From 44bfad0e3aaf8ad8225508f0463b3b89d998029f Mon Sep 17 00:00:00 2001 From: Volodymyr Vygovskyi Date: Wed, 3 Apr 2019 12:22:45 +0300 Subject: [PATCH 0001/1143] #631 Convert CreateCmsPageEntityTest to MFTF --- .../AssertCMSPageContentActionGroup.xml | 12 ++ .../FillOutCMSPageContentActionGroup.xml | 17 ++ .../CmsNewPagePageBasicFieldsSection.xml | 1 + .../Mftf/Section/CmsNewPagePiwSection.xml | 1 + .../Test/AdminCreateCmsPageEntityTest.xml | 146 ++++++++++++++++++ 5 files changed, 177 insertions(+) create mode 100644 app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsPageEntityTest.xml diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageContentActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageContentActionGroup.xml index dde6237390257..e8861ff089faa 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageContentActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageContentActionGroup.xml @@ -23,6 +23,18 @@ + + + + + + + + + {{storeId}} + grabValueFromStoreView + + diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/FillOutCMSPageContentActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/FillOutCMSPageContentActionGroup.xml index e47ff472ccdcb..b1f66f166472e 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/FillOutCMSPageContentActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/FillOutCMSPageContentActionGroup.xml @@ -11,7 +11,24 @@ + + + + + + + + + + + + + + + + + diff --git a/app/code/Magento/Cms/Test/Mftf/Section/CmsNewPagePageBasicFieldsSection.xml b/app/code/Magento/Cms/Test/Mftf/Section/CmsNewPagePageBasicFieldsSection.xml index 7288e5d455d52..92170c447fa11 100644 --- a/app/code/Magento/Cms/Test/Mftf/Section/CmsNewPagePageBasicFieldsSection.xml +++ b/app/code/Magento/Cms/Test/Mftf/Section/CmsNewPagePageBasicFieldsSection.xml @@ -12,6 +12,7 @@ + diff --git a/app/code/Magento/Cms/Test/Mftf/Section/CmsNewPagePiwSection.xml b/app/code/Magento/Cms/Test/Mftf/Section/CmsNewPagePiwSection.xml index bd487e3b2c03c..b22cbbe6b0843 100644 --- a/app/code/Magento/Cms/Test/Mftf/Section/CmsNewPagePiwSection.xml +++ b/app/code/Magento/Cms/Test/Mftf/Section/CmsNewPagePiwSection.xml @@ -11,5 +11,6 @@
+
\ No newline at end of file diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsPageEntityTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsPageEntityTest.xml new file mode 100644 index 0000000000000..253f5e5fb4c67 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsPageEntityTest.xml @@ -0,0 +1,146 @@ + + + + + + + + <description value="Admin should be able to create a CMS Page"/> + <group value="backend"/> + <group value="cMSContent"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <!--Disable single store mode--> + <magentoCLI command="config:set general/single_store_mode/enabled 0" stepKey="disableSingleStoreMode"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <!--Create CMS Content Page--> + <!--Go to New CMS Page page--> + <amOnPage url="{{CmsNewPagePage.url}}" stepKey="navigateToCreateNewPage"/> + <waitForPageLoad stepKey="waitForNewPagePageLoad"/> + <actionGroup ref="FillOutCMSPageContent" stepKey="fillBasicPageData"/> + <!--verify successfully saved--> + <actionGroup ref="saveCmsPage" stepKey="saveNewPage"/> + <!--verify page on frontend--> + <amOnPage url="{{StorefrontHomePage.url}}/{{_duplicatedCMSPage.identifier}}" stepKey="amOnPageTestPage"/> + <actionGroup ref="AssertStoreFrontCMSPage" stepKey="verifyPageDataOnFrontend"> + <argument name="cmsTitle" value="{{_duplicatedCMSPage.title}}"/> + <argument name="cmsContent" value="{{_duplicatedCMSPage.content}}"/> + <argument name="cmsContentHeading" value="{{_duplicatedCMSPage.content_heading}}"/> + </actionGroup> + <!--verify page in grid--> + <actionGroup ref="navigateToCreatedCMSPage" stepKey="verifyPageInGrid"> + <argument name="CMSPage" value="_duplicatedCMSPage"/> + </actionGroup> + <actionGroup ref="DeletePageByUrlKeyActionGroup" stepKey="deletePage"> + <argument name="UrlKey" value="{{_duplicatedCMSPage.identifier}}"/> + </actionGroup> + + <!--Create page for default store view--> + <!--Go to New CMS Page page--> + <amOnPage url="{{CmsNewPagePage.url}}" stepKey="navigateToCreateNewPage2"/> + <waitForPageLoad stepKey="waitForNewPagePageLoad2"/> + <!--Fill the CMS page form--> + <actionGroup ref="FillOutCMSPageContent" stepKey="fillBasicPageDataForPageWithDefaultStore"/> + <actionGroup ref="SelectCMSPageStoreView" stepKey="selectCMSPageStoreView"> + <argument name="storeViewName" value="Default Store View"/> + </actionGroup> + <!--Verify successfully saved--> + <actionGroup ref="saveCmsPage" stepKey="savePageWithDefaultStore"/> + <!--Navigate to page in Admin--> + <actionGroup ref="navigateToCreatedCMSPage" stepKey="navigateToCMSPageWithDefaultStoreInAdmin"> + <argument name="CMSPage" value="_duplicatedCMSPage"/> + </actionGroup> + <!--Verify Page Data in Admin--> + <actionGroup ref="AssertCMSPageContent" stepKey="verifyPageWithDefaultStoreDataInAdmin"/> + <!--Verify Store ID--> + <actionGroup ref="AssertCMSPageStoreId" stepKey="verifyStoreId"> + <argument name="storeId" value="1"/> + </actionGroup> + <!--Delete page--> + <actionGroup ref="DeletePageByUrlKeyActionGroup" stepKey="deletePageWithDefaultStore"> + <argument name="UrlKey" value="{{_duplicatedCMSPage.identifier}}"/> + </actionGroup> + + <!--Block Cache Exploit--> + <!--Go to New CMS Page page--> + <amOnPage url="{{CmsNewPagePage.url}}" stepKey="navigateToCreateNewPage3"/> + <waitForPageLoad stepKey="waitForNewPagePageLoad3"/> + <!--Fill the CMS page form--> + <actionGroup ref="FillOutCMSPageContent" stepKey="fillBasicPageDataForPageWithBlock"/> + <fillField selector="{{CmsNewPagePageContentSection.content}}" userInput="{{block class='Magento\Framework\View\Element\Text' text='bla bla bla' cache_key='BACKEND_ACL_RESOURCES' cache_lifetime=999}}" stepKey="fillFieldContent"/> + <actionGroup ref="SelectCMSPageStoreView" stepKey="selectCMSPageStoreViewForPageWithBlock"> + <argument name="storeViewName" value="Default Store View"/> + </actionGroup> + <!--Verify successfully saved--> + <actionGroup ref="saveCmsPage" stepKey="savePageWithBlock"/> + <!--verify page on frontend--> + <amOnPage url="{{StorefrontHomePage.url}}/{{_duplicatedCMSPage.identifier}}" stepKey="amOnPageWithBlock"/> + <actionGroup ref="AssertStoreFrontCMSPage" stepKey="verifyPageWithBlockDataOnFrontend"> + <argument name="cmsTitle" value="{{_duplicatedCMSPage.title}}"/> + <argument name="cmsContent" value="bla bla bla"/> + <argument name="cmsContentHeading" value="{{_duplicatedCMSPage.content_heading}}"/> + </actionGroup> + <!--Delete page with block--> + <actionGroup ref="DeletePageByUrlKeyActionGroup" stepKey="deletePageWithBlock"> + <argument name="UrlKey" value="{{_duplicatedCMSPage.identifier}}"/> + </actionGroup> + + <!--Create CMS page with single store mode--> + <!--Enable single store mode--> + <magentoCLI command="config:set general/single_store_mode/enabled 1" stepKey="enableSingleStoreMode"/> + <!--Go to New CMS Page page--> + <amOnPage url="{{CmsNewPagePage.url}}" stepKey="navigateToCreateNewPage4"/> + <waitForPageLoad stepKey="waitForNewPagePageLoad4"/> + <!--Fill the CMS page form--> + <actionGroup ref="FillOutCMSPageContent" stepKey="fillBasicPageDataInSingleStoreMode"/> + <!--Verify successfully saved--> + <actionGroup ref="saveCmsPage" stepKey="savePageInSingleStoreMode"/> + <!--verify page on frontend--> + <amOnPage url="{{StorefrontHomePage.url}}/{{_duplicatedCMSPage.identifier}}" stepKey="amOnPageTestPageInSingleStoreMode"/> + <actionGroup ref="AssertStoreFrontCMSPage" stepKey="verifyPageDataOnFrontendInSingleStoreMode"> + <argument name="cmsTitle" value="{{_duplicatedCMSPage.title}}"/> + <argument name="cmsContent" value="{{_duplicatedCMSPage.content}}"/> + <argument name="cmsContentHeading" value="{{_duplicatedCMSPage.content_heading}}"/> + </actionGroup> + <!--Navigate to page in Admin--> + <actionGroup ref="navigateToCreatedCMSPage" stepKey="navigateToCMSPageInAdminInSingleStoreMode"> + <argument name="CMSPage" value="_duplicatedCMSPage"/> + </actionGroup> + <!--Verify Page Data in Admin--> + <actionGroup ref="AssertCMSPageContent" stepKey="verifyPageDataInAdminInSingleStoreMode"/> + <!--Delete page--> + <actionGroup ref="DeletePageByUrlKeyActionGroup" stepKey="deletePageInSingleStoreMode"> + <argument name="UrlKey" value="{{_duplicatedCMSPage.identifier}}"/> + </actionGroup> + + <!--Create disabled page--> + <!--Go to New CMS Page page--> + <amOnPage url="{{CmsNewPagePage.url}}" stepKey="navigateToCreateNewPage5"/> + <waitForPageLoad stepKey="waitForNewPagePageLoad5"/> + <!--Fill the CMS page form--> + <actionGroup ref="FillOutCMSPageContent" stepKey="fillBasicPageDataForDisabledPage"/> + <actionGroup ref="SetCMSPageDisabled" stepKey="setCMSPageDisabled"/> + <!--Verify successfully saved--> + <actionGroup ref="saveCmsPage" stepKey="saveDisabledPage"/> + <!--Check that page is disabled on frontend--> + <amOnPage url="{{StorefrontHomePage.url}}/{{_duplicatedCMSPage.identifier}}" stepKey="amOnDeactivatedPageOnFrontend"/> + <waitForPageLoad stepKey="waitForDeactivatedPageLoadOnFrontend"/> + <see userInput="Whoops, our bad..." stepKey="seePageError"/> + <!--Delete page--> + <actionGroup ref="DeletePageByUrlKeyActionGroup" stepKey="deleteDisabledPage"> + <argument name="UrlKey" value="{{_duplicatedCMSPage.identifier}}"/> + </actionGroup> + </test> +</tests> \ No newline at end of file From fc8d4496ef384d9f9d85e551bfb90a3119bc83ed Mon Sep 17 00:00:00 2001 From: --global <v.vygovskyi@atwix.com> Date: Wed, 3 Apr 2019 12:41:52 +0300 Subject: [PATCH 0002/1143] #631 added mftf_migrated tag --- .../Cms/Test/Mftf/Test/AdminCreateCmsPageEntityTest.xml | 2 +- .../Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.xml | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsPageEntityTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsPageEntityTest.xml index 253f5e5fb4c67..c53344efcc519 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsPageEntityTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsPageEntityTest.xml @@ -97,7 +97,7 @@ <argument name="UrlKey" value="{{_duplicatedCMSPage.identifier}}"/> </actionGroup> - <!--Create CMS page with single store mode--> + <!--Create CMS page in single store mode--> <!--Enable single store mode--> <magentoCLI command="config:set general/single_store_mode/enabled 1" stepKey="enableSingleStoreMode"/> <!--Go to New CMS Page page--> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.xml index 88434bbc009ce..46cc63e417e61 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.xml @@ -15,6 +15,7 @@ <data name="data/identifier" xsi:type="string">identifier-%isolation%</data> <data name="data/store_id" xsi:type="string">All Store Views</data> <data name="data/content/content" xsi:type="string">cms_page_text_content%isolation%</data> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageSuccessSaveMessage" /> <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageInGrid" /> <constraint name="Magento\Cms\Test\Constraint\AssertCmsPagePreview" /> @@ -27,6 +28,7 @@ <data name="data/identifier" xsi:type="string">identifier-%isolation%</data> <data name="data/store_id" xsi:type="string">Main Website/Main Website Store/Default Store View</data> <data name="data/content/content" xsi:type="string">cms_page_text_content%isolation%</data> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageSuccessSaveMessage" /> <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageForm" /> </variation> @@ -38,6 +40,7 @@ <data name="data/store_id" xsi:type="string">Main Website/Main Website Store/Default Store View</data> <data name="data/is_active" xsi:type="string">No</data> <data name="data/content/content" xsi:type="string">cms_page_text_content%isolation%</data> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageSuccessSaveMessage" /> <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageDisabledOnFrontend" /> </variation> @@ -50,6 +53,7 @@ <data name="data/is_active" xsi:type="string">Yes</data> <data name="data/content/content" xsi:type="string">\\{{block class='Magento\Framework\View\Element\Text' text='bla bla bla' cache_key='BACKEND_ACL_RESOURCES' cache_lifetime=999\}}</data> <data name="displayContent" xsi:type="string">bla bla bla</data> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageSuccessSaveMessage" /> <constraint name="Magento\Cms\Test\Constraint\AssertCmsPagePreview" /> <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageOnFrontend" /> @@ -62,6 +66,7 @@ <data name="data/title" xsi:type="string">NewCmsPage%isolation%</data> <data name="data/identifier" xsi:type="string">identifier-%isolation%</data> <data name="data/content/content" xsi:type="string">cms_page_text_content%isolation%</data> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageSuccessSaveMessage" /> <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageFormSingleStoreMode" /> <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageOnFrontend" /> From 49d53277949e4e92e9f85585f11f38d1ba3389df Mon Sep 17 00:00:00 2001 From: Volodymyr Vygovskyi <v.vygovskyi@atwix.com> Date: Fri, 12 Apr 2019 17:20:22 +0300 Subject: [PATCH 0003/1143] refactored according to best practices --- .../AdminCMSPageSetDisabledActionGroup.xml | 14 ++ ...dminCmsPageFillContentFieldActionGroup.xml | 16 ++ ...PageNavigateToCreateNewPageActionGroup.xml | 14 ++ ...nCmsPageSelectPageStoreViewActionGroup.xml | 18 +++ .../AssertCMSPageContentActionGroup.xml | 12 -- .../AssertCMSPageInGridActionGroup.xml | 25 +++ ...ssertCMSPageNotFoundOnFrontActionGroup.xml | 18 +++ .../AssertCMSPageStoreIdActionGroup.xml | 22 +++ .../FillOutCMSPageContentActionGroup.xml | 16 -- ...efrontCMSPageNavigateToPageActionGroup.xml | 16 ++ .../AdminCmsPageCreateDisabledPageTest.xml | 42 +++++ ...inCmsPageCreatePageForDefaultStoreTest.xml | 49 ++++++ ...CmsPageCreatePageInSingleStoreModeTest.xml | 53 +++++++ .../Mftf/Test/AdminCmsPageCreatePageTest.xml | 47 ++++++ .../AdminCmsPageCreatePageWithBlockTest.xml | 50 ++++++ .../Test/AdminCreateCmsPageEntityTest.xml | 146 ------------------ .../Store/Test/Mftf/Data/StoreConfigData.xml | 21 +++ .../Test/TestCase/CreateCmsPageEntityTest.xml | 15 +- 18 files changed, 410 insertions(+), 184 deletions(-) create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCMSPageSetDisabledActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCmsPageFillContentFieldActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCmsPageNavigateToCreateNewPageActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCmsPageSelectPageStoreViewActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageInGridActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageNotFoundOnFrontActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageStoreIdActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontCMSPageNavigateToPageActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreateDisabledPageTest.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageForDefaultStoreTest.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageInSingleStoreModeTest.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageTest.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageWithBlockTest.xml delete mode 100644 app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsPageEntityTest.xml create mode 100644 app/code/Magento/Store/Test/Mftf/Data/StoreConfigData.xml diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCMSPageSetDisabledActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCMSPageSetDisabledActionGroup.xml new file mode 100644 index 0000000000000..6005cd5738199 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCMSPageSetDisabledActionGroup.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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCMSPageSetDisabled"> + <seeElement selector="{{CmsNewPagePageBasicFieldsSection.isActive('1')}}" stepKey="seePageIsEnabled" /> + <click selector="{{CmsNewPagePageBasicFieldsSection.isActiveLabel}}" stepKey="setPageDisabled"/> + </actionGroup> +</actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCmsPageFillContentFieldActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCmsPageFillContentFieldActionGroup.xml new file mode 100644 index 0000000000000..7480e791f4145 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCmsPageFillContentFieldActionGroup.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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCmsPageFillContentField"> + <arguments> + <argument name="content" type="string"/> + </arguments> + <fillField selector="{{CmsNewPagePageContentSection.content}}" userInput="{{content}}" stepKey="fillFieldContent"/> + </actionGroup> +</actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCmsPageNavigateToCreateNewPageActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCmsPageNavigateToCreateNewPageActionGroup.xml new file mode 100644 index 0000000000000..432a3b60d9177 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCmsPageNavigateToCreateNewPageActionGroup.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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCmsPageNavigateToCreateNewPage"> + <amOnPage url="{{CmsNewPagePage.url}}" stepKey="navigateToCreateNewPage"/> + <waitForPageLoad stepKey="waitForNewPagePageLoad"/> + </actionGroup> +</actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCmsPageSelectPageStoreViewActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCmsPageSelectPageStoreViewActionGroup.xml new file mode 100644 index 0000000000000..b5b61926b2ba8 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCmsPageSelectPageStoreViewActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCmsPageSelectPageStoreView"> + <arguments> + <argument name="storeViewName" type="string"/> + </arguments> + <click selector="{{CmsNewPagePiwSection.header}}" stepKey="clickPageInWebsites"/> + <waitForElementVisible selector="{{CmsNewPagePiwSection.selectStoreView(storeViewName)}}" stepKey="waitForStoreGridReload"/> + <clickWithLeftButton selector="{{CmsNewPagePiwSection.selectStoreView(storeViewName)}}" stepKey="clickStoreView"/> + </actionGroup> +</actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageContentActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageContentActionGroup.xml index e8861ff089faa..dde6237390257 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageContentActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageContentActionGroup.xml @@ -23,18 +23,6 @@ <executeJS function="(el = document.querySelector('[name=\'identifier\']')) && el['se' + 'tAt' + 'tribute']('data-value', el.value.split('-')[0]);" stepKey="setAttribute" /> <seeElement selector="{{CmsNewPagePageBasicFieldsSection.duplicatedURLKey(_duplicatedCMSPage.title)}}" stepKey="see"/> </actionGroup> - <actionGroup name="AssertCMSPageStoreId"> - <arguments> - <argument name="storeId" type="string"/> - </arguments> - <click selector="{{CmsNewPagePiwSection.header}}" stepKey="clickPageInWebsites"/> - <waitForElementVisible selector="{{CmsNewPagePiwSection.storeIdDropdown}}" stepKey="waitForStoresSectionReload"/> - <grabValueFrom selector="{{CmsNewPagePiwSection.storeIdDropdown}}" stepKey="grabValueFromStoreView"/> - <assertEquals stepKey="assertTitle" message="pass"> - <expectedResult type="string">{{storeId}}</expectedResult> - <actualResult type="variable">grabValueFromStoreView</actualResult> - </assertEquals> - </actionGroup> <actionGroup name="AssertStoreFrontCMSPage"> <arguments> <argument name="cmsTitle" type="string"/> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageInGridActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageInGridActionGroup.xml new file mode 100644 index 0000000000000..bbb8345ffcacd --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageInGridActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertCMSPageInGrid"> + <arguments> + <argument name="identifier" defaultValue=""/> + </arguments> + <amOnPage url="{{CmsPagesPage.url}}" stepKey="navigateToCMSPagesGrid"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + <conditionalClick selector="{{CmsPagesPageActionsSection.clearAllButton}}" dependentSelector="{{CmsPagesPageActionsSection.activeFilters}}" stepKey="clickToResetFilter" visible="true"/> + <waitForPageLoad stepKey="waitForPageLoad2"/> + <conditionalClick selector="//div[contains(@data-role, 'grid-wrapper')]/table/thead/tr/th/span[contains(text(), 'ID')]" dependentSelector="//span[contains(text(), 'ID')]/parent::th[not(contains(@class, '_descend'))]/parent::tr/parent::thead/parent::table/parent::div[contains(@data-role, 'grid-wrapper')]" stepKey="clickToAttemptSortByIdDescending" visible="true"/> + <waitForLoadingMaskToDisappear stepKey="waitForFirstIdSortDescendingToFinish" /> + <!-- Conditional Click again in case it goes from default state to ascending on first click --> + <conditionalClick selector="//div[contains(@data-role, 'grid-wrapper')]/table/thead/tr/th/span[contains(text(), 'ID')]" dependentSelector="//span[contains(text(), 'ID')]/parent::th[not(contains(@class, '_descend'))]/parent::tr/parent::thead/parent::table/parent::div[contains(@data-role, 'grid-wrapper')]" stepKey="secondClickToAttemptSortByIdDescending" visible="true"/> + <waitForLoadingMaskToDisappear stepKey="waitForSecondIdSortDescendingToFinish" /> + <click selector="{{CmsPagesPageActionsSection.select(identifier)}}" stepKey="clickSelectCMSPage" /> + </actionGroup> +</actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageNotFoundOnFrontActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageNotFoundOnFrontActionGroup.xml new file mode 100644 index 0000000000000..a9d12a9721f87 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageNotFoundOnFrontActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertCMSPageNotFoundOnFront"> + <arguments> + <argument name="identifier" type="string"/> + </arguments> + <amOnPage url="{{StorefrontHomePage.url}}/{{identifier}}" stepKey="amOnPageOnStorefront"/> + <waitForPageLoad stepKey="waitForPageLoadOnStorefront"/> + <see userInput="Whoops, our bad..." stepKey="seePageErrorNotFound"/> + </actionGroup> +</actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageStoreIdActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageStoreIdActionGroup.xml new file mode 100644 index 0000000000000..4ef3b75f77082 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageStoreIdActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertCMSPageStoreId"> + <arguments> + <argument name="storeId" type="string"/> + </arguments> + <click selector="{{CmsNewPagePiwSection.header}}" stepKey="clickPageInWebsites"/> + <waitForElementVisible selector="{{CmsNewPagePiwSection.storeIdDropdown}}" stepKey="waitForStoresSectionReload"/> + <grabValueFrom selector="{{CmsNewPagePiwSection.storeIdDropdown}}" stepKey="grabValueFromStoreView"/> + <assertEquals stepKey="assertTitle" message="pass"> + <expectedResult type="string">{{storeId}}</expectedResult> + <actualResult type="variable">grabValueFromStoreView</actualResult> + </assertEquals> + </actionGroup> +</actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/FillOutCMSPageContentActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/FillOutCMSPageContentActionGroup.xml index b1f66f166472e..173c81a1e049a 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/FillOutCMSPageContentActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/FillOutCMSPageContentActionGroup.xml @@ -15,20 +15,4 @@ <click selector="{{CmsNewPagePageSeoSection.header}}" stepKey="clickExpandSearchEngineOptimisation"/> <fillField selector="{{CmsNewPagePageSeoSection.urlKey}}" userInput="{{_duplicatedCMSPage.identifier}}" stepKey="fillFieldUrlKey"/> </actionGroup> - <actionGroup name="SetCMSPageDisabled"> - <seeElement selector="{{CmsNewPagePageBasicFieldsSection.isActive('1')}}" stepKey="seePageIsEnabled" /> - <click selector="{{CmsNewPagePageBasicFieldsSection.isActiveLabel}}" stepKey="setPageDisabled"/> - </actionGroup> - <actionGroup name="SetCMSPageEnabled"> - <seeElement selector="{{CmsNewPagePageBasicFieldsSection.isActive('0')}}" stepKey="seePageIsDisabled" /> - <click selector="{{CmsNewPagePageBasicFieldsSection.isActiveLabel}}" stepKey="setPageEnabled"/> - </actionGroup> - <actionGroup name="SelectCMSPageStoreView"> - <arguments> - <argument name="storeViewName" type="string"/> - </arguments> - <click selector="{{CmsNewPagePiwSection.header}}" stepKey="clickPageInWebsites"/> - <waitForElementVisible selector="{{CmsNewPagePiwSection.selectStoreView(storeViewName)}}" stepKey="waitForStoreGridReload"/> - <clickWithLeftButton selector="{{CmsNewPagePiwSection.selectStoreView(storeViewName)}}" stepKey="clickStoreView"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontCMSPageNavigateToPageActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontCMSPageNavigateToPageActionGroup.xml new file mode 100644 index 0000000000000..c27fe2f316ec9 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontCMSPageNavigateToPageActionGroup.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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCMSPageNavigateToPage"> + <arguments> + <argument name="identifier" type="string"/> + </arguments> + <amOnPage url="{{StorefrontHomePage.url}}/{{identifier}}" stepKey="amOnCmsPageOnStorefront"/> + </actionGroup> +</actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreateDisabledPageTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreateDisabledPageTest.xml new file mode 100644 index 0000000000000..cee38905f49ba --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreateDisabledPageTest.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCmsPageCreateDisabledPageTest"> + <annotations> + <features value="Cms"/> + <title value="Create disabled CMS Page via the Admin"/> + <description value="Admin should be able to create a CMS Page"/> + <group value="backend"/> + <group value="cMSContent"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!--Go to New CMS Page page--> + <actionGroup ref="AdminCmsPageNavigateToCreateNewPage" stepKey="navigateToCreateNewPage"/> + <!--Fill the CMS page form--> + <actionGroup ref="FillOutCMSPageContent" stepKey="fillBasicPageDataForDisabledPage"/> + <!--Set page disabled--> + <actionGroup ref="AdminCMSPageSetDisabled" stepKey="setCMSPageDisabled"/> + <!--Verify successfully saved--> + <actionGroup ref="saveCmsPage" stepKey="saveDisabledPage"/> + <!--Check that page is disabled on frontend--> + <actionGroup ref="AssertCMSPageNotFoundOnFront" stepKey="checkFirstPageNotFoundOnFront"> + <argument name="identifier" value="{{_duplicatedCMSPage.identifier}}"/> + </actionGroup> + <!--Delete page--> + <actionGroup ref="DeletePageByUrlKeyActionGroup" stepKey="deleteDisabledPage"> + <argument name="UrlKey" value="{{_duplicatedCMSPage.identifier}}"/> + </actionGroup> + </test> +</tests> \ No newline at end of file diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageForDefaultStoreTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageForDefaultStoreTest.xml new file mode 100644 index 0000000000000..4863737a39368 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageForDefaultStoreTest.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="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCmsPageCreatePageForDefaultStoreTest"> + <annotations> + <features value="Cms"/> + <title value="Create CMS Page via the Admin for default store"/> + <description value="Admin should be able to create a CMS Page"/> + <group value="backend"/> + <group value="cMSContent"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!--Go to New CMS Page page--> + <actionGroup ref="AdminCmsPageNavigateToCreateNewPage" stepKey="navigateToCreateNewPage"/> + <!--Fill the CMS page form--> + <actionGroup ref="FillOutCMSPageContent" stepKey="fillBasicPageDataForPageWithDefaultStore"/> + <actionGroup ref="AdminCmsPageSelectPageStoreView" stepKey="selectCMSPageStoreView"> + <argument name="storeViewName" value="Default Store View"/> + </actionGroup> + <!--Verify successfully saved--> + <actionGroup ref="saveCmsPage" stepKey="savePageWithDefaultStore"/> + <!--Navigate to page in Admin--> + <actionGroup ref="navigateToCreatedCMSPage" stepKey="navigateToCMSPageWithDefaultStoreInAdmin"> + <argument name="CMSPage" value="_duplicatedCMSPage"/> + </actionGroup> + <!--Verify Page Data in Admin--> + <actionGroup ref="AssertCMSPageContent" stepKey="verifyPageWithDefaultStoreDataInAdmin"/> + <!--Verify Store ID--> + <actionGroup ref="AssertCMSPageStoreId" stepKey="verifyStoreId"> + <argument name="storeId" value="1"/> + </actionGroup> + <!--Delete page--> + <actionGroup ref="DeletePageByUrlKeyActionGroup" stepKey="deletePageWithDefaultStore"> + <argument name="UrlKey" value="{{_duplicatedCMSPage.identifier}}"/> + </actionGroup> + </test> +</tests> \ No newline at end of file diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageInSingleStoreModeTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageInSingleStoreModeTest.xml new file mode 100644 index 0000000000000..913fe4b15fd33 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageInSingleStoreModeTest.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="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCmsPageCreatePageInSingleStoreModeTest"> + <annotations> + <features value="Cms"/> + <title value="Create CMS Page via the Admin in single store mode"/> + <description value="Admin should be able to create a CMS Page"/> + <group value="backend"/> + <group value="cMSContent"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <magentoCLI command="config:set {{StorefrontSingleStoreModeEnabledConfigData.path}} {{StorefrontSingleStoreModeEnabledConfigData.value}}" stepKey="enableSingleStoreMode" /> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <magentoCLI command="config:set {{StorefrontSingleStoreModeDisabledConfigData.path}} {{StorefrontSingleStoreModeDisabledConfigData.value}}" stepKey="enableSingleStoreMode" /> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!--Go to New CMS Page page--> + <actionGroup ref="AdminCmsPageNavigateToCreateNewPage" stepKey="navigateToCreateNewPage"/> + <!--Fill the CMS page form--> + <actionGroup ref="FillOutCMSPageContent" stepKey="fillBasicPageDataForPageWithDefaultStore"/> + <!--Verify successfully saved--> + <actionGroup ref="saveCmsPage" stepKey="savePageInSingleStoreMode"/> + <!--verify page on frontend--> + <actionGroup ref="StorefrontCMSPageNavigateToPage" stepKey="navigateToPageOnStoreFront"> + <argument name="identifier" value="{{_duplicatedCMSPage.identifier}}"/> + </actionGroup> + <actionGroup ref="AssertStoreFrontCMSPage" stepKey="verifyPageDataOnFrontend"> + <argument name="cmsTitle" value="{{_duplicatedCMSPage.title}}"/> + <argument name="cmsContent" value="{{_duplicatedCMSPage.content}}"/> + <argument name="cmsContentHeading" value="{{_duplicatedCMSPage.content_heading}}"/> + </actionGroup> + <!--Navigate to page in Admin--> + <actionGroup ref="navigateToCreatedCMSPage" stepKey="navigateToCMSPageInAdminInSingleStoreMode"> + <argument name="CMSPage" value="_duplicatedCMSPage"/> + </actionGroup> + <!--Verify Page Data in Admin--> + <actionGroup ref="AssertCMSPageContent" stepKey="verifyPageDataInAdminInSingleStoreMode"/> + <!--Delete page--> + <actionGroup ref="DeletePageByUrlKeyActionGroup" stepKey="deletePageInSingleStoreMode"> + <argument name="UrlKey" value="{{_duplicatedCMSPage.identifier}}"/> + </actionGroup> + </test> +</tests> \ No newline at end of file diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageTest.xml new file mode 100644 index 0000000000000..940549d48483a --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageTest.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="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCmsPageCreatePageTest"> + <annotations> + <features value="Cms"/> + <title value="Create CMS Page via the Admin"/> + <description value="Admin should be able to create a CMS Page"/> + <group value="backend"/> + <group value="cMSContent"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!--Go to New CMS Page page--> + <actionGroup ref="AdminCmsPageNavigateToCreateNewPage" stepKey="navigateToCreateNewPage"/> + <actionGroup ref="FillOutCMSPageContent" stepKey="fillBasicPageData"/> + <!--verify successfully saved--> + <actionGroup ref="saveCmsPage" stepKey="saveNewPage"/> + <!--verify page on frontend--> + <actionGroup ref="StorefrontCMSPageNavigateToPage" stepKey="navigateToPageOnStoreFront"> + <argument name="identifier" value="{{_duplicatedCMSPage.identifier}}"/> + </actionGroup> + <actionGroup ref="AssertStoreFrontCMSPage" stepKey="verifyPageDataOnFrontend"> + <argument name="cmsTitle" value="{{_duplicatedCMSPage.title}}"/> + <argument name="cmsContent" value="{{_duplicatedCMSPage.content}}"/> + <argument name="cmsContentHeading" value="{{_duplicatedCMSPage.content_heading}}"/> + </actionGroup> + <!--verify page in grid--> + <actionGroup ref="AssertCMSPageInGrid" stepKey="verifyPageInGrid"> + <argument name="identifier" value="_duplicatedCMSPage.identifier"/> + </actionGroup> + <actionGroup ref="DeletePageByUrlKeyActionGroup" stepKey="deletePage"> + <argument name="UrlKey" value="{{_duplicatedCMSPage.identifier}}"/> + </actionGroup> + </test> +</tests> \ No newline at end of file diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageWithBlockTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageWithBlockTest.xml new file mode 100644 index 0000000000000..7d5046c5c0186 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageWithBlockTest.xml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCmsPageCreatePageWithBlockTest"> + <annotations> + <features value="Cms"/> + <title value="Create CMS Page that contains block content via the Admin"/> + <description value="Admin should be able to create a CMS Page"/> + <group value="backend"/> + <group value="cMSContent"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!--Go to New CMS Page page--> + <actionGroup ref="AdminCmsPageNavigateToCreateNewPage" stepKey="navigateToCreateNewPage"/> + <actionGroup ref="FillOutCMSPageContent" stepKey="fillBasicPageData"/> + <actionGroup ref="AdminCmsPageFillContentField" stepKey="fillContentField"> + <argument name="content" value="{{block class='Magento\Framework\View\Element\Text' text='bla bla bla' cache_key='BACKEND_ACL_RESOURCES' cache_lifetime=999}}"/> + </actionGroup> + <actionGroup ref="AdminCmsPageSelectPageStoreView" stepKey="selectCMSPageStoreViewForPageWithBlock"> + <argument name="storeViewName" value="Default Store View"/> + </actionGroup> + <!--Verify successfully saved--> + <actionGroup ref="saveCmsPage" stepKey="savePageWithBlock"/> + <!--verify page on frontend--> + <actionGroup ref="StorefrontCMSPageNavigateToPage" stepKey="navigateToPageOnStoreFront"> + <argument name="identifier" value="{{_duplicatedCMSPage.identifier}}"/> + </actionGroup> + <actionGroup ref="AssertStoreFrontCMSPage" stepKey="verifyPageWithBlockDataOnFrontend"> + <argument name="cmsTitle" value="{{_duplicatedCMSPage.title}}"/> + <argument name="cmsContent" value="bla bla bla"/> + <argument name="cmsContentHeading" value="{{_duplicatedCMSPage.content_heading}}"/> + </actionGroup> + <!--Delete page with block--> + <actionGroup ref="DeletePageByUrlKeyActionGroup" stepKey="deletePageWithBlock"> + <argument name="UrlKey" value="{{_duplicatedCMSPage.identifier}}"/> + </actionGroup> + </test> +</tests> \ No newline at end of file diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsPageEntityTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsPageEntityTest.xml deleted file mode 100644 index c53344efcc519..0000000000000 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsPageEntityTest.xml +++ /dev/null @@ -1,146 +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="urn:magento:mftf:Test/etc/testSchema.xsd"> - <test name="AdminCreateCmsPageEntityTest"> - <annotations> - <features value="Cms"/> - <title value="Create CMS Page via the Admin"/> - <description value="Admin should be able to create a CMS Page"/> - <group value="backend"/> - <group value="cMSContent"/> - <group value="mtf_migrated"/> - </annotations> - <before> - <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - </before> - <after> - <!--Disable single store mode--> - <magentoCLI command="config:set general/single_store_mode/enabled 0" stepKey="disableSingleStoreMode"/> - <actionGroup ref="logout" stepKey="logout"/> - </after> - - <!--Create CMS Content Page--> - <!--Go to New CMS Page page--> - <amOnPage url="{{CmsNewPagePage.url}}" stepKey="navigateToCreateNewPage"/> - <waitForPageLoad stepKey="waitForNewPagePageLoad"/> - <actionGroup ref="FillOutCMSPageContent" stepKey="fillBasicPageData"/> - <!--verify successfully saved--> - <actionGroup ref="saveCmsPage" stepKey="saveNewPage"/> - <!--verify page on frontend--> - <amOnPage url="{{StorefrontHomePage.url}}/{{_duplicatedCMSPage.identifier}}" stepKey="amOnPageTestPage"/> - <actionGroup ref="AssertStoreFrontCMSPage" stepKey="verifyPageDataOnFrontend"> - <argument name="cmsTitle" value="{{_duplicatedCMSPage.title}}"/> - <argument name="cmsContent" value="{{_duplicatedCMSPage.content}}"/> - <argument name="cmsContentHeading" value="{{_duplicatedCMSPage.content_heading}}"/> - </actionGroup> - <!--verify page in grid--> - <actionGroup ref="navigateToCreatedCMSPage" stepKey="verifyPageInGrid"> - <argument name="CMSPage" value="_duplicatedCMSPage"/> - </actionGroup> - <actionGroup ref="DeletePageByUrlKeyActionGroup" stepKey="deletePage"> - <argument name="UrlKey" value="{{_duplicatedCMSPage.identifier}}"/> - </actionGroup> - - <!--Create page for default store view--> - <!--Go to New CMS Page page--> - <amOnPage url="{{CmsNewPagePage.url}}" stepKey="navigateToCreateNewPage2"/> - <waitForPageLoad stepKey="waitForNewPagePageLoad2"/> - <!--Fill the CMS page form--> - <actionGroup ref="FillOutCMSPageContent" stepKey="fillBasicPageDataForPageWithDefaultStore"/> - <actionGroup ref="SelectCMSPageStoreView" stepKey="selectCMSPageStoreView"> - <argument name="storeViewName" value="Default Store View"/> - </actionGroup> - <!--Verify successfully saved--> - <actionGroup ref="saveCmsPage" stepKey="savePageWithDefaultStore"/> - <!--Navigate to page in Admin--> - <actionGroup ref="navigateToCreatedCMSPage" stepKey="navigateToCMSPageWithDefaultStoreInAdmin"> - <argument name="CMSPage" value="_duplicatedCMSPage"/> - </actionGroup> - <!--Verify Page Data in Admin--> - <actionGroup ref="AssertCMSPageContent" stepKey="verifyPageWithDefaultStoreDataInAdmin"/> - <!--Verify Store ID--> - <actionGroup ref="AssertCMSPageStoreId" stepKey="verifyStoreId"> - <argument name="storeId" value="1"/> - </actionGroup> - <!--Delete page--> - <actionGroup ref="DeletePageByUrlKeyActionGroup" stepKey="deletePageWithDefaultStore"> - <argument name="UrlKey" value="{{_duplicatedCMSPage.identifier}}"/> - </actionGroup> - - <!--Block Cache Exploit--> - <!--Go to New CMS Page page--> - <amOnPage url="{{CmsNewPagePage.url}}" stepKey="navigateToCreateNewPage3"/> - <waitForPageLoad stepKey="waitForNewPagePageLoad3"/> - <!--Fill the CMS page form--> - <actionGroup ref="FillOutCMSPageContent" stepKey="fillBasicPageDataForPageWithBlock"/> - <fillField selector="{{CmsNewPagePageContentSection.content}}" userInput="{{block class='Magento\Framework\View\Element\Text' text='bla bla bla' cache_key='BACKEND_ACL_RESOURCES' cache_lifetime=999}}" stepKey="fillFieldContent"/> - <actionGroup ref="SelectCMSPageStoreView" stepKey="selectCMSPageStoreViewForPageWithBlock"> - <argument name="storeViewName" value="Default Store View"/> - </actionGroup> - <!--Verify successfully saved--> - <actionGroup ref="saveCmsPage" stepKey="savePageWithBlock"/> - <!--verify page on frontend--> - <amOnPage url="{{StorefrontHomePage.url}}/{{_duplicatedCMSPage.identifier}}" stepKey="amOnPageWithBlock"/> - <actionGroup ref="AssertStoreFrontCMSPage" stepKey="verifyPageWithBlockDataOnFrontend"> - <argument name="cmsTitle" value="{{_duplicatedCMSPage.title}}"/> - <argument name="cmsContent" value="bla bla bla"/> - <argument name="cmsContentHeading" value="{{_duplicatedCMSPage.content_heading}}"/> - </actionGroup> - <!--Delete page with block--> - <actionGroup ref="DeletePageByUrlKeyActionGroup" stepKey="deletePageWithBlock"> - <argument name="UrlKey" value="{{_duplicatedCMSPage.identifier}}"/> - </actionGroup> - - <!--Create CMS page in single store mode--> - <!--Enable single store mode--> - <magentoCLI command="config:set general/single_store_mode/enabled 1" stepKey="enableSingleStoreMode"/> - <!--Go to New CMS Page page--> - <amOnPage url="{{CmsNewPagePage.url}}" stepKey="navigateToCreateNewPage4"/> - <waitForPageLoad stepKey="waitForNewPagePageLoad4"/> - <!--Fill the CMS page form--> - <actionGroup ref="FillOutCMSPageContent" stepKey="fillBasicPageDataInSingleStoreMode"/> - <!--Verify successfully saved--> - <actionGroup ref="saveCmsPage" stepKey="savePageInSingleStoreMode"/> - <!--verify page on frontend--> - <amOnPage url="{{StorefrontHomePage.url}}/{{_duplicatedCMSPage.identifier}}" stepKey="amOnPageTestPageInSingleStoreMode"/> - <actionGroup ref="AssertStoreFrontCMSPage" stepKey="verifyPageDataOnFrontendInSingleStoreMode"> - <argument name="cmsTitle" value="{{_duplicatedCMSPage.title}}"/> - <argument name="cmsContent" value="{{_duplicatedCMSPage.content}}"/> - <argument name="cmsContentHeading" value="{{_duplicatedCMSPage.content_heading}}"/> - </actionGroup> - <!--Navigate to page in Admin--> - <actionGroup ref="navigateToCreatedCMSPage" stepKey="navigateToCMSPageInAdminInSingleStoreMode"> - <argument name="CMSPage" value="_duplicatedCMSPage"/> - </actionGroup> - <!--Verify Page Data in Admin--> - <actionGroup ref="AssertCMSPageContent" stepKey="verifyPageDataInAdminInSingleStoreMode"/> - <!--Delete page--> - <actionGroup ref="DeletePageByUrlKeyActionGroup" stepKey="deletePageInSingleStoreMode"> - <argument name="UrlKey" value="{{_duplicatedCMSPage.identifier}}"/> - </actionGroup> - - <!--Create disabled page--> - <!--Go to New CMS Page page--> - <amOnPage url="{{CmsNewPagePage.url}}" stepKey="navigateToCreateNewPage5"/> - <waitForPageLoad stepKey="waitForNewPagePageLoad5"/> - <!--Fill the CMS page form--> - <actionGroup ref="FillOutCMSPageContent" stepKey="fillBasicPageDataForDisabledPage"/> - <actionGroup ref="SetCMSPageDisabled" stepKey="setCMSPageDisabled"/> - <!--Verify successfully saved--> - <actionGroup ref="saveCmsPage" stepKey="saveDisabledPage"/> - <!--Check that page is disabled on frontend--> - <amOnPage url="{{StorefrontHomePage.url}}/{{_duplicatedCMSPage.identifier}}" stepKey="amOnDeactivatedPageOnFrontend"/> - <waitForPageLoad stepKey="waitForDeactivatedPageLoadOnFrontend"/> - <see userInput="Whoops, our bad..." stepKey="seePageError"/> - <!--Delete page--> - <actionGroup ref="DeletePageByUrlKeyActionGroup" stepKey="deleteDisabledPage"> - <argument name="UrlKey" value="{{_duplicatedCMSPage.identifier}}"/> - </actionGroup> - </test> -</tests> \ No newline at end of file diff --git a/app/code/Magento/Store/Test/Mftf/Data/StoreConfigData.xml b/app/code/Magento/Store/Test/Mftf/Data/StoreConfigData.xml new file mode 100644 index 0000000000000..7ec513869ea16 --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/Data/StoreConfigData.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="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> + <entity name="StorefrontSingleStoreModeEnabledConfigData"> + <data key="path">general/single_store_mode/enabled</data> + <data key="scope_id">0</data> + <data key="label">Yes</data> + <data key="value">1</data> + </entity> + <entity name="StorefrontSingleStoreModeDisabledConfigData"> + <data key="path">general/single_store_mode/enabled</data> + <data key="scope_id">0</data> + <data key="label">No</data> + <data key="value">0</data> + </entity> +</entities> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.xml index 46cc63e417e61..bf477e1215486 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.xml @@ -8,44 +8,41 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\Cms\Test\TestCase\CreateCmsPageEntityTest" summary="Create Cms Page" ticketId="MAGETWO-25580"> <variation name="CreateCmsPageEntityTestVariation1" summary="Create CMS Content Page" ticketId="MAGETWO-12399"> - <data name="tag" xsi:type="string">test_type:acceptance_test, test_type:extended_acceptance_test, severity:S1</data> + <data name="tag" xsi:type="string">test_type:acceptance_test, test_type:extended_acceptance_test, severity:S1, mftf_migrated:yes</data> <data name="fixtureType" xsi:type="string">cmsPage</data> <data name="data/is_active" xsi:type="string">Yes</data> <data name="data/title" xsi:type="string">NewCmsPage%isolation%</data> <data name="data/identifier" xsi:type="string">identifier-%isolation%</data> <data name="data/store_id" xsi:type="string">All Store Views</data> <data name="data/content/content" xsi:type="string">cms_page_text_content%isolation%</data> - <data name="tag" xsi:type="string">mftf_migrated:yes</data> <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageSuccessSaveMessage" /> <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageInGrid" /> <constraint name="Magento\Cms\Test\Constraint\AssertCmsPagePreview" /> </variation> <variation name="CreateCmsPageEntityTestVariation2" summary="Create page for default store view"> - <data name="tag" xsi:type="string">severity:S1</data> + <data name="tag" xsi:type="string">severity:S1, mftf_migrated:yes</data> <data name="fixtureType" xsi:type="string">cmsPage</data> <data name="data/is_active" xsi:type="string">Yes</data> <data name="data/title" xsi:type="string">NewCmsPage%isolation%</data> <data name="data/identifier" xsi:type="string">identifier-%isolation%</data> <data name="data/store_id" xsi:type="string">Main Website/Main Website Store/Default Store View</data> <data name="data/content/content" xsi:type="string">cms_page_text_content%isolation%</data> - <data name="tag" xsi:type="string">mftf_migrated:yes</data> <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageSuccessSaveMessage" /> <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageForm" /> </variation> <variation name="CreateCmsPageEntityTestVariation4" summary="Create disabled page"> - <data name="tag" xsi:type="string">severity:S3</data> + <data name="tag" xsi:type="string">severity:S3, mftf_migrated:yes</data> <data name="fixtureType" xsi:type="string">cmsPage</data> <data name="data/title" xsi:type="string">NewCmsPage%isolation%</data> <data name="data/identifier" xsi:type="string">identifier-%isolation%</data> <data name="data/store_id" xsi:type="string">Main Website/Main Website Store/Default Store View</data> <data name="data/is_active" xsi:type="string">No</data> <data name="data/content/content" xsi:type="string">cms_page_text_content%isolation%</data> - <data name="tag" xsi:type="string">mftf_migrated:yes</data> <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageSuccessSaveMessage" /> <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageDisabledOnFrontend" /> </variation> <variation name="CreateCmsPageEntityTestVariation5" summary="Block Cache Exploit" ticketId="MAGETWO-48017"> - <data name="tag" xsi:type="string">severity:S2</data> + <data name="tag" xsi:type="string">severity:S2, mftf_migrated:yes</data> <data name="fixtureType" xsi:type="string">cmsPage</data> <data name="data/title" xsi:type="string">NewCmsPage%isolation%</data> <data name="data/identifier" xsi:type="string">identifier-%isolation%</data> @@ -53,20 +50,18 @@ <data name="data/is_active" xsi:type="string">Yes</data> <data name="data/content/content" xsi:type="string">\\{{block class='Magento\Framework\View\Element\Text' text='bla bla bla' cache_key='BACKEND_ACL_RESOURCES' cache_lifetime=999\}}</data> <data name="displayContent" xsi:type="string">bla bla bla</data> - <data name="tag" xsi:type="string">mftf_migrated:yes</data> <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageSuccessSaveMessage" /> <constraint name="Magento\Cms\Test\Constraint\AssertCmsPagePreview" /> <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageOnFrontend" /> </variation> <variation name="CreateCmsPageEntityTestVariation6" summary="Create CMS page with single store mode" ticketId="MAGETWO-59654"> - <data name="tag" xsi:type="string">test_type:acceptance_test, test_type:extended_acceptance_test</data> + <data name="tag" xsi:type="string">test_type:acceptance_test, test_type:extended_acceptance_test, mftf_migrated:yes</data> <data name="configData" xsi:type="string">enable_single_store_mode</data> <data name="fixtureType" xsi:type="string">cmsPage</data> <data name="data/is_active" xsi:type="string">Yes</data> <data name="data/title" xsi:type="string">NewCmsPage%isolation%</data> <data name="data/identifier" xsi:type="string">identifier-%isolation%</data> <data name="data/content/content" xsi:type="string">cms_page_text_content%isolation%</data> - <data name="tag" xsi:type="string">mftf_migrated:yes</data> <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageSuccessSaveMessage" /> <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageFormSingleStoreMode" /> <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageOnFrontend" /> From 0bb861c55712c38280ef4c750788c7006a6c90eb Mon Sep 17 00:00:00 2001 From: Volodymyr Vygovskyi <v.vygovskyi@atwix.com> Date: Wed, 1 May 2019 11:31:29 +0300 Subject: [PATCH 0004/1143] refactoring, fixing code review notes --- ...xml => AdminDisableCMSPageActionGroup.xml} | 2 +- ...minFillCMSPageContentFieldActionGroup.xml} | 2 +- .../AdminOpenCMSPagesGridActionGroup.xml | 14 +++++++++++ ... AdminOpenCreateNewCMSPageActionGroup.xml} | 2 +- .../AdminSelectCMSPageFromGridActionGroup.xml | 16 ++++++++++++ ...dminSelectCMSPageStoreViewActionGroup.xml} | 2 +- .../AssertCMSPageInGridActionGroup.xml | 25 ------------------- ...MSPageNotFoundOnStorefrontActionGroup.xml} | 7 +----- .../AssertCMSPageStoreIdActionGroup.xml | 2 +- ...l => StorefrontGoToCMSPageActionGroup.xml} | 3 ++- .../Mftf/Section/CmsNewPagePiwSection.xml | 2 +- .../AdminCmsPageCreateDisabledPageTest.xml | 7 +++--- ...inCmsPageCreatePageForDefaultStoreTest.xml | 6 ++--- ...CmsPageCreatePageInSingleStoreModeTest.xml | 6 ++--- .../Mftf/Test/AdminCmsPageCreatePageTest.xml | 9 ++++--- .../AdminCmsPageCreatePageWithBlockTest.xml | 8 +++--- 16 files changed, 59 insertions(+), 54 deletions(-) rename app/code/Magento/Cms/Test/Mftf/ActionGroup/{AdminCMSPageSetDisabledActionGroup.xml => AdminDisableCMSPageActionGroup.xml} (92%) rename app/code/Magento/Cms/Test/Mftf/ActionGroup/{AdminCmsPageFillContentFieldActionGroup.xml => AdminFillCMSPageContentFieldActionGroup.xml} (89%) create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminOpenCMSPagesGridActionGroup.xml rename app/code/Magento/Cms/Test/Mftf/ActionGroup/{AdminCmsPageNavigateToCreateNewPageActionGroup.xml => AdminOpenCreateNewCMSPageActionGroup.xml} (88%) create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminSelectCMSPageFromGridActionGroup.xml rename app/code/Magento/Cms/Test/Mftf/ActionGroup/{AdminCmsPageSelectPageStoreViewActionGroup.xml => AdminSelectCMSPageStoreViewActionGroup.xml} (92%) delete mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageInGridActionGroup.xml rename app/code/Magento/Cms/Test/Mftf/ActionGroup/{AssertCMSPageNotFoundOnFrontActionGroup.xml => AssertCMSPageNotFoundOnStorefrontActionGroup.xml} (57%) rename app/code/Magento/Cms/Test/Mftf/ActionGroup/{StorefrontCMSPageNavigateToPageActionGroup.xml => StorefrontGoToCMSPageActionGroup.xml} (81%) diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCMSPageSetDisabledActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminDisableCMSPageActionGroup.xml similarity index 92% rename from app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCMSPageSetDisabledActionGroup.xml rename to app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminDisableCMSPageActionGroup.xml index 6005cd5738199..53f53227167ee 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCMSPageSetDisabledActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminDisableCMSPageActionGroup.xml @@ -7,7 +7,7 @@ --> <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AdminCMSPageSetDisabled"> + <actionGroup name="AdminDisableCMSPage"> <seeElement selector="{{CmsNewPagePageBasicFieldsSection.isActive('1')}}" stepKey="seePageIsEnabled" /> <click selector="{{CmsNewPagePageBasicFieldsSection.isActiveLabel}}" stepKey="setPageDisabled"/> </actionGroup> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCmsPageFillContentFieldActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminFillCMSPageContentFieldActionGroup.xml similarity index 89% rename from app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCmsPageFillContentFieldActionGroup.xml rename to app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminFillCMSPageContentFieldActionGroup.xml index 7480e791f4145..9bd440695ecf2 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCmsPageFillContentFieldActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminFillCMSPageContentFieldActionGroup.xml @@ -7,7 +7,7 @@ --> <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AdminCmsPageFillContentField"> + <actionGroup name="AdminFillCMSPageContentFieldActionGroup"> <arguments> <argument name="content" type="string"/> </arguments> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminOpenCMSPagesGridActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminOpenCMSPagesGridActionGroup.xml new file mode 100644 index 0000000000000..8b140ea486603 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminOpenCMSPagesGridActionGroup.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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminOpenCMSPagesGridActionGroup"> + <amOnPage url="{{CmsPagesPage.url}}" stepKey="navigateToCMSPagesGrid"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + </actionGroup> +</actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCmsPageNavigateToCreateNewPageActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminOpenCreateNewCMSPageActionGroup.xml similarity index 88% rename from app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCmsPageNavigateToCreateNewPageActionGroup.xml rename to app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminOpenCreateNewCMSPageActionGroup.xml index 432a3b60d9177..c9f97855be79d 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCmsPageNavigateToCreateNewPageActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminOpenCreateNewCMSPageActionGroup.xml @@ -7,7 +7,7 @@ --> <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AdminCmsPageNavigateToCreateNewPage"> + <actionGroup name="AdminOpenCreateNewCMSPageActionGroup"> <amOnPage url="{{CmsNewPagePage.url}}" stepKey="navigateToCreateNewPage"/> <waitForPageLoad stepKey="waitForNewPagePageLoad"/> </actionGroup> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminSelectCMSPageFromGridActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminSelectCMSPageFromGridActionGroup.xml new file mode 100644 index 0000000000000..6a08b8fa89eef --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminSelectCMSPageFromGridActionGroup.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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminSelectCMSPageFromGridActionGroup"> + <arguments> + <argument name="identifier" defaultValue=""/> + </arguments> + <click selector="{{CmsPagesPageActionsSection.select(identifier)}}" stepKey="clickSelectCMSPage" /> + </actionGroup> +</actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCmsPageSelectPageStoreViewActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminSelectCMSPageStoreViewActionGroup.xml similarity index 92% rename from app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCmsPageSelectPageStoreViewActionGroup.xml rename to app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminSelectCMSPageStoreViewActionGroup.xml index b5b61926b2ba8..3e4a67e595c04 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCmsPageSelectPageStoreViewActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminSelectCMSPageStoreViewActionGroup.xml @@ -7,7 +7,7 @@ --> <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AdminCmsPageSelectPageStoreView"> + <actionGroup name="AdminSelectCMSPageStoreViewActionGroup"> <arguments> <argument name="storeViewName" type="string"/> </arguments> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageInGridActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageInGridActionGroup.xml deleted file mode 100644 index bbb8345ffcacd..0000000000000 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageInGridActionGroup.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. - */ ---> -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AssertCMSPageInGrid"> - <arguments> - <argument name="identifier" defaultValue=""/> - </arguments> - <amOnPage url="{{CmsPagesPage.url}}" stepKey="navigateToCMSPagesGrid"/> - <waitForPageLoad stepKey="waitForPageLoad1"/> - <conditionalClick selector="{{CmsPagesPageActionsSection.clearAllButton}}" dependentSelector="{{CmsPagesPageActionsSection.activeFilters}}" stepKey="clickToResetFilter" visible="true"/> - <waitForPageLoad stepKey="waitForPageLoad2"/> - <conditionalClick selector="//div[contains(@data-role, 'grid-wrapper')]/table/thead/tr/th/span[contains(text(), 'ID')]" dependentSelector="//span[contains(text(), 'ID')]/parent::th[not(contains(@class, '_descend'))]/parent::tr/parent::thead/parent::table/parent::div[contains(@data-role, 'grid-wrapper')]" stepKey="clickToAttemptSortByIdDescending" visible="true"/> - <waitForLoadingMaskToDisappear stepKey="waitForFirstIdSortDescendingToFinish" /> - <!-- Conditional Click again in case it goes from default state to ascending on first click --> - <conditionalClick selector="//div[contains(@data-role, 'grid-wrapper')]/table/thead/tr/th/span[contains(text(), 'ID')]" dependentSelector="//span[contains(text(), 'ID')]/parent::th[not(contains(@class, '_descend'))]/parent::tr/parent::thead/parent::table/parent::div[contains(@data-role, 'grid-wrapper')]" stepKey="secondClickToAttemptSortByIdDescending" visible="true"/> - <waitForLoadingMaskToDisappear stepKey="waitForSecondIdSortDescendingToFinish" /> - <click selector="{{CmsPagesPageActionsSection.select(identifier)}}" stepKey="clickSelectCMSPage" /> - </actionGroup> -</actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageNotFoundOnFrontActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageNotFoundOnStorefrontActionGroup.xml similarity index 57% rename from app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageNotFoundOnFrontActionGroup.xml rename to app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageNotFoundOnStorefrontActionGroup.xml index a9d12a9721f87..c0e0a1b599482 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageNotFoundOnFrontActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageNotFoundOnStorefrontActionGroup.xml @@ -7,12 +7,7 @@ --> <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AssertCMSPageNotFoundOnFront"> - <arguments> - <argument name="identifier" type="string"/> - </arguments> - <amOnPage url="{{StorefrontHomePage.url}}/{{identifier}}" stepKey="amOnPageOnStorefront"/> - <waitForPageLoad stepKey="waitForPageLoadOnStorefront"/> + <actionGroup name="AssertCMSPageNotFoundOnStorefrontActionGroup"> <see userInput="Whoops, our bad..." stepKey="seePageErrorNotFound"/> </actionGroup> </actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageStoreIdActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageStoreIdActionGroup.xml index 4ef3b75f77082..4d05d68e5e9b2 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageStoreIdActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageStoreIdActionGroup.xml @@ -7,7 +7,7 @@ --> <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AssertCMSPageStoreId"> + <actionGroup name="AssertCMSPageStoreIdActionGroup"> <arguments> <argument name="storeId" type="string"/> </arguments> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontCMSPageNavigateToPageActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontGoToCMSPageActionGroup.xml similarity index 81% rename from app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontCMSPageNavigateToPageActionGroup.xml rename to app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontGoToCMSPageActionGroup.xml index c27fe2f316ec9..ac27ac89bba14 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontCMSPageNavigateToPageActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontGoToCMSPageActionGroup.xml @@ -7,10 +7,11 @@ --> <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="StorefrontCMSPageNavigateToPage"> + <actionGroup name="StorefrontGoToCMSPageActionGroup"> <arguments> <argument name="identifier" type="string"/> </arguments> <amOnPage url="{{StorefrontHomePage.url}}/{{identifier}}" stepKey="amOnCmsPageOnStorefront"/> + <waitForPageLoad stepKey="waitForPageLoadOnStorefront"/> </actionGroup> </actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Cms/Test/Mftf/Section/CmsNewPagePiwSection.xml b/app/code/Magento/Cms/Test/Mftf/Section/CmsNewPagePiwSection.xml index b22cbbe6b0843..cccdbaddfb4d2 100644 --- a/app/code/Magento/Cms/Test/Mftf/Section/CmsNewPagePiwSection.xml +++ b/app/code/Magento/Cms/Test/Mftf/Section/CmsNewPagePiwSection.xml @@ -11,6 +11,6 @@ <section name="CmsNewPagePiwSection"> <element name="header" type="button" selector="div[data-index=websites]" timeout="30"/> <element name="selectStoreView" type="select" selector="//option[contains(text(),'{{var1}}')]" parameterized="true"/> - <element name="storeIdDropdown" type="select" selector="select[name='store_id']"/> + <element name="storeIdDropdown" type="select" selector="//div[@data-bind="scope: 'cms_page_form.cms_page_form'"]//select[@name='store_id']"/> </section> </sections> \ No newline at end of file diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreateDisabledPageTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreateDisabledPageTest.xml index cee38905f49ba..6227b99a402a1 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreateDisabledPageTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreateDisabledPageTest.xml @@ -23,17 +23,18 @@ <actionGroup ref="logout" stepKey="logout"/> </after> <!--Go to New CMS Page page--> - <actionGroup ref="AdminCmsPageNavigateToCreateNewPage" stepKey="navigateToCreateNewPage"/> + <actionGroup ref="AdminOpenCreateNewCMSPageActionGroup" stepKey="navigateToCreateNewPage"/> <!--Fill the CMS page form--> <actionGroup ref="FillOutCMSPageContent" stepKey="fillBasicPageDataForDisabledPage"/> <!--Set page disabled--> - <actionGroup ref="AdminCMSPageSetDisabled" stepKey="setCMSPageDisabled"/> + <actionGroup ref="AdminDisableCMSPage" stepKey="setCMSPageDisabled"/> <!--Verify successfully saved--> <actionGroup ref="saveCmsPage" stepKey="saveDisabledPage"/> <!--Check that page is disabled on frontend--> - <actionGroup ref="AssertCMSPageNotFoundOnFront" stepKey="checkFirstPageNotFoundOnFront"> + <actionGroup ref="StorefrontGoToCMSPageActionGroup" stepKey="goToCMSPageOnStorefront"> <argument name="identifier" value="{{_duplicatedCMSPage.identifier}}"/> </actionGroup> + <actionGroup ref="AssertCMSPageNotFoundOnStorefrontActionGroup" stepKey="seeNotFoundError"/> <!--Delete page--> <actionGroup ref="DeletePageByUrlKeyActionGroup" stepKey="deleteDisabledPage"> <argument name="UrlKey" value="{{_duplicatedCMSPage.identifier}}"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageForDefaultStoreTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageForDefaultStoreTest.xml index 4863737a39368..8b1b7fa482a6e 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageForDefaultStoreTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageForDefaultStoreTest.xml @@ -23,10 +23,10 @@ <actionGroup ref="logout" stepKey="logout"/> </after> <!--Go to New CMS Page page--> - <actionGroup ref="AdminCmsPageNavigateToCreateNewPage" stepKey="navigateToCreateNewPage"/> + <actionGroup ref="AdminOpenCreateNewCMSPageActionGroup" stepKey="navigateToCreateNewPage"/> <!--Fill the CMS page form--> <actionGroup ref="FillOutCMSPageContent" stepKey="fillBasicPageDataForPageWithDefaultStore"/> - <actionGroup ref="AdminCmsPageSelectPageStoreView" stepKey="selectCMSPageStoreView"> + <actionGroup ref="AdminSelectCMSPageStoreViewActionGroup" stepKey="selectCMSPageStoreView"> <argument name="storeViewName" value="Default Store View"/> </actionGroup> <!--Verify successfully saved--> @@ -38,7 +38,7 @@ <!--Verify Page Data in Admin--> <actionGroup ref="AssertCMSPageContent" stepKey="verifyPageWithDefaultStoreDataInAdmin"/> <!--Verify Store ID--> - <actionGroup ref="AssertCMSPageStoreId" stepKey="verifyStoreId"> + <actionGroup ref="AssertCMSPageStoreIdActionGroup" stepKey="verifyStoreId"> <argument name="storeId" value="1"/> </actionGroup> <!--Delete page--> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageInSingleStoreModeTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageInSingleStoreModeTest.xml index 913fe4b15fd33..2ba101f82e248 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageInSingleStoreModeTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageInSingleStoreModeTest.xml @@ -21,17 +21,17 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <magentoCLI command="config:set {{StorefrontSingleStoreModeDisabledConfigData.path}} {{StorefrontSingleStoreModeDisabledConfigData.value}}" stepKey="enableSingleStoreMode" /> + <magentoCLI command="config:set {{StorefrontSingleStoreModeDisabledConfigData.path}} {{StorefrontSingleStoreModeDisabledConfigData.value}}" stepKey="disableSingleStoreMode" /> <actionGroup ref="logout" stepKey="logout"/> </after> <!--Go to New CMS Page page--> - <actionGroup ref="AdminCmsPageNavigateToCreateNewPage" stepKey="navigateToCreateNewPage"/> + <actionGroup ref="AdminOpenCreateNewCMSPageActionGroup" stepKey="navigateToCreateNewPage"/> <!--Fill the CMS page form--> <actionGroup ref="FillOutCMSPageContent" stepKey="fillBasicPageDataForPageWithDefaultStore"/> <!--Verify successfully saved--> <actionGroup ref="saveCmsPage" stepKey="savePageInSingleStoreMode"/> <!--verify page on frontend--> - <actionGroup ref="StorefrontCMSPageNavigateToPage" stepKey="navigateToPageOnStoreFront"> + <actionGroup ref="StorefrontGoToCMSPageActionGroup" stepKey="navigateToPageOnStoreFront"> <argument name="identifier" value="{{_duplicatedCMSPage.identifier}}"/> </actionGroup> <actionGroup ref="AssertStoreFrontCMSPage" stepKey="verifyPageDataOnFrontend"> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageTest.xml index 940549d48483a..260bfea1f2b49 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageTest.xml @@ -23,12 +23,12 @@ <actionGroup ref="logout" stepKey="logout"/> </after> <!--Go to New CMS Page page--> - <actionGroup ref="AdminCmsPageNavigateToCreateNewPage" stepKey="navigateToCreateNewPage"/> + <actionGroup ref="AdminOpenCreateNewCMSPageActionGroup" stepKey="navigateToCreateNewPage"/> <actionGroup ref="FillOutCMSPageContent" stepKey="fillBasicPageData"/> <!--verify successfully saved--> <actionGroup ref="saveCmsPage" stepKey="saveNewPage"/> <!--verify page on frontend--> - <actionGroup ref="StorefrontCMSPageNavigateToPage" stepKey="navigateToPageOnStoreFront"> + <actionGroup ref="StorefrontGoToCMSPageActionGroup" stepKey="navigateToPageOnStoreFront"> <argument name="identifier" value="{{_duplicatedCMSPage.identifier}}"/> </actionGroup> <actionGroup ref="AssertStoreFrontCMSPage" stepKey="verifyPageDataOnFrontend"> @@ -37,7 +37,10 @@ <argument name="cmsContentHeading" value="{{_duplicatedCMSPage.content_heading}}"/> </actionGroup> <!--verify page in grid--> - <actionGroup ref="AssertCMSPageInGrid" stepKey="verifyPageInGrid"> + <actionGroup ref="AdminOpenCMSPagesGridActionGroup" stepKey="openCMSPagesGridActionGroup"/> + <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearGridFilters"/> + <actionGroup ref="SortByIdDescendingActionGroup" stepKey="sortGridByIdDescending"/> + <actionGroup ref="AdminSelectCMSPageFromGridActionGroup" stepKey="verifyPageInGrid"> <argument name="identifier" value="_duplicatedCMSPage.identifier"/> </actionGroup> <actionGroup ref="DeletePageByUrlKeyActionGroup" stepKey="deletePage"> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageWithBlockTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageWithBlockTest.xml index 7d5046c5c0186..b7ab6f3b67e7c 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageWithBlockTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageWithBlockTest.xml @@ -23,18 +23,18 @@ <actionGroup ref="logout" stepKey="logout"/> </after> <!--Go to New CMS Page page--> - <actionGroup ref="AdminCmsPageNavigateToCreateNewPage" stepKey="navigateToCreateNewPage"/> + <actionGroup ref="AdminOpenCreateNewCMSPageActionGroup" stepKey="navigateToCreateNewPage"/> <actionGroup ref="FillOutCMSPageContent" stepKey="fillBasicPageData"/> - <actionGroup ref="AdminCmsPageFillContentField" stepKey="fillContentField"> + <actionGroup ref="AdminFillCMSPageContentFieldActionGroup" stepKey="fillContentField"> <argument name="content" value="{{block class='Magento\Framework\View\Element\Text' text='bla bla bla' cache_key='BACKEND_ACL_RESOURCES' cache_lifetime=999}}"/> </actionGroup> - <actionGroup ref="AdminCmsPageSelectPageStoreView" stepKey="selectCMSPageStoreViewForPageWithBlock"> + <actionGroup ref="AdminSelectCMSPageStoreViewActionGroup" stepKey="selectCMSPageStoreViewForPageWithBlock"> <argument name="storeViewName" value="Default Store View"/> </actionGroup> <!--Verify successfully saved--> <actionGroup ref="saveCmsPage" stepKey="savePageWithBlock"/> <!--verify page on frontend--> - <actionGroup ref="StorefrontCMSPageNavigateToPage" stepKey="navigateToPageOnStoreFront"> + <actionGroup ref="StorefrontGoToCMSPageActionGroup" stepKey="navigateToPageOnStoreFront"> <argument name="identifier" value="{{_duplicatedCMSPage.identifier}}"/> </actionGroup> <actionGroup ref="AssertStoreFrontCMSPage" stepKey="verifyPageWithBlockDataOnFrontend"> From ab8b8bd4a34b7d069f548b2976589741ec8d47be Mon Sep 17 00:00:00 2001 From: Volodymyr Vygovskyi <v.vygovskyi@atwix.com> Date: Wed, 1 May 2019 11:38:20 +0300 Subject: [PATCH 0005/1143] minor refactoring --- ...abledPageTest.xml => AdminCMSPageCreateDisabledPageTest.xml} | 2 +- ...reTest.xml => AdminCMSPageCreatePageForDefaultStoreTest.xml} | 2 +- ...Test.xml => AdminCMSPageCreatePageInSingleStoreModeTest.xml} | 2 +- ...CmsPageCreatePageTest.xml => AdminCMSPageCreatePageTest.xml} | 2 +- ...ithBlockTest.xml => AdminCMSPageCreatePageWithBlockTest.xml} | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) rename app/code/Magento/Cms/Test/Mftf/Test/{AdminCmsPageCreateDisabledPageTest.xml => AdminCMSPageCreateDisabledPageTest.xml} (97%) rename app/code/Magento/Cms/Test/Mftf/Test/{AdminCmsPageCreatePageForDefaultStoreTest.xml => AdminCMSPageCreatePageForDefaultStoreTest.xml} (97%) rename app/code/Magento/Cms/Test/Mftf/Test/{AdminCmsPageCreatePageInSingleStoreModeTest.xml => AdminCMSPageCreatePageInSingleStoreModeTest.xml} (97%) rename app/code/Magento/Cms/Test/Mftf/Test/{AdminCmsPageCreatePageTest.xml => AdminCMSPageCreatePageTest.xml} (98%) rename app/code/Magento/Cms/Test/Mftf/Test/{AdminCmsPageCreatePageWithBlockTest.xml => AdminCMSPageCreatePageWithBlockTest.xml} (97%) diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreateDisabledPageTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreateDisabledPageTest.xml similarity index 97% rename from app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreateDisabledPageTest.xml rename to app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreateDisabledPageTest.xml index 6227b99a402a1..3a9427349c0fa 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreateDisabledPageTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreateDisabledPageTest.xml @@ -7,7 +7,7 @@ --> <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> - <test name="AdminCmsPageCreateDisabledPageTest"> + <test name="AdminCMSPageCreateDisabledPageTest"> <annotations> <features value="Cms"/> <title value="Create disabled CMS Page via the Admin"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageForDefaultStoreTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageForDefaultStoreTest.xml similarity index 97% rename from app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageForDefaultStoreTest.xml rename to app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageForDefaultStoreTest.xml index 8b1b7fa482a6e..eaab13202c89d 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageForDefaultStoreTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageForDefaultStoreTest.xml @@ -7,7 +7,7 @@ --> <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> - <test name="AdminCmsPageCreatePageForDefaultStoreTest"> + <test name="AdminCMSPageCreatePageForDefaultStoreTest"> <annotations> <features value="Cms"/> <title value="Create CMS Page via the Admin for default store"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageInSingleStoreModeTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageInSingleStoreModeTest.xml similarity index 97% rename from app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageInSingleStoreModeTest.xml rename to app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageInSingleStoreModeTest.xml index 2ba101f82e248..a550ce6f4a9c5 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageInSingleStoreModeTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageInSingleStoreModeTest.xml @@ -7,7 +7,7 @@ --> <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> - <test name="AdminCmsPageCreatePageInSingleStoreModeTest"> + <test name="AdminCMSPageCreatePageInSingleStoreModeTest"> <annotations> <features value="Cms"/> <title value="Create CMS Page via the Admin in single store mode"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageTest.xml similarity index 98% rename from app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageTest.xml rename to app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageTest.xml index 260bfea1f2b49..4e1a5b5ed6422 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageTest.xml @@ -7,7 +7,7 @@ --> <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> - <test name="AdminCmsPageCreatePageTest"> + <test name="AdminCMSPageCreatePageTest"> <annotations> <features value="Cms"/> <title value="Create CMS Page via the Admin"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageWithBlockTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageWithBlockTest.xml similarity index 97% rename from app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageWithBlockTest.xml rename to app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageWithBlockTest.xml index b7ab6f3b67e7c..c4112111aa839 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageCreatePageWithBlockTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageWithBlockTest.xml @@ -7,7 +7,7 @@ --> <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> - <test name="AdminCmsPageCreatePageWithBlockTest"> + <test name="AdminCMSPageCreatePageWithBlockTest"> <annotations> <features value="Cms"/> <title value="Create CMS Page that contains block content via the Admin"/> From 3f0a6b2fffaabbade27e8044b6bcaa6d92bd8952 Mon Sep 17 00:00:00 2001 From: Volodymyr Vygovskyi <v.vygovskyi@atwix.com> Date: Wed, 1 May 2019 16:56:02 +0300 Subject: [PATCH 0006/1143] updated stepkey name in AdminOpenCMSPagesGridActionGroup --- .../Test/Mftf/ActionGroup/AdminOpenCMSPagesGridActionGroup.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminOpenCMSPagesGridActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminOpenCMSPagesGridActionGroup.xml index 8b140ea486603..fe5c6202c977d 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminOpenCMSPagesGridActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminOpenCMSPagesGridActionGroup.xml @@ -9,6 +9,6 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="AdminOpenCMSPagesGridActionGroup"> <amOnPage url="{{CmsPagesPage.url}}" stepKey="navigateToCMSPagesGrid"/> - <waitForPageLoad stepKey="waitForPageLoad1"/> + <waitForPageLoad stepKey="waitForPageLoad"/> </actionGroup> </actionGroups> \ No newline at end of file From ae520b8575e5d07ceb758c93bdb470a874568ebc Mon Sep 17 00:00:00 2001 From: Volodymyr Vygovskyi <v.vygovskyi@atwix.com> Date: Wed, 15 May 2019 11:07:15 +0300 Subject: [PATCH 0007/1143] fixed AdminCMSPageCreateDisabledPageTest after the merge --- .../Cms/Test/Mftf/Test/AdminCMSPageCreateDisabledPageTest.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreateDisabledPageTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreateDisabledPageTest.xml index 3a9427349c0fa..2f609f7a88b43 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreateDisabledPageTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreateDisabledPageTest.xml @@ -24,10 +24,10 @@ </after> <!--Go to New CMS Page page--> <actionGroup ref="AdminOpenCreateNewCMSPageActionGroup" stepKey="navigateToCreateNewPage"/> - <!--Fill the CMS page form--> - <actionGroup ref="FillOutCMSPageContent" stepKey="fillBasicPageDataForDisabledPage"/> <!--Set page disabled--> <actionGroup ref="AdminDisableCMSPage" stepKey="setCMSPageDisabled"/> + <!--Fill the CMS page form--> + <actionGroup ref="FillOutCMSPageContent" stepKey="fillBasicPageDataForDisabledPage"/> <!--Verify successfully saved--> <actionGroup ref="saveCmsPage" stepKey="saveDisabledPage"/> <!--Check that page is disabled on frontend--> From 0105e4c59d5606662a100580c4627e29f6f999cf Mon Sep 17 00:00:00 2001 From: Denis Kopylov <dkopylov@magenius.team> Date: Thu, 23 May 2019 17:11:41 +0300 Subject: [PATCH 0008/1143] [Catalog|Sales] Fix wrong behavior of grid row click event --- .../web/catalog/category/assign-products.js | 19 +- .../adminhtml/web/order/create/scripts.js | 445 +++++++++--------- lib/web/mage/adminhtml/grid.js | 89 ++-- 3 files changed, 293 insertions(+), 260 deletions(-) diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/assign-products.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/assign-products.js index 829c04c13106d..598bde9106231 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/assign-products.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/assign-products.js @@ -51,15 +51,28 @@ define([ */ function categoryProductRowClick(grid, event) { var trElement = Event.findElement(event, 'tr'), - isInput = Event.element(event).tagName === 'INPUT', + eventElement = Event.element(event), + isInputCheckbox = eventElement.tagName === 'INPUT' && eventElement.type === 'checkbox', + isInputPosition = grid.targetElement + && grid.targetElement.tagName === 'INPUT' + && grid.targetElement.name === 'position', checked = false, checkbox = null; - if (trElement) { + if (eventElement.tagName === 'LABEL' + && trElement.querySelector('#' + eventElement.htmlFor) + && trElement.querySelector('#' + eventElement.htmlFor).type === 'checkbox' + ) { + event.stopPropagation(); + trElement.querySelector('#' + eventElement.htmlFor).trigger('click'); + return; + } + + if (trElement && !isInputPosition) { checkbox = Element.getElementsBySelector(trElement, 'input'); if (checkbox[0]) { - checked = isInput ? checkbox[0].checked : !checkbox[0].checked; + checked = isInputCheckbox ? checkbox[0].checked : !checkbox[0].checked; gridJsObject.setCheckboxChecked(checkbox[0], checked); } } diff --git a/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js b/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js index c508a5ecdfa58..d6221b8914449 100644 --- a/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js +++ b/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js @@ -19,17 +19,17 @@ define([ window.AdminOrder = new Class.create(); AdminOrder.prototype = { - initialize : function(data){ - if(!data) data = {}; - this.loadBaseUrl = false; - this.customerId = data.customer_id ? data.customer_id : false; - this.storeId = data.store_id ? data.store_id : false; - this.quoteId = data['quote_id'] ? data['quote_id'] : false; - this.currencyId = false; + initialize: function (data) { + if (!data) data = {}; + this.loadBaseUrl = false; + this.customerId = data.customer_id ? data.customer_id : false; + this.storeId = data.store_id ? data.store_id : false; + this.quoteId = data['quote_id'] ? data['quote_id'] : false; + this.currencyId = false; this.currencySymbol = data.currency_symbol ? data.currency_symbol : ''; - this.addresses = data.addresses ? data.addresses : $H({}); + this.addresses = data.addresses ? data.addresses : $H({}); this.shippingAsBilling = data.shippingAsBilling ? data.shippingAsBilling : false; - this.gridProducts = $H({}); + this.gridProducts = $H({}); this.gridProductsGift = $H({}); this.billingAddressContainer = ''; this.shippingAddressContainer = ''; @@ -55,10 +55,10 @@ define([ } }); - jQuery.async('#order-items', (function(){ + jQuery.async('#order-items', (function () { this.dataArea = new OrderFormArea('data', $(this.getAreaId('data')), this); this.itemsArea = Object.extend(new OrderFormArea('items', $(this.getAreaId('items')), this), { - addControlButton: function(button){ + addControlButton: function (button) { var controlButtonArea = $(this.node).select('.actions')[0]; if (typeof controlButtonArea != 'undefined') { var buttons = controlButtonArea.childElements(); @@ -75,7 +75,7 @@ define([ var searchButtonId = 'add_products', searchButton = new ControlButton(jQuery.mage.__('Add Products'), searchButtonId), searchAreaId = this.getAreaId('search'); - searchButton.onClick = function() { + searchButton.onClick = function () { $(searchAreaId).show(); var el = this; window.setTimeout(function () { @@ -84,13 +84,13 @@ define([ }; if (jQuery('#' + this.getAreaId('items')).is(':visible')) { - this.dataArea.onLoad = this.dataArea.onLoad.wrap(function(proceed) { + this.dataArea.onLoad = this.dataArea.onLoad.wrap(function (proceed) { proceed(); this._parent.itemsArea.setNode($(this._parent.getAreaId('items'))); this._parent.itemsArea.onLoad(); }); - this.itemsArea.onLoad = this.itemsArea.onLoad.wrap(function(proceed) { + this.itemsArea.onLoad = this.itemsArea.onLoad.wrap(function (proceed) { proceed(); if ($(searchAreaId) && !$(searchAreaId).visible() && !$(searchButtonId)) { this.addControlButton(searchButton); @@ -102,35 +102,35 @@ define([ }).bind(this)); jQuery('#edit_form') - .on('submitOrder', function(){ + .on('submitOrder', function () { jQuery(this).trigger('realOrder'); }) .on('realOrder', this._realSubmit.bind(this)); }, - areasLoaded: function(){ + areasLoaded: function () { }, - itemsLoaded: function(){ + itemsLoaded: function () { }, - dataLoaded: function(){ + dataLoaded: function () { this.dataShow(); }, - setLoadBaseUrl : function(url){ + setLoadBaseUrl: function (url) { this.loadBaseUrl = url; }, - setAddresses : function(addresses){ + setAddresses: function (addresses) { this.addresses = addresses; }, - addExcludedPaymentMethod : function(method){ + addExcludedPaymentMethod: function (method) { this.excludedPaymentMethods.push(method); }, - setCustomerId : function(id){ + setCustomerId: function (id) { this.customerId = id; this.loadArea('header', true); $(this.getAreaId('header')).callback = 'setCustomerAfter'; @@ -138,18 +138,17 @@ define([ $('reset_order_top_button').show(); }, - setCustomerAfter : function () { + setCustomerAfter: function () { this.customerSelectorHide(); if (this.storeId) { $(this.getAreaId('data')).callback = 'dataLoaded'; this.loadArea(['data'], true); - } - else { + } else { this.storeSelectorShow(); } }, - setStoreId : function(id){ + setStoreId: function (id) { this.storeId = id; this.storeSelectorHide(); this.sidebarShow(); @@ -158,26 +157,25 @@ define([ this.loadArea(['header', 'data'], true); }, - setCurrencyId : function(id){ + setCurrencyId: function (id) { this.currencyId = id; //this.loadArea(['sidebar', 'data'], true); this.loadArea(['data'], true); }, - setCurrencySymbol : function(symbol){ + setCurrencySymbol: function (symbol) { this.currencySymbol = symbol; }, - selectAddress : function(el, container){ + selectAddress: function (el, container) { id = el.value; if (id.length == 0) { id = '0'; } - if(this.addresses[id]){ + if (this.addresses[id]) { this.fillAddressFields(container, this.addresses[id]); - } - else{ + } else { this.fillAddressFields(container, {}); } @@ -187,7 +185,7 @@ define([ this.resetPaymentMethod(); if (this.isShippingField(container) && !this.isShippingMethodReseted) { this.resetShippingMethod(data); - } else{ + } else { this.saveData(data); } }, @@ -313,13 +311,13 @@ define([ }); }, - fillAddressFields: function(container, data){ + fillAddressFields: function (container, data) { var regionIdElem = false; var regionIdElemValue = false; var fields = $(container).select('input', 'select', 'textarea'); var re = /[^\[]*\[[^\]]*\]\[([^\]]*)\](\[(\d)\])?/; - for(var i=0;i<fields.length;i++){ + for (var i = 0; i < fields.length; i++) { // skip input type file @Security error code: 1000 if (fields[i].tagName.toLowerCase() == 'input' && fields[i].type.toLowerCase() == 'file') { continue; @@ -331,9 +329,9 @@ define([ var name = matchRes[1]; var index = matchRes[3]; - if (index){ + if (index) { // multiply line - if (data[name]){ + if (data[name]) { var values = data[name].split("\n"); fields[i].value = values[index] ? values[index] : ''; } else { @@ -358,7 +356,7 @@ define([ fields[i].changeUpdater(); } - if (name == 'region' && data['region_id'] && !data['region']){ + if (name == 'region' && data['region_id'] && !data['region']) { fields[i].value = data['region_id']; } @@ -366,7 +364,7 @@ define([ } }, - disableShippingAddress : function(flag) { + disableShippingAddress: function (flag) { this.shippingAsBilling = flag; if ($('order-shipping_address_customer_address_id')) { $('order-shipping_address_customer_address_id').disabled = flag; @@ -376,7 +374,7 @@ define([ for (var i = 0; i < dataFields.length; i++) { dataFields[i].disabled = flag; - if(this.isOnlyVirtualProduct) { + if (this.isOnlyVirtualProduct) { dataFields[i].setValue(''); } } @@ -433,8 +431,8 @@ define([ */ loadShippingRates: function () { var addressContainer = this.shippingAsBilling ? - 'billingAddressContainer' : - 'shippingAddressContainer', + 'billingAddressContainer' : + 'shippingAddressContainer', data = this.serializeData(this[addressContainer]).toObject(); data['collect_shipping_rates'] = 1; @@ -444,7 +442,7 @@ define([ return false; }, - setShippingMethod: function(method) { + setShippingMethod: function (method) { var data = {}; data['order[shipping_method]'] = method; @@ -461,18 +459,18 @@ define([ * * @return boolean */ - loadPaymentMethods: function() { + loadPaymentMethods: function () { var data = this.serializeData(this.billingAddressContainer).toObject(); - this.loadArea(['billing_method','totals'], true, data); + this.loadArea(['billing_method', 'totals'], true, data); return false; }, - switchPaymentMethod: function(method){ + switchPaymentMethod: function (method) { jQuery('#edit_form') .off('submitOrder') - .on('submitOrder', function(){ + .on('submitOrder', function () { jQuery(this).trigger('realOrder'); }); jQuery('#edit_form').trigger('changePaymentMethod', [method]); @@ -482,35 +480,35 @@ define([ this.loadArea(['card_validation'], true, data); }, - setPaymentMethod : function(method){ - if (this.paymentMethod && $('payment_form_'+this.paymentMethod)) { - var form = 'payment_form_'+this.paymentMethod; - [form + '_before', form, form + '_after'].each(function(el) { + setPaymentMethod: function (method) { + if (this.paymentMethod && $('payment_form_' + this.paymentMethod)) { + var form = 'payment_form_' + this.paymentMethod; + [form + '_before', form, form + '_after'].each(function (el) { var block = $(el); if (block) { block.hide(); - block.select('input', 'select', 'textarea').each(function(field) { + block.select('input', 'select', 'textarea').each(function (field) { field.disabled = true; }); } }); } - if(!this.paymentMethod || method){ - $('order-billing_method_form').select('input', 'select', 'textarea').each(function(elem){ - if(elem.type != 'radio') elem.disabled = true; + if (!this.paymentMethod || method) { + $('order-billing_method_form').select('input', 'select', 'textarea').each(function (elem) { + if (elem.type != 'radio') elem.disabled = true; }) } - if ($('payment_form_'+method)){ + if ($('payment_form_' + method)) { jQuery('#' + this.getAreaId('billing_method')).trigger('contentUpdated'); this.paymentMethod = method; - var form = 'payment_form_'+method; - [form + '_before', form, form + '_after'].each(function(el) { + var form = 'payment_form_' + method; + [form + '_before', form, form + '_after'].each(function (el) { var block = $(el); if (block) { block.show(); - block.select('input', 'select', 'textarea').each(function(field) { + block.select('input', 'select', 'textarea').each(function (field) { field.disabled = false; if (!el.include('_before') && !el.include('_after') && !field.bindChange) { field.bindChange = true; @@ -518,15 +516,15 @@ define([ field.method = method; field.observe('change', this.changePaymentData.bind(this)) } - },this); + }, this); } - },this); + }, this); } }, - changePaymentData : function(event){ + changePaymentData: function (event) { var elem = Event.element(event); - if(elem && elem.method){ + if (elem && elem.method) { var data = this.getPaymentData(elem.method); if (data) { this.loadArea(['card_validation'], true, data); @@ -536,8 +534,8 @@ define([ } }, - getPaymentData : function(currentMethod){ - if (typeof(currentMethod) == 'undefined') { + getPaymentData: function (currentMethod) { + if (typeof (currentMethod) == 'undefined') { if (this.paymentMethod) { currentMethod = this.paymentMethod; } else { @@ -549,7 +547,7 @@ define([ } var data = {}; var fields = $('payment_form_' + currentMethod).select('input', 'select'); - for(var i=0;i<fields.length;i++){ + for (var i = 0; i < fields.length; i++) { data[fields[i].name] = fields[i].getValue(); } if ((typeof data['payment[cc_type]']) != 'undefined' && (!data['payment[cc_type]'] || !data['payment[cc_number]'])) { @@ -558,32 +556,38 @@ define([ return data; }, - applyCoupon : function(code){ - this.loadArea(['items', 'shipping_method', 'totals', 'billing_method'], true, {'order[coupon][code]':code, reset_shipping: 0}); + applyCoupon: function (code) { + this.loadArea(['items', 'shipping_method', 'totals', 'billing_method'], true, { + 'order[coupon][code]': code, + reset_shipping: 0 + }); this.orderItemChanged = false; }, - addProduct : function(id){ - this.loadArea(['items', 'shipping_method', 'totals', 'billing_method'], true, {add_product:id, reset_shipping: true}); + addProduct: function (id) { + this.loadArea(['items', 'shipping_method', 'totals', 'billing_method'], true, { + add_product: id, + reset_shipping: true + }); }, - removeQuoteItem : function(id){ + removeQuoteItem: function (id) { this.loadArea(['items', 'shipping_method', 'totals', 'billing_method'], true, - {remove_item:id, from:'quote',reset_shipping: true}); + {remove_item: id, from: 'quote', reset_shipping: true}); }, - moveQuoteItem : function(id, to){ - this.loadArea(['sidebar_'+to, 'items', 'shipping_method', 'totals', 'billing_method'], this.getAreaId('items'), - {move_item:id, to:to, reset_shipping: true}); + moveQuoteItem: function (id, to) { + this.loadArea(['sidebar_' + to, 'items', 'shipping_method', 'totals', 'billing_method'], this.getAreaId('items'), + {move_item: id, to: to, reset_shipping: true}); }, - productGridShow : function(buttonElement){ + productGridShow: function (buttonElement) { this.productGridShowButton = buttonElement; Element.hide(buttonElement); this.showArea('search'); }, - productGridRowInit : function(grid, row){ + productGridRowInit: function (grid, row) { var checkbox = $(row).select('.checkbox')[0]; var inputs = $(row).select('.input-text'); if (checkbox && inputs.length > 0) { @@ -606,29 +610,39 @@ define([ input.disabled = !checkbox.checked || input.hasClassName('input-inactive'); - Event.observe(input,'keyup', this.productGridRowInputChange.bind(this)); - Event.observe(input,'change',this.productGridRowInputChange.bind(this)); + Event.observe(input, 'keyup', this.productGridRowInputChange.bind(this)); + Event.observe(input, 'change', this.productGridRowInputChange.bind(this)); } } }, - productGridRowInputChange : function(event){ + productGridRowInputChange: function (event) { var element = Event.element(event); - if (element && element.checkboxElement && element.checkboxElement.checked){ - if (element.name!='giftmessage' || element.checked) { + if (element && element.checkboxElement && element.checkboxElement.checked) { + if (element.name != 'giftmessage' || element.checked) { this.gridProducts.get(element.checkboxElement.value)[element.name] = element.value; - } else if (element.name=='giftmessage' && this.gridProducts.get(element.checkboxElement.value)[element.name]) { - delete(this.gridProducts.get(element.checkboxElement.value)[element.name]); + } else if (element.name == 'giftmessage' && this.gridProducts.get(element.checkboxElement.value)[element.name]) { + delete (this.gridProducts.get(element.checkboxElement.value)[element.name]); } } }, - productGridRowClick : function(grid, event){ + productGridRowClick: function (grid, event) { var trElement = Event.findElement(event, 'tr'); var qtyElement = trElement.select('input[name="qty"]')[0]; var eventElement = Event.element(event); - var isInputCheckbox = eventElement.tagName == 'INPUT' && eventElement.type == 'checkbox'; - var isInputQty = eventElement.tagName == 'INPUT' && eventElement.name == 'qty'; + + if (eventElement.tagName === 'LABEL' + && trElement.querySelector('#' + eventElement.htmlFor) + && trElement.querySelector('#' + eventElement.htmlFor).type === 'checkbox' + ) { + event.stopPropagation(); + trElement.querySelector('#' + eventElement.htmlFor).trigger('click'); + return; + } + + var isInputCheckbox = (eventElement.tagName === 'INPUT' && eventElement.type === 'checkbox'); + var isInputQty = grid.targetElement && grid.targetElement.tagName === 'INPUT' && grid.targetElement.name === 'qty'; if (trElement && !isInputQty) { var checkbox = Element.select(trElement, 'input[type="checkbox"]')[0]; var confLink = Element.select(trElement, 'a')[0]; @@ -650,10 +664,10 @@ define([ if (!priceBase) { this.productPriceBase[productId] = 0; } else { - this.productPriceBase[productId] = parseFloat(priceBase[1].replace(/,/g,'')); + this.productPriceBase[productId] = parseFloat(priceBase[1].replace(/,/g, '')); } } - productConfigure.setConfirmCallback(listType, function() { + productConfigure.setConfirmCallback(listType, function () { // sync qty of popup and qty of grid var confirmedCurrentQty = productConfigure.getCurrentConfirmedQtyElement(); if (qtyElement && confirmedCurrentQty && !isNaN(confirmedCurrentQty.value)) { @@ -669,12 +683,12 @@ define([ // and set checkbox checked grid.setCheckboxChecked(checkbox, true); }.bind(this)); - productConfigure.setCancelCallback(listType, function() { + productConfigure.setCancelCallback(listType, function () { if (!$(productConfigure.confirmedCurrentId) || !$(productConfigure.confirmedCurrentId).innerHTML) { grid.setCheckboxChecked(checkbox, false); } }); - productConfigure.setShowWindowCallback(listType, function() { + productConfigure.setShowWindowCallback(listType, function () { // sync qty of grid and qty of popup var formCurrentQty = productConfigure.getCurrentFormQtyElement(); if (formCurrentQty && qtyElement && !isNaN(qtyElement.value)) { @@ -690,7 +704,7 @@ define([ /** * Is need to summarize price */ - _isSummarizePrice: function(elm) { + _isSummarizePrice: function (elm) { if (elm && elm.hasAttribute('summarizePrice')) { this.summarizePrice = parseInt(elm.readAttribute('summarizePrice')); } @@ -717,9 +731,9 @@ define([ } return 0; }; - for(var i = 0; i < elms.length; i++) { + for (var i = 0; i < elms.length; i++) { if (elms[i].type == 'select-one' || elms[i].type == 'select-multiple') { - for(var ii = 0; ii < elms[i].options.length; ii++) { + for (var ii = 0; ii < elms[i].options.length; ii++) { if (elms[i].options[ii].selected) { if (this._isSummarizePrice(elms[i].options[ii])) { productPrice += getPrice(elms[i].options[ii]); @@ -728,8 +742,7 @@ define([ } } } - } - else if (((elms[i].type == 'checkbox' || elms[i].type == 'radio') && elms[i].checked) + } else if (((elms[i].type == 'checkbox' || elms[i].type == 'radio') && elms[i].checked) || ((elms[i].type == 'file' || elms[i].type == 'text' || elms[i].type == 'textarea' || elms[i].type == 'hidden') && Form.Element.getValue(elms[i])) ) { @@ -748,9 +761,9 @@ define([ return productPrice; }, - productGridCheckboxCheck : function(grid, element, checked){ + productGridCheckboxCheck: function (grid, element, checked) { if (checked) { - if(element.inputElements) { + if (element.inputElements) { this.gridProducts.set(element.value, {}); var product = this.gridProducts.get(element.value); for (var i = 0; i < element.inputElements.length; i++) { @@ -765,36 +778,36 @@ define([ if (input.checked || input.name != 'giftmessage') { product[input.name] = input.value; } else if (product[input.name]) { - delete(product[input.name]); + delete (product[input.name]); } } } } else { - if(element.inputElements){ - for(var i = 0; i < element.inputElements.length; i++) { + if (element.inputElements) { + for (var i = 0; i < element.inputElements.length; i++) { element.inputElements[i].disabled = true; } } this.gridProducts.unset(element.value); } - grid.reloadParams = {'products[]':this.gridProducts.keys()}; + grid.reloadParams = {'products[]': this.gridProducts.keys()}; }, /** * Submit configured products to quote */ - productGridAddSelected : function(){ - if(this.productGridShowButton) Element.show(this.productGridShowButton); - var area = ['search', 'items', 'shipping_method', 'totals', 'giftmessage','billing_method']; + productGridAddSelected: function () { + if (this.productGridShowButton) Element.show(this.productGridShowButton); + var area = ['search', 'items', 'shipping_method', 'totals', 'giftmessage', 'billing_method']; // prepare additional fields and filtered items of products var fieldsPrepare = {}; var itemsFilter = []; var products = this.gridProducts.toObject(); for (var productId in products) { itemsFilter.push(productId); - var paramKey = 'item['+productId+']'; + var paramKey = 'item[' + productId + ']'; for (var productParamKey in products[productId]) { - paramKey += '['+productParamKey+']'; + paramKey += '[' + productParamKey + ']'; fieldsPrepare[paramKey] = products[productId][productParamKey]; } } @@ -804,47 +817,47 @@ define([ this.gridProducts = $H({}); }, - selectCustomer : function(grid, event){ + selectCustomer: function (grid, event) { var element = Event.findElement(event, 'tr'); - if (element.title){ + if (element.title) { this.setCustomerId(element.title); } }, - customerSelectorHide : function(){ + customerSelectorHide: function () { this.hideArea('customer-selector'); }, - customerSelectorShow : function(){ + customerSelectorShow: function () { this.showArea('customer-selector'); }, - storeSelectorHide : function(){ + storeSelectorHide: function () { this.hideArea('store-selector'); }, - storeSelectorShow : function(){ + storeSelectorShow: function () { this.showArea('store-selector'); }, - dataHide : function(){ + dataHide: function () { this.hideArea('data'); }, - dataShow : function(){ + dataShow: function () { if ($('submit_order_top_button')) { $('submit_order_top_button').show(); } this.showArea('data'); }, - clearShoppingCart : function(confirmMessage){ + clearShoppingCart: function (confirmMessage) { var self = this; confirm({ content: confirmMessage, actions: { - confirm: function() { + confirm: function () { self.collectElementsValue = false; order.sidebarApplyChanges({'sidebar[empty_customer_cart]': 1}); self.collectElementsValue = true; @@ -853,12 +866,12 @@ define([ }); }, - sidebarApplyChanges : function(auxiliaryParams) { + sidebarApplyChanges: function (auxiliaryParams) { if ($(this.getAreaId('sidebar'))) { var data = {}; if (this.collectElementsValue) { var elems = $(this.getAreaId('sidebar')).select('input'); - for (var i=0; i < elems.length; i++) { + for (var i = 0; i < elems.length; i++) { if (elems[i].getValue()) { data[elems[i].name] = elems[i].getValue(); } @@ -870,20 +883,20 @@ define([ } } data.reset_shipping = true; - this.loadArea(['sidebar', 'items', 'shipping_method', 'billing_method','totals', 'giftmessage'], true, data); + this.loadArea(['sidebar', 'items', 'shipping_method', 'billing_method', 'totals', 'giftmessage'], true, data); } }, - sidebarHide : function(){ - if(this.storeId === false && $('page:left') && $('page:container')){ + sidebarHide: function () { + if (this.storeId === false && $('page:left') && $('page:container')) { $('page:left').hide(); $('page:container').removeClassName('container'); $('page:container').addClassName('container-collapsed'); } }, - sidebarShow : function(){ - if($('page:left') && $('page:container')){ + sidebarShow: function () { + if ($('page:left') && $('page:container')) { $('page:left').show(); $('page:container').removeClassName('container-collapsed'); $('page:container').addClassName('container'); @@ -904,7 +917,7 @@ define([ for (var i in params) { if (params[i] === null) { unset(params[i]); - } else if (typeof(params[i]) == 'boolean') { + } else if (typeof (params[i]) == 'boolean') { params[i] = params[i] ? 1 : 0; } } @@ -913,15 +926,15 @@ define([ fields.push(new Element('input', {type: 'hidden', name: name, value: params[name]})); } // add additional fields before triggered submit - productConfigure.setBeforeSubmitCallback(listType, function() { + productConfigure.setBeforeSubmitCallback(listType, function () { productConfigure.addFields(fields); }.bind(this)); // response handler - productConfigure.setOnLoadIFrameCallback(listType, function(response) { + productConfigure.setOnLoadIFrameCallback(listType, function (response) { if (!response.ok) { return; } - this.loadArea(['items', 'shipping_method', 'billing_method','totals', 'giftmessage'], true); + this.loadArea(['items', 'shipping_method', 'billing_method', 'totals', 'giftmessage'], true); }.bind(this)); // show item configuration itemId = itemId ? itemId : productId; @@ -929,17 +942,17 @@ define([ return false; }, - removeSidebarItem : function(id, from){ - this.loadArea(['sidebar_'+from], 'sidebar_data_'+from, {remove_item:id, from:from}); + removeSidebarItem: function (id, from) { + this.loadArea(['sidebar_' + from], 'sidebar_data_' + from, {remove_item: id, from: from}); }, - itemsUpdate : function(){ - var area = ['sidebar', 'items', 'shipping_method', 'billing_method','totals', 'giftmessage']; + itemsUpdate: function () { + var area = ['sidebar', 'items', 'shipping_method', 'billing_method', 'totals', 'giftmessage']; // prepare additional fields var fieldsPrepare = {update_items: 1}; var info = $('order-items_grid').select('input', 'select', 'textarea'); - for(var i=0; i<info.length; i++){ - if(!info[i].disabled && (info[i].type != 'checkbox' || info[i].checked)) { + for (var i = 0; i < info.length; i++) { + if (!info[i].disabled && (info[i].type != 'checkbox' || info[i].checked)) { fieldsPrepare[info[i].name] = info[i].getValue(); } } @@ -948,17 +961,17 @@ define([ this.orderItemChanged = false; }, - itemsOnchangeBind : function(){ + itemsOnchangeBind: function () { var elems = $('order-items_grid').select('input', 'select', 'textarea'); - for(var i=0; i<elems.length; i++){ - if(!elems[i].bindOnchange){ + for (var i = 0; i < elems.length; i++) { + if (!elems[i].bindOnchange) { elems[i].bindOnchange = true; elems[i].observe('change', this.itemChange.bind(this)) } } }, - itemChange : function(event){ + itemChange: function (event) { this.giftmessageOnItemChange(event); this.orderItemChanged = true; }, @@ -971,7 +984,7 @@ define([ * @param fieldsPrepare * @param itemsFilter */ - productConfigureSubmit : function(listType, area, fieldsPrepare, itemsFilter) { + productConfigureSubmit: function (listType, area, fieldsPrepare, itemsFilter) { // prepare loading areas and build url area = this.prepareArea(area); this.loadingAreas = area; @@ -996,7 +1009,7 @@ define([ // prepare and do submit productConfigure.addListType(listType, {urlSubmit: url}); - productConfigure.setOnLoadIFrameCallback(listType, function(response){ + productConfigure.setOnLoadIFrameCallback(listType, function (response) { this.loadAreaResponseHandler(response); }.bind(this)); productConfigure.submit(listType); @@ -1009,20 +1022,20 @@ define([ * * @param itemId */ - showQuoteItemConfiguration: function(itemId){ + showQuoteItemConfiguration: function (itemId) { var listType = 'quote_items'; - var qtyElement = $('order-items_grid').select('input[name="item\['+itemId+'\]\[qty\]"]')[0]; - productConfigure.setConfirmCallback(listType, function() { + var qtyElement = $('order-items_grid').select('input[name="item\[' + itemId + '\]\[qty\]"]')[0]; + productConfigure.setConfirmCallback(listType, function () { // sync qty of popup and qty of grid var confirmedCurrentQty = productConfigure.getCurrentConfirmedQtyElement(); if (qtyElement && confirmedCurrentQty && !isNaN(confirmedCurrentQty.value)) { qtyElement.value = confirmedCurrentQty.value; } - this.productConfigureAddFields['item['+itemId+'][configured]'] = 1; + this.productConfigureAddFields['item[' + itemId + '][configured]'] = 1; this.itemsUpdate(); }.bind(this)); - productConfigure.setShowWindowCallback(listType, function() { + productConfigure.setShowWindowCallback(listType, function () { // sync qty of grid and qty of popup var formCurrentQty = productConfigure.getCurrentFormQtyElement(); if (formCurrentQty && qtyElement && !isNaN(qtyElement.value)) { @@ -1032,60 +1045,59 @@ define([ productConfigure.showItemConfiguration(listType, itemId); }, - accountFieldsBind : function(container){ - if($(container)){ + accountFieldsBind: function (container) { + if ($(container)) { var fields = $(container).select('input', 'select', 'textarea'); - for(var i=0; i<fields.length; i++){ - if(fields[i].id == 'group_id'){ + for (var i = 0; i < fields.length; i++) { + if (fields[i].id == 'group_id') { fields[i].observe('change', this.accountGroupChange.bind(this)) - } - else{ + } else { fields[i].observe('change', this.accountFieldChange.bind(this)) } } } }, - accountGroupChange : function(){ + accountGroupChange: function () { this.loadArea(['data'], true, this.serializeData('order-form_account').toObject()); }, - accountFieldChange : function(){ + accountFieldChange: function () { this.saveData(this.serializeData('order-form_account')); }, - commentFieldsBind : function(container){ - if($(container)){ + commentFieldsBind: function (container) { + if ($(container)) { var fields = $(container).select('input', 'textarea'); - for(var i=0; i<fields.length; i++) + for (var i = 0; i < fields.length; i++) fields[i].observe('change', this.commentFieldChange.bind(this)) } }, - commentFieldChange : function(){ + commentFieldChange: function () { this.saveData(this.serializeData('order-comment')); }, - giftmessageFieldsBind : function(container){ - if($(container)){ + giftmessageFieldsBind: function (container) { + if ($(container)) { var fields = $(container).select('input', 'textarea'); - for(var i=0; i<fields.length; i++) + for (var i = 0; i < fields.length; i++) fields[i].observe('change', this.giftmessageFieldChange.bind(this)) } }, - giftmessageFieldChange : function(){ + giftmessageFieldChange: function () { this.giftMessageDataChanged = true; }, - giftmessageOnItemChange : function(event) { + giftmessageOnItemChange: function (event) { var element = Event.element(event); - if(element.name.indexOf("giftmessage") != -1 && element.type == "checkbox" && !element.checked) { + if (element.name.indexOf("giftmessage") != -1 && element.type == "checkbox" && !element.checked) { var messages = $("order-giftmessage").select('textarea'); var name; - for(var i=0; i<messages.length; i++) { + for (var i = 0; i < messages.length; i++) { name = messages[i].id.split("_"); - if(name.length < 2) continue; + if (name.length < 2) continue; if (element.name.indexOf("[" + name[1] + "]") != -1 && messages[i].value != "") { alert({ content: "First, clean the Message field in Gift Message form" @@ -1096,7 +1108,7 @@ define([ } }, - loadArea : function(area, indicator, params){ + loadArea: function (area, indicator, params) { var deferred = new jQuery.Deferred(); var url = this.loadBaseUrl; if (area) { @@ -1110,20 +1122,19 @@ define([ if (indicator) { this.loadingAreas = area; new Ajax.Request(url, { - parameters:params, + parameters: params, loaderArea: indicator, - onSuccess: function(transport) { + onSuccess: function (transport) { var response = transport.responseText.evalJSON(); this.loadAreaResponseHandler(response); deferred.resolve(); }.bind(this) }); - } - else { + } else { new Ajax.Request(url, { - parameters:params, + parameters: params, loaderArea: indicator, - onSuccess: function(transport) { + onSuccess: function (transport) { deferred.resolve(); } }); @@ -1134,7 +1145,7 @@ define([ return deferred.promise(); }, - loadAreaResponseHandler : function (response) { + loadAreaResponseHandler: function (response) { if (response.error) { alert({ content: response.message @@ -1169,45 +1180,44 @@ define([ } }, - prepareArea : function(area) { + prepareArea: function (area) { if (this.giftMessageDataChanged) { return area.without('giftmessage'); } return area; }, - saveData : function(data){ + saveData: function (data) { this.loadArea(false, false, data); }, - showArea : function(area){ + showArea: function (area) { var id = this.getAreaId(area); - if($(id)) { + if ($(id)) { $(id).show(); this.areaOverlay(); } }, - hideArea : function(area){ + hideArea: function (area) { var id = this.getAreaId(area); - if($(id)) { + if ($(id)) { $(id).hide(); this.areaOverlay(); } }, - areaOverlay : function() - { - $H(order.overlayData).each(function(e){ + areaOverlay: function () { + $H(order.overlayData).each(function (e) { e.value.fx(); }); }, - getAreaId : function(area){ - return 'order-'+area; + getAreaId: function (area) { + return 'order-' + area; }, - prepareParams : function(params){ + prepareParams: function (params) { if (!params) { params = {}; } @@ -1227,7 +1237,7 @@ define([ if (this.isPaymentValidationAvailable()) { var data = this.serializeData('order-billing_method'); if (data) { - data.each(function(value) { + data.each(function (value) { params[value[0]] = value[1]; }); } @@ -1242,7 +1252,7 @@ define([ * * @returns {boolean} */ - isPaymentValidationAvailable : function(){ + isPaymentValidationAvailable: function () { return ((typeof this.paymentMethod) == 'undefined' || this.excludedPaymentMethods.indexOf(this.paymentMethod) == -1); }, @@ -1260,21 +1270,19 @@ define([ return $H(data); }, - toggleCustomPrice: function(checkbox, elemId, tierBlock) { + toggleCustomPrice: function (checkbox, elemId, tierBlock) { if (checkbox.checked) { $(elemId).disabled = false; $(elemId).show(); - if($(tierBlock)) $(tierBlock).hide(); - } - else { + if ($(tierBlock)) $(tierBlock).hide(); + } else { $(elemId).disabled = true; $(elemId).hide(); - if($(tierBlock)) $(tierBlock).show(); + if ($(tierBlock)) $(tierBlock).show(); } }, - submit : function() - { + submit: function () { var $editForm = jQuery('#edit_form'); if ($editForm.valid()) { @@ -1284,9 +1292,9 @@ define([ }, _realSubmit: function () { - var disableAndSave = function() { + var disableAndSave = function () { disableElements('save'); - jQuery('#edit_form').on('invalid-form.validate', function() { + jQuery('#edit_form').on('invalid-form.validate', function () { enableElements('save'); jQuery('#edit_form').trigger('processStop'); jQuery('#edit_form').off('invalid-form.validate'); @@ -1301,11 +1309,11 @@ define([ confirm({ content: jQuery.mage.__('You have item changes'), actions: { - confirm: function() { + confirm: function () { jQuery('#edit_form').trigger('processStart'); disableAndSave(); }, - cancel: function() { + cancel: function () { self.itemsUpdate(); } } @@ -1315,8 +1323,10 @@ define([ } }, - overlay : function(elId, show, observe) { - if (typeof(show) == 'undefined') { show = true; } + overlay: function (elId, show, observe) { + if (typeof (show) == 'undefined') { + show = true; + } var orderObj = this; var obj = this.overlayData.get(elId); @@ -1325,7 +1335,7 @@ define([ show: show, el: elId, order: orderObj, - fx: function(event) { + fx: function (event) { this.order.processOverlay(this.el, this.show); } }; @@ -1341,7 +1351,7 @@ define([ this.processOverlay(elId, show); }, - processOverlay : function(elId, show) { + processOverlay: function (elId, show) { var el = $(elId); if (!el) { @@ -1373,8 +1383,7 @@ define([ }); }, - validateVat: function(parameters) - { + validateVat: function (parameters) { var params = { country: $(parameters.countryElementId).value, vat: $(parameters.vatElementId).value @@ -1389,7 +1398,7 @@ define([ new Ajax.Request(parameters.validateUrl, { parameters: params, - onSuccess: function(response) { + onSuccess: function (response) { var message = ''; var groupActionRequired = null; try { @@ -1428,8 +1437,7 @@ define([ alert({ content: message }); - } - else { + } else { this.processCustomerGroupChange( parameters.groupIdHtmlId, message, @@ -1443,8 +1451,7 @@ define([ }); }, - processCustomerGroupChange: function(groupIdHtmlId, message, customerGroupMessage, errorMessage, groupId, action) - { + processCustomerGroupChange: function (groupIdHtmlId, message, customerGroupMessage, errorMessage, groupId, action) { var groupMessage = ''; try { var currentCustomerGroupId = $(groupIdHtmlId).value; @@ -1484,8 +1491,8 @@ define([ _parent: null, _callbackName: null, - initialize: function(name, node, parent){ - if(!node) + initialize: function (name, node, parent) { + if (!node) return; this._name = name; this._parent = parent; @@ -1494,7 +1501,7 @@ define([ this._callbackName = name + 'Loaded'; node.callback = this._callbackName; } - parent[this._callbackName] = parent[this._callbackName].wrap((function (proceed){ + parent[this._callbackName] = parent[this._callbackName].wrap((function (proceed) { proceed(); this.onLoad(); }).bind(this)); @@ -1502,14 +1509,14 @@ define([ this.setNode(node); }, - setNode: function(node){ + setNode: function (node) { if (!node.callback) { node.callback = this._callbackName; } this.node = node; }, - onLoad: function(){ + onLoad: function () { } }; @@ -1519,21 +1526,21 @@ define([ _label: '', _node: null, - initialize: function(label, id){ + initialize: function (label, id) { this._label = label; this._node = new Element('button', { 'class': 'action-secondary action-add', - 'type': 'button' + 'type': 'button' }); if (typeof id !== 'undefined') { this._node.setAttribute('id', id) } }, - onClick: function(){ + onClick: function () { }, - insertIn: function(element, position){ + insertIn: function (element, position) { var node = Object.extend(this._node), content = {}; node.observe('click', this.onClick); @@ -1542,7 +1549,7 @@ define([ Element.insert(element, content); }, - getLabel: function(){ + getLabel: function () { return this._label; } }; diff --git a/lib/web/mage/adminhtml/grid.js b/lib/web/mage/adminhtml/grid.js index 5f7a709f04fea..a946060da06ed 100644 --- a/lib/web/mage/adminhtml/grid.js +++ b/lib/web/mage/adminhtml/grid.js @@ -33,6 +33,7 @@ define([ setLocation(element.title); } } + window.openGridRow = openGridRow; window.varienGrid = new Class.create(); @@ -63,11 +64,13 @@ define([ this.initRowCallback = false; this.doFilterCallback = false; this.sortableUpdateCallback = false; + this.targetElement = undefined; this.reloadParams = false; this.trOnMouseOver = this.rowMouseOver.bindAsEventListener(this); this.trOnMouseOut = this.rowMouseOut.bindAsEventListener(this); + this.trOnMouseDown = this.rowMouseDown.bindAsEventListener(this); this.trOnClick = this.rowMouseClick.bindAsEventListener(this); this.trOnDblClick = this.rowMouseDblClick.bindAsEventListener(this); this.trOnKeyPress = this.keyPress.bindAsEventListener(this); @@ -96,6 +99,7 @@ define([ Event.observe(this.rows[row], 'mouseover', this.trOnMouseOver); Event.observe(this.rows[row], 'mouseout', this.trOnMouseOut); + Event.observe(this.rows[row], 'mousedown', this.trOnMouseDown); Event.observe(this.rows[row], 'click', this.trOnClick); Event.observe(this.rows[row], 'dblclick', this.trOnDblClick); } @@ -114,8 +118,7 @@ define([ if (this.initCallback) { try { this.initCallback(this); - } - catch (e) { + } catch (e) { if (window.console) { //eslint-disable-line max-depth console.log(e); } @@ -179,6 +182,13 @@ define([ Element.removeClassName(element, 'on-mouse'); }, + /** + * @param {*} event + */ + rowMouseDown: function (event) { + this.targetElement = event.target; + }, + /** * @param {*} event */ @@ -186,11 +196,11 @@ define([ if (this.rowClickCallback) { try { this.rowClickCallback(this, event); - } - catch (e) { + } catch (e) { } } varienGlobalEvents.fireEvent('gridRowClick', event); + this.targetElement = undefined; }, /** @@ -203,7 +213,8 @@ define([ /** * Key press. */ - keyPress: function () {}, + keyPress: function () { + }, /** * @param {*} event @@ -404,8 +415,8 @@ define([ */ bindFilterFields: function () { var filters = $$( - '#' + this.containerId + ' [data-role="filter-form"] input', - '#' + this.containerId + ' [data-role="filter-form"] select' + '#' + this.containerId + ' [data-role="filter-form"] input', + '#' + this.containerId + ' [data-role="filter-form"] select' ), i; @@ -452,7 +463,8 @@ define([ return ui; }, - update: this.sortableUpdateCallback ? this.sortableUpdateCallback : function () {}, + update: this.sortableUpdateCallback ? this.sortableUpdateCallback : function () { + }, tolerance: 'pointer' }); } @@ -472,8 +484,8 @@ define([ */ doFilter: function (callback) { var filters = $$( - '#' + this.containerId + ' [data-role="filter-form"] input', - '#' + this.containerId + ' [data-role="filter-form"] select' + '#' + this.containerId + ' [data-role="filter-form"] input', + '#' + this.containerId + ' [data-role="filter-form"] select' ), elements = [], i; @@ -589,24 +601,24 @@ define([ */ initialize: function (containerId, grid, checkedValues, formFieldNameInternal, formFieldName) { this.setOldCallback('row_click', grid.rowClickCallback); - this.setOldCallback('init', grid.initCallback); - this.setOldCallback('init_row', grid.initRowCallback); - this.setOldCallback('pre_init', grid.preInitCallback); + this.setOldCallback('init', grid.initCallback); + this.setOldCallback('init_row', grid.initRowCallback); + this.setOldCallback('pre_init', grid.preInitCallback); - this.useAjax = false; - this.grid = grid; + this.useAjax = false; + this.grid = grid; this.grid.massaction = this; - this.containerId = containerId; + this.containerId = containerId; this.initMassactionElements(); - this.checkedString = checkedValues; - this.formFieldName = formFieldName; - this.formFieldNameInternal = formFieldNameInternal; + this.checkedString = checkedValues; + this.formFieldName = formFieldName; + this.formFieldNameInternal = formFieldNameInternal; - this.grid.initCallback = this.onGridInit.bind(this); - this.grid.preInitCallback = this.onGridPreInit.bind(this); - this.grid.initRowCallback = this.onGridRowInit.bind(this); - this.grid.rowClickCallback = this.onGridRowClick.bind(this); + this.grid.initCallback = this.onGridInit.bind(this); + this.grid.preInitCallback = this.onGridPreInit.bind(this); + this.grid.initRowCallback = this.onGridRowInit.bind(this); + this.grid.rowClickCallback = this.onGridRowClick.bind(this); this.initCheckboxes(); this.checkCheckboxes(); }, @@ -629,16 +641,16 @@ define([ * Init massaction elements. */ initMassactionElements: function () { - this.container = $(this.containerId); - this.multiselect = $(this.containerId + '-mass-select'); - this.count = $(this.containerId + '-count'); - this.formHiddens = $(this.containerId + '-form-hiddens'); + this.container = $(this.containerId); + this.multiselect = $(this.containerId + '-mass-select'); + this.count = $(this.containerId + '-count'); + this.formHiddens = $(this.containerId + '-form-hiddens'); this.formAdditional = $(this.containerId + '-form-additional'); - this.select = $(this.containerId + '-select'); - this.form = this.prepareForm(); + this.select = $(this.containerId + '-select'); + this.form = this.prepareForm(); jQuery(this.form).mage('validation'); this.select.observe('change', this.onSelectChange.bindAsEventListener(this)); - this.lastChecked = { + this.lastChecked = { left: false, top: false, checkbox: false @@ -795,7 +807,7 @@ define([ this.getOldCallback('row_click')(grid, evt); } else { checkbox = Element.select(trElement, 'input'); - isInput = Event.element(evt).tagName == 'input'; //eslint-disable-line eqeqeq + isInput = Event.element(evt).tagName == 'input'; //eslint-disable-line eqeqeq checked = isInput ? checkbox[0].checked : !checkbox[0].checked; if (checked) { //eslint-disable-line max-depth @@ -1107,7 +1119,8 @@ define([ try { listener = this.getListener(this.currentItem.complete) || Prototype.emptyFunction; listener(this.grid, this, transport); - } catch (e) {} + } catch (e) { + } } }, @@ -1318,8 +1331,8 @@ define([ * @return {String} */ trimComma: function (string) { - string = string.replace(new RegExp('^(,+)','i'), ''); - string = string.replace(new RegExp('(,+)$','i'), ''); + string = string.replace(new RegExp('^(,+)', 'i'), ''); + string = string.replace(new RegExp('(,+)$', 'i'), ''); return string; } @@ -1339,14 +1352,14 @@ define([ initialize: function (hiddenDataHolder, predefinedData, inputsToManage, grid, reloadParamName) { //Grid inputs this.tabIndex = 1000; - this.inputsToManage = inputsToManage; + this.inputsToManage = inputsToManage; this.multidimensionalMode = inputsToManage.length > 0; //Hash with grid data - this.gridData = this.getGridDataHash(predefinedData); + this.gridData = this.getGridDataHash(predefinedData); //Hidden input data holder - this.hiddenDataHolder = $(hiddenDataHolder); + this.hiddenDataHolder = $(hiddenDataHolder); this.hiddenDataHolder.value = this.serializeObject(); this.grid = grid; @@ -1439,7 +1452,7 @@ define([ */ rowClick: function (grid, event) { var trElement = Event.findElement(event, 'tr'), - isInput = Event.element(event).tagName == 'INPUT', //eslint-disable-line eqeqeq + isInput = Event.element(event).tagName == 'INPUT', //eslint-disable-line eqeqeq checkbox, checked; if (trElement) { From 89dd87d5a150edccb542085b51c3b5bfdf6592f7 Mon Sep 17 00:00:00 2001 From: DmitryTsymbal <d.tsymbal@atwix.com> Date: Fri, 7 Jun 2019 18:04:29 +0300 Subject: [PATCH 0009/1143] Convert NewCustomerPasswordComplexityTest --- .../StorefrontFillRegistryFormActionGroup.xml | 31 +++++++++++++++++ .../StorefrontSeeHeaderLinksActionGroup.xml | 19 +++++++++++ .../Mftf/Section/StorefrontHeaderSection.xml | 16 +++++++++ .../NewCustomerPasswordComplexityTest.xml | 33 +++++++++++++++++++ 4 files changed, 99 insertions(+) create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontFillRegistryFormActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontSeeHeaderLinksActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/Section/StorefrontHeaderSection.xml create mode 100644 app/code/Magento/Security/Test/Mftf/Test/NewCustomerPasswordComplexityTest.xml diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontFillRegistryFormActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontFillRegistryFormActionGroup.xml new file mode 100644 index 0000000000000..0a1440937a554 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontFillRegistryFormActionGroup.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontFillRegistryFormActionGroup"> + + <!--Fill Registry Form with password length is below 8 characters --> + <fillField stepKey="fillFirstName1stVariation" userInput="John" selector="{{StorefrontCustomerCreateFormSection.firstnameField}}"/> + <fillField stepKey="fillLastName1stVariation" userInput="Doe" selector="{{StorefrontCustomerCreateFormSection.lastnameField}}"/> + <fillField stepKey="fillEmail1stVariation" userInput="johndoe@domain.com" selector="{{StorefrontCustomerCreateFormSection.emailField}}"/> + <fillField stepKey="fillPassword1stVariation" userInput="123123" selector="{{StorefrontCustomerCreateFormSection.passwordField}}"/> + <fillField stepKey="fillConfirmPassword1stVariation" userInput="123123" selector="{{StorefrontCustomerCreateFormSection.confirmPasswordField}}"/> + <click stepKey="clickCreateAccountButton1stVariation" selector="{{StorefrontCustomerCreateFormSection.createAccountButton}}"/> + <see userInput="Minimum length of this field must be equal or greater than 8 symbols. Leading and trailing spaces will be ignored." stepKey="seeTheErrorMessageIsDisplayed1"/> + + <!--Fill Registry Form with not secure enough password --> + <fillField stepKey="fillFirstName2ndVariation" userInput="John" selector="{{StorefrontCustomerCreateFormSection.firstnameField}}"/> + <fillField stepKey="fillLastName2ndVariation" userInput="Doe" selector="{{StorefrontCustomerCreateFormSection.lastnameField}}"/> + <fillField stepKey="fillEmail2ndVariation" userInput="johndoe@domain.com" selector="{{StorefrontCustomerCreateFormSection.emailField}}"/> + <fillField stepKey="fillPassword2ndVariation" userInput="123123qa" selector="{{StorefrontCustomerCreateFormSection.passwordField}}"/> + <fillField stepKey="fillConfirmPassword2ndVariation" userInput="123123qa" selector="{{StorefrontCustomerCreateFormSection.confirmPasswordField}}"/> + <click stepKey="clickCreateAccountButton" selector="{{StorefrontCustomerCreateFormSection.createAccountButton}}"/> + <see userInput="Minimum of different classes of characters in password is 3. Classes of characters: Lower Case, Upper Case, Digits, Special Characters." stepKey="seeTheErrorMessageIsDisplayed2"/> + + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontSeeHeaderLinksActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontSeeHeaderLinksActionGroup.xml new file mode 100644 index 0000000000000..b70560ad2cd86 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontSeeHeaderLinksActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontSeeHeaderLinksActionGroup"> + <arguments> + <argument name="LinkName" type="string" defaultValue="Create an Account"/> + </arguments> + + <see stepKey="SeeElement" selector="{{StorefrontHeaderSection.headerlinks}}" userInput="{{LinkName}}"/> + <click stepKey="ClickLink" selector="{{StorefrontHeaderSection.HeaderLinkByText(LinkName)}}"/> + <waitForPageLoad stepKey="Wait"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/Section/StorefrontHeaderSection.xml b/app/code/Magento/Cms/Test/Mftf/Section/StorefrontHeaderSection.xml new file mode 100644 index 0000000000000..fefde1e6035f3 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/Section/StorefrontHeaderSection.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="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="StorefrontHeaderSection"> + <element name="headerlinks" type="text" selector="ul.header.links"/> + <element name="HeaderLinkByText" type="text" selector="//ul[contains(@class, 'header') and contains(@class, 'links')]/li/a[contains(text(),'{{LinkName}}')]" + parameterized="true" /> + </section> +</sections> diff --git a/app/code/Magento/Security/Test/Mftf/Test/NewCustomerPasswordComplexityTest.xml b/app/code/Magento/Security/Test/Mftf/Test/NewCustomerPasswordComplexityTest.xml new file mode 100644 index 0000000000000..a414878997021 --- /dev/null +++ b/app/code/Magento/Security/Test/Mftf/Test/NewCustomerPasswordComplexityTest.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="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="NewCustomerPasswordComplexityTest"> + <annotations> + <features value="Security"/> + <stories value="Checking customer's password length and password complexity"/> + <title value="Notify the customer if password length or complexity is not match to requirements"/> + <description value="Show notifies to the customer if password length or complexity is not match to requirements"/> + <group value="security"/> + <group value="mtf_migrated"/> + </annotations> + + <!-- TEST BODY --> + <!-- Go to storefront home page --> + <actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="openStoreFrontHomePage"/> + <!-- Click the Registration Link --> + <actionGroup ref="StorefrontSeeHeaderLinksActionGroup" stepKey="ClickTheLink"> + <argument name="LinkName" value="Create an Account" /> + </actionGroup> + <!-- Fill Registry Form with Incorrect Password (Two variations) --> + <actionGroup ref="StorefrontFillRegistryFormActionGroup" stepKey="FillRegistryForm"/> + <!--Test Body END--> + + </test> +</tests> From 100a81eb41648eabb41c2d77059368750916758e Mon Sep 17 00:00:00 2001 From: DmitryTsymbal <d.tsymbal@atwix.com> Date: Fri, 7 Jun 2019 18:32:45 +0300 Subject: [PATCH 0010/1143] Refactoring --- .../Test/Mftf/Test/NewCustomerPasswordComplexityTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Security/Test/Mftf/Test/NewCustomerPasswordComplexityTest.xml b/app/code/Magento/Security/Test/Mftf/Test/NewCustomerPasswordComplexityTest.xml index a414878997021..29135332d6125 100644 --- a/app/code/Magento/Security/Test/Mftf/Test/NewCustomerPasswordComplexityTest.xml +++ b/app/code/Magento/Security/Test/Mftf/Test/NewCustomerPasswordComplexityTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="openStoreFrontHomePage"/> <!-- Click the Registration Link --> <actionGroup ref="StorefrontSeeHeaderLinksActionGroup" stepKey="ClickTheLink"> - <argument name="LinkName" value="Create an Account" /> + <argument name="LinkName" value="Create an Account" /> </actionGroup> <!-- Fill Registry Form with Incorrect Password (Two variations) --> <actionGroup ref="StorefrontFillRegistryFormActionGroup" stepKey="FillRegistryForm"/> From 6d69673fc6bf8c0094ae89d347374fd0374e5c63 Mon Sep 17 00:00:00 2001 From: John Hughes <johnh@fisheyehq.com> Date: Tue, 18 Jun 2019 15:31:01 +0100 Subject: [PATCH 0011/1143] Trigger page load listeners when no longer loading * Switch from waiting until complete which could lead to severe rendering delays --- lib/web/requirejs/domReady.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/web/requirejs/domReady.js b/lib/web/requirejs/domReady.js index 31bd0d77697ca..d6eaa31187e60 100644 --- a/lib/web/requirejs/domReady.js +++ b/lib/web/requirejs/domReady.js @@ -78,7 +78,7 @@ define(function () { } } - //Check if document already complete, and if so, just trigger page load + //Check if document is no longer loading, and if so, just trigger page load //listeners. Latest webkit browsers also use "interactive", and //will fire the onDOMContentLoaded before "interactive" but not after //entering "interactive" or "complete". More details: @@ -89,7 +89,7 @@ define(function () { //so removing the || document.readyState === "interactive" test. //There is still a window.onload binding that should get fired if //DOMContentLoaded is missed. - if (document.readyState === "complete") { + if (document.readyState !== "loading") { pageLoaded(); } } From 0225d61d7b56a28e0e9a15d0699a1bf2630791c3 Mon Sep 17 00:00:00 2001 From: Volodymyr Vygovskyi <v.vygovskyi@atwix.com> Date: Wed, 24 Jul 2019 10:47:50 +0300 Subject: [PATCH 0012/1143] fixed actiongroup name --- .../Test/Mftf/ActionGroup/AdminDisableCMSPageActionGroup.xml | 2 +- .../Cms/Test/Mftf/Test/AdminCMSPageCreateDisabledPageTest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminDisableCMSPageActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminDisableCMSPageActionGroup.xml index 53f53227167ee..6617c8eea8155 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminDisableCMSPageActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminDisableCMSPageActionGroup.xml @@ -7,7 +7,7 @@ --> <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AdminDisableCMSPage"> + <actionGroup name="AdminDisableCMSPageActionGroup"> <seeElement selector="{{CmsNewPagePageBasicFieldsSection.isActive('1')}}" stepKey="seePageIsEnabled" /> <click selector="{{CmsNewPagePageBasicFieldsSection.isActiveLabel}}" stepKey="setPageDisabled"/> </actionGroup> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreateDisabledPageTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreateDisabledPageTest.xml index 2f609f7a88b43..dc40310b15191 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreateDisabledPageTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreateDisabledPageTest.xml @@ -25,7 +25,7 @@ <!--Go to New CMS Page page--> <actionGroup ref="AdminOpenCreateNewCMSPageActionGroup" stepKey="navigateToCreateNewPage"/> <!--Set page disabled--> - <actionGroup ref="AdminDisableCMSPage" stepKey="setCMSPageDisabled"/> + <actionGroup ref="AdminDisableCMSPageActionGroup" stepKey="setCMSPageDisabled"/> <!--Fill the CMS page form--> <actionGroup ref="FillOutCMSPageContent" stepKey="fillBasicPageDataForDisabledPage"/> <!--Verify successfully saved--> From 7c9b5f7fe45ba39d64f782b609efc370ea2684e3 Mon Sep 17 00:00:00 2001 From: DmitryTsymbal <d.tsymbal@atwix.com> Date: Tue, 30 Jul 2019 12:43:39 +0300 Subject: [PATCH 0013/1143] refactoring --- .../StorefrontClickHeaderLinkActionGroup.xml | 17 ++++++++++ .../StorefrontFillRegistryFormActionGroup.xml | 31 ------------------- .../StorefrontSeeHeaderLinksActionGroup.xml | 3 -- ...teAccountPasswordComplexityActionGroup.xml | 17 ++++++++++ .../Customer/Test/Mftf/Data/CustomerData.xml | 20 ++++++++++++ .../StorefrontCustomerCreateFormSection.xml | 1 + .../NewCustomerPasswordComplexityTest.xml | 24 +++++++++++--- .../NewCustomerPasswordComplexityTest.xml | 2 ++ 8 files changed, 77 insertions(+), 38 deletions(-) create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontClickHeaderLinkActionGroup.xml delete mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontFillRegistryFormActionGroup.xml create mode 100644 app/code/Magento/Customer/Test/Mftf/ActionGroup/AssertMessageCustomerCreateAccountPasswordComplexityActionGroup.xml diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontClickHeaderLinkActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontClickHeaderLinkActionGroup.xml new file mode 100644 index 0000000000000..46c06e909b4d9 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontClickHeaderLinkActionGroup.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontClickHeaderLinkActionGroup"> + <arguments> + <argument name="LinkName" type="string" defaultValue="Create an Account"/> + </arguments> + <click stepKey="ClickTheLink" selector="{{StorefrontHeaderSection.HeaderLinkByText(LinkName)}}"/> + <waitForPageLoad stepKey="Wait"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontFillRegistryFormActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontFillRegistryFormActionGroup.xml deleted file mode 100644 index 0a1440937a554..0000000000000 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontFillRegistryFormActionGroup.xml +++ /dev/null @@ -1,31 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="StorefrontFillRegistryFormActionGroup"> - - <!--Fill Registry Form with password length is below 8 characters --> - <fillField stepKey="fillFirstName1stVariation" userInput="John" selector="{{StorefrontCustomerCreateFormSection.firstnameField}}"/> - <fillField stepKey="fillLastName1stVariation" userInput="Doe" selector="{{StorefrontCustomerCreateFormSection.lastnameField}}"/> - <fillField stepKey="fillEmail1stVariation" userInput="johndoe@domain.com" selector="{{StorefrontCustomerCreateFormSection.emailField}}"/> - <fillField stepKey="fillPassword1stVariation" userInput="123123" selector="{{StorefrontCustomerCreateFormSection.passwordField}}"/> - <fillField stepKey="fillConfirmPassword1stVariation" userInput="123123" selector="{{StorefrontCustomerCreateFormSection.confirmPasswordField}}"/> - <click stepKey="clickCreateAccountButton1stVariation" selector="{{StorefrontCustomerCreateFormSection.createAccountButton}}"/> - <see userInput="Minimum length of this field must be equal or greater than 8 symbols. Leading and trailing spaces will be ignored." stepKey="seeTheErrorMessageIsDisplayed1"/> - - <!--Fill Registry Form with not secure enough password --> - <fillField stepKey="fillFirstName2ndVariation" userInput="John" selector="{{StorefrontCustomerCreateFormSection.firstnameField}}"/> - <fillField stepKey="fillLastName2ndVariation" userInput="Doe" selector="{{StorefrontCustomerCreateFormSection.lastnameField}}"/> - <fillField stepKey="fillEmail2ndVariation" userInput="johndoe@domain.com" selector="{{StorefrontCustomerCreateFormSection.emailField}}"/> - <fillField stepKey="fillPassword2ndVariation" userInput="123123qa" selector="{{StorefrontCustomerCreateFormSection.passwordField}}"/> - <fillField stepKey="fillConfirmPassword2ndVariation" userInput="123123qa" selector="{{StorefrontCustomerCreateFormSection.confirmPasswordField}}"/> - <click stepKey="clickCreateAccountButton" selector="{{StorefrontCustomerCreateFormSection.createAccountButton}}"/> - <see userInput="Minimum of different classes of characters in password is 3. Classes of characters: Lower Case, Upper Case, Digits, Special Characters." stepKey="seeTheErrorMessageIsDisplayed2"/> - - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontSeeHeaderLinksActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontSeeHeaderLinksActionGroup.xml index b70560ad2cd86..3155cca583d59 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontSeeHeaderLinksActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontSeeHeaderLinksActionGroup.xml @@ -11,9 +11,6 @@ <arguments> <argument name="LinkName" type="string" defaultValue="Create an Account"/> </arguments> - <see stepKey="SeeElement" selector="{{StorefrontHeaderSection.headerlinks}}" userInput="{{LinkName}}"/> - <click stepKey="ClickLink" selector="{{StorefrontHeaderSection.HeaderLinkByText(LinkName)}}"/> - <waitForPageLoad stepKey="Wait"/> </actionGroup> </actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AssertMessageCustomerCreateAccountPasswordComplexityActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AssertMessageCustomerCreateAccountPasswordComplexityActionGroup.xml new file mode 100644 index 0000000000000..9d7dbc604f59d --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AssertMessageCustomerCreateAccountPasswordComplexityActionGroup.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertMessageCustomerCreateAccountPasswordComplexityActionGroup"> + <arguments> + <argument name="message" type="string"/> + </arguments> + <see userInput="{{message}}" selector="{{StorefrontCustomerCreateFormSection.PasswordErrorMessages}}" stepKey="verifyMessage" /> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml b/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml index 5904067aea639..77bf6277d9c21 100644 --- a/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml +++ b/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml @@ -271,4 +271,24 @@ <requiredEntity type="address">US_Address_TX</requiredEntity> <requiredEntity type="address">US_Address_NY_Not_Default_Address</requiredEntity> </entity> + <entity name="Simple_Customer_With_Password_Length_Is_Below_Eight_Characters" type="customer"> + <data key="group_id">1</data> + <data key="email" unique="prefix">John.Doe@example.com</data> + <data key="firstname">John</data> + <data key="lastname">Doe</data> + <data key="fullname">John Doe</data> + <data key="password">123123</data> + <data key="store_id">0</data> + <data key="website_id">0</data> + </entity> + <entity name="Simple_Customer_With_Not_Secure_Password" type="customer"> + <data key="group_id">1</data> + <data key="email" unique="prefix">John.Doe@example.com</data> + <data key="firstname">John</data> + <data key="lastname">Doe</data> + <data key="fullname">John Doe</data> + <data key="password">123123qa</data> + <data key="store_id">0</data> + <data key="website_id">0</data> + </entity> </entities> diff --git a/app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerCreateFormSection.xml b/app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerCreateFormSection.xml index 8881a2a012ce8..5a731b2c3f0ed 100644 --- a/app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerCreateFormSection.xml +++ b/app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerCreateFormSection.xml @@ -17,6 +17,7 @@ <element name="passwordField" type="input" selector="#password"/> <element name="confirmPasswordField" type="input" selector="#password-confirmation"/> <element name="createAccountButton" type="button" selector="button.action.submit.primary" timeout="30"/> + <element name="PasswordErrorMessages" type="text" selector="#password-error"/> </section> <section name="StoreFrontCustomerAdvancedAttributesSection"> <element name="textFieldAttribute" type="input" selector="//input[@id='{{var}}']" parameterized="true" /> diff --git a/app/code/Magento/Security/Test/Mftf/Test/NewCustomerPasswordComplexityTest.xml b/app/code/Magento/Security/Test/Mftf/Test/NewCustomerPasswordComplexityTest.xml index 29135332d6125..ccd97f83cd0a6 100644 --- a/app/code/Magento/Security/Test/Mftf/Test/NewCustomerPasswordComplexityTest.xml +++ b/app/code/Magento/Security/Test/Mftf/Test/NewCustomerPasswordComplexityTest.xml @@ -21,12 +21,28 @@ <!-- TEST BODY --> <!-- Go to storefront home page --> <actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="openStoreFrontHomePage"/> + <!-- See the Registration Link --> + <actionGroup ref="StorefrontSeeHeaderLinksActionGroup" stepKey="SeeTheLink"/> <!-- Click the Registration Link --> - <actionGroup ref="StorefrontSeeHeaderLinksActionGroup" stepKey="ClickTheLink"> - <argument name="LinkName" value="Create an Account" /> + <actionGroup ref="StorefrontClickHeaderLinkActionGroup" stepKey="ClickTheLink"> + <argument name="LinkName" value="Create an Account"/> + </actionGroup> + <!-- Fill Registration Form with Password length is bellow 8 Characters --> + <actionGroup ref="StorefrontFillCustomerAccountCreationFormActionGroup" stepKey="FillRegistrationFormPasswordLengthBellowEightCharacters"> + <argument name="customer" value="Simple_Customer_With_Password_Length_Is_Below_Eight_Characters"/> + </actionGroup> + <!-- See the Error --> + <actionGroup ref="AssertMessageCustomerCreateAccountPasswordComplexityActionGroup" stepKey="SeeTheErrorPasswordLength"> + <argument name="message" value="Minimum length of this field must be equal or greater than 8 symbols. Leading and trailing spaces will be ignored."/> + </actionGroup> + <!-- Fill Registration Form with not secure enough password --> + <actionGroup ref="StorefrontFillCustomerAccountCreationFormActionGroup" stepKey="FillRegistrationFormPasswordNotSecure"> + <argument name="customer" value="Simple_Customer_With_Not_Secure_Password"/> + </actionGroup> + <!-- See the Error --> + <actionGroup ref="AssertMessageCustomerCreateAccountPasswordComplexityActionGroup" stepKey="SeeTheErrorPasswordSecure"> + <argument name="message" value="Minimum of different classes of characters in password is 3. Classes of characters: Lower Case, Upper Case, Digits, Special Characters."/> </actionGroup> - <!-- Fill Registry Form with Incorrect Password (Two variations) --> - <actionGroup ref="StorefrontFillRegistryFormActionGroup" stepKey="FillRegistryForm"/> <!--Test Body END--> </test> diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/NewCustomerPasswordComplexityTest.xml b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/NewCustomerPasswordComplexityTest.xml index a169a3f175cc6..7b6f3e981714c 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/NewCustomerPasswordComplexityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/NewCustomerPasswordComplexityTest.xml @@ -16,6 +16,7 @@ <data name="customer/data/password" xsi:type="string">123123</data> <data name="customer/data/password_confirmation" xsi:type="string">123123</data> <constraint name="Magento\Security\Test\Constraint\AssertPasswordLengthErrorMessage" /> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> </variation> <variation name="PasswordComplexityTest" summary="Customer password is not secure enough"> <data name="tag" xsi:type="string">severity:S1</data> @@ -26,6 +27,7 @@ <data name="customer/data/password" xsi:type="string">123123qa</data> <data name="customer/data/password_confirmation" xsi:type="string">123123qa</data> <constraint name="Magento\Security\Test\Constraint\AssertPasswordIsNotSecureEnoughMessage" /> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> </variation> </testCase> </config> From 06d06f1824c374af835fe2e5d222f8c7e5b2f9f0 Mon Sep 17 00:00:00 2001 From: David Lambauer <david@run-as-root.sh> Date: Sun, 11 Aug 2019 17:18:18 +0200 Subject: [PATCH 0014/1143] Added Unit Test for Actions Block. Use FQCN. Reduce Code-Smell --- .../Block/Grid/Renderer/Actions.php | 32 +++++---- .../Unit/Block/Grid/Renderer/ActionsTest.php | 70 +++++++++++++++++++ 2 files changed, 88 insertions(+), 14 deletions(-) create mode 100644 app/code/Magento/AdminNotification/Test/Unit/Block/Grid/Renderer/ActionsTest.php diff --git a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php index 82f70d92e4930..ab591702ceae6 100644 --- a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php +++ b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php @@ -1,4 +1,6 @@ <?php +declare(strict_types=1); + /** * Adminhtml AdminNotification Severity Renderer * @@ -8,12 +10,17 @@ namespace Magento\AdminNotification\Block\Grid\Renderer; +use Magento\Backend\Block\Context; +use Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer; +use Magento\Framework\App\ActionInterface; +use Magento\Framework\DataObject; +use Magento\Framework\Url\Helper\Data; + /** * Renderer class for action in the admin notifications grid - * * @package Magento\AdminNotification\Block\Grid\Renderer */ -class Actions extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer +class Actions extends AbstractRenderer { /** * @var \Magento\Framework\Url\Helper\Data @@ -25,11 +32,8 @@ class Actions extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstrac * @param \Magento\Framework\Url\Helper\Data $urlHelper * @param array $data */ - public function __construct( - \Magento\Backend\Block\Context $context, - \Magento\Framework\Url\Helper\Data $urlHelper, - array $data = [] - ) { + public function __construct(Context $context, Data $urlHelper, array $data = []) + { $this->_urlHelper = $urlHelper; parent::__construct($context, $data); } @@ -40,16 +44,16 @@ public function __construct( * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\DataObject $row) + public function render(DataObject $row) : string { - $readDetailsHtml = $row->getUrl() ? '<a class="action-details" target="_blank" href="' . - $this->escapeUrl($row->getUrl()) + $readDetailsHtml = $row->getData('url') ? '<a class="action-details" target="_blank" href="' . + $this->escapeUrl($row->getData('url')) . '">' . __('Read Details') . '</a>' : ''; - $markAsReadHtml = !$row->getIsRead() ? '<a class="action-mark" href="' . $this->getUrl( + $markAsReadHtml = !$row->getData('is_read') ? '<a class="action-mark" href="' . $this->getUrl( '*/*/markAsRead/', - ['_current' => true, 'id' => $row->getId()] + ['_current' => true, 'id' => $row->getData('id')] ) . '">' . __( 'Mark as Read' ) . '</a>' : ''; @@ -63,8 +67,8 @@ public function render(\Magento\Framework\DataObject $row) '*/*/remove/', [ '_current' => true, - 'id' => $row->getId(), - \Magento\Framework\App\ActionInterface::PARAM_NAME_URL_ENCODED => $encodedUrl + 'id' => $row->getData('id'), + ActionInterface::PARAM_NAME_URL_ENCODED => $encodedUrl ] ), __('Are you sure?'), diff --git a/app/code/Magento/AdminNotification/Test/Unit/Block/Grid/Renderer/ActionsTest.php b/app/code/Magento/AdminNotification/Test/Unit/Block/Grid/Renderer/ActionsTest.php new file mode 100644 index 0000000000000..4ffbcd56e8dcb --- /dev/null +++ b/app/code/Magento/AdminNotification/Test/Unit/Block/Grid/Renderer/ActionsTest.php @@ -0,0 +1,70 @@ +<?php +declare(strict_types=1); + +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +/** + * Test class for \Magento\AdminNotification\Block\Grid\Renderer\Actions + */ +namespace Magento\AdminNotification\Test\Unit\Block\Grid\Renderer; + +use Magento\AdminNotification\Block\Grid\Renderer\Actions; +use Magento\Backend\Block\Context; +use Magento\Framework\DataObject; +use Magento\Framework\Escaper; +use Magento\Framework\Url\Helper\Data; +use Magento\Framework\UrlInterface; +use PHPUnit\Framework\TestCase; + +class ActionsTest extends TestCase +{ + /** + * System under Test + * + * @var Actions + */ + private $sut; + + protected function setUp() : void + { + parent::setUp(); + + /** @var Escaper | \PHPUnit_Framework_MockObject_MockObject $escaperMock */ + $escaperMock = $this->getMockBuilder(Escaper::class)->disableOriginalConstructor()->getMock(); + $escaperMock->expects($this->once())->method('escapeUrl')->willReturn('https://magento.com'); + + /** @var UrlInterface | \PHPUnit_Framework_MockObject_MockObject $urlBuilder */ + $urlBuilder = $this->getMockBuilder(UrlInterface::class)->getMock(); + $urlBuilder->expects($this->once())->method('getUrl')->willReturn('http://magento.com'); + + /** @var Context | \PHPUnit_Framework_MockObject_MockObject $contextMock */ + $contextMock = $this->getMockBuilder(Context::class)->disableOriginalConstructor()->getMock(); + $contextMock->expects($this->once())->method('getEscaper')->willReturn($escaperMock); + $contextMock->expects($this->once())->method('getUrlBuilder')->willReturn($urlBuilder); + + /** @var Data | \PHPUnit_Framework_MockObject_MockObject $urlHelperMock */ + $urlHelperMock = $this->getMockBuilder(Data::class)->disableOriginalConstructor()->getMock(); + $urlHelperMock->expects($this->once())->method('getEncodedUrl')->willReturn('http://magento.com'); + + $this->sut = new Actions($contextMock, $urlHelperMock); + + } + + public function test_should_render_message_when_urlIsGiven() : void + { + $dataObject = new DataObject(); + $dataObject->setdata('url', 'https://magento.com'); + $dataObject->setdata('is_read', true); + $dataObject->setdata('id', 1); + + $actual = $this->sut->render($dataObject); + $expected = <<<HTML +<a class="action-details" target="_blank" href="https://magento.com">Read Details</a><a class="action-delete" href="http://magento.com" onClick="deleteConfirm('Are you sure?', this.href); return false;">Remove</a> +HTML; + + $this->assertEquals($actual, $expected); + } +} From cae8810baaee949298eccee884d2a6f97fcd3898 Mon Sep 17 00:00:00 2001 From: David Lambauer <david@run-as-root.sh> Date: Sun, 11 Aug 2019 17:19:19 +0200 Subject: [PATCH 0015/1143] Added Unit Test for Notice Block. Added strict type hint. Removed Code-Smell --- .../Block/Grid/Renderer/Notice.php | 13 +++-- .../Unit/Block/Grid/Renderer/NoticeTest.php | 56 +++++++++++++++++++ 2 files changed, 65 insertions(+), 4 deletions(-) create mode 100644 app/code/Magento/AdminNotification/Test/Unit/Block/Grid/Renderer/NoticeTest.php diff --git a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Notice.php b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Notice.php index ccc1b98a228ce..8de85cf1b241f 100644 --- a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Notice.php +++ b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Notice.php @@ -1,4 +1,6 @@ <?php +declare(strict_types=1); + /** * Adminhtml AdminNotification Severity Renderer * @@ -7,7 +9,10 @@ */ namespace Magento\AdminNotification\Block\Grid\Renderer; -class Notice extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer +use Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer; +use Magento\Framework\DataObject; + +class Notice extends AbstractRenderer { /** * Renders grid column @@ -15,11 +20,11 @@ class Notice extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstract * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\DataObject $row) + public function render(DataObject $row) : string { return '<span class="grid-row-title">' . - $this->escapeHtml($row->getTitle()) . + $this->escapeHtml($row->getData('title')) . '</span>' . - ($row->getDescription() ? '<br />' . $this->escapeHtml($row->getDescription()) : ''); + ($row->getData('description') ? '<br />' . $this->escapeHtml($row->getData('description')) : ''); } } diff --git a/app/code/Magento/AdminNotification/Test/Unit/Block/Grid/Renderer/NoticeTest.php b/app/code/Magento/AdminNotification/Test/Unit/Block/Grid/Renderer/NoticeTest.php new file mode 100644 index 0000000000000..4ed41a79bdaa8 --- /dev/null +++ b/app/code/Magento/AdminNotification/Test/Unit/Block/Grid/Renderer/NoticeTest.php @@ -0,0 +1,56 @@ +<?php +declare(strict_types=1); + +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +/** + * Test class for \Magento\AdminNotification\Block\Grid\Renderer\Actions + */ +namespace Magento\AdminNotification\Test\Unit\Block\Grid\Renderer; + +use Magento\AdminNotification\Block\Grid\Renderer\Notice; +use Magento\Framework\DataObject; +use Magento\Framework\Escaper; +use Magento\Backend\Block\Context; +use PHPUnit\Framework\TestCase; + +class NoticeTest extends TestCase +{ + /** + * System under Test + * + * @var Notice + */ + private $sut; + + protected function setUp() : void + { + parent::setUp(); + + /** @var Escaper | \PHPUnit_Framework_MockObject_MockObject $escaperMock */ + $escaperMock = $this->getMockBuilder(Escaper::class)->disableOriginalConstructor()->getMock(); + $escaperMock->expects($this->exactly(2))->method('escapeHtml')->willReturn('<div>Some random html</div>'); + + /** @var Context | \PHPUnit_Framework_MockObject_MockObject $contextMock */ + $contextMock = $this->getMockBuilder(Context::class)->disableOriginalConstructor()->getMock(); + $contextMock->expects($this->once())->method('getEscaper')->willReturn($escaperMock); + + $this->sut = new Notice($contextMock); + + } + + public function test_should_render_notice() : void + { + $dataObject = new DataObject(); + $dataObject->setData('title', 'A great Title'); + $dataObject->setData('description', 'Handy description right here'); + + $actual = $this->sut->render($dataObject); + $expected = '<span class="grid-row-title"><div>Some random html</div></span><br /><div>Some random html</div>'; + + $this->assertEquals($actual, $expected); + } +} From 32f9293b28fc9a212a506e5e45cad538983f07ef Mon Sep 17 00:00:00 2001 From: David Lambauer <david@run-as-root.sh> Date: Sun, 11 Aug 2019 17:20:19 +0200 Subject: [PATCH 0016/1143] Added Unit Test for Severity Block. Use FQCN. Added strict type hints --- .../Block/Grid/Renderer/Severity.php | 22 +++-- .../Unit/Block/Grid/Renderer/SeverityTest.php | 87 +++++++++++++++++++ 2 files changed, 101 insertions(+), 8 deletions(-) create mode 100644 app/code/Magento/AdminNotification/Test/Unit/Block/Grid/Renderer/SeverityTest.php diff --git a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Severity.php b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Severity.php index 033fa52c55081..69c9d1994e764 100644 --- a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Severity.php +++ b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Severity.php @@ -1,4 +1,6 @@ <?php +declare(strict_types=1); + /** * Adminhtml AdminNotification Severity Renderer * @@ -7,9 +9,13 @@ */ namespace Magento\AdminNotification\Block\Grid\Renderer; +use Magento\AdminNotification\Model\Inbox; +use Magento\Backend\Block\Context; +use Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer; +use Magento\Framework\DataObject; use Magento\Framework\Notification\MessageInterface; -class Severity extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer +class Severity extends AbstractRenderer { /** * @var \Magento\AdminNotification\Model\Inbox @@ -21,11 +27,8 @@ class Severity extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstra * @param \Magento\AdminNotification\Model\Inbox $notice * @param array $data */ - public function __construct( - \Magento\Backend\Block\Context $context, - \Magento\AdminNotification\Model\Inbox $notice, - array $data = [] - ) { + public function __construct(Context $context, Inbox $notice, array $data = []) + { parent::__construct($context, $data); $this->_notice = $notice; } @@ -36,12 +39,14 @@ public function __construct( * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\DataObject $row) + public function render(DataObject $row) : string { $class = ''; $value = ''; - switch ($row->getData($this->getColumn()->getIndex())) { + $column = $this->getColumn(); + $index = $column->getData('index'); + switch ($row->getData($index)) { case MessageInterface::SEVERITY_CRITICAL: $class = 'critical'; $value = $this->_notice->getSeverities(MessageInterface::SEVERITY_CRITICAL); @@ -59,6 +64,7 @@ public function render(\Magento\Framework\DataObject $row) $value = $this->_notice->getSeverities(MessageInterface::SEVERITY_NOTICE); break; } + return '<span class="grid-severity-' . $class . '"><span>' . $value . '</span></span>'; } } diff --git a/app/code/Magento/AdminNotification/Test/Unit/Block/Grid/Renderer/SeverityTest.php b/app/code/Magento/AdminNotification/Test/Unit/Block/Grid/Renderer/SeverityTest.php new file mode 100644 index 0000000000000..2791d6d6ce15e --- /dev/null +++ b/app/code/Magento/AdminNotification/Test/Unit/Block/Grid/Renderer/SeverityTest.php @@ -0,0 +1,87 @@ +<?php +declare(strict_types=1); + +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +/** + * Test class for \Magento\AdminNotification\Block\Grid\Renderer\Actions + */ +namespace Magento\AdminNotification\Test\Unit\Block\Grid\Renderer; + +use Magento\AdminNotification\Block\Grid\Renderer\Severity; +use Magento\AdminNotification\Model\Inbox; +use Magento\Backend\Block\Context; +use Magento\Backend\Block\Widget\Grid\Column; +use Magento\Framework\DataObject; +use Magento\Framework\Escaper; +use PHPUnit\Framework\TestCase; + +class SeverityTest extends TestCase +{ + /** + * System under Test + * + * @var Severity + */ + private $sut; + + protected function setUp() : void + { + parent::setUp(); + + /** @var Inbox |\PHPUnit_Framework_MockObject_MockObject $inboxMock */ + $inboxMock = $this->getMockBuilder(Inbox::class)->disableOriginalConstructor()->getMock(); + + /** @var Context | \PHPUnit_Framework_MockObject_MockObject $contextMock */ + $contextMock = $this->getMockBuilder(Context::class)->disableOriginalConstructor()->getMock(); + + $this->sut = new Severity($contextMock, $inboxMock); + } + + public function test_should_render_severity() : void + { + /** @var Column | \PHPUnit_Framework_MockObject_MockObject $columnMock */ + $columnMock = $this->getMockBuilder(Column::class)->disableOriginalConstructor()->getMock(); + $columnMock->expects($this->exactly(5))->method('getData')->with($this->equalTo('index'))->willReturn('a magic index'); + $this->sut->setColumn($columnMock); + $dataObject = new DataObject(); + + // Test critical severity + $dataObject->setData('a magic index', 1); + $actual = $this->sut->render($dataObject); + $expected = '<span class="grid-severity-critical"><span></span></span>'; + + $this->assertEquals($actual, $expected); + + // Test major severity + $dataObject->setData('a magic index', 2); + $actual = $this->sut->render($dataObject); + $expected = '<span class="grid-severity-major"><span></span></span>'; + + $this->assertEquals($actual, $expected); + + // Test minor severity + $dataObject->setData('a magic index', 3); + $actual = $this->sut->render($dataObject); + $expected = '<span class="grid-severity-minor"><span></span></span>'; + + $this->assertEquals($actual, $expected); + + // Test notice severity + $dataObject->setData('a magic index', 4); + $actual = $this->sut->render($dataObject); + $expected = '<span class="grid-severity-notice"><span></span></span>'; + + $this->assertEquals($actual, $expected); + + // Test default severity + $dataObject->setData('a magic index', 5); + $actual = $this->sut->render($dataObject); + $expected = '<span class="grid-severity-"><span></span></span>'; + + $this->assertEquals($actual, $expected); + } +} From 3188cac632b7b54d9afd78f0d3993930d469b946 Mon Sep 17 00:00:00 2001 From: David Lambauer <david@run-as-root.sh> Date: Sun, 11 Aug 2019 17:43:59 +0200 Subject: [PATCH 0017/1143] Fix CS --- .../Test/Unit/Block/Grid/Renderer/ActionsTest.php | 13 ++++++++----- .../Test/Unit/Block/Grid/Renderer/NoticeTest.php | 3 +-- .../Test/Unit/Block/Grid/Renderer/SeverityTest.php | 14 +++++++------- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/app/code/Magento/AdminNotification/Test/Unit/Block/Grid/Renderer/ActionsTest.php b/app/code/Magento/AdminNotification/Test/Unit/Block/Grid/Renderer/ActionsTest.php index 4ffbcd56e8dcb..781734186ce6b 100644 --- a/app/code/Magento/AdminNotification/Test/Unit/Block/Grid/Renderer/ActionsTest.php +++ b/app/code/Magento/AdminNotification/Test/Unit/Block/Grid/Renderer/ActionsTest.php @@ -1,5 +1,5 @@ <?php -declare(strict_types=1); +declare(strict_types = 1); /** * Copyright © Magento, Inc. All rights reserved. @@ -9,6 +9,7 @@ /** * Test class for \Magento\AdminNotification\Block\Grid\Renderer\Actions */ + namespace Magento\AdminNotification\Test\Unit\Block\Grid\Renderer; use Magento\AdminNotification\Block\Grid\Renderer\Actions; @@ -23,7 +24,6 @@ class ActionsTest extends TestCase { /** * System under Test - * * @var Actions */ private $sut; @@ -50,20 +50,23 @@ protected function setUp() : void $urlHelperMock->expects($this->once())->method('getEncodedUrl')->willReturn('http://magento.com'); $this->sut = new Actions($contextMock, $urlHelperMock); - } - public function test_should_render_message_when_urlIsGiven() : void + public function testShouldRenderMessageWhenUrlIsGiven() : void { $dataObject = new DataObject(); $dataObject->setdata('url', 'https://magento.com'); $dataObject->setdata('is_read', true); $dataObject->setdata('id', 1); - $actual = $this->sut->render($dataObject); + $actual = $this->sut->render($dataObject); + + // Ignoring Code Style at this point due to the long HEREDOC + // phpcs:disable $expected = <<<HTML <a class="action-details" target="_blank" href="https://magento.com">Read Details</a><a class="action-delete" href="http://magento.com" onClick="deleteConfirm('Are you sure?', this.href); return false;">Remove</a> HTML; + // phpcs:enable $this->assertEquals($actual, $expected); } diff --git a/app/code/Magento/AdminNotification/Test/Unit/Block/Grid/Renderer/NoticeTest.php b/app/code/Magento/AdminNotification/Test/Unit/Block/Grid/Renderer/NoticeTest.php index 4ed41a79bdaa8..7b4b0a0f66e96 100644 --- a/app/code/Magento/AdminNotification/Test/Unit/Block/Grid/Renderer/NoticeTest.php +++ b/app/code/Magento/AdminNotification/Test/Unit/Block/Grid/Renderer/NoticeTest.php @@ -39,10 +39,9 @@ protected function setUp() : void $contextMock->expects($this->once())->method('getEscaper')->willReturn($escaperMock); $this->sut = new Notice($contextMock); - } - public function test_should_render_notice() : void + public function testShouldRenderNotice() : void { $dataObject = new DataObject(); $dataObject->setData('title', 'A great Title'); diff --git a/app/code/Magento/AdminNotification/Test/Unit/Block/Grid/Renderer/SeverityTest.php b/app/code/Magento/AdminNotification/Test/Unit/Block/Grid/Renderer/SeverityTest.php index 2791d6d6ce15e..f42c740ca8fee 100644 --- a/app/code/Magento/AdminNotification/Test/Unit/Block/Grid/Renderer/SeverityTest.php +++ b/app/code/Magento/AdminNotification/Test/Unit/Block/Grid/Renderer/SeverityTest.php @@ -41,44 +41,44 @@ protected function setUp() : void $this->sut = new Severity($contextMock, $inboxMock); } - public function test_should_render_severity() : void + public function testShouldRenderSeverity() : void { /** @var Column | \PHPUnit_Framework_MockObject_MockObject $columnMock */ $columnMock = $this->getMockBuilder(Column::class)->disableOriginalConstructor()->getMock(); - $columnMock->expects($this->exactly(5))->method('getData')->with($this->equalTo('index'))->willReturn('a magic index'); + $columnMock->expects($this->exactly(5))->method('getData')->with($this->equalTo('index'))->willReturn('index'); $this->sut->setColumn($columnMock); $dataObject = new DataObject(); // Test critical severity - $dataObject->setData('a magic index', 1); + $dataObject->setData('index', 1); $actual = $this->sut->render($dataObject); $expected = '<span class="grid-severity-critical"><span></span></span>'; $this->assertEquals($actual, $expected); // Test major severity - $dataObject->setData('a magic index', 2); + $dataObject->setData('index', 2); $actual = $this->sut->render($dataObject); $expected = '<span class="grid-severity-major"><span></span></span>'; $this->assertEquals($actual, $expected); // Test minor severity - $dataObject->setData('a magic index', 3); + $dataObject->setData('index', 3); $actual = $this->sut->render($dataObject); $expected = '<span class="grid-severity-minor"><span></span></span>'; $this->assertEquals($actual, $expected); // Test notice severity - $dataObject->setData('a magic index', 4); + $dataObject->setData('index', 4); $actual = $this->sut->render($dataObject); $expected = '<span class="grid-severity-notice"><span></span></span>'; $this->assertEquals($actual, $expected); // Test default severity - $dataObject->setData('a magic index', 5); + $dataObject->setData('index', 5); $actual = $this->sut->render($dataObject); $expected = '<span class="grid-severity-"><span></span></span>'; From c2155d5c01a158656a00a921ae15cf145de779cd Mon Sep 17 00:00:00 2001 From: David Lambauer <david@run-as-root.sh> Date: Sun, 11 Aug 2019 18:32:49 +0200 Subject: [PATCH 0018/1143] Fixed PHP CS --- .../AdminNotification/Block/Grid/Renderer/Actions.php | 1 + .../Magento/AdminNotification/Block/Grid/Renderer/Notice.php | 5 +++++ .../AdminNotification/Block/Grid/Renderer/Severity.php | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php index ab591702ceae6..2db5bfec92395 100644 --- a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php +++ b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php @@ -18,6 +18,7 @@ /** * Renderer class for action in the admin notifications grid + * * @package Magento\AdminNotification\Block\Grid\Renderer */ class Actions extends AbstractRenderer diff --git a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Notice.php b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Notice.php index 8de85cf1b241f..34919258dbc6c 100644 --- a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Notice.php +++ b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Notice.php @@ -12,6 +12,11 @@ use Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer; use Magento\Framework\DataObject; +/** + * Renderer class for notice in the admin notifications grid + * + * @package Magento\AdminNotification\Block\Grid\Renderer + */ class Notice extends AbstractRenderer { /** diff --git a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Severity.php b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Severity.php index 69c9d1994e764..bf26bc15813e1 100644 --- a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Severity.php +++ b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Severity.php @@ -15,6 +15,11 @@ use Magento\Framework\DataObject; use Magento\Framework\Notification\MessageInterface; +/** + * Renderer class for severity in the admin notifications grid + * + * @package Magento\AdminNotification\Block\Grid\Renderer + */ class Severity extends AbstractRenderer { /** From 20567da3428c0ee720c3c5804d6d36d0b6ead089 Mon Sep 17 00:00:00 2001 From: Mila Lesechko <l.lesechko@gmail.com> Date: Tue, 27 Aug 2019 21:43:54 -0500 Subject: [PATCH 0019/1143] Convert MoveProductFromShoppingCartToWishlistTest to MFTF --- .../Section/CheckoutCartProductSection.xml | 1 + ...orefrontCustomerWishlistProductSection.xml | 3 + ...eProductFromShoppingCartToWishlistTest.xml | 164 ++++++++++++++++++ ...eProductFromShoppingCartToWishlistTest.xml | 110 ++++++++++++ ...eProductFromShoppingCartToWishlistTest.xml | 101 +++++++++++ ...lProductFromShoppingCartToWishlistTest.xml | 71 ++++++++ ...eProductFromShoppingCartToWishlistTest.xml | 5 +- 7 files changed, 454 insertions(+), 1 deletion(-) create mode 100644 app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveConfigurableProductFromShoppingCartToWishlistTest.xml create mode 100644 app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveDynamicBundleProductFromShoppingCartToWishlistTest.xml create mode 100644 app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveFixedBundleProductFromShoppingCartToWishlistTest.xml create mode 100644 app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveVirtualProductFromShoppingCartToWishlistTest.xml diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartProductSection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartProductSection.xml index 3ab3fa5857b78..f028fae1f1f21 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartProductSection.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartProductSection.xml @@ -32,6 +32,7 @@ selector="//table[@id='shopping-cart-table']//tbody//tr[contains(@class,'item-actions')]//a[contains(@class,'action-delete')]"/> <element name="removeProductByName" type="text" selector="//*[contains(text(), '{{productName}}')]/ancestor::tbody//a[@class='action action-delete']" parameterized="true" timeout="30"/> <element name="productName" type="text" selector="//tbody[@class='cart item']//strong[@class='product-item-name']"/> + <element name="moveToWishlistByProductName" type="button" selector="//a[contains(text(), '{{productName}}')]/ancestor::tbody/tr//a[contains(@class, 'towishlist')]" parameterized="true"/> <element name="nthItemOption" type="block" selector=".item:nth-of-type({{numElement}}) .item-options" parameterized="true"/> <element name="nthEditButton" type="block" selector=".item:nth-of-type({{numElement}}) .action-edit" parameterized="true"/> <element name="nthBundleOptionName" type="text" selector=".product-item-details .item-options:nth-of-type({{numOption}}) dt" parameterized="true"/> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistProductSection.xml b/app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistProductSection.xml index 0b6c2f1191c40..dba0acfc29e8e 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistProductSection.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistProductSection.xml @@ -24,5 +24,8 @@ <element name="productSuccessShareMessage" type="text" selector="div.message-success"/> <element name="pager" type="block" selector=".toolbar .pager"/> <element name="wishlistEmpty" type="block" selector=".form-wishlist-items .message.info.empty"/> + <element name="productSeeDetailsByName" type="block" selector="//a[contains(text(), '{{productName}}')]/ancestor::div/div[contains(@class, 'product-item-tooltip')]" parameterized="true"/> + <element name="productSeeDetailsLabelByName" type="block" selector="//a[contains(text(), '{{productName}}')]/ancestor::div/div[contains(@class, 'product-item-tooltip')]//dt[@class='label']" parameterized="true"/> + <element name="productSeeDetailsValueByName" type="block" selector="//a[contains(text(), '{{productName}}')]/ancestor::div/div[contains(@class, 'product-item-tooltip')]//dd[@class='values']" parameterized="true"/> </section> </sections> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveConfigurableProductFromShoppingCartToWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveConfigurableProductFromShoppingCartToWishlistTest.xml new file mode 100644 index 0000000000000..317f937def3f1 --- /dev/null +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveConfigurableProductFromShoppingCartToWishlistTest.xml @@ -0,0 +1,164 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="StorefrontMoveConfigurableProductFromShoppingCartToWishlistTest"> + <annotations> + <stories value="Wishlist"/> + <title value="Move Configurable Product from Shopping Cart to Wishlist"/> + <description value="Move Configurable Product from Shopping Cart to Wishlist"/> + <severity value="CRITICAL"/> + <testCaseId value="MAGETWO-29545"/> + <group value="wishlist"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <!-- Create Data --> + <createData entity="Simple_US_Customer" stepKey="createCustomer"/> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <!-- Create an attribute with three options to be used in the first child product --> + <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="productAttributeOption3" stepKey="createConfigProductAttributeOption3"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </createData> + + <!-- Add the attribute just created to default attribute set --> + <createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </createData> + + <!-- Get the first option of the attribute created --> + <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </getData> + + <!-- Get the second option of the attribute created --> + <getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeOption2"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </getData> + + <!-- Get the third option of the attribute created --> + <getData entity="ProductAttributeOptionGetter" index="3" stepKey="getConfigAttributeOption3"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </getData> + + <!-- Create Configurable product --> + <createData entity="BaseConfigurableProduct" stepKey="createConfigProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + + <!-- Create a simple product and give it the attribute with the first option --> + <createData entity="ApiSimpleOne" stepKey="createConfigChildProduct1"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="getConfigAttributeOption1"/> + <field key="price">10.00</field> + </createData> + + <!--Create a simple product and give it the attribute with the second option --> + <createData entity="ApiSimpleTwo" stepKey="createConfigChildProduct2"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="getConfigAttributeOption2"/> + <field key="price">20.00</field> + </createData> + + <!--Create a simple product and give it the attribute with the Third option --> + <createData entity="ApiSimpleTwo" stepKey="createConfigChildProduct3"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="getConfigAttributeOption3"/> + <field key="price">30.00</field> + </createData> + + <!-- Create the configurable product --> + <createData entity="ConfigurableProductThreeOptions" stepKey="createConfigProductOption"> + <requiredEntity createDataKey="createConfigProduct"/> + <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="getConfigAttributeOption1"/> + <requiredEntity createDataKey="getConfigAttributeOption2"/> + <requiredEntity createDataKey="getConfigAttributeOption3"/> + </createData> + + <!-- Add the first simple product to the configurable product --> + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild1"> + <requiredEntity createDataKey="createConfigProduct"/> + <requiredEntity createDataKey="createConfigChildProduct1"/> + </createData> + + <!-- Add the second simple product to the configurable product --> + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild2"> + <requiredEntity createDataKey="createConfigProduct"/> + <requiredEntity createDataKey="createConfigChildProduct2"/> + </createData> + + <!-- Add the third simple product to the configurable product --> + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild3"> + <requiredEntity createDataKey="createConfigProduct"/> + <requiredEntity createDataKey="createConfigChildProduct3"/> + </createData> + </before> + <after> + <!-- Delete data --> + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> + <deleteData createDataKey="createConfigChildProduct1" stepKey="deleteSimpleProduct1"/> + <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteSimpleProduct2"/> + <deleteData createDataKey="createConfigChildProduct3" stepKey="deleteSimpleProduct3"/> + <deleteData createDataKey="createConfigProduct" stepKey="deleteProduct"/> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteProductAttribute"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <!-- 1. Login as a customer --> + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginToStorefrontAccount"> + <argument name="Customer" value="$$createCustomer$$"/> + </actionGroup> + + <!-- Open Product page --> + <actionGroup ref="OpenProductFromCategoryPageActionGroup" stepKey="openProductFromCategory"> + <argument name="category" value="$$createCategory$$"/> + <argument name="product" value="$$createConfigProduct$$"/> + </actionGroup> + <selectOption selector="{{StorefrontProductInfoMainSection.productOptionSelect($$createConfigProductAttribute.default_value$$)}}" userInput="$$getConfigAttributeOption2.label$$" stepKey="selectOption1"/> + <scrollTo selector="{{StorefrontProductInfoMainSection.productAddToWishlist}}" y="-200" stepKey="scroll"/> + + <!-- Add product to the cart and Assert add product to cart success message--> + <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartVirtualProductFromStorefrontProductPage"> + <argument name="productName" value="$$createConfigProduct.name$$"/> + </actionGroup> + + <!-- Select Mini Cart and select 'View And Edit Cart' --> + <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="selectViewAndEditCart"/> + + <!-- Assert move product to wishlist success message --> + <click selector="{{CheckoutCartProductSection.moveToWishlistByProductName($$createConfigProduct.name$$)}}" stepKey="moveToWishlist"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <see userInput="$$createConfigProduct.name$$ has been moved to your wish list." selector="{{CheckoutCartMessageSection.successMessage}}" stepKey="assertMoveProductToWishlistSuccessMessage"/> + + <!-- Assert product is present in wishlist --> + <amOnPage url="{{StorefrontCustomerWishlistPage.url}}" stepKey="goToWishlistPage"/> + <waitForPageLoad stepKey="waitForWishlistPage"/> + <waitForElement selector="{{StorefrontCustomerWishlistProductSection.ProductTitleByName($$createConfigProduct.name$$)}}" time="30" stepKey="assertWishlistProductName"/> + <see userInput="$20.00" selector="{{StorefrontCustomerWishlistProductSection.ProductPriceByName($$createConfigProduct.name$$)}}" stepKey="AssertWishlistProductPrice"/> + + <!-- Assert product details in Wishlist --> + <moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.ProductInfoByName($$createConfigProduct.name$$)}}" stepKey="wishlistMoveMouseOverProduct"/> + <seeElement selector="{{StorefrontCustomerWishlistProductSection.ProductAddToCartByName($$createConfigProduct.name$$)}}" stepKey="AssertWishlistAddToCart"/> + <seeElement selector="{{StorefrontCustomerWishlistProductSection.ProductImageByName($$createConfigProduct.name$$)}}" stepKey="AssertWishlistProductImage"/> + <moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.productSeeDetailsByName($$createConfigProduct.name$$)}}" stepKey="seeDetailsMoveMouseOverProduct"/> + <see userInput="$$createConfigProductAttribute.default_value$$" selector="{{StorefrontCustomerWishlistProductSection.productSeeDetailsLabelByName($$createConfigProduct.name$$)}}" stepKey="seeAttribute"/> + <see userInput="$$getConfigAttributeOption2.label$$" selector="{{StorefrontCustomerWishlistProductSection.productSeeDetailsValueByName($$createConfigProduct.name$$)}}" stepKey="seeOption"/> + + <actionGroup ref="AssertShoppingCartIsEmptyActionGroup" stepKey="assertCartIsEmpty"/> + </test> +</tests> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveDynamicBundleProductFromShoppingCartToWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveDynamicBundleProductFromShoppingCartToWishlistTest.xml new file mode 100644 index 0000000000000..dcd69a61e596f --- /dev/null +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveDynamicBundleProductFromShoppingCartToWishlistTest.xml @@ -0,0 +1,110 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="StorefrontMoveDynamicBundleProductFromShoppingCartToWishlistTest"> + <annotations> + <stories value="Wishlist"/> + <title value="Move Dynamic Bundle Product from Shopping Cart to Wishlist"/> + <description value="Move Dynamic Bundle Product from Shopping Cart to Wishlist"/> + <severity value="CRITICAL"/> + <testCaseId value="MAGETWO-29545"/> + <group value="wishlist"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <!-- Create Data --> + <createData entity="Simple_US_Customer" stepKey="createCustomer"/> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <createData entity="SimpleProduct2" stepKey="simpleProduct1"> + <field key="price">100.00</field> + </createData> + <createData entity="SimpleProduct2" stepKey="simpleProduct2"> + <field key="price">20.00</field> + </createData> + <!--Create Bundle product--> + <createData entity="ApiBundleProductPriceViewRange" stepKey="createBundleProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + <createData entity="DropDownBundleOption" stepKey="createBundleOption1_1"> + <requiredEntity createDataKey="createBundleProduct"/> + </createData> + <createData entity="ApiBundleLink" stepKey="linkOptionToProduct"> + <requiredEntity createDataKey="createBundleProduct"/> + <requiredEntity createDataKey="createBundleOption1_1"/> + <requiredEntity createDataKey="simpleProduct1"/> + </createData> + <createData entity="ApiBundleLink" stepKey="linkOptionToProduct2"> + <requiredEntity createDataKey="createBundleProduct"/> + <requiredEntity createDataKey="createBundleOption1_1"/> + <requiredEntity createDataKey="simpleProduct2"/> + </createData> + <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> + <actionGroup ref="goToProductPageViaID" stepKey="goToProduct"> + <argument name="productId" value="$$createBundleProduct.id$$"/> + </actionGroup> + <scrollTo selector="{{AdminProductFormBundleSection.contentDropDown}}" stepKey="scrollToBundleSection"/> + <selectOption userInput="Separately" selector="{{AdminProductFormBundleSection.shipmentType}}" stepKey="selectSeparately"/> + <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <magentoCLI stepKey="reindex" command="indexer:reindex"/> + <magentoCLI stepKey="flushCache" command="cache:flush"/> + </before> + <after> + <!-- Delete data --> + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <deleteData createDataKey="createBundleProduct" stepKey="deleteBundleProduct"/> + <deleteData createDataKey="simpleProduct1" stepKey="deleteProduct1"/> + <deleteData createDataKey="simpleProduct2" stepKey="deleteProduct2"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <!-- 1. Login as a customer --> + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginToStorefrontAccount"> + <argument name="Customer" value="$$createCustomer$$"/> + </actionGroup> + + <!-- Open Product page --> + <actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="openProductFromCategory"> + <argument name="productUrlKey" value="$$createBundleProduct.custom_attributes[url_key]$$"/> + </actionGroup> + <actionGroup ref="StorefrontSelectCustomizeAndAddToTheCartButtonActionGroup" stepKey="clickCustomizeButton"/> + <selectOption selector="{{StorefrontBundledSection.dropDownOptionOneProducts($$createBundleOption1_1.title$$)}}" userInput="$$simpleProduct1.sku$$ +$100.00" stepKey="selectOption0Product0"/> + <fillField selector="{{StorefrontBundledSection.dropDownOptionOneQuantity($$createBundleOption1_1.title$$)}}" userInput="1" stepKey="fillQuantity00"/> + + <!-- Add product to the cart and Assert add product to cart success message--> + <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartVirtualProductFromStorefrontProductPage"> + <argument name="productName" value="$$createBundleProduct.name$$"/> + </actionGroup> + + <!-- Select Mini Cart and select 'View And Edit Cart' --> + <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="selectViewAndEditCart"/> + + <!-- Assert move product to wishlist success message --> + <click selector="{{CheckoutCartProductSection.moveToWishlistByProductName($$createBundleProduct.name$$)}}" stepKey="moveToWishlist"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <see userInput="$$createBundleProduct.name$$ has been moved to your wish list." selector="{{CheckoutCartMessageSection.successMessage}}" stepKey="assertMoveProductToWishlistSuccessMessage"/> + + <!-- Assert product is present in wishlist --> + <amOnPage url="{{StorefrontCustomerWishlistPage.url}}" stepKey="goToWishlistPage"/> + <waitForPageLoad stepKey="waitForWishlistPage"/> + <waitForElement selector="{{StorefrontCustomerWishlistProductSection.ProductTitleByName($$createBundleProduct.name$$)}}" time="30" stepKey="assertWishlistProductName"/> + <see userInput="$100.00" selector="{{StorefrontCustomerWishlistProductSection.ProductPriceByName($$createBundleProduct.name$$)}}" stepKey="AssertWishlistProductPrice"/> + + <!-- Assert product details in Wishlist --> + <moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.ProductInfoByName($$createBundleProduct.name$$)}}" stepKey="wishlistMoveMouseOverProduct"/> + <seeElement selector="{{StorefrontCustomerWishlistProductSection.ProductAddToCartByName($$createBundleProduct.name$$)}}" stepKey="AssertWishlistAddToCart"/> + <seeElement selector="{{StorefrontCustomerWishlistProductSection.ProductImageByName($$createBundleProduct.name$$)}}" stepKey="AssertWishlistProductImage"/> + <moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.productSeeDetailsByName($$createBundleProduct.name$$)}}" stepKey="seeDetailsMoveMouseOverProduct"/> + <see userInput="$$createBundleOption1_1.title$$" selector="{{StorefrontCustomerWishlistProductSection.productSeeDetailsLabelByName($$createBundleProduct.name$$)}}" stepKey="seeBundleOption"/> + <see userInput="$$simpleProduct1.sku$$ $100.00" selector="{{StorefrontCustomerWishlistProductSection.productSeeDetailsValueByName($$createBundleProduct.name$$)}}" stepKey="seeProduct"/> + + <actionGroup ref="AssertShoppingCartIsEmptyActionGroup" stepKey="assertCartIsEmpty"/> + </test> +</tests> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveFixedBundleProductFromShoppingCartToWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveFixedBundleProductFromShoppingCartToWishlistTest.xml new file mode 100644 index 0000000000000..4d99b05e9aa6a --- /dev/null +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveFixedBundleProductFromShoppingCartToWishlistTest.xml @@ -0,0 +1,101 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="StorefrontMoveFixedBundleProductFromShoppingCartToWishlistTest"> + <annotations> + <stories value="Wishlist"/> + <title value="Move Fixed Bundle Product from Shopping Cart to Wishlist"/> + <description value="Move Fixed Bundle Product from Shopping Cart to Wishlist"/> + <severity value="CRITICAL"/> + <testCaseId value="MAGETWO-29545"/> + <group value="wishlist"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <!-- Create Data --> + <createData entity="Simple_US_Customer" stepKey="createCustomer"/> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <createData entity="SimpleProduct2" stepKey="simpleProduct1"/> + <createData entity="SimpleProduct2" stepKey="simpleProduct2"/> + <!-- Create bundle product --> + <createData entity="ApiFixedBundleProduct" stepKey="createBundleProduct"/> + <createData entity="DropDownBundleOption" stepKey="createBundleOption1_1"> + <requiredEntity createDataKey="createBundleProduct"/> + </createData> + <createData entity="ApiBundleLink" stepKey="createBundleLink"> + <field key="price_type">0</field> + <field key="price">100</field> + <requiredEntity createDataKey="createBundleProduct"/> + <requiredEntity createDataKey="createBundleOption1_1"/> + <requiredEntity createDataKey="simpleProduct1"/> + </createData> + <createData entity="ApiBundleLink" stepKey="linkOptionToProduct2"> + <field key="price_type">0</field> + <field key="price">100</field> + <requiredEntity createDataKey="createBundleProduct"/> + <requiredEntity createDataKey="createBundleOption1_1"/> + <requiredEntity createDataKey="simpleProduct2"/> + </createData> + <magentoCLI stepKey="reindex" command="indexer:reindex"/> + <magentoCLI stepKey="flushCache" command="cache:flush"/> + </before> + <after> + <!-- Delete data --> + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <deleteData createDataKey="createBundleProduct" stepKey="deleteBundleProduct"/> + <deleteData createDataKey="simpleProduct1" stepKey="deleteProduct1"/> + <deleteData createDataKey="simpleProduct2" stepKey="deleteProduct2"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <!-- 1. Login as a customer --> + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginToStorefrontAccount"> + <argument name="Customer" value="$$createCustomer$$"/> + </actionGroup> + + <!-- Open Product page --> + <actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="openProductFromCategory"> + <argument name="productUrlKey" value="$$createBundleProduct.custom_attributes[url_key]$$"/> + </actionGroup> + <actionGroup ref="StorefrontSelectCustomizeAndAddToTheCartButtonActionGroup" stepKey="clickCustomizeButton"/> + <selectOption selector="{{StorefrontBundledSection.dropDownOptionOneProducts($$createBundleOption1_1.title$$)}}" userInput="$$simpleProduct1.sku$$ +$100.00" stepKey="selectOption0Product0"/> + <fillField selector="{{StorefrontBundledSection.dropDownOptionOneQuantity($$createBundleOption1_1.title$$)}}" userInput="1" stepKey="fillQuantity00"/> + + <!-- Add product to the cart and Assert add product to cart success message--> + <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartVirtualProductFromStorefrontProductPage"> + <argument name="productName" value="$$createBundleProduct.name$$"/> + </actionGroup> + + <!-- Select Mini Cart and select 'View And Edit Cart' --> + <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="selectViewAndEditCart"/> + + <!-- Assert move product to wishlist success message --> + <click selector="{{CheckoutCartProductSection.moveToWishlistByProductName($$createBundleProduct.name$$)}}" stepKey="moveToWishlist"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <see userInput="$$createBundleProduct.name$$ has been moved to your wish list." selector="{{CheckoutCartMessageSection.successMessage}}" stepKey="assertMoveProductToWishlistSuccessMessage"/> + + <!-- Assert product is present in wishlist --> + <amOnPage url="{{StorefrontCustomerWishlistPage.url}}" stepKey="goToWishlistPage"/> + <waitForPageLoad stepKey="waitForWishlistPage"/> + <waitForElement selector="{{StorefrontCustomerWishlistProductSection.ProductTitleByName($$createBundleProduct.name$$)}}" time="30" stepKey="assertWishlistProductName"/> + <see userInput="$101.23" selector="{{StorefrontCustomerWishlistProductSection.ProductPriceByName($$createBundleProduct.name$$)}}" stepKey="AssertWishlistProductPrice"/> + + <!-- Assert product details in Wishlist --> + <moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.ProductInfoByName($$createBundleProduct.name$$)}}" stepKey="wishlistMoveMouseOverProduct"/> + <seeElement selector="{{StorefrontCustomerWishlistProductSection.ProductAddToCartByName($$createBundleProduct.name$$)}}" stepKey="AssertWishlistAddToCart"/> + <seeElement selector="{{StorefrontCustomerWishlistProductSection.ProductImageByName($$createBundleProduct.name$$)}}" stepKey="AssertWishlistProductImage"/> + <moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.productSeeDetailsByName($$createBundleProduct.name$$)}}" stepKey="seeDetailsMoveMouseOverProduct"/> + <see userInput="$$createBundleOption1_1.title$$" selector="{{StorefrontCustomerWishlistProductSection.productSeeDetailsLabelByName($$createBundleProduct.name$$)}}" stepKey="seeBundleOption"/> + <see userInput="$$simpleProduct1.sku$$ $100.00" selector="{{StorefrontCustomerWishlistProductSection.productSeeDetailsValueByName($$createBundleProduct.name$$)}}" stepKey="seeProduct"/> + + <actionGroup ref="AssertShoppingCartIsEmptyActionGroup" stepKey="assertCartIsEmpty"/> + </test> +</tests> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveVirtualProductFromShoppingCartToWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveVirtualProductFromShoppingCartToWishlistTest.xml new file mode 100644 index 0000000000000..baaae80f7d081 --- /dev/null +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveVirtualProductFromShoppingCartToWishlistTest.xml @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="StorefrontMoveVirtualProductFromShoppingCartToWishlistTest"> + <annotations> + <stories value="Wishlist"/> + <title value="Move Virtual Product from Shopping Cart to Wishlist"/> + <description value="Move Virtual Product from Shopping Cart to Wishlist"/> + <severity value="CRITICAL"/> + <testCaseId value="MAGETWO-29545"/> + <group value="wishlist"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <!-- Create Data --> + <createData entity="Simple_US_Customer" stepKey="createCustomer"/> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <createData entity="defaultVirtualProduct" stepKey="createProduct"> + <field key="price">40</field> + <requiredEntity createDataKey="createCategory"/> + </createData> + </before> + <after> + <!-- Delete data --> + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <!-- 1. Login as a customer --> + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginToStorefrontAccount"> + <argument name="Customer" value="$$createCustomer$$"/> + </actionGroup> + + <!-- Open Virtual Product page --> + <amOnPage url="{{StorefrontProductPage.url($$createProduct.custom_attributes[url_key]$$)}}" stepKey="OpenStoreFrontProductPage"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + + <!-- Add Virtual product to the cart and Assert add product to cart success message--> + <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartVirtualProductFromStorefrontProductPage"> + <argument name="productName" value="$$createProduct.name$$"/> + </actionGroup> + + <!-- Select Mini Cart and select 'View And Edit Cart' --> + <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="selectViewAndEditCart"/> + + <!-- Assert move product to wishlist success message --> + <click selector="{{CheckoutCartProductSection.moveToWishlistByProductName($$createProduct.name$$)}}" stepKey="moveToWishlist"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <see userInput="$$createProduct.name$$ has been moved to your wish list." selector="{{CheckoutCartMessageSection.successMessage}}" stepKey="assertMoveProductToWishlistSuccessMessage"/> + + <!-- Assert product is present in wishlist --> + <amOnPage url="{{StorefrontCustomerWishlistPage.url}}" stepKey="goToWishlistPage"/> + <waitForPageLoad stepKey="waitForWishlistPage"/> + + <actionGroup ref="StorefrontCustomerCheckProductInWishlist" stepKey="assertProductIsPresentInWishlist"> + <argument name="productVar" value="$$createProduct$$"/> + </actionGroup> + + <!-- Assert cart is empty --> + <actionGroup ref="AssertShoppingCartIsEmptyActionGroup" stepKey="assertCartIsEmpty"/> + </test> +</tests> diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/MoveProductFromShoppingCartToWishlistTest.xml b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/MoveProductFromShoppingCartToWishlistTest.xml index 95e6a854ed266..aa3b646161a17 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/MoveProductFromShoppingCartToWishlistTest.xml +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/MoveProductFromShoppingCartToWishlistTest.xml @@ -15,6 +15,7 @@ <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty" /> </variation> <variation name="MoveProductFromShoppingCartToWishlistTestVariation2"> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <data name="product/0" xsi:type="string">catalogProductVirtual::default</data> <constraint name="Magento\Wishlist\Test\Constraint\AssertMoveProductToWishlistSuccessMessage" /> <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" /> @@ -29,7 +30,7 @@ <constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" /> </variation> <variation name="MoveProductFromShoppingCartToWishlistTestVariation4"> - <data name="tag" xsi:type="string">test_type:extended_acceptance_test</data> + <data name="tag" xsi:type="string">test_type:extended_acceptance_test, mftf_migrated:yes</data> <data name="product/0" xsi:type="string">configurableProduct::default</data> <constraint name="Magento\Wishlist\Test\Constraint\AssertMoveProductToWishlistSuccessMessage" /> <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" /> @@ -37,6 +38,7 @@ <constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" /> </variation> <variation name="MoveProductFromShoppingCartToWishlistTestVariation5"> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <data name="product/0" xsi:type="string">bundleProduct::bundle_dynamic_product</data> <constraint name="Magento\Wishlist\Test\Constraint\AssertMoveProductToWishlistSuccessMessage" /> <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" /> @@ -44,6 +46,7 @@ <constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" /> </variation> <variation name="MoveProductFromShoppingCartToWishlistTestVariation6"> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <data name="product/0" xsi:type="string">bundleProduct::bundle_fixed_product</data> <constraint name="Magento\Wishlist\Test\Constraint\AssertMoveProductToWishlistSuccessMessage" /> <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" /> From ff7c3c9b8d9b1732cd5b69142a856ad27c0b839e Mon Sep 17 00:00:00 2001 From: Kate Kyzyma <kate@atwix.com> Date: Wed, 28 Aug 2019 13:27:16 +0300 Subject: [PATCH 0020/1143] Convert DeleteCategoryUrlRewriteEntityTest to MFTF --- ...dminDeleteCategoryUrlRewriteEntityTest.xml | 75 +++++++++++++++++++ .../DeleteCategoryUrlRewriteEntityTest.xml | 2 + 2 files changed, 77 insertions(+) create mode 100644 app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteEntityTest.xml diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteEntityTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteEntityTest.xml new file mode 100644 index 0000000000000..d0e976a1f9e3d --- /dev/null +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteEntityTest.xml @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminDeleteCategoryUrlRewriteEntityTest"> + <annotations> + <stories value="Delete category URL rewrite"/> + <title value="Delete category URL rewrite"/> + <description value="Login as admin and delete category Url Rewrite"/> + <group value="urlRewrite"/> + <group value="mtf_migrated"/> + </annotations> + + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> + <createData entity="_defaultCategory" stepKey="category"/> + </before> + <after> + <deleteData createDataKey="category" stepKey="deleteCategory"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <!--Create the Category Url Rewrite--> + <actionGroup ref="AdminAddUrlRewrite" stepKey="addUrlRewrite"> + <argument name="category" value="$$category.name$$"/> + <argument name="customUrlRewriteValue" value="For Category'"/> + <argument name="storeValue" value="Default Store View"/> + <argument name="requestPath" value="-"/> + <argument name="redirectTypeValue" value="No"/> + <argument name="description" value="End To End Test"/> + </actionGroup> + + <!--Delete the Category Url Rewrite--> + <actionGroup ref="AdminDeleteUrlRewrite" stepKey="deleteCustomUrlRewrite"> + <argument name="requestPath" value="-"/> + </actionGroup> + <actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="assertSuccessMessage"> + <argument name="message" value="You deleted the URL rewrite."/> + </actionGroup> + + <!--Verify AssertPageByUrlRewriteIsNotFound--> + <actionGroup ref="AssertPageByUrlRewriteIsNotFound" stepKey="checkUrlOnFrontend"> + <argument name="requestPath" value="-"/> + </actionGroup> + + <!--Create the Category Url Rewrite--> + <actionGroup ref="AdminAddUrlRewrite" stepKey="addUrlRewriteSecondTime"> + <argument name="category" value="$$category.name$$"/> + <argument name="customUrlRewriteValue" value="For Category'"/> + <argument name="storeValue" value="Default Store View"/> + <argument name="requestPath" value="newrequestpath.html"/> + <argument name="redirectTypeValue" value="No"/> + <argument name="description" value="End To End Test"/> + </actionGroup> + + <!--Delete the Category Url Rewrite--> + <actionGroup ref="AdminDeleteUrlRewrite" stepKey="deleteCustomUrlRewriteSecondTime"> + <argument name="requestPath" value="newrequestpath.html"/> + </actionGroup> + <actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="assertSuccessMessageSecondTime"> + <argument name="message" value="You deleted the URL rewrite."/> + </actionGroup> + + <!--Verify AssertPageByUrlRewriteIsNotFound--> + <actionGroup ref="AssertPageByUrlRewriteIsNotFound" stepKey="checkUrlOnFrontendSecondTime"> + <argument name="requestPath" value="newrequestpath.html"/> + </actionGroup> + + </test> +</tests> diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/DeleteCategoryUrlRewriteEntityTest.xml b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/DeleteCategoryUrlRewriteEntityTest.xml index 56440e8a8492b..42f71b8d01f76 100644 --- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/DeleteCategoryUrlRewriteEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/DeleteCategoryUrlRewriteEntityTest.xml @@ -8,6 +8,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\UrlRewrite\Test\TestCase\DeleteCategoryUrlRewriteEntityTest" summary="Delete Category URL Rewrites" ticketId="MAGETWO-25086"> <variation name="DeleteCategoryUrlRewriteEntityTestVariation1"> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <data name="urlRewrite/data/target_path/entity" xsi:type="string">catalog/category/view/id/%category::default%</data> <data name="urlRewrite/data/redirect_type" xsi:type="string">No</data> <data name="urlRewrite/data/request_path" xsi:type="string">-</data> @@ -15,6 +16,7 @@ <constraint name="Magento\UrlRewrite\Test\Constraint\AssertPageByUrlRewriteIsNotFound" /> </variation> <variation name="DeleteCategoryUrlRewriteEntityTestVariation2"> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <data name="urlRewrite/data/target_path/entity" xsi:type="string">catalog/category/view/id/%category::default%</data> <data name="urlRewrite/data/redirect_type" xsi:type="string">No</data> <data name="urlRewrite/data/request_path" xsi:type="string">example%isolation%.html</data> From f208cf5d0db47c13a70fe4e3cf7e3dd3763c6424 Mon Sep 17 00:00:00 2001 From: Kate Kyzyma <kate@atwix.com> Date: Wed, 28 Aug 2019 16:32:48 +0300 Subject: [PATCH 0021/1143] Working on the test --- ...dminAddUrlRewriteForCmsPageActionGroup.xml | 40 ++++++++ .../Section/AdminUrlRewriteEditSection.xml | 1 + ...AdminDeleteCmsPageUrlRewriteEntityTest.xml | 99 +++++++++++++++++++ 3 files changed, 140 insertions(+) create mode 100644 app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminAddUrlRewriteForCmsPageActionGroup.xml create mode 100644 app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteEntityTest.xml diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminAddUrlRewriteForCmsPageActionGroup.xml b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminAddUrlRewriteForCmsPageActionGroup.xml new file mode 100644 index 0000000000000..f46bd7f5e0386 --- /dev/null +++ b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminAddUrlRewriteForCmsPageActionGroup.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAddUrlRewriteForCmsPageActionGroup"> + <annotations> + <description>Goes to the Admin Add URL Rewrite edit page. Fills in the provided URL details. Clicks on Save. Validates that the Success Message is present.</description> + </annotations> + <arguments> + <argument name="cmsPageUrlKey" type="string"/> + <argument name="customUrlRewriteValue" type="string"/> + <argument name="storeValue" type="string"/> + <argument name="requestPath" type="string"/> + <argument name="redirectTypeValue" type="string"/> + <argument name="description" type="string"/> + </arguments> + + <amOnPage url="{{AdminUrlRewriteEditPage.url}}" stepKey="openUrlRewriteEditPage"/> + <waitForPageLoad stepKey="waitForUrlRewriteEditPageToLoad"/> + <click selector="{{AdminUrlRewriteEditSection.createCustomUrlRewrite}}" stepKey="clickOnCustomUrlRewrite"/> + <click selector="{{AdminUrlRewriteEditSection.createCustomUrlRewriteValue('customUrlRewriteValue')}}" stepKey="selectForCsmPage"/> + <waitForPageLoad stepKey="waitForCategoryEditSectionToLoad"/> + <click selector="{{AdminUrlRewriteEditSection.cmsPage('cmsPageUrlKey')}}" stepKey="selectCmsPage"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + <click selector="{{AdminUrlRewriteEditSection.store}}" stepKey="clickOnStore"/> + <click selector="{{AdminUrlRewriteEditSection.storeValue('storeValue')}}" stepKey="clickOnStoreValue"/> + <fillField selector="{{AdminUrlRewriteEditSection.requestPath}}" userInput="{{requestPath}}" stepKey="fillRequestPath"/> + <click selector="{{AdminUrlRewriteEditSection.redirectType}}" stepKey="selectRedirectType"/> + <click selector="{{AdminUrlRewriteEditSection.redirectTypeValue('redirectTypeValue')}}" stepKey="clickOnRedirectTypeValue"/> + <fillField selector="{{AdminUrlRewriteEditSection.description}}" userInput="{{description}}" stepKey="fillDescription"/> + <click selector="{{AdminUrlRewriteEditSection.saveButton}}" stepKey="clickOnSaveButton"/> + <seeElement selector="{{AdminUrlRewriteIndexSection.successMessage}}" stepKey="seeSuccessSaveMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Section/AdminUrlRewriteEditSection.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Section/AdminUrlRewriteEditSection.xml index 52939607f5377..5a55562e99334 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Section/AdminUrlRewriteEditSection.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Section/AdminUrlRewriteEditSection.xml @@ -19,6 +19,7 @@ <element name="redirectTypeValue" type="select" selector="//select[@id='redirect_type']//option[contains(., '{{Var}}')]" parameterized="true"/> <element name="description" type="input" selector="#description"/> <element name="categoryInTree" type="text" selector="//li[contains(@class,'active-category jstree-open')]/a[contains(., '{{categoryName}}')]" parameterized="true"/> + <element name="cmsPage" selector="//td[contains(text(), '{{cmsPageUrlKey}}')]" type="button" parameterized="true"/> <element name="saveButton" type="button" selector="#save" timeout="30"/> <element name="deleteButton" type="button" selector="#delete" timeout="30"/> <element name="okButton" type="button" selector="//button[@class='action-primary action-accept']" timeout="30"/> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteEntityTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteEntityTest.xml new file mode 100644 index 0000000000000..705786afa83bb --- /dev/null +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteEntityTest.xml @@ -0,0 +1,99 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminDeleteCmsPageUrlRewriteEntityTest"> + <annotations> + <stories value="Delete CMS Page URL rewrite"/> + <title value="Delete CMS Page URL rewrite"/> + <description value="Log in to admin and delete CMS Page URL rewrite"/> + <group value="cMSContent"/> + <group value="mtf_migrated"/> + </annotations> + + <before> + <createData entity="simpleCmsPage" stepKey="createCMSPage"/> + <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> + </before> + <after> + <deleteData createDataKey="createCMSPage" stepKey="deleteCMSPage"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <!-- Create URL Rewrite for CMS Page with No redirects --> + <actionGroup ref="AdminAddUrlRewriteForCmsPageActionGroup" stepKey="addUrlRewrite"> + <argument name="cmsPageUrlKey" value="$$createCMSPage.identifier$$"/> + <argument name="customUrlRewriteValue" value="For CMS page'"/> + <argument name="storeValue" value="Default Store View"/> + <argument name="requestPath" value="newrequestpath"/> + <argument name="redirectTypeValue" value="No"/> + <argument name="description" value="cms_default_no_redirect"/> + </actionGroup> + + <!-- Create URL Rewrite for CMS Page with temporary redirect --> + <actionGroup ref="AdminAddUrlRewriteForCmsPageActionGroup" stepKey="addUrlRewriteTemporary"> + <argument name="cmsPageUrlKey" value="$$createCMSPage.identifier$$"/> + <argument name="customUrlRewriteValue" value="For CMS page'"/> + <argument name="storeValue" value="Default Store View"/> + <argument name="requestPath" value="temporaryrequestpath.html"/> + <argument name="redirectTypeValue" value="Temporary (302)"/> + <argument name="description" value="cms_default_temporary_redirect"/> + </actionGroup> + + <!-- Create URL Rewrite for CMS Page with permanent redirect --> + <actionGroup ref="AdminAddUrlRewriteForCmsPageActionGroup" stepKey="addUrlRewritePermanent"> + <argument name="cmsPageUrlKey" value="$$createCMSPage.identifier$$"/> + <argument name="customUrlRewriteValue" value="For CMS page'"/> + <argument name="storeValue" value="Default Store View"/> + <argument name="requestPath" value="permanentrequestpath.html"/> + <argument name="redirectTypeValue" value="Permanent (301)"/> + <argument name="description" value="cms_default_permanent_redirect"/> + </actionGroup> + + <!--Delete the URL Rewrite for CMS Page with No redirects--> + <actionGroup ref="AdminDeleteUrlRewrite" stepKey="deleteCustomUrlRewrite"> + <argument name="requestPath" value="newrequestpath"/> + </actionGroup> + <actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="assertSuccessMessage"> + <argument name="message" value="You deleted the URL rewrite."/> + </actionGroup> + <!--Search and verify AssertUrlRewriteNotInGrid--> + <actionGroup ref="AdminSearchDeletedUrlRewrite" stepKey="searchDeletedUrlRewriteInGrid"> + <argument name="requestPath" value="newrequestpath"/> + </actionGroup> + <!--Verify AssertPageByUrlRewriteIsNotFound--> + <actionGroup ref="AssertPageByUrlRewriteIsNotFound" stepKey="assertPageByUrlRewriteIsNotFound"> + <argument name="requestPath" value="newrequestpath"/> + </actionGroup> + + <!--Delete the URL Rewrite for CMS Page with with temporary redirect--> + <actionGroup ref="AdminDeleteUrlRewrite" stepKey="deleteTemporaryUrlRewrite"> + <argument name="requestPath" value="temporaryrequestpath.html"/> + </actionGroup> + <actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="assertSuccessMessageSecondTime"> + <argument name="message" value="You deleted the URL rewrite."/> + </actionGroup> + <!--Verify AssertPageByUrlRewriteIsNotFound--> + <actionGroup ref="AssertPageByUrlRewriteIsNotFound" stepKey="assertPageByUrlRewriteIsNotFoundSecondTime"> + <argument name="requestPath" value="temporaryrequestpath.html"/> + </actionGroup> + + <!--Delete the URL Rewrite for CMS Page with permanent redirect--> + <actionGroup ref="AdminDeleteUrlRewrite" stepKey="deletePermanentUrlRewrite"> + <argument name="requestPath" value="permanentrequestpath.html"/> + </actionGroup> + <actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="assertSuccessMessageThirdTime"> + <argument name="message" value="You deleted the URL rewrite."/> + </actionGroup> + <!--Verify AssertPageByUrlRewriteIsNotFound--> + <actionGroup ref="AssertPageByUrlRewriteIsNotFound" stepKey="assertPageByUrlRewriteIsNotFoundThirdTime"> + <argument name="requestPath" value="permanentrequestpath.html"/> + </actionGroup> + + </test> +</tests> From 4674e41ea82a9e51bfb8b56c76a3533446d1c310 Mon Sep 17 00:00:00 2001 From: Kate Kyzyma <kate@atwix.com> Date: Wed, 28 Aug 2019 21:12:41 +0300 Subject: [PATCH 0022/1143] Convert DeleteCmsPageUrlRewriteEntityTest to MFTF --- .../Cms/Test/TestCase/DeleteCmsPageUrlRewriteEntityTest.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageUrlRewriteEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageUrlRewriteEntityTest.xml index 8262d88bdff1a..ea9d49d662bdd 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageUrlRewriteEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageUrlRewriteEntityTest.xml @@ -8,20 +8,20 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\Cms\Test\TestCase\DeleteCmsPageUrlRewriteEntityTest" summary="Delete Cms Page URL Rewrites" ticketId="MAGETWO-25915"> <variation name="DeleteCmsPageUrlRewriteEntityTestVariation1"> - <data name="tag" xsi:type="string">severity:S2</data> + <data name="tag" xsi:type="string">severity:S2,mftf_migrated:yes</data> <data name="urlRewrite/dataset" xsi:type="string">cms_default_no_redirect</data> <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteDeletedMessage" /> <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteNotInGrid" /> <constraint name="Magento\UrlRewrite\Test\Constraint\AssertPageByUrlRewriteIsNotFound" /> </variation> <variation name="DeleteCmsPageUrlRewriteEntityTestVariation2"> - <data name="tag" xsi:type="string">severity:S2</data> + <data name="tag" xsi:type="string">severity:S2,mftf_migrated:yes</data> <data name="urlRewrite/dataset" xsi:type="string">cms_default_permanent_redirect</data> <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteDeletedMessage" /> <constraint name="Magento\UrlRewrite\Test\Constraint\AssertPageByUrlRewriteIsNotFound" /> </variation> <variation name="DeleteCmsPageUrlRewriteEntityTestVariation3"> - <data name="tag" xsi:type="string">severity:S2</data> + <data name="tag" xsi:type="string">severity:S2,mftf_migrated:yes</data> <data name="urlRewrite/dataset" xsi:type="string">cms_default_temporary_redirect</data> <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteDeletedMessage" /> <constraint name="Magento\UrlRewrite\Test\Constraint\AssertPageByUrlRewriteIsNotFound" /> From 459c596a74c209b001b1afcfcde8717f46132fec Mon Sep 17 00:00:00 2001 From: Tan Sezer <t.sezer@youwe.nl> Date: Thu, 29 Aug 2019 16:46:38 +0200 Subject: [PATCH 0023/1143] add eav_attribute_option join for ordering by sort_order column for attributes --- .../Model/Entity/Attribute/Source/Table.php | 8 +++++- .../ResourceModel/Entity/Attribute/Option.php | 27 +++++++++++++++++++ .../Entity/Attribute/Source/TableTest.php | 3 +++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Source/Table.php b/app/code/Magento/Eav/Model/Entity/Attribute/Source/Table.php index f9aa1a9ed3ba1..908f29069c429 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Source/Table.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Source/Table.php @@ -213,7 +213,13 @@ public function addValueSortToCollection($collection, $dir = \Magento\Framework\ $valueExpr ); - $collection->getSelect()->order("{$attribute->getAttributeCode()} {$dir}"); + $this->_attrOptionFactory->create()->addOptionToCollection( + $collection, + $attribute, + $valueExpr + ); + + $collection->getSelect()->order("{$attribute->getAttributeCode()}_order {$dir}"); return $this; } diff --git a/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Option.php b/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Option.php index 79c277dcb6a82..6dc51247fb3f3 100644 --- a/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Option.php +++ b/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Option.php @@ -61,6 +61,33 @@ public function addOptionValueToCollection($collection, $attribute, $valueExpr) return $this; } + /** + * Add Join with option for collection select + * + * @param \Magento\Eav\Model\Entity\Collection\AbstractCollection $collection + * @param \Magento\Eav\Model\Entity\Attribute $attribute + * @param \Zend_Db_Expr $valueExpr + * @return $this + */ + public function addOptionToCollection($collection, $attribute, $valueExpr) + { + $connection = $this->getConnection(); + $attributeCode = $attribute->getAttributeCode(); + $optionTable1 = $attributeCode . '_option_t1'; + $tableJoinCond1 = "{$optionTable1}.option_id={$valueExpr}"; + $valueExpr = $connection->getIfNullSql( + "{$optionTable1}.sort_order" + ); + + $collection->getSelect()->joinLeft( + [$optionTable1 => $this->getTable('eav_attribute_option')], + $tableJoinCond1, + ["{$attributeCode}_order" => $valueExpr] + ); + + return $this; + } + /** * Retrieve Select for update Flat data * diff --git a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Source/TableTest.php b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Source/TableTest.php index b68446d22f910..49e7be7ecf594 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Source/TableTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Source/TableTest.php @@ -314,6 +314,9 @@ public function testAddValueSortToCollection() $attrOption->expects($this->once())->method('addOptionValueToCollection') ->with($collection, $this->abstractAttributeMock, $expr) ->willReturnSelf(); + $attrOption->expects($this->once())->method('addOptionToCollection') + ->with($collection, $this->abstractAttributeMock, $expr) + ->willReturnSelf(); $select->expects($this->once())->method('order')->with("{$attributeCode} {$dir}"); $this->assertEquals($this->model, $this->model->addValueSortToCollection($collection, $dir)); From a047aca104cb76d743bb318887f6ff7530175d5d Mon Sep 17 00:00:00 2001 From: Tan Sezer <t.sezer@youwe.nl> Date: Thu, 29 Aug 2019 17:02:43 +0200 Subject: [PATCH 0024/1143] add a line --- app/code/Magento/Eav/Model/Entity/Attribute/Source/Table.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Source/Table.php b/app/code/Magento/Eav/Model/Entity/Attribute/Source/Table.php index 908f29069c429..ef7b4a69808bc 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Source/Table.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Source/Table.php @@ -211,9 +211,7 @@ public function addValueSortToCollection($collection, $dir = \Magento\Framework\ $collection, $attribute, $valueExpr - ); - - $this->_attrOptionFactory->create()->addOptionToCollection( + )->addOptionToCollection( $collection, $attribute, $valueExpr From 952d12e423f2a02c0ead3a7fd8cd7588a15d0760 Mon Sep 17 00:00:00 2001 From: Tan Sezer <t.sezer@youwe.nl> Date: Fri, 30 Aug 2019 11:24:37 +0200 Subject: [PATCH 0025/1143] fix unit test for ordering of attribute --- .../Eav/Test/Unit/Model/Entity/Attribute/Source/TableTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Source/TableTest.php b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Source/TableTest.php index 49e7be7ecf594..2997874f6ea34 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Source/TableTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Source/TableTest.php @@ -317,7 +317,7 @@ public function testAddValueSortToCollection() $attrOption->expects($this->once())->method('addOptionToCollection') ->with($collection, $this->abstractAttributeMock, $expr) ->willReturnSelf(); - $select->expects($this->once())->method('order')->with("{$attributeCode} {$dir}"); + $select->expects($this->once())->method('order')->with("{$attributeCode}_order {$dir}"); $this->assertEquals($this->model, $this->model->addValueSortToCollection($collection, $dir)); } From e5907065e80f35ef450fc94ef5a83a1ddec9928c Mon Sep 17 00:00:00 2001 From: David Lambauer <david@run-as-root.sh> Date: Mon, 2 Sep 2019 22:02:40 +0200 Subject: [PATCH 0026/1143] Fixed Id Call due to model intercept. --- .../Magento/AdminNotification/Block/Grid/Renderer/Actions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php index 2db5bfec92395..af8ccf65dd769 100644 --- a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php +++ b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php @@ -54,7 +54,7 @@ public function render(DataObject $row) : string $markAsReadHtml = !$row->getData('is_read') ? '<a class="action-mark" href="' . $this->getUrl( '*/*/markAsRead/', - ['_current' => true, 'id' => $row->getData('id')] + ['_current' => true, 'id' => $row->getData('notification_id')] ) . '">' . __( 'Mark as Read' ) . '</a>' : ''; @@ -68,7 +68,7 @@ public function render(DataObject $row) : string '*/*/remove/', [ '_current' => true, - 'id' => $row->getData('id'), + 'id' => $row->getData('notification_id'), ActionInterface::PARAM_NAME_URL_ENCODED => $encodedUrl ] ), From e89a604e1010c98e37956719db96416fec515a96 Mon Sep 17 00:00:00 2001 From: Andreas von Studnitz <avs@integer-net.de> Date: Fri, 6 Sep 2019 11:50:58 +0200 Subject: [PATCH 0027/1143] Fix return type --- .../Magento/Framework/Pricing/PriceCurrencyInterface.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Pricing/PriceCurrencyInterface.php b/lib/internal/Magento/Framework/Pricing/PriceCurrencyInterface.php index eb379b54d257f..72068586e3027 100644 --- a/lib/internal/Magento/Framework/Pricing/PriceCurrencyInterface.php +++ b/lib/internal/Magento/Framework/Pricing/PriceCurrencyInterface.php @@ -47,7 +47,7 @@ public function convertAndRound($amount, $scope = null, $currency = null, $preci * @param int $precision * @param null|string|bool|int|\Magento\Framework\App\ScopeInterface $scope * @param \Magento\Framework\Model\AbstractModel|string|null $currency - * @return float + * @return string */ public function format( $amount, From 098770d4dca34b3a5c10d3ed5f7bc27c12d3f20d Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <51681487+engcom-Foxtrot@users.noreply.github.com> Date: Mon, 9 Sep 2019 14:41:50 +0300 Subject: [PATCH 0028/1143] magento/magento2#24485: Static test fix. --- .../Magento/Framework/Pricing/PriceCurrencyInterface.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/internal/Magento/Framework/Pricing/PriceCurrencyInterface.php b/lib/internal/Magento/Framework/Pricing/PriceCurrencyInterface.php index 72068586e3027..ab3d26f3e0c6c 100644 --- a/lib/internal/Magento/Framework/Pricing/PriceCurrencyInterface.php +++ b/lib/internal/Magento/Framework/Pricing/PriceCurrencyInterface.php @@ -13,9 +13,6 @@ */ interface PriceCurrencyInterface { - /** - * Default precision - */ const DEFAULT_PRECISION = 2; /** From 75f6a45c0978a7ea94776058fae8b6837f5966f4 Mon Sep 17 00:00:00 2001 From: John Hughes <johnh@fisheyehq.com> Date: Mon, 9 Sep 2019 17:19:00 +0100 Subject: [PATCH 0029/1143] Skip test to due unrelated failure from incomplete action group --- ...torefrontVerifySearchSuggestionByProductDescriptionTest.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductDescriptionTest.xml b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductDescriptionTest.xml index 0ec33c48f259e..c115828898dee 100644 --- a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductDescriptionTest.xml +++ b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductDescriptionTest.xml @@ -16,6 +16,9 @@ <severity value="CRITICAL"/> <testCaseId value="MC-14765"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-19868"/> + </skip> </annotations> <before> <!-- Login as admin --> From cd3b244cf3140821ee34bb52fc1cf8259988386d Mon Sep 17 00:00:00 2001 From: Vinai Kopp <vinai@netzarbeiter.com> Date: Mon, 2 Sep 2019 12:21:00 +0200 Subject: [PATCH 0030/1143] Allow construction of products with custom_attributes This patch does two things: 1. Currently it is not possible to pass an array with `custom_attributes` to the `\Magento\Catalog\Model\Product` constructor (it causes a fatal error). The reason is because the `filterCustomAttribute` and `eavConfig` arguments are assigned after the call to `parent::__construct`. However, the properties are used during the `parent::__construct` calls. The flow of execution is as follows: Product::__construct -> Catalog\Model\AbstractModel::__construct Catalog\Model\AbstractModel::__construct -> AbstractExtensibleModel::__construct AbstractExtensibleModel::__construct -> AbstractExtensibleModel::filterCustomAttributes AbstractExtensibleModel::filterCustomAttributes -> AbstractExtensibleModel::getCustomAttributesCodes ...which is overridden by Product::getCustomAttributesCodes getCustomAttributesCodes expectes the `filterCustomAttribute` and `eavConfig` properties to be set if `custom_attributes` are present in `$data`, but they are still null because the `Product::__construct` method has not yet completed. The fix this PR applies is to assign the properties before the call to `parent::__construct`. The bug and fix are covered by the integration test: `\Magento\Catalog\Model\ProductTest::testConstructionWithCustomAttributesMapInData` 2. The method `AbstractExtensibleModel::filterCustomAttribute` expects the `custom_attributes` in `$data` to be a simple map from codes to values, e.g. `['category_ids => '1,2']`. However, the method `\Magento\Framework\Reflection\DataObjectProcessor::buildOutputDataArray` generates a numerically indexed custom attributes array, where each custom attribute is a sub-array with a `attribute_code` and `value` record. This PR allows passing such an `custom_attributes` array into the `Product` model constructor. Currently it would be ignored, but with this patch the code checks if `custom_attributes` is numerically indexed, and if so, flattens the sub-arrays into the expected map format. To illustrate the difference of the `custom_attributes` array formats: Map: [ 'custom_attributes' => [ 'category_ids' => '1,2', 'tax_class_id' => '3', ] ] Numerically indexed array of sub-arrays: [ 'custom_attributes' => [ [ 'attribute_code' => 'category_ids', 'value' => '1,2' ], [ 'attribute_code' => 'tax_class_id', 'value' => '3' ], ] ] This improvement is covered by the integration test `\Magento\Catalog\Model\ProductTest::testConstructionWithCustomAttributesArrayInData` --- app/code/Magento/Catalog/Model/Product.php | 19 +++---- .../Magento/Catalog/Model/ProductTest.php | 54 ++++++++++++++++--- .../Model/AbstractExtensibleModel.php | 29 +++++++++- 3 files changed, 83 insertions(+), 19 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product.php b/app/code/Magento/Catalog/Model/Product.php index 1b7552c82276d..2f3c219d66cbb 100644 --- a/app/code/Magento/Catalog/Model/Product.php +++ b/app/code/Magento/Catalog/Model/Product.php @@ -472,6 +472,9 @@ public function __construct( $this->mediaGalleryEntryConverterPool = $mediaGalleryEntryConverterPool; $this->dataObjectHelper = $dataObjectHelper; $this->joinProcessor = $joinProcessor; + $this->eavConfig = $config ?? ObjectManager::getInstance()->get(\Magento\Eav\Model\Config::class); + $this->filterCustomAttribute = $filterCustomAttribute + ?? ObjectManager::getInstance()->get(FilterProductCustomAttribute::class); parent::__construct( $context, $registry, @@ -482,9 +485,6 @@ public function __construct( $resourceCollection, $data ); - $this->eavConfig = $config ?? ObjectManager::getInstance()->get(\Magento\Eav\Model\Config::class); - $this->filterCustomAttribute = $filterCustomAttribute - ?? ObjectManager::getInstance()->get(FilterProductCustomAttribute::class); } /** @@ -835,12 +835,13 @@ public function getStoreIds() if (!$this->isObjectNew() && $this->_storeManager->isSingleStoreMode()) { $websiteIds = array_keys($websiteIds); } - foreach ($websiteIds as $websiteId) { - $websiteStores = $this->_storeManager->getWebsite($websiteId)->getStoreIds(); - foreach ($websiteStores as $websiteStore) { - $storeIds []= $websiteStore; - } - } + $websiteStoreIds = array_map( + function ($websiteId): array { + return $this->_storeManager->getWebsite($websiteId)->getStoreIds(); + }, + $websiteIds + ); + $storeIds = array_merge($storeIds, ...$websiteStoreIds); } $this->setStoreIds($storeIds); } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php index c34120404a950..0754ec0c06633 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php @@ -8,7 +8,9 @@ namespace Magento\Catalog\Model; +use Magento\Eav\Model\Config as EavConfig; use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\TestFramework\ObjectManager; /** * Tests product model: @@ -49,8 +51,8 @@ protected function setUp() } /** - * @throws \Magento\Framework\Exception\FileSystemException * @return void + * @throws \Magento\Framework\Exception\FileSystemException */ public static function tearDownAfterClass() { @@ -307,9 +309,9 @@ public function testIsSalable() $this->_model = $this->productRepository->get('simple'); // fixture - $this->assertTrue((bool)$this->_model->isSalable()); - $this->assertTrue((bool)$this->_model->isSaleable()); - $this->assertTrue((bool)$this->_model->isAvailable()); + $this->assertTrue((bool) $this->_model->isSalable()); + $this->assertTrue((bool) $this->_model->isSaleable()); + $this->assertTrue((bool) $this->_model->isAvailable()); $this->assertTrue($this->_model->isInStock()); } @@ -324,9 +326,9 @@ public function testIsNotSalableWhenStatusDisabled() $this->_model = $this->productRepository->get('simple'); $this->_model->setStatus(0); - $this->assertFalse((bool)$this->_model->isSalable()); - $this->assertFalse((bool)$this->_model->isSaleable()); - $this->assertFalse((bool)$this->_model->isAvailable()); + $this->assertFalse((bool) $this->_model->isSalable()); + $this->assertFalse((bool) $this->_model->isSaleable()); + $this->assertFalse((bool) $this->_model->isAvailable()); $this->assertFalse($this->_model->isInStock()); } @@ -585,7 +587,7 @@ public function testGetOptions() continue; } foreach ($option->getValues() as $value) { - $this->assertEquals($expectedValue[$value->getSku()], (float)$value->getPrice()); + $this->assertEquals($expectedValue[$value->getSku()], (float) $value->getPrice()); } } } @@ -632,4 +634,40 @@ public function productWithBackordersDataProvider(): array [1, 1, true], ]; } + + public function testConstructionWithCustomAttributesMapInData() + { + $data = [ + 'custom_attributes' => [ + 'tax_class_id' => '3', + 'category_ids' => '1,2' + ], + ]; + + /** @var Product $product */ + $product = ObjectManager::getInstance()->create(Product::class, ['data' => $data]); + $this->assertSame($product->getCustomAttribute('tax_class_id')->getValue(), '3'); + $this->assertSame($product->getCustomAttribute('category_ids')->getValue(), '1,2'); + } + + public function testConstructionWithCustomAttributesArrayInData() + { + $data = [ + 'custom_attributes' => [ + [ + 'attribute_code' => 'tax_class_id', + 'value' => '3' + ], + [ + 'attribute_code' => 'category_ids', + 'value' => '1,2' + ] + ], + ]; + + /** @var Product $product */ + $product = ObjectManager::getInstance()->create(Product::class, ['data' => $data]); + $this->assertSame($product->getCustomAttribute('tax_class_id')->getValue(), '3'); + $this->assertSame($product->getCustomAttribute('category_ids')->getValue(), '1,2'); + } } diff --git a/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php b/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php index 949e002a14208..b88954bd21ce8 100644 --- a/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php +++ b/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php @@ -74,6 +74,28 @@ public function __construct( } } + /** + * Convert the custom attributes array format to map format + * + * The method \Magento\Framework\Reflection\DataObjectProcessor::buildOutputDataArray generates a custom_attributes + * array representation where each custom attribute is a sub-array with a `attribute_code and value key. + * This method maps such an array to the plain code => value map format exprected by filterCustomAttributes + * + * @param array[] $customAttributesData + * @return array + */ + private function flattenCustomAttributesArrayToMap(array $customAttributesData): array + { + return array_reduce( + $customAttributesData, + function (array $acc, array $customAttribute): array { + $acc[$customAttribute['attribute_code']] = $customAttribute['value']; + return $acc; + }, + [] + ); + } + /** * Verify custom attributes set on $data and unset if not a valid custom attribute * @@ -85,9 +107,12 @@ protected function filterCustomAttributes($data) if (empty($data[self::CUSTOM_ATTRIBUTES])) { return $data; } - $customAttributesCodes = $this->getCustomAttributesCodes(); + if (isset($data[self::CUSTOM_ATTRIBUTES][0])) { + $data[self::CUSTOM_ATTRIBUTES] = $this->flattenCustomAttributesArrayToMap($data[self::CUSTOM_ATTRIBUTES]); + } + $customAttributesCodes = $this->getCustomAttributesCodes(); $data[self::CUSTOM_ATTRIBUTES] = array_intersect_key( - (array)$data[self::CUSTOM_ATTRIBUTES], + (array) $data[self::CUSTOM_ATTRIBUTES], array_flip($customAttributesCodes) ); foreach ($data[self::CUSTOM_ATTRIBUTES] as $code => $value) { From 3e42c25472b9269045281631a9a84cc2f5726a3a Mon Sep 17 00:00:00 2001 From: David Lambauer <david@run-as-root.sh> Date: Tue, 17 Sep 2019 17:39:27 +0200 Subject: [PATCH 0031/1143] Removed static types for compatibility --- .../Magento/AdminNotification/Block/Grid/Renderer/Actions.php | 2 +- .../Magento/AdminNotification/Block/Grid/Renderer/Notice.php | 2 +- .../Magento/AdminNotification/Block/Grid/Renderer/Severity.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php index af8ccf65dd769..86cf528fd4971 100644 --- a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php +++ b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php @@ -45,7 +45,7 @@ public function __construct(Context $context, Data $urlHelper, array $data = []) * @param \Magento\Framework\DataObject $row * @return string */ - public function render(DataObject $row) : string + public function render(DataObject $row) { $readDetailsHtml = $row->getData('url') ? '<a class="action-details" target="_blank" href="' . $this->escapeUrl($row->getData('url')) diff --git a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Notice.php b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Notice.php index 34919258dbc6c..1cf56d60db9de 100644 --- a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Notice.php +++ b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Notice.php @@ -25,7 +25,7 @@ class Notice extends AbstractRenderer * @param \Magento\Framework\DataObject $row * @return string */ - public function render(DataObject $row) : string + public function render(DataObject $row) { return '<span class="grid-row-title">' . $this->escapeHtml($row->getData('title')) . diff --git a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Severity.php b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Severity.php index bf26bc15813e1..d50781b1f6415 100644 --- a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Severity.php +++ b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Severity.php @@ -44,7 +44,7 @@ public function __construct(Context $context, Inbox $notice, array $data = []) * @param \Magento\Framework\DataObject $row * @return string */ - public function render(DataObject $row) : string + public function render(DataObject $row) { $class = ''; $value = ''; From d56f3c6d908634dd71117f713c32cf7f5fa7e045 Mon Sep 17 00:00:00 2001 From: George Babarus <george.babarus@emag.ro> Date: Fri, 5 Jul 2019 11:55:36 +0300 Subject: [PATCH 0032/1143] reduce resetData calls on DeploymentConfig --- .../Model/Logger/Handler/DebugTest.php | 1 + .../Framework/App/DeploymentConfig.php | 39 ++++--- .../App/Test/Unit/DeploymentConfigTest.php | 108 ++++++++++++------ .../Magento/Framework/Module/ModuleList.php | 19 +-- .../Module/Test/Unit/ModuleListTest.php | 8 +- .../ModuleEnableDisableCommandTest.php | 23 ++-- 6 files changed, 124 insertions(+), 74 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Developer/Model/Logger/Handler/DebugTest.php b/dev/tests/integration/testsuite/Magento/Developer/Model/Logger/Handler/DebugTest.php index f7a47017f8b18..fec71206accd8 100644 --- a/dev/tests/integration/testsuite/Magento/Developer/Model/Logger/Handler/DebugTest.php +++ b/dev/tests/integration/testsuite/Magento/Developer/Model/Logger/Handler/DebugTest.php @@ -173,6 +173,7 @@ private function reinitDeploymentConfig() { $this->etcDirectory->delete(self::$configFile); $this->etcDirectory->copyFile(self::$backupFile, self::$configFile); + $this->deploymentConfig->resetData(); } /** diff --git a/lib/internal/Magento/Framework/App/DeploymentConfig.php b/lib/internal/Magento/Framework/App/DeploymentConfig.php index 40b03b068d6ab..ddd7faa80b906 100644 --- a/lib/internal/Magento/Framework/App/DeploymentConfig.php +++ b/lib/internal/Magento/Framework/App/DeploymentConfig.php @@ -7,6 +7,9 @@ namespace Magento\Framework\App; use Magento\Framework\Config\ConfigOptionsListConstants; +use Magento\Framework\Exception\FileSystemException; +use Magento\Framework\Exception\RuntimeException; +use Magento\Framework\Phrase; /** * Application deployment configuration @@ -63,6 +66,8 @@ public function __construct(DeploymentConfig\Reader $reader, $overrideData = []) * @param string $key * @param mixed $defaultValue * @return mixed|null + * @throws FileSystemException + * @throws RuntimeException */ public function get($key = null, $defaultValue = null) { @@ -82,10 +87,11 @@ public function get($key = null, $defaultValue = null) * Checks if data available * * @return bool + * @throws FileSystemException + * @throws RuntimeException */ public function isAvailable() { - $this->data = null; $this->load(); return isset($this->flatData[ConfigOptionsListConstants::CONFIG_PATH_INSTALL_DATE]); } @@ -95,6 +101,8 @@ public function isAvailable() * * @param string $key * @return null|mixed + * @throws FileSystemException + * @throws RuntimeException */ public function getConfigData($key = null) { @@ -104,11 +112,7 @@ public function getConfigData($key = null) return null; } - if (isset($this->data[$key])) { - return $this->data[$key]; - } - - return $this->data; + return $this->data[$key] ?? $this->data; } /** @@ -125,6 +129,8 @@ public function resetData() * Check if data from deploy files is available * * @return bool + * @throws FileSystemException + * @throws RuntimeException * @since 100.1.3 */ public function isDbAvailable() @@ -137,6 +143,8 @@ public function isDbAvailable() * Loads the configuration data * * @return void + * @throws FileSystemException + * @throws RuntimeException */ private function load() { @@ -158,12 +166,15 @@ private function load() * * @param array $params * @param string $path + * @param array $flattenResult * @return array - * @throws \Exception + * @throws RuntimeException */ - private function flattenParams(array $params, $path = null) + private function flattenParams(array $params, $path = null, array &$flattenResult = null) : array { - $cache = []; + if (null === $flattenResult) { + $flattenResult = []; + } foreach ($params as $key => $param) { if ($path) { @@ -171,15 +182,15 @@ private function flattenParams(array $params, $path = null) } else { $newPath = $key; } - if (isset($cache[$newPath])) { - throw new \Exception("Key collision {$newPath} is already defined."); + if (isset($flattenResult[$newPath])) { + throw new RuntimeException(new Phrase("Key collision '%1' is already defined.", [$newPath])); } - $cache[$newPath] = $param; + $flattenResult[$newPath] = $param; if (is_array($param)) { - $cache = array_merge($cache, $this->flattenParams($param, $newPath)); + $this->flattenParams($param, $newPath, $flattenResult); } } - return $cache; + return $flattenResult; } } diff --git a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfigTest.php b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfigTest.php index 80ab2302dc91c..81a4f842bdf1d 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfigTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfigTest.php @@ -14,27 +14,33 @@ class DeploymentConfigTest extends \PHPUnit\Framework\TestCase /** * @var array */ - private static $fixture = [ - 'configData1' => 'scalar_value', - 'configData2' => [ - 'foo' => 1, - 'bar' => ['baz' => 2], - ], - ]; + private static $fixture + = [ + 'configData1' => 'scalar_value', + 'configData2' => [ + 'foo' => 1, + 'bar' => ['baz' => 2], + ], + 'configData3' => null, + 'test_override' => 'original', + ]; /** * @var array */ - private static $flattenedFixture = [ - 'configData1' => 'scalar_value', - 'configData2' => [ - 'foo' => 1, - 'bar' => ['baz' => 2], - ], - 'configData2/foo' => 1, - 'configData2/bar' => ['baz' => 2], - 'configData2/bar/baz' => 2, - ]; + private static $flattenedFixture + = [ + 'configData1' => 'scalar_value', + 'configData2' => [ + 'foo' => 1, + 'bar' => ['baz' => 2], + ], + 'configData2/foo' => 1, + 'configData2/bar' => ['baz' => 2], + 'configData2/bar/baz' => 2, + 'configData3' => null, + 'test_override' => 'overridden', + ]; /** * @var array @@ -63,21 +69,24 @@ class DeploymentConfigTest extends \PHPUnit\Framework\TestCase public static function setUpBeforeClass() { - self::$fixtureConfig = require __DIR__ . '/_files/config.php'; - self::$fixtureConfigMerged = require __DIR__ . '/_files/other/local_developer_merged.php'; + self::$fixtureConfig = require __DIR__.'/_files/config.php'; + self::$fixtureConfigMerged = require __DIR__.'/_files/other/local_developer_merged.php'; } protected function setUp() { - $this->reader = $this->createMock(\Magento\Framework\App\DeploymentConfig\Reader::class); - $this->_deploymentConfig = new \Magento\Framework\App\DeploymentConfig($this->reader, []); + $this->reader = $this->createMock(\Magento\Framework\App\DeploymentConfig\Reader::class); + $this->_deploymentConfig = new \Magento\Framework\App\DeploymentConfig( + $this->reader, + ['test_override' => 'overridden'] + ); $this->_deploymentConfigMerged = new \Magento\Framework\App\DeploymentConfig( $this->reader, - require __DIR__ . '/_files/other/local_developer.php' + require __DIR__.'/_files/other/local_developer.php' ); } - public function testGetters() + public function testGetters(): void { $this->reader->expects($this->once())->method('load')->willReturn(self::$fixture); $this->assertSame(self::$flattenedFixture, $this->_deploymentConfig->get()); @@ -85,33 +94,40 @@ public function testGetters() $this->assertSame(self::$flattenedFixture, $this->_deploymentConfig->get()); $this->assertSame('scalar_value', $this->_deploymentConfig->getConfigData('configData1')); $this->assertSame(self::$fixture['configData2'], $this->_deploymentConfig->getConfigData('configData2')); + $this->assertSame(self::$fixture['configData3'], $this->_deploymentConfig->getConfigData('configData3')); + $this->assertSame('', $this->_deploymentConfig->get('configData3')); + $this->assertSame('defaultValue', $this->_deploymentConfig->get('invalid_key', 'defaultValue')); + $this->assertNull($this->_deploymentConfig->getConfigData('invalid_key')); + $this->assertSame('overridden', $this->_deploymentConfig->get('test_override')); } - public function testIsAvailable() + public function testIsAvailable(): void { - $this->reader->expects($this->once())->method('load')->willReturn([ - ConfigOptionsListConstants::CONFIG_PATH_INSTALL_DATE => 1 - ]); + $this->reader->expects($this->once())->method('load')->willReturn( + [ + ConfigOptionsListConstants::CONFIG_PATH_INSTALL_DATE => 1, + ] + ); $object = new DeploymentConfig($this->reader); $this->assertTrue($object->isAvailable()); } - public function testNotAvailable() + public function testNotAvailable(): void { $this->reader->expects($this->once())->method('load')->willReturn([]); $object = new DeploymentConfig($this->reader); $this->assertFalse($object->isAvailable()); } - public function testNotAvailableThenAvailable() + /** + * test if the configuration changes during the same request, the configuration remain the same + */ + public function testNotAvailableThenAvailable(): void { - $this->reader->expects($this->at(0))->method('load')->willReturn([]); - $this->reader->expects($this->at(1))->method('load')->willReturn([ - ConfigOptionsListConstants::CONFIG_PATH_INSTALL_DATE => 1 - ]); + $this->reader->expects($this->once())->method('load')->willReturn([]); $object = new DeploymentConfig($this->reader); $this->assertFalse($object->isAvailable()); - $this->assertTrue($object->isAvailable()); + $this->assertFalse($object->isAvailable()); } /** @@ -120,7 +136,7 @@ public function testNotAvailableThenAvailable() * @expectedExceptionMessage Key collision * @dataProvider keyCollisionDataProvider */ - public function testKeyCollision(array $data) + public function testKeyCollision(array $data): void { $this->reader->expects($this->once())->method('load')->willReturn($data); $object = new DeploymentConfig($this->reader); @@ -130,14 +146,32 @@ public function testKeyCollision(array $data) /** * @return array */ - public function keyCollisionDataProvider() + public function keyCollisionDataProvider(): array { return [ [ ['foo' => ['bar' => '1'], 'foo/bar' => '2'], ['foo/bar' => '1', 'foo' => ['bar' => '2']], ['foo' => ['subfoo' => ['subbar' => '1'], 'subfoo/subbar' => '2'], 'bar' => '3'], - ] + ], ]; } + + public function testResetData(): void + { + $this->reader->expects($this->exactly(2))->method('load')->willReturn(self::$fixture); + $this->assertSame(self::$flattenedFixture, $this->_deploymentConfig->get()); + $this->_deploymentConfig->resetData(); + // second time to ensure loader will be invoked only once after reset + $this->assertSame(self::$flattenedFixture, $this->_deploymentConfig->get()); + $this->assertSame(self::$flattenedFixture, $this->_deploymentConfig->get()); + } + + public function testIsDbAvailable(): void + { + $this->reader->expects($this->exactly(2))->method('load')->willReturnOnConsecutiveCalls([], ['db' => []]); + $this->assertFalse($this->_deploymentConfig->isDbAvailable()); + $this->_deploymentConfig->resetData(); + $this->assertTrue($this->_deploymentConfig->isDbAvailable()); + } } diff --git a/lib/internal/Magento/Framework/Module/ModuleList.php b/lib/internal/Magento/Framework/Module/ModuleList.php index 6ee061cffb3d0..5a60a1c102b05 100644 --- a/lib/internal/Magento/Framework/Module/ModuleList.php +++ b/lib/internal/Magento/Framework/Module/ModuleList.php @@ -59,7 +59,7 @@ public function __construct(DeploymentConfig $config, ModuleList\Loader $loader) } /** - * {@inheritdoc} + * @inheritdoc * * Note that this triggers loading definitions of all existing modules in the system. * Use this method only when you actually need modules' declared meta-information. @@ -84,8 +84,7 @@ public function getAll() } /** - * {@inheritdoc} - * @see has() + * @inheritdoc */ public function getOne($name) { @@ -94,7 +93,7 @@ public function getOne($name) } /** - * {@inheritdoc} + * @inheritdoc */ public function getNames() { @@ -107,7 +106,7 @@ public function getNames() } /** - * {@inheritdoc} + * @inheritdoc */ public function has($name) { @@ -136,12 +135,16 @@ public function isModuleInfoAvailable() * Loads configuration data only * * @return void + * @throws \Magento\Framework\Exception\FileSystemException + * @throws \Magento\Framework\Exception\RuntimeException */ private function loadConfigData() { - $this->config->resetData(); - if (null === $this->configData && null !== $this->config->get(ConfigOptionsListConstants::KEY_MODULES)) { - $this->configData = $this->config->get(ConfigOptionsListConstants::KEY_MODULES); + if (null === $this->configData) { + $this->config->resetData(); + if (null !== $this->config->get(ConfigOptionsListConstants::KEY_MODULES)) { + $this->configData = $this->config->get(ConfigOptionsListConstants::KEY_MODULES); + } } } } diff --git a/lib/internal/Magento/Framework/Module/Test/Unit/ModuleListTest.php b/lib/internal/Magento/Framework/Module/Test/Unit/ModuleListTest.php index 9b4f238725138..3142bbbc6771a 100644 --- a/lib/internal/Magento/Framework/Module/Test/Unit/ModuleListTest.php +++ b/lib/internal/Magento/Framework/Module/Test/Unit/ModuleListTest.php @@ -47,7 +47,7 @@ protected function setUp() public function testGetAll() { - $this->config->expects($this->exactly(2))->method('resetData'); + $this->config->expects($this->once())->method('resetData'); $this->setLoadAllExpectation(); $this->setLoadConfigExpectation(); $expected = ['foo' => self::$allFixture['foo']]; @@ -65,7 +65,7 @@ public function testGetAllNoData() public function testGetOne() { - $this->config->expects($this->exactly(2))->method('resetData'); + $this->config->expects($this->once())->method('resetData'); $this->setLoadAllExpectation(); $this->setLoadConfigExpectation(); $this->assertSame(['key' => 'value'], $this->model->getOne('foo')); @@ -74,7 +74,7 @@ public function testGetOne() public function testGetNames() { - $this->config->expects($this->exactly(2))->method('resetData'); + $this->config->expects($this->once())->method('resetData'); $this->setLoadAllExpectation(false); $this->setLoadConfigExpectation(); $this->assertSame(['foo'], $this->model->getNames()); @@ -83,7 +83,7 @@ public function testGetNames() public function testHas() { - $this->config->expects($this->exactly(2))->method('resetData'); + $this->config->expects($this->once())->method('resetData'); $this->setLoadAllExpectation(false); $this->setLoadConfigExpectation(); $this->assertTrue($this->model->has('foo')); diff --git a/setup/src/Magento/Setup/Test/Unit/Console/Command/ModuleEnableDisableCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/ModuleEnableDisableCommandTest.php index 4ff2b0c7bca58..8eb13a9c1ec5e 100644 --- a/setup/src/Magento/Setup/Test/Unit/Console/Command/ModuleEnableDisableCommandTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/ModuleEnableDisableCommandTest.php @@ -53,23 +53,24 @@ protected function setUp() { $this->objectManagerProviderMock = $this->createMock(\Magento\Setup\Model\ObjectManagerProvider::class); $objectManager = $this->getMockForAbstractClass(\Magento\Framework\ObjectManagerInterface::class); - $this->objectManagerProviderMock->expects($this->any()) + $this->objectManagerProviderMock ->method('get') - ->will($this->returnValue($objectManager)); + ->willReturn($objectManager); $this->statusMock = $this->createMock(\Magento\Framework\Module\Status::class); $this->cacheMock = $this->createMock(\Magento\Framework\App\Cache::class); $this->cleanupFilesMock = $this->createMock(\Magento\Framework\App\State\CleanupFiles::class); $this->fullModuleListMock = $this->createMock(\Magento\Framework\Module\FullModuleList::class); $this->deploymentConfigMock = $this->createMock(\Magento\Framework\App\DeploymentConfig::class); $this->generatedFiles = $this->createMock(\Magento\Framework\Code\GeneratedFiles::class); - $objectManager->expects($this->any()) - ->method('get') - ->will($this->returnValueMap([ - [\Magento\Framework\Module\Status::class, $this->statusMock], - [\Magento\Framework\App\Cache::class, $this->cacheMock], - [\Magento\Framework\App\State\CleanupFiles::class, $this->cleanupFilesMock], - [\Magento\Framework\Module\FullModuleList::class, $this->fullModuleListMock], - ])); + $objectManager->method('get') + ->willReturnMap( + [ + [\Magento\Framework\Module\Status::class, $this->statusMock], + [\Magento\Framework\App\Cache::class, $this->cacheMock], + [\Magento\Framework\App\State\CleanupFiles::class, $this->cleanupFilesMock], + [\Magento\Framework\Module\FullModuleList::class, $this->fullModuleListMock], + ] + ); } /** @@ -189,7 +190,7 @@ public function testExecuteAll($isEnable, $expectedMessage) if ($isEnable) { $this->deploymentConfigMock->expects($this->once()) ->method('isAvailable') - ->willReturn(['Magento_Module1']); + ->willReturn(true); } else { $this->deploymentConfigMock->expects($this->never()) ->method('isAvailable'); From 2769f7c8d8caa58fab0f1e6c6f27879859d1b573 Mon Sep 17 00:00:00 2001 From: Jens Scherbl <jens@scherbl.com> Date: Sun, 22 Sep 2019 15:13:39 +0200 Subject: [PATCH 0033/1143] Allows additional payment checks in payment method list --- app/code/Magento/Payment/Model/MethodList.php | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Payment/Model/MethodList.php b/app/code/Magento/Payment/Model/MethodList.php index 5a426d72e4cfd..e5b961f87e426 100644 --- a/app/code/Magento/Payment/Model/MethodList.php +++ b/app/code/Magento/Payment/Model/MethodList.php @@ -39,16 +39,24 @@ class MethodList */ private $paymentMethodInstanceFactory; + /** + * @var array + */ + private $additionalChecks; + /** * @param \Magento\Payment\Helper\Data $paymentHelper - * @param Checks\SpecificationFactory $specificationFactory + * @param Checks\SpecificationFactory $specificationFactory + * @param array $additionalChecks */ public function __construct( \Magento\Payment\Helper\Data $paymentHelper, - \Magento\Payment\Model\Checks\SpecificationFactory $specificationFactory + \Magento\Payment\Model\Checks\SpecificationFactory $specificationFactory, + array $additionalChecks = [] ) { $this->paymentHelper = $paymentHelper; $this->methodSpecificationFactory = $specificationFactory; + $this->additionalChecks = $additionalChecks; } /** @@ -80,12 +88,15 @@ public function getAvailableMethods(\Magento\Quote\Api\Data\CartInterface $quote protected function _canUseMethod($method, \Magento\Quote\Api\Data\CartInterface $quote) { return $this->methodSpecificationFactory->create( - [ - AbstractMethod::CHECK_USE_CHECKOUT, - AbstractMethod::CHECK_USE_FOR_COUNTRY, - AbstractMethod::CHECK_USE_FOR_CURRENCY, - AbstractMethod::CHECK_ORDER_TOTAL_MIN_MAX, - ] + array_merge( + [ + AbstractMethod::CHECK_USE_CHECKOUT, + AbstractMethod::CHECK_USE_FOR_COUNTRY, + AbstractMethod::CHECK_USE_FOR_CURRENCY, + AbstractMethod::CHECK_ORDER_TOTAL_MIN_MAX, + ], + $this->additionalChecks + ) )->isApplicable( $method, $quote From 882868a5c33712691a79f62dfdf05459427cc31d Mon Sep 17 00:00:00 2001 From: Jens Scherbl <jens@scherbl.com> Date: Sun, 22 Sep 2019 16:34:48 +0200 Subject: [PATCH 0034/1143] Fixes unrelated code style issues --- app/code/Magento/Payment/Model/MethodList.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Payment/Model/MethodList.php b/app/code/Magento/Payment/Model/MethodList.php index e5b961f87e426..746306cbd0bbf 100644 --- a/app/code/Magento/Payment/Model/MethodList.php +++ b/app/code/Magento/Payment/Model/MethodList.php @@ -60,6 +60,8 @@ public function __construct( } /** + * Returns all available payment methods for the given quote. + * * @param \Magento\Quote\Api\Data\CartInterface $quote * @return \Magento\Payment\Model\MethodInterface[] */ From a7f87cedecb81ea4901266aadd669fd8f3bea347 Mon Sep 17 00:00:00 2001 From: "rostyslav.hymon" <rostyslav.hymon@transoftgroup.com> Date: Wed, 2 Oct 2019 17:11:19 +0300 Subject: [PATCH 0035/1143] MC-18457: Free Shipping Minimum Order Amount Excluding/Including Tax options --- .../Model/Carrier/Freeshipping.php | 23 +- ...eeShippingDisplayWithInclTaxOptionTest.xml | 68 ++++++ .../Unit/Model/Carrier/FreeshippingTest.php | 200 ++++++++++++++++++ .../OfflineShipping/etc/adminhtml/system.xml | 4 + .../Magento/Quote/Model/Quote/Address.php | 21 +- .../Test/Mftf/Data/FreeShippingMethodData.xml | 15 ++ .../Mftf/Metadata/shipping_methods-meta.xml | 3 + .../Sales/Total/Quote/CommonTaxCollector.php | 4 + 8 files changed, 324 insertions(+), 14 deletions(-) create mode 100644 app/code/Magento/OfflineShipping/Test/Mftf/Test/StorefrontFreeShippingDisplayWithInclTaxOptionTest.xml create mode 100644 app/code/Magento/OfflineShipping/Test/Unit/Model/Carrier/FreeshippingTest.php diff --git a/app/code/Magento/OfflineShipping/Model/Carrier/Freeshipping.php b/app/code/Magento/OfflineShipping/Model/Carrier/Freeshipping.php index 674e6b8089787..a1fca2b155f11 100644 --- a/app/code/Magento/OfflineShipping/Model/Carrier/Freeshipping.php +++ b/app/code/Magento/OfflineShipping/Model/Carrier/Freeshipping.php @@ -63,6 +63,24 @@ public function __construct( parent::__construct($scopeConfig, $rateErrorFactory, $logger, $data); } + /** + * Check subtotal for allowed free shipping + * + * @param RateRequest $request + * + * @return bool + */ + private function isFreeShippingRequired(RateRequest $request): bool + { + $minSubtotal = $request->getPackageValueWithDiscount(); + if ($request->getBaseSubtotalWithDiscountInclTax() + && $this->getConfigFlag('tax_including')) { + $minSubtotal = $request->getBaseSubtotalWithDiscountInclTax(); + } + + return $minSubtotal >= $this->getConfigData('free_shipping_subtotal'); + } + /** * FreeShipping Rates Collector * @@ -80,10 +98,7 @@ public function collectRates(RateRequest $request) $this->_updateFreeMethodQuote($request); - if ($request->getFreeShipping() || $request->getPackageValueWithDiscount() >= $this->getConfigData( - 'free_shipping_subtotal' - ) - ) { + if ($request->getFreeShipping() || $this->isFreeShippingRequired($request)) { /** @var \Magento\Quote\Model\Quote\Address\RateResult\Method $method */ $method = $this->_rateMethodFactory->create(); diff --git a/app/code/Magento/OfflineShipping/Test/Mftf/Test/StorefrontFreeShippingDisplayWithInclTaxOptionTest.xml b/app/code/Magento/OfflineShipping/Test/Mftf/Test/StorefrontFreeShippingDisplayWithInclTaxOptionTest.xml new file mode 100644 index 0000000000000..db44a06b54a88 --- /dev/null +++ b/app/code/Magento/OfflineShipping/Test/Mftf/Test/StorefrontFreeShippingDisplayWithInclTaxOptionTest.xml @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="StorefrontFreeShippingDisplayWithInclTaxOptionTest"> + <annotations> + <features value="Shipping"/> + <stories value="Offline Shipping Methods"/> + <title value="Free Shipping Minimum Order Amount Excluding/Including Tax options"/> + <description value="Free Shipping Minimum Order Amount Excluding/Including Tax options"/> + <severity value="AVERAGE"/> + <testCaseId value="MC-20613"/> + <useCaseId value="MC-18457"/> + <group value="shipping"/> + </annotations> + <before> + <createData entity="SimpleProduct2" stepKey="createSimpleProduct"> + <field key="price">100.00</field> + </createData> + <!-- Enable free shipping method --> + <createData entity="FreeShippinMethodConfig" stepKey="enableFreeShippingMethod"/> + <createData entity="setFreeShippingSubtotal" stepKey="setFreeShippingSubtotal"/> + <createData entity="SetTaxIncluding" stepKey="setTaxIncluding"/> + <!-- Tax configuration (Store>Configuration; Sales>Tax) --> + <createData entity="Tax_Config_CA" stepKey="configureTaxForCA"/> + <createData entity="defaultTaxRule" stepKey="createTaxRule"/> + </before> + <after> + <!-- Disable free shipping method --> + <createData entity="FreeShippinMethodDefault" stepKey="disableFreeShippingMethod"/> + <createData entity="setFreeShippingSubtotalToDefault" stepKey="setFreeShippingSubtotalToDefault"/> + <createData entity="SetTaxIncludingToDefault" stepKey="setTaxIncludingToDefault"/> + <deleteData createDataKey="createTaxRule" stepKey="deleteTaxRule"/> + <createData entity="DefaultTaxConfig" stepKey="resetTaxConfiguration"/> + <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> + </after> + <!-- Add simple product to cart --> + <actionGroup ref="AddSimpleProductToCart" stepKey="addProductToCart"> + <argument name="product" value="$$createSimpleProduct$$"/> + </actionGroup> + <!-- Assert that taxes are applied correctly for CA --> + <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCheckout"/> + <waitForPageLoad stepKey="waitForCart"/> + <waitForElementVisible selector="{{CheckoutPaymentSection.tax}}" stepKey="waitForOverviewVisible"/> + <waitForElement time="30" selector="{{CheckoutCartSummarySection.estimateShippingAndTaxForm}}" stepKey="waitForEstimateShippingAndTaxForm"/> + <waitForElement time="30" selector="{{CheckoutCartSummarySection.shippingMethodForm}}" stepKey="waitForShippingMethodForm"/> + <conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="expandEstimateShippingandTax" /> + <selectOption selector="{{CheckoutCartSummarySection.country}}" userInput="United States" stepKey="selectUSCountry"/> + <waitForPageLoad stepKey="waitForSelectCountry"/> + <selectOption selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="California" stepKey="selectCaliforniaRegion"/> + <waitForPageLoad stepKey="waitForSelectRegion"/> + <see selector="{{CheckoutPaymentSection.tax}}" userInput="$8.25" stepKey="seeTaxForCA"/> + <!-- See available Free Shipping option --> + <actionGroup ref="StorefrontAssertShippingMethodPresentInCartActionGroup" stepKey="assertShippingMethodLabel"> + <argument name="shippingMethod" value="{{freeTitleDefault.value}}"/> + </actionGroup> + <!-- Change State to New York --> + <selectOption selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="{{US_Address_NY.state}}" stepKey="selectAnotherState"/> + <waitForPageLoad stepKey="waitForShippingMethodLoad"/> + <dontSee selector="{{CheckoutCartSummarySection.shippingMethodLabel}}" userInput="{{freeTitleDefault.value}}" stepKey="assertShippingMethodIsNotPresentInCart"/> + </test> +</tests> diff --git a/app/code/Magento/OfflineShipping/Test/Unit/Model/Carrier/FreeshippingTest.php b/app/code/Magento/OfflineShipping/Test/Unit/Model/Carrier/FreeshippingTest.php new file mode 100644 index 0000000000000..7f8959e610d42 --- /dev/null +++ b/app/code/Magento/OfflineShipping/Test/Unit/Model/Carrier/FreeshippingTest.php @@ -0,0 +1,200 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\OfflineShipping\Test\Unit\Model\Carrier; + +use Magento\Quote\Model\Quote\Address\RateResult\Method; +use Magento\Shipping\Model\Rate\Result; +use Magento\OfflineShipping\Model\Carrier\Freeshipping; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Quote\Model\Quote\Address\RateResult\MethodFactory; +use Magento\Shipping\Model\Rate\ResultFactory; +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Quote\Model\Quote\Address\RateRequest; +use Magento\Store\Model\ScopeInterface; +use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\MockObject\MockObject; +use Magento\Quote\Model\Quote\Item as QuoteItem; +use PHPUnit\Framework\MockObject\Matcher\InvokedCount; + +/** + * Class for test free shipping + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class FreeshippingTest extends TestCase +{ + /** + * @var Freeshipping + */ + private $model; + + /** + * @var ScopeConfigInterface|MockObject + */ + private $scopeConfigMock; + + /** + * @var ResultFactory|MockObject + */ + private $resultFactoryMock; + + /** + * @var MethodFactory|MockObject + */ + private $methodFactoryMock; + + /** + * @var ObjectManager + */ + private $helper; + + /** + * @inheritdoc + */ + protected function setUp() + { + $this->scopeConfigMock = $this->getMockBuilder(\Magento\Framework\App\Config::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->resultFactoryMock = $this->getMockBuilder(ResultFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + + $this->methodFactoryMock = $this + ->getMockBuilder(MethodFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + + $this->helper = new ObjectManager($this); + $this->model = $this->helper->getObject( + Freeshipping::class, + [ + 'scopeConfig' => $this->scopeConfigMock, + '_rateResultFactory' => $this->resultFactoryMock, + '_rateMethodFactory' => $this->methodFactoryMock, + ] + ); + } + + /** + * Test for collect rate free shipping with tax options + * + * @param int $subtotalInclTax + * @param int $minOrderAmount + * @param int $packageValueWithDiscount + * @param int $baseSubtotalWithDiscountInclTax + * @param InvokedCount $expectedCallAppend + * + * @return void + * @dataProvider freeShippingWithSubtotalTaxDataProvider + */ + public function testCollectRatesFreeShippingWithTaxOptions( + int $subtotalInclTax, + int $minOrderAmount, + int $packageValueWithDiscount, + int $baseSubtotalWithDiscountInclTax, + InvokedCount $expectedCallAppend + ): void { + /** @var RateRequest|MockObject $request */ + $request = $this->getMockBuilder(RateRequest::class) + ->disableOriginalConstructor() + ->setMethods( + [ + 'getAllItems', + 'getPackageQty', + 'getFreeShipping', + 'getBaseSubtotalWithDiscountInclTax', + 'getPackageValueWithDiscount', + ] + ) + ->getMock(); + $item = $this->getMockBuilder(QuoteItem::class) + ->disableOriginalConstructor() + ->getMock(); + $this->scopeConfigMock->expects($this->at(0)) + ->method('isSetFlag') + ->willReturn(true); + $this->scopeConfigMock->expects($this->at(1)) + ->method('isSetFlag') + ->with( + 'carriers/freeshipping/tax_including', + ScopeInterface::SCOPE_STORE, + null + ) + ->willReturn($subtotalInclTax); + $this->scopeConfigMock->expects($this->at(2)) + ->method('getValue') + ->with( + 'carriers/freeshipping/free_shipping_subtotal', + ScopeInterface::SCOPE_STORE, + null + ) + ->willReturn($minOrderAmount); + $method = $this->getMockBuilder(Method::class) + ->disableOriginalConstructor() + ->setMethods(['setCarrier', 'setCarrierTitle', 'setMethod', 'setMethodTitle', 'setPrice', 'setCost']) + ->getMock(); + $resultModel = $this->getMockBuilder(Result::class) + ->disableOriginalConstructor() + ->setMethods(['append']) + ->getMock(); + $this->resultFactoryMock->method('create') + ->willReturn($resultModel); + $request->method('getPackageValueWithDiscount') + ->willReturn($packageValueWithDiscount); + $request->method('getAllItems') + ->willReturn([$item]); + $request->method('getFreeShipping') + ->willReturn(false); + $request->method('getBaseSubtotalWithDiscountInclTax') + ->willReturn($baseSubtotalWithDiscountInclTax); + $this->methodFactoryMock->method('create')->willReturn($method); + + $resultModel->expects($expectedCallAppend) + ->method('append') + ->with($method); + + $this->model->collectRates($request); + } + + /** + * @return array + */ + public function freeShippingWithSubtotalTaxDataProvider(): array + { + return [ + [ + 'subtotalInclTax' => 1, + 'minOrderAmount' => 10, + 'packageValueWithDiscount' => 8, + 'baseSubtotalWithDiscountInclTax' => 15, + 'expectedCallAppend' => $this->once(), + + ], + [ + 'subtotalInclTax' => 1, + 'minOrderAmount' => 20, + 'packageValueWithDiscount' => 8, + 'baseSubtotalWithDiscountInclTax' => 15, + 'expectedCallAppend' => $this->never(), + + ], + [ + 'subtotalInclTax' => 0, + 'minOrderAmount' => 10, + 'packageValueWithDiscount' => 8, + 'baseSubtotalWithDiscountInclTax' => 15, + 'expectedCallAppend' => $this->never(), + + ], + ]; + } +} diff --git a/app/code/Magento/OfflineShipping/etc/adminhtml/system.xml b/app/code/Magento/OfflineShipping/etc/adminhtml/system.xml index 2b29d2211b9d1..cb75bddf4d7bd 100644 --- a/app/code/Magento/OfflineShipping/etc/adminhtml/system.xml +++ b/app/code/Magento/OfflineShipping/etc/adminhtml/system.xml @@ -127,6 +127,10 @@ <label>Minimum Order Amount</label> <validate>validate-number validate-zero-or-greater</validate> </field> + <field id="tax_including" translate="label" sortOrder="5" type="select" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <label>Include Tax to Amount</label> + <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> + </field> <field id="name" translate="label" type="text" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Method Name</label> </field> diff --git a/app/code/Magento/Quote/Model/Quote/Address.php b/app/code/Magento/Quote/Model/Quote/Address.php index 3ecbc69b80785..ecc51a00e8fb5 100644 --- a/app/code/Magento/Quote/Model/Quote/Address.php +++ b/app/code/Magento/Quote/Model/Quote/Address.php @@ -471,7 +471,7 @@ protected function _isDefaultShippingNullOrSameAsBillingAddress() /** * Declare address quote model object * - * @param \Magento\Quote\Model\Quote $quote + * @param \Magento\Quote\Model\Quote $quote * @return $this */ public function setQuote(\Magento\Quote\Model\Quote $quote) @@ -691,7 +691,7 @@ public function getItemQty($itemId = 0) */ public function hasItems() { - return sizeof($this->getAllItems()) > 0; + return count($this->getAllItems()) > 0; } /** @@ -1020,6 +1020,7 @@ public function requestShippingRates(\Magento\Quote\Model\Quote\Item\AbstractIte $request->setLimitCarrier($this->getLimitCarrier()); $baseSubtotalInclTax = $this->getBaseSubtotalTotalInclTax(); $request->setBaseSubtotalInclTax($baseSubtotalInclTax); + $request->setBaseSubtotalWithDiscountInclTax($this->getBaseSubtotalWithDiscount() + $this->getBaseTaxAmount()); $result = $this->_rateCollector->create()->collectRates($request)->getResult(); @@ -1225,8 +1226,8 @@ public function setBaseShippingAmount($value, $alreadyExclTax = false) /** * Set total amount value * - * @param string $code - * @param float $amount + * @param string $code + * @param float $amount * @return $this */ public function setTotalAmount($code, $amount) @@ -1243,8 +1244,8 @@ public function setTotalAmount($code, $amount) /** * Set total amount value in base store currency * - * @param string $code - * @param float $amount + * @param string $code + * @param float $amount * @return $this */ public function setBaseTotalAmount($code, $amount) @@ -1261,8 +1262,8 @@ public function setBaseTotalAmount($code, $amount) /** * Add amount total amount value * - * @param string $code - * @param float $amount + * @param string $code + * @param float $amount * @return $this */ public function addTotalAmount($code, $amount) @@ -1276,8 +1277,8 @@ public function addTotalAmount($code, $amount) /** * Add amount total amount value in base store currency * - * @param string $code - * @param float $amount + * @param string $code + * @param float $amount * @return $this */ public function addBaseTotalAmount($code, $amount) diff --git a/app/code/Magento/Shipping/Test/Mftf/Data/FreeShippingMethodData.xml b/app/code/Magento/Shipping/Test/Mftf/Data/FreeShippingMethodData.xml index d700aa622c177..3d3667e59903f 100644 --- a/app/code/Magento/Shipping/Test/Mftf/Data/FreeShippingMethodData.xml +++ b/app/code/Magento/Shipping/Test/Mftf/Data/FreeShippingMethodData.xml @@ -26,6 +26,7 @@ <requiredEntity type="title">freeTitleDefault</requiredEntity> <requiredEntity type="name">freeNameDefault</requiredEntity> <requiredEntity type="free_shipping_subtotal">freeShippingSubtotalDefault</requiredEntity> + <requiredEntity type="tax_including">TaxIncludingDefault</requiredEntity> <requiredEntity type="specificerrmsg">freeSpecificerrmsgDefault</requiredEntity> <requiredEntity type="sallowspecific">freeSallowspecificDefault</requiredEntity> <requiredEntity type="specificcountry">freeSpecificcountryDefault</requiredEntity> @@ -44,6 +45,9 @@ <entity name="freeShippingSubtotalDefault" type="free_shipping_subtotal"> <data key="value" /> </entity> + <entity name="TaxIncludingDefault" type="tax_including"> + <data key="value">0</data> + </entity> <entity name="freeSpecificerrmsgDefault" type="specificerrmsg"> <data key="value">This shipping method is not available. To use this shipping method, please contact us.</data> </entity> @@ -66,6 +70,17 @@ <entity name="freeShippingSubtotal" type="free_shipping_subtotal"> <data key="value">101</data> </entity> + <!--Set Free Shipping "Include Tax to Amount" to "Yes"--> + <entity name="SetTaxIncluding" type="free_shipping_method"> + <requiredEntity type="tax_including">TaxIncluding</requiredEntity> + </entity> + <entity name="TaxIncluding" type="tax_including"> + <data key="value">1</data> + </entity> + <!--Set to default Free Shipping "Include Tax to Amount"--> + <entity name="SetTaxIncludingToDefault" type="free_shipping_method"> + <requiredEntity type="tax_including">TaxIncludingDefault</requiredEntity> + </entity> <!--Set to default Free Shipping Subtotal--> <entity name="setFreeShippingSubtotalToDefault" type="free_shipping_method"> <requiredEntity type="free_shipping_subtotal">freeShippingSubtotalDefault</requiredEntity> diff --git a/app/code/Magento/Shipping/Test/Mftf/Metadata/shipping_methods-meta.xml b/app/code/Magento/Shipping/Test/Mftf/Metadata/shipping_methods-meta.xml index 5781b886386f6..14c0d6d5af725 100644 --- a/app/code/Magento/Shipping/Test/Mftf/Metadata/shipping_methods-meta.xml +++ b/app/code/Magento/Shipping/Test/Mftf/Metadata/shipping_methods-meta.xml @@ -66,6 +66,9 @@ <object key="free_shipping_subtotal" dataType="free_shipping_subtotal"> <field key="value">string</field> </object> + <object key="tax_including" dataType="tax_including"> + <field key="value">boolean</field> + </object> <object key="specificerrmsg" dataType="specificerrmsg"> <field key="value">string</field> </object> diff --git a/app/code/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollector.php b/app/code/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollector.php index 77b3cfa3a08bb..c70c715d32c1b 100644 --- a/app/code/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollector.php +++ b/app/code/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollector.php @@ -383,6 +383,7 @@ public function mapItems( $priceIncludesTax, $useBaseCurrency ); + //phpcs:ignore Magento2.Performance.ForeachArrayMerge $itemDataObjects = array_merge($itemDataObjects, $extraTaxableItems); } } else { @@ -394,6 +395,7 @@ public function mapItems( $priceIncludesTax, $useBaseCurrency ); + //phpcs:ignore Magento2.Performance.ForeachArrayMerge $itemDataObjects = array_merge($itemDataObjects, $extraTaxableItems); } } @@ -592,6 +594,7 @@ protected function processProductItems( $total->setBaseSubtotalTotalInclTax($baseSubtotalInclTax); $total->setBaseSubtotalInclTax($baseSubtotalInclTax); $shippingAssignment->getShipping()->getAddress()->setBaseSubtotalTotalInclTax($baseSubtotalInclTax); + $shippingAssignment->getShipping()->getAddress()->setBaseTaxAmount($baseTax); return $this; } @@ -799,6 +802,7 @@ public function convertAppliedTaxes($appliedTaxes, $baseAppliedTaxes, $extraInfo 'rates' => $rates, ]; if (!empty($extraInfo)) { + //phpcs:ignore Magento2.Performance.ForeachArrayMerge $appliedTaxArray = array_merge($appliedTaxArray, $extraInfo); } From f5a7ac98dadb79e5c994fee06a5e03b8346e1671 Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Thu, 3 Oct 2019 16:02:55 +0300 Subject: [PATCH 0036/1143] MC-5233: DateTime product attributes support --- .../Product/Attribute/Edit/Tab/Advanced.php | 50 +++++- .../Product/Attribute/Edit/Tab/Main.php | 112 +++++++++----- .../Attribute/Edit/Tab/AdvancedTest.php | 104 ++++++++++--- .../Unit/Ui/Component/ColumnFactoryTest.php | 143 ++++++++++++++++-- .../Product/Form/Modifier/EavTest.php | 100 +++++++----- .../Catalog/Ui/Component/ColumnFactory.php | 72 +++++++-- .../Catalog/Ui/Component/Listing/Columns.php | 5 +- .../Product/Form/Modifier/Eav.php | 16 ++ app/code/Magento/Catalog/etc/adminhtml/di.xml | 17 +++ app/code/Magento/Catalog/etc/config.xml | 7 + .../catalog/product/attribute/js.phtml | 1 + .../product_attribute_add_form.xml | 26 ++++ .../Magento/Eav/Model/Entity/Attribute.php | 37 ++++- .../Entity/Attribute/Frontend/Datetime.php | 6 +- .../Attribute/Frontend/DatetimeTest.php | 62 ++++++-- .../Test/Unit/Model/Entity/AttributeTest.php | 2 + .../adminhtml/web/js/product-attributes.js | 8 + app/code/Magento/Ui/Component/Filters.php | 3 + .../Ui/Component/Filters/Type/Date.php | 47 ++++-- .../Component/Form/Element/DataType/Date.php | 24 ++- .../Unit/Component/Filters/Type/DateTest.php | 113 +++++++++----- .../Ui/Test/Unit/Component/FiltersTest.php | 47 ++++-- .../Form/Element/DataType/DateTest.php | 69 ++++++++- .../Ui/view/base/web/js/form/element/date.js | 7 + .../Ui/view/base/web/js/grid/columns/date.js | 17 ++- .../view/base/web/js/grid/filters/filters.js | 4 + .../Ui/view/base/web/js/grid/filters/range.js | 8 + 27 files changed, 872 insertions(+), 235 deletions(-) diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Advanced.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Advanced.php index 1b6756968662f..89239a2e3e608 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Advanced.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Advanced.php @@ -7,16 +7,20 @@ namespace Magento\Catalog\Block\Adminhtml\Product\Attribute\Edit\Tab; use Magento\Backend\Block\Widget\Form\Generic; +use Magento\Catalog\Model\ResourceModel\Eav\Attribute; use Magento\Config\Model\Config\Source\Yesno; use Magento\Eav\Block\Adminhtml\Attribute\PropertyLocker; use Magento\Eav\Helper\Data; use Magento\Framework\App\ObjectManager; +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Stdlib\DateTime; /** - * Product attribute add/edit form main tab + * Product attribute add/edit advanced form tab * * @api * @since 100.0.2 + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Advanced extends Generic { @@ -70,7 +74,7 @@ public function __construct( * Adding product form elements for editing attribute * * @return $this - * @throws \Magento\Framework\Exception\LocalizedException + * @throws LocalizedException * @SuppressWarnings(PHPMD) */ protected function _prepareForm() @@ -139,7 +143,21 @@ protected function _prepareForm() 'label' => __('Default Value'), 'title' => __('Default Value'), 'value' => $attributeObject->getDefaultValue(), - 'date_format' => $dateFormat + 'date_format' => $dateFormat, + ] + ); + + $timeFormat = $this->_localeDate->getTimeFormat(\IntlDateFormatter::SHORT); + $fieldset->addField( + 'default_value_datetime', + 'date', + [ + 'name' => 'default_value_datetime', + 'label' => __('Default Value'), + 'title' => __('Default Value'), + 'value' => $this->getLocalizedDateDefaultValue(), + 'date_format' => $dateFormat, + 'time_format' => $timeFormat, ] ); @@ -266,7 +284,7 @@ protected function _initFormValues() /** * Retrieve attribute object from registry * - * @return mixed + * @return Attribute */ private function getAttributeObject() { @@ -285,4 +303,28 @@ private function getPropertyLocker() } return $this->propertyLocker; } + + /** + * Get localized date default value + * + * @return string + * @throws LocalizedException + */ + private function getLocalizedDateDefaultValue(): string + { + $attributeObject = $this->getAttributeObject(); + if (empty($attributeObject->getDefaultValue()) || $attributeObject->getFrontendInput() !== 'datetime') { + return (string)$attributeObject->getDefaultValue(); + } + + try { + $localizedDate = $this->_localeDate->date($attributeObject->getDefaultValue(), null, false); + $localizedDate->setTimezone(new \DateTimeZone($this->_localeDate->getConfigTimezone())); + $localizedDate = $localizedDate->format(DateTime::DATETIME_PHP_FORMAT); + } catch (\Exception $e) { + throw new LocalizedException(__('The default date is invalid.')); + } + + return $localizedDate; + } } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Main.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Main.php index 85cf37a1214b5..ddc7273432cb3 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Main.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Main.php @@ -7,60 +7,60 @@ /** * Product attribute add/edit form main tab * - * @author Magento Core Team <core@magentocommerce.com> + * @author Magento Core Team <core@magentocommerce.com> */ namespace Magento\Catalog\Block\Adminhtml\Product\Attribute\Edit\Tab; +use Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Apply as HelperApply; use Magento\Eav\Block\Adminhtml\Attribute\Edit\Main\AbstractMain; +use Magento\Framework\Data\Form\Element\AbstractElement; +use Magento\Framework\Data\Form\Element\Fieldset; +use Magento\Framework\DataObject; /** + * Product attribute add/edit form main tab + * * @api - * @SuppressWarnings(PHPMD.DepthOfInheritance) * @since 100.0.2 */ class Main extends AbstractMain { /** - * Adding product form elements for editing attribute - * - * @return $this - * @SuppressWarnings(PHPMD.UnusedLocalVariable) + * @inheritdoc */ protected function _prepareForm() { parent::_prepareForm(); - /** @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attributeObject */ - $attributeObject = $this->getAttributeObject(); - /* @var $form \Magento\Framework\Data\Form */ - $form = $this->getForm(); - /* @var $fieldset \Magento\Framework\Data\Form\Element\Fieldset */ - $fieldset = $form->getElement('base_fieldset'); - $fieldsToRemove = ['attribute_code', 'is_unique', 'frontend_class']; - foreach ($fieldset->getElements() as $element) { - /** @var \Magento\Framework\Data\Form\AbstractForm $element */ - if (substr($element->getId(), 0, strlen('default_value')) == 'default_value') { - $fieldsToRemove[] = $element->getId(); - } - } - foreach ($fieldsToRemove as $id) { - $fieldset->removeField($id); - } + $this->removeUnusedFields(); + $this->processFrontendInputTypes(); + + $this->_eventManager->dispatch('product_attribute_form_build_main_tab', ['form' => $this->getForm()]); + + return $this; + } + /** + * @inheritdoc + */ + protected function _getAdditionalElementTypes() + { + return ['apply' => HelperApply::class]; + } + + /** + * Process frontend input types for product attributes + * + * @return void + */ + private function processFrontendInputTypes(): void + { + $form = $this->getForm(); + /** @var AbstractElement $frontendInputElm */ $frontendInputElm = $form->getElement('frontend_input'); - $additionalTypes = [ - ['value' => 'price', 'label' => __('Price')], - ['value' => 'media_image', 'label' => __('Media Image')], - ]; - $additionalReadOnlyTypes = ['gallery' => __('Gallery')]; - if (isset($additionalReadOnlyTypes[$attributeObject->getFrontendInput()])) { - $additionalTypes[] = [ - 'value' => $attributeObject->getFrontendInput(), - 'label' => $additionalReadOnlyTypes[$attributeObject->getFrontendInput()], - ]; - } + $additionalTypes = $this->getAdditionalFrontendInputTypes(); - $response = new \Magento\Framework\DataObject(); + $response = new DataObject(); $response->setTypes([]); $this->_eventManager->dispatch('adminhtml_product_attribute_types', ['response' => $response]); $_hiddenFields = []; @@ -74,19 +74,51 @@ protected function _prepareForm() $frontendInputValues = array_merge($frontendInputElm->getValues(), $additionalTypes); $frontendInputElm->setValues($frontendInputValues); + } - $this->_eventManager->dispatch('product_attribute_form_build_main_tab', ['form' => $form]); + /** + * Get additional Frontend Input Types for product attributes + * + * @return array + */ + private function getAdditionalFrontendInputTypes(): array + { + $additionalTypes = [ + ['value' => 'price', 'label' => __('Price')], + ['value' => 'media_image', 'label' => __('Media Image')], + ]; - return $this; + $additionalReadOnlyTypes = ['gallery' => __('Gallery')]; + $attributeObject = $this->getAttributeObject(); + if (isset($additionalReadOnlyTypes[$attributeObject->getFrontendInput()])) { + $additionalTypes[] = [ + 'value' => $attributeObject->getFrontendInput(), + 'label' => $additionalReadOnlyTypes[$attributeObject->getFrontendInput()], + ]; + } + + return $additionalTypes; } /** - * Retrieve additional element types for product attributes + * Remove unused form fields * - * @return array + * @return void */ - protected function _getAdditionalElementTypes() + private function removeUnusedFields(): void { - return ['apply' => \Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Apply::class]; + $form = $this->getForm(); + /* @var $fieldset Fieldset */ + $fieldset = $form->getElement('base_fieldset'); + $fieldsToRemove = ['attribute_code', 'is_unique', 'frontend_class']; + foreach ($fieldset->getElements() as $element) { + /** @var AbstractElement $element */ + if (substr($element->getId(), 0, strlen('default_value')) == 'default_value') { + $fieldsToRemove[] = $element->getId(); + } + } + foreach ($fieldsToRemove as $id) { + $fieldset->removeField($id); + } } } diff --git a/app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Attribute/Edit/Tab/AdvancedTest.php b/app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Attribute/Edit/Tab/AdvancedTest.php index 0352bc83cafb7..4d9345d0b3f22 100644 --- a/app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Attribute/Edit/Tab/AdvancedTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Attribute/Edit/Tab/AdvancedTest.php @@ -5,66 +5,87 @@ */ namespace Magento\Catalog\Test\Unit\Block\Adminhtml\Product\Attribute\Edit\Tab; +use Magento\Catalog\Block\Adminhtml\Product\Attribute\Edit\Tab\Advanced; +use Magento\Catalog\Model\ResourceModel\Eav\Attribute; +use Magento\Config\Model\Config\Source\Yesno; use Magento\Eav\Block\Adminhtml\Attribute\PropertyLocker; +use Magento\Eav\Helper\Data as EavHelper; +use Magento\Eav\Model\Entity\Type as EntityType; +use Magento\Framework\Data\Form; +use Magento\Framework\Data\Form\Element\Fieldset; +use Magento\Framework\Data\Form\Element\Text; +use Magento\Framework\Data\FormFactory; +use Magento\Framework\Filesystem; +use Magento\Framework\Filesystem\Directory\ReadInterface; +use Magento\Framework\Registry; +use Magento\Framework\Stdlib\DateTime; +use Magento\Framework\Stdlib\DateTime\TimezoneInterface; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use PHPUnit\Framework\MockObject\MockObject; /** + * Test product attribute add/edit advanced form tab + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class AdvancedTest extends \PHPUnit\Framework\TestCase { /** - * @var \Magento\Catalog\Block\Adminhtml\Product\Attribute\Grid + * @var Advanced */ protected $block; /** - * @var \Magento\Framework\Data\FormFactory|\PHPUnit_Framework_MockObject_MockObject + * @var FormFactory|MockObject */ protected $formFactory; /** - * @var \Magento\Framework\Registry|\PHPUnit_Framework_MockObject_MockObject + * @var Registry|MockObject */ protected $registry; /** - * @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface|\PHPUnit_Framework_MockObject_MockObject + * @var TimezoneInterface|MockObject */ protected $localeDate; /** - * @var \Magento\Config\Model\Config\Source\Yesno|\PHPUnit_Framework_MockObject_MockObject + * @var Yesno|MockObject */ protected $yesNo; /** - * @var \Magento\Eav\Helper\Data|\PHPUnit_Framework_MockObject_MockObject + * @var EavHelper|MockObject */ protected $eavData; /** - * @var \Magento\Framework\Filesystem|\PHPUnit_Framework_MockObject_MockObject + * @var Filesystem|MockObject */ protected $filesystem; /** - * @var PropertyLocker|\PHPUnit_Framework_MockObject_MockObject + * @var PropertyLocker|MockObject */ protected $propertyLocker; + /** + * @inheritdoc + */ protected function setUp() { - $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $this->registry = $this->createMock(\Magento\Framework\Registry::class); - $this->formFactory = $this->createMock(\Magento\Framework\Data\FormFactory::class); - $this->yesNo = $this->createMock(\Magento\Config\Model\Config\Source\Yesno::class); - $this->localeDate = $this->createMock(\Magento\Framework\Stdlib\DateTime\TimezoneInterface::class); - $this->eavData = $this->createMock(\Magento\Eav\Helper\Data::class); - $this->filesystem = $this->createMock(\Magento\Framework\Filesystem::class); + $objectManager = new ObjectManager($this); + $this->registry = $this->createMock(Registry::class); + $this->formFactory = $this->createMock(FormFactory::class); + $this->yesNo = $this->createMock(Yesno::class); + $this->localeDate = $this->createMock(TimezoneInterface::class); + $this->eavData = $this->createMock(EavHelper::class); + $this->filesystem = $this->createMock(Filesystem::class); $this->propertyLocker = $this->createMock(PropertyLocker::class); $this->block = $objectManager->getObject( - \Magento\Catalog\Block\Adminhtml\Product\Attribute\Edit\Tab\Advanced::class, + Advanced::class, [ 'registry' => $this->registry, 'formFactory' => $this->formFactory, @@ -77,17 +98,35 @@ protected function setUp() ); } + /** + * Test the block's html output + */ public function testToHtml() { - $fieldSet = $this->createMock(\Magento\Framework\Data\Form\Element\Fieldset::class); - $form = $this->createMock(\Magento\Framework\Data\Form::class); + $defaultValue = 'default_value'; + $localizedDefaultValue = 'localized_default_value'; + $frontendInput = 'datetime'; + $dateFormat = 'mm/dd/yy'; + $timeFormat = 'H:i:s:'; + $timeZone = 'America/Chicago'; + + $fieldSet = $this->createMock(Fieldset::class); + $form = $this->createMock(Form::class); $attributeModel = $this->createPartialMock( - \Magento\Catalog\Model\ResourceModel\Eav\Attribute::class, - ['getDefaultValue', 'setDisabled', 'getId', 'getEntityType', 'getIsUserDefined', 'getAttributeCode'] + Attribute::class, + [ + 'getDefaultValue', + 'setDisabled', + 'getId', + 'getEntityType', + 'getIsUserDefined', + 'getAttributeCode', + 'getFrontendInput' + ] ); - $entityType = $this->createMock(\Magento\Eav\Model\Entity\Type::class); - $formElement = $this->createPartialMock(\Magento\Framework\Data\Form\Element\Text::class, ['setDisabled']); - $directoryReadInterface = $this->createMock(\Magento\Framework\Filesystem\Directory\ReadInterface::class); + $entityType = $this->createMock(EntityType::class); + $formElement = $this->createPartialMock(Text::class, ['setDisabled']); + $directoryReadInterface = $this->createMock(ReadInterface::class); $this->registry->expects($this->any())->method('registry')->with('entity_attribute') ->willReturn($attributeModel); @@ -95,13 +134,28 @@ public function testToHtml() $form->expects($this->any())->method('addFieldset')->willReturn($fieldSet); $form->expects($this->any())->method('getElement')->willReturn($formElement); $fieldSet->expects($this->any())->method('addField')->willReturnSelf(); - $attributeModel->expects($this->any())->method('getDefaultValue')->willReturn('default_value'); + $attributeModel->expects($this->any())->method('getDefaultValue')->willReturn($defaultValue); $attributeModel->expects($this->any())->method('setDisabled')->willReturnSelf(); $attributeModel->expects($this->any())->method('getId')->willReturn(1); $attributeModel->expects($this->any())->method('getEntityType')->willReturn($entityType); $attributeModel->expects($this->any())->method('getIsUserDefined')->willReturn(false); $attributeModel->expects($this->any())->method('getAttributeCode')->willReturn('attribute_code'); - $this->localeDate->expects($this->any())->method('getDateFormat')->willReturn('mm/dd/yy'); + $attributeModel->expects($this->any())->method('getFrontendInput')->willReturn($frontendInput); + + $dateTimeMock = $this->createMock(\DateTime::class); + $dateTimeMock->expects($this->once())->method('setTimezone')->with(new \DateTimeZone($timeZone)); + $dateTimeMock->expects($this->once()) + ->method('format') + ->with(DateTime::DATETIME_PHP_FORMAT) + ->willReturn($localizedDefaultValue); + $this->localeDate->expects($this->any())->method('getDateFormat')->willReturn($dateFormat); + $this->localeDate->expects($this->any())->method('getTimeFormat')->willReturn($timeFormat); + $this->localeDate->expects($this->once())->method('getConfigTimezone')->willReturn($timeZone); + $this->localeDate->expects($this->once()) + ->method('date') + ->with($defaultValue, null, false) + ->willReturn($dateTimeMock); + $entityType->expects($this->any())->method('getEntityTypeCode')->willReturn('entity_type_code'); $this->eavData->expects($this->any())->method('getFrontendClasses')->willReturn([]); $formElement->expects($this->exactly(2))->method('setDisabled')->willReturnSelf(); diff --git a/app/code/Magento/Catalog/Test/Unit/Ui/Component/ColumnFactoryTest.php b/app/code/Magento/Catalog/Test/Unit/Ui/Component/ColumnFactoryTest.php index 774edcfeb6b64..f002173de7996 100644 --- a/app/code/Magento/Catalog/Test/Unit/Ui/Component/ColumnFactoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Ui/Component/ColumnFactoryTest.php @@ -7,14 +7,16 @@ namespace Magento\Catalog\Test\Unit\Ui\Component; -use PHPUnit\Framework\TestCase; +use Magento\Catalog\Model\ResourceModel\Eav\Attribute; use Magento\Catalog\Ui\Component\ColumnFactory; +use Magento\Framework\Stdlib\DateTime\TimezoneInterface; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; -use Magento\Catalog\Api\Data\ProductAttributeInterface; use Magento\Framework\View\Element\UiComponent\ContextInterface; use Magento\Framework\View\Element\UiComponentFactory; use Magento\Ui\Component\Listing\Columns\ColumnInterface; use Magento\Ui\Component\Filters\FilterModifier; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; /** * ColumnFactory test. @@ -32,25 +34,30 @@ class ColumnFactoryTest extends TestCase private $objectManager; /** - * @var ProductAttributeInterface|\PHPUnit\Framework\MockObject\MockObject + * @var Attribute|MockObject */ private $attribute; /** - * @var ContextInterface|\PHPUnit\Framework\MockObject\MockObject + * @var ContextInterface|MockObject */ private $context; /** - * @var UiComponentFactory|\PHPUnit\Framework\MockObject\MockObject + * @var UiComponentFactory|MockObject */ private $uiComponentFactory; /** - * @var ColumnInterface|\PHPUnit\Framework\MockObject\MockObject + * @var ColumnInterface|MockObject */ private $column; + /** + * @var TimezoneInterface|MockObject + */ + private $timeZone; + /** * @inheritdoc */ @@ -58,18 +65,30 @@ protected function setUp(): void { $this->objectManager = new ObjectManager($this); - $this->attribute = $this->getMockBuilder(ProductAttributeInterface::class) - ->setMethods(['usesSource']) - ->getMockForAbstractClass(); + $this->attribute = $this->createPartialMock( + Attribute::class, + [ + 'getAttributeCode', + 'getIsFilterableInGrid', + 'getFrontendInput', + 'getDefaultFrontendLabel', + 'getIsVisibleInGrid', + ] + ); $this->context = $this->createMock(ContextInterface::class); $this->uiComponentFactory = $this->createMock(UiComponentFactory::class); $this->column = $this->getMockForAbstractClass(ColumnInterface::class); $this->uiComponentFactory->method('create') ->willReturn($this->column); + $this->timeZone = $this->createMock(TimezoneInterface::class); - $this->columnFactory = $this->objectManager->getObject(ColumnFactory::class, [ - 'componentFactory' => $this->uiComponentFactory - ]); + $this->columnFactory = $this->objectManager->getObject( + ColumnFactory::class, + [ + 'componentFactory' => $this->uiComponentFactory, + 'timezone' => $this->timeZone, + ] + ); } /** @@ -96,7 +115,6 @@ public function testCreatedObject(): void * * @param array $filterModifiers * @param null|string $filter - * * @return void * @dataProvider filterModifiersProvider */ @@ -132,7 +150,7 @@ public function testCreateWithNotFilterableInGridAttribute(array $filterModifier } /** - * Filter modifiers data provider. + * Filter modifiers data provider * * @return array */ @@ -153,4 +171,101 @@ public function filterModifiersProvider(): array ], ]; } + + /** + * Test to create date column + * + * @param string $frontendInput + * @param bool $showsTime + * @param string $expectedDateFormat + * @param string $expectedTimezone + * @dataProvider createDateColumnDataProvider + */ + public function testCreateDateColumn( + string $frontendInput, + bool $showsTime, + string $expectedDateFormat, + string $expectedTimezone + ) { + $attributeCode = 'attribute_code'; + $dateFormat = 'date_format'; + $dateTimeFormat = 'datetime_format'; + $defaultTimezone = 'default_timezone'; + $configTimezone = 'config_timezone'; + $label = 'Date label'; + + $expectedConfig = [ + 'data' => [ + 'config' => [ + 'label' => __($label), + 'dataType' => 'date', + 'add_field' => true, + 'visible' => true, + 'filter' => 'dateRange', + 'component' => 'Magento_Ui/js/grid/columns/date', + 'timeZone' => $expectedTimezone, + 'dateFormat' => $expectedDateFormat, + 'options' => [ + 'showsTime' => $showsTime + ] + ], + ], + 'context' => $this->context, + ]; + + $this->attribute->method('getAttributeCode') + ->willReturn($attributeCode); + $this->attribute->method('getDefaultFrontendLabel') + ->willReturn($label); + $this->attribute->method('getIsFilterableInGrid') + ->willReturn(true); + $this->attribute->method('getIsVisibleInGrid') + ->willReturn(true); + $this->attribute->method('getFrontendInput') + ->willReturn($frontendInput); + + $this->timeZone->method('getDateFormat') + ->with(\IntlDateFormatter::MEDIUM) + ->willReturn($dateFormat); + $this->timeZone->method('getDateTimeFormat') + ->with(\IntlDateFormatter::MEDIUM) + ->willReturn($dateTimeFormat); + $this->timeZone->method('getDefaultTimezone') + ->willReturn($defaultTimezone); + $this->timeZone->method('getConfigTimezone') + ->willReturn($configTimezone); + + $this->uiComponentFactory->expects($this->once()) + ->method('create') + ->with($attributeCode, 'column', $expectedConfig) + ->willReturn($this->column); + + $this->assertEquals( + $this->column, + $this->columnFactory->create($this->attribute, $this->context) + ); + } + + /** + * Data provider to create date column test + * + * @return array + */ + public function createDateColumnDataProvider(): array + { + return [ + [ + 'frontendInput' => 'date', + 'showsTime' => false, + 'dateFormat' => 'date_format', + 'expectedTimezone' => 'default_timezone', + ], + [ + 'frontendInput' => 'datetime', + 'showsTime' => true, + 'expectedDateFormat' => 'datetime_format', + 'expectedTimezone' => 'config_timezone', + ], + ]; + } } 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 88075b13f1430..834cb505e0903 100644 --- 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 @@ -38,6 +38,7 @@ use Magento\Framework\Stdlib\ArrayManager; use Magento\Catalog\Model\ResourceModel\Eav\AttributeFactory as EavAttributeFactory; use Magento\Framework\Event\ManagerInterface; +use PHPUnit\Framework\MockObject\MockObject; /** * Class EavTest @@ -49,142 +50,142 @@ class EavTest extends AbstractModifierTest { /** - * @var Config|\PHPUnit_Framework_MockObject_MockObject + * @var Config|MockObject */ private $eavConfigMock; /** - * @var EavValidationRules|\PHPUnit_Framework_MockObject_MockObject + * @var EavValidationRules|MockObject */ private $eavValidationRulesMock; /** - * @var RequestInterface|\PHPUnit_Framework_MockObject_MockObject + * @var RequestInterface|MockObject */ private $requestMock; /** - * @var GroupCollectionFactory|\PHPUnit_Framework_MockObject_MockObject + * @var GroupCollectionFactory|MockObject */ private $groupCollectionFactoryMock; /** - * @var GroupCollection|\PHPUnit_Framework_MockObject_MockObject + * @var GroupCollection|MockObject */ private $groupCollectionMock; /** - * @var Group|\PHPUnit_Framework_MockObject_MockObject + * @var Group|MockObject */ private $groupMock; /** - * @var EavAttribute|\PHPUnit_Framework_MockObject_MockObject + * @var EavAttribute|MockObject */ private $attributeMock; /** - * @var EntityType|\PHPUnit_Framework_MockObject_MockObject + * @var EntityType|MockObject */ private $entityTypeMock; /** - * @var AttributeCollectionFactory|\PHPUnit_Framework_MockObject_MockObject + * @var AttributeCollectionFactory|MockObject */ private $attributeCollectionFactoryMock; /** - * @var AttributeCollection|\PHPUnit_Framework_MockObject_MockObject + * @var AttributeCollection|MockObject */ private $attributeCollectionMock; /** - * @var StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject + * @var StoreManagerInterface|MockObject */ private $storeManagerMock; /** - * @var FormElementMapper|\PHPUnit_Framework_MockObject_MockObject + * @var FormElementMapper|MockObject */ private $formElementMapperMock; /** - * @var MetaPropertiesMapper|\PHPUnit_Framework_MockObject_MockObject + * @var MetaPropertiesMapper|MockObject */ private $metaPropertiesMapperMock; /** - * @var SearchCriteriaBuilder|\PHPUnit_Framework_MockObject_MockObject + * @var SearchCriteriaBuilder|MockObject */ private $searchCriteriaBuilderMock; /** - * @var ProductAttributeGroupRepositoryInterface|\PHPUnit_Framework_MockObject_MockObject + * @var ProductAttributeGroupRepositoryInterface|MockObject */ private $attributeGroupRepositoryMock; /** - * @var SearchCriteria|\PHPUnit_Framework_MockObject_MockObject + * @var SearchCriteria|MockObject */ private $searchCriteriaMock; /** - * @var SortOrderBuilder|\PHPUnit_Framework_MockObject_MockObject + * @var SortOrderBuilder|MockObject */ private $sortOrderBuilderMock; /** - * @var ProductAttributeRepositoryInterface|\PHPUnit_Framework_MockObject_MockObject + * @var ProductAttributeRepositoryInterface|MockObject */ private $attributeRepositoryMock; /** - * @var AttributeGroupInterface|\PHPUnit_Framework_MockObject_MockObject + * @var AttributeGroupInterface|MockObject */ private $attributeGroupMock; /** - * @var SearchResultsInterface|\PHPUnit_Framework_MockObject_MockObject + * @var SearchResultsInterface|MockObject */ private $searchResultsMock; /** - * @var Attribute|\PHPUnit_Framework_MockObject_MockObject + * @var Attribute|MockObject */ private $eavAttributeMock; /** - * @var StoreInterface|\PHPUnit_Framework_MockObject_MockObject + * @var StoreInterface|MockObject */ protected $storeMock; /** - * @var Currency|\PHPUnit_Framework_MockObject_MockObject + * @var Currency|MockObject */ protected $currencyMock; /** - * @var CurrencyLocale|\PHPUnit_Framework_MockObject_MockObject + * @var CurrencyLocale|MockObject */ protected $currencyLocaleMock; /** - * @var ProductAttributeInterface|\PHPUnit_Framework_MockObject_MockObject + * @var ProductAttributeInterface|MockObject */ protected $productAttributeMock; /** - * @var ArrayManager|\PHPUnit_Framework_MockObject_MockObject + * @var ArrayManager|MockObject */ protected $arrayManagerMock; /** - * @var EavAttributeFactory|\PHPUnit_Framework_MockObject_MockObject + * @var EavAttributeFactory|MockObject */ protected $eavAttributeFactoryMock; /** - * @var ManagerInterface|\PHPUnit_Framework_MockObject_MockObject + * @var ManagerInterface|MockObject */ protected $eventManagerMock; @@ -457,8 +458,10 @@ public function testModifyData() * @param string|null $attrValue * @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 + * @param string|null $frontendInput + * @param array $expectedCustomize + * @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( @@ -466,7 +469,9 @@ public function testSetupAttributeMetaDefaultAttribute( bool $productRequired, $attrValue, array $expected, - $locked = false + bool $locked = false, + string $frontendInput = null, + array $expectedCustomize = [] ) : void { $configPath = 'arguments/data/config'; $groupCode = 'product-details'; @@ -492,6 +497,7 @@ public function testSetupAttributeMetaDefaultAttribute( $this->productAttributeMock->method('getDefaultValue')->willReturn('required_value'); $this->productAttributeMock->method('getAttributeCode')->willReturn('code'); $this->productAttributeMock->method('getValue')->willReturn('value'); + $this->productAttributeMock->method('getFrontendInput')->willReturn($frontendInput); $attributeMock = $this->getMockBuilder(AttributeInterface::class) ->setMethods(['getValue']) @@ -527,14 +533,16 @@ function ($value) use ($attributeOptionsExpected) { } ) ) - ->willReturn($expected); + ->willReturn($expected + $expectedCustomize); $this->arrayManagerMock->method('get')->willReturn([]); $this->arrayManagerMock->method('exists')->willReturn(true); + $actual = $this->eav->setupAttributeMeta($this->productAttributeMock, $groupCode, $sortOrder); + $this->assertEquals( - $expected, - $this->eav->setupAttributeMeta($this->productAttributeMock, $groupCode, $sortOrder) + $expected + $expectedCustomize, + $actual ); } @@ -660,7 +668,29 @@ public function setupAttributeMetaDataProvider() 'globalScope' => false, 'sortOrder' => 0, ], - ] + ], + 'datetime_null_prod_not_new_and_required' => [ + 'productId' => 1, + 'productRequired' => true, + 'attrValue' => 'val', + 'expected' => [ + 'dataType' => 'datetime', + 'formElement' => 'datetime', + 'visible' => null, + 'required' => true, + 'notice' => null, + 'default' => null, + 'label' => new Phrase(null), + 'code' => 'code', + 'source' => 'product-details', + 'scopeLabel' => '', + 'globalScope' => false, + 'sortOrder' => 0, + ], + 'locked' => false, + 'frontendInput' => 'datetime', + 'expectedCustomize' => ['arguments' => ['data' => ['config' => ['options' => ['showsTime' => 1]]]]], + ], ]; } } diff --git a/app/code/Magento/Catalog/Ui/Component/ColumnFactory.php b/app/code/Magento/Catalog/Ui/Component/ColumnFactory.php index 9a6a22fcb0985..c538273476b1f 100644 --- a/app/code/Magento/Catalog/Ui/Component/ColumnFactory.php +++ b/app/code/Magento/Catalog/Ui/Component/ColumnFactory.php @@ -5,7 +5,14 @@ */ namespace Magento\Catalog\Ui\Component; +use Magento\Catalog\Api\Data\ProductAttributeInterface; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Stdlib\DateTime\TimezoneInterface; +use Magento\Framework\View\Element\UiComponent\ContextInterface; +use Magento\Framework\View\Element\UiComponentFactory; use Magento\Ui\Component\Filters\FilterModifier; +use Magento\Ui\Component\Listing\Columns\ColumnInterface; /** * Column Factory @@ -16,7 +23,7 @@ class ColumnFactory { /** - * @var \Magento\Framework\View\Element\UiComponentFactory + * @var UiComponentFactory */ protected $componentFactory; @@ -40,25 +47,36 @@ class ColumnFactory 'select' => 'select', 'multiselect' => 'multiselect', 'date' => 'date', + 'datetime' => 'date', ]; /** - * @param \Magento\Framework\View\Element\UiComponentFactory $componentFactory + * @var TimezoneInterface */ - public function __construct(\Magento\Framework\View\Element\UiComponentFactory $componentFactory) - { + private $timezone; + + /** + * @param UiComponentFactory $componentFactory + * @param TimezoneInterface|null $timezone + */ + public function __construct( + UiComponentFactory $componentFactory, + TimezoneInterface $timezone = null + ) { $this->componentFactory = $componentFactory; + $this->timezone = $timezone + ?? ObjectManager::getInstance()->get(TimezoneInterface::class); } /** * Create Factory * - * @param \Magento\Catalog\Api\Data\ProductAttributeInterface $attribute - * @param \Magento\Framework\View\Element\UiComponent\ContextInterface $context + * @param ProductAttributeInterface $attribute + * @param ContextInterface $context * @param array $config * - * @return \Magento\Ui\Component\Listing\Columns\ColumnInterface - * @throws \Magento\Framework\Exception\LocalizedException + * @return ColumnInterface + * @throws LocalizedException */ public function create($attribute, $context, array $config = []) { @@ -84,19 +102,46 @@ public function create($attribute, $context, array $config = []) $optionData['__disableTmpl'] = true; } } - + $config['component'] = $this->getJsComponent($config['dataType']); - + + if ($config['dataType'] === 'date') { + $config += $this->getDateConfig($attribute); + } + $arguments = [ 'data' => [ 'config' => $config, ], 'context' => $context, ]; - + return $this->componentFactory->create($columnName, 'column', $arguments); } + /** + * Get config for Date columns + * + * @param ProductAttributeInterface $attribute + * @return array + */ + private function getDateConfig(ProductAttributeInterface $attribute): array + { + $isDatetime = $attribute->getFrontendInput() === 'datetime'; + $dateFormat = $isDatetime + ? $this->timezone->getDateTimeFormat(\IntlDateFormatter::MEDIUM) + : $this->timezone->getDateFormat(\IntlDateFormatter::MEDIUM); + $timeZone = $isDatetime + ? $this->timezone->getConfigTimezone() + : $this->timezone->getDefaultTimezone(); + + return [ + 'timeZone' => $timeZone, + 'dateFormat' => $dateFormat, + 'options' => [ 'showsTime' => $isDatetime], + ]; + } + /** * Get Js Component * @@ -112,7 +157,7 @@ protected function getJsComponent($dataType) /** * Get Data Type * - * @param \Magento\Catalog\Api\Data\ProductAttributeInterface $attribute + * @param ProductAttributeInterface $attribute * * @return string */ @@ -129,8 +174,9 @@ protected function getDataType($attribute) */ protected function getFilterType($frontendInput) { - $filtersMap = ['date' => 'dateRange']; + $filtersMap = ['date' => 'dateRange', 'datetime' => 'dateRange']; $result = array_replace_recursive($this->dataTypeMap, $filtersMap); + return $result[$frontendInput] ?? $result['default']; } } diff --git a/app/code/Magento/Catalog/Ui/Component/Listing/Columns.php b/app/code/Magento/Catalog/Ui/Component/Listing/Columns.php index 8ea6d8b9e5a06..d7b9bc3846f49 100644 --- a/app/code/Magento/Catalog/Ui/Component/Listing/Columns.php +++ b/app/code/Magento/Catalog/Ui/Component/Listing/Columns.php @@ -6,6 +6,8 @@ namespace Magento\Catalog\Ui\Component\Listing; /** + * Column IU component + * * @api * @since 100.0.2 */ @@ -30,6 +32,7 @@ class Columns extends \Magento\Ui\Component\Listing\Columns 'boolean' => 'select', 'multiselect' => 'select', 'date' => 'dateRange', + 'datetime' => 'datetimeRange', ]; /** @@ -52,7 +55,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ public function prepare() { 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 4039ff862f6fe..e41b2390930f0 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php @@ -746,6 +746,9 @@ public function setupAttributeMeta(ProductAttributeInterface $attribute, $groupC // Gallery attribute is being handled by "Images And Videos" section $meta = []; break; + case 'datetime': + $meta = $this->customizeDatetimeAttribute($meta); + break; } //Checking access to design config. @@ -948,6 +951,19 @@ private function customizeWysiwyg(ProductAttributeInterface $attribute, array $m return $meta; } + /** + * Customize datetime attribute + * + * @param array $meta + * @return array + */ + private function customizeDatetimeAttribute(array $meta) + { + $meta['arguments']['data']['config']['options']['showsTime'] = 1; + + return $meta; + } + /** * Retrieve form element * diff --git a/app/code/Magento/Catalog/etc/adminhtml/di.xml b/app/code/Magento/Catalog/etc/adminhtml/di.xml index c04cfb2dce00a..9e02d3da9f5d8 100644 --- a/app/code/Magento/Catalog/etc/adminhtml/di.xml +++ b/app/code/Magento/Catalog/etc/adminhtml/di.xml @@ -232,4 +232,21 @@ </argument> </arguments> </type> + <type name="Magento\Eav\Model\Adminhtml\System\Config\Source\Inputtype"> + <arguments> + <argument name="optionsArray" xsi:type="array"> + <item name="450" xsi:type="array"> + <item name="value" xsi:type="string">datetime</item> + <item name="label" xsi:type="string" translate="true">Date and Time</item> + </item> + </argument> + </arguments> + </type> + <type name="Magento\Ui\DataProvider\Mapper\FormElement"> + <arguments> + <argument name="mappings" xsi:type="array"> + <item name="datetime" xsi:type="string">date</item> + </argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/Catalog/etc/config.xml b/app/code/Magento/Catalog/etc/config.xml index 20511f4ff2295..8506d2ae03032 100644 --- a/app/code/Magento/Catalog/etc/config.xml +++ b/app/code/Magento/Catalog/etc/config.xml @@ -78,5 +78,12 @@ <thumbnail_position>stretch</thumbnail_position> </watermark> </design> + <general> + <validator_data> + <input_types> + <datetime>datetime</datetime> + </input_types> + </validator_data> + </general> </default> </config> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/js.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/js.phtml index f020eddc35dbd..212a345f4bcbc 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/js.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/js.phtml @@ -172,6 +172,7 @@ function switchDefaultValueField() break; case 'date': + case 'datetime': defaultValueDateVisibility = true; break; diff --git a/app/code/Magento/Catalog/view/adminhtml/ui_component/product_attribute_add_form.xml b/app/code/Magento/Catalog/view/adminhtml/ui_component/product_attribute_add_form.xml index 6c5d37a92ea4a..3a6621137ed5a 100644 --- a/app/code/Magento/Catalog/view/adminhtml/ui_component/product_attribute_add_form.xml +++ b/app/code/Magento/Catalog/view/adminhtml/ui_component/product_attribute_add_form.xml @@ -101,6 +101,7 @@ <item name="textarea" xsi:type="string">textarea</item> <item name="texteditor" xsi:type="string">texteditor</item> <item name="date" xsi:type="string">date</item> + <item name="datetime" xsi:type="string">datetime</item> <item name="boolean" xsi:type="string">boolean</item> <item name="multiselect" xsi:type="string">multiselect</item> <item name="select" xsi:type="string">select</item> @@ -287,6 +288,7 @@ <item name="textarea" xsi:type="string">textarea</item> <item name="texteditor" xsi:type="string">texteditor</item> <item name="date" xsi:type="string">date</item> + <item name="datetime" xsi:type="string">datetime</item> <item name="boolean" xsi:type="string">boolean</item> <item name="multiselect" xsi:type="string">multiselect</item> <item name="select" xsi:type="string">select</item> @@ -376,6 +378,29 @@ <dataScope>default_value_date</dataScope> </settings> </field> + <field name="default_value_datetime" component="Magento_Catalog/js/components/visible-on-option/date" sortOrder="35" formElement="date"> + <argument name="data" xsi:type="array"> + <item name="config" xsi:type="array"> + <item name="valuesForOptions" xsi:type="array"> + <item name="datetime" xsi:type="string">datetime</item> + </item> + </item> + </argument> + <settings> + <dataType>text</dataType> + <label translate="true">Default Value</label> + <dataScope>default_value_datetime</dataScope> + </settings> + <formElements> + <date> + <settings> + <options> + <option name="showsTime" xsi:type="boolean">true</option> + </options> + </settings> + </date> + </formElements> + </field> <field name="is_unique" component="Magento_Catalog/js/components/visible-on-option/yesno" sortOrder="40" formElement="checkbox"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> @@ -412,6 +437,7 @@ <item name="textarea" xsi:type="string">textarea</item> <item name="texteditor" xsi:type="string">texteditor</item> <item name="date" xsi:type="string">date</item> + <item name="datetime" xsi:type="string">date</item> <item name="boolean" xsi:type="string">boolean</item> <item name="multiselect" xsi:type="string">multiselect</item> <item name="select" xsi:type="string">select</item> diff --git a/app/code/Magento/Eav/Model/Entity/Attribute.php b/app/code/Magento/Eav/Model/Entity/Attribute.php index 8bd9ca2cc03c8..82eafa6174bb2 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute.php @@ -285,13 +285,8 @@ public function beforeSave() // save default date value as timestamp if ($hasDefaultValue) { - try { - $locale = $this->_localeResolver->getLocale(); - $defaultValue = $this->_localeDate->date($defaultValue, $locale, false, false); - $this->setDefaultValue($defaultValue->format(DateTime::DATETIME_PHP_FORMAT)); - } catch (\Exception $e) { - throw new LocalizedException(__('The default date is invalid. Verify the date and try again.')); - } + $defaultValue = $this->getUtcDateDefaultValue($defaultValue); + $this->setDefaultValue($defaultValue); } } @@ -310,6 +305,29 @@ public function beforeSave() return parent::beforeSave(); } + /** + * Convert localized date default value to UTC + * + * @param string $defaultValue + * @return string + * @throws LocalizedException + */ + private function getUtcDateDefaultValue(string $defaultValue): string + { + $hasTime = $this->getFrontendInput() === 'datetime'; + try { + $defaultValue = $this->_localeDate->date($defaultValue, null, $hasTime, $hasTime); + if ($hasTime) { + $defaultValue->setTimezone(new \DateTimeZone($this->_localeDate->getDefaultTimezone())); + } + $utcValue = $defaultValue->format(DateTime::DATETIME_PHP_FORMAT); + } catch (\Exception $e) { + throw new LocalizedException(__('The default date is invalid. Verify the date and try again.')); + } + + return $utcValue; + } + /** * @inheritdoc * @@ -346,6 +364,7 @@ public function getBackendTypeByInput($type) break; case 'date': + case 'datetime': $field = 'datetime'; break; @@ -401,6 +420,10 @@ public function getDefaultValueByInput($type) $field = 'default_value_date'; break; + case 'datetime': + $field = 'default_value_datetime'; + break; + case 'boolean': $field = 'default_value_yesno'; break; diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/Datetime.php b/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/Datetime.php index a9cd3be246bb1..8effd73d34af2 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/Datetime.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/Datetime.php @@ -7,6 +7,8 @@ namespace Magento\Eav\Model\Entity\Attribute\Frontend; /** + * Entity datetime frontend attribute + * * @api * @since 100.0.2 */ @@ -42,10 +44,12 @@ public function getValue(\Magento\Framework\DataObject $object) $value = parent::getValue($object); if ($value) { + $timeType = $this->getAttribute()->getFrontendInput() === 'datetime' + ? \IntlDateFormatter::MEDIUM : \IntlDateFormatter::NONE; $data = $this->_localeDate->formatDateTime( new \DateTime($value), \IntlDateFormatter::MEDIUM, - \IntlDateFormatter::NONE + $timeType ); } diff --git a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Frontend/DatetimeTest.php b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Frontend/DatetimeTest.php index 66549f2e00415..c775548fc8c75 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Frontend/DatetimeTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Frontend/DatetimeTest.php @@ -5,22 +5,31 @@ */ namespace Magento\Eav\Test\Unit\Model\Entity\Attribute\Frontend; +use Magento\Eav\Model\Entity\Attribute\AbstractAttribute; use Magento\Eav\Model\Entity\Attribute\Frontend\Datetime; +use Magento\Eav\Model\Entity\Attribute\Source\BooleanFactory; +use Magento\Framework\DataObject; +use Magento\Framework\Stdlib\DateTime\TimezoneInterface; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; -class DatetimeTest extends \PHPUnit\Framework\TestCase +/** + * Class to test Entity datetime frontend attribute + */ +class DatetimeTest extends TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var TimezoneInterface|MockObject */ private $localeDateMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var BooleanFactory|MockObject */ private $booleanFactoryMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var AbstractAttribute|MockObject */ private $attributeMock; @@ -29,40 +38,63 @@ class DatetimeTest extends \PHPUnit\Framework\TestCase */ private $model; + /** + * @inheritdoc + */ protected function setUp() { - $this->booleanFactoryMock = $this->createMock(\Magento\Eav\Model\Entity\Attribute\Source\BooleanFactory::class); - $this->localeDateMock = $this->createMock(\Magento\Framework\Stdlib\DateTime\TimezoneInterface::class); + $this->booleanFactoryMock = $this->createMock(BooleanFactory::class); + $this->localeDateMock = $this->createMock(TimezoneInterface::class); $this->attributeMock = $this->createPartialMock( - \Magento\Eav\Model\Entity\Attribute\AbstractAttribute::class, - ['getAttributeCode', 'getFrontendLabel', 'getData'] + AbstractAttribute::class, + ['getAttributeCode', 'getFrontendLabel', 'getFrontendInput'] ); $this->model = new Datetime($this->booleanFactoryMock, $this->localeDateMock); $this->model->setAttribute($this->attributeMock); } - public function testGetValue() + /** + * Test to retrieve attribute value + * + * @param string $frontendInput + * @param int $timeType + * @dataProvider getValueDataProvider + */ + public function testGetValue(string $frontendInput, int $timeType) { $attributeValue = '11-11-2011'; + $attributeCode = 'datetime'; $date = new \DateTime($attributeValue); - $object = new \Magento\Framework\DataObject(['datetime' => $attributeValue]); + $object = new DataObject([$attributeCode => $attributeValue]); $this->attributeMock->expects($this->any()) ->method('getAttributeCode') - ->willReturn('datetime'); + ->willReturn($attributeCode); $this->attributeMock->expects($this->any()) - ->method('getData') - ->with('frontend_input') - ->willReturn('text'); + ->method('getFrontendInput') + ->willReturn($frontendInput); $this->localeDateMock->expects($this->once()) ->method('formatDateTime') - ->with($date, \IntlDateFormatter::MEDIUM, \IntlDateFormatter::NONE, null, null, null) + ->with($date, \IntlDateFormatter::MEDIUM, $timeType) ->willReturn($attributeValue); $this->assertEquals($attributeValue, $this->model->getValue($object)); } + /** + * Retrieve attribute value data provider + * + * @return array + */ + public function getValueDataProvider(): array + { + return [ + ['frontendInput' => 'date', 'timeType' => \IntlDateFormatter::NONE], + ['frontendInput' => 'datetime', 'timeType' => \IntlDateFormatter::MEDIUM], + ]; + } + /** * @param mixed $labelText * @param string $attributeCode diff --git a/app/code/Magento/Eav/Test/Unit/Model/Entity/AttributeTest.php b/app/code/Magento/Eav/Test/Unit/Model/Entity/AttributeTest.php index 402497a1379c0..7aa5bca00f0b6 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/Entity/AttributeTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Entity/AttributeTest.php @@ -57,6 +57,7 @@ public static function dataGetBackendTypeByInput() ['image', 'text'], ['textarea', 'text'], ['date', 'datetime'], + ['datetime', 'datetime'], ['select', 'int'], ['boolean', 'int'], ['price', 'decimal'], @@ -91,6 +92,7 @@ public static function dataGetDefaultValueByInput() ['weight', 'default_value_text'], ['textarea', 'default_value_textarea'], ['date', 'default_value_date'], + ['datetime', 'default_value_datetime'], ['boolean', 'default_value_yesno'] ]; } 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 f795f99e8112d..9e48af20ee945 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 @@ -31,6 +31,7 @@ define([ defaultValueText: $('#default_value_text'), defaultValueTextarea: $('#default_value_textarea'), defaultValueDate: $('#default_value_date'), + defaultValueDatetime: $('#default_value_datetime'), defaultValueYesno: $('#default_value_yesno'), isGlobal: $('#is_global'), useProductImageForSwatch: $('#use_product_image_for_swatch'), @@ -178,6 +179,7 @@ define([ defaultValueTextVisibility = false, defaultValueTextareaVisibility = false, defaultValueDateVisibility = false, + defaultValueDatetimeVisibility = false, defaultValueYesnoVisibility = false, scopeVisibility = true, useProductImageForSwatch = false, @@ -203,6 +205,10 @@ define([ defaultValueDateVisibility = true; break; + case 'datetime': + defaultValueDatetimeVisibility = true; + break; + case 'boolean': defaultValueYesnoVisibility = true; break; @@ -256,6 +262,7 @@ define([ defaultValueTextVisibility = false; defaultValueTextareaVisibility = false; defaultValueDateVisibility = false; + defaultValueDatetimeVisibility = false; defaultValueYesnoVisibility = false; break; @@ -279,6 +286,7 @@ define([ this.setRowVisibility(this.defaultValueText, defaultValueTextVisibility); this.setRowVisibility(this.defaultValueTextarea, defaultValueTextareaVisibility); this.setRowVisibility(this.defaultValueDate, defaultValueDateVisibility); + this.setRowVisibility(this.defaultValueDatetime, defaultValueDatetimeVisibility); this.setRowVisibility(this.defaultValueYesno, defaultValueYesnoVisibility); this.setRowVisibility(this.isGlobal, scopeVisibility); diff --git a/app/code/Magento/Ui/Component/Filters.php b/app/code/Magento/Ui/Component/Filters.php index fe02c23af9c8a..5bf89ae7936e9 100644 --- a/app/code/Magento/Ui/Component/Filters.php +++ b/app/code/Magento/Ui/Component/Filters.php @@ -12,6 +12,8 @@ use Magento\Ui\Component\Listing\Columns\ColumnInterface; /** + * Grid filters UI component + * * @api * @since 100.0.2 */ @@ -36,6 +38,7 @@ class Filters extends AbstractComponent implements ObserverInterface 'textRange' => 'filterRange', 'select' => 'filterSelect', 'dateRange' => 'filterDate', + 'datetimeRange' => 'filterDate', ]; /** diff --git a/app/code/Magento/Ui/Component/Filters/Type/Date.php b/app/code/Magento/Ui/Component/Filters/Type/Date.php index e854b888c45e6..28ad8568ebe31 100644 --- a/app/code/Magento/Ui/Component/Filters/Type/Date.php +++ b/app/code/Magento/Ui/Component/Filters/Type/Date.php @@ -9,6 +9,8 @@ use Magento\Ui\Component\Form\Element\DataType\Date as DataTypeDate; /** + * Date grid filter UI Component + * * @api * @since 100.0.2 */ @@ -84,30 +86,18 @@ protected function applyFilter() if (isset($value['from'])) { $this->applyFilterByType( 'gteq', - $this->wrappedComponent->convertDate( - $value['from'], - 0, - 0, - 0, - !$this->getData('config/skipTimeZoneConversion') - ) + $this->convertDatetime((string)$value['from']) ); } if (isset($value['to'])) { $this->applyFilterByType( 'lteq', - $this->wrappedComponent->convertDate( - $value['to'], - 23, - 59, - 59, - !$this->getData('config/skipTimeZoneConversion') - ) + $this->convertDatetime((string)$value['to'], 23, 59, 59) ); } } else { - $this->applyFilterByType('eq', $this->wrappedComponent->convertDate($value)); + $this->applyFilterByType('eq', $this->convertDatetime((string)$value)); } } } @@ -130,4 +120,31 @@ protected function applyFilterByType($type, $value) $this->getContext()->getDataProvider()->addFilter($filter); } } + + /** + * Convert given date to default (UTC) timezone + * + * @param string $value + * @param int $hour + * @param int $minute + * @param int $second + * @return \DateTime + */ + private function convertDatetime(string $value, int $hour = 0, int $minute = 0, int $second = 0): ?\DateTime + { + $value = $this->getData('config/options/showsTime') + ? $this->wrappedComponent->convertDatetime( + $value, + !$this->getData('config/skipTimeZoneConversion') + ) + : $this->wrappedComponent->convertDate( + $value, + $hour, + $minute, + $second, + !$this->getData('config/skipTimeZoneConversion') + ); + + return $value; + } } diff --git a/app/code/Magento/Ui/Component/Form/Element/DataType/Date.php b/app/code/Magento/Ui/Component/Form/Element/DataType/Date.php index 31d2fe786cfd8..8ea6236e8e2e2 100644 --- a/app/code/Magento/Ui/Component/Form/Element/DataType/Date.php +++ b/app/code/Magento/Ui/Component/Form/Element/DataType/Date.php @@ -111,7 +111,7 @@ public function getComponentName() public function convertDate($date, $hour = 0, $minute = 0, $second = 0, $setUtcTimeZone = true) { try { - $dateObj = $this->localeDate->date($date, $this->getLocale(), true); + $dateObj = $this->localeDate->date($date, $this->getLocale(), false); $dateObj->setTime($hour, $minute, $second); //convert store date to default date in UTC timezone without DST if ($setUtcTimeZone) { @@ -122,4 +122,26 @@ public function convertDate($date, $hour = 0, $minute = 0, $second = 0, $setUtcT return null; } } + + /** + * Convert given date to default (UTC) timezone + * + * @param string $date + * @param bool $setUtcTimeZone + * @return \DateTime|null + */ + public function convertDatetime(string $date, bool $setUtcTimeZone = true): ?\DateTime + { + try { + $date = rtrim($date, 'Z'); + $dateObj = new \DateTime($date, new \DateTimeZone($this->localeDate->getConfigTimezone())); + //convert store date to default date in UTC timezone without DST + if ($setUtcTimeZone) { + $dateObj->setTimezone(new \DateTimeZone('UTC')); + } + return $dateObj; + } catch (\Exception $e) { + return null; + } + } } diff --git a/app/code/Magento/Ui/Test/Unit/Component/Filters/Type/DateTest.php b/app/code/Magento/Ui/Test/Unit/Component/Filters/Type/DateTest.php index 78456968cbef1..7038a587be0b0 100644 --- a/app/code/Magento/Ui/Test/Unit/Component/Filters/Type/DateTest.php +++ b/app/code/Magento/Ui/Test/Unit/Component/Filters/Type/DateTest.php @@ -13,6 +13,7 @@ use Magento\Ui\Component\Filters\Type\Date; use Magento\Framework\View\Element\UiComponent\ContextInterface; use Magento\Ui\Component\Form\Element\DataType\Date as FormDate; +use PHPUnit\Framework\MockObject\MockObject; /** * Class DateTest @@ -20,27 +21,27 @@ class DateTest extends \PHPUnit\Framework\TestCase { /** - * @var ContextInterface|\PHPUnit_Framework_MockObject_MockObject + * @var ContextInterface|MockObject */ private $contextMock; /** - * @var UiComponentFactory|\PHPUnit_Framework_MockObject_MockObject + * @var UiComponentFactory|MockObject */ private $uiComponentFactory; /** - * @var FilterBuilder|\PHPUnit_Framework_MockObject_MockObject + * @var FilterBuilder|MockObject */ private $filterBuilderMock; /** - * @var FilterModifier|\PHPUnit_Framework_MockObject_MockObject + * @var FilterModifier|MockObject */ private $filterModifierMock; /** - * @var DataProviderInterface|\PHPUnit_Framework_MockObject_MockObject + * @var DataProviderInterface|MockObject */ private $dataProviderMock; @@ -89,18 +90,19 @@ public function testGetComponentName() * Run test prepare method * * @param string $name + * @param bool $showsTime * @param array $filterData * @param array|null $expectedCondition * @dataProvider getPrepareDataProvider * @return void */ - public function testPrepare($name, $filterData, $expectedCondition) + public function testPrepare(string $name, bool $showsTime, array $filterData, ?array $expectedCondition) { $processor = $this->getMockBuilder(\Magento\Framework\View\Element\UiComponent\Processor::class) ->disableOriginalConstructor() ->getMock(); $this->contextMock->expects(static::atLeastOnce())->method('getProcessor')->willReturn($processor); - /** @var FormDate $uiComponent */ + /** @var FormDate|MockObject $uiComponent */ $uiComponent = $this->getMockBuilder(FormDate::class) ->disableOriginalConstructor() ->getMock(); @@ -125,7 +127,7 @@ public function testPrepare($name, $filterData, $expectedCondition) ->willReturn($this->dataProviderMock); if ($expectedCondition !== null) { - $this->processFilters($name, $filterData, $expectedCondition, $uiComponent); + $this->processFilters($name, $showsTime, $filterData, $expectedCondition, $uiComponent); } $this->uiComponentFactory->expects($this->any()) @@ -139,7 +141,10 @@ public function testPrepare($name, $filterData, $expectedCondition) $this->filterBuilderMock, $this->filterModifierMock, [], - ['name' => $name] + [ + 'name' => $name, + 'config' => ['options' => ['showsTime' => $showsTime]], + ] ); $date->prepare(); } @@ -152,7 +157,7 @@ public function testPrepare($name, $filterData, $expectedCondition) * @param string $expectedDate * @param int $i * - * @return Filter|\PHPUnit_Framework_MockObject_MockObject + * @return Filter|MockObject */ private function getFilterMock($name, $expectedType, $expectedDate, &$i) { @@ -184,57 +189,87 @@ public function getPrepareDataProvider() { return [ [ - 'test_date', - ['test_date' => ['from' => '11-05-2015', 'to' => null]], - ['date' => '2015-05-11 00:00:00', 'type' => 'gteq'], + 'name' => 'test_date', + 'showsTime' => false, + 'filterData' => ['test_date' => ['from' => '11-05-2015', 'to' => null]], + 'expectedCondition' => ['date' => '2015-05-11 00:00:00', 'type' => 'gteq'], ], [ - 'test_date', - ['test_date' => ['from' => null, 'to' => '11-05-2015']], - ['date' => '2015-05-11 23:59:59', 'type' => 'lteq'], + 'name' => 'test_date', + 'showsTime' => false, + 'filterData' => ['test_date' => ['from' => null, 'to' => '11-05-2015']], + 'expectedCondition' => ['date' => '2015-05-11 23:59:59', 'type' => 'lteq'], ], [ - 'test_date', - ['test_date' => ['from' => '11-05-2015', 'to' => '11-05-2015']], - [ + 'name' => 'test_date', + 'showsTime' => false, + 'filterData' => ['test_date' => ['from' => '11-05-2015', 'to' => '11-05-2015']], + 'expectedCondition' => [ 'date_from' => '2015-05-11 00:00:00', 'type_from' => 'gteq', 'date_to' => '2015-05-11 23:59:59', 'type_to' => 'lteq' ], ], [ - 'test_date', - ['test_date' => '11-05-2015'], - ['date' => '2015-05-11 00:00:00', 'type' => 'eq'], + 'name' => 'test_date', + 'showsTime' => false, + 'filterData' => ['test_date' => '11-05-2015'], + 'expectedCondition' => ['date' => '2015-05-11 00:00:00', 'type' => 'eq'], + ], + [ + 'name' => 'test_date', + 'showsTime' => false, + 'filterData' => ['test_date' => ['from' => '', 'to' => '']], + 'expectedCondition' => null, ], [ - 'test_date', - ['test_date' => ['from' => '', 'to' => '']], - null, + 'name' => 'test_date', + 'showsTime' => true, + 'filterData' => ['test_date' => ['from' => '11-05-2015 10:20:00', 'to' => '11-05-2015 18:25:00']], + 'expectedCondition' => [ + 'date_from' => '2015-05-11 10:20:00', 'type_from' => 'gteq', + 'date_to' => '2015-05-11 18:25:00', 'type_to' => 'lteq' + ], ], ]; } /** - * @param $name - * @param $filterData - * @param $expectedCondition - * @param $uiComponent + * @param string $name + * @param bool $showsTime + * @param array $filterData + * @param array $expectedCondition + * @param MockObject $uiComponent */ - private function processFilters($name, $filterData, $expectedCondition, $uiComponent) - { + private function processFilters( + string $name, + bool $showsTime, + array $filterData, + array $expectedCondition, + FormDate $uiComponent + ) { if (is_string($filterData[$name])) { $uiComponent->expects(static::once()) - ->method('convertDate') + ->method($showsTime ? 'convertDatetime' : 'convertDate') ->with($filterData[$name]) ->willReturn(new \DateTime($filterData[$name])); } else { - $from = new \DateTime($filterData[$name]['from']); - $to = new \DateTime($filterData[$name]['to'] . ' 23:59:59'); - $uiComponent->method('convertDate') - ->willReturnMap([ - [$filterData[$name]['from'], 0, 0, 0, true, $from], - [$filterData[$name]['to'], 23, 59, 59, true, $to], - ]); + if ($showsTime) { + $from = new \DateTime($filterData[$name]['from']); + $to = new \DateTime($filterData[$name]['to']); + $uiComponent->method('convertDatetime') + ->willReturnMap([ + [$filterData[$name]['from'], true, $from], + [$filterData[$name]['to'], true, $to], + ]); + } else { + $from = new \DateTime($filterData[$name]['from']); + $to = new \DateTime($filterData[$name]['to'] . ' 23:59:59'); + $uiComponent->method('convertDate') + ->willReturnMap([ + [$filterData[$name]['from'], 0, 0, 0, true, $from], + [$filterData[$name]['to'], 23, 59, 59, true, $to], + ]); + } } $i = 0; diff --git a/app/code/Magento/Ui/Test/Unit/Component/FiltersTest.php b/app/code/Magento/Ui/Test/Unit/Component/FiltersTest.php index 402fd30bf4d5b..19a1be69ca1d7 100644 --- a/app/code/Magento/Ui/Test/Unit/Component/FiltersTest.php +++ b/app/code/Magento/Ui/Test/Unit/Component/FiltersTest.php @@ -8,23 +8,27 @@ namespace Magento\Ui\Test\Unit\Component; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; -use \Magento\Ui\Component\Filters; +use Magento\Framework\View\Element\UiComponent\ContextInterface; +use Magento\Framework\View\Element\UiComponentFactory; +use Magento\Framework\View\Element\UiComponentInterface; +use Magento\Ui\Component\Filters; +use PHPUnit\Framework\MockObject\MockObject; /** * Unit tests for \Magento\Ui\Component\Filters class */ class FiltersTest extends \PHPUnit\Framework\TestCase { - /** @var Filters|\PHPUnit_Framework_MockObject_MockObject */ + /** @var Filters|MockObject */ private $filters; - /** @var \Magento\Framework\View\Element\UiComponentInterface|\PHPUnit_Framework_MockObject_MockObject */ + /** @var UiComponentInterface|MockObject */ private $uiComponentInterface; - /** @var \Magento\Framework\View\Element\UiComponentFactory|\PHPUnit_Framework_MockObject_MockObject */ + /** @var UiComponentFactory|MockObject */ private $uiComponentFactory; - /** @var \Magento\Framework\View\Element\UiComponent\ContextInterface|\PHPUnit_Framework_MockObject_MockObject */ + /** @var ContextInterface|MockObject */ private $context; /** @@ -33,13 +37,13 @@ class FiltersTest extends \PHPUnit\Framework\TestCase protected function setUp() { $objectManager = new ObjectManager($this); - $this->uiComponentInterface = $this->getMockBuilder(\Magento\Framework\View\Element\UiComponentInterface::class) + $this->uiComponentInterface = $this->getMockBuilder(UiComponentInterface::class) ->disableOriginalConstructor() ->getMock(); - $this->uiComponentFactory = $this->getMockBuilder(\Magento\Framework\View\Element\UiComponentFactory::class) + $this->uiComponentFactory = $this->getMockBuilder(UiComponentFactory::class) ->disableOriginalConstructor() ->getMock(); - $this->context = $this->getMockBuilder(\Magento\Framework\View\Element\UiComponent\ContextInterface::class) + $this->context = $this->getMockBuilder(ContextInterface::class) ->disableOriginalConstructor() ->getMock(); $this->filters = $objectManager->getObject( @@ -52,7 +56,14 @@ protected function setUp() ); } - public function testUpdate() + /** + * Test to Update filter component according to $component + * + * @param string $filterType + * @param string $filterName + * @dataProvider updateDataProvider + */ + public function testUpdate(string $filterType, string $filterName) { $componentName = 'component_name'; $componentConfig = [0, 1, 2]; @@ -60,7 +71,10 @@ public function testUpdate() ->disableOriginalConstructor() ->setMethods(['getData', 'getName', 'getConfiguration']) ->getMockForAbstractClass(); - $columnInterface->expects($this->atLeastOnce())->method('getData')->with('config/filter')->willReturn('text'); + $columnInterface->expects($this->atLeastOnce()) + ->method('getData') + ->with('config/filter') + ->willReturn($filterType); $columnInterface->expects($this->atLeastOnce())->method('getName')->willReturn($componentName); $columnInterface->expects($this->once())->method('getConfiguration')->willReturn($componentConfig); $filterComponent = $this->getMockBuilder(\Magento\Framework\View\Element\UiComponentInterface::class) @@ -71,11 +85,22 @@ public function testUpdate() ->willReturnSelf(); $filterComponent->expects($this->once())->method('prepare')->willReturnSelf(); $this->uiComponentFactory->expects($this->once())->method('create') - ->with($componentName, 'filterInput', ['context' => $this->context]) + ->with($componentName, $filterName, ['context' => $this->context]) ->willReturn($filterComponent); $this->filters->update($columnInterface); /** Verify that filter is already set and it wouldn't be set again */ $this->filters->update($columnInterface); } + + /** + * @return array + */ + public function updateDataProvider(): array + { + return [ + ['text', 'filterInput'], + ['datetimeRange', 'filterDate'], + ]; + } } diff --git a/app/code/Magento/Ui/Test/Unit/Component/Form/Element/DataType/DateTest.php b/app/code/Magento/Ui/Test/Unit/Component/Form/Element/DataType/DateTest.php index cdb11f05daa8c..015c025e7c102 100644 --- a/app/code/Magento/Ui/Test/Unit/Component/Form/Element/DataType/DateTest.php +++ b/app/code/Magento/Ui/Test/Unit/Component/Form/Element/DataType/DateTest.php @@ -11,27 +11,35 @@ use Magento\Framework\View\Element\UiComponent\Context; use Magento\Framework\View\Element\UiComponent\Processor; use Magento\Ui\Component\Form\Element\DataType\Date; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; -class DateTest extends \PHPUnit\Framework\TestCase +/** + * Class to test Date form element + */ +class DateTest extends TestCase { - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var Context|MockObject */ private $contextMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var TimezoneInterface|MockObject */ private $localeDateMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var ResolverInterface|MockObject */ private $localeResolverMock; - /** @var \Magento\Ui\Component\Form\Element\DataType\Date */ + /** @var Date */ private $date; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var Processor|MockObject */ private $processorMock; - /** @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager */ + /** @var ObjectManager */ private $objectManagerHelper; + /** + * @inheritdoc + */ public function setUp() { $this->contextMock = $this->createMock(Context::class); @@ -39,9 +47,12 @@ public function setUp() $this->localeResolverMock = $this->createMock(ResolverInterface::class); $this->objectManagerHelper = new ObjectManager($this); $this->processorMock = $this->createMock(Processor::class); - $this->contextMock->expects($this->atLeastOnce())->method('getProcessor')->willReturn($this->processorMock); + $this->contextMock->method('getProcessor')->willReturn($this->processorMock); } + /** + * Test to Prepare component configuration with Time offset + */ public function testPrepareWithTimeOffset() { $this->date = new Date( @@ -72,6 +83,9 @@ public function testPrepareWithTimeOffset() $this->assertEquals($localeDateFormat, $config['options']['dateFormat']); } + /** + * Test to Prepare component configuration without Time offset + */ public function testPrepareWithoutTimeOffset() { $defaultDateFormat = 'MM/dd/y'; @@ -130,4 +144,43 @@ public function testPrepare() $this->assertEquals('America/Chicago', $configArray['storeTimeZone']); $this->assertEquals('de-DE', $configArray['options']['storeLocale']); } + + /** + * Test to Convert given date to default (UTC) timezone + * + * @param string $dateStr + * @param bool $setUtcTimeZone + * @param string $convertedDate + * @dataProvider convertDatetimeDataProvider + */ + public function testConvertDatetime(string $dateStr, bool $setUtcTimeZone, string $convertedDate) + { + $this->localeDateMock->method('getConfigTimezone') + ->willReturn('America/Los_Angeles'); + + $this->date = $this->objectManagerHelper->getObject( + Date::class, + [ + 'localeDate' => $this->localeDateMock, + ] + ); + + $this->assertEquals( + $convertedDate, + $this->date->convertDatetime($dateStr, $setUtcTimeZone)->format('Y-m-d H:i:s'), + "The date value wasn't converted" + ); + } + + /** + * @return array + */ + public function convertDatetimeDataProvider(): array + { + return [ + ['2019-09-30T12:32:00.000Z', false, '2019-09-30 12:32:00'], + ['2019-09-30T12:32:00.000', false, '2019-09-30 12:32:00'], + ['2019-09-30T12:32:00.000Z', true, '2019-09-30 19:32:00'], + ]; + } } diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/date.js b/app/code/Magento/Ui/view/base/web/js/form/element/date.js index ac28271e90a3b..1432372dd75a9 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/date.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/date.js @@ -107,6 +107,13 @@ define([ return this._super().observe(['shiftedValue']); }, + /** + * @inheritdoc + */ + getPreview: function () { + return this.shiftedValue(); + }, + /** * Prepares and sets date/time value that will be displayed * in the input field. diff --git a/app/code/Magento/Ui/view/base/web/js/grid/columns/date.js b/app/code/Magento/Ui/view/base/web/js/grid/columns/date.js index 3f9c5b20d6215..cc69d990372c1 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/columns/date.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/columns/date.js @@ -9,8 +9,10 @@ define([ 'mageUtils', 'moment', - './column' -], function (utils, moment, Column) { + './column', + 'underscore', + 'moment-timezone-with-data' +], function (utils, moment, Column, _) { 'use strict'; return Column.extend({ @@ -20,9 +22,9 @@ define([ }, /** - * Overrides base method to normalize date format. + * Overrides base method to normalize date format * - * @returns {DateColumn} Chainable. + * @returns {DateColumn} Chainable */ initConfig: function () { this._super(); @@ -38,12 +40,15 @@ define([ * @returns {String} Formatted date. */ getLabel: function (value, format) { - var date; + var date = moment.utc(this._super()); if (this.storeLocale !== undefined) { moment.locale(this.storeLocale, utils.extend({}, this.calendarConfig)); } - date = moment(this._super()); + + if (!_.isUndefined(this.timeZone)) { + date = date.tz(this.timeZone); + } date = date.isValid() && value[this.index] ? date.format(format || this.dateFormat) : diff --git a/app/code/Magento/Ui/view/base/web/js/grid/filters/filters.js b/app/code/Magento/Ui/view/base/web/js/grid/filters/filters.js index 98c3eb1c6f882..a6fae9df50c4d 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/filters/filters.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/filters/filters.js @@ -83,6 +83,10 @@ define([ component: 'Magento_Ui/js/grid/filters/range', rangeType: 'date' }, + datetimeRange: { + component: 'Magento_Ui/js/grid/filters/range', + rangeType: 'datetime' + }, textRange: { component: 'Magento_Ui/js/grid/filters/range', rangeType: 'text' diff --git a/app/code/Magento/Ui/view/base/web/js/grid/filters/range.js b/app/code/Magento/Ui/view/base/web/js/grid/filters/range.js index ccfba8e98b6f4..1949234c89324 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/filters/range.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/filters/range.js @@ -30,6 +30,14 @@ define([ dateFormat: 'MM/dd/YYYY', shiftedValue: 'filter' }, + datetime: { + component: 'Magento_Ui/js/form/element/date', + dateFormat: 'MM/dd/YYYY', + shiftedValue: 'filter', + options: { + showsTime: true + } + }, text: { component: 'Magento_Ui/js/form/element/abstract' }, From 91d61bdc5e5b85dcc5b51f7b539055e187a16790 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <engcom-vendorworker-foxtrot@adobe.com> Date: Tue, 24 Sep 2019 17:01:57 +0300 Subject: [PATCH 0037/1143] magento/magento2#24460: Multiline custom attributes save fix. --- .../Model/Address/AbstractAddress.php | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Customer/Model/Address/AbstractAddress.php b/app/code/Magento/Customer/Model/Address/AbstractAddress.php index 158461b4d9c17..fb067decd0b37 100644 --- a/app/code/Magento/Customer/Model/Address/AbstractAddress.php +++ b/app/code/Magento/Customer/Model/Address/AbstractAddress.php @@ -281,7 +281,13 @@ public function setData($key, $value = null) $key = $this->_implodeArrayField($key); } elseif (is_array($value) && $this->isAddressMultilineAttribute($key)) { $value = $this->_implodeArrayValues($value); + } elseif (self::CUSTOM_ATTRIBUTES === $key && is_array($value)) { + foreach ($value as &$attribute) { + $attribute = is_array($attribute) ? $attribute : $attribute->__toArray(); + $attribute = $this->processCustomAttribute($attribute); + } } + return parent::setData($key, $value); } @@ -637,8 +643,8 @@ public function unsRegion() * Is company required * * @return bool - * @since 100.2.0 * @throws \Magento\Framework\Exception\LocalizedException + * @since 100.2.0 */ protected function isCompanyRequired() { @@ -649,8 +655,8 @@ protected function isCompanyRequired() * Is telephone required * * @return bool - * @since 100.2.0 * @throws \Magento\Framework\Exception\LocalizedException + * @since 100.2.0 */ protected function isTelephoneRequired() { @@ -661,11 +667,30 @@ protected function isTelephoneRequired() * Is fax required * * @return bool - * @since 100.2.0 * @throws \Magento\Framework\Exception\LocalizedException + * @since 100.2.0 */ protected function isFaxRequired() { return ($this->_eavConfig->getAttribute('customer_address', 'fax')->getIsRequired()); } + + /** + * Unify attribute format. + * + * @param array $attribute + * @return array + */ + private function processCustomAttribute(array $attribute): array + { + if (isset($attribute['attribute_code']) && + isset($attribute['value']) && + is_array($attribute['value']) && + $this->isAddressMultilineAttribute($attribute['attribute_code']) + ) { + $attribute['value'] = $this->_implodeArrayValues($attribute['value']); + } + + return $attribute; + } } From e9c704b9277e2567278992dabd14946e65c42f42 Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Fri, 4 Oct 2019 10:12:06 +0300 Subject: [PATCH 0038/1143] MC-5233: DateTime product attributes support --- .../Attribute/Frontend/DatetimeTest.php | 2 +- .../Unit/Component/Filters/Type/DateTest.php | 21 ++++--- .../Ui/Test/Unit/Component/FiltersTest.php | 2 +- .../Eav/Model/Entity/AttributeTest.php | 55 ++++++++++++------- 4 files changed, 49 insertions(+), 31 deletions(-) diff --git a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Frontend/DatetimeTest.php b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Frontend/DatetimeTest.php index c775548fc8c75..163f3d208e724 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Frontend/DatetimeTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Frontend/DatetimeTest.php @@ -56,7 +56,7 @@ protected function setUp() /** * Test to retrieve attribute value - * + * * @param string $frontendInput * @param int $timeType * @dataProvider getValueDataProvider diff --git a/app/code/Magento/Ui/Test/Unit/Component/Filters/Type/DateTest.php b/app/code/Magento/Ui/Test/Unit/Component/Filters/Type/DateTest.php index 7038a587be0b0..31d7ca92c5985 100644 --- a/app/code/Magento/Ui/Test/Unit/Component/Filters/Type/DateTest.php +++ b/app/code/Magento/Ui/Test/Unit/Component/Filters/Type/DateTest.php @@ -239,6 +239,7 @@ public function getPrepareDataProvider() * @param array $filterData * @param array $expectedCondition * @param MockObject $uiComponent + * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ private function processFilters( string $name, @@ -257,18 +258,22 @@ private function processFilters( $from = new \DateTime($filterData[$name]['from']); $to = new \DateTime($filterData[$name]['to']); $uiComponent->method('convertDatetime') - ->willReturnMap([ - [$filterData[$name]['from'], true, $from], - [$filterData[$name]['to'], true, $to], - ]); + ->willReturnMap( + [ + [$filterData[$name]['from'], true, $from], + [$filterData[$name]['to'], true, $to], + ] + ); } else { $from = new \DateTime($filterData[$name]['from']); $to = new \DateTime($filterData[$name]['to'] . ' 23:59:59'); $uiComponent->method('convertDate') - ->willReturnMap([ - [$filterData[$name]['from'], 0, 0, 0, true, $from], - [$filterData[$name]['to'], 23, 59, 59, true, $to], - ]); + ->willReturnMap( + [ + [$filterData[$name]['from'], 0, 0, 0, true, $from], + [$filterData[$name]['to'], 23, 59, 59, true, $to], + ] + ); } } diff --git a/app/code/Magento/Ui/Test/Unit/Component/FiltersTest.php b/app/code/Magento/Ui/Test/Unit/Component/FiltersTest.php index 19a1be69ca1d7..d4cf7f1af8d62 100644 --- a/app/code/Magento/Ui/Test/Unit/Component/FiltersTest.php +++ b/app/code/Magento/Ui/Test/Unit/Component/FiltersTest.php @@ -58,7 +58,7 @@ protected function setUp() /** * Test to Update filter component according to $component - * + * * @param string $filterType * @param string $filterName * @dataProvider updateDataProvider diff --git a/dev/tests/integration/testsuite/Magento/Eav/Model/Entity/AttributeTest.php b/dev/tests/integration/testsuite/Magento/Eav/Model/Entity/AttributeTest.php index 2750e2a768aab..5df08762e29a7 100644 --- a/dev/tests/integration/testsuite/Magento/Eav/Model/Entity/AttributeTest.php +++ b/dev/tests/integration/testsuite/Magento/Eav/Model/Entity/AttributeTest.php @@ -3,15 +3,20 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - declare(strict_types=1); namespace Magento\Eav\Model\Entity; -use Magento\TestFramework\Helper\Bootstrap; +use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Locale\ResolverInterface; +use Magento\Framework\ObjectManagerInterface; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; -class AttributeTest extends \PHPUnit\Framework\TestCase +/** + * Class to test EAV Entity attribute model + */ +class AttributeTest extends TestCase { /** * @var Attribute @@ -19,33 +24,33 @@ class AttributeTest extends \PHPUnit\Framework\TestCase private $attribute; /** - * @var \Magento\Framework\ObjectManagerInterface + * @var ObjectManagerInterface */ private $objectManager; /** * @var ResolverInterface */ - private $_localeResolver; + private $localeResolver; /** - * {@inheritdoc} + * @inheritdoc */ protected function setUp() { $this->objectManager = Bootstrap::getObjectManager(); $this->attribute = $this->objectManager->get(Attribute::class); - $this->_localeResolver = $this->objectManager->get(ResolverInterface::class); + $this->localeResolver = $this->objectManager->get(ResolverInterface::class); } /** - * {@inheritdoc} + * @inheritdoc */ protected function tearDown() { $this->attribute = null; $this->objectManager = null; - $this->_localeResolver = null; + $this->localeResolver = null; } /** @@ -56,11 +61,17 @@ protected function tearDown() * @dataProvider beforeSaveDataProvider * @throws */ - public function testBeforeSave($defaultValue, $backendType, $locale, $expected) - { + public function testBeforeSave( + string $defaultValue, + string $backendType, + string $frontendInput, + string $locale, + string $expected + ) { $this->attribute->setDefaultValue($defaultValue); $this->attribute->setBackendType($backendType); - $this->_localeResolver->setLocale($locale); + $this->attribute->setFrontendInput($frontendInput); + $this->localeResolver->setLocale($locale); $this->attribute->beforeSave(); $this->assertEquals($expected, $this->attribute->getDefaultValue()); @@ -74,13 +85,15 @@ public function testBeforeSave($defaultValue, $backendType, $locale, $expected) public function beforeSaveDataProvider() { return [ - ['21/07/18', 'datetime', 'en_AU', '2018-07-21 00:00:00'], - ['07/21/18', 'datetime', 'en_US', '2018-07-21 00:00:00'], - ['21/07/18', 'datetime', 'fr_FR', '2018-07-21 00:00:00'], - ['21/07/18', 'datetime', 'de_DE', '2018-07-21 00:00:00'], - ['21/07/18', 'datetime', 'uk_UA', '2018-07-21 00:00:00'], - ['100.50', 'decimal', 'en_US', '100.50'], - ['100,50', 'decimal', 'uk_UA', '100.5'], + ['21/07/18', 'datetime', 'date', 'en_AU', '2018-07-21 00:00:00'], + ['07/21/18', 'datetime', 'date', 'en_US', '2018-07-21 00:00:00'], + ['21/07/18', 'datetime', 'date', 'fr_FR', '2018-07-21 00:00:00'], + ['21/07/18', 'datetime', 'date', 'de_DE', '2018-07-21 00:00:00'], + ['21/07/18', 'datetime', 'date', 'uk_UA', '2018-07-21 00:00:00'], + ['100.50', 'decimal', 'decimal', 'en_US', '100.50'], + ['100,50', 'decimal', 'decimal', 'uk_UA', '100.5'], + ['07/21/2019 2:30 PM', 'datetime', 'datetime', 'en_US', '2019-07-21 21:30:00'], + ['21.07.2019 14:30', 'datetime', 'datetime', 'uk_UA', '2019-07-21 21:30:00'], ]; } @@ -90,13 +103,13 @@ public function beforeSaveDataProvider() * @param string $locale * @param string $expected * @dataProvider beforeSaveErrorDataDataProvider - * @expectedException \Magento\Framework\Exception\LocalizedException + * @expectedException LocalizedException */ public function testBeforeSaveErrorData($defaultValue, $backendType, $locale, $expected) { $this->attribute->setDefaultValue($defaultValue); $this->attribute->setBackendType($backendType); - $this->_localeResolver->setLocale($locale); + $this->localeResolver->setLocale($locale); $this->attribute->beforeSave(); $this->expectExceptionMessage($expected); From a8f3b9e8931d69a4bfa3af51483ed89b16292eea Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Fri, 27 Sep 2019 17:19:04 +0300 Subject: [PATCH 0039/1143] magento/magento2#22856: Catalog price rules are not working with custom options as expected. --- .../Product/View/Options/AbstractOptions.php | 30 ++++- .../Magento/Catalog/Model/Product/Option.php | 123 ++++++------------ .../Model/Product/Option/Type/DefaultType.php | 67 ++++++---- .../Model/Product/Option/Type/Select.php | 31 +++-- .../Catalog/Model/Product/Option/Value.php | 60 +++++++-- .../CalculateCustomOptionCatalogRule.php | 99 ++++++++++++++ .../Unit/Model/Product/Option/ValueTest.php | 32 +++-- app/code/Magento/CatalogRule/Model/Rule.php | 15 ++- .../Model/Product/BundlePriceAbstract.php | 21 ++- ...ndleWithCatalogPriceRuleCalculatorTest.php | 1 + .../Block/Product/View/OptionsTest.php | 70 ++++++++-- 11 files changed, 400 insertions(+), 149 deletions(-) create mode 100644 app/code/Magento/Catalog/Pricing/Price/CalculateCustomOptionCatalogRule.php diff --git a/app/code/Magento/Catalog/Block/Product/View/Options/AbstractOptions.php b/app/code/Magento/Catalog/Block/Product/View/Options/AbstractOptions.php index 030b6e1d2204c..0bfdcc678e9f7 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Options/AbstractOptions.php +++ b/app/code/Magento/Catalog/Block/Product/View/Options/AbstractOptions.php @@ -3,16 +3,14 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -/** - * Product options abstract type block - * - * @author Magento Core Team <core@magentocommerce.com> - */ +declare(strict_types=1); namespace Magento\Catalog\Block\Product\View\Options; +use Magento\Catalog\Pricing\Price\BasePrice; +use Magento\Catalog\Pricing\Price\CalculateCustomOptionCatalogRule; use Magento\Catalog\Pricing\Price\CustomOptionPriceInterface; +use Magento\Framework\App\ObjectManager; /** * Product options section abstract block. @@ -47,20 +45,29 @@ abstract class AbstractOptions extends \Magento\Framework\View\Element\Template */ protected $_catalogHelper; + /** + * @var CalculateCustomOptionCatalogRule + */ + private $calculateCustomOptionCatalogRule; + /** * @param \Magento\Framework\View\Element\Template\Context $context * @param \Magento\Framework\Pricing\Helper\Data $pricingHelper * @param \Magento\Catalog\Helper\Data $catalogData * @param array $data + * @param CalculateCustomOptionCatalogRule $calculateCustomOptionCatalogRule */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\Pricing\Helper\Data $pricingHelper, \Magento\Catalog\Helper\Data $catalogData, - array $data = [] + array $data = [], + CalculateCustomOptionCatalogRule $calculateCustomOptionCatalogRule = null ) { $this->pricingHelper = $pricingHelper; $this->_catalogHelper = $catalogData; + $this->calculateCustomOptionCatalogRule = $calculateCustomOptionCatalogRule + ?? ObjectManager::getInstance()->get(CalculateCustomOptionCatalogRule::class); parent::__construct($context, $data); } @@ -161,6 +168,15 @@ protected function _formatPrice($value, $flag = true) $priceStr = $sign; $customOptionPrice = $this->getProduct()->getPriceInfo()->getPrice('custom_option_price'); + + if (!$value['is_percent']) { + $value['pricing_value'] = $this->calculateCustomOptionCatalogRule->execute( + $this->getProduct(), + (float)$value['pricing_value'], + (bool)$value['is_percent'] + ); + } + $context = [CustomOptionPriceInterface::CONFIGURATION_OPTION_FLAG => true]; $optionAmount = $customOptionPrice->getCustomAmount($value['pricing_value'], null, $context); $priceStr .= $this->getLayout()->getBlock('product.price.render.default')->renderAmount( diff --git a/app/code/Magento/Catalog/Model/Product/Option.php b/app/code/Magento/Catalog/Model/Product/Option.php index 4f730834412e4..0170de5dc1ed4 100644 --- a/app/code/Magento/Catalog/Model/Product/Option.php +++ b/app/code/Magento/Catalog/Model/Product/Option.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Catalog\Model\Product; @@ -11,8 +12,10 @@ use Magento\Catalog\Api\Data\ProductCustomOptionValuesInterfaceFactory; use Magento\Catalog\Api\Data\ProductInterface; use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\Product\Option\Value; use Magento\Catalog\Model\ResourceModel\Product\Option\Value\Collection; -use Magento\Catalog\Pricing\Price\BasePrice; +use Magento\Catalog\Pricing\Price\CalculateCustomOptionCatalogRule; +use Magento\Framework\App\ObjectManager; use Magento\Framework\EntityManager\MetadataPool; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Model\AbstractExtensibleModel; @@ -108,6 +111,11 @@ class Option extends AbstractExtensibleModel implements ProductCustomOptionInter */ private $customOptionValuesFactory; + /** + * @var CalculateCustomOptionCatalogRule + */ + private $calculateCustomOptionCatalogRule; + /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry @@ -121,6 +129,7 @@ class Option extends AbstractExtensibleModel implements ProductCustomOptionInter * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection * @param array $data * @param ProductCustomOptionValuesInterfaceFactory|null $customOptionValuesFactory + * @param CalculateCustomOptionCatalogRule $calculateCustomOptionCatalogRule * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -135,14 +144,17 @@ public function __construct( \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, array $data = [], - ProductCustomOptionValuesInterfaceFactory $customOptionValuesFactory = null + ProductCustomOptionValuesInterfaceFactory $customOptionValuesFactory = null, + CalculateCustomOptionCatalogRule $calculateCustomOptionCatalogRule = null ) { $this->productOptionValue = $productOptionValue; $this->optionTypeFactory = $optionFactory; $this->validatorPool = $validatorPool; $this->string = $string; $this->customOptionValuesFactory = $customOptionValuesFactory ?: - \Magento\Framework\App\ObjectManager::getInstance()->get(ProductCustomOptionValuesInterfaceFactory::class); + ObjectManager::getInstance()->get(ProductCustomOptionValuesInterfaceFactory::class); + $this->calculateCustomOptionCatalogRule = $calculateCustomOptionCatalogRule ?? + ObjectManager::getInstance()->get(CalculateCustomOptionCatalogRule::class); parent::__construct( $context, @@ -156,10 +168,7 @@ public function __construct( } /** - * Get resource instance - * - * @return \Magento\Framework\Model\ResourceModel\Db\AbstractDb - * @deprecated 101.1.0 because resource models should be used directly + * @inheritdoc */ protected function _getResource() { @@ -439,10 +448,12 @@ public function afterSave() */ public function getPrice($flag = false) { - if ($flag && $this->getPriceType() == self::$typePercent) { - $basePrice = $this->getProduct()->getPriceInfo()->getPrice(BasePrice::PRICE_CODE)->getValue(); - $price = $basePrice * ($this->_getData(self::KEY_PRICE) / 100); - return $price; + if ($flag) { + return $this->calculateCustomOptionCatalogRule->execute( + $this->getProduct(), + (float)$this->getData(self::KEY_PRICE), + $this->getPriceType() === Value::TYPE_PERCENT + ); } return $this->_getData(self::KEY_PRICE); } @@ -536,9 +547,7 @@ public function getSearchableData($productId, $storeId) } /** - * Clearing object's data - * - * @return $this + * @inheritdoc */ protected function _clearData() { @@ -548,9 +557,7 @@ protected function _clearData() } /** - * Clearing cyclic references - * - * @return $this + * @inheritdoc */ protected function _clearReferences() { @@ -571,9 +578,7 @@ protected function _getValidationRulesBeforeSave() } /** - * Get product SKU - * - * @return string + * @inheritdoc */ public function getProductSku() { @@ -585,9 +590,7 @@ public function getProductSku() } /** - * Get option id - * - * @return int|null + * @inheritdoc * @codeCoverageIgnoreStart */ public function getOptionId() @@ -596,9 +599,7 @@ public function getOptionId() } /** - * Get option title - * - * @return string + * @inheritdoc */ public function getTitle() { @@ -606,9 +607,7 @@ public function getTitle() } /** - * Get option type - * - * @return string + * @inheritdoc */ public function getType() { @@ -616,9 +615,7 @@ public function getType() } /** - * Get sort order - * - * @return int + * @inheritdoc */ public function getSortOrder() { @@ -626,10 +623,7 @@ public function getSortOrder() } /** - * Get is require - * - * @return bool - * @SuppressWarnings(PHPMD.BooleanGetMethodName) + * @inheritdoc */ public function getIsRequire() { @@ -637,9 +631,7 @@ public function getIsRequire() } /** - * Get price type - * - * @return string|null + * @inheritdoc */ public function getPriceType() { @@ -647,9 +639,7 @@ public function getPriceType() } /** - * Get Sku - * - * @return string|null + * @inheritdoc */ public function getSku() { @@ -697,10 +687,7 @@ public function getImageSizeY() } /** - * Set product SKU - * - * @param string $productSku - * @return $this + * @inheritdoc */ public function setProductSku($productSku) { @@ -708,10 +695,7 @@ public function setProductSku($productSku) } /** - * Set option id - * - * @param int $optionId - * @return $this + * @inheritdoc */ public function setOptionId($optionId) { @@ -719,10 +703,7 @@ public function setOptionId($optionId) } /** - * Set option title - * - * @param string $title - * @return $this + * @inheritdoc */ public function setTitle($title) { @@ -730,10 +711,7 @@ public function setTitle($title) } /** - * Set option type - * - * @param string $type - * @return $this + * @inheritdoc */ public function setType($type) { @@ -741,10 +719,7 @@ public function setType($type) } /** - * Set sort order - * - * @param int $sortOrder - * @return $this + * @inheritdoc */ public function setSortOrder($sortOrder) { @@ -752,10 +727,7 @@ public function setSortOrder($sortOrder) } /** - * Set is require - * - * @param bool $isRequired - * @return $this + * @inheritdoc */ public function setIsRequire($isRequired) { @@ -763,10 +735,7 @@ public function setIsRequire($isRequired) } /** - * Set price - * - * @param float $price - * @return $this + * @inheritdoc */ public function setPrice($price) { @@ -774,10 +743,7 @@ public function setPrice($price) } /** - * Set price type - * - * @param string $priceType - * @return $this + * @inheritdoc */ public function setPriceType($priceType) { @@ -785,10 +751,7 @@ public function setPriceType($priceType) } /** - * Set Sku - * - * @param string $sku - * @return $this + * @inheritdoc */ public function setSku($sku) { @@ -929,7 +892,7 @@ public function setExtensionAttributes( private function getOptionRepository() { if (null === $this->optionRepository) { - $this->optionRepository = \Magento\Framework\App\ObjectManager::getInstance() + $this->optionRepository = ObjectManager::getInstance() ->get(\Magento\Catalog\Model\Product\Option\Repository::class); } return $this->optionRepository; @@ -943,7 +906,7 @@ private function getOptionRepository() private function getMetadataPool() { if (null === $this->metadataPool) { - $this->metadataPool = \Magento\Framework\App\ObjectManager::getInstance() + $this->metadataPool = ObjectManager::getInstance() ->get(\Magento\Framework\EntityManager\MetadataPool::class); } return $this->metadataPool; diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php b/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php index c388be8b6f394..be7f1921afccf 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php @@ -3,17 +3,26 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Catalog\Model\Product\Option\Type; -use Magento\Framework\Exception\LocalizedException; use Magento\Catalog\Api\Data\ProductCustomOptionInterface; +use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\Product\Configuration\Item\ItemInterface; +use Magento\Catalog\Model\Product\Configuration\Item\Option\OptionInterface; +use Magento\Catalog\Model\Product\Option; +use Magento\Catalog\Model\Product\Option\Value; +use Magento\Catalog\Pricing\Price\CalculateCustomOptionCatalogRule; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\Exception\LocalizedException; /** * Catalog product option default type * * @api * @author Magento Core Team <core@magentocommerce.com> + * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @since 100.0.2 */ @@ -22,14 +31,14 @@ class DefaultType extends \Magento\Framework\DataObject /** * Option Instance * - * @var \Magento\Catalog\Model\Product\Option + * @var Option */ protected $_option; /** * Product Instance * - * @var \Magento\Catalog\Model\Product + * @var Product */ protected $_product; @@ -54,27 +63,36 @@ class DefaultType extends \Magento\Framework\DataObject */ protected $_checkoutSession; + /** + * @var CalculateCustomOptionCatalogRule + */ + private $calculateCustomOptionCatalogRule; + /** * Construct * * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param array $data + * @param CalculateCustomOptionCatalogRule $calculateCustomOptionCatalogRule */ public function __construct( \Magento\Checkout\Model\Session $checkoutSession, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, - array $data = [] + array $data = [], + CalculateCustomOptionCatalogRule $calculateCustomOptionCatalogRule = null ) { $this->_checkoutSession = $checkoutSession; parent::__construct($data); $this->_scopeConfig = $scopeConfig; + $this->calculateCustomOptionCatalogRule = $calculateCustomOptionCatalogRule ?? ObjectManager::getInstance() + ->get(CalculateCustomOptionCatalogRule::class); } /** * Option Instance setter * - * @param \Magento\Catalog\Model\Product\Option $option + * @param Option $option * @return $this */ public function setOption($option) @@ -86,12 +104,12 @@ public function setOption($option) /** * Option Instance getter * + * @return Option * @throws \Magento\Framework\Exception\LocalizedException - * @return \Magento\Catalog\Model\Product\Option */ public function getOption() { - if ($this->_option instanceof \Magento\Catalog\Model\Product\Option) { + if ($this->_option instanceof Option) { return $this->_option; } throw new LocalizedException(__('The option instance type in options group is incorrect.')); @@ -100,7 +118,7 @@ public function getOption() /** * Product Instance setter * - * @param \Magento\Catalog\Model\Product $product + * @param Product $product * @return $this */ public function setProduct($product) @@ -112,12 +130,12 @@ public function setProduct($product) /** * Product Instance getter * + * @return Product * @throws \Magento\Framework\Exception\LocalizedException - * @return \Magento\Catalog\Model\Product */ public function getProduct() { - if ($this->_product instanceof \Magento\Catalog\Model\Product) { + if ($this->_product instanceof Product) { return $this->_product; } throw new LocalizedException(__('The product instance type in options group is incorrect.')); @@ -126,15 +144,12 @@ public function getProduct() /** * Getter for Configuration Item Option * - * @return \Magento\Catalog\Model\Product\Configuration\Item\Option\OptionInterface + * @return OptionInterface * @throws LocalizedException */ public function getConfigurationItemOption() { - if ($this->_getData( - 'configuration_item_option' - ) instanceof \Magento\Catalog\Model\Product\Configuration\Item\Option\OptionInterface - ) { + if ($this->_getData('configuration_item_option') instanceof OptionInterface) { return $this->_getData('configuration_item_option'); } @@ -149,14 +164,12 @@ public function getConfigurationItemOption() /** * Getter for Configuration Item * - * @return \Magento\Catalog\Model\Product\Configuration\Item\ItemInterface + * @return ItemInterface * @throws \Magento\Framework\Exception\LocalizedException */ public function getConfigurationItem() { - if ($this->_getData( - 'configuration_item' - ) instanceof \Magento\Catalog\Model\Product\Configuration\Item\ItemInterface + if ($this->_getData('configuration_item') instanceof ItemInterface ) { return $this->_getData('configuration_item'); } @@ -341,7 +354,11 @@ public function getOptionPrice($optionValue, $basePrice) { $option = $this->getOption(); - return $this->_getChargeableOptionPrice($option->getPrice(), $option->getPriceType() == 'percent', $basePrice); + return $this->calculateCustomOptionCatalogRule->execute( + $option->getProduct(), + (float)$option->getPrice(), + $option->getPriceType() === Value::TYPE_PERCENT + ); } /** @@ -368,14 +385,14 @@ public function getProductOptions() $options = $this->getProduct()->getOptions(); if ($options != null) { foreach ($options as $_option) { - /* @var $option \Magento\Catalog\Model\Product\Option */ + /* @var $option Option */ $this->_productOptions[$this->getProduct()->getId()][$_option->getTitle()] = [ 'option_id' => $_option->getId(), ]; if ($_option->getGroupByType() == ProductCustomOptionInterface::OPTION_GROUP_SELECT) { $optionValues = []; foreach ($_option->getValues() as $_value) { - /* @var $value \Magento\Catalog\Model\Product\Option\Value */ + /* @var $value Value */ $optionValues[$_value->getTitle()] = $_value->getId(); } $this->_productOptions[$this @@ -395,12 +412,14 @@ public function getProductOptions() } /** + * Return final chargeable price for option + * * @param float $price Price of option * @param boolean $isPercent Price type - percent or fixed * @param float $basePrice For percent price type * @return float * @deprecated 102.0.4 typo in method name - * @see _getChargeableOptionPrice + * @see CalculateCustomOptionCatalogRule::execute */ protected function _getChargableOptionPrice($price, $isPercent, $basePrice) { @@ -414,6 +433,8 @@ protected function _getChargableOptionPrice($price, $isPercent, $basePrice) * @param boolean $isPercent Price type - percent or fixed * @param float $basePrice For percent price type * @return float + * @deprecated + * @see CalculateCustomOptionCatalogRule::execute */ protected function _getChargeableOptionPrice($price, $isPercent, $basePrice) { diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php b/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php index d2766b1bbb054..8eebd3e91c2ee 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php @@ -3,9 +3,13 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Catalog\Model\Product\Option\Type; +use Magento\Catalog\Model\Product\Option\Value; +use Magento\Catalog\Pricing\Price\CalculateCustomOptionCatalogRule; +use Magento\Framework\App\ObjectManager; use Magento\Framework\Exception\LocalizedException; /** @@ -37,6 +41,11 @@ class Select extends \Magento\Catalog\Model\Product\Option\Type\DefaultType */ private $singleSelectionTypes; + /** + * @var CalculateCustomOptionCatalogRule + */ + private $calculateCustomOptionCatalogRule; + /** * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig @@ -44,6 +53,7 @@ class Select extends \Magento\Catalog\Model\Product\Option\Type\DefaultType * @param \Magento\Framework\Escaper $escaper * @param array $data * @param array $singleSelectionTypes + * @param CalculateCustomOptionCatalogRule $calculateCustomOptionCatalogRule */ public function __construct( \Magento\Checkout\Model\Session $checkoutSession, @@ -51,7 +61,8 @@ public function __construct( \Magento\Framework\Stdlib\StringUtils $string, \Magento\Framework\Escaper $escaper, array $data = [], - array $singleSelectionTypes = [] + array $singleSelectionTypes = [], + CalculateCustomOptionCatalogRule $calculateCustomOptionCatalogRule = null ) { $this->string = $string; $this->_escaper = $escaper; @@ -61,6 +72,8 @@ public function __construct( 'drop_down' => \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DROP_DOWN, 'radio' => \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_RADIO, ]; + $this->calculateCustomOptionCatalogRule = $calculateCustomOptionCatalogRule ?? ObjectManager::getInstance() + ->get(CalculateCustomOptionCatalogRule::class); } /** @@ -248,10 +261,10 @@ public function getOptionPrice($optionValue, $basePrice) foreach (explode(',', $optionValue) as $value) { $_result = $option->getValueById($value); if ($_result) { - $result += $this->_getChargeableOptionPrice( - $_result->getPrice(), - $_result->getPriceType() == 'percent', - $basePrice + $result += $this->calculateCustomOptionCatalogRule->execute( + $option->getProduct(), + (float)$_result->getPrice(), + $_result->getPriceType() === Value::TYPE_PERCENT ); } else { if ($this->getListener()) { @@ -263,10 +276,10 @@ public function getOptionPrice($optionValue, $basePrice) } elseif ($this->_isSingleSelection()) { $_result = $option->getValueById($optionValue); if ($_result) { - $result = $this->_getChargeableOptionPrice( - $_result->getPrice(), - $_result->getPriceType() == 'percent', - $basePrice + $result = $this->calculateCustomOptionCatalogRule->execute( + $option->getProduct(), + (float)$_result->getPrice(), + $_result->getPriceType() === Value::TYPE_PERCENT ); } else { if ($this->getListener()) { diff --git a/app/code/Magento/Catalog/Model/Product/Option/Value.php b/app/code/Magento/Catalog/Model/Product/Option/Value.php index ebbc060c99edf..fce39614248ca 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Value.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Value.php @@ -3,13 +3,16 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Catalog\Model\Product\Option; use Magento\Catalog\Model\Product; use Magento\Catalog\Model\Product\Option; -use Magento\Framework\Model\AbstractModel; use Magento\Catalog\Pricing\Price\BasePrice; +use Magento\Catalog\Pricing\Price\CalculateCustomOptionCatalogRule; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\Model\AbstractModel; use Magento\Catalog\Pricing\Price\CustomOptionPriceCalculator; use Magento\Catalog\Pricing\Price\RegularPrice; @@ -69,6 +72,11 @@ class Value extends AbstractModel implements \Magento\Catalog\Api\Data\ProductCu */ private $customOptionPriceCalculator; + /** + * @var CalculateCustomOptionCatalogRule + */ + private $calculateCustomOptionCatalogRule; + /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry @@ -77,6 +85,7 @@ class Value extends AbstractModel implements \Magento\Catalog\Api\Data\ProductCu * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection * @param array $data * @param CustomOptionPriceCalculator|null $customOptionPriceCalculator + * @param CalculateCustomOptionCatalogRule|null $CalculateCustomOptionCatalogRule */ public function __construct( \Magento\Framework\Model\Context $context, @@ -85,11 +94,14 @@ public function __construct( \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, array $data = [], - CustomOptionPriceCalculator $customOptionPriceCalculator = null + CustomOptionPriceCalculator $customOptionPriceCalculator = null, + CalculateCustomOptionCatalogRule $CalculateCustomOptionCatalogRule = null ) { $this->_valueCollectionFactory = $valueCollectionFactory; $this->customOptionPriceCalculator = $customOptionPriceCalculator - ?? \Magento\Framework\App\ObjectManager::getInstance()->get(CustomOptionPriceCalculator::class); + ?? ObjectManager::getInstance()->get(CustomOptionPriceCalculator::class); + $this->calculateCustomOptionCatalogRule = $CalculateCustomOptionCatalogRule + ?? ObjectManager::getInstance()->get(CalculateCustomOptionCatalogRule::class); parent::__construct( $context, @@ -101,7 +113,7 @@ public function __construct( } /** - * @return void + * @inheritDoc */ protected function _construct() { @@ -109,6 +121,8 @@ protected function _construct() } /** + * Add value. + * * @codeCoverageIgnoreStart * @param mixed $value * @return $this @@ -120,6 +134,8 @@ public function addValue($value) } /** + * Get values. + * * @return array */ public function getValues() @@ -128,6 +144,8 @@ public function getValues() } /** + * Set values. + * * @param array $values * @return $this */ @@ -138,6 +156,8 @@ public function setValues($values) } /** + * Unset values. + * * @return $this */ public function unsetValues() @@ -147,6 +167,8 @@ public function unsetValues() } /** + * Set option. + * * @param Option $option * @return $this */ @@ -157,6 +179,8 @@ public function setOption(Option $option) } /** + * Unset option. + * * @return $this */ public function unsetOption() @@ -166,7 +190,7 @@ public function unsetOption() } /** - * Enter description here... + * Get option. * * @return Option */ @@ -176,6 +200,8 @@ public function getOption() } /** + * Set product. + * * @param Product $product * @return $this */ @@ -188,6 +214,8 @@ public function setProduct($product) //@codeCoverageIgnoreEnd /** + * Get product. + * * @return Product */ public function getProduct() @@ -199,7 +227,10 @@ public function getProduct() } /** + * Save values. + * * @return $this + * @throws \Exception */ public function saveValues() { @@ -225,8 +256,9 @@ public function saveValues() } /** - * Return price. If $flag is true and price is percent - * return converted percent to price + * Return price. + * + * If $flag is true and price is percent return converted percent to price * * @param bool $flag * @return float|int @@ -234,7 +266,11 @@ public function saveValues() public function getPrice($flag = false) { if ($flag) { - return $this->customOptionPriceCalculator->getOptionPriceByPriceCode($this, BasePrice::PRICE_CODE); + return $this->calculateCustomOptionCatalogRule->execute( + $this->getProduct(), + (float)$this->getData(self::KEY_PRICE), + $this->getPriceType() === self::TYPE_PERCENT + ); } return $this->_getData(self::KEY_PRICE); } @@ -250,7 +286,7 @@ public function getRegularPrice() } /** - * Enter description here... + * Get values collection. * * @param Option $option * @return \Magento\Catalog\Model\ResourceModel\Product\Option\Value\Collection @@ -268,6 +304,8 @@ public function getValuesCollection(Option $option) } /** + * Get values by option. + * * @param array $optionIds * @param int $option_id * @param int $store_id @@ -287,6 +325,8 @@ public function getValuesByOption($optionIds, $option_id, $store_id) } /** + * Delete value. + * * @param int $option_id * @return $this */ @@ -297,6 +337,8 @@ public function deleteValue($option_id) } /** + * Delete values. + * * @param int $option_type_id * @return $this */ diff --git a/app/code/Magento/Catalog/Pricing/Price/CalculateCustomOptionCatalogRule.php b/app/code/Magento/Catalog/Pricing/Price/CalculateCustomOptionCatalogRule.php new file mode 100644 index 0000000000000..91ff8f921566c --- /dev/null +++ b/app/code/Magento/Catalog/Pricing/Price/CalculateCustomOptionCatalogRule.php @@ -0,0 +1,99 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Pricing\Price; + +use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\Product\PriceModifierInterface; +use Magento\CatalogRule\Pricing\Price\CatalogRulePrice; +use Magento\Framework\Pricing\Price\BasePriceProviderInterface; +use Magento\Framework\Pricing\PriceCurrencyInterface; + +/** + * Calculates prices of custom options of the product with catalog rules applied. + */ +class CalculateCustomOptionCatalogRule +{ + /** + * @var PriceCurrencyInterface + */ + private $priceCurrency; + + /** + * @var PriceModifierInterface + */ + private $priceModifier; + + /** + * @param PriceCurrencyInterface $priceCurrency + * @param PriceModifierInterface $priceModifier + */ + public function __construct( + PriceCurrencyInterface $priceCurrency, + PriceModifierInterface $priceModifier + ) { + $this->priceModifier = $priceModifier; + $this->priceCurrency = $priceCurrency; + } + + /** + * Calculate prices of custom options of the product with catalog rules applied. + * + * @param Product $product + * @param float $optionPriceValue + * @param bool $isPercent + * @return float + */ + public function execute( + Product $product, + float $optionPriceValue, + bool $isPercent + ): float { + $basePrice = $this->getGetBasePriceWithOutCatalogRules($product); + if ($isPercent) { + $optionPrice = $basePrice * $optionPriceValue / 100; + } else { + $optionPrice = $optionPriceValue; + } + + $totalPriceModified = $this->priceModifier->modifyPrice( + $basePrice + $optionPrice, + $product + ); + $basePriceModified = $this->priceModifier->modifyPrice( + $basePrice, + $product + ); + $price = $totalPriceModified - $basePriceModified; + + return $this->priceCurrency->convertAndRound($price); + } + + /** + * Get product base price without catalog rules applied. + * + * @param Product $product + * @return float + */ + private function getGetBasePriceWithOutCatalogRules(Product $product): float + { + $basePrice = null; + foreach ($product->getPriceInfo()->getPrices() as $price) { + if ($price instanceof BasePriceProviderInterface + && $price->getPriceCode() !== CatalogRulePrice::PRICE_CODE + && $price->getValue() !== false + ) { + $basePrice = min( + $price->getValue(), + $basePrice ?? $price->getValue() + ); + } + } + + return $basePrice ?? $product->getPrice(); + } +} diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Option/ValueTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Option/ValueTest.php index 1ff5bef78cd79..212c8020750d2 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/Option/ValueTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Option/ValueTest.php @@ -3,15 +3,21 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Catalog\Test\Unit\Model\Product\Option; +declare(strict_types=1); -use \Magento\Catalog\Model\Product\Option\Value; +namespace Magento\Catalog\Test\Unit\Model\Product\Option; use Magento\Catalog\Model\Product; + use Magento\Catalog\Model\Product\Option; -use Magento\Framework\Model\ActionValidator\RemoveAction; +use Magento\Catalog\Model\Product\Option\Value; +use Magento\Catalog\Pricing\Price\CalculateCustomOptionCatalogRule; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use PHPUnit\Framework\MockObject\MockObject; +/** + * Test for \Magento\Catalog\Model\Product\Option\Value class. + */ class ValueTest extends \PHPUnit\Framework\TestCase { /** @@ -24,6 +30,11 @@ class ValueTest extends \PHPUnit\Framework\TestCase */ private $customOptionPriceCalculatorMock; + /** + * @var CalculateCustomOptionCatalogRule|MockObject + */ + private $CalculateCustomOptionCatalogRule; + protected function setUp() { $mockedResource = $this->getMockedResource(); @@ -33,6 +44,10 @@ protected function setUp() \Magento\Catalog\Pricing\Price\CustomOptionPriceCalculator::class ); + $this->CalculateCustomOptionCatalogRule = $this->createMock( + CalculateCustomOptionCatalogRule::class + ); + $helper = new ObjectManager($this); $this->model = $helper->getObject( \Magento\Catalog\Model\Product\Option\Value::class, @@ -40,6 +55,7 @@ protected function setUp() 'resource' => $mockedResource, 'valueCollectionFactory' => $mockedCollectionFactory, 'customOptionPriceCalculator' => $this->customOptionPriceCalculatorMock, + 'CalculateCustomOptionCatalogRule' => $this->CalculateCustomOptionCatalogRule ] ); $this->model->setOption($this->getMockedOption()); @@ -66,11 +82,11 @@ public function testGetPrice() $this->model->setPriceType(Value::TYPE_PERCENT); $this->assertEquals($price, $this->model->getPrice(false)); - $percentPice = 100; - $this->customOptionPriceCalculatorMock->expects($this->atLeastOnce()) - ->method('getOptionPriceByPriceCode') - ->willReturn($percentPice); - $this->assertEquals($percentPice, $this->model->getPrice(true)); + $percentPrice = 100; + $this->CalculateCustomOptionCatalogRule->expects($this->atLeastOnce()) + ->method('execute') + ->willReturn($percentPrice); + $this->assertEquals($percentPrice, $this->model->getPrice(true)); } public function testGetValuesCollection() diff --git a/app/code/Magento/CatalogRule/Model/Rule.php b/app/code/Magento/CatalogRule/Model/Rule.php index f2e8e54d34665..cd24201963f25 100644 --- a/app/code/Magento/CatalogRule/Model/Rule.php +++ b/app/code/Magento/CatalogRule/Model/Rule.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\CatalogRule\Model; use Magento\Catalog\Model\Product; @@ -13,6 +15,7 @@ use Magento\CatalogRule\Helper\Data; use Magento\CatalogRule\Model\Data\Condition\Converter; use Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor; +use Magento\CatalogRule\Model\ResourceModel\Product\ConditionsToCollectionApplier; use Magento\CatalogRule\Model\ResourceModel\Rule as RuleResourceModel; use Magento\CatalogRule\Model\Rule\Action\CollectionFactory as RuleCollectionFactory; use Magento\CatalogRule\Model\Rule\Condition\CombineFactory; @@ -33,7 +36,6 @@ use Magento\Framework\Stdlib\DateTime; use Magento\Framework\Stdlib\DateTime\TimezoneInterface; use Magento\Store\Model\StoreManagerInterface; -use Magento\CatalogRule\Model\ResourceModel\Product\ConditionsToCollectionApplier; /** * Catalog Rule data model @@ -499,7 +501,8 @@ public function calcProductPriceRule(Product $product, $price) } else { $customerGroupId = $this->_customerSession->getCustomerGroupId(); } - $dateTs = $this->_localeDate->scopeTimeStamp($storeId); + $currentDateTime = new \DateTime(); + $dateTs = $currentDateTime->getTimestamp(); $cacheKey = date('Y-m-d', $dateTs) . "|{$websiteId}|{$customerGroupId}|{$productId}|{$price}"; if (!array_key_exists($cacheKey, self::$_priceRulesData)) { @@ -895,4 +898,12 @@ public function getIdentities() { return ['price']; } + + /** + * Clear price rules cache. + */ + public function clearPriceRulesData(): void + { + self::$_priceRulesData = []; + } } diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/BundlePriceAbstract.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/BundlePriceAbstract.php index e30916810b1e0..2a7b80e62797d 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/BundlePriceAbstract.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/BundlePriceAbstract.php @@ -3,11 +3,13 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Bundle\Model\Product; /** * Abstract class for testing bundle prices + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ abstract class BundlePriceAbstract extends \PHPUnit\Framework\TestCase @@ -29,6 +31,14 @@ abstract class BundlePriceAbstract extends \PHPUnit\Framework\TestCase */ protected $productCollectionFactory; + /** + * @var \Magento\CatalogRule\Model\RuleFactory + */ + private $ruleFactory; + + /** + * @inheritdoc + */ protected function setUp() { $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); @@ -42,15 +52,19 @@ protected function setUp() true, \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); + $this->ruleFactory = $this->objectManager->get(\Magento\CatalogRule\Model\RuleFactory::class); } /** - * Get test cases + * Get test cases. + * * @return array */ abstract public function getTestCases(); /** + * Prepare fixture. + * * @param array $strategyModifiers * @param string $productSku * @return void @@ -61,11 +75,14 @@ abstract public function getTestCases(); */ protected function prepareFixture($strategyModifiers, $productSku) { + $this->ruleFactory->create()->clearPriceRulesData(); + $bundleProduct = $this->productRepository->get($productSku); foreach ($strategyModifiers as $modifier) { if (method_exists($this, $modifier['modifierName'])) { array_unshift($modifier['data'], $bundleProduct); + // phpcs:ignore Magento2.Functions.DiscouragedFunction $bundleProduct = call_user_func_array([$this, $modifier['modifierName']], $modifier['data']); } else { throw new \Magento\Framework\Exception\InputException( @@ -113,6 +130,8 @@ protected function addSimpleProduct(\Magento\Catalog\Model\Product $bundleProduc } /** + * Add custom option. + * * @param \Magento\Catalog\Model\Product $bundleProduct * @param array $optionsData * @return \Magento\Catalog\Model\Product diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithCatalogPriceRuleCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithCatalogPriceRuleCalculatorTest.php index b3c46c75bcfb7..2b0e8c75a15e0 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithCatalogPriceRuleCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithCatalogPriceRuleCalculatorTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Bundle\Model\Product; diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/OptionsTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/OptionsTest.php index 152ad6a6286f4..8997920ac1e3a 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/OptionsTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/OptionsTest.php @@ -3,8 +3,12 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Catalog\Block\Product\View; +use Magento\CatalogRule\Model\Indexer\IndexBuilder; + /** * Test class for \Magento\Catalog\Block\Product\View\Options. */ @@ -30,12 +34,19 @@ class OptionsTest extends \PHPUnit\Framework\TestCase */ protected $productRepository; + /** + * @var IndexBuilder + */ + private $indexBuilder; + protected function setUp() { $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $this->productRepository = $this->objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); + $this->indexBuilder = $this->objectManager->create(IndexBuilder::class); + try { $this->product = $this->productRepository->get('simple'); } catch (\Magento\Framework\Exception\NoSuchEntityException $e) { @@ -113,24 +124,63 @@ private function getExpectedJsonConfig() { return [ 0 => [ - 'prices' => - ['oldPrice' => - ['amount' => 10, 'adjustments' => []], + 'prices' => ['oldPrice' => ['amount' => 10, 'adjustments' => []], 'basePrice' => ['amount' => 10], 'finalPrice' => ['amount' => 10] ], - 'type' => 'fixed', - 'name' => 'drop_down option 1', + 'type' => 'fixed', + 'name' => 'drop_down option 1', ], 1 => [ - 'prices' => - ['oldPrice' => - ['amount' => 40, 'adjustments' => []], + 'prices' => ['oldPrice' => ['amount' => 40, 'adjustments' => []], 'basePrice' => ['amount' => 40], 'finalPrice' => ['amount' => 40], ], - 'type' => 'percent', - 'name' => 'drop_down option 2', + 'type' => 'percent', + 'name' => 'drop_down option 2', + ], + ]; + } + + /** + * Test option prices with catalog price rules applied. + * + * @magentoDbIsolation disabled + * @magentoDataFixture Magento/CatalogRule/_files/two_rules.php + * @magentoDataFixture Magento/Catalog/_files/product_with_dropdown_option.php + */ + public function testGetJsonConfigWithCatalogRules() + { + $this->indexBuilder->reindexFull(); + + $config = json_decode($this->block->getJsonConfig(), true); + $configValues = array_values($config); + $this->assertEquals($this->getExpectedJsonConfigWithCatalogRules(), array_values($configValues[0])); + } + + /** + * Expected data for testGetJsonConfigWithCatalogRules + * + * @return array + */ + private function getExpectedJsonConfigWithCatalogRules() + { + return [ + 0 => [ + 'prices' => ['oldPrice' => ['amount' => 10, 'adjustments' => []], + 'basePrice' => ['amount' => 9.5], + 'finalPrice' => ['amount' => 9.5], + ], + 'type' => 'fixed', + 'name' => 'drop_down option 1', + ], + 1 => [ + 'prices' => ['oldPrice' => ['amount' => 40, 'adjustments' => []], + 'basePrice' => ['amount' => 38], + 'finalPrice' => ['amount' => 38], + ], + 'type' => 'percent', + 'name' => 'drop_down option 2', ], ]; } From 3bb11bb745298a44ade08ea94cdbf44e35adb35b Mon Sep 17 00:00:00 2001 From: Daniel Ruf <d.ruf@bitexpert.de> Date: Fri, 4 Oct 2019 10:12:18 +0200 Subject: [PATCH 0040/1143] Simplify some conditional checks --- .../Model/OperationProcessor.php | 4 +--- .../Magento/Indexer/Test/Unit/Model/IndexerTest.php | 10 +--------- .../Ui/view/base/web/js/lib/validation/rules.js | 2 +- lib/web/mage/validation.js | 2 +- 4 files changed, 4 insertions(+), 14 deletions(-) diff --git a/app/code/Magento/AsynchronousOperations/Model/OperationProcessor.php b/app/code/Magento/AsynchronousOperations/Model/OperationProcessor.php index 6826c34fd35f0..a617a943db9f9 100644 --- a/app/code/Magento/AsynchronousOperations/Model/OperationProcessor.php +++ b/app/code/Magento/AsynchronousOperations/Model/OperationProcessor.php @@ -206,9 +206,7 @@ private function executeHandler($callback, $entityParams) } } catch (NoSuchEntityException $e) { $this->logger->error($e->getMessage()); - $result['status'] = ($e instanceof TemporaryStateExceptionInterface) ? - OperationInterface::STATUS_TYPE_NOT_RETRIABLY_FAILED : - OperationInterface::STATUS_TYPE_NOT_RETRIABLY_FAILED; + $result['status'] = OperationInterface::STATUS_TYPE_NOT_RETRIABLY_FAILED; $result['error_code'] = $e->getCode(); $result['messages'][] = $e->getMessage(); } catch (LocalizedException $e) { diff --git a/app/code/Magento/Indexer/Test/Unit/Model/IndexerTest.php b/app/code/Magento/Indexer/Test/Unit/Model/IndexerTest.php index 6b7cc12218990..3edba23897a35 100644 --- a/app/code/Magento/Indexer/Test/Unit/Model/IndexerTest.php +++ b/app/code/Magento/Indexer/Test/Unit/Model/IndexerTest.php @@ -154,15 +154,7 @@ public function testGetLatestUpdated($getViewIsEnabled, $getViewGetUpdated, $get $this->stateFactoryMock->expects($this->once())->method('create')->will($this->returnValue($stateMock)); if ($getViewIsEnabled && $getViewGetUpdated) { - if (!$getStateGetUpdated) { - $this->assertEquals($getViewGetUpdated, $this->model->getLatestUpdated()); - } else { - if ($getViewGetUpdated == $getStateGetUpdated) { - $this->assertEquals($getViewGetUpdated, $this->model->getLatestUpdated()); - } else { - $this->assertEquals($getViewGetUpdated, $this->model->getLatestUpdated()); - } - } + $this->assertEquals($getViewGetUpdated, $this->model->getLatestUpdated()); } else { $this->assertEquals($getStateGetUpdated, $this->model->getLatestUpdated()); } diff --git a/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js b/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js index d765f842a0895..b558ca2c28079 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js @@ -822,7 +822,7 @@ define([ ], 'validate-state': [ function (value) { - return value !== 0 || value === ''; + return value !== 0; }, $.mage.__('Please select State/Province.') ], diff --git a/lib/web/mage/validation.js b/lib/web/mage/validation.js index dfa35473176b9..e4ace239cf1b5 100644 --- a/lib/web/mage/validation.js +++ b/lib/web/mage/validation.js @@ -1122,7 +1122,7 @@ ], 'validate-state': [ function (v) { - return v !== 0 || v === ''; + return v !== 0; }, $.mage.__('Please select State/Province.') ], From b6d071f9b57a784206730e1f3612fd13ffdabf4b Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Mon, 7 Oct 2019 16:26:34 +0300 Subject: [PATCH 0041/1143] MC-5233: DateTime product attributes support --- .../Block/Adminhtml/Product/Attribute/Edit/Tab/Main.php | 2 +- app/code/Magento/Catalog/Ui/Component/ColumnFactory.php | 6 +++--- .../Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php | 2 +- .../Eav/Model/Entity/Attribute/Frontend/Datetime.php | 4 ++-- .../Magento/Ui/Component/Form/Element/DataType/Date.php | 8 ++++---- app/code/Magento/Ui/view/base/web/js/grid/columns/date.js | 4 ++-- .../testsuite/Magento/Eav/Model/Entity/AttributeTest.php | 3 +-- 7 files changed, 14 insertions(+), 15 deletions(-) diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Main.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Main.php index ddc7273432cb3..955ea259ec9a8 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Main.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Main.php @@ -113,7 +113,7 @@ private function removeUnusedFields(): void $fieldsToRemove = ['attribute_code', 'is_unique', 'frontend_class']; foreach ($fieldset->getElements() as $element) { /** @var AbstractElement $element */ - if (substr($element->getId(), 0, strlen('default_value')) == 'default_value') { + if (substr($element->getId(), 0, strlen('default_value')) === 'default_value') { $fieldsToRemove[] = $element->getId(); } } diff --git a/app/code/Magento/Catalog/Ui/Component/ColumnFactory.php b/app/code/Magento/Catalog/Ui/Component/ColumnFactory.php index c538273476b1f..bbcd9bbc9f03a 100644 --- a/app/code/Magento/Catalog/Ui/Component/ColumnFactory.php +++ b/app/code/Magento/Catalog/Ui/Component/ColumnFactory.php @@ -131,14 +131,14 @@ private function getDateConfig(ProductAttributeInterface $attribute): array $dateFormat = $isDatetime ? $this->timezone->getDateTimeFormat(\IntlDateFormatter::MEDIUM) : $this->timezone->getDateFormat(\IntlDateFormatter::MEDIUM); - $timeZone = $isDatetime + $timezone = $isDatetime ? $this->timezone->getConfigTimezone() : $this->timezone->getDefaultTimezone(); return [ - 'timeZone' => $timeZone, + 'timezone' => $timezone, 'dateFormat' => $dateFormat, - 'options' => [ 'showsTime' => $isDatetime], + 'options' => ['showsTime' => $isDatetime], ]; } 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 e41b2390930f0..0c76feb2c94ec 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php @@ -957,7 +957,7 @@ private function customizeWysiwyg(ProductAttributeInterface $attribute, array $m * @param array $meta * @return array */ - private function customizeDatetimeAttribute(array $meta) + private function customizeDatetimeAttribute(array $meta): array { $meta['arguments']['data']['config']['options']['showsTime'] = 1; diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/Datetime.php b/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/Datetime.php index 8effd73d34af2..ea454fc0bcc74 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/Datetime.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/Datetime.php @@ -44,12 +44,12 @@ public function getValue(\Magento\Framework\DataObject $object) $value = parent::getValue($object); if ($value) { - $timeType = $this->getAttribute()->getFrontendInput() === 'datetime' + $showTime = $this->getAttribute()->getFrontendInput() === 'datetime' ? \IntlDateFormatter::MEDIUM : \IntlDateFormatter::NONE; $data = $this->_localeDate->formatDateTime( new \DateTime($value), \IntlDateFormatter::MEDIUM, - $timeType + $showTime ); } diff --git a/app/code/Magento/Ui/Component/Form/Element/DataType/Date.php b/app/code/Magento/Ui/Component/Form/Element/DataType/Date.php index 8ea6236e8e2e2..6bf1eacd161cc 100644 --- a/app/code/Magento/Ui/Component/Form/Element/DataType/Date.php +++ b/app/code/Magento/Ui/Component/Form/Element/DataType/Date.php @@ -127,20 +127,20 @@ public function convertDate($date, $hour = 0, $minute = 0, $second = 0, $setUtcT * Convert given date to default (UTC) timezone * * @param string $date - * @param bool $setUtcTimeZone + * @param bool $setUtcTimezone * @return \DateTime|null */ - public function convertDatetime(string $date, bool $setUtcTimeZone = true): ?\DateTime + public function convertDatetime(string $date, bool $setUtcTimezone = true): ?\DateTime { try { $date = rtrim($date, 'Z'); $dateObj = new \DateTime($date, new \DateTimeZone($this->localeDate->getConfigTimezone())); //convert store date to default date in UTC timezone without DST - if ($setUtcTimeZone) { + if ($setUtcTimezone) { $dateObj->setTimezone(new \DateTimeZone('UTC')); } return $dateObj; - } catch (\Exception $e) { + } catch (\Throwable $e) { return null; } } diff --git a/app/code/Magento/Ui/view/base/web/js/grid/columns/date.js b/app/code/Magento/Ui/view/base/web/js/grid/columns/date.js index cc69d990372c1..3179529e282c6 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/columns/date.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/columns/date.js @@ -46,8 +46,8 @@ define([ moment.locale(this.storeLocale, utils.extend({}, this.calendarConfig)); } - if (!_.isUndefined(this.timeZone)) { - date = date.tz(this.timeZone); + if (!_.isUndefined(this.timezone)) { + date = date.tz(this.timezone); } date = date.isValid() && value[this.index] ? diff --git a/dev/tests/integration/testsuite/Magento/Eav/Model/Entity/AttributeTest.php b/dev/tests/integration/testsuite/Magento/Eav/Model/Entity/AttributeTest.php index 5df08762e29a7..5b05308c786b5 100644 --- a/dev/tests/integration/testsuite/Magento/Eav/Model/Entity/AttributeTest.php +++ b/dev/tests/integration/testsuite/Magento/Eav/Model/Entity/AttributeTest.php @@ -7,7 +7,6 @@ namespace Magento\Eav\Model\Entity; -use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Locale\ResolverInterface; use Magento\Framework\ObjectManagerInterface; use Magento\TestFramework\Helper\Bootstrap; @@ -103,7 +102,7 @@ public function beforeSaveDataProvider() * @param string $locale * @param string $expected * @dataProvider beforeSaveErrorDataDataProvider - * @expectedException LocalizedException + * @expectedException \Magento\Framework\Exception\LocalizedException */ public function testBeforeSaveErrorData($defaultValue, $backendType, $locale, $expected) { From 9c9f9fcc5bed3b5df1ef81df4c8ff3333a826bb1 Mon Sep 17 00:00:00 2001 From: Daniel Ruf <d.ruf@bitexpert.de> Date: Tue, 8 Oct 2019 09:55:29 +0200 Subject: [PATCH 0042/1143] Fix parameter order --- .../Magento/AsynchronousOperations/Model/OperationProcessor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/AsynchronousOperations/Model/OperationProcessor.php b/app/code/Magento/AsynchronousOperations/Model/OperationProcessor.php index a617a943db9f9..5f644fa03ae27 100644 --- a/app/code/Magento/AsynchronousOperations/Model/OperationProcessor.php +++ b/app/code/Magento/AsynchronousOperations/Model/OperationProcessor.php @@ -80,9 +80,9 @@ class OperationProcessor * @param ConsumerConfigurationInterface $configuration * @param Json $jsonHelper * @param OperationManagementInterface $operationManagement - * @param LoggerInterface $logger * @param \Magento\Framework\Webapi\ServiceOutputProcessor $serviceOutputProcessor * @param \Magento\Framework\Communication\ConfigInterface $communicationConfig + * @param LoggerInterface $logger */ public function __construct( MessageValidator $messageValidator, From 7c55ae5bb6322225b97cdc5c61884e75cb6575b8 Mon Sep 17 00:00:00 2001 From: Daniel Ruf <d.ruf@bitexpert.de> Date: Tue, 8 Oct 2019 10:11:54 +0200 Subject: [PATCH 0043/1143] Add missing types --- .../AsynchronousOperations/Model/OperationProcessor.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/AsynchronousOperations/Model/OperationProcessor.php b/app/code/Magento/AsynchronousOperations/Model/OperationProcessor.php index 5f644fa03ae27..ded507958d8a3 100644 --- a/app/code/Magento/AsynchronousOperations/Model/OperationProcessor.php +++ b/app/code/Magento/AsynchronousOperations/Model/OperationProcessor.php @@ -174,8 +174,8 @@ public function process(string $encodedMessage) /** * Execute topic handler * - * @param $callback - * @param $entityParams + * @param callable $callback + * @param array $entityParams * @return array */ private function executeHandler($callback, $entityParams) From 6e5e27fbd66f06423dd53ac9c7b2d8bc645227ba Mon Sep 17 00:00:00 2001 From: Daniel Ruf <d.ruf@bitexpert.de> Date: Tue, 8 Oct 2019 11:20:58 +0200 Subject: [PATCH 0044/1143] Refactor array_merge in loop and call_user_func_array --- .../AsynchronousOperations/Model/OperationProcessor.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/AsynchronousOperations/Model/OperationProcessor.php b/app/code/Magento/AsynchronousOperations/Model/OperationProcessor.php index ded507958d8a3..5e7cb6b7a0916 100644 --- a/app/code/Magento/AsynchronousOperations/Model/OperationProcessor.php +++ b/app/code/Magento/AsynchronousOperations/Model/OperationProcessor.php @@ -133,13 +133,15 @@ public function process(string $encodedMessage) $outputData = null; if ($errorCode === null) { + $handlerMessages = []; foreach ($handlers as $callback) { $result = $this->executeHandler($callback, $entityParams); $status = $result['status']; $errorCode = $result['error_code']; - $messages = array_merge($messages, $result['messages']); + $handlerMessages[] = $result['messages']; $outputData = $result['output_data']; } + $messages = array_merge($messages, ...$handlerMessages); } if (isset($outputData)) { @@ -187,7 +189,7 @@ private function executeHandler($callback, $entityParams) 'output_data' => null ]; try { - $result['output_data'] = call_user_func_array($callback, $entityParams); + $result['output_data'] = $callback(...$entityParams); $result['messages'][] = sprintf('Service execution success %s::%s', get_class($callback[0]), $callback[1]); } catch (\Zend_Db_Adapter_Exception $e) { $this->logger->critical($e->getMessage()); From 7b05c055b110b3bb8441afbdb1e9d8bfbeed6516 Mon Sep 17 00:00:00 2001 From: Daniel Ruf <d.ruf@bitexpert.de> Date: Tue, 8 Oct 2019 13:14:15 +0200 Subject: [PATCH 0045/1143] Revert small change --- .../AsynchronousOperations/Model/OperationProcessor.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/code/Magento/AsynchronousOperations/Model/OperationProcessor.php b/app/code/Magento/AsynchronousOperations/Model/OperationProcessor.php index 5e7cb6b7a0916..f7a411c745b1f 100644 --- a/app/code/Magento/AsynchronousOperations/Model/OperationProcessor.php +++ b/app/code/Magento/AsynchronousOperations/Model/OperationProcessor.php @@ -133,15 +133,13 @@ public function process(string $encodedMessage) $outputData = null; if ($errorCode === null) { - $handlerMessages = []; foreach ($handlers as $callback) { $result = $this->executeHandler($callback, $entityParams); $status = $result['status']; $errorCode = $result['error_code']; - $handlerMessages[] = $result['messages']; + $messages = array_merge($messages, $result['messages']); $outputData = $result['output_data']; } - $messages = array_merge($messages, ...$handlerMessages); } if (isset($outputData)) { From 5a014040afd71105af6ba32737ceba8436d6e640 Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Tue, 8 Oct 2019 15:42:11 +0300 Subject: [PATCH 0046/1143] MC-5233: DateTime product attributes support --- .../AdminProductAttributeActionGroup.xml | 11 ++++ .../Test/Mftf/Data/ProductAttributeData.xml | 4 ++ .../AdminCreateProductAttributeSection.xml | 1 + ...dminCreateDatetimeProductAttributeTest.xml | 61 +++++++++++++++++++ 4 files changed, 77 insertions(+) create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDatetimeProductAttributeTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml index 3e54574c553e3..4081a362153bb 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml @@ -370,4 +370,15 @@ <checkOption selector="{{AttributePropertiesSection.dropdownNthOptionIsDefault(row)}}" stepKey="setAsDefault" after="fillStoreView"/> </actionGroup> + + <!-- Go to advanced attribute properties --> + <actionGroup name="AdminNavigateToProductAttributeAdvancedSection"> + <annotations> + <description>Navigate and open Advanced Attribute Properties section on product attribute page</description> + </annotations> + + <scrollTo selector="{{AdvancedAttributePropertiesSection.AdvancedAttributePropertiesSectionToggle}}" stepKey="scrollToSection"/> + <click selector="{{AdvancedAttributePropertiesSection.AdvancedAttributePropertiesSectionToggle}}" stepKey="openSection"/> + <waitForElementVisible selector="{{AdvancedAttributePropertiesSection.AttributeCode}}" stepKey="waitForSlideOutSection"/> + </actionGroup> </actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeData.xml index 6614fa4b5dbeb..38a273fe9fb41 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeData.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeData.xml @@ -309,6 +309,10 @@ <data key="frontend_input">date</data> <data key="is_required_admin">No</data> </entity> + <entity name="datetimeProductAttribute" extends="productAttributeWysiwyg" type="ProductAttribute"> + <data key="frontend_input">datetime</data> + <data key="is_required_admin">No</data> + </entity> <entity name="priceProductAttribute" extends="productAttributeWysiwyg" type="ProductAttribute"> <data key="frontend_input">date</data> <data key="is_required_admin">No</data> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCreateProductAttributeSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCreateProductAttributeSection.xml index 462f721913b9c..1236e07a2f278 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCreateProductAttributeSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCreateProductAttributeSection.xml @@ -93,6 +93,7 @@ <element name="DefaultValueText" type="textarea" selector="#default_value_text"/> <element name="DefaultValueTextArea" type="textarea" selector="#default_value_textarea"/> <element name="DefaultValueDate" type="textarea" selector="#default_value_date"/> + <element name="DefaultValueDatetime" type="textarea" selector="#default_value_datetime"/> <element name="DefaultValueYesNo" type="textarea" selector="#default_value_yesno"/> <element name="Scope" type="select" selector="#is_global"/> <element name="UniqueValue" type="select" selector="#is_unique"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDatetimeProductAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDatetimeProductAttributeTest.xml new file mode 100644 index 0000000000000..5d1f0716f33f7 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDatetimeProductAttributeTest.xml @@ -0,0 +1,61 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateDatetimeProductAttributeTest"> + <annotations> + <features value="Catalog"/> + <stories value="Datetime product attributes support"/> + <title value="Datetime product attribute type is supported"/> + <description value="Admin should be able to create datetime product attribute"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-21451"/> + <group value="Catalog"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="login"/> + </before> + <after> + <actionGroup ref="deleteProductAttribute" stepKey="deleteAttribute"> + <argument name="ProductAttribute" value="datetimeProductAttribute"/> + </actionGroup> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <amOnPage url="{{ProductAttributePage.url}}" stepKey="navigateToNewProductAttributePage"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <!-- Set attribute properties --> + <fillField selector="{{AttributePropertiesSection.DefaultLabel}}" + userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="fillDefaultLabel"/> + <selectOption selector="{{AttributePropertiesSection.InputType}}" + userInput="{{datetimeProductAttribute.frontend_input}}" stepKey="fillInputType"/> + <actionGroup ref="AdminNavigateToProductAttributeAdvancedSection" stepKey="goToAdvancedSectionNew"/> + <fillField selector="{{AdvancedAttributePropertiesSection.AttributeCode}}" + userInput="{{datetimeProductAttribute.attribute_code}}" + stepKey="fillAttributeCode"/> + <!-- Generate and set a default value --> + <generateDate date="now" format="m/j/y g:i A" stepKey="generateDefaultValue"/> + <fillField selector="{{AdvancedAttributePropertiesSection.DefaultValueDatetime}}" + userInput="{$generateDefaultValue}" + stepKey="fillDefaultValue"/> + <!-- Save the new product attribute --> + <click selector="{{AttributePropertiesSection.Save}}" stepKey="clickSaveAttribute"/> + <waitForPageLoad stepKey="waitForGridPageLoadAfterSaveAttribute"/> + <seeElement selector="{{AdminProductMessagesSection.successMessage}}" + stepKey="waitForSuccessMessage"/> + <!-- Navigate to created product attribute --> + <actionGroup ref="navigateToCreatedProductAttribute" stepKey="navigateToAttribute"> + <argument name="ProductAttribute" value="datetimeProductAttribute"/> + </actionGroup> + <!-- Check the saved date and time default value --> + <actionGroup ref="AdminNavigateToProductAttributeAdvancedSection" stepKey="goToAdvancedSection"/> + <scrollTo selector="{{AdvancedAttributePropertiesSection.DefaultValueDatetime}}" stepKey="scrollToDefaultValue"/> + <seeInField userInput="{$generateDefaultValue}" + selector="{{AdvancedAttributePropertiesSection.DefaultValueDatetime}}" + stepKey="checkDefaultValue"/> + </test> +</tests> From a9f42f9ed40aef0aaaefd5754d575fcb80f4fc7d Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Tue, 8 Oct 2019 15:43:47 +0300 Subject: [PATCH 0047/1143] MC-5233: DateTime product attributes support --- app/code/Magento/Ui/view/base/web/js/grid/columns/date.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/view/base/web/js/grid/columns/date.js b/app/code/Magento/Ui/view/base/web/js/grid/columns/date.js index 3179529e282c6..88959cda7499d 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/columns/date.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/columns/date.js @@ -40,12 +40,14 @@ define([ * @returns {String} Formatted date. */ getLabel: function (value, format) { - var date = moment.utc(this._super()); + var date; if (this.storeLocale !== undefined) { moment.locale(this.storeLocale, utils.extend({}, this.calendarConfig)); } + date = moment.utc(this._super()); + if (!_.isUndefined(this.timezone)) { date = date.tz(this.timezone); } From db1887747b87bc699c3ceb9796aff30eed30a0a5 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <engcom-vendorworker-foxtrot@adobe.com> Date: Tue, 8 Oct 2019 16:22:53 +0300 Subject: [PATCH 0048/1143] magento/magento2#24103: Refactoring. --- .../AdminNotification/Block/Grid/Renderer/Actions.php | 10 +++++----- .../AdminNotification/Block/Grid/Renderer/Notice.php | 4 ++-- .../AdminNotification/Block/Grid/Renderer/Severity.php | 2 +- .../Test/Unit/Block/Grid/Renderer/SeverityTest.php | 7 +++++-- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php index 86cf528fd4971..0a19531a34a0c 100644 --- a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php +++ b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php @@ -47,14 +47,14 @@ public function __construct(Context $context, Data $urlHelper, array $data = []) */ public function render(DataObject $row) { - $readDetailsHtml = $row->getData('url') ? '<a class="action-details" target="_blank" href="' . - $this->escapeUrl($row->getData('url')) + $readDetailsHtml = $row->getUrl() ? '<a class="action-details" target="_blank" href="' . + $this->escapeUrl($row->getUrl()) . '">' . __('Read Details') . '</a>' : ''; - $markAsReadHtml = !$row->getData('is_read') ? '<a class="action-mark" href="' . $this->getUrl( + $markAsReadHtml = !$row->getIsRead() ? '<a class="action-mark" href="' . $this->getUrl( '*/*/markAsRead/', - ['_current' => true, 'id' => $row->getData('notification_id')] + ['_current' => true, 'id' => $row->getNotificationId()] ) . '">' . __( 'Mark as Read' ) . '</a>' : ''; @@ -68,7 +68,7 @@ public function render(DataObject $row) '*/*/remove/', [ '_current' => true, - 'id' => $row->getData('notification_id'), + 'id' => $row->getNotificationId(), ActionInterface::PARAM_NAME_URL_ENCODED => $encodedUrl ] ), diff --git a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Notice.php b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Notice.php index 1cf56d60db9de..bd553e97aff79 100644 --- a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Notice.php +++ b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Notice.php @@ -28,8 +28,8 @@ class Notice extends AbstractRenderer public function render(DataObject $row) { return '<span class="grid-row-title">' . - $this->escapeHtml($row->getData('title')) . + $this->escapeHtml($row->getTitle()) . '</span>' . - ($row->getData('description') ? '<br />' . $this->escapeHtml($row->getData('description')) : ''); + ($row->getDescription() ? '<br />' . $this->escapeHtml($row->getDescription()) : ''); } } diff --git a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Severity.php b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Severity.php index d50781b1f6415..f7f8633e42e79 100644 --- a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Severity.php +++ b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Severity.php @@ -50,7 +50,7 @@ public function render(DataObject $row) $value = ''; $column = $this->getColumn(); - $index = $column->getData('index'); + $index = $column->getIndex(); switch ($row->getData($index)) { case MessageInterface::SEVERITY_CRITICAL: $class = 'critical'; diff --git a/app/code/Magento/AdminNotification/Test/Unit/Block/Grid/Renderer/SeverityTest.php b/app/code/Magento/AdminNotification/Test/Unit/Block/Grid/Renderer/SeverityTest.php index f42c740ca8fee..2a30be02f173b 100644 --- a/app/code/Magento/AdminNotification/Test/Unit/Block/Grid/Renderer/SeverityTest.php +++ b/app/code/Magento/AdminNotification/Test/Unit/Block/Grid/Renderer/SeverityTest.php @@ -44,8 +44,11 @@ protected function setUp() : void public function testShouldRenderSeverity() : void { /** @var Column | \PHPUnit_Framework_MockObject_MockObject $columnMock */ - $columnMock = $this->getMockBuilder(Column::class)->disableOriginalConstructor()->getMock(); - $columnMock->expects($this->exactly(5))->method('getData')->with($this->equalTo('index'))->willReturn('index'); + $columnMock = $this->getMockBuilder(Column::class) + ->disableOriginalConstructor() + ->setMethods(['getIndex']) + ->getMock(); + $columnMock->expects($this->exactly(5))->method('getIndex')->willReturn('index'); $this->sut->setColumn($columnMock); $dataObject = new DataObject(); From 1a780d2a113b0deba056fc983e2660aa4d21ff58 Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Wed, 9 Oct 2019 14:42:37 +0300 Subject: [PATCH 0049/1143] MC-5233: DateTime product attributes support --- .../AdminProductAttributeActionGroup.xml | 19 +++++- .../Test/Mftf/Data/ProductAttributeData.xml | 2 +- .../Section/AdminProductGridFilterSection.xml | 2 + ...dminCreateDatetimeProductAttributeTest.xml | 37 ++++------- ...SimpleProductWithDatetimeAttributeTest.xml | 65 +++++++++++++++++++ 5 files changed, 98 insertions(+), 27 deletions(-) create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithDatetimeAttributeTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml index 4081a362153bb..bc99e8d3f57e9 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml @@ -345,6 +345,23 @@ <fillField stepKey="fillDefaultValue" selector="{{AdvancedAttributePropertiesSection.DefaultValueDate}}" userInput="{{date}}"/> </actionGroup> + <!-- Inputs datetime default value and attribute code--> + <actionGroup name="CreateProductAttributeWithDatetimeField" extends="createProductAttribute" insertAfter="checkRequired"> + <annotations> + <description>EXTENDS: createProductAttribute. Fills in the Attribute Code and Default Value (Attribute Type: Date and Time Field).</description> + </annotations> + <arguments> + <argument name="date" type="string"/> + </arguments> + + <scrollTo selector="{{AdvancedAttributePropertiesSection.AdvancedAttributePropertiesSectionToggle}}" stepKey="scrollToAdvancedSection"/> + <click selector="{{AdvancedAttributePropertiesSection.AdvancedAttributePropertiesSectionToggle}}" stepKey="openAdvancedSection"/> + <waitForElementVisible selector="{{AdvancedAttributePropertiesSection.AttributeCode}}" stepKey="waitForSlideOutAdvancedSection"/> + <fillField stepKey="fillCode" selector="{{AdvancedAttributePropertiesSection.AttributeCode}}" userInput="{{attribute.attribute_code}}"/> + <scrollTo selector="{{AdvancedAttributePropertiesSection.DefaultValueDatetime}}" stepKey="scrollToDefaultField"/> + <fillField stepKey="fillDefaultValue" selector="{{AdvancedAttributePropertiesSection.DefaultValueDatetime}}" userInput="{{date}}"/> + </actionGroup> + <!-- Creates dropdown option at row without saving--> <actionGroup name="createAttributeDropdownNthOption"> <annotations> @@ -377,7 +394,7 @@ <description>Navigate and open Advanced Attribute Properties section on product attribute page</description> </annotations> - <scrollTo selector="{{AdvancedAttributePropertiesSection.AdvancedAttributePropertiesSectionToggle}}" stepKey="scrollToSection"/> + <scrollTo selector="{{AdvancedAttributePropertiesSection.AdvancedAttributePropertiesSectionToggle}}" stepKey="scrollToSection"/> <click selector="{{AdvancedAttributePropertiesSection.AdvancedAttributePropertiesSectionToggle}}" stepKey="openSection"/> <waitForElementVisible selector="{{AdvancedAttributePropertiesSection.AttributeCode}}" stepKey="waitForSlideOutSection"/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeData.xml index 38a273fe9fb41..b24a765706f2d 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeData.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeData.xml @@ -309,7 +309,7 @@ <data key="frontend_input">date</data> <data key="is_required_admin">No</data> </entity> - <entity name="datetimeProductAttribute" extends="productAttributeWysiwyg" type="ProductAttribute"> + <entity name="DatetimeProductAttribute" extends="productAttributeWysiwyg" type="ProductAttribute"> <data key="frontend_input">datetime</data> <data key="is_required_admin">No</data> </entity> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridFilterSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridFilterSection.xml index 3b6f24c0f259d..4e86f14611c24 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridFilterSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridFilterSection.xml @@ -36,5 +36,7 @@ <element name="productCount" type="text" selector="#catalog_category_products-total-count"/> <element name="productPerPage" type="select" selector="#catalog_category_products_page-limit"/> <element name="storeViewDropdown" type="text" selector="//select[@name='store_id']/option[contains(.,'{{storeView}}')]" parameterized="true"/> + <element name="inputByCodeRangeFrom" type="input" selector="input.admin__control-text[name='{{code}}[from]']" parameterized="true"/> + <element name="inputByCodeRangeTo" type="input" selector="input.admin__control-text[name='{{code}}[to]']" parameterized="true"/> </section> </sections> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDatetimeProductAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDatetimeProductAttributeTest.xml index 5d1f0716f33f7..d084eb962c5da 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDatetimeProductAttributeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDatetimeProductAttributeTest.xml @@ -14,44 +14,31 @@ <description value="Admin should be able to create datetime product attribute"/> <severity value="CRITICAL"/> <testCaseId value="MC-21451"/> - <group value="Catalog"/> + <group value="catalog"/> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="login"/> </before> <after> <actionGroup ref="deleteProductAttribute" stepKey="deleteAttribute"> - <argument name="ProductAttribute" value="datetimeProductAttribute"/> + <argument name="ProductAttribute" value="DatetimeProductAttribute"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> </after> - - <amOnPage url="{{ProductAttributePage.url}}" stepKey="navigateToNewProductAttributePage"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <!-- Set attribute properties --> - <fillField selector="{{AttributePropertiesSection.DefaultLabel}}" - userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="fillDefaultLabel"/> - <selectOption selector="{{AttributePropertiesSection.InputType}}" - userInput="{{datetimeProductAttribute.frontend_input}}" stepKey="fillInputType"/> - <actionGroup ref="AdminNavigateToProductAttributeAdvancedSection" stepKey="goToAdvancedSectionNew"/> - <fillField selector="{{AdvancedAttributePropertiesSection.AttributeCode}}" - userInput="{{datetimeProductAttribute.attribute_code}}" - stepKey="fillAttributeCode"/> - <!-- Generate and set a default value --> + <!-- Generate the datetime default value --> <generateDate date="now" format="m/j/y g:i A" stepKey="generateDefaultValue"/> - <fillField selector="{{AdvancedAttributePropertiesSection.DefaultValueDatetime}}" - userInput="{$generateDefaultValue}" - stepKey="fillDefaultValue"/> - <!-- Save the new product attribute --> - <click selector="{{AttributePropertiesSection.Save}}" stepKey="clickSaveAttribute"/> - <waitForPageLoad stepKey="waitForGridPageLoadAfterSaveAttribute"/> - <seeElement selector="{{AdminProductMessagesSection.successMessage}}" - stepKey="waitForSuccessMessage"/> + <!-- Create new datetime product attribute --> + <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="goToProductAttributes"/> + <waitForPageLoad stepKey="waitForPageLoadAttributes"/> + <actionGroup ref="CreateProductAttributeWithDatetimeField" stepKey="createAttribute"> + <argument name="attribute" value="DatetimeProductAttribute"/> + <argument name="date" value="{$generateDefaultValue}"/> + </actionGroup> <!-- Navigate to created product attribute --> <actionGroup ref="navigateToCreatedProductAttribute" stepKey="navigateToAttribute"> - <argument name="ProductAttribute" value="datetimeProductAttribute"/> + <argument name="ProductAttribute" value="DatetimeProductAttribute"/> </actionGroup> - <!-- Check the saved date and time default value --> + <!-- Check the saved datetime default value --> <actionGroup ref="AdminNavigateToProductAttributeAdvancedSection" stepKey="goToAdvancedSection"/> <scrollTo selector="{{AdvancedAttributePropertiesSection.DefaultValueDatetime}}" stepKey="scrollToDefaultValue"/> <seeInField userInput="{$generateDefaultValue}" diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithDatetimeAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithDatetimeAttributeTest.xml new file mode 100644 index 0000000000000..a21c5a84447dc --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithDatetimeAttributeTest.xml @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateSimpleProductWithDatetimeAttributeTest"> + <annotations> + <features value="Catalog"/> + <stories value="Datetime product attributes support"/> + <title value="Set datetime attribute to product"/> + <description value="Admin should be able to specify datetime attribute to product and find by them in product grid"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-21461"/> + <group value="catalog"/> + </annotations> + + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <deleteData createDataKey="createDatetimeAttribute" stepKey="DatetimeProductAttribute"/> + <actionGroup ref="deleteProductBySku" stepKey="deleteCreatedProduct"> + <argument name="sku" value="{{_defaultProduct.sku}}"/> + </actionGroup> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <!-- Generate default value --> + <generateDate date="now" format="m/j/Y g:i A" stepKey="generateDefaultValue"/> + <generateDate date="now" format="M j, Y g:i:00 A" stepKey="generateDefaultGridValue"/> + <generateDate date="+1 minute" format="m/j/Y g:i A" stepKey="generateFilterToDate"/> + <!-- Create new datetime product attribute --> + <createData entity="DatetimeProductAttribute" stepKey="createDatetimeAttribute"> + <field key="default_value">{$generateDefaultValue}</field> + </createData> + <!-- Open the new simple product page --> + <actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="openNewProductPage"/> + <actionGroup ref="fillMainProductForm" stepKey="fillDefaultProductFields"/> + <!-- Add datetime attribute --> + <actionGroup ref="addProductAttributeInProductModal" stepKey="addDatetimeAttribute"> + <argument name="attributeCode" value="$createDatetimeAttribute.attribute_code$"/> + </actionGroup> + <!-- Check default value --> + <scrollTo selector="{{AdminProductAttributesSection.sectionHeader}}" stepKey="goToAttributesSection"/> + <click selector="{{AdminProductAttributesSection.sectionHeader}}" stepKey="openAttributesSection"/> + <waitForElementVisible selector="{{AdminProductAttributesSection.attributeTextInputByCode($createDatetimeAttribute.attribute_code$)}}" stepKey="waitForSlideOutAttributes"/> + <seeInField selector="{{AdminProductAttributesSection.attributeTextInputByCode($createDatetimeAttribute.attribute_code$)}}" userInput="$generateDefaultValue" stepKey="checkDefaultValue"/> + <!-- Save the product --> + <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <!-- Check datetime grid filter --> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToAdminProductIndexPage"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> + <fillField selector="{{AdminProductGridFilterSection.inputByCodeRangeFrom($createDatetimeAttribute.attribute_code$)}}" userInput="{$generateDefaultValue}" stepKey="fillProductDatetimeFromFilter"/> + <fillField selector="{{AdminProductGridFilterSection.inputByCodeRangeTo($createDatetimeAttribute.attribute_code$)}}" userInput="{$generateFilterToDate}" stepKey="fillProductDatetimeToFilter"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> + <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad"/> + <see selector="{{AdminProductGridSection.productGridCell('1', 'Name')}}" userInput="{{_defaultProduct.name}}" stepKey="checkAppliedDatetimeFilter"/> + <see selector="{{AdminProductGridSection.productGridContentsOnRow('1')}}" userInput="{$generateDefaultGridValue}" stepKey="checkDefaultValueInGrid"/> + </test> +</tests> From f27f74950a0fb961834bd4909015718e228a8ddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gihovani=20Filipp=20Pereira=20Deme=CC=81trio?= <gihovani@gmail.com> Date: Wed, 9 Oct 2019 18:46:27 -0300 Subject: [PATCH 0050/1143] Fix: add to cart grouped product when exists a sold out option --- app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php b/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php index 187fd27fa0554..8eac8d0b0e163 100644 --- a/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php +++ b/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php @@ -344,7 +344,7 @@ protected function getProductInfo(\Magento\Framework\DataObject $buyRequest, $pr } foreach ($associatedProducts as $subProduct) { if (!isset($productsInfo[$subProduct->getId()])) { - if ($isStrictProcessMode && !$subProduct->getQty()) { + if ($isStrictProcessMode && !$subProduct->getQty() && $subProduct->isSalable()) { return __('Please specify the quantity of product(s).')->render(); } $productsInfo[$subProduct->getId()] = $subProduct->isSalable() ? (float)$subProduct->getQty() : 0; From 7379bc9a62df7af85003a26bf94f72bee16989cc Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Thu, 10 Oct 2019 11:16:11 +0300 Subject: [PATCH 0051/1143] MC-5233: DateTime product attributes support --- .../AdminProductAttributeActionGroup.xml | 10 +++++----- .../Section/AdminCreateProductAttributeSection.xml | 2 +- .../AdminCreateDatetimeProductAttributeTest.xml | 5 +++-- ...reateSimpleProductWithDatetimeAttributeTest.xml | 14 +++++++------- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml index bc99e8d3f57e9..6deec50a831b4 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml @@ -355,11 +355,11 @@ </arguments> <scrollTo selector="{{AdvancedAttributePropertiesSection.AdvancedAttributePropertiesSectionToggle}}" stepKey="scrollToAdvancedSection"/> - <click selector="{{AdvancedAttributePropertiesSection.AdvancedAttributePropertiesSectionToggle}}" stepKey="openAdvancedSection"/> + <conditionalClick selector="{{AdvancedAttributePropertiesSection.AdvancedAttributePropertiesSectionToggle}}" dependentSelector="{{AdvancedAttributePropertiesSection.AttributeCode}}" visible="false" stepKey="openAdvancedSection"/> <waitForElementVisible selector="{{AdvancedAttributePropertiesSection.AttributeCode}}" stepKey="waitForSlideOutAdvancedSection"/> - <fillField stepKey="fillCode" selector="{{AdvancedAttributePropertiesSection.AttributeCode}}" userInput="{{attribute.attribute_code}}"/> - <scrollTo selector="{{AdvancedAttributePropertiesSection.DefaultValueDatetime}}" stepKey="scrollToDefaultField"/> - <fillField stepKey="fillDefaultValue" selector="{{AdvancedAttributePropertiesSection.DefaultValueDatetime}}" userInput="{{date}}"/> + <fillField selector="{{AdvancedAttributePropertiesSection.AttributeCode}}" userInput="{{attribute.attribute_code}}" stepKey="fillCode"/> + <scrollTo selector="{{AdvancedAttributePropertiesSection.defaultValueDatetime}}" stepKey="scrollToDefaultField"/> + <fillField selector="{{AdvancedAttributePropertiesSection.defaultValueDatetime}}" userInput="{{date}}" stepKey="fillDefaultValue"/> </actionGroup> <!-- Creates dropdown option at row without saving--> @@ -395,7 +395,7 @@ </annotations> <scrollTo selector="{{AdvancedAttributePropertiesSection.AdvancedAttributePropertiesSectionToggle}}" stepKey="scrollToSection"/> - <click selector="{{AdvancedAttributePropertiesSection.AdvancedAttributePropertiesSectionToggle}}" stepKey="openSection"/> + <conditionalClick selector="{{AdvancedAttributePropertiesSection.AdvancedAttributePropertiesSectionToggle}}" dependentSelector="{{AdvancedAttributePropertiesSection.AttributeCode}}" visible="false" stepKey="openSection"/> <waitForElementVisible selector="{{AdvancedAttributePropertiesSection.AttributeCode}}" stepKey="waitForSlideOutSection"/> </actionGroup> </actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCreateProductAttributeSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCreateProductAttributeSection.xml index 1236e07a2f278..e6b86c7a9172b 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCreateProductAttributeSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCreateProductAttributeSection.xml @@ -93,7 +93,7 @@ <element name="DefaultValueText" type="textarea" selector="#default_value_text"/> <element name="DefaultValueTextArea" type="textarea" selector="#default_value_textarea"/> <element name="DefaultValueDate" type="textarea" selector="#default_value_date"/> - <element name="DefaultValueDatetime" type="textarea" selector="#default_value_datetime"/> + <element name="defaultValueDatetime" type="textarea" selector="#default_value_datetime"/> <element name="DefaultValueYesNo" type="textarea" selector="#default_value_yesno"/> <element name="Scope" type="select" selector="#is_global"/> <element name="UniqueValue" type="select" selector="#is_unique"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDatetimeProductAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDatetimeProductAttributeTest.xml index d084eb962c5da..e46114ff752f6 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDatetimeProductAttributeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDatetimeProductAttributeTest.xml @@ -23,6 +23,7 @@ <actionGroup ref="deleteProductAttribute" stepKey="deleteAttribute"> <argument name="ProductAttribute" value="DatetimeProductAttribute"/> </actionGroup> + <actionGroup ref="AdminGridFilterResetActionGroup" stepKey="resetGridFilter"/> <actionGroup ref="logout" stepKey="logout"/> </after> <!-- Generate the datetime default value --> @@ -40,9 +41,9 @@ </actionGroup> <!-- Check the saved datetime default value --> <actionGroup ref="AdminNavigateToProductAttributeAdvancedSection" stepKey="goToAdvancedSection"/> - <scrollTo selector="{{AdvancedAttributePropertiesSection.DefaultValueDatetime}}" stepKey="scrollToDefaultValue"/> + <scrollTo selector="{{AdvancedAttributePropertiesSection.defaultValueDatetime}}" stepKey="scrollToDefaultValue"/> <seeInField userInput="{$generateDefaultValue}" - selector="{{AdvancedAttributePropertiesSection.DefaultValueDatetime}}" + selector="{{AdvancedAttributePropertiesSection.defaultValueDatetime}}" stepKey="checkDefaultValue"/> </test> </tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithDatetimeAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithDatetimeAttributeTest.xml index a21c5a84447dc..019baa4ac153d 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithDatetimeAttributeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithDatetimeAttributeTest.xml @@ -22,10 +22,11 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <deleteData createDataKey="createDatetimeAttribute" stepKey="DatetimeProductAttribute"/> + <deleteData createDataKey="createDatetimeAttribute" stepKey="deleteDatetimeAttribute"/> <actionGroup ref="deleteProductBySku" stepKey="deleteCreatedProduct"> <argument name="sku" value="{{_defaultProduct.sku}}"/> </actionGroup> + <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFiltersOnProductIndexPage"/> <actionGroup ref="logout" stepKey="logout"/> </after> @@ -53,13 +54,12 @@ <actionGroup ref="saveProductForm" stepKey="saveProduct"/> <!-- Check datetime grid filter --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToAdminProductIndexPage"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> + <click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openProductFilters"/> <fillField selector="{{AdminProductGridFilterSection.inputByCodeRangeFrom($createDatetimeAttribute.attribute_code$)}}" userInput="{$generateDefaultValue}" stepKey="fillProductDatetimeFromFilter"/> <fillField selector="{{AdminProductGridFilterSection.inputByCodeRangeTo($createDatetimeAttribute.attribute_code$)}}" userInput="{$generateFilterToDate}" stepKey="fillProductDatetimeToFilter"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> - <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad"/> - <see selector="{{AdminProductGridSection.productGridCell('1', 'Name')}}" userInput="{{_defaultProduct.name}}" stepKey="checkAppliedDatetimeFilter"/> - <see selector="{{AdminProductGridSection.productGridContentsOnRow('1')}}" userInput="{$generateDefaultGridValue}" stepKey="checkDefaultValueInGrid"/> + <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickApplyFilters"/> + <see selector="{{AdminDataGridTableSection.gridCell('1', 'Name')}}" userInput="{{_defaultProduct.name}}" stepKey="checkAppliedDatetimeFilter"/> + <see selector="{{AdminDataGridTableSection.rowTemplateStrict(_defaultProduct.name)}}" userInput="{$generateDefaultGridValue}" stepKey="checkDefaultValueInGrid"/> </test> </tests> From 9110f821c258e91431596d835c0b811083d327f3 Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Thu, 10 Oct 2019 12:44:11 +0300 Subject: [PATCH 0052/1143] MC-5233: DateTime product attributes support --- .../Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml | 1 + .../Test/Mftf/Section/AdminCreateProductAttributeSection.xml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml index 6deec50a831b4..389330fd7deb5 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml @@ -17,6 +17,7 @@ </arguments> <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/> + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingFilters"/> <fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" userInput="{{ProductAttribute.attribute_code}}" stepKey="setAttributeCode"/> <click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="searchForAttributeFromTheGrid"/> <click selector="{{AdminProductAttributeGridSection.FirstRow}}" stepKey="clickOnAttributeRow"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCreateProductAttributeSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCreateProductAttributeSection.xml index e6b86c7a9172b..31c4f5198a8b0 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCreateProductAttributeSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCreateProductAttributeSection.xml @@ -93,7 +93,7 @@ <element name="DefaultValueText" type="textarea" selector="#default_value_text"/> <element name="DefaultValueTextArea" type="textarea" selector="#default_value_textarea"/> <element name="DefaultValueDate" type="textarea" selector="#default_value_date"/> - <element name="defaultValueDatetime" type="textarea" selector="#default_value_datetime"/> + <element name="defaultValueDatetime" type="text" selector="#default_value_datetime"/> <element name="DefaultValueYesNo" type="textarea" selector="#default_value_yesno"/> <element name="Scope" type="select" selector="#is_global"/> <element name="UniqueValue" type="select" selector="#is_unique"/> From c5a1666a93e10806f1861a7df958a6f4de5c4a99 Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Thu, 10 Oct 2019 12:49:48 +0300 Subject: [PATCH 0053/1143] MC-5233: DateTime product attributes support --- .../Test/Unit/Ui/Component/ColumnFactoryTest.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Ui/Component/ColumnFactoryTest.php b/app/code/Magento/Catalog/Test/Unit/Ui/Component/ColumnFactoryTest.php index f002173de7996..4e6730b553307 100644 --- a/app/code/Magento/Catalog/Test/Unit/Ui/Component/ColumnFactoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Ui/Component/ColumnFactoryTest.php @@ -56,7 +56,7 @@ class ColumnFactoryTest extends TestCase /** * @var TimezoneInterface|MockObject */ - private $timeZone; + private $timezone; /** * @inheritdoc @@ -80,13 +80,13 @@ protected function setUp(): void $this->column = $this->getMockForAbstractClass(ColumnInterface::class); $this->uiComponentFactory->method('create') ->willReturn($this->column); - $this->timeZone = $this->createMock(TimezoneInterface::class); + $this->timezone = $this->createMock(TimezoneInterface::class); $this->columnFactory = $this->objectManager->getObject( ColumnFactory::class, [ 'componentFactory' => $this->uiComponentFactory, - 'timezone' => $this->timeZone, + 'timezone' => $this->timezone, ] ); } @@ -203,7 +203,7 @@ public function testCreateDateColumn( 'visible' => true, 'filter' => 'dateRange', 'component' => 'Magento_Ui/js/grid/columns/date', - 'timeZone' => $expectedTimezone, + 'timezone' => $expectedTimezone, 'dateFormat' => $expectedDateFormat, 'options' => [ 'showsTime' => $showsTime @@ -224,15 +224,15 @@ public function testCreateDateColumn( $this->attribute->method('getFrontendInput') ->willReturn($frontendInput); - $this->timeZone->method('getDateFormat') + $this->timezone->method('getDateFormat') ->with(\IntlDateFormatter::MEDIUM) ->willReturn($dateFormat); - $this->timeZone->method('getDateTimeFormat') + $this->timezone->method('getDateTimeFormat') ->with(\IntlDateFormatter::MEDIUM) ->willReturn($dateTimeFormat); - $this->timeZone->method('getDefaultTimezone') + $this->timezone->method('getDefaultTimezone') ->willReturn($defaultTimezone); - $this->timeZone->method('getConfigTimezone') + $this->timezone->method('getConfigTimezone') ->willReturn($configTimezone); $this->uiComponentFactory->expects($this->once()) From e9f0b8a117f09134ed15652e551266a237de3c6e Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Thu, 10 Oct 2019 14:12:39 +0300 Subject: [PATCH 0054/1143] MC-5233: DateTime product attributes support --- .../Test/Mftf/Section/AdminCreateProductAttributeSection.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCreateProductAttributeSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCreateProductAttributeSection.xml index 31c4f5198a8b0..0934e39dcb062 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCreateProductAttributeSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCreateProductAttributeSection.xml @@ -93,7 +93,7 @@ <element name="DefaultValueText" type="textarea" selector="#default_value_text"/> <element name="DefaultValueTextArea" type="textarea" selector="#default_value_textarea"/> <element name="DefaultValueDate" type="textarea" selector="#default_value_date"/> - <element name="defaultValueDatetime" type="text" selector="#default_value_datetime"/> + <element name="defaultValueDatetime" type="date" selector="#default_value_datetime"/> <element name="DefaultValueYesNo" type="textarea" selector="#default_value_yesno"/> <element name="Scope" type="select" selector="#is_global"/> <element name="UniqueValue" type="select" selector="#is_unique"/> From 27e2049537f34d8ce0748e2f47afc9f95ffed1b1 Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Thu, 10 Oct 2019 17:09:16 +0300 Subject: [PATCH 0055/1143] MC-5233: DateTime product attributes support --- app/code/Magento/Catalog/Ui/Component/Listing/Columns.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Ui/Component/Listing/Columns.php b/app/code/Magento/Catalog/Ui/Component/Listing/Columns.php index d7b9bc3846f49..1e056d9f8d517 100644 --- a/app/code/Magento/Catalog/Ui/Component/Listing/Columns.php +++ b/app/code/Magento/Catalog/Ui/Component/Listing/Columns.php @@ -14,7 +14,7 @@ class Columns extends \Magento\Ui\Component\Listing\Columns { /** - * Default columns max order + * Default columns max order value */ const DEFAULT_COLUMNS_MAX_ORDER = 100; From ee1807bbcd027f37f0d3460710c713f9793b5395 Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Fri, 11 Oct 2019 13:34:14 +0300 Subject: [PATCH 0056/1143] MC-5233: DateTime product attributes support --- .../AdminCreateSimpleProductWithDatetimeAttributeTest.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithDatetimeAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithDatetimeAttributeTest.xml index 019baa4ac153d..6772e95b6ec27 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithDatetimeAttributeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithDatetimeAttributeTest.xml @@ -45,13 +45,15 @@ <actionGroup ref="addProductAttributeInProductModal" stepKey="addDatetimeAttribute"> <argument name="attributeCode" value="$createDatetimeAttribute.attribute_code$"/> </actionGroup> + <!-- Flush config cache to reset product attributes in attribute set --> + <magentoCLI command="cache:flush" arguments="config" stepKey="flushConfigCache"/> + <!-- Save the product --> + <actionGroup ref="saveProductForm" stepKey="saveProduct"/> <!-- Check default value --> <scrollTo selector="{{AdminProductAttributesSection.sectionHeader}}" stepKey="goToAttributesSection"/> <click selector="{{AdminProductAttributesSection.sectionHeader}}" stepKey="openAttributesSection"/> <waitForElementVisible selector="{{AdminProductAttributesSection.attributeTextInputByCode($createDatetimeAttribute.attribute_code$)}}" stepKey="waitForSlideOutAttributes"/> <seeInField selector="{{AdminProductAttributesSection.attributeTextInputByCode($createDatetimeAttribute.attribute_code$)}}" userInput="$generateDefaultValue" stepKey="checkDefaultValue"/> - <!-- Save the product --> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> <!-- Check datetime grid filter --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToAdminProductIndexPage"/> <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> From 96bfb5170e359c89058e9e0ed108ad2e136d73b1 Mon Sep 17 00:00:00 2001 From: Thomas Klein <thomas.klein@mpbio.com> Date: Wed, 16 Oct 2019 10:20:00 +0200 Subject: [PATCH 0057/1143] cleanup di --- app/code/Magento/Cms/etc/di.xml | 8 -------- app/code/Magento/Sales/etc/di.xml | 8 -------- app/code/Magento/Search/etc/di.xml | 8 -------- app/code/Magento/Ui/etc/di.xml | 10 ++++------ .../Element/UiComponent/DataProvider/FilterPool.php | 12 ++++-------- 5 files changed, 8 insertions(+), 38 deletions(-) diff --git a/app/code/Magento/Cms/etc/di.xml b/app/code/Magento/Cms/etc/di.xml index 025d63115f4ce..43d8c4aff1574 100644 --- a/app/code/Magento/Cms/etc/di.xml +++ b/app/code/Magento/Cms/etc/di.xml @@ -117,14 +117,6 @@ <argument name="resourceModel" xsi:type="string">Magento\Cms\Model\ResourceModel\Block</argument> </arguments> </type> - <virtualType name="CmsGirdFilterPool" type="Magento\Framework\View\Element\UiComponent\DataProvider\FilterPool"> - <arguments> - <argument name="appliers" xsi:type="array"> - <item name="regular" xsi:type="object">Magento\Framework\View\Element\UiComponent\DataProvider\RegularFilter</item> - <item name="fulltext" xsi:type="object">Magento\Framework\View\Element\UiComponent\DataProvider\FulltextFilter</item> - </argument> - </arguments> - </virtualType> <type name="Magento\Framework\Model\Entity\RepositoryFactory"> <arguments> <argument name="entities" xsi:type="array"> diff --git a/app/code/Magento/Sales/etc/di.xml b/app/code/Magento/Sales/etc/di.xml index f6618c9884d60..9f705c1a674c1 100644 --- a/app/code/Magento/Sales/etc/di.xml +++ b/app/code/Magento/Sales/etc/di.xml @@ -819,14 +819,6 @@ </argument> </arguments> </type> - <type name="Magento\Framework\View\Element\UiComponent\DataProvider\FilterPool"> - <arguments> - <argument name="appliers" xsi:type="array"> - <item name="regular" xsi:type="object">Magento\Framework\View\Element\UiComponent\DataProvider\RegularFilter</item> - <item name="fulltext" xsi:type="object">Magento\Framework\View\Element\UiComponent\DataProvider\FulltextFilter</item> - </argument> - </arguments> - </type> <type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory"> <arguments> <argument name="collections" xsi:type="array"> diff --git a/app/code/Magento/Search/etc/di.xml b/app/code/Magento/Search/etc/di.xml index 4aa211d23f0a2..382174f4327a2 100755 --- a/app/code/Magento/Search/etc/di.xml +++ b/app/code/Magento/Search/etc/di.xml @@ -45,14 +45,6 @@ <preference for="Magento\Search\Model\AutocompleteInterface" type="Magento\Search\Model\Autocomplete" /> <preference for="Magento\Search\Model\Autocomplete\ItemInterface" type="Magento\Search\Model\Autocomplete\Item" /> <preference for="Magento\Framework\Search\SearchEngineInterface" type="Magento\Search\Model\SearchEngine"/> - <type name="Magento\Framework\View\Element\UiComponent\DataProvider\FilterPool"> - <arguments> - <argument name="appliers" xsi:type="array"> - <item name="regular" xsi:type="object">Magento\Framework\View\Element\UiComponent\DataProvider\RegularFilter</item> - <item name="fulltext" xsi:type="object">Magento\Framework\View\Element\UiComponent\DataProvider\FulltextFilter</item> - </argument> - </arguments> - </type> <!-- @api --> <virtualType name="Magento\Search\Model\ResourceModel\Synonyms\Grid\Collection" type="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult"> <arguments> diff --git a/app/code/Magento/Ui/etc/di.xml b/app/code/Magento/Ui/etc/di.xml index c029e18addf73..151ae7f630692 100644 --- a/app/code/Magento/Ui/etc/di.xml +++ b/app/code/Magento/Ui/etc/di.xml @@ -194,13 +194,11 @@ <argument name="uiReader" xsi:type="object">uiDefinitionReader</argument> </arguments> </type> - <type name="Magento\Ui\Component\Filter\FilterPool"> + <type name="Magento\Framework\View\Element\UiComponent\DataProvider\FilterPool"> <arguments> - <argument name="filters" xsi:type="array"> - <item name="filter_input" xsi:type="string">Magento\Ui\Component\Filter\Type\Input</item> - <item name="filter_select" xsi:type="string">Magento\Ui\Component\Filter\Type\Select</item> - <item name="filter_range" xsi:type="string">Magento\Ui\Component\Filter\Type\Range</item> - <item name="filter_store" xsi:type="string">Magento\Ui\Component\Filter\Type\Store</item> + <argument name="appliers" xsi:type="array"> + <item name="regular" xsi:type="object">Magento\Framework\View\Element\UiComponent\DataProvider\RegularFilter</item> + <item name="fulltext" xsi:type="object">Magento\Framework\View\Element\UiComponent\DataProvider\FulltextFilter</item> </argument> </arguments> </type> diff --git a/lib/internal/Magento/Framework/View/Element/UiComponent/DataProvider/FilterPool.php b/lib/internal/Magento/Framework/View/Element/UiComponent/DataProvider/FilterPool.php index 24ea542649875..9cee6b6d5bb4c 100644 --- a/lib/internal/Magento/Framework/View/Element/UiComponent/DataProvider/FilterPool.php +++ b/lib/internal/Magento/Framework/View/Element/UiComponent/DataProvider/FilterPool.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Framework\View\Element\UiComponent\DataProvider; @@ -17,12 +18,12 @@ class FilterPool { /** - * @var array + * @var FilterApplierInterface[] */ protected $appliers; /** - * @param array $appliers + * @param FilterApplierInterface[] $appliers */ public function __construct(array $appliers = []) { @@ -38,12 +39,7 @@ public function applyFilters(Collection $collection, SearchCriteriaInterface $cr { foreach ($criteria->getFilterGroups() as $filterGroup) { foreach ($filterGroup->getFilters() as $filter) { - /** @var $filterApplier FilterApplierInterface*/ - if (isset($this->appliers[$filter->getConditionType()])) { - $filterApplier = $this->appliers[$filter->getConditionType()]; - } else { - $filterApplier = $this->appliers['regular']; - } + $filterApplier = $this->appliers[$filter->getConditionType()] ?? $this->appliers['regular']; $filterApplier->apply($collection, $filter); } } From b5787de0a17e13c749cf4bc5a3df771f8435829d Mon Sep 17 00:00:00 2001 From: Namrata Vora <namrata@seepossible.com> Date: Thu, 17 Oct 2019 14:04:45 +0530 Subject: [PATCH 0058/1143] Added translate for strings and added missing node in existing translate attribute on xml. --- app/code/Magento/AdvancedSearch/etc/adminhtml/system.xml | 2 +- app/code/Magento/Analytics/etc/adminhtml/system.xml | 2 +- .../view/adminhtml/ui_component/bulk_listing.xml | 2 +- .../Magento_Backend/layout/layout_test_grid_handle.xml | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/AdvancedSearch/etc/adminhtml/system.xml b/app/code/Magento/AdvancedSearch/etc/adminhtml/system.xml index 63c78e07c7bfc..905dd3e7d1819 100644 --- a/app/code/Magento/AdvancedSearch/etc/adminhtml/system.xml +++ b/app/code/Magento/AdvancedSearch/etc/adminhtml/system.xml @@ -60,7 +60,7 @@ <field id="search_suggestion_enabled">1</field> </depends> </field> - <field id="search_suggestion_count_results_enabled" translate="label" type="select" sortOrder="92" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="search_suggestion_count_results_enabled" translate="label comment" type="select" sortOrder="92" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Show Results Count for Each Suggestion</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <comment>When you enable this option your site may slow down.</comment> diff --git a/app/code/Magento/Analytics/etc/adminhtml/system.xml b/app/code/Magento/Analytics/etc/adminhtml/system.xml index c7da840b7e665..79dd914cb3c1d 100644 --- a/app/code/Magento/Analytics/etc/adminhtml/system.xml +++ b/app/code/Magento/Analytics/etc/adminhtml/system.xml @@ -29,7 +29,7 @@ <frontend_model>Magento\Analytics\Block\Adminhtml\System\Config\CollectionTimeLabel</frontend_model> <backend_model>Magento\Analytics\Model\Config\Backend\CollectionTime</backend_model> </field> - <field id="vertical" translate="label comment" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="vertical" translate="hint label comment" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0"> <hint>Industry Data</hint> <label>Industry</label> <comment>In order to personalize your Advanced Reporting experience, please select your industry.</comment> diff --git a/app/code/Magento/AsynchronousOperations/view/adminhtml/ui_component/bulk_listing.xml b/app/code/Magento/AsynchronousOperations/view/adminhtml/ui_component/bulk_listing.xml index 512b08d6a8de2..87dc0525eb1c0 100644 --- a/app/code/Magento/AsynchronousOperations/view/adminhtml/ui_component/bulk_listing.xml +++ b/app/code/Magento/AsynchronousOperations/view/adminhtml/ui_component/bulk_listing.xml @@ -92,7 +92,7 @@ <actionsColumn name="actions" class="\Magento\AsynchronousOperations\Ui\Component\Listing\Column\Actions"> <settings> <indexField>id</indexField> - <label>Action</label> + <label translate="true">Action</label> </settings> </actionsColumn> </columns> diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/_files/design/adminhtml/Magento/test_default/Magento_Backend/layout/layout_test_grid_handle.xml b/dev/tests/integration/testsuite/Magento/Backend/Block/_files/design/adminhtml/Magento/test_default/Magento_Backend/layout/layout_test_grid_handle.xml index 621e9f13409f1..70bf2af6a5fcf 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/_files/design/adminhtml/Magento/test_default/Magento_Backend/layout/layout_test_grid_handle.xml +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/_files/design/adminhtml/Magento/test_default/Magento_Backend/layout/layout_test_grid_handle.xml @@ -55,12 +55,12 @@ <item name="option_id1" xsi:type="array"> <item name="label" xsi:type="string" translate="true">Option One</item> <item name="url" xsi:type="string">*/*/option1</item> - <item name="complete" xsi:type="string">Test</item> + <item name="complete" xsi:type="string" translate="true">Test</item> </item> <item name="option_id2" xsi:type="array"> <item name="label" xsi:type="string" translate="true">Option Two</item> <item name="url" xsi:type="string">*/*/option2</item> - <item name="confirm" xsi:type="string">Are you sure?</item> + <item name="confirm" xsi:type="string" translate="true">Are you sure?</item> </item> <item name="option_id3" xsi:type="array"> <item name="label" xsi:type="string" translate="true">Option Three</item> From 216540f3f9577ad0d57785790c5160505e823f1a Mon Sep 17 00:00:00 2001 From: Andrey Legayev <andrey@ven.com> Date: Thu, 17 Oct 2019 21:58:39 +0300 Subject: [PATCH 0059/1143] Replace multiple string concatenation by joining array of strings --- .../App/ObjectManager/ConfigLoader/Compiled.php | 2 +- .../Framework/View/Element/AbstractBlock.php | 14 ++++++++++++-- lib/internal/Magento/Framework/View/Layout.php | 14 ++++++++------ 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php b/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php index 01e5031461f85..1dec1666d526a 100644 --- a/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php +++ b/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php @@ -42,6 +42,6 @@ public function load($area) public static function getFilePath($area) { $diPath = DirectoryList::getDefaultConfig()[DirectoryList::GENERATED_METADATA][DirectoryList::PATH]; - return BP . '/' . $diPath . '/' . $area . '.php'; + return join('', [BP, '/', $diPath, '/', $area, '.php']); } } diff --git a/lib/internal/Magento/Framework/View/Element/AbstractBlock.php b/lib/internal/Magento/Framework/View/Element/AbstractBlock.php index f8e8d2fee264a..1788fba3386f4 100644 --- a/lib/internal/Magento/Framework/View/Element/AbstractBlock.php +++ b/lib/internal/Magento/Framework/View/Element/AbstractBlock.php @@ -517,9 +517,14 @@ public function getChildHtml($alias = '', $useCache = true) $out = $layout->renderElement($childName, $useCache); } } else { + $outParts = []; foreach ($layout->getChildNames($name) as $child) { - $out .= $layout->renderElement($child, $useCache); + $elementHtml = $layout->renderElement($child, $useCache); + if (!empty($elementHtml)) { + $outParts[] = $elementHtml; + } } + $out = join('', $outParts); } return $out; @@ -548,9 +553,14 @@ public function getChildChildHtml($alias, $childChildAlias = '', $useCache = tru $childChildName = $layout->getChildName($childName, $childChildAlias); $out = $layout->renderElement($childChildName, $useCache); } else { + $outParts = []; foreach ($layout->getChildNames($childName) as $childChild) { - $out .= $layout->renderElement($childChild, $useCache); + $elementHtml = $layout->renderElement($childChild, $useCache); + if (!empty($elementHtml)) { + $outParts[] = $elementHtml; + } } + $out = join('', $outParts); } return $out; } diff --git a/lib/internal/Magento/Framework/View/Layout.php b/lib/internal/Magento/Framework/View/Layout.php index a622006f32a1e..994a19b03695d 100644 --- a/lib/internal/Magento/Framework/View/Layout.php +++ b/lib/internal/Magento/Framework/View/Layout.php @@ -586,13 +586,16 @@ protected function _renderUiComponent($name) */ protected function _renderContainer($name, $useCache = true) { - $html = ''; + $htmlParts = []; $children = $this->getChildNames($name); foreach ($children as $child) { - $html .= $this->renderElement($child, $useCache); + $childHtml = $this->renderElement($child, $useCache); + if (!empty($childHtml)) { + $htmlParts[] = $childHtml; + } } - if ($html == '' || !$this->structure->getAttribute($name, Element::CONTAINER_OPT_HTML_TAG)) { - return $html; + if (empty($htmlParts) || !$this->structure->getAttribute($name, Element::CONTAINER_OPT_HTML_TAG)) { + return join('', $htmlParts); } $htmlId = $this->structure->getAttribute($name, Element::CONTAINER_OPT_HTML_ID); @@ -606,8 +609,7 @@ protected function _renderContainer($name, $useCache = true) } $htmlTag = $this->structure->getAttribute($name, Element::CONTAINER_OPT_HTML_TAG); - - $html = sprintf('<%1$s%2$s%3$s>%4$s</%1$s>', $htmlTag, $htmlId, $htmlClass, $html); + $html = sprintf('<%1$s%2$s%3$s>%4$s</%1$s>', $htmlTag, $htmlId, $htmlClass, join('', $htmlParts)); return $html; } From e917b007ed8a233007c1a19d22776315eb7870d4 Mon Sep 17 00:00:00 2001 From: Andrey Legayev <andrey@ven.com> Date: Thu, 17 Oct 2019 21:59:32 +0300 Subject: [PATCH 0060/1143] Replace two calls to str_replace() by single strtr() I've tested: str_replace() is slower than strtr() in this case --- lib/internal/Magento/Framework/Phrase/Renderer/Translate.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Phrase/Renderer/Translate.php b/lib/internal/Magento/Framework/Phrase/Renderer/Translate.php index c9329caf49370..e2c8a737c344b 100644 --- a/lib/internal/Magento/Framework/Phrase/Renderer/Translate.php +++ b/lib/internal/Magento/Framework/Phrase/Renderer/Translate.php @@ -50,8 +50,7 @@ public function render(array $source, array $arguments) { $text = end($source); /* If phrase contains escaped quotes then use translation for phrase with non-escaped quote */ - $text = str_replace('\"', '"', $text); - $text = str_replace("\\'", "'", $text); + $text = strtr($text, ['\"' => '"', "\\'" => "'"]); try { $data = $this->translator->getData(); From aa068f94560b90f40aa5392d426c53f76aa7a895 Mon Sep 17 00:00:00 2001 From: Andrey Legayev <andrey@ven.com> Date: Thu, 17 Oct 2019 22:00:34 +0300 Subject: [PATCH 0061/1143] Replace in_array() by isset() --- .../Model/ResourceModel/Eav/Attribute.php | 25 ++++++++++--------- .../Framework/DB/Select/SelectRenderer.php | 8 +++++- lib/internal/Magento/Framework/Module/Dir.php | 16 ++++++------ 3 files changed, 29 insertions(+), 20 deletions(-) diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Eav/Attribute.php b/app/code/Magento/Catalog/Model/ResourceModel/Eav/Attribute.php index 355561c5e384d..97f126e388730 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Eav/Attribute.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Eav/Attribute.php @@ -38,6 +38,18 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute implements const KEY_IS_GLOBAL = 'is_global'; + private const ALLOWED_INPUT_TYPES = [ + 'boolean' => true, + 'date' => true, + 'datetime' => true, + 'multiselect' => true, + 'price' => true, + 'select' => true, + 'text' => true, + 'textarea' => true, + 'weight' => true, + ]; + /** * @var LockValidatorInterface */ @@ -403,18 +415,7 @@ public function getSourceModel() */ public function isAllowedForRuleCondition() { - $allowedInputTypes = [ - 'boolean', - 'date', - 'datetime', - 'multiselect', - 'price', - 'select', - 'text', - 'textarea', - 'weight', - ]; - return $this->getIsVisible() && in_array($this->getFrontendInput(), $allowedInputTypes); + return $this->getIsVisible() && isset(self::ALLOWED_INPUT_TYPES[$this->getFrontendInput()]); } /** diff --git a/lib/internal/Magento/Framework/DB/Select/SelectRenderer.php b/lib/internal/Magento/Framework/DB/Select/SelectRenderer.php index 11dbaeb82317a..ce53c07789bde 100644 --- a/lib/internal/Magento/Framework/DB/Select/SelectRenderer.php +++ b/lib/internal/Magento/Framework/DB/Select/SelectRenderer.php @@ -12,6 +12,11 @@ */ class SelectRenderer implements RendererInterface { + private const MANDATORY_SELECT_PARTS = [ + Select::COLUMNS => true, + Select::FROM => true + ]; + /** * @var RendererInterface[] */ @@ -67,7 +72,8 @@ public function render(Select $select, $sql = '') { $sql = Select::SQL_SELECT; foreach ($this->renderers as $renderer) { - if (in_array($renderer['part'], [Select::COLUMNS, Select::FROM]) || $select->getPart($renderer['part'])) { + $part = $renderer['part']; + if (isset(self::MANDATORY_SELECT_PARTS[$part]) || $select->getPart($part)) { $sql = $renderer['renderer']->render($select, $sql); } } diff --git a/lib/internal/Magento/Framework/Module/Dir.php b/lib/internal/Magento/Framework/Module/Dir.php index e6b60453b9577..4baf5f2f10ec6 100644 --- a/lib/internal/Magento/Framework/Module/Dir.php +++ b/lib/internal/Magento/Framework/Module/Dir.php @@ -22,6 +22,14 @@ class Dir const MODULE_SETUP_DIR = 'Setup'; /**#@-*/ + private const ALLOWED_DIR_TYPES = [ + self::MODULE_ETC_DIR => true, + self::MODULE_I18N_DIR => true, + self::MODULE_VIEW_DIR => true, + self::MODULE_CONTROLLER_DIR => true, + self::MODULE_SETUP_DIR => true + ]; + /**#@-*/ private $componentRegistrar; @@ -52,13 +60,7 @@ public function getDir($moduleName, $type = '') } if ($type) { - if (!in_array($type, [ - self::MODULE_ETC_DIR, - self::MODULE_I18N_DIR, - self::MODULE_VIEW_DIR, - self::MODULE_CONTROLLER_DIR, - self::MODULE_SETUP_DIR - ])) { + if (!isset(self::ALLOWED_DIR_TYPES[$type])) { throw new \InvalidArgumentException("Directory type '{$type}' is not recognized."); } $path .= '/' . $type; From c0ce7eac9a5f9f233b12b4e354b09664dbaf3d26 Mon Sep 17 00:00:00 2001 From: Andrey Legayev <andrey@ven.com> Date: Thu, 17 Oct 2019 22:01:17 +0300 Subject: [PATCH 0062/1143] Micro optimization: Replace != with !== --- .../Attribute/Backend/GroupPrice/AbstractGroupPrice.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php index e26717e47274c..d301cc7b63c52 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php @@ -97,17 +97,16 @@ protected function _getWebsiteCurrencyRates() ); foreach ($this->_storeManager->getWebsites() as $website) { /* @var $website \Magento\Store\Model\Website */ - if ($website->getBaseCurrencyCode() != $baseCurrency) { + $websiteBaseCurrency = $website->getBaseCurrencyCode(); + if ($websiteBaseCurrency !== $baseCurrency) { $rate = $this->_currencyFactory->create()->load( $baseCurrency - )->getRate( - $website->getBaseCurrencyCode() - ); + )->getRate($websiteBaseCurrency); if (!$rate) { $rate = 1; } $this->_rates[$website->getId()] = [ - 'code' => $website->getBaseCurrencyCode(), + 'code' => $websiteBaseCurrency, 'rate' => $rate, ]; } else { From 33c7de98bbc6f1baa6c9d1712b6a7e6d94a506ad Mon Sep 17 00:00:00 2001 From: Andrey Legayev <andrey@ven.com> Date: Fri, 18 Oct 2019 19:52:53 +0300 Subject: [PATCH 0063/1143] Fixes for PHPCS --- .../Attribute/Backend/GroupPrice/AbstractGroupPrice.php | 4 ++++ .../Framework/App/ObjectManager/ConfigLoader/Compiled.php | 8 ++++---- lib/internal/Magento/Framework/Module/Dir.php | 3 +++ .../Magento/Framework/Phrase/Renderer/Translate.php | 3 +++ .../Magento/Framework/View/Element/AbstractBlock.php | 3 +++ 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php index d301cc7b63c52..68aeabfc70d34 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php @@ -186,6 +186,7 @@ public function validate($object) } $compare = implode( '-', + // phpcs:ignore Magento2.Performance.ForeachArrayMerge array_merge( [$priceRow['website_id'], $priceRow['cust_group']], $this->_getAdditionalUniqueFields($priceRow) @@ -209,6 +210,7 @@ public function validate($object) if ($price['website_id'] == 0) { $compare = implode( '-', + // phpcs:ignore Magento2.Performance.ForeachArrayMerge array_merge( [$price['website_id'], $price['cust_group']], $this->_getAdditionalUniqueFields($price) @@ -233,6 +235,7 @@ public function validate($object) $globalCompare = implode( '-', + // phpcs:ignore Magento2.Performance.ForeachArrayMerge array_merge([0, $priceRow['cust_group']], $this->_getAdditionalUniqueFields($priceRow)) ); $websiteCurrency = $rates[$priceRow['website_id']]['code']; @@ -278,6 +281,7 @@ public function preparePriceData(array $priceData, $productTypeId, $websiteId) if (!array_filter($v)) { continue; } + // phpcs:ignore Magento2.Performance.ForeachArrayMerge $key = implode('-', array_merge([$v['cust_group']], $this->_getAdditionalUniqueFields($v))); if ($v['website_id'] == $websiteId) { $data[$key] = $v; diff --git a/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php b/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php index 1dec1666d526a..5fc668e2d9c5e 100644 --- a/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php +++ b/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php @@ -1,6 +1,5 @@ <?php /** - * * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ @@ -8,9 +7,10 @@ use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\ObjectManager\ConfigLoaderInterface; -use Magento\Framework\Serialize\SerializerInterface; -use Magento\Framework\Serialize\Serializer\Serialize; +/** + * Class Compiled + */ class Compiled implements ConfigLoaderInterface { /** @@ -21,7 +21,7 @@ class Compiled implements ConfigLoaderInterface private $configCache = []; /** - * {inheritdoc} + * @inheritdoc */ public function load($area) { diff --git a/lib/internal/Magento/Framework/Module/Dir.php b/lib/internal/Magento/Framework/Module/Dir.php index 4baf5f2f10ec6..99570b97e7251 100644 --- a/lib/internal/Magento/Framework/Module/Dir.php +++ b/lib/internal/Magento/Framework/Module/Dir.php @@ -10,6 +10,9 @@ use Magento\Framework\Component\ComponentRegistrar; use Magento\Framework\Component\ComponentRegistrarInterface; +/** + * Class Dir + */ class Dir { /**#@+ diff --git a/lib/internal/Magento/Framework/Phrase/Renderer/Translate.php b/lib/internal/Magento/Framework/Phrase/Renderer/Translate.php index e2c8a737c344b..4edf0fe049902 100644 --- a/lib/internal/Magento/Framework/Phrase/Renderer/Translate.php +++ b/lib/internal/Magento/Framework/Phrase/Renderer/Translate.php @@ -11,6 +11,9 @@ use Magento\Framework\TranslateInterface; use Psr\Log\LoggerInterface; +/** + * Class Translate + */ class Translate implements RendererInterface { /** diff --git a/lib/internal/Magento/Framework/View/Element/AbstractBlock.php b/lib/internal/Magento/Framework/View/Element/AbstractBlock.php index 1788fba3386f4..57cf1f68efca6 100644 --- a/lib/internal/Magento/Framework/View/Element/AbstractBlock.php +++ b/lib/internal/Magento/Framework/View/Element/AbstractBlock.php @@ -16,6 +16,7 @@ * * Marked as public API because it is actively used now. * + * phpcs:disable Magento2.Classes.AbstractApi * @api * @SuppressWarnings(PHPMD.ExcessivePublicCount) * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) @@ -244,6 +245,8 @@ public function getRequest() * Please override this one instead of overriding real __construct constructor * * @return void + * + * phpcs:disable Magento2.CodeAnalysis.EmptyBlock */ protected function _construct() { From 4fb5da819cb2517de204e7dcf8c545505eeabd2c Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Sat, 19 Oct 2019 19:41:02 +0300 Subject: [PATCH 0064/1143] magento/magento2#22856: Catalog price rules are not working with custom options as expected. --- .../CalculateCustomOptionCatalogRule.php | 50 +++- .../CalculateCustomOptionCatalogRuleTest.php | 266 ++++++++++++++++++ 2 files changed, 301 insertions(+), 15 deletions(-) create mode 100644 app/code/Magento/Catalog/Test/Unit/Pricing/Price/CalculateCustomOptionCatalogRuleTest.php diff --git a/app/code/Magento/Catalog/Pricing/Price/CalculateCustomOptionCatalogRule.php b/app/code/Magento/Catalog/Pricing/Price/CalculateCustomOptionCatalogRule.php index 91ff8f921566c..b3f3ac7bf68ef 100644 --- a/app/code/Magento/Catalog/Pricing/Price/CalculateCustomOptionCatalogRule.php +++ b/app/code/Magento/Catalog/Pricing/Price/CalculateCustomOptionCatalogRule.php @@ -53,24 +53,31 @@ public function execute( float $optionPriceValue, bool $isPercent ): float { - $basePrice = $this->getGetBasePriceWithOutCatalogRules($product); - if ($isPercent) { - $optionPrice = $basePrice * $optionPriceValue / 100; - } else { - $optionPrice = $optionPriceValue; - } - - $totalPriceModified = $this->priceModifier->modifyPrice( - $basePrice + $optionPrice, - $product - ); - $basePriceModified = $this->priceModifier->modifyPrice( - $basePrice, + $regularPrice = (float)$product->getPriceInfo() + ->getPrice(RegularPrice::PRICE_CODE) + ->getValue(); + $catalogRulePrice = $this->priceModifier->modifyPrice( + $regularPrice, $product ); - $price = $totalPriceModified - $basePriceModified; + $basePriceWithOutCatalogRules = (float)$this->getGetBasePriceWithOutCatalogRules($product); + // Apply catalog price rules to product options only if catalog price rules are applied to product. + if ($catalogRulePrice < $basePriceWithOutCatalogRules) { + $optionPrice = $this->getOptionPriceWithoutPriceRule($optionPriceValue, $isPercent, $regularPrice); + $totalCatalogRulePrice = $this->priceModifier->modifyPrice( + $regularPrice + $optionPrice, + $product + ); + $finalOptionPrice = $totalCatalogRulePrice - $catalogRulePrice; + } else { + $finalOptionPrice = $this->getOptionPriceWithoutPriceRule( + $optionPriceValue, + $isPercent, + $this->getGetBasePriceWithOutCatalogRules($product) + ); + } - return $this->priceCurrency->convertAndRound($price); + return $this->priceCurrency->convertAndRound($finalOptionPrice); } /** @@ -96,4 +103,17 @@ private function getGetBasePriceWithOutCatalogRules(Product $product): float return $basePrice ?? $product->getPrice(); } + + /** + * Calculate option price without catalog price rule discount. + * + * @param float $optionPriceValue + * @param bool $isPercent + * @param float $basePrice + * @return float + */ + private function getOptionPriceWithoutPriceRule(float $optionPriceValue, bool $isPercent, float $basePrice): float + { + return $isPercent ? $basePrice * $optionPriceValue / 100 : $optionPriceValue; + } } diff --git a/app/code/Magento/Catalog/Test/Unit/Pricing/Price/CalculateCustomOptionCatalogRuleTest.php b/app/code/Magento/Catalog/Test/Unit/Pricing/Price/CalculateCustomOptionCatalogRuleTest.php new file mode 100644 index 0000000000000..1a99ac5d451f0 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Unit/Pricing/Price/CalculateCustomOptionCatalogRuleTest.php @@ -0,0 +1,266 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Test\Unit\Pricing\Price; + +use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\Product\PriceModifier\Composite as PriceModifier; +use Magento\Catalog\Pricing\Price\CalculateCustomOptionCatalogRule; +use Magento\Catalog\Pricing\Price\RegularPrice; +use Magento\Catalog\Pricing\Price\SpecialPrice; +use Magento\CatalogRule\Pricing\Price\CatalogRulePrice; +use Magento\Directory\Model\PriceCurrency; +use Magento\Framework\Pricing\PriceInfo\Base; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +/** + * Test for CalculateCustomOptionCatalogRule class. + */ +class CalculateCustomOptionCatalogRuleTest extends TestCase +{ + /** + * @var Product|MockObject + */ + private $saleableItemMock; + + /** + * @var RegularPrice|MockObject + */ + private $regularPriceMock; + + /** + * @var SpecialPrice|MockObject + */ + private $specialPriceMock; + + /** + * @var CatalogRulePrice|MockObject + */ + private $catalogRulePriceMock; + + /** + * @var PriceModifier|MockObject + */ + private $priceModifierMock; + + /** + * @var CalculateCustomOptionCatalogRule + */ + private $calculateCustomOptionCatalogRule; + + /** + * @inheritdoc + */ + protected function setUp() + { + $objectManager = new ObjectManager($this); + $this->saleableItemMock = $this->createMock(Product::class); + $this->regularPriceMock = $this->createMock(RegularPrice::class); + $this->specialPriceMock = $this->createMock(SpecialPrice::class); + $this->catalogRulePriceMock = $this->createMock(CatalogRulePrice::class); + $priceInfoMock = $this->createMock(Base::class); + $this->saleableItemMock->expects($this->any()) + ->method('getPriceInfo') + ->willReturn($priceInfoMock); + $this->regularPriceMock->expects($this->any()) + ->method('getPriceCode') + ->willReturn(RegularPrice::PRICE_CODE); + $this->specialPriceMock->expects($this->any()) + ->method('getPriceCode') + ->willReturn(SpecialPrice::PRICE_CODE); + $this->catalogRulePriceMock->expects($this->any()) + ->method('getPriceCode') + ->willReturn(CatalogRulePrice::PRICE_CODE); + $priceInfoMock->expects($this->any()) + ->method('getPrices') + ->willReturn( + [ + 'regular_price' => $this->regularPriceMock, + 'special_price' => $this->specialPriceMock, + 'catalog_rule_price' => $this->catalogRulePriceMock + ] + ); + $priceInfoMock->expects($this->any()) + ->method('getPrice') + ->willReturnMap( + [ + ['regular_price', $this->regularPriceMock], + ['special_price', $this->specialPriceMock], + ['catalog_rule_price', $this->catalogRulePriceMock], + ] + ); + $priceCurrencyMock = $this->createMock(PriceCurrency::class); + $priceCurrencyMock->expects($this->any()) + ->method('convertAndRound') + ->willReturnArgument(0); + $this->priceModifierMock = $this->createMock(PriceModifier::class); + + $this->calculateCustomOptionCatalogRule = $objectManager->getObject( + CalculateCustomOptionCatalogRule::class, + [ + 'priceCurrency' => $priceCurrencyMock, + 'priceModifier' => $this->priceModifierMock, + ] + ); + } + + /** + * Tests correct option price calculation with different catalog rules and special prices combination. + * + * @dataProvider executeDataProvider + * @param array $prices + * @param float $catalogRulePriceModifier + * @param float $optionPriceValue + * @param bool $isPercent + * @param float $expectedResult + */ + public function testExecute( + array $prices, + float $catalogRulePriceModifier, + float $optionPriceValue, + bool $isPercent, + float $expectedResult + ) { + $this->regularPriceMock->expects($this->any()) + ->method('getValue') + ->willReturn($prices['regularPriceValue']); + $this->specialPriceMock->expects($this->any()) + ->method('getValue') + ->willReturn($prices['specialPriceValue']); + $this->priceModifierMock->expects($this->any()) + ->method('modifyPrice') + ->willReturnCallback( + function ($price) use ($catalogRulePriceModifier) { + return $price * $catalogRulePriceModifier; + } + ); + + $finalPrice = $this->calculateCustomOptionCatalogRule->execute( + $this->saleableItemMock, + $optionPriceValue, + $isPercent + ); + + $this->assertSame($expectedResult, $finalPrice); + } + + /** + * Data provider for testExecute. + * + * "Active" means this price type has biggest discount, so other prices doesn't count. + * + * @return array + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function executeDataProvider(): array + { + return [ + 'No special price, no catalog price rules, fixed option price' => [ + 'prices' => [ + 'regularPriceValue' => 1000, + 'specialPriceValue' => 1000, + ], + 'catalogRulePriceModifier' => 1.0, + 'optionPriceValue' => 100.0, + 'isPercent' => false, + 'expectedResult' => 100.0 + ], + 'No special price, no catalog price rules, percent option price' => [ + 'prices' => [ + 'regularPriceValue' => 1000, + 'specialPriceValue' => 1000, + ], + 'catalogRulePriceModifier' => 1.0, + 'optionPriceValue' => 100.0, + 'isPercent' => true, + 'expectedResult' => 1000.0 + ], + 'No special price, catalog price rule set, fixed option price' => [ + 'prices' => [ + 'regularPriceValue' => 1000, + 'specialPriceValue' => 1000, + ], + 'catalogRulePriceModifier' => 0.9, + 'optionPriceValue' => 100.0, + 'isPercent' => false, + 'expectedResult' => 90.0 + ], + 'No special price, catalog price rule set, percent option price' => [ + 'prices' => [ + 'regularPriceValue' => 1000, + 'specialPriceValue' => 1000, + ], + 'catalogRulePriceModifier' => 0.9, + 'optionPriceValue' => 100.0, + 'isPercent' => true, + 'expectedResult' => 900.0 + ], + 'Special price set, no catalog price rule, fixed option price' => [ + 'prices' => [ + 'regularPriceValue' => 1000, + 'specialPriceValue' => 900, + ], + 'catalogRulePriceModifier' => 1.0, + 'optionPriceValue' => 100.0, + 'isPercent' => false, + 'expectedResult' => 100.0 + ], + 'Special price set, no catalog price rule, percent option price' => [ + 'prices' => [ + 'regularPriceValue' => 1000, + 'specialPriceValue' => 900, + ], + 'catalogRulePriceModifier' => 1.0, + 'optionPriceValue' => 100.0, + 'isPercent' => true, + 'expectedResult' => 900.0 + ], + 'Special price set and active, catalog price rule set, fixed option price' => [ + 'prices' => [ + 'regularPriceValue' => 1000, + 'specialPriceValue' => 800, + ], + 'catalogRulePriceModifier' => 0.9, + 'optionPriceValue' => 100.0, + 'isPercent' => false, + 'expectedResult' => 100.0 + ], + 'Special price set and active, catalog price rule set, percent option price' => [ + 'prices' => [ + 'regularPriceValue' => 1000, + 'specialPriceValue' => 800, + ], + 'catalogRulePriceModifier' => 0.9, + 'optionPriceValue' => 100.0, + 'isPercent' => true, + 'expectedResult' => 800.0 + ], + 'Special price set, catalog price rule set and active, fixed option price' => [ + 'prices' => [ + 'regularPriceValue' => 1000, + 'specialPriceValue' => 950, + ], + 'catalogRulePriceModifier' => 0.9, + 'optionPriceValue' => 100.0, + 'isPercent' => false, + 'expectedResult' => 90.0 + ], + 'Special price set, catalog price rule set and active, percent option price' => [ + 'prices' => [ + 'regularPriceValue' => 1000, + 'specialPriceValue' => 950, + ], + 'catalogRulePriceModifier' => 0.9, + 'optionPriceValue' => 100.0, + 'isPercent' => true, + 'expectedResult' => 900.0 + ], + ]; + } +} From ca502c3970ea846b3be81b220ddde074c0a2b0f8 Mon Sep 17 00:00:00 2001 From: Andrey Legayev <andrey@ven.com> Date: Sun, 20 Oct 2019 17:25:46 +0300 Subject: [PATCH 0065/1143] Rollback some changes after benchmarking on PHP 7.2 --- .../Framework/App/ObjectManager/ConfigLoader/Compiled.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php b/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php index 5fc668e2d9c5e..7408e8b230bd9 100644 --- a/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php +++ b/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php @@ -42,6 +42,6 @@ public function load($area) public static function getFilePath($area) { $diPath = DirectoryList::getDefaultConfig()[DirectoryList::GENERATED_METADATA][DirectoryList::PATH]; - return join('', [BP, '/', $diPath, '/', $area, '.php']); + return BP . '/' . $diPath . '/' . $area . '.php'; } } From cded4b1f2a72c9f6cf568d4c85ff31a16c0d61ac Mon Sep 17 00:00:00 2001 From: Duong Hoang <d.hoang@youwe.nl> Date: Mon, 21 Oct 2019 14:19:48 +0200 Subject: [PATCH 0066/1143] Limit the php explode to 2 to prevent extra '=' sign content in the attribute value being explode to more than 2 element in result array. --- .../Model/Import/Product/Type/Configurable.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php b/app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php index 2767e725cc9b0..48dcf68901927 100644 --- a/app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php +++ b/app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php @@ -573,7 +573,7 @@ protected function _parseVariations($rowData) $fieldAndValuePairs = []; foreach ($fieldAndValuePairsText as $nameAndValue) { - $nameAndValue = explode(ImportProduct::PAIR_NAME_VALUE_SEPARATOR, $nameAndValue); + $nameAndValue = explode(ImportProduct::PAIR_NAME_VALUE_SEPARATOR, $nameAndValue,2); if (!empty($nameAndValue)) { $value = isset($nameAndValue[1]) ? trim($nameAndValue[1]) : ''; // Ignoring field names' case. From 904b2342c7f7ce391103091d1c9e0406af247aed Mon Sep 17 00:00:00 2001 From: Duong Hoang <d.hoang@youwe.nl> Date: Mon, 21 Oct 2019 14:45:49 +0200 Subject: [PATCH 0067/1143] Limit the php explode to 2 to prevent extra '=' sign content in the attribute value being explode to more than 2 element in result array. --UPDATE-- add space after comma ',' --- .../Model/Import/Product/Type/Configurable.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php b/app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php index 48dcf68901927..88007d0b1a880 100644 --- a/app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php +++ b/app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php @@ -573,7 +573,7 @@ protected function _parseVariations($rowData) $fieldAndValuePairs = []; foreach ($fieldAndValuePairsText as $nameAndValue) { - $nameAndValue = explode(ImportProduct::PAIR_NAME_VALUE_SEPARATOR, $nameAndValue,2); + $nameAndValue = explode(ImportProduct::PAIR_NAME_VALUE_SEPARATOR, $nameAndValue, 2); if (!empty($nameAndValue)) { $value = isset($nameAndValue[1]) ? trim($nameAndValue[1]) : ''; // Ignoring field names' case. From 156c689eedb3fd39b91d771c60e8d7eda611f4be Mon Sep 17 00:00:00 2001 From: Andrey Legayev <andrey@ven.com> Date: Tue, 22 Oct 2019 13:49:18 +0300 Subject: [PATCH 0068/1143] Revert string concat optimizations - there is no real improvement I've run performance tests for string concat vs. array join: https://gist.github.com/andrey-legayev/24ed101a34d4775bf1b6f9879581f51a No real performance improvement (which surprised me). But anyway - I'm rolling back string concatenation improvements, because it doesn't make any sense. --- .../Framework/View/Element/AbstractBlock.php | 14 ++------------ lib/internal/Magento/Framework/View/Layout.php | 14 ++++++-------- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/lib/internal/Magento/Framework/View/Element/AbstractBlock.php b/lib/internal/Magento/Framework/View/Element/AbstractBlock.php index 57cf1f68efca6..0d7e3154440e9 100644 --- a/lib/internal/Magento/Framework/View/Element/AbstractBlock.php +++ b/lib/internal/Magento/Framework/View/Element/AbstractBlock.php @@ -520,14 +520,9 @@ public function getChildHtml($alias = '', $useCache = true) $out = $layout->renderElement($childName, $useCache); } } else { - $outParts = []; foreach ($layout->getChildNames($name) as $child) { - $elementHtml = $layout->renderElement($child, $useCache); - if (!empty($elementHtml)) { - $outParts[] = $elementHtml; - } + $out .= $layout->renderElement($child, $useCache); } - $out = join('', $outParts); } return $out; @@ -556,14 +551,9 @@ public function getChildChildHtml($alias, $childChildAlias = '', $useCache = tru $childChildName = $layout->getChildName($childName, $childChildAlias); $out = $layout->renderElement($childChildName, $useCache); } else { - $outParts = []; foreach ($layout->getChildNames($childName) as $childChild) { - $elementHtml = $layout->renderElement($childChild, $useCache); - if (!empty($elementHtml)) { - $outParts[] = $elementHtml; - } + $out .= $layout->renderElement($childChild, $useCache); } - $out = join('', $outParts); } return $out; } diff --git a/lib/internal/Magento/Framework/View/Layout.php b/lib/internal/Magento/Framework/View/Layout.php index 994a19b03695d..a622006f32a1e 100644 --- a/lib/internal/Magento/Framework/View/Layout.php +++ b/lib/internal/Magento/Framework/View/Layout.php @@ -586,16 +586,13 @@ protected function _renderUiComponent($name) */ protected function _renderContainer($name, $useCache = true) { - $htmlParts = []; + $html = ''; $children = $this->getChildNames($name); foreach ($children as $child) { - $childHtml = $this->renderElement($child, $useCache); - if (!empty($childHtml)) { - $htmlParts[] = $childHtml; - } + $html .= $this->renderElement($child, $useCache); } - if (empty($htmlParts) || !$this->structure->getAttribute($name, Element::CONTAINER_OPT_HTML_TAG)) { - return join('', $htmlParts); + if ($html == '' || !$this->structure->getAttribute($name, Element::CONTAINER_OPT_HTML_TAG)) { + return $html; } $htmlId = $this->structure->getAttribute($name, Element::CONTAINER_OPT_HTML_ID); @@ -609,7 +606,8 @@ protected function _renderContainer($name, $useCache = true) } $htmlTag = $this->structure->getAttribute($name, Element::CONTAINER_OPT_HTML_TAG); - $html = sprintf('<%1$s%2$s%3$s>%4$s</%1$s>', $htmlTag, $htmlId, $htmlClass, join('', $htmlParts)); + + $html = sprintf('<%1$s%2$s%3$s>%4$s</%1$s>', $htmlTag, $htmlId, $htmlClass, $html); return $html; } From ee8373fa27727abb5139747ea5547a81fa3735ac Mon Sep 17 00:00:00 2001 From: Michal Sz <michal.szymanski@accenture.com> Date: Wed, 23 Oct 2019 20:04:10 +0200 Subject: [PATCH 0069/1143] Implement catching for all Errors - ref Magento issue #23350 --- lib/internal/Magento/Framework/App/Bootstrap.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/App/Bootstrap.php b/lib/internal/Magento/Framework/App/Bootstrap.php index 717b810cffd29..57b40faabc764 100644 --- a/lib/internal/Magento/Framework/App/Bootstrap.php +++ b/lib/internal/Magento/Framework/App/Bootstrap.php @@ -269,6 +269,8 @@ public function run(AppInterface $application) } } catch (\Exception $e) { $this->terminate($e); + } catch (\Error $e) { + $this->terminate($e); } } // phpcs:enable @@ -418,12 +420,12 @@ public function isDeveloperMode() /** * Display an exception and terminate program execution * - * @param \Exception $e + * @param \Throwable $e * @return void * * phpcs:disable Magento2.Security.LanguageConstruct, Squiz.Commenting.FunctionCommentThrowTag */ - protected function terminate(\Exception $e) + protected function terminate(\Throwable $e) { if ($this->isDeveloperMode()) { From 5c054e111d7ec9ccfe1a4cba6c89905a53dc8efb Mon Sep 17 00:00:00 2001 From: Michal Sz <michal.szymanski@accenture.com> Date: Thu, 24 Oct 2019 07:46:13 +0200 Subject: [PATCH 0070/1143] Unifying the catch statement - ref Magento issue #23350 --- lib/internal/Magento/Framework/App/Bootstrap.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/internal/Magento/Framework/App/Bootstrap.php b/lib/internal/Magento/Framework/App/Bootstrap.php index 57b40faabc764..d3290f8518b6e 100644 --- a/lib/internal/Magento/Framework/App/Bootstrap.php +++ b/lib/internal/Magento/Framework/App/Bootstrap.php @@ -267,11 +267,10 @@ public function run(AppInterface $application) throw $e; } } - } catch (\Exception $e) { - $this->terminate($e); - } catch (\Error $e) { + } catch (\Throwable $e) { $this->terminate($e); } + } // phpcs:enable /** From 296a0905267003b033bc9d71ecd1a4f8921e1f3d Mon Sep 17 00:00:00 2001 From: phil <philkun@users.noreply.github.com> Date: Thu, 24 Oct 2019 09:41:54 +0100 Subject: [PATCH 0071/1143] Allow autoplay for vimeo thumb click Currently on click a video thumb the video does not start, but the code to autoplay is incorrect since 2017 https://developers.google.com/web/updates/2017/09/autoplay-policy-changes --- .../Magento/ProductVideo/view/frontend/web/js/load-player.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/ProductVideo/view/frontend/web/js/load-player.js b/app/code/Magento/ProductVideo/view/frontend/web/js/load-player.js index ede0d2019309d..aead951043448 100644 --- a/app/code/Magento/ProductVideo/view/frontend/web/js/load-player.js +++ b/app/code/Magento/ProductVideo/view/frontend/web/js/load-player.js @@ -344,6 +344,7 @@ define([ .attr('mozallowfullscreen', '') .attr('allowfullscreen', '') .attr('referrerPolicy', 'origin') + .attr('allow', 'autoplay') ); this._player = window.$f(this.element.children(':first')[0]); From 738792efa1feb761dc4e9d5b6d8da3f7298db33c Mon Sep 17 00:00:00 2001 From: Andrey Nikolaev <tonikolaev@gmail.com> Date: Fri, 25 Oct 2019 08:51:32 +0300 Subject: [PATCH 0072/1143] Add lib wrapper for UUID validation. --- app/etc/di.xml | 1 + .../DataObject/IdentityValidator.php | 23 +++++++++++++++++++ .../DataObject/IdentityValidatorInterface.php | 21 +++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 lib/internal/Magento/Framework/DataObject/IdentityValidator.php create mode 100644 lib/internal/Magento/Framework/DataObject/IdentityValidatorInterface.php diff --git a/app/etc/di.xml b/app/etc/di.xml index f8818de2af842..27b85f0a924c0 100644 --- a/app/etc/di.xml +++ b/app/etc/di.xml @@ -167,6 +167,7 @@ <preference for="Magento\Framework\EntityManager\MapperInterface" type="Magento\Framework\EntityManager\CompositeMapper"/> <preference for="Magento\Framework\Console\CommandListInterface" type="Magento\Framework\Console\CommandList"/> <preference for="Magento\Framework\DataObject\IdentityGeneratorInterface" type="Magento\Framework\DataObject\IdentityService" /> + <preference for="Magento\Framework\DataObject\IdentityValidatorInterface" type="Magento\Framework\DataObject\IdentityValidator" /> <preference for="Magento\Framework\Serialize\SerializerInterface" type="Magento\Framework\Serialize\Serializer\Json" /> <preference for="Magento\Framework\App\Scope\ValidatorInterface" type="Magento\Framework\App\Scope\Validator"/> <preference for="Magento\Framework\App\ScopeResolverInterface" type="Magento\Framework\App\ScopeResolver" /> diff --git a/lib/internal/Magento/Framework/DataObject/IdentityValidator.php b/lib/internal/Magento/Framework/DataObject/IdentityValidator.php new file mode 100644 index 0000000000000..0aeb16dfbd9bd --- /dev/null +++ b/lib/internal/Magento/Framework/DataObject/IdentityValidator.php @@ -0,0 +1,23 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\DataObject; + +use Ramsey\Uuid\Uuid; + +/** + * Class IdentityValidator + */ +class IdentityValidator implements IdentityValidatorInterface +{ + /** + * @inheritDoc + */ + public function isValid($value) + { + $isValid = Uuid::isValid($value); + return $isValid; + } +} diff --git a/lib/internal/Magento/Framework/DataObject/IdentityValidatorInterface.php b/lib/internal/Magento/Framework/DataObject/IdentityValidatorInterface.php new file mode 100644 index 0000000000000..fd8b835665baf --- /dev/null +++ b/lib/internal/Magento/Framework/DataObject/IdentityValidatorInterface.php @@ -0,0 +1,21 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\DataObject; + +/** + * Interface IdentityValidatorInterface + */ +interface IdentityValidatorInterface +{ + /** + * Checks if uuid is valid + * + * @param string $value + * + * @return string + */ + public function isValid($value); +} From 10626e06c1ee25471e9338e32b866bb0706c3c2f Mon Sep 17 00:00:00 2001 From: Buba Suma <soumah@adobe.com> Date: Fri, 18 Oct 2019 18:02:22 -0500 Subject: [PATCH 0073/1143] MC-21807: Implement control over minimum_should_match for elasticsearch queries - Add ability to configure and apply minimum_should_match --- .../FieldsMappingPreprocessorInterface.php | 22 ++ .../Config/Backend/MinimumShouldMatch.php | 41 +++ .../SearchAdapter/Query/Builder/Match.php | 14 +- .../Config/Backend/MinimumShouldMatchTest.php | 75 ++++++ .../SearchAdapter/Query/Builder/MatchTest.php | 240 ++++++++++-------- .../Elasticsearch/etc/adminhtml/system.xml | 20 +- app/code/Magento/Elasticsearch/etc/config.xml | 2 + .../FieldMapper/AddDefaultSearchField.php | 33 +++ .../CopySearchableFieldsToSearchField.php | 52 ++++ .../Model/Client/Elasticsearch.php | 44 +++- .../FieldMapper/AddDefaultSearchFieldTest.php | 85 +++++++ .../CopySearchableFieldsToSearchFieldTest.php | 136 ++++++++++ .../Unit/Model/Client/ElasticsearchTest.php | 6 +- .../Elasticsearch6/etc/adminhtml/system.xml | 12 +- .../Magento/Elasticsearch6/etc/config.xml | 1 + app/code/Magento/Elasticsearch6/etc/di.xml | 9 + 16 files changed, 675 insertions(+), 117 deletions(-) create mode 100644 app/code/Magento/Elasticsearch/Model/Adapter/FieldsMappingPreprocessorInterface.php create mode 100644 app/code/Magento/Elasticsearch/Model/Config/Backend/MinimumShouldMatch.php create mode 100644 app/code/Magento/Elasticsearch/Test/Unit/Model/Config/Backend/MinimumShouldMatchTest.php create mode 100644 app/code/Magento/Elasticsearch6/Model/Adapter/FieldMapper/AddDefaultSearchField.php create mode 100644 app/code/Magento/Elasticsearch6/Model/Adapter/FieldMapper/CopySearchableFieldsToSearchField.php create mode 100644 app/code/Magento/Elasticsearch6/Test/Unit/Model/Adapter/FieldMapper/AddDefaultSearchFieldTest.php create mode 100644 app/code/Magento/Elasticsearch6/Test/Unit/Model/Adapter/FieldMapper/CopySearchableFieldsToSearchFieldTest.php diff --git a/app/code/Magento/Elasticsearch/Model/Adapter/FieldsMappingPreprocessorInterface.php b/app/code/Magento/Elasticsearch/Model/Adapter/FieldsMappingPreprocessorInterface.php new file mode 100644 index 0000000000000..6eea6560f7273 --- /dev/null +++ b/app/code/Magento/Elasticsearch/Model/Adapter/FieldsMappingPreprocessorInterface.php @@ -0,0 +1,22 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Elasticsearch\Model\Adapter; + +/** + * Modifies fields mapping before save + */ +interface FieldsMappingPreprocessorInterface +{ + /** + * Modifies fields mapping before save + * + * @param array $mapping + * @return array + */ + public function process(array $mapping): array; +} diff --git a/app/code/Magento/Elasticsearch/Model/Config/Backend/MinimumShouldMatch.php b/app/code/Magento/Elasticsearch/Model/Config/Backend/MinimumShouldMatch.php new file mode 100644 index 0000000000000..434270c62d3d9 --- /dev/null +++ b/app/code/Magento/Elasticsearch/Model/Config/Backend/MinimumShouldMatch.php @@ -0,0 +1,41 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Elasticsearch\Model\Config\Backend; + +use Magento\Framework\App\Config\Value; +use Magento\Framework\Exception\LocalizedException; + +/** + * Elasticsearch minimum should match data model + */ +class MinimumShouldMatch extends Value +{ + /** + * @inheritDoc + */ + public function beforeSave() + { + $result = parent::beforeSave(); + $this->validateValue(); + return $result; + } + + /** + * Validates config value + * + * @throws LocalizedException + */ + public function validateValue(): void + { + if (strlen($this->getValue()) && !preg_match('/^((\d+<)?-?\d+%?\s?)+$/', $this->getValue())) { + throw new LocalizedException( + __('Value for the field "%1" was not saved because of the incorrect format.', __('Minimum Terms to Match')) + ); + } + } +} diff --git a/app/code/Magento/Elasticsearch/SearchAdapter/Query/Builder/Match.php b/app/code/Magento/Elasticsearch/SearchAdapter/Query/Builder/Match.php index ddf75c0a78e25..8a44b58d35fb8 100644 --- a/app/code/Magento/Elasticsearch/SearchAdapter/Query/Builder/Match.php +++ b/app/code/Magento/Elasticsearch/SearchAdapter/Query/Builder/Match.php @@ -7,6 +7,7 @@ use Magento\Elasticsearch\Model\Adapter\FieldMapper\Product\AttributeProvider; use Magento\Elasticsearch\Model\Adapter\FieldMapper\Product\FieldProvider\FieldType\ResolverInterface as TypeResolver; +use Magento\Elasticsearch\Model\Config; use Magento\Elasticsearch\SearchAdapter\Query\ValueTransformerPool; use Magento\Framework\App\ObjectManager; use Magento\Framework\Search\Request\Query\BoolExpression; @@ -50,6 +51,10 @@ class Match implements QueryInterface * @var ValueTransformerPool */ private $valueTransformerPool; + /** + * @var Config + */ + private $config; /** * @param FieldMapperInterface $fieldMapper @@ -57,13 +62,15 @@ class Match implements QueryInterface * @param AttributeProvider|null $attributeProvider * @param TypeResolver|null $fieldTypeResolver * @param ValueTransformerPool|null $valueTransformerPool + * @param Config|null $config */ public function __construct( FieldMapperInterface $fieldMapper, array $preprocessorContainer, AttributeProvider $attributeProvider = null, TypeResolver $fieldTypeResolver = null, - ValueTransformerPool $valueTransformerPool = null + ValueTransformerPool $valueTransformerPool = null, + Config $config = null ) { $this->fieldMapper = $fieldMapper; $this->preprocessorContainer = $preprocessorContainer; @@ -73,6 +80,7 @@ public function __construct( ->get(TypeResolver::class); $this->valueTransformerPool = $valueTransformerPool ?? ObjectManager::getInstance() ->get(ValueTransformerPool::class); + $this->config = $config ?? ObjectManager::getInstance()->get(Config::class); } /** @@ -83,11 +91,15 @@ public function build(array $selectQuery, RequestQueryInterface $requestQuery, $ $queryValue = $this->prepareQuery($requestQuery->getValue(), $conditionType); $queries = $this->buildQueries($requestQuery->getMatches(), $queryValue); $requestQueryBoost = $requestQuery->getBoost() ?: 1; + $minimumShouldMatch = $this->config->getElasticsearchConfigData('minimum_should_match'); foreach ($queries as $query) { $queryBody = $query['body']; $matchKey = isset($queryBody['match_phrase']) ? 'match_phrase' : 'match'; foreach ($queryBody[$matchKey] as $field => $matchQuery) { $matchQuery['boost'] = $requestQueryBoost + $matchQuery['boost']; + if ($minimumShouldMatch) { + $matchQuery['minimum_should_match'] = $minimumShouldMatch; + } $queryBody[$matchKey][$field] = $matchQuery; } $selectQuery['bool'][$query['condition']][] = $queryBody; diff --git a/app/code/Magento/Elasticsearch/Test/Unit/Model/Config/Backend/MinimumShouldMatchTest.php b/app/code/Magento/Elasticsearch/Test/Unit/Model/Config/Backend/MinimumShouldMatchTest.php new file mode 100644 index 0000000000000..e8f3621eda25d --- /dev/null +++ b/app/code/Magento/Elasticsearch/Test/Unit/Model/Config/Backend/MinimumShouldMatchTest.php @@ -0,0 +1,75 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Elasticsearch\Test\Unit\Model\Config\Backend; + +use Magento\Elasticsearch\Model\Config\Backend\MinimumShouldMatch; +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use PHPUnit\Framework\TestCase; +use Throwable; + +/** + * Test elasticsearch minimum should match data model + */ +class MinimumShouldMatchTest extends TestCase +{ + /** + * @var MinimumShouldMatch + */ + private $model; + + /** + * @inheritDoc + */ + protected function setUp() + { + $objectManager = new ObjectManager($this); + $this->model = $objectManager->getObject(MinimumShouldMatch::class); + parent::setUp(); + } + + /** + * @param string $value + * @param bool $valid + * @dataProvider validateValueDataProvider + * @throws LocalizedException + */ + public function testValidateValue(string $value, bool $valid) + { + $this->model->setValue($value); + try { + $this->model->validateValue(); + } catch (Throwable $exception) { + $this->assertFalse($valid); + return; + } + $this->assertTrue($valid); + } + + /** + * @return array + */ + public function validateValueDataProvider(): array + { + return [ + ['3', true], + ['-2', true], + ['75%', true], + ['-25%', true], + ['3<90%', true], + ['2<-25% 9<-3', true], + ['90%<3', false], + ['<90%', false], + ['90%<', false], + ['-3<2', false], + ['two', false], + ['2<', false], + ['<2', false], + ]; + } +} diff --git a/app/code/Magento/Elasticsearch/Test/Unit/SearchAdapter/Query/Builder/MatchTest.php b/app/code/Magento/Elasticsearch/Test/Unit/SearchAdapter/Query/Builder/MatchTest.php index d0ffc6debcd8a..705b06e9769f2 100644 --- a/app/code/Magento/Elasticsearch/Test/Unit/SearchAdapter/Query/Builder/MatchTest.php +++ b/app/code/Magento/Elasticsearch/Test/Unit/SearchAdapter/Query/Builder/MatchTest.php @@ -9,14 +9,19 @@ use Magento\Elasticsearch\Model\Adapter\FieldMapper\Product\AttributeProvider; use Magento\Elasticsearch\Model\Adapter\FieldMapper\Product\FieldProvider\FieldType\ResolverInterface as TypeResolver; use Magento\Elasticsearch\Model\Adapter\FieldMapperInterface; +use Magento\Elasticsearch\Model\Config; use Magento\Elasticsearch\SearchAdapter\Query\Builder\Match as MatchQueryBuilder; use Magento\Elasticsearch\SearchAdapter\Query\ValueTransformerInterface; use Magento\Elasticsearch\SearchAdapter\Query\ValueTransformerPool; use Magento\Framework\Search\Request\Query\Match as MatchRequestQuery; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use PHPUnit\Framework\MockObject\MockObject as MockObject; +use PHPUnit\Framework\TestCase; -class MatchTest extends \PHPUnit\Framework\TestCase +/** + * Test Match query builder + */ +class MatchTest extends TestCase { /** * @var AttributeProvider|MockObject @@ -32,6 +37,14 @@ class MatchTest extends \PHPUnit\Framework\TestCase * @var MatchQueryBuilder */ private $matchQueryBuilder; + /** + * @var MockObject + */ + private $config; + /** + * @var MockObject + */ + private $fieldMapper; /** * @inheritdoc @@ -40,22 +53,25 @@ protected function setUp() { $this->attributeProvider = $this->createMock(AttributeProvider::class); $this->fieldTypeResolver = $this->createMock(TypeResolver::class); - + $this->config = $this->createMock(Config::class); + $this->fieldMapper = $this->getMockForAbstractClass(FieldMapperInterface::class); + $this->fieldMapper->method('getFieldName') + ->willReturnArgument(0); $valueTransformerPoolMock = $this->createMock(ValueTransformerPool::class); $valueTransformerMock = $this->createMock(ValueTransformerInterface::class); $valueTransformerPoolMock->method('get') ->willReturn($valueTransformerMock); $valueTransformerMock->method('transform') ->willReturnArgument(0); - $this->matchQueryBuilder = (new ObjectManager($this))->getObject( MatchQueryBuilder::class, [ - 'fieldMapper' => $this->getFieldMapper(), + 'fieldMapper' => $this->fieldMapper, 'preprocessorContainer' => [], 'attributeProvider' => $this->attributeProvider, 'fieldTypeResolver' => $this->fieldTypeResolver, 'valueTransformerPool' => $valueTransformerPoolMock, + 'config' => $this->config, ] ); } @@ -63,130 +79,146 @@ protected function setUp() /** * Tests that method constructs a correct select query. * - * @see MatchQueryBuilder::build + * @param string $searchQuery + * @param array $fields + * @param array $expected + * @param string|null $minimumShouldMatch + * @dataProvider buildDataProvider */ - public function testBuild() - { - $attributeAdapter = $this->createMock(AttributeAdapter::class); - $this->attributeProvider->expects($this->once()) - ->method('getByAttributeCode') - ->with('some_field') - ->willReturn($attributeAdapter); - $this->fieldTypeResolver->expects($this->once()) - ->method('getFieldType') - ->with($attributeAdapter) - ->willReturn('text'); - - $rawQueryValue = 'query_value'; - $selectQuery = $this->matchQueryBuilder->build([], $this->getMatchRequestQuery($rawQueryValue), 'not'); + public function testBuild( + string $searchQuery, + array $fields, + array $expected, + ?string $minimumShouldMatch = null + ) { + $this->config->method('getElasticsearchConfigData') + ->with('minimum_should_match') + ->willReturn($minimumShouldMatch); + + foreach ($fields as $field) { + $this->mockAttribute($field['field']); + } + + $requestQuery = new MatchRequestQuery('match', $searchQuery, 1, $fields); + $query = $this->matchQueryBuilder->build([], $requestQuery, 'should'); $expectedSelectQuery = [ 'bool' => [ - 'must_not' => [ + 'should' => $expected, + ], + ]; + + $this->assertEquals( + $expectedSelectQuery, + $query + ); + } + + /** + * @return array + */ + public function buildDataProvider(): array + { + return [ + 'match query without minimum_should_match' => [ + 'fitness bottle', + [ + [ + 'field' => 'name', + 'boost' => 5 + ] + ], + [ + [ + 'match' => [ + 'name' => [ + 'query' => 'fitness bottle', + 'boost' => 6, + ], + ], + ], + ] + ], + 'match_phrase query without minimum_should_match' => [ + '"fitness bottle"', + [ + [ + 'field' => 'name', + 'boost' => 5 + ] + ], + [ + [ + 'match_phrase' => [ + 'name' => [ + 'query' => 'fitness bottle', + 'boost' => 6, + ], + ], + ], + ] + ], + 'match query with minimum_should_match' => [ + 'fitness bottle', + [ + [ + 'field' => 'name', + 'boost' => 5 + ] + ], + [ [ 'match' => [ - 'some_field' => [ - 'query' => $rawQueryValue, - 'boost' => 43, + 'name' => [ + 'query' => 'fitness bottle', + 'boost' => 6, + 'minimum_should_match' => '2<75%', ], ], ], ], + '2<75%' ], + 'match_phrase query with minimum_should_match' => [ + '"fitness bottle"', + [ + [ + 'field' => 'name', + 'boost' => 5 + ] + ], + [ + [ + 'match_phrase' => [ + 'name' => [ + 'query' => 'fitness bottle', + 'boost' => 6, + 'minimum_should_match' => '2<75%', + ], + ], + ], + ], + '2<75%' + ] ]; - $this->assertEquals($expectedSelectQuery, $selectQuery); } /** - * Tests that method constructs a correct "match" query depending on query value. - * - * @dataProvider matchProvider + * Mock attribute * - * @param string $rawQueryValue - * @param string $queryValue - * @param string $match + * @param string $attributeCode + * @param string $type */ - public function testBuildMatchQuery($rawQueryValue, $queryValue, $match) + private function mockAttribute(string $attributeCode, string $type = 'text') { $attributeAdapter = $this->createMock(AttributeAdapter::class); $this->attributeProvider->expects($this->once()) ->method('getByAttributeCode') - ->with('some_field') + ->with($attributeCode) ->willReturn($attributeAdapter); $this->fieldTypeResolver->expects($this->once()) ->method('getFieldType') ->with($attributeAdapter) - ->willReturn('text'); - - $query = $this->matchQueryBuilder->build([], $this->getMatchRequestQuery($rawQueryValue), 'should'); - - $expectedSelectQuery = [ - 'bool' => [ - 'should' => [ - [ - $match => [ - 'some_field' => [ - 'query' => $queryValue, - 'boost' => 43, - ], - ], - ], - ], - ], - ]; - - $this->assertEquals( - $expectedSelectQuery, - $query, - sprintf('Wrong "match" query. Should be processed with "%s"', $match) - ); - } - - /** - * @return array - */ - public function matchProvider() - { - return [ - ['query_value', 'query_value', 'match'], - ['"query value"', 'query value', 'match_phrase'], - ]; - } - - /** - * Gets fieldMapper mock object. - * - * @return FieldMapperInterface|MockObject - */ - private function getFieldMapper() - { - $fieldMapper = $this->getMockBuilder(FieldMapperInterface::class) - ->getMockForAbstractClass(); - - $fieldMapper->method('getFieldName') - ->with('some_field', ['type' => FieldMapperInterface::TYPE_QUERY]) - ->willReturnArgument(0); - - return $fieldMapper; - } - - /** - * Gets RequestQuery mock object. - * - * @param string $rawQueryValue - * @return MatchRequestQuery|MockObject - */ - private function getMatchRequestQuery($rawQueryValue) - { - $matchRequestQuery = $this->getMockBuilder(MatchRequestQuery::class) - ->disableOriginalConstructor() - ->getMock(); - - $matchRequestQuery->method('getValue') - ->willReturn($rawQueryValue); - $matchRequestQuery->method('getMatches') - ->willReturn([['field' => 'some_field', 'boost' => 42]]); - - return $matchRequestQuery; + ->willReturn($type); } } diff --git a/app/code/Magento/Elasticsearch/etc/adminhtml/system.xml b/app/code/Magento/Elasticsearch/etc/adminhtml/system.xml index dd42b408ff75e..1f61a48db9bfa 100644 --- a/app/code/Magento/Elasticsearch/etc/adminhtml/system.xml +++ b/app/code/Magento/Elasticsearch/etc/adminhtml/system.xml @@ -55,7 +55,15 @@ <field id="engine">elasticsearch</field> </depends> </field> - <field id="elasticsearch_test_connect_wizard" translate="button_label" sortOrder="68" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="elasticsearch_minimum_should_match" translate="label" type="text" sortOrder="68" showInDefault="1" showInWebsite="0" showInStore="0"> + <label>Minimum Terms to Match</label> + <depends> + <field id="engine">elasticsearch</field> + </depends> + <comment><![CDATA[See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-minimum-should-match.html">here</a> for possible values.]]></comment> + <backend_model>Magento\Elasticsearch\Model\Config\Backend\MinimumShouldMatch</backend_model> + </field> + <field id="elasticsearch_test_connect_wizard" translate="button_label" sortOrder="69" showInDefault="1" showInWebsite="0" showInStore="0"> <label/> <button_label>Test Connection</button_label> <frontend_model>Magento\Elasticsearch\Block\Adminhtml\System\Config\TestConnection</frontend_model> @@ -109,7 +117,15 @@ <field id="engine">elasticsearch5</field> </depends> </field> - <field id="elasticsearch5_test_connect_wizard" translate="button_label" sortOrder="68" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="elasticsearch5_minimum_should_match" translate="label" type="text" sortOrder="68" showInDefault="1" showInWebsite="0" showInStore="0"> + <label>Minimum Terms to Match</label> + <depends> + <field id="engine">elasticsearch5</field> + </depends> + <comment><![CDATA[See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-minimum-should-match.html">here</a> for possible values.]]></comment> + <backend_model>Magento\Elasticsearch\Model\Config\Backend\MinimumShouldMatch</backend_model> + </field> + <field id="elasticsearch5_test_connect_wizard" translate="button_label" sortOrder="69" showInDefault="1" showInWebsite="0" showInStore="0"> <label/> <button_label>Test Connection</button_label> <frontend_model>Magento\Elasticsearch\Block\Adminhtml\System\Config\Elasticsearch5\TestConnection</frontend_model> diff --git a/app/code/Magento/Elasticsearch/etc/config.xml b/app/code/Magento/Elasticsearch/etc/config.xml index 0e01aba5ed857..9df21978b5414 100644 --- a/app/code/Magento/Elasticsearch/etc/config.xml +++ b/app/code/Magento/Elasticsearch/etc/config.xml @@ -14,12 +14,14 @@ <elasticsearch_index_prefix>magento2</elasticsearch_index_prefix> <elasticsearch_enable_auth>0</elasticsearch_enable_auth> <elasticsearch_server_timeout>15</elasticsearch_server_timeout> + <elasticsearch_minimum_should_match></elasticsearch_minimum_should_match> <elasticsearch5_server_hostname>localhost</elasticsearch5_server_hostname> <elasticsearch5_server_port>9200</elasticsearch5_server_port> <elasticsearch5_index_prefix>magento2</elasticsearch5_index_prefix> <elasticsearch5_enable_auth>0</elasticsearch5_enable_auth> <elasticsearch5_server_timeout>15</elasticsearch5_server_timeout> + <elasticsearch5_minimum_should_match></elasticsearch5_minimum_should_match> </search> </catalog> </default> diff --git a/app/code/Magento/Elasticsearch6/Model/Adapter/FieldMapper/AddDefaultSearchField.php b/app/code/Magento/Elasticsearch6/Model/Adapter/FieldMapper/AddDefaultSearchField.php new file mode 100644 index 0000000000000..27767f6567d96 --- /dev/null +++ b/app/code/Magento/Elasticsearch6/Model/Adapter/FieldMapper/AddDefaultSearchField.php @@ -0,0 +1,33 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Elasticsearch6\Model\Adapter\FieldMapper; + +use Magento\Elasticsearch\Model\Adapter\FieldsMappingPreprocessorInterface; + +/** + * Add default search field (catch all field) to the mapping. + */ +class AddDefaultSearchField implements FieldsMappingPreprocessorInterface +{ + /** + * catch all field name + */ + private const NAME = '_search'; + /** + * Add default search field (catch all field) to the fields. + * + * Emulates catch all field (_all) for elasticsearch version 6.0+ + * + * @param array $mapping + * @return array + */ + public function process(array $mapping): array + { + return [self::NAME => ['type' => 'text']] + $mapping; + } +} diff --git a/app/code/Magento/Elasticsearch6/Model/Adapter/FieldMapper/CopySearchableFieldsToSearchField.php b/app/code/Magento/Elasticsearch6/Model/Adapter/FieldMapper/CopySearchableFieldsToSearchField.php new file mode 100644 index 0000000000000..6179eacba5ad7 --- /dev/null +++ b/app/code/Magento/Elasticsearch6/Model/Adapter/FieldMapper/CopySearchableFieldsToSearchField.php @@ -0,0 +1,52 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Elasticsearch6\Model\Adapter\FieldMapper; + +use Magento\Elasticsearch\Model\Adapter\FieldsMappingPreprocessorInterface; + +/** + * Add "copy_to" parameter for default search field to index fields. + */ +class CopySearchableFieldsToSearchField implements FieldsMappingPreprocessorInterface +{ + /** + * List of field types to copy + */ + private const FIELD_TYPES = ['text', 'keyword']; + /** + * Add "copy_to" parameter for default search field to index fields. + * + * Emulates catch all field (_all) for elasticsearch version 6.0+ + * + * @param array $mapping + * @return array + */ + public function process(array $mapping): array + { + foreach ($mapping as $field => $definition) { + if ($this->isSearchable($definition)) { + $definition['copy_to'][] = '_search'; + $mapping[$field] = $definition; + } + } + return $mapping; + } + + /** + * Determine if the field is searchable by mapping + * + * The field is searchable if it's indexed and its mapping type is either "text" or "keyword" + * + * @param array $mapping + * @return bool + */ + private function isSearchable(array $mapping): bool + { + return in_array($mapping['type'] ?? null, self::FIELD_TYPES) && (($mapping['index'] ?? true) !== false); + } +} diff --git a/app/code/Magento/Elasticsearch6/Model/Client/Elasticsearch.php b/app/code/Magento/Elasticsearch6/Model/Client/Elasticsearch.php index 34129a5af0012..c72ce4776909e 100644 --- a/app/code/Magento/Elasticsearch6/Model/Client/Elasticsearch.php +++ b/app/code/Magento/Elasticsearch6/Model/Client/Elasticsearch.php @@ -5,8 +5,9 @@ */ namespace Magento\Elasticsearch6\Model\Client; -use Magento\Framework\Exception\LocalizedException; use Magento\AdvancedSearch\Model\Client\ClientInterface; +use Magento\Elasticsearch\Model\Adapter\FieldsMappingPreprocessorInterface; +use Magento\Framework\Exception\LocalizedException; /** * Elasticsearch client @@ -29,17 +30,23 @@ class Elasticsearch implements ClientInterface * @var bool */ private $pingResult; + /** + * @var FieldsMappingPreprocessorInterface[] + */ + private $fieldsMappingPreprocessors; /** * Initialize Elasticsearch Client * * @param array $options * @param \Elasticsearch\Client|null $elasticsearchClient + * @param FieldsMappingPreprocessorInterface[] $fieldsMappingPreprocessors * @throws LocalizedException */ public function __construct( $options = [], - $elasticsearchClient = null + $elasticsearchClient = null, + $fieldsMappingPreprocessors = [] ) { if (empty($options['hostname']) || ((!empty($options['enableAuth']) && ($options['enableAuth'] == 1)) && (empty($options['username']) || empty($options['password'])))) { @@ -54,6 +61,17 @@ public function __construct( } $this->client[getmypid()] = $elasticsearchClient; $this->clientOptions = $options; + foreach ($fieldsMappingPreprocessors as $preprocessor) { + if (!$preprocessor instanceof FieldsMappingPreprocessorInterface) { + throw new \InvalidArgumentException( + sprintf( + 'Instance of FieldsMappingPreprocessorInterface is expected, got %s instead.', + get_class($preprocessor) + ) + ); + } + } + $this->fieldsMappingPreprocessors = $fieldsMappingPreprocessors; } /** @@ -249,11 +267,7 @@ public function addFieldsMapping(array $fields, $index, $entityType) 'type' => $entityType, 'body' => [ $entityType => [ - 'properties' => [ - '_search' => [ - 'type' => 'text' - ], - ], + 'properties' => [], 'dynamic_templates' => [ [ 'price_mapping' => [ @@ -291,7 +305,7 @@ public function addFieldsMapping(array $fields, $index, $entityType) ], ]; - foreach ($fields as $field => $fieldInfo) { + foreach ($this->applyFieldsMappingPreprocessors($fields) as $field => $fieldInfo) { $params['body'][$entityType]['properties'][$field] = $fieldInfo; } @@ -336,4 +350,18 @@ public function suggest($query) { return $this->getClient()->suggest($query); } + + /** + * Apply fields mapping preprocessors + * + * @param array $properties + * @return array + */ + private function applyFieldsMappingPreprocessors(array $properties): array + { + foreach ($this->fieldsMappingPreprocessors as $preprocessor) { + $properties = $preprocessor->process($properties); + } + return $properties; + } } diff --git a/app/code/Magento/Elasticsearch6/Test/Unit/Model/Adapter/FieldMapper/AddDefaultSearchFieldTest.php b/app/code/Magento/Elasticsearch6/Test/Unit/Model/Adapter/FieldMapper/AddDefaultSearchFieldTest.php new file mode 100644 index 0000000000000..7da68168f8c97 --- /dev/null +++ b/app/code/Magento/Elasticsearch6/Test/Unit/Model/Adapter/FieldMapper/AddDefaultSearchFieldTest.php @@ -0,0 +1,85 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Elasticsearch6\Test\Unit\Model\Adapter\FieldMapper; + +use Magento\Elasticsearch6\Model\Adapter\FieldMapper\AddDefaultSearchField; +use Magento\Framework\TestFramework\Unit\BaseTestCase; + +/** + * Test mapping preprocessor AddDefaultSearchField + */ +class AddDefaultSearchFieldTest extends BaseTestCase +{ + /** + * @var AddDefaultSearchField + */ + private $model; + + /** + * @inheritDoc + */ + protected function setUp() + { + parent::setUp(); + $this->model = $this->objectManager->getObject(AddDefaultSearchField::class); + } + + /** + * Test default search field "_search" should be prepended and overwrite if exist. + * + * @dataProvider processDataProvider + * @param array $mappingBefore + * @param array $mappingAfter + */ + public function testProcess(array $mappingBefore, array $mappingAfter) + { + $this->assertEquals($mappingAfter, $this->model->process($mappingBefore)); + } + + /** + * @return array + */ + public function processDataProvider(): array + { + return [ + '_search field should be prepended if not exist' => [ + [ + 'name' => [ + 'type' => 'text' + ] + ], + [ + '_search' => [ + 'type' => 'text' + ], + 'name' => [ + 'type' => 'text' + ] + ] + ], + '_search field should be prepended and overwrite if exist' => [ + [ + 'name' => [ + 'type' => 'text', + ], + '_search' => [ + 'type' => 'keyword' + ], + ], + [ + '_search' => [ + 'type' => 'text' + ], + 'name' => [ + 'type' => 'text', + ] + ] + ] + ]; + } +} diff --git a/app/code/Magento/Elasticsearch6/Test/Unit/Model/Adapter/FieldMapper/CopySearchableFieldsToSearchFieldTest.php b/app/code/Magento/Elasticsearch6/Test/Unit/Model/Adapter/FieldMapper/CopySearchableFieldsToSearchFieldTest.php new file mode 100644 index 0000000000000..c366e55fbbdf7 --- /dev/null +++ b/app/code/Magento/Elasticsearch6/Test/Unit/Model/Adapter/FieldMapper/CopySearchableFieldsToSearchFieldTest.php @@ -0,0 +1,136 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Elasticsearch6\Test\Unit\Model\Adapter\FieldMapper; + +use Magento\Elasticsearch6\Model\Adapter\FieldMapper\CopySearchableFieldsToSearchField; +use Magento\Framework\TestFramework\Unit\BaseTestCase; + +/** + * Test mapping preprocessor CopySearchableFieldsToSearchField + */ +class CopySearchableFieldsToSearchFieldTest extends BaseTestCase +{ + /** + * @var CopySearchableFieldsToSearchField + */ + private $model; + + /** + * @inheritDoc + */ + protected function setUp() + { + parent::setUp(); + $this->model = $this->objectManager->getObject(CopySearchableFieldsToSearchField::class); + } + + /** + * Test "copy_to" parameter should be added to searchable fields. + * + * @dataProvider processDataProvider + * @param array $mappingBefore + * @param array $mappingAfter + */ + public function testProcess(array $mappingBefore, array $mappingAfter) + { + $this->assertEquals($mappingAfter, $this->model->process($mappingBefore)); + } + + /** + * @return array + */ + public function processDataProvider(): array + { + return [ + 'index text field should be copied' => [ + [ + 'name' => [ + 'type' => 'text' + ] + ], + [ + 'name' => [ + 'type' => 'text', + 'copy_to' => [ + '_search' + ] + ] + ] + ], + 'non-index text field should not be copied' => [ + [ + 'name' => [ + 'type' => 'text', + 'index' => false + ] + ], + [ + 'name' => [ + 'type' => 'text', + 'index' => false + ] + ] + ], + 'index keyword field should be copied' => [ + [ + 'material' => [ + 'type' => 'keyword' + ] + ], + [ + 'material' => [ + 'type' => 'keyword', + 'copy_to' => [ + '_search' + ] + ] + ] + ], + 'non-index keyword field should not be copied' => [ + [ + 'country_of_manufacture' => [ + 'type' => 'keyword', + 'index' => false + ] + ], + [ + 'country_of_manufacture' => [ + 'type' => 'keyword', + 'index' => false + ] + ] + ], + 'index integer field should not be copied' => [ + [ + 'sale' => [ + 'type' => 'integer', + ] + ], + [ + 'sale' => [ + 'type' => 'integer', + ] + ] + ], + 'non-index integer field should not be copied' => [ + [ + 'position_category_1' => [ + 'type' => 'integer', + 'index' => false + ] + ], + [ + 'position_category_1' => [ + 'type' => 'integer', + 'index' => false + ] + ] + ], + ]; + } +} diff --git a/app/code/Magento/Elasticsearch6/Test/Unit/Model/Client/ElasticsearchTest.php b/app/code/Magento/Elasticsearch6/Test/Unit/Model/Client/ElasticsearchTest.php index 487a5a886f951..b7cca13fdefef 100644 --- a/app/code/Magento/Elasticsearch6/Test/Unit/Model/Client/ElasticsearchTest.php +++ b/app/code/Magento/Elasticsearch6/Test/Unit/Model/Client/ElasticsearchTest.php @@ -6,6 +6,7 @@ namespace Magento\Elasticsearch6\Test\Unit\Model\Client; use Magento\Elasticsearch\Model\Client\Elasticsearch as ElasticsearchClient; +use Magento\Elasticsearch6\Model\Adapter\FieldMapper\AddDefaultSearchField; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; /** @@ -86,7 +87,10 @@ protected function setUp() \Magento\Elasticsearch6\Model\Client\Elasticsearch::class, [ 'options' => $this->getOptions(), - 'elasticsearchClient' => $this->elasticsearchClientMock + 'elasticsearchClient' => $this->elasticsearchClientMock, + 'fieldsMappingPreprocessors' => [ + new AddDefaultSearchField() + ] ] ); } diff --git a/app/code/Magento/Elasticsearch6/etc/adminhtml/system.xml b/app/code/Magento/Elasticsearch6/etc/adminhtml/system.xml index 067a0acb8c908..8d22fcbc5f8f4 100644 --- a/app/code/Magento/Elasticsearch6/etc/adminhtml/system.xml +++ b/app/code/Magento/Elasticsearch6/etc/adminhtml/system.xml @@ -70,7 +70,17 @@ </depends> </field> - <field id="elasticsearch6_test_connect_wizard" translate="button_label" sortOrder="78" showInDefault="1" + <field id="elasticsearch6_minimum_should_match" translate="label" type="text" sortOrder="78" showInDefault="1" + showInWebsite="0" showInStore="0"> + <label>Minimum Terms to Match</label> + <depends> + <field id="engine">elasticsearch6</field> + </depends> + <comment><![CDATA[See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-minimum-should-match.html">here</a> for possible values.]]></comment> + <backend_model>Magento\Elasticsearch\Model\Config\Backend\MinimumShouldMatch</backend_model> + </field> + + <field id="elasticsearch6_test_connect_wizard" translate="button_label" sortOrder="79" showInDefault="1" showInWebsite="0" showInStore="0"> <label/> <button_label>Test Connection</button_label> diff --git a/app/code/Magento/Elasticsearch6/etc/config.xml b/app/code/Magento/Elasticsearch6/etc/config.xml index 047ae977fdef1..3c0f28ee16eaa 100644 --- a/app/code/Magento/Elasticsearch6/etc/config.xml +++ b/app/code/Magento/Elasticsearch6/etc/config.xml @@ -14,6 +14,7 @@ <elasticsearch6_index_prefix>magento2</elasticsearch6_index_prefix> <elasticsearch6_enable_auth>0</elasticsearch6_enable_auth> <elasticsearch6_server_timeout>15</elasticsearch6_server_timeout> + <elasticsearch6_minimum_should_match></elasticsearch6_minimum_should_match> </search> </catalog> </default> diff --git a/app/code/Magento/Elasticsearch6/etc/di.xml b/app/code/Magento/Elasticsearch6/etc/di.xml index 580c61ffc8cdb..6419b0aa3ee73 100644 --- a/app/code/Magento/Elasticsearch6/etc/di.xml +++ b/app/code/Magento/Elasticsearch6/etc/di.xml @@ -111,6 +111,15 @@ </arguments> </type> + <type name="Magento\Elasticsearch6\Model\Client\Elasticsearch"> + <arguments> + <argument name="fieldsMappingPreprocessors" xsi:type="array"> + <item name="elasticsearch6_copy_searchable_fields_to_search_field" xsi:type="object">Magento\Elasticsearch6\Model\Adapter\FieldMapper\CopySearchableFieldsToSearchField</item> + <item name="elasticsearch6_add_default_search_field" xsi:type="object">Magento\Elasticsearch6\Model\Adapter\FieldMapper\AddDefaultSearchField</item> + </argument> + </arguments> + </type> + <type name="Magento\Framework\Search\Dynamic\IntervalFactory"> <arguments> <argument name="intervals" xsi:type="array"> From 6bf9b7a2e1371654647fd912b53baacc5b4dc161 Mon Sep 17 00:00:00 2001 From: Andrey Nikolaev <tonikolaev@gmail.com> Date: Sun, 27 Oct 2019 12:39:20 +0300 Subject: [PATCH 0074/1143] Declare strict types --- .../Magento/Framework/DataObject/IdentityValidator.php | 4 +++- .../Framework/DataObject/IdentityValidatorInterface.php | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/internal/Magento/Framework/DataObject/IdentityValidator.php b/lib/internal/Magento/Framework/DataObject/IdentityValidator.php index 0aeb16dfbd9bd..b17e04585531a 100644 --- a/lib/internal/Magento/Framework/DataObject/IdentityValidator.php +++ b/lib/internal/Magento/Framework/DataObject/IdentityValidator.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Framework\DataObject; use Ramsey\Uuid\Uuid; @@ -15,7 +17,7 @@ class IdentityValidator implements IdentityValidatorInterface /** * @inheritDoc */ - public function isValid($value) + public function isValid(string $value): bool { $isValid = Uuid::isValid($value); return $isValid; diff --git a/lib/internal/Magento/Framework/DataObject/IdentityValidatorInterface.php b/lib/internal/Magento/Framework/DataObject/IdentityValidatorInterface.php index fd8b835665baf..a1979721f0cc9 100644 --- a/lib/internal/Magento/Framework/DataObject/IdentityValidatorInterface.php +++ b/lib/internal/Magento/Framework/DataObject/IdentityValidatorInterface.php @@ -15,7 +15,7 @@ interface IdentityValidatorInterface * * @param string $value * - * @return string + * @return bool */ - public function isValid($value); + public function isValid(string $value): bool; } From 529c46f8d445cfb27c58519bf0caab398c15d1c7 Mon Sep 17 00:00:00 2001 From: Marc Rodriguez <marc.rodriguez@interactiv4.com> Date: Sun, 27 Oct 2019 14:36:07 +0100 Subject: [PATCH 0075/1143] Error in vendor/magento/module-shipping/Model/Config/Source/Allmethods.php - public function toOptionArray --- app/code/Magento/Shipping/Model/Config/Source/Allmethods.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/code/Magento/Shipping/Model/Config/Source/Allmethods.php b/app/code/Magento/Shipping/Model/Config/Source/Allmethods.php index e310df8ed11cb..bafb9ed49cf30 100644 --- a/app/code/Magento/Shipping/Model/Config/Source/Allmethods.php +++ b/app/code/Magento/Shipping/Model/Config/Source/Allmethods.php @@ -56,6 +56,11 @@ public function toOptionArray($isActiveOnlyFlag = false) ); $methods[$carrierCode] = ['label' => $carrierTitle, 'value' => []]; foreach ($carrierMethods as $methodCode => $methodTitle) { + + /** Check it $carrierMethods array was well formed */ + if (!$methodCode) { + continue; + } $methods[$carrierCode]['value'][] = [ 'value' => $carrierCode . '_' . $methodCode, 'label' => '[' . $carrierCode . '] ' . $methodTitle, From bf87df0b47014a7c083ff8fd4a3f6b4e0c157a61 Mon Sep 17 00:00:00 2001 From: Andrey Nikolaev <tonikolaev@gmail.com> Date: Sun, 27 Oct 2019 17:59:07 +0300 Subject: [PATCH 0076/1143] Cover identity validator with integration tests --- .../DataObject/IdentityValidatorTest.php | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/Framework/DataObject/IdentityValidatorTest.php diff --git a/dev/tests/integration/testsuite/Magento/Framework/DataObject/IdentityValidatorTest.php b/dev/tests/integration/testsuite/Magento/Framework/DataObject/IdentityValidatorTest.php new file mode 100644 index 0000000000000..15f54ba01a795 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/DataObject/IdentityValidatorTest.php @@ -0,0 +1,41 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\DataObject; + +class IdentityValidatorTest extends \PHPUnit\Framework\TestCase +{ + const VALID_UUID = 'fe563e12-cf9d-4faf-82cd-96e011b557b7'; + const INVALID_UUID = 'abcdef'; + + /** + * @var IdentityValidator + */ + protected $identityValidator; + + protected function setUp() + { + $this->identityValidator = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get(IdentityValidator::class); + } + + public function testIsValid() + { + $isValid = $this->identityValidator->isValid(self::VALID_UUID); + $this->assertEquals(true, $isValid); + } + + public function testIsNotValid() + { + $isValid = $this->identityValidator->isValid(self::INVALID_UUID); + $this->assertEquals(false, $isValid); + } + + public function testEmptyValue() + { + $isValid = $this->identityValidator->isValid(''); + $this->assertEquals(false, $isValid); + } +} From b6bd937a8276924191c8bf753889941636cecd2d Mon Sep 17 00:00:00 2001 From: Raul Verdugo <rverdugo@onestic.com> Date: Sun, 27 Oct 2019 16:56:56 +0100 Subject: [PATCH 0077/1143] #13865 create a popup to advice about navigator blocked cookies --- .../frontend/layout/default_head_blocks.xml | 1 + .../Theme/view/frontend/requirejs-config.js | 3 +- .../frontend/templates/js/cookie_status.phtml | 20 ++++++++++ .../view/frontend/web/js/cookie-status.js | 38 +++++++++++++++++++ 4 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 app/code/Magento/Theme/view/frontend/templates/js/cookie_status.phtml create mode 100644 app/code/Magento/Theme/view/frontend/web/js/cookie-status.js diff --git a/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml b/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml index ab4dabfa6d1a0..a4a10ef3f6ee9 100644 --- a/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml +++ b/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml @@ -23,6 +23,7 @@ </referenceBlock> <referenceContainer name="after.body.start"> <block class="Magento\Framework\View\Element\Js\Components" name="head.components" as="components" template="Magento_Theme::js/components.phtml" before="-"/> + <block class="Magento\Framework\View\Element\Template" name="cookie-status-check" as="cookie-status" template="Magento_Theme::js/cookie_status.phtml" /> </referenceContainer> </body> </page> diff --git a/app/code/Magento/Theme/view/frontend/requirejs-config.js b/app/code/Magento/Theme/view/frontend/requirejs-config.js index c41a0602ef3e8..b5ffd358c893b 100644 --- a/app/code/Magento/Theme/view/frontend/requirejs-config.js +++ b/app/code/Magento/Theme/view/frontend/requirejs-config.js @@ -30,7 +30,8 @@ var config = { 'welcome': 'Magento_Theme/js/view/welcome', 'breadcrumbs': 'Magento_Theme/js/view/breadcrumbs', 'criticalCssLoader': 'Magento_Theme/js/view/critical-css-loader', - 'jquery/ui': 'jquery/compat' + 'jquery/ui': 'jquery/compat', + 'cookieStatus': 'Magento_Theme/js/cookie-status' } }, deps: [ diff --git a/app/code/Magento/Theme/view/frontend/templates/js/cookie_status.phtml b/app/code/Magento/Theme/view/frontend/templates/js/cookie_status.phtml new file mode 100644 index 0000000000000..833daf43a4570 --- /dev/null +++ b/app/code/Magento/Theme/view/frontend/templates/js/cookie_status.phtml @@ -0,0 +1,20 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +?> + +<div id="cookie-status" style="display: none"> + <?= __('The store will not work correctly in the case when cookies are disabled.') ?> +</div> + +<script type="text/x-magento-init"> + { + "*": { + "cookieStatus": {} + } + } +</script> + + diff --git a/app/code/Magento/Theme/view/frontend/web/js/cookie-status.js b/app/code/Magento/Theme/view/frontend/web/js/cookie-status.js new file mode 100644 index 0000000000000..f736d4366440c --- /dev/null +++ b/app/code/Magento/Theme/view/frontend/web/js/cookie-status.js @@ -0,0 +1,38 @@ +define([ + 'jquery', + 'mage/translate', + 'Magento_Ui/js/modal/modal' +], function($, $tr, modal){ + 'use strict'; + + $.widget('mage.cookieStatus', { + /** + * Init object + * @private + */ + _init: function () { + + if(!navigator.cookieEnabled) { + console.log('popup'); + + const options = { + type: 'popup', + responsive: true, + innerScroll: true, + autoOpen: true, + buttons: [{ + text: $.mage.__('Close'), + class: 'cookie-status', + click: function () { + this.closeModal(); + } + }] + }; + + modal(options, $('#cookie-status')); + } + } + }); + + return $.mage.cookieStatus; +}); \ No newline at end of file From 7e527d8706a4590075219fb10080e009d8da3422 Mon Sep 17 00:00:00 2001 From: Raul Verdugo <rverdugo@onestic.com> Date: Sun, 27 Oct 2019 17:01:15 +0100 Subject: [PATCH 0078/1143] #13865 remove console log --- app/code/Magento/Theme/view/frontend/web/js/cookie-status.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/code/Magento/Theme/view/frontend/web/js/cookie-status.js b/app/code/Magento/Theme/view/frontend/web/js/cookie-status.js index f736d4366440c..20090bc67befc 100644 --- a/app/code/Magento/Theme/view/frontend/web/js/cookie-status.js +++ b/app/code/Magento/Theme/view/frontend/web/js/cookie-status.js @@ -13,8 +13,6 @@ define([ _init: function () { if(!navigator.cookieEnabled) { - console.log('popup'); - const options = { type: 'popup', responsive: true, From 74892074f9bbed128a4c0c2e7c14a8f47d317755 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Mon, 28 Oct 2019 14:29:51 +0200 Subject: [PATCH 0079/1143] magento/magento2#22856: Integration test fix. --- .../Magento/Catalog/Block/Product/View/OptionsTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/OptionsTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/OptionsTest.php index 8997920ac1e3a..3d767502dd784 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/OptionsTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/OptionsTest.php @@ -152,7 +152,7 @@ private function getExpectedJsonConfig() public function testGetJsonConfigWithCatalogRules() { $this->indexBuilder->reindexFull(); - + sleep(1); $config = json_decode($this->block->getJsonConfig(), true); $configValues = array_values($config); $this->assertEquals($this->getExpectedJsonConfigWithCatalogRules(), array_values($configValues[0])); From c1c06cc71657fe264c24f7cbf9c54a1adaa21a2c Mon Sep 17 00:00:00 2001 From: mk-elogic <michael.kalakailo@elogic.com.ua> Date: Mon, 28 Oct 2019 16:52:10 +0200 Subject: [PATCH 0080/1143] Fixed issue magento#25278:Incorrect @return type at getSourceModel in Eav\Attribute --- app/code/Magento/Catalog/Model/ResourceModel/Eav/Attribute.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Eav/Attribute.php b/app/code/Magento/Catalog/Model/ResourceModel/Eav/Attribute.php index 355561c5e384d..5077476211a15 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Eav/Attribute.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Eav/Attribute.php @@ -383,7 +383,7 @@ public function getApplyTo() /** * Retrieve source model * - * @return \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource + * @return mixed|string|null */ public function getSourceModel() { From c57d98c67343794530cd9e9d7405c095bc31fad8 Mon Sep 17 00:00:00 2001 From: Douglas Radburn <douglas.radburn@pinpointdesigns.co.uk> Date: Mon, 28 Oct 2019 21:27:10 +0000 Subject: [PATCH 0081/1143] Updated page 1 to not include p1 in URL link --- app/code/Magento/Theme/Block/Html/Pager.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Theme/Block/Html/Pager.php b/app/code/Magento/Theme/Block/Html/Pager.php index ad3f4aad676eb..e86310b66bb4b 100644 --- a/app/code/Magento/Theme/Block/Html/Pager.php +++ b/app/code/Magento/Theme/Block/Html/Pager.php @@ -450,7 +450,9 @@ public function getLastPageUrl() */ public function getPageUrl($page) { - return $this->getPagerUrl([$this->getPageVarName() => $page]); + return $this->getPagerUrl([ + $this->getPageVarName() => $page > 1 ? $page : null, + ]); } /** From f0e0d1c3bbe846694c2a1c919b796c2a53d50570 Mon Sep 17 00:00:00 2001 From: Daniel Ruf <d.ruf@bitexpert.de> Date: Tue, 29 Oct 2019 10:10:06 +0100 Subject: [PATCH 0082/1143] Do not use splat operator as we use associative arrays --- .../Magento/AsynchronousOperations/Model/OperationProcessor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/AsynchronousOperations/Model/OperationProcessor.php b/app/code/Magento/AsynchronousOperations/Model/OperationProcessor.php index f7a411c745b1f..ded507958d8a3 100644 --- a/app/code/Magento/AsynchronousOperations/Model/OperationProcessor.php +++ b/app/code/Magento/AsynchronousOperations/Model/OperationProcessor.php @@ -187,7 +187,7 @@ private function executeHandler($callback, $entityParams) 'output_data' => null ]; try { - $result['output_data'] = $callback(...$entityParams); + $result['output_data'] = call_user_func_array($callback, $entityParams); $result['messages'][] = sprintf('Service execution success %s::%s', get_class($callback[0]), $callback[1]); } catch (\Zend_Db_Adapter_Exception $e) { $this->logger->critical($e->getMessage()); From 60117ee2523187a546cf0aee5b1c4d1ef8ee49b8 Mon Sep 17 00:00:00 2001 From: Raul Verdugo <rverdugo@onestic.com> Date: Tue, 29 Oct 2019 12:53:51 +0100 Subject: [PATCH 0083/1143] #13865 add scapeHtml to popup text --- .../Theme/view/frontend/templates/js/cookie_status.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Theme/view/frontend/templates/js/cookie_status.phtml b/app/code/Magento/Theme/view/frontend/templates/js/cookie_status.phtml index 833daf43a4570..2da71c90b5657 100644 --- a/app/code/Magento/Theme/view/frontend/templates/js/cookie_status.phtml +++ b/app/code/Magento/Theme/view/frontend/templates/js/cookie_status.phtml @@ -6,7 +6,7 @@ ?> <div id="cookie-status" style="display: none"> - <?= __('The store will not work correctly in the case when cookies are disabled.') ?> + <?= $block->escapeHtml(__('The store will not work correctly in the case when cookies are disabled.')); ?> </div> <script type="text/x-magento-init"> From 20d3f40795e8c29aa1a307c55817f557698f2f8a Mon Sep 17 00:00:00 2001 From: Matti Vapa <matti.vapa@piimega.fi> Date: Wed, 30 Oct 2019 15:19:50 +0200 Subject: [PATCH 0084/1143] Fix minicart promotion region not rendering The minicart promotion region was not rendering due to a wrongly written check for the number of items in the 'promotion' region. The code checked for the length property of the observable returned from the getRegion method instead of the array it contained. A fast way would have been to add the missing parentheses to the check (and I made antoher PR doing just that), but I felt that the getRegion(region)().length pattern is a bit hard to read and easy to make a mistake with. Therefore, this commit adds a new method to the lib/core/collection.js component of the Magento_Ui module that can be used to check if a region has any elements associated with it. This commit also replaces all occurences of getRegion(region)().length with a call to the new method. --- .../view/base/web/template/product/list/listing.html | 8 ++++---- .../view/frontend/web/js/view/payment/list.js | 2 +- .../view/frontend/web/template/minicart/content.html | 2 +- .../frontend/web/template/payment-methods/list.html | 2 +- .../Ui/view/base/web/js/lib/core/collection.js | 12 ++++++++++++ 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Catalog/view/base/web/template/product/list/listing.html b/app/code/Magento/Catalog/view/base/web/template/product/list/listing.html index c80f591bd6590..b9cf20fa32cb0 100644 --- a/app/code/Magento/Catalog/view/base/web/template/product/list/listing.html +++ b/app/code/Magento/Catalog/view/base/web/template/product/list/listing.html @@ -25,15 +25,15 @@ <render args="$col.getBody()"/> </fastForEach> - <div if="getRegion('action-primary-area')().length || getRegion('action-secondary-area')().length" + <div if="regionHasElements('action-primary-area') || regionHasElements('action-secondary-area')" class="product-item-actions"> - <div class="actions-primary" if="getRegion('action-primary-area')().length"> + <div class="actions-primary" if="regionHasElements('action-primary-area')"> <fastForEach args="data: getRegion('action-primary-area'), as: '$col'" > <render args="$col.getBody()"/> </fastForEach> </div> - <div if="getRegion('action-secondary-area')().length" + <div if="regionHasElements('action-secondary-area')" class="actions-secondary" data-role="add-to-links"> <fastForEach args="data: getRegion('action-secondary-area'), as: '$col'" > @@ -42,7 +42,7 @@ </div> </div> - <div if="getRegion('description-area')().length" + <div if=regionHasElements('description-area')" class="product-item-description"> <fastForEach args="data: getRegion('description-area'), as: '$col'" > <render args="$col.getBody()"/> diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/payment/list.js b/app/code/Magento/Checkout/view/frontend/web/js/view/payment/list.js index 15ae5d68534b8..17ccf3863a875 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/payment/list.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/payment/list.js @@ -203,7 +203,7 @@ define([ */ isPaymentMethodsAvailable: function () { return _.some(this.paymentGroupsList(), function (group) { - return this.getRegion(group.displayArea)().length; + return this.regionHasElements(group.displayArea); }, this); }, diff --git a/app/code/Magento/Checkout/view/frontend/web/template/minicart/content.html b/app/code/Magento/Checkout/view/frontend/web/template/minicart/content.html index 0719a7d01ec70..9f7b8b11bf459 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/minicart/content.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/minicart/content.html @@ -97,7 +97,7 @@ </div> </div> - <div id="minicart-widgets" class="minicart-widgets" if="getRegion('promotion').length"> + <div id="minicart-widgets" class="minicart-widgets" if="regionHasElements('promotion')"> <each args="getRegion('promotion')" render=""/> </div> </div> diff --git a/app/code/Magento/Checkout/view/frontend/web/template/payment-methods/list.html b/app/code/Magento/Checkout/view/frontend/web/template/payment-methods/list.html index b7be5efee383e..77b801ec0e826 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/payment-methods/list.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/payment-methods/list.html @@ -8,7 +8,7 @@ class="items payment-methods"> <div repeat="foreach: paymentGroupsList, item: '$group'" class="payment-group"> - <div if="getRegion($group().displayArea)().length" + <div if="regionHasElements($group().displayArea)" translate="getGroupTitle($group)" class="step-title" data-role="title"> diff --git a/app/code/Magento/Ui/view/base/web/js/lib/core/collection.js b/app/code/Magento/Ui/view/base/web/js/lib/core/collection.js index 0491390d2b6c2..3d1e5cf8fb797 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/core/collection.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/core/collection.js @@ -214,6 +214,18 @@ define([ return regions[name]; }, + /** + * Checks if the specified region has any elements + * associated with it. + * + * @param {String} name + * @returns {Boolean} + */ + regionHasElements: function (name) { + var region = this.getRegion(name); + return region().length > 0; + }, + /** * Replaces specified regions' data with a provided one. * Creates region if it was not created yet. From 0b278c84278cb42f03083a4115763d3ed5c7dd52 Mon Sep 17 00:00:00 2001 From: Mateusz Krzeszowiak <mateusz.krzeszowiak@creativestyle.pl> Date: Wed, 30 Oct 2019 21:07:05 +0100 Subject: [PATCH 0085/1143] Prevent page scroll jumping when product gallery loads During the investigation of the issue linked below I was able to pinpoint the exact moment of scroll jumping to fotorama's `that.resize` function which for some reason resets all of its major elements' width and height dimensions. I analysed the code and concluded that since current element height seems to be completely ignored in the whole script and is only set either based on settings or its width and ratio, the code that resets it can be removed. Please not that this can be also true for width but I left it here just to be safe as it doesn't contribute to page jumping. In addition, `min-height` was added to prevent initial jump of the gallery when static image is being replaced by fotorama's HTML. Fixes https://github.com/magento/magento2/issues/10518. --- lib/web/fotorama/fotorama.js | 4 ---- lib/web/mage/gallery/gallery.js | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/web/fotorama/fotorama.js b/lib/web/fotorama/fotorama.js index b38e70d915c9d..d20e427b9ffab 100644 --- a/lib/web/fotorama/fotorama.js +++ b/lib/web/fotorama/fotorama.js @@ -3272,13 +3272,9 @@ fotoramaVersion = '4.6.4'; if (measureIsValid(width)) { $wrap.css({width: ''}); - $wrap.css({height: ''}); $stage.css({width: ''}); - $stage.css({height: ''}); $stageShaft.css({width: ''}); - $stageShaft.css({height: ''}); $nav.css({width: ''}); - $nav.css({height: ''}); $wrap.css({minWidth: measures.minwidth || 0, maxWidth: measures.maxwidth || MAX_WIDTH}); if (o_nav === 'dots') { diff --git a/lib/web/mage/gallery/gallery.js b/lib/web/mage/gallery/gallery.js index be78856b21fcd..65a14f77de257 100644 --- a/lib/web/mage/gallery/gallery.js +++ b/lib/web/mage/gallery/gallery.js @@ -291,10 +291,12 @@ define([ config.click = false; config.breakpoints = null; settings.currentConfig = config; + settings.$element.css('min-height', settings.$element.height()); settings.$element.html(tpl); settings.$element.removeClass('_block-content-loading'); settings.$elementF = $(settings.$element.children()[0]); settings.$elementF.fotorama(config); + settings.$element.css('min-height', ''); settings.fotoramaApi = settings.$elementF.data('fotorama'); $.extend(true, config, this.startConfig); From 6e18b9835c54982b1b26b2ba079184a38bfdfcd6 Mon Sep 17 00:00:00 2001 From: Kate Kyzyma <kate@atwix.com> Date: Thu, 31 Oct 2019 15:14:53 +0200 Subject: [PATCH 0086/1143] Separating the test into 2 individual tests --- ...goryUrlRewriteEntityFirstVariationTest.xml | 52 +++++++++++++++++++ ...ryUrlRewriteEntitySecondVariationTest.xml} | 29 ++--------- 2 files changed, 55 insertions(+), 26 deletions(-) create mode 100644 app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteEntityFirstVariationTest.xml rename app/code/Magento/UrlRewrite/Test/Mftf/Test/{AdminDeleteCategoryUrlRewriteEntityTest.xml => AdminDeleteCategoryUrlRewriteEntitySecondVariationTest.xml} (61%) diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteEntityFirstVariationTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteEntityFirstVariationTest.xml new file mode 100644 index 0000000000000..c653bf2e910b1 --- /dev/null +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteEntityFirstVariationTest.xml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminDeleteCategoryUrlRewriteEntityFirstVariationTest"> + <annotations> + <stories value="Delete category URL rewrite first scenario"/> + <title value="Delete category URL rewrite first scenario"/> + <description value="Login as admin and delete category Url Rewrite"/> + <group value="urlRewrite"/> + <group value="mtf_migrated"/> + </annotations> + + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> + <createData entity="_defaultCategory" stepKey="category"/> + </before> + <after> + <deleteData createDataKey="category" stepKey="deleteCategory"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <!--Create the Category Url Rewrite--> + <actionGroup ref="AdminAddUrlRewrite" stepKey="addUrlRewrite"> + <argument name="category" value="$$category.name$$"/> + <argument name="customUrlRewriteValue" value="For Category'"/> + <argument name="storeValue" value="Default Store View"/> + <argument name="requestPath" value="-"/> + <argument name="redirectTypeValue" value="No"/> + <argument name="description" value="End To End Test"/> + </actionGroup> + + <!--Delete the Category Url Rewrite--> + <actionGroup ref="AdminDeleteUrlRewrite" stepKey="deleteCustomUrlRewrite"> + <argument name="requestPath" value="-"/> + </actionGroup> + <actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="assertSuccessMessage"> + <argument name="message" value="You deleted the URL rewrite."/> + </actionGroup> + + <!--Verify AssertPageByUrlRewriteIsNotFound--> + <actionGroup ref="AssertPageByUrlRewriteIsNotFound" stepKey="checkUrlOnFrontend"> + <argument name="requestPath" value="-"/> + </actionGroup> + + </test> +</tests> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteEntityTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteEntitySecondVariationTest.xml similarity index 61% rename from app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteEntityTest.xml rename to app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteEntitySecondVariationTest.xml index d0e976a1f9e3d..f613ee57296e9 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteEntityTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteEntitySecondVariationTest.xml @@ -7,10 +7,10 @@ --> <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> - <test name="AdminDeleteCategoryUrlRewriteEntityTest"> + <test name="AdminDeleteCategoryUrlRewriteEntitySecondVariationTest"> <annotations> - <stories value="Delete category URL rewrite"/> - <title value="Delete category URL rewrite"/> + <stories value="Delete category URL rewrite second scenario"/> + <title value="Delete category URL rewrite second scenario"/> <description value="Login as admin and delete category Url Rewrite"/> <group value="urlRewrite"/> <group value="mtf_migrated"/> @@ -25,29 +25,6 @@ <actionGroup ref="logout" stepKey="logout"/> </after> - <!--Create the Category Url Rewrite--> - <actionGroup ref="AdminAddUrlRewrite" stepKey="addUrlRewrite"> - <argument name="category" value="$$category.name$$"/> - <argument name="customUrlRewriteValue" value="For Category'"/> - <argument name="storeValue" value="Default Store View"/> - <argument name="requestPath" value="-"/> - <argument name="redirectTypeValue" value="No"/> - <argument name="description" value="End To End Test"/> - </actionGroup> - - <!--Delete the Category Url Rewrite--> - <actionGroup ref="AdminDeleteUrlRewrite" stepKey="deleteCustomUrlRewrite"> - <argument name="requestPath" value="-"/> - </actionGroup> - <actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="assertSuccessMessage"> - <argument name="message" value="You deleted the URL rewrite."/> - </actionGroup> - - <!--Verify AssertPageByUrlRewriteIsNotFound--> - <actionGroup ref="AssertPageByUrlRewriteIsNotFound" stepKey="checkUrlOnFrontend"> - <argument name="requestPath" value="-"/> - </actionGroup> - <!--Create the Category Url Rewrite--> <actionGroup ref="AdminAddUrlRewrite" stepKey="addUrlRewriteSecondTime"> <argument name="category" value="$$category.name$$"/> From 9b6c8d74daf13a1de3124d6999751f158004f2b2 Mon Sep 17 00:00:00 2001 From: Matti Vapa <matti.vapa@piimega.fi> Date: Fri, 1 Nov 2019 09:33:22 +0200 Subject: [PATCH 0087/1143] Add missing newline after var declaration This is to appease the code style checker. --- app/code/Magento/Ui/view/base/web/js/lib/core/collection.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Ui/view/base/web/js/lib/core/collection.js b/app/code/Magento/Ui/view/base/web/js/lib/core/collection.js index 3d1e5cf8fb797..33acba6103b10 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/core/collection.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/core/collection.js @@ -223,6 +223,7 @@ define([ */ regionHasElements: function (name) { var region = this.getRegion(name); + return region().length > 0; }, From 79be5ed26493ef2ad801d3a06da44357b2459abf Mon Sep 17 00:00:00 2001 From: Adarsh Manickam <adarsh.apple@icloud.com> Date: Fri, 1 Nov 2019 13:42:48 +0530 Subject: [PATCH 0088/1143] Fixed model save and ObjectManager usage --- .../Adminhtml/Email/Template/Save.php | 71 +++++++++++++++---- 1 file changed, 57 insertions(+), 14 deletions(-) diff --git a/app/code/Magento/Email/Controller/Adminhtml/Email/Template/Save.php b/app/code/Magento/Email/Controller/Adminhtml/Email/Template/Save.php index 135506f4068a8..e61f45dd8be0f 100644 --- a/app/code/Magento/Email/Controller/Adminhtml/Email/Template/Save.php +++ b/app/code/Magento/Email/Controller/Adminhtml/Email/Template/Save.php @@ -1,15 +1,62 @@ <?php /** - * * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Email\Controller\Adminhtml\Email\Template; +use Exception; +use Magento\Backend\App\Action\Context; +use Magento\Backend\Model\Session; +use Magento\Email\Controller\Adminhtml\Email\Template; +use Magento\Email\Model\ResourceModel\Template as TemplateResource; +use Magento\Framework\App\Action\HttpPostActionInterface; use Magento\Framework\App\TemplateTypesInterface; +use Magento\Framework\Registry; +use Magento\Framework\Stdlib\DateTime\DateTime; -class Save extends \Magento\Email\Controller\Adminhtml\Email\Template +/** + * Save Controller + */ +class Save extends Template implements HttpPostActionInterface { + /** + * @var DateTime + */ + private $dateTime; + + /** + * @var TemplateResource + */ + private $templateResource; + + /** + * @var Session + */ + private $backendSession; + + /** + * Save constructor + * + * @param Context $context + * @param Registry $coreRegistry + * @param DateTime $dateTime + * @param TemplateResource $templateResource + * @param Session $backendSession + */ + public function __construct( + Context $context, + Registry $coreRegistry, + DateTime $dateTime, + TemplateResource $templateResource, + Session $backendSession + ) { + $this->dateTime = $dateTime; + $this->templateResource = $templateResource; + $this->backendSession = $backendSession; + parent::__construct($context, $coreRegistry); + } + /** * Save transactional email action * @@ -18,10 +65,10 @@ class Save extends \Magento\Email\Controller\Adminhtml\Email\Template public function execute() { $request = $this->getRequest(); - $id = $this->getRequest()->getParam('id'); + $templateId = $this->getRequest()->getParam('id'); $template = $this->_initTemplate('id'); - if (!$template->getId() && $id) { + if (!$template->getId() && $templateId) { $this->messageManager->addErrorMessage(__('This email template no longer exists.')); $this->_redirect('adminhtml/*/'); return; @@ -37,7 +84,7 @@ public function execute() )->setTemplateStyles( $request->getParam('template_styles') )->setModifiedAt( - $this->_objectManager->get(\Magento\Framework\Stdlib\DateTime\DateTime::class)->gmtDate() + $this->dateTime->gmtDate() )->setOrigTemplateCode( $request->getParam('orig_template_code') )->setOrigTemplateVariables( @@ -53,17 +100,13 @@ public function execute() $template->setTemplateStyles(''); } - $template->save(); - $this->_objectManager->get(\Magento\Backend\Model\Session::class)->setFormData(false); + $this->templateResource->save($template); + + $this->backendSession->setFormData(false); $this->messageManager->addSuccessMessage(__('You saved the email template.')); $this->_redirect('adminhtml/*'); - } catch (\Exception $e) { - $this->_objectManager->get( - \Magento\Backend\Model\Session::class - )->setData( - 'email_template_form_data', - $request->getParams() - ); + } catch (Exception $e) { + $this->backendSession->setData('email_template_form_data', $request->getParams()); $this->messageManager->addErrorMessage($e->getMessage()); $this->_forward('new'); } From 0bf7a4c1b87cf0a738ab17ad76a4cb5b46443167 Mon Sep 17 00:00:00 2001 From: Behnam Shayani <behnam.shayani@vaimo.com> Date: Sun, 3 Nov 2019 20:43:31 +0100 Subject: [PATCH 0089/1143] fix performance issue with attribute that have large numebr of options, do not loop over all options --- .../Adapter/BatchDataMapper/ProductDataMapper.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Elasticsearch/Model/Adapter/BatchDataMapper/ProductDataMapper.php b/app/code/Magento/Elasticsearch/Model/Adapter/BatchDataMapper/ProductDataMapper.php index 270ca37e2d42c..19b553dd05f08 100644 --- a/app/code/Magento/Elasticsearch/Model/Adapter/BatchDataMapper/ProductDataMapper.php +++ b/app/code/Magento/Elasticsearch/Model/Adapter/BatchDataMapper/ProductDataMapper.php @@ -285,9 +285,9 @@ private function getValuesLabels(Attribute $attribute, array $attributeValues): return $attributeLabels; } - foreach ($options as $option) { - if (\in_array($option->getValue(), $attributeValues)) { - $attributeLabels[] = $option->getLabel(); + foreach ($attributeValues as $attributeValue) { + if (isset($options[$attributeValue])) { + $attributeLabels[] = $options[$attributeValue]->getLabel(); } } @@ -304,7 +304,11 @@ private function getAttributeOptions(Attribute $attribute): array { if (!isset($this->attributeOptionsCache[$attribute->getId()])) { $options = $attribute->getOptions() ?? []; - $this->attributeOptionsCache[$attribute->getId()] = $options; + $optionsByValue = []; + foreach ($options as $option) { + $optionsByValue[$option->getValue()] = $option; + } + $this->attributeOptionsCache[$attribute->getId()] = $optionsByValue; } return $this->attributeOptionsCache[$attribute->getId()]; From 2b5b9860c395ae85e6c1dc4a736571c9b8985e55 Mon Sep 17 00:00:00 2001 From: Ihor Sviziev <ihor-sviziev@users.noreply.github.com> Date: Mon, 4 Nov 2019 13:33:44 +0200 Subject: [PATCH 0090/1143] magento/magento2#25452 Elastic Search 5 Indexing Performance Issue Fix static tests --- .../Adapter/BatchDataMapper/ProductDataMapper.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Elasticsearch/Model/Adapter/BatchDataMapper/ProductDataMapper.php b/app/code/Magento/Elasticsearch/Model/Adapter/BatchDataMapper/ProductDataMapper.php index 19b553dd05f08..7b0f9cfe4b274 100644 --- a/app/code/Magento/Elasticsearch/Model/Adapter/BatchDataMapper/ProductDataMapper.php +++ b/app/code/Magento/Elasticsearch/Model/Adapter/BatchDataMapper/ProductDataMapper.php @@ -252,9 +252,14 @@ private function prepareAttributeValues( */ private function prepareMultiselectValues(array $values): array { - return \array_merge(...\array_map(function (string $value) { - return \explode(',', $value); - }, $values)); + return \array_merge( + ...\array_map( + function (string $value) { + return \explode(',', $value); + }, + $values + ) + ); } /** From ab1d4d67cd3dfba9346179f043e56a210616bd3f Mon Sep 17 00:00:00 2001 From: Edward Simpson <edward@skywire.co.uk> Date: Tue, 5 Nov 2019 17:05:18 +0000 Subject: [PATCH 0091/1143] Clearer PHPDocs comment for AbstractBlock::escapeJJsQuote and Escaper::escapeJsQuote --- lib/internal/Magento/Framework/Escaper.php | 3 ++- lib/internal/Magento/Framework/View/Element/AbstractBlock.php | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Escaper.php b/lib/internal/Magento/Framework/Escaper.php index 1b766dea2105c..1587d33ddab49 100644 --- a/lib/internal/Magento/Framework/Escaper.php +++ b/lib/internal/Magento/Framework/Escaper.php @@ -310,7 +310,8 @@ public function escapeCss($string) } /** - * Escape quotes in java script + * Escape single quotes/apostrophes ('), or other specified $quote character + * in javascript (string or array of strings) * * @param string|array $data * @param string $quote diff --git a/lib/internal/Magento/Framework/View/Element/AbstractBlock.php b/lib/internal/Magento/Framework/View/Element/AbstractBlock.php index 4df1ac515a87b..59d925034d80d 100644 --- a/lib/internal/Magento/Framework/View/Element/AbstractBlock.php +++ b/lib/internal/Magento/Framework/View/Element/AbstractBlock.php @@ -985,10 +985,12 @@ public function escapeQuote($data, $addSlashes = false) } /** - * Escape quotes in java scripts + * Escape single quotes/apostrophes ('), or other specified $quote character + * in javascript (string or array of strings) * * @param string|array $data * @param string $quote + * * @return string|array * @deprecated 100.2.0 */ From bedbb377740644f236e93b2e34fc8fd70530aaa6 Mon Sep 17 00:00:00 2001 From: Anton Kaplia <akaplya@adobe.com> Date: Tue, 5 Nov 2019 11:13:10 -0600 Subject: [PATCH 0092/1143] JSON fields support --- app/etc/di.xml | 3 + .../Db/MySQL/Definition/Columns/Json.php | 73 +++++++++++++++++++ .../Declaration/Schema/Dto/Columns/Json.php | 68 +++++++++++++++++ .../Declaration/Schema/Dto/Factories/Json.php | 47 ++++++++++++ .../Setup/Declaration/Schema/etc/schema.xsd | 1 + .../Schema/etc/types/texts/json.xsd | 23 ++++++ .../JsonDefinition.php | 25 +++++++ 7 files changed, 240 insertions(+) create mode 100644 lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/Json.php create mode 100644 lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Columns/Json.php create mode 100644 lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Json.php create mode 100644 lib/internal/Magento/Framework/Setup/Declaration/Schema/etc/types/texts/json.xsd create mode 100644 lib/internal/Magento/Framework/Setup/SchemaListenerDefinition/JsonDefinition.php diff --git a/app/etc/di.xml b/app/etc/di.xml index f8818de2af842..167471dbd0397 100644 --- a/app/etc/di.xml +++ b/app/etc/di.xml @@ -1453,6 +1453,7 @@ <item name="primary" xsi:type="object">\Magento\Framework\Setup\Declaration\Schema\Dto\Factories\Primary</item> <item name="foreign" xsi:type="object">\Magento\Framework\Setup\Declaration\Schema\Dto\Factories\Foreign</item> <item name="index" xsi:type="object">\Magento\Framework\Setup\Declaration\Schema\Dto\Factories\Index</item> + <item name="json" xsi:type="object">\Magento\Framework\Setup\Declaration\Schema\Dto\Factories\Json</item> </argument> </arguments> </type> @@ -1480,6 +1481,7 @@ <item name="varchar" xsi:type="object">\Magento\Framework\Setup\Declaration\Schema\Db\MySQL\Definition\Columns\StringBinary</item> <item name="binary" xsi:type="object">\Magento\Framework\Setup\Declaration\Schema\Db\MySQL\Definition\Columns\StringBinary</item> <item name="varbinary" xsi:type="object">\Magento\Framework\Setup\Declaration\Schema\Db\MySQL\Definition\Columns\StringBinary</item> + <item name="json" xsi:type="object">\Magento\Framework\Setup\Declaration\Schema\Db\MySQL\Definition\Columns\Json</item> <item name="index" xsi:type="object">\Magento\Framework\Setup\Declaration\Schema\Db\MySQL\Definition\Index</item> <item name="unique" xsi:type="object">\Magento\Framework\Setup\Declaration\Schema\Db\MySQL\Definition\Constraints\Internal</item> <item name="primary" xsi:type="object">\Magento\Framework\Setup\Declaration\Schema\Db\MySQL\Definition\Constraints\Internal</item> @@ -1593,6 +1595,7 @@ <item name="datetime" xsi:type="object">Magento\Framework\Setup\SchemaListenerDefinition\TimestampDefinition</item> <item name="date" xsi:type="object">Magento\Framework\Setup\SchemaListenerDefinition\DateDefinition</item> <item name="boolean" xsi:type="object">Magento\Framework\Setup\SchemaListenerDefinition\BooleanDefinition</item> + <item name="json" xsi:type="object">Magento\Framework\Setup\SchemaListenerDefinition\JsonDefinition</item> </argument> </arguments> </type> diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/Json.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/Json.php new file mode 100644 index 0000000000000..2ed65a9ff9d03 --- /dev/null +++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/Json.php @@ -0,0 +1,73 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Framework\Setup\Declaration\Schema\Db\MySQL\Definition\Columns; + +use Magento\Framework\App\ResourceConnection; +use Magento\Framework\Setup\Declaration\Schema\Db\DbDefinitionProcessorInterface; +use Magento\Framework\Setup\Declaration\Schema\Dto\ElementInterface; + +/** + * Process json data type. + * + * @inheritdoc + */ +class Json implements DbDefinitionProcessorInterface +{ + /** + * @var Nullable + */ + private $nullable; + + /** + * @var ResourceConnection + */ + private $resourceConnection; + + /** + * @var Comment + */ + private $comment; + + /** + * Blob constructor. + * + * @param Nullable $nullable + * @param Comment $comment + * @param ResourceConnection $resourceConnection + */ + public function __construct( + Nullable $nullable, + Comment $comment, + ResourceConnection $resourceConnection + ) { + $this->nullable = $nullable; + $this->resourceConnection = $resourceConnection; + $this->comment = $comment; + } + + /** + * @inheritdoc + */ + public function toDefinition(ElementInterface $column) + { + return sprintf( + '%s %s %s %s', + $this->resourceConnection->getConnection()->quoteIdentifier($column->getName()), + $column->getType(), + $this->nullable->toDefinition($column), + $this->comment->toDefinition($column) + ); + } + + /** + * @inheritdoc + */ + public function fromDefinition(array $data) + { + return $data; + } +} diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Columns/Json.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Columns/Json.php new file mode 100644 index 0000000000000..8b8de071068a1 --- /dev/null +++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Columns/Json.php @@ -0,0 +1,68 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\Setup\Declaration\Schema\Dto\Columns; + +use Magento\Framework\Setup\Declaration\Schema\Dto\Column; +use Magento\Framework\Setup\Declaration\Schema\Dto\ElementDiffAwareInterface; +use Magento\Framework\Setup\Declaration\Schema\Dto\Table; + +/** + * Text column. + * Declared in SQL, like: JSON + */ +class Json extends Column implements + ElementDiffAwareInterface, + ColumnNullableAwareInterface +{ + /**Json + * @var bool + */ + private $nullable; + + /** + * Constructor. + * + * @param string $name + * @param string $type + * @param Table $table + * @param bool $nullable + * @param string|null $comment + * @param string|null $onCreate + */ + public function __construct( + string $name, + string $type, + Table $table, + bool $nullable = true, + string $comment = null, + string $onCreate = null + ) { + parent::__construct($name, $type, $table, $comment, $onCreate); + $this->nullable = $nullable; + } + + /** + * Check whether column can be nullable. + * + * @return bool + */ + public function isNullable() + { + return $this->nullable; + } + + /** + * @inheritdoc + */ + public function getDiffSensitiveParams() + { + return [ + 'type' => $this->getType(), + 'nullable' => $this->isNullable(), + 'comment' => $this->getComment() + ]; + } +} diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Json.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Json.php new file mode 100644 index 0000000000000..f778b048413de --- /dev/null +++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Json.php @@ -0,0 +1,47 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\Setup\Declaration\Schema\Dto\Factories; + +use Magento\Framework\ObjectManagerInterface; + +/** + * Class Json + */ +class Json implements FactoryInterface +{ + + /** + * @var ObjectManagerInterface + */ + private $objectManager; + + /** + * @var string + */ + private $className; + + /** + * Constructor. + * + * @param ObjectManagerInterface $objectManager + * @param string $className + */ + public function __construct( + ObjectManagerInterface $objectManager, + $className = \Magento\Framework\Setup\Declaration\Schema\Dto\Columns\Blob::class + ) { + $this->objectManager = $objectManager; + $this->className = $className; + } + + /** + * {@inheritdoc} + */ + public function create(array $data) + { + return $this->objectManager->create($this->className, $data); + } +} diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/etc/schema.xsd b/lib/internal/Magento/Framework/Setup/Declaration/Schema/etc/schema.xsd index e3c54413f810b..bb9136d8a9ae6 100644 --- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/etc/schema.xsd +++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/etc/schema.xsd @@ -20,6 +20,7 @@ <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/types/texts/longtext.xsd" /> <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/types/texts/mediumtext.xsd" /> <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/types/texts/varchar.xsd" /> + <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/types/texts/json.xsd" /> <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/types/binaries/blob.xsd" /> <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/types/binaries/mediumblob.xsd" /> <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/types/binaries/longblob.xsd" /> diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/etc/types/texts/json.xsd b/lib/internal/Magento/Framework/Setup/Declaration/Schema/etc/types/texts/json.xsd new file mode 100644 index 0000000000000..690f84a5ef43f --- /dev/null +++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/etc/types/texts/json.xsd @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> + <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/types/column.xsd"/> + + <xs:complexType name="json"> + <xs:complexContent> + <xs:extension base="abstractColumnType"> + <xs:annotation> + <xs:documentation> + Well formatted Json object + </xs:documentation> + </xs:annotation> + <xs:attribute name="nullable" type="xs:boolean" /> + </xs:extension> + </xs:complexContent> + </xs:complexType> +</xs:schema> diff --git a/lib/internal/Magento/Framework/Setup/SchemaListenerDefinition/JsonDefinition.php b/lib/internal/Magento/Framework/Setup/SchemaListenerDefinition/JsonDefinition.php new file mode 100644 index 0000000000000..04866dde943f4 --- /dev/null +++ b/lib/internal/Magento/Framework/Setup/SchemaListenerDefinition/JsonDefinition.php @@ -0,0 +1,25 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Framework\Setup\SchemaListenerDefinition; + +/** + * Json type definition. + */ +class JsonDefinition implements DefinitionConverterInterface +{ + /** + * @inheritdoc + */ + public function convertToDefinition(array $definition) + { + return [ + 'xsi:type' => $definition['type'], + 'name' => $definition['name'], + 'nullable' => $definition['nullable'] ?? true + ]; + } +} From ba5ee6edc002d2462c5bb784bd13b53dc4b87e60 Mon Sep 17 00:00:00 2001 From: Anton Kaplia <akaplya@adobe.com> Date: Tue, 5 Nov 2019 12:32:02 -0600 Subject: [PATCH 0093/1143] Fix static tests --- .../Schema/Db/MySQL/Definition/Columns/Json.php | 7 ++++--- .../Setup/Declaration/Schema/Dto/Columns/Json.php | 9 +++++---- .../Setup/Declaration/Schema/Dto/Factories/Json.php | 9 ++++++--- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/Json.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/Json.php index 2ed65a9ff9d03..b25b70674e0d0 100644 --- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/Json.php +++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/Json.php @@ -12,8 +12,6 @@ /** * Process json data type. - * - * @inheritdoc */ class Json implements DbDefinitionProcessorInterface { @@ -64,7 +62,10 @@ public function toDefinition(ElementInterface $column) } /** - * @inheritdoc + * Returns an array of column definitions + * + * @param array $data + * @return array */ public function fromDefinition(array $data) { diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Columns/Json.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Columns/Json.php index 8b8de071068a1..0f1e785730d38 100644 --- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Columns/Json.php +++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Columns/Json.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Setup\Declaration\Schema\Dto\Columns; use Magento\Framework\Setup\Declaration\Schema\Dto\Column; @@ -10,14 +11,14 @@ use Magento\Framework\Setup\Declaration\Schema\Dto\Table; /** + * Json + * * Text column. * Declared in SQL, like: JSON */ -class Json extends Column implements - ElementDiffAwareInterface, - ColumnNullableAwareInterface +class Json extends Column implements ElementDiffAwareInterface, ColumnNullableAwareInterface { - /**Json + /** * @var bool */ private $nullable; diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Json.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Json.php index f778b048413de..ec20e4a9438f3 100644 --- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Json.php +++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Json.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Setup\Declaration\Schema\Dto\Factories; use Magento\Framework\ObjectManagerInterface; @@ -12,7 +13,6 @@ */ class Json implements FactoryInterface { - /** * @var ObjectManagerInterface */ @@ -27,7 +27,7 @@ class Json implements FactoryInterface * Constructor. * * @param ObjectManagerInterface $objectManager - * @param string $className + * @param string $className */ public function __construct( ObjectManagerInterface $objectManager, @@ -38,7 +38,10 @@ public function __construct( } /** - * {@inheritdoc} + * Create element using definition data array. + * + * @param array $data + * @return \Magento\Framework\Setup\Declaration\Schema\Dto\ElementInterface|mixed */ public function create(array $data) { From 9bbc8f2db89920b68d9dfb0397771947c2da70b7 Mon Sep 17 00:00:00 2001 From: Edward Simpson <edward@skywire.co.uk> Date: Wed, 6 Nov 2019 10:09:16 +0000 Subject: [PATCH 0094/1143] Simplifying Escaper and AbstractBlock escapeJsQuote description and modifying PHPDoc param to specify can be string and array of strings --- lib/internal/Magento/Framework/Escaper.php | 5 ++--- .../Magento/Framework/View/Element/AbstractBlock.php | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/internal/Magento/Framework/Escaper.php b/lib/internal/Magento/Framework/Escaper.php index 1587d33ddab49..dd7a780af09fe 100644 --- a/lib/internal/Magento/Framework/Escaper.php +++ b/lib/internal/Magento/Framework/Escaper.php @@ -310,10 +310,9 @@ public function escapeCss($string) } /** - * Escape single quotes/apostrophes ('), or other specified $quote character - * in javascript (string or array of strings) + * Escape single quotes/apostrophes ('), or other specified $quote character in javascript * - * @param string|array $data + * @param string|string[]|array $data * @param string $quote * @return string|array * @deprecated 100.2.0 diff --git a/lib/internal/Magento/Framework/View/Element/AbstractBlock.php b/lib/internal/Magento/Framework/View/Element/AbstractBlock.php index 59d925034d80d..9b09818c3a2db 100644 --- a/lib/internal/Magento/Framework/View/Element/AbstractBlock.php +++ b/lib/internal/Magento/Framework/View/Element/AbstractBlock.php @@ -985,10 +985,9 @@ public function escapeQuote($data, $addSlashes = false) } /** - * Escape single quotes/apostrophes ('), or other specified $quote character - * in javascript (string or array of strings) + * Escape single quotes/apostrophes ('), or other specified $quote character in javascript * - * @param string|array $data + * @param string|string[]|array $data * @param string $quote * * @return string|array From a81802a9ceed3782da19a4f3a2a8267107b695a2 Mon Sep 17 00:00:00 2001 From: Buba Suma <soumah@adobe.com> Date: Fri, 25 Oct 2019 17:18:40 -0500 Subject: [PATCH 0095/1143] MC-22572: Shuffle related, up-sale and cross-sale products either by priority and weight - Fix random order of related, up-sell and cross-sell products - Add support for weighted random order of related, up-sell and cross-sell products --- .../templates/product/list/items.phtml | 10 ++- .../view/frontend/web/js/related-products.js | 77 +++++++++++++++--- .../view/frontend/web/js/upsell-products.js | 78 +++++++++++++++---- 3 files changed, 137 insertions(+), 28 deletions(-) diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml index 926e7c78a7df0..8f1fe3fa6874c 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml @@ -23,6 +23,7 @@ switch ($type = $block->getType()) { $items = $block->getAllItems(); $limit = $block->getPositionLimit(); $shuffle = (int) $block->isShuffled(); + $isWeightedRandom = (int) $block->getRotation()->isWeightedRandom($block->getProductListType()); $canItemsAddToCart = $block->canItemsAddToCart(); $showAddTo = true; @@ -43,6 +44,7 @@ switch ($type = $block->getType()) { $items = $block->getItems(); $limit = 0; $shuffle = 0; + $isWeightedRandom = 0; $canItemsAddToCart = $block->canItemsAddToCart(); $showAddTo = true; @@ -62,6 +64,7 @@ switch ($type = $block->getType()) { $items = $block->getAllItems(); $limit = $block->getPositionLimit(); $shuffle = (int) $block->isShuffled(); + $isWeightedRandom = (int) $block->getRotation()->isWeightedRandom($block->getProductListType()); $showAddTo = false; $showCart = false; @@ -82,6 +85,7 @@ switch ($type = $block->getType()) { $items = $block->getItemCollection()->getItems(); $limit = $block->getItemLimit('upsell'); $shuffle = 0; + $isWeightedRandom = 0; $showAddTo = false; $showCart = false; @@ -156,9 +160,9 @@ switch ($type = $block->getType()) { <?php if ($type == 'related' || $type == 'upsell') :?> <?php if ($type == 'related') :?> -<div class="block <?= $block->escapeHtmlAttr($class) ?>" data-mage-init='{"relatedProducts":{"relatedCheckbox":".related.checkbox"}}' data-limit="<?= $block->escapeHtmlAttr($limit) ?>" data-shuffle="<?= /* @noEscape */ $shuffle ?>"> +<div class="block <?= $block->escapeHtmlAttr($class) ?>" data-mage-init='{"relatedProducts":{"relatedCheckbox":".related.checkbox"}}' data-limit="<?= $block->escapeHtmlAttr($limit) ?>" data-shuffle="<?= /* @noEscape */ $shuffle ?>" data-shuffle-weighted="<?= /* @noEscape */ $isWeightedRandom ?>"> <?php else :?> - <div class="block <?= $block->escapeHtmlAttr($class) ?>" data-mage-init='{"upsellProducts":{}}' data-limit="<?= $block->escapeHtmlAttr($limit) ?>" data-shuffle="<?= /* @noEscape */ $shuffle ?>"> + <div class="block <?= $block->escapeHtmlAttr($class) ?>" data-mage-init='{"upsellProducts":{}}' data-limit="<?= $block->escapeHtmlAttr($limit) ?>" data-shuffle="<?= /* @noEscape */ $shuffle ?>" data-shuffle-weighted="<?= /* @noEscape */ $isWeightedRandom ?>"> <?php endif; ?> <?php else :?> <div class="block <?= $block->escapeHtmlAttr($class) ?>"> @@ -183,7 +187,7 @@ switch ($type = $block->getType()) { <?php endif; ?> <?php endif; ?> <?php if ($type == 'related' || $type == 'upsell') :?> - <li class="item product product-item" style="display: none;"> + <li class="item product product-item" style="display: none;" data-shuffle-group="<?= $block->escapeHtmlAttr($_item->getPriority()) ?>" > <?php else :?> <li class="item product product-item"> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/frontend/web/js/related-products.js b/app/code/Magento/Catalog/view/frontend/web/js/related-products.js index c875dd8f5d2c7..bc54fdeac5c28 100644 --- a/app/code/Magento/Catalog/view/frontend/web/js/related-products.js +++ b/app/code/Magento/Catalog/view/frontend/web/js/related-products.js @@ -28,10 +28,14 @@ define([ _create: function () { $(this.options.selectAllLink, this.element).on('click', $.proxy(this._selectAllRelated, this)); $(this.options.relatedCheckbox, this.element).on('click', $.proxy(this._addRelatedToProduct, this)); + + if (this.element.data('shuffle')) { + this._shuffle(this.element.find(this.options.elementsSelector)); + } this._showRelatedProducts( this.element.find(this.options.elementsSelector), this.element.data('limit'), - this.element.data('shuffle') + this.element.data('shuffle-weighted') ); }, @@ -69,24 +73,66 @@ define([ ); }, + /* jscs:disable */ + /* eslint-disable */ /** * Show related products according to limit. Shuffle if needed. * @param {*} elements * @param {*} limit - * @param {*} shuffle + * @param weightedRandom * @private */ - _showRelatedProducts: function (elements, limit, shuffle) { - var index; - - if (shuffle) { - this._shuffle(elements); - } + _showRelatedProducts: function (elements, limit, weightedRandom) { + var index, weights = [], random = [], weight = 2, shown = 0, $element, currentGroup, prevGroup; if (limit === 0) { limit = elements.length; } + if (weightedRandom && limit > 0 && limit < elements.length) { + for (index = 0; index < limit; index++) { + $element = $(elements[index]); + if ($element.data('shuffle-group') !== '') { + break; + } + $element.show(); + shown++; + } + limit -= shown; + for (index = elements.length - 1; index >= 0; index--) { + $element = $(elements[index]); + currentGroup = $element.data('shuffle-group'); + if (currentGroup !== '') { + weights.push([index, Math.log(weight)]); + if (typeof prevGroup !== 'undefined' && prevGroup !== currentGroup) { + weight += 2; + } + prevGroup = currentGroup; + } + } + + if (weights.length === 0) { + return; + } + + for (index = 0; index < weights.length; index++) { + random.push([weights[index][0], Math.pow(Math.random(), 1 / weights[index][1])]); + } + + random.sort(function(a, b) { + a = a[1]; + b = b[1]; + return a < b ? 1 : (a > b ? -1 : 0); + }); + index = 0; + while (limit) { + $(elements[random[index][0]]).show(); + limit--; + index++ + } + return; + } + for (index = 0; index < limit; index++) { $(elements[index]).show(); } @@ -96,12 +142,19 @@ define([ /* eslint-disable */ /** * Shuffle an array - * @param {Array} o + * @param {Array} elements * @returns {*} */ - _shuffle: function shuffle(o) { //v1.0 - for (var j, x, i = o.length; i; j = Math.floor(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x); - return o; + _shuffle: function shuffle(elements) { + var parent, child, lastSibling; + if (elements.length) { + parent = $(elements[0]).parent(); + } + while (elements.length) { + child = elements.splice(Math.floor(Math.random() * elements.length), 1)[0]; + lastSibling = parent.find('[data-shuffle-group="' + $(child).data('shuffle-group') + '"]').last(); + lastSibling.after(child); + } } /* jscs:disable */ diff --git a/app/code/Magento/Catalog/view/frontend/web/js/upsell-products.js b/app/code/Magento/Catalog/view/frontend/web/js/upsell-products.js index da2526d5679c8..867011d3d1646 100644 --- a/app/code/Magento/Catalog/view/frontend/web/js/upsell-products.js +++ b/app/code/Magento/Catalog/view/frontend/web/js/upsell-products.js @@ -19,33 +19,78 @@ define([ * @private */ _create: function () { + if (this.element.data('shuffle')) { + this._shuffle(this.element.find(this.options.elementsSelector)); + } this._showUpsellProducts( this.element.find(this.options.elementsSelector), this.element.data('limit'), - this.element.data('shuffle') + this.element.data('shuffle-weighted') ); }, + /* jscs:disable */ + /* eslint-disable */ /** * Show upsell products according to limit. Shuffle if needed. * @param {*} elements * @param {Number} limit - * @param {Boolean} shuffle + * @param {Boolean} weightedRandom * @private */ - _showUpsellProducts: function (elements, limit, shuffle) { - var index; - - if (shuffle) { - this._shuffle(elements); - } + _showUpsellProducts: function (elements, limit, weightedRandom) { + var index, weights = [], random = [], weight = 2, shown = 0, $element, currentGroup, prevGroup; if (limit === 0) { limit = elements.length; } + if (weightedRandom && limit > 0 && limit < elements.length) { + for (index = 0; index < limit; index++) { + $element = $(elements[index]); + if ($element.data('shuffle-group') !== '') { + break; + } + $element.show(); + shown++; + } + limit -= shown; + for (index = elements.length - 1; index >= 0; index--) { + $element = $(elements[index]); + currentGroup = $element.data('shuffle-group'); + if (currentGroup !== '') { + weights.push([index, Math.log(weight)]); + if (typeof prevGroup !== 'undefined' && prevGroup !== currentGroup) { + weight += 2; + } + prevGroup = currentGroup; + } + } + + if (weights.length === 0) { + return; + } + + for (index = 0; index < weights.length; index++) { + random.push([weights[index][0], Math.pow(Math.random(), 1 / weights[index][1])]); + } + + random.sort(function(a, b) { + a = a[1]; + b = b[1]; + return a < b ? 1 : (a > b ? -1 : 0); + }); + index = 0; + while (limit) { + $(elements[random[index][0]]).show(); + limit--; + index++ + } + return; + } + for (index = 0; index < limit; index++) { - $(this.element).find(elements[index]).show(); + $(elements[index]).show(); } }, @@ -53,12 +98,19 @@ define([ /* eslint-disable */ /** * Shuffle an array - * @param o + * @param elements * @returns {*} */ - _shuffle: function shuffle(o){ //v1.0 - for (var j, x, i = o.length; i; j = Math.floor(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x); - return o; + _shuffle: function shuffle(elements){ //v1.0 + var parent, child, lastSibling; + if (elements.length) { + parent = $(elements[0]).parent(); + } + while (elements.length) { + child = elements.splice(Math.floor(Math.random() * elements.length), 1)[0]; + lastSibling = parent.find('[data-shuffle-group="' + $(child).data('shuffle-group') + '"]').last(); + lastSibling.after(child); + } } /* jscs:disable */ From 627ac5a88c7f355f60cc764ef08bfe3d5df7a888 Mon Sep 17 00:00:00 2001 From: Nazarn96 <nazarn96@gmail.com> Date: Thu, 7 Nov 2019 12:06:17 +0200 Subject: [PATCH 0096/1143] fix static-test --- lib/internal/Magento/Framework/App/Bootstrap.php | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/internal/Magento/Framework/App/Bootstrap.php b/lib/internal/Magento/Framework/App/Bootstrap.php index d3290f8518b6e..e98631ec4adbd 100644 --- a/lib/internal/Magento/Framework/App/Bootstrap.php +++ b/lib/internal/Magento/Framework/App/Bootstrap.php @@ -270,7 +270,6 @@ public function run(AppInterface $application) } catch (\Throwable $e) { $this->terminate($e); } - } // phpcs:enable /** From 8b5818df65ad4ab7ed33fe5933782151f9b0d2cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Corr=C3=AAa=20Gomes?= <rafaelcgstz@gmail.com> Date: Thu, 7 Nov 2019 22:55:40 -0300 Subject: [PATCH 0097/1143] Contact form > Adding ViewModel --- .../Contact/ViewModel/UserDataProvider.php | 72 +++++++++++++++++++ .../frontend/layout/contact_index_index.xml | 3 + .../view/frontend/templates/form.phtml | 11 +-- 3 files changed, 82 insertions(+), 4 deletions(-) create mode 100644 app/code/Magento/Contact/ViewModel/UserDataProvider.php diff --git a/app/code/Magento/Contact/ViewModel/UserDataProvider.php b/app/code/Magento/Contact/ViewModel/UserDataProvider.php new file mode 100644 index 0000000000000..678f4349b0e88 --- /dev/null +++ b/app/code/Magento/Contact/ViewModel/UserDataProvider.php @@ -0,0 +1,72 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Contact\ViewModel; + +use Magento\Contact\Helper\Data; +use Magento\Framework\View\Element\Block\ArgumentInterface; + +/** + * Provides the user data to fill the form. + */ +class UserDataProvider implements ArgumentInterface +{ + + /** + * @var Data + */ + private $helper; + + /** + * UserDataProvider constructor. + * @param Data $helper + */ + public function __construct( + Data $helper + ) { + $this->helper = $helper; + } + + /** + * Get user name + * + * @return string + */ + public function getUserName() + { + return $this->helper->getPostValue('name') ?: $this->helper->getUserName(); + } + + /** + * Get user email + * + * @return string + */ + public function getUserEmail() + { + return $this->helper->getPostValue('email') ?: $this->helper->getUserEmail(); + } + + /** + * Get user telephone + * + * @return string + */ + public function getUserTelephone() + { + return $this->helper->getPostValue('telephone'); + } + + /** + * Get user comment + * + * @return string + */ + public function getUserComment() + { + return $this->helper->getPostValue('comment'); + } +} diff --git a/app/code/Magento/Contact/view/frontend/layout/contact_index_index.xml b/app/code/Magento/Contact/view/frontend/layout/contact_index_index.xml index 078c1a4ff5621..c7009831d4642 100644 --- a/app/code/Magento/Contact/view/frontend/layout/contact_index_index.xml +++ b/app/code/Magento/Contact/view/frontend/layout/contact_index_index.xml @@ -13,6 +13,9 @@ <referenceContainer name="content"> <block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml"> <container name="form.additional.info" label="Form Additional Info"/> + <arguments> + <argument name="view_model" xsi:type="object">Magento\Contact\ViewModel\UserDataProvider</argument> + </arguments> </block> </referenceContainer> </body> diff --git a/app/code/Magento/Contact/view/frontend/templates/form.phtml b/app/code/Magento/Contact/view/frontend/templates/form.phtml index d64a991bcafad..74708bf276a78 100644 --- a/app/code/Magento/Contact/view/frontend/templates/form.phtml +++ b/app/code/Magento/Contact/view/frontend/templates/form.phtml @@ -6,6 +6,9 @@ // @codingStandardsIgnoreFile /** @var \Magento\Contact\Block\ContactForm $block */ +/** @var \Magento\Contact\ViewModel\UserDataProvider $viewModel */ + +$viewModel = $block->getViewModel(); ?> <form class="form contact" action="<?= $block->escapeUrl($block->getFormAction()) ?>" @@ -19,25 +22,25 @@ <div class="field name required"> <label class="label" for="name"><span><?= $block->escapeHtml(__('Name')) ?></span></label> <div class="control"> - <input name="name" id="name" title="<?= $block->escapeHtmlAttr(__('Name')) ?>" value="<?= $block->escapeHtmlAttr($this->helper('Magento\Contact\Helper\Data')->getPostValue('name') ?: $this->helper('Magento\Contact\Helper\Data')->getUserName()) ?>" class="input-text" type="text" data-validate="{required:true}"/> + <input name="name" id="name" title="<?= $block->escapeHtmlAttr(__('Name')) ?>" value="<?= $block->escapeHtmlAttr($viewModel->getUserName()) ?>" class="input-text" type="text" data-validate="{required:true}"/> </div> </div> <div class="field email required"> <label class="label" for="email"><span><?= $block->escapeHtml(__('Email')) ?></span></label> <div class="control"> - <input name="email" id="email" title="<?= $block->escapeHtmlAttr(__('Email')) ?>" value="<?= $block->escapeHtmlAttr($this->helper('Magento\Contact\Helper\Data')->getPostValue('email') ?: $this->helper('Magento\Contact\Helper\Data')->getUserEmail()) ?>" class="input-text" type="email" data-validate="{required:true, 'validate-email':true}"/> + <input name="email" id="email" title="<?= $block->escapeHtmlAttr(__('Email')) ?>" value="<?= $block->escapeHtmlAttr($viewModel->getUserEmail()) ?>" class="input-text" type="email" data-validate="{required:true, 'validate-email':true}"/> </div> </div> <div class="field telephone"> <label class="label" for="telephone"><span><?= $block->escapeHtml(__('Phone Number')) ?></span></label> <div class="control"> - <input name="telephone" id="telephone" title="<?= $block->escapeHtmlAttr(__('Phone Number')) ?>" value="<?= $block->escapeHtmlAttr($this->helper('Magento\Contact\Helper\Data')->getPostValue('telephone')) ?>" class="input-text" type="text" /> + <input name="telephone" id="telephone" title="<?= $block->escapeHtmlAttr(__('Phone Number')) ?>" value="<?= $block->escapeHtmlAttr($viewModel->getUserTelephone()) ?>" class="input-text" type="text" /> </div> </div> <div class="field comment required"> <label class="label" for="comment"><span><?= $block->escapeHtml(__('What’s on your mind?')) ?></span></label> <div class="control"> - <textarea name="comment" id="comment" title="<?= $block->escapeHtmlAttr(__('What’s on your mind?')) ?>" class="input-text" cols="5" rows="3" data-validate="{required:true}"><?= $block->escapeHtml($this->helper('Magento\Contact\Helper\Data')->getPostValue('comment')) ?></textarea> + <textarea name="comment" id="comment" title="<?= $block->escapeHtmlAttr(__('What’s on your mind?')) ?>" class="input-text" cols="5" rows="3" data-validate="{required:true}"><?= $block->escapeHtml($viewModel->getUserComment()) ?></textarea> </div> </div> <?= $block->getChildHtml('form.additional.info') ?> From bde46816fb391793b2a8958dbcd85ef95ca793ec Mon Sep 17 00:00:00 2001 From: Adarsh Manickam <adarsh.apple@icloud.com> Date: Fri, 8 Nov 2019 15:44:12 +0530 Subject: [PATCH 0098/1143] Added backward compatibility --- .../Adminhtml/Email/Template/Save.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Email/Controller/Adminhtml/Email/Template/Save.php b/app/code/Magento/Email/Controller/Adminhtml/Email/Template/Save.php index e61f45dd8be0f..8e0b4d30ec511 100644 --- a/app/code/Magento/Email/Controller/Adminhtml/Email/Template/Save.php +++ b/app/code/Magento/Email/Controller/Adminhtml/Email/Template/Save.php @@ -11,6 +11,7 @@ use Magento\Email\Controller\Adminhtml\Email\Template; use Magento\Email\Model\ResourceModel\Template as TemplateResource; use Magento\Framework\App\Action\HttpPostActionInterface; +use Magento\Framework\App\ObjectManager; use Magento\Framework\App\TemplateTypesInterface; use Magento\Framework\Registry; use Magento\Framework\Stdlib\DateTime\DateTime; @@ -40,20 +41,20 @@ class Save extends Template implements HttpPostActionInterface * * @param Context $context * @param Registry $coreRegistry - * @param DateTime $dateTime - * @param TemplateResource $templateResource - * @param Session $backendSession + * @param DateTime|null $dateTime + * @param TemplateResource|null $templateResource + * @param Session|null $backendSession */ public function __construct( Context $context, Registry $coreRegistry, - DateTime $dateTime, - TemplateResource $templateResource, - Session $backendSession + DateTime $dateTime = null, + TemplateResource $templateResource = null, + Session $backendSession = null ) { - $this->dateTime = $dateTime; - $this->templateResource = $templateResource; - $this->backendSession = $backendSession; + $this->dateTime = $dateTime ?: ObjectManager::getInstance()->get(DateTime::class); + $this->templateResource = $templateResource ?: ObjectManager::getInstance()->get(TemplateResource::class); + $this->backendSession = $backendSession ?: ObjectManager::getInstance()->get(Session::class); parent::__construct($context, $coreRegistry); } From 2314bd3e02f0449af9e88d440fdc620e609d29fa Mon Sep 17 00:00:00 2001 From: Buba Suma <soumah@adobe.com> Date: Mon, 11 Nov 2019 10:46:29 -0600 Subject: [PATCH 0099/1143] MC-21807: Implement control over minimum_should_match for elasticsearch queries - Fix Magento-Health-Index-PR build failures --- .../FieldMapper/AddDefaultSearchFieldTest.php | 23 +++++-------------- .../CopySearchableFieldsToSearchFieldTest.php | 23 +++++-------------- 2 files changed, 12 insertions(+), 34 deletions(-) diff --git a/app/code/Magento/Elasticsearch6/Test/Unit/Model/Adapter/FieldMapper/AddDefaultSearchFieldTest.php b/app/code/Magento/Elasticsearch6/Test/Unit/Model/Adapter/FieldMapper/AddDefaultSearchFieldTest.php index 7da68168f8c97..1a1e7f4e0d643 100644 --- a/app/code/Magento/Elasticsearch6/Test/Unit/Model/Adapter/FieldMapper/AddDefaultSearchFieldTest.php +++ b/app/code/Magento/Elasticsearch6/Test/Unit/Model/Adapter/FieldMapper/AddDefaultSearchFieldTest.php @@ -8,27 +8,14 @@ namespace Magento\Elasticsearch6\Test\Unit\Model\Adapter\FieldMapper; use Magento\Elasticsearch6\Model\Adapter\FieldMapper\AddDefaultSearchField; -use Magento\Framework\TestFramework\Unit\BaseTestCase; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use PHPUnit\Framework\TestCase; /** * Test mapping preprocessor AddDefaultSearchField */ -class AddDefaultSearchFieldTest extends BaseTestCase +class AddDefaultSearchFieldTest extends TestCase { - /** - * @var AddDefaultSearchField - */ - private $model; - - /** - * @inheritDoc - */ - protected function setUp() - { - parent::setUp(); - $this->model = $this->objectManager->getObject(AddDefaultSearchField::class); - } - /** * Test default search field "_search" should be prepended and overwrite if exist. * @@ -38,7 +25,9 @@ protected function setUp() */ public function testProcess(array $mappingBefore, array $mappingAfter) { - $this->assertEquals($mappingAfter, $this->model->process($mappingBefore)); + $objectManager = new ObjectManager($this); + $model = $objectManager->getObject(AddDefaultSearchField::class); + $this->assertEquals($mappingAfter, $model->process($mappingBefore)); } /** diff --git a/app/code/Magento/Elasticsearch6/Test/Unit/Model/Adapter/FieldMapper/CopySearchableFieldsToSearchFieldTest.php b/app/code/Magento/Elasticsearch6/Test/Unit/Model/Adapter/FieldMapper/CopySearchableFieldsToSearchFieldTest.php index c366e55fbbdf7..cfe8b71095d21 100644 --- a/app/code/Magento/Elasticsearch6/Test/Unit/Model/Adapter/FieldMapper/CopySearchableFieldsToSearchFieldTest.php +++ b/app/code/Magento/Elasticsearch6/Test/Unit/Model/Adapter/FieldMapper/CopySearchableFieldsToSearchFieldTest.php @@ -8,27 +8,14 @@ namespace Magento\Elasticsearch6\Test\Unit\Model\Adapter\FieldMapper; use Magento\Elasticsearch6\Model\Adapter\FieldMapper\CopySearchableFieldsToSearchField; -use Magento\Framework\TestFramework\Unit\BaseTestCase; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use PHPUnit\Framework\TestCase; /** * Test mapping preprocessor CopySearchableFieldsToSearchField */ -class CopySearchableFieldsToSearchFieldTest extends BaseTestCase +class CopySearchableFieldsToSearchFieldTest extends TestCase { - /** - * @var CopySearchableFieldsToSearchField - */ - private $model; - - /** - * @inheritDoc - */ - protected function setUp() - { - parent::setUp(); - $this->model = $this->objectManager->getObject(CopySearchableFieldsToSearchField::class); - } - /** * Test "copy_to" parameter should be added to searchable fields. * @@ -38,7 +25,9 @@ protected function setUp() */ public function testProcess(array $mappingBefore, array $mappingAfter) { - $this->assertEquals($mappingAfter, $this->model->process($mappingBefore)); + $objectManager = new ObjectManager($this); + $model = $objectManager->getObject(CopySearchableFieldsToSearchField::class); + $this->assertEquals($mappingAfter, $model->process($mappingBefore)); } /** From ca8c75a303918257d1fca4cc110ad7348b05a72f Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <engcom-vendorworker-foxtrot@adobe.com> Date: Tue, 12 Nov 2019 11:09:20 +0200 Subject: [PATCH 0100/1143] magento/magento2#25375: Static tests fix. --- .../view/frontend/web/js/view/minicart.js | 16 +++++++++++++--- .../frontend/web/template/minicart/content.html | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/minicart.js b/app/code/Magento/Checkout/view/frontend/web/js/view/minicart.js index 4adc1cd88c0ae..c77e72e38107a 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/minicart.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/minicart.js @@ -162,10 +162,11 @@ define([ /** * Get cart param by name. + * * @param {String} name * @returns {*} */ - getCartParam: function (name) { + getCartParamUnsanitizedHtml: function (name) { if (!_.isUndefined(name)) { if (!this.cart.hasOwnProperty(name)) { this.cart[name] = ko.observable(); @@ -175,12 +176,21 @@ define([ return this.cart[name](); }, + /** + * @deprecated please use getCartParamUnsanitizedHtml. + * @param {String} name + * @returns {*} + */ + getCartParam: function (name) { + return this.getCartParamUnsanitizedHtml(name); + }, + /** * Returns array of cart items, limited by 'maxItemsToDisplay' setting * @returns [] */ getCartItems: function () { - var items = this.getCartParam('items') || []; + var items = this.getCartParamUnsanitizedHtml('items') || []; items = items.slice(parseInt(-this.maxItemsToDisplay, 10)); @@ -192,7 +202,7 @@ define([ * @returns {Number} */ getCartLineItemsCount: function () { - var items = this.getCartParam('items') || []; + var items = this.getCartParamUnsanitizedHtml('items') || []; return parseInt(items.length, 10); } diff --git a/app/code/Magento/Checkout/view/frontend/web/template/minicart/content.html b/app/code/Magento/Checkout/view/frontend/web/template/minicart/content.html index 9f7b8b11bf459..c5fd6d545702b 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/minicart/content.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/minicart/content.html @@ -56,7 +56,7 @@ " translate="'Proceed to Checkout'" /> - <div data-bind="html: getCartParam('extra_actions')"></div> + <div data-bind="html: getCartParamUnsanitizedHtml('extra_actions')"></div> </div> </div> </if> From 20ae9e3f3c9b89afe9a7439728cb05f20c09080d Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Tue, 12 Nov 2019 11:32:07 +0200 Subject: [PATCH 0101/1143] magento/magento2#22856: Integration test fix. --- .../CatalogRule/_files/catalog_rule_10_off_not_logged.php | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_10_off_not_logged.php b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_10_off_not_logged.php index 48ed1956c88a1..52357706b0610 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_10_off_not_logged.php +++ b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_10_off_not_logged.php @@ -31,3 +31,4 @@ $indexBuilder = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get(\Magento\CatalogRule\Model\Indexer\IndexBuilder::class); $indexBuilder->reindexFull(); +sleep(1); From 30087a0c1d12f11d77153932f0a2e9b3fb2a9cb8 Mon Sep 17 00:00:00 2001 From: Daniel Ruf <d.ruf@bitexpert.de> Date: Tue, 12 Nov 2019 14:55:14 +0100 Subject: [PATCH 0102/1143] Remove unused TemporaryStateExceptionInterface --- .../Magento/AsynchronousOperations/Model/OperationProcessor.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/AsynchronousOperations/Model/OperationProcessor.php b/app/code/Magento/AsynchronousOperations/Model/OperationProcessor.php index ded507958d8a3..b1bc990159bf3 100644 --- a/app/code/Magento/AsynchronousOperations/Model/OperationProcessor.php +++ b/app/code/Magento/AsynchronousOperations/Model/OperationProcessor.php @@ -18,7 +18,6 @@ use Magento\Framework\MessageQueue\ConsumerConfigurationInterface; use Psr\Log\LoggerInterface; use Magento\Framework\Exception\LocalizedException; -use Magento\Framework\Exception\TemporaryStateExceptionInterface; use Magento\Framework\DB\Adapter\ConnectionException; use Magento\Framework\DB\Adapter\DeadlockException; use Magento\Framework\DB\Adapter\LockWaitException; From 47a18106269a46a91158beaed06faf3d73f31880 Mon Sep 17 00:00:00 2001 From: Alex Kolesnyk <kolesnyk@adobe.com> Date: Tue, 12 Nov 2019 14:09:52 -0600 Subject: [PATCH 0103/1143] Community MTF to MFTF test conversion code delivery --- ...DeleteCategoryUrlRewriteHypenAsRequestPathTest.xml} | 10 ++++++---- ...minDeleteCategoryUrlRewriteWithRequestPathTest.xml} | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) rename app/code/Magento/UrlRewrite/Test/Mftf/Test/{AdminDeleteCategoryUrlRewriteEntityFirstVariationTest.xml => AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml} (83%) rename app/code/Magento/UrlRewrite/Test/Mftf/Test/{AdminDeleteCategoryUrlRewriteEntitySecondVariationTest.xml => AdminDeleteCategoryUrlRewriteWithRequestPathTest.xml} (84%) diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteEntityFirstVariationTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml similarity index 83% rename from app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteEntityFirstVariationTest.xml rename to app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml index c653bf2e910b1..ca292c384979f 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteEntityFirstVariationTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml @@ -7,11 +7,13 @@ --> <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> - <test name="AdminDeleteCategoryUrlRewriteEntityFirstVariationTest"> + <test name="AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest"> <annotations> - <stories value="Delete category URL rewrite first scenario"/> - <title value="Delete category URL rewrite first scenario"/> - <description value="Login as admin and delete category Url Rewrite"/> + <features value="UrlRewrite" /> + <stories value="Delete custom URL rewrite"/> + <title value="Delete category URL rewrite, hyphen as request path"/> + <description value="Delete category URL rewrite, hyphen as request path"/> + <testCaseId value="MC-5348" /> <group value="urlRewrite"/> <group value="mtf_migrated"/> </annotations> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteEntitySecondVariationTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteWithRequestPathTest.xml similarity index 84% rename from app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteEntitySecondVariationTest.xml rename to app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteWithRequestPathTest.xml index f613ee57296e9..3c0dc8dc2be10 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteEntitySecondVariationTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteWithRequestPathTest.xml @@ -7,11 +7,13 @@ --> <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> - <test name="AdminDeleteCategoryUrlRewriteEntitySecondVariationTest"> + <test name="AdminDeleteCategoryUrlRewriteWithRequestPathTest"> <annotations> - <stories value="Delete category URL rewrite second scenario"/> - <title value="Delete category URL rewrite second scenario"/> - <description value="Login as admin and delete category Url Rewrite"/> + <features value="UrlRewrite" /> + <stories value="Delete custom URL rewrite"/> + <title value="Delete category URL rewrite, with request path"/> + <description value="Delete category URL rewrite, with request path"/> + <testCaseId value="MC-5349" /> <group value="urlRewrite"/> <group value="mtf_migrated"/> </annotations> From 69447cbbfa4e70b162b9d080bd25f0a377edd6db Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <51681487+engcom-Foxtrot@users.noreply.github.com> Date: Wed, 13 Nov 2019 11:35:19 +0200 Subject: [PATCH 0104/1143] magento/magento2#22990: Static tests fix. --- .../web/catalog/category/assign-products.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/assign-products.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/assign-products.js index 598bde9106231..20f773b650223 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/assign-products.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/assign-products.js @@ -53,15 +53,15 @@ define([ var trElement = Event.findElement(event, 'tr'), eventElement = Event.element(event), isInputCheckbox = eventElement.tagName === 'INPUT' && eventElement.type === 'checkbox', - isInputPosition = grid.targetElement - && grid.targetElement.tagName === 'INPUT' - && grid.targetElement.name === 'position', + isInputPosition = grid.targetElement && + grid.targetElement.tagName === 'INPUT' && + grid.targetElement.name === 'position', checked = false, checkbox = null; - if (eventElement.tagName === 'LABEL' - && trElement.querySelector('#' + eventElement.htmlFor) - && trElement.querySelector('#' + eventElement.htmlFor).type === 'checkbox' + if (eventElement.tagName === 'LABEL' && + trElement.querySelector('#' + eventElement.htmlFor) && + trElement.querySelector('#' + eventElement.htmlFor).type === 'checkbox' ) { event.stopPropagation(); trElement.querySelector('#' + eventElement.htmlFor).trigger('click'); From 021b5d858670d2f3c8eb2e82bc2454d825abe776 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <51681487+engcom-Foxtrot@users.noreply.github.com> Date: Wed, 13 Nov 2019 12:50:22 +0200 Subject: [PATCH 0105/1143] magento/magento2#22990: Static tests fix. --- .../view/adminhtml/web/catalog/category/assign-products.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/assign-products.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/assign-products.js index 20f773b650223..807f92b2aa27e 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/assign-products.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/assign-products.js @@ -65,6 +65,7 @@ define([ ) { event.stopPropagation(); trElement.querySelector('#' + eventElement.htmlFor).trigger('click'); + return; } From 27a57deb6a6e2f4746e3d0a83946b8234818eee3 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <51681487+engcom-Foxtrot@users.noreply.github.com> Date: Wed, 13 Nov 2019 14:29:10 +0200 Subject: [PATCH 0106/1143] magento/magento2#22990: Static tests fix. --- .../view/adminhtml/web/catalog/category/assign-products.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/assign-products.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/assign-products.js index 807f92b2aa27e..35b8958f2f8fd 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/assign-products.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/assign-products.js @@ -65,7 +65,7 @@ define([ ) { event.stopPropagation(); trElement.querySelector('#' + eventElement.htmlFor).trigger('click'); - + return; } From 0693cc2a75a1646080501176e24d3fd41a72a6b5 Mon Sep 17 00:00:00 2001 From: Alexey Arendarenko <alexeya@ven.com> Date: Thu, 14 Nov 2019 15:08:45 +0200 Subject: [PATCH 0107/1143] UrlRewrite module fixes add ability to save query param from request during redirect to target path --- app/code/Magento/UrlRewrite/Controller/Router.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/UrlRewrite/Controller/Router.php b/app/code/Magento/UrlRewrite/Controller/Router.php index dd26f49b8efa4..0525621b6a20e 100644 --- a/app/code/Magento/UrlRewrite/Controller/Router.php +++ b/app/code/Magento/UrlRewrite/Controller/Router.php @@ -118,7 +118,7 @@ protected function processRedirect($request, $rewrite) if ($rewrite->getEntityType() !== Rewrite::ENTITY_TYPE_CUSTOM || ($prefix = substr($target, 0, 6)) !== 'http:/' && $prefix !== 'https:' ) { - $target = $this->url->getUrl('', ['_direct' => $target]); + $target = $this->url->getUrl('', ['_direct' => $target, '_query' => $request->getParams()]); } return $this->redirect($request, $target, $rewrite->getRedirectType()); } From 19b7bdac3a33eb12395b9f362a7c03e013228cc8 Mon Sep 17 00:00:00 2001 From: Alexey Arendarenko <alexeya@ven.com> Date: Thu, 14 Nov 2019 15:08:55 +0200 Subject: [PATCH 0108/1143] UrlRewrite module fixes update unit test --- .../Test/Unit/Controller/RouterTest.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/UrlRewrite/Test/Unit/Controller/RouterTest.php b/app/code/Magento/UrlRewrite/Test/Unit/Controller/RouterTest.php index c935b3c7ec4cb..c67f3f400b007 100644 --- a/app/code/Magento/UrlRewrite/Test/Unit/Controller/RouterTest.php +++ b/app/code/Magento/UrlRewrite/Test/Unit/Controller/RouterTest.php @@ -260,6 +260,7 @@ public function testNoRewriteAfterStoreSwitcherWhenOldRewriteEqualsToNewOne() */ public function testMatchWithRedirect() { + $queryParams = []; $this->storeManager->expects($this->any())->method('getStore')->will($this->returnValue($this->store)); $urlRewrite = $this->getMockBuilder(UrlRewrite::class) ->disableOriginalConstructor()->getMock(); @@ -268,7 +269,11 @@ public function testMatchWithRedirect() $this->urlFinder->expects($this->any())->method('findOneByData')->will($this->returnValue($urlRewrite)); $this->response->expects($this->once())->method('setRedirect') ->with('new-target-path', 'redirect-code'); - $this->url->expects($this->once())->method('getUrl')->with('', ['_direct' => 'target-path']) + $this->request->expects($this->once())->method('getParams')->willReturn($queryParams); + $this->url->expects($this->once())->method('getUrl')->with( + '', + ['_direct' => 'target-path', '_query' => $queryParams] + ) ->will($this->returnValue('new-target-path')); $this->request->expects($this->once())->method('setDispatched')->with(true); $this->actionFactory->expects($this->once())->method('create') @@ -282,6 +287,7 @@ public function testMatchWithRedirect() */ public function testMatchWithCustomInternalRedirect() { + $queryParams = []; $this->storeManager->expects($this->any())->method('getStore')->will($this->returnValue($this->store)); $urlRewrite = $this->getMockBuilder(UrlRewrite::class) ->disableOriginalConstructor()->getMock(); @@ -289,8 +295,12 @@ public function testMatchWithCustomInternalRedirect() $urlRewrite->expects($this->any())->method('getRedirectType')->will($this->returnValue('redirect-code')); $urlRewrite->expects($this->any())->method('getTargetPath')->will($this->returnValue('target-path')); $this->urlFinder->expects($this->any())->method('findOneByData')->will($this->returnValue($urlRewrite)); + $this->request->expects($this->any())->method('getParams')->willReturn($queryParams); $this->response->expects($this->once())->method('setRedirect')->with('a', 'redirect-code'); - $this->url->expects($this->once())->method('getUrl')->with('', ['_direct' => 'target-path'])->willReturn('a'); + $this->url->expects($this->once())->method('getUrl')->with( + '', + ['_direct' => 'target-path', '_query' => $queryParams] + )->willReturn('a'); $this->request->expects($this->once())->method('setDispatched')->with(true); $this->actionFactory->expects($this->once())->method('create') ->with(\Magento\Framework\App\Action\Redirect::class); @@ -312,6 +322,7 @@ public function testMatchWithCustomExternalRedirect($targetPath) $urlRewrite->expects($this->any())->method('getTargetPath')->will($this->returnValue($targetPath)); $this->urlFinder->expects($this->any())->method('findOneByData')->will($this->returnValue($urlRewrite)); $this->response->expects($this->once())->method('setRedirect')->with($targetPath, 'redirect-code'); + $this->request->expects($this->never())->method('getParams'); $this->url->expects($this->never())->method('getUrl'); $this->request->expects($this->once())->method('setDispatched')->with(true); $this->actionFactory->expects($this->once())->method('create') From e287963e0444f009098c7dcd1206f49d2b52cb1a Mon Sep 17 00:00:00 2001 From: Kate Kyzyma <kate@atwix.com> Date: Thu, 14 Nov 2019 17:58:46 +0200 Subject: [PATCH 0109/1143] Code refactoring --- ...eateNewUrlRewriteForCmsPageActionGroup.xml | 23 +++++ ...llNewCmsPageUrlRewriteFormActionGroup.xml} | 14 +-- ...minGoToAddNewUrlRewritePageActionGroup.xml | 19 ++++ ...ageFromGridForNewUrlRewriteActionGroup.xml | 22 +++++ ...AdminDeleteCmsPageUrlRewriteEntityTest.xml | 99 ------------------- ...teCmsPageUrlRewriteWithNoRedirectsTest.xml | 59 +++++++++++ ...ageUrlRewriteWithPermanentRedirectTest.xml | 55 +++++++++++ ...ageUrlRewriteWithTemporaryRedirectTest.xml | 55 +++++++++++ 8 files changed, 235 insertions(+), 111 deletions(-) create mode 100644 app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminCreateNewUrlRewriteForCmsPageActionGroup.xml rename app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/{AdminAddUrlRewriteForCmsPageActionGroup.xml => AdminFillNewCmsPageUrlRewriteFormActionGroup.xml} (56%) create mode 100644 app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminGoToAddNewUrlRewritePageActionGroup.xml create mode 100644 app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminSelectCmsPageFromGridForNewUrlRewriteActionGroup.xml delete mode 100644 app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteEntityTest.xml create mode 100644 app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.xml create mode 100644 app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithPermanentRedirectTest.xml create mode 100644 app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithTemporaryRedirectTest.xml diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminCreateNewUrlRewriteForCmsPageActionGroup.xml b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminCreateNewUrlRewriteForCmsPageActionGroup.xml new file mode 100644 index 0000000000000..143198e4a1faa --- /dev/null +++ b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminCreateNewUrlRewriteForCmsPageActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateNewUrlRewriteForCmsPageActionGroup"> + <annotations> + <description>Select "For Csm Page" URL Rewrite type</description> + </annotations> + <arguments> + <argument name="customUrlRewriteValue" type="string"/> + </arguments> + + <click selector="{{AdminUrlRewriteEditSection.createCustomUrlRewrite}}" stepKey="clickOnCustomUrlRewrite"/> + <click selector="{{AdminUrlRewriteEditSection.createCustomUrlRewriteValue('customUrlRewriteValue')}}" stepKey="selectForCsmPage"/> + <waitForPageLoad stepKey="waitForCategoryEditSectionToLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminAddUrlRewriteForCmsPageActionGroup.xml b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminFillNewCmsPageUrlRewriteFormActionGroup.xml similarity index 56% rename from app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminAddUrlRewriteForCmsPageActionGroup.xml rename to app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminFillNewCmsPageUrlRewriteFormActionGroup.xml index f46bd7f5e0386..0c540d0698dd8 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminAddUrlRewriteForCmsPageActionGroup.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminFillNewCmsPageUrlRewriteFormActionGroup.xml @@ -8,26 +8,17 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AdminAddUrlRewriteForCmsPageActionGroup"> + <actionGroup name="AdminFillNewCmsPageUrlRewriteFormActionGroup"> <annotations> - <description>Goes to the Admin Add URL Rewrite edit page. Fills in the provided URL details. Clicks on Save. Validates that the Success Message is present.</description> + <description>Fills in the provided URL details. Clicks on Save.</description> </annotations> <arguments> - <argument name="cmsPageUrlKey" type="string"/> - <argument name="customUrlRewriteValue" type="string"/> <argument name="storeValue" type="string"/> <argument name="requestPath" type="string"/> <argument name="redirectTypeValue" type="string"/> <argument name="description" type="string"/> </arguments> - <amOnPage url="{{AdminUrlRewriteEditPage.url}}" stepKey="openUrlRewriteEditPage"/> - <waitForPageLoad stepKey="waitForUrlRewriteEditPageToLoad"/> - <click selector="{{AdminUrlRewriteEditSection.createCustomUrlRewrite}}" stepKey="clickOnCustomUrlRewrite"/> - <click selector="{{AdminUrlRewriteEditSection.createCustomUrlRewriteValue('customUrlRewriteValue')}}" stepKey="selectForCsmPage"/> - <waitForPageLoad stepKey="waitForCategoryEditSectionToLoad"/> - <click selector="{{AdminUrlRewriteEditSection.cmsPage('cmsPageUrlKey')}}" stepKey="selectCmsPage"/> - <waitForPageLoad stepKey="waitForPageToLoad"/> <click selector="{{AdminUrlRewriteEditSection.store}}" stepKey="clickOnStore"/> <click selector="{{AdminUrlRewriteEditSection.storeValue('storeValue')}}" stepKey="clickOnStoreValue"/> <fillField selector="{{AdminUrlRewriteEditSection.requestPath}}" userInput="{{requestPath}}" stepKey="fillRequestPath"/> @@ -35,6 +26,5 @@ <click selector="{{AdminUrlRewriteEditSection.redirectTypeValue('redirectTypeValue')}}" stepKey="clickOnRedirectTypeValue"/> <fillField selector="{{AdminUrlRewriteEditSection.description}}" userInput="{{description}}" stepKey="fillDescription"/> <click selector="{{AdminUrlRewriteEditSection.saveButton}}" stepKey="clickOnSaveButton"/> - <seeElement selector="{{AdminUrlRewriteIndexSection.successMessage}}" stepKey="seeSuccessSaveMessage"/> </actionGroup> </actionGroups> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminGoToAddNewUrlRewritePageActionGroup.xml b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminGoToAddNewUrlRewritePageActionGroup.xml new file mode 100644 index 0000000000000..e0e8df47852d6 --- /dev/null +++ b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminGoToAddNewUrlRewritePageActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminGoToAddNewUrlRewritePageActionGroup"> + <annotations> + <description>Goes to the Admin Add URL Rewrite edit page</description> + </annotations> + + <amOnPage url="{{AdminUrlRewriteEditPage.url}}" stepKey="openUrlRewriteEditPage"/> + <waitForPageLoad stepKey="waitForUrlRewriteEditPageToLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminSelectCmsPageFromGridForNewUrlRewriteActionGroup.xml b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminSelectCmsPageFromGridForNewUrlRewriteActionGroup.xml new file mode 100644 index 0000000000000..2713e3937469b --- /dev/null +++ b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminSelectCmsPageFromGridForNewUrlRewriteActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminSelectCmsPageFromGridForNewUrlRewriteActionGroup"> + <annotations> + <description>Select Cms Page for URL Rewrite from the grid</description> + </annotations> + <arguments> + <argument name="cmsPageUrlKey" type="string"/> + </arguments> + + <click selector="{{AdminUrlRewriteEditSection.cmsPage('cmsPageUrlKey')}}" stepKey="selectCmsPage"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteEntityTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteEntityTest.xml deleted file mode 100644 index 705786afa83bb..0000000000000 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteEntityTest.xml +++ /dev/null @@ -1,99 +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="urn:magento:mftf:Test/etc/testSchema.xsd"> - <test name="AdminDeleteCmsPageUrlRewriteEntityTest"> - <annotations> - <stories value="Delete CMS Page URL rewrite"/> - <title value="Delete CMS Page URL rewrite"/> - <description value="Log in to admin and delete CMS Page URL rewrite"/> - <group value="cMSContent"/> - <group value="mtf_migrated"/> - </annotations> - - <before> - <createData entity="simpleCmsPage" stepKey="createCMSPage"/> - <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> - </before> - <after> - <deleteData createDataKey="createCMSPage" stepKey="deleteCMSPage"/> - <actionGroup ref="logout" stepKey="logout"/> - </after> - - <!-- Create URL Rewrite for CMS Page with No redirects --> - <actionGroup ref="AdminAddUrlRewriteForCmsPageActionGroup" stepKey="addUrlRewrite"> - <argument name="cmsPageUrlKey" value="$$createCMSPage.identifier$$"/> - <argument name="customUrlRewriteValue" value="For CMS page'"/> - <argument name="storeValue" value="Default Store View"/> - <argument name="requestPath" value="newrequestpath"/> - <argument name="redirectTypeValue" value="No"/> - <argument name="description" value="cms_default_no_redirect"/> - </actionGroup> - - <!-- Create URL Rewrite for CMS Page with temporary redirect --> - <actionGroup ref="AdminAddUrlRewriteForCmsPageActionGroup" stepKey="addUrlRewriteTemporary"> - <argument name="cmsPageUrlKey" value="$$createCMSPage.identifier$$"/> - <argument name="customUrlRewriteValue" value="For CMS page'"/> - <argument name="storeValue" value="Default Store View"/> - <argument name="requestPath" value="temporaryrequestpath.html"/> - <argument name="redirectTypeValue" value="Temporary (302)"/> - <argument name="description" value="cms_default_temporary_redirect"/> - </actionGroup> - - <!-- Create URL Rewrite for CMS Page with permanent redirect --> - <actionGroup ref="AdminAddUrlRewriteForCmsPageActionGroup" stepKey="addUrlRewritePermanent"> - <argument name="cmsPageUrlKey" value="$$createCMSPage.identifier$$"/> - <argument name="customUrlRewriteValue" value="For CMS page'"/> - <argument name="storeValue" value="Default Store View"/> - <argument name="requestPath" value="permanentrequestpath.html"/> - <argument name="redirectTypeValue" value="Permanent (301)"/> - <argument name="description" value="cms_default_permanent_redirect"/> - </actionGroup> - - <!--Delete the URL Rewrite for CMS Page with No redirects--> - <actionGroup ref="AdminDeleteUrlRewrite" stepKey="deleteCustomUrlRewrite"> - <argument name="requestPath" value="newrequestpath"/> - </actionGroup> - <actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="assertSuccessMessage"> - <argument name="message" value="You deleted the URL rewrite."/> - </actionGroup> - <!--Search and verify AssertUrlRewriteNotInGrid--> - <actionGroup ref="AdminSearchDeletedUrlRewrite" stepKey="searchDeletedUrlRewriteInGrid"> - <argument name="requestPath" value="newrequestpath"/> - </actionGroup> - <!--Verify AssertPageByUrlRewriteIsNotFound--> - <actionGroup ref="AssertPageByUrlRewriteIsNotFound" stepKey="assertPageByUrlRewriteIsNotFound"> - <argument name="requestPath" value="newrequestpath"/> - </actionGroup> - - <!--Delete the URL Rewrite for CMS Page with with temporary redirect--> - <actionGroup ref="AdminDeleteUrlRewrite" stepKey="deleteTemporaryUrlRewrite"> - <argument name="requestPath" value="temporaryrequestpath.html"/> - </actionGroup> - <actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="assertSuccessMessageSecondTime"> - <argument name="message" value="You deleted the URL rewrite."/> - </actionGroup> - <!--Verify AssertPageByUrlRewriteIsNotFound--> - <actionGroup ref="AssertPageByUrlRewriteIsNotFound" stepKey="assertPageByUrlRewriteIsNotFoundSecondTime"> - <argument name="requestPath" value="temporaryrequestpath.html"/> - </actionGroup> - - <!--Delete the URL Rewrite for CMS Page with permanent redirect--> - <actionGroup ref="AdminDeleteUrlRewrite" stepKey="deletePermanentUrlRewrite"> - <argument name="requestPath" value="permanentrequestpath.html"/> - </actionGroup> - <actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="assertSuccessMessageThirdTime"> - <argument name="message" value="You deleted the URL rewrite."/> - </actionGroup> - <!--Verify AssertPageByUrlRewriteIsNotFound--> - <actionGroup ref="AssertPageByUrlRewriteIsNotFound" stepKey="assertPageByUrlRewriteIsNotFoundThirdTime"> - <argument name="requestPath" value="permanentrequestpath.html"/> - </actionGroup> - - </test> -</tests> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.xml new file mode 100644 index 0000000000000..4c3bd8179578c --- /dev/null +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.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="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest"> + <annotations> + <stories value="Delete CMS Page URL rewrite with No Redirects"/> + <title value="Delete CMS Page URL rewrite with No Redirects"/> + <description value="Log in to admin and delete CMS Page URL rewrite with No Redirects"/> + <group value="cMSContent"/> + <group value="mtf_migrated"/> + </annotations> + + <before> + <createData entity="simpleCmsPage" stepKey="createCMSPage"/> + <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> + </before> + <after> + <deleteData createDataKey="createCMSPage" stepKey="deleteCMSPage"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <actionGroup ref="AdminGoToAddNewUrlRewritePageActionGroup" stepKey="openUrlRewriteEditPage"/> + <actionGroup ref="AdminCreateNewUrlRewriteForCmsPageActionGroup" stepKey="selectForCsmPageType"> + <argument name="customUrlRewriteValue" value="For CMS page'"/> + </actionGroup> + <actionGroup ref="AdminSelectCmsPageFromGridForNewUrlRewriteActionGroup" stepKey="selectCmsPge"> + <argument name="cmsPageUrlKey" value="$$createCMSPage.identifier$$"/> + </actionGroup> + <actionGroup ref="AdminFillNewCmsPageUrlRewriteFormActionGroup" stepKey="fillTheForm"> + <argument name="storeValue" value="Default Store View"/> + <argument name="requestPath" value="newrequestpath"/> + <argument name="redirectTypeValue" value="No"/> + <argument name="description" value="cms_default_no_redirect"/> + </actionGroup> + + <!--Delete the URL Rewrite for CMS Page with No redirects--> + <actionGroup ref="AdminDeleteUrlRewrite" stepKey="deleteCustomUrlRewrite"> + <argument name="requestPath" value="newrequestpath"/> + </actionGroup> + <actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="assertSuccessMessage"> + <argument name="message" value="You deleted the URL rewrite."/> + </actionGroup> + <!--Search and verify AssertUrlRewriteNotInGrid--> + <actionGroup ref="AdminSearchDeletedUrlRewrite" stepKey="searchDeletedUrlRewriteInGrid"> + <argument name="requestPath" value="newrequestpath"/> + </actionGroup> + <!--Verify AssertPageByUrlRewriteIsNotFound--> + <actionGroup ref="AssertPageByUrlRewriteIsNotFound" stepKey="assertPageByUrlRewriteIsNotFound"> + <argument name="requestPath" value="newrequestpath"/> + </actionGroup> + + </test> +</tests> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithPermanentRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithPermanentRedirectTest.xml new file mode 100644 index 0000000000000..89f663b54e017 --- /dev/null +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithPermanentRedirectTest.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="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminDeleteCmsPageUrlRewriteWithPermanentRedirectTest"> + <annotations> + <stories value="Delete CMS Page URL rewrite with Permanent Redirect"/> + <title value="Delete CMS Page URL rewrite with Permanent Redirect"/> + <description value="Log in to admin and delete CMS Page URL rewrite with Permanent Redirect"/> + <group value="cMSContent"/> + <group value="mtf_migrated"/> + </annotations> + + <before> + <createData entity="simpleCmsPage" stepKey="createCMSPage"/> + <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> + </before> + <after> + <deleteData createDataKey="createCMSPage" stepKey="deleteCMSPage"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <actionGroup ref="AdminGoToAddNewUrlRewritePageActionGroup" stepKey="openUrlRewriteEditPage"/> + <actionGroup ref="AdminCreateNewUrlRewriteForCmsPageActionGroup" stepKey="selectForCsmPageType"> + <argument name="customUrlRewriteValue" value="For CMS page'"/> + </actionGroup> + <actionGroup ref="AdminSelectCmsPageFromGridForNewUrlRewriteActionGroup" stepKey="selectCmsPge"> + <argument name="cmsPageUrlKey" value="$$createCMSPage.identifier$$"/> + </actionGroup> + <actionGroup ref="AdminFillNewCmsPageUrlRewriteFormActionGroup" stepKey="fillTheForm"> + <argument name="storeValue" value="Default Store View"/> + <argument name="requestPath" value="permanentrequestpath.html"/> + <argument name="redirectTypeValue" value="Permanent (301)"/> + <argument name="description" value="cms_default_permanent_redirect"/> + </actionGroup> + + <!-- Delete the URL Rewrite for CMS Page with permanent redirect--> + <actionGroup ref="AdminDeleteUrlRewrite" stepKey="deletePermanentUrlRewrite"> + <argument name="requestPath" value="permanentrequestpath.html"/> + </actionGroup> + <actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="assertSuccessMessage"> + <argument name="message" value="You deleted the URL rewrite."/> + </actionGroup> + <!-- Verify AssertPageByUrlRewriteIsNotFound --> + <actionGroup ref="AssertPageByUrlRewriteIsNotFound" stepKey="assertPageByUrlRewriteIsNotFound"> + <argument name="requestPath" value="permanentrequestpath.html"/> + </actionGroup> + + </test> +</tests> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithTemporaryRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithTemporaryRedirectTest.xml new file mode 100644 index 0000000000000..ad7aec335b7a3 --- /dev/null +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithTemporaryRedirectTest.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="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminDeleteCmsPageUrlRewriteWithTemporaryRedirectTest"> + <annotations> + <stories value="Delete CMS Page URL rewrite with Temporary Redirect"/> + <title value="Delete CMS Page URL rewrite with Temporary Redirect"/> + <description value="Log in to admin and delete CMS Page URL rewrite with Temporary Redirect"/> + <group value="cMSContent"/> + <group value="mtf_migrated"/> + </annotations> + + <before> + <createData entity="simpleCmsPage" stepKey="createCMSPage"/> + <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> + </before> + <after> + <deleteData createDataKey="createCMSPage" stepKey="deleteCMSPage"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <actionGroup ref="AdminGoToAddNewUrlRewritePageActionGroup" stepKey="openUrlRewriteEditPage"/> + <actionGroup ref="AdminCreateNewUrlRewriteForCmsPageActionGroup" stepKey="selectForCsmPageType"> + <argument name="customUrlRewriteValue" value="For CMS page'"/> + </actionGroup> + <actionGroup ref="AdminSelectCmsPageFromGridForNewUrlRewriteActionGroup" stepKey="selectCmsPge"> + <argument name="cmsPageUrlKey" value="$$createCMSPage.identifier$$"/> + </actionGroup> + <actionGroup ref="AdminFillNewCmsPageUrlRewriteFormActionGroup" stepKey="fillTheForm"> + <argument name="storeValue" value="Default Store View"/> + <argument name="requestPath" value="temporaryrequestpath.html"/> + <argument name="redirectTypeValue" value="Temporary (302)"/> + <argument name="description" value="cms_default_temporary_redirect"/> + </actionGroup> + + <!-- Delete the URL Rewrite for CMS Page with with temporary redirect--> + <actionGroup ref="AdminDeleteUrlRewrite" stepKey="deleteTemporaryUrlRewrite"> + <argument name="requestPath" value="temporaryrequestpath.html"/> + </actionGroup> + <actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="assertSuccessMessage"> + <argument name="message" value="You deleted the URL rewrite."/> + </actionGroup> + <!--Verify AssertPageByUrlRewriteIsNotFound--> + <actionGroup ref="AssertPageByUrlRewriteIsNotFound" stepKey="assertPageByUrlRewriteIsNotFound"> + <argument name="requestPath" value="temporaryrequestpath.html"/> + </actionGroup> + + </test> +</tests> From 841872ca4313ca6b4a3587a65598ce8206ad90a9 Mon Sep 17 00:00:00 2001 From: Buba Suma <soumah@adobe.com> Date: Thu, 14 Nov 2019 13:14:53 -0600 Subject: [PATCH 0110/1143] MC-23068: Change in-product doc url to devdocs - Move "Minimum Terms to Match" down to search configuration section - Change documentation URL for "Minimum Terms to Match" --- .../Elasticsearch/etc/adminhtml/system.xml | 32 +++++++++---------- .../Elasticsearch6/etc/adminhtml/system.xml | 17 +++++----- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/app/code/Magento/Elasticsearch/etc/adminhtml/system.xml b/app/code/Magento/Elasticsearch/etc/adminhtml/system.xml index 1f61a48db9bfa..41c6710412db9 100644 --- a/app/code/Magento/Elasticsearch/etc/adminhtml/system.xml +++ b/app/code/Magento/Elasticsearch/etc/adminhtml/system.xml @@ -55,21 +55,21 @@ <field id="engine">elasticsearch</field> </depends> </field> - <field id="elasticsearch_minimum_should_match" translate="label" type="text" sortOrder="68" showInDefault="1" showInWebsite="0" showInStore="0"> - <label>Minimum Terms to Match</label> + <field id="elasticsearch_test_connect_wizard" translate="button_label" sortOrder="68" showInDefault="1" showInWebsite="0" showInStore="0"> + <label/> + <button_label>Test Connection</button_label> + <frontend_model>Magento\Elasticsearch\Block\Adminhtml\System\Config\TestConnection</frontend_model> <depends> <field id="engine">elasticsearch</field> </depends> - <comment><![CDATA[See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-minimum-should-match.html">here</a> for possible values.]]></comment> - <backend_model>Magento\Elasticsearch\Model\Config\Backend\MinimumShouldMatch</backend_model> </field> - <field id="elasticsearch_test_connect_wizard" translate="button_label" sortOrder="69" showInDefault="1" showInWebsite="0" showInStore="0"> - <label/> - <button_label>Test Connection</button_label> - <frontend_model>Magento\Elasticsearch\Block\Adminhtml\System\Config\TestConnection</frontend_model> + <field id="elasticsearch_minimum_should_match" translate="label" type="text" sortOrder="93" showInDefault="1" showInWebsite="0" showInStore="0"> + <label>Minimum Terms to Match</label> <depends> <field id="engine">elasticsearch</field> </depends> + <comment><![CDATA[<a href="https://docs.magento.com/m2/ce/user_guide/catalog/search-elasticsearch.html">Learn more</a> about valid syntax.]]></comment> + <backend_model>Magento\Elasticsearch\Model\Config\Backend\MinimumShouldMatch</backend_model> </field> <!-- Elasticsearch 5.0+ --> <field id="elasticsearch5_server_hostname" translate="label" type="text" sortOrder="61" showInDefault="1" showInWebsite="0" showInStore="0"> @@ -117,21 +117,21 @@ <field id="engine">elasticsearch5</field> </depends> </field> - <field id="elasticsearch5_minimum_should_match" translate="label" type="text" sortOrder="68" showInDefault="1" showInWebsite="0" showInStore="0"> - <label>Minimum Terms to Match</label> + <field id="elasticsearch5_test_connect_wizard" translate="button_label" sortOrder="68" showInDefault="1" showInWebsite="0" showInStore="0"> + <label/> + <button_label>Test Connection</button_label> + <frontend_model>Magento\Elasticsearch\Block\Adminhtml\System\Config\Elasticsearch5\TestConnection</frontend_model> <depends> <field id="engine">elasticsearch5</field> </depends> - <comment><![CDATA[See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-minimum-should-match.html">here</a> for possible values.]]></comment> - <backend_model>Magento\Elasticsearch\Model\Config\Backend\MinimumShouldMatch</backend_model> </field> - <field id="elasticsearch5_test_connect_wizard" translate="button_label" sortOrder="69" showInDefault="1" showInWebsite="0" showInStore="0"> - <label/> - <button_label>Test Connection</button_label> - <frontend_model>Magento\Elasticsearch\Block\Adminhtml\System\Config\Elasticsearch5\TestConnection</frontend_model> + <field id="elasticsearch5_minimum_should_match" translate="label" type="text" sortOrder="93" showInDefault="1" showInWebsite="0" showInStore="0"> + <label>Minimum Terms to Match</label> <depends> <field id="engine">elasticsearch5</field> </depends> + <comment><![CDATA[<a href="https://docs.magento.com/m2/ce/user_guide/catalog/search-elasticsearch.html">Learn more</a> about valid syntax.]]></comment> + <backend_model>Magento\Elasticsearch\Model\Config\Backend\MinimumShouldMatch</backend_model> </field> </group> </section> diff --git a/app/code/Magento/Elasticsearch6/etc/adminhtml/system.xml b/app/code/Magento/Elasticsearch6/etc/adminhtml/system.xml index 8d22fcbc5f8f4..beccb0c1ceb81 100644 --- a/app/code/Magento/Elasticsearch6/etc/adminhtml/system.xml +++ b/app/code/Magento/Elasticsearch6/etc/adminhtml/system.xml @@ -70,24 +70,23 @@ </depends> </field> - <field id="elasticsearch6_minimum_should_match" translate="label" type="text" sortOrder="78" showInDefault="1" + <field id="elasticsearch6_test_connect_wizard" translate="button_label" sortOrder="78" showInDefault="1" showInWebsite="0" showInStore="0"> - <label>Minimum Terms to Match</label> + <label/> + <button_label>Test Connection</button_label> + <frontend_model>Magento\Elasticsearch6\Block\Adminhtml\System\Config\TestConnection</frontend_model> <depends> <field id="engine">elasticsearch6</field> </depends> - <comment><![CDATA[See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-minimum-should-match.html">here</a> for possible values.]]></comment> - <backend_model>Magento\Elasticsearch\Model\Config\Backend\MinimumShouldMatch</backend_model> </field> - - <field id="elasticsearch6_test_connect_wizard" translate="button_label" sortOrder="79" showInDefault="1" + <field id="elasticsearch6_minimum_should_match" translate="label" type="text" sortOrder="93" showInDefault="1" showInWebsite="0" showInStore="0"> - <label/> - <button_label>Test Connection</button_label> - <frontend_model>Magento\Elasticsearch6\Block\Adminhtml\System\Config\TestConnection</frontend_model> + <label>Minimum Terms to Match</label> <depends> <field id="engine">elasticsearch6</field> </depends> + <comment><![CDATA[<a href="https://docs.magento.com/m2/ce/user_guide/catalog/search-elasticsearch.html">Learn more</a> about valid syntax.]]></comment> + <backend_model>Magento\Elasticsearch\Model\Config\Backend\MinimumShouldMatch</backend_model> </field> </group> </section> From f63475c37e37dde8eef9f404f518eb415c7557b0 Mon Sep 17 00:00:00 2001 From: Alexey Arendarenko <alexeya@ven.com> Date: Thu, 14 Nov 2019 15:10:37 +0200 Subject: [PATCH 0111/1143] UrlRewrite module fixes update fixture update integration test --- .../UrlRewrite/Controller/UrlRewriteTest.php | 30 +++++++++++++ .../Magento/UrlRewrite/_files/url_rewrite.php | 42 ++++++++++++++++++- .../_files/url_rewrite_rollback.php | 4 +- 3 files changed, 73 insertions(+), 3 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/UrlRewrite/Controller/UrlRewriteTest.php b/dev/tests/integration/testsuite/Magento/UrlRewrite/Controller/UrlRewriteTest.php index 5f8adc5d65113..b6a551cc6ad50 100644 --- a/dev/tests/integration/testsuite/Magento/UrlRewrite/Controller/UrlRewriteTest.php +++ b/dev/tests/integration/testsuite/Magento/UrlRewrite/Controller/UrlRewriteTest.php @@ -80,6 +80,36 @@ public function requestDataProvider(): array 'request' => '/page-similar/', 'redirect' => '/page-b', ], + 'Use Case #7: Rewrite: page-similar --(301)--> page-a; ' + . 'Request: page-similar?param=1 --(301)--> page-a?param=1' => [ + 'request' => '/page-similar?param=1', + 'redirect' => '/page-a?param=1', + ], + 'Use Case #8: Rewrite: page-similar/ --(301)--> page-b; ' + . 'Request: page-similar/?param=1 --(301)--> page-b?param=1' => [ + 'request' => '/page-similar/?param=1', + 'redirect' => '/page-b?param=1', + ], + 'Use Case #9: Rewrite: page-similar-query-param --(301)--> page-d?param1=1;' + . 'Request: page-similar-query-param --(301)--> page-d?param1=1' => [ + 'request' => '/page-similar-query-param', + 'redirect' => '/page-d?param1=1', + ], + 'Use Case #10: Rewrite: page-similar-query-param --(301)--> page-d?param1=1; ' + . 'Request: page-similar-query-param?param2=1 --(301)--> page-d?param1=1¶m2=1' => [ + 'request' => '/page-similar-query-param?param2=1', + 'redirect' => '/page-d?param1=1¶m2=1', + ], + 'Use Case #11: Rewrite: page-similar-query-param/ --(301)--> page-e?param1=1; ' + . 'Request: page-similar-query-param/ --(301)--> page-e?param1=1' => [ + 'request' => '/page-similar-query-param/', + 'redirect' => '/page-e?param1=1', + ], + 'Use Case #12: Rewrite: page-similar-query-param/ --(301)--> page-e?param1=1;' + . 'Request: page-similar-query-param/?param2=1 --(301)--> page-e?param1=1¶m2=1' => [ + 'request' => '/page-similar-query-param/?param2=1', + 'redirect' => '/page-e?param1=1¶m2=1', + ], ]; } } diff --git a/dev/tests/integration/testsuite/Magento/UrlRewrite/_files/url_rewrite.php b/dev/tests/integration/testsuite/Magento/UrlRewrite/_files/url_rewrite.php index 8e82aa853d4a4..dc3f5490f5a53 100644 --- a/dev/tests/integration/testsuite/Magento/UrlRewrite/_files/url_rewrite.php +++ b/dev/tests/integration/testsuite/Magento/UrlRewrite/_files/url_rewrite.php @@ -64,6 +64,26 @@ ->setStores([$storeID, $secondStoreId]); $pageResource->save($page); +$page = $objectManager->create(Page::class); +$page->setTitle('Cms D') + ->setIdentifier('page-d') + ->setIsActive(1) + ->setContent('<h1>Cms Page D</h1>') + ->setPageLayout('1column') + ->setCustomTheme('Magento/blank') + ->setStores([$storeID, $secondStoreId]); +$pageResource->save($page); + +$page = $objectManager->create(Page::class); +$page->setTitle('Cms E') + ->setIdentifier('page-e') + ->setIsActive(1) + ->setContent('<h1>Cms Page E</h1>') + ->setPageLayout('1column') + ->setCustomTheme('Magento/blank') + ->setStores([$storeID, $secondStoreId]); +$pageResource->save($page); + $rewrite = $objectManager->create(UrlRewrite::class); $rewrite->setEntityType('custom') ->setRequestPath('page-one/') @@ -88,7 +108,7 @@ ->setTargetPath('page-a') ->setRedirectType(OptionProvider::PERMANENT) ->setStoreId($storeID) - ->setDescription('From age-similar without trailing slash to page-a'); + ->setDescription('From page-similar without trailing slash to page-a'); $rewriteResource->save($rewrite); $rewrite = $objectManager->create(UrlRewrite::class); @@ -97,7 +117,7 @@ ->setTargetPath('page-b') ->setRedirectType(OptionProvider::PERMANENT) ->setStoreId($storeID) - ->setDescription('From age-similar with trailing slash to page-b'); + ->setDescription('From page-similar with trailing slash to page-b'); $rewriteResource->save($rewrite); //Emulating auto-generated aliases (like the ones used for categories). @@ -117,3 +137,21 @@ ->setRedirectType(0) ->setStoreId($secondStoreId); $rewriteResource->save($rewrite); + +$rewrite = $objectManager->create(UrlRewrite::class); +$rewrite->setEntityType('custom') + ->setRequestPath('page-similar-query-param') + ->setTargetPath('page-d?param1=1') + ->setRedirectType(OptionProvider::PERMANENT) + ->setStoreId($storeID) + ->setDescription('From page-similar-query-param to page-d with query param'); +$rewriteResource->save($rewrite); + +$rewrite = $objectManager->create(UrlRewrite::class); +$rewrite->setEntityType('custom') + ->setRequestPath('page-similar-query-param/') + ->setTargetPath('page-e?param1=1') + ->setRedirectType(OptionProvider::PERMANENT) + ->setStoreId($storeID) + ->setDescription('From page-similar-query-param with trailing slash to page-e with query param'); +$rewriteResource->save($rewrite); diff --git a/dev/tests/integration/testsuite/Magento/UrlRewrite/_files/url_rewrite_rollback.php b/dev/tests/integration/testsuite/Magento/UrlRewrite/_files/url_rewrite_rollback.php index 22d95751fbf26..76b84810ac433 100644 --- a/dev/tests/integration/testsuite/Magento/UrlRewrite/_files/url_rewrite_rollback.php +++ b/dev/tests/integration/testsuite/Magento/UrlRewrite/_files/url_rewrite_rollback.php @@ -19,6 +19,8 @@ $pageRepository->deleteById('page-a'); $pageRepository->deleteById('page-b'); $pageRepository->deleteById('page-c'); +$pageRepository->deleteById('page-d'); +$pageRepository->deleteById('page-e'); /** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */ $productRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() @@ -29,7 +31,7 @@ ->create(\Magento\UrlRewrite\Model\ResourceModel\UrlRewriteCollection::class); $collection = $urlRewriteCollection ->addFieldToFilter('entity_type', 'custom') - ->addFieldToFilter('target_path', ['page-a/', 'page-a', 'page-b', 'page-c']) + ->addFieldToFilter('target_path', ['page-a/', 'page-a', 'page-b', 'page-c', 'page-d?param1=1', 'page-e?param1=1']) ->load() ->walk('delete'); From 094565fa335f20e3b77280c12090f5ad58dd0625 Mon Sep 17 00:00:00 2001 From: Dan Wallis <mrdanwallis@gmail.com> Date: Sat, 16 Nov 2019 14:55:14 +0000 Subject: [PATCH 0112/1143] Add right arrow to show some items have children --- .../Magento/backend/web/css/source/_actions.less | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/design/adminhtml/Magento/backend/web/css/source/_actions.less b/app/design/adminhtml/Magento/backend/web/css/source/_actions.less index 886bbcc29a3b9..28912d873ae00 100644 --- a/app/design/adminhtml/Magento/backend/web/css/source/_actions.less +++ b/app/design/adminhtml/Magento/backend/web/css/source/_actions.less @@ -444,6 +444,20 @@ button { > .action-menu-item { min-width: 100%; } + + &::after { + border-color: transparent transparent transparent #000; + border-style: solid; + border-width: 0.4rem 0 0.4rem 0.5rem; + content: ''; + height: 0; + margin-top: -0.2rem; + position: absolute; + right: 1rem; + top: 50%; + transition: all .2s linear; + width: 0; + } } } From 540b1340275b001aca44ce3d889a039614167a8e Mon Sep 17 00:00:00 2001 From: Mateusz Krzeszowiak <mateusz.krzeszowiak@creativestyle.pl> Date: Wed, 13 Nov 2019 18:10:05 +0100 Subject: [PATCH 0113/1143] Refactor JavaScript mixins module Fixes https://github.com/magento/magento2/issues/25586. --- lib/web/mage/requirejs/mixins.js | 152 ++++++++++++------------------- 1 file changed, 57 insertions(+), 95 deletions(-) diff --git a/lib/web/mage/requirejs/mixins.js b/lib/web/mage/requirejs/mixins.js index 77d98e0f81394..acda3ebf467d7 100644 --- a/lib/web/mage/requirejs/mixins.js +++ b/lib/web/mage/requirejs/mixins.js @@ -7,7 +7,25 @@ define('mixins', [ ], function (module) { 'use strict'; - var rjsMixins; + var contexts = require.s.contexts, + defContextName = '_', + defContext = contexts[defContextName], + unbundledContext = require.s.newContext('$'), + defaultConfig = defContext.config, + unbundledConfig = { + baseUrl: defaultConfig.baseUrl, + paths: defaultConfig.paths, + shim: defaultConfig.shim, + config: defaultConfig.config, + map: defaultConfig.map + }, + rjsMixins; + + /** + * Prepare a separate context where modules are not assigned to bundles + * so we are able to get their true path and corresponding mixins. + */ + unbundledContext.configure(unbundledConfig); /** * Checks if specified string contains @@ -50,14 +68,14 @@ define('mixins', [ /** * Extracts url (without baseUrl prefix) - * from a modules' name. + * from a module name ignoring the fact that it may be bundled. * * @param {String} name - Name, path or alias of a module. - * @param {Object} config - Contexts' configuartion. + * @param {Object} config - Context's configuartion. * @returns {String} */ function getPath(name, config) { - var url = require.toUrl(name); + var url = unbundledContext.require.toUrl(name); return removeBaseUrl(url, config); } @@ -73,11 +91,11 @@ define('mixins', [ } /** - * Iterativly calls mixins passing to them + * Iteratively calls mixins passing to them * current value of a 'target' parameter. * * @param {*} target - Value to be modified. - * @param {...Function} mixins + * @param {...Function} mixins - List of mixins to apply. * @returns {*} Modified 'target' value. */ function applyMixins(target) { @@ -94,8 +112,13 @@ define('mixins', [ /** * Loads specified module along with its' mixins. + * This method is called for each module defined with "mixins!" prefix + * in its name that was added by processNames method. * * @param {String} name - Module to be loaded. + * @param {Function} req - Local "require" function to use to load other modules. + * @param {Function} onLoad - A function to call with the value for name. + * @param {Object} config - RequireJS configuration object. */ load: function (name, req, onLoad, config) { var path = getPath(name, config), @@ -110,14 +133,14 @@ define('mixins', [ /** * Retrieves list of mixins associated with a specified module. * - * @param {String} path - Path to the module (without base url). + * @param {String} path - Path to the module (without base URL). * @returns {Array} An array of paths to mixins. */ getMixins: function (path) { var config = module.config() || {}, - mixins; + mixins; - // fix for when urlArgs is set + // Fix for when urlArgs is set. if (path.indexOf('?') !== -1) { path = path.substring(0, path.indexOf('?')); } @@ -131,7 +154,7 @@ define('mixins', [ /** * Checks if specified module has associated with it mixins. * - * @param {String} path - Path to the module (without base url). + * @param {String} path - Path to the module (without base URL). * @returns {Boolean} */ hasMixins: function (path) { @@ -139,11 +162,11 @@ define('mixins', [ }, /** - * Modifies provided names perpending to them + * Modifies provided names prepending to them * the 'mixins!' plugin prefix if it's necessary. * * @param {(Array|String)} names - Module names, paths or aliases. - * @param {Object} context - Current requirejs context. + * @param {Object} context - Current RequireJS context. * @returns {Array|String} */ processNames: function (names, context) { @@ -179,101 +202,40 @@ require([ ], function (mixins) { 'use strict'; - var originalRequire = window.require, - originalDefine = window.define, - contexts = originalRequire.s.contexts, - defContextName = '_', - hasOwn = Object.prototype.hasOwnProperty, - getLastInQueue; - - getLastInQueue = - '(function () {' + - 'var queue = globalDefQueue,' + - 'item = queue[queue.length - 1];' + - '' + - 'return item;' + - '})();'; - - /** - * Returns property of an object if - * it's not defined in it's prototype. - * - * @param {Object} obj - Object whose property should be retrieved. - * @param {String} prop - Name of the property. - * @returns {*} Value of the property or false. - */ - function getOwn(obj, prop) { - return hasOwn.call(obj, prop) && obj[prop]; - } - - /** - * Overrides global 'require' method adding to it dependencies modfication. - */ - window.require = function (deps, callback, errback, optional) { - var contextName = defContextName, - context, - config; - - if (!Array.isArray(deps) && typeof deps !== 'string') { - config = deps; - - if (Array.isArray(callback)) { - deps = callback; - callback = errback; - errback = optional; - } else { - deps = []; - } - } - - if (config && config.context) { - contextName = config.context; - } - - context = getOwn(contexts, contextName); - - if (!context) { - context = contexts[contextName] = require.s.newContext(contextName); - } - - if (config) { - context.configure(config); - } - - deps = mixins.processNames(deps, context); - - return context.require(deps, callback, errback); - }; + var contexts = require.s.contexts, + defContextName = '_', + defContext = contexts[defContextName], + originalContextRequire = defContext.require, + processNames = mixins.processNames; /** - * Overrides global 'define' method adding to it dependencies modfication. + * Wrap default context's require function which gets called every time + * module is requested using require call. The upside of this approach + * is that deps parameter is already normalized and guaranteed to be an array. */ - window.define = function (name, deps, callback) { // eslint-disable-line no-unused-vars - var context = getOwn(contexts, defContextName), - result = originalDefine.apply(this, arguments), - queueItem = require.exec(getLastInQueue), - lastDeps = queueItem && queueItem[1]; - - if (Array.isArray(lastDeps)) { - queueItem[1] = mixins.processNames(lastDeps, context); - } + defContext.require = function (deps, callback, errback) { + deps = processNames(deps, defContext); - return result; + return originalContextRequire(deps, callback, errback); }; /** * Copy properties of original 'require' method. */ - Object.keys(originalRequire).forEach(function (key) { - require[key] = originalRequire[key]; + Object.keys(originalContextRequire).forEach(function (key) { + defContext.require[key] = originalContextRequire[key]; }); /** - * Copy properties of original 'define' method. + * Wrap shift method from context's definitions queue. + * Items are added to the queue when a new module is defined and taken + * from it every time require call happens. */ - Object.keys(originalDefine).forEach(function (key) { - define[key] = originalDefine[key]; - }); + defContext.defQueue.shift = function () { + var queueItem = Array.prototype.shift.call(this); + + queueItem[1] = processNames(queueItem[1], defContext); - window.requirejs = window.require; + return queueItem; + }; }); From a79a3e1d2b421458ce1d3fb564913f739f8e8f76 Mon Sep 17 00:00:00 2001 From: torhoehn <torhoehn@gmail.com> Date: Mon, 18 Nov 2019 15:56:27 +0100 Subject: [PATCH 0114/1143] set correct pram like in BlockRepository implementation --- app/code/Magento/Cms/Api/BlockRepositoryInterface.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Cms/Api/BlockRepositoryInterface.php b/app/code/Magento/Cms/Api/BlockRepositoryInterface.php index b713ca91ea852..4b180b5153295 100644 --- a/app/code/Magento/Cms/Api/BlockRepositoryInterface.php +++ b/app/code/Magento/Cms/Api/BlockRepositoryInterface.php @@ -24,7 +24,7 @@ public function save(Data\BlockInterface $block); /** * Retrieve block. * - * @param int $blockId + * @param string $blockId * @return \Magento\Cms\Api\Data\BlockInterface * @throws \Magento\Framework\Exception\LocalizedException */ @@ -51,7 +51,7 @@ public function delete(Data\BlockInterface $block); /** * Delete block by ID. * - * @param int $blockId + * @param string $blockId * @return bool true on success * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\LocalizedException From 21620c69868e3786148b3e8f5e0d0786a7f7540b Mon Sep 17 00:00:00 2001 From: Mateusz Krzeszowiak <mateusz.krzeszowiak@creativestyle.pl> Date: Mon, 18 Nov 2019 15:58:32 +0100 Subject: [PATCH 0115/1143] Add tests --- .../tests/lib/mage/requirejs/mixins.test.js | 148 ++++++++++++++++++ lib/web/mage/requirejs/mixins.js | 2 +- 2 files changed, 149 insertions(+), 1 deletion(-) create mode 100644 dev/tests/js/jasmine/tests/lib/mage/requirejs/mixins.test.js diff --git a/dev/tests/js/jasmine/tests/lib/mage/requirejs/mixins.test.js b/dev/tests/js/jasmine/tests/lib/mage/requirejs/mixins.test.js new file mode 100644 index 0000000000000..3d85f77b87467 --- /dev/null +++ b/dev/tests/js/jasmine/tests/lib/mage/requirejs/mixins.test.js @@ -0,0 +1,148 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +/* eslint max-nested-callbacks: 0 */ +require.config({ + paths: { + 'mixins': 'mage/requirejs/mixins' + } +}); + +define(['rjsResolver', 'mixins'], function (resolver, mixins) { + 'use strict'; + + var context = { + config: {} + }; + + describe('mixins module', function () { + beforeEach(function (done) { + // Wait for all modules to be loaded so they don't interfere with testing. + resolver(function () { + done(); + }); + }); + + describe('processNames method', function () { + beforeEach(function () { + spyOn(mixins, 'processNames').and.callThrough(); + spyOn(mixins, 'hasMixins').and.callThrough(); + }); + + it('gets called when module is both required and defined', function (done) { + var name = 'tests/assets/mixins/defined-module', + dependencyName = 'tests/assets/mixins/defined-module-dependency'; + + define(dependencyName, [], function () {}); + define(name, [dependencyName], function () {}); + + require([name], function () { + expect(mixins.processNames.calls.argsFor(0)[0]).toEqual([]); + expect(mixins.processNames.calls.argsFor(1)[0]).toEqual([dependencyName]); + expect(mixins.processNames.calls.argsFor(2)[0]).toEqual([name]); + done(); + }); + }); + + it('keeps name intact when it already contains another plugin', function () { + mixins.hasMixins.and.returnValue(true); + + expect(mixins.processNames('plugin!module', context)).toBe('plugin!module'); + }); + + it('keeps name intact when it has no mixins', function () { + mixins.hasMixins.and.returnValue(false); + + expect(mixins.processNames('module', context)).toBe('module'); + }); + + it('keeps names intact when they have no mixins', function () { + mixins.hasMixins.and.returnValue(false); + + expect(mixins.processNames(['module'], context)).toEqual(['module']); + }); + + it('adds prefix to name when it has mixins', function () { + mixins.hasMixins.and.returnValue(true); + + expect(mixins.processNames('module', context)).toBe('mixins!module'); + }); + + it('adds prefix to name when it contains a relative path', function () { + mixins.hasMixins.and.returnValue(false); + + expect(mixins.processNames('./module', context)).toBe('mixins!./module'); + }); + + it('adds prefix to names when they contain a relative path', function () { + mixins.hasMixins.and.returnValue(false); + + expect(mixins.processNames(['./module'], context)).toEqual(['mixins!./module']); + }); + + it('adds prefix to names when they have mixins', function () { + mixins.hasMixins.and.returnValue(true); + + expect(mixins.processNames(['module'], context)).toEqual(['mixins!module']); + }); + }); + + describe('load method', function () { + it('is not called when module has mixins', function (done) { + var name = 'tests/assets/mixins/load-not-called'; + + spyOn(mixins, 'hasMixins').and.returnValue(false); + spyOn(mixins, 'load').and.callThrough(); + + define(name, [], function () {}); + + require([name], function () { + expect(mixins.load.calls.any()).toBe(false); + done(); + }); + }); + + it('is called when module has mixins', function (done) { + var name = 'tests/assets/mixins/load-called'; + + spyOn(mixins, 'hasMixins').and.returnValue(true); + spyOn(mixins, 'load').and.callThrough(); + + define(name, [], function () {}); + + require([name], function () { + expect(mixins.load.calls.mostRecent().args[0]).toEqual(name); + done(); + }); + }); + + it('applies mixins for loaded module', function (done) { + var name = 'tests/assets/mixins/mixins-applied', + mixinName = 'tests/assets/mixins/mixins-applied-ext'; + + spyOn(mixins, 'hasMixins').and.returnValue(true); + spyOn(mixins, 'load').and.callThrough(); + spyOn(mixins, 'getMixins').and.returnValue([mixinName]); + + define(name, [], function () { + return { value: 'original' }; + }); + + define(mixinName, [], function () { + return function(module) { + module.value = 'changed'; + + return module; + }; + }); + + require([name], function (module) { + expect(module.value).toBe('changed'); + done(); + }); + }); + }); + }); +}); diff --git a/lib/web/mage/requirejs/mixins.js b/lib/web/mage/requirejs/mixins.js index acda3ebf467d7..613605038f4b9 100644 --- a/lib/web/mage/requirejs/mixins.js +++ b/lib/web/mage/requirejs/mixins.js @@ -71,7 +71,7 @@ define('mixins', [ * from a module name ignoring the fact that it may be bundled. * * @param {String} name - Name, path or alias of a module. - * @param {Object} config - Context's configuartion. + * @param {Object} config - Context's configuration. * @returns {String} */ function getPath(name, config) { From 8eb66b564753fd3fab258189a368c05d771eb2a7 Mon Sep 17 00:00:00 2001 From: Mateusz Krzeszowiak <mateusz.krzeszowiak@creativestyle.pl> Date: Mon, 18 Nov 2019 15:59:36 +0100 Subject: [PATCH 0116/1143] Test more of a public api then internal behaviour --- .../tests/lib/mage/requirejs/mixins.test.js | 199 +++++++++++------- 1 file changed, 119 insertions(+), 80 deletions(-) diff --git a/dev/tests/js/jasmine/tests/lib/mage/requirejs/mixins.test.js b/dev/tests/js/jasmine/tests/lib/mage/requirejs/mixins.test.js index 3d85f77b87467..52374a24e8c68 100644 --- a/dev/tests/js/jasmine/tests/lib/mage/requirejs/mixins.test.js +++ b/dev/tests/js/jasmine/tests/lib/mage/requirejs/mixins.test.js @@ -4,6 +4,8 @@ */ /* eslint max-nested-callbacks: 0 */ +// jscs:disable jsDoc + require.config({ paths: { 'mixins': 'mage/requirejs/mixins' @@ -13,136 +15,173 @@ require.config({ define(['rjsResolver', 'mixins'], function (resolver, mixins) { 'use strict'; - var context = { - config: {} - }; - describe('mixins module', function () { beforeEach(function (done) { + spyOn(mixins, 'hasMixins').and.callThrough(); + spyOn(mixins, 'getMixins').and.callThrough(); + spyOn(mixins, 'load').and.callThrough(); + // Wait for all modules to be loaded so they don't interfere with testing. resolver(function () { done(); }); }); - describe('processNames method', function () { - beforeEach(function () { - spyOn(mixins, 'processNames').and.callThrough(); - spyOn(mixins, 'hasMixins').and.callThrough(); - }); + it('does not affect modules without mixins', function (done) { + var name = 'tests/assets/mixins/no-mixins', + mixinName = 'tests/assets/mixins/no-mixins-ext'; - it('gets called when module is both required and defined', function (done) { - var name = 'tests/assets/mixins/defined-module', - dependencyName = 'tests/assets/mixins/defined-module-dependency'; + mixins.hasMixins.and.returnValue(false); - define(dependencyName, [], function () {}); - define(name, [dependencyName], function () {}); + define(name, [], function () { + return { + value: 'original' + }; + }); + + define(mixinName, [], function () { + return function (module) { + module.value = 'changed'; - require([name], function () { - expect(mixins.processNames.calls.argsFor(0)[0]).toEqual([]); - expect(mixins.processNames.calls.argsFor(1)[0]).toEqual([dependencyName]); - expect(mixins.processNames.calls.argsFor(2)[0]).toEqual([name]); - done(); - }); + return module; + }; }); - it('keeps name intact when it already contains another plugin', function () { - mixins.hasMixins.and.returnValue(true); + require([name], function (module) { + expect(module.value).toBe('original'); - expect(mixins.processNames('plugin!module', context)).toBe('plugin!module'); + done(); }); + }); + + it('does not affect modules that are loaded with plugins', function (done) { + var name = 'plugin!tests/assets/mixins/no-mixins', + mixinName = 'tests/assets/mixins/no-mixins-ext'; - it('keeps name intact when it has no mixins', function () { - mixins.hasMixins.and.returnValue(false); + mixins.hasMixins.and.returnValue(true); + mixins.getMixins.and.returnValue([mixinName]); + + define('plugin', [], function () { + return { + load: function (module, req, onLoad) { + req(module, onLoad); + } + }; + }); - expect(mixins.processNames('module', context)).toBe('module'); + define(name, [], function () { + return { + value: 'original' + }; }); - it('keeps names intact when they have no mixins', function () { - mixins.hasMixins.and.returnValue(false); + define(mixinName, [], function () { + return function (module) { + module.value = 'changed'; - expect(mixins.processNames(['module'], context)).toEqual(['module']); + return module; + }; }); - it('adds prefix to name when it has mixins', function () { - mixins.hasMixins.and.returnValue(true); + require([name], function (module) { + expect(module.value).toBe('original'); - expect(mixins.processNames('module', context)).toBe('mixins!module'); + done(); }); + }); + + it('applies mixins for normal module with mixins', function (done) { + var name = 'tests/assets/mixins/mixins-applied', + mixinName = 'tests/assets/mixins/mixins-applied-ext'; - it('adds prefix to name when it contains a relative path', function () { - mixins.hasMixins.and.returnValue(false); + mixins.hasMixins.and.returnValue(true); + mixins.getMixins.and.returnValue([mixinName]); - expect(mixins.processNames('./module', context)).toBe('mixins!./module'); + define(name, [], function () { + return { + value: 'original' + }; }); - it('adds prefix to names when they contain a relative path', function () { - mixins.hasMixins.and.returnValue(false); + define(mixinName, [], function () { + return function (module) { + module.value = 'changed'; - expect(mixins.processNames(['./module'], context)).toEqual(['mixins!./module']); + return module; + }; }); - it('adds prefix to names when they have mixins', function () { - mixins.hasMixins.and.returnValue(true); + require([name], function (module) { + expect(module.value).toBe('changed'); - expect(mixins.processNames(['module'], context)).toEqual(['mixins!module']); + done(); }); }); - describe('load method', function () { - it('is not called when module has mixins', function (done) { - var name = 'tests/assets/mixins/load-not-called'; - - spyOn(mixins, 'hasMixins').and.returnValue(false); - spyOn(mixins, 'load').and.callThrough(); + it('applies mixins for module that is a dependency', function (done) { + var name = 'tests/assets/mixins/module-with-dependency', + dependencyName = 'tests/assets/mixins/dependency-module', + mixinName = 'tests/assets/mixins/dependency-module-ext'; - define(name, [], function () {}); + mixins.hasMixins.and.returnValue(true); + mixins.getMixins.and.returnValue([mixinName]); - require([name], function () { - expect(mixins.load.calls.any()).toBe(false); - done(); - }); + define(dependencyName, [], function () { + return { + value: 'original' + }; }); - it('is called when module has mixins', function (done) { - var name = 'tests/assets/mixins/load-called'; + define(name, [dependencyName], function (module) { + expect(module.value).toBe('changed'); - spyOn(mixins, 'hasMixins').and.returnValue(true); - spyOn(mixins, 'load').and.callThrough(); + done(); - define(name, [], function () {}); + return {}; + }); - require([name], function () { - expect(mixins.load.calls.mostRecent().args[0]).toEqual(name); - done(); - }); + define(mixinName, [], function () { + return function (module) { + module.value = 'changed'; + + return module; + }; }); - it('applies mixins for loaded module', function (done) { - var name = 'tests/assets/mixins/mixins-applied', - mixinName = 'tests/assets/mixins/mixins-applied-ext'; + require([name], function () {}); + }); - spyOn(mixins, 'hasMixins').and.returnValue(true); - spyOn(mixins, 'load').and.callThrough(); - spyOn(mixins, 'getMixins').and.returnValue([mixinName]); + it('applies mixins for module that is a relative dependency', function (done) { + var name = 'tests/assets/mixins/module-with-relative-dependency', + dependencyName = 'tests/assets/mixins/relative-module', + mixinName = 'tests/assets/mixins/relative-module-ext'; - define(name, [], function () { - return { value: 'original' }; - }); + mixins.hasMixins.and.returnValue(true); + mixins.getMixins.and.returnValue([mixinName]); - define(mixinName, [], function () { - return function(module) { - module.value = 'changed'; + define(dependencyName, [], function () { + return { + value: 'original' + }; + }); - return module; - }; - }); + define(name, ['./relative-module'], function (module) { + expect(module.value).toBe('changed'); - require([name], function (module) { - expect(module.value).toBe('changed'); - done(); - }); + done(); + + return {}; + }); + + define(mixinName, [], function () { + return function (module) { + module.value = 'changed'; + + return module; + }; }); + + require([name], function () {}); }); }); }); From c8e81d828cb9ada6a7476ab85a9a3b9b7bae1071 Mon Sep 17 00:00:00 2001 From: Serhiy Yelahin <serhiy.yelahin@transoftgroup.com> Date: Wed, 20 Nov 2019 10:51:52 +0200 Subject: [PATCH 0117/1143] MC-25235: Tier Prices error on product update --- .../Product/Attribute/Backend/TierPrice/UpdateHandler.php | 7 +------ .../Attribute/Backend/TierPrice/UpdateHandlerTest.php | 3 ++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/UpdateHandler.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/UpdateHandler.php index f1943bc108878..0daa1dfb5c8eb 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/UpdateHandler.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/UpdateHandler.php @@ -96,12 +96,7 @@ public function execute($entity, $arguments = []) $productId = (int)$entity->getData($identifierField); // prepare original data to compare - $origPrices = []; - $originalId = $entity->getOrigData($identifierField); - if (empty($originalId) || $entity->getData($identifierField) == $originalId) { - $origPrices = $entity->getOrigData($attribute->getName()); - } - + $origPrices = $entity->getOrigData($attribute->getName()); $old = $this->prepareOldTierPriceToCompare($origPrices); // prepare data for save $new = $this->prepareNewDataForSave($priceRows, $isGlobal); diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Backend/TierPrice/UpdateHandlerTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Backend/TierPrice/UpdateHandlerTest.php index cce00c50d37af..fde793d5c5f89 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Backend/TierPrice/UpdateHandlerTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Backend/TierPrice/UpdateHandlerTest.php @@ -108,6 +108,7 @@ public function testExecute(): void ]; $linkField = 'entity_id'; $productId = 10; + $originalProductId = 11; /** @var \PHPUnit_Framework_MockObject_MockObject $product */ $product = $this->getMockBuilder(\Magento\Catalog\Api\Data\ProductInterface::class) @@ -124,7 +125,7 @@ public function testExecute(): void ->willReturnMap( [ ['tier_price', $originalTierPrices], - ['entity_id', $productId] + ['entity_id', $originalProductId] ] ); $product->expects($this->atLeastOnce())->method('getStoreId')->willReturn(0); From a5a2cbcf7fe26964971667747aa09e8a58c9cb8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Tylek?= <pawel.tylek@creativestyle.pl> Date: Mon, 18 Nov 2019 16:58:43 +0100 Subject: [PATCH 0118/1143] M2C-21768 Validate product quantity on Wishlist update M2C-21768 Add updateWishlist event --- .../view/frontend/web/js/add-to-wishlist.js | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Wishlist/view/frontend/web/js/add-to-wishlist.js b/app/code/Magento/Wishlist/view/frontend/web/js/add-to-wishlist.js index aca843872af65..7dd2d0d6227c3 100644 --- a/app/code/Magento/Wishlist/view/frontend/web/js/add-to-wishlist.js +++ b/app/code/Magento/Wishlist/view/frontend/web/js/add-to-wishlist.js @@ -16,7 +16,8 @@ define([ groupedInfo: '#super-product-table input', downloadableInfo: '#downloadable-links-list input', customOptionsInfo: '.product-custom-option', - qtyInfo: '#qty' + qtyInfo: '#qty', + actionElement: '[data-action="add-to-wishlist"]' }, /** @inheritdoc */ @@ -30,8 +31,10 @@ define([ _bind: function () { var options = this.options, dataUpdateFunc = '_updateWishlistData', + validateProductQty = '_validateWishlistQty', changeCustomOption = 'change ' + options.customOptionsInfo, changeQty = 'change ' + options.qtyInfo, + updateWishlist = 'click ' + options.actionElement, events = {}, key; @@ -45,6 +48,7 @@ define([ events[changeCustomOption] = dataUpdateFunc; events[changeQty] = dataUpdateFunc; + events[updateWishlist] = validateProductQty; for (key in options.productType) { if (options.productType.hasOwnProperty(key) && options.productType[key] + 'Info' in options) { @@ -220,7 +224,24 @@ define([ $(form).attr('action', action).submit(); }); - } + }, + + /** + * Validate product quantity before updating Wish List + * + * @param {jQuery.Event} event + * @private + */ + _validateWishlistQty: function (event) { + var element = $(this.options.qtyInfo); + + if (!(element.validation() && element.validation('isValid'))) { + event.preventDefault(); + event.stopPropagation(); + return; + } + }, + }); return $.mage.addToWishlist; From 8b159d0e6e2d7d2034a2960cd484fe33a50ed2b3 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <engcom-vendorworker-foxtrot@adobe.com> Date: Thu, 21 Nov 2019 12:49:01 +0200 Subject: [PATCH 0119/1143] magento/magento2#22856: Integration test fix. --- .../Adminhtml/Product/Save/CreateCustomOptionsTest.php | 2 ++ .../Catalog/Model/Product/CreateCustomOptionsTest.php | 10 ++++++++++ .../ResourceModel/Attribute/Entity/AttributeTest.php | 1 + .../CatalogImportExport/Model/Import/ProductTest.php | 1 + .../_files/catalog_rule_10_off_not_logged_rollback.php | 1 + 5 files changed, 15 insertions(+) diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Save/CreateCustomOptionsTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Save/CreateCustomOptionsTest.php index 80f15da647b25..f979bad9d0f76 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Save/CreateCustomOptionsTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Save/CreateCustomOptionsTest.php @@ -51,6 +51,8 @@ protected function setUp() * @dataProvider productWithNewOptionsDataProvider * * @param array $productPostData + * + * @magentoDbIsolation enabled */ public function testSaveCustomOptionWithTypeField(array $productPostData): void { diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/CreateCustomOptionsTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/CreateCustomOptionsTest.php index 94bbcd8bae66b..9409163dc5e64 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/CreateCustomOptionsTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/CreateCustomOptionsTest.php @@ -120,6 +120,8 @@ public function testSaveOptionPriceByStore(): void * @dataProvider productCustomOptionsTypeTextDataProvider * * @param array $optionData + * + * @magentoDbIsolation enabled */ public function testCreateOptionsWithTypeText(array $optionData): void { @@ -140,6 +142,8 @@ public function testCreateOptionsWithTypeText(array $optionData): void * * @param string $rawExtensions * @param string $expectedExtensions + * + * @magentoDbIsolation enabled */ public function testFileExtensions(string $rawExtensions, string $expectedExtensions): void { @@ -174,6 +178,8 @@ public function testFileExtensions(string $rawExtensions, string $expectedExtens * * @param array $optionData * @param array $optionValueData + * + * @magentoDbIsolation enabled */ public function testCreateOptionsWithTypeSelect(array $optionData, array $optionValueData): void { @@ -199,6 +205,8 @@ public function testCreateOptionsWithTypeSelect(array $optionData, array $option * @dataProvider productCustomOptionsTypeDateDataProvider * * @param array $optionData + * + * @magentoDbIsolation enabled */ public function testCreateOptionsWithTypeDate(array $optionData): void { @@ -217,6 +225,8 @@ public function testCreateOptionsWithTypeDate(array $optionData): void * * @param array $optionData * @param \Exception $expectedErrorObject + * + * @magentoDbIsolation enabled */ public function testCreateOptionWithError(array $optionData, \Exception $expectedErrorObject): void { diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Attribute/Entity/AttributeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Attribute/Entity/AttributeTest.php index 8ecf3da8e1aae..2df9c468ba10a 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Attribute/Entity/AttributeTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Attribute/Entity/AttributeTest.php @@ -23,6 +23,7 @@ * @magentoDataFixture Magento/Catalog/_files/dropdown_attribute.php * @magentoDataFixture Magento/Catalog/_files/multiselect_attribute.php * @magentoDataFixture Magento/Catalog/_files/product_without_options.php + * @magentoDbIsolation enabled */ class AttributeTest extends \PHPUnit\Framework\TestCase { diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php index 76e1c640b9fba..5ebdf3fb51e9f 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php @@ -2333,6 +2333,7 @@ public function testImportWithFilesystemImages() * @magentoDataFixture Magento/Catalog/_files/attribute_set_with_renamed_group.php * @magentoDataFixture Magento/Catalog/_files/product_without_options.php * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + * @magentoDbIsolation enabled */ public function testImportDataChangeAttributeSet() { diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_10_off_not_logged_rollback.php b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_10_off_not_logged_rollback.php index e7985e8d6b149..7c97c5926ce4f 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_10_off_not_logged_rollback.php +++ b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_10_off_not_logged_rollback.php @@ -26,3 +26,4 @@ /** @var \Magento\CatalogRule\Model\Indexer\IndexBuilder $indexBuilder */ $indexBuilder = $objectManager->get(\Magento\CatalogRule\Model\Indexer\IndexBuilder::class); $indexBuilder->reindexFull(); +sleep(1); From 5415e99c0525dc3a505ef035a11e283bb446b026 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Tylek?= <pawel.tylek@creativestyle.pl> Date: Thu, 21 Nov 2019 18:03:39 +0100 Subject: [PATCH 0120/1143] M2C-21768 Fix tests --- .../Wishlist/view/frontend/web/js/add-to-wishlist.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Wishlist/view/frontend/web/js/add-to-wishlist.js b/app/code/Magento/Wishlist/view/frontend/web/js/add-to-wishlist.js index 7dd2d0d6227c3..55cd77b196be5 100644 --- a/app/code/Magento/Wishlist/view/frontend/web/js/add-to-wishlist.js +++ b/app/code/Magento/Wishlist/view/frontend/web/js/add-to-wishlist.js @@ -236,12 +236,12 @@ define([ var element = $(this.options.qtyInfo); if (!(element.validation() && element.validation('isValid'))) { - event.preventDefault(); - event.stopPropagation(); - return; - } - }, + event.preventDefault(); + event.stopPropagation(); + return; + } + } }); return $.mage.addToWishlist; From 822364927cfda079506ab0400734f7acbc372418 Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Fri, 22 Nov 2019 11:10:42 +0200 Subject: [PATCH 0121/1143] Adding dependency for New Relic system configs --- .../etc/adminhtml/system.xml | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/app/code/Magento/NewRelicReporting/etc/adminhtml/system.xml b/app/code/Magento/NewRelicReporting/etc/adminhtml/system.xml index 98f9c55adbdf0..60c52164021d9 100644 --- a/app/code/Magento/NewRelicReporting/etc/adminhtml/system.xml +++ b/app/code/Magento/NewRelicReporting/etc/adminhtml/system.xml @@ -19,37 +19,61 @@ </field> <field id="api_url" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>New Relic API URL</label> + <depends> + <field id="enable">1</field> + </depends> </field> <field id="insights_api_url" translate="label comment" type="text" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Insights API URL</label> <comment>Use %s to replace the account ID in the URL</comment> + <depends> + <field id="enable">1</field> + </depends> </field> <field id="account_id" translate="label comment" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1"> <label>New Relic Account ID</label> <comment><![CDATA["Need a New Relic account? <a href="http://www.newrelic.com/magento" target="_blank">Click here to get one]]></comment> + <depends> + <field id="enable">1</field> + </depends> </field> <field id="app_id" translate="label comment" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1"> <label>New Relic Application ID</label> <comment>This can commonly be found at the end of the URL when viewing the APM after "/applications/"</comment> + <depends> + <field id="enable">1</field> + </depends> </field> <field id="api" translate="label comment" type="obscure" sortOrder="6" showInDefault="1" showInWebsite="1" showInStore="1"> <label>New Relic API Key</label> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> <comment>This is located by navigating to Events -> Deployments from the New Relic APM website</comment> + <depends> + <field id="enable">1</field> + </depends> </field> <field id="insights_insert_key" translate="label comment" type="obscure" sortOrder="7" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Insights API Key</label> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> <comment>Generated under Insights in Manage data -> API Keys -> Insert Keys</comment> + <depends> + <field id="enable">1</field> + </depends> </field> <field id="app_name" translate="label comment" type="text" sortOrder="8" showInDefault="1" showInWebsite="1" showInStore="1"> <label>New Relic Application Name</label> <comment>This is located by navigating to Settings from the New Relic APM website</comment> + <depends> + <field id="enable">1</field> + </depends> </field> <field id="separate_apps" translate="label comment" type="select" sortOrder="9" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Send Adminhtml and Frontend as Separate Apps</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <comment>In addition to the main app (which includes all PHP execution), separate apps for adminhtml and frontend will be created. Requires New Relic Application Name to be set.</comment> + <depends> + <field id="enable">1</field> + </depends> </field> </group> <group id="cron" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1"> From 478751747275f3b16e71432cc4c5383103fa23f8 Mon Sep 17 00:00:00 2001 From: Benjamin Rosenberger <rosenberger@e-conomix.at> Date: Sun, 24 Nov 2019 11:25:40 +0100 Subject: [PATCH 0122/1143] add check if attribute value is possible to be set * a none existing value would be set and the dropdown would show an empty value (not the please select message) --- .../view/frontend/web/js/configurable.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js b/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js index ae564610e4b0b..d43c7c83306ba 100644 --- a/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js +++ b/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js @@ -139,7 +139,12 @@ define([ }); $.each(queryParams, $.proxy(function (key, value) { - this.options.values[key] = value; + if (this.options.spConfig.attributes[key] !== undefined + && this.options.spConfig.attributes[key].options.find(function(element) { + return element.id===value; + })) { + this.options.values[key] = value; + } }, this)); }, @@ -155,7 +160,13 @@ define([ if (element.value) { attributeId = element.id.replace(/[a-z]*/, ''); - this.options.values[attributeId] = element.value; + + if (this.options.spConfig.attributes[attributeId] !== undefined + && this.options.spConfig.attributes[attributeId].options.find(function(optionElement) { + return optionElement.id===element.value; + })) { + this.options.values[attributeId] = element.value; + } } }, this)); }, From 88da782570f4c1a4728744ed18ed5e5d7b977cca Mon Sep 17 00:00:00 2001 From: Benjamin Rosenberger <rosenberger@e-conomix.at> Date: Sun, 24 Nov 2019 11:46:56 +0100 Subject: [PATCH 0123/1143] add the possibility to add display mode dependant layout handles --- app/code/Magento/Catalog/Controller/Category/View.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Catalog/Controller/Category/View.php b/app/code/Magento/Catalog/Controller/Category/View.php index eea448e0fdb0b..cecae0b2ea8ac 100644 --- a/app/code/Magento/Catalog/Controller/Category/View.php +++ b/app/code/Magento/Catalog/Controller/Category/View.php @@ -239,6 +239,7 @@ public function execute() $page->addPageLayoutHandles(['type' => $parentPageType], null, false); } $page->addPageLayoutHandles(['type' => $pageType], null, false); + $page->addPageLayoutHandles(['displaymode' => strtolower($category->getDisplayMode())], null, false); $page->addPageLayoutHandles(['id' => $category->getId()]); // apply custom layout update once layout is loaded From 4e85593120007d45e8cc6558649c7e8d181c6378 Mon Sep 17 00:00:00 2001 From: User <jimul@rcloudlabs.com> Date: Sun, 24 Nov 2019 21:52:10 +0530 Subject: [PATCH 0124/1143] added delete type support in http adapter curl --- lib/internal/Magento/Framework/HTTP/Adapter/Curl.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php b/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php index f2a703a193e28..a396a52339752 100644 --- a/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php +++ b/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php @@ -176,7 +176,11 @@ public function write($method, $url, $http_ver = '1.1', $headers = [], $body = ' } elseif ($method == \Zend_Http_Client::GET) { curl_setopt($this->_getResource(), CURLOPT_HTTPGET, true); curl_setopt($this->_getResource(), CURLOPT_CUSTOMREQUEST, 'GET'); + }elseif ($method == \Zend_Http_Client::DELETE) { + curl_setopt($this->_getResource(), CURLOPT_CUSTOMREQUEST, "DELETE"); + curl_setopt($this->_getResource(), CURLOPT_POSTFIELDS, $body); } + if ($http_ver === \Zend_Http_Client::HTTP_1) { curl_setopt($this->_getResource(), CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); From 9348fb818ae587d87e71d485a95592d105117e97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Szubert?= <bartlomiejszubert@gmail.com> Date: Sun, 24 Nov 2019 22:22:17 +0100 Subject: [PATCH 0125/1143] Fix #24713 - Symbol of the Belarusian currency BYR is outdated --- .../Dhl/Test/Unit/Model/_files/countries.xml | 2 +- app/code/Magento/Dhl/etc/countries.xml | 2 +- app/code/Magento/Directory/etc/config.xml | 2 +- app/code/Magento/GraphQl/etc/schema.graphqls | 2 +- .../Magento/Framework/Locale/Config.php | 2 +- .../Framework/Locale/Test/Unit/ConfigTest.php | 35 +++++++++++-------- 6 files changed, 25 insertions(+), 20 deletions(-) diff --git a/app/code/Magento/Dhl/Test/Unit/Model/_files/countries.xml b/app/code/Magento/Dhl/Test/Unit/Model/_files/countries.xml index 792465ce45942..d71bb69c99c9b 100644 --- a/app/code/Magento/Dhl/Test/Unit/Model/_files/countries.xml +++ b/app/code/Magento/Dhl/Test/Unit/Model/_files/countries.xml @@ -216,7 +216,7 @@ <name>Botswana</name> </BW> <BY> - <currency>BYR</currency> + <currency>BYN</currency> <weight_unit>KG</weight_unit> <measure_unit>CM</measure_unit> <region>AP</region> diff --git a/app/code/Magento/Dhl/etc/countries.xml b/app/code/Magento/Dhl/etc/countries.xml index 792465ce45942..d71bb69c99c9b 100644 --- a/app/code/Magento/Dhl/etc/countries.xml +++ b/app/code/Magento/Dhl/etc/countries.xml @@ -216,7 +216,7 @@ <name>Botswana</name> </BW> <BY> - <currency>BYR</currency> + <currency>BYN</currency> <weight_unit>KG</weight_unit> <measure_unit>CM</measure_unit> <region>AP</region> diff --git a/app/code/Magento/Directory/etc/config.xml b/app/code/Magento/Directory/etc/config.xml index 2ff0b484fe979..32099ff9d8af5 100644 --- a/app/code/Magento/Directory/etc/config.xml +++ b/app/code/Magento/Directory/etc/config.xml @@ -9,7 +9,7 @@ <default> <system> <currency> - <installed>AZN,AZM,AFN,ALL,DZD,AOA,ARS,AMD,AWG,AUD,BSD,BHD,BDT,BBD,BYR,BZD,BMD,BTN,BOB,BAM,BWP,BRL,GBP,BND,BGN,BUK,BIF,KHR,CAD,CVE,CZK,KYD,CLP,CNY,COP,KMF,CDF,CRC,HRK,CUP,DKK,DJF,DOP,XCD,EGP,SVC,GQE,ERN,EEK,ETB,EUR,FKP,FJD,GMD,GEK,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,KGS,LAK,LVL,LBP,LSL,LRD,LYD,LTL,MOP,MKD,MGA,MWK,MYR,MVR,LSM,MRO,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,ANG,TRL,TRY,NZD,NIC,NGN,KPW,NOK,OMR,PKR,PAB,PGK,PYG,PEN,PHP,PLN,QAR,RHD,RON,ROL,RUB,RWF,SHP,STD,SAR,RSD,SCR,SLL,SGD,SKK,SBD,SOS,ZAR,KRW,LKR,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TMM,USD,UGX,UAH,AED,UYU,UZS,VUV,VEB,VEF,VND,CHE,CHW,XOF,XPF,WST,YER,ZMK,ZWD</installed> + <installed>AZN,AZM,AFN,ALL,DZD,AOA,ARS,AMD,AWG,AUD,BSD,BHD,BDT,BBD,BYN,BZD,BMD,BTN,BOB,BAM,BWP,BRL,GBP,BND,BGN,BUK,BIF,KHR,CAD,CVE,CZK,KYD,CLP,CNY,COP,KMF,CDF,CRC,HRK,CUP,DKK,DJF,DOP,XCD,EGP,SVC,GQE,ERN,EEK,ETB,EUR,FKP,FJD,GMD,GEK,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,KGS,LAK,LVL,LBP,LSL,LRD,LYD,LTL,MOP,MKD,MGA,MWK,MYR,MVR,LSM,MRO,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,ANG,TRL,TRY,NZD,NIC,NGN,KPW,NOK,OMR,PKR,PAB,PGK,PYG,PEN,PHP,PLN,QAR,RHD,RON,ROL,RUB,RWF,SHP,STD,SAR,RSD,SCR,SLL,SGD,SKK,SBD,SOS,ZAR,KRW,LKR,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TMM,USD,UGX,UAH,AED,UYU,UZS,VUV,VEB,VEF,VND,CHE,CHW,XOF,XPF,WST,YER,ZMK,ZWD</installed> </currency> </system> <currency> diff --git a/app/code/Magento/GraphQl/etc/schema.graphqls b/app/code/Magento/GraphQl/etc/schema.graphqls index 559ccf9428929..fccde015c3388 100644 --- a/app/code/Magento/GraphQl/etc/schema.graphqls +++ b/app/code/Magento/GraphQl/etc/schema.graphqls @@ -113,7 +113,7 @@ enum CurrencyEnum @doc(description: "The list of available currency codes") { BHD BDT BBD - BYR + BYN BZD BMD BTN diff --git a/lib/internal/Magento/Framework/Locale/Config.php b/lib/internal/Magento/Framework/Locale/Config.php index f02ba78ccc3e0..c2d0147c7fdc8 100644 --- a/lib/internal/Magento/Framework/Locale/Config.php +++ b/lib/internal/Magento/Framework/Locale/Config.php @@ -129,7 +129,7 @@ class Config implements \Magento\Framework\Locale\ConfigInterface 'BHD', /*Bahraini Dinar*/ 'BDT', /*Bangladesh Taka*/ 'BBD', /*Barbados Dollar*/ - 'BYR', /*Belarussian Ruble*/ + 'BYN', /*Belarussian Ruble*/ 'BZD', /*Belize Dollar*/ 'BMD', /*Bermudan Dollar*/ 'BTN', /*Bhutan Ngultrum*/ diff --git a/lib/internal/Magento/Framework/Locale/Test/Unit/ConfigTest.php b/lib/internal/Magento/Framework/Locale/Test/Unit/ConfigTest.php index 149f6b5e33b6e..20731ee34558e 100644 --- a/lib/internal/Magento/Framework/Locale/Test/Unit/ConfigTest.php +++ b/lib/internal/Magento/Framework/Locale/Test/Unit/ConfigTest.php @@ -6,7 +6,11 @@ namespace Magento\Framework\Locale\Test\Unit; -class ConfigTest extends \PHPUnit\Framework\TestCase +use Magento\Framework\Locale\Config; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use PHPUnit\Framework\TestCase; + +class ConfigTest extends TestCase { private static $allAllowedLocales = [ 'af_ZA', 'ar_DZ', 'ar_EG', 'ar_KW', 'ar_MA', 'ar_SA', 'az_Latn_AZ', 'be_BY', 'bg_BG', 'bn_BD', @@ -22,7 +26,7 @@ class ConfigTest extends \PHPUnit\Framework\TestCase private static $allAllowedCurrencies = [ 'AFN', 'ALL', 'AZN', 'DZD', 'AOA', 'ARS', 'AMD', 'AWG', 'AUD', 'BSD', - 'BHD', 'BDT', 'BBD', 'BYR', 'BZD', 'BMD', 'BTN', 'BOB', 'BAM', 'BWP', + 'BHD', 'BDT', 'BBD', 'BYN', 'BZD', 'BMD', 'BTN', 'BOB', 'BAM', 'BWP', 'BRL', 'GBP', 'BND', 'BGN', 'BUK', 'BIF', 'KHR', 'CAD', 'CVE', 'CZK', 'KYD', 'GQE', 'CLP', 'CNY', 'COP', 'KMF', 'CDF', 'CRC', 'HRK', 'CUP', 'DKK', 'DJF', 'DOP', 'XCD', 'EGP', 'SVC', 'ERN', 'EEK', 'ETB', 'EUR', @@ -67,13 +71,14 @@ class ConfigTest extends \PHPUnit\Framework\TestCase 'QED', 'PNP', 'EJN', 'MTO', 'EBY', ]; - /** @var \Magento\Framework\Locale\Config */ + /** + * @var Config + */ private $configObject; public function testGetAllowedLocalesNoDataArray() { - $this->configObject = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this)) - ->getObject(\Magento\Framework\Locale\Config::class); + $this->configObject = (new ObjectManager($this))->getObject(Config::class); $retrievedLocales = $this->configObject->getAllowedLocales(); @@ -88,9 +93,9 @@ public function testGetAllowedLocalesNoDataArray() public function testGetAllowedLocalesGivenDataArray() { - $this->configObject = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this)) + $this->configObject = (new ObjectManager($this)) ->getObject( - \Magento\Framework\Locale\Config::class, + Config::class, [ 'data' => [ 'allowedLocales' => $this::$sampleAdditionalLocales, @@ -114,9 +119,9 @@ public function testGetAllowedLocalesGivenDataArray() public function testGetAllowedLocalesGivenRedundantDataArray() { - $this->configObject = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this)) + $this->configObject = (new ObjectManager($this)) ->getObject( - \Magento\Framework\Locale\Config::class, + Config::class, [ 'data' => [ 'allowedLocales' => $this::$samplePresentLocales, @@ -140,8 +145,8 @@ public function testGetAllowedLocalesGivenRedundantDataArray() public function testGetAllowedCurrenciesNoDataArray() { - $this->configObject = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this)) - ->getObject(\Magento\Framework\Locale\Config::class); + $this->configObject = (new ObjectManager($this)) + ->getObject(Config::class); $retrievedCurrencies = $this->configObject->getAllowedCurrencies(); @@ -156,9 +161,9 @@ public function testGetAllowedCurrenciesNoDataArray() public function testGetAllowedCurrenciesGivenDataArray() { - $this->configObject = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this)) + $this->configObject = (new ObjectManager($this)) ->getObject( - \Magento\Framework\Locale\Config::class, + Config::class, [ 'data' => [ 'allowedCurrencies' => $this::$sampleAdditionalCurrencies, @@ -182,9 +187,9 @@ public function testGetAllowedCurrenciesGivenDataArray() public function testGetAllowedCurrenciesGivenRedundantDataArray() { - $this->configObject = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this)) + $this->configObject = (new ObjectManager($this)) ->getObject( - \Magento\Framework\Locale\Config::class, + Config::class, [ 'data' => [ 'allowedCurrencies' => $this::$samplePresentCurrencies, From ad7ad7584639b1b68ecf92e2722dfce66cb62efc Mon Sep 17 00:00:00 2001 From: Benjamin Rosenberger <rosenberger@e-conomix.at> Date: Mon, 25 Nov 2019 08:00:13 +0100 Subject: [PATCH 0126/1143] fix code stylings in js file --- .../view/frontend/web/js/configurable.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js b/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js index d43c7c83306ba..67486b3856276 100644 --- a/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js +++ b/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js @@ -139,9 +139,9 @@ define([ }); $.each(queryParams, $.proxy(function (key, value) { - if (this.options.spConfig.attributes[key] !== undefined - && this.options.spConfig.attributes[key].options.find(function(element) { - return element.id===value; + if (this.options.spConfig.attributes[key] !== undefined && + this.options.spConfig.attributes[key].options.find(function (element) { + return element.id === value; })) { this.options.values[key] = value; } @@ -161,9 +161,9 @@ define([ if (element.value) { attributeId = element.id.replace(/[a-z]*/, ''); - if (this.options.spConfig.attributes[attributeId] !== undefined - && this.options.spConfig.attributes[attributeId].options.find(function(optionElement) { - return optionElement.id===element.value; + if (this.options.spConfig.attributes[attributeId] !== undefined && + this.options.spConfig.attributes[attributeId].options.find(function (optionElement) { + return optionElement.id === element.value; })) { this.options.values[attributeId] = element.value; } From 95eea5245b97a8c6f62d435dbfe32c2f3ddcb4c8 Mon Sep 17 00:00:00 2001 From: Alexey Rakitin <alexey.rakitin@babenkocommerce.com> Date: Fri, 22 Nov 2019 13:00:25 +0200 Subject: [PATCH 0127/1143] magento/magento2#23481: Billing/Shipping Address edit form design update from order backend - Messages container added to correctly apply margin between message and form - Form wrapper html tag changed from 'fieldset' to 'div' - Added 'admin__fieldset' class to form for standard admin styles to work properly --- .../Sales/Block/Adminhtml/Order/Address/Form.php | 1 + .../adminhtml/templates/order/address/form.phtml | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Address/Form.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Address/Form.php index 1efa149b390ef..06f2edba878ae 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Address/Form.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Address/Form.php @@ -108,6 +108,7 @@ protected function _prepareForm() { parent::_prepareForm(); $this->_form->setId('edit_form'); + $this->_form->setClass('admin__fieldset'); $this->_form->setMethod('post'); $this->_form->setAction( $this->getUrl('sales/*/addressSave', ['address_id' => $this->_getAddress()->getId()]) diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/address/form.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/address/form.phtml index a7f3b3c1cc8f5..b794c418de8d9 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/address/form.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/address/form.phtml @@ -4,13 +4,15 @@ * See COPYING.txt for license details. */ ?> -<div class="message message-notice"> - <div class="message-inner"> - <div class="message-content"><?= $block->escapeHtml(__('Changing address information will not recalculate shipping, tax or other order amount.')) ?></div> +<div class="messages"> + <div class="message message-notice"> + <div class="message-inner"> + <div class="message-content"><?= $block->escapeHtml(__('Changing address information will not recalculate shipping, tax or other order amount.')) ?></div> + </div> </div> </div> -<fieldset class="fieldset admin__fieldset-wrapper"> +<div class="fieldset admin__fieldset-wrapper"> <legend class="legend admin__legend"> <span><?= $block->escapeHtml($block->getHeaderText()) ?></span> </legend> @@ -18,4 +20,4 @@ <div class="form-inline" data-mage-init='{"Magento_Sales/order/edit/address/form":{}}'> <?= $block->getForm()->toHtml() ?> </div> -</fieldset> +</div> From 46b4e37bac99457c1cecd2c04fe740419a9042fe Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Mon, 25 Nov 2019 20:14:28 +0200 Subject: [PATCH 0128/1143] Covering the system dependency by MFTF --- .../AdminTogglesEnabledConfigActionGroup.xml | 17 +++++++++ ...AdminUnchecksUseSystemValueActionGroup.xml | 14 +++++++ ...rtAdminDoesntSeeConfigFieldActionGroup.xml | 17 +++++++++ .../AssertAdminSeesConfigFieldActionGroup.xml | 17 +++++++++ .../Mftf/Page/AdminNewRelicConfigPage.xml | 12 ++++++ .../AdminNewRelicConfigSystemSection.xml | 16 ++++++++ .../AdminChecksSystemConfigDependencyTest.xml | 38 +++++++++++++++++++ 7 files changed, 131 insertions(+) create mode 100644 app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminTogglesEnabledConfigActionGroup.xml create mode 100644 app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminUnchecksUseSystemValueActionGroup.xml create mode 100644 app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AssertAdminDoesntSeeConfigFieldActionGroup.xml create mode 100644 app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AssertAdminSeesConfigFieldActionGroup.xml create mode 100644 app/code/Magento/NewRelicReporting/Test/Mftf/Page/AdminNewRelicConfigPage.xml create mode 100644 app/code/Magento/NewRelicReporting/Test/Mftf/Section/AdminNewRelicConfigSystemSection.xml create mode 100644 app/code/Magento/NewRelicReporting/Test/Mftf/Test/AdminChecksSystemConfigDependencyTest.xml diff --git a/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminTogglesEnabledConfigActionGroup.xml b/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminTogglesEnabledConfigActionGroup.xml new file mode 100644 index 0000000000000..f9632784f4a92 --- /dev/null +++ b/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminTogglesEnabledConfigActionGroup.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminTogglesEnabledConfigActionGroup"> + <arguments> + <argument name="state" type="string"/> + </arguments> + <selectOption selector="{{AdminNewRelicConfigSystemSection.status}}" userInput="{{state}}" stepKey="switchActiveState"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminUnchecksUseSystemValueActionGroup.xml b/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminUnchecksUseSystemValueActionGroup.xml new file mode 100644 index 0000000000000..7d90c1d8dd478 --- /dev/null +++ b/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminUnchecksUseSystemValueActionGroup.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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminUnchecksUseSystemValueActionGroup"> + <uncheckOption selector="{{AdminNewRelicConfigSystemSection.useSystemValueForEnabled}}" stepKey="uncheckCheckbox"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AssertAdminDoesntSeeConfigFieldActionGroup.xml b/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AssertAdminDoesntSeeConfigFieldActionGroup.xml new file mode 100644 index 0000000000000..6e87dbbfbbf4b --- /dev/null +++ b/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AssertAdminDoesntSeeConfigFieldActionGroup.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertAdminDoesntSeeConfigFieldActionGroup"> + <arguments> + <argument name="config" type="string"/> + </arguments> + <dontSeeElement selector="{{config}}" stepKey="dontSeeConfigField"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AssertAdminSeesConfigFieldActionGroup.xml b/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AssertAdminSeesConfigFieldActionGroup.xml new file mode 100644 index 0000000000000..4df7099e50b28 --- /dev/null +++ b/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AssertAdminSeesConfigFieldActionGroup.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertAdminSeesConfigFieldActionGroup"> + <arguments> + <argument name="config" type="string"/> + </arguments> + <seeElement selector="{{config}}" stepKey="seeConfigField"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/NewRelicReporting/Test/Mftf/Page/AdminNewRelicConfigPage.xml b/app/code/Magento/NewRelicReporting/Test/Mftf/Page/AdminNewRelicConfigPage.xml new file mode 100644 index 0000000000000..fda7d0ef336b1 --- /dev/null +++ b/app/code/Magento/NewRelicReporting/Test/Mftf/Page/AdminNewRelicConfigPage.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> + <page name="AdminNewRelicConfigPage" url="admin/system_config/edit/section/newrelicreporting/" area="admin" module="Magento_Config"> + <section name="AdminNewRelicConfigSystemSection"/> + </page> +</pages> \ No newline at end of file diff --git a/app/code/Magento/NewRelicReporting/Test/Mftf/Section/AdminNewRelicConfigSystemSection.xml b/app/code/Magento/NewRelicReporting/Test/Mftf/Section/AdminNewRelicConfigSystemSection.xml new file mode 100644 index 0000000000000..7c8baccca52fe --- /dev/null +++ b/app/code/Magento/NewRelicReporting/Test/Mftf/Section/AdminNewRelicConfigSystemSection.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="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="AdminNewRelicConfigSystemSection"> + <element name="status" type="select" selector="#row_newrelicreporting_general_enable [data-ui-id='select-groups-general-fields-enable-value']"/> + <element name="useSystemValueForEnabled" type="checkbox" selector="#newrelicreporting_general_enable_inherit"/> + <element name="apiUrl" type="select" selector="input#newrelicreporting_general_api_url"/> + </section> +</sections> diff --git a/app/code/Magento/NewRelicReporting/Test/Mftf/Test/AdminChecksSystemConfigDependencyTest.xml b/app/code/Magento/NewRelicReporting/Test/Mftf/Test/AdminChecksSystemConfigDependencyTest.xml new file mode 100644 index 0000000000000..12aacbc964d2f --- /dev/null +++ b/app/code/Magento/NewRelicReporting/Test/Mftf/Test/AdminChecksSystemConfigDependencyTest.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminChecksSystemConfigDependencyTest"> + <annotations> + <features value="NewRelicReporting"/> + <stories value="Admin is able to see the configuration fields only after enabling the feature"/> + <title value="Admin can see the configuration fields only after enabling the feature"/> + <description value="The system configs should be available only after enabling the New Relic feature."/> + <severity value="CRITICAL"/> + <group value="NewRelicReporting"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <amOnPage url="{{AdminNewRelicConfigPage.url}}" stepKey="navigateToNewRelicConfigurationPage"/> + </before> + <after> + <actionGroup ref="logout" stepKey="logoutOfAdmin"/> + </after> + <actionGroup ref="AssertAdminDoesntSeeConfigFieldActionGroup" stepKey="checkIfApiUrlIsNotVisible"> + <argument name="config" value="{{AdminNewRelicConfigSystemSection.apiUrl}}"/> + </actionGroup> + <actionGroup ref="AdminUnchecksUseSystemValueActionGroup" stepKey="uncheckUseSystemValue"/> + <actionGroup ref="AdminTogglesEnabledConfigActionGroup" stepKey="enableNewRelic"> + <argument name="state" value="Yes"/> + </actionGroup> + <actionGroup ref="AssertAdminSeesConfigFieldActionGroup" stepKey="checkIfApiUrlIsVisible"> + <argument name="config" value="{{AdminNewRelicConfigSystemSection.apiUrl}}"/> + </actionGroup> + </test> +</tests> From 66fddf2e77580582c5c3f0ce957b73dfa3fd6f50 Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Tue, 26 Nov 2019 07:02:39 +0200 Subject: [PATCH 0129/1143] Adding expanding config tab step --- .../AdminExpandNewRelicConfigTabActionGroup.xml | 17 +++++++++++++++++ .../AdminNewRelicConfigSystemSection.xml | 1 + .../AdminChecksSystemConfigDependencyTest.xml | 7 +++++-- 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminExpandNewRelicConfigTabActionGroup.xml diff --git a/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminExpandNewRelicConfigTabActionGroup.xml b/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminExpandNewRelicConfigTabActionGroup.xml new file mode 100644 index 0000000000000..4dc3d2ea8ea34 --- /dev/null +++ b/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminExpandNewRelicConfigTabActionGroup.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminExpandNewRelicConfigTabActionGroup"> + <arguments> + <argument name="tabName" type="string"/> + </arguments> + <conditionalClick selector="{{AdminNewRelicConfigSystemSection.tab(tabName)}}" dependentSelector="{{AdminNewRelicConfigSystemSection.status}}" visible="false" stepKey="expandTab"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/NewRelicReporting/Test/Mftf/Section/AdminNewRelicConfigSystemSection.xml b/app/code/Magento/NewRelicReporting/Test/Mftf/Section/AdminNewRelicConfigSystemSection.xml index 7c8baccca52fe..79625273b988e 100644 --- a/app/code/Magento/NewRelicReporting/Test/Mftf/Section/AdminNewRelicConfigSystemSection.xml +++ b/app/code/Magento/NewRelicReporting/Test/Mftf/Section/AdminNewRelicConfigSystemSection.xml @@ -9,6 +9,7 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminNewRelicConfigSystemSection"> + <element name="tab" type="button" selector="#newrelicreporting_{{tab}}-head" parameterized="true"/> <element name="status" type="select" selector="#row_newrelicreporting_general_enable [data-ui-id='select-groups-general-fields-enable-value']"/> <element name="useSystemValueForEnabled" type="checkbox" selector="#newrelicreporting_general_enable_inherit"/> <element name="apiUrl" type="select" selector="input#newrelicreporting_general_api_url"/> diff --git a/app/code/Magento/NewRelicReporting/Test/Mftf/Test/AdminChecksSystemConfigDependencyTest.xml b/app/code/Magento/NewRelicReporting/Test/Mftf/Test/AdminChecksSystemConfigDependencyTest.xml index 12aacbc964d2f..eabacffe9b181 100644 --- a/app/code/Magento/NewRelicReporting/Test/Mftf/Test/AdminChecksSystemConfigDependencyTest.xml +++ b/app/code/Magento/NewRelicReporting/Test/Mftf/Test/AdminChecksSystemConfigDependencyTest.xml @@ -19,12 +19,15 @@ </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - <amOnPage url="{{AdminNewRelicConfigPage.url}}" stepKey="navigateToNewRelicConfigurationPage"/> + <actionGroup ref="AdminNavigateToNewRelicConfigurationActionGroup" stepKey="goToConfigPage"/> + <actionGroup ref="AdminExpandNewRelicConfigTabActionGroup" stepKey="expandGeneralTab"> + <argument name="tabName" value="general"/> + </actionGroup> </before> <after> <actionGroup ref="logout" stepKey="logoutOfAdmin"/> </after> - <actionGroup ref="AssertAdminDoesntSeeConfigFieldActionGroup" stepKey="checkIfApiUrlIsNotVisible"> + <actionGroup ref="AssertAdminDontSeeConfigFieldActionGroup" stepKey="checkIfApiUrlIsNotVisible"> <argument name="config" value="{{AdminNewRelicConfigSystemSection.apiUrl}}"/> </actionGroup> <actionGroup ref="AdminUnchecksUseSystemValueActionGroup" stepKey="uncheckUseSystemValue"/> From da34cbe83ac50973047f9c0e3d6a0cbeb6ba0be6 Mon Sep 17 00:00:00 2001 From: User <jimul@rcloudlabs.com> Date: Tue, 26 Nov 2019 12:25:20 +0530 Subject: [PATCH 0130/1143] PSR PHPCBF fix --- lib/internal/Magento/Framework/HTTP/Adapter/Curl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php b/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php index a396a52339752..df82be8a70e71 100644 --- a/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php +++ b/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php @@ -176,11 +176,11 @@ public function write($method, $url, $http_ver = '1.1', $headers = [], $body = ' } elseif ($method == \Zend_Http_Client::GET) { curl_setopt($this->_getResource(), CURLOPT_HTTPGET, true); curl_setopt($this->_getResource(), CURLOPT_CUSTOMREQUEST, 'GET'); - }elseif ($method == \Zend_Http_Client::DELETE) { + } elseif ($method == \Zend_Http_Client::DELETE) { curl_setopt($this->_getResource(), CURLOPT_CUSTOMREQUEST, "DELETE"); curl_setopt($this->_getResource(), CURLOPT_POSTFIELDS, $body); } - + if ($http_ver === \Zend_Http_Client::HTTP_1) { curl_setopt($this->_getResource(), CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); From f8b6886538224a9816a381a4fb752674678d6d30 Mon Sep 17 00:00:00 2001 From: mmularski <mmularczyk9@gmail.com> Date: Wed, 10 Jul 2019 18:06:46 +0200 Subject: [PATCH 0131/1143] Issue-628. Convert CreateTermEntityTest to MFTF --- .../AdminAssertTermInGridActionGroup.xml | 21 ++++++ .../ActionGroup/CreateNewTermActionGroup.xml | 27 ++++++++ .../ActionGroup/DeleteTermActionGroup.xml | 26 +++++++ ...tAssertTermAbsentInCheckoutActionGroup.xml | 66 ++++++++++++++++++ ...refrontAssertTermInCheckoutActionGroup.xml | 68 +++++++++++++++++++ ...sageInMultishippingCheckoutActionGroup.xml | 65 ++++++++++++++++++ .../Test/Mftf/Data/TermData.xml | 38 +++++++++++ .../Test/Mftf/Page/AdminEditTermPage.xml | 14 ++++ .../Test/Mftf/Page/AdminNewTermPage.xml | 15 ++++ .../Test/Mftf/Page/AdminTermsPage.xml | 12 ++++ .../Test/Mftf/Page/CheckoutPage.xml | 14 ++++ .../Mftf/Section/AdminEditTermFormSection.xml | 15 ++++ .../Mftf/Section/AdminNewTermFormSection.xml | 23 +++++++ .../Section/AdminTermFormMessagesSection.xml | 15 ++++ .../Mftf/Section/AdminTermGridSection.xml | 18 +++++ .../StorefrontCheckoutAgreementsSection.xml | 16 +++++ .../AdminCreateActiveHtmlTermEntityTest.xml | 47 +++++++++++++ .../AdminCreateActiveTextTermEntityTest.xml | 47 +++++++++++++ .../AdminCreateDisabledTextTermEntityTest.xml | 47 +++++++++++++ ...abledTextTermOnMultishippingEntityTest.xml | 52 ++++++++++++++ .../MultishippingCheckoutAddressesPage.xml | 14 ++++ .../Page/MultishippingCheckoutBillingPage.xml | 14 ++++ .../MultishippingCheckoutOverviewPage.xml | 14 ++++ .../MultishippingCheckoutShippingPage.xml | 14 ++++ ...hippingCheckoutAddressesToolbarSection.xml | 14 ++++ ...ishippingCheckoutBillingToolbarSection.xml | 14 ++++ ...ishippingCheckoutOverviewReviewSection.xml | 14 ++++ ...shippingCheckoutShippingToolbarSection.xml | 14 ++++ 28 files changed, 758 insertions(+) create mode 100644 app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/AdminAssertTermInGridActionGroup.xml create mode 100644 app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/CreateNewTermActionGroup.xml create mode 100644 app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/DeleteTermActionGroup.xml create mode 100644 app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/StorefrontAssertTermAbsentInCheckoutActionGroup.xml create mode 100644 app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/StorefrontAssertTermInCheckoutActionGroup.xml create mode 100644 app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/StorefrontAssertTermRequireMessageInMultishippingCheckoutActionGroup.xml create mode 100644 app/code/Magento/CheckoutAgreements/Test/Mftf/Data/TermData.xml create mode 100644 app/code/Magento/CheckoutAgreements/Test/Mftf/Page/AdminEditTermPage.xml create mode 100644 app/code/Magento/CheckoutAgreements/Test/Mftf/Page/AdminNewTermPage.xml create mode 100644 app/code/Magento/CheckoutAgreements/Test/Mftf/Page/AdminTermsPage.xml create mode 100644 app/code/Magento/CheckoutAgreements/Test/Mftf/Page/CheckoutPage.xml create mode 100644 app/code/Magento/CheckoutAgreements/Test/Mftf/Section/AdminEditTermFormSection.xml create mode 100644 app/code/Magento/CheckoutAgreements/Test/Mftf/Section/AdminNewTermFormSection.xml create mode 100644 app/code/Magento/CheckoutAgreements/Test/Mftf/Section/AdminTermFormMessagesSection.xml create mode 100644 app/code/Magento/CheckoutAgreements/Test/Mftf/Section/AdminTermGridSection.xml create mode 100644 app/code/Magento/CheckoutAgreements/Test/Mftf/Section/StorefrontCheckoutAgreementsSection.xml create mode 100644 app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveHtmlTermEntityTest.xml create mode 100644 app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveTextTermEntityTest.xml create mode 100644 app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateDisabledTextTermEntityTest.xml create mode 100644 app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateEnabledTextTermOnMultishippingEntityTest.xml create mode 100644 app/code/Magento/Multishipping/Test/Mftf/Page/MultishippingCheckoutAddressesPage.xml create mode 100644 app/code/Magento/Multishipping/Test/Mftf/Page/MultishippingCheckoutBillingPage.xml create mode 100644 app/code/Magento/Multishipping/Test/Mftf/Page/MultishippingCheckoutOverviewPage.xml create mode 100644 app/code/Magento/Multishipping/Test/Mftf/Page/MultishippingCheckoutShippingPage.xml create mode 100644 app/code/Magento/Multishipping/Test/Mftf/Section/StorefrontMultishippingCheckoutAddressesToolbarSection.xml create mode 100644 app/code/Magento/Multishipping/Test/Mftf/Section/StorefrontMultishippingCheckoutBillingToolbarSection.xml create mode 100644 app/code/Magento/Multishipping/Test/Mftf/Section/StorefrontMultishippingCheckoutOverviewReviewSection.xml create mode 100644 app/code/Magento/Multishipping/Test/Mftf/Section/StorefrontMultishippingCheckoutShippingToolbarSection.xml diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/AdminAssertTermInGridActionGroup.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/AdminAssertTermInGridActionGroup.xml new file mode 100644 index 0000000000000..965d8d2e01064 --- /dev/null +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/AdminAssertTermInGridActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAssertTermInGrid"> + <arguments> + <argument name="termName" type="string"/> + </arguments> + <amOnPage url="{{AdminTermsPage.url}}" stepKey="onTermGridPage"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <fillField selector="{{AdminTermGridSection.filterByTermName}}" userInput="{{termName}}" stepKey="fillTermNameFilter"/> + <click selector="{{AdminTermGridSection.searchButton}}" stepKey="clickSearchButton"/> + <see selector="{{AdminTermGridSection.firstRowConditionName}}" userInput="{{termName}}" stepKey="assertTermInGrid"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/CreateNewTermActionGroup.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/CreateNewTermActionGroup.xml new file mode 100644 index 0000000000000..4923589ee9cf4 --- /dev/null +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/CreateNewTermActionGroup.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateNewTerm"> + <arguments> + <argument name="term"/> + </arguments> + <amOnPage url="{{AdminNewTermPage.url}}" stepKey="amOnNewTermPage"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + <fillField selector="{{AdminNewTermFormSection.conditionName}}" userInput="{{term.name}}" stepKey="fillFieldConditionName"/> + <selectOption selector="{{AdminNewTermFormSection.isActive}}" userInput="{{term.isActive}}" stepKey="selectOptionIsActive"/> + <selectOption selector="{{AdminNewTermFormSection.isHtml}}" userInput="{{term.isHtml}}" stepKey="selectOptionIsHtml"/> + <selectOption selector="{{AdminNewTermFormSection.mode}}" userInput="{{term.mode}}" stepKey="selectOptionMode"/> + <selectOption selector="{{AdminNewTermFormSection.storeView}}" userInput="{{term.storeView}}" stepKey="selectOptionStoreView" /> + <fillField selector="{{AdminNewTermFormSection.checkboxText}}" userInput="{{term.checkboxText}}" stepKey="fillFieldCheckboxText"/> + <fillField selector="{{AdminNewTermFormSection.content}}" userInput="{{term.content}}" stepKey="fillFieldContent"/> + <click selector="{{AdminNewTermFormSection.save}}" stepKey="saveTerm"/> + <see selector="{{AdminTermFormMessagesSection.successMessage}}" userInput="You saved the condition." stepKey="seeSuccessMessage"/> + </actionGroup> +</actionGroups> \ No newline at end of file diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/DeleteTermActionGroup.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/DeleteTermActionGroup.xml new file mode 100644 index 0000000000000..7ed4d55f29f2d --- /dev/null +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/DeleteTermActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DeleteTerm"> + <arguments> + <argument name="term" /> + </arguments> + <amOnPage url="{{AdminTermsPage.url}}" stepKey="onTermGridPage"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + <fillField selector="{{AdminTermGridSection.filterByTermName}}" userInput="{{term.name}}" stepKey="fillTermNameFilter"/> + <click selector="{{AdminTermGridSection.searchButton}}" stepKey="clickSearchButton"/> + <click selector="{{AdminTermGridSection.firstRowConditionId}}" stepKey="clickFirstRow"/> + <waitForPageLoad stepKey="waitForPageLoad2"/> + <click selector="{{AdminEditTermFormSection.delete}}" stepKey="clickDeleteButton"/> + <click selector="{{AdminEditTermFormSection.acceptPopupButton}}" stepKey="clickDeleteOkButton"/> + <waitForPageLoad stepKey="waitForPageLoad3"/> + <see selector="{{AdminTermFormMessagesSection.successMessage}}" userInput="You deleted the condition." stepKey="seeSuccessMessage"/> + </actionGroup> +</actionGroups> \ No newline at end of file diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/StorefrontAssertTermAbsentInCheckoutActionGroup.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/StorefrontAssertTermAbsentInCheckoutActionGroup.xml new file mode 100644 index 0000000000000..ca2f1b0db59fe --- /dev/null +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/StorefrontAssertTermAbsentInCheckoutActionGroup.xml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontAssertTermAbsentInCheckout"> + <arguments> + <argument name="termCheckboxText" type="string"/> + <argument name="product" defaultValue="SimpleTwo"/> + </arguments> + + <!--Add product to cart--> + <amOnPage url="{{StorefrontProductPage.url(product.custom_attributes[url_key])}}" stepKey="goToProductPage"/> + <waitForPageLoad stepKey="waitForProductPage"/> + <click selector="{{StorefrontProductPageSection.addToCartBtn}}" stepKey="addToCart"/> + <waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdding}}" stepKey="waitForElementNotVisibleAddToCartButtonTitleIsAdding"/> + <waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdded}}" stepKey="waitForElementNotVisibleAddToCartButtonTitleIsAdded"/> + <waitForElementVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAddToCart}}" stepKey="waitForElementVisibleAddToCartButtonTitleIsAddToCart"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" time="30" stepKey="waitForProductAddedMessage"/> + <see selector="{{StorefrontMessagesSection.success}}" userInput="You added {{product.name}} to your shopping cart." stepKey="seeAddToCartSuccessMessage"/> + + <!--Go to Checkout--> + <waitForElementNotVisible selector="{{StorefrontMinicartSection.emptyCart}}" stepKey="waitUpdateQuantity"/> + <wait time="5" stepKey="waitMinicartRendering"/> + <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickCart"/> + <click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="goToCheckout"/> + + <!--Process steps--> + <fillField selector="{{CheckoutShippingSection.email}}" userInput="{{CustomerEntityOne.email}}" stepKey="enterEmail"/> + <fillField selector="{{CheckoutShippingSection.firstName}}" userInput="{{CustomerEntityOne.firstname}}" stepKey="enterFirstName"/> + <fillField selector="{{CheckoutShippingSection.lastName}}" userInput="{{CustomerEntityOne.lastname}}" stepKey="enterLastName"/> + <fillField selector="{{CheckoutShippingSection.street}}" userInput="{{CustomerAddressSimple.street[0]}}" stepKey="enterStreet"/> + <fillField selector="{{CheckoutShippingSection.city}}" userInput="{{CustomerAddressSimple.city}}" stepKey="enterCity"/> + <selectOption selector="{{CheckoutShippingSection.region}}" userInput="{{CustomerAddressSimple.state}}" stepKey="selectRegion"/> + <fillField selector="{{CheckoutShippingSection.postcode}}" userInput="{{CustomerAddressSimple.postcode}}" stepKey="enterPostcode"/> + <fillField selector="{{CheckoutShippingSection.telephone}}" userInput="{{CustomerAddressSimple.telephone}}" stepKey="enterTelephone"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask1"/> + <click selector="{{CheckoutShippingMethodsSection.checkShippingMethodByName('')}}" stepKey="selectShippingMethod"/> + <waitForElement selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/> + <click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/> + <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/> + <seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/> + + <!--Check if agreement is absent on checkout--> + <dontSee selector="{{StorefrontCheckoutAgreementsSection.checkoutAgreementButton}}" userInput="{{termCheckboxText}}" stepKey="seeTermInCheckout"/> + + <!--Checkout select Check/Money Order payment--> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask2"/> + <waitForPageLoad stepKey="waitForPageLoad2"/> + <conditionalClick selector="{{StorefrontCheckoutPaymentMethodSection.checkPaymentMethodByName('Check / Money order')}}" dependentSelector="{{StorefrontCheckoutPaymentMethodSection.checkPaymentMethodByName('Check / Money order')}}" visible="true" stepKey="selectCheckmoPaymentMethod"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskAfterPaymentMethodSelection"/> + + <!--Click Place Order button--> + <click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/> + + <!--See success messages--> + <see selector="{{CheckoutSuccessMainSection.successTitle}}" userInput="Thank you for your purchase!" stepKey="seeSuccessTitle"/> + <see selector="{{CheckoutSuccessMainSection.orderNumberText}}" userInput="Your order # is: " stepKey="seeOrderNumber"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/StorefrontAssertTermInCheckoutActionGroup.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/StorefrontAssertTermInCheckoutActionGroup.xml new file mode 100644 index 0000000000000..fb2825de1a7ad --- /dev/null +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/StorefrontAssertTermInCheckoutActionGroup.xml @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontAssertTermInCheckout"> + <arguments> + <argument name="termCheckboxText" type="string"/> + <argument name="product" defaultValue="SimpleTwo"/> + </arguments> + + <!--Add product to cart--> + <amOnPage url="{{StorefrontProductPage.url(product.custom_attributes[url_key])}}" stepKey="goToProductPage"/> + <waitForPageLoad stepKey="waitForProductPage"/> + <click selector="{{StorefrontProductPageSection.addToCartBtn}}" stepKey="addToCart"/> + <waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdding}}" stepKey="waitForElementNotVisibleAddToCartButtonTitleIsAdding"/> + <waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdded}}" stepKey="waitForElementNotVisibleAddToCartButtonTitleIsAdded"/> + <waitForElementVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAddToCart}}" stepKey="waitForElementVisibleAddToCartButtonTitleIsAddToCart"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" time="30" stepKey="waitForProductAddedMessage"/> + <see selector="{{StorefrontMessagesSection.success}}" userInput="You added {{product.name}} to your shopping cart." stepKey="seeAddToCartSuccessMessage"/> + + <!--Go to Checkout--> + <waitForElementNotVisible selector="{{StorefrontMinicartSection.emptyCart}}" stepKey="waitUpdateQuantity"/> + <wait time="5" stepKey="waitMinicartRendering"/> + <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickCart"/> + <click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="goToCheckout"/> + + <!--Process steps--> + <fillField selector="{{CheckoutShippingSection.email}}" userInput="{{CustomerEntityOne.email}}" stepKey="enterEmail"/> + <fillField selector="{{CheckoutShippingSection.firstName}}" userInput="{{CustomerEntityOne.firstname}}" stepKey="enterFirstName"/> + <fillField selector="{{CheckoutShippingSection.lastName}}" userInput="{{CustomerEntityOne.lastname}}" stepKey="enterLastName"/> + <fillField selector="{{CheckoutShippingSection.street}}" userInput="{{CustomerAddressSimple.street[0]}}" stepKey="enterStreet"/> + <fillField selector="{{CheckoutShippingSection.city}}" userInput="{{CustomerAddressSimple.city}}" stepKey="enterCity"/> + <selectOption selector="{{CheckoutShippingSection.region}}" userInput="{{CustomerAddressSimple.state}}" stepKey="selectRegion"/> + <fillField selector="{{CheckoutShippingSection.postcode}}" userInput="{{CustomerAddressSimple.postcode}}" stepKey="enterPostcode"/> + <fillField selector="{{CheckoutShippingSection.telephone}}" userInput="{{CustomerAddressSimple.telephone}}" stepKey="enterTelephone"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask1"/> + <click selector="{{CheckoutShippingMethodsSection.checkShippingMethodByName('')}}" stepKey="selectShippingMethod"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask2"/> + <waitForElement selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/> + <click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/> + <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/> + <seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/> + + <!--Check if agreement is present on checkout and select it--> + <see selector="{{StorefrontCheckoutAgreementsSection.checkoutAgreementButton}}" userInput="{{termCheckboxText}}" stepKey="seeTermInCheckout"/> + <selectOption selector="{{StorefrontCheckoutAgreementsSection.checkoutAgreementCheckbox}}" userInput="{{termCheckboxText}}" stepKey="checkAgreement"/> + + <!--Checkout select Check/Money Order payment--> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask3"/> + <waitForPageLoad stepKey="waitForPageLoad2"/> + <conditionalClick selector="{{StorefrontCheckoutPaymentMethodSection.checkPaymentMethodByName('Check / Money order')}}" dependentSelector="{{StorefrontCheckoutPaymentMethodSection.checkPaymentMethodByName('Check / Money order')}}" visible="true" stepKey="selectCheckmoPaymentMethod"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskAfterPaymentMethodSelection"/> + + <!--Click Place Order button--> + <click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/> + + <!--See success messages--> + <see selector="{{CheckoutSuccessMainSection.successTitle}}" userInput="Thank you for your purchase!" stepKey="seeSuccessTitle"/> + <see selector="{{CheckoutSuccessMainSection.orderNumberText}}" userInput="Your order # is: " stepKey="seeOrderNumber"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/StorefrontAssertTermRequireMessageInMultishippingCheckoutActionGroup.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/StorefrontAssertTermRequireMessageInMultishippingCheckoutActionGroup.xml new file mode 100644 index 0000000000000..00637c6b22585 --- /dev/null +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/StorefrontAssertTermRequireMessageInMultishippingCheckoutActionGroup.xml @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontAssertTermRequireMessageInMultishippingCheckout"> + <arguments> + <argument name="termCheckboxText" type="string"/> + <argument name="product1" defaultValue="SimpleTwo"/> + <argument name="product2" defaultValue="SimpleTwo"/> + </arguments> + + <!--Add product1 to cart--> + <amOnPage url="{{StorefrontProductPage.url(product1.custom_attributes[url_key])}}" stepKey="goToProduct1Page"/> + <waitForPageLoad stepKey="waitForProduct1Page"/> + <click selector="{{StorefrontProductPageSection.addToCartBtn}}" stepKey="addToCart1"/> + <waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdding}}" stepKey="waitForElementNotVisibleAddToCartButton1TitleIsAdding"/> + <waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdded}}" stepKey="waitForElementNotVisibleAddToCartButton1TitleIsAdded"/> + <waitForElementVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAddToCart}}" stepKey="waitForElementVisibleAddToCartButton1TitleIsAddToCart"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" time="30" stepKey="waitForProduct1AddedMessage"/> + <see selector="{{StorefrontMessagesSection.success}}" userInput="You added {{product1.name}} to your shopping cart." stepKey="seeAddToCart1SuccessMessage"/> + + <!--Add product2 to cart--> + <amOnPage url="{{StorefrontProductPage.url(product2.custom_attributes[url_key])}}" stepKey="goToProduct2Page"/> + <waitForPageLoad stepKey="waitForProduct2Page"/> + <click selector="{{StorefrontProductPageSection.addToCartBtn}}" stepKey="addToCart2"/> + <waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdding}}" stepKey="waitForElementNotVisibleAddToCartButton2TitleIsAdding"/> + <waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdded}}" stepKey="waitForElementNotVisibleAddToCartButton2TitleIsAdded"/> + <waitForElementVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAddToCart}}" stepKey="waitForElementVisibleAddToCartButton2TitleIsAddToCart"/> + <waitForPageLoad stepKey="waitForPageLoad2"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" time="30" stepKey="waitForProduct2AddedMessage"/> + <see selector="{{StorefrontMessagesSection.success}}" userInput="You added {{product2.name}} to your shopping cart." stepKey="seeAddToCart2SuccessMessage"/> + + <!--Go to Checkout Cart and proceed with multiple addresses--> + <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCheckoutCart"/> + <waitForPageLoad stepKey="waitForPageLoad3"/> + <click selector="{{MultishippingSection.checkoutWithMultipleAddresses}}" stepKey="proceedMultishipping"/> + + <!--Procees do overview page--> + <click selector="{{StorefrontMultishippingCheckoutAddressesToolbarSection.goToShippingInformation}}" stepKey="clickGoToShippingInformation"/> + <waitForPageLoad stepKey="waitForPageLoad4"/> + <click selector="{{StorefrontMultishippingCheckoutShippingToolbarSection.continueToBilling}}" stepKey="clickContinueToBilling"/> + <waitForPageLoad stepKey="waitForPageLoad5"/> + <click selector="{{StorefrontMultishippingCheckoutBillingToolbarSection.goToReviewOrder}}" stepKey="clickGoToReviewOrder"/> + <waitForPageLoad stepKey="waitForPageLoad6"/> + + <!--Check if agreement is present on checkout and select it--> + <scrollTo selector="{{StorefrontMultishippingCheckoutOverviewReviewSection.placeOrder}}" stepKey="scrollToButtonPlaceOrder"/> + <see selector="{{StorefrontCheckoutAgreementsSection.checkoutAgreementButton}}" userInput="{{termCheckboxText}}" stepKey="seeTermInCheckout"/> + <click selector="{{StorefrontMultishippingCheckoutOverviewReviewSection.placeOrder}}" stepKey="tryToPlaceOrder1"/> + <see selector="{{StorefrontCheckoutAgreementsSection.checkoutAgreementErrorMessage}}" userInput="This is a required field." stepKey="seeErrorMessage"/> + <selectOption selector="{{StorefrontCheckoutAgreementsSection.checkoutAgreementCheckbox}}" userInput="{{termCheckboxText}}" stepKey="checkAgreement"/> + <click selector="{{StorefrontMultishippingCheckoutOverviewReviewSection.placeOrder}}" stepKey="tryToPlaceOrder2"/> + <dontSee selector="{{StorefrontCheckoutAgreementsSection.checkoutAgreementErrorMessage}}" userInput="This is a required field." stepKey="dontSeeErrorMessage"/> + + <!--See success message--> + <see selector="{{CheckoutSuccessMainSection.successTitle}}" userInput="Thank you for your purchase!" stepKey="seeSuccessTitle"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Data/TermData.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Data/TermData.xml new file mode 100644 index 0000000000000..f34aa52d1ebe3 --- /dev/null +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Data/TermData.xml @@ -0,0 +1,38 @@ +<?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="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> + <entity name="activeTextTerm" type="term"> + <data key="name" unique="suffix">name</data> + <data key="isActive">Enabled</data> + <data key="isHtml">Text</data> + <data key="mode">Manually</data> + <data key="storeView">Default Store View</data> + <data key="checkboxText" unique="suffix">test_checkbox</data> + <data key="content" unique="suffix">TestMessage</data> + </entity> + <entity name="activeHtmlTerm" type="term"> + <data key="name" unique="suffix">name</data> + <data key="isActive">Enabled</data> + <data key="isHtml">HTML</data> + <data key="mode">Manually</data> + <data key="storeView">Default Store View</data> + <data key="checkboxText" unique="suffix">test_checkbox</data> + <data key="content"><html></data> + </entity> + <entity name="disabledTextTerm" type="term"> + <data key="name" unique="suffix">name</data> + <data key="isActive">Disabled</data> + <data key="isHtml">Text</data> + <data key="mode">Manually</data> + <data key="storeView">Default Store View</data> + <data key="checkboxText" unique="suffix">test_checkbox</data> + <data key="content" unique="suffix">TestMessage</data> + </entity> +</entities> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Page/AdminEditTermPage.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Page/AdminEditTermPage.xml new file mode 100644 index 0000000000000..3a13f7d7d5e60 --- /dev/null +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Page/AdminEditTermPage.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="urn:magento:mftf:Page/etc/PageObject.xsd"> + <page name="AdminEditTermPage" url="checkout/agreement/edit/id/{{termId}}/" area="admin" module="Magento_CheckoutAgreements" parameterized="true"> + <section name="AdminEditTermFormSection"/> + </page> +</pages> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Page/AdminNewTermPage.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Page/AdminNewTermPage.xml new file mode 100644 index 0000000000000..51ec18a1d17e5 --- /dev/null +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Page/AdminNewTermPage.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> + <page name="AdminNewTermPage" url="checkout/agreement/new" area="admin" module="Magento_CheckoutAgreements"> + <section name="AdminNewTermFormSection"/> + <section name="AdminTermFormMessagesSection"/> + </page> +</pages> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Page/AdminTermsPage.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Page/AdminTermsPage.xml new file mode 100644 index 0000000000000..4fb1a9704d9d0 --- /dev/null +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Page/AdminTermsPage.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> + <page name="AdminTermsPage" url="checkout/agreement/" area="admin" module="Magento_CheckoutAgreements"> + <section name="AdminTermGridSection"/> + </page> +</pages> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Page/CheckoutPage.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Page/CheckoutPage.xml new file mode 100644 index 0000000000000..fdb75ab4bc4c2 --- /dev/null +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Page/CheckoutPage.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="urn:magento:mftf:Page/etc/PageObject.xsd"> + <page name="CheckoutPage" url="/checkout" area="storefront" module="Magento_CheckoutAgreements"> + <section name="StorefrontCheckoutAgreementsSection"/> + </page> +</pages> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Section/AdminEditTermFormSection.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Section/AdminEditTermFormSection.xml new file mode 100644 index 0000000000000..734a75b49c03a --- /dev/null +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Section/AdminEditTermFormSection.xml @@ -0,0 +1,15 @@ +<?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="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="AdminEditTermFormSection"> + <element name="delete" type="button" selector=".page-main-actions #delete"/> + <element name="acceptPopupButton" type="button" selector="button.action-primary.action-accept"/> + </section> +</sections> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Section/AdminNewTermFormSection.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Section/AdminNewTermFormSection.xml new file mode 100644 index 0000000000000..3f8a12f526c01 --- /dev/null +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Section/AdminNewTermFormSection.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="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="AdminNewTermFormSection"> + <element name="save" type="button" selector=".page-main-actions #save"/> + + <element name="conditionName" type="input" selector="#name"/> + <element name="isActive" type="select" selector="#is_active"/> + <element name="isHtml" type="select" selector="#is_html"/> + <element name="mode" type="select" selector="#mode"/> + <element name="storeView" type="multiselect" selector="#stores"/> + <element name="checkboxText" type="input" selector="#checkbox_text"/> + <element name="content" type="textarea" selector="#content"/> + <element name="contentHeight" type="input" selector="#content_height"/> + </section> +</sections> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Section/AdminTermFormMessagesSection.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Section/AdminTermFormMessagesSection.xml new file mode 100644 index 0000000000000..a3a91855b0640 --- /dev/null +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Section/AdminTermFormMessagesSection.xml @@ -0,0 +1,15 @@ +<?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="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="AdminTermFormMessagesSection"> + <element name="successMessage" type="text" selector=".message-success"/> + <element name="errorMessage" type="text" selector=".message.message-error.error"/> + </section> +</sections> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Section/AdminTermGridSection.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Section/AdminTermGridSection.xml new file mode 100644 index 0000000000000..65211c78ec00a --- /dev/null +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Section/AdminTermGridSection.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="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="AdminTermGridSection"> + <element name="searchButton" type="button" selector=".admin__data-grid-header button[title=Search]"/> + <element name="resetButton" type="button" selector="button[title='Reset Filter']"/> + <element name="filterByTermName" type="input" selector="#agreementGrid_filter_name"/> + <element name="firstRowConditionName" type="text" selector=".data-grid>tbody>tr>td.col-name"/> + <element name="firstRowConditionId" type="text" selector=".data-grid>tbody>tr>td.col-id.col-agreement_id"/> + <element name="successMessage" type="text" selector=".message-success"/> + </section> +</sections> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Section/StorefrontCheckoutAgreementsSection.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Section/StorefrontCheckoutAgreementsSection.xml new file mode 100644 index 0000000000000..cb3e98949c622 --- /dev/null +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Section/StorefrontCheckoutAgreementsSection.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="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="StorefrontCheckoutAgreementsSection"> + <element name="checkoutAgreementCheckbox" type="checkbox" selector="div.checkout-agreement.field.choice.required > input"/> + <element name="checkoutAgreementButton" type="button" selector="div.checkout-agreements-block > div > div > div > label > button > span"/> + <element name="checkoutAgreementErrorMessage" type="button" selector="div.checkout-agreement.field.choice.required > div.mage-error"/> + </section> +</sections> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveHtmlTermEntityTest.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveHtmlTermEntityTest.xml new file mode 100644 index 0000000000000..481c6683d1add --- /dev/null +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveHtmlTermEntityTest.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="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateActiveHtmlTermEntityTest"> + <annotations> + <features value="CheckoutAgreements"/> + <stories value="Checkout agreements"/> + <title value="Create active HTML checkout agreement"/> + <description value="Admin should be able to create active HTML checkout agreement"/> + <severity value="CRITICAL"/> + <testCaseId value=""/> + <group value="checkoutAgreements"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <magentoCLI command="config:set checkout/options/enable_agreements 1" stepKey="setEnableTermsOnCheckout"/> + <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin" /> + <createData entity="SimpleTwo" stepKey="createdProduct"/> + </before> + <after> + <magentoCLI command="config:set checkout/options/enable_agreements 0" stepKey="setDisableTermsOnCheckout"/> + <deleteData createDataKey="createdProduct" stepKey="deletedProduct"/> + <actionGroup ref="DeleteTerm" stepKey="deleteTerm"> + <argument name="term" value="activeHtmlTerm"/> + </actionGroup> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <actionGroup ref="CreateNewTerm" stepKey="createTerm"> + <argument name="term" value="activeHtmlTerm"/> + </actionGroup> + <actionGroup ref="AdminAssertTermInGrid" stepKey="assertTermInGrid"> + <argument name="termName" value="{{activeHtmlTerm.name}}"/> + </actionGroup> + <actionGroup ref="StorefrontAssertTermInCheckout" stepKey="assertTermInCheckout"> + <argument name="termCheckboxText" value="{{activeHtmlTerm.checkboxText}}"/> + <argument name="product" value="$$createdProduct$$"/> + </actionGroup> + </test> +</tests> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveTextTermEntityTest.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveTextTermEntityTest.xml new file mode 100644 index 0000000000000..3fc623de04f8f --- /dev/null +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveTextTermEntityTest.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="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateActiveTextTermEntityTest"> + <annotations> + <features value="CheckoutAgreements"/> + <stories value="Checkout agreements"/> + <title value="Create active text checkout agreement"/> + <description value="Admin should be able to create active text checkout agreement"/> + <severity value="CRITICAL"/> + <testCaseId value=""/> + <group value="checkoutAgreements"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <magentoCLI command="config:set checkout/options/enable_agreements 1" stepKey="setEnableTermsOnCheckout"/> + <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin" /> + <createData entity="SimpleTwo" stepKey="createdProduct"/> + </before> + <after> + <magentoCLI command="config:set checkout/options/enable_agreements 0" stepKey="setDisableTermsOnCheckout"/> + <deleteData createDataKey="createdProduct" stepKey="deletedProduct"/> + <actionGroup ref="DeleteTerm" stepKey="deleteTerm"> + <argument name="term" value="activeTextTerm"/> + </actionGroup> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <actionGroup ref="CreateNewTerm" stepKey="createTerm"> + <argument name="term" value="activeTextTerm"/> + </actionGroup> + <actionGroup ref="AdminAssertTermInGrid" stepKey="assertTermInGrid"> + <argument name="termName" value="{{activeTextTerm.name}}"/> + </actionGroup> + <actionGroup ref="StorefrontAssertTermInCheckout" stepKey="assertTermInCheckout"> + <argument name="termCheckboxText" value="{{activeTextTerm.checkboxText}}"/> + <argument name="product" value="$$createdProduct$$"/> + </actionGroup> + </test> +</tests> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateDisabledTextTermEntityTest.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateDisabledTextTermEntityTest.xml new file mode 100644 index 0000000000000..d28acdcd3d4eb --- /dev/null +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateDisabledTextTermEntityTest.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="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateDisabledTextTermEntityTest"> + <annotations> + <features value="CheckoutAgreements"/> + <stories value="Checkout agreements"/> + <title value="Create disabled text checkout agreement"/> + <description value="Admin should be able to create disabled text checkout agreement"/> + <severity value="CRITICAL"/> + <testCaseId value=""/> + <group value="checkoutAgreements"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <magentoCLI command="config:set checkout/options/enable_agreements 1" stepKey="setEnableTermsOnCheckout"/> + <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin" /> + <createData entity="SimpleTwo" stepKey="createdProduct"/> + </before> + <after> + <magentoCLI command="config:set checkout/options/enable_agreements 0" stepKey="setDisableTermsOnCheckout"/> + <deleteData createDataKey="createdProduct" stepKey="deletedProduct"/> + <actionGroup ref="DeleteTerm" stepKey="deleteTerm"> + <argument name="term" value="disabledTextTerm"/> + </actionGroup> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <actionGroup ref="CreateNewTerm" stepKey="createTerm"> + <argument name="term" value="disabledTextTerm"/> + </actionGroup> + <actionGroup ref="AdminAssertTermInGrid" stepKey="assertTermInGrid"> + <argument name="termName" value="{{disabledTextTerm.name}}"/> + </actionGroup> + <actionGroup ref="StorefrontAssertTermAbsentInCheckout" stepKey="assertTermInCheckout"> + <argument name="termCheckboxText" value="{{disabledTextTerm.checkboxText}}"/> + <argument name="product" value="$$createdProduct$$"/> + </actionGroup> + </test> +</tests> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateEnabledTextTermOnMultishippingEntityTest.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateEnabledTextTermOnMultishippingEntityTest.xml new file mode 100644 index 0000000000000..64b9ce7de2052 --- /dev/null +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateEnabledTextTermOnMultishippingEntityTest.xml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateEnabledTextTermOnMultishippingEntityTest"> + <annotations> + <features value="CheckoutAgreements"/> + <stories value="Checkout agreements"/> + <title value="Create enabled text checkout multishipping agreement"/> + <description value="Admin should be able to create enabled text checkout multishipping agreement"/> + <severity value="CRITICAL"/> + <testCaseId value=""/> + <group value="checkoutAgreements"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <magentoCLI command="config:set checkout/options/enable_agreements 1" stepKey="setEnableTermsOnCheckout"/> + <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin" /> + <createData entity="Simple_US_Customer_Multiple_Addresses" stepKey="createdCustomer"/> + <createData entity="SimpleTwo" stepKey="createdProduct1"/> + <createData entity="SimpleTwo" stepKey="createdProduct2"/> + </before> + <after> + <magentoCLI command="config:set checkout/options/enable_agreements 0" stepKey="setDisableTermsOnCheckout"/> + <deleteData createDataKey="createdCustomer" stepKey="deletedCustomer"/> + <deleteData createDataKey="createdProduct1" stepKey="deletedProduct1"/> + <deleteData createDataKey="createdProduct2" stepKey="deletedProduct2"/> + <actionGroup ref="DeleteTerm" stepKey="deleteTerm"> + <argument name="term" value="activeTextTerm"/> + </actionGroup> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <actionGroup ref="CreateNewTerm" stepKey="createTerm"> + <argument name="term" value="activeTextTerm"/> + </actionGroup> + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerLogin"> + <argument name="Customer" value="$$createdCustomer$$" /> + </actionGroup> + <actionGroup ref="StorefrontAssertTermRequireMessageInMultishippingCheckout" stepKey="assertTermInCheckout"> + <argument name="termCheckboxText" value="{{activeTextTerm.checkboxText}}"/> + <argument name="product1" value="$$createdProduct1$$"/> + <argument name="product2" value="$$createdProduct2$$"/> + </actionGroup> + </test> +</tests> diff --git a/app/code/Magento/Multishipping/Test/Mftf/Page/MultishippingCheckoutAddressesPage.xml b/app/code/Magento/Multishipping/Test/Mftf/Page/MultishippingCheckoutAddressesPage.xml new file mode 100644 index 0000000000000..08ff948b200a7 --- /dev/null +++ b/app/code/Magento/Multishipping/Test/Mftf/Page/MultishippingCheckoutAddressesPage.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="urn:magento:mftf:Page/etc/PageObject.xsd"> + <page name="MultishippingCheckoutAddressesPage" url="/multishipping/checkout/addresses" module="Magento_Multishipping" area="storefront"> + <section name="StorefrontMultishippingCheckoutAddressesToolbarSection"/> + </page> +</pages> diff --git a/app/code/Magento/Multishipping/Test/Mftf/Page/MultishippingCheckoutBillingPage.xml b/app/code/Magento/Multishipping/Test/Mftf/Page/MultishippingCheckoutBillingPage.xml new file mode 100644 index 0000000000000..6e1fbaed2d29a --- /dev/null +++ b/app/code/Magento/Multishipping/Test/Mftf/Page/MultishippingCheckoutBillingPage.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="urn:magento:mftf:Page/etc/PageObject.xsd"> + <page name="MultishippingCheckoutBillingPage" url="/multishipping/checkout/billing" module="Magento_Multishipping" area="storefront"> + <section name="StorefrontMultishippingCheckoutBillingToolbarSection"/> + </page> +</pages> diff --git a/app/code/Magento/Multishipping/Test/Mftf/Page/MultishippingCheckoutOverviewPage.xml b/app/code/Magento/Multishipping/Test/Mftf/Page/MultishippingCheckoutOverviewPage.xml new file mode 100644 index 0000000000000..2f56f70f96e02 --- /dev/null +++ b/app/code/Magento/Multishipping/Test/Mftf/Page/MultishippingCheckoutOverviewPage.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="urn:magento:mftf:Page/etc/PageObject.xsd"> + <page name="MultishippingCheckoutOverviewPage" url="/multishipping/checkout/overview" module="Magento_Multishipping" area="storefront"> + <section name="StorefrontMultishippingCheckoutOverviewReviewSection"/> + </page> +</pages> diff --git a/app/code/Magento/Multishipping/Test/Mftf/Page/MultishippingCheckoutShippingPage.xml b/app/code/Magento/Multishipping/Test/Mftf/Page/MultishippingCheckoutShippingPage.xml new file mode 100644 index 0000000000000..a3d54a9ed90a7 --- /dev/null +++ b/app/code/Magento/Multishipping/Test/Mftf/Page/MultishippingCheckoutShippingPage.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="urn:magento:mftf:Page/etc/PageObject.xsd"> + <page name="MultishippingCheckoutShippingPage" url="/multishipping/checkout/shipping" module="Magento_Multishipping" area="storefront"> + <section name="StorefrontMultishippingCheckoutShippingToolbarSection"/> + </page> +</pages> diff --git a/app/code/Magento/Multishipping/Test/Mftf/Section/StorefrontMultishippingCheckoutAddressesToolbarSection.xml b/app/code/Magento/Multishipping/Test/Mftf/Section/StorefrontMultishippingCheckoutAddressesToolbarSection.xml new file mode 100644 index 0000000000000..f238afe672156 --- /dev/null +++ b/app/code/Magento/Multishipping/Test/Mftf/Section/StorefrontMultishippingCheckoutAddressesToolbarSection.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="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="StorefrontMultishippingCheckoutAddressesToolbarSection"> + <element name="goToShippingInformation" type="button" selector="button.action.primary.continue"/> + </section> +</sections> diff --git a/app/code/Magento/Multishipping/Test/Mftf/Section/StorefrontMultishippingCheckoutBillingToolbarSection.xml b/app/code/Magento/Multishipping/Test/Mftf/Section/StorefrontMultishippingCheckoutBillingToolbarSection.xml new file mode 100644 index 0000000000000..6cfc09c1653fd --- /dev/null +++ b/app/code/Magento/Multishipping/Test/Mftf/Section/StorefrontMultishippingCheckoutBillingToolbarSection.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="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="StorefrontMultishippingCheckoutBillingToolbarSection"> + <element name="goToReviewOrder" type="button" selector="button.action.primary.continue"/> + </section> +</sections> diff --git a/app/code/Magento/Multishipping/Test/Mftf/Section/StorefrontMultishippingCheckoutOverviewReviewSection.xml b/app/code/Magento/Multishipping/Test/Mftf/Section/StorefrontMultishippingCheckoutOverviewReviewSection.xml new file mode 100644 index 0000000000000..3c4de2990f9a5 --- /dev/null +++ b/app/code/Magento/Multishipping/Test/Mftf/Section/StorefrontMultishippingCheckoutOverviewReviewSection.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="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="StorefrontMultishippingCheckoutOverviewReviewSection"> + <element name="placeOrder" type="button" selector="button.action.primary.submit"/> + </section> +</sections> diff --git a/app/code/Magento/Multishipping/Test/Mftf/Section/StorefrontMultishippingCheckoutShippingToolbarSection.xml b/app/code/Magento/Multishipping/Test/Mftf/Section/StorefrontMultishippingCheckoutShippingToolbarSection.xml new file mode 100644 index 0000000000000..deea09acf2f2a --- /dev/null +++ b/app/code/Magento/Multishipping/Test/Mftf/Section/StorefrontMultishippingCheckoutShippingToolbarSection.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="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="StorefrontMultishippingCheckoutShippingToolbarSection"> + <element name="continueToBilling" type="button" selector="button.action.primary.continue"/> + </section> +</sections> From 7de9c303893073d30856e4ff4935765cb27810cb Mon Sep 17 00:00:00 2001 From: mmularski <mmularczyk9@gmail.com> Date: Tue, 26 Nov 2019 08:02:45 +0100 Subject: [PATCH 0132/1143] Issue-628. Convert CreateTermEntityTest to MFTF - CR fixes --- .../AdminAssertTermInGridActionGroup.xml | 2 +- .../ActionGroup/CreateNewTermActionGroup.xml | 4 +- .../ActionGroup/DeleteTermActionGroup.xml | 8 ++-- ...tAssertTermAbsentInCheckoutActionGroup.xml | 41 ++---------------- ...refrontAssertTermInCheckoutActionGroup.xml | 42 ++----------------- ...sageInMultishippingCheckoutActionGroup.xml | 34 +++------------ ...ontProcessCheckoutToPaymentActionGroup.xml | 35 ++++++++++++++++ .../Mftf/Section/AdminNewTermFormSection.xml | 1 - .../Mftf/Section/AdminTermGridSection.xml | 4 +- .../AdminCreateActiveHtmlTermEntityTest.xml | 13 +++--- .../AdminCreateActiveTextTermEntityTest.xml | 13 +++--- .../AdminCreateDisabledTextTermEntityTest.xml | 13 +++--- ...abledTextTermOnMultishippingEntityTest.xml | 14 ++++--- 13 files changed, 88 insertions(+), 136 deletions(-) create mode 100644 app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/StorefrontProcessCheckoutToPaymentActionGroup.xml diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/AdminAssertTermInGridActionGroup.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/AdminAssertTermInGridActionGroup.xml index 965d8d2e01064..9a855c6f8b5e9 100644 --- a/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/AdminAssertTermInGridActionGroup.xml +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/AdminAssertTermInGridActionGroup.xml @@ -8,7 +8,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AdminAssertTermInGrid"> + <actionGroup name="AdminAssertTermInGridActionGroup"> <arguments> <argument name="termName" type="string"/> </arguments> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/CreateNewTermActionGroup.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/CreateNewTermActionGroup.xml index 4923589ee9cf4..d420cc155a77c 100644 --- a/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/CreateNewTermActionGroup.xml +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/CreateNewTermActionGroup.xml @@ -8,12 +8,12 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="CreateNewTerm"> + <actionGroup name="CreateNewTermActionGroup"> <arguments> <argument name="term"/> </arguments> <amOnPage url="{{AdminNewTermPage.url}}" stepKey="amOnNewTermPage"/> - <waitForPageLoad stepKey="waitForPageLoad1"/> + <waitForPageLoad stepKey="waitForAdminNewTermPageLoad"/> <fillField selector="{{AdminNewTermFormSection.conditionName}}" userInput="{{term.name}}" stepKey="fillFieldConditionName"/> <selectOption selector="{{AdminNewTermFormSection.isActive}}" userInput="{{term.isActive}}" stepKey="selectOptionIsActive"/> <selectOption selector="{{AdminNewTermFormSection.isHtml}}" userInput="{{term.isHtml}}" stepKey="selectOptionIsHtml"/> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/DeleteTermActionGroup.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/DeleteTermActionGroup.xml index 7ed4d55f29f2d..b88101ce88ef6 100644 --- a/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/DeleteTermActionGroup.xml +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/DeleteTermActionGroup.xml @@ -8,19 +8,19 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="DeleteTerm"> + <actionGroup name="DeleteTermActionGroup"> <arguments> <argument name="term" /> </arguments> <amOnPage url="{{AdminTermsPage.url}}" stepKey="onTermGridPage"/> - <waitForPageLoad stepKey="waitForPageLoad1"/> + <waitForPageLoad stepKey="waitForAdminTermsGridPageLoad"/> <fillField selector="{{AdminTermGridSection.filterByTermName}}" userInput="{{term.name}}" stepKey="fillTermNameFilter"/> <click selector="{{AdminTermGridSection.searchButton}}" stepKey="clickSearchButton"/> <click selector="{{AdminTermGridSection.firstRowConditionId}}" stepKey="clickFirstRow"/> - <waitForPageLoad stepKey="waitForPageLoad2"/> + <waitForPageLoad stepKey="waitForEditTermPageLoad"/> <click selector="{{AdminEditTermFormSection.delete}}" stepKey="clickDeleteButton"/> <click selector="{{AdminEditTermFormSection.acceptPopupButton}}" stepKey="clickDeleteOkButton"/> - <waitForPageLoad stepKey="waitForPageLoad3"/> + <waitForPageLoad stepKey="waitForAdminTermsGridPageLoad2"/> <see selector="{{AdminTermFormMessagesSection.successMessage}}" userInput="You deleted the condition." stepKey="seeSuccessMessage"/> </actionGroup> </actionGroups> \ No newline at end of file diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/StorefrontAssertTermAbsentInCheckoutActionGroup.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/StorefrontAssertTermAbsentInCheckoutActionGroup.xml index ca2f1b0db59fe..7be17d8ca69d0 100644 --- a/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/StorefrontAssertTermAbsentInCheckoutActionGroup.xml +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/StorefrontAssertTermAbsentInCheckoutActionGroup.xml @@ -8,51 +8,16 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="StorefrontAssertTermAbsentInCheckout"> + <actionGroup name="StorefrontAssertTermAbsentInCheckoutActionGroup"> <arguments> <argument name="termCheckboxText" type="string"/> - <argument name="product" defaultValue="SimpleTwo"/> </arguments> - - <!--Add product to cart--> - <amOnPage url="{{StorefrontProductPage.url(product.custom_attributes[url_key])}}" stepKey="goToProductPage"/> - <waitForPageLoad stepKey="waitForProductPage"/> - <click selector="{{StorefrontProductPageSection.addToCartBtn}}" stepKey="addToCart"/> - <waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdding}}" stepKey="waitForElementNotVisibleAddToCartButtonTitleIsAdding"/> - <waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdded}}" stepKey="waitForElementNotVisibleAddToCartButtonTitleIsAdded"/> - <waitForElementVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAddToCart}}" stepKey="waitForElementVisibleAddToCartButtonTitleIsAddToCart"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" time="30" stepKey="waitForProductAddedMessage"/> - <see selector="{{StorefrontMessagesSection.success}}" userInput="You added {{product.name}} to your shopping cart." stepKey="seeAddToCartSuccessMessage"/> - - <!--Go to Checkout--> - <waitForElementNotVisible selector="{{StorefrontMinicartSection.emptyCart}}" stepKey="waitUpdateQuantity"/> - <wait time="5" stepKey="waitMinicartRendering"/> - <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickCart"/> - <click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="goToCheckout"/> - - <!--Process steps--> - <fillField selector="{{CheckoutShippingSection.email}}" userInput="{{CustomerEntityOne.email}}" stepKey="enterEmail"/> - <fillField selector="{{CheckoutShippingSection.firstName}}" userInput="{{CustomerEntityOne.firstname}}" stepKey="enterFirstName"/> - <fillField selector="{{CheckoutShippingSection.lastName}}" userInput="{{CustomerEntityOne.lastname}}" stepKey="enterLastName"/> - <fillField selector="{{CheckoutShippingSection.street}}" userInput="{{CustomerAddressSimple.street[0]}}" stepKey="enterStreet"/> - <fillField selector="{{CheckoutShippingSection.city}}" userInput="{{CustomerAddressSimple.city}}" stepKey="enterCity"/> - <selectOption selector="{{CheckoutShippingSection.region}}" userInput="{{CustomerAddressSimple.state}}" stepKey="selectRegion"/> - <fillField selector="{{CheckoutShippingSection.postcode}}" userInput="{{CustomerAddressSimple.postcode}}" stepKey="enterPostcode"/> - <fillField selector="{{CheckoutShippingSection.telephone}}" userInput="{{CustomerAddressSimple.telephone}}" stepKey="enterTelephone"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask1"/> - <click selector="{{CheckoutShippingMethodsSection.checkShippingMethodByName('')}}" stepKey="selectShippingMethod"/> - <waitForElement selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/> - <click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/> - <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/> - <seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/> - <!--Check if agreement is absent on checkout--> <dontSee selector="{{StorefrontCheckoutAgreementsSection.checkoutAgreementButton}}" userInput="{{termCheckboxText}}" stepKey="seeTermInCheckout"/> <!--Checkout select Check/Money Order payment--> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask2"/> - <waitForPageLoad stepKey="waitForPageLoad2"/> + <waitForLoadingMaskToDisappear stepKey="waitForPaymentPageRendering"/> + <waitForPageLoad stepKey="waitForPaymentRendering"/> <conditionalClick selector="{{StorefrontCheckoutPaymentMethodSection.checkPaymentMethodByName('Check / Money order')}}" dependentSelector="{{StorefrontCheckoutPaymentMethodSection.checkPaymentMethodByName('Check / Money order')}}" visible="true" stepKey="selectCheckmoPaymentMethod"/> <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskAfterPaymentMethodSelection"/> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/StorefrontAssertTermInCheckoutActionGroup.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/StorefrontAssertTermInCheckoutActionGroup.xml index fb2825de1a7ad..0cf745ce4e04f 100644 --- a/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/StorefrontAssertTermInCheckoutActionGroup.xml +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/StorefrontAssertTermInCheckoutActionGroup.xml @@ -8,53 +8,17 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="StorefrontAssertTermInCheckout"> + <actionGroup name="StorefrontAssertTermInCheckoutActionGroup"> <arguments> <argument name="termCheckboxText" type="string"/> - <argument name="product" defaultValue="SimpleTwo"/> </arguments> - - <!--Add product to cart--> - <amOnPage url="{{StorefrontProductPage.url(product.custom_attributes[url_key])}}" stepKey="goToProductPage"/> - <waitForPageLoad stepKey="waitForProductPage"/> - <click selector="{{StorefrontProductPageSection.addToCartBtn}}" stepKey="addToCart"/> - <waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdding}}" stepKey="waitForElementNotVisibleAddToCartButtonTitleIsAdding"/> - <waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdded}}" stepKey="waitForElementNotVisibleAddToCartButtonTitleIsAdded"/> - <waitForElementVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAddToCart}}" stepKey="waitForElementVisibleAddToCartButtonTitleIsAddToCart"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" time="30" stepKey="waitForProductAddedMessage"/> - <see selector="{{StorefrontMessagesSection.success}}" userInput="You added {{product.name}} to your shopping cart." stepKey="seeAddToCartSuccessMessage"/> - - <!--Go to Checkout--> - <waitForElementNotVisible selector="{{StorefrontMinicartSection.emptyCart}}" stepKey="waitUpdateQuantity"/> - <wait time="5" stepKey="waitMinicartRendering"/> - <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickCart"/> - <click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="goToCheckout"/> - - <!--Process steps--> - <fillField selector="{{CheckoutShippingSection.email}}" userInput="{{CustomerEntityOne.email}}" stepKey="enterEmail"/> - <fillField selector="{{CheckoutShippingSection.firstName}}" userInput="{{CustomerEntityOne.firstname}}" stepKey="enterFirstName"/> - <fillField selector="{{CheckoutShippingSection.lastName}}" userInput="{{CustomerEntityOne.lastname}}" stepKey="enterLastName"/> - <fillField selector="{{CheckoutShippingSection.street}}" userInput="{{CustomerAddressSimple.street[0]}}" stepKey="enterStreet"/> - <fillField selector="{{CheckoutShippingSection.city}}" userInput="{{CustomerAddressSimple.city}}" stepKey="enterCity"/> - <selectOption selector="{{CheckoutShippingSection.region}}" userInput="{{CustomerAddressSimple.state}}" stepKey="selectRegion"/> - <fillField selector="{{CheckoutShippingSection.postcode}}" userInput="{{CustomerAddressSimple.postcode}}" stepKey="enterPostcode"/> - <fillField selector="{{CheckoutShippingSection.telephone}}" userInput="{{CustomerAddressSimple.telephone}}" stepKey="enterTelephone"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask1"/> - <click selector="{{CheckoutShippingMethodsSection.checkShippingMethodByName('')}}" stepKey="selectShippingMethod"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask2"/> - <waitForElement selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/> - <click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/> - <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/> - <seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/> - <!--Check if agreement is present on checkout and select it--> <see selector="{{StorefrontCheckoutAgreementsSection.checkoutAgreementButton}}" userInput="{{termCheckboxText}}" stepKey="seeTermInCheckout"/> <selectOption selector="{{StorefrontCheckoutAgreementsSection.checkoutAgreementCheckbox}}" userInput="{{termCheckboxText}}" stepKey="checkAgreement"/> <!--Checkout select Check/Money Order payment--> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask3"/> - <waitForPageLoad stepKey="waitForPageLoad2"/> + <waitForLoadingMaskToDisappear stepKey="waitForPaymentPageRendering"/> + <waitForPageLoad stepKey="waitForPaymentRendering"/> <conditionalClick selector="{{StorefrontCheckoutPaymentMethodSection.checkPaymentMethodByName('Check / Money order')}}" dependentSelector="{{StorefrontCheckoutPaymentMethodSection.checkPaymentMethodByName('Check / Money order')}}" visible="true" stepKey="selectCheckmoPaymentMethod"/> <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskAfterPaymentMethodSelection"/> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/StorefrontAssertTermRequireMessageInMultishippingCheckoutActionGroup.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/StorefrontAssertTermRequireMessageInMultishippingCheckoutActionGroup.xml index 00637c6b22585..35ac4826ccfef 100644 --- a/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/StorefrontAssertTermRequireMessageInMultishippingCheckoutActionGroup.xml +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/StorefrontAssertTermRequireMessageInMultishippingCheckoutActionGroup.xml @@ -8,47 +8,23 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="StorefrontAssertTermRequireMessageInMultishippingCheckout"> + <actionGroup name="StorefrontAssertTermRequireMessageInMultishippingCheckoutActionGroup"> <arguments> <argument name="termCheckboxText" type="string"/> - <argument name="product1" defaultValue="SimpleTwo"/> - <argument name="product2" defaultValue="SimpleTwo"/> </arguments> - <!--Add product1 to cart--> - <amOnPage url="{{StorefrontProductPage.url(product1.custom_attributes[url_key])}}" stepKey="goToProduct1Page"/> - <waitForPageLoad stepKey="waitForProduct1Page"/> - <click selector="{{StorefrontProductPageSection.addToCartBtn}}" stepKey="addToCart1"/> - <waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdding}}" stepKey="waitForElementNotVisibleAddToCartButton1TitleIsAdding"/> - <waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdded}}" stepKey="waitForElementNotVisibleAddToCartButton1TitleIsAdded"/> - <waitForElementVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAddToCart}}" stepKey="waitForElementVisibleAddToCartButton1TitleIsAddToCart"/> - <waitForPageLoad stepKey="waitForPageLoad1"/> - <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" time="30" stepKey="waitForProduct1AddedMessage"/> - <see selector="{{StorefrontMessagesSection.success}}" userInput="You added {{product1.name}} to your shopping cart." stepKey="seeAddToCart1SuccessMessage"/> - - <!--Add product2 to cart--> - <amOnPage url="{{StorefrontProductPage.url(product2.custom_attributes[url_key])}}" stepKey="goToProduct2Page"/> - <waitForPageLoad stepKey="waitForProduct2Page"/> - <click selector="{{StorefrontProductPageSection.addToCartBtn}}" stepKey="addToCart2"/> - <waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdding}}" stepKey="waitForElementNotVisibleAddToCartButton2TitleIsAdding"/> - <waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdded}}" stepKey="waitForElementNotVisibleAddToCartButton2TitleIsAdded"/> - <waitForElementVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAddToCart}}" stepKey="waitForElementVisibleAddToCartButton2TitleIsAddToCart"/> - <waitForPageLoad stepKey="waitForPageLoad2"/> - <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" time="30" stepKey="waitForProduct2AddedMessage"/> - <see selector="{{StorefrontMessagesSection.success}}" userInput="You added {{product2.name}} to your shopping cart." stepKey="seeAddToCart2SuccessMessage"/> - <!--Go to Checkout Cart and proceed with multiple addresses--> <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCheckoutCart"/> - <waitForPageLoad stepKey="waitForPageLoad3"/> + <waitForPageLoad stepKey="waitForCheckoutPageLoad"/> <click selector="{{MultishippingSection.checkoutWithMultipleAddresses}}" stepKey="proceedMultishipping"/> <!--Procees do overview page--> <click selector="{{StorefrontMultishippingCheckoutAddressesToolbarSection.goToShippingInformation}}" stepKey="clickGoToShippingInformation"/> - <waitForPageLoad stepKey="waitForPageLoad4"/> + <waitForPageLoad stepKey="waitForCheckoutAddressToolbarPageLoad"/> <click selector="{{StorefrontMultishippingCheckoutShippingToolbarSection.continueToBilling}}" stepKey="clickContinueToBilling"/> - <waitForPageLoad stepKey="waitForPageLoad5"/> + <waitForPageLoad stepKey="waitForCheckoutShippingToolbarPageLoad"/> <click selector="{{StorefrontMultishippingCheckoutBillingToolbarSection.goToReviewOrder}}" stepKey="clickGoToReviewOrder"/> - <waitForPageLoad stepKey="waitForPageLoad6"/> + <waitForPageLoad stepKey="waitForCheckoutBillingToolbarPageLoad"/> <!--Check if agreement is present on checkout and select it--> <scrollTo selector="{{StorefrontMultishippingCheckoutOverviewReviewSection.placeOrder}}" stepKey="scrollToButtonPlaceOrder"/> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/StorefrontProcessCheckoutToPaymentActionGroup.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/StorefrontProcessCheckoutToPaymentActionGroup.xml new file mode 100644 index 0000000000000..c40f24836c815 --- /dev/null +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/StorefrontProcessCheckoutToPaymentActionGroup.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontProcessCheckoutToPaymentActionGroup"> + <!--Go to Checkout--> + <waitForElementNotVisible selector="{{StorefrontMinicartSection.emptyCart}}" stepKey="waitUpdateQuantity"/> + <wait time="5" stepKey="waitMinicartRendering"/> + <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickCart"/> + <click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="goToCheckout"/> + + <!--Process steps--> + <fillField selector="{{CheckoutShippingSection.email}}" userInput="{{CustomerEntityOne.email}}" stepKey="enterEmail"/> + <fillField selector="{{CheckoutShippingSection.firstName}}" userInput="{{CustomerEntityOne.firstname}}" stepKey="enterFirstName"/> + <fillField selector="{{CheckoutShippingSection.lastName}}" userInput="{{CustomerEntityOne.lastname}}" stepKey="enterLastName"/> + <fillField selector="{{CheckoutShippingSection.street}}" userInput="{{CustomerAddressSimple.street[0]}}" stepKey="enterStreet"/> + <fillField selector="{{CheckoutShippingSection.city}}" userInput="{{CustomerAddressSimple.city}}" stepKey="enterCity"/> + <selectOption selector="{{CheckoutShippingSection.region}}" userInput="{{CustomerAddressSimple.state}}" stepKey="selectRegion"/> + <fillField selector="{{CheckoutShippingSection.postcode}}" userInput="{{CustomerAddressSimple.postcode}}" stepKey="enterPostcode"/> + <fillField selector="{{CheckoutShippingSection.telephone}}" userInput="{{CustomerAddressSimple.telephone}}" stepKey="enterTelephone"/> + <waitForLoadingMaskToDisappear stepKey="waitForShippingMethods"/> + <click selector="{{CheckoutShippingMethodsSection.checkShippingMethodByName('')}}" stepKey="selectShippingMethod"/> + <waitForElement selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForTheNextButton"/> + <waitForElementNotVisible selector=".loading-mask" time="300" stepKey="waitForProcessShippingMethod"/> + <click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/> + <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/> + <seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Section/AdminNewTermFormSection.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Section/AdminNewTermFormSection.xml index 3f8a12f526c01..aeff29ef116fc 100644 --- a/app/code/Magento/CheckoutAgreements/Test/Mftf/Section/AdminNewTermFormSection.xml +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Section/AdminNewTermFormSection.xml @@ -10,7 +10,6 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminNewTermFormSection"> <element name="save" type="button" selector=".page-main-actions #save"/> - <element name="conditionName" type="input" selector="#name"/> <element name="isActive" type="select" selector="#is_active"/> <element name="isHtml" type="select" selector="#is_html"/> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Section/AdminTermGridSection.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Section/AdminTermGridSection.xml index 65211c78ec00a..326f9dcce4320 100644 --- a/app/code/Magento/CheckoutAgreements/Test/Mftf/Section/AdminTermGridSection.xml +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Section/AdminTermGridSection.xml @@ -8,8 +8,8 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminTermGridSection"> - <element name="searchButton" type="button" selector=".admin__data-grid-header button[title=Search]"/> - <element name="resetButton" type="button" selector="button[title='Reset Filter']"/> + <element name="searchButton" type="button" selector="//div[contains(@class,'admin__data-grid-header')]//div[contains(@class,'admin__filter-actions')]/button[1]"/> + <element name="resetButton" type="button" selector="//div[contains(@class,'admin__data-grid-header')]//div[contains(@class,'admin__filter-actions')]/button[2]"/> <element name="filterByTermName" type="input" selector="#agreementGrid_filter_name"/> <element name="firstRowConditionName" type="text" selector=".data-grid>tbody>tr>td.col-name"/> <element name="firstRowConditionId" type="text" selector=".data-grid>tbody>tr>td.col-id.col-agreement_id"/> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveHtmlTermEntityTest.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveHtmlTermEntityTest.xml index 481c6683d1add..ed9f5959be9d4 100644 --- a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveHtmlTermEntityTest.xml +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveHtmlTermEntityTest.xml @@ -27,21 +27,24 @@ <after> <magentoCLI command="config:set checkout/options/enable_agreements 0" stepKey="setDisableTermsOnCheckout"/> <deleteData createDataKey="createdProduct" stepKey="deletedProduct"/> - <actionGroup ref="DeleteTerm" stepKey="deleteTerm"> + <actionGroup ref="DeleteTermActionGroup" stepKey="deleteTerm"> <argument name="term" value="activeHtmlTerm"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> </after> - <actionGroup ref="CreateNewTerm" stepKey="createTerm"> + <actionGroup ref="CreateNewTermActionGroup" stepKey="createTerm"> <argument name="term" value="activeHtmlTerm"/> </actionGroup> - <actionGroup ref="AdminAssertTermInGrid" stepKey="assertTermInGrid"> + <actionGroup ref="AdminAssertTermInGridActionGroup" stepKey="assertTermInGrid"> <argument name="termName" value="{{activeHtmlTerm.name}}"/> </actionGroup> - <actionGroup ref="StorefrontAssertTermInCheckout" stepKey="assertTermInCheckout"> - <argument name="termCheckboxText" value="{{activeHtmlTerm.checkboxText}}"/> + <actionGroup ref="AddSimpleProductToCart" stepKey="addProductToTheCart"> <argument name="product" value="$$createdProduct$$"/> </actionGroup> + <actionGroup ref="StorefrontProcessCheckoutToPaymentActionGroup" stepKey="processCheckoutToThePaymentMethodsPage"/> + <actionGroup ref="StorefrontAssertTermInCheckoutActionGroup" stepKey="assertTermInCheckout"> + <argument name="termCheckboxText" value="{{activeHtmlTerm.checkboxText}}"/> + </actionGroup> </test> </tests> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveTextTermEntityTest.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveTextTermEntityTest.xml index 3fc623de04f8f..2a95c44a6d4eb 100644 --- a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveTextTermEntityTest.xml +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveTextTermEntityTest.xml @@ -27,21 +27,24 @@ <after> <magentoCLI command="config:set checkout/options/enable_agreements 0" stepKey="setDisableTermsOnCheckout"/> <deleteData createDataKey="createdProduct" stepKey="deletedProduct"/> - <actionGroup ref="DeleteTerm" stepKey="deleteTerm"> + <actionGroup ref="DeleteTermActionGroup" stepKey="deleteTerm"> <argument name="term" value="activeTextTerm"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> </after> - <actionGroup ref="CreateNewTerm" stepKey="createTerm"> + <actionGroup ref="CreateNewTermActionGroup" stepKey="createTerm"> <argument name="term" value="activeTextTerm"/> </actionGroup> - <actionGroup ref="AdminAssertTermInGrid" stepKey="assertTermInGrid"> + <actionGroup ref="AdminAssertTermInGridActionGroup" stepKey="assertTermInGrid"> <argument name="termName" value="{{activeTextTerm.name}}"/> </actionGroup> - <actionGroup ref="StorefrontAssertTermInCheckout" stepKey="assertTermInCheckout"> - <argument name="termCheckboxText" value="{{activeTextTerm.checkboxText}}"/> + <actionGroup ref="AddSimpleProductToCart" stepKey="addProductToTheCart"> <argument name="product" value="$$createdProduct$$"/> </actionGroup> + <actionGroup ref="StorefrontProcessCheckoutToPaymentActionGroup" stepKey="processCheckoutToThePaymentMethodsPage"/> + <actionGroup ref="StorefrontAssertTermInCheckoutActionGroup" stepKey="assertTermInCheckout"> + <argument name="termCheckboxText" value="{{activeTextTerm.checkboxText}}"/> + </actionGroup> </test> </tests> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateDisabledTextTermEntityTest.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateDisabledTextTermEntityTest.xml index d28acdcd3d4eb..d279d38f854d1 100644 --- a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateDisabledTextTermEntityTest.xml +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateDisabledTextTermEntityTest.xml @@ -27,21 +27,24 @@ <after> <magentoCLI command="config:set checkout/options/enable_agreements 0" stepKey="setDisableTermsOnCheckout"/> <deleteData createDataKey="createdProduct" stepKey="deletedProduct"/> - <actionGroup ref="DeleteTerm" stepKey="deleteTerm"> + <actionGroup ref="DeleteTermActionGroup" stepKey="deleteTerm"> <argument name="term" value="disabledTextTerm"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> </after> - <actionGroup ref="CreateNewTerm" stepKey="createTerm"> + <actionGroup ref="CreateNewTermActionGroup" stepKey="createTerm"> <argument name="term" value="disabledTextTerm"/> </actionGroup> - <actionGroup ref="AdminAssertTermInGrid" stepKey="assertTermInGrid"> + <actionGroup ref="AdminAssertTermInGridActionGroup" stepKey="assertTermInGrid"> <argument name="termName" value="{{disabledTextTerm.name}}"/> </actionGroup> - <actionGroup ref="StorefrontAssertTermAbsentInCheckout" stepKey="assertTermInCheckout"> - <argument name="termCheckboxText" value="{{disabledTextTerm.checkboxText}}"/> + <actionGroup ref="AddSimpleProductToCart" stepKey="addProductToTheCart"> <argument name="product" value="$$createdProduct$$"/> </actionGroup> + <actionGroup ref="StorefrontProcessCheckoutToPaymentActionGroup" stepKey="processCheckoutToThePaymentMethodsPage"/> + <actionGroup ref="StorefrontAssertTermAbsentInCheckoutActionGroup" stepKey="assertTermAbsentInCheckout"> + <argument name="termCheckboxText" value="{{disabledTextTerm.checkboxText}}"/> + </actionGroup> </test> </tests> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateEnabledTextTermOnMultishippingEntityTest.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateEnabledTextTermOnMultishippingEntityTest.xml index 64b9ce7de2052..e579d2653b44d 100644 --- a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateEnabledTextTermOnMultishippingEntityTest.xml +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateEnabledTextTermOnMultishippingEntityTest.xml @@ -31,22 +31,26 @@ <deleteData createDataKey="createdCustomer" stepKey="deletedCustomer"/> <deleteData createDataKey="createdProduct1" stepKey="deletedProduct1"/> <deleteData createDataKey="createdProduct2" stepKey="deletedProduct2"/> - <actionGroup ref="DeleteTerm" stepKey="deleteTerm"> + <actionGroup ref="DeleteTermActionGroup" stepKey="deleteTerm"> <argument name="term" value="activeTextTerm"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> </after> - <actionGroup ref="CreateNewTerm" stepKey="createTerm"> + <actionGroup ref="CreateNewTermActionGroup" stepKey="createTerm"> <argument name="term" value="activeTextTerm"/> </actionGroup> <actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerLogin"> <argument name="Customer" value="$$createdCustomer$$" /> </actionGroup> - <actionGroup ref="StorefrontAssertTermRequireMessageInMultishippingCheckout" stepKey="assertTermInCheckout"> + <actionGroup ref="AddSimpleProductToCart" stepKey="addProduct1ToTheCart"> + <argument name="product" value="$$createdProduct1$$"/> + </actionGroup> + <actionGroup ref="AddSimpleProductToCart" stepKey="addProduct2ToTheCart"> + <argument name="product" value="$$createdProduct2$$"/> + </actionGroup> + <actionGroup ref="StorefrontAssertTermRequireMessageInMultishippingCheckoutActionGroup" stepKey="assertTermInCheckout"> <argument name="termCheckboxText" value="{{activeTextTerm.checkboxText}}"/> - <argument name="product1" value="$$createdProduct1$$"/> - <argument name="product2" value="$$createdProduct2$$"/> </actionGroup> </test> </tests> From 841bb75dfbb59a8971b0897b55a234923a2c30e5 Mon Sep 17 00:00:00 2001 From: ashna-jahan <ashna@jivainfotech.com> Date: Tue, 26 Nov 2019 19:35:25 +0530 Subject: [PATCH 0133/1143] fixed issue 25433 --- .../web/css/source/forms/fields/_control-table.less | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less b/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less index 697d11fb57d67..821ab04d8c44c 100644 --- a/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less +++ b/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less @@ -237,3 +237,16 @@ float: right; } } + +@media only screen and (min-width: 768px) +{ + .product_form_product_form_advanced_pricing_modal .admin__fieldset > .admin__field > .admin__field-control{ + min-width: 682px; + } + + .admin__control-table-wrapper { + max-width: 100% !important; + overflow-x: visible !important; + overflow-y: visible !important; + } +} \ No newline at end of file From 6991ebae4d56490f6cd7ba06fe74dfd1cc08ae81 Mon Sep 17 00:00:00 2001 From: Dmytro Yushkin <dyushkin@adobe.com> Date: Mon, 25 Nov 2019 16:42:05 -0600 Subject: [PATCH 0134/1143] MC-18459: Remove Special Price From and To Date fields from the Mass Update page --- .../Helper/Product/Edit/Action/Attribute.php | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Catalog/Helper/Product/Edit/Action/Attribute.php b/app/code/Magento/Catalog/Helper/Product/Edit/Action/Attribute.php index 2c1bacdb99e12..09d53427a3043 100644 --- a/app/code/Magento/Catalog/Helper/Product/Edit/Action/Attribute.php +++ b/app/code/Magento/Catalog/Helper/Product/Edit/Action/Attribute.php @@ -3,15 +3,15 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); -/** - * Adminhtml catalog product action attribute update helper - */ namespace Magento\Catalog\Helper\Product\Edit\Action; /** - * Class Attribute + * Adminhtml catalog product action attribute update helper. + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) */ class Attribute extends \Magento\Backend\Helper\Data { @@ -32,7 +32,7 @@ class Attribute extends \Magento\Backend\Helper\Data /** * Excluded from batch update attribute codes * - * @var string[] + * @var array */ protected $_excludedAttributes = ['url_key']; @@ -92,6 +92,7 @@ public function __construct( /** * Return product collection with selected product filter + * * Product collection didn't load * * @return \Magento\Catalog\Model\ResourceModel\Product\Collection @@ -171,8 +172,8 @@ public function getAttributes() $this->getProductsSetIds() ); - if ($this->_excludedAttributes) { - $this->_attributes->addFieldToFilter('attribute_code', ['nin' => $this->_excludedAttributes]); + if ($excludedAttributes = $this->getExcludedAttributes()) { + $this->_attributes->addFieldToFilter('attribute_code', ['nin' => $excludedAttributes]); } // check product type apply to limitation and remove attributes that impossible to change in mass-update @@ -193,11 +194,24 @@ public function getAttributes() } /** + * Gets website id. + * * @param int $storeId * @return int + * @throws \Magento\Framework\Exception\NoSuchEntityException */ public function getStoreWebsiteId($storeId) { return $this->_storeManager->getStore($storeId)->getWebsiteId(); } + + /** + * Retrieve excluded attributes. + * + * @return array + */ + public function getExcludedAttributes(): array + { + return $this->_excludedAttributes; + } } From 976302de9187d12d9ed0b54e06de3ca8a6f37b24 Mon Sep 17 00:00:00 2001 From: Mateusz Krzeszowiak <mateusz.krzeszowiak@creativestyle.pl> Date: Tue, 26 Nov 2019 19:45:43 +0100 Subject: [PATCH 0135/1143] Cleanup, refactor and cover with tests section-config module --- .../view/frontend/web/js/section-config.js | 44 ++-- .../frontend/js/section-config.test.js | 206 ++++++++++++++++++ 2 files changed, 228 insertions(+), 22 deletions(-) create mode 100644 dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/section-config.test.js diff --git a/app/code/Magento/Customer/view/frontend/web/js/section-config.js b/app/code/Magento/Customer/view/frontend/web/js/section-config.js index d346d5b070729..60482e5fee260 100644 --- a/app/code/Magento/Customer/view/frontend/web/js/section-config.js +++ b/app/code/Magento/Customer/view/frontend/web/js/section-config.js @@ -6,64 +6,65 @@ define(['underscore'], function (_) { 'use strict'; - var baseUrls, sections, clientSideSections, sectionNames, canonize; + var baseUrls = [], + sections = [], + clientSideSections = [], + sectionNames = [], + canonize; /** * @param {String} url * @return {String} */ canonize = function (url) { - var route = url, - key; + var route = url; - for (key in baseUrls) { //eslint-disable-line guard-for-in - route = url.replace(baseUrls[key], ''); + _.some(baseUrls, function (baseUrl) { + route = url.replace(baseUrl, ''); - if (route != url) { //eslint-disable-line eqeqeq - break; - } - } + return route !== url; + }); return route.replace(/^\/?index.php\/?/, '').toLowerCase(); }; return { /** - * @param {String} url - * @return {Array} + * Returns a list of sections which should be invalidated for given URL. + * @param {String} url - URL which was requested. + * @return {Array} - List of sections to invalidate. */ getAffectedSections: function (url) { var route = canonize(url), actions = _.find(sections, function (val, section) { var matched; + // Covers the case where "*" works as a glob pattern. if (section.indexOf('*') >= 0) { section = section.replace(/\*/g, '[^/]+') + '$'; matched = route.match(section); - return matched && matched[0] == route; //eslint-disable-line eqeqeq + return matched && matched[0] === route; } return route.indexOf(section) === 0; }); - return _.union(_.toArray(actions), _.toArray(sections['*'])); + return _.union(actions, sections['*']); }, /** - * @param {*} allSections - * @return {*} + * Filters the list of given sections to the ones defined as client side. + * @param {Array} allSections - List of sections to check. + * @return {Array} - List of filtered sections. */ filterClientSideSections: function (allSections) { - if (Array.isArray(allSections)) { - return _.difference(allSections, clientSideSections); - } - - return allSections; + return _.difference(allSections, clientSideSections); }, /** - * @param {String} sectionName + * Tells if section is defined as client side. + * @param {String} sectionName - Name of the section to check. * @return {Boolean} */ isClientSideSection: function (sectionName) { @@ -72,7 +73,6 @@ define(['underscore'], function (_) { /** * Returns array of section names. - * * @returns {Array} */ getSectionNames: function () { diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/section-config.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/section-config.test.js new file mode 100644 index 0000000000000..56ed546e28f8c --- /dev/null +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/section-config.test.js @@ -0,0 +1,206 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +/* eslint max-nested-callbacks: 0 */ +define(['squire'], function (Squire) { + 'use strict'; + + var injector = new Squire(), + obj; + + beforeEach(function (done) { + // injector.mock(mocks); + injector.require(['Magento_Customer/js/section-config'], function (Constr) { + obj = Constr; + done(); + }); + }); + + afterEach(function () { + try { + injector.clean(); + injector.remove(); + } catch (e) {} + }); + + describe('Magento_Customer/js/section-config', function () { + describe('"getAffectedSections" method', function () { + it('Does not throw before component is initialized.', function () { + expect(function () { + obj.getAffectedSections('http://localhost.com/path'); + }).not.toThrow(); + }); + + it('Returns proper sections when URL contains base URL.', function () { + obj['Magento_Customer/js/section-config']({ + sections: { + 'path': [ + 'section' + ] + }, + baseUrls: [ + 'http://localhost.com/', + 'https://localhost.com/' + ] + }); + + expect(obj.getAffectedSections('https://localhost.com/path')).toEqual(['section']); + }); + + it('Returns proper sections when glob pattern is used at the end.', function () { + obj['Magento_Customer/js/section-config']({ + sections: { + 'path/*': [ + 'section' + ] + }, + baseUrls: [ + 'http://localhost.com/', + 'https://localhost.com/' + ] + }); + + expect(obj.getAffectedSections('https://localhost.com/path/subpath')).toEqual(['section']); + }); + + it('Returns proper sections when glob pattern is used inside.', function () { + obj['Magento_Customer/js/section-config']({ + sections: { + '*/subpath': [ + 'section' + ] + }, + baseUrls: [ + 'http://localhost.com/', + 'https://localhost.com/' + ] + }); + + expect(obj.getAffectedSections('https://localhost.com/path/subpath')).toEqual(['section']); + }); + + it('Strips "index.php" suffix from provided URL.', function () { + obj['Magento_Customer/js/section-config']({ + sections: { + 'path': [ + 'section' + ] + }, + baseUrls: [ + 'http://localhost.com/' + ] + }); + + expect(obj.getAffectedSections('http://localhost.com/path/index.php')).toEqual(['section']); + }); + + it('Adds sections for all URLs "*" to found ones.', function () { + obj['Magento_Customer/js/section-config']({ + sections: { + 'path': [ + 'section' + ], + '*': [ + 'all' + ] + }, + baseUrls: [ + 'http://localhost.com/' + ] + }); + + expect(obj.getAffectedSections('http://localhost.com/path')).toEqual(['section', 'all']); + }); + + it('Returns "*" sections for all URLs.', function () { + obj['Magento_Customer/js/section-config']({ + sections: { + '*': [ + 'all' + ] + }, + baseUrls: [ + 'http://localhost.com/' + ] + }); + + expect(obj.getAffectedSections('http://localhost.com/path')).toEqual(['all']); + }); + }); + + describe('"filterClientSideSections" method', function () { + it('Does not throw before component is initialized.', function () { + expect(function () { + obj.filterClientSideSections(); + }).not.toThrow(); + }); + + it('Returns empty array when all sections are client side.', function () { + var sections = ['test']; + + obj['Magento_Customer/js/section-config']({ + clientSideSections: sections + }); + expect(obj.filterClientSideSections(sections)).toEqual([]); + }); + + it('Filters out client side sections.', function () { + var allSections = ['test', 'client'], + clientSections = ['client']; + + obj['Magento_Customer/js/section-config']({ + clientSideSections: clientSections + }); + expect(obj.filterClientSideSections(allSections)).toEqual(['test']); + }); + }); + + describe('"isClientSideSection" method', function () { + it('Does not throw before component is initialized.', function () { + expect(function () { + obj.isClientSideSection(); + }).not.toThrow(); + }); + + it('Returns true if section is defined as client side.', function () { + obj['Magento_Customer/js/section-config']({ + clientSideSections: ['client'] + }); + expect(obj.isClientSideSection('client')).toBe(true); + }); + + it('Returns false if section is not defined as client side.', function () { + obj['Magento_Customer/js/section-config']({ + clientSideSections: ['client'] + }); + expect(obj.isClientSideSection('test')).toBe(false); + }); + + it('Returns false if section is not client side and sections are not defined.', function () { + obj['Magento_Customer/js/section-config']({ + clientSideSections: [] + }); + expect(obj.isClientSideSection('test')).toBe(false); + }); + }); + + describe('"getSectionNames" method', function () { + it('Does not throw before component is initialized.', function () { + expect(function () { + obj.getSectionNames(); + }).not.toThrow(); + }); + + it('Returns defined section names.', function () { + var sections = ['test']; + + obj['Magento_Customer/js/section-config']({ + sectionNames: sections + }); + expect(obj.getSectionNames()).toBe(sections); + }); + }); + }); +}); From 5d175a35f9b4f91fe94abe7dceb5155cb4fc54c3 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Wed, 27 Nov 2019 11:30:10 +0700 Subject: [PATCH 0136/1143] Resolve Export Coupon Code Grid redirect to DashBoard when create New Cart Price Rule issue24468 --- .../Promo/Quote/ExportCouponsCsv.php | 28 +++--- .../Promo/Quote/ExportCouponsXml.php | 30 +++---- .../Promo/Quote/ExportCouponsCsvTest.php | 87 ++++++++++++++++++ .../Promo/Quote/ExportCouponsXmlTest.php | 89 +++++++++++++++++++ 4 files changed, 206 insertions(+), 28 deletions(-) create mode 100644 app/code/Magento/SalesRule/Test/Unit/Controller/Adminhtml/Promo/Quote/ExportCouponsCsvTest.php create mode 100644 app/code/Magento/SalesRule/Test/Unit/Controller/Adminhtml/Promo/Quote/ExportCouponsXmlTest.php diff --git a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/ExportCouponsCsv.php b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/ExportCouponsCsv.php index 0f073ab4d65ce..513251ccbfe79 100644 --- a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/ExportCouponsCsv.php +++ b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/ExportCouponsCsv.php @@ -4,30 +4,32 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + +declare(strict_types=1); + namespace Magento\SalesRule\Controller\Adminhtml\Promo\Quote; use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\Controller\ResultFactory; +use Magento\SalesRule\Controller\Adminhtml\Promo\Quote; +use Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons\Grid; +use Magento\Framework\View\Result\Layout; +use Magento\Framework\App\ResponseInterface; -class ExportCouponsCsv extends \Magento\SalesRule\Controller\Adminhtml\Promo\Quote +class ExportCouponsCsv extends Quote { /** * Export coupon codes as CSV file * - * @return \Magento\Framework\App\ResponseInterface|null + * @return ResponseInterface|null */ public function execute() { $this->_initRule(); - $rule = $this->_coreRegistry->registry(\Magento\SalesRule\Model\RegistryConstants::CURRENT_SALES_RULE); - if ($rule->getId()) { - $fileName = 'coupon_codes.csv'; - $content = $this->_view->getLayout()->createBlock( - \Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons\Grid::class - )->getCsvFile(); - return $this->_fileFactory->create($fileName, $content, DirectoryList::VAR_DIR); - } else { - $this->_redirect('sales_rule/*/detail', ['_current' => true]); - return; - } + $fileName = 'coupon_codes.csv'; + /** @var Layout $resultLayout */ + $resultLayout = $this->resultFactory->create(ResultFactory::TYPE_LAYOUT); + $content = $resultLayout->getLayout()->createBlock(Grid::class)->getCsvFile(); + return $this->_fileFactory->create($fileName, $content, DirectoryList::VAR_DIR); } } diff --git a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/ExportCouponsXml.php b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/ExportCouponsXml.php index 35d81d3a971fc..c5c61748b4729 100644 --- a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/ExportCouponsXml.php +++ b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/ExportCouponsXml.php @@ -4,32 +4,32 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + +declare(strict_types=1); + namespace Magento\SalesRule\Controller\Adminhtml\Promo\Quote; use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\Controller\ResultFactory; +use Magento\SalesRule\Controller\Adminhtml\Promo\Quote; +use Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons\Grid; +use Magento\Framework\View\Result\Layout; +use Magento\Framework\App\ResponseInterface; -class ExportCouponsXml extends \Magento\SalesRule\Controller\Adminhtml\Promo\Quote +class ExportCouponsXml extends Quote { /** * Export coupon codes as excel xml file * - * @return \Magento\Framework\App\ResponseInterface|null + * @return ResponseInterface|null */ public function execute() { $this->_initRule(); - $rule = $this->_coreRegistry->registry(\Magento\SalesRule\Model\RegistryConstants::CURRENT_SALES_RULE); - if ($rule->getId()) { - $fileName = 'coupon_codes.xml'; - $content = $this->_view->getLayout()->createBlock( - \Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons\Grid::class - )->getExcelFile( - $fileName - ); - return $this->_fileFactory->create($fileName, $content, DirectoryList::VAR_DIR); - } else { - $this->_redirect('sales_rule/*/detail', ['_current' => true]); - return; - } + $fileName = 'coupon_codes.xml'; + /** @var Layout $resultLayout */ + $resultLayout = $this->resultFactory->create(ResultFactory::TYPE_LAYOUT); + $content = $resultLayout->getLayout()->createBlock(Grid::class)->getExcelFile($fileName); + return $this->_fileFactory->create($fileName, $content, DirectoryList::VAR_DIR); } } diff --git a/app/code/Magento/SalesRule/Test/Unit/Controller/Adminhtml/Promo/Quote/ExportCouponsCsvTest.php b/app/code/Magento/SalesRule/Test/Unit/Controller/Adminhtml/Promo/Quote/ExportCouponsCsvTest.php new file mode 100644 index 0000000000000..f3658ab52f8bb --- /dev/null +++ b/app/code/Magento/SalesRule/Test/Unit/Controller/Adminhtml/Promo/Quote/ExportCouponsCsvTest.php @@ -0,0 +1,87 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\SalesRule\Test\Unit\Controller\Adminhtml\Promo\Quote; + +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\SalesRule\Controller\Adminhtml\Promo\Quote\ExportCouponsCsv; +use Magento\Framework\Controller\ResultFactory; +use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\App\Response\Http\FileFactory; +use Magento\Framework\View\Result\Layout; +use Magento\Framework\View\LayoutInterface; +use Magento\Framework\View\Element\AbstractBlock; +use Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons\Grid; +use PHPUnit\Framework\TestCase; + +class ExportCouponsCsvTest extends TestCase +{ + /** + * @var ExportCouponsCsv + */ + private $controller; + + /** + * @var FileFactory|\PHPUnit_Framework_MockObject_MockObject + */ + private $fileFactoryMock; + + /** + * @var ObjectManagerHelper + */ + private $objectManagerHelper; + + /** + * @var ResultFactory|\PHPUnit_Framework_MockObject_MockObject + */ + private $resultFactoryMock; + + /** + * Setup environment + */ + protected function setUp() + { + $this->objectManagerHelper = new ObjectManagerHelper($this); + $this->fileFactoryMock = $this->createMock(FileFactory::class); + $this->resultFactoryMock = $this->createMock(ResultFactory::class); + + $this->controller = $this->objectManagerHelper->getObject( + ExportCouponsCsv::class, + [ + 'fileFactory' => $this->fileFactoryMock, + 'resultFactory' => $this->resultFactoryMock + ] + ); + } + + /** + * Test execute function + */ + public function testExecute() + { + $fileName = 'coupon_codes.csv'; + + $resultLayoutMock = $this->createMock(Layout::class); + $layoutMock = $this->createMock(LayoutInterface::class); + $contentMock = $this->createPartialMock(AbstractBlock::class, ['getCsvFile']); + $this->resultFactoryMock + ->expects($this->once()) + ->method('create') + ->with(ResultFactory::TYPE_LAYOUT)->willReturn($resultLayoutMock); + $resultLayoutMock->expects($this->once())->method('getLayout')->willReturn($layoutMock); + $layoutMock->expects($this->once())->method('createBlock')->with(Grid::class) + ->willReturn($contentMock); + $contentMock->expects($this->once())->method('getCsvFile')->willReturn('csvFile'); + $this->fileFactoryMock + ->expects($this->once()) + ->method('create') + ->with($fileName, 'csvFile', DirectoryList::VAR_DIR); + + $this->controller->execute(); + } +} diff --git a/app/code/Magento/SalesRule/Test/Unit/Controller/Adminhtml/Promo/Quote/ExportCouponsXmlTest.php b/app/code/Magento/SalesRule/Test/Unit/Controller/Adminhtml/Promo/Quote/ExportCouponsXmlTest.php new file mode 100644 index 0000000000000..83ad95171033f --- /dev/null +++ b/app/code/Magento/SalesRule/Test/Unit/Controller/Adminhtml/Promo/Quote/ExportCouponsXmlTest.php @@ -0,0 +1,89 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\SalesRule\Test\Unit\Controller\Adminhtml\Promo\Quote; + +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\SalesRule\Controller\Adminhtml\Promo\Quote\ExportCouponsXml; +use Magento\Framework\Controller\ResultFactory; +use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\App\Response\Http\FileFactory; +use Magento\Framework\View\Result\Layout; +use Magento\Framework\View\LayoutInterface; +use Magento\Framework\View\Element\AbstractBlock; +use Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons\Grid; +use PHPUnit\Framework\TestCase; + +class ExportCouponsXmlTest extends TestCase +{ + /** + * @var ExportCouponsXml + */ + private $controller; + + /** + * @var FileFactory|\PHPUnit_Framework_MockObject_MockObject + */ + private $fileFactoryMock; + + /** + * @var ObjectManagerHelper + */ + private $objectManagerHelper; + + /** + * @var ResultFactory|\PHPUnit_Framework_MockObject_MockObject + */ + private $resultFactoryMock; + + /** + * Setup environment + */ + protected function setUp() + { + $this->objectManagerHelper = new ObjectManagerHelper($this); + $this->fileFactoryMock = $this->createMock(FileFactory::class); + $this->resultFactoryMock = $this->createMock(ResultFactory::class); + + $this->controller = $this->objectManagerHelper->getObject( + ExportCouponsXml::class, + [ + 'fileFactory' => $this->fileFactoryMock, + 'resultFactory' => $this->resultFactoryMock + ] + ); + } + + /** + * Test execute function + */ + public function testExecute() + { + $fileName = 'coupon_codes.xml'; + + $resultLayoutMock = $this->createMock(Layout::class); + $layoutMock = $this->createMock(LayoutInterface::class); + $contentMock = $this->createPartialMock(AbstractBlock::class, ['getExcelFile']); + $this->resultFactoryMock + ->expects($this->once()) + ->method('create') + ->with(ResultFactory::TYPE_LAYOUT)->willReturn($resultLayoutMock); + $resultLayoutMock->expects($this->once())->method('getLayout')->willReturn($layoutMock); + $layoutMock->expects($this->once())->method('createBlock')->with(Grid::class) + ->willReturn($contentMock); + $contentMock->expects($this->once())->method('getExcelFile') + ->with($fileName) + ->willReturn('xmlFile'); + $this->fileFactoryMock + ->expects($this->once()) + ->method('create') + ->with($fileName, 'xmlFile', DirectoryList::VAR_DIR); + + $this->controller->execute(); + } +} From e2d6d58983a8a19d020dde8b2884c489d7939aef Mon Sep 17 00:00:00 2001 From: Ashna-Jahan <32352950+Ashna-Jahan@users.noreply.github.com> Date: Wed, 27 Nov 2019 11:42:33 +0530 Subject: [PATCH 0137/1143] Fixed Indentation Issues. --- .../web/css/source/forms/fields/_control-table.less | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less b/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less index 821ab04d8c44c..3ebb02e11ffa9 100644 --- a/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less +++ b/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less @@ -238,15 +238,13 @@ } } -@media only screen and (min-width: 768px) -{ - .product_form_product_form_advanced_pricing_modal .admin__fieldset > .admin__field > .admin__field-control{ +@media only screen and (min-width: 768px) { + .product_form_product_form_advanced_pricing_modal .admin__fieldset > .admin__field > .admin__field-control { min-width: 682px; - } - +} .admin__control-table-wrapper { max-width: 100% !important; overflow-x: visible !important; overflow-y: visible !important; } -} \ No newline at end of file +} From 853a1e58107d7b9f95b6e0cf07df9b81fe2dabd3 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Wed, 27 Nov 2019 13:20:51 +0700 Subject: [PATCH 0138/1143] Fix static test --- .../Adminhtml/Promo/Quote/ExportCouponsCsv.php | 9 +++++++-- .../Adminhtml/Promo/Quote/ExportCouponsXml.php | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/ExportCouponsCsv.php b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/ExportCouponsCsv.php index 513251ccbfe79..53459f2c3e52f 100644 --- a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/ExportCouponsCsv.php +++ b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/ExportCouponsCsv.php @@ -1,6 +1,5 @@ <?php /** - * * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ @@ -15,8 +14,14 @@ use Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons\Grid; use Magento\Framework\View\Result\Layout; use Magento\Framework\App\ResponseInterface; +use Magento\Framework\App\Action\HttpGetActionInterface; -class ExportCouponsCsv extends Quote +/** + * Export Coupons to csv file + * + * Class \Magento\SalesRule\Controller\Adminhtml\Promo\Quote\ExportCouponsCsv + */ +class ExportCouponsCsv extends Quote implements HttpGetActionInterface { /** * Export coupon codes as CSV file diff --git a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/ExportCouponsXml.php b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/ExportCouponsXml.php index c5c61748b4729..fa3d4455410c4 100644 --- a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/ExportCouponsXml.php +++ b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/ExportCouponsXml.php @@ -1,6 +1,5 @@ <?php /** - * * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ @@ -15,8 +14,14 @@ use Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons\Grid; use Magento\Framework\View\Result\Layout; use Magento\Framework\App\ResponseInterface; +use Magento\Framework\App\Action\HttpGetActionInterface; -class ExportCouponsXml extends Quote +/** + * Export coupons to xml file + * + * Class \Magento\SalesRule\Controller\Adminhtml\Promo\Quote\ExportCouponsXml + */ +class ExportCouponsXml extends Quote implements HttpGetActionInterface { /** * Export coupon codes as excel xml file From 4c0f128c7ccd8bf1642f1ab870b4380ab0821c41 Mon Sep 17 00:00:00 2001 From: Ashna-Jahan <32352950+Ashna-Jahan@users.noreply.github.com> Date: Wed, 27 Nov 2019 13:18:34 +0530 Subject: [PATCH 0139/1143] Fixed the issue with window resizing. --- .../css/source/forms/fields/_control-table.less | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less b/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less index 3ebb02e11ffa9..5b5f6682d027e 100644 --- a/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less +++ b/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less @@ -238,13 +238,13 @@ } } -@media only screen and (min-width: 768px) { - .product_form_product_form_advanced_pricing_modal .admin__fieldset > .admin__field > .admin__field-control { - min-width: 682px; +.product_form_product_form_advanced_pricing_modal .admin__fieldset > .admin__field > .admin__field-control { + min-width: 682px; } - .admin__control-table-wrapper { - max-width: 100% !important; - overflow-x: visible !important; - overflow-y: visible !important; - } + +.admin__control-table-wrapper { + max-width: 100% !important; + overflow-x: visible !important; + overflow-y: visible !important; } + From 2bd319ba7865fb65d57a0ffdcd4745e33b9387b0 Mon Sep 17 00:00:00 2001 From: Ashna-Jahan <32352950+Ashna-Jahan@users.noreply.github.com> Date: Wed, 27 Nov 2019 13:49:55 +0530 Subject: [PATCH 0140/1143] Remove the unwanted spaces. --- .../web/css/source/forms/fields/_control-table.less | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less b/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less index 5b5f6682d027e..b304ae1de4c5a 100644 --- a/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less +++ b/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less @@ -241,10 +241,10 @@ .product_form_product_form_advanced_pricing_modal .admin__fieldset > .admin__field > .admin__field-control { min-width: 682px; } - + .admin__control-table-wrapper { - max-width: 100% !important; - overflow-x: visible !important; - overflow-y: visible !important; + max-width: 100%; + overflow-x: visible; + overflow-y: visible; } From a738307bdf9ff9153deb96569f8e3363337b15d3 Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Wed, 27 Nov 2019 14:46:43 +0200 Subject: [PATCH 0141/1143] Refactoring Action Groups --- ...NavigateToNewRelicConfigurationActionGroup.xml | 15 +++++++++++++++ ...ToggleNewRelicReportingEnabledActionGroup.xml} | 2 +- ...nUncheckNewRelicUseSystemValueActionGroup.xml} | 2 +- ...ewRelicConfigFieldIsNotVisibleActionGroup.xml} | 2 +- ...inNewRelicConfigFieldIsVisibleActionGroup.xml} | 2 +- .../AdminChecksSystemConfigDependencyTest.xml | 10 +++++----- 6 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminNavigateToNewRelicConfigurationActionGroup.xml rename app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/{AdminTogglesEnabledConfigActionGroup.xml => AdminToggleNewRelicReportingEnabledActionGroup.xml} (88%) rename app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/{AdminUnchecksUseSystemValueActionGroup.xml => AdminUncheckNewRelicUseSystemValueActionGroup.xml} (86%) rename app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/{AssertAdminDoesntSeeConfigFieldActionGroup.xml => AssertAdminNewRelicConfigFieldIsNotVisibleActionGroup.xml} (86%) rename app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/{AssertAdminSeesConfigFieldActionGroup.xml => AssertAdminNewRelicConfigFieldIsVisibleActionGroup.xml} (87%) diff --git a/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminNavigateToNewRelicConfigurationActionGroup.xml b/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminNavigateToNewRelicConfigurationActionGroup.xml new file mode 100644 index 0000000000000..9e8314792b0bd --- /dev/null +++ b/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminNavigateToNewRelicConfigurationActionGroup.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminNavigateToNewRelicConfigurationActionGroup"> + <amOnPage url="{{AdminNewRelicConfigPage.url}}" stepKey="navigateToNewRelicConfigurationPage"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminTogglesEnabledConfigActionGroup.xml b/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminToggleNewRelicReportingEnabledActionGroup.xml similarity index 88% rename from app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminTogglesEnabledConfigActionGroup.xml rename to app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminToggleNewRelicReportingEnabledActionGroup.xml index f9632784f4a92..602484189dda4 100644 --- a/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminTogglesEnabledConfigActionGroup.xml +++ b/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminToggleNewRelicReportingEnabledActionGroup.xml @@ -8,7 +8,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AdminTogglesEnabledConfigActionGroup"> + <actionGroup name="AdminToggleNewRelicReportingEnabledActionGroup"> <arguments> <argument name="state" type="string"/> </arguments> diff --git a/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminUnchecksUseSystemValueActionGroup.xml b/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminUncheckNewRelicUseSystemValueActionGroup.xml similarity index 86% rename from app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminUnchecksUseSystemValueActionGroup.xml rename to app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminUncheckNewRelicUseSystemValueActionGroup.xml index 7d90c1d8dd478..31c57c680b2ef 100644 --- a/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminUnchecksUseSystemValueActionGroup.xml +++ b/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminUncheckNewRelicUseSystemValueActionGroup.xml @@ -8,7 +8,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AdminUnchecksUseSystemValueActionGroup"> + <actionGroup name="AdminUncheckNewRelicUseSystemValueActionGroup"> <uncheckOption selector="{{AdminNewRelicConfigSystemSection.useSystemValueForEnabled}}" stepKey="uncheckCheckbox"/> </actionGroup> </actionGroups> diff --git a/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AssertAdminDoesntSeeConfigFieldActionGroup.xml b/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AssertAdminNewRelicConfigFieldIsNotVisibleActionGroup.xml similarity index 86% rename from app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AssertAdminDoesntSeeConfigFieldActionGroup.xml rename to app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AssertAdminNewRelicConfigFieldIsNotVisibleActionGroup.xml index 6e87dbbfbbf4b..1c347512c1737 100644 --- a/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AssertAdminDoesntSeeConfigFieldActionGroup.xml +++ b/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AssertAdminNewRelicConfigFieldIsNotVisibleActionGroup.xml @@ -8,7 +8,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AssertAdminDoesntSeeConfigFieldActionGroup"> + <actionGroup name="AssertAdminNewRelicConfigFieldIsNotVisibleActionGroup"> <arguments> <argument name="config" type="string"/> </arguments> diff --git a/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AssertAdminSeesConfigFieldActionGroup.xml b/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AssertAdminNewRelicConfigFieldIsVisibleActionGroup.xml similarity index 87% rename from app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AssertAdminSeesConfigFieldActionGroup.xml rename to app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AssertAdminNewRelicConfigFieldIsVisibleActionGroup.xml index 4df7099e50b28..fd3b3e47719c0 100644 --- a/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AssertAdminSeesConfigFieldActionGroup.xml +++ b/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AssertAdminNewRelicConfigFieldIsVisibleActionGroup.xml @@ -8,7 +8,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AssertAdminSeesConfigFieldActionGroup"> + <actionGroup name="AssertAdminNewRelicConfigFieldIsVisibleActionGroup"> <arguments> <argument name="config" type="string"/> </arguments> diff --git a/app/code/Magento/NewRelicReporting/Test/Mftf/Test/AdminChecksSystemConfigDependencyTest.xml b/app/code/Magento/NewRelicReporting/Test/Mftf/Test/AdminChecksSystemConfigDependencyTest.xml index eabacffe9b181..676d1dcacf75f 100644 --- a/app/code/Magento/NewRelicReporting/Test/Mftf/Test/AdminChecksSystemConfigDependencyTest.xml +++ b/app/code/Magento/NewRelicReporting/Test/Mftf/Test/AdminChecksSystemConfigDependencyTest.xml @@ -20,21 +20,21 @@ <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <actionGroup ref="AdminNavigateToNewRelicConfigurationActionGroup" stepKey="goToConfigPage"/> - <actionGroup ref="AdminExpandNewRelicConfigTabActionGroup" stepKey="expandGeneralTab"> + <actionGroup ref="AdminExpandNewRelicConfigTabActionGroup" stepKey="expandingGeneralTab"> <argument name="tabName" value="general"/> </actionGroup> </before> <after> <actionGroup ref="logout" stepKey="logoutOfAdmin"/> </after> - <actionGroup ref="AssertAdminDontSeeConfigFieldActionGroup" stepKey="checkIfApiUrlIsNotVisible"> + <actionGroup ref="AssertAdminNewRelicConfigFieldIsNotVisibleActionGroup" stepKey="checkingIfApiUrlIsNotVisible"> <argument name="config" value="{{AdminNewRelicConfigSystemSection.apiUrl}}"/> </actionGroup> - <actionGroup ref="AdminUnchecksUseSystemValueActionGroup" stepKey="uncheckUseSystemValue"/> - <actionGroup ref="AdminTogglesEnabledConfigActionGroup" stepKey="enableNewRelic"> + <actionGroup ref="AdminUncheckNewRelicUseSystemValueActionGroup" stepKey="uncheckUseSystemValue"/> + <actionGroup ref="AdminToggleNewRelicReportingEnabledActionGroup" stepKey="enablingNewRelicReporting"> <argument name="state" value="Yes"/> </actionGroup> - <actionGroup ref="AssertAdminSeesConfigFieldActionGroup" stepKey="checkIfApiUrlIsVisible"> + <actionGroup ref="AssertAdminNewRelicConfigFieldIsVisibleActionGroup" stepKey="checkingIfApiUrlIsVisible"> <argument name="config" value="{{AdminNewRelicConfigSystemSection.apiUrl}}"/> </actionGroup> </test> From 9a3d147d9947e83a9af80453acdcf07207449076 Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Wed, 27 Nov 2019 22:10:39 +0200 Subject: [PATCH 0142/1143] Refactoring the test coverage --- .../AdminExpandConfigSectionActionGroup.xml | 22 +++++++++++++++++++ .../Test/Mftf/Section/AdminConfigSection.xml | 3 +++ ...dminExpandNewRelicConfigTabActionGroup.xml | 17 -------------- ...checkNewRelicUseSystemValueActionGroup.xml | 8 +++++-- .../AdminNewRelicConfigSystemSection.xml | 3 +-- ...eckNewRelicSystemConfigDependencyTest.xml} | 12 +++++----- 6 files changed, 39 insertions(+), 26 deletions(-) create mode 100644 app/code/Magento/Config/Test/Mftf/ActionGroup/AdminExpandConfigSectionActionGroup.xml delete mode 100644 app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminExpandNewRelicConfigTabActionGroup.xml rename app/code/Magento/NewRelicReporting/Test/Mftf/Test/{AdminChecksSystemConfigDependencyTest.xml => AdminCheckNewRelicSystemConfigDependencyTest.xml} (78%) diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/AdminExpandConfigSectionActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/AdminExpandConfigSectionActionGroup.xml new file mode 100644 index 0000000000000..03a3a45ef0947 --- /dev/null +++ b/app/code/Magento/Config/Test/Mftf/ActionGroup/AdminExpandConfigSectionActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminExpandConfigSectionActionGroup"> + <annotations> + <description>Expands configuration section passed via argument as Section Name.</description> + </annotations> + <arguments> + <argument name="sectionName" type="string"/> + </arguments> + + <conditionalClick selector="{{AdminConfigSection.collapsibleSectionByTitle(sectionName)}}" dependentSelector="{{AdminConfigSection.expandedSectionByTitle(sectionName)}}" visible="false" stepKey="expandSection" /> + <waitForElement selector="{{AdminConfigSection.expandedSectionByTitle(sectionName)}}" stepKey="waitOpenedSection"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Config/Test/Mftf/Section/AdminConfigSection.xml b/app/code/Magento/Config/Test/Mftf/Section/AdminConfigSection.xml index ffe3f0076ca8d..3bad136935734 100644 --- a/app/code/Magento/Config/Test/Mftf/Section/AdminConfigSection.xml +++ b/app/code/Magento/Config/Test/Mftf/Section/AdminConfigSection.xml @@ -19,5 +19,8 @@ <element name="defaultConfigButton" type="button" selector="#store-change-button" timeout="30"/> <element name="defaultConfigDropdown" type="button" selector="//ul[@class='dropdown-menu']" timeout="30"/> <element name="fieldError" type="text" selector="label.mage-error"/> + <element name="useSystemValue" type="checkbox" selector="#{{element}} > .use-default > input" parameterized="true"/> + <element name="collapsibleSectionByTitle" type="text" selector="//form[@id='config-edit-form']//div[@class='section-config'][contains(.,'{{sectionTitle}}')]" parameterized="true" /> + <element name="expandedSectionByTitle" type="text" selector="//form[@id='config-edit-form']//div[@class='section-config active'][contains(.,'{{sectionTitle}}')]" parameterized="true" /> </section> </sections> diff --git a/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminExpandNewRelicConfigTabActionGroup.xml b/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminExpandNewRelicConfigTabActionGroup.xml deleted file mode 100644 index 4dc3d2ea8ea34..0000000000000 --- a/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminExpandNewRelicConfigTabActionGroup.xml +++ /dev/null @@ -1,17 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AdminExpandNewRelicConfigTabActionGroup"> - <arguments> - <argument name="tabName" type="string"/> - </arguments> - <conditionalClick selector="{{AdminNewRelicConfigSystemSection.tab(tabName)}}" dependentSelector="{{AdminNewRelicConfigSystemSection.status}}" visible="false" stepKey="expandTab"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminUncheckNewRelicUseSystemValueActionGroup.xml b/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminUncheckNewRelicUseSystemValueActionGroup.xml index 31c57c680b2ef..41f18f0f90d8d 100644 --- a/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminUncheckNewRelicUseSystemValueActionGroup.xml +++ b/app/code/Magento/NewRelicReporting/Test/Mftf/ActionGroup/AdminUncheckNewRelicUseSystemValueActionGroup.xml @@ -8,7 +8,11 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AdminUncheckNewRelicUseSystemValueActionGroup"> - <uncheckOption selector="{{AdminNewRelicConfigSystemSection.useSystemValueForEnabled}}" stepKey="uncheckCheckbox"/> + <actionGroup name="AdminUncheckUseSystemValueActionGroup"> + <arguments> + <argument name="rowId" type="string"/> + </arguments> + + <uncheckOption selector="{{AdminConfigSection.useSystemValue(rowId)}}" stepKey="uncheckCheckbox"/> </actionGroup> </actionGroups> diff --git a/app/code/Magento/NewRelicReporting/Test/Mftf/Section/AdminNewRelicConfigSystemSection.xml b/app/code/Magento/NewRelicReporting/Test/Mftf/Section/AdminNewRelicConfigSystemSection.xml index 79625273b988e..8cecf62999bc3 100644 --- a/app/code/Magento/NewRelicReporting/Test/Mftf/Section/AdminNewRelicConfigSystemSection.xml +++ b/app/code/Magento/NewRelicReporting/Test/Mftf/Section/AdminNewRelicConfigSystemSection.xml @@ -9,9 +9,8 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminNewRelicConfigSystemSection"> - <element name="tab" type="button" selector="#newrelicreporting_{{tab}}-head" parameterized="true"/> + <element name="statusRowId" type="text" selector="#row_newrelicreporting_general_enable"/> <element name="status" type="select" selector="#row_newrelicreporting_general_enable [data-ui-id='select-groups-general-fields-enable-value']"/> - <element name="useSystemValueForEnabled" type="checkbox" selector="#newrelicreporting_general_enable_inherit"/> <element name="apiUrl" type="select" selector="input#newrelicreporting_general_api_url"/> </section> </sections> diff --git a/app/code/Magento/NewRelicReporting/Test/Mftf/Test/AdminChecksSystemConfigDependencyTest.xml b/app/code/Magento/NewRelicReporting/Test/Mftf/Test/AdminCheckNewRelicSystemConfigDependencyTest.xml similarity index 78% rename from app/code/Magento/NewRelicReporting/Test/Mftf/Test/AdminChecksSystemConfigDependencyTest.xml rename to app/code/Magento/NewRelicReporting/Test/Mftf/Test/AdminCheckNewRelicSystemConfigDependencyTest.xml index 676d1dcacf75f..c343f93de2c58 100644 --- a/app/code/Magento/NewRelicReporting/Test/Mftf/Test/AdminChecksSystemConfigDependencyTest.xml +++ b/app/code/Magento/NewRelicReporting/Test/Mftf/Test/AdminCheckNewRelicSystemConfigDependencyTest.xml @@ -8,20 +8,20 @@ <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> - <test name="AdminChecksSystemConfigDependencyTest"> + <test name="AdminCheckNewRelicSystemConfigDependencyTest"> <annotations> <features value="NewRelicReporting"/> <stories value="Admin is able to see the configuration fields only after enabling the feature"/> <title value="Admin can see the configuration fields only after enabling the feature"/> <description value="The system configs should be available only after enabling the New Relic feature."/> - <severity value="CRITICAL"/> + <severity value="MINOR"/> <group value="NewRelicReporting"/> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <actionGroup ref="AdminNavigateToNewRelicConfigurationActionGroup" stepKey="goToConfigPage"/> - <actionGroup ref="AdminExpandNewRelicConfigTabActionGroup" stepKey="expandingGeneralTab"> - <argument name="tabName" value="general"/> + <actionGroup ref="AdminExpandConfigSectionActionGroup" stepKey="expandingGeneralSection"> + <argument name="sectionName" value="General"/> </actionGroup> </before> <after> @@ -30,7 +30,9 @@ <actionGroup ref="AssertAdminNewRelicConfigFieldIsNotVisibleActionGroup" stepKey="checkingIfApiUrlIsNotVisible"> <argument name="config" value="{{AdminNewRelicConfigSystemSection.apiUrl}}"/> </actionGroup> - <actionGroup ref="AdminUncheckNewRelicUseSystemValueActionGroup" stepKey="uncheckUseSystemValue"/> + <actionGroup ref="AdminUncheckUseSystemValueActionGroup" stepKey="uncheckUseSystemValue"> + <argument name="rowId" value="row_newrelicreporting_general_enable"/> + </actionGroup> <actionGroup ref="AdminToggleNewRelicReportingEnabledActionGroup" stepKey="enablingNewRelicReporting"> <argument name="state" value="Yes"/> </actionGroup> From d504f549ba789758a6ce271b23e63ab058611043 Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Wed, 27 Nov 2019 22:12:39 +0200 Subject: [PATCH 0143/1143] Refactoring the test coverage --- .../Test/Mftf/Section/AdminNewRelicConfigSystemSection.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/Magento/NewRelicReporting/Test/Mftf/Section/AdminNewRelicConfigSystemSection.xml b/app/code/Magento/NewRelicReporting/Test/Mftf/Section/AdminNewRelicConfigSystemSection.xml index 8cecf62999bc3..5bf849cd0134e 100644 --- a/app/code/Magento/NewRelicReporting/Test/Mftf/Section/AdminNewRelicConfigSystemSection.xml +++ b/app/code/Magento/NewRelicReporting/Test/Mftf/Section/AdminNewRelicConfigSystemSection.xml @@ -9,8 +9,7 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminNewRelicConfigSystemSection"> - <element name="statusRowId" type="text" selector="#row_newrelicreporting_general_enable"/> <element name="status" type="select" selector="#row_newrelicreporting_general_enable [data-ui-id='select-groups-general-fields-enable-value']"/> - <element name="apiUrl" type="select" selector="input#newrelicreporting_general_api_url"/> + <element name="apiUrl" type="input" selector="input#newrelicreporting_general_api_url"/> </section> </sections> From f78f0c1da3f770d2fc2128b5ec846bfadb1509e8 Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Wed, 27 Nov 2019 22:23:25 +0200 Subject: [PATCH 0144/1143] Renaming the selector --- .../Magento/Config/Test/Mftf/Section/AdminConfigSection.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Config/Test/Mftf/Section/AdminConfigSection.xml b/app/code/Magento/Config/Test/Mftf/Section/AdminConfigSection.xml index 3bad136935734..a4fb3c7e32975 100644 --- a/app/code/Magento/Config/Test/Mftf/Section/AdminConfigSection.xml +++ b/app/code/Magento/Config/Test/Mftf/Section/AdminConfigSection.xml @@ -19,7 +19,7 @@ <element name="defaultConfigButton" type="button" selector="#store-change-button" timeout="30"/> <element name="defaultConfigDropdown" type="button" selector="//ul[@class='dropdown-menu']" timeout="30"/> <element name="fieldError" type="text" selector="label.mage-error"/> - <element name="useSystemValue" type="checkbox" selector="#{{element}} > .use-default > input" parameterized="true"/> + <element name="useSystemValue" type="checkbox" selector="#{{configRowId}} > .use-default > input" parameterized="true"/> <element name="collapsibleSectionByTitle" type="text" selector="//form[@id='config-edit-form']//div[@class='section-config'][contains(.,'{{sectionTitle}}')]" parameterized="true" /> <element name="expandedSectionByTitle" type="text" selector="//form[@id='config-edit-form']//div[@class='section-config active'][contains(.,'{{sectionTitle}}')]" parameterized="true" /> </section> From a1c3ade9d7afa02049f124b25c034c91733a626b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 28 Nov 2019 10:46:26 +0100 Subject: [PATCH 0145/1143] REFACTOR: Extract Action Groups to separate files (according to MFTF best practices) --- .../ActionGroup/CreateBackupActionGroup.xml | 64 ------------------- .../CreateDatabaseBackupActionGroup.xml | 28 ++++++++ .../CreateMediaBackupActionGroup.xml | 28 ++++++++ .../CreateSystemBackupActionGroup.xml | 28 ++++++++ .../Test/AdminCreateAndDeleteBackupsTest.xml | 6 +- 5 files changed, 87 insertions(+), 67 deletions(-) delete mode 100644 app/code/Magento/Backup/Test/Mftf/ActionGroup/CreateBackupActionGroup.xml create mode 100644 app/code/Magento/Backup/Test/Mftf/ActionGroup/CreateDatabaseBackupActionGroup.xml create mode 100644 app/code/Magento/Backup/Test/Mftf/ActionGroup/CreateMediaBackupActionGroup.xml create mode 100644 app/code/Magento/Backup/Test/Mftf/ActionGroup/CreateSystemBackupActionGroup.xml diff --git a/app/code/Magento/Backup/Test/Mftf/ActionGroup/CreateBackupActionGroup.xml b/app/code/Magento/Backup/Test/Mftf/ActionGroup/CreateBackupActionGroup.xml deleted file mode 100644 index cc7691752c62e..0000000000000 --- a/app/code/Magento/Backup/Test/Mftf/ActionGroup/CreateBackupActionGroup.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. - */ ---> - -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="createSystemBackup"> - <annotations> - <description>Creates a System Backup using provided Backup Entity.</description> - </annotations> - <arguments> - <argument name="backup" defaultValue="SystemBackup"/> - </arguments> - - <click selector="{{AdminMainActionsSection.systemBackup}}" stepKey="clickCreateBackupButton"/> - <waitForElementVisible selector="{{AdminCreateBackupFormSection.backupNameField}}" stepKey="waitForForm"/> - <fillField selector="{{AdminCreateBackupFormSection.backupNameField}}" userInput="{{backup.name}}" stepKey="fillBackupName"/> - <click selector="{{AdminCreateBackupFormSection.ok}}" stepKey="clickOk"/> - <waitForElementNotVisible selector=".loading-mask" time="300" stepKey="waitForBackupProcess"/> - <see selector="{{AdminMessagesSection.success}}" userInput="You created the system backup." stepKey="seeSuccessMessage"/> - <see selector="{{AdminGridTableSection.backupNameColumn}}" userInput="{{backup.name}}" stepKey="seeBackupInGrid"/> - <see selector="{{AdminGridTableSection.backupTypeByName(backup.name)}}" userInput="{{backup.type}}" stepKey="seeBackupType"/> - </actionGroup> - - <actionGroup name="createMediaBackup"> - <annotations> - <description>Creates a Media Backup using provided Backup Entity.</description> - </annotations> - <arguments> - <argument name="backup" defaultValue="MediaBackup"/> - </arguments> - - <click selector="{{AdminMainActionsSection.mediaBackup}}" stepKey="clickCreateBackupButton"/> - <waitForElementVisible selector="{{AdminCreateBackupFormSection.backupNameField}}" stepKey="waitForForm"/> - <fillField selector="{{AdminCreateBackupFormSection.backupNameField}}" userInput="{{backup.name}}" stepKey="fillBackupName"/> - <click selector="{{AdminCreateBackupFormSection.ok}}" stepKey="clickOk"/> - <waitForPageLoad time="120" stepKey="waitForBackupProcess"/> - <see selector="{{AdminMessagesSection.success}}" userInput="You created the database and media backup." stepKey="seeSuccessMessage"/> - <see selector="{{AdminGridTableSection.backupNameColumn}}" userInput="{{backup.name}}" stepKey="seeBackupInGrid"/> - <see selector="{{AdminGridTableSection.backupTypeByName(backup.name)}}" userInput="{{backup.type}}" stepKey="seeBackupType"/> - </actionGroup> - - <actionGroup name="createDatabaseBackup"> - <annotations> - <description>Creates a Database Backup using provided Backup Entity.</description> - </annotations> - <arguments> - <argument name="backup" defaultValue="DatabaseBackup"/> - </arguments> - - <click selector="{{AdminMainActionsSection.databaseBackup}}" stepKey="clickCreateBackupButton"/> - <waitForElementVisible selector="{{AdminCreateBackupFormSection.backupNameField}}" stepKey="waitForForm"/> - <fillField selector="{{AdminCreateBackupFormSection.backupNameField}}" userInput="{{backup.name}}" stepKey="fillBackupName"/> - <click selector="{{AdminCreateBackupFormSection.ok}}" stepKey="clickOk"/> - <waitForPageLoad time="120" stepKey="waitForBackupProcess"/> - <see selector="{{AdminMessagesSection.success}}" userInput="You created the database backup." stepKey="seeSuccessMessage"/> - <see selector="{{AdminGridTableSection.backupNameColumn}}" userInput="{{backup.name}}" stepKey="seeBackupInGrid"/> - <see selector="{{AdminGridTableSection.backupTypeByName(backup.name)}}" userInput="{{backup.type}}" stepKey="seeBackupType"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Backup/Test/Mftf/ActionGroup/CreateDatabaseBackupActionGroup.xml b/app/code/Magento/Backup/Test/Mftf/ActionGroup/CreateDatabaseBackupActionGroup.xml new file mode 100644 index 0000000000000..5d4e4a19509ea --- /dev/null +++ b/app/code/Magento/Backup/Test/Mftf/ActionGroup/CreateDatabaseBackupActionGroup.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="createDatabaseBackup"> + <annotations> + <description>Creates a Database Backup using provided Backup Entity.</description> + </annotations> + <arguments> + <argument name="backup" defaultValue="DatabaseBackup"/> + </arguments> + + <click selector="{{AdminMainActionsSection.databaseBackup}}" stepKey="clickCreateBackupButton"/> + <waitForElementVisible selector="{{AdminCreateBackupFormSection.backupNameField}}" stepKey="waitForForm"/> + <fillField selector="{{AdminCreateBackupFormSection.backupNameField}}" userInput="{{backup.name}}" stepKey="fillBackupName"/> + <click selector="{{AdminCreateBackupFormSection.ok}}" stepKey="clickOk"/> + <waitForPageLoad time="120" stepKey="waitForBackupProcess"/> + <see selector="{{AdminMessagesSection.success}}" userInput="You created the database backup." stepKey="seeSuccessMessage"/> + <see selector="{{AdminGridTableSection.backupNameColumn}}" userInput="{{backup.name}}" stepKey="seeBackupInGrid"/> + <see selector="{{AdminGridTableSection.backupTypeByName(backup.name)}}" userInput="{{backup.type}}" stepKey="seeBackupType"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Backup/Test/Mftf/ActionGroup/CreateMediaBackupActionGroup.xml b/app/code/Magento/Backup/Test/Mftf/ActionGroup/CreateMediaBackupActionGroup.xml new file mode 100644 index 0000000000000..ffa66ae230c04 --- /dev/null +++ b/app/code/Magento/Backup/Test/Mftf/ActionGroup/CreateMediaBackupActionGroup.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateMediaBackupActionGroup"> + <annotations> + <description>Creates a Media Backup using provided Backup Entity.</description> + </annotations> + <arguments> + <argument name="backup" defaultValue="MediaBackup"/> + </arguments> + + <click selector="{{AdminMainActionsSection.mediaBackup}}" stepKey="clickCreateBackupButton"/> + <waitForElementVisible selector="{{AdminCreateBackupFormSection.backupNameField}}" stepKey="waitForForm"/> + <fillField selector="{{AdminCreateBackupFormSection.backupNameField}}" userInput="{{backup.name}}" stepKey="fillBackupName"/> + <click selector="{{AdminCreateBackupFormSection.ok}}" stepKey="clickOk"/> + <waitForPageLoad time="120" stepKey="waitForBackupProcess"/> + <see selector="{{AdminMessagesSection.success}}" userInput="You created the database and media backup." stepKey="seeSuccessMessage"/> + <see selector="{{AdminGridTableSection.backupNameColumn}}" userInput="{{backup.name}}" stepKey="seeBackupInGrid"/> + <see selector="{{AdminGridTableSection.backupTypeByName(backup.name)}}" userInput="{{backup.type}}" stepKey="seeBackupType"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Backup/Test/Mftf/ActionGroup/CreateSystemBackupActionGroup.xml b/app/code/Magento/Backup/Test/Mftf/ActionGroup/CreateSystemBackupActionGroup.xml new file mode 100644 index 0000000000000..ca4f7ad1544df --- /dev/null +++ b/app/code/Magento/Backup/Test/Mftf/ActionGroup/CreateSystemBackupActionGroup.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateSystemBackupActionGroup"> + <annotations> + <description>Creates a System Backup using provided Backup Entity.</description> + </annotations> + <arguments> + <argument name="backup" defaultValue="SystemBackup"/> + </arguments> + + <click selector="{{AdminMainActionsSection.systemBackup}}" stepKey="clickCreateBackupButton"/> + <waitForElementVisible selector="{{AdminCreateBackupFormSection.backupNameField}}" stepKey="waitForForm"/> + <fillField selector="{{AdminCreateBackupFormSection.backupNameField}}" userInput="{{backup.name}}" stepKey="fillBackupName"/> + <click selector="{{AdminCreateBackupFormSection.ok}}" stepKey="clickOk"/> + <waitForElementNotVisible selector=".loading-mask" time="300" stepKey="waitForBackupProcess"/> + <see selector="{{AdminMessagesSection.success}}" userInput="You created the system backup." stepKey="seeSuccessMessage"/> + <see selector="{{AdminGridTableSection.backupNameColumn}}" userInput="{{backup.name}}" stepKey="seeBackupInGrid"/> + <see selector="{{AdminGridTableSection.backupTypeByName(backup.name)}}" userInput="{{backup.type}}" stepKey="seeBackupType"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Backup/Test/Mftf/Test/AdminCreateAndDeleteBackupsTest.xml b/app/code/Magento/Backup/Test/Mftf/Test/AdminCreateAndDeleteBackupsTest.xml index 26f8817c0a1bb..778c6d5112b6a 100644 --- a/app/code/Magento/Backup/Test/Mftf/Test/AdminCreateAndDeleteBackupsTest.xml +++ b/app/code/Magento/Backup/Test/Mftf/Test/AdminCreateAndDeleteBackupsTest.xml @@ -30,13 +30,13 @@ <waitForPageLoad stepKey="waitForBackupPage"/> <!--Create system backup--> - <actionGroup ref="createSystemBackup" stepKey="createSystemBackup"/> + <actionGroup ref="CreateSystemBackupActionGroup" stepKey="createSystemBackup"/> <!--Create database/media backup--> - <actionGroup ref="createMediaBackup" stepKey="createMediaBackup"/> + <actionGroup ref="CreateMediaBackupActionGroup" stepKey="createMediaBackup"/> <!--Create database backup--> - <actionGroup ref="createDatabaseBackup" stepKey="createDatabaseBackup"/> + <actionGroup ref="CreateDatabaseBackupActionGroup" stepKey="createDatabaseBackup"/> <!--Delete system backup--> <actionGroup ref="deleteBackup" stepKey="deleteSystemBackup"> From 31e35c68f0a02a10a77ce0069acfec6ca1b1ba2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 28 Nov 2019 10:55:34 +0100 Subject: [PATCH 0146/1143] REFACTOR: Extract Action Groups to separate files (according to MFTF best practices) --- .../AdminCreateNewRoleActionGroup.xml | 32 ++++++++++ ...oup.xml => AdminCreateUserActionGroup.xml} | 15 +---- .../AdminDeleteRoleActionGroup.xml | 27 ++++++++ .../Mftf/ActionGroup/AdminRoleActionGroup.xml | 62 ------------------- .../ConfigureBraintreeActionGroup.xml | 11 +--- .../DisableBraintreeActionGroup.xml | 19 ++++++ .../ActionGroup/GoToAllUsersActionGroup.xml | 21 +++++++ .../ActionGroup/GoToUserRolesActionGroup.xml | 21 +++++++ ...AnAdminOrderUsingBraintreePaymentTest1.xml | 14 ++--- 9 files changed, 129 insertions(+), 93 deletions(-) create mode 100644 app/code/Magento/Braintree/Test/Mftf/ActionGroup/AdminCreateNewRoleActionGroup.xml rename app/code/Magento/Braintree/Test/Mftf/ActionGroup/{AdminUserActionGroup.xml => AdminCreateUserActionGroup.xml} (77%) create mode 100644 app/code/Magento/Braintree/Test/Mftf/ActionGroup/AdminDeleteRoleActionGroup.xml delete mode 100644 app/code/Magento/Braintree/Test/Mftf/ActionGroup/AdminRoleActionGroup.xml create mode 100644 app/code/Magento/Braintree/Test/Mftf/ActionGroup/DisableBraintreeActionGroup.xml create mode 100644 app/code/Magento/Braintree/Test/Mftf/ActionGroup/GoToAllUsersActionGroup.xml create mode 100644 app/code/Magento/Braintree/Test/Mftf/ActionGroup/GoToUserRolesActionGroup.xml diff --git a/app/code/Magento/Braintree/Test/Mftf/ActionGroup/AdminCreateNewRoleActionGroup.xml b/app/code/Magento/Braintree/Test/Mftf/ActionGroup/AdminCreateNewRoleActionGroup.xml new file mode 100644 index 0000000000000..29000563ee87f --- /dev/null +++ b/app/code/Magento/Braintree/Test/Mftf/ActionGroup/AdminCreateNewRoleActionGroup.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateNewRoleActionGroup"> + <annotations> + <description>Creates a User Role using the provided Data.</description> + </annotations> + <arguments> + <argument name="role" type="string" defaultValue=""/> + <argument name="resource" type="string" defaultValue="All"/> + <argument name="scope" type="string" defaultValue="Custom"/> + <argument name="websites" type="string" defaultValue="Main Website"/> + </arguments> + + <click selector="{{AdminCreateRoleSection.create}}" stepKey="clickToAddNewRole"/> + <fillField selector="{{AdminCreateRoleSection.name}}" userInput="{{role.name}}" stepKey="setRoleName"/> + <fillField stepKey="setPassword" selector="{{AdminCreateRoleSection.password}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}"/> + <click selector="{{AdminCreateRoleSection.roleResources}}" stepKey="clickToOpenRoleResources"/> + <waitForPageLoad stepKey="waitForRoleResourcePage" time="5"/> + <click stepKey="checkSales" selector="//a[text()='Sales']"/> + <click selector="{{AdminCreateRoleSection.save}}" stepKey="clickToSaveRole"/> + <waitForPageLoad stepKey="waitForPageLoad" time="10"/> + <see userInput="You saved the role." stepKey="seeSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Braintree/Test/Mftf/ActionGroup/AdminUserActionGroup.xml b/app/code/Magento/Braintree/Test/Mftf/ActionGroup/AdminCreateUserActionGroup.xml similarity index 77% rename from app/code/Magento/Braintree/Test/Mftf/ActionGroup/AdminUserActionGroup.xml rename to app/code/Magento/Braintree/Test/Mftf/ActionGroup/AdminCreateUserActionGroup.xml index 78e0db6bc44ee..82491f6362573 100644 --- a/app/code/Magento/Braintree/Test/Mftf/ActionGroup/AdminUserActionGroup.xml +++ b/app/code/Magento/Braintree/Test/Mftf/ActionGroup/AdminCreateUserActionGroup.xml @@ -7,20 +7,7 @@ --> <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <!--Go to all users--> - <actionGroup name="GoToAllUsers"> - <annotations> - <description>Navigate to the Users page via Backend Admin Side Menu. PLEASE NOTE: Use the amOnPage action instead.</description> - </annotations> - - <click selector="{{AdminCreateUserSection.system}}" stepKey="clickOnSystemIcon"/> - <waitForPageLoad stepKey="waitForSystemsPageToOpen"/> - <click selector="{{AdminCreateUserSection.allUsers}}" stepKey="clickToSelectUserRoles"/> - <waitForPageLoad stepKey="waitForUserRolesPageToOpen"/> - </actionGroup> - - <!--Create new user with specified role--> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="AdminCreateUserAction"> <annotations> <description>Creates a User using the NewAdmin User Entity and User Role Entity. PLEASE NOTE: The Action Group values are Hardcoded.</description> diff --git a/app/code/Magento/Braintree/Test/Mftf/ActionGroup/AdminDeleteRoleActionGroup.xml b/app/code/Magento/Braintree/Test/Mftf/ActionGroup/AdminDeleteRoleActionGroup.xml new file mode 100644 index 0000000000000..9ee3c79d1288e --- /dev/null +++ b/app/code/Magento/Braintree/Test/Mftf/ActionGroup/AdminDeleteRoleActionGroup.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminDeleteRoleActionGroup"> + <annotations> + <description>Deletes a User Role that contains the text 'Role'. PLEASE NOTE: The Action Group values are Hardcoded.</description> + </annotations> + <arguments> + <argument name="role" defaultValue=""/> + </arguments> + + <click stepKey="clickOnRole" selector="{{AdminDeleteRoleSection.theRole}}"/> + <fillField stepKey="TypeCurrentPassword" selector="{{AdminDeleteRoleSection.current_pass}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}"/> + <click stepKey="clickToDeleteRole" selector="{{AdminDeleteRoleSection.delete}}"/> + <waitForAjaxLoad stepKey="waitForDeleteConfirmationPopup" time="5"/> + <click stepKey="clickToConfirm" selector="{{AdminDeleteRoleSection.confirm}}"/> + <waitForPageLoad stepKey="waitForPageLoad" time="10"/> + <see stepKey="seeSuccessMessage" userInput="You deleted the role."/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Braintree/Test/Mftf/ActionGroup/AdminRoleActionGroup.xml b/app/code/Magento/Braintree/Test/Mftf/ActionGroup/AdminRoleActionGroup.xml deleted file mode 100644 index 384ccbf379bc3..0000000000000 --- a/app/code/Magento/Braintree/Test/Mftf/ActionGroup/AdminRoleActionGroup.xml +++ /dev/null @@ -1,62 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="GoToUserRoles"> - <annotations> - <description>Navigate to the User Roles page via Backend Admin Side Menu. PLEASE NOTE: Use the amOnPage action instead.</description> - </annotations> - - <click selector="#menu-magento-backend-system" stepKey="clickOnSystemIcon"/> - <waitForPageLoad stepKey="waitForSystemsPageToOpen"/> - <click selector="//span[contains(text(), 'User Roles')]" stepKey="clickToSelectUserRoles"/> - <waitForPageLoad stepKey="waitForUserRolesPageToOpen"/> - </actionGroup> - - <!--Create new role--> - <actionGroup name="AdminCreateNewRole"> - <annotations> - <description>Creates a User Role using the provided Data.</description> - </annotations> - <arguments> - <argument name="role" type="string" defaultValue=""/> - <argument name="resource" type="string" defaultValue="All"/> - <argument name="scope" type="string" defaultValue="Custom"/> - <argument name="websites" type="string" defaultValue="Main Website"/> - </arguments> - - <click selector="{{AdminCreateRoleSection.create}}" stepKey="clickToAddNewRole"/> - <fillField selector="{{AdminCreateRoleSection.name}}" userInput="{{role.name}}" stepKey="setRoleName"/> - <fillField stepKey="setPassword" selector="{{AdminCreateRoleSection.password}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}"/> - <click selector="{{AdminCreateRoleSection.roleResources}}" stepKey="clickToOpenRoleResources"/> - <waitForPageLoad stepKey="waitForRoleResourcePage" time="5"/> - <click stepKey="checkSales" selector="//a[text()='Sales']"/> - <click selector="{{AdminCreateRoleSection.save}}" stepKey="clickToSaveRole"/> - <waitForPageLoad stepKey="waitForPageLoad" time="10"/> - <see userInput="You saved the role." stepKey="seeSuccessMessage"/> - </actionGroup> - - <!--Delete role--> - <actionGroup name="AdminDeleteRoleActionGroup"> - <annotations> - <description>Deletes a User Role that contains the text 'Role'. PLEASE NOTE: The Action Group values are Hardcoded.</description> - </annotations> - <arguments> - <argument name="role" defaultValue=""/> - </arguments> - - <click stepKey="clickOnRole" selector="{{AdminDeleteRoleSection.theRole}}"/> - <fillField stepKey="TypeCurrentPassword" selector="{{AdminDeleteRoleSection.current_pass}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}"/> - <click stepKey="clickToDeleteRole" selector="{{AdminDeleteRoleSection.delete}}"/> - <waitForAjaxLoad stepKey="waitForDeleteConfirmationPopup" time="5"/> - <click stepKey="clickToConfirm" selector="{{AdminDeleteRoleSection.confirm}}"/> - <waitForPageLoad stepKey="waitForPageLoad" time="10"/> - <see stepKey="seeSuccessMessage" userInput="You deleted the role."/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Braintree/Test/Mftf/ActionGroup/ConfigureBraintreeActionGroup.xml b/app/code/Magento/Braintree/Test/Mftf/ActionGroup/ConfigureBraintreeActionGroup.xml index 6f379c2e66a48..5e5f6d634caad 100644 --- a/app/code/Magento/Braintree/Test/Mftf/ActionGroup/ConfigureBraintreeActionGroup.xml +++ b/app/code/Magento/Braintree/Test/Mftf/ActionGroup/ConfigureBraintreeActionGroup.xml @@ -8,7 +8,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="ConfigureBraintree"> + <actionGroup name="ConfigureBraintreeActionGroup"> <annotations> <description>Sets up the Braintree configuration setting using the BraintreeConfigurationSection Data Entity. PLEASE NOTE: The Action Group values are Hardcoded.</description> </annotations> @@ -49,13 +49,4 @@ <click stepKey="save" selector="{{BraintreeConfiguraionSection.save}}"/> <waitForElementVisible selector="{{BraintreeConfiguraionSection.successfulMessage}}" stepKey="waitForSuccessfullyConfigured" time="10"/> </actionGroup> - - <actionGroup name="DisableBrainTree"> - <annotations> - <description>Disables the Braintree and BraintreePaypal configuration settings via the CLI.</description> - </annotations> - - <magentoCLI stepKey="disableBrainTree" command="config:set payment/braintree/active 0"/> - <magentoCLI stepKey="disableBrainTreePaypal" command="config:set payment/braintree_paypal/active 0"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Braintree/Test/Mftf/ActionGroup/DisableBraintreeActionGroup.xml b/app/code/Magento/Braintree/Test/Mftf/ActionGroup/DisableBraintreeActionGroup.xml new file mode 100644 index 0000000000000..9f8b7735fc067 --- /dev/null +++ b/app/code/Magento/Braintree/Test/Mftf/ActionGroup/DisableBraintreeActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DisableBraintreeActionGroup"> + <annotations> + <description>Disables the Braintree and BraintreePaypal configuration settings via the CLI.</description> + </annotations> + + <magentoCLI stepKey="disableBrainTree" command="config:set payment/braintree/active 0"/> + <magentoCLI stepKey="disableBrainTreePaypal" command="config:set payment/braintree_paypal/active 0"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Braintree/Test/Mftf/ActionGroup/GoToAllUsersActionGroup.xml b/app/code/Magento/Braintree/Test/Mftf/ActionGroup/GoToAllUsersActionGroup.xml new file mode 100644 index 0000000000000..f5cffbe81b509 --- /dev/null +++ b/app/code/Magento/Braintree/Test/Mftf/ActionGroup/GoToAllUsersActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="GoToAllUsersActionGroup"> + <annotations> + <description>Navigate to the Users page via Backend Admin Side Menu. PLEASE NOTE: Use the amOnPage action instead.</description> + </annotations> + + <click selector="{{AdminCreateUserSection.system}}" stepKey="clickOnSystemIcon"/> + <waitForPageLoad stepKey="waitForSystemsPageToOpen"/> + <click selector="{{AdminCreateUserSection.allUsers}}" stepKey="clickToSelectUserRoles"/> + <waitForPageLoad stepKey="waitForUserRolesPageToOpen"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Braintree/Test/Mftf/ActionGroup/GoToUserRolesActionGroup.xml b/app/code/Magento/Braintree/Test/Mftf/ActionGroup/GoToUserRolesActionGroup.xml new file mode 100644 index 0000000000000..43bdb3cb02c0d --- /dev/null +++ b/app/code/Magento/Braintree/Test/Mftf/ActionGroup/GoToUserRolesActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="GoToUserRolesActionGroup"> + <annotations> + <description>Navigate to the User Roles page via Backend Admin Side Menu. PLEASE NOTE: Use the amOnPage action instead.</description> + </annotations> + + <click selector="#menu-magento-backend-system" stepKey="clickOnSystemIcon"/> + <waitForPageLoad stepKey="waitForSystemsPageToOpen"/> + <click selector="//span[contains(text(), 'User Roles')]" stepKey="clickToSelectUserRoles"/> + <waitForPageLoad stepKey="waitForUserRolesPageToOpen"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Braintree/Test/Mftf/Test/CreateAnAdminOrderUsingBraintreePaymentTest1.xml b/app/code/Magento/Braintree/Test/Mftf/Test/CreateAnAdminOrderUsingBraintreePaymentTest1.xml index 2594d245f9ff0..1e134b604d497 100644 --- a/app/code/Magento/Braintree/Test/Mftf/Test/CreateAnAdminOrderUsingBraintreePaymentTest1.xml +++ b/app/code/Magento/Braintree/Test/Mftf/Test/CreateAnAdminOrderUsingBraintreePaymentTest1.xml @@ -42,14 +42,14 @@ <actionGroup ref="ConfigureBraintree" stepKey="configureBraintree"/> <!--Create New Role--> - <actionGroup ref="GoToUserRoles" stepKey="GoToUserRoles"/> + <actionGroup ref="GoToUserRolesActionGroup" stepKey="GoToUserRoles"/> <waitForPageLoad stepKey="waitForAllRoles" time="15"/> - <actionGroup ref="AdminCreateNewRole" stepKey="AdminCreateNewRole"/> + <actionGroup ref="AdminCreateNewRoleActionGroup" stepKey="AdminCreateNewRole"/> <!--Create new admin user--> - <actionGroup ref="GoToAllUsers" stepKey="GoToAllUsers"/> + <actionGroup ref="GoToAllUsersActionGroup" stepKey="GoToAllUsers"/> <waitForPageLoad stepKey="waitForUsers" time="15"/> - <actionGroup ref="AdminCreateUserAction" stepKey="AdminCreateNewUser"/> + <actionGroup ref="AdminCreateUserActionGroup" stepKey="AdminCreateNewUser"/> <!--SignOut--> <actionGroup ref="logout" stepKey="signOutFromAdmin"/> @@ -88,7 +88,7 @@ <after> <!-- Disable BrainTree --> - <actionGroup ref="DisableBrainTree" stepKey="disableBrainTree"/> + <actionGroup ref="DisableBraintreeActionGroup" stepKey="disableBrainTree"/> <!--SignOut--> <actionGroup ref="SignOut" stepKey="signOutFromNewUser"/> @@ -101,11 +101,11 @@ <deleteData stepKey="deleteCustomer" createDataKey="createCustomer"/> <!--Delete User --> - <actionGroup ref="GoToAllUsers" stepKey="GoBackToAllUsers"/> + <actionGroup ref="GoToAllUsersActionGroup" stepKey="GoBackToAllUsers"/> <actionGroup ref="AdminDeleteNewUserActionGroup" stepKey="AdminDeleteUserActionGroup"/> <!--Delete Role--> - <actionGroup ref="GoToUserRoles" stepKey="GoBackToUserRoles"/> + <actionGroup ref="GoToUserRolesActionGroup" stepKey="GoBackToUserRoles"/> <actionGroup ref="AdminDeleteRoleActionGroup" stepKey="AdminDeleteRoleActionGroup"/> </after> </test> From 236988709f6db007988ca274bfbf837c2b609bb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 28 Nov 2019 12:51:34 +0100 Subject: [PATCH 0147/1143] REFACTOR: Extract Action Groups to separate files (according to MFTF best practices) --- ...dBundleOptionWithOneProductActionGroup.xml | 26 +++ ...BundleOptionWithSixProductsActionGroup.xml | 55 ++++++ ...undleOptionWithTreeProductsActionGroup.xml | 31 +++ ...BundleOptionWithTwoProductsActionGroup.xml | 48 +++++ ...AdminCreateApiBundleProductActionGroup.xml | 184 ------------------ ...eateApiDynamicBundleProductActionGroup.xml | 65 +++++++ ...BundleProductAllOptionTypesActionGroup.xml | 74 +++++++ ...CreateApiFixedBundleProductActionGroup.xml | 65 +++++++ ...AncillaryPrepBundleProductActionGroup.xml} | 19 +- ...edFieldsInBundleProductFormActionGroup.xml | 23 +++ .../CreateBasicBundleProductActionGroup.xml | 29 +++ .../CreateBundleProductActionGroup.xml | 162 --------------- .../DeleteBundleOptionByIndexActionGroup.xml | 23 +++ .../FillMainBundleProductFormActionGroup.xml | 23 +++ .../FindProductToEditActionGroup.xml | 24 +++ ...leProductFromCategoryToCartActionGroup.xml | 27 +++ ...dleProductFromProductToCartActionGroup.xml | 24 +++ ...roductToCartWithMultiOptionActionGroup.xml | 22 +++ ...CategoryBundleProductToCartActionGroup.xml | 30 +++ .../StorefrontProductCartActionGroup.xml | 77 -------- ...ewBundleProductInAdminGridActionGroup.xml} | 31 +-- .../Mftf/Test/AdminAddBundleItemsTest.xml | 2 +- ...CreateAndEditBundleProductSettingsTest.xml | 14 +- .../Mftf/Test/AdminDeleteABundleProduct.xml | 2 +- .../AdminFilterProductListByBundleProduct.xml | 2 +- .../Test/AdminMassDeleteBundleProducts.xml | 2 +- .../Test/AdminProductBundleCreationTest.xml | 2 +- .../Test/BundleProductFixedPricingTest.xml | 2 +- .../BundleProductWithTierPriceInCartTest.xml | 6 +- ...urrencyChangingBundleProductInCartTest.xml | 4 +- .../EnableDisableBundleProductStatusTest.xml | 2 +- .../MassEnableDisableBundleProductsTest.xml | 2 +- .../StorefrontAddBundleOptionsToCartTest.xml | 6 +- .../Mftf/Test/StorefrontBundleCartTest.xml | 16 +- .../StorefrontBundleProductDetailsTest.xml | 2 +- ...undleProductShownInCategoryListAndGrid.xml | 2 +- ...tCustomerSelectAndSetBundleOptionsTest.xml | 8 +- ...ontGoToDetailsPageWhenAddingToCartTest.xml | 2 +- .../Mftf/Test/SearchEntityResultsTest.xml | 2 +- ...inCartRulesAppliedForProductInCartTest.xml | 2 +- 40 files changed, 632 insertions(+), 510 deletions(-) create mode 100644 app/code/Magento/Bundle/Test/Mftf/ActionGroup/AddBundleOptionWithOneProductActionGroup.xml create mode 100644 app/code/Magento/Bundle/Test/Mftf/ActionGroup/AddBundleOptionWithSixProductsActionGroup.xml create mode 100644 app/code/Magento/Bundle/Test/Mftf/ActionGroup/AddBundleOptionWithTreeProductsActionGroup.xml create mode 100644 app/code/Magento/Bundle/Test/Mftf/ActionGroup/AddBundleOptionWithTwoProductsActionGroup.xml delete mode 100644 app/code/Magento/Bundle/Test/Mftf/ActionGroup/AdminCreateApiBundleProductActionGroup.xml create mode 100644 app/code/Magento/Bundle/Test/Mftf/ActionGroup/AdminCreateApiDynamicBundleProductActionGroup.xml create mode 100644 app/code/Magento/Bundle/Test/Mftf/ActionGroup/AdminCreateApiDynamicBundleProductAllOptionTypesActionGroup.xml create mode 100644 app/code/Magento/Bundle/Test/Mftf/ActionGroup/AdminCreateApiFixedBundleProductActionGroup.xml rename app/code/Magento/Bundle/Test/Mftf/ActionGroup/{EnableDisableProductActionGroup.xml => AncillaryPrepBundleProductActionGroup.xml} (51%) create mode 100644 app/code/Magento/Bundle/Test/Mftf/ActionGroup/CheckRequiredFieldsInBundleProductFormActionGroup.xml create mode 100644 app/code/Magento/Bundle/Test/Mftf/ActionGroup/CreateBasicBundleProductActionGroup.xml delete mode 100644 app/code/Magento/Bundle/Test/Mftf/ActionGroup/CreateBundleProductActionGroup.xml create mode 100644 app/code/Magento/Bundle/Test/Mftf/ActionGroup/DeleteBundleOptionByIndexActionGroup.xml create mode 100644 app/code/Magento/Bundle/Test/Mftf/ActionGroup/FillMainBundleProductFormActionGroup.xml create mode 100644 app/code/Magento/Bundle/Test/Mftf/ActionGroup/FindProductToEditActionGroup.xml create mode 100644 app/code/Magento/Bundle/Test/Mftf/ActionGroup/StorefrontAddBundleProductFromCategoryToCartActionGroup.xml create mode 100644 app/code/Magento/Bundle/Test/Mftf/ActionGroup/StorefrontAddBundleProductFromProductToCartActionGroup.xml create mode 100644 app/code/Magento/Bundle/Test/Mftf/ActionGroup/StorefrontAddBundleProductFromProductToCartWithMultiOptionActionGroup.xml create mode 100644 app/code/Magento/Bundle/Test/Mftf/ActionGroup/StorefrontAddCategoryBundleProductToCartActionGroup.xml delete mode 100644 app/code/Magento/Bundle/Test/Mftf/ActionGroup/StorefrontProductCartActionGroup.xml rename app/code/Magento/Bundle/Test/Mftf/ActionGroup/{AdminBundleProductActionGroup.xml => ViewBundleProductInAdminGridActionGroup.xml} (50%) diff --git a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AddBundleOptionWithOneProductActionGroup.xml b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AddBundleOptionWithOneProductActionGroup.xml new file mode 100644 index 0000000000000..7c60cde4e20d3 --- /dev/null +++ b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AddBundleOptionWithOneProductActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddBundleOptionWithOneProductActionGroup" extends="AddBundleOptionWithTwoProductsActionGroup"> + <annotations> + <description>Requires Navigation to the Product Creation page. Adds Bundle Option with One Product as specified in arguments. 'x' refers to Bundle option number. 'n' refers to the first number after x.</description> + </annotations> + + <remove keyForRemoval="openProductFilters2"/> + <remove keyForRemoval="fillProductSkuFilter2"/> + <remove keyForRemoval="clickApplyFilters2"/> + <remove keyForRemoval="waitForFilteredGridLoad2"/> + <remove keyForRemoval="selectProduct2"/> + <remove keyForRemoval="selectProduct2"/> + <remove keyForRemoval="fillQuantity1"/> + <remove keyForRemoval="fillQuantity2"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '0')}}" userInput="1" stepKey="fillQuantity" after="clickAddButton1"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AddBundleOptionWithSixProductsActionGroup.xml b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AddBundleOptionWithSixProductsActionGroup.xml new file mode 100644 index 0000000000000..9fd89bbbfe6d5 --- /dev/null +++ b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AddBundleOptionWithSixProductsActionGroup.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddBundleOptionWithSixProductsActionGroup" extends="AddBundleOptionWithTwoProductsActionGroup"> + <annotations> + <description>Requires Navigation to Product Creation page. Adds Bundle Option with Six Products as specified in arguments. 'x' refers to Bundle option number. 'n' refers to the first number after x.</description> + </annotations> + <arguments> + <argument name="prodTreeSku" type="string"/> + <argument name="prodFourSku" type="string"/> + <argument name="prodFiveSku" type="string"/> + <argument name="prodSixSku" type="string"/> + </arguments> + + <remove keyForRemoval="fillQuantity1"/> + <remove keyForRemoval="fillQuantity2"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters3" after="selectProduct2"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters3" after="clickClearFilters3"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{prodTreeSku}}" stepKey="fillProductSkuFilter3" after="openProductFilters3"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters3" after="fillProductSkuFilter3"/> + <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad3" time="30" after="clickApplyFilters3"/> + <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectProduct3" after="waitForFilteredGridLoad3"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters4" after="selectProduct3"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters4" after="clickClearFilters4"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{prodFourSku}}" stepKey="fillProductSkuFilter4" after="openProductFilters4"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters4" after="fillProductSkuFilter4"/> + <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad4" time="30" after="clickApplyFilters4"/> + <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectProduct4" after="clickApplyFilters4"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters5" after="selectProduct4"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters5" after="clickClearFilters5"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{prodFiveSku}}" stepKey="fillProductSkuFilter5" after="openProductFilters5"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters5" after="fillProductSkuFilter5"/> + <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad5" time="30" after="clickApplyFilters5"/> + <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectProduct5" after="waitForFilteredGridLoad5"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters6" after="selectProduct5"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters6" after="clickClearFilters6"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{prodSixSku}}" stepKey="fillProductSkuFilter6" after="openProductFilters6"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters6" after="fillProductSkuFilter6"/> + <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad6" time="30" after="clickApplyFilters6"/> + <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectProduct6" after="waitForFilteredGridLoad6"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '0')}}" userInput="2" stepKey="fillQuantity1" after="clickAddButton1"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '1')}}" userInput="2" stepKey="fillQuantity2" after="fillQuantity1"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '2')}}" userInput="2" stepKey="fillQuantity3" after="fillQuantity2"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '3')}}" userInput="2" stepKey="fillQuantity4" after="fillQuantity3"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '4')}}" userInput="2" stepKey="fillQuantity5" after="fillQuantity4"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '5')}}" userInput="2" stepKey="fillQuantity6" after="fillQuantity5"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AddBundleOptionWithTreeProductsActionGroup.xml b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AddBundleOptionWithTreeProductsActionGroup.xml new file mode 100644 index 0000000000000..085ee47b89e0e --- /dev/null +++ b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AddBundleOptionWithTreeProductsActionGroup.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddBundleOptionWithThreeProductsActionGroup" extends="AddBundleOptionWithTwoProductsActionGroup"> + <annotations> + <description>Requires Navigation to the Product Creation page. Adds Bundle Option with Three Products using the provided arguments. 'x' refers to Bundle option number. 'n' refers to the first number after x.</description> + </annotations> + <arguments> + <argument name="prodTreeSku" type="string"/> + </arguments> + + <remove keyForRemoval="fillQuantity1"/> + <remove keyForRemoval="fillQuantity2"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters3" after="selectProduct2"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters3" after="clickClearFilters3"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{prodTreeSku}}" stepKey="fillProductSkuFilter3" after="openProductFilters3"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters3" after="fillProductSkuFilter3"/> + <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad3" time="30" after="clickApplyFilters3"/> + <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectProduct3" after="waitForFilteredGridLoad3"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '0')}}" userInput="1" stepKey="fillQuantity1" after="clickAddButton1"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '1')}}" userInput="1" stepKey="fillQuantity2" after="fillQuantity1"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '2')}}" userInput="1" stepKey="fillQuantity3" after="fillQuantity2"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AddBundleOptionWithTwoProductsActionGroup.xml b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AddBundleOptionWithTwoProductsActionGroup.xml new file mode 100644 index 0000000000000..f54704de9dbd9 --- /dev/null +++ b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AddBundleOptionWithTwoProductsActionGroup.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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddBundleOptionWithTwoProductsActionGroup"> + <annotations> + <description>Requires Navigation to the Product Creation page. Adds Bundle Option with Two Products using the provided arguments. 'x' refers to Bundle option number. 'n' refers to the first number after x.</description> + </annotations> + <arguments> + <argument name="x" type="string"/> + <argument name="n" type="string"/> + <argument name="prodOneSku" type="string"/> + <argument name="prodTwoSku" type="string"/> + <argument name="optionTitle" type="string"/> + <argument name="inputType" type="string"/> + </arguments> + + <conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="conditionallyOpenSectionBundleItems"/> + <scrollTo selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" stepKey="scrollUpABit"/> + <click selector="{{AdminProductFormBundleSection.addOption}}" stepKey="clickAddOption"/> + <waitForElementVisible selector="{{AdminProductFormBundleSection.bundleOptionXTitle(x)}}" stepKey="waitForOptions"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXTitle(x)}}" userInput="{{optionTitle}}" stepKey="fillTitle"/> + <selectOption selector="{{AdminProductFormBundleSection.bundleOptionXInputType(x)}}" userInput="{{inputType}}" stepKey="selectType"/> + <waitForElementVisible selector="{{AdminProductFormBundleSection.nthAddProductsToOption(n)}}" stepKey="waitForAddBtn"/> + <click selector="{{AdminProductFormBundleSection.nthAddProductsToOption(n)}}" stepKey="clickAdd"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters1"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters1"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{prodOneSku}}" stepKey="fillProductSkuFilter1"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters1"/> + <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad1" time="30"/> + <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectProduct1"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters2"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters2"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{prodTwoSku}}" stepKey="fillProductSkuFilter2"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters2"/> + <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad2" time="30"/> + <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectProduct2"/> + <click selector="{{AdminAddProductsToOptionPanel.addSelectedProducts}}" stepKey="clickAddButton1"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '0')}}" userInput="50" stepKey="fillQuantity1"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '1')}}" userInput="50" stepKey="fillQuantity2"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AdminCreateApiBundleProductActionGroup.xml b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AdminCreateApiBundleProductActionGroup.xml deleted file mode 100644 index 8993a936475b4..0000000000000 --- a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AdminCreateApiBundleProductActionGroup.xml +++ /dev/null @@ -1,184 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AdminCreateApiDynamicBundleProductActionGroup"> - <annotations> - <description>Creates 4 products with varying prices. Creates the bundle product with specified name. Adds the multiple select and checkbox options and 4 links to the created products. Uses the 'ApiBundleProduct' entity.</description> - </annotations> - <arguments> - <argument name="productName" defaultValue="Api Dynamic Bundle Product" type="string"/> - </arguments> - - <!--Create 4 simple products--> - <createData entity="SimpleProduct2" stepKey="simpleProduct1"> - <field key="price">4.99</field> - </createData> - <createData entity="SimpleProduct2" stepKey="simpleProduct2"> - <field key="price">2.89</field> - </createData> - <createData entity="SimpleProduct2" stepKey="simpleProduct3"> - <field key="price">7.33</field> - </createData> - <createData entity="SimpleProduct2" stepKey="simpleProduct4"> - <field key="price">18.25</field> - </createData> - - <!-- Create the bundle product based --> - <createData entity="ApiBundleProduct" stepKey="createBundleProduct"> - <field key="name">{{productName}}</field> - </createData> - <createData entity="MultipleSelectOption" stepKey="createBundleOption1_1"> - <requiredEntity createDataKey="createBundleProduct"/> - <field key="required">false</field> - </createData> - <createData entity="CheckboxOption" stepKey="createBundleOption1_2"> - <requiredEntity createDataKey="createBundleProduct"/> - </createData> - <createData entity="ApiBundleLink" stepKey="linkOptionToProduct"> - <requiredEntity createDataKey="createBundleProduct"/> - <requiredEntity createDataKey="createBundleOption1_1"/> - <requiredEntity createDataKey="simpleProduct1"/> - </createData> - <createData entity="ApiBundleLink" stepKey="linkOptionToProduct2"> - <requiredEntity createDataKey="createBundleProduct"/> - <requiredEntity createDataKey="createBundleOption1_1"/> - <requiredEntity createDataKey="simpleProduct2"/> - </createData> - <createData entity="ApiBundleLink" stepKey="linkOptionToProduct3"> - <requiredEntity createDataKey="createBundleProduct"/> - <requiredEntity createDataKey="createBundleOption1_2"/> - <requiredEntity createDataKey="simpleProduct3"/> - </createData> - <createData entity="ApiBundleLink" stepKey="linkOptionToProduct4"> - <requiredEntity createDataKey="createBundleProduct"/> - <requiredEntity createDataKey="createBundleOption1_2"/> - <requiredEntity createDataKey="simpleProduct4"/> - </createData> - </actionGroup> - - <actionGroup name="AdminCreateApiFixedBundleProductActionGroup"> - <annotations> - <description>Creates 4 products with varying prices. Creates the bundle product with specified name. Adds the multiple select and checkbox options and 4 links to the created products. Uses the 'ApiFixedBundleProduct' entity.</description> - </annotations> - <arguments> - <argument name="productName" defaultValue="Api Fixed Bundle Product" type="string"/> - </arguments> - - <!--Create 4 simple products--> - <createData entity="SimpleProduct2" stepKey="simpleProduct1"> - <field key="price">4.99</field> - </createData> - <createData entity="SimpleProduct2" stepKey="simpleProduct2"> - <field key="price">2.89</field> - </createData> - <createData entity="SimpleProduct2" stepKey="simpleProduct3"> - <field key="price">7.33</field> - </createData> - <createData entity="SimpleProduct2" stepKey="simpleProduct4"> - <field key="price">18.25</field> - </createData> - - <!-- Create the bundle product based --> - <createData entity="ApiFixedBundleProduct" stepKey="createBundleProduct"> - <field key="name">{{productName}}</field> - </createData> - <createData entity="MultipleSelectOption" stepKey="createBundleOption1_1"> - <requiredEntity createDataKey="createBundleProduct"/> - <field key="required">false</field> - </createData> - <createData entity="CheckboxOption" stepKey="createBundleOption1_2"> - <requiredEntity createDataKey="createBundleProduct"/> - </createData> - <createData entity="ApiBundleLink" stepKey="linkOptionToProduct"> - <requiredEntity createDataKey="createBundleProduct"/> - <requiredEntity createDataKey="createBundleOption1_1"/> - <requiredEntity createDataKey="simpleProduct1"/> - </createData> - <createData entity="ApiBundleLink" stepKey="linkOptionToProduct2"> - <requiredEntity createDataKey="createBundleProduct"/> - <requiredEntity createDataKey="createBundleOption1_1"/> - <requiredEntity createDataKey="simpleProduct2"/> - </createData> - <createData entity="ApiBundleLink" stepKey="linkOptionToProduct3"> - <requiredEntity createDataKey="createBundleProduct"/> - <requiredEntity createDataKey="createBundleOption1_2"/> - <requiredEntity createDataKey="simpleProduct3"/> - </createData> - <createData entity="ApiBundleLink" stepKey="linkOptionToProduct4"> - <requiredEntity createDataKey="createBundleProduct"/> - <requiredEntity createDataKey="createBundleOption1_2"/> - <requiredEntity createDataKey="simpleProduct4"/> - </createData> - </actionGroup> - - <actionGroup name="AdminCreateApiDynamicBundleProductAllOptionTypesActionGroup"> - <annotations> - <description>Creates 3 products with varying prices. Creates the dynamic bundle product with specified name. Adds the multiple select, checkbox options and links to the created products. Uses the 'ApiBundleProduct' entity.</description> - </annotations> - <arguments> - <argument name="productName" defaultValue="Api Dynamic Bundle Product" type="string"/> - </arguments> - - <!-- Create simple products --> - <createData entity="SimpleProduct2" stepKey="simpleProduct1"> - <field key="price">10</field> - </createData> - <createData entity="SimpleProduct2" stepKey="simpleProduct2"> - <field key="price">20</field> - </createData> - - <!-- Create Bundle product --> - <createData entity="ApiBundleProduct" stepKey="createBundleProduct"> - <field key="name">{{productName}}</field> - </createData> - <createData entity="DropDownBundleOption" stepKey="createDropDownBundleOption"> - <requiredEntity createDataKey="createBundleProduct"/> - <field key="title">Drop-down Option</field> - </createData> - <createData entity="RadioButtonsOption" stepKey="createBundleRadioButtonsOption"> - <requiredEntity createDataKey="createBundleProduct"/> - <field key="title">Radio Buttons Option</field> - </createData> - <createData entity="CheckboxOption" stepKey="createBundleCheckboxOption"> - <requiredEntity createDataKey="createBundleProduct"/> - <field key="title">Checkbox Option</field> - </createData> - <createData entity="ApiBundleLink" stepKey="linkCheckboxOptionToProduct1"> - <requiredEntity createDataKey="createBundleProduct"/> - <requiredEntity createDataKey="createBundleCheckboxOption"/> - <requiredEntity createDataKey="simpleProduct1"/> - </createData> - <createData entity="ApiBundleLink" stepKey="linkCheckboxOptionToProduct2"> - <requiredEntity createDataKey="createBundleProduct"/> - <requiredEntity createDataKey="createBundleCheckboxOption"/> - <requiredEntity createDataKey="simpleProduct2"/> - </createData> - <createData entity="ApiBundleLink" stepKey="linkDropDownOptionToProduct1"> - <requiredEntity createDataKey="createBundleProduct"/> - <requiredEntity createDataKey="createDropDownBundleOption"/> - <requiredEntity createDataKey="simpleProduct1"/> - </createData> - <createData entity="ApiBundleLink" stepKey="linkDropDownOptionToProduct2"> - <requiredEntity createDataKey="createBundleProduct"/> - <requiredEntity createDataKey="createDropDownBundleOption"/> - <requiredEntity createDataKey="simpleProduct2"/> - </createData> - <createData entity="ApiBundleLink" stepKey="linkRadioButtonsOptionToProduct1"> - <requiredEntity createDataKey="createBundleProduct"/> - <requiredEntity createDataKey="createBundleRadioButtonsOption"/> - <requiredEntity createDataKey="simpleProduct1"/> - </createData> - <createData entity="ApiBundleLink" stepKey="linkRadioButtonsOptionToProduct2"> - <requiredEntity createDataKey="createBundleProduct"/> - <requiredEntity createDataKey="createBundleRadioButtonsOption"/> - <requiredEntity createDataKey="simpleProduct2"/> - </createData> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AdminCreateApiDynamicBundleProductActionGroup.xml b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AdminCreateApiDynamicBundleProductActionGroup.xml new file mode 100644 index 0000000000000..7e17822710a18 --- /dev/null +++ b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AdminCreateApiDynamicBundleProductActionGroup.xml @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateApiDynamicBundleProductActionGroup"> + <annotations> + <description>Creates 4 products with varying prices. Creates the bundle product with specified name. Adds the multiple select and checkbox options and 4 links to the created products. Uses the 'ApiBundleProduct' entity.</description> + </annotations> + <arguments> + <argument name="productName" defaultValue="Api Dynamic Bundle Product" type="string"/> + </arguments> + + <!--Create 4 simple products--> + <createData entity="SimpleProduct2" stepKey="simpleProduct1"> + <field key="price">4.99</field> + </createData> + <createData entity="SimpleProduct2" stepKey="simpleProduct2"> + <field key="price">2.89</field> + </createData> + <createData entity="SimpleProduct2" stepKey="simpleProduct3"> + <field key="price">7.33</field> + </createData> + <createData entity="SimpleProduct2" stepKey="simpleProduct4"> + <field key="price">18.25</field> + </createData> + + <!-- Create the bundle product based --> + <createData entity="ApiBundleProduct" stepKey="createBundleProduct"> + <field key="name">{{productName}}</field> + </createData> + <createData entity="MultipleSelectOption" stepKey="createBundleOption1_1"> + <requiredEntity createDataKey="createBundleProduct"/> + <field key="required">false</field> + </createData> + <createData entity="CheckboxOption" stepKey="createBundleOption1_2"> + <requiredEntity createDataKey="createBundleProduct"/> + </createData> + <createData entity="ApiBundleLink" stepKey="linkOptionToProduct"> + <requiredEntity createDataKey="createBundleProduct"/> + <requiredEntity createDataKey="createBundleOption1_1"/> + <requiredEntity createDataKey="simpleProduct1"/> + </createData> + <createData entity="ApiBundleLink" stepKey="linkOptionToProduct2"> + <requiredEntity createDataKey="createBundleProduct"/> + <requiredEntity createDataKey="createBundleOption1_1"/> + <requiredEntity createDataKey="simpleProduct2"/> + </createData> + <createData entity="ApiBundleLink" stepKey="linkOptionToProduct3"> + <requiredEntity createDataKey="createBundleProduct"/> + <requiredEntity createDataKey="createBundleOption1_2"/> + <requiredEntity createDataKey="simpleProduct3"/> + </createData> + <createData entity="ApiBundleLink" stepKey="linkOptionToProduct4"> + <requiredEntity createDataKey="createBundleProduct"/> + <requiredEntity createDataKey="createBundleOption1_2"/> + <requiredEntity createDataKey="simpleProduct4"/> + </createData> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AdminCreateApiDynamicBundleProductAllOptionTypesActionGroup.xml b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AdminCreateApiDynamicBundleProductAllOptionTypesActionGroup.xml new file mode 100644 index 0000000000000..c9f5c52c05736 --- /dev/null +++ b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AdminCreateApiDynamicBundleProductAllOptionTypesActionGroup.xml @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateApiDynamicBundleProductAllOptionTypesActionGroup"> + <annotations> + <description>Creates 3 products with varying prices. Creates the dynamic bundle product with specified name. Adds the multiple select, checkbox options and links to the created products. Uses the 'ApiBundleProduct' entity.</description> + </annotations> + <arguments> + <argument name="productName" defaultValue="Api Dynamic Bundle Product" type="string"/> + </arguments> + + <!-- Create simple products --> + <createData entity="SimpleProduct2" stepKey="simpleProduct1"> + <field key="price">10</field> + </createData> + <createData entity="SimpleProduct2" stepKey="simpleProduct2"> + <field key="price">20</field> + </createData> + + <!-- Create Bundle product --> + <createData entity="ApiBundleProduct" stepKey="createBundleProduct"> + <field key="name">{{productName}}</field> + </createData> + <createData entity="DropDownBundleOption" stepKey="createDropDownBundleOption"> + <requiredEntity createDataKey="createBundleProduct"/> + <field key="title">Drop-down Option</field> + </createData> + <createData entity="RadioButtonsOption" stepKey="createBundleRadioButtonsOption"> + <requiredEntity createDataKey="createBundleProduct"/> + <field key="title">Radio Buttons Option</field> + </createData> + <createData entity="CheckboxOption" stepKey="createBundleCheckboxOption"> + <requiredEntity createDataKey="createBundleProduct"/> + <field key="title">Checkbox Option</field> + </createData> + <createData entity="ApiBundleLink" stepKey="linkCheckboxOptionToProduct1"> + <requiredEntity createDataKey="createBundleProduct"/> + <requiredEntity createDataKey="createBundleCheckboxOption"/> + <requiredEntity createDataKey="simpleProduct1"/> + </createData> + <createData entity="ApiBundleLink" stepKey="linkCheckboxOptionToProduct2"> + <requiredEntity createDataKey="createBundleProduct"/> + <requiredEntity createDataKey="createBundleCheckboxOption"/> + <requiredEntity createDataKey="simpleProduct2"/> + </createData> + <createData entity="ApiBundleLink" stepKey="linkDropDownOptionToProduct1"> + <requiredEntity createDataKey="createBundleProduct"/> + <requiredEntity createDataKey="createDropDownBundleOption"/> + <requiredEntity createDataKey="simpleProduct1"/> + </createData> + <createData entity="ApiBundleLink" stepKey="linkDropDownOptionToProduct2"> + <requiredEntity createDataKey="createBundleProduct"/> + <requiredEntity createDataKey="createDropDownBundleOption"/> + <requiredEntity createDataKey="simpleProduct2"/> + </createData> + <createData entity="ApiBundleLink" stepKey="linkRadioButtonsOptionToProduct1"> + <requiredEntity createDataKey="createBundleProduct"/> + <requiredEntity createDataKey="createBundleRadioButtonsOption"/> + <requiredEntity createDataKey="simpleProduct1"/> + </createData> + <createData entity="ApiBundleLink" stepKey="linkRadioButtonsOptionToProduct2"> + <requiredEntity createDataKey="createBundleProduct"/> + <requiredEntity createDataKey="createBundleRadioButtonsOption"/> + <requiredEntity createDataKey="simpleProduct2"/> + </createData> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AdminCreateApiFixedBundleProductActionGroup.xml b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AdminCreateApiFixedBundleProductActionGroup.xml new file mode 100644 index 0000000000000..13c31cf2e7127 --- /dev/null +++ b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AdminCreateApiFixedBundleProductActionGroup.xml @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateApiFixedBundleProductActionGroup"> + <annotations> + <description>Creates 4 products with varying prices. Creates the bundle product with specified name. Adds the multiple select and checkbox options and 4 links to the created products. Uses the 'ApiFixedBundleProduct' entity.</description> + </annotations> + <arguments> + <argument name="productName" defaultValue="Api Fixed Bundle Product" type="string"/> + </arguments> + + <!--Create 4 simple products--> + <createData entity="SimpleProduct2" stepKey="simpleProduct1"> + <field key="price">4.99</field> + </createData> + <createData entity="SimpleProduct2" stepKey="simpleProduct2"> + <field key="price">2.89</field> + </createData> + <createData entity="SimpleProduct2" stepKey="simpleProduct3"> + <field key="price">7.33</field> + </createData> + <createData entity="SimpleProduct2" stepKey="simpleProduct4"> + <field key="price">18.25</field> + </createData> + + <!-- Create the bundle product based --> + <createData entity="ApiFixedBundleProduct" stepKey="createBundleProduct"> + <field key="name">{{productName}}</field> + </createData> + <createData entity="MultipleSelectOption" stepKey="createBundleOption1_1"> + <requiredEntity createDataKey="createBundleProduct"/> + <field key="required">false</field> + </createData> + <createData entity="CheckboxOption" stepKey="createBundleOption1_2"> + <requiredEntity createDataKey="createBundleProduct"/> + </createData> + <createData entity="ApiBundleLink" stepKey="linkOptionToProduct"> + <requiredEntity createDataKey="createBundleProduct"/> + <requiredEntity createDataKey="createBundleOption1_1"/> + <requiredEntity createDataKey="simpleProduct1"/> + </createData> + <createData entity="ApiBundleLink" stepKey="linkOptionToProduct2"> + <requiredEntity createDataKey="createBundleProduct"/> + <requiredEntity createDataKey="createBundleOption1_1"/> + <requiredEntity createDataKey="simpleProduct2"/> + </createData> + <createData entity="ApiBundleLink" stepKey="linkOptionToProduct3"> + <requiredEntity createDataKey="createBundleProduct"/> + <requiredEntity createDataKey="createBundleOption1_2"/> + <requiredEntity createDataKey="simpleProduct3"/> + </createData> + <createData entity="ApiBundleLink" stepKey="linkOptionToProduct4"> + <requiredEntity createDataKey="createBundleProduct"/> + <requiredEntity createDataKey="createBundleOption1_2"/> + <requiredEntity createDataKey="simpleProduct4"/> + </createData> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/EnableDisableProductActionGroup.xml b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AncillaryPrepBundleProductActionGroup.xml similarity index 51% rename from app/code/Magento/Bundle/Test/Mftf/ActionGroup/EnableDisableProductActionGroup.xml rename to app/code/Magento/Bundle/Test/Mftf/ActionGroup/AncillaryPrepBundleProductActionGroup.xml index 92d885485949c..99551742deca1 100644 --- a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/EnableDisableProductActionGroup.xml +++ b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AncillaryPrepBundleProductActionGroup.xml @@ -7,8 +7,8 @@ --> <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AncillaryPrepBundleProduct"> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AncillaryPrepBundleProductActionGroup"> <annotations> <description>Requires Navigation to the Product Creation page. Fills out Name, Sku, and SEO information using the BundleProduct Data Entity. PLEASE NOTE: The Action Group values are Hardcoded.</description> </annotations> @@ -25,19 +25,4 @@ <!--Fill URL input--> <fillField userInput="{{BundleProduct.urlKey}}" selector="{{AdminProductFormBundleSection.urlKey}}" stepKey="FillsinSEOlinkExtension"/> </actionGroup> - - <!--Edit existing product by searching in product catalog--> - <actionGroup name="FindProductToEdit"> - <annotations> - <description>Clears the Backend Admin Grid Filters on the Backend Admin Product Grid page. Searches for the BundleProduct Data Entity. Then clicks on the first item in the Admin Grid. PLEASE NOTE: The Action Group values are Hardcoded.</description> - </annotations> - - <amOnPage url="{{ProductCatalogPage.url}}" stepKey="GoToProductCatalog"/> - <waitForPageLoad stepKey="WaitForCatalogProductPageToLoad"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> - <fillField userInput="{{BundleProduct.name}}" selector="#fulltext" stepKey="EnterProductNameInSearch"/> - <click stepKey="ClickSearch" selector="{{AdminProductFormBundleSection.searchButton}}"/> - <click stepKey="ClickOnProduct" selector="{{AdminProductFormBundleSection.firstCatalogProduct}}"/> - <waitForPageLoad stepKey="WaitForProductEditPageToLoad"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/CheckRequiredFieldsInBundleProductFormActionGroup.xml b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/CheckRequiredFieldsInBundleProductFormActionGroup.xml new file mode 100644 index 0000000000000..9575349ba3110 --- /dev/null +++ b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/CheckRequiredFieldsInBundleProductFormActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CheckRequiredFieldsInBundleProductFormActionGroup"> + <annotations> + <description>Clears the Name and SKU fields when adding a Product and then verifies that they are required after attempting to Save.</description> + </annotations> + + <clearField selector="{{AdminProductFormSection.productName}}" stepKey="clearProductSku"/> + <clearField selector="{{AdminProductFormSection.productSku}}" stepKey="clearProductName"/> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveButton"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Product" stepKey="seeStillOnEditPage"/> + <see selector="{{AdminProductFormSection.fieldError('name')}}" userInput="This is a required field." stepKey="seeNameRequired"/> + <see selector="{{AdminProductFormSection.fieldError('sku')}}" userInput="This is a required field." stepKey="seeSkuRequired"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/CreateBasicBundleProductActionGroup.xml b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/CreateBasicBundleProductActionGroup.xml new file mode 100644 index 0000000000000..fd81b392db708 --- /dev/null +++ b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/CreateBasicBundleProductActionGroup.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateBasicBundleProductActionGroup"> + <annotations> + <description>Requires Navigation to the Product Creation page. Fills out Name, Sku, and SEO information using the BundleProduct Data Entity. PLEASE NOTE: The Action Group values are Hardcoded.</description> + </annotations> + + <!--PreReq: Go to bundle product creation page--> + <!--Product name and SKU--> + <fillField selector="{{AdminProductFormBundleSection.productName}}" userInput="{{BundleProduct.name}}" stepKey="fillProductName"/> + <fillField selector="{{AdminProductFormBundleSection.productSku}}" userInput="{{BundleProduct.sku}}" stepKey="fillProductSku"/> + + <!--Trigger SEO drop down--> + <scrollTo selector="{{AdminProductFormBundleSection.seoDropdown}}" stepKey="scrollToSeoDropDown"/> + <conditionalClick selector="{{AdminProductFormBundleSection.seoDropdown}}" dependentSelector="{{AdminProductFormBundleSection.urlKey}}" visible="false" stepKey="openDropDownIfClosed"/> + <waitForPageLoad stepKey="waitForDropDownSEO"/> + + <!--Fill URL input--> + <fillField userInput="{{BundleProduct.urlKey}}" selector="{{AdminProductFormBundleSection.urlKey}}" stepKey="fillsInSeoLinkExtension"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/CreateBundleProductActionGroup.xml b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/CreateBundleProductActionGroup.xml deleted file mode 100644 index 33740c346155a..0000000000000 --- a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/CreateBundleProductActionGroup.xml +++ /dev/null @@ -1,162 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="CreateBasicBundleProduct"> - <annotations> - <description>Requires Navigation to the Product Creation page. Fills out Name, Sku, and SEO information using the BundleProduct Data Entity. PLEASE NOTE: The Action Group values are Hardcoded.</description> - </annotations> - - <!--PreReq: Go to bundle product creation page--> - <!--Product name and SKU--> - <fillField selector="{{AdminProductFormBundleSection.productName}}" userInput="{{BundleProduct.name}}" stepKey="fillProductName"/> - <fillField selector="{{AdminProductFormBundleSection.productSku}}" userInput="{{BundleProduct.sku}}" stepKey="fillProductSku"/> - - <!--Trigger SEO drop down--> - <scrollTo selector="{{AdminProductFormBundleSection.seoDropdown}}" stepKey="scrollToSeoDropDown"/> - <conditionalClick selector="{{AdminProductFormBundleSection.seoDropdown}}" dependentSelector="{{AdminProductFormBundleSection.urlKey}}" visible="false" stepKey="openDropDownIfClosed"/> - <waitForPageLoad stepKey="waitForDropDownSEO"/> - - <!--Fill URL input--> - <fillField userInput="{{BundleProduct.urlKey}}" selector="{{AdminProductFormBundleSection.urlKey}}" stepKey="fillsInSeoLinkExtension"/> - </actionGroup> - - <actionGroup name="addBundleOptionWithTwoProducts"> - <annotations> - <description>Requires Navigation to the Product Creation page. Adds Bundle Option with Two Products using the provided arguments. 'x' refers to Bundle option number. 'n' refers to the first number after x.</description> - </annotations> - <arguments> - <argument name="x" type="string"/> - <argument name="n" type="string"/> - <argument name="prodOneSku" type="string"/> - <argument name="prodTwoSku" type="string"/> - <argument name="optionTitle" type="string"/> - <argument name="inputType" type="string"/> - </arguments> - - <conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="conditionallyOpenSectionBundleItems"/> - <scrollTo selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" stepKey="scrollUpABit"/> - <click selector="{{AdminProductFormBundleSection.addOption}}" stepKey="clickAddOption"/> - <waitForElementVisible selector="{{AdminProductFormBundleSection.bundleOptionXTitle(x)}}" stepKey="waitForOptions"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXTitle(x)}}" userInput="{{optionTitle}}" stepKey="fillTitle"/> - <selectOption selector="{{AdminProductFormBundleSection.bundleOptionXInputType(x)}}" userInput="{{inputType}}" stepKey="selectType"/> - <waitForElementVisible selector="{{AdminProductFormBundleSection.nthAddProductsToOption(n)}}" stepKey="waitForAddBtn"/> - <click selector="{{AdminProductFormBundleSection.nthAddProductsToOption(n)}}" stepKey="clickAdd"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters1"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters1"/> - <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{prodOneSku}}" stepKey="fillProductSkuFilter1"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters1"/> - <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad1" time="30"/> - <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectProduct1"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters2"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters2"/> - <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{prodTwoSku}}" stepKey="fillProductSkuFilter2"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters2"/> - <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad2" time="30"/> - <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectProduct2"/> - <click selector="{{AdminAddProductsToOptionPanel.addSelectedProducts}}" stepKey="clickAddButton1"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '0')}}" userInput="50" stepKey="fillQuantity1"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '1')}}" userInput="50" stepKey="fillQuantity2"/> - </actionGroup> - - <actionGroup name="addBundleOptionWithOneProduct" extends="addBundleOptionWithTwoProducts"> - <annotations> - <description>Requires Navigation to the Product Creation page. Adds Bundle Option with One Product as specified in arguments. 'x' refers to Bundle option number. 'n' refers to the first number after x.</description> - </annotations> - - <remove keyForRemoval="openProductFilters2"/> - <remove keyForRemoval="fillProductSkuFilter2"/> - <remove keyForRemoval="clickApplyFilters2"/> - <remove keyForRemoval="waitForFilteredGridLoad2"/> - <remove keyForRemoval="selectProduct2"/> - <remove keyForRemoval="selectProduct2"/> - <remove keyForRemoval="fillQuantity1"/> - <remove keyForRemoval="fillQuantity2"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '0')}}" userInput="1" stepKey="fillQuantity" after="clickAddButton1"/> - </actionGroup> - - <actionGroup name="addBundleOptionWithTreeProducts" extends="addBundleOptionWithTwoProducts"> - <annotations> - <description>Requires Navigation to the Product Creation page. Adds Bundle Option with Three Products using the provided arguments. 'x' refers to Bundle option number. 'n' refers to the first number after x.</description> - </annotations> - <arguments> - <argument name="prodTreeSku" type="string"/> - </arguments> - - <remove keyForRemoval="fillQuantity1"/> - <remove keyForRemoval="fillQuantity2"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters3" after="selectProduct2"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters3" after="clickClearFilters3"/> - <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{prodTreeSku}}" stepKey="fillProductSkuFilter3" after="openProductFilters3"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters3" after="fillProductSkuFilter3"/> - <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad3" time="30" after="clickApplyFilters3"/> - <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectProduct3" after="waitForFilteredGridLoad3"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '0')}}" userInput="1" stepKey="fillQuantity1" after="clickAddButton1"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '1')}}" userInput="1" stepKey="fillQuantity2" after="fillQuantity1"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '2')}}" userInput="1" stepKey="fillQuantity3" after="fillQuantity2"/> - </actionGroup> - - <actionGroup name="addBundleOptionWithSixProducts" extends="addBundleOptionWithTwoProducts"> - <annotations> - <description>Requires Navigation to Product Creation page. Adds Bundle Option with Six Products as specified in arguments. 'x' refers to Bundle option number. 'n' refers to the first number after x.</description> - </annotations> - <arguments> - <argument name="prodTreeSku" type="string"/> - <argument name="prodFourSku" type="string"/> - <argument name="prodFiveSku" type="string"/> - <argument name="prodSixSku" type="string"/> - </arguments> - - <remove keyForRemoval="fillQuantity1"/> - <remove keyForRemoval="fillQuantity2"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters3" after="selectProduct2"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters3" after="clickClearFilters3"/> - <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{prodTreeSku}}" stepKey="fillProductSkuFilter3" after="openProductFilters3"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters3" after="fillProductSkuFilter3"/> - <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad3" time="30" after="clickApplyFilters3"/> - <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectProduct3" after="waitForFilteredGridLoad3"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters4" after="selectProduct3"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters4" after="clickClearFilters4"/> - <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{prodFourSku}}" stepKey="fillProductSkuFilter4" after="openProductFilters4"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters4" after="fillProductSkuFilter4"/> - <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad4" time="30" after="clickApplyFilters4"/> - <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectProduct4" after="clickApplyFilters4"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters5" after="selectProduct4"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters5" after="clickClearFilters5"/> - <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{prodFiveSku}}" stepKey="fillProductSkuFilter5" after="openProductFilters5"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters5" after="fillProductSkuFilter5"/> - <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad5" time="30" after="clickApplyFilters5"/> - <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectProduct5" after="waitForFilteredGridLoad5"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters6" after="selectProduct5"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters6" after="clickClearFilters6"/> - <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{prodSixSku}}" stepKey="fillProductSkuFilter6" after="openProductFilters6"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters6" after="fillProductSkuFilter6"/> - <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad6" time="30" after="clickApplyFilters6"/> - <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectProduct6" after="waitForFilteredGridLoad6"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '0')}}" userInput="2" stepKey="fillQuantity1" after="clickAddButton1"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '1')}}" userInput="2" stepKey="fillQuantity2" after="fillQuantity1"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '2')}}" userInput="2" stepKey="fillQuantity3" after="fillQuantity2"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '3')}}" userInput="2" stepKey="fillQuantity4" after="fillQuantity3"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '4')}}" userInput="2" stepKey="fillQuantity5" after="fillQuantity4"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '5')}}" userInput="2" stepKey="fillQuantity6" after="fillQuantity5"/> - </actionGroup> - - <actionGroup name="deleteBundleOptionByIndex"> - <annotations> - <description>Requires Navigation to Product Creation page. Removes any Bundle Option by index specified in arguments. 'deleteIndex' refers to Bundle option number.</description> - </annotations> - <arguments> - <argument name="deleteIndex" type="string"/> - </arguments> - - <conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="conditionallyOpenSectionBundleItems"/> - <scrollTo selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" stepKey="scrollUpABit"/> - <click selector="{{AdminProductFormBundleSection.deleteOption(deleteIndex)}}" stepKey="clickDeleteOption"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/DeleteBundleOptionByIndexActionGroup.xml b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/DeleteBundleOptionByIndexActionGroup.xml new file mode 100644 index 0000000000000..52a4897f8e354 --- /dev/null +++ b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/DeleteBundleOptionByIndexActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DeleteBundleOptionByIndexActionGroup"> + <annotations> + <description>Requires Navigation to Product Creation page. Removes any Bundle Option by index specified in arguments. 'deleteIndex' refers to Bundle option number.</description> + </annotations> + <arguments> + <argument name="deleteIndex" type="string"/> + </arguments> + + <conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="conditionallyOpenSectionBundleItems"/> + <scrollTo selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" stepKey="scrollUpABit"/> + <click selector="{{AdminProductFormBundleSection.deleteOption(deleteIndex)}}" stepKey="clickDeleteOption"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/FillMainBundleProductFormActionGroup.xml b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/FillMainBundleProductFormActionGroup.xml new file mode 100644 index 0000000000000..71baf0c450759 --- /dev/null +++ b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/FillMainBundleProductFormActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FillMainBundleProductFormActionGroup"> + <annotations> + <description>Fills the Name, SKU and Stock Status fields.</description> + </annotations> + <arguments> + <argument name="product" defaultValue="BundleProduct"/> + </arguments> + + <fillField selector="{{AdminProductFormSection.productName}}" userInput="{{product.name}}" stepKey="fillProductSku"/> + <fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="fillProductName"/> + <selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="{{product.status}}" stepKey="selectStockStatus"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/FindProductToEditActionGroup.xml b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/FindProductToEditActionGroup.xml new file mode 100644 index 0000000000000..bd6dbb79489b3 --- /dev/null +++ b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/FindProductToEditActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FindProductToEditActionGroup"> + <annotations> + <description>Clears the Backend Admin Grid Filters on the Backend Admin Product Grid page. Searches for the BundleProduct Data Entity. Then clicks on the first item in the Admin Grid. PLEASE NOTE: The Action Group values are Hardcoded.</description> + </annotations> + + <amOnPage url="{{ProductCatalogPage.url}}" stepKey="GoToProductCatalog"/> + <waitForPageLoad stepKey="WaitForCatalogProductPageToLoad"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> + <fillField userInput="{{BundleProduct.name}}" selector="#fulltext" stepKey="EnterProductNameInSearch"/> + <click stepKey="ClickSearch" selector="{{AdminProductFormBundleSection.searchButton}}"/> + <click stepKey="ClickOnProduct" selector="{{AdminProductFormBundleSection.firstCatalogProduct}}"/> + <waitForPageLoad stepKey="WaitForProductEditPageToLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/StorefrontAddBundleProductFromCategoryToCartActionGroup.xml b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/StorefrontAddBundleProductFromCategoryToCartActionGroup.xml new file mode 100644 index 0000000000000..ccfa356881594 --- /dev/null +++ b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/StorefrontAddBundleProductFromCategoryToCartActionGroup.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontAddBundleProductFromCategoryToCartActionGroup"> + <annotations> + <description>Adds a Bundled Product to the Cart from the Product page. PLEASE NOTE: The Quantity selection is not available in the Action Group.</description> + </annotations> + <arguments> + <argument name="productName" type="string"/> + </arguments> + + <moveMouseOver selector="{{StorefrontCategoryProductSection.ProductTitleByName(productName)}}" stepKey="moveMouseOverProduct"/> + <click selector="{{StorefrontCategoryProductSection.ProductTitleByName(productName)}}" stepKey="openProductPage"/> + <waitForPageLoad time="30" stepKey="waitForBundleProductPageLoad"/> + <click selector="{{StorefrontBundledSection.addToCart}}" stepKey="clickCustomizeAndAddToCart"/> + <click selector="{{StorefrontBundledSection.addToCartConfigured}}" stepKey="clickAddBundleProductToCart"/> + <waitForElementVisible selector="{{StorefrontMinicartSection.productCount}}" stepKey="waitProductCount"/> + <see userInput="You added {{productName}} to your shopping cart." selector="{{StorefrontMessagesSection.success}}" stepKey="seeSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/StorefrontAddBundleProductFromProductToCartActionGroup.xml b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/StorefrontAddBundleProductFromProductToCartActionGroup.xml new file mode 100644 index 0000000000000..cf4cfa4659264 --- /dev/null +++ b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/StorefrontAddBundleProductFromProductToCartActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontAddBundleProductFromProductToCartActionGroup"> + <annotations> + <description>Adds a Bundled Product to the Cart from the Product page. PLEASE NOTE: The Quantity selection is not available in the Action Group.</description> + </annotations> + <arguments> + <argument name="productName" type="string"/> + </arguments> + + <click selector="{{StorefrontBundledSection.addToCart}}" stepKey="clickCustomizeAndAddToCart"/> + <click selector="{{StorefrontBundledSection.addToCartConfigured}}" stepKey="clickAddBundleProductToCart"/> + <waitForElementVisible selector="{{StorefrontMinicartSection.productCount}}" stepKey="waitProductCount"/> + <see userInput="You added {{productName}} to your shopping cart." selector="{{StorefrontMessagesSection.success}}" stepKey="seeSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/StorefrontAddBundleProductFromProductToCartWithMultiOptionActionGroup.xml b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/StorefrontAddBundleProductFromProductToCartWithMultiOptionActionGroup.xml new file mode 100644 index 0000000000000..49adf670b4c98 --- /dev/null +++ b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/StorefrontAddBundleProductFromProductToCartWithMultiOptionActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontAddBundleProductFromProductToCartWithMultiOptionActionGroup" extends="StorefrontAddBundleProductFromProductToCartActionGroup"> + <annotations> + <description>Selects a Bundled Product option on the Bundled Product page. PLEASE NOTE: The Quantity selection is not available in the Action Group.</description> + </annotations> + <arguments> + <argument name="optionName" type="string"/> + <argument name="value" type="string"/> + </arguments> + + <selectOption selector="{{StorefrontBundledSection.multiselectOptionFourProducts(optionName)}}" userInput="{{value}}" stepKey="selectValue" before="clickAddBundleProductToCart"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/StorefrontAddCategoryBundleProductToCartActionGroup.xml b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/StorefrontAddCategoryBundleProductToCartActionGroup.xml new file mode 100644 index 0000000000000..bf0e7068fbbde --- /dev/null +++ b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/StorefrontAddCategoryBundleProductToCartActionGroup.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontAddCategoryBundleProductToCartActionGroup"> + <annotations> + <description>Adds a Bundled Product to the Cart from the Category page.</description> + </annotations> + <arguments> + <argument name="product"/> + <argument name="quantity" defaultValue="1" type="string"/> + </arguments> + + <moveMouseOver selector="{{StorefrontCategoryProductSection.ProductInfoByName(product.name)}}" stepKey="moveMouseOverProduct"/> + <click selector="{{StorefrontCategoryProductSection.ProductAddToCartByName(product.name)}}" stepKey="clickAddToCart"/> + <waitForPageLoad time="30" stepKey="waitForPageLoad1"/> + <click selector="{{StorefrontBundleProductActionSection.customizeAndAddToCartButton}}" stepKey="clickCustomizeAndAddToCart"/> + <waitForPageLoad time="30" stepKey="waitForPageLoad2"/> + <fillField selector="{{StorefrontBundleProductActionSection.quantityField}}" userInput="{{quantity}}" stepKey="fillBundleProductQuantity"/> + <click selector="{{StorefrontBundleProductActionSection.addToCartButton}}" stepKey="clickAddBundleProductToCart"/> + <waitForPageLoad time="30" stepKey="waitForPageLoad3"/> + <waitForText userInput="{{quantity}}" selector="{{StorefrontMinicartSection.productCount}}" time="30" stepKey="assertProductCount"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/StorefrontProductCartActionGroup.xml b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/StorefrontProductCartActionGroup.xml deleted file mode 100644 index b260068dedf7c..0000000000000 --- a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/StorefrontProductCartActionGroup.xml +++ /dev/null @@ -1,77 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <!-- Add Bundle Product to Cart from the category page with specified quantity to cart --> - <actionGroup name="StorefrontAddCategoryBundleProductToCartActionGroup"> - <annotations> - <description>Adds a Bundled Product to the Cart from the Category page.</description> - </annotations> - <arguments> - <argument name="product"/> - <argument name="quantity" defaultValue="1" type="string"/> - </arguments> - - <moveMouseOver selector="{{StorefrontCategoryProductSection.ProductInfoByName(product.name)}}" stepKey="moveMouseOverProduct"/> - <click selector="{{StorefrontCategoryProductSection.ProductAddToCartByName(product.name)}}" stepKey="clickAddToCart"/> - <waitForPageLoad time="30" stepKey="waitForPageLoad1"/> - <click selector="{{StorefrontBundleProductActionSection.customizeAndAddToCartButton}}" stepKey="clickCustomizeAndAddToCart"/> - <waitForPageLoad time="30" stepKey="waitForPageLoad2"/> - <fillField selector="{{StorefrontBundleProductActionSection.quantityField}}" userInput="{{quantity}}" stepKey="fillBundleProductQuantity"/> - <click selector="{{StorefrontBundleProductActionSection.addToCartButton}}" stepKey="clickAddBundleProductToCart"/> - <waitForPageLoad time="30" stepKey="waitForPageLoad3"/> - <waitForText userInput="{{quantity}}" selector="{{StorefrontMinicartSection.productCount}}" time="30" stepKey="assertProductCount"/> - </actionGroup> - - <!-- Add Bundle Product to Cart from the category page --> - <actionGroup name="StorefrontAddBundleProductFromCategoryToCartActionGroup"> - <annotations> - <description>Adds a Bundled Product to the Cart from the Product page. PLEASE NOTE: The Quantity selection is not available in the Action Group.</description> - </annotations> - <arguments> - <argument name="productName" type="string"/> - </arguments> - - <moveMouseOver selector="{{StorefrontCategoryProductSection.ProductTitleByName(productName)}}" stepKey="moveMouseOverProduct"/> - <click selector="{{StorefrontCategoryProductSection.ProductTitleByName(productName)}}" stepKey="openProductPage"/> - <waitForPageLoad time="30" stepKey="waitForBundleProductPageLoad"/> - <click selector="{{StorefrontBundledSection.addToCart}}" stepKey="clickCustomizeAndAddToCart"/> - <click selector="{{StorefrontBundledSection.addToCartConfigured}}" stepKey="clickAddBundleProductToCart"/> - <waitForElementVisible selector="{{StorefrontMinicartSection.productCount}}" stepKey="waitProductCount"/> - <see userInput="You added {{productName}} to your shopping cart." selector="{{StorefrontMessagesSection.success}}" stepKey="seeSuccessMessage"/> - </actionGroup> - - <!-- Add Bundle Product to Cart from product Page--> - <actionGroup name="StorefrontAddBundleProductFromProductToCartActionGroup"> - <annotations> - <description>Adds a Bundled Product to the Cart from the Product page. PLEASE NOTE: The Quantity selection is not available in the Action Group.</description> - </annotations> - <arguments> - <argument name="productName" type="string"/> - </arguments> - - <click selector="{{StorefrontBundledSection.addToCart}}" stepKey="clickCustomizeAndAddToCart"/> - <click selector="{{StorefrontBundledSection.addToCartConfigured}}" stepKey="clickAddBundleProductToCart"/> - <waitForElementVisible selector="{{StorefrontMinicartSection.productCount}}" stepKey="waitProductCount"/> - <see userInput="You added {{productName}} to your shopping cart." selector="{{StorefrontMessagesSection.success}}" stepKey="seeSuccessMessage"/> - </actionGroup> - - <!-- Add Bundled Product to Cart with selected multiselect option--> - <actionGroup name="StorefrontAddBundleProductFromProductToCartWithMultiOption" extends="StorefrontAddBundleProductFromProductToCartActionGroup"> - <annotations> - <description>Selects a Bundled Product option on the Bundled Product page. PLEASE NOTE: The Quantity selection is not available in the Action Group.</description> - </annotations> - <arguments> - <argument name="optionName" type="string"/> - <argument name="value" type="string"/> - </arguments> - - <selectOption selector="{{StorefrontBundledSection.multiselectOptionFourProducts(optionName)}}" userInput="{{value}}" stepKey="selectValue" before="clickAddBundleProductToCart"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AdminBundleProductActionGroup.xml b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/ViewBundleProductInAdminGridActionGroup.xml similarity index 50% rename from app/code/Magento/Bundle/Test/Mftf/ActionGroup/AdminBundleProductActionGroup.xml rename to app/code/Magento/Bundle/Test/Mftf/ActionGroup/ViewBundleProductInAdminGridActionGroup.xml index e49126f4cf275..96179b49206c8 100644 --- a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AdminBundleProductActionGroup.xml +++ b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/ViewBundleProductInAdminGridActionGroup.xml @@ -7,36 +7,7 @@ --> <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <!--Fill main fields in create product form--> - <actionGroup name="fillMainBundleProductForm"> - <annotations> - <description>Fills the Name, SKU and Stock Status fields.</description> - </annotations> - <arguments> - <argument name="product" defaultValue="BundleProduct"/> - </arguments> - - <fillField selector="{{AdminProductFormSection.productName}}" userInput="{{product.name}}" stepKey="fillProductSku"/> - <fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="fillProductName"/> - <selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="{{product.status}}" stepKey="selectStockStatus"/> - </actionGroup> - - <!--Check that required fields are actually required--> - <actionGroup name="checkRequiredFieldsInBundleProductForm"> - <annotations> - <description>Clears the Name and SKU fields when adding a Product and then verifies that they are required after attempting to Save.</description> - </annotations> - - <clearField selector="{{AdminProductFormSection.productName}}" stepKey="clearProductSku"/> - <clearField selector="{{AdminProductFormSection.productSku}}" stepKey="clearProductName"/> - <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveButton"/> - <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Product" stepKey="seeStillOnEditPage"/> - <see selector="{{AdminProductFormSection.fieldError('name')}}" userInput="This is a required field." stepKey="seeNameRequired"/> - <see selector="{{AdminProductFormSection.fieldError('sku')}}" userInput="This is a required field." stepKey="seeSkuRequired"/> - </actionGroup> - - <!--Filter product grid and see expected product--> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="viewBundleProductInAdminGrid"> <annotations> <description>Clears the Grid Filters on the Catalog Grid page and applies Filter by Name and Sku. Then checks to see if the Product exists in the 1st row. Then clears the Grid Filters again for future Tests.</description> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminAddBundleItemsTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminAddBundleItemsTest.xml index 401d360a34c64..f2cd278451724 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminAddBundleItemsTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminAddBundleItemsTest.xml @@ -64,7 +64,7 @@ <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty2"/> <!--Fill out ancillary data on bundle product--> - <actionGroup ref="AncillaryPrepBundleProduct" stepKey="createBundledProductForTwoSimpleProducts"> + <actionGroup ref="AncillaryPrepBundleProductActionGroup" stepKey="createBundledProductForTwoSimpleProducts"> <argument name="bundleProduct" value="BundleProduct"/> </actionGroup> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminCreateAndEditBundleProductSettingsTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminCreateAndEditBundleProductSettingsTest.xml index 42584a31651d7..2418668235262 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminCreateAndEditBundleProductSettingsTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminCreateAndEditBundleProductSettingsTest.xml @@ -47,10 +47,10 @@ </actionGroup> <!-- Fill all main fields --> - <actionGroup ref="fillMainBundleProductForm" stepKey="fillMainProductFields"/> + <actionGroup ref="FillMainBundleProductFormActionGroup" stepKey="fillMainProductFields"/> <!-- Add the bundle option to the product --> - <actionGroup ref="addBundleOptionWithOneProduct" stepKey="addBundleOption"> + <actionGroup ref="AddBundleOptionWithOneProductActionGroup" stepKey="addBundleOption"> <argument name="x" value="0"/> <argument name="n" value="1"/> <argument name="prodOneSku" value="$$createSimpleProduct.sku$$"/> @@ -189,10 +189,10 @@ </actionGroup> <!-- Fill all main fields --> - <actionGroup ref="fillMainBundleProductForm" stepKey="fillMainProductFields"/> + <actionGroup ref="FillMainBundleProductFormActionGroup" stepKey="fillMainProductFields"/> <!-- Add first bundle option to the product --> - <actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addFirstBundleOption"> + <actionGroup ref="AddBundleOptionWithTwoProductsActionGroup" stepKey="addFirstBundleOption"> <argument name="x" value="0"/> <argument name="n" value="1"/> <argument name="prodOneSku" value="$$createFirstSimpleProduct.sku$$"/> @@ -202,7 +202,7 @@ </actionGroup> <!-- Add second bundle option to the product --> - <actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addSecondBundleOption"> + <actionGroup ref="AddBundleOptionWithTwoProductsActionGroup" stepKey="addSecondBundleOption"> <argument name="x" value="1"/> <argument name="n" value="2"/> <argument name="prodOneSku" value="$$createFirstSimpleProduct.sku$$"/> @@ -212,7 +212,7 @@ </actionGroup> <!-- Add third bundle option to the product --> - <actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addThirdBundleOption"> + <actionGroup ref="AddBundleOptionWithTwoProductsActionGroup" stepKey="addThirdBundleOption"> <argument name="x" value="2"/> <argument name="n" value="3"/> <argument name="prodOneSku" value="$$createFirstSimpleProduct.sku$$"/> @@ -238,7 +238,7 @@ </actionGroup> <!-- Remove second option --> - <actionGroup ref="deleteBundleOptionByIndex" stepKey="deleteSecondOption"> + <actionGroup ref="DeleteBundleOptionByIndexActionGroup" stepKey="deleteSecondOption"> <argument name="deleteIndex" value="1"/> </actionGroup> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteABundleProduct.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteABundleProduct.xml index 86db6f372b5f8..0b91141f9369a 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteABundleProduct.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteABundleProduct.xml @@ -53,7 +53,7 @@ <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty2"/> <!--Fill out ancillary data on bundle product--> - <actionGroup ref="AncillaryPrepBundleProduct" stepKey="createBundledProductForTwoSimpleProducts"/> + <actionGroup ref="AncillaryPrepBundleProductActionGroup" stepKey="createBundledProductForTwoSimpleProducts"/> <!--Save the product--> <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveButton"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminFilterProductListByBundleProduct.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminFilterProductListByBundleProduct.xml index 40a6e1b75c60a..bb1893f69d785 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminFilterProductListByBundleProduct.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminFilterProductListByBundleProduct.xml @@ -53,7 +53,7 @@ <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty2"/> <!--Fill out ancillary data on bundle product--> - <actionGroup ref="AncillaryPrepBundleProduct" stepKey="createBundledProductForTwoSimpleProducts"/> + <actionGroup ref="AncillaryPrepBundleProductActionGroup" stepKey="createBundledProductForTwoSimpleProducts"/> <!--Save the product--> <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveButton"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminMassDeleteBundleProducts.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminMassDeleteBundleProducts.xml index 2f891fcc8f169..16a109032556b 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminMassDeleteBundleProducts.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminMassDeleteBundleProducts.xml @@ -61,7 +61,7 @@ <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty2"/> <!--Fill out ancillary data on bundle product--> - <actionGroup ref="AncillaryPrepBundleProduct" stepKey="createBundledProductForTwoSimpleProducts"> + <actionGroup ref="AncillaryPrepBundleProductActionGroup" stepKey="createBundledProductForTwoSimpleProducts"> <argument name="bundleProduct" value="BundleProduct"/> </actionGroup> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminProductBundleCreationTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminProductBundleCreationTest.xml index 1f46e1fc9f0b1..634d6bcf53547 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminProductBundleCreationTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminProductBundleCreationTest.xml @@ -61,7 +61,7 @@ <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty2"/> <!--Create a bundle product with ancillary data--> - <actionGroup ref="CreateBasicBundleProduct" stepKey="createBundledProduct"> + <actionGroup ref="CreateBasicBundleProductActionGroup" stepKey="createBundledProduct"> <argument name="bundleProduct" value="BundleProduct"/> </actionGroup> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/BundleProductFixedPricingTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/BundleProductFixedPricingTest.xml index c922b981aecd9..08763ea67da00 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/BundleProductFixedPricingTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/BundleProductFixedPricingTest.xml @@ -63,7 +63,7 @@ <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty2"/> <!--Fill out ancillary data on bundle product--> - <actionGroup ref="AncillaryPrepBundleProduct" stepKey="createBundledProductForTwoSimpleProducts"> + <actionGroup ref="AncillaryPrepBundleProductActionGroup" stepKey="createBundledProductForTwoSimpleProducts"> <argument name="bundleProduct" value="BundleProduct"/> </actionGroup> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/BundleProductWithTierPriceInCartTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/BundleProductWithTierPriceInCartTest.xml index 46c6114637af6..1536eadfe1329 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/BundleProductWithTierPriceInCartTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/BundleProductWithTierPriceInCartTest.xml @@ -37,8 +37,8 @@ </after> <amOnPage url="{{AdminProductCreatePage.url(BundleProduct.set, BundleProduct.type)}}" stepKey="goToBundleProductCreationPage"/> <waitForPageLoad stepKey="waitForBundleProductCreatePageToLoad"/> - <actionGroup ref="fillMainBundleProductForm" stepKey="fillMainFieldsForBundle"/> - <actionGroup ref="addBundleOptionWithOneProduct" stepKey="addBundleOption1"> + <actionGroup ref="FillMainBundleProductFormActionGroup" stepKey="fillMainFieldsForBundle"/> + <actionGroup ref="AddBundleOptionWithOneProductActionGroup" stepKey="addBundleOption1"> <argument name="x" value="0"/> <argument name="n" value="1"/> <argument name="prodOneSku" value="$$simpleProduct1.sku$$"/> @@ -46,7 +46,7 @@ <argument name="optionTitle" value="Option1"/> <argument name="inputType" value="checkbox"/> </actionGroup> - <actionGroup ref="addBundleOptionWithOneProduct" stepKey="addBundleOption2"> + <actionGroup ref="AddBundleOptionWithOneProductActionGroup" stepKey="addBundleOption2"> <argument name="x" value="1"/> <argument name="n" value="2"/> <argument name="prodOneSku" value="$$simpleProduct2.sku$$"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/CurrencyChangingBundleProductInCartTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/CurrencyChangingBundleProductInCartTest.xml index ded8bb3c83337..42d8ab522787b 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/CurrencyChangingBundleProductInCartTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/CurrencyChangingBundleProductInCartTest.xml @@ -46,9 +46,9 @@ <!--Go to bundle product creation page--> <amOnPage url="{{AdminProductCreatePage.url(BundleProduct.set, BundleProduct.type)}}" stepKey="goToBundleProductCreationPage"/> <waitForPageLoad stepKey="waitForBundleProductCreatePageToLoad"/> - <actionGroup ref="fillMainBundleProductForm" stepKey="fillMainFieldsForBundle"/> + <actionGroup ref="FillMainBundleProductFormActionGroup" stepKey="fillMainFieldsForBundle"/> <!-- Add Option, a "Radio Buttons" type option --> - <actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addBundleOptionWithTwoProducts2"> + <actionGroup ref="AddBundleOptionWithTwoProductsActionGroup" stepKey="addBundleOptionWithTwoProducts2"> <argument name="x" value="0"/> <argument name="n" value="1"/> <argument name="prodOneSku" value="$$simpleProduct1.sku$$"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/EnableDisableBundleProductStatusTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/EnableDisableBundleProductStatusTest.xml index 0cfd1f99a8ce0..16e64c5584450 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/EnableDisableBundleProductStatusTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/EnableDisableBundleProductStatusTest.xml @@ -59,7 +59,7 @@ <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty2"/> <!--Fill out ancillary data on bundle product--> - <actionGroup ref="AncillaryPrepBundleProduct" stepKey="createBundledProductForTwoSimpleProducts"> + <actionGroup ref="AncillaryPrepBundleProductActionGroup" stepKey="createBundledProductForTwoSimpleProducts"> <argument name="bundleProduct" value="BundleProduct"/> </actionGroup> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/MassEnableDisableBundleProductsTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/MassEnableDisableBundleProductsTest.xml index ff192538637ef..713262e6ada01 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/MassEnableDisableBundleProductsTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/MassEnableDisableBundleProductsTest.xml @@ -60,7 +60,7 @@ <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '0')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty1"/> <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty2"/> - <actionGroup ref="AncillaryPrepBundleProduct" stepKey="createBundledProductForTwoSimpleProducts"/> + <actionGroup ref="AncillaryPrepBundleProductActionGroup" stepKey="createBundledProductForTwoSimpleProducts"/> <!--Save the product--> <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveButton"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAddBundleOptionsToCartTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAddBundleOptionsToCartTest.xml index a1630128638d9..fe20044e9ae2a 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAddBundleOptionsToCartTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAddBundleOptionsToCartTest.xml @@ -62,7 +62,7 @@ </actionGroup> <!-- Add Option One, a "Checkbox" type option, with tree products --> - <actionGroup ref="addBundleOptionWithTreeProducts" stepKey="addBundleOptionWithTreeProducts"> + <actionGroup ref="AddBundleOptionWithThreeProductsActionGroup" stepKey="addBundleOptionWithTreeProducts"> <argument name="x" value="0"/> <argument name="n" value="1"/> <argument name="prodOneSku" value="$$simpleProduct1.sku$$"/> @@ -73,7 +73,7 @@ </actionGroup> <!-- Add Option Two, a "Radio Buttons" type option, with one product --> - <actionGroup ref="addBundleOptionWithOneProduct" stepKey="addBundleOptionWithOneProduct"> + <actionGroup ref="AddBundleOptionWithOneProductActionGroup" stepKey="addBundleOptionWithOneProduct"> <argument name="x" value="1"/> <argument name="n" value="2"/> <argument name="prodOneSku" value="$$simpleProduct4.sku$$"/> @@ -83,7 +83,7 @@ </actionGroup> <!-- Add Option Tree, a "Checkbox" type option, with six products --> - <actionGroup ref="addBundleOptionWithSixProducts" stepKey="addBundleOptionWithSixProducts"> + <actionGroup ref="AddBundleOptionWithSixProductsActionGroup" stepKey="addBundleOptionWithSixProducts"> <argument name="x" value="2"/> <argument name="n" value="3"/> <argument name="prodOneSku" value="$$simpleProduct5.sku$$"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleCartTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleCartTest.xml index 695c3a8bf7dbb..4c2a25977b5b4 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleCartTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleCartTest.xml @@ -40,7 +40,7 @@ </actionGroup> <!-- Add Option One, a "Drop-down" type option --> - <actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addBundleOptionWithTwoProducts1"> + <actionGroup ref="AddBundleOptionWithTwoProductsActionGroup" stepKey="addBundleOptionWithTwoProducts1"> <argument name="x" value="0"/> <argument name="n" value="1"/> <argument name="prodOneSku" value="$$simpleProduct1.sku$$"/> @@ -50,7 +50,7 @@ </actionGroup> <!-- Add Option Two, a "Radio Buttons" type option --> - <actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addBundleOptionWithTwoProducts2"> + <actionGroup ref="AddBundleOptionWithTwoProductsActionGroup" stepKey="addBundleOptionWithTwoProducts2"> <argument name="x" value="1"/> <argument name="n" value="2"/> <argument name="prodOneSku" value="$$simpleProduct1.sku$$"/> @@ -60,7 +60,7 @@ </actionGroup> <!-- Add Option Three, a "Checkbox" type option --> - <actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addBundleOptionWithTwoProducts3"> + <actionGroup ref="AddBundleOptionWithTwoProductsActionGroup" stepKey="addBundleOptionWithTwoProducts3"> <argument name="x" value="2"/> <argument name="n" value="3"/> <argument name="prodOneSku" value="$$simpleProduct1.sku$$"/> @@ -70,7 +70,7 @@ </actionGroup> <!-- Add Option Four, a "Multi Select" type option --> - <actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addBundleOptionWithTwoProducts4"> + <actionGroup ref="AddBundleOptionWithTwoProductsActionGroup" stepKey="addBundleOptionWithTwoProducts4"> <argument name="x" value="3"/> <argument name="n" value="4"/> <argument name="prodOneSku" value="$$simpleProduct1.sku$$"/> @@ -157,7 +157,7 @@ </actionGroup> <!-- Add Option One, a "Drop-down" type option --> - <actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addBundleOptionWithTwoProducts1"> + <actionGroup ref="AddBundleOptionWithTwoProductsActionGroup" stepKey="addBundleOptionWithTwoProducts1"> <argument name="x" value="0"/> <argument name="n" value="1"/> <argument name="prodOneSku" value="$$simpleProduct1.sku$$"/> @@ -167,7 +167,7 @@ </actionGroup> <!-- Add Option Two, a "Radio Buttons" type option --> - <actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addBundleOptionWithTwoProducts2"> + <actionGroup ref="AddBundleOptionWithTwoProductsActionGroup" stepKey="addBundleOptionWithTwoProducts2"> <argument name="x" value="1"/> <argument name="n" value="2"/> <argument name="prodOneSku" value="$$simpleProduct1.sku$$"/> @@ -177,7 +177,7 @@ </actionGroup> <!-- Add Option Three, a "Checkbox" type option --> - <actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addBundleOptionWithTwoProducts3"> + <actionGroup ref="AddBundleOptionWithTwoProductsActionGroup" stepKey="addBundleOptionWithTwoProducts3"> <argument name="x" value="2"/> <argument name="n" value="3"/> <argument name="prodOneSku" value="$$simpleProduct1.sku$$"/> @@ -187,7 +187,7 @@ </actionGroup> <!-- Add Option Four, a "Multi Select" type option --> - <actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addBundleOptionWithTwoProducts4"> + <actionGroup ref="AddBundleOptionWithTwoProductsActionGroup" stepKey="addBundleOptionWithTwoProducts4"> <argument name="x" value="3"/> <argument name="n" value="4"/> <argument name="prodOneSku" value="$$simpleProduct1.sku$$"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleProductDetailsTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleProductDetailsTest.xml index d7394b2dbf32e..2b77e8c5ae338 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleProductDetailsTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleProductDetailsTest.xml @@ -68,7 +68,7 @@ <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty2"/> <!--Create a basic bundle product--> - <actionGroup ref="CreateBasicBundleProduct" stepKey="createBundledProductForTwoSimpleProducts"> + <actionGroup ref="CreateBasicBundleProductActionGroup" stepKey="createBundledProductForTwoSimpleProducts"> <argument name="bundleProduct" value="BundleProduct"/> </actionGroup> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleProductShownInCategoryListAndGrid.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleProductShownInCategoryListAndGrid.xml index 88db5b64fa42d..fdaeeb7e2955d 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleProductShownInCategoryListAndGrid.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleProductShownInCategoryListAndGrid.xml @@ -70,7 +70,7 @@ <click selector="{{AdminAddProductsToOptionPanel.addSelectedProducts}}" stepKey="clickAddSelectedBundleProducts"/> <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '0')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty1"/> <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty2"/> - <actionGroup ref="AncillaryPrepBundleProduct" stepKey="createBundledProductForTwoSimpleProducts"/> + <actionGroup ref="AncillaryPrepBundleProductActionGroup" stepKey="createBundledProductForTwoSimpleProducts"/> <!--Save the product--> <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveButton"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontCustomerSelectAndSetBundleOptionsTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontCustomerSelectAndSetBundleOptionsTest.xml index 5e6e891541420..2b322b3e7e200 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontCustomerSelectAndSetBundleOptionsTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontCustomerSelectAndSetBundleOptionsTest.xml @@ -44,7 +44,7 @@ </actionGroup> <!-- Add Option One, a "Drop-down" type option --> - <actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addBundleOptionWithTwoProducts1"> + <actionGroup ref="AddBundleOptionWithTwoProductsActionGroup" stepKey="addBundleOptionWithTwoProducts1"> <argument name="x" value="0"/> <argument name="n" value="1"/> <argument name="prodOneSku" value="$$simpleProduct1.sku$$"/> @@ -56,7 +56,7 @@ <checkOption selector="{{AdminProductFormBundleSection.userDefinedQuantity('0', '1')}}" stepKey="userDefinedQuantitiyOption0Product1"/> <!-- Add Option Two, a "Radio Buttons" type option --> - <actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addBundleOptionWithTwoProducts2"> + <actionGroup ref="AddBundleOptionWithTwoProductsActionGroup" stepKey="addBundleOptionWithTwoProducts2"> <argument name="x" value="1"/> <argument name="n" value="2"/> <argument name="prodOneSku" value="$$simpleProduct1.sku$$"/> @@ -68,7 +68,7 @@ <checkOption selector="{{AdminProductFormBundleSection.userDefinedQuantity('1', '1')}}" stepKey="userDefinedQuantitiyOption1Product1"/> <!-- Add Option Three, a "Checkbox" type option --> - <actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addBundleOptionWithTwoProducts3"> + <actionGroup ref="AddBundleOptionWithTwoProductsActionGroup" stepKey="addBundleOptionWithTwoProducts3"> <argument name="x" value="2"/> <argument name="n" value="3"/> <argument name="prodOneSku" value="$$simpleProduct1.sku$$"/> @@ -78,7 +78,7 @@ </actionGroup> <!-- Add Option Four, a "Multi Select" type option --> - <actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addBundleOptionWithTwoProducts4"> + <actionGroup ref="AddBundleOptionWithTwoProductsActionGroup" stepKey="addBundleOptionWithTwoProducts4"> <argument name="x" value="3"/> <argument name="n" value="4"/> <argument name="prodOneSku" value="$$simpleProduct1.sku$$"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontGoToDetailsPageWhenAddingToCartTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontGoToDetailsPageWhenAddingToCartTest.xml index ccd6a58223b3c..cc7711e99ff1a 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontGoToDetailsPageWhenAddingToCartTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontGoToDetailsPageWhenAddingToCartTest.xml @@ -59,7 +59,7 @@ <click selector="{{AdminAddProductsToOptionPanel.addSelectedProducts}}" stepKey="clickAddSelectedBundleProducts"/> <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '0')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty1"/> <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty2"/> - <actionGroup ref="AncillaryPrepBundleProduct" stepKey="createBundledProductForTwoSimpleProducts"/> + <actionGroup ref="AncillaryPrepBundleProductActionGroup" stepKey="createBundledProductForTwoSimpleProducts"/> <!--Save the product--> <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveButton"/> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml b/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml index 3b60e4b09de28..f360e746a7481 100644 --- a/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml +++ b/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml @@ -593,7 +593,7 @@ <argument name="productName" value="$createBundleProduct.name$"/> <argument name="productUrlKey" value="$createBundleProduct.custom_attributes[url_key]$"/> </actionGroup> - <actionGroup ref="StorefrontAddBundleProductFromProductToCartWithMultiOption" stepKey="addProductToCart"> + <actionGroup ref="StorefrontAddBundleProductFromProductToCartWithMultiOptionActionGroup" stepKey="addProductToCart"> <argument name="productName" value="$createBundleProduct.name$"/> <argument name="optionName" value="$createBundleOption1_1.name$"/> <argument name="value" value="$simpleProduct1.name$"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCartRulesAppliedForProductInCartTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCartRulesAppliedForProductInCartTest.xml index ab085dc5ae137..ec22c1fe489ee 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCartRulesAppliedForProductInCartTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCartRulesAppliedForProductInCartTest.xml @@ -73,7 +73,7 @@ <click selector="{{AdminProductFormBundleSection.categoriesLabel}}" stepKey="clickOnCategoriesLabelToCloseOptions"/> <!-- Add option, a "Radio Buttons" type option, with one product and set fixed price 200--> - <actionGroup ref="addBundleOptionWithOneProduct" stepKey="addBundleOptionWithOneProduct"> + <actionGroup ref="AddBundleOptionWithOneProductActionGroup" stepKey="addBundleOptionWithOneProduct"> <argument name="x" value="0"/> <argument name="n" value="1"/> <argument name="prodOneSku" value="$$simpleProduct.sku$$"/> From a12c1b46576a64595cd366395e8445b100221090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 28 Nov 2019 13:00:30 +0100 Subject: [PATCH 0148/1143] FIX: Issues when building the project (use global AdmincreateUserActionGroup instead of local one. --- .../AdminCreateUserActionGroup.xml | 36 ------------------- ...AnAdminOrderUsingBraintreePaymentTest1.xml | 9 ++--- 2 files changed, 5 insertions(+), 40 deletions(-) delete mode 100644 app/code/Magento/Braintree/Test/Mftf/ActionGroup/AdminCreateUserActionGroup.xml diff --git a/app/code/Magento/Braintree/Test/Mftf/ActionGroup/AdminCreateUserActionGroup.xml b/app/code/Magento/Braintree/Test/Mftf/ActionGroup/AdminCreateUserActionGroup.xml deleted file mode 100644 index 82491f6362573..0000000000000 --- a/app/code/Magento/Braintree/Test/Mftf/ActionGroup/AdminCreateUserActionGroup.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. - */ ---> - -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AdminCreateUserAction"> - <annotations> - <description>Creates a User using the NewAdmin User Entity and User Role Entity. PLEASE NOTE: The Action Group values are Hardcoded.</description> - </annotations> - - <click selector="{{AdminCreateUserSection.create}}" stepKey="clickToCreateNewUser"/> - <waitForPageLoad stepKey="waitForNewUserPageLoad" time="10"/> - <fillField selector="{{AdminCreateUserSection.usernameTextField}}" userInput="{{NewAdmin.username}}" stepKey="enterUserName"/> - <fillField selector="{{AdminCreateUserSection.firstNameTextField}}" userInput="{{NewAdmin.firstName}}" stepKey="enterFirstName"/> - <fillField selector="{{AdminCreateUserSection.lastNameTextField}}" userInput="{{NewAdmin.lastName}}" stepKey="enterLastName"/> - <fillField selector="{{AdminCreateUserSection.emailTextField}}" userInput="{{NewAdmin.email}}" stepKey="enterEmail"/> - <fillField selector="{{AdminCreateUserSection.passwordTextField}}" userInput="{{NewAdmin.password}}" stepKey="enterPassword"/> - <fillField selector="{{AdminCreateUserSection.pwConfirmationTextField}}" userInput="{{NewAdmin.password}}" stepKey="confirmPassword"/> - <fillField selector="{{AdminCreateUserSection.currentPasswordField}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}" stepKey="enterCurrentPassword"/> - <scrollToTopOfPage stepKey="scrollToTopOfPage"/> - <click selector="{{AdminCreateUserSection.userRoleTab}}" stepKey="clickUserRole"/> - <waitForAjaxLoad stepKey="waitForRoles" time="5"/> - <fillField selector="{{AdminCreateRoleSection.roleNameFilterTextField}}" userInput="{{role.name}}" stepKey="filterRole"/> - <click selector="{{AdminCreateRoleSection.searchButton}}" stepKey="clickSearch"/> - <waitForPageLoad stepKey="waitForSearch" time="10"/> - <click selector="{{AdminCreateRoleSection.searchResultFirstRow}}" stepKey="selectRole"/> - <click selector="{{AdminCreateUserSection.saveButton}}" stepKey="clickSaveUser"/> - <waitForPageLoad stepKey="waitForSaveUser" time="10"/> - <see userInput="You saved the user." stepKey="seeSuccessMessage"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Braintree/Test/Mftf/Test/CreateAnAdminOrderUsingBraintreePaymentTest1.xml b/app/code/Magento/Braintree/Test/Mftf/Test/CreateAnAdminOrderUsingBraintreePaymentTest1.xml index 1e134b604d497..67081ca08d97a 100644 --- a/app/code/Magento/Braintree/Test/Mftf/Test/CreateAnAdminOrderUsingBraintreePaymentTest1.xml +++ b/app/code/Magento/Braintree/Test/Mftf/Test/CreateAnAdminOrderUsingBraintreePaymentTest1.xml @@ -21,8 +21,6 @@ <issueId value="MQE-1576"/> </skip> </annotations> - - <before> <!--Login As Admin--> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> @@ -39,7 +37,7 @@ <!--Configure Braintree--> - <actionGroup ref="ConfigureBraintree" stepKey="configureBraintree"/> + <actionGroup ref="ConfigureBraintreeActionGroup" stepKey="configureBraintree"/> <!--Create New Role--> <actionGroup ref="GoToUserRolesActionGroup" stepKey="GoToUserRoles"/> @@ -49,7 +47,10 @@ <!--Create new admin user--> <actionGroup ref="GoToAllUsersActionGroup" stepKey="GoToAllUsers"/> <waitForPageLoad stepKey="waitForUsers" time="15"/> - <actionGroup ref="AdminCreateUserActionGroup" stepKey="AdminCreateNewUser"/> + <actionGroup ref="AdminCreateUserActionGroup" stepKey="AdminCreateNewUser"> + <argument name="role" value="role"/> + <argument name="User" value="NewAdmin"/> + </actionGroup> <!--SignOut--> <actionGroup ref="logout" stepKey="signOutFromAdmin"/> From 96e4a24e00895aa3f58e81cacd6e8dbac4b5cb5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 28 Nov 2019 13:03:02 +0100 Subject: [PATCH 0149/1143] FIX: Issues when building the project (missing rename) --- .../Test/Mftf/ActionGroup/CreateDatabaseBackupActionGroup.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Backup/Test/Mftf/ActionGroup/CreateDatabaseBackupActionGroup.xml b/app/code/Magento/Backup/Test/Mftf/ActionGroup/CreateDatabaseBackupActionGroup.xml index 5d4e4a19509ea..171bdb88dc428 100644 --- a/app/code/Magento/Backup/Test/Mftf/ActionGroup/CreateDatabaseBackupActionGroup.xml +++ b/app/code/Magento/Backup/Test/Mftf/ActionGroup/CreateDatabaseBackupActionGroup.xml @@ -8,7 +8,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="createDatabaseBackup"> + <actionGroup name="CreateDatabaseBackupActionGroup"> <annotations> <description>Creates a Database Backup using provided Backup Entity.</description> </annotations> From 2e810cf830cd285085653c74861c277579b1455b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 28 Nov 2019 13:15:41 +0100 Subject: [PATCH 0150/1143] REFACTOR: Extract Action Groups to separate files (according to MFTF best practices) --- ...listIsPersistedUnderLongTermCookieTest.xml | 8 +- ...sertCustomerWishlistIsEmptyActionGroup.xml | 15 ++ ...ddCategoryProductToWishlistActionGroup.xml | 25 ++++ ...artFromWishlistUsingSidebarActionGroup.xml | 23 +++ ...ustomerAddProductToWishlistActionGroup.xml | 25 ++++ ...tomerCheckProductInWishlistActionGroup.xml | 25 ++++ ...eckProductInWishlistSidebarActionGroup.xml | 24 +++ ...stomerEditProductInWishlistActionGroup.xml | 28 ++++ ...uctFromWishlistUsingSidebarActionGroup.xml | 23 +++ ...efrontCustomerShareWishlistActionGroup.xml | 22 +++ .../StorefrontCustomerWishlistActionGroup.xml | 138 ------------------ .../Mftf/Test/EndToEndB2CLoggedInUserTest.xml | 8 +- ...uctsToCartFromWishlistUsingSidebarTest.xml | 4 +- ...teBundleDynamicProductFromWishlistTest.xml | 4 +- ...leteBundleFixedProductFromWishlistTest.xml | 2 +- ...eteConfigurableProductFromWishlistTest.xml | 2 +- ...veProductsFromWishlistUsingSidebarTest.xml | 4 +- .../Test/StorefrontUpdateWishlistTest.xml | 4 +- .../Test/WishListWithDisabledProductTest.xml | 4 +- 19 files changed, 230 insertions(+), 158 deletions(-) create mode 100644 app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontAssertCustomerWishlistIsEmptyActionGroup.xml create mode 100644 app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerAddCategoryProductToWishlistActionGroup.xml create mode 100644 app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerAddProductToCartFromWishlistUsingSidebarActionGroup.xml create mode 100644 app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerAddProductToWishlistActionGroup.xml create mode 100644 app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerCheckProductInWishlistActionGroup.xml create mode 100644 app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerCheckProductInWishlistSidebarActionGroup.xml create mode 100644 app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerEditProductInWishlistActionGroup.xml create mode 100644 app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerRemoveProductFromWishlistUsingSidebarActionGroup.xml create mode 100644 app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerShareWishlistActionGroup.xml delete mode 100644 app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerWishlistActionGroup.xml diff --git a/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyThatInformationAboutViewingComparisonWishlistIsPersistedUnderLongTermCookieTest.xml b/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyThatInformationAboutViewingComparisonWishlistIsPersistedUnderLongTermCookieTest.xml index dc6f87bef0ba8..0b9938d18d11f 100644 --- a/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyThatInformationAboutViewingComparisonWishlistIsPersistedUnderLongTermCookieTest.xml +++ b/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyThatInformationAboutViewingComparisonWishlistIsPersistedUnderLongTermCookieTest.xml @@ -95,10 +95,10 @@ </actionGroup> <!--The My Wishlist widget displays Simple Product 1 and Simple Product 2--> <amOnPage url="{{StorefrontCategoryPage.url($$createCategory.custom_attributes[url_key]$$)}}" stepKey="openCategoryPageToCheckProductsInWishlistSidebar"/> - <actionGroup ref="StorefrontCustomerCheckProductInWishlistSidebar" stepKey="checkSimpleProductInWishlistSidebar"> + <actionGroup ref="StorefrontCustomerCheckProductInWishlistSidebarActionGroup" stepKey="checkSimpleProductInWishlistSidebar"> <argument name="productVar" value="$$createSimpleProduct$$"/> </actionGroup> - <actionGroup ref="StorefrontCustomerCheckProductInWishlistSidebar" stepKey="checkSecondSimpleProductInWishlistSidebar"> + <actionGroup ref="StorefrontCustomerCheckProductInWishlistSidebarActionGroup" stepKey="checkSecondSimpleProductInWishlistSidebar"> <argument name="productVar" value="$$createSecondSimpleProduct$$"/> </actionGroup> @@ -150,7 +150,7 @@ <actionGroup ref="StorefrontAssertProductInRecentlyViewedWidgetActionGroup" stepKey="checkSimpleProductInRecentlyViewedWidgetAfterLogout"> <argument name="product" value="$$createSimpleProduct$$"/> </actionGroup> - <actionGroup ref="StorefrontCustomerCheckProductInWishlistSidebar" stepKey="checkSimpleProductInWishlistSidebarAfterLogout"> + <actionGroup ref="StorefrontCustomerCheckProductInWishlistSidebarActionGroup" stepKey="checkSimpleProductInWishlistSidebarAfterLogout"> <argument name="productVar" value="$$createSimpleProduct$$"/> </actionGroup> <actionGroup ref="StorefrontAssertProductInRecentlyComparedWidgetActionGroup" stepKey="checkSimpleProductInRecentlyComparedWidgetAfterLogout"> @@ -177,7 +177,7 @@ <amOnPage url="{{StorefrontCategoryPage.url($$createCategory.custom_attributes[url_key]$$)}}" stepKey="openCategoryPageToCheckWidgets"/> <see userInput="Welcome, $$createCustomer.firstname$$ $$createCustomer.lastname$$!" selector="{{StorefrontPanelHeaderSection.WelcomeMessage}}" stepKey="checkWelcomeMessageAfterLogin"/> - <actionGroup ref="StorefrontCustomerCheckProductInWishlistSidebar" stepKey="checkSimpleProductNameInWishlistSidebarAfterLogin"> + <actionGroup ref="StorefrontCustomerCheckProductInWishlistSidebarActionGroup" stepKey="checkSimpleProductNameInWishlistSidebarAfterLogin"> <argument name="productVar" value="$$createSimpleProduct$$"/> </actionGroup> <actionGroup ref="StorefrontAssertProductInRecentlyViewedWidgetActionGroup" stepKey="checkSimpleProductInRecentlyViewedWidgetAfterLogin"> diff --git a/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontAssertCustomerWishlistIsEmptyActionGroup.xml b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontAssertCustomerWishlistIsEmptyActionGroup.xml new file mode 100644 index 0000000000000..fad33a405c5e4 --- /dev/null +++ b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontAssertCustomerWishlistIsEmptyActionGroup.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontAssertCustomerWishlistIsEmptyActionGroup"> + <dontSeeElement selector="{{StorefrontCustomerWishlistProductSection.pager}}" stepKey="checkThatPagerIsAbsent"/> + <see selector="{{StorefrontCustomerWishlistProductSection.wishlistEmpty}}" userInput="You have no items in your wish list." stepKey="checkNoItemsMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerAddCategoryProductToWishlistActionGroup.xml b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerAddCategoryProductToWishlistActionGroup.xml new file mode 100644 index 0000000000000..336841901a7ec --- /dev/null +++ b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerAddCategoryProductToWishlistActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCustomerAddCategoryProductToWishlistActionGroup"> + <annotations> + <description>Adds the provided Product to the Wish List from a Storefront Category page. Validates that the Success Message is present and correct.</description> + </annotations> + <arguments> + <argument name="productVar"/> + </arguments> + + <moveMouseOver selector="{{StorefrontCategoryProductSection.ProductInfoByName(productVar.name)}}" stepKey="addCategoryProductToWishlistMoveMouseOverProduct"/> + <click selector="{{StorefrontCategoryProductSection.ProductAddToWishlistByName(productVar.name)}}" stepKey="addCategoryProductToWishlistClickAddProductToWishlist"/> + <waitForElement selector="{{StorefrontCustomerWishlistSection.successMsg}}" time="30" stepKey="addCategoryProductToWishlistWaitForSuccessMessage"/> + <see selector="{{StorefrontCustomerWishlistSection.successMsg}}" userInput="{{productVar.name}} has been added to your Wish List." stepKey="addCategoryProductToWishlistSeeProductNameAddedToWishlist"/> + <seeCurrentUrlMatches regex="~/wishlist_id/\d+/$~" stepKey="seeCurrentUrlMatches"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerAddProductToCartFromWishlistUsingSidebarActionGroup.xml b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerAddProductToCartFromWishlistUsingSidebarActionGroup.xml new file mode 100644 index 0000000000000..a28a80c57fb67 --- /dev/null +++ b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerAddProductToCartFromWishlistUsingSidebarActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCustomerAddProductToCartFromWishlistUsingSidebarActionGroup"> + <annotations> + <description>Add the provided Product to the Cart from the Wish List side bar menu. Validates that the Success Message is present and correct.</description> + </annotations> + <arguments> + <argument name="product"/> + </arguments> + + <click selector="{{StorefrontCustomerWishlistSidebarSection.ProductAddToCartByName(product.name)}}" stepKey="AddProductToCartFromWishlistUsingSidebarClickAddToCartFromWishlist"/> + <waitForElement selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="AddProductToCartFromWishlistUsingSidebarWaitForSuccessMessage"/> + <see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="You added {{product.name}} to your shopping cart." stepKey="AddProductToCartFromWishlistUsingSidebarSeeProductNameAddedToCartFromWishlist"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerAddProductToWishlistActionGroup.xml b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerAddProductToWishlistActionGroup.xml new file mode 100644 index 0000000000000..69d8365096999 --- /dev/null +++ b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerAddProductToWishlistActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCustomerAddProductToWishlistActionGroup"> + <annotations> + <description>Adds the provided Product to the Wish List from the Storefront Product page. Validates that the Success Message is present and correct.</description> + </annotations> + <arguments> + <argument name="productVar"/> + </arguments> + + <waitForElementVisible selector="{{StorefrontProductInfoMainSection.productAddToWishlist}}" stepKey="WaitForWishList" time="30"/> + <click selector="{{StorefrontProductInfoMainSection.productAddToWishlist}}" stepKey="addProductToWishlistClickAddToWishlist"/> + <waitForElement selector="{{StorefrontCustomerWishlistSection.successMsg}}" time="30" stepKey="addProductToWishlistWaitForSuccessMessage"/> + <see selector="{{StorefrontCustomerWishlistSection.successMsg}}" userInput="{{productVar.name}} has been added to your Wish List. Click here to continue shopping." stepKey="addProductToWishlistSeeProductNameAddedToWishlist"/> + <seeCurrentUrlMatches regex="~/wishlist_id/\d+/$~" stepKey="seeCurrentUrlMatches"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerCheckProductInWishlistActionGroup.xml b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerCheckProductInWishlistActionGroup.xml new file mode 100644 index 0000000000000..7380ee2172532 --- /dev/null +++ b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerCheckProductInWishlistActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCustomerCheckProductInWishlistActionGroup"> + <annotations> + <description>Validates that the provided Product details (Price and Name) are present in the Storefront Customer Dashboard Wish List.</description> + </annotations> + <arguments> + <argument name="productVar"/> + </arguments> + + <waitForElement selector="{{StorefrontCustomerWishlistProductSection.ProductTitleByName(productVar.name)}}" time="30" stepKey="assertWishlistProductName"/> + <see userInput="${{productVar.price}}.00" selector="{{StorefrontCustomerWishlistProductSection.ProductPriceByName(productVar.name)}}" stepKey="AssertWishlistProductPrice"/> + <moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.ProductInfoByName(productVar.name)}}" stepKey="wishlistMoveMouseOverProduct"/> + <seeElement selector="{{StorefrontCustomerWishlistProductSection.ProductAddToCartByName(productVar.name)}}" stepKey="AssertWishlistAddToCart"/> + <seeElement selector="{{StorefrontCustomerWishlistProductSection.ProductImageByName(productVar.name)}}" stepKey="AssertWishlistProductImage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerCheckProductInWishlistSidebarActionGroup.xml b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerCheckProductInWishlistSidebarActionGroup.xml new file mode 100644 index 0000000000000..04277897c0cb2 --- /dev/null +++ b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerCheckProductInWishlistSidebarActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCustomerCheckProductInWishlistSidebarActionGroup"> + <annotations> + <description>Validates that the provided Product details (Name) are present in the Wish List side bar menu.</description> + </annotations> + <arguments> + <argument name="productVar"/> + </arguments> + + <waitForElement selector="{{StorefrontCustomerWishlistSidebarSection.ProductTitleByName(productVar.name)}}" time="30" stepKey="assertWishlistSidebarProductName"/> + <see userInput="${{productVar.price}}.00" selector="{{StorefrontCustomerWishlistSidebarSection.ProductPriceByName(productVar.name)}}" stepKey="AssertWishlistSidebarProductPrice"/> + <seeElement selector="{{StorefrontCustomerWishlistSidebarSection.ProductAddToCartByName(productVar.name)}}" stepKey="AssertWishlistSidebarAddToCart"/> + <seeElement selector="{{StorefrontCustomerWishlistSidebarSection.ProductImageByName(productVar.name)}}" stepKey="AssertWishlistSidebarProductImage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerEditProductInWishlistActionGroup.xml b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerEditProductInWishlistActionGroup.xml new file mode 100644 index 0000000000000..f4fe023411e67 --- /dev/null +++ b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerEditProductInWishlistActionGroup.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCustomerEditProductInWishlistActionGroup"> + <annotations> + <description>Edits the provided Product on the Storefront Wish List page. Fills in the provided Description and Quantity. Validates that the Success Message is present and correct.</description> + </annotations> + <arguments> + <argument name="product"/> + <argument name="description" type="string"/> + <argument name="quantity" type="string"/> + </arguments> + + <moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.ProductInfoByName(product.name)}}" stepKey="mouseOverOnProduct"/> + <fillField selector="{{StorefrontCustomerWishlistProductSection.ProductDescription(product.name)}}" userInput="{{description}}" stepKey="fillDescription"/> + <fillField selector="{{StorefrontCustomerWishlistProductSection.ProductQuantity(product.name)}}" userInput="{{quantity}}" stepKey="fillQuantity"/> + <moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.ProductAddAllToCart}}" stepKey="mouseOver"/> + <click selector="{{StorefrontCustomerWishlistProductSection.ProductUpdateWishList}}" stepKey="submitUpdateWishlist"/> + <see selector="{{StorefrontCustomerWishlistProductSection.ProductSuccessUpdateMessage}}" userInput="{{product.name}} has been updated in your Wish List." stepKey="successMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerRemoveProductFromWishlistUsingSidebarActionGroup.xml b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerRemoveProductFromWishlistUsingSidebarActionGroup.xml new file mode 100644 index 0000000000000..a563e57c25230 --- /dev/null +++ b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerRemoveProductFromWishlistUsingSidebarActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCustomerRemoveProductFromWishlistUsingSidebarActionGroup"> + <annotations> + <description>Removes the provided Product from the Wish List side bar menu. Validates that the Success Message is present and correct.</description> + </annotations> + <arguments> + <argument name="product"/> + </arguments> + + <click selector="{{StorefrontCustomerWishlistSidebarSection.ProductRemoveByName(product.name)}}" stepKey="RemoveProductFromWishlistUsingSidebarClickRemoveItemFromWishlist"/> + <waitForElement selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="RemoveProductFromWishlistUsingSidebarWaitForSuccessMessage"/> + <see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="{{product.name}} has been removed from your Wish List." stepKey="RemoveProductFromWishlistUsingSidebarSeeProductNameRemovedFromWishlist"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerShareWishlistActionGroup.xml b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerShareWishlistActionGroup.xml new file mode 100644 index 0000000000000..1f7ac9fc85f50 --- /dev/null +++ b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerShareWishlistActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCustomerShareWishlistActionGroup"> + <annotations> + <description>Shares the Wish List from the Storefront Wish List page. PLEASE NOTE: The details for sharing are Hardcoded using 'Wishlist'.</description> + </annotations> + + <click selector="{{StorefrontCustomerWishlistProductSection.productShareWishList}}" stepKey="clickMyWishListButton"/> + <fillField userInput="{{Wishlist.shareInfo_emails}}" selector="{{StorefrontCustomerWishlistShareSection.ProductShareWishlistEmail}}" stepKey="fillEmailsForShare"/> + <fillField userInput="{{Wishlist.shareInfo_message}}" selector="{{StorefrontCustomerWishlistShareSection.ProductShareWishlistTextMessage}}" stepKey="fillShareMessage"/> + <click selector="{{StorefrontCustomerWishlistShareSection.ProductShareWishlistButton}}" stepKey="sendWishlist"/> + <see selector="{{StorefrontCustomerWishlistProductSection.productSuccessShareMessage}}" userInput="Your wish list has been shared." stepKey="successMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerWishlistActionGroup.xml b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerWishlistActionGroup.xml deleted file mode 100644 index 4c1c088c102cd..0000000000000 --- a/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerWishlistActionGroup.xml +++ /dev/null @@ -1,138 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <!-- Add Product to wishlist from the category page and check message --> - <actionGroup name="StorefrontCustomerAddCategoryProductToWishlistActionGroup"> - <annotations> - <description>Adds the provided Product to the Wish List from a Storefront Category page. Validates that the Success Message is present and correct.</description> - </annotations> - <arguments> - <argument name="productVar"/> - </arguments> - - <moveMouseOver selector="{{StorefrontCategoryProductSection.ProductInfoByName(productVar.name)}}" stepKey="addCategoryProductToWishlistMoveMouseOverProduct"/> - <click selector="{{StorefrontCategoryProductSection.ProductAddToWishlistByName(productVar.name)}}" stepKey="addCategoryProductToWishlistClickAddProductToWishlist"/> - <waitForElement selector="{{StorefrontCustomerWishlistSection.successMsg}}" time="30" stepKey="addCategoryProductToWishlistWaitForSuccessMessage"/> - <see selector="{{StorefrontCustomerWishlistSection.successMsg}}" userInput="{{productVar.name}} has been added to your Wish List." stepKey="addCategoryProductToWishlistSeeProductNameAddedToWishlist"/> - <seeCurrentUrlMatches regex="~/wishlist_id/\d+/$~" stepKey="seeCurrentUrlMatches"/> - </actionGroup> - - <!-- Add Product to wishlist from the product page and check message --> - <actionGroup name="StorefrontCustomerAddProductToWishlistActionGroup"> - <annotations> - <description>Adds the provided Product to the Wish List from the Storefront Product page. Validates that the Success Message is present and correct.</description> - </annotations> - <arguments> - <argument name="productVar"/> - </arguments> - - <waitForElementVisible selector="{{StorefrontProductInfoMainSection.productAddToWishlist}}" stepKey="WaitForWishList" time="30"/> - <click selector="{{StorefrontProductInfoMainSection.productAddToWishlist}}" stepKey="addProductToWishlistClickAddToWishlist"/> - <waitForElement selector="{{StorefrontCustomerWishlistSection.successMsg}}" time="30" stepKey="addProductToWishlistWaitForSuccessMessage"/> - <see selector="{{StorefrontCustomerWishlistSection.successMsg}}" userInput="{{productVar.name}} has been added to your Wish List. Click here to continue shopping." stepKey="addProductToWishlistSeeProductNameAddedToWishlist"/> - <seeCurrentUrlMatches regex="~/wishlist_id/\d+/$~" stepKey="seeCurrentUrlMatches"/> - </actionGroup> - - <!-- Check product in wishlist --> - <actionGroup name="StorefrontCustomerCheckProductInWishlist"> - <annotations> - <description>Validates that the provided Product details (Price and Name) are present in the Storefront Customer Dashboard Wish List.</description> - </annotations> - <arguments> - <argument name="productVar"/> - </arguments> - - <waitForElement selector="{{StorefrontCustomerWishlistProductSection.ProductTitleByName(productVar.name)}}" time="30" stepKey="assertWishlistProductName"/> - <see userInput="${{productVar.price}}.00" selector="{{StorefrontCustomerWishlistProductSection.ProductPriceByName(productVar.name)}}" stepKey="AssertWishlistProductPrice"/> - <moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.ProductInfoByName(productVar.name)}}" stepKey="wishlistMoveMouseOverProduct"/> - <seeElement selector="{{StorefrontCustomerWishlistProductSection.ProductAddToCartByName(productVar.name)}}" stepKey="AssertWishlistAddToCart"/> - <seeElement selector="{{StorefrontCustomerWishlistProductSection.ProductImageByName(productVar.name)}}" stepKey="AssertWishlistProductImage"/> - </actionGroup> - - <!-- Check product in wishlist sidebar --> - <actionGroup name="StorefrontCustomerCheckProductInWishlistSidebar"> - <annotations> - <description>Validates that the provided Product details (Name) are present in the Wish List side bar menu.</description> - </annotations> - <arguments> - <argument name="productVar"/> - </arguments> - - <waitForElement selector="{{StorefrontCustomerWishlistSidebarSection.ProductTitleByName(productVar.name)}}" time="30" stepKey="assertWishlistSidebarProductName"/> - <see userInput="${{productVar.price}}.00" selector="{{StorefrontCustomerWishlistSidebarSection.ProductPriceByName(productVar.name)}}" stepKey="AssertWishlistSidebarProductPrice"/> - <seeElement selector="{{StorefrontCustomerWishlistSidebarSection.ProductAddToCartByName(productVar.name)}}" stepKey="AssertWishlistSidebarAddToCart"/> - <seeElement selector="{{StorefrontCustomerWishlistSidebarSection.ProductImageByName(productVar.name)}}" stepKey="AssertWishlistSidebarProductImage"/> - </actionGroup> - - <!--Remove a product from the wishlist using the sidebar --> - <actionGroup name="StorefrontCustomerRemoveProductFromWishlistUsingSidebar"> - <annotations> - <description>Removes the provided Product from the Wish List side bar menu. Validates that the Success Message is present and correct.</description> - </annotations> - <arguments> - <argument name="product"/> - </arguments> - - <click selector="{{StorefrontCustomerWishlistSidebarSection.ProductRemoveByName(product.name)}}" stepKey="RemoveProductFromWishlistUsingSidebarClickRemoveItemFromWishlist"/> - <waitForElement selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="RemoveProductFromWishlistUsingSidebarWaitForSuccessMessage"/> - <see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="{{product.name}} has been removed from your Wish List." stepKey="RemoveProductFromWishlistUsingSidebarSeeProductNameRemovedFromWishlist"/> - </actionGroup> - - <!--Add a product to the cart from the wishlist using the sidebar --> - <actionGroup name="StorefrontCustomerAddProductToCartFromWishlistUsingSidebar"> - <annotations> - <description>Add the provided Product to the Cart from the Wish List side bar menu. Validates that the Success Message is present and correct.</description> - </annotations> - <arguments> - <argument name="product"/> - </arguments> - - <click selector="{{StorefrontCustomerWishlistSidebarSection.ProductAddToCartByName(product.name)}}" stepKey="AddProductToCartFromWishlistUsingSidebarClickAddToCartFromWishlist"/> - <waitForElement selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="AddProductToCartFromWishlistUsingSidebarWaitForSuccessMessage"/> - <see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="You added {{product.name}} to your shopping cart." stepKey="AddProductToCartFromWishlistUsingSidebarSeeProductNameAddedToCartFromWishlist"/> - </actionGroup> - - <actionGroup name="StorefrontCustomerEditProductInWishlist"> - <annotations> - <description>Edits the provided Product on the Storefront Wish List page. Fills in the provided Description and Quantity. Validates that the Success Message is present and correct.</description> - </annotations> - <arguments> - <argument name="product"/> - <argument name="description" type="string"/> - <argument name="quantity" type="string"/> - </arguments> - - <moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.ProductInfoByName(product.name)}}" stepKey="mouseOverOnProduct"/> - <fillField selector="{{StorefrontCustomerWishlistProductSection.ProductDescription(product.name)}}" userInput="{{description}}" stepKey="fillDescription"/> - <fillField selector="{{StorefrontCustomerWishlistProductSection.ProductQuantity(product.name)}}" userInput="{{quantity}}" stepKey="fillQuantity"/> - <moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.ProductAddAllToCart}}" stepKey="mouseOver"/> - <click selector="{{StorefrontCustomerWishlistProductSection.ProductUpdateWishList}}" stepKey="submitUpdateWishlist"/> - <see selector="{{StorefrontCustomerWishlistProductSection.ProductSuccessUpdateMessage}}" userInput="{{product.name}} has been updated in your Wish List." stepKey="successMessage"/> - </actionGroup> - - <!-- Share wishlist --> - <actionGroup name="StorefrontCustomerShareWishlistActionGroup"> - <annotations> - <description>Shares the Wish List from the Storefront Wish List page. PLEASE NOTE: The details for sharing are Hardcoded using 'Wishlist'.</description> - </annotations> - - <click selector="{{StorefrontCustomerWishlistProductSection.productShareWishList}}" stepKey="clickMyWishListButton"/> - <fillField userInput="{{Wishlist.shareInfo_emails}}" selector="{{StorefrontCustomerWishlistShareSection.ProductShareWishlistEmail}}" stepKey="fillEmailsForShare"/> - <fillField userInput="{{Wishlist.shareInfo_message}}" selector="{{StorefrontCustomerWishlistShareSection.ProductShareWishlistTextMessage}}" stepKey="fillShareMessage"/> - <click selector="{{StorefrontCustomerWishlistShareSection.ProductShareWishlistButton}}" stepKey="sendWishlist"/> - <see selector="{{StorefrontCustomerWishlistProductSection.productSuccessShareMessage}}" userInput="Your wish list has been shared." stepKey="successMessage"/> - </actionGroup> - - <!-- Check that wishlist is empty --> - <actionGroup name="StorefrontAssertCustomerWishlistIsEmpty"> - <dontSeeElement selector="{{StorefrontCustomerWishlistProductSection.pager}}" stepKey="checkThatPagerIsAbsent"/> - <see selector="{{StorefrontCustomerWishlistProductSection.wishlistEmpty}}" userInput="You have no items in your wish list." stepKey="checkNoItemsMessage"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml index 7eb42d1fbfed9..d5a5fccb30be3 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml @@ -17,10 +17,10 @@ <actionGroup ref="StorefrontCustomerAddCategoryProductToWishlistActionGroup" after="wishlistGotoCategory1" stepKey="wishlistAddSimpleProduct1ToWishlist"> <argument name="productVar" value="$$createSimpleProduct1$$"/> </actionGroup> - <actionGroup ref="StorefrontCustomerCheckProductInWishlist" after="wishlistAddSimpleProduct1ToWishlist" stepKey="wishlistCheckSimpleProduct1InWishlist"> + <actionGroup ref="StorefrontCustomerCheckProductInWishlistActionGroup" after="wishlistAddSimpleProduct1ToWishlist" stepKey="wishlistCheckSimpleProduct1InWishlist"> <argument name="productVar" value="$$createSimpleProduct1$$"/> </actionGroup> - <actionGroup ref="StorefrontCustomerCheckProductInWishlistSidebar" after="wishlistCheckSimpleProduct1InWishlist" stepKey="wishlistCheckSimpleProduct1InWishlistSidebar"> + <actionGroup ref="StorefrontCustomerCheckProductInWishlistSidebarActionGroup" after="wishlistCheckSimpleProduct1InWishlist" stepKey="wishlistCheckSimpleProduct1InWishlistSidebar"> <argument name="productVar" value="$$createSimpleProduct1$$"/> </actionGroup> @@ -31,10 +31,10 @@ <actionGroup ref="StorefrontCustomerAddProductToWishlistActionGroup" after="wishlistClickSimpleProduct2" stepKey="wishlistAddSimpleProduct2ToWishlist"> <argument name="productVar" value="$$createSimpleProduct2$$"/> </actionGroup> - <actionGroup ref="StorefrontCustomerCheckProductInWishlist" after="wishlistAddSimpleProduct2ToWishlist" stepKey="wishlistCheckSimpleProduct2InWishlist"> + <actionGroup ref="StorefrontCustomerCheckProductInWishlistActionGroup" after="wishlistAddSimpleProduct2ToWishlist" stepKey="wishlistCheckSimpleProduct2InWishlist"> <argument name="productVar" value="$$createSimpleProduct2$$"/> </actionGroup> - <actionGroup ref="StorefrontCustomerCheckProductInWishlistSidebar" after="wishlistCheckSimpleProduct2InWishlist" stepKey="wishlistCheckSimpleProduct2InWishlistSidebar"> + <actionGroup ref="StorefrontCustomerCheckProductInWishlistSidebarActionGroup" after="wishlistCheckSimpleProduct2InWishlist" stepKey="wishlistCheckSimpleProduct2InWishlistSidebar"> <argument name="productVar" value="$$createSimpleProduct2$$"/> </actionGroup> <comment userInput="End of adding products to wishlist" after="wishlistCheckSimpleProduct2InWishlistSidebar" stepKey="endOfAddingProductsToWishlist" /> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontAddProductsToCartFromWishlistUsingSidebarTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontAddProductsToCartFromWishlistUsingSidebarTest.xml index 82c53bc343e51..7240313e8d980 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontAddProductsToCartFromWishlistUsingSidebarTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontAddProductsToCartFromWishlistUsingSidebarTest.xml @@ -53,10 +53,10 @@ <!--Add product to the cart from the Wishlist using the sidebar from the second category page--> <amOnPage url="{{StorefrontCategoryPage.url($$categorySecond.name$$)}}" stepKey="navigateToCategorySecondPage"/> <actionGroup ref="StorefrontSwitchCategoryViewToListMode" stepKey="switchCategoryViewToListMode"/> - <actionGroup ref="StorefrontCustomerCheckProductInWishlistSidebar" stepKey="checkSimpleProduct1InWishlistSidebar"> + <actionGroup ref="StorefrontCustomerCheckProductInWishlistSidebarActionGroup" stepKey="checkSimpleProduct1InWishlistSidebar"> <argument name="productVar" value="$$simpleProduct1$$"/> </actionGroup> - <actionGroup ref="StorefrontCustomerAddProductToCartFromWishlistUsingSidebar" stepKey="addProduct1ToCartFromWishlistUsingSidebar"> + <actionGroup ref="StorefrontCustomerAddProductToCartFromWishlistUsingSidebarActionGroup" stepKey="addProduct1ToCartFromWishlistUsingSidebar"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> <!--Check that a customer on the same page as before--> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeleteBundleDynamicProductFromWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeleteBundleDynamicProductFromWishlistTest.xml index ae65a4171d883..3d190a039920a 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeleteBundleDynamicProductFromWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeleteBundleDynamicProductFromWishlistTest.xml @@ -74,7 +74,7 @@ <actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="openProductFromCategory"> <argument name="productUrlKey" value="$$createBundleProduct.custom_attributes[url_key]$$"/> </actionGroup> - + <!-- Add created product to Wishlist according to dataset and assert add product to wishlist success message --> <actionGroup ref="StorefrontCustomerAddProductToWishlistActionGroup" stepKey="addProductToWishlist"> <argument name="productVar" value="$$createBundleProduct$$"/> @@ -90,6 +90,6 @@ <click selector="{{StorefrontCustomerWishlistProductSection.removeProduct}}" stepKey="clickRemoveButton"/> <!-- Assert Wishlist is empty --> - <actionGroup ref="StorefrontAssertCustomerWishlistIsEmpty" stepKey="assertWishlistIsEmpty"/> + <actionGroup ref="StorefrontAssertCustomerWishlistIsEmptyActionGroup" stepKey="assertWishlistIsEmpty"/> </test> </tests> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeleteBundleFixedProductFromWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeleteBundleFixedProductFromWishlistTest.xml index a0bff949f00f5..cdd86bfecccc8 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeleteBundleFixedProductFromWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeleteBundleFixedProductFromWishlistTest.xml @@ -83,6 +83,6 @@ <click selector="{{StorefrontCustomerWishlistProductSection.removeProduct}}" stepKey="clickRemoveButton"/> <!-- Assert Wishlist is empty --> - <actionGroup ref="StorefrontAssertCustomerWishlistIsEmpty" stepKey="assertWishlistIsEmpty"/> + <actionGroup ref="StorefrontAssertCustomerWishlistIsEmptyActionGroup" stepKey="assertWishlistIsEmpty"/> </test> </tests> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeleteConfigurableProductFromWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeleteConfigurableProductFromWishlistTest.xml index ee66825878728..6a718ebdfcf0f 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeleteConfigurableProductFromWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeleteConfigurableProductFromWishlistTest.xml @@ -145,6 +145,6 @@ <click selector="{{StorefrontCustomerWishlistProductSection.removeProduct}}" stepKey="clickRemoveButton"/> <!-- Assert Wishlist is empty --> - <actionGroup ref="StorefrontAssertCustomerWishlistIsEmpty" stepKey="assertWishlistIsEmpty"/> + <actionGroup ref="StorefrontAssertCustomerWishlistIsEmptyActionGroup" stepKey="assertWishlistIsEmpty"/> </test> </tests> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontRemoveProductsFromWishlistUsingSidebarTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontRemoveProductsFromWishlistUsingSidebarTest.xml index 6c73cb6708ae4..4c44f9b72e86c 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontRemoveProductsFromWishlistUsingSidebarTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontRemoveProductsFromWishlistUsingSidebarTest.xml @@ -54,10 +54,10 @@ <!--Remove product from the Wishlist using the sidebar from the second category page--> <amOnPage url="{{StorefrontCategoryPage.url($$categorySecond.name$$)}}" stepKey="navigateToCategorySecondPage"/> <actionGroup ref="StorefrontSwitchCategoryViewToListMode" stepKey="switchCategoryViewToListMode"/> - <actionGroup ref="StorefrontCustomerCheckProductInWishlistSidebar" stepKey="checkSimpleProduct1InWishlistSidebar"> + <actionGroup ref="StorefrontCustomerCheckProductInWishlistSidebarActionGroup" stepKey="checkSimpleProduct1InWishlistSidebar"> <argument name="productVar" value="$$simpleProduct1$$"/> </actionGroup> - <actionGroup ref="StorefrontCustomerRemoveProductFromWishlistUsingSidebar" stepKey="removeProduct1FromWishlistUsingSidebar"> + <actionGroup ref="StorefrontCustomerRemoveProductFromWishlistUsingSidebarActionGroup" stepKey="removeProduct1FromWishlistUsingSidebar"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> <!--Check that a customer on the same page as before--> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontUpdateWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontUpdateWishlistTest.xml index b8a84a327b58f..08698658588ae 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontUpdateWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontUpdateWishlistTest.xml @@ -43,11 +43,11 @@ <argument name="productVar" value="$$product$$"/> </actionGroup> - <actionGroup ref="StorefrontCustomerCheckProductInWishlist" stepKey="checkProductInWishlist"> + <actionGroup ref="StorefrontCustomerCheckProductInWishlistActionGroup" stepKey="checkProductInWishlist"> <argument name="productVar" value="$$product$$"/> </actionGroup> - <actionGroup ref="StorefrontCustomerEditProductInWishlist" stepKey="updateProductInWishlist"> + <actionGroup ref="StorefrontCustomerEditProductInWishlistActionGroup" stepKey="updateProductInWishlist"> <argument name="product" value="$$product$$"/> <argument name="description" value="some text"/> <argument name="quantity" value="2"/> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/WishListWithDisabledProductTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/WishListWithDisabledProductTest.xml index af216c139e7fe..aca3ebbc6b48c 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/WishListWithDisabledProductTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/WishListWithDisabledProductTest.xml @@ -35,7 +35,7 @@ <actionGroup ref="StorefrontCustomerAddProductToWishlistActionGroup" stepKey="addProductToWishlist"> <argument name="productVar" value="$$createProduct$$"/> </actionGroup> - <actionGroup ref="StorefrontCustomerCheckProductInWishlist" stepKey="checkProductInWishlist"> + <actionGroup ref="StorefrontCustomerCheckProductInWishlistActionGroup" stepKey="checkProductInWishlist"> <argument name="productVar" value="$$createProduct$$"/> </actionGroup> <openNewTab stepKey="openNewTab"/> @@ -45,6 +45,6 @@ <actionGroup ref="saveProductForm" stepKey="saveProduct"/> <closeTab stepKey="closeSecondTab"/> <reloadPage stepKey="refreshPage"/> - <actionGroup ref="StorefrontAssertCustomerWishlistIsEmpty" stepKey="checkProductIsAbsentInWishlistIsEmpty"/> + <actionGroup ref="StorefrontAssertCustomerWishlistIsEmptyActionGroup" stepKey="checkProductIsAbsentInWishlistIsEmpty"/> </test> </tests> From b17b871c9990bc99ae77d1c878173b9ecd8db929 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 28 Nov 2019 13:58:12 +0100 Subject: [PATCH 0151/1143] REFACTOR: Extract Action Groups to separate files (according to MFTF best practices) --- ...ctedUserAddCategoryFromProductPageTest.xml | 6 +-- .../AdminAddNewUserRoleActionGroup.xml | 7 --- ...serRoleWithCustomRoleScopesActionGroup.xml | 17 +++++++ .../AdminAddRestrictedRoleActionGroup.xml | 22 ++++++++++ .../AdminCreateRoleActionGroup.xml | 44 ------------------- .../AdminCreateUserActionGroup.xml | 30 ------------- .../AdminCreateUserWithApiRoleActionGroup.xml | 14 ++++++ .../AdminCreateUserWithRoleActionGroup.xml | 36 +++++++++++++++ .../AdminDeleteCreatedRoleActionGroup.xml | 3 -- .../AdminDeleteCreatedUserActionGroup.xml | 19 +------- .../AdminDeleteCustomUserActionGroup.xml | 33 ++++++++++++++ .../AdminDeleteNewUserActionGroup.xml | 27 ++++++++++++ .../AdminDeleteRoleByRoleNameActionGroup.xml | 14 ++++++ .../AdminDeleteUserActionGroup.xml | 23 ---------- ...minFillUserRoleRequiredDataActionGroup.xml | 20 +++++++++ 15 files changed, 187 insertions(+), 128 deletions(-) create mode 100644 app/code/Magento/User/Test/Mftf/ActionGroup/AdminAddNewUserRoleWithCustomRoleScopesActionGroup.xml create mode 100644 app/code/Magento/User/Test/Mftf/ActionGroup/AdminAddRestrictedRoleActionGroup.xml create mode 100644 app/code/Magento/User/Test/Mftf/ActionGroup/AdminCreateUserWithApiRoleActionGroup.xml create mode 100644 app/code/Magento/User/Test/Mftf/ActionGroup/AdminCreateUserWithRoleActionGroup.xml create mode 100644 app/code/Magento/User/Test/Mftf/ActionGroup/AdminDeleteCustomUserActionGroup.xml create mode 100644 app/code/Magento/User/Test/Mftf/ActionGroup/AdminDeleteNewUserActionGroup.xml create mode 100644 app/code/Magento/User/Test/Mftf/ActionGroup/AdminDeleteRoleByRoleNameActionGroup.xml create mode 100644 app/code/Magento/User/Test/Mftf/ActionGroup/AdminFillUserRoleRequiredDataActionGroup.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRestrictedUserAddCategoryFromProductPageTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRestrictedUserAddCategoryFromProductPageTest.xml index 7b5455951fb27..da93db7ac8e17 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRestrictedUserAddCategoryFromProductPageTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRestrictedUserAddCategoryFromProductPageTest.xml @@ -51,16 +51,16 @@ </after> <!--Create user role--> <comment userInput="Create user role" stepKey="commentCreateUserRole"/> - <actionGroup ref="AdminFillUserRoleRequiredData" stepKey="fillUserRoleRequiredData"> + <actionGroup ref="AdminFillUserRoleRequiredDataActionGroup" stepKey="fillUserRoleRequiredData"> <argument name="User" value="adminRole"/> <argument name="restrictedRole" value="Stores"/> </actionGroup> <click selector="{{AdminEditRoleInfoSection.roleResourcesTab}}" stepKey="clickRoleResourcesTab" /> - <actionGroup ref="AdminAddRestrictedRole" stepKey="addRestrictedRoleStores"> + <actionGroup ref="AdminAddRestrictedRoleActionGroup" stepKey="addRestrictedRoleStores"> <argument name="User" value="adminRole"/> <argument name="restrictedRole" value="Stores"/> </actionGroup> - <actionGroup ref="AdminAddRestrictedRole" stepKey="addRestrictedRoleProducts"> + <actionGroup ref="AdminAddRestrictedRoleActionGroup" stepKey="addRestrictedRoleProducts"> <argument name="User" value="adminRole"/> <argument name="restrictedRole" value="Products"/> </actionGroup> diff --git a/app/code/Magento/User/Test/Mftf/ActionGroup/AdminAddNewUserRoleActionGroup.xml b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminAddNewUserRoleActionGroup.xml index 175f6203350c7..28cbaba4b8241 100644 --- a/app/code/Magento/User/Test/Mftf/ActionGroup/AdminAddNewUserRoleActionGroup.xml +++ b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminAddNewUserRoleActionGroup.xml @@ -38,11 +38,4 @@ <waitForPageLoad stepKey="waitForSaving"/> <see userInput="You saved the role." selector="{{AdminMessagesSection.success}}" stepKey="seeMessage"/> </actionGroup> - - <actionGroup name="AdminAddNewUserRoleWithCustomRoleScopes" extends="AdminAddNewUserRoleActionGroup"> - <arguments> - <argument name="customWebsiteName" type="string"/> - </arguments> - <checkOption selector="{{AdminCreateRoleSection.selectWebsite(customWebsiteName)}}" stepKey="checkWebsite" after="selectRoleResources"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/User/Test/Mftf/ActionGroup/AdminAddNewUserRoleWithCustomRoleScopesActionGroup.xml b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminAddNewUserRoleWithCustomRoleScopesActionGroup.xml new file mode 100644 index 0000000000000..142ed8af09fcf --- /dev/null +++ b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminAddNewUserRoleWithCustomRoleScopesActionGroup.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAddNewUserRoleWithCustomRoleScopesActionGroup" extends="AdminAddNewUserRoleActionGroup"> + <arguments> + <argument name="customWebsiteName" type="string"/> + </arguments> + <checkOption selector="{{AdminCreateRoleSection.selectWebsite(customWebsiteName)}}" stepKey="checkWebsite" after="selectRoleResources"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/User/Test/Mftf/ActionGroup/AdminAddRestrictedRoleActionGroup.xml b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminAddRestrictedRoleActionGroup.xml new file mode 100644 index 0000000000000..37f06b8c14ad8 --- /dev/null +++ b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminAddRestrictedRoleActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAddRestrictedRoleActionGroup" extends="AdminCreateRoleActionGroup"> + <remove keyForRemoval="navigateToNewRole"/> + <remove keyForRemoval="waitForPageLoad1"/> + <remove keyForRemoval="fillRoleName"/> + <remove keyForRemoval="enterPassword"/> + <remove keyForRemoval="clickRoleResourcesTab"/> + <remove keyForRemoval="waitForScopeSelection"/> + <remove keyForRemoval="clickSaveRoleButton"/> + <remove keyForRemoval="waitForPageLoad2"/> + <scrollTo selector="{{AdminEditRoleInfoSection.blockName('restrictedRole')}}" x="0" y="-100" stepKey="scrollToResourceElement" after="selectResourceAccessCustom"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/User/Test/Mftf/ActionGroup/AdminCreateRoleActionGroup.xml b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminCreateRoleActionGroup.xml index 9e8262d5564fb..15deee5fbd049 100644 --- a/app/code/Magento/User/Test/Mftf/ActionGroup/AdminCreateRoleActionGroup.xml +++ b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminCreateRoleActionGroup.xml @@ -29,48 +29,4 @@ <click selector="{{AdminEditRoleInfoSection.saveButton}}" stepKey="clickSaveRoleButton"/> <waitForPageLoad stepKey="waitForPageLoad2"/> </actionGroup> - - <actionGroup name="AdminFillUserRoleRequiredData" extends="AdminCreateRoleActionGroup"> - <remove keyForRemoval="clickRoleResourcesTab"/> - <remove keyForRemoval="waitForScopeSelection"/> - <remove keyForRemoval="selectResourceAccessCustom"/> - <remove keyForRemoval="waitForElementVisible"/> - <remove keyForRemoval="clickContentBlockCheckbox"/> - <remove keyForRemoval="clickSaveRoleButton"/> - <remove keyForRemoval="waitForPageLoad2"/> - </actionGroup> - <actionGroup name="AdminAddRestrictedRole" extends="AdminCreateRoleActionGroup"> - <remove keyForRemoval="navigateToNewRole"/> - <remove keyForRemoval="waitForPageLoad1"/> - <remove keyForRemoval="fillRoleName"/> - <remove keyForRemoval="enterPassword"/> - <remove keyForRemoval="clickRoleResourcesTab"/> - <remove keyForRemoval="waitForScopeSelection"/> - <remove keyForRemoval="clickSaveRoleButton"/> - <remove keyForRemoval="waitForPageLoad2"/> - <scrollTo selector="{{AdminEditRoleInfoSection.blockName('restrictedRole')}}" x="0" y="-100" stepKey="scrollToResourceElement" after="selectResourceAccessCustom"/> - </actionGroup> - - <!--Create new role--> - <actionGroup name="AdminCreateRole"> - <annotations> - <description>Clicks on 'Add New Role'. Fills in the provided details (Role, Resource, Scope and Websites). Clicks on Save. Validates that the Success Message is present and correct.</description> - </annotations> - <arguments> - <argument name="role" type="string" defaultValue=""/> - <argument name="resource" type="string" defaultValue="All"/> - <argument name="scope" type="string" defaultValue="Custom"/> - <argument name="websites" type="string" defaultValue="Main Website"/> - </arguments> - - <click selector="{{AdminCreateRoleSection.create}}" stepKey="clickToAddNewRole"/> - <fillField selector="{{AdminCreateRoleSection.name}}" userInput="{{role.name}}" stepKey="setRoleName"/> - <fillField stepKey="setPassword" selector="{{AdminCreateRoleSection.password}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}"/> - <click selector="{{AdminCreateRoleSection.roleResources}}" stepKey="clickToOpenRoleResources"/> - <waitForPageLoad stepKey="waitForRoleResourcePage" time="5"/> - <click stepKey="checkSales" selector="//a[text()='Sales']"/> - <click selector="{{AdminCreateRoleSection.save}}" stepKey="clickToSaveRole"/> - <waitForPageLoad stepKey="waitForPageLoad" time="10"/> - <see userInput="You saved the role." stepKey="seeSuccessMessage"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/User/Test/Mftf/ActionGroup/AdminCreateUserActionGroup.xml b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminCreateUserActionGroup.xml index 2738ef9f1cb3f..8abb4e9224b0a 100644 --- a/app/code/Magento/User/Test/Mftf/ActionGroup/AdminCreateUserActionGroup.xml +++ b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminCreateUserActionGroup.xml @@ -37,34 +37,4 @@ <waitForPageLoad stepKey="waitForPageLoad2"/> <see userInput="You saved the user." stepKey="seeSuccessMessage"/> </actionGroup> - - <!--Create new user with role--> - <actionGroup name="AdminCreateUserWithRoleActionGroup"> - <annotations> - <description>Goes to the Admin Users grid page. Clicks on Create User. Fills in the provided Role and User.</description> - </annotations> - <arguments> - <argument name="role"/> - <argument name="user" defaultValue="newAdmin"/> - </arguments> - - <amOnPage url="{{AdminNewUserPage.url}}" stepKey="navigateToNewUser"/> - <waitForPageLoad stepKey="waitForUsersPage"/> - <fillField selector="{{AdminCreateUserSection.usernameTextField}}" userInput="{{user.username}}" stepKey="enterUserName"/> - <fillField selector="{{AdminCreateUserSection.firstNameTextField}}" userInput="{{user.firstName}}" stepKey="enterFirstName"/> - <fillField selector="{{AdminCreateUserSection.lastNameTextField}}" userInput="{{user.lastName}}" stepKey="enterLastName"/> - <fillField selector="{{AdminCreateUserSection.emailTextField}}" userInput="{{user.username}}@magento.com" stepKey="enterEmail"/> - <fillField selector="{{AdminCreateUserSection.passwordTextField}}" userInput="{{user.password}}" stepKey="enterPassword"/> - <fillField selector="{{AdminCreateUserSection.pwConfirmationTextField}}" userInput="{{user.password}}" stepKey="confirmPassword"/> - <fillField selector="{{AdminCreateUserSection.currentPasswordField}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}" stepKey="enterCurrentPassword"/> - <scrollToTopOfPage stepKey="scrollToTopOfPage"/> - <click stepKey="clickUserRole" selector="{{AdminCreateUserSection.userRoleTab}}"/> - <click stepKey="chooseRole" selector="{{AdminStoreSection.createdRoleInUserPage(role.name)}}"/> - <click selector="{{AdminCreateUserSection.saveButton}}" stepKey="clickSaveUser"/> - <waitForPageLoad stepKey="waitForSaveTheUser"/> - <see userInput="You saved the user." stepKey="seeSuccessMessage"/> - </actionGroup> - <actionGroup name="AdminCreateUserWithApiRoleActionGroup" extends="AdminCreateUserWithRoleActionGroup"> - <click stepKey="chooseRole" selector="{{AdminCreateUserSection.createdRoleInUserPage(role.rolename)}}"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/User/Test/Mftf/ActionGroup/AdminCreateUserWithApiRoleActionGroup.xml b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminCreateUserWithApiRoleActionGroup.xml new file mode 100644 index 0000000000000..d3f7278765d47 --- /dev/null +++ b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminCreateUserWithApiRoleActionGroup.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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateUserWithApiRoleActionGroup" extends="AdminCreateUserWithRoleActionGroup"> + <click stepKey="chooseRole" selector="{{AdminCreateUserSection.createdRoleInUserPage(role.rolename)}}"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/User/Test/Mftf/ActionGroup/AdminCreateUserWithRoleActionGroup.xml b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminCreateUserWithRoleActionGroup.xml new file mode 100644 index 0000000000000..dd4f181204040 --- /dev/null +++ b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminCreateUserWithRoleActionGroup.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateUserWithRoleActionGroup"> + <annotations> + <description>Goes to the Admin Users grid page. Clicks on Create User. Fills in the provided Role and User.</description> + </annotations> + <arguments> + <argument name="role"/> + <argument name="user" defaultValue="newAdmin"/> + </arguments> + + <amOnPage url="{{AdminNewUserPage.url}}" stepKey="navigateToNewUser"/> + <waitForPageLoad stepKey="waitForUsersPage"/> + <fillField selector="{{AdminCreateUserSection.usernameTextField}}" userInput="{{user.username}}" stepKey="enterUserName"/> + <fillField selector="{{AdminCreateUserSection.firstNameTextField}}" userInput="{{user.firstName}}" stepKey="enterFirstName"/> + <fillField selector="{{AdminCreateUserSection.lastNameTextField}}" userInput="{{user.lastName}}" stepKey="enterLastName"/> + <fillField selector="{{AdminCreateUserSection.emailTextField}}" userInput="{{user.username}}@magento.com" stepKey="enterEmail"/> + <fillField selector="{{AdminCreateUserSection.passwordTextField}}" userInput="{{user.password}}" stepKey="enterPassword"/> + <fillField selector="{{AdminCreateUserSection.pwConfirmationTextField}}" userInput="{{user.password}}" stepKey="confirmPassword"/> + <fillField selector="{{AdminCreateUserSection.currentPasswordField}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}" stepKey="enterCurrentPassword"/> + <scrollToTopOfPage stepKey="scrollToTopOfPage"/> + <click stepKey="clickUserRole" selector="{{AdminCreateUserSection.userRoleTab}}"/> + <click stepKey="chooseRole" selector="{{AdminStoreSection.createdRoleInUserPage(role.name)}}"/> + <click selector="{{AdminCreateUserSection.saveButton}}" stepKey="clickSaveUser"/> + <waitForPageLoad stepKey="waitForSaveTheUser"/> + <see userInput="You saved the user." stepKey="seeSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/User/Test/Mftf/ActionGroup/AdminDeleteCreatedRoleActionGroup.xml b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminDeleteCreatedRoleActionGroup.xml index c1659610feda5..813e22df227c8 100644 --- a/app/code/Magento/User/Test/Mftf/ActionGroup/AdminDeleteCreatedRoleActionGroup.xml +++ b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminDeleteCreatedRoleActionGroup.xml @@ -21,7 +21,4 @@ <waitForPageLoad stepKey="waitForPageLoad"/> <see stepKey="seeSuccessMessage" userInput="You deleted the role."/> </actionGroup> - <actionGroup name="AdminDeleteRoleByRoleNameActionGroup" extends="AdminDeleteCreatedRoleActionGroup"> - <click stepKey="clickToAddNewRole" selector="{{AdminDeleteRoleSection.role(role.rolename)}}"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/User/Test/Mftf/ActionGroup/AdminDeleteCreatedUserActionGroup.xml b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminDeleteCreatedUserActionGroup.xml index 6be5e80ec3e30..0939626660ad0 100644 --- a/app/code/Magento/User/Test/Mftf/ActionGroup/AdminDeleteCreatedUserActionGroup.xml +++ b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminDeleteCreatedUserActionGroup.xml @@ -15,7 +15,7 @@ <arguments> <argument name="user"/> </arguments> - + <amOnPage stepKey="amOnAdminUsersPage" url="{{AdminUsersPage.url}}"/> <click stepKey="openTheUser" selector="{{AdminDeleteUserSection.role(user.username)}}"/> <waitForPageLoad stepKey="waitForSingleUserPageToLoad"/> @@ -26,21 +26,4 @@ <click stepKey="clickToConfirm" selector="{{AdminDeleteUserSection.confirm}}"/> <see stepKey="seeDeleteMessageForUser" userInput="You deleted the user."/> </actionGroup> - <!--Delete User--> - <actionGroup name="AdminDeleteNewUserActionGroup"> - <annotations> - <description>Deletes a User that contains the name 'John'. PLEASE NOTE: The Action Group values are Hardcoded.</description> - </annotations> - <arguments> - <argument name="userName" type="string" defaultValue="John"/> - </arguments> - <click stepKey="clickOnUser" selector="{{AdminDeleteUserSection.theUser(userName)}}"/> - <fillField stepKey="typeCurrentPassword" selector="{{AdminDeleteUserSection.password}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}"/> - <scrollToTopOfPage stepKey="scrollToTop"/> - <click stepKey="clickToDeleteUser" selector="{{AdminDeleteUserSection.delete}}"/> - <waitForPageLoad stepKey="waitForDeletePopupOpen" time="5"/> - <click stepKey="clickToConfirm" selector="{{AdminDeleteUserSection.confirm}}"/> - <waitForPageLoad stepKey="waitForPageLoad" time="10"/> - <see userInput="You deleted the user." stepKey="seeSuccessMessage" /> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/User/Test/Mftf/ActionGroup/AdminDeleteCustomUserActionGroup.xml b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminDeleteCustomUserActionGroup.xml new file mode 100644 index 0000000000000..598d95b8d562c --- /dev/null +++ b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminDeleteCustomUserActionGroup.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminDeleteCustomUserActionGroup"> + <annotations> + <description>Goes to the Admin Users grid page. Deletes the provided User. Validates that the Success Message is present and correct.</description> + </annotations> + <arguments> + <argument name="user"/> + </arguments> + + <amOnPage url="{{AdminUsersPage.url}}" stepKey="navigateToUserGrid"/> + <fillField selector="{{AdminUserGridSection.usernameFilterTextField}}" userInput="{{user.username}}" stepKey="enterUserName"/> + <click selector="{{AdminUserGridSection.searchButton}}" stepKey="clickSearch"/> + <waitForPageLoad stepKey="waitForGridToLoad"/> + <see selector="{{AdminUserGridSection.usernameInFirstRow}}" userInput="{{user.username}}" stepKey="seeUser"/> + <click selector="{{AdminUserGridSection.searchResultFirstRow}}" stepKey="openUserEdit"/> + <waitForPageLoad stepKey="waitForUserEditPageLoad"/> + <fillField selector="{{AdminEditUserSection.currentPasswordField}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}" stepKey="enterThePassword"/> + <click selector="{{AdminMainActionsSection.delete}}" stepKey="deleteUser"/> + <waitForElementVisible selector="{{AdminConfirmationModalSection.message}}" stepKey="waitForConfirmModal"/> + <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmDelete"/> + <waitForPageLoad stepKey="waitForSave"/> + <see selector="{{AdminMessagesSection.success}}" userInput="You deleted the user." stepKey="seeUserDeleteMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/User/Test/Mftf/ActionGroup/AdminDeleteNewUserActionGroup.xml b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminDeleteNewUserActionGroup.xml new file mode 100644 index 0000000000000..a4e5492f8e3e6 --- /dev/null +++ b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminDeleteNewUserActionGroup.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminDeleteNewUserActionGroup"> + <annotations> + <description>Deletes a User that contains the name 'John'. PLEASE NOTE: The Action Group values are Hardcoded.</description> + </annotations> + <arguments> + <argument name="userName" type="string" defaultValue="John"/> + </arguments> + <click stepKey="clickOnUser" selector="{{AdminDeleteUserSection.theUser(userName)}}"/> + <fillField stepKey="typeCurrentPassword" selector="{{AdminDeleteUserSection.password}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}"/> + <scrollToTopOfPage stepKey="scrollToTop"/> + <click stepKey="clickToDeleteUser" selector="{{AdminDeleteUserSection.delete}}"/> + <waitForPageLoad stepKey="waitForDeletePopupOpen" time="5"/> + <click stepKey="clickToConfirm" selector="{{AdminDeleteUserSection.confirm}}"/> + <waitForPageLoad stepKey="waitForPageLoad" time="10"/> + <see userInput="You deleted the user." stepKey="seeSuccessMessage" /> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/User/Test/Mftf/ActionGroup/AdminDeleteRoleByRoleNameActionGroup.xml b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminDeleteRoleByRoleNameActionGroup.xml new file mode 100644 index 0000000000000..82602c007586c --- /dev/null +++ b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminDeleteRoleByRoleNameActionGroup.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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminDeleteRoleByRoleNameActionGroup" extends="AdminDeleteCreatedRoleActionGroup"> + <click stepKey="clickToAddNewRole" selector="{{AdminDeleteRoleSection.role(role.rolename)}}"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/User/Test/Mftf/ActionGroup/AdminDeleteUserActionGroup.xml b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminDeleteUserActionGroup.xml index 084f60dcf8542..67075eb52a678 100644 --- a/app/code/Magento/User/Test/Mftf/ActionGroup/AdminDeleteUserActionGroup.xml +++ b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminDeleteUserActionGroup.xml @@ -27,27 +27,4 @@ <waitForPageLoad stepKey="waitForPageLoad"/> <see stepKey="seeDeleteMessageForUser" userInput="You deleted the user."/> </actionGroup> - - <actionGroup name="AdminDeleteCustomUserActionGroup"> - <annotations> - <description>Goes to the Admin Users grid page. Deletes the provided User. Validates that the Success Message is present and correct.</description> - </annotations> - <arguments> - <argument name="user"/> - </arguments> - - <amOnPage url="{{AdminUsersPage.url}}" stepKey="navigateToUserGrid"/> - <fillField selector="{{AdminUserGridSection.usernameFilterTextField}}" userInput="{{user.username}}" stepKey="enterUserName"/> - <click selector="{{AdminUserGridSection.searchButton}}" stepKey="clickSearch"/> - <waitForPageLoad stepKey="waitForGridToLoad"/> - <see selector="{{AdminUserGridSection.usernameInFirstRow}}" userInput="{{user.username}}" stepKey="seeUser"/> - <click selector="{{AdminUserGridSection.searchResultFirstRow}}" stepKey="openUserEdit"/> - <waitForPageLoad stepKey="waitForUserEditPageLoad"/> - <fillField selector="{{AdminEditUserSection.currentPasswordField}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}" stepKey="enterThePassword"/> - <click selector="{{AdminMainActionsSection.delete}}" stepKey="deleteUser"/> - <waitForElementVisible selector="{{AdminConfirmationModalSection.message}}" stepKey="waitForConfirmModal"/> - <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmDelete"/> - <waitForPageLoad stepKey="waitForSave"/> - <see selector="{{AdminMessagesSection.success}}" userInput="You deleted the user." stepKey="seeUserDeleteMessage"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/User/Test/Mftf/ActionGroup/AdminFillUserRoleRequiredDataActionGroup.xml b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminFillUserRoleRequiredDataActionGroup.xml new file mode 100644 index 0000000000000..236db105fad14 --- /dev/null +++ b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminFillUserRoleRequiredDataActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminFillUserRoleRequiredDataActionGroup" extends="AdminCreateRoleActionGroup"> + <remove keyForRemoval="clickRoleResourcesTab"/> + <remove keyForRemoval="waitForScopeSelection"/> + <remove keyForRemoval="selectResourceAccessCustom"/> + <remove keyForRemoval="waitForElementVisible"/> + <remove keyForRemoval="clickContentBlockCheckbox"/> + <remove keyForRemoval="clickSaveRoleButton"/> + <remove keyForRemoval="waitForPageLoad2"/> + </actionGroup> +</actionGroups> From d0771dc3ab7e57c8efcfbc4cbe1d616239b3ef16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 28 Nov 2019 14:18:57 +0100 Subject: [PATCH 0152/1143] REFACTOR: Extract Action Groups to separate files (according to MFTF best practices) --- .../AdminAddCustomUrlRewriteActionGroup.xml | 38 ++++++ ...dminAddUrlRewriteForProductActionGroup.xml | 34 +++++ .../AdminDeleteUrlRewriteActionGroup.xml | 35 +++++ ...chAndSelectUrlRewriteInGridActionGroup.xml | 29 ++++ .../AdminSearchByRequestPathActionGroup.xml | 32 +++++ ...dminSearchDeletedUrlRewriteActionGroup.xml | 28 ++++ ...earchUrlRewriteProductBySkuActionGroup.xml | 29 ++++ ...AdminUpdateCustomUrlRewriteActionGroup.xml | 32 +++++ .../AdminUpdateUrlRewriteActionGroup.xml | 31 +++++ .../AdminUrlRewriteActionGroup.xml | 97 +------------- .../AdminUrlRewriteGridActionGroup.xml | 126 ------------------ ...tPageByUrlRewriteIsNotFoundActionGroup.xml | 23 ++++ ...tStorefrontProductRedirectActionGroup.xml} | 21 +-- ...torefrontUrlRewriteRedirectActionGroup.xml | 25 ++++ ...ateURLRewriteWhenCategoryIsDeletedTest.xml | 12 +- ...CategoryUrlRewriteAndAddNoRedirectTest.xml | 4 +- ...yUrlRewriteAndAddPermanentRedirectTest.xml | 6 +- ...yUrlRewriteAndAddTemporaryRedirectTest.xml | 6 +- ...eUrlRewriteAndAddPermanentRedirectTest.xml | 8 +- ...eUrlRewriteAndAddTemporaryRedirectTest.xml | 8 +- ...yUrlRewriteAndAddPermanentRedirectTest.xml | 12 +- ...tUrlRewriteAndAddTemporaryRedirectTest.xml | 12 +- ...eProductURLRewriteAndAddNoRedirectTest.xml | 10 +- ...ithCategoryAndAddTemporaryRedirectTest.xml | 12 +- ...tUrLRewriteAndAddPermanentRedirectTest.xml | 10 +- ...tUrLRewriteAndAddTemporaryRedirectTest.xml | 10 +- ...SeveralWebsitesAndCheckURLRewritesTest.xml | 6 +- .../Test/AdminDeleteCustomUrlRewriteTest.xml | 8 +- ...CreateUrlRewriteForCustomStoreViewTest.xml | 6 +- ...oryUrlRewriteAndAddAspxRequestPathTest.xml | 8 +- ...CategoryUrlRewriteAndAddNoRedirectTest.xml | 8 +- ...yUrlRewriteAndAddPermanentRedirectTest.xml | 8 +- ...yUrlRewriteAndAddTemporaryRedirectTest.xml | 8 +- ...inUpdateCustomURLRewritesPermanentTest.xml | 10 +- ...inUpdateCustomURLRewritesTemporaryTest.xml | 12 +- ...tUrlRewriteAndAddTemporaryRedirectTest.xml | 6 +- 36 files changed, 435 insertions(+), 335 deletions(-) create mode 100644 app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminAddCustomUrlRewriteActionGroup.xml create mode 100644 app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminAddUrlRewriteForProductActionGroup.xml create mode 100644 app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminDeleteUrlRewriteActionGroup.xml create mode 100644 app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminSearchAndSelectUrlRewriteInGridActionGroup.xml create mode 100644 app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminSearchByRequestPathActionGroup.xml create mode 100644 app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminSearchDeletedUrlRewriteActionGroup.xml create mode 100644 app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminSearchUrlRewriteProductBySkuActionGroup.xml create mode 100644 app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminUpdateCustomUrlRewriteActionGroup.xml create mode 100644 app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminUpdateUrlRewriteActionGroup.xml delete mode 100644 app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminUrlRewriteGridActionGroup.xml create mode 100644 app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AssertPageByUrlRewriteIsNotFoundActionGroup.xml rename app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/{StorefrontUrlRewriteRedirectActionGroup.xml => AssertStorefrontProductRedirectActionGroup.xml} (52%) create mode 100644 app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AssertStorefrontUrlRewriteRedirectActionGroup.xml diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminAddCustomUrlRewriteActionGroup.xml b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminAddCustomUrlRewriteActionGroup.xml new file mode 100644 index 0000000000000..d4bcb5bbb414f --- /dev/null +++ b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminAddCustomUrlRewriteActionGroup.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAddCustomUrlRewriteActionGroup"> + <annotations> + <description>Goes to the Admin URL Rewrite edit page. Adds the provided Custom URL Rewrite details. Clicks on Save. Validates that the Success Message is present.</description> + </annotations> + <arguments> + <argument name="customUrlRewriteValue" type="string"/> + <argument name="storeValue" type="string"/> + <argument name="requestPath" type="string"/> + <argument name="targetPath" type="string"/> + <argument name="redirectTypeValue" type="string"/> + <argument name="description" type="string"/> + </arguments> + + <amOnPage url="{{AdminUrlRewriteEditPage.url}}" stepKey="openUrlRewriteEditPage"/> + <waitForPageLoad stepKey="waitForUrlRewriteEditPageToLoad" after="openUrlRewriteEditPage"/> + <click selector="{{AdminUrlRewriteEditSection.createCustomUrlRewrite}}" stepKey="clickOnCustonUrlRewrite"/> + <click selector="{{AdminUrlRewriteEditSection.createCustomUrlRewriteValue('customUrlRewriteValue')}}" stepKey="selectCustom"/> + <click selector="{{AdminUrlRewriteEditSection.store}}" stepKey="clickOnStore"/> + <click selector="{{AdminUrlRewriteEditSection.storeValue('storeValue')}}" stepKey="clickOnStoreValue"/> + <fillField selector="{{AdminUrlRewriteEditSection.requestPath}}" userInput="{{requestPath}}" stepKey="fillRequestPath"/> + <fillField selector="{{AdminUrlRewriteEditSection.targetPath}}" userInput="{{targetPath}}" stepKey="fillTargetPath"/> + <click selector="{{AdminUrlRewriteEditSection.redirectType}}" stepKey="selectRedirectType"/> + <click selector="{{AdminUrlRewriteEditSection.redirectTypeValue('redirectTypeValue')}}" stepKey="selectRedirectTypeValue"/> + <fillField selector="{{AdminUrlRewriteEditSection.description}}" userInput="{{description}}" stepKey="fillDescription"/> + <click selector="{{AdminUrlRewriteEditSection.saveButton}}" stepKey="clickOnSaveButton"/> + <seeElement selector="{{AdminUrlRewriteIndexSection.successMessage}}" stepKey="seeSuccessSaveMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminAddUrlRewriteForProductActionGroup.xml b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminAddUrlRewriteForProductActionGroup.xml new file mode 100644 index 0000000000000..51436fc5de584 --- /dev/null +++ b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminAddUrlRewriteForProductActionGroup.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAddUrlRewriteForProductActionGroup"> + <annotations> + <description>Adds the provided URL Rewrite details for a Product.</description> + </annotations> + <arguments> + <argument name="storeValue" type="string"/> + <argument name="requestPath" type="string"/> + <argument name="redirectTypeValue" type="string"/> + <argument name="description" type="string"/> + </arguments> + + <waitForElementVisible selector="{{AdminUrlRewriteProductSection.skipCategoryButton}}" stepKey="waitForSkipCategoryButton"/> + <click selector="{{AdminUrlRewriteProductSection.skipCategoryButton}}" stepKey="clickOnSkipCategoryButton"/> + <waitForPageLoad stepKey="waitForProductPageToLoad"/> + <click selector="{{AdminUrlRewriteEditSection.store}}" stepKey="clickOnStore"/> + <click selector="{{AdminUrlRewriteEditSection.storeValue('storeValue')}}" stepKey="clickOnStoreValue"/> + <fillField selector="{{AdminUrlRewriteEditSection.requestPath}}" userInput="{{requestPath}}" stepKey="fillRequestPath"/> + <click selector="{{AdminUrlRewriteEditSection.redirectType}}" stepKey="selectRedirectType"/> + <click selector="{{AdminUrlRewriteEditSection.redirectTypeValue('redirectTypeValue')}}" stepKey="clickOnRedirectTypeValue"/> + <fillField selector="{{AdminUrlRewriteEditSection.description}}" userInput="{{description}}" stepKey="fillDescription"/> + <click selector="{{AdminUrlRewriteEditSection.saveButton}}" stepKey="clickOnSaveButton"/> + <seeElement selector="{{AdminUrlRewriteIndexSection.successMessage}}" stepKey="seeSuccessSaveMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminDeleteUrlRewriteActionGroup.xml b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminDeleteUrlRewriteActionGroup.xml new file mode 100644 index 0000000000000..bc3953c4dedd4 --- /dev/null +++ b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminDeleteUrlRewriteActionGroup.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminDeleteUrlRewriteActionGroup"> + <annotations> + <description>Goes to the Admin URL Rewrite grid page. Deletes the provided Request Path. Validates that the Success Message is present and correct.</description> + </annotations> + <arguments> + <argument name="requestPath" type="string"/> + </arguments> + + <amOnPage url="{{AdminUrlRewriteIndexPage.url}}" stepKey="openUrlRewriteEditPage"/> + <waitForPageLoad stepKey="waitForUrlRewriteEditPageToLoad"/> + <click selector="{{AdminUrlRewriteIndexSection.resetButton}}" stepKey="clickOnResetButton"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + <fillField selector="{{AdminUrlRewriteIndexSection.requestPathFilter}}" userInput="{{requestPath}}" stepKey="fillRedirectPathFilter"/> + <click selector="{{AdminUrlRewriteIndexSection.searchButton}}" stepKey="clickOnSearchButton"/> + <waitForPageLoad stepKey="waitForPageToLoad1"/> + <click selector="{{AdminUrlRewriteIndexSection.editButton('1')}}" stepKey="clickOnEditButton"/> + <waitForPageLoad stepKey="waitForEditPageToLoad"/> + <click selector="{{AdminUrlRewriteEditSection.deleteButton}}" stepKey="clickOnDeleteButton"/> + <waitForPageLoad stepKey="waitForPageToLoad2"/> + <waitForElementVisible selector="{{AdminUrlRewriteEditSection.okButton}}" stepKey="waitForOkButtonToVisible"/> + <click selector="{{AdminUrlRewriteEditSection.okButton}}" stepKey="clickOnOkButton"/> + <waitForPageLoad stepKey="waitForPageToLoad3"/> + <see selector="{{AdminUrlRewriteIndexSection.successMessage}}" userInput="You deleted the URL rewrite." stepKey="seeSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminSearchAndSelectUrlRewriteInGridActionGroup.xml b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminSearchAndSelectUrlRewriteInGridActionGroup.xml new file mode 100644 index 0000000000000..f2f114f01cc9e --- /dev/null +++ b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminSearchAndSelectUrlRewriteInGridActionGroup.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminSearchAndSelectUrlRewriteInGridActionGroup"> + <annotations> + <description>Goes to the Admin URL Rewrite grid page. Searches the grid for the provided Request Path. Clicks on Edit.</description> + </annotations> + <arguments> + <argument name="requestPath" type="string"/> + </arguments> + + <amOnPage url="{{AdminUrlRewriteIndexPage.url}}" stepKey="openUrlRewriteEditPage"/> + <waitForPageLoad stepKey="waitForUrlRewriteEditPageToLoad"/> + <click selector="{{AdminUrlRewriteIndexSection.resetButton}}" stepKey="clickOnResetButton"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + <fillField selector="{{AdminUrlRewriteIndexSection.requestPathFilter}}" userInput="{{requestPath}}" stepKey="fillRedirectPathFilter"/> + <click selector="{{AdminUrlRewriteIndexSection.searchButton}}" stepKey="clickOnSearchButton"/> + <waitForPageLoad stepKey="waitForPageToLoad1"/> + <click selector="{{AdminUrlRewriteIndexSection.editButton('1')}}" stepKey="clickOnEditButton"/> + <waitForPageLoad stepKey="waitForEditPageToLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminSearchByRequestPathActionGroup.xml b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminSearchByRequestPathActionGroup.xml new file mode 100644 index 0000000000000..99ac4ea160f82 --- /dev/null +++ b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminSearchByRequestPathActionGroup.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminSearchByRequestPathActionGroup"> + <annotations> + <description>Goes to the Admin URL Rewrite grid page. Searches the grid based on the provided Redirect Path. Validates that the provided Redirect Path, Type and Target Path are present and correct in the grid.</description> + </annotations> + <arguments> + <argument name="redirectPath" type="string"/> + <argument name="redirectType" type="string"/> + <argument name="targetPath" type="string"/> + </arguments> + + <amOnPage url="{{AdminUrlRewriteIndexPage.url}}" stepKey="openUrlRewriteEditPage"/> + <waitForPageLoad stepKey="waitForUrlRewriteEditPageToLoad"/> + <click selector="{{AdminUrlRewriteIndexSection.resetButton}}" stepKey="clickOnResetButton"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + <fillField selector="{{AdminUrlRewriteIndexSection.requestPathFilter}}" userInput="{{redirectPath}}" stepKey="fillRedirectPathFilter"/> + <click selector="{{AdminUrlRewriteIndexSection.searchButton}}" stepKey="clickOnSearchButton"/> + <waitForPageLoad stepKey="waitForPageToLoad1"/> + <see selector="{{AdminUrlRewriteIndexSection.requestPathColumn('1')}}" userInput="{{redirectPath}}" stepKey="seeTheRedirectPathForOldUrl"/> + <see selector="{{AdminUrlRewriteIndexSection.targetPathColumn('1')}}" userInput="{{targetPath}}" stepKey="seeTheTargetPath"/> + <see selector="{{AdminUrlRewriteIndexSection.redirectTypeColumn('1')}}" userInput="{{redirectType}}" stepKey="seeTheRedirectTypeForOldUrl"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminSearchDeletedUrlRewriteActionGroup.xml b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminSearchDeletedUrlRewriteActionGroup.xml new file mode 100644 index 0000000000000..2d7178f72f407 --- /dev/null +++ b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminSearchDeletedUrlRewriteActionGroup.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminSearchDeletedUrlRewriteActionGroup"> + <annotations> + <description>Goes to the Admin URL Rewrite grid page. Searches the grid for the provided Request Path. Validates that it does NOT appear in the grid.</description> + </annotations> + <arguments> + <argument name="requestPath" type="string"/> + </arguments> + + <amOnPage url="{{AdminUrlRewriteIndexPage.url}}" stepKey="openUrlRewriteEditPage"/> + <waitForPageLoad stepKey="waitForUrlRewriteEditPageToLoad"/> + <click selector="{{AdminUrlRewriteIndexSection.resetButton}}" stepKey="clickOnResetButton"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + <fillField selector="{{AdminUrlRewriteIndexSection.requestPathFilter}}" userInput="{{requestPath}}" stepKey="fillRedirectPathFilter"/> + <click selector="{{AdminUrlRewriteIndexSection.searchButton}}" stepKey="clickOnSearchButton"/> + <waitForPageLoad stepKey="waitForPageToLoad1"/> + <see selector="{{AdminUrlRewriteIndexSection.emptyRecords}}" userInput="We couldn't find any records." stepKey="seeEmptyRecordMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminSearchUrlRewriteProductBySkuActionGroup.xml b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminSearchUrlRewriteProductBySkuActionGroup.xml new file mode 100644 index 0000000000000..d77621ccd768f --- /dev/null +++ b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminSearchUrlRewriteProductBySkuActionGroup.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminSearchUrlRewriteProductBySkuActionGroup"> + <annotations> + <description>Goes to the Admin URL Rewrite grid page. Searches the grid based on the provided Product SKU. Clicks on the 1st row in the grid.</description> + </annotations> + <arguments> + <argument name="productSku" type="string"/> + </arguments> + + <amOnPage url="{{AdminUrlRewriteProductPage.url}}" stepKey="openUrlRewriteProductPage"/> + <waitForPageLoad stepKey="waitForUrlRewriteProductPageToLoad"/> + <click selector="{{AdminUrlRewriteProductSection.resetFilter}}" stepKey="clickOnResetFilter"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + <fillField selector="{{AdminUrlRewriteProductSection.skuFilter}}" userInput="{{productSku}}" stepKey="fillProductSkuFilter"/> + <click selector="{{AdminUrlRewriteProductSection.searchFilter}}" stepKey="clickOnSearchFilter"/> + <waitForPageLoad stepKey="waitForProductToLoad"/> + <click selector="{{AdminUrlRewriteProductSection.productRow}}" stepKey="clickOnFirstRow"/> + <waitForPageLoad stepKey="waitForProductCategoryPageToLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminUpdateCustomUrlRewriteActionGroup.xml b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminUpdateCustomUrlRewriteActionGroup.xml new file mode 100644 index 0000000000000..0d0c754fe076e --- /dev/null +++ b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminUpdateCustomUrlRewriteActionGroup.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminUpdateCustomUrlRewriteActionGroup"> + <annotations> + <description>Updates the Custom URL Rewrite fields with the provided details.</description> + </annotations> + <arguments> + <argument name="storeValue" type="string"/> + <argument name="requestPath" type="string"/> + <argument name="targetPath" type="string"/> + <argument name="redirectTypeValue" type="string"/> + <argument name="description" type="string"/> + </arguments> + + <click selector="{{AdminUrlRewriteEditSection.store}}" stepKey="clickOnStore"/> + <click selector="{{AdminUrlRewriteEditSection.storeValue('storeValue')}}" stepKey="clickOnStoreValue"/> + <fillField selector="{{AdminUrlRewriteEditSection.requestPath}}" userInput="{{requestPath}}" stepKey="fillRequestPath"/> + <fillField selector="{{AdminUrlRewriteEditSection.targetPath}}" userInput="{{targetPath}}" stepKey="fillTargetPath"/> + <selectOption selector="{{AdminUrlRewriteEditSection.redirectType}}" userInput="{{redirectTypeValue}}" stepKey="selectRedirectTypeValue"/> + <fillField selector="{{AdminUrlRewriteEditSection.description}}" userInput="{{description}}" stepKey="fillDescription"/> + <click selector="{{AdminUrlRewriteEditSection.saveButton}}" stepKey="clickOnSaveButton"/> + <seeElement selector="{{AdminUrlRewriteIndexSection.successMessage}}" stepKey="seeSuccessSaveMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminUpdateUrlRewriteActionGroup.xml b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminUpdateUrlRewriteActionGroup.xml new file mode 100644 index 0000000000000..4b884448a7653 --- /dev/null +++ b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminUpdateUrlRewriteActionGroup.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminUpdateUrlRewriteActionGroup"> + <annotations> + <description>Updates the URL Rewrite fields with the provided details.</description> + </annotations> + <arguments> + <argument name="storeValue" type="string"/> + <argument name="requestPath" type="string"/> + <argument name="redirectTypeValue" type="string"/> + <argument name="description" type="string"/> + </arguments> + + <click selector="{{AdminUrlRewriteEditSection.store}}" stepKey="clickOnStore"/> + <click selector="{{AdminUrlRewriteEditSection.storeValue(storeValue)}}" stepKey="clickOnStoreValue"/> + <fillField selector="{{AdminUrlRewriteEditSection.requestPath}}" userInput="{{requestPath}}" stepKey="fillRequestPath"/> + <click selector="{{AdminUrlRewriteEditSection.redirectType}}" stepKey="selectRedirectType"/> + <click selector="{{AdminUrlRewriteEditSection.redirectTypeValue(redirectTypeValue)}}" stepKey="selectRedirectTypeValue"/> + <fillField selector="{{AdminUrlRewriteEditSection.description}}" userInput="{{description}}" stepKey="fillDescription"/> + <click selector="{{AdminUrlRewriteEditSection.saveButton}}" stepKey="clickOnSaveButton"/> + <seeElement selector="{{AdminUrlRewriteIndexSection.successMessage}}" stepKey="seeSuccessSaveMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminUrlRewriteActionGroup.xml b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminUrlRewriteActionGroup.xml index 4f89c9389c32b..55f18ae5a0187 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminUrlRewriteActionGroup.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminUrlRewriteActionGroup.xml @@ -8,7 +8,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AdminAddUrlRewrite"> + <actionGroup name="AdminAddUrlRewriteActionGroup"> <annotations> <description>Goes to the Admin Add URL Rewrite edit page. Fills in the provided URL details. Clicks on Save. Validates that the Success Message is present.</description> </annotations> @@ -35,99 +35,4 @@ <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForSuccessMessage"/> <see selector="{{AdminMessagesSection.success}}" userInput="The URL Rewrite has been saved." stepKey="seeSuccessMessage"/> </actionGroup> - - <actionGroup name="AdminAddUrlRewriteForProduct"> - <annotations> - <description>Adds the provided URL Rewrite details for a Product.</description> - </annotations> - <arguments> - <argument name="storeValue" type="string"/> - <argument name="requestPath" type="string"/> - <argument name="redirectTypeValue" type="string"/> - <argument name="description" type="string"/> - </arguments> - - <waitForElementVisible selector="{{AdminUrlRewriteProductSection.skipCategoryButton}}" stepKey="waitForSkipCategoryButton"/> - <click selector="{{AdminUrlRewriteProductSection.skipCategoryButton}}" stepKey="clickOnSkipCategoryButton"/> - <waitForPageLoad stepKey="waitForProductPageToLoad"/> - <click selector="{{AdminUrlRewriteEditSection.store}}" stepKey="clickOnStore"/> - <click selector="{{AdminUrlRewriteEditSection.storeValue('storeValue')}}" stepKey="clickOnStoreValue"/> - <fillField selector="{{AdminUrlRewriteEditSection.requestPath}}" userInput="{{requestPath}}" stepKey="fillRequestPath"/> - <click selector="{{AdminUrlRewriteEditSection.redirectType}}" stepKey="selectRedirectType"/> - <click selector="{{AdminUrlRewriteEditSection.redirectTypeValue('redirectTypeValue')}}" stepKey="clickOnRedirectTypeValue"/> - <fillField selector="{{AdminUrlRewriteEditSection.description}}" userInput="{{description}}" stepKey="fillDescription"/> - <click selector="{{AdminUrlRewriteEditSection.saveButton}}" stepKey="clickOnSaveButton"/> - <seeElement selector="{{AdminUrlRewriteIndexSection.successMessage}}" stepKey="seeSuccessSaveMessage"/> - </actionGroup> - - <actionGroup name="AdminAddCustomUrlRewrite"> - <annotations> - <description>Goes to the Admin URL Rewrite edit page. Adds the provided Custom URL Rewrite details. Clicks on Save. Validates that the Success Message is present.</description> - </annotations> - <arguments> - <argument name="customUrlRewriteValue" type="string"/> - <argument name="storeValue" type="string"/> - <argument name="requestPath" type="string"/> - <argument name="targetPath" type="string"/> - <argument name="redirectTypeValue" type="string"/> - <argument name="description" type="string"/> - </arguments> - - <amOnPage url="{{AdminUrlRewriteEditPage.url}}" stepKey="openUrlRewriteEditPage"/> - <waitForPageLoad stepKey="waitForUrlRewriteEditPageToLoad" after="openUrlRewriteEditPage"/> - <click selector="{{AdminUrlRewriteEditSection.createCustomUrlRewrite}}" stepKey="clickOnCustonUrlRewrite"/> - <click selector="{{AdminUrlRewriteEditSection.createCustomUrlRewriteValue('customUrlRewriteValue')}}" stepKey="selectCustom"/> - <click selector="{{AdminUrlRewriteEditSection.store}}" stepKey="clickOnStore"/> - <click selector="{{AdminUrlRewriteEditSection.storeValue('storeValue')}}" stepKey="clickOnStoreValue"/> - <fillField selector="{{AdminUrlRewriteEditSection.requestPath}}" userInput="{{requestPath}}" stepKey="fillRequestPath"/> - <fillField selector="{{AdminUrlRewriteEditSection.targetPath}}" userInput="{{targetPath}}" stepKey="fillTargetPath"/> - <click selector="{{AdminUrlRewriteEditSection.redirectType}}" stepKey="selectRedirectType"/> - <click selector="{{AdminUrlRewriteEditSection.redirectTypeValue('redirectTypeValue')}}" stepKey="selectRedirectTypeValue"/> - <fillField selector="{{AdminUrlRewriteEditSection.description}}" userInput="{{description}}" stepKey="fillDescription"/> - <click selector="{{AdminUrlRewriteEditSection.saveButton}}" stepKey="clickOnSaveButton"/> - <seeElement selector="{{AdminUrlRewriteIndexSection.successMessage}}" stepKey="seeSuccessSaveMessage"/> - </actionGroup> - - <actionGroup name="AdminUpdateUrlRewrite"> - <annotations> - <description>Updates the URL Rewrite fields with the provided details.</description> - </annotations> - <arguments> - <argument name="storeValue" type="string"/> - <argument name="requestPath" type="string"/> - <argument name="redirectTypeValue" type="string"/> - <argument name="description" type="string"/> - </arguments> - - <click selector="{{AdminUrlRewriteEditSection.store}}" stepKey="clickOnStore"/> - <click selector="{{AdminUrlRewriteEditSection.storeValue(storeValue)}}" stepKey="clickOnStoreValue"/> - <fillField selector="{{AdminUrlRewriteEditSection.requestPath}}" userInput="{{requestPath}}" stepKey="fillRequestPath"/> - <click selector="{{AdminUrlRewriteEditSection.redirectType}}" stepKey="selectRedirectType"/> - <click selector="{{AdminUrlRewriteEditSection.redirectTypeValue(redirectTypeValue)}}" stepKey="selectRedirectTypeValue"/> - <fillField selector="{{AdminUrlRewriteEditSection.description}}" userInput="{{description}}" stepKey="fillDescription"/> - <click selector="{{AdminUrlRewriteEditSection.saveButton}}" stepKey="clickOnSaveButton"/> - <seeElement selector="{{AdminUrlRewriteIndexSection.successMessage}}" stepKey="seeSuccessSaveMessage"/> - </actionGroup> - - <actionGroup name="AdminUpdateCustomUrlRewrite"> - <annotations> - <description>Updates the Custom URL Rewrite fields with the provided details.</description> - </annotations> - <arguments> - <argument name="storeValue" type="string"/> - <argument name="requestPath" type="string"/> - <argument name="targetPath" type="string"/> - <argument name="redirectTypeValue" type="string"/> - <argument name="description" type="string"/> - </arguments> - - <click selector="{{AdminUrlRewriteEditSection.store}}" stepKey="clickOnStore"/> - <click selector="{{AdminUrlRewriteEditSection.storeValue('storeValue')}}" stepKey="clickOnStoreValue"/> - <fillField selector="{{AdminUrlRewriteEditSection.requestPath}}" userInput="{{requestPath}}" stepKey="fillRequestPath"/> - <fillField selector="{{AdminUrlRewriteEditSection.targetPath}}" userInput="{{targetPath}}" stepKey="fillTargetPath"/> - <selectOption selector="{{AdminUrlRewriteEditSection.redirectType}}" userInput="{{redirectTypeValue}}" stepKey="selectRedirectTypeValue"/> - <fillField selector="{{AdminUrlRewriteEditSection.description}}" userInput="{{description}}" stepKey="fillDescription"/> - <click selector="{{AdminUrlRewriteEditSection.saveButton}}" stepKey="clickOnSaveButton"/> - <seeElement selector="{{AdminUrlRewriteIndexSection.successMessage}}" stepKey="seeSuccessSaveMessage"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminUrlRewriteGridActionGroup.xml b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminUrlRewriteGridActionGroup.xml deleted file mode 100644 index 2a3f4446e2b74..0000000000000 --- a/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminUrlRewriteGridActionGroup.xml +++ /dev/null @@ -1,126 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AdminSearchByRequestPath"> - <annotations> - <description>Goes to the Admin URL Rewrite grid page. Searches the grid based on the provided Redirect Path. Validates that the provided Redirect Path, Type and Target Path are present and correct in the grid.</description> - </annotations> - <arguments> - <argument name="redirectPath" type="string"/> - <argument name="redirectType" type="string"/> - <argument name="targetPath" type="string"/> - </arguments> - - <amOnPage url="{{AdminUrlRewriteIndexPage.url}}" stepKey="openUrlRewriteEditPage"/> - <waitForPageLoad stepKey="waitForUrlRewriteEditPageToLoad"/> - <click selector="{{AdminUrlRewriteIndexSection.resetButton}}" stepKey="clickOnResetButton"/> - <waitForPageLoad stepKey="waitForPageToLoad"/> - <fillField selector="{{AdminUrlRewriteIndexSection.requestPathFilter}}" userInput="{{redirectPath}}" stepKey="fillRedirectPathFilter"/> - <click selector="{{AdminUrlRewriteIndexSection.searchButton}}" stepKey="clickOnSearchButton"/> - <waitForPageLoad stepKey="waitForPageToLoad1"/> - <see selector="{{AdminUrlRewriteIndexSection.requestPathColumn('1')}}" userInput="{{redirectPath}}" stepKey="seeTheRedirectPathForOldUrl"/> - <see selector="{{AdminUrlRewriteIndexSection.targetPathColumn('1')}}" userInput="{{targetPath}}" stepKey="seeTheTargetPath"/> - <see selector="{{AdminUrlRewriteIndexSection.redirectTypeColumn('1')}}" userInput="{{redirectType}}" stepKey="seeTheRedirectTypeForOldUrl"/> - </actionGroup> - - <actionGroup name="AdminSearchUrlRewriteProductBySku"> - <annotations> - <description>Goes to the Admin URL Rewrite grid page. Searches the grid based on the provided Product SKU. Clicks on the 1st row in the grid.</description> - </annotations> - <arguments> - <argument name="productSku" type="string"/> - </arguments> - - <amOnPage url="{{AdminUrlRewriteProductPage.url}}" stepKey="openUrlRewriteProductPage"/> - <waitForPageLoad stepKey="waitForUrlRewriteProductPageToLoad"/> - <click selector="{{AdminUrlRewriteProductSection.resetFilter}}" stepKey="clickOnResetFilter"/> - <waitForPageLoad stepKey="waitForPageToLoad"/> - <fillField selector="{{AdminUrlRewriteProductSection.skuFilter}}" userInput="{{productSku}}" stepKey="fillProductSkuFilter"/> - <click selector="{{AdminUrlRewriteProductSection.searchFilter}}" stepKey="clickOnSearchFilter"/> - <waitForPageLoad stepKey="waitForProductToLoad"/> - <click selector="{{AdminUrlRewriteProductSection.productRow}}" stepKey="clickOnFirstRow"/> - <waitForPageLoad stepKey="waitForProductCategoryPageToLoad"/> - </actionGroup> - - <actionGroup name="AdminSearchDeletedUrlRewrite"> - <annotations> - <description>Goes to the Admin URL Rewrite grid page. Searches the grid for the provided Request Path. Validates that it does NOT appear in the grid.</description> - </annotations> - <arguments> - <argument name="requestPath" type="string"/> - </arguments> - - <amOnPage url="{{AdminUrlRewriteIndexPage.url}}" stepKey="openUrlRewriteEditPage"/> - <waitForPageLoad stepKey="waitForUrlRewriteEditPageToLoad"/> - <click selector="{{AdminUrlRewriteIndexSection.resetButton}}" stepKey="clickOnResetButton"/> - <waitForPageLoad stepKey="waitForPageToLoad"/> - <fillField selector="{{AdminUrlRewriteIndexSection.requestPathFilter}}" userInput="{{requestPath}}" stepKey="fillRedirectPathFilter"/> - <click selector="{{AdminUrlRewriteIndexSection.searchButton}}" stepKey="clickOnSearchButton"/> - <waitForPageLoad stepKey="waitForPageToLoad1"/> - <see selector="{{AdminUrlRewriteIndexSection.emptyRecords}}" userInput="We couldn't find any records." stepKey="seeEmptyRecordMessage"/> - </actionGroup> - - <actionGroup name="AdminDeleteUrlRewrite"> - <annotations> - <description>Goes to the Admin URL Rewrite grid page. Deletes the provided Request Path. Validates that the Success Message is present and correct.</description> - </annotations> - <arguments> - <argument name="requestPath" type="string"/> - </arguments> - - <amOnPage url="{{AdminUrlRewriteIndexPage.url}}" stepKey="openUrlRewriteEditPage"/> - <waitForPageLoad stepKey="waitForUrlRewriteEditPageToLoad"/> - <click selector="{{AdminUrlRewriteIndexSection.resetButton}}" stepKey="clickOnResetButton"/> - <waitForPageLoad stepKey="waitForPageToLoad"/> - <fillField selector="{{AdminUrlRewriteIndexSection.requestPathFilter}}" userInput="{{requestPath}}" stepKey="fillRedirectPathFilter"/> - <click selector="{{AdminUrlRewriteIndexSection.searchButton}}" stepKey="clickOnSearchButton"/> - <waitForPageLoad stepKey="waitForPageToLoad1"/> - <click selector="{{AdminUrlRewriteIndexSection.editButton('1')}}" stepKey="clickOnEditButton"/> - <waitForPageLoad stepKey="waitForEditPageToLoad"/> - <click selector="{{AdminUrlRewriteEditSection.deleteButton}}" stepKey="clickOnDeleteButton"/> - <waitForPageLoad stepKey="waitForPageToLoad2"/> - <waitForElementVisible selector="{{AdminUrlRewriteEditSection.okButton}}" stepKey="waitForOkButtonToVisible"/> - <click selector="{{AdminUrlRewriteEditSection.okButton}}" stepKey="clickOnOkButton"/> - <waitForPageLoad stepKey="waitForPageToLoad3"/> - <see selector="{{AdminUrlRewriteIndexSection.successMessage}}" userInput="You deleted the URL rewrite." stepKey="seeSuccessMessage"/> - </actionGroup> - - <actionGroup name="AssertPageByUrlRewriteIsNotFound"> - <annotations> - <description>Validates that the provided Request Path does NOT exist on the Storefront. Validates that the 'Whoops' message is present and correct.</description> - </annotations> - <arguments> - <argument name="requestPath" type="string"/> - </arguments> - - <amOnPage url="{{requestPath}}" stepKey="amOnPage"/> - <waitForPageLoad stepKey="waitForStorefrontPageLoad"/> - <see userInput="Whoops, our bad..." stepKey="seeWhoops"/> - </actionGroup> - - <actionGroup name="AdminSearchAndSelectUrlRewriteInGrid"> - <annotations> - <description>Goes to the Admin URL Rewrite grid page. Searches the grid for the provided Request Path. Clicks on Edit.</description> - </annotations> - <arguments> - <argument name="requestPath" type="string"/> - </arguments> - - <amOnPage url="{{AdminUrlRewriteIndexPage.url}}" stepKey="openUrlRewriteEditPage"/> - <waitForPageLoad stepKey="waitForUrlRewriteEditPageToLoad"/> - <click selector="{{AdminUrlRewriteIndexSection.resetButton}}" stepKey="clickOnResetButton"/> - <waitForPageLoad stepKey="waitForPageToLoad"/> - <fillField selector="{{AdminUrlRewriteIndexSection.requestPathFilter}}" userInput="{{requestPath}}" stepKey="fillRedirectPathFilter"/> - <click selector="{{AdminUrlRewriteIndexSection.searchButton}}" stepKey="clickOnSearchButton"/> - <waitForPageLoad stepKey="waitForPageToLoad1"/> - <click selector="{{AdminUrlRewriteIndexSection.editButton('1')}}" stepKey="clickOnEditButton"/> - <waitForPageLoad stepKey="waitForEditPageToLoad"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AssertPageByUrlRewriteIsNotFoundActionGroup.xml b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AssertPageByUrlRewriteIsNotFoundActionGroup.xml new file mode 100644 index 0000000000000..4188c86a58b81 --- /dev/null +++ b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AssertPageByUrlRewriteIsNotFoundActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertPageByUrlRewriteIsNotFoundActionGroup"> + <annotations> + <description>Validates that the provided Request Path does NOT exist on the Storefront. Validates that the 'Whoops' message is present and correct.</description> + </annotations> + <arguments> + <argument name="requestPath" type="string"/> + </arguments> + + <amOnPage url="{{requestPath}}" stepKey="amOnPage"/> + <waitForPageLoad stepKey="waitForStorefrontPageLoad"/> + <see userInput="Whoops, our bad..." stepKey="seeWhoops"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/StorefrontUrlRewriteRedirectActionGroup.xml b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AssertStorefrontProductRedirectActionGroup.xml similarity index 52% rename from app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/StorefrontUrlRewriteRedirectActionGroup.xml rename to app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AssertStorefrontProductRedirectActionGroup.xml index 325045bccc869..8a41dc4e2a9b3 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/StorefrontUrlRewriteRedirectActionGroup.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AssertStorefrontProductRedirectActionGroup.xml @@ -7,23 +7,8 @@ --> <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AssertStorefrontUrlRewriteRedirect"> - <annotations> - <description>Goes to the provided New URL. Validates that the redirect works and the provided Category is present.</description> - </annotations> - <arguments> - <argument name="category" type="string"/> - <argument name="newRequestPath" type="string"/> - </arguments> - - <amOnPage url="{{newRequestPath}}" stepKey="openCategoryInStorefront"/> - <waitForPageLoad stepKey="waitForCategoryPageToLoad"/> - <seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(category)}}" stepKey="seeCategoryOnStoreNavigationBar"/> - <seeElement selector="{{StorefrontCategoryMainSection.CategoryTitle(category)}}" stepKey="seeCategoryInTitle"/> - </actionGroup> - - <actionGroup name="AssertStorefrontProductRedirect"> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertStorefrontProductRedirectActionGroup"> <annotations> <description>Goes to the provided New Product URL. Validates that the redirect works and the provided Product is present and correct.</description> </annotations> @@ -32,7 +17,7 @@ <argument name="productSku" type="string"/> <argument name="productRequestPath" type="string"/> </arguments> - + <amOnPage url="{{productRequestPath}}" stepKey="openCategoryInStorefront"/> <waitForPageLoad stepKey="waitForCategoryPageToLoad"/> <see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{productName}}" stepKey="seeProductNameInStoreFrontPage"/> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AssertStorefrontUrlRewriteRedirectActionGroup.xml b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AssertStorefrontUrlRewriteRedirectActionGroup.xml new file mode 100644 index 0000000000000..4d95c1a43876b --- /dev/null +++ b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AssertStorefrontUrlRewriteRedirectActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertStorefrontUrlRewriteRedirectActionGroup"> + <annotations> + <description>Goes to the provided New URL. Validates that the redirect works and the provided Category is present.</description> + </annotations> + <arguments> + <argument name="category" type="string"/> + <argument name="newRequestPath" type="string"/> + </arguments> + + <amOnPage url="{{newRequestPath}}" stepKey="openCategoryInStorefront"/> + <waitForPageLoad stepKey="waitForCategoryPageToLoad"/> + <seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(category)}}" stepKey="seeCategoryOnStoreNavigationBar"/> + <seeElement selector="{{StorefrontCategoryMainSection.CategoryTitle(category)}}" stepKey="seeCategoryInTitle"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminAutoUpdateURLRewriteWhenCategoryIsDeletedTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminAutoUpdateURLRewriteWhenCategoryIsDeletedTest.xml index 52d313b21f3e1..ef63478844b20 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminAutoUpdateURLRewriteWhenCategoryIsDeletedTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminAutoUpdateURLRewriteWhenCategoryIsDeletedTest.xml @@ -30,12 +30,12 @@ </after> <!--Filter and Select the created Product --> - <actionGroup ref="AdminSearchUrlRewriteProductBySku" stepKey="searchProduct"> + <actionGroup ref="AdminSearchUrlRewriteProductBySkuActionGroup" stepKey="searchProduct"> <argument name="productSku" value="$$createSimpleProduct.sku$$"/> </actionGroup> <!-- Update the Store, RequestPath, RedirectType and Description --> - <actionGroup ref="AdminAddUrlRewriteForProduct" stepKey="addUrlRewriteForProduct"> + <actionGroup ref="AdminAddUrlRewriteForProductActionGroup" stepKey="addUrlRewriteForProduct"> <argument name="storeValue" value="Default Store View"/> <argument name="requestPath" value="{{_defaultProduct.urlKey}}.html"/> <argument name="redirectTypeValue" value="Temporary (302)"/> @@ -52,22 +52,22 @@ <grabFromCurrentUrl stepKey="productId" regex="#\/([0-9]*)?\/$#"/> <!-- Assert Redirect path, Target Path and Redirect type in grid --> - <actionGroup ref="AdminSearchByRequestPath" stepKey="searchByRequestPath"> + <actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchByRequestPath"> <argument name="redirectPath" value="$$createSimpleProduct.name$$.html" /> <argument name="redirectType" value="No" /> <argument name="targetPath" value="catalog/product/view/id/{$productId}"/> </actionGroup> <!-- Assert Redirect path, Target Path and Redirect type in grid --> - <actionGroup ref="AdminSearchByRequestPath" stepKey="searchByRequestPath1"> + <actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchByRequestPath1"> <argument name="redirectPath" value="{{_defaultProduct.urlKey}}.html" /> <argument name="redirectType" value="Temporary (302)"/> <argument name="targetPath" value="$$createSimpleProduct.name$$.html"/> </actionGroup> <!--Assert Category Url Redirect is not present --> - <actionGroup ref="AdminSearchDeletedUrlRewrite" stepKey="searchDeletedCategory"> + <actionGroup ref="AdminSearchDeletedUrlRewriteActionGroup" stepKey="searchDeletedCategory"> <argument name="requestPath" value="$$createCategory.name$$.html"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCategoryUrlRewriteAndAddNoRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCategoryUrlRewriteAndAddNoRedirectTest.xml index 85e9d7847d5ea..42dca0c22937f 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCategoryUrlRewriteAndAddNoRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCategoryUrlRewriteAndAddNoRedirectTest.xml @@ -27,7 +27,7 @@ </after> <!--Open Url Rewrite Index Page and update the Custom Url Rewrite, Store, Request Path, Redirect Type and Description --> - <actionGroup ref="AdminAddUrlRewrite" stepKey="addUrlRewrite"> + <actionGroup ref="AdminAddUrlRewriteActionGroup" stepKey="addUrlRewrite"> <argument name="category" value="$$category.name$$"/> <argument name="customUrlRewriteValue" value="For Category"/> <argument name="storeValue" value="Default Store View"/> @@ -43,7 +43,7 @@ <grabFromCurrentUrl stepKey="categoryId" regex="#\/([0-9]*)?\/$#"/> <!-- Assert Redirect path, Target Path and Redirect type in grid --> - <actionGroup ref="AdminSearchByRequestPath" stepKey="searchByRequestPath"> + <actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchByRequestPath"> <argument name="redirectPath" value="newrequestpath.html" /> <argument name="redirectType" value="No" /> <argument name="targetPath" value="catalog/category/view/id/{$categoryId}"/> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCategoryUrlRewriteAndAddPermanentRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCategoryUrlRewriteAndAddPermanentRedirectTest.xml index 477742e7e3618..867b3ee54161c 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCategoryUrlRewriteAndAddPermanentRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCategoryUrlRewriteAndAddPermanentRedirectTest.xml @@ -27,7 +27,7 @@ </after> <!--Open Url Rewrite Index Page and update the Custom Url Rewrite, Store, Request Path, Redirect Type and Description --> - <actionGroup ref="AdminAddUrlRewrite" stepKey="addUrlRewrite"> + <actionGroup ref="AdminAddUrlRewriteActionGroup" stepKey="addUrlRewrite"> <argument name="category" value="$$category.name$$"/> <argument name="customUrlRewriteValue" value="For Category"/> <argument name="storeValue" value="Default Store View"/> @@ -37,14 +37,14 @@ </actionGroup> <!-- Assert Redirect path, Target Path and Redirect type in grid --> - <actionGroup ref="AdminSearchByRequestPath" stepKey="searchByRequestPath"> + <actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchByRequestPath"> <argument name="redirectPath" value="newrequestpath.html" /> <argument name="redirectType" value="Permanent (301)" /> <argument name="targetPath" value="$$category.name_lwr$$.html"/> </actionGroup> <!--Assert Updated path directs to the category storefront --> - <actionGroup ref="AssertStorefrontUrlRewriteRedirect" stepKey="openStorefrontUrlRedirectPath"> + <actionGroup ref="AssertStorefrontUrlRewriteRedirectActionGroup" stepKey="openStorefrontUrlRedirectPath"> <argument name="category" value="$$category.name$$"/> <argument name="newRequestPath" value="newrequestpath.html"/> </actionGroup> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCategoryUrlRewriteAndAddTemporaryRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCategoryUrlRewriteAndAddTemporaryRedirectTest.xml index 2367c3d982d15..ab18add56aeb9 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCategoryUrlRewriteAndAddTemporaryRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCategoryUrlRewriteAndAddTemporaryRedirectTest.xml @@ -27,7 +27,7 @@ </after> <!--Open Url Rewrite Index Page and update the Custom Url Rewrite, Store, Request Path, Redirect Type and Description --> - <actionGroup ref="AdminAddUrlRewrite" stepKey="addUrlRewrite"> + <actionGroup ref="AdminAddUrlRewriteActionGroup" stepKey="addUrlRewrite"> <argument name="category" value="$$category.name$$"/> <argument name="customUrlRewriteValue" value="For Category"/> <argument name="storeValue" value="Default Store View"/> @@ -37,14 +37,14 @@ </actionGroup> <!-- Assert Redirect path, Target Path and Redirect type in grid --> - <actionGroup ref="AdminSearchByRequestPath" stepKey="searchByRequestPath"> + <actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchByRequestPath"> <argument name="redirectPath" value="newrequestpath.html" /> <argument name="redirectType" value="Temporary (302)" /> <argument name="targetPath" value="$$category.name_lwr$$.html"/> </actionGroup> <!--Assert Updated path directs to the category storefront --> - <actionGroup ref="AssertStorefrontUrlRewriteRedirect" stepKey="openStorefrontUrlRedirectPath"> + <actionGroup ref="AssertStorefrontUrlRewriteRedirectActionGroup" stepKey="openStorefrontUrlRedirectPath"> <argument name="category" value="$$category.name$$"/> <argument name="newRequestPath" value="newrequestpath.html"/> </actionGroup> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCMSPageUrlRewriteAndAddPermanentRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCMSPageUrlRewriteAndAddPermanentRedirectTest.xml index 358aa58aba0f7..882992da6b508 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCMSPageUrlRewriteAndAddPermanentRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCMSPageUrlRewriteAndAddPermanentRedirectTest.xml @@ -23,7 +23,7 @@ </before> <after> <deleteData createDataKey="createCMSPage" stepKey="deleteCMSPage"/> - <actionGroup ref="AdminDeleteUrlRewrite" stepKey="deleteCustomUrlRewrite"> + <actionGroup ref="AdminDeleteUrlRewriteActionGroup" stepKey="deleteCustomUrlRewrite"> <argument name="requestPath" value="{{defaultCmsPage.title}}"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> @@ -36,7 +36,7 @@ <grabFromCurrentUrl stepKey="cmsId" regex="#\/([0-9]*)?\/$#"/> <!-- Open UrlRewrite Edit page and update the fields and fill the created CMS Page Target Path --> - <actionGroup ref="AdminAddCustomUrlRewrite" stepKey="addCustomUrlRewrite"> + <actionGroup ref="AdminAddCustomUrlRewriteActionGroup" stepKey="addCustomUrlRewrite"> <argument name="customUrlRewriteValue" value="Custom"/> <argument name="storeValue" value="Default Store View"/> <argument name="requestPath" value="{{defaultCmsPage.title}}"/> @@ -46,14 +46,14 @@ </actionGroup> <!-- Assert updated CMS page Url Rewrite in Grid --> - <actionGroup ref="AdminSearchByRequestPath" stepKey="searchByRequestPath"> + <actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchByRequestPath"> <argument name="redirectPath" value="{{defaultCmsPage.title}}" /> <argument name="redirectType" value="Permanent (301)" /> <argument name="targetPath" value="cms/page/view/page_id/{$cmsId}"/> </actionGroup> <!-- Assert initial CMS page Url Rewrite in Grid--> - <actionGroup ref="AdminSearchByRequestPath" stepKey="searchByRequestPath1"> + <actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchByRequestPath1"> <argument name="redirectPath" value="$$createCMSPage.identifier$$" /> <argument name="redirectType" value="No"/> <argument name="targetPath" value="cms/page/view/page_id/{$cmsId}"/> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCMSPageUrlRewriteAndAddTemporaryRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCMSPageUrlRewriteAndAddTemporaryRedirectTest.xml index e6ee9b484059d..4af547ad550d5 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCMSPageUrlRewriteAndAddTemporaryRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCMSPageUrlRewriteAndAddTemporaryRedirectTest.xml @@ -23,7 +23,7 @@ </before> <after> <deleteData createDataKey="createCMSPage" stepKey="deleteCMSPage"/> - <actionGroup ref="AdminDeleteUrlRewrite" stepKey="deleteCustomUrlRewrite"> + <actionGroup ref="AdminDeleteUrlRewriteActionGroup" stepKey="deleteCustomUrlRewrite"> <argument name="requestPath" value="{{defaultCmsPage.title}}"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> @@ -36,7 +36,7 @@ <grabFromCurrentUrl stepKey="cmsId" regex="#\/([0-9]*)?\/$#"/> <!-- Open UrlRewrite Edit page and update the fields and fill the created CMS Page Target Path --> - <actionGroup ref="AdminAddCustomUrlRewrite" stepKey="addCustomUrlRewrite"> + <actionGroup ref="AdminAddCustomUrlRewriteActionGroup" stepKey="addCustomUrlRewrite"> <argument name="customUrlRewriteValue" value="Custom"/> <argument name="storeValue" value="Default Store View"/> <argument name="requestPath" value="{{defaultCmsPage.title}}"/> @@ -46,14 +46,14 @@ </actionGroup> <!-- Assert updated CMS page Url Rewrite in Grid --> - <actionGroup ref="AdminSearchByRequestPath" stepKey="searchByRequestPath"> + <actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchByRequestPath"> <argument name="redirectPath" value="{{defaultCmsPage.title}}" /> <argument name="redirectType" value="Temporary (302)" /> <argument name="targetPath" value="cms/page/view/page_id/{$cmsId}"/> </actionGroup> <!-- Assert initial CMS page Url Rewrite in Grid --> - <actionGroup ref="AdminSearchByRequestPath" stepKey="searchByRequestPath1"> + <actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchByRequestPath1"> <argument name="redirectPath" value="$$createCMSPage.identifier$$" /> <argument name="redirectType" value="No"/> <argument name="targetPath" value="cms/page/view/page_id/{$cmsId}"/> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCategoryUrlRewriteAndAddPermanentRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCategoryUrlRewriteAndAddPermanentRedirectTest.xml index b123bc14cb1ed..b8c981dd772cb 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCategoryUrlRewriteAndAddPermanentRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCategoryUrlRewriteAndAddPermanentRedirectTest.xml @@ -23,7 +23,7 @@ </before> <after> <deleteData createDataKey="category" stepKey="deleteCategory"/> - <actionGroup ref="AdminDeleteUrlRewrite" stepKey="deleteCustomUrlRewrite"> + <actionGroup ref="AdminDeleteUrlRewriteActionGroup" stepKey="deleteCustomUrlRewrite"> <argument name="requestPath" value="{{FirstLevelSubCat.name}}.html"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> @@ -36,7 +36,7 @@ <grabFromCurrentUrl stepKey="categoryId" regex="#\/([0-9]*)?\/$#"/> <!-- Open UrlRewrite Edit page and update the fields and fill the created category Target Path --> - <actionGroup ref="AdminAddCustomUrlRewrite" stepKey="addCustomUrlRewrite"> + <actionGroup ref="AdminAddCustomUrlRewriteActionGroup" stepKey="addCustomUrlRewrite"> <argument name="customUrlRewriteValue" value="Custom"/> <argument name="storeValue" value="Default Store View"/> <argument name="requestPath" value="{{FirstLevelSubCat.name}}.html"/> @@ -46,27 +46,27 @@ </actionGroup> <!-- Assert updated category Url Rewrite in grid --> - <actionGroup ref="AdminSearchByRequestPath" stepKey="searchByCategoryRequestPath"> + <actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchByCategoryRequestPath"> <argument name="redirectPath" value="$$category.name$$.html" /> <argument name="redirectType" value="No" /> <argument name="targetPath" value="catalog/category/view/id/{$categoryId}"/> </actionGroup> <!--Assert initial category Url Rewrite in grid --> - <actionGroup ref="AdminSearchByRequestPath" stepKey="searchByNewRequestPath"> + <actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchByNewRequestPath"> <argument name="redirectPath" value="{{FirstLevelSubCat.name}}.html" /> <argument name="redirectType" value="Permanent (301)" /> <argument name="targetPath" value="catalog/category/view/id/{$categoryId}"/> </actionGroup> <!-- Assert updated Category redirect in Store Front --> - <actionGroup ref="AssertStorefrontUrlRewriteRedirect" stepKey="verifyCategoryInStoreFront"> + <actionGroup ref="AssertStorefrontUrlRewriteRedirectActionGroup" stepKey="verifyCategoryInStoreFront"> <argument name="category" value="$$category.name$$"/> <argument name="newRequestPath" value="{{FirstLevelSubCat.name}}.html"/> </actionGroup> <!-- Assert initial Category redirect in Store Front --> - <actionGroup ref="AssertStorefrontUrlRewriteRedirect" stepKey="verifyCategoryInStoreFront1"> + <actionGroup ref="AssertStorefrontUrlRewriteRedirectActionGroup" stepKey="verifyCategoryInStoreFront1"> <argument name="category" value="$$category.name$$"/> <argument name="newRequestPath" value="catalog/category/view/id/{$categoryId}"/> </actionGroup> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomProductUrlRewriteAndAddTemporaryRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomProductUrlRewriteAndAddTemporaryRedirectTest.xml index 711d5389b013b..b450c8d3c759d 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomProductUrlRewriteAndAddTemporaryRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomProductUrlRewriteAndAddTemporaryRedirectTest.xml @@ -23,7 +23,7 @@ </before> <after> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> - <actionGroup ref="AdminDeleteUrlRewrite" stepKey="deleteCustomUrlRewrite"> + <actionGroup ref="AdminDeleteUrlRewriteActionGroup" stepKey="deleteCustomUrlRewrite"> <argument name="requestPath" value="{{_defaultProduct.name}}.html"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> @@ -36,7 +36,7 @@ <grabFromCurrentUrl stepKey="productId" regex="#\/([0-9]*)?\/$#"/> <!-- Open UrlRewrite Edit page and update the fields and fill the created product Target Path --> - <actionGroup ref="AdminAddCustomUrlRewrite" stepKey="addCustomUrlRewrite"> + <actionGroup ref="AdminAddCustomUrlRewriteActionGroup" stepKey="addCustomUrlRewrite"> <argument name="customUrlRewriteValue" value="Custom"/> <argument name="storeValue" value="Default Store View"/> <argument name="requestPath" value="{{_defaultProduct.name}}.html"/> @@ -46,28 +46,28 @@ </actionGroup> <!--Assert updated product Url Rewrite in Grid --> - <actionGroup ref="AdminSearchByRequestPath" stepKey="searchByRequestPath"> + <actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchByRequestPath"> <argument name="redirectPath" value="{{_defaultProduct.name}}.html" /> <argument name="redirectType" value="Temporary (302)" /> <argument name="targetPath" value="catalog/product/view/id/{$productId}"/> </actionGroup> <!-- Assert initial product Url rewrite in grid --> - <actionGroup ref="AdminSearchByRequestPath" stepKey="searchByRequestPath1"> + <actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchByRequestPath1"> <argument name="redirectPath" value="$$createProduct.name$$.html" /> <argument name="redirectType" value="No"/> <argument name="targetPath" value="catalog/product/view/id/{$productId}"/> </actionGroup> <!-- Assert updated product redirect in Store Front--> - <actionGroup ref="AssertStorefrontProductRedirect" stepKey="verifyProductInStoreFront"> + <actionGroup ref="AssertStorefrontProductRedirectActionGroup" stepKey="verifyProductInStoreFront"> <argument name="productName" value="$$createProduct.name$$"/> <argument name="productSku" value="$$createProduct.sku$$"/> <argument name="productRequestPath" value="{{_defaultProduct.name}}.html"/> </actionGroup> <!-- Assert initial product redirect in Store Front--> - <actionGroup ref="AssertStorefrontProductRedirect" stepKey="verifyProductInStoreFront1"> + <actionGroup ref="AssertStorefrontProductRedirectActionGroup" stepKey="verifyProductInStoreFront1"> <argument name="productName" value="$$createProduct.name$$"/> <argument name="productSku" value="$$createProduct.sku$$"/> <argument name="productRequestPath" value="$$createProduct.name$$.html"/> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductURLRewriteAndAddNoRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductURLRewriteAndAddNoRedirectTest.xml index f8d297c92a176..2cd10d3548cfb 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductURLRewriteAndAddNoRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductURLRewriteAndAddNoRedirectTest.xml @@ -27,12 +27,12 @@ </after> <!--Filter and Select the created Product --> - <actionGroup ref="AdminSearchUrlRewriteProductBySku" stepKey="searchProduct"> + <actionGroup ref="AdminSearchUrlRewriteProductBySkuActionGroup" stepKey="searchProduct"> <argument name="productSku" value="$$createSimpleProduct.sku$$"/> </actionGroup> <!-- Update the Store, RequestPath, RedirectType and Description --> - <actionGroup ref="AdminAddUrlRewriteForProduct" stepKey="addUrlRewrite"> + <actionGroup ref="AdminAddUrlRewriteForProductActionGroup" stepKey="addUrlRewrite"> <argument name="storeValue" value="Default Store View"/> <argument name="requestPath" value="{{_defaultProduct.urlKey}}.html"/> <argument name="redirectTypeValue" value="No"/> @@ -46,17 +46,17 @@ <grabFromCurrentUrl stepKey="productId" regex="#\/([0-9]*)?\/$#"/> <!--Assert Product Redirect --> - <actionGroup ref="AdminSearchByRequestPath" stepKey="searchByRequestPath"> + <actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchByRequestPath"> <argument name="redirectPath" value="{{_defaultProduct.urlKey}}.html" /> <argument name="redirectType" value="No" /> <argument name="targetPath" value="catalog/product/view/id/{$productId}"/> </actionGroup> <!-- Assert Redirect path, Target Path and Redirect type in grid --> - <actionGroup ref="AdminSearchByRequestPath" stepKey="searchByRequestPath1"> + <actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchByRequestPath1"> <argument name="redirectPath" value="$$createSimpleProduct.name$$.html" /> <argument name="redirectType" value="No" /> <argument name="targetPath" value="catalog/product/view/id/{$productId}"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductURLRewriteWithCategoryAndAddTemporaryRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductURLRewriteWithCategoryAndAddTemporaryRedirectTest.xml index ae18ab33ba6ce..82473fb13a33b 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductURLRewriteWithCategoryAndAddTemporaryRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductURLRewriteWithCategoryAndAddTemporaryRedirectTest.xml @@ -31,12 +31,12 @@ </after> <!--Filter and Select the created Product --> - <actionGroup ref="AdminSearchUrlRewriteProductBySku" stepKey="searchProduct"> + <actionGroup ref="AdminSearchUrlRewriteProductBySkuActionGroup" stepKey="searchProduct"> <argument name="productSku" value="$$createSimpleProduct.sku$$"/> </actionGroup> <!-- Update the Store, RequestPath, RedirectType and Description --> - <actionGroup ref="AdminAddUrlRewriteForProduct" stepKey="addUrlRewrite"> + <actionGroup ref="AdminAddUrlRewriteForProductActionGroup" stepKey="addUrlRewrite"> <argument name="storeValue" value="Default Store View"/> <argument name="requestPath" value="{{FirstLevelSubCat.name_lwr}}/{{_defaultProduct.urlKey}}.html"/> <argument name="redirectTypeValue" value="Temporary (302)"/> @@ -44,7 +44,7 @@ </actionGroup> <!--Assert Product Redirect --> - <actionGroup ref="AdminSearchByRequestPath" stepKey="searchByRequestPath"> + <actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchByRequestPath"> <argument name="redirectPath" value="{{FirstLevelSubCat.name_lwr}}/{{_defaultProduct.urlKey}}.html" /> <argument name="redirectType" value="Temporary (302)" /> <argument name="targetPath" value="$$createSimpleProduct.name$$.html"/> @@ -57,7 +57,7 @@ <grabFromCurrentUrl stepKey="productId" regex="#\/([0-9]*)?\/$#"/> <!-- Assert Redirect path, Target Path and Redirect type in grid --> - <actionGroup ref="AdminSearchByRequestPath" stepKey="searchByRequestPath1"> + <actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchByRequestPath1"> <argument name="redirectPath" value="$$createSimpleProduct.name$$.html" /> <argument name="redirectType" value="No" /> <argument name="targetPath" value="catalog/product/view/id/{$productId}"/> @@ -70,10 +70,10 @@ <grabFromCurrentUrl stepKey="categoryId" regex="#\/([0-9]*)?\/$#"/> <!-- Assert Redirect path, Target Path and Redirect type in grid --> - <actionGroup ref="AdminSearchByRequestPath" stepKey="searchByRequestPath2"> + <actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchByRequestPath2"> <argument name="redirectPath" value="$$createCategory.name$$.html" /> <argument name="redirectType" value="No" /> <argument name="targetPath" value="catalog/category/view/id/{$categoryId}"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductUrLRewriteAndAddPermanentRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductUrLRewriteAndAddPermanentRedirectTest.xml index 66c586d4fe891..bfecd98eaa6be 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductUrLRewriteAndAddPermanentRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductUrLRewriteAndAddPermanentRedirectTest.xml @@ -26,12 +26,12 @@ </after> <!--Filter and Select the created Product --> - <actionGroup ref="AdminSearchUrlRewriteProductBySku" stepKey="searchProduct"> + <actionGroup ref="AdminSearchUrlRewriteProductBySkuActionGroup" stepKey="searchProduct"> <argument name="productSku" value="$$createSimpleProduct.sku$$"/> </actionGroup> <!-- Update the Store, RequestPath, RedirectType and Description --> - <actionGroup ref="AdminAddUrlRewriteForProduct" stepKey="addUrlRewrite"> + <actionGroup ref="AdminAddUrlRewriteForProductActionGroup" stepKey="addUrlRewrite"> <argument name="storeValue" value="Default Store View"/> <argument name="requestPath" value="{{_defaultProduct.urlKey}}.html"/> <argument name="redirectTypeValue" value="Permanent (301)"/> @@ -46,17 +46,17 @@ <!--Assert Product Redirect --> - <actionGroup ref="AdminSearchByRequestPath" stepKey="searchByRequestPath"> + <actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchByRequestPath"> <argument name="redirectPath" value="{{_defaultProduct.urlKey}}.html" /> <argument name="redirectType" value="Permanent (301)" /> <argument name="targetPath" value="$$createSimpleProduct.name$$.html"/> </actionGroup> <!-- Assert Redirect Path, Target Path and Redirect type in grid --> - <actionGroup ref="AdminSearchByRequestPath" stepKey="searchByRequestPath1"> + <actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchByRequestPath1"> <argument name="redirectPath" value="$$createSimpleProduct.name$$.html" /> <argument name="redirectType" value="No" /> <argument name="targetPath" value="catalog/product/view/id/{$productId}"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductUrLRewriteAndAddTemporaryRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductUrLRewriteAndAddTemporaryRedirectTest.xml index 2d797a12bedf5..899564287757b 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductUrLRewriteAndAddTemporaryRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductUrLRewriteAndAddTemporaryRedirectTest.xml @@ -27,12 +27,12 @@ </after> <!--Filter and Select the created Product --> - <actionGroup ref="AdminSearchUrlRewriteProductBySku" stepKey="searchProduct"> + <actionGroup ref="AdminSearchUrlRewriteProductBySkuActionGroup" stepKey="searchProduct"> <argument name="productSku" value="$$createSimpleProduct.sku$$"/> </actionGroup> <!-- Update the Store, RequestPath, RedirectType and Description --> - <actionGroup ref="AdminAddUrlRewriteForProduct" stepKey="addUrlRewrite"> + <actionGroup ref="AdminAddUrlRewriteForProductActionGroup" stepKey="addUrlRewrite"> <argument name="storeValue" value="Default Store View"/> <argument name="requestPath" value="{{_defaultProduct.urlKey}}.html"/> <argument name="redirectTypeValue" value="Temporary (302)"/> @@ -46,17 +46,17 @@ <grabFromCurrentUrl stepKey="productId" regex="#\/([0-9]*)?\/$#"/> <!--Assert Product Redirect --> - <actionGroup ref="AdminSearchByRequestPath" stepKey="searchByRequestPath"> + <actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchByRequestPath"> <argument name="redirectPath" value="{{_defaultProduct.urlKey}}.html" /> <argument name="redirectType" value="Temporary (302)" /> <argument name="targetPath" value="$$createSimpleProduct.name$$.html"/> </actionGroup> <!-- Assert Redirect Path, Target Path and Redirect type in grid --> - <actionGroup ref="AdminSearchByRequestPath" stepKey="searchByRequestPath1"> + <actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchByRequestPath1"> <argument name="redirectPath" value="$$createSimpleProduct.name$$.html" /> <argument name="redirectType" value="No" /> <argument name="targetPath" value="catalog/product/view/id/{$productId}"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductWithSeveralWebsitesAndCheckURLRewritesTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductWithSeveralWebsitesAndCheckURLRewritesTest.xml index 4dc5c85830076..96569378404e2 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductWithSeveralWebsitesAndCheckURLRewritesTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductWithSeveralWebsitesAndCheckURLRewritesTest.xml @@ -90,7 +90,7 @@ </actionGroup> <grabFromCurrentUrl stepKey="categoryId" regex="#\/([0-9]*)?\/$#"/> <!-- Open Url Rewrite page and verify new Redirect Path, RedirectType and Target Path for the grabbed category Id --> - <actionGroup ref="AdminSearchByRequestPath" stepKey="searchPath"> + <actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchPath"> <argument name="redirectPath" value="$$category.name$$.html"/> <argument name="redirectType" value="No"/> <argument name="targetPath" value="catalog/category/view/id/{$categoryId}"/> @@ -104,7 +104,7 @@ </actionGroup> <grabFromCurrentUrl stepKey="productId" regex="#\/([0-9]*)?\/$#"/> <!-- Open Url Rewrite page and verify new Redirect Path, RedirectType and Target Path for the grabbed product Id --> - <actionGroup ref="AdminSearchByRequestPath" stepKey="searchPath1"> + <actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchPath1"> <argument name="redirectPath" value="$$createProduct.name$$.html"/> <argument name="redirectType" value="No"/> <argument name="targetPath" value="catalog/product/view/id/{$productId}"/> @@ -112,4 +112,4 @@ <see selector="{{AdminUrlRewriteIndexSection.storeView('1')}}" userInput="{{customStore.name}}" stepKey="seeStoreValueForProductId"/> <see selector="{{AdminUrlRewriteIndexSection.storeView('1')}}" userInput="{{storeViewData.name}}" stepKey="seeStoreViewValueForProductId"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCustomUrlRewriteTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCustomUrlRewriteTest.xml index cf45931029778..288c32102c606 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCustomUrlRewriteTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCustomUrlRewriteTest.xml @@ -27,18 +27,18 @@ </after> <!--Delete created custom url rewrite and verify AssertUrlRewriteDeletedMessage--> - <actionGroup ref="AdminDeleteUrlRewrite" stepKey="deleteUrlRewrite"> + <actionGroup ref="AdminDeleteUrlRewriteActionGroup" stepKey="deleteUrlRewrite"> <argument name="requestPath" value="$$urlRewrite.request_path$$"/> </actionGroup> <!--Search and verify AssertUrlRewriteNotInGrid--> - <actionGroup ref="AdminSearchDeletedUrlRewrite" stepKey="searchDeletedUrlRewriteInGrid"> + <actionGroup ref="AdminSearchDeletedUrlRewriteActionGroup" stepKey="searchDeletedUrlRewriteInGrid"> <argument name="requestPath" value="$$urlRewrite.request_path$$"/> </actionGroup> <!--Verify AssertPageByUrlRewriteIsNotFound--> - <actionGroup ref="AssertPageByUrlRewriteIsNotFound" stepKey="amOnPage"> + <actionGroup ref="AssertPageByUrlRewriteIsNotFoundActionGroup" stepKey="amOnPage"> <argument name="requestPath" value="$$urlRewrite.request_path$$"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminProductCreateUrlRewriteForCustomStoreViewTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminProductCreateUrlRewriteForCustomStoreViewTest.xml index c6ee1a7da9602..26fdd28d004f3 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminProductCreateUrlRewriteForCustomStoreViewTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminProductCreateUrlRewriteForCustomStoreViewTest.xml @@ -67,7 +67,7 @@ <actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="onCategoryPage"> <argument name="category" value="$$createCategory$$"/> </actionGroup> - <actionGroup ref="AssertStorefrontUrlRewriteRedirect" stepKey="assertUrlCategoryOnDefaultStore"> + <actionGroup ref="AssertStorefrontUrlRewriteRedirectActionGroup" stepKey="assertUrlCategoryOnDefaultStore"> <argument name="category" value="$$createCategory.name$$"/> <argument name="newRequestPath" value="u1.html"/> </actionGroup> @@ -92,7 +92,7 @@ <argument name="storeView" value="customStore"/> </actionGroup> <!--Step 9. On Storefront Assert what URL Key for Category is changed and is correct for Custom Store View --> - <actionGroup ref="AssertStorefrontUrlRewriteRedirect" stepKey="assertUrlCategoryOnCustomStore"> + <actionGroup ref="AssertStorefrontUrlRewriteRedirectActionGroup" stepKey="assertUrlCategoryOnCustomStore"> <argument name="category" value="$$createCategory.name$$"/> <argument name="newRequestPath" value="u1.html"/> </actionGroup> @@ -105,7 +105,7 @@ <argument name="productUrl" value="$$createProduct.custom_attributes[url_key]$$"/> </actionGroup> <!--Step 11. On Storefront Assert what URL Key for product is changed and is correct for Custom Store View --> - <actionGroup ref="AssertStorefrontProductRedirect" stepKey="assertProductUrlRewriteInStoreFront"> + <actionGroup ref="AssertStorefrontProductRedirectActionGroup" stepKey="assertProductUrlRewriteInStoreFront"> <argument name="productName" value="$$createProductForUrlRewrite.name$$"/> <argument name="productSku" value="$$createProductForUrlRewrite.sku$$"/> <argument name="productRequestPath" value="u2.html"/> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddAspxRequestPathTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddAspxRequestPathTest.xml index 072753505223d..f03fa5b647df6 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddAspxRequestPathTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddAspxRequestPathTest.xml @@ -27,12 +27,12 @@ </after> <!-- Search and Select Edit option for created category in grid --> - <actionGroup ref="AdminSearchAndSelectUrlRewriteInGrid" stepKey="editUrlRewrite"> + <actionGroup ref="AdminSearchAndSelectUrlRewriteInGridActionGroup" stepKey="editUrlRewrite"> <argument name="requestPath" value="$$category.custom_attributes[url_key]$$.html"/> </actionGroup> <!-- Open UrlRewrite Edit page and update the fields --> - <actionGroup ref="AdminUpdateUrlRewrite" stepKey="updateCategoryUrlRewrite"> + <actionGroup ref="AdminUpdateUrlRewriteActionGroup" stepKey="updateCategoryUrlRewrite"> <argument name="storeValue" value="Default Store View"/> <argument name="requestPath" value="{{defaultUrlRewrite.request_path}}"/> <argument name="redirectTypeValue" value="Temporary (302)"/> @@ -46,14 +46,14 @@ <grabFromCurrentUrl stepKey="categoryId" regex="#\/([0-9]*)?\/$#"/> <!--Assert category Url Rewrite in grid --> - <actionGroup ref="AdminSearchByRequestPath" stepKey="searchByNewRequestPath"> + <actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchByNewRequestPath"> <argument name="redirectPath" value="{{defaultUrlRewrite.request_path}}" /> <argument name="redirectType" value="Temporary (302)" /> <argument name="targetPath" value="catalog/category/view/id/{$categoryId}"/> </actionGroup> <!-- Assert category redirect in Store Front --> - <actionGroup ref="AssertStorefrontUrlRewriteRedirect" stepKey="verifyCategoryInStoreFront"> + <actionGroup ref="AssertStorefrontUrlRewriteRedirectActionGroup" stepKey="verifyCategoryInStoreFront"> <argument name="category" value="$$category.name$$"/> <argument name="newRequestPath" value="{{defaultUrlRewrite.request_path}}"/> </actionGroup> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddNoRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddNoRedirectTest.xml index 80b9dbe41bf59..30a61b49c204d 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddNoRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddNoRedirectTest.xml @@ -27,12 +27,12 @@ </after> <!-- Search and Select Edit option for created category in grid --> - <actionGroup ref="AdminSearchAndSelectUrlRewriteInGrid" stepKey="editUrlRewrite"> + <actionGroup ref="AdminSearchAndSelectUrlRewriteInGridActionGroup" stepKey="editUrlRewrite"> <argument name="requestPath" value="$$category.custom_attributes[url_key]$$.html"/> </actionGroup> <!-- Open UrlRewrite Edit page and update the fields --> - <actionGroup ref="AdminUpdateUrlRewrite" stepKey="updateCategoryUrlRewrite"> + <actionGroup ref="AdminUpdateUrlRewriteActionGroup" stepKey="updateCategoryUrlRewrite"> <argument name="storeValue" value="Default Store View"/> <argument name="requestPath" value="{{defaultUrlRewrite.request_path}}"/> <argument name="redirectTypeValue" value="No"/> @@ -46,14 +46,14 @@ <grabFromCurrentUrl stepKey="categoryId" regex="#\/([0-9]*)?\/$#"/> <!-- Assert category Url Rewrite in grid --> - <actionGroup ref="AdminSearchByRequestPath" stepKey="searchByNewRequestPath"> + <actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchByNewRequestPath"> <argument name="redirectPath" value="{{defaultUrlRewrite.request_path}}" /> <argument name="redirectType" value="No" /> <argument name="targetPath" value="catalog/category/view/id/{$categoryId}"/> </actionGroup> <!-- Assert Category redirect in Store Front --> - <actionGroup ref="AssertStorefrontUrlRewriteRedirect" stepKey="verifyCategoryInStoreFront"> + <actionGroup ref="AssertStorefrontUrlRewriteRedirectActionGroup" stepKey="verifyCategoryInStoreFront"> <argument name="category" value="$$category.name$$"/> <argument name="newRequestPath" value="{{defaultUrlRewrite.request_path}}"/> </actionGroup> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddPermanentRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddPermanentRedirectTest.xml index be9fd1d83c8f1..430964d1f0a17 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddPermanentRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddPermanentRedirectTest.xml @@ -27,12 +27,12 @@ </after> <!-- Search and Select Edit option for created category in grid --> - <actionGroup ref="AdminSearchAndSelectUrlRewriteInGrid" stepKey="editUrlRewrite"> + <actionGroup ref="AdminSearchAndSelectUrlRewriteInGridActionGroup" stepKey="editUrlRewrite"> <argument name="requestPath" value="$$category.custom_attributes[url_key]$$.html"/> </actionGroup> <!-- Open UrlRewrite Edit page and update the fields --> - <actionGroup ref="AdminUpdateUrlRewrite" stepKey="updateCategoryUrlRewrite"> + <actionGroup ref="AdminUpdateUrlRewriteActionGroup" stepKey="updateCategoryUrlRewrite"> <argument name="storeValue" value="Default Store View"/> <argument name="requestPath" value="{{defaultUrlRewrite.request_path}}"/> <argument name="redirectTypeValue" value="Permanent (301)"/> @@ -46,14 +46,14 @@ <grabFromCurrentUrl stepKey="categoryId" regex="#\/([0-9]*)?\/$#"/> <!--Assert category Url Rewrite in grid --> - <actionGroup ref="AdminSearchByRequestPath" stepKey="searchByNewRequestPath"> + <actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchByNewRequestPath"> <argument name="redirectPath" value="{{defaultUrlRewrite.request_path}}" /> <argument name="redirectType" value="Permanent (301)" /> <argument name="targetPath" value="catalog/category/view/id/{$categoryId}"/> </actionGroup> <!-- Assert category redirect in Store Front --> - <actionGroup ref="AssertStorefrontUrlRewriteRedirect" stepKey="verifyCategoryInStoreFront"> + <actionGroup ref="AssertStorefrontUrlRewriteRedirectActionGroup" stepKey="verifyCategoryInStoreFront"> <argument name="category" value="$$category.name$$"/> <argument name="newRequestPath" value="{{defaultUrlRewrite.request_path}}"/> </actionGroup> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddTemporaryRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddTemporaryRedirectTest.xml index 7e1b9acbc47ab..c37bfa15df92c 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddTemporaryRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddTemporaryRedirectTest.xml @@ -27,12 +27,12 @@ </after> <!-- Search and Select Edit option for created category in grid --> - <actionGroup ref="AdminSearchAndSelectUrlRewriteInGrid" stepKey="editUrlRewrite"> + <actionGroup ref="AdminSearchAndSelectUrlRewriteInGridActionGroup" stepKey="editUrlRewrite"> <argument name="requestPath" value="$$category.custom_attributes[url_key]$$.html"/> </actionGroup> <!-- Open UrlRewrite Edit page and update the fields --> - <actionGroup ref="AdminUpdateUrlRewrite" stepKey="updateCategoryUrlRewrite"> + <actionGroup ref="AdminUpdateUrlRewriteActionGroup" stepKey="updateCategoryUrlRewrite"> <argument name="storeValue" value="Default Store View"/> <argument name="requestPath" value="{{updateUrlRewrite.request_path}}"/> <argument name="redirectTypeValue" value="Temporary (302)"/> @@ -46,14 +46,14 @@ <grabFromCurrentUrl stepKey="categoryId" regex="#\/([0-9]*)?\/$#"/> <!--Assert category Url Rewrite in grid --> - <actionGroup ref="AdminSearchByRequestPath" stepKey="searchByNewRequestPath"> + <actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchByNewRequestPath"> <argument name="redirectPath" value="{{updateUrlRewrite.request_path}}" /> <argument name="redirectType" value="Temporary (302)" /> <argument name="targetPath" value="catalog/category/view/id/{$categoryId}"/> </actionGroup> <!-- Assert category redirect in Store Front --> - <actionGroup ref="AssertStorefrontUrlRewriteRedirect" stepKey="verifyCategoryInStoreFront"> + <actionGroup ref="AssertStorefrontUrlRewriteRedirectActionGroup" stepKey="verifyCategoryInStoreFront"> <argument name="category" value="$$category.name$$"/> <argument name="newRequestPath" value="{{updateUrlRewrite.request_path}}"/> </actionGroup> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCustomURLRewritesPermanentTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCustomURLRewritesPermanentTest.xml index 8339eb63abef1..a07f7b8c0fe60 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCustomURLRewritesPermanentTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCustomURLRewritesPermanentTest.xml @@ -23,19 +23,19 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> </before> <after> - <actionGroup ref="AdminDeleteUrlRewrite" stepKey="deleteCustomUrlRewrite"> + <actionGroup ref="AdminDeleteUrlRewriteActionGroup" stepKey="deleteCustomUrlRewrite"> <argument name="requestPath" value="{{customPermanentUrlRewrite.request_path}}"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> </after> <!--Search default custom url rewrite in grid--> - <actionGroup ref="AdminSearchAndSelectUrlRewriteInGrid" stepKey="searchUrlRewrite"> + <actionGroup ref="AdminSearchAndSelectUrlRewriteInGridActionGroup" stepKey="searchUrlRewrite"> <argument name="requestPath" value="$$urlRewrite.request_path$$"/> </actionGroup> <!--Update default custom url rewrite as per requirement and verify AssertUrlRewriteSaveMessage--> - <actionGroup ref="AdminUpdateCustomUrlRewrite" stepKey="updateUrlRewrite"> + <actionGroup ref="AdminUpdateCustomUrlRewriteActionGroup" stepKey="updateUrlRewrite"> <argument name="storeValue" value="Default Store View"/> <argument name="requestPath" value="{{customPermanentUrlRewrite.request_path}}"/> <argument name="targetPath" value="{{customPermanentUrlRewrite.target_path}}"/> @@ -44,7 +44,7 @@ </actionGroup> <!--Search and verify updated AssertUrlRewriteInGrid--> - <actionGroup ref="AdminSearchByRequestPath" stepKey="verifyUpdatedUrlRewriteInGrid"> + <actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="verifyUpdatedUrlRewriteInGrid"> <argument name="redirectPath" value="{{customPermanentUrlRewrite.request_path}}"/> <argument name="redirectType" value="{{customPermanentUrlRewrite.redirect_type_label}}"/> <argument name="targetPath" value="{{customPermanentUrlRewrite.target_path}}"/> @@ -55,4 +55,4 @@ <waitForPageLoad stepKey="waitForPageLoad"/> <seeInCurrentUrl url="{{customPermanentUrlRewrite.target_path}}" stepKey="seeAssertUrlRewrite"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCustomURLRewritesTemporaryTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCustomURLRewritesTemporaryTest.xml index 07d578cbbeca4..73720c3fb5459 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCustomURLRewritesTemporaryTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCustomURLRewritesTemporaryTest.xml @@ -25,7 +25,7 @@ </before> <after> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> - <actionGroup ref="AdminDeleteUrlRewrite" stepKey="deleteCustomUrlRewrite"> + <actionGroup ref="AdminDeleteUrlRewriteActionGroup" stepKey="deleteCustomUrlRewrite"> <argument name="requestPath" value="{{customTemporaryUrlRewrite.request_path}}"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> @@ -38,12 +38,12 @@ <grabFromCurrentUrl stepKey="productId" regex="#\/([0-9]*)?\/$#"/> <!--Search default custom url rewrite in grid--> - <actionGroup ref="AdminSearchAndSelectUrlRewriteInGrid" stepKey="searchUrlRewrite"> + <actionGroup ref="AdminSearchAndSelectUrlRewriteInGridActionGroup" stepKey="searchUrlRewrite"> <argument name="requestPath" value="$$urlRewrite.request_path$$"/> </actionGroup> <!--Update default custom url rewrite as per requirement and verify AssertUrlRewriteSaveMessage--> - <actionGroup ref="AdminUpdateCustomUrlRewrite" stepKey="updateUrlRewrite"> + <actionGroup ref="AdminUpdateCustomUrlRewriteActionGroup" stepKey="updateUrlRewrite"> <argument name="storeValue" value="Default Store View"/> <argument name="requestPath" value="{{customTemporaryUrlRewrite.request_path}}"/> <argument name="targetPath" value="catalog/product/view/id/{$productId}"/> @@ -52,17 +52,17 @@ </actionGroup> <!--Search and verify AssertUrlRewriteInGrid--> - <actionGroup ref="AdminSearchByRequestPath" stepKey="verifyUpdatedUrlRewriteInGrid"> + <actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="verifyUpdatedUrlRewriteInGrid"> <argument name="redirectPath" value="{{customTemporaryUrlRewrite.request_path}}"/> <argument name="redirectType" value="{{customTemporaryUrlRewrite.redirect_type_label}}"/> <argument name="targetPath" value="catalog/product/view/id/{$productId}"/> </actionGroup> <!-- AssertUrlRewriteCustomSearchRedirect--> - <actionGroup ref="AssertStorefrontProductRedirect" stepKey="verifyProductInStoreFrontPage"> + <actionGroup ref="AssertStorefrontProductRedirectActionGroup" stepKey="verifyProductInStoreFrontPage"> <argument name="productName" value="$$createProduct.name$$"/> <argument name="productSku" value="$$createProduct.sku$$"/> <argument name="productRequestPath" value="$$createProduct.name$$.html"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateProductUrlRewriteAndAddTemporaryRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateProductUrlRewriteAndAddTemporaryRedirectTest.xml index ea370d8419583..74f3a60f35cea 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateProductUrlRewriteAndAddTemporaryRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateProductUrlRewriteAndAddTemporaryRedirectTest.xml @@ -27,12 +27,12 @@ </after> <!-- Search and Select Edit option for created product in grid --> - <actionGroup ref="AdminSearchAndSelectUrlRewriteInGrid" stepKey="editUrlRewrite"> + <actionGroup ref="AdminSearchAndSelectUrlRewriteInGridActionGroup" stepKey="editUrlRewrite"> <argument name="requestPath" value="$$createProduct.name$$"/> </actionGroup> <!-- Open UrlRewrite Edit page and update the fields --> - <actionGroup ref="AdminUpdateUrlRewrite" stepKey="updateCategoryUrlRewrite"> + <actionGroup ref="AdminUpdateUrlRewriteActionGroup" stepKey="updateCategoryUrlRewrite"> <argument name="storeValue" value="{{updateUrlRewrite.store}}"/> <argument name="requestPath" value="{{updateUrlRewrite.request_path}}"/> <argument name="redirectTypeValue" value="{{updateUrlRewrite.redirect_type_label}}"/> @@ -40,7 +40,7 @@ </actionGroup> <!-- Assert product Url Rewrite in StoreFront --> - <actionGroup ref="AssertStorefrontProductRedirect" stepKey="assertProductUrlRewriteInStoreFront"> + <actionGroup ref="AssertStorefrontProductRedirectActionGroup" stepKey="assertProductUrlRewriteInStoreFront"> <argument name="productName" value="$$createProduct.name$$"/> <argument name="productSku" value="$$createProduct.sku$$"/> <argument name="productRequestPath" value="{{updateUrlRewrite.request_path}}"/> From c6e7d1dd94d8ebba5e6a4110427a6e738ce41dec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 28 Nov 2019 14:29:16 +0100 Subject: [PATCH 0153/1143] REFACTOR: Extract Action Groups to separate files (according to MFTF best practices) --- ...tualProductOutOfStockWithTierPriceTest.xml | 2 +- ...CustomOptionsSuiteAndImportOptionsTest.xml | 2 +- ...dPageNumberAfterSaveAndCloseActionTest.xml | 4 +- ...CustomizableOptionToProductWithSKUTest.xml | 2 +- ...ductGridFilteringByCustomAttributeTest.xml | 2 +- ...ctImageAssignmentForMultipleStoresTest.xml | 2 +- ...dminRemoveCustomOptionsFromProductTest.xml | 2 +- ...ToAssociateSimpleProductToWebsitesTest.xml | 2 +- ...chorIsVisibleOnViewportOnceClickedTest.xml | 4 +- ...ctCustomOptionsDifferentStoreViewsTest.xml | 4 +- ...ctWithCustomOptionsWithLongValuesTitle.xml | 2 +- .../Test/AdminDeleteCatalogPriceRuleTest.xml | 4 +- .../Mftf/Test/SearchEntityResultsTest.xml | 2 +- .../Mftf/Test/StorefrontGuestCheckoutTest.xml | 2 +- ...CheckResultsOfColorAndOtherFiltersTest.xml | 4 +- .../AdminConfigurableProductUpdateTest.xml | 2 +- ...reateConfigurableProductWithImagesTest.xml | 2 +- ...orefrontConfigurableProductDetailsTest.xml | 10 ++-- .../AdminCreateRetailCustomerGroupTest.xml | 2 +- .../AdminCreateTaxClassCustomerGroupTest.xml | 2 +- ...dminExactMatchSearchInCustomerGridTest.xml | 2 +- .../Mftf/Test/ChangeCustomerGroupTest.xml | 2 +- .../Test/SearchByEmailInCustomerGridTest.xml | 2 +- .../Test/AdminCreatingShippingLabelTest.xml | 2 +- .../AdminCheckDoubleImportOfProductsTest.xml | 4 +- ...lityDifferentStoreViewsAfterImportTest.xml | 4 +- ...utWhenCartPageIsOpenedInAnotherTabTest.xml | 4 +- .../Test/Mftf/Test/AdminCreateInvoiceTest.xml | 2 +- .../Test/AdminReorderWithCatalogPriceTest.xml | 4 +- .../CreateOrderFromEditCustomerPageTest.xml | 2 +- .../Test/Mftf/Test/EndToEndB2CAdminTest.xml | 20 +++---- ...inCartRulesAppliedForProductInCartTest.xml | 4 +- ...ductWithInvisibleIndividualProductTest.xml | 2 +- ...tImageColorWhenFilterByColorFilterTest.xml | 4 +- ...oductImagesMatchingProductSwatchesTest.xml | 4 +- ...DataGridDeleteCustomPerPageActionGroup.xml | 27 +++++++++ .../AdminDataGridFilterActionGroup.xml | 44 -------------- .../AdminDataGridPaginationActionGroup.xml | 57 ------------------- ...DataGridSelectCustomPerPageActionGroup.xml | 27 +++++++++ .../AdminDataGridSelectPerPageActionGroup.xml | 23 ++++++++ .../ClearFiltersAdminDataGridActionGroup.xml | 18 ++++++ ...tAdminDataGridToDefaultViewActionGroup.xml | 20 +++++++ ...earchAdminDataGridByKeywordActionGroup.xml | 23 ++++++++ ...tipleStoreviewsDuringProductImportTest.xml | 8 +-- ...AddMultipleStoreProductsToWishlistTest.xml | 4 +- 45 files changed, 204 insertions(+), 167 deletions(-) create mode 100644 app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminDataGridDeleteCustomPerPageActionGroup.xml delete mode 100644 app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminDataGridFilterActionGroup.xml delete mode 100644 app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminDataGridPaginationActionGroup.xml create mode 100644 app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminDataGridSelectCustomPerPageActionGroup.xml create mode 100644 app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminDataGridSelectPerPageActionGroup.xml create mode 100644 app/code/Magento/Ui/Test/Mftf/ActionGroup/ClearFiltersAdminDataGridActionGroup.xml create mode 100644 app/code/Magento/Ui/Test/Mftf/ActionGroup/ResetAdminDataGridToDefaultViewActionGroup.xml create mode 100644 app/code/Magento/Ui/Test/Mftf/ActionGroup/SearchAdminDataGridByKeywordActionGroup.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductOutOfStockWithTierPriceTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductOutOfStockWithTierPriceTest.xml index 0b929eaddc96e..42cd489e3dcff 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductOutOfStockWithTierPriceTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductOutOfStockWithTierPriceTest.xml @@ -27,7 +27,7 @@ <actionGroup ref="deleteProductBySku" stepKey="deleteVirtualProduct"> <argument name="sku" value="{{virtualProductOutOfStock.sku}}"/> </actionGroup> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFilter"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFilter"/> <actionGroup ref="logout" stepKey="logout"/> </after> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithCustomOptionsSuiteAndImportOptionsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithCustomOptionsSuiteAndImportOptionsTest.xml index 23f772a395a7d..9aa7f451e9091 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithCustomOptionsSuiteAndImportOptionsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithCustomOptionsSuiteAndImportOptionsTest.xml @@ -27,7 +27,7 @@ <actionGroup ref="deleteProductBySku" stepKey="deleteVirtualProduct"> <argument name="sku" value="{{virtualProductCustomImportOptions.sku}}"/> </actionGroup> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="resetOrderFilter"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="resetOrderFilter"/> <actionGroup ref="logout" stepKey="logout"/> </after> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminGridPageNumberAfterSaveAndCloseActionTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminGridPageNumberAfterSaveAndCloseActionTest.xml index eb4a561760070..991c70bb292a4 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminGridPageNumberAfterSaveAndCloseActionTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminGridPageNumberAfterSaveAndCloseActionTest.xml @@ -40,7 +40,7 @@ <amOnPage url="{{ProductCatalogPage.url}}" stepKey="goToProductCatalog"/> <waitForPageLoad stepKey="waitForProductIndexPage"/> <click selector="{{AdminDataGridPaginationSection.previousPage}}" stepKey="clickPrevPageOrderGrid"/> - <actionGroup ref="adminDataGridDeleteCustomPerPage" stepKey="deleteCustomAddedPerPage"> + <actionGroup ref="AdminDataGridDeleteCustomPerPageActionGroup" stepKey="deleteCustomAddedPerPage"> <argument name="perPage" value="ProductPerPage.productCount"/> </actionGroup> <deleteData stepKey="deleteCategory1" createDataKey="category1"/> @@ -51,7 +51,7 @@ </after> <amOnPage url="{{ProductCatalogPage.url}}" stepKey="goToProductCatalog"/> <waitForPageLoad stepKey="waitForProductIndexPage"/> - <actionGroup ref="adminDataGridSelectCustomPerPage" stepKey="select1OrderPerPage"> + <actionGroup ref="AdminDataGridSelectCustomPerPageActionGroup" stepKey="select1OrderPerPage"> <argument name="perPage" value="ProductPerPage.productCount"/> </actionGroup> <!--Go to the next page and edit the product--> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminImportCustomizableOptionToProductWithSKUTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminImportCustomizableOptionToProductWithSKUTest.xml index dfadfdf00481b..a941654db20a8 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminImportCustomizableOptionToProductWithSKUTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminImportCustomizableOptionToProductWithSKUTest.xml @@ -45,7 +45,7 @@ <actionGroup ref="deleteProductBySku" stepKey="deleteSecondProduct"> <argument name="sku" value="$$createFirstProduct.sku$$-1"/> </actionGroup> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearProductGridFilter"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductGridFilter"/> <actionGroup ref="logout" stepKey="logoutOfAdmin"/> </after> <!--Change second product sku to first product sku--> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridFilteringByCustomAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridFilteringByCustomAttributeTest.xml index 72c270aad585c..a1548d870309e 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridFilteringByCustomAttributeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridFilteringByCustomAttributeTest.xml @@ -93,7 +93,7 @@ </after> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductGridPageLoad"/> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearProductGridFilters"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductGridFilters"/> <!--Sort by custom attribute DESC using grabbed value--> <conditionalClick selector="{{AdminProductGridSection.columnHeader($$createDropdownAttribute.attribute[frontend_labels][0][label]$$)}}" dependentSelector="{{AdminProductGridSection.columnHeader($$createDropdownAttribute.attribute[frontend_labels][0][label]$$)}}" visible="true" stepKey="ascendSortByCustomAttribute"/> <waitForPageLoad stepKey="waitForProductGridLoad"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductImageAssignmentForMultipleStoresTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductImageAssignmentForMultipleStoresTest.xml index 8149bc34087fb..37bc5d5f222ae 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductImageAssignmentForMultipleStoresTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductImageAssignmentForMultipleStoresTest.xml @@ -50,7 +50,7 @@ <argument name="customStore" value="customStoreFR"/> </actionGroup> <!-- Clear Filter Store --> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="resetFiltersOnStorePage"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="resetFiltersOnStorePage"/> <!-- Delete Category and Simple Product --> <deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveCustomOptionsFromProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveCustomOptionsFromProductTest.xml index b5f212d1144be..e8eb5915572a0 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveCustomOptionsFromProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveCustomOptionsFromProductTest.xml @@ -27,7 +27,7 @@ <after> <deleteData createDataKey="createProduct" stepKey="deleteProductWithOptions"/> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearProductFilter"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductFilter"/> <actionGroup ref="logout" stepKey="logout"/> </after> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminShouldBeAbleToAssociateSimpleProductToWebsitesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminShouldBeAbleToAssociateSimpleProductToWebsitesTest.xml index 061c30b224828..b0b94461e6405 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminShouldBeAbleToAssociateSimpleProductToWebsitesTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminShouldBeAbleToAssociateSimpleProductToWebsitesTest.xml @@ -43,7 +43,7 @@ </actionGroup> <actionGroup ref="AdminGridFilterResetActionGroup" stepKey="resetFiltersOnStoresIndexPage"/> <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="openProductIndexPageToResetFilters"/> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFiltersOnProductIndexPage"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFiltersOnProductIndexPage"/> <actionGroup ref="logout" stepKey="logout"/> </after> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontEnsureThatAccordionAnchorIsVisibleOnViewportOnceClickedTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontEnsureThatAccordionAnchorIsVisibleOnViewportOnceClickedTest.xml index 0f9f542a97d02..6ee5adb58a18d 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontEnsureThatAccordionAnchorIsVisibleOnViewportOnceClickedTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontEnsureThatAccordionAnchorIsVisibleOnViewportOnceClickedTest.xml @@ -102,7 +102,7 @@ <!-- Go to Pending reviews page and clear filters --> <actionGroup ref="AdminOpenPendingReviewsPageActionGroup" stepKey="openReviewsPage"/> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFilters"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFilters"/> <!-- Moderate first product reviews: change review status from pending to approved, save --> <actionGroup ref="AdminOpenReviewByUserNicknameActionGroup" stepKey="openFirstCustomerReviews"/> @@ -110,7 +110,7 @@ <actionGroup ref="AdminSaveReviewActionGroup" stepKey="saveModeratedFirstReview"/> <!-- Moderate second product reviews: change review status from pending to approved, save --> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFilter"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFilter"/> <actionGroup ref="AdminOpenReviewByUserNicknameActionGroup" stepKey="openSecondCustomerReviews"/> <actionGroup ref="AdminChangeReviewStatusActionGroup" stepKey="changeSecondReviewStatus"/> <actionGroup ref="AdminSaveReviewActionGroup" stepKey="saveModeratedSecondReview"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductCustomOptionsDifferentStoreViewsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductCustomOptionsDifferentStoreViewsTest.xml index a0670bdee54c7..e3dfd5a14bc55 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductCustomOptionsDifferentStoreViewsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductCustomOptionsDifferentStoreViewsTest.xml @@ -63,12 +63,12 @@ <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView2"> <argument name="customStore" value="customStoreFR"/> </actionGroup> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearWebsitesGridFilters"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearWebsitesGridFilters"/> <actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearOrdersGridFilter"/> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearProductsGridFilters"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductsGridFilters"/> <actionGroup ref="logout" stepKey="logout"/> <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogoutStorefront"/> </after> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductWithCustomOptionsWithLongValuesTitle.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductWithCustomOptionsWithLongValuesTitle.xml index e9e23cf157a26..7a667ce9667d4 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductWithCustomOptionsWithLongValuesTitle.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductWithCustomOptionsWithLongValuesTitle.xml @@ -100,7 +100,7 @@ <amOnPage url="{{AdminOrdersPage.url}}" stepKey="onOrdersPage"/> <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappearOnOrdersPage"/> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearGridFilter"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearGridFilter"/> <fillField selector="{{AdminOrdersGridSection.search}}" userInput="{$grabOrderNumber}" stepKey="fillOrderNum"/> <click selector="{{AdminOrdersGridSection.submitSearch}}" stepKey="submitSearchOrderNum"/> <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappearOnSearch"/> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleTest.xml index 16fbca2697702..ccc3296b7bcc3 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleTest.xml @@ -39,10 +39,10 @@ <actionGroup ref="deleteProductBySku" stepKey="deleteConfigurableProduct"> <argument name="sku" value="{{_defaultProduct.sku}}"/> </actionGroup> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearProductsGridFilters"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductsGridFilters"/> <amOnPage url="{{AdminCatalogPriceRuleGridPage.url}}" stepKey="goToCatalogRuleGridPage"/> <waitForPageLoad stepKey="waitForCatalogRuleGridPageLoaded"/> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearCatalogRuleGridFilters"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearCatalogRuleGridFilters"/> <actionGroup ref="logout" stepKey="amOnLogoutPage"/> </after> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml b/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml index 3b60e4b09de28..9426e746ca0fa 100644 --- a/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml +++ b/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml @@ -380,7 +380,7 @@ <actionGroup ref="deleteProductBySku" stepKey="deleteProduct"> <argument name="sku" value="{{_defaultProduct.sku}}"/> </actionGroup> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearProductsGridFilters"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductsGridFilters"/> <actionGroup ref="logout" stepKey="logoutFromAdmin"/> </after> <amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToFrontPage"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutTest.xml index a0914cfc27138..a2007da317c00 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutTest.xml @@ -61,7 +61,7 @@ <amOnPage url="{{AdminOrdersPage.url}}" stepKey="onOrdersPage"/> <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappearOnOrdersPage"/> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearGridFilter"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearGridFilter"/> <fillField selector="{{AdminOrdersGridSection.search}}" userInput="{$grabOrderNumber}" stepKey="fillOrderNum"/> <click selector="{{AdminOrdersGridSection.submitSearch}}" stepKey="submitSearchOrderNum"/> <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappearOnSearch"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckResultsOfColorAndOtherFiltersTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckResultsOfColorAndOtherFiltersTest.xml index de0cca11235ea..1c5fcc5130611 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckResultsOfColorAndOtherFiltersTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckResultsOfColorAndOtherFiltersTest.xml @@ -89,7 +89,7 @@ <actionGroup ref="deleteAttributeSetByLabel" stepKey="deleteAttributeSet"> <argument name="label" value="mySet"/> </actionGroup> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearAttributeSetsFilter"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearAttributeSetsFilter"/> <!-- Delete First attribute --> <actionGroup ref="OpenProductAttributeFromSearchResultInGridActionGroup" stepKey="openProductAttributeFromSearchResultInGrid"> <argument name="productAttributeCode" value="$$createConfigProductAttribute.attribute_code$$"/> @@ -105,7 +105,7 @@ <argument name="productAttributeCode" value="$$createConfigProductAttribute2.attribute_code$$"/> </actionGroup> <!-- Clear filters --> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearProductAttributesFilter"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductAttributesFilter"/> <actionGroup ref="AdminClearFiltersActionGroup" stepKey="clearProductsGridFilter"/> <!-- Log out --> <actionGroup ref="logout" stepKey="logout"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest.xml index 7c6cd57097591..bad1f0dd32391 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest.xml @@ -40,7 +40,7 @@ <deleteData createDataKey="createProduct3" stepKey="deleteThirdProduct"/> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductList"/> <waitForPageLoad stepKey="waitForPageLoad"/> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearProductsGridFilters"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductsGridFilters"/> <actionGroup ref="logout" stepKey="logout"/> </after> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithImagesTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithImagesTest.xml index 9796c14f5519a..9133b61a777b0 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithImagesTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithImagesTest.xml @@ -84,7 +84,7 @@ <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.createNewAttribute}}" time="30" stepKey="waitForConfigurationModalOpen" after="clickCreateConfigurations"/> <!-- Show 100 attributes per page --> - <actionGroup ref="adminDataGridSelectPerPage" stepKey="selectNumberOfAttributesPerPage"> + <actionGroup ref="AdminDataGridSelectPerPageActionGroup" stepKey="selectNumberOfAttributesPerPage"> <argument name="perPage" value="100"/> </actionGroup> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest.xml index 2f5ee036b1420..4ec46d4803793 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest.xml @@ -34,7 +34,7 @@ <actionGroup ref="deleteProductBySku" stepKey="deleteProduct"> <argument name="sku" value="{{_defaultProduct.sku}}"/> </actionGroup> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearProductsGridFilters"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductsGridFilters"/> <actionGroup ref="logout" stepKey="adminLogout"/> </after> @@ -79,7 +79,7 @@ <actionGroup ref="deleteProductBySku" stepKey="deleteProduct"> <argument name="sku" value="{{_defaultProduct.sku}}"/> </actionGroup> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearProductsGridFilters"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductsGridFilters"/> <actionGroup ref="logout" stepKey="adminLogout"/> </after> @@ -124,7 +124,7 @@ <actionGroup ref="deleteProductBySku" stepKey="deleteProduct"> <argument name="sku" value="{{_defaultProduct.sku}}"/> </actionGroup> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearProductsGridFilters"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductsGridFilters"/> <actionGroup ref="logout" stepKey="adminLogout"/> </after> @@ -166,7 +166,7 @@ <actionGroup ref="deleteProductBySku" stepKey="deleteProduct"> <argument name="sku" value="{{_defaultProduct.sku}}"/> </actionGroup> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearProductsGridFilters"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductsGridFilters"/> <actionGroup ref="logout" stepKey="adminLogout"/> </after> @@ -218,7 +218,7 @@ </actionGroup> <deleteData createDataKey="createFirstAttribute" stepKey="deleteFirstAttribute"/> <deleteData createDataKey="createSecondAttribute" stepKey="deleteSecondAttribute"/> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearProductsGridFilters"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductsGridFilters"/> <actionGroup ref="logout" stepKey="adminLogout"/> </after> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateRetailCustomerGroupTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateRetailCustomerGroupTest.xml index 4f1d88ffe99f5..6e08d98a53c56 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateRetailCustomerGroupTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateRetailCustomerGroupTest.xml @@ -26,7 +26,7 @@ <actionGroup ref="AdminDeleteCustomerGroupActionGroup" stepKey="deleteCustomerGroup"> <argument name="customerGroupName" value="{{CustomCustomerGroup.code}}"/> </actionGroup> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFilters"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFilters"/> <actionGroup ref="logout" stepKey="logout"/> </after> <!-- Steps: 1. Log in to backend as admin user. diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateTaxClassCustomerGroupTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateTaxClassCustomerGroupTest.xml index 7d54ede7c1612..4b539ec350435 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateTaxClassCustomerGroupTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateTaxClassCustomerGroupTest.xml @@ -31,7 +31,7 @@ <actionGroup ref="AdminDeleteCustomerGroupActionGroup" stepKey="deleteCustomerGroup"> <argument name="customerGroupName" value="{{CustomCustomerGroup.code}}"/> </actionGroup> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFilters"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFilters"/> <deleteData createDataKey="createCustomerTaxClass" stepKey="deleteCustomerTaxClass"/> <actionGroup ref="logout" stepKey="logout"/> </after> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminExactMatchSearchInCustomerGridTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminExactMatchSearchInCustomerGridTest.xml index 6a7aeab78bcde..d278b6c52d330 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminExactMatchSearchInCustomerGridTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminExactMatchSearchInCustomerGridTest.xml @@ -35,7 +35,7 @@ <!--Step 1: Go to Customers > All Customers--> <amOnPage url="{{AdminCustomerPage.url}}" stepKey="openCustomersGridPage"/> <!--Step 2: On Customers grid page search customer by keyword with quotes--> - <actionGroup ref="searchAdminDataGridByKeyword" stepKey="searchCustomer"> + <actionGroup ref="SearchAdminDataGridByKeywordActionGroup" stepKey="searchCustomer"> <argument name="keyword" value="$$createSecondCustomer.firstname$$"/> </actionGroup> <!--Step 3: Check if customer is placed in a first row and clear grid filter--> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/ChangeCustomerGroupTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/ChangeCustomerGroupTest.xml index e35a1ad61dc7c..d9b71e1e6e9ba 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/ChangeCustomerGroupTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/ChangeCustomerGroupTest.xml @@ -73,7 +73,7 @@ </annotations> <remove keyForRemoval="filterCustomer"/> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFilters" before="selectCustomer"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFilters" before="selectCustomer"/> <actionGroup ref="AdminSelectAllCustomers" stepKey="selectCustomer"/> </test> </tests> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/SearchByEmailInCustomerGridTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/SearchByEmailInCustomerGridTest.xml index e16ec92e507e6..5cce64495bbd2 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/SearchByEmailInCustomerGridTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/SearchByEmailInCustomerGridTest.xml @@ -33,7 +33,7 @@ <!--Step 1: Go to Customers > All Customers--> <amOnPage url="{{AdminCustomerPage.url}}" stepKey="openCustomersGridPage"/> <!--Step 2: On Customers grid page search customer by keyword--> - <actionGroup ref="searchAdminDataGridByKeyword" stepKey="searchCustomer"> + <actionGroup ref="SearchAdminDataGridByKeywordActionGroup" stepKey="searchCustomer"> <argument name="keyword" value="$$createSecondCustomer.email$$"/> </actionGroup> <!--Step 3: Check if customer is placed in a first row and clear grid filter--> diff --git a/app/code/Magento/Fedex/Test/Mftf/Test/AdminCreatingShippingLabelTest.xml b/app/code/Magento/Fedex/Test/Mftf/Test/AdminCreatingShippingLabelTest.xml index 91a76383babd4..acecb62a2811d 100644 --- a/app/code/Magento/Fedex/Test/Mftf/Test/AdminCreatingShippingLabelTest.xml +++ b/app/code/Magento/Fedex/Test/Mftf/Test/AdminCreatingShippingLabelTest.xml @@ -104,7 +104,7 @@ <grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="grabOrderNumber"/> <!--Open created order in admin--> <amOnPage url="{{AdminOrdersPage.url}}" stepKey="onOrdersPage"/> - <actionGroup ref="searchAdminDataGridByKeyword" stepKey="searchOrder"> + <actionGroup ref="SearchAdminDataGridByKeywordActionGroup" stepKey="searchOrder"> <argument name="keyword" value="$grabOrderNumber"/> </actionGroup> <click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/> diff --git a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminCheckDoubleImportOfProductsTest.xml b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminCheckDoubleImportOfProductsTest.xml index 909c6101fe53e..9a6e045cbcf1e 100644 --- a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminCheckDoubleImportOfProductsTest.xml +++ b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminCheckDoubleImportOfProductsTest.xml @@ -33,8 +33,8 @@ <after> <!-- Delete all imported products --> <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="openProductIndexPage"/> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearGridFilter"/> - <actionGroup ref="adminDataGridSelectPerPage" stepKey="selectNumberOfProductsPerPage"> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearGridFilter"/> + <actionGroup ref="AdminDataGridSelectPerPageActionGroup" stepKey="selectNumberOfProductsPerPage"> <argument name="perPage" value="100"/> </actionGroup> <actionGroup ref="deleteProductsIfTheyExist" stepKey="deleteAllProducts"/> diff --git a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminProductVisibilityDifferentStoreViewsAfterImportTest.xml b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminProductVisibilityDifferentStoreViewsAfterImportTest.xml index 0a1423ece71e0..139bf0fdcf58a 100644 --- a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminProductVisibilityDifferentStoreViewsAfterImportTest.xml +++ b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminProductVisibilityDifferentStoreViewsAfterImportTest.xml @@ -34,8 +34,8 @@ <after> <!--Delete all imported products--> <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="openProductIndexPage"/> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearGridFilter"/> - <actionGroup ref="adminDataGridSelectPerPage" stepKey="selectNumberOfProductsPerPage"> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearGridFilter"/> + <actionGroup ref="AdminDataGridSelectPerPageActionGroup" stepKey="selectNumberOfProductsPerPage"> <argument name="perPage" value="100"/> </actionGroup> <actionGroup ref="deleteProductsIfTheyExist" stepKey="deleteAllProducts"/> diff --git a/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontProcessMultishippingCheckoutWhenCartPageIsOpenedInAnotherTabTest.xml b/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontProcessMultishippingCheckoutWhenCartPageIsOpenedInAnotherTabTest.xml index fd79d4d954cd4..7bd16809d3805 100644 --- a/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontProcessMultishippingCheckoutWhenCartPageIsOpenedInAnotherTabTest.xml +++ b/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontProcessMultishippingCheckoutWhenCartPageIsOpenedInAnotherTabTest.xml @@ -105,11 +105,11 @@ <waitForPageLoad stepKey="waitForOrderPageLoad"/> <!-- Go to Admin > Sales > Orders --> <amOnPage url="{{AdminOrdersPage.url}}" stepKey="onOrdersPage"/> - <actionGroup ref="searchAdminDataGridByKeyword" stepKey="searchFirstOrder"> + <actionGroup ref="SearchAdminDataGridByKeywordActionGroup" stepKey="searchFirstOrder"> <argument name="keyword" value="$grabFirstOrderId"/> </actionGroup> <seeElement selector="{{AdminOrdersGridSection.orderId({$grabFirstOrderId})}}" stepKey="seeAdminFirstOrder"/> - <actionGroup ref="searchAdminDataGridByKeyword" stepKey="searchSecondOrder"> + <actionGroup ref="SearchAdminDataGridByKeywordActionGroup" stepKey="searchSecondOrder"> <argument name="keyword" value="$grabSecondOrderId"/> </actionGroup> <seeElement selector="{{AdminOrdersGridSection.orderId({$grabSecondOrderId})}}" stepKey="seeAdminSecondOrder"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml index a90fe5c49f032..3ebc4240ac527 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml @@ -63,7 +63,7 @@ <amOnPage url="{{AdminOrdersPage.url}}" stepKey="onOrdersPage"/> <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask3"/> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearGridFilter"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearGridFilter"/> <fillField selector="{{AdminOrdersGridSection.search}}" userInput="{$grabOrderNumber}" stepKey="searchOrderNum"/> <click selector="{{AdminOrdersGridSection.submitSearch}}" stepKey="submitSearch"/> <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask4"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml index 587b23e857c0c..efd7bae2c480a 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml @@ -48,9 +48,9 @@ <argument name="ruleName" value="{{CatalogRuleToPercent.name}}" /> </actionGroup> <!--Clear all filters in grid--> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="resetCatalogRuleGridFilters"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="resetCatalogRuleGridFilters"/> <amOnPage url="{{AdminOrdersPage.url}}" stepKey="onOrdersPage"/> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearGridFilter"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearGridFilter"/> <actionGroup ref="logout" stepKey="logout"/> </after> <!-- Login as admin --> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/CreateOrderFromEditCustomerPageTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/CreateOrderFromEditCustomerPageTest.xml index 9da5afffb48e5..22cca8248158e 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/CreateOrderFromEditCustomerPageTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/CreateOrderFromEditCustomerPageTest.xml @@ -88,7 +88,7 @@ <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteProductAttribute"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <amOnPage url="{{AdminCustomerPage.url}}" stepKey="openCustomerIndexPage"/> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearCustomerGridFilter"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearCustomerGridFilter"/> <actionGroup ref="logout" stepKey="logout"/> </after> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/EndToEndB2CAdminTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/EndToEndB2CAdminTest.xml index 0fdd8d8c35b32..2158755dbb307 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/EndToEndB2CAdminTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/EndToEndB2CAdminTest.xml @@ -168,10 +168,10 @@ <!--Search order grid by name--> <comment userInput="Admin searches order grid by name" stepKey="searchOrderGridComment" after="waitForOrderGridPageLoad"/> - <actionGroup ref="resetAdminDataGridToDefaultView" stepKey="setOrderGridToDefaultViewForSearch" after="searchOrderGridComment"/> + <actionGroup ref="ResetAdminDataGridToDefaultViewActionGroup" stepKey="setOrderGridToDefaultViewForSearch" after="searchOrderGridComment"/> <!--@TODO use "Ship-to Name" when MQE-794 is fixed--> <see selector="{{AdminDataGridTableSection.column('Ship')}}" userInput="{{Simple_US_Customer.fullname}}" stepKey="seeNonFilterNameInShipNameColumn" after="setOrderGridToDefaultViewForSearch"/> - <actionGroup ref="searchAdminDataGridByKeyword" stepKey="searchOrderGridByNameKeyword" after="seeNonFilterNameInShipNameColumn"> + <actionGroup ref="SearchAdminDataGridByKeywordActionGroup" stepKey="searchOrderGridByNameKeyword" after="seeNonFilterNameInShipNameColumn"> <argument name="keyword" value="BillingAddressTX.fullname"/> </actionGroup> <dontSee selector="{{AdminDataGridTableSection.column('Ship')}}" userInput="{{Simple_US_Customer.fullname}}" stepKey="dontSeeNonFilterNameInShipNameColumn" after="searchOrderGridByNameKeyword"/> @@ -180,7 +180,7 @@ <!--Filter order grid--> <comment userInput="Admin filters order grid by 'Bill-to Name'" stepKey="filterOrderGridByNameComment" after="seeFilterNameInShipNameColumn"/> <!--Filter order grid by "Bill-to Name"--> - <actionGroup ref="resetAdminDataGridToDefaultView" stepKey="resetOrderGridForNameFilter" after="filterOrderGridByNameComment"/> + <actionGroup ref="ResetAdminDataGridToDefaultViewActionGroup" stepKey="resetOrderGridForNameFilter" after="filterOrderGridByNameComment"/> <!--@TODO use "Bill-to Name" when MQE-794 is fixed--> <see selector="{{AdminDataGridTableSection.column('Bill')}}" userInput="{{BillingAddressTX.fullname}}" stepKey="seeNonFilterNameInColumn" after="resetOrderGridForNameFilter"/> <actionGroup ref="filterOrderGridByBillingName" stepKey="filterOrderGridByBillingName" after="seeNonFilterNameInColumn"> @@ -190,7 +190,7 @@ <see selector="{{AdminDataGridTableSection.column('Bill')}}" userInput="{{Simple_US_Customer.fullname}}" stepKey="seeFilterNameInColumn" after="dontSeeNonFilterNameInColumn"/> <!--Filter order grid by Grand Total (Base)--> <comment userInput="Admin filters order grid by 'Grand Total'" stepKey="filterOrderGridByTotalComment" after="seeFilterNameInColumn"/> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFilterBeforeTotalFilter" after="filterOrderGridByTotalComment"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFilterBeforeTotalFilter" after="filterOrderGridByTotalComment"/> <see selector="{{AdminDataGridTableSection.column('Grand Total')}}" userInput="{{AdminOrderSimpleProduct.grandTotal}}" stepKey="seeLowerTotalInGrid" after="clearFilterBeforeTotalFilter"/> <actionGroup ref="filterOrderGridByBaseTotalRange" stepKey="filterOrderGridByTotal" after="seeLowerTotalInGrid"> <argument name="from" value="OrderGrandTotalFilterRange.from"/> @@ -200,7 +200,7 @@ <see selector="{{AdminDataGridTableSection.column('Grand Total')}}" userInput="{{AdminOrderSimpleConfigurableProduct.grandTotal}}" stepKey="seeExpectedTotalInGrid" after="dontSeeLowerTotalInGrid"/> <!--Filter order grid by purchase date--> <comment userInput="Admin filters order grid by 'Purchase Date'" stepKey="filterOrderGridByDateComment" after="seeExpectedTotalInGrid"/> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFilterBeforeOrderDateFilter" after="filterOrderGridByDateComment"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFilterBeforeOrderDateFilter" after="filterOrderGridByDateComment"/> <click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openOrderFilterForOrderDateFrom" after="clearFilterBeforeOrderDateFilter"/> <fillField selector="{{AdminDataGridHeaderSection.filterFieldInput('created_at[from]')}}" userInput="01/01/2018" stepKey="fillOrderDateFromFilter" after="openOrderFilterForOrderDateFrom"/> <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="applyFilterOrderDateFrom" after="fillOrderDateFromFilter"/> @@ -216,7 +216,7 @@ <dontSee selector="{{AdminDataGridTableSection.column('Bill')}}" userInput="{{BillingAddressTX.fullname}}" stepKey="dontSeeSecondOrderInGrid" after="dontSeeFirstOrderInGrid"/> <!--Filter order grid by status--> <comment userInput="Admin filters order grid by 'Status'" stepKey="filterOrderGridByStatusComment" after="dontSeeSecondOrderInGrid"/> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFilterBeforeStatusFilter" after="filterOrderGridByStatusComment"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFilterBeforeStatusFilter" after="filterOrderGridByStatusComment"/> <actionGroup ref="filterOrderGridByStatus" stepKey="filterOrderGridByPendingStatus" after="clearFilterBeforeStatusFilter"> <argument name="status" value="OrderStatus.pending"/> </actionGroup> @@ -229,7 +229,7 @@ <dontSee selector="{{AdminDataGridTableSection.column('Status')}}" userInput="{{OrderStatus.pending}}" stepKey="dontSeePendingStatusInOrderGrid" after="seeClosedStatusInOrderGrid"/> <!--Sort order grid--> - <actionGroup ref="resetAdminDataGridToDefaultView" stepKey="resetOrderGridForSorting" after="dontSeePendingStatusInOrderGrid"/> + <actionGroup ref="ResetAdminDataGridToDefaultViewActionGroup" stepKey="resetOrderGridForSorting" after="dontSeePendingStatusInOrderGrid"/> <!--Sort order grid by status--> <comment userInput="Admin sorts order grid by status" stepKey="sortOrderGridByStatusComment" after="resetOrderGridForSorting"/> <click selector="{{AdminDataGridTableSection.columnHeader('Status')}}" stepKey="clickStatusToSortAsc" after="sortOrderGridByStatusComment"/> @@ -239,9 +239,9 @@ <!--@TODO improve sort assertion and check price and date column when MQE-690 is resolved--> <!--Use paging on order grid--> - <actionGroup ref="resetAdminDataGridToDefaultView" stepKey="resetAdminGridBeforePaging" after="checkStatusSortOrderAsc"/> + <actionGroup ref="ResetAdminDataGridToDefaultViewActionGroup" stepKey="resetAdminGridBeforePaging" after="checkStatusSortOrderAsc"/> <comment userInput="Admin uses paging on order grid" stepKey="usePagingOrderGridComment" after="resetAdminGridBeforePaging"/> - <actionGroup ref="adminDataGridSelectCustomPerPage" stepKey="select1OrderPerPage" after="usePagingOrderGridComment"> + <actionGroup ref="AdminDataGridSelectCustomPerPageActionGroup" stepKey="select1OrderPerPage" after="usePagingOrderGridComment"> <!--@TODO Change this to scalar when MQE-498 is implemented--> <argument name="perPage" value="Const.one"/> </actionGroup> @@ -250,7 +250,7 @@ <click selector="{{AdminDataGridPaginationSection.nextPage}}" stepKey="clickNextPageOrderGrid" after="seeOnFirstPageOrderGrid"/> <seeInField selector="{{AdminDataGridPaginationSection.currentPage}}" userInput="2" stepKey="seeOnSecondPageOrderGrid" after="clickNextPageOrderGrid"/> <seeNumberOfElements selector="{{AdminDataGridTableSection.rows}}" userInput="1" stepKey="see1RowOnSecondPage" after="seeOnSecondPageOrderGrid"/> - <actionGroup ref="adminDataGridSelectPerPage" stepKey="select50OrdersPerPage" after="see1RowOnSecondPage"> + <actionGroup ref="AdminDataGridSelectPerPageActionGroup" stepKey="select50OrdersPerPage" after="see1RowOnSecondPage"> <!--@TODO Change this to scalar when MQE-498 is implemented--> <argument name="perPage" value="Const.fifty"/> </actionGroup> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCartRulesAppliedForProductInCartTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCartRulesAppliedForProductInCartTest.xml index ab085dc5ae137..854ce67eef81a 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCartRulesAppliedForProductInCartTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCartRulesAppliedForProductInCartTest.xml @@ -39,12 +39,12 @@ <actionGroup ref="deleteProductBySku" stepKey="deleteBundleProduct"> <argument name="sku" value="{{BundleProduct.sku}}"/> </actionGroup> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFilters"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFilters"/> <actionGroup ref="DeleteCartPriceRuleByName" stepKey="deleteCartPriceRule"> <argument name="ruleName" value="{{PriceRuleWithCondition.name}}"/> </actionGroup> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFilters1"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFilters1"/> <actionGroup ref="logout" stepKey="logout"/> </after> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCategoryRulesShouldApplyToGroupedProductWithInvisibleIndividualProductTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCategoryRulesShouldApplyToGroupedProductWithInvisibleIndividualProductTest.xml index 8900d838fb825..b90c8d5da0958 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCategoryRulesShouldApplyToGroupedProductWithInvisibleIndividualProductTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCategoryRulesShouldApplyToGroupedProductWithInvisibleIndividualProductTest.xml @@ -76,7 +76,7 @@ <actionGroup ref="AdminDeleteCartPriceRuleActionGroup" stepKey="deleteCartPriceRule"> <argument name="ruleName" value="TestSalesRule"/> </actionGroup> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearGridFilter"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearGridFilter"/> <actionGroup ref="logout" stepKey="logout"/> </after> <!-- Start to create new cart price rule via Category conditions --> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontImageColorWhenFilterByColorFilterTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontImageColorWhenFilterByColorFilterTest.xml index 2928011662864..af75343613a3f 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontImageColorWhenFilterByColorFilterTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontImageColorWhenFilterByColorFilterTest.xml @@ -34,8 +34,8 @@ <argument name="ProductAttribute" value="visualSwatchAttribute"/> </actionGroup> <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="openProductIndexPage"/> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearGridFilter"/> - <actionGroup ref="adminDataGridSelectPerPage" stepKey="selectNumberOfProductsPerPage"> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearGridFilter"/> + <actionGroup ref="AdminDataGridSelectPerPageActionGroup" stepKey="selectNumberOfProductsPerPage"> <argument name="perPage" value="100"/> </actionGroup> <actionGroup ref="deleteProductsIfTheyExist" stepKey="deleteAllProducts"/> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSeeProductImagesMatchingProductSwatchesTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSeeProductImagesMatchingProductSwatchesTest.xml index 1717b424e4597..1fc8c3b2d2727 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSeeProductImagesMatchingProductSwatchesTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSeeProductImagesMatchingProductSwatchesTest.xml @@ -29,11 +29,11 @@ <actionGroup ref="deleteProductAttribute" stepKey="deleteAttribute"> <argument name="ProductAttribute" value="VisualSwatchProductAttribute"/> </actionGroup> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearProductAttributeGridFilter"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductAttributeGridFilter"/> <actionGroup ref="deleteAllDuplicateProductUsingProductGrid" stepKey="deleteAllChildrenProducts"> <argument name="product" value="$$createSimpleProduct$$"/> </actionGroup> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearProductGridFilter"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductGridFilter"/> <actionGroup ref="logout" stepKey="logout"/> </after> diff --git a/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminDataGridDeleteCustomPerPageActionGroup.xml b/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminDataGridDeleteCustomPerPageActionGroup.xml new file mode 100644 index 0000000000000..275aaac39a757 --- /dev/null +++ b/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminDataGridDeleteCustomPerPageActionGroup.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminDataGridDeleteCustomPerPageActionGroup"> + <annotations> + <description>Sets the provided custom 'per page' display setting on an Admin Grid page. Deletes the Items listed in a grid. Validates that the 'per page' count in NOT present.</description> + </annotations> + <arguments> + <argument name="perPage"/> + </arguments> + + <click selector="{{AdminDataGridPaginationSection.perPageDropdown}}" stepKey="clickPerPageDropdown1"/> + <click selector="{{AdminDataGridPaginationSection.perPageEditCustomValue(perPage)}}" stepKey="clickToEditCustomPerPage"/> + <waitForElementVisible selector="{{AdminDataGridPaginationSection.perPageDeleteCustomValue(perPage)}}" time="30" stepKey="waitForDeleteButtonVisible"/> + <click selector="{{AdminDataGridPaginationSection.perPageDeleteCustomValue(perPage)}}" stepKey="clickToDeleteCustomPerPage"/> + <waitForLoadingMaskToDisappear stepKey="waitForGridLoad"/> + <click selector="{{AdminDataGridPaginationSection.perPageDropdown}}" stepKey="clickPerPageDropdown"/> + <dontSeeElement selector="{{AdminDataGridPaginationSection.perPageDropDownItem(perPage)}}" stepKey="dontSeeDropDownItem"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminDataGridFilterActionGroup.xml b/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminDataGridFilterActionGroup.xml deleted file mode 100644 index 4c7b386a4cd00..0000000000000 --- a/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminDataGridFilterActionGroup.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. - */ ---> - -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <!--Search grid with keyword search--> - <actionGroup name="searchAdminDataGridByKeyword"> - <annotations> - <description>Fills 'Search by keyword' on an Admin Grid page. Clicks on Submit Search.</description> - </annotations> - <arguments> - <argument name="keyword"/> - </arguments> - - <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> - <fillField selector="{{AdminDataGridHeaderSection.search}}" userInput="{{keyword}}" stepKey="fillKeywordSearchField"/> - <click selector="{{AdminDataGridHeaderSection.submitSearch}}" stepKey="clickKeywordSearch"/> - </actionGroup> - - <!--Reset data grid to default view--> - <actionGroup name="resetAdminDataGridToDefaultView"> - <annotations> - <description>Resets an Admin Grid page to the 'Default View'.</description> - </annotations> - - <click selector="{{AdminDataGridHeaderSection.bookmarkToggle}}" stepKey="openViewBookmarks"/> - <click selector="{{AdminDataGridHeaderSection.bookmarkOption('Default View')}}" stepKey="selectDefaultGridView"/> - <see selector="{{AdminDataGridHeaderSection.bookmarkToggle}}" userInput="Default View" stepKey="seeDefaultViewSelected"/> - </actionGroup> - - <!--Clear all filters in grid--> - <actionGroup name="clearFiltersAdminDataGrid"> - <annotations> - <description>Clicks on 'Clear Filters' on an Admin Grid page.</description> - </annotations> - - <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingOrderFilters"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminDataGridPaginationActionGroup.xml b/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminDataGridPaginationActionGroup.xml deleted file mode 100644 index 11c5ef039f3e4..0000000000000 --- a/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminDataGridPaginationActionGroup.xml +++ /dev/null @@ -1,57 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="adminDataGridSelectPerPage"> - <annotations> - <description>Sets the provided preset 'per page' display setting on an Admin Grid page.</description> - </annotations> - <arguments> - <argument name="perPage" type="string"/> - </arguments> - - <click selector="{{AdminDataGridPaginationSection.perPageDropdown}}" stepKey="clickPerPageDropdown"/> - <click selector="{{AdminDataGridPaginationSection.perPageOption(perPage)}}" stepKey="selectCustomPerPage"/> - <waitForPageLoad stepKey="waitForGridLoad"/> - </actionGroup> - - <actionGroup name="adminDataGridSelectCustomPerPage"> - <annotations> - <description>Sets the provided custom 'per page' display setting on an Admin Grid page.</description> - </annotations> - <arguments> - <argument name="perPage"/> - </arguments> - - <click selector="{{AdminDataGridPaginationSection.perPageDropdown}}" stepKey="clickPerPageDropdown"/> - <click selector="{{AdminDataGridPaginationSection.perPageOption('Custom')}}" stepKey="selectCustomPerPage"/> - <waitForElementVisible selector="{{AdminDataGridPaginationSection.perPageInput}}" time="30" stepKey="waitForInputVisible"/> - <fillField selector="{{AdminDataGridPaginationSection.perPageInput}}" userInput="{{perPage}}" stepKey="fillCustomPerPage"/> - <click selector="{{AdminDataGridPaginationSection.perPageApplyInput}}" stepKey="applyCustomPerPage"/> - <waitForLoadingMaskToDisappear stepKey="waitForGridLoad"/> - <seeInField selector="{{AdminDataGridPaginationSection.perPageDropDownValue}}" userInput="{{perPage}}" stepKey="seePerPageValueInDropDown"/> - </actionGroup> - - <actionGroup name="adminDataGridDeleteCustomPerPage"> - <annotations> - <description>Sets the provided custom 'per page' display setting on an Admin Grid page. Deletes the Items listed in a grid. Validates that the 'per page' count in NOT present.</description> - </annotations> - <arguments> - <argument name="perPage"/> - </arguments> - - <click selector="{{AdminDataGridPaginationSection.perPageDropdown}}" stepKey="clickPerPageDropdown1"/> - <click selector="{{AdminDataGridPaginationSection.perPageEditCustomValue(perPage)}}" stepKey="clickToEditCustomPerPage"/> - <waitForElementVisible selector="{{AdminDataGridPaginationSection.perPageDeleteCustomValue(perPage)}}" time="30" stepKey="waitForDeleteButtonVisible"/> - <click selector="{{AdminDataGridPaginationSection.perPageDeleteCustomValue(perPage)}}" stepKey="clickToDeleteCustomPerPage"/> - <waitForLoadingMaskToDisappear stepKey="waitForGridLoad"/> - <click selector="{{AdminDataGridPaginationSection.perPageDropdown}}" stepKey="clickPerPageDropdown"/> - <dontSeeElement selector="{{AdminDataGridPaginationSection.perPageDropDownItem(perPage)}}" stepKey="dontSeeDropDownItem"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminDataGridSelectCustomPerPageActionGroup.xml b/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminDataGridSelectCustomPerPageActionGroup.xml new file mode 100644 index 0000000000000..0d9c80e086352 --- /dev/null +++ b/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminDataGridSelectCustomPerPageActionGroup.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminDataGridSelectCustomPerPageActionGroup"> + <annotations> + <description>Sets the provided custom 'per page' display setting on an Admin Grid page.</description> + </annotations> + <arguments> + <argument name="perPage"/> + </arguments> + + <click selector="{{AdminDataGridPaginationSection.perPageDropdown}}" stepKey="clickPerPageDropdown"/> + <click selector="{{AdminDataGridPaginationSection.perPageOption('Custom')}}" stepKey="selectCustomPerPage"/> + <waitForElementVisible selector="{{AdminDataGridPaginationSection.perPageInput}}" time="30" stepKey="waitForInputVisible"/> + <fillField selector="{{AdminDataGridPaginationSection.perPageInput}}" userInput="{{perPage}}" stepKey="fillCustomPerPage"/> + <click selector="{{AdminDataGridPaginationSection.perPageApplyInput}}" stepKey="applyCustomPerPage"/> + <waitForLoadingMaskToDisappear stepKey="waitForGridLoad"/> + <seeInField selector="{{AdminDataGridPaginationSection.perPageDropDownValue}}" userInput="{{perPage}}" stepKey="seePerPageValueInDropDown"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminDataGridSelectPerPageActionGroup.xml b/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminDataGridSelectPerPageActionGroup.xml new file mode 100644 index 0000000000000..df342602a62be --- /dev/null +++ b/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminDataGridSelectPerPageActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminDataGridSelectPerPageActionGroup"> + <annotations> + <description>Sets the provided preset 'per page' display setting on an Admin Grid page.</description> + </annotations> + <arguments> + <argument name="perPage" type="string"/> + </arguments> + + <click selector="{{AdminDataGridPaginationSection.perPageDropdown}}" stepKey="clickPerPageDropdown"/> + <click selector="{{AdminDataGridPaginationSection.perPageOption(perPage)}}" stepKey="selectCustomPerPage"/> + <waitForPageLoad stepKey="waitForGridLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Ui/Test/Mftf/ActionGroup/ClearFiltersAdminDataGridActionGroup.xml b/app/code/Magento/Ui/Test/Mftf/ActionGroup/ClearFiltersAdminDataGridActionGroup.xml new file mode 100644 index 0000000000000..74b4a6c75ed2a --- /dev/null +++ b/app/code/Magento/Ui/Test/Mftf/ActionGroup/ClearFiltersAdminDataGridActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ClearFiltersAdminDataGridActionGroup"> + <annotations> + <description>Clicks on 'Clear Filters' on an Admin Grid page.</description> + </annotations> + + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingOrderFilters"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Ui/Test/Mftf/ActionGroup/ResetAdminDataGridToDefaultViewActionGroup.xml b/app/code/Magento/Ui/Test/Mftf/ActionGroup/ResetAdminDataGridToDefaultViewActionGroup.xml new file mode 100644 index 0000000000000..a07e3c80623de --- /dev/null +++ b/app/code/Magento/Ui/Test/Mftf/ActionGroup/ResetAdminDataGridToDefaultViewActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ResetAdminDataGridToDefaultViewActionGroup"> + <annotations> + <description>Resets an Admin Grid page to the 'Default View'.</description> + </annotations> + + <click selector="{{AdminDataGridHeaderSection.bookmarkToggle}}" stepKey="openViewBookmarks"/> + <click selector="{{AdminDataGridHeaderSection.bookmarkOption('Default View')}}" stepKey="selectDefaultGridView"/> + <see selector="{{AdminDataGridHeaderSection.bookmarkToggle}}" userInput="Default View" stepKey="seeDefaultViewSelected"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Ui/Test/Mftf/ActionGroup/SearchAdminDataGridByKeywordActionGroup.xml b/app/code/Magento/Ui/Test/Mftf/ActionGroup/SearchAdminDataGridByKeywordActionGroup.xml new file mode 100644 index 0000000000000..4a59b1baa70d2 --- /dev/null +++ b/app/code/Magento/Ui/Test/Mftf/ActionGroup/SearchAdminDataGridByKeywordActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SearchAdminDataGridByKeywordActionGroup"> + <annotations> + <description>Fills 'Search by keyword' on an Admin Grid page. Clicks on Submit Search.</description> + </annotations> + <arguments> + <argument name="keyword"/> + </arguments> + + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> + <fillField selector="{{AdminDataGridHeaderSection.search}}" userInput="{{keyword}}" stepKey="fillKeywordSearchField"/> + <click selector="{{AdminDataGridHeaderSection.submitSearch}}" stepKey="clickKeywordSearch"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesCorrectlyGeneratedForMultipleStoreviewsDuringProductImportTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesCorrectlyGeneratedForMultipleStoreviewsDuringProductImportTest.xml index 121fd7c736dcc..69954a2f60480 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesCorrectlyGeneratedForMultipleStoreviewsDuringProductImportTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesCorrectlyGeneratedForMultipleStoreviewsDuringProductImportTest.xml @@ -45,12 +45,12 @@ <actionGroup ref="AdminDeleteStoreViewIfExistsActionGroup" stepKey="deleteStoreViewNl"> <argument name="storeViewName" value="{{customStoreNLNotUnique.name}}"/> </actionGroup> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearStoreFilters"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearStoreFilters"/> <actionGroup ref="deleteProductByName" stepKey="deleteImportedProduct"> <argument name="sku" value="productformagetwo68980"/> <argument name="name" value="productformagetwo68980"/> </actionGroup> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFiltersIfSet"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFiltersIfSet"/> <actionGroup ref="logout" stepKey="logout"/> </after> <actionGroup ref="switchCategoryStoreView" stepKey="switchToStoreViewEn"> @@ -169,12 +169,12 @@ <actionGroup ref="AdminDeleteStoreViewIfExistsActionGroup" stepKey="deleteStoreViewNl"> <argument name="storeViewName" value="{{customStoreNLNotUnique.name}}"/> </actionGroup> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearStoreGridFilters"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearStoreGridFilters"/> <actionGroup ref="deleteProductByName" stepKey="deleteImportedProduct"> <argument name="sku" value="productformagetwo68980"/> <argument name="name" value="productformagetwo68980"/> </actionGroup> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFiltersIfSet"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFiltersIfSet"/> <actionGroup ref="logout" stepKey="logout"/> <magentoCLI command="config:set catalog/seo/generate_category_product_rewrites 1" stepKey="resetConfigurationSetting"/> <!--Flush cache--> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontAddMultipleStoreProductsToWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontAddMultipleStoreProductsToWishlistTest.xml index aeb1d134d8e22..82021e75e0983 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontAddMultipleStoreProductsToWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontAddMultipleStoreProductsToWishlistTest.xml @@ -42,11 +42,11 @@ <actionGroup ref="DeleteCustomStoreActionGroup" stepKey="deleteCustomStoreGroup"> <argument name="storeGroupName" value="$$storeGroup.group[name]$$"/> </actionGroup> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearWebsitesGridFilter"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearWebsitesGridFilter"/> <!--Clear products filter--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearProductsFilters"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductsFilters"/> <!--Logout everywhere--> <actionGroup ref="logout" stepKey="adminLogout"/> <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/> From 9b4c9c01ecbd439af8f3a7aef577f41de89c19b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 28 Nov 2019 14:43:37 +0100 Subject: [PATCH 0154/1143] REFACTOR: Extract Action Groups to separate files (according to MFTF best practices) --- ...thOnlinePaymentIncludingTaxAndDiscount.xml | 2 +- .../Test/StorefrontCustomerCheckoutTest.xml | 4 +- ...StorefrontCheckTaxAddingValidVATIdTest.xml | 12 +- ...ValueWithFullDiscountUsingCartRuleTest.xml | 2 +- .../AddCustomTaxRateActionGroup.xml | 21 ++ .../AddNewTaxRateNoZipActionGroup.xml | 32 +++ .../ActionGroup/AddNewTaxRuleActionGroup.xml | 21 ++ .../AddProductTaxClassActionGroup.xml | 28 ++ .../AdminCustomerTaxClassActionGroup.xml | 25 +- .../Mftf/ActionGroup/AdminTaxActionGroup.xml | 264 ------------------ .../ChangeShippingTaxClassActionGroup.xml | 45 +++ ...ToDefaultTaxConfigurationUIActionGroup.xml | 55 ++++ .../DeleteCustomerTaxClassActionGroup.xml | 30 ++ .../DeleteProductTaxClassActionGroup.xml | 30 ++ .../EditTaxConfigurationByUIActionGroup.xml | 62 ++++ .../SetDefaultShippingTaxClassActionGroup.xml | 43 +++ .../Test/Mftf/Test/AdminTaxReportGridTest.xml | 12 +- .../Mftf/Test/CheckCreditMemoTotalsTest.xml | 2 +- .../Mftf/Test/StorefrontTaxQuoteCartTest.xml | 32 +-- .../Test/StorefrontTaxQuoteCheckoutTest.xml | 32 +-- 20 files changed, 418 insertions(+), 336 deletions(-) create mode 100644 app/code/Magento/Tax/Test/Mftf/ActionGroup/AddCustomTaxRateActionGroup.xml create mode 100644 app/code/Magento/Tax/Test/Mftf/ActionGroup/AddNewTaxRateNoZipActionGroup.xml create mode 100644 app/code/Magento/Tax/Test/Mftf/ActionGroup/AddNewTaxRuleActionGroup.xml create mode 100644 app/code/Magento/Tax/Test/Mftf/ActionGroup/AddProductTaxClassActionGroup.xml delete mode 100644 app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminTaxActionGroup.xml create mode 100644 app/code/Magento/Tax/Test/Mftf/ActionGroup/ChangeShippingTaxClassActionGroup.xml create mode 100644 app/code/Magento/Tax/Test/Mftf/ActionGroup/ChangeToDefaultTaxConfigurationUIActionGroup.xml create mode 100644 app/code/Magento/Tax/Test/Mftf/ActionGroup/DeleteCustomerTaxClassActionGroup.xml create mode 100644 app/code/Magento/Tax/Test/Mftf/ActionGroup/DeleteProductTaxClassActionGroup.xml create mode 100644 app/code/Magento/Tax/Test/Mftf/ActionGroup/EditTaxConfigurationByUIActionGroup.xml create mode 100644 app/code/Magento/Tax/Test/Mftf/ActionGroup/SetDefaultShippingTaxClassActionGroup.xml diff --git a/app/code/Magento/Braintree/Test/Mftf/Test/CretateAdminOrderWithOnlinePaymentIncludingTaxAndDiscount.xml b/app/code/Magento/Braintree/Test/Mftf/Test/CretateAdminOrderWithOnlinePaymentIncludingTaxAndDiscount.xml index 8f0ce4918b978..db87c727a3fee 100644 --- a/app/code/Magento/Braintree/Test/Mftf/Test/CretateAdminOrderWithOnlinePaymentIncludingTaxAndDiscount.xml +++ b/app/code/Magento/Braintree/Test/Mftf/Test/CretateAdminOrderWithOnlinePaymentIncludingTaxAndDiscount.xml @@ -90,7 +90,7 @@ <see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/> <!--Set Taxable Goods for Shipping Tax Class--> - <actionGroup ref="changeShippingTaxClass" stepKey="changeShippingTaxClass"/> + <actionGroup ref="ChangeShippingTaxClassActionGroup" stepKey="changeShippingTaxClass"/> <!--Adding Special price to product--> <amOnPage url="{{AdminProductEditPage.url($$simpleProduct.id$$)}}" stepKey="openAdminProductEditPage"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml index 218ff959750d6..917a4ac58464f 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml @@ -116,11 +116,11 @@ <fillField stepKey="fillRuleName" selector="{{AdminTaxRulesSection.ruleName}}" userInput="SampleRule"/> <!-- Add NY and CA tax rules --> - <actionGroup ref="addNewTaxRateNoZip" stepKey="addNYTaxRate"> + <actionGroup ref="AddNewTaxRateNoZipActionGroup" stepKey="addNYTaxRate"> <argument name="taxCode" value="SimpleTaxNY"/> </actionGroup> - <actionGroup ref="addNewTaxRateNoZip" stepKey="addCATaxRate"> + <actionGroup ref="AddNewTaxRateNoZipActionGroup" stepKey="addCATaxRate"> <argument name="taxCode" value="SimpleTaxCA"/> </actionGroup> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCheckTaxAddingValidVATIdTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCheckTaxAddingValidVATIdTest.xml index 8469126547eb1..4c35cdbdb7cbb 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCheckTaxAddingValidVATIdTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCheckTaxAddingValidVATIdTest.xml @@ -30,23 +30,23 @@ </before> <!--Add new tax rates. Go to tax rule page --> - <actionGroup ref="addNewTaxRuleActionGroup" stepKey="addFirstTaxRuleActionGroup"/> + <actionGroup ref="AddNewTaxRuleActionGroup" stepKey="addFirstTaxRuleActionGroup"/> <fillField stepKey="fillRuleName" selector="{{AdminTaxRulesSection.ruleName}}" userInput="{{TaxRule.name}}"/> <!-- Add NY and CA tax rules --> - <actionGroup ref="addNewTaxRateNoZip" stepKey="addSimpleTaxUK"> + <actionGroup ref="AddNewTaxRateNoZipActionGroup" stepKey="addSimpleTaxUK"> <argument name="taxCode" value="SimpleTaxUK"/> </actionGroup> <click stepKey="clickSave" selector="{{AdminStoresMainActionsSection.saveButton}}"/> <waitForPageLoad stepKey="waitForNewTaxRuleCreated"/> <!-- Go to tax rule page to create second Tax Rule--> - <actionGroup ref="addNewTaxRuleActionGroup" stepKey="addSecondTaxRuleActionGroup"/> + <actionGroup ref="AddNewTaxRuleActionGroup" stepKey="addSecondTaxRuleActionGroup"/> <fillField stepKey="fillSecondRuleName" selector="{{AdminTaxRulesSection.ruleName}}" userInput="{{TaxRuleZeroRate.name}}"/> - <actionGroup ref="addNewTaxRateNoZip" stepKey="addSimpleTaxUKZeroRate"> + <actionGroup ref="AddNewTaxRateNoZipActionGroup" stepKey="addSimpleTaxUKZeroRate"> <argument name="taxCode" value="SimpleTaxUKZeroRate"/> </actionGroup> - <actionGroup ref="addCustomerTaxClass" stepKey="addCustomerTaxClass"> + <actionGroup ref="AddCustomerTaxClassActionGroup" stepKey="addCustomerTaxClass"> <argument name="customerTaxClassName" value="UK_zero"/> </actionGroup> <click stepKey="disableDefaultProdTaxClass" selector="{{AdminTaxRulesSection.defaultCustomerTaxClass}}"/> @@ -138,7 +138,7 @@ <deleteData createDataKey="createProduct" stepKey="deleteSimpleProduct"/> <deleteData createDataKey="createCategory" stepKey="deleteCategoryFirst"/> - <actionGroup ref="deleteProductTaxClass" stepKey="deleteFirstProductTaxClass"> + <actionGroup ref="DeleteProductTaxClassActionGroup" stepKey="deleteFirstProductTaxClass"> <argument name="taxClassName" value="UK_zero"/> </actionGroup> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartTotalValueWithFullDiscountUsingCartRuleTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartTotalValueWithFullDiscountUsingCartRuleTest.xml index 903e79b2328bc..f12b8ea7ca331 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartTotalValueWithFullDiscountUsingCartRuleTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartTotalValueWithFullDiscountUsingCartRuleTest.xml @@ -39,7 +39,7 @@ <click stepKey="addNewTaxRate" selector="{{AdminGridMainControls.add}}"/> <fillField stepKey="fillRuleName" selector="{{AdminTaxRulesSection.ruleName}}" userInput="SampleRule"/> <!-- Add tax rule with 20% tax rate --> - <actionGroup ref="addNewTaxRateNoZip" stepKey="addNYTaxRate"> + <actionGroup ref="AddNewTaxRateNoZipActionGroup" stepKey="addNYTaxRate"> <argument name="taxCode" value="SimpleTaxNYRate"/> </actionGroup> <click stepKey="clickSave" selector="{{AdminStoresMainActionsSection.saveButton}}"/> diff --git a/app/code/Magento/Tax/Test/Mftf/ActionGroup/AddCustomTaxRateActionGroup.xml b/app/code/Magento/Tax/Test/Mftf/ActionGroup/AddCustomTaxRateActionGroup.xml new file mode 100644 index 0000000000000..97d59a51bb68e --- /dev/null +++ b/app/code/Magento/Tax/Test/Mftf/ActionGroup/AddCustomTaxRateActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddCustomTaxRateActionGroup" extends="addNewTaxRateNoZip"> + <annotations> + <description>EXTENDS: addNewTaxRateNoZip. Removes 'fillZipCode' and 'fillRate'. Fills in the Zip Code and Rate. PLEASE NOTE: The values are Hardcoded.</description> + </annotations> + + <remove keyForRemoval="fillZipCode"/> + <remove keyForRemoval="fillRate"/> + <fillField stepKey="fillZipCode" selector="{{AdminTaxRulesSection.zipCode}}" userInput="US-NY-*-Rate 2" after="fillTaxIdentifier"/> + <fillField stepKey="fillRate" selector="{{AdminTaxRulesSection.rate}}" userInput="0" after="selectCountry"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Tax/Test/Mftf/ActionGroup/AddNewTaxRateNoZipActionGroup.xml b/app/code/Magento/Tax/Test/Mftf/ActionGroup/AddNewTaxRateNoZipActionGroup.xml new file mode 100644 index 0000000000000..8a2945130c925 --- /dev/null +++ b/app/code/Magento/Tax/Test/Mftf/ActionGroup/AddNewTaxRateNoZipActionGroup.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddNewTaxRateNoZipActionGroup"> + <annotations> + <description>Goes to the Admin Tax Rules grid page. Adds the provided Tax Code.</description> + </annotations> + <arguments> + <argument name="taxCode"/> + </arguments> + + <!-- Go to the tax rate page --> + <click stepKey="addNewTaxRate" selector="{{AdminTaxRulesSection.addNewTaxRate}}"/> + + <!-- Fill out a new tax rate --> + <fillField stepKey="fillTaxIdentifier" selector="{{AdminTaxRulesSection.taxIdentifier}}" userInput="{{taxCode.state}}-{{taxCode.rate}}"/> + <fillField stepKey="fillZipCode" selector="{{AdminTaxRulesSection.zipCode}}" userInput="{{taxCode.zip}}"/> + <selectOption stepKey="selectState" selector="{{AdminTaxRulesSection.state}}" userInput="{{taxCode.state}}"/> + <selectOption stepKey="selectCountry" selector="{{AdminTaxRulesSection.country}}" userInput="{{taxCode.country}}"/> + <fillField stepKey="fillRate" selector="{{AdminTaxRulesSection.rate}}" userInput="{{taxCode.rate}}"/> + + <!-- Save the tax rate --> + <click stepKey="saveTaxRate" selector="{{AdminTaxRulesSection.save}}"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Tax/Test/Mftf/ActionGroup/AddNewTaxRuleActionGroup.xml b/app/code/Magento/Tax/Test/Mftf/ActionGroup/AddNewTaxRuleActionGroup.xml new file mode 100644 index 0000000000000..6bc7ef6f540c3 --- /dev/null +++ b/app/code/Magento/Tax/Test/Mftf/ActionGroup/AddNewTaxRuleActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddNewTaxRuleActionGroup"> + <annotations> + <description>Goes to the Admin Tax Rules grid page. Clicks on the Add New Tax Rule button.</description> + </annotations> + + <!-- Go to tax rule page --> + <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRulePage"/> + <waitForPageLoad stepKey="waitForTaxRatePage"/> + <click stepKey="addNewTaxRate" selector="{{AdminGridMainControls.add}}"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Tax/Test/Mftf/ActionGroup/AddProductTaxClassActionGroup.xml b/app/code/Magento/Tax/Test/Mftf/ActionGroup/AddProductTaxClassActionGroup.xml new file mode 100644 index 0000000000000..943d05ee37504 --- /dev/null +++ b/app/code/Magento/Tax/Test/Mftf/ActionGroup/AddProductTaxClassActionGroup.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddProductTaxClassActionGroup"> + <annotations> + <description>Adds the provided Product Tax Class to a Tax Rule. Clicks on Save.</description> + </annotations> + <arguments> + <argument name="prodTaxClassName" type="string"/> + </arguments> + + <!--Click Additional Settings--> + <click stepKey="clickAdditionalSettings" selector="{{AdminTaxRulesSection.additionalSettings}}"/> + <!--Click Product Add New Tax Class Button--> + <click stepKey="clickProdAddNewTaxClassBtn" selector="{{AdminTaxRulesSection.productAddNewTaxClass}}"/> + <!--Fill field--> + <fillField stepKey="fillProdNewTaxClass" selector="{{AdminTaxRulesSection.fieldProdNewTaxClass}}" userInput="{{prodTaxClassName}}"/> + <!-- Save Product tax rate --> + <click stepKey="saveProdTaxRate" selector="{{AdminTaxRulesSection.saveProdNewTaxClass}}"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminCustomerTaxClassActionGroup.xml b/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminCustomerTaxClassActionGroup.xml index f711633e1e00b..d627448edf730 100644 --- a/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminCustomerTaxClassActionGroup.xml +++ b/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminCustomerTaxClassActionGroup.xml @@ -9,14 +9,14 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <!--Add Customer Tax Class--> - <actionGroup name="addCustomerTaxClass"> + <actionGroup name="AddCustomerTaxClassActionGroup"> <annotations> <description>Adds the provided Customer Tax Class on the Admin Tax Rule creation/edit page.</description> </annotations> <arguments> <argument name="customerTaxClassName" type="string"/> </arguments> - + <!--Click Additional Settings--> <click stepKey="clickAdditionalSettings" selector="{{AdminTaxRulesSection.additionalSettings}}"/> <!--Click Product Add New Tax Class Button--> @@ -26,25 +26,4 @@ <!-- Save Product tax rate --> <click stepKey="saveProdTaxRate" selector="{{AdminTaxRulesSection.saveCustomerNewTaxClass}}"/> </actionGroup> - - <!--Delete Product Tax Class--> - <actionGroup name="deleteCustomerTaxClass"> - <annotations> - <description>Goes to the Admin New Tax Rule page. Deletes the provided Tax Class Name.</description> - </annotations> - <arguments> - <argument name="taxClassName" type="string"/> - </arguments> - - <!-- Go to tax rule page --> - <amOnPage url="{{AdminNewTaxRulePage.url}}" stepKey="goToNewTaxRulePage"/> - <waitForPageLoad stepKey="waitForTaxRatePage"/> - <click stepKey="clickAdditionalSettings" selector="{{AdminTaxRulesSection.additionalSettings}}"/> - <scrollTo stepKey="scrollToAdditionalSettings" selector="{{AdminTaxRulesSection.additionalSettings}}"/> - <moveMouseOver stepKey="hoverDeleteElement" selector="{{AdminTaxRulesSection.deleteTaxClassName(taxClassName)}}"/> - <click stepKey="deleteFirstTaxClass" selector="{{AdminTaxRulesSection.deleteTaxClass(taxClassName)}}"/> - <waitForElementVisible selector="{{AdminTaxRulesSection.popUpDialogOK}}" stepKey="waitForElementBecomeVisible"/> - <click stepKey="acceptPopUpDialog" selector="{{AdminTaxRulesSection.popUpDialogOK}}"/> - <waitForPageLoad stepKey="waitForProductTaxClassDeleted"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminTaxActionGroup.xml b/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminTaxActionGroup.xml deleted file mode 100644 index e1674481b8bb9..0000000000000 --- a/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminTaxActionGroup.xml +++ /dev/null @@ -1,264 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <!-- Change the tax configuration to display in cart and checkout flow --> - <actionGroup name="editTaxConfigurationByUI"> - <annotations> - <description>Goes to the 'Configuration' page for 'Tax'. Enables the display of Taxes in the Storefront Shopping Cart and Checkout page.</description> - </annotations> - - <!-- navigate to the tax configuration page --> - <amOnPage url="{{AdminTaxConfigurationPage.url}}" stepKey="goToAdminTaxPage"/> - <waitForPageLoad stepKey="waitForTaxConfigLoad"/> - - <!-- change the default state to California --> - <scrollTo selector="#tax_defaults-head" x="0" y="-80" stepKey="scrollToTaxDefaults"/> - - <!-- conditionalClick twice to fix some flaky behavior --> - <conditionalClick stepKey="clickCalculationSettings" selector="{{AdminConfigureTaxSection.defaultDestination}}" dependentSelector="#tax_defaults" visible="false"/> - <conditionalClick stepKey="clickCalculationSettingsAgain" selector="{{AdminConfigureTaxSection.defaultDestination}}" dependentSelector="#tax_defaults" visible="false"/> - <uncheckOption stepKey="clickDefaultState" selector="{{AdminConfigureTaxSection.systemValueDefaultState}}"/> - <selectOption stepKey="selectDefaultState" selector="{{AdminConfigureTaxSection.dropdownDefaultState}}" userInput="California"/> - <fillField stepKey="fillDefaultPostCode" selector="{{AdminConfigureTaxSection.defaultPostCode}}" userInput="*"/> - - <!-- change the options for shopping cart display to show tax --> - <scrollTo selector="#tax_cart_display-head" x="0" y="-80" stepKey="scrollToTaxShoppingCartDisplay"/> - - <!-- conditionalClick twice to fix some flaky behavior --> - <conditionalClick stepKey="clickShoppingCartDisplaySettings" selector="{{AdminConfigureTaxSection.shoppingCartDisplay}}" dependentSelector="#tax_cart_display" visible="false"/> - <conditionalClick stepKey="clickShoppingCartDisplaySettingsAgain" selector="{{AdminConfigureTaxSection.shoppingCartDisplay}}" dependentSelector="#tax_cart_display" visible="false"/> - <uncheckOption stepKey="clickTaxTotalCart" selector="{{AdminConfigureTaxSection.systemValueIncludeTaxTotalCart}}"/> - <selectOption stepKey="selectTaxTotalCart" selector="{{AdminConfigureTaxSection.dropdownIncludeTaxTotalCart}}" userInput="Yes"/> - <uncheckOption stepKey="clickDisplayTaxSummaryCart" selector="{{AdminConfigureTaxSection.systemValueDisplayTaxSummaryCart}}"/> - <selectOption stepKey="selectDisplayTaxSummaryCart" selector="{{AdminConfigureTaxSection.dropdownDisplayTaxSummaryCart}}" userInput="Yes"/> - <uncheckOption stepKey="clickDisplayZeroTaxCart" selector="{{AdminConfigureTaxSection.systemValueDisplayZeroTaxCart}}"/> - <selectOption stepKey="selectDisplayZeroTaxCart" selector="{{AdminConfigureTaxSection.dropdownDisplayZeroTaxCart}}" userInput="Yes"/> - - <!-- change the options for orders, invoices, credit memos display to show tax --> - <scrollTo selector="#tax_sales_display-head" x="0" y="-80" stepKey="scrollToTaxSalesDisplay"/> - - <!-- conditionalClick twice to fix some flaky behavior --> - <conditionalClick stepKey="clickOrdersInvoicesCreditSales" selector="{{AdminConfigureTaxSection.ordersInvoicesCreditSales}}" dependentSelector="#tax_sales_display" visible="false"/> - <conditionalClick stepKey="clickOrdersInvoicesCreditSalesAgain" selector="{{AdminConfigureTaxSection.ordersInvoicesCreditSales}}" dependentSelector="#tax_sales_display" visible="false"/> - <uncheckOption stepKey="clickTaxTotalSales" selector="{{AdminConfigureTaxSection.systemValueIncludeTaxTotalSales}}"/> - <selectOption stepKey="selectTaxTotalSales" selector="{{AdminConfigureTaxSection.dropdownIncludeTaxTotalSales}}" userInput="Yes"/> - <uncheckOption stepKey="clickDisplayTaxSummarySales" selector="{{AdminConfigureTaxSection.systemValueDisplayTaxSummarySales}}"/> - <selectOption stepKey="selectDisplayTaxSummarySales" selector="{{AdminConfigureTaxSection.dropdownDisplayTaxSummarySales}}" userInput="Yes"/> - <uncheckOption stepKey="clickDisplayZeroTaxSales" selector="{{AdminConfigureTaxSection.systemValueDisplayZeroTaxSales}}"/> - <selectOption stepKey="selectDisplayZeroTaxSales" selector="{{AdminConfigureTaxSection.dropdownDisplayZeroTaxSales}}" userInput="Yes"/> - - <!-- Save the settings --> - <scrollToTopOfPage stepKey="scrollToTop"/> - <click stepKey="saveTaxOptions" selector="{{AdminCategoryMainActionsSection.SaveButton}}"/> - <waitForPageLoad stepKey="waitForTaxSaved"/> - <see stepKey="seeSuccess" selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the configuration."/> - </actionGroup> - - <actionGroup name="changeToDefaultTaxConfigurationUI"> - <annotations> - <description>Goes to the 'Configuration' page for 'Tax'. Set the Tax Configuration Settings to the Default values. Clicks on Save. Validates that the Success Message is present and correct.</description> - </annotations> - - <!-- navigate to the tax configuration page --> - <amOnPage url="{{AdminTaxConfigurationPage.url}}" stepKey="goToAdminTaxPage"/> - <waitForPageLoad stepKey="waitForTaxConfigLoad"/> - - <!-- change the default state to none --> - <!-- conditionalClick twice to fix some flaky behavior --> - <conditionalClick stepKey="clickCalculationSettings" selector="{{AdminConfigureTaxSection.defaultDestination}}" dependentSelector="{{AdminConfigureTaxSection.systemValueDefaultState}}" visible="false"/> - <conditionalClick stepKey="clickCalculationSettingsAgain" selector="{{AdminConfigureTaxSection.defaultDestination}}" dependentSelector="{{AdminConfigureTaxSection.systemValueDefaultState}}" visible="false"/> - <checkOption stepKey="clickDefaultState" selector="{{AdminConfigureTaxSection.systemValueDefaultState}}"/> - <selectOption stepKey="selectDefaultState" selector="{{AdminConfigureTaxSection.dropdownDefaultState}}" userInput="California"/> - <fillField stepKey="fillDefaultPostCode" selector="{{AdminConfigureTaxSection.defaultPostCode}}" userInput=""/> - - <!-- change the options for shopping cart display to not show tax --> - <!-- conditionalClick twice to fix some flaky behavior --> - <conditionalClick stepKey="clickShoppingCartDisplaySettings" selector="{{AdminConfigureTaxSection.shoppingCartDisplay}}" dependentSelector="{{AdminConfigureTaxSection.systemValueIncludeTaxTotalCart}}" visible="false"/> - <conditionalClick stepKey="clickShoppingCartDisplaySettingsAgain" selector="{{AdminConfigureTaxSection.shoppingCartDisplay}}" dependentSelector="{{AdminConfigureTaxSection.systemValueIncludeTaxTotalCart}}" visible="false"/> - <checkOption stepKey="clickTaxTotalCart" selector="{{AdminConfigureTaxSection.systemValueIncludeTaxTotalCart}}"/> - <selectOption stepKey="selectTaxTotalCart" selector="{{AdminConfigureTaxSection.dropdownIncludeTaxTotalCart}}" userInput="Yes"/> - <checkOption stepKey="clickDisplayTaxSummaryCart" selector="{{AdminConfigureTaxSection.systemValueDisplayTaxSummaryCart}}"/> - <selectOption stepKey="selectDisplayTaxSummaryCart" selector="{{AdminConfigureTaxSection.dropdownDisplayTaxSummaryCart}}" userInput="Yes"/> - <checkOption stepKey="clickDisplayZeroTaxCart" selector="{{AdminConfigureTaxSection.systemValueDisplayZeroTaxCart}}"/> - <selectOption stepKey="selectDisplayZeroTaxCart" selector="{{AdminConfigureTaxSection.dropdownDisplayZeroTaxCart}}" userInput="Yes"/> - - <!-- change the options for orders, invoices, credit memos display to not show tax --> - <!-- conditionalClick twice to fix some flaky behavior --> - <conditionalClick stepKey="clickOrdersInvoicesCreditSales" selector="{{AdminConfigureTaxSection.ordersInvoicesCreditSales}}" dependentSelector="{{AdminConfigureTaxSection.systemValueIncludeTaxTotalSales}}" visible="false"/> - <conditionalClick stepKey="clickOrdersInvoicesCreditSalesAgain" selector="{{AdminConfigureTaxSection.ordersInvoicesCreditSales}}" dependentSelector="{{AdminConfigureTaxSection.systemValueIncludeTaxTotalSales}}" visible="false"/> - <checkOption stepKey="clickTaxTotalSales" selector="{{AdminConfigureTaxSection.systemValueIncludeTaxTotalSales}}"/> - <selectOption stepKey="selectTaxTotalSales" selector="{{AdminConfigureTaxSection.dropdownIncludeTaxTotalSales}}" userInput="Yes"/> - <checkOption stepKey="clickDisplayTaxSummarySales" selector="{{AdminConfigureTaxSection.systemValueDisplayTaxSummarySales}}"/> - <selectOption stepKey="selectDisplayTaxSummarySales" selector="{{AdminConfigureTaxSection.dropdownDisplayTaxSummarySales}}" userInput="Yes"/> - <checkOption stepKey="clickDisplayZeroTaxSales" selector="{{AdminConfigureTaxSection.systemValueDisplayZeroTaxSales}}"/> - <selectOption stepKey="selectDisplayZeroTaxSales" selector="{{AdminConfigureTaxSection.dropdownDisplayZeroTaxSales}}" userInput="Yes"/> - - <!-- Save the settings --> - <scrollToTopOfPage stepKey="scrollToTop"/> - <click stepKey="saveTaxOptions" selector="{{AdminCategoryMainActionsSection.SaveButton}}"/> - <see stepKey="seeSuccess" selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the configuration."/> - </actionGroup> - - <actionGroup name="addCustomTaxRate" extends="addNewTaxRateNoZip"> - <annotations> - <description>EXTENDS: addNewTaxRateNoZip. Removes 'fillZipCode' and 'fillRate'. Fills in the Zip Code and Rate. PLEASE NOTE: The values are Hardcoded.</description> - </annotations> - - <remove keyForRemoval="fillZipCode"/> - <remove keyForRemoval="fillRate"/> - <fillField stepKey="fillZipCode" selector="{{AdminTaxRulesSection.zipCode}}" userInput="US-NY-*-Rate 2" after="fillTaxIdentifier"/> - <fillField stepKey="fillRate" selector="{{AdminTaxRulesSection.rate}}" userInput="0" after="selectCountry"/> - </actionGroup> - - <!-- Action group to add a tax rate when on a tax rule configuration page --> - <!-- Must already be on a tax rule configuration page or a new tax rule page --> - <actionGroup name="addNewTaxRateNoZip"> - <annotations> - <description>Goes to the Admin Tax Rules grid page. Adds the provided Tax Code.</description> - </annotations> - <arguments> - <argument name="taxCode"/> - </arguments> - - <!-- Go to the tax rate page --> - <click stepKey="addNewTaxRate" selector="{{AdminTaxRulesSection.addNewTaxRate}}"/> - - <!-- Fill out a new tax rate --> - <fillField stepKey="fillTaxIdentifier" selector="{{AdminTaxRulesSection.taxIdentifier}}" userInput="{{taxCode.state}}-{{taxCode.rate}}"/> - <fillField stepKey="fillZipCode" selector="{{AdminTaxRulesSection.zipCode}}" userInput="{{taxCode.zip}}"/> - <selectOption stepKey="selectState" selector="{{AdminTaxRulesSection.state}}" userInput="{{taxCode.state}}"/> - <selectOption stepKey="selectCountry" selector="{{AdminTaxRulesSection.country}}" userInput="{{taxCode.country}}"/> - <fillField stepKey="fillRate" selector="{{AdminTaxRulesSection.rate}}" userInput="{{taxCode.rate}}"/> - - <!-- Save the tax rate --> - <click stepKey="saveTaxRate" selector="{{AdminTaxRulesSection.save}}"/> - </actionGroup> - - <!--Set Tax Class for Shipping--> - <actionGroup name="changeShippingTaxClass"> - <annotations> - <description>Goes to the 'Configuration' page for 'Tax'. Sets the 'Tax Class for Shipping' configuration setting to 'Taxable Goods'. Clicks on Save. Validates that the Success Message is present and correct.</description> - </annotations> - - <!--Select Configuration menu from Store--> - <click selector="{{AdminMenuSection.stores}}" stepKey="clickOnSTORES"/> - <waitForPageLoad stepKey="waitForConfiguration"/> - <click selector="{{AdminMenuSection.configuration}}" stepKey="clickOnConfigurations"/> - <waitForPageLoad stepKey="waitForSales"/> - - <!--Double click the same to fix flaky issue with redirection to Dashboard--> - <click selector="{{AdminMenuSection.stores}}" stepKey="clickOnSTORES1"/> - <waitForPageLoad stepKey="waitForConfiguration1"/> - <click selector="{{AdminMenuSection.configuration}}" stepKey="clickOnConfigurations1"/> - <waitForPageLoad stepKey="waitForSales1" time="5"/> - - <!--Change default tax class for Shipping on Taxable Goods--> - <click selector="{{ConfigurationListSection.sales}}" stepKey="clickOnSales"/> - <waitForPageLoad stepKey="waitForPaymentMethods"/> - <click selector="{{AdminConfigureTaxSection.salesTax}}" stepKey="clickOnTax"/> - <waitForPageLoad stepKey="waitForTax"/> - <seeInCurrentUrl url="{{AdminTaxConfigurationPage.url}}" stepKey="adminTaxConfiguration"/> - <seeElement selector="{{AdminConfigureTaxSection.taxClasses}}" stepKey="taxClassSectionC"/> - <click selector="{{AdminConfigureTaxSection.taxClasses}}" stepKey="openTaxClassSection"/> - <click selector="{{AdminConfigureTaxSection.taxShippingClassSystem}}" stepKey="uncheckSystemValue"/> - <selectOption selector="{{AdminConfigureTaxSection.taxClassShipping}}" userInput="Taxable Goods" stepKey="setTaxClassForShipping"/> - - <!-- Save the settings --> - <scrollToTopOfPage stepKey="scrollToTop"/> - <click stepKey="saveTaxOptions" selector="{{AdminCategoryMainActionsSection.SaveButton}}"/> - <waitForPageLoad stepKey="waitForTaxSaved"/> - <see stepKey="seeSuccess" selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the configuration."/> - </actionGroup> - - <actionGroup name="setDefaultShippingTaxClass"> - <annotations> - <description>Goes to the 'Configuration' page via the Admin Side Menu. Sets the 'Tax Class for Shipping' to the System Default. Clicks on Save. Validates that the Success Message is present and correct.</description> - </annotations> - - <!--Select Configuration menu from Store--> - <click selector="{{AdminMenuSection.stores}}" stepKey="clickOnSTORES"/> - <waitForPageLoad stepKey="waitForConfiguration"/> - <click selector="{{AdminMenuSection.configuration}}" stepKey="clickOnConfigurations"/> - <waitForPageLoad stepKey="waitForSales"/> - - <!--Double click the same to fix flaky issue with redirection to Dashboard--> - <click selector="{{AdminMenuSection.stores}}" stepKey="clickOnSTORES1"/> - <waitForPageLoad stepKey="waitForConfiguration1"/> - <click selector="{{AdminMenuSection.configuration}}" stepKey="clickOnConfigurations1"/> - <waitForPageLoad stepKey="waitForSales1"/> - - <!--Change default tax class for Shipping on Taxable Goods--> - <click selector="{{ConfigurationListSection.sales}}" stepKey="clickOnSales"/> - <waitForPageLoad stepKey="waitForPaymentMethods"/> - <click selector="{{AdminConfigureTaxSection.salesTax}}" stepKey="clickOnTax"/> - <waitForPageLoad stepKey="waitForTax"/> - <seeElement selector="{{AdminConfigureTaxSection.taxClasses}}" stepKey="taxClassSectionC"/> - <click selector="{{AdminConfigureTaxSection.taxShippingClassSystem}}" stepKey="checkSystemDefaultValue"/> - <click selector="{{AdminConfigureTaxSection.taxClasses}}" stepKey="closeTaxClassSection"/> - - <!-- Save the settings --> - <scrollToTopOfPage stepKey="scrollToTop"/> - <click stepKey="saveTaxOptions" selector="{{AdminCategoryMainActionsSection.SaveButton}}"/> - <waitForPageLoad stepKey="waitForTaxSaved"/> - <see stepKey="seeSuccess" selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the configuration."/> - </actionGroup> - - <!--Add Product Tax Class--> - <actionGroup name="addProductTaxClass"> - <annotations> - <description>Adds the provided Product Tax Class to a Tax Rule. Clicks on Save.</description> - </annotations> - <arguments> - <argument name="prodTaxClassName" type="string"/> - </arguments> - - <!--Click Additional Settings--> - <click stepKey="clickAdditionalSettings" selector="{{AdminTaxRulesSection.additionalSettings}}"/> - <!--Click Product Add New Tax Class Button--> - <click stepKey="clickProdAddNewTaxClassBtn" selector="{{AdminTaxRulesSection.productAddNewTaxClass}}"/> - <!--Fill field--> - <fillField stepKey="fillProdNewTaxClass" selector="{{AdminTaxRulesSection.fieldProdNewTaxClass}}" userInput="{{prodTaxClassName}}"/> - <!-- Save Product tax rate --> - <click stepKey="saveProdTaxRate" selector="{{AdminTaxRulesSection.saveProdNewTaxClass}}"/> - </actionGroup> - - <!--Add New Tax Rule --> - <actionGroup name="addNewTaxRuleActionGroup"> - <annotations> - <description>Goes to the Admin Tax Rules grid page. Clicks on the Add New Tax Rule button.</description> - </annotations> - - <!-- Go to tax rule page --> - <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRulePage"/> - <waitForPageLoad stepKey="waitForTaxRatePage"/> - <click stepKey="addNewTaxRate" selector="{{AdminGridMainControls.add}}"/> - </actionGroup> - - <!--Delete Product Tax Class--> - <actionGroup name="deleteProductTaxClass"> - <annotations> - <description>Goes to the Admin Tax Rule creation page. Deletes the provided Tax Class.</description> - </annotations> - <arguments> - <argument name="taxClassName" type="string"/> - </arguments> - - <!-- Go to tax rule page --> - <amOnPage url="{{AdminNewTaxRulePage.url}}" stepKey="goToNewTaxRulePage"/> - <waitForPageLoad stepKey="waitForTaxRatePage"/> - <click stepKey="clickAdditionalSettings" selector="{{AdminTaxRulesSection.additionalSettings}}"/> - <scrollTo stepKey="scrollToAdditionalSettings" selector="{{AdminTaxRulesSection.additionalSettings}}"/> - <moveMouseOver stepKey="hoverDeleteElement" selector="{{AdminTaxRulesSection.deleteTaxClassName(taxClassName)}}"/> - <click stepKey="deleteFirstTaxClass" selector="{{AdminTaxRulesSection.deleteTaxClass(taxClassName)}}"/> - <waitForElementVisible selector="{{AdminTaxRulesSection.popUpDialogOK}}" stepKey="waitForElementBecomeVisible"/> - <click stepKey="acceptPopUpDialog" selector="{{AdminTaxRulesSection.popUpDialogOK}}"/> - <waitForPageLoad stepKey="waitForProductTaxClassDeleted"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Tax/Test/Mftf/ActionGroup/ChangeShippingTaxClassActionGroup.xml b/app/code/Magento/Tax/Test/Mftf/ActionGroup/ChangeShippingTaxClassActionGroup.xml new file mode 100644 index 0000000000000..8bd9136831890 --- /dev/null +++ b/app/code/Magento/Tax/Test/Mftf/ActionGroup/ChangeShippingTaxClassActionGroup.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ChangeShippingTaxClassActionGroup"> + <annotations> + <description>Goes to the 'Configuration' page for 'Tax'. Sets the 'Tax Class for Shipping' configuration setting to 'Taxable Goods'. Clicks on Save. Validates that the Success Message is present and correct.</description> + </annotations> + + <!--Select Configuration menu from Store--> + <click selector="{{AdminMenuSection.stores}}" stepKey="clickOnSTORES"/> + <waitForPageLoad stepKey="waitForConfiguration"/> + <click selector="{{AdminMenuSection.configuration}}" stepKey="clickOnConfigurations"/> + <waitForPageLoad stepKey="waitForSales"/> + + <!--Double click the same to fix flaky issue with redirection to Dashboard--> + <click selector="{{AdminMenuSection.stores}}" stepKey="clickOnSTORES1"/> + <waitForPageLoad stepKey="waitForConfiguration1"/> + <click selector="{{AdminMenuSection.configuration}}" stepKey="clickOnConfigurations1"/> + <waitForPageLoad stepKey="waitForSales1" time="5"/> + + <!--Change default tax class for Shipping on Taxable Goods--> + <click selector="{{ConfigurationListSection.sales}}" stepKey="clickOnSales"/> + <waitForPageLoad stepKey="waitForPaymentMethods"/> + <click selector="{{AdminConfigureTaxSection.salesTax}}" stepKey="clickOnTax"/> + <waitForPageLoad stepKey="waitForTax"/> + <seeInCurrentUrl url="{{AdminTaxConfigurationPage.url}}" stepKey="adminTaxConfiguration"/> + <seeElement selector="{{AdminConfigureTaxSection.taxClasses}}" stepKey="taxClassSectionC"/> + <click selector="{{AdminConfigureTaxSection.taxClasses}}" stepKey="openTaxClassSection"/> + <click selector="{{AdminConfigureTaxSection.taxShippingClassSystem}}" stepKey="uncheckSystemValue"/> + <selectOption selector="{{AdminConfigureTaxSection.taxClassShipping}}" userInput="Taxable Goods" stepKey="setTaxClassForShipping"/> + + <!-- Save the settings --> + <scrollToTopOfPage stepKey="scrollToTop"/> + <click stepKey="saveTaxOptions" selector="{{AdminCategoryMainActionsSection.SaveButton}}"/> + <waitForPageLoad stepKey="waitForTaxSaved"/> + <see stepKey="seeSuccess" selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the configuration."/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Tax/Test/Mftf/ActionGroup/ChangeToDefaultTaxConfigurationUIActionGroup.xml b/app/code/Magento/Tax/Test/Mftf/ActionGroup/ChangeToDefaultTaxConfigurationUIActionGroup.xml new file mode 100644 index 0000000000000..c93d4187cafa6 --- /dev/null +++ b/app/code/Magento/Tax/Test/Mftf/ActionGroup/ChangeToDefaultTaxConfigurationUIActionGroup.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ChangeToDefaultTaxConfigurationUIActionGroup"> + <annotations> + <description>Goes to the 'Configuration' page for 'Tax'. Set the Tax Configuration Settings to the Default values. Clicks on Save. Validates that the Success Message is present and correct.</description> + </annotations> + + <!-- navigate to the tax configuration page --> + <amOnPage url="{{AdminTaxConfigurationPage.url}}" stepKey="goToAdminTaxPage"/> + <waitForPageLoad stepKey="waitForTaxConfigLoad"/> + + <!-- change the default state to none --> + <!-- conditionalClick twice to fix some flaky behavior --> + <conditionalClick stepKey="clickCalculationSettings" selector="{{AdminConfigureTaxSection.defaultDestination}}" dependentSelector="{{AdminConfigureTaxSection.systemValueDefaultState}}" visible="false"/> + <conditionalClick stepKey="clickCalculationSettingsAgain" selector="{{AdminConfigureTaxSection.defaultDestination}}" dependentSelector="{{AdminConfigureTaxSection.systemValueDefaultState}}" visible="false"/> + <checkOption stepKey="clickDefaultState" selector="{{AdminConfigureTaxSection.systemValueDefaultState}}"/> + <selectOption stepKey="selectDefaultState" selector="{{AdminConfigureTaxSection.dropdownDefaultState}}" userInput="California"/> + <fillField stepKey="fillDefaultPostCode" selector="{{AdminConfigureTaxSection.defaultPostCode}}" userInput=""/> + + <!-- change the options for shopping cart display to not show tax --> + <!-- conditionalClick twice to fix some flaky behavior --> + <conditionalClick stepKey="clickShoppingCartDisplaySettings" selector="{{AdminConfigureTaxSection.shoppingCartDisplay}}" dependentSelector="{{AdminConfigureTaxSection.systemValueIncludeTaxTotalCart}}" visible="false"/> + <conditionalClick stepKey="clickShoppingCartDisplaySettingsAgain" selector="{{AdminConfigureTaxSection.shoppingCartDisplay}}" dependentSelector="{{AdminConfigureTaxSection.systemValueIncludeTaxTotalCart}}" visible="false"/> + <checkOption stepKey="clickTaxTotalCart" selector="{{AdminConfigureTaxSection.systemValueIncludeTaxTotalCart}}"/> + <selectOption stepKey="selectTaxTotalCart" selector="{{AdminConfigureTaxSection.dropdownIncludeTaxTotalCart}}" userInput="Yes"/> + <checkOption stepKey="clickDisplayTaxSummaryCart" selector="{{AdminConfigureTaxSection.systemValueDisplayTaxSummaryCart}}"/> + <selectOption stepKey="selectDisplayTaxSummaryCart" selector="{{AdminConfigureTaxSection.dropdownDisplayTaxSummaryCart}}" userInput="Yes"/> + <checkOption stepKey="clickDisplayZeroTaxCart" selector="{{AdminConfigureTaxSection.systemValueDisplayZeroTaxCart}}"/> + <selectOption stepKey="selectDisplayZeroTaxCart" selector="{{AdminConfigureTaxSection.dropdownDisplayZeroTaxCart}}" userInput="Yes"/> + + <!-- change the options for orders, invoices, credit memos display to not show tax --> + <!-- conditionalClick twice to fix some flaky behavior --> + <conditionalClick stepKey="clickOrdersInvoicesCreditSales" selector="{{AdminConfigureTaxSection.ordersInvoicesCreditSales}}" dependentSelector="{{AdminConfigureTaxSection.systemValueIncludeTaxTotalSales}}" visible="false"/> + <conditionalClick stepKey="clickOrdersInvoicesCreditSalesAgain" selector="{{AdminConfigureTaxSection.ordersInvoicesCreditSales}}" dependentSelector="{{AdminConfigureTaxSection.systemValueIncludeTaxTotalSales}}" visible="false"/> + <checkOption stepKey="clickTaxTotalSales" selector="{{AdminConfigureTaxSection.systemValueIncludeTaxTotalSales}}"/> + <selectOption stepKey="selectTaxTotalSales" selector="{{AdminConfigureTaxSection.dropdownIncludeTaxTotalSales}}" userInput="Yes"/> + <checkOption stepKey="clickDisplayTaxSummarySales" selector="{{AdminConfigureTaxSection.systemValueDisplayTaxSummarySales}}"/> + <selectOption stepKey="selectDisplayTaxSummarySales" selector="{{AdminConfigureTaxSection.dropdownDisplayTaxSummarySales}}" userInput="Yes"/> + <checkOption stepKey="clickDisplayZeroTaxSales" selector="{{AdminConfigureTaxSection.systemValueDisplayZeroTaxSales}}"/> + <selectOption stepKey="selectDisplayZeroTaxSales" selector="{{AdminConfigureTaxSection.dropdownDisplayZeroTaxSales}}" userInput="Yes"/> + + <!-- Save the settings --> + <scrollToTopOfPage stepKey="scrollToTop"/> + <click stepKey="saveTaxOptions" selector="{{AdminCategoryMainActionsSection.SaveButton}}"/> + <see stepKey="seeSuccess" selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the configuration."/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Tax/Test/Mftf/ActionGroup/DeleteCustomerTaxClassActionGroup.xml b/app/code/Magento/Tax/Test/Mftf/ActionGroup/DeleteCustomerTaxClassActionGroup.xml new file mode 100644 index 0000000000000..4507265cab1d0 --- /dev/null +++ b/app/code/Magento/Tax/Test/Mftf/ActionGroup/DeleteCustomerTaxClassActionGroup.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DeleteCustomerTaxClassActionGroup"> + <annotations> + <description>Goes to the Admin New Tax Rule page. Deletes the provided Tax Class Name.</description> + </annotations> + <arguments> + <argument name="taxClassName" type="string"/> + </arguments> + + <!-- Go to tax rule page --> + <amOnPage url="{{AdminNewTaxRulePage.url}}" stepKey="goToNewTaxRulePage"/> + <waitForPageLoad stepKey="waitForTaxRatePage"/> + <click stepKey="clickAdditionalSettings" selector="{{AdminTaxRulesSection.additionalSettings}}"/> + <scrollTo stepKey="scrollToAdditionalSettings" selector="{{AdminTaxRulesSection.additionalSettings}}"/> + <moveMouseOver stepKey="hoverDeleteElement" selector="{{AdminTaxRulesSection.deleteTaxClassName(taxClassName)}}"/> + <click stepKey="deleteFirstTaxClass" selector="{{AdminTaxRulesSection.deleteTaxClass(taxClassName)}}"/> + <waitForElementVisible selector="{{AdminTaxRulesSection.popUpDialogOK}}" stepKey="waitForElementBecomeVisible"/> + <click stepKey="acceptPopUpDialog" selector="{{AdminTaxRulesSection.popUpDialogOK}}"/> + <waitForPageLoad stepKey="waitForProductTaxClassDeleted"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Tax/Test/Mftf/ActionGroup/DeleteProductTaxClassActionGroup.xml b/app/code/Magento/Tax/Test/Mftf/ActionGroup/DeleteProductTaxClassActionGroup.xml new file mode 100644 index 0000000000000..b365f68318101 --- /dev/null +++ b/app/code/Magento/Tax/Test/Mftf/ActionGroup/DeleteProductTaxClassActionGroup.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DeleteProductTaxClassActionGroup"> + <annotations> + <description>Goes to the Admin Tax Rule creation page. Deletes the provided Tax Class.</description> + </annotations> + <arguments> + <argument name="taxClassName" type="string"/> + </arguments> + + <!-- Go to tax rule page --> + <amOnPage url="{{AdminNewTaxRulePage.url}}" stepKey="goToNewTaxRulePage"/> + <waitForPageLoad stepKey="waitForTaxRatePage"/> + <click stepKey="clickAdditionalSettings" selector="{{AdminTaxRulesSection.additionalSettings}}"/> + <scrollTo stepKey="scrollToAdditionalSettings" selector="{{AdminTaxRulesSection.additionalSettings}}"/> + <moveMouseOver stepKey="hoverDeleteElement" selector="{{AdminTaxRulesSection.deleteTaxClassName(taxClassName)}}"/> + <click stepKey="deleteFirstTaxClass" selector="{{AdminTaxRulesSection.deleteTaxClass(taxClassName)}}"/> + <waitForElementVisible selector="{{AdminTaxRulesSection.popUpDialogOK}}" stepKey="waitForElementBecomeVisible"/> + <click stepKey="acceptPopUpDialog" selector="{{AdminTaxRulesSection.popUpDialogOK}}"/> + <waitForPageLoad stepKey="waitForProductTaxClassDeleted"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Tax/Test/Mftf/ActionGroup/EditTaxConfigurationByUIActionGroup.xml b/app/code/Magento/Tax/Test/Mftf/ActionGroup/EditTaxConfigurationByUIActionGroup.xml new file mode 100644 index 0000000000000..da56a305d0e94 --- /dev/null +++ b/app/code/Magento/Tax/Test/Mftf/ActionGroup/EditTaxConfigurationByUIActionGroup.xml @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="EditTaxConfigurationByUIActionGroup"> + <annotations> + <description>Goes to the 'Configuration' page for 'Tax'. Enables the display of Taxes in the Storefront Shopping Cart and Checkout page.</description> + </annotations> + + <!-- navigate to the tax configuration page --> + <amOnPage url="{{AdminTaxConfigurationPage.url}}" stepKey="goToAdminTaxPage"/> + <waitForPageLoad stepKey="waitForTaxConfigLoad"/> + + <!-- change the default state to California --> + <scrollTo selector="#tax_defaults-head" x="0" y="-80" stepKey="scrollToTaxDefaults"/> + + <!-- conditionalClick twice to fix some flaky behavior --> + <conditionalClick stepKey="clickCalculationSettings" selector="{{AdminConfigureTaxSection.defaultDestination}}" dependentSelector="#tax_defaults" visible="false"/> + <conditionalClick stepKey="clickCalculationSettingsAgain" selector="{{AdminConfigureTaxSection.defaultDestination}}" dependentSelector="#tax_defaults" visible="false"/> + <uncheckOption stepKey="clickDefaultState" selector="{{AdminConfigureTaxSection.systemValueDefaultState}}"/> + <selectOption stepKey="selectDefaultState" selector="{{AdminConfigureTaxSection.dropdownDefaultState}}" userInput="California"/> + <fillField stepKey="fillDefaultPostCode" selector="{{AdminConfigureTaxSection.defaultPostCode}}" userInput="*"/> + + <!-- change the options for shopping cart display to show tax --> + <scrollTo selector="#tax_cart_display-head" x="0" y="-80" stepKey="scrollToTaxShoppingCartDisplay"/> + + <!-- conditionalClick twice to fix some flaky behavior --> + <conditionalClick stepKey="clickShoppingCartDisplaySettings" selector="{{AdminConfigureTaxSection.shoppingCartDisplay}}" dependentSelector="#tax_cart_display" visible="false"/> + <conditionalClick stepKey="clickShoppingCartDisplaySettingsAgain" selector="{{AdminConfigureTaxSection.shoppingCartDisplay}}" dependentSelector="#tax_cart_display" visible="false"/> + <uncheckOption stepKey="clickTaxTotalCart" selector="{{AdminConfigureTaxSection.systemValueIncludeTaxTotalCart}}"/> + <selectOption stepKey="selectTaxTotalCart" selector="{{AdminConfigureTaxSection.dropdownIncludeTaxTotalCart}}" userInput="Yes"/> + <uncheckOption stepKey="clickDisplayTaxSummaryCart" selector="{{AdminConfigureTaxSection.systemValueDisplayTaxSummaryCart}}"/> + <selectOption stepKey="selectDisplayTaxSummaryCart" selector="{{AdminConfigureTaxSection.dropdownDisplayTaxSummaryCart}}" userInput="Yes"/> + <uncheckOption stepKey="clickDisplayZeroTaxCart" selector="{{AdminConfigureTaxSection.systemValueDisplayZeroTaxCart}}"/> + <selectOption stepKey="selectDisplayZeroTaxCart" selector="{{AdminConfigureTaxSection.dropdownDisplayZeroTaxCart}}" userInput="Yes"/> + + <!-- change the options for orders, invoices, credit memos display to show tax --> + <scrollTo selector="#tax_sales_display-head" x="0" y="-80" stepKey="scrollToTaxSalesDisplay"/> + + <!-- conditionalClick twice to fix some flaky behavior --> + <conditionalClick stepKey="clickOrdersInvoicesCreditSales" selector="{{AdminConfigureTaxSection.ordersInvoicesCreditSales}}" dependentSelector="#tax_sales_display" visible="false"/> + <conditionalClick stepKey="clickOrdersInvoicesCreditSalesAgain" selector="{{AdminConfigureTaxSection.ordersInvoicesCreditSales}}" dependentSelector="#tax_sales_display" visible="false"/> + <uncheckOption stepKey="clickTaxTotalSales" selector="{{AdminConfigureTaxSection.systemValueIncludeTaxTotalSales}}"/> + <selectOption stepKey="selectTaxTotalSales" selector="{{AdminConfigureTaxSection.dropdownIncludeTaxTotalSales}}" userInput="Yes"/> + <uncheckOption stepKey="clickDisplayTaxSummarySales" selector="{{AdminConfigureTaxSection.systemValueDisplayTaxSummarySales}}"/> + <selectOption stepKey="selectDisplayTaxSummarySales" selector="{{AdminConfigureTaxSection.dropdownDisplayTaxSummarySales}}" userInput="Yes"/> + <uncheckOption stepKey="clickDisplayZeroTaxSales" selector="{{AdminConfigureTaxSection.systemValueDisplayZeroTaxSales}}"/> + <selectOption stepKey="selectDisplayZeroTaxSales" selector="{{AdminConfigureTaxSection.dropdownDisplayZeroTaxSales}}" userInput="Yes"/> + + <!-- Save the settings --> + <scrollToTopOfPage stepKey="scrollToTop"/> + <click stepKey="saveTaxOptions" selector="{{AdminCategoryMainActionsSection.SaveButton}}"/> + <waitForPageLoad stepKey="waitForTaxSaved"/> + <see stepKey="seeSuccess" selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the configuration."/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Tax/Test/Mftf/ActionGroup/SetDefaultShippingTaxClassActionGroup.xml b/app/code/Magento/Tax/Test/Mftf/ActionGroup/SetDefaultShippingTaxClassActionGroup.xml new file mode 100644 index 0000000000000..25e2b2d376151 --- /dev/null +++ b/app/code/Magento/Tax/Test/Mftf/ActionGroup/SetDefaultShippingTaxClassActionGroup.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SetDefaultShippingTaxClassActionGroup"> + <annotations> + <description>Goes to the 'Configuration' page via the Admin Side Menu. Sets the 'Tax Class for Shipping' to the System Default. Clicks on Save. Validates that the Success Message is present and correct.</description> + </annotations> + + <!--Select Configuration menu from Store--> + <click selector="{{AdminMenuSection.stores}}" stepKey="clickOnSTORES"/> + <waitForPageLoad stepKey="waitForConfiguration"/> + <click selector="{{AdminMenuSection.configuration}}" stepKey="clickOnConfigurations"/> + <waitForPageLoad stepKey="waitForSales"/> + + <!--Double click the same to fix flaky issue with redirection to Dashboard--> + <click selector="{{AdminMenuSection.stores}}" stepKey="clickOnSTORES1"/> + <waitForPageLoad stepKey="waitForConfiguration1"/> + <click selector="{{AdminMenuSection.configuration}}" stepKey="clickOnConfigurations1"/> + <waitForPageLoad stepKey="waitForSales1"/> + + <!--Change default tax class for Shipping on Taxable Goods--> + <click selector="{{ConfigurationListSection.sales}}" stepKey="clickOnSales"/> + <waitForPageLoad stepKey="waitForPaymentMethods"/> + <click selector="{{AdminConfigureTaxSection.salesTax}}" stepKey="clickOnTax"/> + <waitForPageLoad stepKey="waitForTax"/> + <seeElement selector="{{AdminConfigureTaxSection.taxClasses}}" stepKey="taxClassSectionC"/> + <click selector="{{AdminConfigureTaxSection.taxShippingClassSystem}}" stepKey="checkSystemDefaultValue"/> + <click selector="{{AdminConfigureTaxSection.taxClasses}}" stepKey="closeTaxClassSection"/> + + <!-- Save the settings --> + <scrollToTopOfPage stepKey="scrollToTop"/> + <click stepKey="saveTaxOptions" selector="{{AdminCategoryMainActionsSection.SaveButton}}"/> + <waitForPageLoad stepKey="waitForTaxSaved"/> + <see stepKey="seeSuccess" selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the configuration."/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml index 628d189823a52..98f5401066063 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml @@ -25,11 +25,11 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <!-- Go to tax rule page --> - <actionGroup ref="addNewTaxRuleActionGroup" stepKey="addFirstTaxRuleActionGroup"/> + <actionGroup ref="AddNewTaxRuleActionGroup" stepKey="addFirstTaxRuleActionGroup"/> <fillField stepKey="fillRuleName" selector="{{AdminTaxRulesSection.ruleName}}" userInput="TaxRule1"/> <!-- Add NY and CA tax rules --> - <actionGroup ref="addNewTaxRateNoZip" stepKey="addNYTaxRate"> + <actionGroup ref="AddNewTaxRateNoZipActionGroup" stepKey="addNYTaxRate"> <argument name="taxCode" value="SimpleTaxWithZipCode"/> </actionGroup> @@ -43,10 +43,10 @@ <waitForPageLoad stepKey="waitForNewTaxRuleCreated"/> <!-- Go to tax rule page to create second Tax Rule--> - <actionGroup ref="addNewTaxRuleActionGroup" stepKey="addSecondTaxRuleActionGroup"/> + <actionGroup ref="AddNewTaxRuleActionGroup" stepKey="addSecondTaxRuleActionGroup"/> <fillField stepKey="fillSecondRuleName" selector="{{AdminTaxRulesSection.ruleName}}" userInput="TaxRule2"/> - <actionGroup ref="addNewTaxRateNoZip" stepKey="addCATaxRate"> + <actionGroup ref="AddNewTaxRateNoZipActionGroup" stepKey="addCATaxRate"> <argument name="taxCode" value="SimpleSecondTaxWithZipCode"/> </actionGroup> @@ -211,11 +211,11 @@ <deleteData createDataKey="secondProduct" stepKey="deleteSecondProduct"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="deleteProductTaxClass" stepKey="deleteFirstProductTaxClass"> + <actionGroup ref="DeleteProductTaxClassActionGroup" stepKey="deleteFirstProductTaxClass"> <argument name="taxClassName" value="TaxClasses1"/> </actionGroup> - <actionGroup ref="deleteProductTaxClass" stepKey="deleteSecondProductTaxClass"> + <actionGroup ref="DeleteProductTaxClassActionGroup" stepKey="deleteSecondProductTaxClass"> <argument name="taxClassName" value="TaxClasses2"/> </actionGroup> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/CheckCreditMemoTotalsTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/CheckCreditMemoTotalsTest.xml index 38cc687ff53a4..1bc1134f58163 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/CheckCreditMemoTotalsTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/CheckCreditMemoTotalsTest.xml @@ -95,7 +95,7 @@ <argument name="name" value="{{SimpleTaxNY.state}}"/> <argument name="searchInput" value="{{AdminSecondaryGridSection.taxIdentifierSearch}}"/> </actionGroup> - <actionGroup ref="deleteProductTaxClass" stepKey="deleteFirstProductTaxClass"> + <actionGroup ref="DeleteProductTaxClassActionGroup" stepKey="deleteFirstProductTaxClass"> <argument name="taxClassName" value="NewTaxClass"/> </actionGroup> <!--logout--> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCartTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCartTest.xml index 05ced7e61b3b7..33b82b3d0464f 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCartTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCartTest.xml @@ -23,7 +23,7 @@ <createData entity="SimpleProduct2" stepKey="simpleProduct1"/> <!-- Fill in rules to display tax in the cart --> - <actionGroup ref="editTaxConfigurationByUI" stepKey="fillDefaultTaxForms"/> + <actionGroup ref="EditTaxConfigurationByUIActionGroup" stepKey="fillDefaultTaxForms"/> <!-- Go to tax rule page --> <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRulePage"/> @@ -32,11 +32,11 @@ <fillField stepKey="fillRuleName" selector="{{AdminTaxRulesSection.ruleName}}" userInput="SampleRule"/> <!-- Add NY and CA tax rules --> - <actionGroup ref="addNewTaxRateNoZip" stepKey="addNYTaxRate"> + <actionGroup ref="AddNewTaxRateNoZipActionGroup" stepKey="addNYTaxRate"> <argument name="taxCode" value="SimpleTaxNY"/> </actionGroup> - <actionGroup ref="addNewTaxRateNoZip" stepKey="addCATaxRate"> + <actionGroup ref="AddNewTaxRateNoZipActionGroup" stepKey="addCATaxRate"> <argument name="taxCode" value="SimpleTaxCA"/> </actionGroup> @@ -76,7 +76,7 @@ </actionGroup> <!-- Ensure tax won't be shown in the cart --> - <actionGroup ref="changeToDefaultTaxConfigurationUI" stepKey="changeToDefaultTaxConfiguration"/> + <actionGroup ref="ChangeToDefaultTaxConfigurationUIActionGroup" stepKey="changeToDefaultTaxConfiguration"/> <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> <deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/> @@ -141,7 +141,7 @@ <createData entity="VirtualProduct" stepKey="virtualProduct1"/> <!-- Fill in rules to display tax in the cart --> - <actionGroup ref="editTaxConfigurationByUI" stepKey="fillDefaultTaxForms"/> + <actionGroup ref="EditTaxConfigurationByUIActionGroup" stepKey="fillDefaultTaxForms"/> <!-- Go to tax rule page --> <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRulePage"/> @@ -150,11 +150,11 @@ <fillField stepKey="fillRuleName" selector="{{AdminTaxRulesSection.ruleName}}" userInput="SampleRule"/> <!-- Add NY and CA tax rules --> - <actionGroup ref="addNewTaxRateNoZip" stepKey="addNYTaxRate"> + <actionGroup ref="AddNewTaxRateNoZipActionGroup" stepKey="addNYTaxRate"> <argument name="taxCode" value="SimpleTaxNY"/> </actionGroup> - <actionGroup ref="addNewTaxRateNoZip" stepKey="addCATaxRate"> + <actionGroup ref="AddNewTaxRateNoZipActionGroup" stepKey="addCATaxRate"> <argument name="taxCode" value="SimpleTaxCA"/> </actionGroup> @@ -194,7 +194,7 @@ </actionGroup> <!-- Ensure tax won't be shown in the cart --> - <actionGroup ref="changeToDefaultTaxConfigurationUI" stepKey="changeToDefaultTaxConfiguration"/> + <actionGroup ref="ChangeToDefaultTaxConfigurationUIActionGroup" stepKey="changeToDefaultTaxConfiguration"/> <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> <deleteData createDataKey="virtualProduct1" stepKey="deleteVirtualProduct1"/> @@ -257,7 +257,7 @@ <createData entity="SimpleProduct2" stepKey="simpleProduct1"/> <!-- Fill in rules to display tax in the cart --> - <actionGroup ref="editTaxConfigurationByUI" stepKey="fillDefaultTaxForms"/> + <actionGroup ref="EditTaxConfigurationByUIActionGroup" stepKey="fillDefaultTaxForms"/> <!-- Go to tax rule page --> <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRulePage"/> @@ -266,11 +266,11 @@ <fillField stepKey="fillRuleName" selector="{{AdminTaxRulesSection.ruleName}}" userInput="SampleRule"/> <!-- Add NY and CA tax rules --> - <actionGroup ref="addNewTaxRateNoZip" stepKey="addNYTaxRate"> + <actionGroup ref="AddNewTaxRateNoZipActionGroup" stepKey="addNYTaxRate"> <argument name="taxCode" value="SimpleTaxNY"/> </actionGroup> - <actionGroup ref="addNewTaxRateNoZip" stepKey="addCATaxRate"> + <actionGroup ref="AddNewTaxRateNoZipActionGroup" stepKey="addCATaxRate"> <argument name="taxCode" value="SimpleTaxCA"/> </actionGroup> @@ -301,7 +301,7 @@ </actionGroup> <!-- Ensure tax won't be shown in the cart --> - <actionGroup ref="changeToDefaultTaxConfigurationUI" stepKey="changeToDefaultTaxConfiguration"/> + <actionGroup ref="ChangeToDefaultTaxConfigurationUIActionGroup" stepKey="changeToDefaultTaxConfiguration"/> <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> <deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/> @@ -367,7 +367,7 @@ <createData entity="VirtualProduct" stepKey="virtualProduct1"/> <!-- Fill in rules to display tax in the cart --> - <actionGroup ref="editTaxConfigurationByUI" stepKey="fillDefaultTaxForms"/> + <actionGroup ref="EditTaxConfigurationByUIActionGroup" stepKey="fillDefaultTaxForms"/> <!-- Go to tax rule page --> <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRulePage"/> @@ -376,11 +376,11 @@ <fillField stepKey="fillRuleName" selector="{{AdminTaxRulesSection.ruleName}}" userInput="SampleRule"/> <!-- Add NY and CA tax rules --> - <actionGroup ref="addNewTaxRateNoZip" stepKey="addNYTaxRate"> + <actionGroup ref="AddNewTaxRateNoZipActionGroup" stepKey="addNYTaxRate"> <argument name="taxCode" value="SimpleTaxNY"/> </actionGroup> - <actionGroup ref="addNewTaxRateNoZip" stepKey="addCATaxRate"> + <actionGroup ref="AddNewTaxRateNoZipActionGroup" stepKey="addCATaxRate"> <argument name="taxCode" value="SimpleTaxCA"/> </actionGroup> @@ -411,7 +411,7 @@ </actionGroup> <!-- Ensure tax won't be shown in the cart --> - <actionGroup ref="changeToDefaultTaxConfigurationUI" stepKey="changeToDefaultTaxConfiguration"/> + <actionGroup ref="ChangeToDefaultTaxConfigurationUIActionGroup" stepKey="changeToDefaultTaxConfiguration"/> <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> <deleteData createDataKey="virtualProduct1" stepKey="deleteVirtualProduct1"/> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCheckoutTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCheckoutTest.xml index e7bf08257ea69..e0e411a04d484 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCheckoutTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCheckoutTest.xml @@ -23,7 +23,7 @@ <createData entity="VirtualProduct" stepKey="virtualProduct1"/> <!-- Fill in rules to display tax in the cart --> - <actionGroup ref="editTaxConfigurationByUI" stepKey="fillDefaultTaxForms"/> + <actionGroup ref="EditTaxConfigurationByUIActionGroup" stepKey="fillDefaultTaxForms"/> <!-- Go to tax rule page --> <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRulePage"/> @@ -32,11 +32,11 @@ <fillField stepKey="fillRuleName" selector="{{AdminTaxRulesSection.ruleName}}" userInput="SampleRule"/> <!-- Add NY and CA tax rules --> - <actionGroup ref="addNewTaxRateNoZip" stepKey="addNYTaxRate"> + <actionGroup ref="AddNewTaxRateNoZipActionGroup" stepKey="addNYTaxRate"> <argument name="taxCode" value="SimpleTaxNY"/> </actionGroup> - <actionGroup ref="addNewTaxRateNoZip" stepKey="addCATaxRate"> + <actionGroup ref="AddNewTaxRateNoZipActionGroup" stepKey="addCATaxRate"> <argument name="taxCode" value="SimpleTaxCA"/> </actionGroup> @@ -67,7 +67,7 @@ </actionGroup> <!-- Ensure tax won't be shown in the cart --> - <actionGroup ref="changeToDefaultTaxConfigurationUI" stepKey="changeToDefaultTaxConfiguration"/> + <actionGroup ref="ChangeToDefaultTaxConfigurationUIActionGroup" stepKey="changeToDefaultTaxConfiguration"/> <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> <deleteData createDataKey="virtualProduct1" stepKey="deleteVirtualProduct1"/> @@ -127,7 +127,7 @@ <createData entity="SimpleProduct2" stepKey="simpleProduct1"/> <!-- Fill in rules to display tax in the cart --> - <actionGroup ref="editTaxConfigurationByUI" stepKey="fillDefaultTaxForms"/> + <actionGroup ref="EditTaxConfigurationByUIActionGroup" stepKey="fillDefaultTaxForms"/> <!-- Go to tax rule page --> <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRulePage"/> @@ -136,11 +136,11 @@ <fillField stepKey="fillRuleName" selector="{{AdminTaxRulesSection.ruleName}}" userInput="SampleRule"/> <!-- Add NY and CA tax rules --> - <actionGroup ref="addNewTaxRateNoZip" stepKey="addNYTaxRate"> + <actionGroup ref="AddNewTaxRateNoZipActionGroup" stepKey="addNYTaxRate"> <argument name="taxCode" value="SimpleTaxNY"/> </actionGroup> - <actionGroup ref="addNewTaxRateNoZip" stepKey="addCATaxRate"> + <actionGroup ref="AddNewTaxRateNoZipActionGroup" stepKey="addCATaxRate"> <argument name="taxCode" value="SimpleTaxCA"/> </actionGroup> @@ -180,7 +180,7 @@ </actionGroup> <!-- Ensure tax won't be shown in the cart --> - <actionGroup ref="changeToDefaultTaxConfigurationUI" stepKey="changeToDefaultTaxConfiguration"/> + <actionGroup ref="ChangeToDefaultTaxConfigurationUIActionGroup" stepKey="changeToDefaultTaxConfiguration"/> <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> <deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/> @@ -247,7 +247,7 @@ <createData entity="SimpleProduct2" stepKey="simpleProduct1"/> <!-- Fill in rules to display tax in the cart --> - <actionGroup ref="editTaxConfigurationByUI" stepKey="fillDefaultTaxForms"/> + <actionGroup ref="EditTaxConfigurationByUIActionGroup" stepKey="fillDefaultTaxForms"/> <!-- Go to tax rule page --> <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRulePage"/> @@ -256,11 +256,11 @@ <fillField stepKey="fillRuleName" selector="{{AdminTaxRulesSection.ruleName}}" userInput="SampleRule"/> <!-- Add NY and CA tax rules --> - <actionGroup ref="addNewTaxRateNoZip" stepKey="addNYTaxRate"> + <actionGroup ref="AddNewTaxRateNoZipActionGroup" stepKey="addNYTaxRate"> <argument name="taxCode" value="SimpleTaxNY"/> </actionGroup> - <actionGroup ref="addNewTaxRateNoZip" stepKey="addCATaxRate"> + <actionGroup ref="AddNewTaxRateNoZipActionGroup" stepKey="addCATaxRate"> <argument name="taxCode" value="SimpleTaxCA"/> </actionGroup> @@ -291,7 +291,7 @@ </actionGroup> <!-- Ensure tax won't be shown in the cart --> - <actionGroup ref="changeToDefaultTaxConfigurationUI" stepKey="changeToDefaultTaxConfiguration"/> + <actionGroup ref="ChangeToDefaultTaxConfigurationUIActionGroup" stepKey="changeToDefaultTaxConfiguration"/> <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> <deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/> @@ -362,7 +362,7 @@ <createData entity="VirtualProduct" stepKey="virtualProduct1"/> <!-- Fill in rules to display tax in the cart --> - <actionGroup ref="editTaxConfigurationByUI" stepKey="fillDefaultTaxForms"/> + <actionGroup ref="EditTaxConfigurationByUIActionGroup" stepKey="fillDefaultTaxForms"/> <!-- Go to tax rule page --> <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRulePage"/> @@ -371,11 +371,11 @@ <fillField stepKey="fillRuleName" selector="{{AdminTaxRulesSection.ruleName}}" userInput="SampleRule"/> <!-- Add NY and CA tax rules --> - <actionGroup ref="addNewTaxRateNoZip" stepKey="addNYTaxRate"> + <actionGroup ref="AddNewTaxRateNoZipActionGroup" stepKey="addNYTaxRate"> <argument name="taxCode" value="SimpleTaxNY"/> </actionGroup> - <actionGroup ref="addNewTaxRateNoZip" stepKey="addCATaxRate"> + <actionGroup ref="AddNewTaxRateNoZipActionGroup" stepKey="addCATaxRate"> <argument name="taxCode" value="SimpleTaxCA"/> </actionGroup> @@ -415,7 +415,7 @@ </actionGroup> <!-- Ensure tax won't be shown in the cart --> - <actionGroup ref="changeToDefaultTaxConfigurationUI" stepKey="changeToDefaultTaxConfiguration"/> + <actionGroup ref="ChangeToDefaultTaxConfigurationUIActionGroup" stepKey="changeToDefaultTaxConfiguration"/> <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> <deleteData createDataKey="virtualProduct1" stepKey="deleteVirtualProduct1"/> From 31a2890341cce1c66ace8d808288a5ca309129c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 28 Nov 2019 14:59:57 +0100 Subject: [PATCH 0155/1143] REFACTOR: Extract Action Groups to separate files (according to MFTF best practices) --- .../AddSwatchToProductActionGroup.xml | 132 ------------------ .../AddTextSwatchToProductActionGroup.xml | 46 ++++++ .../AddVisualSwatchToProductActionGroup.xml | 66 +++++++++ ...ProductWithStorefrontConfigActionGroup.xml | 31 ++++ ...torefrontPreviewImageConfigActionGroup.xml | 19 +++ ...dSwatchOptionAndFillFieldsActionGroup.xml} | 10 -- ...inUpdateProductPreviewImageActionGroup.xml | 17 +++ ...AssertStorefrontSwatchColorActionGroup.xml | 26 ++++ .../AssertSwatchColorActionGroup.xml | 26 ++++ .../ActionGroup/ColorPickerActionGroup.xml | 68 --------- .../OpenSwatchMenuByIndexActionGroup.xml | 22 +++ .../SetColorPickerByHexActionGroup.xml | 24 ++++ ...roductWithSwatchesToTheCartActionGroup.xml | 21 +++ ...rontAssertSwatchOptionPriceActionGroup.xml | 19 +++ .../StorefrontProductActionGroup.xml | 34 ----- ...ctSwatchOptionOnProductPageActionGroup.xml | 18 +++ ...nOnProductPageAndCheckImageActionGroup.xml | 17 +++ ...gurableProductWithSwatchesActionGroup.xml} | 18 +-- .../Mftf/Test/AdminCreateImageSwatchTest.xml | 6 +- .../Mftf/Test/AdminCreateVisualSwatchTest.xml | 24 ++-- ...ateVisualSwatchWithNonValidOptionsTest.xml | 14 +- .../Test/AdminDisablingSwatchTooltipsTest.xml | 8 +- ...uctWithAttributesImagesAndSwatchesTest.xml | 6 +- ...figurableProductSwatchMinimumPriceTest.xml | 6 +- ...nChangeProductOptionsUsingSwatchesTest.xml | 2 +- .../StorefrontFilterByImageSwatchTest.xml | 4 +- .../StorefrontFilterByVisualSwatchTest.xml | 8 +- ...oductImagesMatchingProductSwatchesTest.xml | 4 +- 28 files changed, 396 insertions(+), 300 deletions(-) delete mode 100644 app/code/Magento/Swatches/Test/Mftf/ActionGroup/AddSwatchToProductActionGroup.xml create mode 100644 app/code/Magento/Swatches/Test/Mftf/ActionGroup/AddTextSwatchToProductActionGroup.xml create mode 100644 app/code/Magento/Swatches/Test/Mftf/ActionGroup/AddVisualSwatchToProductActionGroup.xml create mode 100644 app/code/Magento/Swatches/Test/Mftf/ActionGroup/AddVisualSwatchToProductWithStorefrontConfigActionGroup.xml create mode 100644 app/code/Magento/Swatches/Test/Mftf/ActionGroup/AddVisualSwatchWithProductWithStorefrontPreviewImageConfigActionGroup.xml rename app/code/Magento/Swatches/Test/Mftf/ActionGroup/{AdminEditPropertiesTabForSwatchProductAtributeActionGroup.xml => AdminAddSwatchOptionAndFillFieldsActionGroup.xml} (72%) create mode 100644 app/code/Magento/Swatches/Test/Mftf/ActionGroup/AdminUpdateProductPreviewImageActionGroup.xml create mode 100644 app/code/Magento/Swatches/Test/Mftf/ActionGroup/AssertStorefrontSwatchColorActionGroup.xml create mode 100644 app/code/Magento/Swatches/Test/Mftf/ActionGroup/AssertSwatchColorActionGroup.xml delete mode 100644 app/code/Magento/Swatches/Test/Mftf/ActionGroup/ColorPickerActionGroup.xml create mode 100644 app/code/Magento/Swatches/Test/Mftf/ActionGroup/OpenSwatchMenuByIndexActionGroup.xml create mode 100644 app/code/Magento/Swatches/Test/Mftf/ActionGroup/SetColorPickerByHexActionGroup.xml create mode 100644 app/code/Magento/Swatches/Test/Mftf/ActionGroup/StorefrontAddProductWithSwatchesToTheCartActionGroup.xml create mode 100644 app/code/Magento/Swatches/Test/Mftf/ActionGroup/StorefrontAssertSwatchOptionPriceActionGroup.xml delete mode 100644 app/code/Magento/Swatches/Test/Mftf/ActionGroup/StorefrontProductActionGroup.xml create mode 100644 app/code/Magento/Swatches/Test/Mftf/ActionGroup/StorefrontSelectSwatchOptionOnProductPageActionGroup.xml create mode 100644 app/code/Magento/Swatches/Test/Mftf/ActionGroup/StorefrontSelectSwatchOptionOnProductPageAndCheckImageActionGroup.xml rename app/code/Magento/Swatches/Test/Mftf/ActionGroup/{StorefrontAddProductWithSwatchAttributeToTheCartActionGroup.xml => StorefrontUpdateCartConfigurableProductWithSwatchesActionGroup.xml} (54%) diff --git a/app/code/Magento/Swatches/Test/Mftf/ActionGroup/AddSwatchToProductActionGroup.xml b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/AddSwatchToProductActionGroup.xml deleted file mode 100644 index 4a67c0dfbe8e4..0000000000000 --- a/app/code/Magento/Swatches/Test/Mftf/ActionGroup/AddSwatchToProductActionGroup.xml +++ /dev/null @@ -1,132 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AddVisualSwatchToProductActionGroup"> - <annotations> - <description>Adds the provided Visual Swatch Attribute and Options (2) to a Product on the Admin Product creation/edit page. Clicks on Save. Validates that the Success Message is present.</description> - </annotations> - <arguments> - <argument name="attribute" defaultValue="visualSwatchAttribute"/> - <argument name="option1" defaultValue="visualSwatchOption1"/> - <argument name="option2" defaultValue="visualSwatchOption2"/> - </arguments> - - <seeInCurrentUrl url="{{ProductCatalogPage.url}}" stepKey="seeOnProductEditPage"/> - <conditionalClick selector="{{AdminProductFormConfigurationsSection.sectionHeader}}" dependentSelector="{{AdminProductFormConfigurationsSection.createConfigurations}}" visible="false" stepKey="openConfigurationSection"/> - <click selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="openConfigurationPanel"/> - <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.createNewAttribute}}" stepKey="waitForSlideOut"/> - <click selector="{{AdminCreateProductConfigurationsPanel.createNewAttribute}}" stepKey="clickCreateNewAttribute"/> - <waitForPageLoad stepKey="waitForIFrame"/> - - <switchToIFrame selector="{{AdminNewAttributePanel.newAttributeIFrame}}" stepKey="switchToNewAttributeIFrame"/> - <fillField selector="{{AdminNewAttributePanel.defaultLabel}}" userInput="{{attribute.default_label}}" stepKey="fillDefaultLabel"/> - <selectOption selector="{{AdminNewAttributePanel.inputType}}" userInput="{{attribute.input_type}}" stepKey="selectInputType"/> - <!--Add swatch options--> - <click selector="{{AdminNewAttributePanel.addVisualSwatchOption}}" stepKey="clickAddSwatch1"/> - <waitForElementVisible selector="{{AdminNewAttributePanel.visualSwatchOptionAdminValue('0')}}" stepKey="waitForOption1Row"/> - <fillField selector="{{AdminNewAttributePanel.visualSwatchOptionAdminValue('0')}}" userInput="{{option1.admin_label}}" stepKey="fillAdminLabel1"/> - <fillField selector="{{AdminNewAttributePanel.visualSwatchOptionDefaultStoreValue('0')}}" userInput="{{option1.default_label}}" stepKey="fillDefaultStoreLabel1"/> - <click selector="{{AdminNewAttributePanel.addVisualSwatchOption}}" stepKey="clickAddSwatch2"/> - <waitForElementVisible selector="{{AdminNewAttributePanel.visualSwatchOptionAdminValue('1')}}" stepKey="waitForOption2Row"/> - <fillField selector="{{AdminNewAttributePanel.visualSwatchOptionAdminValue('1')}}" userInput="{{option2.admin_label}}" stepKey="fillAdminLabel2"/> - <fillField selector="{{AdminNewAttributePanel.visualSwatchOptionDefaultStoreValue('1')}}" userInput="{{option2.default_label}}" stepKey="fillDefaultStoreLabel2"/> - - <!--Save attribute--> - <click selector="{{AdminNewAttributePanel.saveAttribute}}" stepKey="clickOnNewAttributePanel"/> - <waitForPageLoad stepKey="waitForSaveAttribute"/> - <switchToIFrame stepKey="switchOutOfIFrame"/> - - <!--Find attribute in grid and select--> - <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingFilters"/> - <click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="clickOnFilters"/> - <fillField selector="{{AdminDataGridHeaderSection.attributeCodeFilterInput}}" userInput="{{attribute.default_label}}" stepKey="fillFilterAttributeCodeField"/> - <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickApplyFiltersButton"/> - <click selector="{{AdminDataGridTableSection.rowCheckbox('1')}}" stepKey="clickOnFirstCheckbox"/> - - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickNextStep1"/> - - <click selector="{{AdminCreateProductConfigurationsPanel.selectAllByAttribute(attribute.default_label)}}" stepKey="clickSelectAll"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickNextStep2"/> - - <click selector="{{AdminCreateProductConfigurationsPanel.applySingleQuantityToEachSkus}}" stepKey="clickOnApplySingleQuantityToEachSku"/> - <fillField selector="{{AdminCreateProductConfigurationsPanel.quantity}}" userInput="100" stepKey="enterAttributeQuantity"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextStep3"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="generateProducts"/> - <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct"/> - <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup"/> - <seeElement selector="{{AdminMessagesSection.success}}" stepKey="seeSaveProductMessage"/> - </actionGroup> - - <actionGroup name="AddVisualSwatchToProductWithStorefrontConfigActionGroup" extends="AddVisualSwatchToProductActionGroup"> - <annotations> - <description>EXTENDS: AddVisualSwatchToProductActionGroup. Add the provided Visual Swatch Attribute and Options (2) to a Product with Storefront Configurations.</description> - </annotations> - <arguments> - <argument name="attribute" defaultValue="visualSwatchAttribute"/> - <argument name="option1" defaultValue="visualSwatchOption1"/> - <argument name="option2" defaultValue="visualSwatchOption2"/> - </arguments> - - <!-- Go to Storefront Properties tab --> - <click selector="{{AdminNewAttributePanel.storefrontPropertiesTab}}" stepKey="goToStorefrontPropertiesTab" after="fillDefaultStoreLabel2"/> - <waitForElementVisible selector="{{AdminNewAttributePanel.storefrontPropertiesTitle}}" stepKey="waitTabLoad" after="goToStorefrontPropertiesTab"/> - <selectOption selector="{{AdminNewAttributePanel.useInSearch}}" stepKey="switchOnUsInSearch" userInput="Yes" after="waitTabLoad"/> - <selectOption selector="{{AdminNewAttributePanel.visibleInAdvancedSearch}}" stepKey="switchOnVisibleInAdvancedSearch" userInput="Yes" after="switchOnUsInSearch"/> - <selectOption selector="{{AdminNewAttributePanel.comparableOnStorefront}}" stepKey="switchOnComparableOnStorefront" userInput="Yes" after="switchOnVisibleInAdvancedSearch"/> - <selectOption selector="{{AdminNewAttributePanel.useInLayeredNavigation}}" stepKey="selectUseInLayer" userInput="Filterable (with results)" after="switchOnComparableOnStorefront"/> - <selectOption selector="{{AdminNewAttributePanel.visibleOnCatalogPagesOnStorefront}}" stepKey="switchOnVisibleOnCatalogPagesOnStorefront" userInput="Yes" after="selectUseInLayer"/> - <selectOption selector="{{AdminNewAttributePanel.useInProductListing}}" stepKey="switchOnUsedInProductListing" userInput="Yes" after="switchOnVisibleOnCatalogPagesOnStorefront"/> - </actionGroup> - - <actionGroup name="AddVisualSwatchWithProductWithStorefrontPreviewImageConfigActionGroup" extends="AddVisualSwatchToProductActionGroup"> - <selectOption selector="{{AdminNewAttributePanel.updateProductPreviewImage}}" userInput="Yes" stepKey="selectUpdatePreviewImage" after="selectInputType"/> - <click selector="{{AdminNewAttributePanel.storefrontPropertiesTab}}" stepKey="goToStorefrontPropertiesTab" after="fillDefaultStoreLabel2"/> - <waitForElementVisible selector="{{AdminNewAttributePanel.storefrontPropertiesTitle}}" after="goToStorefrontPropertiesTab" stepKey="waitTabLoad"/> - <selectOption selector="{{AdminNewAttributePanel.useInLayeredNavigation}}" userInput="Filterable (with results)" stepKey="selectUseInLayer" after="waitTabLoad"/> - <selectOption selector="{{AdminNewAttributePanel.useInProductListing}}" userInput="Yes" stepKey="switchOnUsedInProductListing" after="selectUseInLayer"/> - <selectOption selector="{{AdminNewAttributePanel.usedForStoringInProductListing}}" userInput="Yes" stepKey="switchOnUsedForStoringInProductListing" after="switchOnUsedInProductListing"/> - </actionGroup> - - <actionGroup name="AddTextSwatchToProductActionGroup"> - <annotations> - <description>Add text swatch property attribute.</description> - </annotations> - <arguments> - <argument name="attributeName" defaultValue="{{textSwatchAttribute.default_label}}" type="string"/> - <argument name="attributeCode" defaultValue="{{textSwatchAttribute.attribute_code}}" type="string"/> - <argument name="option1" defaultValue="textSwatchOption1" type="string"/> - <argument name="option2" defaultValue="textSwatchOption2" type="string"/> - <argument name="option3" defaultValue="textSwatchOption3" type="string"/> - <argument name="usedInProductListing" defaultValue="No" type="string"/> - </arguments> - - <amOnPage url="{{ProductAttributePage.url}}" stepKey="goToNewProductAttributePage"/> - <waitForPageLoad stepKey="waitForNewProductAttributePage"/> - <fillField selector="{{AttributePropertiesSection.DefaultLabel}}" userInput="{{attributeName}}" stepKey="fillDefaultLabel"/> - <selectOption selector="{{AttributePropertiesSection.InputType}}" userInput="{{textSwatchAttribute.input_type}}" stepKey="selectInputType"/> - <click selector="{{AdminManageSwatchSection.addSwatchText}}" stepKey="clickAddSwatch1"/> - <fillField selector="{{AdminManageSwatchSection.swatchTextByIndex('0')}}" userInput="{{option1}}" stepKey="fillSwatch1"/> - <fillField selector="{{AdminManageSwatchSection.swatchAdminDescriptionByIndex('0')}}" userInput="{{option1}}" stepKey="fillSwatch1Description"/> - <click selector="{{AdminManageSwatchSection.addSwatchText}}" stepKey="clickAddSwatch2"/> - <fillField selector="{{AdminManageSwatchSection.swatchTextByIndex('1')}}" userInput="{{option2}}" stepKey="fillSwatch2"/> - <fillField selector="{{AdminManageSwatchSection.swatchAdminDescriptionByIndex('1')}}" userInput="{{option2}}" stepKey="fillSwatch2Description"/> - <click selector="{{AdminManageSwatchSection.addSwatchText}}" stepKey="clickAddSwatch3"/> - <fillField selector="{{AdminManageSwatchSection.swatchTextByIndex('2')}}" userInput="{{option3}}" stepKey="fillSwatch3"/> - <fillField selector="{{AdminManageSwatchSection.swatchAdminDescriptionByIndex('2')}}" userInput="{{option3}}" stepKey="fillSwatch3Description"/> - <click selector="{{AttributePropertiesSection.AdvancedProperties}}" stepKey="expandAdvancedProperties"/> - <selectOption selector="{{AttributePropertiesSection.Scope}}" userInput="1" stepKey="selectGlobalScope"/> - <fillField selector="{{AdvancedAttributePropertiesSection.AttributeCode}}" userInput="{{attributeCode}}" stepKey="fillAttributeCodeField"/> - <scrollToTopOfPage stepKey="scrollToTabs"/> - <click selector="{{StorefrontPropertiesSection.StoreFrontPropertiesTab}}" stepKey="clickStorefrontPropertiesTab"/> - <waitForElementVisible selector="{{AdvancedAttributePropertiesSection.UseInProductListing}}" stepKey="waitForTabSwitch"/> - <selectOption selector="{{AdvancedAttributePropertiesSection.UseInProductListing}}" userInput="{{usedInProductListing}}" stepKey="useInProductListing"/> - <click selector="{{AttributePropertiesSection.SaveAndEdit}}" stepKey="clickSave"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Swatches/Test/Mftf/ActionGroup/AddTextSwatchToProductActionGroup.xml b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/AddTextSwatchToProductActionGroup.xml new file mode 100644 index 0000000000000..97a391137d8e3 --- /dev/null +++ b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/AddTextSwatchToProductActionGroup.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddTextSwatchToProductActionGroup"> + <annotations> + <description>Add text swatch property attribute.</description> + </annotations> + <arguments> + <argument name="attributeName" defaultValue="{{textSwatchAttribute.default_label}}" type="string"/> + <argument name="attributeCode" defaultValue="{{textSwatchAttribute.attribute_code}}" type="string"/> + <argument name="option1" defaultValue="textSwatchOption1" type="string"/> + <argument name="option2" defaultValue="textSwatchOption2" type="string"/> + <argument name="option3" defaultValue="textSwatchOption3" type="string"/> + <argument name="usedInProductListing" defaultValue="No" type="string"/> + </arguments> + + <amOnPage url="{{ProductAttributePage.url}}" stepKey="goToNewProductAttributePage"/> + <waitForPageLoad stepKey="waitForNewProductAttributePage"/> + <fillField selector="{{AttributePropertiesSection.DefaultLabel}}" userInput="{{attributeName}}" stepKey="fillDefaultLabel"/> + <selectOption selector="{{AttributePropertiesSection.InputType}}" userInput="{{textSwatchAttribute.input_type}}" stepKey="selectInputType"/> + <click selector="{{AdminManageSwatchSection.addSwatchText}}" stepKey="clickAddSwatch1"/> + <fillField selector="{{AdminManageSwatchSection.swatchTextByIndex('0')}}" userInput="{{option1}}" stepKey="fillSwatch1"/> + <fillField selector="{{AdminManageSwatchSection.swatchAdminDescriptionByIndex('0')}}" userInput="{{option1}}" stepKey="fillSwatch1Description"/> + <click selector="{{AdminManageSwatchSection.addSwatchText}}" stepKey="clickAddSwatch2"/> + <fillField selector="{{AdminManageSwatchSection.swatchTextByIndex('1')}}" userInput="{{option2}}" stepKey="fillSwatch2"/> + <fillField selector="{{AdminManageSwatchSection.swatchAdminDescriptionByIndex('1')}}" userInput="{{option2}}" stepKey="fillSwatch2Description"/> + <click selector="{{AdminManageSwatchSection.addSwatchText}}" stepKey="clickAddSwatch3"/> + <fillField selector="{{AdminManageSwatchSection.swatchTextByIndex('2')}}" userInput="{{option3}}" stepKey="fillSwatch3"/> + <fillField selector="{{AdminManageSwatchSection.swatchAdminDescriptionByIndex('2')}}" userInput="{{option3}}" stepKey="fillSwatch3Description"/> + <click selector="{{AttributePropertiesSection.AdvancedProperties}}" stepKey="expandAdvancedProperties"/> + <selectOption selector="{{AttributePropertiesSection.Scope}}" userInput="1" stepKey="selectGlobalScope"/> + <fillField selector="{{AdvancedAttributePropertiesSection.AttributeCode}}" userInput="{{attributeCode}}" stepKey="fillAttributeCodeField"/> + <scrollToTopOfPage stepKey="scrollToTabs"/> + <click selector="{{StorefrontPropertiesSection.StoreFrontPropertiesTab}}" stepKey="clickStorefrontPropertiesTab"/> + <waitForElementVisible selector="{{AdvancedAttributePropertiesSection.UseInProductListing}}" stepKey="waitForTabSwitch"/> + <selectOption selector="{{AdvancedAttributePropertiesSection.UseInProductListing}}" userInput="{{usedInProductListing}}" stepKey="useInProductListing"/> + <click selector="{{AttributePropertiesSection.SaveAndEdit}}" stepKey="clickSave"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Swatches/Test/Mftf/ActionGroup/AddVisualSwatchToProductActionGroup.xml b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/AddVisualSwatchToProductActionGroup.xml new file mode 100644 index 0000000000000..670c343b609cf --- /dev/null +++ b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/AddVisualSwatchToProductActionGroup.xml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddVisualSwatchToProductActionGroup"> + <annotations> + <description>Adds the provided Visual Swatch Attribute and Options (2) to a Product on the Admin Product creation/edit page. Clicks on Save. Validates that the Success Message is present.</description> + </annotations> + <arguments> + <argument name="attribute" defaultValue="visualSwatchAttribute"/> + <argument name="option1" defaultValue="visualSwatchOption1"/> + <argument name="option2" defaultValue="visualSwatchOption2"/> + </arguments> + + <seeInCurrentUrl url="{{ProductCatalogPage.url}}" stepKey="seeOnProductEditPage"/> + <conditionalClick selector="{{AdminProductFormConfigurationsSection.sectionHeader}}" dependentSelector="{{AdminProductFormConfigurationsSection.createConfigurations}}" visible="false" stepKey="openConfigurationSection"/> + <click selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="openConfigurationPanel"/> + <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.createNewAttribute}}" stepKey="waitForSlideOut"/> + <click selector="{{AdminCreateProductConfigurationsPanel.createNewAttribute}}" stepKey="clickCreateNewAttribute"/> + <waitForPageLoad stepKey="waitForIFrame"/> + + <switchToIFrame selector="{{AdminNewAttributePanel.newAttributeIFrame}}" stepKey="switchToNewAttributeIFrame"/> + <fillField selector="{{AdminNewAttributePanel.defaultLabel}}" userInput="{{attribute.default_label}}" stepKey="fillDefaultLabel"/> + <selectOption selector="{{AdminNewAttributePanel.inputType}}" userInput="{{attribute.input_type}}" stepKey="selectInputType"/> + <!--Add swatch options--> + <click selector="{{AdminNewAttributePanel.addVisualSwatchOption}}" stepKey="clickAddSwatch1"/> + <waitForElementVisible selector="{{AdminNewAttributePanel.visualSwatchOptionAdminValue('0')}}" stepKey="waitForOption1Row"/> + <fillField selector="{{AdminNewAttributePanel.visualSwatchOptionAdminValue('0')}}" userInput="{{option1.admin_label}}" stepKey="fillAdminLabel1"/> + <fillField selector="{{AdminNewAttributePanel.visualSwatchOptionDefaultStoreValue('0')}}" userInput="{{option1.default_label}}" stepKey="fillDefaultStoreLabel1"/> + <click selector="{{AdminNewAttributePanel.addVisualSwatchOption}}" stepKey="clickAddSwatch2"/> + <waitForElementVisible selector="{{AdminNewAttributePanel.visualSwatchOptionAdminValue('1')}}" stepKey="waitForOption2Row"/> + <fillField selector="{{AdminNewAttributePanel.visualSwatchOptionAdminValue('1')}}" userInput="{{option2.admin_label}}" stepKey="fillAdminLabel2"/> + <fillField selector="{{AdminNewAttributePanel.visualSwatchOptionDefaultStoreValue('1')}}" userInput="{{option2.default_label}}" stepKey="fillDefaultStoreLabel2"/> + + <!--Save attribute--> + <click selector="{{AdminNewAttributePanel.saveAttribute}}" stepKey="clickOnNewAttributePanel"/> + <waitForPageLoad stepKey="waitForSaveAttribute"/> + <switchToIFrame stepKey="switchOutOfIFrame"/> + + <!--Find attribute in grid and select--> + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingFilters"/> + <click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="clickOnFilters"/> + <fillField selector="{{AdminDataGridHeaderSection.attributeCodeFilterInput}}" userInput="{{attribute.default_label}}" stepKey="fillFilterAttributeCodeField"/> + <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickApplyFiltersButton"/> + <click selector="{{AdminDataGridTableSection.rowCheckbox('1')}}" stepKey="clickOnFirstCheckbox"/> + + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickNextStep1"/> + + <click selector="{{AdminCreateProductConfigurationsPanel.selectAllByAttribute(attribute.default_label)}}" stepKey="clickSelectAll"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickNextStep2"/> + + <click selector="{{AdminCreateProductConfigurationsPanel.applySingleQuantityToEachSkus}}" stepKey="clickOnApplySingleQuantityToEachSku"/> + <fillField selector="{{AdminCreateProductConfigurationsPanel.quantity}}" userInput="100" stepKey="enterAttributeQuantity"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextStep3"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="generateProducts"/> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct"/> + <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup"/> + <seeElement selector="{{AdminMessagesSection.success}}" stepKey="seeSaveProductMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Swatches/Test/Mftf/ActionGroup/AddVisualSwatchToProductWithStorefrontConfigActionGroup.xml b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/AddVisualSwatchToProductWithStorefrontConfigActionGroup.xml new file mode 100644 index 0000000000000..71ce5ebd7df30 --- /dev/null +++ b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/AddVisualSwatchToProductWithStorefrontConfigActionGroup.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddVisualSwatchToProductWithStorefrontConfigActionGroup" extends="AddVisualSwatchToProductActionGroup"> + <annotations> + <description>EXTENDS: AddVisualSwatchToProductActionGroup. Add the provided Visual Swatch Attribute and Options (2) to a Product with Storefront Configurations.</description> + </annotations> + <arguments> + <argument name="attribute" defaultValue="visualSwatchAttribute"/> + <argument name="option1" defaultValue="visualSwatchOption1"/> + <argument name="option2" defaultValue="visualSwatchOption2"/> + </arguments> + + <!-- Go to Storefront Properties tab --> + <click selector="{{AdminNewAttributePanel.storefrontPropertiesTab}}" stepKey="goToStorefrontPropertiesTab" after="fillDefaultStoreLabel2"/> + <waitForElementVisible selector="{{AdminNewAttributePanel.storefrontPropertiesTitle}}" stepKey="waitTabLoad" after="goToStorefrontPropertiesTab"/> + <selectOption selector="{{AdminNewAttributePanel.useInSearch}}" stepKey="switchOnUsInSearch" userInput="Yes" after="waitTabLoad"/> + <selectOption selector="{{AdminNewAttributePanel.visibleInAdvancedSearch}}" stepKey="switchOnVisibleInAdvancedSearch" userInput="Yes" after="switchOnUsInSearch"/> + <selectOption selector="{{AdminNewAttributePanel.comparableOnStorefront}}" stepKey="switchOnComparableOnStorefront" userInput="Yes" after="switchOnVisibleInAdvancedSearch"/> + <selectOption selector="{{AdminNewAttributePanel.useInLayeredNavigation}}" stepKey="selectUseInLayer" userInput="Filterable (with results)" after="switchOnComparableOnStorefront"/> + <selectOption selector="{{AdminNewAttributePanel.visibleOnCatalogPagesOnStorefront}}" stepKey="switchOnVisibleOnCatalogPagesOnStorefront" userInput="Yes" after="selectUseInLayer"/> + <selectOption selector="{{AdminNewAttributePanel.useInProductListing}}" stepKey="switchOnUsedInProductListing" userInput="Yes" after="switchOnVisibleOnCatalogPagesOnStorefront"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Swatches/Test/Mftf/ActionGroup/AddVisualSwatchWithProductWithStorefrontPreviewImageConfigActionGroup.xml b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/AddVisualSwatchWithProductWithStorefrontPreviewImageConfigActionGroup.xml new file mode 100644 index 0000000000000..64c298bdcb16c --- /dev/null +++ b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/AddVisualSwatchWithProductWithStorefrontPreviewImageConfigActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddVisualSwatchWithProductWithStorefrontPreviewImageConfigActionGroup" extends="AddVisualSwatchToProductActionGroup"> + <selectOption selector="{{AdminNewAttributePanel.updateProductPreviewImage}}" userInput="Yes" stepKey="selectUpdatePreviewImage" after="selectInputType"/> + <click selector="{{AdminNewAttributePanel.storefrontPropertiesTab}}" stepKey="goToStorefrontPropertiesTab" after="fillDefaultStoreLabel2"/> + <waitForElementVisible selector="{{AdminNewAttributePanel.storefrontPropertiesTitle}}" after="goToStorefrontPropertiesTab" stepKey="waitTabLoad"/> + <selectOption selector="{{AdminNewAttributePanel.useInLayeredNavigation}}" userInput="Filterable (with results)" stepKey="selectUseInLayer" after="waitTabLoad"/> + <selectOption selector="{{AdminNewAttributePanel.useInProductListing}}" userInput="Yes" stepKey="switchOnUsedInProductListing" after="selectUseInLayer"/> + <selectOption selector="{{AdminNewAttributePanel.usedForStoringInProductListing}}" userInput="Yes" stepKey="switchOnUsedForStoringInProductListing" after="switchOnUsedInProductListing"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Swatches/Test/Mftf/ActionGroup/AdminEditPropertiesTabForSwatchProductAtributeActionGroup.xml b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/AdminAddSwatchOptionAndFillFieldsActionGroup.xml similarity index 72% rename from app/code/Magento/Swatches/Test/Mftf/ActionGroup/AdminEditPropertiesTabForSwatchProductAtributeActionGroup.xml rename to app/code/Magento/Swatches/Test/Mftf/ActionGroup/AdminAddSwatchOptionAndFillFieldsActionGroup.xml index 05ab5a53468a2..f31753438569c 100644 --- a/app/code/Magento/Swatches/Test/Mftf/ActionGroup/AdminEditPropertiesTabForSwatchProductAtributeActionGroup.xml +++ b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/AdminAddSwatchOptionAndFillFieldsActionGroup.xml @@ -8,7 +8,6 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <!--You are on ProductAttributePage--> <!--Add new swatch options and fill fields for product attribute --> <actionGroup name="AdminAddSwatchOptionAndFillFieldsActionGroup"> @@ -20,13 +19,4 @@ <fillField selector="{{AdminNewAttributePanel.lastVisualSwatchOptionAdminValue}}" userInput="{{swatchOption.admin_label}}" stepKey="fillAdminLabel"/> <fillField selector="{{AdminNewAttributePanel.lastVisualSwatchOptionDefaultStoreValue}}" userInput="{{swatchOption.default_label}}" stepKey="fillDefaultStoreLabel"/> </actionGroup> - - <!--You are on ProductAttributePage--> - <!--Select value for option "Update Product Preview Image"--> - <actionGroup name="AdminUpdateProductPreviewImageActionGroup"> - <arguments> - <argument name="value" type="string" defaultValue="Yes"/> - </arguments> - <selectOption selector="{{AttributePropertiesSection.UpdateProductPreviewImage}}" userInput="{{value}}" stepKey="setUpdateProductPreviewImage"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Swatches/Test/Mftf/ActionGroup/AdminUpdateProductPreviewImageActionGroup.xml b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/AdminUpdateProductPreviewImageActionGroup.xml new file mode 100644 index 0000000000000..34d053a47a00f --- /dev/null +++ b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/AdminUpdateProductPreviewImageActionGroup.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminUpdateProductPreviewImageActionGroup"> + <arguments> + <argument name="value" type="string" defaultValue="Yes"/> + </arguments> + <selectOption selector="{{AttributePropertiesSection.UpdateProductPreviewImage}}" userInput="{{value}}" stepKey="setUpdateProductPreviewImage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Swatches/Test/Mftf/ActionGroup/AssertStorefrontSwatchColorActionGroup.xml b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/AssertStorefrontSwatchColorActionGroup.xml new file mode 100644 index 0000000000000..b48494a85ae2c --- /dev/null +++ b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/AssertStorefrontSwatchColorActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertStorefrontSwatchColorActionGroup"> + <annotations> + <description>Validates that the Storefront Product has the provided Swatch with the provided Color.</description> + </annotations> + <arguments> + <argument name="nthSwatch" type="string" defaultValue="1"/> + <argument name="expectedRgb" type="string" defaultValue="rgb(231, 77, 60)"/> + </arguments> + + <grabAttributeFrom selector="{{StorefrontProductInfoMainSection.nthSwatchOption(nthSwatch)}}" userInput="style" stepKey="grabStyle1"/> + <assertEquals stepKey="assertStyle1"> + <actualResult type="string">{$grabStyle1}</actualResult> + <expectedResult type="string">background: center center no-repeat {{expectedRgb}};</expectedResult> + </assertEquals> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Swatches/Test/Mftf/ActionGroup/AssertSwatchColorActionGroup.xml b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/AssertSwatchColorActionGroup.xml new file mode 100644 index 0000000000000..f978afd7d2ca0 --- /dev/null +++ b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/AssertSwatchColorActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertSwatchColorActionGroup"> + <annotations> + <description>Validates that the provided Color Picker contains the provided Style.</description> + </annotations> + <arguments> + <argument name="nthSwatch" type="string" defaultValue="1"/> + <argument name="expectedStyle" type="string" defaultValue="background: rgb(0, 0, 0);"/> + </arguments> + + <grabAttributeFrom selector="{{AdminManageSwatchSection.nthSwatch(nthSwatch)}}" userInput="style" stepKey="grabStyle1"/> + <assertEquals stepKey="assertStyle1"> + <actualResult type="string">{$grabStyle1}</actualResult> + <expectedResult type="string">{{expectedStyle}}</expectedResult> + </assertEquals> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Swatches/Test/Mftf/ActionGroup/ColorPickerActionGroup.xml b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/ColorPickerActionGroup.xml deleted file mode 100644 index 7cad0048261eb..0000000000000 --- a/app/code/Magento/Swatches/Test/Mftf/ActionGroup/ColorPickerActionGroup.xml +++ /dev/null @@ -1,68 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="setColorPickerByHex"> - <annotations> - <description>Sets the provided HEX value in the provided Color Picker.</description> - </annotations> - <arguments> - <argument name="nthColorPicker" type="string" defaultValue="1"/> - <argument name="hexColor" type="string" defaultValue="e74c3c"/> - </arguments> - - <!-- This 6x backspace stuff is some magic that is necessary to interact with this field correctly --> - <pressKey selector="{{AdminColorPickerSection.hexByIndex(nthColorPicker)}}" parameterArray="[\Facebook\WebDriver\WebDriverKeys::BACKSPACE,\Facebook\WebDriver\WebDriverKeys::BACKSPACE,\Facebook\WebDriver\WebDriverKeys::BACKSPACE,\Facebook\WebDriver\WebDriverKeys::BACKSPACE,\Facebook\WebDriver\WebDriverKeys::BACKSPACE,\Facebook\WebDriver\WebDriverKeys::BACKSPACE,'{{hexColor}}']" stepKey="fillHex1"/> - <click selector="{{AdminColorPickerSection.submitByIndex(nthColorPicker)}}" stepKey="submitColor1"/> - </actionGroup> - - <actionGroup name="assertSwatchColor"> - <annotations> - <description>Validates that the provided Color Picker contains the provided Style.</description> - </annotations> - <arguments> - <argument name="nthSwatch" type="string" defaultValue="1"/> - <argument name="expectedStyle" type="string" defaultValue="background: rgb(0, 0, 0);"/> - </arguments> - - <grabAttributeFrom selector="{{AdminManageSwatchSection.nthSwatch(nthSwatch)}}" userInput="style" stepKey="grabStyle1"/> - <assertEquals stepKey="assertStyle1"> - <actualResult type="string">{$grabStyle1}</actualResult> - <expectedResult type="string">{{expectedStyle}}</expectedResult> - </assertEquals> - </actionGroup> - - <actionGroup name="assertStorefrontSwatchColor"> - <annotations> - <description>Validates that the Storefront Product has the provided Swatch with the provided Color.</description> - </annotations> - <arguments> - <argument name="nthSwatch" type="string" defaultValue="1"/> - <argument name="expectedRgb" type="string" defaultValue="rgb(231, 77, 60)"/> - </arguments> - - <grabAttributeFrom selector="{{StorefrontProductInfoMainSection.nthSwatchOption(nthSwatch)}}" userInput="style" stepKey="grabStyle1"/> - <assertEquals stepKey="assertStyle1"> - <actualResult type="string">{$grabStyle1}</actualResult> - <expectedResult type="string">background: center center no-repeat {{expectedRgb}};</expectedResult> - </assertEquals> - </actionGroup> - - <actionGroup name="openSwatchMenuByIndex"> - <annotations> - <description>Options the Swatch Menu based on the provided Index.</description> - </annotations> - <arguments> - <argument name="index" type="string" defaultValue="0"/> - </arguments> - - <!-- I had to use executeJS to perform the click to get around the use of CSS ::before and ::after --> - <executeJS function="jQuery('#swatch_window_option_option_{{index}}').click()" stepKey="clickSwatch1"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Swatches/Test/Mftf/ActionGroup/OpenSwatchMenuByIndexActionGroup.xml b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/OpenSwatchMenuByIndexActionGroup.xml new file mode 100644 index 0000000000000..b721596789f92 --- /dev/null +++ b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/OpenSwatchMenuByIndexActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="OpenSwatchMenuByIndexActionGroup"> + <annotations> + <description>Options the Swatch Menu based on the provided Index.</description> + </annotations> + <arguments> + <argument name="index" type="string" defaultValue="0"/> + </arguments> + + <!-- I had to use executeJS to perform the click to get around the use of CSS ::before and ::after --> + <executeJS function="jQuery('#swatch_window_option_option_{{index}}').click()" stepKey="clickSwatch1"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Swatches/Test/Mftf/ActionGroup/SetColorPickerByHexActionGroup.xml b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/SetColorPickerByHexActionGroup.xml new file mode 100644 index 0000000000000..396c1cc87c5c4 --- /dev/null +++ b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/SetColorPickerByHexActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SetColorPickerByHexActionGroup"> + <annotations> + <description>Sets the provided HEX value in the provided Color Picker.</description> + </annotations> + <arguments> + <argument name="nthColorPicker" type="string" defaultValue="1"/> + <argument name="hexColor" type="string" defaultValue="e74c3c"/> + </arguments> + + <!-- This 6x backspace stuff is some magic that is necessary to interact with this field correctly --> + <pressKey selector="{{AdminColorPickerSection.hexByIndex(nthColorPicker)}}" parameterArray="[\Facebook\WebDriver\WebDriverKeys::BACKSPACE,\Facebook\WebDriver\WebDriverKeys::BACKSPACE,\Facebook\WebDriver\WebDriverKeys::BACKSPACE,\Facebook\WebDriver\WebDriverKeys::BACKSPACE,\Facebook\WebDriver\WebDriverKeys::BACKSPACE,\Facebook\WebDriver\WebDriverKeys::BACKSPACE,'{{hexColor}}']" stepKey="fillHex1"/> + <click selector="{{AdminColorPickerSection.submitByIndex(nthColorPicker)}}" stepKey="submitColor1"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Swatches/Test/Mftf/ActionGroup/StorefrontAddProductWithSwatchesToTheCartActionGroup.xml b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/StorefrontAddProductWithSwatchesToTheCartActionGroup.xml new file mode 100644 index 0000000000000..64933e184a86d --- /dev/null +++ b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/StorefrontAddProductWithSwatchesToTheCartActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <!-- Add Configurable Product with Swatch attribute to the cart --> + <actionGroup name="StorefrontAddProductWithSwatchesToTheCartActionGroup" extends="StorefrontAddProductToCartWithQtyActionGroup"> + <arguments> + <argument name="product"/> + <argument name="productOption" type="string"/> + </arguments> + <remove keyForRemoval="seeSuccessSaveMessage"/> + <click selector="{{StorefrontProductInfoMainSection.visualSwatchOption(productOption)}}" after="waitForStorefrontProductPageLoad" stepKey="clickSelectOption"/> + <see selector="{{StorefrontMessagesSection.success}}" userInput="You added {{product.name}} to your shopping cart." after="waitForSuccessMessage" stepKey="seeAddToCartSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Swatches/Test/Mftf/ActionGroup/StorefrontAssertSwatchOptionPriceActionGroup.xml b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/StorefrontAssertSwatchOptionPriceActionGroup.xml new file mode 100644 index 0000000000000..b4a3708c15659 --- /dev/null +++ b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/StorefrontAssertSwatchOptionPriceActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontAssertSwatchOptionPriceActionGroup"> + <arguments> + <argument name="optionName" type="string"/> + <argument name="optionPrice" type="string"/> + </arguments> + <click selector="{{StorefrontProductInfoMainSection.swatchOptionByLabel(optionName)}}" stepKey="clickOnOption"/> + <see userInput="{{optionPrice}}" selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="seeOptionPrice"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Swatches/Test/Mftf/ActionGroup/StorefrontProductActionGroup.xml b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/StorefrontProductActionGroup.xml deleted file mode 100644 index 6ca0c220778d6..0000000000000 --- a/app/code/Magento/Swatches/Test/Mftf/ActionGroup/StorefrontProductActionGroup.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. - */ ---> - -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <!--Click a swatch option on product page--> - <actionGroup name="StorefrontSelectSwatchOptionOnProductPage"> - <arguments> - <argument name="optionName" type="string"/> - </arguments> - <click selector="{{StorefrontProductInfoMainSection.swatchOptionByLabel(optionName)}}" stepKey="clickSwatchOption"/> - </actionGroup> - <actionGroup name="StorefrontAssertSwatchOptionPrice"> - <arguments> - <argument name="optionName" type="string"/> - <argument name="optionPrice" type="string"/> - </arguments> - <click selector="{{StorefrontProductInfoMainSection.swatchOptionByLabel(optionName)}}" stepKey="clickOnOption"/> - <see userInput="{{optionPrice}}" selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="seeOptionPrice"/> - </actionGroup> - - <!--Click a swatch option on product page and check active image--> - <actionGroup name="StorefrontSelectSwatchOptionOnProductPageAndCheckImage" extends="StorefrontSelectSwatchOptionOnProductPage"> - <arguments> - <argument name="fileName" type="string" defaultValue="magento-logo"/> - </arguments> - <seeElement selector="{{StorefrontProductMediaSection.productImageActive(fileName)}}" stepKey="seeActiveImageDefault"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Swatches/Test/Mftf/ActionGroup/StorefrontSelectSwatchOptionOnProductPageActionGroup.xml b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/StorefrontSelectSwatchOptionOnProductPageActionGroup.xml new file mode 100644 index 0000000000000..53c4adb5e1ab3 --- /dev/null +++ b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/StorefrontSelectSwatchOptionOnProductPageActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <!--Click a swatch option on product page--> + <actionGroup name="StorefrontSelectSwatchOptionOnProductPageActionGroup"> + <arguments> + <argument name="optionName" type="string"/> + </arguments> + <click selector="{{StorefrontProductInfoMainSection.swatchOptionByLabel(optionName)}}" stepKey="clickSwatchOption"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Swatches/Test/Mftf/ActionGroup/StorefrontSelectSwatchOptionOnProductPageAndCheckImageActionGroup.xml b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/StorefrontSelectSwatchOptionOnProductPageAndCheckImageActionGroup.xml new file mode 100644 index 0000000000000..67fd0178be9fa --- /dev/null +++ b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/StorefrontSelectSwatchOptionOnProductPageAndCheckImageActionGroup.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontSelectSwatchOptionOnProductPageAndCheckImageActionGroup" extends="StorefrontSelectSwatchOptionOnProductPageActionGroup"> + <arguments> + <argument name="fileName" type="string" defaultValue="magento-logo"/> + </arguments> + <seeElement selector="{{StorefrontProductMediaSection.productImageActive(fileName)}}" stepKey="seeActiveImageDefault"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Swatches/Test/Mftf/ActionGroup/StorefrontAddProductWithSwatchAttributeToTheCartActionGroup.xml b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/StorefrontUpdateCartConfigurableProductWithSwatchesActionGroup.xml similarity index 54% rename from app/code/Magento/Swatches/Test/Mftf/ActionGroup/StorefrontAddProductWithSwatchAttributeToTheCartActionGroup.xml rename to app/code/Magento/Swatches/Test/Mftf/ActionGroup/StorefrontUpdateCartConfigurableProductWithSwatchesActionGroup.xml index 9bd58bff69e5a..2a4f7fd2db62d 100644 --- a/app/code/Magento/Swatches/Test/Mftf/ActionGroup/StorefrontAddProductWithSwatchAttributeToTheCartActionGroup.xml +++ b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/StorefrontUpdateCartConfigurableProductWithSwatchesActionGroup.xml @@ -7,20 +7,8 @@ --> <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <!-- Add Configurable Product with Swatch attribute to the cart --> - <actionGroup name="StorefrontAddProductWithSwatchesToTheCartActionGroup" extends="StorefrontAddProductToCartWithQtyActionGroup"> - <arguments> - <argument name="product"/> - <argument name="productOption" type="string"/> - </arguments> - <remove keyForRemoval="seeSuccessSaveMessage"/> - <click selector="{{StorefrontProductInfoMainSection.visualSwatchOption(productOption)}}" after="waitForStorefrontProductPageLoad" stepKey="clickSelectOption"/> - <see selector="{{StorefrontMessagesSection.success}}" userInput="You added {{product.name}} to your shopping cart." after="waitForSuccessMessage" stepKey="seeAddToCartSuccessMessage"/> - </actionGroup> - - <!-- Update Configurable Product with Swatch attribute in the cart --> - <actionGroup name="StorefrontUpdateCartConfigurableProductWithSwatches"> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontUpdateCartConfigurableProductWithSwatchesActionGroup"> <arguments> <argument name="product"/> <argument name="productOption" type="string"/> @@ -32,4 +20,4 @@ <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> <see selector="{{StorefrontMessagesSection.success}}" userInput="{{product.name}} was updated in your shopping cart." stepKey="assertSuccessMessage"/> </actionGroup> -</actionGroups> \ No newline at end of file +</actionGroups> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateImageSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateImageSwatchTest.xml index 0e294153e881e..97d8b9075c014 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateImageSwatchTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateImageSwatchTest.xml @@ -40,7 +40,7 @@ <!-- Set swatch image #1 --> <click selector="{{AdminManageSwatchSection.addSwatch}}" stepKey="clickAddSwatch1"/> - <actionGroup ref="openSwatchMenuByIndex" stepKey="clickSwatch1"> + <actionGroup ref="OpenSwatchMenuByIndexActionGroup" stepKey="clickSwatch1"> <argument name="index" value="0"/> </actionGroup> <click selector="{{AdminManageSwatchSection.nthUploadFile('1')}}" stepKey="clickUploadFile1"/> @@ -49,7 +49,7 @@ <!-- Set swatch image #2 --> <click selector="{{AdminManageSwatchSection.addSwatch}}" stepKey="clickAddSwatch2"/> - <actionGroup ref="openSwatchMenuByIndex" stepKey="clickSwatch2"> + <actionGroup ref="OpenSwatchMenuByIndexActionGroup" stepKey="clickSwatch2"> <argument name="index" value="1"/> </actionGroup> <click selector="{{AdminManageSwatchSection.nthUploadFile('2')}}" stepKey="clickUploadFile2"/> @@ -58,7 +58,7 @@ <!-- Set swatch image #3 --> <click selector="{{AdminManageSwatchSection.addSwatch}}" stepKey="clickAddSwatch3"/> - <actionGroup ref="openSwatchMenuByIndex" stepKey="clickSwatch3"> + <actionGroup ref="OpenSwatchMenuByIndexActionGroup" stepKey="clickSwatch3"> <argument name="index" value="2"/> </actionGroup> <click selector="{{AdminManageSwatchSection.nthUploadFile('3')}}" stepKey="clickUploadFile3"/> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateVisualSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateVisualSwatchTest.xml index 65f0e2b09b82a..1c8e86b3765d4 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateVisualSwatchTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateVisualSwatchTest.xml @@ -50,33 +50,33 @@ <!-- Set swatch #1 using the color picker --> <click selector="{{AdminManageSwatchSection.addSwatch}}" stepKey="clickAddSwatch1"/> - <actionGroup ref="openSwatchMenuByIndex" stepKey="clickSwatch1"> + <actionGroup ref="OpenSwatchMenuByIndexActionGroup" stepKey="clickSwatch1"> <argument name="index" value="0"/> </actionGroup> <click selector="{{AdminManageSwatchSection.nthChooseColor('1')}}" stepKey="clickChooseColor1"/> - <actionGroup ref="setColorPickerByHex" stepKey="fillHex1"> + <actionGroup ref="SetColorPickerByHexActionGroup" stepKey="fillHex1"> <argument name="nthColorPicker" value="1"/> <argument name="hexColor" value="e74c3c"/> </actionGroup> <fillField selector="{{AdminManageSwatchSection.adminInputByIndex('0')}}" userInput="red" stepKey="fillAdmin1"/> <!-- Set swatch #2 using the color picker --> <click selector="{{AdminManageSwatchSection.addSwatch}}" stepKey="clickAddSwatch2"/> - <actionGroup ref="openSwatchMenuByIndex" stepKey="clickSwatch2"> + <actionGroup ref="OpenSwatchMenuByIndexActionGroup" stepKey="clickSwatch2"> <argument name="index" value="1"/> </actionGroup> <click selector="{{AdminManageSwatchSection.nthChooseColor('2')}}" stepKey="clickChooseColor2"/> - <actionGroup ref="setColorPickerByHex" stepKey="fillHex2"> + <actionGroup ref="SetColorPickerByHexActionGroup" stepKey="fillHex2"> <argument name="nthColorPicker" value="2"/> <argument name="hexColor" value="2ecc71"/> </actionGroup> <fillField selector="{{AdminManageSwatchSection.adminInputByIndex('1')}}" userInput="green" stepKey="fillAdmin2"/> <!-- Set swatch #3 using the color picker --> <click selector="{{AdminManageSwatchSection.addSwatch}}" stepKey="clickAddSwatch3"/> - <actionGroup ref="openSwatchMenuByIndex" stepKey="clickSwatch3"> + <actionGroup ref="OpenSwatchMenuByIndexActionGroup" stepKey="clickSwatch3"> <argument name="index" value="2"/> </actionGroup> <click selector="{{AdminManageSwatchSection.nthChooseColor('3')}}" stepKey="clickChooseColor3"/> - <actionGroup ref="setColorPickerByHex" stepKey="fillHex3"> + <actionGroup ref="SetColorPickerByHexActionGroup" stepKey="fillHex3"> <argument name="nthColorPicker" value="3"/> <argument name="hexColor" value="3498db"/> </actionGroup> @@ -88,15 +88,15 @@ <waitForElementVisible selector="{{AdminProductMessagesSection.successMessage}}" stepKey="waitForSuccess"/> <!-- Assert that the Save was successful after round trip to server --> - <actionGroup ref="assertSwatchColor" stepKey="assertSwatch1"> + <actionGroup ref="AssertSwatchColorActionGroup" stepKey="assertSwatch1"> <argument name="nthSwatch" value="1"/> <argument name="expectedStyle" value="background: rgb(231, 77, 60);"/> </actionGroup> - <actionGroup ref="assertSwatchColor" stepKey="assertSwatch2"> + <actionGroup ref="AssertSwatchColorActionGroup" stepKey="assertSwatch2"> <argument name="nthSwatch" value="2"/> <argument name="expectedStyle" value="background: rgb(46, 204, 112);"/> </actionGroup> - <actionGroup ref="assertSwatchColor" stepKey="assertSwatch3"> + <actionGroup ref="AssertSwatchColorActionGroup" stepKey="assertSwatch3"> <argument name="nthSwatch" value="3"/> <argument name="expectedStyle" value="background: rgb(52, 152, 219);"/> </actionGroup> @@ -143,15 +143,15 @@ <waitForPageLoad stepKey="waitForProductPage"/> <!-- Verify that the storefront shows the swatches too --> - <actionGroup ref="assertStorefrontSwatchColor" stepKey="assertSwatch4"> + <actionGroup ref="AssertStorefrontSwatchColorActionGroup" stepKey="assertSwatch4"> <argument name="nthSwatch" value="1"/> <argument name="expectedRgb" value="rgb(231, 77, 60)"/> </actionGroup> - <actionGroup ref="assertStorefrontSwatchColor" stepKey="assertSwatch5"> + <actionGroup ref="AssertStorefrontSwatchColorActionGroup" stepKey="assertSwatch5"> <argument name="nthSwatch" value="2"/> <argument name="expectedRgb" value="rgb(46, 204, 112)"/> </actionGroup> - <actionGroup ref="assertStorefrontSwatchColor" stepKey="assertSwatch6"> + <actionGroup ref="AssertStorefrontSwatchColorActionGroup" stepKey="assertSwatch6"> <argument name="nthSwatch" value="3"/> <argument name="expectedRgb" value="rgb(52, 152, 219)"/> </actionGroup> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateVisualSwatchWithNonValidOptionsTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateVisualSwatchWithNonValidOptionsTest.xml index b03f771875957..b69d48384aed8 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateVisualSwatchWithNonValidOptionsTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateVisualSwatchWithNonValidOptionsTest.xml @@ -47,11 +47,11 @@ <!-- Add new swatch option without label --> <click selector="{{AdminManageSwatchSection.addSwatch}}" stepKey="clickAddSwatch1"/> - <actionGroup ref="openSwatchMenuByIndex" stepKey="clickSwatch1"> + <actionGroup ref="OpenSwatchMenuByIndexActionGroup" stepKey="clickSwatch1"> <argument name="index" value="0"/> </actionGroup> <click selector="{{AdminManageSwatchSection.nthChooseColor('1')}}" stepKey="clickChooseColor1"/> - <actionGroup ref="setColorPickerByHex" stepKey="fillHex1"> + <actionGroup ref="SetColorPickerByHexActionGroup" stepKey="fillHex1"> <argument name="nthColorPicker" value="1"/> <argument name="hexColor" value="ff0000"/> </actionGroup> @@ -66,11 +66,11 @@ <!-- Add 2 additional new swatch options --> <click selector="{{AdminManageSwatchSection.addSwatch}}" stepKey="clickAddSwatch2"/> - <actionGroup ref="openSwatchMenuByIndex" stepKey="clickSwatch2"> + <actionGroup ref="OpenSwatchMenuByIndexActionGroup" stepKey="clickSwatch2"> <argument name="index" value="1"/> </actionGroup> <click selector="{{AdminManageSwatchSection.nthChooseColor('2')}}" stepKey="clickChooseColor2"/> - <actionGroup ref="setColorPickerByHex" stepKey="fillHex2"> + <actionGroup ref="SetColorPickerByHexActionGroup" stepKey="fillHex2"> <argument name="nthColorPicker" value="2"/> <argument name="hexColor" value="00ff00"/> </actionGroup> @@ -78,11 +78,11 @@ userInput="green" stepKey="fillAdmin2"/> <click selector="{{AdminManageSwatchSection.addSwatch}}" stepKey="clickAddSwatch3"/> - <actionGroup ref="openSwatchMenuByIndex" stepKey="clickSwatch3"> + <actionGroup ref="OpenSwatchMenuByIndexActionGroup" stepKey="clickSwatch3"> <argument name="index" value="2"/> </actionGroup> <click selector="{{AdminManageSwatchSection.nthChooseColor('3')}}" stepKey="clickChooseColor3"/> - <actionGroup ref="setColorPickerByHex" stepKey="fillHex3"> + <actionGroup ref="SetColorPickerByHexActionGroup" stepKey="fillHex3"> <argument name="nthColorPicker" value="3"/> <argument name="hexColor" value="0000ff"/> </actionGroup> @@ -109,4 +109,4 @@ <!-- Check attribute data --> <seeCheckboxIsChecked selector="{{AdminManageSwatchSection.nthIsDefault('2')}}" stepKey="CheckDefaultOption"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/AdminDisablingSwatchTooltipsTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/AdminDisablingSwatchTooltipsTest.xml index 2ffc61614bd1d..b44c04d2c1b46 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/AdminDisablingSwatchTooltipsTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/AdminDisablingSwatchTooltipsTest.xml @@ -61,11 +61,11 @@ <!-- Set swatch using the color picker --> <click selector="{{AdminManageSwatchSection.addSwatch}}" stepKey="clickAddSwatch1"/> - <actionGroup ref="openSwatchMenuByIndex" stepKey="clickSwatch1"> + <actionGroup ref="OpenSwatchMenuByIndexActionGroup" stepKey="clickSwatch1"> <argument name="index" value="0"/> </actionGroup> <click selector="{{AdminManageSwatchSection.nthChooseColor('1')}}" stepKey="clickChooseColor1"/> - <actionGroup ref="setColorPickerByHex" stepKey="fillHex1"> + <actionGroup ref="SetColorPickerByHexActionGroup" stepKey="fillHex1"> <argument name="nthColorPicker" value="1"/> <argument name="hexColor" value="e74c3c"/> </actionGroup> @@ -77,7 +77,7 @@ <waitForElementVisible selector="{{AdminProductMessagesSection.successMessage}}" stepKey="waitForSuccess"/> <!-- Assert that the Save was successful after round trip to server --> - <actionGroup ref="assertSwatchColor" stepKey="assertSwatchAdmin"> + <actionGroup ref="AssertSwatchColorActionGroup" stepKey="assertSwatchAdmin"> <argument name="nthSwatch" value="1"/> <argument name="expectedStyle" value="background: rgb(231, 77, 60);"/> </actionGroup> @@ -137,7 +137,7 @@ <waitForPageLoad stepKey="waitForProductPage"/> <!-- Verify that the storefront shows the swatches too --> - <actionGroup ref="assertStorefrontSwatchColor" stepKey="assertSwatchStorefront"> + <actionGroup ref="AssertStorefrontSwatchColorActionGroup" stepKey="assertSwatchStorefront"> <argument name="nthSwatch" value="1"/> <argument name="expectedRgb" value="rgb(231, 77, 60)"/> </actionGroup> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/AdminSaveConfigurableProductWithAttributesImagesAndSwatchesTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/AdminSaveConfigurableProductWithAttributesImagesAndSwatchesTest.xml index f94314fe94806..cb66b811abad5 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/AdminSaveConfigurableProductWithAttributesImagesAndSwatchesTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/AdminSaveConfigurableProductWithAttributesImagesAndSwatchesTest.xml @@ -33,18 +33,18 @@ <!-- Add a few Swatches and add images to Manage Swatch (Values of Your Attribute) 1. Set swatch #1 using the color picker --> <click selector="{{AdminManageSwatchSection.addSwatch}}" stepKey="clickAddFirstSwatch"/> - <actionGroup ref="openSwatchMenuByIndex" stepKey="clickFirstSwatch"> + <actionGroup ref="OpenSwatchMenuByIndexActionGroup" stepKey="clickFirstSwatch"> <argument name="index" value="0"/> </actionGroup> <click selector="{{AdminManageSwatchSection.nthChooseColor('1')}}" stepKey="clickChooseColor"/> - <actionGroup ref="setColorPickerByHex" stepKey="fillFirstHex"> + <actionGroup ref="SetColorPickerByHexActionGroup" stepKey="fillFirstHex"> <argument name="nthColorPicker" value="1"/> <argument name="hexColor" value="e74c3c"/> </actionGroup> <fillField selector="{{AdminManageSwatchSection.adminInputByIndex('0')}}" userInput="red" stepKey="fillFirstAdminField"/> <!-- Set swatch #2 using upload file --> <click selector="{{AdminManageSwatchSection.addSwatch}}" stepKey="clickAddSecondSwatch"/> - <actionGroup ref="openSwatchMenuByIndex" stepKey="clickSwatch2"> + <actionGroup ref="OpenSwatchMenuByIndexActionGroup" stepKey="clickSwatch2"> <argument name="index" value="1"/> </actionGroup> <click selector="{{AdminManageSwatchSection.nthUploadFile('2')}}" stepKey="clickUploadFile2"/> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontConfigurableProductSwatchMinimumPriceTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontConfigurableProductSwatchMinimumPriceTest.xml index 0a98e7a721c17..085aa89210c08 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontConfigurableProductSwatchMinimumPriceTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontConfigurableProductSwatchMinimumPriceTest.xml @@ -126,19 +126,19 @@ </actionGroup> <!--Verify that Black option's minimum price is 16--> - <actionGroup ref="StorefrontAssertSwatchOptionPrice" stepKey="assertMinimumPriceForBlackOption"> + <actionGroup ref="StorefrontAssertSwatchOptionPriceActionGroup" stepKey="assertMinimumPriceForBlackOption"> <argument name="optionName" value="Black"/> <argument name="optionPrice" value="10.00"/> </actionGroup> <!--Verify that White option's minimum price is 16--> - <actionGroup ref="StorefrontAssertSwatchOptionPrice" stepKey="assertMinimumPriceForWhiteOption"> + <actionGroup ref="StorefrontAssertSwatchOptionPriceActionGroup" stepKey="assertMinimumPriceForWhiteOption"> <argument name="optionName" value="White"/> <argument name="optionPrice" value="13.00"/> </actionGroup> <!--Verify that Blue option's minimum price is 16--> - <actionGroup ref="StorefrontAssertSwatchOptionPrice" stepKey="assertMinimumPriceForBlueOption"> + <actionGroup ref="StorefrontAssertSwatchOptionPriceActionGroup" stepKey="assertMinimumPriceForBlueOption"> <argument name="optionName" value="Blue"/> <argument name="optionPrice" value="16.00"/> </actionGroup> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontCustomerCanChangeProductOptionsUsingSwatchesTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontCustomerCanChangeProductOptionsUsingSwatchesTest.xml index f5bcccd4aa9b2..32e447f6463c0 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontCustomerCanChangeProductOptionsUsingSwatchesTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontCustomerCanChangeProductOptionsUsingSwatchesTest.xml @@ -45,7 +45,7 @@ <!-- Go to shopping cart and update option of configurable product --> <amOnPage url="{{CheckoutCartPage.url}}" stepKey="openShoppingCartPage"/> - <actionGroup ref="StorefrontUpdateCartConfigurableProductWithSwatches" stepKey="updateConfigurableProductInTheCart"> + <actionGroup ref="StorefrontUpdateCartConfigurableProductWithSwatchesActionGroup" stepKey="updateConfigurableProductInTheCart"> <argument name="product" value="_defaultProduct"/> <argument name="productOption" value="e74d3c"/> </actionGroup> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml index c9602ddcd127c..adc230335576a 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml @@ -49,7 +49,7 @@ <!-- Set swatch #1 image using file upload --> <click selector="{{AdminManageSwatchSection.addSwatch}}" stepKey="clickAddSwatch1"/> - <actionGroup ref="openSwatchMenuByIndex" stepKey="clickSwatch1"> + <actionGroup ref="OpenSwatchMenuByIndexActionGroup" stepKey="clickSwatch1"> <argument name="index" value="0"/> </actionGroup> <click selector="{{AdminManageSwatchSection.nthUploadFile('1')}}" stepKey="clickUploadFile1"/> @@ -58,7 +58,7 @@ <!-- Set swatch #2 image using the file upload --> <click selector="{{AdminManageSwatchSection.addSwatch}}" stepKey="clickAddSwatch2"/> - <actionGroup ref="openSwatchMenuByIndex" stepKey="clickSwatch2"> + <actionGroup ref="OpenSwatchMenuByIndexActionGroup" stepKey="clickSwatch2"> <argument name="index" value="1"/> </actionGroup> <click selector="{{AdminManageSwatchSection.nthUploadFile('2')}}" stepKey="clickUploadFile2"/> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByVisualSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByVisualSwatchTest.xml index fd38c48919416..2467935795724 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByVisualSwatchTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByVisualSwatchTest.xml @@ -43,11 +43,11 @@ <!-- Set swatch #1 using the color picker --> <click selector="{{AdminManageSwatchSection.addSwatch}}" stepKey="clickAddSwatch1"/> - <actionGroup ref="openSwatchMenuByIndex" stepKey="clickSwatch1"> + <actionGroup ref="OpenSwatchMenuByIndexActionGroup" stepKey="clickSwatch1"> <argument name="index" value="0"/> </actionGroup> <click selector="{{AdminManageSwatchSection.nthChooseColor('1')}}" stepKey="clickChooseColor1"/> - <actionGroup ref="setColorPickerByHex" stepKey="fillHex1"> + <actionGroup ref="SetColorPickerByHexActionGroup" stepKey="fillHex1"> <argument name="nthColorPicker" value="1"/> <argument name="hexColor" value="e74c3c"/> </actionGroup> @@ -55,11 +55,11 @@ <!-- Set swatch #2 using the color picker --> <click selector="{{AdminManageSwatchSection.addSwatch}}" stepKey="clickAddSwatch2"/> - <actionGroup ref="openSwatchMenuByIndex" stepKey="clickSwatch2"> + <actionGroup ref="OpenSwatchMenuByIndexActionGroup" stepKey="clickSwatch2"> <argument name="index" value="1"/> </actionGroup> <click selector="{{AdminManageSwatchSection.nthChooseColor('2')}}" stepKey="clickChooseColor2"/> - <actionGroup ref="setColorPickerByHex" stepKey="fillHex2"> + <actionGroup ref="SetColorPickerByHexActionGroup" stepKey="fillHex2"> <argument name="nthColorPicker" value="2"/> <argument name="hexColor" value="3498db"/> </actionGroup> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSeeProductImagesMatchingProductSwatchesTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSeeProductImagesMatchingProductSwatchesTest.xml index 1717b424e4597..8700cb34a8cdb 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSeeProductImagesMatchingProductSwatchesTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSeeProductImagesMatchingProductSwatchesTest.xml @@ -100,7 +100,7 @@ <actionGroup ref="StorefrontAssertActiveProductImage" stepKey="StorefrontAssertActiveProductImage"/> <!--Click a swatch and expect to see the image from the swatch from the configurable product --> - <actionGroup ref="StorefrontSelectSwatchOptionOnProductPageAndCheckImage" stepKey="clickSwatchOption"> + <actionGroup ref="StorefrontSelectSwatchOptionOnProductPageAndCheckImageActionGroup" stepKey="clickSwatchOption"> <argument name="optionName" value="{{visualSwatchOption1.default_label}}"/> <argument name="fileName" value="{{TestImageAdobe.filename}}"/> </actionGroup> @@ -109,7 +109,7 @@ <argument name="fileName" value="{{TestImageNew.filename}}"/> </actionGroup> - <actionGroup ref="StorefrontSelectSwatchOptionOnProductPageAndCheckImage" stepKey="clickOnSwatchOption2"> + <actionGroup ref="StorefrontSelectSwatchOptionOnProductPageAndCheckImageActionGroup" stepKey="clickOnSwatchOption2"> <argument name="optionName" value="{{visualSwatchOption2.default_label}}"/> <argument name="fileName" value="{{ImageUpload3.filename}}"/> </actionGroup> From a3b18e16acc2baf30e6576bc1c08e84a74192bdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 28 Nov 2019 15:24:57 +0100 Subject: [PATCH 0156/1143] REFACTOR: Extract Action Groups to separate files (according to MFTF best practices) --- ...iveFlatCategoryAndUpdateAsInactiveTest.xml | 4 +- .../AdminCreateInactiveFlatCategoryTest.xml | 4 +- ...inCreateInactiveInMenuFlatCategoryTest.xml | 4 +- ...inUpdateFlatCategoryAndAddProductsTest.xml | 6 +- ...ateFlatCategoryIncludeInNavigationTest.xml | 6 +- ...dateFlatCategoryNameAndDescriptionTest.xml | 6 +- ...rifyDataOverridingOnStoreViewLevelTest.xml | 2 +- ...rifyDataOverridingOnStoreViewLevelTest.xml | 2 +- ...ddCustomWebSiteToStoreGroupActionGroup.xml | 34 ++++++ .../AdminCreateNewStoreGroupActionGroup.xml | 102 ------------------ .../AdminCreateStoreViewActionGroup.xml | 58 ---------- .../AdminCreateStoreViewSaveActionGroup.xml | 20 ++++ ...CreateStoreViewWithoutCheckActionGroup.xml | 19 ++++ .../AdminCreateWebsiteActionGroup.xml | 52 --------- .../AdminDeleteStoreViewActionGroup.xml | 79 -------------- ...dminDeleteStoreViewIfExistsActionGroup.xml | 34 ++++++ .../AdminGetWebsiteIdActionGroup.xml | 28 +++++ .../AdminSearchStoreViewByNameActionGroup.xml | 24 +++++ .../AdminStoreGroupCreateActionGroup.xml | 24 ----- .../AdminSwitchStoreViewActionGroup.xml | 11 +- .../AdminSwitchToAllStoreViewActionGroup.xml | 19 ++++ .../AssertDefaultStoreViewActionGroup.xml | 20 ++++ .../AssertStoreNotInGridActionGroup.xml | 27 +++++ .../AssertStoreViewNotInGridActionGroup.xml | 27 +++++ .../AssertWebsiteFormActionGroup.xml | 27 +++++ .../AssertWebsiteInGridActionGroup.xml | 27 +++++ .../ChangeDefaultStoreViewActionGroup.xml | 26 +++++ .../CreateCustomStoreActionGroup.xml | 32 ++++++ .../CreateCustomStoreViewActionGroup.xml | 22 ---- .../CreateStoreViewActionGroup.xml | 32 ++++++ .../DeleteCustomStoreActionGroup.xml | 39 ------- ...CustomStoreBackupEnabledYesActionGroup.xml | 32 ++++++ ...omStoreViewBackupEnabledYesActionGroup.xml | 34 ++++++ ...reGroupAcceptWarningMessageActionGroup.xml | 2 +- .../ActionGroup/EditStoreGroupActionGroup.xml | 28 +++++ ...oAdminContentManagementPageActionGroup.xml | 19 ++++ .../SaveStoreConfigurationActionGroup.xml | 21 ++++ ...rationAndValidateFieldErrorActionGroup.xml | 28 +++++ ...frontSwitchDefaultStoreViewActionGroup.xml | 19 ++++ .../StorefrontSwitchStoreViewActionGroup.xml | 11 +- ...EnabledVerifyAbsenceOfDeleteButtonTest.xml | 4 +- ...tusEnabledVerifyBackendAndFrontendTest.xml | 4 +- ...NewLocalizedStoreViewStatusEnabledTest.xml | 4 +- ...ithCustomWebsiteAndDefaultCategoryTest.xml | 8 +- ...upWithCustomWebsiteAndRootCategoryTest.xml | 8 +- ...thDefaultWebsiteAndDefaultCategoryTest.xml | 6 +- ...usDisabledVerifyBackendAndFrontendTest.xml | 6 +- ...tusEnabledVerifyBackendAndFrontendTest.xml | 4 +- .../Test/Mftf/Test/AdminCreateWebsiteTest.xml | 4 +- .../Mftf/Test/AdminDeleteStoreGroupTest.xml | 4 +- .../Mftf/Test/AdminDeleteStoreViewTest.xml | 2 +- ...inMoveStoreToOtherGroupSameWebsiteTest.xml | 4 +- ...pAcceptAlertAndVerifyStoreViewFormTest.xml | 4 +- ...teStoreGroupAndVerifyStoreViewFormTest.xml | 4 +- .../Mftf/Test/AdminUpdateStoreViewTest.xml | 4 +- .../Test/Mftf/Test/AdminUpdateWebsiteTest.xml | 8 +- ...dFilterDeleteAndVerifyErrorMessageTest.xml | 4 +- ...SeveralWebsitesAndCheckURLRewritesTest.xml | 4 +- 58 files changed, 640 insertions(+), 457 deletions(-) create mode 100644 app/code/Magento/Store/Test/Mftf/ActionGroup/AdminAddCustomWebSiteToStoreGroupActionGroup.xml create mode 100644 app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateStoreViewSaveActionGroup.xml create mode 100644 app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateStoreViewWithoutCheckActionGroup.xml create mode 100644 app/code/Magento/Store/Test/Mftf/ActionGroup/AdminDeleteStoreViewIfExistsActionGroup.xml create mode 100644 app/code/Magento/Store/Test/Mftf/ActionGroup/AdminGetWebsiteIdActionGroup.xml create mode 100644 app/code/Magento/Store/Test/Mftf/ActionGroup/AdminSearchStoreViewByNameActionGroup.xml create mode 100644 app/code/Magento/Store/Test/Mftf/ActionGroup/AdminSwitchToAllStoreViewActionGroup.xml create mode 100644 app/code/Magento/Store/Test/Mftf/ActionGroup/AssertDefaultStoreViewActionGroup.xml create mode 100644 app/code/Magento/Store/Test/Mftf/ActionGroup/AssertStoreNotInGridActionGroup.xml create mode 100644 app/code/Magento/Store/Test/Mftf/ActionGroup/AssertStoreViewNotInGridActionGroup.xml create mode 100644 app/code/Magento/Store/Test/Mftf/ActionGroup/AssertWebsiteFormActionGroup.xml create mode 100644 app/code/Magento/Store/Test/Mftf/ActionGroup/AssertWebsiteInGridActionGroup.xml create mode 100644 app/code/Magento/Store/Test/Mftf/ActionGroup/ChangeDefaultStoreViewActionGroup.xml create mode 100644 app/code/Magento/Store/Test/Mftf/ActionGroup/CreateCustomStoreActionGroup.xml create mode 100644 app/code/Magento/Store/Test/Mftf/ActionGroup/CreateStoreViewActionGroup.xml create mode 100644 app/code/Magento/Store/Test/Mftf/ActionGroup/DeleteCustomStoreBackupEnabledYesActionGroup.xml create mode 100644 app/code/Magento/Store/Test/Mftf/ActionGroup/DeleteCustomStoreViewBackupEnabledYesActionGroup.xml create mode 100644 app/code/Magento/Store/Test/Mftf/ActionGroup/EditStoreGroupActionGroup.xml create mode 100644 app/code/Magento/Store/Test/Mftf/ActionGroup/NavigateToAdminContentManagementPageActionGroup.xml create mode 100644 app/code/Magento/Store/Test/Mftf/ActionGroup/SaveStoreConfigurationActionGroup.xml create mode 100644 app/code/Magento/Store/Test/Mftf/ActionGroup/SaveStoreConfigurationAndValidateFieldErrorActionGroup.xml create mode 100644 app/code/Magento/Store/Test/Mftf/ActionGroup/StorefrontSwitchDefaultStoreViewActionGroup.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveFlatCategoryAndUpdateAsInactiveTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveFlatCategoryAndUpdateAsInactiveTest.xml index 21b3dba7140c0..b0e6fe87be918 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveFlatCategoryAndUpdateAsInactiveTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveFlatCategoryAndUpdateAsInactiveTest.xml @@ -23,11 +23,11 @@ <!--Create category--> <createData entity="CatNotActive" stepKey="createCategory"/> <!-- Create First StoreView --> - <actionGroup ref="CreateStoreView" stepKey="createCustomStoreViewEn"> + <actionGroup ref="CreateStoreViewActionGroup" stepKey="createCustomStoreViewEn"> <argument name="storeView" value="customStoreEN"/> </actionGroup> <!-- Create Second StoreView --> - <actionGroup ref="CreateStoreView" stepKey="createCustomStoreViewFr"> + <actionGroup ref="CreateStoreViewActionGroup" stepKey="createCustomStoreViewFr"> <argument name="storeView" value="customStoreFR"/> </actionGroup> <!--Run full reindex and clear caches --> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveFlatCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveFlatCategoryTest.xml index aa3dba85dfadf..7de37b9cb77ef 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveFlatCategoryTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveFlatCategoryTest.xml @@ -23,11 +23,11 @@ <!--Create category--> <createData entity="SimpleSubCategory" stepKey="createCategory"/> <!-- Create First StoreView --> - <actionGroup ref="CreateStoreView" stepKey="createCustomStoreViewEn"> + <actionGroup ref="CreateStoreViewActionGroup" stepKey="createCustomStoreViewEn"> <argument name="storeView" value="customStoreEN"/> </actionGroup> <!-- Create Second StoreView --> - <actionGroup ref="CreateStoreView" stepKey="createCustomStoreViewFr"> + <actionGroup ref="CreateStoreViewActionGroup" stepKey="createCustomStoreViewFr"> <argument name="storeView" value="customStoreFR"/> </actionGroup> <!--Run full reindex and clear caches --> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveInMenuFlatCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveInMenuFlatCategoryTest.xml index 37417cd7fdb85..c7aba1fe8376f 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveInMenuFlatCategoryTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveInMenuFlatCategoryTest.xml @@ -23,11 +23,11 @@ <!--Create category--> <createData entity="SimpleSubCategory" stepKey="category"/> <!-- Create First StoreView --> - <actionGroup ref="CreateStoreView" stepKey="createCustomStoreViewEn"> + <actionGroup ref="CreateStoreViewActionGroup" stepKey="createCustomStoreViewEn"> <argument name="storeView" value="customStoreEN"/> </actionGroup> <!-- Create Second StoreView --> - <actionGroup ref="CreateStoreView" stepKey="createCustomStoreViewFr"> + <actionGroup ref="CreateStoreViewActionGroup" stepKey="createCustomStoreViewFr"> <argument name="storeView" value="customStoreFR"/> </actionGroup> <!--Run full reindex and clear caches --> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryAndAddProductsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryAndAddProductsTest.xml index 8872ea98eb504..cebf67ae2ebcf 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryAndAddProductsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryAndAddProductsTest.xml @@ -24,11 +24,11 @@ <!-- Create category --> <createData entity="defaultSimpleProduct" stepKey="createSimpleProduct"/> <!-- Create First StoreView --> - <actionGroup ref="CreateStoreView" stepKey="createCustomStoreViewEn"> + <actionGroup ref="CreateStoreViewActionGroup" stepKey="createCustomStoreViewEn"> <argument name="storeView" value="customStoreEN"/> </actionGroup> <!-- Create Second StoreView --> - <actionGroup ref="CreateStoreView" stepKey="createCustomStoreViewFr"> + <actionGroup ref="CreateStoreViewActionGroup" stepKey="createCustomStoreViewFr"> <argument name="storeView" value="customStoreFR"/> </actionGroup> <!--Run full reindex and clear caches --> @@ -100,4 +100,4 @@ <seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName($$category.name$$)}}" stepKey="seeCategoryOnNavigation1"/> <see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{defaultSimpleProduct.name}}" stepKey="seeProductName"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryIncludeInNavigationTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryIncludeInNavigationTest.xml index 5527303370623..d7ce22bdc0097 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryIncludeInNavigationTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryIncludeInNavigationTest.xml @@ -22,11 +22,11 @@ <!--Create category--> <createData entity="CatNotIncludeInMenu" stepKey="createCategory"/> <!-- Create First StoreView --> - <actionGroup ref="CreateStoreView" stepKey="createCustomStoreViewEn"> + <actionGroup ref="CreateStoreViewActionGroup" stepKey="createCustomStoreViewEn"> <argument name="storeView" value="customStoreEN"/> </actionGroup> <!-- Create Second StoreView --> - <actionGroup ref="CreateStoreView" stepKey="createCustomStoreViewFr"> + <actionGroup ref="CreateStoreViewActionGroup" stepKey="createCustomStoreViewFr"> <argument name="storeView" value="customStoreFR"/> </actionGroup> <!--Run full reindex and clear caches --> @@ -88,4 +88,4 @@ <waitForPageLoad stepKey="waitForSecondstoreView"/> <seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="seeCategoryOnNavigation1"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryNameAndDescriptionTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryNameAndDescriptionTest.xml index fcbc0cb205268..2b14973d6ce32 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryNameAndDescriptionTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryNameAndDescriptionTest.xml @@ -23,11 +23,11 @@ <!--Create category--> <createData entity="_defaultCategory" stepKey="createCategory"/> <!-- Create First StoreView --> - <actionGroup ref="CreateStoreView" stepKey="createCustomStoreViewEn"> + <actionGroup ref="CreateStoreViewActionGroup" stepKey="createCustomStoreViewEn"> <argument name="storeView" value="customStoreEN"/> </actionGroup> <!-- Create Second StoreView --> - <actionGroup ref="CreateStoreView" stepKey="createCustomStoreViewFr"> + <actionGroup ref="CreateStoreViewActionGroup" stepKey="createCustomStoreViewFr"> <argument name="storeView" value="customStoreFR"/> </actionGroup> <!--Run full reindex and clear caches --> @@ -99,4 +99,4 @@ <click selector="{{AdminCategoryContentSection.sectionHeader}}" stepKey="selectContent1"/> <seeInField selector="{{AdminCategoryContentSection.description}}" userInput="Updated category Description Fields" stepKey="seeUpdatedDescription"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductNameToVerifyDataOverridingOnStoreViewLevelTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductNameToVerifyDataOverridingOnStoreViewLevelTest.xml index 80f0c8ad10ede..6f84ab06c407e 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductNameToVerifyDataOverridingOnStoreViewLevelTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductNameToVerifyDataOverridingOnStoreViewLevelTest.xml @@ -20,7 +20,7 @@ </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - <actionGroup ref="CreateStoreView" stepKey="createCustomStoreViewFr"> + <actionGroup ref="CreateStoreViewActionGroup" stepKey="createCustomStoreViewFr"> <argument name="storeView" value="customStoreFR"/> </actionGroup> <createData entity="SimpleSubCategory" stepKey="initialCategoryEntity"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductPriceToVerifyDataOverridingOnStoreViewLevelTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductPriceToVerifyDataOverridingOnStoreViewLevelTest.xml index f698b3d89ffe9..f65ee96c94b40 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductPriceToVerifyDataOverridingOnStoreViewLevelTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductPriceToVerifyDataOverridingOnStoreViewLevelTest.xml @@ -20,7 +20,7 @@ </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - <actionGroup ref="CreateStoreView" stepKey="createCustomStoreViewFr"> + <actionGroup ref="CreateStoreViewActionGroup" stepKey="createCustomStoreViewFr"> <argument name="storeView" value="customStoreFR"/> </actionGroup> <createData entity="SimpleSubCategory" stepKey="initialCategoryEntity"/> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminAddCustomWebSiteToStoreGroupActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminAddCustomWebSiteToStoreGroupActionGroup.xml new file mode 100644 index 0000000000000..cee37d22e7970 --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminAddCustomWebSiteToStoreGroupActionGroup.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAddCustomWebSiteToStoreGroupActionGroup"> + <annotations> + <description>Goes to the Admin Stores grid page. Searches the grid for the provided Store Group. Edits the Store. Adds the provided Website to the Store. Clicks on Save. Validates that the Success Message is present and correct.</description> + </annotations> + <arguments> + <argument name="storeGroup" defaultValue="customStoreGroup"/> + <argument name="website" defaultValue="customWebsite"/> + </arguments> + + <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> + <click selector="{{AdminStoresGridSection.resetButton}}" stepKey="resetSearchFilter"/> + <fillField userInput="{{storeGroup.name}}" selector="{{AdminStoresGridSection.storeGrpFilterTextField}}" stepKey="fillSearchStoreGroupField"/> + <click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearchButton"/> + <see userInput="{{storeGroup.name}}" selector="{{AdminStoresGridSection.storeGrpNameInFirstRow}}" stepKey="verifyThatCorrectStoreGroupFound"/> + <click selector="{{AdminStoresGridSection.storeGrpNameInFirstRow}}" stepKey="clickEditExistingStoreRow"/> + <waitForPageLoad stepKey="waitForStoreGroupPageLoad"/> + <selectOption selector="{{AdminNewStoreGroupSection.storeGrpWebsiteDropdown}}" userInput="{{website.name}}" stepKey="selectWebsite"/> + <selectOption selector="{{AdminNewStoreGroupSection.storeRootCategoryDropdown}}" userInput="Default Category" stepKey="chooseRootCategory"/> + <click selector="{{AdminNewStoreGroupActionsSection.saveButton}}" stepKey="clickSaveStoreGroup"/> + <conditionalClick selector="{{AdminNewStoreGroupSection.acceptNewStoreGroupCreation}}" dependentSelector="{{AdminNewStoreGroupSection.acceptNewStoreGroupCreation}}" visible="true" stepKey="clickAcceptNewStoreGroupCreationButton"/> + <waitForElementVisible selector="{{AdminStoresGridSection.storeFilterTextField}}" stepKey="waitForPageReload"/> + <see userInput="You saved the store." stepKey="seeSavedMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateNewStoreGroupActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateNewStoreGroupActionGroup.xml index 4c00071da6b61..f1071f2743683 100644 --- a/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateNewStoreGroupActionGroup.xml +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateNewStoreGroupActionGroup.xml @@ -31,106 +31,4 @@ <waitForElementVisible selector="{{AdminStoresGridSection.storeGrpFilterTextField}}" stepKey="waitForStoreGridReload"/> <see userInput="You saved the store." stepKey="seeSavedMessage"/> </actionGroup> - - <actionGroup name="CreateCustomStore"> - <annotations> - <description>Goes to the Admin Stores grid page. Clicks on 'Create Store'. Fills in the provided Details (Website, Store Group Name and Store Group Code). Clicks on Save. Validates that the Success Message is present and correct.</description> - </annotations> - <arguments> - <argument name="website" type="string"/> - <argument name="store" type="string"/> - <argument name="rootCategory" type="string"/> - </arguments> - - <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> - <waitForPageLoad stepKey="waitForSystemStorePage"/> - <click selector="{{AdminStoresMainActionsSection.createStoreButton}}" stepKey="selectCreateStore"/> - <selectOption userInput="{{website}}" selector="{{AdminNewStoreGroupSection.storeGrpWebsiteDropdown}}" stepKey="selectMainWebsite"/> - <fillField userInput="{{store}}" selector="{{AdminNewStoreGroupSection.storeGrpNameTextField}}" stepKey="fillStoreName"/> - <fillField userInput="{{store}}" selector="{{AdminNewStoreGroupSection.storeGrpCodeTextField}}" stepKey="fillStoreCode"/> - <selectOption userInput="{{rootCategory}}" selector="{{AdminNewStoreGroupSection.storeRootCategoryDropdown}}" stepKey="selectStoreStatus"/> - <click selector="{{AdminStoreGroupActionsSection.saveButton}}" stepKey="clickSaveStoreGroup"/> - <waitForElementVisible selector="{{AdminStoresGridSection.storeGrpFilterTextField}}" stepKey="waitForStoreGridReload"/> - <see userInput="You saved the store." stepKey="seeSavedMessage"/> - </actionGroup> - - <actionGroup name="AssertStoreGroupInGrid"> - <annotations> - <description>Goes to the Admin Stores grid page. Searches for the provided Store Group Name. Validates that the provided Store Group Name is present in the grid.</description> - </annotations> - <arguments> - <argument name="storeGroupName" type="string"/> - </arguments> - - <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> - <waitForPageLoad stepKey="waitForAdminSystemStorePageLoad"/> - <click selector="{{AdminStoresGridSection.resetButton}}" stepKey="resetSearchFilter"/> - <fillField userInput="{{storeGroupName}}" selector="{{AdminStoresGridSection.storeGrpFilterTextField}}" stepKey="fillSearchStoreGroupField"/> - <click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearchButton"/> - <waitForPageLoad stepKey="waitForStoreToLoad"/> - <see selector="{{AdminStoresGridSection.nthRow('1')}}" userInput="{{storeGroupName}}" stepKey="seeAssertStoreGroupInGridMessage"/> - </actionGroup> - - <actionGroup name="EditStoreGroupActionGroup"> - <annotations> - <description>Edit store group.</description> - </annotations> - <arguments> - <argument name="storeGroupName" type="string"/> - </arguments> - <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> - <waitForPageLoad stepKey="waitForAdminSystemStorePageLoad"/> - <click selector="{{AdminStoresGridSection.resetButton}}" stepKey="resetSearchFilter"/> - <waitForPageLoad stepKey="waitForResetResult"/> - <fillField userInput="{{storeGroupName}}" selector="{{AdminStoresGridSection.storeGrpFilterTextField}}" stepKey="fillStoreGroupFilter"/> - <click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearchButton"/> - <waitForPageLoad stepKey="waitForSearchResult"/> - <click selector="{{AdminStoresGridSection.storeGrpNameInFirstRow}}" stepKey="clicksStoreGroupName"/> - <waitForPageLoad stepKey="waitForStorePageToLoad"/> - </actionGroup> - - <actionGroup name="ChangeDefaultStoreViewActionGroup" extends="EditStoreGroupActionGroup"> - <annotations> - <description>Change the default store view for provided store group.</description> - </annotations> - <arguments> - <argument name="storeViewName" type="string"/> - </arguments> - <selectOption selector="{{AdminEditStoreGroupSection.defaultStoreView}}" userInput="{{storeViewName}}" stepKey="changeDefaultStoreView" after="waitForStorePageToLoad"/> - <click selector="{{AdminStoreGroupActionsSection.saveButton}}" stepKey="clickSaveStoreGroup"/> - <waitForElementVisible selector="{{AdminConfirmationModalSection.ok}}" stepKey="waitForModal"/> - <see selector="{{AdminConfirmationModalSection.title}}" userInput="Warning message" stepKey="seeWarningAboutTakingALongTimeToComplete"/> - <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmModal"/> - <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="seeForSuccessMessage"/> - <see selector="{{AdminMessagesSection.success}}" userInput="You saved the store." stepKey="seeSuccessMessage"/> - </actionGroup> - - <actionGroup name="AssertDefaultStoreViewActionGroup" extends="EditStoreGroupActionGroup"> - <annotations> - <description>Asserts that the provided store view is default in provided store group.</description> - </annotations> - <arguments> - <argument name="storeViewName" type="string"/> - </arguments> - <seeOptionIsSelected selector="{{AdminEditStoreGroupSection.defaultStoreView}}" userInput="{{storeViewName}}" stepKey="assertDefaultStoreView" after="waitForStorePageToLoad"/> - </actionGroup> - - <actionGroup name="AssertStoreGroupForm"> - <annotations> - <description>Clicks on the 1st Store in the 'Stores' grid. Validates that the provided Details (Website, Store Group Name, Store Group Code and Root Category) are present and correct.</description> - </annotations> - <arguments> - <argument name="website" type="string"/> - <argument name="storeGroupName" type="string"/> - <argument name="storeGroupCode" type="string"/> - <argument name="rootCategory" type="string"/> - </arguments> - - <click selector="{{AdminStoresGridSection.storeGrpNameInFirstRow}}" stepKey="clickEditExistingStoreRow"/> - <waitForPageLoad stepKey="waitTillAdminSystemStoreGroupPage"/> - <seeInField selector="{{AdminNewStoreGroupSection.storeGrpWebsiteDropdown}}" userInput="{{website}}" stepKey="seeAssertWebsite"/> - <seeInField selector="{{AdminNewStoreGroupSection.storeGrpNameTextField}}" userInput="{{storeGroupName}}" stepKey="seeAssertStoreGroupName"/> - <seeInField selector="{{AdminNewStoreGroupSection.storeGrpCodeTextField}}" userInput="{{storeGroupCode}}" stepKey="seeAssertStoreGroupCode"/> - <seeInField selector="{{AdminNewStoreGroupSection.storeRootCategoryDropdown}}" userInput="{{rootCategory}}" stepKey="seeAssertRootCategory"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateStoreViewActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateStoreViewActionGroup.xml index 0faf93d4bde14..7df225368779b 100644 --- a/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateStoreViewActionGroup.xml +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateStoreViewActionGroup.xml @@ -33,62 +33,4 @@ <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForPageReload"/> <see selector="{{AdminMessagesSection.success}}" userInput="You saved the store view." stepKey="seeSavedMessage"/> </actionGroup> - - <actionGroup name="AdminCreateStoreViewWithoutCheckActionGroup" extends="AdminCreateStoreViewActionGroup"> - <annotations> - <description>EXTENDS: AdminCreateStoreViewActionGroup. Removes 'waitForPageReload' and 'seeSavedMessage'.</description> - </annotations> - - <remove keyForRemoval="waitForPageReload"/> - <remove keyForRemoval="seeSavedMessage"/> - </actionGroup> - - <!--Save the Store view--> - <actionGroup name="AdminCreateStoreViewActionSaveGroup"> - <annotations> - <description>Validates that the Success Message is present and correct.</description> - </annotations> - - <waitForLoadingMaskToDisappear stepKey="waitForGridLoad"/> - <waitForElementVisible selector="{{AdminStoresGridSection.websiteFilterTextField}}" stepKey="waitForStoreGridToReload2"/> - <see userInput="You saved the store view." stepKey="seeSavedMessage"/> - </actionGroup> - - <actionGroup name="navigateToAdminContentManagementPage"> - <annotations> - <description>Goes to the 'Configuration' page for 'Content Management'.</description> - </annotations> - - <amOnPage url="{{AdminContentManagementPage.url}}" stepKey="navigateToConfigurationPage"/> - <waitForPageLoad stepKey="waitForPageLoad1"/> - </actionGroup> - - <actionGroup name="saveStoreConfiguration"> - <annotations> - <description>Clicks on the Save button.</description> - </annotations> - - <comment userInput="saveStoreConfiguration" stepKey="comment"/> - <waitForElementVisible selector="{{StoreConfigSection.Save}}" stepKey="waitForSaveButton"/> - <click selector="{{StoreConfigSection.Save}}" stepKey="clickSaveButton"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - </actionGroup> - - <actionGroup name="saveStoreConfigurationAndValidateFieldError"> - <annotations> - <description>Clicks on Save. Validates that the fields are required.</description> - </annotations> - <arguments> - <argument name="inputFieldError" type="string"/> - <argument name="errorMessageSelector" type="string"/> - <argument name="errorMessage" type="string"/> - </arguments> - - <comment userInput="saveStoreConfigurationAndValidateFieldError" stepKey="comment"/> - <waitForElementVisible selector="{{StoreConfigSection.Save}}" stepKey="waitForSaveButton"/> - <click selector="{{StoreConfigSection.Save}}" stepKey="clickSaveButton"/> - <waitForElement selector="{{inputFieldError}}" stepKey="waitForErrorField"/> - <waitForElementVisible selector="{{errorMessageSelector}}" stepKey="waitForErrorMessage"/> - <see selector="{{errorMessageSelector}}" userInput="{{errorMessage}}" stepKey="seeErrorMessage"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateStoreViewSaveActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateStoreViewSaveActionGroup.xml new file mode 100644 index 0000000000000..0d1a2bd5319df --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateStoreViewSaveActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateStoreViewSaveActionGroup"> + <annotations> + <description>Validates that the Success Message is present and correct.</description> + </annotations> + + <waitForLoadingMaskToDisappear stepKey="waitForGridLoad"/> + <waitForElementVisible selector="{{AdminStoresGridSection.websiteFilterTextField}}" stepKey="waitForStoreGridToReload2"/> + <see userInput="You saved the store view." stepKey="seeSavedMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateStoreViewWithoutCheckActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateStoreViewWithoutCheckActionGroup.xml new file mode 100644 index 0000000000000..c6837dc55b34e --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateStoreViewWithoutCheckActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateStoreViewWithoutCheckActionGroup" extends="AdminCreateStoreViewActionGroup"> + <annotations> + <description>EXTENDS: AdminCreateStoreViewActionGroup. Removes 'waitForPageReload' and 'seeSavedMessage'.</description> + </annotations> + + <remove keyForRemoval="waitForPageReload"/> + <remove keyForRemoval="seeSavedMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateWebsiteActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateWebsiteActionGroup.xml index 6a2f601754c41..19be38d130ace 100644 --- a/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateWebsiteActionGroup.xml +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateWebsiteActionGroup.xml @@ -28,56 +28,4 @@ <waitForElementVisible selector="{{AdminStoresGridSection.websiteFilterTextField}}" stepKey="waitForStoreGridToReload"/> <see userInput="You saved the website." stepKey="seeSavedMessage"/> </actionGroup> - - <actionGroup name="AdminGetWebsiteIdActionGroup"> - <!--Get Website_id--> - <annotations> - <description>Goes to the Admin Stores grid page. Filters the grid for the provided Website. Grabs the Website ID from the URL.</description> - </annotations> - <arguments> - <argument name="website"/> - </arguments> - - <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnTheStorePage"/> - <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickClearFilters"/> - <fillField selector="{{AdminStoresGridSection.websiteFilterTextField}}" userInput="{{website.name}}" stepKey="fillSearchWebsiteField"/> - <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickApplyFilters"/> - <see selector="{{AdminStoresGridSection.websiteNameInFirstRow}}" userInput="{{website.name}}" stepKey="verifyThatCorrectWebsiteFound"/> - <click selector="{{AdminStoresGridSection.websiteNameInFirstRow}}" stepKey="clickEditExistingWebsite"/> - <grabFromCurrentUrl regex="~(\d+)/~" stepKey="grabFromCurrentUrl"/> - </actionGroup> - - <actionGroup name="AssertWebsiteInGrid"> - <annotations> - <description>Goes to the Admin Stores grid page. Searches the grid for the provided Website Name. Validates that the Website appears in the grid.</description> - </annotations> - <arguments> - <argument name="websiteName" type="string"/> - </arguments> - - <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> - <waitForPageLoad stepKey="waitForAdminSystemStorePageLoad"/> - <click selector="{{AdminStoresGridSection.resetButton}}" stepKey="resetSearchFilter"/> - <fillField userInput="{{websiteName}}" selector="{{AdminStoresGridSection.websiteFilterTextField}}" stepKey="fillWebsiteField"/> - <click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearchButton"/> - <waitForPageLoad stepKey="waitForStoreToLoad"/> - <seeElement selector="{{AdminStoresGridSection.websiteName(websiteName)}}" stepKey="seeAssertWebsiteInGrid"/> - </actionGroup> - - <actionGroup name="AssertWebsiteForm"> - <annotations> - <description>Clicks on the provided Website Name in the Admin Stores grid. Validates that the URL, Website Name/Code are present and correct.</description> - </annotations> - <arguments> - <argument name="websiteName" type="string"/> - <argument name="websiteCode" type="string"/> - </arguments> - - <click selector="{{AdminStoresGridSection.websiteName(websiteName)}}" stepKey="clickWebsiteFirstRowInGrid"/> - <waitForPageLoad stepKey="waitTillWebsiteFormPageIsOpened"/> - <grabFromCurrentUrl regex="~(\d+)/~" stepKey="grabWebsiteIdFromCurrentUrl"/> - <seeInCurrentUrl url="/system_store/editWebsite/website_id/{$grabWebsiteIdFromCurrentUrl}" stepKey="seeWebsiteId"/> - <seeInField selector="{{AdminNewWebsiteSection.name}}" userInput="{{websiteName}}" stepKey="seeAssertWebsiteName"/> - <seeInField selector="{{AdminNewWebsiteSection.code}}" userInput="{{websiteCode}}" stepKey="seeAssertWebsiteCode"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminDeleteStoreViewActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminDeleteStoreViewActionGroup.xml index 7ac300e3ab804..520a80bcbc328 100644 --- a/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminDeleteStoreViewActionGroup.xml +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminDeleteStoreViewActionGroup.xml @@ -32,83 +32,4 @@ <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitSuccessMessageAppears"/> <see selector="{{AdminMessagesSection.success}}" userInput="You deleted the store view." stepKey="seeDeleteMessage"/> </actionGroup> - - <actionGroup name="DeleteCustomStoreViewBackupEnabledYesActionGroup"> - <annotations> - <description>Goes to the Admin Stores grid page. Deleted the provided Store while creating a Backup. Validates that the Success Messages (Delete/Backup) are present and correct.</description> - </annotations> - <arguments> - <argument name="storeViewName" type="string"/> - </arguments> - - <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> - <click selector="{{AdminStoresGridSection.resetButton}}" stepKey="resetSearchFilter"/> - <fillField userInput="{{storeViewName}}" selector="{{AdminStoresGridSection.storeFilterTextField}}" stepKey="fillSearchStoreViewField"/> - <click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearchButton"/> - <click selector="{{AdminStoresGridSection.storeNameInFirstRow}}" stepKey="clickEditExistingStoreViewRow"/> - <waitForPageLoad stepKey="waitForStoreToLoad"/> - <click selector="{{AdminNewStoreViewActionsSection.delete}}" stepKey="clickDeleteStoreViewButtonOnEditStorePage"/> - <selectOption userInput="Yes" selector="{{AdminStoreBackupOptionsSection.createBackupSelect}}" stepKey="setCreateDbBackupToYes"/> - <click selector="{{AdminNewStoreViewActionsSection.delete}}" stepKey="clickDeleteStoreViewButtonOnDeleteStorePage"/> - <waitForElementVisible selector="{{AdminConfirmationModalSection.title}}" stepKey="waitingForWarningModal"/> - <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmStoreViewDelete"/> - <waitForPageLoad stepKey="waitForSuccessMessage"/> - <see selector="{{AdminStoresGridSection.successMessage}}" userInput="The database was backed up." stepKey="seeAssertDatabaseBackedUpMessage"/> - <see selector="{{AdminStoresGridSection.successMessage}}" userInput="You deleted the store view." stepKey="seeAssertSuccessDeleteStoreViewMessage"/> - </actionGroup> - - <actionGroup name="AssertStoreViewNotInGrid"> - <annotations> - <description>Goes to the Admin Stores grid page. Searches the grid for the provided Store View name. Validates that it does NOT appear in the grid.</description> - </annotations> - <arguments> - <argument name="storeViewName" type="string"/> - </arguments> - - <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> - <waitForPageLoad stepKey="waitForAdminSystemStorePageLoad"/> - <click selector="{{AdminStoresGridSection.resetButton}}" stepKey="resetSearchFilter"/> - <fillField userInput="{{storeViewName}}" selector="{{AdminStoresGridSection.storeFilterTextField}}" stepKey="fillSearchStoreViewField"/> - <click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearchButton"/> - <waitForPageLoad stepKey="waitForStoreToLoad"/> - <see selector="{{AdminStoresGridSection.emptyText}}" userInput="We couldn't find any records." stepKey="seeAssertStoreViewNotInGridMessage"/> - </actionGroup> - - <actionGroup name="AdminSearchStoreViewByNameActionGroup"> - <annotations> - <description>Goes to the Admin Stores grid page. Clears filters and search by store view name.</description> - </annotations> - <arguments> - <argument name="storeViewName" type="string"/> - </arguments> - - <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> - <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="resetSearchFilter"/> - <fillField selector="{{AdminStoresGridSection.storeFilterTextField}}" userInput="{{storeViewName}}" stepKey="fillSearchStoreViewField"/> - <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickSearchButton"/> - </actionGroup> - - <actionGroup name="AdminDeleteStoreViewIfExistsActionGroup" extends="AdminSearchStoreViewByNameActionGroup"> - <annotations> - <description>EXTENDS: AdminSearchStoreViewByNameActionGroup. Goes to the Admin Stores grid page. Deletes the provided Store (if exists) without creating a Backup. Validates that the Success Message is present and correct.</description> - </annotations> - - <executeInSelenium function="function($webdriver) use ($I) { - $items = $webdriver->findElements(\Facebook\WebDriver\WebDriverBy::cssSelector('.col-store_title>a')); - if(!empty($items)) { - $I->click('.col-store_title>a'); - $I->waitForPageLoad(10); - $I->click('#delete'); - $I->waitForPageLoad(30); - $I->selectOption('select#store_create_backup', 'No'); - $I->click('#delete'); - $I->waitForPageLoad(30); - $I->waitForElementVisible('aside.confirm .modal-title', 10); - $I->click('aside.confirm .modal-footer button.action-accept'); - $I->waitForPageLoad(60); - $I->waitForElementVisible('#messages div.message-success', 10); - $I->see('You deleted the store view.', '#messages div.message-success'); - } - }" after="clickSearchButton" stepKey="deleteStoreViewIfExists"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminDeleteStoreViewIfExistsActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminDeleteStoreViewIfExistsActionGroup.xml new file mode 100644 index 0000000000000..6ebf72a893c04 --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminDeleteStoreViewIfExistsActionGroup.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminDeleteStoreViewIfExistsActionGroup" extends="AdminSearchStoreViewByNameActionGroup"> + <annotations> + <description>EXTENDS: AdminSearchStoreViewByNameActionGroup. Goes to the Admin Stores grid page. Deletes the provided Store (if exists) without creating a Backup. Validates that the Success Message is present and correct.</description> + </annotations> + + <executeInSelenium function="function($webdriver) use ($I) { + $items = $webdriver->findElements(\Facebook\WebDriver\WebDriverBy::cssSelector('.col-store_title>a')); + if(!empty($items)) { + $I->click('.col-store_title>a'); + $I->waitForPageLoad(10); + $I->click('#delete'); + $I->waitForPageLoad(30); + $I->selectOption('select#store_create_backup', 'No'); + $I->click('#delete'); + $I->waitForPageLoad(30); + $I->waitForElementVisible('aside.confirm .modal-title', 10); + $I->click('aside.confirm .modal-footer button.action-accept'); + $I->waitForPageLoad(60); + $I->waitForElementVisible('#messages div.message-success', 10); + $I->see('You deleted the store view.', '#messages div.message-success'); + } + }" after="clickSearchButton" stepKey="deleteStoreViewIfExists"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminGetWebsiteIdActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminGetWebsiteIdActionGroup.xml new file mode 100644 index 0000000000000..9e58643981506 --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminGetWebsiteIdActionGroup.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminGetWebsiteIdActionGroup"> + <!--Get Website_id--> + <annotations> + <description>Goes to the Admin Stores grid page. Filters the grid for the provided Website. Grabs the Website ID from the URL.</description> + </annotations> + <arguments> + <argument name="website"/> + </arguments> + + <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnTheStorePage"/> + <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickClearFilters"/> + <fillField selector="{{AdminStoresGridSection.websiteFilterTextField}}" userInput="{{website.name}}" stepKey="fillSearchWebsiteField"/> + <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickApplyFilters"/> + <see selector="{{AdminStoresGridSection.websiteNameInFirstRow}}" userInput="{{website.name}}" stepKey="verifyThatCorrectWebsiteFound"/> + <click selector="{{AdminStoresGridSection.websiteNameInFirstRow}}" stepKey="clickEditExistingWebsite"/> + <grabFromCurrentUrl regex="~(\d+)/~" stepKey="grabFromCurrentUrl"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminSearchStoreViewByNameActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminSearchStoreViewByNameActionGroup.xml new file mode 100644 index 0000000000000..cb8c798a7eaed --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminSearchStoreViewByNameActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminSearchStoreViewByNameActionGroup"> + <annotations> + <description>Goes to the Admin Stores grid page. Clears filters and search by store view name.</description> + </annotations> + <arguments> + <argument name="storeViewName" type="string"/> + </arguments> + + <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> + <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="resetSearchFilter"/> + <fillField selector="{{AdminStoresGridSection.storeFilterTextField}}" userInput="{{storeViewName}}" stepKey="fillSearchStoreViewField"/> + <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickSearchButton"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminStoreGroupCreateActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminStoreGroupCreateActionGroup.xml index 8afa8df4a5e3d..4da1208717f90 100644 --- a/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminStoreGroupCreateActionGroup.xml +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminStoreGroupCreateActionGroup.xml @@ -28,28 +28,4 @@ <waitForElementVisible selector="{{AdminStoresGridSection.storeFilterTextField}}" stepKey="waitForPageReload"/> <see userInput="You saved the store." stepKey="seeSavedMessage"/> </actionGroup> - - <actionGroup name="AdminAddCustomWebSiteToStoreGroup"> - <annotations> - <description>Goes to the Admin Stores grid page. Searches the grid for the provided Store Group. Edits the Store. Adds the provided Website to the Store. Clicks on Save. Validates that the Success Message is present and correct.</description> - </annotations> - <arguments> - <argument name="storeGroup" defaultValue="customStoreGroup"/> - <argument name="website" defaultValue="customWebsite"/> - </arguments> - - <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> - <click selector="{{AdminStoresGridSection.resetButton}}" stepKey="resetSearchFilter"/> - <fillField userInput="{{storeGroup.name}}" selector="{{AdminStoresGridSection.storeGrpFilterTextField}}" stepKey="fillSearchStoreGroupField"/> - <click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearchButton"/> - <see userInput="{{storeGroup.name}}" selector="{{AdminStoresGridSection.storeGrpNameInFirstRow}}" stepKey="verifyThatCorrectStoreGroupFound"/> - <click selector="{{AdminStoresGridSection.storeGrpNameInFirstRow}}" stepKey="clickEditExistingStoreRow"/> - <waitForPageLoad stepKey="waitForStoreGroupPageLoad"/> - <selectOption selector="{{AdminNewStoreGroupSection.storeGrpWebsiteDropdown}}" userInput="{{website.name}}" stepKey="selectWebsite"/> - <selectOption selector="{{AdminNewStoreGroupSection.storeRootCategoryDropdown}}" userInput="Default Category" stepKey="chooseRootCategory"/> - <click selector="{{AdminNewStoreGroupActionsSection.saveButton}}" stepKey="clickSaveStoreGroup"/> - <conditionalClick selector="{{AdminNewStoreGroupSection.acceptNewStoreGroupCreation}}" dependentSelector="{{AdminNewStoreGroupSection.acceptNewStoreGroupCreation}}" visible="true" stepKey="clickAcceptNewStoreGroupCreationButton"/> - <waitForElementVisible selector="{{AdminStoresGridSection.storeFilterTextField}}" stepKey="waitForPageReload"/> - <see userInput="You saved the store." stepKey="seeSavedMessage"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminSwitchStoreViewActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminSwitchStoreViewActionGroup.xml index 22b5d22c2fcc9..13e9beff9745b 100644 --- a/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminSwitchStoreViewActionGroup.xml +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminSwitchStoreViewActionGroup.xml @@ -15,7 +15,7 @@ <arguments> <argument name="storeView" defaultValue="customStore.name"/> </arguments> - + <click selector="{{AdminMainActionsSection.storeViewDropdown}}" stepKey="clickStoreViewSwitchDropdown"/> <waitForElementVisible selector="{{AdminMainActionsSection.storeViewByName('Default Store View')}}" stepKey="waitForStoreViewsAreVisible"/> <click selector="{{AdminMainActionsSection.storeViewByName(storeView)}}" stepKey="clickStoreViewByName"/> @@ -25,13 +25,4 @@ <scrollToTopOfPage stepKey="scrollToStoreSwitcher"/> <see userInput="{{storeView}}" selector="{{AdminMainActionsSection.storeSwitcher}}" stepKey="seeNewStoreViewName"/> </actionGroup> - - <actionGroup name="AdminSwitchToAllStoreViewActionGroup" extends="AdminSwitchStoreViewActionGroup"> - <annotations> - <description>EXTENDS: AdminSwitchStoreViewActionGroup. Clicks on the 'All Store Views' drop down menu. Validates that the 'All Store Views' options is present and correct.</description> - </annotations> - - <click selector="{{AdminMainActionsSection.allStoreViews}}" stepKey="clickStoreViewByName" after="waitForStoreViewsAreVisible"/> - <see selector="{{AdminMainActionsSection.storeSwitcher}}" userInput="All Store Views" stepKey="seeNewStoreViewName" after="waitForStoreViewSwitched"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminSwitchToAllStoreViewActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminSwitchToAllStoreViewActionGroup.xml new file mode 100644 index 0000000000000..fe56aa128dd7e --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminSwitchToAllStoreViewActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminSwitchToAllStoreViewActionGroup" extends="AdminSwitchStoreViewActionGroup"> + <annotations> + <description>EXTENDS: AdminSwitchStoreViewActionGroup. Clicks on the 'All Store Views' drop down menu. Validates that the 'All Store Views' options is present and correct.</description> + </annotations> + + <click selector="{{AdminMainActionsSection.allStoreViews}}" stepKey="clickStoreViewByName" after="waitForStoreViewsAreVisible"/> + <see selector="{{AdminMainActionsSection.storeSwitcher}}" userInput="All Store Views" stepKey="seeNewStoreViewName" after="waitForStoreViewSwitched"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/AssertDefaultStoreViewActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/AssertDefaultStoreViewActionGroup.xml new file mode 100644 index 0000000000000..e899241cfdd1f --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/AssertDefaultStoreViewActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertDefaultStoreViewActionGroup" extends="EditStoreGroupActionGroup"> + <annotations> + <description>Asserts that the provided store view is default in provided store group.</description> + </annotations> + <arguments> + <argument name="storeViewName" type="string"/> + </arguments> + <seeOptionIsSelected selector="{{AdminEditStoreGroupSection.defaultStoreView}}" userInput="{{storeViewName}}" stepKey="assertDefaultStoreView" after="waitForStorePageToLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/AssertStoreNotInGridActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/AssertStoreNotInGridActionGroup.xml new file mode 100644 index 0000000000000..3c9ebe0daa14e --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/AssertStoreNotInGridActionGroup.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertStoreNotInGridActionGroup"> + <annotations> + <description>Goes to the Admin Stores grid page. Validates that the provided Store Group Name is NOT present in the grid.</description> + </annotations> + <arguments> + <argument name="storeGroupName" type="string"/> + </arguments> + + <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> + <waitForPageLoad stepKey="waitForAdminSystemStorePageLoad"/> + <click selector="{{AdminStoresGridSection.resetButton}}" stepKey="resetSearchFilter"/> + <fillField userInput="{{storeGroupName}}" selector="{{AdminStoresGridSection.storeGrpFilterTextField}}" stepKey="fillSearchStoreGroupField"/> + <click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearchButton"/> + <waitForPageLoad stepKey="waitForStoreToLoad"/> + <see selector="{{AdminStoresGridSection.emptyText}}" userInput="We couldn't find any records." stepKey="seeAssertStoreGroupNotInGridMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/AssertStoreViewNotInGridActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/AssertStoreViewNotInGridActionGroup.xml new file mode 100644 index 0000000000000..b258f2e826200 --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/AssertStoreViewNotInGridActionGroup.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertStoreViewNotInGridActionGroup"> + <annotations> + <description>Goes to the Admin Stores grid page. Searches the grid for the provided Store View name. Validates that it does NOT appear in the grid.</description> + </annotations> + <arguments> + <argument name="storeViewName" type="string"/> + </arguments> + + <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> + <waitForPageLoad stepKey="waitForAdminSystemStorePageLoad"/> + <click selector="{{AdminStoresGridSection.resetButton}}" stepKey="resetSearchFilter"/> + <fillField userInput="{{storeViewName}}" selector="{{AdminStoresGridSection.storeFilterTextField}}" stepKey="fillSearchStoreViewField"/> + <click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearchButton"/> + <waitForPageLoad stepKey="waitForStoreToLoad"/> + <see selector="{{AdminStoresGridSection.emptyText}}" userInput="We couldn't find any records." stepKey="seeAssertStoreViewNotInGridMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/AssertWebsiteFormActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/AssertWebsiteFormActionGroup.xml new file mode 100644 index 0000000000000..3738d975e5131 --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/AssertWebsiteFormActionGroup.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertWebsiteFormActionGroup"> + <annotations> + <description>Clicks on the provided Website Name in the Admin Stores grid. Validates that the URL, Website Name/Code are present and correct.</description> + </annotations> + <arguments> + <argument name="websiteName" type="string"/> + <argument name="websiteCode" type="string"/> + </arguments> + + <click selector="{{AdminStoresGridSection.websiteName(websiteName)}}" stepKey="clickWebsiteFirstRowInGrid"/> + <waitForPageLoad stepKey="waitTillWebsiteFormPageIsOpened"/> + <grabFromCurrentUrl regex="~(\d+)/~" stepKey="grabWebsiteIdFromCurrentUrl"/> + <seeInCurrentUrl url="/system_store/editWebsite/website_id/{$grabWebsiteIdFromCurrentUrl}" stepKey="seeWebsiteId"/> + <seeInField selector="{{AdminNewWebsiteSection.name}}" userInput="{{websiteName}}" stepKey="seeAssertWebsiteName"/> + <seeInField selector="{{AdminNewWebsiteSection.code}}" userInput="{{websiteCode}}" stepKey="seeAssertWebsiteCode"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/AssertWebsiteInGridActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/AssertWebsiteInGridActionGroup.xml new file mode 100644 index 0000000000000..0835e3bc330b0 --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/AssertWebsiteInGridActionGroup.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertWebsiteInGridActionGroup"> + <annotations> + <description>Goes to the Admin Stores grid page. Searches the grid for the provided Website Name. Validates that the Website appears in the grid.</description> + </annotations> + <arguments> + <argument name="websiteName" type="string"/> + </arguments> + + <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> + <waitForPageLoad stepKey="waitForAdminSystemStorePageLoad"/> + <click selector="{{AdminStoresGridSection.resetButton}}" stepKey="resetSearchFilter"/> + <fillField userInput="{{websiteName}}" selector="{{AdminStoresGridSection.websiteFilterTextField}}" stepKey="fillWebsiteField"/> + <click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearchButton"/> + <waitForPageLoad stepKey="waitForStoreToLoad"/> + <seeElement selector="{{AdminStoresGridSection.websiteName(websiteName)}}" stepKey="seeAssertWebsiteInGrid"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/ChangeDefaultStoreViewActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/ChangeDefaultStoreViewActionGroup.xml new file mode 100644 index 0000000000000..40ebb95e9cdb2 --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/ChangeDefaultStoreViewActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ChangeDefaultStoreViewActionGroup" extends="EditStoreGroupActionGroup"> + <annotations> + <description>Change the default store view for provided store group.</description> + </annotations> + <arguments> + <argument name="storeViewName" type="string"/> + </arguments> + <selectOption selector="{{AdminEditStoreGroupSection.defaultStoreView}}" userInput="{{storeViewName}}" stepKey="changeDefaultStoreView" after="waitForStorePageToLoad"/> + <click selector="{{AdminStoreGroupActionsSection.saveButton}}" stepKey="clickSaveStoreGroup"/> + <waitForElementVisible selector="{{AdminConfirmationModalSection.ok}}" stepKey="waitForModal"/> + <see selector="{{AdminConfirmationModalSection.title}}" userInput="Warning message" stepKey="seeWarningAboutTakingALongTimeToComplete"/> + <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmModal"/> + <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="seeForSuccessMessage"/> + <see selector="{{AdminMessagesSection.success}}" userInput="You saved the store." stepKey="seeSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/CreateCustomStoreActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/CreateCustomStoreActionGroup.xml new file mode 100644 index 0000000000000..627b8f0b096a1 --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/CreateCustomStoreActionGroup.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateCustomStoreActionGroup"> + <annotations> + <description>Goes to the Admin Stores grid page. Clicks on 'Create Store'. Fills in the provided Details (Website, Store Group Name and Store Group Code). Clicks on Save. Validates that the Success Message is present and correct.</description> + </annotations> + <arguments> + <argument name="website" type="string"/> + <argument name="store" type="string"/> + <argument name="rootCategory" type="string"/> + </arguments> + + <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> + <waitForPageLoad stepKey="waitForSystemStorePage"/> + <click selector="{{AdminStoresMainActionsSection.createStoreButton}}" stepKey="selectCreateStore"/> + <selectOption userInput="{{website}}" selector="{{AdminNewStoreGroupSection.storeGrpWebsiteDropdown}}" stepKey="selectMainWebsite"/> + <fillField userInput="{{store}}" selector="{{AdminNewStoreGroupSection.storeGrpNameTextField}}" stepKey="fillStoreName"/> + <fillField userInput="{{store}}" selector="{{AdminNewStoreGroupSection.storeGrpCodeTextField}}" stepKey="fillStoreCode"/> + <selectOption userInput="{{rootCategory}}" selector="{{AdminNewStoreGroupSection.storeRootCategoryDropdown}}" stepKey="selectStoreStatus"/> + <click selector="{{AdminStoreGroupActionsSection.saveButton}}" stepKey="clickSaveStoreGroup"/> + <waitForElementVisible selector="{{AdminStoresGridSection.storeGrpFilterTextField}}" stepKey="waitForStoreGridReload"/> + <see userInput="You saved the store." stepKey="seeSavedMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/CreateCustomStoreViewActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/CreateCustomStoreViewActionGroup.xml index 290d0ad623bad..cf57afc5f7439 100644 --- a/app/code/Magento/Store/Test/Mftf/ActionGroup/CreateCustomStoreViewActionGroup.xml +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/CreateCustomStoreViewActionGroup.xml @@ -26,26 +26,4 @@ <waitForPageLoad stepKey="waitForPageLoad2"/> <conditionalClick selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" dependentSelector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" visible="true" stepKey="clickAcceptNewStoreViewCreationButton"/> </actionGroup> - - <actionGroup name="CreateStoreView"> - <annotations> - <description>Goes to the Admin Store Views creation page. Fills in the provided Store View, Store Group Name and Store View Status. Clicks on Save. Validates that the Success Message is present and correct.</description> - </annotations> - <arguments> - <argument name="storeView" defaultValue="customStore"/> - <argument name="storeGroupName" defaultValue="_defaultStoreGroup.name"/> - <argument name="storeViewStatus" defaultValue="_defaultStore.is_active"/> - </arguments> - - <amOnPage url="{{AdminSystemStoreViewPage.url}}" stepKey="amOnAdminSystemStoreViewPage"/> - <waitForPageLoad stepKey="waitForProductPageLoad"/> - <selectOption userInput="{{storeGroupName}}" selector="{{AdminNewStoreSection.storeGrpDropdown}}" stepKey="selectStoreGroup"/> - <fillField userInput="{{storeView.name}}" selector="{{AdminNewStoreSection.storeNameTextField}}" stepKey="fillStoreViewName"/> - <fillField userInput="{{storeView.code}}" selector="{{AdminNewStoreSection.storeCodeTextField}}" stepKey="fillStoreViewCode"/> - <selectOption userInput="{{storeViewStatus}}" selector="{{AdminNewStoreSection.statusDropdown}}" stepKey="selectStoreViewStatus"/> - <click selector="{{AdminStoresMainActionsSection.saveButton}}" stepKey="clickSaveStoreViewButton"/> - <waitForElementVisible selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" stepKey="waitForAcceptNewStoreViewCreationButton"/> - <conditionalClick selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" dependentSelector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" visible="true" stepKey="clickAcceptNewStoreViewCreationButton"/> - <see userInput="You saved the store view." stepKey="seeSavedMessage"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/CreateStoreViewActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/CreateStoreViewActionGroup.xml new file mode 100644 index 0000000000000..916048e33ea44 --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/CreateStoreViewActionGroup.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateStoreViewActionGroup"> + <annotations> + <description>Goes to the Admin Store Views creation page. Fills in the provided Store View, Store Group Name and Store View Status. Clicks on Save. Validates that the Success Message is present and correct.</description> + </annotations> + <arguments> + <argument name="storeView" defaultValue="customStore"/> + <argument name="storeGroupName" defaultValue="_defaultStoreGroup.name"/> + <argument name="storeViewStatus" defaultValue="_defaultStore.is_active"/> + </arguments> + + <amOnPage url="{{AdminSystemStoreViewPage.url}}" stepKey="amOnAdminSystemStoreViewPage"/> + <waitForPageLoad stepKey="waitForProductPageLoad"/> + <selectOption userInput="{{storeGroupName}}" selector="{{AdminNewStoreSection.storeGrpDropdown}}" stepKey="selectStoreGroup"/> + <fillField userInput="{{storeView.name}}" selector="{{AdminNewStoreSection.storeNameTextField}}" stepKey="fillStoreViewName"/> + <fillField userInput="{{storeView.code}}" selector="{{AdminNewStoreSection.storeCodeTextField}}" stepKey="fillStoreViewCode"/> + <selectOption userInput="{{storeViewStatus}}" selector="{{AdminNewStoreSection.statusDropdown}}" stepKey="selectStoreViewStatus"/> + <click selector="{{AdminStoresMainActionsSection.saveButton}}" stepKey="clickSaveStoreViewButton"/> + <waitForElementVisible selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" stepKey="waitForAcceptNewStoreViewCreationButton"/> + <conditionalClick selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" dependentSelector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" visible="true" stepKey="clickAcceptNewStoreViewCreationButton"/> + <see userInput="You saved the store view." stepKey="seeSavedMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/DeleteCustomStoreActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/DeleteCustomStoreActionGroup.xml index a4d4374704291..848fd5cf49d07 100644 --- a/app/code/Magento/Store/Test/Mftf/ActionGroup/DeleteCustomStoreActionGroup.xml +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/DeleteCustomStoreActionGroup.xml @@ -29,43 +29,4 @@ <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForSuccessMessage"/> <see selector="{{AdminMessagesSection.success}}" userInput="You deleted the store." stepKey="seeSuccessMessage"/> </actionGroup> - - <actionGroup name="DeleteCustomStoreBackupEnabledYesActionGroup"> - <annotations> - <description>Goes to the Admin Stores grid page. Deletes the provided Store Group Name while creating a DB backup. Validates that the Success Messages are present and correct.</description> - </annotations> - <arguments> - <argument name="storeGroupName" type="string"/> - </arguments> - - <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> - <click selector="{{AdminStoresGridSection.resetButton}}" stepKey="resetSearchFilter"/> - <fillField userInput="{{storeGroupName}}" selector="{{AdminStoresGridSection.storeGrpFilterTextField}}" stepKey="fillSearchStoreGroupField"/> - <click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearchButton"/> - <see userInput="{{storeGroupName}}" selector="{{AdminStoresGridSection.storeGrpNameInFirstRow}}" stepKey="verifyThatCorrectStoreGroupFound"/> - <click selector="{{AdminStoresGridSection.storeGrpNameInFirstRow}}" stepKey="clickEditExistingStoreRow"/> - <waitForPageLoad stepKey="waitForStoreToLoad"/> - <click selector="{{AdminStoresMainActionsSection.deleteButton}}" stepKey="clickDeleteStoreGroupButtonOnEditStorePage"/> - <selectOption userInput="Yes" selector="{{AdminStoresDeleteStoreGroupSection.createDbBackup}}" stepKey="setCreateDbBackupToNo"/> - <click selector="{{AdminStoresDeleteStoreGroupSection.deleteStoreGroupButton}}" stepKey="clickDeleteStoreGroupButtonOnDeleteStorePage"/> - <see selector="{{AdminStoresGridSection.successMessage}}" userInput="The database was backed up." stepKey="seeAssertDatabaseBackedUpMessage"/> - <see selector="{{AdminStoresGridSection.successMessage}}" userInput="You deleted the store." stepKey="seeAssertSuccessDeleteStoreGroupMessage"/> - </actionGroup> - - <actionGroup name="AssertStoreNotInGrid"> - <annotations> - <description>Goes to the Admin Stores grid page. Validates that the provided Store Group Name is NOT present in the grid.</description> - </annotations> - <arguments> - <argument name="storeGroupName" type="string"/> - </arguments> - - <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> - <waitForPageLoad stepKey="waitForAdminSystemStorePageLoad"/> - <click selector="{{AdminStoresGridSection.resetButton}}" stepKey="resetSearchFilter"/> - <fillField userInput="{{storeGroupName}}" selector="{{AdminStoresGridSection.storeGrpFilterTextField}}" stepKey="fillSearchStoreGroupField"/> - <click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearchButton"/> - <waitForPageLoad stepKey="waitForStoreToLoad"/> - <see selector="{{AdminStoresGridSection.emptyText}}" userInput="We couldn't find any records." stepKey="seeAssertStoreGroupNotInGridMessage"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/DeleteCustomStoreBackupEnabledYesActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/DeleteCustomStoreBackupEnabledYesActionGroup.xml new file mode 100644 index 0000000000000..97fb6a83ab06f --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/DeleteCustomStoreBackupEnabledYesActionGroup.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DeleteCustomStoreBackupEnabledYesActionGroup"> + <annotations> + <description>Goes to the Admin Stores grid page. Deletes the provided Store Group Name while creating a DB backup. Validates that the Success Messages are present and correct.</description> + </annotations> + <arguments> + <argument name="storeGroupName" type="string"/> + </arguments> + + <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> + <click selector="{{AdminStoresGridSection.resetButton}}" stepKey="resetSearchFilter"/> + <fillField userInput="{{storeGroupName}}" selector="{{AdminStoresGridSection.storeGrpFilterTextField}}" stepKey="fillSearchStoreGroupField"/> + <click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearchButton"/> + <see userInput="{{storeGroupName}}" selector="{{AdminStoresGridSection.storeGrpNameInFirstRow}}" stepKey="verifyThatCorrectStoreGroupFound"/> + <click selector="{{AdminStoresGridSection.storeGrpNameInFirstRow}}" stepKey="clickEditExistingStoreRow"/> + <waitForPageLoad stepKey="waitForStoreToLoad"/> + <click selector="{{AdminStoresMainActionsSection.deleteButton}}" stepKey="clickDeleteStoreGroupButtonOnEditStorePage"/> + <selectOption userInput="Yes" selector="{{AdminStoresDeleteStoreGroupSection.createDbBackup}}" stepKey="setCreateDbBackupToNo"/> + <click selector="{{AdminStoresDeleteStoreGroupSection.deleteStoreGroupButton}}" stepKey="clickDeleteStoreGroupButtonOnDeleteStorePage"/> + <see selector="{{AdminStoresGridSection.successMessage}}" userInput="The database was backed up." stepKey="seeAssertDatabaseBackedUpMessage"/> + <see selector="{{AdminStoresGridSection.successMessage}}" userInput="You deleted the store." stepKey="seeAssertSuccessDeleteStoreGroupMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/DeleteCustomStoreViewBackupEnabledYesActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/DeleteCustomStoreViewBackupEnabledYesActionGroup.xml new file mode 100644 index 0000000000000..f670a4771ca5c --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/DeleteCustomStoreViewBackupEnabledYesActionGroup.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DeleteCustomStoreViewBackupEnabledYesActionGroup"> + <annotations> + <description>Goes to the Admin Stores grid page. Deleted the provided Store while creating a Backup. Validates that the Success Messages (Delete/Backup) are present and correct.</description> + </annotations> + <arguments> + <argument name="storeViewName" type="string"/> + </arguments> + + <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> + <click selector="{{AdminStoresGridSection.resetButton}}" stepKey="resetSearchFilter"/> + <fillField userInput="{{storeViewName}}" selector="{{AdminStoresGridSection.storeFilterTextField}}" stepKey="fillSearchStoreViewField"/> + <click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearchButton"/> + <click selector="{{AdminStoresGridSection.storeNameInFirstRow}}" stepKey="clickEditExistingStoreViewRow"/> + <waitForPageLoad stepKey="waitForStoreToLoad"/> + <click selector="{{AdminNewStoreViewActionsSection.delete}}" stepKey="clickDeleteStoreViewButtonOnEditStorePage"/> + <selectOption userInput="Yes" selector="{{AdminStoreBackupOptionsSection.createBackupSelect}}" stepKey="setCreateDbBackupToYes"/> + <click selector="{{AdminNewStoreViewActionsSection.delete}}" stepKey="clickDeleteStoreViewButtonOnDeleteStorePage"/> + <waitForElementVisible selector="{{AdminConfirmationModalSection.title}}" stepKey="waitingForWarningModal"/> + <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmStoreViewDelete"/> + <waitForPageLoad stepKey="waitForSuccessMessage"/> + <see selector="{{AdminStoresGridSection.successMessage}}" userInput="The database was backed up." stepKey="seeAssertDatabaseBackedUpMessage"/> + <see selector="{{AdminStoresGridSection.successMessage}}" userInput="You deleted the store view." stepKey="seeAssertSuccessDeleteStoreViewMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/EditCustomStoreGroupAcceptWarningMessageActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/EditCustomStoreGroupAcceptWarningMessageActionGroup.xml index 5493ae7399ddd..1c2ae675573a8 100644 --- a/app/code/Magento/Store/Test/Mftf/ActionGroup/EditCustomStoreGroupAcceptWarningMessageActionGroup.xml +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/EditCustomStoreGroupAcceptWarningMessageActionGroup.xml @@ -8,7 +8,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="EditCustomStoreGroupAcceptWarningMessageActionGroup" extends="CreateCustomStore"> + <actionGroup name="EditCustomStoreGroupAcceptWarningMessageActionGroup" extends="CreateCustomStoreActionGroup"> <!-- Admin creates new Store group --> <annotations> <description>EXTENDS: CreateCustomStore. Removes 'selectCreateStore'. Clicks on the 1st row. Clicks on Ok.</description> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/EditStoreGroupActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/EditStoreGroupActionGroup.xml new file mode 100644 index 0000000000000..7e2a0ac443d51 --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/EditStoreGroupActionGroup.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="EditStoreGroupActionGroup"> + <annotations> + <description>Edit store group.</description> + </annotations> + <arguments> + <argument name="storeGroupName" type="string"/> + </arguments> + <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> + <waitForPageLoad stepKey="waitForAdminSystemStorePageLoad"/> + <click selector="{{AdminStoresGridSection.resetButton}}" stepKey="resetSearchFilter"/> + <waitForPageLoad stepKey="waitForResetResult"/> + <fillField userInput="{{storeGroupName}}" selector="{{AdminStoresGridSection.storeGrpFilterTextField}}" stepKey="fillStoreGroupFilter"/> + <click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearchButton"/> + <waitForPageLoad stepKey="waitForSearchResult"/> + <click selector="{{AdminStoresGridSection.storeGrpNameInFirstRow}}" stepKey="clicksStoreGroupName"/> + <waitForPageLoad stepKey="waitForStorePageToLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/NavigateToAdminContentManagementPageActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/NavigateToAdminContentManagementPageActionGroup.xml new file mode 100644 index 0000000000000..bf3a3b2f8509e --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/NavigateToAdminContentManagementPageActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="NavigateToAdminContentManagementPageActionGroup"> + <annotations> + <description>Goes to the 'Configuration' page for 'Content Management'.</description> + </annotations> + + <amOnPage url="{{AdminContentManagementPage.url}}" stepKey="navigateToConfigurationPage"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/SaveStoreConfigurationActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/SaveStoreConfigurationActionGroup.xml new file mode 100644 index 0000000000000..ce68b7a05b8d2 --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/SaveStoreConfigurationActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SaveStoreConfigurationActionGroup"> + <annotations> + <description>Clicks on the Save button.</description> + </annotations> + + <comment userInput="saveStoreConfiguration" stepKey="comment"/> + <waitForElementVisible selector="{{StoreConfigSection.Save}}" stepKey="waitForSaveButton"/> + <click selector="{{StoreConfigSection.Save}}" stepKey="clickSaveButton"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/SaveStoreConfigurationAndValidateFieldErrorActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/SaveStoreConfigurationAndValidateFieldErrorActionGroup.xml new file mode 100644 index 0000000000000..82b591e8f92dc --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/SaveStoreConfigurationAndValidateFieldErrorActionGroup.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SaveStoreConfigurationAndValidateFieldErrorActionGroup"> + <annotations> + <description>Clicks on Save. Validates that the fields are required.</description> + </annotations> + <arguments> + <argument name="inputFieldError" type="string"/> + <argument name="errorMessageSelector" type="string"/> + <argument name="errorMessage" type="string"/> + </arguments> + + <comment userInput="saveStoreConfigurationAndValidateFieldError" stepKey="comment"/> + <waitForElementVisible selector="{{StoreConfigSection.Save}}" stepKey="waitForSaveButton"/> + <click selector="{{StoreConfigSection.Save}}" stepKey="clickSaveButton"/> + <waitForElement selector="{{inputFieldError}}" stepKey="waitForErrorField"/> + <waitForElementVisible selector="{{errorMessageSelector}}" stepKey="waitForErrorMessage"/> + <see selector="{{errorMessageSelector}}" userInput="{{errorMessage}}" stepKey="seeErrorMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/StorefrontSwitchDefaultStoreViewActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/StorefrontSwitchDefaultStoreViewActionGroup.xml new file mode 100644 index 0000000000000..e3b3cc7c1a9ff --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/StorefrontSwitchDefaultStoreViewActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontSwitchDefaultStoreViewActionGroup" extends="StorefrontSwitchStoreViewActionGroup"> + <annotations> + <description>EXTENDS: StorefrontSwitchStoreViewActionGroup. Clicks on the Default Store View.</description> + </annotations> + + <remove keyForRemoval="clickSelectStoreView"/> + <click selector="{{StorefrontHeaderSection.storeViewOption('default')}}" stepKey="clickSelectDefaultStoreView" after="waitForStoreViewDropdown"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/StorefrontSwitchStoreViewActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/StorefrontSwitchStoreViewActionGroup.xml index 62ebdb6e8e9eb..9d8fb267910e1 100644 --- a/app/code/Magento/Store/Test/Mftf/ActionGroup/StorefrontSwitchStoreViewActionGroup.xml +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/StorefrontSwitchStoreViewActionGroup.xml @@ -15,19 +15,10 @@ <arguments> <argument name="storeView" defaultValue="customStore"/> </arguments> - + <click selector="{{StorefrontHeaderSection.storeViewSwitcher}}" stepKey="clickStoreViewSwitcher"/> <waitForElementVisible selector="{{StorefrontHeaderSection.storeViewDropdown}}" stepKey="waitForStoreViewDropdown"/> <click selector="{{StorefrontHeaderSection.storeViewOption(storeView.code)}}" stepKey="clickSelectStoreView"/> <waitForPageLoad stepKey="waitForPageLoad"/> </actionGroup> - - <actionGroup name="StorefrontSwitchDefaultStoreViewActionGroup" extends="StorefrontSwitchStoreViewActionGroup"> - <annotations> - <description>EXTENDS: StorefrontSwitchStoreViewActionGroup. Clicks on the Default Store View.</description> - </annotations> - - <remove keyForRemoval="clickSelectStoreView"/> - <click selector="{{StorefrontHeaderSection.storeViewOption('default')}}" stepKey="clickSelectDefaultStoreView" after="waitForStoreViewDropdown"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateCustomStoreViewStatusEnabledVerifyAbsenceOfDeleteButtonTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateCustomStoreViewStatusEnabledVerifyAbsenceOfDeleteButtonTest.xml index 7cd44d4d0ae88..5d4ac8de74680 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateCustomStoreViewStatusEnabledVerifyAbsenceOfDeleteButtonTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateCustomStoreViewStatusEnabledVerifyAbsenceOfDeleteButtonTest.xml @@ -39,7 +39,7 @@ </actionGroup> <!--Save the above store view and verify AssertStoreViewSuccessSaveMessage--> - <actionGroup ref="AdminCreateStoreViewActionSaveGroup" stepKey="verifyAssertStoreViewSuccessSaveMessage"/> + <actionGroup ref="AdminCreateStoreViewSaveActionGroup" stepKey="verifyAssertStoreViewSuccessSaveMessage"/> <!--Search store view(from above step) in grid--> <actionGroup ref="AssertStoreViewInGridActionGroup" stepKey="searchStoreViewInGrid"> @@ -56,4 +56,4 @@ <!--Go to store view form page and verify AssertStoreNoDeleteButton--> <dontSee selector="{{AdminNewStoreViewActionsSection.delete}}" stepKey="AssertStoreNoDeleteButton"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateCustomStoreViewStatusEnabledVerifyBackendAndFrontendTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateCustomStoreViewStatusEnabledVerifyBackendAndFrontendTest.xml index 18485abadc008..2ba8c675b3b2a 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateCustomStoreViewStatusEnabledVerifyBackendAndFrontendTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateCustomStoreViewStatusEnabledVerifyBackendAndFrontendTest.xml @@ -39,7 +39,7 @@ </actionGroup> <!--Save the above store view and verify AssertStoreViewSuccessSaveMessage--> - <actionGroup ref="AdminCreateStoreViewActionSaveGroup" stepKey="verifyAssertStoreViewSuccessSaveMessage"/> + <actionGroup ref="AdminCreateStoreViewSaveActionGroup" stepKey="verifyAssertStoreViewSuccessSaveMessage"/> <!--Search store view(from above step) in grid and verify AssertStoreInGrid--> <actionGroup ref="AssertStoreViewInGridActionGroup" stepKey="searchStoreViewInGrid"> @@ -66,4 +66,4 @@ <argument name="customStore" value="{{customStore.name}}"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateNewLocalizedStoreViewStatusEnabledTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateNewLocalizedStoreViewStatusEnabledTest.xml index 8e9fe1e71ceb4..6c60445107b28 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateNewLocalizedStoreViewStatusEnabledTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateNewLocalizedStoreViewStatusEnabledTest.xml @@ -33,11 +33,11 @@ </actionGroup> <!--Save the above store view and verify AssertStoreViewSuccessSaveMessage--> - <actionGroup ref="AdminCreateStoreViewActionSaveGroup" stepKey="verifyAssertStoreViewSuccessSaveMessage"/> + <actionGroup ref="AdminCreateStoreViewSaveActionGroup" stepKey="verifyAssertStoreViewSuccessSaveMessage"/> <!--Search store view(from above step) in grid and verify AssertStoreInGrid--> <actionGroup ref="AssertStoreViewInGridActionGroup" stepKey="searchStoreViewInGrid"> <argument name="storeViewName" value="{{storeViewGermany.name}}"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreGroupWithCustomWebsiteAndDefaultCategoryTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreGroupWithCustomWebsiteAndDefaultCategoryTest.xml index 8e8f31eaca865..4892556929f80 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreGroupWithCustomWebsiteAndDefaultCategoryTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreGroupWithCustomWebsiteAndDefaultCategoryTest.xml @@ -34,19 +34,19 @@ </after> <!--Create custom store group with custom website and default category and verify AssertStoreGroupSuccessSaveMessage--> - <actionGroup ref="CreateCustomStore" stepKey="createCustomStoreGroup"> + <actionGroup ref="CreateCustomStoreActionGroup" stepKey="createCustomStoreGroup"> <argument name="website" value="{{customWebsite.name}}"/> <argument name="store" value="{{customStoreGroup.name}}"/> <argument name="rootCategory" value="Default Category"/> </actionGroup> <!--Search created store group(from above step) in grid and verify AssertStoreGroupInGrid message--> - <actionGroup ref="AssertStoreGroupInGrid" stepKey="seeCreatedStoreGroupInGrid"> + <actionGroup ref="AssertStoreGroupInGridActionGroup" stepKey="seeCreatedStoreGroupInGrid"> <argument name="storeGroupName" value="{{customStoreGroup.name}}"/> </actionGroup> <!--Go to store group form page and verify AssertStoreGroupForm--> - <actionGroup ref="AssertStoreGroupForm" stepKey="seeCreatedStoreGroupForm"> + <actionGroup ref="AssertStoreGroupFormActionGroup" stepKey="seeCreatedStoreGroupForm"> <argument name="website" value="{{customWebsite.name}}"/> <argument name="storeGroupName" value="{{customStoreGroup.name}}"/> <argument name="storeGroupCode" value="{{customStoreGroup.code}}"/> @@ -55,4 +55,4 @@ <!--Also verify absence of delete button on store group form page(AssertStoreGroupNoDeleteButton)--> <dontSee selector="{{AdminStoresMainActionsSection.deleteButton}}" stepKey="AssertStoreGroupNoDeleteButton"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreGroupWithCustomWebsiteAndRootCategoryTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreGroupWithCustomWebsiteAndRootCategoryTest.xml index 18f9822145dec..27037f45f3835 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreGroupWithCustomWebsiteAndRootCategoryTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreGroupWithCustomWebsiteAndRootCategoryTest.xml @@ -42,23 +42,23 @@ </after> <!--Create custom store group with custom website and root category and verify AssertStoreGroupSuccessSaveMessage--> - <actionGroup ref="CreateCustomStore" stepKey="createCustomStoreGroup"> + <actionGroup ref="CreateCustomStoreActionGroup" stepKey="createCustomStoreGroup"> <argument name="website" value="{{customWebsite.name}}"/> <argument name="store" value="{{customStoreGroup.name}}"/> <argument name="rootCategory" value="$$rootCategory.name$$"/> </actionGroup> <!--Search created store group(from above step) in grid and verify AssertStoreGroupInGrid--> - <actionGroup ref="AssertStoreGroupInGrid" stepKey="seeCreatedStoreGroupInGrid"> + <actionGroup ref="AssertStoreGroupInGridActionGroup" stepKey="seeCreatedStoreGroupInGrid"> <argument name="storeGroupName" value="{{customStoreGroup.name}}"/> </actionGroup> <!--Go to store group form page and verify AssertStoreGroupForm and AssertStoreGroupOnStoreViewForm--> - <actionGroup ref="AssertStoreGroupForm" stepKey="seeCreatedStoreGroupInForm"> + <actionGroup ref="AssertStoreGroupFormActionGroup" stepKey="seeCreatedStoreGroupInForm"> <argument name="website" value="{{customWebsite.name}}"/> <argument name="storeGroupName" value="{{customStoreGroup.name}}"/> <argument name="storeGroupCode" value="{{customStoreGroup.code}}"/> <argument name="rootCategory" value="$$rootCategory.name$$"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreGroupWithDefaultWebsiteAndDefaultCategoryTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreGroupWithDefaultWebsiteAndDefaultCategoryTest.xml index ddc5d061c1db2..0db65501b4112 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreGroupWithDefaultWebsiteAndDefaultCategoryTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreGroupWithDefaultWebsiteAndDefaultCategoryTest.xml @@ -36,16 +36,16 @@ </actionGroup> <!--Search created store group(from above step) in grid and verify AssertStoreGroupInGrid--> - <actionGroup ref="AssertStoreGroupInGrid" stepKey="seeCreatedStoreGroupInGrid"> + <actionGroup ref="AssertStoreGroupInGridActionGroup" stepKey="seeCreatedStoreGroupInGrid"> <argument name="storeGroupName" value="{{SecondStoreGroupUnique.name}}"/> </actionGroup> <!--Go to store group form page and verify AssertStoreGroupForm and AssertStoreGroupOnStoreViewForm--> - <actionGroup ref="AssertStoreGroupForm" stepKey="seeCreatedStoreGroupForm"> + <actionGroup ref="AssertStoreGroupFormActionGroup" stepKey="seeCreatedStoreGroupForm"> <argument name="website" value="{{_defaultWebsite.name}}"/> <argument name="storeGroupName" value="{{SecondStoreGroupUnique.name}}"/> <argument name="storeGroupCode" value="{{SecondStoreGroupUnique.code}}"/> <argument name="rootCategory" value="Default Category"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreViewStatusDisabledVerifyBackendAndFrontendTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreViewStatusDisabledVerifyBackendAndFrontendTest.xml index 6ccab965b7727..2d8fbc72263d4 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreViewStatusDisabledVerifyBackendAndFrontendTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreViewStatusDisabledVerifyBackendAndFrontendTest.xml @@ -27,14 +27,14 @@ </after> <!--Create store view--> - <actionGroup ref="CreateStoreView" stepKey="createStoreView"> + <actionGroup ref="CreateStoreViewActionGroup" stepKey="createStoreView"> <argument name="storeView" value="storeViewDataDisabled"/> <argument name="storeGroupName" value="_defaultStoreGroup.name"/> <argument name="storeViewStatus" value="storeViewDataDisabled.is_active"/> </actionGroup> <!--Save the above store view and verify AssertStoreViewSuccessSaveMessage--> - <actionGroup ref="AdminCreateStoreViewActionSaveGroup" stepKey="verifyAssertStoreViewSuccessSaveMessage"/> + <actionGroup ref="AdminCreateStoreViewSaveActionGroup" stepKey="verifyAssertStoreViewSuccessSaveMessage"/> <!--Go to store configuration page and verify AssertStoreBackend--> <actionGroup ref="AssertStoreConfigurationBackendActionGroup" stepKey="verifyValuesOnStoreBackend"> @@ -46,4 +46,4 @@ <argument name="store" value="{{storeViewDataDisabled.name}"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreViewStatusEnabledVerifyBackendAndFrontendTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreViewStatusEnabledVerifyBackendAndFrontendTest.xml index c2f12bd2673f7..150e1082352cf 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreViewStatusEnabledVerifyBackendAndFrontendTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreViewStatusEnabledVerifyBackendAndFrontendTest.xml @@ -33,7 +33,7 @@ </actionGroup> <!--Save the above store view and verify AssertStoreViewSuccessSaveMessage--> - <actionGroup ref="AdminCreateStoreViewActionSaveGroup" stepKey="verifyAssertStoreViewSuccessSaveMessage"/> + <actionGroup ref="AdminCreateStoreViewSaveActionGroup" stepKey="verifyAssertStoreViewSuccessSaveMessage"/> <!--Go to store configuration page and verify AssertStoreBackend--> <actionGroup ref="AssertStoreConfigurationBackendActionGroup" stepKey="verifyValuesOnStoreBackend"> @@ -45,4 +45,4 @@ <argument name="store" value="{{storeViewData.name}}"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateWebsiteTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateWebsiteTest.xml index 29d96c3cb94c2..a8782acb1eb07 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateWebsiteTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateWebsiteTest.xml @@ -35,12 +35,12 @@ </actionGroup> <!--Search created website in grid and verify AssertWebsiteInGrid--> - <actionGroup ref="AssertWebsiteInGrid" stepKey="seeWebsiteInGrid"> + <actionGroup ref="AssertWebsiteInGridActionGroup" stepKey="seeWebsiteInGrid"> <argument name="websiteName" value="{{customWebsite.name}}"/> </actionGroup> <!--Verify website name and websitecode on website form (AssertWebsiteForm and AssertWebsiteOnStoreForm)--> - <actionGroup ref="AssertWebsiteForm" stepKey="seeWebsiteForm"> + <actionGroup ref="AssertWebsiteFormActionGroup" stepKey="seeWebsiteForm"> <argument name="websiteName" value="{{customWebsite.name}}"/> <argument name="websiteCode" value="{{customWebsite.code}}"/> </actionGroup> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminDeleteStoreGroupTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminDeleteStoreGroupTest.xml index 652537f7864cd..185cf87531d9a 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminDeleteStoreGroupTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminDeleteStoreGroupTest.xml @@ -39,7 +39,7 @@ </actionGroup> <!--Verify deleted Store group is not present in grid and verify AssertStoreGroupNotInGrid message--> - <actionGroup ref="AssertStoreNotInGrid" stepKey="verifyDeletedStoreGroupNotInGrid"> + <actionGroup ref="AssertStoreNotInGridActionGroup" stepKey="verifyDeletedStoreGroupNotInGrid"> <argument name="storeGroupName" value="{{customStore.name}}"/> </actionGroup> @@ -52,4 +52,4 @@ <argument name="backup" value="WebSetupWizardBackup"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminDeleteStoreViewTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminDeleteStoreViewTest.xml index fc1dcb5ee1a24..df6fc391b2972 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminDeleteStoreViewTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminDeleteStoreViewTest.xml @@ -37,7 +37,7 @@ </actionGroup> <!--Verify deleted store view not present in grid and verify AssertStoreNotInGrid Message--> - <actionGroup ref="AssertStoreViewNotInGrid" stepKey="verifyDeletedStoreViewNotInGrid"> + <actionGroup ref="AssertStoreViewNotInGridActionGroup" stepKey="verifyDeletedStoreViewNotInGrid"> <argument name="storeViewName" value="{{storeViewData.name}}"/> </actionGroup> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminMoveStoreToOtherGroupSameWebsiteTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminMoveStoreToOtherGroupSameWebsiteTest.xml index b86b99936dbe2..f1983dca53bf7 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminMoveStoreToOtherGroupSameWebsiteTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminMoveStoreToOtherGroupSameWebsiteTest.xml @@ -62,7 +62,7 @@ <argument name="storeDropdown" value="{{customStore.name}}"/> </actionGroup> <!--Save the above store view and verify AssertStoreViewSuccessSaveMessage--> - <actionGroup ref="AdminCreateStoreViewActionSaveGroup" stepKey="verifyAssertStoreViewSuccessSaveMessage"/> + <actionGroup ref="AdminCreateStoreViewSaveActionGroup" stepKey="verifyAssertStoreViewSuccessSaveMessage"/> <!--Search moved store view(from above step) in grid and verify AssertStoreInGrid--> <actionGroup ref="AssertStoreViewInGridActionGroup" stepKey="searchMovedStoreViewInGrid"> @@ -92,4 +92,4 @@ <argument name="storeView2" value="{{storeViewData2.name}}"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminUpdateStoreGroupAcceptAlertAndVerifyStoreViewFormTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminUpdateStoreGroupAcceptAlertAndVerifyStoreViewFormTest.xml index 9c84388d86f99..16f830224f7f4 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminUpdateStoreGroupAcceptAlertAndVerifyStoreViewFormTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminUpdateStoreGroupAcceptAlertAndVerifyStoreViewFormTest.xml @@ -31,7 +31,7 @@ <argument name="websiteCode" value="{{customWebsite.code}}"/> </actionGroup> <!--Create custom store group--> - <actionGroup ref="CreateCustomStore" stepKey="createCustomStoreGroup"> + <actionGroup ref="CreateCustomStoreActionGroup" stepKey="createCustomStoreGroup"> <argument name="website" value="{{_defaultWebsite.name}}"/> <argument name="store" value="{{staticStoreGroup.name}}"/> <argument name="rootCategory" value="Default Category"/> @@ -73,4 +73,4 @@ <argument name="rootCategory" value="$$rootCategory.name$$"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminUpdateStoreGroupAndVerifyStoreViewFormTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminUpdateStoreGroupAndVerifyStoreViewFormTest.xml index 3d85a34901434..ab204560f11c6 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminUpdateStoreGroupAndVerifyStoreViewFormTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminUpdateStoreGroupAndVerifyStoreViewFormTest.xml @@ -44,7 +44,7 @@ <click selector="{{AdminStoresGridSection.firstRow}}" stepKey="clickFirstRow"/> <waitForPageLoad stepKey="AdminSystemStoreGroupPageToOpen"/> <!--Update created Store group as per requirement--> - <actionGroup ref="CreateCustomStore" stepKey="createNewCustomStoreGroup"> + <actionGroup ref="CreateCustomStoreActionGroup" stepKey="createNewCustomStoreGroup"> <argument name="website" value="{{_defaultWebsite.name}}"/> <argument name="store" value="{{customStoreGroup.name}}"/> <argument name="rootCategory" value="Default Category"/> @@ -63,4 +63,4 @@ <argument name="rootCategory" value="Default Category"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminUpdateStoreViewTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminUpdateStoreViewTest.xml index 054ee789fbdc5..26dee6c632928 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminUpdateStoreViewTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminUpdateStoreViewTest.xml @@ -47,7 +47,7 @@ <argument name="customStore" value="SecondStoreUnique"/> </actionGroup> <!--Save the updated Store view and verify AssertStoreViewSuccessSaveMessage--> - <actionGroup ref="AdminCreateStoreViewActionSaveGroup" stepKey="verifyAssertStoreViewSuccessSaveMessage"> + <actionGroup ref="AdminCreateStoreViewSaveActionGroup" stepKey="verifyAssertStoreViewSuccessSaveMessage"> </actionGroup> <!--Search updated store view in grid and verify AssertStoreViewInGridMessage--> @@ -78,4 +78,4 @@ <see selector="{{StorefrontHeaderSection.storeViewDropdown}}" userInput="{{storeViewData.name}}" stepKey="seeAssertStoreViewOnStorefront"/> <see selector="{{StorefrontHeaderSection.storeViewDropdown}}" userInput="{{SecondStoreUnique.name}}" stepKey="seeAssertUpdatedStoreViewOnStorefront"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminUpdateWebsiteTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminUpdateWebsiteTest.xml index 6b666126569ae..5c4ecb87dda53 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminUpdateWebsiteTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminUpdateWebsiteTest.xml @@ -34,7 +34,7 @@ </after> <!--Search created custom website in grid--> - <actionGroup ref="AssertWebsiteInGrid" stepKey="seeWebsiteInGrid"> + <actionGroup ref="AssertWebsiteInGridActionGroup" stepKey="seeWebsiteInGrid"> <argument name="websiteName" value="{{customWebsite.name}}"/> </actionGroup> <click selector="{{AdminStoresGridSection.websiteName(customWebsite.name)}}" stepKey="clickWebsiteFirstRowInGrid"/> @@ -46,14 +46,14 @@ </actionGroup> <!--Search updated custom website(from above step) in grid and verify AssertWebsiteInGrid--> - <actionGroup ref="AssertWebsiteInGrid" stepKey="seeUpdatedWebsiteInGrid"> + <actionGroup ref="AssertWebsiteInGridActionGroup" stepKey="seeUpdatedWebsiteInGrid"> <argument name="websiteName" value="{{updateCustomWebsite.name}}"/> </actionGroup> <!--Verify updated website name and updated websitecode on website form (AssertWebsiteForm and AssertWebsiteOnStoreForm)--> - <actionGroup ref="AssertWebsiteForm" stepKey="seeUpdatedWebsiteForm"> + <actionGroup ref="AssertWebsiteFormActionGroup" stepKey="seeUpdatedWebsiteForm"> <argument name="websiteName" value="{{updateCustomWebsite.name}}"/> <argument name="websiteCode" value="{{updateCustomWebsite.code}}"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Ui/Test/Mftf/Test/AdminGridFilterDeleteAndVerifyErrorMessageTest.xml b/app/code/Magento/Ui/Test/Mftf/Test/AdminGridFilterDeleteAndVerifyErrorMessageTest.xml index e2c3b157c1059..b22618f40e5a8 100644 --- a/app/code/Magento/Ui/Test/Mftf/Test/AdminGridFilterDeleteAndVerifyErrorMessageTest.xml +++ b/app/code/Magento/Ui/Test/Mftf/Test/AdminGridFilterDeleteAndVerifyErrorMessageTest.xml @@ -32,7 +32,7 @@ <argument name="websiteCode" value="{{customWebsite.code}}"/> </actionGroup> <!-- Create second store --> - <actionGroup ref="CreateCustomStore" stepKey="createCustomStore"> + <actionGroup ref="CreateCustomStoreActionGroup" stepKey="createCustomStore"> <argument name="website" value="{{customWebsite.name}}"/> <argument name="store" value="{{customStoreGroup.name}}"/> <argument name="rootCategory" value="$$rootCategory.name$$"/> @@ -78,4 +78,4 @@ <argument name="errorMessage" value="Something went wrong with processing the default view and we have restored the filter to its original state."/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductWithSeveralWebsitesAndCheckURLRewritesTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductWithSeveralWebsitesAndCheckURLRewritesTest.xml index 4dc5c85830076..b2f63dbc39eab 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductWithSeveralWebsitesAndCheckURLRewritesTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductWithSeveralWebsitesAndCheckURLRewritesTest.xml @@ -51,7 +51,7 @@ </actionGroup> <!-- Create second store --> - <actionGroup ref="CreateCustomStore" stepKey="createCustomStore"> + <actionGroup ref="CreateCustomStoreActionGroup" stepKey="createCustomStore"> <argument name="website" value="{{_defaultWebsite.name}}"/> <argument name="store" value="{{customStoreGroup.name}}"/> <argument name="rootCategory" value="$$rootCategory.name$$"/> @@ -112,4 +112,4 @@ <see selector="{{AdminUrlRewriteIndexSection.storeView('1')}}" userInput="{{customStore.name}}" stepKey="seeStoreValueForProductId"/> <see selector="{{AdminUrlRewriteIndexSection.storeView('1')}}" userInput="{{storeViewData.name}}" stepKey="seeStoreViewValueForProductId"/> </test> -</tests> \ No newline at end of file +</tests> From 94c33b4e62ae6ddd4a23f94b097f41c5b1aa8138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 28 Nov 2019 15:35:03 +0100 Subject: [PATCH 0157/1143] REFACTOR: Extract Action Groups to separate files (according to MFTF best practices) --- .../StorefrontUpdateSearchTermEntityTest.xml | 6 +-- .../AdminDeleteAllSearchTermsActionGroup.xml | 17 +++++++ .../AdminDeleteSearchTermActionGroup.xml | 21 +++++++++ .../AdminSearchTermActionGroup.xml | 47 ------------------- ...archTermFilterBySearchQueryActionGroup.xml | 27 +++++++++++ .../AdminMassDeleteSearchTermEntityTest.xml | 8 ++-- ...archSuggestionByProductDescriptionTest.xml | 8 ++-- ...erifySearchSuggestionByProductNameTest.xml | 4 +- ...uggestionByProductShortDescriptionTest.xml | 4 +- ...VerifySearchSuggestionByProductSkuTest.xml | 4 +- 10 files changed, 82 insertions(+), 64 deletions(-) create mode 100644 app/code/Magento/Search/Test/Mftf/ActionGroup/AdminDeleteAllSearchTermsActionGroup.xml create mode 100644 app/code/Magento/Search/Test/Mftf/ActionGroup/AdminDeleteSearchTermActionGroup.xml delete mode 100644 app/code/Magento/Search/Test/Mftf/ActionGroup/AdminSearchTermActionGroup.xml create mode 100644 app/code/Magento/Search/Test/Mftf/ActionGroup/AdminSearchTermFilterBySearchQueryActionGroup.xml diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontUpdateSearchTermEntityTest.xml b/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontUpdateSearchTermEntityTest.xml index 3ebb09f3c9c26..6c475ddc60a95 100644 --- a/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontUpdateSearchTermEntityTest.xml +++ b/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontUpdateSearchTermEntityTest.xml @@ -18,7 +18,7 @@ <group value="search"/> <group value="mtf_migrated"/> </annotations> - + <before> <createData entity="_defaultCategory" stepKey="createCategory1"/> <createData entity="SimpleProduct" stepKey="createProduct1"> @@ -44,7 +44,7 @@ <amOnPage url="{{AdminCatalogSearchTermIndexPage.url}}" stepKey="openAdminCatalogSearchTermIndexPage1"/> <waitForPageLoad stepKey="waitForPageLoad1"/> - <actionGroup ref="searchTermFilterBySearchQuery" stepKey="filterByFirstSearchQuery1"> + <actionGroup ref="AdminSearchTermFilterBySearchQueryActionGroup" stepKey="filterByFirstSearchQuery1"> <argument name="searchQuery" value="$$createProduct1.name$$"/> </actionGroup> @@ -58,7 +58,7 @@ <amOnPage url="{{AdminCatalogSearchTermIndexPage.url}}" stepKey="openAdminCatalogSearchTermIndexPage2"/> <waitForPageLoad stepKey="waitForPageLoad3"/> - <actionGroup ref="searchTermFilterBySearchQuery" stepKey="filterByFirstSearchQuery2"> + <actionGroup ref="AdminSearchTermFilterBySearchQueryActionGroup" stepKey="filterByFirstSearchQuery2"> <argument name="searchQuery" value="{{UpdatedSearchTermData1.query_text}}"/> </actionGroup> diff --git a/app/code/Magento/Search/Test/Mftf/ActionGroup/AdminDeleteAllSearchTermsActionGroup.xml b/app/code/Magento/Search/Test/Mftf/ActionGroup/AdminDeleteAllSearchTermsActionGroup.xml new file mode 100644 index 0000000000000..be01df1bcf5a7 --- /dev/null +++ b/app/code/Magento/Search/Test/Mftf/ActionGroup/AdminDeleteAllSearchTermsActionGroup.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminDeleteAllSearchTermsActionGroup"> + <selectOption userInput="selectAll" selector="{{AdminCatalogSearchTermIndexSection.selectMassActionCheckbox}}" stepKey="checkAllSearchTerms"/> + <selectOption selector="{{AdminCatalogSearchTermIndexSection.massActions}}" userInput="delete" stepKey="selectDeleteOption"/> + <click selector="{{AdminCatalogSearchTermIndexSection.submit}}" stepKey="clickSubmitButton"/> + <click selector="{{AdminCatalogSearchTermIndexSection.okButton}}" stepKey="clickOkButton"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Search/Test/Mftf/ActionGroup/AdminDeleteSearchTermActionGroup.xml b/app/code/Magento/Search/Test/Mftf/ActionGroup/AdminDeleteSearchTermActionGroup.xml new file mode 100644 index 0000000000000..2013dfcf0e3b2 --- /dev/null +++ b/app/code/Magento/Search/Test/Mftf/ActionGroup/AdminDeleteSearchTermActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminDeleteSearchTermActionGroup"> + <annotations> + <description>Deletes the Search Terms in the Admin Search Term grid.</description> + </annotations> + + <selectOption selector="{{AdminCatalogSearchTermIndexSection.massActions}}" userInput="delete" stepKey="selectDeleteOption"/> + <click selector="{{AdminCatalogSearchTermIndexSection.submit}}" stepKey="clickSubmitButton"/> + <click selector="{{AdminCatalogSearchTermIndexSection.okButton}}" stepKey="clickOkButton"/> + <waitForElementVisible selector="{{AdminCatalogSearchTermMessagesSection.successMessage}}" stepKey="waitForSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Search/Test/Mftf/ActionGroup/AdminSearchTermActionGroup.xml b/app/code/Magento/Search/Test/Mftf/ActionGroup/AdminSearchTermActionGroup.xml deleted file mode 100644 index aeadf69050912..0000000000000 --- a/app/code/Magento/Search/Test/Mftf/ActionGroup/AdminSearchTermActionGroup.xml +++ /dev/null @@ -1,47 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <!-- Filter by search query and select --> - <actionGroup name="searchTermFilterBySearchQuery"> - <annotations> - <description>Fills in the provided Search Query on the Admin Search Term grid page.</description> - </annotations> - <arguments> - <argument name="searchQuery" type="string"/> - </arguments> - - <click selector="{{AdminCatalogSearchTermIndexSection.resetFilterButton}}" stepKey="clickOnResetButton"/> - <waitForPageLoad stepKey="waitForResetFilter"/> - <fillField selector="{{AdminCatalogSearchTermIndexSection.searchQuery}}" userInput="{{searchQuery}}" stepKey="fillSearchQuery"/> - <click selector="{{AdminCatalogSearchTermIndexSection.searchButton}}" stepKey="clickSearchButton"/> - <waitForPageLoad stepKey="waitForSearchResultLoad"/> - <checkOption selector="{{AdminCatalogSearchTermIndexSection.searchTermRowCheckboxBySearchQuery(searchQuery)}}" stepKey="checkCheckBox"/> - </actionGroup> - - <!-- Delete search term --> - <actionGroup name="deleteSearchTerm"> - <annotations> - <description>Deletes the Search Terms in the Admin Search Term grid.</description> - </annotations> - - <selectOption selector="{{AdminCatalogSearchTermIndexSection.massActions}}" userInput="delete" stepKey="selectDeleteOption"/> - <click selector="{{AdminCatalogSearchTermIndexSection.submit}}" stepKey="clickSubmitButton"/> - <click selector="{{AdminCatalogSearchTermIndexSection.okButton}}" stepKey="clickOkButton"/> - <waitForElementVisible selector="{{AdminCatalogSearchTermMessagesSection.successMessage}}" stepKey="waitForSuccessMessage"/> - </actionGroup> - - <!-- Delete all existing search terms --> - <actionGroup name="DeleteAllSearchTerms"> - <selectOption userInput="selectAll" selector="{{AdminCatalogSearchTermIndexSection.selectMassActionCheckbox}}" stepKey="checkAllSearchTerms"/> - <selectOption selector="{{AdminCatalogSearchTermIndexSection.massActions}}" userInput="delete" stepKey="selectDeleteOption"/> - <click selector="{{AdminCatalogSearchTermIndexSection.submit}}" stepKey="clickSubmitButton"/> - <click selector="{{AdminCatalogSearchTermIndexSection.okButton}}" stepKey="clickOkButton"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Search/Test/Mftf/ActionGroup/AdminSearchTermFilterBySearchQueryActionGroup.xml b/app/code/Magento/Search/Test/Mftf/ActionGroup/AdminSearchTermFilterBySearchQueryActionGroup.xml new file mode 100644 index 0000000000000..4536b0126b872 --- /dev/null +++ b/app/code/Magento/Search/Test/Mftf/ActionGroup/AdminSearchTermFilterBySearchQueryActionGroup.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <!-- Filter by search query and select --> + <actionGroup name="AdminSearchTermFilterBySearchQueryActionGroup"> + <annotations> + <description>Fills in the provided Search Query on the Admin Search Term grid page.</description> + </annotations> + <arguments> + <argument name="searchQuery" type="string"/> + </arguments> + + <click selector="{{AdminCatalogSearchTermIndexSection.resetFilterButton}}" stepKey="clickOnResetButton"/> + <waitForPageLoad stepKey="waitForResetFilter"/> + <fillField selector="{{AdminCatalogSearchTermIndexSection.searchQuery}}" userInput="{{searchQuery}}" stepKey="fillSearchQuery"/> + <click selector="{{AdminCatalogSearchTermIndexSection.searchButton}}" stepKey="clickSearchButton"/> + <waitForPageLoad stepKey="waitForSearchResultLoad"/> + <checkOption selector="{{AdminCatalogSearchTermIndexSection.searchTermRowCheckboxBySearchQuery(searchQuery)}}" stepKey="checkCheckBox"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Search/Test/Mftf/Test/AdminMassDeleteSearchTermEntityTest.xml b/app/code/Magento/Search/Test/Mftf/Test/AdminMassDeleteSearchTermEntityTest.xml index 67ccb51bf401e..37be694522b17 100644 --- a/app/code/Magento/Search/Test/Mftf/Test/AdminMassDeleteSearchTermEntityTest.xml +++ b/app/code/Magento/Search/Test/Mftf/Test/AdminMassDeleteSearchTermEntityTest.xml @@ -38,18 +38,18 @@ <waitForPageLoad stepKey="waitForAdminCatalogSearchTermIndexPageLoad"/> <!-- Select all created below search terms --> - <actionGroup ref="searchTermFilterBySearchQuery" stepKey="filterByFirstSearchQuery"> + <actionGroup ref="AdminSearchTermFilterBySearchQueryActionGroup" stepKey="filterByFirstSearchQuery"> <argument name="searchQuery" value="$$createFirstSearchTerm.query_text$$"/> </actionGroup> - <actionGroup ref="searchTermFilterBySearchQuery" stepKey="filterBySecondSearchQuery"> + <actionGroup ref="AdminSearchTermFilterBySearchQueryActionGroup" stepKey="filterBySecondSearchQuery"> <argument name="searchQuery" value="$$createSecondSearchTerm.query_text$$"/> </actionGroup> - <actionGroup ref="searchTermFilterBySearchQuery" stepKey="filterByThirdSearchQuery"> + <actionGroup ref="AdminSearchTermFilterBySearchQueryActionGroup" stepKey="filterByThirdSearchQuery"> <argument name="searchQuery" value="$$createThirdSearchTerm.query_text$$"/> </actionGroup> <!-- Delete created below search terms --> - <actionGroup ref="deleteSearchTerm" stepKey="deleteSearchTerms"/> + <actionGroup ref="AdminDeleteSearchTermActionGroup" stepKey="deleteSearchTerms"/> <!-- Assert search terms are absent on the search term page --> <actionGroup ref="AssertSearchTermNotInGrid" stepKey="assertFirstSearchTermNotInGrid"> diff --git a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductDescriptionTest.xml b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductDescriptionTest.xml index c5124ac9c74a1..261a029be995a 100644 --- a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductDescriptionTest.xml +++ b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductDescriptionTest.xml @@ -27,7 +27,7 @@ <waitForPageLoad stepKey="waitForAdminCatalogSearchTermIndexPageLoad"/> <!-- Delete all search terms --> <comment userInput="Delete all search terms" stepKey="deleteAllSearchTermsComment"/> - <actionGroup ref="DeleteAllSearchTerms" stepKey="deleteAllSearchTerms"/> + <actionGroup ref="AdminDeleteAllSearchTermsActionGroup" stepKey="deleteAllSearchTerms"/> <actionGroup ref="deleteAllProductsUsingProductGrid" stepKey="deleteAllProducts"/> <!-- Create product with description --> <comment userInput="Create product with description" stepKey="createProductWithDescriptionComment"/> @@ -47,12 +47,12 @@ <waitForPageLoad stepKey="waitForAdminCatalogSearchTermIndexPageLoad"/> <!-- Filter the search term --> <comment userInput="Filter search term" stepKey="filterSearchTermComment"/> - <actionGroup ref="searchTermFilterBySearchQuery" stepKey="filterByThirdSearchQuery"> + <actionGroup ref="AdminSearchTermFilterBySearchQueryActionGroup" stepKey="filterByThirdSearchQuery"> <argument name="searchQuery" value="{{ApiProductDescription.value}}"/> </actionGroup> <!-- Delete created below search terms --> <comment userInput="Delete created below search terms" stepKey="deleteCreatedBelowSearchTermsComment"/> - <actionGroup ref="deleteSearchTerm" stepKey="deleteSearchTerms"/> + <actionGroup ref="AdminDeleteSearchTermActionGroup" stepKey="deleteSearchTerms"/> <actionGroup ref="logout" stepKey="logout"/> </after> <!-- Go to storefront home page --> @@ -79,7 +79,7 @@ <waitForPageLoad stepKey="waitForAdminCatalogSearchTermIndexPageLoad"/> <!-- Filter the search term --> <comment userInput="Filter search term" stepKey="filterSearchTermComment2"/> - <actionGroup ref="searchTermFilterBySearchQuery" stepKey="filterByThirdSearchQuery"> + <actionGroup ref="AdminSearchTermFilterBySearchQueryActionGroup" stepKey="filterByThirdSearchQuery"> <argument name="searchQuery" value="{{ApiProductDescription.value}}"/> </actionGroup> <!-- Assert Search Term in grid --> diff --git a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductNameTest.xml b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductNameTest.xml index e49db08954e14..fc933c90341f9 100644 --- a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductNameTest.xml +++ b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductNameTest.xml @@ -38,11 +38,11 @@ <waitForPageLoad stepKey="waitForAdminCatalogSearchTermIndexPageLoad"/> <!--Filter the search term --> - <actionGroup ref="searchTermFilterBySearchQuery" stepKey="filterByThirdSearchQuery"> + <actionGroup ref="AdminSearchTermFilterBySearchQueryActionGroup" stepKey="filterByThirdSearchQuery"> <argument name="searchQuery" value="$$simpleProduct.name$$"/> </actionGroup> <!-- Delete created below search terms --> - <actionGroup ref="deleteSearchTerm" stepKey="deleteSearchTerms"/> + <actionGroup ref="AdminDeleteSearchTermActionGroup" stepKey="deleteSearchTerms"/> <actionGroup ref="logout" stepKey="logout"/> </after> diff --git a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductShortDescriptionTest.xml b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductShortDescriptionTest.xml index a1aa8be999aea..65472b9e10282 100644 --- a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductShortDescriptionTest.xml +++ b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductShortDescriptionTest.xml @@ -39,12 +39,12 @@ <waitForPageLoad stepKey="waitForAdminCatalogSearchTermIndexPageLoad"/> <!--Filter the search term --> - <actionGroup ref="searchTermFilterBySearchQuery" stepKey="filterByThirdSearchQuery"> + <actionGroup ref="AdminSearchTermFilterBySearchQueryActionGroup" stepKey="filterByThirdSearchQuery"> <argument name="searchQuery" value="{{ApiProductShortDescription.value}}"/> </actionGroup> <!-- Delete created below search terms --> - <actionGroup ref="deleteSearchTerm" stepKey="deleteSearchTerms"/> + <actionGroup ref="AdminDeleteSearchTermActionGroup" stepKey="deleteSearchTerms"/> <actionGroup ref="logout" stepKey="logout"/> </after> diff --git a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductSkuTest.xml b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductSkuTest.xml index 3a8443706c9c7..6e80823b78e0f 100644 --- a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductSkuTest.xml +++ b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductSkuTest.xml @@ -39,12 +39,12 @@ <waitForPageLoad stepKey="waitForAdminCatalogSearchTermIndexPageLoad"/> <!--Filter the search term --> - <actionGroup ref="searchTermFilterBySearchQuery" stepKey="filterByThirdSearchQuery"> + <actionGroup ref="AdminSearchTermFilterBySearchQueryActionGroup" stepKey="filterByThirdSearchQuery"> <argument name="searchQuery" value="$$simpleProduct.sku$$"/> </actionGroup> <!-- Delete created below search terms --> - <actionGroup ref="deleteSearchTerm" stepKey="deleteSearchTerms"/> + <actionGroup ref="AdminDeleteSearchTermActionGroup" stepKey="deleteSearchTerms"/> <actionGroup ref="logout" stepKey="logout"/> </after> From f2d3f07e423452964a55bc5038512241fa34bff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 28 Nov 2019 15:52:16 +0100 Subject: [PATCH 0158/1143] REFACTOR: Extract Action Groups to separate files (according to MFTF best practices) --- ...thOnlinePaymentIncludingTaxAndDiscount.xml | 2 +- .../AdminApplyCatalogRuleByCategoryTest.xml | 2 +- .../Test/AdminCreateCatalogPriceRuleTest.xml | 4 +- .../Test/AdminDeleteCatalogPriceRuleTest.xml | 2 +- .../StorefrontInactiveCatalogRuleTest.xml | 2 +- ...eForConfigurableProductWithOptionsTest.xml | 6 +- ...gRecalculationAfterCouponCodeAddedTest.xml | 2 +- ...SubtotalOrdersWithProcessingStatusTest.xml | 2 +- ...ConfigurableWithCatalogRuleAppliedTest.xml | 2 +- ...editMemoTotalAfterShippingDiscountTest.xml | 2 +- .../AdminCartPriceRuleActionGroup.xml | 80 --------- ...AdminCartPriceRuleNotInGridActionGroup.xml | 20 +++ .../AdminCreateCartPriceRuleActionGroup.xml | 162 ------------------ ...tionsSectionDiscountFieldsActionGroup.xml} | 27 --- ...eActionsSectionFreeShippingActionGroup.xml | 21 +++ ...ctionsSectionShippingAmountActionGroup.xml | 18 ++ ...tionsSectionSubsequentRulesActionGroup.xml | 18 ++ ...riceRuleActionsWithSubtotalActionGroup.xml | 38 ++++ ...eCartPriceRuleAndStayOnEditActionGroup.xml | 18 ++ ...RuleWithConditionIsCategoryActionGroup.xml | 34 ++++ ...CartPriceRuleWithConditionsActionGroup.xml | 46 +++++ ...CartPriceRuleWithCouponCodeActionGroup.xml | 28 +++ ...teMultiWebsiteCartPriceRuleActionGroup.xml | 23 +++ ...eteCartPriceRuleForRetailerActionGroup.xml | 24 +++ .../AdminFilterCartPriceRuleActionGroup.xml | 12 +- .../AdminInactiveCartPriceRuleActionGroup.xml | 18 ++ ...eCartPriceRuleSecondWebsiteActionGroup.xml | 25 +++ ...ectNotLoggedInCustomerGroupActionGroup.xml | 19 ++ ...SelectRetailerCustomerGroupActionGroup.xml | 19 ++ ...teConditionForCartPriceRuleActionGroup.xml | 34 ++++ ...onForActionsInCartPriceRuleActionGroup.xml | 37 ++++ .../StorefrontApplyCouponActionGroup.xml | 27 +++ .../StorefrontCancelCouponActionGroup.xml | 21 +++ ...torefrontCheckCouponAppliedActionGroup.xml | 24 +++ .../StorefrontSalesRuleActionGroup.xml | 76 -------- .../VerifyDiscountAmountActionGroup.xml | 32 ++++ ...inCartRulesAppliedForProductInCartTest.xml | 2 +- .../Mftf/Test/AdminCreateBuyXGetYFreeTest.xml | 2 +- ...inCreateCartPriceRuleEmptyFromDateTest.xml | 2 +- .../AdminCreateFixedAmountDiscountTest.xml | 2 +- ...CreateFixedAmountWholeCartDiscountTest.xml | 2 +- .../AdminCreatePercentOfProductPriceTest.xml | 2 +- ...PercentPriceAndVerifyDeleteMessageTest.xml | 4 +- ...artPriceRuleForConfigurableProductTest.xml | 4 +- .../Test/StorefrontCartPriceRuleCountry.xml | 2 +- .../Test/StorefrontCartPriceRulePostcode.xml | 2 +- .../Test/StorefrontCartPriceRuleQuantity.xml | 2 +- .../Test/StorefrontCartPriceRuleState.xml | 2 +- .../Test/StorefrontCartPriceRuleSubtotal.xml | 2 +- 49 files changed, 573 insertions(+), 384 deletions(-) delete mode 100644 app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCartPriceRuleActionGroup.xml create mode 100644 app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCartPriceRuleNotInGridActionGroup.xml rename app/code/Magento/SalesRule/Test/Mftf/ActionGroup/{AdminCreateCartPriceRuleActionsSectionActionGroup.xml => AdminCreateCartPriceRuleActionsSectionDiscountFieldsActionGroup.xml} (55%) create mode 100644 app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionsSectionFreeShippingActionGroup.xml create mode 100644 app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionsSectionShippingAmountActionGroup.xml create mode 100644 app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionsSectionSubsequentRulesActionGroup.xml create mode 100644 app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionsWithSubtotalActionGroup.xml create mode 100644 app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleAndStayOnEditActionGroup.xml create mode 100644 app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleWithConditionIsCategoryActionGroup.xml create mode 100644 app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleWithConditionsActionGroup.xml create mode 100644 app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleWithCouponCodeActionGroup.xml create mode 100644 app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateMultiWebsiteCartPriceRuleActionGroup.xml create mode 100644 app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminDeleteCartPriceRuleForRetailerActionGroup.xml create mode 100644 app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminInactiveCartPriceRuleActionGroup.xml create mode 100644 app/code/Magento/SalesRule/Test/Mftf/ActionGroup/CreateCartPriceRuleSecondWebsiteActionGroup.xml create mode 100644 app/code/Magento/SalesRule/Test/Mftf/ActionGroup/SelectNotLoggedInCustomerGroupActionGroup.xml create mode 100644 app/code/Magento/SalesRule/Test/Mftf/ActionGroup/SelectRetailerCustomerGroupActionGroup.xml create mode 100644 app/code/Magento/SalesRule/Test/Mftf/ActionGroup/SetCartAttributeConditionForCartPriceRuleActionGroup.xml create mode 100644 app/code/Magento/SalesRule/Test/Mftf/ActionGroup/SetConditionForActionsInCartPriceRuleActionGroup.xml create mode 100644 app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontApplyCouponActionGroup.xml create mode 100644 app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontCancelCouponActionGroup.xml create mode 100644 app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontCheckCouponAppliedActionGroup.xml delete mode 100644 app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontSalesRuleActionGroup.xml create mode 100644 app/code/Magento/SalesRule/Test/Mftf/ActionGroup/VerifyDiscountAmountActionGroup.xml diff --git a/app/code/Magento/Braintree/Test/Mftf/Test/CretateAdminOrderWithOnlinePaymentIncludingTaxAndDiscount.xml b/app/code/Magento/Braintree/Test/Mftf/Test/CretateAdminOrderWithOnlinePaymentIncludingTaxAndDiscount.xml index 8f0ce4918b978..98e075809b441 100644 --- a/app/code/Magento/Braintree/Test/Mftf/Test/CretateAdminOrderWithOnlinePaymentIncludingTaxAndDiscount.xml +++ b/app/code/Magento/Braintree/Test/Mftf/Test/CretateAdminOrderWithOnlinePaymentIncludingTaxAndDiscount.xml @@ -81,7 +81,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"/> - <actionGroup ref="selectRetailerCustomerGroup" stepKey="selectRetailerCustomerGroup"/> + <actionGroup ref="SelectRetailerCustomerGroupActionGroup" stepKey="selectRetailerCustomerGroup"/> <click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickToExpandActions"/> <selectOption selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="Percent of product price discount" stepKey="selectActionType"/> <fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="10" stepKey="fillDiscountAmount"/> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminApplyCatalogRuleByCategoryTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminApplyCatalogRuleByCategoryTest.xml index ca534ec7f5375..d7d7da58c27fc 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminApplyCatalogRuleByCategoryTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminApplyCatalogRuleByCategoryTest.xml @@ -74,7 +74,7 @@ <selectOption selector="{{AdminNewCatalogPriceRuleActions.disregardRules}}" userInput="Yes" stepKey="discardSubsequentRules"/> <scrollToTopOfPage stepKey="scrollToTop"/> <waitForPageLoad stepKey="waitForApplied"/> - <actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="selectNotLoggedInCustomerGroup"/> + <actionGroup ref="SelectNotLoggedInCustomerGroupActionGroup" stepKey="selectNotLoggedInCustomerGroup"/> <!-- 3. Save and apply the new catalog price rule --> <click selector="{{AdminNewCatalogPriceRule.saveAndApply}}" stepKey="saveAndApply"/> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminCreateCatalogPriceRuleTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminCreateCatalogPriceRuleTest.xml index ee61af180d350..c8669f551c32e 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminCreateCatalogPriceRuleTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminCreateCatalogPriceRuleTest.xml @@ -32,7 +32,7 @@ <!-- log in and create the price rule --> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <actionGroup stepKey="createNewPriceRule" ref="newCatalogPriceRuleByUI"/> - <actionGroup stepKey="selectNotLoggedInCustomerGroup" ref="selectNotLoggedInCustomerGroup"/> + <actionGroup stepKey="selectNotLoggedInCustomerGroup" ref="SelectNotLoggedInCustomerGroupActionGroup"/> <click stepKey="saveAndApply" selector="{{AdminNewCatalogPriceRule.saveAndApply}}"/> <see stepKey="assertSuccess" selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the rule."/> </before> @@ -173,7 +173,7 @@ <!-- Create a catalog rule for the NOT LOGGED IN customer group --> <actionGroup ref="newCatalogPriceRuleByUI" stepKey="createNewPriceRule"/> - <actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="selectNotLoggedInCustomerGroup"/> + <actionGroup ref="SelectNotLoggedInCustomerGroupActionGroup" stepKey="selectNotLoggedInCustomerGroup"/> <click selector="{{AdminNewCatalogPriceRule.saveAndApply}}" stepKey="saveAndApply"/> <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the rule." stepKey="assertSuccess"/> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleTest.xml index 16fbca2697702..bd36c55d38f01 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleTest.xml @@ -48,7 +48,7 @@ <!-- Create a catalog price rule --> <actionGroup ref="newCatalogPriceRuleByUI" stepKey="createNewPriceRule"/> - <actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="selectNotLoggedInCustomerGroup"/> + <actionGroup ref="SelectNotLoggedInCustomerGroupActionGroup" stepKey="selectNotLoggedInCustomerGroup"/> <click selector="{{AdminNewCatalogPriceRule.saveAndApply}}" stepKey="saveAndApply"/> <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the rule." stepKey="assertSuccess"/> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/StorefrontInactiveCatalogRuleTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/StorefrontInactiveCatalogRuleTest.xml index 08e59c6316411..7ff63fd11c194 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/StorefrontInactiveCatalogRuleTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/StorefrontInactiveCatalogRuleTest.xml @@ -25,7 +25,7 @@ <requiredEntity createDataKey="createCategory"/> </createData> <actionGroup stepKey="createNewPriceRule" ref="newCatalogPriceRuleByUI"/> - <actionGroup stepKey="selectLoggedInCustomers" ref="selectNotLoggedInCustomerGroup"/> + <actionGroup stepKey="selectLoggedInCustomers" ref="SelectNotLoggedInCustomerGroupActionGroup"/> <scrollToTopOfPage stepKey="scrollToTop"/> <click stepKey="setInactive" selector="{{AdminCategoryBasicFieldSection.enableCategoryLabel}}"/> <click selector="{{AdminNewCatalogPriceRule.saveAndApply}}" stepKey="saveAndApply"/> diff --git a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptionsTest.xml b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptionsTest.xml index e53e51c626aa9..920d839a1f2a0 100644 --- a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptionsTest.xml +++ b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptionsTest.xml @@ -129,7 +129,7 @@ <actionGroup ref="newCatalogPriceRuleByUI" stepKey="createFirstPriceRule"> <argument name="catalogRule" value="CatalogRuleToFixed"/> </actionGroup> - <actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="selectNotLoggedInCustomerGroupForFirstPriceRule"/> + <actionGroup ref="SelectNotLoggedInCustomerGroupActionGroup" stepKey="selectNotLoggedInCustomerGroupForFirstPriceRule"/> <actionGroup ref="CreateCatalogPriceRuleConditionWithAttributeAndOptionActionGroup" stepKey="createFirstCatalogPriceRuleCondition"> <argument name="attributeName" value="$$createConfigProductAttribute.attribute[frontend_labels][0][label]$$"/> <argument name="targetSelectValue" value="$$createConfigProductAttributeFirstOption.option[store_labels][1][label]$$"/> @@ -143,7 +143,7 @@ <actionGroup ref="newCatalogPriceRuleByUI" stepKey="createSecondPriceRule"> <argument name="catalogRule" value="_defaultCatalogRule"/> </actionGroup> - <actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="selectNotLoggedInCustomerGroupForSecondPriceRule"/> + <actionGroup ref="SelectNotLoggedInCustomerGroupActionGroup" stepKey="selectNotLoggedInCustomerGroupForSecondPriceRule"/> <actionGroup ref="CreateCatalogPriceRuleConditionWithAttributeAndOptionActionGroup" stepKey="createSecondCatalogPriceRuleCondition"> <argument name="attributeName" value="$$createConfigProductAttribute.attribute[frontend_labels][0][label]$$"/> <argument name="targetSelectValue" value="$$createConfigProductAttributeSecondOption.option[store_labels][1][label]$$"/> @@ -157,7 +157,7 @@ <actionGroup ref="newCatalogPriceRuleByUI" stepKey="createThirdPriceRule"> <argument name="catalogRule" value="CatalogRuleWithoutDiscount"/> </actionGroup> - <actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="selectNotLoggedInCustomerGroupForThirdPriceRule"/> + <actionGroup ref="SelectNotLoggedInCustomerGroupActionGroup" stepKey="selectNotLoggedInCustomerGroupForThirdPriceRule"/> <actionGroup ref="CreateCatalogPriceRuleConditionWithAttributeAndOptionActionGroup" stepKey="createThirdCatalogPriceRuleCondition"> <argument name="attributeName" value="$$createConfigProductAttribute.attribute[frontend_labels][0][label]$$"/> <argument name="targetSelectValue" value="$$createConfigProductAttributeThirdOption.option[store_labels][1][label]$$"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontFreeShippingRecalculationAfterCouponCodeAddedTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontFreeShippingRecalculationAfterCouponCodeAddedTest.xml index 330a026bb9426..8a2990c5869c9 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontFreeShippingRecalculationAfterCouponCodeAddedTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontFreeShippingRecalculationAfterCouponCodeAddedTest.xml @@ -34,7 +34,7 @@ <createData entity="FreeShippingMethodsSettingConfig" stepKey="freeShippingMethodsSettingConfig"/> <createData entity="MinimumOrderAmount90" stepKey="minimumOrderAmount90"/> <magentoCLI command="cache:flush" stepKey="flushCache1"/> - <actionGroup ref="AdminCreateCartPriceRuleWithCouponCode" stepKey="createCartPriceRule"> + <actionGroup ref="AdminCreateCartPriceRuleWithCouponCodeActionGroup" stepKey="createCartPriceRule"> <argument name="ruleName" value="CatPriceRule"/> <argument name="couponCode" value="CatPriceRule.coupon_code"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml index 4b3e18fb31877..fe990c359b315 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml @@ -49,7 +49,7 @@ <click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/> <fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{ApiSalesRule.name}}" stepKey="fillRuleName"/> <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Main Website" stepKey="selectWebsite"/> - <actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="chooseNotLoggedInCustomerGroup"/> + <actionGroup ref="SelectNotLoggedInCustomerGroupActionGroup" stepKey="chooseNotLoggedInCustomerGroup"/> <generateDate date="-1 day" format="m/d/Y" stepKey="yesterdayDate"/> <fillField selector="{{AdminCartPriceRulesFormSection.fromDate}}" userInput="{$yesterdayDate}" stepKey="fillFromDate"/> <selectOption selector="{{AdminCartPriceRulesFormSection.coupon}}" userInput="Specific Coupon" stepKey="selectCouponType"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml index bc8f3e49272b7..4dd8d03fa6ba3 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml @@ -136,7 +136,7 @@ <argument name="catalogRule" value="CatalogRuleByPercentWith96Amount" /> <argument name="productSku" value="$$createConfigChildProduct3.sku$$" /> </actionGroup> - <actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="selectNotLoggedInCustomerGroup"/> + <actionGroup ref="SelectNotLoggedInCustomerGroupActionGroup" stepKey="selectNotLoggedInCustomerGroup"/> <click selector="{{AdminNewCatalogPriceRule.saveAndApply}}" stepKey="clickSaveAndApplyRules"/> <magentoCLI command="indexer:reindex" stepKey="reindex"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/CreditMemoTotalAfterShippingDiscountTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/CreditMemoTotalAfterShippingDiscountTest.xml index ec0f97e418c8c..edd5c9841fb6b 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/CreditMemoTotalAfterShippingDiscountTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/CreditMemoTotalAfterShippingDiscountTest.xml @@ -44,7 +44,7 @@ <click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/> <fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{ApiSalesRule.name}}" stepKey="fillRuleName"/> <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Main Website" stepKey="selectWebsite"/> - <actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="chooseNotLoggedInCustomerGroup"/> + <actionGroup ref="SelectNotLoggedInCustomerGroupActionGroup" stepKey="chooseNotLoggedInCustomerGroup"/> <generateDate date="-1 day" format="m/d/Y" stepKey="yesterdayDate"/> <fillField selector="{{AdminCartPriceRulesFormSection.fromDate}}" userInput="{$yesterdayDate}" stepKey="fillFromDate"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCartPriceRuleActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCartPriceRuleActionGroup.xml deleted file mode 100644 index 1bd4d743acdc5..0000000000000 --- a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCartPriceRuleActionGroup.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. - */ ---> - -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="selectNotLoggedInCustomerGroup"> - <annotations> - <description>Selects 'NOT LOGGED IN' from the 'Customer Groups' list (Magento 2 B2B). PLEASE NOTE: The value is Hardcoded.</description> - </annotations> - - <!-- 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> - - <actionGroup name="selectRetailerCustomerGroup"> - <annotations> - <description>Selects 'Retailer' from the 'Customer Groups' list (Magento 2 B2B). PLEASE NOTE: The value is Hardcoded.</description> - </annotations> - - <!-- This actionGroup was created to be merged from B2B. Retailer Customer Group --> - <selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="Retailer" stepKey="selectRetailerCustomerGroup"/> - </actionGroup> - - <!--Set Subtotal condition for Customer Segment--> - <actionGroup name="SetCartAttributeConditionForCartPriceRuleActionGroup"> - <annotations> - <description>Sets the provided Cart Attribute Condition (Attribute Name, Operator Type and Value) on the Admin Cart Price Rule creation/edit page.</description> - </annotations> - <arguments> - <argument name="attributeName" type="string"/> - <argument name="operatorType" defaultValue="is" type="string"/> - <argument name="value" type="string"/> - </arguments> - - <scrollTo selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" stepKey="scrollToActionTab"/> - <conditionalClick selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.conditionsHeaderOpen}}" visible="false" stepKey="openActionTab"/> - <click selector="{{AdminCartPriceRulesFormSection.conditions}}" stepKey="applyRuleForConditions"/> - <waitForPageLoad stepKey="waitForDropDownOpened"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.childAttribute}}" userInput="{{attributeName}}" stepKey="selectAttribute"/> - <waitForPageLoad stepKey="waitForOperatorOpened"/> - <click selector="{{AdminCartPriceRulesFormSection.condition('is')}}" stepKey="clickToChooseOption"/> - <selectOption userInput="{{operatorType}}" selector="{{AdminCartPriceRulesFormSection.conditionsOperator}}" stepKey="setOperatorType"/> - <click selector="{{AdminCartPriceRulesFormSection.condition('...')}}" stepKey="clickToChooseOption1"/> - <fillField userInput="{{value}}" selector="{{AdminCartPriceRulesFormSection.conditionsValue}}" stepKey="fillActionValue"/> - <click selector="{{AdminMainActionsSection.saveAndContinue}}" stepKey="clickSaveButton"/> - <see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/> - </actionGroup> - - <actionGroup name="SetConditionForActionsInCartPriceRuleActionGroup"> - <annotations> - <description>Sets the provided Condition (Actions Aggregator/Value, Child Attribute and Action Value) for Actions on the Admin Cart Price Rule creation/edit page.</description> - </annotations> - <arguments> - <argument name="actionsAggregator" type="string" defaultValue="ANY"/> - <argument name="actionsValue" type="string" defaultValue="FALSE"/> - <argument name="childAttribute" type="string" defaultValue="Category"/> - <argument name="actionValue" type="string"/> - </arguments> - - <click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickOnActionTab"/> - <click selector="{{AdminCartPriceRulesFormSection.condition('ALL')}}" stepKey="clickToChooseOption"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.actionsAggregator}}" userInput="{{actionsAggregator}}" stepKey="selectCondition"/> - <click selector="{{AdminCartPriceRulesFormSection.condition('TRUE')}}" stepKey="clickToChooseOption2"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.actionsValue}}" userInput="{{actionsValue}}" stepKey="selectCondition2"/> - <click selector="{{AdminCartPriceRulesFormSection.conditions}}" stepKey="selectActionConditions"/> - <waitForPageLoad stepKey="waitForDropDownOpened"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.childAttribute}}" userInput="{{childAttribute}}" stepKey="selectAttribute"/> - <waitForPageLoad stepKey="waitForOperatorOpened"/> - <click selector="{{AdminCartPriceRulesFormSection.condition('...')}}" stepKey="clickToChooseOption3"/> - <fillField selector="{{AdminCartPriceRulesFormSection.actionValue}}" userInput="{{actionValue}}" stepKey="fillActionValue"/> - <click selector="{{AdminCartPriceRulesFormSection.applyAction}}" stepKey="applyAction"/> - <click selector="{{AdminMainActionsSection.save}}" stepKey="clickSaveButton"/> - <see selector="{{AdminMessagesSection.success}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCartPriceRuleNotInGridActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCartPriceRuleNotInGridActionGroup.xml new file mode 100644 index 0000000000000..23d7daf03e9c3 --- /dev/null +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCartPriceRuleNotInGridActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCartPriceRuleNotInGridActionGroup" extends="AdminFilterCartPriceRuleActionGroup"> + <annotations> + <description>EXTENDS: AdminFilterCartPriceRuleActionGroup. Removes 'goToEditRulePage'. Validates that the Empty Grid message is present and correct.</description> + </annotations> + + <remove keyForRemoval="goToEditRulePage"/> + <waitForPageLoad stepKey="waitForStoreToLoad"/> + <see selector="{{AdminCartPriceRulesSection.emptyText}}" userInput="We couldn't find any records." stepKey="seeAssertCartPriceRuleIsNotPresentedInGrid"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml index 91ecaff7f83a6..57a2c17419532 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml @@ -28,166 +28,4 @@ <click selector="{{AdminCartPriceRulesFormSection.save}}" stepKey="clickSaveButton"/> <see selector="{{AdminCartPriceRulesFormSection.successMessage}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/> </actionGroup> - - <actionGroup name="AdminCreateCartPriceRuleAndStayOnEditActionGroup" extends="AdminCreateCartPriceRuleActionGroup"> - <annotations> - <description>EXTENDS: AdminCreateCartPriceRuleActionGroup. Clicks on Save and Continue.</description> - </annotations> - - <click selector="{{AdminCartPriceRulesFormSection.saveAndContinue}}" stepKey="clickSaveButton"/> - </actionGroup> - - <actionGroup name="AdminCreateCartPriceRuleWithCouponCode" extends="AdminCreateCartPriceRuleActionGroup"> - <annotations> - <description>EXTENDS: AdminCreateCartPriceRuleActionGroup. Removes 'selectActionType' and 'fillDiscountAmount'. Adds the provided Coupon Code to a Cart Price Rule.</description> - </annotations> - <arguments> - <argument name="couponCode" defaultValue="_defaultCoupon.code"/> - </arguments> - - <remove keyForRemoval="selectActionType"/> - <remove keyForRemoval="fillDiscountAmount"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.coupon}}" userInput="Specific Coupon" stepKey="selectCouponType" after="fillRuleName"/> - <waitForElementVisible selector="{{AdminCartPriceRulesFormSection.couponCode}}" stepKey="waitForElementVisible" after="selectCouponType"/> - <fillField selector="{{AdminCartPriceRulesFormSection.couponCode}}" userInput="{{couponCode}}" stepKey="fillCouponCode" after="waitForElementVisible"/> - <fillField selector="{{AdminCartPriceRulesFormSection.userPerCoupon}}" userInput="99" stepKey="fillUserPerCoupon" after="fillCouponCode"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="Fixed amount discount for whole cart" stepKey="selectActionTypeToFixed" after="clickToExpandActions"/> - <fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="1" stepKey="fillDiscountAmount" after="selectActionTypeToFixed"/> - </actionGroup> - - <!--Delete Cart price Rule for Retailer customer--> - <actionGroup name="AdminDeleteCartPriceRuleForRetailerActionGroup"> - <annotations> - <description>Goes to the Admin Cart Price Rules grid page. Removes the 1st Cart Price Rule in the Grid.</description> - </annotations> - - <amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="goToCartPriceRules"/> - <waitForPageLoad stepKey="waitForCartPriceRules"/> - <fillField selector="{{AdminCartPriceRulesSection.filterByNameInput}}" userInput="{{SimpleSalesRule.name}}" stepKey="filterByName"/> - <click selector="{{AdminCartPriceRulesSection.searchButton}}" stepKey="doFilter"/> - <click selector="{{AdminCartPriceRulesSection.rowByIndex('1')}}" stepKey="goToEditRulePage"/> - <click selector="{{AdminCartPriceRulesFormSection.delete}}" stepKey="clickDeleteButton"/> - <click selector="{{AdminCartPriceRulesFormSection.modalAcceptButton}}" stepKey="confirmDelete"/> - </actionGroup> - - <actionGroup name="AdminCreateCartPriceRuleWithConditions" extends="AdminCreateCartPriceRuleActionGroup"> - <annotations> - <description>EXTENDS: AdminCreateCartPriceRuleActionGroup. Removes 'fillDiscountAmount'. Adds the 2 provided Conditions (Name, Rule, Rule to Change and Category Name) to a Cart Price Rule.</description> - </annotations> - <arguments> - <argument name="condition1" type="string" defaultValue="Products subselection"/> - <argument name="condition2" type="string" defaultValue="Category"/> - <argument name="ruleToChange1" type="string" defaultValue="is"/> - <argument name="rule1" type="string" defaultValue="equals or greater than"/> - <argument name="ruleToChange2" type="string" defaultValue="..."/> - <argument name="rule2" type="string" defaultValue="2"/> - <argument name="categoryName" type="string" defaultValue="_defaultCategory.name"/> - </arguments> - - <remove keyForRemoval="fillDiscountAmount"/> - - <!--Go to Conditions section--> - <click selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" stepKey="openConditionsSection" after="selectActionType"/> - <click selector="{{AdminCartPriceRulesFormSection.addCondition('1')}}" stepKey="addFirstCondition" after="openConditionsSection"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.ruleCondition('1')}}" userInput="{{condition1}}" stepKey="selectRule" after="addFirstCondition"/> - <waitForElementVisible selector="{{AdminCartPriceRulesFormSection.ruleParameter(ruleToChange1)}}" stepKey="waitForFirstRuleElement" after="selectRule"/> - <click selector="{{AdminCartPriceRulesFormSection.ruleParameter(ruleToChange1)}}" stepKey="clickToChangeRule" after="waitForFirstRuleElement"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.ruleParameterSelect('1--1')}}" userInput="{{rule1}}" stepKey="selectRule1" after="clickToChangeRule"/> - <waitForElementVisible selector="{{AdminCartPriceRulesFormSection.ruleParameter(ruleToChange2)}}" stepKey="waitForSecondRuleElement" after="selectRule1"/> - <click selector="{{AdminCartPriceRulesFormSection.ruleParameter(ruleToChange2)}}" stepKey="clickToChangeRule1" after="waitForSecondRuleElement"/> - <fillField selector="{{AdminCartPriceRulesFormSection.ruleParameterInput('1--1')}}" userInput="{{rule2}}" stepKey="fillRule" after="clickToChangeRule1"/> - <click selector="{{AdminCartPriceRulesFormSection.addCondition('1--1')}}" stepKey="addSecondCondition" after="fillRule"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.ruleCondition('1--1')}}" userInput="{{condition2}}" stepKey="selectSecondCondition" after="addSecondCondition"/> - <waitForElementVisible selector="{{AdminCartPriceRulesFormSection.ruleParameter(ruleToChange2)}}" stepKey="waitForThirdRuleElement" after="selectSecondCondition"/> - <click selector="{{AdminCartPriceRulesFormSection.ruleParameter(ruleToChange2)}}" stepKey="addThirdCondition" after="waitForThirdRuleElement"/> - <waitForElementVisible selector="{{AdminCartPriceRulesFormSection.openChooser('1--1--1')}}" stepKey="waitForForthRuleElement" after="addThirdCondition"/> - <click selector="{{AdminCartPriceRulesFormSection.openChooser('1--1--1')}}" stepKey="openChooser" after="waitForForthRuleElement"/> - <waitForElementVisible selector="{{AdminCartPriceRulesFormSection.categoryCheckbox(categoryName)}}" stepKey="waitForCategoryVisible" after="openChooser"/> - <checkOption selector="{{AdminCartPriceRulesFormSection.categoryCheckbox(categoryName)}}" stepKey="checkCategoryName" after="waitForCategoryVisible"/> - </actionGroup> - <actionGroup name="AdminCreateCartPriceRuleActionsWithSubtotalActionGroup" extends="AdminCreateCartPriceRuleActionGroup"> - <annotations> - <description>EXTENDS: AdminCreateCartPriceRuleActionGroup. Removes 'fillDiscountAmount'. Adds sub total conditions for free shipping to a Cart Price Rule.</description> - </annotations> - <arguments> - <argument name="ruleName"/> - </arguments> - <remove keyForRemoval="fillDiscountAmount"/> - <!-- Expand the conditions section --> - <grabTextFrom selector="{{AdminCartPriceRulesFormSection.ruleName}}" after="fillRuleName" stepKey="getSubtotalRule"/> - <click selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" stepKey="openConditionsSection" after="selectActionType"/> - <click selector="{{AdminCartPriceRulesFormSection.addCondition('1')}}" after="openConditionsSection" stepKey="addFirstCondition"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.conditionSelect}}" userInput="{{ruleName.condition1}}" after="addFirstCondition" stepKey="selectCondition1"/> - <waitForPageLoad after="selectCondition1" stepKey="waitForConditionLoad"/> - <click selector="{{AdminCartPriceRulesFormSection.condition(ruleName.ruleToChange1)}}" after="waitForConditionLoad" stepKey="clickToChooseOption"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.conditionsOperator}}" userInput="{{ruleName.rule1}}" after="clickToChooseOption" stepKey="setOperatorType"/> - <click selector="{{AdminCartPriceRulesFormSection.targetEllipsis}}" after="setOperatorType" stepKey="clickEllipsis"/> - <fillField selector="{{AdminCartPriceRulesFormSection.ruleFieldByIndex('1--1')}}" userInput="{{ruleName.subtotal}}" after="clickEllipsis" stepKey="fillSubtotalParameter"/> - <click selector="{{AdminCartPriceRulesFormSection.addNewCondition('1')}}" after="fillSubtotalParameter" stepKey="clickOnTheAddNewCondition"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.conditionSelectDropdown('1')}}" userInput="{{ruleName.condition2}}" after="clickOnTheAddNewCondition" stepKey="selectSecondCondition"/> - <waitForPageLoad after="selectSecondCondition" stepKey="waitForConditionLoad2"/> - <click selector="{{AdminCartPriceRulesFormSection.targetEllipsis}}" after="waitForConditionLoad2" stepKey="clickEllipsis2"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.ruleFieldByIndex('1--2')}}" userInput="{{ruleName.shippingMethod}}" after="clickEllipsis2" stepKey="selectShippingMethod"/> - <click selector="{{AdminCartPriceRulesFormSection.applyToShippingAmount}}" after="selectShippingMethod" stepKey="clickApplyToShipping"/> - <click selector="{{AdminCartPriceRulesFormSection.discardSubsequentRules}}" after="clickApplyToShipping" stepKey="clickDiscardSubsequentRules"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.freeShipping}}" userInput="{{ruleName.simple_free_shipping}}" after="clickDiscardSubsequentRules" stepKey="selectForMatchingItemsOnly"/> - </actionGroup> - <actionGroup name="AdminCreateMultiWebsiteCartPriceRuleActionGroup" extends="AdminCreateCartPriceRuleActionGroup"> - <annotations> - <description>EXTENDS: AdminCreateCartPriceRuleActionGroup. Removes 'clickSaveButton' for the next data changing. Assign cart price rule to 2 websites instead of 1.</description> - </annotations> - <arguments> - <argument name="ruleName"/> - </arguments> - <remove keyForRemoval="clickSaveButton"/> - <remove keyForRemoval="seeSuccessMessage"/> - <remove keyForRemoval="selectWebsites"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" parameterArray="['FirstWebsite', 'SecondWebsite']" stepKey="selectWebsites" after="fillRuleName"/> - </actionGroup> - <actionGroup name="CreateCartPriceRuleSecondWebsiteActionGroup"> - <annotations> - <description>Goes to the Admin Cart Price Rule grid page. Clicks on Add New Rule. Fills the provided Rule (Name). Selects 'Second Website' from the 'Websites' menu.</description> - </annotations> - <arguments> - <argument name="ruleName"/> - </arguments> - - <amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceList"/> - <waitForPageLoad stepKey="waitForPriceList"/> - <click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/> - <fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{ruleName.name}}" stepKey="fillRuleName"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Second Website" stepKey="selectWebsites"/> - </actionGroup> - - <actionGroup name="AdminInactiveCartPriceRuleActionGroup" extends="AdminCreateCartPriceRuleActionGroup"> - <annotations> - <description>EXTENDS: AdminCreateCartPriceRuleActionGroup. Clicks on 'Active'.</description> - </annotations> - - <click selector="{{AdminCartPriceRulesFormSection.active}}" stepKey="clickActiveToDisable" after="fillRuleName"/> - </actionGroup> - - <actionGroup name="AdminCreateCartPriceRuleWithConditionIsCategoryActionGroup" extends="AdminCreateCartPriceRuleActionGroup"> - <annotations> - <description>EXTENDS: AdminCreateCartPriceRuleActionGroup. Sets the provide Condition (Actions Aggregator/Value, Child Attribute and Action Value) for Actions on the Admin Cart Price Rule creation/edit page.</description> - </annotations> - <arguments> - <argument name="actionsAggregator" type="string" defaultValue="ANY"/> - <argument name="actionsValue" type="string" defaultValue="FALSE"/> - <argument name="childAttribute" type="string" defaultValue="Category"/> - <argument name="actionValue" type="string" defaultValue="2"/> - </arguments> - <click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" after="fillDiscountAmount" stepKey="clickOnActionTab"/> - <click selector="{{AdminCartPriceRulesFormSection.condition('ALL')}}" after="clickOnActionTab" stepKey="clickToChooseFirstRuleConditionValue"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.actionsAggregator}}" userInput="{{actionsAggregator}}" after="clickToChooseFirstRuleConditionValue" stepKey="changeFirstRuleConditionValue"/> - <click selector="{{AdminCartPriceRulesFormSection.condition('TRUE')}}" after="changeFirstRuleConditionValue" stepKey="clickToChooseSecondRuleConditionValue"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.actionsValue}}" userInput="{{actionsValue}}" after="clickToChooseSecondRuleConditionValue" stepKey="changeSecondRuleConditionValue"/> - <click selector="{{AdminCartPriceRulesFormSection.conditions}}" after="changeSecondRuleConditionValue" stepKey="clickConditionDropDownMenu"/> - <waitForPageLoad stepKey="waitForDropDownOpened"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.childAttribute}}" userInput="{{childAttribute}}" after="clickConditionDropDownMenu" stepKey="selectConditionAttributeIsCategory"/> - <waitForPageLoad after="selectConditionAttributeIsCategory" stepKey="waitForOperatorOpened"/> - <click selector="{{AdminCartPriceRulesFormSection.condition('...')}}" after="waitForOperatorOpened" stepKey="clickToChooserIcon"/> - <fillField selector="{{AdminCartPriceRulesFormSection.actionValue}}" userInput="{{actionValue}}" after="clickToChooserIcon" stepKey="choseNeededCategoryFromCategoryGrid"/> - <click selector="{{AdminCartPriceRulesFormSection.applyAction}}" after="choseNeededCategoryFromCategoryGrid" stepKey="applyAction"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionsSectionActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionsSectionDiscountFieldsActionGroup.xml similarity index 55% rename from app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionsSectionActionGroup.xml rename to app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionsSectionDiscountFieldsActionGroup.xml index b30d2cfbb9204..00edcfc6f19ed 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionsSectionActionGroup.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionsSectionDiscountFieldsActionGroup.xml @@ -22,31 +22,4 @@ <fillField selector="{{AdminCartPriceRulesFormSection.maximumQtyDiscount}}" userInput="{{rule.maximumQtyDiscount}}" stepKey="fillMaximumQtyDiscount"/> <fillField selector="{{AdminCartPriceRulesFormSection.discountStep}}" userInput="{{rule.discount_step}}" stepKey="fillDiscountStep"/> </actionGroup> - - <actionGroup name="AdminCreateCartPriceRuleActionsSectionShippingAmountActionGroup"> - <annotations> - <description>Clicks on the 'Apply to Shipping Amount' toggle.</description> - </annotations> - - <click selector="{{AdminCartPriceRulesFormSection.applyToShippingAmount}}" stepKey="clickApplyToShipping"/> - </actionGroup> - - <actionGroup name="AdminCreateCartPriceRuleActionsSectionSubsequentRulesActionGroup"> - <annotations> - <description>Clicks on the 'Discard subsequent rules' toggle.</description> - </annotations> - - <click selector="{{AdminCartPriceRulesFormSection.discardSubsequentRules}}" stepKey="clickApplyToShipping"/> - </actionGroup> - - <actionGroup name="AdminCreateCartPriceRuleActionsSectionFreeShippingActionGroup"> - <annotations> - <description>Selects the provided option in the 'Free Shipping' dropdown menu.</description> - </annotations> - <arguments> - <argument name="freeShippingOption" type="string"/> - </arguments> - - <selectOption selector="{{AdminCartPriceRulesFormSection.freeShipping}}" userInput="{{freeShippingOption}}" stepKey="selectForMatchingItemsOnly"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionsSectionFreeShippingActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionsSectionFreeShippingActionGroup.xml new file mode 100644 index 0000000000000..d90261bf44fa9 --- /dev/null +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionsSectionFreeShippingActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateCartPriceRuleActionsSectionFreeShippingActionGroup"> + <annotations> + <description>Selects the provided option in the 'Free Shipping' dropdown menu.</description> + </annotations> + <arguments> + <argument name="freeShippingOption" type="string"/> + </arguments> + + <selectOption selector="{{AdminCartPriceRulesFormSection.freeShipping}}" userInput="{{freeShippingOption}}" stepKey="selectForMatchingItemsOnly"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionsSectionShippingAmountActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionsSectionShippingAmountActionGroup.xml new file mode 100644 index 0000000000000..3af8a82601a08 --- /dev/null +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionsSectionShippingAmountActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateCartPriceRuleActionsSectionShippingAmountActionGroup"> + <annotations> + <description>Clicks on the 'Apply to Shipping Amount' toggle.</description> + </annotations> + + <click selector="{{AdminCartPriceRulesFormSection.applyToShippingAmount}}" stepKey="clickApplyToShipping"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionsSectionSubsequentRulesActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionsSectionSubsequentRulesActionGroup.xml new file mode 100644 index 0000000000000..15dc5af206572 --- /dev/null +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionsSectionSubsequentRulesActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateCartPriceRuleActionsSectionSubsequentRulesActionGroup"> + <annotations> + <description>Clicks on the 'Discard subsequent rules' toggle.</description> + </annotations> + + <click selector="{{AdminCartPriceRulesFormSection.discardSubsequentRules}}" stepKey="clickApplyToShipping"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionsWithSubtotalActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionsWithSubtotalActionGroup.xml new file mode 100644 index 0000000000000..b6836ab63fb10 --- /dev/null +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionsWithSubtotalActionGroup.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateCartPriceRuleActionsWithSubtotalActionGroup" extends="AdminCreateCartPriceRuleActionGroup"> + <annotations> + <description>EXTENDS: AdminCreateCartPriceRuleActionGroup. Removes 'fillDiscountAmount'. Adds sub total conditions for free shipping to a Cart Price Rule.</description> + </annotations> + <arguments> + <argument name="ruleName"/> + </arguments> + <remove keyForRemoval="fillDiscountAmount"/> + <!-- Expand the conditions section --> + <grabTextFrom selector="{{AdminCartPriceRulesFormSection.ruleName}}" after="fillRuleName" stepKey="getSubtotalRule"/> + <click selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" stepKey="openConditionsSection" after="selectActionType"/> + <click selector="{{AdminCartPriceRulesFormSection.addCondition('1')}}" after="openConditionsSection" stepKey="addFirstCondition"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.conditionSelect}}" userInput="{{ruleName.condition1}}" after="addFirstCondition" stepKey="selectCondition1"/> + <waitForPageLoad after="selectCondition1" stepKey="waitForConditionLoad"/> + <click selector="{{AdminCartPriceRulesFormSection.condition(ruleName.ruleToChange1)}}" after="waitForConditionLoad" stepKey="clickToChooseOption"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.conditionsOperator}}" userInput="{{ruleName.rule1}}" after="clickToChooseOption" stepKey="setOperatorType"/> + <click selector="{{AdminCartPriceRulesFormSection.targetEllipsis}}" after="setOperatorType" stepKey="clickEllipsis"/> + <fillField selector="{{AdminCartPriceRulesFormSection.ruleFieldByIndex('1--1')}}" userInput="{{ruleName.subtotal}}" after="clickEllipsis" stepKey="fillSubtotalParameter"/> + <click selector="{{AdminCartPriceRulesFormSection.addNewCondition('1')}}" after="fillSubtotalParameter" stepKey="clickOnTheAddNewCondition"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.conditionSelectDropdown('1')}}" userInput="{{ruleName.condition2}}" after="clickOnTheAddNewCondition" stepKey="selectSecondCondition"/> + <waitForPageLoad after="selectSecondCondition" stepKey="waitForConditionLoad2"/> + <click selector="{{AdminCartPriceRulesFormSection.targetEllipsis}}" after="waitForConditionLoad2" stepKey="clickEllipsis2"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.ruleFieldByIndex('1--2')}}" userInput="{{ruleName.shippingMethod}}" after="clickEllipsis2" stepKey="selectShippingMethod"/> + <click selector="{{AdminCartPriceRulesFormSection.applyToShippingAmount}}" after="selectShippingMethod" stepKey="clickApplyToShipping"/> + <click selector="{{AdminCartPriceRulesFormSection.discardSubsequentRules}}" after="clickApplyToShipping" stepKey="clickDiscardSubsequentRules"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.freeShipping}}" userInput="{{ruleName.simple_free_shipping}}" after="clickDiscardSubsequentRules" stepKey="selectForMatchingItemsOnly"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleAndStayOnEditActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleAndStayOnEditActionGroup.xml new file mode 100644 index 0000000000000..b61988b630f03 --- /dev/null +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleAndStayOnEditActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateCartPriceRuleAndStayOnEditActionGroup" extends="AdminCreateCartPriceRuleActionGroup"> + <annotations> + <description>EXTENDS: AdminCreateCartPriceRuleActionGroup. Clicks on Save and Continue.</description> + </annotations> + + <click selector="{{AdminCartPriceRulesFormSection.saveAndContinue}}" stepKey="clickSaveButton"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleWithConditionIsCategoryActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleWithConditionIsCategoryActionGroup.xml new file mode 100644 index 0000000000000..7181ef586b2d8 --- /dev/null +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleWithConditionIsCategoryActionGroup.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateCartPriceRuleWithConditionIsCategoryActionGroup" extends="AdminCreateCartPriceRuleActionGroup"> + <annotations> + <description>EXTENDS: AdminCreateCartPriceRuleActionGroup. Sets the provide Condition (Actions Aggregator/Value, Child Attribute and Action Value) for Actions on the Admin Cart Price Rule creation/edit page.</description> + </annotations> + <arguments> + <argument name="actionsAggregator" type="string" defaultValue="ANY"/> + <argument name="actionsValue" type="string" defaultValue="FALSE"/> + <argument name="childAttribute" type="string" defaultValue="Category"/> + <argument name="actionValue" type="string" defaultValue="2"/> + </arguments> + <click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" after="fillDiscountAmount" stepKey="clickOnActionTab"/> + <click selector="{{AdminCartPriceRulesFormSection.condition('ALL')}}" after="clickOnActionTab" stepKey="clickToChooseFirstRuleConditionValue"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.actionsAggregator}}" userInput="{{actionsAggregator}}" after="clickToChooseFirstRuleConditionValue" stepKey="changeFirstRuleConditionValue"/> + <click selector="{{AdminCartPriceRulesFormSection.condition('TRUE')}}" after="changeFirstRuleConditionValue" stepKey="clickToChooseSecondRuleConditionValue"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.actionsValue}}" userInput="{{actionsValue}}" after="clickToChooseSecondRuleConditionValue" stepKey="changeSecondRuleConditionValue"/> + <click selector="{{AdminCartPriceRulesFormSection.conditions}}" after="changeSecondRuleConditionValue" stepKey="clickConditionDropDownMenu"/> + <waitForPageLoad stepKey="waitForDropDownOpened"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.childAttribute}}" userInput="{{childAttribute}}" after="clickConditionDropDownMenu" stepKey="selectConditionAttributeIsCategory"/> + <waitForPageLoad after="selectConditionAttributeIsCategory" stepKey="waitForOperatorOpened"/> + <click selector="{{AdminCartPriceRulesFormSection.condition('...')}}" after="waitForOperatorOpened" stepKey="clickToChooserIcon"/> + <fillField selector="{{AdminCartPriceRulesFormSection.actionValue}}" userInput="{{actionValue}}" after="clickToChooserIcon" stepKey="choseNeededCategoryFromCategoryGrid"/> + <click selector="{{AdminCartPriceRulesFormSection.applyAction}}" after="choseNeededCategoryFromCategoryGrid" stepKey="applyAction"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleWithConditionsActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleWithConditionsActionGroup.xml new file mode 100644 index 0000000000000..db1bcde6677dc --- /dev/null +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleWithConditionsActionGroup.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateCartPriceRuleWithConditionsActionGroup" extends="AdminCreateCartPriceRuleActionGroup"> + <annotations> + <description>EXTENDS: AdminCreateCartPriceRuleActionGroup. Removes 'fillDiscountAmount'. Adds the 2 provided Conditions (Name, Rule, Rule to Change and Category Name) to a Cart Price Rule.</description> + </annotations> + <arguments> + <argument name="condition1" type="string" defaultValue="Products subselection"/> + <argument name="condition2" type="string" defaultValue="Category"/> + <argument name="ruleToChange1" type="string" defaultValue="is"/> + <argument name="rule1" type="string" defaultValue="equals or greater than"/> + <argument name="ruleToChange2" type="string" defaultValue="..."/> + <argument name="rule2" type="string" defaultValue="2"/> + <argument name="categoryName" type="string" defaultValue="_defaultCategory.name"/> + </arguments> + + <remove keyForRemoval="fillDiscountAmount"/> + + <!--Go to Conditions section--> + <click selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" stepKey="openConditionsSection" after="selectActionType"/> + <click selector="{{AdminCartPriceRulesFormSection.addCondition('1')}}" stepKey="addFirstCondition" after="openConditionsSection"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.ruleCondition('1')}}" userInput="{{condition1}}" stepKey="selectRule" after="addFirstCondition"/> + <waitForElementVisible selector="{{AdminCartPriceRulesFormSection.ruleParameter(ruleToChange1)}}" stepKey="waitForFirstRuleElement" after="selectRule"/> + <click selector="{{AdminCartPriceRulesFormSection.ruleParameter(ruleToChange1)}}" stepKey="clickToChangeRule" after="waitForFirstRuleElement"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.ruleParameterSelect('1--1')}}" userInput="{{rule1}}" stepKey="selectRule1" after="clickToChangeRule"/> + <waitForElementVisible selector="{{AdminCartPriceRulesFormSection.ruleParameter(ruleToChange2)}}" stepKey="waitForSecondRuleElement" after="selectRule1"/> + <click selector="{{AdminCartPriceRulesFormSection.ruleParameter(ruleToChange2)}}" stepKey="clickToChangeRule1" after="waitForSecondRuleElement"/> + <fillField selector="{{AdminCartPriceRulesFormSection.ruleParameterInput('1--1')}}" userInput="{{rule2}}" stepKey="fillRule" after="clickToChangeRule1"/> + <click selector="{{AdminCartPriceRulesFormSection.addCondition('1--1')}}" stepKey="addSecondCondition" after="fillRule"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.ruleCondition('1--1')}}" userInput="{{condition2}}" stepKey="selectSecondCondition" after="addSecondCondition"/> + <waitForElementVisible selector="{{AdminCartPriceRulesFormSection.ruleParameter(ruleToChange2)}}" stepKey="waitForThirdRuleElement" after="selectSecondCondition"/> + <click selector="{{AdminCartPriceRulesFormSection.ruleParameter(ruleToChange2)}}" stepKey="addThirdCondition" after="waitForThirdRuleElement"/> + <waitForElementVisible selector="{{AdminCartPriceRulesFormSection.openChooser('1--1--1')}}" stepKey="waitForForthRuleElement" after="addThirdCondition"/> + <click selector="{{AdminCartPriceRulesFormSection.openChooser('1--1--1')}}" stepKey="openChooser" after="waitForForthRuleElement"/> + <waitForElementVisible selector="{{AdminCartPriceRulesFormSection.categoryCheckbox(categoryName)}}" stepKey="waitForCategoryVisible" after="openChooser"/> + <checkOption selector="{{AdminCartPriceRulesFormSection.categoryCheckbox(categoryName)}}" stepKey="checkCategoryName" after="waitForCategoryVisible"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleWithCouponCodeActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleWithCouponCodeActionGroup.xml new file mode 100644 index 0000000000000..51a45cf24784b --- /dev/null +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleWithCouponCodeActionGroup.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateCartPriceRuleWithCouponCodeActionGroup" extends="AdminCreateCartPriceRuleActionGroup"> + <annotations> + <description>EXTENDS: AdminCreateCartPriceRuleActionGroup. Removes 'selectActionType' and 'fillDiscountAmount'. Adds the provided Coupon Code to a Cart Price Rule.</description> + </annotations> + <arguments> + <argument name="couponCode" defaultValue="_defaultCoupon.code"/> + </arguments> + + <remove keyForRemoval="selectActionType"/> + <remove keyForRemoval="fillDiscountAmount"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.coupon}}" userInput="Specific Coupon" stepKey="selectCouponType" after="fillRuleName"/> + <waitForElementVisible selector="{{AdminCartPriceRulesFormSection.couponCode}}" stepKey="waitForElementVisible" after="selectCouponType"/> + <fillField selector="{{AdminCartPriceRulesFormSection.couponCode}}" userInput="{{couponCode}}" stepKey="fillCouponCode" after="waitForElementVisible"/> + <fillField selector="{{AdminCartPriceRulesFormSection.userPerCoupon}}" userInput="99" stepKey="fillUserPerCoupon" after="fillCouponCode"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="Fixed amount discount for whole cart" stepKey="selectActionTypeToFixed" after="clickToExpandActions"/> + <fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="1" stepKey="fillDiscountAmount" after="selectActionTypeToFixed"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateMultiWebsiteCartPriceRuleActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateMultiWebsiteCartPriceRuleActionGroup.xml new file mode 100644 index 0000000000000..f04c76c190b81 --- /dev/null +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateMultiWebsiteCartPriceRuleActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateMultiWebsiteCartPriceRuleActionGroup" extends="AdminCreateCartPriceRuleActionGroup"> + <annotations> + <description>EXTENDS: AdminCreateCartPriceRuleActionGroup. Removes 'clickSaveButton' for the next data changing. Assign cart price rule to 2 websites instead of 1.</description> + </annotations> + <arguments> + <argument name="ruleName"/> + </arguments> + <remove keyForRemoval="clickSaveButton"/> + <remove keyForRemoval="seeSuccessMessage"/> + <remove keyForRemoval="selectWebsites"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" parameterArray="['FirstWebsite', 'SecondWebsite']" stepKey="selectWebsites" after="fillRuleName"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminDeleteCartPriceRuleForRetailerActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminDeleteCartPriceRuleForRetailerActionGroup.xml new file mode 100644 index 0000000000000..3f5d511ebfbe7 --- /dev/null +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminDeleteCartPriceRuleForRetailerActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminDeleteCartPriceRuleForRetailerActionGroup"> + <annotations> + <description>Goes to the Admin Cart Price Rules grid page. Removes the 1st Cart Price Rule in the Grid.</description> + </annotations> + + <amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="goToCartPriceRules"/> + <waitForPageLoad stepKey="waitForCartPriceRules"/> + <fillField selector="{{AdminCartPriceRulesSection.filterByNameInput}}" userInput="{{SimpleSalesRule.name}}" stepKey="filterByName"/> + <click selector="{{AdminCartPriceRulesSection.searchButton}}" stepKey="doFilter"/> + <click selector="{{AdminCartPriceRulesSection.rowByIndex('1')}}" stepKey="goToEditRulePage"/> + <click selector="{{AdminCartPriceRulesFormSection.delete}}" stepKey="clickDeleteButton"/> + <click selector="{{AdminCartPriceRulesFormSection.modalAcceptButton}}" stepKey="confirmDelete"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminFilterCartPriceRuleActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminFilterCartPriceRuleActionGroup.xml index 0f307b2dfe591..f939f9b5a81be 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminFilterCartPriceRuleActionGroup.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminFilterCartPriceRuleActionGroup.xml @@ -16,20 +16,10 @@ <arguments> <argument name="ruleName"/> </arguments> - + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> <fillField selector="{{AdminCartPriceRulesSection.filterByNameInput}}" userInput="{{ruleName}}" stepKey="filterByName"/> <click selector="{{AdminCartPriceRulesSection.searchButton}}" stepKey="doFilter"/> <click selector="{{AdminCartPriceRulesSection.rowByIndex('1')}}" stepKey="goToEditRulePage"/> </actionGroup> - - <actionGroup name="AdminCartPriceRuleNotInGridActionGroup" extends="AdminFilterCartPriceRuleActionGroup"> - <annotations> - <description>EXTENDS: AdminFilterCartPriceRuleActionGroup. Removes 'goToEditRulePage'. Validates that the Empty Grid message is present and correct.</description> - </annotations> - - <remove keyForRemoval="goToEditRulePage"/> - <waitForPageLoad stepKey="waitForStoreToLoad"/> - <see selector="{{AdminCartPriceRulesSection.emptyText}}" userInput="We couldn't find any records." stepKey="seeAssertCartPriceRuleIsNotPresentedInGrid"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminInactiveCartPriceRuleActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminInactiveCartPriceRuleActionGroup.xml new file mode 100644 index 0000000000000..dad1090d3af27 --- /dev/null +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminInactiveCartPriceRuleActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminInactiveCartPriceRuleActionGroup" extends="AdminCreateCartPriceRuleActionGroup"> + <annotations> + <description>EXTENDS: AdminCreateCartPriceRuleActionGroup. Clicks on 'Active'.</description> + </annotations> + + <click selector="{{AdminCartPriceRulesFormSection.active}}" stepKey="clickActiveToDisable" after="fillRuleName"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/CreateCartPriceRuleSecondWebsiteActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/CreateCartPriceRuleSecondWebsiteActionGroup.xml new file mode 100644 index 0000000000000..d291f2fb4e63d --- /dev/null +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/CreateCartPriceRuleSecondWebsiteActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateCartPriceRuleSecondWebsiteActionGroup"> + <annotations> + <description>Goes to the Admin Cart Price Rule grid page. Clicks on Add New Rule. Fills the provided Rule (Name). Selects 'Second Website' from the 'Websites' menu.</description> + </annotations> + <arguments> + <argument name="ruleName"/> + </arguments> + + <amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceList"/> + <waitForPageLoad stepKey="waitForPriceList"/> + <click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/> + <fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{ruleName.name}}" stepKey="fillRuleName"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Second Website" stepKey="selectWebsites"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/SelectNotLoggedInCustomerGroupActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/SelectNotLoggedInCustomerGroupActionGroup.xml new file mode 100644 index 0000000000000..4f5f50e128ae8 --- /dev/null +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/SelectNotLoggedInCustomerGroupActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SelectNotLoggedInCustomerGroupActionGroup"> + <annotations> + <description>Selects 'NOT LOGGED IN' from the 'Customer Groups' list (Magento 2 B2B). PLEASE NOTE: The value is Hardcoded.</description> + </annotations> + + <!-- 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/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/SelectRetailerCustomerGroupActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/SelectRetailerCustomerGroupActionGroup.xml new file mode 100644 index 0000000000000..8552189807470 --- /dev/null +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/SelectRetailerCustomerGroupActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SelectRetailerCustomerGroupActionGroup"> + <annotations> + <description>Selects 'Retailer' from the 'Customer Groups' list (Magento 2 B2B). PLEASE NOTE: The value is Hardcoded.</description> + </annotations> + + <!-- This actionGroup was created to be merged from B2B. Retailer Customer Group --> + <selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="Retailer" stepKey="selectRetailerCustomerGroup"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/SetCartAttributeConditionForCartPriceRuleActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/SetCartAttributeConditionForCartPriceRuleActionGroup.xml new file mode 100644 index 0000000000000..466a02e607911 --- /dev/null +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/SetCartAttributeConditionForCartPriceRuleActionGroup.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SetCartAttributeConditionForCartPriceRuleActionGroup"> + <annotations> + <description>Sets the provided Cart Attribute Condition (Attribute Name, Operator Type and Value) on the Admin Cart Price Rule creation/edit page.</description> + </annotations> + <arguments> + <argument name="attributeName" type="string"/> + <argument name="operatorType" defaultValue="is" type="string"/> + <argument name="value" type="string"/> + </arguments> + + <scrollTo selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" stepKey="scrollToActionTab"/> + <conditionalClick selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.conditionsHeaderOpen}}" visible="false" stepKey="openActionTab"/> + <click selector="{{AdminCartPriceRulesFormSection.conditions}}" stepKey="applyRuleForConditions"/> + <waitForPageLoad stepKey="waitForDropDownOpened"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.childAttribute}}" userInput="{{attributeName}}" stepKey="selectAttribute"/> + <waitForPageLoad stepKey="waitForOperatorOpened"/> + <click selector="{{AdminCartPriceRulesFormSection.condition('is')}}" stepKey="clickToChooseOption"/> + <selectOption userInput="{{operatorType}}" selector="{{AdminCartPriceRulesFormSection.conditionsOperator}}" stepKey="setOperatorType"/> + <click selector="{{AdminCartPriceRulesFormSection.condition('...')}}" stepKey="clickToChooseOption1"/> + <fillField userInput="{{value}}" selector="{{AdminCartPriceRulesFormSection.conditionsValue}}" stepKey="fillActionValue"/> + <click selector="{{AdminMainActionsSection.saveAndContinue}}" stepKey="clickSaveButton"/> + <see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/SetConditionForActionsInCartPriceRuleActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/SetConditionForActionsInCartPriceRuleActionGroup.xml new file mode 100644 index 0000000000000..118e9c9961ddb --- /dev/null +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/SetConditionForActionsInCartPriceRuleActionGroup.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SetConditionForActionsInCartPriceRuleActionGroup"> + <annotations> + <description>Sets the provided Condition (Actions Aggregator/Value, Child Attribute and Action Value) for Actions on the Admin Cart Price Rule creation/edit page.</description> + </annotations> + <arguments> + <argument name="actionsAggregator" type="string" defaultValue="ANY"/> + <argument name="actionsValue" type="string" defaultValue="FALSE"/> + <argument name="childAttribute" type="string" defaultValue="Category"/> + <argument name="actionValue" type="string"/> + </arguments> + + <click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickOnActionTab"/> + <click selector="{{AdminCartPriceRulesFormSection.condition('ALL')}}" stepKey="clickToChooseOption"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.actionsAggregator}}" userInput="{{actionsAggregator}}" stepKey="selectCondition"/> + <click selector="{{AdminCartPriceRulesFormSection.condition('TRUE')}}" stepKey="clickToChooseOption2"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.actionsValue}}" userInput="{{actionsValue}}" stepKey="selectCondition2"/> + <click selector="{{AdminCartPriceRulesFormSection.conditions}}" stepKey="selectActionConditions"/> + <waitForPageLoad stepKey="waitForDropDownOpened"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.childAttribute}}" userInput="{{childAttribute}}" stepKey="selectAttribute"/> + <waitForPageLoad stepKey="waitForOperatorOpened"/> + <click selector="{{AdminCartPriceRulesFormSection.condition('...')}}" stepKey="clickToChooseOption3"/> + <fillField selector="{{AdminCartPriceRulesFormSection.actionValue}}" userInput="{{actionValue}}" stepKey="fillActionValue"/> + <click selector="{{AdminCartPriceRulesFormSection.applyAction}}" stepKey="applyAction"/> + <click selector="{{AdminMainActionsSection.save}}" stepKey="clickSaveButton"/> + <see selector="{{AdminMessagesSection.success}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontApplyCouponActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontApplyCouponActionGroup.xml new file mode 100644 index 0000000000000..72f2fb2a2a386 --- /dev/null +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontApplyCouponActionGroup.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <!-- Apply Sales Rule Coupon to the cart --> + <actionGroup name="StorefrontApplyCouponActionGroup"> + <annotations> + <description>Applies the provided Coupon Code to the Storefront Shopping Cart.</description> + </annotations> + <arguments> + <argument name="coupon"/> + </arguments> + + <waitForElement selector="{{StorefrontSalesRuleCartCouponSection.couponHeader}}" time="30" stepKey="waitForCouponHeader"/> + <conditionalClick selector="{{StorefrontSalesRuleCartCouponSection.couponHeader}}" dependentSelector="{{StorefrontSalesRuleCartCouponSection.discountBlockActive}}" visible="false" stepKey="clickCouponHeader"/> + <waitForElementVisible selector="{{StorefrontSalesRuleCartCouponSection.couponField}}" stepKey="waitForCouponField"/> + <fillField userInput="{{coupon.code}}" selector="{{StorefrontSalesRuleCartCouponSection.couponField}}" stepKey="fillCouponField"/> + <click selector="{{StorefrontSalesRuleCartCouponSection.applyButton}}" stepKey="clickApplyButton"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontCancelCouponActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontCancelCouponActionGroup.xml new file mode 100644 index 0000000000000..a97d9e8cd6300 --- /dev/null +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontCancelCouponActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCancelCouponActionGroup"> + <annotations> + <description>Cancels the Coupon that is applied to the Storefront Shopping Cart.</description> + </annotations> + + <waitForElement selector="{{StorefrontSalesRuleCartCouponSection.couponHeader}}" time="30" stepKey="waitForCouponHeader"/> + <conditionalClick selector="{{StorefrontSalesRuleCartCouponSection.couponHeader}}" dependentSelector="{{StorefrontSalesRuleCartCouponSection.discountBlockActive}}" visible="false" stepKey="clickCouponHeader"/> + <waitForElementVisible selector="{{StorefrontSalesRuleCartCouponSection.couponField}}" stepKey="waitForCouponField"/> + <click selector="{{StorefrontSalesRuleCartCouponSection.cancelButton}}" stepKey="clickCancelButton"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontCheckCouponAppliedActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontCheckCouponAppliedActionGroup.xml new file mode 100644 index 0000000000000..84c2dd2121ae3 --- /dev/null +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontCheckCouponAppliedActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCheckCouponAppliedActionGroup"> + <annotations> + <description>Validates that the provided Rule and Discount Amount is present and correct on the Storefront Checkout page.</description> + </annotations> + <arguments> + <argument name="rule"/> + <argument name="discount" type="string"/> + </arguments> + + <waitForElementVisible selector="{{CheckoutCartSummarySection.discountTotal}}" stepKey="waitForDiscountTotal"/> + <see userInput="{{rule.store_labels[1][store_label]}}" selector="{{CheckoutCartSummarySection.discountLabel}}" stepKey="assertDiscountLabel"/> + <see userInput="-${{discount}}" selector="{{CheckoutCartSummarySection.discountTotal}}" stepKey="assertDiscountTotal"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontSalesRuleActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontSalesRuleActionGroup.xml deleted file mode 100644 index f978c1e2a9262..0000000000000 --- a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontSalesRuleActionGroup.xml +++ /dev/null @@ -1,76 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <!-- Apply Sales Rule Coupon to the cart --> - <actionGroup name="StorefrontApplyCouponActionGroup"> - <annotations> - <description>Applies the provided Coupon Code to the Storefront Shopping Cart.</description> - </annotations> - <arguments> - <argument name="coupon"/> - </arguments> - - <waitForElement selector="{{StorefrontSalesRuleCartCouponSection.couponHeader}}" time="30" stepKey="waitForCouponHeader"/> - <conditionalClick selector="{{StorefrontSalesRuleCartCouponSection.couponHeader}}" dependentSelector="{{StorefrontSalesRuleCartCouponSection.discountBlockActive}}" visible="false" stepKey="clickCouponHeader"/> - <waitForElementVisible selector="{{StorefrontSalesRuleCartCouponSection.couponField}}" stepKey="waitForCouponField"/> - <fillField userInput="{{coupon.code}}" selector="{{StorefrontSalesRuleCartCouponSection.couponField}}" stepKey="fillCouponField"/> - <click selector="{{StorefrontSalesRuleCartCouponSection.applyButton}}" stepKey="clickApplyButton"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - </actionGroup> - - <!-- Cancel Sales Rule Coupon applied to the cart --> - <actionGroup name="StorefrontCancelCouponActionGroup"> - <annotations> - <description>Cancels the Coupon that is applied to the Storefront Shopping Cart.</description> - </annotations> - - <waitForElement selector="{{StorefrontSalesRuleCartCouponSection.couponHeader}}" time="30" stepKey="waitForCouponHeader"/> - <conditionalClick selector="{{StorefrontSalesRuleCartCouponSection.couponHeader}}" dependentSelector="{{StorefrontSalesRuleCartCouponSection.discountBlockActive}}" visible="false" stepKey="clickCouponHeader"/> - <waitForElementVisible selector="{{StorefrontSalesRuleCartCouponSection.couponField}}" stepKey="waitForCouponField"/> - <click selector="{{StorefrontSalesRuleCartCouponSection.cancelButton}}" stepKey="clickCancelButton"/> - </actionGroup> - - <!-- Check applied discount in cart summary --> - <actionGroup name="StorefrontCheckCouponAppliedActionGroup"> - <annotations> - <description>Validates that the provided Rule and Discount Amount is present and correct on the Storefront Checkout page.</description> - </annotations> - <arguments> - <argument name="rule"/> - <argument name="discount" type="string"/> - </arguments> - - <waitForElementVisible selector="{{CheckoutCartSummarySection.discountTotal}}" stepKey="waitForDiscountTotal"/> - <see userInput="{{rule.store_labels[1][store_label]}}" selector="{{CheckoutCartSummarySection.discountLabel}}" stepKey="assertDiscountLabel"/> - <see userInput="-${{discount}}" selector="{{CheckoutCartSummarySection.discountTotal}}" stepKey="assertDiscountTotal"/> - </actionGroup> - - <actionGroup name="VerifyDiscountAmount"> - <annotations> - <description>Goes to the provided Storefront Product URL. Fills in provided Quantity. Clicks Add to Cart. Goes to Checkout. Validates that the provided Discount Amount is present and correct.</description> - </annotations> - <arguments> - <argument name="productUrl" type="string"/> - <argument name="quantity" type="string"/> - <argument name="expectedDiscount" type="string"/> - </arguments> - - <amOnPage url="{{productUrl}}" stepKey="goToProductPage"/> - <waitForPageLoad stepKey="waitForProductPageLoad"/> - <fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="{{quantity}}" stepKey="fillQuantity"/> - <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart"/> - <waitForPageLoad stepKey="waitForAddToCart"/> - <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> - <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage"/> - <waitForPageLoad stepKey="waitForCartPage"/> - <waitForElementVisible selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="waitForDiscountElement"/> - <see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="{{expectedDiscount}}" stepKey="seeDiscountTotal"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/VerifyDiscountAmountActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/VerifyDiscountAmountActionGroup.xml new file mode 100644 index 0000000000000..c4e8f9f6ce32e --- /dev/null +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/VerifyDiscountAmountActionGroup.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="VerifyDiscountAmountActionGroup"> + <annotations> + <description>Goes to the provided Storefront Product URL. Fills in provided Quantity. Clicks Add to Cart. Goes to Checkout. Validates that the provided Discount Amount is present and correct.</description> + </annotations> + <arguments> + <argument name="productUrl" type="string"/> + <argument name="quantity" type="string"/> + <argument name="expectedDiscount" type="string"/> + </arguments> + + <amOnPage url="{{productUrl}}" stepKey="goToProductPage"/> + <waitForPageLoad stepKey="waitForProductPageLoad"/> + <fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="{{quantity}}" stepKey="fillQuantity"/> + <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart"/> + <waitForPageLoad stepKey="waitForAddToCart"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> + <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage"/> + <waitForPageLoad stepKey="waitForCartPage"/> + <waitForElementVisible selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="waitForDiscountElement"/> + <see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="{{expectedDiscount}}" stepKey="seeDiscountTotal"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCartRulesAppliedForProductInCartTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCartRulesAppliedForProductInCartTest.xml index ab085dc5ae137..b516e102fc928 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCartRulesAppliedForProductInCartTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCartRulesAppliedForProductInCartTest.xml @@ -86,7 +86,7 @@ <actionGroup ref="saveProductForm" stepKey="saveProduct"/> <!--Create cart price rule--> - <actionGroup ref="AdminCreateCartPriceRuleWithConditions" stepKey="createRule"> + <actionGroup ref="AdminCreateCartPriceRuleWithConditionsActionGroup" stepKey="createRule"> <argument name="ruleName" value="PriceRuleWithCondition"/> <argument name="condition1" value="Products subselection"/> <argument name="condition2" value="Category"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateBuyXGetYFreeTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateBuyXGetYFreeTest.xml index 02078ff15ecc2..d6bb25fec6ff0 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateBuyXGetYFreeTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateBuyXGetYFreeTest.xml @@ -56,7 +56,7 @@ </actionGroup> <!-- Spot check the storefront --> - <actionGroup ref="VerifyDiscountAmount" stepKey="verifyStorefront"> + <actionGroup ref="VerifyDiscountAmountActionGroup" stepKey="verifyStorefront"> <argument name="productUrl" value="{{_defaultProduct.urlKey}}.html"/> <argument name="quantity" value="2"/> <argument name="expectedDiscount" value="-$123.00"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleEmptyFromDateTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleEmptyFromDateTest.xml index f5b285f2f0286..f0075a92a2b82 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleEmptyFromDateTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleEmptyFromDateTest.xml @@ -53,7 +53,7 @@ <click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/> <fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{_defaultCoupon.code}}" stepKey="fillRuleName"/> <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Main Website" stepKey="selectWebsites"/> - <actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="selectCustomerGroup"/> + <actionGroup ref="SelectNotLoggedInCustomerGroupActionGroup" stepKey="selectCustomerGroup"/> <selectOption selector="{{AdminCartPriceRulesFormSection.coupon}}" userInput="Specific Coupon" stepKey="selectCouponType"/> <fillField selector="{{AdminCartPriceRulesFormSection.couponCode}}" userInput="{{_defaultCoupon.code}}" stepKey="fillCouponCode"/> <click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickToExpandActions"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateFixedAmountDiscountTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateFixedAmountDiscountTest.xml index 1681d910ccdb0..1b5361a7f1d4d 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateFixedAmountDiscountTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateFixedAmountDiscountTest.xml @@ -55,7 +55,7 @@ </actionGroup> <!-- Spot check the storefront --> - <actionGroup ref="VerifyDiscountAmount" stepKey="verifyStorefront"> + <actionGroup ref="VerifyDiscountAmountActionGroup" stepKey="verifyStorefront"> <argument name="productUrl" value="{{_defaultProduct.urlKey}}.html"/> <argument name="quantity" value="2"/> <argument name="expectedDiscount" value="-$20.00"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateFixedAmountWholeCartDiscountTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateFixedAmountWholeCartDiscountTest.xml index 69918bda8c426..f4acb93c54572 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateFixedAmountWholeCartDiscountTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateFixedAmountWholeCartDiscountTest.xml @@ -55,7 +55,7 @@ </actionGroup> <!-- Spot check the storefront --> - <actionGroup ref="VerifyDiscountAmount" stepKey="verifyStorefront"> + <actionGroup ref="VerifyDiscountAmountActionGroup" stepKey="verifyStorefront"> <argument name="productUrl" value="{{_defaultProduct.urlKey}}.html"/> <argument name="quantity" value="2"/> <argument name="expectedDiscount" value="-$19.99"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreatePercentOfProductPriceTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreatePercentOfProductPriceTest.xml index 898e5a07304b6..e859d4ffc2b98 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreatePercentOfProductPriceTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreatePercentOfProductPriceTest.xml @@ -55,7 +55,7 @@ </actionGroup> <!-- Spot check the storefront --> - <actionGroup ref="VerifyDiscountAmount" stepKey="verifyStorefront"> + <actionGroup ref="VerifyDiscountAmountActionGroup" stepKey="verifyStorefront"> <argument name="productUrl" value="{{_defaultProduct.urlKey}}.html"/> <argument name="quantity" value="1"/> <argument name="expectedDiscount" value="-$61.50"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteActiveSalesRuleWithPercentPriceAndVerifyDeleteMessageTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteActiveSalesRuleWithPercentPriceAndVerifyDeleteMessageTest.xml index 41e4221a2c37f..34b8363e8b5ce 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteActiveSalesRuleWithPercentPriceAndVerifyDeleteMessageTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteActiveSalesRuleWithPercentPriceAndVerifyDeleteMessageTest.xml @@ -22,7 +22,7 @@ <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <!--Create active cart price rule--> - <actionGroup ref="AdminCreateCartPriceRuleWithCouponCode" stepKey="createActiveCartPriceRule"> + <actionGroup ref="AdminCreateCartPriceRuleWithCouponCodeActionGroup" stepKey="createActiveCartPriceRule"> <argument name="ruleName" value="ActiveSalesRuleWithPercentPriceDiscountCoupon"/> <argument name="couponCode" value="ActiveSalesRuleWithPercentPriceDiscountCoupon.coupon_code"/> </actionGroup> @@ -41,4 +41,4 @@ <argument name="ruleName" value="ActiveSalesRuleWithPercentPriceDiscountCoupon.name"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/CartPriceRuleForConfigurableProductTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/CartPriceRuleForConfigurableProductTest.xml index 1eba06126ff6f..83625acf69822 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/CartPriceRuleForConfigurableProductTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/CartPriceRuleForConfigurableProductTest.xml @@ -88,14 +88,14 @@ <deleteData createDataKey="createCategory" stepKey="deleteApiCategory"/> <actionGroup ref="logout" stepKey="logout"/> </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"/> - <actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="selectNotLoggedInCustomerGroup"/> + <actionGroup ref="SelectNotLoggedInCustomerGroupActionGroup" stepKey="selectNotLoggedInCustomerGroup"/> <generateDate date="-1 day" format="m/d/Y" stepKey="yesterdayDate"/> <fillField selector="{{AdminCartPriceRulesFormSection.fromDate}}" userInput="{$yesterdayDate}" stepKey="fillFromDate"/> <selectOption selector="{{AdminCartPriceRulesFormSection.coupon}}" userInput="Specific Coupon" stepKey="selectCouponType"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleCountry.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleCountry.xml index ffd50e43a2344..832b9ef8bd4b4 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleCountry.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/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"/> - <actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="selectNotLoggedInCustomerGroup"/> + <actionGroup ref="SelectNotLoggedInCustomerGroupActionGroup" stepKey="selectNotLoggedInCustomerGroup"/> <generateDate date="-1 day" format="m/d/Y" stepKey="yesterdayDate"/> <fillField selector="{{AdminCartPriceRulesFormSection.fromDate}}" userInput="{$yesterdayDate}" stepKey="fillFromDate"/> <click selector="{{PriceRuleConditionsSection.conditionsTab}}" stepKey="expandConditions"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRulePostcode.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRulePostcode.xml index 765f10e44d81b..9882b04bdc956 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRulePostcode.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/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"/> - <actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="selectNotLoggedInCustomerGroup"/> + <actionGroup ref="SelectNotLoggedInCustomerGroupActionGroup" stepKey="selectNotLoggedInCustomerGroup"/> <generateDate date="-1 day" format="m/d/Y" stepKey="yesterdayDate"/> <fillField selector="{{AdminCartPriceRulesFormSection.fromDate}}" userInput="{$yesterdayDate}" stepKey="fillFromDate"/> <click selector="{{PriceRuleConditionsSection.conditionsTab}}" stepKey="expandConditions"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleQuantity.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleQuantity.xml index cde5e351e1b70..ad060c1412c8c 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleQuantity.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/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"/> - <actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="selectNotLoggedInCustomerGroup"/> + <actionGroup ref="SelectNotLoggedInCustomerGroupActionGroup" stepKey="selectNotLoggedInCustomerGroup"/> <generateDate date="-1 day" format="m/d/Y" stepKey="yesterdayDate"/> <fillField selector="{{AdminCartPriceRulesFormSection.fromDate}}" userInput="{$yesterdayDate}" stepKey="fillFromDate"/> <click selector="{{PriceRuleConditionsSection.conditionsTab}}" stepKey="expandConditions"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleState.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleState.xml index d6806e2a2966b..19ffb7c36f992 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleState.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/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"/> - <actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="selectNotLoggedInCustomerGroup"/> + <actionGroup ref="SelectNotLoggedInCustomerGroupActionGroup" stepKey="selectNotLoggedInCustomerGroup"/> <generateDate date="-1 day" format="m/d/Y" stepKey="yesterdayDate"/> <fillField selector="{{AdminCartPriceRulesFormSection.fromDate}}" userInput="{$yesterdayDate}" stepKey="fillFromDate"/> <click selector="{{PriceRuleConditionsSection.conditionsTab}}" stepKey="expandConditions"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleSubtotal.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleSubtotal.xml index 8ff747607ea30..510bfabf303f5 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleSubtotal.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/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"/> - <actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="selectNotLoggedInCustomerGroup"/> + <actionGroup ref="SelectNotLoggedInCustomerGroupActionGroup" stepKey="selectNotLoggedInCustomerGroup"/> <generateDate date="-1 day" format="m/d/Y" stepKey="yesterdayDate"/> <fillField selector="{{AdminCartPriceRulesFormSection.fromDate}}" userInput="{$yesterdayDate}" stepKey="fillFromDate"/> <click selector="{{PriceRuleConditionsSection.conditionsTab}}" stepKey="expandConditions"/> From d26e7b8afcfa04fdbdcb79ff2daf3e1149f977e2 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Thu, 28 Nov 2019 17:05:02 +0200 Subject: [PATCH 0159/1143] Tests for: magento/magento2#25058, magento/magento2#25248. --- .../Mftf/Section/AdminImportMainSection.xml | 1 + ...gesFileDirectoryCorrectExplanationTest.xml | 33 ++++++++++++++ .../Page/AdminNewsletterSubscriberPage.xml | 13 ++++++ .../AdminNewsletterSubscriberGridSection.xml | 16 +++++++ .../Mftf/Test/AdminNameEmptyForGuestTest.xml | 45 +++++++++++++++++++ 5 files changed, 108 insertions(+) create mode 100644 app/code/Magento/ImportExport/Test/Mftf/Test/AdminImagesFileDirectoryCorrectExplanationTest.xml create mode 100644 app/code/Magento/Newsletter/Test/Mftf/Page/AdminNewsletterSubscriberPage.xml create mode 100644 app/code/Magento/Newsletter/Test/Mftf/Section/AdminNewsletterSubscriberGridSection.xml create mode 100644 app/code/Magento/Newsletter/Test/Mftf/Test/AdminNameEmptyForGuestTest.xml diff --git a/app/code/Magento/ImportExport/Test/Mftf/Section/AdminImportMainSection.xml b/app/code/Magento/ImportExport/Test/Mftf/Section/AdminImportMainSection.xml index ba1deeebbd89a..0f647aa027c23 100644 --- a/app/code/Magento/ImportExport/Test/Mftf/Section/AdminImportMainSection.xml +++ b/app/code/Magento/ImportExport/Test/Mftf/Section/AdminImportMainSection.xml @@ -17,5 +17,6 @@ <element name="messageError" type="text" selector=".messages div.message-error"/> <element name="validationStrategy" type="select" selector="#basic_behaviorvalidation_strategy"/> <element name="allowedErrorsCount" type="input" selector="#basic_behavior_allowed_error_count"/> + <element name="importImagesFileDirNote" type="input" selector="#import_images_file_dir-note"/> </section> </sections> diff --git a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminImagesFileDirectoryCorrectExplanationTest.xml b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminImagesFileDirectoryCorrectExplanationTest.xml new file mode 100644 index 0000000000000..989c405324f06 --- /dev/null +++ b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminImagesFileDirectoryCorrectExplanationTest.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="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminImagesFileDirectoryCorrectExplanationTest"> + <annotations> + <features value="Import/Export"/> + <stories value="Import CSV file"/> + <title value="Images file directory correct explanation test"/> + <description value="Check correct explanation for the 'Images File Directory' option."/> + <severity value="MINOR"/> + <group value="importExport"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + </after> + <amOnPage url="{{AdminImportIndexPage.url}}" stepKey="goToImportIndexPage"/> + <waitForPageLoad stepKey="adminImportMainSectionLoad"/> + <selectOption selector="{{AdminImportMainSection.entityType}}" userInput="Products" stepKey="selectProductsOption"/> + <waitForElementVisible selector="{{AdminImportMainSection.importBehavior}}" stepKey="waitForImportBehaviorElementVisible"/> + + <see selector="{{AdminImportMainSection.importImagesFileDirNote}}" userInput='For Type "Local Server" use relative path to <Magento root directory>/var/import/images, e.g. ' stepKey="seeCorrectExplanation"/> + </test> +</tests> diff --git a/app/code/Magento/Newsletter/Test/Mftf/Page/AdminNewsletterSubscriberPage.xml b/app/code/Magento/Newsletter/Test/Mftf/Page/AdminNewsletterSubscriberPage.xml new file mode 100644 index 0000000000000..0193064c8756c --- /dev/null +++ b/app/code/Magento/Newsletter/Test/Mftf/Page/AdminNewsletterSubscriberPage.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> + <page name="AdminNewsletterSubscriberPage" url="newsletter/subscriber/index/" area="admin" module="Magento_Newsletter"> + <section name="AdminNewsletterSubscriberGridSection"/> + </page> +</pages> diff --git a/app/code/Magento/Newsletter/Test/Mftf/Section/AdminNewsletterSubscriberGridSection.xml b/app/code/Magento/Newsletter/Test/Mftf/Section/AdminNewsletterSubscriberGridSection.xml new file mode 100644 index 0000000000000..3332041817150 --- /dev/null +++ b/app/code/Magento/Newsletter/Test/Mftf/Section/AdminNewsletterSubscriberGridSection.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="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="AdminNewsletterSubscriberGridSection"> + <element name="email" type="text" selector="//table[contains(@class, 'data-grid')]/tbody/tr[{{row}}][@data-role='row']/td[@data-column='email']" parameterized="true"/> + <element name="type" type="text" selector="//table[contains(@class, 'data-grid')]/tbody/tr[{{row}}][@data-role='row']/td[@data-column='type']" parameterized="true"/> + <element name="firstName" type="text" selector="//table[contains(@class, 'data-grid')]/tbody/tr[{{row}}][@data-role='row']/td[@data-column='firstname']" parameterized="true"/> + <element name="lastName" type="text" selector="//table[contains(@class, 'data-grid')]/tbody/tr[{{row}}][@data-role='row']/td[@data-column='lastname']" parameterized="true"/> + </section> +</sections> diff --git a/app/code/Magento/Newsletter/Test/Mftf/Test/AdminNameEmptyForGuestTest.xml b/app/code/Magento/Newsletter/Test/Mftf/Test/AdminNameEmptyForGuestTest.xml new file mode 100644 index 0000000000000..07c7cc050d5cf --- /dev/null +++ b/app/code/Magento/Newsletter/Test/Mftf/Test/AdminNameEmptyForGuestTest.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminNameEmptyForGuestTest"> + <annotations> + <features value="Newsletter"/> + <group value="Newsletter"/> + <title value="Empty name for Guest Customer"/> + <description value="'Customer First Name' and 'Customer Last Name' should be empty for Guest Customer in Newsletter Subscribers Grid"/> + <severity value="MINOR"/> + </annotations> + + <before> + <actionGroup ref="LoginActionGroup" stepKey="loginAsAdmin"/> + </before> + + <after> + <actionGroup ref="logout" stepKey="adminLogout"/> + </after> + + <amOnPage url="{{StorefrontHomePage.url}}" stepKey="amOnStorefrontPage"/> + <waitForPageLoad stepKey="waitForCustomerPage"/> + <scrollTo selector="{{StorefrontCustomerFooterSection.footerBlock}}" stepKey="scrollToFooter"/> + <fillField userInput="{{Simple_US_Customer.email}}" selector="{{StorefrontCustomerFooterSection.formSubscribe}}" + stepKey="giveEmail"/> + <click selector="{{StorefrontCustomerFooterSection.buttonSubscribe}}" stepKey="clickSubscribeButton"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <see selector="{{StorefrontCustomerMessagesSection.successMessage}}" + userInput="Thank you for your subscription." stepKey="checkSuccessMessage"/> + + <amOnPage url="{{AdminNewsletterSubscriberPage.url}}" stepKey="amOnNewsletterSubscribersPage"/> + <see selector="{{AdminNewsletterSubscriberGridSection.email('1')}}" userInput="{{Simple_US_Customer.email}}" + stepKey="checkEmail"/> + <see selector="{{AdminNewsletterSubscriberGridSection.type('1')}}" userInput="Guest" stepKey="checkType"/> + <see selector="{{AdminNewsletterSubscriberGridSection.firstName('1')}}" userInput="" stepKey="checkFirstName"/> + <see selector="{{AdminNewsletterSubscriberGridSection.lastName('1')}}" userInput="" stepKey="checkLastName"/> + </test> +</tests> From 4c9c7bfb7c28cdd29e7b5f16944d81a3a9b99be5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 28 Nov 2019 17:00:15 +0100 Subject: [PATCH 0160/1143] REFACTOR: Extract Action Groups to separate files (according to MFTF best practices) --- .../Test/AdminDashboardWithChartsChart.xml | 2 +- ...AnAdminOrderUsingBraintreePaymentTest1.xml | 8 +- ...thOnlinePaymentIncludingTaxAndDiscount.xml | 8 +- ...ProductWithZeroPriceToShoppingCartTest.xml | 2 +- .../Test/CheckTierPricingOfProductsTest.xml | 2 +- ...ctCustomOptionsDifferentStoreViewsTest.xml | 2 +- ...ntPurchaseProductWithCustomOptionsTest.xml | 2 +- ...ckoutAsCustomerUsingDefaultAddressTest.xml | 2 +- ...eCheckoutAsCustomerUsingNewAddressTest.xml | 2 +- ...utAsCustomerUsingNonDefaultAddressTest.xml | 2 +- .../OnePageCheckoutUsingSignInLinkTest.xml | 2 +- ...OnePageCheckoutWithAllProductTypesTest.xml | 2 +- ...efrontApplyPromoCodeDuringCheckoutTest.xml | 2 +- ...ingAddressAndProductWithTierPricesTest.xml | 4 +- ...ssAndRegisterCustomerAfterCheckoutTest.xml | 4 +- ...ntCheckoutWithSpecialPriceProductsTest.xml | 4 +- ...OnLoginWhenGuestCheckoutIsDisabledTest.xml | 4 +- ...egistrationAndDisableGuestCheckoutTest.xml | 4 +- ...tCheckoutUsingFreeShippingAndTaxesTest.xml | 4 +- ...tCheckoutWithCouponAndZeroSubtotalTest.xml | 4 +- ...ngesInBackendAfterCustomerCheckoutTest.xml | 4 +- ...efrontUKCustomerCheckoutWithCouponTest.xml | 2 +- ...uctQuantityEqualsToOrderedQuantityTest.xml | 4 +- ...CouponAndBankTransferPaymentMethodTest.xml | 4 +- ...SubtotalOrdersWithProcessingStatusTest.xml | 2 +- ...vailableToConfigureDisabledProductTest.xml | 4 +- .../ProductsQtyReturnAfterOrderCancelTest.xml | 4 +- ...ayWhenChooseThreeAllowedCurrenciesTest.xml | 2 +- .../AdminOrderRateDisplayedInOneLineTest.xml | 2 +- ...fStorefrontIsOpenedViaCustomerViewTest.xml | 12 +- ...oreFrontMyAccountWithMultishipmentTest.xml | 4 +- .../CancelOrdersInOrderSalesReportTest.xml | 2 +- .../AddBundleProductToOrderActionGroup.xml | 32 + ...tToOrderAndCheckPriceInGridActionGroup.xml | 25 + ...dConfigurableProductToOrderActionGroup.xml | 33 ++ ...ableProductToOrderFromAdminActionGroup.xml | 19 + ...dDownloadableProductToOrderActionGroup.xml | 29 + ...GroupedProductOptionToOrderActionGroup.xml | 33 ++ .../AddSimpleProductToOrderActionGroup.xml | 30 + ...SimpleProductWithQtyToOrderActionGroup.xml | 18 + .../AdminCreateInvoiceActionGroup.xml | 12 - ...nCreateInvoiceAndCreditMemoActionGroup.xml | 19 + ...minCreateInvoiceAndShipmentActionGroup.xml | 15 + .../AdminCreditMemoActionGroup.xml | 32 +- .../AdminFastCreateInvoiceActionGroup.xml | 26 + .../ActionGroup/AdminInvoiceActionGroup.xml | 130 ---- ...OpenAndFillCreditMemoRefundActionGroup.xml | 11 +- ...ditMemoRefundAndBackToStockActionGroup.xml | 18 + .../ActionGroup/AdminOrderActionGroup.xml | 557 ------------------ .../ActionGroup/AdminOrderGridActionGroup.xml | 113 ---- ...AdminOrdersGridClearFiltersActionGroup.xml | 20 + ...sertOrderAddressInformationActionGroup.xml | 20 + .../CancelPendingOrderActionGroup.xml | 26 + .../ChangeShippingMethodActionGroup.xml | 26 + ...kRequiredFieldsNewOrderFormActionGroup.xml | 39 ++ .../ClearInvoicesGridFiltersActionGroup.xml | 21 + ...eOrderedConfigurableProductActionGroup.xml | 28 + .../ActionGroup/CreateOrderActionGroup.xml | 38 ++ ...derFilteringCustomerByEmailActionGroup.xml | 14 + .../CreateOrderInStoreActionGroup.xml | 39 ++ ...nStoreChoosingPaymentMethodActionGroup.xml | 40 ++ .../CreateOrderToPrintPageActionGroup.xml | 9 - ...geWithSelectedPaymentMethodActionGroup.xml | 19 + ...ontSeeProductInItemsOrderedActionGroup.xml | 17 + ...illOrderCustomerInformationActionGroup.xml | 29 + .../FilterInvoiceGridByOrderIdActionGroup.xml | 25 + ...idByOrderIdWithCleanFiltersActionGroup.xml | 17 + ...erOrderGridByBaseTotalRangeActionGroup.xml | 26 + ...ilterOrderGridByBillingNameActionGroup.xml | 26 + .../FilterOrderGridByIdActionGroup.xml | 30 + ...lterOrderGridByPurchaseDateActionGroup.xml | 26 + .../FilterOrderGridByStatusActionGroup.xml | 24 + .../GoToInvoiceIntoOrderActionGroup.xml | 20 + ...ewOrderPageExistingCustomerActionGroup.xml | 39 ++ ...ageExistingCustomerAndStoreActionGroup.xml | 22 + ...teToNewOrderPageNewCustomerActionGroup.xml | 29 + ...rPageNewCustomerSingleStoreActionGroup.xml | 26 + ...dConfigurableProductToOrderActionGroup.xml | 16 + .../ActionGroup/OpenOrderByIdActionGroup.xml | 19 + ...OrderSelectFlatRateShippingActionGroup.xml | 22 + .../OrderSelectFreeShippingActionGroup.xml | 22 + .../SeeProductInInvoiceItemsActionGroup.xml | 21 + .../SeeProductInItemsOrderedActionGroup.xml | 21 + .../SeeProductInItemsRefundedActionGroup.xml | 21 + ...ctBankTransferPaymentMethodActionGroup.xml | 15 + ...CashOnDeliveryPaymentMethodActionGroup.xml | 15 + ...lectCheckMoneyPaymentMethodActionGroup.xml | 19 + ...tPurchaseOrderPaymentMethodActionGroup.xml | 19 + ...tCreateInvoiceFromOrderPageActionGroup.xml | 20 + .../StartToCreateCreditMemoActionGroup.xml | 20 + .../SubmitCreditMemoActionGroup.xml | 19 + .../ActionGroup/SubmitInvoiceActionGroup.xml | 22 + .../UpdateCreditMemoTotalsActionGroup.xml | 15 + ...rifyBasicInvoiceInformationActionGroup.xml | 35 ++ ...VerifyBasicOrderInformationActionGroup.xml | 34 ++ ...rifyCreatedOrderInformationActionGroup.xml | 21 + ...vailabilityCreditMemoWithNoPaymentTest.xml | 12 +- ...OrderWithBankTransferPaymentMethodTest.xml | 8 +- ...derWithCashOnDeliveryPaymentMethodTest.xml | 8 +- ...erWithCheckMoneyOrderPaymentMethodTest.xml | 16 +- ...WithProductQtyWithoutStockDecreaseTest.xml | 14 +- ...rderWithPurchaseOrderPaymentMethodTest.xml | 10 +- ...eatedOrderWithZeroSubtotalCheckoutTest.xml | 10 +- .../AdminChangeCustomerGroupInNewOrder.xml | 4 +- ...dminCheckingCreditMemoUpdateTotalsTest.xml | 4 +- ...kingDateAfterChangeInterfaceLocaleTest.xml | 4 +- ...ectnessInvoicedItemInBundleProductTest.xml | 6 +- ...reateCreditMemoBankTransferPaymentTest.xml | 12 +- ...reateCreditMemoConfigurableProductTest.xml | 12 +- ...AdminCreateCreditMemoPartialRefundTest.xml | 14 +- ...CreateCreditMemoWithCashOnDeliveryTest.xml | 12 +- ...nCreateCreditMemoWithPurchaseOrderTest.xml | 12 +- ...AdminCreateOrderAddProductCheckboxTest.xml | 2 +- ...AdminCreateOrderAndCheckTheReorderTest.xml | 10 +- ...thTwoAddressesTaxableAndNonTaxableTest.xml | 8 +- .../AdminCreateOrderWithBundleProductTest.xml | 8 +- ...reateOrderWithMinimumAmountEnabledTest.xml | 14 +- ...OrderWithSelectedShoppingCartItemsTest.xml | 12 +- .../AdminCreateOrderWithSimpleProductTest.xml | 10 +- ...nimumOrderAmountNotMatchOrderTotalTest.xml | 4 +- .../Mftf/Test/AdminHoldCreatedOrderTest.xml | 10 +- ...rderCreationWithMultiWebsiteConfigTest.xml | 8 +- .../Test/AdminReorderWithCatalogPriceTest.xml | 2 +- ...dminSaveInAddressBookCheckboxStateTest.xml | 4 +- ...dminSubmitConfigurableProductOrderTest.xml | 12 +- ...ubmitsOrderPaymentMethodValidationTest.xml | 10 +- ...minSubmitsOrderWithAndWithoutEmailTest.xml | 12 +- ...rderWithAndWithoutFieldsValidationTest.xml | 12 +- ...mOrderStatusNotVisibleOnStorefrontTest.xml | 4 +- ...SSVulnerabilityDuringOrderCreationTest.xml | 2 +- .../CreateInvoiceAndCheckInvoiceOrderTest.xml | 6 +- ...iceWithCashOnDeliveryPaymentMethodTest.xml | 4 +- ...eWithShipmentAndCheckInvoicedOrderTest.xml | 10 +- ...ateInvoiceWithZeroSubtotalCheckoutTest.xml | 8 +- .../CreateOrderFromEditCustomerPageTest.xml | 8 +- .../Test/Mftf/Test/EndToEndB2CAdminTest.xml | 42 +- ...eredConfigurableProductOnOrderPageTest.xml | 4 +- .../Test/StorefrontPrintOrderGuestTest.xml | 6 +- ...ustomStoreShippingMethodTableRatesTest.xml | 6 +- .../AdminCreatePartialShipmentEntityTest.xml | 6 +- .../Test/AdminCreateShipmentEntityTest.xml | 6 +- .../AdminTaxCalcWithApplyTaxOnSettingTest.xml | 6 +- .../Test/Mftf/Test/AdminTaxReportGridTest.xml | 10 +- .../Mftf/Test/CheckCreditMemoTotalsTest.xml | 6 +- 144 files changed, 1652 insertions(+), 1133 deletions(-) create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/AddBundleProductToOrderActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/AddBundleProductToOrderAndCheckPriceInGridActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/AddConfigurableProductToOrderActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/AddConfigurableProductToOrderFromAdminActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/AddDownloadableProductToOrderActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/AddGroupedProductOptionToOrderActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/AddSimpleProductToOrderActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/AddSimpleProductWithQtyToOrderActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminCreateInvoiceAndCreditMemoActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminCreateInvoiceAndShipmentActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminFastCreateInvoiceActionGroup.xml delete mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminInvoiceActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOpenAndFillCreditMemoRefundAndBackToStockActionGroup.xml delete mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml delete mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderGridActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrdersGridClearFiltersActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/AssertOrderAddressInformationActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/CancelPendingOrderActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/ChangeShippingMethodActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/CheckRequiredFieldsNewOrderFormActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/ClearInvoicesGridFiltersActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/ConfigureOrderedConfigurableProductActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/CreateOrderActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/CreateOrderFilteringCustomerByEmailActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/CreateOrderInStoreActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/CreateOrderInStoreChoosingPaymentMethodActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/CreateOrderToPrintPageWithSelectedPaymentMethodActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/DontSeeProductInItemsOrderedActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/FillOrderCustomerInformationActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/FilterInvoiceGridByOrderIdActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/FilterInvoiceGridByOrderIdWithCleanFiltersActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/FilterOrderGridByBaseTotalRangeActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/FilterOrderGridByBillingNameActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/FilterOrderGridByIdActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/FilterOrderGridByPurchaseDateActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/FilterOrderGridByStatusActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/GoToInvoiceIntoOrderActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/NavigateToNewOrderPageExistingCustomerActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/NavigateToNewOrderPageExistingCustomerAndStoreActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/NavigateToNewOrderPageNewCustomerActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/NavigateToNewOrderPageNewCustomerSingleStoreActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/NewAddConfigurableProductToOrderActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/OpenOrderByIdActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/OrderSelectFlatRateShippingActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/OrderSelectFreeShippingActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/SeeProductInInvoiceItemsActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/SeeProductInItemsOrderedActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/SeeProductInItemsRefundedActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/SelectBankTransferPaymentMethodActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/SelectCashOnDeliveryPaymentMethodActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/SelectCheckMoneyPaymentMethodActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/SelectPurchaseOrderPaymentMethodActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/StartCreateInvoiceFromOrderPageActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/StartToCreateCreditMemoActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/SubmitCreditMemoActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/SubmitInvoiceActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/UpdateCreditMemoTotalsActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/VerifyBasicInvoiceInformationActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/VerifyBasicOrderInformationActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/VerifyCreatedOrderInformationActionGroup.xml diff --git a/app/code/Magento/Backend/Test/Mftf/Test/AdminDashboardWithChartsChart.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminDashboardWithChartsChart.xml index f48c7752efc7a..53d2081958b21 100644 --- a/app/code/Magento/Backend/Test/Mftf/Test/AdminDashboardWithChartsChart.xml +++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminDashboardWithChartsChart.xml @@ -76,7 +76,7 @@ <grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderNumber"/> <!-- Search for Order in the order grid --> <comment userInput="Search for Order in the order grid" stepKey="searchOrderInGrid"/> - <actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGridById"> <argument name="orderId" value="$grabOrderNumber"/> </actionGroup> <waitForLoadingMaskToDisappear stepKey="waitForSearchingOrder"/> diff --git a/app/code/Magento/Braintree/Test/Mftf/Test/CreateAnAdminOrderUsingBraintreePaymentTest1.xml b/app/code/Magento/Braintree/Test/Mftf/Test/CreateAnAdminOrderUsingBraintreePaymentTest1.xml index 2594d245f9ff0..5a332b3518256 100644 --- a/app/code/Magento/Braintree/Test/Mftf/Test/CreateAnAdminOrderUsingBraintreePaymentTest1.xml +++ b/app/code/Magento/Braintree/Test/Mftf/Test/CreateAnAdminOrderUsingBraintreePaymentTest1.xml @@ -59,23 +59,23 @@ <waitForPageLoad stepKey="waitForLogin" time="3"/> <!--Create New Order--> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrder"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrder"> <argument name="customer" value="Simple_US_Customer"/> </actionGroup> <!--Add Product to Order--> - <actionGroup ref="addSimpleProductToOrder" stepKey="addProduct"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addProduct"> <argument name="product" value="_defaultProduct"/> </actionGroup> <!--Fill Order Customer Information--> - <actionGroup ref="fillOrderCustomerInformation" stepKey="fillCustomerAddress"> + <actionGroup ref="FillOrderCustomerInformationActionGroup" stepKey="fillCustomerAddress"> <argument name="customer" value="Simple_US_Customer"/> <argument name="address" value="US_Address_TX"/> </actionGroup> <!--Select Shipping--> - <actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRateShipping"/> + <actionGroup ref="OrderSelectFlatRateShippingActionGroup" stepKey="selectFlatRateShipping"/> <waitForPageLoad stepKey="waitForShippingToFinish"/> <!--Pay with Braintree --> diff --git a/app/code/Magento/Braintree/Test/Mftf/Test/CretateAdminOrderWithOnlinePaymentIncludingTaxAndDiscount.xml b/app/code/Magento/Braintree/Test/Mftf/Test/CretateAdminOrderWithOnlinePaymentIncludingTaxAndDiscount.xml index 8f0ce4918b978..b2f13d6c8c56c 100644 --- a/app/code/Magento/Braintree/Test/Mftf/Test/CretateAdminOrderWithOnlinePaymentIncludingTaxAndDiscount.xml +++ b/app/code/Magento/Braintree/Test/Mftf/Test/CretateAdminOrderWithOnlinePaymentIncludingTaxAndDiscount.xml @@ -98,17 +98,17 @@ <actionGroup ref="saveProductForm" stepKey="saveProductForm"/> <!--Create New Order--> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderWithExistingCustomer"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderWithExistingCustomer"> <argument name="customer" value="$$simpleCustomer$$"/> </actionGroup> <!--Add a product to order--> - <actionGroup ref="addSimpleProductToOrder" stepKey="addProductToOrder"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addProductToOrder"> <argument name="product" value="$$simpleProduct$$"/> </actionGroup> <!--Select FlatRate shipping method--> - <actionGroup ref="orderSelectFlatRateShipping" stepKey="orderSelectFlatRateShippingMethod"/> + <actionGroup ref="OrderSelectFlatRateShippingActionGroup" stepKey="orderSelectFlatRateShippingMethod"/> <!--Select Braintree online Payment method --> <actionGroup ref="AdminOrderBraintreeFillActionGroup" stepKey="selectCreditCardPayment"/> @@ -119,7 +119,7 @@ <see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="You created the order." stepKey="seeOrderSuccessMessage" after="waitForSubmitOrder"/> <!-- Create New invoice--> - <actionGroup ref="adminFastCreateInvoice" stepKey="createInvoice"/> + <actionGroup ref="AdminFastCreateInvoiceActionGroup" stepKey="createInvoice"/> <!--Get access to Credit Memo page from Invoice page--> <click selector="{{AdminInvoiceMainActionsSection.openNewCreditMemoFromInvoice}}" stepKey="clickCreateNewCreditMemo"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAddBundleProductWithZeroPriceToShoppingCartTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAddBundleProductWithZeroPriceToShoppingCartTest.xml index 33181d6e920eb..64b786ac4ed7c 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAddBundleProductWithZeroPriceToShoppingCartTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAddBundleProductWithZeroPriceToShoppingCartTest.xml @@ -67,7 +67,7 @@ <!--Check subtotal in created order--> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - <actionGroup ref="filterOrderGridById" stepKey="filterOrderById"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderById"> <argument name="orderId" value="$grabOrderNumber"/> </actionGroup> <click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/CheckTierPricingOfProductsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/CheckTierPricingOfProductsTest.xml index cee40241185b4..9e980784e1a7c 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/CheckTierPricingOfProductsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/CheckTierPricingOfProductsTest.xml @@ -149,7 +149,7 @@ <see userInput="You saved the rule." stepKey="RuleSaved"/> <!--Create new order--> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="CreateNewOrder"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="CreateNewOrder"> <argument name="customer" value="Simple_US_Customer"/> <argument name="storeView" value="customStoreView"/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductCustomOptionsDifferentStoreViewsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductCustomOptionsDifferentStoreViewsTest.xml index a0670bdee54c7..a96797f080a40 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductCustomOptionsDifferentStoreViewsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductCustomOptionsDifferentStoreViewsTest.xml @@ -196,7 +196,7 @@ <!-- Open Order --> - <actionGroup ref="filterOrderGridById" stepKey="openOrdersGrid"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="openOrdersGrid"> <argument name="orderId" value="{$grabOrderNumber}"/> </actionGroup> <click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductWithCustomOptionsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductWithCustomOptionsTest.xml index 12a465188aa85..c0653d9dbba7e 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductWithCustomOptionsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductWithCustomOptionsTest.xml @@ -130,7 +130,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/> - <actionGroup ref="filterOrderGridById" stepKey="filterByOrderId"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterByOrderId"> <argument name="orderId" value="$grabOrderNumber"/> </actionGroup> <click selector="{{AdminDataGridTableSection.firstRow}}" stepKey="clickOrderRow"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingDefaultAddressTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingDefaultAddressTest.xml index aa3665a81bbde..428b569046fa5 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingDefaultAddressTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingDefaultAddressTest.xml @@ -87,7 +87,7 @@ <!-- Open created order in backend --> <amOnPage url="{{AdminOrdersPage.url}}" stepKey="goToOrders"/> <waitForPageLoad stepKey="waitForOrdersPageLoad"/> - <actionGroup ref="OpenOrderById" stepKey="filterOrderGridById"> + <actionGroup ref="OpenOrderByIdActionGroup" stepKey="filterOrderGridById"> <argument name="orderId" value="$grabOrderNumber"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNewAddressTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNewAddressTest.xml index bafad6f28a680..8ae1bb83d852b 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNewAddressTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNewAddressTest.xml @@ -100,7 +100,7 @@ <!-- Open created order in backend --> <amOnPage url="{{AdminOrdersPage.url}}" stepKey="goToOrders"/> <waitForPageLoad stepKey="waitForOrdersPageLoad"/> - <actionGroup ref="OpenOrderById" stepKey="filterOrderGridById"> + <actionGroup ref="OpenOrderByIdActionGroup" stepKey="filterOrderGridById"> <argument name="orderId" value="$grabOrderNumber"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNonDefaultAddressTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNonDefaultAddressTest.xml index 2c341a5c4c1ab..4d5443d8430d7 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNonDefaultAddressTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNonDefaultAddressTest.xml @@ -88,7 +88,7 @@ <!-- Open created order in backend --> <amOnPage url="{{AdminOrdersPage.url}}" stepKey="goToOrders"/> <waitForPageLoad stepKey="waitForOrdersPageLoad"/> - <actionGroup ref="OpenOrderById" stepKey="filterOrderGridById"> + <actionGroup ref="OpenOrderByIdActionGroup" stepKey="filterOrderGridById"> <argument name="orderId" value="$grabOrderNumber"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutUsingSignInLinkTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutUsingSignInLinkTest.xml index 990459d7c81b7..5b01246170a95 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutUsingSignInLinkTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutUsingSignInLinkTest.xml @@ -81,7 +81,7 @@ <!-- Open created order in backend --> <amOnPage url="{{AdminOrdersPage.url}}" stepKey="goToOrders"/> <waitForPageLoad stepKey="waitForOrdersPageLoad"/> - <actionGroup ref="OpenOrderById" stepKey="filterOrderGridById"> + <actionGroup ref="OpenOrderByIdActionGroup" stepKey="filterOrderGridById"> <argument name="orderId" value="$grabOrderNumber"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml index e85a47ab7a91d..72ca058f7efd9 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml @@ -197,7 +197,7 @@ <!-- Open created order --> <amOnPage url="{{AdminOrdersPage.url}}" stepKey="goToOrders"/> <waitForPageLoad stepKey="waitForOrderPageLoad"/> - <actionGroup ref="OpenOrderById" stepKey="filterOrderGridById"> + <actionGroup ref="OpenOrderByIdActionGroup" stepKey="filterOrderGridById"> <argument name="orderId" value="$grabOrderNumber"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontApplyPromoCodeDuringCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontApplyPromoCodeDuringCheckoutTest.xml index bdfdfceab53f9..6aa44d3c10499 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontApplyPromoCodeDuringCheckoutTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontApplyPromoCodeDuringCheckoutTest.xml @@ -80,7 +80,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <!-- Verify total on order page --> - <actionGroup ref="filterOrderGridById" stepKey="filterOrderById"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderById"> <argument name="orderId" value="$grabOrderNumber"/> </actionGroup> <click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndProductWithTierPricesTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndProductWithTierPricesTest.xml index c5d1c34a93b32..e7ff46f049109 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndProductWithTierPricesTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndProductWithTierPricesTest.xml @@ -111,7 +111,7 @@ <waitForPageLoad stepKey="waitForOrderIndexPageToLoad"/> <!-- Filter Order using orderId and assert order--> - <actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGridById"> <argument name="orderId" value="$orderId"/> </actionGroup> <click selector="{{AdminOrdersGridSection.viewLink('$orderId')}}" stepKey="clickOnViewLink"/> @@ -127,4 +127,4 @@ <!-- Assert order buttons --> <actionGroup ref="AdminAssertOrderAvailableButtonsActionGroup" stepKey="assertOrderButtons"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndRegisterCustomerAfterCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndRegisterCustomerAfterCheckoutTest.xml index 34dc6617d25d5..a943f928d9f18 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndRegisterCustomerAfterCheckoutTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndRegisterCustomerAfterCheckoutTest.xml @@ -81,7 +81,7 @@ <waitForPageLoad stepKey="waitForPageLoad5"/> <!-- Filter Order using orderId and assert order--> - <actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGridById"> <argument name="orderId" value="$orderId"/> </actionGroup> @@ -98,4 +98,4 @@ <!-- Assert order buttons --> <actionGroup ref="AdminAssertOrderAvailableButtonsActionGroup" stepKey="assertOrderButtons"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithSpecialPriceProductsTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithSpecialPriceProductsTest.xml index 6ccb05bf4c4f7..255e9445e7948 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithSpecialPriceProductsTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithSpecialPriceProductsTest.xml @@ -151,7 +151,7 @@ <waitForPageLoad stepKey="waitForPageLoad5"/> <!-- Filter Order using orderId and assert order--> - <actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGridById"> <argument name="orderId" value="$orderId"/> </actionGroup> @@ -168,4 +168,4 @@ <!-- Assert order buttons --> <actionGroup ref="AdminAssertOrderAvailableButtonsActionGroup" stepKey="assertOrderButtons"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutOnLoginWhenGuestCheckoutIsDisabledTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutOnLoginWhenGuestCheckoutIsDisabledTest.xml index b0b72515611e8..9b9c5044af0bd 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutOnLoginWhenGuestCheckoutIsDisabledTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutOnLoginWhenGuestCheckoutIsDisabledTest.xml @@ -81,7 +81,7 @@ <waitForPageLoad stepKey="waitForPageLoad"/> <!-- Filter Order using orderId and assert order--> - <actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGridById"> <argument name="orderId" value="$orderId"/> </actionGroup> @@ -91,4 +91,4 @@ <!-- Ship the order and assert the shipping status --> <actionGroup ref="AdminShipThePendingOrderActionGroup" stepKey="shipTheOrder"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutWithNewCustomerRegistrationAndDisableGuestCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutWithNewCustomerRegistrationAndDisableGuestCheckoutTest.xml index f7e54867b1ae4..931ee4e8ec59d 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutWithNewCustomerRegistrationAndDisableGuestCheckoutTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutWithNewCustomerRegistrationAndDisableGuestCheckoutTest.xml @@ -119,7 +119,7 @@ <waitForPageLoad stepKey="waitForPageLoad"/> <!-- Filter Order using orderId and assert order--> - <actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGridById"> <argument name="orderId" value="$orderId"/> </actionGroup> @@ -129,4 +129,4 @@ <!-- Ship the order and assert the shipping status --> <actionGroup ref="AdminShipThePendingOrderActionGroup" stepKey="shipTheOrder"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutUsingFreeShippingAndTaxesTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutUsingFreeShippingAndTaxesTest.xml index 2226e1ebc8292..961fc226d9d1e 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutUsingFreeShippingAndTaxesTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutUsingFreeShippingAndTaxesTest.xml @@ -196,7 +196,7 @@ <waitForPageLoad stepKey="waitForPageLoad5"/> <!-- Filter Order using orderId and assert order--> - <actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGridById"> <argument name="orderId" value="$orderId"/> </actionGroup> <click selector="{{AdminOrdersGridSection.viewLink('$orderId')}}" stepKey="clickOnViewLink"/> @@ -220,4 +220,4 @@ <argument name="customerGroup" value=""/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutWithCouponAndZeroSubtotalTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutWithCouponAndZeroSubtotalTest.xml index 33ec099aa2ace..1fc6b7fc3eaf7 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutWithCouponAndZeroSubtotalTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutWithCouponAndZeroSubtotalTest.xml @@ -77,7 +77,7 @@ <waitForPageLoad stepKey="waitForPageLoad5"/> <!-- Filter Order using orderId and assert order--> - <actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGridById"> <argument name="orderId" value="$orderId"/> </actionGroup> <click selector="{{AdminOrdersGridSection.viewLink('$orderId')}}" stepKey="clickOnViewLink"/> @@ -90,4 +90,4 @@ <see selector="{{AdminOrderTotalSection.grandTotal}}" userInput="$0.00" stepKey="seeGrandTotal"/> <see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="Pending" stepKey="seeOrderStatus"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontProductQuantityChangesInBackendAfterCustomerCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontProductQuantityChangesInBackendAfterCustomerCheckoutTest.xml index 285dc28cb520e..d0d5600175556 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontProductQuantityChangesInBackendAfterCustomerCheckoutTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontProductQuantityChangesInBackendAfterCustomerCheckoutTest.xml @@ -71,7 +71,7 @@ <waitForPageLoad stepKey="waitForPageLoad5"/> <!-- Filter Order using orderId and assert order--> - <actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGridById"> <argument name="orderId" value="$orderId"/> </actionGroup> <click selector="{{AdminOrdersGridSection.viewLink('$orderId')}}" stepKey="clickOnViewLink"/> @@ -102,4 +102,4 @@ </actionGroup> <see selector="{{StorefrontProductInfoMainSection.productStockStatus}}" userInput="Out Of Stock" stepKey="seeProductDisplayedAsOutOfStock"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKCustomerCheckoutWithCouponTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKCustomerCheckoutWithCouponTest.xml index 482e2fb6233a6..176bf2d0089c7 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKCustomerCheckoutWithCouponTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKCustomerCheckoutWithCouponTest.xml @@ -116,7 +116,7 @@ <waitForPageLoad stepKey="waitForPageLoad5"/> <!-- Filter Order using orderId and assert order--> - <actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGridById"> <argument name="orderId" value="$orderId"/> </actionGroup> <see selector="{{AdminOrdersGridSection.firstRow}}" userInput="$$createCustomer.fullname$$" stepKey="seeCustomerNameInGrid"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKGuestCheckoutWithConditionProductQuantityEqualsToOrderedQuantityTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKGuestCheckoutWithConditionProductQuantityEqualsToOrderedQuantityTest.xml index deab32aede324..d9686d6784f39 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKGuestCheckoutWithConditionProductQuantityEqualsToOrderedQuantityTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKGuestCheckoutWithConditionProductQuantityEqualsToOrderedQuantityTest.xml @@ -66,7 +66,7 @@ <waitForPageLoad stepKey="waitForPageLoad5"/> <!-- Filter Order using orderId and assert order--> - <actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGridById"> <argument name="orderId" value="$orderId"/> </actionGroup> <click selector="{{AdminOrdersGridSection.viewLink('$orderId')}}" stepKey="clickOnViewLink"/> @@ -97,4 +97,4 @@ </actionGroup> <see selector="{{StorefrontProductInfoMainSection.productStockStatus}}" userInput="Out Of Stock" stepKey="seeProductDisplayedAsOutOfStock"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUSCustomerCheckoutWithCouponAndBankTransferPaymentMethodTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUSCustomerCheckoutWithCouponAndBankTransferPaymentMethodTest.xml index 6d5f79f3aadf4..eb4633ee80c11 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUSCustomerCheckoutWithCouponAndBankTransferPaymentMethodTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUSCustomerCheckoutWithCouponAndBankTransferPaymentMethodTest.xml @@ -78,7 +78,7 @@ <waitForPageLoad stepKey="waitForPageLoad"/> <!-- Filter Order using orderId and assert order--> - <actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGridById"> <argument name="orderId" value="$orderId"/> </actionGroup> <click selector="{{AdminOrdersGridSection.viewLink('$orderId')}}" stepKey="clickOnViewLink"/> @@ -94,4 +94,4 @@ <!-- Assert order buttons --> <actionGroup ref="AdminAssertOrderAvailableButtonsActionGroup" stepKey="assertOrderButtons"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml index 4b3e18fb31877..88dffc32377cc 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml @@ -90,7 +90,7 @@ <waitForPageLoad stepKey="waitForSalesOrderPageLoaded"/> <!-- Open Order --> - <actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGridById"> <argument name="orderId" value="$grabOrderNumber"/> </actionGroup> <click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoOptionAvailableToConfigureDisabledProductTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoOptionAvailableToConfigureDisabledProductTest.xml index fd607d2203c66..21ffe1deef01c 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoOptionAvailableToConfigureDisabledProductTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoOptionAvailableToConfigureDisabledProductTest.xml @@ -118,7 +118,7 @@ <actionGroup ref="saveProductForm" stepKey="saveSecondProductForm"/> <!-- Go to created customer page --> <comment userInput="Go to created customer page" stepKey="goToCreatedCustomerPage"/> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="createNewOrder"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="createNewOrder"> <argument name="customer" value="$$createCustomer$$"/> </actionGroup> <click selector="{{AdminOrderFormItemsSection.addProducts}}" stepKey="clickToAddProduct"/> @@ -133,7 +133,7 @@ <dontSee userInput="$$createConfigProductAttributeOption1.option[store_labels][1][label]$$" stepKey="dontSeeOption1"/> <!-- Go to created customer page again --> <comment userInput="Go to created customer page again" stepKey="goToCreatedCustomerPageAgain"/> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="createNewOrderAgain"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="createNewOrderAgain"> <argument name="customer" value="$$createCustomer$$"/> </actionGroup> <click selector="{{AdminOrderFormItemsSection.addProducts}}" stepKey="clickToAddProductAgain"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ProductsQtyReturnAfterOrderCancelTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ProductsQtyReturnAfterOrderCancelTest.xml index c3459aec34492..80202396720bf 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ProductsQtyReturnAfterOrderCancelTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ProductsQtyReturnAfterOrderCancelTest.xml @@ -66,7 +66,7 @@ <grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="grabOrderNumber"/> - <actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGridById"> <argument name="orderId" value="$grabOrderNumber"/> </actionGroup> @@ -83,7 +83,7 @@ <fillField selector="{{AdminShipmentItemsSection.itemQtyToShip('1')}}" userInput="1" stepKey="changeItemQtyToShip"/> <click selector="{{AdminShipmentMainActionsSection.submitShipment}}" stepKey="clickSubmitShipment"/> <waitForPageLoad stepKey="waitShipmentSectionToLoad"/> - <actionGroup ref="cancelPendingOrder" stepKey="cancelPendingOption"> + <actionGroup ref="CancelPendingOrderActionGroup" stepKey="cancelPendingOption"> <argument name="orderStatus" value="Complete"/> </actionGroup> diff --git a/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayWhenChooseThreeAllowedCurrenciesTest.xml b/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayWhenChooseThreeAllowedCurrenciesTest.xml index 26fbfd394be68..6de2a46a5d3d9 100644 --- a/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayWhenChooseThreeAllowedCurrenciesTest.xml +++ b/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayWhenChooseThreeAllowedCurrenciesTest.xml @@ -61,7 +61,7 @@ </actionGroup> <grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="grabNewOrderNumber"/> <!--Open order and check rates display in one line--> - <actionGroup ref="OpenOrderById" stepKey="openNewOrderById"> + <actionGroup ref="OpenOrderByIdActionGroup" stepKey="openNewOrderById"> <argument name="orderId" value="$grabNewOrderNumber"/> </actionGroup> <see selector="{{AdminOrderDetailsInformationSection.orderInformationTable}}" userInput="EUR / USD rate" stepKey="seeUSDandEURRate"/> diff --git a/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayedInOneLineTest.xml b/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayedInOneLineTest.xml index dc6bdf3db542e..3e3d3f5d20f26 100644 --- a/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayedInOneLineTest.xml +++ b/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayedInOneLineTest.xml @@ -64,7 +64,7 @@ </actionGroup> <grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="grabOrderNumber"/> <!--Open order and check rates display in one line--> - <actionGroup ref="OpenOrderById" stepKey="openOrderById"> + <actionGroup ref="OpenOrderByIdActionGroup" stepKey="openOrderById"> <argument name="orderId" value="$grabOrderNumber"/> </actionGroup> <see selector="{{AdminOrderDetailsInformationSection.orderInformationTable}}" userInput="EUR / USD rate" stepKey="seeEURandUSDRate"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminPanelIsFrozenIfStorefrontIsOpenedViaCustomerViewTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminPanelIsFrozenIfStorefrontIsOpenedViaCustomerViewTest.xml index d2d3343a3b8d3..ee32214435428 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminPanelIsFrozenIfStorefrontIsOpenedViaCustomerViewTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminPanelIsFrozenIfStorefrontIsOpenedViaCustomerViewTest.xml @@ -30,22 +30,22 @@ <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> <actionGroup ref="logout" stepKey="logout"/> </after> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderPage"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderPage"> <argument name="customer" value="$simpleCustomer$"/> </actionGroup> - <actionGroup ref="addSimpleProductToOrder" stepKey="addSecondProduct"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSecondProduct"> <argument name="product" value="$createSimpleProduct$"/> </actionGroup> - <actionGroup ref="fillOrderCustomerInformation" stepKey="fillCustomerInfo"> + <actionGroup ref="FillOrderCustomerInformationActionGroup" stepKey="fillCustomerInfo"> <argument name="customer" value="$simpleCustomer$"/> <argument name="address" value="US_Address_TX"/> </actionGroup> - <actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRate"/> + <actionGroup ref="OrderSelectFlatRateShippingActionGroup" stepKey="selectFlatRate"/> <actionGroup ref="AdminSubmitOrderActionGroup" stepKey="submitOrder"/> <grabTextFrom selector="|Order # (\d+)|" stepKey="getOrderId"/> - <actionGroup ref="StartCreateInvoiceFromOrderPage" stepKey="startCreateInvoice"/> - <actionGroup ref="SubmitInvoice" stepKey="submitInvoice"/> + <actionGroup ref="StartCreateInvoiceFromOrderPageActionGroup" stepKey="startCreateInvoice"/> + <actionGroup ref="SubmitInvoiceActionGroup" stepKey="submitInvoice"/> <actionGroup ref="goToShipmentIntoOrder" stepKey="goToShipment"/> <actionGroup ref="submitShipmentIntoOrder" stepKey="submitShipment"/> diff --git a/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontMyAccountWithMultishipmentTest.xml b/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontMyAccountWithMultishipmentTest.xml index eec8a40877bb3..0af5be7dafb3c 100644 --- a/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontMyAccountWithMultishipmentTest.xml +++ b/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontMyAccountWithMultishipmentTest.xml @@ -96,7 +96,7 @@ <waitForLoadingMaskToDisappear stepKey="waitForLoading"/> <!--Assert order in orders grid --> <!-- Go to order page --> - <actionGroup ref="OpenOrderById" stepKey="openFirstOrderPage"> + <actionGroup ref="OpenOrderByIdActionGroup" stepKey="openFirstOrderPage"> <argument name="orderId" value="{$getFirstOrderIdPlaceOrder}"/> </actionGroup> <!-- Check status --> @@ -106,7 +106,7 @@ <waitForPageLoad stepKey="waitForOrderPageLoad4"/> <actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearFilters2"/> <!-- Go to order page --> - <actionGroup ref="OpenOrderById" stepKey="openSecondOrderPage"> + <actionGroup ref="OpenOrderByIdActionGroup" stepKey="openSecondOrderPage"> <argument name="orderId" value="{$getSecondOrderIdPlaceOrder}"/> </actionGroup> <!-- Check status --> diff --git a/app/code/Magento/Reports/Test/Mftf/Test/CancelOrdersInOrderSalesReportTest.xml b/app/code/Magento/Reports/Test/Mftf/Test/CancelOrdersInOrderSalesReportTest.xml index 0412e945362e4..324b56757c516 100644 --- a/app/code/Magento/Reports/Test/Mftf/Test/CancelOrdersInOrderSalesReportTest.xml +++ b/app/code/Magento/Reports/Test/Mftf/Test/CancelOrdersInOrderSalesReportTest.xml @@ -62,7 +62,7 @@ </actionGroup> <!-- Cancel order --> - <actionGroup ref="cancelPendingOrder" stepKey="cancelOrder"/> + <actionGroup ref="CancelPendingOrderActionGroup" stepKey="cancelOrder"/> <!-- Generate Order report for statuses --> <amOnPage url="{{OrdersReportPage.url}}" stepKey="goToOrdersReportPage1"/> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AddBundleProductToOrderActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AddBundleProductToOrderActionGroup.xml new file mode 100644 index 0000000000000..ee252990e0646 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AddBundleProductToOrderActionGroup.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddBundleProductToOrderActionGroup"> + <annotations> + <description>Adds the provided Bundled Product with the provided Option to an Order. Fills in the provided Product Qty. Clicks on 'Add Selected Product(s) to Order'.</description> + </annotations> + <arguments> + <argument name="product"/> + <argument name="quantity" type="string" defaultValue="1"/> + </arguments> + + <click selector="{{AdminOrderFormItemsSection.addProducts}}" stepKey="clickAddProducts"/> + <fillField selector="{{AdminOrderFormItemsSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillSkuFilterBundle"/> + <click selector="{{AdminOrderFormItemsSection.search}}" stepKey="clickSearchBundle"/> + <scrollTo selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" x="0" y="-100" stepKey="scrollToCheckColumn"/> + <checkOption selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" stepKey="selectBundleProduct"/> + <waitForElementVisible selector="{{AdminOrderFormBundleProductSection.quantity}}" stepKey="waitForBundleOptionLoad"/> + <wait time="2" stepKey="waitForOptionsToLoad"/> + <fillField selector="{{AdminOrderFormBundleProductSection.quantity}}" userInput="{{quantity}}" stepKey="fillQuantity"/> + <click selector="{{AdminOrderFormConfigureProductSection.ok}}" stepKey="clickOk"/> + <scrollTo selector="{{AdminOrderFormItemsSection.addSelected}}" x="0" y="-100" stepKey="scrollToAddSelectedButton"/> + <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickAddSelectedProducts"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AddBundleProductToOrderAndCheckPriceInGridActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AddBundleProductToOrderAndCheckPriceInGridActionGroup.xml new file mode 100644 index 0000000000000..71205ff9808d0 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AddBundleProductToOrderAndCheckPriceInGridActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddBundleProductToOrderAndCheckPriceInGridActionGroup" extends="AddBundleProductToOrderActionGroup"> + <annotations> + <description>EXTENDS: addBundleProductToOrder. Validates that the provided Product Price is present and correct in the 'Items Ordered' section.</description> + </annotations> + <arguments> + <argument name="price" type="string"/> + </arguments> + + <grabTextFrom selector="{{AdminOrderFormItemsSection.rowPrice('1')}}" stepKey="grabProductPriceFromGrid" after="clickOk"/> + <assertEquals stepKey="assertProductPriceInGrid" message="Bundle product price in grid should be equal {{price}}" after="grabProductPriceFromGrid"> + <expectedResult type="string">{{price}}</expectedResult> + <actualResult type="variable">grabProductPriceFromGrid</actualResult> + </assertEquals> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AddConfigurableProductToOrderActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AddConfigurableProductToOrderActionGroup.xml new file mode 100644 index 0000000000000..dee2af6cd4053 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AddConfigurableProductToOrderActionGroup.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddConfigurableProductToOrderActionGroup"> + <annotations> + <description>Adds the provided Configurable Product with the provided Option to an Order. Fills in the provided Product Qty. Clicks on 'Add Selected Product(s) to Order'.</description> + </annotations> + <arguments> + <argument name="product"/> + <argument name="attribute"/> + <argument name="option"/> + </arguments> + + <click selector="{{AdminOrderFormItemsSection.addProducts}}" stepKey="clickAddProducts"/> + <fillField selector="{{AdminOrderFormItemsSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillSkuFilterConfigurable"/> + <click selector="{{AdminOrderFormItemsSection.search}}" stepKey="clickSearchConfigurable"/> + <scrollTo selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" x="0" y="-100" stepKey="scrollToCheckColumn"/> + <checkOption selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" stepKey="selectConfigurableProduct"/> + <waitForElementVisible selector="{{AdminOrderFormConfigureProductSection.optionSelect(attribute.default_label)}}" stepKey="waitForConfigurablePopover"/> + <wait time="2" stepKey="waitForOptionsToLoad"/> + <selectOption selector="{{AdminOrderFormConfigureProductSection.optionSelect(attribute.default_label)}}" userInput="{{option.name}}" stepKey="selectionConfigurableOption"/> + <click selector="{{AdminOrderFormConfigureProductSection.ok}}" stepKey="clickOkConfigurablePopover"/> + <scrollTo selector="{{AdminOrderFormItemsSection.addSelected}}" x="0" y="-100" stepKey="scrollToAddSelectedButton"/> + <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickAddSelectedProducts"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AddConfigurableProductToOrderFromAdminActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AddConfigurableProductToOrderFromAdminActionGroup.xml new file mode 100644 index 0000000000000..200568fe2c05a --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AddConfigurableProductToOrderFromAdminActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddConfigurableProductToOrderFromAdminActionGroup" extends="AddConfigurableProductToOrderActionGroup"> + <annotations> + <description>EXTENDS: addConfigurableProductToOrder. Selects the provided Option to the Configurable Product.</description> + </annotations> + + <waitForElementVisible selector="{{AdminOrderFormConfigureProductSection.optionSelect(attribute.default_frontend_label)}}" stepKey="waitForConfigurablePopover"/> + <selectOption selector="{{AdminOrderFormConfigureProductSection.optionSelect(attribute.default_frontend_label)}}" userInput="{{option.label}}" stepKey="selectionConfigurableOption"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AddDownloadableProductToOrderActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AddDownloadableProductToOrderActionGroup.xml new file mode 100644 index 0000000000000..3018b4308b193 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AddDownloadableProductToOrderActionGroup.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddDownloadableProductToOrderActionGroup"> + <annotations> + <description>Adds a Downloadable Product to an Order. Clicks on 'Add Selected Product(s) to Order'.</description> + </annotations> + + <click selector="{{AdminOrderFormItemsSection.addProducts}}" stepKey="clickAddProducts"/> + <waitForPageLoad time="30" stepKey="waitForPageLoad1"/> + <fillField selector="{{AdminOrderFormItemsSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillSkuFilterDownloadable"/> + <click selector="{{AdminOrderFormItemsSection.search}}" stepKey="clickSearchDownloadable"/> + <scrollTo selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" x="0" y="-100" stepKey="scrollToCheckColumn"/> + <checkOption selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" stepKey="selectDownloadableProduct"/> + <waitForElementVisible selector="{{AdminOrderFormDownloadableProductSection.optionSelect(link.title)}}" stepKey="waitForLinkLoad"/> + <click selector="{{AdminOrderFormDownloadableProductSection.optionSelect(link.title)}}" stepKey="selectLink"/> + <fillField selector="{{AdminOrderFormDownloadableProductSection.quantity}}" userInput="{{quantity}}" stepKey="setQuantity"/> + <click selector="{{AdminOrderFormDownloadableProductSection.ok}}" stepKey="confirmConfiguration"/> + <scrollTo selector="{{AdminOrderFormItemsSection.addSelected}}" x="0" y="-100" stepKey="scrollToAddSelectedButton"/> + <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickAddSelectedProducts"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AddGroupedProductOptionToOrderActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AddGroupedProductOptionToOrderActionGroup.xml new file mode 100644 index 0000000000000..228198527b911 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AddGroupedProductOptionToOrderActionGroup.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddGroupedProductOptionToOrderActionGroup"> + <annotations> + <description>Adds the provided Grouped Product with the provided Option to an Order. Fills in the provided Product Qty. Clicks on 'Add Selected Product(s) to Order'.</description> + </annotations> + <arguments> + <argument name="product"/> + <argument name="option"/> + <argument name="quantity" type="string" defaultValue="1"/> + </arguments> + + <click selector="{{AdminOrderFormItemsSection.addProducts}}" stepKey="clickAddProducts"/> + <fillField selector="{{AdminOrderFormItemsSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillSkuFilterGrouped"/> + <click selector="{{AdminOrderFormItemsSection.search}}" stepKey="clickSearchGrouped"/> + <scrollTo selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" x="0" y="-100" stepKey="scrollToCheckColumn"/> + <checkOption selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" stepKey="selectGroupedProduct"/> + <waitForElementVisible selector="{{AdminOrderFormGroupedProductSection.optionQty(option.sku)}}" stepKey="waitForGroupedOptionLoad"/> + <wait time="2" stepKey="waitForOptionsToLoad"/> + <fillField selector="{{AdminOrderFormGroupedProductSection.optionQty(option.sku)}}" userInput="{{quantity}}" stepKey="fillOptionQuantity"/> + <click selector="{{AdminOrderFormConfigureProductSection.ok}}" stepKey="clickOk"/> + <scrollTo selector="{{AdminOrderFormItemsSection.addSelected}}" x="0" y="-100" stepKey="scrollToAddSelectedButton"/> + <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickAddSelectedProducts"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AddSimpleProductToOrderActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AddSimpleProductToOrderActionGroup.xml new file mode 100644 index 0000000000000..8d5062c79f828 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AddSimpleProductToOrderActionGroup.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddSimpleProductToOrderActionGroup"> + <annotations> + <description>Adds the provided Simple Product to an Order. Fills in the provided Product Qty. Clicks on 'Add Selected Product(s) to Order'.</description> + </annotations> + <arguments> + <argument name="product" defaultValue="_defaultProduct" type="entity"/> + <argument name="productQty" defaultValue="1" type="string"/> + </arguments> + + <click selector="{{AdminOrderFormItemsSection.addProducts}}" stepKey="clickAddProducts"/> + <fillField selector="{{AdminOrderFormItemsSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillSkuFilter"/> + <click selector="{{AdminOrderFormItemsSection.search}}" stepKey="clickSearch"/> + <scrollTo selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" x="0" y="-100" stepKey="scrollToCheckColumn"/> + <checkOption selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" stepKey="selectProduct"/> + <fillField selector="{{AdminOrderFormItemsSection.rowQty('1')}}" userInput="{{productQty}}" stepKey="fillProductQty"/> + <scrollTo selector="{{AdminOrderFormItemsSection.addSelected}}" x="0" y="-100" stepKey="scrollToAddSelectedButton"/> + <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickAddSelectedProducts"/> + <wait time="5" stepKey="waitForOptionsToLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AddSimpleProductWithQtyToOrderActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AddSimpleProductWithQtyToOrderActionGroup.xml new file mode 100644 index 0000000000000..e0d18fa9c2340 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AddSimpleProductWithQtyToOrderActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddSimpleProductWithQtyToOrderActionGroup" extends="AddSimpleProductToOrderActionGroup"> + <arguments> + <argument name="product" defaultValue="_defaultProduct" type="entity"/> + <argument name="productQty" type="string"/> + </arguments> + <fillField selector="{{AdminOrderFormItemsSection.rowQty('1')}}" userInput="{{productQty}}" stepKey="fillProductQty"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminCreateInvoiceActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminCreateInvoiceActionGroup.xml index 416d3f488dd1f..a90c16428ca03 100644 --- a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminCreateInvoiceActionGroup.xml +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminCreateInvoiceActionGroup.xml @@ -15,16 +15,4 @@ <waitForPageLoad stepKey="waitForLoadPage"/> <see userInput="The invoice has been created." stepKey="seeMessage"/> </actionGroup> - <actionGroup name="AdminCreateInvoiceAndShipmentActionGroup" extends="AdminCreateInvoiceActionGroup"> - <checkOption selector="{{AdminInvoicePaymentShippingSection.CreateShipment}}" stepKey="checkCreateShipment" after="waitForInvoicePage"/> - <see userInput="You created the invoice and shipment." stepKey="seeMessage"/> - </actionGroup> - <actionGroup name="AdminCreateInvoiceAndCreditMemoActionGroup" extends="AdminCreateInvoiceActionGroup"> - <click selector="{{AdminOrderDetailsMainActionsSection.creditMemo}}" stepKey="pushButtonCreditMemo" after="seeMessage"/> - <waitForPageLoad stepKey="waitForLoadingCreditMemoPage" after="pushButtonCreditMemo"/> - <scrollTo selector="{{AdminCreditMemoTotalSection.submitRefundOffline}}" stepKey="scrollToBottom" after="waitForLoadingCreditMemoPage"/> - <click selector="{{AdminCreditMemoTotalSection.submitRefundOffline}}" stepKey="clickSubmitRefund" after="scrollToBottom"/> - <waitForPageLoad stepKey="waitForMainOrderPageLoad" after="clickSubmitRefund"/> - <see userInput="You created the credit memo." stepKey="seeCreditMemoMessage" after="waitForMainOrderPageLoad"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminCreateInvoiceAndCreditMemoActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminCreateInvoiceAndCreditMemoActionGroup.xml new file mode 100644 index 0000000000000..a69cd8688c6c5 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminCreateInvoiceAndCreditMemoActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateInvoiceAndCreditMemoActionGroup" extends="AdminCreateInvoiceActionGroup"> + <click selector="{{AdminOrderDetailsMainActionsSection.creditMemo}}" stepKey="pushButtonCreditMemo" after="seeMessage"/> + <waitForPageLoad stepKey="waitForLoadingCreditMemoPage" after="pushButtonCreditMemo"/> + <scrollTo selector="{{AdminCreditMemoTotalSection.submitRefundOffline}}" stepKey="scrollToBottom" after="waitForLoadingCreditMemoPage"/> + <click selector="{{AdminCreditMemoTotalSection.submitRefundOffline}}" stepKey="clickSubmitRefund" after="scrollToBottom"/> + <waitForPageLoad stepKey="waitForMainOrderPageLoad" after="clickSubmitRefund"/> + <see userInput="You created the credit memo." stepKey="seeCreditMemoMessage" after="waitForMainOrderPageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminCreateInvoiceAndShipmentActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminCreateInvoiceAndShipmentActionGroup.xml new file mode 100644 index 0000000000000..047b78a81c2cd --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminCreateInvoiceAndShipmentActionGroup.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateInvoiceAndShipmentActionGroup" extends="AdminCreateInvoiceActionGroup"> + <checkOption selector="{{AdminInvoicePaymentShippingSection.CreateShipment}}" stepKey="checkCreateShipment" after="waitForInvoicePage"/> + <see userInput="You created the invoice and shipment." stepKey="seeMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminCreditMemoActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminCreditMemoActionGroup.xml index 75d41d835bed2..04e4c40060d27 100644 --- a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminCreditMemoActionGroup.xml +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminCreditMemoActionGroup.xml @@ -9,7 +9,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <!--Check customer information is correct in credit memo--> - <actionGroup name="verifyBasicCreditMemoInformation"> + <actionGroup name="VerifyBasicCreditMemoInformationActionGroup"> <annotations> <description>Validates that the provided Customer, Shipping/Billing Address and Customer Group are present and correct on the Admin Credit Memo view page.</description> </annotations> @@ -35,36 +35,6 @@ <see selector="{{AdminCreditMemoAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.postcode}}" stepKey="seeShippingAddressPostcode"/> </actionGroup> - <actionGroup name="seeProductInItemsRefunded"> - <annotations> - <description>Validates that the provided Product appears in the 'Product' column on the Admin Credit Memo view page.</description> - </annotations> - <arguments> - <argument name="product"/> - </arguments> - <see selector="{{AdminCreditMemoItemsSection.skuColumn}}" userInput="{{product.sku}}" stepKey="seeProductSkuInGrid"/> - </actionGroup> - <actionGroup name="StartToCreateCreditMemoActionGroup"> - <arguments> - <argument name="orderId" type="string"/> - </arguments> - <amOnPage url="{{AdminOrderPage.url(orderId)}}" stepKey="navigateToOrderPage"/> - <click selector="{{AdminOrderDetailsMainActionsSection.creditMemo}}" stepKey="clickCreditMemo"/> - <waitForElementVisible selector="{{AdminHeaderSection.pageTitle}}" stepKey="waitForPageTitle"/> - <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Memo" stepKey="seeNewMemoPageTitle"/> - </actionGroup> - <actionGroup name="SubmitCreditMemoActionGroup"> - <grabFromCurrentUrl regex="~/order_id/(\d+)/~" stepKey="grabOrderId"/> - <waitForElementVisible selector="{{AdminCreditMemoTotalSection.submitRefundOffline}}" stepKey="waitButtonEnabled"/> - <click selector="{{AdminCreditMemoTotalSection.submitRefundOffline}}" stepKey="clickSubmitCreditMemo"/> - <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForMessageAppears"/> - <see selector="{{AdminMessagesSection.success}}" userInput="You created the credit memo." stepKey="seeCreditMemoCreateSuccess"/> - <seeInCurrentUrl url="{{AdminOrderDetailsPage.url}}$grabOrderId" stepKey="seeViewOrderPageCreditMemo"/> - </actionGroup> - <actionGroup name="UpdateCreditMemoTotalsActionGroup"> - <waitForElementVisible selector="{{AdminCreditMemoTotalSection.updateTotals}}" stepKey="waitUpdateTotalsButtonEnabled"/> - <click selector="{{AdminCreditMemoTotalSection.updateTotals}}" stepKey="clickUpdateTotals"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminFastCreateInvoiceActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminFastCreateInvoiceActionGroup.xml new file mode 100644 index 0000000000000..b5175b6c3002e --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminFastCreateInvoiceActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminFastCreateInvoiceActionGroup"> + <annotations> + <description>Clicks on 'Invoice' on the Admin Orders view page. Clicks on 'Submit Invoice'. Clicks on 'View Invoice'.</description> + </annotations> + + <click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoiceButton"/> + <waitForPageLoad stepKey="waitForNewInvoicePageLoad"/> + <click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/> + <see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="The invoice has been created." stepKey="seeSuccessMessage"/> + <click selector="{{AdminOrderDetailsOrderViewSection.invoices}}" stepKey="clickInvoices"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask5"/> + <conditionalClick selector="{{AdminOrderInvoicesTabSection.clearFilters}}" dependentSelector="{{AdminOrderInvoicesTabSection.clearFilters}}" visible="true" stepKey="clearExistingOrderFilters"/> + <click selector="{{AdminOrderInvoicesTabSection.viewInvoice}}" stepKey="openInvoicePage"/> + <waitForPageLoad stepKey="waitForInvoicePageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminInvoiceActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminInvoiceActionGroup.xml deleted file mode 100644 index 8451f9de03293..0000000000000 --- a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminInvoiceActionGroup.xml +++ /dev/null @@ -1,130 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <!--Check customer information is correct in invoice--> - <actionGroup name="verifyBasicInvoiceInformation"> - <annotations> - <description>Validates that the provided Customer, Address and Customer Group details are present and correct on the Admin View Invoice page.</description> - </annotations> - <arguments> - <argument name="customer"/> - <argument name="shippingAddress"/> - <argument name="billingAddress"/> - <argument name="customerGroup" defaultValue="GeneralCustomerGroup"/> - </arguments> - - <see selector="{{AdminInvoiceOrderInformationSection.customerName}}" userInput="{{customer.firstname}}" stepKey="seeCustomerName"/> - <see selector="{{AdminInvoiceOrderInformationSection.customerEmail}}" userInput="{{customer.email}}" stepKey="seeCustomerEmail"/> - <see selector="{{AdminInvoiceOrderInformationSection.customerGroup}}" userInput="{{customerGroup.code}}" stepKey="seeCustomerGroup"/> - <see selector="{{AdminInvoiceAddressInformationSection.billingAddress}}" userInput="{{billingAddress.street[0]}}" stepKey="seeBillingAddressStreet"/> - <see selector="{{AdminInvoiceAddressInformationSection.billingAddress}}" userInput="{{billingAddress.city}}" stepKey="seeBillingAddressCity"/> - <see selector="{{AdminInvoiceAddressInformationSection.billingAddress}}" userInput="{{billingAddress.country_id}}" stepKey="seeBillingAddressCountry"/> - <see selector="{{AdminInvoiceAddressInformationSection.billingAddress}}" userInput="{{billingAddress.postcode}}" stepKey="seeBillingAddressPostcode"/> - <see selector="{{AdminInvoiceAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.street[0]}}" stepKey="seeShippingAddressStreet"/> - <see selector="{{AdminInvoiceAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.city}}" stepKey="seeShippingAddressCity"/> - <see selector="{{AdminInvoiceAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.country_id}}" stepKey="seeShippingAddressCountry"/> - <see selector="{{AdminInvoiceAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.postcode}}" stepKey="seeShippingAddressPostcode"/> - </actionGroup> - - <!--Check that product is in invoice items--> - <actionGroup name="seeProductInInvoiceItems"> - <annotations> - <description>Validates that the provided Product appears under the 'SKU' column in the Admin Invoices edit page.</description> - </annotations> - <arguments> - <argument name="product"/> - </arguments> - - <see selector="{{AdminInvoiceItemsSection.skuColumn}}" userInput="{{product.sku}}" stepKey="seeProductSkuInGrid"/> - </actionGroup> - - <!--Admin Fast Create Invoice--> - <actionGroup name="adminFastCreateInvoice"> - <annotations> - <description>Clicks on 'Invoice' on the Admin Orders view page. Clicks on 'Submit Invoice'. Clicks on 'View Invoice'.</description> - </annotations> - - <click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoiceButton"/> - <waitForPageLoad stepKey="waitForNewInvoicePageLoad"/> - <click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/> - <see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="The invoice has been created." stepKey="seeSuccessMessage"/> - <click selector="{{AdminOrderDetailsOrderViewSection.invoices}}" stepKey="clickInvoices"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask5"/> - <conditionalClick selector="{{AdminOrderInvoicesTabSection.clearFilters}}" dependentSelector="{{AdminOrderInvoicesTabSection.clearFilters}}" visible="true" stepKey="clearExistingOrderFilters"/> - <click selector="{{AdminOrderInvoicesTabSection.viewInvoice}}" stepKey="openInvoicePage"/> - <waitForPageLoad stepKey="waitForInvoicePageLoad"/> - </actionGroup> - - <actionGroup name="clearInvoicesGridFilters"> - <annotations> - <description>Goes to the Admin Invoices grid page. Clicks on 'Clear Filters', if present.</description> - </annotations> - - <amOnPage url="{{AdminInvoicesPage.url}}" stepKey="goToInvoices"/> - <waitForPageLoad stepKey="waitInvoicesGridToLoad"/> - <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearFilters"/> - <waitForPageLoad stepKey="waitInvoicesGrid"/> - </actionGroup> - - <actionGroup name="goToInvoiceIntoOrder"> - <annotations> - <description>Clicks on 'Invoice' on the Admin Orders view page. Validates that the URL and Page Title are correct.</description> - </annotations> - - <click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoiceAction"/> - <seeInCurrentUrl url="{{AdminInvoiceNewPage.url}}" stepKey="seeOrderInvoiceUrl"/> - <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Invoice" stepKey="seePageNameNewInvoicePage"/> - </actionGroup> - - <actionGroup name="StartCreateInvoiceFromOrderPage"> - <annotations> - <description>Clicks on 'Invoice' on the Admin Orders view page. Validates that the URL and Page Title are correct.</description> - </annotations> - - <click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoiceAction"/> - <seeInCurrentUrl url="{{AdminInvoiceNewPage.url}}" stepKey="seeNewInvoiceUrl"/> - <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Invoice" stepKey="seeNewInvoicePageTitle"/> - </actionGroup> - - <actionGroup name="SubmitInvoice"> - <annotations> - <description>Clicks on 'Submit Invoice' on the Admin 'New Invoice' page. Validates that the Success Message is present and correct. Validates that the Order ID appears in the URL.</description> - </annotations> - - <click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/> - <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForMessageAppears"/> - <see selector="{{AdminMessagesSection.success}}" userInput="The invoice has been created." stepKey="seeInvoiceCreateSuccess"/> - <grabFromCurrentUrl regex="~/order_id/(\d+)/~" stepKey="grabOrderId"/> - <seeInCurrentUrl url="{{AdminOrderDetailsPage.url('$grabOrderId')}}" stepKey="seeViewOrderPageInvoice"/> - </actionGroup> - - <!--Filter invoices by order id --> - <actionGroup name="filterInvoiceGridByOrderId"> - <annotations> - <description>Goes to the Admin Invoices grid page. Filters the grid for the provided Order ID.</description> - </annotations> - <arguments> - <argument name="orderId" type="string"/> - </arguments> - - <amOnPage url="{{AdminInvoicesPage.url}}" stepKey="goToInvoices"/> - <click selector="{{AdminInvoicesGridSection.filter}}" stepKey="clickFilter"/> - <fillField selector="{{AdminInvoicesFiltersSection.orderNum}}" userInput="{{orderId}}" stepKey="fillOrderIdForFilter"/> - <click selector="{{AdminInvoicesFiltersSection.applyFilters}}" stepKey="clickApplyFilters"/> - <waitForPageLoad stepKey="waitForFiltersApply"/> - </actionGroup> - - <actionGroup name="FilterInvoiceGridByOrderIdWithCleanFiltersActionGroup" extends="filterInvoiceGridByOrderId"> - <arguments> - <argument name="orderId" type="string"/> - </arguments> - <conditionalClick selector="{{AdminInvoicesGridSection.clearFilters}}" dependentSelector="{{AdminInvoicesGridSection.clearFilters}}" visible="true" stepKey="clearFilters" after="goToInvoices"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOpenAndFillCreditMemoRefundActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOpenAndFillCreditMemoRefundActionGroup.xml index da4c80bb28586..b11985fc8e7ef 100644 --- a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOpenAndFillCreditMemoRefundActionGroup.xml +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOpenAndFillCreditMemoRefundActionGroup.xml @@ -19,7 +19,7 @@ <argument name="adjustmentFee" type="string" defaultValue="0"/> <argument name="rowNumber" type="string" defaultValue="1"/> </arguments> - + <!-- Click 'Credit Memo' button --> <click selector="{{AdminOrderDetailsMainActionsSection.creditMemo}}" stepKey="clickCreateCreditMemo"/> <seeInCurrentUrl url="{{AdminCreditMemoNewPage.url}}" stepKey="seeNewCreditMemoPage"/> @@ -38,13 +38,4 @@ <click selector="{{AdminCreditMemoTotalSection.updateTotals}}" stepKey="clickUpdateTotals"/> <checkOption selector="{{AdminCreditMemoTotalSection.emailCopy}}" stepKey="checkSendEmailCopy"/> </actionGroup> - - <!-- Open and fill CreditMemo refund with back to stock --> - <actionGroup name="AdminOpenAndFillCreditMemoRefundAndBackToStockActionGroup" extends="AdminOpenAndFillCreditMemoRefundActionGroup"> - <annotations> - <description>EXTENDS: AdminOpenAndFillCreditMemoRefundActionGroup. Checks 'Return to Stock'.</description> - </annotations> - - <checkOption selector="{{AdminCreditMemoItemsSection.itemReturnToStock(rowNumber)}}" stepKey="backToStock" after="scrollToItemsToRefund"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOpenAndFillCreditMemoRefundAndBackToStockActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOpenAndFillCreditMemoRefundAndBackToStockActionGroup.xml new file mode 100644 index 0000000000000..0dc205df18249 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOpenAndFillCreditMemoRefundAndBackToStockActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminOpenAndFillCreditMemoRefundAndBackToStockActionGroup" extends="AdminOpenAndFillCreditMemoRefundActionGroup"> + <annotations> + <description>EXTENDS: AdminOpenAndFillCreditMemoRefundActionGroup. Checks 'Return to Stock'.</description> + </annotations> + + <checkOption selector="{{AdminCreditMemoItemsSection.itemReturnToStock(rowNumber)}}" stepKey="backToStock" after="scrollToItemsToRefund"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml deleted file mode 100644 index 90e2aa8e12527..0000000000000 --- a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml +++ /dev/null @@ -1,557 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <!--Navigate to create order page (New Order -> Create New Customer)--> - <actionGroup name="navigateToNewOrderPageNewCustomer"> - <annotations> - <description>Goes to the Admin Orders grid page. Clicks on 'Create New Order'. Clicks on 'Create New Customer'. Select the provided Store View, if present. Validates that Page Title is present and correct.</description> - </annotations> - <arguments> - <argument name="storeView" defaultValue="_defaultStore"/> - </arguments> - - <amOnPage url="{{AdminOrdersPage.url}}" stepKey="navigateToOrderIndexPage"/> - <waitForPageLoad stepKey="waitForIndexPageLoad"/> - <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Orders" stepKey="seeIndexPageTitle"/> - <click selector="{{AdminOrdersGridSection.createNewOrder}}" stepKey="clickCreateNewOrder"/> - <click selector="{{AdminOrderFormActionSection.CreateNewCustomer}}" stepKey="clickCreateCustomer"/> - <conditionalClick selector="{{AdminOrderStoreScopeTreeSection.storeOption(storeView.name)}}" dependentSelector="{{AdminOrderStoreScopeTreeSection.storeOption(storeView.name)}}" visible="true" stepKey="selectStoreViewIfAppears"/> - <waitForPageLoad stepKey="waitForCreateOrderPageLoadAfterStoreSelect"/> - <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Create New Order" stepKey="seeNewOrderPageTitle"/> - </actionGroup> - - <!--Navigate to create order page (New Order -> Create New Customer)--> - <actionGroup name="navigateToNewOrderPageNewCustomerSingleStore"> - <annotations> - <description>Goes to the Admin Orders grid page. Clicks on 'Create New Order'. Clicks on 'Create New Customer'. Validates that Page Title is present and correct.</description> - </annotations> - <arguments> - <argument name="storeView" defaultValue="_defaultStore"/> - </arguments> - - <amOnPage url="{{AdminOrdersPage.url}}" stepKey="navigateToOrderIndexPage"/> - <waitForPageLoad stepKey="waitForIndexPageLoad"/> - <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Orders" stepKey="seeIndexPageTitle"/> - <click selector="{{AdminOrdersGridSection.createNewOrder}}" stepKey="clickCreateNewOrder"/> - <click selector="{{AdminOrderFormActionSection.CreateNewCustomer}}" stepKey="clickCreateCustomer"/> - <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Create New Order" stepKey="seeNewOrderPageTitle"/> - </actionGroup> - - <!--Navigate to create order page (New Order -> Select Customer)--> - <actionGroup name="navigateToNewOrderPageExistingCustomer"> - <annotations> - <description>Goes tot he Admin Orders grid page. Clicks on 'Create New Order'. Filters the grid for the provided Customer. Clicks on the Customer. Selects the provided Store View, if present. Validates that the Page Title is present and correct.</description> - </annotations> - <arguments> - <argument name="customer"/> - <argument name="storeView" defaultValue="_defaultStore"/> - </arguments> - - <amOnPage url="{{AdminOrdersPage.url}}" stepKey="navigateToOrderIndexPage"/> - <waitForPageLoad stepKey="waitForIndexPageLoad"/> - <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Orders" stepKey="seeIndexPageTitle"/> - <click selector="{{AdminOrdersGridSection.createNewOrder}}" stepKey="clickCreateNewOrder"/> - <waitForPageLoad stepKey="waitForCustomerGridLoad"/> - - <!--Clear grid filters--> - <conditionalClick selector="{{AdminOrderCustomersGridSection.resetButton}}" dependentSelector="{{AdminOrderCustomersGridSection.resetButton}}" visible="true" stepKey="clearExistingCustomerFilters"/> - <fillField userInput="{{customer.email}}" selector="{{AdminOrderCustomersGridSection.emailInput}}" stepKey="filterEmail"/> - <click selector="{{AdminOrderCustomersGridSection.apply}}" stepKey="applyFilter"/> - <waitForPageLoad stepKey="waitForFilteredCustomerGridLoad"/> - <click selector="{{AdminOrderCustomersGridSection.firstRow}}" stepKey="clickOnCustomer"/> - <waitForPageLoad stepKey="waitForCreateOrderPageLoad"/> - - <!-- Select store view if appears --> - <conditionalClick selector="{{AdminOrderStoreScopeTreeSection.storeOption(storeView.name)}}" dependentSelector="{{AdminOrderStoreScopeTreeSection.storeOption(storeView.name)}}" visible="true" stepKey="selectStoreViewIfAppears"/> - <waitForPageLoad stepKey="waitForCreateOrderPageLoadAfterStoreSelect"/> - <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Create New Order" stepKey="seeNewOrderPageTitle"/> - </actionGroup> - - <!--Navigate to New Order Page for existing Customer And Store--> - <actionGroup name="NavigateToNewOrderPageExistingCustomerAndStoreActionGroup" extends="navigateToNewOrderPageExistingCustomer"> - <annotations> - <description>EXTENDS: navigateToNewOrderPageExistingCustomer. Clicks on the provided Store View.</description> - </annotations> - <arguments> - <argument name="storeView" defaultValue="_defaultStore"/> - </arguments> - - <click selector="{{AdminOrderStoreScopeTreeSection.storeOption(storeView.name)}}" stepKey="selectStoreView" after="waitForCreateOrderPageLoad"/> - <waitForPageLoad stepKey="waitForLoad" after="selectStoreView"/> - </actionGroup> - - <!--Check the required fields are actually required--> - <actionGroup name="checkRequiredFieldsNewOrderForm"> - <annotations> - <description>Clears the Email, First Name, Last Name, Street Line 1, City, Postal Code and Phone fields when adding an Order and then verifies that they are required after attempting to Save.</description> - </annotations> - - <seeElement selector="{{AdminOrderFormAccountSection.requiredGroup}}" stepKey="seeCustomerGroupRequired"/> - <seeElement selector="{{AdminOrderFormAccountSection.requiredEmail}}" stepKey="seeEmailRequired"/> - <clearField selector="{{AdminOrderFormAccountSection.email}}" stepKey="clearEmailField"/> - <clearField selector="{{AdminOrderFormBillingAddressSection.FirstName}}" stepKey="clearFirstNameField"/> - <clearField selector="{{AdminOrderFormBillingAddressSection.LastName}}" stepKey="clearLastNameField"/> - <clearField selector="{{AdminOrderFormBillingAddressSection.StreetLine1}}" stepKey="clearStreetField"/> - <clearField selector="{{AdminOrderFormBillingAddressSection.City}}" stepKey="clearCityField"/> - <selectOption selector="{{AdminOrderFormBillingAddressSection.Country}}" userInput="United States" stepKey="selectUSCountry"/> - <selectOption selector="{{AdminOrderFormBillingAddressSection.State}}" userInput="Please select" stepKey="selectNoState"/> - <clearField selector="{{AdminOrderFormBillingAddressSection.PostalCode}}" stepKey="clearPostalCodeField"/> - <clearField selector="{{AdminOrderFormBillingAddressSection.Phone}}" stepKey="clearPhoneField"/> - <seeElement selector="{{AdminOrderFormPaymentSection.getShippingMethods}}" stepKey="seeShippingMethodNotSelected"/> - <click selector="{{AdminOrderFormActionSection.SubmitOrder}}" stepKey="trySubmitOrder"/> - <see selector="{{AdminOrderFormBillingAddressSection.emailError}}" userInput="This is a required field." stepKey="seeThatEmailIsRequired"/> - <see selector="{{AdminOrderFormBillingAddressSection.firstNameError}}" userInput="This is a required field." stepKey="seeFirstNameRequired"/> - <see selector="{{AdminOrderFormBillingAddressSection.lastNameError}}" userInput="This is a required field." stepKey="seeLastNameRequired"/> - <see selector="{{AdminOrderFormBillingAddressSection.streetAddressError}}" userInput="This is a required field." stepKey="seeStreetRequired"/> - <see selector="{{AdminOrderFormBillingAddressSection.cityError}}" userInput="This is a required field." stepKey="seeCityRequired"/> - <see selector="{{AdminOrderFormBillingAddressSection.stateError}}" userInput="This is a required field." stepKey="seeStateRequired"/> - <see selector="{{AdminOrderFormBillingAddressSection.postalCodeError}}" userInput="This is a required field." stepKey="seePostalCodeRequired"/> - <see selector="{{AdminOrderFormBillingAddressSection.phoneError}}" userInput="This is a required field." stepKey="seePhoneRequired"/> - <see selector="{{AdminOrderFormPaymentSection.shippingError}}" userInput="This is a required field." stepKey="seeShippingMethodRequired"/> - </actionGroup> - - <!--Add a simple product to order--> - <actionGroup name="addSimpleProductToOrder"> - <annotations> - <description>Adds the provided Simple Product to an Order. Fills in the provided Product Qty. Clicks on 'Add Selected Product(s) to Order'.</description> - </annotations> - <arguments> - <argument name="product" defaultValue="_defaultProduct" type="entity"/> - <argument name="productQty" defaultValue="1" type="string"/> - </arguments> - - <click selector="{{AdminOrderFormItemsSection.addProducts}}" stepKey="clickAddProducts"/> - <fillField selector="{{AdminOrderFormItemsSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillSkuFilter"/> - <click selector="{{AdminOrderFormItemsSection.search}}" stepKey="clickSearch"/> - <scrollTo selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" x="0" y="-100" stepKey="scrollToCheckColumn"/> - <checkOption selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" stepKey="selectProduct"/> - <fillField selector="{{AdminOrderFormItemsSection.rowQty('1')}}" userInput="{{productQty}}" stepKey="fillProductQty"/> - <scrollTo selector="{{AdminOrderFormItemsSection.addSelected}}" x="0" y="-100" stepKey="scrollToAddSelectedButton"/> - <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickAddSelectedProducts"/> - <wait time="5" stepKey="waitForOptionsToLoad"/> - </actionGroup> - - <actionGroup name="AddSimpleProductWithQtyToOrderActionGroup" extends="addSimpleProductToOrder"> - <arguments> - <argument name="product" defaultValue="_defaultProduct" type="entity"/> - <argument name="productQty" type="string"/> - </arguments> - <fillField selector="{{AdminOrderFormItemsSection.rowQty('1')}}" userInput="{{productQty}}" stepKey="fillProductQty"/> - </actionGroup> - - <!--Add configurable product to order --> - <actionGroup name="addConfigurableProductToOrder"> - <annotations> - <description>Adds the provided Configurable Product with the provided Option to an Order. Fills in the provided Product Qty. Clicks on 'Add Selected Product(s) to Order'.</description> - </annotations> - <arguments> - <argument name="product"/> - <argument name="attribute"/> - <argument name="option"/> - </arguments> - - <click selector="{{AdminOrderFormItemsSection.addProducts}}" stepKey="clickAddProducts"/> - <fillField selector="{{AdminOrderFormItemsSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillSkuFilterConfigurable"/> - <click selector="{{AdminOrderFormItemsSection.search}}" stepKey="clickSearchConfigurable"/> - <scrollTo selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" x="0" y="-100" stepKey="scrollToCheckColumn"/> - <checkOption selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" stepKey="selectConfigurableProduct"/> - <waitForElementVisible selector="{{AdminOrderFormConfigureProductSection.optionSelect(attribute.default_label)}}" stepKey="waitForConfigurablePopover"/> - <wait time="2" stepKey="waitForOptionsToLoad"/> - <selectOption selector="{{AdminOrderFormConfigureProductSection.optionSelect(attribute.default_label)}}" userInput="{{option.name}}" stepKey="selectionConfigurableOption"/> - <click selector="{{AdminOrderFormConfigureProductSection.ok}}" stepKey="clickOkConfigurablePopover"/> - <scrollTo selector="{{AdminOrderFormItemsSection.addSelected}}" x="0" y="-100" stepKey="scrollToAddSelectedButton"/> - <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickAddSelectedProducts"/> - </actionGroup> - - <actionGroup name="newAddConfigurableProductToOrder" extends="addConfigurableProductToOrder"> - <remove keyForRemoval="waitForConfigurablePopover"/> - <remove keyForRemoval="selectionConfigurableOption"/> - <selectOption selector="{{AdminOrderFormConfigureProductSection.selectOption}}" userInput="{{option.value}}" stepKey="selectOption" after="waitForOptionsToLoad"/> - </actionGroup> - - <!--Add configurable product to order --> - <actionGroup name="addConfigurableProductToOrderFromAdmin" extends="addConfigurableProductToOrder"> - <annotations> - <description>EXTENDS: addConfigurableProductToOrder. Selects the provided Option to the Configurable Product.</description> - </annotations> - - <waitForElementVisible selector="{{AdminOrderFormConfigureProductSection.optionSelect(attribute.default_frontend_label)}}" stepKey="waitForConfigurablePopover"/> - <selectOption selector="{{AdminOrderFormConfigureProductSection.optionSelect(attribute.default_frontend_label)}}" userInput="{{option.label}}" stepKey="selectionConfigurableOption"/> - </actionGroup> - - <actionGroup name="configureOrderedConfigurableProduct"> - <annotations> - <description>Clicks on 'Configure' for a Product in the 'Please select products' under the 'Create New Order for' page. Selects the provided Option and Attribute. Fills in the provided Qty. Clicks on Ok.</description> - </annotations> - <arguments> - <argument name="attribute"/> - <argument name="option"/> - <argument name="quantity" type="string"/> - </arguments> - - <click selector="{{AdminOrderFormItemsSection.configure}}" stepKey="clickConfigure"/> - <waitForElementVisible selector="{{AdminOrderFormConfigureProductSection.optionSelect(attribute.default_frontend_label)}}" stepKey="waitForConfigurablePopover"/> - <wait time="2" stepKey="waitForOptionsToLoad"/> - <selectOption selector="{{AdminOrderFormConfigureProductSection.optionSelect(attribute.default_frontend_label)}}" userInput="{{option.label}}" stepKey="selectionConfigurableOption"/> - <fillField selector="{{AdminOrderFormConfigureProductSection.quantity}}" userInput="{{quantity}}" stepKey="fillQuantity"/> - <click selector="{{AdminOrderFormConfigureProductSection.ok}}" stepKey="clickOkConfigurablePopover"/> - </actionGroup> - - <!--Add bundle product to order --> - <actionGroup name="addBundleProductToOrder"> - <annotations> - <description>Adds the provided Bundled Product with the provided Option to an Order. Fills in the provided Product Qty. Clicks on 'Add Selected Product(s) to Order'.</description> - </annotations> - <arguments> - <argument name="product"/> - <argument name="quantity" type="string" defaultValue="1"/> - </arguments> - - <click selector="{{AdminOrderFormItemsSection.addProducts}}" stepKey="clickAddProducts"/> - <fillField selector="{{AdminOrderFormItemsSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillSkuFilterBundle"/> - <click selector="{{AdminOrderFormItemsSection.search}}" stepKey="clickSearchBundle"/> - <scrollTo selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" x="0" y="-100" stepKey="scrollToCheckColumn"/> - <checkOption selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" stepKey="selectBundleProduct"/> - <waitForElementVisible selector="{{AdminOrderFormBundleProductSection.quantity}}" stepKey="waitForBundleOptionLoad"/> - <wait time="2" stepKey="waitForOptionsToLoad"/> - <fillField selector="{{AdminOrderFormBundleProductSection.quantity}}" userInput="{{quantity}}" stepKey="fillQuantity"/> - <click selector="{{AdminOrderFormConfigureProductSection.ok}}" stepKey="clickOk"/> - <scrollTo selector="{{AdminOrderFormItemsSection.addSelected}}" x="0" y="-100" stepKey="scrollToAddSelectedButton"/> - <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickAddSelectedProducts"/> - </actionGroup> - - <!--Add bundle product to order and check product price in the grid--> - <actionGroup name="addBundleProductToOrderAndCheckPriceInGrid" extends="addBundleProductToOrder"> - <annotations> - <description>EXTENDS: addBundleProductToOrder. Validates that the provided Product Price is present and correct in the 'Items Ordered' section.</description> - </annotations> - <arguments> - <argument name="price" type="string"/> - </arguments> - - <grabTextFrom selector="{{AdminOrderFormItemsSection.rowPrice('1')}}" stepKey="grabProductPriceFromGrid" after="clickOk"/> - <assertEquals stepKey="assertProductPriceInGrid" message="Bundle product price in grid should be equal {{price}}" after="grabProductPriceFromGrid"> - <expectedResult type="string">{{price}}</expectedResult> - <actualResult type="variable">grabProductPriceFromGrid</actualResult> - </assertEquals> - </actionGroup> - - <!--Add downloadable product to order --> - <actionGroup name="addDownloadableProductToOrder"> - <annotations> - <description>Adds a Downloadable Product to an Order. Clicks on 'Add Selected Product(s) to Order'.</description> - </annotations> - - <click selector="{{AdminOrderFormItemsSection.addProducts}}" stepKey="clickAddProducts"/> - <waitForPageLoad time="30" stepKey="waitForPageLoad1"/> - <fillField selector="{{AdminOrderFormItemsSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillSkuFilterDownloadable"/> - <click selector="{{AdminOrderFormItemsSection.search}}" stepKey="clickSearchDownloadable"/> - <scrollTo selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" x="0" y="-100" stepKey="scrollToCheckColumn"/> - <checkOption selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" stepKey="selectDownloadableProduct"/> - <waitForElementVisible selector="{{AdminOrderFormDownloadableProductSection.optionSelect(link.title)}}" stepKey="waitForLinkLoad"/> - <click selector="{{AdminOrderFormDownloadableProductSection.optionSelect(link.title)}}" stepKey="selectLink"/> - <fillField selector="{{AdminOrderFormDownloadableProductSection.quantity}}" userInput="{{quantity}}" stepKey="setQuantity"/> - <click selector="{{AdminOrderFormDownloadableProductSection.ok}}" stepKey="confirmConfiguration"/> - <scrollTo selector="{{AdminOrderFormItemsSection.addSelected}}" x="0" y="-100" stepKey="scrollToAddSelectedButton"/> - <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickAddSelectedProducts"/> - </actionGroup> - - <!--Add grouped product option to order --> - <actionGroup name="addGroupedProductOptionToOrder"> - <annotations> - <description>Adds the provided Grouped Product with the provided Option to an Order. Fills in the provided Product Qty. Clicks on 'Add Selected Product(s) to Order'.</description> - </annotations> - <arguments> - <argument name="product"/> - <argument name="option"/> - <argument name="quantity" type="string" defaultValue="1"/> - </arguments> - - <click selector="{{AdminOrderFormItemsSection.addProducts}}" stepKey="clickAddProducts"/> - <fillField selector="{{AdminOrderFormItemsSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillSkuFilterGrouped"/> - <click selector="{{AdminOrderFormItemsSection.search}}" stepKey="clickSearchGrouped"/> - <scrollTo selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" x="0" y="-100" stepKey="scrollToCheckColumn"/> - <checkOption selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" stepKey="selectGroupedProduct"/> - <waitForElementVisible selector="{{AdminOrderFormGroupedProductSection.optionQty(option.sku)}}" stepKey="waitForGroupedOptionLoad"/> - <wait time="2" stepKey="waitForOptionsToLoad"/> - <fillField selector="{{AdminOrderFormGroupedProductSection.optionQty(option.sku)}}" userInput="{{quantity}}" stepKey="fillOptionQuantity"/> - <click selector="{{AdminOrderFormConfigureProductSection.ok}}" stepKey="clickOk"/> - <scrollTo selector="{{AdminOrderFormItemsSection.addSelected}}" x="0" y="-100" stepKey="scrollToAddSelectedButton"/> - <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickAddSelectedProducts"/> - </actionGroup> - - <!--Fill customer billing address--> - <actionGroup name="fillOrderCustomerInformation"> - <annotations> - <description>Fills in the provided Customer and Address details on the Admin 'Create New Order for' page.</description> - </annotations> - <arguments> - <argument name="customer"/> - <argument name="address"/> - </arguments> - - <fillField selector="{{AdminOrderFormBillingAddressSection.FirstName}}" userInput="{{customer.firstname}}" stepKey="fillFirstName"/> - <fillField selector="{{AdminOrderFormBillingAddressSection.LastName}}" userInput="{{customer.lastname}}" stepKey="fillLastName"/> - <fillField selector="{{AdminOrderFormBillingAddressSection.StreetLine1}}" userInput="{{address.street[0]}}" stepKey="fillStreetLine1"/> - <fillField selector="{{AdminOrderFormBillingAddressSection.City}}" userInput="{{address.city}}" stepKey="fillCity"/> - <selectOption selector="{{AdminOrderFormBillingAddressSection.Country}}" userInput="{{address.country_id}}" stepKey="fillCountry"/> - <selectOption selector="{{AdminOrderFormBillingAddressSection.State}}" userInput="{{address.state}}" stepKey="fillState"/> - <fillField selector="{{AdminOrderFormBillingAddressSection.PostalCode}}" userInput="{{address.postcode}}" stepKey="fillPostalCode"/> - <fillField selector="{{AdminOrderFormBillingAddressSection.Phone}}" userInput="{{address.telephone}}" stepKey="fillPhone"/> - </actionGroup> - - <!--Select flat rate shipping method--> - <actionGroup name="orderSelectFlatRateShipping"> - <annotations> - <description>Selects the 'Flat Rate' Shipping Method on the Admin 'Create New Order for' page.</description> - </annotations> - - <click selector="{{AdminOrderFormPaymentSection.header}}" stepKey="unfocus"/> - <waitForPageLoad stepKey="waitForJavascriptToFinish"/> - <click selector="{{AdminOrderFormPaymentSection.getShippingMethods}}" stepKey="clickShippingMethods"/> - <waitForElementVisible selector="{{AdminOrderFormPaymentSection.flatRateOption}}" stepKey="waitForShippingOptions"/> - <selectOption selector="{{AdminOrderFormPaymentSection.flatRateOption}}" userInput="flatrate_flatrate" stepKey="checkFlatRate"/> - </actionGroup> - - <actionGroup name="changeShippingMethod"> - <annotations> - <description>Change Shipping Method on the Admin 'Create New Order for' page.</description> - </annotations> - <arguments> - <argument name="shippingMethod" defaultValue="flatrate_flatrate" type="string"/> - </arguments> - <click selector="{{AdminOrderFormPaymentSection.header}}" stepKey="unfocus"/> - <waitForPageLoad stepKey="waitForJavascriptToFinish"/> - <click selector="{{AdminOrderFormPaymentSection.getShippingMethods}}" stepKey="clickShippingMethods1"/> - <waitForElementVisible selector="{{AdminOrderFormPaymentSection.getShippingMethods}}" stepKey="waitForChangeShippingMethod"/> - <click selector="{{AdminOrderFormPaymentSection.getShippingMethods}}" stepKey="clickShippingMethods2"/> - <waitForElementVisible selector="{{AdminOrderFormPaymentSection.shippingMethod}}" stepKey="waitForShippingOptions2"/> - <selectOption selector="{{AdminOrderFormPaymentSection.shippingMethod}}" userInput="{{shippingMethod}}" stepKey="checkFlatRate"/> - </actionGroup> - - <!--Select free shipping method--> - <actionGroup name="orderSelectFreeShipping"> - <annotations> - <description>Selects the 'Free Shipping' Shipping Method on the Admin 'Create New Order for' page.</description> - </annotations> - - <click selector="{{AdminOrderFormPaymentSection.header}}" stepKey="unfocus"/> - <waitForPageLoad stepKey="waitForJavascriptToFinish"/> - <click selector="{{AdminOrderFormPaymentSection.getShippingMethods}}" stepKey="clickShippingMethods"/> - <waitForElementVisible selector="{{AdminOrderFormPaymentSection.freeShippingOption}}" stepKey="waitForShippingOptions"/> - <selectOption selector="{{AdminOrderFormPaymentSection.freeShippingOption}}" userInput="freeshipping_freeshipping" stepKey="checkFreeShipping"/> - </actionGroup> - - <!--Check that customer information is correct in order--> - <actionGroup name="verifyBasicOrderInformation"> - <annotations> - <description>Validates that the provided Customer, Shipping/Billing Address and Customer Group are present and correct on the Admin Orders view page.</description> - </annotations> - <arguments> - <argument name="customer"/> - <argument name="shippingAddress"/> - <argument name="billingAddress"/> - <argument name="customerGroup" defaultValue="GeneralCustomerGroup"/> - </arguments> - - <see selector="{{AdminOrderDetailsInformationSection.customerName}}" userInput="{{customer.firstname}}" stepKey="seeCustomerName"/> - <see selector="{{AdminOrderDetailsInformationSection.customerEmail}}" userInput="{{customer.email}}" stepKey="seeCustomerEmail"/> - <see selector="{{AdminOrderDetailsInformationSection.customerGroup}}" userInput="{{customerGroup.code}}" stepKey="seeCustomerGroup"/> - <see selector="{{AdminOrderAddressInformationSection.billingAddress}}" userInput="{{billingAddress.street[0]}}" stepKey="seeBillingAddressStreet"/> - <see selector="{{AdminOrderAddressInformationSection.billingAddress}}" userInput="{{billingAddress.city}}" stepKey="seeBillingAddressCity"/> - <see selector="{{AdminOrderAddressInformationSection.billingAddress}}" userInput="{{billingAddress.country_id}}" stepKey="seeBillingAddressCountry"/> - <see selector="{{AdminOrderAddressInformationSection.billingAddress}}" userInput="{{billingAddress.postcode}}" stepKey="seeBillingAddressPostcode"/> - <see selector="{{AdminOrderAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.street[0]}}" stepKey="seeShippingAddressStreet"/> - <see selector="{{AdminOrderAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.city}}" stepKey="seeShippingAddressCity"/> - <see selector="{{AdminOrderAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.country_id}}" stepKey="seeShippingAddressCountry"/> - <see selector="{{AdminOrderAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.postcode}}" stepKey="seeShippingAddressPostcode"/> - </actionGroup> - <actionGroup name="AssertOrderAddressInformationActionGroup" extends="verifyBasicOrderInformation"> - <remove keyForRemoval="seeCustomerName"/> - <remove keyForRemoval="seeCustomerEmail"/> - <remove keyForRemoval="seeCustomerGroup"/> - <remove keyForRemoval="seeBillingAddressCountry"/> - <remove keyForRemoval="seeShippingAddressCountry"/> - <see selector="{{AdminOrderAddressInformationSection.billingAddress}}" userInput="{{billingAddress.country}}" stepKey="seeBillingCountry" after="seeBillingAddressCity"/> - <see selector="{{AdminOrderAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.country}}" stepKey="seeAddressCountry" after="seeShippingAddressCity"/> - </actionGroup> - - <!--Verify order information--> - <actionGroup name="verifyCreatedOrderInformation"> - <annotations> - <description>Validates that the Success Message, Order Status (Pending) and Order ID are present and correct.</description> - </annotations> - - <see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="You created the order." stepKey="seeSuccessMessage"/> - <see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="Pending" stepKey="seeOrderPendingStatus" after="seeSuccessMessage"/> - <grabTextFrom selector="|Order # (\d+)|" stepKey="getOrderId" after="seeOrderPendingStatus"/> - <assertNotEmpty actual="$getOrderId" stepKey="assertOrderIdIsNotEmpty" after="getOrderId"/> - </actionGroup> - - <!--Check for product in order items list--> - <actionGroup name="seeProductInItemsOrdered"> - <annotations> - <description>Validates that the provided Product is present and correct in the 'Items Ordered' section on the Admin Orders view page.</description> - </annotations> - <arguments> - <argument name="product"/> - </arguments> - - <see selector="{{AdminOrderItemsOrderedSection.productSkuColumn}}" userInput="{{product.sku}}" stepKey="seeSkuInItemsOrdered"/> - </actionGroup> - - <actionGroup name="CreateOrderInStoreActionGroup"> - <annotations> - <description>Goes to the Admin Create Order page. Creates an Order based on the provided Customer, Store View and Product. Validates that the Success Message is present and correct.</description> - </annotations> - <arguments> - <argument name="product"/> - <argument name="customer"/> - <argument name="storeView"/> - </arguments> - - <amOnPage stepKey="navigateToNewOrderPage" url="{{AdminOrderCreatePage.url}}"/> - <click stepKey="chooseCustomer" selector="{{AdminOrdersGridSection.customerInOrdersSection(customer.firstname)}}"/> - <waitForPageLoad stepKey="waitForStoresPageOpened"/> - <click stepKey="chooseStore" selector="{{AdminOrderStoreScopeTreeSection.storeForOrder(storeView.name)}}"/> - <scrollToTopOfPage stepKey="scrollToTop"/> - <waitForPageLoad stepKey="waitForStoreToAppear"/> - <click selector="{{OrdersGridSection.addProducts}}" stepKey="clickOnAddProducts"/> - <waitForPageLoad stepKey="waitForProductsListForOrder"/> - <click selector="{{AdminOrdersGridSection.productForOrder(product.sku)}}" stepKey="chooseTheProduct"/> - <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="addSelectedProductToOrder"/> - <waitForPageLoad stepKey="waitForProductAddedInOrder"/> - <click selector="{{AdminInvoicePaymentShippingSection.getShippingMethodAndRates}}" stepKey="openShippingMethod"/> - <waitForPageLoad stepKey="waitForShippingMethods"/> - <click selector="{{AdminInvoicePaymentShippingSection.shippingMethod}}" stepKey="chooseShippingMethod"/> - <waitForPageLoad stepKey="waitForShippingMethodsThickened"/> - <click selector="{{OrdersGridSection.submitOrder}}" stepKey="submitOrder"/> - <see stepKey="seeSuccessMessageForOrder" userInput="You created the order."/> - </actionGroup> - - <actionGroup name="CreateOrderInStoreChoosingPaymentMethodActionGroup"> - <annotations> - <description>Goes to the Admin Create Order page. Creates an Order based on the provided Customer, Store View and Product. Validates that the Success Message is present and correct.</description> - </annotations> - <arguments> - <argument name="product"/> - <argument name="customer"/> - <argument name="storeView"/> - </arguments> - - <amOnPage stepKey="navigateToNewOrderPage" url="{{AdminOrderCreatePage.url}}"/> - <click stepKey="chooseCustomer" selector="{{AdminOrdersGridSection.customerInOrdersSection(customer.firstname)}}"/> - <waitForPageLoad stepKey="waitForStoresPageOpened"/> - <click stepKey="chooseStore" selector="{{AdminOrderStoreScopeTreeSection.storeForOrder(storeView.name)}}"/> - <scrollToTopOfPage stepKey="scrollToTop"/> - <click selector="{{OrdersGridSection.addProducts}}" stepKey="clickOnAddProducts"/> - <waitForPageLoad stepKey="waitForProductsListForOrder"/> - <click selector="{{AdminOrdersGridSection.productForOrder(product.sku)}}" stepKey="chooseTheProduct"/> - <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="addSelectedProductToOrder"/> - <waitForPageLoad stepKey="waitForProductAddedInOrder"/> - <click selector="{{AdminInvoicePaymentShippingSection.getShippingMethodAndRates}}" stepKey="openShippingMethod"/> - <waitForPageLoad stepKey="waitForShippingMethods"/> - <click selector="{{AdminInvoicePaymentShippingSection.shippingMethod}}" stepKey="chooseShippingMethod"/> - <waitForPageLoad stepKey="waitForShippingMethodsThickened"/> - <waitForElementVisible selector="{{AdminOrderFormPaymentSection.paymentBlock}}" stepKey="waitForPaymentOptions"/> - <conditionalClick selector="{{AdminOrderFormPaymentSection.checkMoneyOption}}" dependentSelector="{{AdminOrderFormPaymentSection.checkMoneyOption}}" visible="true" stepKey="checkCheckMoneyOption"/> - <click selector="{{OrdersGridSection.submitOrder}}" stepKey="submitOrder"/> - <see stepKey="seeSuccessMessageForOrder" userInput="You created the order."/> - </actionGroup> - - <!--Cancel order that is in pending status--> - <actionGroup name="cancelPendingOrder"> - <annotations> - <description>Cancels the Pending Order on the Admin Orders view page. Validates that the provided Order Status is present and correct.</description> - </annotations> - <arguments> - <argument name="orderStatus" type="string" defaultValue="Canceled"/> - </arguments> - - <click selector="{{AdminOrderDetailsMainActionsSection.cancel}}" stepKey="clickCancelOrder"/> - <waitForElement selector="{{AdminConfirmationModalSection.message}}" stepKey="waitForCancelConfirmation"/> - <see selector="{{AdminConfirmationModalSection.message}}" userInput="Are you sure you want to cancel this order?" stepKey="seeConfirmationMessage"/> - <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmOrderCancel"/> - <see selector="{{AdminMessagesSection.success}}" userInput="You canceled the order." stepKey="seeCancelSuccessMessage"/> - <see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="{{orderStatus}}" stepKey="seeOrderStatusCanceled"/> - </actionGroup> - - <!--Assert that the product is not in the order items list--> - <actionGroup name="dontSeeProductInItemsOrdered"> - <arguments> - <argument name="product"/> - </arguments> - <dontSee selector="{{AdminOrderItemsOrderedSection.productSkuColumn}}" userInput="{{product.sku}}" stepKey="dontseeSkuInItemsOrdered"/> - </actionGroup> - - <!--Select Check Money payment method--> - <actionGroup name="SelectCheckMoneyPaymentMethod"> - <annotations> - <description>Selects the 'Check / Money Order' Payment Method on the Admin Create New Order page.</description> - </annotations> - - <waitForElementVisible selector="{{AdminOrderFormPaymentSection.paymentBlock}}" stepKey="waitForPaymentOptions"/> - <conditionalClick selector="{{AdminOrderFormPaymentSection.checkMoneyOption}}" dependentSelector="{{AdminOrderFormPaymentSection.checkMoneyOption}}" visible="true" stepKey="checkCheckMoneyOption"/> - </actionGroup> - - <!--Select Bank Transfer payment method--> - <actionGroup name="SelectBankTransferPaymentMethodActionGroup" extends="SelectCheckMoneyPaymentMethod"> - <remove keyForRemoval="checkCheckMoneyOption"/> - <conditionalClick selector="{{AdminOrderFormPaymentSection.checkBankTransfer}}" dependentSelector="{{AdminOrderFormPaymentSection.checkBankTransfer}}" visible="true" stepKey="checkBankTransferOption" after="waitForPaymentOptions"/> - </actionGroup> - - <!--Select Cash on Delivery payment method--> - <actionGroup name="SelectCashOnDeliveryPaymentMethodActionGroup" extends="SelectCheckMoneyPaymentMethod"> - <remove keyForRemoval="checkCheckMoneyOption"/> - <conditionalClick selector="{{AdminOrderFormPaymentSection.checkCashOnDelivery}}" dependentSelector="{{AdminOrderFormPaymentSection.checkCashOnDelivery}}" visible="true" stepKey="checkCashOnDeliveryOption" after="waitForPaymentOptions"/> - </actionGroup> - - <!--Select Purchase Order payment method--> - <actionGroup name="SelectPurchaseOrderPaymentMethodActionGroup" extends="SelectCheckMoneyPaymentMethod"> - <arguments> - <argument name="purchaseOrderNumber" type="string"/> - </arguments> - <remove keyForRemoval="checkCheckMoneyOption"/> - <conditionalClick selector="{{AdminOrderFormPaymentSection.checkPurchaseOrder}}" dependentSelector="{{AdminOrderFormPaymentSection.checkPurchaseOrder}}" visible="true" stepKey="checkPurchaseOrderOption" after="waitForPaymentOptions"/> - <fillField selector="{{AdminOrderFormPaymentSection.fieldPurchaseOrderNumber}}" userInput="{{purchaseOrderNumber}}" stepKey="fillPurchaseOrderNumber"/> - </actionGroup> - - <!-- Create Order --> - <actionGroup name="CreateOrderActionGroup"> - <annotations> - <description>Goes to the Admin Create New Order page. Selects the provided Customer. Adds the provided Product to the Order. Clicks on Submit Order. Validates that the Success Message is present and correct.</description> - </annotations> - <arguments> - <argument name="product"/> - <argument name="customer"/> - </arguments> - - <amOnPage stepKey="navigateToNewOrderPage" url="{{AdminOrderCreatePage.url}}"/> - <waitForPageLoad stepKey="waitForNewOrderPageOpened"/> - <click stepKey="chooseCustomer" selector="{{AdminOrdersGridSection.customerInOrdersSection(customer.firstname)}}"/> - <waitForPageLoad stepKey="waitForStoresPageOpened"/> - <click selector="{{OrdersGridSection.addProducts}}" stepKey="clickOnAddProducts"/> - <waitForPageLoad stepKey="waitForProductsListForOrder"/> - <click selector="{{AdminOrdersGridSection.productForOrder(product.sku)}}" stepKey="chooseTheProduct"/> - <waitForPageLoad stepKey="waitForClickProduct"/> - <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="addSelectedProductToOrder"/> - <waitForPageLoad stepKey="waitForProductAddedInOrder"/> - <click selector="{{AdminInvoicePaymentShippingSection.getShippingMethodAndRates}}" stepKey="openShippingMethod"/> - <waitForPageLoad stepKey="waitForShippingMethods"/> - <click selector="{{AdminInvoicePaymentShippingSection.shippingMethod}}" stepKey="chooseShippingMethod"/> - <waitForPageLoad stepKey="waitForShippingMethodsThickened"/> - <click selector="{{OrdersGridSection.submitOrder}}" stepKey="submitOrder"/> - <waitForPageLoad stepKey="waitForSubmitOrder"/> - <see stepKey="seeSuccessMessageForOrder" userInput="You created the order."/> - </actionGroup> - <actionGroup name="CreateOrderFilteringCustomerByEmailActionGroup" extends="CreateOrderActionGroup"> - <click stepKey="chooseCustomer" selector="{{AdminOrdersGridSection.customerInOrdersSection(customer.email)}}"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderGridActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderGridActionGroup.xml deleted file mode 100644 index e8ed82148b007..0000000000000 --- a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderGridActionGroup.xml +++ /dev/null @@ -1,113 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <!--Filter order grid by order id field--> - <actionGroup name="filterOrderGridById"> - <annotations> - <description>Goes to the Admin Orders page. Filters the grid based on the provided Order ID.</description> - </annotations> - <arguments> - <argument name="orderId" type="string"/> - </arguments> - - <amOnPage url="{{AdminOrdersPage.url}}" stepKey="navigateToOrderGridPage"/> - <waitForPageLoad stepKey="waitForOrdersPage"/> - <conditionalClick selector="{{AdminOrdersGridSection.clearFilters}}" dependentSelector="{{AdminOrdersGridSection.clearFilters}}" visible="true" stepKey="clearExistingOrderFilters"/> - <waitForPageLoad stepKey="waitForClearFilters"/> - <click selector="{{AdminOrdersGridSection.filters}}" stepKey="openOrderGridFilters"/> - <waitForPageLoad stepKey="waitForClickFilters"/> - <fillField selector="{{AdminOrdersGridSection.idFilter}}" userInput="{{orderId}}" stepKey="fillOrderIdFilter"/> - <click selector="{{AdminOrdersGridSection.applyFilters}}" stepKey="clickOrderApplyFilters"/> - <waitForPageLoad stepKey="waitForApplyFilters"/> - </actionGroup> - - <!--Filter order grid by the billing name field--> - <actionGroup name="filterOrderGridByBillingName"> - <annotations> - <description>Goes to the Admin Orders page. Filters the grid based on the provided Customer.</description> - </annotations> - <arguments> - <argument name="customer"/> - </arguments> - - <amOnPage url="{{AdminOrdersPage.url}}" stepKey="navigateToOrderGridPage"/> - <waitForPageLoad stepKey="waitForOrderGridLoad"/> - <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingOrderFilters"/> - <click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openOrderGridFilters"/> - <fillField selector="{{AdminDataGridHeaderSection.filterFieldInput('billing_name')}}" userInput="{{customer.fullname}}" stepKey="fillBillToNameFilter"/> - <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickOrderApplyFilters"/> - </actionGroup> - - <!--Filter order grid by order total range--> - <actionGroup name="filterOrderGridByBaseTotalRange"> - <annotations> - <description>Goes to the Admin Orders page. Filters the grid based on the provided Grand Total From/To values.</description> - </annotations> - <arguments> - <argument name="from"/> - <argument name="to"/> - </arguments> - - <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingOrderFilters"/> - <click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openOrderGridFilters"/> - <fillField selector="{{AdminDataGridHeaderSection.filterFieldInput('base_grand_total[from]')}}" userInput="{{from}}" stepKey="fillOrderTotalFrom"/> - <fillField selector="{{AdminDataGridHeaderSection.filterFieldInput('base_grand_total[to]')}}" userInput="{{to}}" stepKey="fillOrderTotalTo"/> - <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickApplyFilters"/> - </actionGroup> - - <actionGroup name="filterOrderGridByPurchaseDate"> - <annotations> - <description>Goes to the Admin Orders page. Filters the grid based on the provided Purchased Date From/To values.</description> - </annotations> - <arguments> - <argument name="from"/> - <argument name="to"/> - </arguments> - - <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingOrderFilters"/> - <click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openOrderGridFilters"/> - <fillField selector="{{AdminDataGridHeaderSection.filterFieldInput('created_at[from]')}}" userInput="{{from}}" stepKey="fillOrderPurchaseDateFrom"/> - <fillField selector="{{AdminDataGridHeaderSection.filterFieldInput('created_at[to]')}}" userInput="{{to}}" stepKey="fillOrderPurchaseDateTo"/> - <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickApplyFilters"/> - </actionGroup> - - <actionGroup name="filterOrderGridByStatus"> - <annotations> - <description>Filters the Admin Orders grid based on the provided Order Status.</description> - </annotations> - <arguments> - <argument name="status"/> - </arguments> - - <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingOrderFilters"/> - <click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openOrderGridFilters"/> - <selectOption selector="{{AdminDataGridHeaderSection.filterFieldSelect('status')}}" userInput="{{status}}" stepKey="fillOrderStatusFilter"/> - <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickApplyFilters"/> - </actionGroup> - - <actionGroup name="AdminOrdersGridClearFiltersActionGroup"> - <annotations> - <description>Goes to the Admin Orders grid page. Clicks on 'Clear Filters', if present.</description> - </annotations> - - <amOnPage url="{{AdminOrdersPage.url}}" stepKey="goToGridOrdersPage"/> - <waitForPageLoad stepKey="waitForPageToLoad"/> - <conditionalClick selector="{{AdminOrdersGridSection.clearFilters}}" dependentSelector="{{AdminOrdersGridSection.enabledFilters}}" visible="true" stepKey="clickOnButtonToRemoveFiltersIfPresent"/> - </actionGroup> - - <actionGroup name="OpenOrderById" extends="filterOrderGridById"> - <annotations> - <description>EXTENDS: filterOrderGridById. Clicks on the 1st row of the Admin Orders grid.</description> - </annotations> - - <click selector="{{AdminDataGridTableSection.firstRow}}" after="clickOrderApplyFilters" stepKey="openOrderViewPage"/> - <waitForPageLoad after="openOrderViewPage" stepKey="waitForOrderViewPageOpened"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrdersGridClearFiltersActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrdersGridClearFiltersActionGroup.xml new file mode 100644 index 0000000000000..b301864212c8b --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrdersGridClearFiltersActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminOrdersGridClearFiltersActionGroup"> + <annotations> + <description>Goes to the Admin Orders grid page. Clicks on 'Clear Filters', if present.</description> + </annotations> + + <amOnPage url="{{AdminOrdersPage.url}}" stepKey="goToGridOrdersPage"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + <conditionalClick selector="{{AdminOrdersGridSection.clearFilters}}" dependentSelector="{{AdminOrdersGridSection.enabledFilters}}" visible="true" stepKey="clickOnButtonToRemoveFiltersIfPresent"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AssertOrderAddressInformationActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AssertOrderAddressInformationActionGroup.xml new file mode 100644 index 0000000000000..db3343794de01 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AssertOrderAddressInformationActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertOrderAddressInformationActionGroup" extends="VerifyBasicOrderInformationActionGroup"> + <remove keyForRemoval="seeCustomerName"/> + <remove keyForRemoval="seeCustomerEmail"/> + <remove keyForRemoval="seeCustomerGroup"/> + <remove keyForRemoval="seeBillingAddressCountry"/> + <remove keyForRemoval="seeShippingAddressCountry"/> + <see selector="{{AdminOrderAddressInformationSection.billingAddress}}" userInput="{{billingAddress.country}}" stepKey="seeBillingCountry" after="seeBillingAddressCity"/> + <see selector="{{AdminOrderAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.country}}" stepKey="seeAddressCountry" after="seeShippingAddressCity"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/CancelPendingOrderActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/CancelPendingOrderActionGroup.xml new file mode 100644 index 0000000000000..b440817dfd80e --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/CancelPendingOrderActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CancelPendingOrderActionGroup"> + <annotations> + <description>Cancels the Pending Order on the Admin Orders view page. Validates that the provided Order Status is present and correct.</description> + </annotations> + <arguments> + <argument name="orderStatus" type="string" defaultValue="Canceled"/> + </arguments> + + <click selector="{{AdminOrderDetailsMainActionsSection.cancel}}" stepKey="clickCancelOrder"/> + <waitForElement selector="{{AdminConfirmationModalSection.message}}" stepKey="waitForCancelConfirmation"/> + <see selector="{{AdminConfirmationModalSection.message}}" userInput="Are you sure you want to cancel this order?" stepKey="seeConfirmationMessage"/> + <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmOrderCancel"/> + <see selector="{{AdminMessagesSection.success}}" userInput="You canceled the order." stepKey="seeCancelSuccessMessage"/> + <see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="{{orderStatus}}" stepKey="seeOrderStatusCanceled"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/ChangeShippingMethodActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/ChangeShippingMethodActionGroup.xml new file mode 100644 index 0000000000000..49ad1013f7b73 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/ChangeShippingMethodActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ChangeShippingMethodActionGroup"> + <annotations> + <description>Change Shipping Method on the Admin 'Create New Order for' page.</description> + </annotations> + <arguments> + <argument name="shippingMethod" defaultValue="flatrate_flatrate" type="string"/> + </arguments> + <click selector="{{AdminOrderFormPaymentSection.header}}" stepKey="unfocus"/> + <waitForPageLoad stepKey="waitForJavascriptToFinish"/> + <click selector="{{AdminOrderFormPaymentSection.getShippingMethods}}" stepKey="clickShippingMethods1"/> + <waitForElementVisible selector="{{AdminOrderFormPaymentSection.getShippingMethods}}" stepKey="waitForChangeShippingMethod"/> + <click selector="{{AdminOrderFormPaymentSection.getShippingMethods}}" stepKey="clickShippingMethods2"/> + <waitForElementVisible selector="{{AdminOrderFormPaymentSection.shippingMethod}}" stepKey="waitForShippingOptions2"/> + <selectOption selector="{{AdminOrderFormPaymentSection.shippingMethod}}" userInput="{{shippingMethod}}" stepKey="checkFlatRate"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/CheckRequiredFieldsNewOrderFormActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/CheckRequiredFieldsNewOrderFormActionGroup.xml new file mode 100644 index 0000000000000..25936ad3f6002 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/CheckRequiredFieldsNewOrderFormActionGroup.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CheckRequiredFieldsNewOrderFormActionGroup"> + <annotations> + <description>Clears the Email, First Name, Last Name, Street Line 1, City, Postal Code and Phone fields when adding an Order and then verifies that they are required after attempting to Save.</description> + </annotations> + + <seeElement selector="{{AdminOrderFormAccountSection.requiredGroup}}" stepKey="seeCustomerGroupRequired"/> + <seeElement selector="{{AdminOrderFormAccountSection.requiredEmail}}" stepKey="seeEmailRequired"/> + <clearField selector="{{AdminOrderFormAccountSection.email}}" stepKey="clearEmailField"/> + <clearField selector="{{AdminOrderFormBillingAddressSection.FirstName}}" stepKey="clearFirstNameField"/> + <clearField selector="{{AdminOrderFormBillingAddressSection.LastName}}" stepKey="clearLastNameField"/> + <clearField selector="{{AdminOrderFormBillingAddressSection.StreetLine1}}" stepKey="clearStreetField"/> + <clearField selector="{{AdminOrderFormBillingAddressSection.City}}" stepKey="clearCityField"/> + <selectOption selector="{{AdminOrderFormBillingAddressSection.Country}}" userInput="United States" stepKey="selectUSCountry"/> + <selectOption selector="{{AdminOrderFormBillingAddressSection.State}}" userInput="Please select" stepKey="selectNoState"/> + <clearField selector="{{AdminOrderFormBillingAddressSection.PostalCode}}" stepKey="clearPostalCodeField"/> + <clearField selector="{{AdminOrderFormBillingAddressSection.Phone}}" stepKey="clearPhoneField"/> + <seeElement selector="{{AdminOrderFormPaymentSection.getShippingMethods}}" stepKey="seeShippingMethodNotSelected"/> + <click selector="{{AdminOrderFormActionSection.SubmitOrder}}" stepKey="trySubmitOrder"/> + <see selector="{{AdminOrderFormBillingAddressSection.emailError}}" userInput="This is a required field." stepKey="seeThatEmailIsRequired"/> + <see selector="{{AdminOrderFormBillingAddressSection.firstNameError}}" userInput="This is a required field." stepKey="seeFirstNameRequired"/> + <see selector="{{AdminOrderFormBillingAddressSection.lastNameError}}" userInput="This is a required field." stepKey="seeLastNameRequired"/> + <see selector="{{AdminOrderFormBillingAddressSection.streetAddressError}}" userInput="This is a required field." stepKey="seeStreetRequired"/> + <see selector="{{AdminOrderFormBillingAddressSection.cityError}}" userInput="This is a required field." stepKey="seeCityRequired"/> + <see selector="{{AdminOrderFormBillingAddressSection.stateError}}" userInput="This is a required field." stepKey="seeStateRequired"/> + <see selector="{{AdminOrderFormBillingAddressSection.postalCodeError}}" userInput="This is a required field." stepKey="seePostalCodeRequired"/> + <see selector="{{AdminOrderFormBillingAddressSection.phoneError}}" userInput="This is a required field." stepKey="seePhoneRequired"/> + <see selector="{{AdminOrderFormPaymentSection.shippingError}}" userInput="This is a required field." stepKey="seeShippingMethodRequired"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/ClearInvoicesGridFiltersActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/ClearInvoicesGridFiltersActionGroup.xml new file mode 100644 index 0000000000000..8b8f400fca928 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/ClearInvoicesGridFiltersActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ClearInvoicesGridFiltersActionGroup"> + <annotations> + <description>Goes to the Admin Invoices grid page. Clicks on 'Clear Filters', if present.</description> + </annotations> + + <amOnPage url="{{AdminInvoicesPage.url}}" stepKey="goToInvoices"/> + <waitForPageLoad stepKey="waitInvoicesGridToLoad"/> + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearFilters"/> + <waitForPageLoad stepKey="waitInvoicesGrid"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/ConfigureOrderedConfigurableProductActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/ConfigureOrderedConfigurableProductActionGroup.xml new file mode 100644 index 0000000000000..1a0f1cb9689f1 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/ConfigureOrderedConfigurableProductActionGroup.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ConfigureOrderedConfigurableProductActionGroup"> + <annotations> + <description>Clicks on 'Configure' for a Product in the 'Please select products' under the 'Create New Order for' page. Selects the provided Option and Attribute. Fills in the provided Qty. Clicks on Ok.</description> + </annotations> + <arguments> + <argument name="attribute"/> + <argument name="option"/> + <argument name="quantity" type="string"/> + </arguments> + + <click selector="{{AdminOrderFormItemsSection.configure}}" stepKey="clickConfigure"/> + <waitForElementVisible selector="{{AdminOrderFormConfigureProductSection.optionSelect(attribute.default_frontend_label)}}" stepKey="waitForConfigurablePopover"/> + <wait time="2" stepKey="waitForOptionsToLoad"/> + <selectOption selector="{{AdminOrderFormConfigureProductSection.optionSelect(attribute.default_frontend_label)}}" userInput="{{option.label}}" stepKey="selectionConfigurableOption"/> + <fillField selector="{{AdminOrderFormConfigureProductSection.quantity}}" userInput="{{quantity}}" stepKey="fillQuantity"/> + <click selector="{{AdminOrderFormConfigureProductSection.ok}}" stepKey="clickOkConfigurablePopover"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/CreateOrderActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/CreateOrderActionGroup.xml new file mode 100644 index 0000000000000..576735a9a36c5 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/CreateOrderActionGroup.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateOrderActionGroup"> + <annotations> + <description>Goes to the Admin Create New Order page. Selects the provided Customer. Adds the provided Product to the Order. Clicks on Submit Order. Validates that the Success Message is present and correct.</description> + </annotations> + <arguments> + <argument name="product"/> + <argument name="customer"/> + </arguments> + + <amOnPage stepKey="navigateToNewOrderPage" url="{{AdminOrderCreatePage.url}}"/> + <waitForPageLoad stepKey="waitForNewOrderPageOpened"/> + <click stepKey="chooseCustomer" selector="{{AdminOrdersGridSection.customerInOrdersSection(customer.firstname)}}"/> + <waitForPageLoad stepKey="waitForStoresPageOpened"/> + <click selector="{{OrdersGridSection.addProducts}}" stepKey="clickOnAddProducts"/> + <waitForPageLoad stepKey="waitForProductsListForOrder"/> + <click selector="{{AdminOrdersGridSection.productForOrder(product.sku)}}" stepKey="chooseTheProduct"/> + <waitForPageLoad stepKey="waitForClickProduct"/> + <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="addSelectedProductToOrder"/> + <waitForPageLoad stepKey="waitForProductAddedInOrder"/> + <click selector="{{AdminInvoicePaymentShippingSection.getShippingMethodAndRates}}" stepKey="openShippingMethod"/> + <waitForPageLoad stepKey="waitForShippingMethods"/> + <click selector="{{AdminInvoicePaymentShippingSection.shippingMethod}}" stepKey="chooseShippingMethod"/> + <waitForPageLoad stepKey="waitForShippingMethodsThickened"/> + <click selector="{{OrdersGridSection.submitOrder}}" stepKey="submitOrder"/> + <waitForPageLoad stepKey="waitForSubmitOrder"/> + <see stepKey="seeSuccessMessageForOrder" userInput="You created the order."/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/CreateOrderFilteringCustomerByEmailActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/CreateOrderFilteringCustomerByEmailActionGroup.xml new file mode 100644 index 0000000000000..fb65531b14bfb --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/CreateOrderFilteringCustomerByEmailActionGroup.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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateOrderFilteringCustomerByEmailActionGroup" extends="CreateOrderActionGroup"> + <click stepKey="chooseCustomer" selector="{{AdminOrdersGridSection.customerInOrdersSection(customer.email)}}"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/CreateOrderInStoreActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/CreateOrderInStoreActionGroup.xml new file mode 100644 index 0000000000000..2349be636cfa7 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/CreateOrderInStoreActionGroup.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateOrderInStoreActionGroup"> + <annotations> + <description>Goes to the Admin Create Order page. Creates an Order based on the provided Customer, Store View and Product. Validates that the Success Message is present and correct.</description> + </annotations> + <arguments> + <argument name="product"/> + <argument name="customer"/> + <argument name="storeView"/> + </arguments> + + <amOnPage stepKey="navigateToNewOrderPage" url="{{AdminOrderCreatePage.url}}"/> + <click stepKey="chooseCustomer" selector="{{AdminOrdersGridSection.customerInOrdersSection(customer.firstname)}}"/> + <waitForPageLoad stepKey="waitForStoresPageOpened"/> + <click stepKey="chooseStore" selector="{{AdminOrderStoreScopeTreeSection.storeForOrder(storeView.name)}}"/> + <scrollToTopOfPage stepKey="scrollToTop"/> + <waitForPageLoad stepKey="waitForStoreToAppear"/> + <click selector="{{OrdersGridSection.addProducts}}" stepKey="clickOnAddProducts"/> + <waitForPageLoad stepKey="waitForProductsListForOrder"/> + <click selector="{{AdminOrdersGridSection.productForOrder(product.sku)}}" stepKey="chooseTheProduct"/> + <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="addSelectedProductToOrder"/> + <waitForPageLoad stepKey="waitForProductAddedInOrder"/> + <click selector="{{AdminInvoicePaymentShippingSection.getShippingMethodAndRates}}" stepKey="openShippingMethod"/> + <waitForPageLoad stepKey="waitForShippingMethods"/> + <click selector="{{AdminInvoicePaymentShippingSection.shippingMethod}}" stepKey="chooseShippingMethod"/> + <waitForPageLoad stepKey="waitForShippingMethodsThickened"/> + <click selector="{{OrdersGridSection.submitOrder}}" stepKey="submitOrder"/> + <see stepKey="seeSuccessMessageForOrder" userInput="You created the order."/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/CreateOrderInStoreChoosingPaymentMethodActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/CreateOrderInStoreChoosingPaymentMethodActionGroup.xml new file mode 100644 index 0000000000000..7277a75c9bc73 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/CreateOrderInStoreChoosingPaymentMethodActionGroup.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateOrderInStoreChoosingPaymentMethodActionGroup"> + <annotations> + <description>Goes to the Admin Create Order page. Creates an Order based on the provided Customer, Store View and Product. Validates that the Success Message is present and correct.</description> + </annotations> + <arguments> + <argument name="product"/> + <argument name="customer"/> + <argument name="storeView"/> + </arguments> + + <amOnPage stepKey="navigateToNewOrderPage" url="{{AdminOrderCreatePage.url}}"/> + <click stepKey="chooseCustomer" selector="{{AdminOrdersGridSection.customerInOrdersSection(customer.firstname)}}"/> + <waitForPageLoad stepKey="waitForStoresPageOpened"/> + <click stepKey="chooseStore" selector="{{AdminOrderStoreScopeTreeSection.storeForOrder(storeView.name)}}"/> + <scrollToTopOfPage stepKey="scrollToTop"/> + <click selector="{{OrdersGridSection.addProducts}}" stepKey="clickOnAddProducts"/> + <waitForPageLoad stepKey="waitForProductsListForOrder"/> + <click selector="{{AdminOrdersGridSection.productForOrder(product.sku)}}" stepKey="chooseTheProduct"/> + <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="addSelectedProductToOrder"/> + <waitForPageLoad stepKey="waitForProductAddedInOrder"/> + <click selector="{{AdminInvoicePaymentShippingSection.getShippingMethodAndRates}}" stepKey="openShippingMethod"/> + <waitForPageLoad stepKey="waitForShippingMethods"/> + <click selector="{{AdminInvoicePaymentShippingSection.shippingMethod}}" stepKey="chooseShippingMethod"/> + <waitForPageLoad stepKey="waitForShippingMethodsThickened"/> + <waitForElementVisible selector="{{AdminOrderFormPaymentSection.paymentBlock}}" stepKey="waitForPaymentOptions"/> + <conditionalClick selector="{{AdminOrderFormPaymentSection.checkMoneyOption}}" dependentSelector="{{AdminOrderFormPaymentSection.checkMoneyOption}}" visible="true" stepKey="checkCheckMoneyOption"/> + <click selector="{{OrdersGridSection.submitOrder}}" stepKey="submitOrder"/> + <see stepKey="seeSuccessMessageForOrder" userInput="You created the order."/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/CreateOrderToPrintPageActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/CreateOrderToPrintPageActionGroup.xml index 7388eaa96f215..2b09048a7a11f 100644 --- a/app/code/Magento/Sales/Test/Mftf/ActionGroup/CreateOrderToPrintPageActionGroup.xml +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/CreateOrderToPrintPageActionGroup.xml @@ -34,13 +34,4 @@ <click selector="{{CheckoutSuccessMainSection.orderLink}}" stepKey="clickOrderLink"/> <click selector="{{StorefrontCustomerOrderViewSection.printOrderLink}}" stepKey="clickPrintOrderLink"/> </actionGroup> - - <actionGroup name="CreateOrderToPrintPageWithSelectedPaymentMethodActionGroup" extends="CreateOrderToPrintPageActionGroup"> - <annotations> - <description>EXTENDS: CreateOrderToPrintPageActionGroup. Clicks on 'Check / Money Order'.</description> - </annotations> - - <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" after="clickNext" stepKey="waitForPaymentSectionLoaded"/> - <conditionalClick selector="{{CheckoutPaymentSection.checkMoneyOrderPayment}}" dependentSelector="{{CheckoutPaymentSection.billingAddress}}" visible="false" before="waitForPlaceOrderButton" stepKey="clickCheckMoneyOrderPayment"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/CreateOrderToPrintPageWithSelectedPaymentMethodActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/CreateOrderToPrintPageWithSelectedPaymentMethodActionGroup.xml new file mode 100644 index 0000000000000..289855aee7e18 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/CreateOrderToPrintPageWithSelectedPaymentMethodActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateOrderToPrintPageWithSelectedPaymentMethodActionGroup" extends="CreateOrderToPrintPageActionGroup"> + <annotations> + <description>EXTENDS: CreateOrderToPrintPageActionGroup. Clicks on 'Check / Money Order'.</description> + </annotations> + + <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" after="clickNext" stepKey="waitForPaymentSectionLoaded"/> + <conditionalClick selector="{{CheckoutPaymentSection.checkMoneyOrderPayment}}" dependentSelector="{{CheckoutPaymentSection.billingAddress}}" visible="false" before="waitForPlaceOrderButton" stepKey="clickCheckMoneyOrderPayment"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/DontSeeProductInItemsOrderedActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/DontSeeProductInItemsOrderedActionGroup.xml new file mode 100644 index 0000000000000..da0deb15f35c1 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/DontSeeProductInItemsOrderedActionGroup.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DontSeeProductInItemsOrderedActionGroup"> + <arguments> + <argument name="product"/> + </arguments> + <dontSee selector="{{AdminOrderItemsOrderedSection.productSkuColumn}}" userInput="{{product.sku}}" stepKey="dontseeSkuInItemsOrdered"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/FillOrderCustomerInformationActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/FillOrderCustomerInformationActionGroup.xml new file mode 100644 index 0000000000000..188e6856db186 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/FillOrderCustomerInformationActionGroup.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FillOrderCustomerInformationActionGroup"> + <annotations> + <description>Fills in the provided Customer and Address details on the Admin 'Create New Order for' page.</description> + </annotations> + <arguments> + <argument name="customer"/> + <argument name="address"/> + </arguments> + + <fillField selector="{{AdminOrderFormBillingAddressSection.FirstName}}" userInput="{{customer.firstname}}" stepKey="fillFirstName"/> + <fillField selector="{{AdminOrderFormBillingAddressSection.LastName}}" userInput="{{customer.lastname}}" stepKey="fillLastName"/> + <fillField selector="{{AdminOrderFormBillingAddressSection.StreetLine1}}" userInput="{{address.street[0]}}" stepKey="fillStreetLine1"/> + <fillField selector="{{AdminOrderFormBillingAddressSection.City}}" userInput="{{address.city}}" stepKey="fillCity"/> + <selectOption selector="{{AdminOrderFormBillingAddressSection.Country}}" userInput="{{address.country_id}}" stepKey="fillCountry"/> + <selectOption selector="{{AdminOrderFormBillingAddressSection.State}}" userInput="{{address.state}}" stepKey="fillState"/> + <fillField selector="{{AdminOrderFormBillingAddressSection.PostalCode}}" userInput="{{address.postcode}}" stepKey="fillPostalCode"/> + <fillField selector="{{AdminOrderFormBillingAddressSection.Phone}}" userInput="{{address.telephone}}" stepKey="fillPhone"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/FilterInvoiceGridByOrderIdActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/FilterInvoiceGridByOrderIdActionGroup.xml new file mode 100644 index 0000000000000..5ad2b23089c76 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/FilterInvoiceGridByOrderIdActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FilterInvoiceGridByOrderIdActionGroup"> + <annotations> + <description>Goes to the Admin Invoices grid page. Filters the grid for the provided Order ID.</description> + </annotations> + <arguments> + <argument name="orderId" type="string"/> + </arguments> + + <amOnPage url="{{AdminInvoicesPage.url}}" stepKey="goToInvoices"/> + <click selector="{{AdminInvoicesGridSection.filter}}" stepKey="clickFilter"/> + <fillField selector="{{AdminInvoicesFiltersSection.orderNum}}" userInput="{{orderId}}" stepKey="fillOrderIdForFilter"/> + <click selector="{{AdminInvoicesFiltersSection.applyFilters}}" stepKey="clickApplyFilters"/> + <waitForPageLoad stepKey="waitForFiltersApply"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/FilterInvoiceGridByOrderIdWithCleanFiltersActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/FilterInvoiceGridByOrderIdWithCleanFiltersActionGroup.xml new file mode 100644 index 0000000000000..88dfc1dc888c2 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/FilterInvoiceGridByOrderIdWithCleanFiltersActionGroup.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FilterInvoiceGridByOrderIdWithCleanFiltersActionGroup" extends="FilterInvoiceGridByOrderIdActionGroup"> + <arguments> + <argument name="orderId" type="string"/> + </arguments> + <conditionalClick selector="{{AdminInvoicesGridSection.clearFilters}}" dependentSelector="{{AdminInvoicesGridSection.clearFilters}}" visible="true" stepKey="clearFilters" after="goToInvoices"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/FilterOrderGridByBaseTotalRangeActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/FilterOrderGridByBaseTotalRangeActionGroup.xml new file mode 100644 index 0000000000000..cf200a99fc57c --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/FilterOrderGridByBaseTotalRangeActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FilterOrderGridByBaseTotalRangeActionGroup"> + <annotations> + <description>Goes to the Admin Orders page. Filters the grid based on the provided Grand Total From/To values.</description> + </annotations> + <arguments> + <argument name="from"/> + <argument name="to"/> + </arguments> + + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingOrderFilters"/> + <click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openOrderGridFilters"/> + <fillField selector="{{AdminDataGridHeaderSection.filterFieldInput('base_grand_total[from]')}}" userInput="{{from}}" stepKey="fillOrderTotalFrom"/> + <fillField selector="{{AdminDataGridHeaderSection.filterFieldInput('base_grand_total[to]')}}" userInput="{{to}}" stepKey="fillOrderTotalTo"/> + <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickApplyFilters"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/FilterOrderGridByBillingNameActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/FilterOrderGridByBillingNameActionGroup.xml new file mode 100644 index 0000000000000..8636bd823e744 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/FilterOrderGridByBillingNameActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FilterOrderGridByBillingNameActionGroup"> + <annotations> + <description>Goes to the Admin Orders page. Filters the grid based on the provided Customer.</description> + </annotations> + <arguments> + <argument name="customer"/> + </arguments> + + <amOnPage url="{{AdminOrdersPage.url}}" stepKey="navigateToOrderGridPage"/> + <waitForPageLoad stepKey="waitForOrderGridLoad"/> + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingOrderFilters"/> + <click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openOrderGridFilters"/> + <fillField selector="{{AdminDataGridHeaderSection.filterFieldInput('billing_name')}}" userInput="{{customer.fullname}}" stepKey="fillBillToNameFilter"/> + <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickOrderApplyFilters"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/FilterOrderGridByIdActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/FilterOrderGridByIdActionGroup.xml new file mode 100644 index 0000000000000..bbab664809cdd --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/FilterOrderGridByIdActionGroup.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <!--Filter order grid by order id field--> + <actionGroup name="FilterOrderGridByIdActionGroup"> + <annotations> + <description>Goes to the Admin Orders page. Filters the grid based on the provided Order ID.</description> + </annotations> + <arguments> + <argument name="orderId" type="string"/> + </arguments> + + <amOnPage url="{{AdminOrdersPage.url}}" stepKey="navigateToOrderGridPage"/> + <waitForPageLoad stepKey="waitForOrdersPage"/> + <conditionalClick selector="{{AdminOrdersGridSection.clearFilters}}" dependentSelector="{{AdminOrdersGridSection.clearFilters}}" visible="true" stepKey="clearExistingOrderFilters"/> + <waitForPageLoad stepKey="waitForClearFilters"/> + <click selector="{{AdminOrdersGridSection.filters}}" stepKey="openOrderGridFilters"/> + <waitForPageLoad stepKey="waitForClickFilters"/> + <fillField selector="{{AdminOrdersGridSection.idFilter}}" userInput="{{orderId}}" stepKey="fillOrderIdFilter"/> + <click selector="{{AdminOrdersGridSection.applyFilters}}" stepKey="clickOrderApplyFilters"/> + <waitForPageLoad stepKey="waitForApplyFilters"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/FilterOrderGridByPurchaseDateActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/FilterOrderGridByPurchaseDateActionGroup.xml new file mode 100644 index 0000000000000..538faf1327b35 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/FilterOrderGridByPurchaseDateActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FilterOrderGridByPurchaseDateActionGroup"> + <annotations> + <description>Goes to the Admin Orders page. Filters the grid based on the provided Purchased Date From/To values.</description> + </annotations> + <arguments> + <argument name="from"/> + <argument name="to"/> + </arguments> + + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingOrderFilters"/> + <click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openOrderGridFilters"/> + <fillField selector="{{AdminDataGridHeaderSection.filterFieldInput('created_at[from]')}}" userInput="{{from}}" stepKey="fillOrderPurchaseDateFrom"/> + <fillField selector="{{AdminDataGridHeaderSection.filterFieldInput('created_at[to]')}}" userInput="{{to}}" stepKey="fillOrderPurchaseDateTo"/> + <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickApplyFilters"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/FilterOrderGridByStatusActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/FilterOrderGridByStatusActionGroup.xml new file mode 100644 index 0000000000000..05731e06c6228 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/FilterOrderGridByStatusActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FilterOrderGridByStatusActionGroup"> + <annotations> + <description>Filters the Admin Orders grid based on the provided Order Status.</description> + </annotations> + <arguments> + <argument name="status"/> + </arguments> + + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingOrderFilters"/> + <click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openOrderGridFilters"/> + <selectOption selector="{{AdminDataGridHeaderSection.filterFieldSelect('status')}}" userInput="{{status}}" stepKey="fillOrderStatusFilter"/> + <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickApplyFilters"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/GoToInvoiceIntoOrderActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/GoToInvoiceIntoOrderActionGroup.xml new file mode 100644 index 0000000000000..15c7f3e9a7022 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/GoToInvoiceIntoOrderActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="GoToInvoiceIntoOrderActionGroup"> + <annotations> + <description>Clicks on 'Invoice' on the Admin Orders view page. Validates that the URL and Page Title are correct.</description> + </annotations> + + <click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoiceAction"/> + <seeInCurrentUrl url="{{AdminInvoiceNewPage.url}}" stepKey="seeOrderInvoiceUrl"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Invoice" stepKey="seePageNameNewInvoicePage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/NavigateToNewOrderPageExistingCustomerActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/NavigateToNewOrderPageExistingCustomerActionGroup.xml new file mode 100644 index 0000000000000..a8f9d61ad6803 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/NavigateToNewOrderPageExistingCustomerActionGroup.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="NavigateToNewOrderPageExistingCustomerActionGroup"> + <annotations> + <description>Goes tot he Admin Orders grid page. Clicks on 'Create New Order'. Filters the grid for the provided Customer. Clicks on the Customer. Selects the provided Store View, if present. Validates that the Page Title is present and correct.</description> + </annotations> + <arguments> + <argument name="customer"/> + <argument name="storeView" defaultValue="_defaultStore"/> + </arguments> + + <amOnPage url="{{AdminOrdersPage.url}}" stepKey="navigateToOrderIndexPage"/> + <waitForPageLoad stepKey="waitForIndexPageLoad"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Orders" stepKey="seeIndexPageTitle"/> + <click selector="{{AdminOrdersGridSection.createNewOrder}}" stepKey="clickCreateNewOrder"/> + <waitForPageLoad stepKey="waitForCustomerGridLoad"/> + + <!--Clear grid filters--> + <conditionalClick selector="{{AdminOrderCustomersGridSection.resetButton}}" dependentSelector="{{AdminOrderCustomersGridSection.resetButton}}" visible="true" stepKey="clearExistingCustomerFilters"/> + <fillField userInput="{{customer.email}}" selector="{{AdminOrderCustomersGridSection.emailInput}}" stepKey="filterEmail"/> + <click selector="{{AdminOrderCustomersGridSection.apply}}" stepKey="applyFilter"/> + <waitForPageLoad stepKey="waitForFilteredCustomerGridLoad"/> + <click selector="{{AdminOrderCustomersGridSection.firstRow}}" stepKey="clickOnCustomer"/> + <waitForPageLoad stepKey="waitForCreateOrderPageLoad"/> + + <!-- Select store view if appears --> + <conditionalClick selector="{{AdminOrderStoreScopeTreeSection.storeOption(storeView.name)}}" dependentSelector="{{AdminOrderStoreScopeTreeSection.storeOption(storeView.name)}}" visible="true" stepKey="selectStoreViewIfAppears"/> + <waitForPageLoad stepKey="waitForCreateOrderPageLoadAfterStoreSelect"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Create New Order" stepKey="seeNewOrderPageTitle"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/NavigateToNewOrderPageExistingCustomerAndStoreActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/NavigateToNewOrderPageExistingCustomerAndStoreActionGroup.xml new file mode 100644 index 0000000000000..08f70f69013f3 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/NavigateToNewOrderPageExistingCustomerAndStoreActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="NavigateToNewOrderPageExistingCustomerAndStoreActionGroup" extends="navigateToNewOrderPageExistingCustomer"> + <annotations> + <description>EXTENDS: navigateToNewOrderPageExistingCustomer. Clicks on the provided Store View.</description> + </annotations> + <arguments> + <argument name="storeView" defaultValue="_defaultStore"/> + </arguments> + + <click selector="{{AdminOrderStoreScopeTreeSection.storeOption(storeView.name)}}" stepKey="selectStoreView" after="waitForCreateOrderPageLoad"/> + <waitForPageLoad stepKey="waitForLoad" after="selectStoreView"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/NavigateToNewOrderPageNewCustomerActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/NavigateToNewOrderPageNewCustomerActionGroup.xml new file mode 100644 index 0000000000000..73a4da42eb093 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/NavigateToNewOrderPageNewCustomerActionGroup.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <!--Navigate to create order page (New Order -> Create New Customer)--> + <actionGroup name="NavigateToNewOrderPageNewCustomerActionGroup"> + <annotations> + <description>Goes to the Admin Orders grid page. Clicks on 'Create New Order'. Clicks on 'Create New Customer'. Select the provided Store View, if present. Validates that Page Title is present and correct.</description> + </annotations> + <arguments> + <argument name="storeView" defaultValue="_defaultStore"/> + </arguments> + + <amOnPage url="{{AdminOrdersPage.url}}" stepKey="navigateToOrderIndexPage"/> + <waitForPageLoad stepKey="waitForIndexPageLoad"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Orders" stepKey="seeIndexPageTitle"/> + <click selector="{{AdminOrdersGridSection.createNewOrder}}" stepKey="clickCreateNewOrder"/> + <click selector="{{AdminOrderFormActionSection.CreateNewCustomer}}" stepKey="clickCreateCustomer"/> + <conditionalClick selector="{{AdminOrderStoreScopeTreeSection.storeOption(storeView.name)}}" dependentSelector="{{AdminOrderStoreScopeTreeSection.storeOption(storeView.name)}}" visible="true" stepKey="selectStoreViewIfAppears"/> + <waitForPageLoad stepKey="waitForCreateOrderPageLoadAfterStoreSelect"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Create New Order" stepKey="seeNewOrderPageTitle"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/NavigateToNewOrderPageNewCustomerSingleStoreActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/NavigateToNewOrderPageNewCustomerSingleStoreActionGroup.xml new file mode 100644 index 0000000000000..cd1be0ac34279 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/NavigateToNewOrderPageNewCustomerSingleStoreActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="NavigateToNewOrderPageNewCustomerSingleStoreActionGroup"> + <annotations> + <description>Goes to the Admin Orders grid page. Clicks on 'Create New Order'. Clicks on 'Create New Customer'. Validates that Page Title is present and correct.</description> + </annotations> + <arguments> + <argument name="storeView" defaultValue="_defaultStore"/> + </arguments> + + <amOnPage url="{{AdminOrdersPage.url}}" stepKey="navigateToOrderIndexPage"/> + <waitForPageLoad stepKey="waitForIndexPageLoad"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Orders" stepKey="seeIndexPageTitle"/> + <click selector="{{AdminOrdersGridSection.createNewOrder}}" stepKey="clickCreateNewOrder"/> + <click selector="{{AdminOrderFormActionSection.CreateNewCustomer}}" stepKey="clickCreateCustomer"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Create New Order" stepKey="seeNewOrderPageTitle"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/NewAddConfigurableProductToOrderActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/NewAddConfigurableProductToOrderActionGroup.xml new file mode 100644 index 0000000000000..20f2ab162688d --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/NewAddConfigurableProductToOrderActionGroup.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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="NewAddConfigurableProductToOrderActionGroup" extends="AddConfigurableProductToOrderActionGroup"> + <remove keyForRemoval="waitForConfigurablePopover"/> + <remove keyForRemoval="selectionConfigurableOption"/> + <selectOption selector="{{AdminOrderFormConfigureProductSection.selectOption}}" userInput="{{option.value}}" stepKey="selectOption" after="waitForOptionsToLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/OpenOrderByIdActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/OpenOrderByIdActionGroup.xml new file mode 100644 index 0000000000000..ca05041140f47 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/OpenOrderByIdActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="OpenOrderByIdActionGroup" extends="FilterOrderGridByIdActionGroup"> + <annotations> + <description>EXTENDS: filterOrderGridById. Clicks on the 1st row of the Admin Orders grid.</description> + </annotations> + + <click selector="{{AdminDataGridTableSection.firstRow}}" after="clickOrderApplyFilters" stepKey="openOrderViewPage"/> + <waitForPageLoad after="openOrderViewPage" stepKey="waitForOrderViewPageOpened"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/OrderSelectFlatRateShippingActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/OrderSelectFlatRateShippingActionGroup.xml new file mode 100644 index 0000000000000..b85dc21e0b1b5 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/OrderSelectFlatRateShippingActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="OrderSelectFlatRateShippingActionGroup"> + <annotations> + <description>Selects the 'Flat Rate' Shipping Method on the Admin 'Create New Order for' page.</description> + </annotations> + + <click selector="{{AdminOrderFormPaymentSection.header}}" stepKey="unfocus"/> + <waitForPageLoad stepKey="waitForJavascriptToFinish"/> + <click selector="{{AdminOrderFormPaymentSection.getShippingMethods}}" stepKey="clickShippingMethods"/> + <waitForElementVisible selector="{{AdminOrderFormPaymentSection.flatRateOption}}" stepKey="waitForShippingOptions"/> + <selectOption selector="{{AdminOrderFormPaymentSection.flatRateOption}}" userInput="flatrate_flatrate" stepKey="checkFlatRate"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/OrderSelectFreeShippingActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/OrderSelectFreeShippingActionGroup.xml new file mode 100644 index 0000000000000..ef78fe892e933 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/OrderSelectFreeShippingActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="OrderSelectFreeShippingActionGroup"> + <annotations> + <description>Selects the 'Free Shipping' Shipping Method on the Admin 'Create New Order for' page.</description> + </annotations> + + <click selector="{{AdminOrderFormPaymentSection.header}}" stepKey="unfocus"/> + <waitForPageLoad stepKey="waitForJavascriptToFinish"/> + <click selector="{{AdminOrderFormPaymentSection.getShippingMethods}}" stepKey="clickShippingMethods"/> + <waitForElementVisible selector="{{AdminOrderFormPaymentSection.freeShippingOption}}" stepKey="waitForShippingOptions"/> + <selectOption selector="{{AdminOrderFormPaymentSection.freeShippingOption}}" userInput="freeshipping_freeshipping" stepKey="checkFreeShipping"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/SeeProductInInvoiceItemsActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/SeeProductInInvoiceItemsActionGroup.xml new file mode 100644 index 0000000000000..0d35414617ff8 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/SeeProductInInvoiceItemsActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SeeProductInInvoiceItemsActionGroup"> + <annotations> + <description>Validates that the provided Product appears under the 'SKU' column in the Admin Invoices edit page.</description> + </annotations> + <arguments> + <argument name="product"/> + </arguments> + + <see selector="{{AdminInvoiceItemsSection.skuColumn}}" userInput="{{product.sku}}" stepKey="seeProductSkuInGrid"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/SeeProductInItemsOrderedActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/SeeProductInItemsOrderedActionGroup.xml new file mode 100644 index 0000000000000..05328ab046bf8 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/SeeProductInItemsOrderedActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SeeProductInItemsOrderedActionGroup"> + <annotations> + <description>Validates that the provided Product is present and correct in the 'Items Ordered' section on the Admin Orders view page.</description> + </annotations> + <arguments> + <argument name="product"/> + </arguments> + + <see selector="{{AdminOrderItemsOrderedSection.productSkuColumn}}" userInput="{{product.sku}}" stepKey="seeSkuInItemsOrdered"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/SeeProductInItemsRefundedActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/SeeProductInItemsRefundedActionGroup.xml new file mode 100644 index 0000000000000..0690a190d3f0f --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/SeeProductInItemsRefundedActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SeeProductInItemsRefundedActionGroup"> + <annotations> + <description>Validates that the provided Product appears in the 'Product' column on the Admin Credit Memo view page.</description> + </annotations> + <arguments> + <argument name="product"/> + </arguments> + + <see selector="{{AdminCreditMemoItemsSection.skuColumn}}" userInput="{{product.sku}}" stepKey="seeProductSkuInGrid"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/SelectBankTransferPaymentMethodActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/SelectBankTransferPaymentMethodActionGroup.xml new file mode 100644 index 0000000000000..8c1ceeb97201d --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/SelectBankTransferPaymentMethodActionGroup.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SelectBankTransferPaymentMethodActionGroup" extends="SelectCheckMoneyPaymentMethodActionGroup"> + <remove keyForRemoval="checkCheckMoneyOption"/> + <conditionalClick selector="{{AdminOrderFormPaymentSection.checkBankTransfer}}" dependentSelector="{{AdminOrderFormPaymentSection.checkBankTransfer}}" visible="true" stepKey="checkBankTransferOption" after="waitForPaymentOptions"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/SelectCashOnDeliveryPaymentMethodActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/SelectCashOnDeliveryPaymentMethodActionGroup.xml new file mode 100644 index 0000000000000..dc6d8d4a8ffaf --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/SelectCashOnDeliveryPaymentMethodActionGroup.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SelectCashOnDeliveryPaymentMethodActionGroup" extends="SelectCheckMoneyPaymentMethodActionGroup"> + <remove keyForRemoval="checkCheckMoneyOption"/> + <conditionalClick selector="{{AdminOrderFormPaymentSection.checkCashOnDelivery}}" dependentSelector="{{AdminOrderFormPaymentSection.checkCashOnDelivery}}" visible="true" stepKey="checkCashOnDeliveryOption" after="waitForPaymentOptions"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/SelectCheckMoneyPaymentMethodActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/SelectCheckMoneyPaymentMethodActionGroup.xml new file mode 100644 index 0000000000000..044a7fa9f8b3b --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/SelectCheckMoneyPaymentMethodActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SelectCheckMoneyPaymentMethodActionGroup"> + <annotations> + <description>Selects the 'Check / Money Order' Payment Method on the Admin Create New Order page.</description> + </annotations> + + <waitForElementVisible selector="{{AdminOrderFormPaymentSection.paymentBlock}}" stepKey="waitForPaymentOptions"/> + <conditionalClick selector="{{AdminOrderFormPaymentSection.checkMoneyOption}}" dependentSelector="{{AdminOrderFormPaymentSection.checkMoneyOption}}" visible="true" stepKey="checkCheckMoneyOption"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/SelectPurchaseOrderPaymentMethodActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/SelectPurchaseOrderPaymentMethodActionGroup.xml new file mode 100644 index 0000000000000..c9502afb3777f --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/SelectPurchaseOrderPaymentMethodActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SelectPurchaseOrderPaymentMethodActionGroup" extends="SelectCheckMoneyPaymentMethodActionGroup"> + <arguments> + <argument name="purchaseOrderNumber" type="string"/> + </arguments> + <remove keyForRemoval="checkCheckMoneyOption"/> + <conditionalClick selector="{{AdminOrderFormPaymentSection.checkPurchaseOrder}}" dependentSelector="{{AdminOrderFormPaymentSection.checkPurchaseOrder}}" visible="true" stepKey="checkPurchaseOrderOption" after="waitForPaymentOptions"/> + <fillField selector="{{AdminOrderFormPaymentSection.fieldPurchaseOrderNumber}}" userInput="{{purchaseOrderNumber}}" stepKey="fillPurchaseOrderNumber"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/StartCreateInvoiceFromOrderPageActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/StartCreateInvoiceFromOrderPageActionGroup.xml new file mode 100644 index 0000000000000..25906e895726d --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/StartCreateInvoiceFromOrderPageActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StartCreateInvoiceFromOrderPageActionGroup"> + <annotations> + <description>Clicks on 'Invoice' on the Admin Orders view page. Validates that the URL and Page Title are correct.</description> + </annotations> + + <click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoiceAction"/> + <seeInCurrentUrl url="{{AdminInvoiceNewPage.url}}" stepKey="seeNewInvoiceUrl"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Invoice" stepKey="seeNewInvoicePageTitle"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/StartToCreateCreditMemoActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/StartToCreateCreditMemoActionGroup.xml new file mode 100644 index 0000000000000..fbfdf4979fda8 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/StartToCreateCreditMemoActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StartToCreateCreditMemoActionGroup"> + <arguments> + <argument name="orderId" type="string"/> + </arguments> + <amOnPage url="{{AdminOrderPage.url(orderId)}}" stepKey="navigateToOrderPage"/> + <click selector="{{AdminOrderDetailsMainActionsSection.creditMemo}}" stepKey="clickCreditMemo"/> + <waitForElementVisible selector="{{AdminHeaderSection.pageTitle}}" stepKey="waitForPageTitle"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Memo" stepKey="seeNewMemoPageTitle"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/SubmitCreditMemoActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/SubmitCreditMemoActionGroup.xml new file mode 100644 index 0000000000000..fbd2a0047d558 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/SubmitCreditMemoActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SubmitCreditMemoActionGroup"> + <grabFromCurrentUrl regex="~/order_id/(\d+)/~" stepKey="grabOrderId"/> + <waitForElementVisible selector="{{AdminCreditMemoTotalSection.submitRefundOffline}}" stepKey="waitButtonEnabled"/> + <click selector="{{AdminCreditMemoTotalSection.submitRefundOffline}}" stepKey="clickSubmitCreditMemo"/> + <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForMessageAppears"/> + <see selector="{{AdminMessagesSection.success}}" userInput="You created the credit memo." stepKey="seeCreditMemoCreateSuccess"/> + <seeInCurrentUrl url="{{AdminOrderDetailsPage.url}}$grabOrderId" stepKey="seeViewOrderPageCreditMemo"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/SubmitInvoiceActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/SubmitInvoiceActionGroup.xml new file mode 100644 index 0000000000000..2ff4dd210a187 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/SubmitInvoiceActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SubmitInvoiceActionGroup"> + <annotations> + <description>Clicks on 'Submit Invoice' on the Admin 'New Invoice' page. Validates that the Success Message is present and correct. Validates that the Order ID appears in the URL.</description> + </annotations> + + <click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/> + <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForMessageAppears"/> + <see selector="{{AdminMessagesSection.success}}" userInput="The invoice has been created." stepKey="seeInvoiceCreateSuccess"/> + <grabFromCurrentUrl regex="~/order_id/(\d+)/~" stepKey="grabOrderId"/> + <seeInCurrentUrl url="{{AdminOrderDetailsPage.url('$grabOrderId')}}" stepKey="seeViewOrderPageInvoice"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/UpdateCreditMemoTotalsActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/UpdateCreditMemoTotalsActionGroup.xml new file mode 100644 index 0000000000000..18707a39853a3 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/UpdateCreditMemoTotalsActionGroup.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="UpdateCreditMemoTotalsActionGroup"> + <waitForElementVisible selector="{{AdminCreditMemoTotalSection.updateTotals}}" stepKey="waitUpdateTotalsButtonEnabled"/> + <click selector="{{AdminCreditMemoTotalSection.updateTotals}}" stepKey="clickUpdateTotals"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/VerifyBasicInvoiceInformationActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/VerifyBasicInvoiceInformationActionGroup.xml new file mode 100644 index 0000000000000..431e5e7dbfee1 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/VerifyBasicInvoiceInformationActionGroup.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <!--Check customer information is correct in invoice--> + <actionGroup name="VerifyBasicInvoiceInformationActionGroup"> + <annotations> + <description>Validates that the provided Customer, Address and Customer Group details are present and correct on the Admin View Invoice page.</description> + </annotations> + <arguments> + <argument name="customer"/> + <argument name="shippingAddress"/> + <argument name="billingAddress"/> + <argument name="customerGroup" defaultValue="GeneralCustomerGroup"/> + </arguments> + + <see selector="{{AdminInvoiceOrderInformationSection.customerName}}" userInput="{{customer.firstname}}" stepKey="seeCustomerName"/> + <see selector="{{AdminInvoiceOrderInformationSection.customerEmail}}" userInput="{{customer.email}}" stepKey="seeCustomerEmail"/> + <see selector="{{AdminInvoiceOrderInformationSection.customerGroup}}" userInput="{{customerGroup.code}}" stepKey="seeCustomerGroup"/> + <see selector="{{AdminInvoiceAddressInformationSection.billingAddress}}" userInput="{{billingAddress.street[0]}}" stepKey="seeBillingAddressStreet"/> + <see selector="{{AdminInvoiceAddressInformationSection.billingAddress}}" userInput="{{billingAddress.city}}" stepKey="seeBillingAddressCity"/> + <see selector="{{AdminInvoiceAddressInformationSection.billingAddress}}" userInput="{{billingAddress.country_id}}" stepKey="seeBillingAddressCountry"/> + <see selector="{{AdminInvoiceAddressInformationSection.billingAddress}}" userInput="{{billingAddress.postcode}}" stepKey="seeBillingAddressPostcode"/> + <see selector="{{AdminInvoiceAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.street[0]}}" stepKey="seeShippingAddressStreet"/> + <see selector="{{AdminInvoiceAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.city}}" stepKey="seeShippingAddressCity"/> + <see selector="{{AdminInvoiceAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.country_id}}" stepKey="seeShippingAddressCountry"/> + <see selector="{{AdminInvoiceAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.postcode}}" stepKey="seeShippingAddressPostcode"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/VerifyBasicOrderInformationActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/VerifyBasicOrderInformationActionGroup.xml new file mode 100644 index 0000000000000..412586739006b --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/VerifyBasicOrderInformationActionGroup.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="VerifyBasicOrderInformationActionGroup"> + <annotations> + <description>Validates that the provided Customer, Shipping/Billing Address and Customer Group are present and correct on the Admin Orders view page.</description> + </annotations> + <arguments> + <argument name="customer"/> + <argument name="shippingAddress"/> + <argument name="billingAddress"/> + <argument name="customerGroup" defaultValue="GeneralCustomerGroup"/> + </arguments> + + <see selector="{{AdminOrderDetailsInformationSection.customerName}}" userInput="{{customer.firstname}}" stepKey="seeCustomerName"/> + <see selector="{{AdminOrderDetailsInformationSection.customerEmail}}" userInput="{{customer.email}}" stepKey="seeCustomerEmail"/> + <see selector="{{AdminOrderDetailsInformationSection.customerGroup}}" userInput="{{customerGroup.code}}" stepKey="seeCustomerGroup"/> + <see selector="{{AdminOrderAddressInformationSection.billingAddress}}" userInput="{{billingAddress.street[0]}}" stepKey="seeBillingAddressStreet"/> + <see selector="{{AdminOrderAddressInformationSection.billingAddress}}" userInput="{{billingAddress.city}}" stepKey="seeBillingAddressCity"/> + <see selector="{{AdminOrderAddressInformationSection.billingAddress}}" userInput="{{billingAddress.country_id}}" stepKey="seeBillingAddressCountry"/> + <see selector="{{AdminOrderAddressInformationSection.billingAddress}}" userInput="{{billingAddress.postcode}}" stepKey="seeBillingAddressPostcode"/> + <see selector="{{AdminOrderAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.street[0]}}" stepKey="seeShippingAddressStreet"/> + <see selector="{{AdminOrderAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.city}}" stepKey="seeShippingAddressCity"/> + <see selector="{{AdminOrderAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.country_id}}" stepKey="seeShippingAddressCountry"/> + <see selector="{{AdminOrderAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.postcode}}" stepKey="seeShippingAddressPostcode"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/VerifyCreatedOrderInformationActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/VerifyCreatedOrderInformationActionGroup.xml new file mode 100644 index 0000000000000..9a62771fb54cd --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/VerifyCreatedOrderInformationActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="VerifyCreatedOrderInformationActionGroup"> + <annotations> + <description>Validates that the Success Message, Order Status (Pending) and Order ID are present and correct.</description> + </annotations> + + <see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="You created the order." stepKey="seeSuccessMessage"/> + <see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="Pending" stepKey="seeOrderPendingStatus" after="seeSuccessMessage"/> + <grabTextFrom selector="|Order # (\d+)|" stepKey="getOrderId" after="seeOrderPendingStatus"/> + <assertNotEmpty actual="$getOrderId" stepKey="assertOrderIdIsNotEmpty" after="getOrderId"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminAvailabilityCreditMemoWithNoPaymentTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminAvailabilityCreditMemoWithNoPaymentTest.xml index e405173429b2c..ec518c79a0808 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminAvailabilityCreditMemoWithNoPaymentTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminAvailabilityCreditMemoWithNoPaymentTest.xml @@ -42,11 +42,11 @@ </after> <!--Proceed to Admin panel > SALES > Orders. Created order should be in Processing status--> - <actionGroup ref="navigateToNewOrderPageNewCustomer" stepKey="navigateToNewOrderPage"/> + <actionGroup ref="NavigateToNewOrderPageNewCustomerActionGroup" stepKey="navigateToNewOrderPage"/> <!--Check if order can be submitted without the required fields including email address--> <scrollToTopOfPage stepKey="scrollToTopOfOrderFormPage"/> - <actionGroup ref="addSimpleProductToOrder" stepKey="addFirstProductToOrder"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addFirstProductToOrder"> <argument name="product" value="$$createProduct$$"/> </actionGroup> @@ -61,20 +61,20 @@ <fillField selector="{{AdminOrderFormAccountSection.email}}" userInput="{{Simple_US_Customer.email}}" stepKey="fillCustomerEmail"/> <!--Fill customer address information--> - <actionGroup ref="fillOrderCustomerInformation" stepKey="fillCustomerAddress"> + <actionGroup ref="FillOrderCustomerInformationActionGroup" stepKey="fillCustomerAddress"> <argument name="customer" value="Simple_US_Customer"/> <argument name="address" value="US_Address_TX"/> </actionGroup> <!-- Select Free shipping --> - <actionGroup ref="orderSelectFreeShipping" stepKey="selectFreeShippingOption"/> + <actionGroup ref="OrderSelectFreeShippingActionGroup" stepKey="selectFreeShippingOption"/> <!--Click *Submit Order* button--> <click selector="{{AdminOrderFormActionSection.SubmitOrder}}" stepKey="clickSubmitOrder"/> <!--Click *Invoice* button--> - <actionGroup ref="StartCreateInvoiceFromOrderPage" stepKey="startCreateInvoice"/> - <actionGroup ref="SubmitInvoice" stepKey="submitInvoice"/> + <actionGroup ref="StartCreateInvoiceFromOrderPageActionGroup" stepKey="startCreateInvoice"/> + <actionGroup ref="SubmitInvoiceActionGroup" stepKey="submitInvoice"/> <!--Verify that *Credit Memo* button is displayed--> <seeElement selector="{{AdminOrderFormItemsSection.creditMemo}}" stepKey="seeCreditMemo"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithBankTransferPaymentMethodTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithBankTransferPaymentMethodTest.xml index 74cf3e9dd6b7a..726b4a99cdec9 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithBankTransferPaymentMethodTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithBankTransferPaymentMethodTest.xml @@ -44,12 +44,12 @@ </after> <!--Create new customer order--> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderWithExistingCustomer"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderWithExistingCustomer"> <argument name="customer" value="$$simpleCustomer$$"/> </actionGroup> <!--Add Simple product to order--> - <actionGroup ref="addSimpleProductToOrder" stepKey="addSimpleProductToTheOrder"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSimpleProductToTheOrder"> <argument name="product" value="$$simpleProduct$$"/> </actionGroup> @@ -64,11 +64,11 @@ <click selector="{{AdminOrderFormActionSection.SubmitOrder}}" stepKey="submitOrder"/> <!-- Verify order information --> - <actionGroup ref="verifyCreatedOrderInformation" stepKey="verifyCreatedOrderInformation"/> + <actionGroup ref="VerifyCreatedOrderInformationActionGroup" stepKey="verifyCreatedOrderInformation"/> <grabTextFrom selector="|Order # (\d+)|" stepKey="orderId"/> <!-- Cancel the Order --> - <actionGroup ref="cancelPendingOrder" stepKey="cancelPendingOrder"/> + <actionGroup ref="CancelPendingOrderActionGroup" stepKey="cancelPendingOrder"/> <!--Log in to Storefront as Customer --> <actionGroup ref="LoginToStorefrontActionGroup" stepKey="signUp"> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithCashOnDeliveryPaymentMethodTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithCashOnDeliveryPaymentMethodTest.xml index a412adee939d2..eb46621a458ab 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithCashOnDeliveryPaymentMethodTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithCashOnDeliveryPaymentMethodTest.xml @@ -44,12 +44,12 @@ </after> <!-- Create new customer order --> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderWithExistingCustomer"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderWithExistingCustomer"> <argument name="customer" value="$$simpleCustomer$$"/> </actionGroup> <!-- Add Simple product to order --> - <actionGroup ref="addSimpleProductToOrder" stepKey="addSimpleProductToTheOrder"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSimpleProductToTheOrder"> <argument name="product" value="$$simpleProduct$$"/> </actionGroup> @@ -64,11 +64,11 @@ <click selector="{{AdminOrderFormActionSection.SubmitOrder}}" stepKey="submitOrder"/> <!--Verify order information--> - <actionGroup ref="verifyCreatedOrderInformation" stepKey="verifyCreatedOrderInformation"/> + <actionGroup ref="VerifyCreatedOrderInformationActionGroup" stepKey="verifyCreatedOrderInformation"/> <grabTextFrom selector="|Order # (\d+)|" stepKey="orderId"/> <!-- Cancel the Order --> - <actionGroup ref="cancelPendingOrder" stepKey="cancelPendingOrder"/> + <actionGroup ref="CancelPendingOrderActionGroup" stepKey="cancelPendingOrder"/> <!--Log in to Storefront as Customer --> <actionGroup ref="LoginToStorefrontActionGroup" stepKey="signUp"> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithCheckMoneyOrderPaymentMethodTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithCheckMoneyOrderPaymentMethodTest.xml index 116b8e7d6ca71..f8bec3f450963 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithCheckMoneyOrderPaymentMethodTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithCheckMoneyOrderPaymentMethodTest.xml @@ -111,30 +111,30 @@ </after> <!-- Create new customer order --> <comment userInput="Create new customer order" stepKey="createNewCustomerOrderComment"/> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderWithExistingCustomer"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderWithExistingCustomer"> <argument name="customer" value="$$simpleCustomer$$"/> </actionGroup> <!-- Add bundle product to order and check product price in grid --> <comment userInput="Add bundle product to order and check product price in grid" stepKey="addBundleProductToOrderComment"/> - <actionGroup ref="addBundleProductToOrder" stepKey="addBundleProductToOrder"> + <actionGroup ref="AddBundleProductToOrderActionGroup" stepKey="addBundleProductToOrder"> <argument name="product" value="$$createBundleProduct$$"/> <argument name="quantity" value="1"/> </actionGroup> <!-- Add configurable product to order --> <comment userInput="Add configurable product to order" stepKey="addConfigurableProductToOrderComment"/> - <actionGroup ref="newAddConfigurableProductToOrder" stepKey="addConfigurableProductToOrder"> + <actionGroup ref="NewAddConfigurableProductToOrderActionGroup" stepKey="addConfigurableProductToOrder"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="attribute" value="$$createConfigProductAttribute$$"/> <argument name="option" value="$$getConfigAttributeOption1$$"/> </actionGroup> <!-- Add Simple product to order --> <comment userInput="Add Simple product to order" stepKey="addSimpleProductToOrderComment"/> - <actionGroup ref="addSimpleProductToOrder" stepKey="addSimpleProductToTheOrder"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSimpleProductToTheOrder"> <argument name="product" value="$$simpleProduct$$"/> </actionGroup> <!-- Add Virtual product to order --> <comment userInput="Add Virtual product to order" stepKey="addVirtualProductToOrderComment"/> - <actionGroup ref="addSimpleProductToOrder" stepKey="addVirtualProductToTheOrder"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addVirtualProductToTheOrder"> <argument name="product" value="$$virtualProduct$$"/> </actionGroup> <!-- Select FlatRate shipping method --> @@ -145,11 +145,11 @@ <click selector="{{AdminOrderFormActionSection.SubmitOrder}}" stepKey="submitOrder"/> <!-- Verify order information --> <comment userInput="Verify order information" stepKey="verifyOrderInformationComment"/> - <actionGroup ref="verifyCreatedOrderInformation" stepKey="verifyCreatedOrderInformation"/> + <actionGroup ref="VerifyCreatedOrderInformationActionGroup" stepKey="verifyCreatedOrderInformation"/> <grabTextFrom selector="|Order # (\d+)|" stepKey="orderId"/> <!-- Cancel the Order --> <comment userInput="Cancel the Order" stepKey="cancelTheOrder"/> - <actionGroup ref="cancelPendingOrder" stepKey="cancelPendingOrder"/> + <actionGroup ref="CancelPendingOrderActionGroup" stepKey="cancelPendingOrder"/> <!-- Assert Simple Product Quantity in backend after order Canceled --> <comment userInput="Assert Simple Product Quantity in backend after order Canceled" stepKey="assertSimpleProductQuantityAfterOrderCanceledComment"/> <actionGroup ref="filterAndSelectProduct" stepKey="filterAndSelectTheProduct"> @@ -216,7 +216,7 @@ <waitForPageLoad stepKey="waitForPageLoad5"/> <!-- Filter order using orderId --> <comment userInput="Filter order using orderId" stepKey="filterOrderUsingOrderIdComment"/> - <actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGridById"> <argument name="orderId" value="$orderId"/> </actionGroup> <see selector="{{AdminOrdersGridSection.firstRow}}" userInput="$orderId" stepKey="seeOrderIdInGrid"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithProductQtyWithoutStockDecreaseTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithProductQtyWithoutStockDecreaseTest.xml index 4300f22c3fb3a..1ab921ac2b09d 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithProductQtyWithoutStockDecreaseTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithProductQtyWithoutStockDecreaseTest.xml @@ -47,12 +47,12 @@ </after> <!--Create new customer order--> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderWithExistingCustomer"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderWithExistingCustomer"> <argument name="customer" value="$$simpleCustomer$$"/> </actionGroup> <!--Add Simple product to order--> - <actionGroup ref="addSimpleProductToOrder" stepKey="addSimpleProductToTheOrder"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSimpleProductToTheOrder"> <argument name="product" value="$$simpleProduct$$"/> </actionGroup> @@ -63,7 +63,7 @@ <click selector="{{AdminOrderFormActionSection.SubmitOrder}}" stepKey="submitOrder"/> <!--Verify order information--> - <actionGroup ref="verifyCreatedOrderInformation" stepKey="verifyCreatedOrderInformation"/> + <actionGroup ref="VerifyCreatedOrderInformationActionGroup" stepKey="verifyCreatedOrderInformation"/> <grabTextFrom selector="|Order # (\d+)|" stepKey="orderId"/> <!-- Assert Simple Product Quantity in backend after order --> @@ -80,13 +80,13 @@ <waitForPageLoad stepKey="waitForPageLoad5"/> <!-- Filter Order using orderId --> - <actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGridById"> <argument name="orderId" value="$orderId"/> </actionGroup> <click selector="{{AdminOrdersGridSection.rowViewAction('1')}}" stepKey="clickOnViewAction"/> <!-- Cancel the Order --> - <actionGroup ref="cancelPendingOrder" stepKey="cancelPendingOrder"/> + <actionGroup ref="CancelPendingOrderActionGroup" stepKey="cancelPendingOrder"/> <!-- Assert Simple Product Quantity in backend after Cancelling the order --> <actionGroup ref="filterAndSelectProduct" stepKey="filterAndSelectTheProduct1"> @@ -102,7 +102,7 @@ <waitForPageLoad stepKey="waitForPageLoad6"/> <!-- Filter Order using orderId --> - <actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById1"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGridById1"> <argument name="orderId" value="$orderId"/> </actionGroup> <click selector="{{AdminOrdersGridSection.rowViewAction('1')}}" stepKey="clickOnViewAction1"/> @@ -122,4 +122,4 @@ <seeInField selector="{{AdminProductFormSection.productQuantity}}" userInput="10" stepKey="seeProductQuantityAfterReorder"/> <seeInField selector="{{AdminProductFormSection.productStockStatus}}" userInput="In Stock" stepKey="seeProductStockStatusAfterReorder"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithPurchaseOrderPaymentMethodTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithPurchaseOrderPaymentMethodTest.xml index d14987dd2e87b..c85a3fffc2c69 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithPurchaseOrderPaymentMethodTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithPurchaseOrderPaymentMethodTest.xml @@ -46,12 +46,12 @@ </after> <!--Create new customer order--> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderWithExistingCustomer"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderWithExistingCustomer"> <argument name="customer" value="$$simpleCustomer$$"/> </actionGroup> <!--Add Simple product to order--> - <actionGroup ref="addSimpleProductToOrder" stepKey="addSimpleProductToTheOrder"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSimpleProductToTheOrder"> <argument name="product" value="$$simpleProduct$$"/> </actionGroup> @@ -70,11 +70,11 @@ <click selector="{{AdminOrderFormActionSection.SubmitOrder}}" stepKey="submitOrder"/> <!--Verify order information--> - <actionGroup ref="verifyCreatedOrderInformation" stepKey="verifyCreatedOrderInformation"/> + <actionGroup ref="VerifyCreatedOrderInformationActionGroup" stepKey="verifyCreatedOrderInformation"/> <grabTextFrom selector="|Order # (\d+)|" stepKey="orderId"/> <!-- Cancel the Order --> - <actionGroup ref="cancelPendingOrder" stepKey="cancelPendingOrder"/> + <actionGroup ref="CancelPendingOrderActionGroup" stepKey="cancelPendingOrder"/> <!--Log in to Storefront as Customer --> <actionGroup ref="LoginToStorefrontActionGroup" stepKey="signUp"> @@ -86,4 +86,4 @@ <waitForPageLoad stepKey="waitForOrderDetailsToLoad"/> <seeElement selector="{{StorefrontCustomerOrderViewSection.orderStatusInGrid('$orderId', 'Canceled')}}" stepKey="seeOrderStatusInGrid"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithZeroSubtotalCheckoutTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithZeroSubtotalCheckoutTest.xml index f8c5b46dc6ff9..a8014466c5773 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithZeroSubtotalCheckoutTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithZeroSubtotalCheckoutTest.xml @@ -49,12 +49,12 @@ </after> <!--Create new customer order--> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderWithExistingCustomer"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderWithExistingCustomer"> <argument name="customer" value="$$simpleCustomer$$"/> </actionGroup> <!--Add Simple product to order--> - <actionGroup ref="addSimpleProductToOrder" stepKey="addSimpleProductToTheOrder"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSimpleProductToTheOrder"> <argument name="product" value="$$simpleProduct$$"/> </actionGroup> @@ -65,11 +65,11 @@ <click selector="{{AdminOrderFormActionSection.SubmitOrder}}" stepKey="submitOrder"/> <!--Verify order information--> - <actionGroup ref="verifyCreatedOrderInformation" stepKey="verifyCreatedOrderInformation"/> + <actionGroup ref="VerifyCreatedOrderInformationActionGroup" stepKey="verifyCreatedOrderInformation"/> <grabTextFrom selector="|Order # (\d+)|" stepKey="orderId"/> <!-- Cancel the Order --> - <actionGroup ref="cancelPendingOrder" stepKey="cancelPendingOrder"/> + <actionGroup ref="CancelPendingOrderActionGroup" stepKey="cancelPendingOrder"/> <!--Log in to Storefront as Customer --> <actionGroup ref="LoginToStorefrontActionGroup" stepKey="signUp"> @@ -81,4 +81,4 @@ <waitForPageLoad stepKey="waitForOrderDetailsToLoad"/> <seeElement selector="{{StorefrontCustomerOrderViewSection.orderStatusInGrid('$orderId', 'Canceled')}}" stepKey="seeOrderStatusInGrid"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminChangeCustomerGroupInNewOrder.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminChangeCustomerGroupInNewOrder.xml index 315a097eb2323..e19002d5ecb4c 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminChangeCustomerGroupInNewOrder.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminChangeCustomerGroupInNewOrder.xml @@ -25,8 +25,8 @@ <after> <actionGroup ref="logout" stepKey="logout"/> </after> - - <actionGroup ref="navigateToNewOrderPageNewCustomer" stepKey="openNewOrder"/> + + <actionGroup ref="NavigateToNewOrderPageNewCustomerActionGroup" stepKey="openNewOrder"/> <selectOption selector="{{AdminOrderFormAccountSection.group}}" userInput="Retailer" stepKey="selectCustomerGroup"/> <waitForPageLoad stepKey="waitForPageLoad"/> <grabValueFrom selector="{{AdminOrderFormAccountSection.group}}" stepKey="grabGroupValue"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCheckingCreditMemoUpdateTotalsTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCheckingCreditMemoUpdateTotalsTest.xml index 8cd2b8ee60edd..251d29df43dd1 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCheckingCreditMemoUpdateTotalsTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCheckingCreditMemoUpdateTotalsTest.xml @@ -41,9 +41,9 @@ </actionGroup> <grabFromCurrentUrl regex="~/order_id/(\d+)/~" stepKey="grabOrderId"/> <!--Create invoice--> - <actionGroup ref="StartCreateInvoiceFromOrderPage" stepKey="startCreateInvoice"/> + <actionGroup ref="StartCreateInvoiceFromOrderPageActionGroup" stepKey="startCreateInvoice"/> <!--Submit invoice--> - <actionGroup ref="SubmitInvoice" stepKey="submitInvoice"/> + <actionGroup ref="SubmitInvoiceActionGroup" stepKey="submitInvoice"/> <!--Create Credit Memo--> <actionGroup ref="StartToCreateCreditMemoActionGroup" stepKey="startToCreateCreditMemo"> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCheckingDateAfterChangeInterfaceLocaleTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCheckingDateAfterChangeInterfaceLocaleTest.xml index add8f7d2ae2c3..ad3b6cf45d5bb 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCheckingDateAfterChangeInterfaceLocaleTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCheckingDateAfterChangeInterfaceLocaleTest.xml @@ -51,7 +51,7 @@ <grabTextFrom selector="{{AdminOrderDetailsInformationSection.orderId}}" stepKey="grabOrderId"/> <!--Filter orders grid by ID on Admin page--> - <actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGridById"> <argument name="orderId" value="{$grabOrderId}"/> </actionGroup> @@ -73,7 +73,7 @@ </actionGroup> <!--Filter orders grid by ID on Admin page after changing "Interface Locale"--> - <actionGroup ref="filterOrderGridById" stepKey="filterOrderGridByIdAfterSetFrenchLocale"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGridByIdAfterSetFrenchLocale"> <argument name="orderId" value="{$grabOrderId}"/> </actionGroup> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCorrectnessInvoicedItemInBundleProductTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCorrectnessInvoicedItemInBundleProductTest.xml index 4310d412d1c98..9fded54e73eb7 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCorrectnessInvoicedItemInBundleProductTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCorrectnessInvoicedItemInBundleProductTest.xml @@ -76,16 +76,16 @@ <!--Go to order page submit invoice--> <grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="grabOrderNumber"/> <amOnPage url="{{AdminOrdersPage.url}}" stepKey="onOrdersPage"/> - <actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGridById"> <argument name="orderId" value="$grabOrderNumber"/> </actionGroup> <click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/> <waitForPageLoad stepKey="waitForCreatedOrderPageOpened"/> - <actionGroup ref="goToInvoiceIntoOrder" stepKey="goToInvoiceIntoOrderPage"/> + <actionGroup ref="GoToInvoiceIntoOrderActionGroup" stepKey="goToInvoiceIntoOrderPage"/> <fillField selector="{{AdminInvoiceItemsSection.qtyToInvoiceColumn}}" userInput="5" stepKey="ChangeQtyToInvoice"/> <click selector="{{AdminInvoiceItemsSection.updateQty}}" stepKey="updateQunatity"/> <waitForPageLoad stepKey="waitPageToBeLoaded"/> - <actionGroup ref="SubmitInvoice" stepKey="submitInvoice"/> + <actionGroup ref="SubmitInvoiceActionGroup" stepKey="submitInvoice"/> <!--Verify invoiced items qty in ship tab--> <actionGroup ref="goToShipmentIntoOrder" stepKey="goToShipment"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoBankTransferPaymentTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoBankTransferPaymentTest.xml index 37a9b97fab064..4b582a09deacf 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoBankTransferPaymentTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoBankTransferPaymentTest.xml @@ -42,17 +42,17 @@ <actionGroup ref="logout" stepKey="logout"/> </after> <!-- Create Order --> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderPage"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderPage"> <argument name="customer" value="$createCustomer$"/> </actionGroup> - <actionGroup ref="addSimpleProductToOrder" stepKey="addSecondProduct"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSecondProduct"> <argument name="product" value="$createProduct$"/> </actionGroup> - <actionGroup ref="fillOrderCustomerInformation" stepKey="fillCustomerInfo"> + <actionGroup ref="FillOrderCustomerInformationActionGroup" stepKey="fillCustomerInfo"> <argument name="customer" value="$createCustomer$"/> <argument name="address" value="US_Address_TX"/> </actionGroup> - <actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRate"/> + <actionGroup ref="OrderSelectFlatRateShippingActionGroup" stepKey="selectFlatRate"/> <conditionalClick selector="{{AdminOrderFormPaymentSection.linkPaymentOptions}}" dependentSelector="{{AdminOrderFormPaymentSection.linkPaymentOptions}}" visible="true" stepKey="openMoneyOption"/> <waitForElementVisible selector="{{AdminOrderFormPaymentSection.paymentBlock}}" stepKey="waitForPaymentOptions"/> <checkOption selector="{{AdminOrderFormPaymentSection.checkBankTransfer}}" stepKey="checkBankTransfer"/> @@ -62,7 +62,7 @@ <see stepKey="seeSuccessMessageForOrder" userInput="You created the order."/> <!-- Create Invoice --> - <actionGroup ref="StartCreateInvoiceFromOrderPage" stepKey="startInvoice"/> + <actionGroup ref="StartCreateInvoiceFromOrderPageActionGroup" stepKey="startInvoice"/> <click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/> <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForMessageAppears"/> <see selector="{{AdminMessagesSection.success}}" userInput="The invoice has been created." stepKey="seeInvoiceCreateSuccess"/> @@ -70,7 +70,7 @@ <!-- Go to Sales > Orders > find out placed order and open --> <grabTextFrom selector="|Order # (\d+)|" stepKey="grabOrderId" /> <assertNotEmpty actual="$grabOrderId" stepKey="assertOrderIdIsNotEmpty" after="grabOrderId"/> - <actionGroup ref="OpenOrderById" stepKey="openOrder"> + <actionGroup ref="OpenOrderByIdActionGroup" stepKey="openOrder"> <argument name="orderId" value="{$grabOrderId}"/> </actionGroup> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoConfigurableProductTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoConfigurableProductTest.xml index 8a9369537f0a4..2a841b04bd647 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoConfigurableProductTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoConfigurableProductTest.xml @@ -100,28 +100,28 @@ <actionGroup ref="logout" stepKey="logout"/> </after> <!-- Create Order --> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderPage"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderPage"> <argument name="customer" value="$createCustomer$"/> </actionGroup> <!--Add configurable product to order--> - <actionGroup ref="addConfigurableProductToOrderFromAdmin" stepKey="addConfigurableProductToOrder"> + <actionGroup ref="AddConfigurableProductToOrderFromAdminActionGroup" stepKey="addConfigurableProductToOrder"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="attribute" value="$$createConfigProductAttribute$$"/> <argument name="option" value="$$getConfigAttributeOption1$$"/> </actionGroup> - <actionGroup ref="fillOrderCustomerInformation" stepKey="fillCustomerInfo"> + <actionGroup ref="FillOrderCustomerInformationActionGroup" stepKey="fillCustomerInfo"> <argument name="customer" value="$createCustomer$"/> <argument name="address" value="US_Address_TX"/> </actionGroup> - <actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRate"/> + <actionGroup ref="OrderSelectFlatRateShippingActionGroup" stepKey="selectFlatRate"/> <click selector="{{OrdersGridSection.submitOrder}}" stepKey="submitOrder"/> <waitForPageLoad stepKey="waitForSubmitOrderPage"/> <see stepKey="seeSuccessMessageForOrder" userInput="You created the order."/> <!-- Create Invoice --> - <actionGroup ref="StartCreateInvoiceFromOrderPage" stepKey="startInvoice"/> + <actionGroup ref="StartCreateInvoiceFromOrderPageActionGroup" stepKey="startInvoice"/> <click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/> <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForMessageAppears"/> <see selector="{{AdminMessagesSection.success}}" userInput="The invoice has been created." stepKey="seeInvoiceCreateSuccess"/> @@ -129,7 +129,7 @@ <!-- Go to Sales > Orders > find out placed order and open --> <grabTextFrom selector="|Order # (\d+)|" stepKey="grabOrderId" /> <assertNotEmpty actual="$grabOrderId" stepKey="assertOrderIdIsNotEmpty" after="grabOrderId"/> - <actionGroup ref="OpenOrderById" stepKey="openOrder"> + <actionGroup ref="OpenOrderByIdActionGroup" stepKey="openOrder"> <argument name="orderId" value="{$grabOrderId}"/> </actionGroup> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoPartialRefundTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoPartialRefundTest.xml index 418c0e72dc1fc..acc119b53c9dc 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoPartialRefundTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoPartialRefundTest.xml @@ -40,24 +40,24 @@ <actionGroup ref="logout" stepKey="logout"/> </after> <!-- Create Order --> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderPage"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderPage"> <argument name="customer" value="$createCustomer$"/> </actionGroup> - <actionGroup ref="addSimpleProductToOrder" stepKey="addSecondProduct"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSecondProduct"> <argument name="product" value="$createProduct$"/> <argument name="productQty" value="2"/> </actionGroup> - <actionGroup ref="fillOrderCustomerInformation" stepKey="fillCustomerInfo"> + <actionGroup ref="FillOrderCustomerInformationActionGroup" stepKey="fillCustomerInfo"> <argument name="customer" value="$createCustomer$"/> <argument name="address" value="US_Address_TX"/> </actionGroup> - <actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRate"/> + <actionGroup ref="OrderSelectFlatRateShippingActionGroup" stepKey="selectFlatRate"/> <click selector="{{OrdersGridSection.submitOrder}}" stepKey="submitOrder"/> <waitForPageLoad stepKey="waitForSubmitOrderPage"/> <see stepKey="seeSuccessMessageForOrder" userInput="You created the order."/> <!-- Create Invoice --> - <actionGroup ref="StartCreateInvoiceFromOrderPage" stepKey="startInvoice"/> + <actionGroup ref="StartCreateInvoiceFromOrderPageActionGroup" stepKey="startInvoice"/> <click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/> <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForMessageAppears"/> <see selector="{{AdminMessagesSection.success}}" userInput="The invoice has been created." stepKey="seeInvoiceCreateSuccess"/> @@ -65,7 +65,7 @@ <!-- Go to Sales > Orders > find out placed order and open --> <grabTextFrom selector="|Order # (\d+)|" stepKey="grabOrderId" /> <assertNotEmpty actual="$grabOrderId" stepKey="assertOrderIdIsNotEmpty" after="grabOrderId"/> - <actionGroup ref="OpenOrderById" stepKey="openOrder"> + <actionGroup ref="OpenOrderByIdActionGroup" stepKey="openOrder"> <argument name="orderId" value="{$grabOrderId}"/> </actionGroup> @@ -102,7 +102,7 @@ <see userInput="1" selector="{{AdminCreditMemoViewItemsSection.productQty}}" stepKey="seeQty"/> <!-- Go to order page --> - <actionGroup ref="OpenOrderById" stepKey="openOrderPage"> + <actionGroup ref="OpenOrderByIdActionGroup" stepKey="openOrderPage"> <argument name="orderId" value="{$grabOrderId}"/> </actionGroup> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoWithCashOnDeliveryTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoWithCashOnDeliveryTest.xml index c552f93e62a4a..452c54d188c57 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoWithCashOnDeliveryTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoWithCashOnDeliveryTest.xml @@ -43,17 +43,17 @@ </after> <!-- Create Order --> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderPage"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderPage"> <argument name="customer" value="$createCustomer$"/> </actionGroup> - <actionGroup ref="addSimpleProductToOrder" stepKey="addSecondProduct"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSecondProduct"> <argument name="product" value="$createProduct$"/> </actionGroup> - <actionGroup ref="fillOrderCustomerInformation" stepKey="fillCustomerInfo"> + <actionGroup ref="FillOrderCustomerInformationActionGroup" stepKey="fillCustomerInfo"> <argument name="customer" value="$createCustomer$"/> <argument name="address" value="US_Address_TX"/> </actionGroup> - <actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRate"/> + <actionGroup ref="OrderSelectFlatRateShippingActionGroup" stepKey="selectFlatRate"/> <conditionalClick selector="{{AdminOrderFormPaymentSection.linkPaymentOptions}}" dependentSelector="{{AdminOrderFormPaymentSection.linkPaymentOptions}}" visible="true" stepKey="openMoneyOption"/> <waitForElementVisible selector="{{AdminOrderFormPaymentSection.paymentBlock}}" stepKey="waitForPaymentOptions"/> <checkOption selector="{{AdminOrderFormPaymentSection.checkCashOnDelivery}}" stepKey="checkCashOnDelivery"/> @@ -63,7 +63,7 @@ <see stepKey="seeSuccessMessageForOrder" userInput="You created the order."/> <!-- Create Invoice --> - <actionGroup ref="StartCreateInvoiceFromOrderPage" stepKey="startInvoice"/> + <actionGroup ref="StartCreateInvoiceFromOrderPageActionGroup" stepKey="startInvoice"/> <click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/> <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForMessageAppears"/> <see selector="{{AdminMessagesSection.success}}" userInput="The invoice has been created." stepKey="seeInvoiceCreateSuccess"/> @@ -71,7 +71,7 @@ <!-- Go to Sales > Orders > find out placed order and open --> <grabTextFrom selector="|Order # (\d+)|" stepKey="grabOrderId" /> <assertNotEmpty actual="$grabOrderId" stepKey="assertOrderIdIsNotEmpty" after="grabOrderId"/> - <actionGroup ref="OpenOrderById" stepKey="openOrder"> + <actionGroup ref="OpenOrderByIdActionGroup" stepKey="openOrder"> <argument name="orderId" value="{$grabOrderId}"/> </actionGroup> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoWithPurchaseOrderTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoWithPurchaseOrderTest.xml index 57d9222d85096..231ff78d7d8fb 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoWithPurchaseOrderTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoWithPurchaseOrderTest.xml @@ -43,17 +43,17 @@ </after> <!-- Create Order --> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderPage"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderPage"> <argument name="customer" value="$createCustomer$"/> </actionGroup> - <actionGroup ref="addSimpleProductToOrder" stepKey="addSecondProduct"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSecondProduct"> <argument name="product" value="$createProduct$"/> </actionGroup> - <actionGroup ref="fillOrderCustomerInformation" stepKey="fillCustomerInfo"> + <actionGroup ref="FillOrderCustomerInformationActionGroup" stepKey="fillCustomerInfo"> <argument name="customer" value="$createCustomer$"/> <argument name="address" value="US_Address_TX"/> </actionGroup> - <actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRate"/> + <actionGroup ref="OrderSelectFlatRateShippingActionGroup" stepKey="selectFlatRate"/> <conditionalClick selector="{{AdminOrderFormPaymentSection.linkPaymentOptions}}" dependentSelector="{{AdminOrderFormPaymentSection.linkPaymentOptions}}" visible="true" stepKey="openMoneyOption"/> <waitForElementVisible selector="{{AdminOrderFormPaymentSection.paymentBlock}}" stepKey="waitForPaymentOptions"/> <checkOption selector="{{AdminOrderFormPaymentSection.checkPurchaseOrder}}" stepKey="checkPurchaseOrder"/> @@ -66,7 +66,7 @@ <see stepKey="seeSuccessMessageForOrder" selector="{{AdminIndexManagementSection.successMessage}}" userInput="You created the order."/> <!-- Create Invoice --> - <actionGroup ref="StartCreateInvoiceFromOrderPage" stepKey="startInvoice"/> + <actionGroup ref="StartCreateInvoiceFromOrderPageActionGroup" stepKey="startInvoice"/> <click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/> <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForMessageAppears"/> <see selector="{{AdminMessagesSection.success}}" userInput="The invoice has been created." stepKey="seeInvoiceCreateSuccess"/> @@ -74,7 +74,7 @@ <!-- Go to Sales > Orders > find out placed order and open --> <grabTextFrom selector="|Order # (\d+)|" stepKey="grabOrderId" /> <assertNotEmpty actual="$grabOrderId" stepKey="assertOrderIdIsNotEmpty" after="grabOrderId"/> - <actionGroup ref="OpenOrderById" stepKey="openOrder"> + <actionGroup ref="OpenOrderByIdActionGroup" stepKey="openOrder"> <argument name="orderId" value="{$grabOrderId}"/> </actionGroup> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderAddProductCheckboxTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderAddProductCheckboxTest.xml index bd13f7c847c34..8fe49558cf091 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderAddProductCheckboxTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderAddProductCheckboxTest.xml @@ -30,7 +30,7 @@ </before> <!-- Initiate create new order --> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderWithExistingCustomer"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderWithExistingCustomer"> <argument name="customer" value="$$createSimpleCustomer$$"/> </actionGroup> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderAndCheckTheReorderTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderAndCheckTheReorderTest.xml index 80697fd57736a..338765d650d13 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderAndCheckTheReorderTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderAndCheckTheReorderTest.xml @@ -28,19 +28,19 @@ </createData> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderWithExistingCustomer"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderWithExistingCustomer"> <argument name="customer" value="$$simpleCustomer$$"/> </actionGroup> - <actionGroup ref="addSimpleProductToOrder" stepKey="addSimpleProductToOrder"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSimpleProductToOrder"> <argument name="product" value="$$simpleProduct$$"/> <argument name="productQty" value="{{SimpleProduct_25.quantity}}"/> </actionGroup> <actionGroup ref="SelectCashOnDeliveryPaymentMethodActionGroup" stepKey="selectPaymentMethod"/> - <actionGroup ref="orderSelectFlatRateShipping" stepKey="orderSelectFlatRateShippingMethod"/> + <actionGroup ref="OrderSelectFlatRateShippingActionGroup" stepKey="orderSelectFlatRateShippingMethod"/> <actionGroup ref="AdminSubmitOrderActionGroup" stepKey="submitOrder"/> - <actionGroup ref="verifyCreatedOrderInformation" stepKey="verifyCreatedOrderInformation"/> + <actionGroup ref="VerifyCreatedOrderInformationActionGroup" stepKey="verifyCreatedOrderInformation"/> <grabTextFrom selector="|Order # (\d+)|" stepKey="getOrderId"/> - <actionGroup ref="OpenOrderById" stepKey="openOrder"> + <actionGroup ref="OpenOrderByIdActionGroup" stepKey="openOrder"> <argument name="orderId" value="$getOrderId"/> </actionGroup> <click selector="{{AdminOrderDetailsMainActionsSection.ship}}" stepKey="clickShipAction"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderForCustomerWithTwoAddressesTaxableAndNonTaxableTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderForCustomerWithTwoAddressesTaxableAndNonTaxableTest.xml index d6bf0eec301db..1c35a9e900a8a 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderForCustomerWithTwoAddressesTaxableAndNonTaxableTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderForCustomerWithTwoAddressesTaxableAndNonTaxableTest.xml @@ -36,23 +36,23 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <!--Step 1: Create new order for customer--> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderWithExistingCustomer"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderWithExistingCustomer"> <argument name="customer" value="$$simpleCustomer$$"/> </actionGroup> <!--Step 2: Add product1 to the order--> - <actionGroup ref="addSimpleProductToOrder" stepKey="addSimpleProductToOrder"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSimpleProductToOrder"> <argument name="product" value="$$product1$$"/> </actionGroup> <!--Step 2: Select taxable address as billing address--> <selectOption selector="{{AdminOrderFormBillingAddressSection.selectAddress}}" userInput="{{US_Address_CA.state}}" stepKey="selectTaxableAddress" /> <!--Step 3: Select FlatRate shipping method--> - <actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRateShippingMethod"/> + <actionGroup ref="OrderSelectFlatRateShippingActionGroup" stepKey="selectFlatRateShippingMethod"/> <!--Step 4: Verify that tax is applied to the order--> <seeElement selector="{{AdminOrderFormTotalSection.total('Tax')}}" stepKey="seeTax" /> <!--Step 5: Select non taxable address as billing address--> <selectOption selector="{{AdminOrderFormBillingAddressSection.selectAddress}}" userInput="{{US_Address_TX.state}}" stepKey="selectNonTaxableAddress" /> <!--Step 6: Change shipping method to Free--> - <actionGroup ref="changeShippingMethod" stepKey="changeShippingMethod"> + <actionGroup ref="ChangeShippingMethodActionGroup" stepKey="changeShippingMethod"> <argument name="shippingMethod" value="freeshipping_freeshipping"/> </actionGroup> <!--Step 7: Verify that tax is not applied to the order--> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithBundleProductTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithBundleProductTest.xml index d087b291de87c..1749fcd6c218e 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithBundleProductTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithBundleProductTest.xml @@ -80,25 +80,25 @@ </before> <!--Create new customer order--> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderWithExistingCustomer"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderWithExistingCustomer"> <argument name="customer" value="$$simpleCustomer$$"/> </actionGroup> <!--Add bundle product to order and check product price in grid--> - <actionGroup ref="addBundleProductToOrderAndCheckPriceInGrid" stepKey="addBundleProductToOrder"> + <actionGroup ref="AddBundleProductToOrderAndCheckPriceInGridActionGroup" stepKey="addBundleProductToOrder"> <argument name="product" value="$$product$$"/> <argument name="quantity" value="1"/> <argument name="price" value="$738.00"/> </actionGroup> <!--Select FlatRate shipping method--> - <actionGroup ref="orderSelectFlatRateShipping" stepKey="orderSelectFlatRateShippingMethod"/> + <actionGroup ref="OrderSelectFlatRateShippingActionGroup" stepKey="orderSelectFlatRateShippingMethod"/> <!--Submit order--> <click selector="{{AdminOrderFormActionSection.SubmitOrder}}" stepKey="submitOrder"/> <!--Verify order information--> - <actionGroup ref="verifyCreatedOrderInformation" stepKey="verifyCreatedOrderInformation"/> + <actionGroup ref="VerifyCreatedOrderInformationActionGroup" stepKey="verifyCreatedOrderInformation"/> <after> <actionGroup ref="logout" stepKey="logout"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithMinimumAmountEnabledTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithMinimumAmountEnabledTest.xml index 40b26a6b46045..bfaf31007b10a 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithMinimumAmountEnabledTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithMinimumAmountEnabledTest.xml @@ -37,10 +37,10 @@ <!--Admin creates order--> <comment userInput="Admin creates order" stepKey="adminCreateOrder"/> - <actionGroup ref="navigateToNewOrderPageNewCustomerSingleStore" stepKey="navigateToNewOrderPage"/> + <actionGroup ref="NavigateToNewOrderPageNewCustomerSingleStoreActionGroup" stepKey="navigateToNewOrderPage"/> <conditionalClick selector="{{AdminOrderFormStoreSelectorSection.defaultStoreViewButton}}" dependentSelector="{{AdminOrderFormStoreSelectorSection.storeSelectorContainer}}" visible="true" stepKey="selectFirstStoreViewIfAppears"/> <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskDisappearedAfterStoreSelected"/> - <actionGroup ref="addSimpleProductToOrder" stepKey="addSimpleProductToOrder"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSimpleProductToOrder"> <argument name="product" value="SimpleProduct"/> </actionGroup> @@ -49,15 +49,15 @@ <fillField selector="{{AdminOrderFormAccountSection.email}}" userInput="{{Simple_US_Customer.email}}" stepKey="fillEmail"/> <!--Fill customer address information--> - <actionGroup ref="fillOrderCustomerInformation" stepKey="fillCustomerAddress"> + <actionGroup ref="FillOrderCustomerInformationActionGroup" stepKey="fillCustomerAddress"> <argument name="customer" value="Simple_US_Customer"/> <argument name="address" value="US_Address_TX"/> </actionGroup> - <actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRateShipping"/> + <actionGroup ref="OrderSelectFlatRateShippingActionGroup" stepKey="selectFlatRateShipping"/> <!-- Checkout select Check/Money Order payment --> - <actionGroup ref="SelectCheckMoneyPaymentMethod" stepKey="selectCheckMoneyPayment"/> + <actionGroup ref="SelectCheckMoneyPaymentMethodActionGroup" stepKey="selectCheckMoneyPayment"/> <!--Verify totals on Order page--> <see selector="{{AdminOrderFormTotalSection.total('Subtotal')}}" userInput="${{AdminOrderSimpleProduct.subtotal}}" stepKey="seeOrderSubTotal"/> @@ -72,12 +72,12 @@ <see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="Pending" stepKey="seeOrderPendingStatus"/> <grabTextFrom selector="|Order # (\d+)|" stepKey="orderId"/> <assertNotEmpty actual="$orderId" stepKey="assertOrderIdIsNotEmpty"/> - <actionGroup ref="verifyBasicOrderInformation" stepKey="verifyOrderInformation"> + <actionGroup ref="VerifyBasicOrderInformationActionGroup" stepKey="verifyOrderInformation"> <argument name="customer" value="Simple_US_Customer"/> <argument name="shippingAddress" value="US_Address_TX"/> <argument name="billingAddress" value="US_Address_TX"/> </actionGroup> - <actionGroup ref="seeProductInItemsOrdered" stepKey="seeSimpleProductInItemsOrdered"> + <actionGroup ref="SeeProductInItemsOrderedActionGroup" stepKey="seeSimpleProductInItemsOrdered"> <argument name="product" value="SimpleProduct"/> </actionGroup> </test> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithSelectedShoppingCartItemsTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithSelectedShoppingCartItemsTest.xml index 513fcd7fd2699..58a680ea61c87 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithSelectedShoppingCartItemsTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithSelectedShoppingCartItemsTest.xml @@ -53,12 +53,12 @@ </actionGroup> <!--Step 3: Create new customer order--> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderWithExistingCustomer"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderWithExistingCustomer"> <argument name="customer" value="$$simpleCustomer$$"/> </actionGroup> <!--Step 4: Add product2 to the order--> - <actionGroup ref="addSimpleProductToOrder" stepKey="addSimpleProductToOrder"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSimpleProductToOrder"> <argument name="product" value="$$product2$$"/> </actionGroup> @@ -66,21 +66,21 @@ <click selector="{{AdminOrderFormShoppingCartSection.addProduct($$product1.name$$)}}" stepKey="selectProduct1InTheShoppingCart"/> <!--Step 6: Select FlatRate shipping method--> - <actionGroup ref="orderSelectFlatRateShipping" stepKey="orderSelectFlatRateShippingMethod"/> + <actionGroup ref="OrderSelectFlatRateShippingActionGroup" stepKey="orderSelectFlatRateShippingMethod"/> <!--Step 7: Submit order--> <actionGroup ref="AdminSubmitOrderActionGroup" stepKey="submitOrder"/> <!--Step 8: Verify order information--> - <actionGroup ref="verifyCreatedOrderInformation" stepKey="verifyCreatedOrderInformation"/> + <actionGroup ref="VerifyCreatedOrderInformationActionGroup" stepKey="verifyCreatedOrderInformation"/> <!--Step 9: Check that product 2 is in the order items list --> - <actionGroup ref="seeProductInItemsOrdered" stepKey="seeProduct2InItemsOrdered"> + <actionGroup ref="SeeProductInItemsOrderedActionGroup" stepKey="seeProduct2InItemsOrdered"> <argument name="product" value="$$product2$$"/> </actionGroup> <!--Step 10: Check that product 1 is not in the order items list --> - <actionGroup ref="dontSeeProductInItemsOrdered" stepKey="dontSeeProduct1InItemsOrdered"> + <actionGroup ref="DontSeeProductInItemsOrderedActionGroup" stepKey="dontSeeProduct1InItemsOrdered"> <argument name="product" value="$$product1$$"/> </actionGroup> <after> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithSimpleProductTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithSimpleProductTest.xml index 85567374e36e4..76f916d55ee92 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithSimpleProductTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithSimpleProductTest.xml @@ -28,19 +28,19 @@ </createData> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderWithExistingCustomer"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderWithExistingCustomer"> <argument name="customer" value="$$simpleCustomer$$"/> </actionGroup> - <actionGroup ref="addSimpleProductToOrder" stepKey="addSimpleProductToOrder"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSimpleProductToOrder"> <argument name="product" value="$$simpleProduct$$"/> <argument name="productQty" value="{{SimpleProduct_25.quantity}}"/> </actionGroup> <actionGroup ref="SelectCashOnDeliveryPaymentMethodActionGroup" stepKey="selectPaymentMethod"/> - <actionGroup ref="orderSelectFlatRateShipping" stepKey="orderSelectFlatRateShippingMethod"/> + <actionGroup ref="OrderSelectFlatRateShippingActionGroup" stepKey="orderSelectFlatRateShippingMethod"/> <actionGroup ref="AdminSubmitOrderActionGroup" stepKey="submitOrder"/> - <actionGroup ref="verifyCreatedOrderInformation" stepKey="verifyCreatedOrderInformation"/> + <actionGroup ref="VerifyCreatedOrderInformationActionGroup" stepKey="verifyCreatedOrderInformation"/> <grabTextFrom selector="|Order # (\d+)|" stepKey="getOrderId"/> - <actionGroup ref="OpenOrderById" stepKey="openOrder"> + <actionGroup ref="OpenOrderByIdActionGroup" stepKey="openOrder"> <argument name="orderId" value="$getOrderId"/> </actionGroup> <click selector="{{AdminOrderDetailsMainActionsSection.ship}}" stepKey="clickShipAction"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminFreeShippingNotAvailableIfMinimumOrderAmountNotMatchOrderTotalTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminFreeShippingNotAvailableIfMinimumOrderAmountNotMatchOrderTotalTest.xml index 8bfcaf67c4332..9ff6f3bdac985 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminFreeShippingNotAvailableIfMinimumOrderAmountNotMatchOrderTotalTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminFreeShippingNotAvailableIfMinimumOrderAmountNotMatchOrderTotalTest.xml @@ -41,11 +41,11 @@ <magentoCLI command="cache:flush" stepKey="flushCache2"/> </after> <!--Create new order with existing customer--> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="goToCreateOrderPage"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="goToCreateOrderPage"> <argument name="customer" value="$$createCustomer$$"/> </actionGroup> <!--Add product to order--> - <actionGroup ref="addSimpleProductToOrder" stepKey="addProductToOrder"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addProductToOrder"> <argument name="product" value="$$createProduct$$"/> </actionGroup> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminHoldCreatedOrderTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminHoldCreatedOrderTest.xml index 9e8949c9ba600..5dc5dbf3ab79d 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminHoldCreatedOrderTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminHoldCreatedOrderTest.xml @@ -44,17 +44,17 @@ </after> <!--Create new customer order--> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderWithExistingCustomer"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderWithExistingCustomer"> <argument name="customer" value="$$simpleCustomer$$"/> </actionGroup> <!--Add Simple product to order--> - <actionGroup ref="addSimpleProductToOrder" stepKey="addSimpleProductToTheOrder"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSimpleProductToTheOrder"> <argument name="product" value="$$simpleProduct$$"/> </actionGroup> <!--Add second product to order--> - <actionGroup ref="addSimpleProductToOrder" stepKey="addSecondProductToTheOrder"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSecondProductToTheOrder"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> @@ -65,7 +65,7 @@ <click selector="{{AdminOrderFormActionSection.SubmitOrder}}" stepKey="submitOrder"/> <!-- Verify order information --> - <actionGroup ref="verifyCreatedOrderInformation" stepKey="verifyCreatedOrderInformation"/> + <actionGroup ref="VerifyCreatedOrderInformationActionGroup" stepKey="verifyCreatedOrderInformation"/> <grabTextFrom selector="|Order # (\d+)|" stepKey="orderId"/> <!-- Hold the Order --> @@ -93,4 +93,4 @@ <waitForPageLoad stepKey="waitForOrderDetailsToLoad"/> <seeElement selector="{{StorefrontCustomerOrderViewSection.orderStatusInGrid('$orderId', 'On Hold')}}" stepKey="seeOrderStatusInGrid"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminProductInTheShoppingCartCouldBeReachedByAdminDuringOrderCreationWithMultiWebsiteConfigTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminProductInTheShoppingCartCouldBeReachedByAdminDuringOrderCreationWithMultiWebsiteConfigTest.xml index b40e9d041a10e..0646fdc5e5090 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminProductInTheShoppingCartCouldBeReachedByAdminDuringOrderCreationWithMultiWebsiteConfigTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminProductInTheShoppingCartCouldBeReachedByAdminDuringOrderCreationWithMultiWebsiteConfigTest.xml @@ -74,7 +74,7 @@ <actionGroup ref="StorefrontAddToTheCartActionGroup" stepKey="addProductToCart"/> <!--Create new order for existing Customer And Store--> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="createNewOrder"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="createNewOrder"> <argument name="customer" value="Simple_US_Customer"/> <argument name="storeView" value="customStore"/> </actionGroup> @@ -90,16 +90,16 @@ </actionGroup> <!--Fill customer address information--> - <actionGroup ref="fillOrderCustomerInformation" stepKey="fillCustomerAddress"> + <actionGroup ref="FillOrderCustomerInformationActionGroup" stepKey="fillCustomerAddress"> <argument name="customer" value="Simple_US_Customer"/> <argument name="address" value="US_Address_TX"/> </actionGroup> <!--Select shipping method--> - <actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRateShipping"/> + <actionGroup ref="OrderSelectFlatRateShippingActionGroup" stepKey="selectFlatRateShipping"/> <!--Checkout select Check/Money Order payment--> - <actionGroup ref="SelectCheckMoneyPaymentMethod" stepKey="selectCheckMoneyPayment"/> + <actionGroup ref="SelectCheckMoneyPaymentMethodActionGroup" stepKey="selectCheckMoneyPayment"/> <!--Submit Order and verify information--> <actionGroup ref="AdminSubmitOrderActionGroup" stepKey="submitOrder"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml index 587b23e857c0c..fe29c1b63aa33 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml @@ -56,7 +56,7 @@ <!-- Login as admin --> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <!--Open order by Id--> - <actionGroup ref="OpenOrderById" stepKey="openOrderById"> + <actionGroup ref="OpenOrderByIdActionGroup" stepKey="openOrderById"> <argument name="orderId" value="$createGuestCart.return$"/> </actionGroup> <!--Reorder--> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminSaveInAddressBookCheckboxStateTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminSaveInAddressBookCheckboxStateTest.xml index 650152a191d16..f2341278becba 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminSaveInAddressBookCheckboxStateTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminSaveInAddressBookCheckboxStateTest.xml @@ -39,12 +39,12 @@ </after> <!-- Create new order and choose an existing customer --> <comment userInput="Create new order and choose an existing customer" stepKey="createOrderAndAddCustomer"/> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderPage"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderPage"> <argument name="customer" value="$$createCustomer$$"/> </actionGroup> <!-- Add simple product to order --> <comment userInput="Add simple product to order" stepKey="addSimpleProdToOrder"/> - <actionGroup ref="addSimpleProductToOrder" stepKey="addSimpleProductToOrder"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSimpleProductToOrder"> <argument name="product" value="$$createSimpleProduct$$"/> </actionGroup> <!-- Just in case uncheck and check 'Same as Billing Address checkbox' --> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitConfigurableProductOrderTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitConfigurableProductOrderTest.xml index 63607e59c41b2..65bba7512e228 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitConfigurableProductOrderTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitConfigurableProductOrderTest.xml @@ -91,35 +91,35 @@ </before> <!--Create new customer order--> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderWithExistingCustomer"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderWithExistingCustomer"> <argument name="customer" value="$$simpleCustomer$$"/> </actionGroup> <!--Add configurable product to order--> - <actionGroup ref="addConfigurableProductToOrderFromAdmin" stepKey="addConfigurableProductToOrder"> + <actionGroup ref="AddConfigurableProductToOrderFromAdminActionGroup" stepKey="addConfigurableProductToOrder"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="attribute" value="$$createConfigProductAttribute$$"/> <argument name="option" value="$$getConfigAttributeOption1$$"/> </actionGroup> <!--Configure ordered configurable product--> - <actionGroup ref="configureOrderedConfigurableProduct" stepKey="configureOrderedConfigurableProduct"> + <actionGroup ref="ConfigureOrderedConfigurableProductActionGroup" stepKey="configureOrderedConfigurableProduct"> <argument name="attribute" value="$$createConfigProductAttribute$$"/> <argument name="option" value="$$getConfigAttributeOption2$$"/> <argument name="quantity" value="2"/> </actionGroup> <!--Select FlatRate shipping method--> - <actionGroup ref="orderSelectFlatRateShipping" stepKey="orderSelectFlatRateShippingMethod"/> + <actionGroup ref="OrderSelectFlatRateShippingActionGroup" stepKey="orderSelectFlatRateShippingMethod"/> <!-- Checkout select Check/Money Order payment --> - <actionGroup ref="SelectCheckMoneyPaymentMethod" stepKey="selectCheckMoneyPayment"/> + <actionGroup ref="SelectCheckMoneyPaymentMethodActionGroup" stepKey="selectCheckMoneyPayment"/> <!--Submit order--> <click selector="{{AdminOrderFormActionSection.SubmitOrder}}" stepKey="submitOrder"/> <!--Verify order information--> - <actionGroup ref="verifyCreatedOrderInformation" stepKey="verifyCreatedOrderInformation"/> + <actionGroup ref="VerifyCreatedOrderInformationActionGroup" stepKey="verifyCreatedOrderInformation"/> <after> <actionGroup ref="logout" stepKey="logout"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitsOrderPaymentMethodValidationTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitsOrderPaymentMethodValidationTest.xml index 255a7a91f9b10..b2d424ca5d7d3 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitsOrderPaymentMethodValidationTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitsOrderPaymentMethodValidationTest.xml @@ -41,10 +41,10 @@ <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Create New Order" stepKey="seeNewOrderPageTitle"/> <!--Check if order can be submitted without the required fields--> - <actionGroup ref="addSimpleProductToOrder" stepKey="addSimpleProductToOrder" after="seeNewOrderPageTitle"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSimpleProductToOrder" after="seeNewOrderPageTitle"> <argument name="product" value="_defaultProduct"/> </actionGroup> - <actionGroup ref="checkRequiredFieldsNewOrderForm" stepKey="checkRequiredFieldsNewOrder" after="addSimpleProductToOrder"/> + <actionGroup ref="CheckRequiredFieldsNewOrderFormActionGroup" stepKey="checkRequiredFieldsNewOrder" after="addSimpleProductToOrder"/> <see selector="{{AdminOrderFormPaymentSection.paymentError}}" userInput="Please select one of the options." stepKey="seePaymentMethodRequired" after="checkRequiredFieldsNewOrder"/> <scrollToTopOfPage stepKey="scrollToTopOfOrderFormPage" after="seePaymentMethodRequired"/> @@ -53,7 +53,7 @@ <fillField selector="{{AdminOrderFormAccountSection.email}}" userInput="{{Simple_US_Customer.email}}" stepKey="fillCustomerEmail" after="selectCustomerGroup"/> <!--Fill customer address information--> - <actionGroup ref="fillOrderCustomerInformation" stepKey="fillCustomerAddress" after="fillCustomerEmail"> + <actionGroup ref="FillOrderCustomerInformationActionGroup" stepKey="fillCustomerAddress" after="fillCustomerEmail"> <argument name="customer" value="Simple_US_Customer"/> <argument name="address" value="US_Address_TX"/> </actionGroup> @@ -61,7 +61,7 @@ <!-- Select payment and shipping --> <waitForElementVisible selector="{{AdminOrderFormPaymentSection.checkMoneyOption}}" stepKey="waitForPaymentOptions"/> <selectOption selector="{{AdminOrderFormPaymentSection.checkMoneyOption}}" userInput="checkmo" stepKey="checkPaymentOption"/> - <actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRateShipping" after="fillCustomerAddress"/> + <actionGroup ref="OrderSelectFlatRateShippingActionGroup" stepKey="selectFlatRateShipping" after="fillCustomerAddress"/> <!--Verify totals on Order page--> <see selector="{{AdminOrderFormTotalSection.total('Subtotal')}}" userInput="${{AdminOrderSimpleProduct.subtotal}}" stepKey="seeOrderSubTotal" after="selectFlatRateShipping"/> @@ -74,4 +74,4 @@ <seeInCurrentUrl url="{{AdminOrderDetailsPage.url}}" stepKey="seeViewOrderPage" after="clickSubmitOrder"/> <see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="You created the order." stepKey="seeSuccessMessage" after="seeViewOrderPage"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitsOrderWithAndWithoutEmailTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitsOrderWithAndWithoutEmailTest.xml index 01021ad745f70..f2d0fffe9b4cf 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitsOrderWithAndWithoutEmailTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitsOrderWithAndWithoutEmailTest.xml @@ -31,7 +31,7 @@ <!--Create order via Admin--> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <comment userInput="Admin creates order" stepKey="adminCreateOrderComment"/> - <!--<actionGroup ref="navigateToNewOrderPageNewCustomer" stepKey="navigateToNewOrderPage"/>--> + <!--<actionGroup ref="NavigateToNewOrderPageNewCustomerActionGroup" stepKey="navigateToNewOrderPage"/>--> <amOnPage url="{{AdminOrdersPage.url}}" stepKey="navigateToOrderIndexPage"/> <waitForPageLoad stepKey="waitForIndexPageLoad"/> <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Orders" stepKey="seeIndexPageTitle"/> @@ -40,9 +40,9 @@ <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Create New Order" stepKey="seeNewOrderPageTitle"/> <!--Check if order can be submitted without the required fields including email address--> - <actionGroup ref="checkRequiredFieldsNewOrderForm" stepKey="checkRequiredFieldsNewOrder" after="seeNewOrderPageTitle"/> + <actionGroup ref="CheckRequiredFieldsNewOrderFormActionGroup" stepKey="checkRequiredFieldsNewOrder" after="seeNewOrderPageTitle"/> <scrollToTopOfPage stepKey="scrollToTopOfOrderFormPage" after="checkRequiredFieldsNewOrder"/> - <actionGroup ref="addSimpleProductToOrder" stepKey="addSimpleProductToOrder" after="scrollToTopOfOrderFormPage"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSimpleProductToOrder" after="scrollToTopOfOrderFormPage"> <argument name="product" value="_defaultProduct"/> </actionGroup> @@ -51,15 +51,15 @@ <fillField selector="{{AdminOrderFormAccountSection.email}}" userInput="{{Simple_US_Customer.email}}" stepKey="fillCustomerEmail" after="selectCustomerGroup"/> <!--Fill customer address information--> - <actionGroup ref="fillOrderCustomerInformation" stepKey="fillCustomerAddress" after="fillCustomerEmail"> + <actionGroup ref="FillOrderCustomerInformationActionGroup" stepKey="fillCustomerAddress" after="fillCustomerEmail"> <argument name="customer" value="Simple_US_Customer"/> <argument name="address" value="US_Address_TX"/> </actionGroup> <!-- Select shipping --> - <actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRateShipping" after="fillCustomerAddress"/> + <actionGroup ref="OrderSelectFlatRateShippingActionGroup" stepKey="selectFlatRateShipping" after="fillCustomerAddress"/> <!-- Checkout select Check/Money Order payment --> - <actionGroup ref="SelectCheckMoneyPaymentMethod" stepKey="selectCheckMoneyPayment"/> + <actionGroup ref="SelectCheckMoneyPaymentMethodActionGroup" stepKey="selectCheckMoneyPayment"/> <!--Verify totals on Order page--> <see selector="{{AdminOrderFormTotalSection.total('Subtotal')}}" userInput="${{AdminOrderSimpleProduct.subtotal}}" stepKey="seeOrderSubTotal" after="selectFlatRateShipping"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitsOrderWithAndWithoutFieldsValidationTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitsOrderWithAndWithoutFieldsValidationTest.xml index 9268e9e728658..4dbd80a351ee7 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitsOrderWithAndWithoutFieldsValidationTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitsOrderWithAndWithoutFieldsValidationTest.xml @@ -30,7 +30,7 @@ <!--Create order via Admin--> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <comment userInput="Admin creates order" stepKey="adminCreateOrderComment"/> - <!--<actionGroup ref="navigateToNewOrderPageNewCustomer" stepKey="navigateToNewOrderPage"/>--> + <!--<actionGroup ref="NavigateToNewOrderPageNewCustomerActionGroup" stepKey="navigateToNewOrderPage"/>--> <amOnPage url="{{AdminOrdersPage.url}}" stepKey="navigateToOrderIndexPage"/> <waitForPageLoad stepKey="waitForIndexPageLoad"/> <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Orders" stepKey="seeIndexPageTitle"/> @@ -39,9 +39,9 @@ <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Create New Order" stepKey="seeNewOrderPageTitle"/> <!--Check if order can be submitted without the required fields including email address--> - <actionGroup ref="checkRequiredFieldsNewOrderForm" stepKey="checkRequiredFieldsNewOrder" after="seeNewOrderPageTitle"/> + <actionGroup ref="CheckRequiredFieldsNewOrderFormActionGroup" stepKey="checkRequiredFieldsNewOrder" after="seeNewOrderPageTitle"/> <scrollToTopOfPage stepKey="scrollToTopOfOrderFormPage" after="checkRequiredFieldsNewOrder"/> - <actionGroup ref="addSimpleProductToOrder" stepKey="addSimpleProductToOrder" after="scrollToTopOfOrderFormPage"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSimpleProductToOrder" after="scrollToTopOfOrderFormPage"> <argument name="product" value="_defaultProduct"/> </actionGroup> @@ -50,12 +50,12 @@ <fillField selector="{{AdminOrderFormAccountSection.email}}" userInput="{{Simple_US_Customer.email}}" stepKey="fillCustomerEmail" after="selectCustomerGroup"/> <!--Fill wrong customer address information--> - <actionGroup ref="fillOrderCustomerInformation" stepKey="fillWrongCustomerAddress" after="fillCustomerEmail"> + <actionGroup ref="FillOrderCustomerInformationActionGroup" stepKey="fillWrongCustomerAddress" after="fillCustomerEmail"> <argument name="customer" value="Simple_US_Customer_Incorrect_Name"/> <argument name="address" value="US_Address_TX"/> </actionGroup> <!-- Select shipping --> - <actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRateShipping" + <actionGroup ref="OrderSelectFlatRateShippingActionGroup" stepKey="selectFlatRateShipping" after="fillWrongCustomerAddress"/> <!--Verify totals on Order page--> @@ -72,7 +72,7 @@ after="clickSubmitOrderWrong"/> <!--Fill correct customer address information--> - <actionGroup ref="fillOrderCustomerInformation" stepKey="fillCustomerAddress" after="firstNameError"> + <actionGroup ref="FillOrderCustomerInformationActionGroup" stepKey="fillCustomerAddress" after="firstNameError"> <argument name="customer" value="Simple_US_Customer"/> <argument name="address" value="US_Address_TX"/> </actionGroup> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AssignCustomOrderStatusNotVisibleOnStorefrontTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AssignCustomOrderStatusNotVisibleOnStorefrontTest.xml index c292afe65cdf3..ac377a0d31606 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AssignCustomOrderStatusNotVisibleOnStorefrontTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AssignCustomOrderStatusNotVisibleOnStorefrontTest.xml @@ -87,7 +87,7 @@ <!-- Assert order status is correct --> <amOnPage url="{{AdminOrdersPage.url}}" stepKey="goToOrdersPage"/> <waitForPageLoad stepKey="waitForOrdersPageLoad"/> - <actionGroup ref="filterOrderGridById" stepKey="filterOrdersGridById"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrdersGridById"> <argument name="orderId" value="$getOrderId"/> </actionGroup> <click selector="{{AdminDataGridTableSection.firstRow}}" stepKey="clickCreatedOrderInGrid"/> @@ -112,7 +112,7 @@ <!-- Cancel order --> <amOnPage url="{{AdminOrdersPage.url}}" stepKey="goToAdminOrdersPage"/> <waitForPageLoad stepKey="waitForAdminOrdersPageLoad"/> - <actionGroup ref="filterOrderGridById" stepKey="filterOrdersGridByOrderId"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrdersGridByOrderId"> <argument name="orderId" value="$getOrderId"/> </actionGroup> <checkOption selector="{{AdminOrdersGridSection.checkOrder}}" stepKey="selectOrder"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/CheckXSSVulnerabilityDuringOrderCreationTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/CheckXSSVulnerabilityDuringOrderCreationTest.xml index a728b57a743af..6eb9e37a3ab79 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/CheckXSSVulnerabilityDuringOrderCreationTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/CheckXSSVulnerabilityDuringOrderCreationTest.xml @@ -52,7 +52,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <!-- Try to create order in admin with provided email --> - <actionGroup ref="navigateToNewOrderPageNewCustomerSingleStore" stepKey="navigateToNewOrderPage"/> + <actionGroup ref="NavigateToNewOrderPageNewCustomerSingleStoreActionGroup" stepKey="navigateToNewOrderPage"/> <fillField selector="{{AdminOrderFormAccountSection.email}}" userInput="{{Simple_US_Customer_Incorrect_Email.email}}" stepKey="fillEmailAddressAdminPanel"/> <click selector="{{AdminOrderFormActionSection.submitOrder}}" stepKey="clickSubmitOrder"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceAndCheckInvoiceOrderTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceAndCheckInvoiceOrderTest.xml index 45953b7b584f2..0b065e0da54f0 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceAndCheckInvoiceOrderTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceAndCheckInvoiceOrderTest.xml @@ -51,7 +51,7 @@ </after> <!-- Create order --> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="goToCreateOrderPage"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="goToCreateOrderPage"> <argument name="customer" value="$$createCustomer$$"/> </actionGroup> @@ -79,7 +79,7 @@ <!-- Open created order --> <amOnPage url="{{AdminOrdersPage.url}}" stepKey="goToOrdersPage"/> <waitForPageLoad stepKey="waitForOrdersPageLoad"/> - <actionGroup ref="filterOrderGridById" stepKey="filterOrdersGridById"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrdersGridById"> <argument name="orderId" value="$getOrderId"/> </actionGroup> <click selector="{{AdminDataGridTableSection.firstRow}}" stepKey="clickCreatedOrderInGrid"/> @@ -105,7 +105,7 @@ <!-- Assert invoice in invoices tab --> <amOnPage url="{{AdminOrdersPage.url}}" stepKey="goToOrders"/> <waitForPageLoad stepKey="waitForOrdersLoad"/> - <actionGroup ref="filterOrderGridById" stepKey="filterOrderGridByIdForAssertingInvoiceBtn"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGridByIdForAssertingInvoiceBtn"> <argument name="orderId" value="$getOrderId"/> </actionGroup> <click selector="{{AdminDataGridTableSection.firstRow}}" stepKey="clickOrderInGrid"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceWithCashOnDeliveryPaymentMethodTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceWithCashOnDeliveryPaymentMethodTest.xml index ef194028a4367..295d388ced96e 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceWithCashOnDeliveryPaymentMethodTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceWithCashOnDeliveryPaymentMethodTest.xml @@ -51,7 +51,7 @@ </after> <!-- Create order --> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="goToCreateOrderPage"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="goToCreateOrderPage"> <argument name="customer" value="$$createCustomer$$"/> </actionGroup> @@ -79,7 +79,7 @@ <!-- Open created order --> <amOnPage url="{{AdminOrdersPage.url}}" stepKey="goToOrdersPage"/> <waitForPageLoad stepKey="waitForOrdersPageLoad"/> - <actionGroup ref="filterOrderGridById" stepKey="filterOrdersGridById"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrdersGridById"> <argument name="orderId" value="$getOrderId"/> </actionGroup> <click selector="{{AdminDataGridTableSection.firstRow}}" stepKey="clickCreatedOrderInGrid"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceWithShipmentAndCheckInvoicedOrderTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceWithShipmentAndCheckInvoicedOrderTest.xml index 30ca1f5175576..2ccecf34a5a0c 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceWithShipmentAndCheckInvoicedOrderTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceWithShipmentAndCheckInvoicedOrderTest.xml @@ -49,12 +49,12 @@ </after> <!-- Create order--> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="goToCreateOrderPage"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="goToCreateOrderPage"> <argument name="customer" value="$$createCustomer$$"/> </actionGroup> <!-- Add product to order --> - <actionGroup ref="addSimpleProductToOrder" stepKey="addProductToOrder"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addProductToOrder"> <argument name="product" value="$$createSimpleProduct$$"/> </actionGroup> @@ -73,7 +73,7 @@ <!-- Open created order --> <amOnPage url="{{AdminOrdersPage.url}}" stepKey="goToOrdersPage"/> <waitForPageLoad stepKey="waitForOrdersPageLoad"/> - <actionGroup ref="filterOrderGridById" stepKey="filterOrdersGridById"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrdersGridById"> <argument name="orderId" value="$getOrderId"/> </actionGroup> <click selector="{{AdminDataGridTableSection.firstRow}}" stepKey="clickCreatedOrderInGrid"/> @@ -103,7 +103,7 @@ <!-- Assert no invoice button --> <amOnPage url="{{AdminOrdersPage.url}}" stepKey="goToOrders"/> <waitForPageLoad stepKey="waitForOrdersLoad"/> - <actionGroup ref="filterOrderGridById" stepKey="filterOrderGridByIdForAssertingInvoiceBtn"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGridByIdForAssertingInvoiceBtn"> <argument name="orderId" value="$getOrderId"/> </actionGroup> <click selector="{{AdminDataGridTableSection.firstRow}}" stepKey="clickOrderInGrid"/> @@ -148,7 +148,7 @@ <!-- Assert no ship button --> <amOnPage url="{{AdminOrdersPage.url}}" stepKey="goToAdminOrdersPage"/> <waitForPageLoad stepKey="waitForOrdersPageToLoad"/> - <actionGroup ref="filterOrderGridById" stepKey="filterOrderGridByIdForAssertingShipBtn"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGridByIdForAssertingShipBtn"> <argument name="orderId" value="$getOrderId"/> </actionGroup> <click selector="{{AdminDataGridTableSection.firstRow}}" stepKey="selectOrderInGrid"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceWithZeroSubtotalCheckoutTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceWithZeroSubtotalCheckoutTest.xml index 4b8e5d88cdf49..944a1ed75cebd 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceWithZeroSubtotalCheckoutTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceWithZeroSubtotalCheckoutTest.xml @@ -62,12 +62,12 @@ </after> <!-- Create order --> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="goToCreateOrderPage"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="goToCreateOrderPage"> <argument name="customer" value="$$createCustomer$$"/> </actionGroup> <!-- Add product to order --> - <actionGroup ref="addSimpleProductToOrder" stepKey="addProductToOrder"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addProductToOrder"> <argument name="product" value="$$createSimpleProduct$$"/> </actionGroup> @@ -77,7 +77,7 @@ </actionGroup> <!-- Select Free shipping --> - <actionGroup ref="orderSelectFreeShipping" stepKey="selectFreeShippingOption"/> + <actionGroup ref="OrderSelectFreeShippingActionGroup" stepKey="selectFreeShippingOption"/> <!-- Submit order --> <actionGroup ref="AdminSubmitOrderActionGroup" stepKey="submitOrder"/> @@ -88,7 +88,7 @@ <!-- Open created order --> <amOnPage url="{{AdminOrdersPage.url}}" stepKey="goToOrdersPage"/> <waitForPageLoad stepKey="waitForOrdersPageLoad"/> - <actionGroup ref="filterOrderGridById" stepKey="filterOrdersGridById"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrdersGridById"> <argument name="orderId" value="$getOrderId"/> </actionGroup> <click selector="{{AdminDataGridTableSection.firstRow}}" stepKey="clickCreatedOrderInGrid"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/CreateOrderFromEditCustomerPageTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/CreateOrderFromEditCustomerPageTest.xml index 9da5afffb48e5..d32a5304c5087 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/CreateOrderFromEditCustomerPageTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/CreateOrderFromEditCustomerPageTest.xml @@ -103,19 +103,19 @@ <conditionalClick selector="{{AdminOrderStoreScopeTreeSection.storeOption(_defaultStore.name)}}" dependentSelector="{{AdminOrderStoreScopeTreeSection.storeOption(_defaultStore.name)}}" visible="true" stepKey="selectStoreViewIfAppears"/> <!--Add configurable product to order--> - <actionGroup ref="addConfigurableProductToOrderFromAdmin" stepKey="addConfigurableProductToOrder"> + <actionGroup ref="AddConfigurableProductToOrderFromAdminActionGroup" stepKey="addConfigurableProductToOrder"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="attribute" value="$$createConfigProductAttribute$$"/> <argument name="option" value="$$getConfigAttributeOption1$$"/> </actionGroup> <!--Add Simple product to order--> - <actionGroup ref="addSimpleProductToOrder" stepKey="addSimpleProductToOrder"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSimpleProductToOrder"> <argument name="product" value="$$simpleProduct$$"/> </actionGroup> <!--Add Second Simple product to order--> - <actionGroup ref="addSimpleProductToOrder" stepKey="addSecondSimpleProductToOrder"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSecondSimpleProductToOrder"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> @@ -185,7 +185,7 @@ <waitForPageLoad stepKey="waitForAdminOrderFormLoad"/> <!-- Verify order information --> - <actionGroup ref="verifyCreatedOrderInformation" stepKey="verifyCreatedOrderInformation"/> + <actionGroup ref="VerifyCreatedOrderInformationActionGroup" stepKey="verifyCreatedOrderInformation"/> <grabTextFrom selector="|Order # (\d+)|" stepKey="orderId"/> <!-- Filter and Open the customer edit page --> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/EndToEndB2CAdminTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/EndToEndB2CAdminTest.xml index 0fdd8d8c35b32..08fd95e73ad93 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/EndToEndB2CAdminTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/EndToEndB2CAdminTest.xml @@ -35,14 +35,14 @@ <!--Admin creates order--> <comment userInput="Admin creates order" stepKey="adminCreateOrderComment" before="navigateToNewOrderPage"/> - <actionGroup ref="navigateToNewOrderPageNewCustomer" stepKey="navigateToNewOrderPage" after="deleteCategory"/> + <actionGroup ref="NavigateToNewOrderPageNewCustomerActionGroup" stepKey="navigateToNewOrderPage" after="deleteCategory"/> - <actionGroup ref="checkRequiredFieldsNewOrderForm" stepKey="checkRequiredFieldsNewOrder" after="navigateToNewOrderPage"/> + <actionGroup ref="CheckRequiredFieldsNewOrderFormActionGroup" stepKey="checkRequiredFieldsNewOrder" after="navigateToNewOrderPage"/> <scrollToTopOfPage stepKey="scrollToTopOfOrderFormPage" after="checkRequiredFieldsNewOrder"/> - <actionGroup ref="addSimpleProductToOrder" stepKey="addSimpleProductToOrder" after="scrollToTopOfOrderFormPage"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSimpleProductToOrder" after="scrollToTopOfOrderFormPage"> <argument name="product" value="SimpleProduct"/> </actionGroup> - <actionGroup ref="addConfigurableProductToOrder" stepKey="addConfigurableProductToOrder" after="addSimpleProductToOrder"> + <actionGroup ref="AddConfigurableProductToOrderActionGroup" stepKey="addConfigurableProductToOrder" after="addSimpleProductToOrder"> <argument name="product" value="BaseConfigurableProduct"/> <argument name="attribute" value="colorProductAttribute"/> <argument name="option" value="colorProductAttribute1"/> @@ -53,12 +53,12 @@ <fillField selector="{{AdminOrderFormAccountSection.email}}" userInput="{{Simple_US_Customer.email}}" stepKey="fillEmail" after="selectGroup"/> <!--Fill customer address information--> - <actionGroup ref="fillOrderCustomerInformation" stepKey="fillCustomerAddress" after="fillEmail"> + <actionGroup ref="FillOrderCustomerInformationActionGroup" stepKey="fillCustomerAddress" after="fillEmail"> <argument name="customer" value="Simple_US_Customer"/> <argument name="address" value="US_Address_TX"/> </actionGroup> - <actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRateShipping" after="fillCustomerAddress"/> + <actionGroup ref="OrderSelectFlatRateShippingActionGroup" stepKey="selectFlatRateShipping" after="fillCustomerAddress"/> <!--Verify totals on Order page--> <see selector="{{AdminOrderFormTotalSection.total('Subtotal')}}" userInput="${{AdminOrderSimpleConfigurableProduct.subtotal}}" stepKey="seeOrderSubTotal" after="selectFlatRateShipping"/> @@ -73,15 +73,15 @@ <see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="Pending" stepKey="seeOrderPendingStatus" after="seeSuccessMessage"/> <grabTextFrom selector="|Order # (\d+)|" stepKey="getOrderId" after="seeOrderPendingStatus"/> <assertNotEmpty actual="$getOrderId" stepKey="assertOrderIdIsNotEmpty" after="getOrderId"/> - <actionGroup ref="verifyBasicOrderInformation" stepKey="verifyOrderInformation" after="assertOrderIdIsNotEmpty"> + <actionGroup ref="VerifyBasicOrderInformationActionGroup" stepKey="verifyOrderInformation" after="assertOrderIdIsNotEmpty"> <argument name="customer" value="Simple_US_Customer"/> <argument name="shippingAddress" value="US_Address_TX"/> <argument name="billingAddress" value="US_Address_TX"/> </actionGroup> - <actionGroup ref="seeProductInItemsOrdered" stepKey="seeSimpleProductInItemsOrdered" after="verifyOrderInformation"> + <actionGroup ref="SeeProductInItemsOrderedActionGroup" stepKey="seeSimpleProductInItemsOrdered" after="verifyOrderInformation"> <argument name="product" value="SimpleProduct"/> </actionGroup> - <actionGroup ref="seeProductInItemsOrdered" stepKey="seeConfigurableProductInItemsOrdered" after="seeSimpleProductInItemsOrdered"> + <actionGroup ref="SeeProductInItemsOrderedActionGroup" stepKey="seeConfigurableProductInItemsOrdered" after="seeSimpleProductInItemsOrdered"> <argument name="product" value="BaseConfigurableProduct"/> </actionGroup> @@ -94,7 +94,7 @@ <!--Check Invoice Data--> <see selector="{{AdminInvoiceOrderInformationSection.orderStatus}}" userInput="Pending" stepKey="seeOrderPendingInvoice" after="seePageNameNewInvoicePage"/> - <actionGroup ref="verifyBasicInvoiceInformation" stepKey="verifyOrderInvoiceInformation" after="seeOrderPendingInvoice"> + <actionGroup ref="VerifyBasicInvoiceInformationActionGroup" stepKey="verifyOrderInvoiceInformation" after="seeOrderPendingInvoice"> <argument name="customer" value="Simple_US_Customer"/> <argument name="shippingAddress" value="US_Address_TX"/> <argument name="billingAddress" value="US_Address_TX"/> @@ -113,15 +113,15 @@ <see selector="{{AdminOrderInvoicesTabSection.gridRow('1')}}" userInput="{{Simple_US_Customer.firstname}}" stepKey="seeOrderInvoiceInTabGrid" after="waitForInvoiceGridLoadingMask"/> <click selector="{{AdminOrderInvoicesTabSection.viewGridRow('1')}}" stepKey="clickToViewInvoiceRow" after="seeOrderInvoiceInTabGrid"/> <see selector="{{AdminInvoiceOrderInformationSection.orderId}}" userInput="$getOrderId" stepKey="seeOrderIdOnInvoice" after="clickToViewInvoiceRow"/> - <actionGroup ref="verifyBasicInvoiceInformation" stepKey="verifyBasicInvoiceInformation" after="seeOrderIdOnInvoice"> + <actionGroup ref="VerifyBasicInvoiceInformationActionGroup" stepKey="verifyBasicInvoiceInformation" after="seeOrderIdOnInvoice"> <argument name="customer" value="Simple_US_Customer"/> <argument name="shippingAddress" value="US_Address_TX"/> <argument name="billingAddress" value="US_Address_TX"/> </actionGroup> - <actionGroup ref="seeProductInInvoiceItems" stepKey="seeSimpleProductInInvoice" after="verifyBasicInvoiceInformation"> + <actionGroup ref="SeeProductInInvoiceItemsActionGroup" stepKey="seeSimpleProductInInvoice" after="verifyBasicInvoiceInformation"> <argument name="product" value="SimpleProduct"/> </actionGroup> - <actionGroup ref="seeProductInInvoiceItems" stepKey="seeConfigurableProductInInvoice" after="seeSimpleProductInInvoice"> + <actionGroup ref="SeeProductInInvoiceItemsActionGroup" stepKey="seeConfigurableProductInInvoice" after="seeSimpleProductInInvoice"> <argument name="product" value="BaseConfigurableProduct"/> </actionGroup> <click selector="{{AdminInvoiceOrderInformationSection.orderId}}" stepKey="clickOrderIdLinkOnInvoice" after="seeConfigurableProductInInvoice"/> @@ -132,7 +132,7 @@ <seeInCurrentUrl url="{{AdminCreditMemoNewPage.url}}" stepKey="seeNewCreditMemoPage" after="clickCreateCreditMemo"/> <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Memo" stepKey="seeNewMemoInPageTitle" after="seeNewCreditMemoPage"/> <!--Check Credit Memo Order Data--> - <actionGroup ref="verifyBasicCreditMemoInformation" stepKey="verifyOrderCreditMemoInformation" after="seeNewMemoInPageTitle"> + <actionGroup ref="VerifyBasicCreditMemoInformationActionGroup" stepKey="verifyOrderCreditMemoInformation" after="seeNewMemoInPageTitle"> <argument name="customer" value="Simple_US_Customer"/> <argument name="shippingAddress" value="US_Address_TX"/> <argument name="billingAddress" value="US_Address_TX"/> @@ -146,15 +146,15 @@ <click selector="{{AdminOrderCreditMemosTabSection.viewGridRow('1')}}" stepKey="clickToViewCreditMemoRow" after="seeOrderCreditMemoInTabGrid"/> <waitForPageLoad stepKey="waitForCreditMemoPageLoad" after="clickToViewCreditMemoRow"/> <see selector="{{AdminCreditMemoOrderInformationSection.orderId}}" userInput="$getOrderId" stepKey="seeOrderIdOnCreditMemo" after="waitForCreditMemoPageLoad"/> - <actionGroup ref="verifyBasicCreditMemoInformation" stepKey="verifyBasicCreditMemoInformation" after="seeOrderIdOnCreditMemo"> + <actionGroup ref="VerifyBasicCreditMemoInformationActionGroup" stepKey="verifyBasicCreditMemoInformation" after="seeOrderIdOnCreditMemo"> <argument name="customer" value="Simple_US_Customer"/> <argument name="shippingAddress" value="US_Address_TX"/> <argument name="billingAddress" value="US_Address_TX"/> </actionGroup> - <actionGroup ref="seeProductInItemsRefunded" stepKey="seeSimpleProductInItemsRefunded" after="verifyBasicCreditMemoInformation"> + <actionGroup ref="SeeProductInItemsRefundedActionGroup" stepKey="seeSimpleProductInItemsRefunded" after="verifyBasicCreditMemoInformation"> <argument name="product" value="SimpleProduct"/> </actionGroup> - <actionGroup ref="seeProductInItemsRefunded" stepKey="seeConfigurableProductInItemsRefunded" after="seeSimpleProductInItemsRefunded"> + <actionGroup ref="SeeProductInItemsRefundedActionGroup" stepKey="seeConfigurableProductInItemsRefunded" after="seeSimpleProductInItemsRefunded"> <argument name="product" value="BaseConfigurableProduct"/> </actionGroup> <scrollToTopOfPage stepKey="scrollToTopOfCreditMemo" after="seeConfigurableProductInItemsRefunded"/> @@ -183,7 +183,7 @@ <actionGroup ref="resetAdminDataGridToDefaultView" stepKey="resetOrderGridForNameFilter" after="filterOrderGridByNameComment"/> <!--@TODO use "Bill-to Name" when MQE-794 is fixed--> <see selector="{{AdminDataGridTableSection.column('Bill')}}" userInput="{{BillingAddressTX.fullname}}" stepKey="seeNonFilterNameInColumn" after="resetOrderGridForNameFilter"/> - <actionGroup ref="filterOrderGridByBillingName" stepKey="filterOrderGridByBillingName" after="seeNonFilterNameInColumn"> + <actionGroup ref="FilterOrderGridByBillingNameActionGroup" stepKey="filterOrderGridByBillingName" after="seeNonFilterNameInColumn"> <argument name="customer" value="Simple_US_Customer"/> </actionGroup> <dontSee selector="{{AdminDataGridTableSection.column('Bill')}}" userInput="{{BillingAddressTX.fullname}}" stepKey="dontSeeNonFilterNameInColumn" after="filterOrderGridByBillingName"/> @@ -192,7 +192,7 @@ <comment userInput="Admin filters order grid by 'Grand Total'" stepKey="filterOrderGridByTotalComment" after="seeFilterNameInColumn"/> <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFilterBeforeTotalFilter" after="filterOrderGridByTotalComment"/> <see selector="{{AdminDataGridTableSection.column('Grand Total')}}" userInput="{{AdminOrderSimpleProduct.grandTotal}}" stepKey="seeLowerTotalInGrid" after="clearFilterBeforeTotalFilter"/> - <actionGroup ref="filterOrderGridByBaseTotalRange" stepKey="filterOrderGridByTotal" after="seeLowerTotalInGrid"> + <actionGroup ref="FilterOrderGridByBaseTotalRangeActionGroup" stepKey="filterOrderGridByTotal" after="seeLowerTotalInGrid"> <argument name="from" value="OrderGrandTotalFilterRange.from"/> <argument name="to" value="OrderGrandTotalFilterRange.to"/> </actionGroup> @@ -217,12 +217,12 @@ <!--Filter order grid by status--> <comment userInput="Admin filters order grid by 'Status'" stepKey="filterOrderGridByStatusComment" after="dontSeeSecondOrderInGrid"/> <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFilterBeforeStatusFilter" after="filterOrderGridByStatusComment"/> - <actionGroup ref="filterOrderGridByStatus" stepKey="filterOrderGridByPendingStatus" after="clearFilterBeforeStatusFilter"> + <actionGroup ref="FilterOrderGridByStatusActionGroup" stepKey="filterOrderGridByPendingStatus" after="clearFilterBeforeStatusFilter"> <argument name="status" value="OrderStatus.pending"/> </actionGroup> <dontSee selector="{{AdminDataGridTableSection.column('Status')}}" userInput="{{OrderStatus.closed}}" stepKey="dontSeeClosedStatusInOrderGrid" after="filterOrderGridByPendingStatus"/> <see selector="{{AdminDataGridTableSection.column('Status')}}" userInput="{{OrderStatus.pending}}" stepKey="seePendingStatusInOrderGrid" after="dontSeeClosedStatusInOrderGrid"/> - <actionGroup ref="filterOrderGridByStatus" stepKey="filterOrderGridByClosedStatus" after="seePendingStatusInOrderGrid"> + <actionGroup ref="FilterOrderGridByStatusActionGroup" stepKey="filterOrderGridByClosedStatus" after="seePendingStatusInOrderGrid"> <argument name="status" value="OrderStatus.closed"/> </actionGroup> <see selector="{{AdminDataGridTableSection.column('Status')}}" userInput="{{OrderStatus.closed}}" stepKey="seeClosedStatusInOrderGrid" after="filterOrderGridByClosedStatus"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/MoveLastOrderedConfigurableProductOnOrderPageTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/MoveLastOrderedConfigurableProductOnOrderPageTest.xml index 3cc14392c6183..b3c3f045f0d59 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/MoveLastOrderedConfigurableProductOnOrderPageTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/MoveLastOrderedConfigurableProductOnOrderPageTest.xml @@ -69,12 +69,12 @@ </after> <!-- Create order --> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="goToCreateOrderPage"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="goToCreateOrderPage"> <argument name="customer" value="$$createCustomer$$"/> </actionGroup> <!-- Add configurable product to order --> - <actionGroup ref="addConfigurableProductToOrderFromAdmin" stepKey="addConfigurableProductToOrder"> + <actionGroup ref="AddConfigurableProductToOrderFromAdminActionGroup" stepKey="addConfigurableProductToOrder"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="attribute" value="$$createConfigProductAttribute$$"/> <argument name="option" value="$$getConfigAttributeOption$$"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/StorefrontPrintOrderGuestTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/StorefrontPrintOrderGuestTest.xml index 0bd8ab4855e97..f5fc0851b3ec8 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/StorefrontPrintOrderGuestTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/StorefrontPrintOrderGuestTest.xml @@ -164,7 +164,7 @@ <magentoCLI command="cache:flush" stepKey="flushCache"/> <!-- Place order with options according to dataset --> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="newOrder"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="newOrder"> <argument name="customer" value="$$createCustomer$$"/> </actionGroup> @@ -200,12 +200,12 @@ <argument name="couponCode" value="$$createCouponForCartPriceRule.code$$"/> </actionGroup> - <actionGroup ref="fillOrderCustomerInformation" stepKey="fillOrder"> + <actionGroup ref="FillOrderCustomerInformationActionGroup" stepKey="fillOrder"> <argument name="customer" value="$$createCustomer$$"/> <argument name="address" value="US_Address_TX"/> </actionGroup> - <actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRate"/> + <actionGroup ref="OrderSelectFlatRateShippingActionGroup" stepKey="selectFlatRate"/> </before> <after> <magentoCLI command="downloadable:domains:remove" arguments="example.com static.magento.com" stepKey="removeDownloadableDomain"/> diff --git a/app/code/Magento/Shipping/Test/Mftf/Test/AdminCreateOrderCustomStoreShippingMethodTableRatesTest.xml b/app/code/Magento/Shipping/Test/Mftf/Test/AdminCreateOrderCustomStoreShippingMethodTableRatesTest.xml index b2e3e2516a5c3..48797336431fa 100644 --- a/app/code/Magento/Shipping/Test/Mftf/Test/AdminCreateOrderCustomStoreShippingMethodTableRatesTest.xml +++ b/app/code/Magento/Shipping/Test/Mftf/Test/AdminCreateOrderCustomStoreShippingMethodTableRatesTest.xml @@ -86,14 +86,14 @@ </actionGroup> <actionGroup ref="saveProductForm" stepKey="saveProduct"/> <!--Create order--> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderWithExistingCustomer"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderWithExistingCustomer"> <argument name="customer" value="$$createCustomer$$"/> <argument name="storeView" value="customStore"/> </actionGroup> - <actionGroup ref="addSimpleProductToOrder" stepKey="addSimpleProductToTheOrder"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSimpleProductToTheOrder"> <argument name="product" value="$$createProduct$$"/> </actionGroup> - <actionGroup ref="fillOrderCustomerInformation" stepKey="fillCustomerInfo"> + <actionGroup ref="FillOrderCustomerInformationActionGroup" stepKey="fillCustomerInfo"> <argument name="customer" value="$$createCustomer$$"/> <argument name="address" value="US_Address_TX"/> </actionGroup> diff --git a/app/code/Magento/Shipping/Test/Mftf/Test/AdminCreatePartialShipmentEntityTest.xml b/app/code/Magento/Shipping/Test/Mftf/Test/AdminCreatePartialShipmentEntityTest.xml index 30dc98c2f68ca..0e4fd3ce9a86c 100644 --- a/app/code/Magento/Shipping/Test/Mftf/Test/AdminCreatePartialShipmentEntityTest.xml +++ b/app/code/Magento/Shipping/Test/Mftf/Test/AdminCreatePartialShipmentEntityTest.xml @@ -40,15 +40,15 @@ <!-- TEST BODY --> <!-- Create Order --> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="goToCreateOrderPage"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="goToCreateOrderPage"> <argument name="customer" value="$$createCustomer$$"/> </actionGroup> - <actionGroup ref="addSimpleProductToOrder" stepKey="addProductToOrder"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addProductToOrder"> <argument name="product" value="$$createSimpleProduct$$"/> <argument name="productQty" value="2"/> </actionGroup> <!-- Select Free shipping --> - <actionGroup ref="orderSelectFreeShipping" stepKey="selectFreeShippingOption"/> + <actionGroup ref="OrderSelectFreeShippingActionGroup" stepKey="selectFreeShippingOption"/> <!--Click *Submit Order* button--> <click selector="{{AdminOrderFormActionSection.SubmitOrder}}" stepKey="clickSubmitOrder"/> <!-- Create Partial Shipment --> diff --git a/app/code/Magento/Shipping/Test/Mftf/Test/AdminCreateShipmentEntityTest.xml b/app/code/Magento/Shipping/Test/Mftf/Test/AdminCreateShipmentEntityTest.xml index 3e6bf29b1bf54..f4087932a0710 100644 --- a/app/code/Magento/Shipping/Test/Mftf/Test/AdminCreateShipmentEntityTest.xml +++ b/app/code/Magento/Shipping/Test/Mftf/Test/AdminCreateShipmentEntityTest.xml @@ -41,14 +41,14 @@ <!-- TEST BODY --> <!-- Create Order --> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="goToCreateOrderPage"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="goToCreateOrderPage"> <argument name="customer" value="$$createCustomer$$"/> </actionGroup> - <actionGroup ref="addSimpleProductToOrder" stepKey="addProductToOrder"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addProductToOrder"> <argument name="product" value="$$createSimpleProduct$$"/> </actionGroup> <!-- Select Free shipping --> - <actionGroup ref="orderSelectFreeShipping" stepKey="selectFreeShippingOption"/> + <actionGroup ref="OrderSelectFreeShippingActionGroup" stepKey="selectFreeShippingOption"/> <!--Click *Submit Order* button--> <click selector="{{AdminOrderFormActionSection.SubmitOrder}}" stepKey="clickSubmitOrder"/> <!-- Create Shipment --> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxCalcWithApplyTaxOnSettingTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxCalcWithApplyTaxOnSettingTest.xml index d249af983f715..d023f2eae25c8 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxCalcWithApplyTaxOnSettingTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxCalcWithApplyTaxOnSettingTest.xml @@ -52,12 +52,12 @@ <actionGroup ref="logout" stepKey="logout"/> </after> - <actionGroup ref="navigateToNewOrderPageNewCustomerSingleStore" stepKey="gotoNewOrderCreationPage"/> - <actionGroup ref="addSimpleProductToOrder" stepKey="addSimpleProductToOrder"> + <actionGroup ref="NavigateToNewOrderPageNewCustomerSingleStoreActionGroup" stepKey="gotoNewOrderCreationPage"/> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSimpleProductToOrder"> <argument name="product" value="$$createProduct$$"></argument> </actionGroup> <fillField selector="{{AdminOrderFormAccountSection.email}}" userInput="{{Simple_US_Customer.email}}" stepKey="fillEmailField"/> - <actionGroup ref="fillOrderCustomerInformation" stepKey="fillCustomerAddress"> + <actionGroup ref="FillOrderCustomerInformationActionGroup" stepKey="fillCustomerAddress"> <argument name="customer" value="Simple_US_Customer"/> <argument name="address" value="US_Address_CA"/> </actionGroup> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml index 628d189823a52..b7f604974fec2 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml @@ -104,10 +104,10 @@ <waitForPageLoad stepKey="waitForPage" time="60"/> <!--Check if order can be submitted without the required fields including email address--> <scrollToTopOfPage stepKey="scrollToTopOfOrderFormPage" after="seeNewOrderPageTitle"/> - <actionGroup ref="addSimpleProductToOrder" stepKey="addFirstProductToOrder" after="scrollToTopOfOrderFormPage"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addFirstProductToOrder" after="scrollToTopOfOrderFormPage"> <argument name="product" value="$$firstProduct$$"/> </actionGroup> - <actionGroup ref="addSimpleProductToOrder" stepKey="addSecondProductToOrder" after="addFirstProductToOrder"> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSecondProductToOrder" after="addFirstProductToOrder"> <argument name="product" value="$$secondProduct$$"/> </actionGroup> @@ -116,15 +116,15 @@ <fillField selector="{{AdminOrderFormAccountSection.email}}" userInput="{{Simple_US_Customer.email}}" stepKey="fillCustomerEmail" after="selectCustomerGroup"/> <!--Fill customer address information--> - <actionGroup ref="fillOrderCustomerInformation" stepKey="fillCustomerAddress" after="fillCustomerEmail"> + <actionGroup ref="FillOrderCustomerInformationActionGroup" stepKey="fillCustomerAddress" after="fillCustomerEmail"> <argument name="customer" value="Simple_US_Customer"/> <argument name="address" value="US_Address_TX"/> </actionGroup> <!-- Select shipping --> - <actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRateShipping" after="fillCustomerAddress"/> + <actionGroup ref="OrderSelectFlatRateShippingActionGroup" stepKey="selectFlatRateShipping" after="fillCustomerAddress"/> <!-- Checkout select Check/Money Order payment --> - <actionGroup ref="SelectCheckMoneyPaymentMethod" after="selectFlatRateShipping" stepKey="selectCheckMoneyPayment"/> + <actionGroup ref="SelectCheckMoneyPaymentMethodActionGroup" after="selectFlatRateShipping" stepKey="selectCheckMoneyPayment"/> <!--Submit Order and verify information--> <click selector="{{AdminOrderFormActionSection.SubmitOrder}}" after="selectCheckMoneyPayment" stepKey="clickSubmitOrder"/> <seeInCurrentUrl url="{{AdminOrderDetailsPage.url}}" stepKey="seeViewOrderPage" after="clickSubmitOrder"/> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/CheckCreditMemoTotalsTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/CheckCreditMemoTotalsTest.xml index 38cc687ff53a4..d80e48bc08a90 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/CheckCreditMemoTotalsTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/CheckCreditMemoTotalsTest.xml @@ -102,7 +102,7 @@ <actionGroup ref="logout" stepKey="logout"/> </after> <!--Create new order--> - <actionGroup stepKey="CreateNewOrder" ref="navigateToNewOrderPageExistingCustomer"> + <actionGroup stepKey="CreateNewOrder" ref="NavigateToNewOrderPageExistingCustomerActionGroup"> <argument name="customer" value="Simple_US_Customer_NY"/> </actionGroup> <!--Add product to order--> @@ -112,7 +112,7 @@ <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickAddSelectedProducts"/> <waitForPageLoad stepKey="waitForPageLoad3"/> <!--Set shipping method--> - <actionGroup stepKey="orderSelectFlatRateShipping" ref="orderSelectFlatRateShipping"/> + <actionGroup stepKey="orderSelectFlatRateShipping" ref="OrderSelectFlatRateShippingActionGroup"/> <!--Submit order--> <click stepKey="SubmitOrder" selector="{{AdminOrderFormActionSection.SubmitOrder}}"/> <waitForPageLoad stepKey="waitForPageLoad4"/> @@ -120,7 +120,7 @@ <!--Open new created order--> <amOnPage url="{{AdminOrdersPage.url}}" stepKey="goToOrders"/> <waitForPageLoad stepKey="waitForPageLoad5"/> - <actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById"> + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGridById"> <argument name="orderId" value="$getOrderId"/> </actionGroup> <!--Create order invoice--> From 2270cebfeb0a8744d100c0b64031c99874a39bb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 28 Nov 2019 17:16:37 +0100 Subject: [PATCH 0161/1143] REFACTOR: Extract Action Groups to separate files (according to MFTF best practices) --- .../AddProductVideoActionGroup.xml | 33 ++++++++ .../AdminProductVideoActionGroup.xml | 77 ------------------- ...roductVideoAdminProductPageActionGroup.xml | 25 ++++++ ...tVideoNotInAdminProductPageActionGroup.xml | 25 ++++++ ...oNotInStorefrontProductPageActionGroup.xml | 21 +++++ ...VideoStorefrontProductPageActionGroup.xml} | 14 +--- .../RemoveProductVideoActionGroup.xml | 21 +++++ .../AdminAddDefaultVideoSimpleProductTest.xml | 6 +- ...minRemoveDefaultVideoSimpleProductTest.xml | 8 +- .../YoutubeVideoWindowOnProductPageTest.xml | 6 +- 10 files changed, 136 insertions(+), 100 deletions(-) create mode 100644 app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/AddProductVideoActionGroup.xml delete mode 100644 app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/AdminProductVideoActionGroup.xml create mode 100644 app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/AssertProductVideoAdminProductPageActionGroup.xml create mode 100644 app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/AssertProductVideoNotInAdminProductPageActionGroup.xml create mode 100644 app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/AssertProductVideoNotInStorefrontProductPageActionGroup.xml rename app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/{StorefrontProductVideoActionGroup.xml => AssertProductVideoStorefrontProductPageActionGroup.xml} (56%) create mode 100644 app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/RemoveProductVideoActionGroup.xml diff --git a/app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/AddProductVideoActionGroup.xml b/app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/AddProductVideoActionGroup.xml new file mode 100644 index 0000000000000..bf76b7c11acfd --- /dev/null +++ b/app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/AddProductVideoActionGroup.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <!-- Add video in Admin Product page --> + <actionGroup name="AddProductVideoActionGroup"> + <annotations> + <description>Expands the 'Images And Videos' section on the Admin Product creation/edit page. Adds the provided Video to the Product. Clicks on Save.</description> + </annotations> + <arguments> + <argument name="video" defaultValue="mftfTestProductVideo"/> + </arguments> + + <scrollTo selector="{{AdminProductImagesSection.productImagesToggle}}" x="0" y="-100" stepKey="scrollToArea"/> + <conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductVideoSection"/> + <waitForElementVisible selector="{{AdminProductImagesSection.addVideoButton}}" stepKey="waitForAddVideoButtonVisible" time="30"/> + <click selector="{{AdminProductImagesSection.addVideoButton}}" stepKey="addVideo"/> + <waitForElementVisible selector=".modal-slide.mage-new-video-dialog.form-inline._show" stepKey="waitForUrlElementVisibleslide" time="30"/> + <waitForElementVisible selector="{{AdminProductNewVideoSection.videoUrlTextField}}" stepKey="waitForUrlElementVisible" time="60"/> + <fillField selector="{{AdminProductNewVideoSection.videoUrlTextField}}" userInput="{{video.videoUrl}}" stepKey="fillFieldVideoUrl"/> + <fillField selector="{{AdminProductNewVideoSection.videoTitleTextField}}" userInput="{{video.videoTitle}}" stepKey="fillFieldVideoTitle"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <waitForElementNotVisible selector="{{AdminProductNewVideoSection.saveButtonDisabled}}" stepKey="waitForSaveButtonVisible" time="30"/> + <click selector="{{AdminProductNewVideoSection.saveButton}}" stepKey="saveVideo"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/AdminProductVideoActionGroup.xml b/app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/AdminProductVideoActionGroup.xml deleted file mode 100644 index 67a79e7f37adf..0000000000000 --- a/app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/AdminProductVideoActionGroup.xml +++ /dev/null @@ -1,77 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <!-- Add video in Admin Product page --> - <actionGroup name="addProductVideo"> - <annotations> - <description>Expands the 'Images And Videos' section on the Admin Product creation/edit page. Adds the provided Video to the Product. Clicks on Save.</description> - </annotations> - <arguments> - <argument name="video" defaultValue="mftfTestProductVideo"/> - </arguments> - - <scrollTo selector="{{AdminProductImagesSection.productImagesToggle}}" x="0" y="-100" stepKey="scrollToArea"/> - <conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductVideoSection"/> - <waitForElementVisible selector="{{AdminProductImagesSection.addVideoButton}}" stepKey="waitForAddVideoButtonVisible" time="30"/> - <click selector="{{AdminProductImagesSection.addVideoButton}}" stepKey="addVideo"/> - <waitForElementVisible selector=".modal-slide.mage-new-video-dialog.form-inline._show" stepKey="waitForUrlElementVisibleslide" time="30"/> - <waitForElementVisible selector="{{AdminProductNewVideoSection.videoUrlTextField}}" stepKey="waitForUrlElementVisible" time="60"/> - <fillField selector="{{AdminProductNewVideoSection.videoUrlTextField}}" userInput="{{video.videoUrl}}" stepKey="fillFieldVideoUrl"/> - <fillField selector="{{AdminProductNewVideoSection.videoTitleTextField}}" userInput="{{video.videoTitle}}" stepKey="fillFieldVideoTitle"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <waitForElementNotVisible selector="{{AdminProductNewVideoSection.saveButtonDisabled}}" stepKey="waitForSaveButtonVisible" time="30"/> - <click selector="{{AdminProductNewVideoSection.saveButton}}" stepKey="saveVideo"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear"/> - </actionGroup> - - <!-- Remove video in Admin Product page --> - <actionGroup name="removeProductVideo"> - <annotations> - <description>Expands the 'Images And Videos' section on the Admin Product creation/edit page. Clicks on the Remove Video button.</description> - </annotations> - - <scrollTo selector="{{AdminProductImagesSection.productImagesToggle}}" x="0" y="-100" stepKey="scrollToArea"/> - <conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductVideoSection"/> - <waitForElementVisible selector="{{AdminProductImagesSection.addVideoButton}}" stepKey="waitForAddVideoButtonVisible" time="30"/> - <click selector="{{AdminProductImagesSection.removeVideoButton}}" stepKey="removeVideo"/> - </actionGroup> - - <!-- Assert product video in Admin Product page --> - <actionGroup name="assertProductVideoAdminProductPage"> - <annotations> - <description>Validates that the provided Video is present on the Admin Product creation/edit page.</description> - </annotations> - <arguments> - <argument name="video" defaultValue="mftfTestProductVideo"/> - </arguments> - - <scrollTo selector="{{AdminProductImagesSection.productImagesToggle}}" x="0" y="-100" stepKey="scrollToArea"/> - <conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductVideoSection"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <seeElement selector="{{AdminProductImagesSection.videoTitleText(video.videoShortTitle)}}" stepKey="seeVideoTitle"/> - <seeElementInDOM selector="{{AdminProductImagesSection.videoUrlHiddenField(video.videoUrl)}}" stepKey="seeVideoItem"/> - </actionGroup> - - <!-- Assert product video not in Admin Product page --> - <actionGroup name="assertProductVideoNotInAdminProductPage"> - <annotations> - <description>Validates that the provided Video is NOT present on the Admin Product creation/edit page.</description> - </annotations> - <arguments> - <argument name="video" defaultValue="mftfTestProductVideo"/> - </arguments> - - <scrollTo selector="{{AdminProductImagesSection.productImagesToggle}}" x="0" y="-100" stepKey="scrollToArea"/> - <conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductVideoSection"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <dontSeeElement selector="{{AdminProductImagesSection.videoTitleText(video.videoShortTitle)}}" stepKey="seeVideoTitle"/> - <dontSeeElementInDOM selector="{{AdminProductImagesSection.videoUrlHiddenField(video.videoUrl)}}" stepKey="seeVideoItem"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/AssertProductVideoAdminProductPageActionGroup.xml b/app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/AssertProductVideoAdminProductPageActionGroup.xml new file mode 100644 index 0000000000000..bda0b9532f2a1 --- /dev/null +++ b/app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/AssertProductVideoAdminProductPageActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertProductVideoAdminProductPageActionGroup"> + <annotations> + <description>Validates that the provided Video is present on the Admin Product creation/edit page.</description> + </annotations> + <arguments> + <argument name="video" defaultValue="mftfTestProductVideo"/> + </arguments> + + <scrollTo selector="{{AdminProductImagesSection.productImagesToggle}}" x="0" y="-100" stepKey="scrollToArea"/> + <conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductVideoSection"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <seeElement selector="{{AdminProductImagesSection.videoTitleText(video.videoShortTitle)}}" stepKey="seeVideoTitle"/> + <seeElementInDOM selector="{{AdminProductImagesSection.videoUrlHiddenField(video.videoUrl)}}" stepKey="seeVideoItem"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/AssertProductVideoNotInAdminProductPageActionGroup.xml b/app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/AssertProductVideoNotInAdminProductPageActionGroup.xml new file mode 100644 index 0000000000000..3a10c096222b8 --- /dev/null +++ b/app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/AssertProductVideoNotInAdminProductPageActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertProductVideoNotInAdminProductPageActionGroup"> + <annotations> + <description>Validates that the provided Video is NOT present on the Admin Product creation/edit page.</description> + </annotations> + <arguments> + <argument name="video" defaultValue="mftfTestProductVideo"/> + </arguments> + + <scrollTo selector="{{AdminProductImagesSection.productImagesToggle}}" x="0" y="-100" stepKey="scrollToArea"/> + <conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductVideoSection"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <dontSeeElement selector="{{AdminProductImagesSection.videoTitleText(video.videoShortTitle)}}" stepKey="seeVideoTitle"/> + <dontSeeElementInDOM selector="{{AdminProductImagesSection.videoUrlHiddenField(video.videoUrl)}}" stepKey="seeVideoItem"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/AssertProductVideoNotInStorefrontProductPageActionGroup.xml b/app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/AssertProductVideoNotInStorefrontProductPageActionGroup.xml new file mode 100644 index 0000000000000..22666ad0eddcf --- /dev/null +++ b/app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/AssertProductVideoNotInStorefrontProductPageActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertProductVideoNotInStorefrontProductPageActionGroup"> + <annotations> + <description>Validates that the provided Video is NOT present on the Storefront Product page.</description> + </annotations> + <arguments> + <argument name="dataTypeAttribute" defaultValue="'youtube'"/> + </arguments> + + <dontSeeElement selector="{{StorefrontProductInfoMainSection.productVideo(dataTypeAttribute)}}" stepKey="dontSeeProductVideoDataType"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/StorefrontProductVideoActionGroup.xml b/app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/AssertProductVideoStorefrontProductPageActionGroup.xml similarity index 56% rename from app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/StorefrontProductVideoActionGroup.xml rename to app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/AssertProductVideoStorefrontProductPageActionGroup.xml index e2cdac9ec9287..c2bb4e016147a 100644 --- a/app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/StorefrontProductVideoActionGroup.xml +++ b/app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/AssertProductVideoStorefrontProductPageActionGroup.xml @@ -9,7 +9,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <!--Assert product video in Storefront Product page --> - <actionGroup name="assertProductVideoStorefrontProductPage"> + <actionGroup name="AssertProductVideoStorefrontProductPageActionGroup"> <annotations> <description>Validates that the provided Video is present on the Storefront Product page.</description> </annotations> @@ -19,16 +19,4 @@ <seeElement selector="{{StorefrontProductInfoMainSection.productVideo(dataTypeAttribute)}}" stepKey="seeProductVideoDataType"/> </actionGroup> - - <!--Assert product video not in Storefront Product page --> - <actionGroup name="assertProductVideoNotInStorefrontProductPage"> - <annotations> - <description>Validates that the provided Video is NOT present on the Storefront Product page.</description> - </annotations> - <arguments> - <argument name="dataTypeAttribute" defaultValue="'youtube'"/> - </arguments> - - <dontSeeElement selector="{{StorefrontProductInfoMainSection.productVideo(dataTypeAttribute)}}" stepKey="dontSeeProductVideoDataType"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/RemoveProductVideoActionGroup.xml b/app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/RemoveProductVideoActionGroup.xml new file mode 100644 index 0000000000000..5666d51082543 --- /dev/null +++ b/app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/RemoveProductVideoActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="RemoveProductVideoActionGroup"> + <annotations> + <description>Expands the 'Images And Videos' section on the Admin Product creation/edit page. Clicks on the Remove Video button.</description> + </annotations> + + <scrollTo selector="{{AdminProductImagesSection.productImagesToggle}}" x="0" y="-100" stepKey="scrollToArea"/> + <conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductVideoSection"/> + <waitForElementVisible selector="{{AdminProductImagesSection.addVideoButton}}" stepKey="waitForAddVideoButtonVisible" time="30"/> + <click selector="{{AdminProductImagesSection.removeVideoButton}}" stepKey="removeVideo"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ProductVideo/Test/Mftf/Test/AdminAddDefaultVideoSimpleProductTest.xml b/app/code/Magento/ProductVideo/Test/Mftf/Test/AdminAddDefaultVideoSimpleProductTest.xml index 2b5f87f78d5e5..c2b92e6af452a 100644 --- a/app/code/Magento/ProductVideo/Test/Mftf/Test/AdminAddDefaultVideoSimpleProductTest.xml +++ b/app/code/Magento/ProductVideo/Test/Mftf/Test/AdminAddDefaultVideoSimpleProductTest.xml @@ -22,12 +22,12 @@ </after> <!-- Add product video --> - <actionGroup ref="addProductVideo" stepKey="addProductVideo" after="fillMainProductForm"/> + <actionGroup ref="AddProductVideoActionGroup" stepKey="addProductVideo" after="fillMainProductForm"/> <!-- Assert product video in admin product form --> - <actionGroup ref="assertProductVideoAdminProductPage" stepKey="assertProductVideoAdminProductPage" after="saveProductForm"/> + <actionGroup ref="AssertProductVideoAdminProductPageActionGroup" stepKey="assertProductVideoAdminProductPage" after="saveProductForm"/> <!-- Assert product video in storefront product page --> - <actionGroup ref="assertProductVideoStorefrontProductPage" stepKey="assertProductVideoStorefrontProductPage" after="AssertProductInStorefrontProductPage"/> + <actionGroup ref="AssertProductVideoStorefrontProductPageActionGroup" stepKey="assertProductVideoStorefrontProductPage" after="AssertProductInStorefrontProductPage"/> </test> </tests> diff --git a/app/code/Magento/ProductVideo/Test/Mftf/Test/AdminRemoveDefaultVideoSimpleProductTest.xml b/app/code/Magento/ProductVideo/Test/Mftf/Test/AdminRemoveDefaultVideoSimpleProductTest.xml index d4da0ffa54451..c674f12115334 100644 --- a/app/code/Magento/ProductVideo/Test/Mftf/Test/AdminRemoveDefaultVideoSimpleProductTest.xml +++ b/app/code/Magento/ProductVideo/Test/Mftf/Test/AdminRemoveDefaultVideoSimpleProductTest.xml @@ -22,15 +22,15 @@ </after> <!-- Add product video --> - <actionGroup ref="addProductVideo" stepKey="addProductVideo" after="fillMainProductForm"/> + <actionGroup ref="AddProductVideoActionGroup" stepKey="addProductVideo" after="fillMainProductForm"/> <!-- Remove product video --> - <actionGroup ref="removeProductVideo" stepKey="removeProductVideo" after="saveProductForm"/> + <actionGroup ref="RemoveProductVideoActionGroup" stepKey="removeProductVideo" after="saveProductForm"/> <!-- Assert product video not in admin product form --> - <actionGroup ref="assertProductVideoNotInAdminProductPage" stepKey="assertProductVideoNotInAdminProductPage" after="saveProductFormAfterRemove"/> + <actionGroup ref="AssertProductVideoNotInAdminProductPageActionGroup" stepKey="assertProductVideoNotInAdminProductPage" after="saveProductFormAfterRemove"/> <!-- Assert product video not in storefront product page --> - <actionGroup ref="assertProductVideoNotInStorefrontProductPage" stepKey="assertProductVideoNotInStorefrontProductPage" after="AssertProductInStorefrontProductPage"/> + <actionGroup ref="AssertProductVideoNotInStorefrontProductPageActionGroup" stepKey="assertProductVideoNotInStorefrontProductPage" after="AssertProductInStorefrontProductPage"/> </test> </tests> diff --git a/app/code/Magento/ProductVideo/Test/Mftf/Test/YoutubeVideoWindowOnProductPageTest.xml b/app/code/Magento/ProductVideo/Test/Mftf/Test/YoutubeVideoWindowOnProductPageTest.xml index 7249a4223503e..a550471715018 100644 --- a/app/code/Magento/ProductVideo/Test/Mftf/Test/YoutubeVideoWindowOnProductPageTest.xml +++ b/app/code/Magento/ProductVideo/Test/Mftf/Test/YoutubeVideoWindowOnProductPageTest.xml @@ -42,9 +42,9 @@ <actionGroup ref="openProducForEditByClickingRowXColumnYInProductGrid" stepKey="openFirstProductForEdit"/> <!-- Add product video --> - <actionGroup ref="addProductVideo" stepKey="addProductVideo" after="openFirstProductForEdit"/> + <actionGroup ref="AddProductVideoActionGroup" stepKey="addProductVideo" after="openFirstProductForEdit"/> <!-- Assert product video in admin product form --> - <actionGroup ref="assertProductVideoAdminProductPage" stepKey="assertProductVideoAdminProductPage" after="addProductVideo"/> + <actionGroup ref="AssertProductVideoAdminProductPageActionGroup" stepKey="assertProductVideoAdminProductPage" after="addProductVideo"/> <!-- Save the product --> <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveFirstProduct"/> @@ -53,7 +53,7 @@ <!-- Assert product video in storefront product page --> <amOnPage url="$$createProduct.name$$.html" stepKey="goToStorefrontCategoryPage"/> <waitForPageLoad stepKey="waitForStorefrontPageLoaded"/> - <actionGroup ref="assertProductVideoStorefrontProductPage" stepKey="assertProductVideoStorefrontProductPage" after="waitForStorefrontPageLoaded"/> + <actionGroup ref="AssertProductVideoStorefrontProductPageActionGroup" stepKey="assertProductVideoStorefrontProductPage" after="waitForStorefrontPageLoaded"/> <!--Click Play video button--> <click stepKey="clickToPlayVideo" selector="{{StorefrontProductInfoMainSection.clickInVideo}}"/> From f1781b6d5c9a18fc4eda5e1e45cde96c62aa1651 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 28 Nov 2019 17:23:47 +0100 Subject: [PATCH 0162/1143] REFACTOR: Extract Action Groups to separate files (according to MFTF best practices) --- ...efrontWithRememberMeCheckedActionGroup.xml | 18 +++++++++ ...rontWithRememberMeUnCheckedActionGroup.xml | 18 +++++++++ ...tentCustomerWelcomeMessageActionGroup.xml} | 5 --- ...merWelcomeMessageNotPresentActionGroup.xml | 15 +++++++ ...RegisterPageDoNotRememberMeActionGroup.xml | 18 +++++++++ .../StorefrontCustomerActionGroup.xml | 40 ------------------- ...tRegisterCustomerRememberMeActionGroup.xml | 17 ++++++++ 7 files changed, 86 insertions(+), 45 deletions(-) create mode 100644 app/code/Magento/Persistent/Test/Mftf/ActionGroup/CustomerLoginOnStorefrontWithRememberMeCheckedActionGroup.xml create mode 100644 app/code/Magento/Persistent/Test/Mftf/ActionGroup/CustomerLoginOnStorefrontWithRememberMeUnCheckedActionGroup.xml rename app/code/Magento/Persistent/Test/Mftf/ActionGroup/{StorefrontPersistentAssertCustomerWelcomeMessageActionGroup.xml => StorefrontAssertPersistentCustomerWelcomeMessageActionGroup.xml} (64%) create mode 100644 app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontAssertPersistentCustomerWelcomeMessageNotPresentActionGroup.xml create mode 100644 app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontCreateCustomerOnRegisterPageDoNotRememberMeActionGroup.xml delete mode 100644 app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontCustomerActionGroup.xml create mode 100644 app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontRegisterCustomerRememberMeActionGroup.xml diff --git a/app/code/Magento/Persistent/Test/Mftf/ActionGroup/CustomerLoginOnStorefrontWithRememberMeCheckedActionGroup.xml b/app/code/Magento/Persistent/Test/Mftf/ActionGroup/CustomerLoginOnStorefrontWithRememberMeCheckedActionGroup.xml new file mode 100644 index 0000000000000..6a28829034611 --- /dev/null +++ b/app/code/Magento/Persistent/Test/Mftf/ActionGroup/CustomerLoginOnStorefrontWithRememberMeCheckedActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CustomerLoginOnStorefrontWithRememberMeCheckedActionGroup" extends="LoginToStorefrontActionGroup"> + <annotations> + <description>EXTENDS: LoginToStorefrontActionGroup. Checks the 'Remember Me' checkbox.</description> + </annotations> + + <checkOption selector="{{StorefrontCustomerSignInFormSection.rememberMe}}" before="clickSignInAccountButton" stepKey="checkRememberMe"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Persistent/Test/Mftf/ActionGroup/CustomerLoginOnStorefrontWithRememberMeUnCheckedActionGroup.xml b/app/code/Magento/Persistent/Test/Mftf/ActionGroup/CustomerLoginOnStorefrontWithRememberMeUnCheckedActionGroup.xml new file mode 100644 index 0000000000000..080dde1f60f93 --- /dev/null +++ b/app/code/Magento/Persistent/Test/Mftf/ActionGroup/CustomerLoginOnStorefrontWithRememberMeUnCheckedActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CustomerLoginOnStorefrontWithRememberMeUnCheckedActionGroup" extends="LoginToStorefrontActionGroup"> + <annotations> + <description>EXTENDS: LoginToStorefrontActionGroup. Uncheck the 'Remember Me' checkbox.</description> + </annotations> + + <uncheckOption selector="{{StorefrontCustomerSignInFormSection.rememberMe}}" before="clickSignInAccountButton" stepKey="unCheckRememberMe"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontPersistentAssertCustomerWelcomeMessageActionGroup.xml b/app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontAssertPersistentCustomerWelcomeMessageActionGroup.xml similarity index 64% rename from app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontPersistentAssertCustomerWelcomeMessageActionGroup.xml rename to app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontAssertPersistentCustomerWelcomeMessageActionGroup.xml index b081f5c3eb0c8..54105dc0d31ad 100644 --- a/app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontPersistentAssertCustomerWelcomeMessageActionGroup.xml +++ b/app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontAssertPersistentCustomerWelcomeMessageActionGroup.xml @@ -15,9 +15,4 @@ <waitForPageLoad stepKey="waitForPageLoad"/> <see selector="{{StorefrontPanelHeaderSection.welcomeMessage}}" userInput="Welcome, {{customerFullName}}! Not you?" stepKey="verifyMessage" /> </actionGroup> - - <actionGroup name="StorefrontAssertPersistentCustomerWelcomeMessageNotPresentActionGroup" extends="StorefrontAssertPersistentCustomerWelcomeMessageActionGroup"> - <remove keyForRemoval="verifyMessage"/> - <dontSee selector="{{StorefrontPanelHeaderSection.welcomeMessage}}" userInput="Welcome, {{customerFullName}}! Not you?" stepKey="dontSeeWelcomeMessageNotYou"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontAssertPersistentCustomerWelcomeMessageNotPresentActionGroup.xml b/app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontAssertPersistentCustomerWelcomeMessageNotPresentActionGroup.xml new file mode 100644 index 0000000000000..3aa0c4d9c0de5 --- /dev/null +++ b/app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontAssertPersistentCustomerWelcomeMessageNotPresentActionGroup.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontAssertPersistentCustomerWelcomeMessageNotPresentActionGroup" extends="StorefrontAssertPersistentCustomerWelcomeMessageActionGroup"> + <remove keyForRemoval="verifyMessage"/> + <dontSee selector="{{StorefrontPanelHeaderSection.welcomeMessage}}" userInput="Welcome, {{customerFullName}}! Not you?" stepKey="dontSeeWelcomeMessageNotYou"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontCreateCustomerOnRegisterPageDoNotRememberMeActionGroup.xml b/app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontCreateCustomerOnRegisterPageDoNotRememberMeActionGroup.xml new file mode 100644 index 0000000000000..75ca7bca24dce --- /dev/null +++ b/app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontCreateCustomerOnRegisterPageDoNotRememberMeActionGroup.xml @@ -0,0 +1,18 @@ + +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCreateCustomerOnRegisterPageDoNotRememberMeActionGroup" extends="SignUpNewUserFromStorefrontActionGroup"> + <!--- Assume we are on customer registration page. --> + <remove keyForRemoval="amOnStorefrontPage"/> + <remove keyForRemoval="clickOnCreateAccountLink"/> + <uncheckOption selector="{{StorefrontCustomerSignInFormSection.rememberMe}}" before="clickCreateAccountButton" stepKey="unCheckRememberMe"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontCustomerActionGroup.xml b/app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontCustomerActionGroup.xml deleted file mode 100644 index 70d5be2dcf23f..0000000000000 --- a/app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontCustomerActionGroup.xml +++ /dev/null @@ -1,40 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="CustomerLoginOnStorefrontWithRememberMeChecked" extends="LoginToStorefrontActionGroup"> - <annotations> - <description>EXTENDS: LoginToStorefrontActionGroup. Checks the 'Remember Me' checkbox.</description> - </annotations> - - <checkOption selector="{{StorefrontCustomerSignInFormSection.rememberMe}}" before="clickSignInAccountButton" stepKey="checkRememberMe"/> - </actionGroup> - - <actionGroup name="CustomerLoginOnStorefrontWithRememberMeUnChecked" extends="LoginToStorefrontActionGroup"> - <annotations> - <description>EXTENDS: LoginToStorefrontActionGroup. Uncheck the 'Remember Me' checkbox.</description> - </annotations> - - <uncheckOption selector="{{StorefrontCustomerSignInFormSection.rememberMe}}" before="clickSignInAccountButton" stepKey="unCheckRememberMe"/> - </actionGroup> - - <actionGroup name="StorefrontRegisterCustomerRememberMe" extends="SignUpNewUserFromStorefrontActionGroup"> - <!--- Assume we are on customer registration page. --> - <remove keyForRemoval="amOnStorefrontPage"/> - <remove keyForRemoval="clickOnCreateAccountLink"/> - <checkOption selector="{{StorefrontCustomerSignInFormSection.rememberMe}}" before="clickCreateAccountButton" stepKey="checkRememberMe"/> - </actionGroup> - - <actionGroup name="StorefrontCreateCustomerOnRegisterPageDoNotRememberMe" extends="SignUpNewUserFromStorefrontActionGroup"> - <!--- Assume we are on customer registration page. --> - <remove keyForRemoval="amOnStorefrontPage"/> - <remove keyForRemoval="clickOnCreateAccountLink"/> - <uncheckOption selector="{{StorefrontCustomerSignInFormSection.rememberMe}}" before="clickCreateAccountButton" stepKey="unCheckRememberMe"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontRegisterCustomerRememberMeActionGroup.xml b/app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontRegisterCustomerRememberMeActionGroup.xml new file mode 100644 index 0000000000000..44cdb341b2b10 --- /dev/null +++ b/app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontRegisterCustomerRememberMeActionGroup.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontRegisterCustomerRememberMeActionGroup" extends="SignUpNewUserFromStorefrontActionGroup"> + <!--- Assume we are on customer registration page. --> + <remove keyForRemoval="amOnStorefrontPage"/> + <remove keyForRemoval="clickOnCreateAccountLink"/> + <checkOption selector="{{StorefrontCustomerSignInFormSection.rememberMe}}" before="clickCreateAccountButton" stepKey="checkRememberMe"/> + </actionGroup> +</actionGroups> From b082a86ec685cbd88a112d8848e99bea2d683ff9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 28 Nov 2019 17:28:23 +0100 Subject: [PATCH 0163/1143] FIX: Invalid references to ActionGroups after extracting --- ...CreateCustomerOnRegisterPageDoNotRememberMeActionGroup.xml | 1 - .../Test/Mftf/Test/ShippingQuotePersistedForGuestTest.xml | 2 +- ...frontCorrectWelcomeMessageAfterCustomerIsLoggedOutTest.xml | 4 ++-- ...ntVerifyShoppingCartPersistenceUnderLongTermCookieTest.xml | 4 ++-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontCreateCustomerOnRegisterPageDoNotRememberMeActionGroup.xml b/app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontCreateCustomerOnRegisterPageDoNotRememberMeActionGroup.xml index 75ca7bca24dce..9c8f04bf6292a 100644 --- a/app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontCreateCustomerOnRegisterPageDoNotRememberMeActionGroup.xml +++ b/app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontCreateCustomerOnRegisterPageDoNotRememberMeActionGroup.xml @@ -1,4 +1,3 @@ - <?xml version="1.0" encoding="UTF-8"?> <!-- /** diff --git a/app/code/Magento/Persistent/Test/Mftf/Test/ShippingQuotePersistedForGuestTest.xml b/app/code/Magento/Persistent/Test/Mftf/Test/ShippingQuotePersistedForGuestTest.xml index d508ebaa26885..add7f8a8bc0f8 100644 --- a/app/code/Magento/Persistent/Test/Mftf/Test/ShippingQuotePersistedForGuestTest.xml +++ b/app/code/Magento/Persistent/Test/Mftf/Test/ShippingQuotePersistedForGuestTest.xml @@ -40,7 +40,7 @@ <actionGroup ref="logout" stepKey="logout"/> </after> <!--Step 1: Login as a Customer with remember me checked--> - <actionGroup ref="CustomerLoginOnStorefrontWithRememberMeChecked" stepKey="loginToStorefrontAccountWithRememberMeChecked"> + <actionGroup ref="CustomerLoginOnStorefrontWithRememberMeCheckedActionGroup" stepKey="loginToStorefrontAccountWithRememberMeChecked"> <argument name="Customer" value="$$createCustomer$$"/> </actionGroup> <!--Step 2: Open the Product Page and add the product to shopping cart--> diff --git a/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontCorrectWelcomeMessageAfterCustomerIsLoggedOutTest.xml b/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontCorrectWelcomeMessageAfterCustomerIsLoggedOutTest.xml index 61710cbc98082..b41cad61c93a5 100644 --- a/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontCorrectWelcomeMessageAfterCustomerIsLoggedOutTest.xml +++ b/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontCorrectWelcomeMessageAfterCustomerIsLoggedOutTest.xml @@ -43,7 +43,7 @@ <deleteData createDataKey="createCustomerForPersistent" stepKey="deleteCustomerForPersistent"/> </after> <!--Login as a Customer with remember me unchecked--> - <actionGroup ref="CustomerLoginOnStorefrontWithRememberMeUnChecked" stepKey="loginToStorefrontAccountWithRememberMeUnchecked"> + <actionGroup ref="CustomerLoginOnStorefrontWithRememberMeUnCheckedActionGroup" stepKey="loginToStorefrontAccountWithRememberMeUnchecked"> <argument name="Customer" value="$$createCustomer$$"/> </actionGroup> @@ -60,7 +60,7 @@ stepKey="seeDefaultWelcomeMessage"/> <!--Login as a Customer with remember me checked--> - <actionGroup ref="CustomerLoginOnStorefrontWithRememberMeChecked" stepKey="loginToStorefrontAccountWithRememberMeChecked"> + <actionGroup ref="CustomerLoginOnStorefrontWithRememberMeCheckedActionGroup" stepKey="loginToStorefrontAccountWithRememberMeChecked"> <argument name="Customer" value="$$createCustomerForPersistent$$"/> </actionGroup> <!--Check customer name and last name in welcome message--> diff --git a/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyShoppingCartPersistenceUnderLongTermCookieTest.xml b/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyShoppingCartPersistenceUnderLongTermCookieTest.xml index e50fc4af83107..e80ff5b031125 100644 --- a/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyShoppingCartPersistenceUnderLongTermCookieTest.xml +++ b/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyShoppingCartPersistenceUnderLongTermCookieTest.xml @@ -54,7 +54,7 @@ <actionGroup ref="StorefrontAssertPersistentRegistrationPageFields" stepKey="assertPersistentRegistrationPageFields"/> <!-- 2. Fill fields for registration, set password and unselect the Remember Me checkbox--> - <actionGroup ref="StorefrontCreateCustomerOnRegisterPageDoNotRememberMe" stepKey="registrationJohnSmithCustomer"> + <actionGroup ref="StorefrontCreateCustomerOnRegisterPageDoNotRememberMeActionGroup" stepKey="registrationJohnSmithCustomer"> <argument name="Customer" value="John_Smith_Customer"/> </actionGroup> <!--Check customer name and last name in welcome message--> @@ -83,7 +83,7 @@ <!-- 5. Click the Create an Account link again and fill fields for registration of another customer, set password and check the Remember Me checkbox --> <amOnPage url="{{StorefrontCustomerCreatePage.url}}" stepKey="amOnCustomerAccountCreatePage"/> - <actionGroup ref="StorefrontRegisterCustomerRememberMe" stepKey="registrationJohnDoeCustomer"> + <actionGroup ref="StorefrontRegisterCustomerRememberMeActionGroup" stepKey="registrationJohnDoeCustomer"> <argument name="Customer" value="Simple_Customer_Without_Address"/> </actionGroup> <!--Check customer name and last name in welcome message--> From 59758da8a9ddb601abba21db21e5009da2b1d531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 28 Nov 2019 17:52:38 +0100 Subject: [PATCH 0164/1143] REFACTOR: Extract Action Groups to separate files (according to MFTF best practices) --- .../AddProductToCheckoutPageActionGroup.xml | 35 ++++++ ...leOptionPayPalConfigurationActionGroup.xml | 29 +++++ ...ConfigPayPalExpressCheckoutActionGroup.xml | 35 ++++++ ...erWithSelectedPaymentMethodActionGroup.xml | 44 +++++++ .../EnablePayPalConfigurationActionGroup.xml | 31 +++++ ...lePayPalSolutionWithoutSaveActionGroup.xml | 26 ++++ .../OtherPayPalConfigurationActionGroup.xml | 64 ---------- ...xpressCheckoutConfigurationActionGroup.xml | 118 ------------------ ...ConfigPayPalExpressCheckoutActionGroup.xml | 34 +++++ ...figPaymentsConflictResolutionForPayPal.xml | 74 +++++------ ...ayPalSolutionsEnabledAtTheSameTimeTest.xml | 4 +- ...rontCheckCreditButtonConfigurationTest.xml | 2 +- 12 files changed, 274 insertions(+), 222 deletions(-) create mode 100644 app/code/Magento/Paypal/Test/Mftf/ActionGroup/AddProductToCheckoutPageActionGroup.xml create mode 100644 app/code/Magento/Paypal/Test/Mftf/ActionGroup/CheckEnableOptionPayPalConfigurationActionGroup.xml create mode 100644 app/code/Magento/Paypal/Test/Mftf/ActionGroup/ConfigPayPalExpressCheckoutActionGroup.xml create mode 100644 app/code/Magento/Paypal/Test/Mftf/ActionGroup/CreatePayPalOrderWithSelectedPaymentMethodActionGroup.xml create mode 100644 app/code/Magento/Paypal/Test/Mftf/ActionGroup/EnablePayPalConfigurationActionGroup.xml create mode 100644 app/code/Magento/Paypal/Test/Mftf/ActionGroup/EnablePayPalSolutionWithoutSaveActionGroup.xml delete mode 100644 app/code/Magento/Paypal/Test/Mftf/ActionGroup/OtherPayPalConfigurationActionGroup.xml delete mode 100644 app/code/Magento/Paypal/Test/Mftf/ActionGroup/PayPalExpressCheckoutConfigurationActionGroup.xml create mode 100644 app/code/Magento/Paypal/Test/Mftf/ActionGroup/SampleConfigPayPalExpressCheckoutActionGroup.xml diff --git a/app/code/Magento/Paypal/Test/Mftf/ActionGroup/AddProductToCheckoutPageActionGroup.xml b/app/code/Magento/Paypal/Test/Mftf/ActionGroup/AddProductToCheckoutPageActionGroup.xml new file mode 100644 index 0000000000000..bf2643fc535f7 --- /dev/null +++ b/app/code/Magento/Paypal/Test/Mftf/ActionGroup/AddProductToCheckoutPageActionGroup.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddProductToCheckoutPageActionGroup"> + <annotations> + <description>Goes to the provided Category page on the Storefront. Adds the 1st Product to the Cart. Goes to Checkout. Select the Shipping Method. Selects PayPal as the Payment Method.</description> + </annotations> + <arguments> + <argument name="Category"/> + </arguments> + + <amOnPage url="{{StorefrontCategoryPage.url(Category.name)}}" stepKey="onCategoryPage"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + <moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="hoverProduct"/> + <click selector="{{StorefrontCategoryMainSection.AddToCartBtn}}" stepKey="addToCart"/> + <waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="waitForProductAdded"/> + <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickCart"/> + <click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="goToCheckout"/> + <waitForPageLoad stepKey="waitForPageLoad2"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/> + <click selector="{{CheckoutShippingMethodsSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask2"/> + <waitForElement selector="{{CheckoutShippingMethodsSection.next}}" time="30" stepKey="waitForNextButton"/> + <click selector="{{CheckoutShippingMethodsSection.next}}" stepKey="clickNext"/> + <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" stepKey="waitForPlaceOrderButton"/> + <click selector="{{CheckoutPaymentSection.PayPalPaymentRadio}}" stepKey="clickPayPalCheckbox"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Paypal/Test/Mftf/ActionGroup/CheckEnableOptionPayPalConfigurationActionGroup.xml b/app/code/Magento/Paypal/Test/Mftf/ActionGroup/CheckEnableOptionPayPalConfigurationActionGroup.xml new file mode 100644 index 0000000000000..6fe01799c5422 --- /dev/null +++ b/app/code/Magento/Paypal/Test/Mftf/ActionGroup/CheckEnableOptionPayPalConfigurationActionGroup.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CheckEnableOptionPayPalConfigurationActionGroup"> + <annotations> + <description>Expands the 'OTHER PAYPAL PAYMENT SOLUTIONS' tab on the Admin Configuration page. Enables the provided PayPal Config type for the provided Country Code.</description> + </annotations> + <arguments> + <argument name="payPalConfigType"/> + <argument name="enabledOption" type="string"/> + <argument name="countryCode" type="string" defaultValue="us"/> + </arguments> + + <waitForElementVisible selector="{{OtherPayPalPaymentsConfigSection.expandTab(countryCode)}}" stepKey="waitForOtherPayPalPaymentsSection"/> + <conditionalClick selector="{{OtherPayPalPaymentsConfigSection.expandTab(countryCode)}}" dependentSelector="{{OtherPayPalPaymentsConfigSection.expandedTab(countryCode)}}" visible="false" stepKey="clickOtherPayPalPaymentsSection"/> + <waitForElementVisible selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="waitForWPSExpressConfigureBtn"/> + <click selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="clickWPSExpressConfigureBtn1"/> + <waitForElementVisible selector="{{payPalConfigType.enableSolution(countryCode)}}" stepKey="waitForWPSExpressEnable"/> + <seeOptionIsSelected selector="{{payPalConfigType.enableSolution(countryCode)}}" userInput="{{enabledOption}}" stepKey="seeSelectedOption"/> + <click selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="clickWPSExpressConfigureBtn2"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Paypal/Test/Mftf/ActionGroup/ConfigPayPalExpressCheckoutActionGroup.xml b/app/code/Magento/Paypal/Test/Mftf/ActionGroup/ConfigPayPalExpressCheckoutActionGroup.xml new file mode 100644 index 0000000000000..90f0a25a8cd69 --- /dev/null +++ b/app/code/Magento/Paypal/Test/Mftf/ActionGroup/ConfigPayPalExpressCheckoutActionGroup.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ConfigPayPalExpressCheckoutActionGroup"> + <annotations> + <description>Goes to the 'Configuration' page for 'Payment Methods'. Fills in the provided PayPal credentials and other details. Clicks on Save.</description> + </annotations> + <arguments> + <argument name="credentials" defaultValue="_CREDS"/> + <argument name="countryCode" type="string" defaultValue="us"/> + </arguments> + + <amOnPage url="{{AdminConfigPaymentMethodsPage.url}}" stepKey="navigateToPaymentConfigurationPage"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + <click selector="{{PayPalExpressCheckoutConfigSection.configureBtn(countryCode)}}" stepKey="clickPayPalConfigureBtn"/> + <waitForElementVisible selector="{{PayPalAdvancedSettingConfigSection.advancedSettingTab(countryCode)}}" stepKey="waitForAdvancedSettingTab"/> + <fillField selector ="{{PayPalExpressCheckoutConfigSection.email(countryCode)}}" userInput="{{credentials.magento/paypal_express_checkout_us_business_account}}" stepKey="inputEmailAssociatedWithPayPalMerchantAccount"/> + <selectOption selector ="{{PayPalExpressCheckoutConfigSection.apiMethod(countryCode)}}" userInput="API Signature" stepKey="inputAPIAuthenticationMethods"/> + <fillField selector ="{{PayPalExpressCheckoutConfigSection.username(countryCode)}}" userInput="{{credentials.magento/paypal_express_checkout_us_api_username}}" stepKey="inputAPIUsername"/> + <fillField selector ="{{PayPalExpressCheckoutConfigSection.password(countryCode)}}" userInput="{{credentials.magento/paypal_express_checkout_us_api_password}}" stepKey="inputAPIPassword"/> + <fillField selector ="{{PayPalExpressCheckoutConfigSection.signature(countryCode)}}" userInput="{{credentials.magento/paypal_express_checkout_us_api_signature}}" stepKey="inputAPISignature"/> + <selectOption selector ="{{PayPalExpressCheckoutConfigSection.sandboxMode(countryCode)}}" userInput="Yes" stepKey="enableSandboxMode"/> + <selectOption selector="{{PayPalExpressCheckoutConfigSection.enableSolution(countryCode)}}" userInput="Yes" stepKey="enableSolution"/> + <fillField selector ="{{PayPalExpressCheckoutConfigSection.merchantID(countryCode)}}" userInput="{{credentials.magento/paypal_express_checkout_us_merchant_id}}" stepKey="inputMerchantID"/> + <!--Save configuration--> + <click selector="{{AdminConfigSection.saveButton}}" stepKey="saveConfig"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Paypal/Test/Mftf/ActionGroup/CreatePayPalOrderWithSelectedPaymentMethodActionGroup.xml b/app/code/Magento/Paypal/Test/Mftf/ActionGroup/CreatePayPalOrderWithSelectedPaymentMethodActionGroup.xml new file mode 100644 index 0000000000000..49ebe90418436 --- /dev/null +++ b/app/code/Magento/Paypal/Test/Mftf/ActionGroup/CreatePayPalOrderWithSelectedPaymentMethodActionGroup.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreatePayPalOrderWithSelectedPaymentMethodActionGroup" extends="CreateOrderToPrintPageActionGroup"> + <annotations> + <description>EXTENDS: CreateOrderToPrintPageActionGroup. Clicks on PayPal. Fills the PayPay details in the modal. PLEASE NOTE: The PayPal Payment credentials are Hardcoded using 'Payer'.</description> + </annotations> + <arguments> + <argument name="payerName" defaultValue="MPI" type="string"/> + <argument name="credentials" defaultValue="_CREDS"/> + </arguments> + + <!-- click on PayPal payment radio button --> + <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" stepKey="waitForPlaceOrderButton"/> + <click selector="{{CheckoutPaymentSection.PayPalPaymentRadio}}" stepKey="clickPlaceOrder"/> + + <!--set ID for iframe of PayPal group button--> + <executeJS function="jQuery('.zoid-component-frame.zoid-visible').attr('id', 'myIframe')" stepKey="clickOrderLink"/> + + <!--switch to iframe of PayPal group button--> + <switchToIFrame userInput="myIframe" stepKey="clickPrintOrderLink"/> + <waitForElementVisible selector="{{CheckoutPaymentSection.PayPalBtn}}" stepKey="waitForPayPalBtn"/> + <click selector="{{CheckoutPaymentSection.PayPalBtn}}" stepKey="clickPayPalBtn"/> + <switchToIFrame stepKey="switchBack1"/> + + <!--Check in-context--> + <switchToNextTab stepKey="switchToInContentTab"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <seeCurrentUrlMatches regex="~\//www.sandbox.paypal.com/~" stepKey="seeCurrentUrlMatchesConfigPath1"/> + <waitForElement selector="{{PayPalPaymentSection.email}}" stepKey="waitForLoginForm" /> + <fillField selector="{{PayPalPaymentSection.email}}" userInput="{{credentials.magento/paypal_sandbox_login_email}}" stepKey="fillEmail"/> + <fillField selector="{{PayPalPaymentSection.password}}" userInput="{{credentials.magento/paypal_sandbox_login_password}}" stepKey="fillPassword"/> + <click selector="{{PayPalPaymentSection.loginBtn}}" stepKey="login"/> + <waitForPageLoad stepKey="wait"/> + <see userInput="{{payerName}}" selector="{{PayPalPaymentSection.reviewUserInfo}}" stepKey="seePayerName"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Paypal/Test/Mftf/ActionGroup/EnablePayPalConfigurationActionGroup.xml b/app/code/Magento/Paypal/Test/Mftf/ActionGroup/EnablePayPalConfigurationActionGroup.xml new file mode 100644 index 0000000000000..b653858f770e9 --- /dev/null +++ b/app/code/Magento/Paypal/Test/Mftf/ActionGroup/EnablePayPalConfigurationActionGroup.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="EnablePayPalConfigurationActionGroup"> + <annotations> + <description>Expands the 'OTHER PAYPAL PAYMENT SOLUTIONS' tab on the Admin Configuration page. Enables the provided PayPal Config type for the provided Country Code.</description> + </annotations> + <arguments> + <argument name="payPalConfigType"/> + <argument name="countryCode" type="string" defaultValue="us"/> + </arguments> + + <waitForElementVisible selector="{{OtherPayPalPaymentsConfigSection.expandTab(countryCode)}}" stepKey="waitForOtherPayPalPaymentsSection"/> + <conditionalClick selector="{{OtherPayPalPaymentsConfigSection.expandTab(countryCode)}}" dependentSelector="{{OtherPayPalPaymentsConfigSection.expandedTab(countryCode)}}" visible="false" stepKey="clickOtherPayPalPaymentsSection"/> + <waitForElementVisible selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="waitForWPSExpressConfigureBtn"/> + <click selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="clickWPSExpressConfigureBtn"/> + <waitForElementVisible selector="{{payPalConfigType.enableSolution(countryCode)}}" stepKey="waitForWPSExpressEnable"/> + <selectOption selector="{{payPalConfigType.enableSolution(countryCode)}}" userInput="Yes" stepKey="enableWPSExpressSolution"/> + <seeInPopup userInput="There is already another PayPal solution enabled. Enable this solution instead?" stepKey="seeAlertMessage"/> + <acceptPopup stepKey="acceptEnablePopUp"/> + <click selector="{{AdminConfigSection.saveButton}}" stepKey="saveConfig"/> + <waitForPageLoad stepKey="waitForPageLoad2"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Paypal/Test/Mftf/ActionGroup/EnablePayPalSolutionWithoutSaveActionGroup.xml b/app/code/Magento/Paypal/Test/Mftf/ActionGroup/EnablePayPalSolutionWithoutSaveActionGroup.xml new file mode 100644 index 0000000000000..51b70b10a8827 --- /dev/null +++ b/app/code/Magento/Paypal/Test/Mftf/ActionGroup/EnablePayPalSolutionWithoutSaveActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="EnablePayPalSolutionWithoutSaveActionGroup" > + <annotations> + <description>Expands the 'OTHER PAYPAL PAYMENT SOLUTIONS' tab on the Admin Configuration page. Enables the provided PayPal Config type for the provided Country Code without saving.</description> + </annotations> + <arguments> + <argument name="payPalConfigType"/> + <argument name="countryCode" type="string" defaultValue="us"/> + </arguments> + <waitForElementVisible selector="{{OtherPayPalPaymentsConfigSection.expandTab(countryCode)}}" stepKey="waitForOtherPayPalPaymentsSection"/> + <conditionalClick selector="{{OtherPayPalPaymentsConfigSection.expandTab(countryCode)}}" dependentSelector="{{OtherPayPalPaymentsConfigSection.expandedTab(countryCode)}}" visible="false" stepKey="clickOtherPayPalPaymentsSection"/> + <waitForElementVisible selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="waitForWPSExpressConfigureBtn"/> + <click selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="clickWPSExpressConfigureBtn"/> + <waitForElementVisible selector="{{payPalConfigType.enableSolution(countryCode)}}" stepKey="waitForWPSExpressEnable"/> + <selectOption selector="{{payPalConfigType.enableSolution(countryCode)}}" userInput="Yes" stepKey="enableWPSExpressSolution"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Paypal/Test/Mftf/ActionGroup/OtherPayPalConfigurationActionGroup.xml b/app/code/Magento/Paypal/Test/Mftf/ActionGroup/OtherPayPalConfigurationActionGroup.xml deleted file mode 100644 index c3e99854ce3ac..0000000000000 --- a/app/code/Magento/Paypal/Test/Mftf/ActionGroup/OtherPayPalConfigurationActionGroup.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. - */ ---> - -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="EnablePayPalConfiguration"> - <annotations> - <description>Expands the 'OTHER PAYPAL PAYMENT SOLUTIONS' tab on the Admin Configuration page. Enables the provided PayPal Config type for the provided Country Code.</description> - </annotations> - <arguments> - <argument name="payPalConfigType"/> - <argument name="countryCode" type="string" defaultValue="us"/> - </arguments> - - <waitForElementVisible selector="{{OtherPayPalPaymentsConfigSection.expandTab(countryCode)}}" stepKey="waitForOtherPayPalPaymentsSection"/> - <conditionalClick selector="{{OtherPayPalPaymentsConfigSection.expandTab(countryCode)}}" dependentSelector="{{OtherPayPalPaymentsConfigSection.expandedTab(countryCode)}}" visible="false" stepKey="clickOtherPayPalPaymentsSection"/> - <waitForElementVisible selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="waitForWPSExpressConfigureBtn"/> - <click selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="clickWPSExpressConfigureBtn"/> - <waitForElementVisible selector="{{payPalConfigType.enableSolution(countryCode)}}" stepKey="waitForWPSExpressEnable"/> - <selectOption selector="{{payPalConfigType.enableSolution(countryCode)}}" userInput="Yes" stepKey="enableWPSExpressSolution"/> - <seeInPopup userInput="There is already another PayPal solution enabled. Enable this solution instead?" stepKey="seeAlertMessage"/> - <acceptPopup stepKey="acceptEnablePopUp"/> - <click selector="{{AdminConfigSection.saveButton}}" stepKey="saveConfig"/> - <waitForPageLoad stepKey="waitForPageLoad2"/> - </actionGroup> - <actionGroup name="EnablePayPalSolutionWithoutSave" > - <annotations> - <description>Expands the 'OTHER PAYPAL PAYMENT SOLUTIONS' tab on the Admin Configuration page. Enables the provided PayPal Config type for the provided Country Code without saving.</description> - </annotations> - <arguments> - <argument name="payPalConfigType"/> - <argument name="countryCode" type="string" defaultValue="us"/> - </arguments> - <waitForElementVisible selector="{{OtherPayPalPaymentsConfigSection.expandTab(countryCode)}}" stepKey="waitForOtherPayPalPaymentsSection"/> - <conditionalClick selector="{{OtherPayPalPaymentsConfigSection.expandTab(countryCode)}}" dependentSelector="{{OtherPayPalPaymentsConfigSection.expandedTab(countryCode)}}" visible="false" stepKey="clickOtherPayPalPaymentsSection"/> - <waitForElementVisible selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="waitForWPSExpressConfigureBtn"/> - <click selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="clickWPSExpressConfigureBtn"/> - <waitForElementVisible selector="{{payPalConfigType.enableSolution(countryCode)}}" stepKey="waitForWPSExpressEnable"/> - <selectOption selector="{{payPalConfigType.enableSolution(countryCode)}}" userInput="Yes" stepKey="enableWPSExpressSolution"/> - </actionGroup> - <actionGroup name="CheckEnableOptionPayPalConfiguration"> - <annotations> - <description>Expands the 'OTHER PAYPAL PAYMENT SOLUTIONS' tab on the Admin Configuration page. Enables the provided PayPal Config type for the provided Country Code.</description> - </annotations> - <arguments> - <argument name="payPalConfigType"/> - <argument name="enabledOption" type="string"/> - <argument name="countryCode" type="string" defaultValue="us"/> - </arguments> - - <waitForElementVisible selector="{{OtherPayPalPaymentsConfigSection.expandTab(countryCode)}}" stepKey="waitForOtherPayPalPaymentsSection"/> - <conditionalClick selector="{{OtherPayPalPaymentsConfigSection.expandTab(countryCode)}}" dependentSelector="{{OtherPayPalPaymentsConfigSection.expandedTab(countryCode)}}" visible="false" stepKey="clickOtherPayPalPaymentsSection"/> - <waitForElementVisible selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="waitForWPSExpressConfigureBtn"/> - <click selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="clickWPSExpressConfigureBtn1"/> - <waitForElementVisible selector="{{payPalConfigType.enableSolution(countryCode)}}" stepKey="waitForWPSExpressEnable"/> - <seeOptionIsSelected selector="{{payPalConfigType.enableSolution(countryCode)}}" userInput="{{enabledOption}}" stepKey="seeSelectedOption"/> - <click selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="clickWPSExpressConfigureBtn2"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Paypal/Test/Mftf/ActionGroup/PayPalExpressCheckoutConfigurationActionGroup.xml b/app/code/Magento/Paypal/Test/Mftf/ActionGroup/PayPalExpressCheckoutConfigurationActionGroup.xml deleted file mode 100644 index 4d752d8377640..0000000000000 --- a/app/code/Magento/Paypal/Test/Mftf/ActionGroup/PayPalExpressCheckoutConfigurationActionGroup.xml +++ /dev/null @@ -1,118 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="ConfigPayPalExpressCheckout"> - <annotations> - <description>Goes to the 'Configuration' page for 'Payment Methods'. Fills in the provided PayPal credentials and other details. Clicks on Save.</description> - </annotations> - <arguments> - <argument name="credentials" defaultValue="_CREDS"/> - <argument name="countryCode" type="string" defaultValue="us"/> - </arguments> - - <amOnPage url="{{AdminConfigPaymentMethodsPage.url}}" stepKey="navigateToPaymentConfigurationPage"/> - <waitForPageLoad stepKey="waitForPageLoad1"/> - <click selector="{{PayPalExpressCheckoutConfigSection.configureBtn(countryCode)}}" stepKey="clickPayPalConfigureBtn"/> - <waitForElementVisible selector="{{PayPalAdvancedSettingConfigSection.advancedSettingTab(countryCode)}}" stepKey="waitForAdvancedSettingTab"/> - <fillField selector ="{{PayPalExpressCheckoutConfigSection.email(countryCode)}}" userInput="{{credentials.magento/paypal_express_checkout_us_business_account}}" stepKey="inputEmailAssociatedWithPayPalMerchantAccount"/> - <selectOption selector ="{{PayPalExpressCheckoutConfigSection.apiMethod(countryCode)}}" userInput="API Signature" stepKey="inputAPIAuthenticationMethods"/> - <fillField selector ="{{PayPalExpressCheckoutConfigSection.username(countryCode)}}" userInput="{{credentials.magento/paypal_express_checkout_us_api_username}}" stepKey="inputAPIUsername"/> - <fillField selector ="{{PayPalExpressCheckoutConfigSection.password(countryCode)}}" userInput="{{credentials.magento/paypal_express_checkout_us_api_password}}" stepKey="inputAPIPassword"/> - <fillField selector ="{{PayPalExpressCheckoutConfigSection.signature(countryCode)}}" userInput="{{credentials.magento/paypal_express_checkout_us_api_signature}}" stepKey="inputAPISignature"/> - <selectOption selector ="{{PayPalExpressCheckoutConfigSection.sandboxMode(countryCode)}}" userInput="Yes" stepKey="enableSandboxMode"/> - <selectOption selector="{{PayPalExpressCheckoutConfigSection.enableSolution(countryCode)}}" userInput="Yes" stepKey="enableSolution"/> - <fillField selector ="{{PayPalExpressCheckoutConfigSection.merchantID(countryCode)}}" userInput="{{credentials.magento/paypal_express_checkout_us_merchant_id}}" stepKey="inputMerchantID"/> - <!--Save configuration--> - <click selector="{{AdminConfigSection.saveButton}}" stepKey="saveConfig"/> - </actionGroup> - - <actionGroup name="SampleConfigPayPalExpressCheckout"> - <annotations> - <description>Goes to the 'Configuration' page for 'Payment Methods'. Fills in the provided Sample PayPal credentials and other details. Clicks on Save.</description> - </annotations> - <arguments> - <argument name="credentials" defaultValue="SamplePaypalExpressConfig"/> - <argument name="countryCode" type="string" defaultValue="us"/> - </arguments> - <amOnPage url="{{AdminConfigPaymentMethodsPage.url}}" stepKey="navigateToPaymentConfigurationPage"/> - <waitForPageLoad stepKey="waitForPageLoad1"/> - <click selector="{{PayPalExpressCheckoutConfigSection.configureBtn(countryCode)}}" stepKey="clickPayPalConfigureBtn"/> - <waitForElementVisible selector="{{PayPalAdvancedSettingConfigSection.advancedSettingTab(countryCode)}}" stepKey="waitForAdvancedSettingTab"/> - <fillField selector ="{{PayPalExpressCheckoutConfigSection.email(countryCode)}}" userInput="{{credentials.paypal_express_email}}" stepKey="inputEmailAssociatedWithPayPalMerchantAccount"/> - <selectOption selector ="{{PayPalExpressCheckoutConfigSection.apiMethod(countryCode)}}" userInput="API Signature" stepKey="inputAPIAuthenticationMethods"/> - <fillField selector ="{{PayPalExpressCheckoutConfigSection.username(countryCode)}}" userInput="{{credentials.paypal_express_api_username}}" stepKey="inputAPIUsername"/> - <fillField selector ="{{PayPalExpressCheckoutConfigSection.password(countryCode)}}" userInput="{{credentials.paypal_express_api_password}}" stepKey="inputAPIPassword"/> - <fillField selector ="{{PayPalExpressCheckoutConfigSection.signature(countryCode)}}" userInput="{{credentials.paypal_express_api_signature}}" stepKey="inputAPISignature"/> - <selectOption selector ="{{PayPalExpressCheckoutConfigSection.sandboxMode(countryCode)}}" userInput="Yes" stepKey="enableSandboxMode"/> - <selectOption selector="{{PayPalExpressCheckoutConfigSection.enableSolution(countryCode)}}" userInput="Yes" stepKey="enableSolution"/> - <fillField selector ="{{PayPalExpressCheckoutConfigSection.merchantID(countryCode)}}" userInput="{{credentials.paypal_express_merchantID}}" stepKey="inputMerchantID"/> - <!--Save configuration--> - <click selector="{{AdminConfigSection.saveButton}}" stepKey="saveConfig"/> - </actionGroup> - - <actionGroup name="CreatePayPalOrderWithSelectedPaymentMethodActionGroup" extends="CreateOrderToPrintPageActionGroup"> - <annotations> - <description>EXTENDS: CreateOrderToPrintPageActionGroup. Clicks on PayPal. Fills the PayPay details in the modal. PLEASE NOTE: The PayPal Payment credentials are Hardcoded using 'Payer'.</description> - </annotations> - <arguments> - <argument name="payerName" defaultValue="MPI" type="string"/> - <argument name="credentials" defaultValue="_CREDS"/> - </arguments> - - <!-- click on PayPal payment radio button --> - <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" stepKey="waitForPlaceOrderButton"/> - <click selector="{{CheckoutPaymentSection.PayPalPaymentRadio}}" stepKey="clickPlaceOrder"/> - - <!--set ID for iframe of PayPal group button--> - <executeJS function="jQuery('.zoid-component-frame.zoid-visible').attr('id', 'myIframe')" stepKey="clickOrderLink"/> - - <!--switch to iframe of PayPal group button--> - <switchToIFrame userInput="myIframe" stepKey="clickPrintOrderLink"/> - <waitForElementVisible selector="{{CheckoutPaymentSection.PayPalBtn}}" stepKey="waitForPayPalBtn"/> - <click selector="{{CheckoutPaymentSection.PayPalBtn}}" stepKey="clickPayPalBtn"/> - <switchToIFrame stepKey="switchBack1"/> - - <!--Check in-context--> - <switchToNextTab stepKey="switchToInContentTab"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <seeCurrentUrlMatches regex="~\//www.sandbox.paypal.com/~" stepKey="seeCurrentUrlMatchesConfigPath1"/> - <waitForElement selector="{{PayPalPaymentSection.email}}" stepKey="waitForLoginForm" /> - <fillField selector="{{PayPalPaymentSection.email}}" userInput="{{credentials.magento/paypal_sandbox_login_email}}" stepKey="fillEmail"/> - <fillField selector="{{PayPalPaymentSection.password}}" userInput="{{credentials.magento/paypal_sandbox_login_password}}" stepKey="fillPassword"/> - <click selector="{{PayPalPaymentSection.loginBtn}}" stepKey="login"/> - <waitForPageLoad stepKey="wait"/> - <see userInput="{{payerName}}" selector="{{PayPalPaymentSection.reviewUserInfo}}" stepKey="seePayerName"/> - </actionGroup> - - <actionGroup name="addProductToCheckoutPage"> - <annotations> - <description>Goes to the provided Category page on the Storefront. Adds the 1st Product to the Cart. Goes to Checkout. Select the Shipping Method. Selects PayPal as the Payment Method.</description> - </annotations> - <arguments> - <argument name="Category"/> - </arguments> - - <amOnPage url="{{StorefrontCategoryPage.url(Category.name)}}" stepKey="onCategoryPage"/> - <waitForPageLoad stepKey="waitForPageLoad1"/> - <moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="hoverProduct"/> - <click selector="{{StorefrontCategoryMainSection.AddToCartBtn}}" stepKey="addToCart"/> - <waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="waitForProductAdded"/> - <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickCart"/> - <click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="goToCheckout"/> - <waitForPageLoad stepKey="waitForPageLoad2"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/> - <click selector="{{CheckoutShippingMethodsSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask2"/> - <waitForElement selector="{{CheckoutShippingMethodsSection.next}}" time="30" stepKey="waitForNextButton"/> - <click selector="{{CheckoutShippingMethodsSection.next}}" stepKey="clickNext"/> - <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" stepKey="waitForPlaceOrderButton"/> - <click selector="{{CheckoutPaymentSection.PayPalPaymentRadio}}" stepKey="clickPayPalCheckbox"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Paypal/Test/Mftf/ActionGroup/SampleConfigPayPalExpressCheckoutActionGroup.xml b/app/code/Magento/Paypal/Test/Mftf/ActionGroup/SampleConfigPayPalExpressCheckoutActionGroup.xml new file mode 100644 index 0000000000000..23d956c8e9b8f --- /dev/null +++ b/app/code/Magento/Paypal/Test/Mftf/ActionGroup/SampleConfigPayPalExpressCheckoutActionGroup.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SampleConfigPayPalExpressCheckoutActionGroup"> + <annotations> + <description>Goes to the 'Configuration' page for 'Payment Methods'. Fills in the provided Sample PayPal credentials and other details. Clicks on Save.</description> + </annotations> + <arguments> + <argument name="credentials" defaultValue="SamplePaypalExpressConfig"/> + <argument name="countryCode" type="string" defaultValue="us"/> + </arguments> + <amOnPage url="{{AdminConfigPaymentMethodsPage.url}}" stepKey="navigateToPaymentConfigurationPage"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + <click selector="{{PayPalExpressCheckoutConfigSection.configureBtn(countryCode)}}" stepKey="clickPayPalConfigureBtn"/> + <waitForElementVisible selector="{{PayPalAdvancedSettingConfigSection.advancedSettingTab(countryCode)}}" stepKey="waitForAdvancedSettingTab"/> + <fillField selector ="{{PayPalExpressCheckoutConfigSection.email(countryCode)}}" userInput="{{credentials.paypal_express_email}}" stepKey="inputEmailAssociatedWithPayPalMerchantAccount"/> + <selectOption selector ="{{PayPalExpressCheckoutConfigSection.apiMethod(countryCode)}}" userInput="API Signature" stepKey="inputAPIAuthenticationMethods"/> + <fillField selector ="{{PayPalExpressCheckoutConfigSection.username(countryCode)}}" userInput="{{credentials.paypal_express_api_username}}" stepKey="inputAPIUsername"/> + <fillField selector ="{{PayPalExpressCheckoutConfigSection.password(countryCode)}}" userInput="{{credentials.paypal_express_api_password}}" stepKey="inputAPIPassword"/> + <fillField selector ="{{PayPalExpressCheckoutConfigSection.signature(countryCode)}}" userInput="{{credentials.paypal_express_api_signature}}" stepKey="inputAPISignature"/> + <selectOption selector ="{{PayPalExpressCheckoutConfigSection.sandboxMode(countryCode)}}" userInput="Yes" stepKey="enableSandboxMode"/> + <selectOption selector="{{PayPalExpressCheckoutConfigSection.enableSolution(countryCode)}}" userInput="Yes" stepKey="enableSolution"/> + <fillField selector ="{{PayPalExpressCheckoutConfigSection.merchantID(countryCode)}}" userInput="{{credentials.paypal_express_merchantID}}" stepKey="inputMerchantID"/> + <!--Save configuration--> + <click selector="{{AdminConfigSection.saveButton}}" stepKey="saveConfig"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Paypal/Test/Mftf/Test/AdminConfigPaymentsConflictResolutionForPayPal.xml b/app/code/Magento/Paypal/Test/Mftf/Test/AdminConfigPaymentsConflictResolutionForPayPal.xml index cfc7d66ba23cf..e918a417dcfde 100644 --- a/app/code/Magento/Paypal/Test/Mftf/Test/AdminConfigPaymentsConflictResolutionForPayPal.xml +++ b/app/code/Magento/Paypal/Test/Mftf/Test/AdminConfigPaymentsConflictResolutionForPayPal.xml @@ -20,7 +20,7 @@ </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - <actionGroup ref="SampleConfigPayPalExpressCheckout" stepKey="ConfigPayPalExpress"> + <actionGroup ref="SampleConfigPayPalExpressCheckoutActionGroup" stepKey="ConfigPayPalExpress"> <argument name="credentials" value="SamplePaypalExpressConfig"/> </actionGroup> </before> @@ -38,36 +38,36 @@ <waitForPageLoad stepKey="waitForPageLoad1"/> <!-- Enable WPS Express --> <comment userInput="Enable WPS Express" stepKey="enableWPSExpressComment"/> - <actionGroup ref="EnablePayPalConfiguration" stepKey="EnableWPSExpress"> + <actionGroup ref="EnablePayPalConfigurationActionGroup" stepKey="EnableWPSExpress"> <argument name="payPalConfigType" value="WPSExpressConfigSection"/> <argument name="countryCode" value="gb"/> </actionGroup> <!-- Check only the correct solution is enabled --> <comment userInput="Check only the correct solution is enabled" stepKey="checkOnlyTheCorrectSolutionIsEnabledComment1"/> - <actionGroup ref="CheckEnableOptionPayPalConfiguration" stepKey="checkPayPalExpressIsDisabled"> + <actionGroup ref="CheckEnableOptionPayPalConfigurationActionGroup" stepKey="checkPayPalExpressIsDisabled"> <argument name="payPalConfigType" value="PayPalExpressCheckoutConfigSection"/> <argument name="enabledOption" value="No"/> <argument name="countryCode" value="gb"/> </actionGroup> - <actionGroup ref="CheckEnableOptionPayPalConfiguration" stepKey="checkWPSExpressIsEnabled"> + <actionGroup ref="CheckEnableOptionPayPalConfigurationActionGroup" stepKey="checkWPSExpressIsEnabled"> <argument name="payPalConfigType" value="WPSExpressConfigSection"/> <argument name="enabledOption" value="Yes"/> <argument name="countryCode" value="gb"/> </actionGroup> <!-- Enable Pro Hosted With Express Checkout --> <comment userInput="Enable Pro Hosted With Express Checkout" stepKey="enableProHostedWithExpressCheckoutComment"/> - <actionGroup ref="EnablePayPalConfiguration" stepKey="EnableProHostedWithExpressCheckou"> + <actionGroup ref="EnablePayPalConfigurationActionGroup" stepKey="EnableProHostedWithExpressCheckou"> <argument name="payPalConfigType" value="PaymentsProHostedWithExpressCheckoutConfigSection"/> <argument name="countryCode" value="gb"/> </actionGroup> <!-- Check only the correct solution is enabled --> <comment userInput="Check only the correct solution is enabled" stepKey="checkOnlyTheCorrectSolutionIsEnabledComment2"/> - <actionGroup ref="CheckEnableOptionPayPalConfiguration" stepKey="checkWPSExpressIsDisabled"> + <actionGroup ref="CheckEnableOptionPayPalConfigurationActionGroup" stepKey="checkWPSExpressIsDisabled"> <argument name="payPalConfigType" value="WPSExpressConfigSection"/> <argument name="enabledOption" value="No"/> <argument name="countryCode" value="gb"/> </actionGroup> - <actionGroup ref="CheckEnableOptionPayPalConfiguration" stepKey="checkProHostedIsEnabled"> + <actionGroup ref="CheckEnableOptionPayPalConfigurationActionGroup" stepKey="checkProHostedIsEnabled"> <argument name="payPalConfigType" value="PaymentsProHostedWithExpressCheckoutConfigSection"/> <argument name="enabledOption" value="Yes"/> <argument name="countryCode" value="gb"/> @@ -84,30 +84,30 @@ <group value="paypal"/> </annotations> <selectOption selector="{{PaymentsConfigSection.merchantCountry}}" userInput="Japan" stepKey="setMerchantCountry"/> - <actionGroup ref="EnablePayPalConfiguration" stepKey="EnableWPSExpress"> + <actionGroup ref="EnablePayPalConfigurationActionGroup" stepKey="EnableWPSExpress"> <argument name="payPalConfigType" value="WPSOtherConfigSection"/> <argument name="countryCode" value="jp"/> </actionGroup> - <actionGroup ref="CheckEnableOptionPayPalConfiguration" stepKey="checkPayPalExpressIsDisabled"> + <actionGroup ref="CheckEnableOptionPayPalConfigurationActionGroup" stepKey="checkPayPalExpressIsDisabled"> <argument name="payPalConfigType" value="PayPalExpressCheckoutOtherCountryConfigSection"/> <argument name="enabledOption" value="No"/> <argument name="countryCode" value="jp"/> </actionGroup> - <actionGroup ref="CheckEnableOptionPayPalConfiguration" stepKey="checkWPSExpressIsEnabled"> + <actionGroup ref="CheckEnableOptionPayPalConfigurationActionGroup" stepKey="checkWPSExpressIsEnabled"> <argument name="payPalConfigType" value="WPSOtherConfigSection"/> <argument name="enabledOption" value="Yes"/> <argument name="countryCode" value="jp"/> </actionGroup> - <actionGroup ref="EnablePayPalConfiguration" stepKey="EnableProHostedWithExpressCheckou"> + <actionGroup ref="EnablePayPalConfigurationActionGroup" stepKey="EnableProHostedWithExpressCheckou"> <argument name="payPalConfigType" value="WebsitePaymentsPlusConfigSection"/> <argument name="countryCode" value="jp"/> </actionGroup> - <actionGroup ref="CheckEnableOptionPayPalConfiguration" stepKey="checkWPSExpressIsDisabled"> + <actionGroup ref="CheckEnableOptionPayPalConfigurationActionGroup" stepKey="checkWPSExpressIsDisabled"> <argument name="payPalConfigType" value="WPSOtherConfigSection"/> <argument name="enabledOption" value="No"/> <argument name="countryCode" value="jp"/> </actionGroup> - <actionGroup ref="CheckEnableOptionPayPalConfiguration" stepKey="checkProHostedIsEnabled"> + <actionGroup ref="CheckEnableOptionPayPalConfigurationActionGroup" stepKey="checkProHostedIsEnabled"> <argument name="payPalConfigType" value="WebsitePaymentsPlusConfigSection"/> <argument name="enabledOption" value="Yes"/> <argument name="countryCode" value="jp"/> @@ -124,30 +124,30 @@ <group value="paypal"/> </annotations> <selectOption selector="{{PaymentsConfigSection.merchantCountry}}" userInput="France" stepKey="setMerchantCountry"/> - <actionGroup ref="EnablePayPalConfiguration" stepKey="EnableWPSExpress"> + <actionGroup ref="EnablePayPalConfigurationActionGroup" stepKey="EnableWPSExpress"> <argument name="payPalConfigType" value="WPSOtherConfigSection"/> <argument name="countryCode" value="fr"/> </actionGroup> - <actionGroup ref="CheckEnableOptionPayPalConfiguration" stepKey="checkPayPalExpressIsDisabled"> + <actionGroup ref="CheckEnableOptionPayPalConfigurationActionGroup" stepKey="checkPayPalExpressIsDisabled"> <argument name="payPalConfigType" value="PayPalExpressCheckoutOtherCountryConfigSection"/> <argument name="enabledOption" value="No"/> <argument name="countryCode" value="fr"/> </actionGroup> - <actionGroup ref="CheckEnableOptionPayPalConfiguration" stepKey="checkWPSExpressIsEnabled"> + <actionGroup ref="CheckEnableOptionPayPalConfigurationActionGroup" stepKey="checkWPSExpressIsEnabled"> <argument name="payPalConfigType" value="WPSOtherConfigSection"/> <argument name="enabledOption" value="Yes"/> <argument name="countryCode" value="fr"/> </actionGroup> - <actionGroup ref="EnablePayPalConfiguration" stepKey="EnableProHostedWithExpressCheckou"> + <actionGroup ref="EnablePayPalConfigurationActionGroup" stepKey="EnableProHostedWithExpressCheckou"> <argument name="payPalConfigType" value="WebsitePaymentsPlusConfigSection"/> <argument name="countryCode" value="fr"/> </actionGroup> - <actionGroup ref="CheckEnableOptionPayPalConfiguration" stepKey="checkWPSExpressIsDisabled"> + <actionGroup ref="CheckEnableOptionPayPalConfigurationActionGroup" stepKey="checkWPSExpressIsDisabled"> <argument name="payPalConfigType" value="WPSOtherConfigSection"/> <argument name="enabledOption" value="No"/> <argument name="countryCode" value="fr"/> </actionGroup> - <actionGroup ref="CheckEnableOptionPayPalConfiguration" stepKey="checkProHostedIsEnabled"> + <actionGroup ref="CheckEnableOptionPayPalConfigurationActionGroup" stepKey="checkProHostedIsEnabled"> <argument name="payPalConfigType" value="WebsitePaymentsPlusConfigSection"/> <argument name="enabledOption" value="Yes"/> <argument name="countryCode" value="fr"/> @@ -164,30 +164,30 @@ <group value="paypal"/> </annotations> <selectOption selector="{{PaymentsConfigSection.merchantCountry}}" userInput="Hong Kong SAR China" stepKey="setMerchantCountry"/> - <actionGroup ref="EnablePayPalConfiguration" stepKey="EnableWPSExpress"> + <actionGroup ref="EnablePayPalConfigurationActionGroup" stepKey="EnableWPSExpress"> <argument name="payPalConfigType" value="WPSOtherConfigSection"/> <argument name="countryCode" value="hk"/> </actionGroup> - <actionGroup ref="CheckEnableOptionPayPalConfiguration" stepKey="checkPayPalExpressIsDisabled"> + <actionGroup ref="CheckEnableOptionPayPalConfigurationActionGroup" stepKey="checkPayPalExpressIsDisabled"> <argument name="payPalConfigType" value="PayPalExpressCheckoutOtherCountryConfigSection"/> <argument name="enabledOption" value="No"/> <argument name="countryCode" value="hk"/> </actionGroup> - <actionGroup ref="CheckEnableOptionPayPalConfiguration" stepKey="checkWPSExpressIsEnabled"> + <actionGroup ref="CheckEnableOptionPayPalConfigurationActionGroup" stepKey="checkWPSExpressIsEnabled"> <argument name="payPalConfigType" value="WPSOtherConfigSection"/> <argument name="enabledOption" value="Yes"/> <argument name="countryCode" value="hk"/> </actionGroup> - <actionGroup ref="EnablePayPalConfiguration" stepKey="EnableProHostedWithExpressCheckou"> + <actionGroup ref="EnablePayPalConfigurationActionGroup" stepKey="EnableProHostedWithExpressCheckou"> <argument name="payPalConfigType" value="WebsitePaymentsPlusConfigSection"/> <argument name="countryCode" value="hk"/> </actionGroup> - <actionGroup ref="CheckEnableOptionPayPalConfiguration" stepKey="checkWPSExpressIsDisabled"> + <actionGroup ref="CheckEnableOptionPayPalConfigurationActionGroup" stepKey="checkWPSExpressIsDisabled"> <argument name="payPalConfigType" value="WPSOtherConfigSection"/> <argument name="enabledOption" value="No"/> <argument name="countryCode" value="hk"/> </actionGroup> - <actionGroup ref="CheckEnableOptionPayPalConfiguration" stepKey="checkProHostedIsEnabled"> + <actionGroup ref="CheckEnableOptionPayPalConfigurationActionGroup" stepKey="checkProHostedIsEnabled"> <argument name="payPalConfigType" value="WebsitePaymentsPlusConfigSection"/> <argument name="enabledOption" value="Yes"/> <argument name="countryCode" value="hk"/> @@ -204,30 +204,30 @@ <group value="paypal"/> </annotations> <selectOption selector="{{PaymentsConfigSection.merchantCountry}}" userInput="Italy" stepKey="setMerchantCountry"/> - <actionGroup ref="EnablePayPalConfiguration" stepKey="EnableWPSExpress"> + <actionGroup ref="EnablePayPalConfigurationActionGroup" stepKey="EnableWPSExpress"> <argument name="payPalConfigType" value="WPSOtherConfigSection"/> <argument name="countryCode" value="it"/> </actionGroup> - <actionGroup ref="CheckEnableOptionPayPalConfiguration" stepKey="checkPayPalExpressIsDisabled"> + <actionGroup ref="CheckEnableOptionPayPalConfigurationActionGroup" stepKey="checkPayPalExpressIsDisabled"> <argument name="payPalConfigType" value="PayPalExpressCheckoutOtherCountryConfigSection"/> <argument name="enabledOption" value="No"/> <argument name="countryCode" value="it"/> </actionGroup> - <actionGroup ref="CheckEnableOptionPayPalConfiguration" stepKey="checkWPSExpressIsEnabled"> + <actionGroup ref="CheckEnableOptionPayPalConfigurationActionGroup" stepKey="checkWPSExpressIsEnabled"> <argument name="payPalConfigType" value="WPSOtherConfigSection"/> <argument name="enabledOption" value="Yes"/> <argument name="countryCode" value="it"/> </actionGroup> - <actionGroup ref="EnablePayPalConfiguration" stepKey="EnableProHostedWithExpressCheckou"> + <actionGroup ref="EnablePayPalConfigurationActionGroup" stepKey="EnableProHostedWithExpressCheckou"> <argument name="payPalConfigType" value="WebsitePaymentsPlusConfigSection"/> <argument name="countryCode" value="it"/> </actionGroup> - <actionGroup ref="CheckEnableOptionPayPalConfiguration" stepKey="checkWPSExpressIsDisabled"> + <actionGroup ref="CheckEnableOptionPayPalConfigurationActionGroup" stepKey="checkWPSExpressIsDisabled"> <argument name="payPalConfigType" value="WPSOtherConfigSection"/> <argument name="enabledOption" value="No"/> <argument name="countryCode" value="it"/> </actionGroup> - <actionGroup ref="CheckEnableOptionPayPalConfiguration" stepKey="checkProHostedIsEnabled"> + <actionGroup ref="CheckEnableOptionPayPalConfigurationActionGroup" stepKey="checkProHostedIsEnabled"> <argument name="payPalConfigType" value="WebsitePaymentsPlusConfigSection"/> <argument name="enabledOption" value="Yes"/> <argument name="countryCode" value="it"/> @@ -244,30 +244,30 @@ <group value="paypal"/> </annotations> <selectOption selector="{{PaymentsConfigSection.merchantCountry}}" userInput="Spain" stepKey="setMerchantCountry"/> - <actionGroup ref="EnablePayPalConfiguration" stepKey="EnableWPSExpress"> + <actionGroup ref="EnablePayPalConfigurationActionGroup" stepKey="EnableWPSExpress"> <argument name="payPalConfigType" value="WPSOtherConfigSection"/> <argument name="countryCode" value="es"/> </actionGroup> - <actionGroup ref="CheckEnableOptionPayPalConfiguration" stepKey="checkPayPalExpressIsDisabled"> + <actionGroup ref="CheckEnableOptionPayPalConfigurationActionGroup" stepKey="checkPayPalExpressIsDisabled"> <argument name="payPalConfigType" value="PayPalExpressCheckoutOtherCountryConfigSection"/> <argument name="enabledOption" value="No"/> <argument name="countryCode" value="es"/> </actionGroup> - <actionGroup ref="CheckEnableOptionPayPalConfiguration" stepKey="checkWPSExpressIsEnabled"> + <actionGroup ref="CheckEnableOptionPayPalConfigurationActionGroup" stepKey="checkWPSExpressIsEnabled"> <argument name="payPalConfigType" value="WPSOtherConfigSection"/> <argument name="enabledOption" value="Yes"/> <argument name="countryCode" value="es"/> </actionGroup> - <actionGroup ref="EnablePayPalConfiguration" stepKey="EnableProHostedWithExpressCheckou"> + <actionGroup ref="EnablePayPalConfigurationActionGroup" stepKey="EnableProHostedWithExpressCheckou"> <argument name="payPalConfigType" value="WebsitePaymentsPlusConfigSection"/> <argument name="countryCode" value="es"/> </actionGroup> - <actionGroup ref="CheckEnableOptionPayPalConfiguration" stepKey="checkWPSExpressIsDisabled"> + <actionGroup ref="CheckEnableOptionPayPalConfigurationActionGroup" stepKey="checkWPSExpressIsDisabled"> <argument name="payPalConfigType" value="WPSOtherConfigSection"/> <argument name="enabledOption" value="No"/> <argument name="countryCode" value="es"/> </actionGroup> - <actionGroup ref="CheckEnableOptionPayPalConfiguration" stepKey="checkProHostedIsEnabled"> + <actionGroup ref="CheckEnableOptionPayPalConfigurationActionGroup" stepKey="checkProHostedIsEnabled"> <argument name="payPalConfigType" value="WebsitePaymentsPlusConfigSection"/> <argument name="enabledOption" value="Yes"/> <argument name="countryCode" value="es"/> diff --git a/app/code/Magento/Paypal/Test/Mftf/Test/AdminOnePayPalSolutionsEnabledAtTheSameTimeTest.xml b/app/code/Magento/Paypal/Test/Mftf/Test/AdminOnePayPalSolutionsEnabledAtTheSameTimeTest.xml index c653c1f03fd74..fd0e74f38287d 100644 --- a/app/code/Magento/Paypal/Test/Mftf/Test/AdminOnePayPalSolutionsEnabledAtTheSameTimeTest.xml +++ b/app/code/Magento/Paypal/Test/Mftf/Test/AdminOnePayPalSolutionsEnabledAtTheSameTimeTest.xml @@ -39,13 +39,13 @@ <!--Try to enable express checkout Solution--> <comment userInput="Try to enable express checkout Solution" stepKey="commentTryEnableExpressCheckout"/> <amOnPage url="{{AdminConfigPaymentMethodsPage.url}}" stepKey="navigateToPaymentConfigurationPage"/> - <actionGroup ref="EnablePayPalSolutionWithoutSave" stepKey="enableExpressCheckout"> + <actionGroup ref="EnablePayPalSolutionWithoutSaveActionGroup" stepKey="enableExpressCheckout"> <argument name="payPalConfigType" value="WPSExpressConfigSection"/> <argument name="countryCode" value="us"/> </actionGroup> <click selector="{{AdminConfigSection.saveButton}}" stepKey="saveConfig"/> <waitForPageLoad stepKey="waitForPageLoad2"/> - <actionGroup ref="EnablePayPalSolutionWithoutSave" stepKey="enableExpressCheckout2"> + <actionGroup ref="EnablePayPalSolutionWithoutSaveActionGroup" stepKey="enableExpressCheckout2"> <argument name="payPalConfigType" value="PayPalExpressCheckoutConfigSection"/> <argument name="countryCode" value="us"/> </actionGroup> diff --git a/app/code/Magento/Paypal/Test/Mftf/Test/StorefrontCheckCreditButtonConfigurationTest.xml b/app/code/Magento/Paypal/Test/Mftf/Test/StorefrontCheckCreditButtonConfigurationTest.xml index d8cea82bcc2f5..78a27106bf406 100644 --- a/app/code/Magento/Paypal/Test/Mftf/Test/StorefrontCheckCreditButtonConfigurationTest.xml +++ b/app/code/Magento/Paypal/Test/Mftf/Test/StorefrontCheckCreditButtonConfigurationTest.xml @@ -65,7 +65,7 @@ <actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginAsCustomer"> <argument name="Customer" value="$$createCustomer$$"/> </actionGroup> - <actionGroup ref="addProductToCheckoutPage" stepKey="addProductToCheckoutPage"> + <actionGroup ref="AddProductToCheckoutPageActionGroup" stepKey="addProductToCheckoutPage"> <argument name="Category" value="$$createPreReqCategory$$"/> </actionGroup> <!--set ID for iframe of PayPal group button--> From 9f774144e527e81df731900005c249e2714f825c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 28 Nov 2019 21:27:24 +0100 Subject: [PATCH 0165/1143] REFACTOR: Replace redundant Action Group with the same one --- .../Mftf/ActionGroup/ClearCacheActionGroup.xml | 15 +-------------- .../Test/Mftf/Test/NewProductsListWidgetTest.xml | 14 +++++++------- 2 files changed, 8 insertions(+), 21 deletions(-) diff --git a/app/code/Magento/PageCache/Test/Mftf/ActionGroup/ClearCacheActionGroup.xml b/app/code/Magento/PageCache/Test/Mftf/ActionGroup/ClearCacheActionGroup.xml index 1eec4b40db68d..4bd68fa1e9929 100644 --- a/app/code/Magento/PageCache/Test/Mftf/ActionGroup/ClearCacheActionGroup.xml +++ b/app/code/Magento/PageCache/Test/Mftf/ActionGroup/ClearCacheActionGroup.xml @@ -12,23 +12,10 @@ <annotations> <description>Goes to the Admin Cache Management page. Clicks on 'Flush Magento Cache'.</description> </annotations> - + <amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}/admin/cache/" stepKey="goToNewCustomVarialePage"/> <waitForPageLoad stepKey="waitForPageLoad"/> <click selector="{{AdminCacheManagementSection.FlushMagentoCache}}" stepKey="clickFlushMagentoCache"/> <waitForPageLoad stepKey="waitForCacheFlush"/> </actionGroup> - - <actionGroup name="clearPageCache"> - <annotations> - <description>Goes to the Admin Cache Management page. Selects 'Refresh'. Checks the 'Page Cache' row. Clicks on Submit.</description> - </annotations> - - <amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}/admin/cache/" stepKey="amOnCacheManagementPage"/> - <waitForPageLoad stepKey="waitForCacheManagement"/> - <selectOption selector="{{AdminCacheManagementSection.massActionSelect}}" userInput="refresh" stepKey="selectRefresh"/> - <click selector="{{AdminCacheManagementSection.pageCacheCheckbox}}" stepKey="selectPageCache"/> - <click selector="{{AdminCacheManagementSection.massActionSubmit}}" stepKey="submitCacheForm"/> - <waitForPageLoad stepKey="waitForCacheFlush"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/PageCache/Test/Mftf/Test/NewProductsListWidgetTest.xml b/app/code/Magento/PageCache/Test/Mftf/Test/NewProductsListWidgetTest.xml index a3c9e7b39217d..e7dc40c20f4dd 100644 --- a/app/code/Magento/PageCache/Test/Mftf/Test/NewProductsListWidgetTest.xml +++ b/app/code/Magento/PageCache/Test/Mftf/Test/NewProductsListWidgetTest.xml @@ -9,21 +9,21 @@ <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="NewProductsListWidgetSimpleProductTest"> - <actionGroup ref="clearPageCache" stepKey="clearPageCache" before="amOnCmsPage"/> + <actionGroup ref="ClearPageCacheActionGroup" stepKey="clearPageCache" before="amOnCmsPage"/> </test> <test name="NewProductsListWidgetConfigurableProductTest"> - <actionGroup ref="clearPageCache" stepKey="clearPageCache" after="clickSaveProduct"/> + <actionGroup ref="ClearPageCacheActionGroup" stepKey="clearPageCache" after="clickSaveProduct"/> </test> <test name="NewProductsListWidgetGroupedProductTest"> - <actionGroup ref="clearPageCache" stepKey="clearPageCache" after="clickSaveProduct"/> + <actionGroup ref="ClearPageCacheActionGroup" stepKey="clearPageCache" after="clickSaveProduct"/> </test> <test name="NewProductsListWidgetVirtualProductTest"> - <actionGroup ref="clearPageCache" stepKey="clearPageCache" before="amOnCmsPage"/> + <actionGroup ref="ClearPageCacheActionGroup" stepKey="clearPageCache" before="amOnCmsPage"/> </test> <test name="NewProductsListWidgetBundleProductTest"> - <actionGroup ref="clearPageCache" stepKey="clearPageCache" after="clickSaveProduct"/> + <actionGroup ref="ClearPageCacheActionGroup" stepKey="clearPageCache" after="clickSaveProduct"/> </test> <test name="NewProductsListWidgetDownloadableProductTest"> - <actionGroup ref="clearPageCache" stepKey="clearPageCache" after="clickSaveProduct"/> + <actionGroup ref="ClearPageCacheActionGroup" stepKey="clearPageCache" after="clickSaveProduct"/> </test> -</tests> \ No newline at end of file +</tests> From 5f90f1aae78c7d20924a171bc03ca8a772c27426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 28 Nov 2019 21:36:20 +0100 Subject: [PATCH 0166/1143] REFACTOR: Extract Action Groups to separate files (according to MFTF best practices) --- .../CheckSubscribedNewsletterActionGroup.xml | 19 ++++++++ ...NewAccountNewsletterCheckedActionGroup.xml | 20 +++++++++ ...wAccountNewsletterUncheckedActionGroup.xml | 24 ++++++++++ ...l => SwitchToPreviewIframeActionGroup.xml} | 0 ...bscribedNewsletterDisplayedActionGroup.xml | 45 ------------------- ...erifySubscribedNewsletterDisplayedTest.xml | 4 +- 6 files changed, 65 insertions(+), 47 deletions(-) create mode 100644 app/code/Magento/Newsletter/Test/Mftf/ActionGroup/CheckSubscribedNewsletterActionGroup.xml create mode 100644 app/code/Magento/Newsletter/Test/Mftf/ActionGroup/StorefrontCreateNewAccountNewsletterCheckedActionGroup.xml create mode 100644 app/code/Magento/Newsletter/Test/Mftf/ActionGroup/StorefrontCreateNewAccountNewsletterUncheckedActionGroup.xml rename app/code/Magento/Newsletter/Test/Mftf/ActionGroup/{AdminNewsletterTemplateActionGroup.xml => SwitchToPreviewIframeActionGroup.xml} (100%) delete mode 100644 app/code/Magento/Newsletter/Test/Mftf/ActionGroup/VerifySubscribedNewsletterDisplayedActionGroup.xml diff --git a/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/CheckSubscribedNewsletterActionGroup.xml b/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/CheckSubscribedNewsletterActionGroup.xml new file mode 100644 index 0000000000000..feedd58c911aa --- /dev/null +++ b/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/CheckSubscribedNewsletterActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CheckSubscribedNewsletterActionGroup"> + <annotations> + <description>Goes to the Storefront Newsletter Management page. Validates that the 'Subscription' checkbox is checked.</description> + </annotations> + + <amOnPage url="{{StorefrontNewsletterManagePage.url}}" stepKey="goToNewsletterManage"/> + <seeCheckboxIsChecked selector="{{StorefrontNewsletterManageSection.subscriptionCheckbox}}" stepKey="checkSubscribedNewsletter"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/StorefrontCreateNewAccountNewsletterCheckedActionGroup.xml b/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/StorefrontCreateNewAccountNewsletterCheckedActionGroup.xml new file mode 100644 index 0000000000000..ff543febcd9a3 --- /dev/null +++ b/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/StorefrontCreateNewAccountNewsletterCheckedActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <!--Create an Account. Check Sign Up for Newsletter checkbox --> + <actionGroup name="StorefrontCreateNewAccountNewsletterCheckedActionGroup" extends="SignUpNewUserFromStorefrontActionGroup"> + <annotations> + <description>EXTENDS: SignUpNewUserFromStorefrontActionGroup. Clicks on 'Sign Up for Newsletter'. Validates that the Subscription Confirmation message is present and correct.</description> + </annotations> + + <click selector="{{StorefrontCustomerCreateFormSection.signUpForNewsletter}}" stepKey="selectSignUpForNewsletterCheckbox" after="fillLastName"/> + <see stepKey="seeDescriptionNewsletter" userInput='You are subscribed to "General Subscription".' selector="{{CustomerMyAccountPage.DescriptionNewsletter}}"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/StorefrontCreateNewAccountNewsletterUncheckedActionGroup.xml b/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/StorefrontCreateNewAccountNewsletterUncheckedActionGroup.xml new file mode 100644 index 0000000000000..d6b0adff53a86 --- /dev/null +++ b/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/StorefrontCreateNewAccountNewsletterUncheckedActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCreateNewAccountNewsletterUncheckedActionGroup" extends="SignUpNewUserFromStorefrontActionGroup"> + <annotations> + <description>EXTENDS: SignUpNewUserFromStorefrontActionGroup. Validates that the you are NOT subscribed message is present and correct.</description> + </annotations> + <arguments> + <argument name="Customer"/> + <argument name="Store"/> + </arguments> + + <amOnPage stepKey="amOnStorefrontPage" url="{{Store.code}}"/> + <see stepKey="seeDescriptionNewsletter" userInput="You aren't subscribed to our newsletter." selector="{{CustomerMyAccountPage.DescriptionNewsletter}}"/> + <see stepKey="seeThankYouMessage" userInput="Thank you for registering with NewStore."/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/AdminNewsletterTemplateActionGroup.xml b/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/SwitchToPreviewIframeActionGroup.xml similarity index 100% rename from app/code/Magento/Newsletter/Test/Mftf/ActionGroup/AdminNewsletterTemplateActionGroup.xml rename to app/code/Magento/Newsletter/Test/Mftf/ActionGroup/SwitchToPreviewIframeActionGroup.xml diff --git a/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/VerifySubscribedNewsletterDisplayedActionGroup.xml b/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/VerifySubscribedNewsletterDisplayedActionGroup.xml deleted file mode 100644 index 69b973dbddbda..0000000000000 --- a/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/VerifySubscribedNewsletterDisplayedActionGroup.xml +++ /dev/null @@ -1,45 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <!--Create an Account. Check Sign Up for Newsletter checkbox --> - <actionGroup name="StorefrontCreateNewAccountNewsletterChecked" extends="SignUpNewUserFromStorefrontActionGroup"> - <annotations> - <description>EXTENDS: SignUpNewUserFromStorefrontActionGroup. Clicks on 'Sign Up for Newsletter'. Validates that the Subscription Confirmation message is present and correct.</description> - </annotations> - - <click selector="{{StorefrontCustomerCreateFormSection.signUpForNewsletter}}" stepKey="selectSignUpForNewsletterCheckbox" after="fillLastName"/> - <see stepKey="seeDescriptionNewsletter" userInput='You are subscribed to "General Subscription".' selector="{{CustomerMyAccountPage.DescriptionNewsletter}}"/> - </actionGroup> - - <!--Create an Account. Uncheck Sign Up for Newsletter checkbox --> - <actionGroup name="StorefrontCreateNewAccountNewsletterUnchecked" extends="SignUpNewUserFromStorefrontActionGroup"> - <annotations> - <description>EXTENDS: SignUpNewUserFromStorefrontActionGroup. Validates that the you are NOT subscribed message is present and correct.</description> - </annotations> - <arguments> - <argument name="Customer"/> - <argument name="Store"/> - </arguments> - - <amOnPage stepKey="amOnStorefrontPage" url="{{Store.code}}"/> - <see stepKey="seeDescriptionNewsletter" userInput="You aren't subscribed to our newsletter." selector="{{CustomerMyAccountPage.DescriptionNewsletter}}"/> - <see stepKey="seeThankYouMessage" userInput="Thank you for registering with NewStore."/> - </actionGroup> - - <!--Check Subscribed Newsletter via StoreFront--> - <actionGroup name="CheckSubscribedNewsletterActionGroup"> - <annotations> - <description>Goes to the Storefront Newsletter Management page. Validates that the 'Subscription' checkbox is checked.</description> - </annotations> - - <amOnPage url="{{StorefrontNewsletterManagePage.url}}" stepKey="goToNewsletterManage"/> - <seeCheckboxIsChecked selector="{{StorefrontNewsletterManageSection.subscriptionCheckbox}}" stepKey="checkSubscribedNewsletter"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Newsletter/Test/Mftf/Test/VerifySubscribedNewsletterDisplayedTest.xml b/app/code/Magento/Newsletter/Test/Mftf/Test/VerifySubscribedNewsletterDisplayedTest.xml index 4d60b7676605e..2afeb8f8b0746 100644 --- a/app/code/Magento/Newsletter/Test/Mftf/Test/VerifySubscribedNewsletterDisplayedTest.xml +++ b/app/code/Magento/Newsletter/Test/Mftf/Test/VerifySubscribedNewsletterDisplayedTest.xml @@ -53,14 +53,14 @@ </after> <!--Go to store front (default) and click Create an Account.--> - <actionGroup ref="StorefrontCreateNewAccountNewsletterChecked" stepKey="SignUpNewUser"> + <actionGroup ref="StorefrontCreateNewAccountNewsletterCheckedActionGroup" stepKey="SignUpNewUser"> <argument name="Customer" value="CustomerEntityOne"/> </actionGroup> <!--Sign Out--> <amOnPage url="customer/account/logout/" stepKey="customerOnLogoutPage"/> <waitForPageLoad stepKey="waitLogoutCustomer"/> <!--Create new Account with the same email address. (unchecked Sign Up for Newsletter checkbox)--> - <actionGroup ref="StorefrontCreateNewAccountNewsletterUnchecked" stepKey="createNewAccountNewsletterUnchecked"> + <actionGroup ref="StorefrontCreateNewAccountNewsletterUncheckedActionGroup" stepKey="createNewAccountNewsletterUnchecked"> <argument name="Customer" value="CustomerEntityOne"/> <argument name="Store" value="staticStore"/> </actionGroup> From 5564c689d274012f97e4e8f63459bc33681727cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 28 Nov 2019 21:46:13 +0100 Subject: [PATCH 0167/1143] REFACTOR: Extract Action Groups to separate files (according to MFTF best practices) --- ...eckingWithMultipleAddressesActionGroup.xml | 26 +-------------- .../CheckingWithSingleAddressActionGroup.xml | 18 ++++++++++ .../ActionGroup/PlaceOrderActionGroup.xml | 10 ------ .../ActionGroup/ReviewOrderActionGroup.xml | 22 ------------- ...ReviewOrderForMultiShipmentActionGroup.xml | 33 +++++++++++++++++++ ...=> SelectMultiShippingInfoActionGroup.xml} | 15 +-------- .../SelectSingleShippingInfoActionGroup.xml | 20 +++++++++++ ...ingSelectMultipleAddressesActionGroup.xml} | 7 ---- ...eckoutWithMultipleAddressesActionGroup.xml | 15 +++++++++ ...eckoutWithMultipleAddressesActionGroup.xml | 14 ++++++++ ...frontGoToBillingInformationActionGroup.xml | 15 +++++++++ ...ngMethodsAndGoToBillingInfoActionGroup.xml | 15 +++++++++ ...ceOrderForMultipleAddressesActionGroup.xml | 21 ++++++++++++ .../StorefrontSaveAddressActionGroup.xml | 17 ++++++++++ .../StorefrontSelectAddressActionGroup.xml | 18 ++++++++++ ...utWhenCartPageIsOpenedInAnotherTabTest.xml | 2 +- 16 files changed, 189 insertions(+), 79 deletions(-) create mode 100644 app/code/Magento/Multishipping/Test/Mftf/ActionGroup/CheckingWithSingleAddressActionGroup.xml create mode 100644 app/code/Magento/Multishipping/Test/Mftf/ActionGroup/ReviewOrderForMultiShipmentActionGroup.xml rename app/code/Magento/Multishipping/Test/Mftf/ActionGroup/{SelectShippingInfoActionGroup.xml => SelectMultiShippingInfoActionGroup.xml} (62%) create mode 100644 app/code/Magento/Multishipping/Test/Mftf/ActionGroup/SelectSingleShippingInfoActionGroup.xml rename app/code/Magento/Multishipping/Test/Mftf/ActionGroup/{StorefrontMultishippingCheckoutActionGroup.xml => StorefrontCheckoutShippingSelectMultipleAddressesActionGroup.xml} (70%) create mode 100644 app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontCheckoutWithMultipleAddressesActionGroup.xml create mode 100644 app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontGoCheckoutWithMultipleAddressesActionGroup.xml create mode 100644 app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontGoToBillingInformationActionGroup.xml create mode 100644 app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontLeaveDefaultShippingMethodsAndGoToBillingInfoActionGroup.xml create mode 100644 app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontPlaceOrderForMultipleAddressesActionGroup.xml create mode 100644 app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontSaveAddressActionGroup.xml create mode 100644 app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontSelectAddressActionGroup.xml diff --git a/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/CheckingWithMultipleAddressesActionGroup.xml b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/CheckingWithMultipleAddressesActionGroup.xml index 34ce38bd0d935..a34e0627bd150 100644 --- a/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/CheckingWithMultipleAddressesActionGroup.xml +++ b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/CheckingWithMultipleAddressesActionGroup.xml @@ -7,13 +7,7 @@ --> <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> - <actionGroup name="CheckingWithSingleAddressActionGroup"> - <click selector="{{SingleShippingSection.checkoutWithMultipleAddresses}}" stepKey="clickOnCheckoutWithMultipleAddresses"/> - <waitForPageLoad stepKey="waitForMultipleAddressPageLoad"/> - <click selector="{{SingleShippingSection.goToShippingInfo}}" stepKey="goToShippingInformation"/> - <waitForPageLoad stepKey="waitForShippingPageLoad"/> - </actionGroup> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="CheckingWithMultipleAddressesActionGroup" extends="CheckingWithSingleAddressActionGroup"> <arguments> <argument name="addressOption1" type="string" defaultValue="1"/> @@ -27,22 +21,4 @@ <click selector="{{SingleShippingSection.updateAddress}}" after="selectSecondShippingMethod" stepKey="clickOnUpdateAddress"/> <waitForPageLoad after="clickOnUpdateAddress" stepKey="waitForShippingInformation"/> </actionGroup> - <actionGroup name="StorefrontCheckoutWithMultipleAddressesActionGroup"> - <click selector="{{SingleShippingSection.checkoutWithMultipleAddresses}}" stepKey="clickOnCheckoutWithMultipleAddresses"/> - <waitForPageLoad stepKey="waitForMultipleAddressPageLoad"/> - </actionGroup> - <actionGroup name="StorefrontSelectAddressActionGroup"> - <arguments> - <argument name="sequenceNumber" type="string" defaultValue="1"/> - <argument name="option" type="string" defaultValue="1"/> - </arguments> - <selectOption selector="{{MultishippingSection.selectShippingAddress(sequenceNumber)}}" userInput="{{option}}" stepKey="selectShippingAddress"/> - </actionGroup> - <actionGroup name="StorefrontSaveAddressActionGroup"> - <click selector="{{SingleShippingSection.updateAddress}}" stepKey="clickOnUpdateAddress"/> - <waitForPageLoad time="90" stepKey="waitForShippingInformationAfterUpdated"/> - <click selector="{{SingleShippingSection.goToShippingInfo}}" stepKey="goToShippingInformation"/> - <waitForPageLoad stepKey="waitForShippingPageLoad"/> - </actionGroup> </actionGroups> - diff --git a/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/CheckingWithSingleAddressActionGroup.xml b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/CheckingWithSingleAddressActionGroup.xml new file mode 100644 index 0000000000000..d911488925427 --- /dev/null +++ b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/CheckingWithSingleAddressActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <actionGroup name="CheckingWithSingleAddressActionGroup"> + <click selector="{{SingleShippingSection.checkoutWithMultipleAddresses}}" stepKey="clickOnCheckoutWithMultipleAddresses"/> + <waitForPageLoad stepKey="waitForMultipleAddressPageLoad"/> + <click selector="{{SingleShippingSection.goToShippingInfo}}" stepKey="goToShippingInformation"/> + <waitForPageLoad stepKey="waitForShippingPageLoad"/> + </actionGroup> +</actionGroups> + diff --git a/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/PlaceOrderActionGroup.xml b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/PlaceOrderActionGroup.xml index 871c71de522c7..8cfbe2665d685 100644 --- a/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/PlaceOrderActionGroup.xml +++ b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/PlaceOrderActionGroup.xml @@ -13,14 +13,4 @@ <waitForPageLoad stepKey="waitForSuccessfullyPlacedOrder"/> <see selector="{{CheckoutSuccessMainSection.successTitle}}" userInput="Thank you for your purchase!" stepKey="waitForLoadSuccessPage"/> </actionGroup> - <actionGroup name="StorefrontPlaceOrderForMultipleAddressesActionGroup" extends="PlaceOrderActionGroup"> - <arguments> - <argument name="firstOrderPosition" type="string" defaultValue="1"/> - <argument name="secondOrderPosition" type="string" defaultValue="2"/> - </arguments> - <grabTextFrom selector="{{StorefrontSalesOrderSection.orderLinkByPosition(firstOrderPosition)}}" after="waitForLoadSuccessPage" stepKey="getFirstOrderId"/> - <grabAttributeFrom selector="{{StorefrontSalesOrderSection.orderLinkByPosition(firstOrderPosition)}}" userInput="href" after="getFirstOrderId" stepKey="dataHrefForFirstOrder"/> - <grabTextFrom selector="{{StorefrontSalesOrderSection.orderLinkByPosition(secondOrderPosition)}}" after="dataHrefForFirstOrder" stepKey="getSecondOrderId"/> - <grabAttributeFrom selector="{{StorefrontSalesOrderSection.orderLinkByPosition(secondOrderPosition)}}" userInput="href" after="getSecondOrderId" stepKey="dataHrefForSecondOrder"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/ReviewOrderActionGroup.xml b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/ReviewOrderActionGroup.xml index 638c5dd8dde61..8a63c42006443 100644 --- a/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/ReviewOrderActionGroup.xml +++ b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/ReviewOrderActionGroup.xml @@ -20,26 +20,4 @@ <actualResult type="string">$shippingMethodBasePrice</actualResult> </assertEquals> </actionGroup> - <actionGroup name="ReviewOrderForMultiShipmentActionGroup"> - <arguments> - <argument name="totalNameForFirstOrder" type="string" defaultValue="Shipping & Handling"/> - <argument name="totalPositionForFirstOrder" type="string" defaultValue="1"/> - <argument name="totalNameForSecondOrder" type="string" defaultValue="Shipping & Handling"/> - <argument name="totalPositionForSecondOrder" type="string" defaultValue="2"/> - </arguments> - <!--Check First Shipping Method Price--> - <grabTextFrom selector="{{ReviewOrderSection.shippingMethodBasePrice(totalPositionForFirstOrder)}}" stepKey="firstShippingMethodBasePrice"/> - <grabTextFrom selector="{{ReviewOrderSection.shippingMethodSubtotalPrice(totalPositionForFirstOrder,totalNameForFirstOrder)}}" stepKey="firstShippingMethodSubtotalPrice"/> - <assertEquals stepKey="assertShippingMethodPrice"> - <expectedResult type="string">$firstShippingMethodSubtotalPrice</expectedResult> - <actualResult type="string">$firstShippingMethodBasePrice</actualResult> - </assertEquals> - <!--Check Second Shipping Method Price--> - <grabTextFrom selector="{{ReviewOrderSection.shippingMethodBasePrice(totalPositionForSecondOrder)}}" stepKey="secondShippingMethodBasePrice"/> - <grabTextFrom selector="{{ReviewOrderSection.shippingMethodSubtotalPrice(totalPositionForSecondOrder,totalNameForSecondOrder)}}" stepKey="secondShippingMethodSubtotalPrice"/> - <assertEquals stepKey="assertSecondShippingMethodPrice" > - <expectedResult type="string">$secondShippingMethodSubtotalPrice</expectedResult> - <actualResult type="string">$secondShippingMethodBasePrice</actualResult> - </assertEquals> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/ReviewOrderForMultiShipmentActionGroup.xml b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/ReviewOrderForMultiShipmentActionGroup.xml new file mode 100644 index 0000000000000..3a95c7779d596 --- /dev/null +++ b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/ReviewOrderForMultiShipmentActionGroup.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ReviewOrderForMultiShipmentActionGroup"> + <arguments> + <argument name="totalNameForFirstOrder" type="string" defaultValue="Shipping & Handling"/> + <argument name="totalPositionForFirstOrder" type="string" defaultValue="1"/> + <argument name="totalNameForSecondOrder" type="string" defaultValue="Shipping & Handling"/> + <argument name="totalPositionForSecondOrder" type="string" defaultValue="2"/> + </arguments> + <!--Check First Shipping Method Price--> + <grabTextFrom selector="{{ReviewOrderSection.shippingMethodBasePrice(totalPositionForFirstOrder)}}" stepKey="firstShippingMethodBasePrice"/> + <grabTextFrom selector="{{ReviewOrderSection.shippingMethodSubtotalPrice(totalPositionForFirstOrder,totalNameForFirstOrder)}}" stepKey="firstShippingMethodSubtotalPrice"/> + <assertEquals stepKey="assertShippingMethodPrice"> + <expectedResult type="string">$firstShippingMethodSubtotalPrice</expectedResult> + <actualResult type="string">$firstShippingMethodBasePrice</actualResult> + </assertEquals> + <!--Check Second Shipping Method Price--> + <grabTextFrom selector="{{ReviewOrderSection.shippingMethodBasePrice(totalPositionForSecondOrder)}}" stepKey="secondShippingMethodBasePrice"/> + <grabTextFrom selector="{{ReviewOrderSection.shippingMethodSubtotalPrice(totalPositionForSecondOrder,totalNameForSecondOrder)}}" stepKey="secondShippingMethodSubtotalPrice"/> + <assertEquals stepKey="assertSecondShippingMethodPrice" > + <expectedResult type="string">$secondShippingMethodSubtotalPrice</expectedResult> + <actualResult type="string">$secondShippingMethodBasePrice</actualResult> + </assertEquals> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/SelectShippingInfoActionGroup.xml b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/SelectMultiShippingInfoActionGroup.xml similarity index 62% rename from app/code/Magento/Multishipping/Test/Mftf/ActionGroup/SelectShippingInfoActionGroup.xml rename to app/code/Magento/Multishipping/Test/Mftf/ActionGroup/SelectMultiShippingInfoActionGroup.xml index a5aac6b32011b..9da09a524184d 100644 --- a/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/SelectShippingInfoActionGroup.xml +++ b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/SelectMultiShippingInfoActionGroup.xml @@ -7,15 +7,7 @@ --> <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> - <actionGroup name="SelectSingleShippingInfoActionGroup"> - <arguments> - <argument name="shippingMethodType" type="string" defaultValue="Fixed"/> - </arguments> - <selectOption selector="{{ShippingMethodSection.shippingMethodRadioButton}}" userInput="{{shippingMethodType}}" stepKey="selectShippingMethod"/> - <waitForPageLoad stepKey="waitForRadioOptions"/> - <click selector="{{ShippingMethodSection.goToBillingInfo}}" stepKey="goToBillingInformation"/> - </actionGroup> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="SelectMultiShippingInfoActionGroup"> <arguments> <argument name="shippingMethodPosition1" type="string" defaultValue="1"/> @@ -29,9 +21,4 @@ <waitForPageLoad stepKey="waitForRadioOptions"/> <click selector="{{ShippingMethodSection.goToBillingInfo}}" stepKey="goToBillingInformation"/> </actionGroup> - <actionGroup name="StorefrontLeaveDefaultShippingMethodsAndGoToBillingInfoActionGroup"> - <waitForPageLoad stepKey="waitForShippingInfo"/> - <click selector="{{ShippingMethodSection.goToBillingInfo}}" stepKey="goToBillingInformation"/> - </actionGroup> </actionGroups> - diff --git a/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/SelectSingleShippingInfoActionGroup.xml b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/SelectSingleShippingInfoActionGroup.xml new file mode 100644 index 0000000000000..329f1451788cd --- /dev/null +++ b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/SelectSingleShippingInfoActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <actionGroup name="SelectSingleShippingInfoActionGroup"> + <arguments> + <argument name="shippingMethodType" type="string" defaultValue="Fixed"/> + </arguments> + <selectOption selector="{{ShippingMethodSection.shippingMethodRadioButton}}" userInput="{{shippingMethodType}}" stepKey="selectShippingMethod"/> + <waitForPageLoad stepKey="waitForRadioOptions"/> + <click selector="{{ShippingMethodSection.goToBillingInfo}}" stepKey="goToBillingInformation"/> + </actionGroup> +</actionGroups> + diff --git a/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontMultishippingCheckoutActionGroup.xml b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontCheckoutShippingSelectMultipleAddressesActionGroup.xml similarity index 70% rename from app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontMultishippingCheckoutActionGroup.xml rename to app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontCheckoutShippingSelectMultipleAddressesActionGroup.xml index c5dee010239d7..b698f00078bd6 100644 --- a/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontMultishippingCheckoutActionGroup.xml +++ b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontCheckoutShippingSelectMultipleAddressesActionGroup.xml @@ -17,12 +17,5 @@ <selectOption selector="{{StorefrontCheckoutShippingMultipleAddressesSection.selectedMultipleShippingAddress('2')}}" userInput="{{secondAddress}}" stepKey="selectShippingAddressForTheSecondItem"/> <click selector="{{CheckoutSuccessMainSection.continueShoppingButton}}" stepKey="clickToGoToInformationButton"/> </actionGroup> - <actionGroup name="StorefrontGoCheckoutWithMultipleAddresses"> - <click selector="{{MultishippingSection.shippingMultipleCheckout}}" stepKey="clickToMultipleAddressShippingButton"/> - </actionGroup> - <actionGroup name="StorefrontGoToBillingInformationActionGroup"> - <click selector="{{StorefrontMultipleShippingMethodSection.continueToBillingInformationButton}}" stepKey="clickToContinueToBillingInformationButton"/> - <waitForPageLoad stepKey="waitForBillingPage"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontCheckoutWithMultipleAddressesActionGroup.xml b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontCheckoutWithMultipleAddressesActionGroup.xml new file mode 100644 index 0000000000000..f7d6ea6711f89 --- /dev/null +++ b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontCheckoutWithMultipleAddressesActionGroup.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCheckoutWithMultipleAddressesActionGroup"> + <click selector="{{SingleShippingSection.checkoutWithMultipleAddresses}}" stepKey="clickOnCheckoutWithMultipleAddresses"/> + <waitForPageLoad stepKey="waitForMultipleAddressPageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontGoCheckoutWithMultipleAddressesActionGroup.xml b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontGoCheckoutWithMultipleAddressesActionGroup.xml new file mode 100644 index 0000000000000..fd57a3b095a3d --- /dev/null +++ b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontGoCheckoutWithMultipleAddressesActionGroup.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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontGoCheckoutWithMultipleAddressesActionGroup"> + <click selector="{{MultishippingSection.shippingMultipleCheckout}}" stepKey="clickToMultipleAddressShippingButton"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontGoToBillingInformationActionGroup.xml b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontGoToBillingInformationActionGroup.xml new file mode 100644 index 0000000000000..baca62007d3cb --- /dev/null +++ b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontGoToBillingInformationActionGroup.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontGoToBillingInformationActionGroup"> + <click selector="{{StorefrontMultipleShippingMethodSection.continueToBillingInformationButton}}" stepKey="clickToContinueToBillingInformationButton"/> + <waitForPageLoad stepKey="waitForBillingPage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontLeaveDefaultShippingMethodsAndGoToBillingInfoActionGroup.xml b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontLeaveDefaultShippingMethodsAndGoToBillingInfoActionGroup.xml new file mode 100644 index 0000000000000..1054d9b7d9160 --- /dev/null +++ b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontLeaveDefaultShippingMethodsAndGoToBillingInfoActionGroup.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontLeaveDefaultShippingMethodsAndGoToBillingInfoActionGroup"> + <waitForPageLoad stepKey="waitForShippingInfo"/> + <click selector="{{ShippingMethodSection.goToBillingInfo}}" stepKey="goToBillingInformation"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontPlaceOrderForMultipleAddressesActionGroup.xml b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontPlaceOrderForMultipleAddressesActionGroup.xml new file mode 100644 index 0000000000000..8391a16f81b6d --- /dev/null +++ b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontPlaceOrderForMultipleAddressesActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontPlaceOrderForMultipleAddressesActionGroup" extends="PlaceOrderActionGroup"> + <arguments> + <argument name="firstOrderPosition" type="string" defaultValue="1"/> + <argument name="secondOrderPosition" type="string" defaultValue="2"/> + </arguments> + <grabTextFrom selector="{{StorefrontSalesOrderSection.orderLinkByPosition(firstOrderPosition)}}" after="waitForLoadSuccessPage" stepKey="getFirstOrderId"/> + <grabAttributeFrom selector="{{StorefrontSalesOrderSection.orderLinkByPosition(firstOrderPosition)}}" userInput="href" after="getFirstOrderId" stepKey="dataHrefForFirstOrder"/> + <grabTextFrom selector="{{StorefrontSalesOrderSection.orderLinkByPosition(secondOrderPosition)}}" after="dataHrefForFirstOrder" stepKey="getSecondOrderId"/> + <grabAttributeFrom selector="{{StorefrontSalesOrderSection.orderLinkByPosition(secondOrderPosition)}}" userInput="href" after="getSecondOrderId" stepKey="dataHrefForSecondOrder"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontSaveAddressActionGroup.xml b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontSaveAddressActionGroup.xml new file mode 100644 index 0000000000000..c977c94b4e590 --- /dev/null +++ b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontSaveAddressActionGroup.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontSaveAddressActionGroup"> + <click selector="{{SingleShippingSection.updateAddress}}" stepKey="clickOnUpdateAddress"/> + <waitForPageLoad time="90" stepKey="waitForShippingInformationAfterUpdated"/> + <click selector="{{SingleShippingSection.goToShippingInfo}}" stepKey="goToShippingInformation"/> + <waitForPageLoad stepKey="waitForShippingPageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontSelectAddressActionGroup.xml b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontSelectAddressActionGroup.xml new file mode 100644 index 0000000000000..9a20c325df7a6 --- /dev/null +++ b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontSelectAddressActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontSelectAddressActionGroup"> + <arguments> + <argument name="sequenceNumber" type="string" defaultValue="1"/> + <argument name="option" type="string" defaultValue="1"/> + </arguments> + <selectOption selector="{{MultishippingSection.selectShippingAddress(sequenceNumber)}}" userInput="{{option}}" stepKey="selectShippingAddress"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontProcessMultishippingCheckoutWhenCartPageIsOpenedInAnotherTabTest.xml b/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontProcessMultishippingCheckoutWhenCartPageIsOpenedInAnotherTabTest.xml index fd79d4d954cd4..cb333a16dfb96 100644 --- a/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontProcessMultishippingCheckoutWhenCartPageIsOpenedInAnotherTabTest.xml +++ b/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontProcessMultishippingCheckoutWhenCartPageIsOpenedInAnotherTabTest.xml @@ -62,7 +62,7 @@ <amOnPage url="{{CheckoutCartPage.url}}" stepKey="amOnShoppingCartPage"/> <!-- Click 'Check Out with Multiple Addresses' --> <waitForPageLoad stepKey="waitForSecondPageLoad"/> - <actionGroup ref="StorefrontGoCheckoutWithMultipleAddresses" stepKey="goCheckoutWithMultipleAddresses"/> + <actionGroup ref="StorefrontGoCheckoutWithMultipleAddressesActionGroup" stepKey="goCheckoutWithMultipleAddresses"/> <!-- Select different addresses and click 'Go to Shipping Information' --> <actionGroup ref="StorefrontCheckoutShippingSelectMultipleAddressesActionGroup" stepKey="selectMultipleAddresses"> <argument name="firstAddress" value="{{UK_Not_Default_Address.street[0]}}"/> From 02e83cabc83534c1bebcd4e90b0a29ab87e5e70a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 28 Nov 2019 21:52:28 +0100 Subject: [PATCH 0168/1143] REFACTOR: Extract Action Groups to separate files (according to MFTF best practices) --- ...oductQuickSearchUsingElasticSearchTest.xml | 6 ++--- ...=> UpdateIndexerByScheduleActionGroup.xml} | 19 +------------ .../UpdateIndexerOnSaveActionGroup.xml | 27 +++++++++++++++++++ 3 files changed, 31 insertions(+), 21 deletions(-) rename app/code/Magento/Indexer/Test/Mftf/ActionGroup/{IndexerActionGroup.xml => UpdateIndexerByScheduleActionGroup.xml} (54%) create mode 100644 app/code/Magento/Indexer/Test/Mftf/ActionGroup/UpdateIndexerOnSaveActionGroup.xml diff --git a/app/code/Magento/Elasticsearch/Test/Mftf/Test/ProductQuickSearchUsingElasticSearchTest.xml b/app/code/Magento/Elasticsearch/Test/Mftf/Test/ProductQuickSearchUsingElasticSearchTest.xml index d8ce091fba76f..d2df6119aa98a 100644 --- a/app/code/Magento/Elasticsearch/Test/Mftf/Test/ProductQuickSearchUsingElasticSearchTest.xml +++ b/app/code/Magento/Elasticsearch/Test/Mftf/Test/ProductQuickSearchUsingElasticSearchTest.xml @@ -29,7 +29,7 @@ <deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/> <deleteData createDataKey="categoryFirst" stepKey="deleteCategory"/> <actionGroup ref="ResetSearchEngineConfiguration" stepKey="resetCatalogSearchConfiguration"/> - <actionGroup ref="updateIndexerOnSave" stepKey="resetIndexerBackToOriginalState"> + <actionGroup ref="UpdateIndexerOnSaveActionGroup" stepKey="resetIndexerBackToOriginalState"> <argument name="indexerName" value="catalogsearch_fulltext"/> </actionGroup> <actionGroup ref="logout" stepKey="logoutOfAdmin"/> @@ -39,7 +39,7 @@ <comment userInput="Change Catalog search engine option to Elastic Search 5.0+" stepKey="chooseElasticSearch5"/> <actionGroup ref="ChooseElasticSearchAsSearchEngine" stepKey="chooseES5"/> <actionGroup ref="ClearPageCacheActionGroup" stepKey="clearing"/> - <actionGroup ref="updateIndexerBySchedule" stepKey="updateAnIndexerBySchedule"> + <actionGroup ref="UpdateIndexerByScheduleActionGroup" stepKey="updateAnIndexerBySchedule"> <argument name="indexerName" value="catalogsearch_fulltext"/> </actionGroup> <actionGroup ref="logout" stepKey="logoutOfAdmin"/> @@ -57,4 +57,4 @@ <comment userInput="End of searching products" stepKey="endOfSearchingProducts"/> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin2"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Indexer/Test/Mftf/ActionGroup/IndexerActionGroup.xml b/app/code/Magento/Indexer/Test/Mftf/ActionGroup/UpdateIndexerByScheduleActionGroup.xml similarity index 54% rename from app/code/Magento/Indexer/Test/Mftf/ActionGroup/IndexerActionGroup.xml rename to app/code/Magento/Indexer/Test/Mftf/ActionGroup/UpdateIndexerByScheduleActionGroup.xml index 642982f37866f..04a5b97469c8e 100644 --- a/app/code/Magento/Indexer/Test/Mftf/ActionGroup/IndexerActionGroup.xml +++ b/app/code/Magento/Indexer/Test/Mftf/ActionGroup/UpdateIndexerByScheduleActionGroup.xml @@ -8,7 +8,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="updateIndexerBySchedule"> + <actionGroup name="UpdateIndexerByScheduleActionGroup"> <annotations> <description>Goes to the Index Management page. Checks the provided Indexer Name. Selects 'Update by Schedule'. Clicks on Submit.</description> </annotations> @@ -24,21 +24,4 @@ <!-- No re-indexing is done as part of this actionGroup since the test required no re-indexing --> <waitForPageLoad stepKey="waitForSave"/> </actionGroup> - - <actionGroup name="updateIndexerOnSave"> - <annotations> - <description>Goes to the Index Management page. Checks the provided Indexer Name. Selects 'Update on Save'. Clicks on Submit.</description> - </annotations> - <arguments> - <argument name="indexerName" type="string"/> - </arguments> - - <amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}/indexer/indexer/list/" stepKey="amOnIndexManagementPage2"/> - <waitForPageLoad stepKey="waitForIndexManagementPageToLoad2"/> - <click selector="{{AdminIndexManagementSection.indexerCheckbox(indexerName)}}" stepKey="selectIndexer2"/> - <selectOption selector="{{AdminIndexManagementSection.massActionSelect}}" userInput="change_mode_onthefly" stepKey="selectUpdateOnSave"/> - <click selector="{{AdminIndexManagementSection.massActionSubmit}}" stepKey="submitIndexerForm2"/> - <!-- No re-indexing is done as part of this actionGroup since the test required no re-indexing --> - <waitForPageLoad stepKey="waitForSave2"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Indexer/Test/Mftf/ActionGroup/UpdateIndexerOnSaveActionGroup.xml b/app/code/Magento/Indexer/Test/Mftf/ActionGroup/UpdateIndexerOnSaveActionGroup.xml new file mode 100644 index 0000000000000..65be57a335006 --- /dev/null +++ b/app/code/Magento/Indexer/Test/Mftf/ActionGroup/UpdateIndexerOnSaveActionGroup.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="UpdateIndexerOnSaveActionGroup"> + <annotations> + <description>Goes to the Index Management page. Checks the provided Indexer Name. Selects 'Update on Save'. Clicks on Submit.</description> + </annotations> + <arguments> + <argument name="indexerName" type="string"/> + </arguments> + + <amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}/indexer/indexer/list/" stepKey="amOnIndexManagementPage2"/> + <waitForPageLoad stepKey="waitForIndexManagementPageToLoad2"/> + <click selector="{{AdminIndexManagementSection.indexerCheckbox(indexerName)}}" stepKey="selectIndexer2"/> + <selectOption selector="{{AdminIndexManagementSection.massActionSelect}}" userInput="change_mode_onthefly" stepKey="selectUpdateOnSave"/> + <click selector="{{AdminIndexManagementSection.massActionSubmit}}" stepKey="submitIndexerForm2"/> + <!-- No re-indexing is done as part of this actionGroup since the test required no re-indexing --> + <waitForPageLoad stepKey="waitForSave2"/> + </actionGroup> +</actionGroups> From 439132a5de79fe2c37dc277cc4de6ff2ed18d849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 28 Nov 2019 21:58:33 +0100 Subject: [PATCH 0169/1143] REFACTOR: Extract Action Groups to separate files (according to MFTF best practices) --- .../AdminAssignProductToGroupActionGroup.xml | 29 ++++++ .../AdminGroupedProductActionGroup.xml | 92 ------------------- ...dFieldsInGroupedProductFormActionGroup.xml | 37 ++++++++ ...rLinkedToGroupProductInGridActionGroup.xml | 22 +++++ .../FillGroupedProductFormActionGroup.xml | 22 +++++ ...ewGroupedProductInAdminGridActionGroup.xml | 30 ++++++ 6 files changed, 140 insertions(+), 92 deletions(-) create mode 100644 app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/AdminAssignProductToGroupActionGroup.xml delete mode 100644 app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/AdminGroupedProductActionGroup.xml create mode 100644 app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/CheckRequiredFieldsInGroupedProductFormActionGroup.xml create mode 100644 app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/FillDefaultQuantityForLinkedToGroupProductInGridActionGroup.xml create mode 100644 app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/FillGroupedProductFormActionGroup.xml create mode 100644 app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/ViewGroupedProductInAdminGridActionGroup.xml diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/AdminAssignProductToGroupActionGroup.xml b/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/AdminAssignProductToGroupActionGroup.xml new file mode 100644 index 0000000000000..fa1b24616ee6f --- /dev/null +++ b/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/AdminAssignProductToGroupActionGroup.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAssignProductToGroupActionGroup"> + <annotations> + <description>Adds the provided Product to a Grouped Product on an Admin Grouped Product creation/edit page.</description> + </annotations> + <arguments> + <argument name="product"/> + </arguments> + + <scrollTo selector="{{AdminProductFormGroupedProductsSection.toggleGroupedProduct}}" x="0" y="-100" stepKey="scrollToGroupedSection"/> + <conditionalClick selector="{{AdminProductFormGroupedProductsSection.toggleGroupedProduct}}" dependentSelector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" visible="false" stepKey="openGroupedProductsSection"/> + <click selector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" stepKey="clickAddProductsToGroup"/> + <conditionalClick selector="{{AdminAddProductsToGroupPanel.clearFilters}}" dependentSelector="{{AdminAddProductsToGroupPanel.clearFilters}}" visible="true" stepKey="clearExistingFilters"/> + <click selector="{{AdminAddProductsToGroupPanel.filters}}" stepKey="showFiltersPanel"/> + <fillField userInput="{{product.name}}" selector="{{AdminAddProductsToGroupPanel.nameFilter}}" stepKey="fillNameFilter"/> + <click selector="{{AdminAddProductsToGroupPanel.applyFilters}}" stepKey="clickApplyFilters"/> + <click selector="{{AdminAddProductsToGroupPanel.firstCheckbox}}" stepKey="selectProduct"/> + <click selector="{{AdminAddProductsToGroupPanel.addSelectedProducts}}" stepKey="clickAddSelectedGroupProducts"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/AdminGroupedProductActionGroup.xml b/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/AdminGroupedProductActionGroup.xml deleted file mode 100644 index 7b44697880a70..0000000000000 --- a/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/AdminGroupedProductActionGroup.xml +++ /dev/null @@ -1,92 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <!--Check that required fields are actually required--> - <actionGroup name="checkRequiredFieldsInGroupedProductForm"> - <annotations> - <description>Clears the Product Name and SKU fields when adding a Grouped Product and then verifies that they are required after attempting to Save.</description> - </annotations> - - <clearField selector="{{AdminProductFormSection.productName}}" stepKey="clearProductSku"/> - <clearField selector="{{AdminProductFormSection.productSku}}" stepKey="clearProductName"/> - <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveButton"/> - <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Product" stepKey="seeStillOnEditPage"/> - <see selector="{{AdminProductFormSection.fieldError('name')}}" userInput="This is a required field." stepKey="seeNameRequired"/> - <see selector="{{AdminProductFormSection.fieldError('sku')}}" userInput="This is a required field." stepKey="seeSkuRequired"/> - </actionGroup> - - <!--Fill main fields in grouped product form--> - <actionGroup name="fillGroupedProductForm"> - <annotations> - <description>Fills in the provided Product Name and SKU on the Grouped Product creation/edit page.</description> - </annotations> - <arguments> - <argument name="product" defaultValue="GroupedProduct"/> - </arguments> - - <fillField selector="{{AdminProductFormSection.productName}}" userInput="{{product.name}}" stepKey="fillProductSku"/> - <fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="fillProductName"/> - </actionGroup> - - <!--Filter product grid and see expected grouped product--> - <actionGroup name="viewGroupedProductInAdminGrid"> - <annotations> - <description>Goes to the Admin Products grid page. Filters the grid for the provided Product. Validates that the provided Product appears in the grid.</description> - </annotations> - <arguments> - <argument name="product" defaultValue="GroupedProduct"/> - </arguments> - - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> - <waitForPageLoad stepKey="waitForPageLoadInitial"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> - <fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="{{product.name}}" stepKey="fillProductNameFilter"/> - <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillProductSkuFilter"/> - <selectOption selector="{{AdminProductGridFilterSection.typeFilter}}" userInput="{{product.type_id}}" stepKey="selectionProductType"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> - <see selector="{{AdminProductGridSection.firstProductRow}}" userInput="{{product.name}}" stepKey="seeProductNameInGrid"/> - <click selector="{{AdminProductGridFilterSection.clearFilters}}" stepKey="clickClearFiltersAfter"/> - </actionGroup> - - <!--Fill product min quantity in group products grid--> - <actionGroup name="fillDefaultQuantityForLinkedToGroupProductInGrid"> - <annotations> - <description>Fills the provided Qty for a Product linked to a Grouped Product.</description> - </annotations> - <arguments> - <argument name="productName" type="string"/> - <argument name="qty" type="string"/> - </arguments> - - <fillField selector="{{AdminAddedProductsToGroupGrid.inputByProductName(productName)}}" userInput="{{qty}}" stepKey="fillDefaultQtyForLinkedProduct"/> - </actionGroup> - - <!-- Assign Specified Product To Grouped Product --> - <!-- Assumes web client is on grouped product edit page --> - <actionGroup name="AdminAssignProductToGroup"> - <annotations> - <description>Adds the provided Product to a Grouped Product on an Admin Grouped Product creation/edit page.</description> - </annotations> - <arguments> - <argument name="product"/> - </arguments> - - <scrollTo selector="{{AdminProductFormGroupedProductsSection.toggleGroupedProduct}}" x="0" y="-100" stepKey="scrollToGroupedSection"/> - <conditionalClick selector="{{AdminProductFormGroupedProductsSection.toggleGroupedProduct}}" dependentSelector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" visible="false" stepKey="openGroupedProductsSection"/> - <click selector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" stepKey="clickAddProductsToGroup"/> - <conditionalClick selector="{{AdminAddProductsToGroupPanel.clearFilters}}" dependentSelector="{{AdminAddProductsToGroupPanel.clearFilters}}" visible="true" stepKey="clearExistingFilters"/> - <click selector="{{AdminAddProductsToGroupPanel.filters}}" stepKey="showFiltersPanel"/> - <fillField userInput="{{product.name}}" selector="{{AdminAddProductsToGroupPanel.nameFilter}}" stepKey="fillNameFilter"/> - <click selector="{{AdminAddProductsToGroupPanel.applyFilters}}" stepKey="clickApplyFilters"/> - <click selector="{{AdminAddProductsToGroupPanel.firstCheckbox}}" stepKey="selectProduct"/> - <click selector="{{AdminAddProductsToGroupPanel.addSelectedProducts}}" stepKey="clickAddSelectedGroupProducts"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/CheckRequiredFieldsInGroupedProductFormActionGroup.xml b/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/CheckRequiredFieldsInGroupedProductFormActionGroup.xml new file mode 100644 index 0000000000000..26257dd98673c --- /dev/null +++ b/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/CheckRequiredFieldsInGroupedProductFormActionGroup.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <!--Check that required fields are actually required--> + <actionGroup name="CheckRequiredFieldsInGroupedProductFormActionGroup"> + <annotations> + <description>Clears the Product Name and SKU fields when adding a Grouped Product and then verifies that they are required after attempting to Save.</description> + </annotations> + + <clearField selector="{{AdminProductFormSection.productName}}" stepKey="clearProductSku"/> + <clearField selector="{{AdminProductFormSection.productSku}}" stepKey="clearProductName"/> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveButton"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Product" stepKey="seeStillOnEditPage"/> + <see selector="{{AdminProductFormSection.fieldError('name')}}" userInput="This is a required field." stepKey="seeNameRequired"/> + <see selector="{{AdminProductFormSection.fieldError('sku')}}" userInput="This is a required field." stepKey="seeSkuRequired"/> + </actionGroup> + + <!--Fill main fields in grouped product form--> + + + <!--Filter product grid and see expected grouped product--> + + + <!--Fill product min quantity in group products grid--> + + + <!-- Assign Specified Product To Grouped Product --> + <!-- Assumes web client is on grouped product edit page --> + +</actionGroups> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/FillDefaultQuantityForLinkedToGroupProductInGridActionGroup.xml b/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/FillDefaultQuantityForLinkedToGroupProductInGridActionGroup.xml new file mode 100644 index 0000000000000..faa39eb70cced --- /dev/null +++ b/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/FillDefaultQuantityForLinkedToGroupProductInGridActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FillDefaultQuantityForLinkedToGroupProductInGridActionGroup"> + <annotations> + <description>Fills the provided Qty for a Product linked to a Grouped Product.</description> + </annotations> + <arguments> + <argument name="productName" type="string"/> + <argument name="qty" type="string"/> + </arguments> + + <fillField selector="{{AdminAddedProductsToGroupGrid.inputByProductName(productName)}}" userInput="{{qty}}" stepKey="fillDefaultQtyForLinkedProduct"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/FillGroupedProductFormActionGroup.xml b/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/FillGroupedProductFormActionGroup.xml new file mode 100644 index 0000000000000..c4df7f67ac201 --- /dev/null +++ b/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/FillGroupedProductFormActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FillGroupedProductFormActionGroup"> + <annotations> + <description>Fills in the provided Product Name and SKU on the Grouped Product creation/edit page.</description> + </annotations> + <arguments> + <argument name="product" defaultValue="GroupedProduct"/> + </arguments> + + <fillField selector="{{AdminProductFormSection.productName}}" userInput="{{product.name}}" stepKey="fillProductSku"/> + <fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="fillProductName"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/ViewGroupedProductInAdminGridActionGroup.xml b/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/ViewGroupedProductInAdminGridActionGroup.xml new file mode 100644 index 0000000000000..369a0c3f12970 --- /dev/null +++ b/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/ViewGroupedProductInAdminGridActionGroup.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ViewGroupedProductInAdminGridActionGroup"> + <annotations> + <description>Goes to the Admin Products grid page. Filters the grid for the provided Product. Validates that the provided Product appears in the grid.</description> + </annotations> + <arguments> + <argument name="product" defaultValue="GroupedProduct"/> + </arguments> + + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> + <waitForPageLoad stepKey="waitForPageLoadInitial"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> + <fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="{{product.name}}" stepKey="fillProductNameFilter"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillProductSkuFilter"/> + <selectOption selector="{{AdminProductGridFilterSection.typeFilter}}" userInput="{{product.type_id}}" stepKey="selectionProductType"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> + <see selector="{{AdminProductGridSection.firstProductRow}}" userInput="{{product.name}}" stepKey="seeProductNameInGrid"/> + <click selector="{{AdminProductGridFilterSection.clearFilters}}" stepKey="clickClearFiltersAfter"/> + </actionGroup> +</actionGroups> From c0901615f14e004f28147909c609595ce7307194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 28 Nov 2019 22:07:39 +0100 Subject: [PATCH 0170/1143] REFACTOR: Extract Action Groups to separate files (according to MFTF best practices) --- .../AssertEmailTemplateContentActionGroup.xml | 18 ++++ .../CreateCustomTemplateActionGroup.xml | 18 ++++ .../CreateNewTemplateActionGroup.xml | 33 +++++++ .../DeleteEmailTemplateActionGroup.xml | 21 +++++ .../ActionGroup/EmailTemplateActionGroup.xml | 86 ------------------- .../FindAndOpenEmailTemplateActionGroup.xml | 25 ++++++ .../PreviewEmailTemplateActionGroup.xml | 19 ++++ .../Test/AdminEmailTemplatePreviewTest.xml | 8 +- 8 files changed, 138 insertions(+), 90 deletions(-) create mode 100644 app/code/Magento/Email/Test/Mftf/ActionGroup/AssertEmailTemplateContentActionGroup.xml create mode 100644 app/code/Magento/Email/Test/Mftf/ActionGroup/CreateCustomTemplateActionGroup.xml create mode 100644 app/code/Magento/Email/Test/Mftf/ActionGroup/CreateNewTemplateActionGroup.xml create mode 100644 app/code/Magento/Email/Test/Mftf/ActionGroup/DeleteEmailTemplateActionGroup.xml delete mode 100644 app/code/Magento/Email/Test/Mftf/ActionGroup/EmailTemplateActionGroup.xml create mode 100644 app/code/Magento/Email/Test/Mftf/ActionGroup/FindAndOpenEmailTemplateActionGroup.xml create mode 100644 app/code/Magento/Email/Test/Mftf/ActionGroup/PreviewEmailTemplateActionGroup.xml diff --git a/app/code/Magento/Email/Test/Mftf/ActionGroup/AssertEmailTemplateContentActionGroup.xml b/app/code/Magento/Email/Test/Mftf/ActionGroup/AssertEmailTemplateContentActionGroup.xml new file mode 100644 index 0000000000000..653de14a56c9c --- /dev/null +++ b/app/code/Magento/Email/Test/Mftf/ActionGroup/AssertEmailTemplateContentActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertEmailTemplateContentActionGroup"> + <arguments> + <argument name="expectedContent" type="string" defaultValue="{{EmailTemplate.templateText}}"/> + </arguments> + + <see userInput="{{expectedContent}}" stepKey="checkTemplateContainText"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Email/Test/Mftf/ActionGroup/CreateCustomTemplateActionGroup.xml b/app/code/Magento/Email/Test/Mftf/ActionGroup/CreateCustomTemplateActionGroup.xml new file mode 100644 index 0000000000000..6fe1dfad761ff --- /dev/null +++ b/app/code/Magento/Email/Test/Mftf/ActionGroup/CreateCustomTemplateActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateCustomTemplateActionGroup" extends="CreateNewTemplateActionGroup"> + <remove keyForRemoval="selectValueFromTemplateDropDown"/> + <remove keyForRemoval="clickLoadTemplateButton"/> + + <fillField selector="{{AdminEmailTemplateEditSection.templateSubject}}" userInput="{{template.templateSubject}}" after="fillTemplateNameField" stepKey="fillTemplateSubject"/> + <fillField selector="{{AdminEmailTemplateEditSection.templateText}}" userInput="{{template.templateText}}" after="fillTemplateSubject" stepKey="fillTemplateText"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Email/Test/Mftf/ActionGroup/CreateNewTemplateActionGroup.xml b/app/code/Magento/Email/Test/Mftf/ActionGroup/CreateNewTemplateActionGroup.xml new file mode 100644 index 0000000000000..c6e45ad06971a --- /dev/null +++ b/app/code/Magento/Email/Test/Mftf/ActionGroup/CreateNewTemplateActionGroup.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <!--Create New Template --> + <actionGroup name="CreateNewTemplateActionGroup"> + <annotations> + <description>Clicks on Add New Template. Fills the Template details. Clicks on Save. PLEASE NOTE: The values are Hardcoded.</description> + </annotations> + <arguments> + <argument name="template" defaultValue="EmailTemplate"/> + </arguments> + + <!--Go to Marketing> Email Templates--> + <amOnPage url="{{AdminEmailTemplateIndexPage.url}}" stepKey="navigateToEmailTemplatePage"/> + <!--Click "Add New Template" button--> + <click selector="{{AdminMainActionsSection.add}}" stepKey="clickAddNewTemplateButton"/> + <!--Select value for "Template" drop-down menu in "Load Default Template" tab--> + <selectOption selector="{{AdminEmailTemplateEditSection.templateDropDown}}" userInput="Registry Update" stepKey="selectValueFromTemplateDropDown"/> + <!--Fill in required fields in "Template Information" tab and click "Save Template" button--> + <click selector="{{AdminEmailTemplateEditSection.loadTemplateButton}}" stepKey="clickLoadTemplateButton"/> + <fillField selector="{{AdminEmailTemplateEditSection.templateCode}}" userInput="{{EmailTemplate.templateName}}" stepKey="fillTemplateNameField"/> + <click selector="{{AdminMainActionsSection.save}}" stepKey="clickSaveTemplateButton"/> + <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForSuccessMessage"/> + <see selector="{{AdminMessagesSection.success}}" userInput="You saved the email template." stepKey="seeSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Email/Test/Mftf/ActionGroup/DeleteEmailTemplateActionGroup.xml b/app/code/Magento/Email/Test/Mftf/ActionGroup/DeleteEmailTemplateActionGroup.xml new file mode 100644 index 0000000000000..b12f79da5f597 --- /dev/null +++ b/app/code/Magento/Email/Test/Mftf/ActionGroup/DeleteEmailTemplateActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DeleteEmailTemplateActionGroup" extends="FindAndOpenEmailTemplateActionGroup"> + <annotations> + <description>Clicks on Delete Template. Accepts the Popup. Validates that the Email Template is NOT present in the Email Templates Grid.</description> + </annotations> + <click selector="{{AdminEmailTemplateEditSection.deleteTemplateButton}}" after="checkTemplateName" stepKey="deleteTemplate"/> + <waitForElementVisible selector="{{AdminEmailTemplateEditSection.acceptPopupButton}}" after="deleteTemplate" stepKey="waitForConfirmButton"/> + <click selector="{{AdminEmailTemplateEditSection.acceptPopupButton}}" after="waitForConfirmButton" stepKey="acceptPopup"/> + <waitForElementVisible selector="{{AdminMessagesSection.success}}" after="acceptPopup" stepKey="waitForSuccessMessage"/> + <see selector="{{AdminMessagesSection.success}}" userInput="You deleted the email template." after="waitForSuccessMessage" stepKey="seeSuccessfulMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Email/Test/Mftf/ActionGroup/EmailTemplateActionGroup.xml b/app/code/Magento/Email/Test/Mftf/ActionGroup/EmailTemplateActionGroup.xml deleted file mode 100644 index c859b956810c7..0000000000000 --- a/app/code/Magento/Email/Test/Mftf/ActionGroup/EmailTemplateActionGroup.xml +++ /dev/null @@ -1,86 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <!--Create New Template --> - <actionGroup name="CreateNewTemplate"> - <annotations> - <description>Clicks on Add New Template. Fills the Template details. Clicks on Save. PLEASE NOTE: The values are Hardcoded.</description> - </annotations> - <arguments> - <argument name="template" defaultValue="EmailTemplate"/> - </arguments> - - <!--Go to Marketing> Email Templates--> - <amOnPage url="{{AdminEmailTemplateIndexPage.url}}" stepKey="navigateToEmailTemplatePage"/> - <!--Click "Add New Template" button--> - <click selector="{{AdminMainActionsSection.add}}" stepKey="clickAddNewTemplateButton"/> - <!--Select value for "Template" drop-down menu in "Load Default Template" tab--> - <selectOption selector="{{AdminEmailTemplateEditSection.templateDropDown}}" userInput="Registry Update" stepKey="selectValueFromTemplateDropDown"/> - <!--Fill in required fields in "Template Information" tab and click "Save Template" button--> - <click selector="{{AdminEmailTemplateEditSection.loadTemplateButton}}" stepKey="clickLoadTemplateButton"/> - <fillField selector="{{AdminEmailTemplateEditSection.templateCode}}" userInput="{{EmailTemplate.templateName}}" stepKey="fillTemplateNameField"/> - <click selector="{{AdminMainActionsSection.save}}" stepKey="clickSaveTemplateButton"/> - <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForSuccessMessage"/> - <see selector="{{AdminMessagesSection.success}}" userInput="You saved the email template." stepKey="seeSuccessMessage"/> - </actionGroup> - - <!--Create New Custom Template --> - <actionGroup name="CreateCustomTemplate" extends="CreateNewTemplate"> - <remove keyForRemoval="selectValueFromTemplateDropDown"/> - <remove keyForRemoval="clickLoadTemplateButton"/> - - <fillField selector="{{AdminEmailTemplateEditSection.templateSubject}}" userInput="{{template.templateSubject}}" after="fillTemplateNameField" stepKey="fillTemplateSubject"/> - <fillField selector="{{AdminEmailTemplateEditSection.templateText}}" userInput="{{template.templateText}}" after="fillTemplateSubject" stepKey="fillTemplateText"/> - </actionGroup> - - <!-- Find and Open Email Template --> - <actionGroup name="FindAndOpenEmailTemplate"> - <arguments> - <argument name="template" defaultValue="EmailTemplate"/> - </arguments> - - <amOnPage url="{{AdminEmailTemplateIndexPage.url}}" stepKey="navigateEmailTemplatePage" /> - <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clearFilters"/> - <fillField selector="{{AdminEmailTemplateIndexSection.searchTemplateField}}" userInput="{{template.templateName}}" stepKey="findCreatedTemplate"/> - <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickSearch"/> - <waitForElementVisible selector="{{AdminEmailTemplateIndexSection.templateRowByName(template.templateName)}}" stepKey="waitForTemplatesAppeared"/> - <click selector="{{AdminEmailTemplateIndexSection.templateRowByName(template.templateName)}}" stepKey="clickToOpenTemplate"/> - <waitForElementVisible selector="{{AdminEmailTemplateEditSection.templateCode}}" stepKey="waitForTemplateNameisible"/> - <seeInField selector="{{AdminEmailTemplateEditSection.templateCode}}" userInput="{{template.templateName}}" stepKey="checkTemplateName"/> - </actionGroup> - - <actionGroup name="DeleteEmailTemplate" extends="FindAndOpenEmailTemplate"> - <annotations> - <description>Clicks on Delete Template. Accepts the Popup. Validates that the Email Template is NOT present in the Email Templates Grid.</description> - </annotations> - <click selector="{{AdminEmailTemplateEditSection.deleteTemplateButton}}" after="checkTemplateName" stepKey="deleteTemplate"/> - <waitForElementVisible selector="{{AdminEmailTemplateEditSection.acceptPopupButton}}" after="deleteTemplate" stepKey="waitForConfirmButton"/> - <click selector="{{AdminEmailTemplateEditSection.acceptPopupButton}}" after="waitForConfirmButton" stepKey="acceptPopup"/> - <waitForElementVisible selector="{{AdminMessagesSection.success}}" after="acceptPopup" stepKey="waitForSuccessMessage"/> - <see selector="{{AdminMessagesSection.success}}" userInput="You deleted the email template." after="waitForSuccessMessage" stepKey="seeSuccessfulMessage"/> - </actionGroup> - - <actionGroup name="PreviewEmailTemplate" extends="FindAndOpenEmailTemplate"> - <click selector="{{AdminEmailTemplateEditSection.previewTemplateButton}}" after="checkTemplateName" stepKey="clickPreviewTemplate"/> - <switchToNextTab after="clickPreviewTemplate" stepKey="switchToNewOpenedTab"/> - <seeInCurrentUrl url="{{AdminEmailTemplatePreviewPage.url}}" after="switchToNewOpenedTab" stepKey="seeCurrentUrl"/> - <seeElement selector="{{AdminEmailTemplatePreviewSection.iframe}}" after="seeCurrentUrl" stepKey="seeIframeOnPage"/> - <switchToIFrame userInput="preview_iframe" after="seeIframeOnPage" stepKey="switchToIframe"/> - <waitForPageLoad after="switchToIframe" stepKey="waitForPageLoaded"/> - </actionGroup> - - <actionGroup name="AssertEmailTemplateContent"> - <arguments> - <argument name="expectedContent" type="string" defaultValue="{{EmailTemplate.templateText}}"/> - </arguments> - - <see userInput="{{expectedContent}}" stepKey="checkTemplateContainText"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Email/Test/Mftf/ActionGroup/FindAndOpenEmailTemplateActionGroup.xml b/app/code/Magento/Email/Test/Mftf/ActionGroup/FindAndOpenEmailTemplateActionGroup.xml new file mode 100644 index 0000000000000..5e95b4a72b0ec --- /dev/null +++ b/app/code/Magento/Email/Test/Mftf/ActionGroup/FindAndOpenEmailTemplateActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FindAndOpenEmailTemplateActionGroup"> + <arguments> + <argument name="template" defaultValue="EmailTemplate"/> + </arguments> + + <amOnPage url="{{AdminEmailTemplateIndexPage.url}}" stepKey="navigateEmailTemplatePage" /> + <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clearFilters"/> + <fillField selector="{{AdminEmailTemplateIndexSection.searchTemplateField}}" userInput="{{template.templateName}}" stepKey="findCreatedTemplate"/> + <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickSearch"/> + <waitForElementVisible selector="{{AdminEmailTemplateIndexSection.templateRowByName(template.templateName)}}" stepKey="waitForTemplatesAppeared"/> + <click selector="{{AdminEmailTemplateIndexSection.templateRowByName(template.templateName)}}" stepKey="clickToOpenTemplate"/> + <waitForElementVisible selector="{{AdminEmailTemplateEditSection.templateCode}}" stepKey="waitForTemplateNameisible"/> + <seeInField selector="{{AdminEmailTemplateEditSection.templateCode}}" userInput="{{template.templateName}}" stepKey="checkTemplateName"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Email/Test/Mftf/ActionGroup/PreviewEmailTemplateActionGroup.xml b/app/code/Magento/Email/Test/Mftf/ActionGroup/PreviewEmailTemplateActionGroup.xml new file mode 100644 index 0000000000000..4038a34625800 --- /dev/null +++ b/app/code/Magento/Email/Test/Mftf/ActionGroup/PreviewEmailTemplateActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="PreviewEmailTemplateActionGroup" extends="FindAndOpenEmailTemplateActionGroup"> + <click selector="{{AdminEmailTemplateEditSection.previewTemplateButton}}" after="checkTemplateName" stepKey="clickPreviewTemplate"/> + <switchToNextTab after="clickPreviewTemplate" stepKey="switchToNewOpenedTab"/> + <seeInCurrentUrl url="{{AdminEmailTemplatePreviewPage.url}}" after="switchToNewOpenedTab" stepKey="seeCurrentUrl"/> + <seeElement selector="{{AdminEmailTemplatePreviewSection.iframe}}" after="seeCurrentUrl" stepKey="seeIframeOnPage"/> + <switchToIFrame userInput="preview_iframe" after="seeIframeOnPage" stepKey="switchToIframe"/> + <waitForPageLoad after="switchToIframe" stepKey="waitForPageLoaded"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Email/Test/Mftf/Test/AdminEmailTemplatePreviewTest.xml b/app/code/Magento/Email/Test/Mftf/Test/AdminEmailTemplatePreviewTest.xml index 459e3c0f9290f..ca73de1f88fcc 100644 --- a/app/code/Magento/Email/Test/Mftf/Test/AdminEmailTemplatePreviewTest.xml +++ b/app/code/Magento/Email/Test/Mftf/Test/AdminEmailTemplatePreviewTest.xml @@ -27,14 +27,14 @@ <after> <!--Delete created Template--> - <actionGroup ref="DeleteEmailTemplate" stepKey="deleteTemplate"/> + <actionGroup ref="DeleteEmailTemplateActionGroup" stepKey="deleteTemplate"/> <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clearFilters"/> <!--Logout from Admin Area--> <actionGroup ref="logout" stepKey="logoutOfAdmin"/> </after> - <actionGroup ref="CreateCustomTemplate" stepKey="createTemplate"/> - <actionGroup ref="PreviewEmailTemplate" stepKey="previewTemplate"/> - <actionGroup ref="AssertEmailTemplateContent" stepKey="assertContent"/> + <actionGroup ref="CreateCustomTemplateActionGroup" stepKey="createTemplate"/> + <actionGroup ref="PreviewEmailTemplateActionGroup" stepKey="previewTemplate"/> + <actionGroup ref="AssertEmailTemplateContentActionGroup" stepKey="assertContent"/> </test> </tests> From 988705f2acfcafbf8128c40851a3f910497a485e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 28 Nov 2019 22:17:39 +0100 Subject: [PATCH 0171/1143] REFACTOR: Extract Action Groups to separate files (according to MFTF best practices) --- ...AdminProductTypeSwitchingOnEditingTest.xml | 2 +- .../AddDownloadableProductLinkActionGroup.xml | 32 ++++++ ...ProductLinkWithMaxDownloadsActionGroup.xml | 30 ++++++ .../AddDownloadableSampleFileActionGroup.xml | 26 +++++ .../AddDownloadableSampleUrlActionGroup.xml | 25 +++++ .../AdminDownloadableProductActionGroup.xml | 102 ------------------ ...MainDownloadableProductFormActionGroup.xml | 25 +++++ ...AddDefaultImageDownloadableProductTest.xml | 4 +- ...AddDefaultVideoDownloadableProductTest.xml | 4 +- ...bleProductAndAssignItToCustomStoreTest.xml | 2 +- ...wnloadableProductWithCustomOptionsTest.xml | 2 +- ...loadableProductWithDefaultSetLinksTest.xml | 4 +- ...eDownloadableProductWithGroupPriceTest.xml | 4 +- ...bleProductWithInvalidDomainLinkUrlTest.xml | 4 +- ...nCreateDownloadableProductWithLinkTest.xml | 2 +- ...DownloadableProductWithManageStockTest.xml | 4 +- ...oadableProductWithOutOfStockStatusTest.xml | 4 +- ...ownloadableProductWithSpecialPriceTest.xml | 4 +- ...ductWithoutFillingQuantityAndStockTest.xml | 4 +- ...wnloadableProductWithoutTaxClassIdTest.xml | 4 +- ...AdminProductTypeSwitchingOnEditingTest.xml | 2 +- ...oveDefaultImageDownloadableProductTest.xml | 4 +- ...oveDefaultVideoDownloadableProductTest.xml | 4 +- ...leProductWithSeparateLinksFromCartTest.xml | 4 +- .../Test/Mftf/Test/EndToEndB2CAdminTest.xml | 10 +- ...wnloadableLinksDownloadableProductTest.xml | 4 +- ...ductsListWidgetDownloadableProductTest.xml | 4 +- ...wnloadableLinksDownloadableProductTest.xml | 4 +- 28 files changed, 180 insertions(+), 144 deletions(-) create mode 100644 app/code/Magento/Downloadable/Test/Mftf/ActionGroup/AddDownloadableProductLinkActionGroup.xml create mode 100644 app/code/Magento/Downloadable/Test/Mftf/ActionGroup/AddDownloadableProductLinkWithMaxDownloadsActionGroup.xml create mode 100644 app/code/Magento/Downloadable/Test/Mftf/ActionGroup/AddDownloadableSampleFileActionGroup.xml create mode 100644 app/code/Magento/Downloadable/Test/Mftf/ActionGroup/AddDownloadableSampleUrlActionGroup.xml delete mode 100644 app/code/Magento/Downloadable/Test/Mftf/ActionGroup/AdminDownloadableProductActionGroup.xml create mode 100644 app/code/Magento/Downloadable/Test/Mftf/ActionGroup/FillMainDownloadableProductFormActionGroup.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml index de065d2d930cb..609f9a6629a3d 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml @@ -42,7 +42,7 @@ <waitForPageLoad stepKey="waitForDownloadableProductPageLoad"/> <actionGroup ref="AdminAddDownloadableLinkInformationActionGroup" stepKey="addDownloadableLinkInformation"/> <checkOption selector="{{AdminProductDownloadableSection.isLinksPurchasedSeparately}}" stepKey="checkOptionPurchaseSeparately"/> - <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="addDownloadableProductLink"> + <actionGroup ref="AddDownloadableProductLinkWithMaxDownloadsActionGroup" stepKey="addDownloadableProductLink"> <argument name="link" value="downloadableLinkWithMaxDownloads"/> </actionGroup> <actionGroup ref="saveProductForm" stepKey="saveDownloadableProductForm"/> diff --git a/app/code/Magento/Downloadable/Test/Mftf/ActionGroup/AddDownloadableProductLinkActionGroup.xml b/app/code/Magento/Downloadable/Test/Mftf/ActionGroup/AddDownloadableProductLinkActionGroup.xml new file mode 100644 index 0000000000000..d132b3bc609ae --- /dev/null +++ b/app/code/Magento/Downloadable/Test/Mftf/ActionGroup/AddDownloadableProductLinkActionGroup.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddDownloadableProductLinkActionGroup"> + <annotations> + <description>Clicks on 'Add Link', under the 'Links' section. Fills in the provided Link details including Unlimited Downloads.</description> + </annotations> + <arguments> + <argument name="link" defaultValue="downloadableLink"/> + <argument name="index" type="string" defaultValue="1"/> + </arguments> + + <click selector="{{AdminProductDownloadableSection.linksAddLinkButton}}" stepKey="clickLinkAddLinkButton"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <fillField userInput="{{link.title}}" selector="{{AdminProductDownloadableSection.addLinkTitleInput(index)}}" stepKey="fillDownloadableLinkTitle"/> + <fillField userInput="{{link.price}}" selector="{{AdminProductDownloadableSection.addLinkPriceInput(index)}}" stepKey="fillDownloadableLinkPrice"/> + <selectOption userInput="{{link.file_type}}" selector="{{AdminProductDownloadableSection.addLinkFileTypeSelector(index)}}" stepKey="selectDownloadableLinkFileType"/> + <selectOption userInput="{{link.sample_type}}" selector="{{AdminProductDownloadableSection.addLinkSampleTypeSelector(index)}}" stepKey="selectDownloadableLinkSampleType"/> + <selectOption userInput="{{link.shareable}}" selector="{{AdminProductDownloadableSection.addLinkShareableSelector(index)}}" stepKey="selectDownloadableLinkShareable"/> + <checkOption selector="{{AdminProductDownloadableSection.addLinkIsUnlimitedDownloads(index)}}" stepKey="checkDownloadableLinkUnlimited"/> + <fillField userInput="{{link.file}}" selector="{{AdminProductDownloadableSection.addLinkFileUrlInput(index)}}" stepKey="fillDownloadableLinkFileUrl"/> + <attachFile userInput="{{link.sample}}" selector="{{AdminProductDownloadableSection.addLinkSampleUploadFile(index)}}" stepKey="attachDownloadableLinkUploadSample"/> + <waitForPageLoad stepKey="waitForPageLoadAfterFillingOutForm" /> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Downloadable/Test/Mftf/ActionGroup/AddDownloadableProductLinkWithMaxDownloadsActionGroup.xml b/app/code/Magento/Downloadable/Test/Mftf/ActionGroup/AddDownloadableProductLinkWithMaxDownloadsActionGroup.xml new file mode 100644 index 0000000000000..fb21724130042 --- /dev/null +++ b/app/code/Magento/Downloadable/Test/Mftf/ActionGroup/AddDownloadableProductLinkWithMaxDownloadsActionGroup.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddDownloadableProductLinkWithMaxDownloadsActionGroup"> + <annotations> + <description>Clicks on 'Add Link'. Fills in the provided Link details including a Max Downloads limit.</description> + </annotations> + <arguments> + <argument name="link" defaultValue="downloadableLinkWithMaxDownloads"/> + </arguments> + + <click selector="{{AdminProductDownloadableSection.linksAddLinkButton}}" stepKey="clickLinkAddLinkButton"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <fillField userInput="{{link.title}}" selector="{{AdminProductDownloadableSection.addLinkTitleInput('0')}}" stepKey="fillDownloadableLinkTitle"/> + <fillField userInput="{{link.price}}" selector="{{AdminProductDownloadableSection.addLinkPriceInput('0')}}" stepKey="fillDownloadableLinkPrice"/> + <selectOption userInput="{{link.file_type}}" selector="{{AdminProductDownloadableSection.addLinkFileTypeSelector('0')}}" stepKey="selectDownloadableLinkFileType"/> + <selectOption userInput="{{link.sample_type}}" selector="{{AdminProductDownloadableSection.addLinkSampleTypeSelector('0')}}" stepKey="selectDownloadableLinkSampleType"/> + <selectOption userInput="{{link.shareable}}" selector="{{AdminProductDownloadableSection.addLinkShareableSelector('0')}}" stepKey="selectDownloadableLinkShareable"/> + <fillField userInput="{{link.max_downloads}}" selector="{{AdminProductDownloadableSection.addLinkMaxDownloadsInput('0')}}" stepKey="fillDownloadableLinkMaxDownloads"/> + <attachFile userInput="{{link.file}}" selector="{{AdminProductDownloadableSection.addLinkFileUploadFile('0')}}" stepKey="fillDownloadableLinkUploadFile"/> + <fillField userInput="{{link.sample}}" selector="{{AdminProductDownloadableSection.addLinkSampleUrlInput('0')}}" stepKey="fillDownloadableLinkSampleUrl"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Downloadable/Test/Mftf/ActionGroup/AddDownloadableSampleFileActionGroup.xml b/app/code/Magento/Downloadable/Test/Mftf/ActionGroup/AddDownloadableSampleFileActionGroup.xml new file mode 100644 index 0000000000000..b5b37d0a41b98 --- /dev/null +++ b/app/code/Magento/Downloadable/Test/Mftf/ActionGroup/AddDownloadableSampleFileActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddDownloadableSampleFileActionGroup"> + <annotations> + <description>Clicks on 'Add Link' under the 'Samples' section. Fills in the provided Downloadable Sample File details.</description> + </annotations> + <arguments> + <argument name="sample" defaultValue="downloadableSampleFile"/> + </arguments> + + <click selector="{{AdminProductDownloadableSection.samplesAddLinkButton}}" stepKey="clickSampleAddLinkButton"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <fillField userInput="{{sample.title}}" selector="{{AdminProductDownloadableSection.addSampleTitleInput('0')}}" stepKey="fillDownloadableSampleTitle"/> + <selectOption userInput="{{sample.file_type}}" selector="{{AdminProductDownloadableSection.addSampleFileTypeSelector('0')}}" stepKey="selectDownloadableSampleFileType"/> + <attachFile userInput="{{sample.file}}" selector="{{AdminProductDownloadableSection.addSampleFileUploadFile('0')}}" stepKey="selectDownloadableSampleUpload"/> + <waitForAjaxLoad stepKey="waitForSampleFileUpload"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Downloadable/Test/Mftf/ActionGroup/AddDownloadableSampleUrlActionGroup.xml b/app/code/Magento/Downloadable/Test/Mftf/ActionGroup/AddDownloadableSampleUrlActionGroup.xml new file mode 100644 index 0000000000000..5002722feb51d --- /dev/null +++ b/app/code/Magento/Downloadable/Test/Mftf/ActionGroup/AddDownloadableSampleUrlActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddDownloadableSampleUrlActionGroup"> + <annotations> + <description>Clicks on 'Add Link' under the 'Samples' section. Fills in the provided Downloadable Sample URL details.</description> + </annotations> + <arguments> + <argument name="sample" defaultValue="downloadableSampleUrl"/> + </arguments> + + <click selector="{{AdminProductDownloadableSection.samplesAddLinkButton}}" stepKey="clickSampleAddLinkButton2"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <fillField userInput="{{sample.title}}" selector="{{AdminProductDownloadableSection.addSampleTitleInput('1')}}" stepKey="fillDownloadableSampleTitle"/> + <selectOption userInput="{{sample.file_type}}" selector="{{AdminProductDownloadableSection.addSampleFileTypeSelector('1')}}" stepKey="selectDownloadableSampleFileType"/> + <fillField userInput="{{sample.file}}" selector="{{AdminProductDownloadableSection.addSampleFileUrlInput('1')}}" stepKey="fillDownloadableSampleFileUrl"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Downloadable/Test/Mftf/ActionGroup/AdminDownloadableProductActionGroup.xml b/app/code/Magento/Downloadable/Test/Mftf/ActionGroup/AdminDownloadableProductActionGroup.xml deleted file mode 100644 index 2d2cdd969ac9d..0000000000000 --- a/app/code/Magento/Downloadable/Test/Mftf/ActionGroup/AdminDownloadableProductActionGroup.xml +++ /dev/null @@ -1,102 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <!--Fill main fields in product form--> - <actionGroup name="fillMainDownloadableProductForm"> - <annotations> - <description>Fills the Name, SKU, Price and Quantity on the Product creation/edit page.</description> - </annotations> - <arguments> - <argument name="product" defaultValue="DownloadableProduct"/> - </arguments> - - <fillField selector="{{AdminProductFormSection.productName}}" userInput="{{product.name}}" stepKey="fillProductSku"/> - <fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="fillProductName"/> - <fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{product.price}}" stepKey="fillProductPrice"/> - <fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="{{product.quantity}}" stepKey="fillProductQty"/> - </actionGroup> - - <!--Add a downloadable link that has max downloads--> - <actionGroup name="addDownloadableProductLinkWithMaxDownloads"> - <annotations> - <description>Clicks on 'Add Link'. Fills in the provided Link details including a Max Downloads limit.</description> - </annotations> - <arguments> - <argument name="link" defaultValue="downloadableLinkWithMaxDownloads"/> - </arguments> - - <click selector="{{AdminProductDownloadableSection.linksAddLinkButton}}" stepKey="clickLinkAddLinkButton"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <fillField userInput="{{link.title}}" selector="{{AdminProductDownloadableSection.addLinkTitleInput('0')}}" stepKey="fillDownloadableLinkTitle"/> - <fillField userInput="{{link.price}}" selector="{{AdminProductDownloadableSection.addLinkPriceInput('0')}}" stepKey="fillDownloadableLinkPrice"/> - <selectOption userInput="{{link.file_type}}" selector="{{AdminProductDownloadableSection.addLinkFileTypeSelector('0')}}" stepKey="selectDownloadableLinkFileType"/> - <selectOption userInput="{{link.sample_type}}" selector="{{AdminProductDownloadableSection.addLinkSampleTypeSelector('0')}}" stepKey="selectDownloadableLinkSampleType"/> - <selectOption userInput="{{link.shareable}}" selector="{{AdminProductDownloadableSection.addLinkShareableSelector('0')}}" stepKey="selectDownloadableLinkShareable"/> - <fillField userInput="{{link.max_downloads}}" selector="{{AdminProductDownloadableSection.addLinkMaxDownloadsInput('0')}}" stepKey="fillDownloadableLinkMaxDownloads"/> - <attachFile userInput="{{link.file}}" selector="{{AdminProductDownloadableSection.addLinkFileUploadFile('0')}}" stepKey="fillDownloadableLinkUploadFile"/> - <fillField userInput="{{link.sample}}" selector="{{AdminProductDownloadableSection.addLinkSampleUrlInput('0')}}" stepKey="fillDownloadableLinkSampleUrl"/> - </actionGroup> - - <!--Add a downloadable link with unlimited downloads--> - <actionGroup name="addDownloadableProductLink"> - <annotations> - <description>Clicks on 'Add Link', under the 'Links' section. Fills in the provided Link details including Unlimited Downloads.</description> - </annotations> - <arguments> - <argument name="link" defaultValue="downloadableLink"/> - <argument name="index" type="string" defaultValue="1"/> - </arguments> - - <click selector="{{AdminProductDownloadableSection.linksAddLinkButton}}" stepKey="clickLinkAddLinkButton"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <fillField userInput="{{link.title}}" selector="{{AdminProductDownloadableSection.addLinkTitleInput(index)}}" stepKey="fillDownloadableLinkTitle"/> - <fillField userInput="{{link.price}}" selector="{{AdminProductDownloadableSection.addLinkPriceInput(index)}}" stepKey="fillDownloadableLinkPrice"/> - <selectOption userInput="{{link.file_type}}" selector="{{AdminProductDownloadableSection.addLinkFileTypeSelector(index)}}" stepKey="selectDownloadableLinkFileType"/> - <selectOption userInput="{{link.sample_type}}" selector="{{AdminProductDownloadableSection.addLinkSampleTypeSelector(index)}}" stepKey="selectDownloadableLinkSampleType"/> - <selectOption userInput="{{link.shareable}}" selector="{{AdminProductDownloadableSection.addLinkShareableSelector(index)}}" stepKey="selectDownloadableLinkShareable"/> - <checkOption selector="{{AdminProductDownloadableSection.addLinkIsUnlimitedDownloads(index)}}" stepKey="checkDownloadableLinkUnlimited"/> - <fillField userInput="{{link.file}}" selector="{{AdminProductDownloadableSection.addLinkFileUrlInput(index)}}" stepKey="fillDownloadableLinkFileUrl"/> - <attachFile userInput="{{link.sample}}" selector="{{AdminProductDownloadableSection.addLinkSampleUploadFile(index)}}" stepKey="attachDownloadableLinkUploadSample"/> - <waitForPageLoad stepKey="waitForPageLoadAfterFillingOutForm" /> - </actionGroup> - - <!--Add a downloadable sample file--> - <actionGroup name="addDownloadableSampleFile"> - <annotations> - <description>Clicks on 'Add Link' under the 'Samples' section. Fills in the provided Downloadable Sample File details.</description> - </annotations> - <arguments> - <argument name="sample" defaultValue="downloadableSampleFile"/> - </arguments> - - <click selector="{{AdminProductDownloadableSection.samplesAddLinkButton}}" stepKey="clickSampleAddLinkButton"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <fillField userInput="{{sample.title}}" selector="{{AdminProductDownloadableSection.addSampleTitleInput('0')}}" stepKey="fillDownloadableSampleTitle"/> - <selectOption userInput="{{sample.file_type}}" selector="{{AdminProductDownloadableSection.addSampleFileTypeSelector('0')}}" stepKey="selectDownloadableSampleFileType"/> - <attachFile userInput="{{sample.file}}" selector="{{AdminProductDownloadableSection.addSampleFileUploadFile('0')}}" stepKey="selectDownloadableSampleUpload"/> - <waitForAjaxLoad stepKey="waitForSampleFileUpload"/> - </actionGroup> - - <!--Add a downloadable sample URL--> - <actionGroup name="addDownloadableSampleUrl"> - <annotations> - <description>Clicks on 'Add Link' under the 'Samples' section. Fills in the provided Downloadable Sample URL details.</description> - </annotations> - <arguments> - <argument name="sample" defaultValue="downloadableSampleUrl"/> - </arguments> - - <click selector="{{AdminProductDownloadableSection.samplesAddLinkButton}}" stepKey="clickSampleAddLinkButton2"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <fillField userInput="{{sample.title}}" selector="{{AdminProductDownloadableSection.addSampleTitleInput('1')}}" stepKey="fillDownloadableSampleTitle"/> - <selectOption userInput="{{sample.file_type}}" selector="{{AdminProductDownloadableSection.addSampleFileTypeSelector('1')}}" stepKey="selectDownloadableSampleFileType"/> - <fillField userInput="{{sample.file}}" selector="{{AdminProductDownloadableSection.addSampleFileUrlInput('1')}}" stepKey="fillDownloadableSampleFileUrl"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Downloadable/Test/Mftf/ActionGroup/FillMainDownloadableProductFormActionGroup.xml b/app/code/Magento/Downloadable/Test/Mftf/ActionGroup/FillMainDownloadableProductFormActionGroup.xml new file mode 100644 index 0000000000000..f18267459c4be --- /dev/null +++ b/app/code/Magento/Downloadable/Test/Mftf/ActionGroup/FillMainDownloadableProductFormActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <!--Fill main fields in product form--> + <actionGroup name="FillMainDownloadableProductFormActionGroup"> + <annotations> + <description>Fills the Name, SKU, Price and Quantity on the Product creation/edit page.</description> + </annotations> + <arguments> + <argument name="product" defaultValue="DownloadableProduct"/> + </arguments> + + <fillField selector="{{AdminProductFormSection.productName}}" userInput="{{product.name}}" stepKey="fillProductSku"/> + <fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="fillProductName"/> + <fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{product.price}}" stepKey="fillProductPrice"/> + <fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="{{product.quantity}}" stepKey="fillProductQty"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminAddDefaultImageDownloadableProductTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminAddDefaultImageDownloadableProductTest.xml index a7ce96ddf1fde..a9c0c8c058890 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminAddDefaultImageDownloadableProductTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminAddDefaultImageDownloadableProductTest.xml @@ -51,10 +51,10 @@ <fillField userInput="{{downloadableData.link_title}}" selector="{{AdminProductDownloadableSection.linksTitleInput}}" stepKey="fillDownloadableLinkTitle"/> <checkOption selector="{{AdminProductDownloadableSection.isLinksPurchasedSeparately}}" stepKey="checkLinksPurchasedSeparately"/> <fillField userInput="{{downloadableData.sample_title}}" selector="{{AdminProductDownloadableSection.samplesTitleInput}}" stepKey="fillDownloadableSampleTitle"/> - <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="addDownloadableLinkWithMaxDownloads"> + <actionGroup ref="AddDownloadableProductLinkWithMaxDownloadsActionGroup" stepKey="addDownloadableLinkWithMaxDownloads"> <argument name="link" value="downloadableLinkWithMaxDownloads"/> </actionGroup> - <actionGroup ref="addDownloadableProductLink" stepKey="addDownloadableLink"> + <actionGroup ref="AddDownloadableProductLinkActionGroup" stepKey="addDownloadableLink"> <argument name="link" value="downloadableLink"/> </actionGroup> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminAddDefaultVideoDownloadableProductTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminAddDefaultVideoDownloadableProductTest.xml index d95ddaf12470d..814090c3f4450 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminAddDefaultVideoDownloadableProductTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminAddDefaultVideoDownloadableProductTest.xml @@ -40,10 +40,10 @@ <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"> + <actionGroup ref="AddDownloadableProductLinkWithMaxDownloadsActionGroup" stepKey="addDownloadableProductLinkWithMaxDownloads" after="fillSampleTitle"> <argument name="link" value="downloadableLinkWithMaxDownloads"/> </actionGroup> - <actionGroup ref="addDownloadableProductLink" stepKey="addDownloadableProductLink" before="saveProductForm"> + <actionGroup ref="AddDownloadableProductLinkActionGroup" stepKey="addDownloadableProductLink" before="saveProductForm"> <argument name="link" value="downloadableLink"/> </actionGroup> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductAndAssignItToCustomStoreTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductAndAssignItToCustomStoreTest.xml index 4f07334640cf3..2e196d1d4e115 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductAndAssignItToCustomStoreTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductAndAssignItToCustomStoreTest.xml @@ -69,7 +69,7 @@ <checkOption selector="{{AdminProductDownloadableSection.isLinksPurchasedSeparately}}" stepKey="checkOptionPurchaseSeparately"/> <!-- Add downloadable link --> - <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="addDownloadableProductLink"> + <actionGroup ref="AddDownloadableProductLinkWithMaxDownloadsActionGroup" stepKey="addDownloadableProductLink"> <argument name="link" value="downloadableLinkWithMaxDownloads"/> </actionGroup> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithCustomOptionsTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithCustomOptionsTest.xml index 54a2ff606f384..c6bbbc1f6885a 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithCustomOptionsTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithCustomOptionsTest.xml @@ -81,7 +81,7 @@ <checkOption selector="{{AdminProductDownloadableSection.isLinksPurchasedSeparately}}" stepKey="checkOptionPurchaseSeparately"/> <!-- Add downloadable link --> - <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="addDownloadableProductLink"> + <actionGroup ref="AddDownloadableProductLinkWithMaxDownloadsActionGroup" stepKey="addDownloadableProductLink"> <argument name="link" value="downloadableLinkWithMaxDownloads"/> </actionGroup> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithDefaultSetLinksTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithDefaultSetLinksTest.xml index 24741c281d7f6..7e8950cbfb6e0 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithDefaultSetLinksTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithDefaultSetLinksTest.xml @@ -65,12 +65,12 @@ <checkOption selector="{{AdminProductDownloadableSection.isLinksPurchasedSeparately}}" stepKey="checkOptionPurchaseSeparately"/> <!-- Add first downloadable link --> - <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="addFirstDownloadableProductLink"> + <actionGroup ref="AddDownloadableProductLinkWithMaxDownloadsActionGroup" stepKey="addFirstDownloadableProductLink"> <argument name="link" value="downloadableLinkWithMaxDownloads"/> </actionGroup> <!-- Add second downloadable link --> - <actionGroup ref="addDownloadableProductLink" stepKey="addSecondDownloadableProductLink"> + <actionGroup ref="AddDownloadableProductLinkActionGroup" stepKey="addSecondDownloadableProductLink"> <argument name="link" value="downloadableLink"/> </actionGroup> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithGroupPriceTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithGroupPriceTest.xml index 06cf31b763f1c..92b409b4e882e 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithGroupPriceTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithGroupPriceTest.xml @@ -69,12 +69,12 @@ <checkOption selector="{{AdminProductDownloadableSection.isLinksPurchasedSeparately}}" stepKey="checkOptionPurchaseSeparately"/> <!-- Add first downloadable link --> - <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="addFirstDownloadableProductLink"> + <actionGroup ref="AddDownloadableProductLinkWithMaxDownloadsActionGroup" stepKey="addFirstDownloadableProductLink"> <argument name="link" value="downloadableLinkWithMaxDownloads"/> </actionGroup> <!-- Add second downloadable link --> - <actionGroup ref="addDownloadableProductLink" stepKey="addSecondDownloadableProductLink"> + <actionGroup ref="AddDownloadableProductLinkActionGroup" stepKey="addSecondDownloadableProductLink"> <argument name="link" value="downloadableLink"/> </actionGroup> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithInvalidDomainLinkUrlTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithInvalidDomainLinkUrlTest.xml index f2e4bdfb4890f..d21d44b85df89 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithInvalidDomainLinkUrlTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithInvalidDomainLinkUrlTest.xml @@ -21,7 +21,7 @@ <before> <remove keyForRemoval="addDownloadableDomain" /> </before> - <actionGroup ref="addDownloadableProductLink" stepKey="addDownloadableProductLink"> + <actionGroup ref="AddDownloadableProductLinkActionGroup" stepKey="addDownloadableProductLink"> <argument name="link" value="downloadableLink"/> <argument name="index" value="0"/> </actionGroup> @@ -33,7 +33,7 @@ </actionGroup> <checkOption selector="{{AdminProductDownloadableSection.isDownloadableProduct}}" stepKey="checkIsDownloadable" after="fillDownloadableProductFormAgain"/> <checkOption selector="{{AdminProductDownloadableSection.isLinksPurchasedSeparately}}" stepKey="checkIsLinksPurchasedSeparately" after="checkIsDownloadable"/> - <actionGroup ref="addDownloadableProductLink" stepKey="addDownloadableProductLinkAgain" after="checkIsLinksPurchasedSeparately"> + <actionGroup ref="AddDownloadableProductLinkActionGroup" stepKey="addDownloadableProductLinkAgain" after="checkIsLinksPurchasedSeparately"> <argument name="link" value="downloadableLink"/> <argument name="index" value="0"/> </actionGroup> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithLinkTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithLinkTest.xml index e43b8f94c7a3d..3dfe45341b694 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithLinkTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithLinkTest.xml @@ -63,7 +63,7 @@ <checkOption selector="{{AdminProductDownloadableSection.isLinksPurchasedSeparately}}" stepKey="checkOptionPurchaseSeparately"/> <!-- Add downloadable link --> - <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="addDownloadableProductLink"> + <actionGroup ref="AddDownloadableProductLinkWithMaxDownloadsActionGroup" stepKey="addDownloadableProductLink"> <argument name="link" value="downloadableLinkWithMaxDownloads"/> </actionGroup> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithManageStockTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithManageStockTest.xml index fb6a48254fa8d..14f7fca32782f 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithManageStockTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithManageStockTest.xml @@ -76,12 +76,12 @@ <checkOption selector="{{AdminProductDownloadableSection.isLinksPurchasedSeparately}}" stepKey="checkOptionPurchaseSeparately"/> <!-- Add first downloadable link --> - <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="addFirstDownloadableProductLink"> + <actionGroup ref="AddDownloadableProductLinkWithMaxDownloadsActionGroup" stepKey="addFirstDownloadableProductLink"> <argument name="link" value="downloadableLinkWithMaxDownloads"/> </actionGroup> <!-- Add second downloadable link --> - <actionGroup ref="addDownloadableProductLink" stepKey="addSecondDownloadableProductLink"> + <actionGroup ref="AddDownloadableProductLinkActionGroup" stepKey="addSecondDownloadableProductLink"> <argument name="link" value="downloadableLink"/> </actionGroup> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithOutOfStockStatusTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithOutOfStockStatusTest.xml index 5e3fe6836f7e9..737945715cd57 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithOutOfStockStatusTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithOutOfStockStatusTest.xml @@ -63,12 +63,12 @@ <checkOption selector="{{AdminProductDownloadableSection.isLinksPurchasedSeparately}}" stepKey="checkOptionPurchaseSeparately"/> <!-- Add first downloadable link --> - <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="addFirstDownloadableProductLink"> + <actionGroup ref="AddDownloadableProductLinkWithMaxDownloadsActionGroup" stepKey="addFirstDownloadableProductLink"> <argument name="link" value="downloadableLinkWithMaxDownloads"/> </actionGroup> <!-- Add second downloadable link --> - <actionGroup ref="addDownloadableProductLink" stepKey="addSecondDownloadableProductLink"> + <actionGroup ref="AddDownloadableProductLinkActionGroup" stepKey="addSecondDownloadableProductLink"> <argument name="link" value="downloadableLink"/> </actionGroup> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithSpecialPriceTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithSpecialPriceTest.xml index fb59d51831bae..4e01fb575f9f4 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithSpecialPriceTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithSpecialPriceTest.xml @@ -68,12 +68,12 @@ <checkOption selector="{{AdminProductDownloadableSection.isLinksPurchasedSeparately}}" stepKey="checkOptionPurchaseSeparately"/> <!-- Add first downloadable link --> - <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="addFirstDownloadableProductLink"> + <actionGroup ref="AddDownloadableProductLinkWithMaxDownloadsActionGroup" stepKey="addFirstDownloadableProductLink"> <argument name="link" value="downloadableLinkWithMaxDownloads"/> </actionGroup> <!-- Add second downloadable link --> - <actionGroup ref="addDownloadableProductLink" stepKey="addSecondDownloadableProductLink"> + <actionGroup ref="AddDownloadableProductLinkActionGroup" stepKey="addSecondDownloadableProductLink"> <argument name="link" value="downloadableLink"/> </actionGroup> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithoutFillingQuantityAndStockTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithoutFillingQuantityAndStockTest.xml index af9487e3e6a23..12d2d5492d12b 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithoutFillingQuantityAndStockTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithoutFillingQuantityAndStockTest.xml @@ -65,12 +65,12 @@ <checkOption selector="{{AdminProductDownloadableSection.isLinksPurchasedSeparately}}" stepKey="checkOptionPurchaseSeparately"/> <!-- Add first downloadable link --> - <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="addFirstDownloadableProductLink"> + <actionGroup ref="AddDownloadableProductLinkWithMaxDownloadsActionGroup" stepKey="addFirstDownloadableProductLink"> <argument name="link" value="downloadableLinkWithMaxDownloads"/> </actionGroup> <!-- Add second downloadable link --> - <actionGroup ref="addDownloadableProductLink" stepKey="addSecondDownloadableProductLink"> + <actionGroup ref="AddDownloadableProductLinkActionGroup" stepKey="addSecondDownloadableProductLink"> <argument name="link" value="downloadableLink"/> </actionGroup> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithoutTaxClassIdTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithoutTaxClassIdTest.xml index dd7e3331a0ed2..670f9f66c186b 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithoutTaxClassIdTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithoutTaxClassIdTest.xml @@ -66,12 +66,12 @@ <checkOption selector="{{AdminProductDownloadableSection.isLinksPurchasedSeparately}}" stepKey="checkOptionPurchaseSeparately"/> <!-- Add first downloadable link --> - <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="addFirstDownloadableProductLink"> + <actionGroup ref="AddDownloadableProductLinkWithMaxDownloadsActionGroup" stepKey="addFirstDownloadableProductLink"> <argument name="link" value="downloadableLinkWithMaxDownloads"/> </actionGroup> <!-- Add second downloadable link --> - <actionGroup ref="addDownloadableProductLink" stepKey="addSecondDownloadableProductLink"> + <actionGroup ref="AddDownloadableProductLinkActionGroup" stepKey="addSecondDownloadableProductLink"> <argument name="link" value="downloadableLink"/> </actionGroup> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml index 20c1acaf8d612..ff76180e34d05 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml @@ -59,7 +59,7 @@ <selectOption selector="{{AdminProductFormSection.productWeightSelect}}" userInput="This item has no weight" stepKey="selectNoWeightForProduct"/> <actionGroup ref="AdminAddDownloadableLinkInformationActionGroup" stepKey="addDownloadableLinkInformation"/> <checkOption selector="{{AdminProductDownloadableSection.isLinksPurchasedSeparately}}" stepKey="checkOptionPurchaseSeparately"/> - <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="addDownloadableProductLink"> + <actionGroup ref="AddDownloadableProductLinkWithMaxDownloadsActionGroup" stepKey="addDownloadableProductLink"> <argument name="link" value="downloadableLinkWithMaxDownloads"/> </actionGroup> <actionGroup ref="saveProductForm" stepKey="saveDownloadableProductForm"/> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminRemoveDefaultImageDownloadableProductTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminRemoveDefaultImageDownloadableProductTest.xml index 3597c12e82df0..90d77a016629b 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminRemoveDefaultImageDownloadableProductTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminRemoveDefaultImageDownloadableProductTest.xml @@ -48,10 +48,10 @@ <fillField userInput="{{downloadableData.link_title}}" selector="{{AdminProductDownloadableSection.linksTitleInput}}" stepKey="fillDownloadableLinkTitle"/> <checkOption selector="{{AdminProductDownloadableSection.isLinksPurchasedSeparately}}" stepKey="checkLinksPurchasedSeparately"/> <fillField userInput="{{downloadableData.sample_title}}" selector="{{AdminProductDownloadableSection.samplesTitleInput}}" stepKey="fillDownloadableSampleTitle"/> - <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="addDownloadableLinkWithMaxDownloads"> + <actionGroup ref="AddDownloadableProductLinkWithMaxDownloadsActionGroup" stepKey="addDownloadableLinkWithMaxDownloads"> <argument name="link" value="downloadableLinkWithMaxDownloads"/> </actionGroup> - <actionGroup ref="addDownloadableProductLink" stepKey="addDownloadableLink"> + <actionGroup ref="AddDownloadableProductLinkActionGroup" stepKey="addDownloadableLink"> <argument name="link" value="downloadableLink"/> </actionGroup> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml index 0d98862d9a5e7..ff31087b05d20 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml @@ -41,10 +41,10 @@ <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"> + <actionGroup ref="AddDownloadableProductLinkWithMaxDownloadsActionGroup" stepKey="addDownloadableProductLinkWithMaxDownloads" after="fillSampleTitle"> <argument name="link" value="downloadableLinkWithMaxDownloads"/> </actionGroup> - <actionGroup ref="addDownloadableProductLink" stepKey="addDownloadableProductLink" before="saveProductForm"> + <actionGroup ref="AddDownloadableProductLinkActionGroup" stepKey="addDownloadableProductLink" before="saveProductForm"> <argument name="link" value="downloadableLink"/> </actionGroup> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/EditDownloadableProductWithSeparateLinksFromCartTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/EditDownloadableProductWithSeparateLinksFromCartTest.xml index 274dd39468a2b..6beb145de5cfa 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/EditDownloadableProductWithSeparateLinksFromCartTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/EditDownloadableProductWithSeparateLinksFromCartTest.xml @@ -51,12 +51,12 @@ stepKey="checkOptionPurchaseSeparately"/> <!-- Add first downloadable link --> - <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="addFirstDownloadableProductLink"> + <actionGroup ref="AddDownloadableProductLinkWithMaxDownloadsActionGroup" stepKey="addFirstDownloadableProductLink"> <argument name="link" value="downloadableLinkWithMaxDownloads"/> </actionGroup> <!-- Add second downloadable link --> - <actionGroup ref="addDownloadableProductLink" stepKey="addSecondDownloadableProductLink"> + <actionGroup ref="AddDownloadableProductLinkActionGroup" stepKey="addSecondDownloadableProductLink"> <argument name="link" value="downloadableLink"/> </actionGroup> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/EndToEndB2CAdminTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/EndToEndB2CAdminTest.xml index 75a66cec91692..18b851f08927b 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/EndToEndB2CAdminTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/EndToEndB2CAdminTest.xml @@ -14,7 +14,7 @@ <actionGroup ref="goToCreateProductPage" stepKey="goToCreateDownloadableProduct" after="waitForProductPageLoadDownloadable"> <argument name="product" value="DownloadableProduct"/> </actionGroup> - <actionGroup ref="fillMainDownloadableProductForm" stepKey="fillMainProductFormDownloadable" after="goToCreateDownloadableProduct"> + <actionGroup ref="FillMainDownloadableProductFormActionGroup" stepKey="fillMainProductFormDownloadable" after="goToCreateDownloadableProduct"> <argument name="product" value="DownloadableProduct"/> </actionGroup> @@ -25,22 +25,22 @@ <fillField userInput="{{downloadableData.sample_title}}" selector="{{AdminProductDownloadableSection.samplesTitleInput}}" stepKey="fillDownloadableSampleTitle" after="checkLinksPurchasedSeparately"/> <!-- Link 1 --> - <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="addDownloadableLinkWithMaxDownloads" after="fillDownloadableSampleTitle"> + <actionGroup ref="AddDownloadableProductLinkWithMaxDownloadsActionGroup" stepKey="addDownloadableLinkWithMaxDownloads" after="fillDownloadableSampleTitle"> <argument name="link" value="downloadableLinkWithMaxDownloads"/> </actionGroup> <!-- Link 2 --> - <actionGroup ref="addDownloadableProductLink" stepKey="addDownloadableLink" after="addDownloadableLinkWithMaxDownloads"> + <actionGroup ref="AddDownloadableProductLinkActionGroup" stepKey="addDownloadableLink" after="addDownloadableLinkWithMaxDownloads"> <argument name="link" value="downloadableLink"/> </actionGroup> <!-- Sample 1 --> - <actionGroup ref="addDownloadableSampleFile" stepKey="addDownloadSampleFile" after="addDownloadableLink"> + <actionGroup ref="AddDownloadableSampleFileActionGroup" stepKey="addDownloadSampleFile" after="addDownloadableLink"> <argument name="sample" value="downloadableSampleFile"/> </actionGroup> <!-- Sample 2 --> - <actionGroup ref="addDownloadableSampleUrl" stepKey="addDownloadableSampleUrl" after="addDownloadSampleFile"> + <actionGroup ref="AddDownloadableSampleUrlActionGroup" stepKey="addDownloadableSampleUrl" after="addDownloadSampleFile"> <argument name="sample" value="downloadableSampleUrl"/> </actionGroup> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/ManualSelectAllDownloadableLinksDownloadableProductTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/ManualSelectAllDownloadableLinksDownloadableProductTest.xml index a86fd544d24d6..505151c3ac458 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/ManualSelectAllDownloadableLinksDownloadableProductTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/ManualSelectAllDownloadableLinksDownloadableProductTest.xml @@ -51,12 +51,12 @@ stepKey="checkOptionPurchaseSeparately"/> <!-- Add first downloadable link --> - <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="addFirstDownloadableProductLink"> + <actionGroup ref="AddDownloadableProductLinkWithMaxDownloadsActionGroup" stepKey="addFirstDownloadableProductLink"> <argument name="link" value="downloadableLinkWithMaxDownloads"/> </actionGroup> <!-- Add second downloadable link --> - <actionGroup ref="addDownloadableProductLink" stepKey="addSecondDownloadableProductLink"> + <actionGroup ref="AddDownloadableProductLinkActionGroup" stepKey="addSecondDownloadableProductLink"> <argument name="link" value="downloadableLink"/> </actionGroup> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/NewProductsListWidgetDownloadableProductTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/NewProductsListWidgetDownloadableProductTest.xml index 94fca6f507637..55c673146021d 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/NewProductsListWidgetDownloadableProductTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/NewProductsListWidgetDownloadableProductTest.xml @@ -46,7 +46,7 @@ <fillField userInput="This Is A Title" selector="{{AdminProductDownloadableSection.linksTitleInput}}" stepKey="fillDownloadableLinkTitle"/> <checkOption selector="{{AdminProductDownloadableSection.isLinksPurchasedSeparately}}" stepKey="checkLinksPurchasedSeparately"/> <fillField userInput="This Is Another Title" selector="{{AdminProductDownloadableSection.samplesTitleInput}}" stepKey="fillDownloadableSampleTitle"/> - <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="addDownloadableLinkWithMaxDownloads"> + <actionGroup ref="AddDownloadableProductLinkWithMaxDownloadsActionGroup" stepKey="addDownloadableLinkWithMaxDownloads"> <argument name="link" value="downloadableLinkWithMaxDownloads"/> </actionGroup> <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveProduct"/> @@ -59,4 +59,4 @@ <waitForPageLoad stepKey="waitForCmsPage"/> <see selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" userInput="{{_defaultProduct.name}}" stepKey="seeProductName"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/SelectAllDownloadableLinksDownloadableProductTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/SelectAllDownloadableLinksDownloadableProductTest.xml index f9ca6fea09cf0..fdd4268bd84e1 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/SelectAllDownloadableLinksDownloadableProductTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/SelectAllDownloadableLinksDownloadableProductTest.xml @@ -51,12 +51,12 @@ stepKey="checkOptionPurchaseSeparately"/> <!-- Add first downloadable link --> - <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="addFirstDownloadableProductLink"> + <actionGroup ref="AddDownloadableProductLinkWithMaxDownloadsActionGroup" stepKey="addFirstDownloadableProductLink"> <argument name="link" value="downloadableLinkWithMaxDownloads"/> </actionGroup> <!-- Add second downloadable link --> - <actionGroup ref="addDownloadableProductLink" stepKey="addSecondDownloadableProductLink"> + <actionGroup ref="AddDownloadableProductLinkActionGroup" stepKey="addSecondDownloadableProductLink"> <argument name="link" value="downloadableLink"/> </actionGroup> From 8ac3bba1327060112cd2b437f95d9fbc71fea89a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 28 Nov 2019 22:27:30 +0100 Subject: [PATCH 0172/1143] FIX: Update references to the right ones (forgot to replace) --- ...equiredFieldsInGroupedProductFormActionGroup.xml | 13 ------------- .../Test/AdminAddDefaultImageGroupedProductTest.xml | 2 +- .../Test/AdminAddDefaultVideoGroupedProductTest.xml | 2 +- ...AdminCreateAndEditGroupedProductSettingsTest.xml | 4 ++-- .../Test/Mftf/Test/AdminGroupedProductsListTest.xml | 2 +- .../Test/AdminGroupedSetEditRelatedProductsTest.xml | 2 +- .../AdminRemoveDefaultImageGroupedProductTest.xml | 2 +- .../AdminRemoveDefaultVideoGroupedProductTest.xml | 2 +- .../Test/AdminSortingAssociatedProductsTest.xml | 2 +- .../Test/Mftf/Test/EndToEndB2CAdminTest.xml | 8 ++++---- 10 files changed, 13 insertions(+), 26 deletions(-) diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/CheckRequiredFieldsInGroupedProductFormActionGroup.xml b/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/CheckRequiredFieldsInGroupedProductFormActionGroup.xml index 26257dd98673c..84bb291120ee5 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/CheckRequiredFieldsInGroupedProductFormActionGroup.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/CheckRequiredFieldsInGroupedProductFormActionGroup.xml @@ -21,17 +21,4 @@ <see selector="{{AdminProductFormSection.fieldError('name')}}" userInput="This is a required field." stepKey="seeNameRequired"/> <see selector="{{AdminProductFormSection.fieldError('sku')}}" userInput="This is a required field." stepKey="seeSkuRequired"/> </actionGroup> - - <!--Fill main fields in grouped product form--> - - - <!--Filter product grid and see expected grouped product--> - - - <!--Fill product min quantity in group products grid--> - - - <!-- Assign Specified Product To Grouped Product --> - <!-- Assumes web client is on grouped product edit page --> - </actionGroups> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminAddDefaultImageGroupedProductTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminAddDefaultImageGroupedProductTest.xml index f2cb2cc993a50..3618e90e6efda 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminAddDefaultImageGroupedProductTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminAddDefaultImageGroupedProductTest.xml @@ -45,7 +45,7 @@ <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct"> <argument name="product" value="GroupedProduct"/> </actionGroup> - <actionGroup ref="fillGroupedProductForm" stepKey="fillProductForm"> + <actionGroup ref="FillGroupedProductFormActionGroup" stepKey="fillProductForm"> <argument name="product" value="GroupedProduct"/> </actionGroup> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminAddDefaultVideoGroupedProductTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminAddDefaultVideoGroupedProductTest.xml index c3a95bbef3aa3..9892df4bb0b41 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminAddDefaultVideoGroupedProductTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminAddDefaultVideoGroupedProductTest.xml @@ -32,7 +32,7 @@ <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> <argument name="product" value="GroupedProduct"/> </actionGroup> - <actionGroup ref="fillGroupedProductForm" stepKey="fillMainProductForm"> + <actionGroup ref="FillGroupedProductFormActionGroup" stepKey="fillMainProductForm"> <argument name="product" value="GroupedProduct"/> </actionGroup> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminCreateAndEditGroupedProductSettingsTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminCreateAndEditGroupedProductSettingsTest.xml index 62a685554f735..8420de66a1604 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminCreateAndEditGroupedProductSettingsTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminCreateAndEditGroupedProductSettingsTest.xml @@ -52,12 +52,12 @@ </actionGroup> <!-- Fill all main fields --> - <actionGroup ref="fillGroupedProductForm" stepKey="fillProductForm"> + <actionGroup ref="FillGroupedProductFormActionGroup" stepKey="fillProductForm"> <argument name="product" value="GroupedProduct"/> </actionGroup> <!-- Add simple product to the Group --> - <actionGroup ref="AdminAssignProductToGroup" stepKey="addFirstSimpleToGroup"> + <actionGroup ref="AdminAssignProductToGroupActionGroup" stepKey="addFirstSimpleToGroup"> <argument name="product" value="$$createProduct$$"/> </actionGroup> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminGroupedProductsListTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminGroupedProductsListTest.xml index b59cf1e2175d8..8c9b9ee552ffe 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminGroupedProductsListTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminGroupedProductsListTest.xml @@ -42,7 +42,7 @@ <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> <argument name="product" value="GroupedProduct"/> </actionGroup> - <actionGroup ref="fillGroupedProductForm" stepKey="fillMainProductForm"> + <actionGroup ref="FillGroupedProductFormActionGroup" stepKey="fillMainProductForm"> <argument name="product" value="GroupedProduct"/> </actionGroup> <!-- Add two simple products to grouped product --> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminGroupedSetEditRelatedProductsTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminGroupedSetEditRelatedProductsTest.xml index 8117d627a370c..cddadff986539 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminGroupedSetEditRelatedProductsTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminGroupedSetEditRelatedProductsTest.xml @@ -30,7 +30,7 @@ <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct"> <argument name="product" value="GroupedProduct"/> </actionGroup> - <actionGroup ref="fillGroupedProductForm" stepKey="fillProductForm"> + <actionGroup ref="FillGroupedProductFormActionGroup" stepKey="fillProductForm"> <argument name="product" value="GroupedProduct"/> </actionGroup> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminRemoveDefaultImageGroupedProductTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminRemoveDefaultImageGroupedProductTest.xml index da7cfaeb71566..de899d77a9a7a 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminRemoveDefaultImageGroupedProductTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminRemoveDefaultImageGroupedProductTest.xml @@ -42,7 +42,7 @@ <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct"> <argument name="product" value="GroupedProduct"/> </actionGroup> - <actionGroup ref="fillGroupedProductForm" stepKey="fillProductForm"> + <actionGroup ref="FillGroupedProductFormActionGroup" stepKey="fillProductForm"> <argument name="product" value="GroupedProduct"/> </actionGroup> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminRemoveDefaultVideoGroupedProductTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminRemoveDefaultVideoGroupedProductTest.xml index e322d4a1eb038..3bd74c103a519 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminRemoveDefaultVideoGroupedProductTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminRemoveDefaultVideoGroupedProductTest.xml @@ -32,7 +32,7 @@ <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> <argument name="product" value="GroupedProduct"/> </actionGroup> - <actionGroup ref="fillGroupedProductForm" stepKey="fillMainProductForm"> + <actionGroup ref="FillGroupedProductFormActionGroup" stepKey="fillMainProductForm"> <argument name="product" value="GroupedProduct"/> </actionGroup> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminSortingAssociatedProductsTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminSortingAssociatedProductsTest.xml index ad5fbbb30edeb..dc6cde31c1ae6 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminSortingAssociatedProductsTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminSortingAssociatedProductsTest.xml @@ -133,7 +133,7 @@ <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct"> <argument name="product" value="GroupedProduct"/> </actionGroup> - <actionGroup ref="fillGroupedProductForm" stepKey="fillProductForm"> + <actionGroup ref="FillGroupedProductFormActionGroup" stepKey="fillProductForm"> <argument name="product" value="GroupedProduct"/> </actionGroup> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/EndToEndB2CAdminTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/EndToEndB2CAdminTest.xml index dbe3dddfca81b..80b7640f8283c 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/EndToEndB2CAdminTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/EndToEndB2CAdminTest.xml @@ -14,8 +14,8 @@ <actionGroup ref="goToCreateProductPage" stepKey="goToCreateGroupedProduct" after="waitForProductPageLoadGrouped"> <argument name="product" value="GroupedProduct"/> </actionGroup> - <actionGroup ref="checkRequiredFieldsInGroupedProductForm" stepKey="checkRequiredFieldsProductGrouped" after="goToCreateGroupedProduct"/> - <actionGroup ref="fillGroupedProductForm" stepKey="fillGroupedProductForm" after="checkRequiredFieldsProductGrouped"> + <actionGroup ref="CheckRequiredFieldsInGroupedProductFormActionGroup" stepKey="checkRequiredFieldsProductGrouped" after="goToCreateGroupedProduct"/> + <actionGroup ref="FillGroupedProductFormActionGroup" stepKey="fillGroupedProductForm" after="checkRequiredFieldsProductGrouped"> <argument name="product" value="GroupedProduct"/> </actionGroup> <scrollTo selector="{{AdminProductFormGroupedProductsSection.toggleGroupedProduct}}" x="0" y="-100" stepKey="scrollToGroupedSection" after="fillGroupedProductForm"/> @@ -29,7 +29,7 @@ <checkOption selector="{{AdminAddProductsToGroupPanel.firstCheckbox}}" stepKey="checkFilterResult" after="filterGroupedProductOptions"/> <click selector="{{AdminAddProductsToGroupPanel.addSelectedProducts}}" stepKey="clickAddSelectedGroupProducts" after="checkFilterResult"/> <actionGroup ref="saveProductForm" stepKey="saveGroupedProduct" after="clickAddSelectedGroupProducts"/> - <actionGroup ref="viewGroupedProductInAdminGrid" stepKey="viewGroupedProductInGrid" after="saveGroupedProduct"> + <actionGroup ref="ViewGroupedProductInAdminGridActionGroup" stepKey="viewGroupedProductInGrid" after="saveGroupedProduct"> <argument name="product" value="GroupedProduct"/> </actionGroup> @@ -39,4 +39,4 @@ <argument name="product" value="GroupedProduct"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> From c6c5a3302467f20e270dc5d20ff5b4f23e3f2e8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 28 Nov 2019 22:53:03 +0100 Subject: [PATCH 0173/1143] REFACTOR: Extract Action Groups to separate files (according to MFTF best practices) --- .../AdminCurrencyRatesActionGroup.xml | 16 -------------- .../AdminSaveCurrencyRatesActionGroup.xml | 16 ++++++++++++++ .../AdminSetCurrencyRatesActionGroup.xml | 22 +++++++++++++++++++ .../StorefrontCurrencyRatesActionGroup.xml | 9 -------- ...ayWhenChooseThreeAllowedCurrenciesTest.xml | 2 +- 5 files changed, 39 insertions(+), 26 deletions(-) create mode 100644 app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/AdminSaveCurrencyRatesActionGroup.xml create mode 100644 app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/AdminSetCurrencyRatesActionGroup.xml diff --git a/app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/AdminCurrencyRatesActionGroup.xml b/app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/AdminCurrencyRatesActionGroup.xml index a2e25cf858a6e..7f2a9846f3fd0 100644 --- a/app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/AdminCurrencyRatesActionGroup.xml +++ b/app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/AdminCurrencyRatesActionGroup.xml @@ -16,20 +16,4 @@ <click selector="{{AdminCurrencyRatesSection.import}}" stepKey="clickImport"/> <waitForElementVisible selector="{{AdminCurrencyRatesSection.oldRate}}" stepKey="waitForOldRateVisible"/> </actionGroup> - <actionGroup name="AdminSaveCurrencyRatesActionGroup"> - <click selector="{{AdminCurrencyRatesSection.saveCurrencyRates}}" stepKey="clickSaveCurrencyRates"/> - <waitForPageLoad stepKey="waitForSave"/> - <see selector="{{AdminMessagesSection.success}}" userInput="All valid rates have been saved." stepKey="seeSuccessMessage"/> - </actionGroup> - <actionGroup name="AdminSetCurrencyRatesActionGroup"> - <arguments> - <argument name="firstCurrency" type="string" defaultValue="USD"/> - <argument name="secondCurrency" type="string" defaultValue="EUR"/> - <argument name="rate" type="string" defaultValue="0.5"/> - </arguments> - <fillField selector="{{AdminCurrencyRatesSection.currencyRate(firstCurrency, secondCurrency)}}" userInput="{{rate}}" stepKey="setCurrencyRate"/> - <click selector="{{AdminCurrencyRatesSection.saveCurrencyRates}}" stepKey="clickSaveCurrencyRates"/> - <waitForPageLoad stepKey="waitForSave"/> - <see selector="{{AdminMessagesSection.success}}" userInput="{{AdminSaveCurrencyRatesMessageData.success}}" stepKey="seeSuccessMessage"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/AdminSaveCurrencyRatesActionGroup.xml b/app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/AdminSaveCurrencyRatesActionGroup.xml new file mode 100644 index 0000000000000..82401eea34aca --- /dev/null +++ b/app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/AdminSaveCurrencyRatesActionGroup.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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminSaveCurrencyRatesActionGroup"> + <click selector="{{AdminCurrencyRatesSection.saveCurrencyRates}}" stepKey="clickSaveCurrencyRates"/> + <waitForPageLoad stepKey="waitForSave"/> + <see selector="{{AdminMessagesSection.success}}" userInput="All valid rates have been saved." stepKey="seeSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/AdminSetCurrencyRatesActionGroup.xml b/app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/AdminSetCurrencyRatesActionGroup.xml new file mode 100644 index 0000000000000..6b8a93ef3542d --- /dev/null +++ b/app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/AdminSetCurrencyRatesActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminSetCurrencyRatesActionGroup"> + <arguments> + <argument name="firstCurrency" type="string" defaultValue="USD"/> + <argument name="secondCurrency" type="string" defaultValue="EUR"/> + <argument name="rate" type="string" defaultValue="0.5"/> + </arguments> + <fillField selector="{{AdminCurrencyRatesSection.currencyRate(firstCurrency, secondCurrency)}}" userInput="{{rate}}" stepKey="setCurrencyRate"/> + <click selector="{{AdminCurrencyRatesSection.saveCurrencyRates}}" stepKey="clickSaveCurrencyRates"/> + <waitForPageLoad stepKey="waitForSave"/> + <see selector="{{AdminMessagesSection.success}}" userInput="{{AdminSaveCurrencyRatesMessageData.success}}" stepKey="seeSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/StorefrontCurrencyRatesActionGroup.xml b/app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/StorefrontCurrencyRatesActionGroup.xml index 02cf23c323a8a..2f6d1df102d06 100644 --- a/app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/StorefrontCurrencyRatesActionGroup.xml +++ b/app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/StorefrontCurrencyRatesActionGroup.xml @@ -17,13 +17,4 @@ <click selector="{{StorefrontSwitchCurrencyRatesSection.currency(currency)}}" stepKey="chooseCurrency"/> <see selector="{{StorefrontSwitchCurrencyRatesSection.selectedCurrency}}" userInput="{{currency}}" stepKey="seeSelectedCurrency"/> </actionGroup> - <actionGroup name="StorefrontSwitchCurrency"> - <arguments> - <argument name="currency" type="string" defaultValue="EUR"/> - </arguments> - <click selector="{{StorefrontSwitchCurrencyRatesSection.currencyTrigger}}" stepKey="openTrigger"/> - <waitForElementVisible selector="{{StorefrontSwitchCurrencyRatesSection.currency(currency)}}" stepKey="waitForCurrency"/> - <click selector="{{StorefrontSwitchCurrencyRatesSection.currency(currency)}}" stepKey="chooseCurrency"/> - <see selector="{{StorefrontSwitchCurrencyRatesSection.selectedCurrency}}" userInput="{{currency}}" stepKey="seeSelectedCurrency"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayWhenChooseThreeAllowedCurrenciesTest.xml b/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayWhenChooseThreeAllowedCurrenciesTest.xml index 26fbfd394be68..8783f1cee041b 100644 --- a/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayWhenChooseThreeAllowedCurrenciesTest.xml +++ b/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayWhenChooseThreeAllowedCurrenciesTest.xml @@ -45,7 +45,7 @@ <!--Open created product on Storefront and place for order--> <amOnPage url="{{StorefrontProductPage.url($$createNewProduct.custom_attributes[url_key]$$)}}" stepKey="goToNewProductPage"/> <waitForPageLoad stepKey="waitForNewProductPagePageLoad"/> - <actionGroup ref="StorefrontSwitchCurrency" stepKey="switchCurrency"> + <actionGroup ref="StorefrontSwitchCurrencyActionGroup" stepKey="switchCurrency"> <argument name="currency" value="RUB"/> </actionGroup> <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontNewProductPage"> From 121a17d31906f2cedc266e0c5a316b9b15cc0064 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Fri, 29 Nov 2019 00:04:35 +0100 Subject: [PATCH 0174/1143] REFACTOR: Extract Action Groups to separate files (according to MFTF best practices) --- .../Test/AdminDeleteCatalogPriceRuleTest.xml | 2 +- .../Mftf/Test/SearchEntityResultsTest.xml | 4 +- ...oductConfigurationAttributeActionGroup.xml | 49 ++ ...ProductToConfigurationsGridActionGroup.xml | 29 + ...ToConfigurableProductOptionActionGroup.xml | 27 + ...ToConfigurableProductOptionActionGroup.xml | 25 + ...ToConfigurableProductOptionActionGroup.xml | 21 + .../AdminConfigurableProductActionGroup.xml | 545 ------------------ ...roductDisableConfigurationsActionGroup.xml | 19 + ...gurableWizardMoveToNextStepActionGroup.xml | 23 + ...reateApiConfigurableProductActionGroup.xml | 17 - ...rableProductWithHiddenChildActionGroup.xml | 26 + ...tWithAttributeUncheckOptionActionGroup.xml | 25 + ...eConfigurationsForAttributeActionGroup.xml | 22 + ...leProductOnAdminProductPageActionGroup.xml | 23 + ...riceOnStorefrontProductPageActionGroup.xml | 26 + ...AndPriceInStorefrontProductActionGroup.xml | 25 + ...mageInStorefrontProductPageActionGroup.xml | 26 + ...bleProductChildProductPriceActionGroup.xml | 21 + ...ProductConfigurationsInGridActionGroup.xml | 31 + ...nfigurationsInGridExceptSkuActionGroup.xml | 19 + .../CreateConfigurableProductActionGroup.xml | 75 +++ ...ableProductWithAttributeSetActionGroup.xml | 27 + ...bleProductWithTwoAttributesActionGroup.xml | 57 ++ ...eConfigurationsForAttributeActionGroup.xml | 22 + ...tionsForAttributeWithImagesActionGroup.xml | 29 + ...nfigurationsForTwoAttributeActionGroup.xml | 34 ++ ....xml => CreateNewAttributeActionGroup.xml} | 74 +-- .../CreateOptionsForAttributeActionGroup.xml | 31 + .../DeleteCreatedAttributeActionGroup.xml | 45 ++ .../FillAllRequiredFieldsActionGroup.xml | 24 + ...dProductAfterSettingOptionsActionGroup.xml | 15 + ...nfigurationsByAttributeCodeActionGroup.xml | 32 + .../GotoCatalogProductsPageActionGroup.xml | 22 + ...GotoConfigurableProductPageActionGroup.xml | 21 + .../SaveConfigurableProductActionGroup.xml | 23 + ...uctAddToCurrentAttributeSetActionGroup.xml | 22 + ...eProductWithNewAttributeSetActionGroup.xml | 23 + .../SaveConfiguredProductActionGroup.xml | 20 + ...ttributeAndCreateTwoOptionsActionGroup.xml | 28 + ...SingleAttributeAndAddToCartActionGroup.xml | 26 + ...eConfigurationsForAttributeActionGroup.xml | 15 + ...ategoryConfigurableProductActionGroup.xml} | 17 +- ...tOfStockConfigurableProductActionGroup.xml | 24 + ...ontCheckConfigurableProductActionGroup.xml | 31 + ...kConfigurableProductOptionsActionGroup.xml | 32 + ...AndCheckConfigurableProductActionGroup.xml | 24 + .../StorefrontProductActionGroup.xml | 134 ----- .../StorefrontProductCartActionGroup.xml | 12 - ...fyOptionInProductStorefrontActionGroup.xml | 22 + ...figurableProductInAdminGridActionGroup.xml | 41 ++ ...agesAndPricesToConfigurableProductTest.xml | 6 +- ...hangedWhenSavingProductWithSameSkuTest.xml | 2 +- ...bleProductAttributeValueUniquenessTest.xml | 2 +- ...CheckResultsOfColorAndOtherFiltersTest.xml | 14 +- .../AdminConfigurableProductCreateTest.xml | 2 +- .../AdminConfigurableProductLongSkuTest.xml | 2 +- .../AdminConfigurableProductUpdateTest.xml | 4 +- ...ConfigurableSetEditRelatedProductsTest.xml | 2 +- .../Test/AdminCreateAndSwitchProductType.xml | 18 +- ...onfigurableProductBasedOnParentSkuTest.xml | 8 +- ...ctWithCreatingCategoryAndAttributeTest.xml | 12 +- ...roductWithDisabledChildrenProductsTest.xml | 6 +- ...reateConfigurableProductWithImagesTest.xml | 16 +- ...eeProductDisplayOutOfStockProductsTest.xml | 12 +- ...oductDontDisplayOutOfStockProductsTest.xml | 12 +- ...ableProductWithTierPriceForOneItemTest.xml | 6 +- ...ctWithTwoOptionsAssignedToCategoryTest.xml | 10 +- ...woOptionsWithoutAssignedToCategoryTest.xml | 8 +- ...AdminProductTypeSwitchingOnEditingTest.xml | 8 +- ...igurableProductAttributeNameDesignTest.xml | 10 +- .../Test/Mftf/Test/EndToEndB2CAdminTest.xml | 4 +- .../Mftf/Test/EndToEndB2CGuestUserTest.xml | 32 +- .../Mftf/Test/EndToEndB2CLoggedInUserTest.xml | 16 +- ...orefrontConfigurableProductDetailsTest.xml | 10 +- .../StorefrontConfigurableProductViewTest.xml | 6 +- ...gurableProductWithFileCustomOptionTest.xml | 4 +- ...efrontVisibilityOfDuplicateProductTest.xml | 28 +- ...uctWithAttributesImagesAndSwatchesTest.xml | 2 +- ...figurableProductSwatchMinimumPriceTest.xml | 22 +- .../StorefrontFilterByImageSwatchTest.xml | 2 +- .../Test/StorefrontFilterByTextSwatchTest.xml | 2 +- .../StorefrontFilterByVisualSwatchTest.xml | 2 +- ...tImageColorWhenFilterByColorFilterTest.xml | 4 +- ...oductImagesMatchingProductSwatchesTest.xml | 8 +- ...ddToCartWishListWithUnselectedAttrTest.xml | 2 +- ...tChildImageShouldBeShownOnWishListTest.xml | 2 +- .../Test/EndToEndB2CGuestUserTest.xml | 8 +- .../Test/EndToEndB2CLoggedInUserTest.xml | 4 +- 89 files changed, 1366 insertions(+), 959 deletions(-) create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AddNewProductConfigurationAttributeActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AddProductToConfigurationsGridActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AddUniqueImageToConfigurableProductOptionActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AddUniquePriceToConfigurableProductOptionActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AddUniqueQuantityToConfigurableProductOptionActionGroup.xml delete mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductDisableConfigurationsActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableWizardMoveToNextStepActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminCreateApiConfigurableProductWithHiddenChildActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminCreateConfigurableProductWithAttributeUncheckOptionActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminCreateConfigurationsForAttributeActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AssertConfigurableProductOnAdminProductPageActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AssertConfigurableProductWithSpecialPriceOnStorefrontProductPageActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AssertOptionImageAndPriceInStorefrontProductActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AssertOptionImageInStorefrontProductPageActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/ChangeConfigurableProductChildProductPriceActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/ChangeProductConfigurationsInGridActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/ChangeProductConfigurationsInGridExceptSkuActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateConfigurableProductActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateConfigurableProductWithAttributeSetActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateConfigurableProductWithTwoAttributesActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateConfigurationsForAttributeActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateConfigurationsForAttributeWithImagesActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateConfigurationsForTwoAttributeActionGroup.xml rename app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/{ConfigurableProductAttributeNameDesignActionGroup.xml => CreateNewAttributeActionGroup.xml} (55%) create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateOptionsForAttributeActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/DeleteCreatedAttributeActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/FillAllRequiredFieldsActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/GenerateAndSaveConfiguredProductAfterSettingOptionsActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/GenerateConfigurationsByAttributeCodeActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/GotoCatalogProductsPageActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/GotoConfigurableProductPageActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/SaveConfigurableProductActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/SaveConfigurableProductAddToCurrentAttributeSetActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/SaveConfigurableProductWithNewAttributeSetActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/SaveConfiguredProductActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/SelectCreatedAttributeAndCreateTwoOptionsActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/SelectSingleAttributeAndAddToCartActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StartCreateConfigurationsForAttributeActionGroup.xml rename app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/{StorefrontCategoryActionGroup.xml => StorefrontCheckCategoryConfigurableProductActionGroup.xml} (60%) create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontCheckCategoryOutOfStockConfigurableProductActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontCheckConfigurableProductActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontCheckConfigurableProductOptionsActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontOpenMinicartAndCheckConfigurableProductActionGroup.xml delete mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontProductActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/VerifyOptionInProductStorefrontActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/ViewConfigurableProductInAdminGridActionGroup.xml diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleTest.xml index 16fbca2697702..f9665e9e0a48a 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleTest.xml @@ -28,7 +28,7 @@ <!-- Login to Admin page --> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <!-- Create a configurable product --> - <actionGroup ref="createConfigurableProduct" stepKey="createConfigurableProduct"> + <actionGroup ref="CreateConfigurableProductActionGroup" stepKey="createConfigurableProduct"> <argument name="product" value="_defaultProduct"/> <argument name="category" value="$$createCategory$$"/> </actionGroup> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml b/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml index 3b60e4b09de28..a4a41b38aa954 100644 --- a/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml +++ b/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml @@ -366,7 +366,7 @@ <before> <createData entity="_defaultCategory" stepKey="createCategory"/> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/> - <actionGroup ref="createConfigurableProduct" stepKey="createProduct"> + <actionGroup ref="CreateConfigurableProductActionGroup" stepKey="createProduct"> <argument name="product" value="_defaultProduct"/> <argument name="category" value="$$createCategory$$"/> </actionGroup> @@ -391,7 +391,7 @@ <argument name="productName" value="{{_defaultProduct.name}}"/> <argument name="productUrlKey" value="{{_defaultProduct.urlKey}}"/> </actionGroup> - <actionGroup ref="SelectSingleAttributeAndAddToCart" stepKey="addProductToCart"> + <actionGroup ref="SelectSingleAttributeAndAddToCartActionGroup" stepKey="addProductToCart"> <argument name="productName" value="{{_defaultProduct.name}}"/> <argument name="attributeCode" value="{{colorProductAttribute.default_label}}"/> <argument name="optionName" value="{{colorProductAttribute1.name}}"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AddNewProductConfigurationAttributeActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AddNewProductConfigurationAttributeActionGroup.xml new file mode 100644 index 0000000000000..5914d935d3c49 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AddNewProductConfigurationAttributeActionGroup.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddNewProductConfigurationAttributeActionGroup"> + <annotations> + <description>Generates the Product Configurations for the 2 provided Attribute Names on the Configurable Product creation/edit page.</description> + </annotations> + <arguments> + <argument name="attribute" type="entity"/> + <argument name="firstOption" type="entity"/> + <argument name="secondOption" type="entity"/> + </arguments> + + <!-- Create new attribute --> + <click selector="{{AdminCreateProductConfigurationsPanel.createNewAttribute}}" stepKey="clickOnNewAttribute"/> + <waitForPageLoad stepKey="waitForIFrame"/> + <switchToIFrame selector="{{AdminNewAttributePanel.newAttributeIFrame}}" stepKey="switchToNewAttributeIFrame"/> + <fillField selector="{{AdminNewAttributePanel.defaultLabel}}" userInput="{{attribute.default_label}}" stepKey="fillDefaultLabel"/> + <click selector="{{AdminNewAttributePanel.saveAttribute}}" stepKey="clickOnNewAttributePanel"/> + <waitForPageLoad stepKey="waitForSaveAttribute"/> + <switchToIFrame stepKey="switchOutOfIFrame"/> + <waitForPageLoad stepKey="waitForFilters"/> + + <!-- Find created below attribute and add option; save attribute --> + <click selector="{{AdminCreateProductConfigurationsPanel.filters}}" stepKey="clickOnFilters"/> + <fillField userInput="{{attribute.default_label}}" selector="{{AdminCreateProductConfigurationsPanel.attributeCode}}" stepKey="fillFilterAttributeCodeField"/> + <click selector="{{AdminCreateProductConfigurationsPanel.applyFilters}}" stepKey="clickApplyFiltersButton"/> + <click selector="{{AdminCreateProductConfigurationsPanel.firstCheckbox}}" stepKey="clickOnFirstCheckbox"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton"/> + <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="waitCreateNewValueAppears"/> + <click selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="clickOnCreateFirstNewValue"/> + <fillField userInput="{{firstOption.name}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewFirstOption"/> + <click selector="{{AdminCreateProductConfigurationsPanel.saveAttribute}}" stepKey="clickOnSaveNewAttribute"/> + <click selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="clickOnCreateSecondNewValue"/> + <fillField userInput="{{secondOption.name}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewSecondOption"/> + <click selector="{{AdminCreateProductConfigurationsPanel.saveAttribute}}" stepKey="clickOnSaveAttribute"/> + <click selector="{{AdminCreateProductConfigurationsPanel.selectAll}}" stepKey="clickOnSelectAll"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnSecondNextButton"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnThirdNextButton"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnFourthNextButton"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AddProductToConfigurationsGridActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AddProductToConfigurationsGridActionGroup.xml new file mode 100644 index 0000000000000..f9bd485fa4511 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AddProductToConfigurationsGridActionGroup.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddProductToConfigurationsGridActionGroup"> + <annotations> + <description>Adds the provided Product SKU to the provided Product Name.</description> + </annotations> + <arguments> + <argument name="sku" type="string"/> + <argument name="name" type="string"/> + </arguments> + + <click selector="{{AdminProductFormConfigurationsSection.actionsBtnByProductName(name)}}" stepKey="clickToExpandFirstActions"/> + <click selector="{{AdminProductFormConfigurationsSection.addProduct(name)}}" stepKey="clickChooseFirstDifferentProduct"/> + <switchToIFrame stepKey="switchOutOfIFrame"/> + <waitForPageLoad stepKey="waitForFilters"/> + <click selector="{{AdminCreateProductConfigurationsPanel.filters}}" stepKey="clickFilters"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{sku}}" stepKey="fillProductSkuFilter"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> + <click selector="{{AdminProductGridFilterSection.firstRowBySku(sku)}}" stepKey="clickOnFirstRow"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AddUniqueImageToConfigurableProductOptionActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AddUniqueImageToConfigurableProductOptionActionGroup.xml new file mode 100644 index 0000000000000..26fe50d845dbc --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AddUniqueImageToConfigurableProductOptionActionGroup.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddUniqueImageToConfigurableProductOptionActionGroup"> + <annotations> + <description>Adds the provided Image to a Configurable Product on the Admin Product creation/edit page.</description> + </annotations> + <arguments> + <argument name="image" defaultValue="ProductImage"/> + <argument name="frontend_label" type="string"/> + <argument name="label" type="string"/> + </arguments> + + <click selector="{{AdminCreateProductConfigurationsPanel.applyUniqueImagesToEachSkus}}" stepKey="clickOnApplyUniqueImagesToEachSku"/> + <selectOption userInput="{{frontend_label}}" selector="{{AdminCreateProductConfigurationsPanel.selectImagesButton}}" stepKey="selectOption"/> + <attachFile selector="{{AdminCreateProductConfigurationsPanel.uploadImagesButton(label)}}" userInput="{{image.file}}" stepKey="uploadFile"/> + <waitForElementNotVisible selector="{{AdminCreateProductConfigurationsPanel.uploadProgressBar}}" stepKey="waitForUpload"/> + <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.imageFile(image.fileName)}}" stepKey="waitForThumbnail"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AddUniquePriceToConfigurableProductOptionActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AddUniquePriceToConfigurableProductOptionActionGroup.xml new file mode 100644 index 0000000000000..3852dc5c821ed --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AddUniquePriceToConfigurableProductOptionActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddUniquePriceToConfigurableProductOptionActionGroup"> + <annotations> + <description>On the 'Step 3: Bulk Images, Price and Quantity' page of the 'Create Product Configurations' model click on 'Apply unique prices...'. Select provided Option. Fill price.</description> + </annotations> + <arguments> + <argument name="frontend_label" type="string"/> + <argument name="label" type="string"/> + <argument name="price" type="string"/> + </arguments> + + <click selector="{{AdminCreateProductConfigurationsPanel.applyUniquePricesToEachSkus}}" stepKey="clickOnApplyUniquePricesToEachSku"/> + <selectOption userInput="{{frontend_label}}" selector="{{AdminCreateProductConfigurationsPanel.selectPriceButton}}" stepKey="selectOption"/> + <fillField selector="{{AdminCreateProductConfigurationsPanel.price(label)}}" userInput="{{price}}" stepKey="enterAttributeQuantity"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AddUniqueQuantityToConfigurableProductOptionActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AddUniqueQuantityToConfigurableProductOptionActionGroup.xml new file mode 100644 index 0000000000000..b92a847df8f1d --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AddUniqueQuantityToConfigurableProductOptionActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddUniqueQuantityToConfigurableProductOptionActionGroup"> + <arguments> + <argument name="frontend_label" type="string" defaultValue="{{productAttributeColor.default_label}}"/> + <argument name="label" type="string" defaultValue="option1"/> + <argument name="quantity" type="string" defaultValue="10"/> + </arguments> + <click selector="{{AdminCreateProductConfigurationsPanel.applyUniqueQuantityToEachSkus}}" stepKey="clickOnApplyUniqueQuantitiesToEachSku"/> + <selectOption selector="{{AdminCreateProductConfigurationsPanel.selectQuantity}}" userInput="{{frontend_label}}" stepKey="selectOption"/> + <fillField selector="{{AdminCreateProductConfigurationsPanel.applyUniqueQuantity(label)}}" userInput="{{quantity}}" stepKey="enterAttributeQuantity"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductActionGroup.xml deleted file mode 100644 index 02c7aeb3db6ac..0000000000000 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductActionGroup.xml +++ /dev/null @@ -1,545 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="CreateConfigurableProductWithAttributeSet"> - <annotations> - <description>Admin edit created product as configurable. Choose created options</description> - </annotations> - <arguments> - <argument name="product" defaultValue="_defaultProduct"/> - <argument name="category" defaultValue="_defaultCategory"/> - <argument name="label" type="string" defaultValue="mySet"/> - <argument name="option" type="string" defaultValue="['option1', 'option2', 'option3', 'option4']"/> - </arguments> - <click selector="{{AdminProductFormSection.attributeSet}}" stepKey="startEditAttrSet"/> - <fillField selector="{{AdminProductFormSection.attributeSetFilter}}" userInput="{{label}}" stepKey="searchForAttrSet"/> - <click selector="{{AdminProductFormSection.attributeSetFilterResult}}" stepKey="selectAttrSet"/> - <fillField userInput="{{product.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="fillName"/> - <selectOption selector="{{AdminProductFormSection.additionalOptions}}" parameterArray="{{option}}" stepKey="searchAndMultiSelectCreatedOption"/> - </actionGroup> - <actionGroup name="AdminCreateConfigurationsForAttribute" extends="generateConfigurationsByAttributeCode"> - <annotations> - <description>EXTENDS: generateConfigurationsByAttributeCode. Click to apply single price to all Skus. Enter Attribute price</description> - </annotations> - <arguments> - <argument name="price" type="string" defaultValue="100"/> - </arguments> - <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.applySinglePriceToAllSkus}}" after="clickOnNextButton2" stepKey="waitForNextPageOpened2"/> - <click selector="{{AdminCreateProductConfigurationsPanel.applySinglePriceToAllSkus}}" after="waitForNextPageOpened2" stepKey="clickOnApplySinglePriceToAllSkus"/> - <fillField selector="{{AdminCreateProductConfigurationsPanel.singlePrice}}" userInput="{{price}}" before="clickOnApplySingleQuantityToEachSku" stepKey="enterAttributePrice"/> - </actionGroup> - <actionGroup name="AdminCreateConfigurableProductWithAttributeUncheckOption" extends="generateConfigurationsByAttributeCode"> - <annotations> - <description>EXTENDS: generateConfigurationsByAttributeCode. Click to uncheck created option. Enter Attribute price</description> - </annotations> - <arguments> - <argument name="attributeOption" type="string" defaultValue="option1"/> - <argument name="price" type="string" defaultValue="100"/> - </arguments> - <click selector="{{AdminCreateProductConfigurationsPanel.attributeOption('attributeOption')}}" after="clickOnSelectAll" stepKey="clickToUncheckOption"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" after="clickToUncheckOption" stepKey="clickOnNextButton22"/> - <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.applySinglePriceToAllSkus}}" after="clickOnNextButton22" stepKey="waitForNextPageOpened2"/> - <click selector="{{AdminCreateProductConfigurationsPanel.applySinglePriceToAllSkus}}" after="waitForNextPageOpened2" stepKey="clickOnApplySinglePriceToAllSkus"/> - <fillField selector="{{AdminCreateProductConfigurationsPanel.singlePrice}}" userInput="{{price}}" before="clickOnApplySingleQuantityToEachSku" stepKey="enterAttributePrice"/> - </actionGroup> - <!--Filter the product grid and view expected products--> - <actionGroup name="viewConfigurableProductInAdminGrid"> - <annotations> - <description>Goes to the Admin Product grid page. Validates the provided Configurable Product is present and correct in the grid.</description> - </annotations> - <arguments> - <argument name="product" defaultValue="_defaultProduct"/> - </arguments> - - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> - <waitForPageLoad 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"/> - <seeNumberOfElements selector="{{AdminProductGridSection.productGridRows}}" userInput="3" stepKey="seeCorrectNumberOfProducts"/> - - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFiltersSimple"/> - <selectOption selector="{{AdminProductGridFilterSection.typeFilter}}" userInput="simple" stepKey="selectionProductType"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFiltersWithSimpleType"/> - <see selector="{{AdminProductGridSection.firstProductRow}}" userInput="{{product.name}}" stepKey="seeSimpleProductNameInGrid"/> - <see selector="{{AdminProductGridSection.firstProductRow}}" userInput="{{product.price}}" stepKey="seeSimpleProductPriceInGrid"/> - - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFiltersConfigurable"/> - <selectOption selector="{{AdminProductGridFilterSection.typeFilter}}" userInput="{{product.type_id}}" stepKey="selectionConfigurableProductType"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFiltersWithConfigurableType"/> - <see selector="{{AdminProductGridSection.firstProductRow}}" userInput="{{product.name}}" stepKey="seeConfigurableProductNameInGrid"/> - <dontSee selector="{{AdminProductGridSection.firstProductRow}}" userInput="{{product.price}}" stepKey="dontSeeProductPriceNameInGrid"/> - - <click selector="{{AdminProductGridFilterSection.clearFilters}}" stepKey="clickClearFiltersAfter"/> - </actionGroup> - - <!--Create a configurable product with three options for color: red, white, and blue - Expected start state = logged in as an admin - End state = on the product edit page in the admin--> - <actionGroup name="createConfigurableProduct"> - <annotations> - <description>Goes to the Admin Product grid page. Creates a Configurable Product using the default Product Options.</description> - </annotations> - <arguments> - <argument name="product" defaultValue="_defaultProduct"/> - <argument name="category" defaultValue="_defaultCategory"/> - </arguments> - - <!-- fill in basic configurable product values --> - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> - <waitForPageLoad time="30" stepKey="wait1"/> - <click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickOnAddProductToggle"/> - <click selector="{{AdminProductGridActionSection.addConfigurableProduct}}" stepKey="clickOnAddConfigurableProduct"/> - <fillField userInput="{{product.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="fillName"/> - <fillField userInput="{{product.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="fillSKU"/> - <fillField userInput="{{product.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="fillPrice"/> - <fillField userInput="{{product.quantity}}" selector="{{AdminProductFormSection.productQuantity}}" stepKey="fillQuantity"/> - <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[{{category.name}}]" stepKey="fillCategory"/> - <selectOption userInput="{{product.visibility}}" selector="{{AdminProductFormSection.visibility}}" stepKey="fillVisibility"/> - <click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/> - <fillField userInput="{{product.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/> - - <!-- create configurations for colors the product is available in --> - <click selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="clickOnCreateConfigurations"/> - <click selector="{{AdminCreateProductConfigurationsPanel.createNewAttribute}}" stepKey="clickOnNewAttribute"/> - <waitForPageLoad stepKey="waitForIFrame"/> - <switchToIFrame selector="{{AdminNewAttributePanel.newAttributeIFrame}}" stepKey="switchToNewAttributeIFrame"/> - <fillField selector="{{AdminNewAttributePanel.defaultLabel}}" userInput="{{colorProductAttribute.default_label}}" stepKey="fillDefaultLabel"/> - <click selector="{{AdminNewAttributePanel.saveAttribute}}" stepKey="clickOnNewAttributePanel"/> - <waitForPageLoad stepKey="waitForSaveAttribute"/> - <switchToIFrame stepKey="switchOutOfIFrame"/> - <waitForPageLoad stepKey="waitForFilters"/> - <click selector="{{AdminCreateProductConfigurationsPanel.filters}}" stepKey="clickOnFilters"/> - <fillField userInput="{{colorProductAttribute.default_label}}" selector="{{AdminCreateProductConfigurationsPanel.attributeCode}}" stepKey="fillFilterAttributeCodeField"/> - <click selector="{{AdminCreateProductConfigurationsPanel.applyFilters}}" stepKey="clickApplyFiltersButton"/> - <click selector="{{AdminCreateProductConfigurationsPanel.firstCheckbox}}" stepKey="clickOnFirstCheckbox"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton1"/> - <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="waitCreateNewValueAppears"/> - <click selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="clickOnCreateNewValue1"/> - <fillField userInput="{{colorProductAttribute1.name}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewAttribute1"/> - <click selector="{{AdminCreateProductConfigurationsPanel.saveAttribute}}" stepKey="clickOnSaveNewAttribute1"/> - <click selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="clickOnCreateNewValue2"/> - <fillField userInput="{{colorProductAttribute2.name}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewAttribute2"/> - <click selector="{{AdminCreateProductConfigurationsPanel.saveAttribute}}" stepKey="clickOnSaveNewAttribute2"/> - <click selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="clickOnCreateNewValue3"/> - <fillField userInput="{{colorProductAttribute3.name}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewAttribute3"/> - <click selector="{{AdminCreateProductConfigurationsPanel.saveAttribute}}" stepKey="clickOnSaveNewAttribute3"/> - <click selector="{{AdminCreateProductConfigurationsPanel.selectAll}}" stepKey="clickOnSelectAll"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton2"/> - <click selector="{{AdminCreateProductConfigurationsPanel.applyUniquePricesByAttributeToEachSku}}" stepKey="clickOnApplyUniquePricesByAttributeToEachSku"/> - <selectOption selector="{{AdminCreateProductConfigurationsPanel.selectAttribute}}" userInput="{{colorProductAttribute.default_label}}" stepKey="selectAttributes"/> - <fillField selector="{{AdminCreateProductConfigurationsPanel.attribute1}}" userInput="{{colorProductAttribute1.price}}" stepKey="fillAttributePrice1"/> - <fillField selector="{{AdminCreateProductConfigurationsPanel.attribute2}}" userInput="{{colorProductAttribute2.price}}" stepKey="fillAttributePrice2"/> - <fillField selector="{{AdminCreateProductConfigurationsPanel.attribute3}}" userInput="{{colorProductAttribute3.price}}" stepKey="fillAttributePrice3"/> - <click selector="{{AdminCreateProductConfigurationsPanel.applySingleQuantityToEachSkus}}" stepKey="clickOnApplySingleQuantityToEachSku"/> - <fillField selector="{{AdminCreateProductConfigurationsPanel.quantity}}" userInput="1" stepKey="enterAttributeQuantity"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton3"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton4"/> - <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton2"/> - <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup"/> - <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSaveProductMessage"/> - <seeInTitle userInput="{{product.name}}" stepKey="seeProductNameInTitle"/> - </actionGroup> - - <actionGroup name="createConfigurableProductWithTwoAttributes" extends="createConfigurableProduct"> - <annotations> - <description>Goes to the Admin Product grid page. Creates a Configurable Product with 2 product attributes.</description> - </annotations> - <arguments> - <argument name="attribute1" defaultValue="ProductColorAttribute"/> - <argument name="attribute2" defaultValue="ProductSizeAttribute"/> - </arguments> - <remove keyForRemoval="clickOnNewAttribute"/> - <remove keyForRemoval="waitForIFrame"/> - <remove keyForRemoval="switchToNewAttributeIFrame"/> - <remove keyForRemoval="fillDefaultLabel"/> - <remove keyForRemoval="clickOnNewAttributePanel"/> - <remove keyForRemoval="waitForSaveAttribute"/> - <remove keyForRemoval="switchOutOfIFrame"/> - <remove keyForRemoval="waitForFilters"/> - <remove keyForRemoval="clickOnFilters"/> - <remove keyForRemoval="fillFilterAttributeCodeField"/> - <remove keyForRemoval="clickApplyFiltersButton"/> - <remove keyForRemoval="clickOnFirstCheckbox"/> - <click selector="{{AdminCreateProductConfigurationsPanel.attributeCheckbox(attribute1.attribute_code)}}" stepKey="selectAttribute1" after="clickOnCreateConfigurations"/> - <click selector="{{AdminCreateProductConfigurationsPanel.attributeCheckbox(attribute2.attribute_code)}}" stepKey="selectAttribute2" after="selectAttribute1"/> - <remove keyForRemoval="waitCreateNewValueAppears"/> - <remove keyForRemoval="clickOnCreateNewValue1"/> - <remove keyForRemoval="fillFieldForNewAttribute1"/> - <remove keyForRemoval="clickOnSaveNewAttribute1"/> - <remove keyForRemoval="clickOnCreateNewValue2"/> - <remove keyForRemoval="fillFieldForNewAttribute2"/> - <remove keyForRemoval="clickOnSaveNewAttribute2"/> - <remove keyForRemoval="clickOnCreateNewValue3"/> - <remove keyForRemoval="fillFieldForNewAttribute3"/> - <remove keyForRemoval="clickOnSaveNewAttribute3"/> - <remove keyForRemoval="clickOnSelectAll"/> - <click selector="{{AdminCreateProductConfigurationsPanel.selectAllByAttribute(attribute1.frontend_label)}}" stepKey="selectAllOptionsOfAttribute1" before="clickOnNextButton2"/> - <click selector="{{AdminCreateProductConfigurationsPanel.selectAllByAttribute(attribute2.frontend_label)}}" stepKey="selectAllOptionsOfAttribute2" before="clickOnNextButton2"/> - <remove keyForRemoval="applyUniquePricesByAttributeToEachSku"/> - <remove keyForRemoval="clickOnApplyUniquePricesByAttributeToEachSku"/> - <remove keyForRemoval="selectAttributes"/> - <remove keyForRemoval="fillAttributePrice1"/> - <remove keyForRemoval="fillAttributePrice2"/> - <remove keyForRemoval="fillAttributePrice3"/> - <remove keyForRemoval="clickOnSaveButton2"/> - <remove keyForRemoval="clickOnConfirmInPopup"/> - <remove keyForRemoval="seeSaveProductMessage"/> - <remove keyForRemoval="seeProductNameInTitle"/> - </actionGroup> - <actionGroup name="saveConfigurableProduct"> - <annotations> - <description>Save configurable product</description> - </annotations> - <arguments> - <argument name="product" defaultValue="_defaultProduct"/> - </arguments> - <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton"/> - <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup"/> - <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSaveProductMessage"/> - <seeInTitle userInput="{{product.name}}" stepKey="seeProductNameInTitle"/> - </actionGroup> - - <actionGroup name="generateConfigurationsByAttributeCode"> - <annotations> - <description>Generates the Product Configurations for the provided Attribute Code on the Configurable Product creation/edit page.</description> - </annotations> - <arguments> - <argument name="attributeCode" type="string" defaultValue="SomeString"/> - </arguments> - - <click selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="clickCreateConfigurations"/> - <click selector="{{AdminCreateProductConfigurationsPanel.filters}}" stepKey="clickFilters"/> - <fillField selector="{{AdminCreateProductConfigurationsPanel.attributeCode}}" userInput="{{attributeCode}}" stepKey="fillFilterAttributeCodeField"/> - <click selector="{{AdminCreateProductConfigurationsPanel.applyFilters}}" stepKey="clickApplyFiltersButton"/> - <click selector="{{AdminCreateProductConfigurationsPanel.firstCheckbox}}" stepKey="clickOnFirstCheckbox"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton1"/> - <click selector="{{AdminCreateProductConfigurationsPanel.selectAll}}" stepKey="clickOnSelectAll"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton2"/> - <click selector="{{AdminCreateProductConfigurationsPanel.applySingleQuantityToEachSkus}}" stepKey="clickOnApplySingleQuantityToEachSku"/> - <fillField selector="{{AdminCreateProductConfigurationsPanel.quantity}}" userInput="99" stepKey="enterAttributeQuantity"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton3"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton4"/> - </actionGroup> - <actionGroup name="createOptionsForAttribute"> - <arguments> - <argument name="attributeName" type="string" defaultValue="{{productAttributeColor.default_label}}"/> - <argument name="firstOptionName" type="string" defaultValue="option1"/> - <argument name="secondOptionName" type="string" defaultValue="option2"/> - </arguments> - <click selector="{{AdminCreateProductConfigurationsPanel.filters}}" stepKey="clickOnFilters"/> - <fillField userInput="{{attributeName}}" selector="{{AdminCreateProductConfigurationsPanel.attributeCode}}" stepKey="fillFilterAttributeCodeField"/> - <click selector="{{AdminCreateProductConfigurationsPanel.applyFilters}}" stepKey="clickApplyFiltersButton"/> - <click selector="{{AdminCreateProductConfigurationsPanel.firstCheckbox}}" stepKey="clickOnFirstCheckbox"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton"/> - <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="waitCreateNewValueAppears"/> - <click selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="clickOnCreateFirstNewValue"/> - <fillField userInput="{{firstOptionName}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewFirstOption"/> - <click selector="{{AdminCreateProductConfigurationsPanel.saveAttribute}}" stepKey="clickOnSaveNewAttribute"/> - <click selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="clickOnCreateSecondNewValue"/> - <fillField userInput="{{secondOptionName}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewSecondOption"/> - <click selector="{{AdminCreateProductConfigurationsPanel.saveAttribute}}" stepKey="clickOnSaveAttribute"/> - <click selector="{{AdminCreateProductConfigurationsPanel.selectAll}}" stepKey="clickOnSelectAll"/> - </actionGroup> - - <actionGroup name="createConfigurationsForAttribute" extends="generateConfigurationsByAttributeCode"> - <annotations> - <description>EXTENDS: generateConfigurationsByAttributeCode. Clicks on the Save button. Clicks on the Confirm button.</description> - </annotations> - <arguments> - <argument name="attributeCode" type="string" defaultValue="SomeString"/> - </arguments> - - <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton2"/> - <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup"/> - </actionGroup> - - <actionGroup name="createConfigurationsForAttributeWithImages" extends="generateConfigurationsByAttributeCode"> - <annotations> - <description>EXTENDS: generateConfigurationsByAttributeCode. Adds the provided Attribute Image to the provided Attribute Code.</description> - </annotations> - <arguments> - <argument name="attributeCode" type="string" defaultValue="SomeString"/> - <argument name="image" defaultValue="ProductImage"/> - </arguments> - - <click selector="{{AdminCreateProductConfigurationsPanel.applySingleSetOfImages}}" stepKey="clickOnApplySingleImageSetToAllSku" after="enterAttributeQuantity"/> - <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.imageUploadButton}}" stepKey="seeImageSectionIsReady" after="clickOnApplySingleImageSetToAllSku"/> - <attachFile selector="{{AdminCreateProductConfigurationsPanel.imageFileUpload}}" userInput="{{image.file}}" stepKey="uploadFile" after="seeImageSectionIsReady"/> - <waitForElementNotVisible selector="{{AdminCreateProductConfigurationsPanel.uploadProgressBar}}" stepKey="waitForUpload" after="uploadFile"/> - <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.imageFile(image.fileName)}}" stepKey="waitForThumbnail" after="waitForUpload"/> - - <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton2" after="clickOnNextButton4"/> - <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup" after="clickOnSaveButton2"/> - </actionGroup> - - <actionGroup name="createConfigurationsForTwoAttribute" extends="generateConfigurationsByAttributeCode"> - <annotations> - <description>EXTENDS: generateConfigurationsByAttributeCode. Generates the Product Configurations for the 2 provided Attribute Codes on the Configurable Product creation/edit page.</description> - </annotations> - <arguments> - <argument name="secondAttributeCode" type="string"/> - </arguments> - - <remove keyForRemoval="clickOnSelectAll"/> - <remove keyForRemoval="clickFilters"/> - <remove keyForRemoval="fillFilterAttributeCodeField"/> - <remove keyForRemoval="clickApplyFiltersButton"/> - <remove keyForRemoval="clickOnFirstCheckbox"/> - - <click selector="{{AdminCreateProductConfigurationsPanel.attributeCheckbox(attributeCode)}}" stepKey="clickOnFirstAttributeCheckbox" after="clickCreateConfigurations"/> - <click selector="{{AdminCreateProductConfigurationsPanel.attributeCheckbox(secondAttributeCode)}}" stepKey="clickOnSecondAttributeCheckbox" after="clickOnFirstAttributeCheckbox"/> - <grabTextFrom selector="{{AdminCreateProductConfigurationsPanel.defaultLabel(attributeCode)}}" stepKey="grabFirstAttributeDefaultLabel" after="clickOnSecondAttributeCheckbox"/> - <grabTextFrom selector="{{AdminCreateProductConfigurationsPanel.defaultLabel(secondAttributeCode)}}" stepKey="grabSecondAttributeDefaultLabel" after="grabFirstAttributeDefaultLabel"/> - <click selector="{{AdminCreateProductConfigurationsPanel.selectAllByAttribute({$grabFirstAttributeDefaultLabel})}}" stepKey="clickOnSelectAllForFirstAttribute" after="clickOnNextButton1"/> - <click selector="{{AdminCreateProductConfigurationsPanel.selectAllByAttribute({$grabSecondAttributeDefaultLabel})}}" stepKey="clickOnSelectAllForSecondAttribute" after="clickOnSelectAllForFirstAttribute"/> - <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton2"/> - <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup"/> - </actionGroup> - - <actionGroup name="saveConfiguredProduct"> - <annotations> - <description>Save the Configurable Product on the Configurable Product creation/edit page. Validates that the Success Message is present.</description> - </annotations> - - <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton2"/> - <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup"/> - <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSaveProductMessage"/> - </actionGroup> - - <!--Generate and save configurable product after setting options--> - <actionGroup name="GenerateAndSaveConfiguredProductAfterSettingOptions" extends="saveConfiguredProduct"> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" before="clickOnSaveButton2" stepKey="clickOnNextButton"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" after="clickOnNextButton" stepKey="clickOnGenerateProductsButton"/> - </actionGroup> - - <actionGroup name="addNewProductConfigurationAttribute"> - <annotations> - <description>Generates the Product Configurations for the 2 provided Attribute Names on the Configurable Product creation/edit page.</description> - </annotations> - <arguments> - <argument name="attribute" type="entity"/> - <argument name="firstOption" type="entity"/> - <argument name="secondOption" type="entity"/> - </arguments> - - <!-- Create new attribute --> - <click selector="{{AdminCreateProductConfigurationsPanel.createNewAttribute}}" stepKey="clickOnNewAttribute"/> - <waitForPageLoad stepKey="waitForIFrame"/> - <switchToIFrame selector="{{AdminNewAttributePanel.newAttributeIFrame}}" stepKey="switchToNewAttributeIFrame"/> - <fillField selector="{{AdminNewAttributePanel.defaultLabel}}" userInput="{{attribute.default_label}}" stepKey="fillDefaultLabel"/> - <click selector="{{AdminNewAttributePanel.saveAttribute}}" stepKey="clickOnNewAttributePanel"/> - <waitForPageLoad stepKey="waitForSaveAttribute"/> - <switchToIFrame stepKey="switchOutOfIFrame"/> - <waitForPageLoad stepKey="waitForFilters"/> - - <!-- Find created below attribute and add option; save attribute --> - <click selector="{{AdminCreateProductConfigurationsPanel.filters}}" stepKey="clickOnFilters"/> - <fillField userInput="{{attribute.default_label}}" selector="{{AdminCreateProductConfigurationsPanel.attributeCode}}" stepKey="fillFilterAttributeCodeField"/> - <click selector="{{AdminCreateProductConfigurationsPanel.applyFilters}}" stepKey="clickApplyFiltersButton"/> - <click selector="{{AdminCreateProductConfigurationsPanel.firstCheckbox}}" stepKey="clickOnFirstCheckbox"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton"/> - <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="waitCreateNewValueAppears"/> - <click selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="clickOnCreateFirstNewValue"/> - <fillField userInput="{{firstOption.name}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewFirstOption"/> - <click selector="{{AdminCreateProductConfigurationsPanel.saveAttribute}}" stepKey="clickOnSaveNewAttribute"/> - <click selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="clickOnCreateSecondNewValue"/> - <fillField userInput="{{secondOption.name}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewSecondOption"/> - <click selector="{{AdminCreateProductConfigurationsPanel.saveAttribute}}" stepKey="clickOnSaveAttribute"/> - <click selector="{{AdminCreateProductConfigurationsPanel.selectAll}}" stepKey="clickOnSelectAll"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnSecondNextButton"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnThirdNextButton"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnFourthNextButton"/> - </actionGroup> - <actionGroup name="selectCreatedAttributeAndCreateTwoOptions" extends="addNewProductConfigurationAttribute"> - <remove keyForRemoval="clickOnNewAttribute"/> - <remove keyForRemoval="waitForIFrame"/> - <remove keyForRemoval="switchToNewAttributeIFrame"/> - <remove keyForRemoval="fillDefaultLabel"/> - <remove keyForRemoval="clickOnNewAttributePanel"/> - <remove keyForRemoval="waitForSaveAttribute"/> - <remove keyForRemoval="switchOutOfIFrame"/> - <remove keyForRemoval="waitForFilters"/> - <fillField userInput="{{attribute.attribute_code}}" selector="{{AdminCreateProductConfigurationsPanel.attributeCode}}" stepKey="fillFilterAttributeCodeField"/> - <fillField userInput="{{firstOption.label}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewFirstOption"/> - <fillField userInput="{{secondOption.label}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewSecondOption"/> - <remove keyForRemoval="clickOnSelectAll"/> - <remove keyForRemoval="clickOnSecondNextButton"/> - <remove keyForRemoval="clickOnThirdNextButton"/> - <remove keyForRemoval="clickOnFourthNextButton"/> - </actionGroup> - <actionGroup name="changeProductConfigurationsInGrid"> - <annotations> - <description>Edit the Product Configuration via the Admin Product grid page.</description> - </annotations> - <arguments> - <argument name="firstOption" type="entity"/> - <argument name="secondOption" type="entity"/> - </arguments> - - <fillField userInput="{{firstOption.name}}" selector="{{AdminProductFormConfigurationsSection.confProductNameCell(firstOption.name)}}" stepKey="fillFieldNameForFirstAttributeOption"/> - <fillField userInput="{{secondOption.name}}" selector="{{AdminProductFormConfigurationsSection.confProductNameCell(secondOption.name)}}" stepKey="fillFieldNameForSecondAttributeOption"/> - <fillField userInput="{{firstOption.sku}}" selector="{{AdminProductFormConfigurationsSection.confProductSkuCell(firstOption.name)}}" stepKey="fillFieldSkuForFirstAttributeOption"/> - <fillField userInput="{{secondOption.sku}}" selector="{{AdminProductFormConfigurationsSection.confProductSkuCell(secondOption.name)}}" stepKey="fillFieldSkuForSecondAttributeOption"/> - <fillField userInput="{{firstOption.price}}" selector="{{AdminProductFormConfigurationsSection.confProductPriceCell(firstOption.name)}}" stepKey="fillFieldPriceForFirstAttributeOption"/> - <fillField userInput="{{secondOption.price}}" selector="{{AdminProductFormConfigurationsSection.confProductPriceCell(secondOption.name)}}" stepKey="fillFieldPriceForSecondAttributeOption"/> - <fillField userInput="{{firstOption.quantity}}" selector="{{AdminProductFormConfigurationsSection.confProductQuantityCell(firstOption.name)}}" stepKey="fillFieldQuantityForFirstAttributeOption"/> - <fillField userInput="{{secondOption.quantity}}" selector="{{AdminProductFormConfigurationsSection.confProductQuantityCell(secondOption.name)}}" stepKey="fillFieldQuantityForSecondAttributeOption"/> - <fillField userInput="{{firstOption.weight}}" selector="{{AdminProductFormConfigurationsSection.confProductWeightCell(firstOption.name)}}" stepKey="fillFieldWeightForFirstAttributeOption"/> - <fillField userInput="{{secondOption.weight}}" selector="{{AdminProductFormConfigurationsSection.confProductWeightCell(secondOption.name)}}" stepKey="fillFieldWeightForSecondAttributeOption"/> - </actionGroup> - <actionGroup name="changeConfigurableProductChildProductPrice"> - <annotations> - <description>Change the price of a configurable child product in the grid under configurations.</description> - </annotations> - <arguments> - <argument name="productAttributes" type="string"/> - <argument name="productPrice" type="string"/> - </arguments> - <fillField userInput="{{productPrice}}" selector="{{AdminProductFormConfigurationsSection.confProductPriceCell(productAttributes)}}" stepKey="fillPriceForConfigurableProductAttributeOption"/> - </actionGroup> - <actionGroup name="changeProductConfigurationsInGridExceptSku" extends="changeProductConfigurationsInGrid"> - <annotations> - <description>EXTENDS: changeProductConfigurationsInGrid. Removes 'fillFieldSkuForFirstAttributeOption' and 'fillFieldSkuForSecondAttributeOption'.</description> - </annotations> - - <remove keyForRemoval="fillFieldSkuForFirstAttributeOption"/> - <remove keyForRemoval="fillFieldSkuForSecondAttributeOption"/> - </actionGroup> - - <actionGroup name="addProductToConfigurationsGrid"> - <annotations> - <description>Adds the provided Product SKU to the provided Product Name.</description> - </annotations> - <arguments> - <argument name="sku" type="string"/> - <argument name="name" type="string"/> - </arguments> - - <click selector="{{AdminProductFormConfigurationsSection.actionsBtnByProductName(name)}}" stepKey="clickToExpandFirstActions"/> - <click selector="{{AdminProductFormConfigurationsSection.addProduct(name)}}" stepKey="clickChooseFirstDifferentProduct"/> - <switchToIFrame stepKey="switchOutOfIFrame"/> - <waitForPageLoad stepKey="waitForFilters"/> - <click selector="{{AdminCreateProductConfigurationsPanel.filters}}" stepKey="clickFilters"/> - <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{sku}}" stepKey="fillProductSkuFilter"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> - <click selector="{{AdminProductGridFilterSection.firstRowBySku(sku)}}" stepKey="clickOnFirstRow"/> - </actionGroup> - - <actionGroup name="addUniqueImageToConfigurableProductOption"> - <annotations> - <description>Adds the provided Image to a Configurable Product on the Admin Product creation/edit page.</description> - </annotations> - <arguments> - <argument name="image" defaultValue="ProductImage"/> - <argument name="frontend_label" type="string"/> - <argument name="label" type="string"/> - </arguments> - - <click selector="{{AdminCreateProductConfigurationsPanel.applyUniqueImagesToEachSkus}}" stepKey="clickOnApplyUniqueImagesToEachSku"/> - <selectOption userInput="{{frontend_label}}" selector="{{AdminCreateProductConfigurationsPanel.selectImagesButton}}" stepKey="selectOption"/> - <attachFile selector="{{AdminCreateProductConfigurationsPanel.uploadImagesButton(label)}}" userInput="{{image.file}}" stepKey="uploadFile"/> - <waitForElementNotVisible selector="{{AdminCreateProductConfigurationsPanel.uploadProgressBar}}" stepKey="waitForUpload"/> - <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.imageFile(image.fileName)}}" stepKey="waitForThumbnail"/> - </actionGroup> - - <actionGroup name="addUniquePriceToConfigurableProductOption"> - <annotations> - <description>On the 'Step 3: Bulk Images, Price and Quantity' page of the 'Create Product Configurations' model click on 'Apply unique prices...'. Select provided Option. Fill price.</description> - </annotations> - <arguments> - <argument name="frontend_label" type="string"/> - <argument name="label" type="string"/> - <argument name="price" type="string"/> - </arguments> - - <click selector="{{AdminCreateProductConfigurationsPanel.applyUniquePricesToEachSkus}}" stepKey="clickOnApplyUniquePricesToEachSku"/> - <selectOption userInput="{{frontend_label}}" selector="{{AdminCreateProductConfigurationsPanel.selectPriceButton}}" stepKey="selectOption"/> - <fillField selector="{{AdminCreateProductConfigurationsPanel.price(label)}}" userInput="{{price}}" stepKey="enterAttributeQuantity"/> - </actionGroup> - <actionGroup name="addUniqueQuantityToConfigurableProductOption"> - <arguments> - <argument name="frontend_label" type="string" defaultValue="{{productAttributeColor.default_label}}"/> - <argument name="label" type="string" defaultValue="option1"/> - <argument name="quantity" type="string" defaultValue="10"/> - </arguments> - <click selector="{{AdminCreateProductConfigurationsPanel.applyUniqueQuantityToEachSkus}}" stepKey="clickOnApplyUniqueQuantitiesToEachSku"/> - <selectOption selector="{{AdminCreateProductConfigurationsPanel.selectQuantity}}" userInput="{{frontend_label}}" stepKey="selectOption"/> - <fillField selector="{{AdminCreateProductConfigurationsPanel.applyUniqueQuantity(label)}}" userInput="{{quantity}}" stepKey="enterAttributeQuantity"/> - </actionGroup> - - <actionGroup name="saveConfigurableProductWithNewAttributeSet"> - <annotations> - <description>Clicks on 'Save'. Clicks radio for '...new Attribute Set...' in the 'Choose Affected Attribute Set' modal. Clicks on 'Confirm' in the model on the Configurable Product creation/edit page.</description> - </annotations> - - <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveConfigurableProduct"/> - <waitForElementVisible selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" time="30" stepKey="waitForAttributeSetConfirmation"/> - <click selector="{{AdminChooseAffectedAttributeSetPopup.addNewAttrSet}}" stepKey="clickAddNewAttributeSet"/> - <fillField selector="{{AdminChooseAffectedAttributeSetPopup.createNewAttrSetName}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="fillFieldNewAttrSetName"/> - <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickConfirmAttributeSet"/> - <see selector="You saved the product" stepKey="seeConfigurableSaveConfirmation" after="clickConfirmAttributeSet"/> - </actionGroup> - - <actionGroup name="saveConfigurableProductAddToCurrentAttributeSet"> - <annotations> - <description>Clicks on 'Save'. Clicks on 'Confirm' in the 'Choose Affected Attribute Set' model on the Configurable Product creation/edit page.</description> - </annotations> - - <waitForElementVisible selector="{{AdminProductFormActionSection.saveButton}}" stepKey="waitForSaveBtnVisible"/> - <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProductAgain"/> - <waitForElementVisible selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="waitPopUpVisible"/> - <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmPopup"/> - <seeElement selector="{{AdminMessagesSection.success}}" stepKey="seeSaveProductMessage"/> - </actionGroup> - - <actionGroup name="assertConfigurableProductOnAdminProductPage"> - <annotations> - <description>Validates that the provided Configurable Product Name, SKU and Price are present and correct on the Configurable Product creation/edit page. PLEASE NOTE: The Product Data is Hardcoded.</description> - </annotations> - <arguments> - <argument name="product" type="entity"/> - </arguments> - - <seeInField userInput="{{ApiConfigurableProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="seeNameRequired"/> - <seeInField userInput="{{ApiConfigurableProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="seeSkuRequired"/> - <dontSeeInField userInput="{{ApiConfigurableProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="dontSeePriceRequired"/> - </actionGroup> - - <!--Click in Next Step and see Title--> - <actionGroup name="AdminConfigurableWizardMoveToNextStepActionGroup"> - <annotations> - <description>Click on the 'Next' button in the 'Create Product Configurations' panel on the Configurable Product creation/edit page.</description> - </annotations> - <arguments> - <argument name="title" type="string"/> - </arguments> - - <click selector="{{ConfigurableProductSection.nextButton}}" stepKey="clickNextButton"/> - <waitForPageLoad stepKey="waitForNextStepLoaded"/> - <see userInput="{{title}}" selector="{{AdminProductFormConfigurationsSection.stepsWizardTitle}}" stepKey="seeStepTitle"/> - </actionGroup> - <actionGroup name="AdminConfigurableProductDisableConfigurationsActionGroup"> - <arguments> - <argument name="productName" type="string" defaultValue="{{SimpleProduct.name}}"/> - </arguments> - <click selector="{{AdminProductFormConfigurationsSection.actionsBtnByProductName(productName)}}" stepKey="clickToExpandActionsSelect"/> - <click selector="{{AdminProductFormConfigurationsSection.disableProductBtn}}" stepKey="clickDisableChildProduct"/> - <see selector="{{AdminProductFormConfigurationsSection.confProductOptionStatusCell(productName)}}" userInput="Disabled" stepKey="seeConfigDisabled"/> - </actionGroup> - - <!--You are on AdminProductEditPage--> - <!--Start create configurations for attribute and fill quantity--> - <actionGroup name="StartCreateConfigurationsForAttribute" extends="generateConfigurationsByAttributeCode"> - <remove keyForRemoval="clickOnNextButton3"/> - <remove keyForRemoval="clickOnNextButton4"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductDisableConfigurationsActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductDisableConfigurationsActionGroup.xml new file mode 100644 index 0000000000000..69b2c37b6e850 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductDisableConfigurationsActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminConfigurableProductDisableConfigurationsActionGroup"> + <arguments> + <argument name="productName" type="string" defaultValue="{{SimpleProduct.name}}"/> + </arguments> + <click selector="{{AdminProductFormConfigurationsSection.actionsBtnByProductName(productName)}}" stepKey="clickToExpandActionsSelect"/> + <click selector="{{AdminProductFormConfigurationsSection.disableProductBtn}}" stepKey="clickDisableChildProduct"/> + <see selector="{{AdminProductFormConfigurationsSection.confProductOptionStatusCell(productName)}}" userInput="Disabled" stepKey="seeConfigDisabled"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableWizardMoveToNextStepActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableWizardMoveToNextStepActionGroup.xml new file mode 100644 index 0000000000000..50621b7114002 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableWizardMoveToNextStepActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminConfigurableWizardMoveToNextStepActionGroup"> + <annotations> + <description>Click on the 'Next' button in the 'Create Product Configurations' panel on the Configurable Product creation/edit page.</description> + </annotations> + <arguments> + <argument name="title" type="string"/> + </arguments> + + <click selector="{{ConfigurableProductSection.nextButton}}" stepKey="clickNextButton"/> + <waitForPageLoad stepKey="waitForNextStepLoaded"/> + <see userInput="{{title}}" selector="{{AdminProductFormConfigurationsSection.stepsWizardTitle}}" stepKey="seeStepTitle"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminCreateApiConfigurableProductActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminCreateApiConfigurableProductActionGroup.xml index 2cdee5468a457..6dba2f09a707b 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminCreateApiConfigurableProductActionGroup.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminCreateApiConfigurableProductActionGroup.xml @@ -65,21 +65,4 @@ <requiredEntity createDataKey="createConfigChildProduct2"/> </createData> </actionGroup> - - <!-- Create the configurable product, children are not visible individually --> - <actionGroup name="AdminCreateApiConfigurableProductWithHiddenChildActionGroup" extends="AdminCreateApiConfigurableProductActionGroup"> - <annotations> - <description>EXTENDS: AdminCreateApiConfigurableProductActionGroup. Adds 2 Hidden Product Options.</description> - </annotations> - - <!-- Create the 2 children that will be a part of the configurable product --> - <createData entity="ApiSimpleOneHidden" stepKey="createConfigChildProduct1"> - <requiredEntity createDataKey="createConfigProductAttribute"/> - <requiredEntity createDataKey="getConfigAttributeOption1"/> - </createData> - <createData entity="ApiSimpleTwoHidden" stepKey="createConfigChildProduct2"> - <requiredEntity createDataKey="createConfigProductAttribute"/> - <requiredEntity createDataKey="getConfigAttributeOption2"/> - </createData> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminCreateApiConfigurableProductWithHiddenChildActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminCreateApiConfigurableProductWithHiddenChildActionGroup.xml new file mode 100644 index 0000000000000..2562c8cc20e6e --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminCreateApiConfigurableProductWithHiddenChildActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateApiConfigurableProductWithHiddenChildActionGroup" extends="AdminCreateApiConfigurableProductActionGroup"> + <annotations> + <description>EXTENDS: AdminCreateApiConfigurableProductActionGroup. Adds 2 Hidden Product Options.</description> + </annotations> + + <!-- Create the 2 children that will be a part of the configurable product --> + <createData entity="ApiSimpleOneHidden" stepKey="createConfigChildProduct1"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="getConfigAttributeOption1"/> + </createData> + <createData entity="ApiSimpleTwoHidden" stepKey="createConfigChildProduct2"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="getConfigAttributeOption2"/> + </createData> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminCreateConfigurableProductWithAttributeUncheckOptionActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminCreateConfigurableProductWithAttributeUncheckOptionActionGroup.xml new file mode 100644 index 0000000000000..2f494bb003bfa --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminCreateConfigurableProductWithAttributeUncheckOptionActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateConfigurableProductWithAttributeUncheckOptionActionGroup" extends="GenerateConfigurationsByAttributeCodeActionGroup"> + <annotations> + <description>EXTENDS: generateConfigurationsByAttributeCode. Click to uncheck created option. Enter Attribute price</description> + </annotations> + <arguments> + <argument name="attributeOption" type="string" defaultValue="option1"/> + <argument name="price" type="string" defaultValue="100"/> + </arguments> + <click selector="{{AdminCreateProductConfigurationsPanel.attributeOption('attributeOption')}}" after="clickOnSelectAll" stepKey="clickToUncheckOption"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" after="clickToUncheckOption" stepKey="clickOnNextButton22"/> + <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.applySinglePriceToAllSkus}}" after="clickOnNextButton22" stepKey="waitForNextPageOpened2"/> + <click selector="{{AdminCreateProductConfigurationsPanel.applySinglePriceToAllSkus}}" after="waitForNextPageOpened2" stepKey="clickOnApplySinglePriceToAllSkus"/> + <fillField selector="{{AdminCreateProductConfigurationsPanel.singlePrice}}" userInput="{{price}}" before="clickOnApplySingleQuantityToEachSku" stepKey="enterAttributePrice"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminCreateConfigurationsForAttributeActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminCreateConfigurationsForAttributeActionGroup.xml new file mode 100644 index 0000000000000..57468165fe4f9 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminCreateConfigurationsForAttributeActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateConfigurationsForAttributeActionGroup" extends="GenerateConfigurationsByAttributeCodeActionGroup"> + <annotations> + <description>EXTENDS: generateConfigurationsByAttributeCode. Click to apply single price to all Skus. Enter Attribute price</description> + </annotations> + <arguments> + <argument name="price" type="string" defaultValue="100"/> + </arguments> + <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.applySinglePriceToAllSkus}}" after="clickOnNextButton2" stepKey="waitForNextPageOpened2"/> + <click selector="{{AdminCreateProductConfigurationsPanel.applySinglePriceToAllSkus}}" after="waitForNextPageOpened2" stepKey="clickOnApplySinglePriceToAllSkus"/> + <fillField selector="{{AdminCreateProductConfigurationsPanel.singlePrice}}" userInput="{{price}}" before="clickOnApplySingleQuantityToEachSku" stepKey="enterAttributePrice"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AssertConfigurableProductOnAdminProductPageActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AssertConfigurableProductOnAdminProductPageActionGroup.xml new file mode 100644 index 0000000000000..88e170e3a3a90 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AssertConfigurableProductOnAdminProductPageActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertConfigurableProductOnAdminProductPageActionGroup"> + <annotations> + <description>Validates that the provided Configurable Product Name, SKU and Price are present and correct on the Configurable Product creation/edit page. PLEASE NOTE: The Product Data is Hardcoded.</description> + </annotations> + <arguments> + <argument name="product" type="entity"/> + </arguments> + + <seeInField userInput="{{ApiConfigurableProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="seeNameRequired"/> + <seeInField userInput="{{ApiConfigurableProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="seeSkuRequired"/> + <dontSeeInField userInput="{{ApiConfigurableProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="dontSeePriceRequired"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AssertConfigurableProductWithSpecialPriceOnStorefrontProductPageActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AssertConfigurableProductWithSpecialPriceOnStorefrontProductPageActionGroup.xml new file mode 100644 index 0000000000000..b998b4443f446 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AssertConfigurableProductWithSpecialPriceOnStorefrontProductPageActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertConfigurableProductWithSpecialPriceOnStorefrontProductPageActionGroup"> + <annotations> + <description>Validates that Special Price for a Configurable Product is present and correct when the provided Product Option is selected.</description> + </annotations> + <arguments> + <argument name="option" type="string"/> + <argument name="price" type="string"/> + <argument name="specialPrice" defaultValue="specialProductPrice"/> + </arguments> + + <selectOption userInput="{{option}}" selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" stepKey="selectOptionWithSpecialPrice"/> + <see userInput="{{specialProductPrice.price}}" selector="{{StorefrontProductInfoMainSection.productSpecialPrice}}" stepKey="seeSpecialProductPrice"/> + <see userInput="Regular Price" selector="{{StorefrontProductInfoMainSection.specialProductText}}" stepKey="seeText"/> + <see userInput="{{price}}" selector="{{StorefrontProductInfoMainSection.oldProductPrice}}" stepKey="seeOldProductPrice"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AssertOptionImageAndPriceInStorefrontProductActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AssertOptionImageAndPriceInStorefrontProductActionGroup.xml new file mode 100644 index 0000000000000..e13d1909b5a10 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AssertOptionImageAndPriceInStorefrontProductActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertOptionImageAndPriceInStorefrontProductActionGroup"> + <annotations> + <description>Validates that the provided Product Image and Price are present when the provided Product Option is selected.</description> + </annotations> + <arguments> + <argument name="label" type="string"/> + <argument name="image" type="string"/> + <argument name="price" type="string"/> + </arguments> + + <selectOption userInput="{{label}}" selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" stepKey="selectOption"/> + <seeElement selector="{{StorefrontProductMediaSection.imageFile(image)}}" stepKey="seeImage"/> + <see userInput="{{price}}" selector="{{StorefrontProductInfoMainSection.price}}" stepKey="seeProductPrice"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AssertOptionImageInStorefrontProductPageActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AssertOptionImageInStorefrontProductPageActionGroup.xml new file mode 100644 index 0000000000000..ba41d36d95970 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AssertOptionImageInStorefrontProductPageActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertOptionImageInStorefrontProductPageActionGroup"> + <annotations> + <description>Validates that the provided Product Image is present when the provided Product Option is selected.</description> + </annotations> + <arguments> + <argument name="product" type="entity"/> + <argument name="label" type="string"/> + <argument name="image" defaultValue="MagentoLogo"/> + </arguments> + + <seeInCurrentUrl url="/{{product.urlKey}}.html" stepKey="checkUrl"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <selectOption userInput="{{label}}" selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" stepKey="selectOption1"/> + <seeElement selector="{{StorefrontProductMediaSection.imageFile(image.filename)}}" stepKey="seeFirstImage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/ChangeConfigurableProductChildProductPriceActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/ChangeConfigurableProductChildProductPriceActionGroup.xml new file mode 100644 index 0000000000000..b244681afbbb9 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/ChangeConfigurableProductChildProductPriceActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ChangeConfigurableProductChildProductPriceActionGroup"> + <annotations> + <description>Change the price of a configurable child product in the grid under configurations.</description> + </annotations> + <arguments> + <argument name="productAttributes" type="string"/> + <argument name="productPrice" type="string"/> + </arguments> + <fillField userInput="{{productPrice}}" selector="{{AdminProductFormConfigurationsSection.confProductPriceCell(productAttributes)}}" stepKey="fillPriceForConfigurableProductAttributeOption"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/ChangeProductConfigurationsInGridActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/ChangeProductConfigurationsInGridActionGroup.xml new file mode 100644 index 0000000000000..48523fe693c44 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/ChangeProductConfigurationsInGridActionGroup.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ChangeProductConfigurationsInGridActionGroup"> + <annotations> + <description>Edit the Product Configuration via the Admin Product grid page.</description> + </annotations> + <arguments> + <argument name="firstOption" type="entity"/> + <argument name="secondOption" type="entity"/> + </arguments> + + <fillField userInput="{{firstOption.name}}" selector="{{AdminProductFormConfigurationsSection.confProductNameCell(firstOption.name)}}" stepKey="fillFieldNameForFirstAttributeOption"/> + <fillField userInput="{{secondOption.name}}" selector="{{AdminProductFormConfigurationsSection.confProductNameCell(secondOption.name)}}" stepKey="fillFieldNameForSecondAttributeOption"/> + <fillField userInput="{{firstOption.sku}}" selector="{{AdminProductFormConfigurationsSection.confProductSkuCell(firstOption.name)}}" stepKey="fillFieldSkuForFirstAttributeOption"/> + <fillField userInput="{{secondOption.sku}}" selector="{{AdminProductFormConfigurationsSection.confProductSkuCell(secondOption.name)}}" stepKey="fillFieldSkuForSecondAttributeOption"/> + <fillField userInput="{{firstOption.price}}" selector="{{AdminProductFormConfigurationsSection.confProductPriceCell(firstOption.name)}}" stepKey="fillFieldPriceForFirstAttributeOption"/> + <fillField userInput="{{secondOption.price}}" selector="{{AdminProductFormConfigurationsSection.confProductPriceCell(secondOption.name)}}" stepKey="fillFieldPriceForSecondAttributeOption"/> + <fillField userInput="{{firstOption.quantity}}" selector="{{AdminProductFormConfigurationsSection.confProductQuantityCell(firstOption.name)}}" stepKey="fillFieldQuantityForFirstAttributeOption"/> + <fillField userInput="{{secondOption.quantity}}" selector="{{AdminProductFormConfigurationsSection.confProductQuantityCell(secondOption.name)}}" stepKey="fillFieldQuantityForSecondAttributeOption"/> + <fillField userInput="{{firstOption.weight}}" selector="{{AdminProductFormConfigurationsSection.confProductWeightCell(firstOption.name)}}" stepKey="fillFieldWeightForFirstAttributeOption"/> + <fillField userInput="{{secondOption.weight}}" selector="{{AdminProductFormConfigurationsSection.confProductWeightCell(secondOption.name)}}" stepKey="fillFieldWeightForSecondAttributeOption"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/ChangeProductConfigurationsInGridExceptSkuActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/ChangeProductConfigurationsInGridExceptSkuActionGroup.xml new file mode 100644 index 0000000000000..740eda889637f --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/ChangeProductConfigurationsInGridExceptSkuActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ChangeProductConfigurationsInGridExceptSkuActionGroup" extends="ChangeProductConfigurationsInGridActionGroup"> + <annotations> + <description>EXTENDS: changeProductConfigurationsInGrid. Removes 'fillFieldSkuForFirstAttributeOption' and 'fillFieldSkuForSecondAttributeOption'.</description> + </annotations> + + <remove keyForRemoval="fillFieldSkuForFirstAttributeOption"/> + <remove keyForRemoval="fillFieldSkuForSecondAttributeOption"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateConfigurableProductActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateConfigurableProductActionGroup.xml new file mode 100644 index 0000000000000..cb903222822eb --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateConfigurableProductActionGroup.xml @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateConfigurableProductActionGroup"> + <annotations> + <description>Goes to the Admin Product grid page. Creates a Configurable Product using the default Product Options.</description> + </annotations> + <arguments> + <argument name="product" defaultValue="_defaultProduct"/> + <argument name="category" defaultValue="_defaultCategory"/> + </arguments> + + <!-- fill in basic configurable product values --> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> + <waitForPageLoad time="30" stepKey="wait1"/> + <click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickOnAddProductToggle"/> + <click selector="{{AdminProductGridActionSection.addConfigurableProduct}}" stepKey="clickOnAddConfigurableProduct"/> + <fillField userInput="{{product.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="fillName"/> + <fillField userInput="{{product.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="fillSKU"/> + <fillField userInput="{{product.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="fillPrice"/> + <fillField userInput="{{product.quantity}}" selector="{{AdminProductFormSection.productQuantity}}" stepKey="fillQuantity"/> + <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[{{category.name}}]" stepKey="fillCategory"/> + <selectOption userInput="{{product.visibility}}" selector="{{AdminProductFormSection.visibility}}" stepKey="fillVisibility"/> + <click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/> + <fillField userInput="{{product.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/> + + <!-- create configurations for colors the product is available in --> + <click selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="clickOnCreateConfigurations"/> + <click selector="{{AdminCreateProductConfigurationsPanel.createNewAttribute}}" stepKey="clickOnNewAttribute"/> + <waitForPageLoad stepKey="waitForIFrame"/> + <switchToIFrame selector="{{AdminNewAttributePanel.newAttributeIFrame}}" stepKey="switchToNewAttributeIFrame"/> + <fillField selector="{{AdminNewAttributePanel.defaultLabel}}" userInput="{{colorProductAttribute.default_label}}" stepKey="fillDefaultLabel"/> + <click selector="{{AdminNewAttributePanel.saveAttribute}}" stepKey="clickOnNewAttributePanel"/> + <waitForPageLoad stepKey="waitForSaveAttribute"/> + <switchToIFrame stepKey="switchOutOfIFrame"/> + <waitForPageLoad stepKey="waitForFilters"/> + <click selector="{{AdminCreateProductConfigurationsPanel.filters}}" stepKey="clickOnFilters"/> + <fillField userInput="{{colorProductAttribute.default_label}}" selector="{{AdminCreateProductConfigurationsPanel.attributeCode}}" stepKey="fillFilterAttributeCodeField"/> + <click selector="{{AdminCreateProductConfigurationsPanel.applyFilters}}" stepKey="clickApplyFiltersButton"/> + <click selector="{{AdminCreateProductConfigurationsPanel.firstCheckbox}}" stepKey="clickOnFirstCheckbox"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton1"/> + <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="waitCreateNewValueAppears"/> + <click selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="clickOnCreateNewValue1"/> + <fillField userInput="{{colorProductAttribute1.name}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewAttribute1"/> + <click selector="{{AdminCreateProductConfigurationsPanel.saveAttribute}}" stepKey="clickOnSaveNewAttribute1"/> + <click selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="clickOnCreateNewValue2"/> + <fillField userInput="{{colorProductAttribute2.name}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewAttribute2"/> + <click selector="{{AdminCreateProductConfigurationsPanel.saveAttribute}}" stepKey="clickOnSaveNewAttribute2"/> + <click selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="clickOnCreateNewValue3"/> + <fillField userInput="{{colorProductAttribute3.name}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewAttribute3"/> + <click selector="{{AdminCreateProductConfigurationsPanel.saveAttribute}}" stepKey="clickOnSaveNewAttribute3"/> + <click selector="{{AdminCreateProductConfigurationsPanel.selectAll}}" stepKey="clickOnSelectAll"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton2"/> + <click selector="{{AdminCreateProductConfigurationsPanel.applyUniquePricesByAttributeToEachSku}}" stepKey="clickOnApplyUniquePricesByAttributeToEachSku"/> + <selectOption selector="{{AdminCreateProductConfigurationsPanel.selectAttribute}}" userInput="{{colorProductAttribute.default_label}}" stepKey="selectAttributes"/> + <fillField selector="{{AdminCreateProductConfigurationsPanel.attribute1}}" userInput="{{colorProductAttribute1.price}}" stepKey="fillAttributePrice1"/> + <fillField selector="{{AdminCreateProductConfigurationsPanel.attribute2}}" userInput="{{colorProductAttribute2.price}}" stepKey="fillAttributePrice2"/> + <fillField selector="{{AdminCreateProductConfigurationsPanel.attribute3}}" userInput="{{colorProductAttribute3.price}}" stepKey="fillAttributePrice3"/> + <click selector="{{AdminCreateProductConfigurationsPanel.applySingleQuantityToEachSkus}}" stepKey="clickOnApplySingleQuantityToEachSku"/> + <fillField selector="{{AdminCreateProductConfigurationsPanel.quantity}}" userInput="1" stepKey="enterAttributeQuantity"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton3"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton4"/> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton2"/> + <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup"/> + <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSaveProductMessage"/> + <seeInTitle userInput="{{product.name}}" stepKey="seeProductNameInTitle"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateConfigurableProductWithAttributeSetActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateConfigurableProductWithAttributeSetActionGroup.xml new file mode 100644 index 0000000000000..cf8d36b393178 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateConfigurableProductWithAttributeSetActionGroup.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateConfigurableProductWithAttributeSetActionGroup"> + <annotations> + <description>Admin edit created product as configurable. Choose created options</description> + </annotations> + <arguments> + <argument name="product" defaultValue="_defaultProduct"/> + <argument name="category" defaultValue="_defaultCategory"/> + <argument name="label" type="string" defaultValue="mySet"/> + <argument name="option" type="string" defaultValue="['option1', 'option2', 'option3', 'option4']"/> + </arguments> + <click selector="{{AdminProductFormSection.attributeSet}}" stepKey="startEditAttrSet"/> + <fillField selector="{{AdminProductFormSection.attributeSetFilter}}" userInput="{{label}}" stepKey="searchForAttrSet"/> + <click selector="{{AdminProductFormSection.attributeSetFilterResult}}" stepKey="selectAttrSet"/> + <fillField userInput="{{product.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="fillName"/> + <selectOption selector="{{AdminProductFormSection.additionalOptions}}" parameterArray="{{option}}" stepKey="searchAndMultiSelectCreatedOption"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateConfigurableProductWithTwoAttributesActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateConfigurableProductWithTwoAttributesActionGroup.xml new file mode 100644 index 0000000000000..aeb39fc9cbb0a --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateConfigurableProductWithTwoAttributesActionGroup.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateConfigurableProductWithTwoAttributesActionGroup" extends="CreateConfigurableProductActionGroup"> + <annotations> + <description>Goes to the Admin Product grid page. Creates a Configurable Product with 2 product attributes.</description> + </annotations> + <arguments> + <argument name="attribute1" defaultValue="ProductColorAttribute"/> + <argument name="attribute2" defaultValue="ProductSizeAttribute"/> + </arguments> + <remove keyForRemoval="clickOnNewAttribute"/> + <remove keyForRemoval="waitForIFrame"/> + <remove keyForRemoval="switchToNewAttributeIFrame"/> + <remove keyForRemoval="fillDefaultLabel"/> + <remove keyForRemoval="clickOnNewAttributePanel"/> + <remove keyForRemoval="waitForSaveAttribute"/> + <remove keyForRemoval="switchOutOfIFrame"/> + <remove keyForRemoval="waitForFilters"/> + <remove keyForRemoval="clickOnFilters"/> + <remove keyForRemoval="fillFilterAttributeCodeField"/> + <remove keyForRemoval="clickApplyFiltersButton"/> + <remove keyForRemoval="clickOnFirstCheckbox"/> + <click selector="{{AdminCreateProductConfigurationsPanel.attributeCheckbox(attribute1.attribute_code)}}" stepKey="selectAttribute1" after="clickOnCreateConfigurations"/> + <click selector="{{AdminCreateProductConfigurationsPanel.attributeCheckbox(attribute2.attribute_code)}}" stepKey="selectAttribute2" after="selectAttribute1"/> + <remove keyForRemoval="waitCreateNewValueAppears"/> + <remove keyForRemoval="clickOnCreateNewValue1"/> + <remove keyForRemoval="fillFieldForNewAttribute1"/> + <remove keyForRemoval="clickOnSaveNewAttribute1"/> + <remove keyForRemoval="clickOnCreateNewValue2"/> + <remove keyForRemoval="fillFieldForNewAttribute2"/> + <remove keyForRemoval="clickOnSaveNewAttribute2"/> + <remove keyForRemoval="clickOnCreateNewValue3"/> + <remove keyForRemoval="fillFieldForNewAttribute3"/> + <remove keyForRemoval="clickOnSaveNewAttribute3"/> + <remove keyForRemoval="clickOnSelectAll"/> + <click selector="{{AdminCreateProductConfigurationsPanel.selectAllByAttribute(attribute1.frontend_label)}}" stepKey="selectAllOptionsOfAttribute1" before="clickOnNextButton2"/> + <click selector="{{AdminCreateProductConfigurationsPanel.selectAllByAttribute(attribute2.frontend_label)}}" stepKey="selectAllOptionsOfAttribute2" before="clickOnNextButton2"/> + <remove keyForRemoval="applyUniquePricesByAttributeToEachSku"/> + <remove keyForRemoval="clickOnApplyUniquePricesByAttributeToEachSku"/> + <remove keyForRemoval="selectAttributes"/> + <remove keyForRemoval="fillAttributePrice1"/> + <remove keyForRemoval="fillAttributePrice2"/> + <remove keyForRemoval="fillAttributePrice3"/> + <remove keyForRemoval="clickOnSaveButton2"/> + <remove keyForRemoval="clickOnConfirmInPopup"/> + <remove keyForRemoval="seeSaveProductMessage"/> + <remove keyForRemoval="seeProductNameInTitle"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateConfigurationsForAttributeActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateConfigurationsForAttributeActionGroup.xml new file mode 100644 index 0000000000000..bcfad4849276d --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateConfigurationsForAttributeActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateConfigurationsForAttributeActionGroup" extends="GenerateConfigurationsByAttributeCodeActionGroup"> + <annotations> + <description>EXTENDS: generateConfigurationsByAttributeCode. Clicks on the Save button. Clicks on the Confirm button.</description> + </annotations> + <arguments> + <argument name="attributeCode" type="string" defaultValue="SomeString"/> + </arguments> + + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton2"/> + <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateConfigurationsForAttributeWithImagesActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateConfigurationsForAttributeWithImagesActionGroup.xml new file mode 100644 index 0000000000000..b74300b0d5a13 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateConfigurationsForAttributeWithImagesActionGroup.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateConfigurationsForAttributeWithImagesActionGroup" extends="GenerateConfigurationsByAttributeCodeActionGroup"> + <annotations> + <description>EXTENDS: generateConfigurationsByAttributeCode. Adds the provided Attribute Image to the provided Attribute Code.</description> + </annotations> + <arguments> + <argument name="attributeCode" type="string" defaultValue="SomeString"/> + <argument name="image" defaultValue="ProductImage"/> + </arguments> + + <click selector="{{AdminCreateProductConfigurationsPanel.applySingleSetOfImages}}" stepKey="clickOnApplySingleImageSetToAllSku" after="enterAttributeQuantity"/> + <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.imageUploadButton}}" stepKey="seeImageSectionIsReady" after="clickOnApplySingleImageSetToAllSku"/> + <attachFile selector="{{AdminCreateProductConfigurationsPanel.imageFileUpload}}" userInput="{{image.file}}" stepKey="uploadFile" after="seeImageSectionIsReady"/> + <waitForElementNotVisible selector="{{AdminCreateProductConfigurationsPanel.uploadProgressBar}}" stepKey="waitForUpload" after="uploadFile"/> + <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.imageFile(image.fileName)}}" stepKey="waitForThumbnail" after="waitForUpload"/> + + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton2" after="clickOnNextButton4"/> + <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup" after="clickOnSaveButton2"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateConfigurationsForTwoAttributeActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateConfigurationsForTwoAttributeActionGroup.xml new file mode 100644 index 0000000000000..e241d1dfa3921 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateConfigurationsForTwoAttributeActionGroup.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateConfigurationsForTwoAttributeActionGroup" extends="GenerateConfigurationsByAttributeCodeActionGroup"> + <annotations> + <description>EXTENDS: generateConfigurationsByAttributeCode. Generates the Product Configurations for the 2 provided Attribute Codes on the Configurable Product creation/edit page.</description> + </annotations> + <arguments> + <argument name="secondAttributeCode" type="string"/> + </arguments> + + <remove keyForRemoval="clickOnSelectAll"/> + <remove keyForRemoval="clickFilters"/> + <remove keyForRemoval="fillFilterAttributeCodeField"/> + <remove keyForRemoval="clickApplyFiltersButton"/> + <remove keyForRemoval="clickOnFirstCheckbox"/> + + <click selector="{{AdminCreateProductConfigurationsPanel.attributeCheckbox(attributeCode)}}" stepKey="clickOnFirstAttributeCheckbox" after="clickCreateConfigurations"/> + <click selector="{{AdminCreateProductConfigurationsPanel.attributeCheckbox(secondAttributeCode)}}" stepKey="clickOnSecondAttributeCheckbox" after="clickOnFirstAttributeCheckbox"/> + <grabTextFrom selector="{{AdminCreateProductConfigurationsPanel.defaultLabel(attributeCode)}}" stepKey="grabFirstAttributeDefaultLabel" after="clickOnSecondAttributeCheckbox"/> + <grabTextFrom selector="{{AdminCreateProductConfigurationsPanel.defaultLabel(secondAttributeCode)}}" stepKey="grabSecondAttributeDefaultLabel" after="grabFirstAttributeDefaultLabel"/> + <click selector="{{AdminCreateProductConfigurationsPanel.selectAllByAttribute({$grabFirstAttributeDefaultLabel})}}" stepKey="clickOnSelectAllForFirstAttribute" after="clickOnNextButton1"/> + <click selector="{{AdminCreateProductConfigurationsPanel.selectAllByAttribute({$grabSecondAttributeDefaultLabel})}}" stepKey="clickOnSelectAllForSecondAttribute" after="clickOnSelectAllForFirstAttribute"/> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton2"/> + <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/ConfigurableProductAttributeNameDesignActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateNewAttributeActionGroup.xml similarity index 55% rename from app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/ConfigurableProductAttributeNameDesignActionGroup.xml rename to app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateNewAttributeActionGroup.xml index 8863cfaf4aeaa..9925aba09fb82 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/ConfigurableProductAttributeNameDesignActionGroup.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateNewAttributeActionGroup.xml @@ -8,44 +8,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="GotoCatalogProductsPage"> - <annotations> - <description>Goes to the Admin Products grid via the Admin Side Menu.</description> - </annotations> - - <click stepKey="clickOnCatalogItem" selector="{{CatalogProductsSection.catalogItem}}"/> - <waitForPageLoad stepKey="waitForCatalogLoad"/> - <click stepKey="clickOnProductItem" selector="{{CatalogProductsSection.productItem}}"/> - <waitForPageLoad stepKey="waitForCatalogProductPageLoad"/> - <seeInCurrentUrl stepKey="assertWeAreOnTheCatalogProductPage" url="{{assertionData.catalogProduct}}"/> - </actionGroup> - - <actionGroup name="GotoConfigurableProductPage"> - <annotations> - <description>Clicks on create Configurable Product from the Admin Products grid page.</description> - </annotations> - - <click stepKey="clickOnAddProductItem" selector="{{ConfigurableProductSection.addProductItem}}"/> - <click stepKey="clickOnConfigurationProductItem" selector="{{ConfigurableProductSection.configProductItem}}"/> - <waitForPageLoad stepKey="waitForConfigurableProductPageLoad"/> - <seeInCurrentUrl stepKey="assertWeAreOnTheConfigurableProductPage" url="{{assertionData.configurableProduct}}"/> - </actionGroup> - - <actionGroup name="FillAllRequiredFields"> - <annotations> - <description>Fills the Product Name, Price and Weight fields. Clicks on 'Create Configurations'. Clicks on 'Create New Attribute'.</description> - </annotations> - - <fillField stepKey="fillInProductNameFields" selector="{{NewProduct.productName}}" userInput="{{NewProductsData.productName}}"/> - <fillField stepKey="fillInPriceFields" selector="{{NewProduct.price}}" userInput="{{NewProductsData.price}}"/> - <fillField stepKey="fillInWeightFields" selector="{{NewProduct.weight}}" userInput="{{NewProductsData.weight}}"/> - <click stepKey="clickOnCreateConfigurationsButton" selector="{{NewProduct.createConfigurationButton}}"/> - <waitForPageLoad stepKey="waitForCreateProductConfigurationsPageLoad"/> - <click stepKey="clickOnCreateNewAttributeButton" selector="{{NewProduct.createNewAttributeButton}}"/> - <waitForPageLoad stepKey="waitForNewAttributePageLoad"/> - </actionGroup> - - <actionGroup name="CreateNewAttribute"> + <actionGroup name="CreateNewAttributeActionGroup"> <annotations> <description>Creates a new Product Attribute via the Admin Products creation/edit page. PLEASE NOTE: The Product Attributes are Hardcoded.</description> </annotations> @@ -120,39 +83,4 @@ <conditionalClick selector="{{ConfigurableProductSection.closeFrame}}" dependentSelector="{{ConfigurableProductSection.closeFrame}}" visible="1" stepKey="closeFrame"/> <waitForPageLoad stepKey="waitForClosingFrame"/> </actionGroup> - - <actionGroup name="DeleteCreatedAttribute"> - <annotations> - <description>Deletes the Configurable Product Attribute.</description> - </annotations> - - <!--Click on Stores item--> - <click stepKey="clickOnStoresItem" selector="{{CatalogProductsSection.storesItem}}"/> - <waitForPageLoad stepKey="waitForNavigationPanel"/> - - <!--Click on Products item--> - <waitForElementVisible selector="{{CatalogProductsSection.storesProductItem}}" stepKey="waitForCatalogLoad"/> - <click stepKey="clickOnStoresProductItem" selector="{{CatalogProductsSection.storesProductItem}}"/> - <waitForPageLoad stepKey="waitForStoresProductPageLoad"/> - - <!--Click on created Attribute --> - <fillField stepKey="searchProductDefaultLabel" selector="{{CatalogProductsSection.searchDefaultLabelField}}" userInput="{{NewProductsData.defaultLabel}}"/> - <click stepKey="clickSearchButton" selector="{{CatalogProductsSection.searchButton}}"/> - <waitForPageLoad stepKey="waitForCreatedAttributeLoad"/> - <click stepKey="clickOnCreatedAttributeItem" selector="{{CatalogProductsSection.createdAttributeItem}}"/> - <waitForPageLoad stepKey="waitForAttributePropertiesPageLoad"/> - - <!--Click on Delete Attribute item--> - <click stepKey="clickOnDeleteAttributeItem" selector="{{CatalogProductsSection.deleteAttributeItem}}"/> - <waitForPageLoad stepKey="waitForDeletedDialogOpened"/> - - <!--Click on OK button--> - <click stepKey="clickOnOKButton" selector="{{CatalogProductsSection.okButton}}"/> - <waitForPageLoad stepKey="waitFordAttributeDeleted"/> - <see userInput="You deleted the product attribute." stepKey="seeDeletedTheProductAttributeMessage"/> - - <!-- Click Reset Filter button--> - <click stepKey="clickResetFilterButton" selector="{{CatalogProductsSection.resetFilter}}"/> - <waitForPageLoad stepKey="waitForAllFilterReset"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateOptionsForAttributeActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateOptionsForAttributeActionGroup.xml new file mode 100644 index 0000000000000..d691564f331f1 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateOptionsForAttributeActionGroup.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateOptionsForAttributeActionGroup"> + <arguments> + <argument name="attributeName" type="string" defaultValue="{{productAttributeColor.default_label}}"/> + <argument name="firstOptionName" type="string" defaultValue="option1"/> + <argument name="secondOptionName" type="string" defaultValue="option2"/> + </arguments> + <click selector="{{AdminCreateProductConfigurationsPanel.filters}}" stepKey="clickOnFilters"/> + <fillField userInput="{{attributeName}}" selector="{{AdminCreateProductConfigurationsPanel.attributeCode}}" stepKey="fillFilterAttributeCodeField"/> + <click selector="{{AdminCreateProductConfigurationsPanel.applyFilters}}" stepKey="clickApplyFiltersButton"/> + <click selector="{{AdminCreateProductConfigurationsPanel.firstCheckbox}}" stepKey="clickOnFirstCheckbox"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton"/> + <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="waitCreateNewValueAppears"/> + <click selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="clickOnCreateFirstNewValue"/> + <fillField userInput="{{firstOptionName}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewFirstOption"/> + <click selector="{{AdminCreateProductConfigurationsPanel.saveAttribute}}" stepKey="clickOnSaveNewAttribute"/> + <click selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="clickOnCreateSecondNewValue"/> + <fillField userInput="{{secondOptionName}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewSecondOption"/> + <click selector="{{AdminCreateProductConfigurationsPanel.saveAttribute}}" stepKey="clickOnSaveAttribute"/> + <click selector="{{AdminCreateProductConfigurationsPanel.selectAll}}" stepKey="clickOnSelectAll"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/DeleteCreatedAttributeActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/DeleteCreatedAttributeActionGroup.xml new file mode 100644 index 0000000000000..ff8cfecf83ab9 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/DeleteCreatedAttributeActionGroup.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DeleteCreatedAttributeActionGroup"> + <annotations> + <description>Deletes the Configurable Product Attribute.</description> + </annotations> + + <!--Click on Stores item--> + <click stepKey="clickOnStoresItem" selector="{{CatalogProductsSection.storesItem}}"/> + <waitForPageLoad stepKey="waitForNavigationPanel"/> + + <!--Click on Products item--> + <waitForElementVisible selector="{{CatalogProductsSection.storesProductItem}}" stepKey="waitForCatalogLoad"/> + <click stepKey="clickOnStoresProductItem" selector="{{CatalogProductsSection.storesProductItem}}"/> + <waitForPageLoad stepKey="waitForStoresProductPageLoad"/> + + <!--Click on created Attribute --> + <fillField stepKey="searchProductDefaultLabel" selector="{{CatalogProductsSection.searchDefaultLabelField}}" userInput="{{NewProductsData.defaultLabel}}"/> + <click stepKey="clickSearchButton" selector="{{CatalogProductsSection.searchButton}}"/> + <waitForPageLoad stepKey="waitForCreatedAttributeLoad"/> + <click stepKey="clickOnCreatedAttributeItem" selector="{{CatalogProductsSection.createdAttributeItem}}"/> + <waitForPageLoad stepKey="waitForAttributePropertiesPageLoad"/> + + <!--Click on Delete Attribute item--> + <click stepKey="clickOnDeleteAttributeItem" selector="{{CatalogProductsSection.deleteAttributeItem}}"/> + <waitForPageLoad stepKey="waitForDeletedDialogOpened"/> + + <!--Click on OK button--> + <click stepKey="clickOnOKButton" selector="{{CatalogProductsSection.okButton}}"/> + <waitForPageLoad stepKey="waitFordAttributeDeleted"/> + <see userInput="You deleted the product attribute." stepKey="seeDeletedTheProductAttributeMessage"/> + + <!-- Click Reset Filter button--> + <click stepKey="clickResetFilterButton" selector="{{CatalogProductsSection.resetFilter}}"/> + <waitForPageLoad stepKey="waitForAllFilterReset"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/FillAllRequiredFieldsActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/FillAllRequiredFieldsActionGroup.xml new file mode 100644 index 0000000000000..9021225dd6fca --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/FillAllRequiredFieldsActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FillAllRequiredFieldsActionGroup"> + <annotations> + <description>Fills the Product Name, Price and Weight fields. Clicks on 'Create Configurations'. Clicks on 'Create New Attribute'.</description> + </annotations> + + <fillField stepKey="fillInProductNameFields" selector="{{NewProduct.productName}}" userInput="{{NewProductsData.productName}}"/> + <fillField stepKey="fillInPriceFields" selector="{{NewProduct.price}}" userInput="{{NewProductsData.price}}"/> + <fillField stepKey="fillInWeightFields" selector="{{NewProduct.weight}}" userInput="{{NewProductsData.weight}}"/> + <click stepKey="clickOnCreateConfigurationsButton" selector="{{NewProduct.createConfigurationButton}}"/> + <waitForPageLoad stepKey="waitForCreateProductConfigurationsPageLoad"/> + <click stepKey="clickOnCreateNewAttributeButton" selector="{{NewProduct.createNewAttributeButton}}"/> + <waitForPageLoad stepKey="waitForNewAttributePageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/GenerateAndSaveConfiguredProductAfterSettingOptionsActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/GenerateAndSaveConfiguredProductAfterSettingOptionsActionGroup.xml new file mode 100644 index 0000000000000..a4eade1549b07 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/GenerateAndSaveConfiguredProductAfterSettingOptionsActionGroup.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="GenerateAndSaveConfiguredProductAfterSettingOptionsActionGroup" extends="SaveConfiguredProductActionGroup"> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" before="clickOnSaveButton2" stepKey="clickOnNextButton"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" after="clickOnNextButton" stepKey="clickOnGenerateProductsButton"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/GenerateConfigurationsByAttributeCodeActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/GenerateConfigurationsByAttributeCodeActionGroup.xml new file mode 100644 index 0000000000000..80248cf5e00f8 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/GenerateConfigurationsByAttributeCodeActionGroup.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="GenerateConfigurationsByAttributeCodeActionGroup"> + <annotations> + <description>Generates the Product Configurations for the provided Attribute Code on the Configurable Product creation/edit page.</description> + </annotations> + <arguments> + <argument name="attributeCode" type="string" defaultValue="SomeString"/> + </arguments> + + <click selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="clickCreateConfigurations"/> + <click selector="{{AdminCreateProductConfigurationsPanel.filters}}" stepKey="clickFilters"/> + <fillField selector="{{AdminCreateProductConfigurationsPanel.attributeCode}}" userInput="{{attributeCode}}" stepKey="fillFilterAttributeCodeField"/> + <click selector="{{AdminCreateProductConfigurationsPanel.applyFilters}}" stepKey="clickApplyFiltersButton"/> + <click selector="{{AdminCreateProductConfigurationsPanel.firstCheckbox}}" stepKey="clickOnFirstCheckbox"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton1"/> + <click selector="{{AdminCreateProductConfigurationsPanel.selectAll}}" stepKey="clickOnSelectAll"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton2"/> + <click selector="{{AdminCreateProductConfigurationsPanel.applySingleQuantityToEachSkus}}" stepKey="clickOnApplySingleQuantityToEachSku"/> + <fillField selector="{{AdminCreateProductConfigurationsPanel.quantity}}" userInput="99" stepKey="enterAttributeQuantity"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton3"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton4"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/GotoCatalogProductsPageActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/GotoCatalogProductsPageActionGroup.xml new file mode 100644 index 0000000000000..237c55dd591ae --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/GotoCatalogProductsPageActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="GotoCatalogProductsPageActionGroup"> + <annotations> + <description>Goes to the Admin Products grid via the Admin Side Menu.</description> + </annotations> + + <click stepKey="clickOnCatalogItem" selector="{{CatalogProductsSection.catalogItem}}"/> + <waitForPageLoad stepKey="waitForCatalogLoad"/> + <click stepKey="clickOnProductItem" selector="{{CatalogProductsSection.productItem}}"/> + <waitForPageLoad stepKey="waitForCatalogProductPageLoad"/> + <seeInCurrentUrl stepKey="assertWeAreOnTheCatalogProductPage" url="{{assertionData.catalogProduct}}"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/GotoConfigurableProductPageActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/GotoConfigurableProductPageActionGroup.xml new file mode 100644 index 0000000000000..a16d99944003b --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/GotoConfigurableProductPageActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="GotoConfigurableProductPageActionGroup"> + <annotations> + <description>Clicks on create Configurable Product from the Admin Products grid page.</description> + </annotations> + + <click stepKey="clickOnAddProductItem" selector="{{ConfigurableProductSection.addProductItem}}"/> + <click stepKey="clickOnConfigurationProductItem" selector="{{ConfigurableProductSection.configProductItem}}"/> + <waitForPageLoad stepKey="waitForConfigurableProductPageLoad"/> + <seeInCurrentUrl stepKey="assertWeAreOnTheConfigurableProductPage" url="{{assertionData.configurableProduct}}"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/SaveConfigurableProductActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/SaveConfigurableProductActionGroup.xml new file mode 100644 index 0000000000000..3b77a3b00c960 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/SaveConfigurableProductActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SaveConfigurableProductActionGroup"> + <annotations> + <description>Save configurable product</description> + </annotations> + <arguments> + <argument name="product" defaultValue="_defaultProduct"/> + </arguments> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton"/> + <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup"/> + <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSaveProductMessage"/> + <seeInTitle userInput="{{product.name}}" stepKey="seeProductNameInTitle"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/SaveConfigurableProductAddToCurrentAttributeSetActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/SaveConfigurableProductAddToCurrentAttributeSetActionGroup.xml new file mode 100644 index 0000000000000..2b45b52e39d8f --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/SaveConfigurableProductAddToCurrentAttributeSetActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SaveConfigurableProductAddToCurrentAttributeSetActionGroup"> + <annotations> + <description>Clicks on 'Save'. Clicks on 'Confirm' in the 'Choose Affected Attribute Set' model on the Configurable Product creation/edit page.</description> + </annotations> + + <waitForElementVisible selector="{{AdminProductFormActionSection.saveButton}}" stepKey="waitForSaveBtnVisible"/> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProductAgain"/> + <waitForElementVisible selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="waitPopUpVisible"/> + <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmPopup"/> + <seeElement selector="{{AdminMessagesSection.success}}" stepKey="seeSaveProductMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/SaveConfigurableProductWithNewAttributeSetActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/SaveConfigurableProductWithNewAttributeSetActionGroup.xml new file mode 100644 index 0000000000000..449c97cb5da6e --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/SaveConfigurableProductWithNewAttributeSetActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SaveConfigurableProductWithNewAttributeSetActionGroup"> + <annotations> + <description>Clicks on 'Save'. Clicks radio for '...new Attribute Set...' in the 'Choose Affected Attribute Set' modal. Clicks on 'Confirm' in the model on the Configurable Product creation/edit page.</description> + </annotations> + + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveConfigurableProduct"/> + <waitForElementVisible selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" time="30" stepKey="waitForAttributeSetConfirmation"/> + <click selector="{{AdminChooseAffectedAttributeSetPopup.addNewAttrSet}}" stepKey="clickAddNewAttributeSet"/> + <fillField selector="{{AdminChooseAffectedAttributeSetPopup.createNewAttrSetName}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="fillFieldNewAttrSetName"/> + <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickConfirmAttributeSet"/> + <see selector="You saved the product" stepKey="seeConfigurableSaveConfirmation" after="clickConfirmAttributeSet"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/SaveConfiguredProductActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/SaveConfiguredProductActionGroup.xml new file mode 100644 index 0000000000000..011c1f195dbd1 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/SaveConfiguredProductActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SaveConfiguredProductActionGroup"> + <annotations> + <description>Save the Configurable Product on the Configurable Product creation/edit page. Validates that the Success Message is present.</description> + </annotations> + + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton2"/> + <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup"/> + <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSaveProductMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/SelectCreatedAttributeAndCreateTwoOptionsActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/SelectCreatedAttributeAndCreateTwoOptionsActionGroup.xml new file mode 100644 index 0000000000000..ef06518205196 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/SelectCreatedAttributeAndCreateTwoOptionsActionGroup.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SelectCreatedAttributeAndCreateTwoOptionsActionGroup" extends="AddNewProductConfigurationAttributeActionGroup"> + <remove keyForRemoval="clickOnNewAttribute"/> + <remove keyForRemoval="waitForIFrame"/> + <remove keyForRemoval="switchToNewAttributeIFrame"/> + <remove keyForRemoval="fillDefaultLabel"/> + <remove keyForRemoval="clickOnNewAttributePanel"/> + <remove keyForRemoval="waitForSaveAttribute"/> + <remove keyForRemoval="switchOutOfIFrame"/> + <remove keyForRemoval="waitForFilters"/> + <fillField userInput="{{attribute.attribute_code}}" selector="{{AdminCreateProductConfigurationsPanel.attributeCode}}" stepKey="fillFilterAttributeCodeField"/> + <fillField userInput="{{firstOption.label}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewFirstOption"/> + <fillField userInput="{{secondOption.label}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewSecondOption"/> + <remove keyForRemoval="clickOnSelectAll"/> + <remove keyForRemoval="clickOnSecondNextButton"/> + <remove keyForRemoval="clickOnThirdNextButton"/> + <remove keyForRemoval="clickOnFourthNextButton"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/SelectSingleAttributeAndAddToCartActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/SelectSingleAttributeAndAddToCartActionGroup.xml new file mode 100644 index 0000000000000..681e3a319eac6 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/SelectSingleAttributeAndAddToCartActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SelectSingleAttributeAndAddToCartActionGroup"> + <annotations> + <description>Selects a Product Option. Clicks 'Add to Cart'. Validates that the Product Added Success message appears.</description> + </annotations> + <arguments> + <argument name="productName" type="string"/> + <argument name="attributeCode" type="string"/> + <argument name="optionName" type="string"/> + </arguments> + + <selectOption selector="{{StorefrontProductInfoMainSection.attributeSelectByAttributeID(attributeCode)}}" userInput="{{optionName}}" stepKey="selectAttribute"/> + <click stepKey="addProduct" selector="{{StorefrontProductActionSection.addToCart}}"/> + <waitForElementVisible selector="{{StorefrontQuickSearchResultsSection.messageSection}}" time="30" stepKey="waitForProductAdded"/> + <see selector="{{StorefrontQuickSearchResultsSection.messageSection}}" userInput="You added {{productName}} to your shopping cart." stepKey="seeAddedToCartMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StartCreateConfigurationsForAttributeActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StartCreateConfigurationsForAttributeActionGroup.xml new file mode 100644 index 0000000000000..d91d918c9ec79 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StartCreateConfigurationsForAttributeActionGroup.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StartCreateConfigurationsForAttributeActionGroup" extends="GenerateConfigurationsByAttributeCodeActionGroup"> + <remove keyForRemoval="clickOnNextButton3"/> + <remove keyForRemoval="clickOnNextButton4"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontCategoryActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontCheckCategoryConfigurableProductActionGroup.xml similarity index 60% rename from app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontCategoryActionGroup.xml rename to app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontCheckCategoryConfigurableProductActionGroup.xml index 8b61f0e109591..d33675e2c6b06 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontCategoryActionGroup.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontCheckCategoryConfigurableProductActionGroup.xml @@ -9,7 +9,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <!-- Check configurable product on the category page --> - <actionGroup name="StorefrontCheckCategoryConfigurableProduct"> + <actionGroup name="StorefrontCheckCategoryConfigurableProductActionGroup"> <annotations> <description>Validates that the provided Configurable Product is present and correct on a Category page.</description> </annotations> @@ -25,19 +25,4 @@ <!-- @TODO: MAGETWO-80272 Move to Magento_Checkout --> <seeElement selector="{{StorefrontCategoryProductSection.ProductAddToCartByName(product.name)}}" stepKey="AssertAddToCart"/> </actionGroup> - - <!-- Check configurable product out of stock on the category page --> - <actionGroup name="StorefrontCheckCategoryOutOfStockConfigurableProduct"> - <annotations> - <description>Validates that the provided Configurable Product is present and correct on a Category page.</description> - </annotations> - <arguments> - <argument name="product" type="entity"/> - </arguments> - - <seeElement selector="{{StorefrontCategoryProductSection.ProductTitleByName(product.name)}}" stepKey="assertProductName"/> - <moveMouseOver selector="{{StorefrontCategoryProductSection.ProductInfoByName(product.name)}}" stepKey="moveMouseOverProduct"/> - <seeElement selector="{{StorefrontCategoryProductSection.ProductStockUnavailable}}" stepKey="AssertOutOfStock"/> - <dontSeeElement selector="{{StorefrontCategoryProductSection.ProductAddToCartByName(product.name)}}" stepKey="AssertAddToCart"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontCheckCategoryOutOfStockConfigurableProductActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontCheckCategoryOutOfStockConfigurableProductActionGroup.xml new file mode 100644 index 0000000000000..1de28e36d83ae --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontCheckCategoryOutOfStockConfigurableProductActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCheckCategoryOutOfStockConfigurableProductActionGroup"> + <annotations> + <description>Validates that the provided Configurable Product is present and correct on a Category page.</description> + </annotations> + <arguments> + <argument name="product" type="entity"/> + </arguments> + + <seeElement selector="{{StorefrontCategoryProductSection.ProductTitleByName(product.name)}}" stepKey="assertProductName"/> + <moveMouseOver selector="{{StorefrontCategoryProductSection.ProductInfoByName(product.name)}}" stepKey="moveMouseOverProduct"/> + <seeElement selector="{{StorefrontCategoryProductSection.ProductStockUnavailable}}" stepKey="AssertOutOfStock"/> + <dontSeeElement selector="{{StorefrontCategoryProductSection.ProductAddToCartByName(product.name)}}" stepKey="AssertAddToCart"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontCheckConfigurableProductActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontCheckConfigurableProductActionGroup.xml new file mode 100644 index 0000000000000..e21c2e11fcc4c --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontCheckConfigurableProductActionGroup.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <!-- Check the configurable product on the product page --> + <actionGroup name="StorefrontCheckConfigurableProductActionGroup"> + <annotations> + <description>Goes to the provided Storefront Product page. Validates that the Product details are present and correct.</description> + </annotations> + <arguments> + <argument name="product"/> + <argument name="optionProduct"/> + </arguments> + + <seeInCurrentUrl url="/{{product.custom_attributes[url_key]}}.html" stepKey="checkUrl"/> + <seeInTitle userInput="{{product.name}}" stepKey="AssertProductNameInTitle"/> + <see userInput="{{product.name}}" selector="{{StorefrontProductInfoMainSection.productName}}" stepKey="assertProductName"/> + <see userInput="{{product.sku}}" selector="{{StorefrontProductInfoMainSection.productSku}}" stepKey="assertProductSku"/> + <see userInput="${{optionProduct.price}}.00" selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="assertProductPrice"/> + <see userInput="IN STOCK" selector="{{StorefrontProductInfoMainSection.productStockStatus}}" stepKey="assertInStock"/> + <seeElement selector="{{StorefrontProductInfoMainSection.AddToCart}}" stepKey="assertAddToCart"/> + <see userInput="{{product.custom_attributes[description]}}" selector="{{StorefrontProductInfoMainSection.productDescription}}" stepKey="assertProductDescription"/> + <see userInput="{{product.custom_attributes[short_description]}}" selector="{{StorefrontProductInfoMainSection.productShortDescription}}" stepKey="assertProductShortDescription"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontCheckConfigurableProductOptionsActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontCheckConfigurableProductOptionsActionGroup.xml new file mode 100644 index 0000000000000..bee1181601f9b --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontCheckConfigurableProductOptionsActionGroup.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCheckConfigurableProductOptionsActionGroup"> + <annotations> + <description>Validates that the Options for a Configurable Product are present and correct.</description> + </annotations> + <arguments> + <argument name="product" type="entity"/> + <argument name="firstOption" type="entity"/> + <argument name="secondOption" type="entity"/> + </arguments> + + <selectOption userInput="{{firstOption.name}}" selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" stepKey="selectOption1"/> + <see userInput="{{product.name}}" selector="{{StorefrontProductInfoMainSection.productName}}" stepKey="seeConfigurableProductName"/> + <see userInput="{{firstOption.price}}" selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="assertProductPricePresent"/> + <see userInput="{{product.sku}}" selector="{{StorefrontProductInfoMainSection.productSku}}" stepKey="seeConfigurableProductSku"/> + <see userInput="IN STOCK" selector="{{StorefrontProductInfoMainSection.productStockStatus}}" stepKey="assertInStock"/> + <see userInput="{{colorProductAttribute.default_label}}" selector="{{StorefrontProductInfoMainSection.productAttributeTitle1}}" stepKey="seeColorAttributeName"/> + <dontSee userInput="As low as" selector="{{StorefrontProductInfoMainSection.productPriceLabel}}" stepKey="dontSeeProductPriceLabel1"/> + <selectOption userInput="{{secondOption.name}}" selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" stepKey="selectOption2"/> + <dontSee userInput="As low as" selector="{{StorefrontProductInfoMainSection.productPriceLabel}}" stepKey="dontSeeProductPriceLabel2"/> + <see userInput="{{secondOption.price}}" selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="seeProductPrice2"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontOpenMinicartAndCheckConfigurableProductActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontOpenMinicartAndCheckConfigurableProductActionGroup.xml new file mode 100644 index 0000000000000..d2567aa9c87f8 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontOpenMinicartAndCheckConfigurableProductActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontOpenMinicartAndCheckConfigurableProductActionGroup"> + <annotations> + <description>Validates that the provided Option Price is present and correct in the Mini Shopping Cart on the Storefront.</description> + </annotations> + <arguments> + <argument name="product"/> + <argument name="optionProduct"/> + </arguments> + + <waitForElement selector="{{StorefrontMinicartSection.productLinkByName(product.name)}}" stepKey="waitForMinicartProduct"/> + <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickShowMinicart"/> + <see userInput="${{optionProduct.price}}.00" selector="{{StorefrontMinicartSection.productPriceByName(product.name)}}" stepKey="assertProductPrice"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontProductActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontProductActionGroup.xml deleted file mode 100644 index e5d537f350299..0000000000000 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontProductActionGroup.xml +++ /dev/null @@ -1,134 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <!-- Check the configurable product on the product page --> - <actionGroup name="StorefrontCheckConfigurableProduct"> - <annotations> - <description>Goes to the provided Storefront Product page. Validates that the Product details are present and correct.</description> - </annotations> - <arguments> - <argument name="product"/> - <argument name="optionProduct"/> - </arguments> - - <seeInCurrentUrl url="/{{product.custom_attributes[url_key]}}.html" stepKey="checkUrl"/> - <seeInTitle userInput="{{product.name}}" stepKey="AssertProductNameInTitle"/> - <see userInput="{{product.name}}" selector="{{StorefrontProductInfoMainSection.productName}}" stepKey="assertProductName"/> - <see userInput="{{product.sku}}" selector="{{StorefrontProductInfoMainSection.productSku}}" stepKey="assertProductSku"/> - <see userInput="${{optionProduct.price}}.00" selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="assertProductPrice"/> - <see userInput="IN STOCK" selector="{{StorefrontProductInfoMainSection.productStockStatus}}" stepKey="assertInStock"/> - <seeElement selector="{{StorefrontProductInfoMainSection.AddToCart}}" stepKey="assertAddToCart"/> - <see userInput="{{product.custom_attributes[description]}}" selector="{{StorefrontProductInfoMainSection.productDescription}}" stepKey="assertProductDescription"/> - <see userInput="{{product.custom_attributes[short_description]}}" selector="{{StorefrontProductInfoMainSection.productShortDescription}}" stepKey="assertProductShortDescription"/> - </actionGroup> - - <!-- Check Storefront Configurable Product Option --> - <actionGroup name="VerifyOptionInProductStorefront"> - <annotations> - <description>Validates that the provided Option Code and Option Name are present and correct on a Configurable Product page.</description> - </annotations> - <arguments> - <argument name="attributeCode" type="string"/> - <argument name="optionName" type="string"/> - </arguments> - - <seeElement selector="{{StorefrontProductInfoMainSection.attributeOptionByAttributeID(attributeCode, optionName)}}" stepKey="verifyOptionExists"/> - </actionGroup> - - <!-- Adds Single Option Configurable Product to cart--> - <actionGroup name="SelectSingleAttributeAndAddToCart"> - <annotations> - <description>Selects a Product Option. Clicks 'Add to Cart'. Validates that the Product Added Success message appears.</description> - </annotations> - <arguments> - <argument name="productName" type="string"/> - <argument name="attributeCode" type="string"/> - <argument name="optionName" type="string"/> - </arguments> - - <selectOption selector="{{StorefrontProductInfoMainSection.attributeSelectByAttributeID(attributeCode)}}" userInput="{{optionName}}" stepKey="selectAttribute"/> - <click stepKey="addProduct" selector="{{StorefrontProductActionSection.addToCart}}"/> - <waitForElementVisible selector="{{StorefrontQuickSearchResultsSection.messageSection}}" time="30" stepKey="waitForProductAdded"/> - <see selector="{{StorefrontQuickSearchResultsSection.messageSection}}" userInput="You added {{productName}} to your shopping cart." stepKey="seeAddedToCartMessage"/> - </actionGroup> - - <!-- Verify configurable product options in storefront product view --> - <actionGroup name="storefrontCheckConfigurableProductOptions"> - <annotations> - <description>Validates that the Options for a Configurable Product are present and correct.</description> - </annotations> - <arguments> - <argument name="product" type="entity"/> - <argument name="firstOption" type="entity"/> - <argument name="secondOption" type="entity"/> - </arguments> - - <selectOption userInput="{{firstOption.name}}" selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" stepKey="selectOption1"/> - <see userInput="{{product.name}}" selector="{{StorefrontProductInfoMainSection.productName}}" stepKey="seeConfigurableProductName"/> - <see userInput="{{firstOption.price}}" selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="assertProductPricePresent"/> - <see userInput="{{product.sku}}" selector="{{StorefrontProductInfoMainSection.productSku}}" stepKey="seeConfigurableProductSku"/> - <see userInput="IN STOCK" selector="{{StorefrontProductInfoMainSection.productStockStatus}}" stepKey="assertInStock"/> - <see userInput="{{colorProductAttribute.default_label}}" selector="{{StorefrontProductInfoMainSection.productAttributeTitle1}}" stepKey="seeColorAttributeName"/> - <dontSee userInput="As low as" selector="{{StorefrontProductInfoMainSection.productPriceLabel}}" stepKey="dontSeeProductPriceLabel1"/> - <selectOption userInput="{{secondOption.name}}" selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" stepKey="selectOption2"/> - <dontSee userInput="As low as" selector="{{StorefrontProductInfoMainSection.productPriceLabel}}" stepKey="dontSeeProductPriceLabel2"/> - <see userInput="{{secondOption.price}}" selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="seeProductPrice2"/> - </actionGroup> - - <!-- Assert option image in storefront product page --> - <actionGroup name="assertOptionImageInStorefrontProductPage"> - <annotations> - <description>Validates that the provided Product Image is present when the provided Product Option is selected.</description> - </annotations> - <arguments> - <argument name="product" type="entity"/> - <argument name="label" type="string"/> - <argument name="image" defaultValue="MagentoLogo"/> - </arguments> - - <seeInCurrentUrl url="/{{product.urlKey}}.html" stepKey="checkUrl"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <selectOption userInput="{{label}}" selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" stepKey="selectOption1"/> - <seeElement selector="{{StorefrontProductMediaSection.imageFile(image.filename)}}" stepKey="seeFirstImage"/> - </actionGroup> - - <!-- Assert option image and price in storefront product page --> - <actionGroup name="AssertOptionImageAndPriceInStorefrontProductActionGroup"> - <annotations> - <description>Validates that the provided Product Image and Price are present when the provided Product Option is selected.</description> - </annotations> - <arguments> - <argument name="label" type="string"/> - <argument name="image" type="string"/> - <argument name="price" type="string"/> - </arguments> - - <selectOption userInput="{{label}}" selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" stepKey="selectOption"/> - <seeElement selector="{{StorefrontProductMediaSection.imageFile(image)}}" stepKey="seeImage"/> - <see userInput="{{price}}" selector="{{StorefrontProductInfoMainSection.price}}" stepKey="seeProductPrice"/> - </actionGroup> - - <!-- Assert configurable product with special price in storefront product page --> - <actionGroup name="assertConfigurableProductWithSpecialPriceOnStorefrontProductPage"> - <annotations> - <description>Validates that Special Price for a Configurable Product is present and correct when the provided Product Option is selected.</description> - </annotations> - <arguments> - <argument name="option" type="string"/> - <argument name="price" type="string"/> - <argument name="specialPrice" defaultValue="specialProductPrice"/> - </arguments> - - <selectOption userInput="{{option}}" selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" stepKey="selectOptionWithSpecialPrice"/> - <see userInput="{{specialProductPrice.price}}" selector="{{StorefrontProductInfoMainSection.productSpecialPrice}}" stepKey="seeSpecialProductPrice"/> - <see userInput="Regular Price" selector="{{StorefrontProductInfoMainSection.specialProductText}}" stepKey="seeText"/> - <see userInput="{{price}}" selector="{{StorefrontProductInfoMainSection.oldProductPrice}}" stepKey="seeOldProductPrice"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontProductCartActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontProductCartActionGroup.xml index 965f452861f7c..28c23955aa1f8 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontProductCartActionGroup.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontProductCartActionGroup.xml @@ -25,17 +25,5 @@ </actionGroup> <!-- Open the Minicart and check Configurable Product --> - <actionGroup name="StorefrontOpenMinicartAndCheckConfigurableProductActionGroup"> - <annotations> - <description>Validates that the provided Option Price is present and correct in the Mini Shopping Cart on the Storefront.</description> - </annotations> - <arguments> - <argument name="product"/> - <argument name="optionProduct"/> - </arguments> - <waitForElement selector="{{StorefrontMinicartSection.productLinkByName(product.name)}}" stepKey="waitForMinicartProduct"/> - <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickShowMinicart"/> - <see userInput="${{optionProduct.price}}.00" selector="{{StorefrontMinicartSection.productPriceByName(product.name)}}" stepKey="assertProductPrice"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/VerifyOptionInProductStorefrontActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/VerifyOptionInProductStorefrontActionGroup.xml new file mode 100644 index 0000000000000..05623ee9c8ee4 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/VerifyOptionInProductStorefrontActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="VerifyOptionInProductStorefrontActionGroup"> + <annotations> + <description>Validates that the provided Option Code and Option Name are present and correct on a Configurable Product page.</description> + </annotations> + <arguments> + <argument name="attributeCode" type="string"/> + <argument name="optionName" type="string"/> + </arguments> + + <seeElement selector="{{StorefrontProductInfoMainSection.attributeOptionByAttributeID(attributeCode, optionName)}}" stepKey="verifyOptionExists"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/ViewConfigurableProductInAdminGridActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/ViewConfigurableProductInAdminGridActionGroup.xml new file mode 100644 index 0000000000000..135bd21aad3e9 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/ViewConfigurableProductInAdminGridActionGroup.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ViewConfigurableProductInAdminGridActionGroup"> + <annotations> + <description>Goes to the Admin Product grid page. Validates the provided Configurable Product is present and correct in the grid.</description> + </annotations> + <arguments> + <argument name="product" defaultValue="_defaultProduct"/> + </arguments> + + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> + <waitForPageLoad 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"/> + <seeNumberOfElements selector="{{AdminProductGridSection.productGridRows}}" userInput="3" stepKey="seeCorrectNumberOfProducts"/> + + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFiltersSimple"/> + <selectOption selector="{{AdminProductGridFilterSection.typeFilter}}" userInput="simple" stepKey="selectionProductType"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFiltersWithSimpleType"/> + <see selector="{{AdminProductGridSection.firstProductRow}}" userInput="{{product.name}}" stepKey="seeSimpleProductNameInGrid"/> + <see selector="{{AdminProductGridSection.firstProductRow}}" userInput="{{product.price}}" stepKey="seeSimpleProductPriceInGrid"/> + + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFiltersConfigurable"/> + <selectOption selector="{{AdminProductGridFilterSection.typeFilter}}" userInput="{{product.type_id}}" stepKey="selectionConfigurableProductType"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFiltersWithConfigurableType"/> + <see selector="{{AdminProductGridSection.firstProductRow}}" userInput="{{product.name}}" stepKey="seeConfigurableProductNameInGrid"/> + <dontSee selector="{{AdminProductGridSection.firstProductRow}}" userInput="{{product.price}}" stepKey="dontSeeProductPriceNameInGrid"/> + + <click selector="{{AdminProductGridFilterSection.clearFilters}}" stepKey="clickClearFiltersAfter"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAddingNewOptionsWithImagesAndPricesToConfigurableProductTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAddingNewOptionsWithImagesAndPricesToConfigurableProductTest.xml index 36c135c427365..7740589b4d498 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAddingNewOptionsWithImagesAndPricesToConfigurableProductTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAddingNewOptionsWithImagesAndPricesToConfigurableProductTest.xml @@ -67,17 +67,17 @@ selector="{{AdminCreateProductConfigurationsPanel.selectImagesButton}}" stepKey="selectAttributeOption"/> <!-- Add images to configurable product attribute options --> - <actionGroup ref="addUniqueImageToConfigurableProductOption" stepKey="addImageToConfigurableProductOptionOne"> + <actionGroup ref="AddUniqueImageToConfigurableProductOptionActionGroup" stepKey="addImageToConfigurableProductOptionOne"> <argument name="image" value="ImageUpload"/> <argument name="frontend_label" value="$$createConfigProductAttributeCreateConfigurableProduct.default_frontend_label$$"/> <argument name="label" value="$$getConfigAttributeOption1CreateConfigurableProduct.label$$"/> </actionGroup> - <actionGroup ref="addUniqueImageToConfigurableProductOption" stepKey="addImageToConfigurableProductOptionTwo"> + <actionGroup ref="AddUniqueImageToConfigurableProductOptionActionGroup" stepKey="addImageToConfigurableProductOptionTwo"> <argument name="image" value="ImageUpload_1"/> <argument name="frontend_label" value="$$createConfigProductAttributeCreateConfigurableProduct.default_frontend_label$$"/> <argument name="label" value="$$getConfigAttributeOption2CreateConfigurableProduct.label$$"/> </actionGroup> - <actionGroup ref="addUniqueImageToConfigurableProductOption" stepKey="addImageToConfigurableProductOptionThree"> + <actionGroup ref="AddUniqueImageToConfigurableProductOptionActionGroup" stepKey="addImageToConfigurableProductOptionThree"> <argument name="image" value="ImageUpload3"/> <argument name="frontend_label" value="$$createConfigProductAttributeCreateConfigurableProduct.default_frontend_label$$"/> <argument name="label" value="{{colorDefaultProductAttribute1.name}}"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAssertNoticeThatExistingSkuAutomaticallyChangedWhenSavingProductWithSameSkuTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAssertNoticeThatExistingSkuAutomaticallyChangedWhenSavingProductWithSameSkuTest.xml index c085229da8028..0568ee445034e 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAssertNoticeThatExistingSkuAutomaticallyChangedWhenSavingProductWithSameSkuTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAssertNoticeThatExistingSkuAutomaticallyChangedWhenSavingProductWithSameSkuTest.xml @@ -52,7 +52,7 @@ <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.createNewAttribute}}" time="30" stepKey="waitForConfigurationModalOpen" after="clickCreateConfigurations"/> <!--Create new attribute with two option --> - <actionGroup ref="addNewProductConfigurationAttribute" stepKey="createProductConfigurationAttribute"> + <actionGroup ref="AddNewProductConfigurationAttributeActionGroup" stepKey="createProductConfigurationAttribute"> <argument name="attribute" value="colorProductAttribute"/> <argument name="firstOption" value="colorConfigurableProductAttribute1"/> <argument name="secondOption" value="colorConfigurableProductAttribute2"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckConfigurableProductAttributeValueUniquenessTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckConfigurableProductAttributeValueUniquenessTest.xml index df6afdcfd2243..7c25cf82a1181 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckConfigurableProductAttributeValueUniquenessTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckConfigurableProductAttributeValueUniquenessTest.xml @@ -55,7 +55,7 @@ <conditionalClick selector="{{AdminProductFormConfigurationsSection.sectionHeader}}" dependentSelector="{{AdminProductFormConfigurationsSection.createConfigurations}}" visible="false" stepKey="expandConfigurationsTab1"/> <click selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="clickOnCreateConfigurations1"/> <waitForPageLoad stepKey="waitForSelectAttributesPage1"/> - <actionGroup ref="selectCreatedAttributeAndCreateTwoOptions" stepKey="selectCreatedAttributeAndCreateOptions"> + <actionGroup ref="SelectCreatedAttributeAndCreateTwoOptionsActionGroup" stepKey="selectCreatedAttributeAndCreateOptions"> <argument name="attribute" value="dropdownProductAttribute"/> <argument name="firstOption" value="productAttributeOption1"/> <argument name="secondOption" value="productAttributeOption1"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckResultsOfColorAndOtherFiltersTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckResultsOfColorAndOtherFiltersTest.xml index de0cca11235ea..502b25617e2b3 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckResultsOfColorAndOtherFiltersTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckResultsOfColorAndOtherFiltersTest.xml @@ -120,13 +120,13 @@ <actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openEditProductFirst"> <argument name="product" value="$$createFirstConfigurableProduct$$"/> </actionGroup> - <actionGroup ref="CreateConfigurableProductWithAttributeSet" stepKey="createProductFirst"> + <actionGroup ref="CreateConfigurableProductWithAttributeSetActionGroup" stepKey="createProductFirst"> <argument name="product" value="$$createFirstConfigurableProduct$$"/> <argument name="category" value="$$createCategory$$"/> <argument name="label" value="mySet"/> <argument name="option1" value="['option1', 'option2', 'option3', 'option4']"/> </actionGroup> - <actionGroup ref="AdminCreateConfigurationsForAttribute" stepKey="createConfigurationFirst"> + <actionGroup ref="AdminCreateConfigurationsForAttributeActionGroup" stepKey="createConfigurationFirst"> <argument name="attributeCode" value="$$createConfigProductAttribute.attribute_code$$"/> <argument name="price" value="34"/> </actionGroup> @@ -142,13 +142,13 @@ <actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openEditProductSecond"> <argument name="product" value="$$createSecondConfigurableProduct$$"/> </actionGroup> - <actionGroup ref="CreateConfigurableProductWithAttributeSet" stepKey="createProductSecond"> + <actionGroup ref="CreateConfigurableProductWithAttributeSetActionGroup" stepKey="createProductSecond"> <argument name="product" value="$$createSecondConfigurableProduct$$"/> <argument name="category" value="$$createCategory$$"/> <argument name="label" value="mySet"/> <argument name="option1" value="['option1', 'option2', 'option3']"/> </actionGroup> - <actionGroup ref="AdminCreateConfigurableProductWithAttributeUncheckOption" stepKey="createConfigurationSecond"> + <actionGroup ref="AdminCreateConfigurableProductWithAttributeUncheckOptionActionGroup" stepKey="createConfigurationSecond"> <argument name="attributeCode" value="$$createConfigProductAttribute.attribute_code$$"/> <argument name="price" value="34"/> <argument name="attributeOption" value="option5"/> @@ -165,13 +165,13 @@ <actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openEditProductThird"> <argument name="product" value="$$createThirdConfigurableProduct$$"/> </actionGroup> - <actionGroup ref="CreateConfigurableProductWithAttributeSet" stepKey="createProductThird"> + <actionGroup ref="CreateConfigurableProductWithAttributeSetActionGroup" stepKey="createProductThird"> <argument name="product" value="$$createThirdConfigurableProduct$$"/> <argument name="category" value="$$createCategory$$"/> <argument name="label" value="mySet"/> <argument name="option1" value="['option2', 'option3', 'option4']"/> </actionGroup> - <actionGroup ref="AdminCreateConfigurableProductWithAttributeUncheckOption" stepKey="createConfigurationThird"> + <actionGroup ref="AdminCreateConfigurableProductWithAttributeUncheckOptionActionGroup" stepKey="createConfigurationThird"> <argument name="attributeCode" value="$$createConfigProductAttribute.attribute_code$$"/> <argument name="price" value="34"/> <argument name="attributeOption" value="option1"/> @@ -187,7 +187,7 @@ <actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openEditSimpleProduct"> <argument name="product" value="$$createSimpleProduct$$"/> </actionGroup> - <actionGroup ref="CreateConfigurableProductWithAttributeSet" stepKey="createSimpleProduct"> + <actionGroup ref="CreateConfigurableProductWithAttributeSetActionGroup" stepKey="createSimpleProduct"> <argument name="product" value="$$createSimpleProduct$$"/> <argument name="category" value="$$createCategory$$"/> <argument name="label" value="mySet"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductCreateTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductCreateTest.xml index 430007ae761f7..aa2e7c1a8a073 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductCreateTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductCreateTest.xml @@ -30,7 +30,7 @@ </after> <!-- Create a configurable product via the UI --> - <actionGroup ref="createConfigurableProduct" stepKey="createProduct"> + <actionGroup ref="CreateConfigurableProductActionGroup" stepKey="createProduct"> <argument name="product" value="_defaultProduct"/> <argument name="category" value="$$createCategory$$"/> </actionGroup> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductLongSkuTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductLongSkuTest.xml index cd09cbd295877..592642573a221 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductLongSkuTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductLongSkuTest.xml @@ -63,7 +63,7 @@ <fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{ProductWithLongNameSku.price}}" stepKey="fillProductPrice"/> <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[$$createCategory.name$$]" stepKey="selectCategory"/> <!--Setup configurations--> - <actionGroup ref="generateConfigurationsByAttributeCode" stepKey="setupConfigurations"> + <actionGroup ref="GenerateConfigurationsByAttributeCodeActionGroup" stepKey="setupConfigurations"> <argument name="attributeCode" value="$$createConfigProductAttribute.attribute_code$$"/> </actionGroup> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest.xml index 7c6cd57097591..6514ed23ea2b5 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest.xml @@ -284,7 +284,7 @@ </after> <!-- Create a configurable product via the UI --> - <actionGroup ref="createConfigurableProduct" stepKey="createProduct"> + <actionGroup ref="CreateConfigurableProductActionGroup" stepKey="createProduct"> <argument name="product" value="_defaultProduct"/> <argument name="category" value="$$createCategory$$"/> </actionGroup> @@ -333,7 +333,7 @@ </after> <!-- Create a configurable product via the UI --> - <actionGroup ref="createConfigurableProduct" stepKey="createProduct"> + <actionGroup ref="CreateConfigurableProductActionGroup" stepKey="createProduct"> <argument name="product" value="_defaultProduct"/> <argument name="category" value="$$createCategory$$"/> </actionGroup> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableSetEditRelatedProductsTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableSetEditRelatedProductsTest.xml index 11f1e9bb33c10..f6bcfac593bf2 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableSetEditRelatedProductsTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableSetEditRelatedProductsTest.xml @@ -32,7 +32,7 @@ <!-- Create product --> <remove keyForRemoval="goToCreateProduct"/> - <actionGroup ref="createConfigurableProduct" stepKey="fillProductForm"> + <actionGroup ref="CreateConfigurableProductActionGroup" stepKey="fillProductForm"> <argument name="product" value="_defaultProduct"/> <argument name="category" value="$$createCategory$$"/> </actionGroup> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml index 2cc71964042a4..e1dab01697d89 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml @@ -70,12 +70,12 @@ <argument name="product" value="_defaultProduct"/> </actionGroup> <comment before="createConfiguration" stepKey="beforeCreateConfiguration" userInput="Adding Configuration to Product"/> - <actionGroup ref="generateConfigurationsByAttributeCode" stepKey="createConfiguration" after="fillProductForm"> + <actionGroup ref="GenerateConfigurationsByAttributeCodeActionGroup" stepKey="createConfiguration" after="fillProductForm"> <argument name="attributeCode" value="$$createConfigProductAttribute.attribute_code$$"/> </actionGroup> - <actionGroup ref="saveConfiguredProduct" stepKey="saveProductForm"/> + <actionGroup ref="SaveConfiguredProductActionGroup" stepKey="saveProductForm"/> <see selector="{{AdminProductGridSection.productGridCell('2', 'Type')}}" userInput="Configurable Product" stepKey="seeProductTypeInGrid"/> - <actionGroup ref="VerifyOptionInProductStorefront" stepKey="verifyConfigurableOption" after="AssertProductInStorefrontProductPage"> + <actionGroup ref="VerifyOptionInProductStorefrontActionGroup" stepKey="verifyConfigurableOption" after="AssertProductInStorefrontProductPage"> <argument name="attributeCode" value="$createConfigProductAttribute.default_frontend_label$"/> <argument name="optionName" value="$createConfigProductAttributeOption1.option[store_labels][1][label]$"/> </actionGroup> @@ -109,14 +109,14 @@ <argument name="product" value="_defaultProduct"/> </actionGroup> <comment before="createConfiguration" stepKey="beforeCreateConfiguration" userInput="Adding Configuration to Product"/> - <actionGroup ref="generateConfigurationsByAttributeCode" stepKey="createConfiguration" after="fillProductForm"> + <actionGroup ref="GenerateConfigurationsByAttributeCodeActionGroup" stepKey="createConfiguration" after="fillProductForm"> <argument name="attributeCode" value="$$createConfigProductAttribute.attribute_code$$"/> </actionGroup> - <actionGroup ref="saveConfiguredProduct" stepKey="saveProductForm"/> + <actionGroup ref="SaveConfiguredProductActionGroup" stepKey="saveProductForm"/> <see selector="{{AdminProductGridSection.productGridCell('2', 'Type')}}" userInput="Configurable Product" stepKey="seeProductTypeInGrid"/> <!-- Verify product on store front --> <comment userInput="Verify product on store front" stepKey="commentVerifyProductGrid"/> - <actionGroup ref="VerifyOptionInProductStorefront" stepKey="verifyConfigurableOption" after="AssertProductInStorefrontProductPage"> + <actionGroup ref="VerifyOptionInProductStorefrontActionGroup" stepKey="verifyConfigurableOption" after="AssertProductInStorefrontProductPage"> <argument name="attributeCode" value="$createConfigProductAttribute.default_frontend_label$"/> <argument name="optionName" value="$createConfigProductAttributeOption1.option[store_labels][1][label]$"/> </actionGroup> @@ -169,10 +169,10 @@ <argument name="product" value="_defaultProduct"/> </actionGroup> <comment before="createConfiguration" stepKey="beforeCreateConfiguration" userInput="Adding Configuration to Product"/> - <actionGroup ref="generateConfigurationsByAttributeCode" stepKey="createConfiguration"> + <actionGroup ref="GenerateConfigurationsByAttributeCodeActionGroup" stepKey="createConfiguration"> <argument name="attributeCode" value="$$createConfigProductAttribute.attribute_code$$"/> </actionGroup> - <actionGroup ref="saveConfiguredProduct" stepKey="saveProductForm"/> + <actionGroup ref="SaveConfiguredProductActionGroup" stepKey="saveProductForm"/> <!-- Check that product was added with implicit type change --> <comment stepKey="beforeVerify" userInput="Verify Product Type Assigned Correctly"/> <actionGroup ref="GoToProductCatalogPage" stepKey="goToProductCatalogPage"/> @@ -184,7 +184,7 @@ <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="assertProductInStorefrontProductPage"> <argument name="product" value="_defaultProduct"/> </actionGroup> - <actionGroup ref="VerifyOptionInProductStorefront" stepKey="verifyConfigurableOption"> + <actionGroup ref="VerifyOptionInProductStorefrontActionGroup" stepKey="verifyConfigurableOption"> <argument name="attributeCode" value="$createConfigProductAttribute.default_frontend_label$"/> <argument name="optionName" value="$createConfigProductAttributeOption1.option[store_labels][1][label]$"/> </actionGroup> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductBasedOnParentSkuTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductBasedOnParentSkuTest.xml index f4f607e9119b6..4bec1b243ae39 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductBasedOnParentSkuTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductBasedOnParentSkuTest.xml @@ -52,20 +52,20 @@ <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.createNewAttribute}}" time="30" stepKey="waitForConfigurationModalOpen" after="clickCreateConfigurations"/> <!--Create new attribute with two option --> - <actionGroup ref="addNewProductConfigurationAttribute" stepKey="createProductConfigurationAttribute"> + <actionGroup ref="AddNewProductConfigurationAttributeActionGroup" stepKey="createProductConfigurationAttribute"> <argument name="attribute" value="colorProductAttribute"/> <argument name="firstOption" value="colorConfigurableProductAttribute1"/> <argument name="secondOption" value="colorConfigurableProductAttribute2"/> </actionGroup> <!-- Change product configurations except sku --> - <actionGroup ref="changeProductConfigurationsInGridExceptSku" stepKey="changeProductConfigurationsInGridExceptSku"> + <actionGroup ref="ChangeProductConfigurationsInGridExceptSkuActionGroup" stepKey="changeProductConfigurationsInGridExceptSku"> <argument name="firstOption" value="colorConfigurableProductAttribute1"/> <argument name="secondOption" value="colorConfigurableProductAttribute2"/> </actionGroup> <!-- Save product --> - <actionGroup ref="saveConfigurableProductAddToCurrentAttributeSet" stepKey="saveProduct"/> + <actionGroup ref="SaveConfigurableProductAddToCurrentAttributeSetActionGroup" stepKey="saveProduct"/> <!-- Assert child products generated sku in grid --> <amOnPage url="{{ProductCatalogPage.url}}" stepKey="openProductCatalogPage"/> @@ -79,4 +79,4 @@ </actionGroup> <see selector="{{AdminProductGridSection.productGridCell('1', 'SKU')}}" userInput="{{ApiConfigurableProduct.sku}}-{{colorConfigurableProductAttribute2.name}}" stepKey="seeSecondProductSkuInGrid"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithCreatingCategoryAndAttributeTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithCreatingCategoryAndAttributeTest.xml index a7242b43c2b5f..c87fd7dda867a 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithCreatingCategoryAndAttributeTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithCreatingCategoryAndAttributeTest.xml @@ -72,20 +72,20 @@ <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.createNewAttribute}}" time="30" stepKey="waitForConfigurationModalOpen" after="clickCreateConfigurations"/> <!--Create new attribute with two option --> - <actionGroup ref="addNewProductConfigurationAttribute" stepKey="createProductConfigurationAttribute"> + <actionGroup ref="AddNewProductConfigurationAttributeActionGroup" stepKey="createProductConfigurationAttribute"> <argument name="attribute" value="colorProductAttribute"/> <argument name="firstOption" value="colorConfigurableProductAttribute1"/> <argument name="secondOption" value="colorConfigurableProductAttribute2"/> </actionGroup> <!-- Change product configurations in grid --> - <actionGroup ref="changeProductConfigurationsInGrid" stepKey="changeProductConfigurationsInGrid"> + <actionGroup ref="ChangeProductConfigurationsInGridActionGroup" stepKey="changeProductConfigurationsInGrid"> <argument name="firstOption" value="colorConfigurableProductAttribute1"/> <argument name="secondOption" value="colorConfigurableProductAttribute2"/> </actionGroup> <!-- Save configurable product; add product to new attribute set --> - <actionGroup ref="saveConfigurableProductWithNewAttributeSet" stepKey="saveConfigurableProduct"/> + <actionGroup ref="SaveConfigurableProductWithNewAttributeSetActionGroup" stepKey="saveConfigurableProduct"/> <!-- Find configurable product in grid --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> @@ -97,7 +97,7 @@ <!-- Assert configurable product on admin product page --> <click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnProductPage"/> <waitForPageLoad stepKey="waitForProductPageLoad"/> - <actionGroup ref="assertConfigurableProductOnAdminProductPage" stepKey="assertConfigurableProductOnAdminProductPage"> + <actionGroup ref="AssertConfigurableProductOnAdminProductPageActionGroup" stepKey="assertConfigurableProductOnAdminProductPage"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> @@ -107,7 +107,7 @@ <!--Assert configurable product in category --> <amOnPage url="$$createCategory.name$$.html" stepKey="amOnCategoryPage"/> <waitForPageLoad stepKey="waitForCategoryPageLoad"/> - <actionGroup ref="StorefrontCheckCategoryConfigurableProduct" stepKey="assertConfigurableProductInCategory"> + <actionGroup ref="StorefrontCheckCategoryConfigurableProductActionGroup" stepKey="assertConfigurableProductInCategory"> <argument name="product" value="ApiConfigurableProduct"/> <argument name="optionProduct" value="colorConfigurableProductAttribute1"/> </actionGroup> @@ -115,7 +115,7 @@ <!--Assert configurable product on product page --> <amOnPage url="{{ApiConfigurableProduct.urlKey}}.html" stepKey="amOnProductPage"/> <waitForPageLoad stepKey="waitForPageLoad"/> - <actionGroup ref="storefrontCheckConfigurableProductOptions" stepKey="checkConfigurableProductOptions"> + <actionGroup ref="StorefrontCheckConfigurableProductOptionsActionGroup" stepKey="checkConfigurableProductOptions"> <argument name="product" value="ApiConfigurableProduct"/> <argument name="firstOption" value="colorConfigurableProductAttribute1"/> <argument name="secondOption" value="colorConfigurableProductAttribute2"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithDisabledChildrenProductsTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithDisabledChildrenProductsTest.xml index 49f3f8b5ea931..8c69542117993 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithDisabledChildrenProductsTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithDisabledChildrenProductsTest.xml @@ -69,7 +69,7 @@ </actionGroup> <!-- Create product configurations and add attribute and select all options --> - <actionGroup ref="generateConfigurationsByAttributeCode" stepKey="generateConfigurationsByAttributeCode" after="fillConfigurableProductValues"> + <actionGroup ref="GenerateConfigurationsByAttributeCodeActionGroup" stepKey="generateConfigurationsByAttributeCode" after="fillConfigurableProductValues"> <argument name="attributeCode" value="$$createConfigProductAttribute.attribute_code$$"/> </actionGroup> @@ -77,7 +77,7 @@ <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[$$createCategory.name$$]" stepKey="fillCategory" after="fillConfigurableProductValues"/> <!-- Add child product to configurations grid --> - <actionGroup ref="addProductToConfigurationsGrid" stepKey="addSimpleProduct"> + <actionGroup ref="AddProductToConfigurationsGridActionGroup" stepKey="addSimpleProduct"> <argument name="sku" value="$$createSimpleProduct.sku$$"/> <argument name="name" value="$$createConfigProductAttributeOption.option[store_labels][1][label]$$"/> </actionGroup> @@ -95,7 +95,7 @@ <!-- Assert configurable product on admin product page --> <click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnProductPage"/> <waitForPageLoad stepKey="waitForProductPageLoad"/> - <actionGroup ref="assertConfigurableProductOnAdminProductPage" stepKey="assertConfigurableProductOnAdminProductPage"> + <actionGroup ref="AssertConfigurableProductOnAdminProductPageActionGroup" stepKey="assertConfigurableProductOnAdminProductPage"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithImagesTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithImagesTest.xml index 9796c14f5519a..e856755a48ff8 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithImagesTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithImagesTest.xml @@ -97,24 +97,24 @@ <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton2"/> <!-- Add images to first product attribute options --> - <actionGroup ref="addUniqueImageToConfigurableProductOption" stepKey="addImageToConfigurableProductOptionOne"> + <actionGroup ref="AddUniqueImageToConfigurableProductOptionActionGroup" stepKey="addImageToConfigurableProductOptionOne"> <argument name="image" value="MagentoLogo"/> <argument name="frontend_label" value="$$createFirstConfigProductAttribute.default_frontend_label$$"/> <argument name="label" value="$$createConfigProductAttributeOptionOne.option[store_labels][1][label]$$"/> </actionGroup> - <actionGroup ref="addUniqueImageToConfigurableProductOption" stepKey="addImageToConfigurableProductOptionTwo"> + <actionGroup ref="AddUniqueImageToConfigurableProductOptionActionGroup" stepKey="addImageToConfigurableProductOptionTwo"> <argument name="image" value="TestImageNew"/> <argument name="frontend_label" value="$$createFirstConfigProductAttribute.default_frontend_label$$"/> <argument name="label" value="$$createConfigProductAttributeOptionTwo.option[store_labels][1][label]$$"/> </actionGroup> <!-- Add price to second product attribute options --> - <actionGroup ref="addUniquePriceToConfigurableProductOption" stepKey="addPriceToConfigurableProductOptionThree"> + <actionGroup ref="AddUniquePriceToConfigurableProductOptionActionGroup" stepKey="addPriceToConfigurableProductOptionThree"> <argument name="frontend_label" value="$$createSecondConfigProductAttribute.default_frontend_label$$"/> <argument name="label" value="$$createConfigProductAttributeOptionThree.option[store_labels][1][label]$$"/> <argument name="price" value="{{virtualProductWithRequiredFields.price}}"/> </actionGroup> - <actionGroup ref="addUniquePriceToConfigurableProductOption" stepKey="addPriceToConfigurableProductOptionFour"> + <actionGroup ref="AddUniquePriceToConfigurableProductOptionActionGroup" stepKey="addPriceToConfigurableProductOptionFour"> <argument name="frontend_label" value="$$createSecondConfigProductAttribute.default_frontend_label$$"/> <argument name="label" value="$$createConfigProductAttributeOptionFour.option[store_labels][1][label]$$"/> <argument name="price" value="{{virtualProductWithRequiredFields.price}}"/> @@ -127,7 +127,7 @@ <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton4"/> <!-- Save product --> - <actionGroup ref="saveConfigurableProductAddToCurrentAttributeSet" stepKey="saveProduct"/> + <actionGroup ref="SaveConfigurableProductAddToCurrentAttributeSetActionGroup" stepKey="saveProduct"/> <!--Run re-index task--> <magentoCLI command="indexer:reindex" stepKey="reindex"/> @@ -135,7 +135,7 @@ <!-- Assert configurable product in category --> <amOnPage url="$$createCategory.name$$.html" stepKey="amOnCategoryPage"/> <waitForPageLoad stepKey="waitForCategoryPageLoad"/> - <actionGroup ref="StorefrontCheckCategoryConfigurableProduct" stepKey="assertConfigurableProductInCategory"> + <actionGroup ref="StorefrontCheckCategoryConfigurableProductActionGroup" stepKey="assertConfigurableProductInCategory"> <argument name="product" value="ApiConfigurableProduct"/> <argument name="optionProduct" value="virtualProductWithRequiredFields"/> </actionGroup> @@ -148,12 +148,12 @@ </actionGroup> <!-- Assert product options images in storefront product page --> - <actionGroup ref="assertOptionImageInStorefrontProductPage" stepKey="assertFirstOptionImageInStorefrontProductPage"> + <actionGroup ref="AssertOptionImageInStorefrontProductPageActionGroup" stepKey="assertFirstOptionImageInStorefrontProductPage"> <argument name="product" value="ApiConfigurableProduct"/> <argument name="label" value="$$createConfigProductAttributeOptionOne.option[store_labels][1][label]$$"/> <argument name="image" value="MagentoLogo"/> </actionGroup> - <actionGroup ref="assertOptionImageInStorefrontProductPage" stepKey="assertSecondOptionImageInStorefrontProductPage"> + <actionGroup ref="AssertOptionImageInStorefrontProductPageActionGroup" stepKey="assertSecondOptionImageInStorefrontProductPage"> <argument name="product" value="ApiConfigurableProduct"/> <argument name="label" value="$$createConfigProductAttributeOptionTwo.option[store_labels][1][label]$$"/> <argument name="image" value="TestImageNew"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDisplayOutOfStockProductsTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDisplayOutOfStockProductsTest.xml index 308e256543736..07d4f6cdabcf2 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDisplayOutOfStockProductsTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDisplayOutOfStockProductsTest.xml @@ -92,7 +92,7 @@ </actionGroup> <!-- Create product configurations and add attribute and select all options --> - <actionGroup ref="generateConfigurationsByAttributeCode" stepKey="generateConfigurationsByAttributeCode" after="fillConfigurableProductValues"> + <actionGroup ref="GenerateConfigurationsByAttributeCodeActionGroup" stepKey="generateConfigurationsByAttributeCode" after="fillConfigurableProductValues"> <argument name="attributeCode" value="$$createConfigProductAttribute.attribute_code$$"/> </actionGroup> @@ -100,17 +100,17 @@ <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[$$createCategory.name$$]" stepKey="fillCategory" after="fillConfigurableProductValues"/> <!-- Add child products to configurations grid --> - <actionGroup ref="addProductToConfigurationsGrid" stepKey="addFirstSimpleProduct"> + <actionGroup ref="AddProductToConfigurationsGridActionGroup" stepKey="addFirstSimpleProduct"> <argument name="sku" value="$$createFirstSimpleProduct.sku$$"/> <argument name="name" value="$$createConfigProductAttributeOptionOne.option[store_labels][1][label]$$"/> </actionGroup> - <actionGroup ref="addProductToConfigurationsGrid" stepKey="addSecondSimpleProduct"> + <actionGroup ref="AddProductToConfigurationsGridActionGroup" stepKey="addSecondSimpleProduct"> <argument name="sku" value="$$createSecondSimpleProduct.sku$$"/> <argument name="name" value="$$createConfigProductAttributeOptionTwo.option[store_labels][1][label]$$"/> </actionGroup> - <actionGroup ref="addProductToConfigurationsGrid" stepKey="addOutOfStockProduct"> + <actionGroup ref="AddProductToConfigurationsGridActionGroup" stepKey="addOutOfStockProduct"> <argument name="sku" value="$$createSimpleOutOfStockProduct.sku$$"/> <argument name="name" value="$$createConfigProductAttributeOptionThree.option[store_labels][1][label]$$"/> </actionGroup> @@ -127,7 +127,7 @@ <!--Assert configurable product in category --> <amOnPage url="$$createCategory.name$$.html" stepKey="amOnCategoryPage"/> <waitForPageLoad stepKey="waitForCategoryPageLoad"/> - <actionGroup ref="StorefrontCheckCategoryConfigurableProduct" stepKey="assertConfigurableProductInCategory"> + <actionGroup ref="StorefrontCheckCategoryConfigurableProductActionGroup" stepKey="assertConfigurableProductInCategory"> <argument name="product" value="ApiConfigurableProduct"/> <argument name="optionProduct" value="$$createFirstSimpleProduct$$"/> </actionGroup> @@ -137,4 +137,4 @@ <waitForPageLoad stepKey="waitForProductPageLoad"/> <see userInput="$$createConfigProductAttributeOptionThree.option[store_labels][1][label]$$" selector="{{StorefrontProductInfoMainSection.optionByAttributeId($$createConfigProductAttribute.attribute_id$$)}}" stepKey="assertOptionNotAvailable" /> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDontDisplayOutOfStockProductsTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDontDisplayOutOfStockProductsTest.xml index e24ac07c30d1e..514ad6ea6f675 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDontDisplayOutOfStockProductsTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDontDisplayOutOfStockProductsTest.xml @@ -89,7 +89,7 @@ </actionGroup> <!-- Create product configurations and add attribute and select all options --> - <actionGroup ref="generateConfigurationsByAttributeCode" stepKey="generateConfigurationsByAttributeCode" after="fillConfigurableProductValues"> + <actionGroup ref="GenerateConfigurationsByAttributeCodeActionGroup" stepKey="generateConfigurationsByAttributeCode" after="fillConfigurableProductValues"> <argument name="attributeCode" value="$$createConfigProductAttribute.attribute_code$$"/> </actionGroup> @@ -97,17 +97,17 @@ <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[$$createCategory.name$$]" stepKey="fillCategory" after="fillConfigurableProductValues"/> <!-- Add child products to configurations grid --> - <actionGroup ref="addProductToConfigurationsGrid" stepKey="addFirstSimpleProduct"> + <actionGroup ref="AddProductToConfigurationsGridActionGroup" stepKey="addFirstSimpleProduct"> <argument name="sku" value="$$createFirstSimpleProduct.sku$$"/> <argument name="name" value="$$createConfigProductAttributeOptionOne.option[store_labels][1][label]$$"/> </actionGroup> - <actionGroup ref="addProductToConfigurationsGrid" stepKey="addSecondSimpleProduct"> + <actionGroup ref="AddProductToConfigurationsGridActionGroup" stepKey="addSecondSimpleProduct"> <argument name="sku" value="$$createSecondSimpleProduct.sku$$"/> <argument name="name" value="$$createConfigProductAttributeOptionTwo.option[store_labels][1][label]$$"/> </actionGroup> - <actionGroup ref="addProductToConfigurationsGrid" stepKey="addOutOfStockProduct"> + <actionGroup ref="AddProductToConfigurationsGridActionGroup" stepKey="addOutOfStockProduct"> <argument name="sku" value="$$createSimpleOutOfStockProduct.sku$$"/> <argument name="name" value="$createConfigProductAttributeOptionThree.option[store_labels][1][label]$$"/> </actionGroup> @@ -121,7 +121,7 @@ <!--Assert configurable product in category --> <amOnPage url="$$createCategory.name$$.html" stepKey="amOnCategoryPage"/> <waitForPageLoad stepKey="waitForCategoryPageLoad"/> - <actionGroup ref="StorefrontCheckCategoryConfigurableProduct" stepKey="assertConfigurableProductInCategory"> + <actionGroup ref="StorefrontCheckCategoryConfigurableProductActionGroup" stepKey="assertConfigurableProductInCategory"> <argument name="product" value="ApiConfigurableProduct"/> <argument name="optionProduct" value="$$createFirstSimpleProduct$$"/> </actionGroup> @@ -131,4 +131,4 @@ <waitForPageLoad stepKey="waitForPageLoad"/> <dontSee userInput="$$createConfigProductAttributeOptionThree.option[store_labels][1][label]$$" selector="{{StorefrontProductInfoMainSection.optionByAttributeId($$createConfigProductAttribute.attribute_id$$)}}" stepKey="assertOptionNotAvailable"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTierPriceForOneItemTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTierPriceForOneItemTest.xml index 51f4bf0279942..f4ce226960ca2 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTierPriceForOneItemTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTierPriceForOneItemTest.xml @@ -80,17 +80,17 @@ </actionGroup> <!-- Create product configurations and add attribute and select all options --> - <actionGroup ref="generateConfigurationsByAttributeCode" stepKey="generateConfigurationsByAttributeCode" after="fillConfigurableProductValues"> + <actionGroup ref="GenerateConfigurationsByAttributeCodeActionGroup" stepKey="generateConfigurationsByAttributeCode" after="fillConfigurableProductValues"> <argument name="attributeCode" value="$$createConfigProductAttribute.attribute_code$$"/> </actionGroup> <!-- Add associated products to configurations grid --> - <actionGroup ref="addProductToConfigurationsGrid" stepKey="addFirstSimpleProduct"> + <actionGroup ref="AddProductToConfigurationsGridActionGroup" stepKey="addFirstSimpleProduct"> <argument name="sku" value="$$createFirstSimpleProduct.sku$$"/> <argument name="name" value="$$createConfigProductAttributeOptionOne.option[store_labels][1][label]$$"/> </actionGroup> - <actionGroup ref="addProductToConfigurationsGrid" stepKey="addSecondSimpleProduct"> + <actionGroup ref="AddProductToConfigurationsGridActionGroup" stepKey="addSecondSimpleProduct"> <argument name="sku" value="$$createSecondSimpleProduct.sku$$"/> <argument name="name" value="$$createConfigProductAttributeOptionTwo.option[store_labels][1][label]$$"/> </actionGroup> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTwoOptionsAssignedToCategoryTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTwoOptionsAssignedToCategoryTest.xml index 1db9b3e5b79b2..bdf3e49aa466c 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTwoOptionsAssignedToCategoryTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTwoOptionsAssignedToCategoryTest.xml @@ -72,14 +72,14 @@ <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.createNewAttribute}}" time="30" stepKey="waitForConfigurationModalOpen" after="clickCreateConfigurations"/> <!--Create new attribute with two options --> - <actionGroup ref="addNewProductConfigurationAttribute" stepKey="createProductConfigurationAttribute"> + <actionGroup ref="AddNewProductConfigurationAttributeActionGroup" stepKey="createProductConfigurationAttribute"> <argument name="attribute" value="colorProductAttribute"/> <argument name="firstOption" value="colorConfigurableProductAttribute1"/> <argument name="secondOption" value="colorConfigurableProductAttribute2"/> </actionGroup> <!-- Change product configurations in grid --> - <actionGroup ref="changeProductConfigurationsInGrid" stepKey="changeProductConfigurationsInGrid"> + <actionGroup ref="ChangeProductConfigurationsInGridActionGroup" stepKey="changeProductConfigurationsInGrid"> <argument name="firstOption" value="colorConfigurableProductAttribute1"/> <argument name="secondOption" value="colorConfigurableProductAttribute2"/> </actionGroup> @@ -88,7 +88,7 @@ <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[$$createCategory.name$$]" stepKey="fillCategory" after="fillConfigurableProductValues"/> <!-- Save configurable product; add product to new attribute set --> - <actionGroup ref="saveConfigurableProductWithNewAttributeSet" stepKey="saveConfigurableProduct"/> + <actionGroup ref="SaveConfigurableProductWithNewAttributeSetActionGroup" stepKey="saveConfigurableProduct"/> <!-- Assert child products in grid --> <actionGroup ref="viewProductInAdminGrid" stepKey="viewFirstChildProductInAdminGrid"> @@ -111,7 +111,7 @@ <!--Assert configurable product in category --> <amOnPage url="$$createCategory.name$$.html" stepKey="amOnCategoryPage"/> <waitForPageLoad stepKey="waitForCategoryPageLoad"/> - <actionGroup ref="StorefrontCheckCategoryConfigurableProduct" stepKey="assertConfigurableProductInCategory"> + <actionGroup ref="StorefrontCheckCategoryConfigurableProductActionGroup" stepKey="assertConfigurableProductInCategory"> <argument name="product" value="ApiConfigurableProduct"/> <argument name="optionProduct" value="colorConfigurableProductAttribute1"/> </actionGroup> @@ -119,7 +119,7 @@ <!--Assert configurable product on product page --> <amOnPage url="{{ApiConfigurableProduct.urlKey}}.html" stepKey="amOnProductPage" after="assertConfigurableProductInCategory"/> <waitForPageLoad stepKey="waitForProductPageLoad"/> - <actionGroup ref="storefrontCheckConfigurableProductOptions" stepKey="checkConfigurableProductOptions"> + <actionGroup ref="StorefrontCheckConfigurableProductOptionsActionGroup" stepKey="checkConfigurableProductOptions"> <argument name="product" value="ApiConfigurableProduct"/> <argument name="firstOption" value="colorConfigurableProductAttribute1"/> <argument name="secondOption" value="colorConfigurableProductAttribute2"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTwoOptionsWithoutAssignedToCategoryTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTwoOptionsWithoutAssignedToCategoryTest.xml index 934a410d58a8a..f3c56184bc956 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTwoOptionsWithoutAssignedToCategoryTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTwoOptionsWithoutAssignedToCategoryTest.xml @@ -65,20 +65,20 @@ <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.createNewAttribute}}" time="30" stepKey="waitForConfigurationModalOpen" after="clickCreateConfigurations"/> <!--Create new attribute with two option --> - <actionGroup ref="addNewProductConfigurationAttribute" stepKey="createProductConfigurationAttribute"> + <actionGroup ref="AddNewProductConfigurationAttributeActionGroup" stepKey="createProductConfigurationAttribute"> <argument name="attribute" value="colorProductAttribute"/> <argument name="firstOption" value="colorConfigurableProductAttribute1"/> <argument name="secondOption" value="colorConfigurableProductAttribute2"/> </actionGroup> <!-- Change product configurations in grid --> - <actionGroup ref="changeProductConfigurationsInGrid" stepKey="changeProductConfigurationsInGrid"> + <actionGroup ref="ChangeProductConfigurationsInGridActionGroup" stepKey="changeProductConfigurationsInGrid"> <argument name="firstOption" value="colorConfigurableProductAttribute1"/> <argument name="secondOption" value="colorConfigurableProductAttribute2"/> </actionGroup> <!-- Save configurable product; add product to new attribute set --> - <actionGroup ref="saveConfigurableProductWithNewAttributeSet" stepKey="saveConfigurableProduct"/> + <actionGroup ref="SaveConfigurableProductWithNewAttributeSetActionGroup" stepKey="saveConfigurableProduct"/> <!-- Assert Child Products in grid --> <actionGroup ref="viewProductInAdminGrid" stepKey="viewFirstChildProductInAdminGrid"> @@ -101,7 +101,7 @@ <!-- Assert configurable product on product page --> <amOnPage url="{{ApiConfigurableProduct.urlKey}}.html" stepKey="amOnProductPage"/> <waitForPageLoad stepKey="waitForProductPageLoad"/> - <actionGroup ref="storefrontCheckConfigurableProductOptions" stepKey="checkConfigurableProductOptions"> + <actionGroup ref="StorefrontCheckConfigurableProductOptionsActionGroup" stepKey="checkConfigurableProductOptions"> <argument name="product" value="ApiConfigurableProduct"/> <argument name="firstOption" value="colorConfigurableProductAttribute1"/> <argument name="secondOption" value="colorConfigurableProductAttribute2"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml index fa21d20eb4456..f3d9eef42458e 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml @@ -49,10 +49,10 @@ <comment userInput="Add configurations to product" stepKey="commentAddConfigs"/> <amOnPage url="{{AdminProductEditPage.url($$createProduct.id$$)}}" stepKey="gotToSimpleProductPage"/> <waitForPageLoad stepKey="waitForSimpleProductPageLoad"/> - <actionGroup ref="generateConfigurationsByAttributeCode" stepKey="setupConfigurations"> + <actionGroup ref="GenerateConfigurationsByAttributeCodeActionGroup" stepKey="setupConfigurations"> <argument name="attributeCode" value="$$createConfigProductAttribute.attribute_code$$"/> </actionGroup> - <actionGroup ref="saveConfiguredProduct" stepKey="saveConfigProductForm"/> + <actionGroup ref="SaveConfiguredProductActionGroup" stepKey="saveConfigProductForm"/> <!--Assert configurable product on Admin product page grid--> <comment userInput="Assert configurable product in Admin product page grid" stepKey="commentAssertConfigProductOnAdmin"/> <amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="goToCatalogProductPage"/> @@ -154,10 +154,10 @@ <amOnPage url="{{AdminProductEditPage.url($$createProduct.id$$)}}" stepKey="gotToConfigProductPage"/> <waitForPageLoad stepKey="waitForConfigurableProductPageLoad"/> <selectOption selector="{{AdminProductFormSection.productWeightSelect}}" userInput="This item has weight" stepKey="selectWeightForConfigurableProduct"/> - <actionGroup ref="generateConfigurationsByAttributeCode" stepKey="setupConfigurationsForProduct"> + <actionGroup ref="GenerateConfigurationsByAttributeCodeActionGroup" stepKey="setupConfigurationsForProduct"> <argument name="attributeCode" value="$$createConfigProductAttribute.attribute_code$$"/> </actionGroup> - <actionGroup ref="saveConfiguredProduct" stepKey="saveNewConfigurableProductForm"/> + <actionGroup ref="SaveConfiguredProductActionGroup" stepKey="saveNewConfigurableProductForm"/> <!--Assert configurable product on Admin product page grid--> <comment userInput="Assert configurable product in Admin product page grid" stepKey="commentAssertConfigurableProductOnAdmin"/> <amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="goToCatalogProductPageForConfigurable"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ConfigurableProductAttributeNameDesignTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ConfigurableProductAttributeNameDesignTest.xml index 7fbff5eac2583..bb16d04dfc94a 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ConfigurableProductAttributeNameDesignTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ConfigurableProductAttributeNameDesignTest.xml @@ -26,16 +26,16 @@ <!-- Navigate to Catalog-> Products --> - <actionGroup ref="GotoCatalogProductsPage" stepKey="goToCatalogProductsPage"/> + <actionGroup ref="GotoCatalogProductsPageActionGroup" stepKey="goToCatalogProductsPage"/> <!-- Fill the fields on Configurable Product--> - <actionGroup ref="GotoConfigurableProductPage" stepKey="goToConfigurableProductPage"/> - <actionGroup ref="FillAllRequiredFields" stepKey="fillInAllRequiredFields"/> + <actionGroup ref="GotoConfigurableProductPageActionGroup" stepKey="goToConfigurableProductPage"/> + <actionGroup ref="FillAllRequiredFieldsActionGroup" stepKey="fillInAllRequiredFields"/> <!-- Create New Attribute (Default Label= design) --> - <actionGroup ref="CreateNewAttribute" stepKey="createNewAttribute"/> + <actionGroup ref="CreateNewAttributeActionGroup" stepKey="createNewAttribute"/> <after> <!-- Delete Created Attribute --> - <actionGroup ref="DeleteCreatedAttribute" stepKey="deleteCreatedAttribute"/> + <actionGroup ref="DeleteCreatedAttributeActionGroup" stepKey="deleteCreatedAttribute"/> </after> </test> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/EndToEndB2CAdminTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/EndToEndB2CAdminTest.xml index 6bbb97c66cdd8..3135393bd502b 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/EndToEndB2CAdminTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/EndToEndB2CAdminTest.xml @@ -63,7 +63,7 @@ <waitForElementVisible selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" time="30" stepKey="waitForAttributeSetConfirmation" after="clickSaveConfigurableProduct"/> <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickConfirmAttributeSet" after="waitForAttributeSetConfirmation"/> <see selector="You saved the product" stepKey="seeConfigurableSaveConfirmation" after="clickConfirmAttributeSet"/> - <actionGroup ref="viewConfigurableProductInAdminGrid" stepKey="viewConfigurableProductInGrid" after="seeConfigurableSaveConfirmation"> + <actionGroup ref="ViewConfigurableProductInAdminGridActionGroup" stepKey="viewConfigurableProductInGrid" after="seeConfigurableSaveConfirmation"> <argument name="product" value="BaseConfigurableProduct"/> </actionGroup> @@ -73,4 +73,4 @@ <argument name="product" value="BaseConfigurableProduct"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/EndToEndB2CGuestUserTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/EndToEndB2CGuestUserTest.xml index 04687a2314dc6..59bb7f53f0aa8 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/EndToEndB2CGuestUserTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/EndToEndB2CGuestUserTest.xml @@ -85,7 +85,7 @@ <!-- Check configurable product in category --> <comment userInput="Verify Configurable Product in category" stepKey="commentVerifyConfigurableProductInCategory" after="browseAssertSimpleProduct2ImageNotDefault" /> - <actionGroup ref="StorefrontCheckCategoryConfigurableProduct" stepKey="browseAssertCategoryConfigProduct" after="commentVerifyConfigurableProductInCategory"> + <actionGroup ref="StorefrontCheckCategoryConfigurableProductActionGroup" stepKey="browseAssertCategoryConfigProduct" after="commentVerifyConfigurableProductInCategory"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="optionProduct" value="$$createConfigChildProduct1$$"/> </actionGroup> @@ -98,7 +98,7 @@ <click selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="clickCategory2" after="commentViewConfigurableProduct"/> <click selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createConfigProduct.name$$)}}" stepKey="browseClickCategoryConfigProductView" after="clickCategory2"/> <waitForLoadingMaskToDisappear stepKey="waitForConfigurableProductViewloaded" after="browseClickCategoryConfigProductView"/> - <actionGroup ref="StorefrontCheckConfigurableProduct" stepKey="browseAssertConfigProductPage" after="waitForConfigurableProductViewloaded"> + <actionGroup ref="StorefrontCheckConfigurableProductActionGroup" stepKey="browseAssertConfigProductPage" after="waitForConfigurableProductViewloaded"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="optionProduct" value="$$createConfigChildProduct1$$"/> </actionGroup> @@ -114,7 +114,7 @@ <argument name="category" value="$$createCategory$$"/> <argument name="productCount" value="3"/> </actionGroup> - <actionGroup ref="StorefrontCheckCategoryConfigurableProduct" stepKey="cartAssertConfigProduct" after="cartAssertCategory1ForConfigurableProduct"> + <actionGroup ref="StorefrontCheckCategoryConfigurableProductActionGroup" stepKey="cartAssertConfigProduct" after="cartAssertCategory1ForConfigurableProduct"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="optionProduct" value="$$createConfigChildProduct1$$"/> </actionGroup> @@ -123,7 +123,7 @@ <assertNotRegExp expected="'/placeholder\/small_image\.jpg/'" actual="$cartGrabConfigProductImageSrc" stepKey="cartAssertConfigProductImageNotDefault" after="cartGrabConfigProductImageSrc"/> <click selector="{{StorefrontCategoryProductSection.ProductAddToCartByName($$createConfigProduct.name$$)}}" stepKey="cartClickCategoryConfigProductAddToCart" after="cartAssertConfigProductImageNotDefault"/> <waitForElement selector="{{StorefrontMessagesSection.message('You need to choose options for your item.')}}" time="30" stepKey="cartWaitForConfigProductPageLoad" after="cartClickCategoryConfigProductAddToCart"/> - <actionGroup ref="StorefrontCheckConfigurableProduct" stepKey="cartAssertConfigProductPage" after="cartWaitForConfigProductPageLoad"> + <actionGroup ref="StorefrontCheckConfigurableProductActionGroup" stepKey="cartAssertConfigProductPage" after="cartWaitForConfigProductPageLoad"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="optionProduct" value="$$createConfigChildProduct1$$"/> </actionGroup> @@ -132,7 +132,7 @@ <assertNotRegExp expected="'/placeholder\/image\.jpg/'" actual="$cartGrabConfigProductPageImageSrc1" stepKey="cartAssertConfigProductPageImageNotDefault1" after="cartGrabConfigProductPageImageSrc1"/> <selectOption userInput="$$createConfigProductAttributeOption2.option[store_labels][1][label]$$" selector="{{StorefrontProductInfoMainSection.optionByAttributeId($$createConfigProductAttribute.attribute_id$$)}}" stepKey="cartConfigProductFillOption" after="cartAssertConfigProductPageImageNotDefault1"/> <waitForLoadingMaskToDisappear stepKey="waitForConfigurableProductOptionloaded" after="cartConfigProductFillOption"/> - <actionGroup ref="StorefrontCheckConfigurableProduct" stepKey="cartAssertConfigProductWithOptionPage" after="waitForConfigurableProductOptionloaded"> + <actionGroup ref="StorefrontCheckConfigurableProductActionGroup" stepKey="cartAssertConfigProductWithOptionPage" after="waitForConfigurableProductOptionloaded"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="optionProduct" value="$$createConfigChildProduct2$$"/> </actionGroup> @@ -157,7 +157,7 @@ <see userInput="$$createConfigProductAttributeOption2.option[store_labels][1][label]$$" selector="{{StorefrontMinicartSection.productOptionByNameAndAttribute($$createConfigProduct.name$$, $$createConfigProductAttribute.attribute[frontend_labels][0][label]$$)}}" stepKey="cartMinicartCheckConfigProductOption" after="cartMinicartClickConfigProductDetails"/> <click selector="{{StorefrontMinicartSection.productLinkByName($$createConfigProduct.name$$)}}" stepKey="cartMinicartClickConfigProduct" after="cartMinicartCheckConfigProductOption"/> <waitForLoadingMaskToDisappear stepKey="waitForMinicartConfigProductloaded" after="cartMinicartClickConfigProduct"/> - <actionGroup ref="StorefrontCheckConfigurableProduct" stepKey="cartAssertMinicartConfigProductPage" after="waitForMinicartConfigProductloaded"> + <actionGroup ref="StorefrontCheckConfigurableProductActionGroup" stepKey="cartAssertMinicartConfigProductPage" after="waitForMinicartConfigProductloaded"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="optionProduct" value="$$createConfigChildProduct1$$"/> </actionGroup> @@ -180,7 +180,7 @@ <see userInput="$$createConfigProductAttributeOption2.option[store_labels][1][label]$$" selector="{{CheckoutCartProductSection.ProductOptionByNameAndAttribute($$createConfigProduct.name$$, $$createConfigProductAttribute.attribute[frontend_labels][0][label]$$)}}" stepKey="cartCheckConfigProductOption" after="cartCartAssertConfigProduct2ImageNotDefault"/> <click selector="{{CheckoutCartProductSection.ProductLinkByName($$createConfigProduct.name$$)}}" stepKey="cartClickCartConfigProduct" after="cartCheckConfigProductOption"/> <waitForLoadingMaskToDisappear stepKey="waitForCartConfigProductloaded" after="cartClickCartConfigProduct"/> - <actionGroup ref="StorefrontCheckConfigurableProduct" stepKey="cartAssertCartConfigProductPage" after="waitForCartConfigProductloaded"> + <actionGroup ref="StorefrontCheckConfigurableProductActionGroup" stepKey="cartAssertCartConfigProductPage" after="waitForCartConfigProductloaded"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="optionProduct" value="$$createConfigChildProduct1$$"/> </actionGroup> @@ -190,7 +190,7 @@ <!-- Add Configurable Product to comparison --> <comment userInput="Add Configurable Product to comparison" stepKey="commentAddConfigurableProductToComparison" after="compareAddSimpleProduct2ToCompare" /> - <actionGroup ref="StorefrontCheckCategoryConfigurableProduct" stepKey="compareAssertConfigProduct" after="commentAddConfigurableProductToComparison"> + <actionGroup ref="StorefrontCheckCategoryConfigurableProductActionGroup" stepKey="compareAssertConfigProduct" after="commentAddConfigurableProductToComparison"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="optionProduct" value="$$createConfigChildProduct1$$"/> </actionGroup> @@ -294,7 +294,7 @@ <!-- Check configurable product in category --> <comment userInput="Verify Configurable Product in category" stepKey="commentVerifyConfigurableProductInCategory" after="browseAssertSimpleProduct2ImageNotDefault" /> - <actionGroup ref="StorefrontCheckCategoryConfigurableProduct" stepKey="browseAssertCategoryConfigProduct" after="commentVerifyConfigurableProductInCategory"> + <actionGroup ref="StorefrontCheckCategoryConfigurableProductActionGroup" stepKey="browseAssertCategoryConfigProduct" after="commentVerifyConfigurableProductInCategory"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="optionProduct" value="$$createConfigChildProduct1$$"/> </actionGroup> @@ -307,7 +307,7 @@ <click selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="clickCategory2" after="commentViewConfigurableProduct"/> <click selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createConfigProduct.name$$)}}" stepKey="browseClickCategoryConfigProductView" after="clickCategory2"/> <waitForLoadingMaskToDisappear stepKey="waitForConfigurableProductViewloaded" after="browseClickCategoryConfigProductView"/> - <actionGroup ref="StorefrontCheckConfigurableProduct" stepKey="browseAssertConfigProductPage" after="waitForConfigurableProductViewloaded"> + <actionGroup ref="StorefrontCheckConfigurableProductActionGroup" stepKey="browseAssertConfigProductPage" after="waitForConfigurableProductViewloaded"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="optionProduct" value="$$createConfigChildProduct1$$"/> </actionGroup> @@ -323,7 +323,7 @@ <argument name="category" value="$$createCategory$$"/> <argument name="productCount" value="3"/> </actionGroup> - <actionGroup ref="StorefrontCheckCategoryConfigurableProduct" stepKey="cartAssertConfigProduct" after="cartAssertCategory1ForConfigurableProduct"> + <actionGroup ref="StorefrontCheckCategoryConfigurableProductActionGroup" stepKey="cartAssertConfigProduct" after="cartAssertCategory1ForConfigurableProduct"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="optionProduct" value="$$createConfigChildProduct1$$"/> </actionGroup> @@ -332,7 +332,7 @@ <assertNotRegExp expected="'/placeholder\/small_image\.jpg/'" actual="$cartGrabConfigProductImageSrc" stepKey="cartAssertConfigProductImageNotDefault" after="cartGrabConfigProductImageSrc"/> <click selector="{{StorefrontCategoryProductSection.ProductAddToCartByName($$createConfigProduct.name$$)}}" stepKey="cartClickCategoryConfigProductAddToCart" after="cartAssertConfigProductImageNotDefault"/> <waitForElement selector="{{StorefrontMessagesSection.message('You need to choose options for your item.')}}" time="30" stepKey="cartWaitForConfigProductPageLoad" after="cartClickCategoryConfigProductAddToCart"/> - <actionGroup ref="StorefrontCheckConfigurableProduct" stepKey="cartAssertConfigProductPage" after="cartWaitForConfigProductPageLoad"> + <actionGroup ref="StorefrontCheckConfigurableProductActionGroup" stepKey="cartAssertConfigProductPage" after="cartWaitForConfigProductPageLoad"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="optionProduct" value="$$createConfigChildProduct1$$"/> </actionGroup> @@ -341,7 +341,7 @@ <assertNotRegExp expected="'/placeholder\/image\.jpg/'" actual="$cartGrabConfigProductPageImageSrc1" stepKey="cartAssertConfigProductPageImageNotDefault1" after="cartGrabConfigProductPageImageSrc1"/> <selectOption userInput="$$createConfigProductAttributeOption2.option[store_labels][1][label]$$" selector="{{StorefrontProductInfoMainSection.optionByAttributeId($$createConfigProductAttribute.attribute_id$$)}}" stepKey="cartConfigProductFillOption" after="cartAssertConfigProductPageImageNotDefault1"/> <waitForLoadingMaskToDisappear stepKey="waitForConfigurableProductOptionloaded" after="cartConfigProductFillOption"/> - <actionGroup ref="StorefrontCheckConfigurableProduct" stepKey="cartAssertConfigProductWithOptionPage" after="waitForConfigurableProductOptionloaded"> + <actionGroup ref="StorefrontCheckConfigurableProductActionGroup" stepKey="cartAssertConfigProductWithOptionPage" after="waitForConfigurableProductOptionloaded"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="optionProduct" value="$$createConfigChildProduct2$$"/> </actionGroup> @@ -366,7 +366,7 @@ <see userInput="$$createConfigProductAttributeOption2.option[store_labels][1][label]$$" selector="{{StorefrontMinicartSection.productOptionByNameAndAttribute($$createConfigProduct.name$$, $$createConfigProductAttribute.attribute[frontend_labels][0][label]$$)}}" stepKey="cartMinicartCheckConfigProductOption" after="cartMinicartClickConfigProductDetails"/> <click selector="{{StorefrontMinicartSection.productLinkByName($$createConfigProduct.name$$)}}" stepKey="cartMinicartClickConfigProduct" after="cartMinicartCheckConfigProductOption"/> <waitForLoadingMaskToDisappear stepKey="waitForMinicartConfigProductloaded" after="cartMinicartClickConfigProduct"/> - <actionGroup ref="StorefrontCheckConfigurableProduct" stepKey="cartAssertMinicartConfigProductPage" after="waitForMinicartConfigProductloaded"> + <actionGroup ref="StorefrontCheckConfigurableProductActionGroup" stepKey="cartAssertMinicartConfigProductPage" after="waitForMinicartConfigProductloaded"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="optionProduct" value="$$createConfigChildProduct1$$"/> </actionGroup> @@ -389,7 +389,7 @@ <see userInput="$$createConfigProductAttributeOption2.option[store_labels][1][label]$$" selector="{{CheckoutCartProductSection.ProductOptionByNameAndAttribute($$createConfigProduct.name$$, $$createConfigProductAttribute.attribute[frontend_labels][0][label]$$)}}" stepKey="cartCheckConfigProductOption" after="cartCartAssertConfigProduct2ImageNotDefault"/> <click selector="{{CheckoutCartProductSection.ProductLinkByName($$createConfigProduct.name$$)}}" stepKey="cartClickCartConfigProduct" after="cartCheckConfigProductOption"/> <waitForLoadingMaskToDisappear stepKey="waitForCartConfigProductloaded" after="cartClickCartConfigProduct"/> - <actionGroup ref="StorefrontCheckConfigurableProduct" stepKey="cartAssertCartConfigProductPage" after="waitForCartConfigProductloaded"> + <actionGroup ref="StorefrontCheckConfigurableProductActionGroup" stepKey="cartAssertCartConfigProductPage" after="waitForCartConfigProductloaded"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="optionProduct" value="$$createConfigChildProduct1$$"/> </actionGroup> @@ -399,7 +399,7 @@ <!-- Add Configurable Product to comparison --> <comment userInput="Add Configurable Product to comparison" stepKey="commentAddConfigurableProductToComparison" after="compareAddSimpleProduct2ToCompare" /> - <actionGroup ref="StorefrontCheckCategoryConfigurableProduct" stepKey="compareAssertConfigProduct" after="commentAddConfigurableProductToComparison"> + <actionGroup ref="StorefrontCheckCategoryConfigurableProductActionGroup" stepKey="compareAssertConfigProduct" after="commentAddConfigurableProductToComparison"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="optionProduct" value="$$createConfigChildProduct1$$"/> </actionGroup> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml index 6f9ad93a56dc5..dd0673563838e 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml @@ -85,7 +85,7 @@ <!-- Check configurable product in category --> <comment userInput="Verify Configurable Product in category" stepKey="commentVerifyConfigurableProductInCategory" after="browseAssertSimpleProduct2ImageNotDefault" /> - <actionGroup ref="StorefrontCheckCategoryConfigurableProduct" stepKey="browseAssertCategoryConfigProduct" after="commentVerifyConfigurableProductInCategory"> + <actionGroup ref="StorefrontCheckCategoryConfigurableProductActionGroup" stepKey="browseAssertCategoryConfigProduct" after="commentVerifyConfigurableProductInCategory"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="optionProduct" value="$$createConfigChildProduct1$$"/> </actionGroup> @@ -98,7 +98,7 @@ <click selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="clickCategory2" after="commentViewConfigurableProduct"/> <click selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createConfigProduct.name$$)}}" stepKey="browseClickCategoryConfigProductView" after="clickCategory2"/> <waitForLoadingMaskToDisappear stepKey="waitForConfigurableProductViewloaded" after="browseClickCategoryConfigProductView"/> - <actionGroup ref="StorefrontCheckConfigurableProduct" stepKey="browseAssertConfigProductPage" after="waitForConfigurableProductViewloaded"> + <actionGroup ref="StorefrontCheckConfigurableProductActionGroup" stepKey="browseAssertConfigProductPage" after="waitForConfigurableProductViewloaded"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="optionProduct" value="$$createConfigChildProduct1$$"/> </actionGroup> @@ -114,7 +114,7 @@ <argument name="category" value="$$createCategory$$"/> <argument name="productCount" value="3"/> </actionGroup> - <actionGroup ref="StorefrontCheckCategoryConfigurableProduct" stepKey="cartAssertConfigProduct" after="cartAssertCategory1ForConfigurableProduct"> + <actionGroup ref="StorefrontCheckCategoryConfigurableProductActionGroup" stepKey="cartAssertConfigProduct" after="cartAssertCategory1ForConfigurableProduct"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="optionProduct" value="$$createConfigChildProduct1$$"/> </actionGroup> @@ -123,7 +123,7 @@ <assertNotRegExp expected="'/placeholder\/small_image\.jpg/'" actual="$cartGrabConfigProductImageSrc" stepKey="cartAssertConfigProductImageNotDefault" after="cartGrabConfigProductImageSrc"/> <click selector="{{StorefrontCategoryProductSection.ProductAddToCartByName($$createConfigProduct.name$$)}}" stepKey="cartClickCategoryConfigProductAddToCart" after="cartAssertConfigProductImageNotDefault"/> <waitForElement selector="{{StorefrontMessagesSection.message('You need to choose options for your item.')}}" time="30" stepKey="cartWaitForConfigProductPageLoad" after="cartClickCategoryConfigProductAddToCart"/> - <actionGroup ref="StorefrontCheckConfigurableProduct" stepKey="cartAssertConfigProductPage" after="cartWaitForConfigProductPageLoad"> + <actionGroup ref="StorefrontCheckConfigurableProductActionGroup" stepKey="cartAssertConfigProductPage" after="cartWaitForConfigProductPageLoad"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="optionProduct" value="$$createConfigChildProduct1$$"/> </actionGroup> @@ -132,7 +132,7 @@ <assertNotRegExp expected="'/placeholder\/image\.jpg/'" actual="$cartGrabConfigProductPageImageSrc1" stepKey="cartAssertConfigProductPageImageNotDefault1" after="cartGrabConfigProductPageImageSrc1"/> <selectOption userInput="$$createConfigProductAttributeOption2.option[store_labels][1][label]$$" selector="{{StorefrontProductInfoMainSection.optionByAttributeId($$createConfigProductAttribute.attribute_id$$)}}" stepKey="cartConfigProductFillOption" after="cartAssertConfigProductPageImageNotDefault1"/> <waitForLoadingMaskToDisappear stepKey="waitForConfigurableProductOptionloaded" after="cartConfigProductFillOption"/> - <actionGroup ref="StorefrontCheckConfigurableProduct" stepKey="cartAssertConfigProductWithOptionPage" after="waitForConfigurableProductOptionloaded"> + <actionGroup ref="StorefrontCheckConfigurableProductActionGroup" stepKey="cartAssertConfigProductWithOptionPage" after="waitForConfigurableProductOptionloaded"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="optionProduct" value="$$createConfigChildProduct2$$"/> </actionGroup> @@ -157,7 +157,7 @@ <see userInput="$$createConfigProductAttributeOption2.option[store_labels][1][label]$$" selector="{{StorefrontMinicartSection.productOptionByNameAndAttribute($$createConfigProduct.name$$, $$createConfigProductAttribute.attribute[frontend_labels][0][label]$$)}}" stepKey="cartMinicartCheckConfigProductOption" after="cartMinicartClickConfigProductDetails"/> <click selector="{{StorefrontMinicartSection.productLinkByName($$createConfigProduct.name$$)}}" stepKey="cartMinicartClickConfigProduct" after="cartMinicartCheckConfigProductOption"/> <waitForLoadingMaskToDisappear stepKey="waitForMinicartConfigProductloaded" after="cartMinicartClickConfigProduct"/> - <actionGroup ref="StorefrontCheckConfigurableProduct" stepKey="cartAssertMinicartConfigProductPage" after="waitForMinicartConfigProductloaded"> + <actionGroup ref="StorefrontCheckConfigurableProductActionGroup" stepKey="cartAssertMinicartConfigProductPage" after="waitForMinicartConfigProductloaded"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="optionProduct" value="$$createConfigChildProduct1$$"/> </actionGroup> @@ -180,7 +180,7 @@ <see userInput="$$createConfigProductAttributeOption2.option[store_labels][1][label]$$" selector="{{CheckoutCartProductSection.ProductOptionByNameAndAttribute($$createConfigProduct.name$$, $$createConfigProductAttribute.attribute[frontend_labels][0][label]$$)}}" stepKey="cartCheckConfigProductOption" after="cartCartAssertConfigProduct2ImageNotDefault"/> <click selector="{{CheckoutCartProductSection.ProductLinkByName($$createConfigProduct.name$$)}}" stepKey="cartClickCartConfigProduct" after="cartCheckConfigProductOption"/> <waitForLoadingMaskToDisappear stepKey="waitForCartConfigProductloaded" after="cartClickCartConfigProduct"/> - <actionGroup ref="StorefrontCheckConfigurableProduct" stepKey="cartAssertCartConfigProductPage" after="waitForCartConfigProductloaded"> + <actionGroup ref="StorefrontCheckConfigurableProductActionGroup" stepKey="cartAssertCartConfigProductPage" after="waitForCartConfigProductloaded"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="optionProduct" value="$$createConfigChildProduct1$$"/> </actionGroup> @@ -190,7 +190,7 @@ <!-- Add Configurable Product to comparison --> <comment userInput="Add Configurable Product to comparison" stepKey="commentAddConfigurableProductToComparison" after="compareAddSimpleProduct2ToCompare" /> - <actionGroup ref="StorefrontCheckCategoryConfigurableProduct" stepKey="compareAssertConfigProduct" after="commentAddConfigurableProductToComparison"> + <actionGroup ref="StorefrontCheckCategoryConfigurableProductActionGroup" stepKey="compareAssertConfigProduct" after="commentAddConfigurableProductToComparison"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="optionProduct" value="$$createConfigChildProduct1$$"/> </actionGroup> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest.xml index 2f5ee036b1420..632e066456c4c 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest.xml @@ -24,7 +24,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <!-- Create a configurable product via the UI --> - <actionGroup ref="createConfigurableProduct" stepKey="createProduct"> + <actionGroup ref="CreateConfigurableProductActionGroup" stepKey="createProduct"> <argument name="product" value="_defaultProduct"/> <argument name="category" value="$$createCategory$$"/> </actionGroup> @@ -69,7 +69,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <!-- Create a configurable product via the UI --> - <actionGroup ref="createConfigurableProduct" stepKey="createProduct"> + <actionGroup ref="CreateConfigurableProductActionGroup" stepKey="createProduct"> <argument name="product" value="_defaultProduct"/> <argument name="category" value="$$createCategory$$"/> </actionGroup> @@ -114,7 +114,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <!-- Create a configurable product via the UI --> - <actionGroup ref="createConfigurableProduct" stepKey="createProduct"> + <actionGroup ref="CreateConfigurableProductActionGroup" stepKey="createProduct"> <argument name="product" value="_defaultProduct"/> <argument name="category" value="$$createCategory$$"/> </actionGroup> @@ -156,7 +156,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <!-- Create a configurable product via the UI --> - <actionGroup ref="createConfigurableProduct" stepKey="createProduct"> + <actionGroup ref="CreateConfigurableProductActionGroup" stepKey="createProduct"> <argument name="product" value="_defaultProduct"/> <argument name="category" value="$$createCategory$$"/> </actionGroup> @@ -269,7 +269,7 @@ <argument name="rowIndex" value="3"/> <argument name="quantity" value="1"/> </actionGroup> - <actionGroup ref="saveConfigurableProduct" stepKey="saveConfigurableProduct"> + <actionGroup ref="SaveConfigurableProductActionGroup" stepKey="saveConfigurableProduct"> <argument name="product" value="BaseConfigurableProduct"/> </actionGroup> <scrollTo selector="{{AdminProductSEOSection.sectionHeader}}" x="0" y="-80" stepKey="scrollToAdminProductSEOSection"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductViewTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductViewTest.xml index 65e1d3a74f060..5bebe900ed30d 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductViewTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductViewTest.xml @@ -23,7 +23,7 @@ <createData entity="ApiCategory" stepKey="createCategory"/> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/> <!-- Create a configurable product via the UI --> - <actionGroup ref="createConfigurableProduct" stepKey="createProduct"> + <actionGroup ref="CreateConfigurableProductActionGroup" stepKey="createProduct"> <argument name="product" value="_defaultProduct"/> <argument name="category" value="$$createCategory$$"/> </actionGroup> @@ -65,7 +65,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/> <!-- Create a configurable product via the UI --> - <actionGroup ref="createConfigurableProduct" stepKey="createProduct"> + <actionGroup ref="CreateConfigurableProductActionGroup" stepKey="createProduct"> <argument name="product" value="_defaultProduct"/> <argument name="category" value="$$createCategory$$"/> </actionGroup> @@ -103,7 +103,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/> <!-- Create a configurable product via the UI --> - <actionGroup ref="createConfigurableProduct" stepKey="createProduct"> + <actionGroup ref="CreateConfigurableProductActionGroup" stepKey="createProduct"> <argument name="product" value="_defaultProduct"/> <argument name="category" value="$$createCategory$$"/> </actionGroup> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductWithFileCustomOptionTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductWithFileCustomOptionTest.xml index 4c955f3385643..68a3dc8d437a3 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductWithFileCustomOptionTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductWithFileCustomOptionTest.xml @@ -31,14 +31,14 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <!-- Create a configurable product via the UI --> - <actionGroup ref="createConfigurableProduct" stepKey="createProduct"> + <actionGroup ref="CreateConfigurableProductActionGroup" stepKey="createProduct"> <argument name="product" value="BaseConfigurableProduct"/> <argument name="category" value="$$createCategory$$"/> </actionGroup> <!--Add custom option to configurable product--> <actionGroup ref="AddProductCustomOptionFile" stepKey="addCustomOptionToProduct"/> <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct"/> - + <!--Go to storefront--> <amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToHomePage"/> <waitForPageLoad stepKey="waitForHomePageLoad"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontVisibilityOfDuplicateProductTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontVisibilityOfDuplicateProductTest.xml index 749d1bee0661a..af612baed2052 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontVisibilityOfDuplicateProductTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontVisibilityOfDuplicateProductTest.xml @@ -64,7 +64,7 @@ <waitForPageLoad stepKey="waitForProductPageReload"/> <click selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="clickOnCreateConfigurations"/> <waitForPageLoad stepKey="waitForFilters"/> - <actionGroup ref="createOptionsForAttribute" stepKey="createOptions"> + <actionGroup ref="CreateOptionsForAttributeActionGroup" stepKey="createOptions"> <argument name="attributeName" value="{{colorProductAttribute.default_label}}"/> <argument name="firstOptionName" value="{{colorConfigurableProductAttribute1.name}}"/> <argument name="secondOptionName" value="{{colorConfigurableProductAttribute2.name}}"/> @@ -73,36 +73,36 @@ <waitForPageLoad stepKey="waitForBulkImagesPriceQuantityPageLoad"/> <!--Add images to configurable product attribute options--> <comment userInput="Add images to configurable product attribute options" stepKey="commentAddImages"/> - <actionGroup ref="addUniqueImageToConfigurableProductOption" stepKey="addImageToConfigurableProductOptionOne"> + <actionGroup ref="AddUniqueImageToConfigurableProductOptionActionGroup" stepKey="addImageToConfigurableProductOptionOne"> <argument name="image" value="ImageUpload"/> <argument name="frontend_label" value="{{colorProductAttribute.default_label}}"/> <argument name="label" value="{{colorConfigurableProductAttribute1.name}}"/> </actionGroup> - <actionGroup ref="addUniqueImageToConfigurableProductOption" stepKey="addImageToConfigurableProductOptionTwo"> + <actionGroup ref="AddUniqueImageToConfigurableProductOptionActionGroup" stepKey="addImageToConfigurableProductOptionTwo"> <argument name="image" value="ImageUpload_1"/> <argument name="frontend_label" value="{{colorProductAttribute.default_label}}"/> <argument name="label" value="{{colorConfigurableProductAttribute2.name}}"/> </actionGroup> <!--Add price to product attribute options--> <comment userInput="Add price to product attribute options" stepKey="commentAddPrice"/> - <actionGroup ref="addUniquePriceToConfigurableProductOption" stepKey="addPriceToConfigurableProductOptionFirst"> + <actionGroup ref="AddUniquePriceToConfigurableProductOptionActionGroup" stepKey="addPriceToConfigurableProductOptionFirst"> <argument name="frontend_label" value="{{colorProductAttribute.default_label}}"/> <argument name="label" value="{{colorConfigurableProductAttribute1.name}}"/> <argument name="price" value="{{virtualProductWithRequiredFields.price}}"/> </actionGroup> - <actionGroup ref="addUniquePriceToConfigurableProductOption" stepKey="addPriceToConfigurableProductOptionSecond"> + <actionGroup ref="AddUniquePriceToConfigurableProductOptionActionGroup" stepKey="addPriceToConfigurableProductOptionSecond"> <argument name="frontend_label" value="{{colorProductAttribute.default_label}}"/> <argument name="label" value="{{colorConfigurableProductAttribute2.name}}"/> <argument name="price" value="{{virtualProductWithRequiredFields.price}}"/> </actionGroup> <!--Add quantity to product attribute options--> <comment userInput="Add quantity to product attribute options" stepKey="commentAddQuantity"/> - <actionGroup ref="addUniqueQuantityToConfigurableProductOption" stepKey="addUniqueQtyForFirstOption"> + <actionGroup ref="AddUniqueQuantityToConfigurableProductOptionActionGroup" stepKey="addUniqueQtyForFirstOption"> <argument name="frontend_label" value="{{colorProductAttribute.default_label}}"/> <argument name="label" value="{{colorConfigurableProductAttribute1.name}}"/> <argument name="quantity" value="{{virtualProductBigQty.quantity}}"/> </actionGroup> - <actionGroup ref="addUniqueQuantityToConfigurableProductOption" stepKey="addUniqueQtyForSecondOption"> + <actionGroup ref="AddUniqueQuantityToConfigurableProductOptionActionGroup" stepKey="addUniqueQtyForSecondOption"> <argument name="frontend_label" value="{{colorProductAttribute.default_label}}"/> <argument name="label" value="{{colorConfigurableProductAttribute2.name}}"/> <argument name="quantity" value="{{virtualProductBigQty.quantity}}"/> @@ -146,39 +146,39 @@ <waitForElementVisible selector="{{AdminGridSelectRows.multicheckDropdown}}" stepKey="waitForCreateConfigurationsPageLoad"/> <click selector="{{AdminGridSelectRows.multicheckDropdown}}" stepKey="openMulticheckDropdown"/> <click selector="{{AdminGridSelectRows.multicheckOption('Deselect All')}}" stepKey="DeselectAllAttributes"/> - <actionGroup ref="createOptionsForAttribute" stepKey="createOptionsForDuplicatedProduct"> + <actionGroup ref="CreateOptionsForAttributeActionGroup" stepKey="createOptionsForDuplicatedProduct"> <argument name="attributeName" value="{{productAttributeColor.default_label}}"/> <argument name="firstOptionName" value="{{colorConfigurableProductAttribute1.name}}"/> <argument name="secondOptionName" value="{{colorConfigurableProductAttribute2.name}}"/> </actionGroup> <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnFirstNextButtonForDuplicatedProduct"/> <waitForPageLoad stepKey="waitForBulkImagesPriceQuantityPageLoadForDuplicatedProduct"/> - <actionGroup ref="addUniqueImageToConfigurableProductOption" stepKey="addImgConfigProductOption1DuplicatedProduct"> + <actionGroup ref="AddUniqueImageToConfigurableProductOptionActionGroup" stepKey="addImgConfigProductOption1DuplicatedProduct"> <argument name="image" value="MagentoLogo"/> <argument name="frontend_label" value="{{productAttributeColor.default_label}}"/> <argument name="label" value="{{colorConfigurableProductAttribute1.name}}"/> </actionGroup> - <actionGroup ref="addUniqueImageToConfigurableProductOption" stepKey="addImgConfigProductOption2DuplicatedProduct"> + <actionGroup ref="AddUniqueImageToConfigurableProductOptionActionGroup" stepKey="addImgConfigProductOption2DuplicatedProduct"> <argument name="image" value="MagentoLogo"/> <argument name="frontend_label" value="{{productAttributeColor.default_label}}"/> <argument name="label" value="{{colorConfigurableProductAttribute2.name}}"/> </actionGroup> - <actionGroup ref="addUniquePriceToConfigurableProductOption" stepKey="addPriceConfigProductOption1DuplicatedProduct"> + <actionGroup ref="AddUniquePriceToConfigurableProductOptionActionGroup" stepKey="addPriceConfigProductOption1DuplicatedProduct"> <argument name="frontend_label" value="{{productAttributeColor.default_label}}"/> <argument name="label" value="{{colorConfigurableProductAttribute1.name}}"/> <argument name="price" value="{{virtualProductWithRequiredFields.price}}"/> </actionGroup> - <actionGroup ref="addUniquePriceToConfigurableProductOption" stepKey="addPriceConfigProductOption2DuplicatedProduct"> + <actionGroup ref="AddUniquePriceToConfigurableProductOptionActionGroup" stepKey="addPriceConfigProductOption2DuplicatedProduct"> <argument name="frontend_label" value="{{productAttributeColor.default_label}}"/> <argument name="label" value="{{colorConfigurableProductAttribute2.name}}"/> <argument name="price" value="{{virtualProductWithRequiredFields.price}}"/> </actionGroup> - <actionGroup ref="addUniqueQuantityToConfigurableProductOption" stepKey="addUniqueQtyOption1DuplicatedProduct"> + <actionGroup ref="AddUniqueQuantityToConfigurableProductOptionActionGroup" stepKey="addUniqueQtyOption1DuplicatedProduct"> <argument name="frontend_label" value="{{productAttributeColor.default_label}}"/> <argument name="label" value="{{colorConfigurableProductAttribute1.name}}"/> <argument name="quantity" value="{{virtualProductBigQty.quantity}}"/> </actionGroup> - <actionGroup ref="addUniqueQuantityToConfigurableProductOption" stepKey="addUniqueQtyOption2DuplicatedProduct"> + <actionGroup ref="AddUniqueQuantityToConfigurableProductOptionActionGroup" stepKey="addUniqueQtyOption2DuplicatedProduct"> <argument name="frontend_label" value="{{productAttributeColor.default_label}}"/> <argument name="label" value="{{colorConfigurableProductAttribute2.name}}"/> <argument name="quantity" value="{{virtualProductBigQty.quantity}}"/> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/AdminSaveConfigurableProductWithAttributesImagesAndSwatchesTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/AdminSaveConfigurableProductWithAttributesImagesAndSwatchesTest.xml index f94314fe94806..a342f30b66598 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/AdminSaveConfigurableProductWithAttributesImagesAndSwatchesTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/AdminSaveConfigurableProductWithAttributesImagesAndSwatchesTest.xml @@ -89,7 +89,7 @@ <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> <!-- Click "Create Configurations" button, select created product attribute using the same Quantity for all products. Click "Generate products" button --> - <actionGroup ref="generateConfigurationsByAttributeCode" stepKey="addAttributeToProduct"> + <actionGroup ref="GenerateConfigurationsByAttributeCodeActionGroup" stepKey="addAttributeToProduct"> <argument name="attributeCode" value="{{VisualSwatchProductAttribute.attribute_code}}"/> </actionGroup> <!-- Using this action to concatenate 2 strings to have unique identifier for grid --> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontConfigurableProductSwatchMinimumPriceTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontConfigurableProductSwatchMinimumPriceTest.xml index 0a98e7a721c17..c65a24e2c724f 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontConfigurableProductSwatchMinimumPriceTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontConfigurableProductSwatchMinimumPriceTest.xml @@ -60,59 +60,59 @@ <argument name="option3" value="Large"/> </actionGroup> <!--Create configurable product with two attributes: Color and Size--> - <actionGroup ref="createConfigurableProductWithTwoAttributes" stepKey="createProduct"> + <actionGroup ref="CreateConfigurableProductWithTwoAttributesActionGroup" stepKey="createProduct"> <argument name="product" value="_defaultProduct"/> <argument name="category" value="$$createCategory$$"/> <argument name="attribute1" value="ProductColorAttribute"/> <argument name="attribute2" value="ProductSizeAttribute"/> </actionGroup> <!--Set Black-Small product price to 10--> - <actionGroup ref="changeConfigurableProductChildProductPrice" stepKey="changeBlackSmallPrice"> + <actionGroup ref="ChangeConfigurableProductChildProductPriceActionGroup" stepKey="changeBlackSmallPrice"> <argument name="productAttributes" value="Color: Black, Size: Small"/> <argument name="productPrice" value="10"/> </actionGroup> <!--Set Black-Medium product price to 11--> - <actionGroup ref="changeConfigurableProductChildProductPrice" stepKey="changeBlackMediumPrice"> + <actionGroup ref="ChangeConfigurableProductChildProductPriceActionGroup" stepKey="changeBlackMediumPrice"> <argument name="productAttributes" value="Color: Black, Size: Medium"/> <argument name="productPrice" value="11"/> </actionGroup> <!--Set Black-Large product price to 12--> - <actionGroup ref="changeConfigurableProductChildProductPrice" stepKey="changeBlackLargePrice"> + <actionGroup ref="ChangeConfigurableProductChildProductPriceActionGroup" stepKey="changeBlackLargePrice"> <argument name="productAttributes" value="Color: Black, Size: Large"/> <argument name="productPrice" value="12"/> </actionGroup> <!--Set White-Small product price to 14--> - <actionGroup ref="changeConfigurableProductChildProductPrice" stepKey="changeWhiteSmallPrice"> + <actionGroup ref="ChangeConfigurableProductChildProductPriceActionGroup" stepKey="changeWhiteSmallPrice"> <argument name="productAttributes" value="Color: White, Size: Small"/> <argument name="productPrice" value="14"/> </actionGroup> <!--Set White-Medium product price to 13--> - <actionGroup ref="changeConfigurableProductChildProductPrice" stepKey="changeWhiteMediumPrice"> + <actionGroup ref="ChangeConfigurableProductChildProductPriceActionGroup" stepKey="changeWhiteMediumPrice"> <argument name="productAttributes" value="Color: White, Size: Medium"/> <argument name="productPrice" value="13"/> </actionGroup> <!--Set White-Large product price to 15--> - <actionGroup ref="changeConfigurableProductChildProductPrice" stepKey="changeWhiteLargePrice"> + <actionGroup ref="ChangeConfigurableProductChildProductPriceActionGroup" stepKey="changeWhiteLargePrice"> <argument name="productAttributes" value="Color: White, Size: Large"/> <argument name="productPrice" value="15"/> </actionGroup> <!--Set Blue-Small product price to 18--> - <actionGroup ref="changeConfigurableProductChildProductPrice" stepKey="changeBlueSmallPrice"> + <actionGroup ref="ChangeConfigurableProductChildProductPriceActionGroup" stepKey="changeBlueSmallPrice"> <argument name="productAttributes" value="Color: Blue, Size: Small"/> <argument name="productPrice" value="18"/> </actionGroup> <!--Set Blue-Medium product price to 17--> - <actionGroup ref="changeConfigurableProductChildProductPrice" stepKey="changeBlueMediumPrice"> + <actionGroup ref="ChangeConfigurableProductChildProductPriceActionGroup" stepKey="changeBlueMediumPrice"> <argument name="productAttributes" value="Color: Blue, Size: Medium"/> <argument name="productPrice" value="17"/> </actionGroup> <!--Set Blue-Large product price to 16--> - <actionGroup ref="changeConfigurableProductChildProductPrice" stepKey="changeBlueLargePrice"> + <actionGroup ref="ChangeConfigurableProductChildProductPriceActionGroup" stepKey="changeBlueLargePrice"> <argument name="productAttributes" value="Color: Blue, Size: Large"/> <argument name="productPrice" value="16"/> </actionGroup> <!--Save configurable product--> - <actionGroup ref="saveConfigurableProduct" stepKey="saveProduct"> + <actionGroup ref="SaveConfigurableProductActionGroup" stepKey="saveProduct"> <argument name="product" value="_defaultProduct"/> </actionGroup> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml index c9602ddcd127c..e9f5461435449 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml @@ -98,7 +98,7 @@ <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[$$createCategory.name$$]" stepKey="fillCategory"/> <!-- Create configurations based off the visual swatch we created earlier --> - <actionGroup ref="createConfigurationsForAttributeWithImages" stepKey="createConfigurations"> + <actionGroup ref="CreateConfigurationsForAttributeWithImagesActionGroup" stepKey="createConfigurations"> <argument name="attributeCode" value="{{ProductAttributeFrontendLabel.label}}"/> <argument name="image" value="TestImageAdobe"/> </actionGroup> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByTextSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByTextSwatchTest.xml index 7bf63d25417e3..f3304e67e5534 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByTextSwatchTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByTextSwatchTest.xml @@ -78,7 +78,7 @@ <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[$$createCategory.name$$]" stepKey="fillCategory"/> <!-- Create configurations based off the text swatch we created earlier --> - <actionGroup ref="createConfigurationsForAttribute" stepKey="createConfigurations"> + <actionGroup ref="CreateConfigurationsForAttributeActionGroup" stepKey="createConfigurations"> <argument name="attributeCode" value="{{ProductAttributeFrontendLabel.label}}"/> </actionGroup> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByVisualSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByVisualSwatchTest.xml index fd38c48919416..b4028674ee5bd 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByVisualSwatchTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByVisualSwatchTest.xml @@ -90,7 +90,7 @@ <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[$$createCategory.name$$]" stepKey="fillCategory"/> <!-- Create configurations based off the visual watch we created earlier --> - <actionGroup ref="createConfigurationsForAttribute" stepKey="createConfigurations"> + <actionGroup ref="CreateConfigurationsForAttributeActionGroup" stepKey="createConfigurations"> <argument name="attributeCode" value="{{ProductAttributeFrontendLabel.label}}"/> </actionGroup> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontImageColorWhenFilterByColorFilterTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontImageColorWhenFilterByColorFilterTest.xml index 2928011662864..b46f5753152b6 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontImageColorWhenFilterByColorFilterTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontImageColorWhenFilterByColorFilterTest.xml @@ -54,12 +54,12 @@ <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton1"/> <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton2"/> <!--Add images to product attribute options--> - <actionGroup ref="addUniqueImageToConfigurableProductOption" stepKey="addImageToConfigurableProductOptionOne"> + <actionGroup ref="AddUniqueImageToConfigurableProductOptionActionGroup" stepKey="addImageToConfigurableProductOptionOne"> <argument name="image" value="MagentoLogo"/> <argument name="frontend_label" value="{{visualSwatchAttribute.default_label}}"/> <argument name="label" value="{{visualSwatchOption1.default_label}}"/> </actionGroup> - <actionGroup ref="addUniqueImageToConfigurableProductOption" stepKey="addImageToConfigurableProductOptionTwo"> + <actionGroup ref="AddUniqueImageToConfigurableProductOptionActionGroup" stepKey="addImageToConfigurableProductOptionTwo"> <argument name="image" value="TestImageNew"/> <argument name="frontend_label" value="{{visualSwatchAttribute.default_label}}"/> <argument name="label" value="{{visualSwatchOption2.default_label}}"/> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSeeProductImagesMatchingProductSwatchesTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSeeProductImagesMatchingProductSwatchesTest.xml index 1717b424e4597..bf432b98b3d3a 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSeeProductImagesMatchingProductSwatchesTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSeeProductImagesMatchingProductSwatchesTest.xml @@ -76,23 +76,23 @@ </actionGroup> <!-- Create configurations based off the visual swatch we created earlier --> - <actionGroup ref="StartCreateConfigurationsForAttribute" stepKey="createConfigurations"> + <actionGroup ref="StartCreateConfigurationsForAttributeActionGroup" stepKey="createConfigurations"> <argument name="attributeCode" value="{{VisualSwatchProductAttribute.attribute_code}}"/> </actionGroup> <!--Add images to configurable product attribute options--> - <actionGroup ref="addUniqueImageToConfigurableProductOption" stepKey="addImageToConfigurableProductOptionOne"> + <actionGroup ref="AddUniqueImageToConfigurableProductOptionActionGroup" stepKey="addImageToConfigurableProductOptionOne"> <argument name="image" value="TestImageAdobe"/> <argument name="frontend_label" value="{{VisualSwatchProductAttribute.attribute_code}}"/> <argument name="label" value="{{visualSwatchOption1.default_label}}"/> </actionGroup> - <actionGroup ref="addUniqueImageToConfigurableProductOption" stepKey="addImageToConfigurableProductOptionTwo"> + <actionGroup ref="AddUniqueImageToConfigurableProductOptionActionGroup" stepKey="addImageToConfigurableProductOptionTwo"> <argument name="image" value="ImageUpload3"/> <argument name="frontend_label" value="{{VisualSwatchProductAttribute.attribute_code}}"/> <argument name="label" value="{{visualSwatchOption2.default_label}}"/> </actionGroup> - <actionGroup ref="GenerateAndSaveConfiguredProductAfterSettingOptions" stepKey="saveProductForm"/> + <actionGroup ref="GenerateAndSaveConfiguredProductAfterSettingOptionsActionGroup" stepKey="saveProductForm"/> <!-- Go to the category page --> <amOnPage url="{{StorefrontProductPage.url($$createSimpleProduct.custom_attributes[url_key]$$)}}" stepKey="goToProductPage"/> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/ConfProdAddToCartWishListWithUnselectedAttrTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/ConfProdAddToCartWishListWithUnselectedAttrTest.xml index 4e6a062c7993d..317e9e9bab3cd 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/ConfProdAddToCartWishListWithUnselectedAttrTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/ConfProdAddToCartWishListWithUnselectedAttrTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/> <createData entity="ApiCategory" stepKey="createCategory"/> <!--Create Configurable product--> - <actionGroup ref="createConfigurableProduct" stepKey="createProduct"> + <actionGroup ref="CreateConfigurableProductActionGroup" stepKey="createProduct"> <argument name="product" value="_defaultProduct"/> <argument name="category" value="$$createCategory$$"/> </actionGroup> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/ConfigurableProductChildImageShouldBeShownOnWishListTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/ConfigurableProductChildImageShouldBeShownOnWishListTest.xml index 0489ec750b7e0..bb4870d294b0c 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/ConfigurableProductChildImageShouldBeShownOnWishListTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/ConfigurableProductChildImageShouldBeShownOnWishListTest.xml @@ -23,7 +23,7 @@ <createData entity="ApiCategory" stepKey="createCategory"/> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/> - <actionGroup ref="createConfigurableProduct" stepKey="createProduct"> + <actionGroup ref="CreateConfigurableProductActionGroup" stepKey="createProduct"> <argument name="product" value="_defaultProduct"/> <argument name="category" value="$$createCategory$$"/> </actionGroup> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductCatalogSearch/Test/EndToEndB2CGuestUserTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductCatalogSearch/Test/EndToEndB2CGuestUserTest.xml index cac9d0c3cb55f..d38bf90a3a16d 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductCatalogSearch/Test/EndToEndB2CGuestUserTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductCatalogSearch/Test/EndToEndB2CGuestUserTest.xml @@ -11,7 +11,7 @@ <test name="EndToEndB2CGuestUserTest"> <!-- Search configurable product --> <comment userInput="Search configurable product" stepKey="commentSearchConfigurableProduct" after="searchAssertSimpleProduct2ImageNotDefault" /> - <actionGroup ref="StorefrontCheckCategoryConfigurableProduct" stepKey="searchAssertFilterCategoryConfigProduct" after="commentSearchConfigurableProduct"> + <actionGroup ref="StorefrontCheckCategoryConfigurableProductActionGroup" stepKey="searchAssertFilterCategoryConfigProduct" after="commentSearchConfigurableProduct"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="optionProduct" value="$$createConfigChildProduct1$$"/> </actionGroup> @@ -19,7 +19,7 @@ <grabAttributeFrom selector="{{StorefrontCategoryProductSection.ProductImageByName($$createConfigProduct.name$$)}}" userInput="src" stepKey="searchGrabConfigProductImageSrc" after="searchAssertFilterCategoryConfigProduct"/> <assertNotRegExp expected="'/placeholder\/small_image\.jpg/'" actual="$searchGrabConfigProductImageSrc" stepKey="searchAssertConfigProductImageNotDefault" after="searchGrabConfigProductImageSrc"/> <click selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createConfigProduct.name$$)}}" stepKey="searchClickConfigProductView" after="searchAssertConfigProductImageNotDefault"/> - <actionGroup ref="StorefrontCheckConfigurableProduct" stepKey="searchAssertConfigProductPage" after="searchClickConfigProductView"> + <actionGroup ref="StorefrontCheckConfigurableProductActionGroup" stepKey="searchAssertConfigProductPage" after="searchClickConfigProductView"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="optionProduct" value="$$createConfigChildProduct1$$"/> </actionGroup> @@ -30,7 +30,7 @@ <test name="EndToEndB2CGuestUserMysqlTest"> <!-- Search configurable product --> <comment userInput="Search configurable product" stepKey="commentSearchConfigurableProduct" after="searchAssertSimpleProduct2ImageNotDefault" /> - <actionGroup ref="StorefrontCheckCategoryConfigurableProduct" stepKey="searchAssertFilterCategoryConfigProduct" after="commentSearchConfigurableProduct"> + <actionGroup ref="StorefrontCheckCategoryConfigurableProductActionGroup" stepKey="searchAssertFilterCategoryConfigProduct" after="commentSearchConfigurableProduct"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="optionProduct" value="$$createConfigChildProduct1$$"/> </actionGroup> @@ -38,7 +38,7 @@ <grabAttributeFrom selector="{{StorefrontCategoryProductSection.ProductImageByName($$createConfigProduct.name$$)}}" userInput="src" stepKey="searchGrabConfigProductImageSrc" after="searchAssertFilterCategoryConfigProduct"/> <assertNotRegExp expected="'/placeholder\/small_image\.jpg/'" actual="$searchGrabConfigProductImageSrc" stepKey="searchAssertConfigProductImageNotDefault" after="searchGrabConfigProductImageSrc"/> <click selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createConfigProduct.name$$)}}" stepKey="searchClickConfigProductView" after="searchAssertConfigProductImageNotDefault"/> - <actionGroup ref="StorefrontCheckConfigurableProduct" stepKey="searchAssertConfigProductPage" after="searchClickConfigProductView"> + <actionGroup ref="StorefrontCheckConfigurableProductActionGroup" stepKey="searchAssertConfigProductPage" after="searchClickConfigProductView"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="optionProduct" value="$$createConfigChildProduct1$$"/> </actionGroup> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductCatalogSearch/Test/EndToEndB2CLoggedInUserTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductCatalogSearch/Test/EndToEndB2CLoggedInUserTest.xml index 9fe70c8b4dd3b..f616e46d6f692 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductCatalogSearch/Test/EndToEndB2CLoggedInUserTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductCatalogSearch/Test/EndToEndB2CLoggedInUserTest.xml @@ -11,7 +11,7 @@ <test name="EndToEndB2CLoggedInUserTest"> <!-- Search configurable product --> <comment userInput="Search configurable product" stepKey="commentSearchConfigurableProduct" after="searchAssertSimpleProduct2ImageNotDefault" /> - <actionGroup ref="StorefrontCheckCategoryConfigurableProduct" stepKey="searchAssertFilterCategoryConfigProduct" after="commentSearchConfigurableProduct"> + <actionGroup ref="StorefrontCheckCategoryConfigurableProductActionGroup" stepKey="searchAssertFilterCategoryConfigProduct" after="commentSearchConfigurableProduct"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="optionProduct" value="$$createConfigChildProduct1$$"/> </actionGroup> @@ -19,7 +19,7 @@ <grabAttributeFrom selector="{{StorefrontCategoryProductSection.ProductImageByName($$createConfigProduct.name$$)}}" userInput="src" stepKey="searchGrabConfigProductImageSrc" after="searchAssertFilterCategoryConfigProduct"/> <assertNotRegExp expected="'/placeholder\/small_image\.jpg/'" actual="$searchGrabConfigProductImageSrc" stepKey="searchAssertConfigProductImageNotDefault" after="searchGrabConfigProductImageSrc"/> <click selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createConfigProduct.name$$)}}" stepKey="searchClickConfigProductView" after="searchAssertConfigProductImageNotDefault"/> - <actionGroup ref="StorefrontCheckConfigurableProduct" stepKey="searchAssertConfigProductPage" after="searchClickConfigProductView"> + <actionGroup ref="StorefrontCheckConfigurableProductActionGroup" stepKey="searchAssertConfigProductPage" after="searchClickConfigProductView"> <argument name="product" value="$$createConfigProduct$$"/> <argument name="optionProduct" value="$$createConfigChildProduct1$$"/> </actionGroup> From 363ecc0c8bc61cbf41ba8f0228c30380571e10e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Fri, 29 Nov 2019 00:22:14 +0100 Subject: [PATCH 0175/1143] REFACTOR: Extract Action Groups to separate files (according to MFTF best practices) --- .../StorefrontBundleProductDetailsTest.xml | 2 +- .../AdminAddImageToWYSIWYGCatalogTest.xml | 4 +- .../AdminAddImageToWYSIWYGProductTest.xml | 4 +- ...reateAndEditVirtualProductSettingsTest.xml | 4 +- ...dminEditTextEditorProductAttributeTest.xml | 4 +- .../AdminRemoveImageAffectsAllScopesTest.xml | 2 +- .../AdminSimpleProductSetEditContentTest.xml | 2 +- .../Mftf/Test/AdminSortingByWebsitesTest.xml | 4 +- ...ductWithCustomOptionsSecondWebsiteTest.xml | 6 +- ...rifyDefaultWYSIWYGToolbarOnProductTest.xml | 8 +- ...yTinyMCEv4IsNativeWYSIWYGOnCatalogTest.xml | 4 +- ...yTinyMCEv4IsNativeWYSIWYGOnProductTest.xml | 4 +- .../CatalogProductListWidgetOperatorsTest.xml | 4 +- .../CatalogProductListWidgetOrderTest.xml | 6 +- .../Test/CheckoutSpecificDestinationsTest.xml | 8 +- ...frontCustomerCheckoutWithoutRegionTest.xml | 4 +- .../Test/AdminAddImageToWYSIWYGBlockTest.xml | 4 +- .../Test/AdminAddImageToWYSIWYGCMSTest.xml | 4 +- .../AdminAddVariableToWYSIWYGBlockTest.xml | 4 +- .../Test/AdminAddVariableToWYSIWYGCMSTest.xml | 4 +- .../Test/AdminAddWidgetToWYSIWYGBlockTest.xml | 4 +- ...WidgetToWYSIWYGWithCMSPageLinkTypeTest.xml | 4 +- ...getToWYSIWYGWithCMSStaticBlockTypeTest.xml | 4 +- ...WYSIWYGWithCatalogCategoryLinkTypeTest.xml | 4 +- ...oWYSIWYGWithCatalogProductLinkTypeTest.xml | 4 +- ...oWYSIWYGWithCatalogProductListTypeTest.xml | 4 +- ...YGWithRecentlyComparedProductsTypeTest.xml | 4 +- ...IWYGWithRecentlyViewedProductsTypeTest.xml | 4 +- .../Mftf/Test/AdminCreateCmsBlockTest.xml | 2 +- .../Test/Mftf/Test/AdminCreateCmsPageTest.xml | 4 +- ...CheckOrderOfProdsInWidgetOnCMSPageTest.xml | 4 +- ...ifyTinyMCEv4IsNativeWYSIWYGOnBlockTest.xml | 4 +- ...yTinyMCEv4IsNativeWYSIWYGOnCMSPageTest.xml | 4 +- ...lasticSearchAsSearchEngineActionGroup.xml} | 20 +---- .../ConfigAdminAccountSharingActionGroup.xml | 16 ---- .../ConfigSalesTaxClassActionGroup.xml | 78 ------------------- .../ActionGroup/ConfigWYSIWYGActionGroup.xml | 76 ------------------ .../DisableAdminAccountSharingActionGroup.xml | 18 +++++ ...ableTaxApplyOnOriginalPriceActionGroup.xml | 29 +++++++ .../DisabledWYSIWYGActionGroup.xml | 18 +++++ .../EnableAdminAccountSharingActionGroup.xml | 18 +++++ .../EnableWebUrlOptionsActionGroup.xml | 25 ++++++ .../ActionGroup/EnabledWYSIWYGActionGroup.xml | 18 +++++ .../EnabledWYSIWYGEditorActionGroup.xml | 26 +++++++ .../GeneralConfigurationActionGroup.xml | 72 ----------------- ...eToConfigurationGeneralPageActionGroup.xml | 19 +++++ ...gateToDefaultLayoutsSettingActionGroup.xml | 21 +++++ ...etSearchEngineConfigurationActionGroup.xml | 26 +++++++ .../ResetTaxClassForShippingActionGroup.xml | 25 ++++++ ....xml => ResetWebUrlOptionsActionGroup.xml} | 19 +---- ...CountriesWithRequiredRegionActionGroup.xml | 27 +++++++ ...electTopDestinationsCountryActionGroup.xml | 23 ++++++ .../SetTaxApplyOnSettingActionGroup.xml | 29 +++++++ .../SetTaxClassForShippingActionGroup.xml | 25 ++++++ .../SwitchToTinyMCE3ActionGroup.xml | 26 +++++++ ...electTopDestinationsCountryActionGroup.xml | 23 ++++++ ...URLForMediaContentInWYSIWYGActionGroup.xml | 28 +++++++ ...bleProductPriceAdditionalStoreViewTest.xml | 6 +- ...CountriesRestrictionApplyOnBackendTest.xml | 4 +- ...oductQuickSearchUsingElasticSearchTest.xml | 6 +- .../AdminAddImageToWYSIWYGNewsletterTest.xml | 4 +- ...dminAddVariableToWYSIWYGNewsletterTest.xml | 4 +- .../AdminAddWidgetToWYSIWYGNewsletterTest.xml | 4 +- ...erifySubscribedNewsletterDisplayedTest.xml | 4 +- ...nyMCEv4IsNativeWYSIWYGOnNewsletterTest.xml | 4 +- ...editMemoTotalAfterShippingDiscountTest.xml | 4 +- .../AdminTaxCalcWithApplyTaxOnSettingTest.xml | 8 +- .../Test/AdminSwitchWYSIWYGOptionsTest.xml | 4 +- .../Mftf/Test/NewProductsListWidgetTest.xml | 4 +- 69 files changed, 524 insertions(+), 373 deletions(-) rename app/code/Magento/Config/Test/Mftf/ActionGroup/{ConfigAdminCatalogSearchActionGroup.xml => ChooseElasticSearchAsSearchEngineActionGroup.xml} (56%) delete mode 100644 app/code/Magento/Config/Test/Mftf/ActionGroup/ConfigSalesTaxClassActionGroup.xml delete mode 100644 app/code/Magento/Config/Test/Mftf/ActionGroup/ConfigWYSIWYGActionGroup.xml create mode 100644 app/code/Magento/Config/Test/Mftf/ActionGroup/DisableAdminAccountSharingActionGroup.xml create mode 100644 app/code/Magento/Config/Test/Mftf/ActionGroup/DisableTaxApplyOnOriginalPriceActionGroup.xml create mode 100644 app/code/Magento/Config/Test/Mftf/ActionGroup/DisabledWYSIWYGActionGroup.xml create mode 100644 app/code/Magento/Config/Test/Mftf/ActionGroup/EnableAdminAccountSharingActionGroup.xml create mode 100644 app/code/Magento/Config/Test/Mftf/ActionGroup/EnableWebUrlOptionsActionGroup.xml create mode 100644 app/code/Magento/Config/Test/Mftf/ActionGroup/EnabledWYSIWYGActionGroup.xml create mode 100644 app/code/Magento/Config/Test/Mftf/ActionGroup/EnabledWYSIWYGEditorActionGroup.xml delete mode 100644 app/code/Magento/Config/Test/Mftf/ActionGroup/GeneralConfigurationActionGroup.xml create mode 100644 app/code/Magento/Config/Test/Mftf/ActionGroup/NavigateToConfigurationGeneralPageActionGroup.xml create mode 100644 app/code/Magento/Config/Test/Mftf/ActionGroup/NavigateToDefaultLayoutsSettingActionGroup.xml create mode 100644 app/code/Magento/Config/Test/Mftf/ActionGroup/ResetSearchEngineConfigurationActionGroup.xml create mode 100644 app/code/Magento/Config/Test/Mftf/ActionGroup/ResetTaxClassForShippingActionGroup.xml rename app/code/Magento/Config/Test/Mftf/ActionGroup/{ConfigWebUrlOptionsActionGroup.xml => ResetWebUrlOptionsActionGroup.xml} (56%) create mode 100644 app/code/Magento/Config/Test/Mftf/ActionGroup/SelectCountriesWithRequiredRegionActionGroup.xml create mode 100644 app/code/Magento/Config/Test/Mftf/ActionGroup/SelectTopDestinationsCountryActionGroup.xml create mode 100644 app/code/Magento/Config/Test/Mftf/ActionGroup/SetTaxApplyOnSettingActionGroup.xml create mode 100644 app/code/Magento/Config/Test/Mftf/ActionGroup/SetTaxClassForShippingActionGroup.xml create mode 100644 app/code/Magento/Config/Test/Mftf/ActionGroup/SwitchToTinyMCE3ActionGroup.xml create mode 100644 app/code/Magento/Config/Test/Mftf/ActionGroup/UnSelectTopDestinationsCountryActionGroup.xml create mode 100644 app/code/Magento/Config/Test/Mftf/ActionGroup/UseStaticURLForMediaContentInWYSIWYGActionGroup.xml diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleProductDetailsTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleProductDetailsTest.xml index d7394b2dbf32e..c1414b4c96230 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleProductDetailsTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleProductDetailsTest.xml @@ -26,7 +26,7 @@ <!-- Admin Login--> <actionGroup stepKey="loginToAdminPanel" ref="LoginAsAdmin"/> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> </before> <after> <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGCatalogTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGCatalogTest.xml index c36c29ce594d0..a59562717d688 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGCatalogTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGCatalogTest.xml @@ -10,7 +10,7 @@ <test name="AdminAddImageToWYSIWYGCatalogTest"> <before> <actionGroup ref="LoginActionGroup" stepKey="login"/> - <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> + <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> <annotations> @@ -54,7 +54,7 @@ <actionGroup ref="DeleteCategory" stepKey="DeleteCategory"> <argument name="categoryEntity" value="SimpleSubCategory"/> </actionGroup> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> </test> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml index 4044490c92334..450f21b7afd99 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml @@ -19,11 +19,11 @@ </annotations> <before> <actionGroup ref="LoginActionGroup" stepKey="login"/> - <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> + <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> <after> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndEditVirtualProductSettingsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndEditVirtualProductSettingsTest.xml index 90cbab59bd71d..26043bef51e6d 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndEditVirtualProductSettingsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndEditVirtualProductSettingsTest.xml @@ -51,7 +51,7 @@ <actionGroup ref="logout" stepKey="adminLogout"/> </after> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <!-- Create new virtual product --> <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="createVirtualProduct"> @@ -185,6 +185,6 @@ <actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openCart"/> <dontSeeElement selector="{{StorefrontProductCartGiftOptionSection.giftOptions}}" stepKey="dontSeeGiftOptionBtn"/> - <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> + <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> </test> </tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminEditTextEditorProductAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminEditTextEditorProductAttributeTest.xml index 53040993beb8f..eff05fd64a775 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminEditTextEditorProductAttributeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminEditTextEditorProductAttributeTest.xml @@ -19,7 +19,7 @@ </annotations> <before> <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> - <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> + <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> <createData stepKey="myProductAttributeCreation" entity="productAttributeWysiwyg"/> <createData stepKey="myProductAttributeSetAssign" entity="AddToDefaultSet"> @@ -75,7 +75,7 @@ <seeElement selector="{{ProductAttributeWYSIWYGSection.TinyMCE4($$myProductAttributeCreation.attribute_code$$)}}" stepKey="seePoweredBy"/> <after> <deleteData createDataKey="myProductAttributeCreation" stepKey="deletePreReqProductAttribute" /> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> </test> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveImageAffectsAllScopesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveImageAffectsAllScopesTest.xml index 8316f54c15a52..d92a3622725bf 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveImageAffectsAllScopesTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveImageAffectsAllScopesTest.xml @@ -55,7 +55,7 @@ </before> <after> - <actionGroup ref="ResetWebUrlOptions" stepKey="resetUrlOption"/> + <actionGroup ref="ResetWebUrlOptionsActionGroup" stepKey="resetUrlOption"/> <actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite"> <argument name="websiteName" value="FirstWebSite"/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductSetEditContentTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductSetEditContentTest.xml index f5e5911352c86..2099e95d61ed2 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductSetEditContentTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductSetEditContentTest.xml @@ -22,7 +22,7 @@ <before> <!--Admin Login--> <actionGroup stepKey="loginToAdminPanel" ref="LoginAsAdmin"/> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> </before> <after> <!-- Delete simple product --> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminSortingByWebsitesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminSortingByWebsitesTest.xml index 5b6207e135796..ddef7beb07b43 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminSortingByWebsitesTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminSortingByWebsitesTest.xml @@ -30,7 +30,7 @@ <argument name="newWebsiteName" value="{{customWebsite.name}}"/> <argument name="websiteCode" value="{{customWebsite.code}}"/> </actionGroup> - <actionGroup ref="EnableWebUrlOptions" stepKey="addStoreCodeToUrls"/> + <actionGroup ref="EnableWebUrlOptionsActionGroup" stepKey="addStoreCodeToUrls"/> <magentoCLI command="cache:flush" stepKey="flushCacheAfterEnableWebUrlOptions"/> </before> <after> @@ -42,7 +42,7 @@ </actionGroup> <actionGroup ref="GoToProductCatalogPage" stepKey="goToProductCatalogPage"/> <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGridColumnsInitial"/> - <actionGroup ref="ResetWebUrlOptions" stepKey="resetUrlOption"/> + <actionGroup ref="ResetWebUrlOptionsActionGroup" stepKey="resetUrlOption"/> <magentoCLI command="indexer:reindex" stepKey="reindex"/> <magentoCLI command="cache:flush" stepKey="flushCache"/> <actionGroup ref="logout" stepKey="logout"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/SaveProductWithCustomOptionsSecondWebsiteTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/SaveProductWithCustomOptionsSecondWebsiteTest.xml index 8092b03c53cba..89e784d67eaea 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/SaveProductWithCustomOptionsSecondWebsiteTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/SaveProductWithCustomOptionsSecondWebsiteTest.xml @@ -49,14 +49,14 @@ <see userInput="You saved the store view." stepKey="seeSaveMessage" /> </before> <after> - <actionGroup ref="ResetWebUrlOptions" stepKey="resetUrlOption"/> + <actionGroup ref="ResetWebUrlOptionsActionGroup" stepKey="resetUrlOption"/> <actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteTestWebsite"> <argument name="websiteName" value="Second Website"/> </actionGroup> <actionGroup ref="logout" stepKey="adminLogout"/> </after> - <actionGroup ref="EnableWebUrlOptions" stepKey="addStoreCodeToUrls"/> + <actionGroup ref="EnableWebUrlOptionsActionGroup" stepKey="addStoreCodeToUrls"/> <!--Create a Simple Product with Custom Options --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToCatalogProductGrid"/> <waitForPageLoad stepKey="waitForCatalogProductGrid"/> @@ -103,4 +103,4 @@ <seeNumberOfElements selector=".admin__dynamic-rows[data-index='values'] tr.data-row" userInput="3" stepKey="see4RowsOfOptions"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/VerifyDefaultWYSIWYGToolbarOnProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/VerifyDefaultWYSIWYGToolbarOnProductTest.xml index 53bcac5b1d5f0..fe0ed32f39e1e 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/VerifyDefaultWYSIWYGToolbarOnProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/VerifyDefaultWYSIWYGToolbarOnProductTest.xml @@ -20,7 +20,7 @@ </annotations> <before> <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> - <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> + <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> <amOnPage url="{{AdminProductCreatePage.url(AddToDefaultSet.attributeSetId, 'simple')}}" stepKey="navigateToProduct"/> @@ -43,7 +43,7 @@ <seeElement selector="{{ProductDescriptionWYSIWYGToolbarSection.InsertTable}}" stepKey="assertInfo13"/> <seeElement selector="{{ProductDescriptionWYSIWYGToolbarSection.SpecialCharacter}}" stepKey="assertInfo14"/> <after> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> </test> @@ -59,7 +59,7 @@ </annotations> <before> <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> - <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> + <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> <amOnPage url="{{AdminProductCreatePage.url(AddToDefaultSet.attributeSetId, 'simple')}}" stepKey="navigateToProduct"/> @@ -82,7 +82,7 @@ <seeElement selector="{{ProductShortDescriptionWYSIWYGToolbarSection.InsertTable}}" stepKey="assertInfo27"/> <seeElement selector="{{ProductShortDescriptionWYSIWYGToolbarSection.SpecialCharacter}}" stepKey="assertInfo28"/> <after> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> </test> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogTest.xml index aad83cd0c2aff..cc69d0828015f 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogTest.xml @@ -20,7 +20,7 @@ </annotations> <before> <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> - <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> + <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> <amOnPage url="{{AdminCategoryPage.url}}" stepKey="navigateToNewCatalog"/> @@ -45,7 +45,7 @@ <waitForElementVisible selector="{{StorefrontCategoryMainSection.CatalogDescription}}" stepKey="waitForDesVisible" /> <see userInput="Hello World!" selector="{{StorefrontCategoryMainSection.CatalogDescription}}" stepKey="assertCatalogDescription"/> <after> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> </test> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnProductTest.xml index 29ed3af4f01d9..5a2728b6532c8 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnProductTest.xml @@ -19,7 +19,7 @@ </annotations> <before> <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> - <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> + <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> <amOnPage url="{{AdminProductCreatePage.url(AddToDefaultSet.attributeSetId, 'simple')}}" stepKey="navigateToNewProduct"/> @@ -58,7 +58,7 @@ <see userInput="Hello World!" selector="{{StorefrontProductInfoMainSection.productDescription}}" stepKey="assertProductDescription"/> <see userInput="Hello World! Short Content" selector="{{StorefrontProductInfoMainSection.productShortDescription}}" stepKey="assertProductShortDescription"/> <after> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> </test> diff --git a/app/code/Magento/CatalogWidget/Test/Mftf/Test/CatalogProductListWidgetOperatorsTest.xml b/app/code/Magento/CatalogWidget/Test/Mftf/Test/CatalogProductListWidgetOperatorsTest.xml index 32bea8b604cf8..d4344c5d2fac6 100644 --- a/app/code/Magento/CatalogWidget/Test/Mftf/Test/CatalogProductListWidgetOperatorsTest.xml +++ b/app/code/Magento/CatalogWidget/Test/Mftf/Test/CatalogProductListWidgetOperatorsTest.xml @@ -38,7 +38,7 @@ <createData entity="_defaultBlock" stepKey="createPreReqBlock"/> <!--User log in on back-end as admin--> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> + <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> </before> <!--Open block with widget.--> @@ -145,7 +145,7 @@ <dontSeeElement selector="{{InsertWidgetSection.checkElementStorefrontByPrice('100')}}" stepKey="dontSeeElementByPrice100s"/> <after> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <deleteData createDataKey="createPreReqBlock" stepKey="deletePreReqBlock" /> <deleteData createDataKey="simplecategory" stepKey="deleteSimpleCategory"/> <deleteData createDataKey="createFirstProduct" stepKey="deleteFirstProduct"/> diff --git a/app/code/Magento/CatalogWidget/Test/Mftf/Test/CatalogProductListWidgetOrderTest.xml b/app/code/Magento/CatalogWidget/Test/Mftf/Test/CatalogProductListWidgetOrderTest.xml index 11586207c4d8e..f9e050100bf05 100644 --- a/app/code/Magento/CatalogWidget/Test/Mftf/Test/CatalogProductListWidgetOrderTest.xml +++ b/app/code/Magento/CatalogWidget/Test/Mftf/Test/CatalogProductListWidgetOrderTest.xml @@ -38,7 +38,7 @@ </createData> <createData entity="_defaultCmsPage" stepKey="createPreReqPage"/> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> + <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> </before> <!--Open created cms page--> <comment userInput="Open created cms page" stepKey="commentOpenCreatedCmsPage"/> @@ -76,7 +76,7 @@ <seeElement selector="{{InsertWidgetSection.checkElementStorefrontByName('2','$$createSecondProduct.name$$')}}" stepKey="seeElementByName2"/> <seeElement selector="{{InsertWidgetSection.checkElementStorefrontByName('3','$$createFirstProduct.name$$')}}" stepKey="seeElementByName3"/> <after> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <deleteData createDataKey="createPreReqPage" stepKey="deletePreReqPage" /> <deleteData createDataKey="simplecategory" stepKey="deleteSimpleCategory"/> <deleteData createDataKey="createFirstProduct" stepKey="deleteFirstProduct"/> @@ -85,4 +85,4 @@ <actionGroup ref="logout" stepKey="logout"/> </after> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/CheckoutSpecificDestinationsTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/CheckoutSpecificDestinationsTest.xml index f3807388399b8..70a4c64558779 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/CheckoutSpecificDestinationsTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/CheckoutSpecificDestinationsTest.xml @@ -28,13 +28,13 @@ </before> <!--Go to configuration general page--> - <actionGroup ref="NavigateToConfigurationGeneralPage" stepKey="navigateToConfigurationGeneralPage"/> + <actionGroup ref="NavigateToConfigurationGeneralPageActionGroup" stepKey="navigateToConfigurationGeneralPage"/> <!--Open country options section--> <conditionalClick selector="{{CountryOptionsSection.countryOptions}}" dependentSelector="{{CountryOptionsSection.countryOptionsOpen}}" visible="false" stepKey="clickOnStoreInformation"/> <!--Select top destinations country--> - <actionGroup ref="SelectTopDestinationsCountry" stepKey="selectTopDestinationsCountry"> + <actionGroup ref="SelectTopDestinationsCountryActionGroup" stepKey="selectTopDestinationsCountry"> <argument name="countries" value="Countries"/> </actionGroup> @@ -57,13 +57,13 @@ </actionGroup> <!--Go to configuration general page--> - <actionGroup ref="NavigateToConfigurationGeneralPage" stepKey="navigateToConfigurationGeneralPage2"/> + <actionGroup ref="NavigateToConfigurationGeneralPageActionGroup" stepKey="navigateToConfigurationGeneralPage2"/> <!--Open country options section--> <conditionalClick selector="{{CountryOptionsSection.countryOptions}}" dependentSelector="{{CountryOptionsSection.countryOptionsOpen}}" visible="false" stepKey="clickOnStoreInformation2"/> <!--Deselect top destinations country--> - <actionGroup ref="UnSelectTopDestinationsCountry" stepKey="unSelectTopDestinationsCountry"> + <actionGroup ref="UnSelectTopDestinationsCountryActionGroup" stepKey="unSelectTopDestinationsCountry"> <argument name="countries" value="Countries"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutWithoutRegionTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutWithoutRegionTest.xml index 0cc0dcf38e312..81412451d2941 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutWithoutRegionTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutWithoutRegionTest.xml @@ -25,12 +25,12 @@ </createData> <createData entity="Simple_GB_Customer" stepKey="createCustomer"/> <actionGroup stepKey="loginToAdminPanel" ref="LoginAsAdmin"/> - <actionGroup ref="SelectCountriesWithRequiredRegion" stepKey="setCustomCountryWithRequiredRegion"> + <actionGroup ref="SelectCountriesWithRequiredRegionActionGroup" stepKey="setCustomCountryWithRequiredRegion"> <argument name="countries" value="CustomCountryWithRequiredRegion"/> </actionGroup> </before> <after> - <actionGroup ref="SelectCountriesWithRequiredRegion" stepKey="setDefaultCountriesWithRequiredRegion"> + <actionGroup ref="SelectCountriesWithRequiredRegionActionGroup" stepKey="setDefaultCountriesWithRequiredRegion"> <argument name="countries" value="DefaultCountriesWithRequiredRegions"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGBlockTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGBlockTest.xml index 03edc69e6d625..a972c895160fb 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGBlockTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGBlockTest.xml @@ -21,7 +21,7 @@ <createData entity="_defaultCmsPage" stepKey="createCMSPage" /> <createData entity="_defaultBlock" stepKey="createPreReqBlock" /> <actionGroup ref="LoginActionGroup" stepKey="login"/> - <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> + <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> <actionGroup ref="AssignBlockToCMSPage" stepKey="assignBlockToCMSPage"> @@ -62,7 +62,7 @@ <waitForPageLoad stepKey="waitForGridReload"/> <deleteData createDataKey="createPreReqBlock" stepKey="deletePreReqBlock" /> <deleteData createDataKey="createCMSPage" stepKey="deletePreReqCMSPage" /> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> </test> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGCMSTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGCMSTest.xml index 205850f888797..039bd0c7cbc82 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGCMSTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGCMSTest.xml @@ -20,7 +20,7 @@ <before> <createData entity="_defaultCmsPage" stepKey="createCMSPage" /> <actionGroup ref="LoginActionGroup" stepKey="login"/> - <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> + <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> <actionGroup ref="navigateToCreatedCMSPage" stepKey="navigateToCreatedCMSPage"> @@ -56,7 +56,7 @@ <seeElementInDOM selector="{{StorefrontCMSPageSection.imageSource(ImageUpload3.fileName)}}" stepKey="assertMediaSource"/> <after> <deleteData createDataKey="createCMSPage" stepKey="deletePreReqCMSPage" /> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> </test> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddVariableToWYSIWYGBlockTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddVariableToWYSIWYGBlockTest.xml index ce34a8d09c302..6cfe35564297f 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddVariableToWYSIWYGBlockTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddVariableToWYSIWYGBlockTest.xml @@ -21,7 +21,7 @@ <createData entity="_defaultCmsPage" stepKey="createCMSPage" /> <createData entity="_defaultBlock" stepKey="createPreReqBlock" /> <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> - <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> + <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> <!--Create Custom Variable--> @@ -142,7 +142,7 @@ <waitForPageLoad stepKey="waitForGridReload"/> <deleteData createDataKey="createPreReqBlock" stepKey="deletePreReqBlock" /> <deleteData createDataKey="createCMSPage" stepKey="deletePreReqCMSPage" /> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> </test> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddVariableToWYSIWYGCMSTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddVariableToWYSIWYGCMSTest.xml index 3b501859e606e..92164f34f5a83 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddVariableToWYSIWYGCMSTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddVariableToWYSIWYGCMSTest.xml @@ -18,7 +18,7 @@ </annotations> <before> <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> - <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> + <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> <!--Create Custom Variable--> @@ -94,7 +94,7 @@ <!--see custom variable blank--> <dontSee userInput="{{customVariable.html}}" stepKey="dontSeeCustomVariableName" /> <after> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> </test> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGBlockTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGBlockTest.xml index ad5e769c61be4..0242f07edab88 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGBlockTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGBlockTest.xml @@ -21,7 +21,7 @@ <createData entity="_defaultCmsPage" stepKey="createCMSPage" /> <createData entity="_defaultBlock" stepKey="createPreReqBlock" /> <actionGroup ref="LoginActionGroup" stepKey="login"/> - <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> + <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> <actionGroup ref="navigateToCreatedCMSBlockPage" stepKey="navigateToCreatedCMSBlockPage"> @@ -80,7 +80,7 @@ <waitForPageLoad stepKey="waitForGridReload"/> <deleteData createDataKey="createCMSPage" stepKey="deletePreReqCMSPage" /> <deleteData createDataKey="createPreReqBlock" stepKey="deletePreReqBlock" /> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> </test> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeTest.xml index 1adb781a67536..53ed63c89bfb6 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeTest.xml @@ -20,7 +20,7 @@ </annotations> <before> <actionGroup ref="LoginActionGroup" stepKey="login"/> - <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> + <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> <!--Main test--> @@ -66,7 +66,7 @@ <!--see widget on Storefront--> <see userInput="Home page" stepKey="seeHomepageWidget" /> <after> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> </test> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeTest.xml index f37038435e109..c199601231a13 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeTest.xml @@ -21,7 +21,7 @@ <before> <createData entity="_defaultBlock" stepKey="createPreReqBlock" /> <actionGroup ref="LoginActionGroup" stepKey="login"/> - <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> + <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> <!--Main test--> @@ -68,7 +68,7 @@ <see userInput="$$createPreReqBlock.content$$" stepKey="seeBlockLink"/> <after> <deleteData createDataKey="createPreReqBlock" stepKey="deletePreReqBlock" /> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> </test> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeTest.xml index 552eae407391d..0237d3704f7c1 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeTest.xml @@ -20,7 +20,7 @@ <before> <createData entity="_defaultCategory" stepKey="createPreReqCategory"/> <actionGroup ref="LoginActionGroup" stepKey="login"/> - <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> + <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> <actionGroup ref="ConfigAdminAccountSharingActionGroup" stepKey="allowAdminShareAccount"/> </before> @@ -75,7 +75,7 @@ stepKey="seeProductLinkInCategory"/> <after> <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCatalog" /> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <magentoCLI command="config:set catalog/seo/generate_category_product_rewrites 1" stepKey="enableGenerateUrlRewrite"/> <actionGroup ref="logout" stepKey="logout"/> </after> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeTest.xml index d75d422afa2a4..4e7ecd48a6af4 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeTest.xml @@ -24,7 +24,7 @@ <requiredEntity createDataKey="createPreReqCategory"/> </createData> <actionGroup ref="LoginActionGroup" stepKey="login"/> - <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> + <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> <!--Main test--> @@ -82,7 +82,7 @@ <after> <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCatalog" /> <deleteData createDataKey="createPreReqProduct" stepKey="deletePreReqProduct" /> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <magentoCLI command="config:set catalog/seo/generate_category_product_rewrites 1" stepKey="enableGenerateUrlRewrite"/> <actionGroup ref="logout" stepKey="logout"/> </after> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeTest.xml index 394d79bda1ab3..2cd41eb9d9f7b 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeTest.xml @@ -26,7 +26,7 @@ <requiredEntity createDataKey="createPreReqCategory"/> </createData> <actionGroup ref="LoginActionGroup" stepKey="login"/> - <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> + <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> <!--Main test--> @@ -99,7 +99,7 @@ <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCatalog" /> <deleteData createDataKey="createPreReqProduct1" stepKey="deletePreReqProduct1" /> <deleteData createDataKey="createPreReqProduct2" stepKey="deletePreReqProduct2" /> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> </test> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeTest.xml index 862f51ea72fad..803a3b692dbe2 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeTest.xml @@ -25,7 +25,7 @@ <requiredEntity createDataKey="createPreReqCategory"/> </createData> <actionGroup ref="LoginActionGroup" stepKey="login"/> - <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> + <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> <amOnPage url="{{CmsNewPagePage.url}}" stepKey="navigateToPage"/> @@ -82,7 +82,7 @@ <after> <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCatalog" /> <deleteData createDataKey="createPreReqProduct" stepKey="deletePreReqProduct" /> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> </test> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeTest.xml index 298aed917fc18..2c3b060d3bc15 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeTest.xml @@ -24,7 +24,7 @@ <requiredEntity createDataKey="createPreReqCategory"/> </createData> <actionGroup ref="LoginActionGroup" stepKey="login"/> - <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> + <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> <!--Main test--> @@ -72,7 +72,7 @@ <after> <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCatalog" /> <deleteData createDataKey="createPreReqProduct" stepKey="deletePreReqProduct" /> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> </test> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsBlockTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsBlockTest.xml index 7ab0d9209dde3..ef4a7575c35d3 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsBlockTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsBlockTest.xml @@ -20,7 +20,7 @@ </annotations> <before> <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> </before> <after> <actionGroup ref="deleteBlock" stepKey="deleteCreatedBlock"> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsPageTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsPageTest.xml index b7c7e4a4212fe..81c239a58f03e 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsPageTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsPageTest.xml @@ -20,7 +20,7 @@ </annotations> <before> <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> </before> <after> <actionGroup ref="logout" stepKey="adminLogout"/> @@ -90,7 +90,7 @@ </annotations> <before> <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> </before> <after> <actionGroup ref="logout" stepKey="logout"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/CheckOrderOfProdsInWidgetOnCMSPageTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/CheckOrderOfProdsInWidgetOnCMSPageTest.xml index ce093144e6a2a..599276db8e615 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/CheckOrderOfProdsInWidgetOnCMSPageTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/CheckOrderOfProdsInWidgetOnCMSPageTest.xml @@ -21,7 +21,7 @@ </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> + <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="enableTinyMCE4"/> <waitForPageLoad stepKey="waitConfigToSave"/> <createData entity="ApiCategory" stepKey="createFirstCategory"/> @@ -34,7 +34,7 @@ <createData entity="_defaultCmsPage" stepKey="createCMSPage"/> </before> <after> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <deleteData createDataKey="createFirstCategory" stepKey="deleteCategory"/> <deleteData createDataKey="product1" stepKey="deleteProduct1"/> <deleteData createDataKey="product2" stepKey="deleteProduct2"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockTest.xml index 9ee2055aae650..944cd02d87b86 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockTest.xml @@ -21,7 +21,7 @@ <before> <createData entity="_defaultCmsPage" stepKey="createPreReqCMSPage" /> <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> - <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> + <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> <amOnPage url="{{CmsNewBlock.url}}" stepKey="amOnNewBlockPage"/> @@ -90,7 +90,7 @@ <conditionalClick selector="{{CmsPagesPageActionsSection.clearAllButton}}" dependentSelector="{{CmsPagesPageActionsSection.activeFilters}}" stepKey="clickToResetFilter" visible="true"/> <waitForPageLoad stepKey="waitForGridReload"/> <deleteData createDataKey="createPreReqCMSPage" stepKey="deletePreReqCMSPage" /> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> </test> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageTest.xml index caad1cabe78c5..24377e92fe083 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageTest.xml @@ -20,7 +20,7 @@ </annotations> <before> <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> - <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> + <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> <amOnPage url="{{CmsPagesPage.url}}" stepKey="amOnPagePagesGrid"/> @@ -50,7 +50,7 @@ <see userInput="{{_defaultCmsPage.content_heading}}" stepKey="seeContentHeading"/> <see userInput="Hello World!" stepKey="seeContent" /> <after> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> </test> diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/ConfigAdminCatalogSearchActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/ChooseElasticSearchAsSearchEngineActionGroup.xml similarity index 56% rename from app/code/Magento/Config/Test/Mftf/ActionGroup/ConfigAdminCatalogSearchActionGroup.xml rename to app/code/Magento/Config/Test/Mftf/ActionGroup/ChooseElasticSearchAsSearchEngineActionGroup.xml index d700896f08bc0..ad1cf897b4601 100644 --- a/app/code/Magento/Config/Test/Mftf/ActionGroup/ConfigAdminCatalogSearchActionGroup.xml +++ b/app/code/Magento/Config/Test/Mftf/ActionGroup/ChooseElasticSearchAsSearchEngineActionGroup.xml @@ -8,11 +8,11 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="ChooseElasticSearchAsSearchEngine"> + <actionGroup name="ChooseElasticSearchAsSearchEngineActionGroup"> <annotations> <description>Goes to the 'Configuration' page for 'Catalog'. Sets the 'Search Engine' to 'elasticsearch5'. Clicks on the Save button. PLEASE NOTE: The value is Hardcoded.</description> </annotations> - + <amOnPage url="{{AdminCatalogSearchConfigurationPage.url}}" stepKey="configureSearchEngine"/> <waitForPageLoad stepKey="waitForConfigPage"/> <scrollTo selector="{{AdminCatalogSearchConfigurationSection.catalogSearchTab}}" stepKey="scrollToCatalogSearchTab"/> @@ -25,20 +25,4 @@ <click selector="{{ContentManagementSection.Save}}" stepKey="saveConfiguration"/> <see selector="{{AdminMessagesSection.success}}" userInput="You saved the configuration." stepKey="seeConfigurationSuccessMessage"/> </actionGroup> - - <actionGroup name="ResetSearchEngineConfiguration"> - <annotations> - <description>Goes to the 'Configuration' page for 'Catalog'. Sets the 'Search Engine' to 'mysql'. Clicks on the Save button. PLEASE NOTE: The value is Hardcoded.</description> - </annotations> - - <amOnPage url="{{AdminCatalogSearchConfigurationPage.url}}" stepKey="resetSearchEngine"/> - <waitForPageLoad stepKey="waitForConfigPage2"/> - <scrollTo selector="{{AdminCatalogSearchConfigurationSection.catalogSearchTab}}" stepKey="scrollToCatalogSearchTab2"/> - <conditionalClick selector="{{AdminCatalogSearchConfigurationSection.catalogSearchTab}}" dependentSelector="{{AdminCatalogSearchConfigurationSection.checkIfCatalogSearchTabExpand}}" visible="true" stepKey="expandCatalogSearchTab2"/> - <waitForElementVisible selector="{{AdminCatalogSearchConfigurationSection.searchEngine}}" stepKey="waitForDropdownToBeVisible2"/> - <selectOption selector="{{AdminCatalogSearchConfigurationSection.searchEngine}}" userInput="mysql" stepKey="chooseMySQL"/> - <checkOption selector="{{AdminCatalogSearchConfigurationSection.searchEngineDefaultSystemValue}}" stepKey="checkUseSystemValue"/> - <click selector="{{ContentManagementSection.Save}}" stepKey="saveConfiguration2"/> - <see selector="{{AdminMessagesSection.success}}" userInput="You saved the configuration." stepKey="seeConfigurationSuccessMessage2"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/ConfigAdminAccountSharingActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/ConfigAdminAccountSharingActionGroup.xml index 01cfa30ce0e7f..4e11dd6e971de 100644 --- a/app/code/Magento/Config/Test/Mftf/ActionGroup/ConfigAdminAccountSharingActionGroup.xml +++ b/app/code/Magento/Config/Test/Mftf/ActionGroup/ConfigAdminAccountSharingActionGroup.xml @@ -22,20 +22,4 @@ <click selector="{{AdminSection.SecurityTab}}" stepKey="clollapseSecurityTab"/> <click selector="{{ContentManagementSection.Save}}" stepKey="saveConfig"/> </actionGroup> - - <actionGroup name="EnableAdminAccountSharingActionGroup"> - <annotations> - <description>Enabled 'Admin Account Sharing' via the API.</description> - </annotations> - - <createData stepKey="setConfig" entity="EnableAdminAccountSharing"/> - </actionGroup> - - <actionGroup name="DisableAdminAccountSharingActionGroup"> - <annotations> - <description>Disables 'Admin Account Sharing' via the API.</description> - </annotations> - - <createData stepKey="setConfig" entity="DisableAdminAccountSharing"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/ConfigSalesTaxClassActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/ConfigSalesTaxClassActionGroup.xml deleted file mode 100644 index bfa42636519a0..0000000000000 --- a/app/code/Magento/Config/Test/Mftf/ActionGroup/ConfigSalesTaxClassActionGroup.xml +++ /dev/null @@ -1,78 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="SetTaxClassForShipping"> - <annotations> - <description>Goes to the 'Configuration' page for 'Tax'. Sets 'Tax Class for Shipping' to 'Taxable Goods'. Clicks on the Save button. PLEASE NOTE: The value is Hardcoded.</description> - </annotations> - - <amOnPage url="{{AdminSalesTaxClassPage.url}}" stepKey="navigateToSalesTaxPage"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <conditionalClick selector="{{SalesConfigSection.TaxClassesTab}}" dependentSelector="{{SalesConfigSection.CheckIfTaxClassesTabExpand}}" visible="true" stepKey="expandTaxClassesTab"/> - <waitForElementVisible selector="{{SalesConfigSection.ShippingTaxClass}}" stepKey="seeShippingTaxClass"/> - <uncheckOption selector="{{SalesConfigSection.EnableTaxClassForShipping}}" stepKey="uncheckUseSystemValue"/> - <selectOption selector="{{SalesConfigSection.ShippingTaxClass}}" userInput="Taxable Goods" stepKey="setShippingTaxClass"/> - <click selector="{{SalesConfigSection.TaxClassesTab}}" stepKey="collapseTaxClassesTab"/> - <click selector="{{ContentManagementSection.Save}}" stepKey="saveConfig"/> - </actionGroup> - - <actionGroup name="ResetTaxClassForShipping"> - <annotations> - <description>Goes to the 'Configuration' page for 'Tax'. Sets 'Tax Class for Shipping' to 'None'. Clicks on the Save button. PLEASE NOTE: The value is Hardcoded.</description> - </annotations> - - <amOnPage url="{{AdminSalesTaxClassPage.url}}" stepKey="navigateToSalesTaxConfigPagetoReset"/> - <waitForPageLoad stepKey="waitForPageLoad2"/> - <conditionalClick selector="{{SalesConfigSection.TaxClassesTab}}" dependentSelector="{{SalesConfigSection.CheckIfTaxClassesTabExpand}}" visible="true" stepKey="openTaxClassTab"/> - <waitForElementVisible selector="{{SalesConfigSection.ShippingTaxClass}}" stepKey="seeShippingTaxClass2"/> - <selectOption selector="{{SalesConfigSection.ShippingTaxClass}}" userInput="None" stepKey="resetShippingTaxClass"/> - <checkOption selector="{{SalesConfigSection.EnableTaxClassForShipping}}" stepKey="useSystemValue"/> - <click selector="{{SalesConfigSection.TaxClassesTab}}" stepKey="collapseTaxClassesTab"/> - <click selector="{{ContentManagementSection.Save}}" stepKey="saveConfiguration"/> - </actionGroup> - - <actionGroup name="SetTaxApplyOnSetting"> - <annotations> - <description>Goes to the 'Configuration' page for 'Tax'. Sets 'Apply Tax On' to the provided value. Clicks on the Save button</description> - </annotations> - <arguments> - <argument name="userInput" type="string"/> - </arguments> - - <conditionalClick selector="{{AdminConfigureTaxSection.taxCalculationSettings}}" dependentSelector="{{AdminConfigureTaxSection.taxCalculationAlgorithm}}" visible="false" stepKey="openTaxCalcSettingsSection"/> - <scrollTo selector="{{AdminConfigureTaxSection.taxCalculationApplyTaxOnInherit}}" x="0" y="-80" stepKey="goToCheckbox"/> - <uncheckOption selector="{{AdminConfigureTaxSection.taxCalculationApplyTaxOnInherit}}" stepKey="enableApplyTaxOnSetting"/> - <selectOption selector="{{AdminConfigureTaxSection.taxCalculationApplyTaxOn}}" userInput="{{userInput}}" stepKey="setApplyTaxOn"/> - <scrollTo selector="{{SalesConfigSection.TaxClassesTab}}" stepKey="scrollToTop"/> - <click selector="{{AdminConfigureTaxSection.taxCalculationSettings}}" stepKey="collapseCalcSettingsTab"/> - <click selector="{{AdminConfigureTaxSection.save}}" stepKey="saveConfig"/> - <waitForPageLoad stepKey="waitForConfigSaved"/> - <see userInput="You saved the configuration." stepKey="seeSuccessMessage"/> - </actionGroup> - - <actionGroup name="DisableTaxApplyOnOriginalPrice"> - <annotations> - <description>Goes to the 'Configuration' page for 'Tax'. Sets 'Apply Tax On' to the provided value. Clicks on the Save button.</description> - </annotations> - <arguments> - <argument name="userInput" type="string"/> - </arguments> - - <amOnPage url="{{AdminSalesTaxClassPage.url}}" stepKey="navigateToSalesTaxPage"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <conditionalClick selector="{{AdminConfigureTaxSection.taxCalculationSettings}}" dependentSelector="{{AdminConfigureTaxSection.taxCalculationAlgorithm}}" visible="false" stepKey="openTaxCalcSettingsSection"/> - <scrollTo selector="{{AdminConfigureTaxSection.taxCalculationApplyTaxOnInherit}}" x="0" y="-80" stepKey="goToCheckbox"/> - <selectOption selector="{{AdminConfigureTaxSection.taxCalculationApplyTaxOn}}" userInput="{{userInput}}" stepKey="setApplyTaxOff"/> - <checkOption selector="{{AdminConfigureTaxSection.taxCalculationApplyTaxOnInherit}}" stepKey="disableApplyTaxOnSetting"/> - <click selector="{{AdminConfigureTaxSection.save}}" stepKey="saveConfig"/> - <waitForPageLoad stepKey="waitForConfigSaved"/> - <see userInput="You saved the configuration." stepKey="seeSuccessMessage"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/ConfigWYSIWYGActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/ConfigWYSIWYGActionGroup.xml deleted file mode 100644 index 342b98a64c828..0000000000000 --- a/app/code/Magento/Config/Test/Mftf/ActionGroup/ConfigWYSIWYGActionGroup.xml +++ /dev/null @@ -1,76 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="EnabledWYSIWYG"> - <annotations> - <description>Enables the WYSIWYG Editor via the CLI.</description> - </annotations> - - <magentoCLI stepKey="enableWYSIWYG" command="config:set cms/wysiwyg/enabled enabled"/> - </actionGroup> - - <actionGroup name="SwitchToTinyMCE3"> - <annotations> - <description>Goes to the 'Configuration' page for 'Content Management'. Sets 'WYSIWYG Editor' to 'TinyMCE 3'. Clicks on the Save button. PLEASE NOTE: The value is Hardcoded.</description> - </annotations> - - <comment userInput="Choose TinyMCE3 as the default editor" stepKey="chooseTinyMCE3AsEditor"/> - <conditionalClick stepKey="expandWYSIWYGOptions1" selector="{{ContentManagementSection.WYSIWYGOptions}}" dependentSelector="{{ContentManagementSection.CheckIfTabExpand}}" visible="true"/> - <waitForElementVisible selector="{{ContentManagementSection.SwitcherSystemValue}}" stepKey="waitForCheckbox2"/> - <uncheckOption selector="{{ContentManagementSection.SwitcherSystemValue}}" stepKey="uncheckUseSystemValue2"/> - <waitForElementVisible selector="{{ContentManagementSection.Switcher}}" stepKey="waitForSwitcherDropdown2"/> - <selectOption selector="{{ContentManagementSection.Switcher}}" userInput="TinyMCE 3" stepKey="switchToVersion3"/> - <click selector="{{ContentManagementSection.WYSIWYGOptions}}" stepKey="collapseWYSIWYGOptions"/> - <click selector="{{ContentManagementSection.Save}}" stepKey="saveConfig"/> - <see selector="{{AdminMessagesSection.success}}" userInput="You saved the configuration." stepKey="seeConfigurationSuccessMessage"/> - </actionGroup> - - <actionGroup name="DisabledWYSIWYG"> - <annotations> - <description>Disables the WYSIWYG Editor via the CLI.</description> - </annotations> - - <magentoCLI stepKey="disableWYSIWYG" command="config:set cms/wysiwyg/enabled disabled"/> - </actionGroup> - - <actionGroup name="UseStaticURLForMediaContentInWYSIWYG"> - <annotations> - <description>Goes to the 'Configuration' page for 'Content Management'. Sets 'Use Static URLs for Media Content in WYSIWYG' to the provided value. Clicks on the Save button.</description> - </annotations> - <arguments> - <argument name="value" defaultValue="Yes" type="string"/> - </arguments> - - <amOnPage url="{{ConfigurationStoresPage.url}}" stepKey="navigateToWYSIWYGConfigPage1"/> - <waitForPageLoad stepKey="waitForPageLoad1"/> - <conditionalClick stepKey="expandWYSIWYGOptions" selector="{{ContentManagementSection.WYSIWYGOptions}}" dependentSelector="{{ContentManagementSection.CheckIfTabExpand}}" visible="true"/> - <waitForElementVisible selector="{{ContentManagementSection.EnableWYSIWYG}}" stepKey="waitForEnableWYSIWYGDropdown1"/> - <selectOption selector="{{ContentManagementSection.StaticURL}}" userInput="{{value}}" stepKey="selectOption1"/> - <click selector="{{ContentManagementSection.WYSIWYGOptions}}" stepKey="collapseWYSIWYGOptions"/> - <click selector="{{ContentManagementSection.Save}}" stepKey="saveConfig"/> - <waitForPageLoad stepKey="waitForPageLoad2"/> - </actionGroup> - - <actionGroup name="EnabledWYSIWYGEditor"> - <annotations> - <description>Goes to the 'Configuration' page for 'Content Management'. Sets 'Enable WYSIWYG Editor' to 'Enabled by Default'. Clicks on the Save button. PLEASE NOTE: The value is Hardcoded.</description> - </annotations> - - <amOnPage url="{{AdminContentManagementPage.url}}" stepKey="navigateToConfigurationPage"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <conditionalClick selector="{{ContentManagementSection.WYSIWYGOptions}}" dependentSelector="{{ContentManagementSection.EnableWYSIWYG}}" visible="false" stepKey="expandWYSIWYGOptionsTab"/> - <waitForElementVisible selector="{{ContentManagementSection.EnableWYSIWYG}}" stepKey="waitTabToExpand"/> - <uncheckOption selector="{{ContentManagementSection.EnableSystemValue}}" stepKey="enableEnableSystemValue"/> - <selectOption selector="{{ContentManagementSection.EnableWYSIWYG}}" userInput="Enabled by Default" stepKey="enableWYSIWYG"/> - <click selector="{{ContentManagementSection.WYSIWYGOptions}}" stepKey="collapseWYSIWYGOptionsTab"/> - <click selector="{{ContentManagementSection.Save}}" stepKey="clickSaveConfig"/> - <see stepKey="seeSuccess" selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the configuration."/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/DisableAdminAccountSharingActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/DisableAdminAccountSharingActionGroup.xml new file mode 100644 index 0000000000000..5bc9cca7d171f --- /dev/null +++ b/app/code/Magento/Config/Test/Mftf/ActionGroup/DisableAdminAccountSharingActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DisableAdminAccountSharingActionGroup"> + <annotations> + <description>Disables 'Admin Account Sharing' via the API.</description> + </annotations> + + <createData stepKey="setConfig" entity="DisableAdminAccountSharing"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/DisableTaxApplyOnOriginalPriceActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/DisableTaxApplyOnOriginalPriceActionGroup.xml new file mode 100644 index 0000000000000..c27fc6a93ca5a --- /dev/null +++ b/app/code/Magento/Config/Test/Mftf/ActionGroup/DisableTaxApplyOnOriginalPriceActionGroup.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DisableTaxApplyOnOriginalPriceActionGroup"> + <annotations> + <description>Goes to the 'Configuration' page for 'Tax'. Sets 'Apply Tax On' to the provided value. Clicks on the Save button.</description> + </annotations> + <arguments> + <argument name="userInput" type="string"/> + </arguments> + + <amOnPage url="{{AdminSalesTaxClassPage.url}}" stepKey="navigateToSalesTaxPage"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <conditionalClick selector="{{AdminConfigureTaxSection.taxCalculationSettings}}" dependentSelector="{{AdminConfigureTaxSection.taxCalculationAlgorithm}}" visible="false" stepKey="openTaxCalcSettingsSection"/> + <scrollTo selector="{{AdminConfigureTaxSection.taxCalculationApplyTaxOnInherit}}" x="0" y="-80" stepKey="goToCheckbox"/> + <selectOption selector="{{AdminConfigureTaxSection.taxCalculationApplyTaxOn}}" userInput="{{userInput}}" stepKey="setApplyTaxOff"/> + <checkOption selector="{{AdminConfigureTaxSection.taxCalculationApplyTaxOnInherit}}" stepKey="disableApplyTaxOnSetting"/> + <click selector="{{AdminConfigureTaxSection.save}}" stepKey="saveConfig"/> + <waitForPageLoad stepKey="waitForConfigSaved"/> + <see userInput="You saved the configuration." stepKey="seeSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/DisabledWYSIWYGActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/DisabledWYSIWYGActionGroup.xml new file mode 100644 index 0000000000000..f1b817711d6b1 --- /dev/null +++ b/app/code/Magento/Config/Test/Mftf/ActionGroup/DisabledWYSIWYGActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DisabledWYSIWYGActionGroup"> + <annotations> + <description>Disables the WYSIWYG Editor via the CLI.</description> + </annotations> + + <magentoCLI stepKey="disableWYSIWYG" command="config:set cms/wysiwyg/enabled disabled"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/EnableAdminAccountSharingActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/EnableAdminAccountSharingActionGroup.xml new file mode 100644 index 0000000000000..5541a1e48a0af --- /dev/null +++ b/app/code/Magento/Config/Test/Mftf/ActionGroup/EnableAdminAccountSharingActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="EnableAdminAccountSharingActionGroup"> + <annotations> + <description>Enabled 'Admin Account Sharing' via the API.</description> + </annotations> + + <createData stepKey="setConfig" entity="EnableAdminAccountSharing"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/EnableWebUrlOptionsActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/EnableWebUrlOptionsActionGroup.xml new file mode 100644 index 0000000000000..2e4fdf0debd79 --- /dev/null +++ b/app/code/Magento/Config/Test/Mftf/ActionGroup/EnableWebUrlOptionsActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="EnableWebUrlOptionsActionGroup"> + <annotations> + <description>Goes to the 'Configuration' page for 'Url Options'. Enables 'Add Store Code to Urls'. Clicks on the Save button.</description> + </annotations> + + <amOnPage url="{{WebConfigurationPage.url}}" stepKey="navigateToWebConfigurationPage"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <conditionalClick selector="{{WebSection.UrlOptionsTab}}" dependentSelector="{{WebSection.CheckIfUrlOptionsTabExpand}}" visible="true" stepKey="expandUrlSectionTab"/> + <waitForElementVisible selector="{{UrlOptionsSection.addStoreCodeToUrl}}" stepKey="seeAddStoreCodeToUrl"/> + <uncheckOption selector="{{UrlOptionsSection.systemValueForStoreCode}}" stepKey="uncheckUseSystemValue"/> + <selectOption selector="{{UrlOptionsSection.addStoreCodeToUrl}}" userInput="Yes" stepKey="enableStoreCode"/> + <click selector="{{WebSection.UrlOptionsTab}}" stepKey="collapseUrlOptions"/> + <click selector="{{ContentManagementSection.Save}}" stepKey="saveConfig"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/EnabledWYSIWYGActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/EnabledWYSIWYGActionGroup.xml new file mode 100644 index 0000000000000..556b8bdcf9736 --- /dev/null +++ b/app/code/Magento/Config/Test/Mftf/ActionGroup/EnabledWYSIWYGActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="EnabledWYSIWYGActionGroup"> + <annotations> + <description>Enables the WYSIWYG Editor via the CLI.</description> + </annotations> + + <magentoCLI stepKey="enableWYSIWYG" command="config:set cms/wysiwyg/enabled enabled"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/EnabledWYSIWYGEditorActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/EnabledWYSIWYGEditorActionGroup.xml new file mode 100644 index 0000000000000..7d23a5d7581c5 --- /dev/null +++ b/app/code/Magento/Config/Test/Mftf/ActionGroup/EnabledWYSIWYGEditorActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="EnabledWYSIWYGEditorActionGroup"> + <annotations> + <description>Goes to the 'Configuration' page for 'Content Management'. Sets 'Enable WYSIWYG Editor' to 'Enabled by Default'. Clicks on the Save button. PLEASE NOTE: The value is Hardcoded.</description> + </annotations> + + <amOnPage url="{{AdminContentManagementPage.url}}" stepKey="navigateToConfigurationPage"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <conditionalClick selector="{{ContentManagementSection.WYSIWYGOptions}}" dependentSelector="{{ContentManagementSection.EnableWYSIWYG}}" visible="false" stepKey="expandWYSIWYGOptionsTab"/> + <waitForElementVisible selector="{{ContentManagementSection.EnableWYSIWYG}}" stepKey="waitTabToExpand"/> + <uncheckOption selector="{{ContentManagementSection.EnableSystemValue}}" stepKey="enableEnableSystemValue"/> + <selectOption selector="{{ContentManagementSection.EnableWYSIWYG}}" userInput="Enabled by Default" stepKey="enableWYSIWYG"/> + <click selector="{{ContentManagementSection.WYSIWYGOptions}}" stepKey="collapseWYSIWYGOptionsTab"/> + <click selector="{{ContentManagementSection.Save}}" stepKey="clickSaveConfig"/> + <see stepKey="seeSuccess" selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the configuration."/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/GeneralConfigurationActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/GeneralConfigurationActionGroup.xml deleted file mode 100644 index d65376828e2c4..0000000000000 --- a/app/code/Magento/Config/Test/Mftf/ActionGroup/GeneralConfigurationActionGroup.xml +++ /dev/null @@ -1,72 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="NavigateToDefaultLayoutsSetting"> - <annotations> - <description>Goes to the 'Configuration' page for 'Web'. Expands the 'Default Layouts' section.</description> - </annotations> - - <amOnPage url="{{WebConfigurationPage.url}}" stepKey="navigateToWebConfigurationPage"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <conditionalClick stepKey="expandDefaultLayouts" selector="{{WebSection.DefaultLayoutsTab}}" dependentSelector="{{WebSection.CheckIfTabExpand}}" visible="true"/> - <waitForElementVisible selector="{{DefaultLayoutsSection.categoryLayout}}" stepKey="waittForDefaultCategoryLayout"/> - </actionGroup> - - <actionGroup name="NavigateToConfigurationGeneralPage"> - <annotations> - <description>Goes to the 'Configuration' page for 'General'.</description> - </annotations> - - <amOnPage url="{{AdminConfigGeneralPage.url}}" stepKey="navigateToConfigGeneralPage"/> - <waitForPageLoad stepKey="waitForConfigPageLoad"/> - </actionGroup> - <actionGroup name="SelectTopDestinationsCountry"> - <annotations> - <description>Selects the provided Countries under 'Top destinations' on the 'General' section of the 'Configuration' page. Clicks on the Save button.</description> - </annotations> - <arguments> - <argument name="countries" type="entity"/> - </arguments> - - <selectOption selector="{{CountryOptionsSection.topDestinations}}" parameterArray="[{{countries.country}}]" stepKey="selectTopDestinationsCountry"/> - <click selector="#save" stepKey="saveConfig"/> - <waitForPageLoad stepKey="waitForSavingConfig"/> - </actionGroup> - - <actionGroup name="UnSelectTopDestinationsCountry"> - <annotations> - <description>Un-selects the provided Countries under 'Top destinations' on the 'General' section of the 'Configuration' page. Clicks on the Save button.</description> - </annotations> - <arguments> - <argument name="countries" type="entity"/> - </arguments> - - <unselectOption selector="{{CountryOptionsSection.topDestinations}}" parameterArray="[{{countries.country}}]" stepKey="unSelectTopDestinationsCountry"/> - <click selector="#save" stepKey="saveConfig"/> - <waitForPageLoad stepKey="waitForSavingConfig"/> - </actionGroup> - - <actionGroup name="SelectCountriesWithRequiredRegion"> - <annotations> - <description>Goes to the 'Configuration' page for 'General'. Selects the provided Countries under 'State is Required for'. Clicks on the Save button.</description> - </annotations> - <arguments> - <argument name="countries" type="entity"/> - </arguments> - - <amOnPage url="{{AdminConfigGeneralPage.url}}" stepKey="navigateToAdminConfigGeneralPage"/> - <conditionalClick selector="{{StateOptionsSection.stateOptions}}" dependentSelector="{{StateOptionsSection.countriesWithRequiredRegions}}" visible="false" stepKey="expandStateOptionsTab"/> - <waitForAjaxLoad stepKey="waitForAjax"/> - <scrollTo selector="{{StateOptionsSection.countriesWithRequiredRegions}}" stepKey="scrollToForm"/> - <selectOption selector="{{StateOptionsSection.countriesWithRequiredRegions}}" parameterArray="[{{countries.country}}]" stepKey="selectCountriesWithRequiredRegion"/> - <click selector="#save" stepKey="saveConfig"/> - <waitForPageLoad stepKey="waitForSavingConfig"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/NavigateToConfigurationGeneralPageActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/NavigateToConfigurationGeneralPageActionGroup.xml new file mode 100644 index 0000000000000..fb89b406d9f32 --- /dev/null +++ b/app/code/Magento/Config/Test/Mftf/ActionGroup/NavigateToConfigurationGeneralPageActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="NavigateToConfigurationGeneralPageActionGroup"> + <annotations> + <description>Goes to the 'Configuration' page for 'General'.</description> + </annotations> + + <amOnPage url="{{AdminConfigGeneralPage.url}}" stepKey="navigateToConfigGeneralPage"/> + <waitForPageLoad stepKey="waitForConfigPageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/NavigateToDefaultLayoutsSettingActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/NavigateToDefaultLayoutsSettingActionGroup.xml new file mode 100644 index 0000000000000..c6690632194b3 --- /dev/null +++ b/app/code/Magento/Config/Test/Mftf/ActionGroup/NavigateToDefaultLayoutsSettingActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="NavigateToDefaultLayoutsSettingActionGroup"> + <annotations> + <description>Goes to the 'Configuration' page for 'Web'. Expands the 'Default Layouts' section.</description> + </annotations> + + <amOnPage url="{{WebConfigurationPage.url}}" stepKey="navigateToWebConfigurationPage"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <conditionalClick stepKey="expandDefaultLayouts" selector="{{WebSection.DefaultLayoutsTab}}" dependentSelector="{{WebSection.CheckIfTabExpand}}" visible="true"/> + <waitForElementVisible selector="{{DefaultLayoutsSection.categoryLayout}}" stepKey="waittForDefaultCategoryLayout"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/ResetSearchEngineConfigurationActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/ResetSearchEngineConfigurationActionGroup.xml new file mode 100644 index 0000000000000..f6451a4171a59 --- /dev/null +++ b/app/code/Magento/Config/Test/Mftf/ActionGroup/ResetSearchEngineConfigurationActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ResetSearchEngineConfigurationActionGroup"> + <annotations> + <description>Goes to the 'Configuration' page for 'Catalog'. Sets the 'Search Engine' to 'mysql'. Clicks on the Save button. PLEASE NOTE: The value is Hardcoded.</description> + </annotations> + + <amOnPage url="{{AdminCatalogSearchConfigurationPage.url}}" stepKey="resetSearchEngine"/> + <waitForPageLoad stepKey="waitForConfigPage2"/> + <scrollTo selector="{{AdminCatalogSearchConfigurationSection.catalogSearchTab}}" stepKey="scrollToCatalogSearchTab2"/> + <conditionalClick selector="{{AdminCatalogSearchConfigurationSection.catalogSearchTab}}" dependentSelector="{{AdminCatalogSearchConfigurationSection.checkIfCatalogSearchTabExpand}}" visible="true" stepKey="expandCatalogSearchTab2"/> + <waitForElementVisible selector="{{AdminCatalogSearchConfigurationSection.searchEngine}}" stepKey="waitForDropdownToBeVisible2"/> + <selectOption selector="{{AdminCatalogSearchConfigurationSection.searchEngine}}" userInput="mysql" stepKey="chooseMySQL"/> + <checkOption selector="{{AdminCatalogSearchConfigurationSection.searchEngineDefaultSystemValue}}" stepKey="checkUseSystemValue"/> + <click selector="{{ContentManagementSection.Save}}" stepKey="saveConfiguration2"/> + <see selector="{{AdminMessagesSection.success}}" userInput="You saved the configuration." stepKey="seeConfigurationSuccessMessage2"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/ResetTaxClassForShippingActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/ResetTaxClassForShippingActionGroup.xml new file mode 100644 index 0000000000000..3f768bdac8055 --- /dev/null +++ b/app/code/Magento/Config/Test/Mftf/ActionGroup/ResetTaxClassForShippingActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ResetTaxClassForShippingActionGroup"> + <annotations> + <description>Goes to the 'Configuration' page for 'Tax'. Sets 'Tax Class for Shipping' to 'None'. Clicks on the Save button. PLEASE NOTE: The value is Hardcoded.</description> + </annotations> + + <amOnPage url="{{AdminSalesTaxClassPage.url}}" stepKey="navigateToSalesTaxConfigPagetoReset"/> + <waitForPageLoad stepKey="waitForPageLoad2"/> + <conditionalClick selector="{{SalesConfigSection.TaxClassesTab}}" dependentSelector="{{SalesConfigSection.CheckIfTaxClassesTabExpand}}" visible="true" stepKey="openTaxClassTab"/> + <waitForElementVisible selector="{{SalesConfigSection.ShippingTaxClass}}" stepKey="seeShippingTaxClass2"/> + <selectOption selector="{{SalesConfigSection.ShippingTaxClass}}" userInput="None" stepKey="resetShippingTaxClass"/> + <checkOption selector="{{SalesConfigSection.EnableTaxClassForShipping}}" stepKey="useSystemValue"/> + <click selector="{{SalesConfigSection.TaxClassesTab}}" stepKey="collapseTaxClassesTab"/> + <click selector="{{ContentManagementSection.Save}}" stepKey="saveConfiguration"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/ConfigWebUrlOptionsActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/ResetWebUrlOptionsActionGroup.xml similarity index 56% rename from app/code/Magento/Config/Test/Mftf/ActionGroup/ConfigWebUrlOptionsActionGroup.xml rename to app/code/Magento/Config/Test/Mftf/ActionGroup/ResetWebUrlOptionsActionGroup.xml index fe297cbf9ad7d..8c403c95cacbc 100644 --- a/app/code/Magento/Config/Test/Mftf/ActionGroup/ConfigWebUrlOptionsActionGroup.xml +++ b/app/code/Magento/Config/Test/Mftf/ActionGroup/ResetWebUrlOptionsActionGroup.xml @@ -8,26 +8,11 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="EnableWebUrlOptions"> - <annotations> - <description>Goes to the 'Configuration' page for 'Url Options'. Enables 'Add Store Code to Urls'. Clicks on the Save button.</description> - </annotations> - - <amOnPage url="{{WebConfigurationPage.url}}" stepKey="navigateToWebConfigurationPage"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <conditionalClick selector="{{WebSection.UrlOptionsTab}}" dependentSelector="{{WebSection.CheckIfUrlOptionsTabExpand}}" visible="true" stepKey="expandUrlSectionTab"/> - <waitForElementVisible selector="{{UrlOptionsSection.addStoreCodeToUrl}}" stepKey="seeAddStoreCodeToUrl"/> - <uncheckOption selector="{{UrlOptionsSection.systemValueForStoreCode}}" stepKey="uncheckUseSystemValue"/> - <selectOption selector="{{UrlOptionsSection.addStoreCodeToUrl}}" userInput="Yes" stepKey="enableStoreCode"/> - <click selector="{{WebSection.UrlOptionsTab}}" stepKey="collapseUrlOptions"/> - <click selector="{{ContentManagementSection.Save}}" stepKey="saveConfig"/> - </actionGroup> - - <actionGroup name="ResetWebUrlOptions"> + <actionGroup name="ResetWebUrlOptionsActionGroup"> <annotations> <description>Goes to the 'Configuration' page for 'Url Options'. Disables 'Add Store Code to Urls'. Clicks on the Save button.</description> </annotations> - + <amOnPage url="{{WebConfigurationPage.url}}" stepKey="navigateToWebConfigurationPagetoReset"/> <waitForPageLoad stepKey="waitForPageLoad2"/> <conditionalClick selector="{{WebSection.UrlOptionsTab}}" dependentSelector="{{WebSection.CheckIfUrlOptionsTabExpand}}" visible="true" stepKey="closeUrlSectionTab"/> diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/SelectCountriesWithRequiredRegionActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/SelectCountriesWithRequiredRegionActionGroup.xml new file mode 100644 index 0000000000000..c1e90c1c835b8 --- /dev/null +++ b/app/code/Magento/Config/Test/Mftf/ActionGroup/SelectCountriesWithRequiredRegionActionGroup.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SelectCountriesWithRequiredRegionActionGroup"> + <annotations> + <description>Goes to the 'Configuration' page for 'General'. Selects the provided Countries under 'State is Required for'. Clicks on the Save button.</description> + </annotations> + <arguments> + <argument name="countries" type="entity"/> + </arguments> + + <amOnPage url="{{AdminConfigGeneralPage.url}}" stepKey="navigateToAdminConfigGeneralPage"/> + <conditionalClick selector="{{StateOptionsSection.stateOptions}}" dependentSelector="{{StateOptionsSection.countriesWithRequiredRegions}}" visible="false" stepKey="expandStateOptionsTab"/> + <waitForAjaxLoad stepKey="waitForAjax"/> + <scrollTo selector="{{StateOptionsSection.countriesWithRequiredRegions}}" stepKey="scrollToForm"/> + <selectOption selector="{{StateOptionsSection.countriesWithRequiredRegions}}" parameterArray="[{{countries.country}}]" stepKey="selectCountriesWithRequiredRegion"/> + <click selector="#save" stepKey="saveConfig"/> + <waitForPageLoad stepKey="waitForSavingConfig"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/SelectTopDestinationsCountryActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/SelectTopDestinationsCountryActionGroup.xml new file mode 100644 index 0000000000000..8e44bbf912667 --- /dev/null +++ b/app/code/Magento/Config/Test/Mftf/ActionGroup/SelectTopDestinationsCountryActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SelectTopDestinationsCountryActionGroup"> + <annotations> + <description>Selects the provided Countries under 'Top destinations' on the 'General' section of the 'Configuration' page. Clicks on the Save button.</description> + </annotations> + <arguments> + <argument name="countries" type="entity"/> + </arguments> + + <selectOption selector="{{CountryOptionsSection.topDestinations}}" parameterArray="[{{countries.country}}]" stepKey="selectTopDestinationsCountry"/> + <click selector="#save" stepKey="saveConfig"/> + <waitForPageLoad stepKey="waitForSavingConfig"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/SetTaxApplyOnSettingActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/SetTaxApplyOnSettingActionGroup.xml new file mode 100644 index 0000000000000..f91575b052ac7 --- /dev/null +++ b/app/code/Magento/Config/Test/Mftf/ActionGroup/SetTaxApplyOnSettingActionGroup.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SetTaxApplyOnSettingActionGroup"> + <annotations> + <description>Goes to the 'Configuration' page for 'Tax'. Sets 'Apply Tax On' to the provided value. Clicks on the Save button</description> + </annotations> + <arguments> + <argument name="userInput" type="string"/> + </arguments> + + <conditionalClick selector="{{AdminConfigureTaxSection.taxCalculationSettings}}" dependentSelector="{{AdminConfigureTaxSection.taxCalculationAlgorithm}}" visible="false" stepKey="openTaxCalcSettingsSection"/> + <scrollTo selector="{{AdminConfigureTaxSection.taxCalculationApplyTaxOnInherit}}" x="0" y="-80" stepKey="goToCheckbox"/> + <uncheckOption selector="{{AdminConfigureTaxSection.taxCalculationApplyTaxOnInherit}}" stepKey="enableApplyTaxOnSetting"/> + <selectOption selector="{{AdminConfigureTaxSection.taxCalculationApplyTaxOn}}" userInput="{{userInput}}" stepKey="setApplyTaxOn"/> + <scrollTo selector="{{SalesConfigSection.TaxClassesTab}}" stepKey="scrollToTop"/> + <click selector="{{AdminConfigureTaxSection.taxCalculationSettings}}" stepKey="collapseCalcSettingsTab"/> + <click selector="{{AdminConfigureTaxSection.save}}" stepKey="saveConfig"/> + <waitForPageLoad stepKey="waitForConfigSaved"/> + <see userInput="You saved the configuration." stepKey="seeSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/SetTaxClassForShippingActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/SetTaxClassForShippingActionGroup.xml new file mode 100644 index 0000000000000..a0f05405ba0c9 --- /dev/null +++ b/app/code/Magento/Config/Test/Mftf/ActionGroup/SetTaxClassForShippingActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SetTaxClassForShippingActionGroup"> + <annotations> + <description>Goes to the 'Configuration' page for 'Tax'. Sets 'Tax Class for Shipping' to 'Taxable Goods'. Clicks on the Save button. PLEASE NOTE: The value is Hardcoded.</description> + </annotations> + + <amOnPage url="{{AdminSalesTaxClassPage.url}}" stepKey="navigateToSalesTaxPage"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <conditionalClick selector="{{SalesConfigSection.TaxClassesTab}}" dependentSelector="{{SalesConfigSection.CheckIfTaxClassesTabExpand}}" visible="true" stepKey="expandTaxClassesTab"/> + <waitForElementVisible selector="{{SalesConfigSection.ShippingTaxClass}}" stepKey="seeShippingTaxClass"/> + <uncheckOption selector="{{SalesConfigSection.EnableTaxClassForShipping}}" stepKey="uncheckUseSystemValue"/> + <selectOption selector="{{SalesConfigSection.ShippingTaxClass}}" userInput="Taxable Goods" stepKey="setShippingTaxClass"/> + <click selector="{{SalesConfigSection.TaxClassesTab}}" stepKey="collapseTaxClassesTab"/> + <click selector="{{ContentManagementSection.Save}}" stepKey="saveConfig"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/SwitchToTinyMCE3ActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/SwitchToTinyMCE3ActionGroup.xml new file mode 100644 index 0000000000000..b725610b7b2ee --- /dev/null +++ b/app/code/Magento/Config/Test/Mftf/ActionGroup/SwitchToTinyMCE3ActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SwitchToTinyMCE3ActionGroup"> + <annotations> + <description>Goes to the 'Configuration' page for 'Content Management'. Sets 'WYSIWYG Editor' to 'TinyMCE 3'. Clicks on the Save button. PLEASE NOTE: The value is Hardcoded.</description> + </annotations> + + <comment userInput="Choose TinyMCE3 as the default editor" stepKey="chooseTinyMCE3AsEditor"/> + <conditionalClick stepKey="expandWYSIWYGOptions1" selector="{{ContentManagementSection.WYSIWYGOptions}}" dependentSelector="{{ContentManagementSection.CheckIfTabExpand}}" visible="true"/> + <waitForElementVisible selector="{{ContentManagementSection.SwitcherSystemValue}}" stepKey="waitForCheckbox2"/> + <uncheckOption selector="{{ContentManagementSection.SwitcherSystemValue}}" stepKey="uncheckUseSystemValue2"/> + <waitForElementVisible selector="{{ContentManagementSection.Switcher}}" stepKey="waitForSwitcherDropdown2"/> + <selectOption selector="{{ContentManagementSection.Switcher}}" userInput="TinyMCE 3" stepKey="switchToVersion3"/> + <click selector="{{ContentManagementSection.WYSIWYGOptions}}" stepKey="collapseWYSIWYGOptions"/> + <click selector="{{ContentManagementSection.Save}}" stepKey="saveConfig"/> + <see selector="{{AdminMessagesSection.success}}" userInput="You saved the configuration." stepKey="seeConfigurationSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/UnSelectTopDestinationsCountryActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/UnSelectTopDestinationsCountryActionGroup.xml new file mode 100644 index 0000000000000..54e4024be5f34 --- /dev/null +++ b/app/code/Magento/Config/Test/Mftf/ActionGroup/UnSelectTopDestinationsCountryActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="UnSelectTopDestinationsCountryActionGroup"> + <annotations> + <description>Un-selects the provided Countries under 'Top destinations' on the 'General' section of the 'Configuration' page. Clicks on the Save button.</description> + </annotations> + <arguments> + <argument name="countries" type="entity"/> + </arguments> + + <unselectOption selector="{{CountryOptionsSection.topDestinations}}" parameterArray="[{{countries.country}}]" stepKey="unSelectTopDestinationsCountry"/> + <click selector="#save" stepKey="saveConfig"/> + <waitForPageLoad stepKey="waitForSavingConfig"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/UseStaticURLForMediaContentInWYSIWYGActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/UseStaticURLForMediaContentInWYSIWYGActionGroup.xml new file mode 100644 index 0000000000000..b7c7ea2067db2 --- /dev/null +++ b/app/code/Magento/Config/Test/Mftf/ActionGroup/UseStaticURLForMediaContentInWYSIWYGActionGroup.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="UseStaticURLForMediaContentInWYSIWYGActionGroup"> + <annotations> + <description>Goes to the 'Configuration' page for 'Content Management'. Sets 'Use Static URLs for Media Content in WYSIWYG' to the provided value. Clicks on the Save button.</description> + </annotations> + <arguments> + <argument name="value" defaultValue="Yes" type="string"/> + </arguments> + + <amOnPage url="{{ConfigurationStoresPage.url}}" stepKey="navigateToWYSIWYGConfigPage1"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + <conditionalClick stepKey="expandWYSIWYGOptions" selector="{{ContentManagementSection.WYSIWYGOptions}}" dependentSelector="{{ContentManagementSection.CheckIfTabExpand}}" visible="true"/> + <waitForElementVisible selector="{{ContentManagementSection.EnableWYSIWYG}}" stepKey="waitForEnableWYSIWYGDropdown1"/> + <selectOption selector="{{ContentManagementSection.StaticURL}}" userInput="{{value}}" stepKey="selectOption1"/> + <click selector="{{ContentManagementSection.WYSIWYGOptions}}" stepKey="collapseWYSIWYGOptions"/> + <click selector="{{ContentManagementSection.Save}}" stepKey="saveConfig"/> + <waitForPageLoad stepKey="waitForPageLoad2"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ConfigurableProductPriceAdditionalStoreViewTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ConfigurableProductPriceAdditionalStoreViewTest.xml index 83d9bbe8c270a..0b078bc7d2a98 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ConfigurableProductPriceAdditionalStoreViewTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ConfigurableProductPriceAdditionalStoreViewTest.xml @@ -19,7 +19,7 @@ <group value="ConfigurableProduct"/> </annotations> <before> - + <createData entity="ApiCategory" stepKey="createCategory"/> <createData entity="ApiConfigurableProduct" stepKey="createConfigProduct"> <requiredEntity createDataKey="createCategory"/> @@ -73,14 +73,14 @@ <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="ResetWebUrlOptions" stepKey="resetUrlOption"/> + <actionGroup ref="ResetWebUrlOptionsActionGroup" stepKey="resetUrlOption"/> <actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteSecondWebsite"> <argument name="websiteName" value="Second Website"/> </actionGroup> <actionGroup ref="logout" stepKey="adminLogout"/> </after> - <actionGroup ref="EnableWebUrlOptions" stepKey="addStoreCodeToUrls"/> + <actionGroup ref="EnableWebUrlOptionsActionGroup" stepKey="addStoreCodeToUrls"/> <actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="addNewWebsite"> <argument name="newWebsiteName" value="Second Website"/> <argument name="websiteCode" value="second_website"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml index 6de03e225ae08..194c6e6164f8c 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml @@ -53,7 +53,7 @@ <actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteTestWebsite"> <argument name="websiteName" value="{{NewWebSiteData.name}}"/> </actionGroup> - <actionGroup ref="NavigateToConfigurationGeneralPage" stepKey="navigateToConfigGeneralPage2"/> + <actionGroup ref="NavigateToConfigurationGeneralPageActionGroup" stepKey="navigateToConfigGeneralPage2"/> <actionGroup ref="AdminSwitchWebsiteActionGroup" stepKey="adminSwitchWebsiteActionGroup"> <argument name="website" value="_defaultWebsite"/> </actionGroup> @@ -65,7 +65,7 @@ </after> <!--Check that all countries are allowed initially and get amount--> <comment userInput="Check that all countries are allowed initially and get amount" stepKey="checkAllCountriesAreAllowed"/> - <actionGroup ref="NavigateToConfigurationGeneralPage" stepKey="navigateToConfigGeneralPage"/> + <actionGroup ref="NavigateToConfigurationGeneralPageActionGroup" stepKey="navigateToConfigGeneralPage"/> <createData entity="DisableAdminAccountAllowCountry" stepKey="setDefaultValueForAllowCountries"/> <executeJS function="return document.querySelectorAll('{{CountryOptionsSection.allowedCountries}} option').length" stepKey="countriesAmount"/> <!-- Create customer for US --> diff --git a/app/code/Magento/Elasticsearch/Test/Mftf/Test/ProductQuickSearchUsingElasticSearchTest.xml b/app/code/Magento/Elasticsearch/Test/Mftf/Test/ProductQuickSearchUsingElasticSearchTest.xml index d8ce091fba76f..d8abea9196265 100644 --- a/app/code/Magento/Elasticsearch/Test/Mftf/Test/ProductQuickSearchUsingElasticSearchTest.xml +++ b/app/code/Magento/Elasticsearch/Test/Mftf/Test/ProductQuickSearchUsingElasticSearchTest.xml @@ -28,7 +28,7 @@ <after> <deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/> <deleteData createDataKey="categoryFirst" stepKey="deleteCategory"/> - <actionGroup ref="ResetSearchEngineConfiguration" stepKey="resetCatalogSearchConfiguration"/> + <actionGroup ref="ResetSearchEngineConfigurationActionGroup" stepKey="resetCatalogSearchConfiguration"/> <actionGroup ref="updateIndexerOnSave" stepKey="resetIndexerBackToOriginalState"> <argument name="indexerName" value="catalogsearch_fulltext"/> </actionGroup> @@ -37,7 +37,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <comment userInput="Change Catalog search engine option to Elastic Search 5.0+" stepKey="chooseElasticSearch5"/> - <actionGroup ref="ChooseElasticSearchAsSearchEngine" stepKey="chooseES5"/> + <actionGroup ref="ChooseElasticSearchAsSearchEngineActionGroup" stepKey="chooseES5"/> <actionGroup ref="ClearPageCacheActionGroup" stepKey="clearing"/> <actionGroup ref="updateIndexerBySchedule" stepKey="updateAnIndexerBySchedule"> <argument name="indexerName" value="catalogsearch_fulltext"/> @@ -57,4 +57,4 @@ <comment userInput="End of searching products" stepKey="endOfSearchingProducts"/> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin2"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddImageToWYSIWYGNewsletterTest.xml b/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddImageToWYSIWYGNewsletterTest.xml index 0371c0265d149..7ced9d206a28c 100644 --- a/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddImageToWYSIWYGNewsletterTest.xml +++ b/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddImageToWYSIWYGNewsletterTest.xml @@ -19,7 +19,7 @@ </annotations> <before> <actionGroup ref="LoginActionGroup" stepKey="login"/> - <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> + <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> <!--Create a newsletter template that contains an image--> @@ -57,7 +57,7 @@ <seeElementInDOM selector="{{StorefrontNewsletterSection.imageSource(ImageUpload3.fileName)}}" stepKey="assertMediaSource"/> <closeTab stepKey="closeTab"/> <after> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> </test> diff --git a/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddVariableToWYSIWYGNewsletterTest.xml b/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddVariableToWYSIWYGNewsletterTest.xml index b6f78b6f33792..958340671ac43 100644 --- a/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddVariableToWYSIWYGNewsletterTest.xml +++ b/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddVariableToWYSIWYGNewsletterTest.xml @@ -19,7 +19,7 @@ </annotations> <before> <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> - <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> + <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> <!--Create Custom Variable--> @@ -99,7 +99,7 @@ <dontSee userInput="{{customVariable.html}}" stepKey="dontSeeCustomVariableName" /> <closeTab stepKey="closeTab"/> <after> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> </test> diff --git a/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddWidgetToWYSIWYGNewsletterTest.xml b/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddWidgetToWYSIWYGNewsletterTest.xml index 273a39a312132..29c125a52c9e2 100644 --- a/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddWidgetToWYSIWYGNewsletterTest.xml +++ b/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddWidgetToWYSIWYGNewsletterTest.xml @@ -19,7 +19,7 @@ </annotations> <before> <actionGroup ref="LoginActionGroup" stepKey="login"/> - <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> + <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> <amOnPage url="{{NewsletterTemplateForm.url}}" stepKey="amOnNewsletterTemplatePage"/> @@ -54,7 +54,7 @@ <see userInput="Home page" stepKey="seeHomePageCMSPage"/> <closeTab stepKey="closeTab"/> <after> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> </test> diff --git a/app/code/Magento/Newsletter/Test/Mftf/Test/VerifySubscribedNewsletterDisplayedTest.xml b/app/code/Magento/Newsletter/Test/Mftf/Test/VerifySubscribedNewsletterDisplayedTest.xml index 4d60b7676605e..15ce00cd11471 100644 --- a/app/code/Magento/Newsletter/Test/Mftf/Test/VerifySubscribedNewsletterDisplayedTest.xml +++ b/app/code/Magento/Newsletter/Test/Mftf/Test/VerifySubscribedNewsletterDisplayedTest.xml @@ -37,13 +37,13 @@ <argument name="StoreGroup" value="staticStoreGroup"/> <argument name="customStore" value="staticStore"/> </actionGroup> - <actionGroup ref="EnableWebUrlOptions" stepKey="addStoreCodeToUrls"/> + <actionGroup ref="EnableWebUrlOptionsActionGroup" stepKey="addStoreCodeToUrls"/> <magentoCLI command="cache:flush" stepKey="flushCache"/> </before> <after> <!--Delete created data and set Default Configuration--> - <actionGroup ref="ResetWebUrlOptions" stepKey="resetUrlOption"/> + <actionGroup ref="ResetWebUrlOptionsActionGroup" stepKey="resetUrlOption"/> <actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite"> <argument name="websiteName" value="Second"/> </actionGroup> diff --git a/app/code/Magento/Newsletter/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnNewsletterTest.xml b/app/code/Magento/Newsletter/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnNewsletterTest.xml index 722a0dd22119d..0c20357127e6d 100644 --- a/app/code/Magento/Newsletter/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnNewsletterTest.xml +++ b/app/code/Magento/Newsletter/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnNewsletterTest.xml @@ -19,7 +19,7 @@ </annotations> <before> <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> - <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> + <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> <amOnPage url="{{NewsletterTemplateForm.url}}" stepKey="amOnNewsletterTemplatePage"/> @@ -48,7 +48,7 @@ <see userInput="Hello World From Newsletter Template!" stepKey="seeContent" /> <closeTab stepKey="closeTab"/> <after> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> </test> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/CreditMemoTotalAfterShippingDiscountTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/CreditMemoTotalAfterShippingDiscountTest.xml index ec0f97e418c8c..86b55f854d593 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/CreditMemoTotalAfterShippingDiscountTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/CreditMemoTotalAfterShippingDiscountTest.xml @@ -25,10 +25,10 @@ </createData> <actionGroup ref="LoginActionGroup" stepKey="loginAsAdmin"/> <actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearOrderFilters"/> - <actionGroup ref="SetTaxClassForShipping" stepKey="setShippingTaxClass"/> + <actionGroup ref="SetTaxClassForShippingActionGroup" stepKey="setShippingTaxClass"/> </before> <after> - <actionGroup ref="ResetTaxClassForShipping" stepKey="resetTaxClassForShipping"/> + <actionGroup ref="ResetTaxClassForShippingActionGroup" stepKey="resetTaxClassForShipping"/> <actionGroup ref="DeleteCartPriceRuleByName" stepKey="deleteSalesRule"> <argument name="ruleName" value="{{ApiSalesRule.name}}"/> </actionGroup> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxCalcWithApplyTaxOnSettingTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxCalcWithApplyTaxOnSettingTest.xml index d249af983f715..a225144afea34 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxCalcWithApplyTaxOnSettingTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxCalcWithApplyTaxOnSettingTest.xml @@ -28,8 +28,8 @@ <requiredEntity createDataKey="createCategory"/> </createData> <actionGroup ref="LoginActionGroup" stepKey="loginAsAdmin"/> - <actionGroup ref="SetTaxClassForShipping" stepKey="setTaxClass"/> - <actionGroup ref="SetTaxApplyOnSetting" stepKey="setApplyTaxOnSetting"> + <actionGroup ref="SetTaxClassForShippingActionGroup" stepKey="setTaxClass"/> + <actionGroup ref="SetTaxApplyOnSettingActionGroup" stepKey="setApplyTaxOnSetting"> <argument name="userInput" value="Original price only"/> </actionGroup> <amOnPage url="{{AdminEditTaxRulePage.url($$createTaxRule.id$$)}}" stepKey="navigateToEditTaxRulePage"/> @@ -45,10 +45,10 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createTaxRule" stepKey="deleteTaxRule"/> <deleteData stepKey="deleteTaxRate" createDataKey="initialTaxRate" /> - <actionGroup ref="DisableTaxApplyOnOriginalPrice" stepKey="setApplyTaxOffSetting"> + <actionGroup ref="DisableTaxApplyOnOriginalPriceActionGroup" stepKey="setApplyTaxOffSetting"> <argument name="userInput" value="Custom price if available"/> </actionGroup> - <actionGroup ref="ResetTaxClassForShipping" stepKey="resetTaxClassForShipping"/> + <actionGroup ref="ResetTaxClassForShippingActionGroup" stepKey="resetTaxClassForShipping"/> <actionGroup ref="logout" stepKey="logout"/> </after> diff --git a/app/code/Magento/Tinymce3/Test/Mftf/Test/AdminSwitchWYSIWYGOptionsTest.xml b/app/code/Magento/Tinymce3/Test/Mftf/Test/AdminSwitchWYSIWYGOptionsTest.xml index e15886e026c4c..deb94a7f30d34 100644 --- a/app/code/Magento/Tinymce3/Test/Mftf/Test/AdminSwitchWYSIWYGOptionsTest.xml +++ b/app/code/Magento/Tinymce3/Test/Mftf/Test/AdminSwitchWYSIWYGOptionsTest.xml @@ -20,7 +20,7 @@ </annotations> <before> <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> - <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> + <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> </before> <amOnPage url="{{ConfigurationStoresPage.url}}" stepKey="navigateToWYSIWYGConfigPage1"/> <waitForPageLoad stepKey="wait1"/> @@ -80,7 +80,7 @@ <see userInput="Hello TinyMCE3!" stepKey="seeContent2"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> <after> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> </test> diff --git a/app/code/Magento/Widget/Test/Mftf/Test/NewProductsListWidgetTest.xml b/app/code/Magento/Widget/Test/Mftf/Test/NewProductsListWidgetTest.xml index c63e76d851933..e2fb9cb50f88a 100644 --- a/app/code/Magento/Widget/Test/Mftf/Test/NewProductsListWidgetTest.xml +++ b/app/code/Magento/Widget/Test/Mftf/Test/NewProductsListWidgetTest.xml @@ -23,7 +23,7 @@ <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> </before> <after> @@ -49,4 +49,4 @@ <fillField selector="{{CmsNewPagePageSeoSection.urlKey}}" userInput="{{_newDefaultCmsPage.identifier}}" stepKey="fillPageUrlKey"/> <click selector="{{CmsNewPagePageActionsSection.saveAndContinueEdit}}" stepKey="clickSaveCmsPage"/> </test> -</tests> \ No newline at end of file +</tests> From 86f46bb62423949fc808a492c1c75d416bf24a86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Fri, 29 Nov 2019 10:45:04 +0100 Subject: [PATCH 0176/1143] REFACTOR: Extract Action Groups to separate files (according to MFTF best practices) --- .../AdminAddImageToWYSIWYGCatalogTest.xml | 16 +- .../CatalogProductListWidgetOperatorsTest.xml | 8 +- .../CatalogProductListWidgetOrderTest.xml | 4 +- .../AddStoreViewToCmsPageActionGroup.xml | 30 ++++ .../AssertCMSPageContentActionGroup.xml | 19 +- .../AssertStoreFrontCMSPageActionGroup.xml | 25 +++ .../ActionGroup/AttachImageActionGroup.xml | 25 +++ .../Test/Mftf/ActionGroup/CMSActionGroup.xml | 170 ------------------ ...ePageContentWYSIWYGDisabledActionGroup.xml | 20 +++ .../ClearWidgetsFromCMSContentActionGroup.xml | 13 +- ...ClickBrowseBtnOnUploadPopupActionGroup.xml | 19 ++ .../CreateImageFolderActionGroup.xml | 31 ++++ .../CreateNewPageWithAllValuesActionGroup.xml | 8 +- ...PageWithAllValuesAndContentActionGroup.xml | 17 ++ .../ActionGroup/DeleteCMSBlockActionGroup.xml | 25 +++ .../ActionGroup/DeleteImageActionGroup.xml | 23 +++ .../FillOutUploadImagePopupActionGroup.xml | 22 +++ ...vigateToCreatedCMSBlockPageActionGroup.xml | 34 ++++ .../NavigateToCreatedCMSPageActionGroup.xml | 35 ++++ ...eToStorefrontForCreatedPageActionGroup.xml | 22 +++ ...loseCMSBlockWithSplitButtonActionGroup.xml | 22 +++ .../SaveAndContinueEditCmsPageActionGroup.xml | 22 +++ .../ActionGroup/SaveCMSBlockActionGroup.xml | 21 +++ .../ActionGroup/SaveCmsPageActionGroup.xml | 23 +++ .../Mftf/ActionGroup/SaveImageActionGroup.xml | 20 +++ ...SelectImageFromMediaStorageActionGroup.xml | 120 ------------- .../Mftf/ActionGroup/SetLayoutActionGroup.xml | 26 +++ .../VerifyMagentoEntityActionGroup.xml | 19 ++ ...yMediaGalleryStorageActionsActionGroup.xml | 22 +++ ...VerifyOversizeValidationMsgActionGroup.xml | 19 ++ .../ActionGroup/VerifyTinyMCEActionGroup.xml | 11 +- ...WrongExtensionValidationMsgActionGroup.xml | 19 ++ .../AdminAddImageToCMSPageTinyMCE3Test.xml | 8 +- .../Test/AdminAddImageToWYSIWYGBlockTest.xml | 18 +- .../Test/AdminAddImageToWYSIWYGCMSTest.xml | 18 +- .../AdminAddVariableToWYSIWYGBlockTest.xml | 2 +- .../Test/AdminAddWidgetToWYSIWYGBlockTest.xml | 4 +- .../Test/Mftf/Test/AdminCreateCmsPageTest.xml | 2 +- ...lleryPopupUploadImagesWithoutErrorTest.xml | 2 +- ...CheckOrderOfProdsInWidgetOnCMSPageTest.xml | 4 +- .../StoreViewLanguageCorrectSwitchTest.xml | 2 +- .../AdminAddImageToWYSIWYGNewsletterTest.xml | 12 +- ...esignConfigMediaGalleryImageUploadTest.xml | 6 +- ...eUrlRewriteAndAddPermanentRedirectTest.xml | 10 +- ...eUrlRewriteAndAddTemporaryRedirectTest.xml | 10 +- 45 files changed, 610 insertions(+), 398 deletions(-) create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/AddStoreViewToCmsPageActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertStoreFrontCMSPageActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/AttachImageActionGroup.xml delete mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/CMSActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/ClearWidgetsForCMSHomePageContentWYSIWYGDisabledActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/ClickBrowseBtnOnUploadPopupActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/CreateImageFolderActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/CreateNewPageWithAllValuesAndContentActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/DeleteCMSBlockActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/DeleteImageActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/FillOutUploadImagePopupActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/NavigateToCreatedCMSBlockPageActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/NavigateToCreatedCMSPageActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/NavigateToStorefrontForCreatedPageActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/SaveAndCloseCMSBlockWithSplitButtonActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/SaveAndContinueEditCmsPageActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/SaveCMSBlockActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/SaveCmsPageActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/SaveImageActionGroup.xml delete mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/SelectImageFromMediaStorageActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/SetLayoutActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyMagentoEntityActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyMediaGalleryStorageActionsActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyOversizeValidationMsgActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyWrongExtensionValidationMsgActionGroup.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGCatalogTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGCatalogTest.xml index c36c29ce594d0..81694749fa79b 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGCatalogTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGCatalogTest.xml @@ -31,20 +31,20 @@ <waitForElementVisible selector="{{CatalogWYSIWYGSection.TinyMCE4}}" stepKey="waitForTinyMCE4" /> <click selector="{{CatalogWYSIWYGSection.InsertImageIcon}}" stepKey="clickInsertImageIcon" /> <waitForPageLoad stepKey="waitForPageLoad" /> - <actionGroup ref="clickBrowseBtnOnUploadPopup" stepKey="clickBrowserBtn"/> - <actionGroup ref="VerifyMediaGalleryStorageActions" stepKey="VerifyMediaGalleryStorageBtn"/> - <actionGroup ref="CreateImageFolder" stepKey="CreateImageFolder"> + <actionGroup ref="ClickBrowseBtnOnUploadPopupActionGroup" stepKey="clickBrowserBtn"/> + <actionGroup ref="VerifyMediaGalleryStorageActionsActionGroup" stepKey="VerifyMediaGalleryStorageBtn"/> + <actionGroup ref="CreateImageFolderActionGroup" stepKey="CreateImageFolder"> <argument name="ImageFolder" value="ImageFolder"/> </actionGroup> - <actionGroup ref="attachImage" stepKey="attachImage1"> + <actionGroup ref="AttachImageActionGroup" stepKey="attachImage1"> <argument name="Image" value="ImageUpload3"/> </actionGroup> - <actionGroup ref="deleteImage" stepKey="deleteImage"/> - <actionGroup ref="attachImage" stepKey="attachImage2"> + <actionGroup ref="DeleteImageActionGroup" stepKey="deleteImage"/> + <actionGroup ref="AttachImageActionGroup" stepKey="attachImage2"> <argument name="Image" value="ImageUpload3"/> </actionGroup> - <actionGroup ref="saveImage" stepKey="insertImage"/> - <actionGroup ref="fillOutUploadImagePopup" stepKey="fillOutUploadImagePopup" /> + <actionGroup ref="SaveImageActionGroup" stepKey="insertImage"/> + <actionGroup ref="FillOutUploadImagePopupActionGroup" stepKey="fillOutUploadImagePopup" /> <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCatalog"/> <amOnPage url="/{{SimpleSubCategory.name_lwr}}.html" stepKey="goToCategoryFrontPage"/> <waitForPageLoad stepKey="waitForPageLoad2"/> diff --git a/app/code/Magento/CatalogWidget/Test/Mftf/Test/CatalogProductListWidgetOperatorsTest.xml b/app/code/Magento/CatalogWidget/Test/Mftf/Test/CatalogProductListWidgetOperatorsTest.xml index 32bea8b604cf8..bc1542cd2ea28 100644 --- a/app/code/Magento/CatalogWidget/Test/Mftf/Test/CatalogProductListWidgetOperatorsTest.xml +++ b/app/code/Magento/CatalogWidget/Test/Mftf/Test/CatalogProductListWidgetOperatorsTest.xml @@ -42,7 +42,7 @@ </before> <!--Open block with widget.--> - <actionGroup ref="navigateToCreatedCMSBlockPage" stepKey="navigateToCreatedCMSBlockPage1"> + <actionGroup ref="NavigateToCreatedCMSBlockPageActionGroup" stepKey="navigateToCreatedCMSBlockPage1"> <argument name="CMSBlockPage" value="$$createPreReqBlock$$"/> </actionGroup> @@ -85,7 +85,7 @@ <seeElement selector="{{InsertWidgetSection.checkElementStorefrontByPrice('100')}}" stepKey="seeElementByPrice100"/> <!--Open block with widget.--> - <actionGroup ref="navigateToCreatedCMSBlockPage" stepKey="navigateToCreatedCMSBlockPage2"> + <actionGroup ref="NavigateToCreatedCMSBlockPageActionGroup" stepKey="navigateToCreatedCMSBlockPage2"> <argument name="CMSBlockPage" value="$$createPreReqBlock$$"/> </actionGroup> @@ -105,7 +105,7 @@ <dontSeeElement selector="{{InsertWidgetSection.checkElementStorefrontByPrice('100')}}" stepKey="dontSeeElementByPrice100"/> <!--Open block with widget.--> - <actionGroup ref="navigateToCreatedCMSBlockPage" stepKey="navigateToCreatedCMSBlockPage3"> + <actionGroup ref="NavigateToCreatedCMSBlockPageActionGroup" stepKey="navigateToCreatedCMSBlockPage3"> <argument name="CMSBlockPage" value="$$createPreReqBlock$$"/> </actionGroup> @@ -125,7 +125,7 @@ <seeElement selector="{{InsertWidgetSection.checkElementStorefrontByPrice('100')}}" stepKey="seeElementByPrice100s"/> <!--Open block with widget.--> - <actionGroup ref="navigateToCreatedCMSBlockPage" stepKey="navigateToCreatedCMSBlockPage4"> + <actionGroup ref="NavigateToCreatedCMSBlockPageActionGroup" stepKey="navigateToCreatedCMSBlockPage4"> <argument name="CMSBlockPage" value="$$createPreReqBlock$$"/> </actionGroup> diff --git a/app/code/Magento/CatalogWidget/Test/Mftf/Test/CatalogProductListWidgetOrderTest.xml b/app/code/Magento/CatalogWidget/Test/Mftf/Test/CatalogProductListWidgetOrderTest.xml index 11586207c4d8e..cceb25ecebe21 100644 --- a/app/code/Magento/CatalogWidget/Test/Mftf/Test/CatalogProductListWidgetOrderTest.xml +++ b/app/code/Magento/CatalogWidget/Test/Mftf/Test/CatalogProductListWidgetOrderTest.xml @@ -42,7 +42,7 @@ </before> <!--Open created cms page--> <comment userInput="Open created cms page" stepKey="commentOpenCreatedCmsPage"/> - <actionGroup ref="navigateToCreatedCMSPage" stepKey="navigateToCreatedCMSPage1"> + <actionGroup ref="NavigateToCreatedCMSPageActionGroup" stepKey="navigateToCreatedCMSPage1"> <argument name="CMSPage" value="$$createPreReqPage$$"/> </actionGroup> <!--Add widget to cms page--> @@ -85,4 +85,4 @@ <actionGroup ref="logout" stepKey="logout"/> </after> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AddStoreViewToCmsPageActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AddStoreViewToCmsPageActionGroup.xml new file mode 100644 index 0000000000000..505f3bebbf70c --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AddStoreViewToCmsPageActionGroup.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddStoreViewToCmsPageActionGroup" extends="NavigateToCreatedCMSPageActionGroup"> + <annotations> + <description>EXTENDS: navigateToCreatedCMSPage. Adds the provided Store View to a Page.</description> + </annotations> + <arguments> + <argument name="storeViewName" type="string"/> + </arguments> + + <remove keyForRemoval="clickExpandContentTabForPage"/> + <remove keyForRemoval="waitForLoadingMaskOfStagingSection"/> + <click selector="{{CmsNewPagePiwSection.header}}" stepKey="clickPageInWebsites" after="waitForPageLoad3"/> + <waitForElementVisible selector="{{CmsNewPagePiwSection.selectStoreView(storeViewName)}}" stepKey="waitForStoreGridReload"/> + <clickWithLeftButton selector="{{CmsNewPagePiwSection.selectStoreView(storeViewName)}}" stepKey="clickStoreView"/> + <click selector="{{CmsNewPagePageActionsSection.expandSplitButton}}" stepKey="expandButtonMenu"/> + <waitForElementVisible selector="{{CmsNewPagePageActionsSection.splitButtonMenu}}" stepKey="waitForSplitButtonMenuVisible"/> + <click selector="{{CmsNewPagePageActionsSection.savePage}}" stepKey="clickSavePage"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <see userInput="You saved the page." stepKey="seeMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageContentActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageContentActionGroup.xml index 336ed8ea495ec..7697931a24176 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageContentActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageContentActionGroup.xml @@ -8,11 +8,11 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AssertCMSPageContent"> + <actionGroup name="AssertCMSPageContentActionGroup"> <annotations> <description>Validates that the CMS Page details are present and correct. PLEASE NOTE: The CMS Page data is Hardcoded, using '_duplicatedCMSPage'.</description> </annotations> - + <grabValueFrom selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" stepKey="grabTextFromTitle"/> <assertEquals stepKey="assertTitle" message="pass"> <expectedResult type="string">{{_duplicatedCMSPage.title}}</expectedResult> @@ -28,19 +28,4 @@ <executeJS function="(el = document.querySelector('[name=\'identifier\']')) && el['se' + 'tAt' + 'tribute']('data-value', el.value.split('-')[0]);" stepKey="setAttribute"/> <seeElement selector="{{CmsNewPagePageBasicFieldsSection.duplicatedURLKey(_duplicatedCMSPage.title)}}" stepKey="see"/> </actionGroup> - - <actionGroup name="AssertStoreFrontCMSPage"> - <annotations> - <description>Validates that the provided CMS Page Title, Content and Heading are present and correct on a Storefront CMS Page.</description> - </annotations> - <arguments> - <argument name="cmsTitle" type="string"/> - <argument name="cmsContent" type="string"/> - <argument name="cmsContentHeading" type="string"/> - </arguments> - - <see selector="{{StorefrontCMSPageSection.title}}" userInput="{{cmsTitle}}" stepKey="seeTitle"/> - <see selector="{{StorefrontCMSPageSection.mainTitle}}" userInput="{{cmsContentHeading}}" stepKey="seeContentHeading"/> - <see selector="{{StorefrontCMSPageSection.mainContent}}" userInput="{{cmsContent}}" stepKey="seeContent"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertStoreFrontCMSPageActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertStoreFrontCMSPageActionGroup.xml new file mode 100644 index 0000000000000..136fecbab5d8b --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertStoreFrontCMSPageActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertStoreFrontCMSPageActionGroup"> + <annotations> + <description>Validates that the provided CMS Page Title, Content and Heading are present and correct on a Storefront CMS Page.</description> + </annotations> + <arguments> + <argument name="cmsTitle" type="string"/> + <argument name="cmsContent" type="string"/> + <argument name="cmsContentHeading" type="string"/> + </arguments> + + <see selector="{{StorefrontCMSPageSection.title}}" userInput="{{cmsTitle}}" stepKey="seeTitle"/> + <see selector="{{StorefrontCMSPageSection.mainTitle}}" userInput="{{cmsContentHeading}}" stepKey="seeContentHeading"/> + <see selector="{{StorefrontCMSPageSection.mainContent}}" userInput="{{cmsContent}}" stepKey="seeContent"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AttachImageActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AttachImageActionGroup.xml new file mode 100644 index 0000000000000..f4eb3ced2a203 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AttachImageActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AttachImageActionGroup"> + <annotations> + <description>Uploads the provided Image to Media Gallery. + If you use this action group, you MUST add steps to delete the image in the "after" steps.</description> + </annotations> + <arguments> + <argument name="Image"/> + </arguments> + + <attachFile selector="{{MediaGallerySection.BrowseUploadImage}}" userInput="{{Image.value}}" stepKey="uploadImage"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear"/> + <waitForElementVisible selector="{{MediaGallerySection.imageOrImageCopy(Image.fileName, Image.extension)}}" stepKey="waitForUploadImage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/CMSActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/CMSActionGroup.xml deleted file mode 100644 index a75090179460b..0000000000000 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/CMSActionGroup.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. - */ ---> - -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="navigateToCreatedCMSPage"> - <annotations> - <description>Goes to the Admin CMS Pages page. </description> - </annotations> - <arguments> - <argument name="CMSPage" defaultValue=""/> - </arguments> - - <amOnPage url="{{CmsPagesPage.url}}" stepKey="navigateToCMSPagesGrid"/> - <waitForPageLoad stepKey="waitForPageLoad1"/> - <conditionalClick selector="{{CmsPagesPageActionsSection.clearAllButton}}" dependentSelector="{{CmsPagesPageActionsSection.activeFilters}}" stepKey="clickToResetFilter" visible="true"/> - <waitForPageLoad stepKey="waitForPageLoad2"/> - <conditionalClick selector="//div[contains(@data-role, 'grid-wrapper')]/table/thead/tr/th/span[contains(text(), 'ID')]" dependentSelector="//span[contains(text(), 'ID')]/parent::th[not(contains(@class, '_descend'))]/parent::tr/parent::thead/parent::table/parent::div[contains(@data-role, 'grid-wrapper')]" stepKey="clickToAttemptSortByIdDescending" visible="true"/> - <waitForLoadingMaskToDisappear stepKey="waitForFirstIdSortDescendingToFinish"/> - - <!-- Conditional Click again in case it goes from default state to ascending on first click --> - <conditionalClick selector="//div[contains(@data-role, 'grid-wrapper')]/table/thead/tr/th/span[contains(text(), 'ID')]" dependentSelector="//span[contains(text(), 'ID')]/parent::th[not(contains(@class, '_descend'))]/parent::tr/parent::thead/parent::table/parent::div[contains(@data-role, 'grid-wrapper')]" stepKey="secondClickToAttemptSortByIdDescending" visible="true"/> - <waitForLoadingMaskToDisappear stepKey="waitForSecondIdSortDescendingToFinish"/> - <click selector="{{CmsPagesPageActionsSection.select(CMSPage.identifier)}}" stepKey="clickSelectCreatedCMSPage"/> - <click selector="{{CmsPagesPageActionsSection.edit(CMSPage.identifier)}}" stepKey="navigateToCreatedCMSPage"/> - <waitForPageLoad stepKey="waitForPageLoad3"/> - <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickExpandContentTabForPage"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskOfStagingSection"/> - </actionGroup> - - <actionGroup name="navigateToCreatedCMSBlockPage"> - <annotations> - <description>Goes to the Admin Blocks page. Clicks on 'Edit' for the provided Block.</description> - </annotations> - <arguments> - <argument name="CMSBlockPage" defaultValue=""/> - </arguments> - - <amOnPage url="{{CmsBlocksPage.url}}" stepKey="navigateToCMSBlocksGrid"/> - <waitForPageLoad stepKey="waitForPageLoad1"/> - <conditionalClick selector="{{CmsPagesPageActionsSection.clearAllButton}}" dependentSelector="{{CmsPagesPageActionsSection.activeFilters}}" stepKey="clickToResetFilter" visible="true"/> - <waitForPageLoad stepKey="waitForPageLoad2"/> - <conditionalClick selector="{{BlockPageActionsSection.idColumn}}" dependentSelector="//span[contains(text(), 'ID')]/parent::th[not(contains(@class, '_descend'))]/parent::tr/parent::thead/parent::table/parent::div[contains(@data-role, 'grid-wrapper')]" stepKey="clickToAttemptSortByIdDescending" visible="true"/> - <waitForLoadingMaskToDisappear stepKey="waitForFirstIdSortDescendingToFinish"/> - - <!-- Conditional Click again in case it goes from default state to ascending on first click --> - <conditionalClick selector="{{BlockPageActionsSection.idColumn}}" dependentSelector="//span[contains(text(), 'ID')]/parent::th[not(contains(@class, '_descend'))]/parent::tr/parent::thead/parent::table/parent::div[contains(@data-role, 'grid-wrapper')]" stepKey="secondClickToAttemptSortByIdDescending" visible="true"/> - <waitForLoadingMaskToDisappear stepKey="waitForSecondIdSortDescendingToFinish"/> - <click selector="{{BlockPageActionsSection.select(CMSBlockPage.identifier)}}" stepKey="clickSelectCreatedCMSBlock"/> - <click selector="{{BlockPageActionsSection.edit(CMSBlockPage.identifier)}}" stepKey="navigateToCreatedCMSBlock"/> - <waitForPageLoad stepKey="waitForPageLoad3"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskOfStagingSection"/> - </actionGroup> - - <actionGroup name="DeleteCMSBlockActionGroup"> - <annotations> - <description>Goes to the Admin CMS Blocks page. Deletes the '_defaultBlock' Block. Validates that the Success Message is present and correct. PLEASE NOTE: The Block that is deleted it Hardcoded.</description> - </annotations> - - <amOnPage url="{{CmsBlocksPage.url}}" stepKey="navigateToCMSPagesGrid"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <click selector="{{CmsPagesPageActionsSection.select(_defaultBlock.title)}}" stepKey="ClickOnSelect"/> - <click selector="{{CmsPagesPageActionsSection.delete(_defaultBlock.title)}}" stepKey="ClickOnEdit"/> - <waitForPageLoad stepKey="waitForPageLoad3"/> - <click selector="{{CmsPagesPageActionsSection.deleteConfirm}}" stepKey="ClickToConfirm"/> - <waitForPageLoad stepKey="waitForPageLoad4"/> - <see userInput="You deleted the block." stepKey="VerifyBlockIsDeleted"/> - </actionGroup> - - <actionGroup name="AddStoreViewToCmsPage" extends="navigateToCreatedCMSPage"> - <annotations> - <description>EXTENDS: navigateToCreatedCMSPage. Adds the provided Store View to a Page.</description> - </annotations> - <arguments> - <argument name="storeViewName" type="string"/> - </arguments> - - <remove keyForRemoval="clickExpandContentTabForPage"/> - <remove keyForRemoval="waitForLoadingMaskOfStagingSection"/> - <click selector="{{CmsNewPagePiwSection.header}}" stepKey="clickPageInWebsites" after="waitForPageLoad3"/> - <waitForElementVisible selector="{{CmsNewPagePiwSection.selectStoreView(storeViewName)}}" stepKey="waitForStoreGridReload"/> - <clickWithLeftButton selector="{{CmsNewPagePiwSection.selectStoreView(storeViewName)}}" stepKey="clickStoreView"/> - <click selector="{{CmsNewPagePageActionsSection.expandSplitButton}}" stepKey="expandButtonMenu"/> - <waitForElementVisible selector="{{CmsNewPagePageActionsSection.splitButtonMenu}}" stepKey="waitForSplitButtonMenuVisible"/> - <click selector="{{CmsNewPagePageActionsSection.savePage}}" stepKey="clickSavePage"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <see userInput="You saved the page." stepKey="seeMessage"/> - </actionGroup> - - <actionGroup name="saveAndCloseCMSBlockWithSplitButton"> - <annotations> - <description>Clicks on the Save and Close button.</description> - </annotations> - - <waitForElementVisible selector="{{BlockNewPagePageActionsSection.expandSplitButton}}" stepKey="waitForExpandSplitButtonToBeVisible"/> - <click selector="{{BlockNewPagePageActionsSection.expandSplitButton}}" stepKey="expandSplitButton"/> - <click selector="{{BlockNewPagePageActionsSection.saveAndClose}}" stepKey="clickSaveBlock"/> - <waitForPageLoad stepKey="waitForPageLoadAfterClickingSave"/> - <see userInput="You saved the block." stepKey="assertSaveBlockSuccessMessage"/> - </actionGroup> - - <actionGroup name="navigateToStorefrontForCreatedPage"> - <annotations> - <description>Goes to the provided Page on the Storefront.</description> - </annotations> - <arguments> - <argument name="page" type="string"/> - </arguments> - - <amOnPage url="{{page}}" stepKey="goToStorefront"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - </actionGroup> - - <actionGroup name="saveCMSBlock"> - <annotations> - <description>Clicks on the Save button. Validates that the Save message is present and correct. PLEASE NOTE: The message is Hardcoded.</description> - </annotations> - - <waitForElementVisible selector="{{CmsNewBlockBlockActionsSection.savePage}}" stepKey="waitForSaveButton"/> - <click selector="{{CmsNewBlockBlockActionsSection.savePage}}" stepKey="clickSaveButton"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <see userInput="You saved the block." stepKey="seeSuccessfulSaveMessage"/> - </actionGroup> - - <actionGroup name="saveAndContinueEditCmsPage"> - <annotations> - <description>Clicks on the Save and Continue button.</description> - </annotations> - - <waitForElementVisible time="10" selector="{{CmsNewPagePageActionsSection.saveAndContinueEdit}}" stepKey="waitForSaveAndContinueVisibility"/> - <click selector="{{CmsNewPagePageActionsSection.saveAndContinueEdit}}" stepKey="clickSaveAndContinueEditCmsPage"/> - <waitForPageLoad stepKey="waitForCmsPageLoad"/> - <waitForElementVisible time="1" selector="{{CmsNewPagePageActionsSection.cmsPageTitle}}" stepKey="waitForCmsPageSaveButton"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/> - </actionGroup> - - <actionGroup name="saveCmsPage"> - <annotations> - <description>Clicks on the Save button. Validates that the Success Message is present.</description> - </annotations> - - <waitForElementVisible selector="{{CmsNewPagePageActionsSection.expandSplitButton}}" stepKey="waitForSplitButton"/> - <click selector="{{CmsNewPagePageActionsSection.expandSplitButton}}" stepKey="expandSplitButton"/> - <waitForElementVisible selector="{{CmsNewPagePageActionsSection.savePage}}" stepKey="waitForSaveCmsPage"/> - <click selector="{{CmsNewPagePageActionsSection.savePage}}" stepKey="clickSaveCmsPage"/> - <waitForElementVisible time="1" selector="{{CmsPagesPageActionsSection.addNewPageButton}}" stepKey="waitForCmsPageSaveButton"/> - <see userInput="You saved the page." selector="{{CmsPagesPageActionsSection.savePageSuccessMessage}}" stepKey="assertSavePageSuccessMessage"/> - </actionGroup> - - <actionGroup name="setLayout"> - <annotations> - <description>Sets the provided option for 'Layout', under 'Design' on the Page creation/edit page. </description> - </annotations> - <arguments> - <argument name="designSection"/> - <argument name="layoutOption"/> - </arguments> - - <waitForElementVisible selector="{{designSection.DesignTab}}" stepKey="waitForDesignTabVisible"/> - <conditionalClick selector="{{designSection.DesignTab}}" dependentSelector="{{designSection.LayoutDropdown}}" visible="false" stepKey="clickOnDesignTab"/> - <waitForPageLoad stepKey="waitForPageLoadDesignTab"/> - <waitForElementVisible selector="{{designSection.LayoutDropdown}}" stepKey="waitForLayoutDropDown"/> - <selectOption selector="{{designSection.LayoutDropdown}}" userInput="{{layoutOption}}" stepKey="selectLayout"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/ClearWidgetsForCMSHomePageContentWYSIWYGDisabledActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/ClearWidgetsForCMSHomePageContentWYSIWYGDisabledActionGroup.xml new file mode 100644 index 0000000000000..adaeb8c90ff0b --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/ClearWidgetsForCMSHomePageContentWYSIWYGDisabledActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ClearWidgetsForCMSHomePageContentWYSIWYGDisabledActionGroup"> + <amOnPage url="{{CmsPageEditPage.url('2')}}" stepKey="navigateToEditHomePagePage"/> + <waitForPageLoad stepKey="waitForCmsPageEditPage"/> + <conditionalClick selector="{{CmsNewPagePageActionsSection.contentSectionName}}" dependentSelector="{{CatalogWidgetSection.insertWidgetButton}}" visible="false" stepKey="clickShowHideEditorIfVisible"/> + <waitForElementVisible selector="{{CmsNewPagePageContentSection.content}}" stepKey="waitForContentField"/> + <fillField selector="{{CmsNewPagePageContentSection.content}}" userInput="CMS homepage content goes here." stepKey="resetCMSPageToDefaultContent"/> + <click selector="{{CmsNewPagePageActionsSection.saveAndContinueEdit}}" stepKey="clickSave"/> + <waitForPageLoad stepKey="waitForSettingsApply"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/ClearWidgetsFromCMSContentActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/ClearWidgetsFromCMSContentActionGroup.xml index b176de3748282..98de51574aa4b 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/ClearWidgetsFromCMSContentActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/ClearWidgetsFromCMSContentActionGroup.xml @@ -8,11 +8,11 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="ClearWidgetsFromCMSContent"> + <actionGroup name="ClearWidgetsFromCMSContentActionGroup"> <annotations> <description>Goes to the Admin CMS Page Edit page for the Page ID number 2. Clears the Widget and replaces it with Text. PLEASE NOTE: The Page ID/Text are Hardcoded.</description> </annotations> - + <amOnPage url="{{CmsPageEditPage.url('2')}}" stepKey="navigateToEditHomePagePage"/> <waitForPageLoad stepKey="waitEditHomePagePageToLoad"/> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab"/> @@ -26,13 +26,4 @@ <waitForPageLoad stepKey="waitSaveToBeApplied"/> <see selector="{{AdminProductMessagesSection.successMessage}}" userInput="You saved the page." stepKey="seeSaveSuccess"/> </actionGroup> - <actionGroup name="ClearWidgetsForCMSHomePageContentWYSIWYGDisabled"> - <amOnPage url="{{CmsPageEditPage.url('2')}}" stepKey="navigateToEditHomePagePage"/> - <waitForPageLoad stepKey="waitForCmsPageEditPage"/> - <conditionalClick selector="{{CmsNewPagePageActionsSection.contentSectionName}}" dependentSelector="{{CatalogWidgetSection.insertWidgetButton}}" visible="false" stepKey="clickShowHideEditorIfVisible"/> - <waitForElementVisible selector="{{CmsNewPagePageContentSection.content}}" stepKey="waitForContentField"/> - <fillField selector="{{CmsNewPagePageContentSection.content}}" userInput="CMS homepage content goes here." stepKey="resetCMSPageToDefaultContent"/> - <click selector="{{CmsNewPagePageActionsSection.saveAndContinueEdit}}" stepKey="clickSave"/> - <waitForPageLoad stepKey="waitForSettingsApply"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/ClickBrowseBtnOnUploadPopupActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/ClickBrowseBtnOnUploadPopupActionGroup.xml new file mode 100644 index 0000000000000..b0c0278f0c1a5 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/ClickBrowseBtnOnUploadPopupActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ClickBrowseBtnOnUploadPopupActionGroup"> + <annotations> + <description>Clicks on the Browse button in the 'Insert/edit image' model.</description> + </annotations> + + <click selector="{{MediaGallerySection.Browse}}" stepKey="clickBrowse"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/CreateImageFolderActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/CreateImageFolderActionGroup.xml new file mode 100644 index 0000000000000..e39263debd127 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/CreateImageFolderActionGroup.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateImageFolderActionGroup"> + <annotations> + <description>Creates a folder in the Media Gallery based on the provided Folder.</description> + </annotations> + <arguments> + <argument name="ImageFolder" defaultValue="ImageFolder"/> + </arguments> + + <click selector="{{MediaGallerySection.CreateFolder}}" stepKey="createFolder"/> + <waitForElementVisible selector="{{MediaGallerySection.FolderName}}" stepKey="waitForPopUp"/> + <fillField selector="{{MediaGallerySection.FolderName}}" userInput="{{ImageFolder.name}}" stepKey="fillFolderName"/> + <click selector="{{MediaGallerySection.AcceptFolderName}}" stepKey="acceptFolderName"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoading3"/> + <waitForPageLoad stepKey="waitForLoadingArrowToExpand" time="15"/> + <conditionalClick selector="{{MediaGallerySection.StorageRootArrow}}" dependentSelector="{{MediaGallerySection.checkIfArrowExpand}}" stepKey="clickArrowIfClosed" visible="true"/> + <conditionalClick selector="{{MediaGallerySection.WysiwygArrow}}" dependentSelector="{{MediaGallerySection.checkIfWysiwygArrowExpand}}" stepKey="clickWysiwygArrowIfClosed" visible="true"/> + <waitForText userInput="{{ImageFolder.name}}" stepKey="waitForNewFolder"/> + <click userInput="{{ImageFolder.name}}" stepKey="clickOnCreatedFolder"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoading5"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/CreateNewPageWithAllValuesActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/CreateNewPageWithAllValuesActionGroup.xml index fa5cccafccd54..fb8250ae00f27 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/CreateNewPageWithAllValuesActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/CreateNewPageWithAllValuesActionGroup.xml @@ -8,7 +8,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="CreateNewPageWithAllValues"> + <actionGroup name="CreateNewPageWithAllValuesActionGroup"> <annotations> <description>Goes to the Admin CMS creation page. Fills in the provided Page details (Title, Heading, URL, Store View and Hierarchy).</description> </annotations> @@ -33,10 +33,4 @@ <click selector="{{CmsNewPageHierarchySection.header}}" stepKey="clickHierarchy"/> <click selector="{{CmsNewPageHierarchySection.selectHierarchy(selectHierarchyOpt)}}" stepKey="clickPageCheckBoxes"/> </actionGroup> - <actionGroup name="CreateNewPageWithAllValuesAndContent" extends="CreateNewPageWithAllValues"> - <arguments> - <argument name="pageContent" type="string"/> - </arguments> - <fillField selector="{{CmsNewPagePageContentSection.content}}" userInput="{{pageContent}}" stepKey="fillContentField" after="fillFieldContentHeading"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/CreateNewPageWithAllValuesAndContentActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/CreateNewPageWithAllValuesAndContentActionGroup.xml new file mode 100644 index 0000000000000..201e78fff6dbe --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/CreateNewPageWithAllValuesAndContentActionGroup.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateNewPageWithAllValuesAndContentActionGroup" extends="CreateNewPageWithAllValues"> + <arguments> + <argument name="pageContent" type="string"/> + </arguments> + <fillField selector="{{CmsNewPagePageContentSection.content}}" userInput="{{pageContent}}" stepKey="fillContentField" after="fillFieldContentHeading"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/DeleteCMSBlockActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/DeleteCMSBlockActionGroup.xml new file mode 100644 index 0000000000000..2f9b03f1e33b3 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/DeleteCMSBlockActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DeleteCMSBlockActionGroup"> + <annotations> + <description>Goes to the Admin CMS Blocks page. Deletes the '_defaultBlock' Block. Validates that the Success Message is present and correct. PLEASE NOTE: The Block that is deleted it Hardcoded.</description> + </annotations> + + <amOnPage url="{{CmsBlocksPage.url}}" stepKey="navigateToCMSPagesGrid"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <click selector="{{CmsPagesPageActionsSection.select(_defaultBlock.title)}}" stepKey="ClickOnSelect"/> + <click selector="{{CmsPagesPageActionsSection.delete(_defaultBlock.title)}}" stepKey="ClickOnEdit"/> + <waitForPageLoad stepKey="waitForPageLoad3"/> + <click selector="{{CmsPagesPageActionsSection.deleteConfirm}}" stepKey="ClickToConfirm"/> + <waitForPageLoad stepKey="waitForPageLoad4"/> + <see userInput="You deleted the block." stepKey="VerifyBlockIsDeleted"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/DeleteImageActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/DeleteImageActionGroup.xml new file mode 100644 index 0000000000000..3bf2c6795bcb6 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/DeleteImageActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DeleteImageActionGroup"> + <annotations> + <description>Deletes the selected Image from the Media Gallery.</description> + </annotations> + + <see selector="{{MediaGallerySection.DeleteSelectedBtn}}" userInput="Delete Selected" stepKey="seeDeleteBtn"/> + <click selector="{{MediaGallerySection.DeleteSelectedBtn}}" stepKey="clickDeleteSelected"/> + <waitForText userInput="OK" stepKey="waitForConfirm"/> + <click selector="{{MediaGallerySection.confirmDelete}}" stepKey="confirmDelete"/> + <waitForElementNotVisible selector="{{MediaGallerySection.image(ImageUpload.file)}}" stepKey="waitForImageDeleted"/> + <dontSeeElement selector="{{MediaGallerySection.image(ImageUpload.file)}}" stepKey="dontSeeImage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/FillOutUploadImagePopupActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/FillOutUploadImagePopupActionGroup.xml new file mode 100644 index 0000000000000..dc4abe9a5115a --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/FillOutUploadImagePopupActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FillOutUploadImagePopupActionGroup"> + <annotations> + <description>Fills in the Image Description and Height fields. PLEASE NOTE: The values are Hardcoded using 'ImageUpload'.</description> + </annotations> + + <waitForElementVisible selector="{{MediaGallerySection.OkBtn}}" stepKey="waitForOkBtn"/> + <fillField selector="{{MediaGallerySection.ImageDescription}}" userInput="{{ImageUpload.content}}" stepKey="fillImageDescription"/> + <fillField selector="{{MediaGallerySection.Height}}" userInput="{{ImageUpload.height}}" stepKey="fillImageHeight"/> + <click selector="{{MediaGallerySection.OkBtn}}" stepKey="clickOkBtn"/> + <waitForPageLoad stepKey="wait3"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/NavigateToCreatedCMSBlockPageActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/NavigateToCreatedCMSBlockPageActionGroup.xml new file mode 100644 index 0000000000000..06bc3787579e4 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/NavigateToCreatedCMSBlockPageActionGroup.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="NavigateToCreatedCMSBlockPageActionGroup"> + <annotations> + <description>Goes to the Admin Blocks page. Clicks on 'Edit' for the provided Block.</description> + </annotations> + <arguments> + <argument name="CMSBlockPage" defaultValue=""/> + </arguments> + + <amOnPage url="{{CmsBlocksPage.url}}" stepKey="navigateToCMSBlocksGrid"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + <conditionalClick selector="{{CmsPagesPageActionsSection.clearAllButton}}" dependentSelector="{{CmsPagesPageActionsSection.activeFilters}}" stepKey="clickToResetFilter" visible="true"/> + <waitForPageLoad stepKey="waitForPageLoad2"/> + <conditionalClick selector="{{BlockPageActionsSection.idColumn}}" dependentSelector="//span[contains(text(), 'ID')]/parent::th[not(contains(@class, '_descend'))]/parent::tr/parent::thead/parent::table/parent::div[contains(@data-role, 'grid-wrapper')]" stepKey="clickToAttemptSortByIdDescending" visible="true"/> + <waitForLoadingMaskToDisappear stepKey="waitForFirstIdSortDescendingToFinish"/> + + <!-- Conditional Click again in case it goes from default state to ascending on first click --> + <conditionalClick selector="{{BlockPageActionsSection.idColumn}}" dependentSelector="//span[contains(text(), 'ID')]/parent::th[not(contains(@class, '_descend'))]/parent::tr/parent::thead/parent::table/parent::div[contains(@data-role, 'grid-wrapper')]" stepKey="secondClickToAttemptSortByIdDescending" visible="true"/> + <waitForLoadingMaskToDisappear stepKey="waitForSecondIdSortDescendingToFinish"/> + <click selector="{{BlockPageActionsSection.select(CMSBlockPage.identifier)}}" stepKey="clickSelectCreatedCMSBlock"/> + <click selector="{{BlockPageActionsSection.edit(CMSBlockPage.identifier)}}" stepKey="navigateToCreatedCMSBlock"/> + <waitForPageLoad stepKey="waitForPageLoad3"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskOfStagingSection"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/NavigateToCreatedCMSPageActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/NavigateToCreatedCMSPageActionGroup.xml new file mode 100644 index 0000000000000..3b763d3f44125 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/NavigateToCreatedCMSPageActionGroup.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="NavigateToCreatedCMSPageActionGroup"> + <annotations> + <description>Goes to the Admin CMS Pages page. </description> + </annotations> + <arguments> + <argument name="CMSPage" defaultValue=""/> + </arguments> + + <amOnPage url="{{CmsPagesPage.url}}" stepKey="navigateToCMSPagesGrid"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + <conditionalClick selector="{{CmsPagesPageActionsSection.clearAllButton}}" dependentSelector="{{CmsPagesPageActionsSection.activeFilters}}" stepKey="clickToResetFilter" visible="true"/> + <waitForPageLoad stepKey="waitForPageLoad2"/> + <conditionalClick selector="//div[contains(@data-role, 'grid-wrapper')]/table/thead/tr/th/span[contains(text(), 'ID')]" dependentSelector="//span[contains(text(), 'ID')]/parent::th[not(contains(@class, '_descend'))]/parent::tr/parent::thead/parent::table/parent::div[contains(@data-role, 'grid-wrapper')]" stepKey="clickToAttemptSortByIdDescending" visible="true"/> + <waitForLoadingMaskToDisappear stepKey="waitForFirstIdSortDescendingToFinish"/> + + <!-- Conditional Click again in case it goes from default state to ascending on first click --> + <conditionalClick selector="//div[contains(@data-role, 'grid-wrapper')]/table/thead/tr/th/span[contains(text(), 'ID')]" dependentSelector="//span[contains(text(), 'ID')]/parent::th[not(contains(@class, '_descend'))]/parent::tr/parent::thead/parent::table/parent::div[contains(@data-role, 'grid-wrapper')]" stepKey="secondClickToAttemptSortByIdDescending" visible="true"/> + <waitForLoadingMaskToDisappear stepKey="waitForSecondIdSortDescendingToFinish"/> + <click selector="{{CmsPagesPageActionsSection.select(CMSPage.identifier)}}" stepKey="clickSelectCreatedCMSPage"/> + <click selector="{{CmsPagesPageActionsSection.edit(CMSPage.identifier)}}" stepKey="navigateToCreatedCMSPage"/> + <waitForPageLoad stepKey="waitForPageLoad3"/> + <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickExpandContentTabForPage"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskOfStagingSection"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/NavigateToStorefrontForCreatedPageActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/NavigateToStorefrontForCreatedPageActionGroup.xml new file mode 100644 index 0000000000000..7576c61e2391c --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/NavigateToStorefrontForCreatedPageActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="NavigateToStorefrontForCreatedPageActionGroup"> + <annotations> + <description>Goes to the provided Page on the Storefront.</description> + </annotations> + <arguments> + <argument name="page" type="string"/> + </arguments> + + <amOnPage url="{{page}}" stepKey="goToStorefront"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/SaveAndCloseCMSBlockWithSplitButtonActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/SaveAndCloseCMSBlockWithSplitButtonActionGroup.xml new file mode 100644 index 0000000000000..95ce3c499b6b8 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/SaveAndCloseCMSBlockWithSplitButtonActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SaveAndCloseCMSBlockWithSplitButtonActionGroup"> + <annotations> + <description>Clicks on the Save and Close button.</description> + </annotations> + + <waitForElementVisible selector="{{BlockNewPagePageActionsSection.expandSplitButton}}" stepKey="waitForExpandSplitButtonToBeVisible"/> + <click selector="{{BlockNewPagePageActionsSection.expandSplitButton}}" stepKey="expandSplitButton"/> + <click selector="{{BlockNewPagePageActionsSection.saveAndClose}}" stepKey="clickSaveBlock"/> + <waitForPageLoad stepKey="waitForPageLoadAfterClickingSave"/> + <see userInput="You saved the block." stepKey="assertSaveBlockSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/SaveAndContinueEditCmsPageActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/SaveAndContinueEditCmsPageActionGroup.xml new file mode 100644 index 0000000000000..a8dce19153a98 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/SaveAndContinueEditCmsPageActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SaveAndContinueEditCmsPageActionGroup"> + <annotations> + <description>Clicks on the Save and Continue button.</description> + </annotations> + + <waitForElementVisible time="10" selector="{{CmsNewPagePageActionsSection.saveAndContinueEdit}}" stepKey="waitForSaveAndContinueVisibility"/> + <click selector="{{CmsNewPagePageActionsSection.saveAndContinueEdit}}" stepKey="clickSaveAndContinueEditCmsPage"/> + <waitForPageLoad stepKey="waitForCmsPageLoad"/> + <waitForElementVisible time="1" selector="{{CmsNewPagePageActionsSection.cmsPageTitle}}" stepKey="waitForCmsPageSaveButton"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/SaveCMSBlockActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/SaveCMSBlockActionGroup.xml new file mode 100644 index 0000000000000..2f86df70ae8c8 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/SaveCMSBlockActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SaveCMSBlockActionGroup"> + <annotations> + <description>Clicks on the Save button. Validates that the Save message is present and correct. PLEASE NOTE: The message is Hardcoded.</description> + </annotations> + + <waitForElementVisible selector="{{CmsNewBlockBlockActionsSection.savePage}}" stepKey="waitForSaveButton"/> + <click selector="{{CmsNewBlockBlockActionsSection.savePage}}" stepKey="clickSaveButton"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <see userInput="You saved the block." stepKey="seeSuccessfulSaveMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/SaveCmsPageActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/SaveCmsPageActionGroup.xml new file mode 100644 index 0000000000000..5b3b0460edbdb --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/SaveCmsPageActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SaveCmsPageActionGroup"> + <annotations> + <description>Clicks on the Save button. Validates that the Success Message is present.</description> + </annotations> + + <waitForElementVisible selector="{{CmsNewPagePageActionsSection.expandSplitButton}}" stepKey="waitForSplitButton"/> + <click selector="{{CmsNewPagePageActionsSection.expandSplitButton}}" stepKey="expandSplitButton"/> + <waitForElementVisible selector="{{CmsNewPagePageActionsSection.savePage}}" stepKey="waitForSaveCmsPage"/> + <click selector="{{CmsNewPagePageActionsSection.savePage}}" stepKey="clickSaveCmsPage"/> + <waitForElementVisible time="1" selector="{{CmsPagesPageActionsSection.addNewPageButton}}" stepKey="waitForCmsPageSaveButton"/> + <see userInput="You saved the page." selector="{{CmsPagesPageActionsSection.savePageSuccessMessage}}" stepKey="assertSavePageSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/SaveImageActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/SaveImageActionGroup.xml new file mode 100644 index 0000000000000..612cc1c485b08 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/SaveImageActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SaveImageActionGroup"> + <annotations> + <description>Clicks on Insert File in the Media Gallery.</description> + </annotations> + + <click selector="{{MediaGallerySection.InsertFile}}" stepKey="clickInsertBtn"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/SelectImageFromMediaStorageActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/SelectImageFromMediaStorageActionGroup.xml deleted file mode 100644 index 073c299c240e9..0000000000000 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/SelectImageFromMediaStorageActionGroup.xml +++ /dev/null @@ -1,120 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="clickBrowseBtnOnUploadPopup"> - <annotations> - <description>Clicks on the Browse button in the 'Insert/edit image' model.</description> - </annotations> - - <click selector="{{MediaGallerySection.Browse}}" stepKey="clickBrowse"/> - <waitForPageLoad stepKey="waitForPageLoad1"/> - </actionGroup> - - <actionGroup name="VerifyMediaGalleryStorageActions"> - <annotations> - <description>Validates that the Media Gallery 'Cancel'/'Create Folder' buttons are present.</description> - </annotations> - - <waitForPageLoad stepKey="waitForPageLoad1"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoading1"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoading2"/> - <see selector="{{MediaGallerySection.CancelBtn}}" userInput="Cancel" stepKey="seeCancelBtn"/> - <see selector="{{MediaGallerySection.CreateFolder}}" userInput="Create Folder" stepKey="seeCreateFolderBtn"/> - </actionGroup> - - <actionGroup name="CreateImageFolder"> - <annotations> - <description>Creates a folder in the Media Gallery based on the provided Folder.</description> - </annotations> - <arguments> - <argument name="ImageFolder" defaultValue="ImageFolder"/> - </arguments> - - <click selector="{{MediaGallerySection.CreateFolder}}" stepKey="createFolder"/> - <waitForElementVisible selector="{{MediaGallerySection.FolderName}}" stepKey="waitForPopUp"/> - <fillField selector="{{MediaGallerySection.FolderName}}" userInput="{{ImageFolder.name}}" stepKey="fillFolderName"/> - <click selector="{{MediaGallerySection.AcceptFolderName}}" stepKey="acceptFolderName"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoading3"/> - <waitForPageLoad stepKey="waitForLoadingArrowToExpand" time="15"/> - <conditionalClick selector="{{MediaGallerySection.StorageRootArrow}}" dependentSelector="{{MediaGallerySection.checkIfArrowExpand}}" stepKey="clickArrowIfClosed" visible="true"/> - <conditionalClick selector="{{MediaGallerySection.WysiwygArrow}}" dependentSelector="{{MediaGallerySection.checkIfWysiwygArrowExpand}}" stepKey="clickWysiwygArrowIfClosed" visible="true"/> - <waitForText userInput="{{ImageFolder.name}}" stepKey="waitForNewFolder"/> - <click userInput="{{ImageFolder.name}}" stepKey="clickOnCreatedFolder"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoading5"/> - </actionGroup> - - <actionGroup name="attachImage"> - <annotations> - <description>Uploads the provided Image to Media Gallery. - If you use this action group, you MUST add steps to delete the image in the "after" steps.</description> - </annotations> - <arguments> - <argument name="Image"/> - </arguments> - - <attachFile selector="{{MediaGallerySection.BrowseUploadImage}}" userInput="{{Image.value}}" stepKey="uploadImage"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear"/> - <waitForElementVisible selector="{{MediaGallerySection.imageOrImageCopy(Image.fileName, Image.extension)}}" stepKey="waitForUploadImage"/> - </actionGroup> - - <actionGroup name="deleteImage"> - <annotations> - <description>Deletes the selected Image from the Media Gallery.</description> - </annotations> - - <see selector="{{MediaGallerySection.DeleteSelectedBtn}}" userInput="Delete Selected" stepKey="seeDeleteBtn"/> - <click selector="{{MediaGallerySection.DeleteSelectedBtn}}" stepKey="clickDeleteSelected"/> - <waitForText userInput="OK" stepKey="waitForConfirm"/> - <click selector="{{MediaGallerySection.confirmDelete}}" stepKey="confirmDelete"/> - <waitForElementNotVisible selector="{{MediaGallerySection.image(ImageUpload.file)}}" stepKey="waitForImageDeleted"/> - <dontSeeElement selector="{{MediaGallerySection.image(ImageUpload.file)}}" stepKey="dontSeeImage"/> - </actionGroup> - - <actionGroup name="saveImage"> - <annotations> - <description>Clicks on Insert File in the Media Gallery.</description> - </annotations> - - <click selector="{{MediaGallerySection.InsertFile}}" stepKey="clickInsertBtn"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear"/> - </actionGroup> - - <actionGroup name="fillOutUploadImagePopup"> - <annotations> - <description>Fills in the Image Description and Height fields. PLEASE NOTE: The values are Hardcoded using 'ImageUpload'.</description> - </annotations> - - <waitForElementVisible selector="{{MediaGallerySection.OkBtn}}" stepKey="waitForOkBtn"/> - <fillField selector="{{MediaGallerySection.ImageDescription}}" userInput="{{ImageUpload.content}}" stepKey="fillImageDescription"/> - <fillField selector="{{MediaGallerySection.Height}}" userInput="{{ImageUpload.height}}" stepKey="fillImageHeight"/> - <click selector="{{MediaGallerySection.OkBtn}}" stepKey="clickOkBtn"/> - <waitForPageLoad stepKey="wait3"/> - </actionGroup> - - <actionGroup name="verifyOversizeValidationMsg"> - <annotations> - <description>Validates that the Oversize validation message is present and correct.</description> - </annotations> - - <see userInput="this is oversize" stepKey="seeValidationMsg"/> - <click selector="#OK" stepKey="clickOKBtn"/> - </actionGroup> - - <actionGroup name="verifyWrongExtensionValidationMsg"> - <annotations> - <description>Validates that the Wrong Extensions validation message is present and correct.</description> - </annotations> - - <see userInput="this is wrong extension" stepKey="seeValidationMsg"/> - <click selector="#OK" stepKey="clickOKBtn"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/SetLayoutActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/SetLayoutActionGroup.xml new file mode 100644 index 0000000000000..23f4cccd33118 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/SetLayoutActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SetLayoutActionGroup"> + <annotations> + <description>Sets the provided option for 'Layout', under 'Design' on the Page creation/edit page. </description> + </annotations> + <arguments> + <argument name="designSection"/> + <argument name="layoutOption"/> + </arguments> + + <waitForElementVisible selector="{{designSection.DesignTab}}" stepKey="waitForDesignTabVisible"/> + <conditionalClick selector="{{designSection.DesignTab}}" dependentSelector="{{designSection.LayoutDropdown}}" visible="false" stepKey="clickOnDesignTab"/> + <waitForPageLoad stepKey="waitForPageLoadDesignTab"/> + <waitForElementVisible selector="{{designSection.LayoutDropdown}}" stepKey="waitForLayoutDropDown"/> + <selectOption selector="{{designSection.LayoutDropdown}}" userInput="{{layoutOption}}" stepKey="selectLayout"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyMagentoEntityActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyMagentoEntityActionGroup.xml new file mode 100644 index 0000000000000..717c0dbb83dd2 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyMagentoEntityActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="VerifyMagentoEntityActionGroup"> + <annotations> + <description>Validates that the Insert Widget and Insert Variables buttons are present.</description> + </annotations> + + <seeElement selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="assertInfo15"/> + <seeElement selector="{{TinyMCESection.InsertVariableIcon}}" stepKey="assertInfo16"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyMediaGalleryStorageActionsActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyMediaGalleryStorageActionsActionGroup.xml new file mode 100644 index 0000000000000..4410be84485d0 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyMediaGalleryStorageActionsActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="VerifyMediaGalleryStorageActionsActionGroup"> + <annotations> + <description>Validates that the Media Gallery 'Cancel'/'Create Folder' buttons are present.</description> + </annotations> + + <waitForPageLoad stepKey="waitForPageLoad1"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoading1"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoading2"/> + <see selector="{{MediaGallerySection.CancelBtn}}" userInput="Cancel" stepKey="seeCancelBtn"/> + <see selector="{{MediaGallerySection.CreateFolder}}" userInput="Create Folder" stepKey="seeCreateFolderBtn"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyOversizeValidationMsgActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyOversizeValidationMsgActionGroup.xml new file mode 100644 index 0000000000000..6a4d49fcd6eb7 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyOversizeValidationMsgActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="VerifyOversizeValidationMsgActionGroup"> + <annotations> + <description>Validates that the Oversize validation message is present and correct.</description> + </annotations> + + <see userInput="this is oversize" stepKey="seeValidationMsg"/> + <click selector="#OK" stepKey="clickOKBtn"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyTinyMCEActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyTinyMCEActionGroup.xml index c1682e32c28c6..7ba0fcdf0d605 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyTinyMCEActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyTinyMCEActionGroup.xml @@ -12,7 +12,7 @@ <annotations> <description>Goes to Admin CMS Page creation page. Validates that all of the Tiny MCE buttons are present.</description> </annotations> - + <seeElement selector="{{TinyMCESection.Style}}" stepKey="assertInfo2"/> <seeElement selector="{{TinyMCESection.Bold}}" stepKey="assertInfo3"/> <seeElement selector="{{TinyMCESection.Italic}}" stepKey="assertInfo4"/> @@ -27,13 +27,4 @@ <seeElement selector="{{TinyMCESection.InsertTable}}" stepKey="assertInfo13"/> <seeElement selector="{{TinyMCESection.SpecialCharacter}}" stepKey="assertInfo14"/> </actionGroup> - - <actionGroup name="VerifyMagentoEntityActionGroup"> - <annotations> - <description>Validates that the Insert Widget and Insert Variables buttons are present.</description> - </annotations> - - <seeElement selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="assertInfo15"/> - <seeElement selector="{{TinyMCESection.InsertVariableIcon}}" stepKey="assertInfo16"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyWrongExtensionValidationMsgActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyWrongExtensionValidationMsgActionGroup.xml new file mode 100644 index 0000000000000..bfd43bf0d9e1d --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyWrongExtensionValidationMsgActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="VerifyWrongExtensionValidationMsgActionGroup"> + <annotations> + <description>Validates that the Wrong Extensions validation message is present and correct.</description> + </annotations> + + <see userInput="this is wrong extension" stepKey="seeValidationMsg"/> + <click selector="#OK" stepKey="clickOKBtn"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToCMSPageTinyMCE3Test.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToCMSPageTinyMCE3Test.xml index 11bf03c1d5ee9..69f9d24699db0 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToCMSPageTinyMCE3Test.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToCMSPageTinyMCE3Test.xml @@ -47,13 +47,13 @@ <click selector="{{MediaGallerySection.browseForImage}}" stepKey="clickBrowse"/> <switchToIFrame stepKey="switchOutOfIFrame"/> <waitForPageLoad stepKey="waitForPageToLoad" /> - <actionGroup ref="CreateImageFolder" stepKey="CreateImageFolder"> + <actionGroup ref="CreateImageFolderActionGroup" stepKey="CreateImageFolder"> <argument name="ImageFolder" value="ImageFolder"/> </actionGroup> - <actionGroup ref="attachImage" stepKey="attachImage1"> + <actionGroup ref="AttachImageActionGroup" stepKey="attachImage1"> <argument name="Image" value="ImageUpload"/> </actionGroup> - <actionGroup ref="saveImage" stepKey="insertImage"/> + <actionGroup ref="SaveImageActionGroup" stepKey="insertImage"/> <!-- Switching back to the Edit/Insert Image iFrame--> <comment userInput="switching back to iFrame" stepKey="switchBackToIFrame"/> <executeJS function="document.querySelector('.clearlooks2 iframe').setAttribute('name', 'insert-image');" stepKey="makeIFrameInteractable2"/> @@ -67,4 +67,4 @@ <click selector="{{CmsNewPagePageActionsSection.savePage}}" stepKey="clickSavePage"/> <see userInput="You saved the page." stepKey="seeSuccessMessage"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGBlockTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGBlockTest.xml index 03edc69e6d625..23f43ed21367c 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGBlockTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGBlockTest.xml @@ -28,27 +28,27 @@ <argument name="Block" value="$$createPreReqBlock$$"/> <argument name="CmsPage" value="$$createCMSPage$$"/> </actionGroup> - <actionGroup ref="navigateToCreatedCMSBlockPage" stepKey="navigateToCreatedCMSBlockPage1"> + <actionGroup ref="NavigateToCreatedCMSBlockPageActionGroup" stepKey="navigateToCreatedCMSBlockPage1"> <argument name="CMSBlockPage" value="$$createPreReqBlock$$"/> </actionGroup> <selectOption selector="{{BlockNewPageBasicFieldsSection.storeView}}" userInput="All Store View" stepKey="selectAllStoreView" /> <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE" /> <click selector="{{TinyMCESection.InsertImageIcon}}" stepKey="clickInsertImageIcon" /> <waitForPageLoad stepKey="waitForPageLoad2" /> - <actionGroup ref="clickBrowseBtnOnUploadPopup" stepKey="clickBrowserBtn"/> - <actionGroup ref="VerifyMediaGalleryStorageActions" stepKey="VerifyMediaGalleryStorageBtn"/> - <actionGroup ref="CreateImageFolder" stepKey="CreateImageFolder"> + <actionGroup ref="ClickBrowseBtnOnUploadPopupActionGroup" stepKey="clickBrowserBtn"/> + <actionGroup ref="VerifyMediaGalleryStorageActionsActionGroup" stepKey="VerifyMediaGalleryStorageBtn"/> + <actionGroup ref="CreateImageFolderActionGroup" stepKey="CreateImageFolder"> <argument name="ImageFolder" value="ImageFolder"/> </actionGroup> - <actionGroup ref="attachImage" stepKey="attachImage1"> + <actionGroup ref="AttachImageActionGroup" stepKey="attachImage1"> <argument name="Image" value="ImageUpload"/> </actionGroup> - <actionGroup ref="deleteImage" stepKey="deleteImage"/> - <actionGroup ref="attachImage" stepKey="attachImage2"> + <actionGroup ref="DeleteImageActionGroup" stepKey="deleteImage"/> + <actionGroup ref="AttachImageActionGroup" stepKey="attachImage2"> <argument name="Image" value="ImageUpload"/> </actionGroup> - <actionGroup ref="saveImage" stepKey="insertImage"/> - <actionGroup ref="fillOutUploadImagePopup" stepKey="fillOutUploadImagePopup" /> + <actionGroup ref="SaveImageActionGroup" stepKey="insertImage"/> + <actionGroup ref="FillOutUploadImagePopupActionGroup" stepKey="fillOutUploadImagePopup" /> <click selector="{{BlockNewPagePageActionsSection.saveBlock}}" stepKey="clickSaveBlock"/> <amOnPage url="$$createCMSPage.identifier$$" stepKey="amOnPageTestPage"/> <waitForPageLoad stepKey="waitForPageLoad11" /> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGCMSTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGCMSTest.xml index 205850f888797..a244e4bc7f525 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGCMSTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGCMSTest.xml @@ -23,27 +23,27 @@ <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> - <actionGroup ref="navigateToCreatedCMSPage" stepKey="navigateToCreatedCMSPage"> + <actionGroup ref="NavigateToCreatedCMSPageActionGroup" stepKey="navigateToCreatedCMSPage"> <argument name="CMSPage" value="$$createCMSPage$$"/> </actionGroup> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickExpandContent"/> <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE4" /> <click selector="{{TinyMCESection.InsertImageIcon}}" stepKey="clickInsertImageIcon" /> <waitForPageLoad stepKey="waitForPageLoad" /> - <actionGroup ref="clickBrowseBtnOnUploadPopup" stepKey="clickBrowserBtn"/> - <actionGroup ref="VerifyMediaGalleryStorageActions" stepKey="VerifyMediaGalleryStorageBtn"/> - <actionGroup ref="CreateImageFolder" stepKey="CreateImageFolder"> + <actionGroup ref="ClickBrowseBtnOnUploadPopupActionGroup" stepKey="clickBrowserBtn"/> + <actionGroup ref="VerifyMediaGalleryStorageActionsActionGroup" stepKey="VerifyMediaGalleryStorageBtn"/> + <actionGroup ref="CreateImageFolderActionGroup" stepKey="CreateImageFolder"> <argument name="ImageFolder" value="ImageFolder"/> </actionGroup> - <actionGroup ref="attachImage" stepKey="attachImage1"> + <actionGroup ref="AttachImageActionGroup" stepKey="attachImage1"> <argument name="Image" value="ImageUpload3"/> </actionGroup> - <actionGroup ref="deleteImage" stepKey="deleteImage"/> - <actionGroup ref="attachImage" stepKey="attachImage2"> + <actionGroup ref="DeleteImageActionGroup" stepKey="deleteImage"/> + <actionGroup ref="AttachImageActionGroup" stepKey="attachImage2"> <argument name="Image" value="ImageUpload3"/> </actionGroup> - <actionGroup ref="saveImage" stepKey="insertImage"/> - <actionGroup ref="fillOutUploadImagePopup" stepKey="fillOutUploadImagePopup" /> + <actionGroup ref="SaveImageActionGroup" stepKey="insertImage"/> + <actionGroup ref="FillOutUploadImagePopupActionGroup" stepKey="fillOutUploadImagePopup" /> <click selector="{{CmsNewPagePageSeoSection.header}}" stepKey="clickExpandSearchEngineOptimisation"/> <fillField selector="{{CmsNewPagePageSeoSection.urlKey}}" userInput="$$createCMSPage.identifier$$" stepKey="fillFieldUrlKey"/> <click selector="{{CmsNewPagePageActionsSection.expandSplitButton}}" stepKey="expandButtonMenu"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddVariableToWYSIWYGBlockTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddVariableToWYSIWYGBlockTest.xml index ce34a8d09c302..4ff5f314662b3 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddVariableToWYSIWYGBlockTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddVariableToWYSIWYGBlockTest.xml @@ -38,7 +38,7 @@ <argument name="Block" value="$$createPreReqBlock$$"/> <argument name="CmsPage" value="$$createCMSPage$$"/> </actionGroup> - <actionGroup ref="navigateToCreatedCMSBlockPage" stepKey="navigateToCreatedCMSBlockPage1"> + <actionGroup ref="NavigateToCreatedCMSBlockPageActionGroup" stepKey="navigateToCreatedCMSBlockPage1"> <argument name="CMSBlockPage" value="$$createPreReqBlock$$"/> </actionGroup> <selectOption selector="{{BlockNewPageBasicFieldsSection.storeView}}" userInput="All Store View" stepKey="selectAllStoreView" /> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGBlockTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGBlockTest.xml index ad5e769c61be4..0253e62b40a56 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGBlockTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGBlockTest.xml @@ -24,7 +24,7 @@ <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> - <actionGroup ref="navigateToCreatedCMSBlockPage" stepKey="navigateToCreatedCMSBlockPage"> + <actionGroup ref="NavigateToCreatedCMSBlockPageActionGroup" stepKey="navigateToCreatedCMSBlockPage"> <argument name="CMSBlockPage" value="$$createPreReqBlock$$"/> </actionGroup> <selectOption selector="{{BlockNewPageBasicFieldsSection.storeView}}" userInput="All Store View" stepKey="selectAllStoreView" /> @@ -45,7 +45,7 @@ <waitForElementNotVisible selector="{{WidgetSection.InsertWidgetTitle}}" stepKey="waitForSlideOutCloses1" /> <click selector="{{BlockNewPagePageActionsSection.expandSplitButton}}" stepKey="expandSplitButton"/> <click selector="{{BlockNewPagePageActionsSection.saveAndClose}}" stepKey="clickSaveBlock"/> - <actionGroup ref="navigateToCreatedCMSPage" stepKey="navigateToCreatedCMSPage"> + <actionGroup ref="NavigateToCreatedCMSPageActionGroup" stepKey="navigateToCreatedCMSPage"> <argument name="CMSPage" value="$$createCMSPage$$"/> </actionGroup> <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsPageTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsPageTest.xml index b7c7e4a4212fe..6d5adc65fb1df 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsPageTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsPageTest.xml @@ -110,7 +110,7 @@ <see userInput="You duplicated the page." stepKey="seeDuplicatedPageMsg"/> <!--Verify duplicated CMS Page--> <seeElement selector="{{BlockNewPageBasicFieldsSection.isActive('0')}}" stepKey="seeBlockNotEnable" /> - <actionGroup ref="AssertCMSPageContent" stepKey="assertContent"/> + <actionGroup ref="AssertCMSPageContentActionGroup" stepKey="assertContent"/> <click selector="{{CmsNewPagePageActionsSection.expandSplitButton}}" stepKey="expandSplitBtn3" /> <click selector="{{CmsNewPagePageActionsSection.saveAndClose}}" stepKey="clickSaveAndClose"/> <see userInput="You saved the page." stepKey="seeSavedCMSPageMsgOnGrid"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminMediaGalleryPopupUploadImagesWithoutErrorTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminMediaGalleryPopupUploadImagesWithoutErrorTest.xml index bc1688c9d692b..ff389a6ce2965 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminMediaGalleryPopupUploadImagesWithoutErrorTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminMediaGalleryPopupUploadImagesWithoutErrorTest.xml @@ -37,7 +37,7 @@ </after> <!--Open created block page and add image--> <comment userInput="Open create block page and add image" stepKey="commentOpenBlockPage"/> - <actionGroup ref="navigateToCreatedCMSBlockPage" stepKey="navigateToCreatedCMSBlockPage1"> + <actionGroup ref="NavigateToCreatedCMSBlockPageActionGroup" stepKey="navigateToCreatedCMSBlockPage1"> <argument name="CMSBlockPage" value="$$createBlock$$"/> </actionGroup> <actionGroup ref="AdminAddImageToCMSBlockContent" stepKey="addImage"> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/CheckOrderOfProdsInWidgetOnCMSPageTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/CheckOrderOfProdsInWidgetOnCMSPageTest.xml index ce093144e6a2a..cfb765656dbd1 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/CheckOrderOfProdsInWidgetOnCMSPageTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/CheckOrderOfProdsInWidgetOnCMSPageTest.xml @@ -41,7 +41,7 @@ <deleteData createDataKey="createCMSPage" stepKey="deletePreReqCMSPage"/> <actionGroup ref="logout" stepKey="logoutOfAdmin"/> </after> - <actionGroup ref="navigateToCreatedCMSPage" stepKey="navigateToCreatedCMSPage1"> + <actionGroup ref="NavigateToCreatedCMSPageActionGroup" stepKey="navigateToCreatedCMSPage1"> <argument name="CMSPage" value="$$createCMSPage$$"/> </actionGroup> <conditionalClick selector="{{CmsNewPagePageContentSection.header}}" @@ -99,7 +99,7 @@ <argument name="product_1" value="$$product1$$"/> <argument name="product_2" value="$$product2$$"/> </actionGroup> - <actionGroup ref="navigateToCreatedCMSPage" stepKey="navigateToCreatedCMSPage2"> + <actionGroup ref="NavigateToCreatedCMSPageActionGroup" stepKey="navigateToCreatedCMSPage2"> <argument name="CMSPage" value="$$createCMSPage$$"/> </actionGroup> <conditionalClick selector="{{CmsNewPagePageContentSection.header}}" diff --git a/app/code/Magento/Cms/Test/Mftf/Test/StoreViewLanguageCorrectSwitchTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/StoreViewLanguageCorrectSwitchTest.xml index d4796b2ef7d43..6569c07f4580a 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/StoreViewLanguageCorrectSwitchTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/StoreViewLanguageCorrectSwitchTest.xml @@ -41,7 +41,7 @@ </actionGroup> <!-- Add StoreView To Cms Page--> - <actionGroup ref="AddStoreViewToCmsPage" stepKey="gotToCmsPage"> + <actionGroup ref="AddStoreViewToCmsPageActionGroup" stepKey="gotToCmsPage"> <argument name="CMSPage" value="$$createSecondCmsPage$$"/> <argument name="storeViewName" value="{{NewStoreViewData.name}}"/> </actionGroup> diff --git a/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddImageToWYSIWYGNewsletterTest.xml b/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddImageToWYSIWYGNewsletterTest.xml index 0371c0265d149..a62933d7ecb9e 100644 --- a/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddImageToWYSIWYGNewsletterTest.xml +++ b/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddImageToWYSIWYGNewsletterTest.xml @@ -33,16 +33,16 @@ <waitForElementVisible selector="{{NewsletterWYSIWYGSection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> <click selector="{{TinyMCESection.InsertImageIcon}}" stepKey="clickInsertImageIcon" /> <waitForPageLoad stepKey="waitForPageLoad" /> - <actionGroup ref="clickBrowseBtnOnUploadPopup" stepKey="clickBrowserBtn"/> - <actionGroup ref="VerifyMediaGalleryStorageActions" stepKey="VerifyMediaGalleryStorageBtn"/> - <actionGroup ref="CreateImageFolder" stepKey="CreateImageFolder"> + <actionGroup ref="ClickBrowseBtnOnUploadPopupActionGroup" stepKey="clickBrowserBtn"/> + <actionGroup ref="VerifyMediaGalleryStorageActionsActionGroup" stepKey="VerifyMediaGalleryStorageBtn"/> + <actionGroup ref="CreateImageFolderActionGroup" stepKey="CreateImageFolder"> <argument name="ImageFolder" value="ImageFolder"/> </actionGroup> - <actionGroup ref="attachImage" stepKey="attachImage1"> + <actionGroup ref="AttachImageActionGroup" stepKey="attachImage1"> <argument name="Image" value="ImageUpload3"/> </actionGroup> - <actionGroup ref="saveImage" stepKey="insertImage"/> - <actionGroup ref="fillOutUploadImagePopup" stepKey="fillOutUploadImagePopup" /> + <actionGroup ref="SaveImageActionGroup" stepKey="insertImage"/> + <actionGroup ref="FillOutUploadImagePopupActionGroup" stepKey="fillOutUploadImagePopup" /> <click selector="{{BasicFieldNewsletterSection.save}}" stepKey="clickSaveTemplate"/> <waitForPageLoad stepKey="waitForPageLoad10" /> <!--Preview the newsletter template--> diff --git a/app/code/Magento/Theme/Test/Mftf/Test/AdminDesignConfigMediaGalleryImageUploadTest.xml b/app/code/Magento/Theme/Test/Mftf/Test/AdminDesignConfigMediaGalleryImageUploadTest.xml index f46328ac151b1..201f8eba3376b 100644 --- a/app/code/Magento/Theme/Test/Mftf/Test/AdminDesignConfigMediaGalleryImageUploadTest.xml +++ b/app/code/Magento/Theme/Test/Mftf/Test/AdminDesignConfigMediaGalleryImageUploadTest.xml @@ -35,14 +35,14 @@ <!--Upload Image--> <comment userInput="Upload Image" stepKey="uploadImageComment"/> <click selector="{{AdminDesignConfigSection.selectFromGalleryByFieldsetName('Head')}}" stepKey="openMediaGallery"/> - <actionGroup ref="VerifyMediaGalleryStorageActions" stepKey="verifyMediaGalleryStorageBtn"/> + <actionGroup ref="VerifyMediaGalleryStorageActionsActionGroup" stepKey="verifyMediaGalleryStorageBtn"/> <actionGroup ref="NavigateToMediaFolderActionGroup" stepKey="navigateToFolder"> <argument name="FolderName" value="Storage Root"/> </actionGroup> - <actionGroup ref="attachImage" stepKey="selectImageFromMediaStorage"> + <actionGroup ref="AttachImageActionGroup" stepKey="selectImageFromMediaStorage"> <argument name="Image" value="ImageUpload3"/> </actionGroup> - <actionGroup ref="saveImage" stepKey="insertImage"/> + <actionGroup ref="SaveImageActionGroup" stepKey="insertImage"/> <click selector="{{AdminDesignConfigSection.saveConfiguration}}" stepKey="saveConfiguration"/> <waitForElementVisible selector="{{AdminDesignConfigSection.successNotification}}" stepKey="waitForSuccessNotification"/> <waitForPageLoad stepKey="waitForPageloadSuccess"/> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCMSPageUrlRewriteAndAddPermanentRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCMSPageUrlRewriteAndAddPermanentRedirectTest.xml index 358aa58aba0f7..3329dd61e0352 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCMSPageUrlRewriteAndAddPermanentRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCMSPageUrlRewriteAndAddPermanentRedirectTest.xml @@ -30,7 +30,7 @@ </after> <!--Open CMS Edit Page and Get the CMS ID --> - <actionGroup ref="navigateToCreatedCMSPage" stepKey="navigateToCreatedCMSPage"> + <actionGroup ref="NavigateToCreatedCMSPageActionGroup" stepKey="navigateToCreatedCMSPage"> <argument name="CMSPage" value="$$createCMSPage$$"/> </actionGroup> <grabFromCurrentUrl stepKey="cmsId" regex="#\/([0-9]*)?\/$#"/> @@ -60,24 +60,24 @@ </actionGroup> <!-- Assert Updated Request Path redirects to the CMS Page on Store Front --> - <actionGroup ref="navigateToStorefrontForCreatedPage" stepKey="navigateToTheStoreFront"> + <actionGroup ref="NavigateToStorefrontForCreatedPageActionGroup" stepKey="navigateToTheStoreFront"> <argument name="page" value="{{defaultCmsPage.title}}"/> </actionGroup> <!-- Assert updated CMS redirect in Store Front --> - <actionGroup ref="AssertStoreFrontCMSPage" stepKey="assertCMSPage"> + <actionGroup ref="AssertStoreFrontCMSPageActionGroup" stepKey="assertCMSPage"> <argument name="cmsTitle" value="$$createCMSPage.title$$"/> <argument name="cmsContent" value="$$createCMSPage.content$$"/> <argument name="cmsContentHeading" value="$$createCMSPage.content_heading$$"/> </actionGroup> <!-- Assert initial request path directs to the CMS Page on Store Front --> - <actionGroup ref="navigateToStorefrontForCreatedPage" stepKey="navigateToTheStoreFront1"> + <actionGroup ref="NavigateToStorefrontForCreatedPageActionGroup" stepKey="navigateToTheStoreFront1"> <argument name="page" value="$$createCMSPage.identifier$$"/> </actionGroup> <!-- Assert initial CMS redirect in Store Front --> - <actionGroup ref="AssertStoreFrontCMSPage" stepKey="assertCMSPage1"> + <actionGroup ref="AssertStoreFrontCMSPageActionGroup" stepKey="assertCMSPage1"> <argument name="cmsTitle" value="$$createCMSPage.title$$"/> <argument name="cmsContent" value="$$createCMSPage.content$$"/> <argument name="cmsContentHeading" value="$$createCMSPage.content_heading$$"/> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCMSPageUrlRewriteAndAddTemporaryRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCMSPageUrlRewriteAndAddTemporaryRedirectTest.xml index e6ee9b484059d..cf66d7a06f0d0 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCMSPageUrlRewriteAndAddTemporaryRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCMSPageUrlRewriteAndAddTemporaryRedirectTest.xml @@ -30,7 +30,7 @@ </after> <!--Open CMS Edit Page and Get the CMS ID --> - <actionGroup ref="navigateToCreatedCMSPage" stepKey="navigateToCreatedCMSPage"> + <actionGroup ref="NavigateToCreatedCMSPageActionGroup" stepKey="navigateToCreatedCMSPage"> <argument name="CMSPage" value="$$createCMSPage$$"/> </actionGroup> <grabFromCurrentUrl stepKey="cmsId" regex="#\/([0-9]*)?\/$#"/> @@ -60,24 +60,24 @@ </actionGroup> <!-- Assert Updated Request Path redirects to the CMS Page on Store Front --> - <actionGroup ref="navigateToStorefrontForCreatedPage" stepKey="navigateToTheStoreFront"> + <actionGroup ref="NavigateToStorefrontForCreatedPageActionGroup" stepKey="navigateToTheStoreFront"> <argument name="page" value="{{defaultCmsPage.title}}"/> </actionGroup> <!--Assert updated CMS redirect in Store Front--> - <actionGroup ref="AssertStoreFrontCMSPage" stepKey="assertCMSPage"> + <actionGroup ref="AssertStoreFrontCMSPageActionGroup" stepKey="assertCMSPage"> <argument name="cmsTitle" value="$$createCMSPage.title$$"/> <argument name="cmsContent" value="$$createCMSPage.content$$"/> <argument name="cmsContentHeading" value="$$createCMSPage.content_heading$$"/> </actionGroup> <!-- Assert initial request path directs to the CMS Page on Store Front --> - <actionGroup ref="navigateToStorefrontForCreatedPage" stepKey="navigateToTheStoreFront1"> + <actionGroup ref="NavigateToStorefrontForCreatedPageActionGroup" stepKey="navigateToTheStoreFront1"> <argument name="page" value="$$createCMSPage.identifier$$"/> </actionGroup> <!--Assert initial CMS redirect in Store Front--> - <actionGroup ref="AssertStoreFrontCMSPage" stepKey="assertCMSPage1"> + <actionGroup ref="AssertStoreFrontCMSPageActionGroup" stepKey="assertCMSPage1"> <argument name="cmsTitle" value="$$createCMSPage.title$$"/> <argument name="cmsContent" value="$$createCMSPage.content$$"/> <argument name="cmsContentHeading" value="$$createCMSPage.content_heading$$"/> From cf1b0845fd7d0c083b5f20ba2c0a495d0e9bf9ad Mon Sep 17 00:00:00 2001 From: Andreas Mautz <am@webvisum.de> Date: Fri, 29 Nov 2019 10:58:58 +0100 Subject: [PATCH 0177/1143] [FIXES] #25674: Elasticsearch version selections in admin are overly broad. This removes the X.0+ notation and replaces it with X.x notation --- .../Mftf/Test/ProductQuickSearchUsingElasticSearchTest.xml | 6 +++--- app/code/Magento/Elasticsearch/etc/adminhtml/system.xml | 2 +- app/code/Magento/Elasticsearch/etc/di.xml | 2 +- .../Magento/Elasticsearch6/Test/Mftf/Data/ConfigData.xml | 2 +- app/code/Magento/Elasticsearch6/etc/adminhtml/system.xml | 2 +- app/code/Magento/Elasticsearch6/etc/di.xml | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Elasticsearch/Test/Mftf/Test/ProductQuickSearchUsingElasticSearchTest.xml b/app/code/Magento/Elasticsearch/Test/Mftf/Test/ProductQuickSearchUsingElasticSearchTest.xml index d8ce091fba76f..9891b80435476 100644 --- a/app/code/Magento/Elasticsearch/Test/Mftf/Test/ProductQuickSearchUsingElasticSearchTest.xml +++ b/app/code/Magento/Elasticsearch/Test/Mftf/Test/ProductQuickSearchUsingElasticSearchTest.xml @@ -11,7 +11,7 @@ <test name="ProductQuickSearchUsingElasticSearchTest"> <annotations> <features value="Search"/> - <stories value="Quick Search of products on Storefront when ES 5.0+ is enabled"/> + <stories value="Quick Search of products on Storefront when ES 5.x is enabled"/> <title value="Product quick search doesn't throw exception after ES is chosen as search engine"/> <description value="Verify no elastic search exception is thrown when searching for product before catalogsearch reindexing"/> <severity value="CRITICAL"/> @@ -36,7 +36,7 @@ </after> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - <comment userInput="Change Catalog search engine option to Elastic Search 5.0+" stepKey="chooseElasticSearch5"/> + <comment userInput="Change Catalog search engine option to Elastic Search 5.x" stepKey="chooseElasticSearch5"/> <actionGroup ref="ChooseElasticSearchAsSearchEngine" stepKey="chooseES5"/> <actionGroup ref="ClearPageCacheActionGroup" stepKey="clearing"/> <actionGroup ref="updateIndexerBySchedule" stepKey="updateAnIndexerBySchedule"> @@ -57,4 +57,4 @@ <comment userInput="End of searching products" stepKey="endOfSearchingProducts"/> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin2"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Elasticsearch/etc/adminhtml/system.xml b/app/code/Magento/Elasticsearch/etc/adminhtml/system.xml index dd42b408ff75e..e08d4fafd63da 100644 --- a/app/code/Magento/Elasticsearch/etc/adminhtml/system.xml +++ b/app/code/Magento/Elasticsearch/etc/adminhtml/system.xml @@ -63,7 +63,7 @@ <field id="engine">elasticsearch</field> </depends> </field> - <!-- Elasticsearch 5.0+ --> + <!-- Elasticsearch 5.x --> <field id="elasticsearch5_server_hostname" translate="label" type="text" sortOrder="61" showInDefault="1" showInWebsite="0" showInStore="0"> <label>Elasticsearch Server Hostname</label> <depends> diff --git a/app/code/Magento/Elasticsearch/etc/di.xml b/app/code/Magento/Elasticsearch/etc/di.xml index f42d957276d76..2b29e53635e3a 100644 --- a/app/code/Magento/Elasticsearch/etc/di.xml +++ b/app/code/Magento/Elasticsearch/etc/di.xml @@ -169,7 +169,7 @@ <arguments> <argument name="engines" xsi:type="array"> <item name="elasticsearch" xsi:type="string">Elasticsearch</item> - <item name="elasticsearch5" xsi:type="string">Elasticsearch 5.0+</item> + <item name="elasticsearch5" xsi:type="string">Elasticsearch 5.x</item> </argument> </arguments> </type> diff --git a/app/code/Magento/Elasticsearch6/Test/Mftf/Data/ConfigData.xml b/app/code/Magento/Elasticsearch6/Test/Mftf/Data/ConfigData.xml index f1f2f39f4457b..03a1c63f71515 100644 --- a/app/code/Magento/Elasticsearch6/Test/Mftf/Data/ConfigData.xml +++ b/app/code/Magento/Elasticsearch6/Test/Mftf/Data/ConfigData.xml @@ -10,7 +10,7 @@ <entity name="SearchEngineElasticsearchConfigData"> <data key="path">catalog/search/engine</data> <data key="scope_id">1</data> - <data key="label">Elasticsearch 6.0+</data> + <data key="label">Elasticsearch 6.x</data> <data key="value">elasticsearch6</data> </entity> </entities> diff --git a/app/code/Magento/Elasticsearch6/etc/adminhtml/system.xml b/app/code/Magento/Elasticsearch6/etc/adminhtml/system.xml index 067a0acb8c908..6002f3d489d3c 100644 --- a/app/code/Magento/Elasticsearch6/etc/adminhtml/system.xml +++ b/app/code/Magento/Elasticsearch6/etc/adminhtml/system.xml @@ -10,7 +10,7 @@ <system> <section id="catalog"> <group id="search"> - <!-- Elasticsearch 6.0+ --> + <!-- Elasticsearch 6.x --> <field id="elasticsearch6_server_hostname" translate="label" type="text" sortOrder="71" showInDefault="1" showInWebsite="0" showInStore="0"> <label>Elasticsearch Server Hostname</label> diff --git a/app/code/Magento/Elasticsearch6/etc/di.xml b/app/code/Magento/Elasticsearch6/etc/di.xml index 580c61ffc8cdb..434aec5af221a 100644 --- a/app/code/Magento/Elasticsearch6/etc/di.xml +++ b/app/code/Magento/Elasticsearch6/etc/di.xml @@ -17,7 +17,7 @@ <type name="Magento\Search\Model\Adminhtml\System\Config\Source\Engine"> <arguments> <argument name="engines" xsi:type="array"> - <item name="elasticsearch6" xsi:type="string">Elasticsearch 6.0+</item> + <item name="elasticsearch6" xsi:type="string">Elasticsearch 6.x</item> </argument> </arguments> </type> From 3e57f87910bdfb82ea3ed1ade93e371439b6780b Mon Sep 17 00:00:00 2001 From: Ivan Gerchak <ivang@ven.com> Date: Fri, 29 Nov 2019 12:25:31 +0200 Subject: [PATCH 0178/1143] Fix gallery thumbs navigation scrolling --- lib/web/fotorama/fotorama.js | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/lib/web/fotorama/fotorama.js b/lib/web/fotorama/fotorama.js index ddf5a7f000d8e..7bae5198a7a93 100644 --- a/lib/web/fotorama/fotorama.js +++ b/lib/web/fotorama/fotorama.js @@ -1220,22 +1220,6 @@ fotoramaVersion = '4.6.4'; stopPropagation && e.stopPropagation && e.stopPropagation(); } - function stubEvent($el, eventType) { - var isIOS = /ip(ad|hone|od)/i.test(window.navigator.userAgent); - - if (isIOS && eventType === 'touchend') { - $el.on('touchend', function(e){ - $DOCUMENT.trigger('mouseup', e); - }) - } - - $el.on(eventType, function (e) { - stopEvent(e, true); - - return false; - }); - } - function getDirectionSign(forward) { return forward ? '>' : '<'; } @@ -1538,10 +1522,10 @@ fotoramaVersion = '4.6.4'; $WINDOW.on('scroll', onOtherEnd); - $el.on('mousedown pointerdown', onStart); + $el.on('mousedown', onStart); $DOCUMENT - .on('mousemove pointermove', onMove) - .on('mouseup pointerup', onEnd); + .on('mousemove', onMove) + .on('mouseup', onEnd); } if (Modernizr.touch) { dragDomEl = 'a'; @@ -2183,11 +2167,6 @@ fotoramaVersion = '4.6.4'; if (o_allowFullScreen) { $fullscreenIcon.prependTo($stage); o_nativeFullScreen = FULLSCREEN && o_allowFullScreen === 'native'; - - // Due 300ms click delay on mobile devices - // we stub touchend and fallback to click. - // MAGETWO-69567 - stubEvent($fullscreenIcon, 'touchend'); } else { $fullscreenIcon.detach(); o_nativeFullScreen = false; From a5f6167b9f8a35ebdbdd55e5d477c4802fdac51c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Fri, 29 Nov 2019 12:20:08 +0100 Subject: [PATCH 0179/1143] REFACTOR: Extract Action Groups to separate files (according to MFTF best practices) --- .../Test/AdminApplyTierPriceToProductTest.xml | 2 +- ...inConfigureProductImagePlaceholderTest.xml | 8 +- ...IncrementsWorkWithDecimalinventoryTest.xml | 2 +- .../AssertMiniCartEmptyActionGroup.xml | 20 + ...ertOneProductNameInMiniCartActionGroup.xml | 23 + ...ckoutPaymentSummarySubtotalActionGroup.xml | 19 + ...CheckoutPaymentSummaryTotalActionGroup.xml | 19 + ...tPaymentSummaryTotalMissingActionGroup.xml | 15 + ...sertStorefrontMiniCartItemsActionGroup.xml | 13 - ...iniCartProductDetailsAbsentActionGroup.xml | 23 + .../ChangeSummaryQuoteAddressActionGroup.xml | 25 + ...eckBillingAddressInCheckoutActionGroup.xml | 29 ++ ...BillingAddressOnPaymentPageActionGroup.xml | 29 ++ ...CheckOrderSummaryInCheckoutActionGroup.xml | 28 ++ ...kProductInCheckoutCartItemsActionGroup.xml | 25 + ...edShippingAddressInCheckoutActionGroup.xml | 28 ++ ...ShipToInformationInCheckoutActionGroup.xml | 29 ++ ...eckShippingMethodInCheckoutActionGroup.xml | 22 + ...lsSortOrderInSummarySectionActionGroup.xml | 22 + .../Mftf/ActionGroup/CheckoutActionGroup.xml | 433 ------------------ .../CheckoutPlaceOrderActionGroup.xml | 25 + ...electCheckMoneyOrderPaymentActionGroup.xml | 21 + ...electFlatRateShippingMethodActionGroup.xml | 20 + .../ClickPlaceOrderActionGroup.xml | 20 + ...ViewAndEditCartFromMiniCartActionGroup.xml | 23 + ...CheckoutShippingAddressFormActionGroup.xml | 5 +- ...tShippingAddressWithCountryActionGroup.xml | 14 + .../GoToCheckoutFromCartActionGroup.xml | 22 + .../GoToCheckoutFromMinicartActionGroup.xml | 21 + ...eckoutFillNewBillingAddressActionGroup.xml | 70 --- ...illShippingNoWaitForPaymentActionGroup.xml | 19 + ...ckoutFillingShippingSectionActionGroup.xml | 38 ++ ...ngSectionUnavailablePaymentActionGroup.xml | 36 ++ ...hippingSectionWithoutRegionActionGroup.xml | 35 ++ ...entAndFillNewBillingAddressActionGroup.xml | 22 + ...untryOptionForPaymentMethodActionGroup.xml | 22 + ...eckoutFillNewBillingAddressActionGroup.xml | 34 ++ ...dressFieldWithoutStateFieldActionGroup.xml | 19 + ...hippingSectionWithoutRegionActionGroup.xml | 35 ++ ...ckoutFillingShippingSectionActionGroup.xml | 34 ++ .../PlaceOrderWithLoggedUserActionGroup.xml | 31 ++ .../RemoveProductFromMiniCartActionGroup.xml | 27 ++ ...ontAddCategoryProductToCartActionGroup.xml | 28 ++ ...ryProductToCartWithQuantityActionGroup.xml | 32 ++ .../StorefrontAddProductToCartActionGroup.xml | 26 ++ .../StorefrontCheckCartActionGroup.xml | 35 ++ ...frontCheckCartSimpleProductActionGroup.xml | 24 + ...rtTotalWithDiscountCategoryActionGroup.xml | 21 + ...eckoutFillNewBillingAddressActionGroup.xml | 15 + ...koutForwardFromShippingStepActionGroup.xml | 18 + .../StorefrontMiniCartActionGroup.xml | 65 --- ...refrontOpenCartFromMinicartActionGroup.xml | 21 + ...nicartAndCheckSimpleProductActionGroup.xml | 23 + .../StorefrontProductCartActionGroup.xml | 161 ------- .../StorefrontSignOutActionGroup.xml | 21 + ...CheckoutPaymentOrderSummaryActionGroup.xml | 23 - ...erifyTopDestinationsCountryActionGroup.xml | 23 + ...rCheckoutAddressPopupFieldsActionGroup.xml | 30 ++ .../CheckNotVisibleProductInMinicartTest.xml | 6 +- .../Test/CheckoutSpecificDestinationsTest.xml | 4 +- ...ddressShouldBeCheckedOnPaymentPageTest.xml | 2 +- ...ckoutAsCustomerUsingDefaultAddressTest.xml | 2 +- ...eCheckoutAsCustomerUsingNewAddressTest.xml | 2 +- ...utAsCustomerUsingNonDefaultAddressTest.xml | 2 +- .../OnePageCheckoutUsingSignInLinkTest.xml | 2 +- ...OnePageCheckoutWithAllProductTypesTest.xml | 2 +- ...CartAndMiniShoppingCartPerCustomerTest.xml | 4 +- ...ateShoppingCartWhileUpdateMinicartTest.xml | 2 +- ...BundleDynamicProductToShoppingCartTest.xml | 2 +- ...dConfigurableProductToShoppingCartTest.xml | 2 +- ...dDownloadableProductToShoppingCartTest.xml | 2 +- ...ontAddGroupedProductToShoppingCartTest.xml | 2 +- ...MultiSelectOptionToTheShoppingCartTest.xml | 2 +- ...ultiSelectOptionsToTheShoppingCartTest.xml | 2 +- ...ingAddressAndProductWithTierPricesTest.xml | 4 +- ...ssAndRegisterCustomerAfterCheckoutTest.xml | 4 +- ...ntCheckoutWithSpecialPriceProductsTest.xml | 4 +- ...erCheckoutDisabledProductAndCouponTest.xml | 2 +- ...OnLoginWhenGuestCheckoutIsDisabledTest.xml | 4 +- ...egistrationAndDisableGuestCheckoutTest.xml | 6 +- ...refrontCustomerLoginDuringCheckoutTest.xml | 2 +- ...OrderWithNewAddressesThatWasEditedTest.xml | 2 +- ...eBundleProductFromMiniShoppingCartTest.xml | 6 +- ...gurableProductFromMiniShoppingCartTest.xml | 8 +- ...oadableProductFromMiniShoppingCartTest.xml | 8 +- ...aultLimitationFromMiniShoppingCartTest.xml | 24 +- ...VirtualProductFromMiniShoppingCartTest.xml | 12 +- ...eSimpleProductFromMiniShoppingCartTest.xml | 8 +- ...tCheckoutUsingFreeShippingAndTaxesTest.xml | 4 +- ...tCheckoutWithCouponAndZeroSubtotalTest.xml | 4 +- ...ippingMethodInReviewAndPaymentStepTest.xml | 8 +- ...ngesInBackendAfterCustomerCheckoutTest.xml | 4 +- ...rontRefreshPageDuringGuestCheckoutTest.xml | 2 +- ...aultShippingAddressForVirtualQuoteTest.xml | 2 +- ...efrontUKCustomerCheckoutWithCouponTest.xml | 2 +- ...uctQuantityEqualsToOrderedQuantityTest.xml | 4 +- ...CouponAndBankTransferPaymentMethodTest.xml | 4 +- ...UpdateShoppingCartSimpleProductQtyTest.xml | 2 +- ...tSimpleWithCustomOptionsProductQtyTest.xml | 2 +- .../Mftf/Test/AdminRelatedProductsTest.xml | 4 +- ...ingCartBehaviorAfterSessionExpiredTest.xml | 2 +- .../ShippingQuotePersistedForGuestTest.xml | 4 +- ...CartPersistenceUnderLongTermCookieTest.xml | 20 +- ...eConditionAndFreeShippingIsAppliedTest.xml | 2 +- ...AndVerifyRuleConditionIsNotAppliedTest.xml | 2 +- ...talAndVerifyRuleConditionIsAppliedTest.xml | 2 +- ...oryAndVerifyRuleConditionIsAppliedTest.xml | 2 +- ...ghtAndVerifyRuleConditionIsAppliedTest.xml | 2 +- ...artPriceRuleForConfigurableProductTest.xml | 4 +- ...frontCartRuleCouponForFreeShippingTest.xml | 2 +- ...yRulesShouldApplyToComplexProductsTest.xml | 4 +- ...ductWithInvisibleIndividualProductTest.xml | 4 +- ...oppingCartForCustomerPhysicalQuoteTest.xml | 2 +- ...hoppingCartForCustomerVirtualQuoteTest.xml | 2 +- ...nShoppingCartForGuestPhysicalQuoteTest.xml | 2 +- ...InShoppingCartForGuestVirtualQuoteTest.xml | 2 +- .../Mftf/Test/StorefrontTaxQuoteCartTest.xml | 16 +- 117 files changed, 1323 insertions(+), 900 deletions(-) create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertMiniCartEmptyActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertOneProductNameInMiniCartActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontCheckoutPaymentSummarySubtotalActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontCheckoutPaymentSummaryTotalActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontCheckoutPaymentSummaryTotalMissingActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontMiniCartProductDetailsAbsentActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/ChangeSummaryQuoteAddressActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckBillingAddressInCheckoutActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckBillingAddressInCheckoutWithBillingAddressOnPaymentPageActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckOrderSummaryInCheckoutActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckProductInCheckoutCartItemsActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckSelectedShippingAddressInCheckoutActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckShipToInformationInCheckoutActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckShippingMethodInCheckoutActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckTotalsSortOrderInSummarySectionActionGroup.xml delete mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutPlaceOrderActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutSelectCheckMoneyOrderPaymentActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutSelectFlatRateShippingMethodActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/ClickPlaceOrderActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/ClickViewAndEditCartFromMiniCartActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/FillGuestCheckoutShippingAddressWithCountryActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/GoToCheckoutFromCartActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/GoToCheckoutFromMinicartActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillShippingNoWaitForPaymentActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillingShippingSectionActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillingShippingSectionUnavailablePaymentActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillingShippingSectionWithoutRegionActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutSelectPaymentAndFillNewBillingAddressActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutWithSpecificCountryOptionForPaymentMethodActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/LoggedInCheckoutFillNewBillingAddressActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/LoggedInCheckoutWithOneAddressFieldWithoutStateFieldActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/LoggedInUserCheckoutAddNewShippingSectionWithoutRegionActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/LoggedInUserCheckoutFillingShippingSectionActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/PlaceOrderWithLoggedUserActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/RemoveProductFromMiniCartActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontAddCategoryProductToCartActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontAddCategoryProductToCartWithQuantityActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontAddProductToCartActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontCheckCartActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontCheckCartSimpleProductActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontCheckCartTotalWithDiscountCategoryActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontCheckoutFillNewBillingAddressActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontCheckoutForwardFromShippingStepActionGroup.xml delete mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontMiniCartActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontOpenCartFromMinicartActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontOpenMinicartAndCheckSimpleProductActionGroup.xml delete mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontProductCartActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontSignOutActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/VerifyTopDestinationsCountryActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/clearCheckoutAddressPopupFieldsActionGroup.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminApplyTierPriceToProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminApplyTierPriceToProductTest.xml index 545e7c10379bf..8aeb85aa3d2c6 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminApplyTierPriceToProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminApplyTierPriceToProductTest.xml @@ -135,7 +135,7 @@ <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage"> <argument name="productName" value="$$createSimpleProduct.name$$"/> </actionGroup> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToCheckoutFromMinicart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToCheckoutFromMinicart"/> <seeInField userInput="10" selector="{{CheckoutCartProductSection.ProductQuantityByName($$createSimpleProduct.name$$)}}" stepKey="seeInQtyField10"/> <grabTextFrom selector="{{CheckoutCartProductSection.productSubtotalByName($$createSimpleProduct.name$$)}}" stepKey="grabTextFromSubtotalField1"/> <assertEquals message="Shopping cart should contain subtotal $1,000" stepKey="assertSubtotalField1"> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminConfigureProductImagePlaceholderTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminConfigureProductImagePlaceholderTest.xml index 4d97dee56f059..b5ab36729c7fe 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminConfigureProductImagePlaceholderTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminConfigureProductImagePlaceholderTest.xml @@ -62,9 +62,9 @@ <deleteData createDataKey="productNoImages" stepKey="deleteProductNoImages"/> <deleteData createDataKey="productWithImages" stepKey="deleteProductWithImages"/> </after> - + <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminArea"/> - + <!--Admin area: configure Product Image Placeholders--> <comment userInput="Configure product image placeholders in store config" stepKey="configurePlaceholderComment"/> <amOnPage url="{{CatalogConfigPage.url}}" stepKey="goToCatalogConfigurationPage"/> @@ -120,7 +120,7 @@ <actualResult type="variable">$getThumbnailPlaceholderImageSrc</actualResult> <expectedResult type="string">{{placeholderThumbnailImage.name}}</expectedResult> </assertContains> - <actionGroup ref="removeProductFromMiniCart" stepKey="removeProductFromCart1"> + <actionGroup ref="RemoveProductFromMiniCartActionGroup" stepKey="removeProductFromCart1"> <argument name="productName" value="$$productNoImages.name$$"/> </actionGroup> <!--Product which is NOT using placeholder--> @@ -138,7 +138,7 @@ <actualResult type="variable">$getThumbnailImageSrc</actualResult> <expectedResult type="string">{{placeholderThumbnailImage.name}}</expectedResult> </assertNotContains> - <actionGroup ref="removeProductFromMiniCart" stepKey="removeProductFromCart2"> + <actionGroup ref="RemoveProductFromMiniCartActionGroup" stepKey="removeProductFromCart2"> <argument name="productName" value="$$productWithImages.name$$"/> </actionGroup> </test> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/TieredPricingAndQuantityIncrementsWorkWithDecimalinventoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/TieredPricingAndQuantityIncrementsWorkWithDecimalinventoryTest.xml index 4d7c97b26457c..0413018128491 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/TieredPricingAndQuantityIncrementsWorkWithDecimalinventoryTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/TieredPricingAndQuantityIncrementsWorkWithDecimalinventoryTest.xml @@ -79,7 +79,7 @@ <waitForElementVisible selector="{{StorefrontProductPageSection.successMsg}}" time="30" stepKey="waitForProductAdded"/> <see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="You added $$createPreReqSimpleProduct.name$$ to your shopping cart." stepKey="seeAddedToCartMessage"/> <!--Step9. Click on *Cart* icon. Click on *View and Edit Cart* link. Change *Qty* value to *5.5*--> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToShoppingCartFromMinicart"/> <fillField selector="{{CheckoutCartProductSection.ProductQuantityByName(('$$createPreReqSimpleProduct.name$$'))}}" userInput="5.5" stepKey="fillQty2"/> <click selector="{{CheckoutCartProductSection.updateShoppingCartButton}}" stepKey="clickOnUpdateShoppingCartButton"/> <seeInField userInput="5.5" selector="{{CheckoutCartProductSection.ProductQuantityByName(('$$createPreReqSimpleProduct.name$$'))}}" stepKey="seeInField2"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertMiniCartEmptyActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertMiniCartEmptyActionGroup.xml new file mode 100644 index 0000000000000..649421a53040b --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertMiniCartEmptyActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertMiniCartEmptyActionGroup"> + <annotations> + <description>Validates that the provided Product Count appears in the Storefront Header next to the Shopping Cart icon. Clicks on the Mini Shopping Cart icon. Validates that the 'No Items' message is present and correct in the Storefront Mini Shopping Cart.</description> + </annotations> + + <dontSeeElement selector="{{StorefrontMinicartSection.productCount}}" stepKey="dontSeeMinicartProductCount"/> + <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="expandMinicart"/> + <see selector="{{StorefrontMinicartSection.minicartContent}}" userInput="You have no items in your shopping cart." stepKey="seeEmptyCartMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertOneProductNameInMiniCartActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertOneProductNameInMiniCartActionGroup.xml new file mode 100644 index 0000000000000..de54c78fc28ff --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertOneProductNameInMiniCartActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertOneProductNameInMiniCartActionGroup"> + <annotations> + <description>Validates that the provided Product Name is present in the Storefront Mini Shopping Cart.</description> + </annotations> + <arguments> + <argument name="productName"/> + </arguments> + + <conditionalClick selector="{{StorefrontMinicartSection.showCart}}" dependentSelector="{{StorefrontMinicartSection.miniCartOpened}}" visible="false" stepKey="openMiniCart"/> + <waitForElementVisible selector="{{StorefrontMinicartSection.viewAndEditCart}}" stepKey="waitForViewAndEditCartVisible"/> + <see selector="{{StorefrontMinicartSection.miniCartItemsText}}" userInput="{{productName}}" stepKey="seeInMiniCart"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontCheckoutPaymentSummarySubtotalActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontCheckoutPaymentSummarySubtotalActionGroup.xml new file mode 100644 index 0000000000000..bbf578fb8ca8f --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontCheckoutPaymentSummarySubtotalActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertStorefrontCheckoutPaymentSummarySubtotalActionGroup"> + <arguments> + <argument name="orderSubtotal" type="string"/> + </arguments> + <waitForPageLoad time="30" stepKey="waitForCartFullyLoaded"/> + <waitForElementVisible selector="{{CheckoutPaymentSection.orderSummarySubtotal}}" time="30" stepKey="waitForOrderSummaryBlock"/> + <see selector="{{CheckoutPaymentSection.orderSummarySubtotal}}" userInput="{{orderSubtotal}}" stepKey="seeCorrectSubtotal"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontCheckoutPaymentSummaryTotalActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontCheckoutPaymentSummaryTotalActionGroup.xml new file mode 100644 index 0000000000000..626e9d7a98183 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontCheckoutPaymentSummaryTotalActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertStorefrontCheckoutPaymentSummaryTotalActionGroup"> + <arguments> + <argument name="orderTotal" type="string"/> + </arguments> + <waitForPageLoad time="30" stepKey="waitForCartFullyLoaded"/> + <waitForElementVisible selector="{{CheckoutPaymentSection.orderSummaryTotal}}" time="30" stepKey="waitForOrderSummaryBlock"/> + <see selector="{{CheckoutPaymentSection.orderSummaryTotal}}" userInput="{{orderTotal}}" stepKey="seeCorrectOrderTotal"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontCheckoutPaymentSummaryTotalMissingActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontCheckoutPaymentSummaryTotalMissingActionGroup.xml new file mode 100644 index 0000000000000..874d2921022b1 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontCheckoutPaymentSummaryTotalMissingActionGroup.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertStorefrontCheckoutPaymentSummaryTotalMissingActionGroup"> + <waitForPageLoad time="30" stepKey="waitForCartFullyLoaded"/> + <dontSeeElement selector="{{CheckoutPaymentSection.orderSummaryTotal}}" stepKey="seeTotalElement"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontMiniCartItemsActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontMiniCartItemsActionGroup.xml index 8933ebbc1dd84..5545d7ad437a1 100644 --- a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontMiniCartItemsActionGroup.xml +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontMiniCartItemsActionGroup.xml @@ -25,17 +25,4 @@ <seeElement selector="{{StorefrontMinicartSection.productImage}}" stepKey="seeProductImage"/> <see selector="{{StorefrontMinicartSection.productSubTotal}}" userInput="{{cartSubtotal}}" stepKey="seeSubTotal"/> </actionGroup> - - <actionGroup name="AssertStorefrontMiniCartProductDetailsAbsentActionGroup"> - <annotations> - <description>Validates that the provided Product details (Name, Price) are - not present in the Storefront Mini Shopping Cart.</description> - </annotations> - <arguments> - <argument name="productName" type="string"/> - <argument name="productPrice" type="string"/> - </arguments> - - <dontSee selector="{{StorefrontMinicartSection.productPriceByName(productName)}}" userInput="{{productPrice}}" stepKey="dontSeeProductPriceInMiniCart"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontMiniCartProductDetailsAbsentActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontMiniCartProductDetailsAbsentActionGroup.xml new file mode 100644 index 0000000000000..5d52feeaad9cc --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontMiniCartProductDetailsAbsentActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertStorefrontMiniCartProductDetailsAbsentActionGroup"> + <annotations> + <description>Validates that the provided Product details (Name, Price) are + not present in the Storefront Mini Shopping Cart.</description> + </annotations> + <arguments> + <argument name="productName" type="string"/> + <argument name="productPrice" type="string"/> + </arguments> + + <dontSee selector="{{StorefrontMinicartSection.productPriceByName(productName)}}" userInput="{{productPrice}}" stepKey="dontSeeProductPriceInMiniCart"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/ChangeSummaryQuoteAddressActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/ChangeSummaryQuoteAddressActionGroup.xml new file mode 100644 index 0000000000000..041d3530a7e82 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/ChangeSummaryQuoteAddressActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ChangeSummaryQuoteAddressActionGroup"> + <annotations> + <description>Fills in the provided Address details (Country, State and Zip Code) under the 'Summary' section on the Storefront Shopping Cart page.</description> + </annotations> + <arguments> + <argument name="taxCode"/> + </arguments> + + <conditionalClick stepKey="openShippingDetails" selector="{{CheckoutCartSummarySection.shippingHeading}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false"/> + <selectOption stepKey="selectCountry" selector="{{CheckoutCartSummarySection.country}}" userInput="{{taxCode.country}}"/> + <selectOption stepKey="selectStateProvince" selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="{{taxCode.state}}"/> + <fillField stepKey="fillZip" selector="{{CheckoutCartSummarySection.postcode}}" userInput="{{taxCode.zip}}"/> + <waitForPageLoad stepKey="waitForFormUpdate"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckBillingAddressInCheckoutActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckBillingAddressInCheckoutActionGroup.xml new file mode 100644 index 0000000000000..d0128a9913fe9 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckBillingAddressInCheckoutActionGroup.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CheckBillingAddressInCheckoutActionGroup"> + <annotations> + <description>Validates that the provided Customer and Address details are present on the Storefront Checkout page under the 'Payment Method' section.</description> + </annotations> + <arguments> + <argument name="customerVar"/> + <argument name="customerAddressVar"/> + </arguments> + + <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/> + <see userInput="{{customerVar.firstName}}" selector="{{CheckoutPaymentSection.billingAddress}}" stepKey="assertBillingAddressFirstName"/> + <see userInput="{{customerVar.lastName}}" selector="{{CheckoutPaymentSection.billingAddress}}" stepKey="assertBillingAddressLastName"/> + <see userInput="{{customerAddressVar.street[0]}}" selector="{{CheckoutPaymentSection.billingAddress}}" stepKey="assertBillingAddressStreet"/> + <see userInput="{{customerAddressVar.city}}" selector="{{CheckoutPaymentSection.billingAddress}}" stepKey="assertBillingAddressCity"/> + <see userInput="{{customerAddressVar.state}}" selector="{{CheckoutPaymentSection.billingAddress}}" stepKey="assertBillingAddressState"/> + <see userInput="{{customerAddressVar.postcode}}" selector="{{CheckoutPaymentSection.billingAddress}}" stepKey="assertBillingAddressPostcode"/> + <see userInput="{{customerAddressVar.telephone}}" selector="{{CheckoutPaymentSection.billingAddress}}" stepKey="assertBillingAddressTelephone"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckBillingAddressInCheckoutWithBillingAddressOnPaymentPageActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckBillingAddressInCheckoutWithBillingAddressOnPaymentPageActionGroup.xml new file mode 100644 index 0000000000000..adba81138c17d --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckBillingAddressInCheckoutWithBillingAddressOnPaymentPageActionGroup.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CheckBillingAddressInCheckoutWithBillingAddressOnPaymentPageActionGroup"> + <annotations> + <description>Validates that the provided Customer and Address details appear on the Storefront Checkout page under the 'Billing Address' section.</description> + </annotations> + <arguments> + <argument name="customerVar"/> + <argument name="customerAddressVar"/> + </arguments> + + <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/> + <see userInput="{{customerVar.firstName}}" selector="{{CheckoutPaymentWithDisplayBillingAddressOnPaymentPageSection.billingAddressDetails}}" stepKey="assertBillingAddressDetailsFirstName"/> + <see userInput="{{customerVar.lastName}}" selector="{{CheckoutPaymentWithDisplayBillingAddressOnPaymentPageSection.billingAddressDetails}}" stepKey="assertBillingAddressDetailsLastName"/> + <see userInput="{{customerAddressVar.street[0]}}" selector="{{CheckoutPaymentWithDisplayBillingAddressOnPaymentPageSection.billingAddressDetails}}" stepKey="assertBillingAddressDetailsStreet"/> + <see userInput="{{customerAddressVar.city}}" selector="{{CheckoutPaymentWithDisplayBillingAddressOnPaymentPageSection.billingAddressDetails}}" stepKey="assertBillingAddressDetailsCity"/> + <see userInput="{{customerAddressVar.state}}" selector="{{CheckoutPaymentWithDisplayBillingAddressOnPaymentPageSection.billingAddressDetails}}" stepKey="assertBillingAddressDetailsState"/> + <see userInput="{{customerAddressVar.postcode}}" selector="{{CheckoutPaymentWithDisplayBillingAddressOnPaymentPageSection.billingAddressDetails}}" stepKey="assertBillingAddressDetailsPostcode"/> + <see userInput="{{customerAddressVar.telephone}}" selector="{{CheckoutPaymentWithDisplayBillingAddressOnPaymentPageSection.billingAddressDetails}}" stepKey="assertBillingAddressDetailsTelephone"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckOrderSummaryInCheckoutActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckOrderSummaryInCheckoutActionGroup.xml new file mode 100644 index 0000000000000..9db5021e97322 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckOrderSummaryInCheckoutActionGroup.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CheckOrderSummaryInCheckoutActionGroup"> + <annotations> + <description>Validates that the provided Subtotal, Shipping Total, Shipping Method and Total are present and correct on the Storefront Checkout page under the 'Order Summary' section.</description> + </annotations> + <arguments> + <argument name="subtotal" type="string"/> + <argument name="shippingTotal" type="string"/> + <argument name="shippingMethod" type="string"/> + <argument name="total" type="string"/> + </arguments> + + <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/> + <see userInput="{{subtotal}}" selector="{{CheckoutPaymentSection.orderSummarySubtotal}}" stepKey="assertSubtotal"/> + <see userInput="{{shippingTotal}}" selector="{{CheckoutPaymentSection.orderSummaryShippingTotal}}" stepKey="assertShipping"/> + <see userInput="{{shippingMethod}}" selector="{{CheckoutPaymentSection.orderSummaryShippingMethod}}" stepKey="assertShippingMethod"/> + <see userInput="{{total}}" selector="{{CheckoutPaymentSection.orderSummaryTotal}}" stepKey="assertTotal"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckProductInCheckoutCartItemsActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckProductInCheckoutCartItemsActionGroup.xml new file mode 100644 index 0000000000000..85ec765ecd64f --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckProductInCheckoutCartItemsActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CheckProductInCheckoutCartItemsActionGroup"> + <annotations> + <description>Validates the provided Product appears in the Storefront Checkout 'Order Summary' section.</description> + </annotations> + <arguments> + <argument name="productVar"/> + </arguments> + + <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/> + <conditionalClick selector="{{CheckoutPaymentSection.cartItemsArea}}" dependentSelector="{{CheckoutPaymentSection.cartItemsArea}}" visible="true" stepKey="exposeMiniCart"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskForCartItem"/> + <waitForElement selector="{{CheckoutPaymentSection.cartItemsAreaActive}}" time="30" stepKey="waitForCartItemsAreaActive"/> + <see selector="{{CheckoutPaymentSection.cartItems}}" userInput="{{productVar.name}}" stepKey="seeProductInCart"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckSelectedShippingAddressInCheckoutActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckSelectedShippingAddressInCheckoutActionGroup.xml new file mode 100644 index 0000000000000..0c952af6d53fa --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckSelectedShippingAddressInCheckoutActionGroup.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CheckSelectedShippingAddressInCheckoutActionGroup"> + <annotations> + <description>Validates that the provided Customer and Address details are listed on the Storefront Checkout page under the 'Shipping Address' section when multiple Addresses are present for a Customer.</description> + </annotations> + <arguments> + <argument name="customerVar"/> + <argument name="customerAddressVar"/> + </arguments> + + <waitForElement selector="{{CheckoutShippingSection.shippingTab}}" time="30" stepKey="waitForShippingSectionLoaded"/> + <see stepKey="VerifyFirstNameInSelectedAddress" selector="{{CheckoutShippingSection.selectedShippingAddress}}" userInput="{{customerVar.firstname}}"/> + <see stepKey="VerifyLastNameInSelectedAddress" selector="{{CheckoutShippingSection.selectedShippingAddress}}" userInput="{{customerVar.lastname}}"/> + <see stepKey="VerifyStreetInSelectedAddress" selector="{{CheckoutShippingSection.selectedShippingAddress}}" userInput="{{customerAddressVar.street[0]}}"/> + <see stepKey="VerifyCityInSelectedAddress" selector="{{CheckoutShippingSection.selectedShippingAddress}}" userInput="{{customerAddressVar.city}}"/> + <see stepKey="VerifyZipInSelectedAddress" selector="{{CheckoutShippingSection.selectedShippingAddress}}" userInput="{{customerAddressVar.postcode}}"/> + <see stepKey="VerifyPhoneInSelectedAddress" selector="{{CheckoutShippingSection.selectedShippingAddress}}" userInput="{{customerAddressVar.telephone}}"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckShipToInformationInCheckoutActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckShipToInformationInCheckoutActionGroup.xml new file mode 100644 index 0000000000000..f2ededd7f4b17 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckShipToInformationInCheckoutActionGroup.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CheckShipToInformationInCheckoutActionGroup"> + <annotations> + <description>Validates that the provided Customer and Address details are present and correct on the Storefront Checkout page under the 'Ship To' section.</description> + </annotations> + <arguments> + <argument name="customerVar"/> + <argument name="customerAddressVar"/> + </arguments> + + <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/> + <see userInput="{{customerVar.firstname}}" selector="{{CheckoutPaymentSection.shipToInformation}}" stepKey="assertShipToInformationFirstName"/> + <see userInput="{{customerVar.lastname}}" selector="{{CheckoutPaymentSection.shipToInformation}}" stepKey="assertShipToInformationLastName"/> + <see userInput="{{customerAddressVar.street[0]}}" selector="{{CheckoutPaymentSection.shipToInformation}}" stepKey="assertShipToInformationStreet"/> + <see userInput="{{customerAddressVar.city}}" selector="{{CheckoutPaymentSection.shipToInformation}}" stepKey="assertShipToInformationCity"/> + <see userInput="{{customerAddressVar.state}}" selector="{{CheckoutPaymentSection.shipToInformation}}" stepKey="assertShipToInformationState"/> + <see userInput="{{customerAddressVar.postcode}}" selector="{{CheckoutPaymentSection.shipToInformation}}" stepKey="assertShipToInformationPostcode"/> + <see userInput="{{customerAddressVar.telephone}}" selector="{{CheckoutPaymentSection.shipToInformation}}" stepKey="assertShipToInformationTelephone"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckShippingMethodInCheckoutActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckShippingMethodInCheckoutActionGroup.xml new file mode 100644 index 0000000000000..968ee8b46d0ba --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckShippingMethodInCheckoutActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CheckShippingMethodInCheckoutActionGroup"> + <annotations> + <description>Validates that the provided Shipping Method Name is present on the Storefront Checkout page under the 'Shipping Method' section.</description> + </annotations> + <arguments> + <argument name="shippingMethod"/> + </arguments> + + <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/> + <see userInput="{{shippingMethod}}" selector="{{CheckoutPaymentSection.shippingMethodInformation}}" stepKey="assertshippingMethodInformation"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckTotalsSortOrderInSummarySectionActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckTotalsSortOrderInSummarySectionActionGroup.xml new file mode 100644 index 0000000000000..4bd2d40ab94f1 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckTotalsSortOrderInSummarySectionActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CheckTotalsSortOrderInSummarySectionActionGroup"> + <annotations> + <description>Validates that the provided Element Name appears at the provided Position in the Storefront Checkout 'Order Summary' section.</description> + </annotations> + <arguments> + <argument name="elementName" type="string"/> + <argument name="positionNumber" type="string"/> + </arguments> + + <see userInput="{{elementName}}" selector="{{CheckoutCartSummarySection.elementPosition(positionNumber)}}" stepKey="assertElementPosition"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutActionGroup.xml deleted file mode 100644 index 4c7d4e31b2d6f..0000000000000 --- a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutActionGroup.xml +++ /dev/null @@ -1,433 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <!-- Checkout select Flat Rate shipping method --> - <actionGroup name="CheckoutSelectFlatRateShippingMethodActionGroup"> - <annotations> - <description>Clicks on the 'Flat Rate' Shipping Method on the Storefront Checkout page.</description> - </annotations> - - <conditionalClick selector="{{CheckoutShippingMethodsSection.checkShippingMethodByName('Flat Rate')}}" dependentSelector="{{CheckoutShippingMethodsSection.checkShippingMethodByName('Flat Rate')}}" visible="true" stepKey="selectFlatRateShippingMethod"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskForNextButton"/> - </actionGroup> - - <!-- Go to checkout from minicart --> - <actionGroup name="GoToCheckoutFromMinicartActionGroup"> - <annotations> - <description>Clicks on the Storefront Mini Shopping Cart icon. Clicks on 'Proceed to Checkout'.</description> - </annotations> - - <waitForElementNotVisible selector="{{StorefrontMinicartSection.emptyCart}}" stepKey="waitUpdateQuantity"/> - <wait time="5" stepKey="waitMinicartRendering"/> - <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickCart"/> - <click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="goToCheckout"/> - </actionGroup> - - <!-- Go to checkout from cart --> - <actionGroup name="GoToCheckoutFromCartActionGroup"> - <annotations> - <description>Clicks on the 'View and Edit Cart' link in the Storefront Mini Shopping Cart. Validates that the Storefront Shopping Cart URL is present and correct. Clicks on 'Proceed to Checkout'.</description> - </annotations> - - <waitForElementNotVisible selector="{{StorefrontMinicartSection.emptyCart}}" stepKey="waitUpdateQuantity"/> - <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickCart"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/> - <seeInCurrentUrl url="{{CheckoutCartPage.url}}" stepKey="assertCheckoutCartUrl"/> - <click selector="{{CheckoutCartSummarySection.proceedToCheckout}}" stepKey="goToCheckout"/> - </actionGroup> - - <!-- Guest checkout filling shipping section --> - <actionGroup name="GuestCheckoutFillingShippingSectionActionGroup"> - <annotations> - <description>Fills in the provided Customer/Address (Including Region) details on the Storefront Checkout page under the 'Shipping Address' section. Selects the provided Shipping Method. Clicks on Next. Validates that the URL is present and correct.</description> - </annotations> - <arguments> - <argument name="customerVar" defaultValue="CustomerEntityOne"/> - <argument name="customerAddressVar" defaultValue="CustomerAddressSimple"/> - <!--First available shipping method will be selected if value is not passed for shippingMethod--> - <argument name="shippingMethod" defaultValue="" type="string"/> - </arguments> - - <fillField selector="{{CheckoutShippingSection.email}}" userInput="{{customerVar.email}}" stepKey="enterEmail"/> - <fillField selector="{{CheckoutShippingSection.firstName}}" userInput="{{customerVar.firstname}}" stepKey="enterFirstName"/> - <fillField selector="{{CheckoutShippingSection.lastName}}" userInput="{{customerVar.lastname}}" stepKey="enterLastName"/> - <fillField selector="{{CheckoutShippingSection.street}}" userInput="{{customerAddressVar.street[0]}}" stepKey="enterStreet"/> - <fillField selector="{{CheckoutShippingSection.city}}" userInput="{{customerAddressVar.city}}" stepKey="enterCity"/> - <selectOption selector="{{CheckoutShippingSection.region}}" userInput="{{customerAddressVar.state}}" stepKey="selectRegion"/> - <fillField selector="{{CheckoutShippingSection.postcode}}" userInput="{{customerAddressVar.postcode}}" stepKey="enterPostcode"/> - <fillField selector="{{CheckoutShippingSection.telephone}}" userInput="{{customerAddressVar.telephone}}" stepKey="enterTelephone"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/> - <waitForElement selector="{{CheckoutShippingMethodsSection.checkShippingMethodByName('shippingMethod')}}" stepKey="waitForShippingMethod"/> - <click selector="{{CheckoutShippingMethodsSection.checkShippingMethodByName('shippingMethod')}}" stepKey="selectShippingMethod"/> - <waitForElement selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/> - <click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/> - <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/> - <seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/> - </actionGroup> - - <actionGroup name="GuestCheckoutFillShippingNoWaitForPaymentActionGroup" extends="GuestCheckoutFillingShippingSectionActionGroup"> - <annotations> - <description>EXTENDS: GuestCheckoutFillingShippingSectionActionGroup. Removed 'waitForPaymentSectionLoaded' and 'assertCheckoutPaymentUrl'.</description> - </annotations> - - <remove keyForRemoval="waitForPaymentSectionLoaded"/> - <remove keyForRemoval="assertCheckoutPaymentUrl"/> - </actionGroup> - - <!-- Guest checkout filling shipping section without region --> - <actionGroup name="GuestCheckoutFillingShippingSectionWithoutRegionActionGroup"> - <annotations> - <description>Fills in the provided Customer/Address (Excluding Region) details on the Storefront Checkout page under the 'Shipping Address' section. Selects the provided Shipping Method. Clicks on Next. Validates that the URL is present and correct.</description> - </annotations> - <arguments> - <argument name="customerVar"/> - <argument name="customerAddressVar"/> - </arguments> - - <fillField selector="{{CheckoutShippingSection.email}}" userInput="{{customerVar.email}}" stepKey="enterEmail"/> - <fillField selector="{{CheckoutShippingSection.firstName}}" userInput="{{customerVar.firstname}}" stepKey="enterFirstName"/> - <fillField selector="{{CheckoutShippingSection.lastName}}" userInput="{{customerVar.lastname}}" stepKey="enterLastName"/> - <fillField selector="{{CheckoutShippingSection.street}}" userInput="{{customerAddressVar.street[0]}}" stepKey="enterStreet"/> - <fillField selector="{{CheckoutShippingSection.city}}" userInput="{{customerAddressVar.city}}" stepKey="enterCity"/> - <fillField selector="{{CheckoutShippingSection.postcode}}" userInput="{{customerAddressVar.postcode}}" stepKey="enterPostcode"/> - <selectOption selector="{{CheckoutShippingSection.country}}" userInput="{{customerAddressVar.country_id}}" stepKey="enterCountry"/> - <fillField selector="{{CheckoutShippingSection.telephone}}" userInput="{{customerAddressVar.telephone}}" stepKey="enterTelephone"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/> - <click selector="{{CheckoutShippingSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/> - <waitForElement selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/> - <click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/> - <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/> - <seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/> - </actionGroup> - - <!-- Guest checkout filling shipping section with unavailable payments--> - <actionGroup name="GuestCheckoutFillingShippingSectionUnavailablePaymentActionGroup"> - <annotations> - <description>Fills in the provided Customer/Address (Including Region) details on the Storefront Checkout page under the 'Shipping Address' section. Selects the 1st Shipping Method. Clicks on Next. Validates that the Payment Error Message and URL are present and correct.</description> - </annotations> - <arguments> - <argument name="customerVar"/> - <argument name="customerAddressVar"/> - </arguments> - - <fillField selector="{{CheckoutShippingSection.email}}" userInput="{{customerVar.email}}" stepKey="enterEmail"/> - <fillField selector="{{CheckoutShippingSection.firstName}}" userInput="{{customerVar.firstname}}" stepKey="enterFirstName"/> - <fillField selector="{{CheckoutShippingSection.lastName}}" userInput="{{customerVar.lastname}}" stepKey="enterLastName"/> - <fillField selector="{{CheckoutShippingSection.street}}" userInput="{{customerAddressVar.street[0]}}" stepKey="enterStreet"/> - <fillField selector="{{CheckoutShippingSection.city}}" userInput="{{customerAddressVar.city}}" stepKey="enterCity"/> - <selectOption selector="{{CheckoutShippingSection.region}}" userInput="{{customerAddressVar.state}}" stepKey="selectRegion"/> - <fillField selector="{{CheckoutShippingSection.postcode}}" userInput="{{customerAddressVar.postcode}}" stepKey="enterPostcode"/> - <fillField selector="{{CheckoutShippingSection.telephone}}" userInput="{{customerAddressVar.telephone}}" stepKey="enterTelephone"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/> - <click selector="{{CheckoutShippingSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/> - <waitForElement selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/> - <click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/> - <seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/> - <waitForElementVisible selector="{{CheckoutPaymentSection.noQuotes}}" stepKey="waitMessage"/> - <see userInput="No Payment method available." stepKey="checkMessage"/> - </actionGroup> - - <actionGroup name="GuestCheckoutWithSpecificCountryOptionForPaymentMethodActionGroup" extends="GuestCheckoutFillingShippingSectionUnavailablePaymentActionGroup"> - <annotations> - <description>EXTENDS: GuestCheckoutFillingShippingSectionUnavailablePaymentActionGroup. Removes 'checkMessage'. Validates that the provided Payment Method Name is NOT present on the Storefront Checkout page.</description> - </annotations> - <arguments> - <argument name="paymentMethod" type="string"/> - </arguments> - - <remove keyForRemoval="checkMessage"/> - <dontSee selector="{{CheckoutPaymentSection.paymentMethodByName(paymentMethod)}}" stepKey="paymentMethodDoesNotAvailable"/> - </actionGroup> - - <!-- Logged in user checkout filling shipping section --> - <actionGroup name="LoggedInUserCheckoutFillingShippingSectionActionGroup"> - <annotations> - <description>Fills in the provided Customer/Address (Including Region) details on the Storefront Checkout page under the 'Shipping Address' section. Selects the 1st Shipping Method. Clicks on Next. Validates that the Payment Error Message and URL are present and correct.</description> - </annotations> - <arguments> - <argument name="customerVar" defaultValue="CustomerEntityOne"/> - <argument name="customerAddressVar" defaultValue="CustomerAddressSimple"/> - </arguments> - - <fillField selector="{{CheckoutShippingSection.firstName}}" userInput="{{customerVar.firstname}}" stepKey="enterFirstName"/> - <fillField selector="{{CheckoutShippingSection.lastName}}" userInput="{{customerVar.lastname}}" stepKey="enterLastName"/> - <fillField selector="{{CheckoutShippingSection.street}}" userInput="{{customerAddressVar.street[0]}}" stepKey="enterStreet"/> - <fillField selector="{{CheckoutShippingSection.city}}" userInput="{{customerAddressVar.city}}" stepKey="enterCity"/> - <selectOption selector="{{CheckoutShippingSection.region}}" userInput="{{customerAddressVar.state}}" stepKey="selectRegion"/> - <fillField selector="{{CheckoutShippingSection.postcode}}" userInput="{{customerAddressVar.postcode}}" stepKey="enterPostcode"/> - <fillField selector="{{CheckoutShippingSection.telephone}}" userInput="{{customerAddressVar.telephone}}" stepKey="enterTelephone"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/> - <click selector="{{CheckoutShippingSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/> - <waitForElement selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/> - <click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/> - <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/> - <seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/> - </actionGroup> - - <!-- Submit Shipping Address on Checkout Shipping page --> - <actionGroup name="StorefrontCheckoutForwardFromShippingStep"> - <annotations> - <description>Clicks next on Checkout Shipping step</description> - </annotations> - <waitForElementVisible selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/> - <click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/> - </actionGroup> - - <!-- Logged in user checkout filling shipping section --> - <actionGroup name="LoggedInUserCheckoutAddNewShippingSectionWithoutRegionActionGroup"> - <annotations> - <description>Fills in the provided Customer/Address (Excluding Region) details on the Storefront Checkout page under the 'Shipping Address' section. Selects the 1st Shipping Method. Clicks on Next. Validates that the Payment Error Message and URL are present and correct.</description> - </annotations> - <arguments> - <argument name="customerVar"/> - <argument name="customerAddressVar"/> - </arguments> - - <fillField selector="{{CheckoutShippingSection.firstName}}" userInput="{{customerVar.firstname}}" stepKey="enterFirstName"/> - <fillField selector="{{CheckoutShippingSection.lastName}}" userInput="{{customerVar.lastname}}" stepKey="enterLastName"/> - <fillField selector="{{CheckoutShippingSection.street}}" userInput="{{customerAddressVar.street[0]}}" stepKey="enterStreet"/> - <fillField selector="{{CheckoutShippingSection.city}}" userInput="{{customerAddressVar.city}}" stepKey="enterCity"/> - <fillField selector="{{CheckoutShippingSection.postcode}}" userInput="{{customerAddressVar.postcode}}" stepKey="enterPostcode"/> - <selectOption selector="{{CheckoutShippingSection.country}}" userInput="{{customerAddressVar.country_id}}" stepKey="enterCountry"/> - <fillField selector="{{CheckoutShippingSection.telephone}}" userInput="{{customerAddressVar.telephone}}" stepKey="enterTelephone"/> - <click selector="{{CheckoutShippingSection.saveAddress}}" stepKey="clickSaveAddress"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/> - <click selector="{{CheckoutShippingSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/> - <waitForElement selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/> - <click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/> - <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/> - <seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/> - </actionGroup> - - <!-- Place order with logged the user --> - <actionGroup name="PlaceOrderWithLoggedUserActionGroup"> - <annotations> - <description>Clicks on 'Proceed to Checkout' on the Storefront Shopping Cart page. Selects the provided Shipping Method. Clicks on Next. Clicks on Place Order. Validates that the Success Message is present and correct.</description> - </annotations> - <arguments> - <!--First available shipping method will be selected if value is not passed for shippingMethod--> - <argument name="shippingMethod" defaultValue="" type="string"/> - </arguments> - - <waitForElementVisible selector="{{CheckoutCartSummarySection.proceedToCheckout}}" stepKey="waitProceedToCheckout"/> - <click selector="{{CheckoutCartSummarySection.proceedToCheckout}}" stepKey="clickProceedToCheckout"/> - <click selector="{{CheckoutShippingMethodsSection.checkShippingMethodByName('shippingMethod')}}" stepKey="selectShippingMethod"/> - <waitForElement selector="{{CheckoutShippingSection.next}}" stepKey="waitForNextButton"/> - <click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/> - <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" stepKey="waitForPaymentSectionLoaded"/> - <seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/> - <waitForElementVisible selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="waitForPlaceOrderButton"/> - <click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/> - <see selector="{{CheckoutSuccessMainSection.successTitle}}" userInput="Thank you for your purchase!" stepKey="waitForLoadSuccessPage"/> - </actionGroup> - - <!-- Check product in checkout cart items --> - <actionGroup name="CheckProductInCheckoutCartItemsActionGroup"> - <annotations> - <description>Validates the provided Product appears in the Storefront Checkout 'Order Summary' section.</description> - </annotations> - <arguments> - <argument name="productVar"/> - </arguments> - - <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/> - <conditionalClick selector="{{CheckoutPaymentSection.cartItemsArea}}" dependentSelector="{{CheckoutPaymentSection.cartItemsArea}}" visible="true" stepKey="exposeMiniCart"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskForCartItem"/> - <waitForElement selector="{{CheckoutPaymentSection.cartItemsAreaActive}}" time="30" stepKey="waitForCartItemsAreaActive"/> - <see selector="{{CheckoutPaymentSection.cartItems}}" userInput="{{productVar.name}}" stepKey="seeProductInCart"/> - </actionGroup> - - <!-- Check order summary in checkout --> - <actionGroup name="CheckOrderSummaryInCheckoutActionGroup"> - <annotations> - <description>Validates that the provided Subtotal, Shipping Total, Shipping Method and Total are present and correct on the Storefront Checkout page under the 'Order Summary' section.</description> - </annotations> - <arguments> - <argument name="subtotal" type="string"/> - <argument name="shippingTotal" type="string"/> - <argument name="shippingMethod" type="string"/> - <argument name="total" type="string"/> - </arguments> - - <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/> - <see userInput="{{subtotal}}" selector="{{CheckoutPaymentSection.orderSummarySubtotal}}" stepKey="assertSubtotal"/> - <see userInput="{{shippingTotal}}" selector="{{CheckoutPaymentSection.orderSummaryShippingTotal}}" stepKey="assertShipping"/> - <see userInput="{{shippingMethod}}" selector="{{CheckoutPaymentSection.orderSummaryShippingMethod}}" stepKey="assertShippingMethod"/> - <see userInput="{{total}}" selector="{{CheckoutPaymentSection.orderSummaryTotal}}" stepKey="assertTotal"/> - </actionGroup> - - <actionGroup name="CheckTotalsSortOrderInSummarySection"> - <annotations> - <description>Validates that the provided Element Name appears at the provided Position in the Storefront Checkout 'Order Summary' section.</description> - </annotations> - <arguments> - <argument name="elementName" type="string"/> - <argument name="positionNumber" type="string"/> - </arguments> - - <see userInput="{{elementName}}" selector="{{CheckoutCartSummarySection.elementPosition(positionNumber)}}" stepKey="assertElementPosition"/> - </actionGroup> - - <!-- Check ship to information in checkout --> - <actionGroup name="CheckShipToInformationInCheckoutActionGroup"> - <annotations> - <description>Validates that the provided Customer and Address details are present and correct on the Storefront Checkout page under the 'Ship To' section.</description> - </annotations> - <arguments> - <argument name="customerVar"/> - <argument name="customerAddressVar"/> - </arguments> - - <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/> - <see userInput="{{customerVar.firstname}}" selector="{{CheckoutPaymentSection.shipToInformation}}" stepKey="assertShipToInformationFirstName"/> - <see userInput="{{customerVar.lastname}}" selector="{{CheckoutPaymentSection.shipToInformation}}" stepKey="assertShipToInformationLastName"/> - <see userInput="{{customerAddressVar.street[0]}}" selector="{{CheckoutPaymentSection.shipToInformation}}" stepKey="assertShipToInformationStreet"/> - <see userInput="{{customerAddressVar.city}}" selector="{{CheckoutPaymentSection.shipToInformation}}" stepKey="assertShipToInformationCity"/> - <see userInput="{{customerAddressVar.state}}" selector="{{CheckoutPaymentSection.shipToInformation}}" stepKey="assertShipToInformationState"/> - <see userInput="{{customerAddressVar.postcode}}" selector="{{CheckoutPaymentSection.shipToInformation}}" stepKey="assertShipToInformationPostcode"/> - <see userInput="{{customerAddressVar.telephone}}" selector="{{CheckoutPaymentSection.shipToInformation}}" stepKey="assertShipToInformationTelephone"/> - </actionGroup> - - <!-- Check shipping method in checkout --> - <actionGroup name="CheckShippingMethodInCheckoutActionGroup"> - <annotations> - <description>Validates that the provided Shipping Method Name is present on the Storefront Checkout page under the 'Shipping Method' section.</description> - </annotations> - <arguments> - <argument name="shippingMethod"/> - </arguments> - - <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/> - <see userInput="{{shippingMethod}}" selector="{{CheckoutPaymentSection.shippingMethodInformation}}" stepKey="assertshippingMethodInformation"/> - </actionGroup> - - <!-- Checkout select Check/Money Order payment --> - <actionGroup name="CheckoutSelectCheckMoneyOrderPaymentActionGroup"> - <annotations> - <description>Selects the 'Check / Money Order' Payment Method on the Storefront Checkout page.</description> - </annotations> - - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <conditionalClick selector="{{StorefrontCheckoutPaymentMethodSection.checkPaymentMethodByName('Check / Money order')}}" dependentSelector="{{StorefrontCheckoutPaymentMethodSection.checkPaymentMethodByName('Check / Money order')}}" visible="true" stepKey="selectCheckmoPaymentMethod"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskAfterPaymentMethodSelection"/> - </actionGroup> - - <!-- Check selected shipping address information on shipping information step --> - <actionGroup name="CheckSelectedShippingAddressInCheckoutActionGroup"> - <annotations> - <description>Validates that the provided Customer and Address details are listed on the Storefront Checkout page under the 'Shipping Address' section when multiple Addresses are present for a Customer.</description> - </annotations> - <arguments> - <argument name="customerVar"/> - <argument name="customerAddressVar"/> - </arguments> - - <waitForElement selector="{{CheckoutShippingSection.shippingTab}}" time="30" stepKey="waitForShippingSectionLoaded"/> - <see stepKey="VerifyFirstNameInSelectedAddress" selector="{{CheckoutShippingSection.selectedShippingAddress}}" userInput="{{customerVar.firstname}}"/> - <see stepKey="VerifyLastNameInSelectedAddress" selector="{{CheckoutShippingSection.selectedShippingAddress}}" userInput="{{customerVar.lastname}}"/> - <see stepKey="VerifyStreetInSelectedAddress" selector="{{CheckoutShippingSection.selectedShippingAddress}}" userInput="{{customerAddressVar.street[0]}}"/> - <see stepKey="VerifyCityInSelectedAddress" selector="{{CheckoutShippingSection.selectedShippingAddress}}" userInput="{{customerAddressVar.city}}"/> - <see stepKey="VerifyZipInSelectedAddress" selector="{{CheckoutShippingSection.selectedShippingAddress}}" userInput="{{customerAddressVar.postcode}}"/> - <see stepKey="VerifyPhoneInSelectedAddress" selector="{{CheckoutShippingSection.selectedShippingAddress}}" userInput="{{customerAddressVar.telephone}}"/> - </actionGroup> - - <!-- Check billing address in checkout --> - <actionGroup name="CheckBillingAddressInCheckoutActionGroup"> - <annotations> - <description>Validates that the provided Customer and Address details are present on the Storefront Checkout page under the 'Payment Method' section.</description> - </annotations> - <arguments> - <argument name="customerVar"/> - <argument name="customerAddressVar"/> - </arguments> - - <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/> - <see userInput="{{customerVar.firstName}}" selector="{{CheckoutPaymentSection.billingAddress}}" stepKey="assertBillingAddressFirstName"/> - <see userInput="{{customerVar.lastName}}" selector="{{CheckoutPaymentSection.billingAddress}}" stepKey="assertBillingAddressLastName"/> - <see userInput="{{customerAddressVar.street[0]}}" selector="{{CheckoutPaymentSection.billingAddress}}" stepKey="assertBillingAddressStreet"/> - <see userInput="{{customerAddressVar.city}}" selector="{{CheckoutPaymentSection.billingAddress}}" stepKey="assertBillingAddressCity"/> - <see userInput="{{customerAddressVar.state}}" selector="{{CheckoutPaymentSection.billingAddress}}" stepKey="assertBillingAddressState"/> - <see userInput="{{customerAddressVar.postcode}}" selector="{{CheckoutPaymentSection.billingAddress}}" stepKey="assertBillingAddressPostcode"/> - <see userInput="{{customerAddressVar.telephone}}" selector="{{CheckoutPaymentSection.billingAddress}}" stepKey="assertBillingAddressTelephone"/> - </actionGroup> - - <!-- Check billing address in checkout with billing address on payment page --> - <actionGroup name="CheckBillingAddressInCheckoutWithBillingAddressOnPaymentPageActionGroup"> - <annotations> - <description>Validates that the provided Customer and Address details appear on the Storefront Checkout page under the 'Billing Address' section.</description> - </annotations> - <arguments> - <argument name="customerVar"/> - <argument name="customerAddressVar"/> - </arguments> - - <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/> - <see userInput="{{customerVar.firstName}}" selector="{{CheckoutPaymentWithDisplayBillingAddressOnPaymentPageSection.billingAddressDetails}}" stepKey="assertBillingAddressDetailsFirstName"/> - <see userInput="{{customerVar.lastName}}" selector="{{CheckoutPaymentWithDisplayBillingAddressOnPaymentPageSection.billingAddressDetails}}" stepKey="assertBillingAddressDetailsLastName"/> - <see userInput="{{customerAddressVar.street[0]}}" selector="{{CheckoutPaymentWithDisplayBillingAddressOnPaymentPageSection.billingAddressDetails}}" stepKey="assertBillingAddressDetailsStreet"/> - <see userInput="{{customerAddressVar.city}}" selector="{{CheckoutPaymentWithDisplayBillingAddressOnPaymentPageSection.billingAddressDetails}}" stepKey="assertBillingAddressDetailsCity"/> - <see userInput="{{customerAddressVar.state}}" selector="{{CheckoutPaymentWithDisplayBillingAddressOnPaymentPageSection.billingAddressDetails}}" stepKey="assertBillingAddressDetailsState"/> - <see userInput="{{customerAddressVar.postcode}}" selector="{{CheckoutPaymentWithDisplayBillingAddressOnPaymentPageSection.billingAddressDetails}}" stepKey="assertBillingAddressDetailsPostcode"/> - <see userInput="{{customerAddressVar.telephone}}" selector="{{CheckoutPaymentWithDisplayBillingAddressOnPaymentPageSection.billingAddressDetails}}" stepKey="assertBillingAddressDetailsTelephone"/> - </actionGroup> - - <!-- Checkout place order --> - <actionGroup name="CheckoutPlaceOrderActionGroup"> - <annotations> - <description>Clicks on 'Place Order'. Validates that the provided Order ID and Email You messages are present and correct.</description> - </annotations> - <arguments> - <argument name="orderNumberMessage"/> - <argument name="emailYouMessage"/> - </arguments> - - <waitForElementVisible selector="{{CheckoutPaymentSection.placeOrder}}" time="30" stepKey="waitForPlaceOrderButton"/> - <click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/> - <see selector="{{CheckoutSuccessMainSection.success}}" userInput="{{orderNumberMessage}}" stepKey="seeOrderNumber"/> - <see selector="{{CheckoutSuccessMainSection.success}}" userInput="{{emailYouMessage}}" stepKey="seeEmailYou"/> - </actionGroup> - - <!--Verify country options in checkout top destination section--> - <actionGroup name="VerifyTopDestinationsCountry"> - <annotations> - <description>Validates that the provided Country is listed at the provided Index in 'Country' drop down menu on the Storefront Shopping Cart page under the 'Summary' section.</description> - </annotations> - <arguments> - <argument name="country" type="string"/> - <argument name="placeNumber"/> - </arguments> - - <conditionalClick selector="{{CheckoutCartSummarySection.shippingHeading}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="openShippingDetails"/> - <see selector="{{CheckoutCartSummarySection.countryParameterized('placeNumber')}}" userInput="{{country}}" stepKey="seeCountry"/> - </actionGroup> - - <actionGroup name="StorefrontSignOutActionGroup"> - <annotations> - <description>Clicks on the Customer Account link. Clicks on 'Sign Out'. Validates that the Signed Out message is present and correct.</description> - </annotations> - - <click selector="{{StoreFrontSignOutSection.customerAccount}}" stepKey="clickCustomerButton"/> - <click selector="{{StoreFrontSignOutSection.signOut}}" stepKey="clickToSignOut"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <see userInput="You are signed out" stepKey="signOut"/> - </actionGroup> - - <!--Click Place Order button--> - <actionGroup name="ClickPlaceOrderActionGroup"> - <annotations> - <description>Clicks on the 'Place Order' button. Validates that the Success Message is present and correct.</description> - </annotations> - - <waitForElement selector="{{CheckoutPaymentSection.placeOrder}}" time="30" stepKey="waitForPlaceOrderButton"/> - <click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/> - <see selector="{{CheckoutSuccessMainSection.successTitle}}" userInput="Thank you for your purchase!" stepKey="waitForLoadSuccessPage"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutPlaceOrderActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutPlaceOrderActionGroup.xml new file mode 100644 index 0000000000000..48c515a3dd197 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutPlaceOrderActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CheckoutPlaceOrderActionGroup"> + <annotations> + <description>Clicks on 'Place Order'. Validates that the provided Order ID and Email You messages are present and correct.</description> + </annotations> + <arguments> + <argument name="orderNumberMessage"/> + <argument name="emailYouMessage"/> + </arguments> + + <waitForElementVisible selector="{{CheckoutPaymentSection.placeOrder}}" time="30" stepKey="waitForPlaceOrderButton"/> + <click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/> + <see selector="{{CheckoutSuccessMainSection.success}}" userInput="{{orderNumberMessage}}" stepKey="seeOrderNumber"/> + <see selector="{{CheckoutSuccessMainSection.success}}" userInput="{{emailYouMessage}}" stepKey="seeEmailYou"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutSelectCheckMoneyOrderPaymentActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutSelectCheckMoneyOrderPaymentActionGroup.xml new file mode 100644 index 0000000000000..04e987fd10d98 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutSelectCheckMoneyOrderPaymentActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CheckoutSelectCheckMoneyOrderPaymentActionGroup"> + <annotations> + <description>Selects the 'Check / Money Order' Payment Method on the Storefront Checkout page.</description> + </annotations> + + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <conditionalClick selector="{{StorefrontCheckoutPaymentMethodSection.checkPaymentMethodByName('Check / Money order')}}" dependentSelector="{{StorefrontCheckoutPaymentMethodSection.checkPaymentMethodByName('Check / Money order')}}" visible="true" stepKey="selectCheckmoPaymentMethod"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskAfterPaymentMethodSelection"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutSelectFlatRateShippingMethodActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutSelectFlatRateShippingMethodActionGroup.xml new file mode 100644 index 0000000000000..a5dcec3b7cb37 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutSelectFlatRateShippingMethodActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <!-- Checkout select Flat Rate shipping method --> + <actionGroup name="CheckoutSelectFlatRateShippingMethodActionGroup"> + <annotations> + <description>Clicks on the 'Flat Rate' Shipping Method on the Storefront Checkout page.</description> + </annotations> + + <conditionalClick selector="{{CheckoutShippingMethodsSection.checkShippingMethodByName('Flat Rate')}}" dependentSelector="{{CheckoutShippingMethodsSection.checkShippingMethodByName('Flat Rate')}}" visible="true" stepKey="selectFlatRateShippingMethod"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskForNextButton"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/ClickPlaceOrderActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/ClickPlaceOrderActionGroup.xml new file mode 100644 index 0000000000000..079b89a879b77 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/ClickPlaceOrderActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ClickPlaceOrderActionGroup"> + <annotations> + <description>Clicks on the 'Place Order' button. Validates that the Success Message is present and correct.</description> + </annotations> + + <waitForElement selector="{{CheckoutPaymentSection.placeOrder}}" time="30" stepKey="waitForPlaceOrderButton"/> + <click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/> + <see selector="{{CheckoutSuccessMainSection.successTitle}}" userInput="Thank you for your purchase!" stepKey="waitForLoadSuccessPage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/ClickViewAndEditCartFromMiniCartActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/ClickViewAndEditCartFromMiniCartActionGroup.xml new file mode 100644 index 0000000000000..70aa5b49e4b98 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/ClickViewAndEditCartFromMiniCartActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ClickViewAndEditCartFromMiniCartActionGroup"> + <annotations> + <description>Clicks on the Storefront Mini Shopping Cart icon. Clicks on the 'View and Edit Cart' link. Validates that the URL is present and correct. PLEASE NOTE: The URL is Hardcoded.</description> + </annotations> + + <scrollTo selector="{{StorefrontMinicartSection.showCart}}" stepKey="scrollToMiniCart"/> + <conditionalClick selector="{{StorefrontMinicartSection.showCart}}" dependentSelector="{{StorefrontMinicartSection.miniCartOpened}}" visible="false" stepKey="openMiniCart"/> + <waitForElementVisible selector="{{StorefrontMinicartSection.viewAndEditCart}}" stepKey="waitForViewAndEditCartVisible"/> + <click selector="{{StorefrontMinicartSection.viewAndEditCart}}" stepKey="viewAndEditCart"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + <seeInCurrentUrl url="checkout/cart" stepKey="seeInCurrentUrl"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/FillGuestCheckoutShippingAddressFormActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/FillGuestCheckoutShippingAddressFormActionGroup.xml index 80fd604e752e9..527afdc26a5f4 100644 --- a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/FillGuestCheckoutShippingAddressFormActionGroup.xml +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/FillGuestCheckoutShippingAddressFormActionGroup.xml @@ -21,7 +21,4 @@ <fillField selector="{{CheckoutShippingSection.postcode}}" userInput="{{customerAddress.postcode}}" stepKey="SetCustomerZipCode"/> <fillField selector="{{CheckoutShippingSection.telephone}}" userInput="{{customerAddress.telephone}}" stepKey="SetCustomerPhoneNumber"/> </actionGroup> - <actionGroup name="FillGuestCheckoutShippingAddressWithCountryActionGroup" extends="FillGuestCheckoutShippingAddressFormActionGroup"> - <selectOption selector="{{CheckoutShippingSection.country}}" userInput="{{customerAddress.country_id}}" stepKey="selectCustomerCountry" after="SetCustomerCity"/> - </actionGroup> -</actionGroups> \ No newline at end of file +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/FillGuestCheckoutShippingAddressWithCountryActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/FillGuestCheckoutShippingAddressWithCountryActionGroup.xml new file mode 100644 index 0000000000000..c5685f4a3a31f --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/FillGuestCheckoutShippingAddressWithCountryActionGroup.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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FillGuestCheckoutShippingAddressWithCountryActionGroup" extends="FillGuestCheckoutShippingAddressFormActionGroup"> + <selectOption selector="{{CheckoutShippingSection.country}}" userInput="{{customerAddress.country_id}}" stepKey="selectCustomerCountry" after="SetCustomerCity"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GoToCheckoutFromCartActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GoToCheckoutFromCartActionGroup.xml new file mode 100644 index 0000000000000..66db3895483c7 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GoToCheckoutFromCartActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="GoToCheckoutFromCartActionGroup"> + <annotations> + <description>Clicks on the 'View and Edit Cart' link in the Storefront Mini Shopping Cart. Validates that the Storefront Shopping Cart URL is present and correct. Clicks on 'Proceed to Checkout'.</description> + </annotations> + + <waitForElementNotVisible selector="{{StorefrontMinicartSection.emptyCart}}" stepKey="waitUpdateQuantity"/> + <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickCart"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/> + <seeInCurrentUrl url="{{CheckoutCartPage.url}}" stepKey="assertCheckoutCartUrl"/> + <click selector="{{CheckoutCartSummarySection.proceedToCheckout}}" stepKey="goToCheckout"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GoToCheckoutFromMinicartActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GoToCheckoutFromMinicartActionGroup.xml new file mode 100644 index 0000000000000..d6bc6b6a0acb0 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GoToCheckoutFromMinicartActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="GoToCheckoutFromMinicartActionGroup"> + <annotations> + <description>Clicks on the Storefront Mini Shopping Cart icon. Clicks on 'Proceed to Checkout'.</description> + </annotations> + + <waitForElementNotVisible selector="{{StorefrontMinicartSection.emptyCart}}" stepKey="waitUpdateQuantity"/> + <wait time="5" stepKey="waitMinicartRendering"/> + <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickCart"/> + <click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="goToCheckout"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillNewBillingAddressActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillNewBillingAddressActionGroup.xml index 77734cc75497f..22f9f100ed08f 100644 --- a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillNewBillingAddressActionGroup.xml +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillNewBillingAddressActionGroup.xml @@ -28,74 +28,4 @@ <fillField selector="{{CheckoutPaymentSection.guestPostcode}}" userInput="{{customerAddressVar.postcode}}" stepKey="enterPostcode"/> <fillField selector="{{CheckoutPaymentSection.guestTelephone}}" userInput="{{customerAddressVar.telephone}}" stepKey="enterTelephone"/> </actionGroup> - <actionGroup name="StorefrontCheckoutFillNewBillingAddressActionGroup" extends="GuestCheckoutFillNewBillingAddressActionGroup"> - <remove keyForRemoval="enterEmail"/> - <remove keyForRemoval="waitForLoading3"/> - </actionGroup> - - <actionGroup name="LoggedInCheckoutFillNewBillingAddressActionGroup"> - <annotations> - <description>Fills in the provided Address details on the Storefront Checkout Address sections based on the provided Class Prefix (i.e. '._show', '[aria-hidden=false]').</description> - </annotations> - <arguments> - <argument name="Address"/> - <!-- the classPrefix argument is to specifically select the inputs of the correct form - this is to prevent having 3 action groups doing essentially the same thing --> - <argument name="classPrefix" type="string" defaultValue=""/> - </arguments> - - <fillField stepKey="fillFirstName" selector="{{classPrefix}} {{CheckoutShippingSection.firstName}}" userInput="{{Address.firstname}}"/> - <fillField stepKey="fillLastName" selector="{{classPrefix}} {{CheckoutShippingSection.lastName}}" userInput="{{Address.lastname}}"/> - <fillField stepKey="fillCompany" selector="{{classPrefix}} {{CheckoutShippingSection.company}}" userInput="{{Address.company}}"/> - <fillField stepKey="fillPhoneNumber" selector="{{classPrefix}} {{CheckoutShippingSection.telephone}}" userInput="{{Address.telephone}}"/> - <fillField stepKey="fillStreetAddress1" selector="{{classPrefix}} {{CheckoutShippingSection.street}}" userInput="{{Address.street[0]}}"/> - <fillField stepKey="fillStreetAddress2" selector="{{classPrefix}} {{CheckoutShippingSection.street2}}" userInput="{{Address.street[1]}}"/> - <fillField stepKey="fillCityName" selector="{{classPrefix}} {{CheckoutShippingSection.city}}" userInput="{{Address.city}}"/> - <selectOption stepKey="selectState" selector="{{classPrefix}} {{CheckoutShippingSection.region}}" userInput="{{Address.state}}"/> - <fillField stepKey="fillZip" selector="{{classPrefix}} {{CheckoutShippingSection.postcode}}" userInput="{{Address.postcode}}"/> - <selectOption stepKey="selectCounty" selector="{{classPrefix}} {{CheckoutShippingSection.country}}" userInput="{{Address.country_id}}"/> - <waitForPageLoad stepKey="waitForFormUpdate2"/> - </actionGroup> - - <!--Filling address without second address field and without state field--> - <actionGroup name="LoggedInCheckoutWithOneAddressFieldWithoutStateField" extends="LoggedInCheckoutFillNewBillingAddressActionGroup"> - <annotations> - <description>EXTENDS: LoggedInCheckoutFillNewBillingAddressActionGroup. Removes 'fillStreetAddress2' and 'selectState'.</description> - </annotations> - - <remove keyForRemoval="fillStreetAddress2"/> - <remove keyForRemoval="selectState"/> - </actionGroup> - - <actionGroup name="clearCheckoutAddressPopupFieldsActionGroup"> - <annotations> - <description>Clears the fields for the Customer/Address fields on the Storefront Checkout Address sections based on the provided Class Prefix (i.e. '._show', '[aria-hidden=false]').</description> - </annotations> - <arguments> - <argument name="classPrefix" type="string" defaultValue=""/> - </arguments> - - <clearField selector="{{classPrefix}} {{CheckoutShippingSection.firstName}}" stepKey="clearFieldFirstName"/> - <clearField selector="{{classPrefix}} {{CheckoutShippingSection.lastName}}" stepKey="clearFieldLastName"/> - <clearField selector="{{classPrefix}} {{CheckoutShippingSection.company}}" stepKey="clearFieldCompany"/> - <clearField selector="{{classPrefix}} {{CheckoutShippingSection.street}}" stepKey="clearFieldStreetAddress1"/> - <clearField selector="{{classPrefix}} {{CheckoutShippingSection.street2}}" stepKey="clearFieldStreetAddress2"/> - <clearField selector="{{classPrefix}} {{CheckoutShippingSection.city}}" stepKey="clearFieldCityName"/> - <selectOption selector="{{classPrefix}} {{CheckoutShippingSection.region}}" userInput="" stepKey="clearFieldRegion"/> - <clearField selector="{{classPrefix}} {{CheckoutShippingSection.postcode}}" stepKey="clearFieldZip"/> - <selectOption selector="{{classPrefix}} {{CheckoutShippingSection.country}}" userInput="" stepKey="clearFieldCounty"/> - <clearField selector="{{classPrefix}} {{CheckoutShippingSection.telephone}}" stepKey="clearFieldPhoneNumber"/> - </actionGroup> - - <actionGroup name="GuestCheckoutSelectPaymentAndFillNewBillingAddressActionGroup" extends="GuestCheckoutFillNewBillingAddressActionGroup"> - <annotations> - <description>EXTENDS: GuestCheckoutFillNewBillingAddressActionGroup. Clicks on the provided Payment Method on the Storefront Checkout page.</description> - </annotations> - <arguments> - <argument name="paymentMethod" type="string"/> - </arguments> - - <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" after="waitForLoading3" stepKey="waitForPaymentSectionLoaded"/> - <conditionalClick selector="{{CheckoutPaymentSection.paymentMethodByName(paymentMethod)}}" dependentSelector="{{CheckoutPaymentSection.billingAddress}}" visible="false" before="enterFirstName" stepKey="clickCheckMoneyOrderPayment"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillShippingNoWaitForPaymentActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillShippingNoWaitForPaymentActionGroup.xml new file mode 100644 index 0000000000000..ca9b7adf6c387 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillShippingNoWaitForPaymentActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="GuestCheckoutFillShippingNoWaitForPaymentActionGroup" extends="GuestCheckoutFillingShippingSectionActionGroup"> + <annotations> + <description>EXTENDS: GuestCheckoutFillingShippingSectionActionGroup. Removed 'waitForPaymentSectionLoaded' and 'assertCheckoutPaymentUrl'.</description> + </annotations> + + <remove keyForRemoval="waitForPaymentSectionLoaded"/> + <remove keyForRemoval="assertCheckoutPaymentUrl"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillingShippingSectionActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillingShippingSectionActionGroup.xml new file mode 100644 index 0000000000000..f020cb42725c8 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillingShippingSectionActionGroup.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="GuestCheckoutFillingShippingSectionActionGroup"> + <annotations> + <description>Fills in the provided Customer/Address (Including Region) details on the Storefront Checkout page under the 'Shipping Address' section. Selects the provided Shipping Method. Clicks on Next. Validates that the URL is present and correct.</description> + </annotations> + <arguments> + <argument name="customerVar" defaultValue="CustomerEntityOne"/> + <argument name="customerAddressVar" defaultValue="CustomerAddressSimple"/> + <!--First available shipping method will be selected if value is not passed for shippingMethod--> + <argument name="shippingMethod" defaultValue="" type="string"/> + </arguments> + + <fillField selector="{{CheckoutShippingSection.email}}" userInput="{{customerVar.email}}" stepKey="enterEmail"/> + <fillField selector="{{CheckoutShippingSection.firstName}}" userInput="{{customerVar.firstname}}" stepKey="enterFirstName"/> + <fillField selector="{{CheckoutShippingSection.lastName}}" userInput="{{customerVar.lastname}}" stepKey="enterLastName"/> + <fillField selector="{{CheckoutShippingSection.street}}" userInput="{{customerAddressVar.street[0]}}" stepKey="enterStreet"/> + <fillField selector="{{CheckoutShippingSection.city}}" userInput="{{customerAddressVar.city}}" stepKey="enterCity"/> + <selectOption selector="{{CheckoutShippingSection.region}}" userInput="{{customerAddressVar.state}}" stepKey="selectRegion"/> + <fillField selector="{{CheckoutShippingSection.postcode}}" userInput="{{customerAddressVar.postcode}}" stepKey="enterPostcode"/> + <fillField selector="{{CheckoutShippingSection.telephone}}" userInput="{{customerAddressVar.telephone}}" stepKey="enterTelephone"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/> + <waitForElement selector="{{CheckoutShippingMethodsSection.checkShippingMethodByName('shippingMethod')}}" stepKey="waitForShippingMethod"/> + <click selector="{{CheckoutShippingMethodsSection.checkShippingMethodByName('shippingMethod')}}" stepKey="selectShippingMethod"/> + <waitForElement selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/> + <click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/> + <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/> + <seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillingShippingSectionUnavailablePaymentActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillingShippingSectionUnavailablePaymentActionGroup.xml new file mode 100644 index 0000000000000..9ce14338f1223 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillingShippingSectionUnavailablePaymentActionGroup.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="GuestCheckoutFillingShippingSectionUnavailablePaymentActionGroup"> + <annotations> + <description>Fills in the provided Customer/Address (Including Region) details on the Storefront Checkout page under the 'Shipping Address' section. Selects the 1st Shipping Method. Clicks on Next. Validates that the Payment Error Message and URL are present and correct.</description> + </annotations> + <arguments> + <argument name="customerVar"/> + <argument name="customerAddressVar"/> + </arguments> + + <fillField selector="{{CheckoutShippingSection.email}}" userInput="{{customerVar.email}}" stepKey="enterEmail"/> + <fillField selector="{{CheckoutShippingSection.firstName}}" userInput="{{customerVar.firstname}}" stepKey="enterFirstName"/> + <fillField selector="{{CheckoutShippingSection.lastName}}" userInput="{{customerVar.lastname}}" stepKey="enterLastName"/> + <fillField selector="{{CheckoutShippingSection.street}}" userInput="{{customerAddressVar.street[0]}}" stepKey="enterStreet"/> + <fillField selector="{{CheckoutShippingSection.city}}" userInput="{{customerAddressVar.city}}" stepKey="enterCity"/> + <selectOption selector="{{CheckoutShippingSection.region}}" userInput="{{customerAddressVar.state}}" stepKey="selectRegion"/> + <fillField selector="{{CheckoutShippingSection.postcode}}" userInput="{{customerAddressVar.postcode}}" stepKey="enterPostcode"/> + <fillField selector="{{CheckoutShippingSection.telephone}}" userInput="{{customerAddressVar.telephone}}" stepKey="enterTelephone"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/> + <click selector="{{CheckoutShippingSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/> + <waitForElement selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/> + <click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/> + <seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/> + <waitForElementVisible selector="{{CheckoutPaymentSection.noQuotes}}" stepKey="waitMessage"/> + <see userInput="No Payment method available." stepKey="checkMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillingShippingSectionWithoutRegionActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillingShippingSectionWithoutRegionActionGroup.xml new file mode 100644 index 0000000000000..3db019c44dd0d --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillingShippingSectionWithoutRegionActionGroup.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="GuestCheckoutFillingShippingSectionWithoutRegionActionGroup"> + <annotations> + <description>Fills in the provided Customer/Address (Excluding Region) details on the Storefront Checkout page under the 'Shipping Address' section. Selects the provided Shipping Method. Clicks on Next. Validates that the URL is present and correct.</description> + </annotations> + <arguments> + <argument name="customerVar"/> + <argument name="customerAddressVar"/> + </arguments> + + <fillField selector="{{CheckoutShippingSection.email}}" userInput="{{customerVar.email}}" stepKey="enterEmail"/> + <fillField selector="{{CheckoutShippingSection.firstName}}" userInput="{{customerVar.firstname}}" stepKey="enterFirstName"/> + <fillField selector="{{CheckoutShippingSection.lastName}}" userInput="{{customerVar.lastname}}" stepKey="enterLastName"/> + <fillField selector="{{CheckoutShippingSection.street}}" userInput="{{customerAddressVar.street[0]}}" stepKey="enterStreet"/> + <fillField selector="{{CheckoutShippingSection.city}}" userInput="{{customerAddressVar.city}}" stepKey="enterCity"/> + <fillField selector="{{CheckoutShippingSection.postcode}}" userInput="{{customerAddressVar.postcode}}" stepKey="enterPostcode"/> + <selectOption selector="{{CheckoutShippingSection.country}}" userInput="{{customerAddressVar.country_id}}" stepKey="enterCountry"/> + <fillField selector="{{CheckoutShippingSection.telephone}}" userInput="{{customerAddressVar.telephone}}" stepKey="enterTelephone"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/> + <click selector="{{CheckoutShippingSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/> + <waitForElement selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/> + <click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/> + <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/> + <seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutSelectPaymentAndFillNewBillingAddressActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutSelectPaymentAndFillNewBillingAddressActionGroup.xml new file mode 100644 index 0000000000000..73de73a2d1ed6 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutSelectPaymentAndFillNewBillingAddressActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="GuestCheckoutSelectPaymentAndFillNewBillingAddressActionGroup" extends="GuestCheckoutFillNewBillingAddressActionGroup"> + <annotations> + <description>EXTENDS: GuestCheckoutFillNewBillingAddressActionGroup. Clicks on the provided Payment Method on the Storefront Checkout page.</description> + </annotations> + <arguments> + <argument name="paymentMethod" type="string"/> + </arguments> + + <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" after="waitForLoading3" stepKey="waitForPaymentSectionLoaded"/> + <conditionalClick selector="{{CheckoutPaymentSection.paymentMethodByName(paymentMethod)}}" dependentSelector="{{CheckoutPaymentSection.billingAddress}}" visible="false" before="enterFirstName" stepKey="clickCheckMoneyOrderPayment"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutWithSpecificCountryOptionForPaymentMethodActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutWithSpecificCountryOptionForPaymentMethodActionGroup.xml new file mode 100644 index 0000000000000..afa09150cfccd --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutWithSpecificCountryOptionForPaymentMethodActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="GuestCheckoutWithSpecificCountryOptionForPaymentMethodActionGroup" extends="GuestCheckoutFillingShippingSectionUnavailablePaymentActionGroup"> + <annotations> + <description>EXTENDS: GuestCheckoutFillingShippingSectionUnavailablePaymentActionGroup. Removes 'checkMessage'. Validates that the provided Payment Method Name is NOT present on the Storefront Checkout page.</description> + </annotations> + <arguments> + <argument name="paymentMethod" type="string"/> + </arguments> + + <remove keyForRemoval="checkMessage"/> + <dontSee selector="{{CheckoutPaymentSection.paymentMethodByName(paymentMethod)}}" stepKey="paymentMethodDoesNotAvailable"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/LoggedInCheckoutFillNewBillingAddressActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/LoggedInCheckoutFillNewBillingAddressActionGroup.xml new file mode 100644 index 0000000000000..29a71ac938ef6 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/LoggedInCheckoutFillNewBillingAddressActionGroup.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="LoggedInCheckoutFillNewBillingAddressActionGroup"> + <annotations> + <description>Fills in the provided Address details on the Storefront Checkout Address sections based on the provided Class Prefix (i.e. '._show', '[aria-hidden=false]').</description> + </annotations> + <arguments> + <argument name="Address"/> + <!-- the classPrefix argument is to specifically select the inputs of the correct form + this is to prevent having 3 action groups doing essentially the same thing --> + <argument name="classPrefix" type="string" defaultValue=""/> + </arguments> + + <fillField stepKey="fillFirstName" selector="{{classPrefix}} {{CheckoutShippingSection.firstName}}" userInput="{{Address.firstname}}"/> + <fillField stepKey="fillLastName" selector="{{classPrefix}} {{CheckoutShippingSection.lastName}}" userInput="{{Address.lastname}}"/> + <fillField stepKey="fillCompany" selector="{{classPrefix}} {{CheckoutShippingSection.company}}" userInput="{{Address.company}}"/> + <fillField stepKey="fillPhoneNumber" selector="{{classPrefix}} {{CheckoutShippingSection.telephone}}" userInput="{{Address.telephone}}"/> + <fillField stepKey="fillStreetAddress1" selector="{{classPrefix}} {{CheckoutShippingSection.street}}" userInput="{{Address.street[0]}}"/> + <fillField stepKey="fillStreetAddress2" selector="{{classPrefix}} {{CheckoutShippingSection.street2}}" userInput="{{Address.street[1]}}"/> + <fillField stepKey="fillCityName" selector="{{classPrefix}} {{CheckoutShippingSection.city}}" userInput="{{Address.city}}"/> + <selectOption stepKey="selectState" selector="{{classPrefix}} {{CheckoutShippingSection.region}}" userInput="{{Address.state}}"/> + <fillField stepKey="fillZip" selector="{{classPrefix}} {{CheckoutShippingSection.postcode}}" userInput="{{Address.postcode}}"/> + <selectOption stepKey="selectCounty" selector="{{classPrefix}} {{CheckoutShippingSection.country}}" userInput="{{Address.country_id}}"/> + <waitForPageLoad stepKey="waitForFormUpdate2"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/LoggedInCheckoutWithOneAddressFieldWithoutStateFieldActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/LoggedInCheckoutWithOneAddressFieldWithoutStateFieldActionGroup.xml new file mode 100644 index 0000000000000..208dfc37cec74 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/LoggedInCheckoutWithOneAddressFieldWithoutStateFieldActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="LoggedInCheckoutWithOneAddressFieldWithoutStateFieldActionGroup" extends="LoggedInCheckoutFillNewBillingAddressActionGroup"> + <annotations> + <description>EXTENDS: LoggedInCheckoutFillNewBillingAddressActionGroup. Removes 'fillStreetAddress2' and 'selectState'.</description> + </annotations> + + <remove keyForRemoval="fillStreetAddress2"/> + <remove keyForRemoval="selectState"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/LoggedInUserCheckoutAddNewShippingSectionWithoutRegionActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/LoggedInUserCheckoutAddNewShippingSectionWithoutRegionActionGroup.xml new file mode 100644 index 0000000000000..0c4cea142b4e6 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/LoggedInUserCheckoutAddNewShippingSectionWithoutRegionActionGroup.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="LoggedInUserCheckoutAddNewShippingSectionWithoutRegionActionGroup"> + <annotations> + <description>Fills in the provided Customer/Address (Excluding Region) details on the Storefront Checkout page under the 'Shipping Address' section. Selects the 1st Shipping Method. Clicks on Next. Validates that the Payment Error Message and URL are present and correct.</description> + </annotations> + <arguments> + <argument name="customerVar"/> + <argument name="customerAddressVar"/> + </arguments> + + <fillField selector="{{CheckoutShippingSection.firstName}}" userInput="{{customerVar.firstname}}" stepKey="enterFirstName"/> + <fillField selector="{{CheckoutShippingSection.lastName}}" userInput="{{customerVar.lastname}}" stepKey="enterLastName"/> + <fillField selector="{{CheckoutShippingSection.street}}" userInput="{{customerAddressVar.street[0]}}" stepKey="enterStreet"/> + <fillField selector="{{CheckoutShippingSection.city}}" userInput="{{customerAddressVar.city}}" stepKey="enterCity"/> + <fillField selector="{{CheckoutShippingSection.postcode}}" userInput="{{customerAddressVar.postcode}}" stepKey="enterPostcode"/> + <selectOption selector="{{CheckoutShippingSection.country}}" userInput="{{customerAddressVar.country_id}}" stepKey="enterCountry"/> + <fillField selector="{{CheckoutShippingSection.telephone}}" userInput="{{customerAddressVar.telephone}}" stepKey="enterTelephone"/> + <click selector="{{CheckoutShippingSection.saveAddress}}" stepKey="clickSaveAddress"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/> + <click selector="{{CheckoutShippingSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/> + <waitForElement selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/> + <click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/> + <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/> + <seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/LoggedInUserCheckoutFillingShippingSectionActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/LoggedInUserCheckoutFillingShippingSectionActionGroup.xml new file mode 100644 index 0000000000000..60188224871eb --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/LoggedInUserCheckoutFillingShippingSectionActionGroup.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="LoggedInUserCheckoutFillingShippingSectionActionGroup"> + <annotations> + <description>Fills in the provided Customer/Address (Including Region) details on the Storefront Checkout page under the 'Shipping Address' section. Selects the 1st Shipping Method. Clicks on Next. Validates that the Payment Error Message and URL are present and correct.</description> + </annotations> + <arguments> + <argument name="customerVar" defaultValue="CustomerEntityOne"/> + <argument name="customerAddressVar" defaultValue="CustomerAddressSimple"/> + </arguments> + + <fillField selector="{{CheckoutShippingSection.firstName}}" userInput="{{customerVar.firstname}}" stepKey="enterFirstName"/> + <fillField selector="{{CheckoutShippingSection.lastName}}" userInput="{{customerVar.lastname}}" stepKey="enterLastName"/> + <fillField selector="{{CheckoutShippingSection.street}}" userInput="{{customerAddressVar.street[0]}}" stepKey="enterStreet"/> + <fillField selector="{{CheckoutShippingSection.city}}" userInput="{{customerAddressVar.city}}" stepKey="enterCity"/> + <selectOption selector="{{CheckoutShippingSection.region}}" userInput="{{customerAddressVar.state}}" stepKey="selectRegion"/> + <fillField selector="{{CheckoutShippingSection.postcode}}" userInput="{{customerAddressVar.postcode}}" stepKey="enterPostcode"/> + <fillField selector="{{CheckoutShippingSection.telephone}}" userInput="{{customerAddressVar.telephone}}" stepKey="enterTelephone"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/> + <click selector="{{CheckoutShippingSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/> + <waitForElement selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/> + <click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/> + <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/> + <seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/PlaceOrderWithLoggedUserActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/PlaceOrderWithLoggedUserActionGroup.xml new file mode 100644 index 0000000000000..2bd1ee0f7d809 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/PlaceOrderWithLoggedUserActionGroup.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="PlaceOrderWithLoggedUserActionGroup"> + <annotations> + <description>Clicks on 'Proceed to Checkout' on the Storefront Shopping Cart page. Selects the provided Shipping Method. Clicks on Next. Clicks on Place Order. Validates that the Success Message is present and correct.</description> + </annotations> + <arguments> + <!--First available shipping method will be selected if value is not passed for shippingMethod--> + <argument name="shippingMethod" defaultValue="" type="string"/> + </arguments> + + <waitForElementVisible selector="{{CheckoutCartSummarySection.proceedToCheckout}}" stepKey="waitProceedToCheckout"/> + <click selector="{{CheckoutCartSummarySection.proceedToCheckout}}" stepKey="clickProceedToCheckout"/> + <click selector="{{CheckoutShippingMethodsSection.checkShippingMethodByName('shippingMethod')}}" stepKey="selectShippingMethod"/> + <waitForElement selector="{{CheckoutShippingSection.next}}" stepKey="waitForNextButton"/> + <click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/> + <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" stepKey="waitForPaymentSectionLoaded"/> + <seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/> + <waitForElementVisible selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="waitForPlaceOrderButton"/> + <click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/> + <see selector="{{CheckoutSuccessMainSection.successTitle}}" userInput="Thank you for your purchase!" stepKey="waitForLoadSuccessPage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/RemoveProductFromMiniCartActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/RemoveProductFromMiniCartActionGroup.xml new file mode 100644 index 0000000000000..e6626ec357d0e --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/RemoveProductFromMiniCartActionGroup.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="RemoveProductFromMiniCartActionGroup"> + <annotations> + <description>Removed the provided Product from the Storefront Mini Shopping Cart.</description> + </annotations> + <arguments> + <argument name="productName" type="string"/> + </arguments> + + <conditionalClick selector="{{StorefrontMinicartSection.showCart}}" dependentSelector="{{StorefrontMinicartSection.miniCartOpened}}" visible="false" stepKey="openMiniCart"/> + <waitForElementVisible selector="{{StorefrontMinicartSection.viewAndEditCart}}" stepKey="waitForMiniCartOpen"/> + <click selector="{{StorefrontMinicartSection.deleteMiniCartItemByName(productName)}}" stepKey="clickDelete"/> + <waitForElementVisible selector="{{StoreFrontRemoveItemModalSection.message}}" stepKey="waitForConfirmationModal"/> + <see selector="{{StoreFrontRemoveItemModalSection.message}}" userInput="Are you sure you would like to remove this item from the shopping cart?" stepKey="seeDeleteConfirmationMessage"/> + <click selector="{{StoreFrontRemoveItemModalSection.ok}}" stepKey="confirmDelete"/> + <waitForPageLoad stepKey="waitForDeleteToFinish"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontAddCategoryProductToCartActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontAddCategoryProductToCartActionGroup.xml new file mode 100644 index 0000000000000..7fbcb96c20d9e --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontAddCategoryProductToCartActionGroup.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <!-- Add Product to Cart from the category page and check message and product count in Minicart --> + <actionGroup name="StorefrontAddCategoryProductToCartActionGroup"> + <annotations> + <description>Adds the provided Product to the Cart from a Storefront Category page. Validates that the Success Message is present and correct. Validates that the Mini Shopping Cart contains the provided Product Count.</description> + </annotations> + <arguments> + <argument name="product"/> + <argument name="productCount"/> + </arguments> + + <moveMouseOver selector="{{StorefrontCategoryProductSection.ProductInfoByName(product.name)}}" stepKey="moveMouseOverProduct"/> + <click selector="{{StorefrontCategoryProductSection.ProductAddToCartByName(product.name)}}" stepKey="clickAddToCart"/> + <waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" stepKey="waitForSuccessMessage"/> + <see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="You added {{product.name}} to your shopping cart." stepKey="assertSuccessMessage"/> + <seeLink stepKey="assertLinkToShoppingCart" url="{{_ENV.MAGENTO_BASE_URL}}checkout/cart/" userInput="shopping cart"/> + <waitForText userInput="{{productCount}}" selector="{{StorefrontMinicartSection.productCount}}" time="30" stepKey="assertProductCount"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontAddCategoryProductToCartWithQuantityActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontAddCategoryProductToCartWithQuantityActionGroup.xml new file mode 100644 index 0000000000000..c4fe115b70ae4 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontAddCategoryProductToCartWithQuantityActionGroup.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontAddCategoryProductToCartWithQuantityActionGroup"> + <annotations> + <description>Adds the provided Product to the Cart from a Storefront Category page. Validates that the Success Message is present and correct. Updates the Product Quantity using the provided Product Quantity. Validates that the provided Quantity is present and correct in the Mini Shopping Cart.</description> + </annotations> + <arguments> + <argument name="product"/> + <argument name="quantity" defaultValue="1" type="string"/> + <argument name="checkQuantity" defaultValue="1" type="string"/> + </arguments> + + <moveMouseOver selector="{{StorefrontCategoryProductSection.ProductInfoByName(product.name)}}" stepKey="moveMouseOverProduct"/> + <click selector="{{StorefrontCategoryProductSection.ProductAddToCartByName(product.name)}}" stepKey="clickAddToCart"/> + <waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" stepKey="waitForSuccessMessage"/> + <see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="You added {{product.name}} to your shopping cart." stepKey="assertSuccessMessage"/> + <seeLink stepKey="assertLinkToShoppingCart" url="{{_ENV.MAGENTO_BASE_URL}}checkout/cart/" userInput="shopping cart"/> + <waitForText userInput="{{checkQuantity}}" selector="{{StorefrontMinicartSection.productCount}}" time="30" stepKey="assertProductCount"/> + <conditionalClick selector="{{StorefrontMinicartSection.showCart}}" dependentSelector="{{StorefrontMinicartSection.miniCartOpened}}" visible="false" stepKey="openMiniCart"/> + <waitForElementVisible selector="{{StorefrontMinicartSection.viewAndEditCart}}" stepKey="waitForViewAndEditCartVisible"/> + <fillField selector="{{StorefrontMinicartSection.itemQuantity(product.name)}}" userInput="{{quantity}}" stepKey="setProductQtyToFiftyInMiniCart"/> + <click selector="{{StorefrontMinicartSection.itemQuantityUpdate(product.name)}}" stepKey="updateQtyInMiniCart"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontAddProductToCartActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontAddProductToCartActionGroup.xml new file mode 100644 index 0000000000000..8c1ef9d973297 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontAddProductToCartActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontAddProductToCartActionGroup"> + <annotations> + <description>Clicks on Add to Cart on a Storefront Product page. Validates that the Success Message is present and correct. Validates that the provided Product Count is present and correct in the Mini Shopping Cart.</description> + </annotations> + <arguments> + <argument name="product"/> + <argument name="productCount" type="string"/> + </arguments> + + <click selector="{{StorefrontProductInfoMainSection.AddToCart}}" stepKey="clickAddToCart"/> + <waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" stepKey="waitForSuccessMessage"/> + <see selector="{{StorefrontProductPageSection.messagesBlock}}" userInput="You added {{product.name}} to your shopping cart." stepKey="assertSuccessMessage"/> + <seeLink stepKey="assertLinkToShoppingCart" url="{{_ENV.MAGENTO_BASE_URL}}checkout/cart/" userInput="shopping cart"/> + <waitForText userInput="{{productCount}}" selector="{{StorefrontMinicartSection.productCount}}" time="30" stepKey="assertProductCount"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontCheckCartActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontCheckCartActionGroup.xml new file mode 100644 index 0000000000000..bbad2579a47d2 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontCheckCartActionGroup.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCheckCartActionGroup"> + <annotations> + <description>Goes to the Storefront Shopping Cart page. Validates that the provided Subtotal, Shipping, Shipping Method and Total are present and correct.</description> + </annotations> + <arguments> + <argument name="subtotal" type="string"/> + <argument name="shipping" type="string"/> + <argument name="shippingMethod" type="string" defaultValue="Flat Rate - Fixed"/> + <argument name="total" type="string"/> + </arguments> + + <seeInCurrentUrl url="{{CheckoutCartPage.url}}" stepKey="assertUrl"/> + <waitForPageLoad stepKey="waitForCartPage"/> + <conditionalClick selector="{{CheckoutCartSummarySection.shippingHeading}}" dependentSelector="{{CheckoutCartSummarySection.shippingMethodForm}}" visible="false" stepKey="openEstimateShippingSection"/> + <waitForElementVisible selector="{{CheckoutCartSummarySection.flatRateShippingMethod}}" stepKey="waitForShippingSection"/> + <checkOption selector="{{CheckoutCartSummarySection.flatRateShippingMethod}}" stepKey="selectShippingMethod"/> + <scrollTo selector="{{CheckoutCartSummarySection.subtotal}}" stepKey="scrollToSummary"/> + <see userInput="{{subtotal}}" selector="{{CheckoutCartSummarySection.subtotal}}" stepKey="assertSubtotal"/> + <see userInput="({{shippingMethod}})" selector="{{CheckoutCartSummarySection.shippingMethod}}" stepKey="assertShippingMethod"/> + <reloadPage stepKey="reloadPage" after="assertShippingMethod" /> + <waitForPageLoad stepKey="WaitForPageLoaded" after="reloadPage" /> + <waitForText userInput="{{shipping}}" selector="{{CheckoutCartSummarySection.shipping}}" time="45" stepKey="assertShipping" after="WaitForPageLoaded"/> + <see userInput="{{total}}" selector="{{CheckoutCartSummarySection.total}}" stepKey="assertTotal" after="assertShipping"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontCheckCartSimpleProductActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontCheckCartSimpleProductActionGroup.xml new file mode 100644 index 0000000000000..083963f4cc487 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontCheckCartSimpleProductActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCheckCartSimpleProductActionGroup"> + <annotations> + <description>Validates that the provided Product details (Name and Price) are present and correct in the Mini Shopping Cart. Validates that the provided Product Quantity is present and correct in the Mini Shopping Cart.</description> + </annotations> + <arguments> + <argument name="product"/> + <argument name="productQuantity"/> + </arguments> + + <seeElement selector="{{CheckoutCartProductSection.ProductLinkByName(product.name)}}" stepKey="assertProductName"/> + <see userInput="${{product.price}}.00" selector="{{CheckoutCartProductSection.ProductPriceByName(product.name)}}" stepKey="assertProductPrice"/> + <seeInField userInput="{{productQuantity}}" selector="{{CheckoutCartProductSection.ProductQuantityByName(product.name)}}" stepKey="assertProductQuantity"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontCheckCartTotalWithDiscountCategoryActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontCheckCartTotalWithDiscountCategoryActionGroup.xml new file mode 100644 index 0000000000000..c5d2d054f2e8f --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontCheckCartTotalWithDiscountCategoryActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCheckCartTotalWithDiscountCategoryActionGroup" extends="StorefrontCheckCartActionGroup"> + <annotations> + <description>EXTENDS: StorefrontCheckCartActionGroup. Validates that the provided Discount is present in the Storefront Shopping Cart.</description> + </annotations> + <arguments> + <argument name="discount" type="string" defaultValue="0"/> + </arguments> + <waitForElementVisible selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="waitForDiscount"/> + <see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-${{discount}}" stepKey="assertDiscount"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontCheckoutFillNewBillingAddressActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontCheckoutFillNewBillingAddressActionGroup.xml new file mode 100644 index 0000000000000..e8949a1864663 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontCheckoutFillNewBillingAddressActionGroup.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCheckoutFillNewBillingAddressActionGroup" extends="GuestCheckoutFillNewBillingAddressActionGroup"> + <remove keyForRemoval="enterEmail"/> + <remove keyForRemoval="waitForLoading3"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontCheckoutForwardFromShippingStepActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontCheckoutForwardFromShippingStepActionGroup.xml new file mode 100644 index 0000000000000..524e3f784ed3f --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontCheckoutForwardFromShippingStepActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCheckoutForwardFromShippingStepActionGroup"> + <annotations> + <description>Clicks next on Checkout Shipping step</description> + </annotations> + <waitForElementVisible selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/> + <click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontMiniCartActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontMiniCartActionGroup.xml deleted file mode 100644 index 6dc5cfd044924..0000000000000 --- a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontMiniCartActionGroup.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. - */ ---> - -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="clickViewAndEditCartFromMiniCart"> - <annotations> - <description>Clicks on the Storefront Mini Shopping Cart icon. Clicks on the 'View and Edit Cart' link. Validates that the URL is present and correct. PLEASE NOTE: The URL is Hardcoded.</description> - </annotations> - - <scrollTo selector="{{StorefrontMinicartSection.showCart}}" stepKey="scrollToMiniCart"/> - <conditionalClick selector="{{StorefrontMinicartSection.showCart}}" dependentSelector="{{StorefrontMinicartSection.miniCartOpened}}" visible="false" stepKey="openMiniCart"/> - <waitForElementVisible selector="{{StorefrontMinicartSection.viewAndEditCart}}" stepKey="waitForViewAndEditCartVisible"/> - <click selector="{{StorefrontMinicartSection.viewAndEditCart}}" stepKey="viewAndEditCart"/> - <waitForPageLoad stepKey="waitForPageToLoad"/> - <seeInCurrentUrl url="checkout/cart" stepKey="seeInCurrentUrl"/> - </actionGroup> - - <actionGroup name="assertOneProductNameInMiniCart"> - <annotations> - <description>Validates that the provided Product Name is present in the Storefront Mini Shopping Cart.</description> - </annotations> - <arguments> - <argument name="productName"/> - </arguments> - - <conditionalClick selector="{{StorefrontMinicartSection.showCart}}" dependentSelector="{{StorefrontMinicartSection.miniCartOpened}}" visible="false" stepKey="openMiniCart"/> - <waitForElementVisible selector="{{StorefrontMinicartSection.viewAndEditCart}}" stepKey="waitForViewAndEditCartVisible"/> - <see selector="{{StorefrontMinicartSection.miniCartItemsText}}" userInput="{{productName}}" stepKey="seeInMiniCart"/> - </actionGroup> - - <!--Remove an item from the cart using minicart--> - <actionGroup name="removeProductFromMiniCart"> - <annotations> - <description>Removed the provided Product from the Storefront Mini Shopping Cart.</description> - </annotations> - <arguments> - <argument name="productName" type="string"/> - </arguments> - - <conditionalClick selector="{{StorefrontMinicartSection.showCart}}" dependentSelector="{{StorefrontMinicartSection.miniCartOpened}}" visible="false" stepKey="openMiniCart"/> - <waitForElementVisible selector="{{StorefrontMinicartSection.viewAndEditCart}}" stepKey="waitForMiniCartOpen"/> - <click selector="{{StorefrontMinicartSection.deleteMiniCartItemByName(productName)}}" stepKey="clickDelete"/> - <waitForElementVisible selector="{{StoreFrontRemoveItemModalSection.message}}" stepKey="waitForConfirmationModal"/> - <see selector="{{StoreFrontRemoveItemModalSection.message}}" userInput="Are you sure you would like to remove this item from the shopping cart?" stepKey="seeDeleteConfirmationMessage"/> - <click selector="{{StoreFrontRemoveItemModalSection.ok}}" stepKey="confirmDelete"/> - <waitForPageLoad stepKey="waitForDeleteToFinish"/> - </actionGroup> - - <!--Check that the minicart is empty--> - <actionGroup name="assertMiniCartEmpty"> - <annotations> - <description>Validates that the provided Product Count appears in the Storefront Header next to the Shopping Cart icon. Clicks on the Mini Shopping Cart icon. Validates that the 'No Items' message is present and correct in the Storefront Mini Shopping Cart.</description> - </annotations> - - <dontSeeElement selector="{{StorefrontMinicartSection.productCount}}" stepKey="dontSeeMinicartProductCount"/> - <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="expandMinicart"/> - <see selector="{{StorefrontMinicartSection.minicartContent}}" userInput="You have no items in your shopping cart." stepKey="seeEmptyCartMessage"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontOpenCartFromMinicartActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontOpenCartFromMinicartActionGroup.xml new file mode 100644 index 0000000000000..3161d1a63b6f8 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontOpenCartFromMinicartActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontOpenCartFromMinicartActionGroup"> + <annotations> + <description>Clicks on the Storefront Mini Shopping Cart icon. Click on 'View and Edit Cart'.</description> + </annotations> + + <waitForElement selector="{{StorefrontMinicartSection.showCart}}" stepKey="waitForShowMinicart"/> + <waitForElement selector="{{StorefrontMinicartSection.viewAndEditCart}}" stepKey="waitForCartLink"/> + <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickShowMinicart"/> + <click selector="{{StorefrontMinicartSection.viewAndEditCart}}" stepKey="clickCart"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontOpenMinicartAndCheckSimpleProductActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontOpenMinicartAndCheckSimpleProductActionGroup.xml new file mode 100644 index 0000000000000..28e97dfca5158 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontOpenMinicartAndCheckSimpleProductActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontOpenMinicartAndCheckSimpleProductActionGroup"> + <annotations> + <description>Clicks on the Storefront Mini Shopping Cart icon. Validates that the provided Product is present and correct in the Mini Shopping Cart.</description> + </annotations> + <arguments> + <argument name="product"/> + </arguments> + + <waitForElement selector="{{StorefrontMinicartSection.productLinkByName(product.name)}}" stepKey="waitForMinicartProduct"/> + <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickShowMinicart"/> + <see userInput="${{product.price}}.00" selector="{{StorefrontMinicartSection.productPriceByName(product.name)}}" stepKey="assertProductPrice"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontProductCartActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontProductCartActionGroup.xml deleted file mode 100644 index b07bcdccce674..0000000000000 --- a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontProductCartActionGroup.xml +++ /dev/null @@ -1,161 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <!-- Add Product to Cart from the category page and check message and product count in Minicart --> - <actionGroup name="StorefrontAddCategoryProductToCartActionGroup"> - <annotations> - <description>Adds the provided Product to the Cart from a Storefront Category page. Validates that the Success Message is present and correct. Validates that the Mini Shopping Cart contains the provided Product Count.</description> - </annotations> - <arguments> - <argument name="product"/> - <argument name="productCount"/> - </arguments> - - <moveMouseOver selector="{{StorefrontCategoryProductSection.ProductInfoByName(product.name)}}" stepKey="moveMouseOverProduct"/> - <click selector="{{StorefrontCategoryProductSection.ProductAddToCartByName(product.name)}}" stepKey="clickAddToCart"/> - <waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" stepKey="waitForSuccessMessage"/> - <see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="You added {{product.name}} to your shopping cart." stepKey="assertSuccessMessage"/> - <seeLink stepKey="assertLinkToShoppingCart" url="{{_ENV.MAGENTO_BASE_URL}}checkout/cart/" userInput="shopping cart"/> - <waitForText userInput="{{productCount}}" selector="{{StorefrontMinicartSection.productCount}}" time="30" stepKey="assertProductCount"/> - </actionGroup> - - <!-- Add Product to Cart from the category page with specified quantity and check message and product count in Minicart --> - <actionGroup name="StorefrontAddCategoryProductToCartWithQuantityActionGroup"> - <annotations> - <description>Adds the provided Product to the Cart from a Storefront Category page. Validates that the Success Message is present and correct. Updates the Product Quantity using the provided Product Quantity. Validates that the provided Quantity is present and correct in the Mini Shopping Cart.</description> - </annotations> - <arguments> - <argument name="product"/> - <argument name="quantity" defaultValue="1" type="string"/> - <argument name="checkQuantity" defaultValue="1" type="string"/> - </arguments> - - <moveMouseOver selector="{{StorefrontCategoryProductSection.ProductInfoByName(product.name)}}" stepKey="moveMouseOverProduct"/> - <click selector="{{StorefrontCategoryProductSection.ProductAddToCartByName(product.name)}}" stepKey="clickAddToCart"/> - <waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" stepKey="waitForSuccessMessage"/> - <see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="You added {{product.name}} to your shopping cart." stepKey="assertSuccessMessage"/> - <seeLink stepKey="assertLinkToShoppingCart" url="{{_ENV.MAGENTO_BASE_URL}}checkout/cart/" userInput="shopping cart"/> - <waitForText userInput="{{checkQuantity}}" selector="{{StorefrontMinicartSection.productCount}}" time="30" stepKey="assertProductCount"/> - <conditionalClick selector="{{StorefrontMinicartSection.showCart}}" dependentSelector="{{StorefrontMinicartSection.miniCartOpened}}" visible="false" stepKey="openMiniCart"/> - <waitForElementVisible selector="{{StorefrontMinicartSection.viewAndEditCart}}" stepKey="waitForViewAndEditCartVisible"/> - <fillField selector="{{StorefrontMinicartSection.itemQuantity(product.name)}}" userInput="{{quantity}}" stepKey="setProductQtyToFiftyInMiniCart"/> - <click selector="{{StorefrontMinicartSection.itemQuantityUpdate(product.name)}}" stepKey="updateQtyInMiniCart"/> - </actionGroup> - - <!-- Add Product to Cart from the product page and check message and product count in Minicart --> - <actionGroup name="StorefrontAddProductToCartActionGroup"> - <annotations> - <description>Clicks on Add to Cart on a Storefront Product page. Validates that the Success Message is present and correct. Validates that the provided Product Count is present and correct in the Mini Shopping Cart.</description> - </annotations> - <arguments> - <argument name="product"/> - <argument name="productCount" type="string"/> - </arguments> - - <click selector="{{StorefrontProductInfoMainSection.AddToCart}}" stepKey="clickAddToCart"/> - <waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" stepKey="waitForSuccessMessage"/> - <see selector="{{StorefrontProductPageSection.messagesBlock}}" userInput="You added {{product.name}} to your shopping cart." stepKey="assertSuccessMessage"/> - <seeLink stepKey="assertLinkToShoppingCart" url="{{_ENV.MAGENTO_BASE_URL}}checkout/cart/" userInput="shopping cart"/> - <waitForText userInput="{{productCount}}" selector="{{StorefrontMinicartSection.productCount}}" time="30" stepKey="assertProductCount"/> - </actionGroup> - - <!-- Open the Minicart and check Simple Product --> - <actionGroup name="StorefrontOpenMinicartAndCheckSimpleProductActionGroup"> - <annotations> - <description>Clicks on the Storefront Mini Shopping Cart icon. Validates that the provided Product is present and correct in the Mini Shopping Cart.</description> - </annotations> - <arguments> - <argument name="product"/> - </arguments> - - <waitForElement selector="{{StorefrontMinicartSection.productLinkByName(product.name)}}" stepKey="waitForMinicartProduct"/> - <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickShowMinicart"/> - <see userInput="${{product.price}}.00" selector="{{StorefrontMinicartSection.productPriceByName(product.name)}}" stepKey="assertProductPrice"/> - </actionGroup> - - <!-- Check Simple Product in the Cart --> - <actionGroup name="StorefrontCheckCartSimpleProductActionGroup"> - <annotations> - <description>Validates that the provided Product details (Name and Price) are present and correct in the Mini Shopping Cart. Validates that the provided Product Quantity is present and correct in the Mini Shopping Cart.</description> - </annotations> - <arguments> - <argument name="product"/> - <argument name="productQuantity"/> - </arguments> - - <seeElement selector="{{CheckoutCartProductSection.ProductLinkByName(product.name)}}" stepKey="assertProductName"/> - <see userInput="${{product.price}}.00" selector="{{CheckoutCartProductSection.ProductPriceByName(product.name)}}" stepKey="assertProductPrice"/> - <seeInField userInput="{{productQuantity}}" selector="{{CheckoutCartProductSection.ProductQuantityByName(product.name)}}" stepKey="assertProductQuantity"/> - </actionGroup> - - <!-- Check the Cart --> - <actionGroup name="StorefrontCheckCartActionGroup"> - <annotations> - <description>Goes to the Storefront Shopping Cart page. Validates that the provided Subtotal, Shipping, Shipping Method and Total are present and correct.</description> - </annotations> - <arguments> - <argument name="subtotal" type="string"/> - <argument name="shipping" type="string"/> - <argument name="shippingMethod" type="string" defaultValue="Flat Rate - Fixed"/> - <argument name="total" type="string"/> - </arguments> - - <seeInCurrentUrl url="{{CheckoutCartPage.url}}" stepKey="assertUrl"/> - <waitForPageLoad stepKey="waitForCartPage"/> - <conditionalClick selector="{{CheckoutCartSummarySection.shippingHeading}}" dependentSelector="{{CheckoutCartSummarySection.shippingMethodForm}}" visible="false" stepKey="openEstimateShippingSection"/> - <waitForElementVisible selector="{{CheckoutCartSummarySection.flatRateShippingMethod}}" stepKey="waitForShippingSection"/> - <checkOption selector="{{CheckoutCartSummarySection.flatRateShippingMethod}}" stepKey="selectShippingMethod"/> - <scrollTo selector="{{CheckoutCartSummarySection.subtotal}}" stepKey="scrollToSummary"/> - <see userInput="{{subtotal}}" selector="{{CheckoutCartSummarySection.subtotal}}" stepKey="assertSubtotal"/> - <see userInput="({{shippingMethod}})" selector="{{CheckoutCartSummarySection.shippingMethod}}" stepKey="assertShippingMethod"/> - <reloadPage stepKey="reloadPage" after="assertShippingMethod" /> - <waitForPageLoad stepKey="WaitForPageLoaded" after="reloadPage" /> - <waitForText userInput="{{shipping}}" selector="{{CheckoutCartSummarySection.shipping}}" time="45" stepKey="assertShipping" after="WaitForPageLoaded"/> - <see userInput="{{total}}" selector="{{CheckoutCartSummarySection.total}}" stepKey="assertTotal" after="assertShipping"/> - </actionGroup> - - <!-- Open the Cart from Minicart--> - <actionGroup name="StorefrontOpenCartFromMinicartActionGroup"> - <annotations> - <description>Clicks on the Storefront Mini Shopping Cart icon. Click on 'View and Edit Cart'.</description> - </annotations> - - <waitForElement selector="{{StorefrontMinicartSection.showCart}}" stepKey="waitForShowMinicart"/> - <waitForElement selector="{{StorefrontMinicartSection.viewAndEditCart}}" stepKey="waitForCartLink"/> - <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickShowMinicart"/> - <click selector="{{StorefrontMinicartSection.viewAndEditCart}}" stepKey="clickCart"/> - </actionGroup> - - <actionGroup name="changeSummaryQuoteAddress"> - <annotations> - <description>Fills in the provided Address details (Country, State and Zip Code) under the 'Summary' section on the Storefront Shopping Cart page.</description> - </annotations> - <arguments> - <argument name="taxCode"/> - </arguments> - - <conditionalClick stepKey="openShippingDetails" selector="{{CheckoutCartSummarySection.shippingHeading}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false"/> - <selectOption stepKey="selectCountry" selector="{{CheckoutCartSummarySection.country}}" userInput="{{taxCode.country}}"/> - <selectOption stepKey="selectStateProvince" selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="{{taxCode.state}}"/> - <fillField stepKey="fillZip" selector="{{CheckoutCartSummarySection.postcode}}" userInput="{{taxCode.zip}}"/> - <waitForPageLoad stepKey="waitForFormUpdate"/> - </actionGroup> - - <actionGroup name="StorefrontCheckCartTotalWithDiscountCategoryActionGroup" extends="StorefrontCheckCartActionGroup"> - <annotations> - <description>EXTENDS: StorefrontCheckCartActionGroup. Validates that the provided Discount is present in the Storefront Shopping Cart.</description> - </annotations> - <arguments> - <argument name="discount" type="string" defaultValue="0"/> - </arguments> - <waitForElementVisible selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="waitForDiscount"/> - <see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-${{discount}}" stepKey="assertDiscount"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontSignOutActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontSignOutActionGroup.xml new file mode 100644 index 0000000000000..8eac90fff2268 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontSignOutActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontSignOutActionGroup"> + <annotations> + <description>Clicks on the Customer Account link. Clicks on 'Sign Out'. Validates that the Signed Out message is present and correct.</description> + </annotations> + + <click selector="{{StoreFrontSignOutSection.customerAccount}}" stepKey="clickCustomerButton"/> + <click selector="{{StoreFrontSignOutSection.signOut}}" stepKey="clickToSignOut"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <see userInput="You are signed out" stepKey="signOut"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/VerifyCheckoutPaymentOrderSummaryActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/VerifyCheckoutPaymentOrderSummaryActionGroup.xml index 6d8d390d36701..0ae71884745c6 100644 --- a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/VerifyCheckoutPaymentOrderSummaryActionGroup.xml +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/VerifyCheckoutPaymentOrderSummaryActionGroup.xml @@ -23,27 +23,4 @@ <see selector="{{CheckoutPaymentSection.orderSummaryShippingTotal}}" userInput="{{orderSummaryShippingTotal}}" stepKey="seeCorrectShipping"/> <see selector="{{CheckoutPaymentSection.orderSummaryTotal}}" userInput="{{orderSummaryTotal}}" stepKey="seeCorrectOrderTotal"/> </actionGroup> - <!-- Assert Order Summary SubTotal You should be on checkout page --> - <actionGroup name="AssertStorefrontCheckoutPaymentSummarySubtotalActionGroup"> - <arguments> - <argument name="orderSubtotal" type="string"/> - </arguments> - <waitForPageLoad time="30" stepKey="waitForCartFullyLoaded"/> - <waitForElementVisible selector="{{CheckoutPaymentSection.orderSummarySubtotal}}" time="30" stepKey="waitForOrderSummaryBlock"/> - <see selector="{{CheckoutPaymentSection.orderSummarySubtotal}}" userInput="{{orderSubtotal}}" stepKey="seeCorrectSubtotal"/> - </actionGroup> - <!-- Assert Order Summary Total You should be on checkout page --> - <actionGroup name="AssertStorefrontCheckoutPaymentSummaryTotalActionGroup"> - <arguments> - <argument name="orderTotal" type="string"/> - </arguments> - <waitForPageLoad time="30" stepKey="waitForCartFullyLoaded"/> - <waitForElementVisible selector="{{CheckoutPaymentSection.orderSummaryTotal}}" time="30" stepKey="waitForOrderSummaryBlock"/> - <see selector="{{CheckoutPaymentSection.orderSummaryTotal}}" userInput="{{orderTotal}}" stepKey="seeCorrectOrderTotal"/> - </actionGroup> - <!-- Assert Order Summary Total Is Not Shown You should be on checkout page --> - <actionGroup name="AssertStorefrontCheckoutPaymentSummaryTotalMissingActionGroup"> - <waitForPageLoad time="30" stepKey="waitForCartFullyLoaded"/> - <dontSeeElement selector="{{CheckoutPaymentSection.orderSummaryTotal}}" stepKey="seeTotalElement"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/VerifyTopDestinationsCountryActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/VerifyTopDestinationsCountryActionGroup.xml new file mode 100644 index 0000000000000..74f48ff2fc155 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/VerifyTopDestinationsCountryActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="VerifyTopDestinationsCountryActionGroup"> + <annotations> + <description>Validates that the provided Country is listed at the provided Index in 'Country' drop down menu on the Storefront Shopping Cart page under the 'Summary' section.</description> + </annotations> + <arguments> + <argument name="country" type="string"/> + <argument name="placeNumber"/> + </arguments> + + <conditionalClick selector="{{CheckoutCartSummarySection.shippingHeading}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="openShippingDetails"/> + <see selector="{{CheckoutCartSummarySection.countryParameterized('placeNumber')}}" userInput="{{country}}" stepKey="seeCountry"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/clearCheckoutAddressPopupFieldsActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/clearCheckoutAddressPopupFieldsActionGroup.xml new file mode 100644 index 0000000000000..f19d5b5e9cd41 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/clearCheckoutAddressPopupFieldsActionGroup.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="clearCheckoutAddressPopupFieldsActionGroup"> + <annotations> + <description>Clears the fields for the Customer/Address fields on the Storefront Checkout Address sections based on the provided Class Prefix (i.e. '._show', '[aria-hidden=false]').</description> + </annotations> + <arguments> + <argument name="classPrefix" type="string" defaultValue=""/> + </arguments> + + <clearField selector="{{classPrefix}} {{CheckoutShippingSection.firstName}}" stepKey="clearFieldFirstName"/> + <clearField selector="{{classPrefix}} {{CheckoutShippingSection.lastName}}" stepKey="clearFieldLastName"/> + <clearField selector="{{classPrefix}} {{CheckoutShippingSection.company}}" stepKey="clearFieldCompany"/> + <clearField selector="{{classPrefix}} {{CheckoutShippingSection.street}}" stepKey="clearFieldStreetAddress1"/> + <clearField selector="{{classPrefix}} {{CheckoutShippingSection.street2}}" stepKey="clearFieldStreetAddress2"/> + <clearField selector="{{classPrefix}} {{CheckoutShippingSection.city}}" stepKey="clearFieldCityName"/> + <selectOption selector="{{classPrefix}} {{CheckoutShippingSection.region}}" userInput="" stepKey="clearFieldRegion"/> + <clearField selector="{{classPrefix}} {{CheckoutShippingSection.postcode}}" stepKey="clearFieldZip"/> + <selectOption selector="{{classPrefix}} {{CheckoutShippingSection.country}}" userInput="" stepKey="clearFieldCounty"/> + <clearField selector="{{classPrefix}} {{CheckoutShippingSection.telephone}}" stepKey="clearFieldPhoneNumber"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/CheckNotVisibleProductInMinicartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/CheckNotVisibleProductInMinicartTest.xml index 4b4ca1935fd78..952e4460faa00 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/CheckNotVisibleProductInMinicartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/CheckNotVisibleProductInMinicartTest.xml @@ -33,7 +33,7 @@ <!--Check simple product1 in minicart--> <comment userInput="Check simple product 1 in minicart" stepKey="commentCheckSimpleProduct1InMinicart" after="addToCartFromStorefrontProductPage1"/> - <actionGroup ref="assertOneProductNameInMiniCart" stepKey="assertProduct1NameInMiniCart"> + <actionGroup ref="AssertOneProductNameInMiniCartActionGroup" stepKey="assertProduct1NameInMiniCart"> <argument name="productName" value="$$createSimpleProduct1.name$$"/> </actionGroup> @@ -53,13 +53,13 @@ <!--Check simple product1 in minicart--> <comment userInput="Check hidden simple product 1 in minicart" stepKey="commentCheckHiddenSimpleProduct1InMinicart" after="addToCartFromStorefrontProductPage2"/> - <actionGroup ref="assertOneProductNameInMiniCart" stepKey="assertHiddenProduct1NameInMiniCart"> + <actionGroup ref="AssertOneProductNameInMiniCartActionGroup" stepKey="assertHiddenProduct1NameInMiniCart"> <argument name="productName" value="$$createSimpleProduct1.name$$"/> </actionGroup> <!--Check simple product2 in minicart--> <comment userInput="Check hidden simple product 2 in minicart" stepKey="commentCheckSimpleProduct2InMinicart" after="addToCartFromStorefrontProductPage2"/> - <actionGroup ref="assertOneProductNameInMiniCart" stepKey="assertProduct2NameInMiniCart"> + <actionGroup ref="AssertOneProductNameInMiniCartActionGroup" stepKey="assertProduct2NameInMiniCart"> <argument name="productName" value="$$createSimpleProduct2.name$$"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/CheckoutSpecificDestinationsTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/CheckoutSpecificDestinationsTest.xml index f3807388399b8..8d069828c097c 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/CheckoutSpecificDestinationsTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/CheckoutSpecificDestinationsTest.xml @@ -51,7 +51,7 @@ <amOnPage url="{{CheckoutCartPage.url}}" stepKey="amOnPageShoppingCart"/> <!--Verify country options in checkout top destination section--> - <actionGroup ref="VerifyTopDestinationsCountry" stepKey="verifyTopDestinationsCountry"> + <actionGroup ref="VerifyTopDestinationsCountryActionGroup" stepKey="verifyTopDestinationsCountry"> <argument name="country" value="Bahamas"/> <argument name="placeNumber" value="2"/> </actionGroup> @@ -71,7 +71,7 @@ <amOnPage url="{{CheckoutCartPage.url}}" stepKey="amOnPageShoppingCart2"/> <!--Verify country options is shown by default--> - <actionGroup ref="VerifyTopDestinationsCountry" stepKey="verifyTopDestinationsCountry2"> + <actionGroup ref="VerifyTopDestinationsCountryActionGroup" stepKey="verifyTopDestinationsCountry2"> <argument name="country" value="Afghanistan"/> <argument name="placeNumber" value="2"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/DefaultBillingAddressShouldBeCheckedOnPaymentPageTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/DefaultBillingAddressShouldBeCheckedOnPaymentPageTest.xml index 166f5022d5aeb..08534351906ee 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/DefaultBillingAddressShouldBeCheckedOnPaymentPageTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/DefaultBillingAddressShouldBeCheckedOnPaymentPageTest.xml @@ -44,7 +44,7 @@ <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/> <!-- Click "+ New Address" and Fill new address--> <click selector="{{CheckoutShippingSection.newAddressButton}}" stepKey="addAddress"/> - <actionGroup ref="LoggedInCheckoutWithOneAddressFieldWithoutStateField" stepKey="changeAddress"> + <actionGroup ref="LoggedInCheckoutWithOneAddressFieldWithoutStateFieldActionGroup" stepKey="changeAddress"> <argument name="Address" value="UK_Not_Default_Address"/> <argument name="classPrefix" value="._show"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingDefaultAddressTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingDefaultAddressTest.xml index aa3665a81bbde..6202477f23f49 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingDefaultAddressTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingDefaultAddressTest.xml @@ -50,7 +50,7 @@ </actionGroup> <!-- Go to shopping cart --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToShoppingCartFromMinicart"/> <actionGroup ref="FillShippingZipForm" stepKey="fillShippingZipForm"> <argument name="address" value="US_Address_CA"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNewAddressTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNewAddressTest.xml index bafad6f28a680..961780a329dea 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNewAddressTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNewAddressTest.xml @@ -50,7 +50,7 @@ </actionGroup> <!-- Go to shopping cart --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToShoppingCartFromMinicart"/> <actionGroup ref="FillShippingZipForm" stepKey="fillShippingZipForm"> <argument name="address" value="US_Address_CA"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNonDefaultAddressTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNonDefaultAddressTest.xml index 2c341a5c4c1ab..3fc825f0d6405 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNonDefaultAddressTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNonDefaultAddressTest.xml @@ -50,7 +50,7 @@ </actionGroup> <!-- Go to shopping cart --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToShoppingCartFromMinicart"/> <actionGroup ref="FillShippingZipForm" stepKey="fillShippingZipForm"> <argument name="address" value="US_Address_CA"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutUsingSignInLinkTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutUsingSignInLinkTest.xml index 990459d7c81b7..adb6120800a1e 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutUsingSignInLinkTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutUsingSignInLinkTest.xml @@ -50,7 +50,7 @@ </actionGroup> <!-- Go to shopping cart --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToShoppingCartFromMinicart"/> <actionGroup ref="FillShippingZipForm" stepKey="fillShippingZipForm"> <argument name="address" value="US_Address_CA"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml index e85a47ab7a91d..f21e211193b26 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml @@ -159,7 +159,7 @@ </actionGroup> <!--Go to shopping cart--> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToShoppingCartFromMinicart"/> <actionGroup ref="FillShippingZipForm" stepKey="fillShippingZipForm"> <argument name="address" value="US_Address_CA"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/ShoppingCartAndMiniShoppingCartPerCustomerTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/ShoppingCartAndMiniShoppingCartPerCustomerTest.xml index 84cdb8abd9344..f85264db07da6 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/ShoppingCartAndMiniShoppingCartPerCustomerTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/ShoppingCartAndMiniShoppingCartPerCustomerTest.xml @@ -137,10 +137,10 @@ <!-- Assert products in mini cart for first customer --> <amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToStoreFrontHomePage"/> <waitForPageLoad stepKey="waitForHomePageLoad"/> - <actionGroup ref="assertOneProductNameInMiniCart" stepKey="assertFirstProductInMiniCart"> + <actionGroup ref="AssertOneProductNameInMiniCartActionGroup" stepKey="assertFirstProductInMiniCart"> <argument name="productName" value="$$createSimpleProduct.name$$"/> </actionGroup> - <actionGroup ref="assertOneProductNameInMiniCart" stepKey="assertSecondProductInMiniCart"> + <actionGroup ref="AssertOneProductNameInMiniCartActionGroup" stepKey="assertSecondProductInMiniCart"> <argument name="productName" value="$$createSimpleProductWithCustomOptions.name$$"/> </actionGroup> <actionGroup ref="AssertMiniShoppingCartSubTotalActionGroup" stepKey="assertMiniCartSubTotal"> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontUpdateShoppingCartWhileUpdateMinicartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontUpdateShoppingCartWhileUpdateMinicartTest.xml index fb80b4880a6f4..9c5aef12237d7 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontUpdateShoppingCartWhileUpdateMinicartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontUpdateShoppingCartWhileUpdateMinicartTest.xml @@ -37,7 +37,7 @@ </actionGroup> <!--Go to Shopping cart and check Qty--> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToShoppingCart"/> <grabValueFrom selector="{{CheckoutCartProductSection.ProductQuantityByName($$createProduct.name$$)}}" stepKey="grabQtyShoppingCart"/> <assertEquals expected="1" actual="$grabQtyShoppingCart" stepKey="assertQtyShoppingCart"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartTest.xml index 071311b78b3fa..bd2bad402d25e 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartTest.xml @@ -82,7 +82,7 @@ </actionGroup> <!-- Select Mini Cart and select 'View And Edit Cart' --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="selectViewAndEditCart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="selectViewAndEditCart"/> <!--Assert Shopping Cart Summary--> <actionGroup ref="AssertStorefrontShoppingCartSummaryWithShippingActionGroup" stepKey="AssertCartSummary" > diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddConfigurableProductToShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddConfigurableProductToShoppingCartTest.xml index e3090d6cb311b..e716ba294f578 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddConfigurableProductToShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddConfigurableProductToShoppingCartTest.xml @@ -131,7 +131,7 @@ </actionGroup> <!-- Select Mini Cart and select 'View And Edit Cart' --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="selectViewAndEditCart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="selectViewAndEditCart"/> <!--Assert Shopping Cart Summary --> <actionGroup ref="AssertStorefrontShoppingCartSummaryWithShippingActionGroup" stepKey="AssertCartSummary" > diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddDownloadableProductToShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddDownloadableProductToShoppingCartTest.xml index ec9852a6a939d..3c1421f2616aa 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddDownloadableProductToShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddDownloadableProductToShoppingCartTest.xml @@ -47,7 +47,7 @@ </actionGroup> <!-- Select Mini Cart and select 'View And Edit Cart' --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="selectViewAndEditCart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="selectViewAndEditCart"/> <!--Assert Shopping Cart Summary--> <actionGroup ref="AssertStorefrontShoppingCartSummaryItemsActionGroup" stepKey="AssertCartSummary" > diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddGroupedProductToShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddGroupedProductToShoppingCartTest.xml index b3762c7a582b7..0fc4cee5e0582 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddGroupedProductToShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddGroupedProductToShoppingCartTest.xml @@ -64,7 +64,7 @@ </actionGroup> <!-- Select Mini Cart and select 'View And Edit Cart' --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="selectViewAndEditCart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="selectViewAndEditCart"/> <!--Assert Product1 items in cart --> <actionGroup ref="AssertStorefrontCheckoutCartItemsActionGroup" stepKey="assertSimpleProduct1ItemsInCheckOutCart"> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddOneBundleMultiSelectOptionToTheShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddOneBundleMultiSelectOptionToTheShoppingCartTest.xml index 9b8e5a4521115..c7cd69bf8b01a 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddOneBundleMultiSelectOptionToTheShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddOneBundleMultiSelectOptionToTheShoppingCartTest.xml @@ -81,7 +81,7 @@ </actionGroup> <!-- Select Mini Cart and select 'View And Edit Cart' --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="selectViewAndEditCart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="selectViewAndEditCart"/> <!--Assert Shopping Cart Summary--> <actionGroup ref="AssertStorefrontShoppingCartSummaryWithShippingActionGroup" stepKey="AssertCartSummary" > diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddTwoBundleMultiSelectOptionsToTheShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddTwoBundleMultiSelectOptionsToTheShoppingCartTest.xml index 71e99f41f79e1..2dd9ed0907c90 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddTwoBundleMultiSelectOptionsToTheShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddTwoBundleMultiSelectOptionsToTheShoppingCartTest.xml @@ -79,7 +79,7 @@ </actionGroup> <!-- Select Mini Cart and select 'View And Edit Cart' --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="selectViewAndEditCart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="selectViewAndEditCart"/> <!--Assert Shopping Cart Summary--> <actionGroup ref="AssertStorefrontShoppingCartSummaryWithShippingActionGroup" stepKey="AssertCartSummary" > diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndProductWithTierPricesTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndProductWithTierPricesTest.xml index c5d1c34a93b32..20cd28b148df0 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndProductWithTierPricesTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndProductWithTierPricesTest.xml @@ -59,7 +59,7 @@ </actionGroup> <!--Open View and edit --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="clickMiniCart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="clickMiniCart"/> <!-- Fill the Estimate Shipping and Tax section --> <actionGroup ref="CheckoutFillEstimateShippingAndTaxActionGroup" stepKey="fillEstimateShippingAndTaxFields"/> @@ -127,4 +127,4 @@ <!-- Assert order buttons --> <actionGroup ref="AdminAssertOrderAvailableButtonsActionGroup" stepKey="assertOrderButtons"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndRegisterCustomerAfterCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndRegisterCustomerAfterCheckoutTest.xml index 34dc6617d25d5..87d5b9de911cb 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndRegisterCustomerAfterCheckoutTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndRegisterCustomerAfterCheckoutTest.xml @@ -45,7 +45,7 @@ </actionGroup> <!--Open View and edit --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="clickMiniCart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="clickMiniCart"/> <!-- Fill the Estimate Shipping and Tax section --> <actionGroup ref="CheckoutFillEstimateShippingAndTaxActionGroup" stepKey="fillEstimateShippingAndTaxFields"/> @@ -98,4 +98,4 @@ <!-- Assert order buttons --> <actionGroup ref="AdminAssertOrderAvailableButtonsActionGroup" stepKey="assertOrderButtons"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithSpecialPriceProductsTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithSpecialPriceProductsTest.xml index 6ccb05bf4c4f7..5efeef7922a53 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithSpecialPriceProductsTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithSpecialPriceProductsTest.xml @@ -123,7 +123,7 @@ </actionGroup> <!--Open View and edit --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="clickMiniCart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="clickMiniCart"/> <!-- Fill the Estimate Shipping and Tax section --> <actionGroup ref="CheckoutFillEstimateShippingAndTaxActionGroup" stepKey="fillEstimateShippingAndTaxFields"/> @@ -168,4 +168,4 @@ <!-- Assert order buttons --> <actionGroup ref="AdminAssertOrderAvailableButtonsActionGroup" stepKey="assertOrderButtons"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutDisabledProductAndCouponTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutDisabledProductAndCouponTest.xml index 0e704e5336db9..a35e503a3958a 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutDisabledProductAndCouponTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutDisabledProductAndCouponTest.xml @@ -52,7 +52,7 @@ </actionGroup> <!-- Open View and edit --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="clickMiniCart1"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="clickMiniCart1"/> <!-- Fill the Estimate Shipping and Tax section --> <actionGroup ref="CheckoutFillEstimateShippingAndTaxActionGroup" stepKey="fillEstimateShippingAndTaxFields"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutOnLoginWhenGuestCheckoutIsDisabledTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutOnLoginWhenGuestCheckoutIsDisabledTest.xml index b0b72515611e8..50631ad6c4c3f 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutOnLoginWhenGuestCheckoutIsDisabledTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutOnLoginWhenGuestCheckoutIsDisabledTest.xml @@ -49,7 +49,7 @@ </actionGroup> <!--Open View and edit --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="clickMiniCart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="clickMiniCart"/> <!-- Fill the Estimate Shipping and Tax section --> <actionGroup ref="CheckoutFillEstimateShippingAndTaxActionGroup" stepKey="fillEstimateShippingAndTaxFields"/> @@ -91,4 +91,4 @@ <!-- Ship the order and assert the shipping status --> <actionGroup ref="AdminShipThePendingOrderActionGroup" stepKey="shipTheOrder"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutWithNewCustomerRegistrationAndDisableGuestCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutWithNewCustomerRegistrationAndDisableGuestCheckoutTest.xml index f7e54867b1ae4..4907bc6672663 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutWithNewCustomerRegistrationAndDisableGuestCheckoutTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutWithNewCustomerRegistrationAndDisableGuestCheckoutTest.xml @@ -49,7 +49,7 @@ </actionGroup> <!--Open View and edit --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="clickMiniCart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="clickMiniCart"/> <click selector="{{CheckoutCartSummarySection.proceedToCheckout}}" stepKey="goToCheckout"/> <waitForPageLoad stepKey="waitForPageToLoad"/> @@ -83,7 +83,7 @@ <see userInput="You saved the address." stepKey="verifyAddressAdded"/> <!-- Open Edit and View from cart --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="openViewAndEditOption"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="openViewAndEditOption"/> <!-- Proceed to checkout --> <click selector="{{CheckoutCartSummarySection.proceedToCheckout}}" stepKey="goToCheckout1"/> @@ -129,4 +129,4 @@ <!-- Ship the order and assert the shipping status --> <actionGroup ref="AdminShipThePendingOrderActionGroup" stepKey="shipTheOrder"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerLoginDuringCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerLoginDuringCheckoutTest.xml index 3a0ba2302a6dc..afefbff5ea59a 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerLoginDuringCheckoutTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerLoginDuringCheckoutTest.xml @@ -55,7 +55,7 @@ </actionGroup> <!-- Go to Checkout page --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToShoppingCartFromMinicart"/> <click selector="{{CheckoutCartSummarySection.proceedToCheckout}}" stepKey="clickProceedToCheckout"/> <waitForPageLoad stepKey="waitForProceedToCheckout"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerPlaceOrderWithNewAddressesThatWasEditedTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerPlaceOrderWithNewAddressesThatWasEditedTest.xml index 651c5bd8d4375..f4dad72616038 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerPlaceOrderWithNewAddressesThatWasEditedTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerPlaceOrderWithNewAddressesThatWasEditedTest.xml @@ -46,7 +46,7 @@ <!-- Click "+ New Address" and Fill new address--> <click selector="{{CheckoutShippingSection.newAddressButton}}" stepKey="addAddress"/> - <actionGroup ref="LoggedInCheckoutWithOneAddressFieldWithoutStateField" stepKey="changeAddress"> + <actionGroup ref="LoggedInCheckoutWithOneAddressFieldWithoutStateFieldActionGroup" stepKey="changeAddress"> <argument name="Address" value="UK_Not_Default_Address"/> <argument name="classPrefix" value="._show"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteBundleProductFromMiniShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteBundleProductFromMiniShoppingCartTest.xml index 8f3ddbb27f62f..a8aa61dd40366 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteBundleProductFromMiniShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteBundleProductFromMiniShoppingCartTest.xml @@ -75,18 +75,18 @@ </actionGroup> <!-- Select Mini Cart and select 'View And Edit Cart' --> - <actionGroup ref="assertOneProductNameInMiniCart" stepKey="seeProductInMiniCart"> + <actionGroup ref="AssertOneProductNameInMiniCartActionGroup" stepKey="seeProductInMiniCart"> <argument name="productName" value="$$createBundleProduct.name$$"/> </actionGroup> <!--Remove an item from the cart using minicart--> - <actionGroup ref="removeProductFromMiniCart" stepKey="removeProductFromMiniCart"> + <actionGroup ref="RemoveProductFromMiniCartActionGroup" stepKey="removeProductFromMiniCart"> <argument name="productName" value="$$createBundleProduct.name$$"/> </actionGroup> <reloadPage stepKey="reloadPage"/> <!--Check the minicart is empty and verify AssertProductAbsentInMiniShoppingCart--> - <actionGroup ref="assertMiniCartEmpty" stepKey="miniCartEnpty"/> + <actionGroup ref="AssertMiniCartEmptyActionGroup" stepKey="miniCartEnpty"/> <dontSee selector="{{StorefrontMinicartSection.productLinkByName($$createBundleProduct.name$$)}}" stepKey="verifyAssertProductAbsentInMiniShoppingCart"/> </test> </tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteConfigurableProductFromMiniShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteConfigurableProductFromMiniShoppingCartTest.xml index f6357bcf4caa2..34264e5982651 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteConfigurableProductFromMiniShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteConfigurableProductFromMiniShoppingCartTest.xml @@ -83,18 +83,18 @@ </actionGroup> <!-- Select Mini Cart and select 'View And Edit Cart' --> - <actionGroup ref="assertOneProductNameInMiniCart" stepKey="seeProductInMiniCart"> + <actionGroup ref="AssertOneProductNameInMiniCartActionGroup" stepKey="seeProductInMiniCart"> <argument name="productName" value="$$createConfigProduct.name$$"/> </actionGroup> <!--Remove an item from the cart using minicart--> - <actionGroup ref="removeProductFromMiniCart" stepKey="removeProductFromMiniCart"> + <actionGroup ref="RemoveProductFromMiniCartActionGroup" stepKey="removeProductFromMiniCart"> <argument name="productName" value="$$createConfigProduct.name$$"/> </actionGroup> <reloadPage stepKey="reloadPage"/> <!--Check the minicart is empty and verify AssertProductAbsentInMiniShoppingCart--> - <actionGroup ref="assertMiniCartEmpty" stepKey="miniCartEnpty"/> + <actionGroup ref="AssertMiniCartEmptyActionGroup" stepKey="miniCartEnpty"/> <dontSee selector="{{StorefrontMinicartSection.productLinkByName($$createConfigProduct.name$$)}}" stepKey="verifyAssertProductAbsentInMiniShoppingCart"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteDownloadableProductFromMiniShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteDownloadableProductFromMiniShoppingCartTest.xml index 0fa503e1783b5..dd9259833cbc4 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteDownloadableProductFromMiniShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteDownloadableProductFromMiniShoppingCartTest.xml @@ -46,7 +46,7 @@ </actionGroup> <!-- Select Mini Cart and select 'View And Edit Cart' --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="selectViewAndEditCart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="selectViewAndEditCart"/> <!-- Assert product details in Mini Cart --> <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickOnMiniCart"/> @@ -59,18 +59,18 @@ </actionGroup> <!-- Select Mini Cart and select 'View And Edit Cart' --> - <actionGroup ref="assertOneProductNameInMiniCart" stepKey="seeProductInMiniCart"> + <actionGroup ref="AssertOneProductNameInMiniCartActionGroup" stepKey="seeProductInMiniCart"> <argument name="productName" value="$$createDownloadableProduct.name$$"/> </actionGroup> <!--Remove an item from the cart using minicart--> - <actionGroup ref="removeProductFromMiniCart" stepKey="removeProductFromMiniCart"> + <actionGroup ref="RemoveProductFromMiniCartActionGroup" stepKey="removeProductFromMiniCart"> <argument name="productName" value="$$createDownloadableProduct.name$$"/> </actionGroup> <reloadPage stepKey="reloadPage"/> <!--Check the minicart is empty and verify AssertProductAbsentInMiniShoppingCart--> - <actionGroup ref="assertMiniCartEmpty" stepKey="miniCartEnpty"/> + <actionGroup ref="AssertMiniCartEmptyActionGroup" stepKey="miniCartEnpty"/> <dontSee selector="{{StorefrontMinicartSection.productLinkByName($$createDownloadableProduct.name$$)}}" stepKey="verifyAssertProductAbsentInMiniShoppingCart"/> </test> </tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteProductsWithCartItemsDisplayDefaultLimitationFromMiniShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteProductsWithCartItemsDisplayDefaultLimitationFromMiniShoppingCartTest.xml index cca5268564b12..65f29dcd126d3 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteProductsWithCartItemsDisplayDefaultLimitationFromMiniShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteProductsWithCartItemsDisplayDefaultLimitationFromMiniShoppingCartTest.xml @@ -237,40 +237,40 @@ </actionGroup> <!--Remove products from minicart--> - <actionGroup ref="removeProductFromMiniCart" stepKey="removeProduct1FromMiniCart"> + <actionGroup ref="RemoveProductFromMiniCartActionGroup" stepKey="removeProduct1FromMiniCart"> <argument name="productName" value="$$simpleProduct10.name$$"/> </actionGroup> - <actionGroup ref="removeProductFromMiniCart" stepKey="removeProduct2FromMiniCart"> + <actionGroup ref="RemoveProductFromMiniCartActionGroup" stepKey="removeProduct2FromMiniCart"> <argument name="productName" value="$$simpleProduct9.name$$"/> </actionGroup> - <actionGroup ref="removeProductFromMiniCart" stepKey="removeProduct3FromMiniCart"> + <actionGroup ref="RemoveProductFromMiniCartActionGroup" stepKey="removeProduct3FromMiniCart"> <argument name="productName" value="$$simpleProduct8.name$$"/> </actionGroup> - <actionGroup ref="removeProductFromMiniCart" stepKey="removeProduct4FromMiniCart"> + <actionGroup ref="RemoveProductFromMiniCartActionGroup" stepKey="removeProduct4FromMiniCart"> <argument name="productName" value="$$simpleProduct7.name$$"/> </actionGroup> - <actionGroup ref="removeProductFromMiniCart" stepKey="removeProduct5FromMiniCart"> + <actionGroup ref="RemoveProductFromMiniCartActionGroup" stepKey="removeProduct5FromMiniCart"> <argument name="productName" value="$$simpleProduct6.name$$"/> </actionGroup> - <actionGroup ref="removeProductFromMiniCart" stepKey="removeProduct6FromMiniCart"> + <actionGroup ref="RemoveProductFromMiniCartActionGroup" stepKey="removeProduct6FromMiniCart"> <argument name="productName" value="$$simpleProduct5.name$$"/> </actionGroup> - <actionGroup ref="removeProductFromMiniCart" stepKey="removeProduct7FromMiniCart"> + <actionGroup ref="RemoveProductFromMiniCartActionGroup" stepKey="removeProduct7FromMiniCart"> <argument name="productName" value="$$simpleProduct4.name$$"/> </actionGroup> - <actionGroup ref="removeProductFromMiniCart" stepKey="removeProduct8FromMiniCart"> + <actionGroup ref="RemoveProductFromMiniCartActionGroup" stepKey="removeProduct8FromMiniCart"> <argument name="productName" value="$$simpleProduct3.name$$"/> </actionGroup> - <actionGroup ref="removeProductFromMiniCart" stepKey="removeProduct9FromMiniCart"> + <actionGroup ref="RemoveProductFromMiniCartActionGroup" stepKey="removeProduct9FromMiniCart"> <argument name="productName" value="$$simpleProduct2.name$$"/> </actionGroup> - <actionGroup ref="removeProductFromMiniCart" stepKey="removeProduct10FromMiniCart"> + <actionGroup ref="RemoveProductFromMiniCartActionGroup" stepKey="removeProduct10FromMiniCart"> <argument name="productName" value="$$simpleProduct1.name$$"/> </actionGroup> <reloadPage stepKey="reloadPage"/> <!--Check the minicart is empty and verify EmptyCartMessage and AssertProductAbsentInMiniShoppingCart--> - <actionGroup ref="assertMiniCartEmpty" stepKey="miniCartEnpty"/> + <actionGroup ref="AssertMiniCartEmptyActionGroup" stepKey="miniCartEnpty"/> <dontSee selector="{{StorefrontMinicartSection.productLinkByName($$simpleProduct1.name$$)}}" stepKey="verifyAssertProduct1AbsentInMiniShoppingCart"/> <dontSee selector="{{StorefrontMinicartSection.productLinkByName($$simpleProduct2.name$$)}}" stepKey="verifyAssertProduct2AbsentInMiniShoppingCart"/> <dontSee selector="{{StorefrontMinicartSection.productLinkByName($$simpleProduct3.name$$)}}" stepKey="verifyAssertProduct3AbsentInMiniShoppingCart"/> @@ -282,4 +282,4 @@ <dontSee selector="{{StorefrontMinicartSection.productLinkByName($$simpleProduct9.name$$)}}" stepKey="verifyAssertProduct9AbsentInMiniShoppingCart"/> <dontSee selector="{{StorefrontMinicartSection.productLinkByName($$simpleProduct10.name$$)}}" stepKey="verifyAssertProduct10AbsentInMiniShoppingCart"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteSimpleAndVirtualProductFromMiniShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteSimpleAndVirtualProductFromMiniShoppingCartTest.xml index b8092ccdcdce7..c2c939a19cc76 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteSimpleAndVirtualProductFromMiniShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteSimpleAndVirtualProductFromMiniShoppingCartTest.xml @@ -64,25 +64,25 @@ </actionGroup> <!-- Select mini Cart and verify Simple and Virtual products names in cart--> - <actionGroup ref="assertOneProductNameInMiniCart" stepKey="seeSimpleProductInMiniCart"> + <actionGroup ref="AssertOneProductNameInMiniCartActionGroup" stepKey="seeSimpleProductInMiniCart"> <argument name="productName" value="$$simpleProduct.name$$"/> </actionGroup> - <actionGroup ref="assertOneProductNameInMiniCart" stepKey="seeVirtualProductInMiniCart"> + <actionGroup ref="AssertOneProductNameInMiniCartActionGroup" stepKey="seeVirtualProductInMiniCart"> <argument name="productName" value="$$virtualProduct.name$$"/> </actionGroup> <!--Remove Simple and Virtual products from mini cart--> - <actionGroup ref="removeProductFromMiniCart" stepKey="removeProductFromMiniCart"> + <actionGroup ref="RemoveProductFromMiniCartActionGroup" stepKey="removeProductFromMiniCart"> <argument name="productName" value="$$simpleProduct.name$$"/> </actionGroup> - <actionGroup ref="removeProductFromMiniCart" stepKey="removeVirtualProductFromMiniCart"> + <actionGroup ref="RemoveProductFromMiniCartActionGroup" stepKey="removeVirtualProductFromMiniCart"> <argument name="productName" value="$$virtualProduct.name$$"/> </actionGroup> <reloadPage stepKey="reloadPage"/> <!--Check the minicart is empty and verify EmptyCartMessage and AssertProductAbsentInMiniShoppingCart--> - <actionGroup ref="assertMiniCartEmpty" stepKey="miniCartEnpty"/> + <actionGroup ref="AssertMiniCartEmptyActionGroup" stepKey="miniCartEnpty"/> <dontSee selector="{{StorefrontMinicartSection.productLinkByName($$simpleProduct.name$$)}}" stepKey="verifyAssertSimpleProductAbsentInMiniShoppingCart"/> <dontSee selector="{{StorefrontMinicartSection.productLinkByName($$virtualProduct.name$$)}}" stepKey="verifyAssertVirtualProductAbsentInMiniShoppingCart"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteSimpleProductFromMiniShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteSimpleProductFromMiniShoppingCartTest.xml index 05198060f5de4..02943b7f203f7 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteSimpleProductFromMiniShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteSimpleProductFromMiniShoppingCartTest.xml @@ -46,18 +46,18 @@ </actionGroup> <!-- Select Mini Cart and select 'View And Edit Cart' --> - <actionGroup ref="assertOneProductNameInMiniCart" stepKey="seeProductInMiniCart"> + <actionGroup ref="AssertOneProductNameInMiniCartActionGroup" stepKey="seeProductInMiniCart"> <argument name="productName" value="$$simpleProduct.name$$"/> </actionGroup> <!--Remove an item from the cart using minicart--> - <actionGroup ref="removeProductFromMiniCart" stepKey="removeProductFromMiniCart"> + <actionGroup ref="RemoveProductFromMiniCartActionGroup" stepKey="removeProductFromMiniCart"> <argument name="productName" value="$$simpleProduct.name$$"/> </actionGroup> <reloadPage stepKey="reloadPage"/> <!--Check the minicart is empty and verify AssertProductAbsentInMiniShoppingCart--> - <actionGroup ref="assertMiniCartEmpty" stepKey="miniCartEnpty"/> + <actionGroup ref="AssertMiniCartEmptyActionGroup" stepKey="miniCartEnpty"/> <dontSee selector="{{StorefrontMinicartSection.productLinkByName($$simpleProduct.name$$)}}" stepKey="verifyAssertProductAbsentInMiniShoppingCart"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutUsingFreeShippingAndTaxesTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutUsingFreeShippingAndTaxesTest.xml index 2226e1ebc8292..fdcdcb1cbd9e3 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutUsingFreeShippingAndTaxesTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutUsingFreeShippingAndTaxesTest.xml @@ -161,7 +161,7 @@ </actionGroup> <!--Open View and edit --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="clickMiniCart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="clickMiniCart"/> <!-- Fill the Estimate Shipping and Tax section --> <actionGroup ref="CheckoutFillEstimateShippingAndTaxActionGroup" stepKey="fillEstimateShippingAndTaxFields"> @@ -220,4 +220,4 @@ <argument name="customerGroup" value=""/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutWithCouponAndZeroSubtotalTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutWithCouponAndZeroSubtotalTest.xml index 33ec099aa2ace..45e1d2c10e8d2 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutWithCouponAndZeroSubtotalTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutWithCouponAndZeroSubtotalTest.xml @@ -41,7 +41,7 @@ </actionGroup> <!--Open View and edit --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="clickMiniCart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="clickMiniCart"/> <!-- Fill the Estimate Shipping and Tax section --> <actionGroup ref="CheckoutFillEstimateShippingAndTaxActionGroup" stepKey="fillEstimateShippingAndTaxFields"/> @@ -90,4 +90,4 @@ <see selector="{{AdminOrderTotalSection.grandTotal}}" userInput="$0.00" stepKey="seeGrandTotal"/> <see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="Pending" stepKey="seeOrderStatus"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontNotApplicableShippingMethodInReviewAndPaymentStepTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontNotApplicableShippingMethodInReviewAndPaymentStepTest.xml index 0f07549ff7885..8a4d8944a1e11 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontNotApplicableShippingMethodInReviewAndPaymentStepTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontNotApplicableShippingMethodInReviewAndPaymentStepTest.xml @@ -112,7 +112,7 @@ </actionGroup> <!-- Go to Order review --> - <actionGroup ref="StorefrontCheckoutForwardFromShippingStep" stepKey="goToCheckoutReview"/> + <actionGroup ref="StorefrontCheckoutForwardFromShippingStepActionGroup" stepKey="goToCheckoutReview"/> <!-- Checkout select Check/Money Order payment --> <actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/> @@ -142,7 +142,7 @@ </actionGroup> <!-- Go to Order review --> - <actionGroup ref="StorefrontCheckoutForwardFromShippingStep" stepKey="goToCheckoutReview2"/> + <actionGroup ref="StorefrontCheckoutForwardFromShippingStepActionGroup" stepKey="goToCheckoutReview2"/> <!-- Place order assert succeed --> <actionGroup ref="ClickPlaceOrderActionGroup" stepKey="checkoutPlaceOrder"/> @@ -167,7 +167,7 @@ </actionGroup> <!-- Go to Order review --> - <actionGroup ref="StorefrontCheckoutForwardFromShippingStep" stepKey="goToCheckoutReview3"/> + <actionGroup ref="StorefrontCheckoutForwardFromShippingStepActionGroup" stepKey="goToCheckoutReview3"/> <!-- Checkout select Check/Money Order payment --> <actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment2"/> @@ -198,7 +198,7 @@ </actionGroup> <!-- Go to Order review --> - <actionGroup ref="StorefrontCheckoutForwardFromShippingStep" stepKey="goToCheckoutReview4"/> + <actionGroup ref="StorefrontCheckoutForwardFromShippingStepActionGroup" stepKey="goToCheckoutReview4"/> <!-- Place order assert succeed --> <actionGroup ref="ClickPlaceOrderActionGroup" stepKey="checkoutPlaceOrder2"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontProductQuantityChangesInBackendAfterCustomerCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontProductQuantityChangesInBackendAfterCustomerCheckoutTest.xml index 285dc28cb520e..3404bb4baac54 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontProductQuantityChangesInBackendAfterCustomerCheckoutTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontProductQuantityChangesInBackendAfterCustomerCheckoutTest.xml @@ -42,7 +42,7 @@ </actionGroup> <!--Open View and edit --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="clickMiniCart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="clickMiniCart"/> <!-- Fill the Estimate Shipping and Tax section --> <actionGroup ref="CheckoutFillEstimateShippingAndTaxActionGroup" stepKey="fillEstimateShippingAndTaxFields"/> @@ -102,4 +102,4 @@ </actionGroup> <see selector="{{StorefrontProductInfoMainSection.productStockStatus}}" userInput="Out Of Stock" stepKey="seeProductDisplayedAsOutOfStock"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontRefreshPageDuringGuestCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontRefreshPageDuringGuestCheckoutTest.xml index 1db460de44996..bb74726330b68 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontRefreshPageDuringGuestCheckoutTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontRefreshPageDuringGuestCheckoutTest.xml @@ -41,7 +41,7 @@ </actionGroup> <!-- Go to Checkout page --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToShoppingCartFromMinicart"/> <click selector="{{CheckoutCartSummarySection.proceedToCheckout}}" stepKey="clickProceedToCheckout"/> <waitForPageLoad stepKey="waitForProceedToCheckout"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontShoppingCartCheckCustomerDefaultShippingAddressForVirtualQuoteTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontShoppingCartCheckCustomerDefaultShippingAddressForVirtualQuoteTest.xml index b0e1dead1fff9..89e974892427d 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontShoppingCartCheckCustomerDefaultShippingAddressForVirtualQuoteTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontShoppingCartCheckCustomerDefaultShippingAddressForVirtualQuoteTest.xml @@ -39,7 +39,7 @@ <argument name="productCount" value="1"/> </actionGroup> <!-- Step 3: Go to Shopping Cart --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingcart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToShoppingcart"/> <!-- Step 4: Open Estimate Tax section --> <click selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" stepKey="openEstimateTaxSection"/> <seeOptionIsSelected selector="{{CheckoutCartSummarySection.country}}" userInput="{{US_Address_CA.country}}" stepKey="checkCountry"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKCustomerCheckoutWithCouponTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKCustomerCheckoutWithCouponTest.xml index 482e2fb6233a6..bf9c8e9e68a1b 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKCustomerCheckoutWithCouponTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKCustomerCheckoutWithCouponTest.xml @@ -67,7 +67,7 @@ </actionGroup> <!--Open View and edit --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="clickMiniCart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="clickMiniCart"/> <!-- Apply Coupon --> <actionGroup ref="StorefrontApplyCouponActionGroup" stepKey="applyDiscount"> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKGuestCheckoutWithConditionProductQuantityEqualsToOrderedQuantityTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKGuestCheckoutWithConditionProductQuantityEqualsToOrderedQuantityTest.xml index deab32aede324..7b7d4202c3cd4 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKGuestCheckoutWithConditionProductQuantityEqualsToOrderedQuantityTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKGuestCheckoutWithConditionProductQuantityEqualsToOrderedQuantityTest.xml @@ -39,7 +39,7 @@ </actionGroup> <!--Open View and edit --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="clickMiniCart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="clickMiniCart"/> <!-- Fill the Estimate Shipping and Tax section --> <actionGroup ref="CheckoutFillEstimateShippingAndTaxActionGroup" stepKey="fillEstimateShippingAndTaxFields"/> @@ -97,4 +97,4 @@ </actionGroup> <see selector="{{StorefrontProductInfoMainSection.productStockStatus}}" userInput="Out Of Stock" stepKey="seeProductDisplayedAsOutOfStock"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUSCustomerCheckoutWithCouponAndBankTransferPaymentMethodTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUSCustomerCheckoutWithCouponAndBankTransferPaymentMethodTest.xml index 6d5f79f3aadf4..c55e47a5a1ed1 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUSCustomerCheckoutWithCouponAndBankTransferPaymentMethodTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUSCustomerCheckoutWithCouponAndBankTransferPaymentMethodTest.xml @@ -46,7 +46,7 @@ </actionGroup> <!-- Open View and edit --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="clickMiniCart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="clickMiniCart"/> <!-- Fill the Estimate Shipping and Tax section --> <actionGroup ref="CheckoutFillEstimateShippingAndTaxActionGroup" stepKey="fillEstimateShippingAndTaxFields"/> @@ -94,4 +94,4 @@ <!-- Assert order buttons --> <actionGroup ref="AdminAssertOrderAvailableButtonsActionGroup" stepKey="assertOrderButtons"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUpdateShoppingCartSimpleProductQtyTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUpdateShoppingCartSimpleProductQtyTest.xml index 72f6cf95a6fbe..372d763bf2fb7 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUpdateShoppingCartSimpleProductQtyTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUpdateShoppingCartSimpleProductQtyTest.xml @@ -56,7 +56,7 @@ <see userInput="{{quoteQty3Price123.currency}}{{quoteQty3Price123.subtotal}}" selector="{{CheckoutCartSummarySection.subtotal}}" stepKey="assertCartSubtotal"/> <!-- Minicart product price and subtotal should be updated --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="openMinicart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="openMinicart"/> <grabValueFrom selector="{{StorefrontMinicartSection.itemQuantity($$createProduct.name$$)}}" stepKey="grabProductQtyInMinicart"/> <assertEquals stepKey="assertProductQtyInMinicart"> <actualResult type="variable">grabProductQtyInMinicart</actualResult> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUpdateShoppingCartSimpleWithCustomOptionsProductQtyTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUpdateShoppingCartSimpleWithCustomOptionsProductQtyTest.xml index 7a653f13c4ee5..0b52b08980ded 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUpdateShoppingCartSimpleWithCustomOptionsProductQtyTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUpdateShoppingCartSimpleWithCustomOptionsProductQtyTest.xml @@ -61,7 +61,7 @@ <see userInput="{{quoteQty11Subtotal1320.currency}}{{quoteQty11Subtotal1320.subtotal}}" selector="{{CheckoutCartSummarySection.subtotal}}" stepKey="assertSubtotal"/> <!-- Minicart product price and subtotal should be updated --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="openMinicart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="openMinicart"/> <grabValueFrom selector="{{StorefrontMinicartSection.itemQuantity($$createProduct.name$$)}}" stepKey="grabProductQtyInMinicart"/> <assertEquals stepKey="assertProductQtyInMinicart"> <expectedResult type="string">{{quoteQty11Subtotal1320.qty}}</expectedResult> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminRelatedProductsTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminRelatedProductsTest.xml index aa34693ed82f0..7f85224933da2 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminRelatedProductsTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminRelatedProductsTest.xml @@ -193,11 +193,11 @@ <see selector="{{StorefrontMinicartSection.quantity}}" userInput="2" stepKey="seeItemCounterInMiniCart"/> - <actionGroup ref="assertOneProductNameInMiniCart" stepKey="assertOneProductNameInMiniCart"> + <actionGroup ref="AssertOneProductNameInMiniCartActionGroup" stepKey="assertOneProductNameInMiniCart"> <argument name="productName" value="$$baseConfigProductHandle.name$$"/> </actionGroup> - <actionGroup ref="assertOneProductNameInMiniCart" stepKey="assertOneProductNameInMiniCart2"> + <actionGroup ref="AssertOneProductNameInMiniCartActionGroup" stepKey="assertOneProductNameInMiniCart2"> <argument name="productName" value="$$simple2Handle.name$$"/> </actionGroup> </test> diff --git a/app/code/Magento/Persistent/Test/Mftf/Test/CheckShoppingCartBehaviorAfterSessionExpiredTest.xml b/app/code/Magento/Persistent/Test/Mftf/Test/CheckShoppingCartBehaviorAfterSessionExpiredTest.xml index c66a2979aa7f5..9169023bbf2e0 100644 --- a/app/code/Magento/Persistent/Test/Mftf/Test/CheckShoppingCartBehaviorAfterSessionExpiredTest.xml +++ b/app/code/Magento/Persistent/Test/Mftf/Test/CheckShoppingCartBehaviorAfterSessionExpiredTest.xml @@ -46,7 +46,7 @@ <actionGroup ref="AddSimpleProductToCart" stepKey="addProductToCart1"> <argument name="product" value="$$createProduct$$"/> </actionGroup> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToShoppingCartFromMinicart"/> <!--Reset cookies and refresh the page--> <resetCookie userInput="PHPSESSID" stepKey="resetCookieForCart"/> <reloadPage stepKey="reloadPage"/> diff --git a/app/code/Magento/Persistent/Test/Mftf/Test/ShippingQuotePersistedForGuestTest.xml b/app/code/Magento/Persistent/Test/Mftf/Test/ShippingQuotePersistedForGuestTest.xml index d508ebaa26885..40c9d59dc766b 100644 --- a/app/code/Magento/Persistent/Test/Mftf/Test/ShippingQuotePersistedForGuestTest.xml +++ b/app/code/Magento/Persistent/Test/Mftf/Test/ShippingQuotePersistedForGuestTest.xml @@ -59,7 +59,7 @@ <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProductToCartAsGuestUser"> <argument name="productName" value="$$createProduct.name$$"/> </actionGroup> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartBeforeChangeShippingAndTaxSection"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToShoppingCartBeforeChangeShippingAndTaxSection"/> <!--Step 5: Open Estimate Shipping and Tax block and fill the sections--> <conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="expandEstimateShippingAndTax" /> <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/> @@ -69,7 +69,7 @@ <!--Step 6: Go to Homepage--> <amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToHomePageAfterChangingShippingAndTaxSection"/> <!--Step 7: Go to shopping cart and check "Estimate Shipping and Tax" fields values are saved--> - <actionGroup ref="clickViewAndEditCartFromMiniCart" after="goToHomePageAfterChangingShippingAndTaxSection" stepKey="goToShoppingCartAfterChangingShippingAndTaxSection"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" after="goToHomePageAfterChangingShippingAndTaxSection" stepKey="goToShoppingCartAfterChangingShippingAndTaxSection"/> <conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="expandEstimateShippingAndTaxAfterChanging" /> <seeOptionIsSelected selector="{{CheckoutCartSummarySection.country}}" userInput="{{US_Address_CA.country}}" stepKey="checkCustomerCountry" /> <seeOptionIsSelected selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="{{US_Address_CA.state}}" stepKey="checkCustomerRegion" /> diff --git a/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyShoppingCartPersistenceUnderLongTermCookieTest.xml b/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyShoppingCartPersistenceUnderLongTermCookieTest.xml index e50fc4af83107..aaba09b8088d6 100644 --- a/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyShoppingCartPersistenceUnderLongTermCookieTest.xml +++ b/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyShoppingCartPersistenceUnderLongTermCookieTest.xml @@ -67,7 +67,7 @@ <actionGroup ref="AddSimpleProductToCart" stepKey="addSimple1ProductToCartForJohnSmithCustomer"> <argument name="product" value="$$createSimple1$$"/> </actionGroup> - <actionGroup ref="assertOneProductNameInMiniCart" stepKey="checkSimple1InMiniCartForJohnSmithCustomer"> + <actionGroup ref="AssertOneProductNameInMiniCartActionGroup" stepKey="checkSimple1InMiniCartForJohnSmithCustomer"> <argument name="productName" value="$$createSimple1.name$$"/> </actionGroup> @@ -79,7 +79,7 @@ <actionGroup ref="StorefrontAssertPersistentCustomerWelcomeMessageNotPresentActionGroup" stepKey="dontSeeWelcomeJohnSmithCustomerNotYouMessage"> <argument name="customerFullName" value="{{John_Smith_Customer.fullname}}"/> </actionGroup> - <actionGroup ref="assertMiniCartEmpty" stepKey="assertMiniCartEmptyAfterJohnSmithSignOut" /> + <actionGroup ref="AssertMiniCartEmptyActionGroup" stepKey="assertMiniCartEmptyAfterJohnSmithSignOut" /> <!-- 5. Click the Create an Account link again and fill fields for registration of another customer, set password and check the Remember Me checkbox --> <amOnPage url="{{StorefrontCustomerCreatePage.url}}" stepKey="amOnCustomerAccountCreatePage"/> @@ -96,7 +96,7 @@ <argument name="product" value="$$createSimple1$$"/> </actionGroup> <see selector="{{StorefrontMinicartSection.productCount}}" userInput="1" stepKey="miniCartContainsOneProductForJohnDoeCustomer"/> - <actionGroup ref="assertOneProductNameInMiniCart" stepKey="checkSimple1InMiniCartForJohnDoeCustomer"> + <actionGroup ref="AssertOneProductNameInMiniCartActionGroup" stepKey="checkSimple1InMiniCartForJohnDoeCustomer"> <argument name="productName" value="$$createSimple1.name$$"/> </actionGroup> @@ -110,22 +110,22 @@ <waitForText selector="{{StorefrontCMSPageSection.mainContent}}" userInput="CMS homepage content goes here." stepKey="waitForLoadContentMessageOnHomePage"/> <waitForElementVisible selector="{{StorefrontMinicartSection.productCount}}" stepKey="waitForCartCounterVisible"/> <see selector="{{StorefrontMinicartSection.productCount}}" userInput="1" stepKey="miniCartContainsOneProductForGuest"/> - <actionGroup ref="assertOneProductNameInMiniCart" stepKey="checkSimple1InMiniCartForGuestCustomer"> + <actionGroup ref="AssertOneProductNameInMiniCartActionGroup" stepKey="checkSimple1InMiniCartForGuestCustomer"> <argument name="productName" value="$$createSimple1.name$$"/> </actionGroup> <!-- 8. Go to Shopping Cart and verify Simple Product 1 is present there --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCart" /> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToShoppingCart" /> <see selector="{{CheckoutCartProductSection.productName}}" userInput="$$createSimple1.name$$" stepKey="checkSimple1InShoppingCart"/> <!-- 9. Add Simple Product 2 to Shopping Cart --> <actionGroup ref="AddSimpleProductToCart" stepKey="addSimple2ProductToCartForGuest"> <argument name="product" value="$$createSimple2$$"/> </actionGroup> - <actionGroup ref="assertOneProductNameInMiniCart" stepKey="checkSimple1InMiniCartForGuestCustomerSecondTime"> + <actionGroup ref="AssertOneProductNameInMiniCartActionGroup" stepKey="checkSimple1InMiniCartForGuestCustomerSecondTime"> <argument name="productName" value="$$createSimple1.name$$"/> </actionGroup> - <actionGroup ref="assertOneProductNameInMiniCart" stepKey="checkSimple2InMiniCartForGuestCustomer"> + <actionGroup ref="AssertOneProductNameInMiniCartActionGroup" stepKey="checkSimple2InMiniCartForGuestCustomer"> <argument name="productName" value="$$createSimple2.name$$"/> </actionGroup> <see selector="{{StorefrontMinicartSection.productCount}}" userInput="2" stepKey="miniCartContainsTwoProductForGuest"/> @@ -140,10 +140,10 @@ <argument name="Customer" value="Simple_Customer_Without_Address"/> </actionGroup> <see selector="{{StorefrontMinicartSection.productCount}}" userInput="2" stepKey="miniCartContainsTwoProductForJohnDoeCustomer"/> - <actionGroup ref="assertOneProductNameInMiniCart" stepKey="checkSimple1InMiniCartForJohnDoeCustomerSecondTime"> + <actionGroup ref="AssertOneProductNameInMiniCartActionGroup" stepKey="checkSimple1InMiniCartForJohnDoeCustomerSecondTime"> <argument name="productName" value="$$createSimple1.name$$"/> </actionGroup> - <actionGroup ref="assertOneProductNameInMiniCart" stepKey="checkSimple2InMiniCartForJohnDoeCustomer"> + <actionGroup ref="AssertOneProductNameInMiniCartActionGroup" stepKey="checkSimple2InMiniCartForJohnDoeCustomer"> <argument name="productName" value="$$createSimple2.name$$"/> </actionGroup> @@ -154,6 +154,6 @@ <waitForText selector="{{StorefrontCMSPageSection.mainContent}}" userInput="CMS homepage content goes here." stepKey="waitForLoadMainContentMessageOnHomePage"/> <click selector="{{StorefrontPanelHeaderSection.notYouLink}}" stepKey="clickOnNotYouLink" /> <waitForPageLoad stepKey="waitForCustomerLoginPageLoad"/> - <actionGroup ref="assertMiniCartEmpty" stepKey="assertMiniCartEmptyAfterJohnDoeSignOut" /> + <actionGroup ref="AssertMiniCartEmptyActionGroup" stepKey="assertMiniCartEmptyAfterJohnDoeSignOut" /> </test> </tests> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionAndFreeShippingIsAppliedTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionAndFreeShippingIsAppliedTest.xml index b51027d51fd53..c35311e1948c1 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionAndFreeShippingIsAppliedTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionAndFreeShippingIsAppliedTest.xml @@ -91,7 +91,7 @@ </actionGroup> <!--Click on view and edit cart link--> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToShoppingCartFromMinicart"/> <waitForPageLoad stepKey="waitForViewAndEditCartToOpen"/> <conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" visible="true" stepKey="clickEstimateShippingAndTaxToOpen"/> <waitForPageLoad stepKey="waitForEstimateShippingAndTaxToOpen"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionIsNotAppliedTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionIsNotAppliedTest.xml index 8969e9d9d4ceb..3ceff9dc23d4b 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionIsNotAppliedTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionIsNotAppliedTest.xml @@ -103,7 +103,7 @@ </actionGroup> <!--Click on view and edit cart link--> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToShoppingCartFromMinicart"/> <waitForPageLoad stepKey="waitForViewAndEditCartToOpen"/> <!--Verify AssertCartPriceRuleConditionIsNotApplied(Shopping cart subtotal equals to grand total - price rule has not been applied)--> <actionGroup ref="StorefrontCheckCartActionGroup" stepKey="cartAssert"> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForMatchingSubtotalAndVerifyRuleConditionIsAppliedTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForMatchingSubtotalAndVerifyRuleConditionIsAppliedTest.xml index ab62e51414e85..04570742cd31c 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForMatchingSubtotalAndVerifyRuleConditionIsAppliedTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForMatchingSubtotalAndVerifyRuleConditionIsAppliedTest.xml @@ -101,7 +101,7 @@ </actionGroup> <!--Click on view and edit cart link--> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToShoppingCartFromMinicart"/> <waitForPageLoad stepKey="waitForViewAndEditCartToOpen"/> <conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" visible="true" stepKey="clickEstimateShippingAndTaxToOpen"/> <waitForPageLoad stepKey="waitForEstimateShippingAndTaxToOpen"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingCategoryAndVerifyRuleConditionIsAppliedTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingCategoryAndVerifyRuleConditionIsAppliedTest.xml index 00f104885e0f0..bab2212e37892 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingCategoryAndVerifyRuleConditionIsAppliedTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingCategoryAndVerifyRuleConditionIsAppliedTest.xml @@ -110,7 +110,7 @@ </actionGroup> <!--Click on view and edit cart link--> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToShoppingCartFromMinicart"/> <waitForPageLoad stepKey="waitForViewAndEditToOpen"/> <!--Verify AssertCartPriceRuleConditionIsApplied if condition category id is matching--> <actionGroup ref="StorefrontCheckCartActionGroup" stepKey="cartAssert"> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingTotalWeightAndVerifyRuleConditionIsAppliedTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingTotalWeightAndVerifyRuleConditionIsAppliedTest.xml index 43b92ee938978..ebb5aa97e4212 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingTotalWeightAndVerifyRuleConditionIsAppliedTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingTotalWeightAndVerifyRuleConditionIsAppliedTest.xml @@ -98,7 +98,7 @@ </actionGroup> <!--Click on view and edit cart link--> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToShoppingCartFromMinicart"/> <waitForPageLoad stepKey="waitForViewAndEditCartToOpen"/> <!--Verify AssertCartPriceRuleConditionIsApplied if condition Total Weight equals 200 is true--> <actionGroup ref="StorefrontCheckCartActionGroup" stepKey="cartAssert"> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/CartPriceRuleForConfigurableProductTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/CartPriceRuleForConfigurableProductTest.xml index 1eba06126ff6f..27b42d2f77dfd 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/CartPriceRuleForConfigurableProductTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/CartPriceRuleForConfigurableProductTest.xml @@ -88,7 +88,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteApiCategory"/> <actionGroup ref="logout" stepKey="logout"/> </after> - + <!-- Create the rule --> <amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceList"/> <waitForPageLoad stepKey="waitForRulesPage"/> @@ -131,7 +131,7 @@ <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage2"/> <!--View and edit cart--> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="clickViewAndEditCartFromMiniCart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="clickViewAndEditCartFromMiniCart"/> <click selector="{{DiscountSection.DiscountTab}}" stepKey="scrollToDiscountTab" /> <fillField selector="{{DiscountSection.CouponInput}}" userInput="ABCD" stepKey="fillCouponCode" /> <click selector="{{DiscountSection.ApplyCodeBtn}}" stepKey="applyCode"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartRuleCouponForFreeShippingTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartRuleCouponForFreeShippingTest.xml index 9e95e39e4791e..3526ab20aa6b4 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartRuleCouponForFreeShippingTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartRuleCouponForFreeShippingTest.xml @@ -56,7 +56,7 @@ <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckout"/> <!-- Go to Order review --> - <actionGroup ref="StorefrontCheckoutForwardFromShippingStep" stepKey="goToCheckoutReview"/> + <actionGroup ref="StorefrontCheckoutForwardFromShippingStepActionGroup" stepKey="goToCheckoutReview"/> <!-- Apply Discount Coupon to the Order --> <actionGroup ref="StorefrontApplyDiscountCodeActionGroup" stepKey="applyDiscountCoupon"> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCategoryRulesShouldApplyToComplexProductsTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCategoryRulesShouldApplyToComplexProductsTest.xml index d8c5b42dbaaaf..717325ab89e6d 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCategoryRulesShouldApplyToComplexProductsTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCategoryRulesShouldApplyToComplexProductsTest.xml @@ -94,7 +94,7 @@ <argument name="product" value="$$createConfigProductCreateConfigurableProduct1$$"/> <argument name="productCount" value="2"/> </actionGroup> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToCart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToCart"/> <!-- Discount amount is not applied --> <dontSee selector="{{CheckoutCartSummarySection.discountLabel}}" stepKey="discountIsNotApply"/> <!-- 3: Open configurable product 2 and add all his child products to cart --> @@ -110,7 +110,7 @@ <argument name="productCount" value="4"/> </actionGroup> <!-- Discount amount is applied --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToCart2"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToCart2"/> <see selector="{{CheckoutCartSummarySection.discountTotal}}" userInput="-$100.00" stepKey="discountIsApply"/> </test> </tests> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCategoryRulesShouldApplyToGroupedProductWithInvisibleIndividualProductTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCategoryRulesShouldApplyToGroupedProductWithInvisibleIndividualProductTest.xml index 8900d838fb825..6a08724953395 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCategoryRulesShouldApplyToGroupedProductWithInvisibleIndividualProductTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCategoryRulesShouldApplyToGroupedProductWithInvisibleIndividualProductTest.xml @@ -90,7 +90,7 @@ <argument name="linkedProduct1Name" value="$createThirdSimpleProduct.name$"/> <argument name="linkedProduct2Name" value="$createFourthSimpleProduct.name$"/> </actionGroup> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="openTheCartWithSecondGroupedProduct"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="openTheCartWithSecondGroupedProduct"/> <!-- Discount amount is not applied --> <actionGroup ref="StorefrontCheckCartActionGroup" stepKey="checkDiscountIsNotApplied"> <argument name="subtotal" value="$700.00"/> @@ -105,7 +105,7 @@ <argument name="linkedProduct1Name" value="$createFirstSimpleProduct.name$"/> <argument name="linkedProduct2Name" value="$createSecondSimpleProduct.name$"/> </actionGroup> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="openTheCartWithFirstAndSecondGroupedProducts"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="openTheCartWithFirstAndSecondGroupedProducts"/> <!-- Discount amount is applied for product from first category only --> <actionGroup ref="StorefrontCheckCartTotalWithDiscountCategoryActionGroup" stepKey="checkDiscountIsApplied"> <argument name="subtotal" value="$1,000.00"/> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerPhysicalQuoteTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerPhysicalQuoteTest.xml index aa44593400a89..a329a3871b1a0 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerPhysicalQuoteTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerPhysicalQuoteTest.xml @@ -86,7 +86,7 @@ <argument name="productCount" value="1"/> </actionGroup> <!-- Step 3: Go to Shopping Cart --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToShoppingCartFromMinicart"/> <!-- Step 4: Open Estimate Shipping and Tax section --> <conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="expandEstimateShippingandTax" /> <seeOptionIsSelected selector="{{CheckoutCartSummarySection.country}}" userInput="{{US_Address_CA.country}}" stepKey="checkCustomerCountry" /> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerVirtualQuoteTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerVirtualQuoteTest.xml index ac090fd4fe9c0..c62fc59a52e68 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerVirtualQuoteTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerVirtualQuoteTest.xml @@ -58,7 +58,7 @@ <argument name="productCount" value="1"/> </actionGroup> <!-- Step 3: Go to Shopping Cart --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToShoppingCartFromMinicart"/> <!-- Step 4: Open Estimate Shipping and Tax section --> <conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="expandEstimateShippingandTax" /> <seeOptionIsSelected selector="{{CheckoutCartSummarySection.country}}" userInput="{{US_Address_NY.country}}" stepKey="checkCustomerCountry" /> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForGuestPhysicalQuoteTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForGuestPhysicalQuoteTest.xml index bce9d895e311e..06ef58f400598 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForGuestPhysicalQuoteTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForGuestPhysicalQuoteTest.xml @@ -81,7 +81,7 @@ <argument name="productCount" value="1"/> </actionGroup> <!-- Step 3: Go to Shopping Cart --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToShoppingCartFromMinicart"/> <!-- Step 4: Open Estimate Shipping and Tax section --> <conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="expandEstimateShippingandTax" /> <selectOption selector="{{CheckoutCartSummarySection.country}}" userInput="United States" stepKey="selectUSCountry"/> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForGuestVirtualQuoteTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForGuestVirtualQuoteTest.xml index 74233bbff4a64..4b911cd6db32f 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForGuestVirtualQuoteTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForGuestVirtualQuoteTest.xml @@ -53,7 +53,7 @@ <argument name="productCount" value="1"/> </actionGroup> <!-- Step 3: Go to Shopping Cart --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToShoppingCartFromMinicart"/> <!-- Step 4: Open Estimate Shipping and Tax section --> <conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="expandEstimateShippingandTax" /> <selectOption selector="{{CheckoutCartSummarySection.country}}" userInput="United States" stepKey="selectUSCountry"/> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCartTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCartTest.xml index 05ced7e61b3b7..12cdba459f2ec 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCartTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCartTest.xml @@ -103,7 +103,7 @@ <see stepKey="seeTotalExcl" selector="{{CheckoutPaymentSection.orderSummaryTotalExcluding}}" userInput="$128.00"/> <!-- Change the address --> - <actionGroup ref="changeSummaryQuoteAddress" stepKey="changeAddress"> + <actionGroup ref="ChangeSummaryQuoteAddressActionGroup" stepKey="changeAddress"> <argument name="taxCode" value="SimpleTaxSwiss"/> </actionGroup> @@ -113,7 +113,7 @@ <see stepKey="seeTotalExcl2" selector="{{CheckoutPaymentSection.orderSummaryTotalExcluding}}" userInput="$128.00"/> <!-- Change the address --> - <actionGroup ref="changeSummaryQuoteAddress" stepKey="changeAddress2"> + <actionGroup ref="ChangeSummaryQuoteAddressActionGroup" stepKey="changeAddress2"> <argument name="taxCode" value="SimpleTaxCA"/> </actionGroup> @@ -220,7 +220,7 @@ <see stepKey="seeTotalExcl" selector="{{CheckoutPaymentSection.orderSummaryTotalExcluding}}" userInput="$$virtualProduct1.price$$"/> <!-- Change the address --> - <actionGroup ref="changeSummaryQuoteAddress" stepKey="changeAddress"> + <actionGroup ref="ChangeSummaryQuoteAddressActionGroup" stepKey="changeAddress"> <argument name="taxCode" value="SimpleTaxSwiss"/> </actionGroup> @@ -230,7 +230,7 @@ <see stepKey="seeTotalExcl2" selector="{{CheckoutPaymentSection.orderSummaryTotalExcluding}}" userInput="$$$virtualProduct1.price$$"/> <!-- Change the address --> - <actionGroup ref="changeSummaryQuoteAddress" stepKey="changeAddress2"> + <actionGroup ref="ChangeSummaryQuoteAddressActionGroup" stepKey="changeAddress2"> <argument name="taxCode" value="SimpleTaxCA"/> </actionGroup> @@ -330,7 +330,7 @@ <see stepKey="seeTotalExcl3" selector="{{CheckoutPaymentSection.orderSummaryTotalExcluding}}" userInput="$128.00"/> <!-- Change the address --> - <actionGroup ref="changeSummaryQuoteAddress" stepKey="changeAddress"> + <actionGroup ref="ChangeSummaryQuoteAddressActionGroup" stepKey="changeAddress"> <argument name="taxCode" value="SimpleTaxSwiss"/> </actionGroup> @@ -340,7 +340,7 @@ <see stepKey="seeTotalExcl2" selector="{{CheckoutPaymentSection.orderSummaryTotalExcluding}}" userInput="$128.00"/> <!-- Change the address --> - <actionGroup ref="changeSummaryQuoteAddress" stepKey="changeAddress2"> + <actionGroup ref="ChangeSummaryQuoteAddressActionGroup" stepKey="changeAddress2"> <argument name="taxCode" value="SimpleTaxNY"/> </actionGroup> @@ -441,7 +441,7 @@ <see stepKey="seeTotalExcl3" selector="{{CheckoutPaymentSection.orderSummaryTotalExcluding}}" userInput="$$virtualProduct1.price$$"/> <!-- Change the address --> - <actionGroup ref="changeSummaryQuoteAddress" stepKey="changeAddress"> + <actionGroup ref="ChangeSummaryQuoteAddressActionGroup" stepKey="changeAddress"> <argument name="taxCode" value="SimpleTaxSwiss"/> </actionGroup> @@ -451,7 +451,7 @@ <see stepKey="seeTotalExcl2" selector="{{CheckoutPaymentSection.orderSummaryTotalExcluding}}" userInput="$$$virtualProduct1.price$$"/> <!-- Change the address --> - <actionGroup ref="changeSummaryQuoteAddress" stepKey="changeAddress2"> + <actionGroup ref="ChangeSummaryQuoteAddressActionGroup" stepKey="changeAddress2"> <argument name="taxCode" value="SimpleTaxNY"/> </actionGroup> From 54160b744adb3f03e9716f0dd813616bd922a015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Fri, 29 Nov 2019 12:45:14 +0100 Subject: [PATCH 0180/1143] REFACTOR: Extract Action Groups to separate files (according to MFTF best practices) --- ...omerSearchBundleProductsByKeywordsTest.xml | 36 +-- .../AdminCatalogSearchTermActionGroup.xml | 73 ----- .../AssertSearchTermNotInGridActionGroup.xml | 28 ++ ...ertSearchTermNotOnFrontendActionGroup.xml} | 18 +- .../AssertSearchTermOnFrontendActionGroup.xml | 26 ++ ...earchTermSaveSuccessMessageActionGroup.xml | 33 +++ ...rchTermSuccessDeleteMessageActionGroup.xml | 32 ++ ...reViewAdvancedCatalogSearchActionGroup.xml | 19 ++ ...ontAddToCartFromQuickSearchActionGroup.xml | 25 ++ ...dCatalogSearchByDescriptionActionGroup.xml | 23 ++ ...dCatalogSearchByProductNameActionGroup.xml | 23 ++ ...ByProductNameAndDescriptionActionGroup.xml | 25 ++ ...SearchByProductNameAndPriceActionGroup.xml | 27 ++ ...edCatalogSearchByProductSkuActionGroup.xml | 23 ++ ...logSearchByShortDescriptionActionGroup.xml | 23 ++ .../StorefrontCatalogSearchActionGroup.xml | 273 ------------------ ...ntCheckAdvancedSearchResultActionGroup.xml | 20 ++ .../StorefrontCheckQuickSearchActionGroup.xml | 26 ++ ...frontCheckQuickSearchStringActionGroup.xml | 26 ++ ...torefrontCheckSearchIsEmptyActionGroup.xml | 18 ++ ...torefrontOpenAdvancedSearchActionGroup.xml | 21 ++ ...tOpenProductFromQuickSearchActionGroup.xml | 26 ++ ...earchCheckProductNameInGridActionGroup.xml | 22 ++ ...chCheckProductNameNotInGridActionGroup.xml | 21 ++ ...chRelatedSearchTermsAppearsActionGroup.xml | 20 ++ ...QuickSearchSeeProductByNameActionGroup.xml | 17 ++ ...ntQuickSearchTooShortStringActionGroup.xml | 21 ++ ...tSelectSearchFilterCategoryActionGroup.xml | 23 ++ .../Test/AdminCreateSearchTermEntityTest.xml | 6 +- .../Mftf/Test/AdminDeleteSearchTermTest.xml | 10 +- .../Mftf/Test/SearchEntityResultsTest.xml | 30 +- ...ntElasticsearch6SearchInvalidValueTest.xml | 6 +- .../AdminMassDeleteSearchTermEntityTest.xml | 12 +- 33 files changed, 619 insertions(+), 413 deletions(-) delete mode 100644 app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/AdminCatalogSearchTermActionGroup.xml create mode 100644 app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/AssertSearchTermNotInGridActionGroup.xml rename app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/{StorefrontCatalogSearchTermActionGroup.xml => AssertSearchTermNotOnFrontendActionGroup.xml} (61%) create mode 100644 app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/AssertSearchTermOnFrontendActionGroup.xml create mode 100644 app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/AssertSearchTermSaveSuccessMessageActionGroup.xml create mode 100644 app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/AssertSearchTermSuccessDeleteMessageActionGroup.xml create mode 100644 app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/GoToStoreViewAdvancedCatalogSearchActionGroup.xml create mode 100644 app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontAddToCartFromQuickSearchActionGroup.xml create mode 100644 app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontAdvancedCatalogSearchByDescriptionActionGroup.xml create mode 100644 app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontAdvancedCatalogSearchByProductNameActionGroup.xml create mode 100644 app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontAdvancedCatalogSearchByProductNameAndDescriptionActionGroup.xml create mode 100644 app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontAdvancedCatalogSearchByProductNameAndPriceActionGroup.xml create mode 100644 app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontAdvancedCatalogSearchByProductSkuActionGroup.xml create mode 100644 app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontAdvancedCatalogSearchByShortDescriptionActionGroup.xml delete mode 100644 app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontCatalogSearchActionGroup.xml create mode 100644 app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontCheckAdvancedSearchResultActionGroup.xml create mode 100644 app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontCheckQuickSearchActionGroup.xml create mode 100644 app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontCheckQuickSearchStringActionGroup.xml create mode 100644 app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontCheckSearchIsEmptyActionGroup.xml create mode 100644 app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontOpenAdvancedSearchActionGroup.xml create mode 100644 app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontOpenProductFromQuickSearchActionGroup.xml create mode 100644 app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontQuickSearchCheckProductNameInGridActionGroup.xml create mode 100644 app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontQuickSearchCheckProductNameNotInGridActionGroup.xml create mode 100644 app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontQuickSearchRelatedSearchTermsAppearsActionGroup.xml create mode 100644 app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontQuickSearchSeeProductByNameActionGroup.xml create mode 100644 app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontQuickSearchTooShortStringActionGroup.xml create mode 100644 app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontSelectSearchFilterCategoryActionGroup.xml diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontCustomerSearchBundleProductsByKeywordsTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontCustomerSearchBundleProductsByKeywordsTest.xml index 9ea0480e540ba..ae9d01a50f46e 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontCustomerSearchBundleProductsByKeywordsTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontCustomerSearchBundleProductsByKeywordsTest.xml @@ -53,84 +53,84 @@ <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="quickSearchDynamic"> <argument name="phrase" value="Dynamic"/> </actionGroup> - <actionGroup ref="StorefrontQuickSearchSeeProductByName" stepKey="assertDynamicBundleInSearchResultByDynamic"> + <actionGroup ref="StorefrontQuickSearchSeeProductByNameActionGroup" stepKey="assertDynamicBundleInSearchResultByDynamic"> <argument name="productName" value="$createDynamicBundle.name$"/> </actionGroup> - <actionGroup ref="StorefrontQuickSearchCheckProductNameNotInGrid" stepKey="assertFixedBundleInSearchResultByDynamic"> + <actionGroup ref="StorefrontQuickSearchCheckProductNameNotInGridActionGroup" stepKey="assertFixedBundleInSearchResultByDynamic"> <argument name="productName" value="$createFixedBundle.name$"/> </actionGroup> <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="quickSearchByDescription"> <argument name="phrase" value="Dynamicscription"/> </actionGroup> - <actionGroup ref="StorefrontQuickSearchSeeProductByName" stepKey="assertDynamicBundleInSearchResultByDescription"> + <actionGroup ref="StorefrontQuickSearchSeeProductByNameActionGroup" stepKey="assertDynamicBundleInSearchResultByDescription"> <argument name="productName" value="$createDynamicBundle.name$"/> </actionGroup> - <actionGroup ref="StorefrontQuickSearchCheckProductNameNotInGrid" stepKey="dontSeeFixedBundleInSearchResultByDescription"> + <actionGroup ref="StorefrontQuickSearchCheckProductNameNotInGridActionGroup" stepKey="dontSeeFixedBundleInSearchResultByDescription"> <argument name="productName" value="$createFixedBundle.name$"/> </actionGroup> <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="quickSearchShortDescription"> <argument name="phrase" value="Dynamictest"/> </actionGroup> - <actionGroup ref="StorefrontQuickSearchSeeProductByName" stepKey="assertDynamicBundleInSearchResultByShortDescription"> + <actionGroup ref="StorefrontQuickSearchSeeProductByNameActionGroup" stepKey="assertDynamicBundleInSearchResultByShortDescription"> <argument name="productName" value="$createDynamicBundle.name$"/> </actionGroup> - <actionGroup ref="StorefrontQuickSearchCheckProductNameNotInGrid" stepKey="dontSeeFixedBundleInSearchResultByShortDescription"> + <actionGroup ref="StorefrontQuickSearchCheckProductNameNotInGridActionGroup" stepKey="dontSeeFixedBundleInSearchResultByShortDescription"> <argument name="productName" value="$createFixedBundle.name$"/> </actionGroup> <!-- 3. Fill quick search bar with test values mutual for both products and click search --> <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="quickSearchTest123"> <argument name="phrase" value="Test 123"/> </actionGroup> - <actionGroup ref="StorefrontQuickSearchSeeProductByName" stepKey="seeDynamicBundleByTest123"> + <actionGroup ref="StorefrontQuickSearchSeeProductByNameActionGroup" stepKey="seeDynamicBundleByTest123"> <argument name="productName" value="$createDynamicBundle.name$"/> </actionGroup> - <actionGroup ref="StorefrontQuickSearchSeeProductByName" stepKey="seeFixedBundleByTest123"> + <actionGroup ref="StorefrontQuickSearchSeeProductByNameActionGroup" stepKey="seeFixedBundleByTest123"> <argument name="productName" value="$createFixedBundle.name$"/> </actionGroup> <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="quickSearchTesting321"> <argument name="phrase" value="Testing 321"/> </actionGroup> - <actionGroup ref="StorefrontQuickSearchSeeProductByName" stepKey="seeDynamicBundleByTesting321"> + <actionGroup ref="StorefrontQuickSearchSeeProductByNameActionGroup" stepKey="seeDynamicBundleByTesting321"> <argument name="productName" value="$createDynamicBundle.name$"/> </actionGroup> - <actionGroup ref="StorefrontQuickSearchSeeProductByName" stepKey="seeFixedBundleByTesting321"> + <actionGroup ref="StorefrontQuickSearchSeeProductByNameActionGroup" stepKey="seeFixedBundleByTesting321"> <argument name="productName" value="$createFixedBundle.name$"/> </actionGroup> <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="quickSearchShort555"> <argument name="phrase" value="Short 555"/> </actionGroup> - <actionGroup ref="StorefrontQuickSearchSeeProductByName" stepKey="seeDynamicBundleByShort555"> + <actionGroup ref="StorefrontQuickSearchSeeProductByNameActionGroup" stepKey="seeDynamicBundleByShort555"> <argument name="productName" value="$createDynamicBundle.name$"/> </actionGroup> - <actionGroup ref="StorefrontQuickSearchSeeProductByName" stepKey="seeFixedBundleByShort555"> + <actionGroup ref="StorefrontQuickSearchSeeProductByNameActionGroup" stepKey="seeFixedBundleByShort555"> <argument name="productName" value="$createFixedBundle.name$"/> </actionGroup> <!-- 4. Fill quick search bar with test values unique for fixed bundle product and click search --> <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="quickSearchByFixed"> <argument name="phrase" value="Fixed"/> </actionGroup> - <actionGroup ref="StorefrontQuickSearchSeeProductByName" stepKey="seeFixedBundleByFixed"> + <actionGroup ref="StorefrontQuickSearchSeeProductByNameActionGroup" stepKey="seeFixedBundleByFixed"> <argument name="productName" value="$createFixedBundle.name$"/> </actionGroup> - <actionGroup ref="StorefrontQuickSearchCheckProductNameNotInGrid" stepKey="dontSeeDynamicBundleByFixed"> + <actionGroup ref="StorefrontQuickSearchCheckProductNameNotInGridActionGroup" stepKey="dontSeeDynamicBundleByFixed"> <argument name="productName" value="$createDynamicBundle.name$"/> </actionGroup> <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="quickSearchByDescriptionForFixed"> <argument name="phrase" value="Fixedscription"/> </actionGroup> - <actionGroup ref="StorefrontQuickSearchSeeProductByName" stepKey="seeFixedBundleByDescriptionForFixed"> + <actionGroup ref="StorefrontQuickSearchSeeProductByNameActionGroup" stepKey="seeFixedBundleByDescriptionForFixed"> <argument name="productName" value="$createFixedBundle.name$"/> </actionGroup> - <actionGroup ref="StorefrontQuickSearchCheckProductNameNotInGrid" stepKey="dontSeeDynamicProductByDescriptionForFixed"> + <actionGroup ref="StorefrontQuickSearchCheckProductNameNotInGridActionGroup" stepKey="dontSeeDynamicProductByDescriptionForFixed"> <argument name="productName" value="$createDynamicBundle.name$"/> </actionGroup> <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="quickSearchByShortDescriptionForFixed"> <argument name="phrase" value="Fixedtest"/> </actionGroup> - <actionGroup ref="StorefrontQuickSearchSeeProductByName" stepKey="seeFixedBundleByShortDescriptionForFixed"> + <actionGroup ref="StorefrontQuickSearchSeeProductByNameActionGroup" stepKey="seeFixedBundleByShortDescriptionForFixed"> <argument name="productName" value="$createFixedBundle.name$"/> </actionGroup> - <actionGroup ref="StorefrontQuickSearchCheckProductNameNotInGrid" stepKey="dontSeeDynamicBundleByShortDescriptionForFixed"> + <actionGroup ref="StorefrontQuickSearchCheckProductNameNotInGridActionGroup" stepKey="dontSeeDynamicBundleByShortDescriptionForFixed"> <argument name="productName" value="$createDynamicBundle.name$"/> </actionGroup> </test> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/AdminCatalogSearchTermActionGroup.xml b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/AdminCatalogSearchTermActionGroup.xml deleted file mode 100644 index 932c45c0d5aeb..0000000000000 --- a/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/AdminCatalogSearchTermActionGroup.xml +++ /dev/null @@ -1,73 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AssertSearchTermSaveSuccessMessage"> - <annotations> - <description>Goes to the Catalog Search Term grid page. Adds the provided Search Term. Validates that the Success Message is present and correct.</description> - </annotations> - <arguments> - <argument name="searchQuery" type="string"/> - <argument name="storeValue" type="string"/> - <argument name="redirectUrl" type="string"/> - <argument name="displayInSuggestedTerm" type="string"/> - </arguments> - - <amOnPage url="{{AdminCatalogSearchTermIndexPage.url}}" stepKey="openAdminCatalogSearchTermIndexPage"/> - <waitForPageLoad stepKey="waitForAdminCatalogSearchTermIndexPageLoad"/> - <click selector="{{AdminCatalogSearchTermIndexSection.addNewSearchTermButton}}" stepKey="clickAddNewSearchTermButton"/> - <waitForPageLoad stepKey="waitForAdminCatalogSearchTermNewPageLoad"/> - <fillField selector="{{AdminCatalogSearchTermNewSection.searchQuery}}" userInput="{{searchQuery}}" stepKey="fillSearchQueryTextBox"/> - <selectOption selector="{{AdminCatalogSearchTermNewSection.store}}" userInput="{{storeValue}}" stepKey="selectStoreValue"/> - <fillField selector="{{AdminCatalogSearchTermNewSection.redirectUrl}}" userInput="{{redirectUrl}}" stepKey="fillRedirectUrl"/> - <selectOption selector="{{AdminCatalogSearchTermNewSection.displayInSuggestedTerm}}" userInput="{{displayInSuggestedTerm}}" stepKey="selectDisplayInSuggestedTerm"/> - <click selector="{{AdminCatalogSearchTermNewSection.saveSearchButton}}" stepKey="clickSaveSearchButton"/> - <see selector="{{AdminCatalogSearchTermMessagesSection.successMessage}}" userInput="You saved the search term." stepKey="seeSaveSuccessMessage"/> - </actionGroup> - - <actionGroup name="AssertSearchTermSuccessDeleteMessage"> - <annotations> - <description>Goes to the Catalog Search Term grid page. Deletes the provided Search Term. Validates that the Success Message is present and correct.</description> - </annotations> - <arguments> - <argument name="searchQuery" type="string"/> - </arguments> - - <amOnPage url="{{AdminCatalogSearchTermIndexPage.url}}" stepKey="openCatalogSearchIndexPage"/> - <waitForPageLoad stepKey="waitForAdminCatalogSearchTermIndexPageLoad"/> - <click selector="{{AdminCatalogSearchTermIndexSection.resetFilterButton}}" stepKey="clickOnResetButton"/> - <waitForPageLoad stepKey="waitForPageToLoad"/> - <fillField selector="{{AdminCatalogSearchTermIndexSection.searchQuery}}" userInput="{{searchQuery}}" stepKey="fillSearchQuery"/> - <click selector="{{AdminCatalogSearchTermIndexSection.searchButton}}" stepKey="clickSearchButton"/> - <waitForPageLoad stepKey="waitForSearchResultLoad"/> - <click selector="{{AdminCatalogSearchTermIndexSection.nthRow('1')}}" stepKey="checkFirstRow"/> - <selectOption selector="{{AdminCatalogSearchTermIndexSection.massActions}}" userInput="delete" stepKey="selectDeleteOption"/> - <click selector="{{AdminCatalogSearchTermIndexSection.submit}}" stepKey="clickSubmitButton"/> - <click selector="{{AdminCatalogSearchTermIndexSection.okButton}}" stepKey="clickOkButton"/> - <see selector="{{AdminCatalogSearchTermMessagesSection.successMessage}}" userInput="Total of 1 record(s) were deleted." stepKey="seeSuccessMessage"/> - </actionGroup> - - <actionGroup name="AssertSearchTermNotInGrid"> - <annotations> - <description>Goes to the Catalog Search Term grid page. Searches for the provided Search Term. Validates that it is NOT present in the grid.</description> - </annotations> - <arguments> - <argument name="searchQuery" type="string"/> - </arguments> - - <amOnPage url="{{AdminCatalogSearchTermIndexPage.url}}" stepKey="openCatalogSearchIndexPage"/> - <waitForPageLoad stepKey="waitForAdminCatalogSearchTermIndexPageLoad"/> - <click selector="{{AdminCatalogSearchTermIndexSection.resetFilterButton}}" stepKey="clickOnResetButton"/> - <waitForPageLoad stepKey="waitForPageToLoad"/> - <fillField selector="{{AdminCatalogSearchTermIndexSection.searchQuery}}" userInput="{{searchQuery}}" stepKey="fillSearchQuery"/> - <click selector="{{AdminCatalogSearchTermIndexSection.searchButton}}" stepKey="clickSearchButton"/> - <waitForPageLoad stepKey="waitForSearchResultToLoad"/> - <see selector="{{AdminCatalogSearchTermIndexSection.emptyRecords}}" userInput="We couldn't find any records." stepKey="seeEmptyRecordMessage"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/AssertSearchTermNotInGridActionGroup.xml b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/AssertSearchTermNotInGridActionGroup.xml new file mode 100644 index 0000000000000..6b8b94931b3f9 --- /dev/null +++ b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/AssertSearchTermNotInGridActionGroup.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertSearchTermNotInGridActionGroup"> + <annotations> + <description>Goes to the Catalog Search Term grid page. Searches for the provided Search Term. Validates that it is NOT present in the grid.</description> + </annotations> + <arguments> + <argument name="searchQuery" type="string"/> + </arguments> + + <amOnPage url="{{AdminCatalogSearchTermIndexPage.url}}" stepKey="openCatalogSearchIndexPage"/> + <waitForPageLoad stepKey="waitForAdminCatalogSearchTermIndexPageLoad"/> + <click selector="{{AdminCatalogSearchTermIndexSection.resetFilterButton}}" stepKey="clickOnResetButton"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + <fillField selector="{{AdminCatalogSearchTermIndexSection.searchQuery}}" userInput="{{searchQuery}}" stepKey="fillSearchQuery"/> + <click selector="{{AdminCatalogSearchTermIndexSection.searchButton}}" stepKey="clickSearchButton"/> + <waitForPageLoad stepKey="waitForSearchResultToLoad"/> + <see selector="{{AdminCatalogSearchTermIndexSection.emptyRecords}}" userInput="We couldn't find any records." stepKey="seeEmptyRecordMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontCatalogSearchTermActionGroup.xml b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/AssertSearchTermNotOnFrontendActionGroup.xml similarity index 61% rename from app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontCatalogSearchTermActionGroup.xml rename to app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/AssertSearchTermNotOnFrontendActionGroup.xml index e1f0396b68c15..67e60a1603a9b 100644 --- a/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontCatalogSearchTermActionGroup.xml +++ b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/AssertSearchTermNotOnFrontendActionGroup.xml @@ -9,7 +9,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <!--Verify AssertSearchTermNotOnFrontend--> - <actionGroup name="AssertSearchTermNotOnFrontend"> + <actionGroup name="AssertSearchTermNotOnFrontendActionGroup"> <annotations> <description>Goes to the Storefront. Fills the Search field with the provided Search Query. Clicks on Search. Validates that there are no results.</description> </annotations> @@ -26,20 +26,4 @@ <waitForPageLoad stepKey="waitForSearch"/> <see selector="{{StorefrontMessagesSection.noticeMessage}}" userInput="Your search returned no results." stepKey="seeAssertSearchTermNotOnFrontendNoticeMessage"/> </actionGroup> - - <actionGroup name="AssertSearchTermOnFrontend"> - <annotations> - <description>Fills the Storefront Search field with the provided Search Query. Clicks on Search. Validates that the URL is correct.</description> - </annotations> - <arguments> - <argument name="searchQuery" type="string"/> - <argument name="redirectUrl" type="string"/> - </arguments> - - <fillField selector="{{StorefrontQuickSearchResultsSection.searchTextBox}}" userInput="{{searchQuery}}" stepKey="fillSearchQuery"/> - <waitForPageLoad stepKey="waitForFillField"/> - <click selector="{{StorefrontQuickSearchResultsSection.searchTextBoxButton}}" stepKey="clickSearchTextBoxButton"/> - <waitForPageLoad stepKey="waitForSearch"/> - <seeInCurrentUrl url="{{redirectUrl}}" stepKey="checkUrl"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/AssertSearchTermOnFrontendActionGroup.xml b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/AssertSearchTermOnFrontendActionGroup.xml new file mode 100644 index 0000000000000..cb2ce92531af8 --- /dev/null +++ b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/AssertSearchTermOnFrontendActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertSearchTermOnFrontendActionGroup"> + <annotations> + <description>Fills the Storefront Search field with the provided Search Query. Clicks on Search. Validates that the URL is correct.</description> + </annotations> + <arguments> + <argument name="searchQuery" type="string"/> + <argument name="redirectUrl" type="string"/> + </arguments> + + <fillField selector="{{StorefrontQuickSearchResultsSection.searchTextBox}}" userInput="{{searchQuery}}" stepKey="fillSearchQuery"/> + <waitForPageLoad stepKey="waitForFillField"/> + <click selector="{{StorefrontQuickSearchResultsSection.searchTextBoxButton}}" stepKey="clickSearchTextBoxButton"/> + <waitForPageLoad stepKey="waitForSearch"/> + <seeInCurrentUrl url="{{redirectUrl}}" stepKey="checkUrl"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/AssertSearchTermSaveSuccessMessageActionGroup.xml b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/AssertSearchTermSaveSuccessMessageActionGroup.xml new file mode 100644 index 0000000000000..4291bbff88aae --- /dev/null +++ b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/AssertSearchTermSaveSuccessMessageActionGroup.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertSearchTermSaveSuccessMessageActionGroup"> + <annotations> + <description>Goes to the Catalog Search Term grid page. Adds the provided Search Term. Validates that the Success Message is present and correct.</description> + </annotations> + <arguments> + <argument name="searchQuery" type="string"/> + <argument name="storeValue" type="string"/> + <argument name="redirectUrl" type="string"/> + <argument name="displayInSuggestedTerm" type="string"/> + </arguments> + + <amOnPage url="{{AdminCatalogSearchTermIndexPage.url}}" stepKey="openAdminCatalogSearchTermIndexPage"/> + <waitForPageLoad stepKey="waitForAdminCatalogSearchTermIndexPageLoad"/> + <click selector="{{AdminCatalogSearchTermIndexSection.addNewSearchTermButton}}" stepKey="clickAddNewSearchTermButton"/> + <waitForPageLoad stepKey="waitForAdminCatalogSearchTermNewPageLoad"/> + <fillField selector="{{AdminCatalogSearchTermNewSection.searchQuery}}" userInput="{{searchQuery}}" stepKey="fillSearchQueryTextBox"/> + <selectOption selector="{{AdminCatalogSearchTermNewSection.store}}" userInput="{{storeValue}}" stepKey="selectStoreValue"/> + <fillField selector="{{AdminCatalogSearchTermNewSection.redirectUrl}}" userInput="{{redirectUrl}}" stepKey="fillRedirectUrl"/> + <selectOption selector="{{AdminCatalogSearchTermNewSection.displayInSuggestedTerm}}" userInput="{{displayInSuggestedTerm}}" stepKey="selectDisplayInSuggestedTerm"/> + <click selector="{{AdminCatalogSearchTermNewSection.saveSearchButton}}" stepKey="clickSaveSearchButton"/> + <see selector="{{AdminCatalogSearchTermMessagesSection.successMessage}}" userInput="You saved the search term." stepKey="seeSaveSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/AssertSearchTermSuccessDeleteMessageActionGroup.xml b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/AssertSearchTermSuccessDeleteMessageActionGroup.xml new file mode 100644 index 0000000000000..3d32b3c292305 --- /dev/null +++ b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/AssertSearchTermSuccessDeleteMessageActionGroup.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertSearchTermSuccessDeleteMessageActionGroup"> + <annotations> + <description>Goes to the Catalog Search Term grid page. Deletes the provided Search Term. Validates that the Success Message is present and correct.</description> + </annotations> + <arguments> + <argument name="searchQuery" type="string"/> + </arguments> + + <amOnPage url="{{AdminCatalogSearchTermIndexPage.url}}" stepKey="openCatalogSearchIndexPage"/> + <waitForPageLoad stepKey="waitForAdminCatalogSearchTermIndexPageLoad"/> + <click selector="{{AdminCatalogSearchTermIndexSection.resetFilterButton}}" stepKey="clickOnResetButton"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + <fillField selector="{{AdminCatalogSearchTermIndexSection.searchQuery}}" userInput="{{searchQuery}}" stepKey="fillSearchQuery"/> + <click selector="{{AdminCatalogSearchTermIndexSection.searchButton}}" stepKey="clickSearchButton"/> + <waitForPageLoad stepKey="waitForSearchResultLoad"/> + <click selector="{{AdminCatalogSearchTermIndexSection.nthRow('1')}}" stepKey="checkFirstRow"/> + <selectOption selector="{{AdminCatalogSearchTermIndexSection.massActions}}" userInput="delete" stepKey="selectDeleteOption"/> + <click selector="{{AdminCatalogSearchTermIndexSection.submit}}" stepKey="clickSubmitButton"/> + <click selector="{{AdminCatalogSearchTermIndexSection.okButton}}" stepKey="clickOkButton"/> + <see selector="{{AdminCatalogSearchTermMessagesSection.successMessage}}" userInput="Total of 1 record(s) were deleted." stepKey="seeSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/GoToStoreViewAdvancedCatalogSearchActionGroup.xml b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/GoToStoreViewAdvancedCatalogSearchActionGroup.xml new file mode 100644 index 0000000000000..65ba0719af496 --- /dev/null +++ b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/GoToStoreViewAdvancedCatalogSearchActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="GoToStoreViewAdvancedCatalogSearchActionGroup"> + <annotations> + <description>Goes to the Storefront 'Advanced Search' page.</description> + </annotations> + + <amOnPage url="{{StorefrontCatalogSearchAdvancedFormPage.url}}" stepKey="GoToStoreViewAdvancedCatalogSearchActionGroup"/> + <waitForPageLoad time="90" stepKey="waitForPageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontAddToCartFromQuickSearchActionGroup.xml b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontAddToCartFromQuickSearchActionGroup.xml new file mode 100644 index 0000000000000..1ee9003a6bdb6 --- /dev/null +++ b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontAddToCartFromQuickSearchActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontAddToCartFromQuickSearchActionGroup"> + <annotations> + <description>Adds the provided Product Name to the Shopping Cart from the Storefront Quick Search Results page. Validates that the Success Message is present and correct.</description> + </annotations> + <arguments> + <argument name="productName" type="string"/> + </arguments> + + <scrollTo selector="{{StorefrontQuickSearchResultsSection.productByName(productName)}}" stepKey="scrollToProduct"/> + <moveMouseOver stepKey="hoverOverProduct" selector="{{StorefrontQuickSearchResultsSection.productByName(productName)}}"/> + <click selector="{{StorefrontQuickSearchResultsSection.productByName(productName)}} {{StorefrontQuickSearchResultsSection.addToCartBtn}}" stepKey="addToCart"/> + <waitForElementVisible selector="{{StorefrontQuickSearchResultsSection.messageSection}}" time="30" stepKey="waitForProductAdded"/> + <see selector="{{StorefrontQuickSearchResultsSection.messageSection}}" userInput="You added {{productName}} to your shopping cart." stepKey="seeAddedToCartMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontAdvancedCatalogSearchByDescriptionActionGroup.xml b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontAdvancedCatalogSearchByDescriptionActionGroup.xml new file mode 100644 index 0000000000000..d342909d54723 --- /dev/null +++ b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontAdvancedCatalogSearchByDescriptionActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontAdvancedCatalogSearchByDescriptionActionGroup"> + <annotations> + <description>Fills the Product Description field on the Storefront 'Advanced Search' page. Clicks on the Submit button.</description> + </annotations> + <arguments> + <argument name="description" type="string"/> + </arguments> + + <fillField selector="{{StorefrontCatalogSearchAdvancedFormSection.Description}}" userInput="{{description}}" stepKey="fill"/> + <click selector="{{StorefrontCatalogSearchAdvancedFormSection.SubmitButton}}" stepKey="clickSubmit"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontAdvancedCatalogSearchByProductNameActionGroup.xml b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontAdvancedCatalogSearchByProductNameActionGroup.xml new file mode 100644 index 0000000000000..491817dc6391c --- /dev/null +++ b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontAdvancedCatalogSearchByProductNameActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontAdvancedCatalogSearchByProductNameActionGroup"> + <annotations> + <description>Fills the Product Name field on the Storefront 'Advanced Search' page. Clicks on the Submit button.</description> + </annotations> + <arguments> + <argument name="name" type="string"/> + </arguments> + + <fillField selector="{{StorefrontCatalogSearchAdvancedFormSection.ProductName}}" userInput="{{name}}" stepKey="fill"/> + <click selector="{{StorefrontCatalogSearchAdvancedFormSection.SubmitButton}}" stepKey="clickSubmit"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontAdvancedCatalogSearchByProductNameAndDescriptionActionGroup.xml b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontAdvancedCatalogSearchByProductNameAndDescriptionActionGroup.xml new file mode 100644 index 0000000000000..377098dfc372a --- /dev/null +++ b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontAdvancedCatalogSearchByProductNameAndDescriptionActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontAdvancedCatalogSearchByProductNameAndDescriptionActionGroup"> + <annotations> + <description>Fills the Product Name and Description fields on the Storefront 'Advanced Search' page. Clicks on the Submit button.</description> + </annotations> + <arguments> + <argument name="name" type="string"/> + <argument name="description" type="string"/> + </arguments> + + <fillField selector="{{StorefrontCatalogSearchAdvancedFormSection.ProductName}}" userInput="{{name}}" stepKey="fillName"/> + <fillField selector="{{StorefrontCatalogSearchAdvancedFormSection.Description}}" userInput="{{description}}" stepKey="fillDescription"/> + <click selector="{{StorefrontCatalogSearchAdvancedFormSection.SubmitButton}}" stepKey="clickSubmit"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontAdvancedCatalogSearchByProductNameAndPriceActionGroup.xml b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontAdvancedCatalogSearchByProductNameAndPriceActionGroup.xml new file mode 100644 index 0000000000000..89e454db95615 --- /dev/null +++ b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontAdvancedCatalogSearchByProductNameAndPriceActionGroup.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontAdvancedCatalogSearchByProductNameAndPriceActionGroup"> + <annotations> + <description>Fills the Product Name, Price From and Price To fields on the Storefront 'Advanced Search' page. Clicks on the Submit button.</description> + </annotations> + <arguments> + <argument name="name" type="string"/> + <argument name="priceFrom" type="string"/> + <argument name="priceTo" type="string"/> + </arguments> + + <fillField selector="{{StorefrontCatalogSearchAdvancedFormSection.ProductName}}" userInput="{{name}}" stepKey="fillName"/> + <fillField selector="{{StorefrontCatalogSearchAdvancedFormSection.PriceFrom}}" userInput="{{priceFrom}}" stepKey="fillPriceFrom"/> + <fillField selector="{{StorefrontCatalogSearchAdvancedFormSection.PriceTo}}" userInput="{{priceTo}}" stepKey="fillPriceTo"/> + <click selector="{{StorefrontCatalogSearchAdvancedFormSection.SubmitButton}}" stepKey="clickSubmit"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontAdvancedCatalogSearchByProductSkuActionGroup.xml b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontAdvancedCatalogSearchByProductSkuActionGroup.xml new file mode 100644 index 0000000000000..328b57e8ca080 --- /dev/null +++ b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontAdvancedCatalogSearchByProductSkuActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontAdvancedCatalogSearchByProductSkuActionGroup"> + <annotations> + <description>Fills the Product SKU field on the Storefront 'Advanced Search' page. Clicks on the Submit button.</description> + </annotations> + <arguments> + <argument name="sku" type="string"/> + </arguments> + + <fillField selector="{{StorefrontCatalogSearchAdvancedFormSection.SKU}}" userInput="{{sku}}" stepKey="fill"/> + <click selector="{{StorefrontCatalogSearchAdvancedFormSection.SubmitButton}}" stepKey="clickSubmit"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontAdvancedCatalogSearchByShortDescriptionActionGroup.xml b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontAdvancedCatalogSearchByShortDescriptionActionGroup.xml new file mode 100644 index 0000000000000..28b2be68018f4 --- /dev/null +++ b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontAdvancedCatalogSearchByShortDescriptionActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontAdvancedCatalogSearchByShortDescriptionActionGroup"> + <annotations> + <description>Fills the Product Short Description field on the Storefront 'Advanced Search' page. Clicks on the Submit button.</description> + </annotations> + <arguments> + <argument name="shortDescription" type="string"/> + </arguments> + + <fillField selector="{{StorefrontCatalogSearchAdvancedFormSection.ShortDescription}}" userInput="{{shortDescription}}" stepKey="fill"/> + <click selector="{{StorefrontCatalogSearchAdvancedFormSection.SubmitButton}}" stepKey="clickSubmit"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontCatalogSearchActionGroup.xml b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontCatalogSearchActionGroup.xml deleted file mode 100644 index 2022f809139ec..0000000000000 --- a/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontCatalogSearchActionGroup.xml +++ /dev/null @@ -1,273 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <!-- Quick search the phrase and check if the result page contains correct information --> - <actionGroup name="StorefrontCheckQuickSearchActionGroup"> - <annotations> - <description>Submits Form POST for the Storefront Search feature. Validates that the URL is correct. Validates that the Title is present and correct.</description> - </annotations> - <arguments> - <argument name="phrase"/> - </arguments> - - <submitForm selector="{{StorefrontQuickSearchSection.searchMiniForm}}" parameterArray="['q' => {{phrase}}]" stepKey="fillQuickSearch"/> - <seeInCurrentUrl url="{{StorefrontCatalogSearchPage.url}}" stepKey="checkUrl"/> - <dontSeeInCurrentUrl url="form_key=" stepKey="checkUrlFormKey"/> - <seeInTitle userInput="Search results for: '{{phrase}}'" stepKey="assertQuickSearchTitle"/> - <see userInput="Search results for: '{{phrase}}'" selector="{{StorefrontCatalogSearchMainSection.SearchTitle}}" stepKey="assertQuickSearchName"/> - </actionGroup> - - <!-- Quick search the phrase and check if the result page contains correct information, usable with type="string" --> - <actionGroup name="StorefrontCheckQuickSearchStringActionGroup"> - <annotations> - <description>Fill the Storefront Search field. Submits the Form. Validates that the provided Search Phrase is present and correct.</description> - </annotations> - <arguments> - <argument name="phrase" type="string"/> - </arguments> - - <fillField stepKey="fillInput" selector="{{StorefrontQuickSearchResultsSection.searchTextBox}}" userInput="{{phrase}}"/> - <submitForm selector="{{StorefrontQuickSearchResultsSection.searchTextBox}}" parameterArray="[]" stepKey="submitQuickSearch"/> - <seeInCurrentUrl url="{{StorefrontCatalogSearchPage.url}}" stepKey="checkUrl"/> - <dontSeeInCurrentUrl url="form_key=" stepKey="checkUrlFormKey"/> - <seeInTitle userInput="Search results for: '{{phrase}}'" stepKey="assertQuickSearchTitle"/> - <see userInput="Search results for: '{{phrase}}'" selector="{{StorefrontCatalogSearchMainSection.SearchTitle}}" stepKey="assertQuickSearchName"/> - </actionGroup> - - <actionGroup name="StorefrontQuickSearchTooShortStringActionGroup" extends="StorefrontCheckQuickSearchStringActionGroup"> - <annotations> - <description>Fill the Storefront Search field. Submits the Form. Validates that 'Minimum Search query length' warning appears.</description> - </annotations> - <arguments> - <argument name="minQueryLength" type="string"/> - </arguments> - - <see selector="{{StorefrontQuickSearchResultsSection.messageSection}}" userInput="Minimum Search query length is {{minQueryLength}}" stepKey="assertQuickSearchNeedThreeOrMoreChars"/> - </actionGroup> - - <actionGroup name="StorefrontQuickSearchRelatedSearchTermsAppearsActionGroup"> - <arguments> - <argument name="term" type="string"/> - </arguments> - - <waitForElementVisible selector="{{StorefrontCatalogSearchMainSection.relatedSearchTermsTitle}}" stepKey="waitMessageAppears"/> - <see selector="{{StorefrontCatalogSearchMainSection.relatedSearchTermsTitle}}" userInput="Related search terms" stepKey="checkRelatedTermsTitle"/> - <see selector="{{StorefrontCatalogSearchMainSection.relatedSearchTerm}}" userInput="{{term}}" stepKey="checkRelatedTermExists"/> - </actionGroup> - - <!-- Opens product from QuickSearch and performs assertions--> - <actionGroup name="StorefrontOpenProductFromQuickSearch"> - <annotations> - <description>Clicks on the provided Product Name from the Storefront Quick Search Results page.</description> - </annotations> - <arguments> - <argument name="productName" type="string"/> - <argument name="productUrlKey" type="string"/> - </arguments> - - <scrollTo selector="{{StorefrontQuickSearchResultsSection.productByName(productName)}}" stepKey="scrollToProduct"/> - <click stepKey="openProduct" selector="{{StorefrontQuickSearchResultsSection.productByName(productName)}}"/> - <waitForPageLoad stepKey="waitForProductLoad"/> - <seeInCurrentUrl url="{{productUrlKey}}" stepKey="checkUrl"/> - <see stepKey="checkName" selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{productName}}"/> - </actionGroup> - - <!-- Adds product from Quick Search page and perform assertions--> - <actionGroup name="StorefrontAddToCartFromQuickSearch"> - <annotations> - <description>Adds the provided Product Name to the Shopping Cart from the Storefront Quick Search Results page. Validates that the Success Message is present and correct.</description> - </annotations> - <arguments> - <argument name="productName" type="string"/> - </arguments> - - <scrollTo selector="{{StorefrontQuickSearchResultsSection.productByName(productName)}}" stepKey="scrollToProduct"/> - <moveMouseOver stepKey="hoverOverProduct" selector="{{StorefrontQuickSearchResultsSection.productByName(productName)}}"/> - <click selector="{{StorefrontQuickSearchResultsSection.productByName(productName)}} {{StorefrontQuickSearchResultsSection.addToCartBtn}}" stepKey="addToCart"/> - <waitForElementVisible selector="{{StorefrontQuickSearchResultsSection.messageSection}}" time="30" stepKey="waitForProductAdded"/> - <see selector="{{StorefrontQuickSearchResultsSection.messageSection}}" userInput="You added {{productName}} to your shopping cart." stepKey="seeAddedToCartMessage"/> - </actionGroup> - - <actionGroup name="StorefrontQuickSearchCheckProductNameInGrid"> - <annotations> - <description>Validates that the provided Product Name appears at the correct index on the Storefront Quick Search page.</description> - </annotations> - <arguments> - <argument name="productName" type="string"/> - <argument name="index" type="string"/> - </arguments> - - <see selector="{{StorefrontQuickSearchResultsSection.productByIndex(index)}}" userInput="{{productName}}" stepKey="seeProductName"/> - </actionGroup> - - <actionGroup name="StorefrontQuickSearchSeeProductByName"> - <arguments> - <argument name="productName" type="string"/> - </arguments> - <see selector="{{StorefrontQuickSearchResultsSection.productByName(productName)}}" userInput="{{productName}}" stepKey="seeProductName"/> - </actionGroup> - - <actionGroup name="StorefrontQuickSearchCheckProductNameNotInGrid"> - <annotations> - <description>Validates that the provided Product Name does NOT appear on the Storefront Quick Search page.</description> - </annotations> - <arguments> - <argument name="productName" type="string"/> - </arguments> - - <dontSee selector="{{StorefrontQuickSearchResultsSection.allResults}}" userInput="{{productName}}" stepKey="dontSeeProductName"/> - </actionGroup> - - <!-- Open advanced search page --> - <actionGroup name="StorefrontOpenAdvancedSearchActionGroup"> - <annotations> - <description>Clicks on 'Advanced Search' in the Storefront Footer. Validates that the URL and Title are present and correct.</description> - </annotations> - - <click selector="{{StorefrontFooterSection.AdvancedSearch}}" stepKey="clickAdvancedSearchLink"/> - <seeInCurrentUrl url="{{StorefrontCatalogSearchAdvancedFormPage.url}}" stepKey="checkUrl"/> - <seeInTitle userInput="Advanced Search" stepKey="assertAdvancedSearchTitle1"/> - <see userInput="Advanced Search" selector="{{StorefrontCatalogSearchAdvancedFormSection.SearchTitle}}" stepKey="assertAdvancedSearchTitle2"/> - </actionGroup> - - <!-- Check that Advanced Search result page contains correct information --> - <actionGroup name="StorefrontCheckAdvancedSearchResultActionGroup"> - <annotations> - <description>Validates that the URL and Title are present and correct on the Storefront Advanced Search Results page.</description> - </annotations> - - <seeInCurrentUrl url="{{StorefrontCatalogSearchAdvancedResultPage.url}}" stepKey="checkUrl"/> - <seeInTitle userInput="Advanced Search Results" stepKey="assertAdvancedSearchTitle"/> - <see userInput="Catalog Advanced Search" selector="{{StorefrontCatalogSearchMainSection.SearchTitle}}" stepKey="assertAdvancedSearchName"/> - </actionGroup> - - <!-- Select the category in the filter --> - <actionGroup name="StorefrontSelectSearchFilterCategoryActionGroup"> - <annotations> - <description>Clicks on Category Filter. Clicks on the provided Category.</description> - </annotations> - <arguments> - <argument name="category"/> - </arguments> - - <click selector="{{StorefrontCategoryFilterSection.CategoryFilter}}" stepKey="clickCategoryFilterTitle"/> - <scrollTo selector="{{StorefrontCategoryFilterSection.CategoryByName(category.name)}}" stepKey="scrollToClickCategoryFilter"/> - <click selector="{{StorefrontCategoryFilterSection.CategoryByName(category.name)}}" stepKey="clickCategoryFilter"/> - </actionGroup> - - <!-- Go to store's advanced catalog search page --> - <actionGroup name="GoToStoreViewAdvancedCatalogSearchActionGroup"> - <annotations> - <description>Goes to the Storefront 'Advanced Search' page.</description> - </annotations> - - <amOnPage url="{{StorefrontCatalogSearchAdvancedFormPage.url}}" stepKey="GoToStoreViewAdvancedCatalogSearchActionGroup"/> - <waitForPageLoad time="90" stepKey="waitForPageLoad"/> - </actionGroup> - - <!-- Storefront advanced catalog search by product name --> - <actionGroup name="StorefrontAdvancedCatalogSearchByProductNameActionGroup"> - <annotations> - <description>Fills the Product Name field on the Storefront 'Advanced Search' page. Clicks on the Submit button.</description> - </annotations> - <arguments> - <argument name="name" type="string"/> - </arguments> - - <fillField selector="{{StorefrontCatalogSearchAdvancedFormSection.ProductName}}" userInput="{{name}}" stepKey="fill"/> - <click selector="{{StorefrontCatalogSearchAdvancedFormSection.SubmitButton}}" stepKey="clickSubmit"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - </actionGroup> - - <!-- Storefront advanced catalog search by product sku --> - <actionGroup name="StorefrontAdvancedCatalogSearchByProductSkuActionGroup"> - <annotations> - <description>Fills the Product SKU field on the Storefront 'Advanced Search' page. Clicks on the Submit button.</description> - </annotations> - <arguments> - <argument name="sku" type="string"/> - </arguments> - - <fillField selector="{{StorefrontCatalogSearchAdvancedFormSection.SKU}}" userInput="{{sku}}" stepKey="fill"/> - <click selector="{{StorefrontCatalogSearchAdvancedFormSection.SubmitButton}}" stepKey="clickSubmit"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - </actionGroup> - - <!-- Storefront advanced catalog search by product description --> - <actionGroup name="StorefrontAdvancedCatalogSearchByDescriptionActionGroup"> - <annotations> - <description>Fills the Product Description field on the Storefront 'Advanced Search' page. Clicks on the Submit button.</description> - </annotations> - <arguments> - <argument name="description" type="string"/> - </arguments> - - <fillField selector="{{StorefrontCatalogSearchAdvancedFormSection.Description}}" userInput="{{description}}" stepKey="fill"/> - <click selector="{{StorefrontCatalogSearchAdvancedFormSection.SubmitButton}}" stepKey="clickSubmit"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - </actionGroup> - - <!-- Storefront advanced catalog search by product short description --> - <actionGroup name="StorefrontAdvancedCatalogSearchByShortDescriptionActionGroup"> - <annotations> - <description>Fills the Product Short Description field on the Storefront 'Advanced Search' page. Clicks on the Submit button.</description> - </annotations> - <arguments> - <argument name="shortDescription" type="string"/> - </arguments> - - <fillField selector="{{StorefrontCatalogSearchAdvancedFormSection.ShortDescription}}" userInput="{{shortDescription}}" stepKey="fill"/> - <click selector="{{StorefrontCatalogSearchAdvancedFormSection.SubmitButton}}" stepKey="clickSubmit"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - </actionGroup> - - <!-- Storefront advanced catalog search by product name and price --> - <actionGroup name="StorefrontAdvancedCatalogSearchByProductNameAndPriceActionGroup"> - <annotations> - <description>Fills the Product Name, Price From and Price To fields on the Storefront 'Advanced Search' page. Clicks on the Submit button.</description> - </annotations> - <arguments> - <argument name="name" type="string"/> - <argument name="priceFrom" type="string"/> - <argument name="priceTo" type="string"/> - </arguments> - - <fillField selector="{{StorefrontCatalogSearchAdvancedFormSection.ProductName}}" userInput="{{name}}" stepKey="fillName"/> - <fillField selector="{{StorefrontCatalogSearchAdvancedFormSection.PriceFrom}}" userInput="{{priceFrom}}" stepKey="fillPriceFrom"/> - <fillField selector="{{StorefrontCatalogSearchAdvancedFormSection.PriceTo}}" userInput="{{priceTo}}" stepKey="fillPriceTo"/> - <click selector="{{StorefrontCatalogSearchAdvancedFormSection.SubmitButton}}" stepKey="clickSubmit"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - </actionGroup> - - <!-- Storefront advanced catalog search by product name and description --> - <actionGroup name="StorefrontAdvancedCatalogSearchByProductNameAndDescriptionActionGroup"> - <annotations> - <description>Fills the Product Name and Description fields on the Storefront 'Advanced Search' page. Clicks on the Submit button.</description> - </annotations> - <arguments> - <argument name="name" type="string"/> - <argument name="description" type="string"/> - </arguments> - - <fillField selector="{{StorefrontCatalogSearchAdvancedFormSection.ProductName}}" userInput="{{name}}" stepKey="fillName"/> - <fillField selector="{{StorefrontCatalogSearchAdvancedFormSection.Description}}" userInput="{{description}}" stepKey="fillDescription"/> - <click selector="{{StorefrontCatalogSearchAdvancedFormSection.SubmitButton}}" stepKey="clickSubmit"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - </actionGroup> - - <!-- Asserts that search results do not contain any results--> - <actionGroup name="StorefrontCheckSearchIsEmpty"> - <annotations> - <description>Validates that the 'No Results' message is present and correct on the Storefront Search Results page. PLEASE NOTE: The expected message is Hardcoded.</description> - </annotations> - - <see stepKey="checkEmpty" selector="{{StorefrontQuickSearchResultsSection.messageSection}}" userInput="Your search returned no results"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontCheckAdvancedSearchResultActionGroup.xml b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontCheckAdvancedSearchResultActionGroup.xml new file mode 100644 index 0000000000000..e26405bbafbea --- /dev/null +++ b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontCheckAdvancedSearchResultActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCheckAdvancedSearchResultActionGroup"> + <annotations> + <description>Validates that the URL and Title are present and correct on the Storefront Advanced Search Results page.</description> + </annotations> + + <seeInCurrentUrl url="{{StorefrontCatalogSearchAdvancedResultPage.url}}" stepKey="checkUrl"/> + <seeInTitle userInput="Advanced Search Results" stepKey="assertAdvancedSearchTitle"/> + <see userInput="Catalog Advanced Search" selector="{{StorefrontCatalogSearchMainSection.SearchTitle}}" stepKey="assertAdvancedSearchName"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontCheckQuickSearchActionGroup.xml b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontCheckQuickSearchActionGroup.xml new file mode 100644 index 0000000000000..4d97c2d37e7a1 --- /dev/null +++ b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontCheckQuickSearchActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <!-- Quick search the phrase and check if the result page contains correct information --> + <actionGroup name="StorefrontCheckQuickSearchActionGroup"> + <annotations> + <description>Submits Form POST for the Storefront Search feature. Validates that the URL is correct. Validates that the Title is present and correct.</description> + </annotations> + <arguments> + <argument name="phrase"/> + </arguments> + + <submitForm selector="{{StorefrontQuickSearchSection.searchMiniForm}}" parameterArray="['q' => {{phrase}}]" stepKey="fillQuickSearch"/> + <seeInCurrentUrl url="{{StorefrontCatalogSearchPage.url}}" stepKey="checkUrl"/> + <dontSeeInCurrentUrl url="form_key=" stepKey="checkUrlFormKey"/> + <seeInTitle userInput="Search results for: '{{phrase}}'" stepKey="assertQuickSearchTitle"/> + <see userInput="Search results for: '{{phrase}}'" selector="{{StorefrontCatalogSearchMainSection.SearchTitle}}" stepKey="assertQuickSearchName"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontCheckQuickSearchStringActionGroup.xml b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontCheckQuickSearchStringActionGroup.xml new file mode 100644 index 0000000000000..097a02a81679d --- /dev/null +++ b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontCheckQuickSearchStringActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCheckQuickSearchStringActionGroup"> + <annotations> + <description>Fill the Storefront Search field. Submits the Form. Validates that the provided Search Phrase is present and correct.</description> + </annotations> + <arguments> + <argument name="phrase" type="string"/> + </arguments> + + <fillField stepKey="fillInput" selector="{{StorefrontQuickSearchResultsSection.searchTextBox}}" userInput="{{phrase}}"/> + <submitForm selector="{{StorefrontQuickSearchResultsSection.searchTextBox}}" parameterArray="[]" stepKey="submitQuickSearch"/> + <seeInCurrentUrl url="{{StorefrontCatalogSearchPage.url}}" stepKey="checkUrl"/> + <dontSeeInCurrentUrl url="form_key=" stepKey="checkUrlFormKey"/> + <seeInTitle userInput="Search results for: '{{phrase}}'" stepKey="assertQuickSearchTitle"/> + <see userInput="Search results for: '{{phrase}}'" selector="{{StorefrontCatalogSearchMainSection.SearchTitle}}" stepKey="assertQuickSearchName"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontCheckSearchIsEmptyActionGroup.xml b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontCheckSearchIsEmptyActionGroup.xml new file mode 100644 index 0000000000000..c1df5d029d284 --- /dev/null +++ b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontCheckSearchIsEmptyActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCheckSearchIsEmptyActionGroup"> + <annotations> + <description>Validates that the 'No Results' message is present and correct on the Storefront Search Results page. PLEASE NOTE: The expected message is Hardcoded.</description> + </annotations> + + <see stepKey="checkEmpty" selector="{{StorefrontQuickSearchResultsSection.messageSection}}" userInput="Your search returned no results"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontOpenAdvancedSearchActionGroup.xml b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontOpenAdvancedSearchActionGroup.xml new file mode 100644 index 0000000000000..84e4cb29b884d --- /dev/null +++ b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontOpenAdvancedSearchActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontOpenAdvancedSearchActionGroup"> + <annotations> + <description>Clicks on 'Advanced Search' in the Storefront Footer. Validates that the URL and Title are present and correct.</description> + </annotations> + + <click selector="{{StorefrontFooterSection.AdvancedSearch}}" stepKey="clickAdvancedSearchLink"/> + <seeInCurrentUrl url="{{StorefrontCatalogSearchAdvancedFormPage.url}}" stepKey="checkUrl"/> + <seeInTitle userInput="Advanced Search" stepKey="assertAdvancedSearchTitle1"/> + <see userInput="Advanced Search" selector="{{StorefrontCatalogSearchAdvancedFormSection.SearchTitle}}" stepKey="assertAdvancedSearchTitle2"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontOpenProductFromQuickSearchActionGroup.xml b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontOpenProductFromQuickSearchActionGroup.xml new file mode 100644 index 0000000000000..348c5dabc65e0 --- /dev/null +++ b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontOpenProductFromQuickSearchActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontOpenProductFromQuickSearchActionGroup"> + <annotations> + <description>Clicks on the provided Product Name from the Storefront Quick Search Results page.</description> + </annotations> + <arguments> + <argument name="productName" type="string"/> + <argument name="productUrlKey" type="string"/> + </arguments> + + <scrollTo selector="{{StorefrontQuickSearchResultsSection.productByName(productName)}}" stepKey="scrollToProduct"/> + <click stepKey="openProduct" selector="{{StorefrontQuickSearchResultsSection.productByName(productName)}}"/> + <waitForPageLoad stepKey="waitForProductLoad"/> + <seeInCurrentUrl url="{{productUrlKey}}" stepKey="checkUrl"/> + <see stepKey="checkName" selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{productName}}"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontQuickSearchCheckProductNameInGridActionGroup.xml b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontQuickSearchCheckProductNameInGridActionGroup.xml new file mode 100644 index 0000000000000..4f68d9b004c79 --- /dev/null +++ b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontQuickSearchCheckProductNameInGridActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontQuickSearchCheckProductNameInGridActionGroup"> + <annotations> + <description>Validates that the provided Product Name appears at the correct index on the Storefront Quick Search page.</description> + </annotations> + <arguments> + <argument name="productName" type="string"/> + <argument name="index" type="string"/> + </arguments> + + <see selector="{{StorefrontQuickSearchResultsSection.productByIndex(index)}}" userInput="{{productName}}" stepKey="seeProductName"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontQuickSearchCheckProductNameNotInGridActionGroup.xml b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontQuickSearchCheckProductNameNotInGridActionGroup.xml new file mode 100644 index 0000000000000..493b266e2c368 --- /dev/null +++ b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontQuickSearchCheckProductNameNotInGridActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontQuickSearchCheckProductNameNotInGridActionGroup"> + <annotations> + <description>Validates that the provided Product Name does NOT appear on the Storefront Quick Search page.</description> + </annotations> + <arguments> + <argument name="productName" type="string"/> + </arguments> + + <dontSee selector="{{StorefrontQuickSearchResultsSection.allResults}}" userInput="{{productName}}" stepKey="dontSeeProductName"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontQuickSearchRelatedSearchTermsAppearsActionGroup.xml b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontQuickSearchRelatedSearchTermsAppearsActionGroup.xml new file mode 100644 index 0000000000000..00a4f3e5d3917 --- /dev/null +++ b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontQuickSearchRelatedSearchTermsAppearsActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontQuickSearchRelatedSearchTermsAppearsActionGroup"> + <arguments> + <argument name="term" type="string"/> + </arguments> + + <waitForElementVisible selector="{{StorefrontCatalogSearchMainSection.relatedSearchTermsTitle}}" stepKey="waitMessageAppears"/> + <see selector="{{StorefrontCatalogSearchMainSection.relatedSearchTermsTitle}}" userInput="Related search terms" stepKey="checkRelatedTermsTitle"/> + <see selector="{{StorefrontCatalogSearchMainSection.relatedSearchTerm}}" userInput="{{term}}" stepKey="checkRelatedTermExists"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontQuickSearchSeeProductByNameActionGroup.xml b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontQuickSearchSeeProductByNameActionGroup.xml new file mode 100644 index 0000000000000..a900dfce9c1fa --- /dev/null +++ b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontQuickSearchSeeProductByNameActionGroup.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontQuickSearchSeeProductByNameActionGroup"> + <arguments> + <argument name="productName" type="string"/> + </arguments> + <see selector="{{StorefrontQuickSearchResultsSection.productByName(productName)}}" userInput="{{productName}}" stepKey="seeProductName"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontQuickSearchTooShortStringActionGroup.xml b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontQuickSearchTooShortStringActionGroup.xml new file mode 100644 index 0000000000000..58ef412410c74 --- /dev/null +++ b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontQuickSearchTooShortStringActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontQuickSearchTooShortStringActionGroup" extends="StorefrontCheckQuickSearchStringActionGroup"> + <annotations> + <description>Fill the Storefront Search field. Submits the Form. Validates that 'Minimum Search query length' warning appears.</description> + </annotations> + <arguments> + <argument name="minQueryLength" type="string"/> + </arguments> + + <see selector="{{StorefrontQuickSearchResultsSection.messageSection}}" userInput="Minimum Search query length is {{minQueryLength}}" stepKey="assertQuickSearchNeedThreeOrMoreChars"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontSelectSearchFilterCategoryActionGroup.xml b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontSelectSearchFilterCategoryActionGroup.xml new file mode 100644 index 0000000000000..3048217f5dfda --- /dev/null +++ b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontSelectSearchFilterCategoryActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontSelectSearchFilterCategoryActionGroup"> + <annotations> + <description>Clicks on Category Filter. Clicks on the provided Category.</description> + </annotations> + <arguments> + <argument name="category"/> + </arguments> + + <click selector="{{StorefrontCategoryFilterSection.CategoryFilter}}" stepKey="clickCategoryFilterTitle"/> + <scrollTo selector="{{StorefrontCategoryFilterSection.CategoryByName(category.name)}}" stepKey="scrollToClickCategoryFilter"/> + <click selector="{{StorefrontCategoryFilterSection.CategoryByName(category.name)}}" stepKey="clickCategoryFilter"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/Test/AdminCreateSearchTermEntityTest.xml b/app/code/Magento/CatalogSearch/Test/Mftf/Test/AdminCreateSearchTermEntityTest.xml index 2b425f34f8a5b..86a1d4321cba0 100644 --- a/app/code/Magento/CatalogSearch/Test/Mftf/Test/AdminCreateSearchTermEntityTest.xml +++ b/app/code/Magento/CatalogSearch/Test/Mftf/Test/AdminCreateSearchTermEntityTest.xml @@ -27,7 +27,7 @@ </before> <after> <!-- Delete created search term --> - <actionGroup ref="AssertSearchTermSuccessDeleteMessage" stepKey="deleteSearchTerm"> + <actionGroup ref="AssertSearchTermSuccessDeleteMessageActionGroup" stepKey="deleteSearchTerm"> <argument name="searchQuery" value="$$createSimpleProduct.sku$$"/> </actionGroup> @@ -39,7 +39,7 @@ </after> <!-- Go to the search terms page and create new search term --> - <actionGroup ref="AssertSearchTermSaveSuccessMessage" stepKey="createNewSearchTerm"> + <actionGroup ref="AssertSearchTermSaveSuccessMessageActionGroup" stepKey="createNewSearchTerm"> <argument name="searchQuery" value="$$createSimpleProduct.sku$$"/> <argument name="storeValue" value="{{SimpleTerm.store_id}}"/> <argument name="redirectUrl" value="{{SimpleTerm.redirect}}"/> @@ -51,7 +51,7 @@ <waitForPageLoad stepKey="waitForPageLoad"/> <!-- Assert created search term on storefront --> - <actionGroup ref="AssertSearchTermOnFrontend" stepKey="assertCreatedSearchTermOnFrontend"> + <actionGroup ref="AssertSearchTermOnFrontendActionGroup" stepKey="assertCreatedSearchTermOnFrontend"> <argument name="searchQuery" value="$$createSimpleProduct.sku$$"/> <argument name="redirectUrl" value="{{SimpleTerm.redirect}}"/> </actionGroup> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/Test/AdminDeleteSearchTermTest.xml b/app/code/Magento/CatalogSearch/Test/Mftf/Test/AdminDeleteSearchTermTest.xml index c72ed424ef307..b449d92d8e003 100644 --- a/app/code/Magento/CatalogSearch/Test/Mftf/Test/AdminDeleteSearchTermTest.xml +++ b/app/code/Magento/CatalogSearch/Test/Mftf/Test/AdminDeleteSearchTermTest.xml @@ -33,7 +33,7 @@ </after> <!--Add new search term--> - <actionGroup ref="AssertSearchTermSaveSuccessMessage" stepKey="addNewSearchTerm"> + <actionGroup ref="AssertSearchTermSaveSuccessMessageActionGroup" stepKey="addNewSearchTerm"> <argument name="searchQuery" value="{{SimpleTerm.search_query}}"/> <argument name="storeValue" value="{{SimpleTerm.store_id}}"/> <argument name="redirectUrl" value="{{SimpleTerm.redirect}}"/> @@ -41,19 +41,19 @@ </actionGroup> <!--Search and delete search term and AssertSearchTermSuccessDeleteMessage--> - <actionGroup ref="AssertSearchTermSuccessDeleteMessage" stepKey="deleteSearchTerm"> + <actionGroup ref="AssertSearchTermSuccessDeleteMessageActionGroup" stepKey="deleteSearchTerm"> <argument name="searchQuery" value="{{SimpleTerm.search_query}}"/> </actionGroup> <!--Verify deleted search term in grid and AssertSearchTermNotInGrid--> - <actionGroup ref="AssertSearchTermNotInGrid" stepKey="verifyDeletedSearchTermNotInGrid"> + <actionGroup ref="AssertSearchTermNotInGridActionGroup" stepKey="verifyDeletedSearchTermNotInGrid"> <argument name="searchQuery" value="{{SimpleTerm.search_query}}"/> </actionGroup> <!--Go to storefront and Verify AssertSearchTermNotOnFrontend--> - <actionGroup ref="AssertSearchTermNotOnFrontend" stepKey="verifySearchTermNotOnFrontend"> + <actionGroup ref="AssertSearchTermNotOnFrontendActionGroup" stepKey="verifySearchTermNotOnFrontend"> <argument name="searchQuery" value="{{SimpleTerm.search_query}}"/> <argument name="url_key" value="$$simpleProduct.custom_attributes[url_key]$$"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml b/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml index 3b60e4b09de28..02738c118dcc9 100644 --- a/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml +++ b/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml @@ -36,7 +36,7 @@ <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="searchStorefront"> <argument name="phrase" value="$createSimpleProduct.sku$"/> </actionGroup> - <actionGroup ref="StorefrontOpenProductFromQuickSearch" stepKey="openAndCheckProduct"> + <actionGroup ref="StorefrontOpenProductFromQuickSearchActionGroup" stepKey="openAndCheckProduct"> <argument name="productName" value="$createSimpleProduct.name$"/> <argument name="productUrlKey" value="$createSimpleProduct.custom_attributes[url_key]$"/> </actionGroup> @@ -106,7 +106,7 @@ <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="searchStorefront"> <argument name="phrase" value="ThisShouldn'tReturnAnything"/> </actionGroup> - <actionGroup ref="StorefrontCheckSearchIsEmpty" stepKey="checkEmpty"/> + <actionGroup ref="StorefrontCheckSearchIsEmptyActionGroup" stepKey="checkEmpty"/> </test> <test name="QuickSearchWithTwoCharsEmptyResults" extends="QuickSearchEmptyResults"> @@ -254,11 +254,11 @@ <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="searchStorefront"> <argument name="phrase" value="{{_defaultProduct.name}}"/> </actionGroup> - <actionGroup ref="StorefrontQuickSearchCheckProductNameInGrid" stepKey="assertProduct1Position"> + <actionGroup ref="StorefrontQuickSearchCheckProductNameInGridActionGroup" stepKey="assertProduct1Position"> <argument name="productName" value="$product1.name$"/> <argument name="index" value="2"/> </actionGroup> - <actionGroup ref="StorefrontQuickSearchCheckProductNameInGrid" stepKey="assertProduct2Position"> + <actionGroup ref="StorefrontQuickSearchCheckProductNameInGridActionGroup" stepKey="assertProduct2Position"> <argument name="productName" value="$product2.name$"/> <argument name="index" value="1"/> </actionGroup> @@ -283,11 +283,11 @@ <argument name="defaultValue" value="{{_defaultProduct.name}}"/> </actionGroup> </before> - <actionGroup ref="StorefrontQuickSearchCheckProductNameInGrid" stepKey="assertProduct1Position"> + <actionGroup ref="StorefrontQuickSearchCheckProductNameInGridActionGroup" stepKey="assertProduct1Position"> <argument name="productName" value="$product1.name$"/> <argument name="index" value="1"/> </actionGroup> - <actionGroup ref="StorefrontQuickSearchCheckProductNameInGrid" stepKey="assertProduct2Position"> + <actionGroup ref="StorefrontQuickSearchCheckProductNameInGridActionGroup" stepKey="assertProduct2Position"> <argument name="productName" value="$product2.name$"/> <argument name="index" value="2"/> </actionGroup> @@ -317,7 +317,7 @@ <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="searchStorefront"> <argument name="phrase" value="$createSimpleProduct.name$"/> </actionGroup> - <actionGroup ref="StorefrontAddToCartFromQuickSearch" stepKey="addProductToCart"> + <actionGroup ref="StorefrontAddToCartFromQuickSearchActionGroup" stepKey="addProductToCart"> <argument name="productName" value="$createSimpleProduct.name$"/> </actionGroup> </test> @@ -349,7 +349,7 @@ <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="searchStorefront"> <argument name="phrase" value="$createVirtualProduct.name$"/> </actionGroup> - <actionGroup ref="StorefrontAddToCartFromQuickSearch" stepKey="addProductToCart"> + <actionGroup ref="StorefrontAddToCartFromQuickSearchActionGroup" stepKey="addProductToCart"> <argument name="productName" value="$createVirtualProduct.name$"/> </actionGroup> </test> @@ -387,7 +387,7 @@ <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="searchStorefront"> <argument name="phrase" value="{{_defaultProduct.name}}"/> </actionGroup> - <actionGroup ref="StorefrontOpenProductFromQuickSearch" stepKey="openAndCheckProduct"> + <actionGroup ref="StorefrontOpenProductFromQuickSearchActionGroup" stepKey="openAndCheckProduct"> <argument name="productName" value="{{_defaultProduct.name}}"/> <argument name="productUrlKey" value="{{_defaultProduct.urlKey}}"/> </actionGroup> @@ -430,7 +430,7 @@ <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="searchStorefront"> <argument name="phrase" value="$createProduct.name$"/> </actionGroup> - <actionGroup ref="StorefrontAddToCartFromQuickSearch" stepKey="addProductToCart"> + <actionGroup ref="StorefrontAddToCartFromQuickSearchActionGroup" stepKey="addProductToCart"> <argument name="productName" value="$createProduct.name$"/> </actionGroup> </test> @@ -467,7 +467,7 @@ <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="searchStorefront"> <argument name="phrase" value=""$createProduct.name$""/> </actionGroup> - <actionGroup ref="StorefrontAddToCartFromQuickSearch" stepKey="addProductToCart"> + <actionGroup ref="StorefrontAddToCartFromQuickSearchActionGroup" stepKey="addProductToCart"> <argument name="productName" value="$createProduct.name$"/> </actionGroup> </test> @@ -519,7 +519,7 @@ <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="searchStorefront"> <argument name="phrase" value="$createBundleProduct.name$"/> </actionGroup> - <actionGroup ref="StorefrontOpenProductFromQuickSearch" stepKey="openAndCheckProduct"> + <actionGroup ref="StorefrontOpenProductFromQuickSearchActionGroup" stepKey="openAndCheckProduct"> <argument name="productName" value="$createBundleProduct.name$"/> <argument name="productUrlKey" value="$createBundleProduct.custom_attributes[url_key]$"/> </actionGroup> @@ -589,7 +589,7 @@ <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="searchStorefront"> <argument name="phrase" value="$createBundleProduct.name$"/> </actionGroup> - <actionGroup ref="StorefrontOpenProductFromQuickSearch" stepKey="openAndCheckProduct"> + <actionGroup ref="StorefrontOpenProductFromQuickSearchActionGroup" stepKey="openAndCheckProduct"> <argument name="productName" value="$createBundleProduct.name$"/> <argument name="productUrlKey" value="$createBundleProduct.custom_attributes[url_key]$"/> </actionGroup> @@ -676,7 +676,7 @@ <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="searchStorefront"> <argument name="phrase" value="$createConfigProduct.name$"/> </actionGroup> - <actionGroup ref="StorefrontQuickSearchCheckProductNameInGrid" stepKey="seeProductInGrid"> + <actionGroup ref="StorefrontQuickSearchCheckProductNameInGridActionGroup" stepKey="seeProductInGrid"> <argument name="productName" value="$createConfigProduct.name$"/> <argument name="index" value="1"/> </actionGroup> @@ -692,7 +692,7 @@ <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="searchStorefrontAgain"> <argument name="phrase" value="$createConfigProduct.name$"/> </actionGroup> - <actionGroup ref="StorefrontQuickSearchCheckProductNameNotInGrid" stepKey="dontSeeProductAnymore"> + <actionGroup ref="StorefrontQuickSearchCheckProductNameNotInGridActionGroup" stepKey="dontSeeProductAnymore"> <argument name="productName" value="$createConfigProduct.name$"/> </actionGroup> </test> diff --git a/app/code/Magento/Elasticsearch6/Test/Mftf/Test/StorefrontElasticsearch6SearchInvalidValueTest.xml b/app/code/Magento/Elasticsearch6/Test/Mftf/Test/StorefrontElasticsearch6SearchInvalidValueTest.xml index a144a4849db60..0417d1eee1ae2 100644 --- a/app/code/Magento/Elasticsearch6/Test/Mftf/Test/StorefrontElasticsearch6SearchInvalidValueTest.xml +++ b/app/code/Magento/Elasticsearch6/Test/Mftf/Test/StorefrontElasticsearch6SearchInvalidValueTest.xml @@ -92,7 +92,7 @@ <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="quickSearchForSecondSearchTerm"> <argument name="phrase" value="?;"/> </actionGroup> - <actionGroup ref="StorefrontCheckSearchIsEmpty" stepKey="checkEmptyForSecondSearchTerm"/> + <actionGroup ref="StorefrontCheckSearchIsEmptyActionGroup" stepKey="checkEmptyForSecondSearchTerm"/> <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="quickSearchProductForWithSpecialSymbols"> <argument name="phrase" value="?{{ProductWithSpecialSymbols.name}};"/> </actionGroup> @@ -104,10 +104,10 @@ <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="quickSearchForThirdSearchTerm"> <argument name="phrase" value="?anythingcangobetween;"/> </actionGroup> - <actionGroup ref="StorefrontCheckSearchIsEmpty" stepKey="checkEmptyForThirdSearchTerm"/> + <actionGroup ref="StorefrontCheckSearchIsEmptyActionGroup" stepKey="checkEmptyForThirdSearchTerm"/> <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="quickSearchForForthSearchTerm"> <argument name="phrase" value="? anything at all ;"/> </actionGroup> - <actionGroup ref="StorefrontCheckSearchIsEmpty" stepKey="checkEmptyForForthSearchTerm"/> + <actionGroup ref="StorefrontCheckSearchIsEmptyActionGroup" stepKey="checkEmptyForForthSearchTerm"/> </test> </tests> diff --git a/app/code/Magento/Search/Test/Mftf/Test/AdminMassDeleteSearchTermEntityTest.xml b/app/code/Magento/Search/Test/Mftf/Test/AdminMassDeleteSearchTermEntityTest.xml index 67ccb51bf401e..57f34b41a967f 100644 --- a/app/code/Magento/Search/Test/Mftf/Test/AdminMassDeleteSearchTermEntityTest.xml +++ b/app/code/Magento/Search/Test/Mftf/Test/AdminMassDeleteSearchTermEntityTest.xml @@ -52,13 +52,13 @@ <actionGroup ref="deleteSearchTerm" stepKey="deleteSearchTerms"/> <!-- Assert search terms are absent on the search term page --> - <actionGroup ref="AssertSearchTermNotInGrid" stepKey="assertFirstSearchTermNotInGrid"> + <actionGroup ref="AssertSearchTermNotInGridActionGroup" stepKey="assertFirstSearchTermNotInGrid"> <argument name="searchQuery" value="$$createFirstSearchTerm.query_text$$"/> </actionGroup> - <actionGroup ref="AssertSearchTermNotInGrid" stepKey="assertSecondSearchTermNotInGrid"> + <actionGroup ref="AssertSearchTermNotInGridActionGroup" stepKey="assertSecondSearchTermNotInGrid"> <argument name="searchQuery" value="$$createSecondSearchTerm.query_text$$"/> </actionGroup> - <actionGroup ref="AssertSearchTermNotInGrid" stepKey="assertThirdSearchTermNotInGrid"> + <actionGroup ref="AssertSearchTermNotInGridActionGroup" stepKey="assertThirdSearchTermNotInGrid"> <argument name="searchQuery" value="$$createThirdSearchTerm.query_text$$"/> </actionGroup> @@ -70,14 +70,14 @@ <actionGroup ref="StorefrontCheckQuickSearchActionGroup" stepKey="quickSearchForFirstSearchTerm"> <argument name="phrase" value="$$createFirstSearchTerm.query_text$$"/> </actionGroup> - <actionGroup ref="StorefrontCheckSearchIsEmpty" stepKey="checkEmptyForFirstSearchTerm"/> + <actionGroup ref="StorefrontCheckSearchIsEmptyActionGroup" stepKey="checkEmptyForFirstSearchTerm"/> <actionGroup ref="StorefrontCheckQuickSearchActionGroup" stepKey="quickSearchForSecondSearchTerm"> <argument name="phrase" value="$$createSecondSearchTerm.query_text$$"/> </actionGroup> - <actionGroup ref="StorefrontCheckSearchIsEmpty" stepKey="checkEmptyForSecondSearchTerm"/> + <actionGroup ref="StorefrontCheckSearchIsEmptyActionGroup" stepKey="checkEmptyForSecondSearchTerm"/> <actionGroup ref="StorefrontCheckQuickSearchActionGroup" stepKey="quickSearchForThirdSearchTerm"> <argument name="phrase" value="$$createThirdSearchTerm.query_text$$"/> </actionGroup> - <actionGroup ref="StorefrontCheckSearchIsEmpty" stepKey="checkEmptyForThirdSearchTerm"/> + <actionGroup ref="StorefrontCheckSearchIsEmptyActionGroup" stepKey="checkEmptyForThirdSearchTerm"/> </test> </tests> From 26fc7c187010101ba1367f640c929ac7a1ee3550 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Fri, 29 Nov 2019 13:06:37 +0100 Subject: [PATCH 0181/1143] REFACTOR: Extract Action Groups to separate files (according to MFTF best practices) --- ...talogPriceRuleWithConditionActionGroup.xml | 28 +++ ...ipleWebsiteCatalogPriceRuleActionGroup.xml | 15 ++ ...minFillCatalogRuleConditionActionGroup.xml | 35 +++ .../ApplyCatalogPriceRulesActionGroup.xml | 21 ++ .../CatalogPriceRuleActionGroup.xml | 214 +----------------- .../CreateCatalogPriceRuleActionGroup.xml | 29 +++ ...eRuleConditionWithAttributeActionGroup.xml | 31 +++ ...ateCatalogPriceRuleViaTheUiActionGroup.xml | 30 +++ ...ByUIWithConditionIsCategoryActionGroup.xml | 28 +++ ...eRuleByUIWithConditionIsSKUActionGroup.xml | 28 +++ ...logPriceRuleWithInvalidDataActionGroup.xml | 29 +++ .../OpenCatalogPriceRuleActionGroup.xml | 22 ++ .../RemoveCatalogPriceRuleActionGroup.xml | 18 ++ .../SelectGeneralCustomerGroupActionGroup.xml | 18 ++ ...ectNotLoggedInCustomerGroupActionGroup.xml | 18 ++ ...nfigurableProductWithSpecialPricesTest.xml | 4 +- .../Test/AdminCreateCatalogPriceRuleTest.xml | 12 +- .../AdminDeleteCatalogPriceRuleEntityTest.xml | 4 +- .../Test/AdminDeleteCatalogPriceRuleTest.xml | 2 +- ...tributeIsUndefinedCatalogPriceRuleTest.xml | 12 +- ...uleForSimpleAndConfigurableProductTest.xml | 4 +- ...RuleForSimpleProductAndFixedMethodTest.xml | 8 +- ...orSimpleProductForNewCustomerGroupTest.xml | 2 +- ...eForSimpleProductWithCustomOptionsTest.xml | 4 +- ...hipArePersistedUnderLongTermCookieTest.xml | 4 +- .../StorefrontInactiveCatalogRuleTest.xml | 2 +- ...eProductWithAssignedSimpleProductsTest.xml | 2 +- ...eForConfigurableProductWithOptionsTest.xml | 6 +- ...ConfigurableWithCatalogRuleAppliedTest.xml | 2 +- 29 files changed, 385 insertions(+), 247 deletions(-) create mode 100644 app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminCreateCatalogPriceRuleWithConditionActionGroup.xml create mode 100644 app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminCreateMultipleWebsiteCatalogPriceRuleActionGroup.xml create mode 100644 app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminFillCatalogRuleConditionActionGroup.xml create mode 100644 app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/ApplyCatalogPriceRulesActionGroup.xml create mode 100644 app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CreateCatalogPriceRuleActionGroup.xml create mode 100644 app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CreateCatalogPriceRuleConditionWithAttributeActionGroup.xml create mode 100644 app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CreateCatalogPriceRuleViaTheUiActionGroup.xml create mode 100644 app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/NewCatalogPriceRuleByUIWithConditionIsCategoryActionGroup.xml create mode 100644 app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/NewCatalogPriceRuleByUIWithConditionIsSKUActionGroup.xml create mode 100644 app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/NewCatalogPriceRuleWithInvalidDataActionGroup.xml create mode 100644 app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/OpenCatalogPriceRuleActionGroup.xml create mode 100644 app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/RemoveCatalogPriceRuleActionGroup.xml create mode 100644 app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/SelectGeneralCustomerGroupActionGroup.xml create mode 100644 app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/SelectNotLoggedInCustomerGroupActionGroup.xml diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminCreateCatalogPriceRuleWithConditionActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminCreateCatalogPriceRuleWithConditionActionGroup.xml new file mode 100644 index 0000000000000..eebc1175f1894 --- /dev/null +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminCreateCatalogPriceRuleWithConditionActionGroup.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateCatalogPriceRuleWithConditionActionGroup" extends="CreateCatalogPriceRuleActionGroup"> + <arguments> + <argument name="catalogRuleType" type="entity" defaultValue="PriceRuleWithCondition"/> + </arguments> + <waitForPageLoad stepKey="waitForPageLoad" after="addNewRule"/> + <click selector="{{AdminNewCatalogPriceRule.conditionsTab}}" stepKey="expandConditions" before="openActionDropdown"/> + <scrollTo selector="{{AdminNewCatalogPriceRule.conditionsTab}}" stepKey="scrollToConditionsTab" after="expandConditions"/> + <waitForElementVisible selector="{{PriceRuleConditionsSection.createNewRule}}" stepKey="waitForNewRule" after="scrollToConditionsTab"/> + <click selector="{{PriceRuleConditionsSection.createNewRule}}" stepKey="clickNewRule" after="waitForNewRule"/> + <selectOption selector="{{AdminNewCatalogPriceRuleConditions.conditionsDropdown}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="selectProductAttribute" after="clickNewRule"/> + <waitForPageLoad stepKey="waitForAttributeLoad" after="selectProductAttribute"/> + <!--Assert that attribute contains today date without time--> + <comment userInput="Assert that attribute contains today date without time" stepKey="assertDate" after="waitForAttributeLoad"/> + <generateDate date="now" format="Y-m-d" stepKey="today" after="assertDate"/> + <grabTextFrom selector="{{PriceRuleConditionsSection.firstProductAttributeSelected}}" stepKey="grabTextFromSelectedAttribute" after="today"/> + <assertEquals expected="$today" actual="$grabTextFromSelectedAttribute" stepKey="assertTodayDate" after="grabTextFromSelectedAttribute"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminCreateMultipleWebsiteCatalogPriceRuleActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminCreateMultipleWebsiteCatalogPriceRuleActionGroup.xml new file mode 100644 index 0000000000000..06887a6aaba96 --- /dev/null +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminCreateMultipleWebsiteCatalogPriceRuleActionGroup.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateMultipleWebsiteCatalogPriceRuleActionGroup" extends="CreateCatalogPriceRuleActionGroup"> + <remove keyForRemoval="selectSite"/> + <selectOption selector="{{AdminNewCatalogPriceRule.websites}}" parameterArray="['FirstWebsite', 'SecondWebsite']" stepKey="selectWebsite"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminFillCatalogRuleConditionActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminFillCatalogRuleConditionActionGroup.xml new file mode 100644 index 0000000000000..fd173acfa434c --- /dev/null +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminFillCatalogRuleConditionActionGroup.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminFillCatalogRuleConditionActionGroup"> + <annotations> + <description>Clicks on the Conditions tab. Fills in the provided condition for Catalog Price Rule.</description> + </annotations> + <arguments> + <argument name="condition" type="string" defaultValue="{{CatalogRuleProductConditions.categoryIds}}"/> + <argument name="conditionOperator" type="string" defaultValue="is"/> + <argument name="conditionValue" type="string" defaultValue="2"/> + </arguments> + + <conditionalClick selector="{{AdminNewCatalogPriceRule.conditionsTab}}" dependentSelector="{{AdminNewCatalogPriceRuleConditions.newCondition}}" visible="false" stepKey="openConditionsTab"/> + <waitForElementVisible selector="{{AdminNewCatalogPriceRuleConditions.newCondition}}" stepKey="waitForAddConditionButton"/> + <click selector="{{AdminNewCatalogPriceRuleConditions.newCondition}}" stepKey="addNewCondition"/> + <selectOption selector="{{AdminNewCatalogPriceRuleConditions.conditionSelect('1')}}" userInput="{{condition}}" stepKey="selectTypeCondition"/> + <click selector="{{AdminNewCatalogPriceRuleConditions.condition('is')}}" stepKey="clickOnOperator"/> + <selectOption selector="{{AdminNewCatalogPriceRuleConditions.activeOperatorSelect}}" userInput="{{conditionOperator}}" stepKey="selectCondition"/> + <!-- In case we are choosing already selected value - select is not closed automatically --> + <conditionalClick selector="{{AdminNewCatalogPriceRuleConditions.condition('...')}}" dependentSelector="{{AdminNewCatalogPriceRuleConditions.activeOperatorSelect}}" visible="true" stepKey="closeSelect"/> + <click selector="{{AdminNewCatalogPriceRuleConditions.condition('...')}}" stepKey="clickToChooseOption3"/> + <waitForElementVisible selector="{{AdminNewCatalogPriceRuleConditions.activeValueInput}}" stepKey="waitForValueInput"/> + <fillField selector="{{AdminNewCatalogPriceRuleConditions.activeValueInput}}" userInput="{{conditionValue}}" stepKey="fillConditionValue"/> + <click selector="{{AdminNewCatalogPriceRuleConditions.activeConditionApplyButton}}" stepKey="clickApply"/> + <waitForElementNotVisible selector="{{AdminNewCatalogPriceRuleConditions.activeConditionApplyButton}}" stepKey="waitForApplyButtonInvisibility"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/ApplyCatalogPriceRulesActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/ApplyCatalogPriceRulesActionGroup.xml new file mode 100644 index 0000000000000..0b74558599fbd --- /dev/null +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/ApplyCatalogPriceRulesActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ApplyCatalogPriceRulesActionGroup"> + <annotations> + <description>Goes to the Catalog Price Rule grid page. Clicks on Apply Rules. Validates that the Success Message is present and correct.</description> + </annotations> + + <amOnPage stepKey="goToPriceRulePage" url="{{CatalogRulePage.url}}"/> + <waitForPageLoad stepKey="waitForPriceRulePage"/> + <click stepKey="applyRules" selector="{{AdminCatalogPriceRuleGrid.applyRules}}"/> + <see stepKey="assertSuccess" selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="Updated rules applied."/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogPriceRuleActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogPriceRuleActionGroup.xml index 50b4165a3f34b..e0d02a280bf6c 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogPriceRuleActionGroup.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogPriceRuleActionGroup.xml @@ -9,7 +9,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <!-- action group to create a new catalog price rule giving a catalogRule entity --> - <actionGroup name="newCatalogPriceRuleByUI"> + <actionGroup name="NewCatalogPriceRuleByUIActionGroup"> <annotations> <description>Goes to the Catalog Price Rule grid. Clicks on Add. Fills in the provided Catalog Rule details.</description> </annotations> @@ -40,216 +40,4 @@ <scrollToTopOfPage stepKey="scrollToTop"/> <waitForPageLoad stepKey="waitForApplied"/> </actionGroup> - - <actionGroup name="createCatalogPriceRule"> - <annotations> - <description>Clicks on the Add button. Fills Rule Name, Description, Website and Discount Value.</description> - </annotations> - <arguments> - <argument name="catalogRule" defaultValue="_defaultCatalogRule"/> - </arguments> - <click stepKey="addNewRule" selector="{{AdminGridMainControls.add}}"/> - <fillField selector="{{AdminNewCatalogPriceRule.ruleName}}" userInput="{{catalogRule.name}}" stepKey="fillName" /> - <click stepKey="selectActive" selector="{{AdminCategoryBasicFieldSection.enableCategoryLabel}}"/> - <fillField selector="{{AdminNewCatalogPriceRule.description}}" userInput="{{catalogRule.description}}" stepKey="fillDescription" /> - <selectOption selector="{{AdminNewCatalogPriceRule.websites}}" parameterArray="{{catalogRule.website_ids}}" stepKey="selectSite" /> - <click stepKey="openActionDropdown" selector="{{AdminNewCatalogPriceRule.actionsTab}}"/> - <fillField stepKey="fillDiscountValue" selector="{{AdminNewCatalogPriceRuleActions.discountAmount}}" userInput="{{catalogRule.discount_amount}}"/> - <scrollToTopOfPage stepKey="scrollToTop"/> - <click selector="{{AdminNewCatalogPriceRule.save}}" stepKey="clickSave"/> - <waitForPageLoad stepKey="waitForApplied"/> - </actionGroup> - - <actionGroup name="AdminCreateCatalogPriceRuleWithConditionActionGroup" extends="createCatalogPriceRule"> - <arguments> - <argument name="catalogRuleType" type="entity" defaultValue="PriceRuleWithCondition"/> - </arguments> - <waitForPageLoad stepKey="waitForPageLoad" after="addNewRule"/> - <click selector="{{AdminNewCatalogPriceRule.conditionsTab}}" stepKey="expandConditions" before="openActionDropdown"/> - <scrollTo selector="{{AdminNewCatalogPriceRule.conditionsTab}}" stepKey="scrollToConditionsTab" after="expandConditions"/> - <waitForElementVisible selector="{{PriceRuleConditionsSection.createNewRule}}" stepKey="waitForNewRule" after="scrollToConditionsTab"/> - <click selector="{{PriceRuleConditionsSection.createNewRule}}" stepKey="clickNewRule" after="waitForNewRule"/> - <selectOption selector="{{AdminNewCatalogPriceRuleConditions.conditionsDropdown}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="selectProductAttribute" after="clickNewRule"/> - <waitForPageLoad stepKey="waitForAttributeLoad" after="selectProductAttribute"/> - <!--Assert that attribute contains today date without time--> - <comment userInput="Assert that attribute contains today date without time" stepKey="assertDate" after="waitForAttributeLoad"/> - <generateDate date="now" format="Y-m-d" stepKey="today" after="assertDate"/> - <grabTextFrom selector="{{PriceRuleConditionsSection.firstProductAttributeSelected}}" stepKey="grabTextFromSelectedAttribute" after="today"/> - <assertEquals expected="$today" actual="$grabTextFromSelectedAttribute" stepKey="assertTodayDate" after="grabTextFromSelectedAttribute"/> - </actionGroup> - <actionGroup name="AdminCreateMultipleWebsiteCatalogPriceRule" extends="createCatalogPriceRule"> - <remove keyForRemoval="selectSite"/> - <selectOption selector="{{AdminNewCatalogPriceRule.websites}}" parameterArray="['FirstWebsite', 'SecondWebsite']" stepKey="selectWebsite"/> - </actionGroup> - <actionGroup name="CreateCatalogPriceRuleViaTheUi"> - <arguments> - <argument name="catalogRule" defaultValue="_defaultCatalogRule"/> - <argument name="customerGroup" defaultValue="General" type="string"/> - <argument name="disregardRules" defaultValue="Yes" type="string"/> - </arguments> - - <fillField selector="{{AdminNewCatalogPriceRule.ruleName}}" userInput="{{catalogRule.name}}" stepKey="fillName1"/> - <fillField selector="{{AdminNewCatalogPriceRule.description}}" userInput="{{catalogRule.description}}" stepKey="fillDescription1"/> - <selectOption selector="{{AdminNewCatalogPriceRule.websites}}" userInput="{{catalogRule.website_ids[0]}}" stepKey="selectWebSite1"/> - <selectOption selector="{{AdminNewCatalogPriceRule.customerGroups}}" userInput="{{customerGroup}}" stepKey="selectCustomerGroup1"/> - <scrollTo selector="{{AdminNewCatalogPriceRule.actionsTab}}" stepKey="scrollToActionTab1"/> - <click selector="{{AdminNewCatalogPriceRule.actionsTab}}" stepKey="openActionDropdown1"/> - <selectOption selector="{{AdminNewCatalogPriceRuleActions.apply}}" userInput="{{catalogRule.simple_action}}" stepKey="discountType1"/> - <fillField selector="{{AdminNewCatalogPriceRuleActions.discountAmount}}" userInput="{{catalogRule.discount_amount}}" stepKey="fillDiscountValue1"/> - <selectOption selector="{{AdminNewCatalogPriceRuleActions.disregardRules}}" userInput="{{disregardRules}}" stepKey="discardSubsequentRules1"/> - <waitForPageLoad stepKey="waitForPageToLoad1"/> - <scrollToTopOfPage stepKey="scrollToTop1"/> - </actionGroup> - - <actionGroup name="CreateCatalogPriceRuleConditionWithAttribute"> - <annotations> - <description>Add Conditional Requirements to a Catalog Price Rule from the creation/edit page.</description> - </annotations> - <arguments> - <argument name="attributeName" type="string"/> - <argument name="targetValue" type="string"/> - <argument name="targetSelectValue" type="string"/> - </arguments> - - <click selector="{{AdminNewCatalogPriceRule.conditionsTab}}" stepKey="openConditionsTab"/> - <waitForPageLoad stepKey="waitForConditionTabOpened"/> - <click selector="{{AdminNewCatalogPriceRuleConditions.newCondition}}" stepKey="addNewCondition"/> - <selectOption selector="{{AdminNewCatalogPriceRuleConditions.conditionSelect('1')}}" userInput="{{attributeName}}" stepKey="selectTypeCondition"/> - <waitForElement selector="{{AdminNewCatalogPriceRuleConditions.targetEllipsisValue('1', targetValue)}}" stepKey="waitForIsTarget"/> - <click selector="{{AdminNewCatalogPriceRuleConditions.targetEllipsisValue('1', 'is')}}" stepKey="clickOnIs"/> - <selectOption selector="{{AdminNewCatalogPriceRuleConditions.targetSelect('1')}}" userInput="{{targetSelectValue}}" stepKey="selectTargetCondition"/> - <click selector="{{AdminNewCatalogPriceRule.fromDateButton}}" stepKey="clickFromCalender"/> - <click selector="{{AdminNewCatalogPriceRule.todayDate}}" stepKey="clickFromToday"/> - </actionGroup> - - <!-- Apply all of the saved catalog price rules --> - <actionGroup name="applyCatalogPriceRules"> - <annotations> - <description>Goes to the Catalog Price Rule grid page. Clicks on Apply Rules. Validates that the Success Message is present and correct.</description> - </annotations> - - <amOnPage stepKey="goToPriceRulePage" url="{{CatalogRulePage.url}}"/> - <waitForPageLoad stepKey="waitForPriceRulePage"/> - <click stepKey="applyRules" selector="{{AdminCatalogPriceRuleGrid.applyRules}}"/> - <see stepKey="assertSuccess" selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="Updated rules applied."/> - </actionGroup> - - <!--Add Catalog Rule Condition With product SKU--> - <actionGroup name="newCatalogPriceRuleByUIWithConditionIsSKU" extends="newCatalogPriceRuleByUI"> - <annotations> - <description>EXTENDS: newCatalogPriceRuleByUI. Add a Catalog Price Rule Condition based on the provided SKU.</description> - </annotations> - <arguments> - <argument name="productSku"/> - </arguments> - - <click selector="{{AdminNewCatalogPriceRule.conditionsTab}}" after="discardSubsequentRules" stepKey="openConditionsTab"/> - <waitForPageLoad after="openConditionsTab" stepKey="waitForConditionTabOpened"/> - <click selector="{{AdminNewCatalogPriceRuleConditions.newCondition}}" after="waitForConditionTabOpened" stepKey="addNewCondition"/> - <selectOption selector="{{AdminNewCatalogPriceRuleConditions.conditionSelect('1')}}" userInput="Magento\CatalogRule\Model\Rule\Condition\Product|sku" after="addNewCondition" stepKey="selectTypeCondition"/> - <waitForPageLoad after="selectTypeCondition" stepKey="waitForConditionChosed"/> - <click selector="{{AdminNewCatalogPriceRuleConditions.targetEllipsis('1')}}" after="waitForConditionChosed" stepKey="clickEllipsis"/> - <fillField selector="{{AdminNewCatalogPriceRuleConditions.targetInput('1', '1')}}" userInput="{{productSku}}" after="clickEllipsis" stepKey="fillProductSku"/> - <click selector="{{AdminNewCatalogPriceRuleConditions.applyButton('1', '1')}}" after="fillProductSku" stepKey="clickApply"/> - </actionGroup> - - <!--Add Catalog Rule Condition With Category--> - <actionGroup name="newCatalogPriceRuleByUIWithConditionIsCategory" extends="newCatalogPriceRuleByUI"> - <annotations> - <description>EXTENDS: newCatalogPriceRuleByUI. Add a Catalog Price Rule Condition based on the provided Category ID.</description> - </annotations> - <arguments> - <argument name="categoryId"/> - </arguments> - - <click selector="{{AdminNewCatalogPriceRule.conditionsTab}}" after="discardSubsequentRules" stepKey="openConditionsTab"/> - <waitForPageLoad after="openConditionsTab" stepKey="waitForConditionTabOpened"/> - <click selector="{{AdminNewCatalogPriceRuleConditions.newCondition}}" after="waitForConditionTabOpened" stepKey="addNewCondition"/> - <selectOption selector="{{AdminNewCatalogPriceRuleConditions.conditionSelect('1')}}" userInput="Magento\CatalogRule\Model\Rule\Condition\Product|category_ids" after="addNewCondition" stepKey="selectTypeCondition"/> - <waitForPageLoad after="selectTypeCondition" stepKey="waitForConditionChosed"/> - <click selector="{{AdminNewCatalogPriceRuleConditions.targetEllipsis('1')}}" after="waitForConditionChosed" stepKey="clickEllipsis"/> - <fillField selector="{{AdminNewCatalogPriceRuleConditions.targetInput('1', '1')}}" userInput="{{categoryId}}" after="clickEllipsis" stepKey="fillCategoryId"/> - <click selector="{{AdminNewCatalogPriceRuleConditions.applyButton('1', '1')}}" after="fillCategoryId" stepKey="clickApply"/> - </actionGroup> - - <actionGroup name="selectGeneralCustomerGroupActionGroup"> - <annotations> - <description>Selects the 'General' Customer Group for a Catalog Price Rule on the creation/edit page.</description> - </annotations> - - <selectOption selector="{{AdminNewCatalogPriceRule.customerGroups}}" userInput="General" stepKey="selectCustomerGroup"/> - </actionGroup> - - <actionGroup name="selectNotLoggedInCustomerGroupActionGroup"> - <annotations> - <description>Selects the 'NOT LOGGED IN' Customer Group for a Catalog Price Rule on the creation/edit page.</description> - </annotations> - - <selectOption selector="{{AdminNewCatalogPriceRule.customerGroups}}" userInput="NOT LOGGED IN" stepKey="selectCustomerGroup"/> - </actionGroup> - - <!-- Open rule for Edit --> - <actionGroup name="OpenCatalogPriceRule"> - <arguments> - <argument name="ruleName" type="string" defaultValue="CustomCatalogRule.name"/> - </arguments> - <amOnPage url="{{AdminCatalogPriceRuleGridPage.url}}" stepKey="goToAdminCatalogPriceRuleGridPage"/> - <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingFilters"/> - <fillField selector="{{AdminCatalogPriceRuleGridSection.filterByRuleName}}" userInput="{{ruleName}}" stepKey="filterByRuleName"/> - <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickSearch"/> - <click selector="{{AdminGridTableSection.row('1')}}" stepKey="clickEdit"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - </actionGroup> - - <actionGroup name="RemoveCatalogPriceRule" extends="OpenCatalogPriceRule"> - <click selector="{{AdminMainActionsSection.delete}}" after="waitForPageLoad" stepKey="clickToDelete"/> - <waitForElementVisible selector="{{AdminConfirmationModalSection.ok}}" after="clickToDelete" stepKey="waitForElementVisible"/> - <click selector="{{AdminConfirmationModalSection.ok}}" after="waitForElementVisible" stepKey="clickToConfirm"/> - <waitForElementVisible selector="{{AdminMessagesSection.success}}" after="clickToConfirm" stepKey="waitForSuccessMessage"/> - <see selector="{{AdminMessagesSection.success}}" userInput="You deleted the rule." after="waitForSuccessMessage" stepKey="verifyRuleIsDeleted"/> - </actionGroup> - - <actionGroup name="AdminFillCatalogRuleConditionActionGroup"> - <annotations> - <description>Clicks on the Conditions tab. Fills in the provided condition for Catalog Price Rule.</description> - </annotations> - <arguments> - <argument name="condition" type="string" defaultValue="{{CatalogRuleProductConditions.categoryIds}}"/> - <argument name="conditionOperator" type="string" defaultValue="is"/> - <argument name="conditionValue" type="string" defaultValue="2"/> - </arguments> - - <conditionalClick selector="{{AdminNewCatalogPriceRule.conditionsTab}}" dependentSelector="{{AdminNewCatalogPriceRuleConditions.newCondition}}" visible="false" stepKey="openConditionsTab"/> - <waitForElementVisible selector="{{AdminNewCatalogPriceRuleConditions.newCondition}}" stepKey="waitForAddConditionButton"/> - <click selector="{{AdminNewCatalogPriceRuleConditions.newCondition}}" stepKey="addNewCondition"/> - <selectOption selector="{{AdminNewCatalogPriceRuleConditions.conditionSelect('1')}}" userInput="{{condition}}" stepKey="selectTypeCondition"/> - <click selector="{{AdminNewCatalogPriceRuleConditions.condition('is')}}" stepKey="clickOnOperator"/> - <selectOption selector="{{AdminNewCatalogPriceRuleConditions.activeOperatorSelect}}" userInput="{{conditionOperator}}" stepKey="selectCondition"/> - <!-- In case we are choosing already selected value - select is not closed automatically --> - <conditionalClick selector="{{AdminNewCatalogPriceRuleConditions.condition('...')}}" dependentSelector="{{AdminNewCatalogPriceRuleConditions.activeOperatorSelect}}" visible="true" stepKey="closeSelect"/> - <click selector="{{AdminNewCatalogPriceRuleConditions.condition('...')}}" stepKey="clickToChooseOption3"/> - <waitForElementVisible selector="{{AdminNewCatalogPriceRuleConditions.activeValueInput}}" stepKey="waitForValueInput"/> - <fillField selector="{{AdminNewCatalogPriceRuleConditions.activeValueInput}}" userInput="{{conditionValue}}" stepKey="fillConditionValue"/> - <click selector="{{AdminNewCatalogPriceRuleConditions.activeConditionApplyButton}}" stepKey="clickApply"/> - <waitForElementNotVisible selector="{{AdminNewCatalogPriceRuleConditions.activeConditionApplyButton}}" stepKey="waitForApplyButtonInvisibility"/> - </actionGroup> - - <actionGroup name="newCatalogPriceRuleWithInvalidData"> - <annotations> - <description>Goes to the Catalog Price Rule grid. Clicks on Add. Fills in the provided Catalog Rule details with invalid data.</description> - </annotations> - <arguments> - <argument name="catalogRule" defaultValue="catalogRuleWithInvalid"/> - </arguments> - - <!-- Go to the admin Catalog rule grid and add a new one --> - <amOnPage stepKey="goToPriceRulePage" url="{{CatalogRulePage.url}}"/> - <waitForPageLoad stepKey="waitForPriceRulePage"/> - - <click stepKey="addNewRule" selector="{{AdminGridMainControls.add}}"/> - <fillField stepKey="fillPriority" selector="{{AdminNewCatalogPriceRule.priority}}" userInput="{{catalogRule.priority}}"/> - <scrollToTopOfPage stepKey="scrollToTop"/> - <click selector="{{AdminNewCatalogPriceRule.save}}" stepKey="clickSave"/> - <waitForPageLoad stepKey="waitForApplied"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CreateCatalogPriceRuleActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CreateCatalogPriceRuleActionGroup.xml new file mode 100644 index 0000000000000..f43cd44c50de2 --- /dev/null +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CreateCatalogPriceRuleActionGroup.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateCatalogPriceRuleActionGroup"> + <annotations> + <description>Clicks on the Add button. Fills Rule Name, Description, Website and Discount Value.</description> + </annotations> + <arguments> + <argument name="catalogRule" defaultValue="_defaultCatalogRule"/> + </arguments> + <click stepKey="addNewRule" selector="{{AdminGridMainControls.add}}"/> + <fillField selector="{{AdminNewCatalogPriceRule.ruleName}}" userInput="{{catalogRule.name}}" stepKey="fillName" /> + <click stepKey="selectActive" selector="{{AdminCategoryBasicFieldSection.enableCategoryLabel}}"/> + <fillField selector="{{AdminNewCatalogPriceRule.description}}" userInput="{{catalogRule.description}}" stepKey="fillDescription" /> + <selectOption selector="{{AdminNewCatalogPriceRule.websites}}" parameterArray="{{catalogRule.website_ids}}" stepKey="selectSite" /> + <click stepKey="openActionDropdown" selector="{{AdminNewCatalogPriceRule.actionsTab}}"/> + <fillField stepKey="fillDiscountValue" selector="{{AdminNewCatalogPriceRuleActions.discountAmount}}" userInput="{{catalogRule.discount_amount}}"/> + <scrollToTopOfPage stepKey="scrollToTop"/> + <click selector="{{AdminNewCatalogPriceRule.save}}" stepKey="clickSave"/> + <waitForPageLoad stepKey="waitForApplied"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CreateCatalogPriceRuleConditionWithAttributeActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CreateCatalogPriceRuleConditionWithAttributeActionGroup.xml new file mode 100644 index 0000000000000..97d1324f7c4fa --- /dev/null +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CreateCatalogPriceRuleConditionWithAttributeActionGroup.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateCatalogPriceRuleConditionWithAttributeActionGroup"> + <annotations> + <description>Add Conditional Requirements to a Catalog Price Rule from the creation/edit page.</description> + </annotations> + <arguments> + <argument name="attributeName" type="string"/> + <argument name="targetValue" type="string"/> + <argument name="targetSelectValue" type="string"/> + </arguments> + + <click selector="{{AdminNewCatalogPriceRule.conditionsTab}}" stepKey="openConditionsTab"/> + <waitForPageLoad stepKey="waitForConditionTabOpened"/> + <click selector="{{AdminNewCatalogPriceRuleConditions.newCondition}}" stepKey="addNewCondition"/> + <selectOption selector="{{AdminNewCatalogPriceRuleConditions.conditionSelect('1')}}" userInput="{{attributeName}}" stepKey="selectTypeCondition"/> + <waitForElement selector="{{AdminNewCatalogPriceRuleConditions.targetEllipsisValue('1', targetValue)}}" stepKey="waitForIsTarget"/> + <click selector="{{AdminNewCatalogPriceRuleConditions.targetEllipsisValue('1', 'is')}}" stepKey="clickOnIs"/> + <selectOption selector="{{AdminNewCatalogPriceRuleConditions.targetSelect('1')}}" userInput="{{targetSelectValue}}" stepKey="selectTargetCondition"/> + <click selector="{{AdminNewCatalogPriceRule.fromDateButton}}" stepKey="clickFromCalender"/> + <click selector="{{AdminNewCatalogPriceRule.todayDate}}" stepKey="clickFromToday"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CreateCatalogPriceRuleViaTheUiActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CreateCatalogPriceRuleViaTheUiActionGroup.xml new file mode 100644 index 0000000000000..f549102ecd140 --- /dev/null +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CreateCatalogPriceRuleViaTheUiActionGroup.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateCatalogPriceRuleViaTheUiActionGroup"> + <arguments> + <argument name="catalogRule" defaultValue="_defaultCatalogRule"/> + <argument name="customerGroup" defaultValue="General" type="string"/> + <argument name="disregardRules" defaultValue="Yes" type="string"/> + </arguments> + + <fillField selector="{{AdminNewCatalogPriceRule.ruleName}}" userInput="{{catalogRule.name}}" stepKey="fillName1"/> + <fillField selector="{{AdminNewCatalogPriceRule.description}}" userInput="{{catalogRule.description}}" stepKey="fillDescription1"/> + <selectOption selector="{{AdminNewCatalogPriceRule.websites}}" userInput="{{catalogRule.website_ids[0]}}" stepKey="selectWebSite1"/> + <selectOption selector="{{AdminNewCatalogPriceRule.customerGroups}}" userInput="{{customerGroup}}" stepKey="selectCustomerGroup1"/> + <scrollTo selector="{{AdminNewCatalogPriceRule.actionsTab}}" stepKey="scrollToActionTab1"/> + <click selector="{{AdminNewCatalogPriceRule.actionsTab}}" stepKey="openActionDropdown1"/> + <selectOption selector="{{AdminNewCatalogPriceRuleActions.apply}}" userInput="{{catalogRule.simple_action}}" stepKey="discountType1"/> + <fillField selector="{{AdminNewCatalogPriceRuleActions.discountAmount}}" userInput="{{catalogRule.discount_amount}}" stepKey="fillDiscountValue1"/> + <selectOption selector="{{AdminNewCatalogPriceRuleActions.disregardRules}}" userInput="{{disregardRules}}" stepKey="discardSubsequentRules1"/> + <waitForPageLoad stepKey="waitForPageToLoad1"/> + <scrollToTopOfPage stepKey="scrollToTop1"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/NewCatalogPriceRuleByUIWithConditionIsCategoryActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/NewCatalogPriceRuleByUIWithConditionIsCategoryActionGroup.xml new file mode 100644 index 0000000000000..9b5a482c214d4 --- /dev/null +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/NewCatalogPriceRuleByUIWithConditionIsCategoryActionGroup.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="NewCatalogPriceRuleByUIWithConditionIsCategoryActionGroup" extends="NewCatalogPriceRuleByUIActionGroup"> + <annotations> + <description>EXTENDS: newCatalogPriceRuleByUI. Add a Catalog Price Rule Condition based on the provided Category ID.</description> + </annotations> + <arguments> + <argument name="categoryId"/> + </arguments> + + <click selector="{{AdminNewCatalogPriceRule.conditionsTab}}" after="discardSubsequentRules" stepKey="openConditionsTab"/> + <waitForPageLoad after="openConditionsTab" stepKey="waitForConditionTabOpened"/> + <click selector="{{AdminNewCatalogPriceRuleConditions.newCondition}}" after="waitForConditionTabOpened" stepKey="addNewCondition"/> + <selectOption selector="{{AdminNewCatalogPriceRuleConditions.conditionSelect('1')}}" userInput="Magento\CatalogRule\Model\Rule\Condition\Product|category_ids" after="addNewCondition" stepKey="selectTypeCondition"/> + <waitForPageLoad after="selectTypeCondition" stepKey="waitForConditionChosed"/> + <click selector="{{AdminNewCatalogPriceRuleConditions.targetEllipsis('1')}}" after="waitForConditionChosed" stepKey="clickEllipsis"/> + <fillField selector="{{AdminNewCatalogPriceRuleConditions.targetInput('1', '1')}}" userInput="{{categoryId}}" after="clickEllipsis" stepKey="fillCategoryId"/> + <click selector="{{AdminNewCatalogPriceRuleConditions.applyButton('1', '1')}}" after="fillCategoryId" stepKey="clickApply"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/NewCatalogPriceRuleByUIWithConditionIsSKUActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/NewCatalogPriceRuleByUIWithConditionIsSKUActionGroup.xml new file mode 100644 index 0000000000000..9d25ffa948ad1 --- /dev/null +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/NewCatalogPriceRuleByUIWithConditionIsSKUActionGroup.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="NewCatalogPriceRuleByUIWithConditionIsSKUActionGroup" extends="NewCatalogPriceRuleByUIActionGroup"> + <annotations> + <description>EXTENDS: newCatalogPriceRuleByUI. Add a Catalog Price Rule Condition based on the provided SKU.</description> + </annotations> + <arguments> + <argument name="productSku"/> + </arguments> + + <click selector="{{AdminNewCatalogPriceRule.conditionsTab}}" after="discardSubsequentRules" stepKey="openConditionsTab"/> + <waitForPageLoad after="openConditionsTab" stepKey="waitForConditionTabOpened"/> + <click selector="{{AdminNewCatalogPriceRuleConditions.newCondition}}" after="waitForConditionTabOpened" stepKey="addNewCondition"/> + <selectOption selector="{{AdminNewCatalogPriceRuleConditions.conditionSelect('1')}}" userInput="Magento\CatalogRule\Model\Rule\Condition\Product|sku" after="addNewCondition" stepKey="selectTypeCondition"/> + <waitForPageLoad after="selectTypeCondition" stepKey="waitForConditionChosed"/> + <click selector="{{AdminNewCatalogPriceRuleConditions.targetEllipsis('1')}}" after="waitForConditionChosed" stepKey="clickEllipsis"/> + <fillField selector="{{AdminNewCatalogPriceRuleConditions.targetInput('1', '1')}}" userInput="{{productSku}}" after="clickEllipsis" stepKey="fillProductSku"/> + <click selector="{{AdminNewCatalogPriceRuleConditions.applyButton('1', '1')}}" after="fillProductSku" stepKey="clickApply"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/NewCatalogPriceRuleWithInvalidDataActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/NewCatalogPriceRuleWithInvalidDataActionGroup.xml new file mode 100644 index 0000000000000..5fd56c81734b6 --- /dev/null +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/NewCatalogPriceRuleWithInvalidDataActionGroup.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="NewCatalogPriceRuleWithInvalidDataActionGroup"> + <annotations> + <description>Goes to the Catalog Price Rule grid. Clicks on Add. Fills in the provided Catalog Rule details with invalid data.</description> + </annotations> + <arguments> + <argument name="catalogRule" defaultValue="catalogRuleWithInvalid"/> + </arguments> + + <!-- Go to the admin Catalog rule grid and add a new one --> + <amOnPage stepKey="goToPriceRulePage" url="{{CatalogRulePage.url}}"/> + <waitForPageLoad stepKey="waitForPriceRulePage"/> + + <click stepKey="addNewRule" selector="{{AdminGridMainControls.add}}"/> + <fillField stepKey="fillPriority" selector="{{AdminNewCatalogPriceRule.priority}}" userInput="{{catalogRule.priority}}"/> + <scrollToTopOfPage stepKey="scrollToTop"/> + <click selector="{{AdminNewCatalogPriceRule.save}}" stepKey="clickSave"/> + <waitForPageLoad stepKey="waitForApplied"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/OpenCatalogPriceRuleActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/OpenCatalogPriceRuleActionGroup.xml new file mode 100644 index 0000000000000..c810d9579df92 --- /dev/null +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/OpenCatalogPriceRuleActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="OpenCatalogPriceRuleActionGroup"> + <arguments> + <argument name="ruleName" type="string" defaultValue="CustomCatalogRule.name"/> + </arguments> + <amOnPage url="{{AdminCatalogPriceRuleGridPage.url}}" stepKey="goToAdminCatalogPriceRuleGridPage"/> + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingFilters"/> + <fillField selector="{{AdminCatalogPriceRuleGridSection.filterByRuleName}}" userInput="{{ruleName}}" stepKey="filterByRuleName"/> + <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickSearch"/> + <click selector="{{AdminGridTableSection.row('1')}}" stepKey="clickEdit"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/RemoveCatalogPriceRuleActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/RemoveCatalogPriceRuleActionGroup.xml new file mode 100644 index 0000000000000..7c7ecba3ff74f --- /dev/null +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/RemoveCatalogPriceRuleActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="RemoveCatalogPriceRuleActionGroup" extends="OpenCatalogPriceRuleActionGroup"> + <click selector="{{AdminMainActionsSection.delete}}" after="waitForPageLoad" stepKey="clickToDelete"/> + <waitForElementVisible selector="{{AdminConfirmationModalSection.ok}}" after="clickToDelete" stepKey="waitForElementVisible"/> + <click selector="{{AdminConfirmationModalSection.ok}}" after="waitForElementVisible" stepKey="clickToConfirm"/> + <waitForElementVisible selector="{{AdminMessagesSection.success}}" after="clickToConfirm" stepKey="waitForSuccessMessage"/> + <see selector="{{AdminMessagesSection.success}}" userInput="You deleted the rule." after="waitForSuccessMessage" stepKey="verifyRuleIsDeleted"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/SelectGeneralCustomerGroupActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/SelectGeneralCustomerGroupActionGroup.xml new file mode 100644 index 0000000000000..cc4981f73f3f8 --- /dev/null +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/SelectGeneralCustomerGroupActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SelectGeneralCustomerGroupActionGroup"> + <annotations> + <description>Selects the 'General' Customer Group for a Catalog Price Rule on the creation/edit page.</description> + </annotations> + + <selectOption selector="{{AdminNewCatalogPriceRule.customerGroups}}" userInput="General" stepKey="selectCustomerGroup"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/SelectNotLoggedInCustomerGroupActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/SelectNotLoggedInCustomerGroupActionGroup.xml new file mode 100644 index 0000000000000..38b64803acadd --- /dev/null +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/SelectNotLoggedInCustomerGroupActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SelectNotLoggedInCustomerGroupActionGroup"> + <annotations> + <description>Selects the 'NOT LOGGED IN' Customer Group for a Catalog Price Rule on the creation/edit page.</description> + </annotations> + + <selectOption selector="{{AdminNewCatalogPriceRule.customerGroups}}" userInput="NOT LOGGED IN" stepKey="selectCustomerGroup"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithSpecialPricesTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithSpecialPricesTest.xml index 4df08fcca696b..41fbc33bbbec0 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithSpecialPricesTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithSpecialPricesTest.xml @@ -112,12 +112,12 @@ <actionGroup ref="saveProductForm" stepKey="saveSecondProduct"/> <!-- Create a new catalog price rule --> - <actionGroup ref="newCatalogPriceRuleByUIWithConditionIsCategory" stepKey="newCatalogPriceRuleByUIWithConditionIsCategory"> + <actionGroup ref="NewCatalogPriceRuleByUIWithConditionIsCategoryActionGroup" stepKey="newCatalogPriceRuleByUIWithConditionIsCategory"> <argument name="categoryId" value="$createCategory.id$"/> </actionGroup> <!-- Select not logged in customer group --> - <actionGroup ref="selectNotLoggedInCustomerGroupActionGroup" stepKey="selectNotLoggedInCustomerGroup"/> + <actionGroup ref="SelectNotLoggedInCustomerGroupActionGroup" stepKey="selectNotLoggedInCustomerGroup"/> <!-- Save and apply the new catalog price rule --> <actionGroup ref="SaveAndApplyCatalogPriceRuleActionGroup" stepKey="saveAndApplyCatalogPriceRule"/> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminCreateCatalogPriceRuleTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminCreateCatalogPriceRuleTest.xml index ee61af180d350..4cd7df106a131 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminCreateCatalogPriceRuleTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminCreateCatalogPriceRuleTest.xml @@ -31,7 +31,7 @@ <!-- log in and create the price rule --> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - <actionGroup stepKey="createNewPriceRule" ref="newCatalogPriceRuleByUI"/> + <actionGroup stepKey="createNewPriceRule" ref="NewCatalogPriceRuleByUIActionGroup"/> <actionGroup stepKey="selectNotLoggedInCustomerGroup" ref="selectNotLoggedInCustomerGroup"/> <click stepKey="saveAndApply" selector="{{AdminNewCatalogPriceRule.saveAndApply}}"/> <see stepKey="assertSuccess" selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the rule."/> @@ -80,7 +80,7 @@ <group value="CatalogRule"/> </annotations> <before> - <actionGroup stepKey="createNewPriceRule" ref="newCatalogPriceRuleByUI"> + <actionGroup stepKey="createNewPriceRule" ref="NewCatalogPriceRuleByUIActionGroup"> <argument name="catalogRule" value="CatalogRuleByFixed"/> </actionGroup> </before> @@ -103,7 +103,7 @@ <group value="CatalogRule"/> </annotations> <before> - <actionGroup stepKey="createNewPriceRule" ref="newCatalogPriceRuleByUI"> + <actionGroup stepKey="createNewPriceRule" ref="NewCatalogPriceRuleByUIActionGroup"> <argument name="catalogRule" value="CatalogRuleToPercent"/> </actionGroup> </before> @@ -126,7 +126,7 @@ <group value="CatalogRule"/> </annotations> <before> - <actionGroup stepKey="createNewPriceRule" ref="newCatalogPriceRuleByUI"> + <actionGroup stepKey="createNewPriceRule" ref="NewCatalogPriceRuleByUIActionGroup"> <argument name="catalogRule" value="CatalogRuleToFixed"/> </actionGroup> </before> @@ -172,7 +172,7 @@ </after> <!-- Create a catalog rule for the NOT LOGGED IN customer group --> - <actionGroup ref="newCatalogPriceRuleByUI" stepKey="createNewPriceRule"/> + <actionGroup ref="NewCatalogPriceRuleByUIActionGroup" stepKey="createNewPriceRule"/> <actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="selectNotLoggedInCustomerGroup"/> <click selector="{{AdminNewCatalogPriceRule.saveAndApply}}" stepKey="saveAndApply"/> <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the rule." stepKey="assertSuccess"/> @@ -213,7 +213,7 @@ <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> </after> - <actionGroup ref="newCatalogPriceRuleWithInvalidData" stepKey="createNewPriceRule"> + <actionGroup ref="NewCatalogPriceRuleWithInvalidDataActionGroup" stepKey="createNewPriceRule"> <argument name="catalogRule" value="catalogRuleWithInvalid"/> </actionGroup> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleEntityTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleEntityTest.xml index d80759531ecae..e3c5862d4f0e9 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleEntityTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleEntityTest.xml @@ -31,7 +31,7 @@ <amOnPage url="{{AdminNewCatalogPriceRulePage.url}}" stepKey="openNewCatalogPriceRulePage"/> <waitForPageLoad stepKey="waitForPageToLoad1"/> - <actionGroup ref="CreateCatalogPriceRuleViaTheUi" stepKey="createCatalogPriceRuleViaTheUi1"> + <actionGroup ref="CreateCatalogPriceRuleViaTheUiActionGroup" stepKey="createCatalogPriceRuleViaTheUi1"> <argument name="catalogRule" value="DeleteActiveCatalogPriceRuleWithConditions"/> <argument name="customerGroup" value="General"/> <argument name="disregardRules" value="Yes"/> @@ -163,7 +163,7 @@ <amOnPage url="{{AdminNewCatalogPriceRulePage.url}}" stepKey="openNewCatalogPriceRulePage"/> <waitForPageLoad stepKey="waitForPageToLoad1"/> - <actionGroup ref="CreateCatalogPriceRuleViaTheUi" stepKey="createCatalogPriceRuleViaTheUi1"> + <actionGroup ref="CreateCatalogPriceRuleViaTheUiActionGroup" stepKey="createCatalogPriceRuleViaTheUi1"> <argument name="catalogRule" value="DeleteActiveCatalogPriceRuleWithConditions"/> <argument name="customerGroup" value="General"/> <argument name="disregardRules" value="Yes"/> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleTest.xml index 16fbca2697702..71bbeccaaf541 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleTest.xml @@ -47,7 +47,7 @@ </after> <!-- Create a catalog price rule --> - <actionGroup ref="newCatalogPriceRuleByUI" stepKey="createNewPriceRule"/> + <actionGroup ref="NewCatalogPriceRuleByUIActionGroup" stepKey="createNewPriceRule"/> <actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="selectNotLoggedInCustomerGroup"/> <click selector="{{AdminNewCatalogPriceRule.saveAndApply}}" stepKey="saveAndApply"/> <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the rule." stepKey="assertSuccess"/> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminEnableAttributeIsUndefinedCatalogPriceRuleTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminEnableAttributeIsUndefinedCatalogPriceRuleTest.xml index 54bf243c4cde6..da855b08cf390 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminEnableAttributeIsUndefinedCatalogPriceRuleTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminEnableAttributeIsUndefinedCatalogPriceRuleTest.xml @@ -70,11 +70,11 @@ <!--Create catalog price rule--> <amOnPage url="{{CatalogRulePage.url}}" stepKey="goToPriceRulePage"/> <waitForPageLoad stepKey="waitForPriceRulePage"/> - <actionGroup ref="createCatalogPriceRule" stepKey="createCatalogPriceRule"> + <actionGroup ref="CreateCatalogPriceRuleActionGroup" stepKey="createCatalogPriceRule"> <argument name="catalogRule" value="CatalogRuleWithAllCustomerGroups"/> </actionGroup> - <actionGroup ref="selectNotLoggedInCustomerGroupActionGroup" stepKey="selectCustomerGroup"/> - <actionGroup ref="CreateCatalogPriceRuleConditionWithAttribute" stepKey="createCatalogPriceRuleCondition"> + <actionGroup ref="SelectNotLoggedInCustomerGroupActionGroup" stepKey="selectCustomerGroup"/> + <actionGroup ref="CreateCatalogPriceRuleConditionWithAttributeActionGroup" stepKey="createCatalogPriceRuleCondition"> <argument name="attributeName" value="$$createProductAttribute.attribute[frontend_labels][0][label]$$"/> <argument name="targetValue" value="is"/> <argument name="targetSelectValue" value="is undefined"/> @@ -113,11 +113,11 @@ <!--Create new Catalog Price Rule--> <amOnPage url="{{CatalogRulePage.url}}" stepKey="goToPriceRulePage1"/> <waitForPageLoad stepKey="waitForPriceRulePage1"/> - <actionGroup ref="createCatalogPriceRule" stepKey="createCatalogPriceRule1"> + <actionGroup ref="CreateCatalogPriceRuleActionGroup" stepKey="createCatalogPriceRule1"> <argument name="catalogRule" value="CatalogRuleWithAllCustomerGroups"/> </actionGroup> - <actionGroup ref="selectNotLoggedInCustomerGroupActionGroup" stepKey="selectCustomerGroup1"/> - <actionGroup ref="CreateCatalogPriceRuleConditionWithAttribute" stepKey="createCatalogPriceRuleCondition1"> + <actionGroup ref="SelectNotLoggedInCustomerGroupActionGroup" stepKey="selectCustomerGroup1"/> + <actionGroup ref="CreateCatalogPriceRuleConditionWithAttributeActionGroup" stepKey="createCatalogPriceRuleCondition1"> <argument name="attributeName" value="$$createSecondProductAttribute.attribute[frontend_labels][0][label]$$"/> <argument name="targetValue" value="is"/> <argument name="targetSelectValue" value="is undefined"/> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml index b9e7bfb4d41e4..2f12df8b75fc6 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml @@ -101,12 +101,12 @@ <deleteData createDataKey="createCategory" stepKey="deleteApiCategory"/> </after> <!-- Begin creating a new catalog price rule --> - <actionGroup ref="newCatalogPriceRuleByUIWithConditionIsCategory" stepKey="newCatalogPriceRuleByUIWithConditionIsCategory"> + <actionGroup ref="NewCatalogPriceRuleByUIWithConditionIsCategoryActionGroup" stepKey="newCatalogPriceRuleByUIWithConditionIsCategory"> <argument name ="categoryId" value="$createCategory.id$"/> </actionGroup> <!-- Select not logged in customer group --> - <actionGroup ref="selectNotLoggedInCustomerGroupActionGroup" stepKey="selectNotLoggedInCustomerGroup"/> + <actionGroup ref="SelectNotLoggedInCustomerGroupActionGroup" stepKey="selectNotLoggedInCustomerGroup"/> <!-- Save and apply the new catalog price rule --> <actionGroup ref="SaveAndApplyCatalogPriceRuleActionGroup" stepKey="saveAndApplyCatalogPriceRule"/> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductAndFixedMethodTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductAndFixedMethodTest.xml index 3405d0c4e776d..956a2e07fc6b4 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductAndFixedMethodTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductAndFixedMethodTest.xml @@ -53,22 +53,22 @@ <actionGroup ref="logout" stepKey="logout"/> </after> <!-- 1. Begin creating a new catalog price rule --> - <actionGroup ref="newCatalogPriceRuleByUIWithConditionIsCategory" stepKey="newCatalogPriceRuleByUIWithConditionIsCategory"> + <actionGroup ref="NewCatalogPriceRuleByUIWithConditionIsCategoryActionGroup" stepKey="newCatalogPriceRuleByUIWithConditionIsCategory"> <argument name ="categoryId" value="$createCategory.id$"/> <argument name ="catalogRule" value="CatalogRuleByFixed"/> </actionGroup> <!-- Select not logged in customer group --> - <actionGroup ref="selectNotLoggedInCustomerGroupActionGroup" stepKey="selectNotLoggedInCustomerGroup"/> + <actionGroup ref="SelectNotLoggedInCustomerGroupActionGroup" stepKey="selectNotLoggedInCustomerGroup"/> <!-- Save and apply the new catalog price rule --> <actionGroup ref="SaveAndApplyCatalogPriceRuleActionGroup" stepKey="saveAndApplyCatalogPriceRule"/> <magentoCLI command="indexer:reindex" stepKey="reindex"/> <magentoCLI command="cache:flush" stepKey="flushCache"/> - + <!-- Navigate to category on store front --> <amOnPage url="{{StorefrontProductPage.url($createCategory.name$)}}" stepKey="goToCategoryPage"/> - + <!-- Check product 1 name on store front category page --> <actionGroup ref="AssertProductDetailsOnStorefrontActionGroup" stepKey="storefrontProduct1Name"> <argument name="productInfo" value="$createProduct1.name$"/> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductForNewCustomerGroupTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductForNewCustomerGroupTest.xml index c3bcde92bd1f2..e5e3cf9ead5e5 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductForNewCustomerGroupTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductForNewCustomerGroupTest.xml @@ -64,7 +64,7 @@ <actionGroup ref="logout" stepKey="logout"/> </after> <!-- 1. Begin creating a new catalog price rule --> - <actionGroup ref="newCatalogPriceRuleByUIWithConditionIsCategory" stepKey="newCatalogPriceRuleByUIWithConditionIsCategory"> + <actionGroup ref="NewCatalogPriceRuleByUIWithConditionIsCategoryActionGroup" stepKey="newCatalogPriceRuleByUIWithConditionIsCategory"> <argument name ="categoryId" value="$createCategory.id$"/> <argument name="catalogRule" value="CatalogRuleByFixed"/> </actionGroup> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductWithCustomOptionsTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductWithCustomOptionsTest.xml index a251ee1e235d0..166d202ec2410 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductWithCustomOptionsTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductWithCustomOptionsTest.xml @@ -66,12 +66,12 @@ <actionGroup ref="logout" stepKey="logout"/> </after> <!-- 1. Begin creating a new catalog price rule --> - <actionGroup ref="newCatalogPriceRuleByUIWithConditionIsCategory" stepKey="newCatalogPriceRuleByUIWithConditionIsCategory"> + <actionGroup ref="NewCatalogPriceRuleByUIWithConditionIsCategoryActionGroup" stepKey="newCatalogPriceRuleByUIWithConditionIsCategory"> <argument name ="categoryId" value="$createCategory.id$"/> </actionGroup> <!-- Select not logged in customer group --> - <actionGroup ref="selectNotLoggedInCustomerGroupActionGroup" stepKey="selectNotLoggedInCustomerGroup"/> + <actionGroup ref="SelectNotLoggedInCustomerGroupActionGroup" stepKey="selectNotLoggedInCustomerGroup"/> <!-- Save and apply the new catalog price rule --> <actionGroup ref="SaveAndApplyCatalogPriceRuleActionGroup" stepKey="saveAndApplyCatalogPriceRule"/> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/CatalogPriceRuleAndCustomerGroupMembershipArePersistedUnderLongTermCookieTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/CatalogPriceRuleAndCustomerGroupMembershipArePersistedUnderLongTermCookieTest.xml index 738f193fcc511..86d3dccba7595 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/CatalogPriceRuleAndCustomerGroupMembershipArePersistedUnderLongTermCookieTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/CatalogPriceRuleAndCustomerGroupMembershipArePersistedUnderLongTermCookieTest.xml @@ -32,11 +32,11 @@ <actionGroup ref="LoginAsAdmin" stepKey="login"/> <!--Create Catalog Rule--> - <actionGroup ref="newCatalogPriceRuleByUIWithConditionIsCategory" stepKey="createCatalogPriceRule"> + <actionGroup ref="NewCatalogPriceRuleByUIWithConditionIsCategoryActionGroup" stepKey="createCatalogPriceRule"> <argument name="catalogRule" value="_defaultCatalogRule"/> <argument name="categoryId" value="$$createCategory.id$$"/> </actionGroup> - <actionGroup ref="selectGeneralCustomerGroupActionGroup" stepKey="selectCustomerGroup"/> + <actionGroup ref="SelectGeneralCustomerGroupActionGroup" stepKey="selectCustomerGroup"/> <click selector="{{AdminNewCatalogPriceRule.saveAndApply}}" stepKey="clickSaveAndApplyRules"/> <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the rule." stepKey="assertSuccess"/> <magentoCLI command="indexer:reindex" stepKey="reindex"/> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/StorefrontInactiveCatalogRuleTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/StorefrontInactiveCatalogRuleTest.xml index 08e59c6316411..1f9c8df60492e 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/StorefrontInactiveCatalogRuleTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/StorefrontInactiveCatalogRuleTest.xml @@ -24,7 +24,7 @@ <createData entity="ApiSimpleProduct" stepKey="createProduct"> <requiredEntity createDataKey="createCategory"/> </createData> - <actionGroup stepKey="createNewPriceRule" ref="newCatalogPriceRuleByUI"/> + <actionGroup stepKey="createNewPriceRule" ref="NewCatalogPriceRuleByUIActionGroup"/> <actionGroup stepKey="selectLoggedInCustomers" ref="selectNotLoggedInCustomerGroup"/> <scrollToTopOfPage stepKey="scrollToTop"/> <click stepKey="setInactive" selector="{{AdminCategoryBasicFieldSection.enableCategoryLabel}}"/> diff --git a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProductsTest.xml b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProductsTest.xml index 3e700b5bcfb1b..71ab764453b20 100644 --- a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProductsTest.xml +++ b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProductsTest.xml @@ -178,7 +178,7 @@ <actionGroup ref="logout" stepKey="logout"/> </after> <!-- Create price rule --> - <actionGroup ref="newCatalogPriceRuleByUI" stepKey="createPriceRule"> + <actionGroup ref="NewCatalogPriceRuleByUIActionGroup" stepKey="createPriceRule"> <argument name="catalogRule" value="CatalogRuleToFixed"/> </actionGroup> <actionGroup ref="CatalogSelectCustomerGroupActionGroup" stepKey="addCustomerGroup"> diff --git a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptionsTest.xml b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptionsTest.xml index e53e51c626aa9..6fda432ce7905 100644 --- a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptionsTest.xml +++ b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptionsTest.xml @@ -126,7 +126,7 @@ </after> <!-- Create price rule for first configurable product option --> - <actionGroup ref="newCatalogPriceRuleByUI" stepKey="createFirstPriceRule"> + <actionGroup ref="NewCatalogPriceRuleByUIActionGroup" stepKey="createFirstPriceRule"> <argument name="catalogRule" value="CatalogRuleToFixed"/> </actionGroup> <actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="selectNotLoggedInCustomerGroupForFirstPriceRule"/> @@ -140,7 +140,7 @@ <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the rule." stepKey="assertSuccessMessageForFirstPriceRule"/> <!-- Create price rule for second configurable product option --> - <actionGroup ref="newCatalogPriceRuleByUI" stepKey="createSecondPriceRule"> + <actionGroup ref="NewCatalogPriceRuleByUIActionGroup" stepKey="createSecondPriceRule"> <argument name="catalogRule" value="_defaultCatalogRule"/> </actionGroup> <actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="selectNotLoggedInCustomerGroupForSecondPriceRule"/> @@ -154,7 +154,7 @@ <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the rule." stepKey="assertSuccessMessageForSecondPriceRule"/> <!-- Create price rule for third configurable product option --> - <actionGroup ref="newCatalogPriceRuleByUI" stepKey="createThirdPriceRule"> + <actionGroup ref="NewCatalogPriceRuleByUIActionGroup" stepKey="createThirdPriceRule"> <argument name="catalogRule" value="CatalogRuleWithoutDiscount"/> </actionGroup> <actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="selectNotLoggedInCustomerGroupForThirdPriceRule"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml index bc8f3e49272b7..275147549c178 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml @@ -132,7 +132,7 @@ <see selector="{{StorefrontCategoryMainSection.lineProductName('3')}}" userInput="$$createSimpleProduct.name$$" stepKey="seeSimpleProduct"/> <!--Create and apply catalog price rule--> - <actionGroup ref="newCatalogPriceRuleByUIWithConditionIsSKU" stepKey="createCatalogPriceRule"> + <actionGroup ref="NewCatalogPriceRuleByUIWithConditionIsSKUActionGroup" stepKey="createCatalogPriceRule"> <argument name="catalogRule" value="CatalogRuleByPercentWith96Amount" /> <argument name="productSku" value="$$createConfigChildProduct3.sku$$" /> </actionGroup> From 3aebff43b3511862dcbeec352d00e4eb407ce61a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Fri, 29 Nov 2019 13:13:55 +0100 Subject: [PATCH 0182/1143] REFACTOR: Extract Action Groups to separate files (according to MFTF best practices) --- ...wedInShoppingCartValidationActionGroup.xml | 20 ++++++++++++++++ ...axQtyAllowedInShoppingCartActionGroup.xml} | 10 +------- .../DisplayOutOfStockProductActionGroup.xml | 18 ++------------ .../NoDisplayOutOfStockProductActionGroup.xml | 24 +++++++++++++++++++ ...eroMaximumQtyAllowedInShoppingCartTest.xml | 2 +- ...roductWithDisabledChildrenProductsTest.xml | 4 ++-- ...eeProductDisplayOutOfStockProductsTest.xml | 6 ++--- 7 files changed, 53 insertions(+), 31 deletions(-) create mode 100644 app/code/Magento/CatalogInventory/Test/Mftf/ActionGroup/AdminProductMaxQtyAllowedInShoppingCartValidationActionGroup.xml rename app/code/Magento/CatalogInventory/Test/Mftf/ActionGroup/{AdminProductActionGroup.xml => AdminProductSetMaxQtyAllowedInShoppingCartActionGroup.xml} (64%) create mode 100644 app/code/Magento/CatalogInventory/Test/Mftf/ActionGroup/NoDisplayOutOfStockProductActionGroup.xml diff --git a/app/code/Magento/CatalogInventory/Test/Mftf/ActionGroup/AdminProductMaxQtyAllowedInShoppingCartValidationActionGroup.xml b/app/code/Magento/CatalogInventory/Test/Mftf/ActionGroup/AdminProductMaxQtyAllowedInShoppingCartValidationActionGroup.xml new file mode 100644 index 0000000000000..1dbc0256be7d8 --- /dev/null +++ b/app/code/Magento/CatalogInventory/Test/Mftf/ActionGroup/AdminProductMaxQtyAllowedInShoppingCartValidationActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminProductMaxQtyAllowedInShoppingCartValidationActionGroup" extends="AdminProductSetMaxQtyAllowedInShoppingCartActionGroup"> + <arguments> + <argument name="qty" type="string"/> + <argument name="errorMessage" type="string"/> + </arguments> + + <waitForElementVisible selector="{{AdminProductFormAdvancedInventorySection.maxiQtyAllowedInCartError}}" after="clickDone" stepKey="waitProductValidationErrorMessageAppears"/> + <see selector="{{AdminProductFormAdvancedInventorySection.maxiQtyAllowedInCartError}}" userInput="{{errorMessage}}" after="waitProductValidationErrorMessageAppears" stepKey="checkProductValidationErrorMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogInventory/Test/Mftf/ActionGroup/AdminProductActionGroup.xml b/app/code/Magento/CatalogInventory/Test/Mftf/ActionGroup/AdminProductSetMaxQtyAllowedInShoppingCartActionGroup.xml similarity index 64% rename from app/code/Magento/CatalogInventory/Test/Mftf/ActionGroup/AdminProductActionGroup.xml rename to app/code/Magento/CatalogInventory/Test/Mftf/ActionGroup/AdminProductSetMaxQtyAllowedInShoppingCartActionGroup.xml index 84dc6b93c885f..a5e4d3e9c2af7 100644 --- a/app/code/Magento/CatalogInventory/Test/Mftf/ActionGroup/AdminProductActionGroup.xml +++ b/app/code/Magento/CatalogInventory/Test/Mftf/ActionGroup/AdminProductSetMaxQtyAllowedInShoppingCartActionGroup.xml @@ -8,7 +8,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AdminProductSetMaxQtyAllowedInShoppingCart"> + <actionGroup name="AdminProductSetMaxQtyAllowedInShoppingCartActionGroup"> <arguments> <argument name="qty" type="string"/> </arguments> @@ -19,13 +19,5 @@ <click selector="{{AdminSlideOutDialogSection.doneButton}}" stepKey="clickDone"/> </actionGroup> - <actionGroup name="AdminProductMaxQtyAllowedInShoppingCartValidationActionGroup" extends="AdminProductSetMaxQtyAllowedInShoppingCart"> - <arguments> - <argument name="qty" type="string"/> - <argument name="errorMessage" type="string"/> - </arguments> - <waitForElementVisible selector="{{AdminProductFormAdvancedInventorySection.maxiQtyAllowedInCartError}}" after="clickDone" stepKey="waitProductValidationErrorMessageAppears"/> - <see selector="{{AdminProductFormAdvancedInventorySection.maxiQtyAllowedInCartError}}" userInput="{{errorMessage}}" after="waitProductValidationErrorMessageAppears" stepKey="checkProductValidationErrorMessage"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/CatalogInventory/Test/Mftf/ActionGroup/DisplayOutOfStockProductActionGroup.xml b/app/code/Magento/CatalogInventory/Test/Mftf/ActionGroup/DisplayOutOfStockProductActionGroup.xml index 13cb9089bf920..a6fe2b49508ff 100644 --- a/app/code/Magento/CatalogInventory/Test/Mftf/ActionGroup/DisplayOutOfStockProductActionGroup.xml +++ b/app/code/Magento/CatalogInventory/Test/Mftf/ActionGroup/DisplayOutOfStockProductActionGroup.xml @@ -8,11 +8,11 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="displayOutOfStockProduct"> + <actionGroup name="DisplayOutOfStockProductActionGroup"> <annotations> <description>Goes to the 'Configuration' page for 'Inventory'. Enables 'Display Out of Stock Products'. Clicks on the Save button.</description> </annotations> - + <amOnPage url="{{InventoryConfigurationPage.url}}" stepKey="navigateToInventoryConfigurationPage"/> <waitForPageLoad stepKey="waitForConfigPageToLoad"/> <conditionalClick stepKey="expandProductStockOptions" selector="{{InventoryConfigSection.ProductStockOptionsTab}}" dependentSelector="{{InventoryConfigSection.CheckIfProductStockOptionsTabExpanded}}" visible="true"/> @@ -22,18 +22,4 @@ <selectOption selector="{{InventoryConfigSection.DisplayOutOfStockDropdown}}" userInput="Yes" stepKey="switchToYes"/> <click selector="{{ContentManagementSection.Save}}" stepKey="clickSaveConfig"/> </actionGroup> - - <actionGroup name="noDisplayOutOfStockProduct"> - <annotations> - <description>Goes to the 'Configuration' page for 'Inventory'. Disables 'Display Out of Stock Products'. Clicks on the Save button.</description> - </annotations> - - <amOnPage url="{{InventoryConfigurationPage.url}}" stepKey="navigateToInventoryConfigurationPage"/> - <waitForPageLoad stepKey="waitForConfigPageToLoad"/> - <conditionalClick stepKey="expandProductStockOptions" selector="{{InventoryConfigSection.ProductStockOptionsTab}}" dependentSelector="{{InventoryConfigSection.CheckIfProductStockOptionsTabExpanded}}" visible="true"/> - <uncheckOption selector="{{InventoryConfigSection.DisplayOutOfStockSystemValue}}" stepKey="uncheckUseSystemValue"/> - <waitForElementVisible selector="{{InventoryConfigSection.DisplayOutOfStockDropdown}}" stepKey="waitForSwitcherDropdown"/> - <selectOption selector="{{InventoryConfigSection.DisplayOutOfStockDropdown}}" userInput="No" stepKey="switchToNo"/> - <click selector="{{ContentManagementSection.Save}}" stepKey="clickSaveConfig"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/CatalogInventory/Test/Mftf/ActionGroup/NoDisplayOutOfStockProductActionGroup.xml b/app/code/Magento/CatalogInventory/Test/Mftf/ActionGroup/NoDisplayOutOfStockProductActionGroup.xml new file mode 100644 index 0000000000000..6f6b7ae20987f --- /dev/null +++ b/app/code/Magento/CatalogInventory/Test/Mftf/ActionGroup/NoDisplayOutOfStockProductActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="NoDisplayOutOfStockProductActionGroup"> + <annotations> + <description>Goes to the 'Configuration' page for 'Inventory'. Disables 'Display Out of Stock Products'. Clicks on the Save button.</description> + </annotations> + + <amOnPage url="{{InventoryConfigurationPage.url}}" stepKey="navigateToInventoryConfigurationPage"/> + <waitForPageLoad stepKey="waitForConfigPageToLoad"/> + <conditionalClick stepKey="expandProductStockOptions" selector="{{InventoryConfigSection.ProductStockOptionsTab}}" dependentSelector="{{InventoryConfigSection.CheckIfProductStockOptionsTabExpanded}}" visible="true"/> + <uncheckOption selector="{{InventoryConfigSection.DisplayOutOfStockSystemValue}}" stepKey="uncheckUseSystemValue"/> + <waitForElementVisible selector="{{InventoryConfigSection.DisplayOutOfStockDropdown}}" stepKey="waitForSwitcherDropdown"/> + <selectOption selector="{{InventoryConfigSection.DisplayOutOfStockDropdown}}" userInput="No" stepKey="switchToNo"/> + <click selector="{{ContentManagementSection.Save}}" stepKey="clickSaveConfig"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogInventory/Test/Mftf/Test/AdminCreateProductWithZeroMaximumQtyAllowedInShoppingCartTest.xml b/app/code/Magento/CatalogInventory/Test/Mftf/Test/AdminCreateProductWithZeroMaximumQtyAllowedInShoppingCartTest.xml index f7cf0a4deba4b..92265afb03528 100644 --- a/app/code/Magento/CatalogInventory/Test/Mftf/Test/AdminCreateProductWithZeroMaximumQtyAllowedInShoppingCartTest.xml +++ b/app/code/Magento/CatalogInventory/Test/Mftf/Test/AdminCreateProductWithZeroMaximumQtyAllowedInShoppingCartTest.xml @@ -71,7 +71,7 @@ <argument name="errorMessage" value="Please enter a valid number in this field."/> </actionGroup> <!-- Fill correct value --> - <actionGroup ref="AdminProductSetMaxQtyAllowedInShoppingCart" stepKey="setProductMaxQtyAllowedInShoppingCartToCorrectNumber"> + <actionGroup ref="AdminProductSetMaxQtyAllowedInShoppingCartActionGroup" stepKey="setProductMaxQtyAllowedInShoppingCartToCorrectNumber"> <argument name="qty" value="50"/> </actionGroup> <waitForElementNotVisible selector="{{AdminProductFormAdvancedInventorySection.advancedInventoryModal}}" stepKey="waitForModalFormToDisappear"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithDisabledChildrenProductsTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithDisabledChildrenProductsTest.xml index 49f3f8b5ea931..dd1ca79147140 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithDisabledChildrenProductsTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithDisabledChildrenProductsTest.xml @@ -40,7 +40,7 @@ </before> <after> <!-- Don't display out of stock product --> - <actionGroup ref="noDisplayOutOfStockProduct" stepKey="revertDisplayOutOfStockProduct"/> + <actionGroup ref="NoDisplayOutOfStockProductActionGroup" stepKey="revertDisplayOutOfStockProduct"/> <!-- Delete configurable product --> <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> @@ -105,7 +105,7 @@ <see userInput="$$createSimpleProduct.name$$" selector="{{AdminProductFormConfigurationsSection.currentVariationsNameCells}}" stepKey="seeProductNameInConfigurations"/> <!-- Display out of stock product --> - <actionGroup ref="displayOutOfStockProduct" stepKey="displayOutOfStockProduct"/> + <actionGroup ref="DisplayOutOfStockProductActionGroup" stepKey="displayOutOfStockProduct"/> <!-- Flash cache --> <magentoCLI command="cache:flush" stepKey="flushCache"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDisplayOutOfStockProductsTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDisplayOutOfStockProductsTest.xml index 308e256543736..1f0cc7b65aa7b 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDisplayOutOfStockProductsTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDisplayOutOfStockProductsTest.xml @@ -61,7 +61,7 @@ </before> <after> <!-- Don't display out of stock product --> - <actionGroup ref="noDisplayOutOfStockProduct" stepKey="revertDisplayOutOfStockProduct"/> + <actionGroup ref="NoDisplayOutOfStockProductActionGroup" stepKey="revertDisplayOutOfStockProduct"/> <!-- Delete configurable product --> <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> @@ -119,7 +119,7 @@ <actionGroup ref="saveProductForm" stepKey="saveConfigurableProduct"/> <!-- Display out of stock product --> - <actionGroup ref="displayOutOfStockProduct" stepKey="displayOutOfStockProduct"/> + <actionGroup ref="DisplayOutOfStockProductActionGroup" stepKey="displayOutOfStockProduct"/> <!-- Flash cache --> <magentoCLI command="cache:flush" stepKey="flushCache"/> @@ -137,4 +137,4 @@ <waitForPageLoad stepKey="waitForProductPageLoad"/> <see userInput="$$createConfigProductAttributeOptionThree.option[store_labels][1][label]$$" selector="{{StorefrontProductInfoMainSection.optionByAttributeId($$createConfigProductAttribute.attribute_id$$)}}" stepKey="assertOptionNotAvailable" /> </test> -</tests> \ No newline at end of file +</tests> From ca6a5ab3bf9d25ba6ae69d300eba483954afa1d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Fri, 29 Nov 2019 13:22:52 +0100 Subject: [PATCH 0183/1143] REFACTOR: Extract Action Groups to separate files (according to MFTF best practices) --- .../ActionGroup/AdminExportActionGroup.xml | 102 ------------------ .../DeleteAllExportedFilesActionGroup.xml | 32 ++++++ .../DeleteExportedFileActionGroup.xml | 28 +++++ .../DownloadFileByRowIndexActionGroup.xml | 24 +++++ .../ExportAllProductsActionGroup.xml | 24 +++++ ...rtProductsFilterByAttributeActionGroup.xml | 31 ++++++ .../Test/AdminExportBundleProductTest.xml | 8 +- ...portGroupedProductWithSpecialPriceTest.xml | 8 +- ...mportConfigurableProductWithImagesTest.xml | 6 +- ...figurableProductsWithCustomOptionsTest.xml | 8 +- ...igurableProductsWithAssignedImagesTest.xml | 8 +- ...ableProductAssignedToCustomWebsiteTest.xml | 8 +- ...rtSimpleProductWithCustomAttributeTest.xml | 8 +- 13 files changed, 166 insertions(+), 129 deletions(-) delete mode 100644 app/code/Magento/CatalogImportExport/Test/Mftf/ActionGroup/AdminExportActionGroup.xml create mode 100644 app/code/Magento/CatalogImportExport/Test/Mftf/ActionGroup/DeleteAllExportedFilesActionGroup.xml create mode 100644 app/code/Magento/CatalogImportExport/Test/Mftf/ActionGroup/DeleteExportedFileActionGroup.xml create mode 100644 app/code/Magento/CatalogImportExport/Test/Mftf/ActionGroup/DownloadFileByRowIndexActionGroup.xml create mode 100644 app/code/Magento/CatalogImportExport/Test/Mftf/ActionGroup/ExportAllProductsActionGroup.xml create mode 100644 app/code/Magento/CatalogImportExport/Test/Mftf/ActionGroup/ExportProductsFilterByAttributeActionGroup.xml diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/ActionGroup/AdminExportActionGroup.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/ActionGroup/AdminExportActionGroup.xml deleted file mode 100644 index c56bc667e2494..0000000000000 --- a/app/code/Magento/CatalogImportExport/Test/Mftf/ActionGroup/AdminExportActionGroup.xml +++ /dev/null @@ -1,102 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <!-- Export products using filtering by attribute --> - <actionGroup name="exportProductsFilterByAttribute"> - <annotations> - <description>Filters Products by the provided Attribute. Exports the filtered Products list. Validates that the Success Message is present.</description> - </annotations> - <arguments> - <argument name="attribute" type="string"/> - <argument name="attributeData" type="string"/> - </arguments> - - <selectOption selector="{{AdminExportMainSection.entityType}}" userInput="Products" stepKey="selectProductsOption"/> - <waitForElementVisible selector="{{AdminExportMainSection.entityAttributes}}" stepKey="waitForElementVisible"/> - <scrollTo selector="{{AdminExportAttributeSection.chooseAttribute('attribute')}}" stepKey="scrollToAttribute"/> - <checkOption selector="{{AdminExportAttributeSection.chooseAttribute('attribute')}}" stepKey="selectAttribute"/> - <fillField selector="{{AdminExportAttributeSection.fillFilter('attribute')}}" userInput="{{attributeData}}" stepKey="setDataInField"/> - <waitForPageLoad stepKey="waitForUserInput"/> - <scrollTo selector="{{AdminExportAttributeSection.continueBtn}}" stepKey="scrollToContinue"/> - <click selector="{{AdminExportAttributeSection.continueBtn}}" stepKey="clickContinueButton"/> - <see selector="{{AdminMessagesSection.success}}" userInput="Message is added to queue, wait to get your file soon" stepKey="seeSuccessMessage"/> - </actionGroup> - - <!-- Export products without filtering --> - <actionGroup name="exportAllProducts"> - <annotations> - <description>Exports the unfiltered Products list. Validates that the Success Message is present.</description> - </annotations> - - <selectOption selector="{{AdminExportMainSection.entityType}}" userInput="Products" stepKey="selectProductsOption"/> - <waitForElementVisible selector="{{AdminExportMainSection.entityAttributes}}" stepKey="waitForElementVisible" time="5"/> - <scrollTo selector="{{AdminExportAttributeSection.continueBtn}}" stepKey="scrollToContinue"/> - <wait stepKey="waitForScroll" time="5"/> - <click selector="{{AdminExportAttributeSection.continueBtn}}" stepKey="clickContinueButton"/> - <wait stepKey="waitForClick" time="5"/> - <see selector="{{AdminMessagesSection.success}}" userInput="Message is added to queue, wait to get your file soon. Make sure your cron job is running to export the file" stepKey="seeSuccessMessage"/> - </actionGroup> - - <!-- Download first file in the grid --> - <actionGroup name="downloadFileByRowIndex"> - <annotations> - <description>Downloads the provided Grid Index on the Exports grid page.</description> - </annotations> - <arguments> - <argument name="rowIndex" type="string"/> - </arguments> - - <reloadPage stepKey="refreshPage"/> - <waitForPageLoad stepKey="waitFormReload"/> - <click stepKey="clickSelectBtn" selector="{{AdminExportAttributeSection.selectByIndex(rowIndex)}}"/> - <click stepKey="clickOnDownload" selector="{{AdminExportAttributeSection.download(rowIndex)}}" after="clickSelectBtn"/> - </actionGroup> - - <!-- Delete exported file --> - <actionGroup name="deleteExportedFile"> - <annotations> - <description>Deletes the provided Grid Index on the Exports grid page.</description> - </annotations> - <arguments> - <argument name="rowIndex" type="string"/> - </arguments> - - <amOnPage url="{{AdminExportIndexPage.url}}" stepKey="goToExportIndexPage"/> - <waitForPageLoad time="30" stepKey="waitFormReload"/> - <click stepKey="clickSelectBtn" selector="{{AdminExportAttributeSection.selectByIndex(rowIndex)}}"/> - <click stepKey="clickOnDelete" selector="{{AdminExportAttributeSection.delete(rowIndex)}}" after="clickSelectBtn"/> - <waitForElementVisible selector="{{AdminProductGridConfirmActionSection.title}}" stepKey="waitForConfirmModal"/> - <click selector="{{AdminProductGridConfirmActionSection.ok}}" stepKey="confirmDelete"/> - <waitForElementVisible selector="{{AdminDataGridTableSection.dataGridEmpty}}" stepKey="waitDataGridEmptyMessageAppears"/> - <see selector="{{AdminDataGridTableSection.dataGridEmpty}}" userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage"/> - </actionGroup> - - <actionGroup name="deleteAllExportedFiles"> - <amOnPage url="{{AdminExportIndexPage.url}}" stepKey="goToExportIndexPage"/> - <executeInSelenium - function=" - function ($webdriver) use ($I) { - $buttons = $webdriver->findElements(\Facebook\WebDriver\WebDriverBy::xpath('//tr[@data-repeat-index=\'0\']//button')); - while(!empty($buttons)) { - $buttons[0]->click(); - $I->waitForElementVisible('//tr[@data-repeat-index=\'0\']//a[text()=\'Delete\']', 10); - $deleteButton = $webdriver->findElement(\Facebook\WebDriver\WebDriverBy::xpath('//tr[@data-repeat-index=\'0\']//a[text()=\'Delete\']')); - $deleteButton->click(); - $I->waitForElementVisible('.modal-popup.confirm button.action-accept', 10); - $I->click('.modal-popup.confirm button.action-accept'); - $I->waitForPageLoad(60); - $buttons = $webdriver->findElements(\Facebook\WebDriver\WebDriverBy::xpath('//tr[@data-repeat-index=\'0\']//button')); - } - }" - stepKey="deleteAllExportedFilesOneByOne"/> - <waitForElementVisible selector="{{AdminDataGridTableSection.dataGridEmpty}}" stepKey="waitDataGridEmptyMessageAppears"/> - <see selector="{{AdminDataGridTableSection.dataGridEmpty}}" userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/ActionGroup/DeleteAllExportedFilesActionGroup.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/ActionGroup/DeleteAllExportedFilesActionGroup.xml new file mode 100644 index 0000000000000..aa8fad2a1d575 --- /dev/null +++ b/app/code/Magento/CatalogImportExport/Test/Mftf/ActionGroup/DeleteAllExportedFilesActionGroup.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DeleteAllExportedFilesActionGroup"> + <amOnPage url="{{AdminExportIndexPage.url}}" stepKey="goToExportIndexPage"/> + <executeInSelenium + function=" + function ($webdriver) use ($I) { + $buttons = $webdriver->findElements(\Facebook\WebDriver\WebDriverBy::xpath('//tr[@data-repeat-index=\'0\']//button')); + while(!empty($buttons)) { + $buttons[0]->click(); + $I->waitForElementVisible('//tr[@data-repeat-index=\'0\']//a[text()=\'Delete\']', 10); + $deleteButton = $webdriver->findElement(\Facebook\WebDriver\WebDriverBy::xpath('//tr[@data-repeat-index=\'0\']//a[text()=\'Delete\']')); + $deleteButton->click(); + $I->waitForElementVisible('.modal-popup.confirm button.action-accept', 10); + $I->click('.modal-popup.confirm button.action-accept'); + $I->waitForPageLoad(60); + $buttons = $webdriver->findElements(\Facebook\WebDriver\WebDriverBy::xpath('//tr[@data-repeat-index=\'0\']//button')); + } + }" + stepKey="deleteAllExportedFilesOneByOne"/> + <waitForElementVisible selector="{{AdminDataGridTableSection.dataGridEmpty}}" stepKey="waitDataGridEmptyMessageAppears"/> + <see selector="{{AdminDataGridTableSection.dataGridEmpty}}" userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/ActionGroup/DeleteExportedFileActionGroup.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/ActionGroup/DeleteExportedFileActionGroup.xml new file mode 100644 index 0000000000000..78d7293b7437b --- /dev/null +++ b/app/code/Magento/CatalogImportExport/Test/Mftf/ActionGroup/DeleteExportedFileActionGroup.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DeleteExportedFileActionGroup"> + <annotations> + <description>Deletes the provided Grid Index on the Exports grid page.</description> + </annotations> + <arguments> + <argument name="rowIndex" type="string"/> + </arguments> + + <amOnPage url="{{AdminExportIndexPage.url}}" stepKey="goToExportIndexPage"/> + <waitForPageLoad time="30" stepKey="waitFormReload"/> + <click stepKey="clickSelectBtn" selector="{{AdminExportAttributeSection.selectByIndex(rowIndex)}}"/> + <click stepKey="clickOnDelete" selector="{{AdminExportAttributeSection.delete(rowIndex)}}" after="clickSelectBtn"/> + <waitForElementVisible selector="{{AdminProductGridConfirmActionSection.title}}" stepKey="waitForConfirmModal"/> + <click selector="{{AdminProductGridConfirmActionSection.ok}}" stepKey="confirmDelete"/> + <waitForElementVisible selector="{{AdminDataGridTableSection.dataGridEmpty}}" stepKey="waitDataGridEmptyMessageAppears"/> + <see selector="{{AdminDataGridTableSection.dataGridEmpty}}" userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/ActionGroup/DownloadFileByRowIndexActionGroup.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/ActionGroup/DownloadFileByRowIndexActionGroup.xml new file mode 100644 index 0000000000000..ec164ff172625 --- /dev/null +++ b/app/code/Magento/CatalogImportExport/Test/Mftf/ActionGroup/DownloadFileByRowIndexActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DownloadFileByRowIndexActionGroup"> + <annotations> + <description>Downloads the provided Grid Index on the Exports grid page.</description> + </annotations> + <arguments> + <argument name="rowIndex" type="string"/> + </arguments> + + <reloadPage stepKey="refreshPage"/> + <waitForPageLoad stepKey="waitFormReload"/> + <click stepKey="clickSelectBtn" selector="{{AdminExportAttributeSection.selectByIndex(rowIndex)}}"/> + <click stepKey="clickOnDownload" selector="{{AdminExportAttributeSection.download(rowIndex)}}" after="clickSelectBtn"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/ActionGroup/ExportAllProductsActionGroup.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/ActionGroup/ExportAllProductsActionGroup.xml new file mode 100644 index 0000000000000..3edbb1b821843 --- /dev/null +++ b/app/code/Magento/CatalogImportExport/Test/Mftf/ActionGroup/ExportAllProductsActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ExportAllProductsActionGroup"> + <annotations> + <description>Exports the unfiltered Products list. Validates that the Success Message is present.</description> + </annotations> + + <selectOption selector="{{AdminExportMainSection.entityType}}" userInput="Products" stepKey="selectProductsOption"/> + <waitForElementVisible selector="{{AdminExportMainSection.entityAttributes}}" stepKey="waitForElementVisible" time="5"/> + <scrollTo selector="{{AdminExportAttributeSection.continueBtn}}" stepKey="scrollToContinue"/> + <wait stepKey="waitForScroll" time="5"/> + <click selector="{{AdminExportAttributeSection.continueBtn}}" stepKey="clickContinueButton"/> + <wait stepKey="waitForClick" time="5"/> + <see selector="{{AdminMessagesSection.success}}" userInput="Message is added to queue, wait to get your file soon. Make sure your cron job is running to export the file" stepKey="seeSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/ActionGroup/ExportProductsFilterByAttributeActionGroup.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/ActionGroup/ExportProductsFilterByAttributeActionGroup.xml new file mode 100644 index 0000000000000..f3ca894202893 --- /dev/null +++ b/app/code/Magento/CatalogImportExport/Test/Mftf/ActionGroup/ExportProductsFilterByAttributeActionGroup.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <!-- Export products using filtering by attribute --> + <actionGroup name="ExportProductsFilterByAttributeActionGroup"> + <annotations> + <description>Filters Products by the provided Attribute. Exports the filtered Products list. Validates that the Success Message is present.</description> + </annotations> + <arguments> + <argument name="attribute" type="string"/> + <argument name="attributeData" type="string"/> + </arguments> + + <selectOption selector="{{AdminExportMainSection.entityType}}" userInput="Products" stepKey="selectProductsOption"/> + <waitForElementVisible selector="{{AdminExportMainSection.entityAttributes}}" stepKey="waitForElementVisible"/> + <scrollTo selector="{{AdminExportAttributeSection.chooseAttribute('attribute')}}" stepKey="scrollToAttribute"/> + <checkOption selector="{{AdminExportAttributeSection.chooseAttribute('attribute')}}" stepKey="selectAttribute"/> + <fillField selector="{{AdminExportAttributeSection.fillFilter('attribute')}}" userInput="{{attributeData}}" stepKey="setDataInField"/> + <waitForPageLoad stepKey="waitForUserInput"/> + <scrollTo selector="{{AdminExportAttributeSection.continueBtn}}" stepKey="scrollToContinue"/> + <click selector="{{AdminExportAttributeSection.continueBtn}}" stepKey="clickContinueButton"/> + <see selector="{{AdminMessagesSection.success}}" userInput="Message is added to queue, wait to get your file soon" stepKey="seeSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportBundleProductTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportBundleProductTest.xml index 74345e64a7c9a..369805a94dd84 100644 --- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportBundleProductTest.xml +++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportBundleProductTest.xml @@ -86,7 +86,7 @@ <!-- Login as admin --> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - <actionGroup ref="deleteAllExportedFiles" stepKey="clearExportedFilesList"/> + <actionGroup ref="DeleteAllExportedFilesActionGroup" stepKey="clearExportedFilesList"/> </before> <after> <!-- Delete products creations --> @@ -102,7 +102,7 @@ <deleteData createDataKey="createProductAttribute" stepKey="deleteProductAttribute"/> <!-- Delete exported file --> - <actionGroup ref="deleteExportedFile" stepKey="deleteExportedFile"> + <actionGroup ref="DeleteExportedFileActionGroup" stepKey="deleteExportedFile"> <argument name="rowIndex" value="0"/> </actionGroup> <!-- Log out --> @@ -113,14 +113,14 @@ <amOnPage url="{{AdminExportIndexPage.url}}" stepKey="goToExportIndexPage"/> <!-- Export created below products --> - <actionGroup ref="exportAllProducts" stepKey="exportCreatedProducts"/> + <actionGroup ref="ExportAllProductsActionGroup" stepKey="exportCreatedProducts"/> <!-- Run cron --> <magentoCLI command="cron:run" stepKey="runCron3"/> <magentoCLI command="cron:run" stepKey="runCron4"/> <!-- Download product --> - <actionGroup ref="downloadFileByRowIndex" stepKey="downloadCreatedProducts"> + <actionGroup ref="DownloadFileByRowIndexActionGroup" stepKey="downloadCreatedProducts"> <argument name="rowIndex" value="0"/> </actionGroup> </test> diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportGroupedProductWithSpecialPriceTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportGroupedProductWithSpecialPriceTest.xml index b0ac6a4bc95ac..d9b93196db060 100644 --- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportGroupedProductWithSpecialPriceTest.xml +++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportGroupedProductWithSpecialPriceTest.xml @@ -54,7 +54,7 @@ <!-- Login as admin --> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - <actionGroup ref="deleteAllExportedFiles" stepKey="clearExportedFilesList"/> + <actionGroup ref="DeleteAllExportedFilesActionGroup" stepKey="clearExportedFilesList"/> </before> <after> <!-- Deleted created products --> @@ -66,7 +66,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <!-- Delete exported file --> - <actionGroup ref="deleteExportedFile" stepKey="deleteExportedFile"> + <actionGroup ref="DeleteExportedFileActionGroup" stepKey="deleteExportedFile"> <argument name="rowIndex" value="0"/> </actionGroup> <!-- Log out --> @@ -78,14 +78,14 @@ <waitForPageLoad stepKey="waitForExportIndexPageLoad"/> <!-- Export created below products --> - <actionGroup ref="exportAllProducts" stepKey="exportCreatedProducts"/> + <actionGroup ref="ExportAllProductsActionGroup" stepKey="exportCreatedProducts"/> <!-- Run cron --> <magentoCLI command="cron:run" stepKey="runCron3"/> <magentoCLI command="cron:run" stepKey="runCron4"/> <!-- Download product --> - <actionGroup ref="downloadFileByRowIndex" stepKey="downloadCreatedProducts"> + <actionGroup ref="DownloadFileByRowIndexActionGroup" stepKey="downloadCreatedProducts"> <argument name="rowIndex" value="0"/> </actionGroup> </test> diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportImportConfigurableProductWithImagesTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportImportConfigurableProductWithImagesTest.xml index f0ec7dbd0706b..4a22d3d3d43f0 100644 --- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportImportConfigurableProductWithImagesTest.xml +++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportImportConfigurableProductWithImagesTest.xml @@ -128,7 +128,7 @@ <!-- Login as admin --> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - <actionGroup ref="deleteAllExportedFiles" stepKey="clearExportedFilesList"/> + <actionGroup ref="DeleteAllExportedFilesActionGroup" stepKey="clearExportedFilesList"/> </before> <after> <!-- Remove downloadable domains --> @@ -159,7 +159,7 @@ <amOnPage url="{{AdminExportIndexPage.url}}" stepKey="goToExportIndexPage"/> <!-- Set Export Settings: Entity Type > Products, SKU > ConfProd's sku and press "Continue" --> - <actionGroup ref="exportProductsFilterByAttribute" stepKey="exportProductBySku"> + <actionGroup ref="ExportProductsFilterByAttributeActionGroup" stepKey="exportProductBySku"> <argument name="attribute" value="sku"/> <argument name="attributeData" value="$$createExportImportConfigurableProduct.sku$$"/> </actionGroup> @@ -169,7 +169,7 @@ <magentoCLI command="cron:run" stepKey="runCronSecondTime"/> <!-- Save exported file: file successfully downloaded --> - <actionGroup ref="downloadFileByRowIndex" stepKey="downloadCreatedProducts"> + <actionGroup ref="DownloadFileByRowIndexActionGroup" stepKey="downloadCreatedProducts"> <argument name="rowIndex" value="0"/> </actionGroup> diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleAndConfigurableProductsWithCustomOptionsTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleAndConfigurableProductsWithCustomOptionsTest.xml index 1870cb21bd55b..397c1ee57e7f5 100644 --- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleAndConfigurableProductsWithCustomOptionsTest.xml +++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleAndConfigurableProductsWithCustomOptionsTest.xml @@ -79,7 +79,7 @@ <!-- Login as admin --> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - <actionGroup ref="deleteAllExportedFiles" stepKey="clearExportedFilesList"/> + <actionGroup ref="DeleteAllExportedFilesActionGroup" stepKey="clearExportedFilesList"/> </before> <after> <!-- Delete configurable product creation --> @@ -90,7 +90,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <!-- Delete exported file --> - <actionGroup ref="deleteExportedFile" stepKey="deleteExportedFile"> + <actionGroup ref="DeleteExportedFileActionGroup" stepKey="deleteExportedFile"> <argument name="rowIndex" value="0"/> </actionGroup> <!-- Log out --> @@ -102,7 +102,7 @@ <waitForPageLoad stepKey="waitForExportIndexPageLoad"/> <!-- Fill entity attributes data --> - <actionGroup ref="exportProductsFilterByAttribute" stepKey="exportProductBySku"> + <actionGroup ref="ExportProductsFilterByAttributeActionGroup" stepKey="exportProductBySku"> <argument name="attribute" value="sku"/> <argument name="attributeData" value="$$createConfigProduct.sku$$"/> </actionGroup> @@ -112,7 +112,7 @@ <magentoCLI command="cron:run" stepKey="runCron4"/> <!-- Download product --> - <actionGroup ref="downloadFileByRowIndex" stepKey="downloadCreatedProducts"> + <actionGroup ref="DownloadFileByRowIndexActionGroup" stepKey="downloadCreatedProducts"> <argument name="rowIndex" value="0"/> </actionGroup> </test> diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAndConfigurableProductsWithAssignedImagesTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAndConfigurableProductsWithAssignedImagesTest.xml index f6690199d63fe..e00346654ecf4 100644 --- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAndConfigurableProductsWithAssignedImagesTest.xml +++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAndConfigurableProductsWithAssignedImagesTest.xml @@ -95,7 +95,7 @@ <!-- Login as admin --> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - <actionGroup ref="deleteAllExportedFiles" stepKey="clearExportedFilesList"/> + <actionGroup ref="DeleteAllExportedFilesActionGroup" stepKey="clearExportedFilesList"/> </before> <after> <!-- Delete configurable product creation --> @@ -106,7 +106,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <!-- Delete exported file --> - <actionGroup ref="deleteExportedFile" stepKey="deleteExportedFile"> + <actionGroup ref="DeleteExportedFileActionGroup" stepKey="deleteExportedFile"> <argument name="rowIndex" value="0"/> </actionGroup> <!-- Log out --> @@ -117,7 +117,7 @@ <amOnPage url="{{AdminExportIndexPage.url}}" stepKey="goToExportIndexPage"/> <!-- Fill entity attributes data --> - <actionGroup ref="exportProductsFilterByAttribute" stepKey="exportProductBySku"> + <actionGroup ref="ExportProductsFilterByAttributeActionGroup" stepKey="exportProductBySku"> <argument name="attribute" value="sku"/> <argument name="attributeData" value="$$createConfigProduct.sku$$"/> </actionGroup> @@ -127,7 +127,7 @@ <magentoCLI command="cron:run" stepKey="runCron4"/> <!-- Download product --> - <actionGroup ref="downloadFileByRowIndex" stepKey="downloadCreatedProducts"> + <actionGroup ref="DownloadFileByRowIndexActionGroup" stepKey="downloadCreatedProducts"> <argument name="rowIndex" value="0"/> </actionGroup> </test> diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAssignedToMainWebsiteAndConfigurableProductAssignedToCustomWebsiteTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAssignedToMainWebsiteAndConfigurableProductAssignedToCustomWebsiteTest.xml index 271b4621d1a96..04be8f3ae823e 100644 --- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAssignedToMainWebsiteAndConfigurableProductAssignedToCustomWebsiteTest.xml +++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAssignedToMainWebsiteAndConfigurableProductAssignedToCustomWebsiteTest.xml @@ -77,7 +77,7 @@ <!-- Login as admin --> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - <actionGroup ref="deleteAllExportedFiles" stepKey="clearExportedFilesList"/> + <actionGroup ref="DeleteAllExportedFilesActionGroup" stepKey="clearExportedFilesList"/> </before> <after> <!-- Delete simple product --> @@ -91,7 +91,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <!-- Delete exported file --> - <actionGroup ref="deleteExportedFile" stepKey="deleteExportedFile"> + <actionGroup ref="DeleteExportedFileActionGroup" stepKey="deleteExportedFile"> <argument name="rowIndex" value="0"/> </actionGroup> <!-- Log out --> @@ -103,14 +103,14 @@ <waitForPageLoad stepKey="waitForExportIndexPageLoad"/> <!-- Export created below products --> - <actionGroup ref="exportAllProducts" stepKey="exportCreatedProducts"/> + <actionGroup ref="ExportAllProductsActionGroup" stepKey="exportCreatedProducts"/> <!-- Run cron --> <magentoCLI command="cron:run" stepKey="runCron3"/> <magentoCLI command="cron:run" stepKey="runCron4"/> <!-- Download product --> - <actionGroup ref="downloadFileByRowIndex" stepKey="downloadCreatedProducts"> + <actionGroup ref="DownloadFileByRowIndexActionGroup" stepKey="downloadCreatedProducts"> <argument name="rowIndex" value="0"/> </actionGroup> </test> diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductWithCustomAttributeTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductWithCustomAttributeTest.xml index 238a3286dc40d..8553fb8a2cf7e 100644 --- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductWithCustomAttributeTest.xml +++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductWithCustomAttributeTest.xml @@ -34,7 +34,7 @@ <!-- Login as admin --> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - <actionGroup ref="deleteAllExportedFiles" stepKey="clearExportedFilesList"/> + <actionGroup ref="DeleteAllExportedFilesActionGroup" stepKey="clearExportedFilesList"/> </before> <after> <!-- Delete product creations --> @@ -43,7 +43,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <!-- Delete exported file --> - <actionGroup ref="deleteExportedFile" stepKey="deleteExportedFile"> + <actionGroup ref="DeleteExportedFileActionGroup" stepKey="deleteExportedFile"> <argument name="rowIndex" value="0"/> </actionGroup> <!-- Log out --> @@ -55,14 +55,14 @@ <waitForPageLoad stepKey="waitForExportIndexPageLoad"/> <!-- Export created below products --> - <actionGroup ref="exportAllProducts" stepKey="exportCreatedProducts"/> + <actionGroup ref="ExportAllProductsActionGroup" stepKey="exportCreatedProducts"/> <!-- Run cron --> <magentoCLI command="cron:run" stepKey="runCron3"/> <magentoCLI command="cron:run" stepKey="runCron4"/> <!-- Download product --> - <actionGroup ref="downloadFileByRowIndex" stepKey="downloadCreatedProducts"> + <actionGroup ref="DownloadFileByRowIndexActionGroup" stepKey="downloadCreatedProducts"> <argument name="rowIndex" value="0"/> </actionGroup> </test> From 534ccc2a858fb04fa7b35fc506be2b4a6409e750 Mon Sep 17 00:00:00 2001 From: Willem Wigman <wigman@users.noreply.github.com> Date: Fri, 29 Nov 2019 15:11:19 +0100 Subject: [PATCH 0184/1143] Add isTopSearchResult() to SearchQueryCollection. isTopSearchResult looks up the number of matches in a single query, without loading the records/data. --- .../Model/ResourceModel/Query/Collection.php | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/app/code/Magento/Search/Model/ResourceModel/Query/Collection.php b/app/code/Magento/Search/Model/ResourceModel/Query/Collection.php index a1bc1df3f9bdb..c9a983dd8589b 100644 --- a/app/code/Magento/Search/Model/ResourceModel/Query/Collection.php +++ b/app/code/Magento/Search/Model/ResourceModel/Query/Collection.php @@ -149,6 +149,36 @@ public function setPopularQueryFilter($storeIds = null) return $this; } + /** + * Determines whether a Search Term belongs to the top results for given storeId + * + * @param string $term + * @param int $storeId + * @param int $maxCountCacheableSearchTerms + * @return bool + */ + public function isTopSearchResult(string $term, int $storeId, int $maxCountCacheableSearchTerms):bool + { + $select = $this->getSelect(); + $select->reset(\Magento\Framework\DB\Select::FROM); + $select->reset(\Magento\Framework\DB\Select::COLUMNS); + $select->distinct(true); + $select->from(['main_table' => $this->getTable('search_query')], ['query_text']); + $select->where('main_table.store_id IN (?)', $storeId); + $select->where('num_results > 0'); + $select->order(['popularity desc']); + + $select->limit($maxCountCacheableSearchTerms); + + $subQuery = new \Zend_Db_Expr('(' . $select->assemble() . ')'); + + $select->reset(); + $select->from(['result' => $subQuery ], []); + $select->where('result.query_text = ?', $term); + + return $this->getSize() > 0; + } + /** * Set Recent Queries Order * From 1c8b19ab67ca44876017a696a129b9e033c8fa76 Mon Sep 17 00:00:00 2001 From: Willem Wigman <wigman@users.noreply.github.com> Date: Fri, 29 Nov 2019 15:32:04 +0100 Subject: [PATCH 0185/1143] Get isTopSearchResult() from queryCollection Logic to determine if search term is a 'TopSearchResult' moved to Collection. --- app/code/Magento/Search/Model/PopularSearchTerms.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Search/Model/PopularSearchTerms.php b/app/code/Magento/Search/Model/PopularSearchTerms.php index d5ddc0e1dac5f..e8489b2563280 100644 --- a/app/code/Magento/Search/Model/PopularSearchTerms.php +++ b/app/code/Magento/Search/Model/PopularSearchTerms.php @@ -48,13 +48,8 @@ public function __construct( */ public function isCacheable(string $term, int $storeId) { - $terms = $this->queryCollection - ->setPopularQueryFilter($storeId) - ->setPageSize($this->getMaxCountCacheableSearchTerms($storeId)) - ->load() - ->getColumnValues('query_text'); - - return in_array($term, $terms); + $maxCountCacheableSearchTerms = $this->getMaxCountCacheableSearchTerms($storeId); + return $this->queryCollection->isTopSearchResult($term, $storeId, $maxCountCacheableSearchTerms); } /** From 8d5f075229d15b23ef6c607c25481ab122c15903 Mon Sep 17 00:00:00 2001 From: Willem Wigman <wigman@users.noreply.github.com> Date: Fri, 29 Nov 2019 17:04:43 +0100 Subject: [PATCH 0186/1143] Updated testIsCacheable --- .../Unit/Model/PopularSearchTermsTest.php | 37 +++++-------------- 1 file changed, 9 insertions(+), 28 deletions(-) diff --git a/app/code/Magento/Search/Test/Unit/Model/PopularSearchTermsTest.php b/app/code/Magento/Search/Test/Unit/Model/PopularSearchTermsTest.php index 849a0c067d459..8381213d12706 100644 --- a/app/code/Magento/Search/Test/Unit/Model/PopularSearchTermsTest.php +++ b/app/code/Magento/Search/Test/Unit/Model/PopularSearchTermsTest.php @@ -49,47 +49,28 @@ protected function setUp() /** * Test isCacheableDataProvider method * - * @dataProvider isCacheableDataProvider - * * @param string $term * @param array $terms * @param $expected $terms * * @return void */ - public function testIsCacheable($term, $terms, $expected) + public function testIsCacheable() { - $storeId = 7; - $pageSize = 25; - + $term = 'test1'; + $storeId = 1; + $pageSize = 35; + $this->scopeConfigMock->expects($this->once())->method('getValue') ->with( PopularSearchTerms::XML_PATH_MAX_COUNT_CACHEABLE_SEARCH_TERMS, ScopeInterface::SCOPE_STORE, $storeId )->willReturn($pageSize); - $this->queryCollectionMock->expects($this->once())->method('setPopularQueryFilter')->with($storeId) - ->willReturnSelf(); - $this->queryCollectionMock->expects($this->once())->method('setPageSize')->with($pageSize) - ->willReturnSelf(); - $this->queryCollectionMock->expects($this->once())->method('load')->willReturnSelf(); - $this->queryCollectionMock->expects($this->once())->method('getColumnValues')->with('query_text') - ->willReturn($terms); - - $actual = $this->popularSearchTerms->isCacheable($term, $storeId); - self::assertEquals($expected, $actual); - } + $this->queryCollectionMock->expects($this->once())->method('isTopSearchResult')->with($term, $storeId, $pageSize) + ->willReturn(true, false); - /** - * @return array - */ - public function isCacheableDataProvider() - { - return [ - ['test01', [], false], - ['test02', ['test01', 'test02'], true], - ['test03', ['test01', 'test02'], false], - ['test04', ['test04'], true], - ]; + $this->assertTrue($this->popularSearchTerms->isCacheable($term, $storeId)); + $this->assertFalse($this->popularSearchTerms->isCacheable($term, $storeId)); } } From 70255841f3d6f0f596329c1d1a4ee2cd1699ec73 Mon Sep 17 00:00:00 2001 From: Willem Wigman <wigman@users.noreply.github.com> Date: Fri, 29 Nov 2019 17:23:42 +0100 Subject: [PATCH 0187/1143] Test 2 --- .../Magento/Search/Test/Unit/Model/PopularSearchTermsTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Search/Test/Unit/Model/PopularSearchTermsTest.php b/app/code/Magento/Search/Test/Unit/Model/PopularSearchTermsTest.php index 8381213d12706..e8e3ead3a7029 100644 --- a/app/code/Magento/Search/Test/Unit/Model/PopularSearchTermsTest.php +++ b/app/code/Magento/Search/Test/Unit/Model/PopularSearchTermsTest.php @@ -67,7 +67,7 @@ public function testIsCacheable() ScopeInterface::SCOPE_STORE, $storeId )->willReturn($pageSize); - $this->queryCollectionMock->expects($this->once())->method('isTopSearchResult')->with($term, $storeId, $pageSize) + $this->queryCollectionMock->expects($this->exact(2))->method('isTopSearchResult')->with($term, $storeId, $pageSize) ->willReturn(true, false); $this->assertTrue($this->popularSearchTerms->isCacheable($term, $storeId)); From 0262f1428561f5c329a50bfbd62714fa58e175be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Fri, 29 Nov 2019 17:26:23 +0100 Subject: [PATCH 0188/1143] REFACTOR: Extract Action Groups to separate files (according to MFTF best practices) --- .../Test/AdminDashboardWithChartsChart.xml | 2 +- ...thOnlinePaymentIncludingTaxAndDiscount.xml | 2 +- .../Mftf/Test/AdminAddBundleItemsTest.xml | 10 +- ...undleProductToCartFromWishListPageTest.xml | 2 +- .../AdminAddDefaultImageBundleProductTest.xml | 18 +- .../AdminAddDefaultVideoBundleProductTest.xml | 10 +- ...inAssociateBundleProductToWebsitesTest.xml | 10 +- .../Test/AdminAttributeSetSelectionTest.xml | 4 +- .../AdminBasicBundleProductAttributesTest.xml | 6 +- .../AdminBundleProductSetEditContentTest.xml | 6 +- ...CreateAndEditBundleProductSettingsTest.xml | 18 +- .../Mftf/Test/AdminDeleteABundleProduct.xml | 6 +- .../AdminDeleteBundleDynamicProductTest.xml | 2 +- .../AdminDeleteBundleFixedProductTest.xml | 2 +- .../AdminEditRelatedBundleProductTest.xml | 10 +- .../AdminFilterProductListByBundleProduct.xml | 4 +- .../Test/AdminMassDeleteBundleProducts.xml | 8 +- .../Test/AdminProductBundleCreationTest.xml | 6 +- ...minRemoveDefaultImageBundleProductTest.xml | 24 +- ...minRemoveDefaultVideoBundleProductTest.xml | 10 +- ...sUpdateAttributesForBundleProductsTest.xml | 6 +- .../Test/BundleProductFixedPricingTest.xml | 8 +- .../BundleProductWithTierPriceInCartTest.xml | 4 +- ...urrencyChangingBundleProductInCartTest.xml | 4 +- .../EnableDisableBundleProductStatusTest.xml | 6 +- .../Test/Mftf/Test/EndToEndB2CAdminTest.xml | 8 +- .../MassEnableDisableBundleProductsTest.xml | 8 +- .../Test/NewBundleProductSelectionTest.xml | 2 +- ...NewProductsListWidgetBundleProductTest.xml | 4 +- .../StorefrontAddBundleOptionsToCartTest.xml | 8 +- .../Mftf/Test/StorefrontAdminEditDataTest.xml | 12 +- .../Mftf/Test/StorefrontBundleCartTest.xml | 12 +- .../StorefrontBundleProductDetailsTest.xml | 6 +- ...undleProductShownInCategoryListAndGrid.xml | 6 +- ...rontCheckBundleProductOptionTierPrices.xml | 4 +- ...tCustomerSelectAndSetBundleOptionsTest.xml | 8 +- .../Test/StorefrontEditBundleProductTest.xml | 10 +- ...ontGoToDetailsPageWhenAddingToCartTest.xml | 4 +- ...torefrontSortBundleProductsByPriceTest.xml | 2 +- ...oductPricesForCombinationOfOptionsTest.xml | 2 +- .../AddCategoryImageActionGroup.xml | 31 + .../AddCrossSellProductBySkuActionGroup.xml | 32 + ...ductAttributeInProductModalActionGroup.xml | 28 + ...AddProductCustomOptionFieldActionGroup.xml | 31 + .../AddProductCustomOptionFileActionGroup.xml | 30 + .../AddProductImageActionGroup.xml | 26 + ...rtFromStorefrontProductPageActionGroup.xml | 22 + .../AddRelatedProductBySkuActionGroup.xml | 32 + ... => AddSimpleProductToCartActionGroup.xml} | 8 +- .../AddSpecialPriceToProductActionGroup.xml | 28 + ...rtFromStorefrontProductPageActionGroup.xml | 28 + .../AddUpSellProductBySkuActionGroup.xml | 26 + ...AdvancedPricingToTheProductActionGroup.xml | 12 - ...PricingToTheProductExtendedActionGroup.xml | 21 + ...dUnassignedAttributeToGroupActionGroup.xml | 21 + ...tProductCustomOptionVisibleActionGroup.xml | 19 + ...ertProductHasNoCustomOptionActionGroup.xml | 15 + ...rtProductHasNoCustomOptionsActionGroup.xml | 16 + ...dminAssignProductToCategoryActionGroup.xml | 25 + .../ActionGroup/AdminCategoryActionGroup.xml | 459 ----------- .../AdminCategoryAssignProductActionGroup.xml | 25 + ...singInCategoryProductsGridActionGroup.xml} | 9 +- ...itionInCategoryProductsGridActionGroup.xml | 18 + ...ckOnAdvancedInventoryButtonActionGroup.xml | 19 + ...lickOnAdvancedInventoryLinkActionGroup.xml | 11 - ...ateAttributeFromProductPageActionGroup.xml | 27 + ...uteFromProductPageWithScopeActionGroup.xml | 18 + ...teAttributeWithSearchWeightActionGroup.xml | 27 + ...TwoStoreViesFromProductPageActionGroup.xml | 35 + ...CreateCatalogProductWidgetActionGroup.xml} | 12 - ...reateRecentlyProductsWidgetActionGroup.xml | 22 + ...eSearchableProductAttributeActionGroup.xml | 16 + ...ductWithTextOptionCharLimitActionGroup.xml | 47 ++ ...leteAllProductCustomOptionsActionGroup.xml | 26 + .../AdminDeleteCategoryByNameActionGroup.xml | 23 + ...inDeleteProductCustomOptionActionGroup.xml | 15 + ...lProductAttributePropertiesActionGroup.xml | 12 - ...ProductCountryOfManufactureActionGroup.xml | 17 + ...AdminProcessProductWebsitesActionGroup.xml | 17 + .../ActionGroup/AdminProductActionGroup.xml | 759 ------------------ ...AdminProductAddSpecialPriceActionGroup.xml | 28 + ...ricingNewCustomerGroupPriceActionGroup.xml | 24 + .../AdminProductAttributeActionGroup.xml | 379 --------- .../AdminProductAttributeSetActionGroup.xml | 126 +-- .../AdminProductGridActionGroup.xml | 445 ---------- ...teAttributeSetWithAttributeActionGroup.xml | 35 + ...illTextAttributeValueByNameActionGroup.xml | 23 + ...oductPageSelectAttributeSetActionGroup.xml | 23 + .../AdminSetProductDisabledActionGroup.xml | 15 + ...tchScopeForProductAttributeActionGroup.xml | 19 + ...scountsPercentageOfProductsActionGroup.xml | 27 + ...escriptionInProductEditFormActionGroup.xml | 18 + ...roductImageAdminProductPageActionGroup.xml | 23 + ...tImageNotInAdminProductPageActionGroup.xml | 23 + ...NotInStorefrontProductPage2ActionGroup.xml | 24 + ...eNotInStorefrontProductPageActionGroup.xml | 24 + ...ImageStorefrontProductPage2ActionGroup.xml | 24 + ...tImageStorefrontProductPageActionGroup.xml | 24 + ...ductInStorefrontProductPageActionGroup.xml | 34 +- ...tProductIsAssignedToWebsiteActionGroup.xml | 15 + ...oductIsNotAssignedToWebsiteActionGroup.xml | 15 + ...dSkuInStorefrontProductPageActionGroup.xml | 26 + ...PageByCustomAttributeUrlKeyActionGroup.xml | 26 + ...roductNameInProductEditFormActionGroup.xml | 17 + .../AssertProductOnAdminGridActionGroup.xml | 2 +- ...AssertProductOnCategoryPageActionGroup.xml | 19 + ...latedUpSellCrossSellSectionActionGroup.xml | 24 + ...sAvailableInProductWebsitesActionGroup.xml | 19 + ...tAvailableInProductWebsitesActionGroup.xml | 15 + .../CategoryPresentActionGroup.xml | 26 + .../ChangeSeoUrlKeyActionGroup.xml | 24 + ...angeSeoUrlKeyForSubCategoryActionGroup.xml | 25 + ...atusProductUsingProductGridActionGroup.xml | 38 + ...eConditionsProductAttributeActionGroup.xml | 25 + ...tributeInMoreInformationTabActionGroup.xml | 24 + ...buteNotInMoreInformationTabActionGroup.xml | 22 + .../CheckCategoryImageInAdminActionGroup.xml | 28 + ...CategoryNameIsRequiredFieldActionGroup.xml | 23 + .../CheckCategoryOnStorefrontActionGroup.xml | 24 + ...eckCustomizableOptionImportActionGroup.xml | 27 + ...RequiredFieldsInProductFormActionGroup.xml | 25 + .../ClearProductsFilterActionGroup.xml | 20 + ...ConfirmChangeInputTypeModalActionGroup.xml | 20 + ...eAttributeDropdownNthOptionActionGroup.xml | 26 + ...eDropdownNthOptionAsDefaultActionGroup.xml | 18 + .../ActionGroup/CreateCategoryActionGroup.xml | 30 + .../CreateCustomRadioOptionsActionGroup.xml | 43 + .../CreateDefaultAttributeSetActionGroup.xml | 25 + .../CreateProductAttributeActionGroup.xml | 25 + ...oductAttributeWithDateFieldActionGroup.xml | 23 + ...oductAttributeWithTextFieldActionGroup.xml | 20 + ...impleProductAndAddToWebsiteActionGroup.xml | 34 + ...atedProductConnectToWebsiteActionGroup.xml | 29 + .../ActionGroup/CustomOptionsActionGroup.xml | 172 ---- ...cateProductUsingProductGridActionGroup.xml | 21 + ...AllProductsUsingProductGridActionGroup.xml | 29 + .../DeleteAttributeSetByLabelActionGroup.xml | 30 + .../ActionGroup/DeleteCategoryActionGroup.xml | 31 + ...leteDefaultCategoryChildrenActionGroup.xml | 35 + .../DeleteMostRecentCategoryActionGroup.xml | 25 + .../DeleteProductAttributeActionGroup.xml | 21 + ...uctAttributeByAttributeCodeActionGroup.xml | 18 +- ...leteProductAttributeByLabelActionGroup.xml | 29 + .../DeleteProductByNameActionGroup.xml | 25 + .../DeleteProductBySkuActionGroup.xml | 34 + ...leteProductUsingProductGridActionGroup.xml | 35 + .../DeleteProductsByKeywordActionGroup.xml | 31 + .../DeleteProductsIfTheyExistActionGroup.xml | 24 + .../ExpandAdminProductSectionActionGroup.xml | 25 + .../FillAdminSimpleProductFormActionGroup.xml | 38 + .../FillCategoryFormActionGroup.xml | 23 + ...ategoryNameAndUrlKeyAndSaveActionGroup.xml | 29 + .../FillMainProductFormActionGroup.xml | 28 + ...FillMainProductFormByStringActionGroup.xml | 32 + ...FillMainProductFormNoWeightActionGroup.xml | 26 + .../FillNewProductCategoryActionGroup.xml | 34 + ...ductNameAndSkuInProductFormActionGroup.xml | 22 + .../FilterAndSelectProductActionGroup.xml | 30 + ...uctAttributeByAttributeCodeActionGroup.xml | 24 + ...ctAttributeByAttributeLabelActionGroup.xml | 23 + ...ductAttributeByDefaultLabelActionGroup.xml | 24 + ...teSetGridByAttributeSetNameActionGroup.xml | 25 + ...ProductGridByDisabledStatusActionGroup.xml | 22 + ...rProductGridByEnabledStatusActionGroup.xml | 22 + .../FilterProductGridByName2ActionGroup.xml | 25 + .../FilterProductGridByNameActionGroup.xml | 25 + ...lterProductGridByPriceRangeActionGroup.xml | 26 + ...ProductGridBySetNewFromDateActionGroup.xml | 22 + .../FilterProductGridBySku2ActionGroup.xml | 25 + .../FilterProductGridBySkuActionGroup.xml | 25 + ...lterProductGridBySkuAndNameActionGroup.xml | 25 + .../GoToAdminCategoryPageByIdActionGroup.xml | 23 + .../GoToAttributeGridPageActionGroup.xml | 18 + .../GoToAttributeSetByNameActionGroup.xml | 25 + .../GoToCreateCategoryPageActionGroup.xml | 25 + .../GoToCreateProductPageActionGroup.xml | 27 + .../GoToProductCatalogPageActionGroup.xml | 20 + .../GoToProductPageViaIDActionGroup.xml | 21 + ...oSpecifiedCreateProductPageActionGroup.xml | 25 + ...ontCategoryPageByParametersActionGroup.xml | 28 + .../GoToSubCategoryPageActionGroup.xml | 29 + ...tProductCustomizableOptionsActionGroup.xml | 29 + ...tAttributeGridToDefaultViewActionGroup.xml | 21 + ...setProductGridToDefaultViewActionGroup.xml | 19 + .../NavigateToCreatedCategoryActionGroup.xml | 26 + ...teToCreatedProductAttributeActionGroup.xml | 25 + ...ateToCreatedProductEditPageActionGroup.xml | 37 + ...igateToEditProductAttributeActionGroup.xml | 26 + .../NavigateToMediaGalleryActionGroup.xml | 25 + ...penCategoryFromCategoryTreeActionGroup.xml | 27 + ...ingRowXColumnYInProductGridActionGroup.xml | 22 + .../ProductSetAdvancedPricingActionGroup.xml | 38 + ...SetAdvancedTierFixedPricingActionGroup.xml | 15 + .../ProductSetWebsiteActionGroup.xml | 28 + .../RemoveCategoryFromProductActionGroup.xml | 19 + .../RemoveCategoryImageActionGroup.xml | 24 + .../RemoveProductImageActionGroup.xml | 20 + .../RemoveProductImageByNameActionGroup.xml | 21 + .../ResetImportOptionFilterActionGroup.xml | 20 + ...setProductGridToDefaultViewActionGroup.xml | 23 + .../SaveAttributeSetActionGroup.xml | 19 + .../SaveCategoryFormActionGroup.xml | 20 + .../SaveProductAttributeActionGroup.xml | 21 + .../SaveProductAttributeInUseActionGroup.xml | 21 + .../SaveProductFormActionGroup.xml | 22 + ...veProductFormNoSuccessCheckActionGroup.xml | 19 + .../SearchForProductOnBackendActionGroup.xml | 22 - ...chForProductOnBackendByNameActionGroup.xml | 22 + ...SearchProductGridByKeyword2ActionGroup.xml | 23 + .../SearchProductGridByKeywordActionGroup.xml | 23 + .../SelectProductInWebsitesActionGroup.xml | 24 + .../SetCategoryByNameActionGroup.xml | 21 + .../SetProductUrlKeyActionGroup.xml | 22 + .../SetProductUrlKeyByStringActionGroup.xml | 22 + .../SortProductsByIdAscendingActionGroup.xml | 19 + .../SortProductsByIdDescendingActionGroup.xml | 19 + ...AddCategoryProductToCompareActionGroup.xml | 25 + ...orefrontAddProductToCompareActionGroup.xml | 23 + ...rontAddSimpleProductWithQtyActionGroup.xml | 17 + ...ontAssertActiveProductImageActionGroup.xml | 17 + ...rtFotoramaImageAvailabilityActionGroup.xml | 17 + ...tProductImagesOnProductPageActionGroup.xml | 8 - ...uctInRecentlyComparedWidgetActionGroup.xml | 22 + ...ductInRecentlyOrderedWidgetActionGroup.xml | 22 + ...efrontAssertProductInWidgetActionGroup.xml | 26 - ...tProductPriceOnCategoryPageActionGroup.xml | 21 + .../StorefrontCategoryActionGroup.xml | 124 --- ...ntCategoryPageSortAscendingActionGroup.xml | 17 + ...tCategoryPageSortDescendingActionGroup.xml | 17 + ...rontCategoryPageSortProductActionGroup.xml | 12 - ...CheckAddToCartButtonAbsenceActionGroup.xml | 18 + .../StorefrontCheckCategoryActionGroup.xml | 25 + ...tCheckCategorySimpleProductActionGroup.xml | 26 + ...tCheckCompareSidebarProductActionGroup.xml | 21 + ...ntCheckCompareSimpleProductActionGroup.xml | 25 + ...ssingInCategoryProductsPageActionGroup.xml | 7 - ...refrontCheckProductPositionActionGroup.xml | 18 + ...CheckProductPriceInCategoryActionGroup.xml | 12 +- ...torefrontCheckSimpleProductActionGroup.xml | 30 + .../StorefrontClearCompareActionGroup.xml | 24 + .../StorefrontCompareActionGroup.xml | 95 --- .../StorefrontGoToCategoryPageActionGroup.xml | 9 +- ...orefrontGoToSubCategoryPageActionGroup.xml | 18 + ...rontOpenAndCheckComparisionActionGroup.xml | 22 + .../StorefrontOpenProductPageActionGroup.xml | 11 - ...penProductPageOnSecondStoreActionGroup.xml | 22 + .../StorefrontProductActionGroup.xml | 90 --- .../StorefrontProductPageActionGroup.xml | 87 -- ...witchCategoryViewToListModeActionGroup.xml | 19 + .../SwitchCategoryStoreViewActionGroup.xml | 33 + ...witchCategoryToAllStoreViewActionGroup.xml | 31 + .../SwitchToTheNewStoreViewActionGroup.xml | 26 + .../TestDynamicValidationHintActionGroup.xml | 30 + .../ToggleProductEnabledActionGroup.xml | 18 + .../UnassignAttributeFromGroupActionGroup.xml | 26 + .../UnassignWebsiteFromProductActionGroup.xml | 15 + ...erifyCategoryPageParametersActionGroup.xml | 29 + .../ViewProductInAdminGridActionGroup.xml | 31 + .../Test/Mftf/Test/AddToCartCrossSellTest.xml | 10 +- .../AdminAddDefaultImageSimpleProductTest.xml | 16 +- ...AdminAddDefaultImageVirtualProductTest.xml | 16 +- .../AdminAddDefaultVideoSimpleProductTest.xml | 10 +- ...AdminAddDefaultVideoVirtualProductTest.xml | 6 +- .../Test/AdminAddImageForCategoryTest.xml | 16 +- .../AdminAddImageToWYSIWYGCatalogTest.xml | 2 +- .../AdminAddImageToWYSIWYGProductTest.xml | 2 +- .../AdminAddInStockProductToTheCartTest.xml | 2 +- .../Test/AdminApplyTierPriceToProductTest.xml | 18 +- ...signProductAttributeToAttributeSetTest.xml | 4 +- ...inBackorderAllowedAddProductToCartTest.xml | 2 +- .../Test/AdminChangeProductAttributeSet.xml | 4 +- ...oductPriceWithDisabledChildProductTest.xml | 2 +- ...StockProductIsNotVisibleInCategoryTest.xml | 2 +- ...tOfStockProductIsVisibleInCategoryTest.xml | 2 +- .../AdminCloneProductWithDuplicateUrlTest.xml | 12 +- ...CreateAndEditSimpleProductSettingsTest.xml | 16 +- ...reateAndEditVirtualProductSettingsTest.xml | 18 +- .../Test/AdminCreateAndSwitchProductType.xml | 26 +- .../AdminCreateAttributeSetEntityTest.xml | 8 +- ...AdminCreateCategoryFromProductPageTest.xml | 8 +- ...AdminCreateCategoryWithAnchorFieldTest.xml | 2 +- ...eateCategoryWithCustomRootCategoryTest.xml | 4 +- ...CreateCategoryWithInactiveCategoryTest.xml | 2 +- ...eCategoryWithInactiveIncludeInMenuTest.xml | 2 +- ...inCreateCategoryWithProductsGridFilter.xml | 8 +- ...inCreateCategoryWithRequiredFieldsTest.xml | 2 +- ...mProductAttributeWithDropdownFieldTest.xml | 4 +- ...dminCreateDropdownProductAttributeTest.xml | 6 +- ...ibleInStorefrontAdvancedSearchFormTest.xml | 6 +- .../Test/AdminCreateDuplicateCategoryTest.xml | 4 +- .../Test/AdminCreateDuplicateProductTest.xml | 10 +- ...ibleInStorefrontAdvancedSearchFormTest.xml | 6 +- ...nCreateNewAttributeFromProductPageTest.xml | 4 +- ...AdminCreateNewAttributeFromProductTest.xml | 4 +- ...AdminCreateNewGroupForAttributeSetTest.xml | 14 +- ...ateProductAttributeFromProductPageTest.xml | 4 +- ...eProductAttributeRequiredTextFieldTest.xml | 4 +- .../AdminCreateProductCustomAttributeSet.xml | 4 +- .../AdminCreateProductDuplicateUrlkeyTest.xml | 2 +- ...CreateRootCategoryAndSubcategoriesTest.xml | 12 +- ...inCreateRootCategoryRequiredFieldsTest.xml | 2 +- .../Test/AdminCreateSimpleProductTest.xml | 4 +- ...untryOfManufactureAttributeSKUMaskTest.xml | 2 +- ...dminCreateSimpleProductWithUnicodeTest.xml | 4 +- ...inCreateTextEditorProductAttributeTest.xml | 18 +- ...tualProductOutOfStockWithTierPriceTest.xml | 2 +- ...CustomOptionsSuiteAndImportOptionsTest.xml | 2 +- ...roductWithTierPriceForGeneralGroupTest.xml | 2 +- .../Mftf/Test/AdminDeleteAttributeSetTest.xml | 2 +- ...minDeleteConfigurableChildProductsTest.xml | 4 +- ...wnProductAttributeFromAttributeSetTest.xml | 6 +- .../Test/AdminDeleteProductAttributeTest.xml | 8 +- ...AdminDeleteProductWithCustomOptionTest.xml | 2 +- ...roductsImageInCaseOfMultipleStoresTest.xml | 40 +- .../Test/AdminDeleteSimpleProductTest.xml | 2 +- ...ldProductAttributeFromAttributeSetTest.xml | 8 +- .../Test/AdminDeleteVirtualProductTest.xml | 2 +- ...sableProductOnChangingAttributeSetTest.xml | 2 +- ...dminEditTextEditorProductAttributeTest.xml | 2 +- ...lterByNameByStoreViewOnProductGridTest.xml | 6 +- ...CategoryProductsUsingScopeSelectorTest.xml | 6 +- ...dPageNumberAfterSaveAndCloseActionTest.xml | 4 +- ...CustomizableOptionToProductWithSKUTest.xml | 10 +- .../AdminMassChangeProductsStatusTest.xml | 4 +- .../Test/AdminMassProductPriceUpdateTest.xml | 4 +- ...UpdateProductAttributesGlobalScopeTest.xml | 6 +- ...ductAttributesMissingRequiredFieldTest.xml | 2 +- ...ateProductAttributesStoreViewScopeTest.xml | 8 +- ...sUpdateProductStatusStoreViewScopeTest.xml | 18 +- ...CategoryFromParentAnchoredCategoryTest.xml | 2 +- ...oryToAnotherPositionInCategoryTreeTest.xml | 2 +- .../AdminMoveProductBetweenCategoriesTest.xml | 8 +- ...dminNavigateMultipleUpSellProductsTest.xml | 10 +- ...egoryIndexerInUpdateOnScheduleModeTest.xml | 6 +- ...nAssignedToCategoryWithoutCustomURLKey.xml | 10 +- ...ductGridFilteringByCustomAttributeTest.xml | 10 +- ...roductGridFilteringByDateAttributeTest.xml | 4 +- ...ctImageAssignmentForMultipleStoresTest.xml | 12 +- ...AdminProductTypeSwitchingOnEditingTest.xml | 8 +- ...dminRemoveCustomOptionsFromProductTest.xml | 38 +- ...minRemoveDefaultImageSimpleProductTest.xml | 20 +- ...inRemoveDefaultImageVirtualProductTest.xml | 20 +- ...minRemoveDefaultVideoSimpleProductTest.xml | 10 +- ...inRemoveDefaultVideoVirtualProductTest.xml | 6 +- .../AdminRemoveImageAffectsAllScopesTest.xml | 22 +- .../Test/AdminRemoveImageFromCategoryTest.xml | 20 +- ...ctedUserAddCategoryFromProductPageTest.xml | 16 +- ...ToAssociateSimpleProductToWebsitesTest.xml | 6 +- .../Test/AdminSimpleProductImagesTest.xml | 36 +- .../AdminSimpleProductSetEditContentTest.xml | 6 +- .../AdminSimpleSetEditRelatedProductsTest.xml | 20 +- .../Mftf/Test/AdminSortingByWebsitesTest.xml | 4 +- ...gnProductAttributeFromAttributeSetTest.xml | 6 +- .../AdminUpdateCategoryStoreUrlKeyTest.xml | 10 +- ...rifyDataOverridingOnStoreViewLevelTest.xml | 4 +- ...rifyDataOverridingOnStoreViewLevelTest.xml | 4 +- ...dminUpdateSimpleProductTieredPriceTest.xml | 4 +- ...RegularPriceInStockDisabledProductTest.xml | 4 +- ...WithRegularPriceInStockEnabledFlatTest.xml | 4 +- ...PriceInStockNotVisibleIndividuallyTest.xml | 4 +- ...arPriceInStockUnassignFromCategoryTest.xml | 4 +- ...ceInStockVisibleInCatalogAndSearchTest.xml | 4 +- ...arPriceInStockVisibleInCatalogOnlyTest.xml | 4 +- ...larPriceInStockVisibleInSearchOnlyTest.xml | 4 +- ...gularPriceInStockWithCustomOptionsTest.xml | 4 +- ...eProductWithRegularPriceOutOfStockTest.xml | 4 +- ...rPriceInStockVisibleInCategoryOnlyTest.xml | 2 +- ...eInStockVisibleInCategoryAndSearchTest.xml | 2 +- ...rPriceInStockVisibleInCategoryOnlyTest.xml | 2 +- ...tOfStockVisibleInCategoryAndSearchTest.xml | 2 +- .../Mftf/Test/AdminVerifyProductOrderTest.xml | 2 +- .../AdminVirtualProductSetEditContentTest.xml | 6 +- ...AdminVirtualSetEditRelatedProductsTest.xml | 6 +- .../AdvanceCatalogSearchSimpleProductTest.xml | 4 +- .../Test/CheckTierPricingOfProductsTest.xml | 16 +- ...bleOptionTextInputLengthValidationHint.xml | 6 +- .../Test/CreateProductAttributeEntityTest.xml | 68 +- .../Test/Mftf/Test/DeleteCategoriesTest.xml | 18 +- ...UsedInConfigurableProductAttributeTest.xml | 4 +- ...cheAfterChangingCategoryPageLayoutTest.xml | 2 +- .../Test/Mftf/Test/EndToEndB2CAdminTest.xml | 64 +- .../Mftf/Test/EndToEndB2CGuestUserTest.xml | 28 +- .../Mftf/Test/EndToEndB2CLoggedInUserTest.xml | 14 +- .../SimpleProductTwoCustomOptionsTest.xml | 10 +- ...rontCatalogNavigationMenuUIDesktopTest.xml | 4 +- ...chorIsVisibleOnViewportOnceClickedTest.xml | 10 +- .../StorefrontProductNameWithDoubleQuote.xml | 10 +- ...torefrontProductWithEmptyAttributeTest.xml | 4 +- ...orefrontRememberCategoryPaginationTest.xml | 136 ++-- ...ceForDifferentTimezonesForWebsitesTest.xml | 2 +- ...ctAndProductCategoryPartialReindexTest.xml | 8 +- ...ldCategoriesShouldNotIncludeInMenuTest.xml | 8 +- ...mportConfigurableProductWithImagesTest.xml | 10 +- ...eroMaximumQtyAllowedInShoppingCartTest.xml | 2 +- ...nfigurableProductWithSpecialPricesTest.xml | 8 +- .../AdminDeleteCatalogPriceRuleEntityTest.xml | 2 +- .../Test/AdminDeleteCatalogPriceRuleTest.xml | 2 +- ...CatalogPriceRuleByProductAttributeTest.xml | 22 +- .../Mftf/Test/EndToEndB2CGuestUserTest.xml | 16 +- .../Mftf/Test/EndToEndB2CLoggedInUserTest.xml | 8 +- .../LayerNavigationOfCatalogSearchTest.xml | 4 +- .../Mftf/Test/SearchEntityResultsTest.xml | 46 +- ...tAdvancedSearchEntitySimpleProductTest.xml | 2 +- ...goryWithRestrictedUrlKeyNotCreatedTest.xml | 40 +- ...minUrlForProductRewrittenCorrectlyTest.xml | 6 +- ...iteStoreLevelUrlKeyOfChildCategoryTest.xml | 134 ++-- .../Test/CheckCheckoutSuccessPageTest.xml | 10 +- .../CheckNotVisibleProductInMinicartTest.xml | 4 +- ...guringInstantPurchaseFunctionalityTest.xml | 2 +- ...ddressShouldBeCheckedOnPaymentPageTest.xml | 2 +- ...ndleDynamicProductFromShoppingCartTest.xml | 2 +- ...BundleFixedProductFromShoppingCartTest.xml | 2 +- ...ownloadableProductFromShoppingCartTest.xml | 2 +- ...leteVirtualProductFromShoppingCartTest.xml | 2 +- .../Mftf/Test/EndToEndB2CGuestUserTest.xml | 28 +- .../Mftf/Test/EndToEndB2CLoggedInUserTest.xml | 14 +- ...OfDefaultBillingAndShippingAddressTest.xml | 2 +- ...ckoutAsCustomerUsingDefaultAddressTest.xml | 2 +- ...eCheckoutAsCustomerUsingNewAddressTest.xml | 2 +- ...utAsCustomerUsingNonDefaultAddressTest.xml | 2 +- .../OnePageCheckoutUsingSignInLinkTest.xml | 2 +- ...OnePageCheckoutWithAllProductTypesTest.xml | 10 +- ...CartAndMiniShoppingCartPerCustomerTest.xml | 4 +- ...oppingCartWithoutAnySelectedOptionTest.xml | 2 +- ...ontCheckCustomerInfoCreatedByGuestTest.xml | 2 +- ...ateShoppingCartWhileUpdateMinicartTest.xml | 2 +- ...BundleDynamicProductToShoppingCartTest.xml | 2 +- ...pingCartWithDisableMiniCartSidebarTest.xml | 2 +- ...MultiSelectOptionToTheShoppingCartTest.xml | 2 +- ...pesOfCustomOptionToTheShoppingCartTest.xml | 4 +- ...ultiSelectOptionsToTheShoppingCartTest.xml | 2 +- ...efrontApplyPromoCodeDuringCheckoutTest.xml | 2 +- ...rontCheckCartAndCheckoutItemsCountTest.xml | 4 +- ...isplayWithDefaultDisplayLimitationTest.xml | 40 +- ...edToTheCartThanDefaultDisplayLimitTest.xml | 44 +- ...isplayLimitAndDefaultTotalQuantityTest.xml | 40 +- ...ShoppingCartWithMoreThan20ProductsTest.xml | 42 +- ...rtItemDisplayWithDefaultLimitationTest.xml | 44 +- ...playWithCustomDisplayConfigurationTest.xml | 16 +- ...ingAddressAndProductWithTierPricesTest.xml | 8 +- ...ssAndRegisterCustomerAfterCheckoutTest.xml | 4 +- ...ntCheckoutWithSpecialPriceProductsTest.xml | 8 +- ...erCheckoutDisabledProductAndCouponTest.xml | 4 +- ...OnLoginWhenGuestCheckoutIsDisabledTest.xml | 4 +- ...egistrationAndDisableGuestCheckoutTest.xml | 4 +- ...frontCustomerCheckoutWithoutRegionTest.xml | 2 +- ...OrderWithNewAddressesThatWasEditedTest.xml | 2 +- ...eBundleProductFromMiniShoppingCartTest.xml | 2 +- ...aultLimitationFromMiniShoppingCartTest.xml | 42 +- ...VirtualProductFromMiniShoppingCartTest.xml | 6 +- ...eSimpleProductFromMiniShoppingCartTest.xml | 4 +- ...StorefrontGuestCheckoutDataPersistTest.xml | 4 +- ...tCheckoutUsingFreeShippingAndTaxesTest.xml | 6 +- ...tCheckoutWithCouponAndZeroSubtotalTest.xml | 6 +- ...ingPagerShoppingCartWith20ProductsTest.xml | 40 +- ...ntOnePageCheckoutDataWhenChangeQtyTest.xml | 2 +- ...refrontOnePageCheckoutJsValidationTest.xml | 2 +- ...aForGuestCustomerWithPhysicalQuoteTest.xml | 2 +- ...tOnCheckoutPageDifferentStoreViewsTest.xml | 4 +- ...ngesInBackendAfterCustomerCheckoutTest.xml | 8 +- ...PagerForOneItemPerPageAnd2ProductsTest.xml | 4 +- ...efrontUKCustomerCheckoutWithCouponTest.xml | 4 +- ...uctQuantityEqualsToOrderedQuantityTest.xml | 8 +- ...CouponAndBankTransferPaymentMethodTest.xml | 4 +- ...riceInShoppingCartAfterProductSaveTest.xml | 4 +- ...UpdateShoppingCartSimpleProductQtyTest.xml | 2 +- ...eProductFromMiniShoppingCartEntityTest.xml | 2 +- ...SubtotalOrdersWithProcessingStatusTest.xml | 2 +- .../AdminAddDefaultImageConfigurableTest.xml | 16 +- ...agesAndPricesToConfigurableProductTest.xml | 2 +- ...hangedWhenSavingProductWithSameSkuTest.xml | 8 +- ...bleProductAttributeValueUniquenessTest.xml | 6 +- ...CheckResultsOfColorAndOtherFiltersTest.xml | 16 +- ...nCheckValidatorConfigurableProductTest.xml | 6 +- .../AdminConfigurableProductCreateTest.xml | 2 +- .../AdminConfigurableProductDeleteTest.xml | 4 +- .../AdminConfigurableProductLongSkuTest.xml | 2 +- ...AdminConfigurableProductOutOfStockTest.xml | 12 +- .../AdminConfigurableProductSearchTest.xml | 2 +- ...nConfigurableProductSetEditContentTest.xml | 6 +- ...ConfigurableProductUpdateAttributeTest.xml | 6 +- .../AdminConfigurableProductUpdateTest.xml | 2 +- ...ConfigurableSetEditRelatedProductsTest.xml | 2 +- ...AndEditConfigurableProductSettingsTest.xml | 10 +- .../Test/AdminCreateAndSwitchProductType.xml | 34 +- ...onfigurableProductBasedOnParentSkuTest.xml | 14 +- ...ctWithCreatingCategoryAndAttributeTest.xml | 14 +- ...roductWithDisabledChildrenProductsTest.xml | 10 +- ...reateConfigurableProductWithImagesTest.xml | 10 +- ...eeProductDisplayOutOfStockProductsTest.xml | 10 +- ...oductDontDisplayOutOfStockProductsTest.xml | 10 +- ...ableProductWithTierPriceForOneItemTest.xml | 8 +- ...ctWithTwoOptionsAssignedToCategoryTest.xml | 20 +- ...woOptionsWithoutAssignedToCategoryTest.xml | 20 +- .../AdminDeleteConfigurableProductTest.xml | 2 +- ...AdminProductTypeSwitchingOnEditingTest.xml | 12 +- .../Mftf/Test/AdminRelatedProductsTest.xml | 30 +- ...dminRemoveDefaultImageConfigurableTest.xml | 20 +- .../Test/Mftf/Test/EndToEndB2CAdminTest.xml | 10 +- ...vailableToConfigureDisabledProductTest.xml | 4 +- .../ProductsQtyReturnAfterOrderCancelTest.xml | 4 +- ...urableProductCategoryViewChildOnlyTest.xml | 4 +- ...rontConfigurableProductChildSearchTest.xml | 6 +- ...orefrontConfigurableProductDetailsTest.xml | 18 +- .../StorefrontConfigurableProductViewTest.xml | 2 +- ...gurableProductWithFileCustomOptionTest.xml | 4 +- ...ConfigurableWithCatalogRuleAppliedTest.xml | 12 +- ...nfigurableProductLayeredNavigationTest.xml | 2 +- ...efrontVisibilityOfDuplicateProductTest.xml | 26 +- ...ayWhenChooseThreeAllowedCurrenciesTest.xml | 2 +- .../AdminOrderRateDisplayedInOneLineTest.xml | 2 +- ...ectNavigateFromCustomerViewCartProduct.xml | 2 +- .../Mftf/Test/PasswordAutocompleteOffTest.xml | 2 +- ...AddDefaultImageDownloadableProductTest.xml | 16 +- ...AddDefaultVideoDownloadableProductTest.xml | 6 +- ...AndEditDownloadableProductSettingsTest.xml | 10 +- .../Test/AdminCreateAndSwitchProductType.xml | 4 +- ...bleProductAndAssignItToCustomStoreTest.xml | 10 +- ...wnloadableProductWithCustomOptionsTest.xml | 10 +- ...loadableProductWithDefaultSetLinksTest.xml | 12 +- ...eDownloadableProductWithGroupPriceTest.xml | 12 +- ...bleProductWithInvalidDomainLinkUrlTest.xml | 6 +- ...nCreateDownloadableProductWithLinkTest.xml | 10 +- ...DownloadableProductWithManageStockTest.xml | 10 +- ...oadableProductWithOutOfStockStatusTest.xml | 10 +- ...ownloadableProductWithSpecialPriceTest.xml | 12 +- ...ductWithoutFillingQuantityAndStockTest.xml | 10 +- ...wnloadableProductWithoutTaxClassIdTest.xml | 12 +- .../AdminDeleteDownloadableProductTest.xml | 2 +- ...nDownloadableProductSetEditContentTest.xml | 6 +- ...DownloadableSetEditRelatedProductsTest.xml | 6 +- ...AdminProductTypeSwitchingOnEditingTest.xml | 6 +- ...oveDefaultImageDownloadableProductTest.xml | 18 +- ...oveDefaultVideoDownloadableProductTest.xml | 6 +- ...leProductWithSeparateLinksFromCartTest.xml | 8 +- .../Test/Mftf/Test/EndToEndB2CAdminTest.xml | 8 +- ...wnloadableLinksDownloadableProductTest.xml | 8 +- ...wnloadableLinksDownloadableProductTest.xml | 8 +- ...ableProductSamplesAreNotAccessibleTest.xml | 6 +- ...ntElasticsearch6SearchInvalidValueTest.xml | 18 +- .../Test/AdminCreatingShippingLabelTest.xml | 2 +- ...edProductWithTwoLinksToCartActionGroup.xml | 2 +- ...AdminAddDefaultImageGroupedProductTest.xml | 18 +- ...AdminAddDefaultVideoGroupedProductTest.xml | 8 +- ...nAssociateGroupedProductToWebsitesTest.xml | 10 +- ...reateAndEditGroupedProductSettingsTest.xml | 16 +- .../Test/AdminDeleteGroupedProductTest.xml | 2 +- .../AdminGroupedProductSetEditContentTest.xml | 6 +- .../Test/AdminGroupedProductsListTest.xml | 8 +- ...AdminGroupedSetEditRelatedProductsTest.xml | 4 +- ...inRemoveDefaultImageGroupedProductTest.xml | 20 +- ...inRemoveDefaultVideoGroupedProductTest.xml | 8 +- .../AdminSortingAssociatedProductsTest.xml | 14 +- .../Test/Mftf/Test/EndToEndB2CAdminTest.xml | 10 +- ...ewProductsListWidgetGroupedProductTest.xml | 2 +- .../AdminCheckDoubleImportOfProductsTest.xml | 4 +- ...utesChangedValueToEmptyAfterImportTest.xml | 16 +- ...dminImportProductsWithErrorEntriesTest.xml | 2 +- ...lityDifferentStoreViewsAfterImportTest.xml | 8 +- .../Test/Mftf/Test/ShopByButtonInMobile.xml | 2 +- ...hMapAssignedConfigProductIsCorrectTest.xml | 4 +- ...toreFrontCheckingWithMultishipmentTest.xml | 4 +- ...oreFrontCheckingWithSingleShipmentTest.xml | 4 +- ...toreFrontMinicartWithMultishipmentTest.xml | 4 +- ...oreFrontMyAccountWithMultishipmentTest.xml | 4 +- ...frontCheckoutWithMultipleAddressesTest.xml | 6 +- ...ingCartBehaviorAfterSessionExpiredTest.xml | 2 +- ...GuestCheckoutWithEnabledPersistentTest.xml | 2 +- .../ShippingQuotePersistedForGuestTest.xml | 4 +- ...CartPersistenceUnderLongTermCookieTest.xml | 6 +- ...listIsPersistedUnderLongTermCookieTest.xml | 4 +- ...inValidateUrlOnGetVideoInformationTest.xml | 2 +- .../YoutubeVideoWindowOnProductPageTest.xml | 6 +- ...efrontGuestCheckoutDisabledProductTest.xml | 12 +- ...erWithCheckMoneyOrderPaymentMethodTest.xml | 8 +- ...WithProductQtyWithoutStockDecreaseTest.xml | 8 +- ...ectnessInvoicedItemInBundleProductTest.xml | 2 +- .../Test/Mftf/Test/AdminCreateInvoiceTest.xml | 2 +- ...rderCreationWithMultiWebsiteConfigTest.xml | 4 +- .../Test/StorefrontPrintOrderGuestTest.xml | 6 +- ...inCartRulesAppliedForProductInCartTest.xml | 8 +- .../Mftf/Test/AdminCreateBuyXGetYFreeTest.xml | 2 +- ...eConditionAndFreeShippingIsAppliedTest.xml | 2 +- ...AndVerifyRuleConditionIsNotAppliedTest.xml | 2 +- ...inCreateCartPriceRuleForCouponCodeTest.xml | 2 +- ...ateCartPriceRuleForGeneratedCouponTest.xml | 2 +- ...talAndVerifyRuleConditionIsAppliedTest.xml | 2 +- ...oryAndVerifyRuleConditionIsAppliedTest.xml | 6 +- ...ghtAndVerifyRuleConditionIsAppliedTest.xml | 2 +- .../AdminCreateFixedAmountDiscountTest.xml | 2 +- ...CreateFixedAmountWholeCartDiscountTest.xml | 2 +- .../AdminCreatePercentOfProductPriceTest.xml | 2 +- ...iveSalesRuleAndVerifyDeleteMessageTest.xml | 4 +- ...yRulesShouldApplyToComplexProductsTest.xml | 12 +- .../AdminGlobalSearchOnProductPageTest.xml | 12 +- ...archSuggestionByProductDescriptionTest.xml | 2 +- ...ustomStoreShippingMethodTableRatesTest.xml | 4 +- ...splayTableRatesShippingMethodForAETest.xml | 2 +- .../Mftf/Test/AdminCreateImageSwatchTest.xml | 4 +- .../Mftf/Test/AdminCreateTextSwatchTest.xml | 4 +- ...ateVisualSwatchWithNonValidOptionsTest.xml | 6 +- ...uctWithAttributesImagesAndSwatchesTest.xml | 14 +- ...figurableProductSwatchMinimumPriceTest.xml | 6 +- ...ntDisplayAllCharactersOnTextSwatchTest.xml | 2 +- .../StorefrontFilterByImageSwatchTest.xml | 16 +- .../Test/StorefrontFilterByTextSwatchTest.xml | 4 +- .../StorefrontFilterByVisualSwatchTest.xml | 4 +- ...tImageColorWhenFilterByColorFilterTest.xml | 6 +- ...oductImagesMatchingProductSwatchesTest.xml | 20 +- ...SwatchAttributesDisplayInWidgetCMSTest.xml | 8 +- ...tSwatchProductWithFileCustomOptionTest.xml | 10 +- .../Test/Mftf/Test/AdminTaxReportGridTest.xml | 12 +- ...oppingCartForCustomerPhysicalQuoteTest.xml | 4 +- ...nShoppingCartForGuestPhysicalQuoteTest.xml | 4 +- ...esignConfigMediaGalleryImageUploadTest.xml | 2 +- .../AdminInlineTranslationOnCheckoutTest.xml | 6 +- ...StorefrontButtonsInlineTranslationTest.xml | 2 +- ...dFilterDeleteAndVerifyErrorMessageTest.xml | 4 +- ...ateURLRewriteWhenCategoryIsDeletedTest.xml | 4 +- ...tipleStoreviewsDuringProductImportTest.xml | 20 +- ...rlKeyForStoreViewAndMovingCategoryTest.xml | 6 +- ...CategoryUrlRewriteAndAddNoRedirectTest.xml | 2 +- ...yUrlRewriteAndAddPermanentRedirectTest.xml | 2 +- ...tUrlRewriteAndAddTemporaryRedirectTest.xml | 2 +- ...eProductURLRewriteAndAddNoRedirectTest.xml | 4 +- ...ithCategoryAndAddTemporaryRedirectTest.xml | 6 +- ...tUrLRewriteAndAddPermanentRedirectTest.xml | 4 +- ...tUrLRewriteAndAddTemporaryRedirectTest.xml | 4 +- ...SeveralWebsitesAndCheckURLRewritesTest.xml | 8 +- ...CreateUrlRewriteForCustomStoreViewTest.xml | 8 +- ...oryUrlRewriteAndAddAspxRequestPathTest.xml | 2 +- ...CategoryUrlRewriteAndAddNoRedirectTest.xml | 2 +- ...yUrlRewriteAndAddPermanentRedirectTest.xml | 2 +- ...yUrlRewriteAndAddTemporaryRedirectTest.xml | 2 +- ...inUpdateCustomURLRewritesTemporaryTest.xml | 4 +- ...writesForProductInAnchorCategoriesTest.xml | 8 +- ...FixedTaxValSavedForSpecificWebsiteTest.xml | 8 +- ...inRemoveProductWeeeAttributeOptionTest.xml | 6 +- ...ddToCartWishListWithUnselectedAttrTest.xml | 2 +- ...tChildImageShouldBeShownOnWishListTest.xml | 12 +- ...uctsToCartFromWishlistUsingSidebarTest.xml | 4 +- ...teBundleDynamicProductFromWishlistTest.xml | 6 +- ...veProductsFromWishlistUsingSidebarTest.xml | 4 +- .../Test/WishListWithDisabledProductTest.xml | 4 +- 644 files changed, 6491 insertions(+), 4779 deletions(-) create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddCategoryImageActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddCrossSellProductBySkuActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddProductAttributeInProductModalActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddProductCustomOptionFieldActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddProductCustomOptionFileActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddProductImageActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddProductWithQtyToCartFromStorefrontProductPageActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddRelatedProductBySkuActionGroup.xml rename app/code/Magento/Catalog/Test/Mftf/ActionGroup/{AddProductToCartActionGroup.xml => AddSimpleProductToCartActionGroup.xml} (80%) create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddSpecialPriceToProductActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddToCartFromStorefrontProductPageActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddUpSellProductBySkuActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAddAdvancedPricingToTheProductExtendedActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAddUnassignedAttributeToGroupActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssertProductCustomOptionVisibleActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssertProductHasNoCustomOptionActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssertProductHasNoCustomOptionsActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssignProductToCategoryActionGroup.xml delete mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCategoryActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCategoryAssignProductActionGroup.xml rename app/code/Magento/Catalog/Test/Mftf/ActionGroup/{AdminCheckProductsInGridActionGroup.xml => AdminCheckProductIsMissingInCategoryProductsGridActionGroup.xml} (61%) create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductPositionInCategoryProductsGridActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminClickOnAdvancedInventoryButtonActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateAttributeFromProductPageActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateAttributeFromProductPageWithScopeActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateAttributeWithSearchWeightActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateAttributeWithValueWithTwoStoreViesFromProductPageActionGroup.xml rename app/code/Magento/Catalog/Test/Mftf/ActionGroup/{AdminCreateWidgetActionGroup.xml => AdminCreateCatalogProductWidgetActionGroup.xml} (64%) create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateRecentlyProductsWidgetActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateSearchableProductAttributeActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateSimpleProductWithTextOptionCharLimitActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminDeleteAllProductCustomOptionsActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminDeleteCategoryByNameActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminDeleteProductCustomOptionActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminFillProductCountryOfManufactureActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProcessProductWebsitesActionGroup.xml delete mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAddSpecialPriceActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAdvancedPricingNewCustomerGroupPriceActionGroup.xml delete mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml delete mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductPageCreateAttributeSetWithAttributeActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductPageFillTextAttributeValueByNameActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductPageSelectAttributeSetActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSetProductDisabledActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSwitchScopeForProductAttributeActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertDiscountsPercentageOfProductsActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductDescriptionInProductEditFormActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductImageAdminProductPageActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductImageNotInAdminProductPageActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductImageNotInStorefrontProductPage2ActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductImageNotInStorefrontProductPageActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductImageStorefrontProductPage2ActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductImageStorefrontProductPageActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductIsAssignedToWebsiteActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductIsNotAssignedToWebsiteActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductNameAndSkuInStorefrontProductPageActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductNameInProductEditFormActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductOnCategoryPageActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertTextInAdminProductRelatedUpSellCrossSellSectionActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertWebsiteIsAvailableInProductWebsitesActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertWebsiteIsNotAvailableInProductWebsitesActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/CategoryPresentActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/ChangeSeoUrlKeyActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/ChangeSeoUrlKeyForSubCategoryActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/ChangeStatusProductUsingProductGridActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/ChangeUseForPromoRuleConditionsProductAttributeActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/CheckAttributeInMoreInformationTabActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/CheckAttributeNotInMoreInformationTabActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/CheckCategoryImageInAdminActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/CheckCategoryNameIsRequiredFieldActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/CheckCategoryOnStorefrontActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/CheckCustomizableOptionImportActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/CheckRequiredFieldsInProductFormActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/ClearProductsFilterActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/ConfirmChangeInputTypeModalActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateAttributeDropdownNthOptionActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateAttributeDropdownNthOptionAsDefaultActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateCategoryActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateCustomRadioOptionsActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateDefaultAttributeSetActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateProductAttributeActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateProductAttributeWithDateFieldActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateProductAttributeWithTextFieldActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateSimpleProductAndAddToWebsiteActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreatedProductConnectToWebsiteActionGroup.xml delete mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/CustomOptionsActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteAllDuplicateProductUsingProductGridActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteAllProductsUsingProductGridActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteAttributeSetByLabelActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteCategoryActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteDefaultCategoryChildrenActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteMostRecentCategoryActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductAttributeActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductAttributeByLabelActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductByNameActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductBySkuActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductUsingProductGridActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductsByKeywordActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductsIfTheyExistActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/ExpandAdminProductSectionActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillAdminSimpleProductFormActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillCategoryFormActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillCategoryNameAndUrlKeyAndSaveActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillMainProductFormActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillMainProductFormByStringActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillMainProductFormNoWeightActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillNewProductCategoryActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillProductNameAndSkuInProductFormActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterAndSelectProductActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductAttributeByAttributeCodeActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductAttributeByAttributeLabelActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductAttributeByDefaultLabelActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductAttributeSetGridByAttributeSetNameActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridByDisabledStatusActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridByEnabledStatusActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridByName2ActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridByNameActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridByPriceRangeActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridBySetNewFromDateActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridBySku2ActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridBySkuActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridBySkuAndNameActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToAdminCategoryPageByIdActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToAttributeGridPageActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToAttributeSetByNameActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToCreateCategoryPageActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToCreateProductPageActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToProductCatalogPageActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToProductPageViaIDActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToSpecifiedCreateProductPageActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToStorefrontCategoryPageByParametersActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToSubCategoryPageActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/ImportProductCustomizableOptionsActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/NavigateToAndResetProductAttributeGridToDefaultViewActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/NavigateToAndResetProductGridToDefaultViewActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/NavigateToCreatedCategoryActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/NavigateToCreatedProductAttributeActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/NavigateToCreatedProductEditPageActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/NavigateToEditProductAttributeActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/NavigateToMediaGalleryActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/OpenCategoryFromCategoryTreeActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/OpenProductForEditByClickingRowXColumnYInProductGridActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/ProductSetAdvancedPricingActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/ProductSetAdvancedTierFixedPricingActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/ProductSetWebsiteActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/RemoveCategoryFromProductActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/RemoveCategoryImageActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/RemoveProductImageActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/RemoveProductImageByNameActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/ResetImportOptionFilterActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/ResetProductGridToDefaultViewActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/SaveAttributeSetActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/SaveCategoryFormActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/SaveProductAttributeActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/SaveProductAttributeInUseActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/SaveProductFormActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/SaveProductFormNoSuccessCheckActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/SearchForProductOnBackendByNameActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/SearchProductGridByKeyword2ActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/SearchProductGridByKeywordActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/SelectProductInWebsitesActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/SetCategoryByNameActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/SetProductUrlKeyActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/SetProductUrlKeyByStringActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/SortProductsByIdAscendingActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/SortProductsByIdDescendingActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAddCategoryProductToCompareActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAddProductToCompareActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAddSimpleProductWithQtyActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAssertActiveProductImageActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAssertFotoramaImageAvailabilityActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAssertProductInRecentlyComparedWidgetActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAssertProductInRecentlyOrderedWidgetActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAssertProductPriceOnCategoryPageActionGroup.xml delete mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryPageSortAscendingActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryPageSortDescendingActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckAddToCartButtonAbsenceActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckCategoryActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckCategorySimpleProductActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckCompareSidebarProductActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckCompareSimpleProductActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckProductPositionActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckSimpleProductActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontClearCompareActionGroup.xml delete mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCompareActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontGoToSubCategoryPageActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontOpenAndCheckComparisionActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontOpenProductPageOnSecondStoreActionGroup.xml delete mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontProductActionGroup.xml delete mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontProductPageActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontSwitchCategoryViewToListModeActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/SwitchCategoryStoreViewActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/SwitchCategoryToAllStoreViewActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/SwitchToTheNewStoreViewActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/TestDynamicValidationHintActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/ToggleProductEnabledActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/UnassignAttributeFromGroupActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/UnassignWebsiteFromProductActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/VerifyCategoryPageParametersActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/ViewProductInAdminGridActionGroup.xml diff --git a/app/code/Magento/Backend/Test/Mftf/Test/AdminDashboardWithChartsChart.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminDashboardWithChartsChart.xml index f48c7752efc7a..dde24d9f1c602 100644 --- a/app/code/Magento/Backend/Test/Mftf/Test/AdminDashboardWithChartsChart.xml +++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminDashboardWithChartsChart.xml @@ -54,7 +54,7 @@ <comment userInput="Add product to the shopping cart" stepKey="addProductToCart"/> <amOnPage url="{{StorefrontProductPage.url($$createProduct.custom_attributes[url_key]$$)}}" stepKey="navigateToSimpleProductPage"/> <waitForPageLoad stepKey="waitForProductPageLoad"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage"> <argument name="productName" value="$$createProduct.name$$"/> </actionGroup> <!--Go to Checkout--> diff --git a/app/code/Magento/Braintree/Test/Mftf/Test/CretateAdminOrderWithOnlinePaymentIncludingTaxAndDiscount.xml b/app/code/Magento/Braintree/Test/Mftf/Test/CretateAdminOrderWithOnlinePaymentIncludingTaxAndDiscount.xml index 8f0ce4918b978..5d52fe26d39e0 100644 --- a/app/code/Magento/Braintree/Test/Mftf/Test/CretateAdminOrderWithOnlinePaymentIncludingTaxAndDiscount.xml +++ b/app/code/Magento/Braintree/Test/Mftf/Test/CretateAdminOrderWithOnlinePaymentIncludingTaxAndDiscount.xml @@ -95,7 +95,7 @@ <!--Adding Special price to product--> <amOnPage url="{{AdminProductEditPage.url($$simpleProduct.id$$)}}" stepKey="openAdminProductEditPage"/> <actionGroup ref="AddSpecialPriceToProductActionGroup" stepKey="addSpecialPrice"/> - <actionGroup ref="saveProductForm" stepKey="saveProductForm"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductForm"/> <!--Create New Order--> <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderWithExistingCustomer"> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminAddBundleItemsTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminAddBundleItemsTest.xml index 401d360a34c64..c494f29f1a604 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminAddBundleItemsTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminAddBundleItemsTest.xml @@ -51,11 +51,11 @@ <waitForElementVisible selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="waitForAddProductsToBundle"/> <click selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="clickAddProductsToOption"/> <waitForPageLoad stepKey="waitForPageLoadAfterBundleProducts"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions"> <argument name="product" value="$$simpleProduct0$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions2"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions2"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow2"/> @@ -91,7 +91,7 @@ <waitForPageLoad stepKey="WaitForPageToLoad"/> <conditionalClick selector="{{AdminProductFiltersSection.filtersClear}}" dependentSelector="{{AdminProductFiltersSection.filtersClear}}" visible="true" stepKey="ClickOnButtonToRemoveFiltersIfPresent"/> <waitForPageLoad stepKey="WaitForClear"/> - <actionGroup ref="filterProductGridByName" stepKey="filterBundleProductOptionsDownToName"> + <actionGroup ref="FilterProductGridByNameActionGroup" stepKey="filterBundleProductOptionsDownToName"> <argument name="product" value="BundleProduct"/> </actionGroup> <click selector="{{AdminProductFormBundleSection.addOptions}}" stepKey="clickOnBundleProductToEdit"/> @@ -103,11 +103,11 @@ <waitForElementVisible selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="waitForAddProductsToNewBundle"/> <click selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="clickAddProductsToNewOption"/> <waitForPageLoad stepKey="waitForPageLoadAfterNewBundleProducts"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterNewBundleProductOptions"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterNewBundleProductOptions"> <argument name="product" value="$$simpleProduct2$$"/> </actionGroup> <checkOption selector="//div[@class='admin__data-grid-outer-wrap']//tr[@data-repeat-index='0']//input[@type='checkbox']" stepKey="selectNewFirstGridRow"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterNewBundleProductOptions2"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterNewBundleProductOptions2"> <argument name="product" value="$$simpleProduct3$$"/> </actionGroup> <checkOption selector="{{AdminProductFormBundleSection.firstProductOption}}" stepKey="selectNewFirstGridRow2"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminAddBundleProductToCartFromWishListPageTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminAddBundleProductToCartFromWishListPageTest.xml index 2a4b119a5cabc..b2d3c376d9b5a 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminAddBundleProductToCartFromWishListPageTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminAddBundleProductToCartFromWishListPageTest.xml @@ -51,7 +51,7 @@ <requiredEntity createDataKey="createSimpleProduct2"/> </createData> <amOnPage url="{{AdminProductEditPage.url($$createProduct.id$$)}}" stepKey="goToProductEditPage"/> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> </before> <after> <!-- Delete created data --> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminAddDefaultImageBundleProductTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminAddDefaultImageBundleProductTest.xml index 21e6be98b3169..3770e47079c98 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminAddDefaultImageBundleProductTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminAddDefaultImageBundleProductTest.xml @@ -32,11 +32,11 @@ <!-- Create a bundle product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPageBundle"/> <waitForPageLoad stepKey="waitForProductPageLoadBundle"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateBundleProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateBundleProduct"> <argument name="product" value="BundleProduct"/> </actionGroup> - <actionGroup ref="fillProductNameAndSkuInProductForm" stepKey="fillBundleProductNameAndSku"> + <actionGroup ref="FillProductNameAndSkuInProductFormActionGroup" stepKey="fillBundleProductNameAndSku"> <argument name="product" value="BundleProduct"/> </actionGroup> @@ -51,11 +51,11 @@ <waitForElementVisible selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="waitForAddProductsToBundle"/> <click selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="clickAddProductsToOption"/> <waitForPageLoad stepKey="waitForPageLoadAfterBundleProducts"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions2"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions2"> <argument name="product" value="$$simpleProduct2$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow2"/> @@ -64,23 +64,23 @@ <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty2"/> <!-- Add image to product --> - <actionGroup ref="addProductImage" stepKey="addImageForProduct"> + <actionGroup ref="AddProductImageActionGroup" stepKey="addImageForProduct"> <argument name="image" value="MagentoLogo"/> </actionGroup> <!--Save product--> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!-- Assert product image in admin product form --> - <actionGroup ref="assertProductImageAdminProductPage" stepKey="assertProductImageAdminProductPage"/> + <actionGroup ref="AssertProductImageAdminProductPageActionGroup" stepKey="assertProductImageAdminProductPage"/> <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageActionGroup" stepKey="AssertProductInStorefrontProductPage"> <argument name="product" value="BundleProduct"/> </actionGroup> <!-- Assert product image in storefront product page --> - <actionGroup ref="assertProductImageStorefrontProductPage" stepKey="assertProductImageStorefrontProductPage"> + <actionGroup ref="AssertProductImageStorefrontProductPageActionGroup" stepKey="assertProductImageStorefrontProductPage"> <argument name="product" value="BundleProduct"/> <argument name="image" value="MagentoLogo"/> </actionGroup> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminAddDefaultVideoBundleProductTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminAddDefaultVideoBundleProductTest.xml index c49202f31aefb..66443e130ed08 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminAddDefaultVideoBundleProductTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminAddDefaultVideoBundleProductTest.xml @@ -29,10 +29,10 @@ <!-- Create a bundle product --> <!-- Replacing steps in base AdminAddDefaultVideoSimpleProductTest --> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProductPage"> <argument name="product" value="BundleProduct"/> </actionGroup> - <actionGroup ref="fillProductNameAndSkuInProductForm" stepKey="fillMainProductForm"> + <actionGroup ref="FillProductNameAndSkuInProductFormActionGroup" stepKey="fillMainProductForm"> <argument name="product" value="BundleProduct"/> </actionGroup> @@ -46,11 +46,11 @@ <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"> + <actionGroup ref="FilterProductGridBySkuActionGroup" 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"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProductGridBySku2" after="checkOption1"> <argument name="product" value="$$simpleProduct2$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="checkOption2" after="filterProductGridBySku2"/> @@ -59,7 +59,7 @@ <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillQty2" before="saveProductForm"/> <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageActionGroup" stepKey="AssertProductInStorefrontProductPage"> <argument name="product" value="BundleProduct"/> </actionGroup> </test> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminAssociateBundleProductToWebsitesTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminAssociateBundleProductToWebsitesTest.xml index 505a319c5c44f..b58637cf2e81d 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminAssociateBundleProductToWebsitesTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminAssociateBundleProductToWebsitesTest.xml @@ -79,14 +79,14 @@ <argument name="websiteName" value="{{secondCustomWebsite.name}}"/> </actionGroup> - <actionGroup ref="NavigateToAndResetProductGridToDefaultView" stepKey="resetProductGridFilter"/> + <actionGroup ref="NavigateToAndResetProductGridToDefaultViewActionGroup" stepKey="resetProductGridFilter"/> <!-- Admin logout --> <actionGroup ref="logout" stepKey="adminLogout"/> </after> <!-- Open product page and assign grouped project to second website --> - <actionGroup ref="filterAndSelectProduct" stepKey="openAdminProductPage"> + <actionGroup ref="FilterAndSelectProductActionGroup" stepKey="openAdminProductPage"> <argument name="productSku" value="$$createBundleProduct.sku$$"/> </actionGroup> <actionGroup ref="AdminAssignProductInWebsiteActionGroup" stepKey="assignProductToSecondWebsite"> @@ -95,15 +95,15 @@ <actionGroup ref="AdminUnassignProductInWebsiteActionGroup" stepKey="unassignProductFromDefaultWebsite"> <argument name="website" value="{{_defaultWebsite.name}}"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveGroupedProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveGroupedProduct"/> <!-- Assert product is assigned to Second website --> - <actionGroup ref="AssertProductIsAssignedToWebsite" stepKey="seeCustomWebsiteIsChecked"> + <actionGroup ref="AssertProductIsAssignedToWebsiteActionGroup" stepKey="seeCustomWebsiteIsChecked"> <argument name="website" value="{{secondCustomWebsite.name}}"/> </actionGroup> <!-- Assert product is not assigned to Main website --> - <actionGroup ref="AssertProductIsNotAssignedToWebsite" stepKey="seeMainWebsiteIsNotChecked"> + <actionGroup ref="AssertProductIsNotAssignedToWebsiteActionGroup" stepKey="seeMainWebsiteIsNotChecked"> <argument name="website" value="{{_defaultWebsite.name}}"/> </actionGroup> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminAttributeSetSelectionTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminAttributeSetSelectionTest.xml index 1d2f21b7d15f9..c8977cbae1957 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminAttributeSetSelectionTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminAttributeSetSelectionTest.xml @@ -56,7 +56,7 @@ <!--Set filter to product name--> <amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="GoToCatalogProductPage"/> <waitForPageLoad stepKey="WaitForPageToLoad"/> - <actionGroup ref="filterProductGridByName" stepKey="filterBundleProductOptionsDownToName"> + <actionGroup ref="FilterProductGridByNameActionGroup" stepKey="filterBundleProductOptionsDownToName"> <argument name="product" value="BundleProduct"/> </actionGroup> <seeElement selector="{{AdminProductFiltersSection.attributeSetOfFirstRow(ProductAttributeFrontendLabel.label)}}" stepKey="seeAttributeSet"/> @@ -77,7 +77,7 @@ <!--Set filter to product name--> <amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="GoToCatalogProductPage2"/> <waitForPageLoad stepKey="WaitForPageToLoad2"/> - <actionGroup ref="filterProductGridByName" stepKey="filterBundleProductOptionsDownToName2"> + <actionGroup ref="FilterProductGridByNameActionGroup" stepKey="filterBundleProductOptionsDownToName2"> <argument name="product" value="BundleProduct"/> </actionGroup> <seeElement selector="{{AdminProductFiltersSection.attributeSetOfFirstRow(BundleProduct.defaultAttribute)}}" stepKey="seeAttributeSet2"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminBasicBundleProductAttributesTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminBasicBundleProductAttributesTest.xml index c6a07f7ed95c3..fcfd80ac8533c 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminBasicBundleProductAttributesTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminBasicBundleProductAttributesTest.xml @@ -24,7 +24,7 @@ <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> </after> <!--Create attribute set--> - <actionGroup ref="CreateDefaultAttributeSet" stepKey="createDefaultAttributeSet"> + <actionGroup ref="CreateDefaultAttributeSetActionGroup" stepKey="createDefaultAttributeSet"> <argument name="label" value="{{ProductAttributeFrontendLabel.label}}"/> </actionGroup> @@ -91,14 +91,14 @@ <seeOptionIsSelected selector="{{AdminProductFormBundleSection.countryOfManufactureDropDown}}" userInput="Italy" stepKey="seeCountryOfManufacture"/> <!--Create second attribute set for edit--> - <actionGroup ref="CreateDefaultAttributeSet" stepKey="createSecondAttributeSet"> + <actionGroup ref="CreateDefaultAttributeSetActionGroup" stepKey="createSecondAttributeSet"> <argument name="label" value="{{ProductAttributeFrontendLabelTwo.label}}"/> </actionGroup> <!--Filter catalog--> <amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="goToCatalogProductPage"/> <waitForPageLoad stepKey="WaitForPageToLoad"/> - <actionGroup ref="filterProductGridByName" stepKey="filterBundleProductOptionsDownToName"> + <actionGroup ref="FilterProductGridByNameActionGroup" stepKey="filterBundleProductOptionsDownToName"> <argument name="product" value="BundleProduct"/> </actionGroup> <click selector="{{AdminProductFiltersSection.attributeSetOfFirstRow(ProductAttributeFrontendLabel.label)}}" stepKey="clickAttributeSet2"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminBundleProductSetEditContentTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminBundleProductSetEditContentTest.xml index 65733a5bcc037..788dc4a848fd3 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminBundleProductSetEditContentTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminBundleProductSetEditContentTest.xml @@ -21,16 +21,16 @@ </annotations> <after> <!-- Delete bundle product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="BundleProduct"/> </actionGroup> </after> <!-- Create product --> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct"> <argument name="product" value="BundleProduct"/> </actionGroup> - <actionGroup ref="fillProductNameAndSkuInProductForm" stepKey="fillProductForm"> + <actionGroup ref="FillProductNameAndSkuInProductFormActionGroup" stepKey="fillProductForm"> <argument name="product" value="BundleProduct"/> </actionGroup> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminCreateAndEditBundleProductSettingsTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminCreateAndEditBundleProductSettingsTest.xml index 42584a31651d7..9d5b1be6fae04 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminCreateAndEditBundleProductSettingsTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminCreateAndEditBundleProductSettingsTest.xml @@ -42,7 +42,7 @@ </after> <!-- Create new bundle product --> - <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="createBundleProduct"> + <actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="createBundleProduct"> <argument name="productType" value="bundle"/> </actionGroup> @@ -75,7 +75,7 @@ </actionGroup> <!-- Save product form --> - <actionGroup ref="saveProductForm" stepKey="clickSaveButton"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="clickSaveButton"/> <!-- Open product page --> <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openStorefrontProductPage"> @@ -101,7 +101,7 @@ </actionGroup> <!-- Assert product in assigned to Website --> - <actionGroup ref="AssertProductIsAssignedToWebsite" stepKey="seeCustomWebsiteIsChecked"> + <actionGroup ref="AssertProductIsAssignedToWebsiteActionGroup" stepKey="seeCustomWebsiteIsChecked"> <argument name="website" value="$createWebsite.website[name]$"/> </actionGroup> @@ -122,7 +122,7 @@ <actionGroup ref="AdminSwitchProductGiftMessageStatusActionGroup" stepKey="disableGiftMessageSettings"/> <!-- Save product form --> - <actionGroup ref="saveProductForm" stepKey="clickSaveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="clickSaveProduct"/> <!-- Verify Url Key after changing --> <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPage"> @@ -137,7 +137,7 @@ <dontSeeElement selector="{{StorefrontProductCartGiftOptionSection.giftOptions}}" stepKey="dontSeeGiftOptionBtn"/> <!-- Delete created bundle product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="BundleProduct"/> </actionGroup> </test> @@ -184,7 +184,7 @@ </after> <!-- Create new bundle product --> - <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="createBundleProduct"> + <actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="createBundleProduct"> <argument name="productType" value="bundle"/> </actionGroup> @@ -227,7 +227,7 @@ </actionGroup> <!-- Save product form --> - <actionGroup ref="saveProductForm" stepKey="saveWithThreeOptions"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveWithThreeOptions"/> <!-- Open created product --> <actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForSimpleProduct"> @@ -243,12 +243,12 @@ </actionGroup> <!-- Save product form --> - <actionGroup ref="saveProductForm" stepKey="clickSaveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="clickSaveProduct"/> <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveWithTwoOptions"/> <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="messageYouSavedTheProductIsShown"/> <!-- Delete created bundle product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="BundleProduct"/> </actionGroup> </test> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteABundleProduct.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteABundleProduct.xml index 86db6f372b5f8..e0558177e4c3e 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteABundleProduct.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteABundleProduct.xml @@ -40,11 +40,11 @@ <waitForElementVisible selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="waitForAddProductsToBundle"/> <click selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="clickAddProductsToOption"/> <waitForPageLoad stepKey="waitForPageLoadAfterBundleProducts"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions2"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions2"> <argument name="product" value="$$simpleProduct2$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow2"/> @@ -64,7 +64,7 @@ <waitForPageLoad stepKey="Loading"/> <!--Apply Name Filter--> - <actionGroup ref="filterProductGridByName" stepKey="filterBundleProductOptionsDownToName"> + <actionGroup ref="FilterProductGridByNameActionGroup" stepKey="filterBundleProductOptionsDownToName"> <argument name="product" value="BundleProduct"/> </actionGroup> <click selector="{{AdminProductFiltersSection.allCheckbox}}" stepKey="SelectAllOnly1"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteBundleDynamicProductTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteBundleDynamicProductTest.xml index a4e26256e9773..51821b136ba26 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteBundleDynamicProductTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteBundleDynamicProductTest.xml @@ -31,7 +31,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <actionGroup ref="logout" stepKey="logout"/> </after> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteBundleProductFilteredBySkuAndName"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteBundleProductFilteredBySkuAndName"> <argument name="product" value="$$createDynamicBundleProduct$$"/> </actionGroup> <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="A total of 1 record(s) have been deleted." stepKey="deleteMessage"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteBundleFixedProductTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteBundleFixedProductTest.xml index 2527dae7eadf8..dcd53fff6f6dd 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteBundleFixedProductTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteBundleFixedProductTest.xml @@ -28,7 +28,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <actionGroup ref="logout" stepKey="logout"/> </after> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteBundleProductFilteredBySkuAndName"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteBundleProductFilteredBySkuAndName"> <argument name="product" value="$$createFixedBundleProduct$$"/> </actionGroup> <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="A total of 1 record(s) have been deleted." stepKey="deleteMessage"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminEditRelatedBundleProductTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminEditRelatedBundleProductTest.xml index 08faa9d2444df..632ba194cf8de 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminEditRelatedBundleProductTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminEditRelatedBundleProductTest.xml @@ -26,7 +26,7 @@ </before> <after> <!-- Delete the bundled product --> - <actionGroup stepKey="deleteBundle" ref="deleteProductUsingProductGrid"> + <actionGroup stepKey="deleteBundle" ref="DeleteProductUsingProductGridActionGroup"> <argument name="product" value="BundleProduct"/> </actionGroup> <!--Logging out--> @@ -38,15 +38,15 @@ <!-- Create a bundle product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPageBundle"/> <waitForPageLoad stepKey="waitForProductPageLoadBundle"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateBundleProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateBundleProduct"> <argument name="product" value="BundleProduct"/> </actionGroup> - <actionGroup ref="fillProductNameAndSkuInProductForm" stepKey="fillBundleProductNameAndSku"> + <actionGroup ref="FillProductNameAndSkuInProductFormActionGroup" stepKey="fillBundleProductNameAndSku"> <argument name="product" value="BundleProduct"/> </actionGroup> - <actionGroup ref="addRelatedProductBySku" stepKey="addRelatedProduct0"> + <actionGroup ref="AddRelatedProductBySkuActionGroup" stepKey="addRelatedProduct0"> <argument name="sku" value="$$simpleProduct0.sku$$"/> </actionGroup> @@ -54,7 +54,7 @@ <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveButton"/> <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/> - <actionGroup ref="addRelatedProductBySku" stepKey="addRelatedProduct1"> + <actionGroup ref="AddRelatedProductBySkuActionGroup" stepKey="addRelatedProduct1"> <argument name="sku" value="$$simpleProduct1.sku$$"/> </actionGroup> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminFilterProductListByBundleProduct.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminFilterProductListByBundleProduct.xml index 40a6e1b75c60a..ff5c909077e47 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminFilterProductListByBundleProduct.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminFilterProductListByBundleProduct.xml @@ -40,11 +40,11 @@ <waitForElementVisible selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="waitForAddProductsToBundle"/> <click selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="clickAddProductsToOption"/> <waitForPageLoad stepKey="waitForPageLoadAfterBundleProducts"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions2"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions2"> <argument name="product" value="$$simpleProduct2$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow2"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminMassDeleteBundleProducts.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminMassDeleteBundleProducts.xml index 2f891fcc8f169..1cad591d257d3 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminMassDeleteBundleProducts.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminMassDeleteBundleProducts.xml @@ -48,11 +48,11 @@ <waitForElementVisible selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="waitForAddProductsToBundle"/> <click selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="clickAddProductsToOption"/> <waitForPageLoad stepKey="waitForPageLoadAfterBundleProducts"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions2"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions2"> <argument name="product" value="$$simpleProduct2$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow2"/> @@ -83,11 +83,11 @@ <waitForElementVisible selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="waitForAddProductsToBundle2"/> <click selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="clickAddProductsToOption2"/> <waitForPageLoad stepKey="waitForPageLoadAfterBundleProducts2"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptionsx2"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptionsx2"> <argument name="product" value="$$simpleProduct3$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRowx2"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions22"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions22"> <argument name="product" value="$$simpleProduct4$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow22"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminProductBundleCreationTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminProductBundleCreationTest.xml index 1f46e1fc9f0b1..ea3b671417fb6 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminProductBundleCreationTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminProductBundleCreationTest.xml @@ -32,7 +32,7 @@ <deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/> <deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/> <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndexPage"/> - <actionGroup ref="deleteProductsIfTheyExist" stepKey="deleteAllProducts"/> + <actionGroup ref="DeleteProductsIfTheyExistActionGroup" stepKey="deleteAllProducts"/> <actionGroup ref="logout" stepKey="logout"/> </after> <!-- go to bundle product creation page--> @@ -48,11 +48,11 @@ <waitForElementVisible selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="waitForAddProductsToBundle"/> <click selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="clickAddProductsToOption"/> <waitForPageLoad stepKey="waitForPageLoadAfterBundleProducts"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions2"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions2"> <argument name="product" value="$$simpleProduct2$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow2"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminRemoveDefaultImageBundleProductTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminRemoveDefaultImageBundleProductTest.xml index 730df90b31be6..77be5b879b1c6 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminRemoveDefaultImageBundleProductTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminRemoveDefaultImageBundleProductTest.xml @@ -25,7 +25,7 @@ </before> <after> <!-- Delete the bundled product we created in the test body --> - <actionGroup ref="deleteProductBySku" stepKey="deleteBundleProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteBundleProduct"> <argument name="sku" value="{{BundleProduct.sku}}"/> </actionGroup> <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> @@ -36,11 +36,11 @@ <!-- Create a bundle product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPageBundle"/> <waitForPageLoad stepKey="waitForProductPageLoadBundle"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateBundleProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateBundleProduct"> <argument name="product" value="BundleProduct"/> </actionGroup> - <actionGroup ref="fillProductNameAndSkuInProductForm" stepKey="fillBundleProductNameAndSku"> + <actionGroup ref="FillProductNameAndSkuInProductFormActionGroup" stepKey="fillBundleProductNameAndSku"> <argument name="product" value="BundleProduct"/> </actionGroup> @@ -55,11 +55,11 @@ <waitForElementVisible selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="waitForAddProductsToBundle"/> <click selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="clickAddProductsToOption"/> <waitForPageLoad stepKey="waitForPageLoadAfterBundleProducts"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions2"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions2"> <argument name="product" value="$$simpleProduct2$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow2"/> @@ -68,27 +68,27 @@ <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty2"/> <!-- Add image to product --> - <actionGroup ref="addProductImage" stepKey="addImageForProduct"> + <actionGroup ref="AddProductImageActionGroup" stepKey="addImageForProduct"> <argument name="image" value="MagentoLogo"/> </actionGroup> <!--Save product--> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!-- Remove image from product --> - <actionGroup ref="removeProductImage" stepKey="removeProductImage"/> + <actionGroup ref="RemoveProductImageActionGroup" stepKey="removeProductImage"/> - <actionGroup ref="saveProductForm" stepKey="saveProductFormAfterRemove"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductFormAfterRemove"/> <!-- Assert product image not in admin product form --> - <actionGroup ref="assertProductImageNotInAdminProductPage" stepKey="assertProductImageNotInAdminProductPage"/> + <actionGroup ref="AssertProductImageNotInAdminProductPageActionGroup" stepKey="assertProductImageNotInAdminProductPage"/> <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPageAfterRemove"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageActionGroup" stepKey="AssertProductInStorefrontProductPageAfterRemove"> <argument name="product" value="BundleProduct"/> </actionGroup> <!-- Assert product image not in storefront product page --> - <actionGroup ref="assertProductImageNotInStorefrontProductPage" stepKey="assertProductImageNotInStorefrontProductPage"> + <actionGroup ref="AssertProductImageNotInStorefrontProductPageActionGroup" stepKey="assertProductImageNotInStorefrontProductPage"> <argument name="product" value="BundleProduct"/> </actionGroup> </test> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminRemoveDefaultVideoBundleProductTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminRemoveDefaultVideoBundleProductTest.xml index d050c5443d1fe..0de9f4ee75a4d 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminRemoveDefaultVideoBundleProductTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminRemoveDefaultVideoBundleProductTest.xml @@ -29,10 +29,10 @@ <!-- Create a bundle product --> <!-- Replacing steps in base AdminRemoveDefaultVideoSimpleProductTest --> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProductPage"> <argument name="product" value="BundleProduct"/> </actionGroup> - <actionGroup ref="fillProductNameAndSkuInProductForm" stepKey="fillMainProductForm"> + <actionGroup ref="FillProductNameAndSkuInProductFormActionGroup" stepKey="fillMainProductForm"> <argument name="product" value="BundleProduct"/> </actionGroup> @@ -46,11 +46,11 @@ <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"> + <actionGroup ref="FilterProductGridBySkuActionGroup" 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"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProductGridBySku2" after="checkOption1"> <argument name="product" value="$$simpleProduct2$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="checkOption2" after="filterProductGridBySku2"/> @@ -59,7 +59,7 @@ <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillQty2" before="saveProductForm"/> <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageActionGroup" stepKey="AssertProductInStorefrontProductPage"> <argument name="product" value="BundleProduct"/> </actionGroup> </test> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminShouldBeAbleToMassUpdateAttributesForBundleProductsTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminShouldBeAbleToMassUpdateAttributesForBundleProductsTest.xml index fe55fda4d0e05..994a10ae02692 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminShouldBeAbleToMassUpdateAttributesForBundleProductsTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminShouldBeAbleToMassUpdateAttributesForBundleProductsTest.xml @@ -59,17 +59,17 @@ <magentoCLI command="cron:run" stepKey="cronRun"/> <magentoCLI command="cron:run" stepKey="cronRunTwice"/> <!-- Search for a product with a new name and Open Product --> - <actionGroup ref="filterProductGridByName" stepKey="searchWithNewProductName"> + <actionGroup ref="FilterProductGridByNameActionGroup" stepKey="searchWithNewProductName"> <argument name="product" value="UpdateAttributeNameAndDescription"/> </actionGroup> <actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openProductPage"> <argument name="product" value="$$createFixedBundleProduct$$"/> </actionGroup> <!-- Assert product name and description --> - <actionGroup ref="AssertProductNameInProductEditForm" stepKey="assertProductName"> + <actionGroup ref="AssertProductNameInProductEditFormActionGroup" stepKey="assertProductName"> <argument name="productName" value="{{UpdateAttributeNameAndDescription.name}}"/> </actionGroup> - <actionGroup ref="AssertProductDescriptionInProductEditForm" stepKey="assertProductDescription"> + <actionGroup ref="AssertProductDescriptionInProductEditFormActionGroup" stepKey="assertProductDescription"> <argument name="productDescription" value="{{UpdateAttributeNameAndDescription.description}}"/> </actionGroup> </test> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/BundleProductFixedPricingTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/BundleProductFixedPricingTest.xml index c922b981aecd9..2259e91deb2b4 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/BundleProductFixedPricingTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/BundleProductFixedPricingTest.xml @@ -32,7 +32,7 @@ <deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/> <deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/> <!-- Delete the bundled product we created in the test body --> - <actionGroup ref="deleteProductBySku" stepKey="deleteBundleProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteBundleProduct"> <argument name="sku" value="{{BundleProduct.sku}}"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> @@ -50,11 +50,11 @@ <waitForElementVisible selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="waitForAddProductsToBundle"/> <click selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="clickAddProductsToOption"/> <waitForPageLoad stepKey="waitForPageLoadAfterBundleProducts"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions2"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions2"> <argument name="product" value="$$simpleProduct2$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow2"/> @@ -82,7 +82,7 @@ <waitForPageLoad stepKey="WaitForPageToLoad"/> <conditionalClick selector="{{AdminProductFiltersSection.filtersClear}}" dependentSelector="{{AdminProductFiltersSection.filtersClear}}" visible="true" stepKey="ClickOnButtonToRemoveFiltersIfPresent"/> <waitForPageLoad stepKey="WaitForClear"/> - <actionGroup ref="filterProductGridByName" stepKey="filterBundleProductOptionsDownToName"> + <actionGroup ref="FilterProductGridByNameActionGroup" stepKey="filterBundleProductOptionsDownToName"> <argument name="product" value="BundleProduct"/> </actionGroup> <seeElement selector="{{AdminProductFiltersSection.priceOfFirstRow(BundleProduct.fixedPrice)}}" stepKey="seePrice"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/BundleProductWithTierPriceInCartTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/BundleProductWithTierPriceInCartTest.xml index 46c6114637af6..a27d5a832ed21 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/BundleProductWithTierPriceInCartTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/BundleProductWithTierPriceInCartTest.xml @@ -26,7 +26,7 @@ <deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/> <deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/> <actionGroup ref="StorefrontSignOutActionGroup" stepKey="StorefrontSignOutActionGroup"/> - <actionGroup stepKey="deleteBundle" ref="deleteProductUsingProductGrid"> + <actionGroup stepKey="deleteBundle" ref="DeleteProductUsingProductGridActionGroup"> <argument name="product" value="BundleProduct"/> </actionGroup> <actionGroup ref="AdminClearFiltersActionGroup" stepKey="clearFiltersAfter"/> @@ -55,7 +55,7 @@ <argument name="inputType" value="checkbox"/> </actionGroup> <scrollToTopOfPage stepKey="scrollTopPageProduct"/> - <actionGroup ref="ProductSetAdvancedPricing" stepKey="addTierPriceProduct"> + <actionGroup ref="ProductSetAdvancedPricingActionGroup" stepKey="addTierPriceProduct"> <argument name="group" value="ALL GROUPS"/> <argument name="quantity" value="1"/> <argument name="price" value="Discount"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/CurrencyChangingBundleProductInCartTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/CurrencyChangingBundleProductInCartTest.xml index ded8bb3c83337..915ccbf2cac09 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/CurrencyChangingBundleProductInCartTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/CurrencyChangingBundleProductInCartTest.xml @@ -24,7 +24,7 @@ </before> <after> <!-- Delete the bundled product --> - <actionGroup stepKey="deleteBundle" ref="deleteProductUsingProductGrid"> + <actionGroup stepKey="deleteBundle" ref="DeleteProductUsingProductGridActionGroup"> <argument name="product" value="BundleProduct"/> </actionGroup> <actionGroup ref="AdminClearFiltersActionGroup" stepKey="ClearFiltersAfter"/> @@ -58,7 +58,7 @@ </actionGroup> <checkOption selector="{{AdminProductFormBundleSection.userDefinedQuantity('0', '0')}}" stepKey="userDefinedQuantitiyOptionProduct0"/> <checkOption selector="{{AdminProductFormBundleSection.userDefinedQuantity('0', '1')}}" stepKey="userDefinedQuantitiyOptionProduct1"/> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <amOnPage url="{{ConfigCurrencySetupPage.url}}" stepKey="navigateToConfigCurrencySetupPage"/> <waitForPageLoad stepKey="waitForConfigCurrencySetupPage"/> <conditionalClick selector="{{CurrencySetupSection.currencyOptions}}" dependentSelector="{{CurrencySetupSection.allowCurrencies}}" visible="false" stepKey="openOptions"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/EnableDisableBundleProductStatusTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/EnableDisableBundleProductStatusTest.xml index 0cfd1f99a8ce0..1e16a82ed8714 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/EnableDisableBundleProductStatusTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/EnableDisableBundleProductStatusTest.xml @@ -46,11 +46,11 @@ <waitForElementVisible selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="waitForAddProductsToBundle"/> <click selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="clickAddProductsToOption"/> <waitForPageLoad stepKey="waitForPageLoadAfterBundleProducts"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions2"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions2"> <argument name="product" value="$$simpleProduct2$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow2"/> @@ -77,7 +77,7 @@ <!--Testing disabled view--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="GoToProductCatalog"/> <waitForPageLoad stepKey="WaitForCatalogProductPageToLoad"/> - <actionGroup ref="filterProductGridBySku" stepKey="FindProductEditPage"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="FindProductEditPage"> <argument name="product" value="BundleProduct"/> </actionGroup> <click selector="{{AdminDataGridTableSection.rowViewAction('1')}}" stepKey="ClickProductInGrid"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/EndToEndB2CAdminTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/EndToEndB2CAdminTest.xml index 9040d675be34f..5f7a1827a6156 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/EndToEndB2CAdminTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/EndToEndB2CAdminTest.xml @@ -11,7 +11,7 @@ <!--Create Bundle Product--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPageBundle" after="seeSimpleProductInGrid"/> <waitForPageLoad stepKey="waitForProductPageLoadBundle" after="visitAdminProductPageBundle"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateBundleProduct" after="waitForProductPageLoadBundle"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateBundleProduct" after="waitForProductPageLoadBundle"> <argument name="product" value="BundleProduct"/> </actionGroup> @@ -24,20 +24,20 @@ <waitForElementVisible selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="waitForAddProductsToBundle" after="selectInputType"/> <click selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="clickAddProductsToOption" after="waitForAddProductsToBundle"/> <waitForPageLoad stepKey="waitForPageLoadAfterBundleProducts" after="clickAddProductsToOption"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions" after="waitForPageLoadAfterBundleProducts"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions" after="waitForPageLoadAfterBundleProducts"> <argument name="product" value="SimpleProduct"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow" after="filterBundleProductOptions"/> <click selector="{{AdminAddProductsToOptionPanel.addSelectedProducts}}" stepKey="clickAddSelectedBundleProducts" after="selectFirstGridRow"/> <fillField selector="{{AdminProductFormBundleSection.firstProductQuantity}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty" after="clickAddSelectedBundleProducts"/> - <actionGroup ref="saveProductForm" stepKey="saveBundleProduct" after="fillProductDefaultQty"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveBundleProduct" after="fillProductDefaultQty"/> <actionGroup ref="viewBundleProductInAdminGrid" stepKey="viewBundleProductInGrid" after="saveBundleProduct"> <argument name="product" value="BundleProduct"/> </actionGroup> <!--@TODO Move cleanup to "after" when MQE-830 is resolved--> <comment userInput="Clean up bundle product" stepKey="cleanUpBundleProduct" after="deleteSimpleProduct"/> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteBundleProduct" after="cleanUpBundleProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteBundleProduct" after="cleanUpBundleProduct"> <argument name="product" value="BundleProduct"/> </actionGroup> </test> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/MassEnableDisableBundleProductsTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/MassEnableDisableBundleProductsTest.xml index ff192538637ef..b689587bcd8eb 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/MassEnableDisableBundleProductsTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/MassEnableDisableBundleProductsTest.xml @@ -48,11 +48,11 @@ <waitForElementVisible selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="waitForAddProductsToBundle"/> <click selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="clickAddProductsToOption"/> <waitForPageLoad stepKey="waitForPageLoadAfterBundleProducts"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions2"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions2"> <argument name="product" value="$$simpleProduct2$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow2"/> @@ -80,11 +80,11 @@ <waitForElementVisible selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="waitForAddProductsToBundle2"/> <click selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="clickAddProductsToOption2"/> <waitForPageLoad stepKey="waitForPageLoadAfterBundleProducts2"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptionsx2"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptionsx2"> <argument name="product" value="$$simpleProduct3$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRowx2"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions22"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions22"> <argument name="product" value="$$simpleProduct4$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow22"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/NewBundleProductSelectionTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/NewBundleProductSelectionTest.xml index e0a6a9afd648e..2b948ff02d38c 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/NewBundleProductSelectionTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/NewBundleProductSelectionTest.xml @@ -27,7 +27,7 @@ <amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="GoToCatalogProductPage"/> <waitForPageLoad stepKey="WaitForPageToLoad"/> <!--Selecting new bundle product--> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateBundleProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateBundleProduct"> <argument name="product" value="BundleProduct"/> </actionGroup> <!--Testing if on the bundle product creation page--> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/NewProductsListWidgetBundleProductTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/NewProductsListWidgetBundleProductTest.xml index 8efe32a7d84c0..27369d38f0c35 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/NewProductsListWidgetBundleProductTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/NewProductsListWidgetBundleProductTest.xml @@ -52,11 +52,11 @@ <selectOption selector="{{AdminProductFormBundleSection.bundleOptionXInputType('0')}}" userInput="checkbox" stepKey="selectInputType"/> <click selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="clickAddProductsToOption"/> <waitForPageLoad stepKey="waitForPageLoadAfterBundleProducts"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions2"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions2"> <argument name="product" value="$$simpleProduct2$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow2"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAddBundleOptionsToCartTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAddBundleOptionsToCartTest.xml index a1630128638d9..810f84baed906 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAddBundleOptionsToCartTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAddBundleOptionsToCartTest.xml @@ -43,7 +43,7 @@ <deleteData createDataKey="simpleProduct9" stepKey="deleteSimpleProduct9"/> <deleteData createDataKey="simpleProduct10" stepKey="deleteSimpleProduct10"/> <!--delete created bundle product--> - <actionGroup stepKey="deleteProduct1" ref="deleteProductBySku"> + <actionGroup stepKey="deleteProduct1" ref="DeleteProductBySkuActionGroup"> <argument name="sku" value="{{BundleProduct.sku}}"/> </actionGroup> <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" @@ -54,10 +54,10 @@ <!-- Start creating a bundle product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductList"/> <waitForPageLoad stepKey="waitForProductList"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct"> <argument name="product" value="BundleProduct"/> </actionGroup> - <actionGroup ref="fillProductNameAndSkuInProductForm" stepKey="fillNameAndSku"> + <actionGroup ref="FillProductNameAndSkuInProductFormActionGroup" stepKey="fillNameAndSku"> <argument name="product" value="BundleProduct"/> </actionGroup> @@ -97,7 +97,7 @@ </actionGroup> <!-- Save product--> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!--Go to Storefront and open Bundle Product page--> <amOnPage url="{{BundleProduct.sku}}.html" stepKey="goToStorefront"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAdminEditDataTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAdminEditDataTest.xml index 40132ea956584..75e1fa5d7cd4d 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAdminEditDataTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAdminEditDataTest.xml @@ -32,11 +32,11 @@ <!-- Create a bundle product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPageBundle"/> <waitForPageLoad stepKey="waitForProductPageLoadBundle"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateBundleProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateBundleProduct"> <argument name="product" value="BundleProduct"/> </actionGroup> - <actionGroup ref="fillProductNameAndSkuInProductForm" stepKey="fillBundleProductNameAndSku"> + <actionGroup ref="FillProductNameAndSkuInProductFormActionGroup" stepKey="fillBundleProductNameAndSku"> <argument name="product" value="BundleProduct"/> </actionGroup> @@ -50,11 +50,11 @@ <waitForElementVisible selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="waitForAddProductsToBundle"/> <click selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="clickAddProductsToOption"/> <waitForPageLoad stepKey="waitForPageLoadAfterBundleProducts"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions2"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions2"> <argument name="product" value="$$simpleProduct2$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow2"/> @@ -87,7 +87,7 @@ <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"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="findCreatedProduct"> <argument name="product" value="BundleProduct"/> </actionGroup> <waitForPageLoad stepKey="waitForProductFilterLoad"/> @@ -106,7 +106,7 @@ <assertNotEquals expected="{$grabTotalBefore}" expectedType="string" actual="{$grabTotalAfter}" actualType="string" stepKey="assertNotEquals"/> <!-- Delete the bundled product --> - <actionGroup stepKey="deleteBundle" ref="deleteProductUsingProductGrid"> + <actionGroup stepKey="deleteBundle" ref="DeleteProductUsingProductGridActionGroup"> <argument name="product" value="BundleProduct"/> </actionGroup> </test> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleCartTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleCartTest.xml index 695c3a8bf7dbb..9d1008875e57f 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleCartTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleCartTest.xml @@ -32,10 +32,10 @@ <!-- Start creating a bundle product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductList"/> <waitForPageLoad stepKey="waitForProductList"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct"> <argument name="product" value="BundleProduct"/> </actionGroup> - <actionGroup ref="fillProductNameAndSkuInProductForm" stepKey="fillNameAndSku"> + <actionGroup ref="FillProductNameAndSkuInProductFormActionGroup" stepKey="fillNameAndSku"> <argument name="product" value="BundleProduct"/> </actionGroup> @@ -80,7 +80,7 @@ </actionGroup> <!-- Save product and go to storefront --> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <amOnPage url="{{BundleProduct.sku}}.html" stepKey="goToStorefront"/> <waitForPageLoad stepKey="waitForStorefront"/> <click selector="{{StorefrontBundledSection.addToCart}}" stepKey="clickCustomize"/> @@ -149,10 +149,10 @@ <!-- Start creating a bundle product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductList"/> <waitForPageLoad stepKey="waitForProductList"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct"> <argument name="product" value="BundleProduct"/> </actionGroup> - <actionGroup ref="fillProductNameAndSkuInProductForm" stepKey="fillNameAndSku"> + <actionGroup ref="FillProductNameAndSkuInProductFormActionGroup" stepKey="fillNameAndSku"> <argument name="product" value="BundleProduct"/> </actionGroup> @@ -197,7 +197,7 @@ </actionGroup> <!-- Save product and go to storefront --> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <amOnPage url="{{BundleProduct.sku}}.html" stepKey="goToStorefront"/> <waitForPageLoad stepKey="waitForStorefront"/> <click selector="{{StorefrontBundledSection.addToCart}}" stepKey="clickCustomize"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleProductDetailsTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleProductDetailsTest.xml index d7394b2dbf32e..35f3cb527628b 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleProductDetailsTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleProductDetailsTest.xml @@ -33,7 +33,7 @@ <deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/> <deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/> <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndexPage"/> - <actionGroup ref="deleteProductsIfTheyExist" stepKey="deleteAllProducts"/> + <actionGroup ref="DeleteProductsIfTheyExistActionGroup" stepKey="deleteAllProducts"/> <actionGroup ref="logout" stepKey="logout"/> </after> <!-- go to bundle product creation page--> @@ -55,11 +55,11 @@ <waitForElementVisible selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="waitForAddProductsToBundle"/> <click selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="clickAddProductsToOption"/> <waitForPageLoad stepKey="waitForPageLoadAfterBundleProducts"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions2"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions2"> <argument name="product" value="$$simpleProduct2$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow2"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleProductShownInCategoryListAndGrid.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleProductShownInCategoryListAndGrid.xml index 88db5b64fa42d..ff25b3f1407c4 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleProductShownInCategoryListAndGrid.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleProductShownInCategoryListAndGrid.xml @@ -37,7 +37,7 @@ <!--Make category--> <amOnPage url="{{AdminCategoryPage.url}}" stepKey="goToCategoryPage"/> <waitForPageLoad stepKey="waitForCategoryPageLoad"/> - <actionGroup ref="CreateCategory" stepKey="createASubcategory"> + <actionGroup ref="CreateCategoryActionGroup" stepKey="createASubcategory"> <argument name="categoryEntity" value="SimpleSubCategory"/> </actionGroup> @@ -59,11 +59,11 @@ <selectOption selector="{{AdminProductFormBundleSection.bundleOptionXInputType('0')}}" userInput="{{BundleProduct.optionInputType1}}" stepKey="selectInputType"/> <waitForElementVisible selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="waitForAddProductsToBundle"/> <click selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="clickAddProductsToOption"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions2"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions2"> <argument name="product" value="$$simpleProduct2$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow2"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontCheckBundleProductOptionTierPrices.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontCheckBundleProductOptionTierPrices.xml index 532af1ea76dca..0487668c10094 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontCheckBundleProductOptionTierPrices.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontCheckBundleProductOptionTierPrices.xml @@ -28,7 +28,7 @@ <!-- Simple product 1 --> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <amOnPage url="{{AdminProductEditPage.url($$simpleProduct1CreateBundleProduct.id$$)}}" stepKey="openAdminEditPageProduct1"/> - <actionGroup ref="ProductSetAdvancedPricing" stepKey="addTierPriceProduct1"> + <actionGroup ref="ProductSetAdvancedPricingActionGroup" stepKey="addTierPriceProduct1"> <argument name="group" value="ALL GROUPS"/> <argument name="quantity" value="5"/> <argument name="price" value="Discount"/> @@ -36,7 +36,7 @@ </actionGroup> <!-- Simple product 2 --> <amOnPage url="{{AdminProductEditPage.url($$simpleProduct2CreateBundleProduct.id$$)}}" stepKey="openAdminEditPageProduct2"/> - <actionGroup ref="ProductSetAdvancedPricing" stepKey="addTierPriceProduct2"> + <actionGroup ref="ProductSetAdvancedPricingActionGroup" stepKey="addTierPriceProduct2"> <argument name="group" value="ALL GROUPS"/> <argument name="quantity" value="7"/> <argument name="price" value="Discount"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontCustomerSelectAndSetBundleOptionsTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontCustomerSelectAndSetBundleOptionsTest.xml index 5e6e891541420..9998e202fce24 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontCustomerSelectAndSetBundleOptionsTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontCustomerSelectAndSetBundleOptionsTest.xml @@ -25,7 +25,7 @@ </before> <after> <!-- Delete the bundled product --> - <actionGroup stepKey="deleteBundle" ref="deleteProductUsingProductGrid"> + <actionGroup stepKey="deleteBundle" ref="DeleteProductUsingProductGridActionGroup"> <argument name="product" value="BundleProduct"/> </actionGroup> <amOnPage url="{{AdminLogoutPage.url}}" stepKey="logout"/> @@ -36,10 +36,10 @@ <!-- Start creating a bundle product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductList"/> <waitForPageLoad stepKey="waitForProductList"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct"> <argument name="product" value="BundleProduct"/> </actionGroup> - <actionGroup ref="fillProductNameAndSkuInProductForm" stepKey="fillNameAndSku"> + <actionGroup ref="FillProductNameAndSkuInProductFormActionGroup" stepKey="fillNameAndSku"> <argument name="product" value="BundleProduct"/> </actionGroup> @@ -88,7 +88,7 @@ </actionGroup> <!-- Save product and go to storefront --> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <amOnPage url="{{BundleProduct.sku}}.html" stepKey="goToStorefront"/> <waitForPageLoad stepKey="waitForStorefront"/> <click selector="{{StorefrontBundledSection.addToCart}}" stepKey="clickCustomize"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontEditBundleProductTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontEditBundleProductTest.xml index 58806126aee30..0ac47a27f1f95 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontEditBundleProductTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontEditBundleProductTest.xml @@ -32,11 +32,11 @@ <!-- Create a bundle product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPageBundle"/> <waitForPageLoad stepKey="waitForProductPageLoadBundle"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateBundleProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateBundleProduct"> <argument name="product" value="BundleProduct"/> </actionGroup> - <actionGroup ref="fillProductNameAndSkuInProductForm" stepKey="fillBundleProductNameAndSku"> + <actionGroup ref="FillProductNameAndSkuInProductFormActionGroup" stepKey="fillBundleProductNameAndSku"> <argument name="product" value="BundleProduct"/> </actionGroup> @@ -50,11 +50,11 @@ <waitForElementVisible selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="waitForAddProductsToBundle"/> <click selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="clickAddProductsToOption"/> <waitForPageLoad stepKey="waitForPageLoadAfterBundleProducts"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions2"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions2"> <argument name="product" value="$$simpleProduct2$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow2"/> @@ -116,7 +116,7 @@ <assertNotEquals expected="{$grabTotalBefore}" expectedType="string" actual="{$grabTotalAfter}" actualType="string" stepKey="assertNotEquals"/> <!-- Delete the bundled product --> - <actionGroup stepKey="deleteBundle" ref="deleteProductUsingProductGrid"> + <actionGroup stepKey="deleteBundle" ref="DeleteProductUsingProductGridActionGroup"> <argument name="product" value="BundleProduct"/> </actionGroup> </test> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontGoToDetailsPageWhenAddingToCartTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontGoToDetailsPageWhenAddingToCartTest.xml index ccd6a58223b3c..8f47bd7962bea 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontGoToDetailsPageWhenAddingToCartTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontGoToDetailsPageWhenAddingToCartTest.xml @@ -48,11 +48,11 @@ <selectOption selector="{{AdminProductFormBundleSection.bundleOptionXInputType('0')}}" userInput="{{BundleProduct.optionInputType1}}" stepKey="selectInputType"/> <waitForElementVisible selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="waitForAddProductsToBundle"/> <click selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="clickAddProductsToOption"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions2"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions2"> <argument name="product" value="$$simpleProduct2$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow2"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontSortBundleProductsByPriceTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontSortBundleProductsByPriceTest.xml index 18316e41241e4..8bf0de7530e64 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontSortBundleProductsByPriceTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontSortBundleProductsByPriceTest.xml @@ -156,7 +156,7 @@ </actionGroup> <!-- Switch category view to List mode --> - <actionGroup ref="StorefrontSwitchCategoryViewToListMode" stepKey="switchCategoryViewToListMode"/> + <actionGroup ref="StorefrontSwitchCategoryViewToListModeActionGroup" stepKey="switchCategoryViewToListMode"/> <!-- Sort products By Price --> <actionGroup ref="StorefrontCategoryPageSortProductActionGroup" stepKey="sortProductByPrice"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontVerifyDynamicBundleProductPricesForCombinationOfOptionsTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontVerifyDynamicBundleProductPricesForCombinationOfOptionsTest.xml index 31a5f9bab7758..c78796d2fd8b4 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontVerifyDynamicBundleProductPricesForCombinationOfOptionsTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontVerifyDynamicBundleProductPricesForCombinationOfOptionsTest.xml @@ -42,7 +42,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <amOnPage url="{{AdminProductEditPage.url($$simpleProduct5.id$$)}}" stepKey="openAdminEditPage"/> <actionGroup ref="AddSpecialPriceToProductActionGroup" stepKey="addSpecialPrice"/> - <actionGroup ref="saveProductForm" stepKey="saveProductForm"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductForm"/> <!--Create Bundle product--> <createData entity="ApiBundleProductPriceViewRange" stepKey="createBundleProduct"> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddCategoryImageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddCategoryImageActionGroup.xml new file mode 100644 index 0000000000000..5837891667cc9 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddCategoryImageActionGroup.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddCategoryImageActionGroup"> + <annotations> + <description>Requires navigation to the Category creation/edit page. Adds the provided image to a Category. Validates that the Image exists.</description> + </annotations> + <arguments> + <argument name="image" defaultValue="ProductImage"/> + </arguments> + + <conditionalClick selector="{{AdminCategoryContentSection.sectionHeader}}" dependentSelector="{{AdminCategoryContentSection.uploadButton}}" visible="false" stepKey="openContentSection"/> + <waitForPageLoad time="30" stepKey="waitForPageLoad"/> + <waitForElementVisible selector="{{AdminCategoryContentSection.uploadButton}}" stepKey="seeImageSectionIsReady"/> + <attachFile selector="{{AdminCategoryContentSection.uploadImageFile}}" userInput="{{image.file}}" stepKey="uploadFile"/> + <waitForAjaxLoad time="30" stepKey="waitForAjaxUpload"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoading"/> + <grabTextFrom selector="{{AdminCategoryContentSection.imageFileName}}" stepKey="grabCategoryFileName"/> + <assertRegExp stepKey="assertEquals" message="pass"> + <expectedResult type="string">/magento-logo(_[0-9]+)*?\.png$/</expectedResult> + <actualResult type="variable">grabCategoryFileName</actualResult> + </assertRegExp> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddCrossSellProductBySkuActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddCrossSellProductBySkuActionGroup.xml new file mode 100644 index 0000000000000..bf238a0b88417 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddCrossSellProductBySkuActionGroup.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddCrossSellProductBySkuActionGroup"> + <annotations> + <description>Adds the provided Product SKU as a Cross Sell Product on the Admin Product creation/edit page.</description> + </annotations> + <arguments> + <argument name="sku"/> + </arguments> + + <!--Scroll up to avoid error--> + <scrollTo selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDropdown}}" x="0" y="-100" stepKey="scrollTo"/> + <conditionalClick selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDropdown}}" dependentSelector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDependent}}" visible="false" stepKey="openDropDownIfClosedRelatedUpSellCrossSell"/> + <click selector="{{AdminProductFormRelatedUpSellCrossSellSection.AddCrossSellProductsButton}}" stepKey="clickAddCrossSellButton"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{sku}}" stepKey="fillProductSkuFilter"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + <click selector="{{AdminProductModalSlideGridSection.productGridXRowYColumnButton('1', '1')}}" stepKey="selectProduct"/> + <click selector="{{AdminProductCrossSellModalSection.addSelectedProducts}}" stepKey="addRelatedProductSelected"/> + <waitForPageLoad stepKey="waitForModalDisappear"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddProductAttributeInProductModalActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddProductAttributeInProductModalActionGroup.xml new file mode 100644 index 0000000000000..0b8721c589706 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddProductAttributeInProductModalActionGroup.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddProductAttributeInProductModalActionGroup"> + <annotations> + <description>Adds the provided Attribute Code to the Product on the Admin Product creation/edit page.</description> + </annotations> + <arguments> + <argument name="attributeCode" type="string"/> + </arguments> + + <click stepKey="addAttribute" selector="{{AdminProductFormActionSection.addAttributeButton}}"/> + <conditionalClick selector="{{AdminProductAddAttributeModalSection.clearFilters}}" dependentSelector="{{AdminProductAddAttributeModalSection.clearFilters}}" visible="true" stepKey="clearFilters"/> + <click stepKey="clickFilters" selector="{{AdminProductAddAttributeModalSection.filters}}"/> + <fillField stepKey="fillCode" selector="{{AdminProductAddAttributeModalSection.attributeCodeFilter}}" userInput="{{attributeCode}}"/> + <click stepKey="clickApply" selector="{{AdminProductAddAttributeModalSection.applyFilters}}"/> + <waitForPageLoad stepKey="waitForFilters"/> + <checkOption selector="{{AdminProductAddAttributeModalSection.firstRowCheckBox}}" stepKey="checkAttribute"/> + <click stepKey="addSelected" selector="{{AdminProductAddAttributeModalSection.addSelected}}"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddProductCustomOptionFieldActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddProductCustomOptionFieldActionGroup.xml new file mode 100644 index 0000000000000..784a30de3d3c0 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddProductCustomOptionFieldActionGroup.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddProductCustomOptionFieldActionGroup"> + <annotations> + <description>Add a custom Field Product Option to a Product based on the provided Option.</description> + </annotations> + <arguments> + <argument name="option" defaultValue="ProductOptionField"/> + </arguments> + + <scrollTo selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" stepKey="scrollToAddButtonOption"/> + <conditionalClick selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" visible="false" stepKey="openCustomOptionSection"/> + <click selector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" stepKey="clickAddOption"/> + <waitForElementVisible selector="{{AdminProductCustomizableOptionsSection.lastOptionTitle}}" stepKey="waitForOption"/> + <fillField selector="{{AdminProductCustomizableOptionsSection.lastOptionTitle}}" userInput="{{option.title}}" stepKey="fillTitle"/> + <click selector="{{AdminProductCustomizableOptionsSection.lastOptionTypeParent}}" stepKey="openTypeSelect"/> + <click selector="{{AdminProductCustomizableOptionsSection.optionType('Field')}}" stepKey="selectTypeFile"/> + <waitForElementVisible selector="{{AdminProductCustomizableOptionsSection.optionPriceByTitle(option.title)}}" stepKey="waitForElements"/> + <fillField selector="{{AdminProductCustomizableOptionsSection.optionPriceByTitle(option.title)}}" userInput="{{option.price}}" stepKey="fillPrice"/> + <selectOption selector="{{AdminProductCustomizableOptionsSection.optionPriceTypeByTitle(option.title)}}" userInput="{{option.price_type}}" stepKey="selectPriceType"/> + <fillField selector="{{AdminProductCustomizableOptionsSection.optionSkuByTitle(option.title)}}" userInput="{{option.title}}" stepKey="fillSku"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddProductCustomOptionFileActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddProductCustomOptionFileActionGroup.xml new file mode 100644 index 0000000000000..961493d06f494 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddProductCustomOptionFileActionGroup.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddProductCustomOptionFileActionGroup"> + <annotations> + <description>Add a custom File Product Option to a Product based on the provided File.</description> + </annotations> + <arguments> + <argument name="option" defaultValue="ProductOptionFile"/> + </arguments> + + <conditionalClick selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" visible="false" stepKey="openCustomOptionSection"/> + <click selector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" stepKey="clickAddOption"/> + <waitForElementVisible selector="{{AdminProductCustomizableOptionsSection.lastOptionTitle}}" stepKey="waitForOption"/> + <fillField selector="{{AdminProductCustomizableOptionsSection.lastOptionTitle}}" userInput="{{option.title}}" stepKey="fillTitle"/> + <click selector="{{AdminProductCustomizableOptionsSection.lastOptionTypeParent}}" stepKey="openTypeSelect"/> + <click selector="{{AdminProductCustomizableOptionsSection.optionType('File')}}" stepKey="selectTypeFile"/> + <waitForElementVisible selector="{{AdminProductCustomizableOptionsSection.optionPriceByTitle(option.title)}}" stepKey="waitForElements"/> + <fillField selector="{{AdminProductCustomizableOptionsSection.optionPriceByTitle(option.title)}}" userInput="{{option.price}}" stepKey="fillPrice"/> + <selectOption selector="{{AdminProductCustomizableOptionsSection.optionPriceTypeByTitle(option.title)}}" userInput="{{option.price_type}}" stepKey="selectPriceType"/> + <fillField selector="{{AdminProductCustomizableOptionsSection.optionFileExtensionByTitle(option.title)}}" userInput="{{option.file_extension}}" stepKey="fillCompatibleExtensions"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddProductImageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddProductImageActionGroup.xml new file mode 100644 index 0000000000000..2efeca44003b3 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddProductImageActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddProductImageActionGroup"> + <annotations> + <description>Adds the provided Product Image on the Admin Products creation/edit page.</description> + </annotations> + <arguments> + <argument name="image" defaultValue="ProductImage"/> + </arguments> + + <conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductImagesSection"/> + <waitForPageLoad time="30" stepKey="waitForPageRefresh"/> + <waitForElementVisible selector="{{AdminProductImagesSection.imageUploadButton}}" stepKey="seeImageSectionIsReady"/> + <attachFile selector="{{AdminProductImagesSection.imageFileUpload}}" userInput="{{image.file}}" stepKey="uploadFile"/> + <waitForElementNotVisible selector="{{AdminProductImagesSection.uploadProgressBar}}" stepKey="waitForUpload"/> + <waitForElementVisible selector="{{AdminProductImagesSection.imageFile(image.fileName)}}" stepKey="waitForThumbnail"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddProductWithQtyToCartFromStorefrontProductPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddProductWithQtyToCartFromStorefrontProductPageActionGroup.xml new file mode 100644 index 0000000000000..237db68dcf953 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddProductWithQtyToCartFromStorefrontProductPageActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddProductWithQtyToCartFromStorefrontProductPageActionGroup" extends="AddToCartFromStorefrontProductPageActionGroup"> + <annotations> + <description>EXTENDS: addToCartFromStorefrontProductPage. Fills in the provided Product Quantity for the provided Product Name.</description> + </annotations> + <arguments> + <argument name="productName" type="string"/> + <argument name="productQty" type="string"/> + </arguments> + + <fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="{{productQty}}" stepKey="fillProductQuantity" before="addToCart"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddRelatedProductBySkuActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddRelatedProductBySkuActionGroup.xml new file mode 100644 index 0000000000000..ce62acf6dd32a --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddRelatedProductBySkuActionGroup.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddRelatedProductBySkuActionGroup"> + <annotations> + <description>Adds the provided Product SKU as a Related Product on the Admin Product creation/edit page.</description> + </annotations> + <arguments> + <argument name="sku"/> + </arguments> + + <!--Scroll up to avoid error--> + <scrollTo selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDropdown}}" x="0" y="-100" stepKey="scrollTo"/> + <conditionalClick selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDropdown}}" dependentSelector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDependent}}" visible="false" stepKey="openDropDownIfClosedRelatedUpSellCrossSell"/> + <click selector="{{AdminProductFormRelatedUpSellCrossSellSection.AddRelatedProductsButton}}" stepKey="clickAddRelatedProductButton"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{sku}}" stepKey="fillProductSkuFilter"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + <click selector="{{AdminProductModalSlideGridSection.productGridXRowYColumnButton('1', '1')}}" stepKey="selectProduct"/> + <click selector="{{AdminAddRelatedProductsModalSection.AddSelectedProductsButton}}" stepKey="addRelatedProductSelected"/> + <waitForElementNotVisible selector="{{AdminAddRelatedProductsModalSection.AddSelectedProductsButton}}" stepKey="waitForElementNotVisible"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddProductToCartActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddSimpleProductToCartActionGroup.xml similarity index 80% rename from app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddProductToCartActionGroup.xml rename to app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddSimpleProductToCartActionGroup.xml index bc7288d33bcb3..81e3b8c99d9d2 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddProductToCartActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddSimpleProductToCartActionGroup.xml @@ -8,7 +8,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AddSimpleProductToCart"> + <actionGroup name="AddSimpleProductToCartActionGroup"> <annotations> <description>Navigates to the Storefront Product page. Then adds the Product to the Cart. Validates that the Success Message is present and correct.</description> </annotations> @@ -26,10 +26,4 @@ <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" time="30" stepKey="waitForProductAddedMessage"/> <see selector="{{StorefrontMessagesSection.success}}" userInput="You added {{product.name}} to your shopping cart." stepKey="seeAddToCartSuccessMessage"/> </actionGroup> - <actionGroup name="StorefrontAddSimpleProductWithQtyActionGroup" extends="AddSimpleProductToCart"> - <arguments> - <argument name="quantity" type="string" defaultValue="1"/> - </arguments> - <fillField userInput="{{quantity}}" selector="{{StorefrontProductPageSection.qtyInput}}" stepKey="fillProductQty" after="goToProductPage"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddSpecialPriceToProductActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddSpecialPriceToProductActionGroup.xml new file mode 100644 index 0000000000000..dde25104b64dd --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddSpecialPriceToProductActionGroup.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddSpecialPriceToProductActionGroup"> + <annotations> + <description>Sets the provided Special Price on the Admin Product creation/edit page.</description> + </annotations> + <arguments> + <argument name="price" type="string" defaultValue="8"/> + </arguments> + + <waitForPageLoad stepKey="waitForPageLoad"/> + <click selector="{{AdminProductFormSection.advancedPricingLink}}" stepKey="clickAdvancedPricingLink"/> + <waitForPageLoad stepKey="waitForAdvancedPricingModal"/> + <waitForElementVisible selector="{{AdminProductFormAdvancedPricingSection.specialPrice}}" stepKey="waitSpecialPrice"/> + <fillField userInput="{{price}}" selector="{{AdminProductFormAdvancedPricingSection.specialPrice}}" stepKey="fillSpecialPrice"/> + <click selector="{{AdminProductFormAdvancedPricingSection.doneButton}}" stepKey="clickDone"/> + <waitForPageLoad stepKey="waitForAdvancedPricingModalGone"/> + <waitForElementNotVisible selector="{{AdminProductFormAdvancedPricingSection.specialPrice}}" stepKey="waitForCloseModalWindow"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddToCartFromStorefrontProductPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddToCartFromStorefrontProductPageActionGroup.xml new file mode 100644 index 0000000000000..b27bda2b7c8f1 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddToCartFromStorefrontProductPageActionGroup.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <!--Click Add to Cart button in storefront product page--> + <actionGroup name="AddToCartFromStorefrontProductPageActionGroup"> + <annotations> + <description>Click on the Add to Cart button. Validates that the Success Message is present.</description> + </annotations> + <arguments> + <argument name="productName"/> + </arguments> + + <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addToCart"/> + <waitForPageLoad stepKey="waitForAddToCart"/> + <waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdding}}" stepKey="waitForElementNotVisibleAddToCartButtonTitleIsAdding"/> + <waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdded}}" stepKey="waitForElementNotVisibleAddToCartButtonTitleIsAdded"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> + <see selector="{{StorefrontMessagesSection.success}}" userInput="You added {{productName}} to your shopping cart." stepKey="seeAddToCartSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddUpSellProductBySkuActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddUpSellProductBySkuActionGroup.xml new file mode 100644 index 0000000000000..b107aab956beb --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddUpSellProductBySkuActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AddUpSellProductBySkuActionGroup" extends="AddRelatedProductBySkuActionGroup"> + <annotations> + <description>EXTENDS: addRelatedProductBySku. Add the provided Product as an Up Sell Product.</description> + </annotations> + + <click selector="{{AdminProductFormRelatedUpSellCrossSellSection.AddUpSellProductsButton}}" stepKey="clickAddRelatedProductButton"/> + <conditionalClick selector="{{AdminAddUpSellProductsModalSection.Modal}} {{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminAddUpSellProductsModalSection.Modal}} {{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> + <click selector="{{AdminAddUpSellProductsModalSection.Modal}} {{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> + <fillField selector="{{AdminAddUpSellProductsModalSection.Modal}} {{AdminProductGridFilterSection.skuFilter}}" userInput="{{sku}}" stepKey="fillProductSkuFilter"/> + <click selector="{{AdminAddUpSellProductsModalSection.Modal}} {{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + <click selector="{{AdminAddUpSellProductsModalSection.Modal}}{{AdminProductModalSlideGridSection.productGridXRowYColumnButton('1', '1')}}" stepKey="selectProduct"/> + <click selector="{{AdminAddUpSellProductsModalSection.AddSelectedProductsButton}}" stepKey="addRelatedProductSelected"/> + <waitForPageLoad stepKey="waitForPageToLoad1"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAddAdvancedPricingToTheProductActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAddAdvancedPricingToTheProductActionGroup.xml index f5e5957507eeb..958549d5768a8 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAddAdvancedPricingToTheProductActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAddAdvancedPricingToTheProductActionGroup.xml @@ -28,16 +28,4 @@ <fillField selector="{{AdminProductFormAdvancedPricingSection.productTierPriceFixedPriceInput(index)}}" userInput="{{groupPrice.price}}" stepKey="selectProductTierPriceFixedPrice"/> <click selector="{{AdminProductFormAdvancedPricingSection.doneButton}}" stepKey="clickDoneButton"/> </actionGroup> - - <!-- Customer group is selected in different way for B2B --> - <actionGroup name="AdminAddAdvancedPricingToTheProductExtendedActionGroup" extends="AdminAddAdvancedPricingToTheProductActionGroup"> - <annotations> - <description>EXTENDS: AdminAddAdvancedPricingToTheProductActionGroup. Removes 'selectProductTierPriceCustomerGroupInput'. Selects the provided Group Price at the provided Index for B2B.</description> - </annotations> - - <remove keyForRemoval="selectProductTierPriceCustomerGroupInput"/> - <click selector="{{AdminProductFormAdvancedPricingSection.productTierPriceCustGroupSelect(index)}}" stepKey="clickProductTierPriceCustGroupSelect" after="selectProductTierPriceWebsiteInput"/> - <waitForElement selector="{{AdminProductFormAdvancedPricingSection.productTierPriceGroupOrCatalogOption(groupPrice.customer_group)}}" time="30" stepKey="waitProductTierPriceGroupOrCatalogOption" after="clickProductTierPriceCustGroupSelect"/> - <click selector="{{AdminProductFormAdvancedPricingSection.productTierPriceGroupOrCatalogOption(groupPrice.customer_group)}}" stepKey="clickAllGroupsOption" after="waitProductTierPriceGroupOrCatalogOption"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAddAdvancedPricingToTheProductExtendedActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAddAdvancedPricingToTheProductExtendedActionGroup.xml new file mode 100644 index 0000000000000..cf8a3879886f1 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAddAdvancedPricingToTheProductExtendedActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAddAdvancedPricingToTheProductExtendedActionGroup" extends="AdminAddAdvancedPricingToTheProductActionGroup"> + <annotations> + <description>EXTENDS: AdminAddAdvancedPricingToTheProductActionGroup. Removes 'selectProductTierPriceCustomerGroupInput'. Selects the provided Group Price at the provided Index for B2B.</description> + </annotations> + + <remove keyForRemoval="selectProductTierPriceCustomerGroupInput"/> + <click selector="{{AdminProductFormAdvancedPricingSection.productTierPriceCustGroupSelect(index)}}" stepKey="clickProductTierPriceCustGroupSelect" after="selectProductTierPriceWebsiteInput"/> + <waitForElement selector="{{AdminProductFormAdvancedPricingSection.productTierPriceGroupOrCatalogOption(groupPrice.customer_group)}}" time="30" stepKey="waitProductTierPriceGroupOrCatalogOption" after="clickProductTierPriceCustGroupSelect"/> + <click selector="{{AdminProductFormAdvancedPricingSection.productTierPriceGroupOrCatalogOption(groupPrice.customer_group)}}" stepKey="clickAllGroupsOption" after="waitProductTierPriceGroupOrCatalogOption"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAddUnassignedAttributeToGroupActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAddUnassignedAttributeToGroupActionGroup.xml new file mode 100644 index 0000000000000..2815bb7a00abf --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAddUnassignedAttributeToGroupActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAddUnassignedAttributeToGroupActionGroup" extends="CreateDefaultAttributeSetActionGroup"> + <arguments> + <argument name="firstOption" type="string" defaultValue="color"/> + <argument name="secondOption" type="string" defaultValue="material"/> + <argument name="group" type="string" defaultValue="Product Details"/> + </arguments> + <dragAndDrop selector1="{{AdminProductAttributeSetSection.attribute(firstOption)}}" selector2="{{AdminProductAttributeSetSection.attribute(group)}}" stepKey="unassign1"/> + <dragAndDrop selector1="{{AdminProductAttributeSetSection.attribute(secondOption)}}" selector2="{{AdminProductAttributeSetSection.attribute(group)}}" stepKey="unassign2"/> + <click selector="{{AdminProductAttributeSetSection.saveBtn}}" stepKey="clickSaveButton"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssertProductCustomOptionVisibleActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssertProductCustomOptionVisibleActionGroup.xml new file mode 100644 index 0000000000000..c00d214d53984 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssertProductCustomOptionVisibleActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAssertProductCustomOptionVisibleActionGroup"> + <arguments> + <argument name="option" defaultValue="ProductOptionField"/> + </arguments> + <conditionalClick selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.checkIfCustomizableOptionsTabOpen}}" visible="true" stepKey="expandContentTab"/> + <waitForPageLoad time="10" stepKey="waitCustomizableOptionsTabOpened"/> + <seeElement selector="{{AdminProductCustomizableOptionsSection.fillOptionTitle(option.title)}}" stepKey="assertCustomOptionVisible"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssertProductHasNoCustomOptionActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssertProductHasNoCustomOptionActionGroup.xml new file mode 100644 index 0000000000000..d4d10efb697a1 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssertProductHasNoCustomOptionActionGroup.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAssertProductHasNoCustomOptionActionGroup" extends="AdminAssertProductCustomOptionVisibleActionGroup"> + <remove keyForRemoval="assertCustomOptionVisible"/> + <dontSeeElement selector="{{AdminProductCustomizableOptionsSection.fillOptionTitle(option.title)}}" after="waitCustomizableOptionsTabOpened" stepKey="assertNoCustomOption"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssertProductHasNoCustomOptionsActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssertProductHasNoCustomOptionsActionGroup.xml new file mode 100644 index 0000000000000..f1a41b4922c5a --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssertProductHasNoCustomOptionsActionGroup.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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAssertProductHasNoCustomOptionsActionGroup"> + <conditionalClick selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.checkIfCustomizableOptionsTabOpen}}" visible="true" stepKey="expandContentTab"/> + <waitForPageLoad time="10" stepKey="waitCustomizableOptionsTabOpened"/> + <dontSeeElement selector="{{AdminProductCustomizableOptionsSection.customOption}}" stepKey="assertNoCustomOptions"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssignProductToCategoryActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssignProductToCategoryActionGroup.xml new file mode 100644 index 0000000000000..b88129f382263 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssignProductToCategoryActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAssignProductToCategoryActionGroup"> + <annotations> + <description>Navigates to existing product page. Changes the category and saves the product.</description> + </annotations> + <arguments> + <argument name="productId" type="string"/> + <argument name="categoryName" type="string"/> + </arguments> + + <amOnPage url="{{AdminProductEditPage.url(productId)}}" stepKey="amOnPage"/> + <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[{{categoryName}}]" stepKey="selectCategory"/> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton"/> + <see selector="{{AdminMessagesSection.success}}" userInput="You saved the product." stepKey="seeSaveProductMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCategoryActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCategoryActionGroup.xml deleted file mode 100644 index afc332cc28378..0000000000000 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCategoryActionGroup.xml +++ /dev/null @@ -1,459 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <!--Create a new category--> - <actionGroup name="CreateCategory"> - <annotations> - <description>Requires navigation to the Category creation page. Adds a new Subcategory. Validates that the Category was created.</description> - </annotations> - <arguments> - <argument name="categoryEntity" defaultValue="_defaultCategory"/> - </arguments> - - <seeInCurrentUrl url="{{AdminCategoryPage.url}}" stepKey="seeOnCategoryPage"/> - <click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategory"/> - <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Category" stepKey="seeCategoryPageTitle"/> - <fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{categoryEntity.name}}" stepKey="enterCategoryName"/> - <click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="openSEO"/> - <fillField selector="{{AdminCategorySEOSection.UrlKeyInput}}" userInput="{{categoryEntity.name_lwr}}" stepKey="enterURLKey"/> - <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/> - <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="assertSuccess"/> - <seeInTitle userInput="{{categoryEntity.name}}" stepKey="seeNewCategoryPageTitle"/> - <seeElement selector="{{AdminCategorySidebarTreeSection.categoryInTree(categoryEntity.name)}}" stepKey="seeCategoryInTree"/> - </actionGroup> - - <!-- Go to create new root or sub category page --> - <actionGroup name="goToCreateCategoryPage"> - <annotations> - <description>Goes to the Category grid page. Clicks the Add Subcategory button.</description> - </annotations> - <arguments> - <argument name="selector" defaultValue="AdminCategorySidebarActionSection.AddSubcategoryButton"/> - </arguments> - - <amOnPage url="{{AdminCategoryPage.url}}" stepKey="amOnAdminCategoryPage"/> - <scrollToTopOfPage stepKey="scrollToTopOfPage"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <click selector="{{selector}}" stepKey="clickOnAddCategory"/> - <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Category" stepKey="seeCategoryPageTitle"/> - </actionGroup> - - <!-- Go to admin category page by id --> - <actionGroup name="goToAdminCategoryPageById"> - <annotations> - <description>Goes to the Category edit page for a specified Category ID.</description> - </annotations> - <arguments> - <argument name="id" type="string"/> - </arguments> - - <amOnPage url="{{AdminCategoryEditPage.url(id)}}" stepKey="amOnAdminCategoryPage"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <see selector="{{AdminHeaderSection.pageTitle}}" userInput="{{id}}" stepKey="seeCategoryPageTitle"/> - </actionGroup> - - <!-- Fill category fields --> - <actionGroup name="fillCategoryForm"> - <annotations> - <description>Requires navigation to the Subcategory creation/edit page. Fills the Subcategory Name. Fills the Search Engine Optimization.</description> - </annotations> - <arguments> - <argument name="categoryEntity" defaultValue="_defaultCategory"/> - </arguments> - - <fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{categoryEntity.name}}" stepKey="enterCategoryName"/> - <click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="openSEO"/> - <fillField selector="{{AdminCategorySEOSection.UrlKeyInput}}" userInput="{{categoryEntity.name_lwr}}" stepKey="enterURLKey"/> - </actionGroup> - - <!-- Save category form --> - <actionGroup name="saveCategoryForm"> - <annotations> - <description>Requires navigation to the Category creation/edit page. Checks that the url contains the AdminCategoryPage url. Saves the Category.</description> - </annotations> - - <seeInCurrentUrl url="{{AdminCategoryPage.url}}" stepKey="seeOnCategoryPage"/> - <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/> - <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="assertSuccess"/> - </actionGroup> - - <!--Upload image for category --> - <actionGroup name="addCategoryImage"> - <annotations> - <description>Requires navigation to the Category creation/edit page. Adds the provided image to a Category. Validates that the Image exists.</description> - </annotations> - <arguments> - <argument name="image" defaultValue="ProductImage"/> - </arguments> - - <conditionalClick selector="{{AdminCategoryContentSection.sectionHeader}}" dependentSelector="{{AdminCategoryContentSection.uploadButton}}" visible="false" stepKey="openContentSection"/> - <waitForPageLoad time="30" stepKey="waitForPageLoad"/> - <waitForElementVisible selector="{{AdminCategoryContentSection.uploadButton}}" stepKey="seeImageSectionIsReady"/> - <attachFile selector="{{AdminCategoryContentSection.uploadImageFile}}" userInput="{{image.file}}" stepKey="uploadFile"/> - <waitForAjaxLoad time="30" stepKey="waitForAjaxUpload"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoading"/> - <grabTextFrom selector="{{AdminCategoryContentSection.imageFileName}}" stepKey="grabCategoryFileName"/> - <assertRegExp stepKey="assertEquals" message="pass"> - <expectedResult type="string">/magento-logo(_[0-9]+)*?\.png$/</expectedResult> - <actualResult type="variable">grabCategoryFileName</actualResult> - </assertRegExp> - </actionGroup> - - <!-- Remove image from category --> - <actionGroup name="removeCategoryImage"> - <annotations> - <description>Requires navigation to the Category creation/edit page. Removes the current Category image. Validates that the Image does not exist.</description> - </annotations> - - <conditionalClick selector="{{AdminCategoryContentSection.sectionHeader}}" dependentSelector="{{AdminCategoryContentSection.uploadButton}}" visible="false" stepKey="openContentSection"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <waitForElementVisible selector="{{AdminCategoryContentSection.uploadButton}}" stepKey="seeImageSectionIsReady"/> - <click selector="{{AdminCategoryContentSection.removeImageButton}}" stepKey="clickRemoveImage"/> - <waitForAjaxLoad time="30" stepKey="waitForAjaxUpload"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoading"/> - <dontSee selector="{{AdminCategoryContentSection.imageFileName}}" stepKey="dontSeeImage"/> - </actionGroup> - - <actionGroup name="checkCategoryImageInAdmin"> - <annotations> - <description>Requires navigation to the Category creation/edit page. Click on the Upload button. Validates that the Image exists.</description> - </annotations> - <arguments> - <argument name="image" defaultValue="ProductImage"/> - </arguments> - - <conditionalClick selector="{{AdminCategoryContentSection.sectionHeader}}" dependentSelector="{{AdminCategoryContentSection.uploadButton}}" visible="false" stepKey="openContentSection"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <waitForElementVisible selector="{{AdminCategoryContentSection.uploadButton}}" stepKey="seeImageSectionIsReady"/> - <grabTextFrom selector="{{AdminCategoryContentSection.imageFileName}}" stepKey="grabCategoryFileName"/> - <assertRegExp stepKey="assertEquals" message="pass"> - <expectedResult type="string">/magento-logo(_[0-9]+)*?\.png$/</expectedResult> - <actualResult type="variable">grabCategoryFileName</actualResult> - </assertRegExp> - </actionGroup> - - <!-- Action to navigate to Media Gallery. Used in tests to cleanup uploaded images --> - <actionGroup name="navigateToMediaGallery"> - <annotations> - <description>Navigates to the category page and Opens the Media Gallery.</description> - </annotations> - - <amOnPage url="{{AdminCategoryPage.url}}" stepKey="amOnAdminCategoryPage"/> - <waitForElementVisible selector="{{AdminCategoryContentSection.sectionHeader}}" stepKey="waitForContentSection"/> - <conditionalClick selector="{{AdminCategoryContentSection.sectionHeader}}" dependentSelector="{{AdminCategoryContentSection.uploadButton}}" visible="false" stepKey="openContentSection"/> - <waitForPageLoad stepKey="waitForPageLoad1"/> - <waitForElementVisible selector="{{AdminCategoryContentSection.selectFromGalleryButton}}" stepKey="waitForSelectFromGalleryButton"/> - <click selector="{{AdminCategoryContentSection.selectFromGalleryButton}}" stepKey="clickSelectFromGalleryButton"/> - <waitForPageLoad stepKey="waitForPageLoad2"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear"/> - </actionGroup> - - <!--Actions to check if a category exists on StoreFront--> - <actionGroup name="CheckCategoryOnStorefront"> - <annotations> - <description>Navigates to the category page on the storefront and asserts that the title is correct for page and browser.</description> - </annotations> - <arguments> - <argument name="categoryEntity" defaultValue="_defaultCategory"/> - </arguments> - - <amOnPage url="/{{categoryEntity.name_lwr}}.html" stepKey="goToCategoryFrontPage"/> - <waitForPageLoad stepKey="waitForPageLoad1"/> - <see selector="{{StorefrontCategoryMainSection.CategoryTitle}}" userInput="{{categoryEntity.name_lwr}}" stepKey="assertCategoryOnStorefront"/> - <seeInTitle userInput="{{categoryEntity.name}}" stepKey="seeCategoryNameInTitle"/> - </actionGroup> - - <!--Actions to delete category--> - <actionGroup name="DeleteCategory"> - <annotations> - <description>Navigates to the category page and deletes the specified category.</description> - </annotations> - <arguments> - <argument name="categoryEntity" defaultValue="_defaultCategory"/> - </arguments> - - <amOnPage url="{{AdminCategoryPage.url}}" stepKey="goToCategoryPage"/> - <waitForPageLoad time="60" stepKey="waitForCategoryPageLoad"/> - <click selector="{{AdminCategorySidebarTreeSection.categoryInTree(categoryEntity.name)}}" stepKey="clickCategoryLink"/> - <click selector="{{AdminCategoryMainActionsSection.DeleteButton}}" stepKey="clickDelete"/> - <waitForElementVisible selector="{{AdminCategoryModalSection.message}}" stepKey="waitForConfirmationModal"/> - <see selector="{{AdminCategoryModalSection.message}}" userInput="Are you sure you want to delete this category?" stepKey="seeDeleteConfirmationMessage"/> - <click selector="{{AdminCategoryModalSection.ok}}" stepKey="confirmDelete"/> - <waitForPageLoad time="60" stepKey="waitForDeleteToFinish"/> - <see selector="You deleted the category." stepKey="seeDeleteSuccess"/> - <click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="expandToSeeAllCategories"/> - <dontSee selector="{{AdminCategorySidebarTreeSection.categoryInTree(categoryEntity.name)}}" stepKey="dontSeeCategoryInTree"/> - </actionGroup> - <actionGroup name="AdminDeleteCategoryByName" extends="DeleteCategory"> - <arguments> - <argument name="categoryName" type="string" defaultValue="category1"/> - </arguments> - <remove keyForRemoval="clickCategoryLink"/> - <remove keyForRemoval="dontSeeCategoryInTree"/> - <remove keyForRemoval="expandToSeeAllCategories"/> - <conditionalClick selector="{{AdminCategorySidebarTreeSection.expandAll}}" dependentSelector="{{AdminCategorySidebarTreeSection.categoryByName(categoryName)}}" visible="false" stepKey="expandCategories" after="waitForCategoryPageLoad"/> - <click selector="{{AdminCategorySidebarTreeSection.categoryByName(categoryName)}}" stepKey="clickCategory" after="expandCategories"/> - <conditionalClick selector="{{AdminCategorySidebarTreeSection.expandAll}}" dependentSelector="{{AdminCategorySidebarTreeSection.categoryByName(categoryName)}}" visible="false" stepKey="expandCategoriesToSeeAll" after="seeDeleteSuccess"/> - <dontSee selector="{{AdminCategorySidebarTreeSection.categoryByName(categoryName)}}" stepKey="dontSeeCategory" after="expandCategoriesToSeeAll"/> - </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" > - <annotations> - <description>Actions to fill out a new category from the product page with specified category and parent category names.</description> - </annotations> - <arguments> - <argument name="categoryName" defaultValue="Test Category" type="string"/> - <argument name="parentCategoryName" defaultValue="default" type="string"/> - </arguments> - - <!-- Click on new Category --> - <click stepKey="clickNewCategory" selector="{{AdminProductCategoryCreationSection.newCategory}}"/> - <waitForPageLoad stepKey="waitForFieldSet"/> - <fillField stepKey="fillCategoryName" selector="{{AdminProductCategoryCreationSection.nameInput}}" userInput="{{categoryName}}"/> - - <!-- Search and select a parent category for the product --> - <click stepKey="clickParentCategory" selector="{{AdminProductCategoryCreationSection.parentCategory}}"/> - <waitForPageLoad stepKey="waitForDropDownVisible"/> - <fillField stepKey="searchForParent" userInput="{{parentCategoryName}}" selector="{{AdminProductCategoryCreationSection.parentSearch}}"/> - <waitForPageLoad stepKey="waitForFieldResults"/> - <click stepKey="clickParent" selector="{{AdminProductCategoryCreationSection.parentSearchResult}}"/> - <click stepKey="createCategory" selector="{{AdminProductCategoryCreationSection.createCategory}}"/> - <waitForPageLoad stepKey="waitForCategoryCreated"/> - </actionGroup> - - <!-- Actions to delete the category last made --> - <actionGroup name="DeleteMostRecentCategory"> - <annotations> - <description>Actions to delete the category last made (the last category on the list).</description> - </annotations> - - <amOnPage url="/{{AdminCategoryPage.url}}" stepKey="goToCategoryFrontPage"/> - <waitForPageLoad stepKey="waitForCategoryPageLoad"/> - <click stepKey="goToCreateCategory" selector="{{AdminCategorySidebarTreeSection.lastCreatedCategory}}"/> - <waitForPageLoad stepKey="waitForCreatedCategoryPageLoad"/> - <click stepKey="clickDeleteCategory" selector="{{AdminCategoryMainActionsSection.DeleteButton}}"/> - <waitForPageLoad stepKey="waitForModalVisible"/> - <click stepKey="clickOkToDelete" selector="{{AdminCategoryModalSection.ok}}"/> - <waitForPageLoad stepKey="waitForModalNotVisible"/> - </actionGroup> - - <!-- Actions to check if a certain category is present on the page --> - <actionGroup name="CategoryPresent" > - <annotations> - <description>Navigates to category page, asserts category is there. Navigates to storefront category page and asserts category is there. This action group will not work categories where name does NOT equal SEO.</description> - </annotations> - <arguments> - <argument name="categoryName" defaultValue="Test Category" type="string"/> - </arguments> - - <amOnPage url="{{AdminCategoryPage.url}}" stepKey="goToCategoryAdminPage"/> - <waitForPageLoad stepKey="waitForCategoryAdminPageLoad"/> - <see userInput="{{categoryName}}" stepKey="assertCategoryOnAdminPage" selector="{{AdminCategorySidebarTreeSection.treeContainer}}"/> - <amOnPage url="/{{categoryName}}.html" stepKey="goToCustomerFrontPage"/> - <see userInput="{{categoryName}}" stepKey="assertCategoryNameOnStorefront" selector="{{StorefrontCategoryMainSection.CategoryTitle}}"/> - <waitForPageLoad stepKey="waitForCustomerCategoryPageLoad"/> - </actionGroup> - - <!--Check that name field is required--> - <actionGroup name="CheckCategoryNameIsRequiredField"> - <annotations> - <description>Navigates to category page, attempts to add subcategory without name. Expects required field prompt.</description> - </annotations> - - <seeInCurrentUrl url="{{AdminCategoryPage.url}}" stepKey="seeOnCategoryPage"/> - <click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategory"/> - <clearField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" stepKey="makeNameFieldEmpty"/> - <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/> - <seeInCurrentUrl url="{{AdminCategoryPage.url}}add" stepKey="seeBackOnCreateCategoryPage"/> - <see selector="{{AdminCategoryBasicFieldSection.FieldError('uid')}}" userInput="This is a required field." stepKey="seeErrorMessage"/> - </actionGroup> - - <actionGroup name="switchCategoryStoreView"> - <annotations> - <description>Navigates to category page, selects a category and changes store view to specified store.</description> - </annotations> - <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="switchCategoryToAllStoreView"> - <annotations> - <description>Navigates to category page, selects a category and changes store view to all stores.</description> - </annotations> - <arguments> - <argument name="CatName"/> - </arguments> - - <click selector="{{AdminCategorySidebarTreeSection.categoryInTree(CatName)}}" stepKey="navigateToCreatedCategory"/> - <waitForPageLoad stepKey="waitForPageLoad1"/> - <waitForLoadingMaskToDisappear stepKey="waitForSpinner1"/> - <scrollToTopOfPage stepKey="scrollToToggle"/> - <click selector="{{AdminCategoryMainActionsSection.CategoryStoreViewDropdownToggle}}" stepKey="openStoreViewDropDown"/> - <click selector="{{AdminCategoryMainActionsSection.allStoreViews}}" stepKey="clickStoreViewByName"/> - <see selector="{{AdminCategoryMainActionsSection.storeSwitcher}}" userInput="All Store Views" stepKey="seeAllStoreView"/> - <waitForPageLoad stepKey="waitForPageLoad2"/> - <waitForLoadingMaskToDisappear stepKey="waitForSpinner2"/> - <click selector="{{AdminCategoryMainActionsSection.CategoryStoreViewModalAccept}}" stepKey="selectStoreViewAccept"/> - <waitForPageLoad stepKey="waitForStoreViewChangeLoad"/> - </actionGroup> - - <actionGroup name="navigateToCreatedCategory"> - <annotations> - <description>Navigates to category page, selects a category by specified category.</description> - </annotations> - <arguments> - <argument name="Category"/> - </arguments> - - <amOnPage url="{{AdminCategoryPage.page}}" stepKey="amOnCategoryPage"/> - <waitForPageLoad stepKey="waitForPageLoad1"/> - <click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="expandAll"/> - <waitForPageLoad stepKey="waitForPageLoad2"/> - <click selector="{{AdminCategorySidebarTreeSection.categoryInTree(Category.Name)}}" stepKey="navigateToCreatedCategory"/> - <waitForLoadingMaskToDisappear stepKey="waitForSpinner"/> - </actionGroup> - - <actionGroup name="ChangeSeoUrlKey"> - <annotations> - <description>Requires navigation to category creation/edit. Updates the Search Engine Optimization.</description> - </annotations> - <arguments> - <argument name="value" type="string"/> - </arguments> - - <click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="openSeoSection"/> - <fillField selector="{{AdminCategorySEOSection.UrlKeyInput}}" userInput="{{value}}" stepKey="enterURLKey"/> - <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/> - <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="assertSuccessMessage"/> - </actionGroup> - - <actionGroup name="ChangeSeoUrlKeyForSubCategory"> - <annotations> - <description>Requires navigation to subcategory creation/edit. Updates the Search Engine Optimization.</description> - </annotations> - <arguments> - <argument name="value" type="string"/> - </arguments> - - <click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="openSeoSection"/> - <uncheckOption selector="{{AdminCategorySEOSection.UrlKeyDefaultValueCheckbox}}" stepKey="uncheckDefaultValue"/> - <fillField selector="{{AdminCategorySEOSection.UrlKeyInput}}" userInput="{{value}}" stepKey="enterURLKey"/> - <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/> - <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="assertSuccessMessage"/> - </actionGroup> - - <actionGroup name="OpenCategoryFromCategoryTree"> - <annotations> - <description>Navigates to category page, selects a category by specified category. Replicates actionGroup:navigateToCreatedCategory.</description> - </annotations> - <arguments> - <argument name="category" type="string"/> - </arguments> - - <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/> - <waitForPageLoad stepKey="waitForCategoryPageToLoad"/> - <click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="clickOnExpandTree"/> - <waitForPageLoad stepKey="waitForCategoryToLoad"/> - <click selector="{{AdminCategorySidebarTreeSection.categoryInTree(category)}}" stepKey="selectCategory"/> - <waitForPageLoad stepKey="waitForPageToLoad"/> - <waitForElementVisible selector="{{AdminCategoryContentSection.categoryPageTitle}}" stepKey="waitForCategoryTitle"/> - </actionGroup> - - <actionGroup name="AdminAssignProductToCategory"> - <annotations> - <description>Navigates to existing product page. Changes the category and saves the product.</description> - </annotations> - <arguments> - <argument name="productId" type="string"/> - <argument name="categoryName" type="string"/> - </arguments> - - <amOnPage url="{{AdminProductEditPage.url(productId)}}" stepKey="amOnPage"/> - <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[{{categoryName}}]" stepKey="selectCategory"/> - <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton"/> - <see selector="{{AdminMessagesSection.success}}" userInput="You saved the product." stepKey="seeSaveProductMessage"/> - </actionGroup> - - <actionGroup name="FillCategoryNameAndUrlKeyAndSave"> - <annotations> - <description>Requires navigation to subcategory creation/edit. Fills the name, and sets the Search Engine Optimization for the category.</description> - </annotations> - <arguments> - <argument name="categoryName" type="string"/> - <argument name="categoryUrlKey" type="string"/> - </arguments> - - <fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{categoryName}}" stepKey="enterCategoryName"/> - <scrollTo selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="scrollToSearchEngineOptimization"/> - <click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="openSEO"/> - <waitForPageLoad stepKey="waitForPageToLoad"/> - <fillField selector="{{AdminCategorySEOSection.UrlKeyInput}}" userInput="{{categoryUrlKey}}" stepKey="enterURLKey"/> - <scrollToTopOfPage stepKey="scrollToTheTopOfPage"/> - <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/> - <waitForPageLoad stepKey="waitForPageToLoad1"/> - </actionGroup> - - <actionGroup name="AdminCategoryAssignProduct"> - <annotations> - <description>Requires navigation to category creation/edit page. Assign products to category - using "Products in Category" tab.</description> - </annotations> - <arguments> - <argument name="productSku" type="string"/> - </arguments> - - <conditionalClick selector="{{AdminCategoryBasicFieldSection.productsInCategory}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="false" stepKey="clickOnProductInCategory"/> - <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickOnResetFilter"/> - <fillField selector="{{AdminCategoryContentSection.productTableColumnSku}}" userInput="{{productSku}}" stepKey="fillSkuFilter"/> - <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickSearchButton"/> - <click selector="{{AdminCategoryContentSection.productTableRow}}" stepKey="selectProductFromTableRow"/> - </actionGroup> - - <actionGroup name="DeleteDefaultCategoryChildren"> - <annotations> - <description>Deletes all children categories of Default Root Category.</description> - </annotations> - - <amOnPage url="{{AdminCategoryPage.url}}" stepKey="navigateToAdminCategoryPage"/> - <executeInSelenium function="function ($webdriver) use ($I) { - $children = $webdriver->findElements(\Facebook\WebDriver\WebDriverBy::xpath('//ul[contains(@class, \'x-tree-node-ct\')]/li[@class=\'x-tree-node\' and contains(., - \'{{DefaultCategory.name}}\')]/ul[contains(@class, \'x-tree-node-ct\')]/li//a')); - while (!empty($children)) { - $I->click('//ul[contains(@class, \'x-tree-node-ct\')]/li[@class=\'x-tree-node\' and contains(., - \'{{DefaultCategory.name}}\')]/ul[contains(@class, \'x-tree-node-ct\')]/li//a'); - $I->waitForPageLoad(30); - $I->click('#delete'); - $I->waitForElementVisible('aside.confirm .modal-footer button.action-accept'); - $I->click('aside.confirm .modal-footer button.action-accept'); - $I->waitForPageLoad(30); - $I->waitForElementVisible('#messages div.message-success', 30); - $I->see('You deleted the category.', '#messages div.message-success'); - $children = $webdriver->findElements(\Facebook\WebDriver\WebDriverBy::xpath('//ul[contains(@class, \'x-tree-node-ct\')]/li[@class=\'x-tree-node\' and contains(., - \'{{DefaultCategory.name}}\')]/ul[contains(@class, \'x-tree-node-ct\')]/li//a')); - } - }" stepKey="deleteAllChildCategories"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCategoryAssignProductActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCategoryAssignProductActionGroup.xml new file mode 100644 index 0000000000000..9dc661ae5ecad --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCategoryAssignProductActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCategoryAssignProductActionGroup"> + <annotations> + <description>Requires navigation to category creation/edit page. Assign products to category - using "Products in Category" tab.</description> + </annotations> + <arguments> + <argument name="productSku" type="string"/> + </arguments> + + <conditionalClick selector="{{AdminCategoryBasicFieldSection.productsInCategory}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="false" stepKey="clickOnProductInCategory"/> + <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickOnResetFilter"/> + <fillField selector="{{AdminCategoryContentSection.productTableColumnSku}}" userInput="{{productSku}}" stepKey="fillSkuFilter"/> + <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickSearchButton"/> + <click selector="{{AdminCategoryContentSection.productTableRow}}" stepKey="selectProductFromTableRow"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductsInGridActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductIsMissingInCategoryProductsGridActionGroup.xml similarity index 61% rename from app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductsInGridActionGroup.xml rename to app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductIsMissingInCategoryProductsGridActionGroup.xml index 440739875c0c1..4b360cde1485a 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductsInGridActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductIsMissingInCategoryProductsGridActionGroup.xml @@ -8,17 +8,10 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AdminCheckProductIsMissingInCategoryProductsGrid"> + <actionGroup name="AdminCheckProductIsMissingInCategoryProductsGridActionGroup"> <arguments> <argument name="productName" type="string"/> </arguments> <dontSee selector="{{AdminCategoryProductsGridSection.nameColumn}}" userInput="{{productName}}" stepKey="dontSeeProduct"/> </actionGroup> - <actionGroup name="AdminCheckProductPositionInCategoryProductsGrid"> - <arguments> - <argument name="position" type="string"/> - <argument name="productName" type="string"/> - </arguments> - <see selector="{{AdminCategoryProductsGridSection.rowProductName(position)}}" userInput="{{productName}}" stepKey="assertProductPosition"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductPositionInCategoryProductsGridActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductPositionInCategoryProductsGridActionGroup.xml new file mode 100644 index 0000000000000..2c0832e0ee877 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductPositionInCategoryProductsGridActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCheckProductPositionInCategoryProductsGridActionGroup"> + <arguments> + <argument name="position" type="string"/> + <argument name="productName" type="string"/> + </arguments> + <see selector="{{AdminCategoryProductsGridSection.rowProductName(position)}}" userInput="{{productName}}" stepKey="assertProductPosition"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminClickOnAdvancedInventoryButtonActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminClickOnAdvancedInventoryButtonActionGroup.xml new file mode 100644 index 0000000000000..33b99cef6d650 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminClickOnAdvancedInventoryButtonActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminClickOnAdvancedInventoryButtonActionGroup"> + <annotations> + <description>Clicks on the 'Advanced Inventory' link on the Admin Product creation/edit page.</description> + </annotations> + + <click selector="{{AdminProductFormSection.advancedInventoryButton}}" stepKey="clickOnAdvancedInventoryLink"/> + <waitForPageLoad stepKey="waitForAdvancedInventoryPageToLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminClickOnAdvancedInventoryLinkActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminClickOnAdvancedInventoryLinkActionGroup.xml index a0cff133cbbed..60438e23e084c 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminClickOnAdvancedInventoryLinkActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminClickOnAdvancedInventoryLinkActionGroup.xml @@ -18,15 +18,4 @@ <click selector="{{AdminProductFormSection.advancedInventoryLink}}" stepKey="clickOnAdvancedInventoryLink"/> <waitForPageLoad stepKey="waitForAdvancedInventoryPageToLoad"/> </actionGroup> - - <!-- ActionGroup click on Advanced Inventory Button in product form; - You must already be on the product form page --> - <actionGroup name="AdminClickOnAdvancedInventoryButtonActionGroup"> - <annotations> - <description>Clicks on the 'Advanced Inventory' link on the Admin Product creation/edit page.</description> - </annotations> - - <click selector="{{AdminProductFormSection.advancedInventoryButton}}" stepKey="clickOnAdvancedInventoryLink"/> - <waitForPageLoad stepKey="waitForAdvancedInventoryPageToLoad"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateAttributeFromProductPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateAttributeFromProductPageActionGroup.xml new file mode 100644 index 0000000000000..ae8e8a84149e1 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateAttributeFromProductPageActionGroup.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateAttributeFromProductPageActionGroup"> + <annotations> + <description>From the Product creation/edit page, under 'Configurations', Clicks on 'Create Configurations'. Clicks on 'Create New Attribute'. Fills Label. Selects Type. Clicks on Save.</description> + </annotations> + <arguments> + <argument name="attributeName" type="string"/> + <argument name="attributeType" type="string" defaultValue="TextField"/> + </arguments> + + <click selector="{{AdminProductFormSection.addAttributeBtn}}" stepKey="clickAddAttributeBtn"/> + <see userInput="Select Attribute" stepKey="checkNewAttributePopUpAppeared"/> + <click selector="{{AdminProductFormAttributeSection.createNewAttribute}}" stepKey="clickCreateNewAttribute"/> + <fillField selector="{{AdminProductFormNewAttributeSection.attributeLabel}}" userInput="{{attributeName}}" stepKey="fillAttributeLabel"/> + <selectOption selector="{{AdminProductFormNewAttributeSection.attributeType}}" userInput="{{attributeType}}" stepKey="selectAttributeType"/> + <click selector="{{AdminProductFormNewAttributeSection.saveAttribute}}" stepKey="saveAttribute"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateAttributeFromProductPageWithScopeActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateAttributeFromProductPageWithScopeActionGroup.xml new file mode 100644 index 0000000000000..2ee84fcb24b68 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateAttributeFromProductPageWithScopeActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateAttributeFromProductPageWithScopeActionGroup" extends="AdminCreateAttributeFromProductPageActionGroup" insertAfter="selectAttributeType"> + <arguments> + <argument name="scope" type="string" defaultValue="Store View"/> + </arguments> + <conditionalClick selector="{{AdminProductFormNewAttributeAdvancedSection.sectionHeader}}" dependentSelector="{{AdminProductFormNewAttributeAdvancedSection.scope}}" visible="false" stepKey="openAttributeAdvancedSection"/> + <selectOption selector="{{AdminProductFormNewAttributeAdvancedSection.scope}}" userInput="{{scope}}" stepKey="selectScope"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateAttributeWithSearchWeightActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateAttributeWithSearchWeightActionGroup.xml new file mode 100644 index 0000000000000..2ca4c9b616862 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateAttributeWithSearchWeightActionGroup.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateAttributeWithSearchWeightActionGroup" extends="AdminProductPageCreateAttributeSetWithAttributeActionGroup" insertAfter="selectAttributeType"> + <annotations> + <description>EXTENDS: AdminProductPageCreateAttributeSetWithAttribute. Sets the provided Search Weight and Default Values.</description> + </annotations> + <arguments> + <argument name="weight" type="string" defaultValue="1"/> + <argument name="defaultValue" type="string" defaultValue="default"/> + </arguments> + + <click selector="{{AdminProductFormNewAttributeAdvancedSection.sectionHeader}}" stepKey="openAdvancedSection"/> + <fillField selector="{{AdminProductFormNewAttributeAdvancedSection.defaultValue}}" userInput="{{defaultValue}}" stepKey="inputDefault"/> + <click selector="{{AdminProductFormNewAttributeStorefrontSection.sectionHeader}}" stepKey="openStorefrontSection"/> + <checkOption selector="{{AdminProductFormNewAttributeStorefrontSection.useInSearch}}" stepKey="checkUseInSearch"/> + <waitForElementVisible selector="{{AdminProductFormNewAttributeStorefrontSection.searchWeight}}" stepKey="waitForSearchWeight"/> + <selectOption selector="{{AdminProductFormNewAttributeStorefrontSection.searchWeight}}" userInput="{{weight}}" stepKey="selectWeight"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateAttributeWithValueWithTwoStoreViesFromProductPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateAttributeWithValueWithTwoStoreViesFromProductPageActionGroup.xml new file mode 100644 index 0000000000000..ec02df1fbf327 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateAttributeWithValueWithTwoStoreViesFromProductPageActionGroup.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateAttributeWithValueWithTwoStoreViesFromProductPageActionGroup" extends="AdminCreateAttributeFromProductPageActionGroup"> + <remove keyForRemoval="saveAttribute"/> + <annotations> + <description>EXTENDS: AdminCreateAttributeFromProductPage. Adds the 2 provided Store Views to a Product. Clicks on Save.</description> + </annotations> + <arguments> + <argument name="firstStoreViewName" type="string"/> + <argument name="secondStoreViewName" type="string"/> + </arguments> + + <click selector="{{AdminProductFormNewAttributeSection.addValue}}" stepKey="addValue" after="selectAttributeType"/> + <seeElement selector="{{AdminProductFormNewAttributeSection.optionViewName(firstStoreViewName))}}" stepKey="seeFirstStoreView"/> + <seeElement selector="{{AdminProductFormNewAttributeSection.optionViewName(firstStoreViewName))}}" stepKey="seeSecondStoreView"/> + <fillField selector="{{AdminProductFormNewAttributeSection.optionValue('1'))}}" userInput="default" stepKey="fillDefaultStoreView"/> + <fillField selector="{{AdminProductFormNewAttributeSection.optionValue('2'))}}" userInput="admin" stepKey="fillAdminStoreView"/> + <fillField selector="{{AdminProductFormNewAttributeSection.optionValue('3'))}}" userInput="view1" stepKey="fillFirstStoreView"/> + <fillField selector="{{AdminProductFormNewAttributeSection.optionValue('4'))}}" userInput="view2" stepKey="fillSecondStoreView"/> + + <!--Check store view in Manage Titles section--> + <click selector="{{AdminProductFormNewAttributeSection.manageTitlesHeader}}" stepKey="openManageTitlesSection"/> + <seeElement selector="{{AdminProductFormNewAttributeSection.manageTitlesViewName(customStoreEN.name)}}" stepKey="seeFirstStoreViewName"/> + <seeElement selector="{{AdminProductFormNewAttributeSection.manageTitlesViewName(customStoreFR.name)}}" stepKey="seeSecondStoreViewName"/> + <click selector="{{AdminProductFormNewAttributeSection.saveAttribute}}" stepKey="saveAttribute1"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateWidgetActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateCatalogProductWidgetActionGroup.xml similarity index 64% rename from app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateWidgetActionGroup.xml rename to app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateCatalogProductWidgetActionGroup.xml index f3ebbc6370f87..1b9b9d60b36e2 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateWidgetActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateCatalogProductWidgetActionGroup.xml @@ -8,18 +8,6 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AdminCreateRecentlyProductsWidgetActionGroup" extends="AdminCreateWidgetActionGroup"> - <annotations> - <description>EXTENDS: AdminCreateWidgetActionGroup. Adds Product Attributes/Buttons to a Widget. Clicks on the Save button.</description> - </annotations> - - <selectOption selector="{{AdminCatalogProductWidgetSection.productAttributesToShow}}" parameterArray="['Name', 'Image', 'Price']" stepKey="selectAllProductAttributes"/> - <selectOption selector="{{AdminCatalogProductWidgetSection.productButtonsToShow}}" parameterArray="['Add to Cart', 'Add to Compare', 'Add to Wishlist']" stepKey="selectAllProductButtons"/> - <click selector="{{AdminMainActionsSection.save}}" stepKey="clickSaveWidget"/> - <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForSuccessMessageAppears"/> - <see selector="{{AdminMessagesSection.success}}" userInput="The widget instance has been saved" stepKey="seeSuccess"/> - </actionGroup> - <actionGroup name="AdminCreateCatalogProductWidgetActionGroup" extends="AdminCreateWidgetActionGroup"> <annotations> <description>EXTENDS: AdminCreateWidgetActionGroup. Creates Catalog Category Link Widget.</description> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateRecentlyProductsWidgetActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateRecentlyProductsWidgetActionGroup.xml new file mode 100644 index 0000000000000..e22620790ef70 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateRecentlyProductsWidgetActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateRecentlyProductsWidgetActionGroup" extends="AdminCreateWidgetActionGroup"> + <annotations> + <description>EXTENDS: AdminCreateWidgetActionGroup. Adds Product Attributes/Buttons to a Widget. Clicks on the Save button.</description> + </annotations> + + <selectOption selector="{{AdminCatalogProductWidgetSection.productAttributesToShow}}" parameterArray="['Name', 'Image', 'Price']" stepKey="selectAllProductAttributes"/> + <selectOption selector="{{AdminCatalogProductWidgetSection.productButtonsToShow}}" parameterArray="['Add to Cart', 'Add to Compare', 'Add to Wishlist']" stepKey="selectAllProductButtons"/> + <click selector="{{AdminMainActionsSection.save}}" stepKey="clickSaveWidget"/> + <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForSuccessMessageAppears"/> + <see selector="{{AdminMessagesSection.success}}" userInput="The widget instance has been saved" stepKey="seeSuccess"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateSearchableProductAttributeActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateSearchableProductAttributeActionGroup.xml new file mode 100644 index 0000000000000..1e1418b3e0e75 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateSearchableProductAttributeActionGroup.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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateSearchableProductAttributeActionGroup" extends="CreateProductAttributeActionGroup" insertAfter="checkRequired"> + <click selector="{{StorefrontPropertiesSection.StoreFrontPropertiesTab}}" stepKey="goToStorefrontPropertiesTab"/> + <waitForElementVisible selector="{{StorefrontPropertiesSection.PageTitle}}" stepKey="waitTabLoad"/> + <selectOption selector="{{AdvancedAttributePropertiesSection.UseInSearch}}" userInput="Yes" stepKey="setSearchable"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateSimpleProductWithTextOptionCharLimitActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateSimpleProductWithTextOptionCharLimitActionGroup.xml new file mode 100644 index 0000000000000..66620e3d9dd07 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCreateSimpleProductWithTextOptionCharLimitActionGroup.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateSimpleProductWithTextOptionCharLimitActionGroup"> + <annotations> + <description>Goes to the Admin Product grid page. Clicks on Add. Fills the provided Product details (Name, SKU, Price, Quantity, Category and URL). Adds a Text Product Option with the provided Char Limits. Clicks on Save. Validates that the Product details are present and correct.</description> + </annotations> + <arguments> + <argument name="category"/> + <argument name="simpleProduct"/> + <argument name="charLimit"/> + </arguments> + + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> + <click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductDropdown"/> + <click selector="{{AdminProductGridActionSection.addSimpleProduct}}" stepKey="clickAddSimpleProduct"/> + <fillField userInput="{{simpleProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="fillName"/> + <fillField userInput="{{simpleProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="fillSKU"/> + <fillField userInput="{{simpleProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="fillPrice"/> + <fillField userInput="{{simpleProduct.quantity}}" selector="{{AdminProductFormSection.productQuantity}}" stepKey="fillQuantity"/> + <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[{{category.name}}]" stepKey="searchAndSelectCategory"/> + <click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/> + <fillField userInput="{{simpleProduct.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/> + + <click selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" stepKey="openCustomOptionsSection"/> + <click selector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" stepKey="clickAddOption"/> + <fillField selector="{{AdminProductCustomizableOptionsSection.optionTitleInput('0')}}" userInput="option1" stepKey="fillOptionTitle"/> + <click selector="{{AdminProductCustomizableOptionsSection.optionTypeOpenDropDown}}" stepKey="openTypeDropDown"/> + <click selector="{{AdminProductCustomizableOptionsSection.optionTypeTextField}}" stepKey="selectTypeTextField"/> + <fillField userInput="20" selector="{{AdminProductCustomizableOptionsSection.maxCharactersInput}}" stepKey="fillMaxChars"/> + + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct"/> + <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="assertSaveMessageSuccess"/> + <seeInField userInput="{{simpleProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="assertFieldName"/> + <seeInField userInput="{{simpleProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="assertFieldSku"/> + <seeInField userInput="{{simpleProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="assertFieldPrice"/> + <click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSectionAssert"/> + <seeInField userInput="{{simpleProduct.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="assertFieldUrlKey"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminDeleteAllProductCustomOptionsActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminDeleteAllProductCustomOptionsActionGroup.xml new file mode 100644 index 0000000000000..103c25b2c6f50 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminDeleteAllProductCustomOptionsActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminDeleteAllProductCustomOptionsActionGroup"> + <conditionalClick selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.checkIfCustomizableOptionsTabOpen}}" visible="true" stepKey="expandContentTab"/> + <waitForPageLoad time="10" stepKey="waitCustomizableOptionsTabOpened"/> + <executeInSelenium function="function($webdriver) use ($I) { + $buttons = $webdriver->findElements(\Facebook\WebDriver\WebDriverBy::cssSelector('[data-index=\'options\'] [data-index=\'delete_button\']')); + while(!empty($buttons)) { + $button = reset($buttons); + $I->executeJS('arguments[0].scrollIntoView(false)', [$button]); + $button->click(); + $webdriver->wait()->until(\Facebook\WebDriver\WebDriverExpectedCondition::stalenessOf($button)); + $buttons = $webdriver->findElements(\Facebook\WebDriver\WebDriverBy::cssSelector('[data-index=\'options\'] [data-index=\'delete_button\']')); + } + }" stepKey="deleteCustomOptions"/> + <dontSeeElement selector="{{AdminProductCustomizableOptionsSection.customOptionButtonDelete}}" stepKey="assertNoCustomOptions"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminDeleteCategoryByNameActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminDeleteCategoryByNameActionGroup.xml new file mode 100644 index 0000000000000..de7f569074ac3 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminDeleteCategoryByNameActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminDeleteCategoryByNameActionGroup" extends="DeleteCategoryActionGroup"> + <arguments> + <argument name="categoryName" type="string" defaultValue="category1"/> + </arguments> + <remove keyForRemoval="clickCategoryLink"/> + <remove keyForRemoval="dontSeeCategoryInTree"/> + <remove keyForRemoval="expandToSeeAllCategories"/> + <conditionalClick selector="{{AdminCategorySidebarTreeSection.expandAll}}" dependentSelector="{{AdminCategorySidebarTreeSection.categoryByName(categoryName)}}" visible="false" stepKey="expandCategories" after="waitForCategoryPageLoad"/> + <click selector="{{AdminCategorySidebarTreeSection.categoryByName(categoryName)}}" stepKey="clickCategory" after="expandCategories"/> + <conditionalClick selector="{{AdminCategorySidebarTreeSection.expandAll}}" dependentSelector="{{AdminCategorySidebarTreeSection.categoryByName(categoryName)}}" visible="false" stepKey="expandCategoriesToSeeAll" after="seeDeleteSuccess"/> + <dontSee selector="{{AdminCategorySidebarTreeSection.categoryByName(categoryName)}}" stepKey="dontSeeCategory" after="expandCategoriesToSeeAll"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminDeleteProductCustomOptionActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminDeleteProductCustomOptionActionGroup.xml new file mode 100644 index 0000000000000..22c4ef6a7d568 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminDeleteProductCustomOptionActionGroup.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminDeleteProductCustomOptionActionGroup" extends="AdminAssertProductCustomOptionVisibleActionGroup"> + <remove keyForRemoval="assertCustomOptionVisible"/> + <click selector="{{AdminProductCustomizableOptionsSection.deleteCustomOptions(option.title)}}" after="waitCustomizableOptionsTabOpened" stepKey="clickDeleteCustomOption"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminFillProductAttributePropertiesActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminFillProductAttributePropertiesActionGroup.xml index ec73001976dc6..cd850f8a7004d 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminFillProductAttributePropertiesActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminFillProductAttributePropertiesActionGroup.xml @@ -15,16 +15,4 @@ <fillField selector="{{AttributePropertiesSection.DefaultLabel}}" userInput="{{attributeName}}" stepKey="fillDefaultLabel"/> <selectOption selector="{{AttributePropertiesSection.InputType}}" userInput="{{attributeType}}" stepKey="selectInputType"/> </actionGroup> - - <!--You are on AdminProductEditPage--> - <!-- Switch scope for product attribute--> - <!-- !Note! Scope : 0 - Store View; 1 - Global; 2 - Website; --> - <actionGroup name="AdminSwitchScopeForProductAttributeActionGroup"> - <arguments> - <argument name="scope" type="string" defaultValue="1"/> - </arguments> - <click selector="{{AttributePropertiesSection.AdvancedProperties}}" stepKey="expandAdvancedProperties"/> - <waitForElementVisible selector="{{AttributePropertiesSection.Scope}}" stepKey="waitOpenAdvancedProperties"/> - <selectOption selector="{{AttributePropertiesSection.Scope}}" userInput="1" stepKey="selectNecessaryScope"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminFillProductCountryOfManufactureActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminFillProductCountryOfManufactureActionGroup.xml new file mode 100644 index 0000000000000..7642bb5f6635d --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminFillProductCountryOfManufactureActionGroup.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminFillProductCountryOfManufactureActionGroup"> + <arguments> + <argument name="countryId" type="string" defaultValue="US"/> + </arguments> + <selectOption selector="{{AdminProductFormBundleSection.countryOfManufactureDropDown}}" userInput="{{countryId}}" stepKey="countryOfManufactureDropDown"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProcessProductWebsitesActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProcessProductWebsitesActionGroup.xml new file mode 100644 index 0000000000000..fbd49224231f3 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProcessProductWebsitesActionGroup.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminProcessProductWebsitesActionGroup" extends="CreatedProductConnectToWebsiteActionGroup"> + <arguments> + <argument name="websiteToUnassign"/> + </arguments> + <uncheckOption selector="{{ProductInWebsitesSection.website(websiteToUnassign.name)}}" after="SelectWebsite" stepKey="uncheckWebsite"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml deleted file mode 100644 index 428b3828901cd..0000000000000 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml +++ /dev/null @@ -1,759 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <!--Navigate to create product page from product grid page--> - <actionGroup name="goToCreateProductPage"> - <annotations> - <description>Clicks on the 'Add Product' toggle on the Admin Products grid page. Clicks on the provided Product (Type).</description> - </annotations> - <arguments> - <argument name="product" defaultValue="_defaultProduct"/> - </arguments> - - <click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductToggle"/> - <waitForElementVisible selector="{{AdminProductGridActionSection.addTypeProduct(product.type_id)}}" stepKey="waitForAddProductDropdown" time="30"/> - <click selector="{{AdminProductGridActionSection.addTypeProduct(product.type_id)}}" stepKey="clickAddProductType"/> - <waitForPageLoad time="30" stepKey="waitForCreateProductPageLoad"/> - <seeInCurrentUrl url="{{AdminProductCreatePage.url(AddToDefaultSet.attributeSetId, product.type_id)}}" stepKey="seeNewProductUrl"/> - <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Product" stepKey="seeNewProductTitle"/> - </actionGroup> - - <!--Navigate to create product page directly via ID--> - <actionGroup name="goToProductPageViaID"> - <annotations> - <description>Goes to the Product edit page for the provided Product ID.</description> - </annotations> - <arguments> - <argument name="productId" type="string"/> - </arguments> - - <amOnPage url="{{AdminProductEditPage.url(productId)}}" stepKey="goToProduct"/> - </actionGroup> - - <!-- Fill main fields in create product form using a product entity --> - <actionGroup name="fillMainProductForm"> - <annotations> - <description>Fills in the provided Product details (Name, SKU, Price, Quantity, Stock Status, Weight Type and Weight) on the Admin Products creation/edit page.</description> - </annotations> - <arguments> - <argument name="product" defaultValue="_defaultProduct"/> - </arguments> - - <scrollToTopOfPage stepKey="scrollToTopOfPage"/> - <fillField selector="{{AdminProductFormSection.productName}}" userInput="{{product.name}}" stepKey="fillProductName"/> - <fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="fillProductSku"/> - <fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{product.price}}" stepKey="fillProductPrice"/> - <fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="{{product.quantity}}" stepKey="fillProductQty"/> - <selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="{{product.status}}" stepKey="selectStockStatus"/> - <selectOption selector="{{AdminProductFormSection.productWeightSelect}}" userInput="This item has weight" stepKey="selectWeight"/> - <fillField selector="{{AdminProductFormSection.productWeight}}" userInput="{{product.weight}}" stepKey="fillProductWeight"/> - </actionGroup> - - <!-- Fill main fields in create product form using strings for flexibility --> - <actionGroup name="FillMainProductFormByString"> - <annotations> - <description>Fills in the provided Product Name, SKU, Price, Quantity, Stock Status and Weight on the Admin Products creation/edit page.</description> - </annotations> - <arguments> - <argument name="productName" type="string"/> - <argument name="productSku" type="string"/> - <argument name="productPrice" type="string"/> - <argument name="productQuantity" type="string"/> - <argument name="productStatus" type="string"/> - <argument name="productWeight" type="string"/> - </arguments> - - <fillField selector="{{AdminProductFormSection.productName}}" userInput="{{productName}}" stepKey="fillProductName"/> - <fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{productSku}}" stepKey="fillProductSku"/> - <fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{productPrice}}" stepKey="fillProductPrice"/> - <fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="{{productQuantity}}" stepKey="fillProductQty"/> - <selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="{{productStatus}}" stepKey="selectStockStatus"/> - <selectOption selector="{{AdminProductFormSection.productWeightSelect}}" userInput="This item has weight" stepKey="selectWeight"/> - <fillField selector="{{AdminProductFormSection.productWeight}}" userInput="{{productWeight}}" stepKey="fillProductWeight"/> - </actionGroup> - - <!--Fill main fields in create product form with no weight, useful for virtual and downloadable products --> - <actionGroup name="fillMainProductFormNoWeight"> - <annotations> - <description>Fills in the provided Product details (Name, SKU, Price, Quantity, Stock Status and Weight Type) on the Admin Products creation/edit page.</description> - </annotations> - <arguments> - <argument name="product" defaultValue="DownloadableProduct"/> - </arguments> - - <fillField selector="{{AdminProductFormSection.productName}}" userInput="{{product.name}}" stepKey="fillProductName"/> - <fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="fillProductSku"/> - <fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{product.price}}" stepKey="fillProductPrice"/> - <fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="{{product.quantity}}" stepKey="fillProductQty"/> - <selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="{{product.status}}" stepKey="selectStockStatus"/> - <selectOption selector="{{AdminProductFormSection.productWeightSelect}}" userInput="This item has no weight" stepKey="selectWeight"/> - </actionGroup> - - <!--Fill main fields in create product form with name and sku --> - <actionGroup name="fillProductNameAndSkuInProductForm"> - <annotations> - <description>Fills in the provided Product details (Name and SKU) on the Admin Products creation and edit page.</description> - </annotations> - <arguments> - <argument name="product"/> - </arguments> - - <fillField selector="{{AdminProductFormSection.productName}}" userInput="{{product.name}}" stepKey="fillProductName"/> - <fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="fillProductSku"/> - </actionGroup> - <actionGroup name="AdminFillProductCountryOfManufactureActionGroup"> - <arguments> - <argument name="countryId" type="string" defaultValue="US"/> - </arguments> - <selectOption selector="{{AdminProductFormBundleSection.countryOfManufactureDropDown}}" userInput="{{countryId}}" stepKey="countryOfManufactureDropDown"/> - </actionGroup> - - <!--Check that required fields are actually required--> - <actionGroup name="checkRequiredFieldsInProductForm"> - <annotations> - <description>Validates that the 'Required Field' error message is present and correct for the Product Name, SKU and Price fields.</description> - </annotations> - - <clearField selector="{{AdminProductFormSection.productName}}" stepKey="clearProductName"/> - <clearField selector="{{AdminProductFormSection.productSku}}" stepKey="clearProductSku"/> - <clearField selector="{{AdminProductFormSection.productPrice}}" stepKey="clearProductPrice"/> - <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveButton"/> - <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Product" stepKey="seeStillOnEditPage"/> - <see selector="{{AdminProductFormSection.fieldError('name')}}" userInput="This is a required field." stepKey="seeNameRequired"/> - <see selector="{{AdminProductFormSection.fieldError('sku')}}" userInput="This is a required field." stepKey="seeSkuRequired"/> - <see selector="{{AdminProductFormSection.priceFieldError}}" userInput="This is a required field." stepKey="seePriceRequired"/> - </actionGroup> - - <!--Save product and see success message--> - <actionGroup name="saveProductForm"> - <annotations> - <description>Clicks on the Save button. Validates that the Success Message is present and correct.</description> - </annotations> - - <scrollToTopOfPage stepKey="scrollTopPageProduct"/> - <waitForElementVisible selector="{{AdminProductFormActionSection.saveButton}}" stepKey="waitForSaveProductButton"/> - <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveProduct"/> - <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitProductSaveSuccessMessage"/> - <see selector="{{AdminMessagesSection.success}}" userInput="You saved the product." stepKey="seeSaveConfirmation"/> - </actionGroup> - - <actionGroup name="toggleProductEnabled"> - <annotations> - <description>Clicks on the Enable Product toggle.</description> - </annotations> - - <click selector="{{AdminProductFormSection.enableProductLabel}}" stepKey="toggleEnabled"/> - </actionGroup> - - <!-- Save product but do not expect a success message --> - <actionGroup name="SaveProductFormNoSuccessCheck" extends="saveProductForm"> - <annotations> - <description>EXTENDS: saveProductForm. Removes 'waitProductSaveSuccessMessage' and 'seeSaveConfirmation'.</description> - </annotations> - - <remove keyForRemoval="waitProductSaveSuccessMessage"/> - <remove keyForRemoval="seeSaveConfirmation"/> - </actionGroup> - - <!--Upload image for product--> - <actionGroup name="addProductImage"> - <annotations> - <description>Adds the provided Product Image on the Admin Products creation/edit page.</description> - </annotations> - <arguments> - <argument name="image" defaultValue="ProductImage"/> - </arguments> - - <conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductImagesSection"/> - <waitForPageLoad time="30" stepKey="waitForPageRefresh"/> - <waitForElementVisible selector="{{AdminProductImagesSection.imageUploadButton}}" stepKey="seeImageSectionIsReady"/> - <attachFile selector="{{AdminProductImagesSection.imageFileUpload}}" userInput="{{image.file}}" stepKey="uploadFile"/> - <waitForElementNotVisible selector="{{AdminProductImagesSection.uploadProgressBar}}" stepKey="waitForUpload"/> - <waitForElementVisible selector="{{AdminProductImagesSection.imageFile(image.fileName)}}" stepKey="waitForThumbnail"/> - </actionGroup> - - <!--Remove image for product--> - <actionGroup name="removeProductImage"> - <annotations> - <description>Removes a Product Image on the Admin Products creation/edit page.</description> - </annotations> - - <conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductImagesSection"/> - <waitForPageLoad time="30" stepKey="waitForPageRefresh"/> - <click selector="{{AdminProductImagesSection.removeImageButton}}" stepKey="clickRemoveImage"/> - </actionGroup> - - <!--Remove Product image by name--> - <actionGroup name="RemoveProductImageByName" extends="removeProductImage"> - <annotations> - <description>Removes a Product Image on the Admin Products creation/edit page by name.</description> - </annotations> - - <arguments> - <argument name="image" defaultValue="ProductImage"/> - </arguments> - <click selector="{{AdminProductImagesSection.removeImageButtonForExactImage(image.fileName)}}" stepKey="clickRemoveImage"/> - </actionGroup> - - <!-- Assert product image in Admin Product page --> - <actionGroup name="assertProductImageAdminProductPage"> - <annotations> - <description>Validates that the provided Product Image is present and correct.</description> - </annotations> - <arguments> - <argument name="image" defaultValue="MagentoLogo"/> - </arguments> - - <conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductImagesSection"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <seeElement selector="{{AdminProductImagesSection.imageFile(image.filename)}}" stepKey="seeImage"/> - </actionGroup> - - <!-- Assert no product image in Admin Product page --> - <actionGroup name="assertProductImageNotInAdminProductPage"> - <annotations> - <description>Validates that the provided Product Image is NOT present.</description> - </annotations> - <arguments> - <argument name="image" defaultValue="MagentoLogo"/> - </arguments> - - <conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductImagesSection"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <dontSeeElement selector="{{AdminProductImagesSection.imageFile(image.filename)}}" stepKey="seeImage"/> - </actionGroup> - - <!--Fill fields for simple product in a category in Admin--> - <actionGroup name="FillAdminSimpleProductForm"> - <annotations> - <description>Goes to the Admin Product grid page. Clicks on Add. Fills the provided Product details (Name, SKU, Price, Quantity, Category and URL). Clicks on Save. Validates that the Product details are present and correct.</description> - </annotations> - <arguments> - <argument name="category"/> - <argument name="simpleProduct"/> - </arguments> - - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> - <click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductDropdown"/> - <click selector="{{AdminProductGridActionSection.addSimpleProduct}}" stepKey="clickAddSimpleProduct"/> - <fillField userInput="{{simpleProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="fillName"/> - <fillField userInput="{{simpleProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="fillSKU"/> - <fillField userInput="{{simpleProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="fillPrice"/> - <fillField userInput="{{simpleProduct.quantity}}" selector="{{AdminProductFormSection.productQuantity}}" stepKey="fillQuantity"/> - <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[{{category.name}}]" stepKey="searchAndSelectCategory"/> - <click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/> - <fillField userInput="{{simpleProduct.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/> - <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct"/> - <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="assertSaveMessageSuccess"/> - <seeInField userInput="{{simpleProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="assertFieldName"/> - <seeInField userInput="{{simpleProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="assertFieldSku"/> - <seeInField userInput="{{simpleProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="assertFieldPrice"/> - <click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSectionAssert"/> - <seeInField userInput="{{simpleProduct.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="assertFieldUrlKey"/> - </actionGroup> - - <!--Fill fields for simple product in a category in Admin, including text option with char limit--> - <actionGroup name="AdminCreateSimpleProductWithTextOptionCharLimit"> - <annotations> - <description>Goes to the Admin Product grid page. Clicks on Add. Fills the provided Product details (Name, SKU, Price, Quantity, Category and URL). Adds a Text Product Option with the provided Char Limits. Clicks on Save. Validates that the Product details are present and correct.</description> - </annotations> - <arguments> - <argument name="category"/> - <argument name="simpleProduct"/> - <argument name="charLimit"/> - </arguments> - - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> - <click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductDropdown"/> - <click selector="{{AdminProductGridActionSection.addSimpleProduct}}" stepKey="clickAddSimpleProduct"/> - <fillField userInput="{{simpleProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="fillName"/> - <fillField userInput="{{simpleProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="fillSKU"/> - <fillField userInput="{{simpleProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="fillPrice"/> - <fillField userInput="{{simpleProduct.quantity}}" selector="{{AdminProductFormSection.productQuantity}}" stepKey="fillQuantity"/> - <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[{{category.name}}]" stepKey="searchAndSelectCategory"/> - <click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/> - <fillField userInput="{{simpleProduct.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/> - - <click selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" stepKey="openCustomOptionsSection"/> - <click selector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" stepKey="clickAddOption"/> - <fillField selector="{{AdminProductCustomizableOptionsSection.optionTitleInput('0')}}" userInput="option1" stepKey="fillOptionTitle"/> - <click selector="{{AdminProductCustomizableOptionsSection.optionTypeOpenDropDown}}" stepKey="openTypeDropDown"/> - <click selector="{{AdminProductCustomizableOptionsSection.optionTypeTextField}}" stepKey="selectTypeTextField"/> - <fillField userInput="20" selector="{{AdminProductCustomizableOptionsSection.maxCharactersInput}}" stepKey="fillMaxChars"/> - - <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct"/> - <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="assertSaveMessageSuccess"/> - <seeInField userInput="{{simpleProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="assertFieldName"/> - <seeInField userInput="{{simpleProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="assertFieldSku"/> - <seeInField userInput="{{simpleProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="assertFieldPrice"/> - <click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSectionAssert"/> - <seeInField userInput="{{simpleProduct.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="assertFieldUrlKey"/> - </actionGroup> - - <actionGroup name="ProductSetWebsite"> - <annotations> - <description>Sets the provided Website on the Admin Product creation/edit page.</description> - </annotations> - <arguments> - <argument name="website" type="string"/> - </arguments> - - <scrollTo selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="scrollToWebsites"/> - <conditionalClick selector="{{ProductInWebsitesSection.sectionHeader}}" dependentSelector="{{ProductInWebsitesSection.website(website)}}" visible="false" stepKey="clickToOpenProductInWebsite"/> - <waitForPageLoad stepKey="waitForPageOpened"/> - <click selector="{{ProductInWebsitesSection.website(website)}}" stepKey="selectWebsite"/> - <click selector="{{AdminProductFormAdvancedPricingSection.save}}" stepKey="clickSaveProduct"/> - <waitForPageLoad time='60' stepKey="waitForProducrSaved"/> - <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForSaveSuccessMessage"/> - <see selector="{{AdminMessagesSection.success}}" userInput="You saved the product." stepKey="seeSaveSuccessMessage"/> - </actionGroup> - - <actionGroup name="ProductSetAdvancedPricing"> - <annotations> - <description>Sets the provided Advanced Pricing on the Admin Product creation/edit page.</description> - </annotations> - <arguments> - <argument name="website" type="string" defaultValue=""/> - <argument name="group" type="string" defaultValue="Retailer"/> - <argument name="quantity" type="string" defaultValue="1"/> - <argument name="price" type="string" defaultValue="Discount"/> - <argument name="amount" type="string" defaultValue="45"/> - </arguments> - - <click selector="{{AdminProductFormSection.advancedPricingLink}}" stepKey="clickOnAdvancedPricingButton"/> - <waitForElement selector="{{AdminProductFormAdvancedPricingSection.customerGroupPriceAddButton}}" stepKey="waitForCustomerGroupPriceAddButton"/> - <click selector="{{AdminProductFormAdvancedPricingSection.customerGroupPriceAddButton}}" stepKey="addCustomerGroupAllGroupsQty1PriceDiscountAnd10percent"/> - <waitForElement selector="{{AdminProductFormAdvancedPricingSection.productTierPriceCustGroupSelect('0')}}" stepKey="waitForSelectCustomerGroupNameAttribute2"/> - <selectOption selector="{{AdminProductFormAdvancedPricingSection.productTierPriceWebsiteSelect('0')}}" userInput="{{website}}" stepKey="selectProductWebsiteValue"/> - <selectOption selector="{{AdminProductFormAdvancedPricingSection.productTierPriceCustGroupSelect('0')}}" userInput="{{group}}" stepKey="selectProductCustomGroupValue"/> - <fillField selector="{{AdminProductFormAdvancedPricingSection.productTierPriceQtyInput('0')}}" userInput="{{quantity}}" stepKey="fillProductTierPriceQtyInput"/> - <selectOption selector="{{AdminProductFormAdvancedPricingSection.productTierPriceValueTypeSelect('0')}}" userInput="{{price}}" stepKey="selectProductTierPriceValueType"/> - <fillField selector="{{AdminProductFormAdvancedPricingSection.productTierPricePercentageValuePriceInput('0')}}" userInput="{{amount}}" stepKey="selectProductTierPricePriceInput"/> - <click selector="{{AdminProductFormAdvancedPricingSection.doneButton}}" stepKey="clickDoneButton"/> - <waitForPageLoad stepKey="WaitForProductSave"/> - <click selector="{{AdminProductFormAdvancedPricingSection.save}}" stepKey="clickSaveProduct1"/> - <waitForPageLoad time="60" stepKey="WaitForProductSave1"/> - <see userInput="You saved the product." stepKey="seeSaveConfirmation"/> - </actionGroup> - <actionGroup name="ProductSetAdvancedTierFixedPricing" extends="ProductSetAdvancedPricing"> - <remove keyForRemoval="selectProductTierPricePriceInput"/> - <fillField selector="{{AdminProductFormAdvancedPricingSection.productTierPriceFixedPriceInput('0')}}" userInput="{{amount}}" stepKey="selectProductTierPricePriceInput" after="selectProductTierPriceValueType"/> - </actionGroup> - - <!--Assert text in Related, Up-Sell or Cross-Sell section in Admin Product page--> - <actionGroup name="AssertTextInAdminProductRelatedUpSellCrossSellSection"> - <annotations> - <description>Validates that provided Text appears in the provided Element on the Admin Product creation/edit page under 'Related Products, Up-Sells, and Cross-Sells' section.</description> - </annotations> - <arguments> - <argument name="element" defaultValue="AdminProductFormRelatedUpSellCrossSellSection.relatedProductSectionText"/> - <argument name="expectedText"/> - </arguments> - - <conditionalClick selector="{{AdminProductFormSection.productFormTab('Related Products')}}" dependentSelector="{{AdminProductFormSection.productFormTabState('Related Products', 'closed')}}" visible="true" stepKey="openTab"/> - <waitForPageLoad time="30" stepKey="waitForPageLoad"/> - <see selector="{{element}}" userInput="{{expectedText}}" stepKey="assertText"/> - </actionGroup> - - <!--Related products--> - <actionGroup name="addRelatedProductBySku"> - <annotations> - <description>Adds the provided Product SKU as a Related Product on the Admin Product creation/edit page.</description> - </annotations> - <arguments> - <argument name="sku"/> - </arguments> - - <!--Scroll up to avoid error--> - <scrollTo selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDropdown}}" x="0" y="-100" stepKey="scrollTo"/> - <conditionalClick selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDropdown}}" dependentSelector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDependent}}" visible="false" stepKey="openDropDownIfClosedRelatedUpSellCrossSell"/> - <click selector="{{AdminProductFormRelatedUpSellCrossSellSection.AddRelatedProductsButton}}" stepKey="clickAddRelatedProductButton"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> - <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{sku}}" stepKey="fillProductSkuFilter"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> - <waitForPageLoad stepKey="waitForPageToLoad"/> - <click selector="{{AdminProductModalSlideGridSection.productGridXRowYColumnButton('1', '1')}}" stepKey="selectProduct"/> - <click selector="{{AdminAddRelatedProductsModalSection.AddSelectedProductsButton}}" stepKey="addRelatedProductSelected"/> - <waitForElementNotVisible selector="{{AdminAddRelatedProductsModalSection.AddSelectedProductsButton}}" stepKey="waitForElementNotVisible"/> - </actionGroup> - - <!--Click AddCrossSellProducts and adds product by SKU--> - <actionGroup name="addCrossSellProductBySku"> - <annotations> - <description>Adds the provided Product SKU as a Cross Sell Product on the Admin Product creation/edit page.</description> - </annotations> - <arguments> - <argument name="sku"/> - </arguments> - - <!--Scroll up to avoid error--> - <scrollTo selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDropdown}}" x="0" y="-100" stepKey="scrollTo"/> - <conditionalClick selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDropdown}}" dependentSelector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDependent}}" visible="false" stepKey="openDropDownIfClosedRelatedUpSellCrossSell"/> - <click selector="{{AdminProductFormRelatedUpSellCrossSellSection.AddCrossSellProductsButton}}" stepKey="clickAddCrossSellButton"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> - <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{sku}}" stepKey="fillProductSkuFilter"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> - <waitForPageLoad stepKey="waitForPageToLoad"/> - <click selector="{{AdminProductModalSlideGridSection.productGridXRowYColumnButton('1', '1')}}" stepKey="selectProduct"/> - <click selector="{{AdminProductCrossSellModalSection.addSelectedProducts}}" stepKey="addRelatedProductSelected"/> - <waitForPageLoad stepKey="waitForModalDisappear"/> - </actionGroup> - - <!--Add special price to product in Admin product page--> - <actionGroup name="AddSpecialPriceToProductActionGroup"> - <annotations> - <description>Sets the provided Special Price on the Admin Product creation/edit page.</description> - </annotations> - <arguments> - <argument name="price" type="string" defaultValue="8"/> - </arguments> - - <waitForPageLoad stepKey="waitForPageLoad"/> - <click selector="{{AdminProductFormSection.advancedPricingLink}}" stepKey="clickAdvancedPricingLink"/> - <waitForPageLoad stepKey="waitForAdvancedPricingModal"/> - <waitForElementVisible selector="{{AdminProductFormAdvancedPricingSection.specialPrice}}" stepKey="waitSpecialPrice"/> - <fillField userInput="{{price}}" selector="{{AdminProductFormAdvancedPricingSection.specialPrice}}" stepKey="fillSpecialPrice"/> - <click selector="{{AdminProductFormAdvancedPricingSection.doneButton}}" stepKey="clickDone"/> - <waitForPageLoad stepKey="waitForAdvancedPricingModalGone"/> - <waitForElementNotVisible selector="{{AdminProductFormAdvancedPricingSection.specialPrice}}" stepKey="waitForCloseModalWindow"/> - </actionGroup> - - <!--Select Product In Websites--> - <actionGroup name="SelectProductInWebsitesActionGroup"> - <annotations> - <description>Sets the provided Website on the Admin Product creation/edit page.</description> - </annotations> - <arguments> - <argument name="website" type="string"/> - </arguments> - - <scrollTo selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="scrollToWebsites"/> - <conditionalClick selector="{{ProductInWebsitesSection.sectionHeader}}" dependentSelector="{{AdminProductContentSection.sectionHeaderShow}}" visible="false" stepKey="expandSection"/> - <waitForPageLoad stepKey="waitForPageOpened"/> - <checkOption selector="{{ProductInWebsitesSection.website(website)}}" stepKey="selectWebsite"/> - </actionGroup> - <actionGroup name="unassignWebsiteFromProductActionGroup" extends="SelectProductInWebsitesActionGroup"> - <remove keyForRemoval="selectWebsite"/> - <uncheckOption selector="{{ProductInWebsitesSection.website(website)}}" stepKey="unSelectWebsite" after="waitForPageOpened"/> - </actionGroup> - - <actionGroup name="AdminProductAddSpecialPrice"> - <annotations> - <description>Sets the provided Special Price on the Admin Product creation/edit page. Clicks on Save.</description> - </annotations> - <arguments> - <argument name="specialPrice" type="string"/> - </arguments> - - <click selector="{{AdminProductFormSection.advancedPricingLink}}" stepKey="clickAdvancedPricingLink1"/> - <waitForElementVisible selector="{{AdminProductFormAdvancedPricingSection.specialPrice}}" stepKey="waitSpecialPrice1"/> - <click selector="{{AdminProductFormAdvancedPricingSection.useDefaultPrice}}" stepKey="checkUseDefault"/> - <fillField userInput="{{specialPrice}}" selector="{{AdminProductFormAdvancedPricingSection.specialPrice}}" stepKey="fillSpecialPrice"/> - <click selector="{{AdminProductFormAdvancedPricingSection.doneButton}}" stepKey="clickDone"/> - <waitForElementNotVisible selector="{{AdminProductFormAdvancedPricingSection.specialPrice}}" stepKey="waitForCloseModalWindow"/> - <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton"/> - <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSaveProductMessage"/> - </actionGroup> - - <!--Switch to New Store view--> - <actionGroup name="SwitchToTheNewStoreView"> - <annotations> - <description>Switches the New Store View.</description> - </annotations> - <arguments> - <argument name="storeViewName" type="string"/> - </arguments> - - <scrollTo selector="{{AdminProductContentSection.pageHeader}}" stepKey="scrollToUp"/> - <waitForElementVisible selector="{{AdminProductFormActionSection.changeStoreButton}}" stepKey="waitForElementBecomeVisible"/> - <click selector="{{AdminProductFormActionSection.changeStoreButton}}" stepKey="clickStoreviewSwitcher"/> - <click selector="{{AdminProductFormActionSection.selectStoreView(storeViewName)}}" stepKey="chooseStoreView"/> - <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="acceptStoreSwitchingMessage"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - </actionGroup> - - <!--Create a Simple Product--> - <actionGroup name="createSimpleProductAndAddToWebsite"> - <annotations> - <description>Goes to the Admin Product grid page. Clicks on Add Product. Fills the provided Product Details (Name, SKU, Price, Quantity and Website). Clicks on Save.</description> - </annotations> - <arguments> - <argument name="product"/> - <argument name="website" type="string"/> - </arguments> - - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToCatalogProductGrid"/> - <waitForPageLoad stepKey="waitForProductGrid"/> - <click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductDropdown"/> - <click selector="{{AdminProductGridActionSection.addSimpleProduct}}" stepKey="clickAddSimpleProduct"/> - <fillField userInput="{{product.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="fillProductName"/> - <fillField userInput="{{product.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="fillProductSKU"/> - <fillField userInput="{{product.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="fillProductPrice"/> - <fillField userInput="{{product.quantity}}" selector="{{AdminProductFormSection.productQuantity}}" stepKey="fillProductQuantity"/> - <click selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="openProductInWebsites"/> - <click selector="{{ProductInWebsitesSection.website(website)}}" stepKey="selectWebsite"/> - <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSave"/> - <waitForLoadingMaskToDisappear stepKey="waitForProductPageSave"/> - <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSaveProductMessage"/> - </actionGroup> - - <actionGroup name="CreatedProductConnectToWebsite"> - <annotations> - <description>Clicks on 'Edit' for the provided Product. Clicks on the provided Website. Clicks on Save.</description> - </annotations> - <arguments> - <argument name="website"/> - <argument name="product"/> - </arguments> - - <click stepKey="openProduct" selector="{{AdminProductGridActionSection.productName(product.sku)}}"/> - <waitForPageLoad stepKey="waitForProductPage"/> - <scrollTo selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="ScrollToWebsites"/> - <click selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="openWebsitesList"/> - <waitForPageLoad stepKey="waitForWebsitesList"/> - <click selector="{{ProductInWebsitesSection.website(website.name)}}" stepKey="SelectWebsite"/> - <click selector="{{AdminProductFormAdvancedPricingSection.save}}" stepKey="clickSaveProduct"/> - <waitForPageLoad stepKey="waitForSave"/> - </actionGroup> - - <!-- Action group assign to one website and unassign from another --> - <actionGroup name="AdminProcessProductWebsitesActionGroup" extends="CreatedProductConnectToWebsite"> - <arguments> - <argument name="websiteToUnassign"/> - </arguments> - <uncheckOption selector="{{ProductInWebsitesSection.website(websiteToUnassign.name)}}" after="SelectWebsite" stepKey="uncheckWebsite"/> - </actionGroup> - - <!--Check tier price with a discount percentage on product--> - <actionGroup name="AssertDiscountsPercentageOfProducts"> - <annotations> - <description>Validates that the provided Product Tier Price is present and correct.</description> - </annotations> - <arguments> - <argument name="amount" type="string" defaultValue="45"/> - </arguments> - - <click selector="{{AdminProductFormSection.advancedPricingLink}}" stepKey="clickOnAdvancedPricingButton"/> - <waitForElement selector="{{AdminProductFormAdvancedPricingSection.customerGroupPriceAddButton}}" stepKey="waitForCustomerGroupPriceAddButton"/> - <grabValueFrom selector="{{AdminProductFormAdvancedPricingSection.productTierPricePercentageValuePriceInput('0')}}" stepKey="grabProductTierPriceInput"/> - <assertEquals stepKey="assertProductTierPriceInput"> - <expectedResult type="string">{{amount}}</expectedResult> - <actualResult type="string">$grabProductTierPriceInput</actualResult> - </assertEquals> - </actionGroup> - - <!-- This action group goes to the product index page, opens the drop down and clicks the specified product type for adding a product --> - <actionGroup name="GoToSpecifiedCreateProductPage"> - <annotations> - <description>Goes to the Admin Product grid page. Clicks on the Add Product toggle. Clicks on the provided Product Type.</description> - </annotations> - <arguments> - <argument type="string" name="productType" defaultValue="simple"/> - </arguments> - - <comment userInput="actionGroup:GoToSpecifiedCreateProductPage" stepKey="actionGroupComment"/> - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> - <click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductDropdown"/> - <click selector="{{AdminProductGridActionSection.addTypeProduct(productType)}}" stepKey="clickAddProduct"/> - <waitForPageLoad stepKey="waitForFormToLoad"/> - </actionGroup> - - <!-- This action group simply navigates to the product catalog page --> - <actionGroup name="GoToProductCatalogPage"> - <annotations> - <description>Goes to the Admin Products grid page.</description> - </annotations> - - <comment userInput="actionGroup:GoToProductCatalogPage" stepKey="actionGroupComment"/> - <amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="GoToCatalogProductPage"/> - <waitForPageLoad stepKey="WaitForPageToLoad"/> - </actionGroup> - - <actionGroup name="SetProductUrlKey"> - <annotations> - <description>Fills the Product details (URL) for the SEO section.</description> - </annotations> - <arguments> - <argument name="product" defaultValue="_defaultProduct"/> - </arguments> - - <click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/> - <fillField userInput="{{product.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/> - </actionGroup> - - <actionGroup name="SetProductUrlKeyByString"> - <annotations> - <description>Fills the Product SEO URL Key.</description> - </annotations> - <arguments> - <argument name="urlKey" type="string"/> - </arguments> - - <click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/> - <fillField userInput="{{urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/> - </actionGroup> - - <actionGroup name="SetCategoryByName"> - <annotations> - <description>Sets the provided Category Name for a Product on the Product creation/edit page.</description> - </annotations> - <arguments> - <argument name="categoryName" type="string"/> - </arguments> - - <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[{{categoryName}}]" stepKey="searchAndSelectCategory"/> - </actionGroup> - <!--Remove category from product in ProductFrom Page--> - <actionGroup name="removeCategoryFromProduct"> - <arguments> - <argument name="categoryName" type="string" defaultValue="{{_defaultCategory.name}}"/> - </arguments> - <click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="clickCategoriesDropDown"/> - <click selector="{{AdminProductFormSection.unselectCategories(categoryName)}}" stepKey="unselectCategories"/> - <click selector="{{AdminProductFormSection.done}}" stepKey="clickOnDoneAdvancedCategory"/> - </actionGroup> - - <actionGroup name="expandAdminProductSection"> - <annotations> - <description>Expand the provided Section Selector based on the provided dependant Section Selector.</description> - </annotations> - <arguments> - <argument name="sectionSelector" defaultValue="{{AdminProductContentSection.sectionHeader}}" type="string"/> - <argument name="sectionDependentSelector" defaultValue="{{AdminProductContentSection.sectionHeaderShow}}" type="string"/> - </arguments> - - <scrollToTopOfPage stepKey="scrollToTopOfPage"/> - <waitForElementVisible time="30" selector="{{sectionSelector}}" stepKey="waitForSection"/> - <conditionalClick selector="{{sectionSelector}}" dependentSelector="{{sectionDependentSelector}}" visible="false" stepKey="expandSection"/> - <waitForPageLoad time="30" stepKey="waitForSectionToExpand"/> - </actionGroup> - - <actionGroup name="navigateToCreatedProductEditPage"> - <annotations> - <description>Goes to the Admin Product grid page. Filters the Product grid based on the provided Product details (SKU). Edits the provided Product. Validates that the Product SKU is present and correct.</description> - </annotations> - <arguments> - <argument name="product" defaultValue="_defaultProduct"/> - </arguments> - - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToAdminProductIndexPage"/> - <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> - <waitForPageLoad stepKey="waitForClearFilters"/> - <dontSeeElement selector="{{AdminProductGridFilterSection.clearFilters}}" stepKey="dontSeeClearFilters"/> - <click selector="{{AdminProductGridFilterSection.viewDropdown}}" stepKey="openViewBookmarksTab"/> - <click selector="{{AdminProductGridFilterSection.viewBookmark('Default View')}}" stepKey="resetToDefaultGridView"/> - <waitForPageLoad stepKey="waitForResetToDefaultView"/> - <see selector="{{AdminProductGridFilterSection.viewDropdown}}" userInput="Default View" stepKey="seeDefaultViewSelected"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> - <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillProductSkuFilter"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> - <waitForPageLoad stepKey="waitForFilterOnGrid"/> - <click selector="{{AdminProductGridSection.selectRowBasedOnName(product.name)}}" stepKey="clickProduct"/> - <waitForPageLoad stepKey="waitForProductEditPageLoad"/> - <waitForElementVisible selector="{{AdminProductFormBundleSection.productSku}}" stepKey="waitForProductSKUField"/> - <seeInField selector="{{AdminProductFormBundleSection.productSku}}" userInput="{{product.sku}}" stepKey="seeProductSKU"/> - </actionGroup> - - <actionGroup name="addUpSellProductBySku" extends="addRelatedProductBySku"> - <annotations> - <description>EXTENDS: addRelatedProductBySku. Add the provided Product as an Up Sell Product.</description> - </annotations> - - <click selector="{{AdminProductFormRelatedUpSellCrossSellSection.AddUpSellProductsButton}}" stepKey="clickAddRelatedProductButton"/> - <conditionalClick selector="{{AdminAddUpSellProductsModalSection.Modal}} {{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminAddUpSellProductsModalSection.Modal}} {{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> - <click selector="{{AdminAddUpSellProductsModalSection.Modal}} {{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> - <fillField selector="{{AdminAddUpSellProductsModalSection.Modal}} {{AdminProductGridFilterSection.skuFilter}}" userInput="{{sku}}" stepKey="fillProductSkuFilter"/> - <click selector="{{AdminAddUpSellProductsModalSection.Modal}} {{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> - <waitForPageLoad stepKey="waitForPageToLoad"/> - <click selector="{{AdminAddUpSellProductsModalSection.Modal}}{{AdminProductModalSlideGridSection.productGridXRowYColumnButton('1', '1')}}" stepKey="selectProduct"/> - <click selector="{{AdminAddUpSellProductsModalSection.AddSelectedProductsButton}}" stepKey="addRelatedProductSelected"/> - <waitForPageLoad stepKey="waitForPageToLoad1"/> - </actionGroup> - <actionGroup name="adminProductAdvancedPricingNewCustomerGroupPrice"> - <arguments> - <argument name="qty" type="string" defaultValue="2"/> - <argument name="priceType" type="string" defaultValue="Discount"/> - <argument name="discount" type="string" defaultValue="75"/> - <argument name="customerGroup" type="string" defaultValue="0"/> - </arguments> - <click selector="{{AdminProductFormAdvancedPricingSection.customerGroupPriceAddButton}}" stepKey="addCustomerGroup"/> - <fillField selector="{{AdminProductFormAdvancedPricingSection.productTierPriceQtyInput(customerGroup)}}" userInput="{{qty}}" stepKey="fillProductTierPriceQtyInput1"/> - <selectOption selector="{{AdminProductFormAdvancedPricingSection.productTierPriceValueTypeSelect(customerGroup)}}" userInput="{{priceType}}" stepKey="selectProductTierPriceValueType1"/> - <fillField selector="{{AdminProductFormAdvancedPricingSection.productTierPricePercentageValuePriceInput(customerGroup)}}" userInput="{{discount}}" stepKey="selectProductTierPricePriceInput"/> - <click selector="{{AdminProductFormAdvancedPricingSection.doneButton}}" stepKey="clickDoneButton1"/> - </actionGroup> - <actionGroup name="AdminSetProductDisabled"> - <conditionalClick selector="{{AdminProductFormSection.enableProductLabel}}" dependentSelector="{{AdminProductFormSection.productStatusValue('1')}}" visible="true" stepKey="disableProduct"/> - <seeElement selector="{{AdminProductFormSection.productStatusValue('2')}}" stepKey="assertThatProductSetToDisabled"/> - </actionGroup> - - <!-- You are on product Edit Page --> - <!-- Assert checkbox available for website in Product In Websites --> - <actionGroup name="AssertWebsiteIsAvailableInProductWebsites"> - <arguments> - <argument name="website" type="string"/> - </arguments> - <scrollTo selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="scrollToProductInWebsitesSection"/> - <conditionalClick selector="{{ProductInWebsitesSection.sectionHeader}}" dependentSelector="{{ProductInWebsitesSection.sectionHeaderOpened}}" visible="false" stepKey="expandProductWebsitesSection"/> - <seeElement selector="{{ProductInWebsitesSection.website(website)}}" stepKey="seeCheckboxForWebsite"/> - </actionGroup> - - <!-- You are on product Edit Page --> - <!-- Assert checkbox not available for website in Product In Websites --> - <actionGroup name="AssertWebsiteIsNotAvailableInProductWebsites" extends="AssertWebsiteIsAvailableInProductWebsites"> - <remove keyForRemoval="seeCheckboxForWebsite"/> - <dontSeeElement selector="{{ProductInWebsitesSection.website(website)}}" after="expandProductWebsitesSection" stepKey="dontSeeCheckboxForWebsite"/> - </actionGroup> - - <!-- You are on product Edit Page --> - <!-- Assert checkbox Is checked for website in Product In Websites --> - <actionGroup name="AssertProductIsAssignedToWebsite" extends="AssertWebsiteIsAvailableInProductWebsites"> - <remove keyForRemoval="seeCheckboxForWebsite"/> - <seeCheckboxIsChecked selector="{{ProductInWebsitesSection.website(website)}}" after="expandProductWebsitesSection" stepKey="seeCustomWebsiteIsChecked"/> - </actionGroup> - - <!-- You are on product Edit Page --> - <!-- Assert checkbox is not checked for website in Product In Websites --> - <actionGroup name="AssertProductIsNotAssignedToWebsite" extends="AssertWebsiteIsAvailableInProductWebsites"> - <remove keyForRemoval="seeCheckboxForWebsite"/> - <dontSeeCheckboxIsChecked selector="{{ProductInWebsitesSection.website(website)}}" after="expandProductWebsitesSection" stepKey="seeCustomWebsiteIsNotChecked"/> - </actionGroup> - - <!-- You are on product Edit Page --> - <!-- Assert Product Name in admin Product page --> - <actionGroup name="AssertProductNameInProductEditForm"> - <arguments> - <argument name="productName" type="string"/> - </arguments> - <seeInField selector="{{AdminProductFormSection.productName}}" userInput="{{productName}}" stepKey="seeProductNameOnEditProductPage"/> - </actionGroup> - - <!-- You are on product Edit Page --> - <!-- Assert Product Description in admin Product page --> - <actionGroup name="AssertProductDescriptionInProductEditForm"> - <arguments> - <argument name="productDescription" type="string"/> - </arguments> - <conditionalClick selector="{{AdminProductContentSection.sectionHeader}}" dependentSelector="{{AdminProductContentSection.sectionHeaderShow}}" visible="false" stepKey="expandContentSection"/> - <seeInField selector="{{AdminProductContentSection.descriptionTextArea}}" userInput="{{productDescription}}" stepKey="seeProductDescription"/> - </actionGroup> - - <!-- You are on StorefrontProductPage --> - <!-- Check active product image --> - <actionGroup name="StorefrontAssertActiveProductImage"> - <arguments> - <argument name="fileName" defaultValue="magento-logo" type="string"/> - </arguments> - <seeElement selector="{{StorefrontProductMediaSection.productImageActive(fileName)}}" stepKey="seeActiveImageDefault"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAddSpecialPriceActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAddSpecialPriceActionGroup.xml new file mode 100644 index 0000000000000..fc0f908ff5fbe --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAddSpecialPriceActionGroup.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminProductAddSpecialPriceActionGroup"> + <annotations> + <description>Sets the provided Special Price on the Admin Product creation/edit page. Clicks on Save.</description> + </annotations> + <arguments> + <argument name="specialPrice" type="string"/> + </arguments> + + <click selector="{{AdminProductFormSection.advancedPricingLink}}" stepKey="clickAdvancedPricingLink1"/> + <waitForElementVisible selector="{{AdminProductFormAdvancedPricingSection.specialPrice}}" stepKey="waitSpecialPrice1"/> + <click selector="{{AdminProductFormAdvancedPricingSection.useDefaultPrice}}" stepKey="checkUseDefault"/> + <fillField userInput="{{specialPrice}}" selector="{{AdminProductFormAdvancedPricingSection.specialPrice}}" stepKey="fillSpecialPrice"/> + <click selector="{{AdminProductFormAdvancedPricingSection.doneButton}}" stepKey="clickDone"/> + <waitForElementNotVisible selector="{{AdminProductFormAdvancedPricingSection.specialPrice}}" stepKey="waitForCloseModalWindow"/> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton"/> + <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSaveProductMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAdvancedPricingNewCustomerGroupPriceActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAdvancedPricingNewCustomerGroupPriceActionGroup.xml new file mode 100644 index 0000000000000..f465eceb8f008 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAdvancedPricingNewCustomerGroupPriceActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminProductAdvancedPricingNewCustomerGroupPriceActionGroup"> + <arguments> + <argument name="qty" type="string" defaultValue="2"/> + <argument name="priceType" type="string" defaultValue="Discount"/> + <argument name="discount" type="string" defaultValue="75"/> + <argument name="customerGroup" type="string" defaultValue="0"/> + </arguments> + <click selector="{{AdminProductFormAdvancedPricingSection.customerGroupPriceAddButton}}" stepKey="addCustomerGroup"/> + <fillField selector="{{AdminProductFormAdvancedPricingSection.productTierPriceQtyInput(customerGroup)}}" userInput="{{qty}}" stepKey="fillProductTierPriceQtyInput1"/> + <selectOption selector="{{AdminProductFormAdvancedPricingSection.productTierPriceValueTypeSelect(customerGroup)}}" userInput="{{priceType}}" stepKey="selectProductTierPriceValueType1"/> + <fillField selector="{{AdminProductFormAdvancedPricingSection.productTierPricePercentageValuePriceInput(customerGroup)}}" userInput="{{discount}}" stepKey="selectProductTierPricePriceInput"/> + <click selector="{{AdminProductFormAdvancedPricingSection.doneButton}}" stepKey="clickDoneButton1"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml deleted file mode 100644 index 42e0bb24c744f..0000000000000 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml +++ /dev/null @@ -1,379 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="navigateToCreatedProductAttribute"> - <annotations> - <description>Goes to the Product Attributes grid page. Filters the grid based on the provided Product Attribute. Clicks on the 1st row.</description> - </annotations> - <arguments> - <argument name="ProductAttribute"/> - </arguments> - - <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/> - <fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" userInput="{{ProductAttribute.attribute_code}}" stepKey="setAttributeCode"/> - <click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="searchForAttributeFromTheGrid"/> - <click selector="{{AdminProductAttributeGridSection.FirstRow}}" stepKey="clickOnAttributeRow"/> - <waitForPageLoad stepKey="waitForPageLoad2"/> - </actionGroup> - - <actionGroup name="navigateToEditProductAttribute"> - <annotations> - <description>Goes to the Product Attributes grid page. Filters the grid based on the provided Product Attribute. Clicks on the 1st row.</description> - </annotations> - <arguments> - <argument name="ProductAttribute" type="string"/> - </arguments> - - <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/> - <fillField selector="{{AdminProductAttributeGridSection.GridFilterFrontEndLabel}}" userInput="{{ProductAttribute}}" stepKey="navigateToAttributeEditPage1"/> - <click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="navigateToAttributeEditPage2"/> - <waitForPageLoad stepKey="waitForPageLoad2"/> - <click selector="{{AdminProductAttributeGridSection.FirstRow}}" stepKey="navigateToAttributeEditPage3"/> - <waitForPageLoad stepKey="waitForPageLoad3"/> - </actionGroup> - - <actionGroup name="AdminCreateAttributeFromProductPage"> - <annotations> - <description>From the Product creation/edit page, under 'Configurations', Clicks on 'Create Configurations'. Clicks on 'Create New Attribute'. Fills Label. Selects Type. Clicks on Save.</description> - </annotations> - <arguments> - <argument name="attributeName" type="string"/> - <argument name="attributeType" type="string" defaultValue="TextField"/> - </arguments> - - <click selector="{{AdminProductFormSection.addAttributeBtn}}" stepKey="clickAddAttributeBtn"/> - <see userInput="Select Attribute" stepKey="checkNewAttributePopUpAppeared"/> - <click selector="{{AdminProductFormAttributeSection.createNewAttribute}}" stepKey="clickCreateNewAttribute"/> - <fillField selector="{{AdminProductFormNewAttributeSection.attributeLabel}}" userInput="{{attributeName}}" stepKey="fillAttributeLabel"/> - <selectOption selector="{{AdminProductFormNewAttributeSection.attributeType}}" userInput="{{attributeType}}" stepKey="selectAttributeType"/> - <click selector="{{AdminProductFormNewAttributeSection.saveAttribute}}" stepKey="saveAttribute"/> - </actionGroup> - <actionGroup name="AdminCreateAttributeFromProductPageWithScope" extends="AdminCreateAttributeFromProductPage" insertAfter="selectAttributeType"> - <arguments> - <argument name="scope" type="string" defaultValue="Store View"/> - </arguments> - <conditionalClick selector="{{AdminProductFormNewAttributeAdvancedSection.sectionHeader}}" dependentSelector="{{AdminProductFormNewAttributeAdvancedSection.scope}}" visible="false" stepKey="openAttributeAdvancedSection"/> - <selectOption selector="{{AdminProductFormNewAttributeAdvancedSection.scope}}" userInput="{{scope}}" stepKey="selectScope"/> - </actionGroup> - - <actionGroup name="AdminCreateAttributeWithValueWithTwoStoreViesFromProductPage" extends="AdminCreateAttributeFromProductPage"> - <remove keyForRemoval="saveAttribute"/> - <annotations> - <description>EXTENDS: AdminCreateAttributeFromProductPage. Adds the 2 provided Store Views to a Product. Clicks on Save.</description> - </annotations> - <arguments> - <argument name="firstStoreViewName" type="string"/> - <argument name="secondStoreViewName" type="string"/> - </arguments> - - <click selector="{{AdminProductFormNewAttributeSection.addValue}}" stepKey="addValue" after="selectAttributeType"/> - <seeElement selector="{{AdminProductFormNewAttributeSection.optionViewName(firstStoreViewName))}}" stepKey="seeFirstStoreView"/> - <seeElement selector="{{AdminProductFormNewAttributeSection.optionViewName(firstStoreViewName))}}" stepKey="seeSecondStoreView"/> - <fillField selector="{{AdminProductFormNewAttributeSection.optionValue('1'))}}" userInput="default" stepKey="fillDefaultStoreView"/> - <fillField selector="{{AdminProductFormNewAttributeSection.optionValue('2'))}}" userInput="admin" stepKey="fillAdminStoreView"/> - <fillField selector="{{AdminProductFormNewAttributeSection.optionValue('3'))}}" userInput="view1" stepKey="fillFirstStoreView"/> - <fillField selector="{{AdminProductFormNewAttributeSection.optionValue('4'))}}" userInput="view2" stepKey="fillSecondStoreView"/> - - <!--Check store view in Manage Titles section--> - <click selector="{{AdminProductFormNewAttributeSection.manageTitlesHeader}}" stepKey="openManageTitlesSection"/> - <seeElement selector="{{AdminProductFormNewAttributeSection.manageTitlesViewName(customStoreEN.name)}}" stepKey="seeFirstStoreViewName"/> - <seeElement selector="{{AdminProductFormNewAttributeSection.manageTitlesViewName(customStoreFR.name)}}" stepKey="seeSecondStoreViewName"/> - <click selector="{{AdminProductFormNewAttributeSection.saveAttribute}}" stepKey="saveAttribute1"/> - </actionGroup> - - <!-- Creates attribute and attribute set from the product page--> - <actionGroup name="AdminProductPageCreateAttributeSetWithAttribute"> - <annotations> - <description>Adds the provided Product Attribute Set to a Product on the Product creation/edit page.</description> - </annotations> - <arguments> - <argument name="attributeName" type="string"/> - <argument name="attributeSetName" type="string"/> - <argument name="attributeType" type="string" defaultValue="TextField"/> - </arguments> - - <click selector="{{AdminProductFormSection.addAttributeBtn}}" stepKey="clickAddAttributeBtn"/> - <waitForPageLoad stepKey="waitForSidePanel"/> - <see userInput="Select Attribute" stepKey="checkNewAttributePopUpAppeared"/> - <click selector="{{AdminProductFormAttributeSection.createNewAttribute}}" stepKey="clickCreateNewAttribute"/> - <fillField selector="{{AdminProductFormNewAttributeSection.attributeLabel}}" userInput="{{attributeName}}" stepKey="fillAttributeLabel"/> - <selectOption selector="{{AdminProductFormNewAttributeSection.attributeType}}" userInput="{{attributeType}}" stepKey="selectAttributeType"/> - <click selector="{{AdminProductFormNewAttributeSection.saveInNewSet}}" stepKey="saveAttribute"/> - <fillField selector="{{AdminProductFormNewAttributeNewSetSection.setName}}" userInput="{{attributeSetName}}" stepKey="fillSetName"/> - <click selector="{{AdminProductFormNewAttributeNewSetSection.accept}}" stepKey="acceptPopup"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingToFinish"/> - <!-- Product page will hang if there is no reload--> - <reloadPage stepKey="reloadPage"/> - <waitForPageLoad stepKey="waitForReload"/> - </actionGroup> - - <!-- Create attribute and set with given search weight and defaultValue from the Edit Product Page --> - <actionGroup name="AdminCreateAttributeWithSearchWeight" extends="AdminProductPageCreateAttributeSetWithAttribute" insertAfter="selectAttributeType"> - <annotations> - <description>EXTENDS: AdminProductPageCreateAttributeSetWithAttribute. Sets the provided Search Weight and Default Values.</description> - </annotations> - <arguments> - <argument name="weight" type="string" defaultValue="1"/> - <argument name="defaultValue" type="string" defaultValue="default"/> - </arguments> - - <click selector="{{AdminProductFormNewAttributeAdvancedSection.sectionHeader}}" stepKey="openAdvancedSection"/> - <fillField selector="{{AdminProductFormNewAttributeAdvancedSection.defaultValue}}" userInput="{{defaultValue}}" stepKey="inputDefault"/> - <click selector="{{AdminProductFormNewAttributeStorefrontSection.sectionHeader}}" stepKey="openStorefrontSection"/> - <checkOption selector="{{AdminProductFormNewAttributeStorefrontSection.useInSearch}}" stepKey="checkUseInSearch"/> - <waitForElementVisible selector="{{AdminProductFormNewAttributeStorefrontSection.searchWeight}}" stepKey="waitForSearchWeight"/> - <selectOption selector="{{AdminProductFormNewAttributeStorefrontSection.searchWeight}}" userInput="{{weight}}" stepKey="selectWeight"/> - </actionGroup> - - <actionGroup name="AdminProductPageSelectAttributeSet"> - <annotations> - <description>Selects the provided Attribute Set from the Admin Product creation/edit page.</description> - </annotations> - <arguments> - <argument name="attributeSetName" type="string"/> - </arguments> - - <click stepKey="openDropdown" selector="{{AdminProductFormSection.attributeSet}}"/> - <fillField stepKey="filter" selector="{{AdminProductFormSection.attributeSetFilter}}" userInput="{{attributeSetName}}"/> - <click stepKey="clickResult" selector="{{AdminProductFormSection.attributeSetFilterResult}}"/> - </actionGroup> - - <actionGroup name="AdminProductPageFillTextAttributeValueByName"> - <annotations> - <description>Fills in the Attribute Name field with the provided value.</description> - </annotations> - <arguments> - <argument name="attributeName" type="string"/> - <argument name="value" type="string"/> - </arguments> - - <click stepKey="openSection" selector="{{AdminProductAttributeSection.attributeSectionHeader}}"/> - <fillField stepKey="fillValue" selector="{{AdminProductAttributeSection.textAttributeByName(attributeName)}}" userInput="{{value}}"/> - </actionGroup> - - <actionGroup name="changeUseForPromoRuleConditionsProductAttribute"> - <annotations> - <description>Select the provided value for the 'Use for Promo Rule Conditions' dropdown menu. Clicks on Save. Validates that the Save message is present.</description> - </annotations> - <arguments> - <argument name="option" type="string"/> - </arguments> - - <click selector="{{StorefrontPropertiesSection.StoreFrontPropertiesTab}}" stepKey="clickStoreFrontPropertiesTab"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <selectOption selector="{{StorefrontPropertiesSection.useForPromoRuleConditions}}" userInput="{{option}}" stepKey="changeOption"/> - <click selector="{{AttributePropertiesSection.Save}}" stepKey="saveAttribute"/> - <see selector="{{AdminMessagesSection.success}}" userInput="You saved the product attribute." stepKey="successMessage"/> - </actionGroup> - - <actionGroup name="deleteProductAttribute" extends="navigateToCreatedProductAttribute"> - <annotations> - <description>EXTENDS: navigateToCreatedProductAttribute. Deletes the Product Attribute. Validates that the success message is present.</description> - </annotations> - - <click selector="{{AttributePropertiesSection.DeleteAttribute}}" stepKey="deleteAttribute"/> - <click selector="{{ModalConfirmationSection.OkButton}}" stepKey="ClickOnDeleteButton"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="waitForSuccessMessage"/> - </actionGroup> - - <actionGroup name="deleteProductAttributeByLabel"> - <annotations> - <description>Goes to the Admin Product Attributes grid page. Filters the grid for the provided Product Attribute (Label). Deletes the Product Attribute from the grid. Validates that the Success Message is present.</description> - </annotations> - <arguments> - <argument name="ProductAttribute"/> - </arguments> - - <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/> - <fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" userInput="{{ProductAttribute.default_label}}" stepKey="setAttributeCode"/> - <click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="searchForAttributeFromTheGrid"/> - <click selector="{{AdminProductAttributeGridSection.FirstRow}}" stepKey="clickOnAttributeRow"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <click selector="{{AttributePropertiesSection.DeleteAttribute}}" stepKey="deleteAttribute"/> - <click selector="{{ModalConfirmationSection.OkButton}}" stepKey="ClickOnDeleteButton"/> - <waitForPageLoad stepKey="waitForPageLoad1"/> - <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="waitForSuccessMessage"/> - </actionGroup> - - <!-- Delete product attribute by Attribute Code --> - <actionGroup name="deleteProductAttributeByAttributeCode"> - <annotations> - <description>Goes to the Admin Product Attributes grid page. Filters the grid for the provided Product Attribute Code. Deletes the Product Attribute from the grid. Validates that the Success Message is present.</description> - </annotations> - <arguments> - <argument name="ProductAttributeCode" type="string"/> - </arguments> - - <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/> - <waitForPageLoad stepKey="waitForAttributeGridPageLoad"/> - <fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" userInput="{{ProductAttributeCode}}" stepKey="setAttributeCode"/> - <click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="searchForAttributeFromTheGrid"/> - <click selector="{{AdminProductAttributeGridSection.FirstRow}}" stepKey="clickOnAttributeRow"/> - <waitForPageLoad stepKey="waitForPageLoad2"/> - <click selector="{{AttributePropertiesSection.DeleteAttribute}}" stepKey="deleteAttribute"/> - <click selector="{{ModalConfirmationSection.OkButton}}" stepKey="ClickOnDeleteButton"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="waitForSuccessMessage"/> - </actionGroup> - - <!--Filter product attribute by Attribute Code --> - <actionGroup name="filterProductAttributeByAttributeCode"> - <annotations> - <description>Filters the Product Attributes grid by the provided Product Attribute Code.</description> - </annotations> - <arguments> - <argument name="ProductAttributeCode" type="string"/> - </arguments> - - <click selector="{{AdminProductAttributeGridSection.ResetFilter}}" stepKey="resetFiltersOnGrid"/> - <fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" userInput="{{ProductAttributeCode}}" stepKey="setAttributeCode"/> - <waitForPageLoad stepKey="waitForUserInput"/> - <click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="searchForAttributeFromTheGrid"/> - </actionGroup> - - <!--Filter product attribute by Default Label --> - <actionGroup name="filterProductAttributeByDefaultLabel"> - <annotations> - <description>Filters the Product Attributes grid by the provided Product Attribute Label.</description> - </annotations> - <arguments> - <argument name="productAttributeLabel" type="string"/> - </arguments> - - <click selector="{{AdminProductAttributeGridSection.ResetFilter}}" stepKey="resetFiltersOnGrid"/> - <fillField selector="{{AdminProductAttributeGridSection.GridFilterFrontEndLabel}}" userInput="{{productAttributeLabel}}" stepKey="setDefaultLabel"/> - <waitForPageLoad stepKey="waitForUserInput"/> - <click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="searchForAttributeFromTheGrid"/> - </actionGroup> - - <actionGroup name="saveProductAttribute"> - <annotations> - <description>Clicks on Save. Validates that the Success Message is present.</description> - </annotations> - - <waitForElementVisible selector="{{AttributePropertiesSection.Save}}" stepKey="waitForSaveButton"/> - <click selector="{{AttributePropertiesSection.Save}}" stepKey="clickSaveButton"/> - <waitForPageLoad stepKey="waitForAttributeToSave"/> - <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSuccessMessage"/> - </actionGroup> - - <actionGroup name="confirmChangeInputTypeModal"> - <annotations> - <description>Clicks on the Confirm button for the 'Product Data My Be Lost' modal.</description> - </annotations> - - <waitForElementVisible selector="{{AdminEditProductAttributesSection.ProductDataMayBeLostConfirmButton}}" stepKey="waitForChangeInputTypeButton"/> - <click selector="{{AdminEditProductAttributesSection.ProductDataMayBeLostConfirmButton}}" stepKey="clickChangeInputTypeButton"/> - <waitForElementNotVisible selector="{{AdminEditProductAttributesSection.ProductDataMayBeLostModal}}" stepKey="waitForChangeInputTypeModalGone"/> - </actionGroup> - - <actionGroup name="saveProductAttributeInUse"> - <annotations> - <description>Clicks on Save. Validates that the Success Message is present.</description> - </annotations> - - <waitForElementVisible selector="{{AttributePropertiesSection.Save}}" stepKey="waitForSaveButton"/> - <click selector="{{AttributePropertiesSection.Save}}" stepKey="clickSaveButton"/> - <waitForPageLoad stepKey="waitForAttributeToSave"/> - <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSuccessMessage"/> - </actionGroup> - - <!--Clicks Add Attribute and adds the given attribute--> - <actionGroup name="addProductAttributeInProductModal"> - <annotations> - <description>Adds the provided Attribute Code to the Product on the Admin Product creation/edit page.</description> - </annotations> - <arguments> - <argument name="attributeCode" type="string"/> - </arguments> - - <click stepKey="addAttribute" selector="{{AdminProductFormActionSection.addAttributeButton}}"/> - <conditionalClick selector="{{AdminProductAddAttributeModalSection.clearFilters}}" dependentSelector="{{AdminProductAddAttributeModalSection.clearFilters}}" visible="true" stepKey="clearFilters"/> - <click stepKey="clickFilters" selector="{{AdminProductAddAttributeModalSection.filters}}"/> - <fillField stepKey="fillCode" selector="{{AdminProductAddAttributeModalSection.attributeCodeFilter}}" userInput="{{attributeCode}}"/> - <click stepKey="clickApply" selector="{{AdminProductAddAttributeModalSection.applyFilters}}"/> - <waitForPageLoad stepKey="waitForFilters"/> - <checkOption selector="{{AdminProductAddAttributeModalSection.firstRowCheckBox}}" stepKey="checkAttribute"/> - <click stepKey="addSelected" selector="{{AdminProductAddAttributeModalSection.addSelected}}"/> - </actionGroup> - - <!--Clicks createNewAttribute and fills out form--> - <actionGroup name="createProductAttribute"> - <annotations> - <description>Clicks on 'Add New Attribute'. Fills in the Attribute Details (Label, Input Type and Value Required). Clicks on Save.</description> - </annotations> - <arguments> - <argument name="attribute" type="entity" defaultValue="productAttributeWysiwyg"/> - </arguments> - - <click stepKey="createNewAttribute" selector="{{AdminProductAttributeGridSection.createNewAttributeBtn}}"/> - <fillField stepKey="fillDefaultLabel" selector="{{AttributePropertiesSection.DefaultLabel}}" userInput="{{attribute.attribute_code}}"/> - <selectOption selector="{{AttributePropertiesSection.InputType}}" stepKey="checkInputType" userInput="{{attribute.frontend_input}}"/> - <selectOption selector="{{AttributePropertiesSection.ValueRequired}}" stepKey="checkRequired" userInput="{{attribute.is_required_admin}}"/> - <click stepKey="saveAttribute" selector="{{AttributePropertiesSection.Save}}"/> - </actionGroup> - <actionGroup name="AdminCreateSearchableProductAttribute" extends="createProductAttribute" insertAfter="checkRequired"> - <click selector="{{StorefrontPropertiesSection.StoreFrontPropertiesTab}}" stepKey="goToStorefrontPropertiesTab"/> - <waitForElementVisible selector="{{StorefrontPropertiesSection.PageTitle}}" stepKey="waitTabLoad"/> - <selectOption selector="{{AdvancedAttributePropertiesSection.UseInSearch}}" userInput="Yes" stepKey="setSearchable"/> - </actionGroup> - - <!-- Inputs text default value and attribute code--> - <actionGroup name="createProductAttributeWithTextField" extends="createProductAttribute" insertAfter="checkRequired"> - <annotations> - <description>EXTENDS: createProductAttribute. Fills in the Attribute Code and Default Value (Attribute Type: Text Field).</description> - </annotations> - - <click stepKey="openAdvancedProperties" selector="{{AdvancedAttributePropertiesSection.AdvancedAttributePropertiesSectionToggle}}"/> - <fillField stepKey="fillCode" selector="{{AdvancedAttributePropertiesSection.AttributeCode}}" userInput="{{attribute.attribute_code}}"/> - <fillField stepKey="fillDefaultValue" selector="{{AdvancedAttributePropertiesSection.DefaultValueText}}" userInput="{{attribute.default_value}}"/> - </actionGroup> - - <!-- Inputs date default value and attribute code--> - <actionGroup name="createProductAttributeWithDateField" extends="createProductAttribute" insertAfter="checkRequired"> - <annotations> - <description>EXTENDS: createProductAttribute. Fills in the Attribute Code and Default Value (Attribute Type: Date Field).</description> - </annotations> - <arguments> - <argument name="date" type="string"/> - </arguments> - - <click stepKey="openAdvancedProperties" selector="{{AdvancedAttributePropertiesSection.AdvancedAttributePropertiesSectionToggle}}"/> - <fillField stepKey="fillCode" selector="{{AdvancedAttributePropertiesSection.AttributeCode}}" userInput="{{attribute.attribute_code}}"/> - <fillField stepKey="fillDefaultValue" selector="{{AdvancedAttributePropertiesSection.DefaultValueDate}}" userInput="{{date}}"/> - </actionGroup> - - <!-- Creates dropdown option at row without saving--> - <actionGroup name="createAttributeDropdownNthOption"> - <annotations> - <description>Creates an Option for a Product Attribute (Attribute Type: Dropdown).</description> - </annotations> - <arguments> - <argument name="row" type="string"/> - <argument name="adminName" type="string"/> - <argument name="frontName" type="string"/> - </arguments> - - <click stepKey="clickAddOptions" selector="{{AttributePropertiesSection.dropdownAddOptions}}"/> - <waitForPageLoad stepKey="waitForNewOption"/> - <fillField stepKey="fillAdmin" selector="{{AttributePropertiesSection.dropdownNthOptionAdmin(row)}}" userInput="{{adminName}}"/> - <fillField stepKey="fillStoreView" selector="{{AttributePropertiesSection.dropdownNthOptionDefaultStoreView(row)}}" userInput="{{frontName}}"/> - </actionGroup> - - <!-- Creates dropdown option at row as default--> - <actionGroup name="createAttributeDropdownNthOptionAsDefault" extends="createAttributeDropdownNthOption"> - <annotations> - <description>EXTENDS: createAttributeDropdownNthOption. Checks the 'Is Default' option.</description> - </annotations> - - <checkOption selector="{{AttributePropertiesSection.dropdownNthOptionIsDefault(row)}}" stepKey="setAsDefault" after="fillStoreView"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeSetActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeSetActionGroup.xml index a7d5a3864c052..6e05fa614dfb9 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeSetActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeSetActionGroup.xml @@ -8,7 +8,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AssignAttributeToGroup"> + <actionGroup name="AssignAttributeToGroupActionGroup"> <annotations> <description>Assign the provided Attribute to an Attribute Set from the Attribute Sets creation/edit page.</description> </annotations> @@ -23,128 +23,4 @@ <waitForPageLoad stepKey="waitForPageLoad2"/> <see userInput="{{attribute}}" selector="{{AdminProductAttributeSetEditSection.groupTree}}" stepKey="seeAttributeInGroup"/> </actionGroup> - - <actionGroup name="UnassignAttributeFromGroup"> - <annotations> - <description>Unassign the provided Attribute from an Attribute Set from the Attribute Sets creation/edit page.</description> - </annotations> - <arguments> - <argument name="group" type="string"/> - <argument name="attribute" type="string"/> - </arguments> - - <conditionalClick selector="{{AdminProductAttributeSetEditSection.attributeGroupExtender(group)}}" dependentSelector="{{AdminProductAttributeSetEditSection.attributeGroupCollapsed(group)}}" visible="true" stepKey="extendGroup"/> - <waitForPageLoad stepKey="waitForPageLoad1"/> - <dragAndDrop selector1="{{AdminProductAttributeSetEditSection.assignedAttribute(attribute)}}" selector2="{{AdminProductAttributeSetEditSection.xThLineItemUnassignedAttribute('1')}}" stepKey="dragAndDropToUnassigned"/> - <waitForPageLoad stepKey="waitForPageLoad2"/> - <see userInput="{{attribute}}" selector="{{AdminProductAttributeSetEditSection.unassignedAttributesTree}}" stepKey="seeAttributeInUnassigned"/> - </actionGroup> - - <actionGroup name="SaveAttributeSet"> - <annotations> - <description>Save an Attribute Set on the Attribute Set creation/edit page.</description> - </annotations> - - <click selector="{{AdminProductAttributeSetActionSection.save}}" stepKey="clickSave"/> - <see userInput="You saved the attribute set" selector="{{AdminMessagesSection.success}}" stepKey="successMessage"/> - </actionGroup> - - <!--Generic attribute set creation--> - <actionGroup name="CreateDefaultAttributeSet"> - <annotations> - <description>Goes to the Attribute Sets grid page. Clicks on Add. Fill Name. Clicks on Save.</description> - </annotations> - <arguments> - <argument name="label" type="string"/> - </arguments> - - <amOnPage url="{{AdminProductAttributeSetGridPage.url}}" stepKey="goToAttributeSets"/> - <waitForPageLoad stepKey="wait1"/> - <click selector="{{AdminProductAttributeSetGridSection.addAttributeSetBtn}}" stepKey="clickAddAttributeSet"/> - <fillField selector="{{AdminProductAttributeSetSection.name}}" userInput="{{label}}" stepKey="fillName"/> - <click selector="{{AdminProductAttributeSetSection.saveBtn}}" stepKey="clickSave1"/> - </actionGroup> - <actionGroup name="AdminAddUnassignedAttributeToGroup" extends="CreateDefaultAttributeSet"> - <arguments> - <argument name="firstOption" type="string" defaultValue="color"/> - <argument name="secondOption" type="string" defaultValue="material"/> - <argument name="group" type="string" defaultValue="Product Details"/> - </arguments> - <dragAndDrop selector1="{{AdminProductAttributeSetSection.attribute(firstOption)}}" selector2="{{AdminProductAttributeSetSection.attribute(group)}}" stepKey="unassign1"/> - <dragAndDrop selector1="{{AdminProductAttributeSetSection.attribute(secondOption)}}" selector2="{{AdminProductAttributeSetSection.attribute(group)}}" stepKey="unassign2"/> - <click selector="{{AdminProductAttributeSetSection.saveBtn}}" stepKey="clickSaveButton"/> - </actionGroup> - - <actionGroup name="goToAttributeGridPage"> - <annotations> - <description>Goes to the Attribute Sets grid page.</description> - </annotations> - - <amOnPage url="{{AdminProductAttributeSetGridPage.url}}" stepKey="goToAttributeSets"/> - </actionGroup> - - <actionGroup name="goToAttributeSetByName"> - <annotations> - <description>Searches for the provided Attribute Sets Name. Clicks on the 1st row.</description> - </annotations> - <arguments> - <argument name="name" type="string"/> - </arguments> - - <click selector="{{AdminProductAttributeSetGridSection.resetFilter}}" stepKey="clickResetButton"/> - <fillField selector="{{AdminProductAttributeSetGridSection.filter}}" userInput="{{name}}" stepKey="filterByName"/> - <click selector="{{AdminProductAttributeSetGridSection.searchBtn}}" stepKey="clickSearch"/> - <click selector="{{AdminProductAttributeSetGridSection.nthRow('1')}}" stepKey="clickFirstRow"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - </actionGroup> - - <!-- Filter By Attribute Label --> - <actionGroup name="filterProductAttributeByAttributeLabel"> - <annotations> - <description>Searches the Attribute Sets grid page for the provided Attribute Set Name.</description> - </annotations> - <arguments> - <argument name="productAttributeLabel" type="string"/> - </arguments> - - <fillField selector="{{AdminProductAttributeGridSection.attributeLabelFilter}}" userInput="{{productAttributeLabel}}" stepKey="setAttributeLabel"/> - <waitForPageLoad stepKey="waitForUserInput"/> - <click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="searchForAttributeFromTheGrid"/> - </actionGroup> - - <actionGroup name="FilterProductAttributeSetGridByAttributeSetName"> - <annotations> - <description>Filters the Attribute Sets grid page for the provided Attribute Set Name.</description> - </annotations> - <arguments> - <argument name="name" type="string"/> - </arguments> - - <click selector="{{AdminProductAttributeSetGridSection.resetFilter}}" stepKey="clickResetButton"/> - <fillField selector="{{AdminProductAttributeSetGridSection.filter}}" userInput="{{name}}" stepKey="filterByName"/> - <click selector="{{AdminProductAttributeSetGridSection.searchBtn}}" stepKey="clickSearch"/> - <click selector="{{AdminProductAttributeSetGridSection.nthRow('1')}}" stepKey="clickFirstRow"/> - <waitForPageLoad time="30" stepKey="waitForPageLoad1"/> - </actionGroup> - - <!-- Delete attribute set --> - <actionGroup name="deleteAttributeSetByLabel"> - <annotations> - <description>Deletes the provided Attribute Set Name from the Attribute Sets grid page.</description> - </annotations> - <arguments> - <argument name="label" type="string"/> - </arguments> - - <amOnPage url="{{AdminProductAttributeSetGridPage.url}}" stepKey="goToAttributeSets"/> - <waitForPageLoad stepKey="waitForAttributeSetPageLoad"/> - <fillField selector="{{AdminProductAttributeSetGridSection.filter}}" userInput="{{label}}" stepKey="filterByName"/> - <click selector="{{AdminProductAttributeSetGridSection.searchBtn}}" stepKey="clickSearch"/> - <click selector="{{AdminProductAttributeSetGridSection.nthRow('1')}}" stepKey="clickFirstRow"/> - <waitForPageLoad stepKey="waitForClick"/> - <click selector="{{AdminProductAttributeSetSection.deleteBtn}}" stepKey="clickDelete"/> - <click selector="{{AdminProductAttributeSetSection.modalOk}}" stepKey="confirmDelete"/> - <waitForPageLoad stepKey="waitForDeleteToFinish"/> - <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="The attribute set has been removed." stepKey="seeDeleteMessage"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml deleted file mode 100644 index 320a322fc5f8e..0000000000000 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml +++ /dev/null @@ -1,445 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <!--Reset the product grid to the default view--> - <actionGroup name="resetProductGridToDefaultView"> - <annotations> - <description>Sets the Admin Products grid view to the 'Default View'.</description> - </annotations> - - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> - <click selector="{{AdminProductGridFilterSection.viewDropdown}}" stepKey="openViewBookmarksTab"/> - <click selector="{{AdminProductGridFilterSection.viewBookmark('Default View')}}" stepKey="resetToDefaultGridView"/> - <waitForPageLoad stepKey="waitForProductGridLoad"/> - <see selector="{{AdminProductGridFilterSection.viewDropdown}}" userInput="Default View" stepKey="seeDefaultViewSelected"/> - </actionGroup> - - <!--Filter the product grid by the SKU field--> - <actionGroup name="filterProductGridBySku"> - <annotations> - <description>Filters the Admin Products grid by the provided Product (SKU).</description> - </annotations> - <arguments> - <argument name="product" defaultValue="_defaultProduct"/> - </arguments> - - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> - <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillProductSkuFilter"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> - <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad" time="30"/> - </actionGroup> - - <!--Filter the product grid by the SKU string --> - <actionGroup name="filterProductGridBySku2"> - <annotations> - <description>Filters the Admin Products grid by the provided Product SKU.</description> - </annotations> - <arguments> - <argument name="sku" type="string"/> - </arguments> - - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> - <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{sku}}" stepKey="fillProductSkuFilter"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> - <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad" time="30"/> - </actionGroup> - - <!--Filter the product grid by the Name field--> - <actionGroup name="filterProductGridByName"> - <annotations> - <description>Filters the Admin Products grid by the provided Product (Name).</description> - </annotations> - <arguments> - <argument name="product" defaultValue="_defaultProduct"/> - </arguments> - - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> - <fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="{{product.name}}" stepKey="fillProductNameFilter"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> - <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad" time="30"/> - </actionGroup> - - <!--Filter the product grid by the Name field--> - <actionGroup name="filterProductGridByName2"> - <annotations> - <description>Filters the Admin Products grid by the provided Product Name.</description> - </annotations> - <arguments> - <argument name="name" type="string"/> - </arguments> - - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> - <fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="{{name}}" stepKey="fillProductNameFilter"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> - <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad" time="30"/> - </actionGroup> - - <!--Filter the product grid by new from date filter--> - <actionGroup name="filterProductGridBySetNewFromDate"> - <annotations> - <description>Filters the Admin Products grid by the New From Data field. PLEASE NOTE: The Start Date is Hardcoded.</description> - </annotations> - - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> - <fillField selector="{{AdminProductGridFilterSection.newFromDateFilter}}" userInput="05/16/2018" stepKey="fillSetAsNewProductFilter"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> - <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad" time="30"/> - </actionGroup> - - <!--Filter the product grid by a price range--> - <actionGroup name="filterProductGridByPriceRange"> - <annotations> - <description>Filters the Admin Products grid by the provided Price Filter.</description> - </annotations> - <arguments> - <argument name="filter"/> - </arguments> - - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> - <fillField selector="{{AdminProductGridFilterSection.priceFilterFrom}}" userInput="{{filter.from}}" stepKey="fillProductPriceFromFilter"/> - <fillField selector="{{AdminProductGridFilterSection.priceFilterTo}}" userInput="{{filter.to}}" stepKey="fillProductPriceToFilter"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> - <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad" time="30"/> - </actionGroup> - - <!--Filter the product grid to Enabled products--> - <actionGroup name="filterProductGridByEnabledStatus"> - <annotations> - <description>Filters the Admin Products grid by the 'Enabled' Status. PLEASE NOTE: The Filter is Hardcoded.</description> - </annotations> - - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> - <selectOption selector="{{AdminProductGridFilterSection.statusFilter}}" userInput="Enabled" stepKey="selectEnabledStatusFilter"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> - <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad" time="30"/> - </actionGroup> - - <!--Filter the product grid to Disabled products--> - <actionGroup name="filterProductGridByDisabledStatus"> - <annotations> - <description>Filters the Admin Products grid by the 'Disabled' Status. PLEASE NOTE: The Filter is Hardcoded.</description> - </annotations> - - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> - <selectOption selector="{{AdminProductGridFilterSection.statusFilter}}" userInput="Disabled" stepKey="selectDisabledStatusFilter"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> - <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad" time="30"/> - </actionGroup> - - <!--Search product grid with keyword search--> - <actionGroup name="searchProductGridByKeyword"> - <annotations> - <description>Searches the Admin Products grid for the provided Keyword.</description> - </annotations> - <arguments> - <argument name="keyword"/> - </arguments> - - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> - <fillField selector="{{AdminProductGridFilterSection.keywordSearch}}" userInput="{{keyword}}" stepKey="fillKeywordSearchField"/> - <click selector="{{AdminProductGridFilterSection.keywordSearchButton}}" stepKey="clickKeywordSearch"/> - </actionGroup> - - <!--Search product grid with keyword search--> - <!-- Argument type: string (see more in MQE-965) --> - <actionGroup name="searchProductGridByKeyword2"> - <annotations> - <description>Searches the Admin Products grid for the provided Keyword.</description> - </annotations> - <arguments> - <argument name="keyword" type="string"/> - </arguments> - - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> - <fillField selector="{{AdminProductGridFilterSection.keywordSearch}}" userInput="{{keyword}}" stepKey="fillKeywordSearchField"/> - <click selector="{{AdminProductGridFilterSection.keywordSearchButton}}" stepKey="clickKeywordSearch"/> - </actionGroup> - - <!--Filter product grid by name, sku, and type; and see expected product--> - <actionGroup name="viewProductInAdminGrid"> - <annotations> - <description>Filters the Admin Products grid by the provided Product (Name, SKU and Type).</description> - </annotations> - <arguments> - <argument name="product" defaultValue="_defaultProduct"/> - </arguments> - - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> - <waitForPageLoad stepKey="waitForPageLoadInitial"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> - <fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="{{product.name}}" stepKey="fillProductNameFilter"/> - <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillProductSkuFilter"/> - <selectOption selector="{{AdminProductGridFilterSection.typeFilter}}" userInput="{{product.type_id}}" stepKey="selectionProductType"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> - <see selector="{{AdminProductGridSection.productGridCell('1', 'Name')}}" userInput="{{product.name}}" stepKey="seeProductNameInGrid"/> - <see selector="{{AdminProductGridSection.productGridCell('1', 'Price')}}" userInput="{{product.price}}" stepKey="seeProductPriceInGrid"/> - <click selector="{{AdminProductGridFilterSection.clearFilters}}" stepKey="clickClearFiltersAfter"/> - </actionGroup> - - <!-- Filter product grid by sku, name --> - <actionGroup name="filterProductGridBySkuAndName"> - <annotations> - <description>Filters the Admin Products grid by the provided Product (Name and SKU).</description> - </annotations> - <arguments> - <argument name="product" defaultValue="_defaultProduct"/> - </arguments> - - <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"/> - <fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="{{product.name}}" stepKey="fillProductNameFilter"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> - </actionGroup> - - <!--Delete a product by filtering grid and using delete action--> - <actionGroup name="deleteProductUsingProductGrid"> - <annotations> - <description>Deletes the provided Product from the Admin Products grid page.</description> - </annotations> - <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"/> - <fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="{{product.name}}" stepKey="fillProductNameFilter"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> - <see selector="{{AdminProductGridSection.productGridCell('1', 'SKU')}}" userInput="{{product.sku}}" stepKey="seeProductSkuInGrid"/> - <click selector="{{AdminProductGridSection.multicheckDropdown}}" stepKey="openMulticheckDropdown"/> - <click selector="{{AdminProductGridSection.multicheckOption('Select All')}}" stepKey="selectAllProductInFilteredGrid"/> - <click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickActionDropdown"/> - <click selector="{{AdminProductGridSection.bulkActionOption('Delete')}}" stepKey="clickDeleteAction"/> - <waitForElementVisible selector="{{AdminProductGridConfirmActionSection.title}}" stepKey="waitForConfirmModal"/> - <click selector="{{AdminProductGridConfirmActionSection.ok}}" stepKey="confirmProductDelete"/> - </actionGroup> - - <!--Delete all products by filtering grid and using mass delete action--> - <actionGroup name="deleteAllDuplicateProductUsingProductGrid" extends="deleteProductUsingProductGrid"> - <annotations> - <description>EXTENDS: deleteProductUsingProductGrid. Removes 'seeProductSkuInGrid'.</description> - </annotations> - <arguments> - <argument name="product"/> - </arguments> - - <remove keyForRemoval="seeProductSkuInGrid"/> - </actionGroup> - - <!--Delete a product by filtering grid and using delete action--> - <actionGroup name="deleteProductBySku"> - <annotations> - <description>Goes to the Admin Products grid page. Deletes the provided Product SKU.</description> - </annotations> - <arguments> - <argument name="sku" type="string"/> - </arguments> - - <!--TODO use other action group for filtering grid when MQE-539 is implemented --> - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> - <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> - <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{sku}}" stepKey="fillProductSkuFilter"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> - <see selector="{{AdminProductGridSection.productGridCell('1', 'SKU')}}" userInput="{{sku}}" stepKey="seeProductSkuInGrid"/> - <click selector="{{AdminProductGridSection.multicheckDropdown}}" stepKey="openMulticheckDropdown"/> - <click selector="{{AdminProductGridSection.multicheckOption('Select All')}}" stepKey="selectAllProductInFilteredGrid"/> - <click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickActionDropdown"/> - <click selector="{{AdminProductGridSection.bulkActionOption('Delete')}}" stepKey="clickDeleteAction"/> - <waitForElementVisible selector="{{AdminConfirmationModalSection.ok}}" stepKey="waitForConfirmModal"/> - <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmProductDelete"/> - <see selector="{{AdminMessagesSection.success}}" userInput="record(s) have been deleted." stepKey="seeSuccessMessage"/> - </actionGroup> - - <actionGroup name="deleteProductByName" extends="deleteProductBySku"> - <annotations> - <description>EXTENDS: deleteProductBySku. Deletes the provided Product Name.</description> - </annotations> - <arguments> - <argument name="sku" type="string" defaultValue=""/> - <argument name="name" type="string"/> - </arguments> - - <remove keyForRemoval="fillProductSkuFilter"/> - <fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="{{name}}" stepKey="fillProductSkuFilter" after="openProductFilters"/> - <remove keyForRemoval="seeProductSkuInGrid"/> - <see selector="{{AdminProductGridSection.productGridCell('1', 'Name')}}" userInput="{{name}}" stepKey="seeProductNameInGrid" after="clickApplyFilters"/> - </actionGroup> - - <actionGroup name="deleteProductsByKeyword"> - <annotations> - <description>Delete products by keyword</description> - </annotations> - <arguments> - <argument name="keyword" type="string"/> - </arguments> - - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> - <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> - <fillField selector="{{AdminProductGridFilterSection.keywordSearch}}" userInput="{{keyword}}" stepKey="fillKeywordField"/> - <click selector="{{AdminProductGridFilterSection.keywordSearchButton}}" stepKey="keywordSearchButton"/> - <click selector="{{AdminProductGridSection.multicheckDropdown}}" stepKey="openMulticheckDropdown"/> - <click selector="{{AdminProductGridSection.multicheckOption('Select All')}}" stepKey="selectAllProductInFilteredGrid"/> - <click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickActionDropdown"/> - <click selector="{{AdminProductGridSection.bulkActionOption('Delete')}}" stepKey="clickDeleteAction"/> - <waitForElementVisible selector="{{AdminConfirmationModalSection.ok}}" stepKey="waitForConfirmModal"/> - <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmProductDelete"/> - <see selector="{{AdminMessagesSection.success}}" userInput="record(s) have been deleted." stepKey="seeSuccessMessage"/> - </actionGroup> - - <!--Open product for edit by clicking row X and column Y in product grid--> - <actionGroup name="openProducForEditByClickingRowXColumnYInProductGrid"> - <annotations> - <description>Clicks on the 'Edit' button in the Admin Products grid by the provided Grid coordinates (X, Y).</description> - </annotations> - <arguments> - <argument name="X" type="string" defaultValue="1"/> - <argument name="Y" type="string" defaultValue="2"/> - </arguments> - - <click selector="{{AdminProductGridSection.productGridXRowYColumnButton(X, Y)}}" stepKey="openProductForEdit"/> - </actionGroup> - - <!-- Sort products by ID descending --> - <actionGroup name="sortProductsByIdDescending"> - <annotations> - <description>Filters the ID column in Descending Order.</description> - </annotations> - - <conditionalClick selector="{{AdminProductGridTableHeaderSection.id('ascend')}}" dependentSelector="{{AdminProductGridTableHeaderSection.id('descend')}}" visible="false" stepKey="sortById"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - </actionGroup> - - <!-- Sort products by ID ascending --> - <actionGroup name="sortProductsByIdAscending"> - <annotations> - <description>Filters the ID column in Ascending Order.</description> - </annotations> - - <conditionalClick selector="{{AdminProductGridTableHeaderSection.id('descend')}}" dependentSelector="{{AdminProductGridTableHeaderSection.id('ascend')}}" visible="false" stepKey="sortById"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - </actionGroup> - - <!--Disabled a product by filtering grid and using change status action--> - <actionGroup name="ChangeStatusProductUsingProductGridActionGroup"> - <annotations> - <description>Goes to the Admin Products grid page. Changes the Product Status to the provided Status. Validates that the Success Message is present and correct.</description> - </annotations> - <arguments> - <argument name="product"/> - <argument name="status" defaultValue="Enable" type="string"/> - </arguments> - - <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.multicheckDropdown}}" stepKey="openMulticheckDropdown"/> - <click selector="{{AdminProductGridSection.multicheckOption('Select All')}}" stepKey="selectAllProductInFilteredGrid"/> - - <click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickActionDropdown"/> - <click selector="{{AdminProductGridSection.bulkActionOption('Change status')}}" stepKey="clickChangeStatusAction"/> - <click selector="{{AdminProductGridSection.changeStatus('status')}}" stepKey="clickChangeStatusDisabled"/> - <waitForPageLoad stepKey="waitForStatusToBeChanged"/> - <see selector="{{AdminMessagesSection.success}}" userInput="A total of 1 record(s) have been updated." stepKey="seeSuccessMessage"/> - <waitForLoadingMaskToDisappear stepKey="waitForMaskToDisappear"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial2"/> - </actionGroup> - - <actionGroup name="NavigateToAndResetProductGridToDefaultView" extends="resetProductGridToDefaultView"> - <annotations> - <description>EXTENDS: resetProductGridToDefaultView. Adds an action to go to the Admin Products grid page.</description> - </annotations> - - <amOnPage url="{{AdminProductIndexPage.url}}" before="clickClearFilters" stepKey="goToAdminProductIndexPage"/> - <waitForPageLoad after="goToAdminProductIndexPage" stepKey="waitForProductIndexPageToLoad"/> - </actionGroup> - - <actionGroup name="NavigateToAndResetProductAttributeGridToDefaultView"> - <annotations> - <description>Goes to the Product Attributes grid. Clicks on 'Clear Filters'.</description> - </annotations> - - <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> - <waitForPageLoad stepKey="waitForGridLoad"/> - </actionGroup> - - <!--Filter and select the product --> - <actionGroup name="filterAndSelectProduct"> - <annotations> - <description>Goes to the Admin Products grid. Filters the Product grid by the provided Product SKU.</description> - </annotations> - <arguments> - <argument name="productSku" type="string"/> - </arguments> - - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> - <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> - <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{productSku}}" stepKey="fillProductSkuFilter"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> - <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad" time="30"/> - <click stepKey="openSelectedProduct" selector="{{AdminProductGridSection.productRowBySku(productSku)}}"/> - <waitForPageLoad stepKey="waitForProductToLoad"/> - <waitForElementVisible selector="{{AdminHeaderSection.pageTitle}}" stepKey="waitForProductTitle"/> - </actionGroup> - - <actionGroup name="deleteProductsIfTheyExist"> - <annotations> - <description>Deletes all Products in the Admin Products grid.</description> - </annotations> - - <conditionalClick selector="{{AdminProductGridSection.multicheckDropdown}}" dependentSelector="{{AdminProductGridSection.firstProductRow}}" visible="true" stepKey="openMulticheckDropdown"/> - <conditionalClick selector="{{AdminProductGridSection.multicheckOption('Select All')}}" dependentSelector="{{AdminProductGridSection.firstProductRow}}" visible="true" stepKey="selectAllProductInFilteredGrid"/> - <click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickActionDropdown"/> - <click selector="{{AdminProductGridSection.bulkActionOption('Delete')}}" stepKey="clickDeleteAction"/> - <waitForElementVisible selector="{{AdminProductGridConfirmActionSection.ok}}" stepKey="waitForModalPopUp"/> - <click selector="{{AdminProductGridConfirmActionSection.ok}}" stepKey="confirmProductDelete"/> - <waitForPageLoad stepKey="waitForGridLoad"/> - </actionGroup> - - <actionGroup name="deleteAllProductsUsingProductGrid"> - <annotations> - <description>Deletes all products in Admin Products grid page.</description> - </annotations> - - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="openAdminGridProductsPage"/> - <waitForPageLoad time="60" stepKey="waitForPageFullyLoad"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clearGridFilters"/> - - <conditionalClick selector="{{AdminProductGridSection.multicheckDropdown}}" dependentSelector="{{AdminDataGridTableSection.dataGridEmpty}}" visible="false" stepKey="openMulticheckDropdown"/> - <conditionalClick selector="{{AdminProductGridSection.multicheckOption('Select All')}}" dependentSelector="{{AdminDataGridTableSection.dataGridEmpty}}" visible="false" stepKey="selectAllProductsInGrid"/> - <click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickActionDropdown"/> - <click selector="{{AdminProductGridSection.bulkActionOption('Delete')}}" stepKey="clickDeleteAction"/> - - <waitForElementVisible selector="{{AdminConfirmationModalSection.message}}" stepKey="waitForConfirmModal"/> - <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmDelete"/> - <waitForElementVisible selector="{{AdminDataGridTableSection.dataGridEmpty}}" stepKey="waitGridIsEmpty"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductPageCreateAttributeSetWithAttributeActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductPageCreateAttributeSetWithAttributeActionGroup.xml new file mode 100644 index 0000000000000..bdf59b20f8e38 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductPageCreateAttributeSetWithAttributeActionGroup.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminProductPageCreateAttributeSetWithAttributeActionGroup"> + <annotations> + <description>Adds the provided Product Attribute Set to a Product on the Product creation/edit page.</description> + </annotations> + <arguments> + <argument name="attributeName" type="string"/> + <argument name="attributeSetName" type="string"/> + <argument name="attributeType" type="string" defaultValue="TextField"/> + </arguments> + + <click selector="{{AdminProductFormSection.addAttributeBtn}}" stepKey="clickAddAttributeBtn"/> + <waitForPageLoad stepKey="waitForSidePanel"/> + <see userInput="Select Attribute" stepKey="checkNewAttributePopUpAppeared"/> + <click selector="{{AdminProductFormAttributeSection.createNewAttribute}}" stepKey="clickCreateNewAttribute"/> + <fillField selector="{{AdminProductFormNewAttributeSection.attributeLabel}}" userInput="{{attributeName}}" stepKey="fillAttributeLabel"/> + <selectOption selector="{{AdminProductFormNewAttributeSection.attributeType}}" userInput="{{attributeType}}" stepKey="selectAttributeType"/> + <click selector="{{AdminProductFormNewAttributeSection.saveInNewSet}}" stepKey="saveAttribute"/> + <fillField selector="{{AdminProductFormNewAttributeNewSetSection.setName}}" userInput="{{attributeSetName}}" stepKey="fillSetName"/> + <click selector="{{AdminProductFormNewAttributeNewSetSection.accept}}" stepKey="acceptPopup"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingToFinish"/> + <!-- Product page will hang if there is no reload--> + <reloadPage stepKey="reloadPage"/> + <waitForPageLoad stepKey="waitForReload"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductPageFillTextAttributeValueByNameActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductPageFillTextAttributeValueByNameActionGroup.xml new file mode 100644 index 0000000000000..336ab90ccec73 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductPageFillTextAttributeValueByNameActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminProductPageFillTextAttributeValueByNameActionGroup"> + <annotations> + <description>Fills in the Attribute Name field with the provided value.</description> + </annotations> + <arguments> + <argument name="attributeName" type="string"/> + <argument name="value" type="string"/> + </arguments> + + <click stepKey="openSection" selector="{{AdminProductAttributeSection.attributeSectionHeader}}"/> + <fillField stepKey="fillValue" selector="{{AdminProductAttributeSection.textAttributeByName(attributeName)}}" userInput="{{value}}"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductPageSelectAttributeSetActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductPageSelectAttributeSetActionGroup.xml new file mode 100644 index 0000000000000..0b58c65386951 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductPageSelectAttributeSetActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminProductPageSelectAttributeSetActionGroup"> + <annotations> + <description>Selects the provided Attribute Set from the Admin Product creation/edit page.</description> + </annotations> + <arguments> + <argument name="attributeSetName" type="string"/> + </arguments> + + <click stepKey="openDropdown" selector="{{AdminProductFormSection.attributeSet}}"/> + <fillField stepKey="filter" selector="{{AdminProductFormSection.attributeSetFilter}}" userInput="{{attributeSetName}}"/> + <click stepKey="clickResult" selector="{{AdminProductFormSection.attributeSetFilterResult}}"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSetProductDisabledActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSetProductDisabledActionGroup.xml new file mode 100644 index 0000000000000..a8b413d523ff0 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSetProductDisabledActionGroup.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminSetProductDisabledActionGroup"> + <conditionalClick selector="{{AdminProductFormSection.enableProductLabel}}" dependentSelector="{{AdminProductFormSection.productStatusValue('1')}}" visible="true" stepKey="disableProduct"/> + <seeElement selector="{{AdminProductFormSection.productStatusValue('2')}}" stepKey="assertThatProductSetToDisabled"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSwitchScopeForProductAttributeActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSwitchScopeForProductAttributeActionGroup.xml new file mode 100644 index 0000000000000..bd2414ae6e6c5 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSwitchScopeForProductAttributeActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminSwitchScopeForProductAttributeActionGroup"> + <arguments> + <argument name="scope" type="string" defaultValue="1"/> + </arguments> + <click selector="{{AttributePropertiesSection.AdvancedProperties}}" stepKey="expandAdvancedProperties"/> + <waitForElementVisible selector="{{AttributePropertiesSection.Scope}}" stepKey="waitOpenAdvancedProperties"/> + <selectOption selector="{{AttributePropertiesSection.Scope}}" userInput="1" stepKey="selectNecessaryScope"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertDiscountsPercentageOfProductsActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertDiscountsPercentageOfProductsActionGroup.xml new file mode 100644 index 0000000000000..e32c423fb09a3 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertDiscountsPercentageOfProductsActionGroup.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertDiscountsPercentageOfProductsActionGroup"> + <annotations> + <description>Validates that the provided Product Tier Price is present and correct.</description> + </annotations> + <arguments> + <argument name="amount" type="string" defaultValue="45"/> + </arguments> + + <click selector="{{AdminProductFormSection.advancedPricingLink}}" stepKey="clickOnAdvancedPricingButton"/> + <waitForElement selector="{{AdminProductFormAdvancedPricingSection.customerGroupPriceAddButton}}" stepKey="waitForCustomerGroupPriceAddButton"/> + <grabValueFrom selector="{{AdminProductFormAdvancedPricingSection.productTierPricePercentageValuePriceInput('0')}}" stepKey="grabProductTierPriceInput"/> + <assertEquals stepKey="assertProductTierPriceInput"> + <expectedResult type="string">{{amount}}</expectedResult> + <actualResult type="string">$grabProductTierPriceInput</actualResult> + </assertEquals> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductDescriptionInProductEditFormActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductDescriptionInProductEditFormActionGroup.xml new file mode 100644 index 0000000000000..f1bca0c36a57e --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductDescriptionInProductEditFormActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertProductDescriptionInProductEditFormActionGroup"> + <arguments> + <argument name="productDescription" type="string"/> + </arguments> + <conditionalClick selector="{{AdminProductContentSection.sectionHeader}}" dependentSelector="{{AdminProductContentSection.sectionHeaderShow}}" visible="false" stepKey="expandContentSection"/> + <seeInField selector="{{AdminProductContentSection.descriptionTextArea}}" userInput="{{productDescription}}" stepKey="seeProductDescription"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductImageAdminProductPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductImageAdminProductPageActionGroup.xml new file mode 100644 index 0000000000000..6ea154d2b01d3 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductImageAdminProductPageActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertProductImageAdminProductPageActionGroup"> + <annotations> + <description>Validates that the provided Product Image is present and correct.</description> + </annotations> + <arguments> + <argument name="image" defaultValue="MagentoLogo"/> + </arguments> + + <conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductImagesSection"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <seeElement selector="{{AdminProductImagesSection.imageFile(image.filename)}}" stepKey="seeImage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductImageNotInAdminProductPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductImageNotInAdminProductPageActionGroup.xml new file mode 100644 index 0000000000000..a761f20b4cc5f --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductImageNotInAdminProductPageActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertProductImageNotInAdminProductPageActionGroup"> + <annotations> + <description>Validates that the provided Product Image is NOT present.</description> + </annotations> + <arguments> + <argument name="image" defaultValue="MagentoLogo"/> + </arguments> + + <conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductImagesSection"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <dontSeeElement selector="{{AdminProductImagesSection.imageFile(image.filename)}}" stepKey="seeImage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductImageNotInStorefrontProductPage2ActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductImageNotInStorefrontProductPage2ActionGroup.xml new file mode 100644 index 0000000000000..4c7fca97a078a --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductImageNotInStorefrontProductPage2ActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertProductImageNotInStorefrontProductPage2ActionGroup"> + <annotations> + <description>Validates that the provided Product Image is not present.</description> + </annotations> + <arguments> + <argument name="product"/> + <argument name="image" defaultValue="MagentoLogo"/> + </arguments> + + <seeInCurrentUrl url="/{{product.custom_attributes[url_key]}}.html" stepKey="checkUrl"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <dontSeeElement selector="{{StorefrontProductMediaSection.imageFile(image.filename)}}" stepKey="seeImage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductImageNotInStorefrontProductPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductImageNotInStorefrontProductPageActionGroup.xml new file mode 100644 index 0000000000000..72febb053046e --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductImageNotInStorefrontProductPageActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertProductImageNotInStorefrontProductPageActionGroup"> + <annotations> + <description>Validates that the provided Product Image is not present.</description> + </annotations> + <arguments> + <argument name="product"/> + <argument name="image" defaultValue="MagentoLogo"/> + </arguments> + + <seeInCurrentUrl url="/{{product.urlKey}}.html" stepKey="checkUrl"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <dontSeeElement selector="{{StorefrontProductMediaSection.imageFile(image.filename)}}" stepKey="seeImage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductImageStorefrontProductPage2ActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductImageStorefrontProductPage2ActionGroup.xml new file mode 100644 index 0000000000000..a4769e675e607 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductImageStorefrontProductPage2ActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertProductImageStorefrontProductPage2ActionGroup"> + <annotations> + <description>Validates that the provided Product Image is present.</description> + </annotations> + <arguments> + <argument name="product"/> + <argument name="image" defaultValue="MagentoLogo"/> + </arguments> + + <seeInCurrentUrl url="/{{product.custom_attributes[url_key]}}.html" stepKey="checkUrl"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <seeElement selector="{{StorefrontProductMediaSection.imageFile(image.filename)}}" stepKey="seeImage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductImageStorefrontProductPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductImageStorefrontProductPageActionGroup.xml new file mode 100644 index 0000000000000..12be0a3d199dc --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductImageStorefrontProductPageActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertProductImageStorefrontProductPageActionGroup"> + <annotations> + <description>Validates that the provided Product Image is present.</description> + </annotations> + <arguments> + <argument name="product"/> + <argument name="image" defaultValue="MagentoLogo"/> + </arguments> + + <seeInCurrentUrl url="/{{product.urlKey}}.html" stepKey="checkUrl"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <seeElement selector="{{StorefrontProductMediaSection.imageFile(image.filename)}}" stepKey="seeImage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductInStorefrontProductPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductInStorefrontProductPageActionGroup.xml index 8db64ce7c49ac..28ceb82ec6d2e 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductInStorefrontProductPageActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductInStorefrontProductPageActionGroup.xml @@ -8,7 +8,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AssertProductInStorefrontProductPage"> + <actionGroup name="AssertProductInStorefrontProductPageActionGroup"> <annotations> <description>Goes to the Storefront page. Validates that the provided Product details are present.</description> </annotations> @@ -24,36 +24,4 @@ <see userInput="{{product.price}}" selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="assertProductPrice"/> <see userInput="{{product.sku}}" selector="{{StorefrontProductInfoMainSection.productSku}}" stepKey="assertProductSku"/> </actionGroup> - - <actionGroup name="AssertProductNameAndSkuInStorefrontProductPage"> - <annotations> - <description>Goes to the Storefront Product page for the provided Product. Validates that the Product details are present and correct.</description> - </annotations> - <arguments> - <argument name="product"/> - </arguments> - - <!-- Go to storefront product page, assert product name and sku --> - <amOnPage url="{{product.urlKey}}.html" stepKey="navigateToProductPage"/> - <waitForPageLoad stepKey="waitForPageLoad2"/> - <seeInTitle userInput="{{product.name}}" stepKey="assertProductNameTitle"/> - <see userInput="{{product.name}}" selector="{{StorefrontProductInfoMainSection.productName}}" stepKey="assertProductName"/> - <see userInput="{{product.sku}}" selector="{{StorefrontProductInfoMainSection.productSku}}" stepKey="assertProductSku"/> - </actionGroup> - - <actionGroup name="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey"> - <annotations> - <description>Goes to the Storefront Product page for the provided Product. Validates that the Product details are present and correct.</description> - </annotations> - <arguments> - <argument name="product"/> - </arguments> - - <!-- Go to storefront product page, assert product name and sku --> - <amOnPage url="{{product.custom_attributes[url_key]}}.html" stepKey="navigateToProductPage"/> - <waitForPageLoad stepKey="waitForPageLoad2"/> - <seeInTitle userInput="{{product.name}}" stepKey="assertProductNameTitle"/> - <see userInput="{{product.name}}" selector="{{StorefrontProductInfoMainSection.productName}}" stepKey="assertProductName"/> - <see userInput="{{product.sku}}" selector="{{StorefrontProductInfoMainSection.productSku}}" stepKey="assertProductSku"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductIsAssignedToWebsiteActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductIsAssignedToWebsiteActionGroup.xml new file mode 100644 index 0000000000000..23937af41ae51 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductIsAssignedToWebsiteActionGroup.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertProductIsAssignedToWebsiteActionGroup" extends="AssertWebsiteIsAvailableInProductWebsitesActionGroup"> + <remove keyForRemoval="seeCheckboxForWebsite"/> + <seeCheckboxIsChecked selector="{{ProductInWebsitesSection.website(website)}}" after="expandProductWebsitesSection" stepKey="seeCustomWebsiteIsChecked"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductIsNotAssignedToWebsiteActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductIsNotAssignedToWebsiteActionGroup.xml new file mode 100644 index 0000000000000..8963d06e9248f --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductIsNotAssignedToWebsiteActionGroup.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertProductIsNotAssignedToWebsiteActionGroup" extends="AssertWebsiteIsAvailableInProductWebsitesActionGroup"> + <remove keyForRemoval="seeCheckboxForWebsite"/> + <dontSeeCheckboxIsChecked selector="{{ProductInWebsitesSection.website(website)}}" after="expandProductWebsitesSection" stepKey="seeCustomWebsiteIsNotChecked"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductNameAndSkuInStorefrontProductPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductNameAndSkuInStorefrontProductPageActionGroup.xml new file mode 100644 index 0000000000000..23b7701010f35 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductNameAndSkuInStorefrontProductPageActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertProductNameAndSkuInStorefrontProductPageActionGroup"> + <annotations> + <description>Goes to the Storefront Product page for the provided Product. Validates that the Product details are present and correct.</description> + </annotations> + <arguments> + <argument name="product"/> + </arguments> + + <!-- Go to storefront product page, assert product name and sku --> + <amOnPage url="{{product.urlKey}}.html" stepKey="navigateToProductPage"/> + <waitForPageLoad stepKey="waitForPageLoad2"/> + <seeInTitle userInput="{{product.name}}" stepKey="assertProductNameTitle"/> + <see userInput="{{product.name}}" selector="{{StorefrontProductInfoMainSection.productName}}" stepKey="assertProductName"/> + <see userInput="{{product.sku}}" selector="{{StorefrontProductInfoMainSection.productSku}}" stepKey="assertProductSku"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup.xml new file mode 100644 index 0000000000000..e50e5974023f8 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup"> + <annotations> + <description>Goes to the Storefront Product page for the provided Product. Validates that the Product details are present and correct.</description> + </annotations> + <arguments> + <argument name="product"/> + </arguments> + + <!-- Go to storefront product page, assert product name and sku --> + <amOnPage url="{{product.custom_attributes[url_key]}}.html" stepKey="navigateToProductPage"/> + <waitForPageLoad stepKey="waitForPageLoad2"/> + <seeInTitle userInput="{{product.name}}" stepKey="assertProductNameTitle"/> + <see userInput="{{product.name}}" selector="{{StorefrontProductInfoMainSection.productName}}" stepKey="assertProductName"/> + <see userInput="{{product.sku}}" selector="{{StorefrontProductInfoMainSection.productSku}}" stepKey="assertProductSku"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductNameInProductEditFormActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductNameInProductEditFormActionGroup.xml new file mode 100644 index 0000000000000..00f940cd4c3c8 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductNameInProductEditFormActionGroup.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertProductNameInProductEditFormActionGroup"> + <arguments> + <argument name="productName" type="string"/> + </arguments> + <seeInField selector="{{AdminProductFormSection.productName}}" userInput="{{productName}}" stepKey="seeProductNameOnEditProductPage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductOnAdminGridActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductOnAdminGridActionGroup.xml index 95f1cc2c23a37..a384e993405b9 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductOnAdminGridActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductOnAdminGridActionGroup.xml @@ -8,7 +8,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AssertProductOnAdminGridActionGroup" extends="viewProductInAdminGrid"> + <actionGroup name="AssertProductOnAdminGridActionGroup" extends="ViewProductInAdminGridActionGroup"> <annotations> <description>EXTENDS: viewProductInAdminGrid. Removes the 'clickClearFiltersAfter' step from the Action Group.</description> </annotations> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductOnCategoryPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductOnCategoryPageActionGroup.xml new file mode 100644 index 0000000000000..d35d6a4778dd6 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductOnCategoryPageActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertProductOnCategoryPageActionGroup" extends="StorefrontCheckCategorySimpleProductActionGroup"> + <annotations> + <description>EXTENDS:StorefrontCheckCategorySimpleProduct. Removes 'AssertProductPrice', 'moveMouseOverProduct', 'AssertAddToCart'</description> + </annotations> + <remove keyForRemoval="AssertProductPrice"/> + <remove keyForRemoval="moveMouseOverProduct"/> + <remove keyForRemoval="AssertAddToCart"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertTextInAdminProductRelatedUpSellCrossSellSectionActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertTextInAdminProductRelatedUpSellCrossSellSectionActionGroup.xml new file mode 100644 index 0000000000000..e59f923464250 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertTextInAdminProductRelatedUpSellCrossSellSectionActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertTextInAdminProductRelatedUpSellCrossSellSectionActionGroup"> + <annotations> + <description>Validates that provided Text appears in the provided Element on the Admin Product creation/edit page under 'Related Products, Up-Sells, and Cross-Sells' section.</description> + </annotations> + <arguments> + <argument name="element" defaultValue="AdminProductFormRelatedUpSellCrossSellSection.relatedProductSectionText"/> + <argument name="expectedText"/> + </arguments> + + <conditionalClick selector="{{AdminProductFormSection.productFormTab('Related Products')}}" dependentSelector="{{AdminProductFormSection.productFormTabState('Related Products', 'closed')}}" visible="true" stepKey="openTab"/> + <waitForPageLoad time="30" stepKey="waitForPageLoad"/> + <see selector="{{element}}" userInput="{{expectedText}}" stepKey="assertText"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertWebsiteIsAvailableInProductWebsitesActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertWebsiteIsAvailableInProductWebsitesActionGroup.xml new file mode 100644 index 0000000000000..4bd9ce0e09581 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertWebsiteIsAvailableInProductWebsitesActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertWebsiteIsAvailableInProductWebsitesActionGroup"> + <arguments> + <argument name="website" type="string"/> + </arguments> + <scrollTo selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="scrollToProductInWebsitesSection"/> + <conditionalClick selector="{{ProductInWebsitesSection.sectionHeader}}" dependentSelector="{{ProductInWebsitesSection.sectionHeaderOpened}}" visible="false" stepKey="expandProductWebsitesSection"/> + <seeElement selector="{{ProductInWebsitesSection.website(website)}}" stepKey="seeCheckboxForWebsite"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertWebsiteIsNotAvailableInProductWebsitesActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertWebsiteIsNotAvailableInProductWebsitesActionGroup.xml new file mode 100644 index 0000000000000..14eb5a40b184e --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertWebsiteIsNotAvailableInProductWebsitesActionGroup.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertWebsiteIsNotAvailableInProductWebsitesActionGroup" extends="AssertWebsiteIsAvailableInProductWebsitesActionGroup"> + <remove keyForRemoval="seeCheckboxForWebsite"/> + <dontSeeElement selector="{{ProductInWebsitesSection.website(website)}}" after="expandProductWebsitesSection" stepKey="dontSeeCheckboxForWebsite"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CategoryPresentActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CategoryPresentActionGroup.xml new file mode 100644 index 0000000000000..76aec793c4eca --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CategoryPresentActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CategoryPresentActionGroup" > + <annotations> + <description>Navigates to category page, asserts category is there. Navigates to storefront category page and asserts category is there. This action group will not work categories where name does NOT equal SEO.</description> + </annotations> + <arguments> + <argument name="categoryName" defaultValue="Test Category" type="string"/> + </arguments> + + <amOnPage url="{{AdminCategoryPage.url}}" stepKey="goToCategoryAdminPage"/> + <waitForPageLoad stepKey="waitForCategoryAdminPageLoad"/> + <see userInput="{{categoryName}}" stepKey="assertCategoryOnAdminPage" selector="{{AdminCategorySidebarTreeSection.treeContainer}}"/> + <amOnPage url="/{{categoryName}}.html" stepKey="goToCustomerFrontPage"/> + <see userInput="{{categoryName}}" stepKey="assertCategoryNameOnStorefront" selector="{{StorefrontCategoryMainSection.CategoryTitle}}"/> + <waitForPageLoad stepKey="waitForCustomerCategoryPageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ChangeSeoUrlKeyActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ChangeSeoUrlKeyActionGroup.xml new file mode 100644 index 0000000000000..7107cc2a560d1 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ChangeSeoUrlKeyActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ChangeSeoUrlKeyActionGroup"> + <annotations> + <description>Requires navigation to category creation/edit. Updates the Search Engine Optimization.</description> + </annotations> + <arguments> + <argument name="value" type="string"/> + </arguments> + + <click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="openSeoSection"/> + <fillField selector="{{AdminCategorySEOSection.UrlKeyInput}}" userInput="{{value}}" stepKey="enterURLKey"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/> + <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="assertSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ChangeSeoUrlKeyForSubCategoryActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ChangeSeoUrlKeyForSubCategoryActionGroup.xml new file mode 100644 index 0000000000000..42813aef05be5 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ChangeSeoUrlKeyForSubCategoryActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ChangeSeoUrlKeyForSubCategoryActionGroup"> + <annotations> + <description>Requires navigation to subcategory creation/edit. Updates the Search Engine Optimization.</description> + </annotations> + <arguments> + <argument name="value" type="string"/> + </arguments> + + <click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="openSeoSection"/> + <uncheckOption selector="{{AdminCategorySEOSection.UrlKeyDefaultValueCheckbox}}" stepKey="uncheckDefaultValue"/> + <fillField selector="{{AdminCategorySEOSection.UrlKeyInput}}" userInput="{{value}}" stepKey="enterURLKey"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/> + <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="assertSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ChangeStatusProductUsingProductGridActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ChangeStatusProductUsingProductGridActionGroup.xml new file mode 100644 index 0000000000000..b8e8556f53813 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ChangeStatusProductUsingProductGridActionGroup.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ChangeStatusProductUsingProductGridActionGroup"> + <annotations> + <description>Goes to the Admin Products grid page. Changes the Product Status to the provided Status. Validates that the Success Message is present and correct.</description> + </annotations> + <arguments> + <argument name="product"/> + <argument name="status" defaultValue="Enable" type="string"/> + </arguments> + + <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.multicheckDropdown}}" stepKey="openMulticheckDropdown"/> + <click selector="{{AdminProductGridSection.multicheckOption('Select All')}}" stepKey="selectAllProductInFilteredGrid"/> + + <click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickActionDropdown"/> + <click selector="{{AdminProductGridSection.bulkActionOption('Change status')}}" stepKey="clickChangeStatusAction"/> + <click selector="{{AdminProductGridSection.changeStatus('status')}}" stepKey="clickChangeStatusDisabled"/> + <waitForPageLoad stepKey="waitForStatusToBeChanged"/> + <see selector="{{AdminMessagesSection.success}}" userInput="A total of 1 record(s) have been updated." stepKey="seeSuccessMessage"/> + <waitForLoadingMaskToDisappear stepKey="waitForMaskToDisappear"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial2"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ChangeUseForPromoRuleConditionsProductAttributeActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ChangeUseForPromoRuleConditionsProductAttributeActionGroup.xml new file mode 100644 index 0000000000000..5282fe2740fc7 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ChangeUseForPromoRuleConditionsProductAttributeActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ChangeUseForPromoRuleConditionsProductAttributeActionGroup"> + <annotations> + <description>Select the provided value for the 'Use for Promo Rule Conditions' dropdown menu. Clicks on Save. Validates that the Save message is present.</description> + </annotations> + <arguments> + <argument name="option" type="string"/> + </arguments> + + <click selector="{{StorefrontPropertiesSection.StoreFrontPropertiesTab}}" stepKey="clickStoreFrontPropertiesTab"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <selectOption selector="{{StorefrontPropertiesSection.useForPromoRuleConditions}}" userInput="{{option}}" stepKey="changeOption"/> + <click selector="{{AttributePropertiesSection.Save}}" stepKey="saveAttribute"/> + <see selector="{{AdminMessagesSection.success}}" userInput="You saved the product attribute." stepKey="successMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CheckAttributeInMoreInformationTabActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CheckAttributeInMoreInformationTabActionGroup.xml new file mode 100644 index 0000000000000..548d7de79d599 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CheckAttributeInMoreInformationTabActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CheckAttributeInMoreInformationTabActionGroup"> + <annotations> + <description>Validates that the Product More Information area contains the provided Text.</description> + </annotations> + <arguments> + <argument name="attributeLabel" type="string"/> + <argument name="attributeValue" type="string"/> + </arguments> + + <click selector="{{StorefrontProductMoreInformationSection.moreInformation}}" stepKey="clickTab"/> + <see userInput="{{attributeLabel}}" selector="{{StorefrontProductMoreInformationSection.moreInformationTextArea}}" stepKey="seeAttributeLabel"/> + <see userInput="{{attributeValue}}" selector="{{StorefrontProductMoreInformationSection.moreInformationTextArea}}" stepKey="seeAttributeValue"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CheckAttributeNotInMoreInformationTabActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CheckAttributeNotInMoreInformationTabActionGroup.xml new file mode 100644 index 0000000000000..a6d744ebe92be --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CheckAttributeNotInMoreInformationTabActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CheckAttributeNotInMoreInformationTabActionGroup"> + <annotations> + <description>Validate that the More Information area does not contain the provided Text.</description> + </annotations> + <arguments> + <argument name="attributeLabel" type="string"/> + </arguments> + + <click selector="{{StorefrontProductMoreInformationSection.moreInformation}}" stepKey="clickTab"/> + <dontSee userInput="{{attributeLabel}}" selector="{{StorefrontProductMoreInformationSection.moreInformationTextArea}}" stepKey="seeAttributeLabel"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CheckCategoryImageInAdminActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CheckCategoryImageInAdminActionGroup.xml new file mode 100644 index 0000000000000..fd01d4db5babb --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CheckCategoryImageInAdminActionGroup.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CheckCategoryImageInAdminActionGroup"> + <annotations> + <description>Requires navigation to the Category creation/edit page. Click on the Upload button. Validates that the Image exists.</description> + </annotations> + <arguments> + <argument name="image" defaultValue="ProductImage"/> + </arguments> + + <conditionalClick selector="{{AdminCategoryContentSection.sectionHeader}}" dependentSelector="{{AdminCategoryContentSection.uploadButton}}" visible="false" stepKey="openContentSection"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <waitForElementVisible selector="{{AdminCategoryContentSection.uploadButton}}" stepKey="seeImageSectionIsReady"/> + <grabTextFrom selector="{{AdminCategoryContentSection.imageFileName}}" stepKey="grabCategoryFileName"/> + <assertRegExp stepKey="assertEquals" message="pass"> + <expectedResult type="string">/magento-logo(_[0-9]+)*?\.png$/</expectedResult> + <actualResult type="variable">grabCategoryFileName</actualResult> + </assertRegExp> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CheckCategoryNameIsRequiredFieldActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CheckCategoryNameIsRequiredFieldActionGroup.xml new file mode 100644 index 0000000000000..44e1951a0463b --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CheckCategoryNameIsRequiredFieldActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CheckCategoryNameIsRequiredFieldActionGroup"> + <annotations> + <description>Navigates to category page, attempts to add subcategory without name. Expects required field prompt.</description> + </annotations> + + <seeInCurrentUrl url="{{AdminCategoryPage.url}}" stepKey="seeOnCategoryPage"/> + <click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategory"/> + <clearField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" stepKey="makeNameFieldEmpty"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/> + <seeInCurrentUrl url="{{AdminCategoryPage.url}}add" stepKey="seeBackOnCreateCategoryPage"/> + <see selector="{{AdminCategoryBasicFieldSection.FieldError('uid')}}" userInput="This is a required field." stepKey="seeErrorMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CheckCategoryOnStorefrontActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CheckCategoryOnStorefrontActionGroup.xml new file mode 100644 index 0000000000000..134b3897b5e02 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CheckCategoryOnStorefrontActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CheckCategoryOnStorefrontActionGroup"> + <annotations> + <description>Navigates to the category page on the storefront and asserts that the title is correct for page and browser.</description> + </annotations> + <arguments> + <argument name="categoryEntity" defaultValue="_defaultCategory"/> + </arguments> + + <amOnPage url="/{{categoryEntity.name_lwr}}.html" stepKey="goToCategoryFrontPage"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + <see selector="{{StorefrontCategoryMainSection.CategoryTitle}}" userInput="{{categoryEntity.name_lwr}}" stepKey="assertCategoryOnStorefront"/> + <seeInTitle userInput="{{categoryEntity.name}}" stepKey="seeCategoryNameInTitle"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CheckCustomizableOptionImportActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CheckCustomizableOptionImportActionGroup.xml new file mode 100644 index 0000000000000..efd0986efca06 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CheckCustomizableOptionImportActionGroup.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CheckCustomizableOptionImportActionGroup"> + <annotations> + <description>Validate that the Custom Product Option Import value is present and correct.</description> + </annotations> + <arguments> + <argument name="option" defaultValue="ProductOptionField"/> + <argument name="optionIndex" type="string"/> + </arguments> + + <grabValueFrom selector="{{AdminProductCustomizableOptionsSection.optionTitleInput(optionIndex)}}" stepKey="grabOptionTitle"/> + <grabValueFrom selector="{{AdminProductCustomizableOptionsSection.optionPrice(optionIndex)}}" stepKey="grabOptionPrice"/> + <grabValueFrom selector="{{AdminProductCustomizableOptionsSection.optionSku(optionIndex)}}" stepKey="grabOptionSku"/> + <assertEquals expected="{{option.title}}" expectedType="string" actual="$grabOptionTitle" stepKey="assertOptionTitle"/> + <assertEquals expected="{{option.price}}" expectedType="string" actual="$grabOptionPrice" stepKey="assertOptionPrice"/> + <assertEquals expected="{{option.title}}" expectedType="string" actual="$grabOptionSku" stepKey="assertOptionSku"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CheckRequiredFieldsInProductFormActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CheckRequiredFieldsInProductFormActionGroup.xml new file mode 100644 index 0000000000000..6aaa66dc70803 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CheckRequiredFieldsInProductFormActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CheckRequiredFieldsInProductFormActionGroup"> + <annotations> + <description>Validates that the 'Required Field' error message is present and correct for the Product Name, SKU and Price fields.</description> + </annotations> + + <clearField selector="{{AdminProductFormSection.productName}}" stepKey="clearProductName"/> + <clearField selector="{{AdminProductFormSection.productSku}}" stepKey="clearProductSku"/> + <clearField selector="{{AdminProductFormSection.productPrice}}" stepKey="clearProductPrice"/> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveButton"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Product" stepKey="seeStillOnEditPage"/> + <see selector="{{AdminProductFormSection.fieldError('name')}}" userInput="This is a required field." stepKey="seeNameRequired"/> + <see selector="{{AdminProductFormSection.fieldError('sku')}}" userInput="This is a required field." stepKey="seeSkuRequired"/> + <see selector="{{AdminProductFormSection.priceFieldError}}" userInput="This is a required field." stepKey="seePriceRequired"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ClearProductsFilterActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ClearProductsFilterActionGroup.xml new file mode 100644 index 0000000000000..46960b5e25d51 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ClearProductsFilterActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ClearProductsFilterActionGroup"> + <annotations> + <description>Goto the Product grid page. Clear the Search Filters for the grid.</description> + </annotations> + + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> + <waitForPageLoad time="30" stepKey="waitForProductsPageToLoad"/> + <conditionalClick selector="{{AdminProductFiltersSection.clearFiltersButton}}" dependentSelector="{{AdminProductFiltersSection.clearFiltersButton}}" visible="true" stepKey="cleanFiltersIfTheySet"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ConfirmChangeInputTypeModalActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ConfirmChangeInputTypeModalActionGroup.xml new file mode 100644 index 0000000000000..d207073a01fc0 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ConfirmChangeInputTypeModalActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ConfirmChangeInputTypeModalActionGroup"> + <annotations> + <description>Clicks on the Confirm button for the 'Product Data My Be Lost' modal.</description> + </annotations> + + <waitForElementVisible selector="{{AdminEditProductAttributesSection.ProductDataMayBeLostConfirmButton}}" stepKey="waitForChangeInputTypeButton"/> + <click selector="{{AdminEditProductAttributesSection.ProductDataMayBeLostConfirmButton}}" stepKey="clickChangeInputTypeButton"/> + <waitForElementNotVisible selector="{{AdminEditProductAttributesSection.ProductDataMayBeLostModal}}" stepKey="waitForChangeInputTypeModalGone"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateAttributeDropdownNthOptionActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateAttributeDropdownNthOptionActionGroup.xml new file mode 100644 index 0000000000000..2bf79ca980a44 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateAttributeDropdownNthOptionActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateAttributeDropdownNthOptionActionGroup"> + <annotations> + <description>Creates an Option for a Product Attribute (Attribute Type: Dropdown).</description> + </annotations> + <arguments> + <argument name="row" type="string"/> + <argument name="adminName" type="string"/> + <argument name="frontName" type="string"/> + </arguments> + + <click stepKey="clickAddOptions" selector="{{AttributePropertiesSection.dropdownAddOptions}}"/> + <waitForPageLoad stepKey="waitForNewOption"/> + <fillField stepKey="fillAdmin" selector="{{AttributePropertiesSection.dropdownNthOptionAdmin(row)}}" userInput="{{adminName}}"/> + <fillField stepKey="fillStoreView" selector="{{AttributePropertiesSection.dropdownNthOptionDefaultStoreView(row)}}" userInput="{{frontName}}"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateAttributeDropdownNthOptionAsDefaultActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateAttributeDropdownNthOptionAsDefaultActionGroup.xml new file mode 100644 index 0000000000000..e9e8a98ac86a6 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateAttributeDropdownNthOptionAsDefaultActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateAttributeDropdownNthOptionAsDefaultActionGroup" extends="CreateAttributeDropdownNthOptionActionGroup"> + <annotations> + <description>EXTENDS: createAttributeDropdownNthOption. Checks the 'Is Default' option.</description> + </annotations> + + <checkOption selector="{{AttributePropertiesSection.dropdownNthOptionIsDefault(row)}}" stepKey="setAsDefault" after="fillStoreView"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateCategoryActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateCategoryActionGroup.xml new file mode 100644 index 0000000000000..660b475c02ab0 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateCategoryActionGroup.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateCategoryActionGroup"> + <annotations> + <description>Requires navigation to the Category creation page. Adds a new Subcategory. Validates that the Category was created.</description> + </annotations> + <arguments> + <argument name="categoryEntity" defaultValue="_defaultCategory"/> + </arguments> + + <seeInCurrentUrl url="{{AdminCategoryPage.url}}" stepKey="seeOnCategoryPage"/> + <click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategory"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Category" stepKey="seeCategoryPageTitle"/> + <fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{categoryEntity.name}}" stepKey="enterCategoryName"/> + <click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="openSEO"/> + <fillField selector="{{AdminCategorySEOSection.UrlKeyInput}}" userInput="{{categoryEntity.name_lwr}}" stepKey="enterURLKey"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/> + <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="assertSuccess"/> + <seeInTitle userInput="{{categoryEntity.name}}" stepKey="seeNewCategoryPageTitle"/> + <seeElement selector="{{AdminCategorySidebarTreeSection.categoryInTree(categoryEntity.name)}}" stepKey="seeCategoryInTree"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateCustomRadioOptionsActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateCustomRadioOptionsActionGroup.xml new file mode 100644 index 0000000000000..8ac87a30afbf6 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateCustomRadioOptionsActionGroup.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateCustomRadioOptionsActionGroup"> + <annotations> + <description>Adds a custom Radio Product Option with 3 Radio Options to a Product based on the provided Options.</description> + </annotations> + <!-- ActionGroup will add a single custom option to a product --> + <!-- You must already be on the product creation page --> + <arguments> + <argument name="customOptionName"/> + <argument name="productOption"/> + <argument name="productOption2"/> + </arguments> + + <click stepKey="clickAddOptions" selector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}"/> + <waitForPageLoad stepKey="waitForAddProductPageLoad"/> + + <!-- Fill in the option and select the type of radio (once) --> + <fillField stepKey="fillInOptionTitle" selector="{{AdminProductCustomizableOptionsSection.lastOptionTitle}}" userInput="{{customOptionName}}"/> + <click stepKey="clickOptionTypeParent" selector="{{AdminProductCustomizableOptionsSection.lastOptionTypeParent}}"/> + <waitForPageLoad stepKey="waitForDropdownOpen"/> + <click stepKey="clickOptionType" selector="{{AdminProductCustomizableOptionsSection.optionType('Radio Buttons')}}"/> + + <!-- Add three radio options based on the parameter --> + <click stepKey="clickAddValue" selector="{{AdminProductCustomizableOptionsSection.addValue}}"/> + + <fillField stepKey="fillInValueTitle" selector="{{AdminProductCustomizableOptionsSection.valueTitle}}" userInput="{{productOption.title}}"/> + <fillField stepKey="fillInValuePrice" selector="{{AdminProductCustomizableOptionsSection.valuePrice}}" userInput="{{productOption.price}}"/> + + <click stepKey="clickAddValue2" selector="{{AdminProductCustomizableOptionsSection.addValue}}"/> + + <fillField stepKey="fillInValueTitle2" selector="{{AdminProductCustomizableOptionsSection.valueTitle}}" userInput="{{productOption2.title}}"/> + <fillField stepKey="fillInValuePrice2" selector="{{AdminProductCustomizableOptionsSection.valuePrice}}" userInput="{{productOption2.price}}"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateDefaultAttributeSetActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateDefaultAttributeSetActionGroup.xml new file mode 100644 index 0000000000000..8b95a77465b01 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateDefaultAttributeSetActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateDefaultAttributeSetActionGroup"> + <annotations> + <description>Goes to the Attribute Sets grid page. Clicks on Add. Fill Name. Clicks on Save.</description> + </annotations> + <arguments> + <argument name="label" type="string"/> + </arguments> + + <amOnPage url="{{AdminProductAttributeSetGridPage.url}}" stepKey="goToAttributeSets"/> + <waitForPageLoad stepKey="wait1"/> + <click selector="{{AdminProductAttributeSetGridSection.addAttributeSetBtn}}" stepKey="clickAddAttributeSet"/> + <fillField selector="{{AdminProductAttributeSetSection.name}}" userInput="{{label}}" stepKey="fillName"/> + <click selector="{{AdminProductAttributeSetSection.saveBtn}}" stepKey="clickSave1"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateProductAttributeActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateProductAttributeActionGroup.xml new file mode 100644 index 0000000000000..0a0c95fdb33cc --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateProductAttributeActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateProductAttributeActionGroup"> + <annotations> + <description>Clicks on 'Add New Attribute'. Fills in the Attribute Details (Label, Input Type and Value Required). Clicks on Save.</description> + </annotations> + <arguments> + <argument name="attribute" type="entity" defaultValue="productAttributeWysiwyg"/> + </arguments> + + <click stepKey="createNewAttribute" selector="{{AdminProductAttributeGridSection.createNewAttributeBtn}}"/> + <fillField stepKey="fillDefaultLabel" selector="{{AttributePropertiesSection.DefaultLabel}}" userInput="{{attribute.attribute_code}}"/> + <selectOption selector="{{AttributePropertiesSection.InputType}}" stepKey="checkInputType" userInput="{{attribute.frontend_input}}"/> + <selectOption selector="{{AttributePropertiesSection.ValueRequired}}" stepKey="checkRequired" userInput="{{attribute.is_required_admin}}"/> + <click stepKey="saveAttribute" selector="{{AttributePropertiesSection.Save}}"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateProductAttributeWithDateFieldActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateProductAttributeWithDateFieldActionGroup.xml new file mode 100644 index 0000000000000..13b1bca0ad40b --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateProductAttributeWithDateFieldActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateProductAttributeWithDateFieldActionGroup" extends="CreateProductAttributeActionGroup" insertAfter="checkRequired"> + <annotations> + <description>EXTENDS: createProductAttribute. Fills in the Attribute Code and Default Value (Attribute Type: Date Field).</description> + </annotations> + <arguments> + <argument name="date" type="string"/> + </arguments> + + <click stepKey="openAdvancedProperties" selector="{{AdvancedAttributePropertiesSection.AdvancedAttributePropertiesSectionToggle}}"/> + <fillField stepKey="fillCode" selector="{{AdvancedAttributePropertiesSection.AttributeCode}}" userInput="{{attribute.attribute_code}}"/> + <fillField stepKey="fillDefaultValue" selector="{{AdvancedAttributePropertiesSection.DefaultValueDate}}" userInput="{{date}}"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateProductAttributeWithTextFieldActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateProductAttributeWithTextFieldActionGroup.xml new file mode 100644 index 0000000000000..fccb8ad2413f8 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateProductAttributeWithTextFieldActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateProductAttributeWithTextFieldActionGroup" extends="CreateProductAttributeActionGroup" insertAfter="checkRequired"> + <annotations> + <description>EXTENDS: createProductAttribute. Fills in the Attribute Code and Default Value (Attribute Type: Text Field).</description> + </annotations> + + <click stepKey="openAdvancedProperties" selector="{{AdvancedAttributePropertiesSection.AdvancedAttributePropertiesSectionToggle}}"/> + <fillField stepKey="fillCode" selector="{{AdvancedAttributePropertiesSection.AttributeCode}}" userInput="{{attribute.attribute_code}}"/> + <fillField stepKey="fillDefaultValue" selector="{{AdvancedAttributePropertiesSection.DefaultValueText}}" userInput="{{attribute.default_value}}"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateSimpleProductAndAddToWebsiteActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateSimpleProductAndAddToWebsiteActionGroup.xml new file mode 100644 index 0000000000000..97c7072abe42f --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateSimpleProductAndAddToWebsiteActionGroup.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateSimpleProductAndAddToWebsiteActionGroup"> + <annotations> + <description>Goes to the Admin Product grid page. Clicks on Add Product. Fills the provided Product Details (Name, SKU, Price, Quantity and Website). Clicks on Save.</description> + </annotations> + <arguments> + <argument name="product"/> + <argument name="website" type="string"/> + </arguments> + + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToCatalogProductGrid"/> + <waitForPageLoad stepKey="waitForProductGrid"/> + <click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductDropdown"/> + <click selector="{{AdminProductGridActionSection.addSimpleProduct}}" stepKey="clickAddSimpleProduct"/> + <fillField userInput="{{product.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="fillProductName"/> + <fillField userInput="{{product.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="fillProductSKU"/> + <fillField userInput="{{product.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="fillProductPrice"/> + <fillField userInput="{{product.quantity}}" selector="{{AdminProductFormSection.productQuantity}}" stepKey="fillProductQuantity"/> + <click selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="openProductInWebsites"/> + <click selector="{{ProductInWebsitesSection.website(website)}}" stepKey="selectWebsite"/> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSave"/> + <waitForLoadingMaskToDisappear stepKey="waitForProductPageSave"/> + <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSaveProductMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreatedProductConnectToWebsiteActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreatedProductConnectToWebsiteActionGroup.xml new file mode 100644 index 0000000000000..d605aa1910134 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreatedProductConnectToWebsiteActionGroup.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreatedProductConnectToWebsiteActionGroup"> + <annotations> + <description>Clicks on 'Edit' for the provided Product. Clicks on the provided Website. Clicks on Save.</description> + </annotations> + <arguments> + <argument name="website"/> + <argument name="product"/> + </arguments> + + <click stepKey="openProduct" selector="{{AdminProductGridActionSection.productName(product.sku)}}"/> + <waitForPageLoad stepKey="waitForProductPage"/> + <scrollTo selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="ScrollToWebsites"/> + <click selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="openWebsitesList"/> + <waitForPageLoad stepKey="waitForWebsitesList"/> + <click selector="{{ProductInWebsitesSection.website(website.name)}}" stepKey="SelectWebsite"/> + <click selector="{{AdminProductFormAdvancedPricingSection.save}}" stepKey="clickSaveProduct"/> + <waitForPageLoad stepKey="waitForSave"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CustomOptionsActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CustomOptionsActionGroup.xml deleted file mode 100644 index 753f06cd75e3e..0000000000000 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CustomOptionsActionGroup.xml +++ /dev/null @@ -1,172 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="CreateCustomRadioOptions"> - <annotations> - <description>Adds a custom Radio Product Option with 3 Radio Options to a Product based on the provided Options.</description> - </annotations> - <!-- ActionGroup will add a single custom option to a product --> - <!-- You must already be on the product creation page --> - <arguments> - <argument name="customOptionName"/> - <argument name="productOption"/> - <argument name="productOption2"/> - </arguments> - - <click stepKey="clickAddOptions" selector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}"/> - <waitForPageLoad stepKey="waitForAddProductPageLoad"/> - - <!-- Fill in the option and select the type of radio (once) --> - <fillField stepKey="fillInOptionTitle" selector="{{AdminProductCustomizableOptionsSection.lastOptionTitle}}" userInput="{{customOptionName}}"/> - <click stepKey="clickOptionTypeParent" selector="{{AdminProductCustomizableOptionsSection.lastOptionTypeParent}}"/> - <waitForPageLoad stepKey="waitForDropdownOpen"/> - <click stepKey="clickOptionType" selector="{{AdminProductCustomizableOptionsSection.optionType('Radio Buttons')}}"/> - - <!-- Add three radio options based on the parameter --> - <click stepKey="clickAddValue" selector="{{AdminProductCustomizableOptionsSection.addValue}}"/> - - <fillField stepKey="fillInValueTitle" selector="{{AdminProductCustomizableOptionsSection.valueTitle}}" userInput="{{productOption.title}}"/> - <fillField stepKey="fillInValuePrice" selector="{{AdminProductCustomizableOptionsSection.valuePrice}}" userInput="{{productOption.price}}"/> - - <click stepKey="clickAddValue2" selector="{{AdminProductCustomizableOptionsSection.addValue}}"/> - - <fillField stepKey="fillInValueTitle2" selector="{{AdminProductCustomizableOptionsSection.valueTitle}}" userInput="{{productOption2.title}}"/> - <fillField stepKey="fillInValuePrice2" selector="{{AdminProductCustomizableOptionsSection.valuePrice}}" userInput="{{productOption2.price}}"/> - </actionGroup> - - <!--Add a custom option of type "file" to a product--> - <actionGroup name="AddProductCustomOptionFile"> - <annotations> - <description>Add a custom File Product Option to a Product based on the provided File.</description> - </annotations> - <arguments> - <argument name="option" defaultValue="ProductOptionFile"/> - </arguments> - - <conditionalClick selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" visible="false" stepKey="openCustomOptionSection"/> - <click selector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" stepKey="clickAddOption"/> - <waitForElementVisible selector="{{AdminProductCustomizableOptionsSection.lastOptionTitle}}" stepKey="waitForOption"/> - <fillField selector="{{AdminProductCustomizableOptionsSection.lastOptionTitle}}" userInput="{{option.title}}" stepKey="fillTitle"/> - <click selector="{{AdminProductCustomizableOptionsSection.lastOptionTypeParent}}" stepKey="openTypeSelect"/> - <click selector="{{AdminProductCustomizableOptionsSection.optionType('File')}}" stepKey="selectTypeFile"/> - <waitForElementVisible selector="{{AdminProductCustomizableOptionsSection.optionPriceByTitle(option.title)}}" stepKey="waitForElements"/> - <fillField selector="{{AdminProductCustomizableOptionsSection.optionPriceByTitle(option.title)}}" userInput="{{option.price}}" stepKey="fillPrice"/> - <selectOption selector="{{AdminProductCustomizableOptionsSection.optionPriceTypeByTitle(option.title)}}" userInput="{{option.price_type}}" stepKey="selectPriceType"/> - <fillField selector="{{AdminProductCustomizableOptionsSection.optionFileExtensionByTitle(option.title)}}" userInput="{{option.file_extension}}" stepKey="fillCompatibleExtensions"/> - </actionGroup> - - <actionGroup name="AddProductCustomOptionField"> - <annotations> - <description>Add a custom Field Product Option to a Product based on the provided Option.</description> - </annotations> - <arguments> - <argument name="option" defaultValue="ProductOptionField"/> - </arguments> - - <scrollTo selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" stepKey="scrollToAddButtonOption"/> - <conditionalClick selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" visible="false" stepKey="openCustomOptionSection"/> - <click selector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" stepKey="clickAddOption"/> - <waitForElementVisible selector="{{AdminProductCustomizableOptionsSection.lastOptionTitle}}" stepKey="waitForOption"/> - <fillField selector="{{AdminProductCustomizableOptionsSection.lastOptionTitle}}" userInput="{{option.title}}" stepKey="fillTitle"/> - <click selector="{{AdminProductCustomizableOptionsSection.lastOptionTypeParent}}" stepKey="openTypeSelect"/> - <click selector="{{AdminProductCustomizableOptionsSection.optionType('Field')}}" stepKey="selectTypeFile"/> - <waitForElementVisible selector="{{AdminProductCustomizableOptionsSection.optionPriceByTitle(option.title)}}" stepKey="waitForElements"/> - <fillField selector="{{AdminProductCustomizableOptionsSection.optionPriceByTitle(option.title)}}" userInput="{{option.price}}" stepKey="fillPrice"/> - <selectOption selector="{{AdminProductCustomizableOptionsSection.optionPriceTypeByTitle(option.title)}}" userInput="{{option.price_type}}" stepKey="selectPriceType"/> - <fillField selector="{{AdminProductCustomizableOptionsSection.optionSkuByTitle(option.title)}}" userInput="{{option.title}}" stepKey="fillSku"/> - </actionGroup> - - <actionGroup name="importProductCustomizableOptions"> - <annotations> - <description>Import custom Product Options for the provided Product Name.</description> - </annotations> - <arguments> - <argument name="productName" type="string"/> - </arguments> - - <click selector="{{AdminProductCustomizableOptionsSection.importOptions}}" stepKey="clickImportOptions"/> - <waitForElementVisible selector="{{AdminProductImportOptionsSection.selectProductTitle}}" stepKey="waitForTitleVisible"/> - <conditionalClick selector="{{AdminProductImportOptionsSection.resetFiltersButton}}" dependentSelector="{{AdminProductImportOptionsSection.resetFiltersButton}}" visible="true" stepKey="clickResetFilters"/> - <click selector="{{AdminProductImportOptionsSection.filterButton}}" stepKey="clickFilterButton"/> - <waitForElementVisible selector="{{AdminProductImportOptionsSection.nameField}}" stepKey="waitForNameField"/> - <fillField selector="{{AdminProductImportOptionsSection.nameField}}" userInput="{{productName}}" stepKey="fillProductName"/> - <click selector="{{AdminProductImportOptionsSection.applyFiltersButton}}" stepKey="clickApplyFilters"/> - <checkOption selector="{{AdminProductImportOptionsSection.firstRowItemCheckbox}}" stepKey="checkProductCheckbox"/> - <click selector="{{AdminProductImportOptionsSection.importButton}}" stepKey="clickImport"/> - </actionGroup> - - <actionGroup name="resetImportOptionFilter"> - <annotations> - <description>Click on the Reset Filters button for the Import Options filters on the Product grid page.</description> - </annotations> - - <conditionalClick selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" visible="false" stepKey="openCustomOptionSection"/> - <click selector="{{AdminProductCustomizableOptionsSection.importOptions}}" stepKey="clickImportOptions"/> - <click selector="{{AdminProductImportOptionsSection.resetFiltersButton}}" stepKey="clickResetFilterButton"/> - </actionGroup> - - <actionGroup name="checkCustomizableOptionImport"> - <annotations> - <description>Validate that the Custom Product Option Import value is present and correct.</description> - </annotations> - <arguments> - <argument name="option" defaultValue="ProductOptionField"/> - <argument name="optionIndex" type="string"/> - </arguments> - - <grabValueFrom selector="{{AdminProductCustomizableOptionsSection.optionTitleInput(optionIndex)}}" stepKey="grabOptionTitle"/> - <grabValueFrom selector="{{AdminProductCustomizableOptionsSection.optionPrice(optionIndex)}}" stepKey="grabOptionPrice"/> - <grabValueFrom selector="{{AdminProductCustomizableOptionsSection.optionSku(optionIndex)}}" stepKey="grabOptionSku"/> - <assertEquals expected="{{option.title}}" expectedType="string" actual="$grabOptionTitle" stepKey="assertOptionTitle"/> - <assertEquals expected="{{option.price}}" expectedType="string" actual="$grabOptionPrice" stepKey="assertOptionPrice"/> - <assertEquals expected="{{option.title}}" expectedType="string" actual="$grabOptionSku" stepKey="assertOptionSku"/> - </actionGroup> - <!-- Assumes we are on product edit page --> - <actionGroup name="AdminDeleteAllProductCustomOptions"> - <conditionalClick selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.checkIfCustomizableOptionsTabOpen}}" visible="true" stepKey="expandContentTab"/> - <waitForPageLoad time="10" stepKey="waitCustomizableOptionsTabOpened"/> - <executeInSelenium function="function($webdriver) use ($I) { - $buttons = $webdriver->findElements(\Facebook\WebDriver\WebDriverBy::cssSelector('[data-index=\'options\'] [data-index=\'delete_button\']')); - while(!empty($buttons)) { - $button = reset($buttons); - $I->executeJS('arguments[0].scrollIntoView(false)', [$button]); - $button->click(); - $webdriver->wait()->until(\Facebook\WebDriver\WebDriverExpectedCondition::stalenessOf($button)); - $buttons = $webdriver->findElements(\Facebook\WebDriver\WebDriverBy::cssSelector('[data-index=\'options\'] [data-index=\'delete_button\']')); - } - }" stepKey="deleteCustomOptions"/> - <dontSeeElement selector="{{AdminProductCustomizableOptionsSection.customOptionButtonDelete}}" stepKey="assertNoCustomOptions"/> - </actionGroup> - <!-- Assumes we are on product edit page --> - <actionGroup name="AdminAssertProductHasNoCustomOptions"> - <conditionalClick selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.checkIfCustomizableOptionsTabOpen}}" visible="true" stepKey="expandContentTab"/> - <waitForPageLoad time="10" stepKey="waitCustomizableOptionsTabOpened"/> - <dontSeeElement selector="{{AdminProductCustomizableOptionsSection.customOption}}" stepKey="assertNoCustomOptions"/> - </actionGroup> - <!-- Assumes we are on product edit page --> - <actionGroup name="AdminAssertProductHasNoCustomOption" extends="AdminAssertProductCustomOptionVisible"> - <remove keyForRemoval="assertCustomOptionVisible"/> - <dontSeeElement selector="{{AdminProductCustomizableOptionsSection.fillOptionTitle(option.title)}}" after="waitCustomizableOptionsTabOpened" stepKey="assertNoCustomOption"/> - </actionGroup> - <!-- Assumes we are on product edit page --> - <actionGroup name="AdminAssertProductCustomOptionVisible"> - <arguments> - <argument name="option" defaultValue="ProductOptionField"/> - </arguments> - <conditionalClick selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.checkIfCustomizableOptionsTabOpen}}" visible="true" stepKey="expandContentTab"/> - <waitForPageLoad time="10" stepKey="waitCustomizableOptionsTabOpened"/> - <seeElement selector="{{AdminProductCustomizableOptionsSection.fillOptionTitle(option.title)}}" stepKey="assertCustomOptionVisible"/> - </actionGroup> - <!-- Assumes we are on product edit page --> - <actionGroup name="AdminDeleteProductCustomOption" extends="AdminAssertProductCustomOptionVisible"> - <remove keyForRemoval="assertCustomOptionVisible"/> - <click selector="{{AdminProductCustomizableOptionsSection.deleteCustomOptions(option.title)}}" after="waitCustomizableOptionsTabOpened" stepKey="clickDeleteCustomOption"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteAllDuplicateProductUsingProductGridActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteAllDuplicateProductUsingProductGridActionGroup.xml new file mode 100644 index 0000000000000..8dabf2037bf39 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteAllDuplicateProductUsingProductGridActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DeleteAllDuplicateProductUsingProductGridActionGroup" extends="DeleteProductUsingProductGridActionGroup"> + <annotations> + <description>EXTENDS: deleteProductUsingProductGrid. Removes 'seeProductSkuInGrid'.</description> + </annotations> + <arguments> + <argument name="product"/> + </arguments> + + <remove keyForRemoval="seeProductSkuInGrid"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteAllProductsUsingProductGridActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteAllProductsUsingProductGridActionGroup.xml new file mode 100644 index 0000000000000..3609d992a9f0b --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteAllProductsUsingProductGridActionGroup.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DeleteAllProductsUsingProductGridActionGroup"> + <annotations> + <description>Deletes all products in Admin Products grid page.</description> + </annotations> + + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="openAdminGridProductsPage"/> + <waitForPageLoad time="60" stepKey="waitForPageFullyLoad"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clearGridFilters"/> + + <conditionalClick selector="{{AdminProductGridSection.multicheckDropdown}}" dependentSelector="{{AdminDataGridTableSection.dataGridEmpty}}" visible="false" stepKey="openMulticheckDropdown"/> + <conditionalClick selector="{{AdminProductGridSection.multicheckOption('Select All')}}" dependentSelector="{{AdminDataGridTableSection.dataGridEmpty}}" visible="false" stepKey="selectAllProductsInGrid"/> + <click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickActionDropdown"/> + <click selector="{{AdminProductGridSection.bulkActionOption('Delete')}}" stepKey="clickDeleteAction"/> + + <waitForElementVisible selector="{{AdminConfirmationModalSection.message}}" stepKey="waitForConfirmModal"/> + <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmDelete"/> + <waitForElementVisible selector="{{AdminDataGridTableSection.dataGridEmpty}}" stepKey="waitGridIsEmpty"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteAttributeSetByLabelActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteAttributeSetByLabelActionGroup.xml new file mode 100644 index 0000000000000..c0586367fcaf6 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteAttributeSetByLabelActionGroup.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DeleteAttributeSetByLabelActionGroup"> + <annotations> + <description>Deletes the provided Attribute Set Name from the Attribute Sets grid page.</description> + </annotations> + <arguments> + <argument name="label" type="string"/> + </arguments> + + <amOnPage url="{{AdminProductAttributeSetGridPage.url}}" stepKey="goToAttributeSets"/> + <waitForPageLoad stepKey="waitForAttributeSetPageLoad"/> + <fillField selector="{{AdminProductAttributeSetGridSection.filter}}" userInput="{{label}}" stepKey="filterByName"/> + <click selector="{{AdminProductAttributeSetGridSection.searchBtn}}" stepKey="clickSearch"/> + <click selector="{{AdminProductAttributeSetGridSection.nthRow('1')}}" stepKey="clickFirstRow"/> + <waitForPageLoad stepKey="waitForClick"/> + <click selector="{{AdminProductAttributeSetSection.deleteBtn}}" stepKey="clickDelete"/> + <click selector="{{AdminProductAttributeSetSection.modalOk}}" stepKey="confirmDelete"/> + <waitForPageLoad stepKey="waitForDeleteToFinish"/> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="The attribute set has been removed." stepKey="seeDeleteMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteCategoryActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteCategoryActionGroup.xml new file mode 100644 index 0000000000000..a84e92fcbb0f5 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteCategoryActionGroup.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DeleteCategoryActionGroup"> + <annotations> + <description>Navigates to the category page and deletes the specified category.</description> + </annotations> + <arguments> + <argument name="categoryEntity" defaultValue="_defaultCategory"/> + </arguments> + + <amOnPage url="{{AdminCategoryPage.url}}" stepKey="goToCategoryPage"/> + <waitForPageLoad time="60" stepKey="waitForCategoryPageLoad"/> + <click selector="{{AdminCategorySidebarTreeSection.categoryInTree(categoryEntity.name)}}" stepKey="clickCategoryLink"/> + <click selector="{{AdminCategoryMainActionsSection.DeleteButton}}" stepKey="clickDelete"/> + <waitForElementVisible selector="{{AdminCategoryModalSection.message}}" stepKey="waitForConfirmationModal"/> + <see selector="{{AdminCategoryModalSection.message}}" userInput="Are you sure you want to delete this category?" stepKey="seeDeleteConfirmationMessage"/> + <click selector="{{AdminCategoryModalSection.ok}}" stepKey="confirmDelete"/> + <waitForPageLoad time="60" stepKey="waitForDeleteToFinish"/> + <see selector="You deleted the category." stepKey="seeDeleteSuccess"/> + <click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="expandToSeeAllCategories"/> + <dontSee selector="{{AdminCategorySidebarTreeSection.categoryInTree(categoryEntity.name)}}" stepKey="dontSeeCategoryInTree"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteDefaultCategoryChildrenActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteDefaultCategoryChildrenActionGroup.xml new file mode 100644 index 0000000000000..2fb4e0e05887a --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteDefaultCategoryChildrenActionGroup.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DeleteDefaultCategoryChildrenActionGroup"> + <annotations> + <description>Deletes all children categories of Default Root Category.</description> + </annotations> + + <amOnPage url="{{AdminCategoryPage.url}}" stepKey="navigateToAdminCategoryPage"/> + <executeInSelenium function="function ($webdriver) use ($I) { + $children = $webdriver->findElements(\Facebook\WebDriver\WebDriverBy::xpath('//ul[contains(@class, \'x-tree-node-ct\')]/li[@class=\'x-tree-node\' and contains(., + \'{{DefaultCategory.name}}\')]/ul[contains(@class, \'x-tree-node-ct\')]/li//a')); + while (!empty($children)) { + $I->click('//ul[contains(@class, \'x-tree-node-ct\')]/li[@class=\'x-tree-node\' and contains(., + \'{{DefaultCategory.name}}\')]/ul[contains(@class, \'x-tree-node-ct\')]/li//a'); + $I->waitForPageLoad(30); + $I->click('#delete'); + $I->waitForElementVisible('aside.confirm .modal-footer button.action-accept'); + $I->click('aside.confirm .modal-footer button.action-accept'); + $I->waitForPageLoad(30); + $I->waitForElementVisible('#messages div.message-success', 30); + $I->see('You deleted the category.', '#messages div.message-success'); + $children = $webdriver->findElements(\Facebook\WebDriver\WebDriverBy::xpath('//ul[contains(@class, \'x-tree-node-ct\')]/li[@class=\'x-tree-node\' and contains(., + \'{{DefaultCategory.name}}\')]/ul[contains(@class, \'x-tree-node-ct\')]/li//a')); + } + }" stepKey="deleteAllChildCategories"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteMostRecentCategoryActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteMostRecentCategoryActionGroup.xml new file mode 100644 index 0000000000000..8b47b6375c21c --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteMostRecentCategoryActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DeleteMostRecentCategoryActionGroup"> + <annotations> + <description>Actions to delete the category last made (the last category on the list).</description> + </annotations> + + <amOnPage url="/{{AdminCategoryPage.url}}" stepKey="goToCategoryFrontPage"/> + <waitForPageLoad stepKey="waitForCategoryPageLoad"/> + <click stepKey="goToCreateCategory" selector="{{AdminCategorySidebarTreeSection.lastCreatedCategory}}"/> + <waitForPageLoad stepKey="waitForCreatedCategoryPageLoad"/> + <click stepKey="clickDeleteCategory" selector="{{AdminCategoryMainActionsSection.DeleteButton}}"/> + <waitForPageLoad stepKey="waitForModalVisible"/> + <click stepKey="clickOkToDelete" selector="{{AdminCategoryModalSection.ok}}"/> + <waitForPageLoad stepKey="waitForModalNotVisible"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductAttributeActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductAttributeActionGroup.xml new file mode 100644 index 0000000000000..8ea0e43d0307f --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductAttributeActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DeleteProductAttributeActionGroup" extends="NavigateToCreatedProductAttributeActionGroup"> + <annotations> + <description>EXTENDS: navigateToCreatedProductAttribute. Deletes the Product Attribute. Validates that the success message is present.</description> + </annotations> + + <click selector="{{AttributePropertiesSection.DeleteAttribute}}" stepKey="deleteAttribute"/> + <click selector="{{ModalConfirmationSection.OkButton}}" stepKey="ClickOnDeleteButton"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="waitForSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductAttributeByAttributeCodeActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductAttributeByAttributeCodeActionGroup.xml index 66d4378872605..7fbf6a9b2a178 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductAttributeByAttributeCodeActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductAttributeByAttributeCodeActionGroup.xml @@ -10,15 +10,21 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="DeleteProductAttributeByAttributeCodeActionGroup"> <annotations> - <description>Delete a Product Attribute from the Product Attribute creation/edit page.</description> + <description>Goes to the Admin Product Attributes grid page. Filters the grid for the provided Product Attribute Code. Deletes the Product Attribute from the grid. Validates that the Success Message is present.</description> </annotations> <arguments> - <argument name="productAttributeCode" type="string"/> + <argument name="ProductAttributeCode" type="string"/> </arguments> - - <waitForPageLoad stepKey="waitForViewAdminProductAttributeLoad" time="30"/> + + <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/> + <waitForPageLoad stepKey="waitForAttributeGridPageLoad"/> + <fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" userInput="{{ProductAttributeCode}}" stepKey="setAttributeCode"/> + <click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="searchForAttributeFromTheGrid"/> + <click selector="{{AdminProductAttributeGridSection.FirstRow}}" stepKey="clickOnAttributeRow"/> + <waitForPageLoad stepKey="waitForPageLoad2"/> <click selector="{{AttributePropertiesSection.DeleteAttribute}}" stepKey="deleteAttribute"/> - <click selector="{{ModalConfirmationSection.OkButton}}" stepKey="clickOnConfirmOk"/> - <waitForPageLoad stepKey="waitForViewProductAttributePageLoad"/> + <click selector="{{ModalConfirmationSection.OkButton}}" stepKey="ClickOnDeleteButton"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="waitForSuccessMessage"/> </actionGroup> </actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductAttributeByLabelActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductAttributeByLabelActionGroup.xml new file mode 100644 index 0000000000000..fb78909eab0b6 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductAttributeByLabelActionGroup.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DeleteProductAttributeByLabelActionGroup"> + <annotations> + <description>Goes to the Admin Product Attributes grid page. Filters the grid for the provided Product Attribute (Label). Deletes the Product Attribute from the grid. Validates that the Success Message is present.</description> + </annotations> + <arguments> + <argument name="ProductAttribute"/> + </arguments> + + <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/> + <fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" userInput="{{ProductAttribute.default_label}}" stepKey="setAttributeCode"/> + <click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="searchForAttributeFromTheGrid"/> + <click selector="{{AdminProductAttributeGridSection.FirstRow}}" stepKey="clickOnAttributeRow"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <click selector="{{AttributePropertiesSection.DeleteAttribute}}" stepKey="deleteAttribute"/> + <click selector="{{ModalConfirmationSection.OkButton}}" stepKey="ClickOnDeleteButton"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="waitForSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductByNameActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductByNameActionGroup.xml new file mode 100644 index 0000000000000..0541a5ba67d30 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductByNameActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DeleteProductByNameActionGroup" extends="DeleteProductBySkuActionGroup"> + <annotations> + <description>EXTENDS: deleteProductBySku. Deletes the provided Product Name.</description> + </annotations> + <arguments> + <argument name="sku" type="string" defaultValue=""/> + <argument name="name" type="string"/> + </arguments> + + <remove keyForRemoval="fillProductSkuFilter"/> + <fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="{{name}}" stepKey="fillProductSkuFilter" after="openProductFilters"/> + <remove keyForRemoval="seeProductSkuInGrid"/> + <see selector="{{AdminProductGridSection.productGridCell('1', 'Name')}}" userInput="{{name}}" stepKey="seeProductNameInGrid" after="clickApplyFilters"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductBySkuActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductBySkuActionGroup.xml new file mode 100644 index 0000000000000..c1f22920ceb99 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductBySkuActionGroup.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DeleteProductBySkuActionGroup"> + <annotations> + <description>Goes to the Admin Products grid page. Deletes the provided Product SKU.</description> + </annotations> + <arguments> + <argument name="sku" type="string"/> + </arguments> + + <!--TODO use other action group for filtering grid when MQE-539 is implemented --> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{sku}}" stepKey="fillProductSkuFilter"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> + <see selector="{{AdminProductGridSection.productGridCell('1', 'SKU')}}" userInput="{{sku}}" stepKey="seeProductSkuInGrid"/> + <click selector="{{AdminProductGridSection.multicheckDropdown}}" stepKey="openMulticheckDropdown"/> + <click selector="{{AdminProductGridSection.multicheckOption('Select All')}}" stepKey="selectAllProductInFilteredGrid"/> + <click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickActionDropdown"/> + <click selector="{{AdminProductGridSection.bulkActionOption('Delete')}}" stepKey="clickDeleteAction"/> + <waitForElementVisible selector="{{AdminConfirmationModalSection.ok}}" stepKey="waitForConfirmModal"/> + <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmProductDelete"/> + <see selector="{{AdminMessagesSection.success}}" userInput="record(s) have been deleted." stepKey="seeSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductUsingProductGridActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductUsingProductGridActionGroup.xml new file mode 100644 index 0000000000000..95ad1d743690e --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductUsingProductGridActionGroup.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DeleteProductUsingProductGridActionGroup"> + <annotations> + <description>Deletes the provided Product from the Admin Products grid page.</description> + </annotations> + <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"/> + <fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="{{product.name}}" stepKey="fillProductNameFilter"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> + <see selector="{{AdminProductGridSection.productGridCell('1', 'SKU')}}" userInput="{{product.sku}}" stepKey="seeProductSkuInGrid"/> + <click selector="{{AdminProductGridSection.multicheckDropdown}}" stepKey="openMulticheckDropdown"/> + <click selector="{{AdminProductGridSection.multicheckOption('Select All')}}" stepKey="selectAllProductInFilteredGrid"/> + <click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickActionDropdown"/> + <click selector="{{AdminProductGridSection.bulkActionOption('Delete')}}" stepKey="clickDeleteAction"/> + <waitForElementVisible selector="{{AdminProductGridConfirmActionSection.title}}" stepKey="waitForConfirmModal"/> + <click selector="{{AdminProductGridConfirmActionSection.ok}}" stepKey="confirmProductDelete"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductsByKeywordActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductsByKeywordActionGroup.xml new file mode 100644 index 0000000000000..6b181d5f93be2 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductsByKeywordActionGroup.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DeleteProductsByKeywordActionGroup"> + <annotations> + <description>Delete products by keyword</description> + </annotations> + <arguments> + <argument name="keyword" type="string"/> + </arguments> + + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> + <fillField selector="{{AdminProductGridFilterSection.keywordSearch}}" userInput="{{keyword}}" stepKey="fillKeywordField"/> + <click selector="{{AdminProductGridFilterSection.keywordSearchButton}}" stepKey="keywordSearchButton"/> + <click selector="{{AdminProductGridSection.multicheckDropdown}}" stepKey="openMulticheckDropdown"/> + <click selector="{{AdminProductGridSection.multicheckOption('Select All')}}" stepKey="selectAllProductInFilteredGrid"/> + <click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickActionDropdown"/> + <click selector="{{AdminProductGridSection.bulkActionOption('Delete')}}" stepKey="clickDeleteAction"/> + <waitForElementVisible selector="{{AdminConfirmationModalSection.ok}}" stepKey="waitForConfirmModal"/> + <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmProductDelete"/> + <see selector="{{AdminMessagesSection.success}}" userInput="record(s) have been deleted." stepKey="seeSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductsIfTheyExistActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductsIfTheyExistActionGroup.xml new file mode 100644 index 0000000000000..3ef0de8b27a65 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductsIfTheyExistActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DeleteProductsIfTheyExistActionGroup"> + <annotations> + <description>Deletes all Products in the Admin Products grid.</description> + </annotations> + + <conditionalClick selector="{{AdminProductGridSection.multicheckDropdown}}" dependentSelector="{{AdminProductGridSection.firstProductRow}}" visible="true" stepKey="openMulticheckDropdown"/> + <conditionalClick selector="{{AdminProductGridSection.multicheckOption('Select All')}}" dependentSelector="{{AdminProductGridSection.firstProductRow}}" visible="true" stepKey="selectAllProductInFilteredGrid"/> + <click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickActionDropdown"/> + <click selector="{{AdminProductGridSection.bulkActionOption('Delete')}}" stepKey="clickDeleteAction"/> + <waitForElementVisible selector="{{AdminProductGridConfirmActionSection.ok}}" stepKey="waitForModalPopUp"/> + <click selector="{{AdminProductGridConfirmActionSection.ok}}" stepKey="confirmProductDelete"/> + <waitForPageLoad stepKey="waitForGridLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ExpandAdminProductSectionActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ExpandAdminProductSectionActionGroup.xml new file mode 100644 index 0000000000000..a181cce591e09 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ExpandAdminProductSectionActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ExpandAdminProductSectionActionGroup"> + <annotations> + <description>Expand the provided Section Selector based on the provided dependant Section Selector.</description> + </annotations> + <arguments> + <argument name="sectionSelector" defaultValue="{{AdminProductContentSection.sectionHeader}}" type="string"/> + <argument name="sectionDependentSelector" defaultValue="{{AdminProductContentSection.sectionHeaderShow}}" type="string"/> + </arguments> + + <scrollToTopOfPage stepKey="scrollToTopOfPage"/> + <waitForElementVisible time="30" selector="{{sectionSelector}}" stepKey="waitForSection"/> + <conditionalClick selector="{{sectionSelector}}" dependentSelector="{{sectionDependentSelector}}" visible="false" stepKey="expandSection"/> + <waitForPageLoad time="30" stepKey="waitForSectionToExpand"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillAdminSimpleProductFormActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillAdminSimpleProductFormActionGroup.xml new file mode 100644 index 0000000000000..2abfc546e6bb3 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillAdminSimpleProductFormActionGroup.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FillAdminSimpleProductFormActionGroup"> + <annotations> + <description>Goes to the Admin Product grid page. Clicks on Add. Fills the provided Product details (Name, SKU, Price, Quantity, Category and URL). Clicks on Save. Validates that the Product details are present and correct.</description> + </annotations> + <arguments> + <argument name="category"/> + <argument name="simpleProduct"/> + </arguments> + + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> + <click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductDropdown"/> + <click selector="{{AdminProductGridActionSection.addSimpleProduct}}" stepKey="clickAddSimpleProduct"/> + <fillField userInput="{{simpleProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="fillName"/> + <fillField userInput="{{simpleProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="fillSKU"/> + <fillField userInput="{{simpleProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="fillPrice"/> + <fillField userInput="{{simpleProduct.quantity}}" selector="{{AdminProductFormSection.productQuantity}}" stepKey="fillQuantity"/> + <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[{{category.name}}]" stepKey="searchAndSelectCategory"/> + <click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/> + <fillField userInput="{{simpleProduct.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct"/> + <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="assertSaveMessageSuccess"/> + <seeInField userInput="{{simpleProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="assertFieldName"/> + <seeInField userInput="{{simpleProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="assertFieldSku"/> + <seeInField userInput="{{simpleProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="assertFieldPrice"/> + <click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSectionAssert"/> + <seeInField userInput="{{simpleProduct.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="assertFieldUrlKey"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillCategoryFormActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillCategoryFormActionGroup.xml new file mode 100644 index 0000000000000..37989ed9ddc44 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillCategoryFormActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FillCategoryFormActionGroup"> + <annotations> + <description>Requires navigation to the Subcategory creation/edit page. Fills the Subcategory Name. Fills the Search Engine Optimization.</description> + </annotations> + <arguments> + <argument name="categoryEntity" defaultValue="_defaultCategory"/> + </arguments> + + <fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{categoryEntity.name}}" stepKey="enterCategoryName"/> + <click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="openSEO"/> + <fillField selector="{{AdminCategorySEOSection.UrlKeyInput}}" userInput="{{categoryEntity.name_lwr}}" stepKey="enterURLKey"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillCategoryNameAndUrlKeyAndSaveActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillCategoryNameAndUrlKeyAndSaveActionGroup.xml new file mode 100644 index 0000000000000..bd62dd9e83e55 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillCategoryNameAndUrlKeyAndSaveActionGroup.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FillCategoryNameAndUrlKeyAndSaveActionGroup"> + <annotations> + <description>Requires navigation to subcategory creation/edit. Fills the name, and sets the Search Engine Optimization for the category.</description> + </annotations> + <arguments> + <argument name="categoryName" type="string"/> + <argument name="categoryUrlKey" type="string"/> + </arguments> + + <fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{categoryName}}" stepKey="enterCategoryName"/> + <scrollTo selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="scrollToSearchEngineOptimization"/> + <click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="openSEO"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + <fillField selector="{{AdminCategorySEOSection.UrlKeyInput}}" userInput="{{categoryUrlKey}}" stepKey="enterURLKey"/> + <scrollToTopOfPage stepKey="scrollToTheTopOfPage"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/> + <waitForPageLoad stepKey="waitForPageToLoad1"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillMainProductFormActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillMainProductFormActionGroup.xml new file mode 100644 index 0000000000000..f53059b3de063 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillMainProductFormActionGroup.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FillMainProductFormActionGroup"> + <annotations> + <description>Fills in the provided Product details (Name, SKU, Price, Quantity, Stock Status, Weight Type and Weight) on the Admin Products creation/edit page.</description> + </annotations> + <arguments> + <argument name="product" defaultValue="_defaultProduct"/> + </arguments> + + <scrollToTopOfPage stepKey="scrollToTopOfPage"/> + <fillField selector="{{AdminProductFormSection.productName}}" userInput="{{product.name}}" stepKey="fillProductName"/> + <fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="fillProductSku"/> + <fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{product.price}}" stepKey="fillProductPrice"/> + <fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="{{product.quantity}}" stepKey="fillProductQty"/> + <selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="{{product.status}}" stepKey="selectStockStatus"/> + <selectOption selector="{{AdminProductFormSection.productWeightSelect}}" userInput="This item has weight" stepKey="selectWeight"/> + <fillField selector="{{AdminProductFormSection.productWeight}}" userInput="{{product.weight}}" stepKey="fillProductWeight"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillMainProductFormByStringActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillMainProductFormByStringActionGroup.xml new file mode 100644 index 0000000000000..4f3157292d356 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillMainProductFormByStringActionGroup.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FillMainProductFormByStringActionGroup"> + <annotations> + <description>Fills in the provided Product Name, SKU, Price, Quantity, Stock Status and Weight on the Admin Products creation/edit page.</description> + </annotations> + <arguments> + <argument name="productName" type="string"/> + <argument name="productSku" type="string"/> + <argument name="productPrice" type="string"/> + <argument name="productQuantity" type="string"/> + <argument name="productStatus" type="string"/> + <argument name="productWeight" type="string"/> + </arguments> + + <fillField selector="{{AdminProductFormSection.productName}}" userInput="{{productName}}" stepKey="fillProductName"/> + <fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{productSku}}" stepKey="fillProductSku"/> + <fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{productPrice}}" stepKey="fillProductPrice"/> + <fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="{{productQuantity}}" stepKey="fillProductQty"/> + <selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="{{productStatus}}" stepKey="selectStockStatus"/> + <selectOption selector="{{AdminProductFormSection.productWeightSelect}}" userInput="This item has weight" stepKey="selectWeight"/> + <fillField selector="{{AdminProductFormSection.productWeight}}" userInput="{{productWeight}}" stepKey="fillProductWeight"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillMainProductFormNoWeightActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillMainProductFormNoWeightActionGroup.xml new file mode 100644 index 0000000000000..b3cc110224b25 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillMainProductFormNoWeightActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FillMainProductFormNoWeightActionGroup"> + <annotations> + <description>Fills in the provided Product details (Name, SKU, Price, Quantity, Stock Status and Weight Type) on the Admin Products creation/edit page.</description> + </annotations> + <arguments> + <argument name="product" defaultValue="DownloadableProduct"/> + </arguments> + + <fillField selector="{{AdminProductFormSection.productName}}" userInput="{{product.name}}" stepKey="fillProductName"/> + <fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="fillProductSku"/> + <fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{product.price}}" stepKey="fillProductPrice"/> + <fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="{{product.quantity}}" stepKey="fillProductQty"/> + <selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="{{product.status}}" stepKey="selectStockStatus"/> + <selectOption selector="{{AdminProductFormSection.productWeightSelect}}" userInput="This item has no weight" stepKey="selectWeight"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillNewProductCategoryActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillNewProductCategoryActionGroup.xml new file mode 100644 index 0000000000000..9edcfca9416f2 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillNewProductCategoryActionGroup.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FillNewProductCategoryActionGroup"> + <annotations> + <description>Actions to fill out a new category from the product page with specified category and parent category names.</description> + </annotations> + <arguments> + <argument name="categoryName" defaultValue="Test Category" type="string"/> + <argument name="parentCategoryName" defaultValue="default" type="string"/> + </arguments> + + <!-- Click on new Category --> + <click stepKey="clickNewCategory" selector="{{AdminProductCategoryCreationSection.newCategory}}"/> + <waitForPageLoad stepKey="waitForFieldSet"/> + <fillField stepKey="fillCategoryName" selector="{{AdminProductCategoryCreationSection.nameInput}}" userInput="{{categoryName}}"/> + + <!-- Search and select a parent category for the product --> + <click stepKey="clickParentCategory" selector="{{AdminProductCategoryCreationSection.parentCategory}}"/> + <waitForPageLoad stepKey="waitForDropDownVisible"/> + <fillField stepKey="searchForParent" userInput="{{parentCategoryName}}" selector="{{AdminProductCategoryCreationSection.parentSearch}}"/> + <waitForPageLoad stepKey="waitForFieldResults"/> + <click stepKey="clickParent" selector="{{AdminProductCategoryCreationSection.parentSearchResult}}"/> + <click stepKey="createCategory" selector="{{AdminProductCategoryCreationSection.createCategory}}"/> + <waitForPageLoad stepKey="waitForCategoryCreated"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillProductNameAndSkuInProductFormActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillProductNameAndSkuInProductFormActionGroup.xml new file mode 100644 index 0000000000000..822b74d9e9e6b --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillProductNameAndSkuInProductFormActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FillProductNameAndSkuInProductFormActionGroup"> + <annotations> + <description>Fills in the provided Product details (Name and SKU) on the Admin Products creation and edit page.</description> + </annotations> + <arguments> + <argument name="product"/> + </arguments> + + <fillField selector="{{AdminProductFormSection.productName}}" userInput="{{product.name}}" stepKey="fillProductName"/> + <fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="fillProductSku"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterAndSelectProductActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterAndSelectProductActionGroup.xml new file mode 100644 index 0000000000000..2cd64ddc2855f --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterAndSelectProductActionGroup.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FilterAndSelectProductActionGroup"> + <annotations> + <description>Goes to the Admin Products grid. Filters the Product grid by the provided Product SKU.</description> + </annotations> + <arguments> + <argument name="productSku" type="string"/> + </arguments> + + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> + <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{productSku}}" stepKey="fillProductSkuFilter"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> + <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad" time="30"/> + <click stepKey="openSelectedProduct" selector="{{AdminProductGridSection.productRowBySku(productSku)}}"/> + <waitForPageLoad stepKey="waitForProductToLoad"/> + <waitForElementVisible selector="{{AdminHeaderSection.pageTitle}}" stepKey="waitForProductTitle"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductAttributeByAttributeCodeActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductAttributeByAttributeCodeActionGroup.xml new file mode 100644 index 0000000000000..efd1d50cb4929 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductAttributeByAttributeCodeActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FilterProductAttributeByAttributeCodeActionGroup"> + <annotations> + <description>Filters the Product Attributes grid by the provided Product Attribute Code.</description> + </annotations> + <arguments> + <argument name="ProductAttributeCode" type="string"/> + </arguments> + + <click selector="{{AdminProductAttributeGridSection.ResetFilter}}" stepKey="resetFiltersOnGrid"/> + <fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" userInput="{{ProductAttributeCode}}" stepKey="setAttributeCode"/> + <waitForPageLoad stepKey="waitForUserInput"/> + <click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="searchForAttributeFromTheGrid"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductAttributeByAttributeLabelActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductAttributeByAttributeLabelActionGroup.xml new file mode 100644 index 0000000000000..8d2c966de6074 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductAttributeByAttributeLabelActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FilterProductAttributeByAttributeLabelActionGroup"> + <annotations> + <description>Searches the Attribute Sets grid page for the provided Attribute Set Name.</description> + </annotations> + <arguments> + <argument name="productAttributeLabel" type="string"/> + </arguments> + + <fillField selector="{{AdminProductAttributeGridSection.attributeLabelFilter}}" userInput="{{productAttributeLabel}}" stepKey="setAttributeLabel"/> + <waitForPageLoad stepKey="waitForUserInput"/> + <click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="searchForAttributeFromTheGrid"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductAttributeByDefaultLabelActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductAttributeByDefaultLabelActionGroup.xml new file mode 100644 index 0000000000000..31702bfdca212 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductAttributeByDefaultLabelActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FilterProductAttributeByDefaultLabelActionGroup"> + <annotations> + <description>Filters the Product Attributes grid by the provided Product Attribute Label.</description> + </annotations> + <arguments> + <argument name="productAttributeLabel" type="string"/> + </arguments> + + <click selector="{{AdminProductAttributeGridSection.ResetFilter}}" stepKey="resetFiltersOnGrid"/> + <fillField selector="{{AdminProductAttributeGridSection.GridFilterFrontEndLabel}}" userInput="{{productAttributeLabel}}" stepKey="setDefaultLabel"/> + <waitForPageLoad stepKey="waitForUserInput"/> + <click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="searchForAttributeFromTheGrid"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductAttributeSetGridByAttributeSetNameActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductAttributeSetGridByAttributeSetNameActionGroup.xml new file mode 100644 index 0000000000000..c8aa8eb286fc3 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductAttributeSetGridByAttributeSetNameActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FilterProductAttributeSetGridByAttributeSetNameActionGroup"> + <annotations> + <description>Filters the Attribute Sets grid page for the provided Attribute Set Name.</description> + </annotations> + <arguments> + <argument name="name" type="string"/> + </arguments> + + <click selector="{{AdminProductAttributeSetGridSection.resetFilter}}" stepKey="clickResetButton"/> + <fillField selector="{{AdminProductAttributeSetGridSection.filter}}" userInput="{{name}}" stepKey="filterByName"/> + <click selector="{{AdminProductAttributeSetGridSection.searchBtn}}" stepKey="clickSearch"/> + <click selector="{{AdminProductAttributeSetGridSection.nthRow('1')}}" stepKey="clickFirstRow"/> + <waitForPageLoad time="30" stepKey="waitForPageLoad1"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridByDisabledStatusActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridByDisabledStatusActionGroup.xml new file mode 100644 index 0000000000000..52b6972ec92e6 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridByDisabledStatusActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FilterProductGridByDisabledStatusActionGroup"> + <annotations> + <description>Filters the Admin Products grid by the 'Disabled' Status. PLEASE NOTE: The Filter is Hardcoded.</description> + </annotations> + + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> + <selectOption selector="{{AdminProductGridFilterSection.statusFilter}}" userInput="Disabled" stepKey="selectDisabledStatusFilter"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> + <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad" time="30"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridByEnabledStatusActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridByEnabledStatusActionGroup.xml new file mode 100644 index 0000000000000..1e4d2315bf75e --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridByEnabledStatusActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FilterProductGridByEnabledStatusActionGroup"> + <annotations> + <description>Filters the Admin Products grid by the 'Enabled' Status. PLEASE NOTE: The Filter is Hardcoded.</description> + </annotations> + + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> + <selectOption selector="{{AdminProductGridFilterSection.statusFilter}}" userInput="Enabled" stepKey="selectEnabledStatusFilter"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> + <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad" time="30"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridByName2ActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridByName2ActionGroup.xml new file mode 100644 index 0000000000000..850ea3e167daa --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridByName2ActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FilterProductGridByName2ActionGroup"> + <annotations> + <description>Filters the Admin Products grid by the provided Product Name.</description> + </annotations> + <arguments> + <argument name="name" type="string"/> + </arguments> + + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> + <fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="{{name}}" stepKey="fillProductNameFilter"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> + <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad" time="30"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridByNameActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridByNameActionGroup.xml new file mode 100644 index 0000000000000..efd2f1c7be08a --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridByNameActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FilterProductGridByNameActionGroup"> + <annotations> + <description>Filters the Admin Products grid by the provided Product (Name).</description> + </annotations> + <arguments> + <argument name="product" defaultValue="_defaultProduct"/> + </arguments> + + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> + <fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="{{product.name}}" stepKey="fillProductNameFilter"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> + <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad" time="30"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridByPriceRangeActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridByPriceRangeActionGroup.xml new file mode 100644 index 0000000000000..d3405f977ccc4 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridByPriceRangeActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FilterProductGridByPriceRangeActionGroup"> + <annotations> + <description>Filters the Admin Products grid by the provided Price Filter.</description> + </annotations> + <arguments> + <argument name="filter"/> + </arguments> + + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> + <fillField selector="{{AdminProductGridFilterSection.priceFilterFrom}}" userInput="{{filter.from}}" stepKey="fillProductPriceFromFilter"/> + <fillField selector="{{AdminProductGridFilterSection.priceFilterTo}}" userInput="{{filter.to}}" stepKey="fillProductPriceToFilter"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> + <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad" time="30"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridBySetNewFromDateActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridBySetNewFromDateActionGroup.xml new file mode 100644 index 0000000000000..db12d6f9d8440 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridBySetNewFromDateActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FilterProductGridBySetNewFromDateActionGroup"> + <annotations> + <description>Filters the Admin Products grid by the New From Data field. PLEASE NOTE: The Start Date is Hardcoded.</description> + </annotations> + + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> + <fillField selector="{{AdminProductGridFilterSection.newFromDateFilter}}" userInput="05/16/2018" stepKey="fillSetAsNewProductFilter"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> + <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad" time="30"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridBySku2ActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridBySku2ActionGroup.xml new file mode 100644 index 0000000000000..eb5f20b7c84e3 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridBySku2ActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FilterProductGridBySku2ActionGroup"> + <annotations> + <description>Filters the Admin Products grid by the provided Product SKU.</description> + </annotations> + <arguments> + <argument name="sku" type="string"/> + </arguments> + + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{sku}}" stepKey="fillProductSkuFilter"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> + <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad" time="30"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridBySkuActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridBySkuActionGroup.xml new file mode 100644 index 0000000000000..d216b0f976efe --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridBySkuActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FilterProductGridBySkuActionGroup"> + <annotations> + <description>Filters the Admin Products grid by the provided Product (SKU).</description> + </annotations> + <arguments> + <argument name="product" defaultValue="_defaultProduct"/> + </arguments> + + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillProductSkuFilter"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> + <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad" time="30"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridBySkuAndNameActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridBySkuAndNameActionGroup.xml new file mode 100644 index 0000000000000..80e8e2c7c3133 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridBySkuAndNameActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FilterProductGridBySkuAndNameActionGroup"> + <annotations> + <description>Filters the Admin Products grid by the provided Product (Name and SKU).</description> + </annotations> + <arguments> + <argument name="product" defaultValue="_defaultProduct"/> + </arguments> + + <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"/> + <fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="{{product.name}}" stepKey="fillProductNameFilter"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToAdminCategoryPageByIdActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToAdminCategoryPageByIdActionGroup.xml new file mode 100644 index 0000000000000..b1914118cd034 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToAdminCategoryPageByIdActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="GoToAdminCategoryPageByIdActionGroup"> + <annotations> + <description>Goes to the Category edit page for a specified Category ID.</description> + </annotations> + <arguments> + <argument name="id" type="string"/> + </arguments> + + <amOnPage url="{{AdminCategoryEditPage.url(id)}}" stepKey="amOnAdminCategoryPage"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="{{id}}" stepKey="seeCategoryPageTitle"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToAttributeGridPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToAttributeGridPageActionGroup.xml new file mode 100644 index 0000000000000..2b5fe9d76875c --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToAttributeGridPageActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="GoToAttributeGridPageActionGroup"> + <annotations> + <description>Goes to the Attribute Sets grid page.</description> + </annotations> + + <amOnPage url="{{AdminProductAttributeSetGridPage.url}}" stepKey="goToAttributeSets"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToAttributeSetByNameActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToAttributeSetByNameActionGroup.xml new file mode 100644 index 0000000000000..e732f1bd7341e --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToAttributeSetByNameActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="GoToAttributeSetByNameActionGroup"> + <annotations> + <description>Searches for the provided Attribute Sets Name. Clicks on the 1st row.</description> + </annotations> + <arguments> + <argument name="name" type="string"/> + </arguments> + + <click selector="{{AdminProductAttributeSetGridSection.resetFilter}}" stepKey="clickResetButton"/> + <fillField selector="{{AdminProductAttributeSetGridSection.filter}}" userInput="{{name}}" stepKey="filterByName"/> + <click selector="{{AdminProductAttributeSetGridSection.searchBtn}}" stepKey="clickSearch"/> + <click selector="{{AdminProductAttributeSetGridSection.nthRow('1')}}" stepKey="clickFirstRow"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToCreateCategoryPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToCreateCategoryPageActionGroup.xml new file mode 100644 index 0000000000000..346f47006cf37 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToCreateCategoryPageActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="GoToCreateCategoryPageActionGroup"> + <annotations> + <description>Goes to the Category grid page. Clicks the Add Subcategory button.</description> + </annotations> + <arguments> + <argument name="selector" defaultValue="AdminCategorySidebarActionSection.AddSubcategoryButton"/> + </arguments> + + <amOnPage url="{{AdminCategoryPage.url}}" stepKey="amOnAdminCategoryPage"/> + <scrollToTopOfPage stepKey="scrollToTopOfPage"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <click selector="{{selector}}" stepKey="clickOnAddCategory"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Category" stepKey="seeCategoryPageTitle"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToCreateProductPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToCreateProductPageActionGroup.xml new file mode 100644 index 0000000000000..7f95765337189 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToCreateProductPageActionGroup.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <!--Navigate to create product page from product grid page--> + <actionGroup name="GoToCreateProductPageActionGroup"> + <annotations> + <description>Clicks on the 'Add Product' toggle on the Admin Products grid page. Clicks on the provided Product (Type).</description> + </annotations> + <arguments> + <argument name="product" defaultValue="_defaultProduct"/> + </arguments> + + <click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductToggle"/> + <waitForElementVisible selector="{{AdminProductGridActionSection.addTypeProduct(product.type_id)}}" stepKey="waitForAddProductDropdown" time="30"/> + <click selector="{{AdminProductGridActionSection.addTypeProduct(product.type_id)}}" stepKey="clickAddProductType"/> + <waitForPageLoad time="30" stepKey="waitForCreateProductPageLoad"/> + <seeInCurrentUrl url="{{AdminProductCreatePage.url(AddToDefaultSet.attributeSetId, product.type_id)}}" stepKey="seeNewProductUrl"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Product" stepKey="seeNewProductTitle"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToProductCatalogPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToProductCatalogPageActionGroup.xml new file mode 100644 index 0000000000000..08bf948c2223b --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToProductCatalogPageActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="GoToProductCatalogPageActionGroup"> + <annotations> + <description>Goes to the Admin Products grid page.</description> + </annotations> + + <comment userInput="actionGroup:GoToProductCatalogPage" stepKey="actionGroupComment"/> + <amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="GoToCatalogProductPage"/> + <waitForPageLoad stepKey="WaitForPageToLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToProductPageViaIDActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToProductPageViaIDActionGroup.xml new file mode 100644 index 0000000000000..104ef83771e9d --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToProductPageViaIDActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="GoToProductPageViaIDActionGroup"> + <annotations> + <description>Goes to the Product edit page for the provided Product ID.</description> + </annotations> + <arguments> + <argument name="productId" type="string"/> + </arguments> + + <amOnPage url="{{AdminProductEditPage.url(productId)}}" stepKey="goToProduct"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToSpecifiedCreateProductPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToSpecifiedCreateProductPageActionGroup.xml new file mode 100644 index 0000000000000..26041974dbc80 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToSpecifiedCreateProductPageActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="GoToSpecifiedCreateProductPageActionGroup"> + <annotations> + <description>Goes to the Admin Product grid page. Clicks on the Add Product toggle. Clicks on the provided Product Type.</description> + </annotations> + <arguments> + <argument type="string" name="productType" defaultValue="simple"/> + </arguments> + + <comment userInput="actionGroup:GoToSpecifiedCreateProductPage" stepKey="actionGroupComment"/> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> + <click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductDropdown"/> + <click selector="{{AdminProductGridActionSection.addTypeProduct(productType)}}" stepKey="clickAddProduct"/> + <waitForPageLoad stepKey="waitForFormToLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToStorefrontCategoryPageByParametersActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToStorefrontCategoryPageByParametersActionGroup.xml new file mode 100644 index 0000000000000..816aeaa09ee9b --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToStorefrontCategoryPageByParametersActionGroup.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <!-- Go to storefront category product page by given parameters --> + <actionGroup name="GoToStorefrontCategoryPageByParametersActionGroup"> + <annotations> + <description>Goes to the Storefront Category page using URI Search Parameters.</description> + </annotations> + <arguments> + <argument name="category" type="string"/> + <argument name="mode" type="string"/> + <argument name="numOfProductsPerPage" type="string"/> + <argument name="sortBy" type="string" defaultValue="position"/> + <argument name="sort" type="string" defaultValue="asc"/> + </arguments> + + <!-- Go to storefront category page --> + <amOnPage url="{{StorefrontCategoryPage.url(category)}}?product_list_limit={{numOfProductsPerPage}}&product_list_mode={{mode}}&product_list_order={{sortBy}}&product_list_dir={{sort}}" stepKey="onCategoryPage"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToSubCategoryPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToSubCategoryPageActionGroup.xml new file mode 100644 index 0000000000000..8c35c88f151d5 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToSubCategoryPageActionGroup.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="GoToSubCategoryPageActionGroup"> + <annotations> + <description>Goes to the Storefront page. Open the Parent Category menu in the Top Nav Menu. Click on a Subcategory. Validate that the Subcategory is present and correct.</description> + </annotations> + <arguments> + <argument name="parentCategory"/> + <argument name="subCategory"/> + <argument name="urlPath" type="string"/> + </arguments> + + <moveMouseOver selector="{{StorefrontHeaderSection.NavigationCategoryByName(parentCategory.name)}}" stepKey="moveMouseOnMainCategory"/> + <waitForElementVisible selector="{{StorefrontHeaderSection.NavigationCategoryByName(subCategory.name)}}" stepKey="waitForSubCategoryVisible"/> + <click selector="{{StorefrontHeaderSection.NavigationCategoryByName(subCategory.name)}}" stepKey="goToCategory"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <seeInCurrentUrl url="{{urlPath}}.html" stepKey="checkUrl"/> + <seeInTitle userInput="{{subCategory.name}}" stepKey="assertCategoryNameInTitle"/> + <see userInput="{{subCategory.name}}" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="assertCategoryName"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ImportProductCustomizableOptionsActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ImportProductCustomizableOptionsActionGroup.xml new file mode 100644 index 0000000000000..2a847034add1d --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ImportProductCustomizableOptionsActionGroup.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ImportProductCustomizableOptionsActionGroup"> + <annotations> + <description>Import custom Product Options for the provided Product Name.</description> + </annotations> + <arguments> + <argument name="productName" type="string"/> + </arguments> + + <click selector="{{AdminProductCustomizableOptionsSection.importOptions}}" stepKey="clickImportOptions"/> + <waitForElementVisible selector="{{AdminProductImportOptionsSection.selectProductTitle}}" stepKey="waitForTitleVisible"/> + <conditionalClick selector="{{AdminProductImportOptionsSection.resetFiltersButton}}" dependentSelector="{{AdminProductImportOptionsSection.resetFiltersButton}}" visible="true" stepKey="clickResetFilters"/> + <click selector="{{AdminProductImportOptionsSection.filterButton}}" stepKey="clickFilterButton"/> + <waitForElementVisible selector="{{AdminProductImportOptionsSection.nameField}}" stepKey="waitForNameField"/> + <fillField selector="{{AdminProductImportOptionsSection.nameField}}" userInput="{{productName}}" stepKey="fillProductName"/> + <click selector="{{AdminProductImportOptionsSection.applyFiltersButton}}" stepKey="clickApplyFilters"/> + <checkOption selector="{{AdminProductImportOptionsSection.firstRowItemCheckbox}}" stepKey="checkProductCheckbox"/> + <click selector="{{AdminProductImportOptionsSection.importButton}}" stepKey="clickImport"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/NavigateToAndResetProductAttributeGridToDefaultViewActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/NavigateToAndResetProductAttributeGridToDefaultViewActionGroup.xml new file mode 100644 index 0000000000000..6d0091d90175b --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/NavigateToAndResetProductAttributeGridToDefaultViewActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="NavigateToAndResetProductAttributeGridToDefaultViewActionGroup"> + <annotations> + <description>Goes to the Product Attributes grid. Clicks on 'Clear Filters'.</description> + </annotations> + + <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> + <waitForPageLoad stepKey="waitForGridLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/NavigateToAndResetProductGridToDefaultViewActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/NavigateToAndResetProductGridToDefaultViewActionGroup.xml new file mode 100644 index 0000000000000..c67c0c0e61ab7 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/NavigateToAndResetProductGridToDefaultViewActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="NavigateToAndResetProductGridToDefaultViewActionGroup" extends="ResetProductGridToDefaultViewActionGroup"> + <annotations> + <description>EXTENDS: resetProductGridToDefaultView. Adds an action to go to the Admin Products grid page.</description> + </annotations> + + <amOnPage url="{{AdminProductIndexPage.url}}" before="clickClearFilters" stepKey="goToAdminProductIndexPage"/> + <waitForPageLoad after="goToAdminProductIndexPage" stepKey="waitForProductIndexPageToLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/NavigateToCreatedCategoryActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/NavigateToCreatedCategoryActionGroup.xml new file mode 100644 index 0000000000000..b1638909652f6 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/NavigateToCreatedCategoryActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="NavigateToCreatedCategoryActionGroup"> + <annotations> + <description>Navigates to category page, selects a category by specified category.</description> + </annotations> + <arguments> + <argument name="Category"/> + </arguments> + + <amOnPage url="{{AdminCategoryPage.page}}" stepKey="amOnCategoryPage"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + <click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="expandAll"/> + <waitForPageLoad stepKey="waitForPageLoad2"/> + <click selector="{{AdminCategorySidebarTreeSection.categoryInTree(Category.Name)}}" stepKey="navigateToCreatedCategory"/> + <waitForLoadingMaskToDisappear stepKey="waitForSpinner"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/NavigateToCreatedProductAttributeActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/NavigateToCreatedProductAttributeActionGroup.xml new file mode 100644 index 0000000000000..850939501eb81 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/NavigateToCreatedProductAttributeActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="NavigateToCreatedProductAttributeActionGroup"> + <annotations> + <description>Goes to the Product Attributes grid page. Filters the grid based on the provided Product Attribute. Clicks on the 1st row.</description> + </annotations> + <arguments> + <argument name="ProductAttribute"/> + </arguments> + + <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/> + <fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" userInput="{{ProductAttribute.attribute_code}}" stepKey="setAttributeCode"/> + <click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="searchForAttributeFromTheGrid"/> + <click selector="{{AdminProductAttributeGridSection.FirstRow}}" stepKey="clickOnAttributeRow"/> + <waitForPageLoad stepKey="waitForPageLoad2"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/NavigateToCreatedProductEditPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/NavigateToCreatedProductEditPageActionGroup.xml new file mode 100644 index 0000000000000..0c9b5fc1c40e6 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/NavigateToCreatedProductEditPageActionGroup.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="NavigateToCreatedProductEditPageActionGroup"> + <annotations> + <description>Goes to the Admin Product grid page. Filters the Product grid based on the provided Product details (SKU). Edits the provided Product. Validates that the Product SKU is present and correct.</description> + </annotations> + <arguments> + <argument name="product" defaultValue="_defaultProduct"/> + </arguments> + + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToAdminProductIndexPage"/> + <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> + <waitForPageLoad stepKey="waitForClearFilters"/> + <dontSeeElement selector="{{AdminProductGridFilterSection.clearFilters}}" stepKey="dontSeeClearFilters"/> + <click selector="{{AdminProductGridFilterSection.viewDropdown}}" stepKey="openViewBookmarksTab"/> + <click selector="{{AdminProductGridFilterSection.viewBookmark('Default View')}}" stepKey="resetToDefaultGridView"/> + <waitForPageLoad stepKey="waitForResetToDefaultView"/> + <see selector="{{AdminProductGridFilterSection.viewDropdown}}" userInput="Default View" stepKey="seeDefaultViewSelected"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillProductSkuFilter"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> + <waitForPageLoad stepKey="waitForFilterOnGrid"/> + <click selector="{{AdminProductGridSection.selectRowBasedOnName(product.name)}}" stepKey="clickProduct"/> + <waitForPageLoad stepKey="waitForProductEditPageLoad"/> + <waitForElementVisible selector="{{AdminProductFormBundleSection.productSku}}" stepKey="waitForProductSKUField"/> + <seeInField selector="{{AdminProductFormBundleSection.productSku}}" userInput="{{product.sku}}" stepKey="seeProductSKU"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/NavigateToEditProductAttributeActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/NavigateToEditProductAttributeActionGroup.xml new file mode 100644 index 0000000000000..9a348d2be8208 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/NavigateToEditProductAttributeActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="NavigateToEditProductAttributeActionGroup"> + <annotations> + <description>Goes to the Product Attributes grid page. Filters the grid based on the provided Product Attribute. Clicks on the 1st row.</description> + </annotations> + <arguments> + <argument name="ProductAttribute" type="string"/> + </arguments> + + <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/> + <fillField selector="{{AdminProductAttributeGridSection.GridFilterFrontEndLabel}}" userInput="{{ProductAttribute}}" stepKey="navigateToAttributeEditPage1"/> + <click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="navigateToAttributeEditPage2"/> + <waitForPageLoad stepKey="waitForPageLoad2"/> + <click selector="{{AdminProductAttributeGridSection.FirstRow}}" stepKey="navigateToAttributeEditPage3"/> + <waitForPageLoad stepKey="waitForPageLoad3"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/NavigateToMediaGalleryActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/NavigateToMediaGalleryActionGroup.xml new file mode 100644 index 0000000000000..fea652311d7c1 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/NavigateToMediaGalleryActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="NavigateToMediaGalleryActionGroup"> + <annotations> + <description>Navigates to the category page and Opens the Media Gallery.</description> + </annotations> + + <amOnPage url="{{AdminCategoryPage.url}}" stepKey="amOnAdminCategoryPage"/> + <waitForElementVisible selector="{{AdminCategoryContentSection.sectionHeader}}" stepKey="waitForContentSection"/> + <conditionalClick selector="{{AdminCategoryContentSection.sectionHeader}}" dependentSelector="{{AdminCategoryContentSection.uploadButton}}" visible="false" stepKey="openContentSection"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + <waitForElementVisible selector="{{AdminCategoryContentSection.selectFromGalleryButton}}" stepKey="waitForSelectFromGalleryButton"/> + <click selector="{{AdminCategoryContentSection.selectFromGalleryButton}}" stepKey="clickSelectFromGalleryButton"/> + <waitForPageLoad stepKey="waitForPageLoad2"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/OpenCategoryFromCategoryTreeActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/OpenCategoryFromCategoryTreeActionGroup.xml new file mode 100644 index 0000000000000..d172b9b24ab3e --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/OpenCategoryFromCategoryTreeActionGroup.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="OpenCategoryFromCategoryTreeActionGroup"> + <annotations> + <description>Navigates to category page, selects a category by specified category. Replicates actionGroup:navigateToCreatedCategory.</description> + </annotations> + <arguments> + <argument name="category" type="string"/> + </arguments> + + <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/> + <waitForPageLoad stepKey="waitForCategoryPageToLoad"/> + <click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="clickOnExpandTree"/> + <waitForPageLoad stepKey="waitForCategoryToLoad"/> + <click selector="{{AdminCategorySidebarTreeSection.categoryInTree(category)}}" stepKey="selectCategory"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + <waitForElementVisible selector="{{AdminCategoryContentSection.categoryPageTitle}}" stepKey="waitForCategoryTitle"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/OpenProductForEditByClickingRowXColumnYInProductGridActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/OpenProductForEditByClickingRowXColumnYInProductGridActionGroup.xml new file mode 100644 index 0000000000000..d5b6520cb33bb --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/OpenProductForEditByClickingRowXColumnYInProductGridActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="OpenProductForEditByClickingRowXColumnYInProductGridActionGroup"> + <annotations> + <description>Clicks on the 'Edit' button in the Admin Products grid by the provided Grid coordinates (X, Y).</description> + </annotations> + <arguments> + <argument name="X" type="string" defaultValue="1"/> + <argument name="Y" type="string" defaultValue="2"/> + </arguments> + + <click selector="{{AdminProductGridSection.productGridXRowYColumnButton(X, Y)}}" stepKey="openProductForEdit"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ProductSetAdvancedPricingActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ProductSetAdvancedPricingActionGroup.xml new file mode 100644 index 0000000000000..95bda64202159 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ProductSetAdvancedPricingActionGroup.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ProductSetAdvancedPricingActionGroup"> + <annotations> + <description>Sets the provided Advanced Pricing on the Admin Product creation/edit page.</description> + </annotations> + <arguments> + <argument name="website" type="string" defaultValue=""/> + <argument name="group" type="string" defaultValue="Retailer"/> + <argument name="quantity" type="string" defaultValue="1"/> + <argument name="price" type="string" defaultValue="Discount"/> + <argument name="amount" type="string" defaultValue="45"/> + </arguments> + + <click selector="{{AdminProductFormSection.advancedPricingLink}}" stepKey="clickOnAdvancedPricingButton"/> + <waitForElement selector="{{AdminProductFormAdvancedPricingSection.customerGroupPriceAddButton}}" stepKey="waitForCustomerGroupPriceAddButton"/> + <click selector="{{AdminProductFormAdvancedPricingSection.customerGroupPriceAddButton}}" stepKey="addCustomerGroupAllGroupsQty1PriceDiscountAnd10percent"/> + <waitForElement selector="{{AdminProductFormAdvancedPricingSection.productTierPriceCustGroupSelect('0')}}" stepKey="waitForSelectCustomerGroupNameAttribute2"/> + <selectOption selector="{{AdminProductFormAdvancedPricingSection.productTierPriceWebsiteSelect('0')}}" userInput="{{website}}" stepKey="selectProductWebsiteValue"/> + <selectOption selector="{{AdminProductFormAdvancedPricingSection.productTierPriceCustGroupSelect('0')}}" userInput="{{group}}" stepKey="selectProductCustomGroupValue"/> + <fillField selector="{{AdminProductFormAdvancedPricingSection.productTierPriceQtyInput('0')}}" userInput="{{quantity}}" stepKey="fillProductTierPriceQtyInput"/> + <selectOption selector="{{AdminProductFormAdvancedPricingSection.productTierPriceValueTypeSelect('0')}}" userInput="{{price}}" stepKey="selectProductTierPriceValueType"/> + <fillField selector="{{AdminProductFormAdvancedPricingSection.productTierPricePercentageValuePriceInput('0')}}" userInput="{{amount}}" stepKey="selectProductTierPricePriceInput"/> + <click selector="{{AdminProductFormAdvancedPricingSection.doneButton}}" stepKey="clickDoneButton"/> + <waitForPageLoad stepKey="WaitForProductSave"/> + <click selector="{{AdminProductFormAdvancedPricingSection.save}}" stepKey="clickSaveProduct1"/> + <waitForPageLoad time="60" stepKey="WaitForProductSave1"/> + <see userInput="You saved the product." stepKey="seeSaveConfirmation"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ProductSetAdvancedTierFixedPricingActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ProductSetAdvancedTierFixedPricingActionGroup.xml new file mode 100644 index 0000000000000..97d09fb3e1018 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ProductSetAdvancedTierFixedPricingActionGroup.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ProductSetAdvancedTierFixedPricingActionGroup" extends="ProductSetAdvancedPricingActionGroup"> + <remove keyForRemoval="selectProductTierPricePriceInput"/> + <fillField selector="{{AdminProductFormAdvancedPricingSection.productTierPriceFixedPriceInput('0')}}" userInput="{{amount}}" stepKey="selectProductTierPricePriceInput" after="selectProductTierPriceValueType"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ProductSetWebsiteActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ProductSetWebsiteActionGroup.xml new file mode 100644 index 0000000000000..a2439a34bc7be --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ProductSetWebsiteActionGroup.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ProductSetWebsiteActionGroup"> + <annotations> + <description>Sets the provided Website on the Admin Product creation/edit page.</description> + </annotations> + <arguments> + <argument name="website" type="string"/> + </arguments> + + <scrollTo selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="scrollToWebsites"/> + <conditionalClick selector="{{ProductInWebsitesSection.sectionHeader}}" dependentSelector="{{ProductInWebsitesSection.website(website)}}" visible="false" stepKey="clickToOpenProductInWebsite"/> + <waitForPageLoad stepKey="waitForPageOpened"/> + <click selector="{{ProductInWebsitesSection.website(website)}}" stepKey="selectWebsite"/> + <click selector="{{AdminProductFormAdvancedPricingSection.save}}" stepKey="clickSaveProduct"/> + <waitForPageLoad time='60' stepKey="waitForProducrSaved"/> + <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForSaveSuccessMessage"/> + <see selector="{{AdminMessagesSection.success}}" userInput="You saved the product." stepKey="seeSaveSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/RemoveCategoryFromProductActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/RemoveCategoryFromProductActionGroup.xml new file mode 100644 index 0000000000000..37e7d6173d3a4 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/RemoveCategoryFromProductActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="RemoveCategoryFromProductActionGroup"> + <arguments> + <argument name="categoryName" type="string" defaultValue="{{_defaultCategory.name}}"/> + </arguments> + <click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="clickCategoriesDropDown"/> + <click selector="{{AdminProductFormSection.unselectCategories(categoryName)}}" stepKey="unselectCategories"/> + <click selector="{{AdminProductFormSection.done}}" stepKey="clickOnDoneAdvancedCategory"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/RemoveCategoryImageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/RemoveCategoryImageActionGroup.xml new file mode 100644 index 0000000000000..4febb8fd82c91 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/RemoveCategoryImageActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="RemoveCategoryImageActionGroup"> + <annotations> + <description>Requires navigation to the Category creation/edit page. Removes the current Category image. Validates that the Image does not exist.</description> + </annotations> + + <conditionalClick selector="{{AdminCategoryContentSection.sectionHeader}}" dependentSelector="{{AdminCategoryContentSection.uploadButton}}" visible="false" stepKey="openContentSection"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <waitForElementVisible selector="{{AdminCategoryContentSection.uploadButton}}" stepKey="seeImageSectionIsReady"/> + <click selector="{{AdminCategoryContentSection.removeImageButton}}" stepKey="clickRemoveImage"/> + <waitForAjaxLoad time="30" stepKey="waitForAjaxUpload"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoading"/> + <dontSee selector="{{AdminCategoryContentSection.imageFileName}}" stepKey="dontSeeImage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/RemoveProductImageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/RemoveProductImageActionGroup.xml new file mode 100644 index 0000000000000..6a56828b30308 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/RemoveProductImageActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="RemoveProductImageActionGroup"> + <annotations> + <description>Removes a Product Image on the Admin Products creation/edit page.</description> + </annotations> + + <conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductImagesSection"/> + <waitForPageLoad time="30" stepKey="waitForPageRefresh"/> + <click selector="{{AdminProductImagesSection.removeImageButton}}" stepKey="clickRemoveImage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/RemoveProductImageByNameActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/RemoveProductImageByNameActionGroup.xml new file mode 100644 index 0000000000000..fc931cbe37b25 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/RemoveProductImageByNameActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="RemoveProductImageByNameActionGroup" extends="RemoveProductImageActionGroup"> + <annotations> + <description>Removes a Product Image on the Admin Products creation/edit page by name.</description> + </annotations> + + <arguments> + <argument name="image" defaultValue="ProductImage"/> + </arguments> + <click selector="{{AdminProductImagesSection.removeImageButtonForExactImage(image.fileName)}}" stepKey="clickRemoveImage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ResetImportOptionFilterActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ResetImportOptionFilterActionGroup.xml new file mode 100644 index 0000000000000..f73a4f4ed5e4f --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ResetImportOptionFilterActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ResetImportOptionFilterActionGroup"> + <annotations> + <description>Click on the Reset Filters button for the Import Options filters on the Product grid page.</description> + </annotations> + + <conditionalClick selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" visible="false" stepKey="openCustomOptionSection"/> + <click selector="{{AdminProductCustomizableOptionsSection.importOptions}}" stepKey="clickImportOptions"/> + <click selector="{{AdminProductImportOptionsSection.resetFiltersButton}}" stepKey="clickResetFilterButton"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ResetProductGridToDefaultViewActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ResetProductGridToDefaultViewActionGroup.xml new file mode 100644 index 0000000000000..441fe377bd435 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ResetProductGridToDefaultViewActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <!--Reset the product grid to the default view--> + <actionGroup name="ResetProductGridToDefaultViewActionGroup"> + <annotations> + <description>Sets the Admin Products grid view to the 'Default View'.</description> + </annotations> + + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> + <click selector="{{AdminProductGridFilterSection.viewDropdown}}" stepKey="openViewBookmarksTab"/> + <click selector="{{AdminProductGridFilterSection.viewBookmark('Default View')}}" stepKey="resetToDefaultGridView"/> + <waitForPageLoad stepKey="waitForProductGridLoad"/> + <see selector="{{AdminProductGridFilterSection.viewDropdown}}" userInput="Default View" stepKey="seeDefaultViewSelected"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SaveAttributeSetActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SaveAttributeSetActionGroup.xml new file mode 100644 index 0000000000000..4e8efe0885425 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SaveAttributeSetActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SaveAttributeSetActionGroup"> + <annotations> + <description>Save an Attribute Set on the Attribute Set creation/edit page.</description> + </annotations> + + <click selector="{{AdminProductAttributeSetActionSection.save}}" stepKey="clickSave"/> + <see userInput="You saved the attribute set" selector="{{AdminMessagesSection.success}}" stepKey="successMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SaveCategoryFormActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SaveCategoryFormActionGroup.xml new file mode 100644 index 0000000000000..ff6afb4aaf0e9 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SaveCategoryFormActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SaveCategoryFormActionGroup"> + <annotations> + <description>Requires navigation to the Category creation/edit page. Checks that the url contains the AdminCategoryPage url. Saves the Category.</description> + </annotations> + + <seeInCurrentUrl url="{{AdminCategoryPage.url}}" stepKey="seeOnCategoryPage"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/> + <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="assertSuccess"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SaveProductAttributeActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SaveProductAttributeActionGroup.xml new file mode 100644 index 0000000000000..e1bf2dea21318 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SaveProductAttributeActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SaveProductAttributeActionGroup"> + <annotations> + <description>Clicks on Save. Validates that the Success Message is present.</description> + </annotations> + + <waitForElementVisible selector="{{AttributePropertiesSection.Save}}" stepKey="waitForSaveButton"/> + <click selector="{{AttributePropertiesSection.Save}}" stepKey="clickSaveButton"/> + <waitForPageLoad stepKey="waitForAttributeToSave"/> + <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SaveProductAttributeInUseActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SaveProductAttributeInUseActionGroup.xml new file mode 100644 index 0000000000000..4da8232e8405d --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SaveProductAttributeInUseActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SaveProductAttributeInUseActionGroup"> + <annotations> + <description>Clicks on Save. Validates that the Success Message is present.</description> + </annotations> + + <waitForElementVisible selector="{{AttributePropertiesSection.Save}}" stepKey="waitForSaveButton"/> + <click selector="{{AttributePropertiesSection.Save}}" stepKey="clickSaveButton"/> + <waitForPageLoad stepKey="waitForAttributeToSave"/> + <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SaveProductFormActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SaveProductFormActionGroup.xml new file mode 100644 index 0000000000000..f2524d6e68bfc --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SaveProductFormActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SaveProductFormActionGroup"> + <annotations> + <description>Clicks on the Save button. Validates that the Success Message is present and correct.</description> + </annotations> + + <scrollToTopOfPage stepKey="scrollTopPageProduct"/> + <waitForElementVisible selector="{{AdminProductFormActionSection.saveButton}}" stepKey="waitForSaveProductButton"/> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveProduct"/> + <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitProductSaveSuccessMessage"/> + <see selector="{{AdminMessagesSection.success}}" userInput="You saved the product." stepKey="seeSaveConfirmation"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SaveProductFormNoSuccessCheckActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SaveProductFormNoSuccessCheckActionGroup.xml new file mode 100644 index 0000000000000..eb1cc33de9de8 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SaveProductFormNoSuccessCheckActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SaveProductFormNoSuccessCheckActionGroup" extends="SaveProductFormActionGroup"> + <annotations> + <description>EXTENDS: saveProductForm. Removes 'waitProductSaveSuccessMessage' and 'seeSaveConfirmation'.</description> + </annotations> + + <remove keyForRemoval="waitProductSaveSuccessMessage"/> + <remove keyForRemoval="seeSaveConfirmation"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SearchForProductOnBackendActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SearchForProductOnBackendActionGroup.xml index 8b289f21f76b4..4c34feff4c943 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SearchForProductOnBackendActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SearchForProductOnBackendActionGroup.xml @@ -23,26 +23,4 @@ <fillField userInput="{{product.sku}}" selector="{{AdminProductFiltersSection.skuInput}}" stepKey="fillSkuFieldOnFiltersSection"/> <click selector="{{AdminProductFiltersSection.apply}}" stepKey="clickApplyFiltersButton"/> </actionGroup> - - <actionGroup name="SearchForProductOnBackendByNameActionGroup" extends="SearchForProductOnBackendActionGroup"> - <annotations> - <description>Search for the provided Product Name.</description> - </annotations> - <arguments> - <argument name="productName" type="string"/> - </arguments> - - <remove keyForRemoval="fillSkuFieldOnFiltersSection"/> - <fillField userInput="{{productName}}" selector="{{AdminProductFiltersSection.nameInput}}" after="cleanFiltersIfTheySet" stepKey="fillNameFieldOnFiltersSection"/> - </actionGroup> - - <actionGroup name="ClearProductsFilterActionGroup"> - <annotations> - <description>Goto the Product grid page. Clear the Search Filters for the grid.</description> - </annotations> - - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> - <waitForPageLoad time="30" stepKey="waitForProductsPageToLoad"/> - <conditionalClick selector="{{AdminProductFiltersSection.clearFiltersButton}}" dependentSelector="{{AdminProductFiltersSection.clearFiltersButton}}" visible="true" stepKey="cleanFiltersIfTheySet"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SearchForProductOnBackendByNameActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SearchForProductOnBackendByNameActionGroup.xml new file mode 100644 index 0000000000000..b46a3f5818aff --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SearchForProductOnBackendByNameActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SearchForProductOnBackendByNameActionGroup" extends="SearchForProductOnBackendActionGroup"> + <annotations> + <description>Search for the provided Product Name.</description> + </annotations> + <arguments> + <argument name="productName" type="string"/> + </arguments> + + <remove keyForRemoval="fillSkuFieldOnFiltersSection"/> + <fillField userInput="{{productName}}" selector="{{AdminProductFiltersSection.nameInput}}" after="cleanFiltersIfTheySet" stepKey="fillNameFieldOnFiltersSection"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SearchProductGridByKeyword2ActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SearchProductGridByKeyword2ActionGroup.xml new file mode 100644 index 0000000000000..bf9ca75f144b5 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SearchProductGridByKeyword2ActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SearchProductGridByKeyword2ActionGroup"> + <annotations> + <description>Searches the Admin Products grid for the provided Keyword.</description> + </annotations> + <arguments> + <argument name="keyword" type="string"/> + </arguments> + + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> + <fillField selector="{{AdminProductGridFilterSection.keywordSearch}}" userInput="{{keyword}}" stepKey="fillKeywordSearchField"/> + <click selector="{{AdminProductGridFilterSection.keywordSearchButton}}" stepKey="clickKeywordSearch"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SearchProductGridByKeywordActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SearchProductGridByKeywordActionGroup.xml new file mode 100644 index 0000000000000..e3370864e7f61 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SearchProductGridByKeywordActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SearchProductGridByKeywordActionGroup"> + <annotations> + <description>Searches the Admin Products grid for the provided Keyword.</description> + </annotations> + <arguments> + <argument name="keyword"/> + </arguments> + + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> + <fillField selector="{{AdminProductGridFilterSection.keywordSearch}}" userInput="{{keyword}}" stepKey="fillKeywordSearchField"/> + <click selector="{{AdminProductGridFilterSection.keywordSearchButton}}" stepKey="clickKeywordSearch"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SelectProductInWebsitesActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SelectProductInWebsitesActionGroup.xml new file mode 100644 index 0000000000000..bc3a865c3c365 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SelectProductInWebsitesActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SelectProductInWebsitesActionGroup"> + <annotations> + <description>Sets the provided Website on the Admin Product creation/edit page.</description> + </annotations> + <arguments> + <argument name="website" type="string"/> + </arguments> + + <scrollTo selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="scrollToWebsites"/> + <conditionalClick selector="{{ProductInWebsitesSection.sectionHeader}}" dependentSelector="{{AdminProductContentSection.sectionHeaderShow}}" visible="false" stepKey="expandSection"/> + <waitForPageLoad stepKey="waitForPageOpened"/> + <checkOption selector="{{ProductInWebsitesSection.website(website)}}" stepKey="selectWebsite"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SetCategoryByNameActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SetCategoryByNameActionGroup.xml new file mode 100644 index 0000000000000..feca7e59e7b23 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SetCategoryByNameActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SetCategoryByNameActionGroup"> + <annotations> + <description>Sets the provided Category Name for a Product on the Product creation/edit page.</description> + </annotations> + <arguments> + <argument name="categoryName" type="string"/> + </arguments> + + <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[{{categoryName}}]" stepKey="searchAndSelectCategory"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SetProductUrlKeyActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SetProductUrlKeyActionGroup.xml new file mode 100644 index 0000000000000..a75e8f6b764b1 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SetProductUrlKeyActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SetProductUrlKeyActionGroup"> + <annotations> + <description>Fills the Product details (URL) for the SEO section.</description> + </annotations> + <arguments> + <argument name="product" defaultValue="_defaultProduct"/> + </arguments> + + <click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/> + <fillField userInput="{{product.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SetProductUrlKeyByStringActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SetProductUrlKeyByStringActionGroup.xml new file mode 100644 index 0000000000000..d4c654523a40b --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SetProductUrlKeyByStringActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SetProductUrlKeyByStringActionGroup"> + <annotations> + <description>Fills the Product SEO URL Key.</description> + </annotations> + <arguments> + <argument name="urlKey" type="string"/> + </arguments> + + <click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/> + <fillField userInput="{{urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SortProductsByIdAscendingActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SortProductsByIdAscendingActionGroup.xml new file mode 100644 index 0000000000000..38585277476f8 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SortProductsByIdAscendingActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SortProductsByIdAscendingActionGroup"> + <annotations> + <description>Filters the ID column in Ascending Order.</description> + </annotations> + + <conditionalClick selector="{{AdminProductGridTableHeaderSection.id('descend')}}" dependentSelector="{{AdminProductGridTableHeaderSection.id('ascend')}}" visible="false" stepKey="sortById"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SortProductsByIdDescendingActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SortProductsByIdDescendingActionGroup.xml new file mode 100644 index 0000000000000..635e36c458519 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SortProductsByIdDescendingActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SortProductsByIdDescendingActionGroup"> + <annotations> + <description>Filters the ID column in Descending Order.</description> + </annotations> + + <conditionalClick selector="{{AdminProductGridTableHeaderSection.id('ascend')}}" dependentSelector="{{AdminProductGridTableHeaderSection.id('descend')}}" visible="false" stepKey="sortById"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAddCategoryProductToCompareActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAddCategoryProductToCompareActionGroup.xml new file mode 100644 index 0000000000000..d4678a97c5bc2 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAddCategoryProductToCompareActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <!-- Add Product to Compare from the category page and check message --> + <actionGroup name="StorefrontAddCategoryProductToCompareActionGroup"> + <annotations> + <description>Add a Product to the Compare Product list from a Category page.</description> + </annotations> + <arguments> + <argument name="productVar"/> + </arguments> + + <moveMouseOver selector="{{StorefrontCategoryProductSection.ProductInfoByName(productVar.name)}}" stepKey="moveMouseOverProduct"/> + <click selector="{{StorefrontCategoryProductSection.ProductAddToCompareByName(productVar.name)}}" stepKey="clickAddProductToCompare"/> + <waitForElement selector="{{StorefrontMessagesSection.success}}" time="30" stepKey="waitForAddCategoryProductToCompareSuccessMessage"/> + <see selector="{{StorefrontMessagesSection.success}}" userInput="You added product {{productVar.name}} to the comparison list." stepKey="assertAddCategoryProductToCompareSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAddProductToCompareActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAddProductToCompareActionGroup.xml new file mode 100644 index 0000000000000..ee3a5067449dc --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAddProductToCompareActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontAddProductToCompareActionGroup"> + <annotations> + <description>Add a Product to the Compare Product list. Validate that the Success Message is present.</description> + </annotations> + <arguments> + <argument name="productVar"/> + </arguments> + + <click selector="{{StorefrontProductInfoMainSection.productAddToCompare}}" stepKey="clickAddToCompare"/> + <waitForElement selector="{{StorefrontMessagesSection.success}}" time="30" stepKey="waitForAddProductToCompareSuccessMessage"/> + <see selector="{{StorefrontMessagesSection.success}}" userInput="You added product {{productVar.name}} to the comparison list." stepKey="assertAddProductToCompareSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAddSimpleProductWithQtyActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAddSimpleProductWithQtyActionGroup.xml new file mode 100644 index 0000000000000..273893aa49445 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAddSimpleProductWithQtyActionGroup.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontAddSimpleProductWithQtyActionGroup" extends="AddSimpleProductToCartActionGroup"> + <arguments> + <argument name="quantity" type="string" defaultValue="1"/> + </arguments> + <fillField userInput="{{quantity}}" selector="{{StorefrontProductPageSection.qtyInput}}" stepKey="fillProductQty" after="goToProductPage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAssertActiveProductImageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAssertActiveProductImageActionGroup.xml new file mode 100644 index 0000000000000..0e7da54bd4028 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAssertActiveProductImageActionGroup.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontAssertActiveProductImageActionGroup"> + <arguments> + <argument name="fileName" defaultValue="magento-logo" type="string"/> + </arguments> + <seeElement selector="{{StorefrontProductMediaSection.productImageActive(fileName)}}" stepKey="seeActiveImageDefault"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAssertFotoramaImageAvailabilityActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAssertFotoramaImageAvailabilityActionGroup.xml new file mode 100644 index 0000000000000..79ea22403646f --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAssertFotoramaImageAvailabilityActionGroup.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontAssertFotoramaImageAvailabilityActionGroup"> + <arguments> + <argument name="fileName" type="string" defaultValue="magento-logo"/> + </arguments> + <seeElement selector="{{StorefrontProductMediaSection.productImageInFotorama(fileName)}}" stepKey="seeActiveImageDefault"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAssertProductImagesOnProductPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAssertProductImagesOnProductPageActionGroup.xml index ad9fa9a576c7d..d15686ec3bddc 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAssertProductImagesOnProductPageActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAssertProductImagesOnProductPageActionGroup.xml @@ -24,12 +24,4 @@ <click selector="{{StorefrontProductMediaSection.closeFullscreenImage}}" stepKey="closeFullScreenImage"/> <waitForPageLoad stepKey="waitForGalleryDisappear"/> </actionGroup> - - <!--Check availability image in fotorama--> - <actionGroup name="StorefrontAssertFotoramaImageAvailablity"> - <arguments> - <argument name="fileName" type="string" defaultValue="magento-logo"/> - </arguments> - <seeElement selector="{{StorefrontProductMediaSection.productImageInFotorama(fileName)}}" stepKey="seeActiveImageDefault"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAssertProductInRecentlyComparedWidgetActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAssertProductInRecentlyComparedWidgetActionGroup.xml new file mode 100644 index 0000000000000..43db9d96a4f50 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAssertProductInRecentlyComparedWidgetActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontAssertProductInRecentlyComparedWidgetActionGroup"> + <annotations> + <description>Validate that the provided Product appears in the Recently Compared Products widget.</description> + </annotations> + <arguments> + <argument name="product"/> + </arguments> + + <waitForElementVisible selector="{{StorefrontWidgetsSection.widgetRecentlyComparedProductsGrid}}" stepKey="waitWidgetRecentlyComparedProductsGrid"/> + <see selector="{{StorefrontWidgetsSection.widgetRecentlyComparedProductsGrid}}" userInput="{{product.name}}" stepKey="seeProductInRecentlyComparedWidget"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAssertProductInRecentlyOrderedWidgetActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAssertProductInRecentlyOrderedWidgetActionGroup.xml new file mode 100644 index 0000000000000..de0cb05f7c5a1 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAssertProductInRecentlyOrderedWidgetActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontAssertProductInRecentlyOrderedWidgetActionGroup"> + <annotations> + <description>Validate that the provided Product appears in the Recently Ordered Products widget.</description> + </annotations> + <arguments> + <argument name="product"/> + </arguments> + + <waitForElementVisible selector="{{StorefrontWidgetsSection.widgetRecentlyOrderedProductsGrid}}" stepKey="waitWidgetRecentlyOrderedProductsGrid"/> + <see selector="{{StorefrontWidgetsSection.widgetRecentlyOrderedProductsGrid}}" userInput="{{product.name}}" stepKey="seeProductInRecentlyOrderedWidget"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAssertProductInWidgetActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAssertProductInWidgetActionGroup.xml index 3caa58e16654f..81bce368a0c06 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAssertProductInWidgetActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAssertProductInWidgetActionGroup.xml @@ -20,30 +20,4 @@ <waitForElementVisible selector="{{StorefrontWidgetsSection.widgetRecentlyViewedProductsGrid}}" stepKey="waitWidgetRecentlyViewedProductsGrid"/> <see selector="{{StorefrontWidgetsSection.widgetRecentlyViewedProductsGrid}}" userInput="{{product.name}}" stepKey="seeProductInRecentlyViewedWidget"/> </actionGroup> - - <!-- Check the product in recently compared widget --> - <actionGroup name="StorefrontAssertProductInRecentlyComparedWidgetActionGroup"> - <annotations> - <description>Validate that the provided Product appears in the Recently Compared Products widget.</description> - </annotations> - <arguments> - <argument name="product"/> - </arguments> - - <waitForElementVisible selector="{{StorefrontWidgetsSection.widgetRecentlyComparedProductsGrid}}" stepKey="waitWidgetRecentlyComparedProductsGrid"/> - <see selector="{{StorefrontWidgetsSection.widgetRecentlyComparedProductsGrid}}" userInput="{{product.name}}" stepKey="seeProductInRecentlyComparedWidget"/> - </actionGroup> - - <!-- Check the product in recently ordered widget --> - <actionGroup name="StorefrontAssertProductInRecentlyOrderedWidgetActionGroup"> - <annotations> - <description>Validate that the provided Product appears in the Recently Ordered Products widget.</description> - </annotations> - <arguments> - <argument name="product"/> - </arguments> - - <waitForElementVisible selector="{{StorefrontWidgetsSection.widgetRecentlyOrderedProductsGrid}}" stepKey="waitWidgetRecentlyOrderedProductsGrid"/> - <see selector="{{StorefrontWidgetsSection.widgetRecentlyOrderedProductsGrid}}" userInput="{{product.name}}" stepKey="seeProductInRecentlyOrderedWidget"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAssertProductPriceOnCategoryPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAssertProductPriceOnCategoryPageActionGroup.xml new file mode 100644 index 0000000000000..bc341fa09bfab --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAssertProductPriceOnCategoryPageActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontAssertProductPriceOnCategoryPageActionGroup" extends="StorefrontAssertProductPriceOnProductPageActionGroup"> + <annotations> + <description>Validate that the provided Product Price is correct on category page.</description> + </annotations> + <arguments> + <argument name="productName" type="string"/> + </arguments> + + <see userInput="{{productPrice}}" selector="{{StorefrontCategoryProductSection.ProductPriceByName(productName)}}" stepKey="seeProductPrice"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryActionGroup.xml deleted file mode 100644 index 9393669f6e46d..0000000000000 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryActionGroup.xml +++ /dev/null @@ -1,124 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <!-- Go to storefront category product page by given parameters --> - <actionGroup name="GoToStorefrontCategoryPageByParameters"> - <annotations> - <description>Goes to the Storefront Category page using URI Search Parameters.</description> - </annotations> - <arguments> - <argument name="category" type="string"/> - <argument name="mode" type="string"/> - <argument name="numOfProductsPerPage" type="string"/> - <argument name="sortBy" type="string" defaultValue="position"/> - <argument name="sort" type="string" defaultValue="asc"/> - </arguments> - - <!-- Go to storefront category page --> - <amOnPage url="{{StorefrontCategoryPage.url(category)}}?product_list_limit={{numOfProductsPerPage}}&product_list_mode={{mode}}&product_list_order={{sortBy}}&product_list_dir={{sort}}" stepKey="onCategoryPage"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - </actionGroup> - - <actionGroup name="VerifyCategoryPageParameters"> - <annotations> - <description>Validate that the Category Page parameters are present and correct.</description> - </annotations> - <arguments> - <argument name="category"/> - <argument name="mode" type="string"/> - <argument name="numOfProductsPerPage" type="string"/> - <argument name="sortBy" type="string" defaultValue="position"/> - </arguments> - - <seeInCurrentUrl url="/{{category.custom_attributes[url_key]}}.html" stepKey="checkUrl"/> - <seeInTitle userInput="{{category.name}}" stepKey="assertCategoryNameInTitle"/> - <see userInput="{{category.name}}" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="assertCategoryName"/> - <see userInput="{{mode}}" selector="{{StorefrontCategoryMainSection.modeGridIsActive}}" stepKey="assertViewMode"/> - <see userInput="{{numOfProductsPerPage}}" selector="{{StorefrontCategoryMainSection.perPage}}" stepKey="assertNumberOfProductsPerPage"/> - <see userInput="{{sortBy}}" selector="{{StorefrontCategoryMainSection.sortedBy}}" stepKey="assertSortedBy"/> - </actionGroup> - - <!-- Check the category page --> - <actionGroup name="StorefrontCheckCategoryActionGroup"> - <annotations> - <description>Validate that the Storefront Category is present and correct.</description> - </annotations> - <arguments> - <argument name="category"/> - <argument name="productCount" type="string"/> - </arguments> - - <seeInCurrentUrl url="/{{category.custom_attributes[url_key]}}.html" stepKey="checkUrl"/> - <seeInTitle userInput="{{category.name}}" stepKey="assertCategoryNameInTitle"/> - <see userInput="{{category.name}}" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="assertCategoryName"/> - <see userInput="{{productCount}}" selector="{{StorefrontCategoryMainSection.productCount}} span" stepKey="assertProductCount"/> - </actionGroup> - - <!-- Check simple product on the category page --> - <actionGroup name="StorefrontCheckCategorySimpleProduct"> - <annotations> - <description>Validate that the provided Simple Product is present and correct on a Category page.</description> - </annotations> - <arguments> - <argument name="product"/> - </arguments> - - <seeElement selector="{{StorefrontCategoryProductSection.ProductTitleByName(product.name)}}" stepKey="assertProductName"/> - <see userInput="${{product.price}}.00" selector="{{StorefrontCategoryProductSection.ProductPriceByName(product.name)}}" stepKey="AssertProductPrice"/> - <!-- @TODO: MAGETWO-80272 Move to Magento_Checkout --> - <moveMouseOver selector="{{StorefrontCategoryProductSection.ProductInfoByName(product.name)}}" stepKey="moveMouseOverProduct"/> - <!-- @TODO: MAGETWO-80272 Move to Magento_Checkout --> - <seeElement selector="{{StorefrontCategoryProductSection.ProductAddToCartByName(product.name)}}" stepKey="AssertAddToCart"/> - </actionGroup> - - <actionGroup name="AssertProductOnCategoryPageActionGroup" extends="StorefrontCheckCategorySimpleProduct"> - <annotations> - <description>EXTENDS:StorefrontCheckCategorySimpleProduct. Removes 'AssertProductPrice', 'moveMouseOverProduct', 'AssertAddToCart'</description> - </annotations> - <remove keyForRemoval="AssertProductPrice"/> - <remove keyForRemoval="moveMouseOverProduct"/> - <remove keyForRemoval="AssertAddToCart"/> - </actionGroup> - - <actionGroup name="StorefrontCheckAddToCartButtonAbsence"> - <arguments> - <argument name="product" defaultValue="_defaultProduct"/> - </arguments> - <moveMouseOver selector="{{StorefrontCategoryProductSection.ProductInfoByName(product.name)}}" stepKey="moveMouseOverProduct" /> - <dontSeeElement selector="{{StorefrontCategoryProductSection.ProductAddToCartByName(product.name)}}" stepKey="checkAddToCartButtonAbsence"/> - </actionGroup> - <actionGroup name="StorefrontSwitchCategoryViewToListMode"> - <annotations> - <description>Switch the Storefront Category view to List.</description> - </annotations> - - <click selector="{{StorefrontCategoryMainSection.modeListButton}}" stepKey="switchCategoryViewToListMode"/> - <waitForElement selector="{{StorefrontCategoryMainSection.CategoryTitle}}" time="30" stepKey="waitForCategoryReload"/> - </actionGroup> - - <actionGroup name="GoToSubCategoryPage"> - <annotations> - <description>Goes to the Storefront page. Open the Parent Category menu in the Top Nav Menu. Click on a Subcategory. Validate that the Subcategory is present and correct.</description> - </annotations> - <arguments> - <argument name="parentCategory"/> - <argument name="subCategory"/> - <argument name="urlPath" type="string"/> - </arguments> - - <moveMouseOver selector="{{StorefrontHeaderSection.NavigationCategoryByName(parentCategory.name)}}" stepKey="moveMouseOnMainCategory"/> - <waitForElementVisible selector="{{StorefrontHeaderSection.NavigationCategoryByName(subCategory.name)}}" stepKey="waitForSubCategoryVisible"/> - <click selector="{{StorefrontHeaderSection.NavigationCategoryByName(subCategory.name)}}" stepKey="goToCategory"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <seeInCurrentUrl url="{{urlPath}}.html" stepKey="checkUrl"/> - <seeInTitle userInput="{{subCategory.name}}" stepKey="assertCategoryNameInTitle"/> - <see userInput="{{subCategory.name}}" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="assertCategoryName"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryPageSortAscendingActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryPageSortAscendingActionGroup.xml new file mode 100644 index 0000000000000..f456ca6bece55 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryPageSortAscendingActionGroup.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCategoryPageSortAscendingActionGroup"> + <annotations> + <description>Set Ascending Direction for sorting Products on Category page</description> + </annotations> + <click selector="{{StorefrontCategoryTopToolbarSection.sortDirectionAsc}}" stepKey="setAscendingDirection"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryPageSortDescendingActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryPageSortDescendingActionGroup.xml new file mode 100644 index 0000000000000..839260b3339c8 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryPageSortDescendingActionGroup.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCategoryPageSortDescendingActionGroup"> + <annotations> + <description>Set Descending Direction for sorting Products on Category page</description> + </annotations> + <click selector="{{StorefrontCategoryTopToolbarSection.sortDirectionDesc}}" stepKey="setDescendingDirection"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryPageSortProductActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryPageSortProductActionGroup.xml index 64dd2c97a382f..5744ddaf6c69a 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryPageSortProductActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryPageSortProductActionGroup.xml @@ -17,16 +17,4 @@ </arguments> <selectOption selector="{{StorefrontCategoryTopToolbarSection.sortByDropdown}}" userInput="{{sortBy}}" stepKey="selectSortByParameter"/> </actionGroup> - <actionGroup name="StorefrontCategoryPageSortAscendingActionGroup"> - <annotations> - <description>Set Ascending Direction for sorting Products on Category page</description> - </annotations> - <click selector="{{StorefrontCategoryTopToolbarSection.sortDirectionAsc}}" stepKey="setAscendingDirection"/> - </actionGroup> - <actionGroup name="StorefrontCategoryPageSortDescendingActionGroup"> - <annotations> - <description>Set Descending Direction for sorting Products on Category page</description> - </annotations> - <click selector="{{StorefrontCategoryTopToolbarSection.sortDirectionDesc}}" stepKey="setDescendingDirection"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckAddToCartButtonAbsenceActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckAddToCartButtonAbsenceActionGroup.xml new file mode 100644 index 0000000000000..66eb61b4aa8ec --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckAddToCartButtonAbsenceActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCheckAddToCartButtonAbsenceActionGroup"> + <arguments> + <argument name="product" defaultValue="_defaultProduct"/> + </arguments> + <moveMouseOver selector="{{StorefrontCategoryProductSection.ProductInfoByName(product.name)}}" stepKey="moveMouseOverProduct" /> + <dontSeeElement selector="{{StorefrontCategoryProductSection.ProductAddToCartByName(product.name)}}" stepKey="checkAddToCartButtonAbsence"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckCategoryActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckCategoryActionGroup.xml new file mode 100644 index 0000000000000..695ba39f5d397 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckCategoryActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCheckCategoryActionGroup"> + <annotations> + <description>Validate that the Storefront Category is present and correct.</description> + </annotations> + <arguments> + <argument name="category"/> + <argument name="productCount" type="string"/> + </arguments> + + <seeInCurrentUrl url="/{{category.custom_attributes[url_key]}}.html" stepKey="checkUrl"/> + <seeInTitle userInput="{{category.name}}" stepKey="assertCategoryNameInTitle"/> + <see userInput="{{category.name}}" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="assertCategoryName"/> + <see userInput="{{productCount}}" selector="{{StorefrontCategoryMainSection.productCount}} span" stepKey="assertProductCount"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckCategorySimpleProductActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckCategorySimpleProductActionGroup.xml new file mode 100644 index 0000000000000..1f8234498ffa7 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckCategorySimpleProductActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCheckCategorySimpleProductActionGroup"> + <annotations> + <description>Validate that the provided Simple Product is present and correct on a Category page.</description> + </annotations> + <arguments> + <argument name="product"/> + </arguments> + + <seeElement selector="{{StorefrontCategoryProductSection.ProductTitleByName(product.name)}}" stepKey="assertProductName"/> + <see userInput="${{product.price}}.00" selector="{{StorefrontCategoryProductSection.ProductPriceByName(product.name)}}" stepKey="AssertProductPrice"/> + <!-- @TODO: MAGETWO-80272 Move to Magento_Checkout --> + <moveMouseOver selector="{{StorefrontCategoryProductSection.ProductInfoByName(product.name)}}" stepKey="moveMouseOverProduct"/> + <!-- @TODO: MAGETWO-80272 Move to Magento_Checkout --> + <seeElement selector="{{StorefrontCategoryProductSection.ProductAddToCartByName(product.name)}}" stepKey="AssertAddToCart"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckCompareSidebarProductActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckCompareSidebarProductActionGroup.xml new file mode 100644 index 0000000000000..220fe29337d5a --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckCompareSidebarProductActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCheckCompareSidebarProductActionGroup"> + <annotations> + <description>Validate that the Product Name is present and correct in the Compare Product list.</description> + </annotations> + <arguments> + <argument name="productVar"/> + </arguments> + + <waitForElement selector="{{StorefrontComparisonSidebarSection.ProductTitleByName(productVar.name)}}" stepKey="waitForProduct"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckCompareSimpleProductActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckCompareSimpleProductActionGroup.xml new file mode 100644 index 0000000000000..d7515d19ffbbd --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckCompareSimpleProductActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCheckCompareSimpleProductActionGroup"> + <annotations> + <description>Validate that the Simple Product is present and correct in the Compare Product area.</description> + </annotations> + <arguments> + <argument name="productVar"/> + </arguments> + + <seeElement selector="{{StorefrontProductCompareMainSection.ProductLinkByName(productVar.name)}}" stepKey="assertProductName"/> + <see userInput="${{productVar.price}}.00" selector="{{StorefrontProductCompareMainSection.ProductPriceByName(productVar.name)}}" stepKey="assertProductPrice1"/> + <see userInput="{{productVar.sku}}" selector="{{StorefrontProductCompareMainSection.ProductAttributeByCodeAndProductName('SKU', productVar.name)}}" stepKey="assertProductPrice2"/> + <!-- @TODO: MAGETWO-80272 Move to Magento_Checkout --> + <seeElement selector="{{StorefrontProductCompareMainSection.ProductAddToCartByName(productVar.name)}}" stepKey="assertProductAddToCart"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckProductIsMissingInCategoryProductsPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckProductIsMissingInCategoryProductsPageActionGroup.xml index 01751a32d2e06..a386d81f31999 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckProductIsMissingInCategoryProductsPageActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckProductIsMissingInCategoryProductsPageActionGroup.xml @@ -15,11 +15,4 @@ </arguments> <dontSee selector="{{StorefrontCategoryProductSection.ProductTitleByName(productName)}}" stepKey="dontSeeCorrectProductsOnStorefront"/> </actionGroup> - <actionGroup name="StorefrontCheckProductPositionActionGroup"> - <arguments> - <argument name="position" type="string"/> - <argument name="productName" type="string"/> - </arguments> - <see selector="{{StorefrontCategoryProductSection.ProductInfoByNumber(position)}}" userInput="{{productName}}" stepKey="assertProductPosition"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckProductPositionActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckProductPositionActionGroup.xml new file mode 100644 index 0000000000000..ce92966eb1fbf --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckProductPositionActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCheckProductPositionActionGroup"> + <arguments> + <argument name="position" type="string"/> + <argument name="productName" type="string"/> + </arguments> + <see selector="{{StorefrontCategoryProductSection.ProductInfoByNumber(position)}}" userInput="{{productName}}" stepKey="assertProductPosition"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckProductPriceInCategoryActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckProductPriceInCategoryActionGroup.xml index ac33727564505..fd843a68b9720 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckProductPriceInCategoryActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckProductPriceInCategoryActionGroup.xml @@ -9,7 +9,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <!-- You must already be on the category page --> - <actionGroup name="StorefrontCheckProductPriceInCategoryActionGroup" extends="StorefrontCheckCategorySimpleProduct"> + <actionGroup name="StorefrontCheckProductPriceInCategoryActionGroup" extends="StorefrontCheckCategorySimpleProductActionGroup"> <annotations> <description>EXTENDS: StorefrontCheckCategorySimpleProduct. Removes 'AssertProductPrice'. Validates that the provided Product Price is present and correct on a Storefront Product page.</description> </annotations> @@ -17,14 +17,4 @@ <remove keyForRemoval="AssertProductPrice"/> <see userInput="{{product.price}}" selector="{{StorefrontCategoryProductSection.ProductPriceByName(product.name)}}" stepKey="AssertProductPrice"/> </actionGroup> - <actionGroup name="StorefrontAssertProductPriceOnCategoryPageActionGroup" extends="StorefrontAssertProductPriceOnProductPageActionGroup"> - <annotations> - <description>Validate that the provided Product Price is correct on category page.</description> - </annotations> - <arguments> - <argument name="productName" type="string"/> - </arguments> - - <see userInput="{{productPrice}}" selector="{{StorefrontCategoryProductSection.ProductPriceByName(productName)}}" stepKey="seeProductPrice"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckSimpleProductActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckSimpleProductActionGroup.xml new file mode 100644 index 0000000000000..a2ebf93805819 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckSimpleProductActionGroup.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <!-- Check the simple product on the product page --> + <actionGroup name="StorefrontCheckSimpleProductActionGroup"> + <annotations> + <description>Validates that the provided Simple Product information is present and correct.</description> + </annotations> + <arguments> + <argument name="product"/> + </arguments> + + <seeInCurrentUrl url="/{{product.custom_attributes[url_key]}}.html" stepKey="checkUrl"/> + <seeInTitle userInput="{{product.name}}" stepKey="AssertProductNameInTitle"/> + <see userInput="{{product.name}}" selector="{{StorefrontProductInfoMainSection.productName}}" stepKey="assertProductName"/> + <see userInput="{{product.sku}}" selector="{{StorefrontProductInfoMainSection.productSku}}" stepKey="assertProductSku"/> + <see userInput="${{product.price}}.00" selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="assertProductPrice"/> + <see userInput="IN STOCK" selector="{{StorefrontProductInfoMainSection.productStockStatus}}" stepKey="assertInStock"/> + <seeElement selector="{{StorefrontProductInfoMainSection.AddToCart}}" stepKey="assertAddToCart"/> + <see userInput="{{product.custom_attributes[description]}}" selector="{{StorefrontProductInfoMainSection.productDescription}}" stepKey="assertProductDescription"/> + <see userInput="{{product.custom_attributes[short_description]}}" selector="{{StorefrontProductInfoMainSection.productShortDescription}}" stepKey="assertProductShortDescription"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontClearCompareActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontClearCompareActionGroup.xml new file mode 100644 index 0000000000000..995bf7efd3f39 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontClearCompareActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontClearCompareActionGroup"> + <annotations> + <description>Clear the Compare Products list. Validate that the Compare Products list is empty.</description> + </annotations> + + <waitForElementVisible selector="{{StorefrontComparisonSidebarSection.ClearAll}}" time="30" stepKey="waitForClearAll"/> + <click selector="{{StorefrontComparisonSidebarSection.ClearAll}}" stepKey="clickClearAll"/> + <waitForElementVisible selector="{{ModalConfirmationSection.OkButton}}" time="30" stepKey="waitForClearOk"/> + <scrollTo selector="{{ModalConfirmationSection.OkButton}}" stepKey="scrollToClearOk"/> + <click selector="{{ModalConfirmationSection.OkButton}}" stepKey="clickClearOk"/> + <waitForElement selector="{{StorefrontMessagesSection.message('You cleared the comparison list.')}}" time="30" stepKey="AssertMessageCleared"/> + <waitForElement selector="{{StorefrontComparisonSidebarSection.NoItemsMessage}}" time="30" stepKey="assertNoItems"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCompareActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCompareActionGroup.xml deleted file mode 100644 index b10b74c919918..0000000000000 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCompareActionGroup.xml +++ /dev/null @@ -1,95 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <!-- Add Product to Compare from the category page and check message --> - <actionGroup name="StorefrontAddCategoryProductToCompareActionGroup"> - <annotations> - <description>Add a Product to the Compare Product list from a Category page.</description> - </annotations> - <arguments> - <argument name="productVar"/> - </arguments> - - <moveMouseOver selector="{{StorefrontCategoryProductSection.ProductInfoByName(productVar.name)}}" stepKey="moveMouseOverProduct"/> - <click selector="{{StorefrontCategoryProductSection.ProductAddToCompareByName(productVar.name)}}" stepKey="clickAddProductToCompare"/> - <waitForElement selector="{{StorefrontMessagesSection.success}}" time="30" stepKey="waitForAddCategoryProductToCompareSuccessMessage"/> - <see selector="{{StorefrontMessagesSection.success}}" userInput="You added product {{productVar.name}} to the comparison list." stepKey="assertAddCategoryProductToCompareSuccessMessage"/> - </actionGroup> - - <!-- Add Product to Compare from the product page and check message --> - <actionGroup name="StorefrontAddProductToCompareActionGroup"> - <annotations> - <description>Add a Product to the Compare Product list. Validate that the Success Message is present.</description> - </annotations> - <arguments> - <argument name="productVar"/> - </arguments> - - <click selector="{{StorefrontProductInfoMainSection.productAddToCompare}}" stepKey="clickAddToCompare"/> - <waitForElement selector="{{StorefrontMessagesSection.success}}" time="30" stepKey="waitForAddProductToCompareSuccessMessage"/> - <see selector="{{StorefrontMessagesSection.success}}" userInput="You added product {{productVar.name}} to the comparison list." stepKey="assertAddProductToCompareSuccessMessage"/> - </actionGroup> - - <!-- Check the product in compare sidebar --> - <actionGroup name="StorefrontCheckCompareSidebarProductActionGroup"> - <annotations> - <description>Validate that the Product Name is present and correct in the Compare Product list.</description> - </annotations> - <arguments> - <argument name="productVar"/> - </arguments> - - <waitForElement selector="{{StorefrontComparisonSidebarSection.ProductTitleByName(productVar.name)}}" stepKey="waitForProduct"/> - </actionGroup> - - <!-- Open and check comparison page --> - <actionGroup name="StorefrontOpenAndCheckComparisionActionGroup"> - <annotations> - <description>Open the Storefront Compare Product page. Validate that the Compare Product fields are present.</description> - </annotations> - - <click selector="{{StorefrontComparisonSidebarSection.Compare}}" stepKey="clickCompare"/> - <waitForLoadingMaskToDisappear stepKey="waitForComparePageloaded"/> - <seeInCurrentUrl url="{{StorefrontProductComparePage.url}}" stepKey="checkUrl"/> - <seeInTitle userInput="Products Comparison List" stepKey="assertPageNameInTitle"/> - <see userInput="Compare Products" selector="{{StorefrontProductCompareMainSection.PageName}}" stepKey="assertPageName"/> - </actionGroup> - - <!-- Check the simple product in comparison page --> - <actionGroup name="StorefrontCheckCompareSimpleProductActionGroup"> - <annotations> - <description>Validate that the Simple Product is present and correct in the Compare Product area.</description> - </annotations> - <arguments> - <argument name="productVar"/> - </arguments> - - <seeElement selector="{{StorefrontProductCompareMainSection.ProductLinkByName(productVar.name)}}" stepKey="assertProductName"/> - <see userInput="${{productVar.price}}.00" selector="{{StorefrontProductCompareMainSection.ProductPriceByName(productVar.name)}}" stepKey="assertProductPrice1"/> - <see userInput="{{productVar.sku}}" selector="{{StorefrontProductCompareMainSection.ProductAttributeByCodeAndProductName('SKU', productVar.name)}}" stepKey="assertProductPrice2"/> - <!-- @TODO: MAGETWO-80272 Move to Magento_Checkout --> - <seeElement selector="{{StorefrontProductCompareMainSection.ProductAddToCartByName(productVar.name)}}" stepKey="assertProductAddToCart"/> - </actionGroup> - - <!-- Clear the compare list --> - <actionGroup name="StorefrontClearCompareActionGroup"> - <annotations> - <description>Clear the Compare Products list. Validate that the Compare Products list is empty.</description> - </annotations> - - <waitForElementVisible selector="{{StorefrontComparisonSidebarSection.ClearAll}}" time="30" stepKey="waitForClearAll"/> - <click selector="{{StorefrontComparisonSidebarSection.ClearAll}}" stepKey="clickClearAll"/> - <waitForElementVisible selector="{{ModalConfirmationSection.OkButton}}" time="30" stepKey="waitForClearOk"/> - <scrollTo selector="{{ModalConfirmationSection.OkButton}}" stepKey="scrollToClearOk"/> - <click selector="{{ModalConfirmationSection.OkButton}}" stepKey="clickClearOk"/> - <waitForElement selector="{{StorefrontMessagesSection.message('You cleared the comparison list.')}}" time="30" stepKey="AssertMessageCleared"/> - <waitForElement selector="{{StorefrontComparisonSidebarSection.NoItemsMessage}}" time="30" stepKey="assertNoItems"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontGoToCategoryPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontGoToCategoryPageActionGroup.xml index e8be0db38fe2c..080f3264c037b 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontGoToCategoryPageActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontGoToCategoryPageActionGroup.xml @@ -17,11 +17,4 @@ <click selector="{{StorefrontHeaderSection.NavigationCategoryByName(categoryName)}}" stepKey="toCategory"/> <waitForPageLoad stepKey="waitForCategoryPage"/> </actionGroup> - <actionGroup name="StorefrontGoToSubCategoryPageActionGroup" extends="StorefrontGoToCategoryPageActionGroup"> - <arguments> - <argument name="subCategoryName" type="string"/> - </arguments> - <moveMouseOver selector="{{StorefrontHeaderSection.NavigationCategoryByName(categoryName)}}" stepKey="toCategory"/> - <click selector="{{StorefrontHeaderSection.NavigationCategoryByName(subCategoryName)}}" stepKey="openSubCategory" after="toCategory"/> - </actionGroup> -</actionGroups> \ No newline at end of file +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontGoToSubCategoryPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontGoToSubCategoryPageActionGroup.xml new file mode 100644 index 0000000000000..71c51a9b9f567 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontGoToSubCategoryPageActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontGoToSubCategoryPageActionGroup" extends="StorefrontGoToCategoryPageActionGroup"> + <arguments> + <argument name="subCategoryName" type="string"/> + </arguments> + <moveMouseOver selector="{{StorefrontHeaderSection.NavigationCategoryByName(categoryName)}}" stepKey="toCategory"/> + <click selector="{{StorefrontHeaderSection.NavigationCategoryByName(subCategoryName)}}" stepKey="openSubCategory" after="toCategory"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontOpenAndCheckComparisionActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontOpenAndCheckComparisionActionGroup.xml new file mode 100644 index 0000000000000..1bb58d15bc096 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontOpenAndCheckComparisionActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontOpenAndCheckComparisionActionGroup"> + <annotations> + <description>Open the Storefront Compare Product page. Validate that the Compare Product fields are present.</description> + </annotations> + + <click selector="{{StorefrontComparisonSidebarSection.Compare}}" stepKey="clickCompare"/> + <waitForLoadingMaskToDisappear stepKey="waitForComparePageloaded"/> + <seeInCurrentUrl url="{{StorefrontProductComparePage.url}}" stepKey="checkUrl"/> + <seeInTitle userInput="Products Comparison List" stepKey="assertPageNameInTitle"/> + <see userInput="Compare Products" selector="{{StorefrontProductCompareMainSection.PageName}}" stepKey="assertPageName"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontOpenProductPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontOpenProductPageActionGroup.xml index e0229906ad558..899603aa27d75 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontOpenProductPageActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontOpenProductPageActionGroup.xml @@ -18,15 +18,4 @@ <amOnPage url="{{StorefrontProductPage.url(productUrl)}}" stepKey="openProductPage"/> <waitForPageLoad stepKey="waitForProductPageLoaded"/> </actionGroup> - <actionGroup name="StorefrontOpenProductPageOnSecondStore"> - <annotations> - <description>Goes to the Storefront Product page for the provided store code and Product URL.</description> - </annotations> - <arguments> - <argument name="storeCode" type="string"/> - <argument name="productUrl" type="string"/> - </arguments> - - <amOnPage url="{{StorefrontStoreViewProductPage.url(storeCode,productUrl)}}" stepKey="openProductPage"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontOpenProductPageOnSecondStoreActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontOpenProductPageOnSecondStoreActionGroup.xml new file mode 100644 index 0000000000000..00956e2099085 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontOpenProductPageOnSecondStoreActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontOpenProductPageOnSecondStoreActionGroup"> + <annotations> + <description>Goes to the Storefront Product page for the provided store code and Product URL.</description> + </annotations> + <arguments> + <argument name="storeCode" type="string"/> + <argument name="productUrl" type="string"/> + </arguments> + + <amOnPage url="{{StorefrontStoreViewProductPage.url(storeCode,productUrl)}}" stepKey="openProductPage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontProductActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontProductActionGroup.xml deleted file mode 100644 index 403b5b853d80c..0000000000000 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontProductActionGroup.xml +++ /dev/null @@ -1,90 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <!-- Check the simple product on the product page --> - <actionGroup name="StorefrontCheckSimpleProduct"> - <annotations> - <description>Validates that the provided Simple Product information is present and correct.</description> - </annotations> - <arguments> - <argument name="product"/> - </arguments> - - <seeInCurrentUrl url="/{{product.custom_attributes[url_key]}}.html" stepKey="checkUrl"/> - <seeInTitle userInput="{{product.name}}" stepKey="AssertProductNameInTitle"/> - <see userInput="{{product.name}}" selector="{{StorefrontProductInfoMainSection.productName}}" stepKey="assertProductName"/> - <see userInput="{{product.sku}}" selector="{{StorefrontProductInfoMainSection.productSku}}" stepKey="assertProductSku"/> - <see userInput="${{product.price}}.00" selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="assertProductPrice"/> - <see userInput="IN STOCK" selector="{{StorefrontProductInfoMainSection.productStockStatus}}" stepKey="assertInStock"/> - <seeElement selector="{{StorefrontProductInfoMainSection.AddToCart}}" stepKey="assertAddToCart"/> - <see userInput="{{product.custom_attributes[description]}}" selector="{{StorefrontProductInfoMainSection.productDescription}}" stepKey="assertProductDescription"/> - <see userInput="{{product.custom_attributes[short_description]}}" selector="{{StorefrontProductInfoMainSection.productShortDescription}}" stepKey="assertProductShortDescription"/> - </actionGroup> - - <!-- Assert product image in Storefront Product page --> - <actionGroup name="assertProductImageStorefrontProductPage"> - <annotations> - <description>Validates that the provided Product Image is present.</description> - </annotations> - <arguments> - <argument name="product"/> - <argument name="image" defaultValue="MagentoLogo"/> - </arguments> - - <seeInCurrentUrl url="/{{product.urlKey}}.html" stepKey="checkUrl"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <seeElement selector="{{StorefrontProductMediaSection.imageFile(image.filename)}}" stepKey="seeImage"/> - </actionGroup> - - <!-- Assert product image in Storefront Product page --> - <actionGroup name="assertProductImageStorefrontProductPage2"> - <annotations> - <description>Validates that the provided Product Image is present.</description> - </annotations> - <arguments> - <argument name="product"/> - <argument name="image" defaultValue="MagentoLogo"/> - </arguments> - - <seeInCurrentUrl url="/{{product.custom_attributes[url_key]}}.html" stepKey="checkUrl"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <seeElement selector="{{StorefrontProductMediaSection.imageFile(image.filename)}}" stepKey="seeImage"/> - </actionGroup> - - <!-- Assert no product image in Storefront Product page --> - <actionGroup name="assertProductImageNotInStorefrontProductPage"> - <annotations> - <description>Validates that the provided Product Image is not present.</description> - </annotations> - <arguments> - <argument name="product"/> - <argument name="image" defaultValue="MagentoLogo"/> - </arguments> - - <seeInCurrentUrl url="/{{product.urlKey}}.html" stepKey="checkUrl"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <dontSeeElement selector="{{StorefrontProductMediaSection.imageFile(image.filename)}}" stepKey="seeImage"/> - </actionGroup> - - <!-- Assert no product image in Storefront Product page --> - <actionGroup name="assertProductImageNotInStorefrontProductPage2"> - <annotations> - <description>Validates that the provided Product Image is not present.</description> - </annotations> - <arguments> - <argument name="product"/> - <argument name="image" defaultValue="MagentoLogo"/> - </arguments> - - <seeInCurrentUrl url="/{{product.custom_attributes[url_key]}}.html" stepKey="checkUrl"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <dontSeeElement selector="{{StorefrontProductMediaSection.imageFile(image.filename)}}" stepKey="seeImage"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontProductPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontProductPageActionGroup.xml deleted file mode 100644 index c960f14b1cd48..0000000000000 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontProductPageActionGroup.xml +++ /dev/null @@ -1,87 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <!--Click Add to Cart button in storefront product page--> - <actionGroup name="addToCartFromStorefrontProductPage"> - <annotations> - <description>Click on the Add to Cart button. Validates that the Success Message is present.</description> - </annotations> - <arguments> - <argument name="productName"/> - </arguments> - - <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addToCart"/> - <waitForPageLoad stepKey="waitForAddToCart"/> - <waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdding}}" stepKey="waitForElementNotVisibleAddToCartButtonTitleIsAdding"/> - <waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdded}}" stepKey="waitForElementNotVisibleAddToCartButtonTitleIsAdded"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> - <see selector="{{StorefrontMessagesSection.success}}" userInput="You added {{productName}} to your shopping cart." stepKey="seeAddToCartSuccessMessage"/> - </actionGroup> - - <actionGroup name="AddProductWithQtyToCartFromStorefrontProductPage" extends="addToCartFromStorefrontProductPage"> - <annotations> - <description>EXTENDS: addToCartFromStorefrontProductPage. Fills in the provided Product Quantity for the provided Product Name.</description> - </annotations> - <arguments> - <argument name="productName" type="string"/> - <argument name="productQty" type="string"/> - </arguments> - - <fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="{{productQty}}" stepKey="fillProductQuantity" before="addToCart"/> - </actionGroup> - - <!--Verify text length validation hint with multiple inputs--> - <actionGroup name="testDynamicValidationHint"> - <annotations> - <description>Validates that the Product Text Option Text Length Hint displays the correct Count for multiple inputs based on the provided Character Limit.</description> - </annotations> - <arguments> - <argument name="charLimit"/> - </arguments> - - <fillField userInput="abcde" selector="{{StorefrontProductPageSection.customTextOptionInput}}" stepKey="textInput1"/> - <see selector="{{StorefrontProductPageSection.charCounter}}" userInput="(15 remaining)" stepKey="assertHint1"/> - <fillField userInput="abcdefghjklansdmnbv" selector="{{StorefrontProductPageSection.customTextOptionInput}}" stepKey="textInput2"/> - <see selector="{{StorefrontProductPageSection.charCounter}}" userInput="(1 remaining)" stepKey="assertHint2"/> - <fillField userInput="abcdefghjklansdmnbvd" selector="{{StorefrontProductPageSection.customTextOptionInput}}" stepKey="textInput3"/> - <see selector="{{StorefrontProductPageSection.charCounter}}" userInput="(0 remaining)" stepKey="assertHint3"/> - <fillField userInput="abcdefghjklansdmnbvds" selector="{{StorefrontProductPageSection.customTextOptionInput}}" stepKey="textInput4"/> - <see selector="{{StorefrontProductPageSection.charCounter}}" userInput="(1 too many)" stepKey="assertHint4"/> - <fillField userInput="abcdefghjklansdmnbvdsasdfghjmn" selector="{{StorefrontProductPageSection.customTextOptionInput}}" stepKey="textInput5"/> - <see selector="{{StorefrontProductPageSection.charCounter}}" userInput="(10 too many)" stepKey="assertHint5"/> - </actionGroup> - - <actionGroup name="checkAttributeInMoreInformationTab"> - <annotations> - <description>Validates that the Product More Information area contains the provided Text.</description> - </annotations> - <arguments> - <argument name="attributeLabel" type="string"/> - <argument name="attributeValue" type="string"/> - </arguments> - - <click selector="{{StorefrontProductMoreInformationSection.moreInformation}}" stepKey="clickTab"/> - <see userInput="{{attributeLabel}}" selector="{{StorefrontProductMoreInformationSection.moreInformationTextArea}}" stepKey="seeAttributeLabel"/> - <see userInput="{{attributeValue}}" selector="{{StorefrontProductMoreInformationSection.moreInformationTextArea}}" stepKey="seeAttributeValue"/> - </actionGroup> - - <actionGroup name="checkAttributeNotInMoreInformationTab"> - <annotations> - <description>Validate that the More Information area does not contain the provided Text.</description> - </annotations> - <arguments> - <argument name="attributeLabel" type="string"/> - </arguments> - - <click selector="{{StorefrontProductMoreInformationSection.moreInformation}}" stepKey="clickTab"/> - <dontSee userInput="{{attributeLabel}}" selector="{{StorefrontProductMoreInformationSection.moreInformationTextArea}}" stepKey="seeAttributeLabel"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontSwitchCategoryViewToListModeActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontSwitchCategoryViewToListModeActionGroup.xml new file mode 100644 index 0000000000000..7e549294ecfe0 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontSwitchCategoryViewToListModeActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontSwitchCategoryViewToListModeActionGroup"> + <annotations> + <description>Switch the Storefront Category view to List.</description> + </annotations> + + <click selector="{{StorefrontCategoryMainSection.modeListButton}}" stepKey="switchCategoryViewToListMode"/> + <waitForElement selector="{{StorefrontCategoryMainSection.CategoryTitle}}" time="30" stepKey="waitForCategoryReload"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SwitchCategoryStoreViewActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SwitchCategoryStoreViewActionGroup.xml new file mode 100644 index 0000000000000..e75a63581fb3c --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SwitchCategoryStoreViewActionGroup.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SwitchCategoryStoreViewActionGroup"> + <annotations> + <description>Navigates to category page, selects a category and changes store view to specified store.</description> + </annotations> + <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> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SwitchCategoryToAllStoreViewActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SwitchCategoryToAllStoreViewActionGroup.xml new file mode 100644 index 0000000000000..28ca577bb98f5 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SwitchCategoryToAllStoreViewActionGroup.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SwitchCategoryToAllStoreViewActionGroup"> + <annotations> + <description>Navigates to category page, selects a category and changes store view to all stores.</description> + </annotations> + <arguments> + <argument name="CatName"/> + </arguments> + + <click selector="{{AdminCategorySidebarTreeSection.categoryInTree(CatName)}}" stepKey="navigateToCreatedCategory"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + <waitForLoadingMaskToDisappear stepKey="waitForSpinner1"/> + <scrollToTopOfPage stepKey="scrollToToggle"/> + <click selector="{{AdminCategoryMainActionsSection.CategoryStoreViewDropdownToggle}}" stepKey="openStoreViewDropDown"/> + <click selector="{{AdminCategoryMainActionsSection.allStoreViews}}" stepKey="clickStoreViewByName"/> + <see selector="{{AdminCategoryMainActionsSection.storeSwitcher}}" userInput="All Store Views" stepKey="seeAllStoreView"/> + <waitForPageLoad stepKey="waitForPageLoad2"/> + <waitForLoadingMaskToDisappear stepKey="waitForSpinner2"/> + <click selector="{{AdminCategoryMainActionsSection.CategoryStoreViewModalAccept}}" stepKey="selectStoreViewAccept"/> + <waitForPageLoad stepKey="waitForStoreViewChangeLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SwitchToTheNewStoreViewActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SwitchToTheNewStoreViewActionGroup.xml new file mode 100644 index 0000000000000..9dd1a2dc56d1e --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SwitchToTheNewStoreViewActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SwitchToTheNewStoreViewActionGroup"> + <annotations> + <description>Switches the New Store View.</description> + </annotations> + <arguments> + <argument name="storeViewName" type="string"/> + </arguments> + + <scrollTo selector="{{AdminProductContentSection.pageHeader}}" stepKey="scrollToUp"/> + <waitForElementVisible selector="{{AdminProductFormActionSection.changeStoreButton}}" stepKey="waitForElementBecomeVisible"/> + <click selector="{{AdminProductFormActionSection.changeStoreButton}}" stepKey="clickStoreviewSwitcher"/> + <click selector="{{AdminProductFormActionSection.selectStoreView(storeViewName)}}" stepKey="chooseStoreView"/> + <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="acceptStoreSwitchingMessage"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/TestDynamicValidationHintActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/TestDynamicValidationHintActionGroup.xml new file mode 100644 index 0000000000000..9e3f46e0400b2 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/TestDynamicValidationHintActionGroup.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="TestDynamicValidationHintActionGroup"> + <annotations> + <description>Validates that the Product Text Option Text Length Hint displays the correct Count for multiple inputs based on the provided Character Limit.</description> + </annotations> + <arguments> + <argument name="charLimit"/> + </arguments> + + <fillField userInput="abcde" selector="{{StorefrontProductPageSection.customTextOptionInput}}" stepKey="textInput1"/> + <see selector="{{StorefrontProductPageSection.charCounter}}" userInput="(15 remaining)" stepKey="assertHint1"/> + <fillField userInput="abcdefghjklansdmnbv" selector="{{StorefrontProductPageSection.customTextOptionInput}}" stepKey="textInput2"/> + <see selector="{{StorefrontProductPageSection.charCounter}}" userInput="(1 remaining)" stepKey="assertHint2"/> + <fillField userInput="abcdefghjklansdmnbvd" selector="{{StorefrontProductPageSection.customTextOptionInput}}" stepKey="textInput3"/> + <see selector="{{StorefrontProductPageSection.charCounter}}" userInput="(0 remaining)" stepKey="assertHint3"/> + <fillField userInput="abcdefghjklansdmnbvds" selector="{{StorefrontProductPageSection.customTextOptionInput}}" stepKey="textInput4"/> + <see selector="{{StorefrontProductPageSection.charCounter}}" userInput="(1 too many)" stepKey="assertHint4"/> + <fillField userInput="abcdefghjklansdmnbvdsasdfghjmn" selector="{{StorefrontProductPageSection.customTextOptionInput}}" stepKey="textInput5"/> + <see selector="{{StorefrontProductPageSection.charCounter}}" userInput="(10 too many)" stepKey="assertHint5"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ToggleProductEnabledActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ToggleProductEnabledActionGroup.xml new file mode 100644 index 0000000000000..220d254f70c97 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ToggleProductEnabledActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ToggleProductEnabledActionGroup"> + <annotations> + <description>Clicks on the Enable Product toggle.</description> + </annotations> + + <click selector="{{AdminProductFormSection.enableProductLabel}}" stepKey="toggleEnabled"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/UnassignAttributeFromGroupActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/UnassignAttributeFromGroupActionGroup.xml new file mode 100644 index 0000000000000..d58fa1e71061d --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/UnassignAttributeFromGroupActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="UnassignAttributeFromGroupActionGroup"> + <annotations> + <description>Unassign the provided Attribute from an Attribute Set from the Attribute Sets creation/edit page.</description> + </annotations> + <arguments> + <argument name="group" type="string"/> + <argument name="attribute" type="string"/> + </arguments> + + <conditionalClick selector="{{AdminProductAttributeSetEditSection.attributeGroupExtender(group)}}" dependentSelector="{{AdminProductAttributeSetEditSection.attributeGroupCollapsed(group)}}" visible="true" stepKey="extendGroup"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + <dragAndDrop selector1="{{AdminProductAttributeSetEditSection.assignedAttribute(attribute)}}" selector2="{{AdminProductAttributeSetEditSection.xThLineItemUnassignedAttribute('1')}}" stepKey="dragAndDropToUnassigned"/> + <waitForPageLoad stepKey="waitForPageLoad2"/> + <see userInput="{{attribute}}" selector="{{AdminProductAttributeSetEditSection.unassignedAttributesTree}}" stepKey="seeAttributeInUnassigned"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/UnassignWebsiteFromProductActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/UnassignWebsiteFromProductActionGroup.xml new file mode 100644 index 0000000000000..cee17cbc4b45e --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/UnassignWebsiteFromProductActionGroup.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="UnassignWebsiteFromProductActionGroup" extends="SelectProductInWebsitesActionGroup"> + <remove keyForRemoval="selectWebsite"/> + <uncheckOption selector="{{ProductInWebsitesSection.website(website)}}" stepKey="unSelectWebsite" after="waitForPageOpened"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/VerifyCategoryPageParametersActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/VerifyCategoryPageParametersActionGroup.xml new file mode 100644 index 0000000000000..dff3ca46640df --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/VerifyCategoryPageParametersActionGroup.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="VerifyCategoryPageParametersActionGroup"> + <annotations> + <description>Validate that the Category Page parameters are present and correct.</description> + </annotations> + <arguments> + <argument name="category"/> + <argument name="mode" type="string"/> + <argument name="numOfProductsPerPage" type="string"/> + <argument name="sortBy" type="string" defaultValue="position"/> + </arguments> + + <seeInCurrentUrl url="/{{category.custom_attributes[url_key]}}.html" stepKey="checkUrl"/> + <seeInTitle userInput="{{category.name}}" stepKey="assertCategoryNameInTitle"/> + <see userInput="{{category.name}}" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="assertCategoryName"/> + <see userInput="{{mode}}" selector="{{StorefrontCategoryMainSection.modeGridIsActive}}" stepKey="assertViewMode"/> + <see userInput="{{numOfProductsPerPage}}" selector="{{StorefrontCategoryMainSection.perPage}}" stepKey="assertNumberOfProductsPerPage"/> + <see userInput="{{sortBy}}" selector="{{StorefrontCategoryMainSection.sortedBy}}" stepKey="assertSortedBy"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ViewProductInAdminGridActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ViewProductInAdminGridActionGroup.xml new file mode 100644 index 0000000000000..9e9c7bc323eb3 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ViewProductInAdminGridActionGroup.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ViewProductInAdminGridActionGroup"> + <annotations> + <description>Filters the Admin Products grid by the provided Product (Name, SKU and Type).</description> + </annotations> + <arguments> + <argument name="product" defaultValue="_defaultProduct"/> + </arguments> + + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> + <waitForPageLoad stepKey="waitForPageLoadInitial"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> + <fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="{{product.name}}" stepKey="fillProductNameFilter"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillProductSkuFilter"/> + <selectOption selector="{{AdminProductGridFilterSection.typeFilter}}" userInput="{{product.type_id}}" stepKey="selectionProductType"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> + <see selector="{{AdminProductGridSection.productGridCell('1', 'Name')}}" userInput="{{product.name}}" stepKey="seeProductNameInGrid"/> + <see selector="{{AdminProductGridSection.productGridCell('1', 'Price')}}" userInput="{{product.price}}" stepKey="seeProductPriceInGrid"/> + <click selector="{{AdminProductGridFilterSection.clearFilters}}" stepKey="clickClearFiltersAfter"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AddToCartCrossSellTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AddToCartCrossSellTest.xml index 53bb12fda4833..7c0161d443df6 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AddToCartCrossSellTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AddToCartCrossSellTest.xml @@ -45,10 +45,10 @@ <amOnPage url="{{AdminProductEditPage.url($simpleProduct1.id$)}}" stepKey="goToProduct1"/> <click stepKey="openHeader1" selector="{{AdminProductFormRelatedUpSellCrossSellSection.sectionHeader}}"/> - <actionGroup ref="addCrossSellProductBySku" stepKey="addProduct2ToSimp1"> + <actionGroup ref="AddCrossSellProductBySkuActionGroup" stepKey="addProduct2ToSimp1"> <argument name="sku" value="$simpleProduct2.sku$"/> </actionGroup> - <actionGroup ref="addCrossSellProductBySku" stepKey="addProduct3ToSimp1"> + <actionGroup ref="AddCrossSellProductBySkuActionGroup" stepKey="addProduct3ToSimp1"> <argument name="sku" value="$simpleProduct3.sku$"/> </actionGroup> <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSave"/> @@ -58,17 +58,17 @@ <amOnPage url="{{AdminProductEditPage.url($simpleProduct3.id$)}}" stepKey="goToProduct3"/> <click stepKey="openHeader2" selector="{{AdminProductFormRelatedUpSellCrossSellSection.sectionHeader}}"/> - <actionGroup ref="addCrossSellProductBySku" stepKey="addProduct1ToSimp3"> + <actionGroup ref="AddCrossSellProductBySkuActionGroup" stepKey="addProduct1ToSimp3"> <argument name="sku" value="$simpleProduct1.sku$"/> </actionGroup> - <actionGroup ref="addCrossSellProductBySku" stepKey="addProduct2ToSimp3"> + <actionGroup ref="AddCrossSellProductBySkuActionGroup" stepKey="addProduct2ToSimp3"> <argument name="sku" value="$simpleProduct2.sku$"/> </actionGroup> <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSave2"/> <waitForPageLoad stepKey="waitForPageLoad2"/> <!-- Go to frontend, add simpleProduct1 to cart--> - <actionGroup ref="AddSimpleProductToCart" stepKey="addSimp1ToCart"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addSimp1ToCart"> <argument name="product" value="$simpleProduct1$"/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddDefaultImageSimpleProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddDefaultImageSimpleProductTest.xml index 117f094ee0607..ac1f967b66e41 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddDefaultImageSimpleProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddDefaultImageSimpleProductTest.xml @@ -28,32 +28,32 @@ <!--Create product--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPage"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGridColumnsInitial"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateSimpleProduct"> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGridColumnsInitial"/> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateSimpleProduct"> <argument name="product" value="SimpleProduct3"/> </actionGroup> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillSimpleProductMain"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillSimpleProductMain"> <argument name="product" value="SimpleProduct3"/> </actionGroup> <!-- Add image to product --> - <actionGroup ref="addProductImage" stepKey="addImageForProductSimple"> + <actionGroup ref="AddProductImageActionGroup" stepKey="addImageForProductSimple"> <argument name="image" value="MagentoLogo"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveSimpleProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveSimpleProduct"/> <!-- Assert product image in admin product form --> - <actionGroup ref="assertProductImageAdminProductPage" stepKey="assertProductImageAdminProductPage"> + <actionGroup ref="AssertProductImageAdminProductPageActionGroup" stepKey="assertProductImageAdminProductPage"> <argument name="image" value="MagentoLogo"/> </actionGroup> <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> + <actionGroup ref="AssertProductInStorefrontProductPageActionGroup" stepKey="AssertProductInStorefrontProductPage"> <argument name="product" value="SimpleProduct3"/> </actionGroup> <!-- Assert product image in storefront product page --> - <actionGroup ref="assertProductImageStorefrontProductPage" stepKey="assertProductImageStorefrontProductPage"> + <actionGroup ref="AssertProductImageStorefrontProductPageActionGroup" stepKey="assertProductImageStorefrontProductPage"> <argument name="product" value="SimpleProduct3"/> <argument name="image" value="MagentoLogo"/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddDefaultImageVirtualProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddDefaultImageVirtualProductTest.xml index 3f857c258924f..367827f8c0c28 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddDefaultImageVirtualProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddDefaultImageVirtualProductTest.xml @@ -28,30 +28,30 @@ <!--Create product--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPage"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGridColumnsInitial"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct"> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGridColumnsInitial"/> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct"> <argument name="product" value="defaultVirtualProduct"/> </actionGroup> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillProductMain"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillProductMain"> <argument name="product" value="defaultVirtualProduct"/> </actionGroup> <!-- Add image to product --> - <actionGroup ref="addProductImage" stepKey="addImageForProduct"> + <actionGroup ref="AddProductImageActionGroup" stepKey="addImageForProduct"> <argument name="image" value="MagentoLogo"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!-- Assert product image in admin product form --> - <actionGroup ref="assertProductImageAdminProductPage" stepKey="assertProductImageAdminProductPage"/> + <actionGroup ref="AssertProductImageAdminProductPageActionGroup" stepKey="assertProductImageAdminProductPage"/> <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> + <actionGroup ref="AssertProductInStorefrontProductPageActionGroup" stepKey="AssertProductInStorefrontProductPage"> <argument name="product" value="defaultVirtualProduct"/> </actionGroup> <!-- Assert product image in storefront product page --> - <actionGroup ref="assertProductImageStorefrontProductPage" stepKey="assertProductImageStorefrontProductPage"> + <actionGroup ref="AssertProductImageStorefrontProductPageActionGroup" stepKey="assertProductImageStorefrontProductPage"> <argument name="product" value="defaultVirtualProduct"/> <argument name="image" value="MagentoLogo"/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddDefaultVideoSimpleProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddDefaultVideoSimpleProductTest.xml index f657fbbdae607..0b33ef0ac0783 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddDefaultVideoSimpleProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddDefaultVideoSimpleProductTest.xml @@ -29,19 +29,19 @@ <!-- Create product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="adminProductIndexPageAdd"/> <waitForPageLoad stepKey="waitForProductIndexPageLoad"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGridColumnsInitial"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGridColumnsInitial"/> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProductPage"> <argument name="product" value="ApiSimpleProduct"/> </actionGroup> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillMainProductForm"> <argument name="product" value="ApiSimpleProduct"/> </actionGroup> <!-- Save product --> - <actionGroup ref="saveProductForm" stepKey="saveProductForm"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductForm"/> <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> + <actionGroup ref="AssertProductInStorefrontProductPageActionGroup" stepKey="AssertProductInStorefrontProductPage"> <argument name="product" value="ApiSimpleProduct"/> </actionGroup> </test> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddDefaultVideoVirtualProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddDefaultVideoVirtualProductTest.xml index eab36bc90dc18..e89cf6f4242e7 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddDefaultVideoVirtualProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddDefaultVideoVirtualProductTest.xml @@ -21,13 +21,13 @@ <!-- Replacing steps in base AdminAddDefaultVideoSimpleProductTest --> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProductPage"> <argument name="product" value="defaultVirtualProduct"/> </actionGroup> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillMainProductForm"> <argument name="product" value="defaultVirtualProduct"/> </actionGroup> - <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> + <actionGroup ref="AssertProductInStorefrontProductPageActionGroup" stepKey="AssertProductInStorefrontProductPage"> <argument name="product" value="defaultVirtualProduct"/> </actionGroup> </test> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageForCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageForCategoryTest.xml index 8ac0cfa512b03..ed9eb686d2c86 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageForCategoryTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageForCategoryTest.xml @@ -22,27 +22,27 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="DeleteCategory" stepKey="DeleteCategory"> + <actionGroup ref="DeleteCategoryActionGroup" stepKey="DeleteCategory"> <argument name="categoryEntity" value="SimpleSubCategory"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> </after> <!-- Go to create a new category with image --> - <actionGroup ref="goToCreateCategoryPage" stepKey="goToCreateCategoryPage"/> - <actionGroup ref="fillCategoryForm" stepKey="fillCategoryForm"> + <actionGroup ref="GoToCreateCategoryPageActionGroup" stepKey="goToCreateCategoryPage"/> + <actionGroup ref="FillCategoryFormActionGroup" stepKey="fillCategoryForm"> <argument name="categoryEntity" value="SimpleSubCategory"/> </actionGroup> - <actionGroup ref="addCategoryImage" stepKey="addCategoryImage"/> - <actionGroup ref="saveCategoryForm" stepKey="saveCategoryForm"/> + <actionGroup ref="AddCategoryImageActionGroup" stepKey="addCategoryImage"/> + <actionGroup ref="SaveCategoryFormActionGroup" stepKey="saveCategoryForm"/> <!-- Verify category with image in admin --> - <actionGroup ref="checkCategoryImageInAdmin" stepKey="checkCategoryImageInAdmin"/> + <actionGroup ref="CheckCategoryImageInAdminActionGroup" stepKey="checkCategoryImageInAdmin"/> <!-- Verify category with image in storefront --> - <actionGroup ref="CheckCategoryOnStorefront" stepKey="CheckCategoryOnStorefront"> + <actionGroup ref="CheckCategoryOnStorefrontActionGroup" stepKey="CheckCategoryOnStorefront"> <argument name="categoryEntity" value="SimpleSubCategory"/> </actionGroup> <seeElement selector="{{StorefrontCategoryMainSection.imageSource(ProductImage.filename)}}" stepKey="seeImage"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGCatalogTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGCatalogTest.xml index c36c29ce594d0..4bb41ff906f61 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGCatalogTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGCatalogTest.xml @@ -51,7 +51,7 @@ <seeElement selector="{{StorefrontCategoryMainSection.mediaDescription(ImageUpload3.content)}}" stepKey="assertMediaDescription"/> <seeElementInDOM selector="{{StorefrontCategoryMainSection.imageSource(ImageUpload3.fileName)}}" stepKey="assertMediaSource"/> <after> - <actionGroup ref="DeleteCategory" stepKey="DeleteCategory"> + <actionGroup ref="DeleteCategoryActionGroup" stepKey="DeleteCategory"> <argument name="categoryEntity" value="SimpleSubCategory"/> </actionGroup> <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml index 4044490c92334..e1772a975f714 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml @@ -29,7 +29,7 @@ <amOnPage url="{{AdminProductCreatePage.url(AddToDefaultSet.attributeSetId, 'simple')}}" stepKey="navigateToNewProduct"/> <waitForPageLoad stepKey="waitForPageLoadProductCreatePage"/> - <actionGroup ref="fillMainProductForm" stepKey="fillBasicProductInfo" /> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillBasicProductInfo" /> <click selector="{{AdminProductFormSection.contentTab}}" stepKey="clickContentTab" /> <waitForElementVisible selector="{{ProductDescriptionWYSIWYGToolbarSection.TinyMCE4}}" stepKey="waitForDescription" /> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddInStockProductToTheCartTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddInStockProductToTheCartTest.xml index 51ef7fb77d74c..b98ca3a375a17 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddInStockProductToTheCartTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddInStockProductToTheCartTest.xml @@ -36,7 +36,7 @@ <!--Open Product Index Page and filter the product--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProduct"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProduct"> <argument name="product" value="SimpleProduct"/> </actionGroup> <!-- Update product Advanced Inventory setting --> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminApplyTierPriceToProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminApplyTierPriceToProductTest.xml index 545e7c10379bf..87acf14172ef6 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminApplyTierPriceToProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminApplyTierPriceToProductTest.xml @@ -32,7 +32,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex1"/> <waitForPageLoad time="30" stepKey="waitForProductIndexPageLoad"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetGridToDefaultKeywordSearch"/> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetGridToDefaultKeywordSearch"/> <actionGroup ref="logout" stepKey="logoutFromAdmin"/> </after> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> @@ -51,7 +51,7 @@ <selectOption selector="{{AdminProductFormAdvancedPricingSection.productTierPriceValueTypeSelect('0')}}" userInput="Discount" stepKey="selectProductTierPriceValueType1"/> <fillField selector="{{AdminProductFormAdvancedPricingSection.productTierPricePercentageValuePriceInput('0')}}" userInput="10" stepKey="selectProductTierPricePriceInput"/> <click selector="{{AdminProductFormAdvancedPricingSection.doneButton}}" stepKey="clickDoneButton1"/> - <actionGroup ref="saveProductForm" stepKey="saveProduct1"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct1"/> <actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerLogin1"> <argument name="Customer" value="$$createSimpleUSCustomer$$" /> </actionGroup> @@ -79,7 +79,7 @@ <waitForElement selector="{{AdminProductFormAdvancedPricingSection.productTierPriceCustGroupSelect('0')}}" time="30" stepKey="waitForSelectCustomerGroupNameAttribute1"/> <selectOption selector="{{AdminProductFormAdvancedPricingSection.productTierPriceCustGroupSelect('0')}}" userInput="General" stepKey="selectCustomerGroupGeneral"/> <click selector="{{AdminProductFormAdvancedPricingSection.doneButton}}" stepKey="clickDoneButton2"/> - <actionGroup ref="saveProductForm" stepKey="saveProduct2"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct2"/> <amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="navigateToCategoryPage3"/> <waitForPageLoad time="30" stepKey="waitForPageLoad4"/> <seeElement selector="{{StorefrontCategoryProductSection.productPriceFinal('100')}}" stepKey="assertProductFinalPriceIs100_1"/> @@ -110,7 +110,7 @@ <selectOption selector="{{AdminProductFormAdvancedPricingSection.productTierPriceValueTypeSelect('1')}}" userInput="Discount" stepKey="selectProductTierPriceValueType2"/> <fillField selector="{{AdminProductFormAdvancedPricingSection.productTierPricePercentageValuePriceInput('1')}}" userInput="18" stepKey="selectProductTierPricePriceInput18"/> <click selector="{{AdminProductFormAdvancedPricingSection.doneButton}}" stepKey="clickDoneButton3"/> - <actionGroup ref="saveProductForm" stepKey="saveProduct3"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct3"/> <amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="navigateToCategoryPage5"/> <waitForPageLoad time="30" stepKey="waitForPageLoad6"/> <seeElement selector="{{StorefrontCategoryProductSection.productPriceFinal('100')}}" stepKey="assertProductFinalPriceIs100_2"/> @@ -132,7 +132,7 @@ <seeElement selector="{{StorefrontProductInfoMainSection.productTierPriceSavePercentageAmount('1', '10')}}" stepKey="assertProductTierPriceSavePercentageAmountForFirstRow1"/> <seeElement selector="{{StorefrontProductInfoMainSection.productTierPriceSavePercentageAmount('2', '18')}}" stepKey="assertProductTierPriceSavePercentageAmountForSecondRow1"/> <fillField userInput="10" selector="{{StorefrontProductInfoMainSection.qty}}" stepKey="fillProductQuantity1"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage"> <argument name="productName" value="$$createSimpleProduct.name$$"/> </actionGroup> <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToCheckoutFromMinicart"/> @@ -169,7 +169,7 @@ <waitForElement selector="{{AdminProductFormAdvancedPricingSection.customerGroupPriceAddButton}}" stepKey="waitForcustomerGroupPriceAddButton4"/> <fillField selector="{{AdminProductFormAdvancedPricingSection.productTierPricePercentageValuePriceInput('1')}}" userInput="25" stepKey="selectProductTierPricePercentageValue2"/> <click selector="{{AdminProductFormAdvancedPricingSection.doneButton}}" stepKey="clickDoneButton4"/> - <actionGroup ref="saveProductForm" stepKey="saveProduct4"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct4"/> <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToShoppingCartPage1"/> <waitForPageLoad time="30" stepKey="waitForShoppingCartPagePageLoad1"/> <seeInField userInput="20" selector="{{CheckoutCartProductSection.ProductQuantityByName($$createSimpleProduct.name$$)}}" stepKey="seeInQtyField20"/> @@ -239,7 +239,7 @@ <click selector="(//tr//button[@data-action='remove_row'])[1]" userInput=".product_form_product_form_advanced_pricing_modal" stepKey="deleteFirstRowOfCustomerGroupPrice"/> <click selector="//tr//button[@data-action='remove_row']" userInput=".product_form_product_form_advanced_pricing_modal" stepKey="deleteSecondRowOfCustomerGroupPrice"/> <click selector="{{AdminProductFormAdvancedPricingSection.doneButton}}" userInput=".product_form_product_form_advanced_pricing_modal" stepKey="clickDoneButton5"/> - <actionGroup ref="saveProductForm" stepKey="saveProduct5"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct5"/> <scrollToTopOfPage stepKey="scrollToTopOfPage6"/> <click selector="{{AdminProductFormSection.advancedPricingLink}}" stepKey="clickOnAdvancedPricingButton6"/> <waitForElement selector="{{AdminProductFormAdvancedPricingSection.customerGroupPriceAddButton}}" stepKey="waitForcustomerGroupPriceAddButton5"/> @@ -291,7 +291,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad time="30" stepKey="waitForProductIndexPageLoad"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetGridToDefaultKeywordSearch"/> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetGridToDefaultKeywordSearch"/> <actionGroup ref="logout" stepKey="logoutFromAdmin"/> </after> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> @@ -309,7 +309,7 @@ <selectOption selector="{{AdminProductFormAdvancedPricingSection.productTierPriceValueTypeSelect('0')}}" userInput="Discount" stepKey="selectProductTierPriceValueType"/> <fillField selector="{{AdminProductFormAdvancedPricingSection.productTierPricePercentageValuePriceInput('0')}}" userInput="0.1" stepKey="selectProductTierPricePriceInput"/> <click selector="{{AdminProductFormAdvancedPricingSection.doneButton}}" stepKey="clickDoneButton"/> - <actionGroup ref="saveProductForm" stepKey="saveProduct1"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct1"/> <amOnPage url="{{StorefrontProductPage.url($$createSimpleProduct.sku$$)}}" stepKey="goProductPageOnStorefront"/> <waitForPageLoad time="30" stepKey="waitForPageLoad1"/> <seeElement selector="{{StorefrontCategoryProductSection.productPriceFinal('99.90')}}" stepKey="assertProductFinalPriceProductPage"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAssignProductAttributeToAttributeSetTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAssignProductAttributeToAttributeSetTest.xml index 4261721d36064..41b358bbf760e 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAssignProductAttributeToAttributeSetTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAssignProductAttributeToAttributeSetTest.xml @@ -40,14 +40,14 @@ <!-- Assert created attribute in unassigned section --> <see userInput="$$attribute.attribute_code$$" selector="{{AdminProductAttributeSetEditSection.unassignedAttributesTree}}" stepKey="seeAttributeInUnassigned"/> <!-- Assign attribute to a group --> - <actionGroup ref="AssignAttributeToGroup" stepKey="assignAttributeToGroup"> + <actionGroup ref="AssignAttributeToGroupActionGroup" stepKey="assignAttributeToGroup"> <argument name="group" value="Product Details"/> <argument name="attribute" value="$$attribute.attribute_code$$"/> </actionGroup> <!-- Assert attribute in a group --> <see userInput="$$attribute.attribute_code$$" selector="{{AdminProductAttributeSetEditSection.groupTree}}" stepKey="seeAttributeInGroup"/> <!-- Save attribute set --> - <actionGroup ref="SaveAttributeSet" stepKey="SaveAttributeSet"/> + <actionGroup ref="SaveAttributeSetActionGroup" stepKey="SaveAttributeSet"/> <!-- Go to create new product page --> <amOnPage url="{{AdminProductCreatePage.url(AddToDefaultSet.attributeSetId, 'simple')}}" stepKey="navigateToNewProduct"/> <waitForPageLoad stepKey="waitForPageLoad"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminBackorderAllowedAddProductToCartTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminBackorderAllowedAddProductToCartTest.xml index 88c524eff387c..9361637a0a935 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminBackorderAllowedAddProductToCartTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminBackorderAllowedAddProductToCartTest.xml @@ -35,7 +35,7 @@ </after> <!-- Go to the storefront and add the product to the cart --> - <actionGroup ref="AddSimpleProductToCart" stepKey="gotoAndAddProductToCart"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="gotoAndAddProductToCart"> <argument name="product" value="$$createProduct$$"/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminChangeProductAttributeSet.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminChangeProductAttributeSet.xml index bcfab6ccfdf1f..95620bf75b6d0 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminChangeProductAttributeSet.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminChangeProductAttributeSet.xml @@ -35,11 +35,11 @@ <actionGroup ref="LoginAsAdmin" stepKey="login"/> <amOnPage url="{{AdminProductAttributeSetEditPage.url}}/$$createAttributeSet.attribute_set_id$$/" stepKey="onAttributeSetEdit"/> - <actionGroup ref="AssignAttributeToGroup" stepKey="assignAttributeToGroup"> + <actionGroup ref="AssignAttributeToGroupActionGroup" stepKey="assignAttributeToGroup"> <argument name="group" value="Product Details"/> <argument name="attribute" value="$$createProductAttribute.attribute_code$$"/> </actionGroup> - <actionGroup ref="SaveAttributeSet" stepKey="SaveAttributeSet"/> + <actionGroup ref="SaveAttributeSetActionGroup" stepKey="SaveAttributeSet"/> </before> <after> <deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckConfigurableProductPriceWithDisabledChildProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckConfigurableProductPriceWithDisabledChildProductTest.xml index 86978a4121a43..b4381a674827d 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckConfigurableProductPriceWithDisabledChildProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckConfigurableProductPriceWithDisabledChildProductTest.xml @@ -145,7 +145,7 @@ <!-- Open Product Index Page and Filter First Child product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProduct"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProduct"> <argument name="product" value="ApiSimpleOne"/> </actionGroup> <click selector="{{AdminProductGridFilterSection.nthRow('1')}}" stepKey="selectFirstRow"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsNotVisibleInCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsNotVisibleInCategoryTest.xml index ee8b48a94b20d..cd03d868838f3 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsNotVisibleInCategoryTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsNotVisibleInCategoryTest.xml @@ -36,7 +36,7 @@ <!--Open Product Index Page and filter the product--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProduct"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProduct"> <argument name="product" value="SimpleProduct"/> </actionGroup> <!-- Update product Advanced Inventory Setting --> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsVisibleInCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsVisibleInCategoryTest.xml index a863de2716c97..bfea4fa7557f5 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsVisibleInCategoryTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsVisibleInCategoryTest.xml @@ -39,7 +39,7 @@ <!--Open Product Index Page and filter the product--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProduct"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProduct"> <argument name="product" value="SimpleProduct"/> </actionGroup> <!-- Update product Advanced Inventory Setting --> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCloneProductWithDuplicateUrlTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCloneProductWithDuplicateUrlTest.xml index 99adaeb522786..ee9e364758899 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCloneProductWithDuplicateUrlTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCloneProductWithDuplicateUrlTest.xml @@ -28,10 +28,10 @@ <after> <!--Delete created data--> <comment userInput="Delete created data" stepKey="commentDeleteCreatedData"/> - <actionGroup ref="deleteAllDuplicateProductUsingProductGrid" stepKey="deleteAllDuplicateProducts"> + <actionGroup ref="DeleteAllDuplicateProductUsingProductGridActionGroup" stepKey="deleteAllDuplicateProducts"> <argument name="product" value="$$createSimpleProduct$$"/> </actionGroup> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetFiltersIfExist"/> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetFiltersIfExist"/> <actionGroup ref="logout" stepKey="logoutOfAdmin"/> </after> <amOnPage url="{{AdminProductEditPage.url($$createSimpleProduct.id$$)}}" stepKey="goToProductEditPage"/> @@ -47,16 +47,16 @@ <comment userInput="Add duplicated product to the simple product" stepKey="commentAddProduct"/> <amOnPage url="{{AdminProductEditPage.url($$createSimpleProduct.id$$)}}" stepKey="goToSimpleProductPage"/> <waitForPageLoad stepKey="waitForSimpleProductPageLoad1"/> - <actionGroup ref="addCrossSellProductBySku" stepKey="addCrossSellProduct"> + <actionGroup ref="AddCrossSellProductBySkuActionGroup" stepKey="addCrossSellProduct"> <argument name="sku" value="$$createSimpleProduct.sku$$"/> </actionGroup> - <actionGroup ref="addRelatedProductBySku" stepKey="addRelatedProduct"> + <actionGroup ref="AddRelatedProductBySkuActionGroup" stepKey="addRelatedProduct"> <argument name="sku" value="$$createSimpleProduct.sku$$"/> </actionGroup> - <actionGroup ref="addUpSellProductBySku" stepKey="addUpSellProduct"> + <actionGroup ref="AddUpSellProductBySkuActionGroup" stepKey="addUpSellProduct"> <argument name="sku" value="$$createSimpleProduct.sku$$"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="clickSaveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="clickSaveProduct"/> <conditionalClick selector="{{AdminProductFormRelatedUpSellCrossSellSection.sectionHeader}}" dependentSelector="{{AdminProductFormRelatedUpSellCrossSellSection.AddRelatedProductsButton}}" visible="false" stepKey="openProductRUSSection"/> <see selector="{{AdminProductFormRelatedUpSellCrossSellSection.selectedProductSku('related')}}" userInput="$$createSimpleProduct.sku$$-1" stepKey="seeRelatedProduct"/> <see selector="{{AdminProductFormRelatedUpSellCrossSellSection.selectedProductSku('upsell')}}" userInput="$$createSimpleProduct.sku$$-1" stepKey="seeUpSellProduct"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndEditSimpleProductSettingsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndEditSimpleProductSettingsTest.xml index 8ffab42653b49..80c20a7e0b5d9 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndEditSimpleProductSettingsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndEditSimpleProductSettingsTest.xml @@ -38,16 +38,16 @@ </after> <!-- Create new simple product --> - <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="createSimpleProduct"/> + <actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="createSimpleProduct"/> <!-- Fill all main fields --> - <actionGroup ref="fillMainProductForm" stepKey="fillAllNecessaryFields"/> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillAllNecessaryFields"/> <!-- Add two related products --> - <actionGroup ref="addRelatedProductBySku" stepKey="addFirstRelatedProduct"> + <actionGroup ref="AddRelatedProductBySkuActionGroup" stepKey="addFirstRelatedProduct"> <argument name="sku" value="$$createFirstRelatedProduct.sku$$"/> </actionGroup> - <actionGroup ref="addRelatedProductBySku" stepKey="addSecondRelatedProduct"> + <actionGroup ref="AddRelatedProductBySkuActionGroup" stepKey="addSecondRelatedProduct"> <argument name="sku" value="$$createSecondRelatedProduct.sku$$"/> </actionGroup> @@ -60,7 +60,7 @@ </actionGroup> <!-- Save product form --> - <actionGroup ref="saveProductForm" stepKey="clickSaveButton"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="clickSaveButton"/> <!-- Open product page --> <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openStorefrontProductPage"> @@ -96,7 +96,7 @@ </actionGroup> <!-- Edit related products --> - <actionGroup ref="addRelatedProductBySku" stepKey="addThirdRelatedProduct"> + <actionGroup ref="AddRelatedProductBySkuActionGroup" stepKey="addThirdRelatedProduct"> <argument name="sku" value="$$createThirdRelatedProduct.sku$$"/> </actionGroup> <click selector="{{AdminProductFormRelatedUpSellCrossSellSection.removeRelatedProduct($$createFirstRelatedProduct.sku$$)}}" stepKey="removeFirstRelatedProduct"/> @@ -110,7 +110,7 @@ <actionGroup ref="AdminSwitchProductGiftMessageStatusActionGroup" stepKey="disableGiftMessageSettings"/> <!-- Save product form --> - <actionGroup ref="saveProductForm" stepKey="clickSaveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="clickSaveProduct"/> <!-- Verify Url Key after changing --> <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPage"> @@ -129,7 +129,7 @@ <dontSeeElement selector="{{StorefrontProductCartGiftOptionSection.giftOptions}}" stepKey="dontSeeGiftOptionBtn"/> <!-- Delete created simple product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="_defaultProduct"/> </actionGroup> </test> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndEditVirtualProductSettingsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndEditVirtualProductSettingsTest.xml index 90cbab59bd71d..5e7cb461e9667 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndEditVirtualProductSettingsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndEditVirtualProductSettingsTest.xml @@ -33,7 +33,7 @@ </before> <after> <!-- Delete created virtual product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="defaultVirtualProduct"/> </actionGroup> @@ -54,12 +54,12 @@ <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> <!-- Create new virtual product --> - <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="createVirtualProduct"> + <actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="createVirtualProduct"> <argument name="productType" value="virtual"/> </actionGroup> <!-- Fill all main fields --> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillMainProductForm"> <argument name="product" value="defaultVirtualProduct"/> </actionGroup> @@ -70,10 +70,10 @@ <fillField selector="{{AdminProductContentSection.shortDescriptionTextArea}}" userInput="{{ApiProductShortDescription.value}}" stepKey="fillShortDescription"/> <!-- Add two related products --> - <actionGroup ref="addRelatedProductBySku" stepKey="addFirstRelatedProduct"> + <actionGroup ref="AddRelatedProductBySkuActionGroup" stepKey="addFirstRelatedProduct"> <argument name="sku" value="$$createFirstRelatedProduct.sku$$"/> </actionGroup> - <actionGroup ref="addRelatedProductBySku" stepKey="addSecondRelatedProduct"> + <actionGroup ref="AddRelatedProductBySkuActionGroup" stepKey="addSecondRelatedProduct"> <argument name="sku" value="$$createSecondRelatedProduct.sku$$"/> </actionGroup> @@ -93,7 +93,7 @@ </actionGroup> <!-- Save product form--> - <actionGroup ref="saveProductForm" stepKey="clickSaveButton"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="clickSaveButton"/> <!-- Open product page --> <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openStorefrontProductPage"> @@ -139,12 +139,12 @@ </actionGroup> <!-- Edit related products --> - <actionGroup ref="addRelatedProductBySku" stepKey="addThirdRelatedProduct"> + <actionGroup ref="AddRelatedProductBySkuActionGroup" stepKey="addThirdRelatedProduct"> <argument name="sku" value="$$createThirdRelatedProduct.sku$$"/> </actionGroup> <!-- Assert product in assigned to websites --> - <actionGroup ref="AssertProductIsAssignedToWebsite" stepKey="seeCustomWebsiteIsChecked"> + <actionGroup ref="AssertProductIsAssignedToWebsiteActionGroup" stepKey="seeCustomWebsiteIsChecked"> <argument name="website" value="$createWebsite.website[name]$"/> </actionGroup> @@ -162,7 +162,7 @@ <actionGroup ref="AdminSwitchProductGiftMessageStatusActionGroup" stepKey="disableGiftMessageSettings"/> <!-- Save product form --> - <actionGroup ref="saveProductForm" stepKey="clickSaveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="clickSaveProduct"/> <!-- Verify Url Key after changing --> <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPage"> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml index 4deca73504677..12082e1daa6c3 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml @@ -23,11 +23,11 @@ <createData entity="_defaultCategory" stepKey="createPreReqCategory"/> </before> <after> - <actionGroup ref="GoToProductCatalogPage" stepKey="goToProductCatalogPage"/> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteSimpleProduct"> + <actionGroup ref="GoToProductCatalogPageActionGroup" stepKey="goToProductCatalogPage"/> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteSimpleProduct"> <argument name="product" value="_defaultProduct"/> </actionGroup> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetSearch"/> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetSearch"/> <amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/> <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/> </after> @@ -35,28 +35,28 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/> <!-- Open Dropdown and select simple product option --> <comment stepKey="beforeOpenProductFillForm" userInput="Selecting Product from the Add Product Dropdown"/> - <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="openProductFillForm"> + <actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="openProductFillForm"> <argument name="productType" value="simple"/> </actionGroup> <!-- Fill form for Virtual Product Type --> <comment stepKey="beforeFillProductForm" userInput="Filling Product Form"/> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillProductForm"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillProductForm"> <argument name="product" value="_defaultProduct"/> </actionGroup> - <actionGroup ref="SetProductUrlKey" stepKey="setProductUrl"> + <actionGroup ref="SetProductUrlKeyActionGroup" stepKey="setProductUrl"> <argument name="product" value="_defaultProduct"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProductForm"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductForm"/> <!-- Check that product was added with implicit type change --> <comment stepKey="beforeVerify" userInput="Verify Product Type Assigned Correctly"/> - <actionGroup ref="GoToProductCatalogPage" stepKey="goToProductCatalogPage"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetSearch"/> - <actionGroup ref="filterProductGridByName" stepKey="searchForProduct"> + <actionGroup ref="GoToProductCatalogPageActionGroup" stepKey="goToProductCatalogPage"/> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetSearch"/> + <actionGroup ref="FilterProductGridByNameActionGroup" stepKey="searchForProduct"> <argument name="product" value="_defaultProduct"/> </actionGroup> <see selector="{{AdminProductGridSection.productGridCell('1', 'Type')}}" userInput="Virtual Product" stepKey="seeProductTypeInGrid"/> - <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> + <actionGroup ref="AssertProductInStorefrontProductPageActionGroup" stepKey="AssertProductInStorefrontProductPage"> <argument name="product" value="_defaultProduct"/> </actionGroup> </test> @@ -71,11 +71,11 @@ <group value="catalog"/> <group value="mtf_migrated"/> </annotations> - <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="openProductFillForm"> + <actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="openProductFillForm"> <argument name="productType" value="virtual"/> </actionGroup> <!-- Fill form for Virtual Product Type --> - <actionGroup ref="fillMainProductForm" stepKey="fillProductForm"> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillProductForm"> <argument name="product" value="_defaultProduct"/> </actionGroup> <see selector="{{AdminProductGridSection.productGridCell('1', 'Type')}}" userInput="Simple Product" stepKey="seeProductTypeInGrid"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAttributeSetEntityTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAttributeSetEntityTest.xml index d9e410a9a3009..51518dffaf87e 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAttributeSetEntityTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAttributeSetEntityTest.xml @@ -30,7 +30,7 @@ <amOnPage url="{{AdminProductAttributeSetGridPage.url}}" stepKey="goToAttributeSets"/> <waitForPageLoad stepKey="waitForPageLoad"/> - <actionGroup ref="goToAttributeSetByName" stepKey="filterProductAttributeSetGridByLabel"> + <actionGroup ref="GoToAttributeSetByNameActionGroup" stepKey="filterProductAttributeSetGridByLabel"> <argument name="name" value="$$createAttributeSet.attribute_set_name$$"/> </actionGroup> @@ -38,17 +38,17 @@ <see userInput="$$createProductAttribute.attribute_code$$" selector="{{AdminProductAttributeSetEditSection.unassignedAttributesTree}}" stepKey="seeAttributeInUnassignedAttr"/> <!-- Assign attribute in the group --> - <actionGroup ref="AssignAttributeToGroup" stepKey="assignAttributeToGroup"> + <actionGroup ref="AssignAttributeToGroupActionGroup" stepKey="assignAttributeToGroup"> <argument name="group" value="Product Details"/> <argument name="attribute" value="$$createProductAttribute.attribute_code$$"/> </actionGroup> <see userInput="$$createProductAttribute.attribute_code$$" selector="{{AdminProductAttributeSetEditSection.groupTree}}" stepKey="seeAttributeInGroup"/> - <actionGroup ref="SaveAttributeSet" stepKey="SaveAttributeSet"/> + <actionGroup ref="SaveAttributeSetActionGroup" stepKey="SaveAttributeSet"/> <amOnPage url="{{AdminProductAttributeSetGridPage.url}}" stepKey="goToAttributeSets2"/> <waitForPageLoad stepKey="waitForPageLoad2"/> <!-- Assert an attribute in the group--> - <actionGroup ref="goToAttributeSetByName" stepKey="filterProductAttributeSetGridByLabel2"> + <actionGroup ref="GoToAttributeSetByNameActionGroup" stepKey="filterProductAttributeSetGridByLabel2"> <argument name="name" value="$$createAttributeSet.attribute_set_name$$"/> </actionGroup> <see userInput="$$createProductAttribute.attribute_code$$" selector="{{AdminProductAttributeSetEditSection.groupTree}}" stepKey="seeAttributeInGroup2"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryFromProductPageTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryFromProductPageTest.xml index a5150a0fb7f24..ef21b53c7613b 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryFromProductPageTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryFromProductPageTest.xml @@ -26,7 +26,7 @@ <after> <!-- Delete the created category --> - <actionGroup ref="DeleteMostRecentCategory" stepKey="getRidOfCreatedCategory"/> + <actionGroup ref="DeleteMostRecentCategoryActionGroup" stepKey="getRidOfCreatedCategory"/> <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> <deleteData createDataKey="simpleProduct" stepKey="deleteProduct"/> </after> @@ -35,7 +35,7 @@ <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"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="findCreatedProduct"> <argument name="product" value="SimpleTwo"/> </actionGroup> <waitForPageLoad stepKey="waitForFiltersToBeApplied"/> @@ -43,12 +43,12 @@ <waitForPageLoad stepKey="waitForProductPageLoad"/> <!-- Fill out the form for the new category --> - <actionGroup ref="FillNewProductCategory" stepKey="FillNewProductCategory"> + <actionGroup ref="FillNewProductCategoryActionGroup" stepKey="FillNewProductCategory"> <argument name="categoryName" value="{{_defaultCategory.name}}"/> </actionGroup> <!-- Check that category was created --> - <actionGroup ref="CategoryPresent" stepKey="checkIfCategoryPresent"> + <actionGroup ref="CategoryPresentActionGroup" stepKey="checkIfCategoryPresent"> <argument name="categoryName" value="{{_defaultCategory.name}}"/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithAnchorFieldTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithAnchorFieldTest.xml index a6890c2ad4905..7de1d38f097c5 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithAnchorFieldTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithAnchorFieldTest.xml @@ -23,7 +23,7 @@ <createData entity="defaultSimpleProduct" stepKey="simpleProduct" /> </before> <after> - <actionGroup ref="DeleteCategory" stepKey="deleteCategory"/> + <actionGroup ref="DeleteCategoryActionGroup" stepKey="deleteCategory"/> <actionGroup ref="logout" stepKey="logout"/> <deleteData createDataKey="createDefaultCMSBlock" stepKey="deleteDefaultCMSBlock"/> <deleteData stepKey="deleteSimpleProduct" createDataKey="simpleProduct"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithCustomRootCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithCustomRootCategoryTest.xml index e8c6da476a3d6..a68a585bbf31d 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithCustomRootCategoryTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithCustomRootCategoryTest.xml @@ -26,7 +26,7 @@ <actionGroup ref="DeleteCustomStoreActionGroup" stepKey="deleteCustomStore"> <argument name="storeGroupName" value="customStore.name"/> </actionGroup> - <actionGroup ref="DeleteCategory" stepKey="deleteCreatedNewRootCategory"> + <actionGroup ref="DeleteCategoryActionGroup" stepKey="deleteCreatedNewRootCategory"> <argument name="categoryEntity" value="NewRootCategory"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> @@ -41,7 +41,7 @@ <scrollToTopOfPage stepKey="scrollToTopOfPage"/> <click selector="{{AdminCategorySidebarTreeSection.categoryInTree(NewRootCategory.name)}}" stepKey="clickOnCreatedNewRootCategory"/> <scrollToTopOfPage stepKey="scrollToTopOfPage1"/> - <actionGroup ref="CreateCategory" stepKey="createSubcategory"> + <actionGroup ref="CreateCategoryActionGroup" stepKey="createSubcategory"> <argument name="categoryEntity" value="SimpleSubCategory"/> </actionGroup> <!--Create a Store--> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithInactiveCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithInactiveCategoryTest.xml index 96f945da138b0..fae1a1fa8c2e4 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithInactiveCategoryTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithInactiveCategoryTest.xml @@ -21,7 +21,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> </before> <after> - <actionGroup ref="DeleteCategory" stepKey="deleteCategory"/> + <actionGroup ref="DeleteCategoryActionGroup" stepKey="deleteCategory"/> <actionGroup ref="logout" stepKey="logout"/> </after> <!-- Create In active Category --> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithInactiveIncludeInMenuTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithInactiveIncludeInMenuTest.xml index c983089163f78..a695aa33079bd 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithInactiveIncludeInMenuTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithInactiveIncludeInMenuTest.xml @@ -21,7 +21,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> </before> <after> - <actionGroup ref="DeleteCategory" stepKey="deleteCategory"/> + <actionGroup ref="DeleteCategoryActionGroup" stepKey="deleteCategory"/> <actionGroup ref="logout" stepKey="logout"/> </after> <!--Create Category with not included in menu Subcategory --> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithProductsGridFilter.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithProductsGridFilter.xml index 79eec02a828f6..6a49b47b75078 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithProductsGridFilter.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithProductsGridFilter.xml @@ -21,14 +21,14 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> </before> <after> - <actionGroup ref="DeleteCategory" stepKey="deleteCategory"/> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct1"> + <actionGroup ref="DeleteCategoryActionGroup" stepKey="deleteCategory"/> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct1"> <argument name="product" value="defaultSimpleProduct"/> </actionGroup> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct2"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct2"> <argument name="product" value="SimpleProduct"/> </actionGroup> - <actionGroup ref="NavigateToAndResetProductGridToDefaultView" stepKey="NavigateToAndResetProductGridToDefaultView"/> + <actionGroup ref="NavigateToAndResetProductGridToDefaultViewActionGroup" stepKey="NavigateToAndResetProductGridToDefaultView"/> <actionGroup ref="logout" stepKey="logout"/> </after> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductList"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithRequiredFieldsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithRequiredFieldsTest.xml index 1b6c9707b0656..dac2a121d107f 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithRequiredFieldsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithRequiredFieldsTest.xml @@ -21,7 +21,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> </before> <after> - <actionGroup ref="DeleteCategory" stepKey="deleteCategory"/> + <actionGroup ref="DeleteCategoryActionGroup" stepKey="deleteCategory"/> <actionGroup ref="logout" stepKey="logout"/> </after> <!-- Create subcategory with required fields --> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCustomProductAttributeWithDropdownFieldTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCustomProductAttributeWithDropdownFieldTest.xml index a3f543e9cf32a..2d1a58764e20a 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCustomProductAttributeWithDropdownFieldTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCustomProductAttributeWithDropdownFieldTest.xml @@ -38,7 +38,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> - <actionGroup ref="deleteProductAttribute" stepKey="deleteCreatedAttribute"> + <actionGroup ref="DeleteProductAttributeActionGroup" stepKey="deleteCreatedAttribute"> <argument name="ProductAttribute" value="newProductAttribute"/> </actionGroup> @@ -50,7 +50,7 @@ <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> <!-- Select Created Product--> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProductGridBySku"> <argument name="product" value="$$createConfigProduct$$"/> </actionGroup> <click stepKey="openFirstProduct" selector="{{AdminProductGridSection.productRowBySku($$createConfigProduct.sku$$)}}"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDropdownProductAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDropdownProductAttributeTest.xml index 525f81de6c48c..4118356b07e74 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDropdownProductAttributeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDropdownProductAttributeTest.xml @@ -21,7 +21,7 @@ </before> <after> <!-- Remove attribute --> - <actionGroup ref="deleteProductAttribute" stepKey="deleteAttribute"> + <actionGroup ref="DeleteProductAttributeActionGroup" stepKey="deleteAttribute"> <argument name="ProductAttribute" value="productDropDownAttribute"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> @@ -60,7 +60,7 @@ <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="waitForSuccessMessage"/> - <actionGroup ref="navigateToCreatedProductAttribute" stepKey="navigateToAttribute"> + <actionGroup ref="NavigateToCreatedProductAttributeActionGroup" stepKey="navigateToAttribute"> <argument name="ProductAttribute" value="productDropDownAttribute"/> </actionGroup> <!-- Check attribute data --> @@ -69,4 +69,4 @@ <assertEquals actual="$secondOptionAdminLabel" expected="'Fish & Chips'" stepKey="assertSecondOption"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDropdownProductAttributeVisibleInStorefrontAdvancedSearchFormTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDropdownProductAttributeVisibleInStorefrontAdvancedSearchFormTest.xml index 1bc69be642a37..557f0768c98a3 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDropdownProductAttributeVisibleInStorefrontAdvancedSearchFormTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDropdownProductAttributeVisibleInStorefrontAdvancedSearchFormTest.xml @@ -39,7 +39,7 @@ <!-- Filter product attribute set by attribute set name --> <amOnPage url="{{AdminProductAttributeSetGridPage.url}}" stepKey="amOnAttributeSetPage"/> - <actionGroup ref="FilterProductAttributeSetGridByAttributeSetName" stepKey="filterProductAttrSetGridByAttrSetName"> + <actionGroup ref="FilterProductAttributeSetGridByAttributeSetNameActionGroup" stepKey="filterProductAttrSetGridByAttrSetName"> <argument name="name" value="$$createAttributeSet.attribute_set_name$$"/> </actionGroup> @@ -47,12 +47,12 @@ <see userInput="$$attribute.attribute_code$$" selector="{{AdminProductAttributeSetEditSection.unassignedAttributesTree}}" stepKey="seeAttributeInUnassignedAttr"/> <!-- Assign attribute in the group --> - <actionGroup ref="AssignAttributeToGroup" stepKey="assignAttributeToGroup"> + <actionGroup ref="AssignAttributeToGroupActionGroup" stepKey="assignAttributeToGroup"> <argument name="group" value="Product Details"/> <argument name="attribute" value="$$attribute.attribute_code$$"/> </actionGroup> <see userInput="$$attribute.attribute_code$$" selector="{{AdminProductAttributeSetEditSection.groupTree}}" stepKey="seeAttributeInGroup"/> - <actionGroup ref="SaveAttributeSet" stepKey="saveAttributeSet"/> + <actionGroup ref="SaveAttributeSetActionGroup" stepKey="saveAttributeSet"/> <!-- Go to Product Attribute Grid page --> <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDuplicateCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDuplicateCategoryTest.xml index 37ec4e0d32528..cbef9566b2b78 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDuplicateCategoryTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDuplicateCategoryTest.xml @@ -27,10 +27,10 @@ </after> <!-- Open Category Page and select Add category --> - <actionGroup ref="goToCreateCategoryPage" stepKey="goToCategoryPage"/> + <actionGroup ref="GoToCreateCategoryPageActionGroup" stepKey="goToCategoryPage"/> <!-- Fill the Category form with same name and urlKey as initially created category(SimpleSubCategory) --> - <actionGroup ref="FillCategoryNameAndUrlKeyAndSave" stepKey="fillCategoryForm"> + <actionGroup ref="FillCategoryNameAndUrlKeyAndSaveActionGroup" stepKey="fillCategoryForm"> <argument name="categoryName" value="$$category.name$$"/> <argument name="categoryUrlKey" value="$$category.custom_attributes[url_key]$$"/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDuplicateProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDuplicateProductTest.xml index 575bb56912b25..4507e1f880a86 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDuplicateProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDuplicateProductTest.xml @@ -32,10 +32,10 @@ </after> <!-- Go to new simple product page --> - <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="goToCreateProductPage"/> + <actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="goToCreateProductPage"/> <!-- Fill the main fields in the form --> - <actionGroup ref="FillMainProductFormByString" stepKey="fillMainProductForm"> + <actionGroup ref="FillMainProductFormByStringActionGroup" stepKey="fillMainProductForm"> <argument name="productName" value="$$subCategory.name$$"/> <argument name="productSku" value="{{defaultSimpleProduct.sku}}"/> <argument name="productPrice" value="{{defaultSimpleProduct.price}}"/> @@ -45,17 +45,17 @@ </actionGroup> <!-- Select the category that we created in the before block --> - <actionGroup ref="SetCategoryByName" stepKey="setCategory"> + <actionGroup ref="SetCategoryByNameActionGroup" stepKey="setCategory"> <argument name="categoryName" value="$$category.name$$"/> </actionGroup> <!-- Set the url key to match the subcategory created in the before block --> - <actionGroup ref="SetProductUrlKeyByString" stepKey="fillUrlKey"> + <actionGroup ref="SetProductUrlKeyByStringActionGroup" stepKey="fillUrlKey"> <argument name="urlKey" value="$$subCategory.custom_attributes[url_key]$$"/> </actionGroup> <!-- Save the product and expect to see an error message --> - <actionGroup ref="SaveProductFormNoSuccessCheck" stepKey="tryToSaveProduct"/> + <actionGroup ref="SaveProductFormNoSuccessCheckActionGroup" stepKey="tryToSaveProduct"/> <see selector="{{AdminProductFormSection.successMessage}}" userInput="The value specified in the URL Key field would generate a URL that already exists." stepKey="seeErrorMessage"/> </test> </tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateMultipleSelectProductAttributeVisibleInStorefrontAdvancedSearchFormTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateMultipleSelectProductAttributeVisibleInStorefrontAdvancedSearchFormTest.xml index 4e096b7ebb142..6bfd012bc88b2 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateMultipleSelectProductAttributeVisibleInStorefrontAdvancedSearchFormTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateMultipleSelectProductAttributeVisibleInStorefrontAdvancedSearchFormTest.xml @@ -45,7 +45,7 @@ <!-- Filter product attribute set by attribute set name --> <amOnPage url="{{AdminProductAttributeSetGridPage.url}}" stepKey="amOnAttributeSetPage"/> - <actionGroup ref="FilterProductAttributeSetGridByAttributeSetName" stepKey="filterProductAttrSetGridByAttrSetName"> + <actionGroup ref="FilterProductAttributeSetGridByAttributeSetNameActionGroup" stepKey="filterProductAttrSetGridByAttrSetName"> <argument name="name" value="$$createAttributeSet.attribute_set_name$$"/> </actionGroup> @@ -53,12 +53,12 @@ <see userInput="$$attribute.attribute_code$$" selector="{{AdminProductAttributeSetEditSection.unassignedAttributesTree}}" stepKey="seeAttributeInUnassignedAttr"/> <!-- Assign attribute in the group --> - <actionGroup ref="AssignAttributeToGroup" stepKey="assignAttributeToGroup"> + <actionGroup ref="AssignAttributeToGroupActionGroup" stepKey="assignAttributeToGroup"> <argument name="group" value="Product Details"/> <argument name="attribute" value="$$attribute.attribute_code$$"/> </actionGroup> <see userInput="$$attribute.attribute_code$$" selector="{{AdminProductAttributeSetEditSection.groupTree}}" stepKey="seeAttributeInGroup"/> - <actionGroup ref="SaveAttributeSet" stepKey="saveAttributeSet"/> + <actionGroup ref="SaveAttributeSetActionGroup" stepKey="saveAttributeSet"/> <!-- Go to Product Attribute Grid page --> <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewAttributeFromProductPageTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewAttributeFromProductPageTest.xml index 2706d00038e4b..51c4a3250d609 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewAttributeFromProductPageTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewAttributeFromProductPageTest.xml @@ -26,8 +26,8 @@ <actionGroup ref="logout" stepKey="logout"/> </after> - <actionGroup ref="GoToProductCatalogPage" stepKey="goToProductCatalogPage"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct"> + <actionGroup ref="GoToProductCatalogPageActionGroup" stepKey="goToProductCatalogPage"/> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct"> <argument name="product" value="SimpleProduct"/> </actionGroup> <actionGroup ref="AdminClickAddAttributeOnProductEditPageActionGroup" stepKey="clickAddAttribute"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewAttributeFromProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewAttributeFromProductTest.xml index 02615ca5dd254..8fb226f5f5585 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewAttributeFromProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewAttributeFromProductTest.xml @@ -38,7 +38,7 @@ </actionGroup> <!--Delete Attribute--> - <actionGroup ref="deleteProductAttribute" stepKey="deleteAttribute"> + <actionGroup ref="DeleteProductAttributeActionGroup" stepKey="deleteAttribute"> <argument name="ProductAttribute" value="productDropDownAttribute"/> </actionGroup> @@ -55,7 +55,7 @@ <!--Go to created product page and create new attribute--> <amOnPage url="{{AdminProductEditPage.url($$createProduct.id$$)}}" stepKey="openAdminEditPage"/> - <actionGroup ref="AdminCreateAttributeWithValueWithTwoStoreViesFromProductPage" stepKey="createAttribute"> + <actionGroup ref="AdminCreateAttributeWithValueWithTwoStoreViesFromProductPageActionGroup" stepKey="createAttribute"> <argument name="attributeName" value="{{productDropDownAttribute.attribute_code}}"/> <argument name="attributeType" value="Dropdown"/> <argument name="firstStoreViewName" value="{{customStoreEN.name}}"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewGroupForAttributeSetTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewGroupForAttributeSetTest.xml index 3219bca233bee..a105f343d3e21 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewGroupForAttributeSetTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewGroupForAttributeSetTest.xml @@ -29,13 +29,13 @@ <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> <actionGroup ref="logout" stepKey="logout"/> </after> - + <!-- Navigate to Stores > Attributes > Attribute Set --> <amOnPage url="{{AdminProductAttributeSetGridPage.url}}" stepKey="goToAttributeSetPage"/> <waitForPageLoad stepKey="waitForPageLoad"/> <!-- Search and open Attribute Set from preconditions --> - <actionGroup ref="goToAttributeSetByName" stepKey="searchAttribute"> + <actionGroup ref="GoToAttributeSetByNameActionGroup" stepKey="searchAttribute"> <argument name="name" value="$$createAttributeSet.attribute_set_name$$"/> </actionGroup> @@ -68,9 +68,9 @@ <see userInput="$$createConfigProductAttribute.attribute_code$$" selector="{{AdminProductAttributeSetEditSection.groupTree}}" stepKey="seeAttribute"/> <!-- Click 'Save' --> - <actionGroup ref="SaveAttributeSet" stepKey="saveAttribute"/> + <actionGroup ref="SaveAttributeSetActionGroup" stepKey="saveAttribute"/> - <actionGroup ref="goToAttributeSetByName" stepKey="backTohAttributeSet"> + <actionGroup ref="GoToAttributeSetByNameActionGroup" stepKey="backTohAttributeSet"> <argument name="name" value="$$createAttributeSet.attribute_set_name$$"/> </actionGroup> @@ -85,7 +85,7 @@ <!-- Empty group is created. No attributes are assigned to it. --> <seeElement selector="{{AdminProductAttributeSetEditSection.attributeGroup(emptyGroup.name)}}" stepKey="assertEmptyGroup"/> <dontSeeElement selector="{{AdminProductAttributeSetEditSection.attributesInGroup(emptyGroup.name)}}" stepKey="seeNoAttributes"/> - + <!-- Navigate to Catalog > Products --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductPage"/> <waitForPageLoad stepKey="waitForProductPageLoad"/> @@ -93,8 +93,8 @@ <!-- Start to create a new simple product with the custom attribute set from the preconditions --> <click selector="{{AdminProductGridActionSection.addProductBtn}}" stepKey="clickAddProduct"/> <waitForPageLoad stepKey="waitForNewProductPage"/> - - <actionGroup ref="AdminProductPageSelectAttributeSet" stepKey="selectAttribute"> + + <actionGroup ref="AdminProductPageSelectAttributeSetActionGroup" stepKey="selectAttribute"> <argument name="attributeSetName" value="$$createAttributeSet.attribute_set_name$$"/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeFromProductPageTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeFromProductPageTest.xml index 63a964f4b5e91..2e502f58041e6 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeFromProductPageTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeFromProductPageTest.xml @@ -35,7 +35,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <!--<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>--> - <actionGroup ref="deleteProductAttribute" stepKey="deleteCreatedAttribute"> + <actionGroup ref="DeleteProductAttributeActionGroup" stepKey="deleteCreatedAttribute"> <argument name="ProductAttribute" value="newProductAttribute"/> </actionGroup> @@ -47,7 +47,7 @@ <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> <!-- Select Created Product--> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProductGridBySku"> <argument name="product" value="$$createSimpleProduct$$"/> </actionGroup> <click stepKey="openFirstProduct" selector="{{AdminProductGridSection.productRowBySku($$createSimpleProduct.sku$$)}}"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeRequiredTextFieldTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeRequiredTextFieldTest.xml index d4d6496e018f5..63eed37b1e84f 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeRequiredTextFieldTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeRequiredTextFieldTest.xml @@ -34,7 +34,7 @@ <!--Delete created entity --> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> - <actionGroup ref="deleteProductAttribute" stepKey="deleteCreatedAttribute"> + <actionGroup ref="DeleteProductAttributeActionGroup" stepKey="deleteCreatedAttribute"> <argument name="ProductAttribute" value="newProductAttribute"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> @@ -45,7 +45,7 @@ <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> <!-- Select Created Product--> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProductGridBySku"> <argument name="product" value="$$createSimpleProduct$$"/> </actionGroup> <click stepKey="openFirstProduct" selector="{{AdminProductGridSection.productRowBySku($$createSimpleProduct.sku$$)}}"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductCustomAttributeSet.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductCustomAttributeSet.xml index 713e1b7d6dfd1..7f6feaff3ed5d 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductCustomAttributeSet.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductCustomAttributeSet.xml @@ -71,10 +71,10 @@ <dontSeeElementInDOM selector="{{AdminProductFormSection.divByDataIndex('meta_keyword')}}" stepKey="dontSeeMetaKeyword"/> <!-- Finish filling the new product page --> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillSimpleProductMain"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillSimpleProductMain"> <argument name="product" value="_defaultProduct"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveSimpleProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveSimpleProduct"/> <!-- Check the storefront --> <amOnPage url="{{_defaultProduct.name}}.html" stepKey="goToProductPage"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductDuplicateUrlkeyTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductDuplicateUrlkeyTest.xml index 291b6985bd3e5..f5e42bb84549c 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductDuplicateUrlkeyTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductDuplicateUrlkeyTest.xml @@ -58,7 +58,7 @@ </before> <after> <!--Delete all products by filtering grid and using mass delete action--> - <actionGroup ref="deleteAllDuplicateProductUsingProductGrid" stepKey="deleteAllDuplicateProducts"> + <actionGroup ref="DeleteAllDuplicateProductUsingProductGridActionGroup" stepKey="deleteAllDuplicateProducts"> <argument name="product" value="$$createSimpleProduct$$"/> </actionGroup> <deleteData createDataKey="createCategory" stepKey="deletePreReqCatalog" /> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateRootCategoryAndSubcategoriesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateRootCategoryAndSubcategoriesTest.xml index 11d919ddefa2c..7a99750c00e53 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateRootCategoryAndSubcategoriesTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateRootCategoryAndSubcategoriesTest.xml @@ -33,7 +33,7 @@ <selectOption userInput="Default Category" selector="{{AdminNewStoreGroupSection.storeRootCategoryDropdown}}" stepKey="selectOptionDefaultCategory"/> <click selector="{{AdminStoreGroupActionsSection.saveButton}}" stepKey="clickSaveStoreButton"/> <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="clickOkOnModalDialog2"/> - <actionGroup ref="DeleteCategory" stepKey="deleteCreatedNewRootCategory"> + <actionGroup ref="DeleteCategoryActionGroup" stepKey="deleteCreatedNewRootCategory"> <argument name="categoryEntity" value="NewRootCategory"/> </actionGroup> <actionGroup ref="logout" stepKey="logout2"/> @@ -48,13 +48,13 @@ </actionGroup> <scrollToTopOfPage stepKey="scrollToTopOfPage2"/> <!--Create subcategory--> - <actionGroup ref="CreateCategory" stepKey="createSubcategory1"> + <actionGroup ref="CreateCategoryActionGroup" stepKey="createSubcategory1"> <argument name="categoryEntity" value="SimpleSubCategory"/> </actionGroup> <click selector="{{AdminCategorySidebarTreeSection.categoryInTree(NewRootCategory.name)}}" stepKey="clickOnCreatedNewRootCategory1"/> <scrollToTopOfPage stepKey="scrollToTopOfPage3"/> <!--Create another subcategory--> - <actionGroup ref="CreateCategory" stepKey="createSubcategory2"> + <actionGroup ref="CreateCategoryActionGroup" stepKey="createSubcategory2"> <argument name="categoryEntity" value="SubCategoryWithParent"/> </actionGroup> <!--Assign new created root category to store--> @@ -74,11 +74,11 @@ <!--Go to storefront and verify created subcategory on frontend--> <amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToStorefrontPage"/> <waitForPageLoad stepKey="waitForPageAdminSystemStoreLoad2"/> - <actionGroup ref="CheckCategoryOnStorefront" stepKey="checkCreatedSubcategory1OnFrontend"> + <actionGroup ref="CheckCategoryOnStorefrontActionGroup" stepKey="checkCreatedSubcategory1OnFrontend"> <argument name="categoryEntity" value="SimpleSubCategory"/> </actionGroup> - <actionGroup ref="CheckCategoryOnStorefront" stepKey="checkCreatedSubcategory2OnFrontend"> + <actionGroup ref="CheckCategoryOnStorefrontActionGroup" stepKey="checkCreatedSubcategory2OnFrontend"> <argument name="categoryEntity" value="SubCategoryWithParent"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateRootCategoryRequiredFieldsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateRootCategoryRequiredFieldsTest.xml index f98f9acc46961..2b824554b9bd4 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateRootCategoryRequiredFieldsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateRootCategoryRequiredFieldsTest.xml @@ -23,7 +23,7 @@ <actionGroup ref = "LoginAsAdmin" stepKey="LoginToAdminPanel"/> </before> <after> - <actionGroup ref="DeleteCategory" stepKey="deleteCategory"> + <actionGroup ref="DeleteCategoryActionGroup" stepKey="deleteCategory"> <argument name="categoryEntity" value="_defaultCategory" /> </actionGroup> <actionGroup ref="logout" stepKey="logout" /> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductTest.xml index a7587a5ed31fe..052f6b1924e89 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductTest.xml @@ -26,7 +26,7 @@ </after> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/> - <actionGroup ref="FillAdminSimpleProductForm" stepKey="fillProductFieldsInAdmin"> + <actionGroup ref="FillAdminSimpleProductFormActionGroup" stepKey="fillProductFieldsInAdmin"> <argument name="category" value="$$createPreReqCategory$$"/> <argument name="simpleProduct" value="_defaultProduct"/> </actionGroup> @@ -34,7 +34,7 @@ <argument name="category" value="$$createPreReqCategory$$"/> <argument name="product" value="_defaultProduct"/> </actionGroup> - <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="assertProductInStorefront2"> + <actionGroup ref="AssertProductInStorefrontProductPageActionGroup" stepKey="assertProductInStorefront2"> <argument name="product" value="_defaultProduct"/> </actionGroup> </test> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithCountryOfManufactureAttributeSKUMaskTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithCountryOfManufactureAttributeSKUMaskTest.xml index 3487de656173f..bbaabffcc5ecd 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithCountryOfManufactureAttributeSKUMaskTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithCountryOfManufactureAttributeSKUMaskTest.xml @@ -25,7 +25,7 @@ </before> <after> <magentoCLI stepKey="setName" command="config:set catalog/fields_masks/sku" arguments="{{name}}"/> - <actionGroup ref="deleteProductBySku" stepKey="deleteCreatedProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteCreatedProduct"> <argument name="sku" value="{{nameAndAttributeSkuMaskSimpleProduct.name}}-{{nameAndAttributeSkuMaskSimpleProduct.country_of_manufacture_label}}" /> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithUnicodeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithUnicodeTest.xml index 94d488f216b49..93f01964ffdb5 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithUnicodeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithUnicodeTest.xml @@ -27,7 +27,7 @@ </after> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/> - <actionGroup ref="FillAdminSimpleProductForm" stepKey="fillProductFieldsInAdmin"> + <actionGroup ref="FillAdminSimpleProductFormActionGroup" stepKey="fillProductFieldsInAdmin"> <argument name="category" value="$$createPreReqCategory$$"/> <argument name="simpleProduct" value="ProductWithUnicode"/> </actionGroup> @@ -35,7 +35,7 @@ <argument name="category" value="$$createPreReqCategory$$"/> <argument name="product" value="ProductWithUnicode"/> </actionGroup> - <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="assertProductInStorefront2"> + <actionGroup ref="AssertProductInStorefrontProductPageActionGroup" stepKey="assertProductInStorefront2"> <argument name="product" value="ProductWithUnicode"/> </actionGroup> </test> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateTextEditorProductAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateTextEditorProductAttributeTest.xml index fc7482c353136..848e765d34d70 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateTextEditorProductAttributeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateTextEditorProductAttributeTest.xml @@ -30,12 +30,12 @@ </before> <after> <!-- Delete attribute --> - <actionGroup ref="deleteProductAttribute" stepKey="deleteAttribute"> + <actionGroup ref="DeleteProductAttributeActionGroup" stepKey="deleteAttribute"> <argument name="ProductAttribute" value="productTextEditorAttribute"/> </actionGroup> <!-- Delete product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="_defaultProduct"/> </actionGroup> @@ -71,7 +71,7 @@ <selectOption selector="{{AttributePropertiesSection.InputType}}" userInput="{{productTextEditorAttribute.frontend_input}}" stepKey="returnInputType"/> <!-- Save Product Attribute --> - <actionGroup ref="saveProductAttribute" stepKey="saveAttribute"/> + <actionGroup ref="SaveProductAttributeActionGroup" stepKey="saveAttribute"/> <!-- Go to Store > Attribute Set --> <actionGroup ref="AdminOpenAttributeSetGridPageActionGroup" stepKey="openAttributeSetPage"/> @@ -80,20 +80,20 @@ <actionGroup ref="AdminOpenAttributeSetByNameActionGroup" stepKey="openDefaultAttributeSet"/> <!-- Add Product Attribute to Default attribute by dragging and dropping this to the 'Project Details' folder. Then Save. --> - <actionGroup ref="AssignAttributeToGroup" stepKey="assignAttributeToGroup"> + <actionGroup ref="AssignAttributeToGroupActionGroup" stepKey="assignAttributeToGroup"> <argument name="group" value="Product Details"/> <argument name="attribute" value="{{productTextEditorAttribute.attribute_code}}"/> </actionGroup> - <actionGroup ref="SaveAttributeSet" stepKey="saveAttributeSet"/> + <actionGroup ref="SaveAttributeSetActionGroup" stepKey="saveAttributeSet"/> <!-- Go Catalog > Product to create new product page --> <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="goToProductIndexPage"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct"> <argument name="product" value="_defaultProduct"/> </actionGroup> <!-- On product page, select Attribute Set: "Default" --> - <actionGroup ref="AdminProductPageSelectAttributeSet" stepKey="selectAttributeSet"> + <actionGroup ref="AdminProductPageSelectAttributeSetActionGroup" stepKey="selectAttributeSet"> <argument name="attributeSetName" value="Default"/> </actionGroup> @@ -115,8 +115,8 @@ <fillField selector="{{ProductDescriptionWysiwygSection.attributeEditArea(productTextEditorAttribute.attribute_code)}}" userInput="This content from product page" stepKey="setContent"/> <!-- Fill up all required fields for product form --> - <actionGroup ref="fillMainProductForm" stepKey="fillProductForm"/> - <actionGroup ref="saveProductForm" stepKey="saveProductForm"/> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillProductForm"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductForm"/> <!-- Assert product attribute on Storefront --> <actionGroup ref="OpenStorefrontProductPageByProductNameActionGroup" stepKey="openProductPage"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductOutOfStockWithTierPriceTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductOutOfStockWithTierPriceTest.xml index 0b929eaddc96e..84eacc54a6e22 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductOutOfStockWithTierPriceTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductOutOfStockWithTierPriceTest.xml @@ -24,7 +24,7 @@ </before> <after> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="categoryEntity"/> - <actionGroup ref="deleteProductBySku" stepKey="deleteVirtualProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteVirtualProduct"> <argument name="sku" value="{{virtualProductOutOfStock.sku}}"/> </actionGroup> <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFilter"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithCustomOptionsSuiteAndImportOptionsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithCustomOptionsSuiteAndImportOptionsTest.xml index 23f772a395a7d..8dd7671ac0295 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithCustomOptionsSuiteAndImportOptionsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithCustomOptionsSuiteAndImportOptionsTest.xml @@ -24,7 +24,7 @@ </before> <after> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="categoryEntity"/> - <actionGroup ref="deleteProductBySku" stepKey="deleteVirtualProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteVirtualProduct"> <argument name="sku" value="{{virtualProductCustomImportOptions.sku}}"/> </actionGroup> <actionGroup ref="clearFiltersAdminDataGrid" stepKey="resetOrderFilter"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithTierPriceForGeneralGroupTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithTierPriceForGeneralGroupTest.xml index 9055e961f889f..976f714d7b3e1 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithTierPriceForGeneralGroupTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithTierPriceForGeneralGroupTest.xml @@ -24,7 +24,7 @@ <createData entity="Simple_US_CA_Customer" stepKey="customer" /> </before> <after> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteVirtualProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteVirtualProduct"> <argument name="product" value="virtualProductGeneralGroup"/> </actionGroup> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="categoryEntity"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteAttributeSetTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteAttributeSetTest.xml index cbe2f40e0dd25..973ff0381584a 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteAttributeSetTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteAttributeSetTest.xml @@ -47,7 +47,7 @@ <!-- Search for the product by sku and name on the product page --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToAdminProductIndex"/> <waitForPageLoad stepKey="waitForAdminProductIndex"/> - <actionGroup ref="filterProductGridBySkuAndName" stepKey="filerProductsBySkuAndName"> + <actionGroup ref="FilterProductGridBySkuAndNameActionGroup" stepKey="filerProductsBySkuAndName"> <argument name="product" value="SimpleProductWithCustomAttributeSet"/> </actionGroup> <!-- Should not see the product --> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteConfigurableChildProductsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteConfigurableChildProductsTest.xml index 0df9dd0b57545..4a305b8dfec75 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteConfigurableChildProductsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteConfigurableChildProductsTest.xml @@ -95,10 +95,10 @@ <see selector="{{StorefrontProductInfoMainSection.productAttributeTitle1}}" userInput="$$createConfigProductAttribute.default_value$$" stepKey="seeProductAttributeLabel"/> <seeElement selector="{{StorefrontProductInfoMainSection.productAttributeOptions1}}" stepKey="seeProductAttributeOptions"/> <!-- Delete Child products --> - <actionGroup ref="deleteProductBySku" stepKey="deleteFirstChildProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteFirstChildProduct"> <argument name="sku" value="$$createConfigChildProduct1.sku$$"/> </actionGroup> - <actionGroup ref="deleteProductBySku" stepKey="deleteSecondChildProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteSecondChildProduct"> <argument name="sku" value="$$createConfigChildProduct2.sku$$"/> </actionGroup> <!--Verify product is not visible in category store front page --> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteDropdownProductAttributeFromAttributeSetTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteDropdownProductAttributeFromAttributeSetTest.xml index 3841c061c2629..84a116fb4bcd6 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteDropdownProductAttributeFromAttributeSetTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteDropdownProductAttributeFromAttributeSetTest.xml @@ -41,7 +41,7 @@ <click selector="{{AdminProductAttributeSetGridSection.AttributeSetName($$createAttributeSet.attribute_set_name$$)}}" stepKey="clickOnAttributeSet"/> <waitForPageLoad stepKey="waitForAttributeSetEditPageToLoad"/> <!--Assign Attribute to the Group and save the attribute set --> - <actionGroup ref="AssignAttributeToGroup" stepKey="assignAttribute"> + <actionGroup ref="AssignAttributeToGroupActionGroup" stepKey="assignAttribute"> <argument name="group" value="Product Details"/> <argument name="attribute" value="$$attribute.attribute_code$$"/> </actionGroup> @@ -49,11 +49,11 @@ <waitForPageLoad stepKey="waitForPageToSave"/> <see userInput="You saved the attribute set" selector="{{AdminMessagesSection.success}}" stepKey="successMessage"/> <!--Delete product attribute from product attribute grid --> - <actionGroup ref="deleteProductAttributeByAttributeCode" stepKey="deleteProductAttribute"> + <actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteProductAttribute"> <argument name="ProductAttributeCode" value="$$attribute.attribute_code$$"/> </actionGroup> <!--Confirm Attribute is not present in Product Attribute Grid --> - <actionGroup ref="filterProductAttributeByAttributeCode" stepKey="filterAttribute"> + <actionGroup ref="FilterProductAttributeByAttributeCodeActionGroup" stepKey="filterAttribute"> <argument name="ProductAttributeCode" value="$$attribute.attribute_code$$"/> </actionGroup> <see selector="{{AdminProductAttributeGridSection.FirstRow}}" userInput="We couldn't find any records." stepKey="seeEmptyRow"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductAttributeTest.xml index d0036a2adea5a..cc3242310ca11 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductAttributeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductAttributeTest.xml @@ -24,16 +24,16 @@ <after> <actionGroup ref="logout" stepKey="logout"/> </after> - <actionGroup ref="deleteProductAttributeByAttributeCode" stepKey="deleteProductAttribute"> + <actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteProductAttribute"> <argument name="ProductAttributeCode" value="$$createProductAttribute.attribute_code$$"/> </actionGroup> <!-- Assert the product attribute is not in the grid by Attribute code --> - <actionGroup ref="filterProductAttributeByAttributeCode" stepKey="filterByAttributeCode"> + <actionGroup ref="FilterProductAttributeByAttributeCodeActionGroup" stepKey="filterByAttributeCode"> <argument name="ProductAttributeCode" value="$$createProductAttribute.attribute_code$$"/> </actionGroup> <see selector="{{AdminDataGridTableSection.dataGridEmpty}}" userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage"/> <!--Assert the product attribute is not in the grid by Default Label --> - <actionGroup ref="filterProductAttributeByDefaultLabel" stepKey="filterByDefaultLabel"> + <actionGroup ref="FilterProductAttributeByDefaultLabelActionGroup" stepKey="filterByDefaultLabel"> <argument name="productAttributeLabel" value="$$createProductAttribute.default_frontend_label$$"/> </actionGroup> <see selector="{{AdminDataGridTableSection.dataGridEmpty}}" userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage2"/> @@ -48,7 +48,7 @@ <waitForPageLoad stepKey="waitForAttributeAdded"/> <!-- Filter By Attribute Label on Add Attribute Page --> <click selector="{{AdminProductFiltersSection.filter}}" stepKey="clickOnFilter"/> - <actionGroup ref="filterProductAttributeByAttributeLabel" stepKey="filterByAttributeLabel"> + <actionGroup ref="FilterProductAttributeByAttributeLabelActionGroup" stepKey="filterByAttributeLabel"> <argument name="productAttributeLabel" value="$$createProductAttribute.default_frontend_label$$"/> </actionGroup> <see selector="{{AdminDataGridTableSection.dataGridEmpty}}" userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage3"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductWithCustomOptionTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductWithCustomOptionTest.xml index 7f6a1333b721a..dec911ec84a8d 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductWithCustomOptionTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductWithCustomOptionTest.xml @@ -30,7 +30,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <actionGroup ref="logout" stepKey="logout"/> </after> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteSimpleProductFilteredBySkuAndName"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteSimpleProductFilteredBySkuAndName"> <argument name="product" value="$$createSimpleProduct$$"/> </actionGroup> <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="A total of 1 record(s) have been deleted." stepKey="deleteMessage"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductsImageInCaseOfMultipleStoresTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductsImageInCaseOfMultipleStoresTest.xml index f334cbc218b7c..55c98bcc13d34 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductsImageInCaseOfMultipleStoresTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductsImageInCaseOfMultipleStoresTest.xml @@ -43,17 +43,17 @@ <amOnPage url="{{AdminProductEditPage.url($$createProduct.id$$)}}" stepKey="visitAdminProductPage"/> <waitForPageLoad stepKey="waitForProductPageLoad0"/> <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="['Default Category', $$createRootCategory.name$$, $$createSubCategory.name$$]" stepKey="fillCategory"/> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!--Add images to the product--> <amOnPage url="{{AdminProductEditPage.url($$createProduct.id$$)}}" stepKey="visitAdminProductPage2"/> <waitForPageLoad stepKey="waitForProductPageLoad1"/> - <actionGroup ref="addProductImage" stepKey="addImageToProduct"> + <actionGroup ref="AddProductImageActionGroup" stepKey="addImageToProduct"> <argument name="image" value="ProductImage"/> </actionGroup> - <actionGroup ref="addProductImage" stepKey="addImage1ToProduct"> + <actionGroup ref="AddProductImageActionGroup" stepKey="addImage1ToProduct"> <argument name="image" value="TestImageNew"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProduct1"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct1"/> <!--Enable config to view created store view on store front--> <createData entity="EnableWebUrlOptionsConfig" stepKey="enableWebUrlOptionsConfig"/> </before> @@ -86,12 +86,12 @@ <actionGroup ref="SelectProductInWebsitesActionGroup" stepKey="selectWebsiteInProduct2"> <argument name="website" value="{{NewWebSiteData.name}}"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProduct2"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct2"/> <!--Reindex and flush cache--> <magentoCLI command="indexer:reindex" stepKey="reindex"/> <magentoCLI command="cache:flush" stepKey="flushCache"/> <!--Switch to 'Default Store View' scope and open product page--> - <actionGroup ref="SwitchToTheNewStoreView" stepKey="SwitchDefaultStoreView"> + <actionGroup ref="SwitchToTheNewStoreViewActionGroup" stepKey="SwitchDefaultStoreView"> <argument name="storeViewName" value="'Default Store View'"/> </actionGroup> <waitForPageLoad stepKey="waitForProductPageLoad3"/> @@ -99,9 +99,9 @@ <actionGroup ref="AdminAssignImageRolesIfUnassignedActionGroup" stepKey="assignAllRolesToFirstImage"> <argument name="image" value="ProductImage"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProduct3"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct3"/> <!--Switch to newly created Store View scope and open product page--> - <actionGroup ref="SwitchToTheNewStoreView" stepKey="SwitchNewStoreView"> + <actionGroup ref="SwitchToTheNewStoreViewActionGroup" stepKey="SwitchNewStoreView"> <argument name="storeViewName" value="{{NewStoreViewData.name}}"/> </actionGroup> <waitForPageLoad stepKey="waitForProductPageLoad4"/> @@ -109,17 +109,17 @@ <actionGroup ref="AdminAssignImageRolesIfUnassignedActionGroup" stepKey="assignAllRolesToFirstImage2"> <argument name="image" value="ProductImage"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProduct4"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct4"/> <!--Switch to 'All Store Views' scope and open product page--> - <actionGroup ref="SwitchToTheNewStoreView" stepKey="SwitchAllStoreView"> + <actionGroup ref="SwitchToTheNewStoreViewActionGroup" stepKey="SwitchAllStoreView"> <argument name="storeViewName" value="'All Store Views'"/> </actionGroup> <waitForPageLoad stepKey="waitForProductPageLoad5"/> <!--Remove product image and save--> - <actionGroup ref="RemoveProductImageByName" stepKey="removeProductImage"> + <actionGroup ref="RemoveProductImageByNameActionGroup" stepKey="removeProductImage"> <argument name="image" value="ProductImage"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProduct5"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct5"/> <!--Assert notification and success messages--> <see selector="{{StorefrontMessagesSection.success}}" userInput="{{ProductFormMessages.save_success}}" stepKey="seeSuccessMessage"/> <see selector="{{StorefrontMessagesSection.noticeMessage}}" userInput="{{ProductFormMessages.remove_image_notice}}" stepKey="seeNotification"/> @@ -128,7 +128,7 @@ <waitForPageLoad stepKey="waitForImagesLoad"/> <seeElement selector="{{AdminProductImagesSection.imageFile(ProductImage.fileName)}}" stepKey="seeImageIsNotDeleted"/> <!--Switch to newly created Store View scope and open product page--> - <actionGroup ref="SwitchToTheNewStoreView" stepKey="SwitchNewStoreView2"> + <actionGroup ref="SwitchToTheNewStoreViewActionGroup" stepKey="SwitchNewStoreView2"> <argument name="storeViewName" value="{{NewStoreViewData.name}}"/> </actionGroup> <waitForPageLoad stepKey="waitForProductPageLoad6"/> @@ -136,17 +136,17 @@ <actionGroup ref="AdminAssignImageRolesIfUnassignedActionGroup" stepKey="assignAllRolesToSecondImage"> <argument name="image" value="TestImageNew"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProduct6"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct6"/> <!--Switch to 'All Store Views' scope and open product page--> - <actionGroup ref="SwitchToTheNewStoreView" stepKey="SwitchAllStoreView2"> + <actionGroup ref="SwitchToTheNewStoreViewActionGroup" stepKey="SwitchAllStoreView2"> <argument name="storeViewName" value="'All Store Views'"/> </actionGroup> <waitForPageLoad stepKey="waitForProductPageLoad7"/> <!--Remove product image and save--> - <actionGroup ref="RemoveProductImageByName" stepKey="removeProductFirstImage"> + <actionGroup ref="RemoveProductImageByNameActionGroup" stepKey="removeProductFirstImage"> <argument name="image" value="ProductImage"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProduct7"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct7"/> <!--Assert notification and success messages--> <see selector="{{StorefrontMessagesSection.success}}" userInput="{{ProductFormMessages.save_success}}" stepKey="seeSuccessMessage2"/> <see selector="{{StorefrontMessagesSection.noticeMessage}}" userInput="{{ProductFormMessages.remove_image_notice}}" stepKey="seeNotification2"/> @@ -155,15 +155,15 @@ <waitForPageLoad stepKey="waitForImagesLoad2"/> <seeElement selector="{{AdminProductImagesSection.imageFile(ProductImage.fileName)}}" stepKey="seeImageIsNotDeleted2"/> <!--Switch to newly created Store View scope and open product page--> - <actionGroup ref="SwitchToTheNewStoreView" stepKey="SwitchNewStoreView3"> + <actionGroup ref="SwitchToTheNewStoreViewActionGroup" stepKey="SwitchNewStoreView3"> <argument name="storeViewName" value="{{NewStoreViewData.name}}"/> </actionGroup> <waitForPageLoad stepKey="waitForProductPageLoad8"/> <!--Remove second image and save--> - <actionGroup ref="RemoveProductImageByName" stepKey="removeProductSecondImage"> + <actionGroup ref="RemoveProductImageByNameActionGroup" stepKey="removeProductSecondImage"> <argument name="image" value="TestImageNew"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProduct8"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct8"/> <!--Assert success messages--> <see selector="{{StorefrontMessagesSection.success}}" userInput="{{ProductFormMessages.save_success}}" stepKey="seeSuccessMessage3"/> <!--Reopen image tab and see the image is deleted--> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteSimpleProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteSimpleProductTest.xml index 7c460a3dfc51e..5b8ac5157514d 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteSimpleProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteSimpleProductTest.xml @@ -29,7 +29,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <actionGroup ref="logout" stepKey="logout"/> </after> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteSimpleProductFilteredBySkuAndName"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteSimpleProductFilteredBySkuAndName"> <argument name="product" value="$$createSimpleProduct$$"/> </actionGroup> <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="A total of 1 record(s) have been deleted." stepKey="deleteMessage"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteTextFieldProductAttributeFromAttributeSetTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteTextFieldProductAttributeFromAttributeSetTest.xml index c3cafb17c5eac..4b97fb38e994f 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteTextFieldProductAttributeFromAttributeSetTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteTextFieldProductAttributeFromAttributeSetTest.xml @@ -47,7 +47,7 @@ <!--Open Product Index Page and filter the product--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProduct"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProduct"> <argument name="product" value="SimpleProduct2"/> </actionGroup> <!--Verify Created Product Attribute displayed in Product page --> @@ -55,11 +55,11 @@ <waitForPageLoad stepKey="waitForProductToLoad"/> <seeElement selector="{{AdminProductFormSection.newAddedAttribute($$attribute.attribute_code$$)}}" stepKey="seeProductAttributeIsAdded"/> <!--Delete product attribute from product attribute grid --> - <actionGroup ref="deleteProductAttributeByAttributeCode" stepKey="deleteProductAttribute"> + <actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteProductAttribute"> <argument name="ProductAttributeCode" value="$$attribute.attribute_code$$"/> </actionGroup> <!-- Confirm attribute is not present in product attribute grid --> - <actionGroup ref="filterProductAttributeByAttributeCode" stepKey="filterAttribute"> + <actionGroup ref="FilterProductAttributeByAttributeCodeActionGroup" stepKey="filterAttribute"> <argument name="ProductAttributeCode" value="$$attribute.attribute_code$$"/> </actionGroup> <see stepKey="seeEmptyRow" selector="{{AdminProductAttributeGridSection.FirstRow}}" userInput="We couldn't find any records."/> @@ -77,7 +77,7 @@ <!--Verify Product Attribute is not present in Product Index Page --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="openProductIndexPage"/> <waitForPageLoad stepKey="waitForProductIndexPageToLoad1"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProduct1"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProduct1"> <argument name="product" value="SimpleProduct2"/> </actionGroup> <!--Verify Product Attribute is not present in Product page --> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteVirtualProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteVirtualProductTest.xml index 413d53d1c3746..86f253f358532 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteVirtualProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteVirtualProductTest.xml @@ -30,7 +30,7 @@ <actionGroup ref="logout" stepKey="logout"/> </after> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteVirtualProductFilteredBySkuAndName"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteVirtualProductFilteredBySkuAndName"> <argument name="product" value="$$createVirtualProduct$$"/> </actionGroup> <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="A total of 1 record(s) have been deleted." stepKey="deleteMessage"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDisableProductOnChangingAttributeSetTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDisableProductOnChangingAttributeSetTest.xml index dab1704d50bf3..0fc2c022b81e9 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDisableProductOnChangingAttributeSetTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDisableProductOnChangingAttributeSetTest.xml @@ -33,7 +33,7 @@ </after> <actionGroup ref="LoginAsAdmin" stepKey="login"/> <amOnPage url="{{AdminProductAttributeSetEditPage.url}}/$$createAttributeSet.attribute_set_id$$/" stepKey="onAttributeSetEdit"/> - <actionGroup ref="SaveAttributeSet" stepKey="SaveAttributeSet"/> + <actionGroup ref="SaveAttributeSetActionGroup" stepKey="SaveAttributeSet"/> <actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForSimpleProduct"> <argument name="product" value="$$createSimpleProduct$$"/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminEditTextEditorProductAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminEditTextEditorProductAttributeTest.xml index 53040993beb8f..392d3c6ff5320 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminEditTextEditorProductAttributeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminEditTextEditorProductAttributeTest.xml @@ -26,7 +26,7 @@ <requiredEntity createDataKey="myProductAttributeCreation"/> </createData> </before> - <actionGroup ref="navigateToCreatedProductAttribute" stepKey="navigateToAttribute"> + <actionGroup ref="NavigateToCreatedProductAttributeActionGroup" stepKey="navigateToAttribute"> <argument name="ProductAttribute" value="productAttributeWysiwyg"/> </actionGroup> <seeOptionIsSelected selector="{{AttributePropertiesSection.InputType}}" userInput="Text Editor" stepKey="seeTextEditorSelected" /> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminFilterByNameByStoreViewOnProductGridTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminFilterByNameByStoreViewOnProductGridTest.xml index f3ec225540c75..0b230b0b8e002 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminFilterByNameByStoreViewOnProductGridTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminFilterByNameByStoreViewOnProductGridTest.xml @@ -35,11 +35,11 @@ <scrollToTopOfPage stepKey="scrollToTopOfAdminProductFormSection"/> <click selector="{{AdminProductFormSection.productNameUseDefault}}" stepKey="uncheckUseDefault"/> <fillField selector="{{AdminProductFormSection.productName}}" userInput="{{SimpleProduct.name}}" stepKey="fillNewName"/> - <actionGroup ref="saveProductForm" stepKey="saveSimpleProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveSimpleProduct"/> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> - <actionGroup ref="filterProductGridByName" stepKey="filterGridByName"> + <actionGroup ref="FilterProductGridByNameActionGroup" stepKey="filterGridByName"> <argument name="product" value="SimpleProduct"/> </actionGroup> <see selector="{{AdminProductGridSection.firstProductRow}}" userInput="{{SimpleProduct2.name}}" stepKey="seeProductNameInGrid"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminFilteringCategoryProductsUsingScopeSelectorTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminFilteringCategoryProductsUsingScopeSelectorTest.xml index 41b446b474078..f75bdf18ccfc4 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminFilteringCategoryProductsUsingScopeSelectorTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminFilteringCategoryProductsUsingScopeSelectorTest.xml @@ -60,7 +60,7 @@ <click selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="clickToOpenWebsiteSection"/> <waitForPageLoad stepKey="waitForToOpenedWebsiteSection"/> <uncheckOption selector="{{ProductInWebsitesSection.website('Main Website')}}" stepKey="uncheckWebsite"/> - <actionGroup ref="saveProductForm" stepKey="saveProduct1"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct1"/> <!-- Set filter to product name and product2 in website 2 only --> <actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForProduct2"> @@ -73,7 +73,7 @@ <argument name="website" value="{{secondCustomWebsite.name}}"/> </actionGroup> <uncheckOption selector="{{ProductInWebsitesSection.website('Main Website')}}" stepKey="uncheckWebsite1"/> - <actionGroup ref="saveProductForm" stepKey="saveProduct2"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct2"/> <!-- Set filter to product name and product12 assigned to both websites 1 and 2 --> <actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForProduct12"> @@ -85,7 +85,7 @@ <actionGroup ref="SelectProductInWebsitesActionGroup" stepKey="selectProductInWebsites1"> <argument name="website" value="{{secondCustomWebsite.name}}"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProduct3"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct3"/> </before> <after> <actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite"> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminGridPageNumberAfterSaveAndCloseActionTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminGridPageNumberAfterSaveAndCloseActionTest.xml index eb4a561760070..9c0fbbb78451d 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminGridPageNumberAfterSaveAndCloseActionTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminGridPageNumberAfterSaveAndCloseActionTest.xml @@ -25,8 +25,8 @@ <comment userInput="Clear product grid" stepKey="commentClearProductGrid"/> <amOnPage url="{{ProductCatalogPage.url}}" stepKey="goToProductCatalog"/> <waitForPageLoad stepKey="waitForProductIndexPage"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGridToDefaultView"/> - <actionGroup ref="deleteProductsIfTheyExist" stepKey="deleteProductIfTheyExist"/> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGridToDefaultView"/> + <actionGroup ref="DeleteProductsIfTheyExistActionGroup" stepKey="deleteProductIfTheyExist"/> <createData stepKey="category1" entity="SimpleSubCategory"/> <createData stepKey="product1" entity="SimpleProduct"> <requiredEntity createDataKey="category1"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminImportCustomizableOptionToProductWithSKUTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminImportCustomizableOptionToProductWithSKUTest.xml index dfadfdf00481b..3cc21920d239c 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminImportCustomizableOptionToProductWithSKUTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminImportCustomizableOptionToProductWithSKUTest.xml @@ -42,7 +42,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createFirstProduct" stepKey="deleteFirstProduct"/> <!--Delete second product with changed sku--> - <actionGroup ref="deleteProductBySku" stepKey="deleteSecondProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteSecondProduct"> <argument name="sku" value="$$createFirstProduct.sku$$-1"/> </actionGroup> <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearProductGridFilter"/> @@ -54,19 +54,19 @@ <fillField selector="{{AdminProductFormSection.productSku}}" userInput="$$createFirstProduct.sku$$" stepKey="fillProductSku1"/> <!--Import customizable options and check--> <conditionalClick selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" visible="false" stepKey="openCustomOptionSection"/> - <actionGroup ref="importProductCustomizableOptions" stepKey="importOptions"> + <actionGroup ref="ImportProductCustomizableOptionsActionGroup" stepKey="importOptions"> <argument name="productName" value="$$createFirstProduct.name$$"/> </actionGroup> - <actionGroup ref="checkCustomizableOptionImport" stepKey="checkFirstOptionImport"> + <actionGroup ref="CheckCustomizableOptionImportActionGroup" stepKey="checkFirstOptionImport"> <argument name="option" value="ProductOptionField"/> <argument name="optionIndex" value="0"/> </actionGroup> - <actionGroup ref="checkCustomizableOptionImport" stepKey="checkSecondOptionImport"> + <actionGroup ref="CheckCustomizableOptionImportActionGroup" stepKey="checkSecondOptionImport"> <argument name="option" value="ProductOptionField2"/> <argument name="optionIndex" value="1"/> </actionGroup> <!--Save product and check sku changed message--> - <actionGroup ref="saveProductForm" stepKey="saveSecondProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveSecondProduct"/> <see selector="{{AdminMessagesSection.notice}}" userInput="SKU for product $$createSecondProduct.name$$ has been changed to $$createFirstProduct.sku$$-1." stepKey="seeSkuChangedMessage"/> </test> </tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassChangeProductsStatusTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassChangeProductsStatusTest.xml index 8d5121cf21461..6896b11196cf2 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassChangeProductsStatusTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassChangeProductsStatusTest.xml @@ -39,10 +39,10 @@ <!-- Search and select products --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPageLoad"/> - <actionGroup ref="searchProductGridByKeyword2" stepKey="searchByKeyword"> + <actionGroup ref="SearchProductGridByKeyword2ActionGroup" stepKey="searchByKeyword"> <argument name="keyword" value="api-simple-product"/> </actionGroup> - <actionGroup ref="sortProductsByIdDescending" stepKey="sortProductsByIdDescending"/> + <actionGroup ref="SortProductsByIdDescendingActionGroup" stepKey="sortProductsByIdDescending"/> <click selector="{{AdminProductGridSection.productGridCheckboxOnRow('1')}}" stepKey="clickCheckbox1"/> <click selector="{{AdminProductGridSection.productGridCheckboxOnRow('2')}}" stepKey="clickCheckbox2"/> <!-- Mass change status --> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml index f5ad5b8079d1f..e98b145f01401 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml @@ -34,12 +34,12 @@ <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> <!--Search products using keyword --> - <actionGroup ref="searchProductGridByKeyword2" stepKey="searchByKeyword"> + <actionGroup ref="SearchProductGridByKeyword2ActionGroup" stepKey="searchByKeyword"> <argument name="keyword" value="Testp"/> </actionGroup> <!--Sort Products by ID in descending order--> - <actionGroup ref="sortProductsByIdDescending" stepKey="sortProductsByIdDescending"/> + <actionGroup ref="SortProductsByIdDescendingActionGroup" stepKey="sortProductsByIdDescending"/> <!--Select products--> <checkOption selector="{{AdminProductGridSection.productRowCheckboxBySku($$simpleProduct1.sku$$)}}" stepKey="selectFirstProduct"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassUpdateProductAttributesGlobalScopeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassUpdateProductAttributesGlobalScopeTest.xml index 989431941b279..71873fe5b0960 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassUpdateProductAttributesGlobalScopeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassUpdateProductAttributesGlobalScopeTest.xml @@ -21,7 +21,7 @@ </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - <actionGroup ref="deleteAllProductsUsingProductGrid" stepKey="deleteAllProducts"/> + <actionGroup ref="DeleteAllProductsUsingProductGridActionGroup" stepKey="deleteAllProducts"/> <actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createStoreView" /> <createData entity="_defaultCategory" stepKey="createCategory"/> <createData entity="ApiSimpleProduct" stepKey="createProductOne"> @@ -44,10 +44,10 @@ <!-- Search and select products --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPageLoad"/> - <actionGroup ref="searchProductGridByKeyword2" stepKey="searchByKeyword"> + <actionGroup ref="SearchProductGridByKeyword2ActionGroup" stepKey="searchByKeyword"> <argument name="keyword" value="api-simple-product"/> </actionGroup> - <actionGroup ref="sortProductsByIdDescending" stepKey="sortProductsByIdDescending"/> + <actionGroup ref="SortProductsByIdDescendingActionGroup" stepKey="sortProductsByIdDescending"/> <click selector="{{AdminProductGridSection.productGridCheckboxOnRow('1')}}" stepKey="clickCheckbox1"/> <click selector="{{AdminProductGridSection.productGridCheckboxOnRow('2')}}" stepKey="clickCheckbox2"/> <!-- Mass update attributes --> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassUpdateProductAttributesMissingRequiredFieldTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassUpdateProductAttributesMissingRequiredFieldTest.xml index fe0e46369c5e6..a4c8f5e8cff6c 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassUpdateProductAttributesMissingRequiredFieldTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassUpdateProductAttributesMissingRequiredFieldTest.xml @@ -39,7 +39,7 @@ <!-- Search and select products --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPageLoad"/> - <actionGroup ref="searchProductGridByKeyword2" stepKey="searchByKeyword"> + <actionGroup ref="SearchProductGridByKeyword2ActionGroup" stepKey="searchByKeyword"> <argument name="keyword" value="api-simple-product"/> </actionGroup> <click selector="{{AdminProductGridSection.productGridCheckboxOnRow('1')}}" stepKey="clickCheckbox1"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassUpdateProductAttributesStoreViewScopeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassUpdateProductAttributesStoreViewScopeTest.xml index 18d4b9e341cc6..c9840fe455f84 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassUpdateProductAttributesStoreViewScopeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassUpdateProductAttributesStoreViewScopeTest.xml @@ -38,10 +38,10 @@ <!-- Search and select products --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPageLoad"/> - <actionGroup ref="searchProductGridByKeyword2" stepKey="searchByKeyword"> + <actionGroup ref="SearchProductGridByKeyword2ActionGroup" stepKey="searchByKeyword"> <argument name="keyword" value="api-simple-product"/> </actionGroup> - <actionGroup ref="sortProductsByIdDescending" stepKey="sortProductsByIdDescending"/> + <actionGroup ref="SortProductsByIdDescendingActionGroup" stepKey="sortProductsByIdDescending"/> <click selector="{{AdminProductGridSection.productGridCheckboxOnRow('1')}}" stepKey="clickCheckbox1"/> <click selector="{{AdminProductGridSection.productGridCheckboxOnRow('2')}}" stepKey="clickCheckbox2"/> <!-- Mass update attributes --> @@ -114,10 +114,10 @@ <!-- Search and select products --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPageLoad"/> - <actionGroup ref="searchProductGridByKeyword2" stepKey="searchByKeyword"> + <actionGroup ref="SearchProductGridByKeyword2ActionGroup" stepKey="searchByKeyword"> <argument name="keyword" value="api-simple-product"/> </actionGroup> - <actionGroup ref="sortProductsByIdDescending" stepKey="sortProductsByIdDescending"/> + <actionGroup ref="SortProductsByIdDescendingActionGroup" stepKey="sortProductsByIdDescending"/> <click selector="{{AdminProductGridSection.productGridCheckboxOnRow('1')}}" stepKey="clickCheckbox1"/> <click selector="{{AdminProductGridSection.productGridCheckboxOnRow('2')}}" stepKey="clickCheckbox2"/> <!-- Mass update attributes --> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassUpdateProductStatusStoreViewScopeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassUpdateProductStatusStoreViewScopeTest.xml index 02e8157282dee..21c6c56adfd96 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassUpdateProductStatusStoreViewScopeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassUpdateProductStatusStoreViewScopeTest.xml @@ -55,13 +55,13 @@ <see userInput="You saved the store view." stepKey="seeSavedMessage" /> <!--Create a Simple Product 1 --> - <actionGroup ref="createSimpleProductAndAddToWebsite" stepKey="createSimpleProduct1"> + <actionGroup ref="CreateSimpleProductAndAddToWebsiteActionGroup" stepKey="createSimpleProduct1"> <argument name="product" value="simpleProductForMassUpdate"/> <argument name="website" value="Second Website"/> </actionGroup> <!--Create a Simple Product 2 --> - <actionGroup ref="createSimpleProductAndAddToWebsite" stepKey="createSimpleProduct2"> + <actionGroup ref="CreateSimpleProductAndAddToWebsiteActionGroup" stepKey="createSimpleProduct2"> <argument name="product" value="simpleProductForMassUpdate2"/> <argument name="website" value="Second Website"/> </actionGroup> @@ -86,10 +86,10 @@ <!-- Search and select products --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPageLoad"/> - <actionGroup ref="searchProductGridByKeyword2" stepKey="searchByKeyword"> + <actionGroup ref="SearchProductGridByKeyword2ActionGroup" stepKey="searchByKeyword"> <argument name="keyword" value="{{simpleProductForMassUpdate.keyword}}"/> </actionGroup> - <actionGroup ref="sortProductsByIdDescending" stepKey="sortProductsByIdDescending"/> + <actionGroup ref="SortProductsByIdDescendingActionGroup" stepKey="sortProductsByIdDescending"/> <!-- Filter to Second Store View --> <actionGroup ref="AdminFilterStoreViewActionGroup" stepKey="filterStoreView" > @@ -205,13 +205,13 @@ <see userInput="You saved the store view." stepKey="seeSavedMessage" /> <!--Create a Simple Product 1 --> - <actionGroup ref="createSimpleProductAndAddToWebsite" stepKey="createSimpleProduct1"> + <actionGroup ref="CreateSimpleProductAndAddToWebsiteActionGroup" stepKey="createSimpleProduct1"> <argument name="product" value="simpleProductForMassUpdate"/> <argument name="website" value="Second Website"/> </actionGroup> <!--Create a Simple Product 2 --> - <actionGroup ref="createSimpleProductAndAddToWebsite" stepKey="createSimpleProduct2"> + <actionGroup ref="CreateSimpleProductAndAddToWebsiteActionGroup" stepKey="createSimpleProduct2"> <argument name="product" value="simpleProductForMassUpdate2"/> <argument name="website" value="Second Website"/> </actionGroup> @@ -236,10 +236,10 @@ <!-- Search and select products --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPageLoad"/> - <actionGroup ref="searchProductGridByKeyword2" stepKey="searchByKeyword"> + <actionGroup ref="SearchProductGridByKeyword2ActionGroup" stepKey="searchByKeyword"> <argument name="keyword" value="{{simpleProductForMassUpdate.keyword}}"/> </actionGroup> - <actionGroup ref="sortProductsByIdDescending" stepKey="sortProductsByIdDescending"/> + <actionGroup ref="SortProductsByIdDescendingActionGroup" stepKey="sortProductsByIdDescending"/> <!-- Filter to Second Store View --> <actionGroup ref="AdminFilterStoreViewActionGroup" stepKey="filterStoreView" > @@ -299,4 +299,4 @@ <actionGroup ref="StorefrontCheckAdvancedSearchResultActionGroup" stepKey="StorefrontCheckAdvancedSearchResultDefault2"/> <see userInput="We can't find any items matching these search criteria." selector="{{StorefrontCatalogSearchAdvancedResultMainSection.message}}" stepKey="seeInDefault2"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryFromParentAnchoredCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryFromParentAnchoredCategoryTest.xml index b613068893b0e..271d78ab9cdb0 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryFromParentAnchoredCategoryTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryFromParentAnchoredCategoryTest.xml @@ -25,7 +25,7 @@ <after> <deleteData createDataKey="simpleProduct" stepKey="deleteSimpleProduct"/> <deleteData createDataKey="createDefaultCategory" stepKey="deleteDefaultCategory"/> - <actionGroup ref="DeleteCategory" stepKey="deleteCategory"> + <actionGroup ref="DeleteCategoryActionGroup" stepKey="deleteCategory"> <argument name="categoryEntity" value="SimpleSubCategory"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryToAnotherPositionInCategoryTreeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryToAnotherPositionInCategoryTreeTest.xml index 9831f73e07877..6c403fc7714eb 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryToAnotherPositionInCategoryTreeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryToAnotherPositionInCategoryTreeTest.xml @@ -25,7 +25,7 @@ </before> <after> <deleteData createDataKey="createDefaultCategory" stepKey="deleteDefaultCategory"/> - <actionGroup ref="DeleteCategory" stepKey="SecondLevelSubCat"> + <actionGroup ref="DeleteCategoryActionGroup" stepKey="SecondLevelSubCat"> <argument name="categoryEntity" value="SecondLevelSubCat"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveProductBetweenCategoriesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveProductBetweenCategoriesTest.xml index da985fc2ce34d..7e6e79cd08c26 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveProductBetweenCategoriesTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveProductBetweenCategoriesTest.xml @@ -94,7 +94,7 @@ <waitForPageLoad stepKey="waitForProductPage"/> <!-- Click on <product1>: Product page opens--> - <actionGroup ref="filterProductGridByName" stepKey="filterProduct"> + <actionGroup ref="FilterProductGridByNameActionGroup" stepKey="filterProduct"> <argument name="product" value="$$simpleProduct$$"/> </actionGroup> <click selector="{{AdminProductGridSection.productGridNameProduct($$simpleProduct.name$$)}}" stepKey="clickProduct1"/> @@ -159,16 +159,16 @@ <see userInput="$$createAnchoredCategory1.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeCategory1Name"/> <see userInput="We can't find products matching the selection." stepKey="seeEmptyNotice"/> <dontSee userInput="$$simpleProduct.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="dontseeProduct"/> - + <!-- Log in to the backend: Admin user is logged in--> <actionGroup ref="LoginAsAdmin" stepKey="LoginAdmin"/> - + <!-- Navigate to the Catalog > Products: Navigate to the Catalog>Products --> <amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="amOnProductPage"/> <waitForPageLoad stepKey="waitForProductsPage"/> <!-- Click on <product1> --> - <actionGroup ref="filterAndSelectProduct" stepKey="openSimpleProduct"> + <actionGroup ref="FilterAndSelectProductActionGroup" stepKey="openSimpleProduct"> <argument name="productSku" value="$$simpleProduct.sku$$"/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminNavigateMultipleUpSellProductsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminNavigateMultipleUpSellProductsTest.xml index bcd4ca8531203..5dd8b2e430941 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminNavigateMultipleUpSellProductsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminNavigateMultipleUpSellProductsTest.xml @@ -97,7 +97,7 @@ <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> <!--Select SimpleProduct --> - <actionGroup ref="filterProductGridBySku" stepKey="findCreatedProduct"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="findCreatedProduct"> <argument name="product" value="$$createSimpleProduct$$"/> </actionGroup> <click stepKey="openFirstProduct" selector="{{AdminProductGridSection.productRowBySku($$createSimpleProduct.sku$$)}}"/> @@ -106,7 +106,7 @@ <!--Add SimpleProduct1 and ConfigProduct as Up sell products--> <click stepKey="clickOnRelatedProducts" selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedProductsHeader}}"/> <click stepKey="clickOnAddUpSellProducts" selector="{{AdminProductFormRelatedUpSellCrossSellSection.addUpSellProduct}}"/> - <actionGroup ref="filterProductGridBySku2" stepKey="filterProduct"> + <actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterProduct"> <argument name="sku" value="$$createSimpleProduct1.sku$$"/> </actionGroup> <waitForPageLoad stepKey="waitForTheProductToLoad"/> @@ -114,7 +114,7 @@ <click stepKey="addSelectedProduct" selector="{{AdminAddRelatedProductsModalSection.AddUpSellProductsButton}}"/> <waitForPageLoad stepKey="waitForProductToBeAdded"/> <click stepKey="clickOnAddUpSellProductsButton" selector="{{AdminProductFormRelatedUpSellCrossSellSection.addUpSellProduct}}"/> - <actionGroup ref="filterProductGridBySku2" stepKey="filterConfigurableProduct"> + <actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterConfigurableProduct"> <argument name="sku" value="$$createConfigProduct.sku$$"/> </actionGroup> <waitForPageLoad stepKey="waitForTheConfigProductToLoad"/> @@ -131,7 +131,7 @@ <waitForPageLoad stepKey="waitForProductsToBeLoaded"/> <!--Select Configurable Product--> - <actionGroup ref="filterProductGridBySku" stepKey="findConfigProduct"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="findConfigProduct"> <argument name="product" value="$$createConfigProduct$$"/> </actionGroup> <click stepKey="openConfigProduct" selector="{{AdminProductGridSection.productRowBySku($$createConfigProduct.sku$$)}}"/> @@ -140,7 +140,7 @@ <!--Add SimpleProduct1 as Up Sell Product--> <click stepKey="clickOnRelatedProductsHeader" selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedProductsHeader}}"/> <click stepKey="clickOnAddUpSellProductsButton1" selector="{{AdminProductFormRelatedUpSellCrossSellSection.addUpSellProduct}}"/> - <actionGroup ref="filterProductGridBySku2" stepKey="filterSimpleProduct2"> + <actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterSimpleProduct2"> <argument name="sku" value="$$createSimpleProduct1.sku$$"/> </actionGroup> <waitForPageLoad stepKey="waitForTheSimpleProduct2ToBeLoaded"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductCategoryIndexerInUpdateOnScheduleModeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductCategoryIndexerInUpdateOnScheduleModeTest.xml index 41d3ca3020c98..2283a0e4d6158 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductCategoryIndexerInUpdateOnScheduleModeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductCategoryIndexerInUpdateOnScheduleModeTest.xml @@ -148,7 +148,7 @@ <waitForPageLoad stepKey="waitForProductC1PageLoad"/> <click selector="{{AdminProductFormSection.enableProductLabel}}" stepKey="clickOffEnableToggleAgain"/> <!-- Saved successfully --> - <actionGroup ref="saveProductForm" stepKey="saveProductC1"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductC1"/> <!-- 12. Open category B on Storefront --> <actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="toCategoryBStorefront"> @@ -205,7 +205,7 @@ <click selector="{{AdminProductFormSection.enableProductLabel}}" stepKey="clickOnEnableToggleAgain"/> <!-- Saved successfully --> - <actionGroup ref="saveProductForm" stepKey="saveChangedProductC1"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveChangedProductC1"/> <!-- 17.12. Open category B on Storefront --> <actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="openCategoryB"> @@ -264,7 +264,7 @@ stepKey="changeVisibility"/> <!-- Saved successfully --> - <actionGroup ref="saveProductForm" stepKey="productC1Saved"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="productC1Saved"/> <!-- 18.12. Open category B on Storefront --> <actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="goPageCategoryB"> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductCustomURLKeyPreservedWhenAssignedToCategoryWithoutCustomURLKey.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductCustomURLKeyPreservedWhenAssignedToCategoryWithoutCustomURLKey.xml index bae81513de632..df09768139533 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductCustomURLKeyPreservedWhenAssignedToCategoryWithoutCustomURLKey.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductCustomURLKeyPreservedWhenAssignedToCategoryWithoutCustomURLKey.xml @@ -61,20 +61,20 @@ <conditionalClick selector="{{AdminProductSEOSection.sectionHeader}}" dependentSelector="{{AdminProductSEOSection.urlKeyInput}}" visible="false" stepKey="openSeoSection"/> <uncheckOption selector="{{AdminProductSEOSection.useDefaultUrl}}" stepKey="uncheckUseDefaultUrlKey"/> <fillField userInput="U2" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> - <actionGroup ref="goToAdminCategoryPageById" stepKey="openCategory"> + <actionGroup ref="GoToAdminCategoryPageByIdActionGroup" stepKey="openCategory"> <argument name="id" value="$createCategory.id$"/> </actionGroup> - <actionGroup ref="AdminCategoryAssignProduct" stepKey="assignSimpleProductFirst"> + <actionGroup ref="AdminCategoryAssignProductActionGroup" stepKey="assignSimpleProductFirst"> <argument name="productSku" value="$createSimpleProductFirst.sku$"/> </actionGroup> - <actionGroup ref="AdminCategoryAssignProduct" stepKey="assignSimpleProductSecond"> + <actionGroup ref="AdminCategoryAssignProductActionGroup" stepKey="assignSimpleProductSecond"> <argument name="productSku" value="$createSimpleProductSecond.sku$"/> </actionGroup> - <actionGroup ref="saveCategoryForm" stepKey="saveCategory"/> + <actionGroup ref="SaveCategoryFormActionGroup" stepKey="saveCategory"/> <executeJS function="return '$createCategory.name$'.toLowerCase();" stepKey="categoryNameLower" /> <executeJS function="return '$createSimpleProductFirst.name$'.toLowerCase();" stepKey="simpleProductFirstNameLower" /> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridFilteringByCustomAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridFilteringByCustomAttributeTest.xml index 72c270aad585c..f4f86f3a65a12 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridFilteringByCustomAttributeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridFilteringByCustomAttributeTest.xml @@ -22,7 +22,7 @@ <before> <!--Login as admin and delete all products --> <actionGroup ref="LoginAsAdmin" stepKey="login"/> - <actionGroup ref="deleteAllProductsUsingProductGrid" stepKey="deleteAllProducts"/> + <actionGroup ref="DeleteAllProductsUsingProductGridActionGroup" stepKey="deleteAllProducts"/> <!--Create dropdown product attribute--> <createData entity="productDropDownAttribute" stepKey="createDropdownAttribute"/> <!--Create attribute options--> @@ -59,7 +59,7 @@ <argument name="product" value="$$createFirstProduct$$"/> </actionGroup> <selectOption selector="{{AdminProductFormSection.customSelectField($$createDropdownAttribute.attribute[attribute_code]$$)}}" userInput="$$createFirstProductAttributeOption.option[store_labels][0][label]$$" stepKey="setFirstAttributeValue"/> - <actionGroup ref="saveProductForm" stepKey="saveFirstProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveFirstProduct"/> <!--Update second product--> <actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForSecondProduct"> <argument name="product" value="$$createSecondProduct$$"/> @@ -68,7 +68,7 @@ <argument name="product" value="$$createSecondProduct$$"/> </actionGroup> <selectOption selector="{{AdminProductFormSection.customSelectField($$createDropdownAttribute.attribute[attribute_code]$$)}}" userInput="$$createSecondProductAttributeOption.option[store_labels][0][label]$$" stepKey="setSecondAttributeValue"/> - <actionGroup ref="saveProductForm" stepKey="saveSecondProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveSecondProduct"/> <!--Update third product--> <actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForThirdProduct"> <argument name="product" value="$$createThirdProduct$$"/> @@ -77,7 +77,7 @@ <argument name="product" value="$$createThirdProduct$$"/> </actionGroup> <selectOption selector="{{AdminProductFormSection.customSelectField($$createDropdownAttribute.attribute[attribute_code]$$)}}" userInput="$$createThirdProductAttributeOption.option[store_labels][0][label]$$" stepKey="setThirdAttributeValue"/> - <actionGroup ref="saveProductForm" stepKey="saveThirdProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveThirdProduct"/> </before> <after> <!--Delete products--> @@ -88,7 +88,7 @@ <deleteData createDataKey="createDropdownAttribute" stepKey="deleteDropdownAttribute"/> <!--Delete category--> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="NavigateToAndResetProductGridToDefaultView" stepKey="NavigateToAndResetProductGridToDefaultViewAfterTest"/> + <actionGroup ref="NavigateToAndResetProductGridToDefaultViewActionGroup" stepKey="NavigateToAndResetProductGridToDefaultViewAfterTest"/> <actionGroup ref="logout" stepKey="logout"/> </after> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridFilteringByDateAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridFilteringByDateAttributeTest.xml index 2884cb26cf813..df2b525a56086 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridFilteringByDateAttributeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridFilteringByDateAttributeTest.xml @@ -45,7 +45,7 @@ <click selector="{{AdminProductGridFilterSection.columnsDropdown}}" stepKey="closeColumnsDropdown1"/> <seeElement selector="{{AdminProductGridSection.columnHeader('Set Product as New from Date')}}" stepKey="seeNewFromDateColumn"/> <waitForPageLoad stepKey="waitforFiltersToApply"/> - <actionGroup ref="filterProductGridBySetNewFromDate" stepKey="filterProductGridToCheckSetAsNewColumn"/> + <actionGroup ref="FilterProductGridBySetNewFromDateActionGroup" stepKey="filterProductGridToCheckSetAsNewColumn"/> <click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnFirstRowProductGrid"/> <waitForPageLoad stepKey="waitForProductEditPageToLoad"/> <actionGroup ref="AdminFormSaveAndClose" stepKey="saveAndCloseProductForm"/> @@ -57,4 +57,4 @@ <click selector="{{AdminProductGridFilterSection.columnsDropdown}}" stepKey="closeColumnsDropdown2"/> <click selector="{{AdminProductGridFilterSection.clearAll}}" stepKey="clearGridFilters"/> </test> - </tests> \ No newline at end of file + </tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductImageAssignmentForMultipleStoresTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductImageAssignmentForMultipleStoresTest.xml index 8149bc34087fb..44829f0c06b84 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductImageAssignmentForMultipleStoresTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductImageAssignmentForMultipleStoresTest.xml @@ -73,8 +73,8 @@ </actionGroup> <!-- Upload Image English --> - <actionGroup ref="addProductImage" stepKey="uploadImageEnglish"/> - <actionGroup ref="saveProductForm" stepKey="saveProduct1"/> + <actionGroup ref="AddProductImageActionGroup" stepKey="uploadImageEnglish"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct1"/> <!-- Switch to the French store view --> <actionGroup ref="AdminSwitchStoreViewActionGroup" stepKey="switchStoreViewFrenchProduct"> @@ -82,19 +82,19 @@ </actionGroup> <!-- Upload Image French --> - <actionGroup ref="addProductImage" stepKey="uploadImageFrench"> + <actionGroup ref="AddProductImageActionGroup" stepKey="uploadImageFrench"> <argument name="image" value="Magento3"/> </actionGroup> <actionGroup ref="AdminAssignImageRolesActionGroup" stepKey="assignImageRole1"> <argument name="image" value="Magento3"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProduct2"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct2"/> <!-- Switch to the All store view --> <actionGroup ref="AdminSwitchToAllStoreViewActionGroup" stepKey="switchAllStoreViewProduct"/> <!-- Upload Image All Store View --> - <actionGroup ref="addProductImage" stepKey="uploadImageAllStoreView"> + <actionGroup ref="AddProductImageActionGroup" stepKey="uploadImageAllStoreView"> <argument name="image" value="TestImageNew"/> </actionGroup> <actionGroup ref="AdminAssignImageRolesActionGroup" stepKey="assignImageRole"> @@ -105,7 +105,7 @@ <click selector="{{AdminProductContentSection.sectionHeader}}" stepKey="openDescriptionDropDown"/> <fillField selector="{{AdminProductContentSection.descriptionTextArea}}" userInput="This is the long description" stepKey="fillLongDescription"/> <fillField selector="{{AdminProductContentSection.shortDescriptionTextArea}}" userInput="This is the short description" stepKey="fillShortDescription"/> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!-- Go to Product Page and see Default Store View--> <amOnPage url="{{StorefrontProductPage.url($$createSimpleProduct.custom_attributes[url_key]$$)}}" stepKey="goToDefaultStorefrontProductPage"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml index de065d2d930cb..40880291330e7 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml @@ -45,11 +45,11 @@ <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="addDownloadableProductLink"> <argument name="link" value="downloadableLinkWithMaxDownloads"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveDownloadableProductForm"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveDownloadableProductForm"/> <!--Assert downloadable product on Admin product page grid--> <comment userInput="Assert configurable product in Admin product page grid" stepKey="commentAssertDownloadableProductOnAdmin"/> <amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="goToCatalogProductPage"/> - <actionGroup ref="filterProductGridBySku2" stepKey="filterProductGridBySku"> + <actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterProductGridBySku"> <argument name="sku" value="$$createProduct.sku$$"/> </actionGroup> <see selector="{{AdminProductGridSection.productGridCell('1', 'Name')}}" userInput="$$createProduct.name$$" stepKey="seeDownloadableProductNameInGrid"/> @@ -80,11 +80,11 @@ <waitForPageLoad stepKey="waitForProductPageLoad"/> <actionGroup ref="AdminAddDownloadableLinkInformationActionGroup" stepKey="addDownloadableLinkInformation"/> <selectOption selector="{{AdminProductFormSection.productWeightSelect}}" userInput="This item has weight" stepKey="selectWeightForProduct"/> - <actionGroup ref="saveProductForm" stepKey="saveProductForm"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductForm"/> <!--Assert simple product on Admin product page grid--> <comment userInput="Assert simple product in Admin product page grid" stepKey="commentAssertProductOnAdmin"/> <amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="goToCatalogSimpleProductPage"/> - <actionGroup ref="filterProductGridBySku2" stepKey="filterSimpleProductGridBySku"> + <actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterSimpleProductGridBySku"> <argument name="sku" value="$$createProduct.sku$$"/> </actionGroup> <see selector="{{AdminProductGridSection.productGridCell('1', 'Name')}}" userInput="$$createProduct.name$$" stepKey="seeSimpleProductNameInGrid"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveCustomOptionsFromProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveCustomOptionsFromProductTest.xml index b5f212d1144be..71c1ccd4de9b5 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveCustomOptionsFromProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveCustomOptionsFromProductTest.xml @@ -34,59 +34,59 @@ <!-- Edit Simple Product --> <amOnPage url="{{AdminProductEditPage.url($$createProduct.id$$)}}" stepKey="goToProduct"/> <!-- See 3 options are present --> - <actionGroup ref="AdminAssertProductCustomOptionVisible" stepKey="assertCustomOptionsField"> + <actionGroup ref="AdminAssertProductCustomOptionVisibleActionGroup" stepKey="assertCustomOptionsField"> <argument name="option" value="ProductOptionField"/> </actionGroup> - <actionGroup ref="AdminAssertProductCustomOptionVisible" stepKey="assertCustomOptionsArea"> + <actionGroup ref="AdminAssertProductCustomOptionVisibleActionGroup" stepKey="assertCustomOptionsArea"> <argument name="option" value="ProductOptionArea"/> </actionGroup> - <actionGroup ref="AdminAssertProductCustomOptionVisible" stepKey="assertCustomOptionsFile"> + <actionGroup ref="AdminAssertProductCustomOptionVisibleActionGroup" stepKey="assertCustomOptionsFile"> <argument name="option" value="ProductOptionFile"/> </actionGroup> <!-- Click delete "Area" and "File" options --> - <actionGroup ref="AdminDeleteProductCustomOption" stepKey="deleteCustomOptionArea"> + <actionGroup ref="AdminDeleteProductCustomOptionActionGroup" stepKey="deleteCustomOptionArea"> <argument name="option" value="ProductOptionArea"/> </actionGroup> - <actionGroup ref="AdminDeleteProductCustomOption" stepKey="deleteCustomOptionFile"> + <actionGroup ref="AdminDeleteProductCustomOptionActionGroup" stepKey="deleteCustomOptionFile"> <argument name="option" value="ProductOptionFile"/> </actionGroup> - <actionGroup ref="AdminAssertProductCustomOptionVisible" stepKey="assertVisibleCustomOptionField"> + <actionGroup ref="AdminAssertProductCustomOptionVisibleActionGroup" stepKey="assertVisibleCustomOptionField"> <argument name="option" value="ProductOptionField"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!-- See only "Field option" left Also we shouldn't see any other options --> - <actionGroup ref="AdminAssertProductCustomOptionVisible" stepKey="assertVisibleSecondCustomOptionField"> + <actionGroup ref="AdminAssertProductCustomOptionVisibleActionGroup" stepKey="assertVisibleSecondCustomOptionField"> <argument name="option" value="ProductOptionField"/> </actionGroup> - <actionGroup ref="AdminAssertProductHasNoCustomOption" stepKey="assertNoCustomOptionsFile"> + <actionGroup ref="AdminAssertProductHasNoCustomOptionActionGroup" stepKey="assertNoCustomOptionsFile"> <argument name="option" value="ProductOptionFileSecond"/> </actionGroup> - <actionGroup ref="AdminAssertProductHasNoCustomOption" stepKey="assertNoCustomOptionsField"> + <actionGroup ref="AdminAssertProductHasNoCustomOptionActionGroup" stepKey="assertNoCustomOptionsField"> <argument name="option" value="ProductOptionFieldSecond"/> </actionGroup> <!-- Click Add option "File" --> - <actionGroup ref="AddProductCustomOptionFile" stepKey="createAddOptionFile"> + <actionGroup ref="AddProductCustomOptionFileActionGroup" stepKey="createAddOptionFile"> <argument name="option" value="ProductOptionFileSecond"/> </actionGroup> <!-- Click Add option "Field" --> - <actionGroup ref="AddProductCustomOptionField" stepKey="createCustomOptionField"> + <actionGroup ref="AddProductCustomOptionFieldActionGroup" stepKey="createCustomOptionField"> <argument name="option" value="ProductOptionFieldSecond"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProductWithNewlyAddedOptions"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductWithNewlyAddedOptions"/> <!-- See 3 options are present --> - <actionGroup ref="AdminAssertProductCustomOptionVisible" stepKey="assertPresentCustomOptionField"> + <actionGroup ref="AdminAssertProductCustomOptionVisibleActionGroup" stepKey="assertPresentCustomOptionField"> <argument name="option" value="ProductOptionField"/> </actionGroup> - <actionGroup ref="AdminAssertProductCustomOptionVisible" stepKey="assertPresenceOfFileOption"> + <actionGroup ref="AdminAssertProductCustomOptionVisibleActionGroup" stepKey="assertPresenceOfFileOption"> <argument name="option" value="ProductOptionFileSecond"/> </actionGroup> - <actionGroup ref="AdminAssertProductCustomOptionVisible" stepKey="assertPresenceOfFieldOption"> + <actionGroup ref="AdminAssertProductCustomOptionVisibleActionGroup" stepKey="assertPresenceOfFieldOption"> <argument name="option" value="ProductOptionFieldSecond"/> </actionGroup> <!-- Delete All options and See no more options present on the page --> - <actionGroup ref="AdminDeleteAllProductCustomOptions" stepKey="deleteAllCustomOptions"/> + <actionGroup ref="AdminDeleteAllProductCustomOptionsActionGroup" stepKey="deleteAllCustomOptions"/> <!-- Product successfully saved and it has no options --> - <actionGroup ref="saveProductForm" stepKey="saveProductWithoutCustomOptions"/> - <actionGroup ref="AdminAssertProductHasNoCustomOptions" stepKey="assertNoCustomOptions"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductWithoutCustomOptions"/> + <actionGroup ref="AdminAssertProductHasNoCustomOptionsActionGroup" stepKey="assertNoCustomOptions"/> </test> </tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveDefaultImageSimpleProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveDefaultImageSimpleProductTest.xml index 9760dc579b10b..3b750c2cdb21c 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveDefaultImageSimpleProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveDefaultImageSimpleProductTest.xml @@ -28,35 +28,35 @@ <!--Create product--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPage"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGridColumnsInitial"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateSimpleProduct"> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGridColumnsInitial"/> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateSimpleProduct"> <argument name="product" value="SimpleProduct3"/> </actionGroup> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillSimpleProductMain"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillSimpleProductMain"> <argument name="product" value="SimpleProduct3"/> </actionGroup> <!-- Add image to product --> - <actionGroup ref="addProductImage" stepKey="addImageForProductSimple"> + <actionGroup ref="AddProductImageActionGroup" stepKey="addImageForProductSimple"> <argument name="image" value="MagentoLogo"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveSimpleProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveSimpleProduct"/> <!-- Remove image from product --> - <actionGroup ref="removeProductImage" stepKey="removeProductImage"/> + <actionGroup ref="RemoveProductImageActionGroup" stepKey="removeProductImage"/> - <actionGroup ref="saveProductForm" stepKey="saveProductFormAfterRemove"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductFormAfterRemove"/> <!-- Assert product image not in admin product form --> - <actionGroup ref="assertProductImageNotInAdminProductPage" stepKey="assertProductImageNotInAdminProductPage"/> + <actionGroup ref="AssertProductImageNotInAdminProductPageActionGroup" stepKey="assertProductImageNotInAdminProductPage"/> <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPageAfterRemove"> + <actionGroup ref="AssertProductInStorefrontProductPageActionGroup" stepKey="AssertProductInStorefrontProductPageAfterRemove"> <argument name="product" value="SimpleProduct3"/> </actionGroup> <!-- Assert product image not in storefront product page --> - <actionGroup ref="assertProductImageNotInStorefrontProductPage" stepKey="assertProductImageNotInStorefrontProductPage"> + <actionGroup ref="AssertProductImageNotInStorefrontProductPageActionGroup" stepKey="assertProductImageNotInStorefrontProductPage"> <argument name="product" value="SimpleProduct3"/> </actionGroup> </test> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveDefaultImageVirtualProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveDefaultImageVirtualProductTest.xml index a740b700c3026..6a68928be8c70 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveDefaultImageVirtualProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveDefaultImageVirtualProductTest.xml @@ -28,35 +28,35 @@ <!--Create product--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPage"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGridColumnsInitial"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct"> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGridColumnsInitial"/> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct"> <argument name="product" value="defaultVirtualProduct"/> </actionGroup> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillProductMain"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillProductMain"> <argument name="product" value="defaultVirtualProduct"/> </actionGroup> <!-- Add image to product --> - <actionGroup ref="addProductImage" stepKey="addImageForProduct"> + <actionGroup ref="AddProductImageActionGroup" stepKey="addImageForProduct"> <argument name="image" value="MagentoLogo"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!-- Remove image from product --> - <actionGroup ref="removeProductImage" stepKey="removeProductImage"/> + <actionGroup ref="RemoveProductImageActionGroup" stepKey="removeProductImage"/> - <actionGroup ref="saveProductForm" stepKey="saveProductFormAfterRemove"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductFormAfterRemove"/> <!-- Assert product image not in admin product form --> - <actionGroup ref="assertProductImageNotInAdminProductPage" stepKey="assertProductImageNotInAdminProductPage"/> + <actionGroup ref="AssertProductImageNotInAdminProductPageActionGroup" stepKey="assertProductImageNotInAdminProductPage"/> <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPageAfterRemove"> + <actionGroup ref="AssertProductInStorefrontProductPageActionGroup" stepKey="AssertProductInStorefrontProductPageAfterRemove"> <argument name="product" value="defaultVirtualProduct"/> </actionGroup> <!-- Assert product image not in storefront product page --> - <actionGroup ref="assertProductImageNotInStorefrontProductPage" stepKey="assertProductImageNotInStorefrontProductPage"> + <actionGroup ref="AssertProductImageNotInStorefrontProductPageActionGroup" stepKey="assertProductImageNotInStorefrontProductPage"> <argument name="product" value="defaultVirtualProduct"/> </actionGroup> </test> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveDefaultVideoSimpleProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveDefaultVideoSimpleProductTest.xml index 876eedb9347c7..8c80a2bf9a851 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveDefaultVideoSimpleProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveDefaultVideoSimpleProductTest.xml @@ -30,21 +30,21 @@ <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="adminProductIndexPageAdd"/> <waitForPageLoad stepKey="waitForProductIndexPageLoad"/> <actionGroup ref="EnableAdminAccountSharingActionGroup" stepKey="enableAdminAccountSharing"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProductPage"> <argument name="product" value="ApiSimpleProduct"/> </actionGroup> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillMainProductForm"> <argument name="product" value="ApiSimpleProduct"/> </actionGroup> <!-- Save product --> - <actionGroup ref="saveProductForm" stepKey="saveProductForm"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductForm"/> <!-- Save product --> - <actionGroup ref="saveProductForm" stepKey="saveProductFormAfterRemove"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductFormAfterRemove"/> <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> + <actionGroup ref="AssertProductInStorefrontProductPageActionGroup" stepKey="AssertProductInStorefrontProductPage"> <argument name="product" value="ApiSimpleProduct"/> </actionGroup> </test> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveDefaultVideoVirtualProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveDefaultVideoVirtualProductTest.xml index 8b3b38d0ece31..8d89e0d9b535b 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveDefaultVideoVirtualProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveDefaultVideoVirtualProductTest.xml @@ -21,13 +21,13 @@ <!-- Replacing steps in base AdminRemoveDefaultVideoSimpleProductTest --> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProductPage"> <argument name="product" value="defaultVirtualProduct"/> </actionGroup> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillMainProductForm"> <argument name="product" value="defaultVirtualProduct"/> </actionGroup> - <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> + <actionGroup ref="AssertProductInStorefrontProductPageActionGroup" stepKey="AssertProductInStorefrontProductPage"> <argument name="product" value="defaultVirtualProduct"/> </actionGroup> </test> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveImageAffectsAllScopesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveImageAffectsAllScopesTest.xml index 8316f54c15a52..a4887d5b29796 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveImageAffectsAllScopesTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveImageAffectsAllScopesTest.xml @@ -73,26 +73,26 @@ <!--Create product--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPage"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGridColumnsInitial"/> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGridColumnsInitial"/> <!--Open created product--> <click selector="{{AdminProductGridSection.productGridNameProduct($$product.name$$)}}" stepKey="createdProduct"/> <waitForPageLoad stepKey="waitForOpenedCreatedProduct"/> <!-- Add image to product --> - <actionGroup ref="addProductImage" stepKey="addFirstImageForProduct"> + <actionGroup ref="AddProductImageActionGroup" stepKey="addFirstImageForProduct"> <argument name="image" value="TestImageNew"/> </actionGroup> <!-- Add second image to product --> - <actionGroup ref="addProductImage" stepKey="addSecondImageForProduct"> + <actionGroup ref="AddProductImageActionGroup" stepKey="addSecondImageForProduct"> <argument name="image" value="MagentoLogo"/> </actionGroup> <!--"Product in Websites": select both Websites--> - <actionGroup ref="ProductSetWebsite" stepKey="ProductSetWebsite1"> + <actionGroup ref="ProductSetWebsiteActionGroup" stepKey="ProductSetWebsite1"> <argument name="website" value="FirstWebSite"/> </actionGroup> - <actionGroup ref="ProductSetWebsite" stepKey="ProductSetWebsite2"> + <actionGroup ref="ProductSetWebsiteActionGroup" stepKey="ProductSetWebsite2"> <argument name="website" value="SecondWebSite"/> </actionGroup> @@ -103,28 +103,28 @@ <waitForPageLoad stepKey="waitForCreatedProductOpened"/> <!--Delete Image 1--> - <actionGroup ref="removeProductImage" stepKey="removeProductImage"/> + <actionGroup ref="RemoveProductImageActionGroup" stepKey="removeProductImage"/> <!--Click "Save" in the upper right corner--> - <actionGroup ref="saveProductForm" stepKey="saveProductFormAfterRemove"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductFormAfterRemove"/> <!--Switch to "Store view 1"--> - <actionGroup ref="SwitchToTheNewStoreView" stepKey="selectStoreView"> + <actionGroup ref="SwitchToTheNewStoreViewActionGroup" stepKey="selectStoreView"> <argument name="storeViewName" value="Store View"/> </actionGroup> <!-- Assert product first image not in admin product form --> - <actionGroup ref="assertProductImageNotInAdminProductPage" stepKey="assertProductImageNotInAdminProductPage"> + <actionGroup ref="AssertProductImageNotInAdminProductPageActionGroup" stepKey="assertProductImageNotInAdminProductPage"> <argument name="image" value="TestImageNew"/> </actionGroup> <!--Switch to "Store view 2"--> - <actionGroup ref="SwitchToTheNewStoreView" stepKey="selectSecondStoreView"> + <actionGroup ref="SwitchToTheNewStoreViewActionGroup" stepKey="selectSecondStoreView"> <argument name="storeViewName" value="Second Store View"/> </actionGroup> <!-- Verify that Image 1 is deleted from the Second Store View list --> - <actionGroup ref="assertProductImageNotInAdminProductPage" stepKey="assertProductImageNotInSecondStoreViewPage"> + <actionGroup ref="AssertProductImageNotInAdminProductPageActionGroup" stepKey="assertProductImageNotInSecondStoreViewPage"> <argument name="image" value="TestImageNew"/> </actionGroup> </test> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveImageFromCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveImageFromCategoryTest.xml index fb33e18379982..ef276114b4de5 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveImageFromCategoryTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveImageFromCategoryTest.xml @@ -22,30 +22,30 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="DeleteCategory" stepKey="DeleteCategory"> + <actionGroup ref="DeleteCategoryActionGroup" stepKey="DeleteCategory"> <argument name="categoryEntity" value="SimpleSubCategory"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> </after> <!-- Go to create a new category with image --> - <actionGroup ref="goToCreateCategoryPage" stepKey="goToCreateCategoryPage"/> - <actionGroup ref="fillCategoryForm" stepKey="fillCategoryForm"> + <actionGroup ref="GoToCreateCategoryPageActionGroup" stepKey="goToCreateCategoryPage"/> + <actionGroup ref="FillCategoryFormActionGroup" stepKey="fillCategoryForm"> <argument name="categoryEntity" value="SimpleSubCategory"/> </actionGroup> - <actionGroup ref="addCategoryImage" stepKey="addCategoryImage"/> - <actionGroup ref="saveCategoryForm" stepKey="saveCategoryForm"/> - <actionGroup ref="checkCategoryImageInAdmin" stepKey="checkCategoryImageInAdmin"/> + <actionGroup ref="AddCategoryImageActionGroup" stepKey="addCategoryImage"/> + <actionGroup ref="SaveCategoryFormActionGroup" stepKey="saveCategoryForm"/> + <actionGroup ref="CheckCategoryImageInAdminActionGroup" stepKey="checkCategoryImageInAdmin"/> <!-- Remove image from category --> - <actionGroup ref="removeCategoryImage" stepKey="removeCategoryImage"/> - <actionGroup ref="saveCategoryForm" stepKey="saveCategoryFormAfterRemove"/> + <actionGroup ref="RemoveCategoryImageActionGroup" stepKey="removeCategoryImage"/> + <actionGroup ref="SaveCategoryFormActionGroup" stepKey="saveCategoryFormAfterRemove"/> - <actionGroup ref="CheckCategoryOnStorefront" stepKey="CheckCategoryOnStorefront"> + <actionGroup ref="CheckCategoryOnStorefrontActionGroup" stepKey="CheckCategoryOnStorefront"> <argument name="categoryEntity" value="SimpleSubCategory"/> </actionGroup> <!-- Verify category with no image in storefront --> <dontSee selector="{{StorefrontCategoryMainSection.categoryImage}}" stepKey="dontSeeImage"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRestrictedUserAddCategoryFromProductPageTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRestrictedUserAddCategoryFromProductPageTest.xml index 7b5455951fb27..bb0f883e4d439 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRestrictedUserAddCategoryFromProductPageTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRestrictedUserAddCategoryFromProductPageTest.xml @@ -28,10 +28,10 @@ <after> <!--Delete created product--> <comment userInput="Delete created product" stepKey="commentDeleteProduct"/> - <actionGroup ref="deleteProductBySku" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteProduct"> <argument name="sku" value="{{_defaultProduct.sku}}"/> </actionGroup> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetFiltersIfExist"/> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetFiltersIfExist"/> <actionGroup ref="logout" stepKey="logoutOfUser"/> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <!--Delete created data--> @@ -80,15 +80,15 @@ </actionGroup> <!--Go to create product page--> <comment userInput="Go to create product page" stepKey="commentGoCreateProductPage"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"/> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProductPage"/> <dontSeeElement selector="{{AdminProductFormSection.newCategoryButton}}" stepKey="dontSeeNewCategoryButton"/> <!--Fill product data and assign to category--> <comment userInput="Fill product data and assign to category" stepKey="commentFillProductData"/> - <actionGroup ref="fillMainProductForm" stepKey="fillMainProductForm"/> - <actionGroup ref="SetCategoryByName" stepKey="addCategoryToProduct"> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillMainProductForm"/> + <actionGroup ref="SetCategoryByNameActionGroup" stepKey="addCategoryToProduct"> <argument name="categoryName" value="$$createCategory.name$$"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!--Assert that category exist in field--> <comment userInput="Assert that category exist in field" stepKey="commentAssertion"/> <grabTextFrom selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="grabCategoryName"/> @@ -98,10 +98,10 @@ </assertContains> <!--Remove the category from the product and assert that it removed--> <comment userInput="Remove the category from the product and assert that it removed" stepKey="assertCategoryRemoved"/> - <actionGroup ref="removeCategoryFromProduct" stepKey="removeCategoryFromProduct"> + <actionGroup ref="RemoveCategoryFromProductActionGroup" stepKey="removeCategoryFromProduct"> <argument name="categoryName" value="$$createCategory.name$$"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProductAfterRemovingCategory"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductAfterRemovingCategory"/> <grabTextFrom selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="grabCategoryFieldContent"/> <assertNotContains stepKey="assertThatCategoryRemoved"> <expectedResult type="variable">$$createCategory.name$$</expectedResult> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminShouldBeAbleToAssociateSimpleProductToWebsitesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminShouldBeAbleToAssociateSimpleProductToWebsitesTest.xml index 061c30b224828..54224c73135b6 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminShouldBeAbleToAssociateSimpleProductToWebsitesTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminShouldBeAbleToAssociateSimpleProductToWebsitesTest.xml @@ -49,7 +49,7 @@ <!-- 1. Go to product page in admin panel to edit --> <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="openProductIndexPageToAssociateToSecondWebsite"/> - <actionGroup ref="filterProductGridByName2" stepKey="filterProductInGrid"> + <actionGroup ref="FilterProductGridByName2ActionGroup" stepKey="filterProductInGrid"> <argument name="name" value="$$createSimpleProduct.name$$"/> </actionGroup> @@ -59,10 +59,10 @@ <argument name="websiteToUnassign" value="_defaultWebsite"/> <argument name="product" value="$$createSimpleProduct$$"/> </actionGroup> - <actionGroup ref="AssertProductIsAssignedToWebsite" stepKey="seeCustomWebsiteIsChecked"> + <actionGroup ref="AssertProductIsAssignedToWebsiteActionGroup" stepKey="seeCustomWebsiteIsChecked"> <argument name="website" value="$createCustomWebsite.website[name]$"/> </actionGroup> - <actionGroup ref="AssertProductIsNotAssignedToWebsite" stepKey="seeMainWebsiteIsNotChecked"> + <actionGroup ref="AssertProductIsNotAssignedToWebsiteActionGroup" stepKey="seeMainWebsiteIsNotChecked"> <argument name="website" value="{{_defaultWebsite.name}}"/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductImagesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductImagesTest.xml index df50edd20410a..ff8240655ca03 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductImagesTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductImagesTest.xml @@ -40,11 +40,11 @@ <!-- Go to the first product edit page --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductIndex"/> <waitForPageLoad stepKey="wait1"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGrid"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku"> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGrid"/> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProductGridBySku"> <argument name="product" value="$$firstProduct$$"/> </actionGroup> - <actionGroup ref="openProducForEditByClickingRowXColumnYInProductGrid" stepKey="openProducForEditByClickingRow1Column2InProductGrid"/> + <actionGroup ref="OpenProductForEditByClickingRowXColumnYInProductGridActionGroup" stepKey="openProducForEditByClickingRow1Column2InProductGrid"/> <!-- Set url key --> <click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/> @@ -126,11 +126,11 @@ <!-- Go to the second product edit page --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductIndex2"/> <waitForPageLoad stepKey="wait2"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGrid2"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku2"> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGrid2"/> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProductGridBySku2"> <argument name="product" value="$$secondProduct$$"/> </actionGroup> - <actionGroup ref="openProducForEditByClickingRowXColumnYInProductGrid" stepKey="openProducForEditByClickingRow1Column2InProductGrid2"/> + <actionGroup ref="OpenProductForEditByClickingRowXColumnYInProductGridActionGroup" stepKey="openProducForEditByClickingRow1Column2InProductGrid2"/> <!-- Upload an image --> <click selector="{{AdminProductImagesSection.productImagesToggle}}" stepKey="expandImages2"/> @@ -150,8 +150,8 @@ <!-- Go to the admin grid and see the uploaded image --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductIndex3"/> <waitForPageLoad stepKey="wait3"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGrid3"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku3"> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGrid3"/> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProductGridBySku3"> <argument name="product" value="$$secondProduct$$"/> </actionGroup> <seeElement selector="img.admin__control-thumbnail[src*='/large']" stepKey="seeImgInGrid"/> @@ -194,11 +194,11 @@ <!-- Go to the product edit page --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductIndex"/> <waitForPageLoad stepKey="wait1"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGrid"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku"> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGrid"/> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProductGridBySku"> <argument name="product" value="$$product$$"/> </actionGroup> - <actionGroup ref="openProducForEditByClickingRowXColumnYInProductGrid" stepKey="openProduct"/> + <actionGroup ref="OpenProductForEditByClickingRowXColumnYInProductGridActionGroup" stepKey="openProduct"/> <!-- Set url key --> <click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/> @@ -259,8 +259,8 @@ <!-- Go to the admin grid and see the Thumbnail image --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductIndex2"/> <waitForPageLoad stepKey="wait2"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGrid2"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku2"> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGrid2"/> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProductGridBySku2"> <argument name="product" value="$$product$$"/> </actionGroup> <seeElement selector="{{AdminProductGridSection.productThumbnailBySrc('/adobe-thumb')}}" stepKey="seeBaseInGrid"/> @@ -268,11 +268,11 @@ <!-- Go to the product edit page again --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductIndex3"/> <waitForPageLoad stepKey="wait5"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGrid3"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku3"> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGrid3"/> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProductGridBySku3"> <argument name="product" value="$$product$$"/> </actionGroup> - <actionGroup ref="openProducForEditByClickingRowXColumnYInProductGrid" stepKey="openProduct3"/> + <actionGroup ref="OpenProductForEditByClickingRowXColumnYInProductGridActionGroup" stepKey="openProduct3"/> <click selector="{{AdminProductImagesSection.productImagesToggle}}" stepKey="expandImages2"/> <!-- Remove all images --> @@ -284,8 +284,8 @@ <!-- Check admin grid for placeholder --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductIndex4"/> <waitForPageLoad stepKey="wait6"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGrid4"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku4"> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGrid4"/> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProductGridBySku4"> <argument name="product" value="$$product$$"/> </actionGroup> <dontSeeElement selector="{{AdminProductGridSection.productThumbnailBySrc('/adobe-thumb')}}" stepKey="dontSeeBaseInGrid"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductSetEditContentTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductSetEditContentTest.xml index f5e5911352c86..b7e14c336ec5f 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductSetEditContentTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductSetEditContentTest.xml @@ -26,7 +26,7 @@ </before> <after> <!-- Delete simple product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="SimpleProduct"/> </actionGroup> <!--Admin Logout--> @@ -36,10 +36,10 @@ <!-- Create product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPage"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct"> <argument name="product" value="SimpleProduct"/> </actionGroup> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillProductForm"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillProductForm"> <argument name="product" value="SimpleProduct"/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleSetEditRelatedProductsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleSetEditRelatedProductsTest.xml index 4803c1be6c936..0c0b8751a732e 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleSetEditRelatedProductsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleSetEditRelatedProductsTest.xml @@ -30,7 +30,7 @@ </before> <after> <!-- Delete simple product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="SimpleProduct3"/> </actionGroup> <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> @@ -46,15 +46,15 @@ <!--Create product--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPage"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct"> <argument name="product" value="SimpleProduct3"/> </actionGroup> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillProductForm"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillProductForm"> <argument name="product" value="SimpleProduct3"/> </actionGroup> <!--Add related product--> - <actionGroup ref="addRelatedProductBySku" stepKey="addRelatedProduct0"> + <actionGroup ref="AddRelatedProductBySkuActionGroup" stepKey="addRelatedProduct0"> <argument name="sku" value="$$simpleProduct0.sku$$"/> </actionGroup> @@ -63,7 +63,7 @@ <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/> <!--Add another related product--> - <actionGroup ref="addRelatedProductBySku" stepKey="addRelatedProduct1"> + <actionGroup ref="AddRelatedProductBySkuActionGroup" stepKey="addRelatedProduct1"> <argument name="sku" value="$$simpleProduct1.sku$$"/> </actionGroup> @@ -80,19 +80,19 @@ <see selector="{{AdminProductFormRelatedUpSellCrossSellSection.selectedRelatedProduct}}" userInput="$$simpleProduct1.sku$$" stepKey="seeRelatedProduct"/> <!--See more related products in admin--> - <actionGroup ref="addRelatedProductBySku" stepKey="addRelatedProduct2"> + <actionGroup ref="AddRelatedProductBySkuActionGroup" stepKey="addRelatedProduct2"> <argument name="sku" value="$$simpleProduct2.sku$$"/> </actionGroup> - <actionGroup ref="addRelatedProductBySku" stepKey="addRelatedProduct3"> + <actionGroup ref="AddRelatedProductBySkuActionGroup" stepKey="addRelatedProduct3"> <argument name="sku" value="$$simpleProduct3.sku$$"/> </actionGroup> - <actionGroup ref="addRelatedProductBySku" stepKey="addRelatedProduct4"> + <actionGroup ref="AddRelatedProductBySkuActionGroup" stepKey="addRelatedProduct4"> <argument name="sku" value="$$simpleProduct4.sku$$"/> </actionGroup> - <actionGroup ref="addRelatedProductBySku" stepKey="addRelatedProduct5"> + <actionGroup ref="AddRelatedProductBySkuActionGroup" stepKey="addRelatedProduct5"> <argument name="sku" value="$$simpleProduct5.sku$$"/> </actionGroup> - <actionGroup ref="addRelatedProductBySku" stepKey="addRelatedProduct6"> + <actionGroup ref="AddRelatedProductBySkuActionGroup" stepKey="addRelatedProduct6"> <argument name="sku" value="$$simpleProduct6.sku$$"/> </actionGroup> <scrollTo selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDropdown}}" stepKey="scrollTo2"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminSortingByWebsitesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminSortingByWebsitesTest.xml index 5b6207e135796..e385ef70cf4a0 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminSortingByWebsitesTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminSortingByWebsitesTest.xml @@ -40,8 +40,8 @@ <actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteTestWebsite"> <argument name="websiteName" value="{{customWebsite.name}}"/> </actionGroup> - <actionGroup ref="GoToProductCatalogPage" stepKey="goToProductCatalogPage"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGridColumnsInitial"/> + <actionGroup ref="GoToProductCatalogPageActionGroup" stepKey="goToProductCatalogPage"/> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGridColumnsInitial"/> <actionGroup ref="ResetWebUrlOptions" stepKey="resetUrlOption"/> <magentoCLI command="indexer:reindex" stepKey="reindex"/> <magentoCLI command="cache:flush" stepKey="flushCache"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUnassignProductAttributeFromAttributeSetTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUnassignProductAttributeFromAttributeSetTest.xml index bcc8636c65b1e..1c9cdad681d98 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUnassignProductAttributeFromAttributeSetTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUnassignProductAttributeFromAttributeSetTest.xml @@ -40,7 +40,7 @@ <!-- Assert attribute presence in storefront product additional information --> <amOnPage url="/$$product.custom_attributes[url_key]$$.html" stepKey="onProductPage1"/> <waitForPageLoad stepKey="wait1"/> - <actionGroup ref="checkAttributeInMoreInformationTab" stepKey="checkAttributeInMoreInformationTab"> + <actionGroup ref="CheckAttributeInMoreInformationTabActionGroup" stepKey="checkAttributeInMoreInformationTab"> <argument name="attributeLabel" value="$$attribute.attribute[frontend_labels][0][label]$$"/> <argument name="attributeValue" value="$$option2.option[store_labels][0][label]$$"/> </actionGroup> @@ -49,14 +49,14 @@ <!-- Assert created attribute in a group --> <see userInput="$$attribute.attribute_code$$" selector="{{AdminProductAttributeSetEditSection.groupTree}}" stepKey="seeAttributeInGroup"/> <!-- Unassign attribute from group --> - <actionGroup ref="UnassignAttributeFromGroup" stepKey="UnassignAttributeFromGroup"> + <actionGroup ref="UnassignAttributeFromGroupActionGroup" stepKey="UnassignAttributeFromGroup"> <argument name="group" value="Product Details"/> <argument name="attribute" value="$$attribute.attribute_code$$"/> </actionGroup> <!-- Assert attribute in unassigned section --> <see userInput="$$attribute.attribute_code$$" selector="{{AdminProductAttributeSetEditSection.unassignedAttributesTree}}" stepKey="seeAttributeInUnassigned"/> <!-- Save attribute set --> - <actionGroup ref="SaveAttributeSet" stepKey="SaveAttributeSet"/> + <actionGroup ref="SaveAttributeSetActionGroup" stepKey="SaveAttributeSet"/> <!-- Clear cache --> <actionGroup ref="ClearPageCacheActionGroup" stepKey="clearPageCacheActionGroup"/> <!-- Go to create new product page --> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryStoreUrlKeyTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryStoreUrlKeyTest.xml index 0f63a72844452..01eba2976c3d6 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryStoreUrlKeyTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryStoreUrlKeyTest.xml @@ -19,7 +19,7 @@ <group value="category"/> </annotations> <after> - <actionGroup ref="DeleteCategory" stepKey="deleteCategory"> + <actionGroup ref="DeleteCategoryActionGroup" stepKey="deleteCategory"> <argument name="categoryEntity" value="_defaultCategory"/> </actionGroup> <actionGroup ref="logout" stepKey="adminLogout"/> @@ -29,12 +29,12 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <amOnPage url="{{AdminCategoryPage.url}}" stepKey="navigateToCategoryPage"/> <waitForPageLoad stepKey="waitForPageLoad1"/> - <actionGroup ref="CreateCategory" stepKey="createCategory"> + <actionGroup ref="CreateCategoryActionGroup" stepKey="createCategory"> <argument name="categoryEntity" value="_defaultCategory"/> </actionGroup> <!--Switch to "Default Store View" scope--> - <actionGroup ref="switchCategoryStoreView" stepKey="SwitchStoreView"> + <actionGroup ref="SwitchCategoryStoreViewActionGroup" stepKey="SwitchStoreView"> <argument name="Store" value="_defaultStore.name"/> <argument name="CatName" value="_defaultCategory.name"/> </actionGroup> @@ -58,7 +58,7 @@ <!-- Update SEO key to original, uncheck "Create Redirect", confirm in frontend, delete category --> <!--Switch to "Default Store View" scope--> - <actionGroup ref="switchCategoryStoreView" stepKey="SwitchStoreView2"> + <actionGroup ref="SwitchCategoryStoreViewActionGroup" stepKey="SwitchStoreView2"> <argument name="Store" value="_defaultStore.name"/> <argument name="CatName" value="_defaultCategory.name"/> </actionGroup> @@ -74,4 +74,4 @@ <seeInTitle userInput="{{_defaultCategory.name}}" stepKey="seeCategoryNameInTitle2"/> <seeInCurrentUrl stepKey="verifyUrlKeyAfterOriginalSeoKey" url="{{_defaultCategory.name_lwr}}.html"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductNameToVerifyDataOverridingOnStoreViewLevelTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductNameToVerifyDataOverridingOnStoreViewLevelTest.xml index 80f0c8ad10ede..57499c1332020 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductNameToVerifyDataOverridingOnStoreViewLevelTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductNameToVerifyDataOverridingOnStoreViewLevelTest.xml @@ -32,7 +32,7 @@ <after> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/> <deleteData stepKey="deleteSimpleSubCategory2" createDataKey="categoryEntity"/> - <actionGroup ref="deleteProductBySku" stepKey="deleteCreatedProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteCreatedProduct"> <argument name="sku" value="{{defaultSimpleProduct.sku}}"/> </actionGroup> <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView"> @@ -44,7 +44,7 @@ <!-- Search default simple product in grid --> <amOnPage url="{{ProductCatalogPage.url}}" stepKey="OpenProductCatalogPage"/> <waitForPageLoad stepKey="waitForProductCatalogPage"/> - <actionGroup ref="filterProductGridBySku2" stepKey="filterProductGrid"> + <actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterProductGrid"> <argument name="sku" value="$$initialSimpleProduct.sku$$"/> </actionGroup> <click selector="{{AdminProductGridFilterSection.nthRow('1')}}" stepKey="clickFirstRowToOpenDefaultSimpleProduct"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductPriceToVerifyDataOverridingOnStoreViewLevelTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductPriceToVerifyDataOverridingOnStoreViewLevelTest.xml index f698b3d89ffe9..630e47250f11f 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductPriceToVerifyDataOverridingOnStoreViewLevelTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductPriceToVerifyDataOverridingOnStoreViewLevelTest.xml @@ -32,7 +32,7 @@ <after> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/> <deleteData stepKey="deleteSimpleSubCategory2" createDataKey="categoryEntity"/> - <actionGroup ref="deleteProductBySku" stepKey="deleteCreatedProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteCreatedProduct"> <argument name="sku" value="{{defaultSimpleProduct.sku}}"/> </actionGroup> <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView"> @@ -44,7 +44,7 @@ <!-- Search default simple product in grid --> <amOnPage url="{{ProductCatalogPage.url}}" stepKey="OpenProductCatalogPage"/> <waitForPageLoad stepKey="waitForProductCatalogPage"/> - <actionGroup ref="filterProductGridBySku2" stepKey="filterProductGrid"> + <actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterProductGrid"> <argument name="sku" value="$$initialSimpleProduct.sku$$"/> </actionGroup> <click selector="{{AdminProductGridFilterSection.nthRow('1')}}" stepKey="clickFirstRowToOpenDefaultSimpleProduct"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductTieredPriceTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductTieredPriceTest.xml index 10ff1151cd9b3..a848eb3d11e61 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductTieredPriceTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductTieredPriceTest.xml @@ -33,7 +33,7 @@ <after> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/> <deleteData stepKey="deleteSimpleSubCategory2" createDataKey="categoryEntity"/> - <actionGroup ref="deleteProductBySku" stepKey="deleteCreatedProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteCreatedProduct"> <argument name="sku" value="{{simpleProductTierPrice300InStock.sku}}"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> @@ -42,7 +42,7 @@ <!-- Search default simple product in the grid --> <amOnPage url="{{ProductCatalogPage.url}}" stepKey="OpenProductCatalogPage"/> <waitForPageLoad stepKey="waitForProductCatalogPage"/> - <actionGroup ref="filterProductGridBySku2" stepKey="filterProductGrid"> + <actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterProductGrid"> <argument name="sku" value="$$initialSimpleProduct.sku$$"/> </actionGroup> <click selector="{{AdminProductGridFilterSection.nthRow('1')}}" stepKey="clickFirstRowToOpenDefaultSimpleProduct"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockDisabledProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockDisabledProductTest.xml index 6e8f1ba6f12a6..ff3f56b566b38 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockDisabledProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockDisabledProductTest.xml @@ -27,7 +27,7 @@ </before> <after> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/> - <actionGroup ref="deleteProductBySku" stepKey="deleteCreatedProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteCreatedProduct"> <argument name="sku" value="{{simpleProductDisabled.sku}}"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> @@ -36,7 +36,7 @@ <!-- Search default simple product in the grid page --> <amOnPage url="{{ProductCatalogPage.url}}" stepKey="OpenProductCatalogPage"/> <waitForPageLoad stepKey="waitForProductCatalogPage"/> - <actionGroup ref="filterProductGridBySku2" stepKey="filterProductGrid"> + <actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterProductGrid"> <argument name="sku" value="$$initialSimpleProduct.sku$$"/> </actionGroup> <click selector="{{AdminProductGridFilterSection.nthRow('1')}}" stepKey="clickFirstRowToOpenDefaultSimpleProduct"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockEnabledFlatTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockEnabledFlatTest.xml index afb8b40a6dbd4..09ddc18aff4bd 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockEnabledFlatTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockEnabledFlatTest.xml @@ -30,7 +30,7 @@ <after> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/> <deleteData stepKey="deleteSimpleSubCategory2" createDataKey="categoryEntity"/> - <actionGroup ref="deleteProductBySku" stepKey="deleteCreatedProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteCreatedProduct"> <argument name="sku" value="{{simpleProductEnabledFlat.sku}}"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> @@ -40,7 +40,7 @@ <!-- Search default simple product in the grid page --> <amOnPage url="{{ProductCatalogPage.url}}" stepKey="OpenProductCatalogPage"/> <waitForPageLoad stepKey="waitForProductCatalogPage"/> - <actionGroup ref="filterProductGridBySku2" stepKey="filterProductGrid"> + <actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterProductGrid"> <argument name="sku" value="$$initialSimpleProduct.sku$$"/> </actionGroup> <click selector="{{AdminProductGridFilterSection.nthRow('1')}}" stepKey="clickFirstRowToOpenDefaultSimpleProduct"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockNotVisibleIndividuallyTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockNotVisibleIndividuallyTest.xml index 2436fc0fc7f12..94aec4cc95d1d 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockNotVisibleIndividuallyTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockNotVisibleIndividuallyTest.xml @@ -29,7 +29,7 @@ <after> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/> <deleteData stepKey="deleteSimpleSubCategory2" createDataKey="categoryEntity"/> - <actionGroup ref="deleteProductBySku" stepKey="deleteCreatedProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteCreatedProduct"> <argument name="sku" value="{{simpleProductNotVisibleIndividually.sku}}"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> @@ -38,7 +38,7 @@ <!-- Search default simple product in the grid page --> <amOnPage url="{{ProductCatalogPage.url}}" stepKey="OpenProductCatalogPage"/> <waitForPageLoad stepKey="waitForProductCatalogPage"/> - <actionGroup ref="filterProductGridBySku2" stepKey="filterProductGrid"> + <actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterProductGrid"> <argument name="sku" value="$$initialSimpleProduct.sku$$"/> </actionGroup> <click selector="{{AdminProductGridFilterSection.nthRow('1')}}" stepKey="clickFirstRowToOpenDefaultSimpleProduct"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockUnassignFromCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockUnassignFromCategoryTest.xml index 3433a09117322..fa3317aa815d9 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockUnassignFromCategoryTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockUnassignFromCategoryTest.xml @@ -27,7 +27,7 @@ </before> <after> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/> - <actionGroup ref="deleteProductBySku" stepKey="deleteCreatedProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteCreatedProduct"> <argument name="sku" value="$$initialSimpleProduct.sku$$"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> @@ -36,7 +36,7 @@ <!--Search default simple product in the grid page --> <amOnPage url="{{ProductCatalogPage.url}}" stepKey="OpenProductCatalogPage"/> <waitForPageLoad stepKey="waitForProductCatalogPage"/> - <actionGroup ref="filterProductGridBySku2" stepKey="filterProductGrid"> + <actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterProductGrid"> <argument name="sku" value="$$initialSimpleProduct.sku$$"/> </actionGroup> <click selector="{{AdminProductGridFilterSection.nthRow('1')}}" stepKey="clickFirstRowToOpenDefaultSimpleProduct"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogAndSearchTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogAndSearchTest.xml index 82395e5d6e0eb..95b74f4d38b3f 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogAndSearchTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogAndSearchTest.xml @@ -29,7 +29,7 @@ <after> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/> <deleteData stepKey="deleteSimpleSubCategory2" createDataKey="categoryEntity"/> - <actionGroup ref="deleteProductBySku" stepKey="deleteCreatedProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteCreatedProduct"> <argument name="sku" value="{{simpleProductRegularPrice245InStock.sku}}"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> @@ -38,7 +38,7 @@ <!-- Search default simple product in the grid page --> <amOnPage url="{{ProductCatalogPage.url}}" stepKey="OpenProductCatalogPage"/> <waitForPageLoad stepKey="waitForProductCatalogPage"/> - <actionGroup ref="filterProductGridBySku2" stepKey="filterProductGrid"> + <actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterProductGrid"> <argument name="sku" value="$$initialSimpleProduct.sku$$"/> </actionGroup> <click selector="{{AdminProductGridFilterSection.nthRow('1')}}" stepKey="clickFirstRowToOpenDefaultSimpleProduct"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogOnlyTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogOnlyTest.xml index 4817b3497c97e..af190890ac351 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogOnlyTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogOnlyTest.xml @@ -29,7 +29,7 @@ <after> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/> <deleteData stepKey="deleteSimpleSubCategory2" createDataKey="categoryEntity"/> - <actionGroup ref="deleteProductBySku" stepKey="deleteCreatedProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteCreatedProduct"> <argument name="sku" value="{{simpleProductRegularPrice32501InStock.sku}}"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> @@ -38,7 +38,7 @@ <!-- Search default simple product in the grid --> <amOnPage url="{{ProductCatalogPage.url}}" stepKey="OpenProductCatalogPage"/> <waitForPageLoad stepKey="waitForProductCatalogPage"/> - <actionGroup ref="filterProductGridBySku2" stepKey="filterProductGrid"> + <actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterProductGrid"> <argument name="sku" value="$$initialSimpleProduct.sku$$"/> </actionGroup> <click selector="{{AdminProductGridFilterSection.nthRow('1')}}" stepKey="clickFirstRowToOpenDefaultSimpleProduct"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInSearchOnlyTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInSearchOnlyTest.xml index 214f9b0273b6a..626c3d00a5caf 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInSearchOnlyTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInSearchOnlyTest.xml @@ -29,7 +29,7 @@ <after> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/> <deleteData stepKey="deleteSimpleSubCategory2" createDataKey="categoryEntity"/> - <actionGroup ref="deleteProductBySku" stepKey="deleteCreatedProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteCreatedProduct"> <argument name="sku" value="{{simpleProductRegularPrice325InStock.sku}}"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> @@ -38,7 +38,7 @@ <!-- Search default simple product in the grid --> <amOnPage url="{{ProductCatalogPage.url}}" stepKey="OpenProductCatalogPage"/> <waitForPageLoad stepKey="waitForProductCatalogPage"/> - <actionGroup ref="filterProductGridBySku2" stepKey="filterProductGrid"> + <actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterProductGrid"> <argument name="sku" value="$$initialSimpleProduct.sku$$"/> </actionGroup> <click selector="{{AdminProductGridFilterSection.nthRow('1')}}" stepKey="clickFirstRowToOpenDefaultSimpleProduct"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockWithCustomOptionsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockWithCustomOptionsTest.xml index b145328890a91..13782da076f69 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockWithCustomOptionsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockWithCustomOptionsTest.xml @@ -29,7 +29,7 @@ <after> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/> <deleteData stepKey="deleteSimpleSubCategory2" createDataKey="categoryEntity"/> - <actionGroup ref="deleteProductBySku" stepKey="deleteCreatedProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteCreatedProduct"> <argument name="sku" value="{{simpleProductRegularPriceCustomOptions.sku}}"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> @@ -38,7 +38,7 @@ <!-- Search default simple product in the grid --> <amOnPage url="{{ProductCatalogPage.url}}" stepKey="OpenProductCatalogPage"/> <waitForPageLoad stepKey="waitForProductCatalogPage"/> - <actionGroup ref="filterProductGridBySku2" stepKey="filterProductGrid"> + <actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterProductGrid"> <argument name="sku" value="$$initialSimpleProduct.sku$$"/> </actionGroup> <click selector="{{AdminProductGridFilterSection.nthRow('1')}}" stepKey="clickFirstRowToOpenDefaultSimpleProduct"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceOutOfStockTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceOutOfStockTest.xml index 27c7e77a94ad1..285ceb3c4d722 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceOutOfStockTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceOutOfStockTest.xml @@ -29,7 +29,7 @@ <after> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/> <deleteData stepKey="deleteSimpleSubCategory2" createDataKey="categoryEntity"/> - <actionGroup ref="deleteProductBySku" stepKey="deleteCreatedProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteCreatedProduct"> <argument name="sku" value="{{simpleProductRegularPrice32503OutOfStock.sku}}"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> @@ -38,7 +38,7 @@ <!-- Search default simple product in the grid --> <amOnPage url="{{ProductCatalogPage.url}}" stepKey="OpenProductCatalogPage"/> <waitForPageLoad stepKey="waitForProductCatalogPage"/> - <actionGroup ref="filterProductGridBySku2" stepKey="filterProductGrid"> + <actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterProductGrid"> <argument name="sku" value="$$initialSimpleProduct.sku$$"/> </actionGroup> <click selector="{{AdminProductGridFilterSection.nthRow('1')}}" stepKey="clickFirstRowToOpenDefaultSimpleProduct"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceInStockVisibleInCategoryOnlyTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceInStockVisibleInCategoryOnlyTest.xml index 9fa0e155a4fe7..0e9b9431dcfa6 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceInStockVisibleInCategoryOnlyTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceInStockVisibleInCategoryOnlyTest.xml @@ -28,7 +28,7 @@ <createData entity="SimpleSubCategory" stepKey="categoryEntity"/> </before> <after> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteVirtualProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteVirtualProduct"> <argument name="product" value="updateVirtualProductRegularPrice"/> </actionGroup> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryAndSearchTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryAndSearchTest.xml index e0e8360850983..10347584b4cda 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryAndSearchTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryAndSearchTest.xml @@ -28,7 +28,7 @@ <createData entity="SimpleSubCategory" stepKey="categoryEntity"/> </before> <after> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteVirtualProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteVirtualProduct"> <argument name="product" value="updateVirtualProductTierPriceInStock"/> </actionGroup> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryOnlyTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryOnlyTest.xml index 677cc4c65ce88..0edc487e71edf 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryOnlyTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryOnlyTest.xml @@ -28,7 +28,7 @@ <createData entity="SimpleSubCategory" stepKey="categoryEntity"/> </before> <after> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteVirtualProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteVirtualProduct"> <argument name="product" value="updateVirtualProductWithTierPriceInStock"/> </actionGroup> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceOutOfStockVisibleInCategoryAndSearchTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceOutOfStockVisibleInCategoryAndSearchTest.xml index f0148f3d384c1..e513d007e6a09 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceOutOfStockVisibleInCategoryAndSearchTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceOutOfStockVisibleInCategoryAndSearchTest.xml @@ -28,7 +28,7 @@ <createData entity="SimpleSubCategory" stepKey="categoryEntity"/> </before> <after> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteVirtualProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteVirtualProduct"> <argument name="product" value="updateVirtualTierPriceOutOfStock"/> </actionGroup> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminVerifyProductOrderTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminVerifyProductOrderTest.xml index a81c26b6e6eaf..b61be7fd95a58 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminVerifyProductOrderTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminVerifyProductOrderTest.xml @@ -25,7 +25,7 @@ <after> <actionGroup ref="logout" stepKey="logout"/> </after> - <actionGroup ref="GoToProductCatalogPage" stepKey="goToProductCatalogPage"/> + <actionGroup ref="GoToProductCatalogPageActionGroup" stepKey="goToProductCatalogPage"/> <actionGroup ref="VerifyProductTypeOrder" stepKey="verifyProductTypeOrder"/> </test> </tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminVirtualProductSetEditContentTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminVirtualProductSetEditContentTest.xml index c9932de808006..1e7b7cc14f9cc 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminVirtualProductSetEditContentTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminVirtualProductSetEditContentTest.xml @@ -21,16 +21,16 @@ </annotations> <after> <!-- Delete virtual product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="defaultVirtualProduct"/> </actionGroup> </after> <!-- Create product --> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct"> <argument name="product" value="defaultVirtualProduct"/> </actionGroup> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillProductForm"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillProductForm"> <argument name="product" value="defaultVirtualProduct"/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminVirtualSetEditRelatedProductsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminVirtualSetEditRelatedProductsTest.xml index e630545fff8fb..a8d8face1a1e6 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminVirtualSetEditRelatedProductsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminVirtualSetEditRelatedProductsTest.xml @@ -21,16 +21,16 @@ <before></before> <after> <!-- Delete virtual product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="defaultVirtualProduct"/> </actionGroup> </after> <!-- Create product --> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct"> <argument name="product" value="defaultVirtualProduct"/> </actionGroup> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillProductForm"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillProductForm"> <argument name="product" value="defaultVirtualProduct"/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdvanceCatalogSearchSimpleProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdvanceCatalogSearchSimpleProductTest.xml index d8fa20c7cc469..3125ba3decce6 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdvanceCatalogSearchSimpleProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdvanceCatalogSearchSimpleProductTest.xml @@ -20,7 +20,7 @@ </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - <actionGroup ref="deleteAllProductsUsingProductGrid" stepKey="deleteAllProducts"/> + <actionGroup ref="DeleteAllProductsUsingProductGridActionGroup" stepKey="deleteAllProducts"/> <createData entity="ApiProductWithDescription" stepKey="product"/> </before> <after> @@ -91,7 +91,7 @@ </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - <actionGroup ref="deleteAllProductsUsingProductGrid" stepKey="deleteAllProducts"/> + <actionGroup ref="DeleteAllProductsUsingProductGridActionGroup" stepKey="deleteAllProducts"/> <createData entity="ApiProductWithDescription" stepKey="product"/> <getData entity="GetProduct" stepKey="arg1"> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/CheckTierPricingOfProductsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/CheckTierPricingOfProductsTest.xml index cee40241185b4..7cb49c18ec6e9 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/CheckTierPricingOfProductsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/CheckTierPricingOfProductsTest.xml @@ -61,10 +61,10 @@ <actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openEditProduct1"> <argument name="product" value="$$product1$$"/> </actionGroup> - <actionGroup ref="ProductSetWebsite" stepKey="ProductSetWebsite"> + <actionGroup ref="ProductSetWebsiteActionGroup" stepKey="ProductSetWebsite"> <argument name="website" value="secondWebsite"/> </actionGroup> - <actionGroup ref="ProductSetAdvancedPricing" stepKey="ProductSetAdvancedPricing1"> + <actionGroup ref="ProductSetAdvancedPricingActionGroup" stepKey="ProductSetAdvancedPricing1"> <argument name="website" value="secondWebsite"/> </actionGroup> @@ -74,10 +74,10 @@ <actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openEditProduct2"> <argument name="product" value="$$product2$$"/> </actionGroup> - <actionGroup ref="ProductSetWebsite" stepKey="ProductSetWebsite2"> + <actionGroup ref="ProductSetWebsiteActionGroup" stepKey="ProductSetWebsite2"> <argument name="website" value="secondWebsite"/> </actionGroup> - <actionGroup ref="ProductSetAdvancedPricing" stepKey="ProductSetAdvancedPricing2"> + <actionGroup ref="ProductSetAdvancedPricingActionGroup" stepKey="ProductSetAdvancedPricing2"> <argument name="website" value="secondWebsite"/> </actionGroup> @@ -87,10 +87,10 @@ <actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openEditProduct3"> <argument name="product" value="$$product3$$"/> </actionGroup> - <actionGroup ref="ProductSetWebsite" stepKey="ProductSetWebsite3"> + <actionGroup ref="ProductSetWebsiteActionGroup" stepKey="ProductSetWebsite3"> <argument name="website" value="secondWebsite"/> </actionGroup> - <actionGroup ref="ProductSetAdvancedPricing" stepKey="ProductSetAdvancedPricing3"> + <actionGroup ref="ProductSetAdvancedPricingActionGroup" stepKey="ProductSetAdvancedPricing3"> <argument name="website" value="secondWebsite"/> </actionGroup> @@ -100,10 +100,10 @@ <actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openEditProduct4"> <argument name="product" value="$$product4$$"/> </actionGroup> - <actionGroup ref="ProductSetWebsite" stepKey="ProductSetWebsite4"> + <actionGroup ref="ProductSetWebsiteActionGroup" stepKey="ProductSetWebsite4"> <argument name="website" value="secondWebsite"/> </actionGroup> - <actionGroup ref="ProductSetAdvancedPricing" stepKey="ProductSetAdvancedPricing4"> + <actionGroup ref="ProductSetAdvancedPricingActionGroup" stepKey="ProductSetAdvancedPricing4"> <argument name="website" value="secondWebsite"/> </actionGroup> <actionGroup ref="ClearProductsFilterActionGroup" stepKey="ClearProductsFilterActionGroup"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/ConfigurableOptionTextInputLengthValidationHint.xml b/app/code/Magento/Catalog/Test/Mftf/Test/ConfigurableOptionTextInputLengthValidationHint.xml index 899f3e61b5b86..a4785e25d39bb 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/ConfigurableOptionTextInputLengthValidationHint.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/ConfigurableOptionTextInputLengthValidationHint.xml @@ -27,7 +27,7 @@ </after> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/> - <actionGroup ref="AdminCreateSimpleProductWithTextOptionCharLimit" stepKey="fillProductFieldsInAdmin"> + <actionGroup ref="AdminCreateSimpleProductWithTextOptionCharLimitActionGroup" stepKey="fillProductFieldsInAdmin"> <argument name="category" value="$$createPreReqCategory$$"/> <argument name="simpleProduct" value="_defaultProduct"/> <argument name="charLimit" value="20"/> @@ -36,10 +36,10 @@ <argument name="category" value="$$createPreReqCategory$$"/> <argument name="product" value="_defaultProduct"/> </actionGroup> - <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="assertProductInStorefront2"> + <actionGroup ref="AssertProductInStorefrontProductPageActionGroup" stepKey="assertProductInStorefront2"> <argument name="product" value="_defaultProduct"/> </actionGroup> - <actionGroup ref="testDynamicValidationHint" stepKey="testDynamicValidationHint1"> + <actionGroup ref="TestDynamicValidationHintActionGroup" stepKey="testDynamicValidationHint1"> <argument name="charLimit" value="20"/> </actionGroup> </test> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/CreateProductAttributeEntityTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/CreateProductAttributeEntityTest.xml index d895993217e32..1e297586ecb65 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/CreateProductAttributeEntityTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/CreateProductAttributeEntityTest.xml @@ -24,7 +24,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="navigateToEditProductAttribute" stepKey="goToEditPage"> + <actionGroup ref="NavigateToEditProductAttributeActionGroup" stepKey="goToEditPage"> <argument name="ProductAttribute" value="{{textProductAttribute.attribute_code}}"/> </actionGroup> <click stepKey="clickDelete" selector="{{AttributePropertiesSection.DeleteAttribute}}"/> @@ -37,12 +37,12 @@ <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="goToProductAttributes"/> <!--Create new Product Attribute as TextField, with code and default value.--> - <actionGroup ref="createProductAttributeWithTextField" stepKey="createAttribute"> + <actionGroup ref="CreateProductAttributeWithTextFieldActionGroup" stepKey="createAttribute"> <argument name="attribute" value="textProductAttribute"/> </actionGroup> <!--Navigate to Product Attribute.--> - <actionGroup ref="navigateToEditProductAttribute" stepKey="goToEditPage"> + <actionGroup ref="NavigateToEditProductAttributeActionGroup" stepKey="goToEditPage"> <argument name="ProductAttribute" value="{{textProductAttribute.attribute_code}}"/> </actionGroup> @@ -55,7 +55,7 @@ <!--Go to New Product page, add Attribute and check values--> <amOnPage url="{{AdminProductCreatePage.url('4', 'simple')}}" stepKey="goToCreateSimpleProductPage"/> - <actionGroup ref="addProductAttributeInProductModal" stepKey="addAttributeToProduct"> + <actionGroup ref="AddProductAttributeInProductModalActionGroup" stepKey="addAttributeToProduct"> <argument name="attributeCode" value="{{textProductAttribute.attribute_code}}"/> </actionGroup> <click stepKey="openAttributes" selector="{{AdminProductAttributesSection.sectionHeader}}"/> @@ -83,7 +83,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="navigateToEditProductAttribute" stepKey="goToEditPage"> + <actionGroup ref="NavigateToEditProductAttributeActionGroup" stepKey="goToEditPage"> <argument name="ProductAttribute" value="{{dateProductAttribute.attribute_code}}"/> </actionGroup> <click stepKey="clickDelete" selector="{{AttributePropertiesSection.DeleteAttribute}}"/> @@ -99,13 +99,13 @@ <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="goToProductAttributes"/> <!--Create new Product Attribute as TextField, with code and default value.--> - <actionGroup ref="createProductAttributeWithDateField" stepKey="createAttribute"> + <actionGroup ref="CreateProductAttributeWithDateFieldActionGroup" stepKey="createAttribute"> <argument name="attribute" value="dateProductAttribute"/> <argument name="date" value="{$generateDefaultDate}"/> </actionGroup> <!--Navigate to Product Attribute.--> - <actionGroup ref="navigateToEditProductAttribute" stepKey="goToEditPage"> + <actionGroup ref="NavigateToEditProductAttributeActionGroup" stepKey="goToEditPage"> <argument name="ProductAttribute" value="{{dateProductAttribute.attribute_code}}"/> </actionGroup> @@ -118,7 +118,7 @@ <!--Go to New Product page, add Attribute and check values--> <amOnPage url="{{AdminProductCreatePage.url('4', 'simple')}}" stepKey="goToCreateSimpleProductPage"/> - <actionGroup ref="addProductAttributeInProductModal" stepKey="addAttributeToProduct"> + <actionGroup ref="AddProductAttributeInProductModalActionGroup" stepKey="addAttributeToProduct"> <argument name="attributeCode" value="{{dateProductAttribute.attribute_code}}"/> </actionGroup> <click stepKey="openAttributes" selector="{{AdminProductAttributesSection.sectionHeader}}"/> @@ -143,7 +143,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="navigateToEditProductAttribute" stepKey="goToEditPage"> + <actionGroup ref="NavigateToEditProductAttributeActionGroup" stepKey="goToEditPage"> <argument name="ProductAttribute" value="{{priceProductAttribute.attribute_code}}"/> </actionGroup> <click stepKey="clickDelete" selector="{{AttributePropertiesSection.DeleteAttribute}}"/> @@ -156,12 +156,12 @@ <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="goToProductAttributes"/> <!--Create new Product Attribute with Price--> - <actionGroup ref="createProductAttribute" stepKey="createAttribute"> + <actionGroup ref="CreateProductAttributeActionGroup" stepKey="createAttribute"> <argument name="attribute" value="priceProductAttribute"/> </actionGroup> <!--Navigate to Product Attribute.--> - <actionGroup ref="navigateToEditProductAttribute" stepKey="goToEditPage"> + <actionGroup ref="NavigateToEditProductAttributeActionGroup" stepKey="goToEditPage"> <argument name="ProductAttribute" value="{{priceProductAttribute.attribute_code}}"/> </actionGroup> @@ -173,7 +173,7 @@ <!--Go to New Product page, add Attribute and check values--> <amOnPage url="{{AdminProductCreatePage.url('4', 'simple')}}" stepKey="goToCreateSimpleProductPage"/> - <actionGroup ref="addProductAttributeInProductModal" stepKey="addAttributeToProduct"> + <actionGroup ref="AddProductAttributeInProductModalActionGroup" stepKey="addAttributeToProduct"> <argument name="attributeCode" value="{{priceProductAttribute.attribute_code}}"/> </actionGroup> <click stepKey="openAttributes" selector="{{AdminProductAttributesSection.sectionHeader}}"/> @@ -197,7 +197,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="navigateToEditProductAttribute" stepKey="goToEditPage"> + <actionGroup ref="NavigateToEditProductAttributeActionGroup" stepKey="goToEditPage"> <argument name="ProductAttribute" value="{{dropdownProductAttribute.attribute_code}}"/> </actionGroup> <click stepKey="clickDelete" selector="{{AttributePropertiesSection.DeleteAttribute}}"/> @@ -210,25 +210,25 @@ <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="goToProductAttributes"/> <!--Create new Product Attribute as TextField, with code and default value.--> - <actionGroup ref="createProductAttribute" stepKey="createAttribute"> + <actionGroup ref="CreateProductAttributeActionGroup" stepKey="createAttribute"> <argument name="attribute" value="dropdownProductAttribute"/> </actionGroup> <!--Navigate to Product Attribute, add Product Options and Save - 1--> - <actionGroup ref="navigateToEditProductAttribute" stepKey="goToEditPage1"> + <actionGroup ref="NavigateToEditProductAttributeActionGroup" stepKey="goToEditPage1"> <argument name="ProductAttribute" value="{{dropdownProductAttribute.attribute_code}}"/> </actionGroup> - <actionGroup ref="createAttributeDropdownNthOption" stepKey="createOption1"> + <actionGroup ref="CreateAttributeDropdownNthOptionActionGroup" stepKey="createOption1"> <argument name="adminName" value="{{dropdownProductAttribute.option1_admin}}"/> <argument name="frontName" value="{{dropdownProductAttribute.option1_frontend}}"/> <argument name="row" value="1"/> </actionGroup> - <actionGroup ref="createAttributeDropdownNthOption" stepKey="createOption2"> + <actionGroup ref="CreateAttributeDropdownNthOptionActionGroup" stepKey="createOption2"> <argument name="adminName" value="{{dropdownProductAttribute.option2_admin}}"/> <argument name="frontName" value="{{dropdownProductAttribute.option2_frontend}}"/> <argument name="row" value="2"/> </actionGroup> - <actionGroup ref="createAttributeDropdownNthOptionAsDefault" stepKey="createOption3"> + <actionGroup ref="CreateAttributeDropdownNthOptionAsDefaultActionGroup" stepKey="createOption3"> <argument name="adminName" value="{{dropdownProductAttribute.option3_admin}}"/> <argument name="frontName" value="{{dropdownProductAttribute.option3_frontend}}"/> <argument name="row" value="3"/> @@ -236,7 +236,7 @@ <click stepKey="saveAttribute" selector="{{AttributePropertiesSection.Save}}"/> <!--Perform appropriate assertions against dropdownProductAttribute entity--> - <actionGroup ref="navigateToEditProductAttribute" stepKey="goToEditPageForAssertions"> + <actionGroup ref="NavigateToEditProductAttributeActionGroup" stepKey="goToEditPageForAssertions"> <argument name="ProductAttribute" value="{{dropdownProductAttribute.attribute_code}}"/> </actionGroup> <seeInField stepKey="assertLabel" selector="{{AttributePropertiesSection.DefaultLabel}}" userInput="{{dropdownProductAttribute.attribute_code}}"/> @@ -257,7 +257,7 @@ <!--Go to New Product page, add Attribute and check dropdown values--> <amOnPage url="{{AdminProductCreatePage.url('4', 'simple')}}" stepKey="goToCreateSimpleProductPage"/> - <actionGroup ref="addProductAttributeInProductModal" stepKey="addAttributeToProduct"> + <actionGroup ref="AddProductAttributeInProductModalActionGroup" stepKey="addAttributeToProduct"> <argument name="attributeCode" value="{{dropdownProductAttribute.attribute_code}}"/> </actionGroup> <click stepKey="openAttributes" selector="{{AdminProductAttributesSection.sectionHeader}}"/> @@ -284,7 +284,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="navigateToEditProductAttribute" stepKey="goToEditPage"> + <actionGroup ref="NavigateToEditProductAttributeActionGroup" stepKey="goToEditPage"> <argument name="ProductAttribute" value="{{dropdownProductAttributeWithQuote.attribute_code}}"/> </actionGroup> <click stepKey="clickDelete" selector="{{AttributePropertiesSection.DeleteAttribute}}"/> @@ -297,15 +297,15 @@ <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="goToProductAttributes"/> <!--Create new Product Attribute as TextField, with code and default value.--> - <actionGroup ref="createProductAttribute" stepKey="createAttribute"> + <actionGroup ref="CreateProductAttributeActionGroup" stepKey="createAttribute"> <argument name="attribute" value="dropdownProductAttributeWithQuote"/> </actionGroup> <!--Navigate to Product Attribute, add Product Option and Save - 1--> - <actionGroup ref="navigateToEditProductAttribute" stepKey="goToEditPage1"> + <actionGroup ref="NavigateToEditProductAttributeActionGroup" stepKey="goToEditPage1"> <argument name="ProductAttribute" value="{{dropdownProductAttributeWithQuote.attribute_code}}"/> </actionGroup> - <actionGroup ref="createAttributeDropdownNthOptionAsDefault" stepKey="createOption1"> + <actionGroup ref="CreateAttributeDropdownNthOptionAsDefaultActionGroup" stepKey="createOption1"> <argument name="adminName" value="{{dropdownProductAttributeWithQuote.option1_admin}}"/> <argument name="frontName" value="{{dropdownProductAttributeWithQuote.option1_frontend}}"/> <argument name="row" value="1"/> @@ -313,7 +313,7 @@ <click stepKey="saveAttribute" selector="{{AttributePropertiesSection.Save}}"/> <!--Perform appropriate assertions against dropdownProductAttribute entity--> - <actionGroup ref="navigateToEditProductAttribute" stepKey="goToEditPageForAssertions"> + <actionGroup ref="NavigateToEditProductAttributeActionGroup" stepKey="goToEditPageForAssertions"> <argument name="ProductAttribute" value="{{dropdownProductAttributeWithQuote.attribute_code}}"/> </actionGroup> <seeInField stepKey="assertLabel" selector="{{AttributePropertiesSection.DefaultLabel}}" userInput="{{dropdownProductAttributeWithQuote.attribute_code}}"/> @@ -328,7 +328,7 @@ <!--Go to New Product page, add Attribute and check dropdown values--> <amOnPage url="{{AdminProductCreatePage.url('4', 'simple')}}" stepKey="goToCreateSimpleProductPage"/> - <actionGroup ref="addProductAttributeInProductModal" stepKey="addAttributeToProduct"> + <actionGroup ref="AddProductAttributeInProductModalActionGroup" stepKey="addAttributeToProduct"> <argument name="attributeCode" value="{{dropdownProductAttributeWithQuote.attribute_code}}"/> </actionGroup> <click stepKey="openAttributes" selector="{{AdminProductAttributesSection.sectionHeader}}"/> @@ -352,7 +352,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="navigateToEditProductAttribute" stepKey="goToEditPage"> + <actionGroup ref="NavigateToEditProductAttributeActionGroup" stepKey="goToEditPage"> <argument name="ProductAttribute" value="{{multiselectProductAttribute.attribute_code}}"/> </actionGroup> <click stepKey="clickDelete" selector="{{AttributePropertiesSection.DeleteAttribute}}"/> @@ -365,25 +365,25 @@ <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="goToProductAttributes"/> <!--Create new Product Attribute as TextField, with code and default value.--> - <actionGroup ref="createProductAttribute" stepKey="createAttribute"> + <actionGroup ref="CreateProductAttributeActionGroup" stepKey="createAttribute"> <argument name="attribute" value="multiselectProductAttribute"/> </actionGroup> <!--Navigate to Product Attribute, add Product Options and Save - 1--> - <actionGroup ref="navigateToEditProductAttribute" stepKey="goToEditPage1"> + <actionGroup ref="NavigateToEditProductAttributeActionGroup" stepKey="goToEditPage1"> <argument name="ProductAttribute" value="{{multiselectProductAttribute.attribute_code}}"/> </actionGroup> - <actionGroup ref="createAttributeDropdownNthOption" stepKey="createOption1"> + <actionGroup ref="CreateAttributeDropdownNthOptionActionGroup" stepKey="createOption1"> <argument name="adminName" value="{{multiselectProductAttribute.option1_admin}}"/> <argument name="frontName" value="{{multiselectProductAttribute.option1_frontend}}"/> <argument name="row" value="1"/> </actionGroup> - <actionGroup ref="createAttributeDropdownNthOption" stepKey="createOption2"> + <actionGroup ref="CreateAttributeDropdownNthOptionActionGroup" stepKey="createOption2"> <argument name="adminName" value="{{multiselectProductAttribute.option2_admin}}"/> <argument name="frontName" value="{{multiselectProductAttribute.option2_frontend}}"/> <argument name="row" value="2"/> </actionGroup> - <actionGroup ref="createAttributeDropdownNthOptionAsDefault" stepKey="createOption3"> + <actionGroup ref="CreateAttributeDropdownNthOptionAsDefaultActionGroup" stepKey="createOption3"> <argument name="adminName" value="{{multiselectProductAttribute.option3_admin}}"/> <argument name="frontName" value="{{multiselectProductAttribute.option3_frontend}}"/> <argument name="row" value="3"/> @@ -391,7 +391,7 @@ <click stepKey="saveAttribute" selector="{{AttributePropertiesSection.Save}}"/> <!--Perform appropriate assertions against multiselectProductAttribute entity--> - <actionGroup ref="navigateToEditProductAttribute" stepKey="goToEditPageForAssertions"> + <actionGroup ref="NavigateToEditProductAttributeActionGroup" stepKey="goToEditPageForAssertions"> <argument name="ProductAttribute" value="{{multiselectProductAttribute.attribute_code}}"/> </actionGroup> <seeInField stepKey="assertLabel" selector="{{AttributePropertiesSection.DefaultLabel}}" userInput="{{multiselectProductAttribute.attribute_code}}"/> @@ -412,7 +412,7 @@ <!--Go to New Product page, add Attribute and check multiselect values--> <amOnPage url="{{AdminProductCreatePage.url('4', 'simple')}}" stepKey="goToCreateSimpleProductPage"/> - <actionGroup ref="addProductAttributeInProductModal" stepKey="addAttributeToProduct"> + <actionGroup ref="AddProductAttributeInProductModalActionGroup" stepKey="addAttributeToProduct"> <argument name="attributeCode" value="{{multiselectProductAttribute.attribute_code}}"/> </actionGroup> <click stepKey="openAttributes" selector="{{AdminProductAttributesSection.sectionHeader}}"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/DeleteCategoriesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/DeleteCategoriesTest.xml index 674d46b9c18b1..8609d50fecaf2 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/DeleteCategoriesTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/DeleteCategoriesTest.xml @@ -98,7 +98,7 @@ <!--<argument name="category" value="$$createCategoryC$$"/>--> <!--<argument name="productCount" value="2"/>--> <!--</actionGroup>--> - <!--<actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="browseAssertCategoryProduct1">--> + <!--<actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="browseAssertCategoryProduct1">--> <!--<argument name="product" value="$$createProduct1$$"/>--> <!--</actionGroup>--> @@ -109,7 +109,7 @@ <argument name="category" value="$$createSubCategory$$"/> <argument name="productCount" value="1"/> </actionGroup> - <actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="browseAssertCategoryProduct2"> + <actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="browseAssertCategoryProduct2"> <argument name="product" value="$$createProduct2$$"/> </actionGroup> @@ -118,17 +118,17 @@ <!--<argument name="category" value="$$createCategoryB$$"/>--> <!--<argument name="productCount" value="1"/>--> <!--</actionGroup>--> - <!--<actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="browseAssertCategoryProduct3">--> + <!--<actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="browseAssertCategoryProduct3">--> <!--<argument name="product" value="$$createProduct3$$"/>--> <!--</actionGroup>--> <!-- Delete Categories 1(with subcategory) and 3. --> <amOnPage url="{{AdminCategoryPage.url}}" stepKey="navigateToCategoryPageAfterStoreFrontCategoryAssertions"/> <waitForPageLoad time="30" stepKey="waitForCategoryPageLoadAfterStoreFrontCategoryAssertions"/> - <actionGroup ref="DeleteCategory" stepKey="deleteCategoryC"> + <actionGroup ref="DeleteCategoryActionGroup" stepKey="deleteCategoryC"> <argument name="categoryEntity" value="$$createCategoryC$$"/> </actionGroup> - <actionGroup ref="DeleteCategory" stepKey="deleteCategoryB"> + <actionGroup ref="DeleteCategoryActionGroup" stepKey="deleteCategoryB"> <argument name="categoryEntity" value="$$createCategoryB$$"/> </actionGroup> <!-- Verify categories 1 and 3 are absent --> @@ -139,17 +139,17 @@ <!-- Verify products 1-3 are available on storefront --> <amOnPage url="{{StorefrontHomePage.url}}$$createProduct1.custom_attributes[url_key]$$.html" stepKey="amOnProduct1Page"/> <waitForPageLoad stepKey="product1WaitForPageLoad"/> - <actionGroup ref="StorefrontCheckSimpleProduct" stepKey="browseAssertProduct1Page"> + <actionGroup ref="StorefrontCheckSimpleProductActionGroup" stepKey="browseAssertProduct1Page"> <argument name="product" value="$$createProduct1$$"/> </actionGroup> <amOnPage url="{{StorefrontHomePage.url}}$$createProduct2.custom_attributes[url_key]$$.html" stepKey="amOnProduct2Page"/> <waitForPageLoad stepKey="product2WaitForPageLoad"/> - <actionGroup ref="StorefrontCheckSimpleProduct" stepKey="browseAssertProduct2Page"> + <actionGroup ref="StorefrontCheckSimpleProductActionGroup" stepKey="browseAssertProduct2Page"> <argument name="product" value="$$createProduct2$$"/> </actionGroup> <amOnPage url="{{StorefrontHomePage.url}}$$createProduct3.custom_attributes[url_key]$$.html" stepKey="amOnProduct3Page"/> <waitForPageLoad stepKey="product3WaitForPageLoad"/> - <actionGroup ref="StorefrontCheckSimpleProduct" stepKey="browseAssertProduct3Page"> + <actionGroup ref="StorefrontCheckSimpleProductActionGroup" stepKey="browseAssertProduct3Page"> <argument name="product" value="$$createProduct3$$"/> </actionGroup> <!-- Rename New Root Category to Default category --> @@ -161,4 +161,4 @@ <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategoryDefaultCategory"/> <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="assertSuccessMessageAfterSaveDefaultCategory"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/DeleteUsedInConfigurableProductAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/DeleteUsedInConfigurableProductAttributeTest.xml index e79e4cea408fb..6706175a4da54 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/DeleteUsedInConfigurableProductAttributeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/DeleteUsedInConfigurableProductAttributeTest.xml @@ -81,7 +81,7 @@ <!-- Click Delete Attribute button --> <actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteProductAttributeByAttributeCode"> - <argument name="productAttributeCode" value="$$productAttributeHandle.attribute_code$$"/> + <argument name="ProductAttributeCode" value="$$productAttributeHandle.attribute_code$$"/> </actionGroup> <!-- Should see error message: This attribute is used in configurable products. --> @@ -102,4 +102,4 @@ <argument name="productAttribute" value="$$productAttributeHandle$$"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/DisplayRefreshCacheAfterChangingCategoryPageLayoutTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/DisplayRefreshCacheAfterChangingCategoryPageLayoutTest.xml index 02df8db5c2121..1f71ec1e6a850 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/DisplayRefreshCacheAfterChangingCategoryPageLayoutTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/DisplayRefreshCacheAfterChangingCategoryPageLayoutTest.xml @@ -35,7 +35,7 @@ </after> <!-- Navigate to category details page --> <comment userInput="Navigate to category details page" stepKey="navigateToAdminCategoryPage"/> - <actionGroup ref="goToAdminCategoryPageById" stepKey="goToAdminCategoryPage"> + <actionGroup ref="GoToAdminCategoryPageByIdActionGroup" stepKey="goToAdminCategoryPage"> <argument name="id" value="$$simpleCategory.id$$"/> </actionGroup> <!-- Open design tab and set layout --> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/EndToEndB2CAdminTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/EndToEndB2CAdminTest.xml index 1419ca4cb42ef..232321610eadc 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/EndToEndB2CAdminTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/EndToEndB2CAdminTest.xml @@ -31,40 +31,40 @@ <!--Create Simple Product--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPageSimple"/> <waitForPageLoad time="30" stepKey="waitForProductPageLoadSimple"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGridColumnsInitial"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateSimpleProduct"> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGridColumnsInitial"/> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateSimpleProduct"> <argument name="product" value="SimpleProduct"/> </actionGroup> - <actionGroup ref="checkRequiredFieldsInProductForm" stepKey="checkRequiredFieldsProductSimple"/> - <actionGroup ref="fillMainProductForm" stepKey="fillSimpleProductMain"> + <actionGroup ref="CheckRequiredFieldsInProductFormActionGroup" stepKey="checkRequiredFieldsProductSimple"/> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillSimpleProductMain"> <argument name="product" value="SimpleProduct"/> </actionGroup> - <actionGroup ref="addProductImage" stepKey="addImageForProductSimple"> + <actionGroup ref="AddProductImageActionGroup" stepKey="addImageForProductSimple"> <argument name="image" value="ProductImage"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveSimpleProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveSimpleProduct"/> <click selector="{{AdminProductFormActionSection.backButton}}" stepKey="clickBackToGridSimple"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridSimple"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProductGridSimple"> <argument name="product" value="SimpleProduct"/> </actionGroup> <grabAttributeFrom selector="{{AdminProductGridSection.productThumbnail('1')}}" userInput="src" stepKey="getSimpleProductThumbnail"/> <assertNotRegExp expected="'/placeholder\/thumbnail\.jpg/'" actual="$getSimpleProductThumbnail" stepKey="simpleThumbnailIsNotDefault"/> - <actionGroup ref="viewProductInAdminGrid" stepKey="seeSimpleProductInGrid"> + <actionGroup ref="ViewProductInAdminGridActionGroup" stepKey="seeSimpleProductInGrid"> <argument name="product" value="SimpleProduct"/> </actionGroup> <!--Create Virtual Product--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPageVirtual"/> <waitForPageLoad time="30" stepKey="waitForProductPageLoadVirtual"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateVirtualProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateVirtualProduct"> <argument name="product" value="VirtualProduct"/> </actionGroup> <fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{VirtualProduct.sku}}" stepKey="fillVirtualName"/> <fillField selector="{{AdminProductFormSection.productName}}" userInput="{{VirtualProduct.name}}" stepKey="fillVirtualSku"/> <fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{VirtualProduct.price}}" stepKey="fillVirtualPrice"/> <fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="{{VirtualProduct.quantity}}" stepKey="fillVirtualQty"/> - <actionGroup ref="saveProductForm" stepKey="saveVirtualProduct"/> - <actionGroup ref="viewProductInAdminGrid" stepKey="viewVirtualProductInGrid"> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveVirtualProduct"/> + <actionGroup ref="ViewProductInAdminGridActionGroup" stepKey="viewVirtualProductInGrid"> <argument name="product" value="VirtualProduct"/> </actionGroup> @@ -74,15 +74,15 @@ <waitForPageLoad stepKey="waitForProductGridPageLoad"/> <!--Search by keyword--> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetGridToDefaultKeywordSearch"/> - <actionGroup ref="searchProductGridByKeyword" stepKey="useKeywordSearchSimpleProduct"> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetGridToDefaultKeywordSearch"/> + <actionGroup ref="SearchProductGridByKeywordActionGroup" stepKey="useKeywordSearchSimpleProduct"> <argument name="keyword" value="SimpleProduct.name"/> </actionGroup> <seeNumberOfElements selector="{{AdminProductGridSection.productGridRows}}" userInput="1" stepKey="seeOnlyOneProductInGrid"/> <see selector="{{AdminProductGridSection.productGridCell('1', 'Name')}}" userInput="{{SimpleProduct.name}}" stepKey="seeOnlySimpleProductInGrid"/> <!--Paging works--> - <actionGroup ref="resetProductGridToDefaultView" stepKey="setProductGridToDefaultPagination"/> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="setProductGridToDefaultPagination"/> <comment userInput="Admin uses paging on product grid" stepKey="usePagingProductGridComment"/> <click selector="{{AdminProductGridPaginationSection.perPageDropdown}}" stepKey="clickProductPerPageDropdown"/> <click selector="{{AdminProductGridPaginationSection.perPageOption('50')}}" stepKey="selectProductsPerPage"/> @@ -100,14 +100,14 @@ <seeNumberOfElements selector="{{AdminProductGridSection.productGridRows}}" parameterArray="[1,5]" stepKey="seeProductsOnSecondPage"/> <!--Filtering works (by Name, By Price, by Status)--> - <actionGroup ref="resetProductGridToDefaultView" stepKey="setProductGridToDefaultFiltering"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridByGroupedSku"> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="setProductGridToDefaultFiltering"/> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProductGridByGroupedSku"> <argument name="product" value="GroupedProduct"/> </actionGroup> <seeNumberOfElements selector="{{AdminProductGridSection.productGridRows}}" userInput="1" stepKey="seeOneMatchingSkuInProductGrid"/> <see selector="{{AdminProductGridSection.productGridCell('1','SKU')}}" userInput="{{GroupedProduct.sku}}" stepKey="seeProductInFilteredGridSku"/> <!--Filter by price--> - <actionGroup ref="filterProductGridByPriceRange" stepKey="filterProductGridByPrice"> + <actionGroup ref="FilterProductGridByPriceRangeActionGroup" stepKey="filterProductGridByPrice"> <argument name="filter" value="PriceFilterRange"/> </actionGroup> <click selector="{{AdminProductGridSection.columnHeader('Price')}}" stepKey="clickPriceHeaderToSortAscForFilter"/> @@ -118,17 +118,17 @@ <assertRegExp expected="'/\$[0-9]{2}\.[0-9]{2}/'" actual="$getMaximumPriceInGrid" stepKey="assertMaximumPriceIsCorrect"/> <assertLessThan expected="$getMaximumPriceInGrid" actual="$getMinimumPriceInGrid" stepKey="checkPriceSortCorrect"/> <!--Filter by status--> - <actionGroup ref="filterProductGridByEnabledStatus" stepKey="filterGridByEnabledProducts"/> + <actionGroup ref="FilterProductGridByEnabledStatusActionGroup" stepKey="filterGridByEnabledProducts"/> <seeNumberOfElements selector="{{AdminProductGridSection.productGridRows}}" parameterArray="[1,20]" stepKey="seeEnabledProductsNotEmpty"/> <see selector="{{AdminProductGridSection.column('Status')}}" userInput="Enabled" stepKey="seeOnlyEnabledProducts"/> - <actionGroup ref="filterProductGridByDisabledStatus" stepKey="filterGridByDisabledProducts"/> + <actionGroup ref="FilterProductGridByDisabledStatusActionGroup" stepKey="filterGridByDisabledProducts"/> <dontSee selector="{{AdminProductGridSection.column('Status')}}" userInput="Enabled" stepKey="dontSeeEnabledProducts"/> <!--Sorting works (By Price, by ID)--> <!--By Price--> - <actionGroup ref="resetProductGridToDefaultView" stepKey="setProductGridToDefaultSortingPrice"/> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="setProductGridToDefaultSortingPrice"/> <!--Filter by price so grid contains prices that we can compare correctly--> - <actionGroup ref="filterProductGridByPriceRange" stepKey="filterProductGridByPriceForCompare"> + <actionGroup ref="FilterProductGridByPriceRangeActionGroup" stepKey="filterProductGridByPriceForCompare"> <argument name="filter" value="PriceFilterRange"/> </actionGroup> <!--Sort Ascending--> @@ -142,7 +142,7 @@ <grabTextFrom selector="{{AdminProductGridSection.productGridCell('2', 'Price')}}" stepKey="getSecondPriceSortDesc"/> <assertGreaterThanOrEqual expected="$getSecondPriceSortDesc" actual="$getFirstPriceSortDesc" stepKey="checkPriceDescSortCorrect"/> <!--By Product ID--> - <actionGroup ref="resetProductGridToDefaultView" stepKey="setProductGridToDefaultSortingId"/> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="setProductGridToDefaultSortingId"/> <!--Sort Ascending--> <grabTextFrom selector="{{AdminProductGridSection.productGridCell('1', 'ID')}}" stepKey="getFirstProductIdSortAsc"/> <grabTextFrom selector="{{AdminProductGridSection.productGridCell('2', 'ID')}}" stepKey="getSecondProductIdSortAsc"/> @@ -154,7 +154,7 @@ <assertGreaterThan expected="$getSecondProductIdSortDesc" actual="$getFirstProductIdSortDesc" stepKey="checkProductIdDescSortCorrect"/> <!--Adding column works--> - <actionGroup ref="resetProductGridToDefaultView" stepKey="setProductGridToDefaultColumns"/> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="setProductGridToDefaultColumns"/> <click selector="{{AdminProductGridFilterSection.columnsDropdown}}" stepKey="openColumnsDropdownToReset"/> <click selector="{{AdminProductGridFilterSection.resetGridColumns}}" stepKey="resetProductGridColumns"/> <click selector="{{AdminProductGridFilterSection.columnsDropdown}}" stepKey="closeColumnsDropdownAfterReset"/> @@ -170,7 +170,7 @@ <checkOption selector="{{AdminProductGridFilterSection.viewColumnOption('Weight')}}" stepKey="showWeightColumn"/> <click selector="{{AdminProductGridFilterSection.columnsDropdown}}" stepKey="closeColumnsDropdownWeight"/> <seeElement selector="{{AdminProductGridSection.columnHeader('Weight')}}" stepKey="seeWeightColumn"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridToCheckWeightColumn"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProductGridToCheckWeightColumn"> <argument name="product" value="SimpleProduct"/> </actionGroup> <see selector="{{AdminProductGridSection.productGridCell('1','Weight')}}" userInput="{{SimpleProduct.weight}}" stepKey="seeCorrectProductWeightInGrid"/> @@ -182,13 +182,13 @@ <waitForPageLoad time="30" stepKey="waitForCategoryPageLoad"/> <!--Create category under Default Category--> <click selector="{{AdminCategorySidebarTreeSection.categoryTreeRoot}}" stepKey="clickDefaultCategory"/> - <actionGroup ref="CheckCategoryNameIsRequiredField" stepKey="checkCategoryNameIsRequired"/> - <actionGroup ref="CreateCategory" stepKey="createCategory"> + <actionGroup ref="CheckCategoryNameIsRequiredFieldActionGroup" stepKey="checkCategoryNameIsRequired"/> + <actionGroup ref="CreateCategoryActionGroup" stepKey="createCategory"> <argument name="categoryEntity" value="_defaultCategory"/> </actionGroup> <!--Create category under newly created category--> <click selector="{{AdminCategorySidebarTreeSection.categoryInTree(_defaultCategory.name)}}" stepKey="clickCreatedCategoryInTree"/> - <actionGroup ref="CreateCategory" stepKey="createSubCategory"> + <actionGroup ref="CreateCategoryActionGroup" stepKey="createSubCategory"> <argument name="categoryEntity" value="SimpleSubCategory"/> </actionGroup> @@ -211,24 +211,24 @@ <comment userInput="Admin deletes category" stepKey="deleteCategoryComment"/> <amOnPage url="{{AdminCategoryPage.url}}" stepKey="onCategoryPageToDeleteCategory"/> <waitForPageLoad time="30" stepKey="waitForCategoryPageDelete"/> - <actionGroup ref="DeleteCategory" stepKey="deleteCategory"> + <actionGroup ref="DeleteCategoryActionGroup" stepKey="deleteCategory"> <argument name="categoryEntity" value="_defaultCategory"/> </actionGroup> <!--@TODO Move cleanup to "after" when MQE-830 is resolved--> <!--Clean up categories--> <comment userInput="Clean up categories" stepKey="cleanupCategoriesComment"/> - <actionGroup ref="DeleteCategory" stepKey="cleanSimpleSubCategory"> + <actionGroup ref="DeleteCategoryActionGroup" stepKey="cleanSimpleSubCategory"> <argument name="categoryEntity" value="SimpleSubCategory"/> </actionGroup> <!--Clean up products--> <comment userInput="Clean up simple product" stepKey="cleanUpSimpleProduct"/> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteSimpleProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteSimpleProduct"> <argument name="product" value="SimpleProduct"/> </actionGroup> <comment userInput="Clean up virtual product" stepKey="cleanUpVirtualProduct"/> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteVirtualProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteVirtualProduct"> <argument name="product" value="VirtualProduct"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/EndToEndB2CGuestUserTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/EndToEndB2CGuestUserTest.xml index ad66214e902fe..f7ebb090124d6 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/EndToEndB2CGuestUserTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/EndToEndB2CGuestUserTest.xml @@ -76,7 +76,7 @@ </actionGroup> <!-- Check simple product 1 in category --> <comment userInput="Check simple product 1 in category" stepKey="commentCheckSimpleProductInCategory" /> - <actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="browseAssertCategoryProduct1"> + <actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="browseAssertCategoryProduct1"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -84,7 +84,7 @@ <assertNotRegExp expected="'/placeholder\/small_image\.jpg/'" actual="$browseGrabSimpleProduct1ImageSrc" stepKey="browseAssertSimpleProduct1ImageNotDefault"/> <!-- Check simple product 2 in category --> <comment userInput="Check simple product 2 in category" stepKey="commentCheckSimpleProduct2InCategory" /> - <actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="browseAssertCategoryProduct2"> + <actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="browseAssertCategoryProduct2"> <argument name="product" value="$$createSimpleProduct2$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -95,7 +95,7 @@ <comment userInput="View simple product 1" stepKey="commentViewSimpleProduct1" after="browseAssertSimpleProduct2ImageNotDefault"/> <click selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createSimpleProduct1.name$$)}}" stepKey="browseClickCategorySimpleProduct1View" after="commentViewSimpleProduct1"/> <waitForLoadingMaskToDisappear stepKey="waitForSimpleProduct1Viewloaded" /> - <actionGroup ref="StorefrontCheckSimpleProduct" stepKey="browseAssertProduct1Page"> + <actionGroup ref="StorefrontCheckSimpleProductActionGroup" stepKey="browseAssertProduct1Page"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -107,7 +107,7 @@ <click selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="clickCategory1"/> <click selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createSimpleProduct2.name$$)}}" stepKey="browseClickCategorySimpleProduct2View"/> <waitForLoadingMaskToDisappear stepKey="waitForSimpleProduct2ViewLoaded" /> - <actionGroup ref="StorefrontCheckSimpleProduct" stepKey="browseAssertProduct2Page"> + <actionGroup ref="StorefrontCheckSimpleProductActionGroup" stepKey="browseAssertProduct2Page"> <argument name="product" value="$$createSimpleProduct2$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -125,7 +125,7 @@ <argument name="category" value="$$createCategory$$"/> <argument name="productCount" value="3"/> </actionGroup> - <actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="compareAssertSimpleProduct1"> + <actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="compareAssertSimpleProduct1"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -133,7 +133,7 @@ <assertNotRegExp expected="'/placeholder\/small_image\.jpg/'" actual="$compareGrabSimpleProduct1ImageSrc" stepKey="compareAssertSimpleProduct1ImageNotDefault"/> <click selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createSimpleProduct1.name$$)}}" stepKey="compareClickSimpleProduct1"/> <waitForLoadingMaskToDisappear stepKey="waitForCompareSimpleProduct1loaded" /> - <actionGroup ref="StorefrontCheckSimpleProduct" stepKey="compareAssertProduct1Page"> + <actionGroup ref="StorefrontCheckSimpleProductActionGroup" stepKey="compareAssertProduct1Page"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -151,7 +151,7 @@ <argument name="category" value="$$createCategory$$"/> <argument name="productCount" value="3"/> </actionGroup> - <actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="compareAssertSimpleProduct2"> + <actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="compareAssertSimpleProduct2"> <argument name="product" value="$$createSimpleProduct2$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -269,7 +269,7 @@ </actionGroup> <!-- Check simple product 1 in category --> <comment userInput="Check simple product 1 in category" stepKey="commentCheckSimpleProductInCategory" /> - <actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="browseAssertCategoryProduct1"> + <actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="browseAssertCategoryProduct1"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -277,7 +277,7 @@ <assertNotRegExp expected="'/placeholder\/small_image\.jpg/'" actual="$browseGrabSimpleProduct1ImageSrc" stepKey="browseAssertSimpleProduct1ImageNotDefault"/> <!-- Check simple product 2 in category --> <comment userInput="Check simple product 2 in category" stepKey="commentCheckSimpleProduct2InCategory" /> - <actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="browseAssertCategoryProduct2"> + <actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="browseAssertCategoryProduct2"> <argument name="product" value="$$createSimpleProduct2$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -288,7 +288,7 @@ <comment userInput="View simple product 1" stepKey="commentViewSimpleProduct1" after="browseAssertSimpleProduct2ImageNotDefault"/> <click selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createSimpleProduct1.name$$)}}" stepKey="browseClickCategorySimpleProduct1View" after="commentViewSimpleProduct1"/> <waitForLoadingMaskToDisappear stepKey="waitForSimpleProduct1Viewloaded" /> - <actionGroup ref="StorefrontCheckSimpleProduct" stepKey="browseAssertProduct1Page"> + <actionGroup ref="StorefrontCheckSimpleProductActionGroup" stepKey="browseAssertProduct1Page"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -300,7 +300,7 @@ <click selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="clickCategory1"/> <click selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createSimpleProduct2.name$$)}}" stepKey="browseClickCategorySimpleProduct2View"/> <waitForLoadingMaskToDisappear stepKey="waitForSimpleProduct2ViewLoaded" /> - <actionGroup ref="StorefrontCheckSimpleProduct" stepKey="browseAssertProduct2Page"> + <actionGroup ref="StorefrontCheckSimpleProductActionGroup" stepKey="browseAssertProduct2Page"> <argument name="product" value="$$createSimpleProduct2$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -318,7 +318,7 @@ <argument name="category" value="$$createCategory$$"/> <argument name="productCount" value="3"/> </actionGroup> - <actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="compareAssertSimpleProduct1"> + <actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="compareAssertSimpleProduct1"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -326,7 +326,7 @@ <assertNotRegExp expected="'/placeholder\/small_image\.jpg/'" actual="$compareGrabSimpleProduct1ImageSrc" stepKey="compareAssertSimpleProduct1ImageNotDefault"/> <click selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createSimpleProduct1.name$$)}}" stepKey="compareClickSimpleProduct1"/> <waitForLoadingMaskToDisappear stepKey="waitForCompareSimpleProduct1loaded" /> - <actionGroup ref="StorefrontCheckSimpleProduct" stepKey="compareAssertProduct1Page"> + <actionGroup ref="StorefrontCheckSimpleProductActionGroup" stepKey="compareAssertProduct1Page"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -344,7 +344,7 @@ <argument name="category" value="$$createCategory$$"/> <argument name="productCount" value="3"/> </actionGroup> - <actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="compareAssertSimpleProduct2"> + <actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="compareAssertSimpleProduct2"> <argument name="product" value="$$createSimpleProduct2$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml index 3f48c3ca811e3..74c6da1c47f60 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml @@ -61,7 +61,7 @@ </actionGroup> <!-- Check simple product 1 in category --> <comment userInput="Check simple product 1 in category" stepKey="commentCheckSimpleProductInCategory" after="browseAssertCategory"/> - <actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="browseAssertCategoryProduct1" after="commentCheckSimpleProductInCategory"> + <actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="browseAssertCategoryProduct1" after="commentCheckSimpleProductInCategory"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -69,7 +69,7 @@ <assertNotRegExp expected="'/placeholder\/small_image\.jpg/'" actual="$browseGrabSimpleProduct1ImageSrc" stepKey="browseAssertSimpleProduct1ImageNotDefault" after="browseGrabSimpleProduct1ImageSrc"/> <!-- Check simple product 2 in category --> <comment userInput="Check simple product 2 in category" stepKey="commentCheckSimpleProduct2InCategory" after="browseAssertSimpleProduct1ImageNotDefault"/> - <actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="browseAssertCategoryProduct2" after="commentCheckSimpleProduct2InCategory"> + <actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="browseAssertCategoryProduct2" after="commentCheckSimpleProduct2InCategory"> <argument name="product" value="$$createSimpleProduct2$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -80,7 +80,7 @@ <comment userInput="View simple product 1" stepKey="commentViewSimpleProduct1" after="browseAssertSimpleProduct2ImageNotDefault"/> <click selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createSimpleProduct1.name$$)}}" stepKey="browseClickCategorySimpleProduct1View" after="commentViewSimpleProduct1"/> <waitForLoadingMaskToDisappear stepKey="waitForSimpleProduct1Viewloaded" after="browseClickCategorySimpleProduct1View"/> - <actionGroup ref="StorefrontCheckSimpleProduct" stepKey="browseAssertProduct1Page" after="waitForSimpleProduct1Viewloaded"> + <actionGroup ref="StorefrontCheckSimpleProductActionGroup" stepKey="browseAssertProduct1Page" after="waitForSimpleProduct1Viewloaded"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -92,7 +92,7 @@ <click selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="clickCategory1" after="commentViewSimpleProduct2"/> <click selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createSimpleProduct2.name$$)}}" stepKey="browseClickCategorySimpleProduct2View" after="clickCategory1"/> <waitForLoadingMaskToDisappear stepKey="waitForSimpleProduct2ViewLoaded" after="browseClickCategorySimpleProduct2View"/> - <actionGroup ref="StorefrontCheckSimpleProduct" stepKey="browseAssertProduct2Page" after="waitForSimpleProduct2ViewLoaded"> + <actionGroup ref="StorefrontCheckSimpleProductActionGroup" stepKey="browseAssertProduct2Page" after="waitForSimpleProduct2ViewLoaded"> <argument name="product" value="$$createSimpleProduct2$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -110,7 +110,7 @@ <argument name="category" value="$$createCategory$$"/> <argument name="productCount" value="3"/> </actionGroup> - <actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="compareAssertSimpleProduct1" after="compareAssertCategory"> + <actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="compareAssertSimpleProduct1" after="compareAssertCategory"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -118,7 +118,7 @@ <assertNotRegExp expected="'/placeholder\/small_image\.jpg/'" actual="$compareGrabSimpleProduct1ImageSrc" stepKey="compareAssertSimpleProduct1ImageNotDefault" after="compareGrabSimpleProduct1ImageSrc"/> <click selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createSimpleProduct1.name$$)}}" stepKey="compareClickSimpleProduct1" after="compareAssertSimpleProduct1ImageNotDefault"/> <waitForLoadingMaskToDisappear stepKey="waitForCompareSimpleProduct1loaded" after="compareClickSimpleProduct1"/> - <actionGroup ref="StorefrontCheckSimpleProduct" stepKey="compareAssertProduct1Page" after="waitForCompareSimpleProduct1loaded"> + <actionGroup ref="StorefrontCheckSimpleProductActionGroup" stepKey="compareAssertProduct1Page" after="waitForCompareSimpleProduct1loaded"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -136,7 +136,7 @@ <argument name="category" value="$$createCategory$$"/> <argument name="productCount" value="3"/> </actionGroup> - <actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="compareAssertSimpleProduct2" after="compareAssertCategory1"> + <actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="compareAssertSimpleProduct2" after="compareAssertCategory1"> <argument name="product" value="$$createSimpleProduct2$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/SimpleProductTwoCustomOptionsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/SimpleProductTwoCustomOptionsTest.xml index 0049dcb504335..41bacc69baca4 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/SimpleProductTwoCustomOptionsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/SimpleProductTwoCustomOptionsTest.xml @@ -25,16 +25,16 @@ <!--Create product--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPage"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateSimpleProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateSimpleProduct"> <argument name="product" value="SimpleProduct3"/> </actionGroup> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillSimpleProductMain"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillSimpleProductMain"> <argument name="product" value="SimpleProduct3"/> </actionGroup> </before> <after> <!-- Delete the created product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="SimpleProduct3"/> </actionGroup> <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> @@ -45,14 +45,14 @@ <waitForPageLoad stepKey="waitForCustomOptionsOpen"/> <!-- Create a custom option with 2 values --> - <actionGroup ref="CreateCustomRadioOptions" stepKey="createCustomOption1"> + <actionGroup ref="CreateCustomRadioOptionsActionGroup" stepKey="createCustomOption1"> <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"> + <actionGroup ref="CreateCustomRadioOptionsActionGroup" stepKey="createCustomOption2"> <argument name="customOptionName" value="ProductOptionRadiobutton.title"/> <argument name="productOption" value="ProductOptionField"/> <argument name="productOption2" value="ProductOptionField2"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontCatalogNavigationMenuUIDesktopTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontCatalogNavigationMenuUIDesktopTest.xml index ae54b72a5a702..22ec0048497fa 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontCatalogNavigationMenuUIDesktopTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontCatalogNavigationMenuUIDesktopTest.xml @@ -21,10 +21,10 @@ <before> <!-- Login as admin --> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - <actionGroup ref="DeleteDefaultCategoryChildren" stepKey="deleteRootCategoryChildren"/> + <actionGroup ref="DeleteDefaultCategoryChildrenActionGroup" stepKey="deleteRootCategoryChildren"/> </before> <after> - <actionGroup ref="DeleteDefaultCategoryChildren" stepKey="deleteRootCategoryChildren"/> + <actionGroup ref="DeleteDefaultCategoryChildrenActionGroup" stepKey="deleteRootCategoryChildren"/> <actionGroup ref="AdminChangeStorefrontThemeActionGroup" stepKey="changeThemeToDefault"> <argument name="theme" value="{{MagentoLumaTheme.name}}"/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontEnsureThatAccordionAnchorIsVisibleOnViewportOnceClickedTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontEnsureThatAccordionAnchorIsVisibleOnViewportOnceClickedTest.xml index 0f9f542a97d02..034347dc32d82 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontEnsureThatAccordionAnchorIsVisibleOnViewportOnceClickedTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontEnsureThatAccordionAnchorIsVisibleOnViewportOnceClickedTest.xml @@ -84,7 +84,7 @@ <selectOption selector="{{AdminProductFormSection.customSelectField($$createFourthAttribute.attribute[attribute_code]$$)}}" userInput="$$createSecondOption.option[store_labels][0][label]$$" stepKey="setFourthAttributeValue"/> <!-- Save product form --> - <actionGroup ref="saveProductForm" stepKey="saveSimpleProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveSimpleProduct"/> <!-- Go to frontend and make a user account and login with it --> <actionGroup ref="SignUpNewUserFromStorefrontActionGroup" stepKey="signUpNewUser"> @@ -133,19 +133,19 @@ </actionGroup> <!-- Assert that product page has all product attributes in More Info tab --> - <actionGroup ref="checkAttributeInMoreInformationTab" stepKey="checkFirstAttributeInMoreInformationTab"> + <actionGroup ref="CheckAttributeInMoreInformationTabActionGroup" stepKey="checkFirstAttributeInMoreInformationTab"> <argument name="attributeLabel" value="$$createFirstAttribute.attribute[frontend_labels][0][label]$$"/> <argument name="attributeValue" value="$$createOption.option[store_labels][0][label]$$"/> </actionGroup> - <actionGroup ref="checkAttributeInMoreInformationTab" stepKey="checkSecondAttributeInMoreInformationTab"> + <actionGroup ref="CheckAttributeInMoreInformationTabActionGroup" stepKey="checkSecondAttributeInMoreInformationTab"> <argument name="attributeLabel" value="$$createSecondAttribute.attribute[frontend_labels][0][label]$$"/> <argument name="attributeValue" value="{{ProductAttributeOption8.value}}"/> </actionGroup> - <actionGroup ref="checkAttributeInMoreInformationTab" stepKey="checkThirdAttributeInMoreInformationTab"> + <actionGroup ref="CheckAttributeInMoreInformationTabActionGroup" stepKey="checkThirdAttributeInMoreInformationTab"> <argument name="attributeLabel" value="$$createThirdAttribute.attribute[frontend_labels][0][label]$$"/> <argument name="attributeValue" value="{{ProductAttributeOption8.value}}"/> </actionGroup> - <actionGroup ref="checkAttributeInMoreInformationTab" stepKey="checkFourthAttributeInMoreInformationTab"> + <actionGroup ref="CheckAttributeInMoreInformationTabActionGroup" stepKey="checkFourthAttributeInMoreInformationTab"> <argument name="attributeLabel" value="$$createFourthAttribute.attribute[frontend_labels][0][label]$$"/> <argument name="attributeValue" value="$$createSecondOption.option[store_labels][0][label]$$"/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontProductNameWithDoubleQuote.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontProductNameWithDoubleQuote.xml index 21f8e2e070e32..07c2e8a972596 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontProductNameWithDoubleQuote.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontProductNameWithDoubleQuote.xml @@ -29,17 +29,17 @@ <!--Create product via admin--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPage"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToProductCreatePage"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToProductCreatePage"> <argument name="product" value="SimpleProductNameWithDoubleQuote"/> </actionGroup> - <actionGroup ref="fillMainProductForm" stepKey="fillProductForm"> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillProductForm"> <argument name="product" value="SimpleProductNameWithDoubleQuote"/> </actionGroup> <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[$$createCategory.name$$]" stepKey="selectCategory"/> - <actionGroup ref="addProductImage" stepKey="addImageToProduct"> + <actionGroup ref="AddProductImageActionGroup" stepKey="addImageToProduct"> <argument name="image" value="ProductImage"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!--Run re-index task--> <magentoCLI command="indexer:reindex" stepKey="reindex"/> @@ -61,7 +61,7 @@ <see selector="{{StorefrontNavigationSection.breadcrumbs}}" userInput="{{SimpleProductNameWithDoubleQuote.name}}" stepKey="seeCorrectBreadCrumbProduct"/> <!--Remove product--> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="SimpleProductNameWithDoubleQuote"/> </actionGroup> </test> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontProductWithEmptyAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontProductWithEmptyAttributeTest.xml index 1c1b47a6bded9..db693b7229b17 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontProductWithEmptyAttributeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontProductWithEmptyAttributeTest.xml @@ -23,7 +23,7 @@ <createData entity="productAttributeWithDropdownTwoOptions" stepKey="createProductAttribute"/> </before> <after> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteSimpleProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteSimpleProduct"> <argument name="product" value="SimpleProduct"/> </actionGroup> <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/> @@ -38,7 +38,7 @@ <click selector="{{AttributeSetSection.Save}}" stepKey="saveAttributeSet"/> <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear" /> <seeElement selector=".message-success" stepKey="assertSuccess"/> - <actionGroup ref="FillAdminSimpleProductForm" stepKey="fillProductFieldsInAdmin"> + <actionGroup ref="FillAdminSimpleProductFormActionGroup" stepKey="fillProductFieldsInAdmin"> <argument name="category" value="$$createPreReqCategory$$"/> <argument name="simpleProduct" value="SimpleProduct"/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontRememberCategoryPaginationTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontRememberCategoryPaginationTest.xml index 0ed61b8636c4f..c8872425552be 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontRememberCategoryPaginationTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontRememberCategoryPaginationTest.xml @@ -1,68 +1,68 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> - <test name="StorefrontRememberCategoryPaginationTest"> - <annotations> - <title value="Verify that Number of Products per page retained when visiting a different category"/> - <stories value="MAGETWO-61478: Number of Products displayed per page not retained when visiting a different category"/> - <description value="Verify that Number of Products per page retained when visiting a different category"/> - <features value="Catalog"/> - <severity value="MAJOR"/> - <testCaseId value="MAGETWO-94210"/> - <group value="Catalog"/> - </annotations> - - <before> - <createData entity="_defaultCategory" stepKey="defaultCategory1"/> - <createData entity="SimpleProduct" stepKey="simpleProduct1"> - <requiredEntity createDataKey="defaultCategory1"/> - </createData> - - <createData entity="_defaultCategory" stepKey="defaultCategory2"/> - <createData entity="SimpleProduct" stepKey="simpleProduct2"> - <requiredEntity createDataKey="defaultCategory2"/> - </createData> - - <createData entity="RememberPaginationCatalogStorefrontConfig" stepKey="setRememberPaginationCatalogStorefrontConfig"/> - </before> - - <actionGroup ref="GoToStorefrontCategoryPageByParameters" stepKey="GoToStorefrontCategory1Page"> - <argument name="category" value="$$defaultCategory1.custom_attributes[url_key]$$"/> - <argument name="mode" value="grid"/> - <argument name="numOfProductsPerPage" value="12"/> - </actionGroup> - - <actionGroup ref="VerifyCategoryPageParameters" stepKey="verifyCategory1PageParameters"> - <argument name="category" value="$$defaultCategory1$$"/> - <argument name="mode" value="grid"/> - <argument name="numOfProductsPerPage" value="12"/> - </actionGroup> - - <amOnPage url="{{StorefrontCategoryPage.url($$defaultCategory2.name$$)}}" stepKey="navigateToCategory2Page"/> - <waitForPageLoad stepKey="waitForCategory2PageToLoad"/> - - <actionGroup ref="VerifyCategoryPageParameters" stepKey="verifyCategory2PageParameters"> - <argument name="category" value="$$defaultCategory2$$"/> - <argument name="mode" value="grid"/> - <argument name="numOfProductsPerPage" value="12"/> - </actionGroup> - - <after> - <createData entity="DefaultCatalogStorefrontConfiguration" stepKey="setDefaultCatalogStorefrontConfiguration"/> - - <deleteData createDataKey="simpleProduct1" stepKey="deleteProduct1"/> - <deleteData createDataKey="defaultCategory1" stepKey="deleteCategory1"/> - <deleteData createDataKey="simpleProduct2" stepKey="deleteProduct2"/> - <deleteData createDataKey="defaultCategory2" stepKey="deleteCategory2"/> - - <magentoCLI command="cache:flush" stepKey="flushCache"/> - - </after> - </test> -</tests> +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="StorefrontRememberCategoryPaginationTest"> + <annotations> + <title value="Verify that Number of Products per page retained when visiting a different category"/> + <stories value="MAGETWO-61478: Number of Products displayed per page not retained when visiting a different category"/> + <description value="Verify that Number of Products per page retained when visiting a different category"/> + <features value="Catalog"/> + <severity value="MAJOR"/> + <testCaseId value="MAGETWO-94210"/> + <group value="Catalog"/> + </annotations> + + <before> + <createData entity="_defaultCategory" stepKey="defaultCategory1"/> + <createData entity="SimpleProduct" stepKey="simpleProduct1"> + <requiredEntity createDataKey="defaultCategory1"/> + </createData> + + <createData entity="_defaultCategory" stepKey="defaultCategory2"/> + <createData entity="SimpleProduct" stepKey="simpleProduct2"> + <requiredEntity createDataKey="defaultCategory2"/> + </createData> + + <createData entity="RememberPaginationCatalogStorefrontConfig" stepKey="setRememberPaginationCatalogStorefrontConfig"/> + </before> + + <actionGroup ref="GoToStorefrontCategoryPageByParametersActionGroup" stepKey="GoToStorefrontCategory1Page"> + <argument name="category" value="$$defaultCategory1.custom_attributes[url_key]$$"/> + <argument name="mode" value="grid"/> + <argument name="numOfProductsPerPage" value="12"/> + </actionGroup> + + <actionGroup ref="VerifyCategoryPageParametersActionGroup" stepKey="verifyCategory1PageParameters"> + <argument name="category" value="$$defaultCategory1$$"/> + <argument name="mode" value="grid"/> + <argument name="numOfProductsPerPage" value="12"/> + </actionGroup> + + <amOnPage url="{{StorefrontCategoryPage.url($$defaultCategory2.name$$)}}" stepKey="navigateToCategory2Page"/> + <waitForPageLoad stepKey="waitForCategory2PageToLoad"/> + + <actionGroup ref="VerifyCategoryPageParametersActionGroup" stepKey="verifyCategory2PageParameters"> + <argument name="category" value="$$defaultCategory2$$"/> + <argument name="mode" value="grid"/> + <argument name="numOfProductsPerPage" value="12"/> + </actionGroup> + + <after> + <createData entity="DefaultCatalogStorefrontConfiguration" stepKey="setDefaultCatalogStorefrontConfiguration"/> + + <deleteData createDataKey="simpleProduct1" stepKey="deleteProduct1"/> + <deleteData createDataKey="defaultCategory1" stepKey="deleteCategory1"/> + <deleteData createDataKey="simpleProduct2" stepKey="deleteProduct2"/> + <deleteData createDataKey="defaultCategory2" stepKey="deleteCategory2"/> + + <magentoCLI command="cache:flush" stepKey="flushCache"/> + + </after> + </test> +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontSpecialPriceForDifferentTimezonesForWebsitesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontSpecialPriceForDifferentTimezonesForWebsitesTest.xml index 514e12bb355a8..3e887a0a83aa4 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontSpecialPriceForDifferentTimezonesForWebsitesTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontSpecialPriceForDifferentTimezonesForWebsitesTest.xml @@ -61,7 +61,7 @@ <actionGroup ref="AddSpecialPriceToProductActionGroup" stepKey="setSpecialPriceToCreatedProduct"> <argument name="price" value="15"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProductForm"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductForm"/> <!--Login to storefront from customer and check price--> <actionGroup ref="LoginToStorefrontActionGroup" stepKey="logInFromCustomer"> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/VerifyCategoryProductAndProductCategoryPartialReindexTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/VerifyCategoryProductAndProductCategoryPartialReindexTest.xml index deb6700c56990..e91f9742b2841 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/VerifyCategoryProductAndProductCategoryPartialReindexTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/VerifyCategoryProductAndProductCategoryPartialReindexTest.xml @@ -50,7 +50,7 @@ <createData entity="SimpleProduct2" stepKey="productC"/> <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> - <actionGroup ref="AdminAssignProductToCategory" stepKey="assignCategoryNAndMToProductC"> + <actionGroup ref="AdminAssignProductToCategoryActionGroup" stepKey="assignCategoryNAndMToProductC"> <argument name="productId" value="$$productC.id$$"/> <argument name="categoryName" value="$$categoryN.name$$, $$categoryM.name$$"/> </actionGroup> @@ -97,7 +97,7 @@ <!-- Open Products A, B, C to edit. Assign/unassign categories to/from them. Save changes --> <!-- Assign category K to Product A --> - <actionGroup ref="AdminAssignProductToCategory" stepKey="assignCategoryK"> + <actionGroup ref="AdminAssignProductToCategoryActionGroup" stepKey="assignCategoryK"> <argument name="productId" value="$$productA.id$$"/> <argument name="categoryName" value="$$categoryK.name$$"/> </actionGroup> @@ -109,7 +109,7 @@ </actionGroup> <!-- Assign category L to Product C --> - <actionGroup ref="AdminAssignProductToCategory" stepKey="assignCategoryNAndM"> + <actionGroup ref="AdminAssignProductToCategoryActionGroup" stepKey="assignCategoryNAndM"> <argument name="productId" value="$$productC.id$$"/> <argument name="categoryName" value="$$categoryL.name$$"/> </actionGroup> @@ -176,7 +176,7 @@ </actionGroup> <!-- Add Product B assignment for category N --> - <actionGroup ref="AdminAssignProductToCategory" stepKey="assignCategoryN"> + <actionGroup ref="AdminAssignProductToCategoryActionGroup" stepKey="assignCategoryN"> <argument name="productId" value="$$productB.id$$"/> <argument name="categoryName" value="$$categoryN.name$$"/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/VerifyChildCategoriesShouldNotIncludeInMenuTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/VerifyChildCategoriesShouldNotIncludeInMenuTest.xml index 455e9b58156eb..d39d54400279c 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/VerifyChildCategoriesShouldNotIncludeInMenuTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/VerifyChildCategoriesShouldNotIncludeInMenuTest.xml @@ -22,7 +22,7 @@ <amOnPage url="{{AdminCategoryPage.url}}" stepKey="navigateToCategoryPage2"/> <waitForPageLoad stepKey="waitForPageLoad3"/> <click selector="{{AdminCategorySidebarTreeSection.categoryInTree(SimpleSubCategory.name)}}" stepKey="clickOnCreatedSimpleSubCategoryBeforeDelete"/> - <actionGroup ref="DeleteCategory" stepKey="deleteCategory"> + <actionGroup ref="DeleteCategoryActionGroup" stepKey="deleteCategory"> <argument name="categoryEntity" value="SimpleSubCategory"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> @@ -32,11 +32,11 @@ <waitForPageLoad stepKey="waitForPageLoad1"/> <scrollToTopOfPage stepKey="scrollToTopOfPage"/> <!--Create new category under Default Category--> - <actionGroup ref="CreateCategory" stepKey="createSubcategory1"> + <actionGroup ref="CreateCategoryActionGroup" stepKey="createSubcategory1"> <argument name="categoryEntity" value="SimpleSubCategory"/> </actionGroup> <!--Create another subcategory under created category--> - <actionGroup ref="CreateCategory" stepKey="createSubcategory2"> + <actionGroup ref="CreateCategoryActionGroup" stepKey="createSubcategory2"> <argument name="categoryEntity" value="SubCategoryWithParent"/> </actionGroup> <!--Go to storefront and verify visibility of categories--> @@ -85,4 +85,4 @@ <dontSeeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(SimpleSubCategory.name)}}" stepKey="dontSeeSimpleSubCategoryOnStorefront3"/> <dontSeeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(SubCategoryWithParent.name)}}" stepKey="dontSeeSubCategoryWithParentOnStorefront4"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportImportConfigurableProductWithImagesTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportImportConfigurableProductWithImagesTest.xml index f0ec7dbd0706b..87e4f2d5b3be0 100644 --- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportImportConfigurableProductWithImagesTest.xml +++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportImportConfigurableProductWithImagesTest.xml @@ -150,7 +150,7 @@ <deleteData createDataKey="createExportImportCategory" stepKey="deleteExportImportCategory"/> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGridColumnsInitial"/> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGridColumnsInitial"/> <!-- Admin logout--> <actionGroup ref="logout" stepKey="adminLogout"/> </after> @@ -174,7 +174,7 @@ </actionGroup> <!-- Go to Catalog > Products. Find ConfProd and delete it --> - <actionGroup ref="deleteProductBySku" stepKey="deleteConfigurableProductBySku"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteConfigurableProductBySku"> <argument name="sku" value="$$createExportImportConfigurableProduct.sku$$"/> </actionGroup> @@ -187,7 +187,7 @@ </actionGroup> <!-- Go to Catalog > Products: Configurable product exists --> - <actionGroup ref="filterAndSelectProduct" stepKey="openConfigurableProduct"> + <actionGroup ref="FilterAndSelectProductActionGroup" stepKey="openConfigurableProduct"> <argument name="productSku" value="$$createExportImportConfigurableProduct.sku$$"/> </actionGroup> @@ -204,7 +204,7 @@ <!-- Go to "Images and Videos" section: assert image --> <scrollTo selector="{{AdminProductFormConfigurationsSection.sectionHeader}}" stepKey="scrollToProductGalleryTab"/> - <actionGroup ref="assertProductImageAdminProductPage" stepKey="assertProductImageAdminProductPage"> + <actionGroup ref="AssertProductImageAdminProductPageActionGroup" stepKey="assertProductImageAdminProductPage"> <argument name="image" value="MagentoLogo"/> </actionGroup> @@ -214,7 +214,7 @@ <waitForPageLoad stepKey="waitForProductPageLoad"/> <!-- Go to "Images and Videos" section: assert image --> <scrollTo selector="{{AdminProductFormConfigurationsSection.sectionHeader}}" stepKey="scrollToChildProductGalleryTab"/> - <actionGroup ref="assertProductImageAdminProductPage" stepKey="assertChildProductImageAdminProductPage"> + <actionGroup ref="AssertProductImageAdminProductPageActionGroup" stepKey="assertChildProductImageAdminProductPage"> <argument name="image" value="MagentoLogo"/> </actionGroup> <closeTab stepKey="closeConfigChildProductPage"/> diff --git a/app/code/Magento/CatalogInventory/Test/Mftf/Test/AdminCreateProductWithZeroMaximumQtyAllowedInShoppingCartTest.xml b/app/code/Magento/CatalogInventory/Test/Mftf/Test/AdminCreateProductWithZeroMaximumQtyAllowedInShoppingCartTest.xml index f7cf0a4deba4b..b6831738923e1 100644 --- a/app/code/Magento/CatalogInventory/Test/Mftf/Test/AdminCreateProductWithZeroMaximumQtyAllowedInShoppingCartTest.xml +++ b/app/code/Magento/CatalogInventory/Test/Mftf/Test/AdminCreateProductWithZeroMaximumQtyAllowedInShoppingCartTest.xml @@ -75,6 +75,6 @@ <argument name="qty" value="50"/> </actionGroup> <waitForElementNotVisible selector="{{AdminProductFormAdvancedInventorySection.advancedInventoryModal}}" stepKey="waitForModalFormToDisappear"/> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> </test> </tests> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithSpecialPricesTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithSpecialPricesTest.xml index 4df08fcca696b..6e3d87fb812a3 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithSpecialPricesTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithSpecialPricesTest.xml @@ -95,21 +95,21 @@ </after> <!-- Add special prices for products --> - <actionGroup ref="goToProductPageViaID" stepKey="goToFirstChildProduct"> + <actionGroup ref="GoToProductPageViaIDActionGroup" stepKey="goToFirstChildProduct"> <argument name="productId" value="$$createFirstConfigChildProduct.id$$"/> </actionGroup> <actionGroup ref="AddSpecialPriceToProductActionGroup" stepKey="addSpecialPriceForFirstProduct"> <argument name="price" value="{{specialProductPrice.price}}"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveFirstProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveFirstProduct"/> - <actionGroup ref="goToProductPageViaID" stepKey="goToSecondChildProduct"> + <actionGroup ref="GoToProductPageViaIDActionGroup" stepKey="goToSecondChildProduct"> <argument name="productId" value="$$createSecondConfigChildProduct.id$$"/> </actionGroup> <actionGroup ref="AddSpecialPriceToProductActionGroup" stepKey="addSpecialPriceForSecondProduct"> <argument name="price" value="{{specialProductPrice.price}}"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveSecondProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveSecondProduct"/> <!-- Create a new catalog price rule --> <actionGroup ref="newCatalogPriceRuleByUIWithConditionIsCategory" stepKey="newCatalogPriceRuleByUIWithConditionIsCategory"> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleEntityTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleEntityTest.xml index d80759531ecae..84f4a84b6fb05 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleEntityTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleEntityTest.xml @@ -78,7 +78,7 @@ <see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$$createProduct1.price$$" stepKey="seeTrueProductPrice1"/> <!-- Assert that the rule isn't present in the Shopping Cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProductToShoppingCart1"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProductToShoppingCart1"> <argument name="productName" value="$$createProduct1.name$$"/> </actionGroup> <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="openMiniShoppingCart1"/> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleTest.xml index 16fbca2697702..aea03b61eb153 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleTest.xml @@ -36,7 +36,7 @@ <after> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> - <actionGroup ref="deleteProductBySku" stepKey="deleteConfigurableProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteConfigurableProduct"> <argument name="sku" value="{{_defaultProduct.sku}}"/> </actionGroup> <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearProductsGridFilters"/> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogPriceRuleByProductAttributeTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogPriceRuleByProductAttributeTest.xml index b9d601238ac73..1615985370182 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogPriceRuleByProductAttributeTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogPriceRuleByProductAttributeTest.xml @@ -140,49 +140,49 @@ <selectOption selector="{{StorefrontPropertiesSection.useForPromoRuleConditions}}" userInput="Yes" stepKey="selectYes"/> <!-- Save the attribute --> - <actionGroup ref="saveProductAttribute" stepKey="saveAttribute"/> + <actionGroup ref="SaveProductAttributeActionGroup" stepKey="saveAttribute"/> <!-- Add this product attribute to Default attribute set --> <actionGroup ref="AdminOpenAttributeSetGridPageActionGroup" stepKey="openAttributeSetPage"/> <actionGroup ref="AdminOpenAttributeSetByNameActionGroup" stepKey="openDefaultAttributeSet"/> - <actionGroup ref="AssignAttributeToGroup" stepKey="assignAttributeToGroup"> + <actionGroup ref="AssignAttributeToGroupActionGroup" stepKey="assignAttributeToGroup"> <argument name="group" value="Product Details"/> <argument name="attribute" value="{{productAttributeDropdownTwoOptions.attribute_code}}"/> </actionGroup> - <actionGroup ref="SaveAttributeSet" stepKey="saveAttributeSet"/> + <actionGroup ref="SaveAttributeSetActionGroup" stepKey="saveAttributeSet"/> <!-- First Simple Product: choose green as attribute value --> - <actionGroup ref="filterAndSelectProduct" stepKey="openFirstSimpleProduct"> + <actionGroup ref="FilterAndSelectProductActionGroup" stepKey="openFirstSimpleProduct"> <argument name="productSku" value="$$createFirstProduct.sku$$"/> </actionGroup> <selectOption userInput="green" selector="{{AdminProductFormSection.customSelectField(productAttributeDropdownTwoOptions.attribute_code)}}" stepKey="selectGreen"/> - <actionGroup ref="saveProductForm" stepKey="saveFirstProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveFirstProduct"/> <!-- Second Simple Product: choose red as attribute value --> - <actionGroup ref="filterAndSelectProduct" stepKey="openSecondSimpleProduct"> + <actionGroup ref="FilterAndSelectProductActionGroup" stepKey="openSecondSimpleProduct"> <argument name="productSku" value="$$createSecondProduct.sku$$"/> </actionGroup> <selectOption userInput="red" selector="{{AdminProductFormSection.customSelectField(productAttributeDropdownTwoOptions.attribute_code)}}" stepKey="selectRed"/> - <actionGroup ref="saveProductForm" stepKey="saveSecondProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveSecondProduct"/> <!-- Configurable child product1: choose green as attribute value --> - <actionGroup ref="filterAndSelectProduct" stepKey="openConfigChild1Product"> + <actionGroup ref="FilterAndSelectProductActionGroup" stepKey="openConfigChild1Product"> <argument name="productSku" value="$$createConfigChildProduct1.sku$$"/> </actionGroup> <selectOption userInput="green" selector="{{AdminProductFormSection.customSelectField(productAttributeDropdownTwoOptions.attribute_code)}}" stepKey="selectGreenAttr"/> - <actionGroup ref="saveProductForm" stepKey="saveConfigChild1Product"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveConfigChild1Product"/> <!-- Configurable child product2: choose green as attribute value --> - <actionGroup ref="filterAndSelectProduct" stepKey="openConfigChild2Product"> + <actionGroup ref="FilterAndSelectProductActionGroup" stepKey="openConfigChild2Product"> <argument name="productSku" value="$$createConfigChildProduct2.sku$$"/> </actionGroup> <selectOption userInput="green" selector="{{AdminProductFormSection.customSelectField(productAttributeDropdownTwoOptions.attribute_code)}}" stepKey="selectGreenAttribute"/> - <actionGroup ref="saveProductForm" stepKey="saveConfigChild2Product"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveConfigChild2Product"/> <!-- Navigate to Marketing - Promotions - Catalog Price Rules --> <amOnPage url="{{AdminCatalogPriceRuleGridPage.url}}" stepKey="amOnCatalogPriceRule"/> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/Test/EndToEndB2CGuestUserTest.xml b/app/code/Magento/CatalogSearch/Test/Mftf/Test/EndToEndB2CGuestUserTest.xml index aa7cf933f6328..57940e39e9281 100644 --- a/app/code/Magento/CatalogSearch/Test/Mftf/Test/EndToEndB2CGuestUserTest.xml +++ b/app/code/Magento/CatalogSearch/Test/Mftf/Test/EndToEndB2CGuestUserTest.xml @@ -23,7 +23,7 @@ <waitForLoadingMaskToDisappear stepKey="waitForSearchProductsloaded" after="searchClickAdvancedSearchSubmitButton"/> <actionGroup ref="StorefrontCheckAdvancedSearchResultActionGroup" stepKey="searchCheckAdvancedSearchResult" after="waitForSearchProductsloaded"/> <see userInput="4" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.productCount}} span" stepKey="searchAdvancedAssertProductCount" after="searchCheckAdvancedSearchResult"/> - <actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="searchAssertSimpleProduct1" after="searchAdvancedAssertProductCount"> + <actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="searchAssertSimpleProduct1" after="searchAdvancedAssertProductCount"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -31,7 +31,7 @@ <assertNotRegExp expected="'/placeholder\/small_image\.jpg/'" actual="$searchAdvancedGrabSimpleProduct1ImageSrc" stepKey="searchAdvancedAssertSimpleProduct1ImageNotDefault" after="searchAdvancedGrabSimpleProduct1ImageSrc"/> <click selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createSimpleProduct1.name$$)}}" stepKey="searchClickSimpleProduct1View" after="searchAdvancedAssertSimpleProduct1ImageNotDefault"/> <waitForLoadingMaskToDisappear stepKey="waitForSearchSimpleProduct1Viewloaded" after="searchClickSimpleProduct1View"/> - <actionGroup ref="StorefrontCheckSimpleProduct" stepKey="searchAssertSimpleProduct1Page" after="waitForSearchSimpleProduct1Viewloaded"> + <actionGroup ref="StorefrontCheckSimpleProductActionGroup" stepKey="searchAssertSimpleProduct1Page" after="waitForSearchSimpleProduct1Viewloaded"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -51,14 +51,14 @@ <!-- Search simple product 1 --> <comment userInput="Search simple product 1" stepKey="commentSearchSimpleProduct1" after="searchAssertFilterCategoryProductCountCommonPart"/> - <actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="searchAssertFilterCategorySimpleProduct1" after="commentSearchSimpleProduct1"> + <actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="searchAssertFilterCategorySimpleProduct1" after="commentSearchSimpleProduct1"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> <grabAttributeFrom selector="{{StorefrontCategoryProductSection.ProductImageByName($$createSimpleProduct1.name$$)}}" userInput="src" stepKey="searchGrabSimpleProduct1ImageSrc" after="searchAssertFilterCategorySimpleProduct1"/> <assertNotRegExp expected="'/placeholder\/small_image\.jpg/'" actual="$searchGrabSimpleProduct1ImageSrc" stepKey="searchAssertSimpleProduct1ImageNotDefault" after="searchGrabSimpleProduct1ImageSrc"/> <!-- Search simple product2 --> - <actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="searchAssertFilterCategorySimpleProduct2" after="searchAssertSimpleProduct1ImageNotDefault"> + <actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="searchAssertFilterCategorySimpleProduct2" after="searchAssertSimpleProduct1ImageNotDefault"> <argument name="product" value="$$createSimpleProduct2$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -89,7 +89,7 @@ <waitForLoadingMaskToDisappear stepKey="waitForSearchProductsloaded" after="searchClickAdvancedSearchSubmitButton"/> <actionGroup ref="StorefrontCheckAdvancedSearchResultActionGroup" stepKey="searchCheckAdvancedSearchResult" after="waitForSearchProductsloaded"/> <see userInput="1" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.productCount}} span" stepKey="searchAdvancedAssertProductCount" after="searchCheckAdvancedSearchResult"/> - <actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="searchAssertSimpleProduct1" after="searchAdvancedAssertProductCount"> + <actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="searchAssertSimpleProduct1" after="searchAdvancedAssertProductCount"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -97,7 +97,7 @@ <assertNotRegExp expected="'/placeholder\/small_image\.jpg/'" actual="$searchAdvancedGrabSimpleProduct1ImageSrc" stepKey="searchAdvancedAssertSimpleProduct1ImageNotDefault" after="searchAdvancedGrabSimpleProduct1ImageSrc"/> <click selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createSimpleProduct1.name$$)}}" stepKey="searchClickSimpleProduct1View" after="searchAdvancedAssertSimpleProduct1ImageNotDefault"/> <waitForLoadingMaskToDisappear stepKey="waitForSearchSimpleProduct1Viewloaded" after="searchClickSimpleProduct1View"/> - <actionGroup ref="StorefrontCheckSimpleProduct" stepKey="searchAssertSimpleProduct1Page" after="waitForSearchSimpleProduct1Viewloaded"> + <actionGroup ref="StorefrontCheckSimpleProductActionGroup" stepKey="searchAssertSimpleProduct1Page" after="waitForSearchSimpleProduct1Viewloaded"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -117,14 +117,14 @@ <!-- Search simple product 1 --> <comment userInput="Search simple product 1" stepKey="commentSearchSimpleProduct1" after="searchAssertFilterCategoryProductCountCommonPart"/> - <actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="searchAssertFilterCategorySimpleProduct1" after="commentSearchSimpleProduct1"> + <actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="searchAssertFilterCategorySimpleProduct1" after="commentSearchSimpleProduct1"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> <grabAttributeFrom selector="{{StorefrontCategoryProductSection.ProductImageByName($$createSimpleProduct1.name$$)}}" userInput="src" stepKey="searchGrabSimpleProduct1ImageSrc" after="searchAssertFilterCategorySimpleProduct1"/> <assertNotRegExp expected="'/placeholder\/small_image\.jpg/'" actual="$searchGrabSimpleProduct1ImageSrc" stepKey="searchAssertSimpleProduct1ImageNotDefault" after="searchGrabSimpleProduct1ImageSrc"/> <!-- Search simple product2 --> - <actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="searchAssertFilterCategorySimpleProduct2" after="searchAssertSimpleProduct1ImageNotDefault"> + <actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="searchAssertFilterCategorySimpleProduct2" after="searchAssertSimpleProduct1ImageNotDefault"> <argument name="product" value="$$createSimpleProduct2$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml b/app/code/Magento/CatalogSearch/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml index 367cb6a6e214e..cd3dec912a3c1 100644 --- a/app/code/Magento/CatalogSearch/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml +++ b/app/code/Magento/CatalogSearch/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml @@ -23,7 +23,7 @@ <waitForLoadingMaskToDisappear stepKey="waitForSearchProductsloaded" after="searchClickAdvancedSearchSubmitButton"/> <actionGroup ref="StorefrontCheckAdvancedSearchResultActionGroup" stepKey="searchCheckAdvancedSearchResult" after="waitForSearchProductsloaded"/> <see userInput="1" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.productCount}} span" stepKey="searchAdvancedAssertProductCount" after="searchCheckAdvancedSearchResult"/> - <actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="searchAssertSimpleProduct1" after="searchAdvancedAssertProductCount"> + <actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="searchAssertSimpleProduct1" after="searchAdvancedAssertProductCount"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -31,7 +31,7 @@ <assertNotRegExp expected="'/placeholder\/small_image\.jpg/'" actual="$searchAdvancedGrabSimpleProduct1ImageSrc" stepKey="searchAdvancedAssertSimpleProduct1ImageNotDefault" after="searchAdvancedGrabSimpleProduct1ImageSrc"/> <click selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createSimpleProduct1.name$$)}}" stepKey="searchClickSimpleProduct1View" after="searchAdvancedAssertSimpleProduct1ImageNotDefault"/> <waitForLoadingMaskToDisappear stepKey="waitForSearchSimpleProduct1Viewloaded" after="searchClickSimpleProduct1View"/> - <actionGroup ref="StorefrontCheckSimpleProduct" stepKey="searchAssertSimpleProduct1Page" after="waitForSearchSimpleProduct1Viewloaded"> + <actionGroup ref="StorefrontCheckSimpleProductActionGroup" stepKey="searchAssertSimpleProduct1Page" after="waitForSearchSimpleProduct1Viewloaded"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -51,14 +51,14 @@ <!-- Search simple product 1 --> <comment userInput="Search simple product 1" stepKey="commentSearchSimpleProduct1" after="searchAssertFilterCategoryProductCountCommonPart"/> - <actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="searchAssertFilterCategorySimpleProduct1" after="commentSearchSimpleProduct1"> + <actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="searchAssertFilterCategorySimpleProduct1" after="commentSearchSimpleProduct1"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> <grabAttributeFrom selector="{{StorefrontCategoryProductSection.ProductImageByName($$createSimpleProduct1.name$$)}}" userInput="src" stepKey="searchGrabSimpleProduct1ImageSrc" after="searchAssertFilterCategorySimpleProduct1"/> <assertNotRegExp expected="'/placeholder\/small_image\.jpg/'" actual="$searchGrabSimpleProduct1ImageSrc" stepKey="searchAssertSimpleProduct1ImageNotDefault" after="searchGrabSimpleProduct1ImageSrc"/> <!-- Search simple product2 --> - <actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="searchAssertFilterCategorySimpleProduct2" after="searchAssertSimpleProduct1ImageNotDefault"> + <actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="searchAssertFilterCategorySimpleProduct2" after="searchAssertSimpleProduct1ImageNotDefault"> <argument name="product" value="$$createSimpleProduct2$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/Test/LayerNavigationOfCatalogSearchTest.xml b/app/code/Magento/CatalogSearch/Test/Mftf/Test/LayerNavigationOfCatalogSearchTest.xml index c8f84c732d6ba..fa9407495e6e7 100644 --- a/app/code/Magento/CatalogSearch/Test/Mftf/Test/LayerNavigationOfCatalogSearchTest.xml +++ b/app/code/Magento/CatalogSearch/Test/Mftf/Test/LayerNavigationOfCatalogSearchTest.xml @@ -42,7 +42,7 @@ </after> <!--Update value for price attribute of Product 1--> <comment userInput="Update value for price attribute of Product 1" stepKey="comment1"/> - <actionGroup ref="navigateToCreatedProductEditPage" stepKey="navigateToCreatedProductEditPage1"> + <actionGroup ref="NavigateToCreatedProductEditPageActionGroup" stepKey="navigateToCreatedProductEditPage1"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> <grabTextFrom selector="{{AdminProductFormSection.attributeLabelByText($$createPriceAttribute.attribute[frontend_labels][0][label]$$)}}" stepKey="grabAttributeLabel"/> @@ -51,7 +51,7 @@ <waitForPageLoad stepKey="waitForSimpleProductSaved1"/> <!--Update value for price attribute of Product 2--> <comment userInput="Update value for price attribute of Product 1" stepKey="comment2"/> - <actionGroup ref="navigateToCreatedProductEditPage" stepKey="navigateToCreatedProductEditPage2"> + <actionGroup ref="NavigateToCreatedProductEditPageActionGroup" stepKey="navigateToCreatedProductEditPage2"> <argument name="product" value="$$simpleProduct2$$"/> </actionGroup> <fillField selector="{{AdminProductAttributeSection.customAttribute($$createPriceAttribute.attribute_code$$)}}" userInput="70" stepKey="fillCustomPrice2"/> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml b/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml index 3b60e4b09de28..3aa044b650943 100644 --- a/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml +++ b/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml @@ -203,47 +203,47 @@ <!-- Create and Assign Attribute to product1--> - <actionGroup ref="goToProductPageViaID" stepKey="goToProduct1"> + <actionGroup ref="GoToProductPageViaIDActionGroup" stepKey="goToProduct1"> <argument name="productId" value="$product1.id$"/> </actionGroup> - <actionGroup ref="AdminCreateAttributeWithSearchWeight" stepKey="createProduct1Attribute"> + <actionGroup ref="AdminCreateAttributeWithSearchWeightActionGroup" stepKey="createProduct1Attribute"> <argument name="attributeType" value="Text Field"/> <argument name="attributeName" value="$product1.name$"/> <argument name="attributeSetName" value="$product1.name$"/> <argument name="weight" value="1"/> <argument name="defaultValue" value="{{_defaultProduct.name}}"/> </actionGroup> - <actionGroup ref="AdminProductPageSelectAttributeSet" stepKey="selectAttributeSet1"> + <actionGroup ref="AdminProductPageSelectAttributeSetActionGroup" stepKey="selectAttributeSet1"> <argument name="attributeSetName" value="$product1.name$"/> </actionGroup> <!--fill in default--> - <actionGroup ref="saveProductForm" stepKey="saveProduct1a"/> - <actionGroup ref="AdminProductPageFillTextAttributeValueByName" stepKey="fillDefault1"> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct1a"/> + <actionGroup ref="AdminProductPageFillTextAttributeValueByNameActionGroup" stepKey="fillDefault1"> <argument name="attributeName" value="$product1.name$"/> <argument name="value" value="{{_defaultProduct.name}}"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProduct1b"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct1b"/> <!-- Create and Assign Attribute to product2--> - <actionGroup ref="goToProductPageViaID" stepKey="goToProduct2"> + <actionGroup ref="GoToProductPageViaIDActionGroup" stepKey="goToProduct2"> <argument name="productId" value="$product2.id$"/> </actionGroup> - <actionGroup ref="AdminCreateAttributeWithSearchWeight" stepKey="createProduct2Attribute"> + <actionGroup ref="AdminCreateAttributeWithSearchWeightActionGroup" stepKey="createProduct2Attribute"> <argument name="attributeType" value="Text Field"/> <argument name="attributeName" value="$product2.name$"/> <argument name="attributeSetName" value="$product2.name$"/> <argument name="weight" value="1"/> <argument name="defaultValue" value="{{_defaultProduct.name}}"/> </actionGroup> - <actionGroup ref="AdminProductPageSelectAttributeSet" stepKey="selectAttributeSet2"> + <actionGroup ref="AdminProductPageSelectAttributeSetActionGroup" stepKey="selectAttributeSet2"> <argument name="attributeSetName" value="$product2.name$"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProduct2a"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct2a"/> <!--fill in default--> - <actionGroup ref="AdminProductPageFillTextAttributeValueByName" stepKey="fillDefault2"> + <actionGroup ref="AdminProductPageFillTextAttributeValueByNameActionGroup" stepKey="fillDefault2"> <argument name="attributeName" value="$product2.name$"/> <argument name="value" value="{{_defaultProduct.name}}"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProduct2b"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct2b"/> </before> <after> <deleteData stepKey="deleteProduct1" createDataKey="product1"/> @@ -275,7 +275,7 @@ <group value="mtf_migrated"/> </annotations> <before> - <actionGroup ref="AdminCreateAttributeWithSearchWeight" stepKey="createProduct1Attribute"> + <actionGroup ref="AdminCreateAttributeWithSearchWeightActionGroup" stepKey="createProduct1Attribute"> <argument name="attributeType" value="Text Field"/> <argument name="attributeName" value="$product1.name$"/> <argument name="attributeSetName" value="$product1.name$"/> @@ -377,7 +377,7 @@ </before> <after> <deleteData stepKey="deleteCategory" createDataKey="createCategory"/> - <actionGroup ref="deleteProductBySku" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteProduct"> <argument name="sku" value="{{_defaultProduct.sku}}"/> </actionGroup> <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearProductsGridFilters"/> @@ -446,7 +446,7 @@ </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - <actionGroup ref="deleteAllProductsUsingProductGrid" stepKey="deleteAllProducts"/> + <actionGroup ref="DeleteAllProductsUsingProductGridActionGroup" stepKey="deleteAllProducts"/> <createData entity="ApiProductWithDescription" stepKey="simple1"/> <createData entity="ApiGroupedProduct" stepKey="createProduct"/> <createData entity="OneSimpleProductLink" stepKey="addProductOne"> @@ -503,7 +503,7 @@ <!--Finish bundle creation--> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <amOnPage url="{{AdminProductEditPage.url($$createBundleProduct.id$$)}}" stepKey="goToProductEditPage"/> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!-- Perform reindex and flush cache --> <magentoCLI command="indexer:reindex" stepKey="reindex"/> @@ -570,7 +570,7 @@ <!--Finish bundle creation--> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <amOnPage url="{{AdminProductEditPage.url($$createBundleProduct.id$$)}}" stepKey="goToProductEditPage"/> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!-- Perform reindex and flush cache --> <magentoCLI command="indexer:reindex" stepKey="reindex"/> @@ -629,14 +629,14 @@ <!-- Assign attribute to set --> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <actionGroup ref="goToAttributeGridPage" stepKey="goToPage"/> - <actionGroup ref="goToAttributeSetByName" stepKey="goToSet"> + <actionGroup ref="GoToAttributeSetByNameActionGroup" stepKey="goToSet"> <argument name="name" value="$attributeSet.attribute_set_name$"/> </actionGroup> - <actionGroup ref="AssignAttributeToGroup" stepKey="assignToAttributeSetAndGroup"> + <actionGroup ref="AssignAttributeToGroupActionGroup" stepKey="assignToAttributeSetAndGroup"> <argument name="group" value="Product Details"/> <argument name="attribute" value="$createConfigProductAttribute.attribute_code$"/> </actionGroup> - <actionGroup ref="SaveAttributeSet" stepKey="savePage"/> + <actionGroup ref="SaveAttributeSetActionGroup" stepKey="savePage"/> <!-- Get the first option of the attribute we created --> <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1"> @@ -682,11 +682,11 @@ </actionGroup> <!-- Disable Child Product --> - <actionGroup ref="goToProductPageViaID" stepKey="goToChildProduct"> + <actionGroup ref="GoToProductPageViaIDActionGroup" stepKey="goToChildProduct"> <argument name="productId" value="$createConfigChildProduct1.id$"/> </actionGroup> - <actionGroup ref="toggleProductEnabled" stepKey="disableProduct"/> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="ToggleProductEnabledActionGroup" stepKey="disableProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToFrontPageAgain"/> <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="searchStorefrontAgain"> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontAdvancedSearchEntitySimpleProductTest.xml b/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontAdvancedSearchEntitySimpleProductTest.xml index 14df2133017d9..61f274cd13061 100644 --- a/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontAdvancedSearchEntitySimpleProductTest.xml +++ b/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontAdvancedSearchEntitySimpleProductTest.xml @@ -21,7 +21,7 @@ <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <!-- Delete all products left by prev tests because it sensitive for search--> - <actionGroup ref="deleteAllProductsUsingProductGrid" stepKey="deleteAllProducts"/> + <actionGroup ref="DeleteAllProductsUsingProductGridActionGroup" stepKey="deleteAllProducts"/> <!-- Create Data --> <createData entity="ABC_dfj_SimpleProduct" stepKey="createProduct"/> </before> diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/AdminCategoryWithRestrictedUrlKeyNotCreatedTest.xml b/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/AdminCategoryWithRestrictedUrlKeyNotCreatedTest.xml index 58b489da5082b..c3c7e3c3281f4 100644 --- a/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/AdminCategoryWithRestrictedUrlKeyNotCreatedTest.xml +++ b/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/AdminCategoryWithRestrictedUrlKeyNotCreatedTest.xml @@ -24,36 +24,36 @@ <after> <!--Delete created categories--> <comment userInput="Delete created categories" stepKey="commentDeleteCreatedCategories"/> - <actionGroup ref="AdminDeleteCategoryByName" stepKey="deleteAdminCategory"> + <actionGroup ref="AdminDeleteCategoryByNameActionGroup" stepKey="deleteAdminCategory"> <argument name="categoryName" value="admin"/> </actionGroup> - <actionGroup ref="AdminDeleteCategoryByName" stepKey="deleteSoapCategory"> + <actionGroup ref="AdminDeleteCategoryByNameActionGroup" stepKey="deleteSoapCategory"> <argument name="categoryName" value="soap"/> </actionGroup> - <actionGroup ref="AdminDeleteCategoryByName" stepKey="deleteRestCategory"> + <actionGroup ref="AdminDeleteCategoryByNameActionGroup" stepKey="deleteRestCategory"> <argument name="categoryName" value="rest"/> </actionGroup> - <actionGroup ref="AdminDeleteCategoryByName" stepKey="deleteGraphQlCategory"> + <actionGroup ref="AdminDeleteCategoryByNameActionGroup" stepKey="deleteGraphQlCategory"> <argument name="categoryName" value="graphql"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> </after> <!--Check category creation with restricted url key 'admin'--> <comment userInput="Check category creation with restricted url key 'admin'" stepKey="commentCheckAdminCategoryCreation"/> - <actionGroup ref="goToCreateCategoryPage" stepKey="goToCreateAdminCategoryPage"/> - <actionGroup ref="FillCategoryNameAndUrlKeyAndSave" stepKey="fillAdminFirstCategoryForm"> + <actionGroup ref="GoToCreateCategoryPageActionGroup" stepKey="goToCreateAdminCategoryPage"/> + <actionGroup ref="FillCategoryNameAndUrlKeyAndSaveActionGroup" stepKey="fillAdminFirstCategoryForm"> <argument name="categoryName" value="admin"/> <argument name="categoryUrlKey" value=""/> </actionGroup> <see selector="{{AdminMessagesSection.error}}" userInput='{{AdminCategoryRestrictedUrlErrorMessage.urlAdmin}}' stepKey="seeAdminFirstErrorMessage"/> - <actionGroup ref="FillCategoryNameAndUrlKeyAndSave" stepKey="fillAdminSecondCategoryForm"> + <actionGroup ref="FillCategoryNameAndUrlKeyAndSaveActionGroup" stepKey="fillAdminSecondCategoryForm"> <argument name="categoryName" value="{{SimpleSubCategory.name}}"/> <argument name="categoryUrlKey" value="admin"/> </actionGroup> <see selector="{{AdminMessagesSection.error}}" userInput='{{AdminCategoryRestrictedUrlErrorMessage.urlAdmin}}' stepKey="seeAdminSecondErrorMessage"/> <!--Create category with 'admin' name--> <comment userInput="Create category with 'admin' name" stepKey="commentAdminCategoryCreation"/> - <actionGroup ref="FillCategoryNameAndUrlKeyAndSave" stepKey="fillAdminThirdCategoryForm"> + <actionGroup ref="FillCategoryNameAndUrlKeyAndSaveActionGroup" stepKey="fillAdminThirdCategoryForm"> <argument name="categoryName" value="admin"/> <argument name="categoryUrlKey" value="{{SimpleSubCategory.name}}"/> </actionGroup> @@ -61,20 +61,20 @@ <seeElement selector="{{AdminCategorySidebarTreeSection.categoryByName('admin')}}" stepKey="seeAdminCategoryInTree"/> <!--Check category creation with restricted url key 'soap'--> <comment userInput="Check category creation with restricted url key 'soap'" stepKey="commentCheckSoapCategoryCreation"/> - <actionGroup ref="goToCreateCategoryPage" stepKey="goToCreateSoapCategoryPage"/> - <actionGroup ref="FillCategoryNameAndUrlKeyAndSave" stepKey="fillSoapFirstCategoryForm"> + <actionGroup ref="GoToCreateCategoryPageActionGroup" stepKey="goToCreateSoapCategoryPage"/> + <actionGroup ref="FillCategoryNameAndUrlKeyAndSaveActionGroup" stepKey="fillSoapFirstCategoryForm"> <argument name="categoryName" value="soap"/> <argument name="categoryUrlKey" value=""/> </actionGroup> <see selector="{{AdminMessagesSection.error}}" userInput='{{AdminCategoryRestrictedUrlErrorMessage.urlSoap}}' stepKey="seeSoapFirstErrorMessage"/> - <actionGroup ref="FillCategoryNameAndUrlKeyAndSave" stepKey="fillSoapSecondCategoryForm"> + <actionGroup ref="FillCategoryNameAndUrlKeyAndSaveActionGroup" stepKey="fillSoapSecondCategoryForm"> <argument name="categoryName" value="{{ApiCategory.name}}"/> <argument name="categoryUrlKey" value="soap"/> </actionGroup> <see selector="{{AdminMessagesSection.error}}" userInput='{{AdminCategoryRestrictedUrlErrorMessage.urlSoap}}' stepKey="seeSoapSecondErrorMessage"/> <!--Create category with 'soap' name--> <comment userInput="Create category with 'soap' name" stepKey="commentSoapCategoryCreation"/> - <actionGroup ref="FillCategoryNameAndUrlKeyAndSave" stepKey="fillSoapThirdCategoryForm"> + <actionGroup ref="FillCategoryNameAndUrlKeyAndSaveActionGroup" stepKey="fillSoapThirdCategoryForm"> <argument name="categoryName" value="soap"/> <argument name="categoryUrlKey" value="{{ApiCategory.name}}"/> </actionGroup> @@ -82,20 +82,20 @@ <seeElement selector="{{AdminCategorySidebarTreeSection.categoryByName('soap')}}" stepKey="seeSoapCategoryInTree"/> <!--Check category creation with restricted url key 'rest'--> <comment userInput="Check category creation with restricted url key 'rest'" stepKey="commentCheckRestCategoryCreation"/> - <actionGroup ref="goToCreateCategoryPage" stepKey="goToCreateRestCategoryPage"/> - <actionGroup ref="FillCategoryNameAndUrlKeyAndSave" stepKey="fillRestFirstCategoryForm"> + <actionGroup ref="GoToCreateCategoryPageActionGroup" stepKey="goToCreateRestCategoryPage"/> + <actionGroup ref="FillCategoryNameAndUrlKeyAndSaveActionGroup" stepKey="fillRestFirstCategoryForm"> <argument name="categoryName" value="rest"/> <argument name="categoryUrlKey" value=""/> </actionGroup> <see selector="{{AdminMessagesSection.error}}" userInput='{{AdminCategoryRestrictedUrlErrorMessage.urlRest}}' stepKey="seeRestFirstErrorMessage"/> - <actionGroup ref="FillCategoryNameAndUrlKeyAndSave" stepKey="fillRestSecondCategoryForm"> + <actionGroup ref="FillCategoryNameAndUrlKeyAndSaveActionGroup" stepKey="fillRestSecondCategoryForm"> <argument name="categoryName" value="{{SubCategoryWithParent.name}}"/> <argument name="categoryUrlKey" value="rest"/> </actionGroup> <see selector="{{AdminMessagesSection.error}}" userInput='{{AdminCategoryRestrictedUrlErrorMessage.urlRest}}' stepKey="seeRestSecondErrorMessage"/> <!--Create category with 'rest' name--> <comment userInput="Create category with 'rest' name" stepKey="commentRestCategoryCreation"/> - <actionGroup ref="FillCategoryNameAndUrlKeyAndSave" stepKey="fillRestThirdCategoryForm"> + <actionGroup ref="FillCategoryNameAndUrlKeyAndSaveActionGroup" stepKey="fillRestThirdCategoryForm"> <argument name="categoryName" value="rest"/> <argument name="categoryUrlKey" value="{{SubCategoryWithParent.name}}"/> </actionGroup> @@ -103,20 +103,20 @@ <seeElement selector="{{AdminCategorySidebarTreeSection.categoryByName('rest')}}" stepKey="seeRestCategoryInTree"/> <!--Check category creation with restricted url key 'graphql'--> <comment userInput="Check category creation with restricted url key 'graphql'" stepKey="commentCheckGraphQlCategoryCreation"/> - <actionGroup ref="goToCreateCategoryPage" stepKey="goToCreateCategoryPage"/> - <actionGroup ref="FillCategoryNameAndUrlKeyAndSave" stepKey="fillGraphQlFirstCategoryForm"> + <actionGroup ref="GoToCreateCategoryPageActionGroup" stepKey="goToCreateCategoryPage"/> + <actionGroup ref="FillCategoryNameAndUrlKeyAndSaveActionGroup" stepKey="fillGraphQlFirstCategoryForm"> <argument name="categoryName" value="graphql"/> <argument name="categoryUrlKey" value=""/> </actionGroup> <see selector="{{AdminMessagesSection.error}}" userInput='{{AdminCategoryRestrictedUrlErrorMessage.urlGraphql}}' stepKey="seeGraphQlFirstErrorMessage"/> - <actionGroup ref="FillCategoryNameAndUrlKeyAndSave" stepKey="fillGraphQlSecondCategoryForm"> + <actionGroup ref="FillCategoryNameAndUrlKeyAndSaveActionGroup" stepKey="fillGraphQlSecondCategoryForm"> <argument name="categoryName" value="{{NewSubCategoryWithParent.name}}"/> <argument name="categoryUrlKey" value="graphql"/> </actionGroup> <see selector="{{AdminMessagesSection.error}}" userInput='{{AdminCategoryRestrictedUrlErrorMessage.urlGraphql}}' stepKey="seeGraphQlSecondErrorMessage"/> <!--Create category with 'graphql' name--> <comment userInput="Create category with 'graphql' name" stepKey="commentGraphQlCategoryCreation"/> - <actionGroup ref="FillCategoryNameAndUrlKeyAndSave" stepKey="fillGraphQlThirdCategoryForm"> + <actionGroup ref="FillCategoryNameAndUrlKeyAndSaveActionGroup" stepKey="fillGraphQlThirdCategoryForm"> <argument name="categoryName" value="graphql"/> <argument name="categoryUrlKey" value="{{NewSubCategoryWithParent.name}}"/> </actionGroup> diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/AdminUrlForProductRewrittenCorrectlyTest.xml b/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/AdminUrlForProductRewrittenCorrectlyTest.xml index 5423267676507..cc5f09faca57b 100644 --- a/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/AdminUrlForProductRewrittenCorrectlyTest.xml +++ b/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/AdminUrlForProductRewrittenCorrectlyTest.xml @@ -41,7 +41,7 @@ <waitForPageLoad stepKey="waitForEditPage"/> <!--Switch to Default Store view--> - <actionGroup ref="SwitchToTheNewStoreView" stepKey="selectSecondStoreView"> + <actionGroup ref="SwitchToTheNewStoreViewActionGroup" stepKey="selectSecondStoreView"> <argument name="storeViewName" value="Default Store View"/> </actionGroup> <waitForPageLoad stepKey="waitForStoreViewLoad"/> @@ -51,12 +51,12 @@ <waitForElementVisible selector="{{AdminProductSEOSection.useDefaultUrl}}" stepKey="waitForUseDefaultUrlCheckbox"/> <click selector="{{AdminProductSEOSection.useDefaultUrl}}" stepKey="clickUseDefaultUrlCheckbox"/> <fillField selector="{{AdminProductSEOSection.urlKeyInput}}" userInput="$$createProduct.sku$$-new" stepKey="changeUrlKey"/> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!--Select product and go toUpdate Attribute page--> <amOnPage url="{{ProductCatalogPage.url}}" stepKey="GoToCatalogPageChangingView"/> <waitForPageLoad stepKey="WaitForPageToLoadFullyChangingView"/> - <actionGroup ref="filterProductGridByName" stepKey="filterBundleProductOptionsDownToName"> + <actionGroup ref="FilterProductGridByNameActionGroup" stepKey="filterBundleProductOptionsDownToName"> <argument name="product" value="ApiSimpleProduct"/> </actionGroup> <click selector="{{AdminProductFiltersSection.allCheckbox}}" stepKey="ClickOnSelectAllCheckBoxChangingView"/> diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/RewriteStoreLevelUrlKeyOfChildCategoryTest.xml b/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/RewriteStoreLevelUrlKeyOfChildCategoryTest.xml index 67870c51140a6..c3a358bbbd292 100644 --- a/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/RewriteStoreLevelUrlKeyOfChildCategoryTest.xml +++ b/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/RewriteStoreLevelUrlKeyOfChildCategoryTest.xml @@ -1,67 +1,67 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> - <test name="RewriteStoreLevelUrlKeyOfChildCategoryTest"> - <annotations> - <title value="Rewriting Store-level URL key of child category"/> - <stories value="MAGETWO-91649: #13513: Magento ignore store-level url_key of child category in URL rewrite process for global scope"/> - <description value="Rewriting Store-level URL key of child category"/> - <features value="CatalogUrlRewrite"/> - <severity value="MAJOR"/> - <testCaseId value="MAGETWO-94934"/> - <group value="CatalogUrlRewrite"/> - </annotations> - - <before> - <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - <actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createStoreView" /> - - <createData entity="_defaultCategory" stepKey="defaultCategory"/> - <createData entity="SubCategoryWithParent" stepKey="subCategory"> - <requiredEntity createDataKey="defaultCategory"/> - </createData> - </before> - - <actionGroup ref="navigateToCreatedCategory" stepKey="navigateToCreatedSubCategory"> - <argument name="Category" value="$$subCategory$$"/> - </actionGroup> - - <actionGroup ref="AdminSwitchStoreViewActionGroup" stepKey="AdminSwitchStoreViewForSubCategory"/> - - <actionGroup ref="ChangeSeoUrlKeyForSubCategory" stepKey="changeSeoUrlKeyForSubCategory"> - <argument name="value" value="bags-second"/> - </actionGroup> - - <actionGroup ref="navigateToCreatedCategory" stepKey="navigateToCreatedDefaultCategory"> - <argument name="Category" value="$$defaultCategory$$"/> - </actionGroup> - - <actionGroup ref="ChangeSeoUrlKey" stepKey="changeSeoUrlKeyForDefaultCategory"> - <argument name="value" value="gear-global"/> - </actionGroup> - - <amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToStorefrontPage"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - - <actionGroup ref="StorefrontSwitchStoreViewActionGroup" stepKey="storefrontSwitchStoreView"/> - - <actionGroup ref="GoToSubCategoryPage" stepKey="goToSubCategoryPage"> - <argument name="parentCategory" value="$$defaultCategory$$"/> - <argument name="subCategory" value="$$subCategory$$"/> - <argument name="urlPath" value="gear-global/bags-second"/> - </actionGroup> - - <after> - <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView"/> - <actionGroup ref="logout" stepKey="logout"/> - - <deleteData createDataKey="subCategory" stepKey="deleteSubCategory"/> - <deleteData createDataKey="defaultCategory" stepKey="deleteNewRootCategory"/> - </after> - </test> -</tests> +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="RewriteStoreLevelUrlKeyOfChildCategoryTest"> + <annotations> + <title value="Rewriting Store-level URL key of child category"/> + <stories value="MAGETWO-91649: #13513: Magento ignore store-level url_key of child category in URL rewrite process for global scope"/> + <description value="Rewriting Store-level URL key of child category"/> + <features value="CatalogUrlRewrite"/> + <severity value="MAJOR"/> + <testCaseId value="MAGETWO-94934"/> + <group value="CatalogUrlRewrite"/> + </annotations> + + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createStoreView" /> + + <createData entity="_defaultCategory" stepKey="defaultCategory"/> + <createData entity="SubCategoryWithParent" stepKey="subCategory"> + <requiredEntity createDataKey="defaultCategory"/> + </createData> + </before> + + <actionGroup ref="NavigateToCreatedCategoryActionGroup" stepKey="navigateToCreatedSubCategory"> + <argument name="Category" value="$$subCategory$$"/> + </actionGroup> + + <actionGroup ref="AdminSwitchStoreViewActionGroup" stepKey="AdminSwitchStoreViewForSubCategory"/> + + <actionGroup ref="ChangeSeoUrlKeyForSubCategoryActionGroup" stepKey="changeSeoUrlKeyForSubCategory"> + <argument name="value" value="bags-second"/> + </actionGroup> + + <actionGroup ref="NavigateToCreatedCategoryActionGroup" stepKey="navigateToCreatedDefaultCategory"> + <argument name="Category" value="$$defaultCategory$$"/> + </actionGroup> + + <actionGroup ref="ChangeSeoUrlKeyActionGroup" stepKey="changeSeoUrlKeyForDefaultCategory"> + <argument name="value" value="gear-global"/> + </actionGroup> + + <amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToStorefrontPage"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + + <actionGroup ref="StorefrontSwitchStoreViewActionGroup" stepKey="storefrontSwitchStoreView"/> + + <actionGroup ref="GoToSubCategoryPageActionGroup" stepKey="goToSubCategoryPage"> + <argument name="parentCategory" value="$$defaultCategory$$"/> + <argument name="subCategory" value="$$subCategory$$"/> + <argument name="urlPath" value="gear-global/bags-second"/> + </actionGroup> + + <after> + <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView"/> + <actionGroup ref="logout" stepKey="logout"/> + + <deleteData createDataKey="subCategory" stepKey="deleteSubCategory"/> + <deleteData createDataKey="defaultCategory" stepKey="deleteNewRootCategory"/> + </after> + </test> +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/CheckCheckoutSuccessPageTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/CheckCheckoutSuccessPageTest.xml index 163e71c50053f..971af9688e754 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/CheckCheckoutSuccessPageTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/CheckCheckoutSuccessPageTest.xml @@ -45,7 +45,7 @@ <waitForPageLoad stepKey="waitForCatalogPageLoad"/> <!--Add Product to Shopping Cart--> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage"> <argument name="productName" value="$$createSimpleProduct.name$$"/> </actionGroup> @@ -71,7 +71,7 @@ <waitForPageLoad stepKey="waitForCatalogPageLoad2"/> <!--Add Product to Shopping Cart--> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage2"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage2"> <argument name="productName" value="$$createSimpleProduct.name$$"/> </actionGroup> @@ -96,7 +96,7 @@ <waitForPageLoad stepKey="waitForCatalogPageLoad3"/> <!--Add Product to Shopping Cart--> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage3"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage3"> <argument name="productName" value="$$createSimpleProduct.name$$"/> </actionGroup> @@ -156,7 +156,7 @@ <waitForPageLoad stepKey="waitForCatalogPageLoad"/> <!--Add Product to Shopping Cart--> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage"> <argument name="productName" value="$$createSimpleProduct.name$$"/> </actionGroup> @@ -193,7 +193,7 @@ <waitForPageLoad stepKey="waitForCatalogPageLoad2"/> <!--Add Product to Shopping Cart--> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage2"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage2"> <argument name="productName" value="$$createSimpleProduct.name$$"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/CheckNotVisibleProductInMinicartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/CheckNotVisibleProductInMinicartTest.xml index 4b4ca1935fd78..f99678d9171b2 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/CheckNotVisibleProductInMinicartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/CheckNotVisibleProductInMinicartTest.xml @@ -27,7 +27,7 @@ <waitForPageLoad stepKey="waitForCatalogPageLoad"/> <!--Add simple product1 to Shopping Cart--> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage1"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage1"> <argument name="productName" value="$$createSimpleProduct1.name$$"/> </actionGroup> @@ -47,7 +47,7 @@ <waitForPageLoad stepKey="waitForCatalogPageLoad2"/> <!--Add simple product2 to Shopping Cart for updating cart items--> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage2"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage2"> <argument name="productName" value="$$createSimpleProduct2.name$$"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/ConfiguringInstantPurchaseFunctionalityTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/ConfiguringInstantPurchaseFunctionalityTest.xml index 0897e20f1b17d..aea0657cc2e3b 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/ConfiguringInstantPurchaseFunctionalityTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/ConfiguringInstantPurchaseFunctionalityTest.xml @@ -64,7 +64,7 @@ </actionGroup> <!-- Add product to cart --> - <actionGroup ref="AddSimpleProductToCart" stepKey="addProductToCart"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToCart"> <argument name="product" value="$$createProduct$$"/> </actionGroup> <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/DefaultBillingAddressShouldBeCheckedOnPaymentPageTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/DefaultBillingAddressShouldBeCheckedOnPaymentPageTest.xml index 166f5022d5aeb..c3fb83cd1a096 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/DefaultBillingAddressShouldBeCheckedOnPaymentPageTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/DefaultBillingAddressShouldBeCheckedOnPaymentPageTest.xml @@ -38,7 +38,7 @@ <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomer"/> </after> <!-- Add simple product to cart and go to checkout--> - <actionGroup ref="AddSimpleProductToCart" stepKey="addProductToCart"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToCart"> <argument name="product" value="$$createProduct$$"/> </actionGroup> <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/DeleteBundleDynamicProductFromShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/DeleteBundleDynamicProductFromShoppingCartTest.xml index 5ad4c764026f7..ef5f5b640b0a2 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/DeleteBundleDynamicProductFromShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/DeleteBundleDynamicProductFromShoppingCartTest.xml @@ -55,7 +55,7 @@ <!-- Add product to the cart --> <click selector="{{StorefrontBundleProductActionSection.customizeAndAddToCartButton}}" stepKey="clickCustomizeAndAddToCart"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProductToCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProductToCart"> <argument name="productName" value="$$createBundleDynamicProduct.name$$"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/DeleteBundleFixedProductFromShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/DeleteBundleFixedProductFromShoppingCartTest.xml index d1008c5831983..e141d0628cc4d 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/DeleteBundleFixedProductFromShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/DeleteBundleFixedProductFromShoppingCartTest.xml @@ -47,7 +47,7 @@ <!-- Add product to the cart --> <click selector="{{StorefrontBundleProductActionSection.customizeAndAddToCartButton}}" stepKey="clickCustomizeAndAddToCart"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProductToCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProductToCart"> <argument name="productName" value="$$createFixedBundleProduct.name$$"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/DeleteDownloadableProductFromShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/DeleteDownloadableProductFromShoppingCartTest.xml index e16ef70c23e3d..988e3b8d3129d 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/DeleteDownloadableProductFromShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/DeleteDownloadableProductFromShoppingCartTest.xml @@ -39,7 +39,7 @@ <!-- Add downloadable product to the cart --> <amOnPage url="{{StorefrontProductPage.url($$createDownloadableProduct.custom_attributes[url_key]$$)}}" stepKey="navigateToDownloadableProductPage"/> <waitForPageLoad stepKey="waitForDownloadableProductPageLoad"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartDownloadableProductFromStorefrontProductPage"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartDownloadableProductFromStorefrontProductPage"> <argument name="productName" value="$$createDownloadableProduct.name$$"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/DeleteVirtualProductFromShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/DeleteVirtualProductFromShoppingCartTest.xml index 97dcdd52127fd..969a827a8a461 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/DeleteVirtualProductFromShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/DeleteVirtualProductFromShoppingCartTest.xml @@ -33,7 +33,7 @@ <!-- Add virtual product to the cart --> <amOnPage url="{{StorefrontProductPage.url($$createVirtualProduct.custom_attributes[url_key]$$)}}" stepKey="navigateToProductPage"/> <waitForPageLoad stepKey="waitForProductPageLoad"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartVirtualProductFromStorefrontProductPage"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartVirtualProductFromStorefrontProductPage"> <argument name="productName" value="$$createVirtualProduct.name$$"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/EndToEndB2CGuestUserTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/EndToEndB2CGuestUserTest.xml index 4281a0eb77da8..7002479279a78 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/EndToEndB2CGuestUserTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/EndToEndB2CGuestUserTest.xml @@ -19,7 +19,7 @@ <argument name="category" value="$$createCategory$$"/> <argument name="productCount" value="3"/> </actionGroup> - <actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="cartAssertSimpleProduct1" after="cartAssertCategory"> + <actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="cartAssertSimpleProduct1" after="cartAssertCategory"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -27,7 +27,7 @@ <assertNotRegExp expected="'/placeholder\/small_image\.jpg/'" actual="$cartGrabSimpleProduct1ImageSrc" stepKey="cartAssertSimpleProduct1ImageNotDefault" after="cartGrabSimpleProduct1ImageSrc"/> <click selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createSimpleProduct1.name$$)}}" stepKey="cartClickSimpleProduct1" after="cartAssertSimpleProduct1ImageNotDefault"/> <waitForLoadingMaskToDisappear stepKey="waitForCartSimpleProduct1loaded" after="cartClickSimpleProduct1"/> - <actionGroup ref="StorefrontCheckSimpleProduct" stepKey="cartAssertProduct1Page" after="waitForCartSimpleProduct1loaded"> + <actionGroup ref="StorefrontCheckSimpleProductActionGroup" stepKey="cartAssertProduct1Page" after="waitForCartSimpleProduct1loaded"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -46,7 +46,7 @@ <argument name="category" value="$$createCategory$$"/> <argument name="productCount" value="3"/> </actionGroup> - <actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="cartAssertSimpleProduct2" after="cartAssertCategory1ForSimpleProduct2"> + <actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="cartAssertSimpleProduct2" after="cartAssertCategory1ForSimpleProduct2"> <argument name="product" value="$$createSimpleProduct2$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -69,7 +69,7 @@ <assertNotRegExp expected="'/placeholder\/thumbnail\.jpg/'" actual="$cartMinicartGrabSimpleProduct1ImageSrc" stepKey="cartMinicartAssertSimpleProduct1ImageNotDefault" after="cartMinicartGrabSimpleProduct1ImageSrc"/> <click selector="{{StorefrontMinicartSection.productLinkByName($$createSimpleProduct1.name$$)}}" stepKey="cartMinicartClickSimpleProduct1" after="cartMinicartAssertSimpleProduct1ImageNotDefault"/> <waitForLoadingMaskToDisappear stepKey="waitForMinicartSimpleProduct1loaded" after="cartMinicartClickSimpleProduct1"/> - <actionGroup ref="StorefrontCheckSimpleProduct" stepKey="cartAssertMinicartProduct1Page" after="waitForMinicartSimpleProduct1loaded"> + <actionGroup ref="StorefrontCheckSimpleProductActionGroup" stepKey="cartAssertMinicartProduct1Page" after="waitForMinicartSimpleProduct1loaded"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -85,7 +85,7 @@ <assertNotRegExp expected="'/placeholder\/thumbnail\.jpg/'" actual="$cartMinicartGrabSimpleProduct2ImageSrc" stepKey="cartMinicartAssertSimpleProduct2ImageNotDefault" after="cartMinicartGrabSimpleProduct2ImageSrc"/> <click selector="{{StorefrontMinicartSection.productLinkByName($$createSimpleProduct2.name$$)}}" stepKey="cartMinicartClickSimpleProduct2" after="cartMinicartAssertSimpleProduct2ImageNotDefault"/> <waitForLoadingMaskToDisappear stepKey="waitForMinicartSimpleProduct2loaded" after="cartMinicartClickSimpleProduct2"/> - <actionGroup ref="StorefrontCheckSimpleProduct" stepKey="cartAssertMinicartProduct2Page" after="waitForMinicartSimpleProduct2loaded"> + <actionGroup ref="StorefrontCheckSimpleProductActionGroup" stepKey="cartAssertMinicartProduct2Page" after="waitForMinicartSimpleProduct2loaded"> <argument name="product" value="$$createSimpleProduct2$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -114,7 +114,7 @@ <assertNotRegExp expected="'/placeholder\/small_image\.jpg/'" actual="$cartCartGrabSimpleProduct1ImageSrc" stepKey="cartCartAssertSimpleProduct1ImageNotDefault" after="cartCartGrabSimpleProduct1ImageSrc"/> <click selector="{{CheckoutCartProductSection.ProductLinkByName($$createSimpleProduct1.name$$)}}" stepKey="cartClickCartSimpleProduct1" after="cartCartAssertSimpleProduct1ImageNotDefault"/> <waitForLoadingMaskToDisappear stepKey="waitForCartSimpleProduct1loadedAgain" after="cartClickCartSimpleProduct1"/> - <actionGroup ref="StorefrontCheckSimpleProduct" stepKey="cartAssertCartProduct1Page" after="waitForCartSimpleProduct1loadedAgain"> + <actionGroup ref="StorefrontCheckSimpleProductActionGroup" stepKey="cartAssertCartProduct1Page" after="waitForCartSimpleProduct1loadedAgain"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -134,7 +134,7 @@ <assertNotRegExp expected="'/placeholder\/small_image\.jpg/'" actual="$cartCartGrabSimpleProduct2ImageSrc" stepKey="cartCartAssertSimpleProduct2ImageNotDefault" after="cartCartGrabSimpleProduct2ImageSrc"/> <click selector="{{CheckoutCartProductSection.ProductLinkByName($$createSimpleProduct2.name$$)}}" stepKey="cartClickCartSimpleProduct2" after="cartCartAssertSimpleProduct2ImageNotDefault"/> <waitForLoadingMaskToDisappear stepKey="waitForCartSimpleProduct2loaded" after="cartClickCartSimpleProduct2"/> - <actionGroup ref="StorefrontCheckSimpleProduct" stepKey="cartAssertCartProduct2Page" after="waitForCartSimpleProduct2loaded"> + <actionGroup ref="StorefrontCheckSimpleProductActionGroup" stepKey="cartAssertCartProduct2Page" after="waitForCartSimpleProduct2loaded"> <argument name="product" value="$$createSimpleProduct2$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -207,7 +207,7 @@ <argument name="category" value="$$createCategory$$"/> <argument name="productCount" value="3"/> </actionGroup> - <actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="cartAssertSimpleProduct1" after="cartAssertCategory"> + <actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="cartAssertSimpleProduct1" after="cartAssertCategory"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -215,7 +215,7 @@ <assertNotRegExp expected="'/placeholder\/small_image\.jpg/'" actual="$cartGrabSimpleProduct1ImageSrc" stepKey="cartAssertSimpleProduct1ImageNotDefault" after="cartGrabSimpleProduct1ImageSrc"/> <click selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createSimpleProduct1.name$$)}}" stepKey="cartClickSimpleProduct1" after="cartAssertSimpleProduct1ImageNotDefault"/> <waitForLoadingMaskToDisappear stepKey="waitForCartSimpleProduct1loaded" after="cartClickSimpleProduct1"/> - <actionGroup ref="StorefrontCheckSimpleProduct" stepKey="cartAssertProduct1Page" after="waitForCartSimpleProduct1loaded"> + <actionGroup ref="StorefrontCheckSimpleProductActionGroup" stepKey="cartAssertProduct1Page" after="waitForCartSimpleProduct1loaded"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -234,7 +234,7 @@ <argument name="category" value="$$createCategory$$"/> <argument name="productCount" value="3"/> </actionGroup> - <actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="cartAssertSimpleProduct2" after="cartAssertCategory1ForSimpleProduct2"> + <actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="cartAssertSimpleProduct2" after="cartAssertCategory1ForSimpleProduct2"> <argument name="product" value="$$createSimpleProduct2$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -257,7 +257,7 @@ <assertNotRegExp expected="'/placeholder\/thumbnail\.jpg/'" actual="$cartMinicartGrabSimpleProduct1ImageSrc" stepKey="cartMinicartAssertSimpleProduct1ImageNotDefault" after="cartMinicartGrabSimpleProduct1ImageSrc"/> <click selector="{{StorefrontMinicartSection.productLinkByName($$createSimpleProduct1.name$$)}}" stepKey="cartMinicartClickSimpleProduct1" after="cartMinicartAssertSimpleProduct1ImageNotDefault"/> <waitForLoadingMaskToDisappear stepKey="waitForMinicartSimpleProduct1loaded" after="cartMinicartClickSimpleProduct1"/> - <actionGroup ref="StorefrontCheckSimpleProduct" stepKey="cartAssertMinicartProduct1Page" after="waitForMinicartSimpleProduct1loaded"> + <actionGroup ref="StorefrontCheckSimpleProductActionGroup" stepKey="cartAssertMinicartProduct1Page" after="waitForMinicartSimpleProduct1loaded"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -273,7 +273,7 @@ <assertNotRegExp expected="'/placeholder\/thumbnail\.jpg/'" actual="$cartMinicartGrabSimpleProduct2ImageSrc" stepKey="cartMinicartAssertSimpleProduct2ImageNotDefault" after="cartMinicartGrabSimpleProduct2ImageSrc"/> <click selector="{{StorefrontMinicartSection.productLinkByName($$createSimpleProduct2.name$$)}}" stepKey="cartMinicartClickSimpleProduct2" after="cartMinicartAssertSimpleProduct2ImageNotDefault"/> <waitForLoadingMaskToDisappear stepKey="waitForMinicartSimpleProduct2loaded" after="cartMinicartClickSimpleProduct2"/> - <actionGroup ref="StorefrontCheckSimpleProduct" stepKey="cartAssertMinicartProduct2Page" after="waitForMinicartSimpleProduct2loaded"> + <actionGroup ref="StorefrontCheckSimpleProductActionGroup" stepKey="cartAssertMinicartProduct2Page" after="waitForMinicartSimpleProduct2loaded"> <argument name="product" value="$$createSimpleProduct2$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -302,7 +302,7 @@ <assertNotRegExp expected="'/placeholder\/small_image\.jpg/'" actual="$cartCartGrabSimpleProduct1ImageSrc" stepKey="cartCartAssertSimpleProduct1ImageNotDefault" after="cartCartGrabSimpleProduct1ImageSrc"/> <click selector="{{CheckoutCartProductSection.ProductLinkByName($$createSimpleProduct1.name$$)}}" stepKey="cartClickCartSimpleProduct1" after="cartCartAssertSimpleProduct1ImageNotDefault"/> <waitForLoadingMaskToDisappear stepKey="waitForCartSimpleProduct1loadedAgain" after="cartClickCartSimpleProduct1"/> - <actionGroup ref="StorefrontCheckSimpleProduct" stepKey="cartAssertCartProduct1Page" after="waitForCartSimpleProduct1loadedAgain"> + <actionGroup ref="StorefrontCheckSimpleProductActionGroup" stepKey="cartAssertCartProduct1Page" after="waitForCartSimpleProduct1loadedAgain"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -322,7 +322,7 @@ <assertNotRegExp expected="'/placeholder\/small_image\.jpg/'" actual="$cartCartGrabSimpleProduct2ImageSrc" stepKey="cartCartAssertSimpleProduct2ImageNotDefault" after="cartCartGrabSimpleProduct2ImageSrc"/> <click selector="{{CheckoutCartProductSection.ProductLinkByName($$createSimpleProduct2.name$$)}}" stepKey="cartClickCartSimpleProduct2" after="cartCartAssertSimpleProduct2ImageNotDefault"/> <waitForLoadingMaskToDisappear stepKey="waitForCartSimpleProduct2loaded" after="cartClickCartSimpleProduct2"/> - <actionGroup ref="StorefrontCheckSimpleProduct" stepKey="cartAssertCartProduct2Page" after="waitForCartSimpleProduct2loaded"> + <actionGroup ref="StorefrontCheckSimpleProductActionGroup" stepKey="cartAssertCartProduct2Page" after="waitForCartSimpleProduct2loaded"> <argument name="product" value="$$createSimpleProduct2$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml index 65627787e2a05..6df859c9972c3 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml @@ -19,7 +19,7 @@ <argument name="category" value="$$createCategory$$"/> <argument name="productCount" value="3"/> </actionGroup> - <actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="cartAssertSimpleProduct1" after="cartAssertCategory"> + <actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="cartAssertSimpleProduct1" after="cartAssertCategory"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -27,7 +27,7 @@ <assertNotRegExp expected="'/placeholder\/small_image\.jpg/'" actual="$cartGrabSimpleProduct1ImageSrc" stepKey="cartAssertSimpleProduct1ImageNotDefault" after="cartGrabSimpleProduct1ImageSrc"/> <click selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createSimpleProduct1.name$$)}}" stepKey="cartClickSimpleProduct1" after="cartAssertSimpleProduct1ImageNotDefault"/> <waitForLoadingMaskToDisappear stepKey="waitForCartSimpleProduct1loaded" after="cartClickSimpleProduct1"/> - <actionGroup ref="StorefrontCheckSimpleProduct" stepKey="cartAssertProduct1Page" after="waitForCartSimpleProduct1loaded"> + <actionGroup ref="StorefrontCheckSimpleProductActionGroup" stepKey="cartAssertProduct1Page" after="waitForCartSimpleProduct1loaded"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -46,7 +46,7 @@ <argument name="category" value="$$createCategory$$"/> <argument name="productCount" value="3"/> </actionGroup> - <actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="cartAssertSimpleProduct2" after="cartAssertCategory1ForSimpleProduct2"> + <actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="cartAssertSimpleProduct2" after="cartAssertCategory1ForSimpleProduct2"> <argument name="product" value="$$createSimpleProduct2$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -69,7 +69,7 @@ <assertNotRegExp expected="'/placeholder\/thumbnail\.jpg/'" actual="$cartMinicartGrabSimpleProduct1ImageSrc" stepKey="cartMinicartAssertSimpleProduct1ImageNotDefault" after="cartMinicartGrabSimpleProduct1ImageSrc"/> <click selector="{{StorefrontMinicartSection.productLinkByName($$createSimpleProduct1.name$$)}}" stepKey="cartMinicartClickSimpleProduct1" after="cartMinicartAssertSimpleProduct1ImageNotDefault"/> <waitForLoadingMaskToDisappear stepKey="waitForMinicartSimpleProduct1loaded" after="cartMinicartClickSimpleProduct1"/> - <actionGroup ref="StorefrontCheckSimpleProduct" stepKey="cartAssertMinicartProduct1Page" after="waitForMinicartSimpleProduct1loaded"> + <actionGroup ref="StorefrontCheckSimpleProductActionGroup" stepKey="cartAssertMinicartProduct1Page" after="waitForMinicartSimpleProduct1loaded"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -85,7 +85,7 @@ <assertNotRegExp expected="'/placeholder\/thumbnail\.jpg/'" actual="$cartMinicartGrabSimpleProduct2ImageSrc" stepKey="cartMinicartAssertSimpleProduct2ImageNotDefault" after="cartMinicartGrabSimpleProduct2ImageSrc"/> <click selector="{{StorefrontMinicartSection.productLinkByName($$createSimpleProduct2.name$$)}}" stepKey="cartMinicartClickSimpleProduct2" after="cartMinicartAssertSimpleProduct2ImageNotDefault"/> <waitForLoadingMaskToDisappear stepKey="waitForMinicartSimpleProduct2loaded" after="cartMinicartClickSimpleProduct2"/> - <actionGroup ref="StorefrontCheckSimpleProduct" stepKey="cartAssertMinicartProduct2Page" after="waitForMinicartSimpleProduct2loaded"> + <actionGroup ref="StorefrontCheckSimpleProductActionGroup" stepKey="cartAssertMinicartProduct2Page" after="waitForMinicartSimpleProduct2loaded"> <argument name="product" value="$$createSimpleProduct2$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -114,7 +114,7 @@ <assertNotRegExp expected="'/placeholder\/small_image\.jpg/'" actual="$cartCartGrabSimpleProduct1ImageSrc" stepKey="cartCartAssertSimpleProduct1ImageNotDefault" after="cartCartGrabSimpleProduct1ImageSrc"/> <click selector="{{CheckoutCartProductSection.ProductLinkByName($$createSimpleProduct1.name$$)}}" stepKey="cartClickCartSimpleProduct1" after="cartCartAssertSimpleProduct1ImageNotDefault"/> <waitForLoadingMaskToDisappear stepKey="waitForCartSimpleProduct1loadedAgain" after="cartClickCartSimpleProduct1"/> - <actionGroup ref="StorefrontCheckSimpleProduct" stepKey="cartAssertCartProduct1Page" after="waitForCartSimpleProduct1loadedAgain"> + <actionGroup ref="StorefrontCheckSimpleProductActionGroup" stepKey="cartAssertCartProduct1Page" after="waitForCartSimpleProduct1loadedAgain"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> @@ -134,7 +134,7 @@ <assertNotRegExp expected="'/placeholder\/small_image\.jpg/'" actual="$cartCartGrabSimpleProduct2ImageSrc" stepKey="cartCartAssertSimpleProduct2ImageNotDefault" after="cartCartGrabSimpleProduct2ImageSrc"/> <click selector="{{CheckoutCartProductSection.ProductLinkByName($$createSimpleProduct2.name$$)}}" stepKey="cartClickCartSimpleProduct2" after="cartCartAssertSimpleProduct2ImageNotDefault"/> <waitForLoadingMaskToDisappear stepKey="waitForCartSimpleProduct2loaded" after="cartClickCartSimpleProduct2"/> - <actionGroup ref="StorefrontCheckSimpleProduct" stepKey="cartAssertCartProduct2Page" after="waitForCartSimpleProduct2loaded"> + <actionGroup ref="StorefrontCheckSimpleProductActionGroup" stepKey="cartAssertCartProduct2Page" after="waitForCartSimpleProduct2loaded"> <argument name="product" value="$$createSimpleProduct2$$"/> </actionGroup> <!-- @TODO: Move Image check to action group after MQE-697 is fixed --> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/IdentityOfDefaultBillingAndShippingAddressTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/IdentityOfDefaultBillingAndShippingAddressTest.xml index 89028e146c358..e2d1a1b9139c8 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/IdentityOfDefaultBillingAndShippingAddressTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/IdentityOfDefaultBillingAndShippingAddressTest.xml @@ -36,7 +36,7 @@ </actionGroup> <!-- Add simple product to cart --> - <actionGroup ref="AddSimpleProductToCart" stepKey="addProductToCart1"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToCart1"> <argument name="product" value="$$product$$"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingDefaultAddressTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingDefaultAddressTest.xml index aa3665a81bbde..ad7d55e8f9205 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingDefaultAddressTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingDefaultAddressTest.xml @@ -45,7 +45,7 @@ <!-- Add Simple Product to cart --> <amOnPage url="{{StorefrontProductPage.url($$createSimpleProduct.custom_attributes[url_key]$$)}}" stepKey="navigateToSimpleProductPage"/> <waitForPageLoad stepKey="waitForSimpleProductPageLoad"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage"> <argument name="productName" value="$$createSimpleProduct.name$$"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNewAddressTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNewAddressTest.xml index bafad6f28a680..cb752c3b752de 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNewAddressTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNewAddressTest.xml @@ -45,7 +45,7 @@ <!-- Add Simple Product to cart --> <amOnPage url="{{StorefrontProductPage.url($$createSimpleProduct.custom_attributes[url_key]$$)}}" stepKey="navigateToSimpleProductPage"/> <waitForPageLoad stepKey="waitForSimpleProductPageLoad"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage"> <argument name="productName" value="$$createSimpleProduct.name$$"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNonDefaultAddressTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNonDefaultAddressTest.xml index 2c341a5c4c1ab..e2e1039b301d1 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNonDefaultAddressTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNonDefaultAddressTest.xml @@ -45,7 +45,7 @@ <!-- Add Simple Product to cart --> <amOnPage url="{{StorefrontProductPage.url($$createSimpleProduct.custom_attributes[url_key]$$)}}" stepKey="navigateToSimpleProductPage"/> <waitForPageLoad stepKey="waitForSimpleProductPageLoad"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage"> <argument name="productName" value="$$createSimpleProduct.name$$"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutUsingSignInLinkTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutUsingSignInLinkTest.xml index 990459d7c81b7..ddb732b785995 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutUsingSignInLinkTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutUsingSignInLinkTest.xml @@ -45,7 +45,7 @@ <!-- Add Simple Product to cart --> <amOnPage url="{{StorefrontProductPage.url($$createSimpleProduct.custom_attributes[url_key]$$)}}" stepKey="navigateToSimpleProductPage"/> <waitForPageLoad stepKey="waitForSimpleProductPageLoad"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage"> <argument name="productName" value="$$createSimpleProduct.name$$"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml index e85a47ab7a91d..67b159e42d9e1 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml @@ -116,7 +116,7 @@ <!-- Add Simple Product to cart --> <amOnPage url="{{StorefrontProductPage.url($$createSimpleProduct.custom_attributes[url_key]$$)}}" stepKey="navigateToSimpleProductPage"/> <waitForPageLoad stepKey="waitForSimpleProductPageLoad"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage"> <argument name="productName" value="$$createSimpleProduct.name$$"/> </actionGroup> @@ -131,14 +131,14 @@ <!-- Add Virtual Product to cart --> <amOnPage url="{{StorefrontProductPage.url($$createVirtualProduct.custom_attributes[url_key]$$)}}" stepKey="navigateToVirtualProductPage"/> <waitForPageLoad stepKey="waitForVirtualProductPageLoad"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartVirtualProductFromStorefrontProductPage"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartVirtualProductFromStorefrontProductPage"> <argument name="productName" value="$$createVirtualProduct.name$$"/> </actionGroup> <!-- Add Downloadable Product to cart --> <amOnPage url="{{StorefrontProductPage.url($$createDownloadableProduct.custom_attributes[url_key]$$)}}" stepKey="navigateToDownloadableProductPage"/> <waitForPageLoad stepKey="waitForDownloadableProductPageLoad"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartDownloadableProductFromStorefrontProductPage"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartDownloadableProductFromStorefrontProductPage"> <argument name="productName" value="$$createDownloadableProduct.name$$"/> </actionGroup> @@ -146,7 +146,7 @@ <amOnPage url="{{StorefrontProductPage.url($$createGroupedProduct.custom_attributes[url_key]$$)}}" stepKey="navigateToGroupedProductPage"/> <waitForPageLoad stepKey="waitForGroupedProductPageLoad"/> <fillField selector="{{StorefrontProductPageSection.qtyInput}}" userInput="1" stepKey="fillFieldQtyInput"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartGroupedProductFromStorefrontProductPage"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartGroupedProductFromStorefrontProductPage"> <argument name="productName" value="$$createGroupedProduct.name$$"/> </actionGroup> @@ -154,7 +154,7 @@ <amOnPage url="{{StorefrontProductPage.url($$createFixedBundleProduct.custom_attributes[url_key]$$)}}" stepKey="navigateToBundleProductPage"/> <waitForPageLoad stepKey="waitForFixedBundleProductPageLoad"/> <click selector="{{StorefrontBundleProductActionSection.customizeAndAddToCartButton}}" stepKey="clickCustomizeAndAddToCart"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFixedBundleProductFromStorefrontProductPage"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFixedBundleProductFromStorefrontProductPage"> <argument name="productName" value="$$createFixedBundleProduct.name$$"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/ShoppingCartAndMiniShoppingCartPerCustomerTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/ShoppingCartAndMiniShoppingCartPerCustomerTest.xml index 84cdb8abd9344..97ff6d8e56243 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/ShoppingCartAndMiniShoppingCartPerCustomerTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/ShoppingCartAndMiniShoppingCartPerCustomerTest.xml @@ -66,7 +66,7 @@ <waitForPageLoad stepKey="waitForFirstProductPageLoad"/> <!-- Add the product to the shopping cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addFirstProductToCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addFirstProductToCart"> <argument name="productName" value="$$createSimpleProduct.name$$"/> </actionGroup> @@ -102,7 +102,7 @@ <waitForPageLoad stepKey="waitForProductPage"/> <!-- Add the product to the shopping cart --> - <actionGroup ref="AddProductWithQtyToCartFromStorefrontProductPage" stepKey="addProductToCart"> + <actionGroup ref="AddProductWithQtyToCartFromStorefrontProductPageActionGroup" stepKey="addProductToCart"> <argument name="productName" value="$$createSimpleProduct.name$$"/> <argument name="productQty" value="{{quoteQty2Price123.qty}}"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontAddProductWithAllTypesOfCustomOptionToTheShoppingCartWithoutAnySelectedOptionTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontAddProductWithAllTypesOfCustomOptionToTheShoppingCartWithoutAnySelectedOptionTest.xml index d108dc3657a40..450bfff27125a 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontAddProductWithAllTypesOfCustomOptionToTheShoppingCartWithoutAnySelectedOptionTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontAddProductWithAllTypesOfCustomOptionToTheShoppingCartWithoutAnySelectedOptionTest.xml @@ -31,7 +31,7 @@ </after> <!-- Open Product page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct1PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct1PageAndVerifyProduct"> <argument name="product" value="$$createProduct$$"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontCheckCustomerInfoCreatedByGuestTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontCheckCustomerInfoCreatedByGuestTest.xml index 693c05684f292..c08a930ba6224 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontCheckCustomerInfoCreatedByGuestTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontCheckCustomerInfoCreatedByGuestTest.xml @@ -36,7 +36,7 @@ <amOnPage url="$$product.name$$.html" stepKey="navigateToProductPage"/> <waitForPageLoad stepKey="waitForProductPage"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage"> <argument name="productName" value="$$product.name$$"/> </actionGroup> <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontUpdateShoppingCartWhileUpdateMinicartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontUpdateShoppingCartWhileUpdateMinicartTest.xml index fb80b4880a6f4..2aa6530dea205 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontUpdateShoppingCartWhileUpdateMinicartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontUpdateShoppingCartWhileUpdateMinicartTest.xml @@ -32,7 +32,7 @@ <!--Add product to cart--> <amOnPage url="$$createProduct.name$$.html" stepKey="navigateToProductPage"/> <waitForPageLoad stepKey="waitForProductPage"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage"> <argument name="productName" value="$$createProduct.name$$"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartTest.xml index 071311b78b3fa..fdfa7f192232e 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartTest.xml @@ -57,7 +57,7 @@ </after> <!--Open Product page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProductPageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProductPageAndVerifyProduct"> <argument name="product" value="$$createBundleProduct$$"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartWithDisableMiniCartSidebarTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartWithDisableMiniCartSidebarTest.xml index d67800e21afc2..5d5e2b3a91f49 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartWithDisableMiniCartSidebarTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartWithDisableMiniCartSidebarTest.xml @@ -61,7 +61,7 @@ </after> <!--Open Product page in StoreFront and assert product and price range --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProductPageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProductPageAndVerifyProduct"> <argument name="product" value="$$createBundleProduct$$"/> </actionGroup> <actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seePriceRangeIsVisible"> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddOneBundleMultiSelectOptionToTheShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddOneBundleMultiSelectOptionToTheShoppingCartTest.xml index 9b8e5a4521115..9153693923c09 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddOneBundleMultiSelectOptionToTheShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddOneBundleMultiSelectOptionToTheShoppingCartTest.xml @@ -57,7 +57,7 @@ </after> <!--Open Product page in StoreFront and assert product details --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProductPageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProductPageAndVerifyProduct"> <argument name="product" value="$$createBundleProduct$$"/> </actionGroup> <actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seePriceRangeIsVisible"> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddProductWithAllTypesOfCustomOptionToTheShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddProductWithAllTypesOfCustomOptionToTheShoppingCartTest.xml index e90f69e88cec7..319183d4641e6 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddProductWithAllTypesOfCustomOptionToTheShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddProductWithAllTypesOfCustomOptionToTheShoppingCartTest.xml @@ -30,7 +30,7 @@ <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> </after> <!-- Open Product page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct1PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct1PageAndVerifyProduct"> <argument name="product" value="$$createProduct$$"/> </actionGroup> @@ -111,4 +111,4 @@ <argument name="qty" value="2"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddTwoBundleMultiSelectOptionsToTheShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddTwoBundleMultiSelectOptionsToTheShoppingCartTest.xml index 71e99f41f79e1..2625ca2f1a6fe 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddTwoBundleMultiSelectOptionsToTheShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddTwoBundleMultiSelectOptionsToTheShoppingCartTest.xml @@ -57,7 +57,7 @@ </after> <!--Open Product page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProductPageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProductPageAndVerifyProduct"> <argument name="product" value="$$createBundleProduct$$"/> </actionGroup> <actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seePriceRangeIsVisible"> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontApplyPromoCodeDuringCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontApplyPromoCodeDuringCheckoutTest.xml index bdfdfceab53f9..9f50e9c9f8f74 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontApplyPromoCodeDuringCheckoutTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontApplyPromoCodeDuringCheckoutTest.xml @@ -42,7 +42,7 @@ </after> <!-- Go to Storefront as Guest and add simple product to cart --> - <actionGroup ref="AddSimpleProductToCart" stepKey="addProductToCart"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToCart"> <argument name="product" value="$$createProduct$$"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartAndCheckoutItemsCountTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartAndCheckoutItemsCountTest.xml index 0327deaf18968..c3f173961f0c5 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartAndCheckoutItemsCountTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartAndCheckoutItemsCountTest.xml @@ -33,13 +33,13 @@ <!-- Add simpleProduct1 to cart --> <amOnPage url="{{StorefrontProductPage.url($$simpleProduct1.custom_attributes[url_key]$)}}" stepKey="amOnProduct1Page"/> - <actionGroup ref="AddProductWithQtyToCartFromStorefrontProductPage" stepKey="addProduct1ToCart"> + <actionGroup ref="AddProductWithQtyToCartFromStorefrontProductPageActionGroup" stepKey="addProduct1ToCart"> <argument name="productName" value="$$simpleProduct1.name$$"/> <argument name="productQty" value="2"/> </actionGroup> <!-- Add simpleProduct2 to cart --> <amOnPage url="{{StorefrontProductPage.url($$simpleProduct2.custom_attributes[url_key]$)}}" stepKey="amOnProduct2Page"/> - <actionGroup ref="AddProductWithQtyToCartFromStorefrontProductPage" stepKey="addProduct2ToCart"> + <actionGroup ref="AddProductWithQtyToCartFromStorefrontProductPageActionGroup" stepKey="addProduct2ToCart"> <argument name="productName" value="$$simpleProduct2.name$$"/> <argument name="productQty" value="1"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartAndSummaryBlockItemDisplayWithDefaultDisplayLimitationTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartAndSummaryBlockItemDisplayWithDefaultDisplayLimitationTest.xml index beb2d40f94cad..0b52caa7165af 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartAndSummaryBlockItemDisplayWithDefaultDisplayLimitationTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartAndSummaryBlockItemDisplayWithDefaultDisplayLimitationTest.xml @@ -67,102 +67,102 @@ </after> <!-- Open Product1 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct1PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct1PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> <!-- Add Product1 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct1ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct1ToTheCart"> <argument name="productName" value="$$simpleProduct1.name$$"/> </actionGroup> <!-- Open Product2 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct2PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct2PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct2$$"/> </actionGroup> <!-- Add Product2 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct2ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct2ToTheCart"> <argument name="productName" value="$$simpleProduct2.name$$"/> </actionGroup> <!-- Open Product3 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct3PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct3PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct3$$"/> </actionGroup> <!-- Add Product3 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct3ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct3ToTheCart"> <argument name="productName" value="$$simpleProduct3.name$$"/> </actionGroup> <!-- Open Product4 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct4PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct4PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct4$$"/> </actionGroup> <!-- Add Product4 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct4ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct4ToTheCart"> <argument name="productName" value="$$simpleProduct4.name$$"/> </actionGroup> <!-- Open Product5 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct5PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct5PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct5$$"/> </actionGroup> <!-- Add Product5 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct5ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct5ToTheCart"> <argument name="productName" value="$$simpleProduct5.name$$"/> </actionGroup> <!-- Open Product6 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct6PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct6PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct6$$"/> </actionGroup> <!-- Add Product6 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct6ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct6ToTheCart"> <argument name="productName" value="$$simpleProduct6.name$$"/> </actionGroup> <!-- Open Product7 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct7PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct7PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct7$$"/> </actionGroup> <!-- Add Product7 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct7ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct7ToTheCart"> <argument name="productName" value="$$simpleProduct7.name$$"/> </actionGroup> <!-- Open Product8 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct8PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct8PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct8$$"/> </actionGroup> <!-- Add Product8 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct8ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct8ToTheCart"> <argument name="productName" value="$$simpleProduct8.name$$"/> </actionGroup> <!-- Open Product9 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct9PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct9PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct9$$"/> </actionGroup> <!-- Add Product9 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct9ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct9ToTheCart"> <argument name="productName" value="$$simpleProduct9.name$$"/> </actionGroup> <!-- Open Product10 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProductPage10AndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProductPage10AndVerifyProduct"> <argument name="product" value="$$simpleProduct10$$"/> </actionGroup> <!-- Add Product10 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct10ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct10ToTheCart"> <argument name="productName" value="$$simpleProduct10.name$$"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartItemDisplayWhenMoreItemsAddedToTheCartThanDefaultDisplayLimitTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartItemDisplayWhenMoreItemsAddedToTheCartThanDefaultDisplayLimitTest.xml index 8b8aed3ac6204..a496ff68c0cd0 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartItemDisplayWhenMoreItemsAddedToTheCartThanDefaultDisplayLimitTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartItemDisplayWhenMoreItemsAddedToTheCartThanDefaultDisplayLimitTest.xml @@ -72,112 +72,112 @@ </after> <!-- Open Product1 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct1PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct1PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> <!-- Add Product1 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct1ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct1ToTheCart"> <argument name="productName" value="$$simpleProduct1.name$$"/> </actionGroup> <!-- Open Product2 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct2PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct2PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct2$$"/> </actionGroup> <!-- Add Product2 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct2ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct2ToTheCart"> <argument name="productName" value="$$simpleProduct2.name$$"/> </actionGroup> <!-- Open Product3 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct3PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct3PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct3$$"/> </actionGroup> <!-- Add Product3 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct3ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct3ToTheCart"> <argument name="productName" value="$$simpleProduct3.name$$"/> </actionGroup> <!-- Open Product4 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct4PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct4PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct4$$"/> </actionGroup> <!-- Add Product4 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct4ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct4ToTheCart"> <argument name="productName" value="$$simpleProduct4.name$$"/> </actionGroup> <!-- Open Product5 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct5PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct5PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct5$$"/> </actionGroup> <!-- Add Product5 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct5ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct5ToTheCart"> <argument name="productName" value="$$simpleProduct5.name$$"/> </actionGroup> <!-- Open Product6 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct6PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct6PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct6$$"/> </actionGroup> <!-- Add Product6 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct6ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct6ToTheCart"> <argument name="productName" value="$$simpleProduct6.name$$"/> </actionGroup> <!-- Open Product7 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct7PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct7PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct7$$"/> </actionGroup> <!-- Add Product7 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct7ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct7ToTheCart"> <argument name="productName" value="$$simpleProduct7.name$$"/> </actionGroup> <!-- Open Product8 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct8PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct8PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct8$$"/> </actionGroup> <!-- Add Product8 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct8ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct8ToTheCart"> <argument name="productName" value="$$simpleProduct8.name$$"/> </actionGroup> <!-- Open Product9 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct9PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct9PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct9$$"/> </actionGroup> <!-- Add Product9 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct9ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct9ToTheCart"> <argument name="productName" value="$$simpleProduct9.name$$"/> </actionGroup> <!-- Open Product10 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProductPage10AndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProductPage10AndVerifyProduct"> <argument name="product" value="$$simpleProduct10$$"/> </actionGroup> <!-- Add Product10 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct10ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct10ToTheCart"> <argument name="productName" value="$$simpleProduct10.name$$"/> </actionGroup> <!-- Open Product11 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProductPage11AndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProductPage11AndVerifyProduct"> <argument name="product" value="$$simpleProduct11$$"/> </actionGroup> <!-- Add Product11 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct11ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct11ToTheCart"> <argument name="productName" value="$$simpleProduct11.name$$"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartItemDisplayWithDefaultDisplayLimitAndDefaultTotalQuantityTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartItemDisplayWithDefaultDisplayLimitAndDefaultTotalQuantityTest.xml index 2339789bd85d1..8e84deafea9f2 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartItemDisplayWithDefaultDisplayLimitAndDefaultTotalQuantityTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartItemDisplayWithDefaultDisplayLimitAndDefaultTotalQuantityTest.xml @@ -65,102 +65,102 @@ </after> <!-- Open Product1 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct1PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct1PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> <!-- Add Product1 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct1ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct1ToTheCart"> <argument name="productName" value="$$simpleProduct1.name$$"/> </actionGroup> <!-- Open Product2 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct2PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct2PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct2$$"/> </actionGroup> <!-- Add Product2 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct2ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct2ToTheCart"> <argument name="productName" value="$$simpleProduct2.name$$"/> </actionGroup> <!-- Open Product3 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct3PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct3PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct3$$"/> </actionGroup> <!-- Add Product3 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct3ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct3ToTheCart"> <argument name="productName" value="$$simpleProduct3.name$$"/> </actionGroup> <!-- Open Product4 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct4PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct4PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct4$$"/> </actionGroup> <!-- Add Product4 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct4ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct4ToTheCart"> <argument name="productName" value="$$simpleProduct4.name$$"/> </actionGroup> <!-- Open Product5 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct5PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct5PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct5$$"/> </actionGroup> <!-- Add Product5 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct5ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct5ToTheCart"> <argument name="productName" value="$$simpleProduct5.name$$"/> </actionGroup> <!-- Open Product6 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct6PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct6PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct6$$"/> </actionGroup> <!-- Add Product6 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct6ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct6ToTheCart"> <argument name="productName" value="$$simpleProduct6.name$$"/> </actionGroup> <!-- Open Product7 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct7PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct7PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct7$$"/> </actionGroup> <!-- Add Product7 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct7ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct7ToTheCart"> <argument name="productName" value="$$simpleProduct7.name$$"/> </actionGroup> <!-- Open Product8 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct8PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct8PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct8$$"/> </actionGroup> <!-- Add Product8 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct8ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct8ToTheCart"> <argument name="productName" value="$$simpleProduct8.name$$"/> </actionGroup> <!-- Open Product9 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct9PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct9PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct9$$"/> </actionGroup> <!-- Add Product9 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct9ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct9ToTheCart"> <argument name="productName" value="$$simpleProduct9.name$$"/> </actionGroup> <!-- Open Product10 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProductPage10AndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProductPage10AndVerifyProduct"> <argument name="product" value="$$simpleProduct10$$"/> </actionGroup> <!-- Add Product10 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct10ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct10ToTheCart"> <argument name="productName" value="$$simpleProduct10.name$$"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckPagerShoppingCartWithMoreThan20ProductsTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckPagerShoppingCartWithMoreThan20ProductsTest.xml index 9dbd5daba6f23..caec34c5ef1aa 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckPagerShoppingCartWithMoreThan20ProductsTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckPagerShoppingCartWithMoreThan20ProductsTest.xml @@ -24,87 +24,87 @@ <magentoCLI stepKey="allowSpecificValue" command="config:set checkout/cart/number_items_to_display_pager 20" /> <createData entity="SimpleTwo" stepKey="simpleProduct1"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem1"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem1"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct2"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem2"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem2"> <argument name="product" value="$simpleProduct2$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct3"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem3"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem3"> <argument name="product" value="$simpleProduct3$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct4"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem4"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem4"> <argument name="product" value="$simpleProduct4$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct5"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem5"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem5"> <argument name="product" value="$simpleProduct5$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct6"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem6"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem6"> <argument name="product" value="$simpleProduct6$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct7"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem7"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem7"> <argument name="product" value="$simpleProduct7$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct8"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem8"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem8"> <argument name="product" value="$simpleProduct8$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct9"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem9"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem9"> <argument name="product" value="$simpleProduct9$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct10"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem10"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem10"> <argument name="product" value="$$simpleProduct10$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct11"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem11"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem11"> <argument name="product" value="$$simpleProduct11$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct12"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem12"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem12"> <argument name="product" value="$$simpleProduct12$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct13"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem13"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem13"> <argument name="product" value="$$simpleProduct13$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct14"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem14"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem14"> <argument name="product" value="$$simpleProduct14$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct15"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem15"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem15"> <argument name="product" value="$$simpleProduct15$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct16"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem16"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem16"> <argument name="product" value="$$simpleProduct16$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct17"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem17"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem17"> <argument name="product" value="$$simpleProduct17$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct18"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem18"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem18"> <argument name="product" value="$$simpleProduct18$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct19"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem19"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem19"> <argument name="product" value="$$simpleProduct19$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct20"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem20"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem20"> <argument name="product" value="$$simpleProduct20$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct21"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem21"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem21"> <argument name="product" value="$$simpleProduct21$$"/> </actionGroup> </before> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckSimpleProductCartItemDisplayWithDefaultLimitationTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckSimpleProductCartItemDisplayWithDefaultLimitationTest.xml index 084c89312cc7e..79e46d093c2f6 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckSimpleProductCartItemDisplayWithDefaultLimitationTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckSimpleProductCartItemDisplayWithDefaultLimitationTest.xml @@ -71,112 +71,112 @@ </after> <!-- Open Product1 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct1PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct1PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> <!-- Add Product1 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct1ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct1ToTheCart"> <argument name="productName" value="$$simpleProduct1.name$$"/> </actionGroup> <!-- Open Product2 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct2PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct2PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct2$$"/> </actionGroup> <!-- Add Product2 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct2ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct2ToTheCart"> <argument name="productName" value="$$simpleProduct2.name$$"/> </actionGroup> <!-- Open Product3 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct3PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct3PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct3$$"/> </actionGroup> <!-- Add Product3 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct3ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct3ToTheCart"> <argument name="productName" value="$$simpleProduct3.name$$"/> </actionGroup> <!-- Open Product4 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct4PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct4PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct4$$"/> </actionGroup> <!-- Add Product4 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct4ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct4ToTheCart"> <argument name="productName" value="$$simpleProduct4.name$$"/> </actionGroup> <!-- Open Product5 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct5PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct5PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct5$$"/> </actionGroup> <!-- Add Product5 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct5ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct5ToTheCart"> <argument name="productName" value="$$simpleProduct5.name$$"/> </actionGroup> <!-- Open Product6 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct6PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct6PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct6$$"/> </actionGroup> <!-- Add Product6 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct6ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct6ToTheCart"> <argument name="productName" value="$$simpleProduct6.name$$"/> </actionGroup> <!-- Open Product7 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct7PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct7PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct7$$"/> </actionGroup> <!-- Add Product7 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct7ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct7ToTheCart"> <argument name="productName" value="$$simpleProduct7.name$$"/> </actionGroup> <!-- Open Product8 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct8PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct8PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct8$$"/> </actionGroup> <!-- Add Product8 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct8ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct8ToTheCart"> <argument name="productName" value="$$simpleProduct8.name$$"/> </actionGroup> <!-- Open Product9 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct9PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct9PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct9$$"/> </actionGroup> <!-- Add Product9 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct9ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct9ToTheCart"> <argument name="productName" value="$$simpleProduct9.name$$"/> </actionGroup> <!-- Open Product10 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProductPage10AndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProductPage10AndVerifyProduct"> <argument name="product" value="$$simpleProduct10$$"/> </actionGroup> <!-- Add Product10 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct10ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct10ToTheCart"> <argument name="productName" value="$$simpleProduct10.name$$"/> </actionGroup> <!-- Open Product11 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProductPage11AndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProductPage11AndVerifyProduct"> <argument name="product" value="$$simpleProduct11$$"/> </actionGroup> <!-- Add Product11 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct11ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct11ToTheCart"> <argument name="productName" value="$$simpleProduct11.name$$"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckVirtualProductCountDisplayWithCustomDisplayConfigurationTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckVirtualProductCountDisplayWithCustomDisplayConfigurationTest.xml index 1f63565899f88..9f3eacbf5f455 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckVirtualProductCountDisplayWithCustomDisplayConfigurationTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckVirtualProductCountDisplayWithCustomDisplayConfigurationTest.xml @@ -46,42 +46,42 @@ </after> <!-- Open Product1 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct1PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct1PageAndVerifyProduct"> <argument name="product" value="$$virtualProduct1$$"/> </actionGroup> <!-- Add Product1 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct1ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct1ToTheCart"> <argument name="productName" value="$$virtualProduct1.name$$"/> </actionGroup> <!-- Open Product2 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct2PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct2PageAndVerifyProduct"> <argument name="product" value="$$virtualProduct2$$"/> </actionGroup> <!-- Add Product2 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct2ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct2ToTheCart"> <argument name="productName" value="$$virtualProduct2.name$$"/> </actionGroup> <!-- Open Product3 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct3PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct3PageAndVerifyProduct"> <argument name="product" value="$$virtualProduct3$$"/> </actionGroup> <!-- Add Product3 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct3ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct3ToTheCart"> <argument name="productName" value="$$virtualProduct3.name$$"/> </actionGroup> <!-- Open Product4 page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct4PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct4PageAndVerifyProduct"> <argument name="product" value="$$virtualProduct4$$"/> </actionGroup> <!-- Add Product4 to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct4ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct4ToTheCart"> <argument name="productName" value="$$virtualProduct4.name$$"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndProductWithTierPricesTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndProductWithTierPricesTest.xml index c5d1c34a93b32..64591872d8dfe 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndProductWithTierPricesTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndProductWithTierPricesTest.xml @@ -23,10 +23,10 @@ <createData entity="SimpleProduct2" stepKey="simpleProduct"> <field key="price">50.00</field> </createData> - <actionGroup ref="filterAndSelectProduct" stepKey="filterAndSelectTheProduct"> + <actionGroup ref="FilterAndSelectProductActionGroup" stepKey="filterAndSelectTheProduct"> <argument name="productSku" value="$$simpleProduct.sku$$"/> </actionGroup> - <actionGroup ref="ProductSetAdvancedTierFixedPricing" stepKey="setTierPrice"> + <actionGroup ref="ProductSetAdvancedTierFixedPricingActionGroup" stepKey="setTierPrice"> <argument name="website" value=""/> <argument name="group" value=""/> <argument name="quantity" value="3"/> @@ -49,7 +49,7 @@ </after> <!--Open Product page in StoreFront and assert product and price range --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProductPageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProductPageAndVerifyProduct"> <argument name="product" value="$$simpleProduct$$"/> </actionGroup> @@ -127,4 +127,4 @@ <!-- Assert order buttons --> <actionGroup ref="AdminAssertOrderAvailableButtonsActionGroup" stepKey="assertOrderButtons"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndRegisterCustomerAfterCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndRegisterCustomerAfterCheckoutTest.xml index 34dc6617d25d5..30abf9a871ee9 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndRegisterCustomerAfterCheckoutTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndRegisterCustomerAfterCheckoutTest.xml @@ -35,7 +35,7 @@ </after> <!--Open Product page in StoreFront and assert product and price range --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProductPageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProductPageAndVerifyProduct"> <argument name="product" value="$$simpleProduct$$"/> </actionGroup> @@ -98,4 +98,4 @@ <!-- Assert order buttons --> <actionGroup ref="AdminAssertOrderAvailableButtonsActionGroup" stepKey="assertOrderButtons"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithSpecialPriceProductsTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithSpecialPriceProductsTest.xml index 6ccb05bf4c4f7..f4997ef65f47e 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithSpecialPriceProductsTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithSpecialPriceProductsTest.xml @@ -24,7 +24,7 @@ <field key="price">10.00</field> </createData> - <actionGroup ref="filterAndSelectProduct" stepKey="filterAndSelectTheProduct"> + <actionGroup ref="FilterAndSelectProductActionGroup" stepKey="filterAndSelectTheProduct"> <argument name="productSku" value="$$simpleProduct.sku$$"/> </actionGroup> @@ -81,7 +81,7 @@ <requiredEntity createDataKey="createConfigChildProduct2"/> </createData> - <actionGroup ref="filterAndSelectProduct" stepKey="filterAndSelectTheProduct2"> + <actionGroup ref="FilterAndSelectProductActionGroup" stepKey="filterAndSelectTheProduct2"> <argument name="productSku" value="$$createConfigChildProduct2.sku$$"/> </actionGroup> <actionGroup ref="AddSpecialPriceToProductActionGroup" stepKey="addSpecialPriceTopTheProduct2"> @@ -105,7 +105,7 @@ </after> <!--Open Product page in StoreFront and assert product and price range --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProductPageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProductPageAndVerifyProduct"> <argument name="product" value="$$simpleProduct$$"/> </actionGroup> @@ -168,4 +168,4 @@ <!-- Assert order buttons --> <actionGroup ref="AdminAssertOrderAvailableButtonsActionGroup" stepKey="assertOrderButtons"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutDisabledProductAndCouponTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutDisabledProductAndCouponTest.xml index 0e704e5336db9..080a468bd5cd9 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutDisabledProductAndCouponTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutDisabledProductAndCouponTest.xml @@ -36,7 +36,7 @@ <deleteData createDataKey="createUSCustomer" stepKey="deleteCustomer"/> <deleteData createDataKey="createSalesRule" stepKey="deleteSalesRule"/> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductListing"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetGridToDefaultKeywordSearch"/> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetGridToDefaultKeywordSearch"/> </after> <!-- Login as Customer --> @@ -46,7 +46,7 @@ <!-- Add product to shopping cart --> <amOnPage url="{{StorefrontProductPage.url($$createSimpleProduct.name$$)}}" stepKey="amOnSimpleProductPage"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="cartAddSimpleProductToCart"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="cartAddSimpleProductToCart"> <argument name="product" value="$$createSimpleProduct$$"/> <argument name="productCount" value="1"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutOnLoginWhenGuestCheckoutIsDisabledTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutOnLoginWhenGuestCheckoutIsDisabledTest.xml index b0b72515611e8..1dd693bdc2f09 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutOnLoginWhenGuestCheckoutIsDisabledTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutOnLoginWhenGuestCheckoutIsDisabledTest.xml @@ -39,7 +39,7 @@ </after> <!--Open Product page in StoreFront and assert product and price range --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProductPageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProductPageAndVerifyProduct"> <argument name="product" value="$$simpleProduct$$"/> </actionGroup> @@ -91,4 +91,4 @@ <!-- Ship the order and assert the shipping status --> <actionGroup ref="AdminShipThePendingOrderActionGroup" stepKey="shipTheOrder"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutWithNewCustomerRegistrationAndDisableGuestCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutWithNewCustomerRegistrationAndDisableGuestCheckoutTest.xml index f7e54867b1ae4..c2735c8615beb 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutWithNewCustomerRegistrationAndDisableGuestCheckoutTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutWithNewCustomerRegistrationAndDisableGuestCheckoutTest.xml @@ -39,7 +39,7 @@ </after> <!--Open Product page in StoreFront and assert product and price range --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProductPageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProductPageAndVerifyProduct"> <argument name="product" value="$$simpleProduct$$"/> </actionGroup> @@ -129,4 +129,4 @@ <!-- Ship the order and assert the shipping status --> <actionGroup ref="AdminShipThePendingOrderActionGroup" stepKey="shipTheOrder"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutWithoutRegionTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutWithoutRegionTest.xml index 0cc0dcf38e312..4c2a9c1db46f7 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutWithoutRegionTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutWithoutRegionTest.xml @@ -43,7 +43,7 @@ <argument name="Customer" value="$$createCustomer$$" /> </actionGroup> - <actionGroup ref="AddSimpleProductToCart" stepKey="addProductToCart"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToCart"> <argument name="product" value="$$createProduct$$"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerPlaceOrderWithNewAddressesThatWasEditedTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerPlaceOrderWithNewAddressesThatWasEditedTest.xml index 651c5bd8d4375..994a6d2a8b4df 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerPlaceOrderWithNewAddressesThatWasEditedTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerPlaceOrderWithNewAddressesThatWasEditedTest.xml @@ -39,7 +39,7 @@ </actionGroup> <!-- Add simple product to cart and go to checkout--> - <actionGroup ref="AddSimpleProductToCart" stepKey="addProductToCart"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToCart"> <argument name="product" value="$$createProduct$$"/> </actionGroup> <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart" /> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteBundleProductFromMiniShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteBundleProductFromMiniShoppingCartTest.xml index 8f3ddbb27f62f..01a420ed24d0a 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteBundleProductFromMiniShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteBundleProductFromMiniShoppingCartTest.xml @@ -50,7 +50,7 @@ </after> <!--Open Product page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProductPageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProductPageAndVerifyProduct"> <argument name="product" value="$$createBundleProduct$$"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteProductsWithCartItemsDisplayDefaultLimitationFromMiniShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteProductsWithCartItemsDisplayDefaultLimitationFromMiniShoppingCartTest.xml index cca5268564b12..0b5d002253217 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteProductsWithCartItemsDisplayDefaultLimitationFromMiniShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteProductsWithCartItemsDisplayDefaultLimitationFromMiniShoppingCartTest.xml @@ -67,92 +67,92 @@ </after> <!--Open Product1 page in StoreFront--> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct1PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct1PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> <!--Add Product1 to the cart--> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct1ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct1ToTheCart"> <argument name="productName" value="$$simpleProduct1.name$$"/> </actionGroup> <!--Open Product2 page in StoreFront--> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct2PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct2PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct2$$"/> </actionGroup> <!--Add Product2 to the cart--> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct2ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct2ToTheCart"> <argument name="productName" value="$$simpleProduct2.name$$"/> </actionGroup> <!--Open Product3 page in StoreFront--> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct3PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct3PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct3$$"/> </actionGroup> <!--Add Product3 to the cart--> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct3ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct3ToTheCart"> <argument name="productName" value="$$simpleProduct3.name$$"/> </actionGroup> <!--Open Product4 page in StoreFront--> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct4PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct4PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct4$$"/> </actionGroup> <!--Add Product4 to the cart--> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct4ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct4ToTheCart"> <argument name="productName" value="$$simpleProduct4.name$$"/> </actionGroup> <!--Open Product5 page in StoreFront--> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct5PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct5PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct5$$"/> </actionGroup> <!--Add Product5 to the cart--> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct5ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct5ToTheCart"> <argument name="productName" value="$$simpleProduct5.name$$"/> </actionGroup> <!--Open Product6 page in StoreFront--> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct6PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct6PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct6$$"/> </actionGroup> <!--Add Product6 to the cart--> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct6ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct6ToTheCart"> <argument name="productName" value="$$simpleProduct6.name$$"/> </actionGroup> <!--Open Product7 page in StoreFront--> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct7PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct7PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct7$$"/> </actionGroup> <!--Add Product7 to the cart--> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct7ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct7ToTheCart"> <argument name="productName" value="$$simpleProduct7.name$$"/> </actionGroup> <!--Open Product8 page in StoreFront--> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct8PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct8PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct8$$"/> </actionGroup> <!--Add Product8 to the cart--> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct8ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct8ToTheCart"> <argument name="productName" value="$$simpleProduct8.name$$"/> </actionGroup> <!--Open Product9 page in StoreFront--> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProduct9PageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProduct9PageAndVerifyProduct"> <argument name="product" value="$$simpleProduct9$$"/> </actionGroup> <!--Add Product9 to the cart--> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct9ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct9ToTheCart"> <argument name="productName" value="$$simpleProduct9.name$$"/> </actionGroup> <!--Open Product10 page in StoreFront--> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProductPage10AndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProductPage10AndVerifyProduct"> <argument name="product" value="$$simpleProduct10$$"/> </actionGroup> <!--Add Product10 to the cart--> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct10ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct10ToTheCart"> <argument name="productName" value="$$simpleProduct10.name$$"/> </actionGroup> @@ -282,4 +282,4 @@ <dontSee selector="{{StorefrontMinicartSection.productLinkByName($$simpleProduct9.name$$)}}" stepKey="verifyAssertProduct9AbsentInMiniShoppingCart"/> <dontSee selector="{{StorefrontMinicartSection.productLinkByName($$simpleProduct10.name$$)}}" stepKey="verifyAssertProduct10AbsentInMiniShoppingCart"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteSimpleAndVirtualProductFromMiniShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteSimpleAndVirtualProductFromMiniShoppingCartTest.xml index b8092ccdcdce7..90f6860dfa736 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteSimpleAndVirtualProductFromMiniShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteSimpleAndVirtualProductFromMiniShoppingCartTest.xml @@ -36,13 +36,13 @@ </after> <!-- Add Simple Product to the cart --> - <actionGroup ref="AddSimpleProductToCart" stepKey="addSimpleProductToCart"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addSimpleProductToCart"> <argument name="product" value="$$simpleProduct$$"/> </actionGroup> <!-- Add virtual Product to the cart --> <amOnPage url="{{StorefrontProductPage.url($$virtualProduct.name$$)}}" stepKey="amOnStorefrontVirtualProductPage"/> <waitForPageLoad stepKey="waitForPageLoad"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct1ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct1ToTheCart"> <argument name="productName" value="$$virtualProduct.name$$"/> </actionGroup> @@ -85,4 +85,4 @@ <dontSee selector="{{StorefrontMinicartSection.productLinkByName($$simpleProduct.name$$)}}" stepKey="verifyAssertSimpleProductAbsentInMiniShoppingCart"/> <dontSee selector="{{StorefrontMinicartSection.productLinkByName($$virtualProduct.name$$)}}" stepKey="verifyAssertVirtualProductAbsentInMiniShoppingCart"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteSimpleProductFromMiniShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteSimpleProductFromMiniShoppingCartTest.xml index 05198060f5de4..4ef0ad977a779 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteSimpleProductFromMiniShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteSimpleProductFromMiniShoppingCartTest.xml @@ -31,7 +31,7 @@ </after> <!-- Add Simple Product to the cart --> - <actionGroup ref="AddSimpleProductToCart" stepKey="addProductToCart"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToCart"> <argument name="product" value="$$simpleProduct$$"/> </actionGroup> @@ -60,4 +60,4 @@ <actionGroup ref="assertMiniCartEmpty" stepKey="miniCartEnpty"/> <dontSee selector="{{StorefrontMinicartSection.productLinkByName($$simpleProduct.name$$)}}" stepKey="verifyAssertProductAbsentInMiniShoppingCart"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutDataPersistTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutDataPersistTest.xml index 626f095604fa2..a43bbef57d0c8 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutDataPersistTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutDataPersistTest.xml @@ -30,7 +30,7 @@ </after> <!-- Add simple product to cart --> - <actionGroup ref="AddSimpleProductToCart" stepKey="addProductToCart"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToCart"> <argument name="product" value="$$createProduct$$"/> </actionGroup> <!-- Navigate to checkout --> @@ -40,7 +40,7 @@ <argument name="shippingMethod" value="Flat Rate"/> </actionGroup> <!-- Add simple product to cart --> - <actionGroup ref="AddSimpleProductToCart" stepKey="addProductToCart1"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToCart1"> <argument name="product" value="$$createProduct$$"/> </actionGroup> <!-- Navigate to checkout --> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutUsingFreeShippingAndTaxesTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutUsingFreeShippingAndTaxesTest.xml index 2226e1ebc8292..1369c1a0fcbd2 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutUsingFreeShippingAndTaxesTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutUsingFreeShippingAndTaxesTest.xml @@ -129,7 +129,7 @@ <see selector="{{AdminTaxRuleGridSection.successMessage}}" userInput="You saved the tax rule." stepKey="assertTaxRuleSuccessMessage" /> <!--Open Product page in StoreFront and assert product and price range --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProductPageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProductPageAndVerifyProduct"> <argument name="product" value="$$simpleProduct$$"/> </actionGroup> @@ -147,7 +147,7 @@ </actionGroup> <!--Open Product page in StoreFront --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openBundleProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openBundleProduct"> <argument name="product" value="$$createBundleProduct$$"/> </actionGroup> @@ -220,4 +220,4 @@ <argument name="customerGroup" value=""/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutWithCouponAndZeroSubtotalTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutWithCouponAndZeroSubtotalTest.xml index 33ec099aa2ace..eb386975e1ad2 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutWithCouponAndZeroSubtotalTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutWithCouponAndZeroSubtotalTest.xml @@ -31,12 +31,12 @@ </after> <!--Open Product page in StoreFront and assert product and price range --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openVirtualProductPageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openVirtualProductPageAndVerifyProduct"> <argument name="product" value="$$virtualProduct$$"/> </actionGroup> <!-- Add Product to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct1ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct1ToTheCart"> <argument name="productName" value="$$virtualProduct.name$$"/> </actionGroup> @@ -90,4 +90,4 @@ <see selector="{{AdminOrderTotalSection.grandTotal}}" userInput="$0.00" stepKey="seeGrandTotal"/> <see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="Pending" stepKey="seeOrderStatus"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontMissingPagerShoppingCartWith20ProductsTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontMissingPagerShoppingCartWith20ProductsTest.xml index afe4ebcfea40c..32b0985c290a3 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontMissingPagerShoppingCartWith20ProductsTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontMissingPagerShoppingCartWith20ProductsTest.xml @@ -23,83 +23,83 @@ <!--Set the default number of items on cart which is 20--> <magentoCLI stepKey="allowSpecificValue" command="config:set checkout/cart/number_items_to_display_pager 20" /> <createData entity="SimpleTwo" stepKey="simpleProduct1"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem1"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem1"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct2"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem2"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem2"> <argument name="product" value="$$simpleProduct2$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct3"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem3"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem3"> <argument name="product" value="$$simpleProduct3$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct4"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem4"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem4"> <argument name="product" value="$$simpleProduct4$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct5"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem5"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem5"> <argument name="product" value="$$simpleProduct5$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct6"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem6"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem6"> <argument name="product" value="$$simpleProduct6$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct7"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem7"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem7"> <argument name="product" value="$$simpleProduct7$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct8"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem8"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem8"> <argument name="product" value="$$simpleProduct8$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct9"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem9"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem9"> <argument name="product" value="$$simpleProduct9$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct10"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem10"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem10"> <argument name="product" value="$$simpleProduct10$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct11"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem11"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem11"> <argument name="product" value="$$simpleProduct11$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct12"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem12"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem12"> <argument name="product" value="$$simpleProduct12$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct13"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem13"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem13"> <argument name="product" value="$$simpleProduct13$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct14"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem14"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem14"> <argument name="product" value="$$simpleProduct14$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct15"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem15"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem15"> <argument name="product" value="$$simpleProduct15$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct16"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem16"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem16"> <argument name="product" value="$$simpleProduct16$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct17"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem17"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem17"> <argument name="product" value="$$simpleProduct17$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct18"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem18"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem18"> <argument name="product" value="$$simpleProduct18$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct19"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem19"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem19"> <argument name="product" value="$$simpleProduct19$$"/> </actionGroup> <createData entity="SimpleTwo" stepKey="simpleProduct20"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="CartItem20"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="CartItem20"> <argument name="product" value="$$simpleProduct20$$"/> </actionGroup> </before> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontOnePageCheckoutDataWhenChangeQtyTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontOnePageCheckoutDataWhenChangeQtyTest.xml index 913eb34b34d07..ae7b8d2446380 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontOnePageCheckoutDataWhenChangeQtyTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontOnePageCheckoutDataWhenChangeQtyTest.xml @@ -30,7 +30,7 @@ <!--Add product to cart and checkout--> <amOnPage url="{{StorefrontProductPage.url($$createProduct.name$$)}}" stepKey="amOnSimpleProductPage"/> <waitForPageLoad stepKey="waitForPageLoad"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage"> <argument name="productName" value="$createProduct.name$$"/> </actionGroup> <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontOnePageCheckoutJsValidationTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontOnePageCheckoutJsValidationTest.xml index 8ed8e590eb229..66a4f417aed9d 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontOnePageCheckoutJsValidationTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontOnePageCheckoutJsValidationTest.xml @@ -30,7 +30,7 @@ <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> </after> - <actionGroup ref="AddSimpleProductToCart" stepKey="addToCartFromStorefrontProductPage"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addToCartFromStorefrontProductPage"> <argument name="product" value="$$createProduct$$"/> </actionGroup> <actionGroup ref="StorefrontOpenCheckoutPageActionGroup" stepKey="guestGoToCheckout"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontPersistentDataForGuestCustomerWithPhysicalQuoteTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontPersistentDataForGuestCustomerWithPhysicalQuoteTest.xml index 20ff67a076e1e..c106ec9c552ff 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontPersistentDataForGuestCustomerWithPhysicalQuoteTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontPersistentDataForGuestCustomerWithPhysicalQuoteTest.xml @@ -31,7 +31,7 @@ <createData entity="FreeShippinMethodDefault" stepKey="disableFreeShipping"/> </after> <!-- 1. Add simple product to cart and go to checkout--> - <actionGroup ref="AddSimpleProductToCart" stepKey="addSimpleProductToCart"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addSimpleProductToCart"> <argument name="product" value="$$createProduct$$"/> </actionGroup> <!-- 2. Go to Shopping Cart --> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontProductNameMinicartOnCheckoutPageDifferentStoreViewsTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontProductNameMinicartOnCheckoutPageDifferentStoreViewsTest.xml index 5e7e76ae4f02a..b678cb835f503 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontProductNameMinicartOnCheckoutPageDifferentStoreViewsTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontProductNameMinicartOnCheckoutPageDifferentStoreViewsTest.xml @@ -45,7 +45,7 @@ <waitForPageLoad stepKey="waitForProductPage"/> <!--Switch to second store view and change the product name--> - <actionGroup ref="SwitchToTheNewStoreView" stepKey="switchToCustomStoreView"> + <actionGroup ref="SwitchToTheNewStoreViewActionGroup" stepKey="switchToCustomStoreView"> <argument name="storeViewName" value="{{customStore.name}}"/> </actionGroup> <waitForPageLoad stepKey="waitForPageLoad"/> @@ -56,7 +56,7 @@ <!--Add product to cart--> <amOnPage url="{{StorefrontProductPage.url($$createProduct.name$$)}}" stepKey="amOnSimpleProductPage"/> <waitForPageLoad stepKey="waitForProductPageLoad"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage"> <argument name="productName" value="$createProduct.name$$"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontProductQuantityChangesInBackendAfterCustomerCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontProductQuantityChangesInBackendAfterCustomerCheckoutTest.xml index 285dc28cb520e..2f5e687063806 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontProductQuantityChangesInBackendAfterCustomerCheckoutTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontProductQuantityChangesInBackendAfterCustomerCheckoutTest.xml @@ -32,7 +32,7 @@ </after> <!--Open Product page in StoreFront and assert product and price range --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProductPageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProductPageAndVerifyProduct"> <argument name="product" value="$$simpleProduct$$"/> </actionGroup> @@ -88,7 +88,7 @@ <actionGroup ref="AdminAssertOrderAvailableButtonsActionGroup" stepKey="assertOrderButtons"/> <!-- Assert Product Quantity in backend reduced after order processed --> - <actionGroup ref="filterAndSelectProduct" stepKey="filterAndSelectTheProduct"> + <actionGroup ref="FilterAndSelectProductActionGroup" stepKey="filterAndSelectTheProduct"> <argument name="productSku" value="$$simpleProduct.sku$$"/> </actionGroup> <waitForElementVisible selector="{{AdminProductFormSection.productName}}" stepKey="waitForProductDetailsToLoad"/> @@ -97,9 +97,9 @@ <seeInField selector="{{AdminProductFormSection.productStockStatus}}" userInput="Out of Stock" stepKey="seeProductStockStatus"/> <!-- Assert Product is Out of Stock in frontend --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="assertProductInStorefront"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="assertProductInStorefront"> <argument name="product" value="$$simpleProduct$$"/> </actionGroup> <see selector="{{StorefrontProductInfoMainSection.productStockStatus}}" userInput="Out Of Stock" stepKey="seeProductDisplayedAsOutOfStock"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontShoppingCartPagerForOneItemPerPageAnd2ProductsTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontShoppingCartPagerForOneItemPerPageAnd2ProductsTest.xml index 744401cf24d13..2691dc2b9fd06 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontShoppingCartPagerForOneItemPerPageAnd2ProductsTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontShoppingCartPagerForOneItemPerPageAnd2ProductsTest.xml @@ -24,10 +24,10 @@ <magentoCLI stepKey="allowSpecificValue" command="config:set checkout/cart/number_items_to_display_pager 1" /> <createData entity="SimpleTwo" stepKey="createSimpleProduct1"/> <createData entity="SimpleTwo" stepKey="createSimpleProduct2"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="addToCartFromStorefrontProductPage1"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addToCartFromStorefrontProductPage1"> <argument name="product" value="$$createSimpleProduct1$$"/> </actionGroup> - <actionGroup ref="AddSimpleProductToCart" stepKey="addToCartFromStorefrontProductPage2"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addToCartFromStorefrontProductPage2"> <argument name="product" value="$$createSimpleProduct2$$"/> </actionGroup> </before> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKCustomerCheckoutWithCouponTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKCustomerCheckoutWithCouponTest.xml index 482e2fb6233a6..890a3eb748b6b 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKCustomerCheckoutWithCouponTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKCustomerCheckoutWithCouponTest.xml @@ -57,12 +57,12 @@ </actionGroup> <!--Open Product page in StoreFront and assert product and price range --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openVirtualProductPageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openVirtualProductPageAndVerifyProduct"> <argument name="product" value="$$virtualProduct$$"/> </actionGroup> <!-- Add Product to the cart --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProduct1ToTheCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProduct1ToTheCart"> <argument name="productName" value="$$virtualProduct.name$$"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKGuestCheckoutWithConditionProductQuantityEqualsToOrderedQuantityTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKGuestCheckoutWithConditionProductQuantityEqualsToOrderedQuantityTest.xml index deab32aede324..f390244fbd00b 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKGuestCheckoutWithConditionProductQuantityEqualsToOrderedQuantityTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKGuestCheckoutWithConditionProductQuantityEqualsToOrderedQuantityTest.xml @@ -29,7 +29,7 @@ </after> <!--Open Product page in StoreFront and assert product and price range --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProductPageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProductPageAndVerifyProduct"> <argument name="product" value="$$simpleProduct$$"/> </actionGroup> @@ -83,7 +83,7 @@ <actionGroup ref="AdminAssertOrderAvailableButtonsActionGroup" stepKey="assertOrderButtons"/> <!-- Assert Product Quantity in backend reduced after order processed --> - <actionGroup ref="filterAndSelectProduct" stepKey="filterAndSelectTheProduct"> + <actionGroup ref="FilterAndSelectProductActionGroup" stepKey="filterAndSelectTheProduct"> <argument name="productSku" value="$$simpleProduct.sku$$"/> </actionGroup> <waitForElementVisible selector="{{AdminProductFormSection.productName}}" stepKey="waitForProductDetailsToLoad"/> @@ -92,9 +92,9 @@ <seeInField selector="{{AdminProductFormSection.productStockStatus}}" userInput="Out of Stock" stepKey="seeProductStockStatus"/> <!-- Assert Product is Out of Stock in frontend --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="assertProductInStorefront"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="assertProductInStorefront"> <argument name="product" value="$$simpleProduct$$"/> </actionGroup> <see selector="{{StorefrontProductInfoMainSection.productStockStatus}}" userInput="Out Of Stock" stepKey="seeProductDisplayedAsOutOfStock"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUSCustomerCheckoutWithCouponAndBankTransferPaymentMethodTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUSCustomerCheckoutWithCouponAndBankTransferPaymentMethodTest.xml index 6d5f79f3aadf4..2a07604c806d7 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUSCustomerCheckoutWithCouponAndBankTransferPaymentMethodTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUSCustomerCheckoutWithCouponAndBankTransferPaymentMethodTest.xml @@ -36,7 +36,7 @@ </after> <!-- Open Product page in StoreFront and assert product and price range --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProductPageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProductPageAndVerifyProduct"> <argument name="product" value="$$simpleProduct$$"/> </actionGroup> @@ -94,4 +94,4 @@ <!-- Assert order buttons --> <actionGroup ref="AdminAssertOrderAvailableButtonsActionGroup" stepKey="assertOrderButtons"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUpdatePriceInShoppingCartAfterProductSaveTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUpdatePriceInShoppingCartAfterProductSaveTest.xml index b4747a6bf7273..4bff22950174f 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUpdatePriceInShoppingCartAfterProductSaveTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUpdatePriceInShoppingCartAfterProductSaveTest.xml @@ -37,7 +37,7 @@ <amOnPage url="{{StorefrontProductPage.url($$createSimpleProduct.custom_attributes[url_key]$$)}}" stepKey="navigateToSimpleProductPage"/> <!--Add Product to Shopping Cart--> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage"> <argument name="productName" value="$$createSimpleProduct.name$$"/> </actionGroup> @@ -54,7 +54,7 @@ <openNewTab stepKey="openNewTab"/> <amOnPage url="{{AdminProductEditPage.url($$createSimpleProduct.id$$)}}" stepKey="goToProductEditPage"/> <fillField userInput="120" selector="{{AdminProductFormSection.productPrice}}" stepKey="setNewPrice"/> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <closeTab stepKey="closeTab"/> <!--Check price--> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUpdateShoppingCartSimpleProductQtyTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUpdateShoppingCartSimpleProductQtyTest.xml index 72f6cf95a6fbe..69aae3d94ee97 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUpdateShoppingCartSimpleProductQtyTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUpdateShoppingCartSimpleProductQtyTest.xml @@ -26,7 +26,7 @@ </createData> <!-- Add the newly created product to the shopping cart --> - <actionGroup ref="AddSimpleProductToCart" stepKey="addToCartFromStorefrontProductPage"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addToCartFromStorefrontProductPage"> <argument name="product" value="$$createProduct$$"/> </actionGroup> </before> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/UpdateProductFromMiniShoppingCartEntityTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/UpdateProductFromMiniShoppingCartEntityTest.xml index 7318f865a0dc1..6e484c30fa81e 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/UpdateProductFromMiniShoppingCartEntityTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/UpdateProductFromMiniShoppingCartEntityTest.xml @@ -24,7 +24,7 @@ <createData entity="simpleProductWithoutCategory" stepKey="createProduct"/> <!--Add product to cart--> - <actionGroup ref="AddSimpleProductToCart" stepKey="addToCartFromStorefrontProductPage"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addToCartFromStorefrontProductPage"> <argument name="product" value="$$createProduct$$"/> </actionGroup> </before> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml index 4b3e18fb31877..280338239ef58 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml @@ -63,7 +63,7 @@ <!--Proceed to store front and place an order with free shipping using created coupon--> <!--Add product to card--> - <actionGroup ref="AddSimpleProductToCart" stepKey="AddProductToCard"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="AddProductToCard"> <argument name="product" value="$$simpleproduct$$"/> </actionGroup> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAddDefaultImageConfigurableTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAddDefaultImageConfigurableTest.xml index 92928c9384672..2f9347157ef33 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAddDefaultImageConfigurableTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAddDefaultImageConfigurableTest.xml @@ -93,28 +93,28 @@ <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="productIndexPage"/> <waitForPageLoad time="30" stepKey="waitForPageLoad1"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGridColumnsInitial"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGrid"> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGridColumnsInitial"/> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProductGrid"> <argument name="product" value="$$baseConfigProductHandle$$"/> </actionGroup> - <actionGroup ref="openProducForEditByClickingRowXColumnYInProductGrid" stepKey="openProducForEditByClickingRow1Column2InProductGrid1"/> + <actionGroup ref="OpenProductForEditByClickingRowXColumnYInProductGridActionGroup" stepKey="openProducForEditByClickingRow1Column2InProductGrid1"/> <!-- Add image to product --> - <actionGroup ref="addProductImage" stepKey="addImageForProduct"> + <actionGroup ref="AddProductImageActionGroup" stepKey="addImageForProduct"> <argument name="image" value="MagentoLogo"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!-- Assert product image in admin product form --> - <actionGroup ref="assertProductImageAdminProductPage" stepKey="assertProductImageAdminProductPage"/> + <actionGroup ref="AssertProductImageAdminProductPageActionGroup" stepKey="assertProductImageAdminProductPage"/> <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="AssertProductInStorefrontProductPage"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="AssertProductInStorefrontProductPage"> <argument name="product" value="$$baseConfigProductHandle$$"/> </actionGroup> <!-- Assert product image in storefront product page --> - <actionGroup ref="assertProductImageStorefrontProductPage2" stepKey="assertProductImageStorefrontProductPage"> + <actionGroup ref="AssertProductImageStorefrontProductPage2ActionGroup" stepKey="assertProductImageStorefrontProductPageActionGroup"> <argument name="product" value="$$baseConfigProductHandle$$"/> <argument name="image" value="MagentoLogo"/> </actionGroup> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAddingNewOptionsWithImagesAndPricesToConfigurableProductTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAddingNewOptionsWithImagesAndPricesToConfigurableProductTest.xml index 36c135c427365..67f432ca48fa4 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAddingNewOptionsWithImagesAndPricesToConfigurableProductTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAddingNewOptionsWithImagesAndPricesToConfigurableProductTest.xml @@ -104,7 +104,7 @@ <click selector="{{ConfigurableProductSection.generateConfigure}}" stepKey="clickGenerateConfigure"/> <waitForPageLoad stepKey="waitForProductPageLoad"/> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!--Go to frontend and check image and price--> <amOnPage url="{{StorefrontProductPage.url($$createConfigProductCreateConfigurableProduct.custom_attributes[url_key]$$)}}" stepKey="goToProductPage"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAssertNoticeThatExistingSkuAutomaticallyChangedWhenSavingProductWithSameSkuTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAssertNoticeThatExistingSkuAutomaticallyChangedWhenSavingProductWithSameSkuTest.xml index c085229da8028..a1faa2b156808 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAssertNoticeThatExistingSkuAutomaticallyChangedWhenSavingProductWithSameSkuTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAssertNoticeThatExistingSkuAutomaticallyChangedWhenSavingProductWithSameSkuTest.xml @@ -22,12 +22,12 @@ </before> <after> <!-- Delete configurable product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> <!-- Delete product attribute --> - <actionGroup ref="deleteProductAttributeByLabel" stepKey="deleteProductAttribute"> + <actionGroup ref="DeleteProductAttributeByLabelActionGroup" stepKey="deleteProductAttribute"> <argument name="ProductAttribute" value="colorProductAttribute"/> </actionGroup> @@ -38,12 +38,12 @@ <!-- Create configurable product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> <waitForPageLoad stepKey="waitForProductGridPageLoad"/> - <actionGroup ref="goToCreateProductPage" stepKey="createConfigurableProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="createConfigurableProduct"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> <!-- Fill configurable product values --> - <actionGroup ref="fillMainProductForm" stepKey="fillConfigurableProductValues"> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillConfigurableProductValues"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckConfigurableProductAttributeValueUniquenessTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckConfigurableProductAttributeValueUniquenessTest.xml index df6afdcfd2243..3600d6e82bd82 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckConfigurableProductAttributeValueUniquenessTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckConfigurableProductAttributeValueUniquenessTest.xml @@ -26,11 +26,11 @@ <after> <!--Delete created data--> <comment userInput="Delete created data" stepKey="deleteCreatedData"/> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteConfigurableProductAndOptions"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteConfigurableProductAndOptions"> <argument name="product" value="$$createConfigProduct$$"/> </actionGroup> <waitForPageLoad stepKey="waitForProductIndexPage"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGridColumnsInitial"/> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGridColumnsInitial"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createProductAttribute" stepKey="deleteAttribute"/> <actionGroup ref="logout" stepKey="logOut"/> @@ -45,7 +45,7 @@ <comment userInput="Go to created product page" stepKey="goToProdPage"/> <amOnPage url="{{ProductCatalogPage.url}}" stepKey="goToProductGrid"/> <waitForPageLoad stepKey="waitForProductPage1"/> - <actionGroup ref="filterProductGridByName2" stepKey="filterByName"> + <actionGroup ref="FilterProductGridByName2ActionGroup" stepKey="filterByName"> <argument name="name" value="$$createConfigProduct.name$$"/> </actionGroup> <click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnProductName"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckResultsOfColorAndOtherFiltersTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckResultsOfColorAndOtherFiltersTest.xml index de0cca11235ea..84fbab5fb4f02 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckResultsOfColorAndOtherFiltersTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckResultsOfColorAndOtherFiltersTest.xml @@ -71,7 +71,7 @@ <!-- Login as Admin --> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <!-- Add created attributes with options to Attribute Set --> - <actionGroup ref="AdminAddUnassignedAttributeToGroup" stepKey="createDefaultAttributeSet"> + <actionGroup ref="AdminAddUnassignedAttributeToGroupActionGroup" stepKey="createDefaultAttributeSet"> <argument name="label" value="mySet"/> <argument name="firstOption" value="$$createConfigProductAttribute.attribute_code$$"/> <argument name="secondOption" value="$$createConfigProductAttribute2.attribute_code$$"/> @@ -86,7 +86,7 @@ <deleteData createDataKey="createThirdConfigurableProduct" stepKey="deleteThirdProduct"/> <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> <!-- Delete attribute set --> - <actionGroup ref="deleteAttributeSetByLabel" stepKey="deleteAttributeSet"> + <actionGroup ref="DeleteAttributeSetByLabelActionGroup" stepKey="deleteAttributeSet"> <argument name="label" value="mySet"/> </actionGroup> <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearAttributeSetsFilter"/> @@ -95,14 +95,14 @@ <argument name="productAttributeCode" value="$$createConfigProductAttribute.attribute_code$$"/> </actionGroup> <actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteProductAttributeByAttributeCode"> - <argument name="productAttributeCode" value="$$createConfigProductAttribute.attribute_code$$"/> + <argument name="ProductAttributeCode" value="$$createConfigProductAttribute.attribute_code$$"/> </actionGroup> <!-- Delete Second attribute --> <actionGroup ref="OpenProductAttributeFromSearchResultInGridActionGroup" stepKey="openSecondProductAttributeFromSearchResultInGrid"> <argument name="productAttributeCode" value="$$createConfigProductAttribute2.attribute_code$$"/> </actionGroup> <actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteSecondProductAttributeByAttributeCode"> - <argument name="productAttributeCode" value="$$createConfigProductAttribute2.attribute_code$$"/> + <argument name="ProductAttributeCode" value="$$createConfigProductAttribute2.attribute_code$$"/> </actionGroup> <!-- Clear filters --> <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearProductAttributesFilter"/> @@ -114,7 +114,7 @@ <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> <waitForPageLoad time="30" stepKey="wait1"/> <!-- Edit created first product as configurable product with options --> - <actionGroup ref="filterProductGridBySku" stepKey="filterGridByFirstProduct"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterGridByFirstProduct"> <argument name="product" value="$$createFirstConfigurableProduct$$"/> </actionGroup> <actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openEditProductFirst"> @@ -136,7 +136,7 @@ <waitForPageLoad stepKey="waitForMessage"/> <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSaveProductMessageFirst"/> <!-- Edit created second product as configurable product with options --> - <actionGroup ref="filterProductGridBySku" stepKey="filterGridBySecondProduct"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterGridBySecondProduct"> <argument name="product" value="$$createSecondConfigurableProduct$$"/> </actionGroup> <actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openEditProductSecond"> @@ -159,7 +159,7 @@ <waitForPageLoad stepKey="waitForSuccessMessage"/> <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSaveProductMessageSecond"/> <!-- Edit created third product as configurable product with options --> - <actionGroup ref="filterProductGridBySku" stepKey="filterGridByThirdProduct"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterGridByThirdProduct"> <argument name="product" value="$$createThirdConfigurableProduct$$"/> </actionGroup> <actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openEditProductThird"> @@ -181,7 +181,7 @@ <waitForPageLoad stepKey="waitForProductPage"/> <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSaveConfigurableProductMessage"/> <!-- Create Simple product with options --> - <actionGroup ref="filterProductGridBySku" stepKey="filterGridBySimpleProduct"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterGridBySimpleProduct"> <argument name="product" value="$$createSimpleProduct$$"/> </actionGroup> <actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openEditSimpleProduct"> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckValidatorConfigurableProductTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckValidatorConfigurableProductTest.xml index dd641fd370ba7..5bdccf15b19d3 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckValidatorConfigurableProductTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckValidatorConfigurableProductTest.xml @@ -34,13 +34,13 @@ <!--Delete created data--> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> - <actionGroup ref="deleteProductBySku" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteProduct"> <argument name="sku" value="{{ApiConfigurableProduct.name}}-thisIsShortName"/> </actionGroup> <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> <!-- Remove attribute --> - <actionGroup ref="deleteProductAttribute" stepKey="deleteAttribute"> + <actionGroup ref="DeleteProductAttributeActionGroup" stepKey="deleteAttribute"> <argument name="ProductAttribute" value="productDropDownAttribute"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> @@ -51,7 +51,7 @@ <waitForPageLoad stepKey="waitForAdminProductPageLoad"/> <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> - <actionGroup ref="filterProductGridBySku" stepKey="findCreatedProduct"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="findCreatedProduct"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> <waitForPageLoad stepKey="waitForProductFilterLoad"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductCreateTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductCreateTest.xml index 430007ae761f7..75d1745ebe7bc 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductCreateTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductCreateTest.xml @@ -130,7 +130,7 @@ <click selector="{{DropdownAttributeOptionsSection.deleteButton(1)}}" stepKey="deleteOption"/> <click selector="{{AttributePropertiesSection.Save}}" stepKey="saveAttribute"/> <click selector="{{AdminProductAttributeGridSection.ResetFilter}}" stepKey="resetFiltersOnGrid2"/> - <actionGroup stepKey="deleteProduct1" ref="deleteProductBySku"> + <actionGroup stepKey="deleteProduct1" ref="DeleteProductBySkuActionGroup"> <argument name="sku" value="$grabTextFromContent"/> </actionGroup> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductDeleteTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductDeleteTest.xml index 33a6da9dabf34..83e428b454c46 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductDeleteTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductDeleteTest.xml @@ -82,7 +82,7 @@ <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductList"/> <waitForPageLoad stepKey="wait2"/> <conditionalClick selector="{{AdminProductGridFilterSection.clearAll}}" dependentSelector="{{AdminProductGridFilterSection.clearAll}}" stepKey="clearAll" visible="true"/> - <actionGroup ref="searchProductGridByKeyword" stepKey="searchForProduct"> + <actionGroup ref="SearchProductGridByKeywordActionGroup" stepKey="searchForProduct"> <argument name="keyword" value="ApiConfigurableProduct.name"/> </actionGroup> <click selector="label.data-grid-checkbox-cell-inner" stepKey="clickCheckbox"/> @@ -231,7 +231,7 @@ <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductList"/> <waitForPageLoad stepKey="wait1"/> <conditionalClick selector="{{AdminProductGridFilterSection.clearAll}}" dependentSelector="{{AdminProductGridFilterSection.clearAll}}" stepKey="clearAll" visible="true"/> - <actionGroup ref="searchProductGridByKeyword" stepKey="searchForProduct"> + <actionGroup ref="SearchProductGridByKeywordActionGroup" stepKey="searchForProduct"> <argument name="keyword" value="ApiConfigurableProduct.name"/> </actionGroup> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductLongSkuTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductLongSkuTest.xml index cd09cbd295877..450e27f293893 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductLongSkuTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductLongSkuTest.xml @@ -44,7 +44,7 @@ <after> <!--Clean up products--> - <actionGroup ref="deleteProductByName" stepKey="cleanUpProducts"> + <actionGroup ref="DeleteProductByNameActionGroup" stepKey="cleanUpProducts"> <argument name="sku" value="{{ProductWithLongNameSku.sku}}"/> <argument name="name" value="{{ProductWithLongNameSku.name}}"/> </actionGroup> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductOutOfStockTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductOutOfStockTest.xml index 51b3e49f51913..6bba4aa6b43ce 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductOutOfStockTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductOutOfStockTest.xml @@ -94,7 +94,7 @@ <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"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="findCreatedProduct"> <argument name="product" value="ApiSimpleOne"/> </actionGroup> <waitForPageLoad stepKey="waitForFiltersToBeApplied"/> @@ -114,7 +114,7 @@ <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"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="findCreatedProduct2"> <argument name="product" value="ApiSimpleTwo"/> </actionGroup> <waitForPageLoad stepKey="waitForFiltersToBeApplied2"/> @@ -212,7 +212,7 @@ <see stepKey="checkForOutOfStock" selector="{{StorefrontProductInfoMainSection.stockIndication}}" userInput="IN STOCK" /> <!-- Delete the first simple product --> - <actionGroup stepKey="deleteProduct1" ref="deleteProductBySku"> + <actionGroup stepKey="deleteProduct1" ref="DeleteProductBySkuActionGroup"> <argument name="sku" value="{{ApiSimpleOne.sku}}"/> </actionGroup> @@ -222,7 +222,7 @@ <see stepKey="checkForOutOfStock2" selector="{{StorefrontProductInfoMainSection.stockIndication}}" userInput="IN STOCK"/> <!-- Delete the second simple product --> - <actionGroup stepKey="deleteProduct2" ref="deleteProductBySku"> + <actionGroup stepKey="deleteProduct2" ref="DeleteProductBySkuActionGroup"> <argument name="sku" value="{{ApiSimpleTwo.sku}}"/> </actionGroup> @@ -314,7 +314,7 @@ <see stepKey="checkForOutOfStock" selector="{{StorefrontProductInfoMainSection.stockIndication}}" userInput="IN STOCK" /> <!-- Delete the first simple product --> - <actionGroup stepKey="deleteProduct1" ref="deleteProductBySku"> + <actionGroup stepKey="deleteProduct1" ref="DeleteProductBySkuActionGroup"> <argument name="sku" value="{{ApiSimpleOne.sku}}"/> </actionGroup> @@ -327,7 +327,7 @@ <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"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="findCreatedProduct2"> <argument name="product" value="ApiSimpleTwo"/> </actionGroup> <waitForPageLoad stepKey="waitForFiltersToBeApplied2"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductSearchTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductSearchTest.xml index 410c85d314904..889ca5b24b242 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductSearchTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductSearchTest.xml @@ -78,7 +78,7 @@ <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductList"/> <waitForPageLoad stepKey="wait1"/> <conditionalClick selector="{{AdminProductGridFilterSection.clearAll}}" dependentSelector="{{AdminProductGridFilterSection.clearAll}}" stepKey="clearAll" visible="true"/> - <actionGroup ref="searchProductGridByKeyword" stepKey="searchForProduct"> + <actionGroup ref="SearchProductGridByKeywordActionGroup" stepKey="searchForProduct"> <argument name="keyword" value="ApiConfigurableProduct.name"/> </actionGroup> <waitForPageLoad stepKey="wait2"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductSetEditContentTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductSetEditContentTest.xml index 42e12852f563f..0da4c265a73af 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductSetEditContentTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductSetEditContentTest.xml @@ -21,16 +21,16 @@ </annotations> <after> <!-- Delete configurable product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="BaseConfigurableProduct"/> </actionGroup> </after> <!-- Create product --> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct"> <argument name="product" value="BaseConfigurableProduct"/> </actionGroup> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillProductForm"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillProductForm"> <argument name="product" value="BaseConfigurableProduct"/> </actionGroup> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateAttributeTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateAttributeTest.xml index dba481b64810a..c437b39a405cd 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateAttributeTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateAttributeTest.xml @@ -117,7 +117,7 @@ <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"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="findCreatedProduct"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> <waitForPageLoad stepKey="waitForProductFilterLoad"/> @@ -227,7 +227,7 @@ <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"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="findCreatedProduct"> <argument name="product" value="$$createConfigProduct$$"/> </actionGroup> <waitForPageLoad stepKey="waitForProductFilterLoad"/> @@ -265,7 +265,7 @@ <waitForPageLoad stepKey="waitForStoreFrontProductPageLoad"/> <!-- Find the simple product that we just created using the product grid and delete it --> - <actionGroup ref="deleteProductBySku" stepKey="findCreatedProduct2"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="findCreatedProduct2"> <argument name="sku" value="{{ApiConfigurableProduct.sku}}2-simple"/> </actionGroup> </test> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest.xml index 7c6cd57097591..2fe4e1925ce6d 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest.xml @@ -48,7 +48,7 @@ <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductList"/> <waitForPageLoad stepKey="wait1"/> <conditionalClick selector="{{AdminProductGridFilterSection.clearAll}}" dependentSelector="{{AdminProductGridFilterSection.clearAll}}" visible="true" stepKey="clearAll"/> - <actionGroup ref="searchProductGridByKeyword" stepKey="searchForProduct"> + <actionGroup ref="SearchProductGridByKeywordActionGroup" stepKey="searchForProduct"> <argument name="keyword" value="ApiConfigurableProduct.name"/> </actionGroup> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableSetEditRelatedProductsTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableSetEditRelatedProductsTest.xml index 11f1e9bb33c10..e15727b75d86e 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableSetEditRelatedProductsTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableSetEditRelatedProductsTest.xml @@ -24,7 +24,7 @@ </before> <after> <!-- Delete configurable product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="_defaultProduct"/> </actionGroup> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndEditConfigurableProductSettingsTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndEditConfigurableProductSettingsTest.xml index fd80c41b64962..6632cbcee30f2 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndEditConfigurableProductSettingsTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndEditConfigurableProductSettingsTest.xml @@ -29,12 +29,12 @@ <!-- Create a configurable product --> <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndexPage"/> - <actionGroup ref="goToCreateProductPage" stepKey="createConfigurableProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="createConfigurableProduct"> <argument name="product" value="BaseConfigurableProduct"/> </actionGroup> <!-- Fill configurable product values --> - <actionGroup ref="fillMainProductForm" stepKey="fillConfigurableProductValues"> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillConfigurableProductValues"> <argument name="product" value="BaseConfigurableProduct"/> </actionGroup> @@ -47,7 +47,7 @@ </actionGroup> <!-- Save product form --> - <actionGroup ref="saveProductForm" stepKey="clickSaveButton"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="clickSaveButton"/> <!-- Open product page --> <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openStorefrontProductPage"> @@ -87,7 +87,7 @@ <actionGroup ref="AdminSwitchProductGiftMessageStatusActionGroup" stepKey="disableGiftMessageSettings"/> <!-- Save product form --> - <actionGroup ref="saveProductForm" stepKey="clickSaveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="clickSaveProduct"/> <!-- Verify Url Key after changing --> <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPage"> @@ -102,7 +102,7 @@ <dontSeeElement selector="{{StorefrontProductCartGiftOptionSection.giftOptions}}" stepKey="dontSeeGiftOptionBtn"/> <!-- Delete created configurable product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="BaseConfigurableProduct"/> </actionGroup> </test> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml index 2cc71964042a4..c1308bcf57f1e 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml @@ -19,10 +19,10 @@ <group value="catalog"/> <group value="mtf_migrated"/> </annotations> - <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="openProductFillForm"> + <actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="openProductFillForm"> <argument name="productType" value="configurable"/> </actionGroup> - <actionGroup ref="fillMainProductForm" stepKey="fillProductForm"> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillProductForm"> <argument name="product" value="_defaultProduct"/> </actionGroup> <see selector="{{AdminProductGridSection.productGridCell('1', 'Type')}}" userInput="Simple Product" stepKey="seeProductTypeInGrid"/> @@ -38,7 +38,7 @@ <group value="catalog"/> <group value="mtf_migrated"/> </annotations> - <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="openProductFillForm"> + <actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="openProductFillForm"> <argument name="productType" value="configurable"/> </actionGroup> <see selector="{{AdminProductGridSection.productGridCell('1', 'Type')}}" userInput="Virtual Product" stepKey="seeProductTypeInGrid"/> @@ -63,10 +63,10 @@ <after> <deleteData stepKey="deleteAttribute" createDataKey="createConfigProductAttribute"/> </after> - <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="openProductFillForm"> + <actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="openProductFillForm"> <argument name="productType" value="virtual"/> </actionGroup> - <actionGroup ref="fillMainProductForm" stepKey="fillProductForm"> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillProductForm"> <argument name="product" value="_defaultProduct"/> </actionGroup> <comment before="createConfiguration" stepKey="beforeCreateConfiguration" userInput="Adding Configuration to Product"/> @@ -100,12 +100,12 @@ <after> <deleteData stepKey="deleteAttribute" createDataKey="createConfigProductAttribute"/> </after> - <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="openProductFillForm"> + <actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="openProductFillForm"> <argument name="productType" value="simple"/> </actionGroup> <!-- Create configurable product from simple product page--> <comment userInput="Create configurable product" stepKey="commentCreateProduct"/> - <actionGroup ref="fillMainProductForm" stepKey="fillProductForm"> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillProductForm"> <argument name="product" value="_defaultProduct"/> </actionGroup> <comment before="createConfiguration" stepKey="beforeCreateConfiguration" userInput="Adding Configuration to Product"/> @@ -141,11 +141,11 @@ </createData> </before> <after> - <actionGroup ref="GoToProductCatalogPage" stepKey="goToProductCatalogPage"/> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteConfigurableProduct"> + <actionGroup ref="GoToProductCatalogPageActionGroup" stepKey="goToProductCatalogPage"/> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteConfigurableProduct"> <argument name="product" value="_defaultProduct"/> </actionGroup> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetSearch"/> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetSearch"/> <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/> <deleteData stepKey="deleteAttribute" createDataKey="createConfigProductAttribute"/> <actionGroup ref="logout" stepKey="logout"/> @@ -155,17 +155,17 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/> <!-- Open Dropdown and select downloadable product option --> <comment stepKey="beforeOpenProductFillForm" userInput="Selecting Product from the Add Product Dropdown"/> - <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="openProductFillForm"> + <actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="openProductFillForm"> <argument name="productType" value="downloadable"/> </actionGroup> <scrollTo selector="{{AdminProductDownloadableSection.sectionHeader}}" stepKey="scrollToDownloadableInfo" /> <uncheckOption selector="{{AdminProductDownloadableSection.isDownloadableProduct}}" stepKey="checkIsDownloadable"/> <!-- Fill form for Downloadable Product Type --> <comment stepKey="beforeFillProductForm" userInput="Filling Product Form"/> - <actionGroup ref="fillMainProductForm" stepKey="fillProductForm"> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillProductForm"> <argument name="product" value="_defaultProduct"/> </actionGroup> - <actionGroup ref="SetProductUrlKey" stepKey="setProductUrl"> + <actionGroup ref="SetProductUrlKeyActionGroup" stepKey="setProductUrl"> <argument name="product" value="_defaultProduct"/> </actionGroup> <comment before="createConfiguration" stepKey="beforeCreateConfiguration" userInput="Adding Configuration to Product"/> @@ -175,13 +175,13 @@ <actionGroup ref="saveConfiguredProduct" stepKey="saveProductForm"/> <!-- Check that product was added with implicit type change --> <comment stepKey="beforeVerify" userInput="Verify Product Type Assigned Correctly"/> - <actionGroup ref="GoToProductCatalogPage" stepKey="goToProductCatalogPage"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetSearch"/> - <actionGroup ref="filterProductGridByName" stepKey="searchForProduct"> + <actionGroup ref="GoToProductCatalogPageActionGroup" stepKey="goToProductCatalogPage"/> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetSearch"/> + <actionGroup ref="FilterProductGridByNameActionGroup" stepKey="searchForProduct"> <argument name="product" value="_defaultProduct"/> </actionGroup> <see selector="{{AdminProductGridSection.productGridCell('2', 'Type')}}" userInput="Configurable Product" stepKey="seeProductTypeInGrid"/> - <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="assertProductInStorefrontProductPage"> + <actionGroup ref="AssertProductInStorefrontProductPageActionGroup" stepKey="assertProductInStorefrontProductPage"> <argument name="product" value="_defaultProduct"/> </actionGroup> <actionGroup ref="VerifyOptionInProductStorefront" stepKey="verifyConfigurableOption"> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductBasedOnParentSkuTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductBasedOnParentSkuTest.xml index f4f607e9119b6..36cc4363e22f3 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductBasedOnParentSkuTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductBasedOnParentSkuTest.xml @@ -22,12 +22,12 @@ </before> <after> <!-- Delete configurable product with children products --> - <actionGroup ref="deleteProductBySku" stepKey="deleteProducts"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteProducts"> <argument name="sku" value="{{ApiConfigurableProduct.sku}}"/> </actionGroup> <!-- Delete product attribute --> - <actionGroup ref="deleteProductAttributeByLabel" stepKey="deleteProductAttribute"> + <actionGroup ref="DeleteProductAttributeByLabelActionGroup" stepKey="deleteProductAttribute"> <argument name="ProductAttribute" value="colorProductAttribute"/> </actionGroup> @@ -38,12 +38,12 @@ <!-- Create configurable product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> <waitForPageLoad stepKey="waitForProductGridPageLoad"/> - <actionGroup ref="goToCreateProductPage" stepKey="createConfigurableProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="createConfigurableProduct"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> <!-- Fill configurable product values --> - <actionGroup ref="fillMainProductForm" stepKey="fillConfigurableProductValues"> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillConfigurableProductValues"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> @@ -70,13 +70,13 @@ <!-- Assert child products generated sku in grid --> <amOnPage url="{{ProductCatalogPage.url}}" stepKey="openProductCatalogPage"/> <waitForPageLoad stepKey="waitForProductCatalogPageLoad"/> - <actionGroup ref="filterProductGridByName2" stepKey="filterFirstProductByNameInGrid"> + <actionGroup ref="FilterProductGridByName2ActionGroup" stepKey="filterFirstProductByNameInGrid"> <argument name="name" value="{{colorConfigurableProductAttribute1.name}}"/> </actionGroup> <see selector="{{AdminProductGridSection.productGridCell('1', 'SKU')}}" userInput="{{ApiConfigurableProduct.sku}}-{{colorConfigurableProductAttribute1.name}}" stepKey="seeFirstProductSkuInGrid"/> - <actionGroup ref="filterProductGridByName2" stepKey="filterSecondProductByNameInGrid"> + <actionGroup ref="FilterProductGridByName2ActionGroup" stepKey="filterSecondProductByNameInGrid"> <argument name="name" value="{{colorConfigurableProductAttribute2.name}}"/> </actionGroup> <see selector="{{AdminProductGridSection.productGridCell('1', 'SKU')}}" userInput="{{ApiConfigurableProduct.sku}}-{{colorConfigurableProductAttribute2.name}}" stepKey="seeSecondProductSkuInGrid"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithCreatingCategoryAndAttributeTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithCreatingCategoryAndAttributeTest.xml index a7242b43c2b5f..00f166d0f29d0 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithCreatingCategoryAndAttributeTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithCreatingCategoryAndAttributeTest.xml @@ -23,25 +23,25 @@ </before> <after> <!-- Delete configurable product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> <!-- Delete children products --> - <actionGroup ref="deleteProductBySku" stepKey="deleteFirstChildProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteFirstChildProduct"> <argument name="sku" value="{{colorConfigurableProductAttribute1.sku}}"/> </actionGroup> - <actionGroup ref="deleteProductBySku" stepKey="deleteSecondChildProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteSecondChildProduct"> <argument name="sku" value="{{colorConfigurableProductAttribute2.sku}}"/> </actionGroup> <!-- Delete product attribute --> - <actionGroup ref="deleteProductAttributeByLabel" stepKey="deleteProductAttribute"> + <actionGroup ref="DeleteProductAttributeByLabelActionGroup" stepKey="deleteProductAttribute"> <argument name="ProductAttribute" value="colorProductAttribute"/> </actionGroup> <!-- Delete attribute set --> - <actionGroup ref="deleteAttributeSetByLabel" stepKey="deleteAttributeSet"> + <actionGroup ref="DeleteAttributeSetByLabelActionGroup" stepKey="deleteAttributeSet"> <argument name="label" value="{{ProductAttributeFrontendLabel.label}}"/> </actionGroup> @@ -55,7 +55,7 @@ <!-- Create configurable product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> <waitForPageLoad stepKey="waitForProductGridPageLoad"/> - <actionGroup ref="goToCreateProductPage" stepKey="createConfigurableProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="createConfigurableProduct"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> @@ -90,7 +90,7 @@ <!-- Find configurable product in grid --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> <waitForPageLoad stepKey="waitForAdminProductPageLoad"/> - <actionGroup ref="filterProductGridBySku" stepKey="findCreatedConfigurableProduct"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="findCreatedConfigurableProduct"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithDisabledChildrenProductsTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithDisabledChildrenProductsTest.xml index 49f3f8b5ea931..3379e0d053ed9 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithDisabledChildrenProductsTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithDisabledChildrenProductsTest.xml @@ -43,7 +43,7 @@ <actionGroup ref="noDisplayOutOfStockProduct" stepKey="revertDisplayOutOfStockProduct"/> <!-- Delete configurable product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> @@ -59,12 +59,12 @@ <!-- Create configurable product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> <waitForPageLoad stepKey="waitForProductGridPageLoad"/> - <actionGroup ref="goToCreateProductPage" stepKey="createConfigurableProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="createConfigurableProduct"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> <!-- Fill configurable product values --> - <actionGroup ref="fillMainProductForm" stepKey="fillConfigurableProductValues"> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillConfigurableProductValues"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> @@ -83,12 +83,12 @@ </actionGroup> <!-- Save configurable product --> - <actionGroup ref="saveProductForm" stepKey="saveConfigurableProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveConfigurableProduct"/> <!-- Find configurable product in grid --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> <waitForPageLoad stepKey="waitForAdminProductPageLoad"/> - <actionGroup ref="filterProductGridBySku" stepKey="findCreatedConfigurableProduct"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="findCreatedConfigurableProduct"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithImagesTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithImagesTest.xml index 9796c14f5519a..d536ed1b4b960 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithImagesTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithImagesTest.xml @@ -46,7 +46,7 @@ </before> <after> <!-- Delete configurable product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> @@ -62,12 +62,12 @@ <!--Create configurable product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> <waitForPageLoad stepKey="waitForProductGridPageLoad"/> - <actionGroup ref="goToCreateProductPage" stepKey="createConfigurableProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="createConfigurableProduct"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> <!-- Fill configurable product values --> - <actionGroup ref="fillMainProductForm" stepKey="fillConfigurableProductValues"> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillConfigurableProductValues"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> @@ -75,7 +75,7 @@ <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[$$createCategory.name$$]" stepKey="fillCategory" after="fillConfigurableProductValues"/> <!-- Add image to product --> - <actionGroup ref="addProductImage" stepKey="addImageForProduct"> + <actionGroup ref="AddProductImageActionGroup" stepKey="addImageForProduct"> <argument name="image" value="MagentoLogo"/> </actionGroup> @@ -142,7 +142,7 @@ <!-- Assert product image in storefront product page --> <amOnPage url="{{ApiConfigurableProduct.urlKey}}.html" stepKey="amOnProductPage"/> - <actionGroup ref="assertProductImageStorefrontProductPage" stepKey="assertProductImageStorefrontProductPage"> + <actionGroup ref="AssertProductImageStorefrontProductPageActionGroup" stepKey="assertProductImageStorefrontProductPage"> <argument name="product" value="ApiConfigurableProduct"/> <argument name="image" value="MagentoLogo"/> </actionGroup> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDisplayOutOfStockProductsTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDisplayOutOfStockProductsTest.xml index 308e256543736..f12f34cbb02d6 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDisplayOutOfStockProductsTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDisplayOutOfStockProductsTest.xml @@ -64,7 +64,7 @@ <actionGroup ref="noDisplayOutOfStockProduct" stepKey="revertDisplayOutOfStockProduct"/> <!-- Delete configurable product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> @@ -82,12 +82,12 @@ <!--Create configurable product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> <waitForPageLoad stepKey="waitForProductGridPageLoad"/> - <actionGroup ref="goToCreateProductPage" stepKey="createConfigurableProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="createConfigurableProduct"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> <!--Fill configurable product values --> - <actionGroup ref="fillMainProductForm" stepKey="fillConfigurableProductValues"> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillConfigurableProductValues"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> @@ -116,7 +116,7 @@ </actionGroup> <!-- Save configurable product --> - <actionGroup ref="saveProductForm" stepKey="saveConfigurableProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveConfigurableProduct"/> <!-- Display out of stock product --> <actionGroup ref="displayOutOfStockProduct" stepKey="displayOutOfStockProduct"/> @@ -137,4 +137,4 @@ <waitForPageLoad stepKey="waitForProductPageLoad"/> <see userInput="$$createConfigProductAttributeOptionThree.option[store_labels][1][label]$$" selector="{{StorefrontProductInfoMainSection.optionByAttributeId($$createConfigProductAttribute.attribute_id$$)}}" stepKey="assertOptionNotAvailable" /> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDontDisplayOutOfStockProductsTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDontDisplayOutOfStockProductsTest.xml index e24ac07c30d1e..527900b1767bf 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDontDisplayOutOfStockProductsTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDontDisplayOutOfStockProductsTest.xml @@ -61,7 +61,7 @@ </before> <after> <!-- Delete configurable product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> @@ -79,12 +79,12 @@ <!--Create configurable product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> <waitForPageLoad stepKey="waitForProductGridPageLoad"/> - <actionGroup ref="goToCreateProductPage" stepKey="createConfigurableProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="createConfigurableProduct"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> <!--Fill configurable product values --> - <actionGroup ref="fillMainProductForm" stepKey="fillConfigurableProductValues"> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillConfigurableProductValues"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> @@ -113,7 +113,7 @@ </actionGroup> <!-- Save configurable product --> - <actionGroup ref="saveProductForm" stepKey="saveConfigurableProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveConfigurableProduct"/> <!-- Flash cache --> <magentoCLI command="cache:flush" stepKey="flushCache"/> @@ -131,4 +131,4 @@ <waitForPageLoad stepKey="waitForPageLoad"/> <dontSee userInput="$$createConfigProductAttributeOptionThree.option[store_labels][1][label]$$" selector="{{StorefrontProductInfoMainSection.optionByAttributeId($$createConfigProductAttribute.attribute_id$$)}}" stepKey="assertOptionNotAvailable"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTierPriceForOneItemTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTierPriceForOneItemTest.xml index 51f4bf0279942..660651fecf69b 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTierPriceForOneItemTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTierPriceForOneItemTest.xml @@ -54,7 +54,7 @@ </before> <after> <!-- Delete configurable product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> @@ -70,12 +70,12 @@ <!--Create configurable product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> <waitForPageLoad stepKey="waitProductGridPageLoad"/> - <actionGroup ref="goToCreateProductPage" stepKey="createConfigurableProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="createConfigurableProduct"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> <!--Fill configurable product values --> - <actionGroup ref="fillMainProductForm" stepKey="fillConfigurableProductValues"> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillConfigurableProductValues"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> @@ -96,7 +96,7 @@ </actionGroup> <!-- Save configurable product --> - <actionGroup ref="saveProductForm" stepKey="saveConfigurableProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveConfigurableProduct"/> <!-- Assert product tier price on product page --> <amOnPage url="{{ApiConfigurableProduct.urlKey}}.html" stepKey="amOnProductPage"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTwoOptionsAssignedToCategoryTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTwoOptionsAssignedToCategoryTest.xml index 1db9b3e5b79b2..2cee05be69bbe 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTwoOptionsAssignedToCategoryTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTwoOptionsAssignedToCategoryTest.xml @@ -26,25 +26,25 @@ </before> <after> <!-- Delete configurable product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> <!-- Delete children products --> - <actionGroup ref="deleteProductBySku" stepKey="deleteFirstChildProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteFirstChildProduct"> <argument name="sku" value="{{colorConfigurableProductAttribute1.sku}}"/> </actionGroup> - <actionGroup ref="deleteProductBySku" stepKey="deleteSecondChildProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteSecondChildProduct"> <argument name="sku" value="{{colorConfigurableProductAttribute2.sku}}"/> </actionGroup> <!-- Delete product attribute --> - <actionGroup ref="deleteProductAttributeByLabel" stepKey="deleteProductAttribute"> + <actionGroup ref="DeleteProductAttributeByLabelActionGroup" stepKey="deleteProductAttribute"> <argument name="ProductAttribute" value="colorProductAttribute"/> </actionGroup> <!-- Delete attribute set --> - <actionGroup ref="deleteAttributeSetByLabel" stepKey="deleteAttributeSet"> + <actionGroup ref="DeleteAttributeSetByLabelActionGroup" stepKey="deleteAttributeSet"> <argument name="label" value="{{ProductAttributeFrontendLabel.label}}"/> </actionGroup> @@ -58,12 +58,12 @@ <!-- Create configurable product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> <waitForPageLoad stepKey="waitForProductGridPageLoad"/> - <actionGroup ref="goToCreateProductPage" stepKey="createConfigurableProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="createConfigurableProduct"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> <!-- Fill configurable product values --> - <actionGroup ref="fillMainProductForm" stepKey="fillConfigurableProductValues"> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillConfigurableProductValues"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> @@ -91,15 +91,15 @@ <actionGroup ref="saveConfigurableProductWithNewAttributeSet" stepKey="saveConfigurableProduct"/> <!-- Assert child products in grid --> - <actionGroup ref="viewProductInAdminGrid" stepKey="viewFirstChildProductInAdminGrid"> + <actionGroup ref="ViewProductInAdminGridActionGroup" stepKey="viewFirstChildProductInAdminGrid"> <argument name="product" value="colorConfigurableProductAttribute1"/> </actionGroup> - <actionGroup ref="viewProductInAdminGrid" stepKey="viewSecondChildProductInAdminGrid"> + <actionGroup ref="ViewProductInAdminGridActionGroup" stepKey="viewSecondChildProductInAdminGrid"> <argument name="product" value="colorConfigurableProductAttribute2"/> </actionGroup> <!-- Assert configurable product in grid --> - <actionGroup ref="filterProductGridBySkuAndName" stepKey="findCreatedConfigurableProduct"> + <actionGroup ref="FilterProductGridBySkuAndNameActionGroup" stepKey="findCreatedConfigurableProduct"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> <see selector="{{AdminProductGridSection.productGridCell('1', 'Type')}}" userInput="{{ApiConfigurableProduct.type_id}}" stepKey="seeProductTypeInGrid"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTwoOptionsWithoutAssignedToCategoryTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTwoOptionsWithoutAssignedToCategoryTest.xml index 934a410d58a8a..f36465b853317 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTwoOptionsWithoutAssignedToCategoryTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTwoOptionsWithoutAssignedToCategoryTest.xml @@ -22,25 +22,25 @@ </before> <after> <!-- Delete configurable product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> <!-- Delete children products --> - <actionGroup ref="deleteProductBySku" stepKey="deleteFirstChildProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteFirstChildProduct"> <argument name="sku" value="{{colorConfigurableProductAttribute1.sku}}"/> </actionGroup> - <actionGroup ref="deleteProductBySku" stepKey="deleteSecondChildProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteSecondChildProduct"> <argument name="sku" value="{{colorConfigurableProductAttribute2.sku}}"/> </actionGroup> <!-- Delete product attribute --> - <actionGroup ref="deleteProductAttributeByLabel" stepKey="deleteProductAttribute"> + <actionGroup ref="DeleteProductAttributeByLabelActionGroup" stepKey="deleteProductAttribute"> <argument name="ProductAttribute" value="colorProductAttribute"/> </actionGroup> <!-- Delete attribute set --> - <actionGroup ref="deleteAttributeSetByLabel" stepKey="deleteAttributeSet"> + <actionGroup ref="DeleteAttributeSetByLabelActionGroup" stepKey="deleteAttributeSet"> <argument name="label" value="{{ProductAttributeFrontendLabel.label}}"/> </actionGroup> @@ -51,12 +51,12 @@ <!-- Create configurable product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> <waitForPageLoad stepKey="waitForProductGridPageLoad"/> - <actionGroup ref="goToCreateProductPage" stepKey="createConfigurableProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="createConfigurableProduct"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> <!-- Fill configurable product values --> - <actionGroup ref="fillMainProductForm" stepKey="fillConfigurableProductValues"> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillConfigurableProductValues"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> @@ -81,15 +81,15 @@ <actionGroup ref="saveConfigurableProductWithNewAttributeSet" stepKey="saveConfigurableProduct"/> <!-- Assert Child Products in grid --> - <actionGroup ref="viewProductInAdminGrid" stepKey="viewFirstChildProductInAdminGrid"> + <actionGroup ref="ViewProductInAdminGridActionGroup" stepKey="viewFirstChildProductInAdminGrid"> <argument name="product" value="colorConfigurableProductAttribute1"/> </actionGroup> - <actionGroup ref="viewProductInAdminGrid" stepKey="viewSecondChildProductInAdminGrid"> + <actionGroup ref="ViewProductInAdminGridActionGroup" stepKey="viewSecondChildProductInAdminGrid"> <argument name="product" value="colorConfigurableProductAttribute2"/> </actionGroup> <!-- Assert Configurable Product in grid --> - <actionGroup ref="filterProductGridBySkuAndName" stepKey="findCreatedConfigurableProduct"> + <actionGroup ref="FilterProductGridBySkuAndNameActionGroup" stepKey="findCreatedConfigurableProduct"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> <see selector="{{AdminProductGridSection.productGridCell('1', 'Type')}}" userInput="{{ApiConfigurableProduct.type_id}}" stepKey="seeProductTypeInGrid"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminDeleteConfigurableProductTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminDeleteConfigurableProductTest.xml index fb2920be528b6..c2edbaa4e6e87 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminDeleteConfigurableProductTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminDeleteConfigurableProductTest.xml @@ -28,7 +28,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <actionGroup ref="logout" stepKey="logout"/> </after> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteConfigurableProductFilteredBySkuAndName"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteConfigurableProductFilteredBySkuAndName"> <argument name="product" value="$$createConfigurableProduct$$"/> </actionGroup> <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="A total of 1 record(s) have been deleted." stepKey="deleteMessage"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml index fa21d20eb4456..6dc77b691bb4f 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml @@ -39,7 +39,7 @@ <comment userInput="Delete product" stepKey="commentDeleteProduct"/> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteAttribute"/> - <actionGroup ref="deleteAllDuplicateProductUsingProductGrid" stepKey="deleteAllDuplicateProducts"> + <actionGroup ref="DeleteAllDuplicateProductUsingProductGridActionGroup" stepKey="deleteAllDuplicateProducts"> <argument name="product" value="$$createProduct$$"/> </actionGroup> <actionGroup ref="AdminClearFiltersActionGroup" stepKey="clearProductFilters"/> @@ -56,7 +56,7 @@ <!--Assert configurable product on Admin product page grid--> <comment userInput="Assert configurable product in Admin product page grid" stepKey="commentAssertConfigProductOnAdmin"/> <amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="goToCatalogProductPage"/> - <actionGroup ref="filterProductGridBySku2" stepKey="filterProductGridBySku"> + <actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterProductGridBySku"> <argument name="sku" value="$$createProduct.sku$$"/> </actionGroup> <see selector="{{AdminProductGridSection.productGridCell('1', 'Name')}}" userInput="$$createProduct.name$$" stepKey="seeProductNameInGrid"/> @@ -97,11 +97,11 @@ <fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="{{SimpleProduct2.quantity}}" stepKey="fillProductQty"/> <clearField selector="{{AdminProductFormSection.productWeight}}" stepKey="clearWeightField"/> <selectOption selector="{{AdminProductFormSection.productWeightSelect}}" userInput="This item has no weight" stepKey="selectNoWeight"/> - <actionGroup ref="saveProductForm" stepKey="saveVirtualProductForm"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveVirtualProductForm"/> <!--Assert virtual product on Admin product page grid--> <comment userInput="Assert virtual product on Admin product page grid" stepKey="commentAssertVirtualProductOnAdmin"/> <amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="goToCatalogProductPageForVirtual"/> - <actionGroup ref="filterProductGridBySku2" stepKey="filterProductGridBySkuForVirtual"> + <actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterProductGridBySkuForVirtual"> <argument name="sku" value="$$createProduct.sku$$"/> </actionGroup> <see selector="{{AdminProductGridSection.productGridCell('1', 'Name')}}" userInput="$$createProduct.name$$" stepKey="seeVirtualProductNameInGrid"/> @@ -143,7 +143,7 @@ <comment userInput="Delete product" stepKey="commentDeleteProduct"/> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteAttribute"/> - <actionGroup ref="deleteAllDuplicateProductUsingProductGrid" stepKey="deleteAllDuplicateProducts"> + <actionGroup ref="DeleteAllDuplicateProductUsingProductGridActionGroup" stepKey="deleteAllDuplicateProducts"> <argument name="product" value="$$createProduct$$"/> </actionGroup> <actionGroup ref="AdminClearFiltersActionGroup" stepKey="clearProductFilters"/> @@ -161,7 +161,7 @@ <!--Assert configurable product on Admin product page grid--> <comment userInput="Assert configurable product in Admin product page grid" stepKey="commentAssertConfigurableProductOnAdmin"/> <amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="goToCatalogProductPageForConfigurable"/> - <actionGroup ref="filterProductGridBySku2" stepKey="filterProductGridBySkuForConfigurable"> + <actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterProductGridBySkuForConfigurable"> <argument name="sku" value="$$createProduct.sku$$"/> </actionGroup> <see selector="{{AdminProductGridSection.productGridCell('1', 'Name')}}" userInput="$$createProduct.name$$" stepKey="seeConfigurableProductNameInGrid"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminRelatedProductsTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminRelatedProductsTest.xml index aa34693ed82f0..166c31d0460a9 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminRelatedProductsTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminRelatedProductsTest.xml @@ -94,18 +94,18 @@ <comment userInput="Filter and edit simple product 1" stepKey="filterAndEditComment1"/> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="productIndexPage"/> <waitForPageLoad time="30" stepKey="waitForPageLoad1"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGridColumnsInitial"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridSimple"> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGridColumnsInitial"/> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProductGridSimple"> <argument name="product" value="$$simple1Handle$$"/> </actionGroup> - <actionGroup ref="openProducForEditByClickingRowXColumnYInProductGrid" stepKey="openProducForEditByClickingRow1Column2InProductGrid"/> + <actionGroup ref="OpenProductForEditByClickingRowXColumnYInProductGridActionGroup" stepKey="openProducForEditByClickingRow1Column2InProductGrid"/> <conditionalClick selector="{{AdminProductFormSection.productFormTab('Related Products')}}" dependentSelector="{{AdminProductFormSection.productFormTabState('Related Products', 'closed')}}" visible="true" stepKey="openRelatedProductTab"/> <waitForPageLoad time="30" stepKey="waitForPageLoad3"/> <!-- TODO: move adding related product to a action group when nested action group is allowed (ref#: MQE-539)--> <comment userInput="Add related simple product to simple product" stepKey="addSimpleToSimpleComment"/> <click selector="{{AdminProductFormRelatedUpSellCrossSellSection.AddRelatedProductsButton}}" stepKey="clickAddRelatedProductButton"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridSimple1"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProductGridSimple1"> <argument name="product" value="$$simple2Handle$$"/> </actionGroup> <click selector="{{AdminProductModalSlideGridSection.productGridXRowYColumnButton('1', '1')}}" stepKey="selectSimpleTwo"/> @@ -114,7 +114,7 @@ <comment userInput="Add related config product to simple product" stepKey="addConfigToSimpleComment"/> <click selector="{{AdminProductFormRelatedUpSellCrossSellSection.AddRelatedProductsButton}}" stepKey="clickAddRelatedProductButton2"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridSimpleForRelatedConfig1"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProductGridSimpleForRelatedConfig1"> <argument name="product" value="$$baseConfigProductHandle$$"/> </actionGroup> <click selector="{{AdminProductModalSlideGridSection.productGridXRowYColumnButton('1', '1')}}" stepKey="selectConfigProduct"/> @@ -122,16 +122,16 @@ <click selector="{{AdminAddRelatedProductsModalSection.AddSelectedProductsButton}}" stepKey="addRelatedProductSelected2"/> <comment userInput="Save simple product" stepKey="saveSimpleProductComment"/> - <actionGroup ref="saveProductForm" stepKey="saveRelatedProduct1"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveRelatedProduct1"/> <comment userInput="Assert related simple products for simple product in Admin Product Form" stepKey="assertRelated1Comment"/> - <actionGroup ref="AssertTextInAdminProductRelatedUpSellCrossSellSection" stepKey="assertRelated1"> + <actionGroup ref="AssertTextInAdminProductRelatedUpSellCrossSellSectionActionGroup" stepKey="assertRelated1"> <argument name="element" value="AdminProductFormRelatedUpSellCrossSellSection.relatedProductSectionText"/> <argument name="expectedText" value="$$simple2Handle.name$$"/> </actionGroup> <comment userInput="Assert related config products for simple product in Admin Product Form" stepKey="assertRelated2Comment"/> - <actionGroup ref="AssertTextInAdminProductRelatedUpSellCrossSellSection" stepKey="assertRelated2"> + <actionGroup ref="AssertTextInAdminProductRelatedUpSellCrossSellSectionActionGroup" stepKey="assertRelated2"> <argument name="element" value="AdminProductFormRelatedUpSellCrossSellSection.relatedProductSectionText"/> <argument name="expectedText" value="$$baseConfigProductHandle.name$$"/> </actionGroup> @@ -139,17 +139,17 @@ <comment userInput="Filter and edit config product" stepKey="filterAndEditComment2"/> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="productIndexPage2"/> <waitForPageLoad time="30" stepKey="waitForPageLoad5"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGridColumnsInitial2"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridConfig"> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGridColumnsInitial2"/> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProductGridConfig"> <argument name="product" value="$$baseConfigProductHandle$$"/> </actionGroup> - <actionGroup ref="openProducForEditByClickingRowXColumnYInProductGrid" stepKey="openProducForEditByClickingRow1Column2InProductGrid2"/> + <actionGroup ref="OpenProductForEditByClickingRowXColumnYInProductGridActionGroup" stepKey="openProducForEditByClickingRow1Column2InProductGrid2"/> <conditionalClick selector="{{AdminProductFormSection.productFormTab('Related Products')}}" dependentSelector="{{AdminProductFormSection.productFormTabState('Related Products', 'closed')}}" visible="true" stepKey="openRelatedProductTab2"/> <waitForPageLoad time="30" stepKey="waitForPageLoad7"/> <comment userInput="Add related simple product to config product" stepKey="addSimpleToConfigComment"/> <click selector="{{AdminProductFormRelatedUpSellCrossSellSection.AddRelatedProductsButton}}" stepKey="clickAddRelatedProductButton3"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridForConfig3"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProductGridForConfig3"> <argument name="product" value="$$simple2Handle$$"/> </actionGroup> <click selector="{{AdminProductModalSlideGridSection.productGridXRowYColumnButton('1', '1')}}" stepKey="selectSimpleTwo2"/> @@ -157,10 +157,10 @@ <click selector="{{AdminAddRelatedProductsModalSection.AddSelectedProductsButton}}" stepKey="addRelatedProductSelected3"/> <comment userInput="Save config product" stepKey="saveConfigProductComment"/> - <actionGroup ref="saveProductForm" stepKey="saveRelatedProduct2"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveRelatedProduct2"/> <comment userInput="Assert related simple product for config product in Admin Product Form" stepKey="assertRelated3Comment"/> - <actionGroup ref="AssertTextInAdminProductRelatedUpSellCrossSellSection" stepKey="assertRelated3"> + <actionGroup ref="AssertTextInAdminProductRelatedUpSellCrossSellSectionActionGroup" stepKey="assertRelated3"> <argument name="element" value="AdminProductFormRelatedUpSellCrossSellSection.relatedProductSectionText"/> <argument name="expectedText" value="$$simple2Handle.name$$"/> </actionGroup> @@ -187,7 +187,7 @@ <comment userInput="Check related product in product page" stepKey="checkRelatedProductInProductPageComment"/> <click selector="{{StorefrontProductRelatedProductsSection.relatedProductCheckBoxButton('$$simple2Handle.name$$')}}" stepKey="checkRelatedProcut"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage"> <argument name="productName" value="$$baseConfigProductHandle.name$$"/> </actionGroup> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminRemoveDefaultImageConfigurableTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminRemoveDefaultImageConfigurableTest.xml index e7492f4eeaecf..0cc73f117aaad 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminRemoveDefaultImageConfigurableTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminRemoveDefaultImageConfigurableTest.xml @@ -93,33 +93,33 @@ <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="productIndexPage"/> <waitForPageLoad time="30" stepKey="waitForPageLoad1"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGridColumnsInitial"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGrid"> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGridColumnsInitial"/> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProductGrid"> <argument name="product" value="$$baseConfigProductHandle$$"/> </actionGroup> - <actionGroup ref="openProducForEditByClickingRowXColumnYInProductGrid" stepKey="openProducForEditByClickingRow1Column2InProductGrid1"/> + <actionGroup ref="OpenProductForEditByClickingRowXColumnYInProductGridActionGroup" stepKey="openProducForEditByClickingRow1Column2InProductGrid1"/> <!-- Add image to product --> - <actionGroup ref="addProductImage" stepKey="addImageForProduct"> + <actionGroup ref="AddProductImageActionGroup" stepKey="addImageForProduct"> <argument name="image" value="MagentoLogo"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!-- Remove image from product --> - <actionGroup ref="removeProductImage" stepKey="removeProductImage"/> + <actionGroup ref="RemoveProductImageActionGroup" stepKey="removeProductImage"/> - <actionGroup ref="saveProductForm" stepKey="saveProductFormAfterRemove"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductFormAfterRemove"/> <!-- Assert product image not in admin product form --> - <actionGroup ref="assertProductImageNotInAdminProductPage" stepKey="assertProductImageNotInAdminProductPage"/> + <actionGroup ref="AssertProductImageNotInAdminProductPageActionGroup" stepKey="assertProductImageNotInAdminProductPage"/> <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="AssertProductInStorefrontProductPageAfterRemove"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="AssertProductInStorefrontProductPageAfterRemove"> <argument name="product" value="$$baseConfigProductHandle$$"/> </actionGroup> <!-- Assert product image not in storefront product page --> - <actionGroup ref="assertProductImageNotInStorefrontProductPage2" stepKey="assertProductImageNotInStorefrontProductPage2"> + <actionGroup ref="AssertProductImageNotInStorefrontProductPage2ActionGroup" stepKey="assertProductImageNotInStorefrontProductPage2"> <argument name="product" value="$$baseConfigProductHandle$$"/> </actionGroup> </test> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/EndToEndB2CAdminTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/EndToEndB2CAdminTest.xml index 6bbb97c66cdd8..dccacbdc3d6f6 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/EndToEndB2CAdminTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/EndToEndB2CAdminTest.xml @@ -11,11 +11,11 @@ <!--Create configurable product--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPageConfigurable" after="seeSimpleProductInGrid"/> <waitForPageLoad stepKey="waitForProductPageLoadConfigurable" after="visitAdminProductPageConfigurable"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateConfigurableProduct" after="waitForProductPageLoadConfigurable"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateConfigurableProduct" after="waitForProductPageLoadConfigurable"> <argument name="product" value="BaseConfigurableProduct"/> </actionGroup> - <actionGroup ref="checkRequiredFieldsInProductForm" stepKey="checkRequiredFieldsProductConfigurable" after="goToCreateConfigurableProduct"/> - <actionGroup ref="fillMainProductForm" stepKey="fillConfigurableProductMain" after="checkRequiredFieldsProductConfigurable"> + <actionGroup ref="CheckRequiredFieldsInProductFormActionGroup" stepKey="checkRequiredFieldsProductConfigurable" after="goToCreateConfigurableProduct"/> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillConfigurableProductMain" after="checkRequiredFieldsProductConfigurable"> <argument name="product" value="BaseConfigurableProduct"/> </actionGroup> <!--Create product configurations--> @@ -69,8 +69,8 @@ <!--@TODO Move cleanup to "after" when MQE-830 is resolved--> <comment userInput="Clean up configurable product" stepKey="cleanUpConfigurableProduct" after="deleteSimpleProduct"/> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteConfigurableProduct" after="cleanUpConfigurableProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteConfigurableProduct" after="cleanUpConfigurableProduct"> <argument name="product" value="BaseConfigurableProduct"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoOptionAvailableToConfigureDisabledProductTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoOptionAvailableToConfigureDisabledProductTest.xml index fd607d2203c66..4f21e80844736 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoOptionAvailableToConfigureDisabledProductTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoOptionAvailableToConfigureDisabledProductTest.xml @@ -109,13 +109,13 @@ <amOnPage url="{{AdminProductEditPage.url($$createConfigChildProduct1.id$$)}}" stepKey="goToEditPage"/> <waitForPageLoad stepKey="waitForChildProductPageLoad"/> <click selector="{{AdminProductFormSection.enableProductLabel}}" stepKey="disableProduct"/> - <actionGroup ref="saveProductForm" stepKey="saveProductForm"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductForm"/> <!-- Set the second product out of stock --> <comment userInput="Set the second product out of stock" stepKey="outOfStockChildProduct"/> <amOnPage url="{{AdminProductEditPage.url($$createConfigChildProduct2.id$$)}}" stepKey="goToSecondProductEditPage"/> <waitForPageLoad stepKey="waitForSecondChildProductPageLoad"/> <selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="Out of Stock" stepKey="outOfStockStatus"/> - <actionGroup ref="saveProductForm" stepKey="saveSecondProductForm"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveSecondProductForm"/> <!-- Go to created customer page --> <comment userInput="Go to created customer page" stepKey="goToCreatedCustomerPage"/> <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="createNewOrder"> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ProductsQtyReturnAfterOrderCancelTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ProductsQtyReturnAfterOrderCancelTest.xml index c3459aec34492..9152adc6c2e79 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ProductsQtyReturnAfterOrderCancelTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ProductsQtyReturnAfterOrderCancelTest.xml @@ -49,7 +49,7 @@ <waitForPageLoad stepKey="waitForProductPage"/> <fillField selector="{{StorefrontProductInfoMainSection.qty}}" userInput="4" stepKey="fillQuantity"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage"> <argument name="productName" value="$$createConfigProduct.name$$"/> </actionGroup> @@ -91,7 +91,7 @@ <amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="GoToCatalogProductPage"/> - <actionGroup ref="filterProductGridBySku2" stepKey="filterProductGridBySku"> + <actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterProductGridBySku"> <argument name="sku" value="$$createConfigProduct.sku$$"/> </actionGroup> <see selector="{{AdminProductGridSection.productGridCell('1', 'Quantity')}}" userInput="99" stepKey="seeProductSkuInGrid"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductCategoryViewChildOnlyTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductCategoryViewChildOnlyTest.xml index 805727e29a17a..9d7807c543def 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductCategoryViewChildOnlyTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductCategoryViewChildOnlyTest.xml @@ -102,10 +102,10 @@ <!-- Go to the product page for the first product --> <amOnPage stepKey="goToProductGrid" url="{{ProductCatalogPage.url}}"/> <waitForPageLoad stepKey="waitForProductGridLoad"/> - <actionGroup stepKey="searchForSimpleProduct" ref="filterProductGridBySku2"> + <actionGroup stepKey="searchForSimpleProduct" ref="FilterProductGridBySku2ActionGroup"> <argument name="sku" value="$$createConfigChildProduct1.sku$$"/> </actionGroup> - <actionGroup stepKey="openProductEditPage" ref="openProducForEditByClickingRowXColumnYInProductGrid"/> + <actionGroup stepKey="openProductEditPage" ref="OpenProductForEditByClickingRowXColumnYInProductGridActionGroup"/> <!-- Edit the visibility the first simple product --> <selectOption selector="{{AdminProductFormSection.visibility}}" userInput="Catalog, Search" stepKey="selectVisibilityCatalogSearch"/> <!--Add to category--> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductChildSearchTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductChildSearchTest.xml index 16400fa837b1c..294ab9fd0664d 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductChildSearchTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductChildSearchTest.xml @@ -119,10 +119,10 @@ <!-- Go to the product page for the first product --> <amOnPage stepKey="goToProductGrid" url="{{ProductCatalogPage.url}}"/> <waitForPageLoad stepKey="waitForProductGridLoad"/> - <actionGroup stepKey="searchForSimpleProduct" ref="filterProductGridBySku2"> + <actionGroup stepKey="searchForSimpleProduct" ref="FilterProductGridBySku2ActionGroup"> <argument name="sku" value="$$createConfigChildProduct1.sku$$"/> </actionGroup> - <actionGroup stepKey="openProductEditPage" ref="openProducForEditByClickingRowXColumnYInProductGrid"/> + <actionGroup stepKey="openProductEditPage" ref="OpenProductForEditByClickingRowXColumnYInProductGridActionGroup"/> <!-- Edit the attribute for the first simple product --> <selectOption stepKey="editSelectAttribute" selector="{{ModifyAttributes.nthExistingAttribute($$createConfigProductAttributeSelect.default_frontend_label$$)}}" userInput="$$createConfigProductAttributeSelectOption1.option[store_labels][0][label]$$"/> @@ -156,4 +156,4 @@ <submitForm selector="#search_mini_form" parameterArray="['q' => $$createConfigChildProduct1.custom_attributes[short_description]$$]" stepKey="searchStorefront3" /> <seeElement stepKey="seeProduct3" selector="{{StorefrontCategoryProductSection.ProductTitleByName('$$createConfigProduct.name$$')}}"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest.xml index 2f5ee036b1420..6a2d1867a691f 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest.xml @@ -31,7 +31,7 @@ </before> <after> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="deleteProductBySku" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteProduct"> <argument name="sku" value="{{_defaultProduct.sku}}"/> </actionGroup> <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearProductsGridFilters"/> @@ -76,7 +76,7 @@ </before> <after> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="deleteProductBySku" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteProduct"> <argument name="sku" value="{{_defaultProduct.sku}}"/> </actionGroup> <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearProductsGridFilters"/> @@ -121,7 +121,7 @@ </before> <after> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="deleteProductBySku" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteProduct"> <argument name="sku" value="{{_defaultProduct.sku}}"/> </actionGroup> <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearProductsGridFilters"/> @@ -163,7 +163,7 @@ </before> <after> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="deleteProductBySku" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteProduct"> <argument name="sku" value="{{_defaultProduct.sku}}"/> </actionGroup> <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearProductsGridFilters"/> @@ -213,7 +213,7 @@ </before> <after> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="deleteProductBySku" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteProduct"> <argument name="sku" value="{{BaseConfigurableProduct.sku}}"/> </actionGroup> <deleteData createDataKey="createFirstAttribute" stepKey="deleteFirstAttribute"/> @@ -223,16 +223,16 @@ </after> <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="openProductIndexPage"/> - <actionGroup ref="goToCreateProductPage" stepKey="navigateToCreateProductPage"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="navigateToCreateProductPage"> <argument name="product" value="BaseConfigurableProduct"/> </actionGroup> - <actionGroup ref="fillMainProductForm" stepKey="fillProductForm"> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillProductForm"> <argument name="product" value="BaseConfigurableProduct"/> </actionGroup> - <actionGroup ref="SetCategoryByName" stepKey="addCategoryToProduct"> + <actionGroup ref="SetCategoryByNameActionGroup" stepKey="addCategoryToProduct"> <argument name="categoryName" value="$createCategory.name$"/> </actionGroup> - <actionGroup ref="SetProductUrlKeyByString" stepKey="fillUrlKey"> + <actionGroup ref="SetProductUrlKeyByStringActionGroup" stepKey="fillUrlKey"> <argument name="urlKey" value="{{BaseConfigurableProduct.urlKey}}"/> </actionGroup> <click selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="clickOnCreateConfigurations"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductViewTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductViewTest.xml index 65e1d3a74f060..d40b0efa8ad4b 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductViewTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductViewTest.xml @@ -34,7 +34,7 @@ <after> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup stepKey="deleteProduct" ref="deleteProductBySku"> + <actionGroup stepKey="deleteProduct" ref="DeleteProductBySkuActionGroup"> <argument name="sku" value="{{_defaultProduct.sku}}"/> </actionGroup> <actionGroup ref="logout" stepKey="adminLogout"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductWithFileCustomOptionTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductWithFileCustomOptionTest.xml index 4c955f3385643..a9d7f35a50c8a 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductWithFileCustomOptionTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductWithFileCustomOptionTest.xml @@ -36,9 +36,9 @@ <argument name="category" value="$$createCategory$$"/> </actionGroup> <!--Add custom option to configurable product--> - <actionGroup ref="AddProductCustomOptionFile" stepKey="addCustomOptionToProduct"/> + <actionGroup ref="AddProductCustomOptionFileActionGroup" stepKey="addCustomOptionToProduct"/> <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct"/> - + <!--Go to storefront--> <amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToHomePage"/> <waitForPageLoad stepKey="waitForHomePageLoad"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml index bc8f3e49272b7..8d08f599db6a0 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml @@ -89,10 +89,10 @@ </createData> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <!--SKU Product Attribute is enabled for Promo Rule Conditions--> - <actionGroup ref="navigateToEditProductAttribute" stepKey="navigateToSkuProductAttribute"> + <actionGroup ref="NavigateToEditProductAttributeActionGroup" stepKey="navigateToSkuProductAttribute"> <argument name="ProductAttribute" value="sku"/> </actionGroup> - <actionGroup ref="changeUseForPromoRuleConditionsProductAttribute" stepKey="changeUseForPromoRuleConditionsProductAttributeToYes"> + <actionGroup ref="ChangeUseForPromoRuleConditionsProductAttributeActionGroup" stepKey="changeUseForPromoRuleConditionsProductAttributeToYes"> <argument name="option" value="Yes"/> </actionGroup> <magentoCLI command="indexer:reindex" stepKey="reindex1"/> @@ -110,17 +110,17 @@ <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> <!--SKU Product Attribute is disable for Promo Rule Conditions--> - <actionGroup ref="navigateToEditProductAttribute" stepKey="navigateToSkuProductAttribute"> + <actionGroup ref="NavigateToEditProductAttributeActionGroup" stepKey="navigateToSkuProductAttribute"> <argument name="ProductAttribute" value="sku"/> </actionGroup> - <actionGroup ref="changeUseForPromoRuleConditionsProductAttribute" stepKey="changeUseForPromoRuleConditionsProductAttributeToNo"> + <actionGroup ref="ChangeUseForPromoRuleConditionsProductAttributeActionGroup" stepKey="changeUseForPromoRuleConditionsProductAttributeToNo"> <argument name="option" value="No"/> </actionGroup> <actionGroup ref="logout" stepKey="logoutFromAdmin"/> </after> <!--Open category with products and Sort by price desc--> - <actionGroup ref="GoToStorefrontCategoryPageByParameters" stepKey="goToStorefrontCategoryPage"> + <actionGroup ref="GoToStorefrontCategoryPageByParametersActionGroup" stepKey="goToStorefrontCategoryPage"> <argument name="category" value="$$createCategory.custom_attributes[url_key]$$"/> <argument name="mode" value="grid"/> <argument name="numOfProductsPerPage" value="25"/> @@ -143,7 +143,7 @@ <magentoCLI command="cache:flush" stepKey="flushCache"/> <!--Reopen category with products and Sort by price desc--> - <actionGroup ref="GoToStorefrontCategoryPageByParameters" stepKey="goToStorefrontCategoryPage2"> + <actionGroup ref="GoToStorefrontCategoryPageByParametersActionGroup" stepKey="goToStorefrontCategoryPage2"> <argument name="category" value="$$createCategory.custom_attributes[url_key]$$"/> <argument name="mode" value="grid"/> <argument name="numOfProductsPerPage" value="9"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontVerifyConfigurableProductLayeredNavigationTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontVerifyConfigurableProductLayeredNavigationTest.xml index 182c8c069ab23..3ebd9d6ef5367 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontVerifyConfigurableProductLayeredNavigationTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontVerifyConfigurableProductLayeredNavigationTest.xml @@ -122,7 +122,7 @@ <!-- Open Product Index Page and Filter First Child product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProduct"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProduct"> <argument name="product" value="ApiSimpleOne"/> </actionGroup> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontVisibilityOfDuplicateProductTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontVisibilityOfDuplicateProductTest.xml index 749d1bee0661a..e3ab26fa2fff4 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontVisibilityOfDuplicateProductTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontVisibilityOfDuplicateProductTest.xml @@ -30,17 +30,17 @@ <after> <!--Delete created data--> <comment userInput="Delete created data" stepKey="commentDeleteCreatedData"/> - <actionGroup ref="deleteAllDuplicateProductUsingProductGrid" stepKey="deleteDuplicatedProduct"> + <actionGroup ref="DeleteAllDuplicateProductUsingProductGridActionGroup" stepKey="deleteDuplicatedProduct"> <argument name="product" value="$$createConfigProduct$$"/> </actionGroup> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetGridToDefaultKeywordSearch"/> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetGridToDefaultKeywordSearch"/> <!--Delete product attributes--> <comment userInput="Delete product attributes" stepKey="deleteCommentAttributes"/> - <actionGroup ref="deleteProductAttributeByLabel" stepKey="deleteProductAttribute"> + <actionGroup ref="DeleteProductAttributeByLabelActionGroup" stepKey="deleteProductAttribute"> <argument name="ProductAttribute" value="colorProductAttribute"/> </actionGroup> <click selector="{{AdminProductAttributeGridSection.ResetFilter}}" stepKey="resetFiltersOnGridFirst"/> - <actionGroup ref="deleteProductAttributeByLabel" stepKey="deleteProductSecondAttribute"> + <actionGroup ref="DeleteProductAttributeByLabelActionGroup" stepKey="deleteProductSecondAttribute"> <argument name="ProductAttribute" value="productAttributeColor"/> </actionGroup> <click selector="{{AdminProductAttributeGridSection.ResetFilter}}" stepKey="resetFiltersOnGridSecond"/> @@ -51,11 +51,11 @@ <comment userInput="Create attribute and options for product" stepKey="commentCreateAttributesAndOptions"/> <amOnPage url="{{AdminProductEditPage.url($$createConfigProduct.id$$)}}" stepKey="navigateToConfigProductPage"/> <waitForPageLoad stepKey="waitForProductPageLoad"/> - <actionGroup ref="addProductImage" stepKey="addImageForProduct1"> + <actionGroup ref="AddProductImageActionGroup" stepKey="addImageForProduct1"> <argument name="image" value="MagentoLogo"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProductForm"/> - <actionGroup ref="AdminCreateAttributeFromProductPageWithScope" stepKey="createAttributeForProduct"> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductForm"/> + <actionGroup ref="AdminCreateAttributeFromProductPageWithScopeActionGroup" stepKey="createAttributeForProduct"> <argument name="attributeName" value="{{colorProductAttribute.default_label}}"/> <argument name="attributeType" value="{{colorProductAttribute.input_type}}"/> <argument name="scope" value="Global"/> @@ -111,7 +111,7 @@ <waitForPageLoad stepKey="waitForSummaryPageLoad"/> <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButtonToGenerateConfigs"/> <waitForPageLoad stepKey="waitForConfigurableProductPageLoad"/> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!--Duplicate the product--> <comment userInput="Duplicate the product" stepKey="commentDuplicateProduct"/> <actionGroup ref="AdminFormSaveAndDuplicate" stepKey="saveAndDuplicateProductForm"/> @@ -120,8 +120,8 @@ <selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="1" stepKey="selectInStock"/> <!--Change product image--> <comment userInput="Change product image" stepKey="commentChangeProductImage"/> - <actionGroup ref="removeProductImage" stepKey="removeProductImage"/> - <actionGroup ref="addProductImage" stepKey="addImageForProduct"> + <actionGroup ref="RemoveProductImageActionGroup" stepKey="removeProductImage"/> + <actionGroup ref="AddProductImageActionGroup" stepKey="addImageForProduct"> <argument name="image" value="TestImageAdobe"/> </actionGroup> <!--Disable configurations--> @@ -132,10 +132,10 @@ <actionGroup ref="AdminConfigurableProductDisableConfigurationsActionGroup" stepKey="disableSecondConfig"> <argument name="productName" value="{{colorConfigurableProductAttribute2.name}}"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveDuplicatedProductForm"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveDuplicatedProductForm"/> <!--Create new configurations with another attribute--> <comment userInput="Create new configurations with another attribute" stepKey="commentCreateNewConfigurations"/> - <actionGroup ref="AdminCreateAttributeFromProductPageWithScope" stepKey="createAttributeForDuplicatedProduct"> + <actionGroup ref="AdminCreateAttributeFromProductPageWithScopeActionGroup" stepKey="createAttributeForDuplicatedProduct"> <argument name="attributeName" value="{{productAttributeColor.default_label}}"/> <argument name="attributeType" value="{{productAttributeColor.input_type}}"/> <argument name="scope" value="Global"/> @@ -187,7 +187,7 @@ <waitForPageLoad stepKey="waitForSummaryPageLoadForDuplicatedProduct"/> <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="generateConfigsForDuplicatedProduct"/> <waitForPageLoad stepKey="waitForDuplicatedProductPageLoad"/> - <actionGroup ref="saveProductForm" stepKey="saveDuplicatedProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveDuplicatedProduct"/> <magentoCLI command="indexer:reindex" stepKey="reindex"/> <magentoCLI command="cache:flush" stepKey="flushCache"/> <!--Assert configurable product in category--> diff --git a/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayWhenChooseThreeAllowedCurrenciesTest.xml b/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayWhenChooseThreeAllowedCurrenciesTest.xml index 26fbfd394be68..feaef865a5e17 100644 --- a/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayWhenChooseThreeAllowedCurrenciesTest.xml +++ b/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayWhenChooseThreeAllowedCurrenciesTest.xml @@ -48,7 +48,7 @@ <actionGroup ref="StorefrontSwitchCurrency" stepKey="switchCurrency"> <argument name="currency" value="RUB"/> </actionGroup> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontNewProductPage"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontNewProductPage"> <argument name="productName" value="$$createNewProduct.name$$"/> </actionGroup> <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="guestGoToCheckoutNewProductFromMinicart" /> diff --git a/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayedInOneLineTest.xml b/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayedInOneLineTest.xml index dc6bdf3db542e..aa3c356d20a20 100644 --- a/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayedInOneLineTest.xml +++ b/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayedInOneLineTest.xml @@ -51,7 +51,7 @@ <!--Open created product on Storefront and place for order--> <amOnPage url="{{StorefrontProductPage.url($$createProduct.custom_attributes[url_key]$$)}}" stepKey="goToProductPage"/> <waitForPageLoad stepKey="waitForProductPagePageLoad"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage"> <argument name="productName" value="$$createProduct.name$$"/> </actionGroup> <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="guestGoToCheckoutFromMinicart" /> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminProductBackRedirectNavigateFromCustomerViewCartProduct.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminProductBackRedirectNavigateFromCustomerViewCartProduct.xml index b5db354d54371..18106836ce137 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminProductBackRedirectNavigateFromCustomerViewCartProduct.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminProductBackRedirectNavigateFromCustomerViewCartProduct.xml @@ -37,7 +37,7 @@ </actionGroup> <!-- Add product to cart --> - <actionGroup ref="AddSimpleProductToCart" stepKey="addProductToCart"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToCart"> <argument name="product" value="$$createProduct$$"/> </actionGroup> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/PasswordAutocompleteOffTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/PasswordAutocompleteOffTest.xml index f364d24806b9c..6d8f55daecc13 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/PasswordAutocompleteOffTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/PasswordAutocompleteOffTest.xml @@ -42,7 +42,7 @@ </after> <!-- Go to the created product page and add it to the cart--> - <actionGroup ref="AddSimpleProductToCart" stepKey="cartAddSimpleProductToCart"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="cartAddSimpleProductToCart"> <argument name="product" value="$$product$$"/> </actionGroup> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminAddDefaultImageDownloadableProductTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminAddDefaultImageDownloadableProductTest.xml index a7ce96ddf1fde..e801f890c34b9 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminAddDefaultImageDownloadableProductTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminAddDefaultImageDownloadableProductTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="DownloadableProduct"/> </actionGroup> <magentoCLI stepKey="removeDownloadableDomain" command="downloadable:domains:remove static.magento.com"/> @@ -33,15 +33,15 @@ <!-- Create product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="adminProductIndexPageAdd"/> <waitForPageLoad stepKey="waitForProductIndexPageLoad"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProductPage"> <argument name="product" value="DownloadableProduct"/> </actionGroup> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillMainProductForm"> <argument name="product" value="DownloadableProduct"/> </actionGroup> <!-- Add image to product --> - <actionGroup ref="addProductImage" stepKey="addImageForProduct"> + <actionGroup ref="AddProductImageActionGroup" stepKey="addImageForProduct"> <argument name="image" value="MagentoLogo"/> </actionGroup> @@ -59,18 +59,18 @@ </actionGroup> <!--Save product--> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!-- Assert product image in admin product form --> - <actionGroup ref="assertProductImageAdminProductPage" stepKey="assertProductImageAdminProductPage"/> + <actionGroup ref="AssertProductImageAdminProductPageActionGroup" stepKey="assertProductImageAdminProductPage"/> <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageActionGroup" stepKey="AssertProductInStorefrontProductPage"> <argument name="product" value="DownloadableProduct"/> </actionGroup> <!-- Assert product image in storefront product page --> - <actionGroup ref="assertProductImageStorefrontProductPage" stepKey="assertProductImageStorefrontProductPage"> + <actionGroup ref="AssertProductImageStorefrontProductPageActionGroup" stepKey="assertProductImageStorefrontProductPage"> <argument name="product" value="DownloadableProduct"/> <argument name="image" value="MagentoLogo"/> </actionGroup> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminAddDefaultVideoDownloadableProductTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminAddDefaultVideoDownloadableProductTest.xml index d95ddaf12470d..4129fc50c4f7e 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminAddDefaultVideoDownloadableProductTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminAddDefaultVideoDownloadableProductTest.xml @@ -26,10 +26,10 @@ </after> <!-- Create a downloadable product --> <!-- Replacing steps in base AdminAddDefaultVideoSimpleProductTest --> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProductPage"> <argument name="product" value="DownloadableProduct"/> </actionGroup> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillMainProductForm"> <argument name="product" value="DownloadableProduct"/> </actionGroup> @@ -48,7 +48,7 @@ </actionGroup> <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> + <actionGroup ref="AssertProductInStorefrontProductPageActionGroup" stepKey="AssertProductInStorefrontProductPage"> <argument name="product" value="DownloadableProduct"/> </actionGroup> </test> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateAndEditDownloadableProductSettingsTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateAndEditDownloadableProductSettingsTest.xml index 2a7f5b437115b..ebd36dddc0b6c 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateAndEditDownloadableProductSettingsTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateAndEditDownloadableProductSettingsTest.xml @@ -24,7 +24,7 @@ </before> <after> <!-- Delete created downloadable product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="DownloadableProduct"/> </actionGroup> @@ -33,12 +33,12 @@ </after> <!-- Create new downloadable product --> - <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="createDownloadableProduct"> + <actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="createDownloadableProduct"> <argument name="productType" value="downloadable"/> </actionGroup> <!-- Fill all main fields --> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillMainProductForm"> <argument name="product" value="DownloadableProduct"/> </actionGroup> @@ -53,7 +53,7 @@ </actionGroup> <!-- Save product form --> - <actionGroup ref="saveProductForm" stepKey="clickSaveButton"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="clickSaveButton"/> <!-- Open product page --> <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openStorefrontProductPage"> @@ -93,7 +93,7 @@ <actionGroup ref="AdminSwitchProductGiftMessageStatusActionGroup" stepKey="disableGiftMessageSettings"/> <!-- Save product form --> - <actionGroup ref="saveProductForm" stepKey="clickSaveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="clickSaveProduct"/> <!-- Verify Url Key after changing --> <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPage"> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml index 55740af4d834f..d3933ae4fae7d 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml @@ -19,11 +19,11 @@ <group value="catalog"/> <group value="mtf_migrated"/> </annotations> - <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="openProductFillForm"> + <actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="openProductFillForm"> <argument name="productType" value="downloadable"/> </actionGroup> <!-- Fill form for Virtual Product Type --> - <actionGroup ref="fillMainProductForm" stepKey="fillProductForm"> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillProductForm"> <argument name="product" value="_defaultProduct"/> </actionGroup> <see selector="{{AdminProductGridSection.productGridCell('1', 'Type')}}" userInput="Simple Product" stepKey="seeProductTypeInGrid"/> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductAndAssignItToCustomStoreTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductAndAssignItToCustomStoreTest.xml index 4f07334640cf3..3ea48542ad96d 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductAndAssignItToCustomStoreTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductAndAssignItToCustomStoreTest.xml @@ -33,7 +33,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <!-- Delete created downloadable product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="DownloadableProduct"/> </actionGroup> @@ -50,12 +50,12 @@ <!-- Create Downloadable product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> <waitForPageLoad stepKey="waitForProductGridPageLoad"/> - <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="createProduct"> + <actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="createProduct"> <argument name="productType" value="downloadable"/> </actionGroup> <!-- Fill downloadable product values --> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillDownloadableProductForm"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillDownloadableProductForm"> <argument name="product" value="DownloadableProduct"/> </actionGroup> @@ -74,7 +74,7 @@ </actionGroup> <!-- Save product --> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!-- Switch default store view on store view created below --> <amOnPage url="{{StorefrontHomePage.url}}" stepKey="amOnStorefrontPage"/> @@ -84,7 +84,7 @@ </actionGroup> <!-- Assert product in custom store --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageActionGroup" stepKey="AssertProductInStorefrontProductPage"> <argument name="product" value="DownloadableProduct"/> </actionGroup> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithCustomOptionsTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithCustomOptionsTest.xml index 54a2ff606f384..fce6568eacd6c 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithCustomOptionsTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithCustomOptionsTest.xml @@ -33,7 +33,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <!-- Delete created downloadable product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="DownloadableProduct"/> </actionGroup> @@ -44,12 +44,12 @@ <!-- Create Downloadable product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> <waitForPageLoad stepKey="waitForProductGridPageLoad"/> - <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="createProduct"> + <actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="createProduct"> <argument name="productType" value="downloadable"/> </actionGroup> <!-- Fill downloadable product values --> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillDownloadableProductForm"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillDownloadableProductForm"> <argument name="product" value="DownloadableProduct"/> </actionGroup> @@ -86,7 +86,7 @@ </actionGroup> <!-- Save product --> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!-- Go to storefront category page --> <amOnPage url="$$createCategory.name$$.html" stepKey="amOnCategoryPage"/> @@ -98,7 +98,7 @@ </actionGroup> <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageActionGroup" stepKey="AssertProductInStorefrontProductPage"> <argument name="product" value="DownloadableProduct"/> </actionGroup> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithDefaultSetLinksTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithDefaultSetLinksTest.xml index 24741c281d7f6..cb8d36793c41e 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithDefaultSetLinksTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithDefaultSetLinksTest.xml @@ -35,7 +35,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <!-- Delete created downloadable product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="DownloadableProduct"/> </actionGroup> @@ -46,12 +46,12 @@ <!-- Create downloadable product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> <waitForPageLoad stepKey="waitForProductGridPageLoad"/> - <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="createProduct"> + <actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="createProduct"> <argument name="productType" value="downloadable"/> </actionGroup> <!-- Fill downloadable product values --> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillDownloadableProductForm"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillDownloadableProductForm"> <argument name="product" value="DownloadableProduct"/> </actionGroup> @@ -75,14 +75,14 @@ </actionGroup> <!-- Save product --> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <magentoCLI command="indexer:reindex" stepKey="reindex"/> <magentoCLI command="cache:flush" stepKey="flushCache"/> <!-- Find downloadable product in grid --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> <waitForPageLoad stepKey="waitForAdminProductPageLoad"/> - <actionGroup ref="filterProductGridBySku" stepKey="findCreatedConfigurableProduct"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="findCreatedConfigurableProduct"> <argument name="product" value="DownloadableProduct"/> </actionGroup> <click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnProduct"/> @@ -103,7 +103,7 @@ </actionGroup> <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageActionGroup" stepKey="AssertProductInStorefrontProductPage"> <argument name="product" value="DownloadableProduct"/> </actionGroup> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithGroupPriceTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithGroupPriceTest.xml index 06cf31b763f1c..17d0e334eb7f3 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithGroupPriceTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithGroupPriceTest.xml @@ -33,7 +33,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <!-- Delete created downloadable product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="ApiDownloadableProduct"/> </actionGroup> @@ -44,7 +44,7 @@ <!-- Create downloadable product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> <waitForPageLoad stepKey="waitForProductGridPageLoad"/> - <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="createProduct"> + <actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="createProduct"> <argument name="productType" value="downloadable"/> </actionGroup> @@ -55,7 +55,7 @@ </actionGroup> <!-- Fill downloadable product values --> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillDownloadableProductForm"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillDownloadableProductForm"> <argument name="product" value="ApiDownloadableProduct"/> </actionGroup> @@ -79,12 +79,12 @@ </actionGroup> <!-- Save product --> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!-- Find downloadable product in grid --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> <waitForPageLoad stepKey="waitForAdminProductPageLoad"/> - <actionGroup ref="filterProductGridBySku" stepKey="findCreatedConfigurableProduct"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="findCreatedConfigurableProduct"> <argument name="product" value="ApiDownloadableProduct"/> </actionGroup> <click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnProduct"/> @@ -96,7 +96,7 @@ <seeElement selector="{{AdminProductDownloadableSection.addLinkTitleInput('1')}}" stepKey="seeSecondLinkTitle"/> <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageActionGroup" stepKey="AssertProductInStorefrontProductPage"> <argument name="product" value="ApiDownloadableProduct"/> </actionGroup> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithInvalidDomainLinkUrlTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithInvalidDomainLinkUrlTest.xml index f2e4bdfb4890f..ae37d6f4d3bf1 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithInvalidDomainLinkUrlTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithInvalidDomainLinkUrlTest.xml @@ -25,10 +25,10 @@ <argument name="link" value="downloadableLink"/> <argument name="index" value="0"/> </actionGroup> - <actionGroup ref="SaveProductFormNoSuccessCheck" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormNoSuccessCheckActionGroup" stepKey="saveProduct"/> <see selector="{{AdminProductMessagesSection.errorMessage}}" userInput="Link URL's domain is not in list of downloadable_domains in env.php." stepKey="seeLinkUrlInvalidMessage" after="saveProduct" /> <magentoCLI stepKey="addDownloadableDomain2" command="downloadable:domains:add static.magento.com" after="seeLinkUrlInvalidMessage" /> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillDownloadableProductFormAgain" after="addDownloadableDomain2"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillDownloadableProductFormAgain" after="addDownloadableDomain2"> <argument name="product" value="DownloadableProduct"/> </actionGroup> <checkOption selector="{{AdminProductDownloadableSection.isDownloadableProduct}}" stepKey="checkIsDownloadable" after="fillDownloadableProductFormAgain"/> @@ -37,7 +37,7 @@ <argument name="link" value="downloadableLink"/> <argument name="index" value="0"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProductAfterAddingDomainToWhitelist" after="addDownloadableProductLinkAgain" /> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductAfterAddingDomainToWhitelist" after="addDownloadableProductLinkAgain" /> <scrollTo selector="{{StorefrontDownloadableProductSection.downloadableLinkByTitle(downloadableLink.title)}}" stepKey="scrollToLinks"/> <click selector="{{StorefrontDownloadableProductSection.downloadableLinkByTitle(downloadableLink.title)}}" stepKey="selectProductLink"/> <see selector="{{CheckoutCartProductSection.ProductPriceByName(DownloadableProduct.name)}}" userInput="$52.99" stepKey="assertProductPriceInCart"/> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithLinkTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithLinkTest.xml index e43b8f94c7a3d..f604e710ce701 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithLinkTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithLinkTest.xml @@ -33,7 +33,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <!-- Delete created downloadable product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="DownloadableProduct"/> </actionGroup> @@ -44,12 +44,12 @@ <!-- Create downloadable product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> <waitForPageLoad stepKey="waitForProductGridPageLoad"/> - <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="createProduct"> + <actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="createProduct"> <argument name="productType" value="downloadable"/> </actionGroup> <!-- Fill downloadable product values --> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillDownloadableProductForm"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillDownloadableProductForm"> <argument name="product" value="DownloadableProduct"/> </actionGroup> @@ -68,7 +68,7 @@ </actionGroup> <!-- Save product --> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!-- Assert product in storefront category page --> <amOnPage url="$$createCategory.name$$.html" stepKey="amOnCategoryPage"/> @@ -78,7 +78,7 @@ </actionGroup> <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageActionGroup" stepKey="AssertProductInStorefrontProductPage"> <argument name="product" value="DownloadableProduct"/> </actionGroup> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithManageStockTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithManageStockTest.xml index fb6a48254fa8d..732e347713dca 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithManageStockTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithManageStockTest.xml @@ -33,7 +33,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <!-- Delete created downloadable product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="DownloadableProduct"/> </actionGroup> @@ -44,12 +44,12 @@ <!-- Create downloadable product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> <waitForPageLoad stepKey="waitForProductGridPageLoad"/> - <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="createProduct"> + <actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="createProduct"> <argument name="productType" value="downloadable"/> </actionGroup> <!-- Fill downloadable product values --> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillDownloadableProductForm"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillDownloadableProductForm"> <argument name="product" value="DownloadableProduct"/> </actionGroup> @@ -86,12 +86,12 @@ </actionGroup> <!-- Save product --> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!-- Find downloadable product in grid --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> <waitForPageLoad stepKey="waitForAdminProductPageLoad"/> - <actionGroup ref="filterProductGridBySku" stepKey="findCreatedConfigurableProduct"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="findCreatedConfigurableProduct"> <argument name="product" value="DownloadableProduct"/> </actionGroup> <click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnProduct"/> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithOutOfStockStatusTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithOutOfStockStatusTest.xml index 5e3fe6836f7e9..2d3f8f88a8591 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithOutOfStockStatusTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithOutOfStockStatusTest.xml @@ -33,7 +33,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <!-- Delete created downloadable product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="DownloadableProductOutOfStock"/> </actionGroup> @@ -44,12 +44,12 @@ <!-- Create Downloadable product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> <waitForPageLoad stepKey="waitForProductGridPageLoad"/> - <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="createProduct"> + <actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="createProduct"> <argument name="productType" value="downloadable"/> </actionGroup> <!-- Fill downloadable product values --> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillDownloadableProductForm"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillDownloadableProductForm"> <argument name="product" value="DownloadableProductOutOfStock"/> </actionGroup> @@ -73,7 +73,7 @@ </actionGroup> <!-- Save product --> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!-- Assert product is out of stock --> <amOnPage url="{{DownloadableProductOutOfStock.urlKey}}.html" stepKey="navigateToProductPage"/> @@ -83,7 +83,7 @@ <!-- Find downloadable product in grid --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> <waitForPageLoad stepKey="waitForAdminProductPageLoad"/> - <actionGroup ref="filterProductGridBySku" stepKey="findCreatedConfigurableProduct"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="findCreatedConfigurableProduct"> <argument name="product" value="DownloadableProductOutOfStock"/> </actionGroup> <click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnProduct"/> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithSpecialPriceTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithSpecialPriceTest.xml index fb59d51831bae..5085c547517cd 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithSpecialPriceTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithSpecialPriceTest.xml @@ -33,7 +33,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <!-- Delete created downloadable product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="ApiDownloadableProduct"/> </actionGroup> @@ -44,7 +44,7 @@ <!-- Create downloadable product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> <waitForPageLoad stepKey="waitForProductGridPageLoad"/> - <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="createProduct"> + <actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="createProduct"> <argument name="productType" value="downloadable"/> </actionGroup> @@ -54,7 +54,7 @@ </actionGroup> <!-- Fill downloadable product values --> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillDownloadableProductForm"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillDownloadableProductForm"> <argument name="product" value="ApiDownloadableProduct"/> </actionGroup> @@ -78,12 +78,12 @@ </actionGroup> <!-- Save product --> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!-- Find downloadable product in grid --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> <waitForPageLoad stepKey="waitForAdminProductPageLoad"/> - <actionGroup ref="filterProductGridBySku" stepKey="findCreatedConfigurableProduct"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="findCreatedConfigurableProduct"> <argument name="product" value="ApiDownloadableProduct"/> </actionGroup> <click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnProduct"/> @@ -95,7 +95,7 @@ <seeElement selector="{{AdminProductDownloadableSection.addLinkTitleInput('1')}}" stepKey="seeSecondLinkTitle"/> <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageActionGroup" stepKey="AssertProductInStorefrontProductPage"> <argument name="product" value="ApiDownloadableProduct"/> </actionGroup> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithoutFillingQuantityAndStockTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithoutFillingQuantityAndStockTest.xml index af9487e3e6a23..9f9e24b65b5a8 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithoutFillingQuantityAndStockTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithoutFillingQuantityAndStockTest.xml @@ -33,7 +33,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <!-- Delete created downloadable product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="DownloadableProduct"/> </actionGroup> @@ -44,12 +44,12 @@ <!-- Create downloadable product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> <waitForPageLoad stepKey="waitForProductGridPageLoad"/> - <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="createProduct"> + <actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="createProduct"> <argument name="productType" value="downloadable"/> </actionGroup> <!-- Fill downloadable product values --> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillDownloadableProductForm"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillDownloadableProductForm"> <argument name="product" value="DownloadableProduct"/> </actionGroup> @@ -75,12 +75,12 @@ </actionGroup> <!-- Save product --> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!-- Find downloadable product in grid --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> <waitForPageLoad stepKey="waitForAdminProductPageLoad"/> - <actionGroup ref="filterProductGridBySku" stepKey="findCreatedConfigurableProduct"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="findCreatedConfigurableProduct"> <argument name="product" value="DownloadableProduct"/> </actionGroup> <click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnProduct"/> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithoutTaxClassIdTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithoutTaxClassIdTest.xml index dd7e3331a0ed2..4c564c26b9cad 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithoutTaxClassIdTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithoutTaxClassIdTest.xml @@ -33,7 +33,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <!-- Delete created downloadable product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="DownloadableProduct"/> </actionGroup> @@ -44,12 +44,12 @@ <!-- Create downloadable product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> <waitForPageLoad stepKey="waitForProductGridPageLoad"/> - <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="createProduct"> + <actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="createProduct"> <argument name="productType" value="downloadable"/> </actionGroup> <!-- Fill downloadable product values --> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillDownloadableProductForm"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillDownloadableProductForm"> <argument name="product" value="DownloadableProduct"/> </actionGroup> @@ -76,12 +76,12 @@ </actionGroup> <!-- Save product --> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!-- Find downloadable product in grid --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> <waitForPageLoad stepKey="waitForAdminProductPageLoad"/> - <actionGroup ref="filterProductGridBySku" stepKey="findCreatedConfigurableProduct"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="findCreatedConfigurableProduct"> <argument name="product" value="DownloadableProduct"/> </actionGroup> <click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnProduct"/> @@ -93,7 +93,7 @@ <seeInField selector="{{AdminProductDownloadableSection.addLinkTitleInput('1')}}" userInput="{{downloadableLink.title}}" stepKey="seeSecondLinkTitle"/> <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageActionGroup" stepKey="AssertProductInStorefrontProductPage"> <argument name="product" value="DownloadableProduct"/> </actionGroup> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminDeleteDownloadableProductTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminDeleteDownloadableProductTest.xml index 07124ea4846be..0d93bac16569f 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminDeleteDownloadableProductTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminDeleteDownloadableProductTest.xml @@ -36,7 +36,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <actionGroup ref="logout" stepKey="logout"/> </after> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteDownloadableProductFilteredBySkuAndName"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteDownloadableProductFilteredBySkuAndName"> <argument name="product" value="$$createDownloadableProduct$$"/> </actionGroup> <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="A total of 1 record(s) have been deleted." stepKey="deleteMessage"/> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminDownloadableProductSetEditContentTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminDownloadableProductSetEditContentTest.xml index 72cdf589bec91..44c27c17adcd9 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminDownloadableProductSetEditContentTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminDownloadableProductSetEditContentTest.xml @@ -21,16 +21,16 @@ </annotations> <after> <!-- Delete downloadable product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="DownloadableProduct"/> </actionGroup> </after> <!-- Create product --> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct"> <argument name="product" value="DownloadableProduct"/> </actionGroup> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillProductForm"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillProductForm"> <argument name="product" value="DownloadableProduct"/> </actionGroup> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminDownloadableSetEditRelatedProductsTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminDownloadableSetEditRelatedProductsTest.xml index f70769cdfe834..a09076b7dc06e 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminDownloadableSetEditRelatedProductsTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminDownloadableSetEditRelatedProductsTest.xml @@ -21,16 +21,16 @@ <before></before> <after> <!-- Delete downloadable product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="DownloadableProduct"/> </actionGroup> </after> <!-- Create product --> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct"> <argument name="product" value="DownloadableProduct"/> </actionGroup> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillProductForm"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillProductForm"> <argument name="product" value="DownloadableProduct"/> </actionGroup> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml index 20c1acaf8d612..4a3f0d4ef9f83 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml @@ -23,7 +23,7 @@ <click selector="{{AdminProductDownloadableSection.sectionHeader}}" stepKey="openDownloadableSection" after="waitForSimpleProductPageLoad"/> <uncheckOption selector="{{AdminProductDownloadableSection.isDownloadableProduct}}" stepKey="checkOptionIsDownloadable" after="openDownloadableSection"/> <selectOption selector="{{AdminProductFormSection.productWeightSelect}}" userInput="This item has weight" stepKey="selectWeightForProduct" after="checkOptionIsDownloadable"/> - <actionGroup ref="saveProductForm" stepKey="saveDownloadableProductForm" after="selectWeightForProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveDownloadableProductForm" after="selectWeightForProduct"/> </test> <test name="AdminSimpleProductTypeSwitchingToDownloadableProductTest"> <annotations> @@ -62,11 +62,11 @@ <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="addDownloadableProductLink"> <argument name="link" value="downloadableLinkWithMaxDownloads"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveDownloadableProductForm"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveDownloadableProductForm"/> <!--Assert downloadable product on Admin product page grid--> <comment userInput="Assert configurable product in Admin product page grid" stepKey="commentAssertDownloadableProductOnAdmin"/> <amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="goToCatalogProductPage"/> - <actionGroup ref="filterProductGridBySku2" stepKey="filterProductGridBySku"> + <actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterProductGridBySku"> <argument name="sku" value="$$createProduct.sku$$"/> </actionGroup> <see selector="{{AdminProductGridSection.productGridCell('1', 'Name')}}" userInput="$$createProduct.name$$" stepKey="seeDownloadableProductNameInGrid"/> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminRemoveDefaultImageDownloadableProductTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminRemoveDefaultImageDownloadableProductTest.xml index 3597c12e82df0..6830ed9feb08f 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminRemoveDefaultImageDownloadableProductTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminRemoveDefaultImageDownloadableProductTest.xml @@ -30,15 +30,15 @@ <!-- Create product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="adminProductIndexPageAdd"/> <waitForPageLoad stepKey="waitForProductIndexPageLoad"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProductPage"> <argument name="product" value="DownloadableProduct"/> </actionGroup> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillMainProductForm"> <argument name="product" value="DownloadableProduct"/> </actionGroup> <!-- Add image to product --> - <actionGroup ref="addProductImage" stepKey="addImageForProduct"> + <actionGroup ref="AddProductImageActionGroup" stepKey="addImageForProduct"> <argument name="image" value="MagentoLogo"/> </actionGroup> @@ -56,22 +56,22 @@ </actionGroup> <!--Save product--> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!-- Remove image from product --> - <actionGroup ref="removeProductImage" stepKey="removeProductImage"/> + <actionGroup ref="RemoveProductImageActionGroup" stepKey="removeProductImage"/> - <actionGroup ref="saveProductForm" stepKey="saveProductFormAfterRemove"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductFormAfterRemove"/> <!-- Assert product image not in admin product form --> - <actionGroup ref="assertProductImageNotInAdminProductPage" stepKey="assertProductImageNotInAdminProductPage"/> + <actionGroup ref="AssertProductImageNotInAdminProductPageActionGroup" stepKey="assertProductImageNotInAdminProductPage"/> <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPageAfterRemove"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageActionGroup" stepKey="AssertProductInStorefrontProductPageAfterRemove"> <argument name="product" value="DownloadableProduct"/> </actionGroup> <!-- Assert product image not in storefront product page --> - <actionGroup ref="assertProductImageNotInStorefrontProductPage" stepKey="assertProductImageNotInStorefrontProductPage"> + <actionGroup ref="AssertProductImageNotInStorefrontProductPageActionGroup" stepKey="assertProductImageNotInStorefrontProductPage"> <argument name="product" value="DownloadableProduct"/> </actionGroup> </test> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml index 0d98862d9a5e7..ede4540050ecb 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml @@ -27,10 +27,10 @@ <!-- Create a downloadable product --> <!-- Replacing steps in base AdminRemoveDefaultVideoSimpleProductTest --> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProductPage"> <argument name="product" value="DownloadableProduct"/> </actionGroup> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillMainProductForm"> <argument name="product" value="DownloadableProduct"/> </actionGroup> @@ -49,7 +49,7 @@ </actionGroup> <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> + <actionGroup ref="AssertProductInStorefrontProductPageActionGroup" stepKey="AssertProductInStorefrontProductPage"> <argument name="product" value="DownloadableProduct"/> </actionGroup> </test> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/EditDownloadableProductWithSeparateLinksFromCartTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/EditDownloadableProductWithSeparateLinksFromCartTest.xml index 274dd39468a2b..32dc52559b24b 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/EditDownloadableProductWithSeparateLinksFromCartTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/EditDownloadableProductWithSeparateLinksFromCartTest.xml @@ -30,12 +30,12 @@ <!-- Create downloadable product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> <waitForPageLoad stepKey="waitForProductGridPageLoad"/> - <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="createProduct"> + <actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="createProduct"> <argument name="productType" value="downloadable"/> </actionGroup> <!-- Fill downloadable product values --> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillDownloadableProductForm"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillDownloadableProductForm"> <argument name="product" value="DownloadableProduct"/> </actionGroup> @@ -61,7 +61,7 @@ </actionGroup> <!-- Save product --> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> </before> <after> <!-- Remove downloadable domains --> @@ -71,7 +71,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <!-- Delete created downloadable product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="DownloadableProduct"/> </actionGroup> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/EndToEndB2CAdminTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/EndToEndB2CAdminTest.xml index 75a66cec91692..3b9e359aeec34 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/EndToEndB2CAdminTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/EndToEndB2CAdminTest.xml @@ -11,7 +11,7 @@ <!--Create Downloadable Product--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitProductPageDownloadable" after="seeSimpleProductInGrid"/> <waitForPageLoad stepKey="waitForProductPageLoadDownloadable" after="visitProductPageDownloadable"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateDownloadableProduct" after="waitForProductPageLoadDownloadable"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateDownloadableProduct" after="waitForProductPageLoadDownloadable"> <argument name="product" value="DownloadableProduct"/> </actionGroup> <actionGroup ref="fillMainDownloadableProductForm" stepKey="fillMainProductFormDownloadable" after="goToCreateDownloadableProduct"> @@ -45,14 +45,14 @@ </actionGroup> <!--Save Product--> - <actionGroup ref="saveProductForm" stepKey="saveDownloadableProduct" after="addDownloadableSampleUrl"/> - <actionGroup ref="viewProductInAdminGrid" stepKey="viewDownloadableProductInGrid" after="saveDownloadableProduct"> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveDownloadableProduct" after="addDownloadableSampleUrl"/> + <actionGroup ref="ViewProductInAdminGridActionGroup" stepKey="viewDownloadableProductInGrid" after="saveDownloadableProduct"> <argument name="product" value="DownloadableProduct"/> </actionGroup> <!--@TODO Move cleanup to "after" when MQE-830 is resolved--> <comment userInput="Clean up downloadable product" stepKey="cleanUpDownloadableProduct" after="deleteSimpleProduct"/> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteDownloadableProduct" after="cleanUpDownloadableProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteDownloadableProduct" after="cleanUpDownloadableProduct"> <argument name="product" value="DownloadableProduct"/> </actionGroup> </test> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/ManualSelectAllDownloadableLinksDownloadableProductTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/ManualSelectAllDownloadableLinksDownloadableProductTest.xml index a86fd544d24d6..0b7f459f43427 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/ManualSelectAllDownloadableLinksDownloadableProductTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/ManualSelectAllDownloadableLinksDownloadableProductTest.xml @@ -30,12 +30,12 @@ <!-- Create downloadable product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> <waitForPageLoad stepKey="waitForProductGridPageLoad"/> - <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="createProduct"> + <actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="createProduct"> <argument name="productType" value="downloadable"/> </actionGroup> <!-- Fill downloadable product values --> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillDownloadableProductForm"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillDownloadableProductForm"> <argument name="product" value="DownloadableProduct"/> </actionGroup> @@ -61,7 +61,7 @@ </actionGroup> <!-- Save product --> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> </before> <after> <!-- Remove downloadable domains --> @@ -71,7 +71,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <!-- Delete created downloadable product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="DownloadableProduct"/> </actionGroup> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/SelectAllDownloadableLinksDownloadableProductTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/SelectAllDownloadableLinksDownloadableProductTest.xml index f9ca6fea09cf0..ea7074c70d3c3 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/SelectAllDownloadableLinksDownloadableProductTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/SelectAllDownloadableLinksDownloadableProductTest.xml @@ -30,12 +30,12 @@ <!-- Create downloadable product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> <waitForPageLoad stepKey="waitForProductGridPageLoad"/> - <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="createProduct"> + <actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="createProduct"> <argument name="productType" value="downloadable"/> </actionGroup> <!-- Fill downloadable product values --> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillDownloadableProductForm"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillDownloadableProductForm"> <argument name="product" value="DownloadableProduct"/> </actionGroup> @@ -61,7 +61,7 @@ </actionGroup> <!-- Save product --> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> </before> <after> <!-- Remove downloadable domains --> @@ -71,7 +71,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <!-- Delete created downloadable product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="DownloadableProduct"/> </actionGroup> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/VerifyDisableDownloadableProductSamplesAreNotAccessibleTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/VerifyDisableDownloadableProductSamplesAreNotAccessibleTest.xml index ba2e3453a6d99..b0f7edaeaa3a9 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/VerifyDisableDownloadableProductSamplesAreNotAccessibleTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/VerifyDisableDownloadableProductSamplesAreNotAccessibleTest.xml @@ -87,13 +87,13 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <!-- Open Downloadable product from precondition --> - <actionGroup ref="goToProductPageViaID" stepKey="openProductEditPage"> + <actionGroup ref="GoToProductPageViaIDActionGroup" stepKey="openProductEditPage"> <argument name="productId" value="$createProduct.id$"/> </actionGroup> <!-- Change status of product to "Disable" and save it --> - <actionGroup ref="AdminSetProductDisabled" stepKey="disableProduct"/> - <actionGroup ref="saveProductForm" stepKey="clickSaveProduct"/> + <actionGroup ref="AdminSetProductDisabledActionGroup" stepKey="disableProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="clickSaveProduct"/> <!-- Assert product is disable on Storefront --> <actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="openCategoryPage"> diff --git a/app/code/Magento/Elasticsearch6/Test/Mftf/Test/StorefrontElasticsearch6SearchInvalidValueTest.xml b/app/code/Magento/Elasticsearch6/Test/Mftf/Test/StorefrontElasticsearch6SearchInvalidValueTest.xml index a144a4849db60..7c6ff7176ee8f 100644 --- a/app/code/Magento/Elasticsearch6/Test/Mftf/Test/StorefrontElasticsearch6SearchInvalidValueTest.xml +++ b/app/code/Magento/Elasticsearch6/Test/Mftf/Test/StorefrontElasticsearch6SearchInvalidValueTest.xml @@ -34,7 +34,7 @@ <magentoCLI command="config:set {{SetMinQueryLength3Config.path}} {{SetMinQueryLength3Config.value}}" stepKey="setMinQueryLengthPreviousState"/> <!--Delete created data--> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="deleteProductAttributeByAttributeCode" stepKey="deleteProductAttribute"> + <actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteProductAttribute"> <argument name="ProductAttributeCode" value="{{textProductAttribute.attribute_code}}"/> </actionGroup> <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/> @@ -42,35 +42,35 @@ <click selector="{{AdminProductAttributeGridSection.ResetFilter}}" stepKey="resetFiltersOnGrid"/> <amOnPage url="{{ProductCatalogPage.url}}" stepKey="goToProductCatalog"/> <waitForPageLoad stepKey="waitForProductIndexPage"/> - <actionGroup ref="deleteProductsIfTheyExist" stepKey="deleteProduct"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetFiltersIfExist"/> + <actionGroup ref="DeleteProductsIfTheyExistActionGroup" stepKey="deleteProduct"/> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetFiltersIfExist"/> <magentoCLI command="indexer:reindex catalogsearch_fulltext" stepKey="reindex"/> <magentoCLI command="cache:flush config" stepKey="flushCache"/> <actionGroup ref="logout" stepKey="logout"/> </after> <!--Create new searchable product attribute--> <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="goToProductAttributes"/> - <actionGroup ref="AdminCreateSearchableProductAttribute" stepKey="createAttribute"> + <actionGroup ref="AdminCreateSearchableProductAttributeActionGroup" stepKey="createAttribute"> <argument name="attribute" value="textProductAttribute"/> </actionGroup> <!--Assign attribute to the Default set--> <actionGroup ref="AdminOpenAttributeSetGridPageActionGroup" stepKey="openAttributeSetPage"/> <actionGroup ref="AdminOpenAttributeSetByNameActionGroup" stepKey="openDefaultAttributeSet"/> - <actionGroup ref="AssignAttributeToGroup" stepKey="assignAttributeToGroup"> + <actionGroup ref="AssignAttributeToGroupActionGroup" stepKey="assignAttributeToGroup"> <argument name="group" value="Product Details"/> <argument name="attribute" value="{{textProductAttribute.attribute_code}}"/> </actionGroup> - <actionGroup ref="SaveAttributeSet" stepKey="saveAttributeSet"/> + <actionGroup ref="SaveAttributeSetActionGroup" stepKey="saveAttributeSet"/> <!--Create product and fill new attribute field--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPage"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct"> <argument name="product" value="SimpleProduct"/> </actionGroup> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillProductForm"> + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillProductForm"> <argument name="product" value="ProductWithSpecialSymbols"/> </actionGroup> - <actionGroup ref="SetCategoryByName" stepKey="addCategoryToProduct"> + <actionGroup ref="SetCategoryByNameActionGroup" stepKey="addCategoryToProduct"> <argument name="categoryName" value="$$createCategory.name$$"/> </actionGroup> <fillField selector="{{AdminProductFormSection.attributeRequiredInput(textProductAttribute.attribute_code)}}" userInput="searchable" stepKey="fillTheAttributeRequiredInputField"/> diff --git a/app/code/Magento/Fedex/Test/Mftf/Test/AdminCreatingShippingLabelTest.xml b/app/code/Magento/Fedex/Test/Mftf/Test/AdminCreatingShippingLabelTest.xml index 91a76383babd4..c18364df3ca67 100644 --- a/app/code/Magento/Fedex/Test/Mftf/Test/AdminCreatingShippingLabelTest.xml +++ b/app/code/Magento/Fedex/Test/Mftf/Test/AdminCreatingShippingLabelTest.xml @@ -83,7 +83,7 @@ <actionGroup ref="AdminFillProductCountryOfManufactureActionGroup" stepKey="fillCountryOfManufacture"> <argument name="countryId" value="DE"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveSimpleProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveSimpleProduct"/> <!--Place for order using FedEx shipping method--> <amOnPage url="{{StorefrontProductPage.url($$createProduct.custom_attributes[url_key]$$)}}" stepKey="amOnStorefrontProductPage"/> <actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart"> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/StorefrontAddGroupedProductWithTwoLinksToCartActionGroup.xml b/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/StorefrontAddGroupedProductWithTwoLinksToCartActionGroup.xml index c1ba827f6ca8a..0a44aa6943862 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/StorefrontAddGroupedProductWithTwoLinksToCartActionGroup.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/StorefrontAddGroupedProductWithTwoLinksToCartActionGroup.xml @@ -8,7 +8,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="StorefrontAddGroupedProductWithTwoLinksToCartActionGroup" extends="AddSimpleProductToCart"> + <actionGroup name="StorefrontAddGroupedProductWithTwoLinksToCartActionGroup" extends="AddSimpleProductToCartActionGroup"> <annotations> <description>Adding to the Shopping Cart single Grouped product, with 2 associated from the Product page</description> </annotations> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminAddDefaultImageGroupedProductTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminAddDefaultImageGroupedProductTest.xml index f2cb2cc993a50..583406e898c39 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminAddDefaultImageGroupedProductTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminAddDefaultImageGroupedProductTest.xml @@ -29,7 +29,7 @@ </createData> </before> <after> - <actionGroup ref="deleteProductBySku" stepKey="deleteGroupedProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteGroupedProduct"> <argument name="sku" value="{{GroupedProduct.sku}}"/> </actionGroup> <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> @@ -41,8 +41,8 @@ <!-- Create product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPage"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGridColumnsInitial"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct"> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGridColumnsInitial"/> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct"> <argument name="product" value="GroupedProduct"/> </actionGroup> <actionGroup ref="fillGroupedProductForm" stepKey="fillProductForm"> @@ -54,7 +54,7 @@ <click selector="body" stepKey="clickBodyToCorrectFocusGrouped"/> <click selector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" stepKey="clickAddProductsToGroup"/> <waitForElementVisible selector="{{AdminAddProductsToGroupPanel.filters}}" stepKey="waitForGroupedProductModal"/> - <actionGroup ref="filterProductGridBySku2" stepKey="filterGroupedProducts"> + <actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterGroupedProducts"> <argument name="sku" value="api-simple-product"/> </actionGroup> <checkOption selector="{{AdminAddProductsToGroupPanel.nThCheckbox('0')}}" stepKey="checkFilterResult1"/> @@ -63,21 +63,21 @@ <click selector="{{AdminAddProductsToGroupPanel.addSelectedProducts}}" stepKey="clickAddSelectedGroupProducts"/> <!-- Add image to product --> - <actionGroup ref="addProductImage" stepKey="addImageForProduct"> + <actionGroup ref="AddProductImageActionGroup" stepKey="addImageForProduct"> <argument name="image" value="MagentoLogo"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!-- Assert product image in admin product form --> - <actionGroup ref="assertProductImageAdminProductPage" stepKey="assertProductImageAdminProductPage"/> + <actionGroup ref="AssertProductImageAdminProductPageActionGroup" stepKey="assertProductImageAdminProductPage"/> <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageActionGroup" stepKey="AssertProductInStorefrontProductPage"> <argument name="product" value="GroupedProduct"/> </actionGroup> <!-- Assert product image in storefront product page --> - <actionGroup ref="assertProductImageStorefrontProductPage" stepKey="assertProductImageStorefrontProductPage"> + <actionGroup ref="AssertProductImageStorefrontProductPageActionGroup" stepKey="assertProductImageStorefrontProductPage"> <argument name="product" value="GroupedProduct"/> <argument name="image" value="MagentoLogo"/> </actionGroup> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminAddDefaultVideoGroupedProductTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminAddDefaultVideoGroupedProductTest.xml index c3a95bbef3aa3..b4d8b4c1825ad 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminAddDefaultVideoGroupedProductTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminAddDefaultVideoGroupedProductTest.xml @@ -29,7 +29,7 @@ <!-- Create a grouped product --> <!-- Replacing steps in base AdminAddDefaultVideoSimpleProductTest --> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProductPage"> <argument name="product" value="GroupedProduct"/> </actionGroup> <actionGroup ref="fillGroupedProductForm" stepKey="fillMainProductForm"> @@ -41,18 +41,18 @@ <conditionalClick selector="{{AdminProductFormGroupedProductsSection.toggleGroupedProduct}}" dependentSelector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" visible="false" stepKey="openGroupedProductSection" after="scrollToSection"/> <click selector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" stepKey="clickAddProductsToGroup" after="openGroupedProductSection"/> <waitForElementVisible selector="{{AdminAddProductsToGroupPanel.filters}}" stepKey="waitForFilter" after="clickAddProductsToGroup"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku1" after="waitForFilter"> + <actionGroup ref="FilterProductGridBySkuActionGroup" 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"> + <actionGroup ref="FilterProductGridBySkuActionGroup" 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"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageActionGroup" stepKey="AssertProductInStorefrontProductPage"> <argument name="product" value="GroupedProduct"/> </actionGroup> </test> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminAssociateGroupedProductToWebsitesTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminAssociateGroupedProductToWebsitesTest.xml index 3827666252478..41096c416d05e 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminAssociateGroupedProductToWebsitesTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminAssociateGroupedProductToWebsitesTest.xml @@ -69,14 +69,14 @@ <argument name="websiteName" value="{{secondCustomWebsite.name}}"/> </actionGroup> - <actionGroup ref="NavigateToAndResetProductGridToDefaultView" stepKey="resetProductGridFilter"/> + <actionGroup ref="NavigateToAndResetProductGridToDefaultViewActionGroup" stepKey="resetProductGridFilter"/> <!-- Admin logout --> <actionGroup ref="logout" stepKey="logout"/> </after> <!-- Open product page and assign grouped project to second website --> - <actionGroup ref="filterAndSelectProduct" stepKey="openAdminProductPage"> + <actionGroup ref="FilterAndSelectProductActionGroup" stepKey="openAdminProductPage"> <argument name="productSku" value="$$createGroupedProduct.sku$$"/> </actionGroup> <actionGroup ref="AdminAssignProductInWebsiteActionGroup" stepKey="assignProductToSecondWebsite"> @@ -85,15 +85,15 @@ <actionGroup ref="AdminUnassignProductInWebsiteActionGroup" stepKey="unassignProductFromDefaultWebsite"> <argument name="website" value="{{_defaultWebsite.name}}"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveGroupedProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveGroupedProduct"/> <!-- Assert product is assigned to Second website --> - <actionGroup ref="AssertProductIsAssignedToWebsite" stepKey="seeCustomWebsiteIsChecked"> + <actionGroup ref="AssertProductIsAssignedToWebsiteActionGroup" stepKey="seeCustomWebsiteIsChecked"> <argument name="website" value="{{secondCustomWebsite.name}}"/> </actionGroup> <!-- Assert product is not assigned to Main website --> - <actionGroup ref="AssertProductIsNotAssignedToWebsite" stepKey="seeMainWebsiteIsNotChecked"> + <actionGroup ref="AssertProductIsNotAssignedToWebsiteActionGroup" stepKey="seeMainWebsiteIsNotChecked"> <argument name="website" value="{{_defaultWebsite.name}}"/> </actionGroup> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminCreateAndEditGroupedProductSettingsTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminCreateAndEditGroupedProductSettingsTest.xml index 62a685554f735..88f90e54784e8 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminCreateAndEditGroupedProductSettingsTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminCreateAndEditGroupedProductSettingsTest.xml @@ -30,7 +30,7 @@ </before> <after> <!-- Delete grouped product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="GroupedProduct"/> </actionGroup> @@ -47,7 +47,7 @@ </after> <!-- Create new grouped product --> - <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="createGroupedProduct"> + <actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="createGroupedProduct"> <argument name="productType" value="grouped"/> </actionGroup> @@ -70,7 +70,7 @@ <actionGroup ref="AdminSetProductDesignSettingsActionGroup" stepKey="setProductDesignSettings"/> <!-- Save grouped product form --> - <actionGroup ref="saveProductForm" stepKey="clickSaveButton"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="clickSaveButton"/> <!-- Open created simple product --> <actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForSimpleProduct"> @@ -86,7 +86,7 @@ </actionGroup> <!-- Save simple product form --> - <actionGroup ref="saveProductForm" stepKey="clickSaveBtn"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="clickSaveBtn"/> <!-- Open grouped product page --> <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openStorefrontProductPage"> @@ -100,7 +100,7 @@ <fillField selector="{{StorefrontProductPageSection.qtyInput}}" userInput="{{ApiSimpleSingleQty.quantity}}" stepKey="fillFieldQtyInput"/> <!-- Assert Gift Option product settings is present --> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage6"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage6"> <argument name="productName" value="GroupedProduct.name"/> </actionGroup> <actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openShoppingCart"/> @@ -120,7 +120,7 @@ </actionGroup> <!-- Assert product is assigned to websites --> - <actionGroup ref="AssertProductIsAssignedToWebsite" stepKey="seeCustomWebsiteIsChecked"> + <actionGroup ref="AssertProductIsAssignedToWebsiteActionGroup" stepKey="seeCustomWebsiteIsChecked"> <argument name="website" value="$createWebsite.website[name]$"/> </actionGroup> @@ -135,7 +135,7 @@ </actionGroup> <!-- Save grouped product form --> - <actionGroup ref="saveProductForm" stepKey="clickSaveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="clickSaveProduct"/> <!-- Open created simple product --> <actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForProduct"> @@ -149,7 +149,7 @@ <actionGroup ref="AdminSwitchProductGiftMessageStatusActionGroup" stepKey="disableGiftMessageSettings"/> <!-- Save product form --> - <actionGroup ref="saveProductForm" stepKey="clickSaveSimpleProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="clickSaveSimpleProduct"/> <!-- Verify Url Key after changing --> <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPage"> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminDeleteGroupedProductTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminDeleteGroupedProductTest.xml index 6768dd5a1a249..f7b9357f1b34a 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminDeleteGroupedProductTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminDeleteGroupedProductTest.xml @@ -33,7 +33,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <actionGroup ref="logout" stepKey="logout"/> </after> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteGroupedProductFilteredBySkuAndName"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteGroupedProductFilteredBySkuAndName"> <argument name="product" value="$$createGroupedProduct$$"/> </actionGroup> <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminGroupedProductSetEditContentTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminGroupedProductSetEditContentTest.xml index 3938d91c515f1..d9f9d8ecd9382 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminGroupedProductSetEditContentTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminGroupedProductSetEditContentTest.xml @@ -21,16 +21,16 @@ </annotations> <after> <!-- Delete grouped product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="GroupedProduct"/> </actionGroup> </after> <!-- Create product --> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct"> <argument name="product" value="GroupedProduct"/> </actionGroup> - <actionGroup ref="fillProductNameAndSkuInProductForm" stepKey="fillProductForm"> + <actionGroup ref="FillProductNameAndSkuInProductFormActionGroup" stepKey="fillProductForm"> <argument name="product" value="GroupedProduct"/> </actionGroup> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminGroupedProductsListTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminGroupedProductsListTest.xml index b59cf1e2175d8..431ca4449cbdb 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminGroupedProductsListTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminGroupedProductsListTest.xml @@ -39,7 +39,7 @@ <!-- Create product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="adminProductIndexPageAdd"/> <waitForPageLoad stepKey="waitForProductIndexPageLoad"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProductPage"> <argument name="product" value="GroupedProduct"/> </actionGroup> <actionGroup ref="fillGroupedProductForm" stepKey="fillMainProductForm"> @@ -50,11 +50,11 @@ <conditionalClick selector="{{AdminProductFormGroupedProductsSection.toggleGroupedProduct}}" dependentSelector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" visible="false" stepKey="openGroupedProductSection"/> <click selector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" stepKey="clickAddProductsToGroup"/> <waitForElementVisible selector="{{AdminAddProductsToGroupPanel.filters}}" stepKey="waitForFilter"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku1"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProductGridBySku1"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToGroupPanel.firstCheckbox}}" stepKey="checkOption1"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku2"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProductGridBySku2"> <argument name="product" value="$$simpleProduct2$$"/> </actionGroup> <checkOption selector="{{AdminAddProductsToGroupPanel.firstCheckbox}}" stepKey="checkOption2"/> @@ -62,7 +62,7 @@ <waitForPageLoad stepKey="waitForPageLoad1"/> <!-- Save product --> - <actionGroup ref="saveProductForm" stepKey="saveProductForm"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductForm"/> <waitForPageLoad stepKey="waitForPageLoad2"/> <scrollTo selector="{{AdminProductFormGroupedProductsSection.toggleGroupedProduct}}" x="0" y="-100" stepKey="scrollToProducts"/> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminGroupedSetEditRelatedProductsTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminGroupedSetEditRelatedProductsTest.xml index 8117d627a370c..9cdd24b41355a 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminGroupedSetEditRelatedProductsTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminGroupedSetEditRelatedProductsTest.xml @@ -21,13 +21,13 @@ <before></before> <after> <!-- Delete grouped product --> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="GroupedProduct"/> </actionGroup> </after> <!-- Create product --> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct"> <argument name="product" value="GroupedProduct"/> </actionGroup> <actionGroup ref="fillGroupedProductForm" stepKey="fillProductForm"> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminRemoveDefaultImageGroupedProductTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminRemoveDefaultImageGroupedProductTest.xml index da7cfaeb71566..975498863d6da 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminRemoveDefaultImageGroupedProductTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminRemoveDefaultImageGroupedProductTest.xml @@ -38,8 +38,8 @@ <!-- Create product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPage"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGridColumnsInitial"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct"> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGridColumnsInitial"/> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct"> <argument name="product" value="GroupedProduct"/> </actionGroup> <actionGroup ref="fillGroupedProductForm" stepKey="fillProductForm"> @@ -51,7 +51,7 @@ <click selector="body" stepKey="clickBodyToCorrectFocusGrouped"/> <click selector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" stepKey="clickAddProductsToGroup"/> <waitForElementVisible selector="{{AdminAddProductsToGroupPanel.filters}}" stepKey="waitForGroupedProductModal"/> - <actionGroup ref="filterProductGridBySku2" stepKey="filterGroupedProducts"> + <actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterGroupedProducts"> <argument name="sku" value="api-simple-product"/> </actionGroup> <checkOption selector="{{AdminAddProductsToGroupPanel.nThCheckbox('0')}}" stepKey="checkFilterResult1"/> @@ -60,26 +60,26 @@ <click selector="{{AdminAddProductsToGroupPanel.addSelectedProducts}}" stepKey="clickAddSelectedGroupProducts"/> <!-- Add image to product --> - <actionGroup ref="addProductImage" stepKey="addImageForProduct"> + <actionGroup ref="AddProductImageActionGroup" stepKey="addImageForProduct"> <argument name="image" value="MagentoLogo"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!-- Remove image from product --> - <actionGroup ref="removeProductImage" stepKey="removeProductImage"/> + <actionGroup ref="RemoveProductImageActionGroup" stepKey="removeProductImage"/> - <actionGroup ref="saveProductForm" stepKey="saveProductFormAfterRemove"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductFormAfterRemove"/> <!-- Assert product image not in admin product form --> - <actionGroup ref="assertProductImageNotInAdminProductPage" stepKey="assertProductImageNotInAdminProductPage"/> + <actionGroup ref="AssertProductImageNotInAdminProductPageActionGroup" stepKey="assertProductImageNotInAdminProductPage"/> <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPageAfterRemove"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageActionGroup" stepKey="AssertProductInStorefrontProductPageAfterRemove"> <argument name="product" value="GroupedProduct"/> </actionGroup> <!-- Assert product image not in storefront product page --> - <actionGroup ref="assertProductImageNotInStorefrontProductPage" stepKey="assertProductImageNotInStorefrontProductPage"> + <actionGroup ref="AssertProductImageNotInStorefrontProductPageActionGroup" stepKey="assertProductImageNotInStorefrontProductPage"> <argument name="product" value="GroupedProduct"/> </actionGroup> </test> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminRemoveDefaultVideoGroupedProductTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminRemoveDefaultVideoGroupedProductTest.xml index e322d4a1eb038..c24be0d9fdfb6 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminRemoveDefaultVideoGroupedProductTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminRemoveDefaultVideoGroupedProductTest.xml @@ -29,7 +29,7 @@ <!-- Create a grouped product --> <!-- Replacing steps in base AdminRemoveDefaultVideoSimpleProductTest --> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProductPage"> <argument name="product" value="GroupedProduct"/> </actionGroup> <actionGroup ref="fillGroupedProductForm" stepKey="fillMainProductForm"> @@ -41,18 +41,18 @@ <conditionalClick selector="{{AdminProductFormGroupedProductsSection.toggleGroupedProduct}}" dependentSelector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" visible="false" stepKey="openGroupedProductSection" after="scrollToSection"/> <click selector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" stepKey="clickAddProductsToGroup" after="openGroupedProductSection"/> <waitForElementVisible selector="{{AdminAddProductsToGroupPanel.filters}}" stepKey="waitForFilter" after="clickAddProductsToGroup"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku1" after="waitForFilter"> + <actionGroup ref="FilterProductGridBySkuActionGroup" 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"> + <actionGroup ref="FilterProductGridBySkuActionGroup" 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"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageActionGroup" stepKey="AssertProductInStorefrontProductPage"> <argument name="product" value="GroupedProduct"/> </actionGroup> </test> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminSortingAssociatedProductsTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminSortingAssociatedProductsTest.xml index ad5fbbb30edeb..f42c0bed70a17 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminSortingAssociatedProductsTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminSortingAssociatedProductsTest.xml @@ -94,7 +94,7 @@ </before> <after> <!--Delete created grouped product--> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="GroupedProduct"/> </actionGroup> <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" @@ -129,8 +129,8 @@ <!--Create grouped Product--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPage"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGridColumnsInitial"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct"> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGridColumnsInitial"/> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct"> <argument name="product" value="GroupedProduct"/> </actionGroup> <actionGroup ref="fillGroupedProductForm" stepKey="fillProductForm"> @@ -142,7 +142,7 @@ <click selector="body" stepKey="clickBodyToCorrectFocusGrouped"/> <click selector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" stepKey="clickAddProductsToGroup"/> <waitForElementVisible selector="{{AdminAddProductsToGroupPanel.filters}}" stepKey="waitForGroupedProductModal"/> - <actionGroup ref="filterProductGridBySku2" stepKey="filterGroupedProducts"> + <actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterGroupedProducts"> <argument name="sku" value="api-simple-product"/> </actionGroup> @@ -153,13 +153,13 @@ <click selector="{{AdminAddProductsToGroupPanel.addSelectedProducts}}" stepKey="clickAddSelectedGroupProducts"/> <waitForPageLoad stepKey="waitForProductsAdded"/> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!--Open created Product group--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPageLoad"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetFiltersIfExist"/> - <actionGroup ref="searchProductGridByKeyword" stepKey="searchProductGridForm"> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetFiltersIfExist"/> + <actionGroup ref="SearchProductGridByKeywordActionGroup" stepKey="searchProductGridForm"> <argument name="keyword" value="GroupedProduct.name"/> </actionGroup> <click selector="{{AdminProductGridSection.selectRowBasedOnName(GroupedProduct.name)}}" stepKey="openGroupedProduct"/> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/EndToEndB2CAdminTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/EndToEndB2CAdminTest.xml index dbe3dddfca81b..f5f7abc7075ab 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/EndToEndB2CAdminTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/EndToEndB2CAdminTest.xml @@ -11,7 +11,7 @@ <!--Create Grouped Product--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPageGrouped" after="seeSimpleProductInGrid"/> <waitForPageLoad stepKey="waitForProductPageLoadGrouped" after="visitAdminProductPageGrouped"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateGroupedProduct" after="waitForProductPageLoadGrouped"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateGroupedProduct" after="waitForProductPageLoadGrouped"> <argument name="product" value="GroupedProduct"/> </actionGroup> <actionGroup ref="checkRequiredFieldsInGroupedProductForm" stepKey="checkRequiredFieldsProductGrouped" after="goToCreateGroupedProduct"/> @@ -23,20 +23,20 @@ <click selector="body" stepKey="clickBodyToCorrectFocusGrouped" after="openGroupedProductsSection"/> <click selector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" stepKey="clickAddProductsToGroup" after="clickBodyToCorrectFocusGrouped"/> <waitForElementVisible selector="{{AdminAddProductsToGroupPanel.filters}}" stepKey="waitForGroupedProductModal" after="clickAddProductsToGroup"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterGroupedProductOptions" after="waitForGroupedProductModal"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterGroupedProductOptions" after="waitForGroupedProductModal"> <argument name="product" value="SimpleProduct"/> </actionGroup> <checkOption selector="{{AdminAddProductsToGroupPanel.firstCheckbox}}" stepKey="checkFilterResult" after="filterGroupedProductOptions"/> <click selector="{{AdminAddProductsToGroupPanel.addSelectedProducts}}" stepKey="clickAddSelectedGroupProducts" after="checkFilterResult"/> - <actionGroup ref="saveProductForm" stepKey="saveGroupedProduct" after="clickAddSelectedGroupProducts"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveGroupedProduct" after="clickAddSelectedGroupProducts"/> <actionGroup ref="viewGroupedProductInAdminGrid" stepKey="viewGroupedProductInGrid" after="saveGroupedProduct"> <argument name="product" value="GroupedProduct"/> </actionGroup> <!--@TODO Move cleanup to "after" when MQE-830 is resolved--> <comment userInput="Clean up grouped product" stepKey="cleanUpGroupedProduct" after="deleteSimpleProduct"/> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteGroupedProduct" after="cleanUpGroupedProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteGroupedProduct" after="cleanUpGroupedProduct"> <argument name="product" value="GroupedProduct"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/NewProductsListWidgetGroupedProductTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/NewProductsListWidgetGroupedProductTest.xml index a56512f84a9b8..d563796b21da9 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/NewProductsListWidgetGroupedProductTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/NewProductsListWidgetGroupedProductTest.xml @@ -52,7 +52,7 @@ <scrollTo selector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" stepKey="scrollToAddProductsToGroup"/> <click selector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" stepKey="clickAddProductsToGroup"/> <waitForElementVisible selector="{{AdminAddProductsToGroupPanel.filters}}" stepKey="waitForGroupedProductModal"/> - <actionGroup ref="filterProductGridBySku2" stepKey="filterGroupedProducts"> + <actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterGroupedProducts"> <argument name="sku" value="api-simple-product"/> </actionGroup> <checkOption selector="{{AdminAddProductsToGroupPanel.nThCheckbox('0')}}" stepKey="checkFilterResult1"/> diff --git a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminCheckDoubleImportOfProductsTest.xml b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminCheckDoubleImportOfProductsTest.xml index 909c6101fe53e..23ef749217ac6 100644 --- a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminCheckDoubleImportOfProductsTest.xml +++ b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminCheckDoubleImportOfProductsTest.xml @@ -37,7 +37,7 @@ <actionGroup ref="adminDataGridSelectPerPage" stepKey="selectNumberOfProductsPerPage"> <argument name="perPage" value="100"/> </actionGroup> - <actionGroup ref="deleteProductsIfTheyExist" stepKey="deleteAllProducts"/> + <actionGroup ref="DeleteProductsIfTheyExistActionGroup" stepKey="deleteAllProducts"/> <!-- Delete additional store views --> <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteFirstStoreView"> @@ -48,7 +48,7 @@ </actionGroup> <!-- Delete category --> - <actionGroup ref="DeleteCategory" stepKey="deleteCategory"> + <actionGroup ref="DeleteCategoryActionGroup" stepKey="deleteCategory"> <argument name="categoryEntity" value="Gear"/> </actionGroup> diff --git a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminCheckThatSomeAttributesChangedValueToEmptyAfterImportTest.xml b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminCheckThatSomeAttributesChangedValueToEmptyAfterImportTest.xml index 42516e5a5a363..6a2f6ca60acf4 100644 --- a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminCheckThatSomeAttributesChangedValueToEmptyAfterImportTest.xml +++ b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminCheckThatSomeAttributesChangedValueToEmptyAfterImportTest.xml @@ -22,8 +22,8 @@ <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndexPage"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGridToDefaultView"/> - <actionGroup ref="deleteProductsIfTheyExist" stepKey="deleteAllProducts"/> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGridToDefaultView"/> + <actionGroup ref="DeleteProductsIfTheyExistActionGroup" stepKey="deleteAllProducts"/> <createData entity="productDropDownAttribute" stepKey="productAttribute"/> <createData entity="productAttributeOption2" stepKey="attributeOptionWithDefaultValue"> <requiredEntity createDataKey="productAttribute"/> @@ -44,22 +44,22 @@ <actionGroup ref="logout" stepKey="logoutFromAdmin"/> </after> <!--Create product--> - <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="openProductFillForm"/> - <actionGroup ref="fillMainProductForm" stepKey="fillProductFieldsInAdmin"> + <actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="openProductFillForm"/> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillProductFieldsInAdmin"> <argument name="product" value="simpleProductWithShortNameAndSku"/> </actionGroup> - <actionGroup ref="SetCategoryByName" stepKey="addCategoryToProduct"> + <actionGroup ref="SetCategoryByNameActionGroup" stepKey="addCategoryToProduct"> <argument name="categoryName" value="$$createCategory.name$$"/> </actionGroup> <!--Select created attribute--> - <actionGroup ref="addProductAttributeInProductModal" stepKey="addAttributeToProduct"> + <actionGroup ref="AddProductAttributeInProductModalActionGroup" stepKey="addAttributeToProduct"> <argument name="attributeCode" value="$$productAttribute.attribute_code$$"/> </actionGroup> <!--Check that attribute value is selected--> <scrollTo selector="{{AdminProductFormSection.attributeTab}}" stepKey="scrollToAttributeTitle1"/> <conditionalClick selector="{{AdminProductFormSection.attributeTab}}" dependentSelector="{{AdminProductAttributeSection.dropDownAttribute($$productAttribute.attribute_code$$)}}" visible="false" stepKey="expandAttributeTab1"/> <seeOptionIsSelected selector="{{AdminProductAttributeSection.dropDownAttribute($$productAttribute.attribute_code$$)}}" userInput="option2" stepKey="seeAttributeValueIsSelected1"/> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!--Import product with add/update behavior--> <actionGroup ref="AdminImportProductsActionGroup" stepKey="adminImportProductsFirstTime"> <argument name="behavior" value="Add/Update"/> @@ -67,7 +67,7 @@ <argument name="importNoticeMessage" value="Created: 0, Updated: 1, Deleted: 0"/> </actionGroup> <!--Check that attribute value is empty after import--> - <actionGroup ref="filterAndSelectProduct" stepKey="filterAndSelectTheProduct2"> + <actionGroup ref="FilterAndSelectProductActionGroup" stepKey="filterAndSelectTheProduct2"> <argument name="productSku" value="{{simpleProductWithShortNameAndSku.sku}}"/> </actionGroup> <scrollTo selector="{{AdminProductFormSection.attributeTab}}" stepKey="scrollToAttributeTitle2"/> diff --git a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminImportProductsWithErrorEntriesTest.xml b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminImportProductsWithErrorEntriesTest.xml index 94840a4ea6142..e3065f005218b 100644 --- a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminImportProductsWithErrorEntriesTest.xml +++ b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminImportProductsWithErrorEntriesTest.xml @@ -25,7 +25,7 @@ <!--Clear products grid filters--> <actionGroup ref="AdminClearFiltersActionGroup" stepKey="clearProductsGridFilters"/> <!--Delete all imported products--> - <actionGroup ref="deleteProductsIfTheyExist" stepKey="deleteAllProducts"/> + <actionGroup ref="DeleteProductsIfTheyExistActionGroup" stepKey="deleteAllProducts"/> <!--Logout from Admin page--> <actionGroup ref="logout" stepKey="logoutFromAdminPage"/> </after> diff --git a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminProductVisibilityDifferentStoreViewsAfterImportTest.xml b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminProductVisibilityDifferentStoreViewsAfterImportTest.xml index 0a1423ece71e0..738acc873b9c8 100644 --- a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminProductVisibilityDifferentStoreViewsAfterImportTest.xml +++ b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminProductVisibilityDifferentStoreViewsAfterImportTest.xml @@ -38,7 +38,7 @@ <actionGroup ref="adminDataGridSelectPerPage" stepKey="selectNumberOfProductsPerPage"> <argument name="perPage" value="100"/> </actionGroup> - <actionGroup ref="deleteProductsIfTheyExist" stepKey="deleteAllProducts"/> + <actionGroup ref="DeleteProductsIfTheyExistActionGroup" stepKey="deleteAllProducts"/> <!--Delete store views--> <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteEnglishStoreView"> <argument name="customStore" value="customStoreEN"/> @@ -55,17 +55,17 @@ <argument name="importNoticeMessage" value="Created: 2, Updated: 0, Deleted: 0"/> </actionGroup> <!--Open imported name4 product--> - <actionGroup ref="filterAndSelectProduct" stepKey="openName4Product"> + <actionGroup ref="FilterAndSelectProductActionGroup" stepKey="openName4Product"> <argument name="productSku" value="name4"/> </actionGroup> <!--Switch Chinese store view and assert visibility field--> <comment userInput="Switch Chinese store view and assert visibility field" stepKey="commentAssertVisibilityChineseView"/> - <actionGroup ref="SwitchToTheNewStoreView" stepKey="switchToCustomStoreView"> + <actionGroup ref="SwitchToTheNewStoreViewActionGroup" stepKey="switchToCustomStoreView"> <argument name="storeViewName" value="{{storeViewChinese.name}}"/> </actionGroup> <seeInField selector="{{AdminProductFormSection.visibility}}" userInput="Catalog" stepKey="seeVisibilityFieldForChineseStore"/> <!--Switch English store view and assert visibility field--> - <actionGroup ref="SwitchToTheNewStoreView" stepKey="switchToCustomEnglishView"> + <actionGroup ref="SwitchToTheNewStoreViewActionGroup" stepKey="switchToCustomEnglishView"> <argument name="storeViewName" value="{{customStoreEN.name}}"/> </actionGroup> <seeInField selector="{{AdminProductFormSection.visibility}}" userInput="Catalog" stepKey="seeVisibilityFieldForEnglishView"/> diff --git a/app/code/Magento/LayeredNavigation/Test/Mftf/Test/ShopByButtonInMobile.xml b/app/code/Magento/LayeredNavigation/Test/Mftf/Test/ShopByButtonInMobile.xml index 6d182d0b7a5e2..d2b462d0467a2 100644 --- a/app/code/Magento/LayeredNavigation/Test/Mftf/Test/ShopByButtonInMobile.xml +++ b/app/code/Magento/LayeredNavigation/Test/Mftf/Test/ShopByButtonInMobile.xml @@ -47,7 +47,7 @@ <comment userInput="Go to simple product edit page and set the product attribute to a value" stepKey="commentProductAttributeEdit" /> <amOnPage url="{{AdminProductEditPage.url($$simpleProduct1.id$$)}}" stepKey="goToEditPage"/> <selectOption selector="{{AdminProductFormSection.customSelectField($$attribute.attribute[attribute_code]$$)}}" userInput="option1" stepKey="selectAttribute"/> - <actionGroup ref="saveProductForm" stepKey="saveSimpleProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveSimpleProduct"/> <!-- Check storefront mobile view for shop by button is functioning as expected --> <comment userInput="Check storefront mobile view for shop by button is functioning as expected" stepKey="commentCheckShopByButton" /> <amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToHomePage"/> diff --git a/app/code/Magento/Msrp/Test/Mftf/Test/StorefrontProductWithMapAssignedConfigProductIsCorrectTest.xml b/app/code/Magento/Msrp/Test/Mftf/Test/StorefrontProductWithMapAssignedConfigProductIsCorrectTest.xml index d1eb1339fe856..ccb724e8bf199 100644 --- a/app/code/Magento/Msrp/Test/Mftf/Test/StorefrontProductWithMapAssignedConfigProductIsCorrectTest.xml +++ b/app/code/Magento/Msrp/Test/Mftf/Test/StorefrontProductWithMapAssignedConfigProductIsCorrectTest.xml @@ -114,7 +114,7 @@ <waitForElement selector="{{AdminProductFormAdvancedPricingSection.msrp}}" stepKey="waitForMsrp"/> <fillField selector="{{AdminProductFormAdvancedPricingSection.msrp}}" userInput="55" stepKey="setMsrpForFirstChildProduct"/> <click selector="{{AdminProductFormAdvancedPricingSection.doneButton}}" stepKey="clickDoneButton"/> - <actionGroup ref="saveProductForm" stepKey="saveProduct1"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct1"/> <amOnPage url="{{AdminProductEditPage.url($$createConfigChildProduct2.id$$)}}" stepKey="goToSecondChildProductEditPage"/> <waitForPageLoad stepKey="waitForProductPageLoad1"/> @@ -122,7 +122,7 @@ <waitForElement selector="{{AdminProductFormAdvancedPricingSection.msrp}}" stepKey="waitForMsrp1"/> <fillField selector="{{AdminProductFormAdvancedPricingSection.msrp}}" userInput="66" stepKey="setMsrpForSecondChildProduct"/> <click selector="{{AdminProductFormAdvancedPricingSection.doneButton}}" stepKey="clickDoneButton1"/> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!--Clear cache--> <magentoCLI command="cache:flush" stepKey="flushCache"/> diff --git a/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontCheckingWithMultishipmentTest.xml b/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontCheckingWithMultishipmentTest.xml index 3a58ead3b6dfa..cfec857329b3d 100644 --- a/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontCheckingWithMultishipmentTest.xml +++ b/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontCheckingWithMultishipmentTest.xml @@ -38,11 +38,11 @@ </before> <amOnPage url="$$product1.name$$.html" stepKey="goToProduct1"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProduct1"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProduct1"> <argument name="productName" value="$$product1.name$$"/> </actionGroup> <amOnPage url="$$product2.name$$.html" stepKey="goToProduct2"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProduct2"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProduct2"> <argument name="productName" value="$$product2.name$$"/> </actionGroup> <actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openCart"/> diff --git a/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontCheckingWithSingleShipmentTest.xml b/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontCheckingWithSingleShipmentTest.xml index c9f1856249762..dcf0770e5421e 100644 --- a/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontCheckingWithSingleShipmentTest.xml +++ b/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontCheckingWithSingleShipmentTest.xml @@ -38,11 +38,11 @@ </before> <amOnPage url="$$product1.name$$.html" stepKey="goToProduct1"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProduct1"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProduct1"> <argument name="productName" value="$$product1.name$$"/> </actionGroup> <amOnPage url="$$product2.name$$.html" stepKey="goToProduct2"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProduct2"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProduct2"> <argument name="productName" value="$$product2.name$$"/> </actionGroup> <actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openCart"/> diff --git a/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontMinicartWithMultishipmentTest.xml b/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontMinicartWithMultishipmentTest.xml index c2fd978cf3137..e826d8e03ffbc 100644 --- a/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontMinicartWithMultishipmentTest.xml +++ b/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontMinicartWithMultishipmentTest.xml @@ -48,11 +48,11 @@ </after> <amOnPage url="$$product1.name$$.html" stepKey="goToProduct1"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProduct1"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProduct1"> <argument name="productName" value="$$product1.name$$"/> </actionGroup> <amOnPage url="$$product2.name$$.html" stepKey="goToProduct2"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProduct2"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProduct2"> <argument name="productName" value="$$product2.name$$"/> </actionGroup> <actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openCart"/> diff --git a/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontMyAccountWithMultishipmentTest.xml b/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontMyAccountWithMultishipmentTest.xml index eec8a40877bb3..52da343419a22 100644 --- a/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontMyAccountWithMultishipmentTest.xml +++ b/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontMyAccountWithMultishipmentTest.xml @@ -52,11 +52,11 @@ <actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearAllFilters"/> <actionGroup ref="logout" stepKey="logoutAdmin"/> </after> - <actionGroup ref="AddSimpleProductToCart" stepKey="addSimpleProduct1ToCart"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addSimpleProduct1ToCart"> <argument name="product" value="$$product1$$"/> </actionGroup> <waitForPageLoad stepKey="waitForSecondProductPageLoad"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="addSimpleProduct2ToCart"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addSimpleProduct2ToCart"> <argument name="product" value="$$product2$$"/> </actionGroup> <actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openCart"/> diff --git a/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontCheckoutWithMultipleAddressesTest.xml b/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontCheckoutWithMultipleAddressesTest.xml index 138ab5df26ab0..dc786f9cbc5db 100644 --- a/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontCheckoutWithMultipleAddressesTest.xml +++ b/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontCheckoutWithMultipleAddressesTest.xml @@ -51,7 +51,7 @@ <argument name="productUrl" value="$$firstProduct.custom_attributes[url_key]$$"/> </actionGroup> <!-- Add the first product to the Shopping Cart --> - <actionGroup ref="AddProductWithQtyToCartFromStorefrontProductPage" stepKey="addFirstProductToCart"> + <actionGroup ref="AddProductWithQtyToCartFromStorefrontProductPageActionGroup" stepKey="addFirstProductToCart"> <argument name="productName" value="$$firstProduct.name$$"/> <argument name="productQty" value="1"/> </actionGroup> @@ -60,7 +60,7 @@ <argument name="productUrl" value="$$secondProduct.custom_attributes[url_key]$$"/> </actionGroup> <!-- Add the second product to the Shopping Cart --> - <actionGroup ref="AddProductWithQtyToCartFromStorefrontProductPage" stepKey="addSecondProductToCart"> + <actionGroup ref="AddProductWithQtyToCartFromStorefrontProductPageActionGroup" stepKey="addSecondProductToCart"> <argument name="productName" value="$$secondProduct.name$$"/> <argument name="productQty" value="1"/> </actionGroup> @@ -89,7 +89,7 @@ <argument name="productUrl" value="$$firstProduct.custom_attributes[url_key]$$"/> </actionGroup> <!-- Add three identical products to the Shopping Cart --> - <actionGroup ref="AddProductWithQtyToCartFromStorefrontProductPage" stepKey="addIdenticalProductsToCart"> + <actionGroup ref="AddProductWithQtyToCartFromStorefrontProductPageActionGroup" stepKey="addIdenticalProductsToCart"> <argument name="productName" value="$$firstProduct.name$$"/> <argument name="productQty" value="3"/> </actionGroup> diff --git a/app/code/Magento/Persistent/Test/Mftf/Test/CheckShoppingCartBehaviorAfterSessionExpiredTest.xml b/app/code/Magento/Persistent/Test/Mftf/Test/CheckShoppingCartBehaviorAfterSessionExpiredTest.xml index c66a2979aa7f5..ff5713f445097 100644 --- a/app/code/Magento/Persistent/Test/Mftf/Test/CheckShoppingCartBehaviorAfterSessionExpiredTest.xml +++ b/app/code/Magento/Persistent/Test/Mftf/Test/CheckShoppingCartBehaviorAfterSessionExpiredTest.xml @@ -43,7 +43,7 @@ <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> </after> <!-- Add simple product to cart --> - <actionGroup ref="AddSimpleProductToCart" stepKey="addProductToCart1"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToCart1"> <argument name="product" value="$$createProduct$$"/> </actionGroup> <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> diff --git a/app/code/Magento/Persistent/Test/Mftf/Test/GuestCheckoutWithEnabledPersistentTest.xml b/app/code/Magento/Persistent/Test/Mftf/Test/GuestCheckoutWithEnabledPersistentTest.xml index a383fd4505bd6..43390598f7cb3 100644 --- a/app/code/Magento/Persistent/Test/Mftf/Test/GuestCheckoutWithEnabledPersistentTest.xml +++ b/app/code/Magento/Persistent/Test/Mftf/Test/GuestCheckoutWithEnabledPersistentTest.xml @@ -31,7 +31,7 @@ <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> </after> <!-- Add simple product to cart --> - <actionGroup ref="AddSimpleProductToCart" stepKey="addProductToCart1"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToCart1"> <argument name="product" value="$$createProduct$$"/> </actionGroup> <!-- Navigate to checkout --> diff --git a/app/code/Magento/Persistent/Test/Mftf/Test/ShippingQuotePersistedForGuestTest.xml b/app/code/Magento/Persistent/Test/Mftf/Test/ShippingQuotePersistedForGuestTest.xml index d508ebaa26885..2000617e79707 100644 --- a/app/code/Magento/Persistent/Test/Mftf/Test/ShippingQuotePersistedForGuestTest.xml +++ b/app/code/Magento/Persistent/Test/Mftf/Test/ShippingQuotePersistedForGuestTest.xml @@ -45,7 +45,7 @@ </actionGroup> <!--Step 2: Open the Product Page and add the product to shopping cart--> <amOnPage url="{{StorefrontProductPage.url($$createProduct.custom_attributes[url_key]$$)}}" stepKey="navigateToProductPageAsLoggedUser"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProductToCartAsLoggedUser"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProductToCartAsLoggedUser"> <argument name="productName" value="$$createProduct.name$$"/> </actionGroup> <!--Step 3: Log out, reset persistent cookie and go to homepage--> @@ -56,7 +56,7 @@ <waitForPageLoad stepKey="waitHomePageLoadAfterResetCookie"/> <!--Step 4: Add the product to shopping cart and open cart--> <amOnPage url="{{StorefrontProductPage.url($$createProduct.custom_attributes[url_key]$$)}}" stepKey="navigateToProductPageAsGuestUser"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProductToCartAsGuestUser"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProductToCartAsGuestUser"> <argument name="productName" value="$$createProduct.name$$"/> </actionGroup> <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartBeforeChangeShippingAndTaxSection"/> diff --git a/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyShoppingCartPersistenceUnderLongTermCookieTest.xml b/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyShoppingCartPersistenceUnderLongTermCookieTest.xml index e50fc4af83107..492e0a6f6b101 100644 --- a/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyShoppingCartPersistenceUnderLongTermCookieTest.xml +++ b/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyShoppingCartPersistenceUnderLongTermCookieTest.xml @@ -64,7 +64,7 @@ </actionGroup> <!-- 3. Put Simple Product 1 into Shopping Cart --> - <actionGroup ref="AddSimpleProductToCart" stepKey="addSimple1ProductToCartForJohnSmithCustomer"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addSimple1ProductToCartForJohnSmithCustomer"> <argument name="product" value="$$createSimple1$$"/> </actionGroup> <actionGroup ref="assertOneProductNameInMiniCart" stepKey="checkSimple1InMiniCartForJohnSmithCustomer"> @@ -92,7 +92,7 @@ <argument name="customerFullName" value="{{Simple_Customer_Without_Address.fullname}}"/> </actionGroup> <!-- 6. Add Simple Product 1 to Shopping Cart --> - <actionGroup ref="AddSimpleProductToCart" stepKey="addSimple1ProductToCartForJohnDoeCustomer"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addSimple1ProductToCartForJohnDoeCustomer"> <argument name="product" value="$$createSimple1$$"/> </actionGroup> <see selector="{{StorefrontMinicartSection.productCount}}" userInput="1" stepKey="miniCartContainsOneProductForJohnDoeCustomer"/> @@ -119,7 +119,7 @@ <see selector="{{CheckoutCartProductSection.productName}}" userInput="$$createSimple1.name$$" stepKey="checkSimple1InShoppingCart"/> <!-- 9. Add Simple Product 2 to Shopping Cart --> - <actionGroup ref="AddSimpleProductToCart" stepKey="addSimple2ProductToCartForGuest"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addSimple2ProductToCartForGuest"> <argument name="product" value="$$createSimple2$$"/> </actionGroup> <actionGroup ref="assertOneProductNameInMiniCart" stepKey="checkSimple1InMiniCartForGuestCustomerSecondTime"> diff --git a/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyThatInformationAboutViewingComparisonWishlistIsPersistedUnderLongTermCookieTest.xml b/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyThatInformationAboutViewingComparisonWishlistIsPersistedUnderLongTermCookieTest.xml index dc6f87bef0ba8..fd1396ce28d70 100644 --- a/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyThatInformationAboutViewingComparisonWishlistIsPersistedUnderLongTermCookieTest.xml +++ b/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyThatInformationAboutViewingComparisonWishlistIsPersistedUnderLongTermCookieTest.xml @@ -70,10 +70,10 @@ <see userInput="Welcome, $$createCustomer.firstname$$ $$createCustomer.lastname$$!" selector="{{StorefrontPanelHeaderSection.WelcomeMessage}}" stepKey="checkWelcomeMessage"/> <!--Open the details page of Simple Product 1, Simple Product 2 and add to cart, get to the category--> - <actionGroup ref="AddSimpleProductToCart" stepKey="addSimpleProductProductToCart"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addSimpleProductProductToCart"> <argument name="product" value="$$createSimpleProduct$$"/> </actionGroup> - <actionGroup ref="AddSimpleProductToCart" stepKey="addSecondSimpleProductProductToCart"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addSecondSimpleProductProductToCart"> <argument name="product" value="$$createSecondSimpleProduct$$"/> </actionGroup> <amOnPage url="{{StorefrontCategoryPage.url($$createCategory.custom_attributes[url_key]$$)}}" stepKey="openCategoryPageAfterAddedProductToCart"/> diff --git a/app/code/Magento/ProductVideo/Test/Mftf/Test/AdminValidateUrlOnGetVideoInformationTest.xml b/app/code/Magento/ProductVideo/Test/Mftf/Test/AdminValidateUrlOnGetVideoInformationTest.xml index 0db15276e8c67..03fb71ac039a7 100644 --- a/app/code/Magento/ProductVideo/Test/Mftf/Test/AdminValidateUrlOnGetVideoInformationTest.xml +++ b/app/code/Magento/ProductVideo/Test/Mftf/Test/AdminValidateUrlOnGetVideoInformationTest.xml @@ -25,7 +25,7 @@ <actionGroup ref="logout" stepKey="logout"/> </after> <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndexPage"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct"> <argument name="product" value="SimpleProduct"/> </actionGroup> <actionGroup ref="AdminOpenProductVideoModalActionGroup" stepKey="openAddProductVideoModal"/> diff --git a/app/code/Magento/ProductVideo/Test/Mftf/Test/YoutubeVideoWindowOnProductPageTest.xml b/app/code/Magento/ProductVideo/Test/Mftf/Test/YoutubeVideoWindowOnProductPageTest.xml index 7249a4223503e..57e63945865fa 100644 --- a/app/code/Magento/ProductVideo/Test/Mftf/Test/YoutubeVideoWindowOnProductPageTest.xml +++ b/app/code/Magento/ProductVideo/Test/Mftf/Test/YoutubeVideoWindowOnProductPageTest.xml @@ -35,11 +35,11 @@ <!--Open simple product--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductIndex"/> <waitForPageLoad stepKey="wait1"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGrid"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku"> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGrid"/> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProductGridBySku"> <argument name="product" value="$$createProduct$$"/> </actionGroup> - <actionGroup ref="openProducForEditByClickingRowXColumnYInProductGrid" stepKey="openFirstProductForEdit"/> + <actionGroup ref="OpenProductForEditByClickingRowXColumnYInProductGridActionGroup" stepKey="openFirstProductForEdit"/> <!-- Add product video --> <actionGroup ref="addProductVideo" stepKey="addProductVideo" after="openFirstProductForEdit"/> diff --git a/app/code/Magento/Quote/Test/Mftf/Test/StorefrontGuestCheckoutDisabledProductTest.xml b/app/code/Magento/Quote/Test/Mftf/Test/StorefrontGuestCheckoutDisabledProductTest.xml index f7a4fda4f67d8..6e31214b0dddf 100644 --- a/app/code/Magento/Quote/Test/Mftf/Test/StorefrontGuestCheckoutDisabledProductTest.xml +++ b/app/code/Magento/Quote/Test/Mftf/Test/StorefrontGuestCheckoutDisabledProductTest.xml @@ -86,11 +86,11 @@ <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/> <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductListing"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetGridToDefaultKeywordSearch"/> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetGridToDefaultKeywordSearch"/> </after> <!-- Step 1: Add simple product to shopping cart --> <amOnPage url="{{StorefrontProductPage.url($$createSimpleProduct.name$$)}}" stepKey="amOnSimpleProductPage"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="cartAddSimpleProductToCart"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="cartAddSimpleProductToCart"> <argument name="product" value="$$createSimpleProduct$$"/> <argument name="productCount" value="1"/> </actionGroup> @@ -103,7 +103,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <!-- Find the first simple product that we just created using the product grid and go to its page--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> - <actionGroup ref="filterProductGridBySku" stepKey="findCreatedProduct"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="findCreatedProduct"> <argument name="product" value="$$createConfigChildProduct1$$"/> </actionGroup> <waitForPageLoad stepKey="waitForFiltersToBeApplied"/> @@ -111,7 +111,7 @@ <waitForPageLoad stepKey="waitForProductPageLoad"/> <!-- Disabled child configurable product --> <click selector="{{AdminProductFormSection.enableProductAttributeLabel}}" stepKey="clickDisableProduct"/> - <actionGroup ref="saveProductForm" stepKey="clickSaveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="clickSaveProduct"/> <!-- Disabled simple product from grid --> <actionGroup ref="ChangeStatusProductUsingProductGridActionGroup" stepKey="disabledProductFromGrid"> <argument name="product" value="$$createSimpleProduct$$"/> @@ -126,7 +126,7 @@ <dontSeeElement selector="{{StorefrontMiniCartSection.quantity}}" stepKey="dontSeeCartItem"/> <!-- Add simple product to shopping cart --> <amOnPage url="{{StorefrontProductPage.url($$createSimpleProduct2.name$$)}}" stepKey="amOnSimpleProductPage2"/> - <actionGroup ref="AddSimpleProductToCart" stepKey="cartAddSimpleProductToCart2"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="cartAddSimpleProductToCart2"> <argument name="product" value="$$createSimpleProduct2$$"/> <argument name="productCount" value="1"/> </actionGroup> @@ -135,7 +135,7 @@ <openNewTab stepKey="openNewTab2"/> <!-- Find the first simple product that we just created using the product grid and go to its page --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage2"/> - <actionGroup ref="filterProductGridBySku" stepKey="findCreatedProduct2"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="findCreatedProduct2"> <argument name="product" value="$$createSimpleProduct2$$"/> </actionGroup> <click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnProductPage2"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithCheckMoneyOrderPaymentMethodTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithCheckMoneyOrderPaymentMethodTest.xml index 116b8e7d6ca71..ed081d60074fc 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithCheckMoneyOrderPaymentMethodTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithCheckMoneyOrderPaymentMethodTest.xml @@ -152,7 +152,7 @@ <actionGroup ref="cancelPendingOrder" stepKey="cancelPendingOrder"/> <!-- Assert Simple Product Quantity in backend after order Canceled --> <comment userInput="Assert Simple Product Quantity in backend after order Canceled" stepKey="assertSimpleProductQuantityAfterOrderCanceledComment"/> - <actionGroup ref="filterAndSelectProduct" stepKey="filterAndSelectTheProduct"> + <actionGroup ref="FilterAndSelectProductActionGroup" stepKey="filterAndSelectTheProduct"> <argument name="productSku" value="$$simpleProduct.sku$$"/> </actionGroup> <waitForElementVisible selector="{{AdminProductFormSection.productName}}" stepKey="waitForProductDetailsToLoad"/> @@ -167,7 +167,7 @@ </actionGroup> <!-- Assert Virtual Product Quantity in backend after order canceled --> <comment userInput="Assert Virtual Product Quantity in backend after order canceled" stepKey="assertVirtualProductQuantityAfterOrderCanceledComment"/> - <actionGroup ref="filterAndSelectProduct" stepKey="filterAndSelectTheVirtualProduct"> + <actionGroup ref="FilterAndSelectProductActionGroup" stepKey="filterAndSelectTheVirtualProduct"> <argument name="productSku" value="$$virtualProduct.sku$$"/> </actionGroup> <waitForElementVisible selector="{{AdminProductFormSection.productName}}" stepKey="waitForProductDetailsToLoad1"/> @@ -182,7 +182,7 @@ </actionGroup> <!-- Assert Bundle Product Quantity in backend after order canceled --> <comment userInput="Assert Bundle Product Quantity in backend after order canceled" stepKey="assertBundleProductQuantityAfterOrderCanceledComment"/> - <actionGroup ref="filterAndSelectProduct" stepKey="filterAndSelectTheBundleProduct"> + <actionGroup ref="FilterAndSelectProductActionGroup" stepKey="filterAndSelectTheBundleProduct"> <argument name="productSku" value="$$simpleProduct1.sku$$"/> </actionGroup> <waitForElementVisible selector="{{AdminProductFormSection.productName}}" stepKey="waitForProductDetailsToLoad2"/> @@ -197,7 +197,7 @@ </actionGroup> <!-- Assert Configurable Product Quantity in backend after order canceled --> <comment userInput="Assert Configurable Product quantity in backend after order canceled" stepKey="assertConfigurableProductQuantityAfterOrderCanceledComment"/> - <actionGroup ref="filterAndSelectProduct" stepKey="filterAndSelectTheConfigProduct"> + <actionGroup ref="FilterAndSelectProductActionGroup" stepKey="filterAndSelectTheConfigProduct"> <argument name="productSku" value="$$createConfigChildProduct1.sku$$"/> </actionGroup> <waitForElementVisible selector="{{AdminProductFormSection.productName}}" stepKey="waitForProductDetailsToLoad3"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithProductQtyWithoutStockDecreaseTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithProductQtyWithoutStockDecreaseTest.xml index 4300f22c3fb3a..28aa3fab7b9a7 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithProductQtyWithoutStockDecreaseTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithProductQtyWithoutStockDecreaseTest.xml @@ -67,7 +67,7 @@ <grabTextFrom selector="|Order # (\d+)|" stepKey="orderId"/> <!-- Assert Simple Product Quantity in backend after order --> - <actionGroup ref="filterAndSelectProduct" stepKey="filterAndSelectTheProduct"> + <actionGroup ref="FilterAndSelectProductActionGroup" stepKey="filterAndSelectTheProduct"> <argument name="productSku" value="$$simpleProduct.sku$$"/> </actionGroup> <waitForElementVisible selector="{{AdminProductFormSection.productName}}" stepKey="waitForProductDetailsToLoad"/> @@ -89,7 +89,7 @@ <actionGroup ref="cancelPendingOrder" stepKey="cancelPendingOrder"/> <!-- Assert Simple Product Quantity in backend after Cancelling the order --> - <actionGroup ref="filterAndSelectProduct" stepKey="filterAndSelectTheProduct1"> + <actionGroup ref="FilterAndSelectProductActionGroup" stepKey="filterAndSelectTheProduct1"> <argument name="productSku" value="$$simpleProduct.sku$$"/> </actionGroup> <waitForElementVisible selector="{{AdminProductFormSection.productName}}" stepKey="waitForProductDetailsToLoad1"/> @@ -114,7 +114,7 @@ <click selector="{{AdminOrderFormActionSection.SubmitOrder}}" stepKey="submitOrder1"/> <!-- Assert Simple Product Quantity in backend after Reorder --> - <actionGroup ref="filterAndSelectProduct" stepKey="filterAndSelectTheProduct2"> + <actionGroup ref="FilterAndSelectProductActionGroup" stepKey="filterAndSelectTheProduct2"> <argument name="productSku" value="$$simpleProduct.sku$$"/> </actionGroup> <waitForElementVisible selector="{{AdminProductFormSection.productName}}" stepKey="waitForProductDetailsToLoad2"/> @@ -122,4 +122,4 @@ <seeInField selector="{{AdminProductFormSection.productQuantity}}" userInput="10" stepKey="seeProductQuantityAfterReorder"/> <seeInField selector="{{AdminProductFormSection.productStockStatus}}" userInput="In Stock" stepKey="seeProductStockStatusAfterReorder"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCorrectnessInvoicedItemInBundleProductTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCorrectnessInvoicedItemInBundleProductTest.xml index 4310d412d1c98..75f3640b16405 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCorrectnessInvoicedItemInBundleProductTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCorrectnessInvoicedItemInBundleProductTest.xml @@ -53,7 +53,7 @@ <!--Complete Bundle product creation--> <amOnPage url="{{AdminProductEditPage.url($$createBundleProduct.id$$)}}" stepKey="goToProductEditPage"/> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!--Run re-index task--> <magentoCLI command="indexer:reindex" stepKey="reindex"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml index a90fe5c49f032..b0868a408498f 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml @@ -84,7 +84,7 @@ <see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="Processing" stepKey="seeOrderStatus"/> <amOnPage url="{{AdminInvoicesPage.url}}" stepKey="goToInvoices"/> <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask6" /> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetGridInitial"/> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetGridInitial"/> <click selector="{{AdminInvoicesGridSection.filter}}" stepKey="clickFilters"/> <fillField selector="{{AdminInvoicesFiltersSection.orderNum}}" userInput="{$grabOrderNumber}" stepKey="searchOrderNum2"/> <click selector="{{AdminInvoicesFiltersSection.applyFilters}}" stepKey="clickApplyFilters"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminProductInTheShoppingCartCouldBeReachedByAdminDuringOrderCreationWithMultiWebsiteConfigTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminProductInTheShoppingCartCouldBeReachedByAdminDuringOrderCreationWithMultiWebsiteConfigTest.xml index b40e9d041a10e..2b7b8bac2038b 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminProductInTheShoppingCartCouldBeReachedByAdminDuringOrderCreationWithMultiWebsiteConfigTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminProductInTheShoppingCartCouldBeReachedByAdminDuringOrderCreationWithMultiWebsiteConfigTest.xml @@ -37,10 +37,10 @@ <argument name="StoreGroup" value="customStoreGroup"/> <argument name="customStore" value="customStore"/> </actionGroup> - <actionGroup ref="goToProductPageViaID" stepKey="goToProductEditPage"> + <actionGroup ref="GoToProductPageViaIDActionGroup" stepKey="goToProductEditPage"> <argument name="productId" value="$$createProduct.id$$"/> </actionGroup> - <actionGroup ref="ProductSetWebsite" stepKey="assignProductToSecondWebsite"> + <actionGroup ref="ProductSetWebsiteActionGroup" stepKey="assignProductToSecondWebsite"> <argument name="website" value="{{customWebsite.name}}"/> </actionGroup> </before> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/StorefrontPrintOrderGuestTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/StorefrontPrintOrderGuestTest.xml index 0bd8ab4855e97..aa506ead65974 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/StorefrontPrintOrderGuestTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/StorefrontPrintOrderGuestTest.xml @@ -36,7 +36,7 @@ </createData> <!-- Check Links can be purchased separately for Downloadable Product --> - <actionGroup ref="navigateToCreatedProductEditPage" stepKey="goToDownloadableProduct"> + <actionGroup ref="NavigateToCreatedProductEditPageActionGroup" stepKey="goToDownloadableProduct"> <argument name="product" value="$$downloadableProduct$$"/> </actionGroup> <waitForPageLoad stepKey="waitForPageLoad"/> @@ -112,7 +112,7 @@ </createData> <!-- Grab attribute name for Configurable Product --> - <actionGroup ref="navigateToCreatedProductEditPage" stepKey="goToConfigurableProduct"> + <actionGroup ref="NavigateToCreatedProductEditPageActionGroup" stepKey="goToConfigurableProduct"> <argument name="product" value="$$createConfigProduct$$"/> </actionGroup> <grabTextFrom selector="{{AdminConfigurableProductFormSection.currentAttribute}}" stepKey="grabAttribute"/> @@ -145,7 +145,7 @@ </createData> <!-- Grab bundle option name for Bundle Product --> - <actionGroup ref="navigateToCreatedProductEditPage" stepKey="goToBundleProduct"> + <actionGroup ref="NavigateToCreatedProductEditPageActionGroup" stepKey="goToBundleProduct"> <argument name="product" value="$$createBundleProduct$$"/> </actionGroup> <grabTextFrom selector="{{AdminProductFormBundleSection.currentBundleOption}}" stepKey="grabBundleOption"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCartRulesAppliedForProductInCartTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCartRulesAppliedForProductInCartTest.xml index ab085dc5ae137..675a5857f3959 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCartRulesAppliedForProductInCartTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCartRulesAppliedForProductInCartTest.xml @@ -36,7 +36,7 @@ <deleteData createDataKey="defaultCategory" stepKey="deleteCategory"/> <deleteData createDataKey="simpleProduct" stepKey="deleteSimpleProduct"/> - <actionGroup ref="deleteProductBySku" stepKey="deleteBundleProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteBundleProduct"> <argument name="sku" value="{{BundleProduct.sku}}"/> </actionGroup> <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFilters"/> @@ -52,10 +52,10 @@ <!--Start creating a bundle product--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductList"/> <waitForPageLoad stepKey="waitForProductList"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct"> <argument name="product" value="BundleProduct"/> </actionGroup> - <actionGroup ref="fillProductNameAndSkuInProductForm" stepKey="fillNameAndSku"> + <actionGroup ref="FillProductNameAndSkuInProductFormActionGroup" stepKey="fillNameAndSku"> <argument name="product" value="BundleProduct"/> </actionGroup> <pressKey selector="{{AdminProductFormSection.productSku}}" parameterArray="[\Facebook\WebDriver\WebDriverKeys::ENTER]" stepKey="enter"/> @@ -83,7 +83,7 @@ </actionGroup> <selectOption selector="{{AdminProductFormBundleSection.bundlePriceType}}" userInput="Fixed" stepKey="selectPriceType"/> <fillField selector="{{AdminProductFormBundleSection.bundlePriceValue}}" userInput="200" stepKey="fillPriceValue"/> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!--Create cart price rule--> <actionGroup ref="AdminCreateCartPriceRuleWithConditions" stepKey="createRule"> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateBuyXGetYFreeTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateBuyXGetYFreeTest.xml index 02078ff15ecc2..625e174ae9c8e 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateBuyXGetYFreeTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateBuyXGetYFreeTest.xml @@ -50,7 +50,7 @@ <see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/> <!-- Create a product to check the storefront --> - <actionGroup ref="FillAdminSimpleProductForm" stepKey="fillProductFieldsInAdmin"> + <actionGroup ref="FillAdminSimpleProductFormActionGroup" stepKey="fillProductFieldsInAdmin"> <argument name="category" value="$$createPreReqCategory$$"/> <argument name="simpleProduct" value="_defaultProduct"/> </actionGroup> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionAndFreeShippingIsAppliedTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionAndFreeShippingIsAppliedTest.xml index b51027d51fd53..d2efdfb6ec084 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionAndFreeShippingIsAppliedTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionAndFreeShippingIsAppliedTest.xml @@ -74,7 +74,7 @@ <seeInField selector="{{AdminCartPriceRulesFormSection.defaultStoreView}}" userInput="{{CartPriceRuleConditionAndFreeShippingApplied.defaultStoreView}}" stepKey="seeDefaultStoreView"/> <!--Go to storefront page and verify created product--> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProductPageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProductPageAndVerifyProduct"> <argument name="product" value="$$initialSimpleProduct$$"/> </actionGroup> <!--Click on Add To Cart button--> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionIsNotAppliedTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionIsNotAppliedTest.xml index 8969e9d9d4ceb..dcd813bb30b35 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionIsNotAppliedTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionIsNotAppliedTest.xml @@ -85,7 +85,7 @@ <seeInField selector="{{AdminCartPriceRulesFormSection.defaultStoreView}}" userInput="{{CartPriceRuleConditionNotApplied.defaultStoreView}}" stepKey="seeDefaultStoreView"/> <!--Go to storefront page and verify created product--> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProductPageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProductPageAndVerifyProduct"> <argument name="product" value="$$initialSimpleProduct$$"/> </actionGroup> <fillField selector="{{StorefrontProductInfoMainSection.qty}}" userInput="2" stepKey="fillProductQuantity"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForCouponCodeTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForCouponCodeTest.xml index 712475186d5bf..6242c1f3d1baf 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForCouponCodeTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForCouponCodeTest.xml @@ -67,7 +67,7 @@ <seeInField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="5" stepKey="seeDiscountAmount"/> <!-- Create a product to check the storefront --> - <actionGroup ref="FillAdminSimpleProductForm" stepKey="fillProductFieldsInAdmin"> + <actionGroup ref="FillAdminSimpleProductFormActionGroup" stepKey="fillProductFieldsInAdmin"> <argument name="category" value="$$createPreReqCategory$$"/> <argument name="simpleProduct" value="_defaultProduct"/> </actionGroup> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForGeneratedCouponTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForGeneratedCouponTest.xml index d719bb90efd59..78943a0648b51 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForGeneratedCouponTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForGeneratedCouponTest.xml @@ -69,7 +69,7 @@ <grabTextFrom selector="{{AdminCartPriceRulesFormSection.generatedCouponByIndex('1')}}" stepKey="grabCouponCode"/> <!-- Create a product to check the storefront --> - <actionGroup ref="FillAdminSimpleProductForm" stepKey="fillProductFieldsInAdmin"> + <actionGroup ref="FillAdminSimpleProductFormActionGroup" stepKey="fillProductFieldsInAdmin"> <argument name="category" value="$$createPreReqCategory$$"/> <argument name="simpleProduct" value="_defaultProduct"/> </actionGroup> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForMatchingSubtotalAndVerifyRuleConditionIsAppliedTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForMatchingSubtotalAndVerifyRuleConditionIsAppliedTest.xml index ab62e51414e85..7ecf869ec1c7e 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForMatchingSubtotalAndVerifyRuleConditionIsAppliedTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForMatchingSubtotalAndVerifyRuleConditionIsAppliedTest.xml @@ -84,7 +84,7 @@ <seeInField selector="{{AdminCartPriceRulesFormSection.defaultStoreView}}" userInput="{{CartPriceRuleConditionAppliedForSubtotal.defaultStoreView}}" stepKey="seeDefaultStoreView"/> <!--Go to storefront page and verify created product--> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProductPageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProductPageAndVerifyProduct"> <argument name="product" value="$$initialSimpleProduct$$"/> </actionGroup> <!--Click on Add To Cart button--> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingCategoryAndVerifyRuleConditionIsAppliedTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingCategoryAndVerifyRuleConditionIsAppliedTest.xml index 00f104885e0f0..eeccdef78c554 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingCategoryAndVerifyRuleConditionIsAppliedTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingCategoryAndVerifyRuleConditionIsAppliedTest.xml @@ -21,14 +21,14 @@ <before> <actionGroup ref = "LoginAsAdmin" stepKey="loginAsAdmin"/> <createData entity="_defaultCategory" stepKey="createCategory"/> - <actionGroup ref="FillAdminSimpleProductForm" stepKey="fillProductFieldsInAdmin"> + <actionGroup ref="FillAdminSimpleProductFormActionGroup" stepKey="fillProductFieldsInAdmin"> <argument name="category" value="$$createCategory$$"/> <argument name="simpleProduct" value="_defaultProduct"/> </actionGroup> </before> <after> <deleteData createDataKey="createCategory" stepKey="deletePreReqCategory"/> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteSimpleProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteSimpleProduct"> <argument name="product" value="_defaultProduct"/> </actionGroup> <actionGroup ref="DeleteCartPriceRuleByName" stepKey="deleteCreatedCartPriceRule"> @@ -94,7 +94,7 @@ <!--Go to storefront page and verify created product--> <amOnPage url="{{StorefrontProductPage.url(_defaultProduct.urlKey)}}" stepKey="onCategoryPage"/> <waitForPageLoad stepKey="waitForCategoryPageLoad"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="openProductPageAndVerifyProduct"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="openProductPageAndVerifyProduct"> <argument name="productName" value="_defaultProduct.name"/> </actionGroup> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingTotalWeightAndVerifyRuleConditionIsAppliedTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingTotalWeightAndVerifyRuleConditionIsAppliedTest.xml index 43b92ee938978..9157de478efec 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingTotalWeightAndVerifyRuleConditionIsAppliedTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingTotalWeightAndVerifyRuleConditionIsAppliedTest.xml @@ -81,7 +81,7 @@ <seeInField selector="{{AdminCartPriceRulesFormSection.defaultStoreView}}" userInput="{{CartPriceRuleConditionAppliedForWeight.defaultStoreView}}" stepKey="seeDefaultStoreView"/> <!--Go to storefront page and verify created product--> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProductPageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProductPageAndVerifyProduct"> <argument name="product" value="$$initialSimpleProduct$$"/> </actionGroup> <!--Click on Add To Cart button--> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateFixedAmountDiscountTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateFixedAmountDiscountTest.xml index 1681d910ccdb0..44c89d022edb3 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateFixedAmountDiscountTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateFixedAmountDiscountTest.xml @@ -49,7 +49,7 @@ <see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/> <!-- Create a product to check the storefront --> - <actionGroup ref="FillAdminSimpleProductForm" stepKey="fillProductFieldsInAdmin"> + <actionGroup ref="FillAdminSimpleProductFormActionGroup" stepKey="fillProductFieldsInAdmin"> <argument name="category" value="$$createPreReqCategory$$"/> <argument name="simpleProduct" value="_defaultProduct"/> </actionGroup> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateFixedAmountWholeCartDiscountTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateFixedAmountWholeCartDiscountTest.xml index 69918bda8c426..b92efd6f83651 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateFixedAmountWholeCartDiscountTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateFixedAmountWholeCartDiscountTest.xml @@ -49,7 +49,7 @@ <see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/> <!-- Create a product to check the storefront --> - <actionGroup ref="FillAdminSimpleProductForm" stepKey="fillProductFieldsInAdmin"> + <actionGroup ref="FillAdminSimpleProductFormActionGroup" stepKey="fillProductFieldsInAdmin"> <argument name="category" value="$$createPreReqCategory$$"/> <argument name="simpleProduct" value="_defaultProduct"/> </actionGroup> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreatePercentOfProductPriceTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreatePercentOfProductPriceTest.xml index 898e5a07304b6..5fd7c7241130f 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreatePercentOfProductPriceTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreatePercentOfProductPriceTest.xml @@ -49,7 +49,7 @@ <see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/> <!-- Create a product to check the storefront --> - <actionGroup ref="FillAdminSimpleProductForm" stepKey="fillProductFieldsInAdmin"> + <actionGroup ref="FillAdminSimpleProductFormActionGroup" stepKey="fillProductFieldsInAdmin"> <argument name="category" value="$$createPreReqCategory$$"/> <argument name="simpleProduct" value="_defaultProduct"/> </actionGroup> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteInactiveSalesRuleAndVerifyDeleteMessageTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteInactiveSalesRuleAndVerifyDeleteMessageTest.xml index 1570bfbdb7a23..39a5d0f6a7131 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteInactiveSalesRuleAndVerifyDeleteMessageTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteInactiveSalesRuleAndVerifyDeleteMessageTest.xml @@ -44,7 +44,7 @@ </actionGroup> <!--Verify customer don't see updated virtual product link on category page --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProductPageAndVerifyProduct"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProductPageAndVerifyProduct"> <argument name="product" value="$$initialSimpleProduct$$"/> </actionGroup> @@ -62,4 +62,4 @@ <argument name="qty" value="1"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCategoryRulesShouldApplyToComplexProductsTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCategoryRulesShouldApplyToComplexProductsTest.xml index d8c5b42dbaaaf..a14ccc2ad879f 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCategoryRulesShouldApplyToComplexProductsTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCategoryRulesShouldApplyToComplexProductsTest.xml @@ -31,28 +31,28 @@ </actionGroup> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <!-- Assign config1 and the associated child products to CAT1 --> - <actionGroup ref="AdminAssignProductToCategory" stepKey="assignConfigurableProduct1ToCategory"> + <actionGroup ref="AdminAssignProductToCategoryActionGroup" stepKey="assignConfigurableProduct1ToCategory"> <argument name="productId" value="$$createConfigProductCreateConfigurableProduct1.id$$"/> <argument name="categoryName" value="$$createCategory.name$$"/> </actionGroup> - <actionGroup ref="AdminAssignProductToCategory" stepKey="assignConfig1ChildProduct1ToCategory"> + <actionGroup ref="AdminAssignProductToCategoryActionGroup" stepKey="assignConfig1ChildProduct1ToCategory"> <argument name="productId" value="$$createConfigChildProduct1CreateConfigurableProduct1.id$$"/> <argument name="categoryName" value="$$createCategory.name$$"/> </actionGroup> - <actionGroup ref="AdminAssignProductToCategory" stepKey="assignConfig1ChildProduct2ToCategory"> + <actionGroup ref="AdminAssignProductToCategoryActionGroup" stepKey="assignConfig1ChildProduct2ToCategory"> <argument name="productId" value="$$createConfigChildProduct2CreateConfigurableProduct1.id$$"/> <argument name="categoryName" value="$$createCategory.name$$"/> </actionGroup> <!-- Assign config12 and the associated child products to CAT2 --> - <actionGroup ref="AdminAssignProductToCategory" stepKey="assignConfigurableProduct2ToCategory2"> + <actionGroup ref="AdminAssignProductToCategoryActionGroup" stepKey="assignConfigurableProduct2ToCategory2"> <argument name="productId" value="$$createConfigProductCreateConfigurableProduct2.id$$"/> <argument name="categoryName" value="$$createCategory2.name$$"/> </actionGroup> - <actionGroup ref="AdminAssignProductToCategory" stepKey="assignConfig2ChildProduct1ToCategory2"> + <actionGroup ref="AdminAssignProductToCategoryActionGroup" stepKey="assignConfig2ChildProduct1ToCategory2"> <argument name="productId" value="$$createConfigChildProduct1CreateConfigurableProduct2.id$$"/> <argument name="categoryName" value="$$createCategory2.name$$"/> </actionGroup> - <actionGroup ref="AdminAssignProductToCategory" stepKey="assignConfig2ChildProduct2ToCategory2"> + <actionGroup ref="AdminAssignProductToCategoryActionGroup" stepKey="assignConfig2ChildProduct2ToCategory2"> <argument name="productId" value="$$createConfigChildProduct2CreateConfigurableProduct2.id$$"/> <argument name="categoryName" value="$$createCategory2.name$$"/> </actionGroup> diff --git a/app/code/Magento/Search/Test/Mftf/Test/AdminGlobalSearchOnProductPageTest.xml b/app/code/Magento/Search/Test/Mftf/Test/AdminGlobalSearchOnProductPageTest.xml index 45a5f53c3e448..725f45c0bc6e3 100644 --- a/app/code/Magento/Search/Test/Mftf/Test/AdminGlobalSearchOnProductPageTest.xml +++ b/app/code/Magento/Search/Test/Mftf/Test/AdminGlobalSearchOnProductPageTest.xml @@ -24,12 +24,12 @@ </before> <after> <!-- Delete product --> - <actionGroup ref="deleteProductBySku" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteProduct"> <argument name="sku" value="{{SimpleProduct.sku}}"/> </actionGroup> <!-- Delete category --> - <actionGroup ref="DeleteCategory" stepKey="deleteCreatedNewRootCategory"> + <actionGroup ref="DeleteCategoryActionGroup" stepKey="deleteCreatedNewRootCategory"> <argument name="categoryEntity" value="_defaultCategory"/> </actionGroup> @@ -40,20 +40,20 @@ <!-- Create Simple Product --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="adminProductIndexPageAdd"/> <waitForPageLoad stepKey="waitForProductIndexPageLoad"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProductPage"> <argument name="product" value="SimpleProduct"/> </actionGroup> - <actionGroup ref="fillMainProductForm" stepKey="fillProductForm"> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillProductForm"> <argument name="product" value="SimpleProduct"/> </actionGroup> <!-- Create new category for product --> - <actionGroup ref="FillNewProductCategory" stepKey="FillNewProductCategory"> + <actionGroup ref="FillNewProductCategoryActionGroup" stepKey="FillNewProductCategory"> <argument name="categoryName" value="{{_defaultCategory.name}}"/> </actionGroup> <!-- Save product form --> - <actionGroup ref="saveProductForm" stepKey="saveProductForm"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductForm"/> <!-- Click on the magnifying glass to start searching --> <click selector="{{AdminGlobalSearchSection.globalSearch}}" stepKey="clickSearchBtn"/> diff --git a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductDescriptionTest.xml b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductDescriptionTest.xml index c5124ac9c74a1..9e5001591bb91 100644 --- a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductDescriptionTest.xml +++ b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductDescriptionTest.xml @@ -28,7 +28,7 @@ <!-- Delete all search terms --> <comment userInput="Delete all search terms" stepKey="deleteAllSearchTermsComment"/> <actionGroup ref="DeleteAllSearchTerms" stepKey="deleteAllSearchTerms"/> - <actionGroup ref="deleteAllProductsUsingProductGrid" stepKey="deleteAllProducts"/> + <actionGroup ref="DeleteAllProductsUsingProductGridActionGroup" stepKey="deleteAllProducts"/> <!-- Create product with description --> <comment userInput="Create product with description" stepKey="createProductWithDescriptionComment"/> <createData entity="SimpleProductWithDescription" stepKey="simpleProduct"/> diff --git a/app/code/Magento/Shipping/Test/Mftf/Test/AdminCreateOrderCustomStoreShippingMethodTableRatesTest.xml b/app/code/Magento/Shipping/Test/Mftf/Test/AdminCreateOrderCustomStoreShippingMethodTableRatesTest.xml index b2e3e2516a5c3..9602bfdde5e75 100644 --- a/app/code/Magento/Shipping/Test/Mftf/Test/AdminCreateOrderCustomStoreShippingMethodTableRatesTest.xml +++ b/app/code/Magento/Shipping/Test/Mftf/Test/AdminCreateOrderCustomStoreShippingMethodTableRatesTest.xml @@ -78,13 +78,13 @@ <!--Assign product to custom website--> <amOnPage url="{{AdminProductEditPage.url($$createProduct.id$$)}}" stepKey="goToProductEditPage"/> <waitForPageLoad stepKey="waitForProductPageLoad"/> - <actionGroup ref="unassignWebsiteFromProductActionGroup" stepKey="unassignWebsiteInProduct"> + <actionGroup ref="UnassignWebsiteFromProductActionGroup" stepKey="unassignWebsiteInProduct"> <argument name="website" value="{{_defaultWebsite.name}}"/> </actionGroup> <actionGroup ref="SelectProductInWebsitesActionGroup" stepKey="selectWebsiteInProduct"> <argument name="website" value="{{customWebsite.name}}"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!--Create order--> <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderWithExistingCustomer"> <argument name="customer" value="$$createCustomer$$"/> diff --git a/app/code/Magento/Shipping/Test/Mftf/Test/StorefrontDisplayTableRatesShippingMethodForAETest.xml b/app/code/Magento/Shipping/Test/Mftf/Test/StorefrontDisplayTableRatesShippingMethodForAETest.xml index bb29a4a28bcf6..81fe492ffc005 100644 --- a/app/code/Magento/Shipping/Test/Mftf/Test/StorefrontDisplayTableRatesShippingMethodForAETest.xml +++ b/app/code/Magento/Shipping/Test/Mftf/Test/StorefrontDisplayTableRatesShippingMethodForAETest.xml @@ -54,7 +54,7 @@ <argument name="Customer" value="$$createCustomer$$"/> </actionGroup> <!--Add the created product to the shopping cart--> - <actionGroup ref="AddSimpleProductToCart" stepKey="addProductToCart"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToCart"> <argument name="product" value="$$createProduct$$"/> </actionGroup> <!--Proceed to Checkout from the mini cart--> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateImageSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateImageSwatchTest.xml index 0e294153e881e..aac765b4926af 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateImageSwatchTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateImageSwatchTest.xml @@ -98,10 +98,10 @@ <!-- Create a configurable product to verify the storefront with --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> <waitForPageLoad time="30" stepKey="waitForProductGrid"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateConfigurableProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateConfigurableProduct"> <argument name="product" value="BaseConfigurableProduct"/> </actionGroup> - <actionGroup ref="fillMainProductForm" stepKey="fillProductForm"> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillProductForm"> <argument name="product" value="BaseConfigurableProduct"/> </actionGroup> <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[$$createCategory.name$$]" stepKey="fillCategory"/> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateTextSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateTextSwatchTest.xml index 87d3f0bb5bcb9..4685670fbfdd2 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateTextSwatchTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateTextSwatchTest.xml @@ -54,12 +54,12 @@ <!-- Create a configurable product to verify the storefront with --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> <waitForPageLoad time="30" stepKey="waitForProductGrid"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateConfigurableProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateConfigurableProduct"> <argument name="product" value="BaseConfigurableProduct"/> </actionGroup> <click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/> <fillField userInput="{{_defaultProduct.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/> - <actionGroup ref="fillMainProductForm" stepKey="fillProductForm"> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillProductForm"> <argument name="product" value="BaseConfigurableProduct"/> </actionGroup> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateVisualSwatchWithNonValidOptionsTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateVisualSwatchWithNonValidOptionsTest.xml index b03f771875957..5b11cf5942cde 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateVisualSwatchWithNonValidOptionsTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateVisualSwatchWithNonValidOptionsTest.xml @@ -21,7 +21,7 @@ </before> <after> <!-- Remove attribute --> - <actionGroup ref="deleteProductAttribute" stepKey="deleteAttribute"> + <actionGroup ref="DeleteProductAttributeActionGroup" stepKey="deleteAttribute"> <argument name="ProductAttribute" value="visualSwatchAttribute"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> @@ -103,10 +103,10 @@ <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="waitForSuccessMessage"/> - <actionGroup ref="navigateToCreatedProductAttribute" stepKey="navigateToAttribute"> + <actionGroup ref="NavigateToCreatedProductAttributeActionGroup" stepKey="navigateToAttribute"> <argument name="ProductAttribute" value="visualSwatchAttribute"/> </actionGroup> <!-- Check attribute data --> <seeCheckboxIsChecked selector="{{AdminManageSwatchSection.nthIsDefault('2')}}" stepKey="CheckDefaultOption"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/AdminSaveConfigurableProductWithAttributesImagesAndSwatchesTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/AdminSaveConfigurableProductWithAttributesImagesAndSwatchesTest.xml index f94314fe94806..43205375a6330 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/AdminSaveConfigurableProductWithAttributesImagesAndSwatchesTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/AdminSaveConfigurableProductWithAttributesImagesAndSwatchesTest.xml @@ -59,7 +59,7 @@ </before> <after> <!-- Delete product attribute and clear grid filter --> - <actionGroup ref="deleteProductAttributeByAttributeCode" stepKey="deleteProductAttribute"> + <actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteProductAttribute"> <argument name="ProductAttributeCode" value="{{VisualSwatchProductAttribute.attribute_code}}"/> </actionGroup> <actionGroup ref="AdminGridFilterResetActionGroup" stepKey="clearAttributesGridFilter"/> @@ -73,19 +73,19 @@ <!-- Add created product attribute to the Default set --> <actionGroup ref="AdminOpenAttributeSetGridPageActionGroup" stepKey="openAttributeSetPage"/> <actionGroup ref="AdminOpenAttributeSetByNameActionGroup" stepKey="openDefaultAttributeSet"/> - <actionGroup ref="AssignAttributeToGroup" stepKey="assignAttributeToGroup"> + <actionGroup ref="AssignAttributeToGroupActionGroup" stepKey="assignAttributeToGroup"> <argument name="group" value="Product Details"/> <argument name="attribute" value="{{VisualSwatchProductAttribute.attribute_code}}"/> </actionGroup> - <actionGroup ref="SaveAttributeSet" stepKey="saveAttributeSet"/> + <actionGroup ref="SaveAttributeSetActionGroup" stepKey="saveAttributeSet"/> <!-- Create configurable product --> <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="openProductIndexPage"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateConfigurableProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateConfigurableProduct"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> <!-- Fill all the necessary information such as weight, name, SKU etc --> - <actionGroup ref="fillMainProductForm" stepKey="fillProductForm"> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillProductForm"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> <!-- Click "Create Configurations" button, select created product attribute using the same Quantity for all products. Click "Generate products" button --> @@ -100,10 +100,10 @@ <attachFile selector="{{AdminDataGridTableSection.rowTemplate({$attributeCodeAdobeSmall})}}{{AdminProductFormConfigurationsSection.fileUploaderInput}}" userInput="{{TestImageAdobe.file}}" stepKey="uploadImageForSecondProduct"/> <!-- Click "Save" button --> - <actionGroup ref="saveProductForm" stepKey="clickSaveButton"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="clickSaveButton"/> <!-- Delete all created product --> - <actionGroup ref="deleteProductBySku" stepKey="deleteCreatedProducts"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteCreatedProducts"> <argument name="sku" value="{{ApiConfigurableProduct.sku}}"/> </actionGroup> </test> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontConfigurableProductSwatchMinimumPriceTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontConfigurableProductSwatchMinimumPriceTest.xml index 0a98e7a721c17..af3e2f49c9e79 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontConfigurableProductSwatchMinimumPriceTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontConfigurableProductSwatchMinimumPriceTest.xml @@ -26,17 +26,17 @@ </before> <after> <!-- Delete configurable product and all child products --> - <actionGroup ref="deleteProductsByKeyword" stepKey="deleteProductsByKeyword"> + <actionGroup ref="DeleteProductsByKeywordActionGroup" stepKey="deleteProductsByKeyword"> <argument name="keyword" value="{{_defaultProduct.sku}}"/> </actionGroup> <!-- Delete category --> <deleteData createDataKey="createCategory" stepKey="deleteCategoryAttribute"/> <!-- Delete color attribute --> - <actionGroup ref="deleteProductAttribute" stepKey="deleteColorAttribute"> + <actionGroup ref="DeleteProductAttributeActionGroup" stepKey="deleteColorAttribute"> <argument name="ProductAttribute" value="ProductColorAttribute"/> </actionGroup> <!-- Delete size attribute --> - <actionGroup ref="deleteProductAttribute" stepKey="deleteSizeAttribute"> + <actionGroup ref="DeleteProductAttributeActionGroup" stepKey="deleteSizeAttribute"> <argument name="ProductAttribute" value="ProductSizeAttribute"/> </actionGroup> <!-- Logout --> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontDisplayAllCharactersOnTextSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontDisplayAllCharactersOnTextSwatchTest.xml index 1bcdd6fcf9a3a..0999b43c48820 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontDisplayAllCharactersOnTextSwatchTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontDisplayAllCharactersOnTextSwatchTest.xml @@ -63,7 +63,7 @@ <click selector="{{StorefrontCategorySidebarSection.attributeNthOption(ProductAttributeFrontendLabel.label, '4')}}" stepKey="filterBySwatch4"/> <!-- Deletes the created configurable product--> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteConfigurableProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteConfigurableProduct"> <argument name="product" value="BaseConfigurableProduct"/> </actionGroup> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml index c9602ddcd127c..b23e94ae41d6b 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml @@ -81,18 +81,18 @@ <!-- Create a configurable product to verify the storefront with --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> <waitForPageLoad time="30" stepKey="waitForProductGrid"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateConfigurableProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateConfigurableProduct"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> <!-- Add image to configurable product --> - <actionGroup ref="addProductImage" stepKey="addFirstImageForProductConfigurable"> + <actionGroup ref="AddProductImageActionGroup" stepKey="addFirstImageForProductConfigurable"> <argument name="image" value="MagentoLogo"/> </actionGroup> <!-- Add image to configurable product --> - <actionGroup ref="addProductImage" stepKey="addSecondImageForProductConfigurable"> + <actionGroup ref="AddProductImageActionGroup" stepKey="addSecondImageForProductConfigurable"> <argument name="image" value="TestImageNew"/> </actionGroup> - <actionGroup ref="fillMainProductForm" stepKey="fillProductForm"> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillProductForm"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[$$createCategory.name$$]" stepKey="fillCategory"/> @@ -130,18 +130,18 @@ <dontSee selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" userInput="$$createSimpleProduct.name$$" stepKey="dontSeeSimpleProduct"/> <!-- Assert configurable product in storefront product page --> - <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> + <actionGroup ref="AssertProductInStorefrontProductPageActionGroup" stepKey="AssertProductInStorefrontProductPage"> <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> <!-- Assert configurable product image in storefront product page --> - <actionGroup ref="assertProductImageStorefrontProductPage" stepKey="assertProductImageStorefrontProductPage"> + <actionGroup ref="AssertProductImageStorefrontProductPageActionGroup" stepKey="assertProductImageStorefrontProductPage"> <argument name="product" value="ApiConfigurableProduct"/> <argument name="image" value="MagentoLogo"/> </actionGroup> <!-- Assert configurable product image in storefront product page --> - <actionGroup ref="assertProductImageStorefrontProductPage" stepKey="assertProductSecondImageStorefrontProductPage"> + <actionGroup ref="AssertProductImageStorefrontProductPageActionGroup" stepKey="assertProductSecondImageStorefrontProductPage"> <argument name="product" value="ApiConfigurableProduct"/> <argument name="image" value="TestImageNew"/> </actionGroup> @@ -150,7 +150,7 @@ <click selector="{{StorefrontProductInfoMainSection.swatchOptionByLabel('adobe-thumb')}}" stepKey="clickSwatchOption"/> <!-- Assert swatch option image for configurable product image in storefront product page --> - <actionGroup ref="assertProductImageStorefrontProductPage" stepKey="assertSwatchImageStorefrontProductPage"> + <actionGroup ref="AssertProductImageStorefrontProductPageActionGroup" stepKey="assertSwatchImageStorefrontProductPage"> <argument name="product" value="ApiConfigurableProduct"/> <argument name="image" value="TestImageAdobe"/> </actionGroup> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByTextSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByTextSwatchTest.xml index 7bf63d25417e3..c065cb450d3e3 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByTextSwatchTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByTextSwatchTest.xml @@ -69,10 +69,10 @@ <!-- Create a configurable product to verify the storefront with --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> <waitForPageLoad stepKey="waitForProductGrid"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateConfigurableProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateConfigurableProduct"> <argument name="product" value="BaseConfigurableProduct"/> </actionGroup> - <actionGroup ref="fillMainProductForm" stepKey="fillProductForm"> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillProductForm"> <argument name="product" value="BaseConfigurableProduct"/> </actionGroup> <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[$$createCategory.name$$]" stepKey="fillCategory"/> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByVisualSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByVisualSwatchTest.xml index fd38c48919416..de12e326ebcef 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByVisualSwatchTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByVisualSwatchTest.xml @@ -81,10 +81,10 @@ <!-- Create a configurable product to verify the storefront with --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> <waitForPageLoad time="30" stepKey="waitForProductGrid"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateConfigurableProduct"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateConfigurableProduct"> <argument name="product" value="BaseConfigurableProduct"/> </actionGroup> - <actionGroup ref="fillMainProductForm" stepKey="fillProductForm"> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillProductForm"> <argument name="product" value="BaseConfigurableProduct"/> </actionGroup> <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[$$createCategory.name$$]" stepKey="fillCategory"/> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontImageColorWhenFilterByColorFilterTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontImageColorWhenFilterByColorFilterTest.xml index 2928011662864..64283accb9c13 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontImageColorWhenFilterByColorFilterTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontImageColorWhenFilterByColorFilterTest.xml @@ -30,7 +30,7 @@ <after> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> - <actionGroup ref="deleteProductAttributeByLabel" stepKey="deleteAttribute"> + <actionGroup ref="DeleteProductAttributeByLabelActionGroup" stepKey="deleteAttribute"> <argument name="ProductAttribute" value="visualSwatchAttribute"/> </actionGroup> <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="openProductIndexPage"/> @@ -38,7 +38,7 @@ <actionGroup ref="adminDataGridSelectPerPage" stepKey="selectNumberOfProductsPerPage"> <argument name="perPage" value="100"/> </actionGroup> - <actionGroup ref="deleteProductsIfTheyExist" stepKey="deleteAllProducts"/> + <actionGroup ref="DeleteProductsIfTheyExistActionGroup" stepKey="deleteAllProducts"/> <actionGroup ref="logout" stepKey="logout"/> </after> <amOnPage url="{{AdminProductEditPage.url($$createConfigProduct.id$$)}}" stepKey="navigateToConfigProductPage"/> @@ -66,7 +66,7 @@ </actionGroup> <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton"/> <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnGenerateProductsButton"/> - <actionGroup ref="saveProductForm" stepKey="saveProductForm"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductForm"/> <!-- Perform reindex and flush cache --> <magentoCLI command="indexer:reindex" stepKey="reindex"/> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSeeProductImagesMatchingProductSwatchesTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSeeProductImagesMatchingProductSwatchesTest.xml index 1717b424e4597..34f95d7f2284b 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSeeProductImagesMatchingProductSwatchesTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSeeProductImagesMatchingProductSwatchesTest.xml @@ -26,11 +26,11 @@ <after> <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> - <actionGroup ref="deleteProductAttribute" stepKey="deleteAttribute"> + <actionGroup ref="DeleteProductAttributeActionGroup" stepKey="deleteAttribute"> <argument name="ProductAttribute" value="VisualSwatchProductAttribute"/> </actionGroup> <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearProductAttributeGridFilter"/> - <actionGroup ref="deleteAllDuplicateProductUsingProductGrid" stepKey="deleteAllChildrenProducts"> + <actionGroup ref="DeleteAllDuplicateProductUsingProductGridActionGroup" stepKey="deleteAllChildrenProducts"> <argument name="product" value="$$createSimpleProduct$$"/> </actionGroup> <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearProductGridFilter"/> @@ -63,15 +63,15 @@ </actionGroup> <!-- Edit configurable product --> - <actionGroup ref="goToProductPageViaID" stepKey="openProductEditPage"> + <actionGroup ref="GoToProductPageViaIDActionGroup" stepKey="openProductEditPage"> <argument name="productId" value="$$createSimpleProduct.id$$"/> </actionGroup> <!-- Add images to configurable product --> - <actionGroup ref="addProductImage" stepKey="addFirstImageForProductConfigurable"> + <actionGroup ref="AddProductImageActionGroup" stepKey="addFirstImageForProductConfigurable"> <argument name="image" value="MagentoLogo"/> </actionGroup> - <actionGroup ref="addProductImage" stepKey="addSecondImageForProductConfigurable"> + <actionGroup ref="AddProductImageActionGroup" stepKey="addSecondImageForProductConfigurable"> <argument name="image" value="TestImageNew"/> </actionGroup> @@ -97,15 +97,15 @@ <!-- Go to the category page --> <amOnPage url="{{StorefrontProductPage.url($$createSimpleProduct.custom_attributes[url_key]$$)}}" stepKey="goToProductPage"/> - <actionGroup ref="StorefrontAssertActiveProductImage" stepKey="StorefrontAssertActiveProductImage"/> + <actionGroup ref="StorefrontAssertActiveProductImageActionGroup" stepKey="StorefrontAssertActiveProductImage"/> <!--Click a swatch and expect to see the image from the swatch from the configurable product --> <actionGroup ref="StorefrontSelectSwatchOptionOnProductPageAndCheckImage" stepKey="clickSwatchOption"> <argument name="optionName" value="{{visualSwatchOption1.default_label}}"/> <argument name="fileName" value="{{TestImageAdobe.filename}}"/> </actionGroup> - <actionGroup ref="StorefrontAssertFotoramaImageAvailablity" stepKey="seeFirstImageBaseProductInSwatchOption"/> - <actionGroup ref="StorefrontAssertFotoramaImageAvailablity" stepKey="seeSecondImageBaseProductInSwatchOption"> + <actionGroup ref="StorefrontAssertFotoramaImageAvailabilityActionGroup" stepKey="seeFirstImageBaseProductInSwatchOption"/> + <actionGroup ref="StorefrontAssertFotoramaImageAvailabilityActionGroup" stepKey="seeSecondImageBaseProductInSwatchOption"> <argument name="fileName" value="{{TestImageNew.filename}}"/> </actionGroup> @@ -113,8 +113,8 @@ <argument name="optionName" value="{{visualSwatchOption2.default_label}}"/> <argument name="fileName" value="{{ImageUpload3.filename}}"/> </actionGroup> - <actionGroup ref="StorefrontAssertFotoramaImageAvailablity" stepKey="seeFirstImageBaseProductInSwatchOption2"/> - <actionGroup ref="StorefrontAssertFotoramaImageAvailablity" stepKey="seeSecondImageBaseProductInSwatchOption2"> + <actionGroup ref="StorefrontAssertFotoramaImageAvailabilityActionGroup" stepKey="seeFirstImageBaseProductInSwatchOption2"/> + <actionGroup ref="StorefrontAssertFotoramaImageAvailabilityActionGroup" stepKey="seeSecondImageBaseProductInSwatchOption2"> <argument name="fileName" value="{{TestImageNew.filename}}"/> </actionGroup> </test> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSwatchAttributesDisplayInWidgetCMSTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSwatchAttributesDisplayInWidgetCMSTest.xml index 323b10507fe28..119a645252685 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSwatchAttributesDisplayInWidgetCMSTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSwatchAttributesDisplayInWidgetCMSTest.xml @@ -30,13 +30,13 @@ <after> <!--delete created configurable product--> - <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct"> <argument name="product" value="BaseConfigurableProduct"/> </actionGroup> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> <waitForPageLoad stepKey="waitForAdminProductGridLoad"/> <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> - <actionGroup ref="deleteProductAttributeByLabel" stepKey="deleteAttribute"> + <actionGroup ref="DeleteProductAttributeByLabelActionGroup" stepKey="deleteAttribute"> <argument name="ProductAttribute" value="visualSwatchAttribute"/> </actionGroup> <!--delete root category--> @@ -58,10 +58,10 @@ <!--Create a configurable swatch product via the UI --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductIndex"/> <waitForPageLoad stepKey="waitForProductPage"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProductPage"> <argument name="product" value="BaseConfigurableProduct"/> </actionGroup> - <actionGroup ref="fillMainProductForm" stepKey="fillProductForm"> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillProductForm"> <argument name="product" value="BaseConfigurableProduct"/> </actionGroup> <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[$$createRootCategory.name$$]" stepKey="searchAndSelectCategory"/> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSwatchProductWithFileCustomOptionTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSwatchProductWithFileCustomOptionTest.xml index 5e712ebc38292..99b38bd3b34d6 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSwatchProductWithFileCustomOptionTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSwatchProductWithFileCustomOptionTest.xml @@ -34,19 +34,19 @@ <!-- Create a configurable swatch product via the UI --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductIndex"/> <waitForPageLoad stepKey="waitForProductPage"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProductPage"> <argument name="product" value="BaseConfigurableProduct"/> </actionGroup> - <actionGroup ref="fillMainProductForm" stepKey="fillProductForm"> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillProductForm"> <argument name="product" value="BaseConfigurableProduct"/> </actionGroup> <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[$$createCategory.name$$]" stepKey="searchAndSelectCategory"/> <!--Add swatch attribute to configurable product--> <actionGroup ref="AddVisualSwatchToProductActionGroup" stepKey="addSwatchToProduct"/> <!--Add custom option to configurable product--> - <actionGroup ref="AddProductCustomOptionFile" stepKey="addCustomOptionToProduct"/> + <actionGroup ref="AddProductCustomOptionFileActionGroup" stepKey="addCustomOptionToProduct"/> <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct"/> - + <!--Go to storefront--> <amOnPage url="" stepKey="goToHomePage"/> <waitForPageLoad stepKey="waitForHomePageLoad"/> @@ -85,7 +85,7 @@ <click selector="{{CheckoutCartProductSection.RemoveItem}}" stepKey="deleteCartItem"/> <!--Delete product--> - <actionGroup ref="deleteProductBySku" stepKey="deleteProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteProduct"> <argument name="sku" value="{{BaseConfigurableProduct.sku}}"/> </actionGroup> </test> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml index 628d189823a52..814ac1aee1603 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml @@ -72,11 +72,11 @@ <!--Open Created products. In Tax Class select new created Product Tax classes.--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductIndex"/> <waitForPageLoad stepKey="wait1"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGrid"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku"> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGrid"/> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProductGridBySku"> <argument name="product" value="$$firstProduct$$"/> </actionGroup> - <actionGroup ref="openProducForEditByClickingRowXColumnYInProductGrid" stepKey="openFirstProductForEdit"/> + <actionGroup ref="OpenProductForEditByClickingRowXColumnYInProductGridActionGroup" stepKey="openFirstProductForEdit"/> <selectOption selector="{{AdminProductFormSection.productTaxClass}}" stepKey="selectTexClassForFirstProduct" userInput="TaxClasses1"/> <!-- Save the second product --> <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveFirstProduct"/> @@ -84,11 +84,11 @@ <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="againGoToProductIndex"/> <waitForPageLoad stepKey="wait2"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetSecondProductGrid"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterSecondProductGridBySku"> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetSecondProductGrid"/> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterSecondProductGridBySku"> <argument name="product" value="$$secondProduct$$"/> </actionGroup> - <actionGroup ref="openProducForEditByClickingRowXColumnYInProductGrid" stepKey="openSecondProductForEdit"/> + <actionGroup ref="OpenProductForEditByClickingRowXColumnYInProductGridActionGroup" stepKey="openSecondProductForEdit"/> <selectOption selector="{{AdminProductFormSection.productTaxClass}}" stepKey="selectTexClassForSecondProduct" userInput="TaxClasses2"/> <!-- Save the second product --> <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveSecondProduct"/> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerPhysicalQuoteTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerPhysicalQuoteTest.xml index aa44593400a89..5032ca693ceaa 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerPhysicalQuoteTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerPhysicalQuoteTest.xml @@ -57,10 +57,10 @@ <argument name="stateForFPT" value="New York"/> <argument name="valueForFPT" value="20"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPageLoad"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetGridToDefaultKeywordSearch"/> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetGridToDefaultKeywordSearch"/> </before> <after> <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForGuestPhysicalQuoteTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForGuestPhysicalQuoteTest.xml index bce9d895e311e..7ac66498b3c6d 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForGuestPhysicalQuoteTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForGuestPhysicalQuoteTest.xml @@ -55,10 +55,10 @@ <argument name="stateForFPT" value="New York"/> <argument name="valueForFPT" value="20"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPageLoad"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetGridToDefaultKeywordSearch"/> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetGridToDefaultKeywordSearch"/> </before> <after> <deleteData createDataKey="createTaxRule" stepKey="deleteTaxRule"/> diff --git a/app/code/Magento/Theme/Test/Mftf/Test/AdminDesignConfigMediaGalleryImageUploadTest.xml b/app/code/Magento/Theme/Test/Mftf/Test/AdminDesignConfigMediaGalleryImageUploadTest.xml index f46328ac151b1..8939bf6744042 100644 --- a/app/code/Magento/Theme/Test/Mftf/Test/AdminDesignConfigMediaGalleryImageUploadTest.xml +++ b/app/code/Magento/Theme/Test/Mftf/Test/AdminDesignConfigMediaGalleryImageUploadTest.xml @@ -61,7 +61,7 @@ <waitForPageLoad stepKey="waitForPageloadSuccess2"/> <!--Delete Image: will be in both root and favicon--> <comment userInput="Delete Image" stepKey="deleteImageComment"/> - <actionGroup ref="navigateToMediaGallery" stepKey="navigateToMediaGallery"/> + <actionGroup ref="NavigateToMediaGalleryActionGroup" stepKey="navigateToMediaGallery"/> <actionGroup ref="NavigateToMediaFolderActionGroup" stepKey="navigateToFolder2"> <argument name="FolderName" value="Storage Root"/> </actionGroup> diff --git a/app/code/Magento/Translation/Test/Mftf/Test/AdminInlineTranslationOnCheckoutTest.xml b/app/code/Magento/Translation/Test/Mftf/Test/AdminInlineTranslationOnCheckoutTest.xml index 2b86a8ac07e77..08448f7735f7c 100644 --- a/app/code/Magento/Translation/Test/Mftf/Test/AdminInlineTranslationOnCheckoutTest.xml +++ b/app/code/Magento/Translation/Test/Mftf/Test/AdminInlineTranslationOnCheckoutTest.xml @@ -56,7 +56,7 @@ <argument name="Customer" value="$$createCustomer$$"/> </actionGroup> - <actionGroup ref="AddSimpleProductToCart" stepKey="addProduct"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProduct"> <argument name="product" value="$$createProduct$$"/> </actionGroup> @@ -333,7 +333,7 @@ <argument name="Customer" value="$$createCustomer2$$"/> </actionGroup> - <actionGroup ref="AddSimpleProductToCart" stepKey="addProductToCart"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToCart"> <argument name="product" value="$$createProduct$$"/> </actionGroup> <click selector="{{StorefrontMiniCartSection.show}}" stepKey="showCart"/> @@ -427,7 +427,7 @@ <argument name="Customer" value="$$createCustomer3$$"/> </actionGroup> - <actionGroup ref="AddSimpleProductToCart" stepKey="addOneProductToCart"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addOneProductToCart"> <argument name="product" value="$$createProduct$$"/> </actionGroup> diff --git a/app/code/Magento/Translation/Test/Mftf/Test/StorefrontButtonsInlineTranslationTest.xml b/app/code/Magento/Translation/Test/Mftf/Test/StorefrontButtonsInlineTranslationTest.xml index 155e174310ea9..d87d3635fa07c 100644 --- a/app/code/Magento/Translation/Test/Mftf/Test/StorefrontButtonsInlineTranslationTest.xml +++ b/app/code/Magento/Translation/Test/Mftf/Test/StorefrontButtonsInlineTranslationTest.xml @@ -45,7 +45,7 @@ </after> <!-- Add product to cart on storefront --> - <actionGroup ref="AddSimpleProductToCart" stepKey="addProductToCart"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToCart"> <argument name="product" value="$$createProduct$$"/> </actionGroup> diff --git a/app/code/Magento/Ui/Test/Mftf/Test/AdminGridFilterDeleteAndVerifyErrorMessageTest.xml b/app/code/Magento/Ui/Test/Mftf/Test/AdminGridFilterDeleteAndVerifyErrorMessageTest.xml index e2c3b157c1059..1a4b3b76eebe8 100644 --- a/app/code/Magento/Ui/Test/Mftf/Test/AdminGridFilterDeleteAndVerifyErrorMessageTest.xml +++ b/app/code/Magento/Ui/Test/Mftf/Test/AdminGridFilterDeleteAndVerifyErrorMessageTest.xml @@ -53,7 +53,7 @@ <!--Filter created simple product in grid and add category and website created in create data--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="openProductCatalogPage"/> <waitForPageLoad stepKey="waitForProductCatalogPage"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProduct"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProduct"> <argument name="product" value="$$createProduct$$"/> </actionGroup> <click selector="{{AdminProductGridFilterSection.nthRow('1')}}" stepKey="clickFirstRowOfCreatedSimpleProduct"/> @@ -78,4 +78,4 @@ <argument name="errorMessage" value="Something went wrong with processing the default view and we have restored the filter to its original state."/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminAutoUpdateURLRewriteWhenCategoryIsDeletedTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminAutoUpdateURLRewriteWhenCategoryIsDeletedTest.xml index 52d313b21f3e1..5d2bc8a923237 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminAutoUpdateURLRewriteWhenCategoryIsDeletedTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminAutoUpdateURLRewriteWhenCategoryIsDeletedTest.xml @@ -46,7 +46,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <!--Filter Product in product page and get the Product ID --> - <actionGroup ref="filterAndSelectProduct" stepKey="filterProduct"> + <actionGroup ref="FilterAndSelectProductActionGroup" stepKey="filterProduct"> <argument name="productSku" value="$$createSimpleProduct.sku$$"/> </actionGroup> <grabFromCurrentUrl stepKey="productId" regex="#\/([0-9]*)?\/$#"/> @@ -70,4 +70,4 @@ <argument name="requestPath" value="$$createCategory.name$$.html"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesCorrectlyGeneratedForMultipleStoreviewsDuringProductImportTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesCorrectlyGeneratedForMultipleStoreviewsDuringProductImportTest.xml index 121fd7c736dcc..dc26b8c97c64e 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesCorrectlyGeneratedForMultipleStoreviewsDuringProductImportTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesCorrectlyGeneratedForMultipleStoreviewsDuringProductImportTest.xml @@ -46,31 +46,31 @@ <argument name="storeViewName" value="{{customStoreNLNotUnique.name}}"/> </actionGroup> <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearStoreFilters"/> - <actionGroup ref="deleteProductByName" stepKey="deleteImportedProduct"> + <actionGroup ref="DeleteProductByNameActionGroup" stepKey="deleteImportedProduct"> <argument name="sku" value="productformagetwo68980"/> <argument name="name" value="productformagetwo68980"/> </actionGroup> <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFiltersIfSet"/> <actionGroup ref="logout" stepKey="logout"/> </after> - <actionGroup ref="switchCategoryStoreView" stepKey="switchToStoreViewEn"> + <actionGroup ref="SwitchCategoryStoreViewActionGroup" stepKey="switchToStoreViewEn"> <argument name="Store" value="customStoreENNotUnique.name"/> <argument name="CatName" value="$$createCategory.name$$"/> </actionGroup> <uncheckOption selector="{{AdminCategoryBasicFieldSection.categoryNameUseDefault}}" stepKey="uncheckUseDefaultValueENStoreView"/> <fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="category-english" stepKey="changeNameField"/> <click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="clickOnSectionHeader"/> - <actionGroup ref="ChangeSeoUrlKeyForSubCategory" stepKey="changeSeoUrlKeyENStoreView"> + <actionGroup ref="ChangeSeoUrlKeyForSubCategoryActionGroup" stepKey="changeSeoUrlKeyENStoreView"> <argument name="value" value="category-english"/> </actionGroup> - <actionGroup ref="switchCategoryStoreView" stepKey="switchToStoreViewNl"> + <actionGroup ref="SwitchCategoryStoreViewActionGroup" stepKey="switchToStoreViewNl"> <argument name="Store" value="customStoreNLNotUnique.name"/> <argument name="CatName" value="$$createCategory.name$$"/> </actionGroup> <uncheckOption selector="{{AdminCategoryBasicFieldSection.categoryNameUseDefault}}" stepKey="uncheckUseDefaultValue1"/> <fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="category-dutch" stepKey="changeNameFieldNLStoreView"/> <click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="clickOnSectionHeader2"/> - <actionGroup ref="ChangeSeoUrlKeyForSubCategory" stepKey="changeSeoUrlKeyNLStoreView"> + <actionGroup ref="ChangeSeoUrlKeyForSubCategoryActionGroup" stepKey="changeSeoUrlKeyNLStoreView"> <argument name="value" value="category-dutch"/> </actionGroup> <amOnPage url="{{AdminImportIndexPage.url}}" stepKey="navigateToSystemImport"/> @@ -170,7 +170,7 @@ <argument name="storeViewName" value="{{customStoreNLNotUnique.name}}"/> </actionGroup> <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearStoreGridFilters"/> - <actionGroup ref="deleteProductByName" stepKey="deleteImportedProduct"> + <actionGroup ref="DeleteProductByNameActionGroup" stepKey="deleteImportedProduct"> <argument name="sku" value="productformagetwo68980"/> <argument name="name" value="productformagetwo68980"/> </actionGroup> @@ -180,24 +180,24 @@ <!--Flush cache--> <magentoCLI command="cache:flush" stepKey="cleanCache2"/> </after> - <actionGroup ref="switchCategoryStoreView" stepKey="switchToStoreViewEn"> + <actionGroup ref="SwitchCategoryStoreViewActionGroup" stepKey="switchToStoreViewEn"> <argument name="Store" value="customStoreENNotUnique.name"/> <argument name="CatName" value="$$createCategory.name$$"/> </actionGroup> <uncheckOption selector="{{AdminCategoryBasicFieldSection.categoryNameUseDefault}}" stepKey="uncheckUseDefaultValueENStoreView"/> <fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="category-english" stepKey="changeNameField"/> <click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="clickOnSectionHeader"/> - <actionGroup ref="ChangeSeoUrlKeyForSubCategory" stepKey="changeSeoUrlKeyENStoreView"> + <actionGroup ref="ChangeSeoUrlKeyForSubCategoryActionGroup" stepKey="changeSeoUrlKeyENStoreView"> <argument name="value" value="category-english"/> </actionGroup> - <actionGroup ref="switchCategoryStoreView" stepKey="switchToStoreViewNl"> + <actionGroup ref="SwitchCategoryStoreViewActionGroup" stepKey="switchToStoreViewNl"> <argument name="Store" value="customStoreNLNotUnique.name"/> <argument name="CatName" value="$$createCategory.name$$"/> </actionGroup> <uncheckOption selector="{{AdminCategoryBasicFieldSection.categoryNameUseDefault}}" stepKey="uncheckUseDefaultValue1"/> <fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="category-dutch" stepKey="changeNameFieldNLStoreView"/> <click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="clickOnSectionHeader2"/> - <actionGroup ref="ChangeSeoUrlKeyForSubCategory" stepKey="changeSeoUrlKeyNLStoreView"> + <actionGroup ref="ChangeSeoUrlKeyForSubCategoryActionGroup" stepKey="changeSeoUrlKeyNLStoreView"> <argument name="value" value="category-dutch"/> </actionGroup> <amOnPage url="{{AdminImportIndexPage.url}}" stepKey="navigateToSystemImport"/> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategoryTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategoryTest.xml index 52dce4d67f698..828a661e385c9 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategoryTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategoryTest.xml @@ -45,18 +45,18 @@ </after> <!-- On the categories editing page change store view to created additional view --> - <actionGroup ref="switchCategoryStoreView" stepKey="switchStoreView"> + <actionGroup ref="SwitchCategoryStoreViewActionGroup" stepKey="switchStoreView"> <argument name="Store" value="customStore.name"/> <argument name="CatName" value="$$createFirstCategory.name$$"/> </actionGroup> <!-- Change url key for category for first category; save --> - <actionGroup ref="ChangeSeoUrlKeyForSubCategory" stepKey="changeUrlKey"> + <actionGroup ref="ChangeSeoUrlKeyForSubCategoryActionGroup" stepKey="changeUrlKey"> <argument name="value" value="{{SimpleRootSubCategory.url_key}}"/> </actionGroup> <!-- Change store view to "All store views" for first category --> - <actionGroup ref="switchCategoryToAllStoreView" stepKey="switchToAllStoreViewProduct"> + <actionGroup ref="SwitchCategoryToAllStoreViewActionGroup" stepKey="switchToAllStoreViewProduct"> <argument name="CatName" value="$$createFirstCategory.name$$"/> </actionGroup> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCategoryUrlRewriteAndAddNoRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCategoryUrlRewriteAndAddNoRedirectTest.xml index 85e9d7847d5ea..e4047ca625618 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCategoryUrlRewriteAndAddNoRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCategoryUrlRewriteAndAddNoRedirectTest.xml @@ -37,7 +37,7 @@ </actionGroup> <!-- Get Category ID --> - <actionGroup ref="OpenCategoryFromCategoryTree" stepKey="getCategoryId"> + <actionGroup ref="OpenCategoryFromCategoryTreeActionGroup" stepKey="getCategoryId"> <argument name="category" value="$$category.name$$"/> </actionGroup> <grabFromCurrentUrl stepKey="categoryId" regex="#\/([0-9]*)?\/$#"/> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCategoryUrlRewriteAndAddPermanentRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCategoryUrlRewriteAndAddPermanentRedirectTest.xml index b123bc14cb1ed..552853943db25 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCategoryUrlRewriteAndAddPermanentRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCategoryUrlRewriteAndAddPermanentRedirectTest.xml @@ -30,7 +30,7 @@ </after> <!-- Open Category Page and Get Category ID --> - <actionGroup ref="OpenCategoryFromCategoryTree" stepKey="getCategoryId"> + <actionGroup ref="OpenCategoryFromCategoryTreeActionGroup" stepKey="getCategoryId"> <argument name="category" value="$$category.name$$"/> </actionGroup> <grabFromCurrentUrl stepKey="categoryId" regex="#\/([0-9]*)?\/$#"/> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomProductUrlRewriteAndAddTemporaryRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomProductUrlRewriteAndAddTemporaryRedirectTest.xml index 711d5389b013b..2a225123a3409 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomProductUrlRewriteAndAddTemporaryRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomProductUrlRewriteAndAddTemporaryRedirectTest.xml @@ -30,7 +30,7 @@ </after> <!--Filter Product in product page and get the Product ID --> - <actionGroup ref="filterAndSelectProduct" stepKey="filterProduct"> + <actionGroup ref="FilterAndSelectProductActionGroup" stepKey="filterProduct"> <argument name="productSku" value="$$createProduct.sku$$"/> </actionGroup> <grabFromCurrentUrl stepKey="productId" regex="#\/([0-9]*)?\/$#"/> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductURLRewriteAndAddNoRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductURLRewriteAndAddNoRedirectTest.xml index f8d297c92a176..4aef4aec3deed 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductURLRewriteAndAddNoRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductURLRewriteAndAddNoRedirectTest.xml @@ -40,7 +40,7 @@ </actionGroup> <!--Filter Product in product page and get the Product ID --> - <actionGroup ref="filterAndSelectProduct" stepKey="filterProduct"> + <actionGroup ref="FilterAndSelectProductActionGroup" stepKey="filterProduct"> <argument name="productSku" value="$$createSimpleProduct.sku$$"/> </actionGroup> <grabFromCurrentUrl stepKey="productId" regex="#\/([0-9]*)?\/$#"/> @@ -59,4 +59,4 @@ <argument name="targetPath" value="catalog/product/view/id/{$productId}"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductURLRewriteWithCategoryAndAddTemporaryRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductURLRewriteWithCategoryAndAddTemporaryRedirectTest.xml index ae18ab33ba6ce..e91446f43fec0 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductURLRewriteWithCategoryAndAddTemporaryRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductURLRewriteWithCategoryAndAddTemporaryRedirectTest.xml @@ -51,7 +51,7 @@ </actionGroup> <!--Filter Product in product page and get the Product ID --> - <actionGroup ref="filterAndSelectProduct" stepKey="filterProduct"> + <actionGroup ref="FilterAndSelectProductActionGroup" stepKey="filterProduct"> <argument name="productSku" value="$$createSimpleProduct.sku$$"/> </actionGroup> <grabFromCurrentUrl stepKey="productId" regex="#\/([0-9]*)?\/$#"/> @@ -64,7 +64,7 @@ </actionGroup> <!-- Open Category Page and Get Category ID --> - <actionGroup ref="OpenCategoryFromCategoryTree" stepKey="getCategoryId"> + <actionGroup ref="OpenCategoryFromCategoryTreeActionGroup" stepKey="getCategoryId"> <argument name="category" value="$$createCategory.name$$"/> </actionGroup> <grabFromCurrentUrl stepKey="categoryId" regex="#\/([0-9]*)?\/$#"/> @@ -76,4 +76,4 @@ <argument name="targetPath" value="catalog/category/view/id/{$categoryId}"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductUrLRewriteAndAddPermanentRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductUrLRewriteAndAddPermanentRedirectTest.xml index 66c586d4fe891..82e6b269c7b30 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductUrLRewriteAndAddPermanentRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductUrLRewriteAndAddPermanentRedirectTest.xml @@ -39,7 +39,7 @@ </actionGroup> <!--Filter Product in product page and get the Product ID --> - <actionGroup ref="filterAndSelectProduct" stepKey="filterProduct"> + <actionGroup ref="FilterAndSelectProductActionGroup" stepKey="filterProduct"> <argument name="productSku" value="$$createSimpleProduct.sku$$"/> </actionGroup> <grabFromCurrentUrl stepKey="productId" regex="#\/([0-9]*)?\/$#"/> @@ -59,4 +59,4 @@ <argument name="targetPath" value="catalog/product/view/id/{$productId}"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductUrLRewriteAndAddTemporaryRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductUrLRewriteAndAddTemporaryRedirectTest.xml index 2d797a12bedf5..1133119202226 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductUrLRewriteAndAddTemporaryRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductUrLRewriteAndAddTemporaryRedirectTest.xml @@ -40,7 +40,7 @@ </actionGroup> <!--Filter Product in product page and get the Product ID --> - <actionGroup ref="filterAndSelectProduct" stepKey="filterProduct"> + <actionGroup ref="FilterAndSelectProductActionGroup" stepKey="filterProduct"> <argument name="productSku" value="$$createSimpleProduct.sku$$"/> </actionGroup> <grabFromCurrentUrl stepKey="productId" regex="#\/([0-9]*)?\/$#"/> @@ -59,4 +59,4 @@ <argument name="targetPath" value="catalog/product/view/id/{$productId}"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductWithSeveralWebsitesAndCheckURLRewritesTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductWithSeveralWebsitesAndCheckURLRewritesTest.xml index 4dc5c85830076..1dafe371f0d2a 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductWithSeveralWebsitesAndCheckURLRewritesTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductWithSeveralWebsitesAndCheckURLRewritesTest.xml @@ -65,7 +65,7 @@ <!-- Create simple product with categories created in create data --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="openProductCatalogPage"/> <waitForPageLoad stepKey="waitForProductCatalogPage"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProduct"> + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProduct"> <argument name="product" value="$$createProduct$$"/> </actionGroup> <click selector="{{AdminProductGridFilterSection.nthRow('1')}}" stepKey="clickFirstRowOfCreatedSimpleProduct"/> @@ -85,7 +85,7 @@ <see selector="{{AdminProductFormSection.successMessage}}" userInput="You saved the product." stepKey="seeAssertSimpleProductSaveSuccessMessage"/> <!-- Grab category Id --> - <actionGroup ref="OpenCategoryFromCategoryTree" stepKey="grabCategoryId"> + <actionGroup ref="OpenCategoryFromCategoryTreeActionGroup" stepKey="grabCategoryId"> <argument name="category" value="$$category.name$$"/> </actionGroup> <grabFromCurrentUrl stepKey="categoryId" regex="#\/([0-9]*)?\/$#"/> @@ -99,7 +99,7 @@ <see selector="{{AdminUrlRewriteIndexSection.storeView('1')}}" userInput="{{customStoreEN.name}}" stepKey="seeStoreViewValueForCategoryId"/> <!-- Grab product Id --> - <actionGroup ref="filterAndSelectProduct" stepKey="grabProductId"> + <actionGroup ref="FilterAndSelectProductActionGroup" stepKey="grabProductId"> <argument name="productSku" value="$$createProduct.sku$$"/> </actionGroup> <grabFromCurrentUrl stepKey="productId" regex="#\/([0-9]*)?\/$#"/> @@ -112,4 +112,4 @@ <see selector="{{AdminUrlRewriteIndexSection.storeView('1')}}" userInput="{{customStore.name}}" stepKey="seeStoreValueForProductId"/> <see selector="{{AdminUrlRewriteIndexSection.storeView('1')}}" userInput="{{storeViewData.name}}" stepKey="seeStoreViewValueForProductId"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminProductCreateUrlRewriteForCustomStoreViewTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminProductCreateUrlRewriteForCustomStoreViewTest.xml index c6ee1a7da9602..151211bac67e0 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminProductCreateUrlRewriteForCustomStoreViewTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminProductCreateUrlRewriteForCustomStoreViewTest.xml @@ -44,7 +44,7 @@ <actionGroup ref="logout" stepKey="logoutFromAdmin"/> </after> <!--Step 1. Navigate as Admin on Product Page for edit product`s Url Key--> - <actionGroup ref="navigateToCreatedProductEditPage" stepKey="goToProductForUrlRewrite"> + <actionGroup ref="NavigateToCreatedProductEditPageActionGroup" stepKey="goToProductForUrlRewrite"> <argument name="product" value="$$createProductForUrlRewrite$$"/> </actionGroup> <!--Step 2. As Admin switch on Custom Store View from Precondition --> @@ -55,12 +55,12 @@ <actionGroup ref="AdminProductFormUpdateUrlKeyActionGroup" stepKey="updateUrlKeyForProduct"> <argument name="newUrlKey" value="U2"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProductWithNewUrl"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductWithNewUrl"/> <!--Step 4. Set URL Key for created category --> - <actionGroup ref="navigateToCreatedCategory" stepKey="navigateToCreatedSubCategory"> + <actionGroup ref="NavigateToCreatedCategoryActionGroup" stepKey="navigateToCreatedSubCategory"> <argument name="Category" value="$$createCategory$$"/> </actionGroup> - <actionGroup ref="ChangeSeoUrlKey" stepKey="updateUrlKeyForCategory"> + <actionGroup ref="ChangeSeoUrlKeyActionGroup" stepKey="updateUrlKeyForCategory"> <argument name="value" value="U1"/> </actionGroup> <!--Step 5. On Storefront Assert what URL Key for Category is changed and is correct as for Default Store View --> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddAspxRequestPathTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddAspxRequestPathTest.xml index 072753505223d..33f8ab5d8a98d 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddAspxRequestPathTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddAspxRequestPathTest.xml @@ -40,7 +40,7 @@ </actionGroup> <!-- Open Category Page and Get Category ID --> - <actionGroup ref="OpenCategoryFromCategoryTree" stepKey="getCategoryId"> + <actionGroup ref="OpenCategoryFromCategoryTreeActionGroup" stepKey="getCategoryId"> <argument name="category" value="$$category.name$$"/> </actionGroup> <grabFromCurrentUrl stepKey="categoryId" regex="#\/([0-9]*)?\/$#"/> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddNoRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddNoRedirectTest.xml index 80b9dbe41bf59..9859d1a792679 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddNoRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddNoRedirectTest.xml @@ -40,7 +40,7 @@ </actionGroup> <!-- Open Category Page and Get Category ID --> - <actionGroup ref="OpenCategoryFromCategoryTree" stepKey="getCategoryId"> + <actionGroup ref="OpenCategoryFromCategoryTreeActionGroup" stepKey="getCategoryId"> <argument name="category" value="$$category.name$$"/> </actionGroup> <grabFromCurrentUrl stepKey="categoryId" regex="#\/([0-9]*)?\/$#"/> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddPermanentRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddPermanentRedirectTest.xml index be9fd1d83c8f1..65fd4f2df25bd 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddPermanentRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddPermanentRedirectTest.xml @@ -40,7 +40,7 @@ </actionGroup> <!-- Open Category Page and Get Category ID --> - <actionGroup ref="OpenCategoryFromCategoryTree" stepKey="getCategoryId"> + <actionGroup ref="OpenCategoryFromCategoryTreeActionGroup" stepKey="getCategoryId"> <argument name="category" value="$$category.name$$"/> </actionGroup> <grabFromCurrentUrl stepKey="categoryId" regex="#\/([0-9]*)?\/$#"/> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddTemporaryRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddTemporaryRedirectTest.xml index 7e1b9acbc47ab..42b3032592897 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddTemporaryRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddTemporaryRedirectTest.xml @@ -40,7 +40,7 @@ </actionGroup> <!-- Open Category Page and Get Category ID --> - <actionGroup ref="OpenCategoryFromCategoryTree" stepKey="getCategoryId"> + <actionGroup ref="OpenCategoryFromCategoryTreeActionGroup" stepKey="getCategoryId"> <argument name="category" value="$$category.name$$"/> </actionGroup> <grabFromCurrentUrl stepKey="categoryId" regex="#\/([0-9]*)?\/$#"/> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCustomURLRewritesTemporaryTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCustomURLRewritesTemporaryTest.xml index 07d578cbbeca4..059f6bdce71f2 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCustomURLRewritesTemporaryTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCustomURLRewritesTemporaryTest.xml @@ -32,7 +32,7 @@ </after> <!--Filter Product in product page and get the Product ID --> - <actionGroup ref="filterAndSelectProduct" stepKey="filterProduct"> + <actionGroup ref="FilterAndSelectProductActionGroup" stepKey="filterProduct"> <argument name="productSku" value="$$createProduct.sku$$"/> </actionGroup> <grabFromCurrentUrl stepKey="productId" regex="#\/([0-9]*)?\/$#"/> @@ -65,4 +65,4 @@ <argument name="productRequestPath" value="$$createProduct.name$$.html"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUrlRewritesForProductInAnchorCategoriesTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUrlRewritesForProductInAnchorCategoriesTest.xml index b708b63599173..dc82a3e4ab24f 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUrlRewritesForProductInAnchorCategoriesTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUrlRewritesForProductInAnchorCategoriesTest.xml @@ -54,7 +54,7 @@ <seeElement selector="{{AdminUrlRewriteIndexSection.requestPathColumnValue($simpleSubCategory1.custom_attributes[url_key]$/$simpleSubCategory2.custom_attributes[url_key]$/$simpleSubCategory3.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="seeValue4"/> <!-- 3. Edit Category 1 for DEFAULT Store View: --> - <actionGroup ref="switchCategoryStoreView" stepKey="switchStoreView"> + <actionGroup ref="SwitchCategoryStoreViewActionGroup" stepKey="switchStoreView"> <argument name="Store" value="_defaultStore.name"/> <argument name="CatName" value="$$simpleSubCategory1.name$$"/> </actionGroup> @@ -137,7 +137,7 @@ <dontSeeElement selector="{{AdminUrlRewriteIndexSection.requestPathColumnValue($simpleSubCategory1.custom_attributes[url_key]$/$simpleSubCategory2.custom_attributes[url_key]$/$simpleSubCategory3.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="seeValue4"/> <!-- 3. Edit Category 1 for DEFAULT Store View: --> - <actionGroup ref="switchCategoryStoreView" stepKey="switchStoreView"> + <actionGroup ref="SwitchCategoryStoreViewActionGroup" stepKey="switchStoreView"> <argument name="Store" value="_defaultStore.name"/> <argument name="CatName" value="$$simpleSubCategory1.name$$"/> </actionGroup> @@ -200,7 +200,7 @@ </before> <remove keyForRemoval="switchStoreView"/> <!-- 3. Edit Category 1 for All store view: --> - <actionGroup ref="navigateToCreatedCategory" stepKey="goToCategoryPage" after="seeValue4"> + <actionGroup ref="NavigateToCreatedCategoryActionGroup" stepKey="goToCategoryPage" after="seeValue4"> <argument name="Category" value="$$simpleSubCategory1$$"/> </actionGroup> <remove keyForRemoval="uncheckRedirect2"/> @@ -227,7 +227,7 @@ </before> <remove keyForRemoval="switchStoreView"/> <!-- 3. Edit Category 1 for All store view: --> - <actionGroup ref="navigateToCreatedCategory" stepKey="goToCategoryPage" after="seeValue4"> + <actionGroup ref="NavigateToCreatedCategoryActionGroup" stepKey="goToCategoryPage" after="seeValue4"> <argument name="Category" value="$$simpleSubCategory1$$"/> </actionGroup> <remove keyForRemoval="uncheckRedirect2"/> diff --git a/app/code/Magento/Weee/Test/Mftf/Test/AdminFixedTaxValSavedForSpecificWebsiteTest.xml b/app/code/Magento/Weee/Test/Mftf/Test/AdminFixedTaxValSavedForSpecificWebsiteTest.xml index aeb8537313fae..6cbdbe0db267d 100644 --- a/app/code/Magento/Weee/Test/Mftf/Test/AdminFixedTaxValSavedForSpecificWebsiteTest.xml +++ b/app/code/Magento/Weee/Test/Mftf/Test/AdminFixedTaxValSavedForSpecificWebsiteTest.xml @@ -75,7 +75,7 @@ <actionGroup ref="SelectProductInWebsitesActionGroup" stepKey="selectWebsiteInProduct"> <argument name="website" value="{{NewWebSiteData.name}}"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProductFirstTime"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductFirstTime"/> <!-- Add Fixed Product Tax attribute --> <comment userInput="Add Fixed Product Tax attribute" stepKey="addFixedProdTaxAttr"/> <actionGroup ref="AdminProductAddFPTValueActionGroup" stepKey="addFixedProductTaxAttr"> @@ -83,7 +83,7 @@ <argument name="stateForFPT" value="California"/> <argument name="valueForFPT" value="10"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProductSecondTime"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductSecondTime"/> <!-- Check if created tax attribute is saved --> <comment userInput="Check if created tax attribute is saved" stepKey="checkThatTaxAttributeIsSaved"/> <seeElement selector="{{AdminProductAddFPTValueSection.setTaxValueForFPT($$createProductFPTAttribute.attribute_code$$)}}" stepKey="checkIfTaxAttributeSaved"/> @@ -104,10 +104,10 @@ <seeElement selector="{{AdminProductAddFPTValueSection.setWebSiteForFPTOption($$createProductFPTAttribute.attribute_code$$, 'All Websites')}}" stepKey="checkAllWebsitesInDropDown"/> <seeElement selector="{{AdminProductAddFPTValueSection.setWebSiteForFPTOption($$createProductFPTAttribute.attribute_code$$, 'Main Website')}}" stepKey="checkMainWebsiteInDropDown"/> <seeElement selector="{{AdminProductAddFPTValueSection.setWebSiteForFPTOption($$createProductFPTAttribute.attribute_code$$, NewWebSiteData.name)}}" stepKey="checkSecondWebsitesInDropDown"/> - <actionGroup ref="unassignWebsiteFromProductActionGroup" stepKey="unassignWebsiteInProduct"> + <actionGroup ref="UnassignWebsiteFromProductActionGroup" stepKey="unassignWebsiteInProduct"> <argument name="website" value="{{_defaultWebsite.name}}"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProductThirdTime"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductThirdTime"/> <waitForPageLoad stepKey="waitForSavedProductLoad"/> <seeElement selector="{{AdminProductAddFPTValueSection.setWebSiteForFPTOption($$createProductFPTAttribute.attribute_code$$, 'All Websites')}}" stepKey="checkAllWebsitesInDropDownSecondTime"/> <dontSeeElement selector="{{AdminProductAddFPTValueSection.setWebSiteForFPTOption($$createProductFPTAttribute.attribute_code$$, 'Main Website')}}" stepKey="checkNoMainWebsiteInDropDown"/> diff --git a/app/code/Magento/Weee/Test/Mftf/Test/AdminRemoveProductWeeeAttributeOptionTest.xml b/app/code/Magento/Weee/Test/Mftf/Test/AdminRemoveProductWeeeAttributeOptionTest.xml index 3aeed3095dc45..6164f037048ba 100644 --- a/app/code/Magento/Weee/Test/Mftf/Test/AdminRemoveProductWeeeAttributeOptionTest.xml +++ b/app/code/Magento/Weee/Test/Mftf/Test/AdminRemoveProductWeeeAttributeOptionTest.xml @@ -35,12 +35,12 @@ <argument name="stateForFPT" value="California"/> <argument name="valueForFPT" value="10"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProductInitial"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductInitial"/> </before> <after> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductListing"/> <waitForPageLoad stepKey="waitForProductListingPageLoad"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetGridToDefaultKeywordSearch"/> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetGridToDefaultKeywordSearch"/> <actionGroup ref="logout" stepKey="logout"/> <deleteData createDataKey="createProductFPTAttribute" stepKey="deleteProductFPTAttribute"/> <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> @@ -56,7 +56,7 @@ </actionGroup> <!-- Step 2: Remove weee attribute options --> <click selector="{{AdminProductAddFPTValueSection.removeRowByIndex('$$createProductFPTAttribute.attribute_code$$','1')}}" stepKey="removeAttributeOption"/> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!-- Assert weee attribute options are empty --> <dontSeeElement selector="{{AdminProductAddFPTValueSection.removeRowByIndex('$$createProductFPTAttribute.attribute_code$$','1')}}" stepKey="dontSeeOptions"/> </test> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/ConfProdAddToCartWishListWithUnselectedAttrTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/ConfProdAddToCartWishListWithUnselectedAttrTest.xml index 4e6a062c7993d..75f5a0e192080 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/ConfProdAddToCartWishListWithUnselectedAttrTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/ConfProdAddToCartWishListWithUnselectedAttrTest.xml @@ -33,7 +33,7 @@ <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <!-- Delete the first simple product --> - <actionGroup stepKey="deleteProduct1" ref="deleteProductBySku"> + <actionGroup stepKey="deleteProduct1" ref="DeleteProductBySkuActionGroup"> <argument name="sku" value="{{_defaultProduct.sku}}"/> </actionGroup> <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/ConfigurableProductChildImageShouldBeShownOnWishListTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/ConfigurableProductChildImageShouldBeShownOnWishListTest.xml index 0489ec750b7e0..3d2d229c6077a 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/ConfigurableProductChildImageShouldBeShownOnWishListTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/ConfigurableProductChildImageShouldBeShownOnWishListTest.xml @@ -36,24 +36,24 @@ </after> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPageLoad"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetFiltersIfPresent"/> - <actionGroup ref="searchProductGridByKeyword" stepKey="searchProductGrid"> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetFiltersIfPresent"/> + <actionGroup ref="SearchProductGridByKeywordActionGroup" stepKey="searchProductGrid"> <argument name="keyword" value="_defaultProduct.name"/> </actionGroup> <click selector="{{AdminProductGridSection.selectRowBasedOnName(_defaultProduct.name)}}" stepKey="selectProductToAddImage"/> <waitForPageLoad stepKey="waitForProductEditPageLoad"/> - <actionGroup ref="addProductImage" stepKey="addImageForParentProduct"> + <actionGroup ref="AddProductImageActionGroup" stepKey="addImageForParentProduct"> <argument name="image" value="MagentoLogo"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex1"/> <waitForPageLoad stepKey="waitForProductIndexPageLoad1"/> <click selector="{{AdminProductGridSection.selectRowBasedOnName(colorProductAttribute1.name)}}" stepKey="selectProductToAddImage1"/> <waitForPageLoad stepKey="waitForProductEditPageLoad1"/> - <actionGroup ref="addProductImage" stepKey="addImageForChildProduct"> + <actionGroup ref="AddProductImageActionGroup" stepKey="addImageForChildProduct"> <argument name="image" value="TestImageNew"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveSimpleProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveSimpleProduct"/> <!--Sign in as customer --> <amOnPage url="{{StorefrontCustomerSignInPage.url}}" stepKey="amOnSignInPage"/> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontAddProductsToCartFromWishlistUsingSidebarTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontAddProductsToCartFromWishlistUsingSidebarTest.xml index 82c53bc343e51..432ab2b41cdf6 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontAddProductsToCartFromWishlistUsingSidebarTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontAddProductsToCartFromWishlistUsingSidebarTest.xml @@ -44,7 +44,7 @@ </actionGroup> <!-- Add product from first category to the wishlist --> <amOnPage url="{{StorefrontCategoryPage.url($$categoryFirst.name$$)}}" stepKey="navigateToCategoryFirstPage"/> - <actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="browseAssertCategoryProduct1"> + <actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="browseAssertCategoryProduct1"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> <actionGroup ref="StorefrontCustomerAddCategoryProductToWishlistActionGroup" stepKey="addSimpleProduct1ToWishlist"> @@ -52,7 +52,7 @@ </actionGroup> <!--Add product to the cart from the Wishlist using the sidebar from the second category page--> <amOnPage url="{{StorefrontCategoryPage.url($$categorySecond.name$$)}}" stepKey="navigateToCategorySecondPage"/> - <actionGroup ref="StorefrontSwitchCategoryViewToListMode" stepKey="switchCategoryViewToListMode"/> + <actionGroup ref="StorefrontSwitchCategoryViewToListModeActionGroup" stepKey="switchCategoryViewToListMode"/> <actionGroup ref="StorefrontCustomerCheckProductInWishlistSidebar" stepKey="checkSimpleProduct1InWishlistSidebar"> <argument name="productVar" value="$$simpleProduct1$$"/> </actionGroup> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeleteBundleDynamicProductFromWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeleteBundleDynamicProductFromWishlistTest.xml index ae65a4171d883..c2a0f2b20a028 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeleteBundleDynamicProductFromWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeleteBundleDynamicProductFromWishlistTest.xml @@ -48,12 +48,12 @@ </createData> <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> - <actionGroup ref="goToProductPageViaID" stepKey="goToProduct"> + <actionGroup ref="GoToProductPageViaIDActionGroup" stepKey="goToProduct"> <argument name="productId" value="$$createBundleProduct.id$$"/> </actionGroup> <scrollTo selector="{{AdminProductFormBundleSection.contentDropDown}}" stepKey="scrollToBundleSection"/> <selectOption userInput="Separately" selector="{{AdminProductFormBundleSection.shipmentType}}" stepKey="selectSeparately"/> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> </before> <after> <!-- Delete data --> @@ -74,7 +74,7 @@ <actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="openProductFromCategory"> <argument name="productUrlKey" value="$$createBundleProduct.custom_attributes[url_key]$$"/> </actionGroup> - + <!-- Add created product to Wishlist according to dataset and assert add product to wishlist success message --> <actionGroup ref="StorefrontCustomerAddProductToWishlistActionGroup" stepKey="addProductToWishlist"> <argument name="productVar" value="$$createBundleProduct$$"/> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontRemoveProductsFromWishlistUsingSidebarTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontRemoveProductsFromWishlistUsingSidebarTest.xml index 6c73cb6708ae4..37adb23f513ab 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontRemoveProductsFromWishlistUsingSidebarTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontRemoveProductsFromWishlistUsingSidebarTest.xml @@ -45,7 +45,7 @@ </actionGroup> <!-- Add product from first category to the wishlist --> <amOnPage url="{{StorefrontCategoryPage.url($$categoryFirst.name$$)}}" stepKey="navigateToCategoryFirstPage"/> - <actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="browseAssertCategoryProduct1"> + <actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="browseAssertCategoryProduct1"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> <actionGroup ref="StorefrontCustomerAddCategoryProductToWishlistActionGroup" stepKey="addSimpleProduct1ToWishlist"> @@ -53,7 +53,7 @@ </actionGroup> <!--Remove product from the Wishlist using the sidebar from the second category page--> <amOnPage url="{{StorefrontCategoryPage.url($$categorySecond.name$$)}}" stepKey="navigateToCategorySecondPage"/> - <actionGroup ref="StorefrontSwitchCategoryViewToListMode" stepKey="switchCategoryViewToListMode"/> + <actionGroup ref="StorefrontSwitchCategoryViewToListModeActionGroup" stepKey="switchCategoryViewToListMode"/> <actionGroup ref="StorefrontCustomerCheckProductInWishlistSidebar" stepKey="checkSimpleProduct1InWishlistSidebar"> <argument name="productVar" value="$$simpleProduct1$$"/> </actionGroup> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/WishListWithDisabledProductTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/WishListWithDisabledProductTest.xml index af216c139e7fe..488490c2b612e 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/WishListWithDisabledProductTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/WishListWithDisabledProductTest.xml @@ -41,8 +41,8 @@ <openNewTab stepKey="openNewTab"/> <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminArea"/> <amOnPage url="{{AdminProductEditPage.url($$createProduct.id$$)}}" stepKey="goToProductEditPage"/> - <actionGroup ref="AdminSetProductDisabled" stepKey="disableProduct"/> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="AdminSetProductDisabledActionGroup" stepKey="disableProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <closeTab stepKey="closeSecondTab"/> <reloadPage stepKey="refreshPage"/> <actionGroup ref="StorefrontAssertCustomerWishlistIsEmpty" stepKey="checkProductIsAbsentInWishlistIsEmpty"/> From 54ec0c3d8c8fc2640e106a3e08178b8eb1148e10 Mon Sep 17 00:00:00 2001 From: Willem Wigman <wigman@users.noreply.github.com> Date: Fri, 29 Nov 2019 17:49:06 +0100 Subject: [PATCH 0189/1143] Test 3 --- .../Search/Test/Unit/Model/PopularSearchTermsTest.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Search/Test/Unit/Model/PopularSearchTermsTest.php b/app/code/Magento/Search/Test/Unit/Model/PopularSearchTermsTest.php index e8e3ead3a7029..af48bdc516596 100644 --- a/app/code/Magento/Search/Test/Unit/Model/PopularSearchTermsTest.php +++ b/app/code/Magento/Search/Test/Unit/Model/PopularSearchTermsTest.php @@ -49,10 +49,6 @@ protected function setUp() /** * Test isCacheableDataProvider method * - * @param string $term - * @param array $terms - * @param $expected $terms - * * @return void */ public function testIsCacheable() @@ -60,14 +56,16 @@ public function testIsCacheable() $term = 'test1'; $storeId = 1; $pageSize = 35; - + $this->scopeConfigMock->expects($this->once())->method('getValue') ->with( PopularSearchTerms::XML_PATH_MAX_COUNT_CACHEABLE_SEARCH_TERMS, ScopeInterface::SCOPE_STORE, $storeId )->willReturn($pageSize); - $this->queryCollectionMock->expects($this->exact(2))->method('isTopSearchResult')->with($term, $storeId, $pageSize) + $this->queryCollectionMock->expects($this->exactly(2)) + ->method('isTopSearchResult') + ->with($term, $storeId, $pageSize) ->willReturn(true, false); $this->assertTrue($this->popularSearchTerms->isCacheable($term, $storeId)); From d7db16ca48498ee4d0c881a54862eac9d0dbf8cb Mon Sep 17 00:00:00 2001 From: Willem Wigman <wigman@users.noreply.github.com> Date: Fri, 29 Nov 2019 18:14:55 +0100 Subject: [PATCH 0190/1143] Fixing your problems --- app/code/Magento/Search/Model/PopularSearchTerms.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Search/Model/PopularSearchTerms.php b/app/code/Magento/Search/Model/PopularSearchTerms.php index e8489b2563280..213fac0232535 100644 --- a/app/code/Magento/Search/Model/PopularSearchTerms.php +++ b/app/code/Magento/Search/Model/PopularSearchTerms.php @@ -29,7 +29,7 @@ class PopularSearchTerms /** * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig - * @param \Magento\Search\Model\ResourceModel\Query\Collection + * @param \Magento\Search\Model\ResourceModel\Query\Collection $queryCollection */ public function __construct( \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, From bb860cce82ba7b720832d386047c687d6ddbc33b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Fri, 29 Nov 2019 21:19:30 +0100 Subject: [PATCH 0191/1143] FIX: Extract Assertion to separate file, append existing tests with assertion --- ...ductAttributeRemovedSuccessfullyActionGroup.xml | 14 ++++++++++++++ ...eProductAttributeByAttributeCodeActionGroup.xml | 1 - ...ropdownProductAttributeFromAttributeSetTest.xml | 1 + .../Mftf/Test/AdminDeleteProductAttributeTest.xml | 1 + ...xtFieldProductAttributeFromAttributeSetTest.xml | 1 + ...AdminCheckResultsOfColorAndOtherFiltersTest.xml | 1 + ...refrontElasticsearch6SearchInvalidValueTest.xml | 1 + ...eProductWithAttributesImagesAndSwatchesTest.xml | 1 + 8 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductAttributeRemovedSuccessfullyActionGroup.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductAttributeRemovedSuccessfullyActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductAttributeRemovedSuccessfullyActionGroup.xml new file mode 100644 index 0000000000000..60f1e59f9871a --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductAttributeRemovedSuccessfullyActionGroup.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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertProductAttributeRemovedSuccessfullyActionGroup"> + <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="waitForSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductAttributeByAttributeCodeActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductAttributeByAttributeCodeActionGroup.xml index 7fbf6a9b2a178..c40a0f6d31dc0 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductAttributeByAttributeCodeActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductAttributeByAttributeCodeActionGroup.xml @@ -25,6 +25,5 @@ <click selector="{{AttributePropertiesSection.DeleteAttribute}}" stepKey="deleteAttribute"/> <click selector="{{ModalConfirmationSection.OkButton}}" stepKey="ClickOnDeleteButton"/> <waitForPageLoad stepKey="waitForPageLoad"/> - <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="waitForSuccessMessage"/> </actionGroup> </actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteDropdownProductAttributeFromAttributeSetTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteDropdownProductAttributeFromAttributeSetTest.xml index 84a116fb4bcd6..bded224a86563 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteDropdownProductAttributeFromAttributeSetTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteDropdownProductAttributeFromAttributeSetTest.xml @@ -52,6 +52,7 @@ <actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteProductAttribute"> <argument name="ProductAttributeCode" value="$$attribute.attribute_code$$"/> </actionGroup> + <actionGroup ref="AssertProductAttributeRemovedSuccessfullyActionGroup" stepKey="deleteProductAttributeSuccess"/> <!--Confirm Attribute is not present in Product Attribute Grid --> <actionGroup ref="FilterProductAttributeByAttributeCodeActionGroup" stepKey="filterAttribute"> <argument name="ProductAttributeCode" value="$$attribute.attribute_code$$"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductAttributeTest.xml index cc3242310ca11..f81b05c61a669 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductAttributeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductAttributeTest.xml @@ -27,6 +27,7 @@ <actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteProductAttribute"> <argument name="ProductAttributeCode" value="$$createProductAttribute.attribute_code$$"/> </actionGroup> + <actionGroup ref="AssertProductAttributeRemovedSuccessfullyActionGroup" stepKey="deleteProductAttributeSuccess"/> <!-- Assert the product attribute is not in the grid by Attribute code --> <actionGroup ref="FilterProductAttributeByAttributeCodeActionGroup" stepKey="filterByAttributeCode"> <argument name="ProductAttributeCode" value="$$createProductAttribute.attribute_code$$"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteTextFieldProductAttributeFromAttributeSetTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteTextFieldProductAttributeFromAttributeSetTest.xml index 4b97fb38e994f..f5fc104fa2b8d 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteTextFieldProductAttributeFromAttributeSetTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteTextFieldProductAttributeFromAttributeSetTest.xml @@ -58,6 +58,7 @@ <actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteProductAttribute"> <argument name="ProductAttributeCode" value="$$attribute.attribute_code$$"/> </actionGroup> + <actionGroup ref="AssertProductAttributeRemovedSuccessfullyActionGroup" stepKey="deleteProductAttributeSuccess"/> <!-- Confirm attribute is not present in product attribute grid --> <actionGroup ref="FilterProductAttributeByAttributeCodeActionGroup" stepKey="filterAttribute"> <argument name="ProductAttributeCode" value="$$attribute.attribute_code$$"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckResultsOfColorAndOtherFiltersTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckResultsOfColorAndOtherFiltersTest.xml index 84fbab5fb4f02..7324008879eda 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckResultsOfColorAndOtherFiltersTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckResultsOfColorAndOtherFiltersTest.xml @@ -104,6 +104,7 @@ <actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteSecondProductAttributeByAttributeCode"> <argument name="ProductAttributeCode" value="$$createConfigProductAttribute2.attribute_code$$"/> </actionGroup> + <actionGroup ref="AssertProductAttributeRemovedSuccessfullyActionGroup" stepKey="deleteProductAttributeSuccess"/> <!-- Clear filters --> <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearProductAttributesFilter"/> <actionGroup ref="AdminClearFiltersActionGroup" stepKey="clearProductsGridFilter"/> diff --git a/app/code/Magento/Elasticsearch6/Test/Mftf/Test/StorefrontElasticsearch6SearchInvalidValueTest.xml b/app/code/Magento/Elasticsearch6/Test/Mftf/Test/StorefrontElasticsearch6SearchInvalidValueTest.xml index 7c6ff7176ee8f..9da343b40a283 100644 --- a/app/code/Magento/Elasticsearch6/Test/Mftf/Test/StorefrontElasticsearch6SearchInvalidValueTest.xml +++ b/app/code/Magento/Elasticsearch6/Test/Mftf/Test/StorefrontElasticsearch6SearchInvalidValueTest.xml @@ -37,6 +37,7 @@ <actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteProductAttribute"> <argument name="ProductAttributeCode" value="{{textProductAttribute.attribute_code}}"/> </actionGroup> + <actionGroup ref="AssertProductAttributeRemovedSuccessfullyActionGroup" stepKey="deleteProductAttributeSuccess"/> <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/> <waitForPageLoad stepKey="waitForAttributePageLoad"/> <click selector="{{AdminProductAttributeGridSection.ResetFilter}}" stepKey="resetFiltersOnGrid"/> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/AdminSaveConfigurableProductWithAttributesImagesAndSwatchesTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/AdminSaveConfigurableProductWithAttributesImagesAndSwatchesTest.xml index 43205375a6330..e7fc490bbcb97 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/AdminSaveConfigurableProductWithAttributesImagesAndSwatchesTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/AdminSaveConfigurableProductWithAttributesImagesAndSwatchesTest.xml @@ -62,6 +62,7 @@ <actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteProductAttribute"> <argument name="ProductAttributeCode" value="{{VisualSwatchProductAttribute.attribute_code}}"/> </actionGroup> + <actionGroup ref="AssertProductAttributeRemovedSuccessfullyActionGroup" stepKey="deleteProductAttributeSuccess"/> <actionGroup ref="AdminGridFilterResetActionGroup" stepKey="clearAttributesGridFilter"/> <!--Clear products grid filter--> <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="openProductIndexPage"/> From bd425997542a3a02888f243c040bd58abdbe5e0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Sat, 30 Nov 2019 11:09:44 +0100 Subject: [PATCH 0192/1143] Refactor: Remove redundant section to avoid confusion --- .../Test/Mftf/Section/StorefrontSwitchCurrencyRatesSection.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/CurrencySymbol/Test/Mftf/Section/StorefrontSwitchCurrencyRatesSection.xml b/app/code/Magento/CurrencySymbol/Test/Mftf/Section/StorefrontSwitchCurrencyRatesSection.xml index ff922421e5db7..43512796a134d 100644 --- a/app/code/Magento/CurrencySymbol/Test/Mftf/Section/StorefrontSwitchCurrencyRatesSection.xml +++ b/app/code/Magento/CurrencySymbol/Test/Mftf/Section/StorefrontSwitchCurrencyRatesSection.xml @@ -10,7 +10,6 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="StorefrontSwitchCurrencyRatesSection"> <element name="currencyToggle" type="select" selector="#switcher-currency-trigger" timeout="30"/> - <element name="currencyTrigger" type="select" selector="#switcher-currency-trigger" timeout="30"/> <element name="currency" type="button" selector="//div[@id='switcher-currency-trigger']/following-sibling::ul//a[contains(text(), '{{currency}}')]" parameterized="true" timeout="10"/> <element name="selectedCurrency" type="text" selector="#switcher-currency-trigger span"/> </section> From 67cf8d56004d97a9e6a245e09fbe0f06a009db8e Mon Sep 17 00:00:00 2001 From: Dan Wallis <mrdanwallis@gmail.com> Date: Sat, 30 Nov 2019 13:20:43 +0000 Subject: [PATCH 0193/1143] Add mass action to invalidate indexes via admin --- .../Indexer/Controller/Adminhtml/Indexer.php | 1 + .../Adminhtml/Indexer/MassInvalidate.php | 45 ++++ .../Adminhtml/Indexer/MassInvalidateTest.php | 254 ++++++++++++++++++ app/code/Magento/Indexer/etc/acl.xml | 2 +- app/code/Magento/Indexer/i18n/en_US.csv | 5 +- .../layout/indexer_indexer_list_grid.xml | 4 + 6 files changed, 309 insertions(+), 2 deletions(-) create mode 100644 app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassInvalidate.php create mode 100644 app/code/Magento/Indexer/Test/Unit/Controller/Adminhtml/Indexer/MassInvalidateTest.php diff --git a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer.php b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer.php index 85c5736398d00..5527c1b063e5e 100644 --- a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer.php +++ b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer.php @@ -19,6 +19,7 @@ protected function _isAllowed() return $this->_authorization->isAllowed('Magento_Indexer::index'); case 'massOnTheFly': case 'massChangelog': + case 'massInvalidate': return $this->_authorization->isAllowed('Magento_Indexer::changeMode'); } return false; diff --git a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassInvalidate.php b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassInvalidate.php new file mode 100644 index 0000000000000..1cd204dfcf324 --- /dev/null +++ b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassInvalidate.php @@ -0,0 +1,45 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Indexer\Controller\Adminhtml\Indexer; + +use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface; + +class MassInvalidate extends \Magento\Indexer\Controller\Adminhtml\Indexer implements HttpPostActionInterface +{ + /** + * Turn mview on for the given indexers + * + * @return void + */ + public function execute() + { + $indexerIds = $this->getRequest()->getParam('indexer_ids'); + if (!is_array($indexerIds)) { + $this->messageManager->addError(__('Please select indexers.')); + } else { + try { + foreach ($indexerIds as $indexerId) { + /** @var \Magento\Framework\Indexer\IndexerInterface $model */ + $model = $this->_objectManager->get( + \Magento\Framework\Indexer\IndexerRegistry::class + )->get($indexerId); + $model->invalidate(); + } + $this->messageManager->addSuccess( + __('%1 indexer(s) were invalidated.', count($indexerIds)) + ); + } catch (\Magento\Framework\Exception\LocalizedException $e) { + $this->messageManager->addError($e->getMessage()); + } catch (\Exception $e) { + $this->messageManager->addException( + $e, + __("We couldn't invalidate indexer(s) because of an error.") + ); + } + } + $this->_redirect('*/*/list'); + } +} diff --git a/app/code/Magento/Indexer/Test/Unit/Controller/Adminhtml/Indexer/MassInvalidateTest.php b/app/code/Magento/Indexer/Test/Unit/Controller/Adminhtml/Indexer/MassInvalidateTest.php new file mode 100644 index 0000000000000..c80d8b7a7b5c6 --- /dev/null +++ b/app/code/Magento/Indexer/Test/Unit/Controller/Adminhtml/Indexer/MassInvalidateTest.php @@ -0,0 +1,254 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Indexer\Test\Unit\Controller\Adminhtml\Indexer; + +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class MassInvalidateTest extends \PHPUnit\Framework\TestCase +{ + /** + * @var \Magento\Indexer\Controller\Adminhtml\Indexer\MassInvalidate + */ + protected $controller; + + /** + * @var \Magento\Backend\App\Action\Context + */ + protected $contextMock; + + /** + * @var \Magento\Framework\App\ViewInterface + */ + protected $view; + + /** + * @var \Magento\Framework\View\Result\Page + */ + protected $page; + + /** + * @var \Magento\Framework\View\Page\Config + */ + protected $config; + + /** + * @var \Magento\Framework\View\Page\Title + */ + protected $title; + + /** + * @var \Magento\Framework\App\RequestInterface + */ + protected $request; + + /** + * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager + */ + protected $objectManager; + + /** + * @var \Magento\Framework\Message\ManagerInterface + */ + protected $messageManager; + + /** + * @var \Magento\Framework\Indexer\IndexerRegistry + */ + protected $indexReg; + + /** + * @var \Magento\Framework\App\ResponseInterface + */ + protected $response; + + /** + * @var \Magento\Framework\App\ActionFlag + */ + protected $actionFlag; + + /** + * @var \Magento\Backend\Helper\Data + */ + protected $helper; + + /** + * @var \Magento\Backend\Model\Session + */ + protected $session; + + /** + * Set up test + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + protected function setUp() + { + $this->contextMock = $this->createPartialMock(\Magento\Backend\App\Action\Context::class, [ + 'getAuthorization', + 'getSession', + 'getActionFlag', + 'getAuth', + 'getView', + 'getHelper', + 'getBackendUrl', + 'getFormKeyValidator', + 'getLocaleResolver', + 'getCanUseBaseUrl', + 'getRequest', + 'getResponse', + 'getObjectManager', + 'getMessageManager' + ]); + + $this->response = $this->createPartialMock( + \Magento\Framework\App\ResponseInterface::class, + ['setRedirect', 'sendResponse'] + ); + + $this->view = $this->createPartialMock(\Magento\Framework\App\ViewInterface::class, [ + 'loadLayout', + 'getPage', + 'getConfig', + 'getTitle', + 'renderLayout', + 'loadLayoutUpdates', + 'getDefaultLayoutHandle', + 'addPageLayoutHandles', + 'generateLayoutBlocks', + 'generateLayoutXml', + 'getLayout', + 'addActionLayoutHandles', + 'setIsLayoutLoaded', + 'isLayoutLoaded' + ]); + + $this->session = $this->createPartialMock(\Magento\Backend\Model\Session::class, ['setIsUrlNotice']); + $this->session->expects($this->any())->method('setIsUrlNotice')->willReturn($this->objectManager); + $this->actionFlag = $this->createPartialMock(\Magento\Framework\App\ActionFlag::class, ['get']); + $this->actionFlag->expects($this->any())->method("get")->willReturn($this->objectManager); + $this->objectManager = $this->createPartialMock( + \Magento\Framework\TestFramework\Unit\Helper\ObjectManager::class, + ['get'] + ); + $this->request = $this->getMockForAbstractClass( + \Magento\Framework\App\RequestInterface::class, + ['getParam', 'getRequest'], + '', + false + ); + + $this->response->expects($this->any())->method("setRedirect")->willReturn(1); + $this->page = $this->createMock(\Magento\Framework\View\Result\Page::class); + $this->config = $this->createMock(\Magento\Framework\View\Result\Page::class); + $this->title = $this->createMock(\Magento\Framework\View\Page\Title::class); + $this->messageManager = $this->getMockForAbstractClass( + \Magento\Framework\Message\ManagerInterface::class, + ['addError', 'addSuccess'], + '', + false + ); + + $this->indexReg = $this->createPartialMock( + \Magento\Framework\Indexer\IndexerRegistry::class, + ['get', 'setScheduled'] + ); + $this->helper = $this->createPartialMock(\Magento\Backend\Helper\Data::class, ['getUrl']); + $this->contextMock->expects($this->any())->method("getObjectManager")->willReturn($this->objectManager); + $this->contextMock->expects($this->any())->method("getRequest")->willReturn($this->request); + $this->contextMock->expects($this->any())->method("getResponse")->willReturn($this->response); + $this->contextMock->expects($this->any())->method("getMessageManager")->willReturn($this->messageManager); + $this->contextMock->expects($this->any())->method("getSession")->willReturn($this->session); + $this->contextMock->expects($this->any())->method("getActionFlag")->willReturn($this->actionFlag); + $this->contextMock->expects($this->any())->method("getHelper")->willReturn($this->helper); + } + + /** + * @param array $indexerIds + * @param \Exception $exception + * @dataProvider executeDataProvider + */ + public function testExecute($indexerIds, $exception) + { + $this->controller = new \Magento\Indexer\Controller\Adminhtml\Indexer\MassInvalidate($this->contextMock); + $this->request->expects($this->any()) + ->method('getParam')->with('indexer_ids') + ->will($this->returnValue($indexerIds)); + + if (!is_array($indexerIds)) { + $this->messageManager->expects($this->once()) + ->method('addError')->with(__('Please select indexers.')) + ->will($this->returnValue(1)); + } else { + $this->objectManager->expects($this->any()) + ->method('get')->with(\Magento\Framework\Indexer\IndexerRegistry::class) + ->will($this->returnValue($this->indexReg)); + $indexerInterface = $this->getMockForAbstractClass( + \Magento\Framework\Indexer\IndexerInterface::class, + ['invalidate'], + '', + false + ); + $this->indexReg->expects($this->any()) + ->method('get')->with(1) + ->will($this->returnValue($indexerInterface)); + + $indexerInterface->expects($this->any()) + ->method('invalidate')->with(true) + ->will($this->returnValue(1)); + + $this->messageManager->expects($this->any()) + ->method('addSuccess') + ->will($this->returnValue(1)); + + if ($exception) { + if ($exception instanceof \Magento\Framework\Exception\LocalizedException) { + $expectError = 1; + $expectException = 0; + } else { + $expectError = 0; + $expectException = 1; + } + $this->messageManager->expects($this->exactly($expectError)) + ->method('addError') + ->with($exception->getMessage()); + $this->messageManager->expects($this->exactly($expectException)) + ->method('addException') + ->with($exception, "We couldn't invalidate indexer(s) because of an error."); + } + } + + $this->helper->expects($this->any())->method("getUrl")->willReturn("magento.com"); + $this->response->expects($this->any())->method("setRedirect")->willReturn(1); + + $result = $this->controller->execute(); + $this->assertNull($result); + } + + /** + * @return array + */ + public function executeDataProvider() + { + return [ + 'set1' => [ + 'indexers' => 1, + 'exception' => null, + ], + 'set2' => [ + 'indexers' => [1], + 'exception' => null, + ], + 'set3' => [ + 'indexers' => [1], + 'exception' => new \Magento\Framework\Exception\LocalizedException(__('Test Phrase')), + ], + 'set4' => [ + 'indexers' => [1], + 'exception' => new \Exception(), + ] + ]; + } +} diff --git a/app/code/Magento/Indexer/etc/acl.xml b/app/code/Magento/Indexer/etc/acl.xml index fc9f45c21b272..f49c672057a5e 100644 --- a/app/code/Magento/Indexer/etc/acl.xml +++ b/app/code/Magento/Indexer/etc/acl.xml @@ -12,7 +12,7 @@ <resource id="Magento_Backend::system"> <resource id="Magento_Backend::tools"> <resource id="Magento_Indexer::index" title="Index Management" translate="title" sortOrder="30" /> - <resource id="Magento_Indexer::changeMode" title="Change indexer mode" translate="title" sortOrder="40" /> + <resource id="Magento_Indexer::changeMode" title="Change indexer mode & invalidate index" translate="title" sortOrder="40" /> </resource> </resource> </resource> diff --git a/app/code/Magento/Indexer/i18n/en_US.csv b/app/code/Magento/Indexer/i18n/en_US.csv index 85ee5b1f91ba9..7be25954a9012 100644 --- a/app/code/Magento/Indexer/i18n/en_US.csv +++ b/app/code/Magento/Indexer/i18n/en_US.csv @@ -1,6 +1,7 @@ "Indexer Management","Indexer Management" "Update by Schedule","Update by Schedule" "Update on Save","Update on Save" +"Invalidate index","Invalidate index" "Reindex required","Reindex required" Ready,Ready Processing,Processing @@ -11,13 +12,15 @@ Never,Never "%1 indexer(s) are in ""Update by Schedule"" mode.","%1 indexer(s) are in ""Update by Schedule"" mode." "We couldn't change indexer(s)' mode because of an error.","We couldn't change indexer(s)' mode because of an error." "%1 indexer(s) are in ""Update on Save"" mode.","%1 indexer(s) are in ""Update on Save"" mode." +"We couldn't invalidate indexer(s) because of an error.","We couldn't invalidate indexer(s) because of an error." +"%1 indexer(s) were invalidated.","%1 indexer(s) were invalidated." "One or more <a href=""%1"">indexers are invalid</a>. Make sure your <a href=""%2"" target=""_blank"">Magento cron job</a> is running.","One or more <a href=""%1"">indexers are invalid</a>. Make sure your <a href=""%2"" target=""_blank"">Magento cron job</a> is running." "State for the same indexer","State for the same indexer" "State for the same view","State for the same view" "Field '%1' not found","Field '%1' not found" "Some Exception Message","Some Exception Message" "Test Phrase","Test Phrase" -"Change indexer mode","Change indexer mode" +"Change indexer mode & invalidate index","Change indexer mode & invalidate index" Indexer,Indexer Description,Description Mode,Mode diff --git a/app/code/Magento/Indexer/view/adminhtml/layout/indexer_indexer_list_grid.xml b/app/code/Magento/Indexer/view/adminhtml/layout/indexer_indexer_list_grid.xml index f1099c4133bca..7c4eb22ce6128 100644 --- a/app/code/Magento/Indexer/view/adminhtml/layout/indexer_indexer_list_grid.xml +++ b/app/code/Magento/Indexer/view/adminhtml/layout/indexer_indexer_list_grid.xml @@ -30,6 +30,10 @@ <item name="label" xsi:type="string" translate="true">Update by Schedule</item> <item name="url" xsi:type="string">*/indexer/massChangelog</item> </item> + <item name="invalidate_index" xsi:type="array"> + <item name="label" xsi:type="string" translate="true">Invalidate index</item> + <item name="url" xsi:type="string">*/indexer/massInvalidate</item> + </item> </argument> </arguments> </block> From 2be777942056985a81371890cfc010d43c47bccd Mon Sep 17 00:00:00 2001 From: Sergiy Zhovnir <s.zhovnir@atwix.com> Date: Sun, 1 Dec 2019 09:02:47 +0200 Subject: [PATCH 0194/1143] #issue-761 Mark clicked column image with active class --- .../Magento/Ui/view/base/web/js/grid/columns/image.js | 9 +++++++++ .../Ui/view/base/web/templates/grid/columns/image.html | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/view/base/web/js/grid/columns/image.js b/app/code/Magento/Ui/view/base/web/js/grid/columns/image.js index cec0955b835e0..0bd93f8e629b7 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/columns/image.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/columns/image.js @@ -80,6 +80,15 @@ define([ return record.css || {}; }, + /** + * Get is active record + * + * @param {Object} record - Data to be preprocessed. + */ + getIsActive: function (record) { + return this.previewComponent().visibleRecord() === record._rowIndex || false; + }, + /** * Expand image preview */ diff --git a/app/code/Magento/Ui/view/base/web/templates/grid/columns/image.html b/app/code/Magento/Ui/view/base/web/templates/grid/columns/image.html index c513ddeff9895..fa0074ad72283 100644 --- a/app/code/Magento/Ui/view/base/web/templates/grid/columns/image.html +++ b/app/code/Magento/Ui/view/base/web/templates/grid/columns/image.html @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ --> -<div class="masonry-image-block" ko-style="$col.getStyles($row())" attr="'data-id': $col.getId($row())"> +<div class="masonry-image-block" ko-style="$col.getStyles($row())" css="{'active': $col.getIsActive($row())}" attr="'data-id': $col.getId($row())"> <img attr="src: $col.getUrl($row())" css="$col.getClasses($row())" click="function(){ expandPreview($row()) }" data-role="thumbnail"/> </div> From a7f6e2d895d3c818d52b318349b5e7d03e06df30 Mon Sep 17 00:00:00 2001 From: Sergiy Zhovnir <s.zhovnir@atwix.com> Date: Sun, 1 Dec 2019 09:51:45 +0200 Subject: [PATCH 0195/1143] #issue-761 Added the styles for the selected image in the grid --- .../Magento_Ui/web/css/source/module/_masonry-grid.less | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/module/_masonry-grid.less b/app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/module/_masonry-grid.less index c17c19e259478..f805861be90e2 100644 --- a/app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/module/_masonry-grid.less +++ b/app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/module/_masonry-grid.less @@ -27,6 +27,15 @@ margin: @admin__masonry_grid_image__space/2; overflow: hidden; + .masonry-image-block { + &.active { + img { + border: 2px #558dd6 solid; + padding: 1px; + } + } + } + img { cursor: pointer; height: 100%; From 0c7ac0c7fad2963b18a428af6387f88b3f94568d Mon Sep 17 00:00:00 2001 From: Raul Verdugo <rverdugo@onestic.com> Date: Mon, 2 Dec 2019 08:23:07 +0100 Subject: [PATCH 0196/1143] #13865 move translate dependecy and remove declaration --- app/code/Magento/Theme/view/frontend/web/js/cookie-status.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Theme/view/frontend/web/js/cookie-status.js b/app/code/Magento/Theme/view/frontend/web/js/cookie-status.js index 20090bc67befc..8349b6de74736 100644 --- a/app/code/Magento/Theme/view/frontend/web/js/cookie-status.js +++ b/app/code/Magento/Theme/view/frontend/web/js/cookie-status.js @@ -1,8 +1,8 @@ define([ 'jquery', + 'Magento_Ui/js/modal/modal', 'mage/translate', - 'Magento_Ui/js/modal/modal' -], function($, $tr, modal){ +], function($, modal){ 'use strict'; $.widget('mage.cookieStatus', { From 7316201c309abdb8af2b4c68f851289e678d6a1d Mon Sep 17 00:00:00 2001 From: Raul Verdugo <rverdugo@onestic.com> Date: Mon, 2 Dec 2019 08:28:51 +0100 Subject: [PATCH 0197/1143] #13865 move options to wiget's options --- .../view/frontend/web/js/cookie-status.js | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/app/code/Magento/Theme/view/frontend/web/js/cookie-status.js b/app/code/Magento/Theme/view/frontend/web/js/cookie-status.js index 8349b6de74736..48d201af0cffe 100644 --- a/app/code/Magento/Theme/view/frontend/web/js/cookie-status.js +++ b/app/code/Magento/Theme/view/frontend/web/js/cookie-status.js @@ -6,6 +6,20 @@ define([ 'use strict'; $.widget('mage.cookieStatus', { + options: { + type: 'popup', + responsive: true, + innerScroll: true, + autoOpen: true, + buttons: [{ + text: $.mage.__('Close'), + class: 'cookie-status', + click: function () { + this.closeModal(); + } + }] + }, + /** * Init object * @private @@ -13,21 +27,7 @@ define([ _init: function () { if(!navigator.cookieEnabled) { - const options = { - type: 'popup', - responsive: true, - innerScroll: true, - autoOpen: true, - buttons: [{ - text: $.mage.__('Close'), - class: 'cookie-status', - click: function () { - this.closeModal(); - } - }] - }; - - modal(options, $('#cookie-status')); + modal(this.options, $('#cookie-status')); } } }); From db5332e5d95a12c9b32ed0e3523655c8e24d7b1f Mon Sep 17 00:00:00 2001 From: Ashna-Jahan <32352950+Ashna-Jahan@users.noreply.github.com> Date: Mon, 2 Dec 2019 14:01:23 +0530 Subject: [PATCH 0198/1143] Fixed issue. --- .../backend/web/css/source/forms/fields/_control-table.less | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less b/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less index b304ae1de4c5a..f8e50db60281c 100644 --- a/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less +++ b/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less @@ -239,11 +239,10 @@ } .product_form_product_form_advanced_pricing_modal .admin__fieldset > .admin__field > .admin__field-control { - min-width: 682px; + width: calc(~"(100%) * 0.57 - 30px"); } -.admin__control-table-wrapper { - max-width: 100%; +.product_form_product_form_advanced_pricing_modal .admin__control-table-wrapper { overflow-x: visible; overflow-y: visible; } From 45592e234b8ee700b02e82c28c9c7ee94ae13b51 Mon Sep 17 00:00:00 2001 From: Andrea Zambon <azambon@webgriffe.com> Date: Mon, 2 Dec 2019 12:29:52 +0100 Subject: [PATCH 0199/1143] Sets the order to state processing also if the order is in state new or pending_payment --- .../RegisterCaptureNotificationCommand.php | 18 +++++++++++++++--- .../RegisterCaptureNotificationCommandTest.php | 16 ++++++++++++++++ 2 files changed, 31 insertions(+), 3 deletions(-) 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 d38e58d7341c1..d8afcc71cc6af 100644 --- a/app/code/Magento/Sales/Model/Order/Payment/State/RegisterCaptureNotificationCommand.php +++ b/app/code/Magento/Sales/Model/Order/Payment/State/RegisterCaptureNotificationCommand.php @@ -11,6 +11,11 @@ use Magento\Sales\Model\Order; use Magento\Sales\Model\Order\StatusResolver; +/** + * Class RegisterCaptureNotificationCommand + * + * @package Magento\Sales\Model\Order\Payment\State + */ class RegisterCaptureNotificationCommand implements CommandInterface { /** @@ -23,11 +28,12 @@ class RegisterCaptureNotificationCommand implements CommandInterface */ public function __construct(StatusResolver $statusResolver = null) { - $this->statusResolver = $statusResolver - ? : ObjectManager::getInstance()->get(StatusResolver::class); + $this->statusResolver = $statusResolver ?: ObjectManager::getInstance()->get(StatusResolver::class); } /** + * Registers a capture event for this payment + * * @param OrderPaymentInterface $payment * @param string|float|int $amount * @param OrderInterface $order @@ -35,7 +41,11 @@ public function __construct(StatusResolver $statusResolver = null) */ public function execute(OrderPaymentInterface $payment, $amount, OrderInterface $order) { - $state = $order->getState() ?: Order::STATE_PROCESSING; + $state = $order->getState(); + if (!$state || $state === Order::STATE_NEW || $state === Order::STATE_PENDING_PAYMENT) { + $state = Order::STATE_PROCESSING; + } + $status = null; $message = 'Registered notification about captured amount of %1.'; @@ -61,6 +71,8 @@ public function execute(OrderPaymentInterface $payment, $amount, OrderInterface } /** + * Sets the state and status of the order + * * @deprecated 100.2.0 Replaced by a StatusResolver class call. * * @param Order $order 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 1b762fafe0b71..c5c333e55a551 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 @@ -80,6 +80,22 @@ public function commandResultDataProvider() $this->newOrderStatus, 'Registered notification about captured amount of %1.', ], + [ + false, + false, + Order::STATE_NEW, + Order::STATE_PROCESSING, + $this->newOrderStatus, + 'Registered notification about captured amount of %1.', + ], + [ + false, + false, + Order::STATE_PENDING_PAYMENT, + Order::STATE_PROCESSING, + $this->newOrderStatus, + 'Registered notification about captured amount of %1.', + ], [ true, false, From 386f4d2ee393f3162277ca7f861db3a87ec82641 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Fri, 29 Nov 2019 17:56:39 +0200 Subject: [PATCH 0200/1143] Test for: magento/magento2#25585. --- .../StorefrontCompareActionGroup.xml | 2 + ...AttributeWithoutValueInCompareListTest.xml | 81 +++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/ProductAttributeWithoutValueInCompareListTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCompareActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCompareActionGroup.xml index b10b74c919918..706de58a87840 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCompareActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCompareActionGroup.xml @@ -32,6 +32,8 @@ <argument name="productVar"/> </arguments> + <waitForElementVisible selector="{{StorefrontProductInfoMainSection.productAddToCompare}}" + stepKey="seeAddToCompareLink"/> <click selector="{{StorefrontProductInfoMainSection.productAddToCompare}}" stepKey="clickAddToCompare"/> <waitForElement selector="{{StorefrontMessagesSection.success}}" time="30" stepKey="waitForAddProductToCompareSuccessMessage"/> <see selector="{{StorefrontMessagesSection.success}}" userInput="You added product {{productVar.name}} to the comparison list." stepKey="assertAddProductToCompareSuccessMessage"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/ProductAttributeWithoutValueInCompareListTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/ProductAttributeWithoutValueInCompareListTest.xml new file mode 100644 index 0000000000000..f926a2aa2f4ad --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/ProductAttributeWithoutValueInCompareListTest.xml @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="ProductAttributeWithoutValueInCompareListTest"> + <annotations> + <features value="Catalog"/> + <title value="Product attribute without value in compare list test"/> + <description + value="The product attribute that has no value should output 'N/A' on the product comparison page."/> + <severity value="MINOR"/> + <group value="Catalog"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <createData entity="textProductAttribute" stepKey="createProductAttribute"/> + <createData entity="CatalogAttributeSet" stepKey="createAttributeSet"/> + <amOnPage url="{{AdminProductAttributeSetEditPage.url}}/$$createAttributeSet.attribute_set_id$$/" + stepKey="onAttributeSetEdit"/> + <actionGroup ref="AssignAttributeToGroup" stepKey="assignAttributeToGroup"> + <argument name="group" value="Product Details"/> + <argument name="attribute" value="$$createProductAttribute.attribute_code$$"/> + </actionGroup> + <actionGroup ref="SaveAttributeSet" stepKey="SaveAttributeSet"/> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <createData entity="_defaultProduct" stepKey="createProductDefault"> + <requiredEntity createDataKey="createCategory"/> + </createData> + <createData entity="SimpleProductWithCustomAttributeSet" stepKey="createProductCustom"> + <requiredEntity createDataKey="createCategory"/> + <requiredEntity createDataKey="createAttributeSet"/> + </createData> + </before> + <after> + <deleteData createDataKey="createProductDefault" stepKey="deleteProductDefault"/> + <deleteData createDataKey="createProductCustom" stepKey="deleteProductCustom"/> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <deleteData createDataKey="createAttributeSet" stepKey="deleteAttributeSet"/> + <deleteData createDataKey="createProductAttribute" stepKey="deleteProductAttribute"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!--Open product page--> + <amOnPage url="{{StorefrontProductPage.url($$createProductDefault.name$$)}}" stepKey="goToProductDefaultPage"/> + <waitForPageLoad stepKey="waitForProductPage"/> + <!--Click on 'Add to Compare' link--> + <actionGroup ref="StorefrontAddProductToCompareActionGroup" stepKey="clickOnAddToCompare"> + <argument name="productVar" value="$$createProductDefault$$"/> + </actionGroup> + <!--See product in the comparison list--> + <amOnPage url="{{StorefrontProductComparePage.url}}" stepKey="navigateToComparePage"/> + <waitForPageLoad stepKey="waitForStorefrontProductComparePageLoad"/> + <seeElement selector="{{StorefrontProductCompareMainSection.ProductLinkByName($createProductDefault.name$)}}" + stepKey="seeProductInCompareList"/> + <!--Open product with custom attribute page--> + <amOnPage url="{{StorefrontProductPage.url($$createProductCustom.name$$)}}" stepKey="goToProductCustomPage"/> + <waitForPageLoad stepKey="waitForProductCustomPage"/> + <!--Click on 'Add to Compare' link--> + <actionGroup ref="StorefrontAddProductToCompareActionGroup" stepKey="clickOnAddToCompareCustom"> + <argument name="productVar" value="$$createProductCustom$$"/> + </actionGroup> + <!--See product with custom attribute in the comparison list--> + <amOnPage url="{{StorefrontProductComparePage.url}}" stepKey="navigateToComparePageCustom"/> + <waitForPageLoad stepKey="waitForStorefrontProductCustomComparePageLoad"/> + <seeElement selector="{{StorefrontProductCompareMainSection.ProductLinkByName($createProductCustom.name$)}}" + stepKey="seeProductCustomInCompareList"/> + <!--See attribute default value in the comparison list--> + <see userInput="$createProductAttribute.defaultValue$" + selector="{{StorefrontProductCompareMainSection.ProductAttributeByCodeAndProductName(ProductAttributeFrontendLabel.label, $createProductCustom.name$)}}" + stepKey="assertAttributeValueForProductCustom"/> + <!--See N/A if attribute has no value in the comparison list--> + <see userInput="N/A" + selector="{{StorefrontProductCompareMainSection.ProductAttributeByCodeAndProductName(ProductAttributeFrontendLabel.label, $createProductDefault.name$)}}" + stepKey="assertNAForProductDefault"/> + </test> +</tests> From b6ef1b3f935fb04bfbeacaa739e17296e570c0b6 Mon Sep 17 00:00:00 2001 From: Willem Wigman <wigman@users.noreply.github.com> Date: Mon, 2 Dec 2019 15:09:31 +0100 Subject: [PATCH 0201/1143] Test 4 --- .../Magento/Search/Test/Unit/Model/PopularSearchTermsTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Search/Test/Unit/Model/PopularSearchTermsTest.php b/app/code/Magento/Search/Test/Unit/Model/PopularSearchTermsTest.php index af48bdc516596..70f25e2f12e16 100644 --- a/app/code/Magento/Search/Test/Unit/Model/PopularSearchTermsTest.php +++ b/app/code/Magento/Search/Test/Unit/Model/PopularSearchTermsTest.php @@ -57,7 +57,8 @@ public function testIsCacheable() $storeId = 1; $pageSize = 35; - $this->scopeConfigMock->expects($this->once())->method('getValue') + $this->scopeConfigMock->expects($this->exactly(2)) + ->method('getValue') ->with( PopularSearchTerms::XML_PATH_MAX_COUNT_CACHEABLE_SEARCH_TERMS, ScopeInterface::SCOPE_STORE, From 28542922e9914d169ddb41ce1f83ce44cc063982 Mon Sep 17 00:00:00 2001 From: Dmytro Voskoboinikov <voskoboi@adobe.com> Date: Mon, 2 Dec 2019 15:06:05 -0600 Subject: [PATCH 0202/1143] MC-23177: Update of Moment.js library --- lib/web/moment.js | 557 +--------------------------------------------- 1 file changed, 6 insertions(+), 551 deletions(-) diff --git a/lib/web/moment.js b/lib/web/moment.js index d34d1c6329e59..ee598a90a83f0 100644 --- a/lib/web/moment.js +++ b/lib/web/moment.js @@ -1,551 +1,6 @@ -//! moment.js -//! version : 2.17.1 -//! authors : Tim Wood, Iskren Chernev, Moment.js contributors -//! license : MIT -//! momentjs.com -!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.moment=b()}(this,function(){"use strict";function a(){return od.apply(null,arguments)} -// This is done to register the method called with moment() -// without creating circular dependencies. - function b(a){od=a}function c(a){return a instanceof Array||"[object Array]"===Object.prototype.toString.call(a)}function d(a){ -// IE8 will treat undefined and null as object if it wasn't for -// input != null - return null!=a&&"[object Object]"===Object.prototype.toString.call(a)}function e(a){var b;for(b in a) -// even if its not own property I'd still call it non-empty - return!1;return!0}function f(a){return"number"==typeof a||"[object Number]"===Object.prototype.toString.call(a)}function g(a){return a instanceof Date||"[object Date]"===Object.prototype.toString.call(a)}function h(a,b){var c,d=[];for(c=0;c<a.length;++c)d.push(b(a[c],c));return d}function i(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function j(a,b){for(var c in b)i(b,c)&&(a[c]=b[c]);return i(b,"toString")&&(a.toString=b.toString),i(b,"valueOf")&&(a.valueOf=b.valueOf),a}function k(a,b,c,d){return rb(a,b,c,d,!0).utc()}function l(){ -// We need to deep clone this object. - return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null}}function m(a){return null==a._pf&&(a._pf=l()),a._pf}function n(a){if(null==a._isValid){var b=m(a),c=qd.call(b.parsedDateParts,function(a){return null!=a}),d=!isNaN(a._d.getTime())&&b.overflow<0&&!b.empty&&!b.invalidMonth&&!b.invalidWeekday&&!b.nullInput&&!b.invalidFormat&&!b.userInvalidated&&(!b.meridiem||b.meridiem&&c);if(a._strict&&(d=d&&0===b.charsLeftOver&&0===b.unusedTokens.length&&void 0===b.bigHour),null!=Object.isFrozen&&Object.isFrozen(a))return d;a._isValid=d}return a._isValid}function o(a){var b=k(NaN);return null!=a?j(m(b),a):m(b).userInvalidated=!0,b}function p(a){return void 0===a}function q(a,b){var c,d,e;if(p(b._isAMomentObject)||(a._isAMomentObject=b._isAMomentObject),p(b._i)||(a._i=b._i),p(b._f)||(a._f=b._f),p(b._l)||(a._l=b._l),p(b._strict)||(a._strict=b._strict),p(b._tzm)||(a._tzm=b._tzm),p(b._isUTC)||(a._isUTC=b._isUTC),p(b._offset)||(a._offset=b._offset),p(b._pf)||(a._pf=m(b)),p(b._locale)||(a._locale=b._locale),rd.length>0)for(c in rd)d=rd[c],e=b[d],p(e)||(a[d]=e);return a} -// Moment prototype object - function r(b){q(this,b),this._d=new Date(null!=b._d?b._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)), -// Prevent infinite loop in case updateOffset creates new moment -// objects. - sd===!1&&(sd=!0,a.updateOffset(this),sd=!1)}function s(a){return a instanceof r||null!=a&&null!=a._isAMomentObject}function t(a){return a<0?Math.ceil(a)||0:Math.floor(a)}function u(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=t(b)),c} -// compare two arrays, return the number of differences - function v(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;d<e;d++)(c&&a[d]!==b[d]||!c&&u(a[d])!==u(b[d]))&&g++;return g+f}function w(b){a.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+b)}function x(b,c){var d=!0;return j(function(){if(null!=a.deprecationHandler&&a.deprecationHandler(null,b),d){for(var e,f=[],g=0;g<arguments.length;g++){if(e="","object"==typeof arguments[g]){e+="\n["+g+"] ";for(var h in arguments[0])e+=h+": "+arguments[0][h]+", ";e=e.slice(0,-2)}else e=arguments[g];f.push(e)}w(b+"\nArguments: "+Array.prototype.slice.call(f).join("")+"\n"+(new Error).stack),d=!1}return c.apply(this,arguments)},c)}function y(b,c){null!=a.deprecationHandler&&a.deprecationHandler(b,c),td[b]||(w(c),td[b]=!0)}function z(a){return a instanceof Function||"[object Function]"===Object.prototype.toString.call(a)}function A(a){var b,c;for(c in a)b=a[c],z(b)?this[c]=b:this["_"+c]=b;this._config=a, -// Lenient ordinal parsing accepts just a number in addition to -// number + (possibly) stuff coming from _ordinalParseLenient. - this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function B(a,b){var c,e=j({},a);for(c in b)i(b,c)&&(d(a[c])&&d(b[c])?(e[c]={},j(e[c],a[c]),j(e[c],b[c])):null!=b[c]?e[c]=b[c]:delete e[c]);for(c in a)i(a,c)&&!i(b,c)&&d(a[c])&&( -// make sure changes to properties don't modify parent config - e[c]=j({},e[c]));return e}function C(a){null!=a&&this.set(a)}function D(a,b,c){var d=this._calendar[a]||this._calendar.sameElse;return z(d)?d.call(b,c):d}function E(a){var b=this._longDateFormat[a],c=this._longDateFormat[a.toUpperCase()];return b||!c?b:(this._longDateFormat[a]=c.replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a])}function F(){return this._invalidDate}function G(a){return this._ordinal.replace("%d",a)}function H(a,b,c,d){var e=this._relativeTime[c];return z(e)?e(a,b,c,d):e.replace(/%d/i,a)}function I(a,b){var c=this._relativeTime[a>0?"future":"past"];return z(c)?c(b):c.replace(/%s/i,b)}function J(a,b){var c=a.toLowerCase();Dd[c]=Dd[c+"s"]=Dd[b]=a}function K(a){return"string"==typeof a?Dd[a]||Dd[a.toLowerCase()]:void 0}function L(a){var b,c,d={};for(c in a)i(a,c)&&(b=K(c),b&&(d[b]=a[c]));return d}function M(a,b){Ed[a]=b}function N(a){var b=[];for(var c in a)b.push({unit:c,priority:Ed[c]});return b.sort(function(a,b){return a.priority-b.priority}),b}function O(b,c){return function(d){return null!=d?(Q(this,b,d),a.updateOffset(this,c),this):P(this,b)}}function P(a,b){return a.isValid()?a._d["get"+(a._isUTC?"UTC":"")+b]():NaN}function Q(a,b,c){a.isValid()&&a._d["set"+(a._isUTC?"UTC":"")+b](c)} -// MOMENTS - function R(a){return a=K(a),z(this[a])?this[a]():this}function S(a,b){if("object"==typeof a){a=L(a);for(var c=N(a),d=0;d<c.length;d++)this[c[d].unit](a[c[d].unit])}else if(a=K(a),z(this[a]))return this[a](b);return this}function T(a,b,c){var d=""+Math.abs(a),e=b-d.length,f=a>=0;return(f?c?"+":"":"-")+Math.pow(10,Math.max(0,e)).toString().substr(1)+d} -// token: 'M' -// padded: ['MM', 2] -// ordinal: 'Mo' -// callback: function () { this.month() + 1 } - function U(a,b,c,d){var e=d;"string"==typeof d&&(e=function(){return this[d]()}),a&&(Id[a]=e),b&&(Id[b[0]]=function(){return T(e.apply(this,arguments),b[1],b[2])}),c&&(Id[c]=function(){return this.localeData().ordinal(e.apply(this,arguments),a)})}function V(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function W(a){var b,c,d=a.match(Fd);for(b=0,c=d.length;b<c;b++)Id[d[b]]?d[b]=Id[d[b]]:d[b]=V(d[b]);return function(b){var e,f="";for(e=0;e<c;e++)f+=d[e]instanceof Function?d[e].call(b,a):d[e];return f}} -// format date using native date object - function X(a,b){return a.isValid()?(b=Y(b,a.localeData()),Hd[b]=Hd[b]||W(b),Hd[b](a)):a.localeData().invalidDate()}function Y(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(Gd.lastIndex=0;d>=0&&Gd.test(a);)a=a.replace(Gd,c),Gd.lastIndex=0,d-=1;return a}function Z(a,b,c){$d[a]=z(b)?b:function(a,d){return a&&c?c:b}}function $(a,b){return i($d,a)?$d[a](b._strict,b._locale):new RegExp(_(a))} -// Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript - function _(a){return aa(a.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e}))}function aa(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function ba(a,b){var c,d=b;for("string"==typeof a&&(a=[a]),f(b)&&(d=function(a,c){c[b]=u(a)}),c=0;c<a.length;c++)_d[a[c]]=d}function ca(a,b){ba(a,function(a,c,d,e){d._w=d._w||{},b(a,d._w,d,e)})}function da(a,b,c){null!=b&&i(_d,a)&&_d[a](b,c._a,c,a)}function ea(a,b){return new Date(Date.UTC(a,b+1,0)).getUTCDate()}function fa(a,b){return a?c(this._months)?this._months[a.month()]:this._months[(this._months.isFormat||ke).test(b)?"format":"standalone"][a.month()]:this._months}function ga(a,b){return a?c(this._monthsShort)?this._monthsShort[a.month()]:this._monthsShort[ke.test(b)?"format":"standalone"][a.month()]:this._monthsShort}function ha(a,b,c){var d,e,f,g=a.toLocaleLowerCase();if(!this._monthsParse)for( -// this is not used - this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],d=0;d<12;++d)f=k([2e3,d]),this._shortMonthsParse[d]=this.monthsShort(f,"").toLocaleLowerCase(),this._longMonthsParse[d]=this.months(f,"").toLocaleLowerCase();return c?"MMM"===b?(e=je.call(this._shortMonthsParse,g),e!==-1?e:null):(e=je.call(this._longMonthsParse,g),e!==-1?e:null):"MMM"===b?(e=je.call(this._shortMonthsParse,g),e!==-1?e:(e=je.call(this._longMonthsParse,g),e!==-1?e:null)):(e=je.call(this._longMonthsParse,g),e!==-1?e:(e=je.call(this._shortMonthsParse,g),e!==-1?e:null))}function ia(a,b,c){var d,e,f;if(this._monthsParseExact)return ha.call(this,a,b,c); -// TODO: add sorting -// Sorting makes sure if one month (or abbr) is a prefix of another -// see sorting in computeMonthsParse - for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),d=0;d<12;d++){ -// test the regex - if( -// make the regex if we don't have it already - e=k([2e3,d]),c&&!this._longMonthsParse[d]&&(this._longMonthsParse[d]=new RegExp("^"+this.months(e,"").replace(".","")+"$","i"),this._shortMonthsParse[d]=new RegExp("^"+this.monthsShort(e,"").replace(".","")+"$","i")),c||this._monthsParse[d]||(f="^"+this.months(e,"")+"|^"+this.monthsShort(e,""),this._monthsParse[d]=new RegExp(f.replace(".",""),"i")),c&&"MMMM"===b&&this._longMonthsParse[d].test(a))return d;if(c&&"MMM"===b&&this._shortMonthsParse[d].test(a))return d;if(!c&&this._monthsParse[d].test(a))return d}} -// MOMENTS - function ja(a,b){var c;if(!a.isValid()) -// No op - return a;if("string"==typeof b)if(/^\d+$/.test(b))b=u(b);else -// TODO: Another silent failure? - if(b=a.localeData().monthsParse(b),!f(b))return a;return c=Math.min(a.date(),ea(a.year(),b)),a._d["set"+(a._isUTC?"UTC":"")+"Month"](b,c),a}function ka(b){return null!=b?(ja(this,b),a.updateOffset(this,!0),this):P(this,"Month")}function la(){return ea(this.year(),this.month())}function ma(a){return this._monthsParseExact?(i(this,"_monthsRegex")||oa.call(this),a?this._monthsShortStrictRegex:this._monthsShortRegex):(i(this,"_monthsShortRegex")||(this._monthsShortRegex=ne),this._monthsShortStrictRegex&&a?this._monthsShortStrictRegex:this._monthsShortRegex)}function na(a){return this._monthsParseExact?(i(this,"_monthsRegex")||oa.call(this),a?this._monthsStrictRegex:this._monthsRegex):(i(this,"_monthsRegex")||(this._monthsRegex=oe),this._monthsStrictRegex&&a?this._monthsStrictRegex:this._monthsRegex)}function oa(){function a(a,b){return b.length-a.length}var b,c,d=[],e=[],f=[];for(b=0;b<12;b++) -// make the regex if we don't have it already - c=k([2e3,b]),d.push(this.monthsShort(c,"")),e.push(this.months(c,"")),f.push(this.months(c,"")),f.push(this.monthsShort(c,""));for( -// Sorting makes sure if one month (or abbr) is a prefix of another it -// will match the longer piece. - d.sort(a),e.sort(a),f.sort(a),b=0;b<12;b++)d[b]=aa(d[b]),e[b]=aa(e[b]);for(b=0;b<24;b++)f[b]=aa(f[b]);this._monthsRegex=new RegExp("^("+f.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+e.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+d.join("|")+")","i")} -// HELPERS - function pa(a){return qa(a)?366:365}function qa(a){return a%4===0&&a%100!==0||a%400===0}function ra(){return qa(this.year())}function sa(a,b,c,d,e,f,g){ -//can't just apply() to create a date: -//http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply - var h=new Date(a,b,c,d,e,f,g); -//the date constructor remaps years 0-99 to 1900-1999 - return a<100&&a>=0&&isFinite(h.getFullYear())&&h.setFullYear(a),h}function ta(a){var b=new Date(Date.UTC.apply(null,arguments)); -//the Date.UTC function remaps years 0-99 to 1900-1999 - return a<100&&a>=0&&isFinite(b.getUTCFullYear())&&b.setUTCFullYear(a),b} -// start-of-first-week - start-of-year - function ua(a,b,c){var// first-week day -- which january is always in the first week (4 for iso, 1 for other) - d=7+b-c, -// first-week day local weekday -- which local weekday is fwd - e=(7+ta(a,0,d).getUTCDay()-b)%7;return-e+d-1} -//http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday - function va(a,b,c,d,e){var f,g,h=(7+c-d)%7,i=ua(a,d,e),j=1+7*(b-1)+h+i;return j<=0?(f=a-1,g=pa(f)+j):j>pa(a)?(f=a+1,g=j-pa(a)):(f=a,g=j),{year:f,dayOfYear:g}}function wa(a,b,c){var d,e,f=ua(a.year(),b,c),g=Math.floor((a.dayOfYear()-f-1)/7)+1;return g<1?(e=a.year()-1,d=g+xa(e,b,c)):g>xa(a.year(),b,c)?(d=g-xa(a.year(),b,c),e=a.year()+1):(e=a.year(),d=g),{week:d,year:e}}function xa(a,b,c){var d=ua(a,b,c),e=ua(a+1,b,c);return(pa(a)-d+e)/7} -// HELPERS -// LOCALES - function ya(a){return wa(a,this._week.dow,this._week.doy).week}function za(){return this._week.dow}function Aa(){return this._week.doy} -// MOMENTS - function Ba(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")}function Ca(a){var b=wa(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")} -// HELPERS - function Da(a,b){return"string"!=typeof a?a:isNaN(a)?(a=b.weekdaysParse(a),"number"==typeof a?a:null):parseInt(a,10)}function Ea(a,b){return"string"==typeof a?b.weekdaysParse(a)%7||7:isNaN(a)?null:a}function Fa(a,b){return a?c(this._weekdays)?this._weekdays[a.day()]:this._weekdays[this._weekdays.isFormat.test(b)?"format":"standalone"][a.day()]:this._weekdays}function Ga(a){return a?this._weekdaysShort[a.day()]:this._weekdaysShort}function Ha(a){return a?this._weekdaysMin[a.day()]:this._weekdaysMin}function Ia(a,b,c){var d,e,f,g=a.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],d=0;d<7;++d)f=k([2e3,1]).day(d),this._minWeekdaysParse[d]=this.weekdaysMin(f,"").toLocaleLowerCase(),this._shortWeekdaysParse[d]=this.weekdaysShort(f,"").toLocaleLowerCase(),this._weekdaysParse[d]=this.weekdays(f,"").toLocaleLowerCase();return c?"dddd"===b?(e=je.call(this._weekdaysParse,g),e!==-1?e:null):"ddd"===b?(e=je.call(this._shortWeekdaysParse,g),e!==-1?e:null):(e=je.call(this._minWeekdaysParse,g),e!==-1?e:null):"dddd"===b?(e=je.call(this._weekdaysParse,g),e!==-1?e:(e=je.call(this._shortWeekdaysParse,g),e!==-1?e:(e=je.call(this._minWeekdaysParse,g),e!==-1?e:null))):"ddd"===b?(e=je.call(this._shortWeekdaysParse,g),e!==-1?e:(e=je.call(this._weekdaysParse,g),e!==-1?e:(e=je.call(this._minWeekdaysParse,g),e!==-1?e:null))):(e=je.call(this._minWeekdaysParse,g),e!==-1?e:(e=je.call(this._weekdaysParse,g),e!==-1?e:(e=je.call(this._shortWeekdaysParse,g),e!==-1?e:null)))}function Ja(a,b,c){var d,e,f;if(this._weekdaysParseExact)return Ia.call(this,a,b,c);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),d=0;d<7;d++){ -// test the regex - if( -// make the regex if we don't have it already - e=k([2e3,1]).day(d),c&&!this._fullWeekdaysParse[d]&&(this._fullWeekdaysParse[d]=new RegExp("^"+this.weekdays(e,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[d]=new RegExp("^"+this.weekdaysShort(e,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[d]=new RegExp("^"+this.weekdaysMin(e,"").replace(".",".?")+"$","i")),this._weekdaysParse[d]||(f="^"+this.weekdays(e,"")+"|^"+this.weekdaysShort(e,"")+"|^"+this.weekdaysMin(e,""),this._weekdaysParse[d]=new RegExp(f.replace(".",""),"i")),c&&"dddd"===b&&this._fullWeekdaysParse[d].test(a))return d;if(c&&"ddd"===b&&this._shortWeekdaysParse[d].test(a))return d;if(c&&"dd"===b&&this._minWeekdaysParse[d].test(a))return d;if(!c&&this._weekdaysParse[d].test(a))return d}} -// MOMENTS - function Ka(a){if(!this.isValid())return null!=a?this:NaN;var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=Da(a,this.localeData()),this.add(a-b,"d")):b}function La(a){if(!this.isValid())return null!=a?this:NaN;var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")}function Ma(a){if(!this.isValid())return null!=a?this:NaN; -// behaves the same as moment#day except -// as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) -// as a setter, sunday should belong to the previous week. - if(null!=a){var b=Ea(a,this.localeData());return this.day(this.day()%7?b:b-7)}return this.day()||7}function Na(a){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Qa.call(this),a?this._weekdaysStrictRegex:this._weekdaysRegex):(i(this,"_weekdaysRegex")||(this._weekdaysRegex=ue),this._weekdaysStrictRegex&&a?this._weekdaysStrictRegex:this._weekdaysRegex)}function Oa(a){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Qa.call(this),a?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(i(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=ve),this._weekdaysShortStrictRegex&&a?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Pa(a){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Qa.call(this),a?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(i(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=we),this._weekdaysMinStrictRegex&&a?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Qa(){function a(a,b){return b.length-a.length}var b,c,d,e,f,g=[],h=[],i=[],j=[];for(b=0;b<7;b++) -// make the regex if we don't have it already - c=k([2e3,1]).day(b),d=this.weekdaysMin(c,""),e=this.weekdaysShort(c,""),f=this.weekdays(c,""),g.push(d),h.push(e),i.push(f),j.push(d),j.push(e),j.push(f);for( -// Sorting makes sure if one weekday (or abbr) is a prefix of another it -// will match the longer piece. - g.sort(a),h.sort(a),i.sort(a),j.sort(a),b=0;b<7;b++)h[b]=aa(h[b]),i[b]=aa(i[b]),j[b]=aa(j[b]);this._weekdaysRegex=new RegExp("^("+j.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+h.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+g.join("|")+")","i")} -// FORMATTING - function Ra(){return this.hours()%12||12}function Sa(){return this.hours()||24}function Ta(a,b){U(a,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),b)})} -// PARSING - function Ua(a,b){return b._meridiemParse} -// LOCALES - function Va(a){ -// IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays -// Using charAt should be more compatible. - return"p"===(a+"").toLowerCase().charAt(0)}function Wa(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"}function Xa(a){return a?a.toLowerCase().replace("_","-"):a} -// pick the locale from the array -// try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each -// substring from most specific to least, but move to the next array item if it's a more specific variant than the current root - function Ya(a){for(var b,c,d,e,f=0;f<a.length;){for(e=Xa(a[f]).split("-"),b=e.length,c=Xa(a[f+1]),c=c?c.split("-"):null;b>0;){if(d=Za(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&v(e,c,!0)>=b-1) -//the next array item is better than a shallower substring of this one - break;b--}f++}return null}function Za(a){var b=null; -// TODO: Find a better way to register and load all the locales in Node - if(!Be[a]&&"undefined"!=typeof module&&module&&module.exports)try{b=xe._abbr,require("./locale/"+a), -// because defineLocale currently also sets the global locale, we -// want to undo that for lazy loaded locales - $a(b)}catch(a){}return Be[a]} -// This function will load locale and then set the global locale. If -// no arguments are passed in, it will simply return the current global -// locale key. - function $a(a,b){var c; -// moment.duration._locale = moment._locale = data; - return a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}function _a(a,b){if(null!==b){var c=Ae;if(b.abbr=a,null!=Be[a])y("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),c=Be[a]._config;else if(null!=b.parentLocale){if(null==Be[b.parentLocale])return Ce[b.parentLocale]||(Ce[b.parentLocale]=[]),Ce[b.parentLocale].push({name:a,config:b}),null;c=Be[b.parentLocale]._config} -// backwards compat for now: also set the locale -// make sure we set the locale AFTER all child locales have been -// created, so we won't end up with the child locale set. - return Be[a]=new C(B(c,b)),Ce[a]&&Ce[a].forEach(function(a){_a(a.name,a.config)}),$a(a),Be[a]} -// useful for testing - return delete Be[a],null}function ab(a,b){if(null!=b){var c,d=Ae; -// MERGE - null!=Be[a]&&(d=Be[a]._config),b=B(d,b),c=new C(b),c.parentLocale=Be[a],Be[a]=c, -// backwards compat for now: also set the locale - $a(a)}else -// pass null for config to unupdate, useful for tests - null!=Be[a]&&(null!=Be[a].parentLocale?Be[a]=Be[a].parentLocale:null!=Be[a]&&delete Be[a]);return Be[a]} -// returns locale data - function bb(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return xe;if(!c(a)){if( -//short-circuit everything else - b=Za(a))return b;a=[a]}return Ya(a)}function cb(){return wd(Be)}function db(a){var b,c=a._a;return c&&m(a).overflow===-2&&(b=c[be]<0||c[be]>11?be:c[ce]<1||c[ce]>ea(c[ae],c[be])?ce:c[de]<0||c[de]>24||24===c[de]&&(0!==c[ee]||0!==c[fe]||0!==c[ge])?de:c[ee]<0||c[ee]>59?ee:c[fe]<0||c[fe]>59?fe:c[ge]<0||c[ge]>999?ge:-1,m(a)._overflowDayOfYear&&(b<ae||b>ce)&&(b=ce),m(a)._overflowWeeks&&b===-1&&(b=he),m(a)._overflowWeekday&&b===-1&&(b=ie),m(a).overflow=b),a} -// date from iso format - function eb(a){var b,c,d,e,f,g,h=a._i,i=De.exec(h)||Ee.exec(h);if(i){for(m(a).iso=!0,b=0,c=Ge.length;b<c;b++)if(Ge[b][1].exec(i[1])){e=Ge[b][0],d=Ge[b][2]!==!1;break}if(null==e)return void(a._isValid=!1);if(i[3]){for(b=0,c=He.length;b<c;b++)if(He[b][1].exec(i[3])){ -// match[2] should be 'T' or space - f=(i[2]||" ")+He[b][0];break}if(null==f)return void(a._isValid=!1)}if(!d&&null!=f)return void(a._isValid=!1);if(i[4]){if(!Fe.exec(i[4]))return void(a._isValid=!1);g="Z"}a._f=e+(f||"")+(g||""),kb(a)}else a._isValid=!1} -// date from iso format or fallback - function fb(b){var c=Ie.exec(b._i);return null!==c?void(b._d=new Date(+c[1])):(eb(b),void(b._isValid===!1&&(delete b._isValid,a.createFromInputFallback(b))))} -// Pick the first defined of two or three arguments. - function gb(a,b,c){return null!=a?a:null!=b?b:c}function hb(b){ -// hooks is actually the exported moment object - var c=new Date(a.now());return b._useUTC?[c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()]:[c.getFullYear(),c.getMonth(),c.getDate()]} -// convert an array to a date. -// the array should mirror the parameters below -// note: all values past the year are optional and will default to the lowest possible value. -// [year, month, day , hour, minute, second, millisecond] - function ib(a){var b,c,d,e,f=[];if(!a._d){ -// Default to current date. -// * if no year, month, day of month are given, default to today -// * if day of month is given, default month and year -// * if month is given, default only year -// * if year is given, don't default anything - for(d=hb(a), -//compute day of the year from weeks and weekdays - a._w&&null==a._a[ce]&&null==a._a[be]&&jb(a), -//if the day of the year is set, figure out what it is - a._dayOfYear&&(e=gb(a._a[ae],d[ae]),a._dayOfYear>pa(e)&&(m(a)._overflowDayOfYear=!0),c=ta(e,0,a._dayOfYear),a._a[be]=c.getUTCMonth(),a._a[ce]=c.getUTCDate()),b=0;b<3&&null==a._a[b];++b)a._a[b]=f[b]=d[b]; -// Zero out whatever was not defaulted, including time - for(;b<7;b++)a._a[b]=f[b]=null==a._a[b]?2===b?1:0:a._a[b]; -// Check for 24:00:00.000 - 24===a._a[de]&&0===a._a[ee]&&0===a._a[fe]&&0===a._a[ge]&&(a._nextDay=!0,a._a[de]=0),a._d=(a._useUTC?ta:sa).apply(null,f), -// Apply timezone offset from input. The actual utcOffset can be changed -// with parseZone. - null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()-a._tzm),a._nextDay&&(a._a[de]=24)}}function jb(a){var b,c,d,e,f,g,h,i;if(b=a._w,null!=b.GG||null!=b.W||null!=b.E)f=1,g=4, -// TODO: We need to take the current isoWeekYear, but that depends on -// how we interpret now (local, utc, fixed offset). So create -// a now version of current config (take local/utc/offset flags, and -// create now). - c=gb(b.GG,a._a[ae],wa(sb(),1,4).year),d=gb(b.W,1),e=gb(b.E,1),(e<1||e>7)&&(i=!0);else{f=a._locale._week.dow,g=a._locale._week.doy;var j=wa(sb(),f,g);c=gb(b.gg,a._a[ae],j.year), -// Default to current week. - d=gb(b.w,j.week),null!=b.d?( -// weekday -- low day numbers are considered next week - e=b.d,(e<0||e>6)&&(i=!0)):null!=b.e?( -// local weekday -- counting starts from begining of week - e=b.e+f,(b.e<0||b.e>6)&&(i=!0)): -// default to begining of week - e=f}d<1||d>xa(c,f,g)?m(a)._overflowWeeks=!0:null!=i?m(a)._overflowWeekday=!0:(h=va(c,d,e,f,g),a._a[ae]=h.year,a._dayOfYear=h.dayOfYear)} -// date from string and format string - function kb(b){ -// TODO: Move this to another part of the creation flow to prevent circular deps - if(b._f===a.ISO_8601)return void eb(b);b._a=[],m(b).empty=!0; -// This array is used to make a Date, either with `new Date` or `Date.UTC` - var c,d,e,f,g,h=""+b._i,i=h.length,j=0;for(e=Y(b._f,b._locale).match(Fd)||[],c=0;c<e.length;c++)f=e[c],d=(h.match($(f,b))||[])[0], -// console.log('token', token, 'parsedInput', parsedInput, -// 'regex', getParseRegexForToken(token, config)); - d&&(g=h.substr(0,h.indexOf(d)),g.length>0&&m(b).unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),j+=d.length), -// don't parse if it's not a known token - Id[f]?(d?m(b).empty=!1:m(b).unusedTokens.push(f),da(f,d,b)):b._strict&&!d&&m(b).unusedTokens.push(f); -// add remaining unparsed input length to the string - m(b).charsLeftOver=i-j,h.length>0&&m(b).unusedInput.push(h), -// clear _12h flag if hour is <= 12 - b._a[de]<=12&&m(b).bigHour===!0&&b._a[de]>0&&(m(b).bigHour=void 0),m(b).parsedDateParts=b._a.slice(0),m(b).meridiem=b._meridiem, -// handle meridiem - b._a[de]=lb(b._locale,b._a[de],b._meridiem),ib(b),db(b)}function lb(a,b,c){var d; -// Fallback - return null==c?b:null!=a.meridiemHour?a.meridiemHour(b,c):null!=a.isPM?(d=a.isPM(c),d&&b<12&&(b+=12),d||12!==b||(b=0),b):b} -// date from string and array of format strings - function mb(a){var b,c,d,e,f;if(0===a._f.length)return m(a).invalidFormat=!0,void(a._d=new Date(NaN));for(e=0;e<a._f.length;e++)f=0,b=q({},a),null!=a._useUTC&&(b._useUTC=a._useUTC),b._f=a._f[e],kb(b),n(b)&&( -// if there is any input that was not parsed add a penalty for that format - f+=m(b).charsLeftOver, -//or tokens - f+=10*m(b).unusedTokens.length,m(b).score=f,(null==d||f<d)&&(d=f,c=b));j(a,c||b)}function nb(a){if(!a._d){var b=L(a._i);a._a=h([b.year,b.month,b.day||b.date,b.hour,b.minute,b.second,b.millisecond],function(a){return a&&parseInt(a,10)}),ib(a)}}function ob(a){var b=new r(db(pb(a))); -// Adding is smart enough around DST - return b._nextDay&&(b.add(1,"d"),b._nextDay=void 0),b}function pb(a){var b=a._i,d=a._f;return a._locale=a._locale||bb(a._l),null===b||void 0===d&&""===b?o({nullInput:!0}):("string"==typeof b&&(a._i=b=a._locale.preparse(b)),s(b)?new r(db(b)):(g(b)?a._d=b:c(d)?mb(a):d?kb(a):qb(a),n(a)||(a._d=null),a))}function qb(b){var d=b._i;void 0===d?b._d=new Date(a.now()):g(d)?b._d=new Date(d.valueOf()):"string"==typeof d?fb(b):c(d)?(b._a=h(d.slice(0),function(a){return parseInt(a,10)}),ib(b)):"object"==typeof d?nb(b):f(d)? -// from milliseconds - b._d=new Date(d):a.createFromInputFallback(b)}function rb(a,b,f,g,h){var i={}; -// object construction must be done this way. -// https://github.com/moment/moment/issues/1423 - return f!==!0&&f!==!1||(g=f,f=void 0),(d(a)&&e(a)||c(a)&&0===a.length)&&(a=void 0),i._isAMomentObject=!0,i._useUTC=i._isUTC=h,i._l=f,i._i=a,i._f=b,i._strict=g,ob(i)}function sb(a,b,c,d){return rb(a,b,c,d,!1)} -// Pick a moment m from moments so that m[fn](other) is true for all -// other. This relies on the function fn to be transitive. -// -// moments should either be an array of moment objects or an array, whose -// first element is an array of moment objects. - function tb(a,b){var d,e;if(1===b.length&&c(b[0])&&(b=b[0]),!b.length)return sb();for(d=b[0],e=1;e<b.length;++e)b[e].isValid()&&!b[e][a](d)||(d=b[e]);return d} -// TODO: Use [].sort instead? - function ub(){var a=[].slice.call(arguments,0);return tb("isBefore",a)}function vb(){var a=[].slice.call(arguments,0);return tb("isAfter",a)}function wb(a){var b=L(a),c=b.year||0,d=b.quarter||0,e=b.month||0,f=b.week||0,g=b.day||0,h=b.hour||0,i=b.minute||0,j=b.second||0,k=b.millisecond||0; -// representation for dateAddRemove - this._milliseconds=+k+1e3*j+// 1000 - 6e4*i+// 1000 * 60 - 1e3*h*60*60,//using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978 -// Because of dateAddRemove treats 24 hours as different from a -// day when working around DST, we need to store them separately - this._days=+g+7*f, -// It is impossible translate months into days without knowing -// which months you are are talking about, so we have to store -// it separately. - this._months=+e+3*d+12*c,this._data={},this._locale=bb(),this._bubble()}function xb(a){return a instanceof wb}function yb(a){return a<0?Math.round(-1*a)*-1:Math.round(a)} -// FORMATTING - function zb(a,b){U(a,0,0,function(){var a=this.utcOffset(),c="+";return a<0&&(a=-a,c="-"),c+T(~~(a/60),2)+b+T(~~a%60,2)})}function Ab(a,b){var c=(b||"").match(a);if(null===c)return null;var d=c[c.length-1]||[],e=(d+"").match(Me)||["-",0,0],f=+(60*e[1])+u(e[2]);return 0===f?0:"+"===e[0]?f:-f} -// Return a moment from input, that is local/utc/zone equivalent to model. - function Bb(b,c){var d,e; -// Use low-level api, because this fn is low-level api. - return c._isUTC?(d=c.clone(),e=(s(b)||g(b)?b.valueOf():sb(b).valueOf())-d.valueOf(),d._d.setTime(d._d.valueOf()+e),a.updateOffset(d,!1),d):sb(b).local()}function Cb(a){ -// On Firefox.24 Date#getTimezoneOffset returns a floating point. -// https://github.com/moment/moment/pull/1871 - return 15*-Math.round(a._d.getTimezoneOffset()/15)} -// MOMENTS -// keepLocalTime = true means only change the timezone, without -// affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]--> -// 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset -// +0200, so we adjust the time as needed, to be valid. -// -// Keeping the time actually adds/subtracts (one hour) -// from the actual represented time. That is why we call updateOffset -// a second time. In case it wants us to change the offset again -// _changeInProgress == true case, then we have to adjust, because -// there is no such time in the given timezone. - function Db(b,c){var d,e=this._offset||0;if(!this.isValid())return null!=b?this:NaN;if(null!=b){if("string"==typeof b){if(b=Ab(Xd,b),null===b)return this}else Math.abs(b)<16&&(b=60*b);return!this._isUTC&&c&&(d=Cb(this)),this._offset=b,this._isUTC=!0,null!=d&&this.add(d,"m"),e!==b&&(!c||this._changeInProgress?Tb(this,Ob(b-e,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,a.updateOffset(this,!0),this._changeInProgress=null)),this}return this._isUTC?e:Cb(this)}function Eb(a,b){return null!=a?("string"!=typeof a&&(a=-a),this.utcOffset(a,b),this):-this.utcOffset()}function Fb(a){return this.utcOffset(0,a)}function Gb(a){return this._isUTC&&(this.utcOffset(0,a),this._isUTC=!1,a&&this.subtract(Cb(this),"m")),this}function Hb(){if(null!=this._tzm)this.utcOffset(this._tzm);else if("string"==typeof this._i){var a=Ab(Wd,this._i);null!=a?this.utcOffset(a):this.utcOffset(0,!0)}return this}function Ib(a){return!!this.isValid()&&(a=a?sb(a).utcOffset():0,(this.utcOffset()-a)%60===0)}function Jb(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Kb(){if(!p(this._isDSTShifted))return this._isDSTShifted;var a={};if(q(a,this),a=pb(a),a._a){var b=a._isUTC?k(a._a):sb(a._a);this._isDSTShifted=this.isValid()&&v(a._a,b.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function Lb(){return!!this.isValid()&&!this._isUTC}function Mb(){return!!this.isValid()&&this._isUTC}function Nb(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}function Ob(a,b){var c,d,e,g=a, -// matching against regexp is expensive, do it on demand - h=null;// checks for null or undefined - return xb(a)?g={ms:a._milliseconds,d:a._days,M:a._months}:f(a)?(g={},b?g[b]=a:g.milliseconds=a):(h=Ne.exec(a))?(c="-"===h[1]?-1:1,g={y:0,d:u(h[ce])*c,h:u(h[de])*c,m:u(h[ee])*c,s:u(h[fe])*c,ms:u(yb(1e3*h[ge]))*c}):(h=Oe.exec(a))?(c="-"===h[1]?-1:1,g={y:Pb(h[2],c),M:Pb(h[3],c),w:Pb(h[4],c),d:Pb(h[5],c),h:Pb(h[6],c),m:Pb(h[7],c),s:Pb(h[8],c)}):null==g?g={}:"object"==typeof g&&("from"in g||"to"in g)&&(e=Rb(sb(g.from),sb(g.to)),g={},g.ms=e.milliseconds,g.M=e.months),d=new wb(g),xb(a)&&i(a,"_locale")&&(d._locale=a._locale),d}function Pb(a,b){ -// We'd normally use ~~inp for this, but unfortunately it also -// converts floats to ints. -// inp may be undefined, so careful calling replace on it. - var c=a&&parseFloat(a.replace(",",".")); -// apply sign while we're at it - return(isNaN(c)?0:c)*b}function Qb(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,"M").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,"M"),c}function Rb(a,b){var c;return a.isValid()&&b.isValid()?(b=Bb(b,a),a.isBefore(b)?c=Qb(a,b):(c=Qb(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c):{milliseconds:0,months:0}} -// TODO: remove 'name' arg after deprecation is removed - function Sb(a,b){return function(c,d){var e,f; -//invert the arguments, but complain about it - return null===d||isNaN(+d)||(y(b,"moment()."+b+"(period, number) is deprecated. Please use moment()."+b+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),f=c,c=d,d=f),c="string"==typeof c?+c:c,e=Ob(c,d),Tb(this,e,a),this}}function Tb(b,c,d,e){var f=c._milliseconds,g=yb(c._days),h=yb(c._months);b.isValid()&&(e=null==e||e,f&&b._d.setTime(b._d.valueOf()+f*d),g&&Q(b,"Date",P(b,"Date")+g*d),h&&ja(b,P(b,"Month")+h*d),e&&a.updateOffset(b,g||h))}function Ub(a,b){var c=a.diff(b,"days",!0);return c<-6?"sameElse":c<-1?"lastWeek":c<0?"lastDay":c<1?"sameDay":c<2?"nextDay":c<7?"nextWeek":"sameElse"}function Vb(b,c){ -// We want to compare the start of today, vs this. -// Getting start-of-today depends on whether we're local/utc/offset or not. - var d=b||sb(),e=Bb(d,this).startOf("day"),f=a.calendarFormat(this,e)||"sameElse",g=c&&(z(c[f])?c[f].call(this,d):c[f]);return this.format(g||this.localeData().calendar(f,this,sb(d)))}function Wb(){return new r(this)}function Xb(a,b){var c=s(a)?a:sb(a);return!(!this.isValid()||!c.isValid())&&(b=K(p(b)?"millisecond":b),"millisecond"===b?this.valueOf()>c.valueOf():c.valueOf()<this.clone().startOf(b).valueOf())}function Yb(a,b){var c=s(a)?a:sb(a);return!(!this.isValid()||!c.isValid())&&(b=K(p(b)?"millisecond":b),"millisecond"===b?this.valueOf()<c.valueOf():this.clone().endOf(b).valueOf()<c.valueOf())}function Zb(a,b,c,d){return d=d||"()",("("===d[0]?this.isAfter(a,c):!this.isBefore(a,c))&&(")"===d[1]?this.isBefore(b,c):!this.isAfter(b,c))}function $b(a,b){var c,d=s(a)?a:sb(a);return!(!this.isValid()||!d.isValid())&&(b=K(b||"millisecond"),"millisecond"===b?this.valueOf()===d.valueOf():(c=d.valueOf(),this.clone().startOf(b).valueOf()<=c&&c<=this.clone().endOf(b).valueOf()))}function _b(a,b){return this.isSame(a,b)||this.isAfter(a,b)}function ac(a,b){return this.isSame(a,b)||this.isBefore(a,b)}function bc(a,b,c){var d,e,f,g;// 1000 -// 1000 * 60 -// 1000 * 60 * 60 -// 1000 * 60 * 60 * 24, negate dst -// 1000 * 60 * 60 * 24 * 7, negate dst - return this.isValid()?(d=Bb(a,this),d.isValid()?(e=6e4*(d.utcOffset()-this.utcOffset()),b=K(b),"year"===b||"month"===b||"quarter"===b?(g=cc(this,d),"quarter"===b?g/=3:"year"===b&&(g/=12)):(f=this-d,g="second"===b?f/1e3:"minute"===b?f/6e4:"hour"===b?f/36e5:"day"===b?(f-e)/864e5:"week"===b?(f-e)/6048e5:f),c?g:t(g)):NaN):NaN}function cc(a,b){ -// difference in months - var c,d,e=12*(b.year()-a.year())+(b.month()-a.month()), -// b is in (anchor - 1 month, anchor + 1 month) - f=a.clone().add(e,"months"); -//check for negative zero, return zero if negative zero -// linear across the month -// linear across the month - return b-f<0?(c=a.clone().add(e-1,"months"),d=(b-f)/(f-c)):(c=a.clone().add(e+1,"months"),d=(b-f)/(c-f)),-(e+d)||0}function dc(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function ec(){var a=this.clone().utc();return 0<a.year()&&a.year()<=9999?z(Date.prototype.toISOString)?this.toDate().toISOString():X(a,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):X(a,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")}/** - * Return a human readable representation of a moment that can - * also be evaluated to get a new moment which is the same - * - * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects - */ - function fc(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var a="moment",b="";this.isLocal()||(a=0===this.utcOffset()?"moment.utc":"moment.parseZone",b="Z");var c="["+a+'("]',d=0<this.year()&&this.year()<=9999?"YYYY":"YYYYYY",e="-MM-DD[T]HH:mm:ss.SSS",f=b+'[")]';return this.format(c+d+e+f)}function gc(b){b||(b=this.isUtc()?a.defaultFormatUtc:a.defaultFormat);var c=X(this,b);return this.localeData().postformat(c)}function hc(a,b){return this.isValid()&&(s(a)&&a.isValid()||sb(a).isValid())?Ob({to:this,from:a}).locale(this.locale()).humanize(!b):this.localeData().invalidDate()}function ic(a){return this.from(sb(),a)}function jc(a,b){return this.isValid()&&(s(a)&&a.isValid()||sb(a).isValid())?Ob({from:this,to:a}).locale(this.locale()).humanize(!b):this.localeData().invalidDate()}function kc(a){return this.to(sb(),a)} -// If passed a locale key, it will set the locale for this -// instance. Otherwise, it will return the locale configuration -// variables for this instance. - function lc(a){var b;return void 0===a?this._locale._abbr:(b=bb(a),null!=b&&(this._locale=b),this)}function mc(){return this._locale}function nc(a){ -// the following switch intentionally omits break keywords -// to utilize falling through the cases. - switch(a=K(a)){case"year":this.month(0);/* falls through */ - case"quarter":case"month":this.date(1);/* falls through */ - case"week":case"isoWeek":case"day":case"date":this.hours(0);/* falls through */ - case"hour":this.minutes(0);/* falls through */ - case"minute":this.seconds(0);/* falls through */ - case"second":this.milliseconds(0)} -// weeks are a special case -// quarters are also special - return"week"===a&&this.weekday(0),"isoWeek"===a&&this.isoWeekday(1),"quarter"===a&&this.month(3*Math.floor(this.month()/3)),this}function oc(a){ -// 'date' is an alias for 'day', so it should be considered as such. - return a=K(a),void 0===a||"millisecond"===a?this:("date"===a&&(a="day"),this.startOf(a).add(1,"isoWeek"===a?"week":a).subtract(1,"ms"))}function pc(){return this._d.valueOf()-6e4*(this._offset||0)}function qc(){return Math.floor(this.valueOf()/1e3)}function rc(){return new Date(this.valueOf())}function sc(){var a=this;return[a.year(),a.month(),a.date(),a.hour(),a.minute(),a.second(),a.millisecond()]}function tc(){var a=this;return{years:a.year(),months:a.month(),date:a.date(),hours:a.hours(),minutes:a.minutes(),seconds:a.seconds(),milliseconds:a.milliseconds()}}function uc(){ -// new Date(NaN).toJSON() === null - return this.isValid()?this.toISOString():null}function vc(){return n(this)}function wc(){return j({},m(this))}function xc(){return m(this).overflow}function yc(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function zc(a,b){U(0,[a,a.length],0,b)} -// MOMENTS - function Ac(a){return Ec.call(this,a,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function Bc(a){return Ec.call(this,a,this.isoWeek(),this.isoWeekday(),1,4)}function Cc(){return xa(this.year(),1,4)}function Dc(){var a=this.localeData()._week;return xa(this.year(),a.dow,a.doy)}function Ec(a,b,c,d,e){var f;return null==a?wa(this,d,e).year:(f=xa(a,d,e),b>f&&(b=f),Fc.call(this,a,b,c,d,e))}function Fc(a,b,c,d,e){var f=va(a,b,c,d,e),g=ta(f.year,0,f.dayOfYear);return this.year(g.getUTCFullYear()),this.month(g.getUTCMonth()),this.date(g.getUTCDate()),this} -// MOMENTS - function Gc(a){return null==a?Math.ceil((this.month()+1)/3):this.month(3*(a-1)+this.month()%3)} -// HELPERS -// MOMENTS - function Hc(a){var b=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")}function Ic(a,b){b[ge]=u(1e3*("0."+a))} -// MOMENTS - function Jc(){return this._isUTC?"UTC":""}function Kc(){return this._isUTC?"Coordinated Universal Time":""}function Lc(a){return sb(1e3*a)}function Mc(){return sb.apply(null,arguments).parseZone()}function Nc(a){return a}function Oc(a,b,c,d){var e=bb(),f=k().set(d,b);return e[c](f,a)}function Pc(a,b,c){if(f(a)&&(b=a,a=void 0),a=a||"",null!=b)return Oc(a,b,c,"month");var d,e=[];for(d=0;d<12;d++)e[d]=Oc(a,d,c,"month");return e} -// () -// (5) -// (fmt, 5) -// (fmt) -// (true) -// (true, 5) -// (true, fmt, 5) -// (true, fmt) - function Qc(a,b,c,d){"boolean"==typeof a?(f(b)&&(c=b,b=void 0),b=b||""):(b=a,c=b,a=!1,f(b)&&(c=b,b=void 0),b=b||"");var e=bb(),g=a?e._week.dow:0;if(null!=c)return Oc(b,(c+g)%7,d,"day");var h,i=[];for(h=0;h<7;h++)i[h]=Oc(b,(h+g)%7,d,"day");return i}function Rc(a,b){return Pc(a,b,"months")}function Sc(a,b){return Pc(a,b,"monthsShort")}function Tc(a,b,c){return Qc(a,b,c,"weekdays")}function Uc(a,b,c){return Qc(a,b,c,"weekdaysShort")}function Vc(a,b,c){return Qc(a,b,c,"weekdaysMin")}function Wc(){var a=this._data;return this._milliseconds=Ze(this._milliseconds),this._days=Ze(this._days),this._months=Ze(this._months),a.milliseconds=Ze(a.milliseconds),a.seconds=Ze(a.seconds),a.minutes=Ze(a.minutes),a.hours=Ze(a.hours),a.months=Ze(a.months),a.years=Ze(a.years),this}function Xc(a,b,c,d){var e=Ob(b,c);return a._milliseconds+=d*e._milliseconds,a._days+=d*e._days,a._months+=d*e._months,a._bubble()} -// supports only 2.0-style add(1, 's') or add(duration) - function Yc(a,b){return Xc(this,a,b,1)} -// supports only 2.0-style subtract(1, 's') or subtract(duration) - function Zc(a,b){return Xc(this,a,b,-1)}function $c(a){return a<0?Math.floor(a):Math.ceil(a)}function _c(){var a,b,c,d,e,f=this._milliseconds,g=this._days,h=this._months,i=this._data; -// if we have a mix of positive and negative values, bubble down first -// check: https://github.com/moment/moment/issues/2166 -// The following code bubbles up values, see the tests for -// examples of what that means. -// convert days to months -// 12 months -> 1 year - return f>=0&&g>=0&&h>=0||f<=0&&g<=0&&h<=0||(f+=864e5*$c(bd(h)+g),g=0,h=0),i.milliseconds=f%1e3,a=t(f/1e3),i.seconds=a%60,b=t(a/60),i.minutes=b%60,c=t(b/60),i.hours=c%24,g+=t(c/24),e=t(ad(g)),h+=e,g-=$c(bd(e)),d=t(h/12),h%=12,i.days=g,i.months=h,i.years=d,this}function ad(a){ -// 400 years have 146097 days (taking into account leap year rules) -// 400 years have 12 months === 4800 - return 4800*a/146097}function bd(a){ -// the reverse of daysToMonths - return 146097*a/4800}function cd(a){var b,c,d=this._milliseconds;if(a=K(a),"month"===a||"year"===a)return b=this._days+d/864e5,c=this._months+ad(b),"month"===a?c:c/12;switch( -// handle milliseconds separately because of floating point math errors (issue #1867) - b=this._days+Math.round(bd(this._months)),a){case"week":return b/7+d/6048e5;case"day":return b+d/864e5;case"hour":return 24*b+d/36e5;case"minute":return 1440*b+d/6e4;case"second":return 86400*b+d/1e3; -// Math.floor prevents floating point math errors here - case"millisecond":return Math.floor(864e5*b)+d;default:throw new Error("Unknown unit "+a)}} -// TODO: Use this.as('ms')? - function dd(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*u(this._months/12)}function ed(a){return function(){return this.as(a)}}function fd(a){return a=K(a),this[a+"s"]()}function gd(a){return function(){return this._data[a]}}function hd(){return t(this.days()/7)} -// helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize - function id(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function jd(a,b,c){var d=Ob(a).abs(),e=of(d.as("s")),f=of(d.as("m")),g=of(d.as("h")),h=of(d.as("d")),i=of(d.as("M")),j=of(d.as("y")),k=e<pf.s&&["s",e]||f<=1&&["m"]||f<pf.m&&["mm",f]||g<=1&&["h"]||g<pf.h&&["hh",g]||h<=1&&["d"]||h<pf.d&&["dd",h]||i<=1&&["M"]||i<pf.M&&["MM",i]||j<=1&&["y"]||["yy",j];return k[2]=b,k[3]=+a>0,k[4]=c,id.apply(null,k)} -// This function allows you to set the rounding function for relative time strings - function kd(a){return void 0===a?of:"function"==typeof a&&(of=a,!0)} -// This function allows you to set a threshold for relative time strings - function ld(a,b){return void 0!==pf[a]&&(void 0===b?pf[a]:(pf[a]=b,!0))}function md(a){var b=this.localeData(),c=jd(this,!a,b);return a&&(c=b.pastFuture(+this,c)),b.postformat(c)}function nd(){ -// for ISO strings we do not use the normal bubbling rules: -// * milliseconds bubble up until they become hours -// * days do not bubble at all -// * months bubble up until they become years -// This is because there is no context-free conversion between hours and days -// (think of clock changes) -// and also not between days and months (28-31 days per month) - var a,b,c,d=qf(this._milliseconds)/1e3,e=qf(this._days),f=qf(this._months); -// 3600 seconds -> 60 minutes -> 1 hour - a=t(d/60),b=t(a/60),d%=60,a%=60, -// 12 months -> 1 year - c=t(f/12),f%=12; -// inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js - var g=c,h=f,i=e,j=b,k=a,l=d,m=this.asSeconds();return m?(m<0?"-":"")+"P"+(g?g+"Y":"")+(h?h+"M":"")+(i?i+"D":"")+(j||k||l?"T":"")+(j?j+"H":"")+(k?k+"M":"")+(l?l+"S":""):"P0D"}var od,pd;pd=Array.prototype.some?Array.prototype.some:function(a){for(var b=Object(this),c=b.length>>>0,d=0;d<c;d++)if(d in b&&a.call(this,b[d],d,b))return!0;return!1};var qd=pd,rd=a.momentProperties=[],sd=!1,td={};a.suppressDeprecationWarnings=!1,a.deprecationHandler=null;var ud;ud=Object.keys?Object.keys:function(a){var b,c=[];for(b in a)i(a,b)&&c.push(b);return c};var vd,wd=ud,xd={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},yd={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},zd="Invalid date",Ad="%d",Bd=/\d{1,2}/,Cd={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},Dd={},Ed={},Fd=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Gd=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Hd={},Id={},Jd=/\d/,Kd=/\d\d/,Ld=/\d{3}/,Md=/\d{4}/,Nd=/[+-]?\d{6}/,Od=/\d\d?/,Pd=/\d\d\d\d?/,Qd=/\d\d\d\d\d\d?/,Rd=/\d{1,3}/,Sd=/\d{1,4}/,Td=/[+-]?\d{1,6}/,Ud=/\d+/,Vd=/[+-]?\d+/,Wd=/Z|[+-]\d\d:?\d\d/gi,Xd=/Z|[+-]\d\d(?::?\d\d)?/gi,Yd=/[+-]?\d+(\.\d{1,3})?/,Zd=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,$d={},_d={},ae=0,be=1,ce=2,de=3,ee=4,fe=5,ge=6,he=7,ie=8;vd=Array.prototype.indexOf?Array.prototype.indexOf:function(a){ -// I know - var b;for(b=0;b<this.length;++b)if(this[b]===a)return b;return-1};var je=vd; -// FORMATTING - U("M",["MM",2],"Mo",function(){return this.month()+1}),U("MMM",0,0,function(a){return this.localeData().monthsShort(this,a)}),U("MMMM",0,0,function(a){return this.localeData().months(this,a)}), -// ALIASES - J("month","M"), -// PRIORITY - M("month",8), -// PARSING - Z("M",Od),Z("MM",Od,Kd),Z("MMM",function(a,b){return b.monthsShortRegex(a)}),Z("MMMM",function(a,b){return b.monthsRegex(a)}),ba(["M","MM"],function(a,b){b[be]=u(a)-1}),ba(["MMM","MMMM"],function(a,b,c,d){var e=c._locale.monthsParse(a,d,c._strict); -// if we didn't find a month name, mark the date as invalid. - null!=e?b[be]=e:m(c).invalidMonth=a}); -// LOCALES - var ke=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,le="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),me="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),ne=Zd,oe=Zd; -// FORMATTING - U("Y",0,0,function(){var a=this.year();return a<=9999?""+a:"+"+a}),U(0,["YY",2],0,function(){return this.year()%100}),U(0,["YYYY",4],0,"year"),U(0,["YYYYY",5],0,"year"),U(0,["YYYYYY",6,!0],0,"year"), -// ALIASES - J("year","y"), -// PRIORITIES - M("year",1), -// PARSING - Z("Y",Vd),Z("YY",Od,Kd),Z("YYYY",Sd,Md),Z("YYYYY",Td,Nd),Z("YYYYYY",Td,Nd),ba(["YYYYY","YYYYYY"],ae),ba("YYYY",function(b,c){c[ae]=2===b.length?a.parseTwoDigitYear(b):u(b)}),ba("YY",function(b,c){c[ae]=a.parseTwoDigitYear(b)}),ba("Y",function(a,b){b[ae]=parseInt(a,10)}), -// HOOKS - a.parseTwoDigitYear=function(a){return u(a)+(u(a)>68?1900:2e3)}; -// MOMENTS - var pe=O("FullYear",!0); -// FORMATTING - U("w",["ww",2],"wo","week"),U("W",["WW",2],"Wo","isoWeek"), -// ALIASES - J("week","w"),J("isoWeek","W"), -// PRIORITIES - M("week",5),M("isoWeek",5), -// PARSING - Z("w",Od),Z("ww",Od,Kd),Z("W",Od),Z("WW",Od,Kd),ca(["w","ww","W","WW"],function(a,b,c,d){b[d.substr(0,1)]=u(a)});var qe={dow:0,// Sunday is the first day of the week. - doy:6}; -// FORMATTING - U("d",0,"do","day"),U("dd",0,0,function(a){return this.localeData().weekdaysMin(this,a)}),U("ddd",0,0,function(a){return this.localeData().weekdaysShort(this,a)}),U("dddd",0,0,function(a){return this.localeData().weekdays(this,a)}),U("e",0,0,"weekday"),U("E",0,0,"isoWeekday"), -// ALIASES - J("day","d"),J("weekday","e"),J("isoWeekday","E"), -// PRIORITY - M("day",11),M("weekday",11),M("isoWeekday",11), -// PARSING - Z("d",Od),Z("e",Od),Z("E",Od),Z("dd",function(a,b){return b.weekdaysMinRegex(a)}),Z("ddd",function(a,b){return b.weekdaysShortRegex(a)}),Z("dddd",function(a,b){return b.weekdaysRegex(a)}),ca(["dd","ddd","dddd"],function(a,b,c,d){var e=c._locale.weekdaysParse(a,d,c._strict); -// if we didn't get a weekday name, mark the date as invalid - null!=e?b.d=e:m(c).invalidWeekday=a}),ca(["d","e","E"],function(a,b,c,d){b[d]=u(a)}); -// LOCALES - var re="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),se="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),te="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),ue=Zd,ve=Zd,we=Zd;U("H",["HH",2],0,"hour"),U("h",["hh",2],0,Ra),U("k",["kk",2],0,Sa),U("hmm",0,0,function(){return""+Ra.apply(this)+T(this.minutes(),2)}),U("hmmss",0,0,function(){return""+Ra.apply(this)+T(this.minutes(),2)+T(this.seconds(),2)}),U("Hmm",0,0,function(){return""+this.hours()+T(this.minutes(),2)}),U("Hmmss",0,0,function(){return""+this.hours()+T(this.minutes(),2)+T(this.seconds(),2)}),Ta("a",!0),Ta("A",!1), -// ALIASES - J("hour","h"), -// PRIORITY - M("hour",13),Z("a",Ua),Z("A",Ua),Z("H",Od),Z("h",Od),Z("HH",Od,Kd),Z("hh",Od,Kd),Z("hmm",Pd),Z("hmmss",Qd),Z("Hmm",Pd),Z("Hmmss",Qd),ba(["H","HH"],de),ba(["a","A"],function(a,b,c){c._isPm=c._locale.isPM(a),c._meridiem=a}),ba(["h","hh"],function(a,b,c){b[de]=u(a),m(c).bigHour=!0}),ba("hmm",function(a,b,c){var d=a.length-2;b[de]=u(a.substr(0,d)),b[ee]=u(a.substr(d)),m(c).bigHour=!0}),ba("hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[de]=u(a.substr(0,d)),b[ee]=u(a.substr(d,2)),b[fe]=u(a.substr(e)),m(c).bigHour=!0}),ba("Hmm",function(a,b,c){var d=a.length-2;b[de]=u(a.substr(0,d)),b[ee]=u(a.substr(d))}),ba("Hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[de]=u(a.substr(0,d)),b[ee]=u(a.substr(d,2)),b[fe]=u(a.substr(e))});var xe,ye=/[ap]\.?m?\.?/i,ze=O("Hours",!0),Ae={calendar:xd,longDateFormat:yd,invalidDate:zd,ordinal:Ad,ordinalParse:Bd,relativeTime:Cd,months:le,monthsShort:me,week:qe,weekdays:re,weekdaysMin:te,weekdaysShort:se,meridiemParse:ye},Be={},Ce={},De=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Ee=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Fe=/Z|[+-]\d\d(?::?\d\d)?/,Ge=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/], -// YYYYMM is NOT allowed by the standard - ["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],He=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Ie=/^\/?Date\((\-?\d+)/i;a.createFromInputFallback=x("value provided is not in a recognized ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(a){a._d=new Date(a._i+(a._useUTC?" UTC":""))}), -// constant that refers to the ISO standard - a.ISO_8601=function(){};var Je=x("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var a=sb.apply(null,arguments);return this.isValid()&&a.isValid()?a<this?this:a:o()}),Ke=x("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var a=sb.apply(null,arguments);return this.isValid()&&a.isValid()?a>this?this:a:o()}),Le=function(){return Date.now?Date.now():+new Date};zb("Z",":"),zb("ZZ",""), -// PARSING - Z("Z",Xd),Z("ZZ",Xd),ba(["Z","ZZ"],function(a,b,c){c._useUTC=!0,c._tzm=Ab(Xd,a)}); -// HELPERS -// timezone chunker -// '+10:00' > ['10', '00'] -// '-1530' > ['-15', '30'] - var Me=/([\+\-]|\d\d)/gi; -// HOOKS -// This function will be called whenever a moment is mutated. -// It is intended to keep the offset in sync with the timezone. - a.updateOffset=function(){}; -// ASP.NET json date format regex - var Ne=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,Oe=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;Ob.fn=wb.prototype;var Pe=Sb(1,"add"),Qe=Sb(-1,"subtract");a.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",a.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var Re=x("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(a){return void 0===a?this.localeData():this.locale(a)}); -// FORMATTING - U(0,["gg",2],0,function(){return this.weekYear()%100}),U(0,["GG",2],0,function(){return this.isoWeekYear()%100}),zc("gggg","weekYear"),zc("ggggg","weekYear"),zc("GGGG","isoWeekYear"),zc("GGGGG","isoWeekYear"), -// ALIASES - J("weekYear","gg"),J("isoWeekYear","GG"), -// PRIORITY - M("weekYear",1),M("isoWeekYear",1), -// PARSING - Z("G",Vd),Z("g",Vd),Z("GG",Od,Kd),Z("gg",Od,Kd),Z("GGGG",Sd,Md),Z("gggg",Sd,Md),Z("GGGGG",Td,Nd),Z("ggggg",Td,Nd),ca(["gggg","ggggg","GGGG","GGGGG"],function(a,b,c,d){b[d.substr(0,2)]=u(a)}),ca(["gg","GG"],function(b,c,d,e){c[e]=a.parseTwoDigitYear(b)}), -// FORMATTING - U("Q",0,"Qo","quarter"), -// ALIASES - J("quarter","Q"), -// PRIORITY - M("quarter",7), -// PARSING - Z("Q",Jd),ba("Q",function(a,b){b[be]=3*(u(a)-1)}), -// FORMATTING - U("D",["DD",2],"Do","date"), -// ALIASES - J("date","D"), -// PRIOROITY - M("date",9), -// PARSING - Z("D",Od),Z("DD",Od,Kd),Z("Do",function(a,b){return a?b._ordinalParse:b._ordinalParseLenient}),ba(["D","DD"],ce),ba("Do",function(a,b){b[ce]=u(a.match(Od)[0],10)}); -// MOMENTS - var Se=O("Date",!0); -// FORMATTING - U("DDD",["DDDD",3],"DDDo","dayOfYear"), -// ALIASES - J("dayOfYear","DDD"), -// PRIORITY - M("dayOfYear",4), -// PARSING - Z("DDD",Rd),Z("DDDD",Ld),ba(["DDD","DDDD"],function(a,b,c){c._dayOfYear=u(a)}), -// FORMATTING - U("m",["mm",2],0,"minute"), -// ALIASES - J("minute","m"), -// PRIORITY - M("minute",14), -// PARSING - Z("m",Od),Z("mm",Od,Kd),ba(["m","mm"],ee); -// MOMENTS - var Te=O("Minutes",!1); -// FORMATTING - U("s",["ss",2],0,"second"), -// ALIASES - J("second","s"), -// PRIORITY - M("second",15), -// PARSING - Z("s",Od),Z("ss",Od,Kd),ba(["s","ss"],fe); -// MOMENTS - var Ue=O("Seconds",!1); -// FORMATTING - U("S",0,0,function(){return~~(this.millisecond()/100)}),U(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),U(0,["SSS",3],0,"millisecond"),U(0,["SSSS",4],0,function(){return 10*this.millisecond()}),U(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),U(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),U(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),U(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),U(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}), -// ALIASES - J("millisecond","ms"), -// PRIORITY - M("millisecond",16), -// PARSING - Z("S",Rd,Jd),Z("SS",Rd,Kd),Z("SSS",Rd,Ld);var Ve;for(Ve="SSSS";Ve.length<=9;Ve+="S")Z(Ve,Ud);for(Ve="S";Ve.length<=9;Ve+="S")ba(Ve,Ic); -// MOMENTS - var We=O("Milliseconds",!1); -// FORMATTING - U("z",0,0,"zoneAbbr"),U("zz",0,0,"zoneName");var Xe=r.prototype;Xe.add=Pe,Xe.calendar=Vb,Xe.clone=Wb,Xe.diff=bc,Xe.endOf=oc,Xe.format=gc,Xe.from=hc,Xe.fromNow=ic,Xe.to=jc,Xe.toNow=kc,Xe.get=R,Xe.invalidAt=xc,Xe.isAfter=Xb,Xe.isBefore=Yb,Xe.isBetween=Zb,Xe.isSame=$b,Xe.isSameOrAfter=_b,Xe.isSameOrBefore=ac,Xe.isValid=vc,Xe.lang=Re,Xe.locale=lc,Xe.localeData=mc,Xe.max=Ke,Xe.min=Je,Xe.parsingFlags=wc,Xe.set=S,Xe.startOf=nc,Xe.subtract=Qe,Xe.toArray=sc,Xe.toObject=tc,Xe.toDate=rc,Xe.toISOString=ec,Xe.inspect=fc,Xe.toJSON=uc,Xe.toString=dc,Xe.unix=qc,Xe.valueOf=pc,Xe.creationData=yc, -// Year - Xe.year=pe,Xe.isLeapYear=ra, -// Week Year - Xe.weekYear=Ac,Xe.isoWeekYear=Bc, -// Quarter - Xe.quarter=Xe.quarters=Gc, -// Month - Xe.month=ka,Xe.daysInMonth=la, -// Week - Xe.week=Xe.weeks=Ba,Xe.isoWeek=Xe.isoWeeks=Ca,Xe.weeksInYear=Dc,Xe.isoWeeksInYear=Cc, -// Day - Xe.date=Se,Xe.day=Xe.days=Ka,Xe.weekday=La,Xe.isoWeekday=Ma,Xe.dayOfYear=Hc, -// Hour - Xe.hour=Xe.hours=ze, -// Minute - Xe.minute=Xe.minutes=Te, -// Second - Xe.second=Xe.seconds=Ue, -// Millisecond - Xe.millisecond=Xe.milliseconds=We, -// Offset - Xe.utcOffset=Db,Xe.utc=Fb,Xe.local=Gb,Xe.parseZone=Hb,Xe.hasAlignedHourOffset=Ib,Xe.isDST=Jb,Xe.isLocal=Lb,Xe.isUtcOffset=Mb,Xe.isUtc=Nb,Xe.isUTC=Nb, -// Timezone - Xe.zoneAbbr=Jc,Xe.zoneName=Kc, -// Deprecations - Xe.dates=x("dates accessor is deprecated. Use date instead.",Se),Xe.months=x("months accessor is deprecated. Use month instead",ka),Xe.years=x("years accessor is deprecated. Use year instead",pe),Xe.zone=x("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Eb),Xe.isDSTShifted=x("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Kb);var Ye=C.prototype;Ye.calendar=D,Ye.longDateFormat=E,Ye.invalidDate=F,Ye.ordinal=G,Ye.preparse=Nc,Ye.postformat=Nc,Ye.relativeTime=H,Ye.pastFuture=I,Ye.set=A, -// Month - Ye.months=fa,Ye.monthsShort=ga,Ye.monthsParse=ia,Ye.monthsRegex=na,Ye.monthsShortRegex=ma, -// Week - Ye.week=ya,Ye.firstDayOfYear=Aa,Ye.firstDayOfWeek=za, -// Day of Week - Ye.weekdays=Fa,Ye.weekdaysMin=Ha,Ye.weekdaysShort=Ga,Ye.weekdaysParse=Ja,Ye.weekdaysRegex=Na,Ye.weekdaysShortRegex=Oa,Ye.weekdaysMinRegex=Pa, -// Hours - Ye.isPM=Va,Ye.meridiem=Wa,$a("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===u(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}), -// Side effect imports - a.lang=x("moment.lang is deprecated. Use moment.locale instead.",$a),a.langData=x("moment.langData is deprecated. Use moment.localeData instead.",bb);var Ze=Math.abs,$e=ed("ms"),_e=ed("s"),af=ed("m"),bf=ed("h"),cf=ed("d"),df=ed("w"),ef=ed("M"),ff=ed("y"),gf=gd("milliseconds"),hf=gd("seconds"),jf=gd("minutes"),kf=gd("hours"),lf=gd("days"),mf=gd("months"),nf=gd("years"),of=Math.round,pf={s:45,// seconds to minute - m:45,// minutes to hour - h:22,// hours to day - d:26,// days to month - M:11},qf=Math.abs,rf=wb.prototype; -// Deprecations -// Side effect imports -// FORMATTING -// PARSING -// Side effect imports - return rf.abs=Wc,rf.add=Yc,rf.subtract=Zc,rf.as=cd,rf.asMilliseconds=$e,rf.asSeconds=_e,rf.asMinutes=af,rf.asHours=bf,rf.asDays=cf,rf.asWeeks=df,rf.asMonths=ef,rf.asYears=ff,rf.valueOf=dd,rf._bubble=_c,rf.get=fd,rf.milliseconds=gf,rf.seconds=hf,rf.minutes=jf,rf.hours=kf,rf.days=lf,rf.weeks=hd,rf.months=mf,rf.years=nf,rf.humanize=md,rf.toISOString=nd,rf.toString=nd,rf.toJSON=nd,rf.locale=lc,rf.localeData=mc,rf.toIsoString=x("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",nd),rf.lang=Re,U("X",0,0,"unix"),U("x",0,0,"valueOf"),Z("x",Vd),Z("X",Yd),ba("X",function(a,b,c){c._d=new Date(1e3*parseFloat(a,10))}),ba("x",function(a,b,c){c._d=new Date(u(a))}),a.version="2.17.1",b(sb),a.fn=Xe,a.min=ub,a.max=vb,a.now=Le,a.utc=k,a.unix=Lc,a.months=Rc,a.isDate=g,a.locale=$a,a.invalid=o,a.duration=Ob,a.isMoment=s,a.weekdays=Tc,a.parseZone=Mc,a.localeData=bb,a.isDuration=xb,a.monthsShort=Sc,a.weekdaysMin=Vc,a.defineLocale=_a,a.updateLocale=ab,a.locales=cb,a.weekdaysShort=Uc,a.normalizeUnits=K,a.relativeTimeRounding=kd,a.relativeTimeThreshold=ld,a.calendarFormat=Ub,a.prototype=Xe,a}); \ No newline at end of file +/** + * Moment.js + * + * Version: 2.24.0 + */ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.moment=t()}(this,function(){"use strict";var e,i;function c(){return e.apply(null,arguments)}function o(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function u(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function l(e){return void 0===e}function h(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function d(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function f(e,t){var n,s=[];for(n=0;n<e.length;++n)s.push(t(e[n],n));return s}function m(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function _(e,t){for(var n in t)m(t,n)&&(e[n]=t[n]);return m(t,"toString")&&(e.toString=t.toString),m(t,"valueOf")&&(e.valueOf=t.valueOf),e}function y(e,t,n,s){return Tt(e,t,n,s,!0).utc()}function g(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null,rfc2822:!1,weekdayMismatch:!1}),e._pf}function v(e){if(null==e._isValid){var t=g(e),n=i.call(t.parsedDateParts,function(e){return null!=e}),s=!isNaN(e._d.getTime())&&t.overflow<0&&!t.empty&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&n);if(e._strict&&(s=s&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour),null!=Object.isFrozen&&Object.isFrozen(e))return s;e._isValid=s}return e._isValid}function p(e){var t=y(NaN);return null!=e?_(g(t),e):g(t).userInvalidated=!0,t}i=Array.prototype.some?Array.prototype.some:function(e){for(var t=Object(this),n=t.length>>>0,s=0;s<n;s++)if(s in t&&e.call(this,t[s],s,t))return!0;return!1};var r=c.momentProperties=[];function w(e,t){var n,s,i;if(l(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),l(t._i)||(e._i=t._i),l(t._f)||(e._f=t._f),l(t._l)||(e._l=t._l),l(t._strict)||(e._strict=t._strict),l(t._tzm)||(e._tzm=t._tzm),l(t._isUTC)||(e._isUTC=t._isUTC),l(t._offset)||(e._offset=t._offset),l(t._pf)||(e._pf=g(t)),l(t._locale)||(e._locale=t._locale),0<r.length)for(n=0;n<r.length;n++)l(i=t[s=r[n]])||(e[s]=i);return e}var t=!1;function M(e){w(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===t&&(t=!0,c.updateOffset(this),t=!1)}function k(e){return e instanceof M||null!=e&&null!=e._isAMomentObject}function S(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function D(e){var t=+e,n=0;return 0!==t&&isFinite(t)&&(n=S(t)),n}function a(e,t,n){var s,i=Math.min(e.length,t.length),r=Math.abs(e.length-t.length),a=0;for(s=0;s<i;s++)(n&&e[s]!==t[s]||!n&&D(e[s])!==D(t[s]))&&a++;return a+r}function Y(e){!1===c.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function n(i,r){var a=!0;return _(function(){if(null!=c.deprecationHandler&&c.deprecationHandler(null,i),a){for(var e,t=[],n=0;n<arguments.length;n++){if(e="","object"==typeof arguments[n]){for(var s in e+="\n["+n+"] ",arguments[0])e+=s+": "+arguments[0][s]+", ";e=e.slice(0,-2)}else e=arguments[n];t.push(e)}Y(i+"\nArguments: "+Array.prototype.slice.call(t).join("")+"\n"+(new Error).stack),a=!1}return r.apply(this,arguments)},r)}var s,O={};function T(e,t){null!=c.deprecationHandler&&c.deprecationHandler(e,t),O[e]||(Y(t),O[e]=!0)}function b(e){return e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function x(e,t){var n,s=_({},e);for(n in t)m(t,n)&&(u(e[n])&&u(t[n])?(s[n]={},_(s[n],e[n]),_(s[n],t[n])):null!=t[n]?s[n]=t[n]:delete s[n]);for(n in e)m(e,n)&&!m(t,n)&&u(e[n])&&(s[n]=_({},s[n]));return s}function P(e){null!=e&&this.set(e)}c.suppressDeprecationWarnings=!1,c.deprecationHandler=null,s=Object.keys?Object.keys:function(e){var t,n=[];for(t in e)m(e,t)&&n.push(t);return n};var W={};function C(e,t){var n=e.toLowerCase();W[n]=W[n+"s"]=W[t]=e}function H(e){return"string"==typeof e?W[e]||W[e.toLowerCase()]:void 0}function R(e){var t,n,s={};for(n in e)m(e,n)&&(t=H(n))&&(s[t]=e[n]);return s}var U={};function F(e,t){U[e]=t}function L(e,t,n){var s=""+Math.abs(e),i=t-s.length;return(0<=e?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+s}var N=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,G=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,V={},E={};function I(e,t,n,s){var i=s;"string"==typeof s&&(i=function(){return this[s]()}),e&&(E[e]=i),t&&(E[t[0]]=function(){return L(i.apply(this,arguments),t[1],t[2])}),n&&(E[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function A(e,t){return e.isValid()?(t=j(t,e.localeData()),V[t]=V[t]||function(s){var e,i,t,r=s.match(N);for(e=0,i=r.length;e<i;e++)E[r[e]]?r[e]=E[r[e]]:r[e]=(t=r[e]).match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"");return function(e){var t,n="";for(t=0;t<i;t++)n+=b(r[t])?r[t].call(e,s):r[t];return n}}(t),V[t](e)):e.localeData().invalidDate()}function j(e,t){var n=5;function s(e){return t.longDateFormat(e)||e}for(G.lastIndex=0;0<=n&&G.test(e);)e=e.replace(G,s),G.lastIndex=0,n-=1;return e}var Z=/\d/,z=/\d\d/,$=/\d{3}/,q=/\d{4}/,J=/[+-]?\d{6}/,B=/\d\d?/,Q=/\d\d\d\d?/,X=/\d\d\d\d\d\d?/,K=/\d{1,3}/,ee=/\d{1,4}/,te=/[+-]?\d{1,6}/,ne=/\d+/,se=/[+-]?\d+/,ie=/Z|[+-]\d\d:?\d\d/gi,re=/Z|[+-]\d\d(?::?\d\d)?/gi,ae=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,oe={};function ue(e,n,s){oe[e]=b(n)?n:function(e,t){return e&&s?s:n}}function le(e,t){return m(oe,e)?oe[e](t._strict,t._locale):new RegExp(he(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,n,s,i){return t||n||s||i})))}function he(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var de={};function ce(e,n){var t,s=n;for("string"==typeof e&&(e=[e]),h(n)&&(s=function(e,t){t[n]=D(e)}),t=0;t<e.length;t++)de[e[t]]=s}function fe(e,i){ce(e,function(e,t,n,s){n._w=n._w||{},i(e,n._w,n,s)})}var me=0,_e=1,ye=2,ge=3,ve=4,pe=5,we=6,Me=7,ke=8;function Se(e){return De(e)?366:365}function De(e){return e%4==0&&e%100!=0||e%400==0}I("Y",0,0,function(){var e=this.year();return e<=9999?""+e:"+"+e}),I(0,["YY",2],0,function(){return this.year()%100}),I(0,["YYYY",4],0,"year"),I(0,["YYYYY",5],0,"year"),I(0,["YYYYYY",6,!0],0,"year"),C("year","y"),F("year",1),ue("Y",se),ue("YY",B,z),ue("YYYY",ee,q),ue("YYYYY",te,J),ue("YYYYYY",te,J),ce(["YYYYY","YYYYYY"],me),ce("YYYY",function(e,t){t[me]=2===e.length?c.parseTwoDigitYear(e):D(e)}),ce("YY",function(e,t){t[me]=c.parseTwoDigitYear(e)}),ce("Y",function(e,t){t[me]=parseInt(e,10)}),c.parseTwoDigitYear=function(e){return D(e)+(68<D(e)?1900:2e3)};var Ye,Oe=Te("FullYear",!0);function Te(t,n){return function(e){return null!=e?(xe(this,t,e),c.updateOffset(this,n),this):be(this,t)}}function be(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function xe(e,t,n){e.isValid()&&!isNaN(n)&&("FullYear"===t&&De(e.year())&&1===e.month()&&29===e.date()?e._d["set"+(e._isUTC?"UTC":"")+t](n,e.month(),Pe(n,e.month())):e._d["set"+(e._isUTC?"UTC":"")+t](n))}function Pe(e,t){if(isNaN(e)||isNaN(t))return NaN;var n,s=(t%(n=12)+n)%n;return e+=(t-s)/12,1===s?De(e)?29:28:31-s%7%2}Ye=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;t<this.length;++t)if(this[t]===e)return t;return-1},I("M",["MM",2],"Mo",function(){return this.month()+1}),I("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),I("MMMM",0,0,function(e){return this.localeData().months(this,e)}),C("month","M"),F("month",8),ue("M",B),ue("MM",B,z),ue("MMM",function(e,t){return t.monthsShortRegex(e)}),ue("MMMM",function(e,t){return t.monthsRegex(e)}),ce(["M","MM"],function(e,t){t[_e]=D(e)-1}),ce(["MMM","MMMM"],function(e,t,n,s){var i=n._locale.monthsParse(e,s,n._strict);null!=i?t[_e]=i:g(n).invalidMonth=e});var We=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Ce="January_February_March_April_May_June_July_August_September_October_November_December".split("_");var He="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_");function Re(e,t){var n;if(!e.isValid())return e;if("string"==typeof t)if(/^\d+$/.test(t))t=D(t);else if(!h(t=e.localeData().monthsParse(t)))return e;return n=Math.min(e.date(),Pe(e.year(),t)),e._d["set"+(e._isUTC?"UTC":"")+"Month"](t,n),e}function Ue(e){return null!=e?(Re(this,e),c.updateOffset(this,!0),this):be(this,"Month")}var Fe=ae;var Le=ae;function Ne(){function e(e,t){return t.length-e.length}var t,n,s=[],i=[],r=[];for(t=0;t<12;t++)n=y([2e3,t]),s.push(this.monthsShort(n,"")),i.push(this.months(n,"")),r.push(this.months(n,"")),r.push(this.monthsShort(n,""));for(s.sort(e),i.sort(e),r.sort(e),t=0;t<12;t++)s[t]=he(s[t]),i[t]=he(i[t]);for(t=0;t<24;t++)r[t]=he(r[t]);this._monthsRegex=new RegExp("^("+r.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+s.join("|")+")","i")}function Ge(e){var t;if(e<100&&0<=e){var n=Array.prototype.slice.call(arguments);n[0]=e+400,t=new Date(Date.UTC.apply(null,n)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)}else t=new Date(Date.UTC.apply(null,arguments));return t}function Ve(e,t,n){var s=7+t-n;return-((7+Ge(e,0,s).getUTCDay()-t)%7)+s-1}function Ee(e,t,n,s,i){var r,a,o=1+7*(t-1)+(7+n-s)%7+Ve(e,s,i);return a=o<=0?Se(r=e-1)+o:o>Se(e)?(r=e+1,o-Se(e)):(r=e,o),{year:r,dayOfYear:a}}function Ie(e,t,n){var s,i,r=Ve(e.year(),t,n),a=Math.floor((e.dayOfYear()-r-1)/7)+1;return a<1?s=a+Ae(i=e.year()-1,t,n):a>Ae(e.year(),t,n)?(s=a-Ae(e.year(),t,n),i=e.year()+1):(i=e.year(),s=a),{week:s,year:i}}function Ae(e,t,n){var s=Ve(e,t,n),i=Ve(e+1,t,n);return(Se(e)-s+i)/7}I("w",["ww",2],"wo","week"),I("W",["WW",2],"Wo","isoWeek"),C("week","w"),C("isoWeek","W"),F("week",5),F("isoWeek",5),ue("w",B),ue("ww",B,z),ue("W",B),ue("WW",B,z),fe(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=D(e)});function je(e,t){return e.slice(t,7).concat(e.slice(0,t))}I("d",0,"do","day"),I("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),I("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),I("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),I("e",0,0,"weekday"),I("E",0,0,"isoWeekday"),C("day","d"),C("weekday","e"),C("isoWeekday","E"),F("day",11),F("weekday",11),F("isoWeekday",11),ue("d",B),ue("e",B),ue("E",B),ue("dd",function(e,t){return t.weekdaysMinRegex(e)}),ue("ddd",function(e,t){return t.weekdaysShortRegex(e)}),ue("dddd",function(e,t){return t.weekdaysRegex(e)}),fe(["dd","ddd","dddd"],function(e,t,n,s){var i=n._locale.weekdaysParse(e,s,n._strict);null!=i?t.d=i:g(n).invalidWeekday=e}),fe(["d","e","E"],function(e,t,n,s){t[s]=D(e)});var Ze="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_");var ze="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");var $e="Su_Mo_Tu_We_Th_Fr_Sa".split("_");var qe=ae;var Je=ae;var Be=ae;function Qe(){function e(e,t){return t.length-e.length}var t,n,s,i,r,a=[],o=[],u=[],l=[];for(t=0;t<7;t++)n=y([2e3,1]).day(t),s=this.weekdaysMin(n,""),i=this.weekdaysShort(n,""),r=this.weekdays(n,""),a.push(s),o.push(i),u.push(r),l.push(s),l.push(i),l.push(r);for(a.sort(e),o.sort(e),u.sort(e),l.sort(e),t=0;t<7;t++)o[t]=he(o[t]),u[t]=he(u[t]),l[t]=he(l[t]);this._weekdaysRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+a.join("|")+")","i")}function Xe(){return this.hours()%12||12}function Ke(e,t){I(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function et(e,t){return t._meridiemParse}I("H",["HH",2],0,"hour"),I("h",["hh",2],0,Xe),I("k",["kk",2],0,function(){return this.hours()||24}),I("hmm",0,0,function(){return""+Xe.apply(this)+L(this.minutes(),2)}),I("hmmss",0,0,function(){return""+Xe.apply(this)+L(this.minutes(),2)+L(this.seconds(),2)}),I("Hmm",0,0,function(){return""+this.hours()+L(this.minutes(),2)}),I("Hmmss",0,0,function(){return""+this.hours()+L(this.minutes(),2)+L(this.seconds(),2)}),Ke("a",!0),Ke("A",!1),C("hour","h"),F("hour",13),ue("a",et),ue("A",et),ue("H",B),ue("h",B),ue("k",B),ue("HH",B,z),ue("hh",B,z),ue("kk",B,z),ue("hmm",Q),ue("hmmss",X),ue("Hmm",Q),ue("Hmmss",X),ce(["H","HH"],ge),ce(["k","kk"],function(e,t,n){var s=D(e);t[ge]=24===s?0:s}),ce(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),ce(["h","hh"],function(e,t,n){t[ge]=D(e),g(n).bigHour=!0}),ce("hmm",function(e,t,n){var s=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s)),g(n).bigHour=!0}),ce("hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s,2)),t[pe]=D(e.substr(i)),g(n).bigHour=!0}),ce("Hmm",function(e,t,n){var s=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s))}),ce("Hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s,2)),t[pe]=D(e.substr(i))});var tt,nt=Te("Hours",!0),st={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Ce,monthsShort:He,week:{dow:0,doy:6},weekdays:Ze,weekdaysMin:$e,weekdaysShort:ze,meridiemParse:/[ap]\.?m?\.?/i},it={},rt={};function at(e){return e?e.toLowerCase().replace("_","-"):e}function ot(e){var t=null;if(!it[e]&&"undefined"!=typeof module&&module&&module.exports)try{t=tt._abbr,require("./locale/"+e),ut(t)}catch(e){}return it[e]}function ut(e,t){var n;return e&&((n=l(t)?ht(e):lt(e,t))?tt=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),tt._abbr}function lt(e,t){if(null===t)return delete it[e],null;var n,s=st;if(t.abbr=e,null!=it[e])T("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=it[e]._config;else if(null!=t.parentLocale)if(null!=it[t.parentLocale])s=it[t.parentLocale]._config;else{if(null==(n=ot(t.parentLocale)))return rt[t.parentLocale]||(rt[t.parentLocale]=[]),rt[t.parentLocale].push({name:e,config:t}),null;s=n._config}return it[e]=new P(x(s,t)),rt[e]&&rt[e].forEach(function(e){lt(e.name,e.config)}),ut(e),it[e]}function ht(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return tt;if(!o(e)){if(t=ot(e))return t;e=[e]}return function(e){for(var t,n,s,i,r=0;r<e.length;){for(t=(i=at(e[r]).split("-")).length,n=(n=at(e[r+1]))?n.split("-"):null;0<t;){if(s=ot(i.slice(0,t).join("-")))return s;if(n&&n.length>=t&&a(i,n,!0)>=t-1)break;t--}r++}return tt}(e)}function dt(e){var t,n=e._a;return n&&-2===g(e).overflow&&(t=n[_e]<0||11<n[_e]?_e:n[ye]<1||n[ye]>Pe(n[me],n[_e])?ye:n[ge]<0||24<n[ge]||24===n[ge]&&(0!==n[ve]||0!==n[pe]||0!==n[we])?ge:n[ve]<0||59<n[ve]?ve:n[pe]<0||59<n[pe]?pe:n[we]<0||999<n[we]?we:-1,g(e)._overflowDayOfYear&&(t<me||ye<t)&&(t=ye),g(e)._overflowWeeks&&-1===t&&(t=Me),g(e)._overflowWeekday&&-1===t&&(t=ke),g(e).overflow=t),e}function ct(e,t,n){return null!=e?e:null!=t?t:n}function ft(e){var t,n,s,i,r,a=[];if(!e._d){var o,u;for(o=e,u=new Date(c.now()),s=o._useUTC?[u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()]:[u.getFullYear(),u.getMonth(),u.getDate()],e._w&&null==e._a[ye]&&null==e._a[_e]&&function(e){var t,n,s,i,r,a,o,u;if(null!=(t=e._w).GG||null!=t.W||null!=t.E)r=1,a=4,n=ct(t.GG,e._a[me],Ie(bt(),1,4).year),s=ct(t.W,1),((i=ct(t.E,1))<1||7<i)&&(u=!0);else{r=e._locale._week.dow,a=e._locale._week.doy;var l=Ie(bt(),r,a);n=ct(t.gg,e._a[me],l.year),s=ct(t.w,l.week),null!=t.d?((i=t.d)<0||6<i)&&(u=!0):null!=t.e?(i=t.e+r,(t.e<0||6<t.e)&&(u=!0)):i=r}s<1||s>Ae(n,r,a)?g(e)._overflowWeeks=!0:null!=u?g(e)._overflowWeekday=!0:(o=Ee(n,s,i,r,a),e._a[me]=o.year,e._dayOfYear=o.dayOfYear)}(e),null!=e._dayOfYear&&(r=ct(e._a[me],s[me]),(e._dayOfYear>Se(r)||0===e._dayOfYear)&&(g(e)._overflowDayOfYear=!0),n=Ge(r,0,e._dayOfYear),e._a[_e]=n.getUTCMonth(),e._a[ye]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=a[t]=s[t];for(;t<7;t++)e._a[t]=a[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[ge]&&0===e._a[ve]&&0===e._a[pe]&&0===e._a[we]&&(e._nextDay=!0,e._a[ge]=0),e._d=(e._useUTC?Ge:function(e,t,n,s,i,r,a){var o;return e<100&&0<=e?(o=new Date(e+400,t,n,s,i,r,a),isFinite(o.getFullYear())&&o.setFullYear(e)):o=new Date(e,t,n,s,i,r,a),o}).apply(null,a),i=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[ge]=24),e._w&&void 0!==e._w.d&&e._w.d!==i&&(g(e).weekdayMismatch=!0)}}var mt=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,_t=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,yt=/Z|[+-]\d\d(?::?\d\d)?/,gt=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],vt=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],pt=/^\/?Date\((\-?\d+)/i;function wt(e){var t,n,s,i,r,a,o=e._i,u=mt.exec(o)||_t.exec(o);if(u){for(g(e).iso=!0,t=0,n=gt.length;t<n;t++)if(gt[t][1].exec(u[1])){i=gt[t][0],s=!1!==gt[t][2];break}if(null==i)return void(e._isValid=!1);if(u[3]){for(t=0,n=vt.length;t<n;t++)if(vt[t][1].exec(u[3])){r=(u[2]||" ")+vt[t][0];break}if(null==r)return void(e._isValid=!1)}if(!s&&null!=r)return void(e._isValid=!1);if(u[4]){if(!yt.exec(u[4]))return void(e._isValid=!1);a="Z"}e._f=i+(r||"")+(a||""),Yt(e)}else e._isValid=!1}var Mt=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/;function kt(e,t,n,s,i,r){var a=[function(e){var t=parseInt(e,10);{if(t<=49)return 2e3+t;if(t<=999)return 1900+t}return t}(e),He.indexOf(t),parseInt(n,10),parseInt(s,10),parseInt(i,10)];return r&&a.push(parseInt(r,10)),a}var St={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Dt(e){var t,n,s,i=Mt.exec(e._i.replace(/\([^)]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,""));if(i){var r=kt(i[4],i[3],i[2],i[5],i[6],i[7]);if(t=i[1],n=r,s=e,t&&ze.indexOf(t)!==new Date(n[0],n[1],n[2]).getDay()&&(g(s).weekdayMismatch=!0,!(s._isValid=!1)))return;e._a=r,e._tzm=function(e,t,n){if(e)return St[e];if(t)return 0;var s=parseInt(n,10),i=s%100;return(s-i)/100*60+i}(i[8],i[9],i[10]),e._d=Ge.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),g(e).rfc2822=!0}else e._isValid=!1}function Yt(e){if(e._f!==c.ISO_8601)if(e._f!==c.RFC_2822){e._a=[],g(e).empty=!0;var t,n,s,i,r,a,o,u,l=""+e._i,h=l.length,d=0;for(s=j(e._f,e._locale).match(N)||[],t=0;t<s.length;t++)i=s[t],(n=(l.match(le(i,e))||[])[0])&&(0<(r=l.substr(0,l.indexOf(n))).length&&g(e).unusedInput.push(r),l=l.slice(l.indexOf(n)+n.length),d+=n.length),E[i]?(n?g(e).empty=!1:g(e).unusedTokens.push(i),a=i,u=e,null!=(o=n)&&m(de,a)&&de[a](o,u._a,u,a)):e._strict&&!n&&g(e).unusedTokens.push(i);g(e).charsLeftOver=h-d,0<l.length&&g(e).unusedInput.push(l),e._a[ge]<=12&&!0===g(e).bigHour&&0<e._a[ge]&&(g(e).bigHour=void 0),g(e).parsedDateParts=e._a.slice(0),g(e).meridiem=e._meridiem,e._a[ge]=function(e,t,n){var s;if(null==n)return t;return null!=e.meridiemHour?e.meridiemHour(t,n):(null!=e.isPM&&((s=e.isPM(n))&&t<12&&(t+=12),s||12!==t||(t=0)),t)}(e._locale,e._a[ge],e._meridiem),ft(e),dt(e)}else Dt(e);else wt(e)}function Ot(e){var t,n,s,i,r=e._i,a=e._f;return e._locale=e._locale||ht(e._l),null===r||void 0===a&&""===r?p({nullInput:!0}):("string"==typeof r&&(e._i=r=e._locale.preparse(r)),k(r)?new M(dt(r)):(d(r)?e._d=r:o(a)?function(e){var t,n,s,i,r;if(0===e._f.length)return g(e).invalidFormat=!0,e._d=new Date(NaN);for(i=0;i<e._f.length;i++)r=0,t=w({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[i],Yt(t),v(t)&&(r+=g(t).charsLeftOver,r+=10*g(t).unusedTokens.length,g(t).score=r,(null==s||r<s)&&(s=r,n=t));_(e,n||t)}(e):a?Yt(e):l(n=(t=e)._i)?t._d=new Date(c.now()):d(n)?t._d=new Date(n.valueOf()):"string"==typeof n?(s=t,null===(i=pt.exec(s._i))?(wt(s),!1===s._isValid&&(delete s._isValid,Dt(s),!1===s._isValid&&(delete s._isValid,c.createFromInputFallback(s)))):s._d=new Date(+i[1])):o(n)?(t._a=f(n.slice(0),function(e){return parseInt(e,10)}),ft(t)):u(n)?function(e){if(!e._d){var t=R(e._i);e._a=f([t.year,t.month,t.day||t.date,t.hour,t.minute,t.second,t.millisecond],function(e){return e&&parseInt(e,10)}),ft(e)}}(t):h(n)?t._d=new Date(n):c.createFromInputFallback(t),v(e)||(e._d=null),e))}function Tt(e,t,n,s,i){var r,a={};return!0!==n&&!1!==n||(s=n,n=void 0),(u(e)&&function(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;var t;for(t in e)if(e.hasOwnProperty(t))return!1;return!0}(e)||o(e)&&0===e.length)&&(e=void 0),a._isAMomentObject=!0,a._useUTC=a._isUTC=i,a._l=n,a._i=e,a._f=t,a._strict=s,(r=new M(dt(Ot(a))))._nextDay&&(r.add(1,"d"),r._nextDay=void 0),r}function bt(e,t,n,s){return Tt(e,t,n,s,!1)}c.createFromInputFallback=n("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),c.ISO_8601=function(){},c.RFC_2822=function(){};var xt=n("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=bt.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:p()}),Pt=n("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=bt.apply(null,arguments);return this.isValid()&&e.isValid()?this<e?this:e:p()});function Wt(e,t){var n,s;if(1===t.length&&o(t[0])&&(t=t[0]),!t.length)return bt();for(n=t[0],s=1;s<t.length;++s)t[s].isValid()&&!t[s][e](n)||(n=t[s]);return n}var Ct=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Ht(e){var t=R(e),n=t.year||0,s=t.quarter||0,i=t.month||0,r=t.week||t.isoWeek||0,a=t.day||0,o=t.hour||0,u=t.minute||0,l=t.second||0,h=t.millisecond||0;this._isValid=function(e){for(var t in e)if(-1===Ye.call(Ct,t)||null!=e[t]&&isNaN(e[t]))return!1;for(var n=!1,s=0;s<Ct.length;++s)if(e[Ct[s]]){if(n)return!1;parseFloat(e[Ct[s]])!==D(e[Ct[s]])&&(n=!0)}return!0}(t),this._milliseconds=+h+1e3*l+6e4*u+1e3*o*60*60,this._days=+a+7*r,this._months=+i+3*s+12*n,this._data={},this._locale=ht(),this._bubble()}function Rt(e){return e instanceof Ht}function Ut(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function Ft(e,n){I(e,0,0,function(){var e=this.utcOffset(),t="+";return e<0&&(e=-e,t="-"),t+L(~~(e/60),2)+n+L(~~e%60,2)})}Ft("Z",":"),Ft("ZZ",""),ue("Z",re),ue("ZZ",re),ce(["Z","ZZ"],function(e,t,n){n._useUTC=!0,n._tzm=Nt(re,e)});var Lt=/([\+\-]|\d\d)/gi;function Nt(e,t){var n=(t||"").match(e);if(null===n)return null;var s=((n[n.length-1]||[])+"").match(Lt)||["-",0,0],i=60*s[1]+D(s[2]);return 0===i?0:"+"===s[0]?i:-i}function Gt(e,t){var n,s;return t._isUTC?(n=t.clone(),s=(k(e)||d(e)?e.valueOf():bt(e).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+s),c.updateOffset(n,!1),n):bt(e).local()}function Vt(e){return 15*-Math.round(e._d.getTimezoneOffset()/15)}function Et(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}c.updateOffset=function(){};var It=/^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,At=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function jt(e,t){var n,s,i,r=e,a=null;return Rt(e)?r={ms:e._milliseconds,d:e._days,M:e._months}:h(e)?(r={},t?r[t]=e:r.milliseconds=e):(a=It.exec(e))?(n="-"===a[1]?-1:1,r={y:0,d:D(a[ye])*n,h:D(a[ge])*n,m:D(a[ve])*n,s:D(a[pe])*n,ms:D(Ut(1e3*a[we]))*n}):(a=At.exec(e))?(n="-"===a[1]?-1:1,r={y:Zt(a[2],n),M:Zt(a[3],n),w:Zt(a[4],n),d:Zt(a[5],n),h:Zt(a[6],n),m:Zt(a[7],n),s:Zt(a[8],n)}):null==r?r={}:"object"==typeof r&&("from"in r||"to"in r)&&(i=function(e,t){var n;if(!e.isValid()||!t.isValid())return{milliseconds:0,months:0};t=Gt(t,e),e.isBefore(t)?n=zt(e,t):((n=zt(t,e)).milliseconds=-n.milliseconds,n.months=-n.months);return n}(bt(r.from),bt(r.to)),(r={}).ms=i.milliseconds,r.M=i.months),s=new Ht(r),Rt(e)&&m(e,"_locale")&&(s._locale=e._locale),s}function Zt(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)?0:n)*t}function zt(e,t){var n={};return n.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function $t(s,i){return function(e,t){var n;return null===t||isNaN(+t)||(T(i,"moment()."+i+"(period, number) is deprecated. Please use moment()."+i+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),n=e,e=t,t=n),qt(this,jt(e="string"==typeof e?+e:e,t),s),this}}function qt(e,t,n,s){var i=t._milliseconds,r=Ut(t._days),a=Ut(t._months);e.isValid()&&(s=null==s||s,a&&Re(e,be(e,"Month")+a*n),r&&xe(e,"Date",be(e,"Date")+r*n),i&&e._d.setTime(e._d.valueOf()+i*n),s&&c.updateOffset(e,r||a))}jt.fn=Ht.prototype,jt.invalid=function(){return jt(NaN)};var Jt=$t(1,"add"),Bt=$t(-1,"subtract");function Qt(e,t){var n=12*(t.year()-e.year())+(t.month()-e.month()),s=e.clone().add(n,"months");return-(n+(t-s<0?(t-s)/(s-e.clone().add(n-1,"months")):(t-s)/(e.clone().add(n+1,"months")-s)))||0}function Xt(e){var t;return void 0===e?this._locale._abbr:(null!=(t=ht(e))&&(this._locale=t),this)}c.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",c.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var Kt=n("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});function en(){return this._locale}var tn=126227808e5;function nn(e,t){return(e%t+t)%t}function sn(e,t,n){return e<100&&0<=e?new Date(e+400,t,n)-tn:new Date(e,t,n).valueOf()}function rn(e,t,n){return e<100&&0<=e?Date.UTC(e+400,t,n)-tn:Date.UTC(e,t,n)}function an(e,t){I(0,[e,e.length],0,t)}function on(e,t,n,s,i){var r;return null==e?Ie(this,s,i).year:((r=Ae(e,s,i))<t&&(t=r),function(e,t,n,s,i){var r=Ee(e,t,n,s,i),a=Ge(r.year,0,r.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}.call(this,e,t,n,s,i))}I(0,["gg",2],0,function(){return this.weekYear()%100}),I(0,["GG",2],0,function(){return this.isoWeekYear()%100}),an("gggg","weekYear"),an("ggggg","weekYear"),an("GGGG","isoWeekYear"),an("GGGGG","isoWeekYear"),C("weekYear","gg"),C("isoWeekYear","GG"),F("weekYear",1),F("isoWeekYear",1),ue("G",se),ue("g",se),ue("GG",B,z),ue("gg",B,z),ue("GGGG",ee,q),ue("gggg",ee,q),ue("GGGGG",te,J),ue("ggggg",te,J),fe(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,s){t[s.substr(0,2)]=D(e)}),fe(["gg","GG"],function(e,t,n,s){t[s]=c.parseTwoDigitYear(e)}),I("Q",0,"Qo","quarter"),C("quarter","Q"),F("quarter",7),ue("Q",Z),ce("Q",function(e,t){t[_e]=3*(D(e)-1)}),I("D",["DD",2],"Do","date"),C("date","D"),F("date",9),ue("D",B),ue("DD",B,z),ue("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),ce(["D","DD"],ye),ce("Do",function(e,t){t[ye]=D(e.match(B)[0])});var un=Te("Date",!0);I("DDD",["DDDD",3],"DDDo","dayOfYear"),C("dayOfYear","DDD"),F("dayOfYear",4),ue("DDD",K),ue("DDDD",$),ce(["DDD","DDDD"],function(e,t,n){n._dayOfYear=D(e)}),I("m",["mm",2],0,"minute"),C("minute","m"),F("minute",14),ue("m",B),ue("mm",B,z),ce(["m","mm"],ve);var ln=Te("Minutes",!1);I("s",["ss",2],0,"second"),C("second","s"),F("second",15),ue("s",B),ue("ss",B,z),ce(["s","ss"],pe);var hn,dn=Te("Seconds",!1);for(I("S",0,0,function(){return~~(this.millisecond()/100)}),I(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),I(0,["SSS",3],0,"millisecond"),I(0,["SSSS",4],0,function(){return 10*this.millisecond()}),I(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),I(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),I(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),I(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),I(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),C("millisecond","ms"),F("millisecond",16),ue("S",K,Z),ue("SS",K,z),ue("SSS",K,$),hn="SSSS";hn.length<=9;hn+="S")ue(hn,ne);function cn(e,t){t[we]=D(1e3*("0."+e))}for(hn="S";hn.length<=9;hn+="S")ce(hn,cn);var fn=Te("Milliseconds",!1);I("z",0,0,"zoneAbbr"),I("zz",0,0,"zoneName");var mn=M.prototype;function _n(e){return e}mn.add=Jt,mn.calendar=function(e,t){var n=e||bt(),s=Gt(n,this).startOf("day"),i=c.calendarFormat(this,s)||"sameElse",r=t&&(b(t[i])?t[i].call(this,n):t[i]);return this.format(r||this.localeData().calendar(i,this,bt(n)))},mn.clone=function(){return new M(this)},mn.diff=function(e,t,n){var s,i,r;if(!this.isValid())return NaN;if(!(s=Gt(e,this)).isValid())return NaN;switch(i=6e4*(s.utcOffset()-this.utcOffset()),t=H(t)){case"year":r=Qt(this,s)/12;break;case"month":r=Qt(this,s);break;case"quarter":r=Qt(this,s)/3;break;case"second":r=(this-s)/1e3;break;case"minute":r=(this-s)/6e4;break;case"hour":r=(this-s)/36e5;break;case"day":r=(this-s-i)/864e5;break;case"week":r=(this-s-i)/6048e5;break;default:r=this-s}return n?r:S(r)},mn.endOf=function(e){var t;if(void 0===(e=H(e))||"millisecond"===e||!this.isValid())return this;var n=this._isUTC?rn:sn;switch(e){case"year":t=n(this.year()+1,0,1)-1;break;case"quarter":t=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=n(this.year(),this.month()+1,1)-1;break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=36e5-nn(t+(this._isUTC?0:6e4*this.utcOffset()),36e5)-1;break;case"minute":t=this._d.valueOf(),t+=6e4-nn(t,6e4)-1;break;case"second":t=this._d.valueOf(),t+=1e3-nn(t,1e3)-1;break}return this._d.setTime(t),c.updateOffset(this,!0),this},mn.format=function(e){e||(e=this.isUtc()?c.defaultFormatUtc:c.defaultFormat);var t=A(this,e);return this.localeData().postformat(t)},mn.from=function(e,t){return this.isValid()&&(k(e)&&e.isValid()||bt(e).isValid())?jt({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},mn.fromNow=function(e){return this.from(bt(),e)},mn.to=function(e,t){return this.isValid()&&(k(e)&&e.isValid()||bt(e).isValid())?jt({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},mn.toNow=function(e){return this.to(bt(),e)},mn.get=function(e){return b(this[e=H(e)])?this[e]():this},mn.invalidAt=function(){return g(this).overflow},mn.isAfter=function(e,t){var n=k(e)?e:bt(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=H(t)||"millisecond")?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(t).valueOf())},mn.isBefore=function(e,t){var n=k(e)?e:bt(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=H(t)||"millisecond")?this.valueOf()<n.valueOf():this.clone().endOf(t).valueOf()<n.valueOf())},mn.isBetween=function(e,t,n,s){var i=k(e)?e:bt(e),r=k(t)?t:bt(t);return!!(this.isValid()&&i.isValid()&&r.isValid())&&("("===(s=s||"()")[0]?this.isAfter(i,n):!this.isBefore(i,n))&&(")"===s[1]?this.isBefore(r,n):!this.isAfter(r,n))},mn.isSame=function(e,t){var n,s=k(e)?e:bt(e);return!(!this.isValid()||!s.isValid())&&("millisecond"===(t=H(t)||"millisecond")?this.valueOf()===s.valueOf():(n=s.valueOf(),this.clone().startOf(t).valueOf()<=n&&n<=this.clone().endOf(t).valueOf()))},mn.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)},mn.isSameOrBefore=function(e,t){return this.isSame(e,t)||this.isBefore(e,t)},mn.isValid=function(){return v(this)},mn.lang=Kt,mn.locale=Xt,mn.localeData=en,mn.max=Pt,mn.min=xt,mn.parsingFlags=function(){return _({},g(this))},mn.set=function(e,t){if("object"==typeof e)for(var n=function(e){var t=[];for(var n in e)t.push({unit:n,priority:U[n]});return t.sort(function(e,t){return e.priority-t.priority}),t}(e=R(e)),s=0;s<n.length;s++)this[n[s].unit](e[n[s].unit]);else if(b(this[e=H(e)]))return this[e](t);return this},mn.startOf=function(e){var t;if(void 0===(e=H(e))||"millisecond"===e||!this.isValid())return this;var n=this._isUTC?rn:sn;switch(e){case"year":t=n(this.year(),0,1);break;case"quarter":t=n(this.year(),this.month()-this.month()%3,1);break;case"month":t=n(this.year(),this.month(),1);break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=n(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=nn(t+(this._isUTC?0:6e4*this.utcOffset()),36e5);break;case"minute":t=this._d.valueOf(),t-=nn(t,6e4);break;case"second":t=this._d.valueOf(),t-=nn(t,1e3);break}return this._d.setTime(t),c.updateOffset(this,!0),this},mn.subtract=Bt,mn.toArray=function(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]},mn.toObject=function(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}},mn.toDate=function(){return new Date(this.valueOf())},mn.toISOString=function(e){if(!this.isValid())return null;var t=!0!==e,n=t?this.clone().utc():this;return n.year()<0||9999<n.year()?A(n,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):b(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",A(n,"Z")):A(n,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},mn.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="";this.isLocal()||(e=0===this.utcOffset()?"moment.utc":"moment.parseZone",t="Z");var n="["+e+'("]',s=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",i=t+'[")]';return this.format(n+s+"-MM-DD[T]HH:mm:ss.SSS"+i)},mn.toJSON=function(){return this.isValid()?this.toISOString():null},mn.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},mn.unix=function(){return Math.floor(this.valueOf()/1e3)},mn.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},mn.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},mn.year=Oe,mn.isLeapYear=function(){return De(this.year())},mn.weekYear=function(e){return on.call(this,e,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)},mn.isoWeekYear=function(e){return on.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)},mn.quarter=mn.quarters=function(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)},mn.month=Ue,mn.daysInMonth=function(){return Pe(this.year(),this.month())},mn.week=mn.weeks=function(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")},mn.isoWeek=mn.isoWeeks=function(e){var t=Ie(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")},mn.weeksInYear=function(){var e=this.localeData()._week;return Ae(this.year(),e.dow,e.doy)},mn.isoWeeksInYear=function(){return Ae(this.year(),1,4)},mn.date=un,mn.day=mn.days=function(e){if(!this.isValid())return null!=e?this:NaN;var t,n,s=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(t=e,n=this.localeData(),e="string"!=typeof t?t:isNaN(t)?"number"==typeof(t=n.weekdaysParse(t))?t:null:parseInt(t,10),this.add(e-s,"d")):s},mn.weekday=function(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")},mn.isoWeekday=function(e){if(!this.isValid())return null!=e?this:NaN;if(null==e)return this.day()||7;var t,n,s=(t=e,n=this.localeData(),"string"==typeof t?n.weekdaysParse(t)%7||7:isNaN(t)?null:t);return this.day(this.day()%7?s:s-7)},mn.dayOfYear=function(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},mn.hour=mn.hours=nt,mn.minute=mn.minutes=ln,mn.second=mn.seconds=dn,mn.millisecond=mn.milliseconds=fn,mn.utcOffset=function(e,t,n){var s,i=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null==e)return this._isUTC?i:Vt(this);if("string"==typeof e){if(null===(e=Nt(re,e)))return this}else Math.abs(e)<16&&!n&&(e*=60);return!this._isUTC&&t&&(s=Vt(this)),this._offset=e,this._isUTC=!0,null!=s&&this.add(s,"m"),i!==e&&(!t||this._changeInProgress?qt(this,jt(e-i,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,c.updateOffset(this,!0),this._changeInProgress=null)),this},mn.utc=function(e){return this.utcOffset(0,e)},mn.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(Vt(this),"m")),this},mn.parseZone=function(){if(null!=this._tzm)this.utcOffset(this._tzm,!1,!0);else if("string"==typeof this._i){var e=Nt(ie,this._i);null!=e?this.utcOffset(e):this.utcOffset(0,!0)}return this},mn.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?bt(e).utcOffset():0,(this.utcOffset()-e)%60==0)},mn.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},mn.isLocal=function(){return!!this.isValid()&&!this._isUTC},mn.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},mn.isUtc=Et,mn.isUTC=Et,mn.zoneAbbr=function(){return this._isUTC?"UTC":""},mn.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},mn.dates=n("dates accessor is deprecated. Use date instead.",un),mn.months=n("months accessor is deprecated. Use month instead",Ue),mn.years=n("years accessor is deprecated. Use year instead",Oe),mn.zone=n("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}),mn.isDSTShifted=n("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!l(this._isDSTShifted))return this._isDSTShifted;var e={};if(w(e,this),(e=Ot(e))._a){var t=e._isUTC?y(e._a):bt(e._a);this._isDSTShifted=this.isValid()&&0<a(e._a,t.toArray())}else this._isDSTShifted=!1;return this._isDSTShifted});var yn=P.prototype;function gn(e,t,n,s){var i=ht(),r=y().set(s,t);return i[n](r,e)}function vn(e,t,n){if(h(e)&&(t=e,e=void 0),e=e||"",null!=t)return gn(e,t,n,"month");var s,i=[];for(s=0;s<12;s++)i[s]=gn(e,s,n,"month");return i}function pn(e,t,n,s){t=("boolean"==typeof e?h(t)&&(n=t,t=void 0):(t=e,e=!1,h(n=t)&&(n=t,t=void 0)),t||"");var i,r=ht(),a=e?r._week.dow:0;if(null!=n)return gn(t,(n+a)%7,s,"day");var o=[];for(i=0;i<7;i++)o[i]=gn(t,(i+a)%7,s,"day");return o}yn.calendar=function(e,t,n){var s=this._calendar[e]||this._calendar.sameElse;return b(s)?s.call(t,n):s},yn.longDateFormat=function(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.replace(/MMMM|MM|DD|dddd/g,function(e){return e.slice(1)}),this._longDateFormat[e])},yn.invalidDate=function(){return this._invalidDate},yn.ordinal=function(e){return this._ordinal.replace("%d",e)},yn.preparse=_n,yn.postformat=_n,yn.relativeTime=function(e,t,n,s){var i=this._relativeTime[n];return b(i)?i(e,t,n,s):i.replace(/%d/i,e)},yn.pastFuture=function(e,t){var n=this._relativeTime[0<e?"future":"past"];return b(n)?n(t):n.replace(/%s/i,t)},yn.set=function(e){var t,n;for(n in e)b(t=e[n])?this[n]=t:this["_"+n]=t;this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},yn.months=function(e,t){return e?o(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||We).test(t)?"format":"standalone"][e.month()]:o(this._months)?this._months:this._months.standalone},yn.monthsShort=function(e,t){return e?o(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[We.test(t)?"format":"standalone"][e.month()]:o(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},yn.monthsParse=function(e,t,n){var s,i,r;if(this._monthsParseExact)return function(e,t,n){var s,i,r,a=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],s=0;s<12;++s)r=y([2e3,s]),this._shortMonthsParse[s]=this.monthsShort(r,"").toLocaleLowerCase(),this._longMonthsParse[s]=this.months(r,"").toLocaleLowerCase();return n?"MMM"===t?-1!==(i=Ye.call(this._shortMonthsParse,a))?i:null:-1!==(i=Ye.call(this._longMonthsParse,a))?i:null:"MMM"===t?-1!==(i=Ye.call(this._shortMonthsParse,a))?i:-1!==(i=Ye.call(this._longMonthsParse,a))?i:null:-1!==(i=Ye.call(this._longMonthsParse,a))?i:-1!==(i=Ye.call(this._shortMonthsParse,a))?i:null}.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),s=0;s<12;s++){if(i=y([2e3,s]),n&&!this._longMonthsParse[s]&&(this._longMonthsParse[s]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[s]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[s]||(r="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[s]=new RegExp(r.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[s].test(e))return s;if(n&&"MMM"===t&&this._shortMonthsParse[s].test(e))return s;if(!n&&this._monthsParse[s].test(e))return s}},yn.monthsRegex=function(e){return this._monthsParseExact?(m(this,"_monthsRegex")||Ne.call(this),e?this._monthsStrictRegex:this._monthsRegex):(m(this,"_monthsRegex")||(this._monthsRegex=Le),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},yn.monthsShortRegex=function(e){return this._monthsParseExact?(m(this,"_monthsRegex")||Ne.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(m(this,"_monthsShortRegex")||(this._monthsShortRegex=Fe),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},yn.week=function(e){return Ie(e,this._week.dow,this._week.doy).week},yn.firstDayOfYear=function(){return this._week.doy},yn.firstDayOfWeek=function(){return this._week.dow},yn.weekdays=function(e,t){var n=o(this._weekdays)?this._weekdays:this._weekdays[e&&!0!==e&&this._weekdays.isFormat.test(t)?"format":"standalone"];return!0===e?je(n,this._week.dow):e?n[e.day()]:n},yn.weekdaysMin=function(e){return!0===e?je(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin},yn.weekdaysShort=function(e){return!0===e?je(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort},yn.weekdaysParse=function(e,t,n){var s,i,r;if(this._weekdaysParseExact)return function(e,t,n){var s,i,r,a=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],s=0;s<7;++s)r=y([2e3,1]).day(s),this._minWeekdaysParse[s]=this.weekdaysMin(r,"").toLocaleLowerCase(),this._shortWeekdaysParse[s]=this.weekdaysShort(r,"").toLocaleLowerCase(),this._weekdaysParse[s]=this.weekdays(r,"").toLocaleLowerCase();return n?"dddd"===t?-1!==(i=Ye.call(this._weekdaysParse,a))?i:null:"ddd"===t?-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:null:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:null:"dddd"===t?-1!==(i=Ye.call(this._weekdaysParse,a))?i:-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:null:"ddd"===t?-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:-1!==(i=Ye.call(this._weekdaysParse,a))?i:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:null:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:-1!==(i=Ye.call(this._weekdaysParse,a))?i:-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:null}.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),s=0;s<7;s++){if(i=y([2e3,1]).day(s),n&&!this._fullWeekdaysParse[s]&&(this._fullWeekdaysParse[s]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[s]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[s]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[s]||(r="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[s]=new RegExp(r.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[s].test(e))return s;if(n&&"ddd"===t&&this._shortWeekdaysParse[s].test(e))return s;if(n&&"dd"===t&&this._minWeekdaysParse[s].test(e))return s;if(!n&&this._weekdaysParse[s].test(e))return s}},yn.weekdaysRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Qe.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(m(this,"_weekdaysRegex")||(this._weekdaysRegex=qe),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},yn.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Qe.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(m(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Je),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},yn.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Qe.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(m(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Be),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},yn.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},yn.meridiem=function(e,t,n){return 11<e?n?"pm":"PM":n?"am":"AM"},ut("en",{dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===D(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}}),c.lang=n("moment.lang is deprecated. Use moment.locale instead.",ut),c.langData=n("moment.langData is deprecated. Use moment.localeData instead.",ht);var wn=Math.abs;function Mn(e,t,n,s){var i=jt(t,n);return e._milliseconds+=s*i._milliseconds,e._days+=s*i._days,e._months+=s*i._months,e._bubble()}function kn(e){return e<0?Math.floor(e):Math.ceil(e)}function Sn(e){return 4800*e/146097}function Dn(e){return 146097*e/4800}function Yn(e){return function(){return this.as(e)}}var On=Yn("ms"),Tn=Yn("s"),bn=Yn("m"),xn=Yn("h"),Pn=Yn("d"),Wn=Yn("w"),Cn=Yn("M"),Hn=Yn("Q"),Rn=Yn("y");function Un(e){return function(){return this.isValid()?this._data[e]:NaN}}var Fn=Un("milliseconds"),Ln=Un("seconds"),Nn=Un("minutes"),Gn=Un("hours"),Vn=Un("days"),En=Un("months"),In=Un("years");var An=Math.round,jn={ss:44,s:45,m:45,h:22,d:26,M:11};var Zn=Math.abs;function zn(e){return(0<e)-(e<0)||+e}function $n(){if(!this.isValid())return this.localeData().invalidDate();var e,t,n=Zn(this._milliseconds)/1e3,s=Zn(this._days),i=Zn(this._months);t=S((e=S(n/60))/60),n%=60,e%=60;var r=S(i/12),a=i%=12,o=s,u=t,l=e,h=n?n.toFixed(3).replace(/\.?0+$/,""):"",d=this.asSeconds();if(!d)return"P0D";var c=d<0?"-":"",f=zn(this._months)!==zn(d)?"-":"",m=zn(this._days)!==zn(d)?"-":"",_=zn(this._milliseconds)!==zn(d)?"-":"";return c+"P"+(r?f+r+"Y":"")+(a?f+a+"M":"")+(o?m+o+"D":"")+(u||l||h?"T":"")+(u?_+u+"H":"")+(l?_+l+"M":"")+(h?_+h+"S":"")}var qn=Ht.prototype;return qn.isValid=function(){return this._isValid},qn.abs=function(){var e=this._data;return this._milliseconds=wn(this._milliseconds),this._days=wn(this._days),this._months=wn(this._months),e.milliseconds=wn(e.milliseconds),e.seconds=wn(e.seconds),e.minutes=wn(e.minutes),e.hours=wn(e.hours),e.months=wn(e.months),e.years=wn(e.years),this},qn.add=function(e,t){return Mn(this,e,t,1)},qn.subtract=function(e,t){return Mn(this,e,t,-1)},qn.as=function(e){if(!this.isValid())return NaN;var t,n,s=this._milliseconds;if("month"===(e=H(e))||"quarter"===e||"year"===e)switch(t=this._days+s/864e5,n=this._months+Sn(t),e){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(t=this._days+Math.round(Dn(this._months)),e){case"week":return t/7+s/6048e5;case"day":return t+s/864e5;case"hour":return 24*t+s/36e5;case"minute":return 1440*t+s/6e4;case"second":return 86400*t+s/1e3;case"millisecond":return Math.floor(864e5*t)+s;default:throw new Error("Unknown unit "+e)}},qn.asMilliseconds=On,qn.asSeconds=Tn,qn.asMinutes=bn,qn.asHours=xn,qn.asDays=Pn,qn.asWeeks=Wn,qn.asMonths=Cn,qn.asQuarters=Hn,qn.asYears=Rn,qn.valueOf=function(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*D(this._months/12):NaN},qn._bubble=function(){var e,t,n,s,i,r=this._milliseconds,a=this._days,o=this._months,u=this._data;return 0<=r&&0<=a&&0<=o||r<=0&&a<=0&&o<=0||(r+=864e5*kn(Dn(o)+a),o=a=0),u.milliseconds=r%1e3,e=S(r/1e3),u.seconds=e%60,t=S(e/60),u.minutes=t%60,n=S(t/60),u.hours=n%24,o+=i=S(Sn(a+=S(n/24))),a-=kn(Dn(i)),s=S(o/12),o%=12,u.days=a,u.months=o,u.years=s,this},qn.clone=function(){return jt(this)},qn.get=function(e){return e=H(e),this.isValid()?this[e+"s"]():NaN},qn.milliseconds=Fn,qn.seconds=Ln,qn.minutes=Nn,qn.hours=Gn,qn.days=Vn,qn.weeks=function(){return S(this.days()/7)},qn.months=En,qn.years=In,qn.humanize=function(e){if(!this.isValid())return this.localeData().invalidDate();var t,n,s,i,r,a,o,u,l,h,d,c=this.localeData(),f=(n=!e,s=c,i=jt(t=this).abs(),r=An(i.as("s")),a=An(i.as("m")),o=An(i.as("h")),u=An(i.as("d")),l=An(i.as("M")),h=An(i.as("y")),(d=r<=jn.ss&&["s",r]||r<jn.s&&["ss",r]||a<=1&&["m"]||a<jn.m&&["mm",a]||o<=1&&["h"]||o<jn.h&&["hh",o]||u<=1&&["d"]||u<jn.d&&["dd",u]||l<=1&&["M"]||l<jn.M&&["MM",l]||h<=1&&["y"]||["yy",h])[2]=n,d[3]=0<+t,d[4]=s,function(e,t,n,s,i){return i.relativeTime(t||1,!!n,e,s)}.apply(null,d));return e&&(f=c.pastFuture(+this,f)),c.postformat(f)},qn.toISOString=$n,qn.toString=$n,qn.toJSON=$n,qn.locale=Xt,qn.localeData=en,qn.toIsoString=n("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",$n),qn.lang=Kt,I("X",0,0,"unix"),I("x",0,0,"valueOf"),ue("x",se),ue("X",/[+-]?\d+(\.\d{1,3})?/),ce("X",function(e,t,n){n._d=new Date(1e3*parseFloat(e,10))}),ce("x",function(e,t,n){n._d=new Date(D(e))}),c.version="2.24.0",e=bt,c.fn=mn,c.min=function(){return Wt("isBefore",[].slice.call(arguments,0))},c.max=function(){return Wt("isAfter",[].slice.call(arguments,0))},c.now=function(){return Date.now?Date.now():+new Date},c.utc=y,c.unix=function(e){return bt(1e3*e)},c.months=function(e,t){return vn(e,t,"months")},c.isDate=d,c.locale=ut,c.invalid=p,c.duration=jt,c.isMoment=k,c.weekdays=function(e,t,n){return pn(e,t,n,"weekdays")},c.parseZone=function(){return bt.apply(null,arguments).parseZone()},c.localeData=ht,c.isDuration=Rt,c.monthsShort=function(e,t){return vn(e,t,"monthsShort")},c.weekdaysMin=function(e,t,n){return pn(e,t,n,"weekdaysMin")},c.defineLocale=lt,c.updateLocale=function(e,t){if(null!=t){var n,s,i=st;null!=(s=ot(e))&&(i=s._config),(n=new P(t=x(i,t))).parentLocale=it[e],it[e]=n,ut(e)}else null!=it[e]&&(null!=it[e].parentLocale?it[e]=it[e].parentLocale:null!=it[e]&&delete it[e]);return it[e]},c.locales=function(){return s(it)},c.weekdaysShort=function(e,t,n){return pn(e,t,n,"weekdaysShort")},c.normalizeUnits=H,c.relativeTimeRounding=function(e){return void 0===e?An:"function"==typeof e&&(An=e,!0)},c.relativeTimeThreshold=function(e,t){return void 0!==jn[e]&&(void 0===t?jn[e]:(jn[e]=t,"s"===e&&(jn.ss=t-1),!0))},c.calendarFormat=function(e,t){var n=e.diff(t,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"},c.prototype=mn,c.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},c}); \ No newline at end of file From ff92deb93ecd30669ba17e0ad58f3fc64a68e2fe Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Tue, 3 Dec 2019 10:26:00 +0200 Subject: [PATCH 0203/1143] Fixing static tests --- .../Config/Model/Config/Structure/Element/Dependency/Field.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Config/Model/Config/Structure/Element/Dependency/Field.php b/app/code/Magento/Config/Model/Config/Structure/Element/Dependency/Field.php index 8f4d82eed51c5..28e1ba505a2ce 100644 --- a/app/code/Magento/Config/Model/Config/Structure/Element/Dependency/Field.php +++ b/app/code/Magento/Config/Model/Config/Structure/Element/Dependency/Field.php @@ -6,6 +6,8 @@ namespace Magento\Config\Model\Config\Structure\Element\Dependency; /** + * Field + * * @api * @since 100.0.2 */ From f64cd491cd0a4574b572de10e609870a746e3e48 Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Tue, 3 Dec 2019 10:27:55 +0200 Subject: [PATCH 0204/1143] Revert "Fixing static tests" This reverts commit ff92deb93ecd30669ba17e0ad58f3fc64a68e2fe. --- .../Config/Model/Config/Structure/Element/Dependency/Field.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/code/Magento/Config/Model/Config/Structure/Element/Dependency/Field.php b/app/code/Magento/Config/Model/Config/Structure/Element/Dependency/Field.php index 28e1ba505a2ce..8f4d82eed51c5 100644 --- a/app/code/Magento/Config/Model/Config/Structure/Element/Dependency/Field.php +++ b/app/code/Magento/Config/Model/Config/Structure/Element/Dependency/Field.php @@ -6,8 +6,6 @@ namespace Magento\Config\Model\Config\Structure\Element\Dependency; /** - * Field - * * @api * @since 100.0.2 */ From c3804b7a43e32dff6e9066e5030e898b4f1bc986 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Tue, 3 Dec 2019 15:08:07 +0200 Subject: [PATCH 0205/1143] Test for magento/magento2#25666. --- .../Section/StorefrontProductMediaSection.xml | 2 + .../Test/StorefrontFotoramaArrowsTest.xml | 61 +++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/StorefrontFotoramaArrowsTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductMediaSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductMediaSection.xml index 6ed359e35ab59..d3e43d9ea2dfa 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductMediaSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductMediaSection.xml @@ -17,5 +17,7 @@ <element name="imageFile" type="text" selector="//*[@class='product media']//img[contains(@src, '{{filename}}')]" parameterized="true"/> <element name="productImageActive" type="text" selector=".product.media div[data-active=true] > img[src*='{{filename}}']" parameterized="true"/> <element name="productImageInFotorama" type="file" selector=".fotorama__nav__shaft img[src*='{{imageName}}']" parameterized="true"/> + <element name="fotoramaPrevButton" type="button" selector="//*[@data-gallery-role='gallery']//*[@data-gallery-role='nav-wrap']//*[@data-gallery-role='arrow' and contains(@class, 'fotorama__thumb__arr--left')]"/> + <element name="fotoramaNextButton" type="button" selector="//*[@data-gallery-role='gallery']//*[@data-gallery-role='nav-wrap']//*[@data-gallery-role='arrow' and contains(@class, 'fotorama__thumb__arr--right')]"/> </section> </sections> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontFotoramaArrowsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontFotoramaArrowsTest.xml new file mode 100644 index 0000000000000..25d1dcedea0d5 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontFotoramaArrowsTest.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminAddDefaultImageSimpleProductTest"> + <annotations> + <features value="Catalog"/> + <title value="Storefront Fotorama arrows test"/> + <description value="Check arrows next to the thumbs are not visible than there is room for all pictures."/> + <severity value="MINOR"/> + <group value="Catalog"/> + </annotations> + <before> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <createData entity="_defaultProduct" stepKey="createProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <actionGroup ref="logout" stepKey="logout"/> + <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + </after> + + <!-- Open Product for edit --> + <actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="findCreatedProductInGrid"> + <argument name="product" value="$$createProduct$$"/> + </actionGroup> + <actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="goToEditProductPage"> + <argument name="product" value="$$createProduct$$"/> + </actionGroup> + + <!-- Add images to product --> + <actionGroup ref="addProductImage" stepKey="addFirstImageToProduct"> + <argument name="image" value="MagentoLogo"/> + </actionGroup> + <actionGroup ref="addProductImage" stepKey="addSecondImageToProduct"> + <argument name="image" value="ProductImage"/> + </actionGroup> + <actionGroup ref="addProductImage" stepKey="addThirdImageToProduct"> + <argument name="image" value="TestImageNew"/> + </actionGroup> + <actionGroup ref="saveProductForm" stepKey="saveSimpleProduct"/> + + <!-- Assert product in storefront product page --> + <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openCreatedProductPage"> + <argument name="productUrl" value="$$createProduct.name$$"/> + </actionGroup> + + <!-- Assert Fotorama arrows aren't visible --> + <dontSeeElement selector="{{StorefrontProductMediaSection.fotoramaPrevButton}}" stepKey="dontSeePrevButton"/> + <dontSeeElement selector="{{StorefrontProductMediaSection.fotoramaNextButton}}" stepKey="dontSeeNextButton"/> + </test> +</tests> From ee115feeb5d412c69d3e8a8fc9b58e7d406207e6 Mon Sep 17 00:00:00 2001 From: Sergiy Zhovnir <s.zhovnir@atwix.com> Date: Tue, 3 Dec 2019 16:06:36 +0200 Subject: [PATCH 0206/1143] #issue-761 Adjusted the PR --- app/code/Magento/Ui/view/base/web/js/grid/columns/image.js | 2 ++ .../Magento_Ui/web/css/source/module/_masonry-grid.less | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/view/base/web/js/grid/columns/image.js b/app/code/Magento/Ui/view/base/web/js/grid/columns/image.js index 0bd93f8e629b7..e8e1cf3246c76 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/columns/image.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/columns/image.js @@ -84,6 +84,8 @@ define([ * Get is active record * * @param {Object} record - Data to be preprocessed. + * + * @returns {Boolean} */ getIsActive: function (record) { return this.previewComponent().visibleRecord() === record._rowIndex || false; diff --git a/app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/module/_masonry-grid.less b/app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/module/_masonry-grid.less index f805861be90e2..9dd42246dac3f 100644 --- a/app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/module/_masonry-grid.less +++ b/app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/module/_masonry-grid.less @@ -5,6 +5,7 @@ @admin__masonry_grid_image__space: 20px; @admin__masonry_grid_background_color: #fff; @admin__masonry_overlay_background_color: #507dc8; +@admin__masonry_grid_active_image_border_color: #558dd6; & when (@media-common = true) { .masonry-image { @@ -30,7 +31,7 @@ .masonry-image-block { &.active { img { - border: 2px #558dd6 solid; + border: 2px @admin__masonry_grid_active_image_border_color solid; padding: 1px; } } From 6c7f33b067a36b89e41166bf82a7e41bd648a1ce Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Tue, 3 Dec 2019 16:30:21 +0200 Subject: [PATCH 0207/1143] Test for magento/magento2#24973. --- .../Model/ResourceModel/Product/CollectionTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Product/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Product/CollectionTest.php index 86dcf9d96d086..e8d472fb98c6f 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Product/CollectionTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Product/CollectionTest.php @@ -287,8 +287,8 @@ public function testAddAttributeToFilterAffectsGetSize(): void */ public function testAddAttributeTierPriceToFilter($condition): void { - $this->collection->addAttributeToFilter('tier_price', $condition); - $this->assertEquals(1, $this->collection->getSize()); + $size = $this->collection->addAttributeToFilter('tier_price', $condition)->getSize(); + $this->assertEquals(1, $size); } /** @@ -314,8 +314,8 @@ public function addAttributeTierPriceToFilterDataProvider(): array */ public function testAddAttributeIsSaleableToFilter($condition): void { - $this->collection->addAttributeToFilter('is_saleable', $condition); - $this->assertEquals(1, $this->collection->getSize()); + $size = $this->collection->addAttributeToFilter('is_saleable', $condition)->getSize(); + $this->assertEquals(1, $size); } /** From b1a2a29671de32d90dbc10a3b0ced6a3d71b2b72 Mon Sep 17 00:00:00 2001 From: Ihor Sviziev <svizev.igor@gmail.com> Date: Tue, 3 Dec 2019 21:45:36 +0200 Subject: [PATCH 0208/1143] magento/magento2#25603 Fix removing query string from url after redirect Cover with integration tests cases with external URLs as target path --- .../UrlRewrite/Controller/UrlRewriteTest.php | 27 ++++++++++++-- .../Magento/UrlRewrite/_files/url_rewrite.php | 36 +++++++++++++++++++ .../_files/url_rewrite_rollback.php | 16 ++++++++- 3 files changed, 76 insertions(+), 3 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/UrlRewrite/Controller/UrlRewriteTest.php b/dev/tests/integration/testsuite/Magento/UrlRewrite/Controller/UrlRewriteTest.php index b6a551cc6ad50..cea44226f6192 100644 --- a/dev/tests/integration/testsuite/Magento/UrlRewrite/Controller/UrlRewriteTest.php +++ b/dev/tests/integration/testsuite/Magento/UrlRewrite/Controller/UrlRewriteTest.php @@ -44,8 +44,7 @@ public function testMatchUrlRewrite( $location = $response->getHeader('Location')->getFieldValue(); $this->assertStringEndsWith( $redirect, - $location, - 'Invalid location header' + $location ); } } @@ -110,6 +109,30 @@ public function requestDataProvider(): array 'request' => '/page-similar-query-param/?param2=1', 'redirect' => '/page-e?param1=1¶m2=1', ], + 'Use Case #13: Rewrite: page-external1 --(301)--> http://example.com/external;' + . 'Request: page-external1?param1=1 --(301)--> http://example.com/external (not fills get params)' => [ + 'request' => '/page-external1?param1=1', + 'redirect' => 'http://example.com/external', + ], + 'Use Case #14: Rewrite: page-external2/ --(301)--> https://example.com/external2/;' + . 'Request: page-external2?param2=1 --(301)--> https://example.com/external2/ (not fills get params)' => [ + 'request' => '/page-external2?param2=1', + 'redirect' => 'https://example.com/external2/', + ], + 'Use Case #15: Rewrite: page-external3 --(301)--> http://example.com/external?param1=value1;' + . 'Request: page-external3?param1=custom1¶m2=custom2 --(301)--> ' + . 'http://example.com/external?param1=value1' + . ' (fills get param from target path)' => [ + 'request' => '/page-external3?param1=custom1¶m2=custom2', + 'redirect' => 'http://example.com/external?param1=value1', + ], + 'Use Case #16: Rewrite: page-external4/ --(301)--> https://example.com/external2/?param2=value2;' + . 'Request: page-external4?param1=custom1¶m2=custom2 --(301)--> ' + . 'https://example.com/external2/?param2=value2 ' + . ' (fills get param from target path)' => [ + 'request' => '/page-external4?param1=custom1¶m2=custom2', + 'redirect' => 'https://example.com/external2/?param2=value2', + ], ]; } } diff --git a/dev/tests/integration/testsuite/Magento/UrlRewrite/_files/url_rewrite.php b/dev/tests/integration/testsuite/Magento/UrlRewrite/_files/url_rewrite.php index dc3f5490f5a53..68d1212539c6d 100644 --- a/dev/tests/integration/testsuite/Magento/UrlRewrite/_files/url_rewrite.php +++ b/dev/tests/integration/testsuite/Magento/UrlRewrite/_files/url_rewrite.php @@ -155,3 +155,39 @@ ->setStoreId($storeID) ->setDescription('From page-similar-query-param with trailing slash to page-e with query param'); $rewriteResource->save($rewrite); + +$rewrite = $objectManager->create(UrlRewrite::class); +$rewrite->setEntityType('custom') + ->setRequestPath('page-external1') + ->setTargetPath('http://example.com/external') + ->setRedirectType(OptionProvider::PERMANENT) + ->setStoreId($storeID) + ->setDescription('From page-external to external URL'); +$rewriteResource->save($rewrite); + +$rewrite = $objectManager->create(UrlRewrite::class); +$rewrite->setEntityType('custom') + ->setRequestPath('page-external2/') + ->setTargetPath('https://example.com/external2/') + ->setRedirectType(OptionProvider::PERMANENT) + ->setStoreId($storeID) + ->setDescription('From page-external with trailing slash to external URL'); +$rewriteResource->save($rewrite); + +$rewrite = $objectManager->create(UrlRewrite::class); +$rewrite->setEntityType('custom') + ->setRequestPath('page-external3') + ->setTargetPath('http://example.com/external?param1=value1') + ->setRedirectType(OptionProvider::PERMANENT) + ->setStoreId($storeID) + ->setDescription('From page-external to external URL'); +$rewriteResource->save($rewrite); + +$rewrite = $objectManager->create(UrlRewrite::class); +$rewrite->setEntityType('custom') + ->setRequestPath('page-external4/') + ->setTargetPath('https://example.com/external2/?param2=value2') + ->setRedirectType(OptionProvider::PERMANENT) + ->setStoreId($storeID) + ->setDescription('From page-external with trailing slash to external URL'); +$rewriteResource->save($rewrite); diff --git a/dev/tests/integration/testsuite/Magento/UrlRewrite/_files/url_rewrite_rollback.php b/dev/tests/integration/testsuite/Magento/UrlRewrite/_files/url_rewrite_rollback.php index 76b84810ac433..a5c21f7a00e48 100644 --- a/dev/tests/integration/testsuite/Magento/UrlRewrite/_files/url_rewrite_rollback.php +++ b/dev/tests/integration/testsuite/Magento/UrlRewrite/_files/url_rewrite_rollback.php @@ -31,7 +31,21 @@ ->create(\Magento\UrlRewrite\Model\ResourceModel\UrlRewriteCollection::class); $collection = $urlRewriteCollection ->addFieldToFilter('entity_type', 'custom') - ->addFieldToFilter('target_path', ['page-a/', 'page-a', 'page-b', 'page-c', 'page-d?param1=1', 'page-e?param1=1']) + ->addFieldToFilter( + 'target_path', + [ + 'page-a/', + 'page-a', + 'page-b', + 'page-c', + 'page-d?param1=1', + 'page-e?param1=1', + 'http://example.com/external', + 'https://example.com/external2/', + 'http://example.com/external?param1=value1', + 'https://example.com/external2/?param2=value2' + ] + ) ->load() ->walk('delete'); From d904436ab74f88afb6102aff022fc206e7abd199 Mon Sep 17 00:00:00 2001 From: Ashna-Jahan <32352950+Ashna-Jahan@users.noreply.github.com> Date: Wed, 4 Dec 2019 13:39:27 +0530 Subject: [PATCH 0209/1143] Fixed the issue. --- .../css/source/forms/fields/_control-table.less | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less b/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less index f8e50db60281c..22957cb86cb55 100644 --- a/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less +++ b/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less @@ -238,12 +238,20 @@ } } -.product_form_product_form_advanced_pricing_modal .admin__fieldset > .admin__field > .admin__field-control { - width: calc(~"(100%) * 0.57 - 30px"); +.product_form_product_form_advanced_pricing_modal .admin__fieldset > .admin__field > .admin__field-label, .product_form_product_form_advanced_pricing_modal [class*='admin__control-grouped'] > .admin__field:first-child > .admin__field-label { + margin-left: 0; +} + +.product_form_product_form_advanced_pricing_modal .admin__control-table td, +.product_form_product_form_advanced_pricing_modal .admin__control-table th { + padding: 1.3rem 0.7rem 1.3rem 0.3; + overflow-y: visible; +} +.product_form_product_form_advanced_pricing_modal .admin__fieldset { + margin: -40px; } .product_form_product_form_advanced_pricing_modal .admin__control-table-wrapper { overflow-x: visible; overflow-y: visible; } - From 5db4ca7b241868aed4847491dc27332e361888e4 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Wed, 4 Dec 2019 16:44:28 +0200 Subject: [PATCH 0210/1143] Test for magento/magento2#25149. --- .../Catalog/Test/Mftf/Data/ProductData.xml | 5 ++ ...AdminProductCustomizableOptionsSection.xml | 1 + ...minCreateOrderWithDateTimeOptionUITest.xml | 49 +++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithDateTimeOptionUITest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml index bd02bc0e4b340..46bb6e527608f 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml @@ -528,6 +528,11 @@ <requiredEntity type="product_option">ProductOptionDateTime</requiredEntity> <requiredEntity type="product_option">ProductOptionTime</requiredEntity> </entity> + <entity name="productWithDateTimeOption" type="product"> + <var key="sku" entityType="product" entityKey="sku" /> + <data key="file">magento.jpg</data> + <requiredEntity type="product_option">ProductOptionDateTime</requiredEntity> + </entity> <entity name="productWithOptionRadiobutton" type="product"> <var key="sku" entityType="product" entityKey="sku" /> <requiredEntity type="product_option">ProductOptionRadiobuttonWithTwoFixedOptions</requiredEntity> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductCustomizableOptionsSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductCustomizableOptionsSection.xml index fa2f9feffdf91..8802372968f65 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductCustomizableOptionsSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductCustomizableOptionsSection.xml @@ -9,6 +9,7 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminProductCustomizableOptionsSection"> + <element name="requiredFieldIndicator" type="text" selector=" return window.getComputedStyle(document.querySelector('#product_composite_configure_form_fields .admin__field.required .admin__field-label'), ':after').getPropertyValue('content');"/> <element name="checkIfCustomizableOptionsTabOpen" type="text" selector="//span[text()='Customizable Options']/parent::strong/parent::*[@data-state-collapsible='closed']" timeout="30"/> <element name="customizableOptions" type="text" selector="//strong[contains(@class, 'admin__collapsible-title')]/span[text()='Customizable Options']"/> <element name="useDefaultOptionTitle" type="text" selector="[data-index='options'] tr.data-row [data-index='title'] [name^='options_use_default']"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithDateTimeOptionUITest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithDateTimeOptionUITest.xml new file mode 100644 index 0000000000000..06c2375a26616 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithDateTimeOptionUITest.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="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateOrderWithDateTimeOptionUITest"> + <annotations> + <title value="Admin create order with date time option UI test"/> + <description value="Check asterisk rendered correctly for Product with custom option (datetime) at backend"/> + <features value="Sales"/> + <severity value="MINOR"/> + <group value="Sales"/> + </annotations> + + <before> + <createData entity="Simple_US_Customer" stepKey="createCustomer"/> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <createData entity="_defaultProduct" stepKey="createProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + <updateData createDataKey="createProduct" entity="productWithDateTimeOption" stepKey="updateProductWithOption"/> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <actionGroup ref="logout" stepKey="logout"/> + <deleteData createDataKey="createProduct" stepKey="deleteSimpleProduct"/> + <deleteData createDataKey="createCustomer" stepKey="deleteSimpleCustomer"/> + </after> + + <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderWithExistingCustomer"> + <argument name="customer" value="$$createCustomer$$"/> + </actionGroup> + + <click selector="{{AdminOrderFormItemsSection.addProducts}}" stepKey="clickAddProducts"/> + <fillField selector="{{AdminOrderFormItemsSection.skuFilter}}" userInput="$$createProduct.sku$$" stepKey="fillSkuFilter"/> + <click selector="{{AdminOrderFormItemsSection.search}}" stepKey="clickSearch"/> + <scrollTo selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" x="0" y="-100" stepKey="scrollToCheckColumn"/> + <checkOption selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" stepKey="selectProduct"/> + <waitForAjaxLoad stepKey="waitForAjaxLoad"/> + <executeJS function="{{AdminProductCustomizableOptionsSection.requiredFieldIndicator}}" stepKey="dateTimeRequiredFieldIndicator"/> + <assertEquals expected='"*"' expectedType="string" actualType="variable" actual="dateTimeRequiredFieldIndicator" message="pass" stepKey="assertRequiredFieldIndicator"/> + </test> +</tests> + From a4d57b99f4163ca929433f20d56630e99f234a54 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Wed, 4 Dec 2019 22:50:34 +0700 Subject: [PATCH 0211/1143] Resolve issue 25896: Cannot create folder using only letters --- .../Magento/Cms/Model/Wysiwyg/Images/Storage.php | 2 +- .../Unit/Model/Wysiwyg/Images/StorageTest.php | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php b/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php index e02d2b461a94e..21f3b232e783c 100644 --- a/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php +++ b/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php @@ -416,7 +416,7 @@ public function createDirectory($name, $path) { if (!preg_match(self::DIRECTORY_NAME_REGEXP, $name)) { throw new \Magento\Framework\Exception\LocalizedException( - __('Please rename the folder using only letters, numbers, underscores and dashes.') + __('Please rename the folder using only Latin letters, numbers, underscores and dashes.') ); } diff --git a/app/code/Magento/Cms/Test/Unit/Model/Wysiwyg/Images/StorageTest.php b/app/code/Magento/Cms/Test/Unit/Model/Wysiwyg/Images/StorageTest.php index 662aee671dd24..9a9c63195051c 100644 --- a/app/code/Magento/Cms/Test/Unit/Model/Wysiwyg/Images/StorageTest.php +++ b/app/code/Magento/Cms/Test/Unit/Model/Wysiwyg/Images/StorageTest.php @@ -7,6 +7,7 @@ use Magento\Cms\Model\Wysiwyg\Images\Storage\Collection as StorageCollection; use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\Exception\LocalizedException; /** * @SuppressWarnings(PHPMD.LongVariable) @@ -539,4 +540,18 @@ public function testUploadFile() $this->assertEquals($result, $this->imagesStorage->uploadFile($targetPath, $type)); } + + /** + * Test create directory with invalid name + */ + public function testCreateDirectoryWithInvalidName() + { + $name = 'папка'; + $path = '/tmp/path'; + $this->expectException(LocalizedException::class); + $this->expectExceptionMessage( + (string)__('Please rename the folder using only Latin letters, numbers, underscores and dashes.') + ); + $this->imagesStorage->createDirectory($name, $path); + } } From 4584cabf5f11cb422f9735f12f552e471e69644d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Wed, 4 Dec 2019 21:34:39 +0100 Subject: [PATCH 0212/1143] BACKWARD COMPATIBILITY: Deprecated ActionGroups to make change Backward Compatible. --- .../ActionGroup/_Deprecated_ActionGroup.xml | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 app/code/Magento/Backup/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml diff --git a/app/code/Magento/Backup/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Backup/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml new file mode 100644 index 0000000000000..84c6812ddf183 --- /dev/null +++ b/app/code/Magento/Backup/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<!-- +NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. + Please find the Comment with proper replacement for each of ActionGroups provided. +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="createSystemBackup"> + <annotations> + <description>Creates a System Backup using provided Backup Entity.</description> + </annotations> + <arguments> + <argument name="backup" defaultValue="SystemBackup"/> + </arguments> + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateSystemBackupActionGroup` instead --> + <click selector="{{AdminMainActionsSection.systemBackup}}" stepKey="clickCreateBackupButton"/> + <waitForElementVisible selector="{{AdminCreateBackupFormSection.backupNameField}}" stepKey="waitForForm"/> + <fillField selector="{{AdminCreateBackupFormSection.backupNameField}}" userInput="{{backup.name}}" stepKey="fillBackupName"/> + <click selector="{{AdminCreateBackupFormSection.ok}}" stepKey="clickOk"/> + <waitForElementNotVisible selector=".loading-mask" time="300" stepKey="waitForBackupProcess"/> + <see selector="{{AdminMessagesSection.success}}" userInput="You created the system backup." stepKey="seeSuccessMessage"/> + <see selector="{{AdminGridTableSection.backupNameColumn}}" userInput="{{backup.name}}" stepKey="seeBackupInGrid"/> + <see selector="{{AdminGridTableSection.backupTypeByName(backup.name)}}" userInput="{{backup.type}}" stepKey="seeBackupType"/> + </actionGroup> + + <actionGroup name="createMediaBackup"> + <annotations> + <description>Creates a Media Backup using provided Backup Entity.</description> + </annotations> + <arguments> + <argument name="backup" defaultValue="MediaBackup"/> + </arguments> + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateMediaBackupActionGroup` instead --> + <click selector="{{AdminMainActionsSection.mediaBackup}}" stepKey="clickCreateBackupButton"/> + <waitForElementVisible selector="{{AdminCreateBackupFormSection.backupNameField}}" stepKey="waitForForm"/> + <fillField selector="{{AdminCreateBackupFormSection.backupNameField}}" userInput="{{backup.name}}" stepKey="fillBackupName"/> + <click selector="{{AdminCreateBackupFormSection.ok}}" stepKey="clickOk"/> + <waitForPageLoad time="120" stepKey="waitForBackupProcess"/> + <see selector="{{AdminMessagesSection.success}}" userInput="You created the database and media backup." stepKey="seeSuccessMessage"/> + <see selector="{{AdminGridTableSection.backupNameColumn}}" userInput="{{backup.name}}" stepKey="seeBackupInGrid"/> + <see selector="{{AdminGridTableSection.backupTypeByName(backup.name)}}" userInput="{{backup.type}}" stepKey="seeBackupType"/> + </actionGroup> + + <actionGroup name="createDatabaseBackup"> + <annotations> + <description>Creates a Database Backup using provided Backup Entity.</description> + </annotations> + <arguments> + <argument name="backup" defaultValue="DatabaseBackup"/> + </arguments> + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateDatabaseBackupActionGroup` instead --> + <click selector="{{AdminMainActionsSection.databaseBackup}}" stepKey="clickCreateBackupButton"/> + <waitForElementVisible selector="{{AdminCreateBackupFormSection.backupNameField}}" stepKey="waitForForm"/> + <fillField selector="{{AdminCreateBackupFormSection.backupNameField}}" userInput="{{backup.name}}" stepKey="fillBackupName"/> + <click selector="{{AdminCreateBackupFormSection.ok}}" stepKey="clickOk"/> + <waitForPageLoad time="120" stepKey="waitForBackupProcess"/> + <see selector="{{AdminMessagesSection.success}}" userInput="You created the database backup." stepKey="seeSuccessMessage"/> + <see selector="{{AdminGridTableSection.backupNameColumn}}" userInput="{{backup.name}}" stepKey="seeBackupInGrid"/> + <see selector="{{AdminGridTableSection.backupTypeByName(backup.name)}}" userInput="{{backup.type}}" stepKey="seeBackupType"/> + </actionGroup> +</actionGroups> From 54f094a82ef60da66e0f84fa213be3ef5cb74ad5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Wed, 4 Dec 2019 21:44:58 +0100 Subject: [PATCH 0213/1143] BACKWARD COMPATIBILITY: Deprecated ActionGroups to make change Backward Compatible. --- .../_Deprecated_ActionGroup.xml .xml | 139 ++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 app/code/Magento/Braintree/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml .xml diff --git a/app/code/Magento/Braintree/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml .xml b/app/code/Magento/Braintree/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml .xml new file mode 100644 index 0000000000000..5bfd2d15de72a --- /dev/null +++ b/app/code/Magento/Braintree/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml .xml @@ -0,0 +1,139 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<!-- +NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. + Please find the Comment with proper replacement for each of ActionGroups provided. +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="GoToAllUsers"> + <annotations> + <description>Navigate to the Users page via Backend Admin Side Menu. PLEASE NOTE: Use the amOnPage action instead.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `GoToAllUsersActionGroup` instead --> + <click selector="{{AdminCreateUserSection.system}}" stepKey="clickOnSystemIcon"/> + <waitForPageLoad stepKey="waitForSystemsPageToOpen"/> + <click selector="{{AdminCreateUserSection.allUsers}}" stepKey="clickToSelectUserRoles"/> + <waitForPageLoad stepKey="waitForUserRolesPageToOpen"/> + </actionGroup> + + <actionGroup name="GoToUserRoles"> + <annotations> + <description>Navigate to the User Roles page via Backend Admin Side Menu. PLEASE NOTE: Use the amOnPage action instead.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `GoToUserRolesActionGroup` instead --> + <click selector="#menu-magento-backend-system" stepKey="clickOnSystemIcon"/> + <waitForPageLoad stepKey="waitForSystemsPageToOpen"/> + <click selector="//span[contains(text(), 'User Roles')]" stepKey="clickToSelectUserRoles"/> + <waitForPageLoad stepKey="waitForUserRolesPageToOpen"/> + </actionGroup> + + <actionGroup name="AdminCreateNewRole"> + <annotations> + <description>Creates a User Role using the provided Data.</description> + </annotations> + <arguments> + <argument name="role" type="string" defaultValue=""/> + <argument name="resource" type="string" defaultValue="All"/> + <argument name="scope" type="string" defaultValue="Custom"/> + <argument name="websites" type="string" defaultValue="Main Website"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminCreateNewRoleActionGroup` instead --> + <click selector="{{AdminCreateRoleSection.create}}" stepKey="clickToAddNewRole"/> + <fillField selector="{{AdminCreateRoleSection.name}}" userInput="{{role.name}}" stepKey="setRoleName"/> + <fillField stepKey="setPassword" selector="{{AdminCreateRoleSection.password}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}"/> + <click selector="{{AdminCreateRoleSection.roleResources}}" stepKey="clickToOpenRoleResources"/> + <waitForPageLoad stepKey="waitForRoleResourcePage" time="5"/> + <click stepKey="checkSales" selector="//a[text()='Sales']"/> + <click selector="{{AdminCreateRoleSection.save}}" stepKey="clickToSaveRole"/> + <waitForPageLoad stepKey="waitForPageLoad" time="10"/> + <see userInput="You saved the role." stepKey="seeSuccessMessage"/> + </actionGroup> + + <actionGroup name="AdminCreateUserAction"> + <annotations> + <description>Creates a User using the NewAdmin User Entity and User Role Entity. PLEASE NOTE: The Action Group values are Hardcoded.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminCreateUserActionGroup` instead --> + <click selector="{{AdminCreateUserSection.create}}" stepKey="clickToCreateNewUser"/> + <waitForPageLoad stepKey="waitForNewUserPageLoad" time="10"/> + <fillField selector="{{AdminCreateUserSection.usernameTextField}}" userInput="{{NewAdmin.username}}" stepKey="enterUserName"/> + <fillField selector="{{AdminCreateUserSection.firstNameTextField}}" userInput="{{NewAdmin.firstName}}" stepKey="enterFirstName"/> + <fillField selector="{{AdminCreateUserSection.lastNameTextField}}" userInput="{{NewAdmin.lastName}}" stepKey="enterLastName"/> + <fillField selector="{{AdminCreateUserSection.emailTextField}}" userInput="{{NewAdmin.email}}" stepKey="enterEmail"/> + <fillField selector="{{AdminCreateUserSection.passwordTextField}}" userInput="{{NewAdmin.password}}" stepKey="enterPassword"/> + <fillField selector="{{AdminCreateUserSection.pwConfirmationTextField}}" userInput="{{NewAdmin.password}}" stepKey="confirmPassword"/> + <fillField selector="{{AdminCreateUserSection.currentPasswordField}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}" stepKey="enterCurrentPassword"/> + <scrollToTopOfPage stepKey="scrollToTopOfPage"/> + <click selector="{{AdminCreateUserSection.userRoleTab}}" stepKey="clickUserRole"/> + <waitForAjaxLoad stepKey="waitForRoles" time="5"/> + <fillField selector="{{AdminCreateRoleSection.roleNameFilterTextField}}" userInput="{{role.name}}" stepKey="filterRole"/> + <click selector="{{AdminCreateRoleSection.searchButton}}" stepKey="clickSearch"/> + <waitForPageLoad stepKey="waitForSearch" time="10"/> + <click selector="{{AdminCreateRoleSection.searchResultFirstRow}}" stepKey="selectRole"/> + <click selector="{{AdminCreateUserSection.saveButton}}" stepKey="clickSaveUser"/> + <waitForPageLoad stepKey="waitForSaveUser" time="10"/> + <see userInput="You saved the user." stepKey="seeSuccessMessage"/> + </actionGroup> + + <actionGroup name="ConfigureBraintree"> + <annotations> + <description>Sets up the Braintree configuration setting using the BraintreeConfigurationSection Data Entity. PLEASE NOTE: The Action Group values are Hardcoded.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `ConfigureBraintreeActionGroup` instead --> + <click stepKey="clickOnSTORES" selector="{{AdminMenuSection.stores}}"/> + <waitForPageLoad stepKey="waitForConfiguration" time="2"/> + <click stepKey="clickOnConfigurations" selector="{{AdminMenuSection.configuration}}"/> + <waitForPageLoad stepKey="waitForSales" time="2"/> + <click stepKey="clickOnSales" selector="{{ConfigurationListSection.sales}}"/> + <waitForPageLoad stepKey="waitForPaymentMethods" time="2"/> + <click stepKey="clickOnPaymentMethods" selector="{{ConfigurationListSection.salesPaymentMethods}}"/> + <waitForPageLoad stepKey="waitForConfigureButton" time="2"/> + <click stepKey="clickOnConfigureButtonForBraintree" selector="{{ConfigurationPaymentSection.configureButton}}"/> + <waitForPageLoad stepKey="BraintreeSettings" time="2"/> + + <fillField stepKey="fillTitleForBraintreeSettings" selector="{{BraintreeConfiguraionSection.titleForBraintreeSettings}}" userInput="{{BraintreeConfigurationData.title}}"/> + <click stepKey="openEnvironmentSelect" selector="{{BraintreeConfiguraionSection.environment}}"/> + <click stepKey="chooseEnvironment" selector="{{BraintreeConfiguraionSection.sandbox}}"/> + <click stepKey="openPaymentActionSelect" selector="{{BraintreeConfiguraionSection.paymentActionSelect}}"/> + <click stepKey="choosePaymentAction" selector="{{BraintreeConfiguraionSection.paymentAction}}"/> + <fillField stepKey="fillMerchantID" selector="{{BraintreeConfiguraionSection.merchantID}}" userInput="{{BraintreeConfigurationData.merchantID}}"/> + <fillField stepKey="fillPublicKey" selector="{{BraintreeConfiguraionSection.publicKey}}" userInput="{{BraintreeConfigurationData.publicKey}}"/> + <fillField stepKey="fillPrivateKey" selector="{{BraintreeConfiguraionSection.privateKey}}" userInput="{{BraintreeConfigurationData.privateKey}}"/> + <click stepKey="expandEnableThisSolution" selector="{{BraintreeConfiguraionSection.enableThisSolution}}"/> + <click stepKey="chooseYesForEnableThisSolution" selector="{{BraintreeConfiguraionSection.yesForEnable}}"/> + <click stepKey="expandEnablePayPalThroughBraintree" selector="{{BraintreeConfiguraionSection.payPalThroughBraintree}}"/> + <click stepKey="chooseYesForEnablePayPalThroughBraintree" selector="{{BraintreeConfiguraionSection.yesForPayPalThroughBraintree}}"/> + <click stepKey="expandAdvancedBraintreeSettings" selector="{{BraintreeConfiguraionSection.advancedBraintreeSettings}}"/> + <fillField stepKey="fillMerchantAccountID" selector="{{BraintreeConfiguraionSection.merchantAccountID}}" userInput="{{BraintreeConfigurationData.merchantAccountID}}"/> + <click stepKey="expandCVVVerification" selector="{{BraintreeConfiguraionSection.CVVVerification}}"/> + <click stepKey="chooseYes" selector="{{BraintreeConfiguraionSection.yesForCVV}}"/> + <click stepKey="expandPayPalThroughBraintree" selector="{{BraintreeConfiguraionSection.payPalThroughBraintreeSelector}}"/> + <fillField stepKey="fillTitleForPayPalThroughBraintree" selector="{{BraintreeConfiguraionSection.titleForPayPalThroughBraintree}}" userInput="{{BraintreeConfigurationData.titleForPayPalThroughBraintree}}"/> + <click stepKey="expandPaymentAction" selector="{{BraintreeConfiguraionSection.paymentActionInPayPal}}"/> + <click stepKey="chooseAuthorize" selector="{{BraintreeConfiguraionSection.actionAuthorize}}"/> + <click stepKey="save" selector="{{BraintreeConfiguraionSection.save}}"/> + <waitForElementVisible selector="{{BraintreeConfiguraionSection.successfulMessage}}" stepKey="waitForSuccessfullyConfigured" time="10"/> + </actionGroup> + + <actionGroup name="DisableBrainTree"> + <annotations> + <description>Disables the Braintree and BraintreePaypal configuration settings via the CLI.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `DisableBraintreeActionGroup` instead --> + <magentoCLI stepKey="disableBrainTree" command="config:set payment/braintree/active 0"/> + <magentoCLI stepKey="disableBrainTreePaypal" command="config:set payment/braintree_paypal/active 0"/> + </actionGroup> +</actionGroups> From df44eebd4b9eefa1027f5d5fa67687a30d30e8e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Wed, 4 Dec 2019 21:56:55 +0100 Subject: [PATCH 0214/1143] BACKWARD COMPATIBILITY: Deprecated ActionGroups to make change Backward Compatible. --- ...iewBundleProductInAdminGridActionGroup.xml | 2 +- .../ActionGroup/_Deprecated_ActionGroup.xml | 263 ++++++++++++++++++ 2 files changed, 264 insertions(+), 1 deletion(-) create mode 100644 app/code/Magento/Bundle/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml diff --git a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/ViewBundleProductInAdminGridActionGroup.xml b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/ViewBundleProductInAdminGridActionGroup.xml index 96179b49206c8..bd0d08e4c0924 100644 --- a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/ViewBundleProductInAdminGridActionGroup.xml +++ b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/ViewBundleProductInAdminGridActionGroup.xml @@ -8,7 +8,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="viewBundleProductInAdminGrid"> + <actionGroup name="ViewBundleProductInAdminGridActionGroup"> <annotations> <description>Clears the Grid Filters on the Catalog Grid page and applies Filter by Name and Sku. Then checks to see if the Product exists in the 1st row. Then clears the Grid Filters again for future Tests.</description> </annotations> diff --git a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml new file mode 100644 index 0000000000000..d5413d2269a5b --- /dev/null +++ b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml @@ -0,0 +1,263 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<!-- +NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. + Please find the Comment with proper replacement for each of ActionGroups provided. +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AncillaryPrepBundleProduct"> + <annotations> + <description>Requires Navigation to the Product Creation page. Fills out Name, Sku, and SEO information using the BundleProduct Data Entity. PLEASE NOTE: The Action Group values are Hardcoded.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AncillaryPrepBundleProductActionGroup` instead --> + <fillField selector="{{AdminProductFormBundleSection.productName}}" userInput="{{BundleProduct.name}}" stepKey="fillProductName"/> + <fillField selector="{{AdminProductFormBundleSection.productSku}}" userInput="{{BundleProduct.sku}}" stepKey="fillProductSku"/> + + <scrollTo selector="{{AdminProductFormBundleSection.seoDropdown}}" stepKey="moveToSEOSection"/> + <conditionalClick selector="{{AdminProductFormBundleSection.seoDropdown}}" dependentSelector="{{AdminProductFormBundleSection.urlKey}}" visible="false" stepKey="openDropDownIfClosed"/> + <waitForPageLoad stepKey="WaitForDropDownSEO"/> + + <fillField userInput="{{BundleProduct.urlKey}}" selector="{{AdminProductFormBundleSection.urlKey}}" stepKey="FillsinSEOlinkExtension"/> + </actionGroup> + + <actionGroup name="FindProductToEdit"> + <annotations> + <description>Clears the Backend Admin Grid Filters on the Backend Admin Product Grid page. Searches for the BundleProduct Data Entity. Then clicks on the first item in the Admin Grid. PLEASE NOTE: The Action Group values are Hardcoded.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `FindProductToEditActionGroup` instead --> + <amOnPage url="{{ProductCatalogPage.url}}" stepKey="GoToProductCatalog"/> + <waitForPageLoad stepKey="WaitForCatalogProductPageToLoad"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> + <fillField userInput="{{BundleProduct.name}}" selector="#fulltext" stepKey="EnterProductNameInSearch"/> + <click stepKey="ClickSearch" selector="{{AdminProductFormBundleSection.searchButton}}"/> + <click stepKey="ClickOnProduct" selector="{{AdminProductFormBundleSection.firstCatalogProduct}}"/> + <waitForPageLoad stepKey="WaitForProductEditPageToLoad"/> + </actionGroup> + + <actionGroup name="CreateBasicBundleProduct"> + <annotations> + <description>Requires Navigation to the Product Creation page. Fills out Name, Sku, and SEO information using the BundleProduct Data Entity. PLEASE NOTE: The Action Group values are Hardcoded.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateBasicBundleProductActionGroup` instead --> + <fillField selector="{{AdminProductFormBundleSection.productName}}" userInput="{{BundleProduct.name}}" stepKey="fillProductName"/> + <fillField selector="{{AdminProductFormBundleSection.productSku}}" userInput="{{BundleProduct.sku}}" stepKey="fillProductSku"/> + + <scrollTo selector="{{AdminProductFormBundleSection.seoDropdown}}" stepKey="scrollToSeoDropDown"/> + <conditionalClick selector="{{AdminProductFormBundleSection.seoDropdown}}" dependentSelector="{{AdminProductFormBundleSection.urlKey}}" visible="false" stepKey="openDropDownIfClosed"/> + <waitForPageLoad stepKey="waitForDropDownSEO"/> + + <fillField userInput="{{BundleProduct.urlKey}}" selector="{{AdminProductFormBundleSection.urlKey}}" stepKey="fillsInSeoLinkExtension"/> + </actionGroup> + + <actionGroup name="addBundleOptionWithTwoProducts"> + <annotations> + <description>Requires Navigation to the Product Creation page. Adds Bundle Option with Two Products using the provided arguments. 'x' refers to Bundle option number. 'n' refers to the first number after x.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddBundleOptionWithTwoProductsActionGroup` instead --> + <arguments> + <argument name="x" type="string"/> + <argument name="n" type="string"/> + <argument name="prodOneSku" type="string"/> + <argument name="prodTwoSku" type="string"/> + <argument name="optionTitle" type="string"/> + <argument name="inputType" type="string"/> + </arguments> + + <conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="conditionallyOpenSectionBundleItems"/> + <scrollTo selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" stepKey="scrollUpABit"/> + <click selector="{{AdminProductFormBundleSection.addOption}}" stepKey="clickAddOption"/> + <waitForElementVisible selector="{{AdminProductFormBundleSection.bundleOptionXTitle(x)}}" stepKey="waitForOptions"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXTitle(x)}}" userInput="{{optionTitle}}" stepKey="fillTitle"/> + <selectOption selector="{{AdminProductFormBundleSection.bundleOptionXInputType(x)}}" userInput="{{inputType}}" stepKey="selectType"/> + <waitForElementVisible selector="{{AdminProductFormBundleSection.nthAddProductsToOption(n)}}" stepKey="waitForAddBtn"/> + <click selector="{{AdminProductFormBundleSection.nthAddProductsToOption(n)}}" stepKey="clickAdd"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters1"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters1"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{prodOneSku}}" stepKey="fillProductSkuFilter1"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters1"/> + <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad1" time="30"/> + <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectProduct1"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters2"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters2"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{prodTwoSku}}" stepKey="fillProductSkuFilter2"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters2"/> + <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad2" time="30"/> + <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectProduct2"/> + <click selector="{{AdminAddProductsToOptionPanel.addSelectedProducts}}" stepKey="clickAddButton1"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '0')}}" userInput="50" stepKey="fillQuantity1"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '1')}}" userInput="50" stepKey="fillQuantity2"/> + </actionGroup> + + <actionGroup name="addBundleOptionWithOneProduct" extends="addBundleOptionWithTwoProducts"> + <annotations> + <description>Requires Navigation to the Product Creation page. Adds Bundle Option with One Product as specified in arguments. 'x' refers to Bundle option number. 'n' refers to the first number after x.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddBundleOptionWithOneProductActionGroup` instead --> + <remove keyForRemoval="openProductFilters2"/> + <remove keyForRemoval="fillProductSkuFilter2"/> + <remove keyForRemoval="clickApplyFilters2"/> + <remove keyForRemoval="waitForFilteredGridLoad2"/> + <remove keyForRemoval="selectProduct2"/> + <remove keyForRemoval="selectProduct2"/> + <remove keyForRemoval="fillQuantity1"/> + <remove keyForRemoval="fillQuantity2"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '0')}}" userInput="1" stepKey="fillQuantity" after="clickAddButton1"/> + </actionGroup> + + <actionGroup name="addBundleOptionWithTreeProducts" extends="addBundleOptionWithTwoProducts"> + <annotations> + <description>Requires Navigation to the Product Creation page. Adds Bundle Option with Three Products using the provided arguments. 'x' refers to Bundle option number. 'n' refers to the first number after x.</description> + </annotations> + <arguments> + <argument name="prodTreeSku" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddBundleOptionWithThreeProductsActionGroup` instead --> + <remove keyForRemoval="fillQuantity1"/> + <remove keyForRemoval="fillQuantity2"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters3" after="selectProduct2"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters3" after="clickClearFilters3"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{prodTreeSku}}" stepKey="fillProductSkuFilter3" after="openProductFilters3"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters3" after="fillProductSkuFilter3"/> + <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad3" time="30" after="clickApplyFilters3"/> + <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectProduct3" after="waitForFilteredGridLoad3"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '0')}}" userInput="1" stepKey="fillQuantity1" after="clickAddButton1"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '1')}}" userInput="1" stepKey="fillQuantity2" after="fillQuantity1"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '2')}}" userInput="1" stepKey="fillQuantity3" after="fillQuantity2"/> + </actionGroup> + + <actionGroup name="addBundleOptionWithSixProducts" extends="addBundleOptionWithTwoProducts"> + <annotations> + <description>Requires Navigation to Product Creation page. Adds Bundle Option with Six Products as specified in arguments. 'x' refers to Bundle option number. 'n' refers to the first number after x.</description> + </annotations> + <arguments> + <argument name="prodTreeSku" type="string"/> + <argument name="prodFourSku" type="string"/> + <argument name="prodFiveSku" type="string"/> + <argument name="prodSixSku" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddBundleOptionWithSixProductsActionGroup` instead --> + <remove keyForRemoval="fillQuantity1"/> + <remove keyForRemoval="fillQuantity2"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters3" after="selectProduct2"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters3" after="clickClearFilters3"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{prodTreeSku}}" stepKey="fillProductSkuFilter3" after="openProductFilters3"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters3" after="fillProductSkuFilter3"/> + <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad3" time="30" after="clickApplyFilters3"/> + <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectProduct3" after="waitForFilteredGridLoad3"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters4" after="selectProduct3"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters4" after="clickClearFilters4"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{prodFourSku}}" stepKey="fillProductSkuFilter4" after="openProductFilters4"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters4" after="fillProductSkuFilter4"/> + <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad4" time="30" after="clickApplyFilters4"/> + <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectProduct4" after="clickApplyFilters4"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters5" after="selectProduct4"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters5" after="clickClearFilters5"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{prodFiveSku}}" stepKey="fillProductSkuFilter5" after="openProductFilters5"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters5" after="fillProductSkuFilter5"/> + <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad5" time="30" after="clickApplyFilters5"/> + <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectProduct5" after="waitForFilteredGridLoad5"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters6" after="selectProduct5"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters6" after="clickClearFilters6"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{prodSixSku}}" stepKey="fillProductSkuFilter6" after="openProductFilters6"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters6" after="fillProductSkuFilter6"/> + <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad6" time="30" after="clickApplyFilters6"/> + <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectProduct6" after="waitForFilteredGridLoad6"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '0')}}" userInput="2" stepKey="fillQuantity1" after="clickAddButton1"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '1')}}" userInput="2" stepKey="fillQuantity2" after="fillQuantity1"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '2')}}" userInput="2" stepKey="fillQuantity3" after="fillQuantity2"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '3')}}" userInput="2" stepKey="fillQuantity4" after="fillQuantity3"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '4')}}" userInput="2" stepKey="fillQuantity5" after="fillQuantity4"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '5')}}" userInput="2" stepKey="fillQuantity6" after="fillQuantity5"/> + </actionGroup> + + <actionGroup name="deleteBundleOptionByIndex"> + <annotations> + <description>Requires Navigation to Product Creation page. Removes any Bundle Option by index specified in arguments. 'deleteIndex' refers to Bundle option number.</description> + </annotations> + <arguments> + <argument name="deleteIndex" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `DeleteBundleOptionByIndexActionGroup` instead --> + <conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="conditionallyOpenSectionBundleItems"/> + <scrollTo selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" stepKey="scrollUpABit"/> + <click selector="{{AdminProductFormBundleSection.deleteOption(deleteIndex)}}" stepKey="clickDeleteOption"/> + </actionGroup> + + <actionGroup name="StorefrontAddBundleProductFromProductToCartWithMultiOption" extends="StorefrontAddBundleProductFromProductToCartActionGroup"> + <annotations> + <description>Selects a Bundled Product option on the Bundled Product page. PLEASE NOTE: The Quantity selection is not available in the Action Group.</description> + </annotations> + <arguments> + <argument name="optionName" type="string"/> + <argument name="value" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontAddBundleProductFromProductToCartWithMultiOptionActionGroup` instead --> + <selectOption selector="{{StorefrontBundledSection.multiselectOptionFourProducts(optionName)}}" userInput="{{value}}" stepKey="selectValue" before="clickAddBundleProductToCart"/> + </actionGroup> + + <actionGroup name="fillMainBundleProductForm"> + <annotations> + <description>Fills the Name, SKU and Stock Status fields.</description> + </annotations> + <arguments> + <argument name="product" defaultValue="BundleProduct"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `FillMainBundleProductFormActionGroup` instead --> + <fillField selector="{{AdminProductFormSection.productName}}" userInput="{{product.name}}" stepKey="fillProductSku"/> + <fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="fillProductName"/> + <selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="{{product.status}}" stepKey="selectStockStatus"/> + </actionGroup> + + <actionGroup name="checkRequiredFieldsInBundleProductForm"> + <annotations> + <description>Clears the Name and SKU fields when adding a Product and then verifies that they are required after attempting to Save.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CheckRequiredFieldsInBundleProductFormActionGroup` instead --> + <clearField selector="{{AdminProductFormSection.productName}}" stepKey="clearProductSku"/> + <clearField selector="{{AdminProductFormSection.productSku}}" stepKey="clearProductName"/> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveButton"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Product" stepKey="seeStillOnEditPage"/> + <see selector="{{AdminProductFormSection.fieldError('name')}}" userInput="This is a required field." stepKey="seeNameRequired"/> + <see selector="{{AdminProductFormSection.fieldError('sku')}}" userInput="This is a required field." stepKey="seeSkuRequired"/> + </actionGroup> + + <actionGroup name="viewBundleProductInAdminGrid"> + <annotations> + <description>Clears the Grid Filters on the Catalog Grid page and applies Filter by Name and Sku. Then checks to see if the Product exists in the 1st row. Then clears the Grid Filters again for future Tests.</description> + </annotations> + <arguments> + <argument name="product" defaultValue="BundleProduct"/> + <argument name="thumbnail" defaultValue="ProductPlaceholderImage"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `ViewBundleProductInAdminGridActionGroup` instead --> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> + <waitForPageLoad stepKey="waitForPageLoadInitial"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> + <fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="{{product.name}}" stepKey="fillProductNameFilter"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillProductSkuFilter"/> + <selectOption selector="{{AdminProductGridFilterSection.typeFilter}}" userInput="{{product.type_id}}" stepKey="selectionProductType"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> + <see selector="{{AdminProductGridSection.firstProductRow}}" userInput="{{product.name}}" stepKey="seeProductNameInGrid"/> + <click selector="{{AdminProductGridFilterSection.clearFilters}}" stepKey="clickClearFiltersAfter"/> + </actionGroup> +</actionGroups> From 24637fc96cb65ebf61f198c6279c0d6b208acc90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Wed, 4 Dec 2019 22:03:21 +0100 Subject: [PATCH 0215/1143] BACKWARD COMPATIBILITY: Deprecated ActionGroups to make change Backward Compatible. --- .../ActionGroup/_Deprecated_ActionGroup.xml | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 app/code/Magento/Wishlist/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml diff --git a/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml new file mode 100644 index 0000000000000..ca17b0275ed5b --- /dev/null +++ b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml @@ -0,0 +1,99 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<!-- +NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. + Please find the Comment with proper replacement for each of ActionGroups provided. +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + + <actionGroup name="StorefrontCustomerCheckProductInWishlist"> + <annotations> + <description>Validates that the provided Product details (Price and Name) are present in the Storefront Customer Dashboard Wish List.</description> + </annotations> + <arguments> + <argument name="productVar"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontCustomerCheckProductInWishlistActionGroup` instead --> + <waitForElement selector="{{StorefrontCustomerWishlistProductSection.ProductTitleByName(productVar.name)}}" time="30" stepKey="assertWishlistProductName"/> + <see userInput="${{productVar.price}}.00" selector="{{StorefrontCustomerWishlistProductSection.ProductPriceByName(productVar.name)}}" stepKey="AssertWishlistProductPrice"/> + <moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.ProductInfoByName(productVar.name)}}" stepKey="wishlistMoveMouseOverProduct"/> + <seeElement selector="{{StorefrontCustomerWishlistProductSection.ProductAddToCartByName(productVar.name)}}" stepKey="AssertWishlistAddToCart"/> + <seeElement selector="{{StorefrontCustomerWishlistProductSection.ProductImageByName(productVar.name)}}" stepKey="AssertWishlistProductImage"/> + </actionGroup> + + <actionGroup name="StorefrontCustomerCheckProductInWishlistSidebar"> + <annotations> + <description>Validates that the provided Product details (Name) are present in the Wish List side bar menu.</description> + </annotations> + <arguments> + <argument name="productVar"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontCustomerCheckProductInWishlistSidebarActionGroup` instead --> + <waitForElement selector="{{StorefrontCustomerWishlistSidebarSection.ProductTitleByName(productVar.name)}}" time="30" stepKey="assertWishlistSidebarProductName"/> + <see userInput="${{productVar.price}}.00" selector="{{StorefrontCustomerWishlistSidebarSection.ProductPriceByName(productVar.name)}}" stepKey="AssertWishlistSidebarProductPrice"/> + <seeElement selector="{{StorefrontCustomerWishlistSidebarSection.ProductAddToCartByName(productVar.name)}}" stepKey="AssertWishlistSidebarAddToCart"/> + <seeElement selector="{{StorefrontCustomerWishlistSidebarSection.ProductImageByName(productVar.name)}}" stepKey="AssertWishlistSidebarProductImage"/> + </actionGroup> + + <actionGroup name="StorefrontCustomerRemoveProductFromWishlistUsingSidebar"> + <annotations> + <description>Removes the provided Product from the Wish List side bar menu. Validates that the Success Message is present and correct.</description> + </annotations> + <arguments> + <argument name="product"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontCustomerRemoveProductFromWishlistUsingSidebarActionGroup` instead --> + <click selector="{{StorefrontCustomerWishlistSidebarSection.ProductRemoveByName(product.name)}}" stepKey="RemoveProductFromWishlistUsingSidebarClickRemoveItemFromWishlist"/> + <waitForElement selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="RemoveProductFromWishlistUsingSidebarWaitForSuccessMessage"/> + <see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="{{product.name}} has been removed from your Wish List." stepKey="RemoveProductFromWishlistUsingSidebarSeeProductNameRemovedFromWishlist"/> + </actionGroup> + + <actionGroup name="StorefrontCustomerAddProductToCartFromWishlistUsingSidebar"> + <annotations> + <description>Add the provided Product to the Cart from the Wish List side bar menu. Validates that the Success Message is present and correct.</description> + </annotations> + <arguments> + <argument name="product"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontCustomerAddProductToCartFromWishlistUsingSidebarActionGroup` instead --> + <click selector="{{StorefrontCustomerWishlistSidebarSection.ProductAddToCartByName(product.name)}}" stepKey="AddProductToCartFromWishlistUsingSidebarClickAddToCartFromWishlist"/> + <waitForElement selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="AddProductToCartFromWishlistUsingSidebarWaitForSuccessMessage"/> + <see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="You added {{product.name}} to your shopping cart." stepKey="AddProductToCartFromWishlistUsingSidebarSeeProductNameAddedToCartFromWishlist"/> + </actionGroup> + + <actionGroup name="StorefrontCustomerEditProductInWishlist"> + <annotations> + <description>Edits the provided Product on the Storefront Wish List page. Fills in the provided Description and Quantity. Validates that the Success Message is present and correct.</description> + </annotations> + <arguments> + <argument name="product"/> + <argument name="description" type="string"/> + <argument name="quantity" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontCustomerEditProductInWishlistActionGroup` instead --> + <moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.ProductInfoByName(product.name)}}" stepKey="mouseOverOnProduct"/> + <fillField selector="{{StorefrontCustomerWishlistProductSection.ProductDescription(product.name)}}" userInput="{{description}}" stepKey="fillDescription"/> + <fillField selector="{{StorefrontCustomerWishlistProductSection.ProductQuantity(product.name)}}" userInput="{{quantity}}" stepKey="fillQuantity"/> + <moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.ProductAddAllToCart}}" stepKey="mouseOver"/> + <click selector="{{StorefrontCustomerWishlistProductSection.ProductUpdateWishList}}" stepKey="submitUpdateWishlist"/> + <see selector="{{StorefrontCustomerWishlistProductSection.ProductSuccessUpdateMessage}}" userInput="{{product.name}} has been updated in your Wish List." stepKey="successMessage"/> + </actionGroup> + + <actionGroup name="StorefrontAssertCustomerWishlistIsEmpty"> + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontAssertCustomerWishlistIsEmptyActionGroup` instead --> + <dontSeeElement selector="{{StorefrontCustomerWishlistProductSection.pager}}" stepKey="checkThatPagerIsAbsent"/> + <see selector="{{StorefrontCustomerWishlistProductSection.wishlistEmpty}}" userInput="You have no items in your wish list." stepKey="checkNoItemsMessage"/> + </actionGroup> +</actionGroups> From 8519c5d8da998647f7d052493114fb9e893714a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Wed, 4 Dec 2019 22:12:56 +0100 Subject: [PATCH 0216/1143] BACKWARD COMPATIBILITY: Deprecated ActionGroups to make change Backward Compatible. --- .../ActionGroup/_Deprecated_ActionGroup.xml | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 app/code/Magento/User/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml diff --git a/app/code/Magento/User/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/User/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml new file mode 100644 index 0000000000000..0230f5b1c8e3e --- /dev/null +++ b/app/code/Magento/User/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<!-- +NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. + Please find the Comment with proper replacement for each of ActionGroups provided. +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + + + <actionGroup name="AdminAddNewUserRoleWithCustomRoleScopes" extends="AdminAddNewUserRoleActionGroup"> + <arguments> + <argument name="customWebsiteName" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminAddNewUserRoleWithCustomRoleScopesActionGroup` instead --> + <checkOption selector="{{AdminCreateRoleSection.selectWebsite(customWebsiteName)}}" stepKey="checkWebsite" after="selectRoleResources"/> + </actionGroup> + <actionGroup name="AdminFillUserRoleRequiredData" extends="AdminCreateRoleActionGroup"> + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminFillUserRoleRequiredDataActionGroup` instead --> + <remove keyForRemoval="clickRoleResourcesTab"/> + <remove keyForRemoval="waitForScopeSelection"/> + <remove keyForRemoval="selectResourceAccessCustom"/> + <remove keyForRemoval="waitForElementVisible"/> + <remove keyForRemoval="clickContentBlockCheckbox"/> + <remove keyForRemoval="clickSaveRoleButton"/> + <remove keyForRemoval="waitForPageLoad2"/> + </actionGroup> + <actionGroup name="AdminAddRestrictedRole" extends="AdminCreateRoleActionGroup"> + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminAddRestrictedRoleActionGroup` instead --> + <remove keyForRemoval="navigateToNewRole"/> + <remove keyForRemoval="waitForPageLoad1"/> + <remove keyForRemoval="fillRoleName"/> + <remove keyForRemoval="enterPassword"/> + <remove keyForRemoval="clickRoleResourcesTab"/> + <remove keyForRemoval="waitForScopeSelection"/> + <remove keyForRemoval="clickSaveRoleButton"/> + <remove keyForRemoval="waitForPageLoad2"/> + <scrollTo selector="{{AdminEditRoleInfoSection.blockName('restrictedRole')}}" x="0" y="-100" stepKey="scrollToResourceElement" after="selectResourceAccessCustom"/> + </actionGroup> + <actionGroup name="AdminCreateRole"> + <annotations> + <description>Clicks on 'Add New Role'. Fills in the provided details (Role, Resource, Scope and Websites). Clicks on Save. Validates that the Success Message is present and correct.</description> + </annotations> + <arguments> + <argument name="role" type="string" defaultValue=""/> + <argument name="resource" type="string" defaultValue="All"/> + <argument name="scope" type="string" defaultValue="Custom"/> + <argument name="websites" type="string" defaultValue="Main Website"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminCreateRoleActionGroup` instead --> + <click selector="{{AdminCreateRoleSection.create}}" stepKey="clickToAddNewRole"/> + <fillField selector="{{AdminCreateRoleSection.name}}" userInput="{{role.name}}" stepKey="setRoleName"/> + <fillField stepKey="setPassword" selector="{{AdminCreateRoleSection.password}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}"/> + <click selector="{{AdminCreateRoleSection.roleResources}}" stepKey="clickToOpenRoleResources"/> + <waitForPageLoad stepKey="waitForRoleResourcePage" time="5"/> + <click stepKey="checkSales" selector="//a[text()='Sales']"/> + <click selector="{{AdminCreateRoleSection.save}}" stepKey="clickToSaveRole"/> + <waitForPageLoad stepKey="waitForPageLoad" time="10"/> + <see userInput="You saved the role." stepKey="seeSuccessMessage"/> + </actionGroup> +</actionGroups> From bb7eca034eac3fa1514bd78df347f0e9f46bd06b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Wed, 4 Dec 2019 22:19:45 +0100 Subject: [PATCH 0217/1143] BACKWARD COMPATIBILITY: Deprecated ActionGroups to make change Backward Compatible. --- ....xml => AdminAddUrlRewriteActionGroup.xml} | 0 .../ActionGroup/_Deprecated_ActionGroup.xml | 296 ++++++++++++++++++ 2 files changed, 296 insertions(+) rename app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/{AdminUrlRewriteActionGroup.xml => AdminAddUrlRewriteActionGroup.xml} (100%) create mode 100644 app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminUrlRewriteActionGroup.xml b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminAddUrlRewriteActionGroup.xml similarity index 100% rename from app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminUrlRewriteActionGroup.xml rename to app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/AdminAddUrlRewriteActionGroup.xml diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml new file mode 100644 index 0000000000000..c990db8cc3cf8 --- /dev/null +++ b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml @@ -0,0 +1,296 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<!-- +NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. + Please find the Comment with proper replacement for each of ActionGroups provided. +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAddUrlRewrite"> + <annotations> + <description>Goes to the Admin Add URL Rewrite edit page. Fills in the provided URL details. Clicks on Save. Validates that the Success Message is present.</description> + </annotations> + <arguments> + <argument name="category" type="string"/> + <argument name="customUrlRewriteValue" type="string"/> + <argument name="storeValue" type="string"/> + <argument name="requestPath" type="string"/> + <argument name="redirectTypeValue" type="string"/> + <argument name="description" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminAddUrlRewriteActionGroup` instead --> + <amOnPage url="{{AdminUrlRewriteEditPage.url}}" stepKey="openUrlRewriteEditPage"/> + <waitForElementVisible selector="{{AdminUrlRewriteEditSection.createCustomUrlRewrite}}" stepKey="waitForCreateUrlRewriteVisible"/> + <selectOption selector="{{AdminUrlRewriteEditSection.createCustomUrlRewrite}}" userInput="{{customUrlRewriteValue}}" stepKey="selectUrlRewriteTypeOption"/> + <waitForElementVisible selector="{{AdminUrlRewriteEditSection.categoryInTree(category)}}" stepKey="waitForCategoryInTreeVisible"/> + <click selector="{{AdminUrlRewriteEditSection.categoryInTree(category)}}" stepKey="clickOnCategoryInTree"/> + <waitForElementVisible selector="{{AdminUrlRewriteEditSection.store}}" stepKey="waitForStoreSelectVisible"/> + <selectOption selector="{{AdminUrlRewriteEditSection.store}}" userInput="{{storeValue}}" stepKey="selectStoreOption"/> + <fillField selector="{{AdminUrlRewriteEditSection.requestPath}}" userInput="{{requestPath}}" stepKey="fillRequestPathField"/> + <selectOption selector="{{AdminUrlRewriteEditSection.redirectType}}" userInput="{{redirectTypeValue}}" stepKey="selectRedirectType"/> + <fillField selector="{{AdminUrlRewriteEditSection.description}}" userInput="{{description}}" stepKey="fillDescriptionField"/> + <click selector="{{AdminMainActionsSection.save}}" stepKey="clickSaveButton"/> + <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForSuccessMessage"/> + <see selector="{{AdminMessagesSection.success}}" userInput="The URL Rewrite has been saved." stepKey="seeSuccessMessage"/> + </actionGroup> + + <actionGroup name="AdminAddUrlRewriteForProduct"> + <annotations> + <description>Adds the provided URL Rewrite details for a Product.</description> + </annotations> + <arguments> + <argument name="storeValue" type="string"/> + <argument name="requestPath" type="string"/> + <argument name="redirectTypeValue" type="string"/> + <argument name="description" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminAddUrlRewriteForProductActionGroup` instead --> + <waitForElementVisible selector="{{AdminUrlRewriteProductSection.skipCategoryButton}}" stepKey="waitForSkipCategoryButton"/> + <click selector="{{AdminUrlRewriteProductSection.skipCategoryButton}}" stepKey="clickOnSkipCategoryButton"/> + <waitForPageLoad stepKey="waitForProductPageToLoad"/> + <click selector="{{AdminUrlRewriteEditSection.store}}" stepKey="clickOnStore"/> + <click selector="{{AdminUrlRewriteEditSection.storeValue('storeValue')}}" stepKey="clickOnStoreValue"/> + <fillField selector="{{AdminUrlRewriteEditSection.requestPath}}" userInput="{{requestPath}}" stepKey="fillRequestPath"/> + <click selector="{{AdminUrlRewriteEditSection.redirectType}}" stepKey="selectRedirectType"/> + <click selector="{{AdminUrlRewriteEditSection.redirectTypeValue('redirectTypeValue')}}" stepKey="clickOnRedirectTypeValue"/> + <fillField selector="{{AdminUrlRewriteEditSection.description}}" userInput="{{description}}" stepKey="fillDescription"/> + <click selector="{{AdminUrlRewriteEditSection.saveButton}}" stepKey="clickOnSaveButton"/> + <seeElement selector="{{AdminUrlRewriteIndexSection.successMessage}}" stepKey="seeSuccessSaveMessage"/> + </actionGroup> + + <actionGroup name="AdminAddCustomUrlRewrite"> + <annotations> + <description>Goes to the Admin URL Rewrite edit page. Adds the provided Custom URL Rewrite details. Clicks on Save. Validates that the Success Message is present.</description> + </annotations> + <arguments> + <argument name="customUrlRewriteValue" type="string"/> + <argument name="storeValue" type="string"/> + <argument name="requestPath" type="string"/> + <argument name="targetPath" type="string"/> + <argument name="redirectTypeValue" type="string"/> + <argument name="description" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminAddCustomUrlRewriteActionGroup` instead --> + <amOnPage url="{{AdminUrlRewriteEditPage.url}}" stepKey="openUrlRewriteEditPage"/> + <waitForPageLoad stepKey="waitForUrlRewriteEditPageToLoad" after="openUrlRewriteEditPage"/> + <click selector="{{AdminUrlRewriteEditSection.createCustomUrlRewrite}}" stepKey="clickOnCustonUrlRewrite"/> + <click selector="{{AdminUrlRewriteEditSection.createCustomUrlRewriteValue('customUrlRewriteValue')}}" stepKey="selectCustom"/> + <click selector="{{AdminUrlRewriteEditSection.store}}" stepKey="clickOnStore"/> + <click selector="{{AdminUrlRewriteEditSection.storeValue('storeValue')}}" stepKey="clickOnStoreValue"/> + <fillField selector="{{AdminUrlRewriteEditSection.requestPath}}" userInput="{{requestPath}}" stepKey="fillRequestPath"/> + <fillField selector="{{AdminUrlRewriteEditSection.targetPath}}" userInput="{{targetPath}}" stepKey="fillTargetPath"/> + <click selector="{{AdminUrlRewriteEditSection.redirectType}}" stepKey="selectRedirectType"/> + <click selector="{{AdminUrlRewriteEditSection.redirectTypeValue('redirectTypeValue')}}" stepKey="selectRedirectTypeValue"/> + <fillField selector="{{AdminUrlRewriteEditSection.description}}" userInput="{{description}}" stepKey="fillDescription"/> + <click selector="{{AdminUrlRewriteEditSection.saveButton}}" stepKey="clickOnSaveButton"/> + <seeElement selector="{{AdminUrlRewriteIndexSection.successMessage}}" stepKey="seeSuccessSaveMessage"/> + </actionGroup> + + <actionGroup name="AdminUpdateUrlRewrite"> + <annotations> + <description>Updates the URL Rewrite fields with the provided details.</description> + </annotations> + <arguments> + <argument name="storeValue" type="string"/> + <argument name="requestPath" type="string"/> + <argument name="redirectTypeValue" type="string"/> + <argument name="description" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminUpdateUrlRewriteActionGroup` instead --> + <click selector="{{AdminUrlRewriteEditSection.store}}" stepKey="clickOnStore"/> + <click selector="{{AdminUrlRewriteEditSection.storeValue(storeValue)}}" stepKey="clickOnStoreValue"/> + <fillField selector="{{AdminUrlRewriteEditSection.requestPath}}" userInput="{{requestPath}}" stepKey="fillRequestPath"/> + <click selector="{{AdminUrlRewriteEditSection.redirectType}}" stepKey="selectRedirectType"/> + <click selector="{{AdminUrlRewriteEditSection.redirectTypeValue(redirectTypeValue)}}" stepKey="selectRedirectTypeValue"/> + <fillField selector="{{AdminUrlRewriteEditSection.description}}" userInput="{{description}}" stepKey="fillDescription"/> + <click selector="{{AdminUrlRewriteEditSection.saveButton}}" stepKey="clickOnSaveButton"/> + <seeElement selector="{{AdminUrlRewriteIndexSection.successMessage}}" stepKey="seeSuccessSaveMessage"/> + </actionGroup> + + <actionGroup name="AdminUpdateCustomUrlRewrite"> + <annotations> + <description>Updates the Custom URL Rewrite fields with the provided details.</description> + </annotations> + <arguments> + <argument name="storeValue" type="string"/> + <argument name="requestPath" type="string"/> + <argument name="targetPath" type="string"/> + <argument name="redirectTypeValue" type="string"/> + <argument name="description" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminUpdateCustomUrlRewriteActionGroup` instead --> + <click selector="{{AdminUrlRewriteEditSection.store}}" stepKey="clickOnStore"/> + <click selector="{{AdminUrlRewriteEditSection.storeValue('storeValue')}}" stepKey="clickOnStoreValue"/> + <fillField selector="{{AdminUrlRewriteEditSection.requestPath}}" userInput="{{requestPath}}" stepKey="fillRequestPath"/> + <fillField selector="{{AdminUrlRewriteEditSection.targetPath}}" userInput="{{targetPath}}" stepKey="fillTargetPath"/> + <selectOption selector="{{AdminUrlRewriteEditSection.redirectType}}" userInput="{{redirectTypeValue}}" stepKey="selectRedirectTypeValue"/> + <fillField selector="{{AdminUrlRewriteEditSection.description}}" userInput="{{description}}" stepKey="fillDescription"/> + <click selector="{{AdminUrlRewriteEditSection.saveButton}}" stepKey="clickOnSaveButton"/> + <seeElement selector="{{AdminUrlRewriteIndexSection.successMessage}}" stepKey="seeSuccessSaveMessage"/> + </actionGroup> + <actionGroup name="AdminSearchByRequestPath"> + <annotations> + <description>Goes to the Admin URL Rewrite grid page. Searches the grid based on the provided Redirect Path. Validates that the provided Redirect Path, Type and Target Path are present and correct in the grid.</description> + </annotations> + <arguments> + <argument name="redirectPath" type="string"/> + <argument name="redirectType" type="string"/> + <argument name="targetPath" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminSearchByRequestPathActionGroup` instead --> + <amOnPage url="{{AdminUrlRewriteIndexPage.url}}" stepKey="openUrlRewriteEditPage"/> + <waitForPageLoad stepKey="waitForUrlRewriteEditPageToLoad"/> + <click selector="{{AdminUrlRewriteIndexSection.resetButton}}" stepKey="clickOnResetButton"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + <fillField selector="{{AdminUrlRewriteIndexSection.requestPathFilter}}" userInput="{{redirectPath}}" stepKey="fillRedirectPathFilter"/> + <click selector="{{AdminUrlRewriteIndexSection.searchButton}}" stepKey="clickOnSearchButton"/> + <waitForPageLoad stepKey="waitForPageToLoad1"/> + <see selector="{{AdminUrlRewriteIndexSection.requestPathColumn('1')}}" userInput="{{redirectPath}}" stepKey="seeTheRedirectPathForOldUrl"/> + <see selector="{{AdminUrlRewriteIndexSection.targetPathColumn('1')}}" userInput="{{targetPath}}" stepKey="seeTheTargetPath"/> + <see selector="{{AdminUrlRewriteIndexSection.redirectTypeColumn('1')}}" userInput="{{redirectType}}" stepKey="seeTheRedirectTypeForOldUrl"/> + </actionGroup> + + <actionGroup name="AdminSearchUrlRewriteProductBySku"> + <annotations> + <description>Goes to the Admin URL Rewrite grid page. Searches the grid based on the provided Product SKU. Clicks on the 1st row in the grid.</description> + </annotations> + <arguments> + <argument name="productSku" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminSearchUrlRewriteProductBySkuActionGroup` instead --> + <amOnPage url="{{AdminUrlRewriteProductPage.url}}" stepKey="openUrlRewriteProductPage"/> + <waitForPageLoad stepKey="waitForUrlRewriteProductPageToLoad"/> + <click selector="{{AdminUrlRewriteProductSection.resetFilter}}" stepKey="clickOnResetFilter"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + <fillField selector="{{AdminUrlRewriteProductSection.skuFilter}}" userInput="{{productSku}}" stepKey="fillProductSkuFilter"/> + <click selector="{{AdminUrlRewriteProductSection.searchFilter}}" stepKey="clickOnSearchFilter"/> + <waitForPageLoad stepKey="waitForProductToLoad"/> + <click selector="{{AdminUrlRewriteProductSection.productRow}}" stepKey="clickOnFirstRow"/> + <waitForPageLoad stepKey="waitForProductCategoryPageToLoad"/> + </actionGroup> + + <actionGroup name="AdminSearchDeletedUrlRewrite"> + <annotations> + <description>Goes to the Admin URL Rewrite grid page. Searches the grid for the provided Request Path. Validates that it does NOT appear in the grid.</description> + </annotations> + <arguments> + <argument name="requestPath" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminSearchDeletedUrlRewriteActionGroup` instead --> + <amOnPage url="{{AdminUrlRewriteIndexPage.url}}" stepKey="openUrlRewriteEditPage"/> + <waitForPageLoad stepKey="waitForUrlRewriteEditPageToLoad"/> + <click selector="{{AdminUrlRewriteIndexSection.resetButton}}" stepKey="clickOnResetButton"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + <fillField selector="{{AdminUrlRewriteIndexSection.requestPathFilter}}" userInput="{{requestPath}}" stepKey="fillRedirectPathFilter"/> + <click selector="{{AdminUrlRewriteIndexSection.searchButton}}" stepKey="clickOnSearchButton"/> + <waitForPageLoad stepKey="waitForPageToLoad1"/> + <see selector="{{AdminUrlRewriteIndexSection.emptyRecords}}" userInput="We couldn't find any records." stepKey="seeEmptyRecordMessage"/> + </actionGroup> + + <actionGroup name="AdminDeleteUrlRewrite"> + <annotations> + <description>Goes to the Admin URL Rewrite grid page. Deletes the provided Request Path. Validates that the Success Message is present and correct.</description> + </annotations> + <arguments> + <argument name="requestPath" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminDeleteUrlRewriteActionGroup` instead --> + <amOnPage url="{{AdminUrlRewriteIndexPage.url}}" stepKey="openUrlRewriteEditPage"/> + <waitForPageLoad stepKey="waitForUrlRewriteEditPageToLoad"/> + <click selector="{{AdminUrlRewriteIndexSection.resetButton}}" stepKey="clickOnResetButton"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + <fillField selector="{{AdminUrlRewriteIndexSection.requestPathFilter}}" userInput="{{requestPath}}" stepKey="fillRedirectPathFilter"/> + <click selector="{{AdminUrlRewriteIndexSection.searchButton}}" stepKey="clickOnSearchButton"/> + <waitForPageLoad stepKey="waitForPageToLoad1"/> + <click selector="{{AdminUrlRewriteIndexSection.editButton('1')}}" stepKey="clickOnEditButton"/> + <waitForPageLoad stepKey="waitForEditPageToLoad"/> + <click selector="{{AdminUrlRewriteEditSection.deleteButton}}" stepKey="clickOnDeleteButton"/> + <waitForPageLoad stepKey="waitForPageToLoad2"/> + <waitForElementVisible selector="{{AdminUrlRewriteEditSection.okButton}}" stepKey="waitForOkButtonToVisible"/> + <click selector="{{AdminUrlRewriteEditSection.okButton}}" stepKey="clickOnOkButton"/> + <waitForPageLoad stepKey="waitForPageToLoad3"/> + <see selector="{{AdminUrlRewriteIndexSection.successMessage}}" userInput="You deleted the URL rewrite." stepKey="seeSuccessMessage"/> + </actionGroup> + + <actionGroup name="AssertPageByUrlRewriteIsNotFound"> + <annotations> + <description>Validates that the provided Request Path does NOT exist on the Storefront. Validates that the 'Whoops' message is present and correct.</description> + </annotations> + <arguments> + <argument name="requestPath" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertPageByUrlRewriteIsNotFoundActionGroup` instead --> + <amOnPage url="{{requestPath}}" stepKey="amOnPage"/> + <waitForPageLoad stepKey="waitForStorefrontPageLoad"/> + <see userInput="Whoops, our bad..." stepKey="seeWhoops"/> + </actionGroup> + + <actionGroup name="AdminSearchAndSelectUrlRewriteInGrid"> + <annotations> + <description>Goes to the Admin URL Rewrite grid page. Searches the grid for the provided Request Path. Clicks on Edit.</description> + </annotations> + <arguments> + <argument name="requestPath" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminSearchAndSelectUrlRewriteInGridActionGroup` instead --> + <amOnPage url="{{AdminUrlRewriteIndexPage.url}}" stepKey="openUrlRewriteEditPage"/> + <waitForPageLoad stepKey="waitForUrlRewriteEditPageToLoad"/> + <click selector="{{AdminUrlRewriteIndexSection.resetButton}}" stepKey="clickOnResetButton"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + <fillField selector="{{AdminUrlRewriteIndexSection.requestPathFilter}}" userInput="{{requestPath}}" stepKey="fillRedirectPathFilter"/> + <click selector="{{AdminUrlRewriteIndexSection.searchButton}}" stepKey="clickOnSearchButton"/> + <waitForPageLoad stepKey="waitForPageToLoad1"/> + <click selector="{{AdminUrlRewriteIndexSection.editButton('1')}}" stepKey="clickOnEditButton"/> + <waitForPageLoad stepKey="waitForEditPageToLoad"/> + </actionGroup> + + <actionGroup name="AssertStorefrontUrlRewriteRedirect"> + <annotations> + <description>Goes to the provided New URL. Validates that the redirect works and the provided Category is present.</description> + </annotations> + <arguments> + <argument name="category" type="string"/> + <argument name="newRequestPath" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertStorefrontUrlRewriteRedirectActionGroup` instead --> + <amOnPage url="{{newRequestPath}}" stepKey="openCategoryInStorefront"/> + <waitForPageLoad stepKey="waitForCategoryPageToLoad"/> + <seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(category)}}" stepKey="seeCategoryOnStoreNavigationBar"/> + <seeElement selector="{{StorefrontCategoryMainSection.CategoryTitle(category)}}" stepKey="seeCategoryInTitle"/> + </actionGroup> + + <actionGroup name="AssertStorefrontProductRedirect"> + <annotations> + <description>Goes to the provided New Product URL. Validates that the redirect works and the provided Product is present and correct.</description> + </annotations> + <arguments> + <argument name="productName" type="string"/> + <argument name="productSku" type="string"/> + <argument name="productRequestPath" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertStorefrontProductRedirectActionGroup` instead --> + <amOnPage url="{{productRequestPath}}" stepKey="openCategoryInStorefront"/> + <waitForPageLoad stepKey="waitForCategoryPageToLoad"/> + <see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{productName}}" stepKey="seeProductNameInStoreFrontPage"/> + <see selector="{{StorefrontProductInfoMainSection.productSku}}" userInput="{{productSku}}" stepKey="seeProductSkuInStoreFrontPage"/> + </actionGroup> +</actionGroups> From 64936e3174869374bb767b820ce2fc3eb52ab864 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Wed, 4 Dec 2019 22:23:24 +0100 Subject: [PATCH 0218/1143] BACKWARD COMPATIBILITY: Deprecated ActionGroups to make change Backward Compatible. --- .../ActionGroup/_Deprecated_ActionGroup.xml | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 app/code/Magento/Ui/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml diff --git a/app/code/Magento/Ui/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Ui/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml new file mode 100644 index 0000000000000..48d6b90ddb8dc --- /dev/null +++ b/app/code/Magento/Ui/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml @@ -0,0 +1,98 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<!-- +NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. + Please find the Comment with proper replacement for each of ActionGroups provided. +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="searchAdminDataGridByKeyword"> + <annotations> + <description>Fills 'Search by keyword' on an Admin Grid page. Clicks on Submit Search.</description> + </annotations> + <arguments> + <argument name="keyword"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SearchAdminDataGridByKeywordActionGroup` instead --> + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> + <fillField selector="{{AdminDataGridHeaderSection.search}}" userInput="{{keyword}}" stepKey="fillKeywordSearchField"/> + <click selector="{{AdminDataGridHeaderSection.submitSearch}}" stepKey="clickKeywordSearch"/> + </actionGroup> + + <actionGroup name="resetAdminDataGridToDefaultView"> + <annotations> + <description>Resets an Admin Grid page to the 'Default View'.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `ResetAdminDataGridToDefaultViewActionGroup` instead --> + <click selector="{{AdminDataGridHeaderSection.bookmarkToggle}}" stepKey="openViewBookmarks"/> + <click selector="{{AdminDataGridHeaderSection.bookmarkOption('Default View')}}" stepKey="selectDefaultGridView"/> + <see selector="{{AdminDataGridHeaderSection.bookmarkToggle}}" userInput="Default View" stepKey="seeDefaultViewSelected"/> + </actionGroup> + + <actionGroup name="clearFiltersAdminDataGrid"> + <annotations> + <description>Clicks on 'Clear Filters' on an Admin Grid page.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `ClearFiltersAdminDataGridActionGroup` instead --> + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingOrderFilters"/> + </actionGroup> + + <actionGroup name="adminDataGridSelectPerPage"> + <annotations> + <description>Sets the provided preset 'per page' display setting on an Admin Grid page.</description> + </annotations> + <arguments> + <argument name="perPage" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminDataGridSelectPerPageActionGroup` instead --> + <click selector="{{AdminDataGridPaginationSection.perPageDropdown}}" stepKey="clickPerPageDropdown"/> + <click selector="{{AdminDataGridPaginationSection.perPageOption(perPage)}}" stepKey="selectCustomPerPage"/> + <waitForPageLoad stepKey="waitForGridLoad"/> + </actionGroup> + + <actionGroup name="adminDataGridSelectCustomPerPage"> + <annotations> + <description>Sets the provided custom 'per page' display setting on an Admin Grid page.</description> + </annotations> + <arguments> + <argument name="perPage"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminDataGridSelectCustomPerPageActionGroup` instead --> + <click selector="{{AdminDataGridPaginationSection.perPageDropdown}}" stepKey="clickPerPageDropdown"/> + <click selector="{{AdminDataGridPaginationSection.perPageOption('Custom')}}" stepKey="selectCustomPerPage"/> + <waitForElementVisible selector="{{AdminDataGridPaginationSection.perPageInput}}" time="30" stepKey="waitForInputVisible"/> + <fillField selector="{{AdminDataGridPaginationSection.perPageInput}}" userInput="{{perPage}}" stepKey="fillCustomPerPage"/> + <click selector="{{AdminDataGridPaginationSection.perPageApplyInput}}" stepKey="applyCustomPerPage"/> + <waitForLoadingMaskToDisappear stepKey="waitForGridLoad"/> + <seeInField selector="{{AdminDataGridPaginationSection.perPageDropDownValue}}" userInput="{{perPage}}" stepKey="seePerPageValueInDropDown"/> + </actionGroup> + + <actionGroup name="adminDataGridDeleteCustomPerPage"> + <annotations> + <description>Sets the provided custom 'per page' display setting on an Admin Grid page. Deletes the Items listed in a grid. Validates that the 'per page' count in NOT present.</description> + </annotations> + <arguments> + <argument name="perPage"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminDataGridDeleteCustomPerPageActionGroup` instead --> + <click selector="{{AdminDataGridPaginationSection.perPageDropdown}}" stepKey="clickPerPageDropdown1"/> + <click selector="{{AdminDataGridPaginationSection.perPageEditCustomValue(perPage)}}" stepKey="clickToEditCustomPerPage"/> + <waitForElementVisible selector="{{AdminDataGridPaginationSection.perPageDeleteCustomValue(perPage)}}" time="30" stepKey="waitForDeleteButtonVisible"/> + <click selector="{{AdminDataGridPaginationSection.perPageDeleteCustomValue(perPage)}}" stepKey="clickToDeleteCustomPerPage"/> + <waitForLoadingMaskToDisappear stepKey="waitForGridLoad"/> + <click selector="{{AdminDataGridPaginationSection.perPageDropdown}}" stepKey="clickPerPageDropdown"/> + <dontSeeElement selector="{{AdminDataGridPaginationSection.perPageDropDownItem(perPage)}}" stepKey="dontSeeDropDownItem"/> + </actionGroup> +</actionGroups> From 8289f8cd676459040a0d23c22a2854debbcbfb87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Wed, 4 Dec 2019 22:33:29 +0100 Subject: [PATCH 0219/1143] BACKWARD COMPATIBILITY: Deprecated ActionGroups to make change Backward Compatible. --- ...xml => AddCustomerTaxClassActionGroup.xml} | 0 .../ActionGroup/_Deprecated_ActionGroup.xml | 271 ++++++++++++++++++ 2 files changed, 271 insertions(+) rename app/code/Magento/Tax/Test/Mftf/ActionGroup/{AdminCustomerTaxClassActionGroup.xml => AddCustomerTaxClassActionGroup.xml} (100%) create mode 100644 app/code/Magento/Tax/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml diff --git a/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminCustomerTaxClassActionGroup.xml b/app/code/Magento/Tax/Test/Mftf/ActionGroup/AddCustomerTaxClassActionGroup.xml similarity index 100% rename from app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminCustomerTaxClassActionGroup.xml rename to app/code/Magento/Tax/Test/Mftf/ActionGroup/AddCustomerTaxClassActionGroup.xml diff --git a/app/code/Magento/Tax/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Tax/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml new file mode 100644 index 0000000000000..95516361a74f5 --- /dev/null +++ b/app/code/Magento/Tax/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml @@ -0,0 +1,271 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<!-- +NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. + Please find the Comment with proper replacement for each of ActionGroups provided. +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="addCustomerTaxClass"> + <annotations> + <description>Adds the provided Customer Tax Class on the Admin Tax Rule creation/edit page.</description> + </annotations> + <arguments> + <argument name="customerTaxClassName" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddCustomerTaxClassActionGroup` instead --> + <click stepKey="clickAdditionalSettings" selector="{{AdminTaxRulesSection.additionalSettings}}"/> + <click stepKey="clickCustomerAddNewTaxClassBtn" selector="{{AdminTaxRulesSection.customerAddNewTaxClass}}"/> + <fillField stepKey="fillCustomerNewTaxClass" selector="{{AdminTaxRulesSection.fieldCustomerNewTaxClass}}" userInput="{{customerTaxClassName}}"/> + <click stepKey="saveProdTaxRate" selector="{{AdminTaxRulesSection.saveCustomerNewTaxClass}}"/> + </actionGroup> + + <actionGroup name="deleteCustomerTaxClass"> + <annotations> + <description>Goes to the Admin New Tax Rule page. Deletes the provided Tax Class Name.</description> + </annotations> + <arguments> + <argument name="taxClassName" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `DeleteCustomerTaxClassActionGroup` instead --> + <amOnPage url="{{AdminNewTaxRulePage.url}}" stepKey="goToNewTaxRulePage"/> + <waitForPageLoad stepKey="waitForTaxRatePage"/> + <click stepKey="clickAdditionalSettings" selector="{{AdminTaxRulesSection.additionalSettings}}"/> + <scrollTo stepKey="scrollToAdditionalSettings" selector="{{AdminTaxRulesSection.additionalSettings}}"/> + <moveMouseOver stepKey="hoverDeleteElement" selector="{{AdminTaxRulesSection.deleteTaxClassName(taxClassName)}}"/> + <click stepKey="deleteFirstTaxClass" selector="{{AdminTaxRulesSection.deleteTaxClass(taxClassName)}}"/> + <waitForElementVisible selector="{{AdminTaxRulesSection.popUpDialogOK}}" stepKey="waitForElementBecomeVisible"/> + <click stepKey="acceptPopUpDialog" selector="{{AdminTaxRulesSection.popUpDialogOK}}"/> + <waitForPageLoad stepKey="waitForProductTaxClassDeleted"/> + </actionGroup> + <actionGroup name="editTaxConfigurationByUI"> + <annotations> + <description>Goes to the 'Configuration' page for 'Tax'. Enables the display of Taxes in the Storefront Shopping Cart and Checkout page.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `EditTaxConfigurationByUIActionGroup` instead --> + <amOnPage url="{{AdminTaxConfigurationPage.url}}" stepKey="goToAdminTaxPage"/> + <waitForPageLoad stepKey="waitForTaxConfigLoad"/> + + <scrollTo selector="#tax_defaults-head" x="0" y="-80" stepKey="scrollToTaxDefaults"/> + + <conditionalClick stepKey="clickCalculationSettings" selector="{{AdminConfigureTaxSection.defaultDestination}}" dependentSelector="#tax_defaults" visible="false"/> + <conditionalClick stepKey="clickCalculationSettingsAgain" selector="{{AdminConfigureTaxSection.defaultDestination}}" dependentSelector="#tax_defaults" visible="false"/> + <uncheckOption stepKey="clickDefaultState" selector="{{AdminConfigureTaxSection.systemValueDefaultState}}"/> + <selectOption stepKey="selectDefaultState" selector="{{AdminConfigureTaxSection.dropdownDefaultState}}" userInput="California"/> + <fillField stepKey="fillDefaultPostCode" selector="{{AdminConfigureTaxSection.defaultPostCode}}" userInput="*"/> + + <scrollTo selector="#tax_cart_display-head" x="0" y="-80" stepKey="scrollToTaxShoppingCartDisplay"/> + + <conditionalClick stepKey="clickShoppingCartDisplaySettings" selector="{{AdminConfigureTaxSection.shoppingCartDisplay}}" dependentSelector="#tax_cart_display" visible="false"/> + <conditionalClick stepKey="clickShoppingCartDisplaySettingsAgain" selector="{{AdminConfigureTaxSection.shoppingCartDisplay}}" dependentSelector="#tax_cart_display" visible="false"/> + <uncheckOption stepKey="clickTaxTotalCart" selector="{{AdminConfigureTaxSection.systemValueIncludeTaxTotalCart}}"/> + <selectOption stepKey="selectTaxTotalCart" selector="{{AdminConfigureTaxSection.dropdownIncludeTaxTotalCart}}" userInput="Yes"/> + <uncheckOption stepKey="clickDisplayTaxSummaryCart" selector="{{AdminConfigureTaxSection.systemValueDisplayTaxSummaryCart}}"/> + <selectOption stepKey="selectDisplayTaxSummaryCart" selector="{{AdminConfigureTaxSection.dropdownDisplayTaxSummaryCart}}" userInput="Yes"/> + <uncheckOption stepKey="clickDisplayZeroTaxCart" selector="{{AdminConfigureTaxSection.systemValueDisplayZeroTaxCart}}"/> + <selectOption stepKey="selectDisplayZeroTaxCart" selector="{{AdminConfigureTaxSection.dropdownDisplayZeroTaxCart}}" userInput="Yes"/> + + <scrollTo selector="#tax_sales_display-head" x="0" y="-80" stepKey="scrollToTaxSalesDisplay"/> + + <conditionalClick stepKey="clickOrdersInvoicesCreditSales" selector="{{AdminConfigureTaxSection.ordersInvoicesCreditSales}}" dependentSelector="#tax_sales_display" visible="false"/> + <conditionalClick stepKey="clickOrdersInvoicesCreditSalesAgain" selector="{{AdminConfigureTaxSection.ordersInvoicesCreditSales}}" dependentSelector="#tax_sales_display" visible="false"/> + <uncheckOption stepKey="clickTaxTotalSales" selector="{{AdminConfigureTaxSection.systemValueIncludeTaxTotalSales}}"/> + <selectOption stepKey="selectTaxTotalSales" selector="{{AdminConfigureTaxSection.dropdownIncludeTaxTotalSales}}" userInput="Yes"/> + <uncheckOption stepKey="clickDisplayTaxSummarySales" selector="{{AdminConfigureTaxSection.systemValueDisplayTaxSummarySales}}"/> + <selectOption stepKey="selectDisplayTaxSummarySales" selector="{{AdminConfigureTaxSection.dropdownDisplayTaxSummarySales}}" userInput="Yes"/> + <uncheckOption stepKey="clickDisplayZeroTaxSales" selector="{{AdminConfigureTaxSection.systemValueDisplayZeroTaxSales}}"/> + <selectOption stepKey="selectDisplayZeroTaxSales" selector="{{AdminConfigureTaxSection.dropdownDisplayZeroTaxSales}}" userInput="Yes"/> + + <scrollToTopOfPage stepKey="scrollToTop"/> + <click stepKey="saveTaxOptions" selector="{{AdminCategoryMainActionsSection.SaveButton}}"/> + <waitForPageLoad stepKey="waitForTaxSaved"/> + <see stepKey="seeSuccess" selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the configuration."/> + </actionGroup> + + <actionGroup name="changeToDefaultTaxConfigurationUI"> + <annotations> + <description>Goes to the 'Configuration' page for 'Tax'. Set the Tax Configuration Settings to the Default values. Clicks on Save. Validates that the Success Message is present and correct.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `ChangeToDefaultTaxConfigurationUIActionGroup` instead --> + <amOnPage url="{{AdminTaxConfigurationPage.url}}" stepKey="goToAdminTaxPage"/> + <waitForPageLoad stepKey="waitForTaxConfigLoad"/> + + <conditionalClick stepKey="clickCalculationSettings" selector="{{AdminConfigureTaxSection.defaultDestination}}" dependentSelector="{{AdminConfigureTaxSection.systemValueDefaultState}}" visible="false"/> + <conditionalClick stepKey="clickCalculationSettingsAgain" selector="{{AdminConfigureTaxSection.defaultDestination}}" dependentSelector="{{AdminConfigureTaxSection.systemValueDefaultState}}" visible="false"/> + <checkOption stepKey="clickDefaultState" selector="{{AdminConfigureTaxSection.systemValueDefaultState}}"/> + <selectOption stepKey="selectDefaultState" selector="{{AdminConfigureTaxSection.dropdownDefaultState}}" userInput="California"/> + <fillField stepKey="fillDefaultPostCode" selector="{{AdminConfigureTaxSection.defaultPostCode}}" userInput=""/> + + <conditionalClick stepKey="clickShoppingCartDisplaySettings" selector="{{AdminConfigureTaxSection.shoppingCartDisplay}}" dependentSelector="{{AdminConfigureTaxSection.systemValueIncludeTaxTotalCart}}" visible="false"/> + <conditionalClick stepKey="clickShoppingCartDisplaySettingsAgain" selector="{{AdminConfigureTaxSection.shoppingCartDisplay}}" dependentSelector="{{AdminConfigureTaxSection.systemValueIncludeTaxTotalCart}}" visible="false"/> + <checkOption stepKey="clickTaxTotalCart" selector="{{AdminConfigureTaxSection.systemValueIncludeTaxTotalCart}}"/> + <selectOption stepKey="selectTaxTotalCart" selector="{{AdminConfigureTaxSection.dropdownIncludeTaxTotalCart}}" userInput="Yes"/> + <checkOption stepKey="clickDisplayTaxSummaryCart" selector="{{AdminConfigureTaxSection.systemValueDisplayTaxSummaryCart}}"/> + <selectOption stepKey="selectDisplayTaxSummaryCart" selector="{{AdminConfigureTaxSection.dropdownDisplayTaxSummaryCart}}" userInput="Yes"/> + <checkOption stepKey="clickDisplayZeroTaxCart" selector="{{AdminConfigureTaxSection.systemValueDisplayZeroTaxCart}}"/> + <selectOption stepKey="selectDisplayZeroTaxCart" selector="{{AdminConfigureTaxSection.dropdownDisplayZeroTaxCart}}" userInput="Yes"/> + + <conditionalClick stepKey="clickOrdersInvoicesCreditSales" selector="{{AdminConfigureTaxSection.ordersInvoicesCreditSales}}" dependentSelector="{{AdminConfigureTaxSection.systemValueIncludeTaxTotalSales}}" visible="false"/> + <conditionalClick stepKey="clickOrdersInvoicesCreditSalesAgain" selector="{{AdminConfigureTaxSection.ordersInvoicesCreditSales}}" dependentSelector="{{AdminConfigureTaxSection.systemValueIncludeTaxTotalSales}}" visible="false"/> + <checkOption stepKey="clickTaxTotalSales" selector="{{AdminConfigureTaxSection.systemValueIncludeTaxTotalSales}}"/> + <selectOption stepKey="selectTaxTotalSales" selector="{{AdminConfigureTaxSection.dropdownIncludeTaxTotalSales}}" userInput="Yes"/> + <checkOption stepKey="clickDisplayTaxSummarySales" selector="{{AdminConfigureTaxSection.systemValueDisplayTaxSummarySales}}"/> + <selectOption stepKey="selectDisplayTaxSummarySales" selector="{{AdminConfigureTaxSection.dropdownDisplayTaxSummarySales}}" userInput="Yes"/> + <checkOption stepKey="clickDisplayZeroTaxSales" selector="{{AdminConfigureTaxSection.systemValueDisplayZeroTaxSales}}"/> + <selectOption stepKey="selectDisplayZeroTaxSales" selector="{{AdminConfigureTaxSection.dropdownDisplayZeroTaxSales}}" userInput="Yes"/> + + <scrollToTopOfPage stepKey="scrollToTop"/> + <click stepKey="saveTaxOptions" selector="{{AdminCategoryMainActionsSection.SaveButton}}"/> + <see stepKey="seeSuccess" selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the configuration."/> + </actionGroup> + + <actionGroup name="addCustomTaxRate" extends="addNewTaxRateNoZip"> + <annotations> + <description>EXTENDS: addNewTaxRateNoZip. Removes 'fillZipCode' and 'fillRate'. Fills in the Zip Code and Rate. PLEASE NOTE: The values are Hardcoded.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddCustomTaxRateActionGroup` instead --> + <remove keyForRemoval="fillZipCode"/> + <remove keyForRemoval="fillRate"/> + <fillField stepKey="fillZipCode" selector="{{AdminTaxRulesSection.zipCode}}" userInput="US-NY-*-Rate 2" after="fillTaxIdentifier"/> + <fillField stepKey="fillRate" selector="{{AdminTaxRulesSection.rate}}" userInput="0" after="selectCountry"/> + </actionGroup> + + <actionGroup name="addNewTaxRateNoZip"> + <annotations> + <description>Goes to the Admin Tax Rules grid page. Adds the provided Tax Code.</description> + </annotations> + <arguments> + <argument name="taxCode"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddNewTaxRateNoZipActionGroup` instead --> + <click stepKey="addNewTaxRate" selector="{{AdminTaxRulesSection.addNewTaxRate}}"/> + + <fillField stepKey="fillTaxIdentifier" selector="{{AdminTaxRulesSection.taxIdentifier}}" userInput="{{taxCode.state}}-{{taxCode.rate}}"/> + <fillField stepKey="fillZipCode" selector="{{AdminTaxRulesSection.zipCode}}" userInput="{{taxCode.zip}}"/> + <selectOption stepKey="selectState" selector="{{AdminTaxRulesSection.state}}" userInput="{{taxCode.state}}"/> + <selectOption stepKey="selectCountry" selector="{{AdminTaxRulesSection.country}}" userInput="{{taxCode.country}}"/> + <fillField stepKey="fillRate" selector="{{AdminTaxRulesSection.rate}}" userInput="{{taxCode.rate}}"/> + + <click stepKey="saveTaxRate" selector="{{AdminTaxRulesSection.save}}"/> + </actionGroup> + + <actionGroup name="changeShippingTaxClass"> + <annotations> + <description>Goes to the 'Configuration' page for 'Tax'. Sets the 'Tax Class for Shipping' configuration setting to 'Taxable Goods'. Clicks on Save. Validates that the Success Message is present and correct.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `ChangeShippingTaxClassActionGroup` instead --> + <click selector="{{AdminMenuSection.stores}}" stepKey="clickOnSTORES"/> + <waitForPageLoad stepKey="waitForConfiguration"/> + <click selector="{{AdminMenuSection.configuration}}" stepKey="clickOnConfigurations"/> + <waitForPageLoad stepKey="waitForSales"/> + + <click selector="{{AdminMenuSection.stores}}" stepKey="clickOnSTORES1"/> + <waitForPageLoad stepKey="waitForConfiguration1"/> + <click selector="{{AdminMenuSection.configuration}}" stepKey="clickOnConfigurations1"/> + <waitForPageLoad stepKey="waitForSales1" time="5"/> + + <click selector="{{ConfigurationListSection.sales}}" stepKey="clickOnSales"/> + <waitForPageLoad stepKey="waitForPaymentMethods"/> + <click selector="{{AdminConfigureTaxSection.salesTax}}" stepKey="clickOnTax"/> + <waitForPageLoad stepKey="waitForTax"/> + <seeInCurrentUrl url="{{AdminTaxConfigurationPage.url}}" stepKey="adminTaxConfiguration"/> + <seeElement selector="{{AdminConfigureTaxSection.taxClasses}}" stepKey="taxClassSectionC"/> + <click selector="{{AdminConfigureTaxSection.taxClasses}}" stepKey="openTaxClassSection"/> + <click selector="{{AdminConfigureTaxSection.taxShippingClassSystem}}" stepKey="uncheckSystemValue"/> + <selectOption selector="{{AdminConfigureTaxSection.taxClassShipping}}" userInput="Taxable Goods" stepKey="setTaxClassForShipping"/> + + <scrollToTopOfPage stepKey="scrollToTop"/> + <click stepKey="saveTaxOptions" selector="{{AdminCategoryMainActionsSection.SaveButton}}"/> + <waitForPageLoad stepKey="waitForTaxSaved"/> + <see stepKey="seeSuccess" selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the configuration."/> + </actionGroup> + + <actionGroup name="setDefaultShippingTaxClass"> + <annotations> + <description>Goes to the 'Configuration' page via the Admin Side Menu. Sets the 'Tax Class for Shipping' to the System Default. Clicks on Save. Validates that the Success Message is present and correct.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SetDefaultShippingTaxClassActionGroup` instead --> + <click selector="{{AdminMenuSection.stores}}" stepKey="clickOnSTORES"/> + <waitForPageLoad stepKey="waitForConfiguration"/> + <click selector="{{AdminMenuSection.configuration}}" stepKey="clickOnConfigurations"/> + <waitForPageLoad stepKey="waitForSales"/> + + <click selector="{{AdminMenuSection.stores}}" stepKey="clickOnSTORES1"/> + <waitForPageLoad stepKey="waitForConfiguration1"/> + <click selector="{{AdminMenuSection.configuration}}" stepKey="clickOnConfigurations1"/> + <waitForPageLoad stepKey="waitForSales1"/> + + <click selector="{{ConfigurationListSection.sales}}" stepKey="clickOnSales"/> + <waitForPageLoad stepKey="waitForPaymentMethods"/> + <click selector="{{AdminConfigureTaxSection.salesTax}}" stepKey="clickOnTax"/> + <waitForPageLoad stepKey="waitForTax"/> + <seeElement selector="{{AdminConfigureTaxSection.taxClasses}}" stepKey="taxClassSectionC"/> + <click selector="{{AdminConfigureTaxSection.taxShippingClassSystem}}" stepKey="checkSystemDefaultValue"/> + <click selector="{{AdminConfigureTaxSection.taxClasses}}" stepKey="closeTaxClassSection"/> + + <scrollToTopOfPage stepKey="scrollToTop"/> + <click stepKey="saveTaxOptions" selector="{{AdminCategoryMainActionsSection.SaveButton}}"/> + <waitForPageLoad stepKey="waitForTaxSaved"/> + <see stepKey="seeSuccess" selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the configuration."/> + </actionGroup> + + <actionGroup name="addProductTaxClass"> + <annotations> + <description>Adds the provided Product Tax Class to a Tax Rule. Clicks on Save.</description> + </annotations> + <arguments> + <argument name="prodTaxClassName" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddProductTaxClassActionGroup` instead --> + <click stepKey="clickAdditionalSettings" selector="{{AdminTaxRulesSection.additionalSettings}}"/> + <click stepKey="clickProdAddNewTaxClassBtn" selector="{{AdminTaxRulesSection.productAddNewTaxClass}}"/> + <fillField stepKey="fillProdNewTaxClass" selector="{{AdminTaxRulesSection.fieldProdNewTaxClass}}" userInput="{{prodTaxClassName}}"/> + <click stepKey="saveProdTaxRate" selector="{{AdminTaxRulesSection.saveProdNewTaxClass}}"/> + </actionGroup> + + <actionGroup name="addNewTaxRuleActionGroup"> + <annotations> + <description>Goes to the Admin Tax Rules grid page. Clicks on the Add New Tax Rule button.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddNewTaxRuleActionGroup` instead --> + <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRulePage"/> + <waitForPageLoad stepKey="waitForTaxRatePage"/> + <click stepKey="addNewTaxRate" selector="{{AdminGridMainControls.add}}"/> + </actionGroup> + + <actionGroup name="deleteProductTaxClass"> + <annotations> + <description>Goes to the Admin Tax Rule creation page. Deletes the provided Tax Class.</description> + </annotations> + <arguments> + <argument name="taxClassName" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `DeleteProductTaxClassActionGroup` instead --> + <amOnPage url="{{AdminNewTaxRulePage.url}}" stepKey="goToNewTaxRulePage"/> + <waitForPageLoad stepKey="waitForTaxRatePage"/> + <click stepKey="clickAdditionalSettings" selector="{{AdminTaxRulesSection.additionalSettings}}"/> + <scrollTo stepKey="scrollToAdditionalSettings" selector="{{AdminTaxRulesSection.additionalSettings}}"/> + <moveMouseOver stepKey="hoverDeleteElement" selector="{{AdminTaxRulesSection.deleteTaxClassName(taxClassName)}}"/> + <click stepKey="deleteFirstTaxClass" selector="{{AdminTaxRulesSection.deleteTaxClass(taxClassName)}}"/> + <waitForElementVisible selector="{{AdminTaxRulesSection.popUpDialogOK}}" stepKey="waitForElementBecomeVisible"/> + <click stepKey="acceptPopUpDialog" selector="{{AdminTaxRulesSection.popUpDialogOK}}"/> + <waitForPageLoad stepKey="waitForProductTaxClassDeleted"/> + </actionGroup> +</actionGroups> From c58d35203e88d87d4b08bf1b981173134e00652d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Wed, 4 Dec 2019 22:39:57 +0100 Subject: [PATCH 0220/1143] BACKWARD COMPATIBILITY: Deprecated ActionGroups to make change Backward Compatible. --- .../ActionGroup/_Deprecated_ActionGroup.xml | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 app/code/Magento/Swatches/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml diff --git a/app/code/Magento/Swatches/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml new file mode 100644 index 0000000000000..676d6bb2d3e37 --- /dev/null +++ b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml @@ -0,0 +1,115 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<!-- +NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. + Please find the Comment with proper replacement for each of ActionGroups provided. +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="setColorPickerByHex"> + <annotations> + <description>Sets the provided HEX value in the provided Color Picker.</description> + </annotations> + <arguments> + <argument name="nthColorPicker" type="string" defaultValue="1"/> + <argument name="hexColor" type="string" defaultValue="e74c3c"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SetColorPickerByHexActionGroup` instead --> + <pressKey selector="{{AdminColorPickerSection.hexByIndex(nthColorPicker)}}" parameterArray="[\Facebook\WebDriver\WebDriverKeys::BACKSPACE,\Facebook\WebDriver\WebDriverKeys::BACKSPACE,\Facebook\WebDriver\WebDriverKeys::BACKSPACE,\Facebook\WebDriver\WebDriverKeys::BACKSPACE,\Facebook\WebDriver\WebDriverKeys::BACKSPACE,\Facebook\WebDriver\WebDriverKeys::BACKSPACE,'{{hexColor}}']" stepKey="fillHex1"/> + <click selector="{{AdminColorPickerSection.submitByIndex(nthColorPicker)}}" stepKey="submitColor1"/> + </actionGroup> + + <actionGroup name="assertSwatchColor"> + <annotations> + <description>Validates that the provided Color Picker contains the provided Style.</description> + </annotations> + <arguments> + <argument name="nthSwatch" type="string" defaultValue="1"/> + <argument name="expectedStyle" type="string" defaultValue="background: rgb(0, 0, 0);"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertSwatchColorActionGroup` instead --> + <grabAttributeFrom selector="{{AdminManageSwatchSection.nthSwatch(nthSwatch)}}" userInput="style" stepKey="grabStyle1"/> + <assertEquals stepKey="assertStyle1"> + <actualResult type="string">{$grabStyle1}</actualResult> + <expectedResult type="string">{{expectedStyle}}</expectedResult> + </assertEquals> + </actionGroup> + + <actionGroup name="assertStorefrontSwatchColor"> + <annotations> + <description>Validates that the Storefront Product has the provided Swatch with the provided Color.</description> + </annotations> + <arguments> + <argument name="nthSwatch" type="string" defaultValue="1"/> + <argument name="expectedRgb" type="string" defaultValue="rgb(231, 77, 60)"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertStorefrontSwatchColorActionGroup` instead --> + <grabAttributeFrom selector="{{StorefrontProductInfoMainSection.nthSwatchOption(nthSwatch)}}" userInput="style" stepKey="grabStyle1"/> + <assertEquals stepKey="assertStyle1"> + <actualResult type="string">{$grabStyle1}</actualResult> + <expectedResult type="string">background: center center no-repeat {{expectedRgb}};</expectedResult> + </assertEquals> + </actionGroup> + + <actionGroup name="openSwatchMenuByIndex"> + <annotations> + <description>Options the Swatch Menu based on the provided Index.</description> + </annotations> + <arguments> + <argument name="index" type="string" defaultValue="0"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `OpenSwatchMenuByIndexActionGroup` instead --> + <executeJS function="jQuery('#swatch_window_option_option_{{index}}').click()" stepKey="clickSwatch1"/> + </actionGroup> + + <actionGroup name="StorefrontSelectSwatchOptionOnProductPage"> + <arguments> + <argument name="optionName" type="string"/> + </arguments> + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontSelectSwatchOptionOnProductPageActionGroup` instead --> + <click selector="{{StorefrontProductInfoMainSection.swatchOptionByLabel(optionName)}}" stepKey="clickSwatchOption"/> + </actionGroup> + + <actionGroup name="StorefrontAssertSwatchOptionPrice"> + <arguments> + <argument name="optionName" type="string"/> + <argument name="optionPrice" type="string"/> + </arguments> + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontAssertSwatchOptionPriceActionGroup` instead --> + <click selector="{{StorefrontProductInfoMainSection.swatchOptionByLabel(optionName)}}" stepKey="clickOnOption"/> + <see userInput="{{optionPrice}}" selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="seeOptionPrice"/> + </actionGroup> + + <actionGroup name="StorefrontSelectSwatchOptionOnProductPageAndCheckImage" extends="StorefrontSelectSwatchOptionOnProductPage"> + <arguments> + <argument name="fileName" type="string" defaultValue="magento-logo"/> + </arguments> + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontSelectSwatchOptionOnProductPageAndCheckImageActionGroup` instead --> + <seeElement selector="{{StorefrontProductMediaSection.productImageActive(fileName)}}" stepKey="seeActiveImageDefault"/> + </actionGroup> + + <actionGroup name="StorefrontUpdateCartConfigurableProductWithSwatches"> + <arguments> + <argument name="product"/> + <argument name="productOption" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontUpdateCartConfigurableProductWithSwatchesActionGroup` instead --> + <click selector="{{CheckoutCartProductSection.nthEditButton('1')}}" stepKey="clickEditConfigurableProductButton"/> + <waitForPageLoad stepKey="waitForStorefrontProductPageLoad"/> + <click selector="{{StorefrontProductInfoMainSection.visualSwatchOption(productOption)}}" stepKey="changeSwatchAttributeOption"/> + <click selector="{{StorefrontProductInfoMainSection.updateCart}}" stepKey="clickUpdateCartButton"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> + <see selector="{{StorefrontMessagesSection.success}}" userInput="{{product.name}} was updated in your shopping cart." stepKey="assertSuccessMessage"/> + </actionGroup> +</actionGroups> From a00875e37b6adea0be3511426bbb066d52544fe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Wed, 4 Dec 2019 22:49:45 +0100 Subject: [PATCH 0221/1143] BACKWARD COMPATIBILITY: Deprecated ActionGroups to make change Backward Compatible. --- .../ActionGroup/_Deprecated_ActionGroup.xml | 247 ++++++++++++++++++ 1 file changed, 247 insertions(+) create mode 100644 app/code/Magento/Store/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml new file mode 100644 index 0000000000000..7654b1baef2d8 --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml @@ -0,0 +1,247 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<!-- +NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. + Please find the Comment with proper replacement for each of ActionGroups provided. +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateCustomStore"> + <annotations> + <description>Goes to the Admin Stores grid page. Clicks on 'Create Store'. Fills in the provided Details (Website, Store Group Name and Store Group Code). Clicks on Save. Validates that the Success Message is present and correct.</description> + </annotations> + <arguments> + <argument name="website" type="string"/> + <argument name="store" type="string"/> + <argument name="rootCategory" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateCustomStoreActionGroup` instead --> + <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> + <waitForPageLoad stepKey="waitForSystemStorePage"/> + <click selector="{{AdminStoresMainActionsSection.createStoreButton}}" stepKey="selectCreateStore"/> + <selectOption userInput="{{website}}" selector="{{AdminNewStoreGroupSection.storeGrpWebsiteDropdown}}" stepKey="selectMainWebsite"/> + <fillField userInput="{{store}}" selector="{{AdminNewStoreGroupSection.storeGrpNameTextField}}" stepKey="fillStoreName"/> + <fillField userInput="{{store}}" selector="{{AdminNewStoreGroupSection.storeGrpCodeTextField}}" stepKey="fillStoreCode"/> + <selectOption userInput="{{rootCategory}}" selector="{{AdminNewStoreGroupSection.storeRootCategoryDropdown}}" stepKey="selectStoreStatus"/> + <click selector="{{AdminStoreGroupActionsSection.saveButton}}" stepKey="clickSaveStoreGroup"/> + <waitForElementVisible selector="{{AdminStoresGridSection.storeGrpFilterTextField}}" stepKey="waitForStoreGridReload"/> + <see userInput="You saved the store." stepKey="seeSavedMessage"/> + </actionGroup> + + <actionGroup name="AssertStoreGroupInGrid"> + <annotations> + <description>Goes to the Admin Stores grid page. Searches for the provided Store Group Name. Validates that the provided Store Group Name is present in the grid.</description> + </annotations> + <arguments> + <argument name="storeGroupName" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertStoreGroupInGridActionGroup` instead --> + <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> + <waitForPageLoad stepKey="waitForAdminSystemStorePageLoad"/> + <click selector="{{AdminStoresGridSection.resetButton}}" stepKey="resetSearchFilter"/> + <fillField userInput="{{storeGroupName}}" selector="{{AdminStoresGridSection.storeGrpFilterTextField}}" stepKey="fillSearchStoreGroupField"/> + <click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearchButton"/> + <waitForPageLoad stepKey="waitForStoreToLoad"/> + <see selector="{{AdminStoresGridSection.nthRow('1')}}" userInput="{{storeGroupName}}" stepKey="seeAssertStoreGroupInGridMessage"/> + </actionGroup> + + <actionGroup name="AssertStoreGroupForm"> + <annotations> + <description>Clicks on the 1st Store in the 'Stores' grid. Validates that the provided Details (Website, Store Group Name, Store Group Code and Root Category) are present and correct.</description> + </annotations> + <arguments> + <argument name="website" type="string"/> + <argument name="storeGroupName" type="string"/> + <argument name="storeGroupCode" type="string"/> + <argument name="rootCategory" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertStoreGroupFormActionGroup` instead --> + <click selector="{{AdminStoresGridSection.storeGrpNameInFirstRow}}" stepKey="clickEditExistingStoreRow"/> + <waitForPageLoad stepKey="waitTillAdminSystemStoreGroupPage"/> + <seeInField selector="{{AdminNewStoreGroupSection.storeGrpWebsiteDropdown}}" userInput="{{website}}" stepKey="seeAssertWebsite"/> + <seeInField selector="{{AdminNewStoreGroupSection.storeGrpNameTextField}}" userInput="{{storeGroupName}}" stepKey="seeAssertStoreGroupName"/> + <seeInField selector="{{AdminNewStoreGroupSection.storeGrpCodeTextField}}" userInput="{{storeGroupCode}}" stepKey="seeAssertStoreGroupCode"/> + <seeInField selector="{{AdminNewStoreGroupSection.storeRootCategoryDropdown}}" userInput="{{rootCategory}}" stepKey="seeAssertRootCategory"/> + </actionGroup> + + <actionGroup name="AdminCreateStoreViewActionSaveGroup"> + <annotations> + <description>Validates that the Success Message is present and correct.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminCreateStoreViewSaveActionGroup` instead --> + <waitForLoadingMaskToDisappear stepKey="waitForGridLoad"/> + <waitForElementVisible selector="{{AdminStoresGridSection.websiteFilterTextField}}" stepKey="waitForStoreGridToReload2"/> + <see userInput="You saved the store view." stepKey="seeSavedMessage"/> + </actionGroup> + + <actionGroup name="navigateToAdminContentManagementPage"> + <annotations> + <description>Goes to the 'Configuration' page for 'Content Management'.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `NavigateToAdminContentManagementPageActionGroup` instead --> + <amOnPage url="{{AdminContentManagementPage.url}}" stepKey="navigateToConfigurationPage"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + </actionGroup> + + <actionGroup name="saveStoreConfiguration"> + <annotations> + <description>Clicks on the Save button.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SaveStoreConfigurationActionGroup` instead --> + <comment userInput="saveStoreConfiguration" stepKey="comment"/> + <waitForElementVisible selector="{{StoreConfigSection.Save}}" stepKey="waitForSaveButton"/> + <click selector="{{StoreConfigSection.Save}}" stepKey="clickSaveButton"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + </actionGroup> + + <actionGroup name="saveStoreConfigurationAndValidateFieldError"> + <annotations> + <description>Clicks on Save. Validates that the fields are required.</description> + </annotations> + <arguments> + <argument name="inputFieldError" type="string"/> + <argument name="errorMessageSelector" type="string"/> + <argument name="errorMessage" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SaveStoreConfigurationAndValidateFieldErrorActionGroup` instead --> + <comment userInput="saveStoreConfigurationAndValidateFieldError" stepKey="comment"/> + <waitForElementVisible selector="{{StoreConfigSection.Save}}" stepKey="waitForSaveButton"/> + <click selector="{{StoreConfigSection.Save}}" stepKey="clickSaveButton"/> + <waitForElement selector="{{inputFieldError}}" stepKey="waitForErrorField"/> + <waitForElementVisible selector="{{errorMessageSelector}}" stepKey="waitForErrorMessage"/> + <see selector="{{errorMessageSelector}}" userInput="{{errorMessage}}" stepKey="seeErrorMessage"/> + </actionGroup> + + <actionGroup name="AssertWebsiteInGrid"> + <annotations> + <description>Goes to the Admin Stores grid page. Searches the grid for the provided Website Name. Validates that the Website appears in the grid.</description> + </annotations> + <arguments> + <argument name="websiteName" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertWebsiteInGridActionGroup` instead --> + <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> + <waitForPageLoad stepKey="waitForAdminSystemStorePageLoad"/> + <click selector="{{AdminStoresGridSection.resetButton}}" stepKey="resetSearchFilter"/> + <fillField userInput="{{websiteName}}" selector="{{AdminStoresGridSection.websiteFilterTextField}}" stepKey="fillWebsiteField"/> + <click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearchButton"/> + <waitForPageLoad stepKey="waitForStoreToLoad"/> + <seeElement selector="{{AdminStoresGridSection.websiteName(websiteName)}}" stepKey="seeAssertWebsiteInGrid"/> + </actionGroup> + + <actionGroup name="AssertWebsiteForm"> + <annotations> + <description>Clicks on the provided Website Name in the Admin Stores grid. Validates that the URL, Website Name/Code are present and correct.</description> + </annotations> + <arguments> + <argument name="websiteName" type="string"/> + <argument name="websiteCode" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertWebsiteFormActionGroup` instead --> + <click selector="{{AdminStoresGridSection.websiteName(websiteName)}}" stepKey="clickWebsiteFirstRowInGrid"/> + <waitForPageLoad stepKey="waitTillWebsiteFormPageIsOpened"/> + <grabFromCurrentUrl regex="~(\d+)/~" stepKey="grabWebsiteIdFromCurrentUrl"/> + <seeInCurrentUrl url="/system_store/editWebsite/website_id/{$grabWebsiteIdFromCurrentUrl}" stepKey="seeWebsiteId"/> + <seeInField selector="{{AdminNewWebsiteSection.name}}" userInput="{{websiteName}}" stepKey="seeAssertWebsiteName"/> + <seeInField selector="{{AdminNewWebsiteSection.code}}" userInput="{{websiteCode}}" stepKey="seeAssertWebsiteCode"/> + </actionGroup> + + <actionGroup name="AssertStoreViewNotInGrid"> + <annotations> + <description>Goes to the Admin Stores grid page. Searches the grid for the provided Store View name. Validates that it does NOT appear in the grid.</description> + </annotations> + <arguments> + <argument name="storeViewName" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertStoreViewNotInGridActionGroup` instead --> + <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> + <waitForPageLoad stepKey="waitForAdminSystemStorePageLoad"/> + <click selector="{{AdminStoresGridSection.resetButton}}" stepKey="resetSearchFilter"/> + <fillField userInput="{{storeViewName}}" selector="{{AdminStoresGridSection.storeFilterTextField}}" stepKey="fillSearchStoreViewField"/> + <click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearchButton"/> + <waitForPageLoad stepKey="waitForStoreToLoad"/> + <see selector="{{AdminStoresGridSection.emptyText}}" userInput="We couldn't find any records." stepKey="seeAssertStoreViewNotInGridMessage"/> + </actionGroup> + + <actionGroup name="AdminAddCustomWebSiteToStoreGroup"> + <annotations> + <description>Goes to the Admin Stores grid page. Searches the grid for the provided Store Group. Edits the Store. Adds the provided Website to the Store. Clicks on Save. Validates that the Success Message is present and correct.</description> + </annotations> + <arguments> + <argument name="storeGroup" defaultValue="customStoreGroup"/> + <argument name="website" defaultValue="customWebsite"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminAddCustomWebSiteToStoreGroupActionGroup` instead --> + <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> + <click selector="{{AdminStoresGridSection.resetButton}}" stepKey="resetSearchFilter"/> + <fillField userInput="{{storeGroup.name}}" selector="{{AdminStoresGridSection.storeGrpFilterTextField}}" stepKey="fillSearchStoreGroupField"/> + <click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearchButton"/> + <see userInput="{{storeGroup.name}}" selector="{{AdminStoresGridSection.storeGrpNameInFirstRow}}" stepKey="verifyThatCorrectStoreGroupFound"/> + <click selector="{{AdminStoresGridSection.storeGrpNameInFirstRow}}" stepKey="clickEditExistingStoreRow"/> + <waitForPageLoad stepKey="waitForStoreGroupPageLoad"/> + <selectOption selector="{{AdminNewStoreGroupSection.storeGrpWebsiteDropdown}}" userInput="{{website.name}}" stepKey="selectWebsite"/> + <selectOption selector="{{AdminNewStoreGroupSection.storeRootCategoryDropdown}}" userInput="Default Category" stepKey="chooseRootCategory"/> + <click selector="{{AdminNewStoreGroupActionsSection.saveButton}}" stepKey="clickSaveStoreGroup"/> + <conditionalClick selector="{{AdminNewStoreGroupSection.acceptNewStoreGroupCreation}}" dependentSelector="{{AdminNewStoreGroupSection.acceptNewStoreGroupCreation}}" visible="true" stepKey="clickAcceptNewStoreGroupCreationButton"/> + <waitForElementVisible selector="{{AdminStoresGridSection.storeFilterTextField}}" stepKey="waitForPageReload"/> + <see userInput="You saved the store." stepKey="seeSavedMessage"/> + </actionGroup> + + <actionGroup name="CreateStoreView"> + <annotations> + <description>Goes to the Admin Store Views creation page. Fills in the provided Store View, Store Group Name and Store View Status. Clicks on Save. Validates that the Success Message is present and correct.</description> + </annotations> + <arguments> + <argument name="storeView" defaultValue="customStore"/> + <argument name="storeGroupName" defaultValue="_defaultStoreGroup.name"/> + <argument name="storeViewStatus" defaultValue="_defaultStore.is_active"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateStoreViewActionGroup` instead --> + <amOnPage url="{{AdminSystemStoreViewPage.url}}" stepKey="amOnAdminSystemStoreViewPage"/> + <waitForPageLoad stepKey="waitForProductPageLoad"/> + <selectOption userInput="{{storeGroupName}}" selector="{{AdminNewStoreSection.storeGrpDropdown}}" stepKey="selectStoreGroup"/> + <fillField userInput="{{storeView.name}}" selector="{{AdminNewStoreSection.storeNameTextField}}" stepKey="fillStoreViewName"/> + <fillField userInput="{{storeView.code}}" selector="{{AdminNewStoreSection.storeCodeTextField}}" stepKey="fillStoreViewCode"/> + <selectOption userInput="{{storeViewStatus}}" selector="{{AdminNewStoreSection.statusDropdown}}" stepKey="selectStoreViewStatus"/> + <click selector="{{AdminStoresMainActionsSection.saveButton}}" stepKey="clickSaveStoreViewButton"/> + <waitForElementVisible selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" stepKey="waitForAcceptNewStoreViewCreationButton"/> + <conditionalClick selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" dependentSelector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" visible="true" stepKey="clickAcceptNewStoreViewCreationButton"/> + <see userInput="You saved the store view." stepKey="seeSavedMessage"/> + </actionGroup> + + <actionGroup name="AssertStoreNotInGrid"> + <annotations> + <description>Goes to the Admin Stores grid page. Validates that the provided Store Group Name is NOT present in the grid.</description> + </annotations> + <arguments> + <argument name="storeGroupName" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertStoreNotInGridActionGroup` instead --> + <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> + <waitForPageLoad stepKey="waitForAdminSystemStorePageLoad"/> + <click selector="{{AdminStoresGridSection.resetButton}}" stepKey="resetSearchFilter"/> + <fillField userInput="{{storeGroupName}}" selector="{{AdminStoresGridSection.storeGrpFilterTextField}}" stepKey="fillSearchStoreGroupField"/> + <click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearchButton"/> + <waitForPageLoad stepKey="waitForStoreToLoad"/> + <see selector="{{AdminStoresGridSection.emptyText}}" userInput="We couldn't find any records." stepKey="seeAssertStoreGroupNotInGridMessage"/> + </actionGroup> +</actionGroups> From ccb04de3b72da75e6fed51140fb79558f887452c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Wed, 4 Dec 2019 23:00:21 +0100 Subject: [PATCH 0222/1143] BACKWARD COMPATIBILITY: Deprecated ActionGroups to make change Backward Compatible. --- .../ActionGroup/_Deprecated_ActionGroup.xml | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 app/code/Magento/Search/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml diff --git a/app/code/Magento/Search/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Search/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml new file mode 100644 index 0000000000000..6c860e8273bab --- /dev/null +++ b/app/code/Magento/Search/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<!-- +NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. + Please find the Comment with proper replacement for each of ActionGroups provided. +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="searchTermFilterBySearchQuery"> + <annotations> + <description>Fills in the provided Search Query on the Admin Search Term grid page.</description> + </annotations> + <arguments> + <argument name="searchQuery" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminSearchTermFilterBySearchQueryActionGroup` instead --> + <click selector="{{AdminCatalogSearchTermIndexSection.resetFilterButton}}" stepKey="clickOnResetButton"/> + <waitForPageLoad stepKey="waitForResetFilter"/> + <fillField selector="{{AdminCatalogSearchTermIndexSection.searchQuery}}" userInput="{{searchQuery}}" stepKey="fillSearchQuery"/> + <click selector="{{AdminCatalogSearchTermIndexSection.searchButton}}" stepKey="clickSearchButton"/> + <waitForPageLoad stepKey="waitForSearchResultLoad"/> + <checkOption selector="{{AdminCatalogSearchTermIndexSection.searchTermRowCheckboxBySearchQuery(searchQuery)}}" stepKey="checkCheckBox"/> + </actionGroup> + + <actionGroup name="deleteSearchTerm"> + <annotations> + <description>Deletes the Search Terms in the Admin Search Term grid.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminDeleteSearchTermActionGroup` instead --> + <selectOption selector="{{AdminCatalogSearchTermIndexSection.massActions}}" userInput="delete" stepKey="selectDeleteOption"/> + <click selector="{{AdminCatalogSearchTermIndexSection.submit}}" stepKey="clickSubmitButton"/> + <click selector="{{AdminCatalogSearchTermIndexSection.okButton}}" stepKey="clickOkButton"/> + <waitForElementVisible selector="{{AdminCatalogSearchTermMessagesSection.successMessage}}" stepKey="waitForSuccessMessage"/> + </actionGroup> + + <actionGroup name="DeleteAllSearchTerms"> + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminDeleteAllSearchTermsActionGroup` instead --> + <selectOption userInput="selectAll" selector="{{AdminCatalogSearchTermIndexSection.selectMassActionCheckbox}}" stepKey="checkAllSearchTerms"/> + <selectOption selector="{{AdminCatalogSearchTermIndexSection.massActions}}" userInput="delete" stepKey="selectDeleteOption"/> + <click selector="{{AdminCatalogSearchTermIndexSection.submit}}" stepKey="clickSubmitButton"/> + <click selector="{{AdminCatalogSearchTermIndexSection.okButton}}" stepKey="clickOkButton"/> + </actionGroup> +</actionGroups> From 8ff30a8dc9d2ce8854793d1654fcf5f7122b5ffa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Wed, 4 Dec 2019 23:11:51 +0100 Subject: [PATCH 0223/1143] BACKWARD COMPATIBILITY: Deprecated ActionGroups to make change Backward Compatible. --- .../ActionGroup/_Deprecated_ActionGroup.xml | 110 ++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 app/code/Magento/SalesRule/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml new file mode 100644 index 0000000000000..648500bcaeb40 --- /dev/null +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml @@ -0,0 +1,110 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<!-- +NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. + Please find the Comment with proper replacement for each of ActionGroups provided. +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="selectNotLoggedInCustomerGroup"> + <annotations> + <description>Selects 'NOT LOGGED IN' from the 'Customer Groups' list (Magento 2 B2B). PLEASE NOTE: The value is Hardcoded.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SelectNotLoggedInCustomerGroupActionGroup` instead --> + <selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="NOT LOGGED IN" stepKey="selectCustomerGroup"/> + </actionGroup> + + <actionGroup name="selectRetailerCustomerGroup"> + <annotations> + <description>Selects 'Retailer' from the 'Customer Groups' list (Magento 2 B2B). PLEASE NOTE: The value is Hardcoded.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SelectRetailerCustomerGroupActionGroup` instead --> + <selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="Retailer" stepKey="selectRetailerCustomerGroup"/> + </actionGroup> + + <actionGroup name="AdminCreateCartPriceRuleWithCouponCode" extends="AdminCreateCartPriceRuleActionGroup"> + <annotations> + <description>EXTENDS: AdminCreateCartPriceRuleActionGroup. Removes 'selectActionType' and 'fillDiscountAmount'. Adds the provided Coupon Code to a Cart Price Rule.</description> + </annotations> + <arguments> + <argument name="couponCode" defaultValue="_defaultCoupon.code"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminCreateCartPriceRuleWithCouponCodeActionGroup` instead --> + <remove keyForRemoval="selectActionType"/> + <remove keyForRemoval="fillDiscountAmount"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.coupon}}" userInput="Specific Coupon" stepKey="selectCouponType" after="fillRuleName"/> + <waitForElementVisible selector="{{AdminCartPriceRulesFormSection.couponCode}}" stepKey="waitForElementVisible" after="selectCouponType"/> + <fillField selector="{{AdminCartPriceRulesFormSection.couponCode}}" userInput="{{couponCode}}" stepKey="fillCouponCode" after="waitForElementVisible"/> + <fillField selector="{{AdminCartPriceRulesFormSection.userPerCoupon}}" userInput="99" stepKey="fillUserPerCoupon" after="fillCouponCode"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="Fixed amount discount for whole cart" stepKey="selectActionTypeToFixed" after="clickToExpandActions"/> + <fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="1" stepKey="fillDiscountAmount" after="selectActionTypeToFixed"/> + </actionGroup> + + <actionGroup name="AdminCreateCartPriceRuleWithConditions" extends="AdminCreateCartPriceRuleActionGroup"> + <annotations> + <description>EXTENDS: AdminCreateCartPriceRuleActionGroup. Removes 'fillDiscountAmount'. Adds the 2 provided Conditions (Name, Rule, Rule to Change and Category Name) to a Cart Price Rule.</description> + </annotations> + <arguments> + <argument name="condition1" type="string" defaultValue="Products subselection"/> + <argument name="condition2" type="string" defaultValue="Category"/> + <argument name="ruleToChange1" type="string" defaultValue="is"/> + <argument name="rule1" type="string" defaultValue="equals or greater than"/> + <argument name="ruleToChange2" type="string" defaultValue="..."/> + <argument name="rule2" type="string" defaultValue="2"/> + <argument name="categoryName" type="string" defaultValue="_defaultCategory.name"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminCreateCartPriceRuleWithConditionsActionGroup` instead --> + <remove keyForRemoval="fillDiscountAmount"/> + + <click selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" stepKey="openConditionsSection" after="selectActionType"/> + <click selector="{{AdminCartPriceRulesFormSection.addCondition('1')}}" stepKey="addFirstCondition" after="openConditionsSection"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.ruleCondition('1')}}" userInput="{{condition1}}" stepKey="selectRule" after="addFirstCondition"/> + <waitForElementVisible selector="{{AdminCartPriceRulesFormSection.ruleParameter(ruleToChange1)}}" stepKey="waitForFirstRuleElement" after="selectRule"/> + <click selector="{{AdminCartPriceRulesFormSection.ruleParameter(ruleToChange1)}}" stepKey="clickToChangeRule" after="waitForFirstRuleElement"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.ruleParameterSelect('1--1')}}" userInput="{{rule1}}" stepKey="selectRule1" after="clickToChangeRule"/> + <waitForElementVisible selector="{{AdminCartPriceRulesFormSection.ruleParameter(ruleToChange2)}}" stepKey="waitForSecondRuleElement" after="selectRule1"/> + <click selector="{{AdminCartPriceRulesFormSection.ruleParameter(ruleToChange2)}}" stepKey="clickToChangeRule1" after="waitForSecondRuleElement"/> + <fillField selector="{{AdminCartPriceRulesFormSection.ruleParameterInput('1--1')}}" userInput="{{rule2}}" stepKey="fillRule" after="clickToChangeRule1"/> + <click selector="{{AdminCartPriceRulesFormSection.addCondition('1--1')}}" stepKey="addSecondCondition" after="fillRule"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.ruleCondition('1--1')}}" userInput="{{condition2}}" stepKey="selectSecondCondition" after="addSecondCondition"/> + <waitForElementVisible selector="{{AdminCartPriceRulesFormSection.ruleParameter(ruleToChange2)}}" stepKey="waitForThirdRuleElement" after="selectSecondCondition"/> + <click selector="{{AdminCartPriceRulesFormSection.ruleParameter(ruleToChange2)}}" stepKey="addThirdCondition" after="waitForThirdRuleElement"/> + <waitForElementVisible selector="{{AdminCartPriceRulesFormSection.openChooser('1--1--1')}}" stepKey="waitForForthRuleElement" after="addThirdCondition"/> + <click selector="{{AdminCartPriceRulesFormSection.openChooser('1--1--1')}}" stepKey="openChooser" after="waitForForthRuleElement"/> + <waitForElementVisible selector="{{AdminCartPriceRulesFormSection.categoryCheckbox(categoryName)}}" stepKey="waitForCategoryVisible" after="openChooser"/> + <checkOption selector="{{AdminCartPriceRulesFormSection.categoryCheckbox(categoryName)}}" stepKey="checkCategoryName" after="waitForCategoryVisible"/> + </actionGroup> + + <actionGroup name="VerifyDiscountAmount"> + <annotations> + <description>Goes to the provided Storefront Product URL. Fills in provided Quantity. Clicks Add to Cart. Goes to Checkout. Validates that the provided Discount Amount is present and correct.</description> + </annotations> + <arguments> + <argument name="productUrl" type="string"/> + <argument name="quantity" type="string"/> + <argument name="expectedDiscount" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `VerifyDiscountAmountActionGroup` instead --> + <amOnPage url="{{productUrl}}" stepKey="goToProductPage"/> + <waitForPageLoad stepKey="waitForProductPageLoad"/> + <fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="{{quantity}}" stepKey="fillQuantity"/> + <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart"/> + <waitForPageLoad stepKey="waitForAddToCart"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> + <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage"/> + <waitForPageLoad stepKey="waitForCartPage"/> + <waitForElementVisible selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="waitForDiscountElement"/> + <see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="{{expectedDiscount}}" stepKey="seeDiscountTotal"/> + </actionGroup> +</actionGroups> From 7311141cbd79bab02bb19b8e024610cadebae689 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Wed, 4 Dec 2019 23:30:56 +0100 Subject: [PATCH 0224/1143] BACKWARD COMPATIBILITY: Deprecated ActionGroups to make change Backward Compatible. --- ...BasicCreditMemoInformationActionGroup.xml} | 0 .../ActionGroup/_Deprecated_ActionGroup.xml | 673 ++++++++++++++++++ 2 files changed, 673 insertions(+) rename app/code/Magento/Sales/Test/Mftf/ActionGroup/{AdminCreditMemoActionGroup.xml => VerifyBasicCreditMemoInformationActionGroup.xml} (100%) create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminCreditMemoActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/VerifyBasicCreditMemoInformationActionGroup.xml similarity index 100% rename from app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminCreditMemoActionGroup.xml rename to app/code/Magento/Sales/Test/Mftf/ActionGroup/VerifyBasicCreditMemoInformationActionGroup.xml diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml new file mode 100644 index 0000000000000..6a6ddfb514890 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml @@ -0,0 +1,673 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<!-- +NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. + Please find the Comment with proper replacement for each of ActionGroups provided. +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="verifyBasicCreditMemoInformation"> + <annotations> + <description>Validates that the provided Customer, Shipping/Billing Address and Customer Group are present and correct on the Admin Credit Memo view page.</description> + </annotations> + <arguments> + <argument name="customer" defaultValue=""/> + <argument name="shippingAddress" defaultValue=""/> + <argument name="billingAddress" defaultValue=""/> + <argument name="customerGroup" defaultValue="GeneralCustomerGroup"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `VerifyBasicCreditMemoInformationActionGroup` instead --> + <see selector="{{AdminCreditMemoOrderInformationSection.customerName}}" userInput="{{customer.firstname}}" stepKey="seeCustomerName"/> + <see selector="{{AdminCreditMemoOrderInformationSection.customerEmail}}" userInput="{{customer.email}}" stepKey="seeCustomerEmail"/> + <see selector="{{AdminCreditMemoOrderInformationSection.customerGroup}}" userInput="{{customerGroup.code}}" stepKey="seeCustomerGroup"/> + + <see selector="{{AdminCreditMemoAddressInformationSection.billingAddress}}" userInput="{{billingAddress.street[0]}}" stepKey="seeBillingAddressStreet"/> + <see selector="{{AdminCreditMemoAddressInformationSection.billingAddress}}" userInput="{{billingAddress.city}}" stepKey="seeBillingAddressCity"/> + <see selector="{{AdminCreditMemoAddressInformationSection.billingAddress}}" userInput="{{billingAddress.country_id}}" stepKey="seeBillingAddressCountry"/> + <see selector="{{AdminCreditMemoAddressInformationSection.billingAddress}}" userInput="{{billingAddress.postcode}}" stepKey="seeBillingAddressPostcode"/> + + <see selector="{{AdminCreditMemoAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.street[0]}}" stepKey="seeShippingAddressStreet"/> + <see selector="{{AdminCreditMemoAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.city}}" stepKey="seeShippingAddressCity"/> + <see selector="{{AdminCreditMemoAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.country_id}}" stepKey="seeShippingAddressCountry"/> + <see selector="{{AdminCreditMemoAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.postcode}}" stepKey="seeShippingAddressPostcode"/> + </actionGroup> + + <actionGroup name="seeProductInItemsRefunded"> + <annotations> + <description>Validates that the provided Product appears in the 'Product' column on the Admin Credit Memo view page.</description> + </annotations> + <arguments> + <argument name="product"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SeeProductInItemsRefundedActionGroup` instead --> + <see selector="{{AdminCreditMemoItemsSection.skuColumn}}" userInput="{{product.sku}}" stepKey="seeProductSkuInGrid"/> + </actionGroup> + + <actionGroup name="verifyBasicInvoiceInformation"> + <annotations> + <description>Validates that the provided Customer, Address and Customer Group details are present and correct on the Admin View Invoice page.</description> + </annotations> + <arguments> + <argument name="customer"/> + <argument name="shippingAddress"/> + <argument name="billingAddress"/> + <argument name="customerGroup" defaultValue="GeneralCustomerGroup"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `VerifyBasicInvoiceInformationActionGroup` instead --> + <see selector="{{AdminInvoiceOrderInformationSection.customerName}}" userInput="{{customer.firstname}}" stepKey="seeCustomerName"/> + <see selector="{{AdminInvoiceOrderInformationSection.customerEmail}}" userInput="{{customer.email}}" stepKey="seeCustomerEmail"/> + <see selector="{{AdminInvoiceOrderInformationSection.customerGroup}}" userInput="{{customerGroup.code}}" stepKey="seeCustomerGroup"/> + <see selector="{{AdminInvoiceAddressInformationSection.billingAddress}}" userInput="{{billingAddress.street[0]}}" stepKey="seeBillingAddressStreet"/> + <see selector="{{AdminInvoiceAddressInformationSection.billingAddress}}" userInput="{{billingAddress.city}}" stepKey="seeBillingAddressCity"/> + <see selector="{{AdminInvoiceAddressInformationSection.billingAddress}}" userInput="{{billingAddress.country_id}}" stepKey="seeBillingAddressCountry"/> + <see selector="{{AdminInvoiceAddressInformationSection.billingAddress}}" userInput="{{billingAddress.postcode}}" stepKey="seeBillingAddressPostcode"/> + <see selector="{{AdminInvoiceAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.street[0]}}" stepKey="seeShippingAddressStreet"/> + <see selector="{{AdminInvoiceAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.city}}" stepKey="seeShippingAddressCity"/> + <see selector="{{AdminInvoiceAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.country_id}}" stepKey="seeShippingAddressCountry"/> + <see selector="{{AdminInvoiceAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.postcode}}" stepKey="seeShippingAddressPostcode"/> + </actionGroup> + + <actionGroup name="seeProductInInvoiceItems"> + <annotations> + <description>Validates that the provided Product appears under the 'SKU' column in the Admin Invoices edit page.</description> + </annotations> + <arguments> + <argument name="product"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SeeProductInInvoiceItemsActionGroup` instead --> + <see selector="{{AdminInvoiceItemsSection.skuColumn}}" userInput="{{product.sku}}" stepKey="seeProductSkuInGrid"/> + </actionGroup> + + <actionGroup name="adminFastCreateInvoice"> + <annotations> + <description>Clicks on 'Invoice' on the Admin Orders view page. Clicks on 'Submit Invoice'. Clicks on 'View Invoice'.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminFastCreateInvoiceActionGroup` instead --> + <click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoiceButton"/> + <waitForPageLoad stepKey="waitForNewInvoicePageLoad"/> + <click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/> + <see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="The invoice has been created." stepKey="seeSuccessMessage"/> + <click selector="{{AdminOrderDetailsOrderViewSection.invoices}}" stepKey="clickInvoices"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask5"/> + <conditionalClick selector="{{AdminOrderInvoicesTabSection.clearFilters}}" dependentSelector="{{AdminOrderInvoicesTabSection.clearFilters}}" visible="true" stepKey="clearExistingOrderFilters"/> + <click selector="{{AdminOrderInvoicesTabSection.viewInvoice}}" stepKey="openInvoicePage"/> + <waitForPageLoad stepKey="waitForInvoicePageLoad"/> + </actionGroup> + + <actionGroup name="clearInvoicesGridFilters"> + <annotations> + <description>Goes to the Admin Invoices grid page. Clicks on 'Clear Filters', if present.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `ClearInvoicesGridFiltersActionGroup` instead --> + <amOnPage url="{{AdminInvoicesPage.url}}" stepKey="goToInvoices"/> + <waitForPageLoad stepKey="waitInvoicesGridToLoad"/> + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearFilters"/> + <waitForPageLoad stepKey="waitInvoicesGrid"/> + </actionGroup> + + <actionGroup name="goToInvoiceIntoOrder"> + <annotations> + <description>Clicks on 'Invoice' on the Admin Orders view page. Validates that the URL and Page Title are correct.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `GoToInvoiceIntoOrderActionGroup` instead --> + <click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoiceAction"/> + <seeInCurrentUrl url="{{AdminInvoiceNewPage.url}}" stepKey="seeOrderInvoiceUrl"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Invoice" stepKey="seePageNameNewInvoicePage"/> + </actionGroup> + + <actionGroup name="StartCreateInvoiceFromOrderPage"> + <annotations> + <description>Clicks on 'Invoice' on the Admin Orders view page. Validates that the URL and Page Title are correct.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StartCreateInvoiceFromOrderPageActionGroup` instead --> + <click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoiceAction"/> + <seeInCurrentUrl url="{{AdminInvoiceNewPage.url}}" stepKey="seeNewInvoiceUrl"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Invoice" stepKey="seeNewInvoicePageTitle"/> + </actionGroup> + + <actionGroup name="SubmitInvoice"> + <annotations> + <description>Clicks on 'Submit Invoice' on the Admin 'New Invoice' page. Validates that the Success Message is present and correct. Validates that the Order ID appears in the URL.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SubmitInvoiceActionGroup` instead --> + <click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/> + <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForMessageAppears"/> + <see selector="{{AdminMessagesSection.success}}" userInput="The invoice has been created." stepKey="seeInvoiceCreateSuccess"/> + <grabFromCurrentUrl regex="~/order_id/(\d+)/~" stepKey="grabOrderId"/> + <seeInCurrentUrl url="{{AdminOrderDetailsPage.url('$grabOrderId')}}" stepKey="seeViewOrderPageInvoice"/> + </actionGroup> + + <actionGroup name="filterInvoiceGridByOrderId"> + <annotations> + <description>Goes to the Admin Invoices grid page. Filters the grid for the provided Order ID.</description> + </annotations> + <arguments> + <argument name="orderId" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `FilterInvoiceGridByOrderIdActionGroup` instead --> + <amOnPage url="{{AdminInvoicesPage.url}}" stepKey="goToInvoices"/> + <click selector="{{AdminInvoicesGridSection.filter}}" stepKey="clickFilter"/> + <fillField selector="{{AdminInvoicesFiltersSection.orderNum}}" userInput="{{orderId}}" stepKey="fillOrderIdForFilter"/> + <click selector="{{AdminInvoicesFiltersSection.applyFilters}}" stepKey="clickApplyFilters"/> + <waitForPageLoad stepKey="waitForFiltersApply"/> + </actionGroup> + + <actionGroup name="navigateToNewOrderPageNewCustomer"> + <annotations> + <description>Goes to the Admin Orders grid page. Clicks on 'Create New Order'. Clicks on 'Create New Customer'. Select the provided Store View, if present. Validates that Page Title is present and correct.</description> + </annotations> + <arguments> + <argument name="storeView" defaultValue="_defaultStore"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `NavigateToNewOrderPageNewCustomerActionGroup` instead --> + <amOnPage url="{{AdminOrdersPage.url}}" stepKey="navigateToOrderIndexPage"/> + <waitForPageLoad stepKey="waitForIndexPageLoad"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Orders" stepKey="seeIndexPageTitle"/> + <click selector="{{AdminOrdersGridSection.createNewOrder}}" stepKey="clickCreateNewOrder"/> + <click selector="{{AdminOrderFormActionSection.CreateNewCustomer}}" stepKey="clickCreateCustomer"/> + <conditionalClick selector="{{AdminOrderStoreScopeTreeSection.storeOption(storeView.name)}}" dependentSelector="{{AdminOrderStoreScopeTreeSection.storeOption(storeView.name)}}" visible="true" stepKey="selectStoreViewIfAppears"/> + <waitForPageLoad stepKey="waitForCreateOrderPageLoadAfterStoreSelect"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Create New Order" stepKey="seeNewOrderPageTitle"/> + </actionGroup> + + <actionGroup name="navigateToNewOrderPageNewCustomerSingleStore"> + <annotations> + <description>Goes to the Admin Orders grid page. Clicks on 'Create New Order'. Clicks on 'Create New Customer'. Validates that Page Title is present and correct.</description> + </annotations> + <arguments> + <argument name="storeView" defaultValue="_defaultStore"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `NavigateToNewOrderPageNewCustomerSingleStoreActionGroup` instead --> + <amOnPage url="{{AdminOrdersPage.url}}" stepKey="navigateToOrderIndexPage"/> + <waitForPageLoad stepKey="waitForIndexPageLoad"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Orders" stepKey="seeIndexPageTitle"/> + <click selector="{{AdminOrdersGridSection.createNewOrder}}" stepKey="clickCreateNewOrder"/> + <click selector="{{AdminOrderFormActionSection.CreateNewCustomer}}" stepKey="clickCreateCustomer"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Create New Order" stepKey="seeNewOrderPageTitle"/> + </actionGroup> + + <actionGroup name="navigateToNewOrderPageExistingCustomer"> + <annotations> + <description>Goes tot he Admin Orders grid page. Clicks on 'Create New Order'. Filters the grid for the provided Customer. Clicks on the Customer. Selects the provided Store View, if present. Validates that the Page Title is present and correct.</description> + </annotations> + <arguments> + <argument name="customer"/> + <argument name="storeView" defaultValue="_defaultStore"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `NavigateToNewOrderPageExistingCustomerActionGroup` instead --> + <amOnPage url="{{AdminOrdersPage.url}}" stepKey="navigateToOrderIndexPage"/> + <waitForPageLoad stepKey="waitForIndexPageLoad"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Orders" stepKey="seeIndexPageTitle"/> + <click selector="{{AdminOrdersGridSection.createNewOrder}}" stepKey="clickCreateNewOrder"/> + <waitForPageLoad stepKey="waitForCustomerGridLoad"/> + + <conditionalClick selector="{{AdminOrderCustomersGridSection.resetButton}}" dependentSelector="{{AdminOrderCustomersGridSection.resetButton}}" visible="true" stepKey="clearExistingCustomerFilters"/> + <fillField userInput="{{customer.email}}" selector="{{AdminOrderCustomersGridSection.emailInput}}" stepKey="filterEmail"/> + <click selector="{{AdminOrderCustomersGridSection.apply}}" stepKey="applyFilter"/> + <waitForPageLoad stepKey="waitForFilteredCustomerGridLoad"/> + <click selector="{{AdminOrderCustomersGridSection.firstRow}}" stepKey="clickOnCustomer"/> + <waitForPageLoad stepKey="waitForCreateOrderPageLoad"/> + + <conditionalClick selector="{{AdminOrderStoreScopeTreeSection.storeOption(storeView.name)}}" dependentSelector="{{AdminOrderStoreScopeTreeSection.storeOption(storeView.name)}}" visible="true" stepKey="selectStoreViewIfAppears"/> + <waitForPageLoad stepKey="waitForCreateOrderPageLoadAfterStoreSelect"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Create New Order" stepKey="seeNewOrderPageTitle"/> + </actionGroup> + + <actionGroup name="checkRequiredFieldsNewOrderForm"> + <annotations> + <description>Clears the Email, First Name, Last Name, Street Line 1, City, Postal Code and Phone fields when adding an Order and then verifies that they are required after attempting to Save.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CheckRequiredFieldsNewOrderFormActionGroup` instead --> + <seeElement selector="{{AdminOrderFormAccountSection.requiredGroup}}" stepKey="seeCustomerGroupRequired"/> + <seeElement selector="{{AdminOrderFormAccountSection.requiredEmail}}" stepKey="seeEmailRequired"/> + <clearField selector="{{AdminOrderFormAccountSection.email}}" stepKey="clearEmailField"/> + <clearField selector="{{AdminOrderFormBillingAddressSection.FirstName}}" stepKey="clearFirstNameField"/> + <clearField selector="{{AdminOrderFormBillingAddressSection.LastName}}" stepKey="clearLastNameField"/> + <clearField selector="{{AdminOrderFormBillingAddressSection.StreetLine1}}" stepKey="clearStreetField"/> + <clearField selector="{{AdminOrderFormBillingAddressSection.City}}" stepKey="clearCityField"/> + <selectOption selector="{{AdminOrderFormBillingAddressSection.Country}}" userInput="United States" stepKey="selectUSCountry"/> + <selectOption selector="{{AdminOrderFormBillingAddressSection.State}}" userInput="Please select" stepKey="selectNoState"/> + <clearField selector="{{AdminOrderFormBillingAddressSection.PostalCode}}" stepKey="clearPostalCodeField"/> + <clearField selector="{{AdminOrderFormBillingAddressSection.Phone}}" stepKey="clearPhoneField"/> + <seeElement selector="{{AdminOrderFormPaymentSection.getShippingMethods}}" stepKey="seeShippingMethodNotSelected"/> + <click selector="{{AdminOrderFormActionSection.SubmitOrder}}" stepKey="trySubmitOrder"/> + <see selector="{{AdminOrderFormBillingAddressSection.emailError}}" userInput="This is a required field." stepKey="seeThatEmailIsRequired"/> + <see selector="{{AdminOrderFormBillingAddressSection.firstNameError}}" userInput="This is a required field." stepKey="seeFirstNameRequired"/> + <see selector="{{AdminOrderFormBillingAddressSection.lastNameError}}" userInput="This is a required field." stepKey="seeLastNameRequired"/> + <see selector="{{AdminOrderFormBillingAddressSection.streetAddressError}}" userInput="This is a required field." stepKey="seeStreetRequired"/> + <see selector="{{AdminOrderFormBillingAddressSection.cityError}}" userInput="This is a required field." stepKey="seeCityRequired"/> + <see selector="{{AdminOrderFormBillingAddressSection.stateError}}" userInput="This is a required field." stepKey="seeStateRequired"/> + <see selector="{{AdminOrderFormBillingAddressSection.postalCodeError}}" userInput="This is a required field." stepKey="seePostalCodeRequired"/> + <see selector="{{AdminOrderFormBillingAddressSection.phoneError}}" userInput="This is a required field." stepKey="seePhoneRequired"/> + <see selector="{{AdminOrderFormPaymentSection.shippingError}}" userInput="This is a required field." stepKey="seeShippingMethodRequired"/> + </actionGroup> + + <actionGroup name="addSimpleProductToOrder"> + <annotations> + <description>Adds the provided Simple Product to an Order. Fills in the provided Product Qty. Clicks on 'Add Selected Product(s) to Order'.</description> + </annotations> + <arguments> + <argument name="product" defaultValue="_defaultProduct" type="entity"/> + <argument name="productQty" defaultValue="1" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddSimpleProductToOrderActionGroup` instead --> + <click selector="{{AdminOrderFormItemsSection.addProducts}}" stepKey="clickAddProducts"/> + <fillField selector="{{AdminOrderFormItemsSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillSkuFilter"/> + <click selector="{{AdminOrderFormItemsSection.search}}" stepKey="clickSearch"/> + <scrollTo selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" x="0" y="-100" stepKey="scrollToCheckColumn"/> + <checkOption selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" stepKey="selectProduct"/> + <fillField selector="{{AdminOrderFormItemsSection.rowQty('1')}}" userInput="{{productQty}}" stepKey="fillProductQty"/> + <scrollTo selector="{{AdminOrderFormItemsSection.addSelected}}" x="0" y="-100" stepKey="scrollToAddSelectedButton"/> + <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickAddSelectedProducts"/> + <wait time="5" stepKey="waitForOptionsToLoad"/> + </actionGroup> + + <actionGroup name="addConfigurableProductToOrder"> + <annotations> + <description>Adds the provided Configurable Product with the provided Option to an Order. Fills in the provided Product Qty. Clicks on 'Add Selected Product(s) to Order'.</description> + </annotations> + <arguments> + <argument name="product"/> + <argument name="attribute"/> + <argument name="option"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddConfigurableProductToOrderActionGroup` instead --> + <click selector="{{AdminOrderFormItemsSection.addProducts}}" stepKey="clickAddProducts"/> + <fillField selector="{{AdminOrderFormItemsSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillSkuFilterConfigurable"/> + <click selector="{{AdminOrderFormItemsSection.search}}" stepKey="clickSearchConfigurable"/> + <scrollTo selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" x="0" y="-100" stepKey="scrollToCheckColumn"/> + <checkOption selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" stepKey="selectConfigurableProduct"/> + <waitForElementVisible selector="{{AdminOrderFormConfigureProductSection.optionSelect(attribute.default_label)}}" stepKey="waitForConfigurablePopover"/> + <wait time="2" stepKey="waitForOptionsToLoad"/> + <selectOption selector="{{AdminOrderFormConfigureProductSection.optionSelect(attribute.default_label)}}" userInput="{{option.name}}" stepKey="selectionConfigurableOption"/> + <click selector="{{AdminOrderFormConfigureProductSection.ok}}" stepKey="clickOkConfigurablePopover"/> + <scrollTo selector="{{AdminOrderFormItemsSection.addSelected}}" x="0" y="-100" stepKey="scrollToAddSelectedButton"/> + <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickAddSelectedProducts"/> + </actionGroup> + + <actionGroup name="newAddConfigurableProductToOrder" extends="addConfigurableProductToOrder"> + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `NewAddConfigurableProductToOrderActionGroup` instead --> + <remove keyForRemoval="waitForConfigurablePopover"/> + <remove keyForRemoval="selectionConfigurableOption"/> + <selectOption selector="{{AdminOrderFormConfigureProductSection.selectOption}}" userInput="{{option.value}}" stepKey="selectOption" after="waitForOptionsToLoad"/> + </actionGroup> + + <actionGroup name="addConfigurableProductToOrderFromAdmin" extends="addConfigurableProductToOrder"> + <annotations> + <description>EXTENDS: addConfigurableProductToOrder. Selects the provided Option to the Configurable Product.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddConfigurableProductToOrderFromAdminActionGroup` instead --> + <waitForElementVisible selector="{{AdminOrderFormConfigureProductSection.optionSelect(attribute.default_frontend_label)}}" stepKey="waitForConfigurablePopover"/> + <selectOption selector="{{AdminOrderFormConfigureProductSection.optionSelect(attribute.default_frontend_label)}}" userInput="{{option.label}}" stepKey="selectionConfigurableOption"/> + </actionGroup> + + <actionGroup name="configureOrderedConfigurableProduct"> + <annotations> + <description>Clicks on 'Configure' for a Product in the 'Please select products' under the 'Create New Order for' page. Selects the provided Option and Attribute. Fills in the provided Qty. Clicks on Ok.</description> + </annotations> + <arguments> + <argument name="attribute"/> + <argument name="option"/> + <argument name="quantity" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `ConfigureOrderedConfigurableProductActionGroup` instead --> + <click selector="{{AdminOrderFormItemsSection.configure}}" stepKey="clickConfigure"/> + <waitForElementVisible selector="{{AdminOrderFormConfigureProductSection.optionSelect(attribute.default_frontend_label)}}" stepKey="waitForConfigurablePopover"/> + <wait time="2" stepKey="waitForOptionsToLoad"/> + <selectOption selector="{{AdminOrderFormConfigureProductSection.optionSelect(attribute.default_frontend_label)}}" userInput="{{option.label}}" stepKey="selectionConfigurableOption"/> + <fillField selector="{{AdminOrderFormConfigureProductSection.quantity}}" userInput="{{quantity}}" stepKey="fillQuantity"/> + <click selector="{{AdminOrderFormConfigureProductSection.ok}}" stepKey="clickOkConfigurablePopover"/> + </actionGroup> + + <actionGroup name="addBundleProductToOrder"> + <annotations> + <description>Adds the provided Bundled Product with the provided Option to an Order. Fills in the provided Product Qty. Clicks on 'Add Selected Product(s) to Order'.</description> + </annotations> + <arguments> + <argument name="product"/> + <argument name="quantity" type="string" defaultValue="1"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddBundleProductToOrderActionGroup` instead --> + <click selector="{{AdminOrderFormItemsSection.addProducts}}" stepKey="clickAddProducts"/> + <fillField selector="{{AdminOrderFormItemsSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillSkuFilterBundle"/> + <click selector="{{AdminOrderFormItemsSection.search}}" stepKey="clickSearchBundle"/> + <scrollTo selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" x="0" y="-100" stepKey="scrollToCheckColumn"/> + <checkOption selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" stepKey="selectBundleProduct"/> + <waitForElementVisible selector="{{AdminOrderFormBundleProductSection.quantity}}" stepKey="waitForBundleOptionLoad"/> + <wait time="2" stepKey="waitForOptionsToLoad"/> + <fillField selector="{{AdminOrderFormBundleProductSection.quantity}}" userInput="{{quantity}}" stepKey="fillQuantity"/> + <click selector="{{AdminOrderFormConfigureProductSection.ok}}" stepKey="clickOk"/> + <scrollTo selector="{{AdminOrderFormItemsSection.addSelected}}" x="0" y="-100" stepKey="scrollToAddSelectedButton"/> + <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickAddSelectedProducts"/> + </actionGroup> + + <actionGroup name="addBundleProductToOrderAndCheckPriceInGrid" extends="addBundleProductToOrder"> + <annotations> + <description>EXTENDS: addBundleProductToOrder. Validates that the provided Product Price is present and correct in the 'Items Ordered' section.</description> + </annotations> + <arguments> + <argument name="price" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddBundleProductToOrderAndCheckPriceInGridActionGroup` instead --> + <grabTextFrom selector="{{AdminOrderFormItemsSection.rowPrice('1')}}" stepKey="grabProductPriceFromGrid" after="clickOk"/> + <assertEquals stepKey="assertProductPriceInGrid" message="Bundle product price in grid should be equal {{price}}" after="grabProductPriceFromGrid"> + <expectedResult type="string">{{price}}</expectedResult> + <actualResult type="variable">grabProductPriceFromGrid</actualResult> + </assertEquals> + </actionGroup> + + <actionGroup name="addDownloadableProductToOrder"> + <annotations> + <description>Adds a Downloadable Product to an Order. Clicks on 'Add Selected Product(s) to Order'.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddDownloadableProductToOrderActionGroup` instead --> + <click selector="{{AdminOrderFormItemsSection.addProducts}}" stepKey="clickAddProducts"/> + <waitForPageLoad time="30" stepKey="waitForPageLoad1"/> + <fillField selector="{{AdminOrderFormItemsSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillSkuFilterDownloadable"/> + <click selector="{{AdminOrderFormItemsSection.search}}" stepKey="clickSearchDownloadable"/> + <scrollTo selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" x="0" y="-100" stepKey="scrollToCheckColumn"/> + <checkOption selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" stepKey="selectDownloadableProduct"/> + <waitForElementVisible selector="{{AdminOrderFormDownloadableProductSection.optionSelect(link.title)}}" stepKey="waitForLinkLoad"/> + <click selector="{{AdminOrderFormDownloadableProductSection.optionSelect(link.title)}}" stepKey="selectLink"/> + <fillField selector="{{AdminOrderFormDownloadableProductSection.quantity}}" userInput="{{quantity}}" stepKey="setQuantity"/> + <click selector="{{AdminOrderFormDownloadableProductSection.ok}}" stepKey="confirmConfiguration"/> + <scrollTo selector="{{AdminOrderFormItemsSection.addSelected}}" x="0" y="-100" stepKey="scrollToAddSelectedButton"/> + <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickAddSelectedProducts"/> + </actionGroup> + + <actionGroup name="addGroupedProductOptionToOrder"> + <annotations> + <description>Adds the provided Grouped Product with the provided Option to an Order. Fills in the provided Product Qty. Clicks on 'Add Selected Product(s) to Order'.</description> + </annotations> + <arguments> + <argument name="product"/> + <argument name="option"/> + <argument name="quantity" type="string" defaultValue="1"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddGroupedProductOptionToOrderActionGroup` instead --> + <click selector="{{AdminOrderFormItemsSection.addProducts}}" stepKey="clickAddProducts"/> + <fillField selector="{{AdminOrderFormItemsSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillSkuFilterGrouped"/> + <click selector="{{AdminOrderFormItemsSection.search}}" stepKey="clickSearchGrouped"/> + <scrollTo selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" x="0" y="-100" stepKey="scrollToCheckColumn"/> + <checkOption selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" stepKey="selectGroupedProduct"/> + <waitForElementVisible selector="{{AdminOrderFormGroupedProductSection.optionQty(option.sku)}}" stepKey="waitForGroupedOptionLoad"/> + <wait time="2" stepKey="waitForOptionsToLoad"/> + <fillField selector="{{AdminOrderFormGroupedProductSection.optionQty(option.sku)}}" userInput="{{quantity}}" stepKey="fillOptionQuantity"/> + <click selector="{{AdminOrderFormConfigureProductSection.ok}}" stepKey="clickOk"/> + <scrollTo selector="{{AdminOrderFormItemsSection.addSelected}}" x="0" y="-100" stepKey="scrollToAddSelectedButton"/> + <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickAddSelectedProducts"/> + </actionGroup> + + <actionGroup name="fillOrderCustomerInformation"> + <annotations> + <description>Fills in the provided Customer and Address details on the Admin 'Create New Order for' page.</description> + </annotations> + <arguments> + <argument name="customer"/> + <argument name="address"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `FillOrderCustomerInformationActionGroup` instead --> + <fillField selector="{{AdminOrderFormBillingAddressSection.FirstName}}" userInput="{{customer.firstname}}" stepKey="fillFirstName"/> + <fillField selector="{{AdminOrderFormBillingAddressSection.LastName}}" userInput="{{customer.lastname}}" stepKey="fillLastName"/> + <fillField selector="{{AdminOrderFormBillingAddressSection.StreetLine1}}" userInput="{{address.street[0]}}" stepKey="fillStreetLine1"/> + <fillField selector="{{AdminOrderFormBillingAddressSection.City}}" userInput="{{address.city}}" stepKey="fillCity"/> + <selectOption selector="{{AdminOrderFormBillingAddressSection.Country}}" userInput="{{address.country_id}}" stepKey="fillCountry"/> + <selectOption selector="{{AdminOrderFormBillingAddressSection.State}}" userInput="{{address.state}}" stepKey="fillState"/> + <fillField selector="{{AdminOrderFormBillingAddressSection.PostalCode}}" userInput="{{address.postcode}}" stepKey="fillPostalCode"/> + <fillField selector="{{AdminOrderFormBillingAddressSection.Phone}}" userInput="{{address.telephone}}" stepKey="fillPhone"/> + </actionGroup> + + <actionGroup name="orderSelectFlatRateShipping"> + <annotations> + <description>Selects the 'Flat Rate' Shipping Method on the Admin 'Create New Order for' page.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `OrderSelectFlatRateShippingActionGroup` instead --> + <click selector="{{AdminOrderFormPaymentSection.header}}" stepKey="unfocus"/> + <waitForPageLoad stepKey="waitForJavascriptToFinish"/> + <click selector="{{AdminOrderFormPaymentSection.getShippingMethods}}" stepKey="clickShippingMethods"/> + <waitForElementVisible selector="{{AdminOrderFormPaymentSection.flatRateOption}}" stepKey="waitForShippingOptions"/> + <selectOption selector="{{AdminOrderFormPaymentSection.flatRateOption}}" userInput="flatrate_flatrate" stepKey="checkFlatRate"/> + </actionGroup> + + <actionGroup name="changeShippingMethod"> + <annotations> + <description>Change Shipping Method on the Admin 'Create New Order for' page.</description> + </annotations> + <arguments> + <argument name="shippingMethod" defaultValue="flatrate_flatrate" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `ChangeShippingMethodActionGroup` instead --> + <click selector="{{AdminOrderFormPaymentSection.header}}" stepKey="unfocus"/> + <waitForPageLoad stepKey="waitForJavascriptToFinish"/> + <click selector="{{AdminOrderFormPaymentSection.getShippingMethods}}" stepKey="clickShippingMethods1"/> + <waitForElementVisible selector="{{AdminOrderFormPaymentSection.getShippingMethods}}" stepKey="waitForChangeShippingMethod"/> + <click selector="{{AdminOrderFormPaymentSection.getShippingMethods}}" stepKey="clickShippingMethods2"/> + <waitForElementVisible selector="{{AdminOrderFormPaymentSection.shippingMethod}}" stepKey="waitForShippingOptions2"/> + <selectOption selector="{{AdminOrderFormPaymentSection.shippingMethod}}" userInput="{{shippingMethod}}" stepKey="checkFlatRate"/> + </actionGroup> + + <actionGroup name="orderSelectFreeShipping"> + <annotations> + <description>Selects the 'Free Shipping' Shipping Method on the Admin 'Create New Order for' page.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `OrderSelectFreeShippingActionGroup` instead --> + <click selector="{{AdminOrderFormPaymentSection.header}}" stepKey="unfocus"/> + <waitForPageLoad stepKey="waitForJavascriptToFinish"/> + <click selector="{{AdminOrderFormPaymentSection.getShippingMethods}}" stepKey="clickShippingMethods"/> + <waitForElementVisible selector="{{AdminOrderFormPaymentSection.freeShippingOption}}" stepKey="waitForShippingOptions"/> + <selectOption selector="{{AdminOrderFormPaymentSection.freeShippingOption}}" userInput="freeshipping_freeshipping" stepKey="checkFreeShipping"/> + </actionGroup> + + <actionGroup name="verifyBasicOrderInformation"> + <annotations> + <description>Validates that the provided Customer, Shipping/Billing Address and Customer Group are present and correct on the Admin Orders view page.</description> + </annotations> + <arguments> + <argument name="customer"/> + <argument name="shippingAddress"/> + <argument name="billingAddress"/> + <argument name="customerGroup" defaultValue="GeneralCustomerGroup"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `VerifyBasicOrderInformationActionGroup` instead --> + <see selector="{{AdminOrderDetailsInformationSection.customerName}}" userInput="{{customer.firstname}}" stepKey="seeCustomerName"/> + <see selector="{{AdminOrderDetailsInformationSection.customerEmail}}" userInput="{{customer.email}}" stepKey="seeCustomerEmail"/> + <see selector="{{AdminOrderDetailsInformationSection.customerGroup}}" userInput="{{customerGroup.code}}" stepKey="seeCustomerGroup"/> + <see selector="{{AdminOrderAddressInformationSection.billingAddress}}" userInput="{{billingAddress.street[0]}}" stepKey="seeBillingAddressStreet"/> + <see selector="{{AdminOrderAddressInformationSection.billingAddress}}" userInput="{{billingAddress.city}}" stepKey="seeBillingAddressCity"/> + <see selector="{{AdminOrderAddressInformationSection.billingAddress}}" userInput="{{billingAddress.country_id}}" stepKey="seeBillingAddressCountry"/> + <see selector="{{AdminOrderAddressInformationSection.billingAddress}}" userInput="{{billingAddress.postcode}}" stepKey="seeBillingAddressPostcode"/> + <see selector="{{AdminOrderAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.street[0]}}" stepKey="seeShippingAddressStreet"/> + <see selector="{{AdminOrderAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.city}}" stepKey="seeShippingAddressCity"/> + <see selector="{{AdminOrderAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.country_id}}" stepKey="seeShippingAddressCountry"/> + <see selector="{{AdminOrderAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.postcode}}" stepKey="seeShippingAddressPostcode"/> + </actionGroup> + + <actionGroup name="verifyCreatedOrderInformation"> + <annotations> + <description>Validates that the Success Message, Order Status (Pending) and Order ID are present and correct.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `VerifyCreatedOrderInformationActionGroup` instead --> + <see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="You created the order." stepKey="seeSuccessMessage"/> + <see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="Pending" stepKey="seeOrderPendingStatus" after="seeSuccessMessage"/> + <grabTextFrom selector="|Order # (\d+)|" stepKey="getOrderId" after="seeOrderPendingStatus"/> + <assertNotEmpty actual="$getOrderId" stepKey="assertOrderIdIsNotEmpty" after="getOrderId"/> + </actionGroup> + + <actionGroup name="seeProductInItemsOrdered"> + <annotations> + <description>Validates that the provided Product is present and correct in the 'Items Ordered' section on the Admin Orders view page.</description> + </annotations> + <arguments> + <argument name="product"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SeeProductInItemsOrderedActionGroup` instead --> + <see selector="{{AdminOrderItemsOrderedSection.productSkuColumn}}" userInput="{{product.sku}}" stepKey="seeSkuInItemsOrdered"/> + </actionGroup> + + <actionGroup name="cancelPendingOrder"> + <annotations> + <description>Cancels the Pending Order on the Admin Orders view page. Validates that the provided Order Status is present and correct.</description> + </annotations> + <arguments> + <argument name="orderStatus" type="string" defaultValue="Canceled"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CancelPendingOrderActionGroup` instead --> + <click selector="{{AdminOrderDetailsMainActionsSection.cancel}}" stepKey="clickCancelOrder"/> + <waitForElement selector="{{AdminConfirmationModalSection.message}}" stepKey="waitForCancelConfirmation"/> + <see selector="{{AdminConfirmationModalSection.message}}" userInput="Are you sure you want to cancel this order?" stepKey="seeConfirmationMessage"/> + <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmOrderCancel"/> + <see selector="{{AdminMessagesSection.success}}" userInput="You canceled the order." stepKey="seeCancelSuccessMessage"/> + <see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="{{orderStatus}}" stepKey="seeOrderStatusCanceled"/> + </actionGroup> + + <actionGroup name="dontSeeProductInItemsOrdered"> + <arguments> + <argument name="product"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `DontSeeProductInItemsOrderedActionGroup` instead --> + <dontSee selector="{{AdminOrderItemsOrderedSection.productSkuColumn}}" userInput="{{product.sku}}" stepKey="dontseeSkuInItemsOrdered"/> + </actionGroup> + + <actionGroup name="SelectCheckMoneyPaymentMethod"> + <annotations> + <description>Selects the 'Check / Money Order' Payment Method on the Admin Create New Order page.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SelectCheckMoneyPaymentMethodActionGroup` instead --> + <waitForElementVisible selector="{{AdminOrderFormPaymentSection.paymentBlock}}" stepKey="waitForPaymentOptions"/> + <conditionalClick selector="{{AdminOrderFormPaymentSection.checkMoneyOption}}" dependentSelector="{{AdminOrderFormPaymentSection.checkMoneyOption}}" visible="true" stepKey="checkCheckMoneyOption"/> + </actionGroup> + + <actionGroup name="filterOrderGridById"> + <annotations> + <description>Goes to the Admin Orders page. Filters the grid based on the provided Order ID.</description> + </annotations> + <arguments> + <argument name="orderId" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `FilterOrderGridByIdActionGroup` instead --> + <amOnPage url="{{AdminOrdersPage.url}}" stepKey="navigateToOrderGridPage"/> + <waitForPageLoad stepKey="waitForOrdersPage"/> + <conditionalClick selector="{{AdminOrdersGridSection.clearFilters}}" dependentSelector="{{AdminOrdersGridSection.clearFilters}}" visible="true" stepKey="clearExistingOrderFilters"/> + <waitForPageLoad stepKey="waitForClearFilters"/> + <click selector="{{AdminOrdersGridSection.filters}}" stepKey="openOrderGridFilters"/> + <waitForPageLoad stepKey="waitForClickFilters"/> + <fillField selector="{{AdminOrdersGridSection.idFilter}}" userInput="{{orderId}}" stepKey="fillOrderIdFilter"/> + <click selector="{{AdminOrdersGridSection.applyFilters}}" stepKey="clickOrderApplyFilters"/> + <waitForPageLoad stepKey="waitForApplyFilters"/> + </actionGroup> + + <actionGroup name="filterOrderGridByBillingName"> + <annotations> + <description>Goes to the Admin Orders page. Filters the grid based on the provided Customer.</description> + </annotations> + <arguments> + <argument name="customer"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `FilterOrderGridByBillingNameActionGroup` instead --> + <amOnPage url="{{AdminOrdersPage.url}}" stepKey="navigateToOrderGridPage"/> + <waitForPageLoad stepKey="waitForOrderGridLoad"/> + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingOrderFilters"/> + <click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openOrderGridFilters"/> + <fillField selector="{{AdminDataGridHeaderSection.filterFieldInput('billing_name')}}" userInput="{{customer.fullname}}" stepKey="fillBillToNameFilter"/> + <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickOrderApplyFilters"/> + </actionGroup> + + <actionGroup name="filterOrderGridByBaseTotalRange"> + <annotations> + <description>Goes to the Admin Orders page. Filters the grid based on the provided Grand Total From/To values.</description> + </annotations> + <arguments> + <argument name="from"/> + <argument name="to"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `FilterOrderGridByBaseTotalRangeActionGroup` instead --> + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingOrderFilters"/> + <click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openOrderGridFilters"/> + <fillField selector="{{AdminDataGridHeaderSection.filterFieldInput('base_grand_total[from]')}}" userInput="{{from}}" stepKey="fillOrderTotalFrom"/> + <fillField selector="{{AdminDataGridHeaderSection.filterFieldInput('base_grand_total[to]')}}" userInput="{{to}}" stepKey="fillOrderTotalTo"/> + <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickApplyFilters"/> + </actionGroup> + + <actionGroup name="filterOrderGridByPurchaseDate"> + <annotations> + <description>Goes to the Admin Orders page. Filters the grid based on the provided Purchased Date From/To values.</description> + </annotations> + <arguments> + <argument name="from"/> + <argument name="to"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `FilterOrderGridByPurchaseDateActionGroup` instead --> + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingOrderFilters"/> + <click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openOrderGridFilters"/> + <fillField selector="{{AdminDataGridHeaderSection.filterFieldInput('created_at[from]')}}" userInput="{{from}}" stepKey="fillOrderPurchaseDateFrom"/> + <fillField selector="{{AdminDataGridHeaderSection.filterFieldInput('created_at[to]')}}" userInput="{{to}}" stepKey="fillOrderPurchaseDateTo"/> + <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickApplyFilters"/> + </actionGroup> + + <actionGroup name="filterOrderGridByStatus"> + <annotations> + <description>Filters the Admin Orders grid based on the provided Order Status.</description> + </annotations> + <arguments> + <argument name="status"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `FilterOrderGridByStatusActionGroup` instead --> + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingOrderFilters"/> + <click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openOrderGridFilters"/> + <selectOption selector="{{AdminDataGridHeaderSection.filterFieldSelect('status')}}" userInput="{{status}}" stepKey="fillOrderStatusFilter"/> + <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickApplyFilters"/> + </actionGroup> + + <actionGroup name="OpenOrderById" extends="filterOrderGridById"> + <annotations> + <description>EXTENDS: filterOrderGridById. Clicks on the 1st row of the Admin Orders grid.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `OpenOrderByIdActionGroup` instead --> + <click selector="{{AdminDataGridTableSection.firstRow}}" after="clickOrderApplyFilters" stepKey="openOrderViewPage"/> + <waitForPageLoad after="openOrderViewPage" stepKey="waitForOrderViewPageOpened"/> + </actionGroup> +</actionGroups> From 80f734bdf7cd0048780e5a83e8532081418f5472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Wed, 4 Dec 2019 23:35:54 +0100 Subject: [PATCH 0225/1143] BACKWARD COMPATIBILITY: Deprecated ActionGroups to make change Backward Compatible. --- .../ActionGroup/_Deprecated_ActionGroup.xml | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml diff --git a/app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml new file mode 100644 index 0000000000000..e9b6ec37f8f0a --- /dev/null +++ b/app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml @@ -0,0 +1,105 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<!-- +NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. + Please find the Comment with proper replacement for each of ActionGroups provided. +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="addProductVideo"> + <annotations> + <description>Expands the 'Images And Videos' section on the Admin Product creation/edit page. Adds the provided Video to the Product. Clicks on Save.</description> + </annotations> + <arguments> + <argument name="video" defaultValue="mftfTestProductVideo"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddProductVideoActionGroup` instead --> + <scrollTo selector="{{AdminProductImagesSection.productImagesToggle}}" x="0" y="-100" stepKey="scrollToArea"/> + <conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductVideoSection"/> + <waitForElementVisible selector="{{AdminProductImagesSection.addVideoButton}}" stepKey="waitForAddVideoButtonVisible" time="30"/> + <click selector="{{AdminProductImagesSection.addVideoButton}}" stepKey="addVideo"/> + <waitForElementVisible selector=".modal-slide.mage-new-video-dialog.form-inline._show" stepKey="waitForUrlElementVisibleslide" time="30"/> + <waitForElementVisible selector="{{AdminProductNewVideoSection.videoUrlTextField}}" stepKey="waitForUrlElementVisible" time="60"/> + <fillField selector="{{AdminProductNewVideoSection.videoUrlTextField}}" userInput="{{video.videoUrl}}" stepKey="fillFieldVideoUrl"/> + <fillField selector="{{AdminProductNewVideoSection.videoTitleTextField}}" userInput="{{video.videoTitle}}" stepKey="fillFieldVideoTitle"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <waitForElementNotVisible selector="{{AdminProductNewVideoSection.saveButtonDisabled}}" stepKey="waitForSaveButtonVisible" time="30"/> + <click selector="{{AdminProductNewVideoSection.saveButton}}" stepKey="saveVideo"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear"/> + </actionGroup> + + <actionGroup name="removeProductVideo"> + <annotations> + <description>Expands the 'Images And Videos' section on the Admin Product creation/edit page. Clicks on the Remove Video button.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `RemoveProductVideoActionGroup` instead --> + <scrollTo selector="{{AdminProductImagesSection.productImagesToggle}}" x="0" y="-100" stepKey="scrollToArea"/> + <conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductVideoSection"/> + <waitForElementVisible selector="{{AdminProductImagesSection.addVideoButton}}" stepKey="waitForAddVideoButtonVisible" time="30"/> + <click selector="{{AdminProductImagesSection.removeVideoButton}}" stepKey="removeVideo"/> + </actionGroup> + + <actionGroup name="assertProductVideoAdminProductPage"> + <annotations> + <description>Validates that the provided Video is present on the Admin Product creation/edit page.</description> + </annotations> + <arguments> + <argument name="video" defaultValue="mftfTestProductVideo"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertProductVideoAdminProductPageActionGroup` instead --> + <scrollTo selector="{{AdminProductImagesSection.productImagesToggle}}" x="0" y="-100" stepKey="scrollToArea"/> + <conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductVideoSection"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <seeElement selector="{{AdminProductImagesSection.videoTitleText(video.videoShortTitle)}}" stepKey="seeVideoTitle"/> + <seeElementInDOM selector="{{AdminProductImagesSection.videoUrlHiddenField(video.videoUrl)}}" stepKey="seeVideoItem"/> + </actionGroup> + + <actionGroup name="assertProductVideoNotInAdminProductPage"> + <annotations> + <description>Validates that the provided Video is NOT present on the Admin Product creation/edit page.</description> + </annotations> + <arguments> + <argument name="video" defaultValue="mftfTestProductVideo"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertProductVideoNotInAdminProductPageActionGroup` instead --> + <scrollTo selector="{{AdminProductImagesSection.productImagesToggle}}" x="0" y="-100" stepKey="scrollToArea"/> + <conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductVideoSection"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <dontSeeElement selector="{{AdminProductImagesSection.videoTitleText(video.videoShortTitle)}}" stepKey="seeVideoTitle"/> + <dontSeeElementInDOM selector="{{AdminProductImagesSection.videoUrlHiddenField(video.videoUrl)}}" stepKey="seeVideoItem"/> + </actionGroup> + + <actionGroup name="assertProductVideoStorefrontProductPage"> + <annotations> + <description>Validates that the provided Video is present on the Storefront Product page.</description> + </annotations> + <arguments> + <argument name="dataTypeAttribute" defaultValue="'youtube'"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertProductVideoStorefrontProductPageActionGroup` instead --> + <seeElement selector="{{StorefrontProductInfoMainSection.productVideo(dataTypeAttribute)}}" stepKey="seeProductVideoDataType"/> + </actionGroup> + + <actionGroup name="assertProductVideoNotInStorefrontProductPage"> + <annotations> + <description>Validates that the provided Video is NOT present on the Storefront Product page.</description> + </annotations> + <arguments> + <argument name="dataTypeAttribute" defaultValue="'youtube'"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertProductVideoNotInStorefrontProductPageActionGroup` instead --> + <dontSeeElement selector="{{StorefrontProductInfoMainSection.productVideo(dataTypeAttribute)}}" stepKey="dontSeeProductVideoDataType"/> + </actionGroup> +</actionGroups> From f4f7ca689126b093e87283b1123438624c266ac3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Wed, 4 Dec 2019 23:44:01 +0100 Subject: [PATCH 0226/1143] BACKWARD COMPATIBILITY: Deprecated ActionGroups to make change Backward Compatible. --- .../ActionGroup/_Deprecated_ActionGroup.xml | 150 ++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 app/code/Magento/Paypal/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml diff --git a/app/code/Magento/Paypal/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Paypal/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml new file mode 100644 index 0000000000000..e6765a6a520e1 --- /dev/null +++ b/app/code/Magento/Paypal/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml @@ -0,0 +1,150 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<!-- +NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. + Please find the Comment with proper replacement for each of ActionGroups provided. +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="EnablePayPalConfiguration"> + <annotations> + <description>Expands the 'OTHER PAYPAL PAYMENT SOLUTIONS' tab on the Admin Configuration page. Enables the provided PayPal Config type for the provided Country Code.</description> + </annotations> + <arguments> + <argument name="payPalConfigType"/> + <argument name="countryCode" type="string" defaultValue="us"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `EnablePayPalConfigurationActionGroup` instead --> + <waitForElementVisible selector="{{OtherPayPalPaymentsConfigSection.expandTab(countryCode)}}" stepKey="waitForOtherPayPalPaymentsSection"/> + <conditionalClick selector="{{OtherPayPalPaymentsConfigSection.expandTab(countryCode)}}" dependentSelector="{{OtherPayPalPaymentsConfigSection.expandedTab(countryCode)}}" visible="false" stepKey="clickOtherPayPalPaymentsSection"/> + <waitForElementVisible selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="waitForWPSExpressConfigureBtn"/> + <click selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="clickWPSExpressConfigureBtn"/> + <waitForElementVisible selector="{{payPalConfigType.enableSolution(countryCode)}}" stepKey="waitForWPSExpressEnable"/> + <selectOption selector="{{payPalConfigType.enableSolution(countryCode)}}" userInput="Yes" stepKey="enableWPSExpressSolution"/> + <seeInPopup userInput="There is already another PayPal solution enabled. Enable this solution instead?" stepKey="seeAlertMessage"/> + <acceptPopup stepKey="acceptEnablePopUp"/> + <click selector="{{AdminConfigSection.saveButton}}" stepKey="saveConfig"/> + <waitForPageLoad stepKey="waitForPageLoad2"/> + </actionGroup> + + <actionGroup name="EnablePayPalSolutionWithoutSave" > + <annotations> + <description>Expands the 'OTHER PAYPAL PAYMENT SOLUTIONS' tab on the Admin Configuration page. Enables the provided PayPal Config type for the provided Country Code without saving.</description> + </annotations> + <arguments> + <argument name="payPalConfigType"/> + <argument name="countryCode" type="string" defaultValue="us"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `EnablePayPalSolutionWithoutSaveActionGroup` instead --> + <waitForElementVisible selector="{{OtherPayPalPaymentsConfigSection.expandTab(countryCode)}}" stepKey="waitForOtherPayPalPaymentsSection"/> + <conditionalClick selector="{{OtherPayPalPaymentsConfigSection.expandTab(countryCode)}}" dependentSelector="{{OtherPayPalPaymentsConfigSection.expandedTab(countryCode)}}" visible="false" stepKey="clickOtherPayPalPaymentsSection"/> + <waitForElementVisible selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="waitForWPSExpressConfigureBtn"/> + <click selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="clickWPSExpressConfigureBtn"/> + <waitForElementVisible selector="{{payPalConfigType.enableSolution(countryCode)}}" stepKey="waitForWPSExpressEnable"/> + <selectOption selector="{{payPalConfigType.enableSolution(countryCode)}}" userInput="Yes" stepKey="enableWPSExpressSolution"/> + </actionGroup> + + <actionGroup name="CheckEnableOptionPayPalConfiguration"> + <annotations> + <description>Expands the 'OTHER PAYPAL PAYMENT SOLUTIONS' tab on the Admin Configuration page. Enables the provided PayPal Config type for the provided Country Code.</description> + </annotations> + <arguments> + <argument name="payPalConfigType"/> + <argument name="enabledOption" type="string"/> + <argument name="countryCode" type="string" defaultValue="us"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CheckEnableOptionPayPalConfigurationActionGroup` instead --> + <waitForElementVisible selector="{{OtherPayPalPaymentsConfigSection.expandTab(countryCode)}}" stepKey="waitForOtherPayPalPaymentsSection"/> + <conditionalClick selector="{{OtherPayPalPaymentsConfigSection.expandTab(countryCode)}}" dependentSelector="{{OtherPayPalPaymentsConfigSection.expandedTab(countryCode)}}" visible="false" stepKey="clickOtherPayPalPaymentsSection"/> + <waitForElementVisible selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="waitForWPSExpressConfigureBtn"/> + <click selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="clickWPSExpressConfigureBtn1"/> + <waitForElementVisible selector="{{payPalConfigType.enableSolution(countryCode)}}" stepKey="waitForWPSExpressEnable"/> + <seeOptionIsSelected selector="{{payPalConfigType.enableSolution(countryCode)}}" userInput="{{enabledOption}}" stepKey="seeSelectedOption"/> + <click selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="clickWPSExpressConfigureBtn2"/> + </actionGroup> + + <actionGroup name="ConfigPayPalExpressCheckout"> + <annotations> + <description>Goes to the 'Configuration' page for 'Payment Methods'. Fills in the provided PayPal credentials and other details. Clicks on Save.</description> + </annotations> + <arguments> + <argument name="credentials" defaultValue="_CREDS"/> + <argument name="countryCode" type="string" defaultValue="us"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `ConfigPayPalExpressCheckoutActionGroup` instead --> + <amOnPage url="{{AdminConfigPaymentMethodsPage.url}}" stepKey="navigateToPaymentConfigurationPage"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + <click selector="{{PayPalExpressCheckoutConfigSection.configureBtn(countryCode)}}" stepKey="clickPayPalConfigureBtn"/> + <waitForElementVisible selector="{{PayPalAdvancedSettingConfigSection.advancedSettingTab(countryCode)}}" stepKey="waitForAdvancedSettingTab"/> + <fillField selector ="{{PayPalExpressCheckoutConfigSection.email(countryCode)}}" userInput="{{credentials.magento/paypal_express_checkout_us_business_account}}" stepKey="inputEmailAssociatedWithPayPalMerchantAccount"/> + <selectOption selector ="{{PayPalExpressCheckoutConfigSection.apiMethod(countryCode)}}" userInput="API Signature" stepKey="inputAPIAuthenticationMethods"/> + <fillField selector ="{{PayPalExpressCheckoutConfigSection.username(countryCode)}}" userInput="{{credentials.magento/paypal_express_checkout_us_api_username}}" stepKey="inputAPIUsername"/> + <fillField selector ="{{PayPalExpressCheckoutConfigSection.password(countryCode)}}" userInput="{{credentials.magento/paypal_express_checkout_us_api_password}}" stepKey="inputAPIPassword"/> + <fillField selector ="{{PayPalExpressCheckoutConfigSection.signature(countryCode)}}" userInput="{{credentials.magento/paypal_express_checkout_us_api_signature}}" stepKey="inputAPISignature"/> + <selectOption selector ="{{PayPalExpressCheckoutConfigSection.sandboxMode(countryCode)}}" userInput="Yes" stepKey="enableSandboxMode"/> + <selectOption selector="{{PayPalExpressCheckoutConfigSection.enableSolution(countryCode)}}" userInput="Yes" stepKey="enableSolution"/> + <fillField selector ="{{PayPalExpressCheckoutConfigSection.merchantID(countryCode)}}" userInput="{{credentials.magento/paypal_express_checkout_us_merchant_id}}" stepKey="inputMerchantID"/> + <click selector="{{AdminConfigSection.saveButton}}" stepKey="saveConfig"/> + </actionGroup> + + <actionGroup name="SampleConfigPayPalExpressCheckout"> + <annotations> + <description>Goes to the 'Configuration' page for 'Payment Methods'. Fills in the provided Sample PayPal credentials and other details. Clicks on Save.</description> + </annotations> + <arguments> + <argument name="credentials" defaultValue="SamplePaypalExpressConfig"/> + <argument name="countryCode" type="string" defaultValue="us"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SampleConfigPayPalExpressCheckoutActionGroup` instead --> + <amOnPage url="{{AdminConfigPaymentMethodsPage.url}}" stepKey="navigateToPaymentConfigurationPage"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + <click selector="{{PayPalExpressCheckoutConfigSection.configureBtn(countryCode)}}" stepKey="clickPayPalConfigureBtn"/> + <waitForElementVisible selector="{{PayPalAdvancedSettingConfigSection.advancedSettingTab(countryCode)}}" stepKey="waitForAdvancedSettingTab"/> + <fillField selector ="{{PayPalExpressCheckoutConfigSection.email(countryCode)}}" userInput="{{credentials.paypal_express_email}}" stepKey="inputEmailAssociatedWithPayPalMerchantAccount"/> + <selectOption selector ="{{PayPalExpressCheckoutConfigSection.apiMethod(countryCode)}}" userInput="API Signature" stepKey="inputAPIAuthenticationMethods"/> + <fillField selector ="{{PayPalExpressCheckoutConfigSection.username(countryCode)}}" userInput="{{credentials.paypal_express_api_username}}" stepKey="inputAPIUsername"/> + <fillField selector ="{{PayPalExpressCheckoutConfigSection.password(countryCode)}}" userInput="{{credentials.paypal_express_api_password}}" stepKey="inputAPIPassword"/> + <fillField selector ="{{PayPalExpressCheckoutConfigSection.signature(countryCode)}}" userInput="{{credentials.paypal_express_api_signature}}" stepKey="inputAPISignature"/> + <selectOption selector ="{{PayPalExpressCheckoutConfigSection.sandboxMode(countryCode)}}" userInput="Yes" stepKey="enableSandboxMode"/> + <selectOption selector="{{PayPalExpressCheckoutConfigSection.enableSolution(countryCode)}}" userInput="Yes" stepKey="enableSolution"/> + <fillField selector ="{{PayPalExpressCheckoutConfigSection.merchantID(countryCode)}}" userInput="{{credentials.paypal_express_merchantID}}" stepKey="inputMerchantID"/> + <click selector="{{AdminConfigSection.saveButton}}" stepKey="saveConfig"/> + </actionGroup> + + <actionGroup name="addProductToCheckoutPage"> + <annotations> + <description>Goes to the provided Category page on the Storefront. Adds the 1st Product to the Cart. Goes to Checkout. Select the Shipping Method. Selects PayPal as the Payment Method.</description> + </annotations> + <arguments> + <argument name="Category"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddProductToCheckoutPageActionGroup` instead --> + <amOnPage url="{{StorefrontCategoryPage.url(Category.name)}}" stepKey="onCategoryPage"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + <moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="hoverProduct"/> + <click selector="{{StorefrontCategoryMainSection.AddToCartBtn}}" stepKey="addToCart"/> + <waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="waitForProductAdded"/> + <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickCart"/> + <click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="goToCheckout"/> + <waitForPageLoad stepKey="waitForPageLoad2"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/> + <click selector="{{CheckoutShippingMethodsSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask2"/> + <waitForElement selector="{{CheckoutShippingMethodsSection.next}}" time="30" stepKey="waitForNextButton"/> + <click selector="{{CheckoutShippingMethodsSection.next}}" stepKey="clickNext"/> + <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" stepKey="waitForPlaceOrderButton"/> + <click selector="{{CheckoutPaymentSection.PayPalPaymentRadio}}" stepKey="clickPayPalCheckbox"/> + </actionGroup> +</actionGroups> From 76f310f82d94c2df8f6b8f4255577441a1ff1964 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Wed, 4 Dec 2019 23:47:06 +0100 Subject: [PATCH 0227/1143] BACKWARD COMPATIBILITY: Deprecated ActionGroups to make change Backward Compatible. --- .../ActionGroup/_Deprecated_ActionGroup.xml | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 app/code/Magento/PageCache/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml diff --git a/app/code/Magento/PageCache/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/PageCache/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml new file mode 100644 index 0000000000000..65e8a0604f505 --- /dev/null +++ b/app/code/Magento/PageCache/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<!-- +NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. + Please find the Comment with proper replacement for each of ActionGroups provided. +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="clearPageCache"> + <annotations> + <description>Goes to the Admin Cache Management page. Selects 'Refresh'. Checks the 'Page Cache' row. Clicks on Submit.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `ClearPageCacheActionGroup` instead --> + <amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}/admin/cache/" stepKey="amOnCacheManagementPage"/> + <waitForPageLoad stepKey="waitForCacheManagement"/> + <selectOption selector="{{AdminCacheManagementSection.massActionSelect}}" userInput="refresh" stepKey="selectRefresh"/> + <click selector="{{AdminCacheManagementSection.pageCacheCheckbox}}" stepKey="selectPageCache"/> + <click selector="{{AdminCacheManagementSection.massActionSubmit}}" stepKey="submitCacheForm"/> + <waitForPageLoad stepKey="waitForCacheFlush"/> + </actionGroup> +</actionGroups> From b04160805c925901fe7c0e397a3590c8cfacada7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Wed, 4 Dec 2019 23:53:08 +0100 Subject: [PATCH 0228/1143] BACKWARD COMPATIBILITY: Deprecated ActionGroups to make change Backward Compatible. --- .../ActionGroup/_Deprecated_ActionGroup.xml | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 app/code/Magento/Newsletter/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml diff --git a/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml new file mode 100644 index 0000000000000..c3f29feb63b8d --- /dev/null +++ b/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<!-- +NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. + Please find the Comment with proper replacement for each of ActionGroups provided. +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCreateNewAccountNewsletterChecked" extends="SignUpNewUserFromStorefrontActionGroup"> + <annotations> + <description>EXTENDS: SignUpNewUserFromStorefrontActionGroup. Clicks on 'Sign Up for Newsletter'. Validates that the Subscription Confirmation message is present and correct.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontCreateNewAccountNewsletterCheckedActionGroup` instead --> + <click selector="{{StorefrontCustomerCreateFormSection.signUpForNewsletter}}" stepKey="selectSignUpForNewsletterCheckbox" after="fillLastName"/> + <see stepKey="seeDescriptionNewsletter" userInput='You are subscribed to "General Subscription".' selector="{{CustomerMyAccountPage.DescriptionNewsletter}}"/> + </actionGroup> + + <actionGroup name="StorefrontCreateNewAccountNewsletterUnchecked" extends="SignUpNewUserFromStorefrontActionGroup"> + <annotations> + <description>EXTENDS: SignUpNewUserFromStorefrontActionGroup. Validates that the you are NOT subscribed message is present and correct.</description> + </annotations> + <arguments> + <argument name="Customer"/> + <argument name="Store"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontCreateNewAccountNewsletterUncheckedActionGroup` instead --> + <amOnPage stepKey="amOnStorefrontPage" url="{{Store.code}}"/> + <see stepKey="seeDescriptionNewsletter" userInput="You aren't subscribed to our newsletter." selector="{{CustomerMyAccountPage.DescriptionNewsletter}}"/> + <see stepKey="seeThankYouMessage" userInput="Thank you for registering with NewStore."/> + </actionGroup> +</actionGroups> From a5a025a47f2f9a0940aac1453a9c61f27e87e701 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Wed, 4 Dec 2019 23:56:15 +0100 Subject: [PATCH 0229/1143] BACKWARD COMPATIBILITY: Deprecated ActionGroups to make change Backward Compatible. --- .../ActionGroup/_Deprecated_ActionGroup.xml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 app/code/Magento/Multishipping/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml diff --git a/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml new file mode 100644 index 0000000000000..41d8803a253f9 --- /dev/null +++ b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<!-- +NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. + Please find the Comment with proper replacement for each of ActionGroups provided. +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontGoCheckoutWithMultipleAddresses"> + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontGoCheckoutWithMultipleAddressesActionGroup` instead --> + <click selector="{{MultishippingSection.shippingMultipleCheckout}}" stepKey="clickToMultipleAddressShippingButton"/> + </actionGroup> +</actionGroups> From 450138063018e4cf893e5da8a6c9f4ea8ccfb642 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Wed, 4 Dec 2019 23:59:53 +0100 Subject: [PATCH 0230/1143] BACKWARD COMPATIBILITY: Deprecated ActionGroups to make change Backward Compatible. --- .../ActionGroup/_Deprecated_ActionGroup.xml | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml new file mode 100644 index 0000000000000..6da85827f77ec --- /dev/null +++ b/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml @@ -0,0 +1,96 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<!-- +NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. + Please find the Comment with proper replacement for each of ActionGroups provided. +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="checkRequiredFieldsInGroupedProductForm"> + <annotations> + <description>Clears the Product Name and SKU fields when adding a Grouped Product and then verifies that they are required after attempting to Save.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CheckRequiredFieldsInGroupedProductFormActionGroup` instead --> + <clearField selector="{{AdminProductFormSection.productName}}" stepKey="clearProductSku"/> + <clearField selector="{{AdminProductFormSection.productSku}}" stepKey="clearProductName"/> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveButton"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Product" stepKey="seeStillOnEditPage"/> + <see selector="{{AdminProductFormSection.fieldError('name')}}" userInput="This is a required field." stepKey="seeNameRequired"/> + <see selector="{{AdminProductFormSection.fieldError('sku')}}" userInput="This is a required field." stepKey="seeSkuRequired"/> + </actionGroup> + + <!--Fill main fields in grouped product form--> + <actionGroup name="fillGroupedProductForm"> + <annotations> + <description>Fills in the provided Product Name and SKU on the Grouped Product creation/edit page.</description> + </annotations> + <arguments> + <argument name="product" defaultValue="GroupedProduct"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `FillGroupedProductFormActionGroup` instead --> + <fillField selector="{{AdminProductFormSection.productName}}" userInput="{{product.name}}" stepKey="fillProductSku"/> + <fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="fillProductName"/> + </actionGroup> + + <actionGroup name="viewGroupedProductInAdminGrid"> + <annotations> + <description>Goes to the Admin Products grid page. Filters the grid for the provided Product. Validates that the provided Product appears in the grid.</description> + </annotations> + <arguments> + <argument name="product" defaultValue="GroupedProduct"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `ViewGroupedProductInAdminGridActionGroup` instead --> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> + <waitForPageLoad stepKey="waitForPageLoadInitial"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> + <fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="{{product.name}}" stepKey="fillProductNameFilter"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillProductSkuFilter"/> + <selectOption selector="{{AdminProductGridFilterSection.typeFilter}}" userInput="{{product.type_id}}" stepKey="selectionProductType"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> + <see selector="{{AdminProductGridSection.firstProductRow}}" userInput="{{product.name}}" stepKey="seeProductNameInGrid"/> + <click selector="{{AdminProductGridFilterSection.clearFilters}}" stepKey="clickClearFiltersAfter"/> + </actionGroup> + + <actionGroup name="fillDefaultQuantityForLinkedToGroupProductInGrid"> + <annotations> + <description>Fills the provided Qty for a Product linked to a Grouped Product.</description> + </annotations> + <arguments> + <argument name="productName" type="string"/> + <argument name="qty" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `FillDefaultQuantityForLinkedToGroupProductInGridActionGroup` instead --> + <fillField selector="{{AdminAddedProductsToGroupGrid.inputByProductName(productName)}}" userInput="{{qty}}" stepKey="fillDefaultQtyForLinkedProduct"/> + </actionGroup> + + <actionGroup name="AdminAssignProductToGroup"> + <annotations> + <description>Adds the provided Product to a Grouped Product on an Admin Grouped Product creation/edit page.</description> + </annotations> + <arguments> + <argument name="product"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminAssignProductToGroupActionGroup` instead --> + <scrollTo selector="{{AdminProductFormGroupedProductsSection.toggleGroupedProduct}}" x="0" y="-100" stepKey="scrollToGroupedSection"/> + <conditionalClick selector="{{AdminProductFormGroupedProductsSection.toggleGroupedProduct}}" dependentSelector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" visible="false" stepKey="openGroupedProductsSection"/> + <click selector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" stepKey="clickAddProductsToGroup"/> + <conditionalClick selector="{{AdminAddProductsToGroupPanel.clearFilters}}" dependentSelector="{{AdminAddProductsToGroupPanel.clearFilters}}" visible="true" stepKey="clearExistingFilters"/> + <click selector="{{AdminAddProductsToGroupPanel.filters}}" stepKey="showFiltersPanel"/> + <fillField userInput="{{product.name}}" selector="{{AdminAddProductsToGroupPanel.nameFilter}}" stepKey="fillNameFilter"/> + <click selector="{{AdminAddProductsToGroupPanel.applyFilters}}" stepKey="clickApplyFilters"/> + <click selector="{{AdminAddProductsToGroupPanel.firstCheckbox}}" stepKey="selectProduct"/> + <click selector="{{AdminAddProductsToGroupPanel.addSelectedProducts}}" stepKey="clickAddSelectedGroupProducts"/> + </actionGroup> +</actionGroups> From 6245374d9b178a94f722ecc65e498769bbbeac79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 5 Dec 2019 00:03:42 +0100 Subject: [PATCH 0231/1143] BACKWARD COMPATIBILITY: Deprecated ActionGroups to make change Backward Compatible. --- .../ActionGroup/_Deprecated_ActionGroup.xml | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 app/code/Magento/Email/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml diff --git a/app/code/Magento/Email/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Email/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml new file mode 100644 index 0000000000000..855ec8790f8f2 --- /dev/null +++ b/app/code/Magento/Email/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<!-- +NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. + Please find the Comment with proper replacement for each of ActionGroups provided. +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateNewTemplate"> + <annotations> + <description>Clicks on Add New Template. Fills the Template details. Clicks on Save. PLEASE NOTE: The values are Hardcoded.</description> + </annotations> + <arguments> + <argument name="template" defaultValue="EmailTemplate"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateNewTemplateActionGroup` instead --> + <amOnPage url="{{AdminEmailTemplateIndexPage.url}}" stepKey="navigateToEmailTemplatePage"/> + <click selector="{{AdminMainActionsSection.add}}" stepKey="clickAddNewTemplateButton"/> + <selectOption selector="{{AdminEmailTemplateEditSection.templateDropDown}}" userInput="Registry Update" stepKey="selectValueFromTemplateDropDown"/> + <click selector="{{AdminEmailTemplateEditSection.loadTemplateButton}}" stepKey="clickLoadTemplateButton"/> + <fillField selector="{{AdminEmailTemplateEditSection.templateCode}}" userInput="{{EmailTemplate.templateName}}" stepKey="fillTemplateNameField"/> + <click selector="{{AdminMainActionsSection.save}}" stepKey="clickSaveTemplateButton"/> + <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForSuccessMessage"/> + <see selector="{{AdminMessagesSection.success}}" userInput="You saved the email template." stepKey="seeSuccessMessage"/> + </actionGroup> + + <actionGroup name="CreateCustomTemplate" extends="CreateNewTemplate"> + <remove keyForRemoval="selectValueFromTemplateDropDown"/> + <remove keyForRemoval="clickLoadTemplateButton"/> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateCustomTemplateActionGroup` instead --> + <fillField selector="{{AdminEmailTemplateEditSection.templateSubject}}" userInput="{{template.templateSubject}}" after="fillTemplateNameField" stepKey="fillTemplateSubject"/> + <fillField selector="{{AdminEmailTemplateEditSection.templateText}}" userInput="{{template.templateText}}" after="fillTemplateSubject" stepKey="fillTemplateText"/> + </actionGroup> + + <actionGroup name="FindAndOpenEmailTemplate"> + <arguments> + <argument name="template" defaultValue="EmailTemplate"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `FindAndOpenEmailTemplateActionGroup` instead --> + <amOnPage url="{{AdminEmailTemplateIndexPage.url}}" stepKey="navigateEmailTemplatePage" /> + <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clearFilters"/> + <fillField selector="{{AdminEmailTemplateIndexSection.searchTemplateField}}" userInput="{{template.templateName}}" stepKey="findCreatedTemplate"/> + <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickSearch"/> + <waitForElementVisible selector="{{AdminEmailTemplateIndexSection.templateRowByName(template.templateName)}}" stepKey="waitForTemplatesAppeared"/> + <click selector="{{AdminEmailTemplateIndexSection.templateRowByName(template.templateName)}}" stepKey="clickToOpenTemplate"/> + <waitForElementVisible selector="{{AdminEmailTemplateEditSection.templateCode}}" stepKey="waitForTemplateNameisible"/> + <seeInField selector="{{AdminEmailTemplateEditSection.templateCode}}" userInput="{{template.templateName}}" stepKey="checkTemplateName"/> + </actionGroup> + + <actionGroup name="DeleteEmailTemplate" extends="FindAndOpenEmailTemplate"> + <annotations> + <description>Clicks on Delete Template. Accepts the Popup. Validates that the Email Template is NOT present in the Email Templates Grid.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `DeleteEmailTemplateActionGroup` instead --> + <click selector="{{AdminEmailTemplateEditSection.deleteTemplateButton}}" after="checkTemplateName" stepKey="deleteTemplate"/> + <waitForElementVisible selector="{{AdminEmailTemplateEditSection.acceptPopupButton}}" after="deleteTemplate" stepKey="waitForConfirmButton"/> + <click selector="{{AdminEmailTemplateEditSection.acceptPopupButton}}" after="waitForConfirmButton" stepKey="acceptPopup"/> + <waitForElementVisible selector="{{AdminMessagesSection.success}}" after="acceptPopup" stepKey="waitForSuccessMessage"/> + <see selector="{{AdminMessagesSection.success}}" userInput="You deleted the email template." after="waitForSuccessMessage" stepKey="seeSuccessfulMessage"/> + </actionGroup> + + <actionGroup name="PreviewEmailTemplateActionGroup" extends="FindAndOpenEmailTemplate"> + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateSystemBackupActionGroup` instead --> + <click selector="{{AdminEmailTemplateEditSection.previewTemplateButton}}" after="checkTemplateName" stepKey="clickPreviewTemplate"/> + <switchToNextTab after="clickPreviewTemplate" stepKey="switchToNewOpenedTab"/> + <seeInCurrentUrl url="{{AdminEmailTemplatePreviewPage.url}}" after="switchToNewOpenedTab" stepKey="seeCurrentUrl"/> + <seeElement selector="{{AdminEmailTemplatePreviewSection.iframe}}" after="seeCurrentUrl" stepKey="seeIframeOnPage"/> + <switchToIFrame userInput="preview_iframe" after="seeIframeOnPage" stepKey="switchToIframe"/> + <waitForPageLoad after="switchToIframe" stepKey="waitForPageLoaded"/> + </actionGroup> + + <actionGroup name="AssertEmailTemplateContent"> + <arguments> + <argument name="expectedContent" type="string" defaultValue="{{EmailTemplate.templateText}}"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertEmailTemplateContentActionGroup` instead --> + <see userInput="{{expectedContent}}" stepKey="checkTemplateContainText"/> + </actionGroup> +</actionGroups> From 84f9267d61c0f278849381d2bdb3b07a1f1c064a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 5 Dec 2019 00:07:15 +0100 Subject: [PATCH 0232/1143] BACKWARD COMPATIBILITY: Deprecated ActionGroups to make change Backward Compatible. --- .../ActionGroup/_Deprecated_ActionGroup.xml | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 app/code/Magento/Downloadable/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml diff --git a/app/code/Magento/Downloadable/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Downloadable/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml new file mode 100644 index 0000000000000..9d739995e99e6 --- /dev/null +++ b/app/code/Magento/Downloadable/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml @@ -0,0 +1,106 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<!-- +NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. + Please find the Comment with proper replacement for each of ActionGroups provided. +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="fillMainDownloadableProductForm"> + <annotations> + <description>Fills the Name, SKU, Price and Quantity on the Product creation/edit page.</description> + </annotations> + <arguments> + <argument name="product" defaultValue="DownloadableProduct"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `FillMainDownloadableProductFormActionGroup` instead --> + <fillField selector="{{AdminProductFormSection.productName}}" userInput="{{product.name}}" stepKey="fillProductSku"/> + <fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="fillProductName"/> + <fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{product.price}}" stepKey="fillProductPrice"/> + <fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="{{product.quantity}}" stepKey="fillProductQty"/> + </actionGroup> + + <actionGroup name="addDownloadableProductLinkWithMaxDownloads"> + <annotations> + <description>Clicks on 'Add Link'. Fills in the provided Link details including a Max Downloads limit.</description> + </annotations> + <arguments> + <argument name="link" defaultValue="downloadableLinkWithMaxDownloads"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddDownloadableProductLinkWithMaxDownloadsActionGroup` instead --> + <click selector="{{AdminProductDownloadableSection.linksAddLinkButton}}" stepKey="clickLinkAddLinkButton"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <fillField userInput="{{link.title}}" selector="{{AdminProductDownloadableSection.addLinkTitleInput('0')}}" stepKey="fillDownloadableLinkTitle"/> + <fillField userInput="{{link.price}}" selector="{{AdminProductDownloadableSection.addLinkPriceInput('0')}}" stepKey="fillDownloadableLinkPrice"/> + <selectOption userInput="{{link.file_type}}" selector="{{AdminProductDownloadableSection.addLinkFileTypeSelector('0')}}" stepKey="selectDownloadableLinkFileType"/> + <selectOption userInput="{{link.sample_type}}" selector="{{AdminProductDownloadableSection.addLinkSampleTypeSelector('0')}}" stepKey="selectDownloadableLinkSampleType"/> + <selectOption userInput="{{link.shareable}}" selector="{{AdminProductDownloadableSection.addLinkShareableSelector('0')}}" stepKey="selectDownloadableLinkShareable"/> + <fillField userInput="{{link.max_downloads}}" selector="{{AdminProductDownloadableSection.addLinkMaxDownloadsInput('0')}}" stepKey="fillDownloadableLinkMaxDownloads"/> + <attachFile userInput="{{link.file}}" selector="{{AdminProductDownloadableSection.addLinkFileUploadFile('0')}}" stepKey="fillDownloadableLinkUploadFile"/> + <fillField userInput="{{link.sample}}" selector="{{AdminProductDownloadableSection.addLinkSampleUrlInput('0')}}" stepKey="fillDownloadableLinkSampleUrl"/> + </actionGroup> + + <actionGroup name="addDownloadableProductLink"> + <annotations> + <description>Clicks on 'Add Link', under the 'Links' section. Fills in the provided Link details including Unlimited Downloads.</description> + </annotations> + <arguments> + <argument name="link" defaultValue="downloadableLink"/> + <argument name="index" type="string" defaultValue="1"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddDownloadableProductLinkActionGroup` instead --> + <click selector="{{AdminProductDownloadableSection.linksAddLinkButton}}" stepKey="clickLinkAddLinkButton"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <fillField userInput="{{link.title}}" selector="{{AdminProductDownloadableSection.addLinkTitleInput(index)}}" stepKey="fillDownloadableLinkTitle"/> + <fillField userInput="{{link.price}}" selector="{{AdminProductDownloadableSection.addLinkPriceInput(index)}}" stepKey="fillDownloadableLinkPrice"/> + <selectOption userInput="{{link.file_type}}" selector="{{AdminProductDownloadableSection.addLinkFileTypeSelector(index)}}" stepKey="selectDownloadableLinkFileType"/> + <selectOption userInput="{{link.sample_type}}" selector="{{AdminProductDownloadableSection.addLinkSampleTypeSelector(index)}}" stepKey="selectDownloadableLinkSampleType"/> + <selectOption userInput="{{link.shareable}}" selector="{{AdminProductDownloadableSection.addLinkShareableSelector(index)}}" stepKey="selectDownloadableLinkShareable"/> + <checkOption selector="{{AdminProductDownloadableSection.addLinkIsUnlimitedDownloads(index)}}" stepKey="checkDownloadableLinkUnlimited"/> + <fillField userInput="{{link.file}}" selector="{{AdminProductDownloadableSection.addLinkFileUrlInput(index)}}" stepKey="fillDownloadableLinkFileUrl"/> + <attachFile userInput="{{link.sample}}" selector="{{AdminProductDownloadableSection.addLinkSampleUploadFile(index)}}" stepKey="attachDownloadableLinkUploadSample"/> + <waitForPageLoad stepKey="waitForPageLoadAfterFillingOutForm" /> + </actionGroup> + + <actionGroup name="addDownloadableSampleFile"> + <annotations> + <description>Clicks on 'Add Link' under the 'Samples' section. Fills in the provided Downloadable Sample File details.</description> + </annotations> + <arguments> + <argument name="sample" defaultValue="downloadableSampleFile"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddDownloadableSampleFileActionGroup` instead --> + <click selector="{{AdminProductDownloadableSection.samplesAddLinkButton}}" stepKey="clickSampleAddLinkButton"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <fillField userInput="{{sample.title}}" selector="{{AdminProductDownloadableSection.addSampleTitleInput('0')}}" stepKey="fillDownloadableSampleTitle"/> + <selectOption userInput="{{sample.file_type}}" selector="{{AdminProductDownloadableSection.addSampleFileTypeSelector('0')}}" stepKey="selectDownloadableSampleFileType"/> + <attachFile userInput="{{sample.file}}" selector="{{AdminProductDownloadableSection.addSampleFileUploadFile('0')}}" stepKey="selectDownloadableSampleUpload"/> + <waitForAjaxLoad stepKey="waitForSampleFileUpload"/> + </actionGroup> + + <actionGroup name="addDownloadableSampleUrl"> + <annotations> + <description>Clicks on 'Add Link' under the 'Samples' section. Fills in the provided Downloadable Sample URL details.</description> + </annotations> + <arguments> + <argument name="sample" defaultValue="downloadableSampleUrl"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddDownloadableSampleUrlActionGroup` instead --> + <click selector="{{AdminProductDownloadableSection.samplesAddLinkButton}}" stepKey="clickSampleAddLinkButton2"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <fillField userInput="{{sample.title}}" selector="{{AdminProductDownloadableSection.addSampleTitleInput('1')}}" stepKey="fillDownloadableSampleTitle"/> + <selectOption userInput="{{sample.file_type}}" selector="{{AdminProductDownloadableSection.addSampleFileTypeSelector('1')}}" stepKey="selectDownloadableSampleFileType"/> + <fillField userInput="{{sample.file}}" selector="{{AdminProductDownloadableSection.addSampleFileUrlInput('1')}}" stepKey="fillDownloadableSampleFileUrl"/> + </actionGroup> +</actionGroups> From c60bbaa506e08541081deed8c3562164947ebea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 5 Dec 2019 00:22:21 +0100 Subject: [PATCH 0233/1143] BACKWARD COMPATIBILITY: Deprecated ActionGroups to make change Backward Compatible. --- ...> StorefrontSwitchCurrencyActionGroup.xml} | 0 .../ActionGroup/_Deprecated_ActionGroup.xml | 27 +++++++++++++++++++ 2 files changed, 27 insertions(+) rename app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/{StorefrontCurrencyRatesActionGroup.xml => StorefrontSwitchCurrencyActionGroup.xml} (100%) create mode 100644 app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml diff --git a/app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/StorefrontCurrencyRatesActionGroup.xml b/app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/StorefrontSwitchCurrencyActionGroup.xml similarity index 100% rename from app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/StorefrontCurrencyRatesActionGroup.xml rename to app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/StorefrontSwitchCurrencyActionGroup.xml diff --git a/app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml new file mode 100644 index 0000000000000..0bb23b04b66a9 --- /dev/null +++ b/app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<!-- +NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. + Please find the Comment with proper replacement for each of ActionGroups provided. +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + + <actionGroup name="StorefrontSwitchCurrency"> + <arguments> + <argument name="currency" type="string" defaultValue="EUR"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontSwitchCurrencyActionGroup` instead --> + <click selector="{{StorefrontSwitchCurrencyRatesSection.currencyTrigger}}" stepKey="openTrigger"/> + <waitForElementVisible selector="{{StorefrontSwitchCurrencyRatesSection.currency(currency)}}" stepKey="waitForCurrency"/> + <click selector="{{StorefrontSwitchCurrencyRatesSection.currency(currency)}}" stepKey="chooseCurrency"/> + <see selector="{{StorefrontSwitchCurrencyRatesSection.selectedCurrency}}" userInput="{{currency}}" stepKey="seeSelectedCurrency"/> + </actionGroup> +</actionGroups> From 910cc76c985b5559be0bfc287c5593803fc9ac0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 5 Dec 2019 00:36:29 +0100 Subject: [PATCH 0234/1143] BACKWARD COMPATIBILITY: Deprecated ActionGroups to make change Backward Compatible. --- .../ActionGroup/_Deprecated_ActionGroup.xml | 853 ++++++++++++++++++ 1 file changed, 853 insertions(+) create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml new file mode 100644 index 0000000000000..672465ad4120b --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml @@ -0,0 +1,853 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<!-- +NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. + Please find the Comment with proper replacement for each of ActionGroups provided. +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateConfigurableProductWithAttributeSet"> + <annotations> + <description>Admin edit created product as configurable. Choose created options</description> + </annotations> + <arguments> + <argument name="product" defaultValue="_defaultProduct"/> + <argument name="category" defaultValue="_defaultCategory"/> + <argument name="label" type="string" defaultValue="mySet"/> + <argument name="option" type="string" defaultValue="['option1', 'option2', 'option3', 'option4']"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateConfigurableProductWithAttributeSetActionGroup` instead --> + <click selector="{{AdminProductFormSection.attributeSet}}" stepKey="startEditAttrSet"/> + <fillField selector="{{AdminProductFormSection.attributeSetFilter}}" userInput="{{label}}" stepKey="searchForAttrSet"/> + <click selector="{{AdminProductFormSection.attributeSetFilterResult}}" stepKey="selectAttrSet"/> + <fillField userInput="{{product.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="fillName"/> + <selectOption selector="{{AdminProductFormSection.additionalOptions}}" parameterArray="{{option}}" stepKey="searchAndMultiSelectCreatedOption"/> + </actionGroup> + + <actionGroup name="AdminCreateConfigurationsForAttribute" extends="generateConfigurationsByAttributeCode"> + <annotations> + <description>EXTENDS: generateConfigurationsByAttributeCode. Click to apply single price to all Skus. Enter Attribute price</description> + </annotations> + <arguments> + <argument name="price" type="string" defaultValue="100"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminCreateConfigurationsForAttributeActionGroup` instead --> + <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.applySinglePriceToAllSkus}}" after="clickOnNextButton2" stepKey="waitForNextPageOpened2"/> + <click selector="{{AdminCreateProductConfigurationsPanel.applySinglePriceToAllSkus}}" after="waitForNextPageOpened2" stepKey="clickOnApplySinglePriceToAllSkus"/> + <fillField selector="{{AdminCreateProductConfigurationsPanel.singlePrice}}" userInput="{{price}}" before="clickOnApplySingleQuantityToEachSku" stepKey="enterAttributePrice"/> + </actionGroup> + + <actionGroup name="AdminCreateConfigurableProductWithAttributeUncheckOption" extends="generateConfigurationsByAttributeCode"> + <annotations> + <description>EXTENDS: generateConfigurationsByAttributeCode. Click to uncheck created option. Enter Attribute price</description> + </annotations> + <arguments> + <argument name="attributeOption" type="string" defaultValue="option1"/> + <argument name="price" type="string" defaultValue="100"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminCreateConfigurableProductWithAttributeUncheckOptionActionGroup` instead --> + <click selector="{{AdminCreateProductConfigurationsPanel.attributeOption('attributeOption')}}" after="clickOnSelectAll" stepKey="clickToUncheckOption"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" after="clickToUncheckOption" stepKey="clickOnNextButton22"/> + <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.applySinglePriceToAllSkus}}" after="clickOnNextButton22" stepKey="waitForNextPageOpened2"/> + <click selector="{{AdminCreateProductConfigurationsPanel.applySinglePriceToAllSkus}}" after="waitForNextPageOpened2" stepKey="clickOnApplySinglePriceToAllSkus"/> + <fillField selector="{{AdminCreateProductConfigurationsPanel.singlePrice}}" userInput="{{price}}" before="clickOnApplySingleQuantityToEachSku" stepKey="enterAttributePrice"/> + </actionGroup> + + <actionGroup name="viewConfigurableProductInAdminGrid"> + <annotations> + <description>Goes to the Admin Product grid page. Validates the provided Configurable Product is present and correct in the grid.</description> + </annotations> + <arguments> + <argument name="product" defaultValue="_defaultProduct"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `ViewConfigurableProductInAdminGridActionGroup` instead --> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> + <waitForPageLoad 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"/> + <seeNumberOfElements selector="{{AdminProductGridSection.productGridRows}}" userInput="3" stepKey="seeCorrectNumberOfProducts"/> + + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFiltersSimple"/> + <selectOption selector="{{AdminProductGridFilterSection.typeFilter}}" userInput="simple" stepKey="selectionProductType"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFiltersWithSimpleType"/> + <see selector="{{AdminProductGridSection.firstProductRow}}" userInput="{{product.name}}" stepKey="seeSimpleProductNameInGrid"/> + <see selector="{{AdminProductGridSection.firstProductRow}}" userInput="{{product.price}}" stepKey="seeSimpleProductPriceInGrid"/> + + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFiltersConfigurable"/> + <selectOption selector="{{AdminProductGridFilterSection.typeFilter}}" userInput="{{product.type_id}}" stepKey="selectionConfigurableProductType"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFiltersWithConfigurableType"/> + <see selector="{{AdminProductGridSection.firstProductRow}}" userInput="{{product.name}}" stepKey="seeConfigurableProductNameInGrid"/> + <dontSee selector="{{AdminProductGridSection.firstProductRow}}" userInput="{{product.price}}" stepKey="dontSeeProductPriceNameInGrid"/> + + <click selector="{{AdminProductGridFilterSection.clearFilters}}" stepKey="clickClearFiltersAfter"/> + </actionGroup> + + <actionGroup name="createConfigurableProduct"> + <annotations> + <description>Goes to the Admin Product grid page. Creates a Configurable Product using the default Product Options.</description> + </annotations> + <arguments> + <argument name="product" defaultValue="_defaultProduct"/> + <argument name="category" defaultValue="_defaultCategory"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateConfigurableProductActionGroup` instead --> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> + <waitForPageLoad time="30" stepKey="wait1"/> + <click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickOnAddProductToggle"/> + <click selector="{{AdminProductGridActionSection.addConfigurableProduct}}" stepKey="clickOnAddConfigurableProduct"/> + <fillField userInput="{{product.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="fillName"/> + <fillField userInput="{{product.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="fillSKU"/> + <fillField userInput="{{product.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="fillPrice"/> + <fillField userInput="{{product.quantity}}" selector="{{AdminProductFormSection.productQuantity}}" stepKey="fillQuantity"/> + <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[{{category.name}}]" stepKey="fillCategory"/> + <selectOption userInput="{{product.visibility}}" selector="{{AdminProductFormSection.visibility}}" stepKey="fillVisibility"/> + <click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/> + <fillField userInput="{{product.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/> + + <click selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="clickOnCreateConfigurations"/> + <click selector="{{AdminCreateProductConfigurationsPanel.createNewAttribute}}" stepKey="clickOnNewAttribute"/> + <waitForPageLoad stepKey="waitForIFrame"/> + <switchToIFrame selector="{{AdminNewAttributePanel.newAttributeIFrame}}" stepKey="switchToNewAttributeIFrame"/> + <fillField selector="{{AdminNewAttributePanel.defaultLabel}}" userInput="{{colorProductAttribute.default_label}}" stepKey="fillDefaultLabel"/> + <click selector="{{AdminNewAttributePanel.saveAttribute}}" stepKey="clickOnNewAttributePanel"/> + <waitForPageLoad stepKey="waitForSaveAttribute"/> + <switchToIFrame stepKey="switchOutOfIFrame"/> + <waitForPageLoad stepKey="waitForFilters"/> + <click selector="{{AdminCreateProductConfigurationsPanel.filters}}" stepKey="clickOnFilters"/> + <fillField userInput="{{colorProductAttribute.default_label}}" selector="{{AdminCreateProductConfigurationsPanel.attributeCode}}" stepKey="fillFilterAttributeCodeField"/> + <click selector="{{AdminCreateProductConfigurationsPanel.applyFilters}}" stepKey="clickApplyFiltersButton"/> + <click selector="{{AdminCreateProductConfigurationsPanel.firstCheckbox}}" stepKey="clickOnFirstCheckbox"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton1"/> + <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="waitCreateNewValueAppears"/> + <click selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="clickOnCreateNewValue1"/> + <fillField userInput="{{colorProductAttribute1.name}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewAttribute1"/> + <click selector="{{AdminCreateProductConfigurationsPanel.saveAttribute}}" stepKey="clickOnSaveNewAttribute1"/> + <click selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="clickOnCreateNewValue2"/> + <fillField userInput="{{colorProductAttribute2.name}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewAttribute2"/> + <click selector="{{AdminCreateProductConfigurationsPanel.saveAttribute}}" stepKey="clickOnSaveNewAttribute2"/> + <click selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="clickOnCreateNewValue3"/> + <fillField userInput="{{colorProductAttribute3.name}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewAttribute3"/> + <click selector="{{AdminCreateProductConfigurationsPanel.saveAttribute}}" stepKey="clickOnSaveNewAttribute3"/> + <click selector="{{AdminCreateProductConfigurationsPanel.selectAll}}" stepKey="clickOnSelectAll"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton2"/> + <click selector="{{AdminCreateProductConfigurationsPanel.applyUniquePricesByAttributeToEachSku}}" stepKey="clickOnApplyUniquePricesByAttributeToEachSku"/> + <selectOption selector="{{AdminCreateProductConfigurationsPanel.selectAttribute}}" userInput="{{colorProductAttribute.default_label}}" stepKey="selectAttributes"/> + <fillField selector="{{AdminCreateProductConfigurationsPanel.attribute1}}" userInput="{{colorProductAttribute1.price}}" stepKey="fillAttributePrice1"/> + <fillField selector="{{AdminCreateProductConfigurationsPanel.attribute2}}" userInput="{{colorProductAttribute2.price}}" stepKey="fillAttributePrice2"/> + <fillField selector="{{AdminCreateProductConfigurationsPanel.attribute3}}" userInput="{{colorProductAttribute3.price}}" stepKey="fillAttributePrice3"/> + <click selector="{{AdminCreateProductConfigurationsPanel.applySingleQuantityToEachSkus}}" stepKey="clickOnApplySingleQuantityToEachSku"/> + <fillField selector="{{AdminCreateProductConfigurationsPanel.quantity}}" userInput="1" stepKey="enterAttributeQuantity"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton3"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton4"/> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton2"/> + <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup"/> + <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSaveProductMessage"/> + <seeInTitle userInput="{{product.name}}" stepKey="seeProductNameInTitle"/> + </actionGroup> + + <actionGroup name="createConfigurableProductWithTwoAttributes" extends="createConfigurableProduct"> + <annotations> + <description>Goes to the Admin Product grid page. Creates a Configurable Product with 2 product attributes.</description> + </annotations> + <arguments> + <argument name="attribute1" defaultValue="ProductColorAttribute"/> + <argument name="attribute2" defaultValue="ProductSizeAttribute"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateConfigurableProductWithTwoAttributesActionGroup` instead --> + <remove keyForRemoval="clickOnNewAttribute"/> + <remove keyForRemoval="waitForIFrame"/> + <remove keyForRemoval="switchToNewAttributeIFrame"/> + <remove keyForRemoval="fillDefaultLabel"/> + <remove keyForRemoval="clickOnNewAttributePanel"/> + <remove keyForRemoval="waitForSaveAttribute"/> + <remove keyForRemoval="switchOutOfIFrame"/> + <remove keyForRemoval="waitForFilters"/> + <remove keyForRemoval="clickOnFilters"/> + <remove keyForRemoval="fillFilterAttributeCodeField"/> + <remove keyForRemoval="clickApplyFiltersButton"/> + <remove keyForRemoval="clickOnFirstCheckbox"/> + <click selector="{{AdminCreateProductConfigurationsPanel.attributeCheckbox(attribute1.attribute_code)}}" stepKey="selectAttribute1" after="clickOnCreateConfigurations"/> + <click selector="{{AdminCreateProductConfigurationsPanel.attributeCheckbox(attribute2.attribute_code)}}" stepKey="selectAttribute2" after="selectAttribute1"/> + <remove keyForRemoval="waitCreateNewValueAppears"/> + <remove keyForRemoval="clickOnCreateNewValue1"/> + <remove keyForRemoval="fillFieldForNewAttribute1"/> + <remove keyForRemoval="clickOnSaveNewAttribute1"/> + <remove keyForRemoval="clickOnCreateNewValue2"/> + <remove keyForRemoval="fillFieldForNewAttribute2"/> + <remove keyForRemoval="clickOnSaveNewAttribute2"/> + <remove keyForRemoval="clickOnCreateNewValue3"/> + <remove keyForRemoval="fillFieldForNewAttribute3"/> + <remove keyForRemoval="clickOnSaveNewAttribute3"/> + <remove keyForRemoval="clickOnSelectAll"/> + <click selector="{{AdminCreateProductConfigurationsPanel.selectAllByAttribute(attribute1.frontend_label)}}" stepKey="selectAllOptionsOfAttribute1" before="clickOnNextButton2"/> + <click selector="{{AdminCreateProductConfigurationsPanel.selectAllByAttribute(attribute2.frontend_label)}}" stepKey="selectAllOptionsOfAttribute2" before="clickOnNextButton2"/> + <remove keyForRemoval="applyUniquePricesByAttributeToEachSku"/> + <remove keyForRemoval="clickOnApplyUniquePricesByAttributeToEachSku"/> + <remove keyForRemoval="selectAttributes"/> + <remove keyForRemoval="fillAttributePrice1"/> + <remove keyForRemoval="fillAttributePrice2"/> + <remove keyForRemoval="fillAttributePrice3"/> + <remove keyForRemoval="clickOnSaveButton2"/> + <remove keyForRemoval="clickOnConfirmInPopup"/> + <remove keyForRemoval="seeSaveProductMessage"/> + <remove keyForRemoval="seeProductNameInTitle"/> + </actionGroup> + + <actionGroup name="saveConfigurableProduct"> + <annotations> + <description>Save configurable product</description> + </annotations> + <arguments> + <argument name="product" defaultValue="_defaultProduct"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SaveConfigurableProductActionGroup` instead --> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton"/> + <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup"/> + <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSaveProductMessage"/> + <seeInTitle userInput="{{product.name}}" stepKey="seeProductNameInTitle"/> + </actionGroup> + + <actionGroup name="generateConfigurationsByAttributeCode"> + <annotations> + <description>Generates the Product Configurations for the provided Attribute Code on the Configurable Product creation/edit page.</description> + </annotations> + <arguments> + <argument name="attributeCode" type="string" defaultValue="SomeString"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `GenerateConfigurationsByAttributeCodeActionGroup` instead --> + <click selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="clickCreateConfigurations"/> + <click selector="{{AdminCreateProductConfigurationsPanel.filters}}" stepKey="clickFilters"/> + <fillField selector="{{AdminCreateProductConfigurationsPanel.attributeCode}}" userInput="{{attributeCode}}" stepKey="fillFilterAttributeCodeField"/> + <click selector="{{AdminCreateProductConfigurationsPanel.applyFilters}}" stepKey="clickApplyFiltersButton"/> + <click selector="{{AdminCreateProductConfigurationsPanel.firstCheckbox}}" stepKey="clickOnFirstCheckbox"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton1"/> + <click selector="{{AdminCreateProductConfigurationsPanel.selectAll}}" stepKey="clickOnSelectAll"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton2"/> + <click selector="{{AdminCreateProductConfigurationsPanel.applySingleQuantityToEachSkus}}" stepKey="clickOnApplySingleQuantityToEachSku"/> + <fillField selector="{{AdminCreateProductConfigurationsPanel.quantity}}" userInput="99" stepKey="enterAttributeQuantity"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton3"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton4"/> + </actionGroup> + + <actionGroup name="createOptionsForAttribute"> + <arguments> + <argument name="attributeName" type="string" defaultValue="{{productAttributeColor.default_label}}"/> + <argument name="firstOptionName" type="string" defaultValue="option1"/> + <argument name="secondOptionName" type="string" defaultValue="option2"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateOptionsForAttributeActionGroup` instead --> + <click selector="{{AdminCreateProductConfigurationsPanel.filters}}" stepKey="clickOnFilters"/> + <fillField userInput="{{attributeName}}" selector="{{AdminCreateProductConfigurationsPanel.attributeCode}}" stepKey="fillFilterAttributeCodeField"/> + <click selector="{{AdminCreateProductConfigurationsPanel.applyFilters}}" stepKey="clickApplyFiltersButton"/> + <click selector="{{AdminCreateProductConfigurationsPanel.firstCheckbox}}" stepKey="clickOnFirstCheckbox"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton"/> + <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="waitCreateNewValueAppears"/> + <click selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="clickOnCreateFirstNewValue"/> + <fillField userInput="{{firstOptionName}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewFirstOption"/> + <click selector="{{AdminCreateProductConfigurationsPanel.saveAttribute}}" stepKey="clickOnSaveNewAttribute"/> + <click selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="clickOnCreateSecondNewValue"/> + <fillField userInput="{{secondOptionName}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewSecondOption"/> + <click selector="{{AdminCreateProductConfigurationsPanel.saveAttribute}}" stepKey="clickOnSaveAttribute"/> + <click selector="{{AdminCreateProductConfigurationsPanel.selectAll}}" stepKey="clickOnSelectAll"/> + </actionGroup> + + <actionGroup name="createConfigurationsForAttribute" extends="generateConfigurationsByAttributeCode"> + <annotations> + <description>EXTENDS: generateConfigurationsByAttributeCode. Clicks on the Save button. Clicks on the Confirm button.</description> + </annotations> + <arguments> + <argument name="attributeCode" type="string" defaultValue="SomeString"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateConfigurationsForAttributeActionGroup` instead --> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton2"/> + <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup"/> + </actionGroup> + + <actionGroup name="createConfigurationsForAttributeWithImages" extends="generateConfigurationsByAttributeCode"> + <annotations> + <description>EXTENDS: generateConfigurationsByAttributeCode. Adds the provided Attribute Image to the provided Attribute Code.</description> + </annotations> + <arguments> + <argument name="attributeCode" type="string" defaultValue="SomeString"/> + <argument name="image" defaultValue="ProductImage"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateConfigurationsForAttributeWithImagesActionGroup` instead --> + <click selector="{{AdminCreateProductConfigurationsPanel.applySingleSetOfImages}}" stepKey="clickOnApplySingleImageSetToAllSku" after="enterAttributeQuantity"/> + <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.imageUploadButton}}" stepKey="seeImageSectionIsReady" after="clickOnApplySingleImageSetToAllSku"/> + <attachFile selector="{{AdminCreateProductConfigurationsPanel.imageFileUpload}}" userInput="{{image.file}}" stepKey="uploadFile" after="seeImageSectionIsReady"/> + <waitForElementNotVisible selector="{{AdminCreateProductConfigurationsPanel.uploadProgressBar}}" stepKey="waitForUpload" after="uploadFile"/> + <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.imageFile(image.fileName)}}" stepKey="waitForThumbnail" after="waitForUpload"/> + + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton2" after="clickOnNextButton4"/> + <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup" after="clickOnSaveButton2"/> + </actionGroup> + + <actionGroup name="createConfigurationsForTwoAttribute" extends="generateConfigurationsByAttributeCode"> + <annotations> + <description>EXTENDS: generateConfigurationsByAttributeCode. Generates the Product Configurations for the 2 provided Attribute Codes on the Configurable Product creation/edit page.</description> + </annotations> + <arguments> + <argument name="secondAttributeCode" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateConfigurationsForTwoAttributeActionGroup` instead --> + <remove keyForRemoval="clickOnSelectAll"/> + <remove keyForRemoval="clickFilters"/> + <remove keyForRemoval="fillFilterAttributeCodeField"/> + <remove keyForRemoval="clickApplyFiltersButton"/> + <remove keyForRemoval="clickOnFirstCheckbox"/> + + <click selector="{{AdminCreateProductConfigurationsPanel.attributeCheckbox(attributeCode)}}" stepKey="clickOnFirstAttributeCheckbox" after="clickCreateConfigurations"/> + <click selector="{{AdminCreateProductConfigurationsPanel.attributeCheckbox(secondAttributeCode)}}" stepKey="clickOnSecondAttributeCheckbox" after="clickOnFirstAttributeCheckbox"/> + <grabTextFrom selector="{{AdminCreateProductConfigurationsPanel.defaultLabel(attributeCode)}}" stepKey="grabFirstAttributeDefaultLabel" after="clickOnSecondAttributeCheckbox"/> + <grabTextFrom selector="{{AdminCreateProductConfigurationsPanel.defaultLabel(secondAttributeCode)}}" stepKey="grabSecondAttributeDefaultLabel" after="grabFirstAttributeDefaultLabel"/> + <click selector="{{AdminCreateProductConfigurationsPanel.selectAllByAttribute({$grabFirstAttributeDefaultLabel})}}" stepKey="clickOnSelectAllForFirstAttribute" after="clickOnNextButton1"/> + <click selector="{{AdminCreateProductConfigurationsPanel.selectAllByAttribute({$grabSecondAttributeDefaultLabel})}}" stepKey="clickOnSelectAllForSecondAttribute" after="clickOnSelectAllForFirstAttribute"/> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton2"/> + <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup"/> + </actionGroup> + + <actionGroup name="saveConfiguredProduct"> + <annotations> + <description>Save the Configurable Product on the Configurable Product creation/edit page. Validates that the Success Message is present.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SaveConfiguredProductActionGroup` instead --> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton2"/> + <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup"/> + <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSaveProductMessage"/> + </actionGroup> + + <actionGroup name="GenerateAndSaveConfiguredProductAfterSettingOptions" extends="saveConfiguredProduct"> + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `GenerateAndSaveConfiguredProductAfterSettingOptionsActionGroup` instead --> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" before="clickOnSaveButton2" stepKey="clickOnNextButton"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" after="clickOnNextButton" stepKey="clickOnGenerateProductsButton"/> + </actionGroup> + + <actionGroup name="addNewProductConfigurationAttribute"> + <annotations> + <description>Generates the Product Configurations for the 2 provided Attribute Names on the Configurable Product creation/edit page.</description> + </annotations> + <arguments> + <argument name="attribute" type="entity"/> + <argument name="firstOption" type="entity"/> + <argument name="secondOption" type="entity"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddNewProductConfigurationAttributeActionGroup` instead --> + <click selector="{{AdminCreateProductConfigurationsPanel.createNewAttribute}}" stepKey="clickOnNewAttribute"/> + <waitForPageLoad stepKey="waitForIFrame"/> + <switchToIFrame selector="{{AdminNewAttributePanel.newAttributeIFrame}}" stepKey="switchToNewAttributeIFrame"/> + <fillField selector="{{AdminNewAttributePanel.defaultLabel}}" userInput="{{attribute.default_label}}" stepKey="fillDefaultLabel"/> + <click selector="{{AdminNewAttributePanel.saveAttribute}}" stepKey="clickOnNewAttributePanel"/> + <waitForPageLoad stepKey="waitForSaveAttribute"/> + <switchToIFrame stepKey="switchOutOfIFrame"/> + <waitForPageLoad stepKey="waitForFilters"/> + + <click selector="{{AdminCreateProductConfigurationsPanel.filters}}" stepKey="clickOnFilters"/> + <fillField userInput="{{attribute.default_label}}" selector="{{AdminCreateProductConfigurationsPanel.attributeCode}}" stepKey="fillFilterAttributeCodeField"/> + <click selector="{{AdminCreateProductConfigurationsPanel.applyFilters}}" stepKey="clickApplyFiltersButton"/> + <click selector="{{AdminCreateProductConfigurationsPanel.firstCheckbox}}" stepKey="clickOnFirstCheckbox"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton"/> + <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="waitCreateNewValueAppears"/> + <click selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="clickOnCreateFirstNewValue"/> + <fillField userInput="{{firstOption.name}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewFirstOption"/> + <click selector="{{AdminCreateProductConfigurationsPanel.saveAttribute}}" stepKey="clickOnSaveNewAttribute"/> + <click selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="clickOnCreateSecondNewValue"/> + <fillField userInput="{{secondOption.name}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewSecondOption"/> + <click selector="{{AdminCreateProductConfigurationsPanel.saveAttribute}}" stepKey="clickOnSaveAttribute"/> + <click selector="{{AdminCreateProductConfigurationsPanel.selectAll}}" stepKey="clickOnSelectAll"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnSecondNextButton"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnThirdNextButton"/> + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnFourthNextButton"/> + </actionGroup> + + <actionGroup name="selectCreatedAttributeAndCreateTwoOptions" extends="addNewProductConfigurationAttribute"> + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SelectCreatedAttributeAndCreateTwoOptionsActionGroup` instead --> + <remove keyForRemoval="clickOnNewAttribute"/> + <remove keyForRemoval="waitForIFrame"/> + <remove keyForRemoval="switchToNewAttributeIFrame"/> + <remove keyForRemoval="fillDefaultLabel"/> + <remove keyForRemoval="clickOnNewAttributePanel"/> + <remove keyForRemoval="waitForSaveAttribute"/> + <remove keyForRemoval="switchOutOfIFrame"/> + <remove keyForRemoval="waitForFilters"/> + <fillField userInput="{{attribute.attribute_code}}" selector="{{AdminCreateProductConfigurationsPanel.attributeCode}}" stepKey="fillFilterAttributeCodeField"/> + <fillField userInput="{{firstOption.label}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewFirstOption"/> + <fillField userInput="{{secondOption.label}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewSecondOption"/> + <remove keyForRemoval="clickOnSelectAll"/> + <remove keyForRemoval="clickOnSecondNextButton"/> + <remove keyForRemoval="clickOnThirdNextButton"/> + <remove keyForRemoval="clickOnFourthNextButton"/> + </actionGroup> + + <actionGroup name="changeProductConfigurationsInGrid"> + <annotations> + <description>Edit the Product Configuration via the Admin Product grid page.</description> + </annotations> + <arguments> + <argument name="firstOption" type="entity"/> + <argument name="secondOption" type="entity"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `ChangeProductConfigurationsInGridActionGroup` instead --> + <fillField userInput="{{firstOption.name}}" selector="{{AdminProductFormConfigurationsSection.confProductNameCell(firstOption.name)}}" stepKey="fillFieldNameForFirstAttributeOption"/> + <fillField userInput="{{secondOption.name}}" selector="{{AdminProductFormConfigurationsSection.confProductNameCell(secondOption.name)}}" stepKey="fillFieldNameForSecondAttributeOption"/> + <fillField userInput="{{firstOption.sku}}" selector="{{AdminProductFormConfigurationsSection.confProductSkuCell(firstOption.name)}}" stepKey="fillFieldSkuForFirstAttributeOption"/> + <fillField userInput="{{secondOption.sku}}" selector="{{AdminProductFormConfigurationsSection.confProductSkuCell(secondOption.name)}}" stepKey="fillFieldSkuForSecondAttributeOption"/> + <fillField userInput="{{firstOption.price}}" selector="{{AdminProductFormConfigurationsSection.confProductPriceCell(firstOption.name)}}" stepKey="fillFieldPriceForFirstAttributeOption"/> + <fillField userInput="{{secondOption.price}}" selector="{{AdminProductFormConfigurationsSection.confProductPriceCell(secondOption.name)}}" stepKey="fillFieldPriceForSecondAttributeOption"/> + <fillField userInput="{{firstOption.quantity}}" selector="{{AdminProductFormConfigurationsSection.confProductQuantityCell(firstOption.name)}}" stepKey="fillFieldQuantityForFirstAttributeOption"/> + <fillField userInput="{{secondOption.quantity}}" selector="{{AdminProductFormConfigurationsSection.confProductQuantityCell(secondOption.name)}}" stepKey="fillFieldQuantityForSecondAttributeOption"/> + <fillField userInput="{{firstOption.weight}}" selector="{{AdminProductFormConfigurationsSection.confProductWeightCell(firstOption.name)}}" stepKey="fillFieldWeightForFirstAttributeOption"/> + <fillField userInput="{{secondOption.weight}}" selector="{{AdminProductFormConfigurationsSection.confProductWeightCell(secondOption.name)}}" stepKey="fillFieldWeightForSecondAttributeOption"/> + </actionGroup> + + <actionGroup name="changeConfigurableProductChildProductPrice"> + <annotations> + <description>Change the price of a configurable child product in the grid under configurations.</description> + </annotations> + <arguments> + <argument name="productAttributes" type="string"/> + <argument name="productPrice" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `ChangeConfigurableProductChildProductPriceActionGroup` instead --> + <fillField userInput="{{productPrice}}" selector="{{AdminProductFormConfigurationsSection.confProductPriceCell(productAttributes)}}" stepKey="fillPriceForConfigurableProductAttributeOption"/> + </actionGroup> + + <actionGroup name="changeProductConfigurationsInGridExceptSku" extends="changeProductConfigurationsInGrid"> + <annotations> + <description>EXTENDS: changeProductConfigurationsInGrid. Removes 'fillFieldSkuForFirstAttributeOption' and 'fillFieldSkuForSecondAttributeOption'.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `ChangeProductConfigurationsInGridExceptSkuActionGroup` instead --> + <remove keyForRemoval="fillFieldSkuForFirstAttributeOption"/> + <remove keyForRemoval="fillFieldSkuForSecondAttributeOption"/> + </actionGroup> + + <actionGroup name="addProductToConfigurationsGrid"> + <annotations> + <description>Adds the provided Product SKU to the provided Product Name.</description> + </annotations> + <arguments> + <argument name="sku" type="string"/> + <argument name="name" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddProductToConfigurationsGridActionGroup` instead --> + <click selector="{{AdminProductFormConfigurationsSection.actionsBtnByProductName(name)}}" stepKey="clickToExpandFirstActions"/> + <click selector="{{AdminProductFormConfigurationsSection.addProduct(name)}}" stepKey="clickChooseFirstDifferentProduct"/> + <switchToIFrame stepKey="switchOutOfIFrame"/> + <waitForPageLoad stepKey="waitForFilters"/> + <click selector="{{AdminCreateProductConfigurationsPanel.filters}}" stepKey="clickFilters"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{sku}}" stepKey="fillProductSkuFilter"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> + <click selector="{{AdminProductGridFilterSection.firstRowBySku(sku)}}" stepKey="clickOnFirstRow"/> + </actionGroup> + + <actionGroup name="addUniqueImageToConfigurableProductOption"> + <annotations> + <description>Adds the provided Image to a Configurable Product on the Admin Product creation/edit page.</description> + </annotations> + <arguments> + <argument name="image" defaultValue="ProductImage"/> + <argument name="frontend_label" type="string"/> + <argument name="label" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddUniqueImageToConfigurableProductOptionActionGroup` instead --> + <click selector="{{AdminCreateProductConfigurationsPanel.applyUniqueImagesToEachSkus}}" stepKey="clickOnApplyUniqueImagesToEachSku"/> + <selectOption userInput="{{frontend_label}}" selector="{{AdminCreateProductConfigurationsPanel.selectImagesButton}}" stepKey="selectOption"/> + <attachFile selector="{{AdminCreateProductConfigurationsPanel.uploadImagesButton(label)}}" userInput="{{image.file}}" stepKey="uploadFile"/> + <waitForElementNotVisible selector="{{AdminCreateProductConfigurationsPanel.uploadProgressBar}}" stepKey="waitForUpload"/> + <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.imageFile(image.fileName)}}" stepKey="waitForThumbnail"/> + </actionGroup> + + <actionGroup name="addUniquePriceToConfigurableProductOption"> + <annotations> + <description>On the 'Step 3: Bulk Images, Price and Quantity' page of the 'Create Product Configurations' model click on 'Apply unique prices...'. Select provided Option. Fill price.</description> + </annotations> + <arguments> + <argument name="frontend_label" type="string"/> + <argument name="label" type="string"/> + <argument name="price" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddUniquePriceToConfigurableProductOptionActionGroup` instead --> + <click selector="{{AdminCreateProductConfigurationsPanel.applyUniquePricesToEachSkus}}" stepKey="clickOnApplyUniquePricesToEachSku"/> + <selectOption userInput="{{frontend_label}}" selector="{{AdminCreateProductConfigurationsPanel.selectPriceButton}}" stepKey="selectOption"/> + <fillField selector="{{AdminCreateProductConfigurationsPanel.price(label)}}" userInput="{{price}}" stepKey="enterAttributeQuantity"/> + </actionGroup> + + <actionGroup name="addUniqueQuantityToConfigurableProductOption"> + <arguments> + <argument name="frontend_label" type="string" defaultValue="{{productAttributeColor.default_label}}"/> + <argument name="label" type="string" defaultValue="option1"/> + <argument name="quantity" type="string" defaultValue="10"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddUniqueQuantityToConfigurableProductOptionActionGroup` instead --> + <click selector="{{AdminCreateProductConfigurationsPanel.applyUniqueQuantityToEachSkus}}" stepKey="clickOnApplyUniqueQuantitiesToEachSku"/> + <selectOption selector="{{AdminCreateProductConfigurationsPanel.selectQuantity}}" userInput="{{frontend_label}}" stepKey="selectOption"/> + <fillField selector="{{AdminCreateProductConfigurationsPanel.applyUniqueQuantity(label)}}" userInput="{{quantity}}" stepKey="enterAttributeQuantity"/> + </actionGroup> + + <actionGroup name="saveConfigurableProductWithNewAttributeSet"> + <annotations> + <description>Clicks on 'Save'. Clicks radio for '...new Attribute Set...' in the 'Choose Affected Attribute Set' modal. Clicks on 'Confirm' in the model on the Configurable Product creation/edit page.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SaveConfigurableProductWithNewAttributeSetActionGroup` instead --> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveConfigurableProduct"/> + <waitForElementVisible selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" time="30" stepKey="waitForAttributeSetConfirmation"/> + <click selector="{{AdminChooseAffectedAttributeSetPopup.addNewAttrSet}}" stepKey="clickAddNewAttributeSet"/> + <fillField selector="{{AdminChooseAffectedAttributeSetPopup.createNewAttrSetName}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="fillFieldNewAttrSetName"/> + <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickConfirmAttributeSet"/> + <see selector="You saved the product" stepKey="seeConfigurableSaveConfirmation" after="clickConfirmAttributeSet"/> + </actionGroup> + + <actionGroup name="saveConfigurableProductAddToCurrentAttributeSet"> + <annotations> + <description>Clicks on 'Save'. Clicks on 'Confirm' in the 'Choose Affected Attribute Set' model on the Configurable Product creation/edit page.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SaveConfigurableProductAddToCurrentAttributeSetActionGroup` instead --> + <waitForElementVisible selector="{{AdminProductFormActionSection.saveButton}}" stepKey="waitForSaveBtnVisible"/> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProductAgain"/> + <waitForElementVisible selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="waitPopUpVisible"/> + <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmPopup"/> + <seeElement selector="{{AdminMessagesSection.success}}" stepKey="seeSaveProductMessage"/> + </actionGroup> + + <actionGroup name="assertConfigurableProductOnAdminProductPage"> + <annotations> + <description>Validates that the provided Configurable Product Name, SKU and Price are present and correct on the Configurable Product creation/edit page. PLEASE NOTE: The Product Data is Hardcoded.</description> + </annotations> + <arguments> + <argument name="product" type="entity"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertConfigurableProductOnAdminProductPageActionGroup` instead --> + <seeInField userInput="{{ApiConfigurableProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="seeNameRequired"/> + <seeInField userInput="{{ApiConfigurableProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="seeSkuRequired"/> + <dontSeeInField userInput="{{ApiConfigurableProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="dontSeePriceRequired"/> + </actionGroup> + + <actionGroup name="StartCreateConfigurationsForAttribute" extends="generateConfigurationsByAttributeCode"> + <remove keyForRemoval="clickOnNextButton3"/> + <remove keyForRemoval="clickOnNextButton4"/> + </actionGroup> + + <actionGroup name="GotoCatalogProductsPage"> + <annotations> + <description>Goes to the Admin Products grid via the Admin Side Menu.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `GotoCatalogProductsPageActionGroup` instead --> + <click stepKey="clickOnCatalogItem" selector="{{CatalogProductsSection.catalogItem}}"/> + <waitForPageLoad stepKey="waitForCatalogLoad"/> + <click stepKey="clickOnProductItem" selector="{{CatalogProductsSection.productItem}}"/> + <waitForPageLoad stepKey="waitForCatalogProductPageLoad"/> + <seeInCurrentUrl stepKey="assertWeAreOnTheCatalogProductPage" url="{{assertionData.catalogProduct}}"/> + </actionGroup> + + <actionGroup name="GotoConfigurableProductPage"> + <annotations> + <description>Clicks on create Configurable Product from the Admin Products grid page.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `GotoConfigurableProductPageActionGroup` instead --> + <click stepKey="clickOnAddProductItem" selector="{{ConfigurableProductSection.addProductItem}}"/> + <click stepKey="clickOnConfigurationProductItem" selector="{{ConfigurableProductSection.configProductItem}}"/> + <waitForPageLoad stepKey="waitForConfigurableProductPageLoad"/> + <seeInCurrentUrl stepKey="assertWeAreOnTheConfigurableProductPage" url="{{assertionData.configurableProduct}}"/> + </actionGroup> + + <actionGroup name="FillAllRequiredFields"> + <annotations> + <description>Fills the Product Name, Price and Weight fields. Clicks on 'Create Configurations'. Clicks on 'Create New Attribute'.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `FillAllRequiredFieldsActionGroup` instead --> + <fillField stepKey="fillInProductNameFields" selector="{{NewProduct.productName}}" userInput="{{NewProductsData.productName}}"/> + <fillField stepKey="fillInPriceFields" selector="{{NewProduct.price}}" userInput="{{NewProductsData.price}}"/> + <fillField stepKey="fillInWeightFields" selector="{{NewProduct.weight}}" userInput="{{NewProductsData.weight}}"/> + <click stepKey="clickOnCreateConfigurationsButton" selector="{{NewProduct.createConfigurationButton}}"/> + <waitForPageLoad stepKey="waitForCreateProductConfigurationsPageLoad"/> + <click stepKey="clickOnCreateNewAttributeButton" selector="{{NewProduct.createNewAttributeButton}}"/> + <waitForPageLoad stepKey="waitForNewAttributePageLoad"/> + </actionGroup> + + <actionGroup name="CreateNewAttribute"> + <annotations> + <description>Creates a new Product Attribute via the Admin Products creation/edit page. PLEASE NOTE: The Product Attributes are Hardcoded.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateNewAttributeActionGroup` instead --> + <switchToIFrame stepKey="NewAttributePage" selector="{{NewProduct.newAttributeIFrame}}"/> + <fillField stepKey="fillInDefaultLabelField" selector="{{NewProduct.defaultLabel}}" userInput="{{NewProductsData.defaultLabel}}"/> + + <!--Add option 1 to attribute--> + <click selector="{{NewProduct.addOptionButton}}" stepKey="clickAddOption1"/> + <waitForPageLoad stepKey="waitForOption1"/> + <fillField stepKey="fillInAdminFieldRed" selector="{{NewProduct.adminFieldRed}}" userInput="{{NewProductsData.adminFieldRed}}"/> + <fillField stepKey="fillInDefaultStoreViewFieldRed" selector="{{NewProduct.defaultStoreViewFieldRed}}" userInput="{{NewProductsData.defaultStoreViewFieldRed}}"/> + + <!--Add option 2 to attribute--> + <click selector="{{NewProduct.addOptionButton}}" stepKey="clickAddOption2"/> + <waitForPageLoad stepKey="waitForOption2"/> + <fillField stepKey="fillInAdminFieldBlue" selector="{{NewProduct.adminFieldBlue}}" userInput="{{NewProductsData.adminFieldBlue}}"/> + <fillField stepKey="fillInDefaultStoreViewFieldBlue" selector="{{NewProduct.defaultStoreViewFieldBlue}}" userInput="{{NewProductsData.defaultStoreViewFieldBlue}}"/> + + <!--Add option 3 to attribute--> + <click selector="{{NewProduct.addOptionButton}}" stepKey="clickAddOption3"/> + <waitForPageLoad stepKey="waitForOption3"/> + <fillField stepKey="fillInAdminFieldYellow" selector="{{NewProduct.adminFieldYellow}}" userInput="{{NewProductsData.adminFieldYellow}}"/> + <fillField stepKey="fillInDefaultStoreViewFieldYellow" selector="{{NewProduct.defaultStoreViewFieldYellow}}" userInput="{{NewProductsData.defaultStoreViewFieldYellow}}"/> + + <!--Add option 4 to attribute--> + <click selector="{{NewProduct.addOptionButton}}" stepKey="clickAddOption4"/> + <waitForPageLoad stepKey="waitForOption4"/> + <fillField stepKey="fillInAdminFieldGreen" selector="{{NewProduct.adminFieldGreen}}" userInput="{{NewProductsData.adminFieldGreen}}"/> + <fillField stepKey="fillInDefaultStoreViewFieldGreen" selector="{{NewProduct.defaultStoreViewFieldGreen}}" userInput="{{NewProductsData.defaultStoreViewFieldGreen}}"/> + + <!--Add option 5 to attribute--> + <click selector="{{NewProduct.addOptionButton}}" stepKey="clickAddOption5"/> + <waitForPageLoad stepKey="waitForOption5"/> + <fillField stepKey="fillInAdminFieldBlack" selector="{{NewProduct.adminFieldBlack}}" userInput="{{NewProductsData.adminFieldBlack}}"/> + <fillField stepKey="fillInDefaultStoreViewFieldBlack" selector="{{NewProduct.defaultStoreViewFieldBlack}}" userInput="{{NewProductsData.defaultStoreViewFieldBlack}}"/> + + <!--Click Save Attribute button--> + <click selector="{{NewProduct.saveAttributeButton}}" stepKey="clickSaveAttributeButton"/> + <waitForPageLoad stepKey="waitForSavingSettings"/> + + <!--Select created Attribute --> + <click selector="{{ConfigurableProductSection.selectCreatedAttribute}}" stepKey="selectCreatedAttribute"/> + + <!--Click Next button--> + <click selector="{{ConfigurableProductSection.nextButton}}" stepKey="clickNextButton"/> + <waitForPageLoad stepKey="waitForNextPageLoaded"/> + + <!--Select all the options of all the attributes button--> + <click selector="{{CreateProductConfigurations.checkboxRed}}" stepKey="selectCheckboxRed"/> + <click selector="{{CreateProductConfigurations.checkboxBlue}}" stepKey="selectCheckboxBlue"/> + <click selector="{{CreateProductConfigurations.checkboxYellow}}" stepKey="selectCheckboxYellow"/> + <click selector="{{CreateProductConfigurations.checkboxGreen}}" stepKey="selectCheckboxGreen"/> + <click selector="{{CreateProductConfigurations.checkboxBlack}}" stepKey="selectCheckboxBlack"/> + + <!--Click Next button--> + <click selector="{{ConfigurableProductSection.nextButton}}" stepKey="clickNextButton2"/> + <waitForPageLoad stepKey="waitForBulkImagesPricePageLoaded"/> + + <!--Click Next button--> + <click selector="{{ConfigurableProductSection.nextButton}}" stepKey="clickNextButton3"/> + <waitForPageLoad stepKey="waitForSummaryPageLoaded"/> + + <!--Click Generate Configure button--> + <click selector="{{ConfigurableProductSection.generateConfigure}}" stepKey="generateConfigure"/> + <waitForPageLoad stepKey="waitForGenerateConfigure"/> + + <!-- This Error message shouldn't appear: Test will pass when bug will be fixed--> + <dontSee selector="{{CreateProductConfigurations.errorMessage}}" userInput="{{assertionData.errorMessage}}" stepKey="dontSeeError"/> + + <!--Close frame--> + <conditionalClick selector="{{ConfigurableProductSection.closeFrame}}" dependentSelector="{{ConfigurableProductSection.closeFrame}}" visible="1" stepKey="closeFrame"/> + <waitForPageLoad stepKey="waitForClosingFrame"/> + </actionGroup> + + <actionGroup name="DeleteCreatedAttribute"> + <annotations> + <description>Deletes the Configurable Product Attribute.</description> + </annotations> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `DeleteCreatedAttributeActionGroup` instead --> + <click stepKey="clickOnStoresItem" selector="{{CatalogProductsSection.storesItem}}"/> + <waitForPageLoad stepKey="waitForNavigationPanel"/> + + <!--Click on Products item--> + <waitForElementVisible selector="{{CatalogProductsSection.storesProductItem}}" stepKey="waitForCatalogLoad"/> + <click stepKey="clickOnStoresProductItem" selector="{{CatalogProductsSection.storesProductItem}}"/> + <waitForPageLoad stepKey="waitForStoresProductPageLoad"/> + + <!--Click on created Attribute --> + <fillField stepKey="searchProductDefaultLabel" selector="{{CatalogProductsSection.searchDefaultLabelField}}" userInput="{{NewProductsData.defaultLabel}}"/> + <click stepKey="clickSearchButton" selector="{{CatalogProductsSection.searchButton}}"/> + <waitForPageLoad stepKey="waitForCreatedAttributeLoad"/> + <click stepKey="clickOnCreatedAttributeItem" selector="{{CatalogProductsSection.createdAttributeItem}}"/> + <waitForPageLoad stepKey="waitForAttributePropertiesPageLoad"/> + + <!--Click on Delete Attribute item--> + <click stepKey="clickOnDeleteAttributeItem" selector="{{CatalogProductsSection.deleteAttributeItem}}"/> + <waitForPageLoad stepKey="waitForDeletedDialogOpened"/> + + <!--Click on OK button--> + <click stepKey="clickOnOKButton" selector="{{CatalogProductsSection.okButton}}"/> + <waitForPageLoad stepKey="waitFordAttributeDeleted"/> + <see userInput="You deleted the product attribute." stepKey="seeDeletedTheProductAttributeMessage"/> + + <!-- Click Reset Filter button--> + <click stepKey="clickResetFilterButton" selector="{{CatalogProductsSection.resetFilter}}"/> + <waitForPageLoad stepKey="waitForAllFilterReset"/> + </actionGroup> + + <actionGroup name="StorefrontCheckCategoryConfigurableProduct"> + <annotations> + <description>Validates that the provided Configurable Product is present and correct on a Category page.</description> + </annotations> + <arguments> + <argument name="product"/> + <argument name="optionProduct"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontCheckCategoryConfigurableProductActionGroup` instead --> + <seeElement selector="{{StorefrontCategoryProductSection.ProductTitleByName(product.name)}}" stepKey="assertProductName"/> + <see userInput="${{optionProduct.price}}.00" selector="{{StorefrontCategoryProductSection.ProductPriceByName(product.name)}}" stepKey="AssertProductPrice"/> + <!-- @TODO: MAGETWO-80272 Move to Magento_Checkout --> + <moveMouseOver selector="{{StorefrontCategoryProductSection.ProductInfoByName(product.name)}}" stepKey="moveMouseOverProduct"/> + <!-- @TODO: MAGETWO-80272 Move to Magento_Checkout --> + <seeElement selector="{{StorefrontCategoryProductSection.ProductAddToCartByName(product.name)}}" stepKey="AssertAddToCart"/> + </actionGroup> + + <actionGroup name="StorefrontCheckCategoryOutOfStockConfigurableProduct"> + <annotations> + <description>Validates that the provided Configurable Product is present and correct on a Category page.</description> + </annotations> + <arguments> + <argument name="product" type="entity"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontCheckCategoryOutOfStockConfigurableProductActionGroup` instead --> + <seeElement selector="{{StorefrontCategoryProductSection.ProductTitleByName(product.name)}}" stepKey="assertProductName"/> + <moveMouseOver selector="{{StorefrontCategoryProductSection.ProductInfoByName(product.name)}}" stepKey="moveMouseOverProduct"/> + <seeElement selector="{{StorefrontCategoryProductSection.ProductStockUnavailable}}" stepKey="AssertOutOfStock"/> + <dontSeeElement selector="{{StorefrontCategoryProductSection.ProductAddToCartByName(product.name)}}" stepKey="AssertAddToCart"/> + </actionGroup> + + <actionGroup name="StorefrontCheckConfigurableProduct"> + <annotations> + <description>Goes to the provided Storefront Product page. Validates that the Product details are present and correct.</description> + </annotations> + <arguments> + <argument name="product"/> + <argument name="optionProduct"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontCheckConfigurableProductActionGroup` instead --> + <seeInCurrentUrl url="/{{product.custom_attributes[url_key]}}.html" stepKey="checkUrl"/> + <seeInTitle userInput="{{product.name}}" stepKey="AssertProductNameInTitle"/> + <see userInput="{{product.name}}" selector="{{StorefrontProductInfoMainSection.productName}}" stepKey="assertProductName"/> + <see userInput="{{product.sku}}" selector="{{StorefrontProductInfoMainSection.productSku}}" stepKey="assertProductSku"/> + <see userInput="${{optionProduct.price}}.00" selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="assertProductPrice"/> + <see userInput="IN STOCK" selector="{{StorefrontProductInfoMainSection.productStockStatus}}" stepKey="assertInStock"/> + <seeElement selector="{{StorefrontProductInfoMainSection.AddToCart}}" stepKey="assertAddToCart"/> + <see userInput="{{product.custom_attributes[description]}}" selector="{{StorefrontProductInfoMainSection.productDescription}}" stepKey="assertProductDescription"/> + <see userInput="{{product.custom_attributes[short_description]}}" selector="{{StorefrontProductInfoMainSection.productShortDescription}}" stepKey="assertProductShortDescription"/> + </actionGroup> + + <actionGroup name="VerifyOptionInProductStorefront"> + <annotations> + <description>Validates that the provided Option Code and Option Name are present and correct on a Configurable Product page.</description> + </annotations> + <arguments> + <argument name="attributeCode" type="string"/> + <argument name="optionName" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `VerifyOptionInProductStorefrontActionGroup` instead --> + <seeElement selector="{{StorefrontProductInfoMainSection.attributeOptionByAttributeID(attributeCode, optionName)}}" stepKey="verifyOptionExists"/> + </actionGroup> + + <actionGroup name="SelectSingleAttributeAndAddToCart"> + <annotations> + <description>Selects a Product Option. Clicks 'Add to Cart'. Validates that the Product Added Success message appears.</description> + </annotations> + <arguments> + <argument name="productName" type="string"/> + <argument name="attributeCode" type="string"/> + <argument name="optionName" type="string"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SelectSingleAttributeAndAddToCartActionGroup` instead --> + <selectOption selector="{{StorefrontProductInfoMainSection.attributeSelectByAttributeID(attributeCode)}}" userInput="{{optionName}}" stepKey="selectAttribute"/> + <click stepKey="addProduct" selector="{{StorefrontProductActionSection.addToCart}}"/> + <waitForElementVisible selector="{{StorefrontQuickSearchResultsSection.messageSection}}" time="30" stepKey="waitForProductAdded"/> + <see selector="{{StorefrontQuickSearchResultsSection.messageSection}}" userInput="You added {{productName}} to your shopping cart." stepKey="seeAddedToCartMessage"/> + </actionGroup> + + <actionGroup name="storefrontCheckConfigurableProductOptions"> + <annotations> + <description>Validates that the Options for a Configurable Product are present and correct.</description> + </annotations> + <arguments> + <argument name="product" type="entity"/> + <argument name="firstOption" type="entity"/> + <argument name="secondOption" type="entity"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontCheckConfigurableProductOptionsActionGroup` instead --> + <selectOption userInput="{{firstOption.name}}" selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" stepKey="selectOption1"/> + <see userInput="{{product.name}}" selector="{{StorefrontProductInfoMainSection.productName}}" stepKey="seeConfigurableProductName"/> + <see userInput="{{firstOption.price}}" selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="assertProductPricePresent"/> + <see userInput="{{product.sku}}" selector="{{StorefrontProductInfoMainSection.productSku}}" stepKey="seeConfigurableProductSku"/> + <see userInput="IN STOCK" selector="{{StorefrontProductInfoMainSection.productStockStatus}}" stepKey="assertInStock"/> + <see userInput="{{colorProductAttribute.default_label}}" selector="{{StorefrontProductInfoMainSection.productAttributeTitle1}}" stepKey="seeColorAttributeName"/> + <dontSee userInput="As low as" selector="{{StorefrontProductInfoMainSection.productPriceLabel}}" stepKey="dontSeeProductPriceLabel1"/> + <selectOption userInput="{{secondOption.name}}" selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" stepKey="selectOption2"/> + <dontSee userInput="As low as" selector="{{StorefrontProductInfoMainSection.productPriceLabel}}" stepKey="dontSeeProductPriceLabel2"/> + <see userInput="{{secondOption.price}}" selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="seeProductPrice2"/> + </actionGroup> + + <actionGroup name="assertOptionImageInStorefrontProductPage"> + <annotations> + <description>Validates that the provided Product Image is present when the provided Product Option is selected.</description> + </annotations> + <arguments> + <argument name="product" type="entity"/> + <argument name="label" type="string"/> + <argument name="image" defaultValue="MagentoLogo"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertOptionImageInStorefrontProductPageActionGroup` instead --> + <seeInCurrentUrl url="/{{product.urlKey}}.html" stepKey="checkUrl"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <selectOption userInput="{{label}}" selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" stepKey="selectOption1"/> + <seeElement selector="{{StorefrontProductMediaSection.imageFile(image.filename)}}" stepKey="seeFirstImage"/> + </actionGroup> + + <actionGroup name="assertConfigurableProductWithSpecialPriceOnStorefrontProductPage"> + <annotations> + <description>Validates that Special Price for a Configurable Product is present and correct when the provided Product Option is selected.</description> + </annotations> + <arguments> + <argument name="option" type="string"/> + <argument name="price" type="string"/> + <argument name="specialPrice" defaultValue="specialProductPrice"/> + </arguments> + + <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertConfigurableProductWithSpecialPriceOnStorefrontProductPageActionGroup` instead --> + <selectOption userInput="{{option}}" selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" stepKey="selectOptionWithSpecialPrice"/> + <see userInput="{{specialProductPrice.price}}" selector="{{StorefrontProductInfoMainSection.productSpecialPrice}}" stepKey="seeSpecialProductPrice"/> + <see userInput="Regular Price" selector="{{StorefrontProductInfoMainSection.specialProductText}}" stepKey="seeText"/> + <see userInput="{{price}}" selector="{{StorefrontProductInfoMainSection.oldProductPrice}}" stepKey="seeOldProductPrice"/> + </actionGroup> +</actionGroups> From da1daaeeb64f29d7f23bc71e63987ffbc7994099 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Thu, 5 Dec 2019 14:19:30 +0700 Subject: [PATCH 0235/1143] Resolve Admin panel is not accessible after limited permissions set to at least one admin account issue25881 --- .../Controller/Adminhtml/Index/Denied.php | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 app/code/Magento/Backend/Controller/Adminhtml/Index/Denied.php diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Index/Denied.php b/app/code/Magento/Backend/Controller/Adminhtml/Index/Denied.php new file mode 100644 index 0000000000000..5998b704275d8 --- /dev/null +++ b/app/code/Magento/Backend/Controller/Adminhtml/Index/Denied.php @@ -0,0 +1,21 @@ +<?php +/** + * + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Backend\Controller\Adminhtml\Index; + +use Magento\Backend\Controller\Adminhtml\Denied as DeniedController; + +/** + * To display Denied Page + * + * Class Denied + */ +class Denied extends DeniedController +{ + +} From 1f12acfbf94dcfc4acaeba7f74e1b78596817213 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Thu, 5 Dec 2019 16:00:44 +0700 Subject: [PATCH 0236/1143] Fix static test issue25881 --- .../Magento/Backend/Controller/Adminhtml/Index/Denied.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Index/Denied.php b/app/code/Magento/Backend/Controller/Adminhtml/Index/Denied.php index 5998b704275d8..e967a11fe204c 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Index/Denied.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Index/Denied.php @@ -9,13 +9,17 @@ namespace Magento\Backend\Controller\Adminhtml\Index; use Magento\Backend\Controller\Adminhtml\Denied as DeniedController; +use Magento\Framework\App\Action\HttpGetActionInterface; /** * To display Denied Page * * Class Denied */ -class Denied extends DeniedController +class Denied extends DeniedController implements HttpGetActionInterface { - + /** + * Authorization level of a basic admin session + */ + const ADMIN_RESOURCE = 'Magento_Backend::admin'; } From 0efac967654583795f5a068e6d18188d87491f56 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Thu, 5 Dec 2019 13:21:10 +0200 Subject: [PATCH 0237/1143] MFTF test update. --- .../ActionGroup/StorefrontCompareActionGroup.xml | 16 +++++++++++++++- ...uctAttributeWithoutValueInCompareListTest.xml | 14 ++++++-------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCompareActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCompareActionGroup.xml index 706de58a87840..3228d8926e890 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCompareActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCompareActionGroup.xml @@ -31,7 +31,6 @@ <arguments> <argument name="productVar"/> </arguments> - <waitForElementVisible selector="{{StorefrontProductInfoMainSection.productAddToCompare}}" stepKey="seeAddToCompareLink"/> <click selector="{{StorefrontProductInfoMainSection.productAddToCompare}}" stepKey="clickAddToCompare"/> @@ -94,4 +93,19 @@ <waitForElement selector="{{StorefrontMessagesSection.message('You cleared the comparison list.')}}" time="30" stepKey="AssertMessageCleared"/> <waitForElement selector="{{StorefrontComparisonSidebarSection.NoItemsMessage}}" time="30" stepKey="assertNoItems"/> </actionGroup> + + <!-- Check Product is present in the comparison list --> + <actionGroup name="SeeProductInComparisonListActionGroup"> + <annotations> + <description>Validate that the Product is present in the comparison list</description> + </annotations> + <arguments> + <argument name="productVar"/> + </arguments> + + <amOnPage url="{{StorefrontProductComparePage.url}}" stepKey="navigateToComparePage"/> + <waitForPageLoad stepKey="waitForStorefrontProductComparePageLoad"/> + <seeElement selector="{{StorefrontProductCompareMainSection.ProductLinkByName(productVar.name)}}" + stepKey="seeProductInCompareList"/> + </actionGroup> </actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/ProductAttributeWithoutValueInCompareListTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/ProductAttributeWithoutValueInCompareListTest.xml index f926a2aa2f4ad..f32ce60706423 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/ProductAttributeWithoutValueInCompareListTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/ProductAttributeWithoutValueInCompareListTest.xml @@ -53,10 +53,9 @@ <argument name="productVar" value="$$createProductDefault$$"/> </actionGroup> <!--See product in the comparison list--> - <amOnPage url="{{StorefrontProductComparePage.url}}" stepKey="navigateToComparePage"/> - <waitForPageLoad stepKey="waitForStorefrontProductComparePageLoad"/> - <seeElement selector="{{StorefrontProductCompareMainSection.ProductLinkByName($createProductDefault.name$)}}" - stepKey="seeProductInCompareList"/> + <actionGroup ref="SeeProductInComparisonListActionGroup" stepKey="seeProductDefaultInComparisonListActionGroup"> + <argument name="productVar" value="$$createProductDefault$$"/> + </actionGroup> <!--Open product with custom attribute page--> <amOnPage url="{{StorefrontProductPage.url($$createProductCustom.name$$)}}" stepKey="goToProductCustomPage"/> <waitForPageLoad stepKey="waitForProductCustomPage"/> @@ -65,10 +64,9 @@ <argument name="productVar" value="$$createProductCustom$$"/> </actionGroup> <!--See product with custom attribute in the comparison list--> - <amOnPage url="{{StorefrontProductComparePage.url}}" stepKey="navigateToComparePageCustom"/> - <waitForPageLoad stepKey="waitForStorefrontProductCustomComparePageLoad"/> - <seeElement selector="{{StorefrontProductCompareMainSection.ProductLinkByName($createProductCustom.name$)}}" - stepKey="seeProductCustomInCompareList"/> + <actionGroup ref="SeeProductInComparisonListActionGroup" stepKey="seeProductCustomInComparisonListActionGroup"> + <argument name="productVar" value="$$createProductCustom$$"/> + </actionGroup> <!--See attribute default value in the comparison list--> <see userInput="$createProductAttribute.defaultValue$" selector="{{StorefrontProductCompareMainSection.ProductAttributeByCodeAndProductName(ProductAttributeFrontendLabel.label, $createProductCustom.name$)}}" From 954f124017b54beedf87327bec8bde6a1810a76b Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Thu, 5 Dec 2019 14:49:59 +0200 Subject: [PATCH 0238/1143] Test for magento/magento2#25051. --- .../StorefrontProductInfoMainSection.xml | 1 + ...avascriptErrorOnAddYourReviewClickTest.xml | 50 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 app/code/Magento/Review/Test/Mftf/Test/StorefrontNoJavascriptErrorOnAddYourReviewClickTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductInfoMainSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductInfoMainSection.xml index fd412d3c7dee1..631649e33b0fd 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductInfoMainSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductInfoMainSection.xml @@ -34,6 +34,7 @@ <element name="specialPriceValue" type="text" selector="//span[@class='special-price']//span[@class='price']"/> <element name="mapPrice" type="text" selector="//div[@class='price-box price-final_price']//span[contains(@class, 'price-msrp_price')]"/> <element name="clickForPriceLink" type="text" selector="//div[@class='price-box price-final_price']//a[contains(text(), 'Click for price')]"/> + <element name="addReviewLink" type="text" selector="//div[@class='reviews-actions']//a[@class='action add']"/> <!-- 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" /> diff --git a/app/code/Magento/Review/Test/Mftf/Test/StorefrontNoJavascriptErrorOnAddYourReviewClickTest.xml b/app/code/Magento/Review/Test/Mftf/Test/StorefrontNoJavascriptErrorOnAddYourReviewClickTest.xml new file mode 100644 index 0000000000000..667e352cde837 --- /dev/null +++ b/app/code/Magento/Review/Test/Mftf/Test/StorefrontNoJavascriptErrorOnAddYourReviewClickTest.xml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="StorefrontNoJavascriptErrorOnAddYourReviewClickTest"> + <annotations> + <features value="Review"/> + <title value="Storefront no javascript error on 'Add Your Review' click test"/> + <description value="Verify no javascript error occurs when customer clicks 'Add Your Review' link"/> + <severity value="MAJOR"/> + <group value="review"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <createData entity="textProductAttribute" stepKey="createProductAttribute"/> + <createData entity="CatalogAttributeSet" stepKey="createAttributeSet"/> + <amOnPage url="{{AdminProductAttributeSetEditPage.url}}/$$createAttributeSet.attribute_set_id$$/" + stepKey="onAttributeSetEdit"/> + <actionGroup ref="AssignAttributeToGroup" stepKey="assignAttributeToGroup"> + <argument name="group" value="Product Details"/> + <argument name="attribute" value="$$createProductAttribute.attribute_code$$"/> + </actionGroup> + <actionGroup ref="SaveAttributeSet" stepKey="SaveAttributeSet"/> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <createData entity="SimpleProductWithCustomAttributeSet" stepKey="createProduct"> + <requiredEntity createDataKey="createCategory"/> + <requiredEntity createDataKey="createAttributeSet"/> + </createData> + </before> + <after> + <deleteData createDataKey="createProduct" stepKey="deleteProductCustom"/> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <deleteData createDataKey="createAttributeSet" stepKey="deleteAttributeSet"/> + <deleteData createDataKey="createProductAttribute" stepKey="deleteProductAttribute"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <amOnPage url="{{StorefrontProductPage.url($$createProduct.name$$)}}" stepKey="goToProductPage"/> + <dontSeeElement selector="{{StorefrontProductInfoDetailsSection.productNameForReview}}" stepKey="dontSeeReviewTab"/> + <click selector="{{StorefrontProductInfoMainSection.addReviewLink}}" stepKey="clickAddReview"/> + <dontSeeJsError stepKey="dontSeeJsError"/> + <seeElement selector="{{StorefrontProductInfoDetailsSection.productNameForReview}}" stepKey="seeReviewTab"/> + </test> +</tests> From 55585c872996da60661fc196da8363350d27a5b5 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Thu, 5 Dec 2019 16:29:13 +0200 Subject: [PATCH 0239/1143] Test for magento/magento2#24907. --- ...CategoryAccessibleWhenSuffixIsNullTest.xml | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/StorefrontCategoryAccessibleWhenSuffixIsNullTest.xml diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/StorefrontCategoryAccessibleWhenSuffixIsNullTest.xml b/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/StorefrontCategoryAccessibleWhenSuffixIsNullTest.xml new file mode 100644 index 0000000000000..ef8f2b6b1a3e2 --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/StorefrontCategoryAccessibleWhenSuffixIsNullTest.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="StorefrontCategoryAccessibleWhenSuffixIsNullTest"> + <annotations> + <title value="Storefront category is accessible when url suffix is set to null test"/> + <description value="Check no crash occurs on Category page when catalog/seo/category_url_suffix is set to null"/> + <features value="CatalogUrlRewrite"/> + <severity value="MAJOR"/> + <group value="CatalogUrlRewrite"/> + </annotations> + <before> + <magentoCLI command="config:set catalog/seo/category_url_suffix ''" stepKey="setCategoryUrlSuffix"/> + <magentoCLI command="config:set catalog/seo/generate_category_product_rewrites 0" + stepKey="setCategoryProductRewrites"/> + <magentoCLI command="cache:flush" stepKey="flushCacheBefore"/> + <createData entity="_defaultCategory" stepKey="createCategory"/> + </before> + <after> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <magentoCLI command="config:set catalog/seo/category_url_suffix '.html'" + stepKey="restoreCategoryUrlSuffix"/> + <magentoCLI command="config:set catalog/seo/generate_category_product_rewrites 1" + stepKey="restoreCategoryProductRewrites"/> + <magentoCLI command="cache:flush" stepKey="flushCacheAfter"/> + </after> + + <amOnPage url="/$$createCategory.name$$" stepKey="onCategoryPage"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <seeInTitle userInput="$$createCategory.name$$" stepKey="assertCategoryNameInTitle"/> + </test> +</tests> From d67374f1b888dfd9b40da3c89dd191075e0ea618 Mon Sep 17 00:00:00 2001 From: Sathish <srsathish92@gmail.com> Date: Thu, 5 Dec 2019 21:24:48 +0530 Subject: [PATCH 0240/1143] Code refactor in Catalog Viewmodel breadcrumbs --- .../Catalog/ViewModel/Product/Breadcrumbs.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Catalog/ViewModel/Product/Breadcrumbs.php b/app/code/Magento/Catalog/ViewModel/Product/Breadcrumbs.php index d1424d637937b..330d1e0d3fbdf 100644 --- a/app/code/Magento/Catalog/ViewModel/Product/Breadcrumbs.php +++ b/app/code/Magento/Catalog/ViewModel/Product/Breadcrumbs.php @@ -10,7 +10,7 @@ use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\App\ObjectManager; use Magento\Framework\DataObject; -use Magento\Framework\Serialize\Serializer\Json; +use Magento\Framework\Serialize\Serializer\JsonHexTag; use Magento\Framework\View\Element\Block\ArgumentInterface; use Magento\Framework\Escaper; @@ -31,6 +31,11 @@ class Breadcrumbs extends DataObject implements ArgumentInterface */ private $scopeConfig; + /** + * @var JsonHexTag + */ + private $jsonSerializer; + /** * @var Escaper */ @@ -39,20 +44,21 @@ class Breadcrumbs extends DataObject implements ArgumentInterface /** * @param Data $catalogData * @param ScopeConfigInterface $scopeConfig - * @param Json|null $json + * @param JsonHexTag $jsonSerializer * @param Escaper|null $escaper * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function __construct( Data $catalogData, ScopeConfigInterface $scopeConfig, - Json $json = null, + JsonHexTag $jsonSerializer, Escaper $escaper = null ) { parent::__construct(); $this->catalogData = $catalogData; $this->scopeConfig = $scopeConfig; + $this->jsonSerializer = $jsonSerializer; $this->escaper = $escaper ?: ObjectManager::getInstance()->get(Escaper::class); } @@ -101,15 +107,14 @@ public function getProductName(): string */ public function getJsonConfigurationHtmlEscaped() : string { - return json_encode( + return $this->jsonSerializer->serialize( [ 'breadcrumbs' => [ 'categoryUrlSuffix' => $this->escaper->escapeHtml($this->getCategoryUrlSuffix()), 'useCategoryPathInUrl' => (int)$this->isCategoryUsedInProductUrl(), 'product' => $this->escaper->escapeHtml($this->getProductName()) ] - ], - JSON_HEX_TAG + ] ); } From 1e5a9db638e79f527e9c1865dc380d35d30f30b2 Mon Sep 17 00:00:00 2001 From: Sathish <srsathish92@gmail.com> Date: Thu, 5 Dec 2019 21:34:40 +0530 Subject: [PATCH 0241/1143] Updated unit test with JsonHexTag --- .../Catalog/Test/Unit/ViewModel/Product/BreadcrumbsTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/code/Magento/Catalog/Test/Unit/ViewModel/Product/BreadcrumbsTest.php b/app/code/Magento/Catalog/Test/Unit/ViewModel/Product/BreadcrumbsTest.php index a4ccaffc8fb6a..38b5f35634ad7 100644 --- a/app/code/Magento/Catalog/Test/Unit/ViewModel/Product/BreadcrumbsTest.php +++ b/app/code/Magento/Catalog/Test/Unit/ViewModel/Product/BreadcrumbsTest.php @@ -54,12 +54,14 @@ protected function setUp() : void ->getMockForAbstractClass(); $escaper = $this->getObjectManager()->getObject(\Magento\Framework\Escaper::class); + $this->serializer = $this->createMock(\Magento\Framework\Serialize\Serializer\JsonHexTag::class); $this->viewModel = $this->getObjectManager()->getObject( Breadcrumbs::class, [ 'catalogData' => $this->catalogHelper, 'scopeConfig' => $this->scopeConfig, + 'jsonSerializer' => $this->serializer, 'escaper' => $escaper ] ); @@ -141,6 +143,8 @@ public function testGetJsonConfiguration($product, string $expectedJson) : void ->with('catalog/seo/category_url_suffix', \Magento\Store\Model\ScopeInterface::SCOPE_STORE) ->willReturn('."html'); + $this->serializer->expects($this->once())->method('serialize')->willReturn($expectedJson); + $this->assertEquals($expectedJson, $this->viewModel->getJsonConfiguration()); } From 839fed39f56cc8582f3195ef754718250411451c Mon Sep 17 00:00:00 2001 From: Ji Lu <jilu1@adobe.com> Date: Thu, 5 Dec 2019 15:04:56 -0600 Subject: [PATCH 0242/1143] MQE-1907: stabilize mtf to mftf migration pr #744 --- .../AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml | 2 +- .../Test/AdminDeleteCategoryUrlRewriteWithRequestPathTest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml index ca292c384979f..5a05dab7aa707 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml @@ -30,7 +30,7 @@ <!--Create the Category Url Rewrite--> <actionGroup ref="AdminAddUrlRewrite" stepKey="addUrlRewrite"> <argument name="category" value="$$category.name$$"/> - <argument name="customUrlRewriteValue" value="For Category'"/> + <argument name="customUrlRewriteValue" value="For Category"/> <argument name="storeValue" value="Default Store View"/> <argument name="requestPath" value="-"/> <argument name="redirectTypeValue" value="No"/> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteWithRequestPathTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteWithRequestPathTest.xml index 3c0dc8dc2be10..e94e10767c632 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteWithRequestPathTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteWithRequestPathTest.xml @@ -30,7 +30,7 @@ <!--Create the Category Url Rewrite--> <actionGroup ref="AdminAddUrlRewrite" stepKey="addUrlRewriteSecondTime"> <argument name="category" value="$$category.name$$"/> - <argument name="customUrlRewriteValue" value="For Category'"/> + <argument name="customUrlRewriteValue" value="For Category"/> <argument name="storeValue" value="Default Store View"/> <argument name="requestPath" value="newrequestpath.html"/> <argument name="redirectTypeValue" value="No"/> From 5e12e57e99a8adf2c042d5cc81e85dca3a29757a Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko <lytvynen@adobe.com> Date: Thu, 5 Dec 2019 15:50:12 -0600 Subject: [PATCH 0243/1143] MC-29167: CatalogWidget products list doesn't work with anchor category --- .../Block/Product/ProductsList.php | 148 +++++++++++++----- .../Block/Product/ProductListTest.php | 89 +++++++++-- 2 files changed, 179 insertions(+), 58 deletions(-) diff --git a/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php b/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php index 9e47830debfc4..31863eafe85bf 100644 --- a/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php +++ b/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php @@ -6,15 +6,30 @@ namespace Magento\CatalogWidget\Block\Product; +use Magento\Catalog\Api\CategoryRepositoryInterface; +use Magento\Catalog\Block\Product\AbstractProduct; +use Magento\Catalog\Block\Product\Widget\Html\Pager; use Magento\Catalog\Model\Product; -use Magento\Framework\App\ObjectManager; +use Magento\Catalog\Model\Product\Visibility; +use Magento\Catalog\Model\ResourceModel\Product\Collection; +use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory; +use Magento\Catalog\Pricing\Price\FinalPrice; +use Magento\CatalogWidget\Model\Rule; use Magento\Framework\App\ActionInterface; +use Magento\Framework\App\Http\Context; +use Magento\Framework\App\ObjectManager; use Magento\Framework\DataObject\IdentityInterface; +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Pricing\PriceCurrencyInterface; use Magento\Framework\Serialize\Serializer\Json; +use Magento\Framework\Url\EncoderInterface; use Magento\Framework\View\LayoutFactory; +use Magento\Framework\View\LayoutInterface; +use Magento\Rule\Model\Condition\Combine; +use Magento\Rule\Model\Condition\Sql\Builder; use Magento\Widget\Block\BlockInterface; -use Magento\Framework\Url\EncoderInterface; +use Magento\Widget\Helper\Conditions; /** * Catalog Products List widget block @@ -22,7 +37,7 @@ * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ -class ProductsList extends \Magento\Catalog\Block\Product\AbstractProduct implements BlockInterface, IdentityInterface +class ProductsList extends AbstractProduct implements BlockInterface, IdentityInterface { /** * Default value for products count that will be shown @@ -49,41 +64,41 @@ class ProductsList extends \Magento\Catalog\Block\Product\AbstractProduct implem /** * Instance of pager block * - * @var \Magento\Catalog\Block\Product\Widget\Html\Pager + * @var Pager */ protected $pager; /** - * @var \Magento\Framework\App\Http\Context + * @var Context */ protected $httpContext; /** * Catalog product visibility * - * @var \Magento\Catalog\Model\Product\Visibility + * @var Visibility */ protected $catalogProductVisibility; /** * Product collection factory * - * @var \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory + * @var CollectionFactory */ protected $productCollectionFactory; /** - * @var \Magento\Rule\Model\Condition\Sql\Builder + * @var Builder */ protected $sqlBuilder; /** - * @var \Magento\CatalogWidget\Model\Rule + * @var Rule */ protected $rule; /** - * @var \Magento\Widget\Helper\Conditions + * @var Conditions */ protected $conditionsHelper; @@ -105,7 +120,7 @@ class ProductsList extends \Magento\Catalog\Block\Product\AbstractProduct implem private $layoutFactory; /** - * @var \Magento\Framework\Url\EncoderInterface|null + * @var EncoderInterface|null */ private $urlEncoder; @@ -114,29 +129,36 @@ class ProductsList extends \Magento\Catalog\Block\Product\AbstractProduct implem */ private $rendererListBlock; + /** + * @var CategoryRepositoryInterface + */ + private $categoryRepository; + /** * @param \Magento\Catalog\Block\Product\Context $context - * @param \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory - * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility - * @param \Magento\Framework\App\Http\Context $httpContext - * @param \Magento\Rule\Model\Condition\Sql\Builder $sqlBuilder - * @param \Magento\CatalogWidget\Model\Rule $rule - * @param \Magento\Widget\Helper\Conditions $conditionsHelper + * @param CollectionFactory $productCollectionFactory + * @param Visibility $catalogProductVisibility + * @param Context $httpContext + * @param Builder $sqlBuilder + * @param Rule $rule + * @param Conditions $conditionsHelper + * @param CategoryRepositoryInterface $categoryRepository * @param array $data * @param Json|null $json * @param LayoutFactory|null $layoutFactory - * @param \Magento\Framework\Url\EncoderInterface|null $urlEncoder + * @param EncoderInterface|null $urlEncoder * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Catalog\Block\Product\Context $context, - \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory, - \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, - \Magento\Framework\App\Http\Context $httpContext, - \Magento\Rule\Model\Condition\Sql\Builder $sqlBuilder, - \Magento\CatalogWidget\Model\Rule $rule, - \Magento\Widget\Helper\Conditions $conditionsHelper, + CollectionFactory $productCollectionFactory, + Visibility $catalogProductVisibility, + Context $httpContext, + Builder $sqlBuilder, + Rule $rule, + Conditions $conditionsHelper, + CategoryRepositoryInterface $categoryRepository, array $data = [], Json $json = null, LayoutFactory $layoutFactory = null, @@ -151,6 +173,7 @@ public function __construct( $this->json = $json ?: ObjectManager::getInstance()->get(Json::class); $this->layoutFactory = $layoutFactory ?: ObjectManager::getInstance()->get(LayoutFactory::class); $this->urlEncoder = $urlEncoder ?: ObjectManager::getInstance()->get(EncoderInterface::class); + $this->categoryRepository = $categoryRepository; parent::__construct( $context, $data @@ -171,10 +194,14 @@ protected function _construct() ->addColumnCountLayoutDepend('2columns-right', 4) ->addColumnCountLayoutDepend('3columns', 3); - $this->addData([ - 'cache_lifetime' => 86400, - 'cache_tags' => [\Magento\Catalog\Model\Product::CACHE_TAG, - ], ]); + $this->addData( + [ + 'cache_lifetime' => 86400, + 'cache_tags' => [ + Product::CACHE_TAG, + ], + ] + ); } /** @@ -182,6 +209,7 @@ protected function _construct() * * @return array * @SuppressWarnings(PHPMD.RequestAwareBlockMethod) + * @throws NoSuchEntityException */ public function getCacheKeyInfo() { @@ -195,7 +223,7 @@ public function getCacheKeyInfo() $this->_storeManager->getStore()->getId(), $this->_design->getDesignTheme()->getId(), $this->httpContext->getValue(\Magento\Customer\Model\Context::CONTEXT_GROUP), - (int) $this->getRequest()->getParam($this->getData('page_var_name'), 1), + (int)$this->getRequest()->getParam($this->getData('page_var_name'), 1), $this->getProductsPerPage(), $this->getProductsCount(), $conditions, @@ -210,7 +238,7 @@ public function getCacheKeyInfo() * @SuppressWarnings(PHPMD.NPathComplexity) */ public function getProductPriceHtml( - \Magento\Catalog\Model\Product $product, + Product $product, $priceType = null, $renderZone = \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, array $arguments = [] @@ -239,7 +267,7 @@ public function getProductPriceHtml( } $price = $priceRender->render( - \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, + FinalPrice::PRICE_CODE, $product, $arguments ); @@ -253,7 +281,7 @@ public function getProductPriceHtml( protected function getDetailsRendererList() { if (empty($this->rendererListBlock)) { - /** @var $layout \Magento\Framework\View\LayoutInterface */ + /** @var $layout LayoutInterface */ $layout = $this->layoutFactory->create(['cacheable' => false]); $layout->getUpdate()->addHandle('catalog_widget_product_list')->load(); $layout->generateXml(); @@ -294,12 +322,13 @@ protected function _beforeToHtml() /** * Prepare and return product collection * - * @return \Magento\Catalog\Model\ResourceModel\Product\Collection + * @return Collection * @SuppressWarnings(PHPMD.RequestAwareBlockMethod) + * @throws LocalizedException */ public function createCollection() { - /** @var $collection \Magento\Catalog\Model\ResourceModel\Product\Collection */ + /** @var $collection Collection */ $collection = $this->productCollectionFactory->create(); if ($this->getData('store_id') !== null) { @@ -327,10 +356,38 @@ public function createCollection() return $collection; } + /** + * Update conditions if the category is an anchor category + * + * @param array $condition + * @return array + */ + private function updateAnchorCategoryConditions(array $condition): array + { + if (array_key_exists('value', $condition)) { + $categoryId = $condition['value']; + + try { + $category = $this->categoryRepository->get($categoryId, $this->_storeManager->getStore()->getId()); + } catch (NoSuchEntityException $e) { + return $condition; + } + + if ($category->getIsAnchor() && $category->getChildren()) { + $children = explode(',', $category->getChildren()); + + $condition['operator'] = "()"; + $condition['value'] = array_merge([$categoryId], $children); + } + } + + return $condition; + } + /** * Get conditions * - * @return \Magento\Rule\Model\Condition\Combine + * @return Combine */ protected function getConditions() { @@ -343,10 +400,14 @@ protected function getConditions() } foreach ($conditions as $key => $condition) { - if (!empty($condition['attribute']) - && in_array($condition['attribute'], ['special_from_date', 'special_to_date']) - ) { - $conditions[$key]['value'] = date('Y-m-d H:i:s', strtotime($condition['value'])); + if (!empty($condition['attribute'])) { + if (in_array($condition['attribute'], ['special_from_date', 'special_to_date'])) { + $conditions[$key]['value'] = date('Y-m-d H:i:s', strtotime($condition['value'])); + } + + if ($condition['attribute'] == 'category_ids') { + $conditions[$key] = $this->updateAnchorCategoryConditions($condition); + } } } @@ -412,13 +473,14 @@ protected function getPageSize() * Render pagination HTML * * @return string + * @throws LocalizedException */ public function getPagerHtml() { if ($this->showPager() && $this->getProductCollection()->getSize() > $this->getProductsPerPage()) { if (!$this->pager) { $this->pager = $this->getLayout()->createBlock( - \Magento\Catalog\Block\Product\Widget\Html\Pager::class, + Pager::class, $this->getWidgetPagerBlockName() ); @@ -448,12 +510,12 @@ public function getIdentities() if ($this->getProductCollection()) { foreach ($this->getProductCollection() as $product) { if ($product instanceof IdentityInterface) { - $identities = array_merge($identities, $product->getIdentities()); + $identities += $product->getIdentities(); } } } - return $identities ?: [\Magento\Catalog\Model\Product::CACHE_TAG]; + return $identities ?: [Product::CACHE_TAG]; } /** @@ -475,7 +537,7 @@ public function getTitle() private function getPriceCurrency() { if ($this->priceCurrency === null) { - $this->priceCurrency = \Magento\Framework\App\ObjectManager::getInstance() + $this->priceCurrency = ObjectManager::getInstance() ->get(PriceCurrencyInterface::class); } return $this->priceCurrency; diff --git a/dev/tests/integration/testsuite/Magento/CatalogWidget/Block/Product/ProductListTest.php b/dev/tests/integration/testsuite/Magento/CatalogWidget/Block/Product/ProductListTest.php index 85cd5331a29c4..1ca8485ddbd26 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogWidget/Block/Product/ProductListTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogWidget/Block/Product/ProductListTest.php @@ -6,27 +6,39 @@ namespace Magento\CatalogWidget\Block\Product; +use Magento\Catalog\Model\Indexer\Product\Eav\Processor; +use Magento\Catalog\Model\ResourceModel\Category\Collection as CategoryCollection; +use Magento\Catalog\Model\ResourceModel\Eav\Attribute; +use Magento\Framework\ObjectManagerInterface; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; + /** * Tests for @see \Magento\CatalogWidget\Block\Product\ProductsList */ -class ProductListTest extends \PHPUnit\Framework\TestCase +class ProductListTest extends TestCase { /** - * @var \Magento\CatalogWidget\Block\Product\ProductsList + * @var ProductsList */ protected $block; /** - * @var \Magento\Framework\ObjectManagerInterface + * @var CategoryCollection; + + */ + private $categoryCollection; + + /** + * @var ObjectManagerInterface */ protected $objectManager; protected function setUp() { - $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->block = $this->objectManager->create( - \Magento\CatalogWidget\Block\Product\ProductsList::class - ); + $this->objectManager = Bootstrap::getObjectManager(); + $this->block = $this->objectManager->create(ProductsList::class); + $this->categoryCollection = $this->objectManager->create(CategoryCollection::class); } /** @@ -44,16 +56,16 @@ protected function setUp() public function testCreateCollection() { // Reindex EAV attributes to enable products filtration by created multiselect attribute - /** @var \Magento\Catalog\Model\Indexer\Product\Eav\Processor $eavIndexerProcessor */ + /** @var Processor $eavIndexerProcessor */ $eavIndexerProcessor = $this->objectManager->get( - \Magento\Catalog\Model\Indexer\Product\Eav\Processor::class + Processor::class ); $eavIndexerProcessor->reindexAll(); // Prepare conditions - /** @var $attribute \Magento\Catalog\Model\ResourceModel\Eav\Attribute */ - $attribute = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - \Magento\Catalog\Model\ResourceModel\Eav\Attribute::class + /** @var $attribute Attribute */ + $attribute = Bootstrap::getObjectManager()->create( + Attribute::class ); $attribute->load('multiselect_attribute', 'attribute_code'); $multiselectAttributeOptionIds = []; @@ -87,9 +99,9 @@ public function testCreateCollection() */ public function testCreateCollectionWithDropdownAttribute() { - /** @var $attribute \Magento\Catalog\Model\ResourceModel\Eav\Attribute */ - $attribute = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - \Magento\Catalog\Model\ResourceModel\Eav\Attribute::class + /** @var $attribute Attribute */ + $attribute = Bootstrap::getObjectManager()->create( + Attribute::class ); $attribute->load('dropdown_attribute', 'attribute_code'); $dropdownAttributeOptionIds = []; @@ -119,6 +131,7 @@ public function testCreateCollectionWithDropdownAttribute() * * @param int $count * @return void + * @throws \Magento\Framework\Exception\LocalizedException */ private function performAssertions(int $count) { @@ -142,6 +155,7 @@ private function performAssertions(int $count) * @param string $encodedConditions * @param string $sku * @return void + * @throws \Magento\Framework\Exception\LocalizedException */ public function testCreateCollectionForSku($encodedConditions, $sku) { @@ -179,6 +193,7 @@ public function createCollectionForSkuDataProvider() * @magentoDbIsolation disabled * @magentoDataFixture Magento/Catalog/_files/product_simple_with_date_attribute.php * @return void + * @throws \Magento\Framework\Exception\LocalizedException */ public function testProductListWithDateAttribute() { @@ -197,4 +212,48 @@ public function testProductListWithDateAttribute() "Product collection was not filtered according to the widget condition." ); } + + /** + * Make sure CatalogWidget would display anchor category products recursively from children categories. + * + * 1. Create an anchor root category and a sub category inside it + * 2. Create 2 new products and assign them to the sub categories + * 3. Create product list widget condition to display products from the anchor root category + * 4. Load collection for product list widget and make sure that number of loaded products is correct + * + * @magentoDbIsolation disabled + * @magentoDataFixture Magento/Catalog/_files/product_in_multiple_categories.php + */ + public function testCreateAnchorCollection() + { + // Reindex EAV attributes to enable products filtration by created multiselect attribute + /** @var Processor $eavIndexerProcessor */ + $eavIndexerProcessor = $this->objectManager->get( + Processor::class + ); + $eavIndexerProcessor->reindexAll(); + + $this->categoryCollection->addNameToResult()->load(); + $rootCategoryId = $this + ->categoryCollection + ->getItemByColumnValue('name', 'Default Category') + ->getId(); + + $encodedConditions = '^[`1`:^[`type`:`Magento||CatalogWidget||Model||Rule||Condition||Combine`, + `aggregator`:`all`,`value`:`1`,`new_child`:``^], + `1--1`:^[`type`:`Magento||CatalogWidget||Model||Rule||Condition||Product`, + `attribute`:`category_ids`, + `operator`:`==`,`value`:`' . $rootCategoryId . '`^]^]'; + + $this->block->setData('conditions_encoded', $encodedConditions); + + $productCollection = $this->block->createCollection(); + $productCollection->load(); + + $this->assertEquals( + 2, + $productCollection->count(), + "Anchor root category does not contain products of it's children." + ); + } } From 37a9929ad036fd8e8309111d87f8ce7f1e0e35cc Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Fri, 6 Dec 2019 08:19:27 +0700 Subject: [PATCH 0244/1143] Resolve A "500 (Internal Server Error)" appears in Developer Console if Delete the image that is added to Page Content issue25893 --- .../Adminhtml/Wysiwyg/Directive.php | 17 ++++++++--- .../Adminhtml/Wysiwyg/DirectiveTest.php | 29 +++++++++++++++++++ 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Directive.php b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Directive.php index b21ea9fd7ef7b..db53c6a415ddd 100644 --- a/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Directive.php +++ b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Directive.php @@ -4,6 +4,9 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + +declare(strict_types=1); + namespace Magento\Cms\Controller\Adminhtml\Wysiwyg; use Magento\Backend\App\Action; @@ -13,6 +16,8 @@ /** * Process template text for wysiwyg editor. + * + * Class Directive */ class Directive extends Action implements HttpGetActionInterface { @@ -73,10 +78,14 @@ public function execute() /** @var Config $config */ $config = $this->_objectManager->get(Config::class); $imagePath = $config->getSkinImagePlaceholderPath(); - $image->open($imagePath); - $resultRaw->setHeader('Content-Type', $image->getMimeType()); - $resultRaw->setContents($image->getImage()); - $this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e); + try { + $image->open($imagePath); + $resultRaw->setHeader('Content-Type', $image->getMimeType()); + $resultRaw->setContents($image->getImage()); + $this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e); + } catch (\Exception $e) { + $this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e); + } } return $resultRaw; } diff --git a/app/code/Magento/Cms/Test/Unit/Controller/Adminhtml/Wysiwyg/DirectiveTest.php b/app/code/Magento/Cms/Test/Unit/Controller/Adminhtml/Wysiwyg/DirectiveTest.php index 16b218ebf6493..85c48e3fa3b7d 100644 --- a/app/code/Magento/Cms/Test/Unit/Controller/Adminhtml/Wysiwyg/DirectiveTest.php +++ b/app/code/Magento/Cms/Test/Unit/Controller/Adminhtml/Wysiwyg/DirectiveTest.php @@ -274,4 +274,33 @@ protected function prepareExecuteTest() ->method('create') ->willReturn($this->imageAdapterMock); } + + /** + * Test Execute With Deleted Image + * + * @covers \Magento\Cms\Controller\Adminhtml\Wysiwyg\Directive::execute + */ + public function testExecuteWithDeletedImage() + { + $exception = new \Exception('epic fail'); + $placeholderPath = 'pub/static/adminhtml/Magento/backend/en_US/Magento_Cms/images/wysiwyg_skin_image.png'; + $this->prepareExecuteTest(); + + $this->imageAdapterMock->expects($this->at(0)) + ->method('open') + ->with(self::IMAGE_PATH) + ->willThrowException($exception); + $this->wysiwygConfigMock->expects($this->once()) + ->method('getSkinImagePlaceholderPath') + ->willReturn($placeholderPath); + $this->imageAdapterMock->expects($this->at(1)) + ->method('open') + ->willThrowException($exception); + + $this->loggerMock->expects($this->once()) + ->method('critical') + ->with($exception); + + $this->wysiwygDirective->execute(); + } } From 66bf8d18bf6d5f88ffd5dc674106c52a8fd066a2 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Fri, 6 Dec 2019 08:21:24 +0700 Subject: [PATCH 0245/1143] Unit Test for Directive --- .../Unit/Controller/Adminhtml/Wysiwyg/DirectiveTest.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Cms/Test/Unit/Controller/Adminhtml/Wysiwyg/DirectiveTest.php b/app/code/Magento/Cms/Test/Unit/Controller/Adminhtml/Wysiwyg/DirectiveTest.php index 85c48e3fa3b7d..cede3a80cb98b 100644 --- a/app/code/Magento/Cms/Test/Unit/Controller/Adminhtml/Wysiwyg/DirectiveTest.php +++ b/app/code/Magento/Cms/Test/Unit/Controller/Adminhtml/Wysiwyg/DirectiveTest.php @@ -286,15 +286,18 @@ public function testExecuteWithDeletedImage() $placeholderPath = 'pub/static/adminhtml/Magento/backend/en_US/Magento_Cms/images/wysiwyg_skin_image.png'; $this->prepareExecuteTest(); - $this->imageAdapterMock->expects($this->at(0)) + $this->imageAdapterMock->expects($this->any()) ->method('open') ->with(self::IMAGE_PATH) ->willThrowException($exception); + $this->wysiwygConfigMock->expects($this->once()) ->method('getSkinImagePlaceholderPath') ->willReturn($placeholderPath); - $this->imageAdapterMock->expects($this->at(1)) + + $this->imageAdapterMock->expects($this->any()) ->method('open') + ->with($placeholderPath) ->willThrowException($exception); $this->loggerMock->expects($this->once()) From 35493855269d06d80ed2e13b62c50c62069711f7 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Fri, 6 Dec 2019 09:54:09 +0200 Subject: [PATCH 0246/1143] Static test fix. --- .../Catalog/Model/ResourceModel/Product/CollectionTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Product/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Product/CollectionTest.php index e8d472fb98c6f..2100920ab8ac9 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Product/CollectionTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Product/CollectionTest.php @@ -14,7 +14,7 @@ use Magento\TestFramework\Helper\Bootstrap; /** - * Collection test + * Test for Magento\Catalog\Model\ResourceModel\Product\Collection * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ From f9a510a10ed9cf8a3c8a1f0f4ffd374b59333f82 Mon Sep 17 00:00:00 2001 From: Serhiy Yelahin <serhiy.yelahin@transoftgroup.com> Date: Fri, 6 Dec 2019 15:04:15 +0200 Subject: [PATCH 0247/1143] MC-23900: Authorize Net issue on the admin order creation page --- .../Magento/Sales/view/adminhtml/web/order/create/scripts.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js b/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js index 4e07414510748..8803e2ea48f02 100644 --- a/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js +++ b/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js @@ -482,11 +482,6 @@ define([ }, switchPaymentMethod: function(method){ - jQuery('#edit_form') - .off('submitOrder') - .on('submitOrder', function(){ - jQuery(this).trigger('realOrder'); - }); jQuery('#edit_form').trigger('changePaymentMethod', [method]); this.setPaymentMethod(method); var data = {}; From fbea751258747182da71d1175e466405c80b01ab Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Mon, 2 Dec 2019 12:49:27 +0200 Subject: [PATCH 0248/1143] magento/magento2#22856: Integration tests fix. --- .../Product/Option/DataProvider/Type/File.php | 120 +++++++++++------- 1 file changed, 73 insertions(+), 47 deletions(-) diff --git a/dev/tests/integration/framework/Magento/TestFramework/Catalog/Model/Product/Option/DataProvider/Type/File.php b/dev/tests/integration/framework/Magento/TestFramework/Catalog/Model/Product/Option/DataProvider/Type/File.php index 35f449a404410..d2aa20a005ec4 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Catalog/Model/Product/Option/DataProvider/Type/File.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Catalog/Model/Product/Option/DataProvider/Type/File.php @@ -8,7 +8,7 @@ namespace Magento\TestFramework\Catalog\Model\Product\Option\DataProvider\Type; use Magento\Catalog\Api\Data\ProductCustomOptionInterface; -use Magento\TestFramework\Catalog\Model\Product\Option\DataProvider\Type\AbstractBase; +use Magento\Catalog\Model\Product\Option; /** * Data provider for options from file group with type "file". @@ -20,41 +20,44 @@ class File extends AbstractBase */ public function getDataForCreateOptions(): array { - return array_merge_recursive( - parent::getDataForCreateOptions(), - [ - "type_{$this->getType()}_option_file_extension" => [ - [ - 'record_id' => 0, - 'sort_order' => 1, - 'is_require' => 1, - 'sku' => 'test-option-title-1', - 'max_characters' => 30, - 'title' => 'Test option title 1', - 'type' => $this->getType(), - 'price' => 10, - 'price_type' => 'fixed', - 'file_extension' => 'gif', - 'image_size_x' => 10, - 'image_size_y' => 20, + return $this->injectFileExtension( + array_merge_recursive( + parent::getDataForCreateOptions(), + [ + "type_{$this->getType()}_option_file_extension" => [ + [ + 'record_id' => 0, + 'sort_order' => 1, + 'is_require' => 1, + 'sku' => 'test-option-title-1', + 'max_characters' => 30, + 'title' => 'Test option title 1', + 'type' => $this->getType(), + 'price' => 10, + 'price_type' => 'fixed', + 'file_extension' => 'gif', + 'image_size_x' => 10, + 'image_size_y' => 20, + ], ], - ], - "type_{$this->getType()}_option_maximum_file_size" => [ - [ - 'record_id' => 0, - 'sort_order' => 1, - 'is_require' => 1, - 'sku' => 'test-option-title-1', - 'title' => 'Test option title 1', - 'type' => $this->getType(), - 'price' => 10, - 'price_type' => 'fixed', - 'file_extension' => 'gif', - 'image_size_x' => 10, - 'image_size_y' => 20, + "type_{$this->getType()}_option_maximum_file_size" => [ + [ + 'record_id' => 0, + 'sort_order' => 1, + 'is_require' => 1, + 'sku' => 'test-option-title-1', + 'title' => 'Test option title 1', + 'type' => $this->getType(), + 'price' => 10, + 'price_type' => 'fixed', + 'file_extension' => 'gif', + 'image_size_x' => 10, + 'image_size_y' => 20, + ], ], - ], - ] + ] + ), + 'png' ); } @@ -63,21 +66,24 @@ public function getDataForCreateOptions(): array */ public function getDataForUpdateOptions(): array { - return array_merge_recursive( - parent::getDataForUpdateOptions(), - [ - "type_{$this->getType()}_option_file_extension" => [ - [ - 'file_extension' => 'jpg', + return $this->injectFileExtension( + array_merge_recursive( + parent::getDataForUpdateOptions(), + [ + "type_{$this->getType()}_option_file_extension" => [ + [ + 'file_extension' => 'jpg', + ], ], - ], - "type_{$this->getType()}_option_maximum_file_size" => [ - [ - 'image_size_x' => 300, - 'image_size_y' => 815, + "type_{$this->getType()}_option_maximum_file_size" => [ + [ + 'image_size_x' => 300, + 'image_size_y' => 815, + ], ], - ], - ] + ] + ), + '' ); } @@ -88,4 +94,24 @@ protected function getType(): string { return ProductCustomOptionInterface::OPTION_TYPE_FILE; } + + /** + * Add 'file_extension' value to each option. + * + * @param array $data + * @param string $extension + * @return array + */ + private function injectFileExtension(array $data, string $extension): array + { + foreach ($data as &$caseData) { + foreach ($caseData as &$option) { + if (!isset($option[Option::KEY_FILE_EXTENSION])) { + $option[Option::KEY_FILE_EXTENSION] = $extension; + } + } + } + + return $data; + } } From 0bab1dcec3c03b6304d54a488fdfcecaaef93397 Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko <lytvynen@adobe.com> Date: Fri, 6 Dec 2019 10:48:42 -0600 Subject: [PATCH 0249/1143] MC-29167: CatalogWidget products list doesn't work with anchor category --- app/code/Magento/CatalogWidget/Block/Product/ProductsList.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php b/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php index 31863eafe85bf..4521d268817b4 100644 --- a/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php +++ b/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php @@ -48,6 +48,7 @@ class ProductsList extends AbstractProduct implements BlockInterface, IdentityIn * Name of request parameter for page number value * * @deprecated + * @see $this->getData('page_var_name') */ const PAGE_VAR_NAME = 'np'; From b929cc709f54512558e5daa10aea6613da2e87fa Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko <lytvynen@adobe.com> Date: Fri, 6 Dec 2019 11:23:07 -0600 Subject: [PATCH 0250/1143] MC-29167: CatalogWidget products list doesn't work with anchor category --- app/code/Magento/CatalogWidget/Block/Product/ProductsList.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php b/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php index 4521d268817b4..a27f5a3dc5e52 100644 --- a/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php +++ b/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php @@ -47,8 +47,7 @@ class ProductsList extends AbstractProduct implements BlockInterface, IdentityIn /** * Name of request parameter for page number value * - * @deprecated - * @see $this->getData('page_var_name') + * @deprecated @see $this->getData('page_var_name') */ const PAGE_VAR_NAME = 'np'; From dc8821dc2e297c1b73064ea49c1c4e7253b7e84f Mon Sep 17 00:00:00 2001 From: sdovbenko <sdovbenko@magecom.us> Date: Fri, 6 Dec 2019 19:44:52 +0200 Subject: [PATCH 0251/1143] Add OperationStatusPool and OperationStatusValidator --- .../Model/Operation.php | 21 +++++++++ .../Model/OperationStatusPool.php | 37 +++++++++++++++ .../Model/OperationStatusValidator.php | 47 +++++++++++++++++++ .../Magento/AsynchronousOperations/etc/di.xml | 11 +++++ 4 files changed, 116 insertions(+) create mode 100644 app/code/Magento/AsynchronousOperations/Model/OperationStatusPool.php create mode 100644 app/code/Magento/AsynchronousOperations/Model/OperationStatusValidator.php diff --git a/app/code/Magento/AsynchronousOperations/Model/Operation.php b/app/code/Magento/AsynchronousOperations/Model/Operation.php index dbe6ecc1b6b1f..9e0039d2ee151 100644 --- a/app/code/Magento/AsynchronousOperations/Model/Operation.php +++ b/app/code/Magento/AsynchronousOperations/Model/Operation.php @@ -6,6 +6,7 @@ namespace Magento\AsynchronousOperations\Model; use Magento\AsynchronousOperations\Api\Data\OperationInterface; +use Magento\AsynchronousOperations\Model\OperationStatusValidator; use Magento\Framework\DataObject; /** @@ -13,6 +14,25 @@ */ class Operation extends DataObject implements OperationInterface { + /** + * @var OperationStatusValidator + */ + protected $operationStatusValidator; + + /** + * Operation constructor. + * + * @param array $data + * @param OperationStatusValidator $operationStatusValidator + */ + public function __construct( + array $data = [], + OperationStatusValidator $operationStatusValidator + ) { + $this->operationStatusValidator = $operationStatusValidator; + parent::__construct($data); + } + /** * @inheritDoc */ @@ -106,6 +126,7 @@ public function getStatus() */ public function setStatus($status) { + $this->operationStatusValidator->validate($status); return $this->setData(self::STATUS, $status); } diff --git a/app/code/Magento/AsynchronousOperations/Model/OperationStatusPool.php b/app/code/Magento/AsynchronousOperations/Model/OperationStatusPool.php new file mode 100644 index 0000000000000..73eeedbdb7a20 --- /dev/null +++ b/app/code/Magento/AsynchronousOperations/Model/OperationStatusPool.php @@ -0,0 +1,37 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\AsynchronousOperations\Model; + +/** + * Class OperationStatusPool + * + * Pool of statuses that require validate + */ +class OperationStatusPool +{ + /** + * @var array + */ + protected $statuses; + + /** + * @param array $statuses + */ + public function __construct(array $statuses = []) + { + $this->statuses = $statuses; + } + + /** + * Retrieve statuses that require validate + * + * @return array + */ + public function getStatuses() + { + return $this->statuses; + } +} diff --git a/app/code/Magento/AsynchronousOperations/Model/OperationStatusValidator.php b/app/code/Magento/AsynchronousOperations/Model/OperationStatusValidator.php new file mode 100644 index 0000000000000..3da94f1c4d7fb --- /dev/null +++ b/app/code/Magento/AsynchronousOperations/Model/OperationStatusValidator.php @@ -0,0 +1,47 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\AsynchronousOperations\Model; + +use Magento\AsynchronousOperations\Model\OperationStatusPool; +use Magento\Framework\Exception\NoSuchEntityException; +use Doctrine\Instantiator\Exception\InvalidArgumentException; + +/** + * Class OperationStatusValidator to validate operation status + */ +class OperationStatusValidator +{ + /** + * @var OperationStatusPool + */ + protected $operationStatusPool; + + /** + * OperationStatusValidator constructor. + * + * @param OperationStatusPool $operationStatusPool + */ + public function __construct(OperationStatusPool $operationStatusPool) + { + $this->operationStatusPool = $operationStatusPool; + } + + /** + * Validate method + * + * @param $status + */ + public function validate($status) + { + $statuses = $this->operationStatusPool->getStatuses(); + + if (!in_array($status, $statuses)) { + throw new \InvalidArgumentException('Invalid Operation Status.'); + } + + return; + } +} diff --git a/app/code/Magento/AsynchronousOperations/etc/di.xml b/app/code/Magento/AsynchronousOperations/etc/di.xml index 94a4c56c19cea..171a01cedf289 100644 --- a/app/code/Magento/AsynchronousOperations/etc/di.xml +++ b/app/code/Magento/AsynchronousOperations/etc/di.xml @@ -80,6 +80,17 @@ </argument> </arguments> </type> + <type name="Magento\AsynchronousOperations\Model\OperationStatusPool"> + <arguments> + <argument name="statuses" xsi:type="array"> + <item name="complete" xsi:type="string">1</item> + <item name="retriablyFailed" xsi:type="string">2</item> + <item name="notRetriablyFailed" xsi:type="string">3</item> + <item name="open" xsi:type="string">4</item> + <item name="rejected" xsi:type="string">5</item> + </argument> + </arguments> + </type> <virtualType name="Magento\AsynchronousOperations\Ui\Component\DataProvider" type="Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider"/> From f305a84472fc0222147844ffa83542c01cd1c023 Mon Sep 17 00:00:00 2001 From: sdovbenko <sdovbenko@magecom.us> Date: Fri, 6 Dec 2019 20:12:55 +0200 Subject: [PATCH 0252/1143] Changed protected to private modifier --- app/code/Magento/AsynchronousOperations/Model/Operation.php | 2 +- .../AsynchronousOperations/Model/OperationStatusPool.php | 2 +- .../AsynchronousOperations/Model/OperationStatusValidator.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/AsynchronousOperations/Model/Operation.php b/app/code/Magento/AsynchronousOperations/Model/Operation.php index 9e0039d2ee151..de2b56d0a0dd7 100644 --- a/app/code/Magento/AsynchronousOperations/Model/Operation.php +++ b/app/code/Magento/AsynchronousOperations/Model/Operation.php @@ -17,7 +17,7 @@ class Operation extends DataObject implements OperationInterface /** * @var OperationStatusValidator */ - protected $operationStatusValidator; + private $operationStatusValidator; /** * Operation constructor. diff --git a/app/code/Magento/AsynchronousOperations/Model/OperationStatusPool.php b/app/code/Magento/AsynchronousOperations/Model/OperationStatusPool.php index 73eeedbdb7a20..890eb8c1c8c75 100644 --- a/app/code/Magento/AsynchronousOperations/Model/OperationStatusPool.php +++ b/app/code/Magento/AsynchronousOperations/Model/OperationStatusPool.php @@ -15,7 +15,7 @@ class OperationStatusPool /** * @var array */ - protected $statuses; + private $statuses; /** * @param array $statuses diff --git a/app/code/Magento/AsynchronousOperations/Model/OperationStatusValidator.php b/app/code/Magento/AsynchronousOperations/Model/OperationStatusValidator.php index 3da94f1c4d7fb..ae154edfb50f7 100644 --- a/app/code/Magento/AsynchronousOperations/Model/OperationStatusValidator.php +++ b/app/code/Magento/AsynchronousOperations/Model/OperationStatusValidator.php @@ -17,7 +17,7 @@ class OperationStatusValidator /** * @var OperationStatusPool */ - protected $operationStatusPool; + private $operationStatusPool; /** * OperationStatusValidator constructor. From 345ece3f5277c1add6a1fd31cf8c830b3615c96f Mon Sep 17 00:00:00 2001 From: sdovbenko <sdovbenko@magecom.us> Date: Fri, 6 Dec 2019 20:13:59 +0200 Subject: [PATCH 0253/1143] Added OperationStatusValidatorTest class to Unit --- .../Model/OperationStatusValidatorTest.php | 155 ++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 app/code/Magento/AsynchronousOperations/Test/Unit/Model/OperationStatusValidatorTest.php diff --git a/app/code/Magento/AsynchronousOperations/Test/Unit/Model/OperationStatusValidatorTest.php b/app/code/Magento/AsynchronousOperations/Test/Unit/Model/OperationStatusValidatorTest.php new file mode 100644 index 0000000000000..2209564d03aee --- /dev/null +++ b/app/code/Magento/AsynchronousOperations/Test/Unit/Model/OperationStatusValidatorTest.php @@ -0,0 +1,155 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\AsynchronousOperations\Test\Unit\Model; + +use Magento\AsynchronousOperations\Model\OperationStatusValidator; +use Magento\AsynchronousOperations\Model\Operation; +use Magento\AsynchronousOperations\Model\OperationStatusPool; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use PHPUnit\Framework\TestCase; + +/** + * Class OperationStatusValidatorTest + */ +class OperationStatusValidatorTest extends TestCase +{ + /** + * @var OperationStatusPool + */ + private $operationStatusPool; + + /** + * @var OperationStatusValidator + */ + private $operationStatusValidator; + + /** + * @var Operation + */ + private $operation; + + protected function setUp() + { + $this->operationStatusPool = $this->getMockBuilder(OperationStatusPool::class) + ->disableOriginalConstructor() + ->getMock(); + + $objectManager = new ObjectManager($this); + + $this->operationStatusValidator = $objectManager->getObject( + OperationStatusValidator::class, + [ + 'operationStatusPool' => $this->operationStatusPool + ] + ); + + $this->operation = $objectManager->getObject( + Operation::class, + [ + 'operationStatusValidator' => $this->operationStatusValidator + ] + ); + } + + /** + * @param string $status + * @param array $statusPool + * @param string $expectedResult + * @dataProvider dataProviderForTestSetStatus + */ + public function testSetStatus ( + string $status, + array $statusPool, + string $expectedResult + ) { + $this->operationStatusPool + ->expects($this->any()) + ->method('getStatuses') + ->willReturn($statusPool); + + try { + $this->operation->setStatus($status); + $this->assertEquals($expectedResult, $this->operation->getStatus()); + } catch (\Exception $exception) { + $this->assertEquals($expectedResult, $exception->getMessage()); + } + } + + /** + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function dataProviderForTestSetStatus() + { + return [ + [ + 'status' => 0, + 'statusPool' => [ + 'complete' => 1, + 'retriablyFailed' => 2, + 'notRetriablyFailed' => 3, + 'open' => 4, + 'rejected' => 5 + ], + 'expectedResult' => 'Invalid Operation Status.' + ], + [ + 'status' => 1, + 'statusPool' => [ + 'complete' => 1, + 'retriablyFailed' => 2, + 'notRetriablyFailed' => 3, + 'open' => 4, + 'rejected' => 5 + ], + 'expectedResult' => 1 + ], + [ + 'status' => 2, + 'statusPool' => [ + 'complete' => 1, + 'retriablyFailed' => 2, + 'notRetriablyFailed' => 3, + 'open' => 4, + 'rejected' => 5 + ], + 'expectedResult' => 2 + ], + [ + 'status' => 3, + 'statusPool' => [ + 'complete' => 1, + 'retriablyFailed' => 2, + 'notRetriablyFailed' => 3, + 'open' => 4, + 'rejected' => 5 + ], + 'expectedResult' => 3 + ], + [ + 'status' => 4, + 'statusPool' => [ + 'complete' => 1, + 'retriablyFailed' => 2, + 'notRetriablyFailed' => 3, + 'open' => 4, + 'rejected' => 5 + ], + 'expectedResult' => 4 + ], + [ + 'status' => 5, + 'statusPool' => [ + 'complete' => 1, + 'retriablyFailed' => 2, + 'notRetriablyFailed' => 3, + 'open' => 4, + 'rejected' => 5 + ], + 'expectedResult' => 5 + ] + ]; + } +} From b1e518ca649a862abca2856db0c99d385ba964a3 Mon Sep 17 00:00:00 2001 From: Sergey Dovbenko <sdovbenko@magecom.us> Date: Fri, 6 Dec 2019 18:16:25 +0000 Subject: [PATCH 0254/1143] Corrected Code Styles --- .../Magento/AsynchronousOperations/Model/Operation.php | 8 ++++---- .../Model/OperationStatusValidator.php | 6 +++--- .../Test/Unit/Model/OperationStatusValidatorTest.php | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/AsynchronousOperations/Model/Operation.php b/app/code/Magento/AsynchronousOperations/Model/Operation.php index de2b56d0a0dd7..00f33d10a1e1b 100644 --- a/app/code/Magento/AsynchronousOperations/Model/Operation.php +++ b/app/code/Magento/AsynchronousOperations/Model/Operation.php @@ -10,7 +10,7 @@ use Magento\Framework\DataObject; /** - * Class Operation + * Class Operation encapsulates methods for Operation Model Object */ class Operation extends DataObject implements OperationInterface { @@ -22,12 +22,12 @@ class Operation extends DataObject implements OperationInterface /** * Operation constructor. * - * @param array $data * @param OperationStatusValidator $operationStatusValidator + * @param array $data */ public function __construct( - array $data = [], - OperationStatusValidator $operationStatusValidator + OperationStatusValidator $operationStatusValidator, + array $data = [] ) { $this->operationStatusValidator = $operationStatusValidator; parent::__construct($data); diff --git a/app/code/Magento/AsynchronousOperations/Model/OperationStatusValidator.php b/app/code/Magento/AsynchronousOperations/Model/OperationStatusValidator.php index ae154edfb50f7..f2ae135e4303c 100644 --- a/app/code/Magento/AsynchronousOperations/Model/OperationStatusValidator.php +++ b/app/code/Magento/AsynchronousOperations/Model/OperationStatusValidator.php @@ -32,7 +32,9 @@ public function __construct(OperationStatusPool $operationStatusPool) /** * Validate method * - * @param $status + * @param int $status + * @throws \InvalidArgumentException + * @return void */ public function validate($status) { @@ -41,7 +43,5 @@ public function validate($status) if (!in_array($status, $statuses)) { throw new \InvalidArgumentException('Invalid Operation Status.'); } - - return; } } diff --git a/app/code/Magento/AsynchronousOperations/Test/Unit/Model/OperationStatusValidatorTest.php b/app/code/Magento/AsynchronousOperations/Test/Unit/Model/OperationStatusValidatorTest.php index 2209564d03aee..b93d9701a7a69 100644 --- a/app/code/Magento/AsynchronousOperations/Test/Unit/Model/OperationStatusValidatorTest.php +++ b/app/code/Magento/AsynchronousOperations/Test/Unit/Model/OperationStatusValidatorTest.php @@ -12,7 +12,7 @@ use PHPUnit\Framework\TestCase; /** - * Class OperationStatusValidatorTest + * Class OperationStatusValidatorTest implements logic for testing Operation::setStatus() method */ class OperationStatusValidatorTest extends TestCase { @@ -60,7 +60,7 @@ protected function setUp() * @param string $expectedResult * @dataProvider dataProviderForTestSetStatus */ - public function testSetStatus ( + public function testSetStatus( string $status, array $statusPool, string $expectedResult From 12217115413c9028658b552c9fa4b46029aaeaba Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Fri, 6 Dec 2019 15:07:18 -0600 Subject: [PATCH 0255/1143] Remove deprecated action groups that were introduced to backward compatibility --- .../ActionGroup/_Deprecated_ActionGroup.xml | 68 -- .../_Deprecated_ActionGroup.xml .xml | 139 --- .../ActionGroup/_Deprecated_ActionGroup.xml | 263 ------ .../ActionGroup/_Deprecated_ActionGroup.xml | 853 ------------------ .../ActionGroup/_Deprecated_ActionGroup.xml | 27 - .../ActionGroup/_Deprecated_ActionGroup.xml | 106 --- .../ActionGroup/_Deprecated_ActionGroup.xml | 90 -- .../ActionGroup/_Deprecated_ActionGroup.xml | 96 -- .../ActionGroup/_Deprecated_ActionGroup.xml | 19 - .../ActionGroup/_Deprecated_ActionGroup.xml | 39 - .../ActionGroup/_Deprecated_ActionGroup.xml | 28 - .../ActionGroup/_Deprecated_ActionGroup.xml | 150 --- .../ActionGroup/_Deprecated_ActionGroup.xml | 105 --- .../ActionGroup/_Deprecated_ActionGroup.xml | 673 -------------- .../ActionGroup/_Deprecated_ActionGroup.xml | 110 --- .../ActionGroup/_Deprecated_ActionGroup.xml | 51 -- .../ActionGroup/_Deprecated_ActionGroup.xml | 247 ----- .../ActionGroup/_Deprecated_ActionGroup.xml | 115 --- .../ActionGroup/_Deprecated_ActionGroup.xml | 271 ------ .../ActionGroup/_Deprecated_ActionGroup.xml | 98 -- .../ActionGroup/_Deprecated_ActionGroup.xml | 296 ------ .../ActionGroup/_Deprecated_ActionGroup.xml | 69 -- .../ActionGroup/_Deprecated_ActionGroup.xml | 99 -- 23 files changed, 4012 deletions(-) delete mode 100644 app/code/Magento/Backup/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml delete mode 100644 app/code/Magento/Braintree/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml .xml delete mode 100644 app/code/Magento/Bundle/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml delete mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml delete mode 100644 app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml delete mode 100644 app/code/Magento/Downloadable/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml delete mode 100644 app/code/Magento/Email/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml delete mode 100644 app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml delete mode 100644 app/code/Magento/Multishipping/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml delete mode 100644 app/code/Magento/Newsletter/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml delete mode 100644 app/code/Magento/PageCache/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml delete mode 100644 app/code/Magento/Paypal/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml delete mode 100644 app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml delete mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml delete mode 100644 app/code/Magento/SalesRule/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml delete mode 100644 app/code/Magento/Search/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml delete mode 100644 app/code/Magento/Store/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml delete mode 100644 app/code/Magento/Swatches/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml delete mode 100644 app/code/Magento/Tax/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml delete mode 100644 app/code/Magento/Ui/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml delete mode 100644 app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml delete mode 100644 app/code/Magento/User/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml delete mode 100644 app/code/Magento/Wishlist/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml diff --git a/app/code/Magento/Backup/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Backup/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml deleted file mode 100644 index 84c6812ddf183..0000000000000 --- a/app/code/Magento/Backup/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml +++ /dev/null @@ -1,68 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<!-- -NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. - Please find the Comment with proper replacement for each of ActionGroups provided. ---> -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="createSystemBackup"> - <annotations> - <description>Creates a System Backup using provided Backup Entity.</description> - </annotations> - <arguments> - <argument name="backup" defaultValue="SystemBackup"/> - </arguments> - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateSystemBackupActionGroup` instead --> - <click selector="{{AdminMainActionsSection.systemBackup}}" stepKey="clickCreateBackupButton"/> - <waitForElementVisible selector="{{AdminCreateBackupFormSection.backupNameField}}" stepKey="waitForForm"/> - <fillField selector="{{AdminCreateBackupFormSection.backupNameField}}" userInput="{{backup.name}}" stepKey="fillBackupName"/> - <click selector="{{AdminCreateBackupFormSection.ok}}" stepKey="clickOk"/> - <waitForElementNotVisible selector=".loading-mask" time="300" stepKey="waitForBackupProcess"/> - <see selector="{{AdminMessagesSection.success}}" userInput="You created the system backup." stepKey="seeSuccessMessage"/> - <see selector="{{AdminGridTableSection.backupNameColumn}}" userInput="{{backup.name}}" stepKey="seeBackupInGrid"/> - <see selector="{{AdminGridTableSection.backupTypeByName(backup.name)}}" userInput="{{backup.type}}" stepKey="seeBackupType"/> - </actionGroup> - - <actionGroup name="createMediaBackup"> - <annotations> - <description>Creates a Media Backup using provided Backup Entity.</description> - </annotations> - <arguments> - <argument name="backup" defaultValue="MediaBackup"/> - </arguments> - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateMediaBackupActionGroup` instead --> - <click selector="{{AdminMainActionsSection.mediaBackup}}" stepKey="clickCreateBackupButton"/> - <waitForElementVisible selector="{{AdminCreateBackupFormSection.backupNameField}}" stepKey="waitForForm"/> - <fillField selector="{{AdminCreateBackupFormSection.backupNameField}}" userInput="{{backup.name}}" stepKey="fillBackupName"/> - <click selector="{{AdminCreateBackupFormSection.ok}}" stepKey="clickOk"/> - <waitForPageLoad time="120" stepKey="waitForBackupProcess"/> - <see selector="{{AdminMessagesSection.success}}" userInput="You created the database and media backup." stepKey="seeSuccessMessage"/> - <see selector="{{AdminGridTableSection.backupNameColumn}}" userInput="{{backup.name}}" stepKey="seeBackupInGrid"/> - <see selector="{{AdminGridTableSection.backupTypeByName(backup.name)}}" userInput="{{backup.type}}" stepKey="seeBackupType"/> - </actionGroup> - - <actionGroup name="createDatabaseBackup"> - <annotations> - <description>Creates a Database Backup using provided Backup Entity.</description> - </annotations> - <arguments> - <argument name="backup" defaultValue="DatabaseBackup"/> - </arguments> - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateDatabaseBackupActionGroup` instead --> - <click selector="{{AdminMainActionsSection.databaseBackup}}" stepKey="clickCreateBackupButton"/> - <waitForElementVisible selector="{{AdminCreateBackupFormSection.backupNameField}}" stepKey="waitForForm"/> - <fillField selector="{{AdminCreateBackupFormSection.backupNameField}}" userInput="{{backup.name}}" stepKey="fillBackupName"/> - <click selector="{{AdminCreateBackupFormSection.ok}}" stepKey="clickOk"/> - <waitForPageLoad time="120" stepKey="waitForBackupProcess"/> - <see selector="{{AdminMessagesSection.success}}" userInput="You created the database backup." stepKey="seeSuccessMessage"/> - <see selector="{{AdminGridTableSection.backupNameColumn}}" userInput="{{backup.name}}" stepKey="seeBackupInGrid"/> - <see selector="{{AdminGridTableSection.backupTypeByName(backup.name)}}" userInput="{{backup.type}}" stepKey="seeBackupType"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Braintree/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml .xml b/app/code/Magento/Braintree/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml .xml deleted file mode 100644 index 5bfd2d15de72a..0000000000000 --- a/app/code/Magento/Braintree/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml .xml +++ /dev/null @@ -1,139 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<!-- -NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. - Please find the Comment with proper replacement for each of ActionGroups provided. ---> -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="GoToAllUsers"> - <annotations> - <description>Navigate to the Users page via Backend Admin Side Menu. PLEASE NOTE: Use the amOnPage action instead.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `GoToAllUsersActionGroup` instead --> - <click selector="{{AdminCreateUserSection.system}}" stepKey="clickOnSystemIcon"/> - <waitForPageLoad stepKey="waitForSystemsPageToOpen"/> - <click selector="{{AdminCreateUserSection.allUsers}}" stepKey="clickToSelectUserRoles"/> - <waitForPageLoad stepKey="waitForUserRolesPageToOpen"/> - </actionGroup> - - <actionGroup name="GoToUserRoles"> - <annotations> - <description>Navigate to the User Roles page via Backend Admin Side Menu. PLEASE NOTE: Use the amOnPage action instead.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `GoToUserRolesActionGroup` instead --> - <click selector="#menu-magento-backend-system" stepKey="clickOnSystemIcon"/> - <waitForPageLoad stepKey="waitForSystemsPageToOpen"/> - <click selector="//span[contains(text(), 'User Roles')]" stepKey="clickToSelectUserRoles"/> - <waitForPageLoad stepKey="waitForUserRolesPageToOpen"/> - </actionGroup> - - <actionGroup name="AdminCreateNewRole"> - <annotations> - <description>Creates a User Role using the provided Data.</description> - </annotations> - <arguments> - <argument name="role" type="string" defaultValue=""/> - <argument name="resource" type="string" defaultValue="All"/> - <argument name="scope" type="string" defaultValue="Custom"/> - <argument name="websites" type="string" defaultValue="Main Website"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminCreateNewRoleActionGroup` instead --> - <click selector="{{AdminCreateRoleSection.create}}" stepKey="clickToAddNewRole"/> - <fillField selector="{{AdminCreateRoleSection.name}}" userInput="{{role.name}}" stepKey="setRoleName"/> - <fillField stepKey="setPassword" selector="{{AdminCreateRoleSection.password}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}"/> - <click selector="{{AdminCreateRoleSection.roleResources}}" stepKey="clickToOpenRoleResources"/> - <waitForPageLoad stepKey="waitForRoleResourcePage" time="5"/> - <click stepKey="checkSales" selector="//a[text()='Sales']"/> - <click selector="{{AdminCreateRoleSection.save}}" stepKey="clickToSaveRole"/> - <waitForPageLoad stepKey="waitForPageLoad" time="10"/> - <see userInput="You saved the role." stepKey="seeSuccessMessage"/> - </actionGroup> - - <actionGroup name="AdminCreateUserAction"> - <annotations> - <description>Creates a User using the NewAdmin User Entity and User Role Entity. PLEASE NOTE: The Action Group values are Hardcoded.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminCreateUserActionGroup` instead --> - <click selector="{{AdminCreateUserSection.create}}" stepKey="clickToCreateNewUser"/> - <waitForPageLoad stepKey="waitForNewUserPageLoad" time="10"/> - <fillField selector="{{AdminCreateUserSection.usernameTextField}}" userInput="{{NewAdmin.username}}" stepKey="enterUserName"/> - <fillField selector="{{AdminCreateUserSection.firstNameTextField}}" userInput="{{NewAdmin.firstName}}" stepKey="enterFirstName"/> - <fillField selector="{{AdminCreateUserSection.lastNameTextField}}" userInput="{{NewAdmin.lastName}}" stepKey="enterLastName"/> - <fillField selector="{{AdminCreateUserSection.emailTextField}}" userInput="{{NewAdmin.email}}" stepKey="enterEmail"/> - <fillField selector="{{AdminCreateUserSection.passwordTextField}}" userInput="{{NewAdmin.password}}" stepKey="enterPassword"/> - <fillField selector="{{AdminCreateUserSection.pwConfirmationTextField}}" userInput="{{NewAdmin.password}}" stepKey="confirmPassword"/> - <fillField selector="{{AdminCreateUserSection.currentPasswordField}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}" stepKey="enterCurrentPassword"/> - <scrollToTopOfPage stepKey="scrollToTopOfPage"/> - <click selector="{{AdminCreateUserSection.userRoleTab}}" stepKey="clickUserRole"/> - <waitForAjaxLoad stepKey="waitForRoles" time="5"/> - <fillField selector="{{AdminCreateRoleSection.roleNameFilterTextField}}" userInput="{{role.name}}" stepKey="filterRole"/> - <click selector="{{AdminCreateRoleSection.searchButton}}" stepKey="clickSearch"/> - <waitForPageLoad stepKey="waitForSearch" time="10"/> - <click selector="{{AdminCreateRoleSection.searchResultFirstRow}}" stepKey="selectRole"/> - <click selector="{{AdminCreateUserSection.saveButton}}" stepKey="clickSaveUser"/> - <waitForPageLoad stepKey="waitForSaveUser" time="10"/> - <see userInput="You saved the user." stepKey="seeSuccessMessage"/> - </actionGroup> - - <actionGroup name="ConfigureBraintree"> - <annotations> - <description>Sets up the Braintree configuration setting using the BraintreeConfigurationSection Data Entity. PLEASE NOTE: The Action Group values are Hardcoded.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `ConfigureBraintreeActionGroup` instead --> - <click stepKey="clickOnSTORES" selector="{{AdminMenuSection.stores}}"/> - <waitForPageLoad stepKey="waitForConfiguration" time="2"/> - <click stepKey="clickOnConfigurations" selector="{{AdminMenuSection.configuration}}"/> - <waitForPageLoad stepKey="waitForSales" time="2"/> - <click stepKey="clickOnSales" selector="{{ConfigurationListSection.sales}}"/> - <waitForPageLoad stepKey="waitForPaymentMethods" time="2"/> - <click stepKey="clickOnPaymentMethods" selector="{{ConfigurationListSection.salesPaymentMethods}}"/> - <waitForPageLoad stepKey="waitForConfigureButton" time="2"/> - <click stepKey="clickOnConfigureButtonForBraintree" selector="{{ConfigurationPaymentSection.configureButton}}"/> - <waitForPageLoad stepKey="BraintreeSettings" time="2"/> - - <fillField stepKey="fillTitleForBraintreeSettings" selector="{{BraintreeConfiguraionSection.titleForBraintreeSettings}}" userInput="{{BraintreeConfigurationData.title}}"/> - <click stepKey="openEnvironmentSelect" selector="{{BraintreeConfiguraionSection.environment}}"/> - <click stepKey="chooseEnvironment" selector="{{BraintreeConfiguraionSection.sandbox}}"/> - <click stepKey="openPaymentActionSelect" selector="{{BraintreeConfiguraionSection.paymentActionSelect}}"/> - <click stepKey="choosePaymentAction" selector="{{BraintreeConfiguraionSection.paymentAction}}"/> - <fillField stepKey="fillMerchantID" selector="{{BraintreeConfiguraionSection.merchantID}}" userInput="{{BraintreeConfigurationData.merchantID}}"/> - <fillField stepKey="fillPublicKey" selector="{{BraintreeConfiguraionSection.publicKey}}" userInput="{{BraintreeConfigurationData.publicKey}}"/> - <fillField stepKey="fillPrivateKey" selector="{{BraintreeConfiguraionSection.privateKey}}" userInput="{{BraintreeConfigurationData.privateKey}}"/> - <click stepKey="expandEnableThisSolution" selector="{{BraintreeConfiguraionSection.enableThisSolution}}"/> - <click stepKey="chooseYesForEnableThisSolution" selector="{{BraintreeConfiguraionSection.yesForEnable}}"/> - <click stepKey="expandEnablePayPalThroughBraintree" selector="{{BraintreeConfiguraionSection.payPalThroughBraintree}}"/> - <click stepKey="chooseYesForEnablePayPalThroughBraintree" selector="{{BraintreeConfiguraionSection.yesForPayPalThroughBraintree}}"/> - <click stepKey="expandAdvancedBraintreeSettings" selector="{{BraintreeConfiguraionSection.advancedBraintreeSettings}}"/> - <fillField stepKey="fillMerchantAccountID" selector="{{BraintreeConfiguraionSection.merchantAccountID}}" userInput="{{BraintreeConfigurationData.merchantAccountID}}"/> - <click stepKey="expandCVVVerification" selector="{{BraintreeConfiguraionSection.CVVVerification}}"/> - <click stepKey="chooseYes" selector="{{BraintreeConfiguraionSection.yesForCVV}}"/> - <click stepKey="expandPayPalThroughBraintree" selector="{{BraintreeConfiguraionSection.payPalThroughBraintreeSelector}}"/> - <fillField stepKey="fillTitleForPayPalThroughBraintree" selector="{{BraintreeConfiguraionSection.titleForPayPalThroughBraintree}}" userInput="{{BraintreeConfigurationData.titleForPayPalThroughBraintree}}"/> - <click stepKey="expandPaymentAction" selector="{{BraintreeConfiguraionSection.paymentActionInPayPal}}"/> - <click stepKey="chooseAuthorize" selector="{{BraintreeConfiguraionSection.actionAuthorize}}"/> - <click stepKey="save" selector="{{BraintreeConfiguraionSection.save}}"/> - <waitForElementVisible selector="{{BraintreeConfiguraionSection.successfulMessage}}" stepKey="waitForSuccessfullyConfigured" time="10"/> - </actionGroup> - - <actionGroup name="DisableBrainTree"> - <annotations> - <description>Disables the Braintree and BraintreePaypal configuration settings via the CLI.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `DisableBraintreeActionGroup` instead --> - <magentoCLI stepKey="disableBrainTree" command="config:set payment/braintree/active 0"/> - <magentoCLI stepKey="disableBrainTreePaypal" command="config:set payment/braintree_paypal/active 0"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml deleted file mode 100644 index d5413d2269a5b..0000000000000 --- a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml +++ /dev/null @@ -1,263 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<!-- -NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. - Please find the Comment with proper replacement for each of ActionGroups provided. ---> -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AncillaryPrepBundleProduct"> - <annotations> - <description>Requires Navigation to the Product Creation page. Fills out Name, Sku, and SEO information using the BundleProduct Data Entity. PLEASE NOTE: The Action Group values are Hardcoded.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AncillaryPrepBundleProductActionGroup` instead --> - <fillField selector="{{AdminProductFormBundleSection.productName}}" userInput="{{BundleProduct.name}}" stepKey="fillProductName"/> - <fillField selector="{{AdminProductFormBundleSection.productSku}}" userInput="{{BundleProduct.sku}}" stepKey="fillProductSku"/> - - <scrollTo selector="{{AdminProductFormBundleSection.seoDropdown}}" stepKey="moveToSEOSection"/> - <conditionalClick selector="{{AdminProductFormBundleSection.seoDropdown}}" dependentSelector="{{AdminProductFormBundleSection.urlKey}}" visible="false" stepKey="openDropDownIfClosed"/> - <waitForPageLoad stepKey="WaitForDropDownSEO"/> - - <fillField userInput="{{BundleProduct.urlKey}}" selector="{{AdminProductFormBundleSection.urlKey}}" stepKey="FillsinSEOlinkExtension"/> - </actionGroup> - - <actionGroup name="FindProductToEdit"> - <annotations> - <description>Clears the Backend Admin Grid Filters on the Backend Admin Product Grid page. Searches for the BundleProduct Data Entity. Then clicks on the first item in the Admin Grid. PLEASE NOTE: The Action Group values are Hardcoded.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `FindProductToEditActionGroup` instead --> - <amOnPage url="{{ProductCatalogPage.url}}" stepKey="GoToProductCatalog"/> - <waitForPageLoad stepKey="WaitForCatalogProductPageToLoad"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> - <fillField userInput="{{BundleProduct.name}}" selector="#fulltext" stepKey="EnterProductNameInSearch"/> - <click stepKey="ClickSearch" selector="{{AdminProductFormBundleSection.searchButton}}"/> - <click stepKey="ClickOnProduct" selector="{{AdminProductFormBundleSection.firstCatalogProduct}}"/> - <waitForPageLoad stepKey="WaitForProductEditPageToLoad"/> - </actionGroup> - - <actionGroup name="CreateBasicBundleProduct"> - <annotations> - <description>Requires Navigation to the Product Creation page. Fills out Name, Sku, and SEO information using the BundleProduct Data Entity. PLEASE NOTE: The Action Group values are Hardcoded.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateBasicBundleProductActionGroup` instead --> - <fillField selector="{{AdminProductFormBundleSection.productName}}" userInput="{{BundleProduct.name}}" stepKey="fillProductName"/> - <fillField selector="{{AdminProductFormBundleSection.productSku}}" userInput="{{BundleProduct.sku}}" stepKey="fillProductSku"/> - - <scrollTo selector="{{AdminProductFormBundleSection.seoDropdown}}" stepKey="scrollToSeoDropDown"/> - <conditionalClick selector="{{AdminProductFormBundleSection.seoDropdown}}" dependentSelector="{{AdminProductFormBundleSection.urlKey}}" visible="false" stepKey="openDropDownIfClosed"/> - <waitForPageLoad stepKey="waitForDropDownSEO"/> - - <fillField userInput="{{BundleProduct.urlKey}}" selector="{{AdminProductFormBundleSection.urlKey}}" stepKey="fillsInSeoLinkExtension"/> - </actionGroup> - - <actionGroup name="addBundleOptionWithTwoProducts"> - <annotations> - <description>Requires Navigation to the Product Creation page. Adds Bundle Option with Two Products using the provided arguments. 'x' refers to Bundle option number. 'n' refers to the first number after x.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddBundleOptionWithTwoProductsActionGroup` instead --> - <arguments> - <argument name="x" type="string"/> - <argument name="n" type="string"/> - <argument name="prodOneSku" type="string"/> - <argument name="prodTwoSku" type="string"/> - <argument name="optionTitle" type="string"/> - <argument name="inputType" type="string"/> - </arguments> - - <conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="conditionallyOpenSectionBundleItems"/> - <scrollTo selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" stepKey="scrollUpABit"/> - <click selector="{{AdminProductFormBundleSection.addOption}}" stepKey="clickAddOption"/> - <waitForElementVisible selector="{{AdminProductFormBundleSection.bundleOptionXTitle(x)}}" stepKey="waitForOptions"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXTitle(x)}}" userInput="{{optionTitle}}" stepKey="fillTitle"/> - <selectOption selector="{{AdminProductFormBundleSection.bundleOptionXInputType(x)}}" userInput="{{inputType}}" stepKey="selectType"/> - <waitForElementVisible selector="{{AdminProductFormBundleSection.nthAddProductsToOption(n)}}" stepKey="waitForAddBtn"/> - <click selector="{{AdminProductFormBundleSection.nthAddProductsToOption(n)}}" stepKey="clickAdd"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters1"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters1"/> - <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{prodOneSku}}" stepKey="fillProductSkuFilter1"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters1"/> - <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad1" time="30"/> - <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectProduct1"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters2"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters2"/> - <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{prodTwoSku}}" stepKey="fillProductSkuFilter2"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters2"/> - <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad2" time="30"/> - <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectProduct2"/> - <click selector="{{AdminAddProductsToOptionPanel.addSelectedProducts}}" stepKey="clickAddButton1"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '0')}}" userInput="50" stepKey="fillQuantity1"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '1')}}" userInput="50" stepKey="fillQuantity2"/> - </actionGroup> - - <actionGroup name="addBundleOptionWithOneProduct" extends="addBundleOptionWithTwoProducts"> - <annotations> - <description>Requires Navigation to the Product Creation page. Adds Bundle Option with One Product as specified in arguments. 'x' refers to Bundle option number. 'n' refers to the first number after x.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddBundleOptionWithOneProductActionGroup` instead --> - <remove keyForRemoval="openProductFilters2"/> - <remove keyForRemoval="fillProductSkuFilter2"/> - <remove keyForRemoval="clickApplyFilters2"/> - <remove keyForRemoval="waitForFilteredGridLoad2"/> - <remove keyForRemoval="selectProduct2"/> - <remove keyForRemoval="selectProduct2"/> - <remove keyForRemoval="fillQuantity1"/> - <remove keyForRemoval="fillQuantity2"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '0')}}" userInput="1" stepKey="fillQuantity" after="clickAddButton1"/> - </actionGroup> - - <actionGroup name="addBundleOptionWithTreeProducts" extends="addBundleOptionWithTwoProducts"> - <annotations> - <description>Requires Navigation to the Product Creation page. Adds Bundle Option with Three Products using the provided arguments. 'x' refers to Bundle option number. 'n' refers to the first number after x.</description> - </annotations> - <arguments> - <argument name="prodTreeSku" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddBundleOptionWithThreeProductsActionGroup` instead --> - <remove keyForRemoval="fillQuantity1"/> - <remove keyForRemoval="fillQuantity2"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters3" after="selectProduct2"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters3" after="clickClearFilters3"/> - <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{prodTreeSku}}" stepKey="fillProductSkuFilter3" after="openProductFilters3"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters3" after="fillProductSkuFilter3"/> - <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad3" time="30" after="clickApplyFilters3"/> - <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectProduct3" after="waitForFilteredGridLoad3"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '0')}}" userInput="1" stepKey="fillQuantity1" after="clickAddButton1"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '1')}}" userInput="1" stepKey="fillQuantity2" after="fillQuantity1"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '2')}}" userInput="1" stepKey="fillQuantity3" after="fillQuantity2"/> - </actionGroup> - - <actionGroup name="addBundleOptionWithSixProducts" extends="addBundleOptionWithTwoProducts"> - <annotations> - <description>Requires Navigation to Product Creation page. Adds Bundle Option with Six Products as specified in arguments. 'x' refers to Bundle option number. 'n' refers to the first number after x.</description> - </annotations> - <arguments> - <argument name="prodTreeSku" type="string"/> - <argument name="prodFourSku" type="string"/> - <argument name="prodFiveSku" type="string"/> - <argument name="prodSixSku" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddBundleOptionWithSixProductsActionGroup` instead --> - <remove keyForRemoval="fillQuantity1"/> - <remove keyForRemoval="fillQuantity2"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters3" after="selectProduct2"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters3" after="clickClearFilters3"/> - <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{prodTreeSku}}" stepKey="fillProductSkuFilter3" after="openProductFilters3"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters3" after="fillProductSkuFilter3"/> - <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad3" time="30" after="clickApplyFilters3"/> - <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectProduct3" after="waitForFilteredGridLoad3"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters4" after="selectProduct3"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters4" after="clickClearFilters4"/> - <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{prodFourSku}}" stepKey="fillProductSkuFilter4" after="openProductFilters4"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters4" after="fillProductSkuFilter4"/> - <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad4" time="30" after="clickApplyFilters4"/> - <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectProduct4" after="clickApplyFilters4"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters5" after="selectProduct4"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters5" after="clickClearFilters5"/> - <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{prodFiveSku}}" stepKey="fillProductSkuFilter5" after="openProductFilters5"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters5" after="fillProductSkuFilter5"/> - <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad5" time="30" after="clickApplyFilters5"/> - <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectProduct5" after="waitForFilteredGridLoad5"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters6" after="selectProduct5"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters6" after="clickClearFilters6"/> - <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{prodSixSku}}" stepKey="fillProductSkuFilter6" after="openProductFilters6"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters6" after="fillProductSkuFilter6"/> - <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad6" time="30" after="clickApplyFilters6"/> - <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectProduct6" after="waitForFilteredGridLoad6"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '0')}}" userInput="2" stepKey="fillQuantity1" after="clickAddButton1"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '1')}}" userInput="2" stepKey="fillQuantity2" after="fillQuantity1"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '2')}}" userInput="2" stepKey="fillQuantity3" after="fillQuantity2"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '3')}}" userInput="2" stepKey="fillQuantity4" after="fillQuantity3"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '4')}}" userInput="2" stepKey="fillQuantity5" after="fillQuantity4"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity(x, '5')}}" userInput="2" stepKey="fillQuantity6" after="fillQuantity5"/> - </actionGroup> - - <actionGroup name="deleteBundleOptionByIndex"> - <annotations> - <description>Requires Navigation to Product Creation page. Removes any Bundle Option by index specified in arguments. 'deleteIndex' refers to Bundle option number.</description> - </annotations> - <arguments> - <argument name="deleteIndex" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `DeleteBundleOptionByIndexActionGroup` instead --> - <conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="conditionallyOpenSectionBundleItems"/> - <scrollTo selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" stepKey="scrollUpABit"/> - <click selector="{{AdminProductFormBundleSection.deleteOption(deleteIndex)}}" stepKey="clickDeleteOption"/> - </actionGroup> - - <actionGroup name="StorefrontAddBundleProductFromProductToCartWithMultiOption" extends="StorefrontAddBundleProductFromProductToCartActionGroup"> - <annotations> - <description>Selects a Bundled Product option on the Bundled Product page. PLEASE NOTE: The Quantity selection is not available in the Action Group.</description> - </annotations> - <arguments> - <argument name="optionName" type="string"/> - <argument name="value" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontAddBundleProductFromProductToCartWithMultiOptionActionGroup` instead --> - <selectOption selector="{{StorefrontBundledSection.multiselectOptionFourProducts(optionName)}}" userInput="{{value}}" stepKey="selectValue" before="clickAddBundleProductToCart"/> - </actionGroup> - - <actionGroup name="fillMainBundleProductForm"> - <annotations> - <description>Fills the Name, SKU and Stock Status fields.</description> - </annotations> - <arguments> - <argument name="product" defaultValue="BundleProduct"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `FillMainBundleProductFormActionGroup` instead --> - <fillField selector="{{AdminProductFormSection.productName}}" userInput="{{product.name}}" stepKey="fillProductSku"/> - <fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="fillProductName"/> - <selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="{{product.status}}" stepKey="selectStockStatus"/> - </actionGroup> - - <actionGroup name="checkRequiredFieldsInBundleProductForm"> - <annotations> - <description>Clears the Name and SKU fields when adding a Product and then verifies that they are required after attempting to Save.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CheckRequiredFieldsInBundleProductFormActionGroup` instead --> - <clearField selector="{{AdminProductFormSection.productName}}" stepKey="clearProductSku"/> - <clearField selector="{{AdminProductFormSection.productSku}}" stepKey="clearProductName"/> - <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveButton"/> - <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Product" stepKey="seeStillOnEditPage"/> - <see selector="{{AdminProductFormSection.fieldError('name')}}" userInput="This is a required field." stepKey="seeNameRequired"/> - <see selector="{{AdminProductFormSection.fieldError('sku')}}" userInput="This is a required field." stepKey="seeSkuRequired"/> - </actionGroup> - - <actionGroup name="viewBundleProductInAdminGrid"> - <annotations> - <description>Clears the Grid Filters on the Catalog Grid page and applies Filter by Name and Sku. Then checks to see if the Product exists in the 1st row. Then clears the Grid Filters again for future Tests.</description> - </annotations> - <arguments> - <argument name="product" defaultValue="BundleProduct"/> - <argument name="thumbnail" defaultValue="ProductPlaceholderImage"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `ViewBundleProductInAdminGridActionGroup` instead --> - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> - <waitForPageLoad stepKey="waitForPageLoadInitial"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> - <fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="{{product.name}}" stepKey="fillProductNameFilter"/> - <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillProductSkuFilter"/> - <selectOption selector="{{AdminProductGridFilterSection.typeFilter}}" userInput="{{product.type_id}}" stepKey="selectionProductType"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> - <see selector="{{AdminProductGridSection.firstProductRow}}" userInput="{{product.name}}" stepKey="seeProductNameInGrid"/> - <click selector="{{AdminProductGridFilterSection.clearFilters}}" stepKey="clickClearFiltersAfter"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml deleted file mode 100644 index 672465ad4120b..0000000000000 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml +++ /dev/null @@ -1,853 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<!-- -NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. - Please find the Comment with proper replacement for each of ActionGroups provided. ---> -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="CreateConfigurableProductWithAttributeSet"> - <annotations> - <description>Admin edit created product as configurable. Choose created options</description> - </annotations> - <arguments> - <argument name="product" defaultValue="_defaultProduct"/> - <argument name="category" defaultValue="_defaultCategory"/> - <argument name="label" type="string" defaultValue="mySet"/> - <argument name="option" type="string" defaultValue="['option1', 'option2', 'option3', 'option4']"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateConfigurableProductWithAttributeSetActionGroup` instead --> - <click selector="{{AdminProductFormSection.attributeSet}}" stepKey="startEditAttrSet"/> - <fillField selector="{{AdminProductFormSection.attributeSetFilter}}" userInput="{{label}}" stepKey="searchForAttrSet"/> - <click selector="{{AdminProductFormSection.attributeSetFilterResult}}" stepKey="selectAttrSet"/> - <fillField userInput="{{product.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="fillName"/> - <selectOption selector="{{AdminProductFormSection.additionalOptions}}" parameterArray="{{option}}" stepKey="searchAndMultiSelectCreatedOption"/> - </actionGroup> - - <actionGroup name="AdminCreateConfigurationsForAttribute" extends="generateConfigurationsByAttributeCode"> - <annotations> - <description>EXTENDS: generateConfigurationsByAttributeCode. Click to apply single price to all Skus. Enter Attribute price</description> - </annotations> - <arguments> - <argument name="price" type="string" defaultValue="100"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminCreateConfigurationsForAttributeActionGroup` instead --> - <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.applySinglePriceToAllSkus}}" after="clickOnNextButton2" stepKey="waitForNextPageOpened2"/> - <click selector="{{AdminCreateProductConfigurationsPanel.applySinglePriceToAllSkus}}" after="waitForNextPageOpened2" stepKey="clickOnApplySinglePriceToAllSkus"/> - <fillField selector="{{AdminCreateProductConfigurationsPanel.singlePrice}}" userInput="{{price}}" before="clickOnApplySingleQuantityToEachSku" stepKey="enterAttributePrice"/> - </actionGroup> - - <actionGroup name="AdminCreateConfigurableProductWithAttributeUncheckOption" extends="generateConfigurationsByAttributeCode"> - <annotations> - <description>EXTENDS: generateConfigurationsByAttributeCode. Click to uncheck created option. Enter Attribute price</description> - </annotations> - <arguments> - <argument name="attributeOption" type="string" defaultValue="option1"/> - <argument name="price" type="string" defaultValue="100"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminCreateConfigurableProductWithAttributeUncheckOptionActionGroup` instead --> - <click selector="{{AdminCreateProductConfigurationsPanel.attributeOption('attributeOption')}}" after="clickOnSelectAll" stepKey="clickToUncheckOption"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" after="clickToUncheckOption" stepKey="clickOnNextButton22"/> - <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.applySinglePriceToAllSkus}}" after="clickOnNextButton22" stepKey="waitForNextPageOpened2"/> - <click selector="{{AdminCreateProductConfigurationsPanel.applySinglePriceToAllSkus}}" after="waitForNextPageOpened2" stepKey="clickOnApplySinglePriceToAllSkus"/> - <fillField selector="{{AdminCreateProductConfigurationsPanel.singlePrice}}" userInput="{{price}}" before="clickOnApplySingleQuantityToEachSku" stepKey="enterAttributePrice"/> - </actionGroup> - - <actionGroup name="viewConfigurableProductInAdminGrid"> - <annotations> - <description>Goes to the Admin Product grid page. Validates the provided Configurable Product is present and correct in the grid.</description> - </annotations> - <arguments> - <argument name="product" defaultValue="_defaultProduct"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `ViewConfigurableProductInAdminGridActionGroup` instead --> - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> - <waitForPageLoad 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"/> - <seeNumberOfElements selector="{{AdminProductGridSection.productGridRows}}" userInput="3" stepKey="seeCorrectNumberOfProducts"/> - - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFiltersSimple"/> - <selectOption selector="{{AdminProductGridFilterSection.typeFilter}}" userInput="simple" stepKey="selectionProductType"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFiltersWithSimpleType"/> - <see selector="{{AdminProductGridSection.firstProductRow}}" userInput="{{product.name}}" stepKey="seeSimpleProductNameInGrid"/> - <see selector="{{AdminProductGridSection.firstProductRow}}" userInput="{{product.price}}" stepKey="seeSimpleProductPriceInGrid"/> - - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFiltersConfigurable"/> - <selectOption selector="{{AdminProductGridFilterSection.typeFilter}}" userInput="{{product.type_id}}" stepKey="selectionConfigurableProductType"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFiltersWithConfigurableType"/> - <see selector="{{AdminProductGridSection.firstProductRow}}" userInput="{{product.name}}" stepKey="seeConfigurableProductNameInGrid"/> - <dontSee selector="{{AdminProductGridSection.firstProductRow}}" userInput="{{product.price}}" stepKey="dontSeeProductPriceNameInGrid"/> - - <click selector="{{AdminProductGridFilterSection.clearFilters}}" stepKey="clickClearFiltersAfter"/> - </actionGroup> - - <actionGroup name="createConfigurableProduct"> - <annotations> - <description>Goes to the Admin Product grid page. Creates a Configurable Product using the default Product Options.</description> - </annotations> - <arguments> - <argument name="product" defaultValue="_defaultProduct"/> - <argument name="category" defaultValue="_defaultCategory"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateConfigurableProductActionGroup` instead --> - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> - <waitForPageLoad time="30" stepKey="wait1"/> - <click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickOnAddProductToggle"/> - <click selector="{{AdminProductGridActionSection.addConfigurableProduct}}" stepKey="clickOnAddConfigurableProduct"/> - <fillField userInput="{{product.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="fillName"/> - <fillField userInput="{{product.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="fillSKU"/> - <fillField userInput="{{product.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="fillPrice"/> - <fillField userInput="{{product.quantity}}" selector="{{AdminProductFormSection.productQuantity}}" stepKey="fillQuantity"/> - <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[{{category.name}}]" stepKey="fillCategory"/> - <selectOption userInput="{{product.visibility}}" selector="{{AdminProductFormSection.visibility}}" stepKey="fillVisibility"/> - <click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/> - <fillField userInput="{{product.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/> - - <click selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="clickOnCreateConfigurations"/> - <click selector="{{AdminCreateProductConfigurationsPanel.createNewAttribute}}" stepKey="clickOnNewAttribute"/> - <waitForPageLoad stepKey="waitForIFrame"/> - <switchToIFrame selector="{{AdminNewAttributePanel.newAttributeIFrame}}" stepKey="switchToNewAttributeIFrame"/> - <fillField selector="{{AdminNewAttributePanel.defaultLabel}}" userInput="{{colorProductAttribute.default_label}}" stepKey="fillDefaultLabel"/> - <click selector="{{AdminNewAttributePanel.saveAttribute}}" stepKey="clickOnNewAttributePanel"/> - <waitForPageLoad stepKey="waitForSaveAttribute"/> - <switchToIFrame stepKey="switchOutOfIFrame"/> - <waitForPageLoad stepKey="waitForFilters"/> - <click selector="{{AdminCreateProductConfigurationsPanel.filters}}" stepKey="clickOnFilters"/> - <fillField userInput="{{colorProductAttribute.default_label}}" selector="{{AdminCreateProductConfigurationsPanel.attributeCode}}" stepKey="fillFilterAttributeCodeField"/> - <click selector="{{AdminCreateProductConfigurationsPanel.applyFilters}}" stepKey="clickApplyFiltersButton"/> - <click selector="{{AdminCreateProductConfigurationsPanel.firstCheckbox}}" stepKey="clickOnFirstCheckbox"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton1"/> - <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="waitCreateNewValueAppears"/> - <click selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="clickOnCreateNewValue1"/> - <fillField userInput="{{colorProductAttribute1.name}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewAttribute1"/> - <click selector="{{AdminCreateProductConfigurationsPanel.saveAttribute}}" stepKey="clickOnSaveNewAttribute1"/> - <click selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="clickOnCreateNewValue2"/> - <fillField userInput="{{colorProductAttribute2.name}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewAttribute2"/> - <click selector="{{AdminCreateProductConfigurationsPanel.saveAttribute}}" stepKey="clickOnSaveNewAttribute2"/> - <click selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="clickOnCreateNewValue3"/> - <fillField userInput="{{colorProductAttribute3.name}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewAttribute3"/> - <click selector="{{AdminCreateProductConfigurationsPanel.saveAttribute}}" stepKey="clickOnSaveNewAttribute3"/> - <click selector="{{AdminCreateProductConfigurationsPanel.selectAll}}" stepKey="clickOnSelectAll"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton2"/> - <click selector="{{AdminCreateProductConfigurationsPanel.applyUniquePricesByAttributeToEachSku}}" stepKey="clickOnApplyUniquePricesByAttributeToEachSku"/> - <selectOption selector="{{AdminCreateProductConfigurationsPanel.selectAttribute}}" userInput="{{colorProductAttribute.default_label}}" stepKey="selectAttributes"/> - <fillField selector="{{AdminCreateProductConfigurationsPanel.attribute1}}" userInput="{{colorProductAttribute1.price}}" stepKey="fillAttributePrice1"/> - <fillField selector="{{AdminCreateProductConfigurationsPanel.attribute2}}" userInput="{{colorProductAttribute2.price}}" stepKey="fillAttributePrice2"/> - <fillField selector="{{AdminCreateProductConfigurationsPanel.attribute3}}" userInput="{{colorProductAttribute3.price}}" stepKey="fillAttributePrice3"/> - <click selector="{{AdminCreateProductConfigurationsPanel.applySingleQuantityToEachSkus}}" stepKey="clickOnApplySingleQuantityToEachSku"/> - <fillField selector="{{AdminCreateProductConfigurationsPanel.quantity}}" userInput="1" stepKey="enterAttributeQuantity"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton3"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton4"/> - <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton2"/> - <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup"/> - <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSaveProductMessage"/> - <seeInTitle userInput="{{product.name}}" stepKey="seeProductNameInTitle"/> - </actionGroup> - - <actionGroup name="createConfigurableProductWithTwoAttributes" extends="createConfigurableProduct"> - <annotations> - <description>Goes to the Admin Product grid page. Creates a Configurable Product with 2 product attributes.</description> - </annotations> - <arguments> - <argument name="attribute1" defaultValue="ProductColorAttribute"/> - <argument name="attribute2" defaultValue="ProductSizeAttribute"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateConfigurableProductWithTwoAttributesActionGroup` instead --> - <remove keyForRemoval="clickOnNewAttribute"/> - <remove keyForRemoval="waitForIFrame"/> - <remove keyForRemoval="switchToNewAttributeIFrame"/> - <remove keyForRemoval="fillDefaultLabel"/> - <remove keyForRemoval="clickOnNewAttributePanel"/> - <remove keyForRemoval="waitForSaveAttribute"/> - <remove keyForRemoval="switchOutOfIFrame"/> - <remove keyForRemoval="waitForFilters"/> - <remove keyForRemoval="clickOnFilters"/> - <remove keyForRemoval="fillFilterAttributeCodeField"/> - <remove keyForRemoval="clickApplyFiltersButton"/> - <remove keyForRemoval="clickOnFirstCheckbox"/> - <click selector="{{AdminCreateProductConfigurationsPanel.attributeCheckbox(attribute1.attribute_code)}}" stepKey="selectAttribute1" after="clickOnCreateConfigurations"/> - <click selector="{{AdminCreateProductConfigurationsPanel.attributeCheckbox(attribute2.attribute_code)}}" stepKey="selectAttribute2" after="selectAttribute1"/> - <remove keyForRemoval="waitCreateNewValueAppears"/> - <remove keyForRemoval="clickOnCreateNewValue1"/> - <remove keyForRemoval="fillFieldForNewAttribute1"/> - <remove keyForRemoval="clickOnSaveNewAttribute1"/> - <remove keyForRemoval="clickOnCreateNewValue2"/> - <remove keyForRemoval="fillFieldForNewAttribute2"/> - <remove keyForRemoval="clickOnSaveNewAttribute2"/> - <remove keyForRemoval="clickOnCreateNewValue3"/> - <remove keyForRemoval="fillFieldForNewAttribute3"/> - <remove keyForRemoval="clickOnSaveNewAttribute3"/> - <remove keyForRemoval="clickOnSelectAll"/> - <click selector="{{AdminCreateProductConfigurationsPanel.selectAllByAttribute(attribute1.frontend_label)}}" stepKey="selectAllOptionsOfAttribute1" before="clickOnNextButton2"/> - <click selector="{{AdminCreateProductConfigurationsPanel.selectAllByAttribute(attribute2.frontend_label)}}" stepKey="selectAllOptionsOfAttribute2" before="clickOnNextButton2"/> - <remove keyForRemoval="applyUniquePricesByAttributeToEachSku"/> - <remove keyForRemoval="clickOnApplyUniquePricesByAttributeToEachSku"/> - <remove keyForRemoval="selectAttributes"/> - <remove keyForRemoval="fillAttributePrice1"/> - <remove keyForRemoval="fillAttributePrice2"/> - <remove keyForRemoval="fillAttributePrice3"/> - <remove keyForRemoval="clickOnSaveButton2"/> - <remove keyForRemoval="clickOnConfirmInPopup"/> - <remove keyForRemoval="seeSaveProductMessage"/> - <remove keyForRemoval="seeProductNameInTitle"/> - </actionGroup> - - <actionGroup name="saveConfigurableProduct"> - <annotations> - <description>Save configurable product</description> - </annotations> - <arguments> - <argument name="product" defaultValue="_defaultProduct"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SaveConfigurableProductActionGroup` instead --> - <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton"/> - <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup"/> - <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSaveProductMessage"/> - <seeInTitle userInput="{{product.name}}" stepKey="seeProductNameInTitle"/> - </actionGroup> - - <actionGroup name="generateConfigurationsByAttributeCode"> - <annotations> - <description>Generates the Product Configurations for the provided Attribute Code on the Configurable Product creation/edit page.</description> - </annotations> - <arguments> - <argument name="attributeCode" type="string" defaultValue="SomeString"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `GenerateConfigurationsByAttributeCodeActionGroup` instead --> - <click selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="clickCreateConfigurations"/> - <click selector="{{AdminCreateProductConfigurationsPanel.filters}}" stepKey="clickFilters"/> - <fillField selector="{{AdminCreateProductConfigurationsPanel.attributeCode}}" userInput="{{attributeCode}}" stepKey="fillFilterAttributeCodeField"/> - <click selector="{{AdminCreateProductConfigurationsPanel.applyFilters}}" stepKey="clickApplyFiltersButton"/> - <click selector="{{AdminCreateProductConfigurationsPanel.firstCheckbox}}" stepKey="clickOnFirstCheckbox"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton1"/> - <click selector="{{AdminCreateProductConfigurationsPanel.selectAll}}" stepKey="clickOnSelectAll"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton2"/> - <click selector="{{AdminCreateProductConfigurationsPanel.applySingleQuantityToEachSkus}}" stepKey="clickOnApplySingleQuantityToEachSku"/> - <fillField selector="{{AdminCreateProductConfigurationsPanel.quantity}}" userInput="99" stepKey="enterAttributeQuantity"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton3"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton4"/> - </actionGroup> - - <actionGroup name="createOptionsForAttribute"> - <arguments> - <argument name="attributeName" type="string" defaultValue="{{productAttributeColor.default_label}}"/> - <argument name="firstOptionName" type="string" defaultValue="option1"/> - <argument name="secondOptionName" type="string" defaultValue="option2"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateOptionsForAttributeActionGroup` instead --> - <click selector="{{AdminCreateProductConfigurationsPanel.filters}}" stepKey="clickOnFilters"/> - <fillField userInput="{{attributeName}}" selector="{{AdminCreateProductConfigurationsPanel.attributeCode}}" stepKey="fillFilterAttributeCodeField"/> - <click selector="{{AdminCreateProductConfigurationsPanel.applyFilters}}" stepKey="clickApplyFiltersButton"/> - <click selector="{{AdminCreateProductConfigurationsPanel.firstCheckbox}}" stepKey="clickOnFirstCheckbox"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton"/> - <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="waitCreateNewValueAppears"/> - <click selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="clickOnCreateFirstNewValue"/> - <fillField userInput="{{firstOptionName}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewFirstOption"/> - <click selector="{{AdminCreateProductConfigurationsPanel.saveAttribute}}" stepKey="clickOnSaveNewAttribute"/> - <click selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="clickOnCreateSecondNewValue"/> - <fillField userInput="{{secondOptionName}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewSecondOption"/> - <click selector="{{AdminCreateProductConfigurationsPanel.saveAttribute}}" stepKey="clickOnSaveAttribute"/> - <click selector="{{AdminCreateProductConfigurationsPanel.selectAll}}" stepKey="clickOnSelectAll"/> - </actionGroup> - - <actionGroup name="createConfigurationsForAttribute" extends="generateConfigurationsByAttributeCode"> - <annotations> - <description>EXTENDS: generateConfigurationsByAttributeCode. Clicks on the Save button. Clicks on the Confirm button.</description> - </annotations> - <arguments> - <argument name="attributeCode" type="string" defaultValue="SomeString"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateConfigurationsForAttributeActionGroup` instead --> - <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton2"/> - <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup"/> - </actionGroup> - - <actionGroup name="createConfigurationsForAttributeWithImages" extends="generateConfigurationsByAttributeCode"> - <annotations> - <description>EXTENDS: generateConfigurationsByAttributeCode. Adds the provided Attribute Image to the provided Attribute Code.</description> - </annotations> - <arguments> - <argument name="attributeCode" type="string" defaultValue="SomeString"/> - <argument name="image" defaultValue="ProductImage"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateConfigurationsForAttributeWithImagesActionGroup` instead --> - <click selector="{{AdminCreateProductConfigurationsPanel.applySingleSetOfImages}}" stepKey="clickOnApplySingleImageSetToAllSku" after="enterAttributeQuantity"/> - <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.imageUploadButton}}" stepKey="seeImageSectionIsReady" after="clickOnApplySingleImageSetToAllSku"/> - <attachFile selector="{{AdminCreateProductConfigurationsPanel.imageFileUpload}}" userInput="{{image.file}}" stepKey="uploadFile" after="seeImageSectionIsReady"/> - <waitForElementNotVisible selector="{{AdminCreateProductConfigurationsPanel.uploadProgressBar}}" stepKey="waitForUpload" after="uploadFile"/> - <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.imageFile(image.fileName)}}" stepKey="waitForThumbnail" after="waitForUpload"/> - - <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton2" after="clickOnNextButton4"/> - <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup" after="clickOnSaveButton2"/> - </actionGroup> - - <actionGroup name="createConfigurationsForTwoAttribute" extends="generateConfigurationsByAttributeCode"> - <annotations> - <description>EXTENDS: generateConfigurationsByAttributeCode. Generates the Product Configurations for the 2 provided Attribute Codes on the Configurable Product creation/edit page.</description> - </annotations> - <arguments> - <argument name="secondAttributeCode" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateConfigurationsForTwoAttributeActionGroup` instead --> - <remove keyForRemoval="clickOnSelectAll"/> - <remove keyForRemoval="clickFilters"/> - <remove keyForRemoval="fillFilterAttributeCodeField"/> - <remove keyForRemoval="clickApplyFiltersButton"/> - <remove keyForRemoval="clickOnFirstCheckbox"/> - - <click selector="{{AdminCreateProductConfigurationsPanel.attributeCheckbox(attributeCode)}}" stepKey="clickOnFirstAttributeCheckbox" after="clickCreateConfigurations"/> - <click selector="{{AdminCreateProductConfigurationsPanel.attributeCheckbox(secondAttributeCode)}}" stepKey="clickOnSecondAttributeCheckbox" after="clickOnFirstAttributeCheckbox"/> - <grabTextFrom selector="{{AdminCreateProductConfigurationsPanel.defaultLabel(attributeCode)}}" stepKey="grabFirstAttributeDefaultLabel" after="clickOnSecondAttributeCheckbox"/> - <grabTextFrom selector="{{AdminCreateProductConfigurationsPanel.defaultLabel(secondAttributeCode)}}" stepKey="grabSecondAttributeDefaultLabel" after="grabFirstAttributeDefaultLabel"/> - <click selector="{{AdminCreateProductConfigurationsPanel.selectAllByAttribute({$grabFirstAttributeDefaultLabel})}}" stepKey="clickOnSelectAllForFirstAttribute" after="clickOnNextButton1"/> - <click selector="{{AdminCreateProductConfigurationsPanel.selectAllByAttribute({$grabSecondAttributeDefaultLabel})}}" stepKey="clickOnSelectAllForSecondAttribute" after="clickOnSelectAllForFirstAttribute"/> - <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton2"/> - <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup"/> - </actionGroup> - - <actionGroup name="saveConfiguredProduct"> - <annotations> - <description>Save the Configurable Product on the Configurable Product creation/edit page. Validates that the Success Message is present.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SaveConfiguredProductActionGroup` instead --> - <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton2"/> - <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup"/> - <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSaveProductMessage"/> - </actionGroup> - - <actionGroup name="GenerateAndSaveConfiguredProductAfterSettingOptions" extends="saveConfiguredProduct"> - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `GenerateAndSaveConfiguredProductAfterSettingOptionsActionGroup` instead --> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" before="clickOnSaveButton2" stepKey="clickOnNextButton"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" after="clickOnNextButton" stepKey="clickOnGenerateProductsButton"/> - </actionGroup> - - <actionGroup name="addNewProductConfigurationAttribute"> - <annotations> - <description>Generates the Product Configurations for the 2 provided Attribute Names on the Configurable Product creation/edit page.</description> - </annotations> - <arguments> - <argument name="attribute" type="entity"/> - <argument name="firstOption" type="entity"/> - <argument name="secondOption" type="entity"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddNewProductConfigurationAttributeActionGroup` instead --> - <click selector="{{AdminCreateProductConfigurationsPanel.createNewAttribute}}" stepKey="clickOnNewAttribute"/> - <waitForPageLoad stepKey="waitForIFrame"/> - <switchToIFrame selector="{{AdminNewAttributePanel.newAttributeIFrame}}" stepKey="switchToNewAttributeIFrame"/> - <fillField selector="{{AdminNewAttributePanel.defaultLabel}}" userInput="{{attribute.default_label}}" stepKey="fillDefaultLabel"/> - <click selector="{{AdminNewAttributePanel.saveAttribute}}" stepKey="clickOnNewAttributePanel"/> - <waitForPageLoad stepKey="waitForSaveAttribute"/> - <switchToIFrame stepKey="switchOutOfIFrame"/> - <waitForPageLoad stepKey="waitForFilters"/> - - <click selector="{{AdminCreateProductConfigurationsPanel.filters}}" stepKey="clickOnFilters"/> - <fillField userInput="{{attribute.default_label}}" selector="{{AdminCreateProductConfigurationsPanel.attributeCode}}" stepKey="fillFilterAttributeCodeField"/> - <click selector="{{AdminCreateProductConfigurationsPanel.applyFilters}}" stepKey="clickApplyFiltersButton"/> - <click selector="{{AdminCreateProductConfigurationsPanel.firstCheckbox}}" stepKey="clickOnFirstCheckbox"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton"/> - <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="waitCreateNewValueAppears"/> - <click selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="clickOnCreateFirstNewValue"/> - <fillField userInput="{{firstOption.name}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewFirstOption"/> - <click selector="{{AdminCreateProductConfigurationsPanel.saveAttribute}}" stepKey="clickOnSaveNewAttribute"/> - <click selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="clickOnCreateSecondNewValue"/> - <fillField userInput="{{secondOption.name}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewSecondOption"/> - <click selector="{{AdminCreateProductConfigurationsPanel.saveAttribute}}" stepKey="clickOnSaveAttribute"/> - <click selector="{{AdminCreateProductConfigurationsPanel.selectAll}}" stepKey="clickOnSelectAll"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnSecondNextButton"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnThirdNextButton"/> - <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnFourthNextButton"/> - </actionGroup> - - <actionGroup name="selectCreatedAttributeAndCreateTwoOptions" extends="addNewProductConfigurationAttribute"> - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SelectCreatedAttributeAndCreateTwoOptionsActionGroup` instead --> - <remove keyForRemoval="clickOnNewAttribute"/> - <remove keyForRemoval="waitForIFrame"/> - <remove keyForRemoval="switchToNewAttributeIFrame"/> - <remove keyForRemoval="fillDefaultLabel"/> - <remove keyForRemoval="clickOnNewAttributePanel"/> - <remove keyForRemoval="waitForSaveAttribute"/> - <remove keyForRemoval="switchOutOfIFrame"/> - <remove keyForRemoval="waitForFilters"/> - <fillField userInput="{{attribute.attribute_code}}" selector="{{AdminCreateProductConfigurationsPanel.attributeCode}}" stepKey="fillFilterAttributeCodeField"/> - <fillField userInput="{{firstOption.label}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewFirstOption"/> - <fillField userInput="{{secondOption.label}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewSecondOption"/> - <remove keyForRemoval="clickOnSelectAll"/> - <remove keyForRemoval="clickOnSecondNextButton"/> - <remove keyForRemoval="clickOnThirdNextButton"/> - <remove keyForRemoval="clickOnFourthNextButton"/> - </actionGroup> - - <actionGroup name="changeProductConfigurationsInGrid"> - <annotations> - <description>Edit the Product Configuration via the Admin Product grid page.</description> - </annotations> - <arguments> - <argument name="firstOption" type="entity"/> - <argument name="secondOption" type="entity"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `ChangeProductConfigurationsInGridActionGroup` instead --> - <fillField userInput="{{firstOption.name}}" selector="{{AdminProductFormConfigurationsSection.confProductNameCell(firstOption.name)}}" stepKey="fillFieldNameForFirstAttributeOption"/> - <fillField userInput="{{secondOption.name}}" selector="{{AdminProductFormConfigurationsSection.confProductNameCell(secondOption.name)}}" stepKey="fillFieldNameForSecondAttributeOption"/> - <fillField userInput="{{firstOption.sku}}" selector="{{AdminProductFormConfigurationsSection.confProductSkuCell(firstOption.name)}}" stepKey="fillFieldSkuForFirstAttributeOption"/> - <fillField userInput="{{secondOption.sku}}" selector="{{AdminProductFormConfigurationsSection.confProductSkuCell(secondOption.name)}}" stepKey="fillFieldSkuForSecondAttributeOption"/> - <fillField userInput="{{firstOption.price}}" selector="{{AdminProductFormConfigurationsSection.confProductPriceCell(firstOption.name)}}" stepKey="fillFieldPriceForFirstAttributeOption"/> - <fillField userInput="{{secondOption.price}}" selector="{{AdminProductFormConfigurationsSection.confProductPriceCell(secondOption.name)}}" stepKey="fillFieldPriceForSecondAttributeOption"/> - <fillField userInput="{{firstOption.quantity}}" selector="{{AdminProductFormConfigurationsSection.confProductQuantityCell(firstOption.name)}}" stepKey="fillFieldQuantityForFirstAttributeOption"/> - <fillField userInput="{{secondOption.quantity}}" selector="{{AdminProductFormConfigurationsSection.confProductQuantityCell(secondOption.name)}}" stepKey="fillFieldQuantityForSecondAttributeOption"/> - <fillField userInput="{{firstOption.weight}}" selector="{{AdminProductFormConfigurationsSection.confProductWeightCell(firstOption.name)}}" stepKey="fillFieldWeightForFirstAttributeOption"/> - <fillField userInput="{{secondOption.weight}}" selector="{{AdminProductFormConfigurationsSection.confProductWeightCell(secondOption.name)}}" stepKey="fillFieldWeightForSecondAttributeOption"/> - </actionGroup> - - <actionGroup name="changeConfigurableProductChildProductPrice"> - <annotations> - <description>Change the price of a configurable child product in the grid under configurations.</description> - </annotations> - <arguments> - <argument name="productAttributes" type="string"/> - <argument name="productPrice" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `ChangeConfigurableProductChildProductPriceActionGroup` instead --> - <fillField userInput="{{productPrice}}" selector="{{AdminProductFormConfigurationsSection.confProductPriceCell(productAttributes)}}" stepKey="fillPriceForConfigurableProductAttributeOption"/> - </actionGroup> - - <actionGroup name="changeProductConfigurationsInGridExceptSku" extends="changeProductConfigurationsInGrid"> - <annotations> - <description>EXTENDS: changeProductConfigurationsInGrid. Removes 'fillFieldSkuForFirstAttributeOption' and 'fillFieldSkuForSecondAttributeOption'.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `ChangeProductConfigurationsInGridExceptSkuActionGroup` instead --> - <remove keyForRemoval="fillFieldSkuForFirstAttributeOption"/> - <remove keyForRemoval="fillFieldSkuForSecondAttributeOption"/> - </actionGroup> - - <actionGroup name="addProductToConfigurationsGrid"> - <annotations> - <description>Adds the provided Product SKU to the provided Product Name.</description> - </annotations> - <arguments> - <argument name="sku" type="string"/> - <argument name="name" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddProductToConfigurationsGridActionGroup` instead --> - <click selector="{{AdminProductFormConfigurationsSection.actionsBtnByProductName(name)}}" stepKey="clickToExpandFirstActions"/> - <click selector="{{AdminProductFormConfigurationsSection.addProduct(name)}}" stepKey="clickChooseFirstDifferentProduct"/> - <switchToIFrame stepKey="switchOutOfIFrame"/> - <waitForPageLoad stepKey="waitForFilters"/> - <click selector="{{AdminCreateProductConfigurationsPanel.filters}}" stepKey="clickFilters"/> - <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{sku}}" stepKey="fillProductSkuFilter"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> - <click selector="{{AdminProductGridFilterSection.firstRowBySku(sku)}}" stepKey="clickOnFirstRow"/> - </actionGroup> - - <actionGroup name="addUniqueImageToConfigurableProductOption"> - <annotations> - <description>Adds the provided Image to a Configurable Product on the Admin Product creation/edit page.</description> - </annotations> - <arguments> - <argument name="image" defaultValue="ProductImage"/> - <argument name="frontend_label" type="string"/> - <argument name="label" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddUniqueImageToConfigurableProductOptionActionGroup` instead --> - <click selector="{{AdminCreateProductConfigurationsPanel.applyUniqueImagesToEachSkus}}" stepKey="clickOnApplyUniqueImagesToEachSku"/> - <selectOption userInput="{{frontend_label}}" selector="{{AdminCreateProductConfigurationsPanel.selectImagesButton}}" stepKey="selectOption"/> - <attachFile selector="{{AdminCreateProductConfigurationsPanel.uploadImagesButton(label)}}" userInput="{{image.file}}" stepKey="uploadFile"/> - <waitForElementNotVisible selector="{{AdminCreateProductConfigurationsPanel.uploadProgressBar}}" stepKey="waitForUpload"/> - <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.imageFile(image.fileName)}}" stepKey="waitForThumbnail"/> - </actionGroup> - - <actionGroup name="addUniquePriceToConfigurableProductOption"> - <annotations> - <description>On the 'Step 3: Bulk Images, Price and Quantity' page of the 'Create Product Configurations' model click on 'Apply unique prices...'. Select provided Option. Fill price.</description> - </annotations> - <arguments> - <argument name="frontend_label" type="string"/> - <argument name="label" type="string"/> - <argument name="price" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddUniquePriceToConfigurableProductOptionActionGroup` instead --> - <click selector="{{AdminCreateProductConfigurationsPanel.applyUniquePricesToEachSkus}}" stepKey="clickOnApplyUniquePricesToEachSku"/> - <selectOption userInput="{{frontend_label}}" selector="{{AdminCreateProductConfigurationsPanel.selectPriceButton}}" stepKey="selectOption"/> - <fillField selector="{{AdminCreateProductConfigurationsPanel.price(label)}}" userInput="{{price}}" stepKey="enterAttributeQuantity"/> - </actionGroup> - - <actionGroup name="addUniqueQuantityToConfigurableProductOption"> - <arguments> - <argument name="frontend_label" type="string" defaultValue="{{productAttributeColor.default_label}}"/> - <argument name="label" type="string" defaultValue="option1"/> - <argument name="quantity" type="string" defaultValue="10"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddUniqueQuantityToConfigurableProductOptionActionGroup` instead --> - <click selector="{{AdminCreateProductConfigurationsPanel.applyUniqueQuantityToEachSkus}}" stepKey="clickOnApplyUniqueQuantitiesToEachSku"/> - <selectOption selector="{{AdminCreateProductConfigurationsPanel.selectQuantity}}" userInput="{{frontend_label}}" stepKey="selectOption"/> - <fillField selector="{{AdminCreateProductConfigurationsPanel.applyUniqueQuantity(label)}}" userInput="{{quantity}}" stepKey="enterAttributeQuantity"/> - </actionGroup> - - <actionGroup name="saveConfigurableProductWithNewAttributeSet"> - <annotations> - <description>Clicks on 'Save'. Clicks radio for '...new Attribute Set...' in the 'Choose Affected Attribute Set' modal. Clicks on 'Confirm' in the model on the Configurable Product creation/edit page.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SaveConfigurableProductWithNewAttributeSetActionGroup` instead --> - <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveConfigurableProduct"/> - <waitForElementVisible selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" time="30" stepKey="waitForAttributeSetConfirmation"/> - <click selector="{{AdminChooseAffectedAttributeSetPopup.addNewAttrSet}}" stepKey="clickAddNewAttributeSet"/> - <fillField selector="{{AdminChooseAffectedAttributeSetPopup.createNewAttrSetName}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="fillFieldNewAttrSetName"/> - <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickConfirmAttributeSet"/> - <see selector="You saved the product" stepKey="seeConfigurableSaveConfirmation" after="clickConfirmAttributeSet"/> - </actionGroup> - - <actionGroup name="saveConfigurableProductAddToCurrentAttributeSet"> - <annotations> - <description>Clicks on 'Save'. Clicks on 'Confirm' in the 'Choose Affected Attribute Set' model on the Configurable Product creation/edit page.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SaveConfigurableProductAddToCurrentAttributeSetActionGroup` instead --> - <waitForElementVisible selector="{{AdminProductFormActionSection.saveButton}}" stepKey="waitForSaveBtnVisible"/> - <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProductAgain"/> - <waitForElementVisible selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="waitPopUpVisible"/> - <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmPopup"/> - <seeElement selector="{{AdminMessagesSection.success}}" stepKey="seeSaveProductMessage"/> - </actionGroup> - - <actionGroup name="assertConfigurableProductOnAdminProductPage"> - <annotations> - <description>Validates that the provided Configurable Product Name, SKU and Price are present and correct on the Configurable Product creation/edit page. PLEASE NOTE: The Product Data is Hardcoded.</description> - </annotations> - <arguments> - <argument name="product" type="entity"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertConfigurableProductOnAdminProductPageActionGroup` instead --> - <seeInField userInput="{{ApiConfigurableProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="seeNameRequired"/> - <seeInField userInput="{{ApiConfigurableProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="seeSkuRequired"/> - <dontSeeInField userInput="{{ApiConfigurableProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="dontSeePriceRequired"/> - </actionGroup> - - <actionGroup name="StartCreateConfigurationsForAttribute" extends="generateConfigurationsByAttributeCode"> - <remove keyForRemoval="clickOnNextButton3"/> - <remove keyForRemoval="clickOnNextButton4"/> - </actionGroup> - - <actionGroup name="GotoCatalogProductsPage"> - <annotations> - <description>Goes to the Admin Products grid via the Admin Side Menu.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `GotoCatalogProductsPageActionGroup` instead --> - <click stepKey="clickOnCatalogItem" selector="{{CatalogProductsSection.catalogItem}}"/> - <waitForPageLoad stepKey="waitForCatalogLoad"/> - <click stepKey="clickOnProductItem" selector="{{CatalogProductsSection.productItem}}"/> - <waitForPageLoad stepKey="waitForCatalogProductPageLoad"/> - <seeInCurrentUrl stepKey="assertWeAreOnTheCatalogProductPage" url="{{assertionData.catalogProduct}}"/> - </actionGroup> - - <actionGroup name="GotoConfigurableProductPage"> - <annotations> - <description>Clicks on create Configurable Product from the Admin Products grid page.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `GotoConfigurableProductPageActionGroup` instead --> - <click stepKey="clickOnAddProductItem" selector="{{ConfigurableProductSection.addProductItem}}"/> - <click stepKey="clickOnConfigurationProductItem" selector="{{ConfigurableProductSection.configProductItem}}"/> - <waitForPageLoad stepKey="waitForConfigurableProductPageLoad"/> - <seeInCurrentUrl stepKey="assertWeAreOnTheConfigurableProductPage" url="{{assertionData.configurableProduct}}"/> - </actionGroup> - - <actionGroup name="FillAllRequiredFields"> - <annotations> - <description>Fills the Product Name, Price and Weight fields. Clicks on 'Create Configurations'. Clicks on 'Create New Attribute'.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `FillAllRequiredFieldsActionGroup` instead --> - <fillField stepKey="fillInProductNameFields" selector="{{NewProduct.productName}}" userInput="{{NewProductsData.productName}}"/> - <fillField stepKey="fillInPriceFields" selector="{{NewProduct.price}}" userInput="{{NewProductsData.price}}"/> - <fillField stepKey="fillInWeightFields" selector="{{NewProduct.weight}}" userInput="{{NewProductsData.weight}}"/> - <click stepKey="clickOnCreateConfigurationsButton" selector="{{NewProduct.createConfigurationButton}}"/> - <waitForPageLoad stepKey="waitForCreateProductConfigurationsPageLoad"/> - <click stepKey="clickOnCreateNewAttributeButton" selector="{{NewProduct.createNewAttributeButton}}"/> - <waitForPageLoad stepKey="waitForNewAttributePageLoad"/> - </actionGroup> - - <actionGroup name="CreateNewAttribute"> - <annotations> - <description>Creates a new Product Attribute via the Admin Products creation/edit page. PLEASE NOTE: The Product Attributes are Hardcoded.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateNewAttributeActionGroup` instead --> - <switchToIFrame stepKey="NewAttributePage" selector="{{NewProduct.newAttributeIFrame}}"/> - <fillField stepKey="fillInDefaultLabelField" selector="{{NewProduct.defaultLabel}}" userInput="{{NewProductsData.defaultLabel}}"/> - - <!--Add option 1 to attribute--> - <click selector="{{NewProduct.addOptionButton}}" stepKey="clickAddOption1"/> - <waitForPageLoad stepKey="waitForOption1"/> - <fillField stepKey="fillInAdminFieldRed" selector="{{NewProduct.adminFieldRed}}" userInput="{{NewProductsData.adminFieldRed}}"/> - <fillField stepKey="fillInDefaultStoreViewFieldRed" selector="{{NewProduct.defaultStoreViewFieldRed}}" userInput="{{NewProductsData.defaultStoreViewFieldRed}}"/> - - <!--Add option 2 to attribute--> - <click selector="{{NewProduct.addOptionButton}}" stepKey="clickAddOption2"/> - <waitForPageLoad stepKey="waitForOption2"/> - <fillField stepKey="fillInAdminFieldBlue" selector="{{NewProduct.adminFieldBlue}}" userInput="{{NewProductsData.adminFieldBlue}}"/> - <fillField stepKey="fillInDefaultStoreViewFieldBlue" selector="{{NewProduct.defaultStoreViewFieldBlue}}" userInput="{{NewProductsData.defaultStoreViewFieldBlue}}"/> - - <!--Add option 3 to attribute--> - <click selector="{{NewProduct.addOptionButton}}" stepKey="clickAddOption3"/> - <waitForPageLoad stepKey="waitForOption3"/> - <fillField stepKey="fillInAdminFieldYellow" selector="{{NewProduct.adminFieldYellow}}" userInput="{{NewProductsData.adminFieldYellow}}"/> - <fillField stepKey="fillInDefaultStoreViewFieldYellow" selector="{{NewProduct.defaultStoreViewFieldYellow}}" userInput="{{NewProductsData.defaultStoreViewFieldYellow}}"/> - - <!--Add option 4 to attribute--> - <click selector="{{NewProduct.addOptionButton}}" stepKey="clickAddOption4"/> - <waitForPageLoad stepKey="waitForOption4"/> - <fillField stepKey="fillInAdminFieldGreen" selector="{{NewProduct.adminFieldGreen}}" userInput="{{NewProductsData.adminFieldGreen}}"/> - <fillField stepKey="fillInDefaultStoreViewFieldGreen" selector="{{NewProduct.defaultStoreViewFieldGreen}}" userInput="{{NewProductsData.defaultStoreViewFieldGreen}}"/> - - <!--Add option 5 to attribute--> - <click selector="{{NewProduct.addOptionButton}}" stepKey="clickAddOption5"/> - <waitForPageLoad stepKey="waitForOption5"/> - <fillField stepKey="fillInAdminFieldBlack" selector="{{NewProduct.adminFieldBlack}}" userInput="{{NewProductsData.adminFieldBlack}}"/> - <fillField stepKey="fillInDefaultStoreViewFieldBlack" selector="{{NewProduct.defaultStoreViewFieldBlack}}" userInput="{{NewProductsData.defaultStoreViewFieldBlack}}"/> - - <!--Click Save Attribute button--> - <click selector="{{NewProduct.saveAttributeButton}}" stepKey="clickSaveAttributeButton"/> - <waitForPageLoad stepKey="waitForSavingSettings"/> - - <!--Select created Attribute --> - <click selector="{{ConfigurableProductSection.selectCreatedAttribute}}" stepKey="selectCreatedAttribute"/> - - <!--Click Next button--> - <click selector="{{ConfigurableProductSection.nextButton}}" stepKey="clickNextButton"/> - <waitForPageLoad stepKey="waitForNextPageLoaded"/> - - <!--Select all the options of all the attributes button--> - <click selector="{{CreateProductConfigurations.checkboxRed}}" stepKey="selectCheckboxRed"/> - <click selector="{{CreateProductConfigurations.checkboxBlue}}" stepKey="selectCheckboxBlue"/> - <click selector="{{CreateProductConfigurations.checkboxYellow}}" stepKey="selectCheckboxYellow"/> - <click selector="{{CreateProductConfigurations.checkboxGreen}}" stepKey="selectCheckboxGreen"/> - <click selector="{{CreateProductConfigurations.checkboxBlack}}" stepKey="selectCheckboxBlack"/> - - <!--Click Next button--> - <click selector="{{ConfigurableProductSection.nextButton}}" stepKey="clickNextButton2"/> - <waitForPageLoad stepKey="waitForBulkImagesPricePageLoaded"/> - - <!--Click Next button--> - <click selector="{{ConfigurableProductSection.nextButton}}" stepKey="clickNextButton3"/> - <waitForPageLoad stepKey="waitForSummaryPageLoaded"/> - - <!--Click Generate Configure button--> - <click selector="{{ConfigurableProductSection.generateConfigure}}" stepKey="generateConfigure"/> - <waitForPageLoad stepKey="waitForGenerateConfigure"/> - - <!-- This Error message shouldn't appear: Test will pass when bug will be fixed--> - <dontSee selector="{{CreateProductConfigurations.errorMessage}}" userInput="{{assertionData.errorMessage}}" stepKey="dontSeeError"/> - - <!--Close frame--> - <conditionalClick selector="{{ConfigurableProductSection.closeFrame}}" dependentSelector="{{ConfigurableProductSection.closeFrame}}" visible="1" stepKey="closeFrame"/> - <waitForPageLoad stepKey="waitForClosingFrame"/> - </actionGroup> - - <actionGroup name="DeleteCreatedAttribute"> - <annotations> - <description>Deletes the Configurable Product Attribute.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `DeleteCreatedAttributeActionGroup` instead --> - <click stepKey="clickOnStoresItem" selector="{{CatalogProductsSection.storesItem}}"/> - <waitForPageLoad stepKey="waitForNavigationPanel"/> - - <!--Click on Products item--> - <waitForElementVisible selector="{{CatalogProductsSection.storesProductItem}}" stepKey="waitForCatalogLoad"/> - <click stepKey="clickOnStoresProductItem" selector="{{CatalogProductsSection.storesProductItem}}"/> - <waitForPageLoad stepKey="waitForStoresProductPageLoad"/> - - <!--Click on created Attribute --> - <fillField stepKey="searchProductDefaultLabel" selector="{{CatalogProductsSection.searchDefaultLabelField}}" userInput="{{NewProductsData.defaultLabel}}"/> - <click stepKey="clickSearchButton" selector="{{CatalogProductsSection.searchButton}}"/> - <waitForPageLoad stepKey="waitForCreatedAttributeLoad"/> - <click stepKey="clickOnCreatedAttributeItem" selector="{{CatalogProductsSection.createdAttributeItem}}"/> - <waitForPageLoad stepKey="waitForAttributePropertiesPageLoad"/> - - <!--Click on Delete Attribute item--> - <click stepKey="clickOnDeleteAttributeItem" selector="{{CatalogProductsSection.deleteAttributeItem}}"/> - <waitForPageLoad stepKey="waitForDeletedDialogOpened"/> - - <!--Click on OK button--> - <click stepKey="clickOnOKButton" selector="{{CatalogProductsSection.okButton}}"/> - <waitForPageLoad stepKey="waitFordAttributeDeleted"/> - <see userInput="You deleted the product attribute." stepKey="seeDeletedTheProductAttributeMessage"/> - - <!-- Click Reset Filter button--> - <click stepKey="clickResetFilterButton" selector="{{CatalogProductsSection.resetFilter}}"/> - <waitForPageLoad stepKey="waitForAllFilterReset"/> - </actionGroup> - - <actionGroup name="StorefrontCheckCategoryConfigurableProduct"> - <annotations> - <description>Validates that the provided Configurable Product is present and correct on a Category page.</description> - </annotations> - <arguments> - <argument name="product"/> - <argument name="optionProduct"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontCheckCategoryConfigurableProductActionGroup` instead --> - <seeElement selector="{{StorefrontCategoryProductSection.ProductTitleByName(product.name)}}" stepKey="assertProductName"/> - <see userInput="${{optionProduct.price}}.00" selector="{{StorefrontCategoryProductSection.ProductPriceByName(product.name)}}" stepKey="AssertProductPrice"/> - <!-- @TODO: MAGETWO-80272 Move to Magento_Checkout --> - <moveMouseOver selector="{{StorefrontCategoryProductSection.ProductInfoByName(product.name)}}" stepKey="moveMouseOverProduct"/> - <!-- @TODO: MAGETWO-80272 Move to Magento_Checkout --> - <seeElement selector="{{StorefrontCategoryProductSection.ProductAddToCartByName(product.name)}}" stepKey="AssertAddToCart"/> - </actionGroup> - - <actionGroup name="StorefrontCheckCategoryOutOfStockConfigurableProduct"> - <annotations> - <description>Validates that the provided Configurable Product is present and correct on a Category page.</description> - </annotations> - <arguments> - <argument name="product" type="entity"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontCheckCategoryOutOfStockConfigurableProductActionGroup` instead --> - <seeElement selector="{{StorefrontCategoryProductSection.ProductTitleByName(product.name)}}" stepKey="assertProductName"/> - <moveMouseOver selector="{{StorefrontCategoryProductSection.ProductInfoByName(product.name)}}" stepKey="moveMouseOverProduct"/> - <seeElement selector="{{StorefrontCategoryProductSection.ProductStockUnavailable}}" stepKey="AssertOutOfStock"/> - <dontSeeElement selector="{{StorefrontCategoryProductSection.ProductAddToCartByName(product.name)}}" stepKey="AssertAddToCart"/> - </actionGroup> - - <actionGroup name="StorefrontCheckConfigurableProduct"> - <annotations> - <description>Goes to the provided Storefront Product page. Validates that the Product details are present and correct.</description> - </annotations> - <arguments> - <argument name="product"/> - <argument name="optionProduct"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontCheckConfigurableProductActionGroup` instead --> - <seeInCurrentUrl url="/{{product.custom_attributes[url_key]}}.html" stepKey="checkUrl"/> - <seeInTitle userInput="{{product.name}}" stepKey="AssertProductNameInTitle"/> - <see userInput="{{product.name}}" selector="{{StorefrontProductInfoMainSection.productName}}" stepKey="assertProductName"/> - <see userInput="{{product.sku}}" selector="{{StorefrontProductInfoMainSection.productSku}}" stepKey="assertProductSku"/> - <see userInput="${{optionProduct.price}}.00" selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="assertProductPrice"/> - <see userInput="IN STOCK" selector="{{StorefrontProductInfoMainSection.productStockStatus}}" stepKey="assertInStock"/> - <seeElement selector="{{StorefrontProductInfoMainSection.AddToCart}}" stepKey="assertAddToCart"/> - <see userInput="{{product.custom_attributes[description]}}" selector="{{StorefrontProductInfoMainSection.productDescription}}" stepKey="assertProductDescription"/> - <see userInput="{{product.custom_attributes[short_description]}}" selector="{{StorefrontProductInfoMainSection.productShortDescription}}" stepKey="assertProductShortDescription"/> - </actionGroup> - - <actionGroup name="VerifyOptionInProductStorefront"> - <annotations> - <description>Validates that the provided Option Code and Option Name are present and correct on a Configurable Product page.</description> - </annotations> - <arguments> - <argument name="attributeCode" type="string"/> - <argument name="optionName" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `VerifyOptionInProductStorefrontActionGroup` instead --> - <seeElement selector="{{StorefrontProductInfoMainSection.attributeOptionByAttributeID(attributeCode, optionName)}}" stepKey="verifyOptionExists"/> - </actionGroup> - - <actionGroup name="SelectSingleAttributeAndAddToCart"> - <annotations> - <description>Selects a Product Option. Clicks 'Add to Cart'. Validates that the Product Added Success message appears.</description> - </annotations> - <arguments> - <argument name="productName" type="string"/> - <argument name="attributeCode" type="string"/> - <argument name="optionName" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SelectSingleAttributeAndAddToCartActionGroup` instead --> - <selectOption selector="{{StorefrontProductInfoMainSection.attributeSelectByAttributeID(attributeCode)}}" userInput="{{optionName}}" stepKey="selectAttribute"/> - <click stepKey="addProduct" selector="{{StorefrontProductActionSection.addToCart}}"/> - <waitForElementVisible selector="{{StorefrontQuickSearchResultsSection.messageSection}}" time="30" stepKey="waitForProductAdded"/> - <see selector="{{StorefrontQuickSearchResultsSection.messageSection}}" userInput="You added {{productName}} to your shopping cart." stepKey="seeAddedToCartMessage"/> - </actionGroup> - - <actionGroup name="storefrontCheckConfigurableProductOptions"> - <annotations> - <description>Validates that the Options for a Configurable Product are present and correct.</description> - </annotations> - <arguments> - <argument name="product" type="entity"/> - <argument name="firstOption" type="entity"/> - <argument name="secondOption" type="entity"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontCheckConfigurableProductOptionsActionGroup` instead --> - <selectOption userInput="{{firstOption.name}}" selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" stepKey="selectOption1"/> - <see userInput="{{product.name}}" selector="{{StorefrontProductInfoMainSection.productName}}" stepKey="seeConfigurableProductName"/> - <see userInput="{{firstOption.price}}" selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="assertProductPricePresent"/> - <see userInput="{{product.sku}}" selector="{{StorefrontProductInfoMainSection.productSku}}" stepKey="seeConfigurableProductSku"/> - <see userInput="IN STOCK" selector="{{StorefrontProductInfoMainSection.productStockStatus}}" stepKey="assertInStock"/> - <see userInput="{{colorProductAttribute.default_label}}" selector="{{StorefrontProductInfoMainSection.productAttributeTitle1}}" stepKey="seeColorAttributeName"/> - <dontSee userInput="As low as" selector="{{StorefrontProductInfoMainSection.productPriceLabel}}" stepKey="dontSeeProductPriceLabel1"/> - <selectOption userInput="{{secondOption.name}}" selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" stepKey="selectOption2"/> - <dontSee userInput="As low as" selector="{{StorefrontProductInfoMainSection.productPriceLabel}}" stepKey="dontSeeProductPriceLabel2"/> - <see userInput="{{secondOption.price}}" selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="seeProductPrice2"/> - </actionGroup> - - <actionGroup name="assertOptionImageInStorefrontProductPage"> - <annotations> - <description>Validates that the provided Product Image is present when the provided Product Option is selected.</description> - </annotations> - <arguments> - <argument name="product" type="entity"/> - <argument name="label" type="string"/> - <argument name="image" defaultValue="MagentoLogo"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertOptionImageInStorefrontProductPageActionGroup` instead --> - <seeInCurrentUrl url="/{{product.urlKey}}.html" stepKey="checkUrl"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <selectOption userInput="{{label}}" selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" stepKey="selectOption1"/> - <seeElement selector="{{StorefrontProductMediaSection.imageFile(image.filename)}}" stepKey="seeFirstImage"/> - </actionGroup> - - <actionGroup name="assertConfigurableProductWithSpecialPriceOnStorefrontProductPage"> - <annotations> - <description>Validates that Special Price for a Configurable Product is present and correct when the provided Product Option is selected.</description> - </annotations> - <arguments> - <argument name="option" type="string"/> - <argument name="price" type="string"/> - <argument name="specialPrice" defaultValue="specialProductPrice"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertConfigurableProductWithSpecialPriceOnStorefrontProductPageActionGroup` instead --> - <selectOption userInput="{{option}}" selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" stepKey="selectOptionWithSpecialPrice"/> - <see userInput="{{specialProductPrice.price}}" selector="{{StorefrontProductInfoMainSection.productSpecialPrice}}" stepKey="seeSpecialProductPrice"/> - <see userInput="Regular Price" selector="{{StorefrontProductInfoMainSection.specialProductText}}" stepKey="seeText"/> - <see userInput="{{price}}" selector="{{StorefrontProductInfoMainSection.oldProductPrice}}" stepKey="seeOldProductPrice"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml deleted file mode 100644 index 0bb23b04b66a9..0000000000000 --- a/app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<!-- -NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. - Please find the Comment with proper replacement for each of ActionGroups provided. ---> -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - - <actionGroup name="StorefrontSwitchCurrency"> - <arguments> - <argument name="currency" type="string" defaultValue="EUR"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontSwitchCurrencyActionGroup` instead --> - <click selector="{{StorefrontSwitchCurrencyRatesSection.currencyTrigger}}" stepKey="openTrigger"/> - <waitForElementVisible selector="{{StorefrontSwitchCurrencyRatesSection.currency(currency)}}" stepKey="waitForCurrency"/> - <click selector="{{StorefrontSwitchCurrencyRatesSection.currency(currency)}}" stepKey="chooseCurrency"/> - <see selector="{{StorefrontSwitchCurrencyRatesSection.selectedCurrency}}" userInput="{{currency}}" stepKey="seeSelectedCurrency"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Downloadable/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Downloadable/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml deleted file mode 100644 index 9d739995e99e6..0000000000000 --- a/app/code/Magento/Downloadable/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml +++ /dev/null @@ -1,106 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<!-- -NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. - Please find the Comment with proper replacement for each of ActionGroups provided. ---> -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="fillMainDownloadableProductForm"> - <annotations> - <description>Fills the Name, SKU, Price and Quantity on the Product creation/edit page.</description> - </annotations> - <arguments> - <argument name="product" defaultValue="DownloadableProduct"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `FillMainDownloadableProductFormActionGroup` instead --> - <fillField selector="{{AdminProductFormSection.productName}}" userInput="{{product.name}}" stepKey="fillProductSku"/> - <fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="fillProductName"/> - <fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{product.price}}" stepKey="fillProductPrice"/> - <fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="{{product.quantity}}" stepKey="fillProductQty"/> - </actionGroup> - - <actionGroup name="addDownloadableProductLinkWithMaxDownloads"> - <annotations> - <description>Clicks on 'Add Link'. Fills in the provided Link details including a Max Downloads limit.</description> - </annotations> - <arguments> - <argument name="link" defaultValue="downloadableLinkWithMaxDownloads"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddDownloadableProductLinkWithMaxDownloadsActionGroup` instead --> - <click selector="{{AdminProductDownloadableSection.linksAddLinkButton}}" stepKey="clickLinkAddLinkButton"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <fillField userInput="{{link.title}}" selector="{{AdminProductDownloadableSection.addLinkTitleInput('0')}}" stepKey="fillDownloadableLinkTitle"/> - <fillField userInput="{{link.price}}" selector="{{AdminProductDownloadableSection.addLinkPriceInput('0')}}" stepKey="fillDownloadableLinkPrice"/> - <selectOption userInput="{{link.file_type}}" selector="{{AdminProductDownloadableSection.addLinkFileTypeSelector('0')}}" stepKey="selectDownloadableLinkFileType"/> - <selectOption userInput="{{link.sample_type}}" selector="{{AdminProductDownloadableSection.addLinkSampleTypeSelector('0')}}" stepKey="selectDownloadableLinkSampleType"/> - <selectOption userInput="{{link.shareable}}" selector="{{AdminProductDownloadableSection.addLinkShareableSelector('0')}}" stepKey="selectDownloadableLinkShareable"/> - <fillField userInput="{{link.max_downloads}}" selector="{{AdminProductDownloadableSection.addLinkMaxDownloadsInput('0')}}" stepKey="fillDownloadableLinkMaxDownloads"/> - <attachFile userInput="{{link.file}}" selector="{{AdminProductDownloadableSection.addLinkFileUploadFile('0')}}" stepKey="fillDownloadableLinkUploadFile"/> - <fillField userInput="{{link.sample}}" selector="{{AdminProductDownloadableSection.addLinkSampleUrlInput('0')}}" stepKey="fillDownloadableLinkSampleUrl"/> - </actionGroup> - - <actionGroup name="addDownloadableProductLink"> - <annotations> - <description>Clicks on 'Add Link', under the 'Links' section. Fills in the provided Link details including Unlimited Downloads.</description> - </annotations> - <arguments> - <argument name="link" defaultValue="downloadableLink"/> - <argument name="index" type="string" defaultValue="1"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddDownloadableProductLinkActionGroup` instead --> - <click selector="{{AdminProductDownloadableSection.linksAddLinkButton}}" stepKey="clickLinkAddLinkButton"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <fillField userInput="{{link.title}}" selector="{{AdminProductDownloadableSection.addLinkTitleInput(index)}}" stepKey="fillDownloadableLinkTitle"/> - <fillField userInput="{{link.price}}" selector="{{AdminProductDownloadableSection.addLinkPriceInput(index)}}" stepKey="fillDownloadableLinkPrice"/> - <selectOption userInput="{{link.file_type}}" selector="{{AdminProductDownloadableSection.addLinkFileTypeSelector(index)}}" stepKey="selectDownloadableLinkFileType"/> - <selectOption userInput="{{link.sample_type}}" selector="{{AdminProductDownloadableSection.addLinkSampleTypeSelector(index)}}" stepKey="selectDownloadableLinkSampleType"/> - <selectOption userInput="{{link.shareable}}" selector="{{AdminProductDownloadableSection.addLinkShareableSelector(index)}}" stepKey="selectDownloadableLinkShareable"/> - <checkOption selector="{{AdminProductDownloadableSection.addLinkIsUnlimitedDownloads(index)}}" stepKey="checkDownloadableLinkUnlimited"/> - <fillField userInput="{{link.file}}" selector="{{AdminProductDownloadableSection.addLinkFileUrlInput(index)}}" stepKey="fillDownloadableLinkFileUrl"/> - <attachFile userInput="{{link.sample}}" selector="{{AdminProductDownloadableSection.addLinkSampleUploadFile(index)}}" stepKey="attachDownloadableLinkUploadSample"/> - <waitForPageLoad stepKey="waitForPageLoadAfterFillingOutForm" /> - </actionGroup> - - <actionGroup name="addDownloadableSampleFile"> - <annotations> - <description>Clicks on 'Add Link' under the 'Samples' section. Fills in the provided Downloadable Sample File details.</description> - </annotations> - <arguments> - <argument name="sample" defaultValue="downloadableSampleFile"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddDownloadableSampleFileActionGroup` instead --> - <click selector="{{AdminProductDownloadableSection.samplesAddLinkButton}}" stepKey="clickSampleAddLinkButton"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <fillField userInput="{{sample.title}}" selector="{{AdminProductDownloadableSection.addSampleTitleInput('0')}}" stepKey="fillDownloadableSampleTitle"/> - <selectOption userInput="{{sample.file_type}}" selector="{{AdminProductDownloadableSection.addSampleFileTypeSelector('0')}}" stepKey="selectDownloadableSampleFileType"/> - <attachFile userInput="{{sample.file}}" selector="{{AdminProductDownloadableSection.addSampleFileUploadFile('0')}}" stepKey="selectDownloadableSampleUpload"/> - <waitForAjaxLoad stepKey="waitForSampleFileUpload"/> - </actionGroup> - - <actionGroup name="addDownloadableSampleUrl"> - <annotations> - <description>Clicks on 'Add Link' under the 'Samples' section. Fills in the provided Downloadable Sample URL details.</description> - </annotations> - <arguments> - <argument name="sample" defaultValue="downloadableSampleUrl"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddDownloadableSampleUrlActionGroup` instead --> - <click selector="{{AdminProductDownloadableSection.samplesAddLinkButton}}" stepKey="clickSampleAddLinkButton2"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <fillField userInput="{{sample.title}}" selector="{{AdminProductDownloadableSection.addSampleTitleInput('1')}}" stepKey="fillDownloadableSampleTitle"/> - <selectOption userInput="{{sample.file_type}}" selector="{{AdminProductDownloadableSection.addSampleFileTypeSelector('1')}}" stepKey="selectDownloadableSampleFileType"/> - <fillField userInput="{{sample.file}}" selector="{{AdminProductDownloadableSection.addSampleFileUrlInput('1')}}" stepKey="fillDownloadableSampleFileUrl"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Email/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Email/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml deleted file mode 100644 index 855ec8790f8f2..0000000000000 --- a/app/code/Magento/Email/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml +++ /dev/null @@ -1,90 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<!-- -NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. - Please find the Comment with proper replacement for each of ActionGroups provided. ---> -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="CreateNewTemplate"> - <annotations> - <description>Clicks on Add New Template. Fills the Template details. Clicks on Save. PLEASE NOTE: The values are Hardcoded.</description> - </annotations> - <arguments> - <argument name="template" defaultValue="EmailTemplate"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateNewTemplateActionGroup` instead --> - <amOnPage url="{{AdminEmailTemplateIndexPage.url}}" stepKey="navigateToEmailTemplatePage"/> - <click selector="{{AdminMainActionsSection.add}}" stepKey="clickAddNewTemplateButton"/> - <selectOption selector="{{AdminEmailTemplateEditSection.templateDropDown}}" userInput="Registry Update" stepKey="selectValueFromTemplateDropDown"/> - <click selector="{{AdminEmailTemplateEditSection.loadTemplateButton}}" stepKey="clickLoadTemplateButton"/> - <fillField selector="{{AdminEmailTemplateEditSection.templateCode}}" userInput="{{EmailTemplate.templateName}}" stepKey="fillTemplateNameField"/> - <click selector="{{AdminMainActionsSection.save}}" stepKey="clickSaveTemplateButton"/> - <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForSuccessMessage"/> - <see selector="{{AdminMessagesSection.success}}" userInput="You saved the email template." stepKey="seeSuccessMessage"/> - </actionGroup> - - <actionGroup name="CreateCustomTemplate" extends="CreateNewTemplate"> - <remove keyForRemoval="selectValueFromTemplateDropDown"/> - <remove keyForRemoval="clickLoadTemplateButton"/> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateCustomTemplateActionGroup` instead --> - <fillField selector="{{AdminEmailTemplateEditSection.templateSubject}}" userInput="{{template.templateSubject}}" after="fillTemplateNameField" stepKey="fillTemplateSubject"/> - <fillField selector="{{AdminEmailTemplateEditSection.templateText}}" userInput="{{template.templateText}}" after="fillTemplateSubject" stepKey="fillTemplateText"/> - </actionGroup> - - <actionGroup name="FindAndOpenEmailTemplate"> - <arguments> - <argument name="template" defaultValue="EmailTemplate"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `FindAndOpenEmailTemplateActionGroup` instead --> - <amOnPage url="{{AdminEmailTemplateIndexPage.url}}" stepKey="navigateEmailTemplatePage" /> - <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clearFilters"/> - <fillField selector="{{AdminEmailTemplateIndexSection.searchTemplateField}}" userInput="{{template.templateName}}" stepKey="findCreatedTemplate"/> - <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickSearch"/> - <waitForElementVisible selector="{{AdminEmailTemplateIndexSection.templateRowByName(template.templateName)}}" stepKey="waitForTemplatesAppeared"/> - <click selector="{{AdminEmailTemplateIndexSection.templateRowByName(template.templateName)}}" stepKey="clickToOpenTemplate"/> - <waitForElementVisible selector="{{AdminEmailTemplateEditSection.templateCode}}" stepKey="waitForTemplateNameisible"/> - <seeInField selector="{{AdminEmailTemplateEditSection.templateCode}}" userInput="{{template.templateName}}" stepKey="checkTemplateName"/> - </actionGroup> - - <actionGroup name="DeleteEmailTemplate" extends="FindAndOpenEmailTemplate"> - <annotations> - <description>Clicks on Delete Template. Accepts the Popup. Validates that the Email Template is NOT present in the Email Templates Grid.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `DeleteEmailTemplateActionGroup` instead --> - <click selector="{{AdminEmailTemplateEditSection.deleteTemplateButton}}" after="checkTemplateName" stepKey="deleteTemplate"/> - <waitForElementVisible selector="{{AdminEmailTemplateEditSection.acceptPopupButton}}" after="deleteTemplate" stepKey="waitForConfirmButton"/> - <click selector="{{AdminEmailTemplateEditSection.acceptPopupButton}}" after="waitForConfirmButton" stepKey="acceptPopup"/> - <waitForElementVisible selector="{{AdminMessagesSection.success}}" after="acceptPopup" stepKey="waitForSuccessMessage"/> - <see selector="{{AdminMessagesSection.success}}" userInput="You deleted the email template." after="waitForSuccessMessage" stepKey="seeSuccessfulMessage"/> - </actionGroup> - - <actionGroup name="PreviewEmailTemplateActionGroup" extends="FindAndOpenEmailTemplate"> - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateSystemBackupActionGroup` instead --> - <click selector="{{AdminEmailTemplateEditSection.previewTemplateButton}}" after="checkTemplateName" stepKey="clickPreviewTemplate"/> - <switchToNextTab after="clickPreviewTemplate" stepKey="switchToNewOpenedTab"/> - <seeInCurrentUrl url="{{AdminEmailTemplatePreviewPage.url}}" after="switchToNewOpenedTab" stepKey="seeCurrentUrl"/> - <seeElement selector="{{AdminEmailTemplatePreviewSection.iframe}}" after="seeCurrentUrl" stepKey="seeIframeOnPage"/> - <switchToIFrame userInput="preview_iframe" after="seeIframeOnPage" stepKey="switchToIframe"/> - <waitForPageLoad after="switchToIframe" stepKey="waitForPageLoaded"/> - </actionGroup> - - <actionGroup name="AssertEmailTemplateContent"> - <arguments> - <argument name="expectedContent" type="string" defaultValue="{{EmailTemplate.templateText}}"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertEmailTemplateContentActionGroup` instead --> - <see userInput="{{expectedContent}}" stepKey="checkTemplateContainText"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml deleted file mode 100644 index 6da85827f77ec..0000000000000 --- a/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml +++ /dev/null @@ -1,96 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<!-- -NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. - Please find the Comment with proper replacement for each of ActionGroups provided. ---> -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="checkRequiredFieldsInGroupedProductForm"> - <annotations> - <description>Clears the Product Name and SKU fields when adding a Grouped Product and then verifies that they are required after attempting to Save.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CheckRequiredFieldsInGroupedProductFormActionGroup` instead --> - <clearField selector="{{AdminProductFormSection.productName}}" stepKey="clearProductSku"/> - <clearField selector="{{AdminProductFormSection.productSku}}" stepKey="clearProductName"/> - <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveButton"/> - <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Product" stepKey="seeStillOnEditPage"/> - <see selector="{{AdminProductFormSection.fieldError('name')}}" userInput="This is a required field." stepKey="seeNameRequired"/> - <see selector="{{AdminProductFormSection.fieldError('sku')}}" userInput="This is a required field." stepKey="seeSkuRequired"/> - </actionGroup> - - <!--Fill main fields in grouped product form--> - <actionGroup name="fillGroupedProductForm"> - <annotations> - <description>Fills in the provided Product Name and SKU on the Grouped Product creation/edit page.</description> - </annotations> - <arguments> - <argument name="product" defaultValue="GroupedProduct"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `FillGroupedProductFormActionGroup` instead --> - <fillField selector="{{AdminProductFormSection.productName}}" userInput="{{product.name}}" stepKey="fillProductSku"/> - <fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="fillProductName"/> - </actionGroup> - - <actionGroup name="viewGroupedProductInAdminGrid"> - <annotations> - <description>Goes to the Admin Products grid page. Filters the grid for the provided Product. Validates that the provided Product appears in the grid.</description> - </annotations> - <arguments> - <argument name="product" defaultValue="GroupedProduct"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `ViewGroupedProductInAdminGridActionGroup` instead --> - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> - <waitForPageLoad stepKey="waitForPageLoadInitial"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> - <fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="{{product.name}}" stepKey="fillProductNameFilter"/> - <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillProductSkuFilter"/> - <selectOption selector="{{AdminProductGridFilterSection.typeFilter}}" userInput="{{product.type_id}}" stepKey="selectionProductType"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> - <see selector="{{AdminProductGridSection.firstProductRow}}" userInput="{{product.name}}" stepKey="seeProductNameInGrid"/> - <click selector="{{AdminProductGridFilterSection.clearFilters}}" stepKey="clickClearFiltersAfter"/> - </actionGroup> - - <actionGroup name="fillDefaultQuantityForLinkedToGroupProductInGrid"> - <annotations> - <description>Fills the provided Qty for a Product linked to a Grouped Product.</description> - </annotations> - <arguments> - <argument name="productName" type="string"/> - <argument name="qty" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `FillDefaultQuantityForLinkedToGroupProductInGridActionGroup` instead --> - <fillField selector="{{AdminAddedProductsToGroupGrid.inputByProductName(productName)}}" userInput="{{qty}}" stepKey="fillDefaultQtyForLinkedProduct"/> - </actionGroup> - - <actionGroup name="AdminAssignProductToGroup"> - <annotations> - <description>Adds the provided Product to a Grouped Product on an Admin Grouped Product creation/edit page.</description> - </annotations> - <arguments> - <argument name="product"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminAssignProductToGroupActionGroup` instead --> - <scrollTo selector="{{AdminProductFormGroupedProductsSection.toggleGroupedProduct}}" x="0" y="-100" stepKey="scrollToGroupedSection"/> - <conditionalClick selector="{{AdminProductFormGroupedProductsSection.toggleGroupedProduct}}" dependentSelector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" visible="false" stepKey="openGroupedProductsSection"/> - <click selector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" stepKey="clickAddProductsToGroup"/> - <conditionalClick selector="{{AdminAddProductsToGroupPanel.clearFilters}}" dependentSelector="{{AdminAddProductsToGroupPanel.clearFilters}}" visible="true" stepKey="clearExistingFilters"/> - <click selector="{{AdminAddProductsToGroupPanel.filters}}" stepKey="showFiltersPanel"/> - <fillField userInput="{{product.name}}" selector="{{AdminAddProductsToGroupPanel.nameFilter}}" stepKey="fillNameFilter"/> - <click selector="{{AdminAddProductsToGroupPanel.applyFilters}}" stepKey="clickApplyFilters"/> - <click selector="{{AdminAddProductsToGroupPanel.firstCheckbox}}" stepKey="selectProduct"/> - <click selector="{{AdminAddProductsToGroupPanel.addSelectedProducts}}" stepKey="clickAddSelectedGroupProducts"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml deleted file mode 100644 index 41d8803a253f9..0000000000000 --- a/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<!-- -NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. - Please find the Comment with proper replacement for each of ActionGroups provided. ---> -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="StorefrontGoCheckoutWithMultipleAddresses"> - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontGoCheckoutWithMultipleAddressesActionGroup` instead --> - <click selector="{{MultishippingSection.shippingMultipleCheckout}}" stepKey="clickToMultipleAddressShippingButton"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml deleted file mode 100644 index c3f29feb63b8d..0000000000000 --- a/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<!-- -NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. - Please find the Comment with proper replacement for each of ActionGroups provided. ---> -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="StorefrontCreateNewAccountNewsletterChecked" extends="SignUpNewUserFromStorefrontActionGroup"> - <annotations> - <description>EXTENDS: SignUpNewUserFromStorefrontActionGroup. Clicks on 'Sign Up for Newsletter'. Validates that the Subscription Confirmation message is present and correct.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontCreateNewAccountNewsletterCheckedActionGroup` instead --> - <click selector="{{StorefrontCustomerCreateFormSection.signUpForNewsletter}}" stepKey="selectSignUpForNewsletterCheckbox" after="fillLastName"/> - <see stepKey="seeDescriptionNewsletter" userInput='You are subscribed to "General Subscription".' selector="{{CustomerMyAccountPage.DescriptionNewsletter}}"/> - </actionGroup> - - <actionGroup name="StorefrontCreateNewAccountNewsletterUnchecked" extends="SignUpNewUserFromStorefrontActionGroup"> - <annotations> - <description>EXTENDS: SignUpNewUserFromStorefrontActionGroup. Validates that the you are NOT subscribed message is present and correct.</description> - </annotations> - <arguments> - <argument name="Customer"/> - <argument name="Store"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontCreateNewAccountNewsletterUncheckedActionGroup` instead --> - <amOnPage stepKey="amOnStorefrontPage" url="{{Store.code}}"/> - <see stepKey="seeDescriptionNewsletter" userInput="You aren't subscribed to our newsletter." selector="{{CustomerMyAccountPage.DescriptionNewsletter}}"/> - <see stepKey="seeThankYouMessage" userInput="Thank you for registering with NewStore."/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/PageCache/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/PageCache/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml deleted file mode 100644 index 65e8a0604f505..0000000000000 --- a/app/code/Magento/PageCache/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<!-- -NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. - Please find the Comment with proper replacement for each of ActionGroups provided. ---> -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="clearPageCache"> - <annotations> - <description>Goes to the Admin Cache Management page. Selects 'Refresh'. Checks the 'Page Cache' row. Clicks on Submit.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `ClearPageCacheActionGroup` instead --> - <amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}/admin/cache/" stepKey="amOnCacheManagementPage"/> - <waitForPageLoad stepKey="waitForCacheManagement"/> - <selectOption selector="{{AdminCacheManagementSection.massActionSelect}}" userInput="refresh" stepKey="selectRefresh"/> - <click selector="{{AdminCacheManagementSection.pageCacheCheckbox}}" stepKey="selectPageCache"/> - <click selector="{{AdminCacheManagementSection.massActionSubmit}}" stepKey="submitCacheForm"/> - <waitForPageLoad stepKey="waitForCacheFlush"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Paypal/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Paypal/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml deleted file mode 100644 index e6765a6a520e1..0000000000000 --- a/app/code/Magento/Paypal/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml +++ /dev/null @@ -1,150 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<!-- -NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. - Please find the Comment with proper replacement for each of ActionGroups provided. ---> -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="EnablePayPalConfiguration"> - <annotations> - <description>Expands the 'OTHER PAYPAL PAYMENT SOLUTIONS' tab on the Admin Configuration page. Enables the provided PayPal Config type for the provided Country Code.</description> - </annotations> - <arguments> - <argument name="payPalConfigType"/> - <argument name="countryCode" type="string" defaultValue="us"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `EnablePayPalConfigurationActionGroup` instead --> - <waitForElementVisible selector="{{OtherPayPalPaymentsConfigSection.expandTab(countryCode)}}" stepKey="waitForOtherPayPalPaymentsSection"/> - <conditionalClick selector="{{OtherPayPalPaymentsConfigSection.expandTab(countryCode)}}" dependentSelector="{{OtherPayPalPaymentsConfigSection.expandedTab(countryCode)}}" visible="false" stepKey="clickOtherPayPalPaymentsSection"/> - <waitForElementVisible selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="waitForWPSExpressConfigureBtn"/> - <click selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="clickWPSExpressConfigureBtn"/> - <waitForElementVisible selector="{{payPalConfigType.enableSolution(countryCode)}}" stepKey="waitForWPSExpressEnable"/> - <selectOption selector="{{payPalConfigType.enableSolution(countryCode)}}" userInput="Yes" stepKey="enableWPSExpressSolution"/> - <seeInPopup userInput="There is already another PayPal solution enabled. Enable this solution instead?" stepKey="seeAlertMessage"/> - <acceptPopup stepKey="acceptEnablePopUp"/> - <click selector="{{AdminConfigSection.saveButton}}" stepKey="saveConfig"/> - <waitForPageLoad stepKey="waitForPageLoad2"/> - </actionGroup> - - <actionGroup name="EnablePayPalSolutionWithoutSave" > - <annotations> - <description>Expands the 'OTHER PAYPAL PAYMENT SOLUTIONS' tab on the Admin Configuration page. Enables the provided PayPal Config type for the provided Country Code without saving.</description> - </annotations> - <arguments> - <argument name="payPalConfigType"/> - <argument name="countryCode" type="string" defaultValue="us"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `EnablePayPalSolutionWithoutSaveActionGroup` instead --> - <waitForElementVisible selector="{{OtherPayPalPaymentsConfigSection.expandTab(countryCode)}}" stepKey="waitForOtherPayPalPaymentsSection"/> - <conditionalClick selector="{{OtherPayPalPaymentsConfigSection.expandTab(countryCode)}}" dependentSelector="{{OtherPayPalPaymentsConfigSection.expandedTab(countryCode)}}" visible="false" stepKey="clickOtherPayPalPaymentsSection"/> - <waitForElementVisible selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="waitForWPSExpressConfigureBtn"/> - <click selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="clickWPSExpressConfigureBtn"/> - <waitForElementVisible selector="{{payPalConfigType.enableSolution(countryCode)}}" stepKey="waitForWPSExpressEnable"/> - <selectOption selector="{{payPalConfigType.enableSolution(countryCode)}}" userInput="Yes" stepKey="enableWPSExpressSolution"/> - </actionGroup> - - <actionGroup name="CheckEnableOptionPayPalConfiguration"> - <annotations> - <description>Expands the 'OTHER PAYPAL PAYMENT SOLUTIONS' tab on the Admin Configuration page. Enables the provided PayPal Config type for the provided Country Code.</description> - </annotations> - <arguments> - <argument name="payPalConfigType"/> - <argument name="enabledOption" type="string"/> - <argument name="countryCode" type="string" defaultValue="us"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CheckEnableOptionPayPalConfigurationActionGroup` instead --> - <waitForElementVisible selector="{{OtherPayPalPaymentsConfigSection.expandTab(countryCode)}}" stepKey="waitForOtherPayPalPaymentsSection"/> - <conditionalClick selector="{{OtherPayPalPaymentsConfigSection.expandTab(countryCode)}}" dependentSelector="{{OtherPayPalPaymentsConfigSection.expandedTab(countryCode)}}" visible="false" stepKey="clickOtherPayPalPaymentsSection"/> - <waitForElementVisible selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="waitForWPSExpressConfigureBtn"/> - <click selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="clickWPSExpressConfigureBtn1"/> - <waitForElementVisible selector="{{payPalConfigType.enableSolution(countryCode)}}" stepKey="waitForWPSExpressEnable"/> - <seeOptionIsSelected selector="{{payPalConfigType.enableSolution(countryCode)}}" userInput="{{enabledOption}}" stepKey="seeSelectedOption"/> - <click selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="clickWPSExpressConfigureBtn2"/> - </actionGroup> - - <actionGroup name="ConfigPayPalExpressCheckout"> - <annotations> - <description>Goes to the 'Configuration' page for 'Payment Methods'. Fills in the provided PayPal credentials and other details. Clicks on Save.</description> - </annotations> - <arguments> - <argument name="credentials" defaultValue="_CREDS"/> - <argument name="countryCode" type="string" defaultValue="us"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `ConfigPayPalExpressCheckoutActionGroup` instead --> - <amOnPage url="{{AdminConfigPaymentMethodsPage.url}}" stepKey="navigateToPaymentConfigurationPage"/> - <waitForPageLoad stepKey="waitForPageLoad1"/> - <click selector="{{PayPalExpressCheckoutConfigSection.configureBtn(countryCode)}}" stepKey="clickPayPalConfigureBtn"/> - <waitForElementVisible selector="{{PayPalAdvancedSettingConfigSection.advancedSettingTab(countryCode)}}" stepKey="waitForAdvancedSettingTab"/> - <fillField selector ="{{PayPalExpressCheckoutConfigSection.email(countryCode)}}" userInput="{{credentials.magento/paypal_express_checkout_us_business_account}}" stepKey="inputEmailAssociatedWithPayPalMerchantAccount"/> - <selectOption selector ="{{PayPalExpressCheckoutConfigSection.apiMethod(countryCode)}}" userInput="API Signature" stepKey="inputAPIAuthenticationMethods"/> - <fillField selector ="{{PayPalExpressCheckoutConfigSection.username(countryCode)}}" userInput="{{credentials.magento/paypal_express_checkout_us_api_username}}" stepKey="inputAPIUsername"/> - <fillField selector ="{{PayPalExpressCheckoutConfigSection.password(countryCode)}}" userInput="{{credentials.magento/paypal_express_checkout_us_api_password}}" stepKey="inputAPIPassword"/> - <fillField selector ="{{PayPalExpressCheckoutConfigSection.signature(countryCode)}}" userInput="{{credentials.magento/paypal_express_checkout_us_api_signature}}" stepKey="inputAPISignature"/> - <selectOption selector ="{{PayPalExpressCheckoutConfigSection.sandboxMode(countryCode)}}" userInput="Yes" stepKey="enableSandboxMode"/> - <selectOption selector="{{PayPalExpressCheckoutConfigSection.enableSolution(countryCode)}}" userInput="Yes" stepKey="enableSolution"/> - <fillField selector ="{{PayPalExpressCheckoutConfigSection.merchantID(countryCode)}}" userInput="{{credentials.magento/paypal_express_checkout_us_merchant_id}}" stepKey="inputMerchantID"/> - <click selector="{{AdminConfigSection.saveButton}}" stepKey="saveConfig"/> - </actionGroup> - - <actionGroup name="SampleConfigPayPalExpressCheckout"> - <annotations> - <description>Goes to the 'Configuration' page for 'Payment Methods'. Fills in the provided Sample PayPal credentials and other details. Clicks on Save.</description> - </annotations> - <arguments> - <argument name="credentials" defaultValue="SamplePaypalExpressConfig"/> - <argument name="countryCode" type="string" defaultValue="us"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SampleConfigPayPalExpressCheckoutActionGroup` instead --> - <amOnPage url="{{AdminConfigPaymentMethodsPage.url}}" stepKey="navigateToPaymentConfigurationPage"/> - <waitForPageLoad stepKey="waitForPageLoad1"/> - <click selector="{{PayPalExpressCheckoutConfigSection.configureBtn(countryCode)}}" stepKey="clickPayPalConfigureBtn"/> - <waitForElementVisible selector="{{PayPalAdvancedSettingConfigSection.advancedSettingTab(countryCode)}}" stepKey="waitForAdvancedSettingTab"/> - <fillField selector ="{{PayPalExpressCheckoutConfigSection.email(countryCode)}}" userInput="{{credentials.paypal_express_email}}" stepKey="inputEmailAssociatedWithPayPalMerchantAccount"/> - <selectOption selector ="{{PayPalExpressCheckoutConfigSection.apiMethod(countryCode)}}" userInput="API Signature" stepKey="inputAPIAuthenticationMethods"/> - <fillField selector ="{{PayPalExpressCheckoutConfigSection.username(countryCode)}}" userInput="{{credentials.paypal_express_api_username}}" stepKey="inputAPIUsername"/> - <fillField selector ="{{PayPalExpressCheckoutConfigSection.password(countryCode)}}" userInput="{{credentials.paypal_express_api_password}}" stepKey="inputAPIPassword"/> - <fillField selector ="{{PayPalExpressCheckoutConfigSection.signature(countryCode)}}" userInput="{{credentials.paypal_express_api_signature}}" stepKey="inputAPISignature"/> - <selectOption selector ="{{PayPalExpressCheckoutConfigSection.sandboxMode(countryCode)}}" userInput="Yes" stepKey="enableSandboxMode"/> - <selectOption selector="{{PayPalExpressCheckoutConfigSection.enableSolution(countryCode)}}" userInput="Yes" stepKey="enableSolution"/> - <fillField selector ="{{PayPalExpressCheckoutConfigSection.merchantID(countryCode)}}" userInput="{{credentials.paypal_express_merchantID}}" stepKey="inputMerchantID"/> - <click selector="{{AdminConfigSection.saveButton}}" stepKey="saveConfig"/> - </actionGroup> - - <actionGroup name="addProductToCheckoutPage"> - <annotations> - <description>Goes to the provided Category page on the Storefront. Adds the 1st Product to the Cart. Goes to Checkout. Select the Shipping Method. Selects PayPal as the Payment Method.</description> - </annotations> - <arguments> - <argument name="Category"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddProductToCheckoutPageActionGroup` instead --> - <amOnPage url="{{StorefrontCategoryPage.url(Category.name)}}" stepKey="onCategoryPage"/> - <waitForPageLoad stepKey="waitForPageLoad1"/> - <moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="hoverProduct"/> - <click selector="{{StorefrontCategoryMainSection.AddToCartBtn}}" stepKey="addToCart"/> - <waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="waitForProductAdded"/> - <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickCart"/> - <click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="goToCheckout"/> - <waitForPageLoad stepKey="waitForPageLoad2"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/> - <click selector="{{CheckoutShippingMethodsSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask2"/> - <waitForElement selector="{{CheckoutShippingMethodsSection.next}}" time="30" stepKey="waitForNextButton"/> - <click selector="{{CheckoutShippingMethodsSection.next}}" stepKey="clickNext"/> - <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" stepKey="waitForPlaceOrderButton"/> - <click selector="{{CheckoutPaymentSection.PayPalPaymentRadio}}" stepKey="clickPayPalCheckbox"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml deleted file mode 100644 index e9b6ec37f8f0a..0000000000000 --- a/app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml +++ /dev/null @@ -1,105 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<!-- -NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. - Please find the Comment with proper replacement for each of ActionGroups provided. ---> -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="addProductVideo"> - <annotations> - <description>Expands the 'Images And Videos' section on the Admin Product creation/edit page. Adds the provided Video to the Product. Clicks on Save.</description> - </annotations> - <arguments> - <argument name="video" defaultValue="mftfTestProductVideo"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddProductVideoActionGroup` instead --> - <scrollTo selector="{{AdminProductImagesSection.productImagesToggle}}" x="0" y="-100" stepKey="scrollToArea"/> - <conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductVideoSection"/> - <waitForElementVisible selector="{{AdminProductImagesSection.addVideoButton}}" stepKey="waitForAddVideoButtonVisible" time="30"/> - <click selector="{{AdminProductImagesSection.addVideoButton}}" stepKey="addVideo"/> - <waitForElementVisible selector=".modal-slide.mage-new-video-dialog.form-inline._show" stepKey="waitForUrlElementVisibleslide" time="30"/> - <waitForElementVisible selector="{{AdminProductNewVideoSection.videoUrlTextField}}" stepKey="waitForUrlElementVisible" time="60"/> - <fillField selector="{{AdminProductNewVideoSection.videoUrlTextField}}" userInput="{{video.videoUrl}}" stepKey="fillFieldVideoUrl"/> - <fillField selector="{{AdminProductNewVideoSection.videoTitleTextField}}" userInput="{{video.videoTitle}}" stepKey="fillFieldVideoTitle"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <waitForElementNotVisible selector="{{AdminProductNewVideoSection.saveButtonDisabled}}" stepKey="waitForSaveButtonVisible" time="30"/> - <click selector="{{AdminProductNewVideoSection.saveButton}}" stepKey="saveVideo"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear"/> - </actionGroup> - - <actionGroup name="removeProductVideo"> - <annotations> - <description>Expands the 'Images And Videos' section on the Admin Product creation/edit page. Clicks on the Remove Video button.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `RemoveProductVideoActionGroup` instead --> - <scrollTo selector="{{AdminProductImagesSection.productImagesToggle}}" x="0" y="-100" stepKey="scrollToArea"/> - <conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductVideoSection"/> - <waitForElementVisible selector="{{AdminProductImagesSection.addVideoButton}}" stepKey="waitForAddVideoButtonVisible" time="30"/> - <click selector="{{AdminProductImagesSection.removeVideoButton}}" stepKey="removeVideo"/> - </actionGroup> - - <actionGroup name="assertProductVideoAdminProductPage"> - <annotations> - <description>Validates that the provided Video is present on the Admin Product creation/edit page.</description> - </annotations> - <arguments> - <argument name="video" defaultValue="mftfTestProductVideo"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertProductVideoAdminProductPageActionGroup` instead --> - <scrollTo selector="{{AdminProductImagesSection.productImagesToggle}}" x="0" y="-100" stepKey="scrollToArea"/> - <conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductVideoSection"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <seeElement selector="{{AdminProductImagesSection.videoTitleText(video.videoShortTitle)}}" stepKey="seeVideoTitle"/> - <seeElementInDOM selector="{{AdminProductImagesSection.videoUrlHiddenField(video.videoUrl)}}" stepKey="seeVideoItem"/> - </actionGroup> - - <actionGroup name="assertProductVideoNotInAdminProductPage"> - <annotations> - <description>Validates that the provided Video is NOT present on the Admin Product creation/edit page.</description> - </annotations> - <arguments> - <argument name="video" defaultValue="mftfTestProductVideo"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertProductVideoNotInAdminProductPageActionGroup` instead --> - <scrollTo selector="{{AdminProductImagesSection.productImagesToggle}}" x="0" y="-100" stepKey="scrollToArea"/> - <conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductVideoSection"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <dontSeeElement selector="{{AdminProductImagesSection.videoTitleText(video.videoShortTitle)}}" stepKey="seeVideoTitle"/> - <dontSeeElementInDOM selector="{{AdminProductImagesSection.videoUrlHiddenField(video.videoUrl)}}" stepKey="seeVideoItem"/> - </actionGroup> - - <actionGroup name="assertProductVideoStorefrontProductPage"> - <annotations> - <description>Validates that the provided Video is present on the Storefront Product page.</description> - </annotations> - <arguments> - <argument name="dataTypeAttribute" defaultValue="'youtube'"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertProductVideoStorefrontProductPageActionGroup` instead --> - <seeElement selector="{{StorefrontProductInfoMainSection.productVideo(dataTypeAttribute)}}" stepKey="seeProductVideoDataType"/> - </actionGroup> - - <actionGroup name="assertProductVideoNotInStorefrontProductPage"> - <annotations> - <description>Validates that the provided Video is NOT present on the Storefront Product page.</description> - </annotations> - <arguments> - <argument name="dataTypeAttribute" defaultValue="'youtube'"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertProductVideoNotInStorefrontProductPageActionGroup` instead --> - <dontSeeElement selector="{{StorefrontProductInfoMainSection.productVideo(dataTypeAttribute)}}" stepKey="dontSeeProductVideoDataType"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml deleted file mode 100644 index 6a6ddfb514890..0000000000000 --- a/app/code/Magento/Sales/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml +++ /dev/null @@ -1,673 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<!-- -NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. - Please find the Comment with proper replacement for each of ActionGroups provided. ---> -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="verifyBasicCreditMemoInformation"> - <annotations> - <description>Validates that the provided Customer, Shipping/Billing Address and Customer Group are present and correct on the Admin Credit Memo view page.</description> - </annotations> - <arguments> - <argument name="customer" defaultValue=""/> - <argument name="shippingAddress" defaultValue=""/> - <argument name="billingAddress" defaultValue=""/> - <argument name="customerGroup" defaultValue="GeneralCustomerGroup"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `VerifyBasicCreditMemoInformationActionGroup` instead --> - <see selector="{{AdminCreditMemoOrderInformationSection.customerName}}" userInput="{{customer.firstname}}" stepKey="seeCustomerName"/> - <see selector="{{AdminCreditMemoOrderInformationSection.customerEmail}}" userInput="{{customer.email}}" stepKey="seeCustomerEmail"/> - <see selector="{{AdminCreditMemoOrderInformationSection.customerGroup}}" userInput="{{customerGroup.code}}" stepKey="seeCustomerGroup"/> - - <see selector="{{AdminCreditMemoAddressInformationSection.billingAddress}}" userInput="{{billingAddress.street[0]}}" stepKey="seeBillingAddressStreet"/> - <see selector="{{AdminCreditMemoAddressInformationSection.billingAddress}}" userInput="{{billingAddress.city}}" stepKey="seeBillingAddressCity"/> - <see selector="{{AdminCreditMemoAddressInformationSection.billingAddress}}" userInput="{{billingAddress.country_id}}" stepKey="seeBillingAddressCountry"/> - <see selector="{{AdminCreditMemoAddressInformationSection.billingAddress}}" userInput="{{billingAddress.postcode}}" stepKey="seeBillingAddressPostcode"/> - - <see selector="{{AdminCreditMemoAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.street[0]}}" stepKey="seeShippingAddressStreet"/> - <see selector="{{AdminCreditMemoAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.city}}" stepKey="seeShippingAddressCity"/> - <see selector="{{AdminCreditMemoAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.country_id}}" stepKey="seeShippingAddressCountry"/> - <see selector="{{AdminCreditMemoAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.postcode}}" stepKey="seeShippingAddressPostcode"/> - </actionGroup> - - <actionGroup name="seeProductInItemsRefunded"> - <annotations> - <description>Validates that the provided Product appears in the 'Product' column on the Admin Credit Memo view page.</description> - </annotations> - <arguments> - <argument name="product"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SeeProductInItemsRefundedActionGroup` instead --> - <see selector="{{AdminCreditMemoItemsSection.skuColumn}}" userInput="{{product.sku}}" stepKey="seeProductSkuInGrid"/> - </actionGroup> - - <actionGroup name="verifyBasicInvoiceInformation"> - <annotations> - <description>Validates that the provided Customer, Address and Customer Group details are present and correct on the Admin View Invoice page.</description> - </annotations> - <arguments> - <argument name="customer"/> - <argument name="shippingAddress"/> - <argument name="billingAddress"/> - <argument name="customerGroup" defaultValue="GeneralCustomerGroup"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `VerifyBasicInvoiceInformationActionGroup` instead --> - <see selector="{{AdminInvoiceOrderInformationSection.customerName}}" userInput="{{customer.firstname}}" stepKey="seeCustomerName"/> - <see selector="{{AdminInvoiceOrderInformationSection.customerEmail}}" userInput="{{customer.email}}" stepKey="seeCustomerEmail"/> - <see selector="{{AdminInvoiceOrderInformationSection.customerGroup}}" userInput="{{customerGroup.code}}" stepKey="seeCustomerGroup"/> - <see selector="{{AdminInvoiceAddressInformationSection.billingAddress}}" userInput="{{billingAddress.street[0]}}" stepKey="seeBillingAddressStreet"/> - <see selector="{{AdminInvoiceAddressInformationSection.billingAddress}}" userInput="{{billingAddress.city}}" stepKey="seeBillingAddressCity"/> - <see selector="{{AdminInvoiceAddressInformationSection.billingAddress}}" userInput="{{billingAddress.country_id}}" stepKey="seeBillingAddressCountry"/> - <see selector="{{AdminInvoiceAddressInformationSection.billingAddress}}" userInput="{{billingAddress.postcode}}" stepKey="seeBillingAddressPostcode"/> - <see selector="{{AdminInvoiceAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.street[0]}}" stepKey="seeShippingAddressStreet"/> - <see selector="{{AdminInvoiceAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.city}}" stepKey="seeShippingAddressCity"/> - <see selector="{{AdminInvoiceAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.country_id}}" stepKey="seeShippingAddressCountry"/> - <see selector="{{AdminInvoiceAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.postcode}}" stepKey="seeShippingAddressPostcode"/> - </actionGroup> - - <actionGroup name="seeProductInInvoiceItems"> - <annotations> - <description>Validates that the provided Product appears under the 'SKU' column in the Admin Invoices edit page.</description> - </annotations> - <arguments> - <argument name="product"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SeeProductInInvoiceItemsActionGroup` instead --> - <see selector="{{AdminInvoiceItemsSection.skuColumn}}" userInput="{{product.sku}}" stepKey="seeProductSkuInGrid"/> - </actionGroup> - - <actionGroup name="adminFastCreateInvoice"> - <annotations> - <description>Clicks on 'Invoice' on the Admin Orders view page. Clicks on 'Submit Invoice'. Clicks on 'View Invoice'.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminFastCreateInvoiceActionGroup` instead --> - <click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoiceButton"/> - <waitForPageLoad stepKey="waitForNewInvoicePageLoad"/> - <click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/> - <see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="The invoice has been created." stepKey="seeSuccessMessage"/> - <click selector="{{AdminOrderDetailsOrderViewSection.invoices}}" stepKey="clickInvoices"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask5"/> - <conditionalClick selector="{{AdminOrderInvoicesTabSection.clearFilters}}" dependentSelector="{{AdminOrderInvoicesTabSection.clearFilters}}" visible="true" stepKey="clearExistingOrderFilters"/> - <click selector="{{AdminOrderInvoicesTabSection.viewInvoice}}" stepKey="openInvoicePage"/> - <waitForPageLoad stepKey="waitForInvoicePageLoad"/> - </actionGroup> - - <actionGroup name="clearInvoicesGridFilters"> - <annotations> - <description>Goes to the Admin Invoices grid page. Clicks on 'Clear Filters', if present.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `ClearInvoicesGridFiltersActionGroup` instead --> - <amOnPage url="{{AdminInvoicesPage.url}}" stepKey="goToInvoices"/> - <waitForPageLoad stepKey="waitInvoicesGridToLoad"/> - <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearFilters"/> - <waitForPageLoad stepKey="waitInvoicesGrid"/> - </actionGroup> - - <actionGroup name="goToInvoiceIntoOrder"> - <annotations> - <description>Clicks on 'Invoice' on the Admin Orders view page. Validates that the URL and Page Title are correct.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `GoToInvoiceIntoOrderActionGroup` instead --> - <click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoiceAction"/> - <seeInCurrentUrl url="{{AdminInvoiceNewPage.url}}" stepKey="seeOrderInvoiceUrl"/> - <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Invoice" stepKey="seePageNameNewInvoicePage"/> - </actionGroup> - - <actionGroup name="StartCreateInvoiceFromOrderPage"> - <annotations> - <description>Clicks on 'Invoice' on the Admin Orders view page. Validates that the URL and Page Title are correct.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StartCreateInvoiceFromOrderPageActionGroup` instead --> - <click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoiceAction"/> - <seeInCurrentUrl url="{{AdminInvoiceNewPage.url}}" stepKey="seeNewInvoiceUrl"/> - <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Invoice" stepKey="seeNewInvoicePageTitle"/> - </actionGroup> - - <actionGroup name="SubmitInvoice"> - <annotations> - <description>Clicks on 'Submit Invoice' on the Admin 'New Invoice' page. Validates that the Success Message is present and correct. Validates that the Order ID appears in the URL.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SubmitInvoiceActionGroup` instead --> - <click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/> - <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForMessageAppears"/> - <see selector="{{AdminMessagesSection.success}}" userInput="The invoice has been created." stepKey="seeInvoiceCreateSuccess"/> - <grabFromCurrentUrl regex="~/order_id/(\d+)/~" stepKey="grabOrderId"/> - <seeInCurrentUrl url="{{AdminOrderDetailsPage.url('$grabOrderId')}}" stepKey="seeViewOrderPageInvoice"/> - </actionGroup> - - <actionGroup name="filterInvoiceGridByOrderId"> - <annotations> - <description>Goes to the Admin Invoices grid page. Filters the grid for the provided Order ID.</description> - </annotations> - <arguments> - <argument name="orderId" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `FilterInvoiceGridByOrderIdActionGroup` instead --> - <amOnPage url="{{AdminInvoicesPage.url}}" stepKey="goToInvoices"/> - <click selector="{{AdminInvoicesGridSection.filter}}" stepKey="clickFilter"/> - <fillField selector="{{AdminInvoicesFiltersSection.orderNum}}" userInput="{{orderId}}" stepKey="fillOrderIdForFilter"/> - <click selector="{{AdminInvoicesFiltersSection.applyFilters}}" stepKey="clickApplyFilters"/> - <waitForPageLoad stepKey="waitForFiltersApply"/> - </actionGroup> - - <actionGroup name="navigateToNewOrderPageNewCustomer"> - <annotations> - <description>Goes to the Admin Orders grid page. Clicks on 'Create New Order'. Clicks on 'Create New Customer'. Select the provided Store View, if present. Validates that Page Title is present and correct.</description> - </annotations> - <arguments> - <argument name="storeView" defaultValue="_defaultStore"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `NavigateToNewOrderPageNewCustomerActionGroup` instead --> - <amOnPage url="{{AdminOrdersPage.url}}" stepKey="navigateToOrderIndexPage"/> - <waitForPageLoad stepKey="waitForIndexPageLoad"/> - <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Orders" stepKey="seeIndexPageTitle"/> - <click selector="{{AdminOrdersGridSection.createNewOrder}}" stepKey="clickCreateNewOrder"/> - <click selector="{{AdminOrderFormActionSection.CreateNewCustomer}}" stepKey="clickCreateCustomer"/> - <conditionalClick selector="{{AdminOrderStoreScopeTreeSection.storeOption(storeView.name)}}" dependentSelector="{{AdminOrderStoreScopeTreeSection.storeOption(storeView.name)}}" visible="true" stepKey="selectStoreViewIfAppears"/> - <waitForPageLoad stepKey="waitForCreateOrderPageLoadAfterStoreSelect"/> - <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Create New Order" stepKey="seeNewOrderPageTitle"/> - </actionGroup> - - <actionGroup name="navigateToNewOrderPageNewCustomerSingleStore"> - <annotations> - <description>Goes to the Admin Orders grid page. Clicks on 'Create New Order'. Clicks on 'Create New Customer'. Validates that Page Title is present and correct.</description> - </annotations> - <arguments> - <argument name="storeView" defaultValue="_defaultStore"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `NavigateToNewOrderPageNewCustomerSingleStoreActionGroup` instead --> - <amOnPage url="{{AdminOrdersPage.url}}" stepKey="navigateToOrderIndexPage"/> - <waitForPageLoad stepKey="waitForIndexPageLoad"/> - <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Orders" stepKey="seeIndexPageTitle"/> - <click selector="{{AdminOrdersGridSection.createNewOrder}}" stepKey="clickCreateNewOrder"/> - <click selector="{{AdminOrderFormActionSection.CreateNewCustomer}}" stepKey="clickCreateCustomer"/> - <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Create New Order" stepKey="seeNewOrderPageTitle"/> - </actionGroup> - - <actionGroup name="navigateToNewOrderPageExistingCustomer"> - <annotations> - <description>Goes tot he Admin Orders grid page. Clicks on 'Create New Order'. Filters the grid for the provided Customer. Clicks on the Customer. Selects the provided Store View, if present. Validates that the Page Title is present and correct.</description> - </annotations> - <arguments> - <argument name="customer"/> - <argument name="storeView" defaultValue="_defaultStore"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `NavigateToNewOrderPageExistingCustomerActionGroup` instead --> - <amOnPage url="{{AdminOrdersPage.url}}" stepKey="navigateToOrderIndexPage"/> - <waitForPageLoad stepKey="waitForIndexPageLoad"/> - <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Orders" stepKey="seeIndexPageTitle"/> - <click selector="{{AdminOrdersGridSection.createNewOrder}}" stepKey="clickCreateNewOrder"/> - <waitForPageLoad stepKey="waitForCustomerGridLoad"/> - - <conditionalClick selector="{{AdminOrderCustomersGridSection.resetButton}}" dependentSelector="{{AdminOrderCustomersGridSection.resetButton}}" visible="true" stepKey="clearExistingCustomerFilters"/> - <fillField userInput="{{customer.email}}" selector="{{AdminOrderCustomersGridSection.emailInput}}" stepKey="filterEmail"/> - <click selector="{{AdminOrderCustomersGridSection.apply}}" stepKey="applyFilter"/> - <waitForPageLoad stepKey="waitForFilteredCustomerGridLoad"/> - <click selector="{{AdminOrderCustomersGridSection.firstRow}}" stepKey="clickOnCustomer"/> - <waitForPageLoad stepKey="waitForCreateOrderPageLoad"/> - - <conditionalClick selector="{{AdminOrderStoreScopeTreeSection.storeOption(storeView.name)}}" dependentSelector="{{AdminOrderStoreScopeTreeSection.storeOption(storeView.name)}}" visible="true" stepKey="selectStoreViewIfAppears"/> - <waitForPageLoad stepKey="waitForCreateOrderPageLoadAfterStoreSelect"/> - <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Create New Order" stepKey="seeNewOrderPageTitle"/> - </actionGroup> - - <actionGroup name="checkRequiredFieldsNewOrderForm"> - <annotations> - <description>Clears the Email, First Name, Last Name, Street Line 1, City, Postal Code and Phone fields when adding an Order and then verifies that they are required after attempting to Save.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CheckRequiredFieldsNewOrderFormActionGroup` instead --> - <seeElement selector="{{AdminOrderFormAccountSection.requiredGroup}}" stepKey="seeCustomerGroupRequired"/> - <seeElement selector="{{AdminOrderFormAccountSection.requiredEmail}}" stepKey="seeEmailRequired"/> - <clearField selector="{{AdminOrderFormAccountSection.email}}" stepKey="clearEmailField"/> - <clearField selector="{{AdminOrderFormBillingAddressSection.FirstName}}" stepKey="clearFirstNameField"/> - <clearField selector="{{AdminOrderFormBillingAddressSection.LastName}}" stepKey="clearLastNameField"/> - <clearField selector="{{AdminOrderFormBillingAddressSection.StreetLine1}}" stepKey="clearStreetField"/> - <clearField selector="{{AdminOrderFormBillingAddressSection.City}}" stepKey="clearCityField"/> - <selectOption selector="{{AdminOrderFormBillingAddressSection.Country}}" userInput="United States" stepKey="selectUSCountry"/> - <selectOption selector="{{AdminOrderFormBillingAddressSection.State}}" userInput="Please select" stepKey="selectNoState"/> - <clearField selector="{{AdminOrderFormBillingAddressSection.PostalCode}}" stepKey="clearPostalCodeField"/> - <clearField selector="{{AdminOrderFormBillingAddressSection.Phone}}" stepKey="clearPhoneField"/> - <seeElement selector="{{AdminOrderFormPaymentSection.getShippingMethods}}" stepKey="seeShippingMethodNotSelected"/> - <click selector="{{AdminOrderFormActionSection.SubmitOrder}}" stepKey="trySubmitOrder"/> - <see selector="{{AdminOrderFormBillingAddressSection.emailError}}" userInput="This is a required field." stepKey="seeThatEmailIsRequired"/> - <see selector="{{AdminOrderFormBillingAddressSection.firstNameError}}" userInput="This is a required field." stepKey="seeFirstNameRequired"/> - <see selector="{{AdminOrderFormBillingAddressSection.lastNameError}}" userInput="This is a required field." stepKey="seeLastNameRequired"/> - <see selector="{{AdminOrderFormBillingAddressSection.streetAddressError}}" userInput="This is a required field." stepKey="seeStreetRequired"/> - <see selector="{{AdminOrderFormBillingAddressSection.cityError}}" userInput="This is a required field." stepKey="seeCityRequired"/> - <see selector="{{AdminOrderFormBillingAddressSection.stateError}}" userInput="This is a required field." stepKey="seeStateRequired"/> - <see selector="{{AdminOrderFormBillingAddressSection.postalCodeError}}" userInput="This is a required field." stepKey="seePostalCodeRequired"/> - <see selector="{{AdminOrderFormBillingAddressSection.phoneError}}" userInput="This is a required field." stepKey="seePhoneRequired"/> - <see selector="{{AdminOrderFormPaymentSection.shippingError}}" userInput="This is a required field." stepKey="seeShippingMethodRequired"/> - </actionGroup> - - <actionGroup name="addSimpleProductToOrder"> - <annotations> - <description>Adds the provided Simple Product to an Order. Fills in the provided Product Qty. Clicks on 'Add Selected Product(s) to Order'.</description> - </annotations> - <arguments> - <argument name="product" defaultValue="_defaultProduct" type="entity"/> - <argument name="productQty" defaultValue="1" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddSimpleProductToOrderActionGroup` instead --> - <click selector="{{AdminOrderFormItemsSection.addProducts}}" stepKey="clickAddProducts"/> - <fillField selector="{{AdminOrderFormItemsSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillSkuFilter"/> - <click selector="{{AdminOrderFormItemsSection.search}}" stepKey="clickSearch"/> - <scrollTo selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" x="0" y="-100" stepKey="scrollToCheckColumn"/> - <checkOption selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" stepKey="selectProduct"/> - <fillField selector="{{AdminOrderFormItemsSection.rowQty('1')}}" userInput="{{productQty}}" stepKey="fillProductQty"/> - <scrollTo selector="{{AdminOrderFormItemsSection.addSelected}}" x="0" y="-100" stepKey="scrollToAddSelectedButton"/> - <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickAddSelectedProducts"/> - <wait time="5" stepKey="waitForOptionsToLoad"/> - </actionGroup> - - <actionGroup name="addConfigurableProductToOrder"> - <annotations> - <description>Adds the provided Configurable Product with the provided Option to an Order. Fills in the provided Product Qty. Clicks on 'Add Selected Product(s) to Order'.</description> - </annotations> - <arguments> - <argument name="product"/> - <argument name="attribute"/> - <argument name="option"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddConfigurableProductToOrderActionGroup` instead --> - <click selector="{{AdminOrderFormItemsSection.addProducts}}" stepKey="clickAddProducts"/> - <fillField selector="{{AdminOrderFormItemsSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillSkuFilterConfigurable"/> - <click selector="{{AdminOrderFormItemsSection.search}}" stepKey="clickSearchConfigurable"/> - <scrollTo selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" x="0" y="-100" stepKey="scrollToCheckColumn"/> - <checkOption selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" stepKey="selectConfigurableProduct"/> - <waitForElementVisible selector="{{AdminOrderFormConfigureProductSection.optionSelect(attribute.default_label)}}" stepKey="waitForConfigurablePopover"/> - <wait time="2" stepKey="waitForOptionsToLoad"/> - <selectOption selector="{{AdminOrderFormConfigureProductSection.optionSelect(attribute.default_label)}}" userInput="{{option.name}}" stepKey="selectionConfigurableOption"/> - <click selector="{{AdminOrderFormConfigureProductSection.ok}}" stepKey="clickOkConfigurablePopover"/> - <scrollTo selector="{{AdminOrderFormItemsSection.addSelected}}" x="0" y="-100" stepKey="scrollToAddSelectedButton"/> - <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickAddSelectedProducts"/> - </actionGroup> - - <actionGroup name="newAddConfigurableProductToOrder" extends="addConfigurableProductToOrder"> - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `NewAddConfigurableProductToOrderActionGroup` instead --> - <remove keyForRemoval="waitForConfigurablePopover"/> - <remove keyForRemoval="selectionConfigurableOption"/> - <selectOption selector="{{AdminOrderFormConfigureProductSection.selectOption}}" userInput="{{option.value}}" stepKey="selectOption" after="waitForOptionsToLoad"/> - </actionGroup> - - <actionGroup name="addConfigurableProductToOrderFromAdmin" extends="addConfigurableProductToOrder"> - <annotations> - <description>EXTENDS: addConfigurableProductToOrder. Selects the provided Option to the Configurable Product.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddConfigurableProductToOrderFromAdminActionGroup` instead --> - <waitForElementVisible selector="{{AdminOrderFormConfigureProductSection.optionSelect(attribute.default_frontend_label)}}" stepKey="waitForConfigurablePopover"/> - <selectOption selector="{{AdminOrderFormConfigureProductSection.optionSelect(attribute.default_frontend_label)}}" userInput="{{option.label}}" stepKey="selectionConfigurableOption"/> - </actionGroup> - - <actionGroup name="configureOrderedConfigurableProduct"> - <annotations> - <description>Clicks on 'Configure' for a Product in the 'Please select products' under the 'Create New Order for' page. Selects the provided Option and Attribute. Fills in the provided Qty. Clicks on Ok.</description> - </annotations> - <arguments> - <argument name="attribute"/> - <argument name="option"/> - <argument name="quantity" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `ConfigureOrderedConfigurableProductActionGroup` instead --> - <click selector="{{AdminOrderFormItemsSection.configure}}" stepKey="clickConfigure"/> - <waitForElementVisible selector="{{AdminOrderFormConfigureProductSection.optionSelect(attribute.default_frontend_label)}}" stepKey="waitForConfigurablePopover"/> - <wait time="2" stepKey="waitForOptionsToLoad"/> - <selectOption selector="{{AdminOrderFormConfigureProductSection.optionSelect(attribute.default_frontend_label)}}" userInput="{{option.label}}" stepKey="selectionConfigurableOption"/> - <fillField selector="{{AdminOrderFormConfigureProductSection.quantity}}" userInput="{{quantity}}" stepKey="fillQuantity"/> - <click selector="{{AdminOrderFormConfigureProductSection.ok}}" stepKey="clickOkConfigurablePopover"/> - </actionGroup> - - <actionGroup name="addBundleProductToOrder"> - <annotations> - <description>Adds the provided Bundled Product with the provided Option to an Order. Fills in the provided Product Qty. Clicks on 'Add Selected Product(s) to Order'.</description> - </annotations> - <arguments> - <argument name="product"/> - <argument name="quantity" type="string" defaultValue="1"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddBundleProductToOrderActionGroup` instead --> - <click selector="{{AdminOrderFormItemsSection.addProducts}}" stepKey="clickAddProducts"/> - <fillField selector="{{AdminOrderFormItemsSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillSkuFilterBundle"/> - <click selector="{{AdminOrderFormItemsSection.search}}" stepKey="clickSearchBundle"/> - <scrollTo selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" x="0" y="-100" stepKey="scrollToCheckColumn"/> - <checkOption selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" stepKey="selectBundleProduct"/> - <waitForElementVisible selector="{{AdminOrderFormBundleProductSection.quantity}}" stepKey="waitForBundleOptionLoad"/> - <wait time="2" stepKey="waitForOptionsToLoad"/> - <fillField selector="{{AdminOrderFormBundleProductSection.quantity}}" userInput="{{quantity}}" stepKey="fillQuantity"/> - <click selector="{{AdminOrderFormConfigureProductSection.ok}}" stepKey="clickOk"/> - <scrollTo selector="{{AdminOrderFormItemsSection.addSelected}}" x="0" y="-100" stepKey="scrollToAddSelectedButton"/> - <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickAddSelectedProducts"/> - </actionGroup> - - <actionGroup name="addBundleProductToOrderAndCheckPriceInGrid" extends="addBundleProductToOrder"> - <annotations> - <description>EXTENDS: addBundleProductToOrder. Validates that the provided Product Price is present and correct in the 'Items Ordered' section.</description> - </annotations> - <arguments> - <argument name="price" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddBundleProductToOrderAndCheckPriceInGridActionGroup` instead --> - <grabTextFrom selector="{{AdminOrderFormItemsSection.rowPrice('1')}}" stepKey="grabProductPriceFromGrid" after="clickOk"/> - <assertEquals stepKey="assertProductPriceInGrid" message="Bundle product price in grid should be equal {{price}}" after="grabProductPriceFromGrid"> - <expectedResult type="string">{{price}}</expectedResult> - <actualResult type="variable">grabProductPriceFromGrid</actualResult> - </assertEquals> - </actionGroup> - - <actionGroup name="addDownloadableProductToOrder"> - <annotations> - <description>Adds a Downloadable Product to an Order. Clicks on 'Add Selected Product(s) to Order'.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddDownloadableProductToOrderActionGroup` instead --> - <click selector="{{AdminOrderFormItemsSection.addProducts}}" stepKey="clickAddProducts"/> - <waitForPageLoad time="30" stepKey="waitForPageLoad1"/> - <fillField selector="{{AdminOrderFormItemsSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillSkuFilterDownloadable"/> - <click selector="{{AdminOrderFormItemsSection.search}}" stepKey="clickSearchDownloadable"/> - <scrollTo selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" x="0" y="-100" stepKey="scrollToCheckColumn"/> - <checkOption selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" stepKey="selectDownloadableProduct"/> - <waitForElementVisible selector="{{AdminOrderFormDownloadableProductSection.optionSelect(link.title)}}" stepKey="waitForLinkLoad"/> - <click selector="{{AdminOrderFormDownloadableProductSection.optionSelect(link.title)}}" stepKey="selectLink"/> - <fillField selector="{{AdminOrderFormDownloadableProductSection.quantity}}" userInput="{{quantity}}" stepKey="setQuantity"/> - <click selector="{{AdminOrderFormDownloadableProductSection.ok}}" stepKey="confirmConfiguration"/> - <scrollTo selector="{{AdminOrderFormItemsSection.addSelected}}" x="0" y="-100" stepKey="scrollToAddSelectedButton"/> - <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickAddSelectedProducts"/> - </actionGroup> - - <actionGroup name="addGroupedProductOptionToOrder"> - <annotations> - <description>Adds the provided Grouped Product with the provided Option to an Order. Fills in the provided Product Qty. Clicks on 'Add Selected Product(s) to Order'.</description> - </annotations> - <arguments> - <argument name="product"/> - <argument name="option"/> - <argument name="quantity" type="string" defaultValue="1"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddGroupedProductOptionToOrderActionGroup` instead --> - <click selector="{{AdminOrderFormItemsSection.addProducts}}" stepKey="clickAddProducts"/> - <fillField selector="{{AdminOrderFormItemsSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillSkuFilterGrouped"/> - <click selector="{{AdminOrderFormItemsSection.search}}" stepKey="clickSearchGrouped"/> - <scrollTo selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" x="0" y="-100" stepKey="scrollToCheckColumn"/> - <checkOption selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" stepKey="selectGroupedProduct"/> - <waitForElementVisible selector="{{AdminOrderFormGroupedProductSection.optionQty(option.sku)}}" stepKey="waitForGroupedOptionLoad"/> - <wait time="2" stepKey="waitForOptionsToLoad"/> - <fillField selector="{{AdminOrderFormGroupedProductSection.optionQty(option.sku)}}" userInput="{{quantity}}" stepKey="fillOptionQuantity"/> - <click selector="{{AdminOrderFormConfigureProductSection.ok}}" stepKey="clickOk"/> - <scrollTo selector="{{AdminOrderFormItemsSection.addSelected}}" x="0" y="-100" stepKey="scrollToAddSelectedButton"/> - <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickAddSelectedProducts"/> - </actionGroup> - - <actionGroup name="fillOrderCustomerInformation"> - <annotations> - <description>Fills in the provided Customer and Address details on the Admin 'Create New Order for' page.</description> - </annotations> - <arguments> - <argument name="customer"/> - <argument name="address"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `FillOrderCustomerInformationActionGroup` instead --> - <fillField selector="{{AdminOrderFormBillingAddressSection.FirstName}}" userInput="{{customer.firstname}}" stepKey="fillFirstName"/> - <fillField selector="{{AdminOrderFormBillingAddressSection.LastName}}" userInput="{{customer.lastname}}" stepKey="fillLastName"/> - <fillField selector="{{AdminOrderFormBillingAddressSection.StreetLine1}}" userInput="{{address.street[0]}}" stepKey="fillStreetLine1"/> - <fillField selector="{{AdminOrderFormBillingAddressSection.City}}" userInput="{{address.city}}" stepKey="fillCity"/> - <selectOption selector="{{AdminOrderFormBillingAddressSection.Country}}" userInput="{{address.country_id}}" stepKey="fillCountry"/> - <selectOption selector="{{AdminOrderFormBillingAddressSection.State}}" userInput="{{address.state}}" stepKey="fillState"/> - <fillField selector="{{AdminOrderFormBillingAddressSection.PostalCode}}" userInput="{{address.postcode}}" stepKey="fillPostalCode"/> - <fillField selector="{{AdminOrderFormBillingAddressSection.Phone}}" userInput="{{address.telephone}}" stepKey="fillPhone"/> - </actionGroup> - - <actionGroup name="orderSelectFlatRateShipping"> - <annotations> - <description>Selects the 'Flat Rate' Shipping Method on the Admin 'Create New Order for' page.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `OrderSelectFlatRateShippingActionGroup` instead --> - <click selector="{{AdminOrderFormPaymentSection.header}}" stepKey="unfocus"/> - <waitForPageLoad stepKey="waitForJavascriptToFinish"/> - <click selector="{{AdminOrderFormPaymentSection.getShippingMethods}}" stepKey="clickShippingMethods"/> - <waitForElementVisible selector="{{AdminOrderFormPaymentSection.flatRateOption}}" stepKey="waitForShippingOptions"/> - <selectOption selector="{{AdminOrderFormPaymentSection.flatRateOption}}" userInput="flatrate_flatrate" stepKey="checkFlatRate"/> - </actionGroup> - - <actionGroup name="changeShippingMethod"> - <annotations> - <description>Change Shipping Method on the Admin 'Create New Order for' page.</description> - </annotations> - <arguments> - <argument name="shippingMethod" defaultValue="flatrate_flatrate" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `ChangeShippingMethodActionGroup` instead --> - <click selector="{{AdminOrderFormPaymentSection.header}}" stepKey="unfocus"/> - <waitForPageLoad stepKey="waitForJavascriptToFinish"/> - <click selector="{{AdminOrderFormPaymentSection.getShippingMethods}}" stepKey="clickShippingMethods1"/> - <waitForElementVisible selector="{{AdminOrderFormPaymentSection.getShippingMethods}}" stepKey="waitForChangeShippingMethod"/> - <click selector="{{AdminOrderFormPaymentSection.getShippingMethods}}" stepKey="clickShippingMethods2"/> - <waitForElementVisible selector="{{AdminOrderFormPaymentSection.shippingMethod}}" stepKey="waitForShippingOptions2"/> - <selectOption selector="{{AdminOrderFormPaymentSection.shippingMethod}}" userInput="{{shippingMethod}}" stepKey="checkFlatRate"/> - </actionGroup> - - <actionGroup name="orderSelectFreeShipping"> - <annotations> - <description>Selects the 'Free Shipping' Shipping Method on the Admin 'Create New Order for' page.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `OrderSelectFreeShippingActionGroup` instead --> - <click selector="{{AdminOrderFormPaymentSection.header}}" stepKey="unfocus"/> - <waitForPageLoad stepKey="waitForJavascriptToFinish"/> - <click selector="{{AdminOrderFormPaymentSection.getShippingMethods}}" stepKey="clickShippingMethods"/> - <waitForElementVisible selector="{{AdminOrderFormPaymentSection.freeShippingOption}}" stepKey="waitForShippingOptions"/> - <selectOption selector="{{AdminOrderFormPaymentSection.freeShippingOption}}" userInput="freeshipping_freeshipping" stepKey="checkFreeShipping"/> - </actionGroup> - - <actionGroup name="verifyBasicOrderInformation"> - <annotations> - <description>Validates that the provided Customer, Shipping/Billing Address and Customer Group are present and correct on the Admin Orders view page.</description> - </annotations> - <arguments> - <argument name="customer"/> - <argument name="shippingAddress"/> - <argument name="billingAddress"/> - <argument name="customerGroup" defaultValue="GeneralCustomerGroup"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `VerifyBasicOrderInformationActionGroup` instead --> - <see selector="{{AdminOrderDetailsInformationSection.customerName}}" userInput="{{customer.firstname}}" stepKey="seeCustomerName"/> - <see selector="{{AdminOrderDetailsInformationSection.customerEmail}}" userInput="{{customer.email}}" stepKey="seeCustomerEmail"/> - <see selector="{{AdminOrderDetailsInformationSection.customerGroup}}" userInput="{{customerGroup.code}}" stepKey="seeCustomerGroup"/> - <see selector="{{AdminOrderAddressInformationSection.billingAddress}}" userInput="{{billingAddress.street[0]}}" stepKey="seeBillingAddressStreet"/> - <see selector="{{AdminOrderAddressInformationSection.billingAddress}}" userInput="{{billingAddress.city}}" stepKey="seeBillingAddressCity"/> - <see selector="{{AdminOrderAddressInformationSection.billingAddress}}" userInput="{{billingAddress.country_id}}" stepKey="seeBillingAddressCountry"/> - <see selector="{{AdminOrderAddressInformationSection.billingAddress}}" userInput="{{billingAddress.postcode}}" stepKey="seeBillingAddressPostcode"/> - <see selector="{{AdminOrderAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.street[0]}}" stepKey="seeShippingAddressStreet"/> - <see selector="{{AdminOrderAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.city}}" stepKey="seeShippingAddressCity"/> - <see selector="{{AdminOrderAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.country_id}}" stepKey="seeShippingAddressCountry"/> - <see selector="{{AdminOrderAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.postcode}}" stepKey="seeShippingAddressPostcode"/> - </actionGroup> - - <actionGroup name="verifyCreatedOrderInformation"> - <annotations> - <description>Validates that the Success Message, Order Status (Pending) and Order ID are present and correct.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `VerifyCreatedOrderInformationActionGroup` instead --> - <see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="You created the order." stepKey="seeSuccessMessage"/> - <see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="Pending" stepKey="seeOrderPendingStatus" after="seeSuccessMessage"/> - <grabTextFrom selector="|Order # (\d+)|" stepKey="getOrderId" after="seeOrderPendingStatus"/> - <assertNotEmpty actual="$getOrderId" stepKey="assertOrderIdIsNotEmpty" after="getOrderId"/> - </actionGroup> - - <actionGroup name="seeProductInItemsOrdered"> - <annotations> - <description>Validates that the provided Product is present and correct in the 'Items Ordered' section on the Admin Orders view page.</description> - </annotations> - <arguments> - <argument name="product"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SeeProductInItemsOrderedActionGroup` instead --> - <see selector="{{AdminOrderItemsOrderedSection.productSkuColumn}}" userInput="{{product.sku}}" stepKey="seeSkuInItemsOrdered"/> - </actionGroup> - - <actionGroup name="cancelPendingOrder"> - <annotations> - <description>Cancels the Pending Order on the Admin Orders view page. Validates that the provided Order Status is present and correct.</description> - </annotations> - <arguments> - <argument name="orderStatus" type="string" defaultValue="Canceled"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CancelPendingOrderActionGroup` instead --> - <click selector="{{AdminOrderDetailsMainActionsSection.cancel}}" stepKey="clickCancelOrder"/> - <waitForElement selector="{{AdminConfirmationModalSection.message}}" stepKey="waitForCancelConfirmation"/> - <see selector="{{AdminConfirmationModalSection.message}}" userInput="Are you sure you want to cancel this order?" stepKey="seeConfirmationMessage"/> - <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmOrderCancel"/> - <see selector="{{AdminMessagesSection.success}}" userInput="You canceled the order." stepKey="seeCancelSuccessMessage"/> - <see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="{{orderStatus}}" stepKey="seeOrderStatusCanceled"/> - </actionGroup> - - <actionGroup name="dontSeeProductInItemsOrdered"> - <arguments> - <argument name="product"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `DontSeeProductInItemsOrderedActionGroup` instead --> - <dontSee selector="{{AdminOrderItemsOrderedSection.productSkuColumn}}" userInput="{{product.sku}}" stepKey="dontseeSkuInItemsOrdered"/> - </actionGroup> - - <actionGroup name="SelectCheckMoneyPaymentMethod"> - <annotations> - <description>Selects the 'Check / Money Order' Payment Method on the Admin Create New Order page.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SelectCheckMoneyPaymentMethodActionGroup` instead --> - <waitForElementVisible selector="{{AdminOrderFormPaymentSection.paymentBlock}}" stepKey="waitForPaymentOptions"/> - <conditionalClick selector="{{AdminOrderFormPaymentSection.checkMoneyOption}}" dependentSelector="{{AdminOrderFormPaymentSection.checkMoneyOption}}" visible="true" stepKey="checkCheckMoneyOption"/> - </actionGroup> - - <actionGroup name="filterOrderGridById"> - <annotations> - <description>Goes to the Admin Orders page. Filters the grid based on the provided Order ID.</description> - </annotations> - <arguments> - <argument name="orderId" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `FilterOrderGridByIdActionGroup` instead --> - <amOnPage url="{{AdminOrdersPage.url}}" stepKey="navigateToOrderGridPage"/> - <waitForPageLoad stepKey="waitForOrdersPage"/> - <conditionalClick selector="{{AdminOrdersGridSection.clearFilters}}" dependentSelector="{{AdminOrdersGridSection.clearFilters}}" visible="true" stepKey="clearExistingOrderFilters"/> - <waitForPageLoad stepKey="waitForClearFilters"/> - <click selector="{{AdminOrdersGridSection.filters}}" stepKey="openOrderGridFilters"/> - <waitForPageLoad stepKey="waitForClickFilters"/> - <fillField selector="{{AdminOrdersGridSection.idFilter}}" userInput="{{orderId}}" stepKey="fillOrderIdFilter"/> - <click selector="{{AdminOrdersGridSection.applyFilters}}" stepKey="clickOrderApplyFilters"/> - <waitForPageLoad stepKey="waitForApplyFilters"/> - </actionGroup> - - <actionGroup name="filterOrderGridByBillingName"> - <annotations> - <description>Goes to the Admin Orders page. Filters the grid based on the provided Customer.</description> - </annotations> - <arguments> - <argument name="customer"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `FilterOrderGridByBillingNameActionGroup` instead --> - <amOnPage url="{{AdminOrdersPage.url}}" stepKey="navigateToOrderGridPage"/> - <waitForPageLoad stepKey="waitForOrderGridLoad"/> - <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingOrderFilters"/> - <click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openOrderGridFilters"/> - <fillField selector="{{AdminDataGridHeaderSection.filterFieldInput('billing_name')}}" userInput="{{customer.fullname}}" stepKey="fillBillToNameFilter"/> - <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickOrderApplyFilters"/> - </actionGroup> - - <actionGroup name="filterOrderGridByBaseTotalRange"> - <annotations> - <description>Goes to the Admin Orders page. Filters the grid based on the provided Grand Total From/To values.</description> - </annotations> - <arguments> - <argument name="from"/> - <argument name="to"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `FilterOrderGridByBaseTotalRangeActionGroup` instead --> - <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingOrderFilters"/> - <click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openOrderGridFilters"/> - <fillField selector="{{AdminDataGridHeaderSection.filterFieldInput('base_grand_total[from]')}}" userInput="{{from}}" stepKey="fillOrderTotalFrom"/> - <fillField selector="{{AdminDataGridHeaderSection.filterFieldInput('base_grand_total[to]')}}" userInput="{{to}}" stepKey="fillOrderTotalTo"/> - <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickApplyFilters"/> - </actionGroup> - - <actionGroup name="filterOrderGridByPurchaseDate"> - <annotations> - <description>Goes to the Admin Orders page. Filters the grid based on the provided Purchased Date From/To values.</description> - </annotations> - <arguments> - <argument name="from"/> - <argument name="to"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `FilterOrderGridByPurchaseDateActionGroup` instead --> - <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingOrderFilters"/> - <click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openOrderGridFilters"/> - <fillField selector="{{AdminDataGridHeaderSection.filterFieldInput('created_at[from]')}}" userInput="{{from}}" stepKey="fillOrderPurchaseDateFrom"/> - <fillField selector="{{AdminDataGridHeaderSection.filterFieldInput('created_at[to]')}}" userInput="{{to}}" stepKey="fillOrderPurchaseDateTo"/> - <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickApplyFilters"/> - </actionGroup> - - <actionGroup name="filterOrderGridByStatus"> - <annotations> - <description>Filters the Admin Orders grid based on the provided Order Status.</description> - </annotations> - <arguments> - <argument name="status"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `FilterOrderGridByStatusActionGroup` instead --> - <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingOrderFilters"/> - <click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openOrderGridFilters"/> - <selectOption selector="{{AdminDataGridHeaderSection.filterFieldSelect('status')}}" userInput="{{status}}" stepKey="fillOrderStatusFilter"/> - <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickApplyFilters"/> - </actionGroup> - - <actionGroup name="OpenOrderById" extends="filterOrderGridById"> - <annotations> - <description>EXTENDS: filterOrderGridById. Clicks on the 1st row of the Admin Orders grid.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `OpenOrderByIdActionGroup` instead --> - <click selector="{{AdminDataGridTableSection.firstRow}}" after="clickOrderApplyFilters" stepKey="openOrderViewPage"/> - <waitForPageLoad after="openOrderViewPage" stepKey="waitForOrderViewPageOpened"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml deleted file mode 100644 index 648500bcaeb40..0000000000000 --- a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml +++ /dev/null @@ -1,110 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<!-- -NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. - Please find the Comment with proper replacement for each of ActionGroups provided. ---> -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="selectNotLoggedInCustomerGroup"> - <annotations> - <description>Selects 'NOT LOGGED IN' from the 'Customer Groups' list (Magento 2 B2B). PLEASE NOTE: The value is Hardcoded.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SelectNotLoggedInCustomerGroupActionGroup` instead --> - <selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="NOT LOGGED IN" stepKey="selectCustomerGroup"/> - </actionGroup> - - <actionGroup name="selectRetailerCustomerGroup"> - <annotations> - <description>Selects 'Retailer' from the 'Customer Groups' list (Magento 2 B2B). PLEASE NOTE: The value is Hardcoded.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SelectRetailerCustomerGroupActionGroup` instead --> - <selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="Retailer" stepKey="selectRetailerCustomerGroup"/> - </actionGroup> - - <actionGroup name="AdminCreateCartPriceRuleWithCouponCode" extends="AdminCreateCartPriceRuleActionGroup"> - <annotations> - <description>EXTENDS: AdminCreateCartPriceRuleActionGroup. Removes 'selectActionType' and 'fillDiscountAmount'. Adds the provided Coupon Code to a Cart Price Rule.</description> - </annotations> - <arguments> - <argument name="couponCode" defaultValue="_defaultCoupon.code"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminCreateCartPriceRuleWithCouponCodeActionGroup` instead --> - <remove keyForRemoval="selectActionType"/> - <remove keyForRemoval="fillDiscountAmount"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.coupon}}" userInput="Specific Coupon" stepKey="selectCouponType" after="fillRuleName"/> - <waitForElementVisible selector="{{AdminCartPriceRulesFormSection.couponCode}}" stepKey="waitForElementVisible" after="selectCouponType"/> - <fillField selector="{{AdminCartPriceRulesFormSection.couponCode}}" userInput="{{couponCode}}" stepKey="fillCouponCode" after="waitForElementVisible"/> - <fillField selector="{{AdminCartPriceRulesFormSection.userPerCoupon}}" userInput="99" stepKey="fillUserPerCoupon" after="fillCouponCode"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="Fixed amount discount for whole cart" stepKey="selectActionTypeToFixed" after="clickToExpandActions"/> - <fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="1" stepKey="fillDiscountAmount" after="selectActionTypeToFixed"/> - </actionGroup> - - <actionGroup name="AdminCreateCartPriceRuleWithConditions" extends="AdminCreateCartPriceRuleActionGroup"> - <annotations> - <description>EXTENDS: AdminCreateCartPriceRuleActionGroup. Removes 'fillDiscountAmount'. Adds the 2 provided Conditions (Name, Rule, Rule to Change and Category Name) to a Cart Price Rule.</description> - </annotations> - <arguments> - <argument name="condition1" type="string" defaultValue="Products subselection"/> - <argument name="condition2" type="string" defaultValue="Category"/> - <argument name="ruleToChange1" type="string" defaultValue="is"/> - <argument name="rule1" type="string" defaultValue="equals or greater than"/> - <argument name="ruleToChange2" type="string" defaultValue="..."/> - <argument name="rule2" type="string" defaultValue="2"/> - <argument name="categoryName" type="string" defaultValue="_defaultCategory.name"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminCreateCartPriceRuleWithConditionsActionGroup` instead --> - <remove keyForRemoval="fillDiscountAmount"/> - - <click selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" stepKey="openConditionsSection" after="selectActionType"/> - <click selector="{{AdminCartPriceRulesFormSection.addCondition('1')}}" stepKey="addFirstCondition" after="openConditionsSection"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.ruleCondition('1')}}" userInput="{{condition1}}" stepKey="selectRule" after="addFirstCondition"/> - <waitForElementVisible selector="{{AdminCartPriceRulesFormSection.ruleParameter(ruleToChange1)}}" stepKey="waitForFirstRuleElement" after="selectRule"/> - <click selector="{{AdminCartPriceRulesFormSection.ruleParameter(ruleToChange1)}}" stepKey="clickToChangeRule" after="waitForFirstRuleElement"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.ruleParameterSelect('1--1')}}" userInput="{{rule1}}" stepKey="selectRule1" after="clickToChangeRule"/> - <waitForElementVisible selector="{{AdminCartPriceRulesFormSection.ruleParameter(ruleToChange2)}}" stepKey="waitForSecondRuleElement" after="selectRule1"/> - <click selector="{{AdminCartPriceRulesFormSection.ruleParameter(ruleToChange2)}}" stepKey="clickToChangeRule1" after="waitForSecondRuleElement"/> - <fillField selector="{{AdminCartPriceRulesFormSection.ruleParameterInput('1--1')}}" userInput="{{rule2}}" stepKey="fillRule" after="clickToChangeRule1"/> - <click selector="{{AdminCartPriceRulesFormSection.addCondition('1--1')}}" stepKey="addSecondCondition" after="fillRule"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.ruleCondition('1--1')}}" userInput="{{condition2}}" stepKey="selectSecondCondition" after="addSecondCondition"/> - <waitForElementVisible selector="{{AdminCartPriceRulesFormSection.ruleParameter(ruleToChange2)}}" stepKey="waitForThirdRuleElement" after="selectSecondCondition"/> - <click selector="{{AdminCartPriceRulesFormSection.ruleParameter(ruleToChange2)}}" stepKey="addThirdCondition" after="waitForThirdRuleElement"/> - <waitForElementVisible selector="{{AdminCartPriceRulesFormSection.openChooser('1--1--1')}}" stepKey="waitForForthRuleElement" after="addThirdCondition"/> - <click selector="{{AdminCartPriceRulesFormSection.openChooser('1--1--1')}}" stepKey="openChooser" after="waitForForthRuleElement"/> - <waitForElementVisible selector="{{AdminCartPriceRulesFormSection.categoryCheckbox(categoryName)}}" stepKey="waitForCategoryVisible" after="openChooser"/> - <checkOption selector="{{AdminCartPriceRulesFormSection.categoryCheckbox(categoryName)}}" stepKey="checkCategoryName" after="waitForCategoryVisible"/> - </actionGroup> - - <actionGroup name="VerifyDiscountAmount"> - <annotations> - <description>Goes to the provided Storefront Product URL. Fills in provided Quantity. Clicks Add to Cart. Goes to Checkout. Validates that the provided Discount Amount is present and correct.</description> - </annotations> - <arguments> - <argument name="productUrl" type="string"/> - <argument name="quantity" type="string"/> - <argument name="expectedDiscount" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `VerifyDiscountAmountActionGroup` instead --> - <amOnPage url="{{productUrl}}" stepKey="goToProductPage"/> - <waitForPageLoad stepKey="waitForProductPageLoad"/> - <fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="{{quantity}}" stepKey="fillQuantity"/> - <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart"/> - <waitForPageLoad stepKey="waitForAddToCart"/> - <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> - <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage"/> - <waitForPageLoad stepKey="waitForCartPage"/> - <waitForElementVisible selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="waitForDiscountElement"/> - <see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="{{expectedDiscount}}" stepKey="seeDiscountTotal"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Search/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Search/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml deleted file mode 100644 index 6c860e8273bab..0000000000000 --- a/app/code/Magento/Search/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml +++ /dev/null @@ -1,51 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<!-- -NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. - Please find the Comment with proper replacement for each of ActionGroups provided. ---> -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="searchTermFilterBySearchQuery"> - <annotations> - <description>Fills in the provided Search Query on the Admin Search Term grid page.</description> - </annotations> - <arguments> - <argument name="searchQuery" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminSearchTermFilterBySearchQueryActionGroup` instead --> - <click selector="{{AdminCatalogSearchTermIndexSection.resetFilterButton}}" stepKey="clickOnResetButton"/> - <waitForPageLoad stepKey="waitForResetFilter"/> - <fillField selector="{{AdminCatalogSearchTermIndexSection.searchQuery}}" userInput="{{searchQuery}}" stepKey="fillSearchQuery"/> - <click selector="{{AdminCatalogSearchTermIndexSection.searchButton}}" stepKey="clickSearchButton"/> - <waitForPageLoad stepKey="waitForSearchResultLoad"/> - <checkOption selector="{{AdminCatalogSearchTermIndexSection.searchTermRowCheckboxBySearchQuery(searchQuery)}}" stepKey="checkCheckBox"/> - </actionGroup> - - <actionGroup name="deleteSearchTerm"> - <annotations> - <description>Deletes the Search Terms in the Admin Search Term grid.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminDeleteSearchTermActionGroup` instead --> - <selectOption selector="{{AdminCatalogSearchTermIndexSection.massActions}}" userInput="delete" stepKey="selectDeleteOption"/> - <click selector="{{AdminCatalogSearchTermIndexSection.submit}}" stepKey="clickSubmitButton"/> - <click selector="{{AdminCatalogSearchTermIndexSection.okButton}}" stepKey="clickOkButton"/> - <waitForElementVisible selector="{{AdminCatalogSearchTermMessagesSection.successMessage}}" stepKey="waitForSuccessMessage"/> - </actionGroup> - - <actionGroup name="DeleteAllSearchTerms"> - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminDeleteAllSearchTermsActionGroup` instead --> - <selectOption userInput="selectAll" selector="{{AdminCatalogSearchTermIndexSection.selectMassActionCheckbox}}" stepKey="checkAllSearchTerms"/> - <selectOption selector="{{AdminCatalogSearchTermIndexSection.massActions}}" userInput="delete" stepKey="selectDeleteOption"/> - <click selector="{{AdminCatalogSearchTermIndexSection.submit}}" stepKey="clickSubmitButton"/> - <click selector="{{AdminCatalogSearchTermIndexSection.okButton}}" stepKey="clickOkButton"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml deleted file mode 100644 index 7654b1baef2d8..0000000000000 --- a/app/code/Magento/Store/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml +++ /dev/null @@ -1,247 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<!-- -NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. - Please find the Comment with proper replacement for each of ActionGroups provided. ---> -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="CreateCustomStore"> - <annotations> - <description>Goes to the Admin Stores grid page. Clicks on 'Create Store'. Fills in the provided Details (Website, Store Group Name and Store Group Code). Clicks on Save. Validates that the Success Message is present and correct.</description> - </annotations> - <arguments> - <argument name="website" type="string"/> - <argument name="store" type="string"/> - <argument name="rootCategory" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateCustomStoreActionGroup` instead --> - <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> - <waitForPageLoad stepKey="waitForSystemStorePage"/> - <click selector="{{AdminStoresMainActionsSection.createStoreButton}}" stepKey="selectCreateStore"/> - <selectOption userInput="{{website}}" selector="{{AdminNewStoreGroupSection.storeGrpWebsiteDropdown}}" stepKey="selectMainWebsite"/> - <fillField userInput="{{store}}" selector="{{AdminNewStoreGroupSection.storeGrpNameTextField}}" stepKey="fillStoreName"/> - <fillField userInput="{{store}}" selector="{{AdminNewStoreGroupSection.storeGrpCodeTextField}}" stepKey="fillStoreCode"/> - <selectOption userInput="{{rootCategory}}" selector="{{AdminNewStoreGroupSection.storeRootCategoryDropdown}}" stepKey="selectStoreStatus"/> - <click selector="{{AdminStoreGroupActionsSection.saveButton}}" stepKey="clickSaveStoreGroup"/> - <waitForElementVisible selector="{{AdminStoresGridSection.storeGrpFilterTextField}}" stepKey="waitForStoreGridReload"/> - <see userInput="You saved the store." stepKey="seeSavedMessage"/> - </actionGroup> - - <actionGroup name="AssertStoreGroupInGrid"> - <annotations> - <description>Goes to the Admin Stores grid page. Searches for the provided Store Group Name. Validates that the provided Store Group Name is present in the grid.</description> - </annotations> - <arguments> - <argument name="storeGroupName" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertStoreGroupInGridActionGroup` instead --> - <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> - <waitForPageLoad stepKey="waitForAdminSystemStorePageLoad"/> - <click selector="{{AdminStoresGridSection.resetButton}}" stepKey="resetSearchFilter"/> - <fillField userInput="{{storeGroupName}}" selector="{{AdminStoresGridSection.storeGrpFilterTextField}}" stepKey="fillSearchStoreGroupField"/> - <click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearchButton"/> - <waitForPageLoad stepKey="waitForStoreToLoad"/> - <see selector="{{AdminStoresGridSection.nthRow('1')}}" userInput="{{storeGroupName}}" stepKey="seeAssertStoreGroupInGridMessage"/> - </actionGroup> - - <actionGroup name="AssertStoreGroupForm"> - <annotations> - <description>Clicks on the 1st Store in the 'Stores' grid. Validates that the provided Details (Website, Store Group Name, Store Group Code and Root Category) are present and correct.</description> - </annotations> - <arguments> - <argument name="website" type="string"/> - <argument name="storeGroupName" type="string"/> - <argument name="storeGroupCode" type="string"/> - <argument name="rootCategory" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertStoreGroupFormActionGroup` instead --> - <click selector="{{AdminStoresGridSection.storeGrpNameInFirstRow}}" stepKey="clickEditExistingStoreRow"/> - <waitForPageLoad stepKey="waitTillAdminSystemStoreGroupPage"/> - <seeInField selector="{{AdminNewStoreGroupSection.storeGrpWebsiteDropdown}}" userInput="{{website}}" stepKey="seeAssertWebsite"/> - <seeInField selector="{{AdminNewStoreGroupSection.storeGrpNameTextField}}" userInput="{{storeGroupName}}" stepKey="seeAssertStoreGroupName"/> - <seeInField selector="{{AdminNewStoreGroupSection.storeGrpCodeTextField}}" userInput="{{storeGroupCode}}" stepKey="seeAssertStoreGroupCode"/> - <seeInField selector="{{AdminNewStoreGroupSection.storeRootCategoryDropdown}}" userInput="{{rootCategory}}" stepKey="seeAssertRootCategory"/> - </actionGroup> - - <actionGroup name="AdminCreateStoreViewActionSaveGroup"> - <annotations> - <description>Validates that the Success Message is present and correct.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminCreateStoreViewSaveActionGroup` instead --> - <waitForLoadingMaskToDisappear stepKey="waitForGridLoad"/> - <waitForElementVisible selector="{{AdminStoresGridSection.websiteFilterTextField}}" stepKey="waitForStoreGridToReload2"/> - <see userInput="You saved the store view." stepKey="seeSavedMessage"/> - </actionGroup> - - <actionGroup name="navigateToAdminContentManagementPage"> - <annotations> - <description>Goes to the 'Configuration' page for 'Content Management'.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `NavigateToAdminContentManagementPageActionGroup` instead --> - <amOnPage url="{{AdminContentManagementPage.url}}" stepKey="navigateToConfigurationPage"/> - <waitForPageLoad stepKey="waitForPageLoad1"/> - </actionGroup> - - <actionGroup name="saveStoreConfiguration"> - <annotations> - <description>Clicks on the Save button.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SaveStoreConfigurationActionGroup` instead --> - <comment userInput="saveStoreConfiguration" stepKey="comment"/> - <waitForElementVisible selector="{{StoreConfigSection.Save}}" stepKey="waitForSaveButton"/> - <click selector="{{StoreConfigSection.Save}}" stepKey="clickSaveButton"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - </actionGroup> - - <actionGroup name="saveStoreConfigurationAndValidateFieldError"> - <annotations> - <description>Clicks on Save. Validates that the fields are required.</description> - </annotations> - <arguments> - <argument name="inputFieldError" type="string"/> - <argument name="errorMessageSelector" type="string"/> - <argument name="errorMessage" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SaveStoreConfigurationAndValidateFieldErrorActionGroup` instead --> - <comment userInput="saveStoreConfigurationAndValidateFieldError" stepKey="comment"/> - <waitForElementVisible selector="{{StoreConfigSection.Save}}" stepKey="waitForSaveButton"/> - <click selector="{{StoreConfigSection.Save}}" stepKey="clickSaveButton"/> - <waitForElement selector="{{inputFieldError}}" stepKey="waitForErrorField"/> - <waitForElementVisible selector="{{errorMessageSelector}}" stepKey="waitForErrorMessage"/> - <see selector="{{errorMessageSelector}}" userInput="{{errorMessage}}" stepKey="seeErrorMessage"/> - </actionGroup> - - <actionGroup name="AssertWebsiteInGrid"> - <annotations> - <description>Goes to the Admin Stores grid page. Searches the grid for the provided Website Name. Validates that the Website appears in the grid.</description> - </annotations> - <arguments> - <argument name="websiteName" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertWebsiteInGridActionGroup` instead --> - <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> - <waitForPageLoad stepKey="waitForAdminSystemStorePageLoad"/> - <click selector="{{AdminStoresGridSection.resetButton}}" stepKey="resetSearchFilter"/> - <fillField userInput="{{websiteName}}" selector="{{AdminStoresGridSection.websiteFilterTextField}}" stepKey="fillWebsiteField"/> - <click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearchButton"/> - <waitForPageLoad stepKey="waitForStoreToLoad"/> - <seeElement selector="{{AdminStoresGridSection.websiteName(websiteName)}}" stepKey="seeAssertWebsiteInGrid"/> - </actionGroup> - - <actionGroup name="AssertWebsiteForm"> - <annotations> - <description>Clicks on the provided Website Name in the Admin Stores grid. Validates that the URL, Website Name/Code are present and correct.</description> - </annotations> - <arguments> - <argument name="websiteName" type="string"/> - <argument name="websiteCode" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertWebsiteFormActionGroup` instead --> - <click selector="{{AdminStoresGridSection.websiteName(websiteName)}}" stepKey="clickWebsiteFirstRowInGrid"/> - <waitForPageLoad stepKey="waitTillWebsiteFormPageIsOpened"/> - <grabFromCurrentUrl regex="~(\d+)/~" stepKey="grabWebsiteIdFromCurrentUrl"/> - <seeInCurrentUrl url="/system_store/editWebsite/website_id/{$grabWebsiteIdFromCurrentUrl}" stepKey="seeWebsiteId"/> - <seeInField selector="{{AdminNewWebsiteSection.name}}" userInput="{{websiteName}}" stepKey="seeAssertWebsiteName"/> - <seeInField selector="{{AdminNewWebsiteSection.code}}" userInput="{{websiteCode}}" stepKey="seeAssertWebsiteCode"/> - </actionGroup> - - <actionGroup name="AssertStoreViewNotInGrid"> - <annotations> - <description>Goes to the Admin Stores grid page. Searches the grid for the provided Store View name. Validates that it does NOT appear in the grid.</description> - </annotations> - <arguments> - <argument name="storeViewName" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertStoreViewNotInGridActionGroup` instead --> - <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> - <waitForPageLoad stepKey="waitForAdminSystemStorePageLoad"/> - <click selector="{{AdminStoresGridSection.resetButton}}" stepKey="resetSearchFilter"/> - <fillField userInput="{{storeViewName}}" selector="{{AdminStoresGridSection.storeFilterTextField}}" stepKey="fillSearchStoreViewField"/> - <click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearchButton"/> - <waitForPageLoad stepKey="waitForStoreToLoad"/> - <see selector="{{AdminStoresGridSection.emptyText}}" userInput="We couldn't find any records." stepKey="seeAssertStoreViewNotInGridMessage"/> - </actionGroup> - - <actionGroup name="AdminAddCustomWebSiteToStoreGroup"> - <annotations> - <description>Goes to the Admin Stores grid page. Searches the grid for the provided Store Group. Edits the Store. Adds the provided Website to the Store. Clicks on Save. Validates that the Success Message is present and correct.</description> - </annotations> - <arguments> - <argument name="storeGroup" defaultValue="customStoreGroup"/> - <argument name="website" defaultValue="customWebsite"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminAddCustomWebSiteToStoreGroupActionGroup` instead --> - <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> - <click selector="{{AdminStoresGridSection.resetButton}}" stepKey="resetSearchFilter"/> - <fillField userInput="{{storeGroup.name}}" selector="{{AdminStoresGridSection.storeGrpFilterTextField}}" stepKey="fillSearchStoreGroupField"/> - <click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearchButton"/> - <see userInput="{{storeGroup.name}}" selector="{{AdminStoresGridSection.storeGrpNameInFirstRow}}" stepKey="verifyThatCorrectStoreGroupFound"/> - <click selector="{{AdminStoresGridSection.storeGrpNameInFirstRow}}" stepKey="clickEditExistingStoreRow"/> - <waitForPageLoad stepKey="waitForStoreGroupPageLoad"/> - <selectOption selector="{{AdminNewStoreGroupSection.storeGrpWebsiteDropdown}}" userInput="{{website.name}}" stepKey="selectWebsite"/> - <selectOption selector="{{AdminNewStoreGroupSection.storeRootCategoryDropdown}}" userInput="Default Category" stepKey="chooseRootCategory"/> - <click selector="{{AdminNewStoreGroupActionsSection.saveButton}}" stepKey="clickSaveStoreGroup"/> - <conditionalClick selector="{{AdminNewStoreGroupSection.acceptNewStoreGroupCreation}}" dependentSelector="{{AdminNewStoreGroupSection.acceptNewStoreGroupCreation}}" visible="true" stepKey="clickAcceptNewStoreGroupCreationButton"/> - <waitForElementVisible selector="{{AdminStoresGridSection.storeFilterTextField}}" stepKey="waitForPageReload"/> - <see userInput="You saved the store." stepKey="seeSavedMessage"/> - </actionGroup> - - <actionGroup name="CreateStoreView"> - <annotations> - <description>Goes to the Admin Store Views creation page. Fills in the provided Store View, Store Group Name and Store View Status. Clicks on Save. Validates that the Success Message is present and correct.</description> - </annotations> - <arguments> - <argument name="storeView" defaultValue="customStore"/> - <argument name="storeGroupName" defaultValue="_defaultStoreGroup.name"/> - <argument name="storeViewStatus" defaultValue="_defaultStore.is_active"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `CreateStoreViewActionGroup` instead --> - <amOnPage url="{{AdminSystemStoreViewPage.url}}" stepKey="amOnAdminSystemStoreViewPage"/> - <waitForPageLoad stepKey="waitForProductPageLoad"/> - <selectOption userInput="{{storeGroupName}}" selector="{{AdminNewStoreSection.storeGrpDropdown}}" stepKey="selectStoreGroup"/> - <fillField userInput="{{storeView.name}}" selector="{{AdminNewStoreSection.storeNameTextField}}" stepKey="fillStoreViewName"/> - <fillField userInput="{{storeView.code}}" selector="{{AdminNewStoreSection.storeCodeTextField}}" stepKey="fillStoreViewCode"/> - <selectOption userInput="{{storeViewStatus}}" selector="{{AdminNewStoreSection.statusDropdown}}" stepKey="selectStoreViewStatus"/> - <click selector="{{AdminStoresMainActionsSection.saveButton}}" stepKey="clickSaveStoreViewButton"/> - <waitForElementVisible selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" stepKey="waitForAcceptNewStoreViewCreationButton"/> - <conditionalClick selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" dependentSelector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" visible="true" stepKey="clickAcceptNewStoreViewCreationButton"/> - <see userInput="You saved the store view." stepKey="seeSavedMessage"/> - </actionGroup> - - <actionGroup name="AssertStoreNotInGrid"> - <annotations> - <description>Goes to the Admin Stores grid page. Validates that the provided Store Group Name is NOT present in the grid.</description> - </annotations> - <arguments> - <argument name="storeGroupName" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertStoreNotInGridActionGroup` instead --> - <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> - <waitForPageLoad stepKey="waitForAdminSystemStorePageLoad"/> - <click selector="{{AdminStoresGridSection.resetButton}}" stepKey="resetSearchFilter"/> - <fillField userInput="{{storeGroupName}}" selector="{{AdminStoresGridSection.storeGrpFilterTextField}}" stepKey="fillSearchStoreGroupField"/> - <click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearchButton"/> - <waitForPageLoad stepKey="waitForStoreToLoad"/> - <see selector="{{AdminStoresGridSection.emptyText}}" userInput="We couldn't find any records." stepKey="seeAssertStoreGroupNotInGridMessage"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Swatches/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Swatches/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml deleted file mode 100644 index 676d6bb2d3e37..0000000000000 --- a/app/code/Magento/Swatches/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml +++ /dev/null @@ -1,115 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<!-- -NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. - Please find the Comment with proper replacement for each of ActionGroups provided. ---> -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="setColorPickerByHex"> - <annotations> - <description>Sets the provided HEX value in the provided Color Picker.</description> - </annotations> - <arguments> - <argument name="nthColorPicker" type="string" defaultValue="1"/> - <argument name="hexColor" type="string" defaultValue="e74c3c"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SetColorPickerByHexActionGroup` instead --> - <pressKey selector="{{AdminColorPickerSection.hexByIndex(nthColorPicker)}}" parameterArray="[\Facebook\WebDriver\WebDriverKeys::BACKSPACE,\Facebook\WebDriver\WebDriverKeys::BACKSPACE,\Facebook\WebDriver\WebDriverKeys::BACKSPACE,\Facebook\WebDriver\WebDriverKeys::BACKSPACE,\Facebook\WebDriver\WebDriverKeys::BACKSPACE,\Facebook\WebDriver\WebDriverKeys::BACKSPACE,'{{hexColor}}']" stepKey="fillHex1"/> - <click selector="{{AdminColorPickerSection.submitByIndex(nthColorPicker)}}" stepKey="submitColor1"/> - </actionGroup> - - <actionGroup name="assertSwatchColor"> - <annotations> - <description>Validates that the provided Color Picker contains the provided Style.</description> - </annotations> - <arguments> - <argument name="nthSwatch" type="string" defaultValue="1"/> - <argument name="expectedStyle" type="string" defaultValue="background: rgb(0, 0, 0);"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertSwatchColorActionGroup` instead --> - <grabAttributeFrom selector="{{AdminManageSwatchSection.nthSwatch(nthSwatch)}}" userInput="style" stepKey="grabStyle1"/> - <assertEquals stepKey="assertStyle1"> - <actualResult type="string">{$grabStyle1}</actualResult> - <expectedResult type="string">{{expectedStyle}}</expectedResult> - </assertEquals> - </actionGroup> - - <actionGroup name="assertStorefrontSwatchColor"> - <annotations> - <description>Validates that the Storefront Product has the provided Swatch with the provided Color.</description> - </annotations> - <arguments> - <argument name="nthSwatch" type="string" defaultValue="1"/> - <argument name="expectedRgb" type="string" defaultValue="rgb(231, 77, 60)"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertStorefrontSwatchColorActionGroup` instead --> - <grabAttributeFrom selector="{{StorefrontProductInfoMainSection.nthSwatchOption(nthSwatch)}}" userInput="style" stepKey="grabStyle1"/> - <assertEquals stepKey="assertStyle1"> - <actualResult type="string">{$grabStyle1}</actualResult> - <expectedResult type="string">background: center center no-repeat {{expectedRgb}};</expectedResult> - </assertEquals> - </actionGroup> - - <actionGroup name="openSwatchMenuByIndex"> - <annotations> - <description>Options the Swatch Menu based on the provided Index.</description> - </annotations> - <arguments> - <argument name="index" type="string" defaultValue="0"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `OpenSwatchMenuByIndexActionGroup` instead --> - <executeJS function="jQuery('#swatch_window_option_option_{{index}}').click()" stepKey="clickSwatch1"/> - </actionGroup> - - <actionGroup name="StorefrontSelectSwatchOptionOnProductPage"> - <arguments> - <argument name="optionName" type="string"/> - </arguments> - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontSelectSwatchOptionOnProductPageActionGroup` instead --> - <click selector="{{StorefrontProductInfoMainSection.swatchOptionByLabel(optionName)}}" stepKey="clickSwatchOption"/> - </actionGroup> - - <actionGroup name="StorefrontAssertSwatchOptionPrice"> - <arguments> - <argument name="optionName" type="string"/> - <argument name="optionPrice" type="string"/> - </arguments> - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontAssertSwatchOptionPriceActionGroup` instead --> - <click selector="{{StorefrontProductInfoMainSection.swatchOptionByLabel(optionName)}}" stepKey="clickOnOption"/> - <see userInput="{{optionPrice}}" selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="seeOptionPrice"/> - </actionGroup> - - <actionGroup name="StorefrontSelectSwatchOptionOnProductPageAndCheckImage" extends="StorefrontSelectSwatchOptionOnProductPage"> - <arguments> - <argument name="fileName" type="string" defaultValue="magento-logo"/> - </arguments> - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontSelectSwatchOptionOnProductPageAndCheckImageActionGroup` instead --> - <seeElement selector="{{StorefrontProductMediaSection.productImageActive(fileName)}}" stepKey="seeActiveImageDefault"/> - </actionGroup> - - <actionGroup name="StorefrontUpdateCartConfigurableProductWithSwatches"> - <arguments> - <argument name="product"/> - <argument name="productOption" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontUpdateCartConfigurableProductWithSwatchesActionGroup` instead --> - <click selector="{{CheckoutCartProductSection.nthEditButton('1')}}" stepKey="clickEditConfigurableProductButton"/> - <waitForPageLoad stepKey="waitForStorefrontProductPageLoad"/> - <click selector="{{StorefrontProductInfoMainSection.visualSwatchOption(productOption)}}" stepKey="changeSwatchAttributeOption"/> - <click selector="{{StorefrontProductInfoMainSection.updateCart}}" stepKey="clickUpdateCartButton"/> - <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> - <see selector="{{StorefrontMessagesSection.success}}" userInput="{{product.name}} was updated in your shopping cart." stepKey="assertSuccessMessage"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Tax/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Tax/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml deleted file mode 100644 index 95516361a74f5..0000000000000 --- a/app/code/Magento/Tax/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml +++ /dev/null @@ -1,271 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<!-- -NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. - Please find the Comment with proper replacement for each of ActionGroups provided. ---> -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="addCustomerTaxClass"> - <annotations> - <description>Adds the provided Customer Tax Class on the Admin Tax Rule creation/edit page.</description> - </annotations> - <arguments> - <argument name="customerTaxClassName" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddCustomerTaxClassActionGroup` instead --> - <click stepKey="clickAdditionalSettings" selector="{{AdminTaxRulesSection.additionalSettings}}"/> - <click stepKey="clickCustomerAddNewTaxClassBtn" selector="{{AdminTaxRulesSection.customerAddNewTaxClass}}"/> - <fillField stepKey="fillCustomerNewTaxClass" selector="{{AdminTaxRulesSection.fieldCustomerNewTaxClass}}" userInput="{{customerTaxClassName}}"/> - <click stepKey="saveProdTaxRate" selector="{{AdminTaxRulesSection.saveCustomerNewTaxClass}}"/> - </actionGroup> - - <actionGroup name="deleteCustomerTaxClass"> - <annotations> - <description>Goes to the Admin New Tax Rule page. Deletes the provided Tax Class Name.</description> - </annotations> - <arguments> - <argument name="taxClassName" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `DeleteCustomerTaxClassActionGroup` instead --> - <amOnPage url="{{AdminNewTaxRulePage.url}}" stepKey="goToNewTaxRulePage"/> - <waitForPageLoad stepKey="waitForTaxRatePage"/> - <click stepKey="clickAdditionalSettings" selector="{{AdminTaxRulesSection.additionalSettings}}"/> - <scrollTo stepKey="scrollToAdditionalSettings" selector="{{AdminTaxRulesSection.additionalSettings}}"/> - <moveMouseOver stepKey="hoverDeleteElement" selector="{{AdminTaxRulesSection.deleteTaxClassName(taxClassName)}}"/> - <click stepKey="deleteFirstTaxClass" selector="{{AdminTaxRulesSection.deleteTaxClass(taxClassName)}}"/> - <waitForElementVisible selector="{{AdminTaxRulesSection.popUpDialogOK}}" stepKey="waitForElementBecomeVisible"/> - <click stepKey="acceptPopUpDialog" selector="{{AdminTaxRulesSection.popUpDialogOK}}"/> - <waitForPageLoad stepKey="waitForProductTaxClassDeleted"/> - </actionGroup> - <actionGroup name="editTaxConfigurationByUI"> - <annotations> - <description>Goes to the 'Configuration' page for 'Tax'. Enables the display of Taxes in the Storefront Shopping Cart and Checkout page.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `EditTaxConfigurationByUIActionGroup` instead --> - <amOnPage url="{{AdminTaxConfigurationPage.url}}" stepKey="goToAdminTaxPage"/> - <waitForPageLoad stepKey="waitForTaxConfigLoad"/> - - <scrollTo selector="#tax_defaults-head" x="0" y="-80" stepKey="scrollToTaxDefaults"/> - - <conditionalClick stepKey="clickCalculationSettings" selector="{{AdminConfigureTaxSection.defaultDestination}}" dependentSelector="#tax_defaults" visible="false"/> - <conditionalClick stepKey="clickCalculationSettingsAgain" selector="{{AdminConfigureTaxSection.defaultDestination}}" dependentSelector="#tax_defaults" visible="false"/> - <uncheckOption stepKey="clickDefaultState" selector="{{AdminConfigureTaxSection.systemValueDefaultState}}"/> - <selectOption stepKey="selectDefaultState" selector="{{AdminConfigureTaxSection.dropdownDefaultState}}" userInput="California"/> - <fillField stepKey="fillDefaultPostCode" selector="{{AdminConfigureTaxSection.defaultPostCode}}" userInput="*"/> - - <scrollTo selector="#tax_cart_display-head" x="0" y="-80" stepKey="scrollToTaxShoppingCartDisplay"/> - - <conditionalClick stepKey="clickShoppingCartDisplaySettings" selector="{{AdminConfigureTaxSection.shoppingCartDisplay}}" dependentSelector="#tax_cart_display" visible="false"/> - <conditionalClick stepKey="clickShoppingCartDisplaySettingsAgain" selector="{{AdminConfigureTaxSection.shoppingCartDisplay}}" dependentSelector="#tax_cart_display" visible="false"/> - <uncheckOption stepKey="clickTaxTotalCart" selector="{{AdminConfigureTaxSection.systemValueIncludeTaxTotalCart}}"/> - <selectOption stepKey="selectTaxTotalCart" selector="{{AdminConfigureTaxSection.dropdownIncludeTaxTotalCart}}" userInput="Yes"/> - <uncheckOption stepKey="clickDisplayTaxSummaryCart" selector="{{AdminConfigureTaxSection.systemValueDisplayTaxSummaryCart}}"/> - <selectOption stepKey="selectDisplayTaxSummaryCart" selector="{{AdminConfigureTaxSection.dropdownDisplayTaxSummaryCart}}" userInput="Yes"/> - <uncheckOption stepKey="clickDisplayZeroTaxCart" selector="{{AdminConfigureTaxSection.systemValueDisplayZeroTaxCart}}"/> - <selectOption stepKey="selectDisplayZeroTaxCart" selector="{{AdminConfigureTaxSection.dropdownDisplayZeroTaxCart}}" userInput="Yes"/> - - <scrollTo selector="#tax_sales_display-head" x="0" y="-80" stepKey="scrollToTaxSalesDisplay"/> - - <conditionalClick stepKey="clickOrdersInvoicesCreditSales" selector="{{AdminConfigureTaxSection.ordersInvoicesCreditSales}}" dependentSelector="#tax_sales_display" visible="false"/> - <conditionalClick stepKey="clickOrdersInvoicesCreditSalesAgain" selector="{{AdminConfigureTaxSection.ordersInvoicesCreditSales}}" dependentSelector="#tax_sales_display" visible="false"/> - <uncheckOption stepKey="clickTaxTotalSales" selector="{{AdminConfigureTaxSection.systemValueIncludeTaxTotalSales}}"/> - <selectOption stepKey="selectTaxTotalSales" selector="{{AdminConfigureTaxSection.dropdownIncludeTaxTotalSales}}" userInput="Yes"/> - <uncheckOption stepKey="clickDisplayTaxSummarySales" selector="{{AdminConfigureTaxSection.systemValueDisplayTaxSummarySales}}"/> - <selectOption stepKey="selectDisplayTaxSummarySales" selector="{{AdminConfigureTaxSection.dropdownDisplayTaxSummarySales}}" userInput="Yes"/> - <uncheckOption stepKey="clickDisplayZeroTaxSales" selector="{{AdminConfigureTaxSection.systemValueDisplayZeroTaxSales}}"/> - <selectOption stepKey="selectDisplayZeroTaxSales" selector="{{AdminConfigureTaxSection.dropdownDisplayZeroTaxSales}}" userInput="Yes"/> - - <scrollToTopOfPage stepKey="scrollToTop"/> - <click stepKey="saveTaxOptions" selector="{{AdminCategoryMainActionsSection.SaveButton}}"/> - <waitForPageLoad stepKey="waitForTaxSaved"/> - <see stepKey="seeSuccess" selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the configuration."/> - </actionGroup> - - <actionGroup name="changeToDefaultTaxConfigurationUI"> - <annotations> - <description>Goes to the 'Configuration' page for 'Tax'. Set the Tax Configuration Settings to the Default values. Clicks on Save. Validates that the Success Message is present and correct.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `ChangeToDefaultTaxConfigurationUIActionGroup` instead --> - <amOnPage url="{{AdminTaxConfigurationPage.url}}" stepKey="goToAdminTaxPage"/> - <waitForPageLoad stepKey="waitForTaxConfigLoad"/> - - <conditionalClick stepKey="clickCalculationSettings" selector="{{AdminConfigureTaxSection.defaultDestination}}" dependentSelector="{{AdminConfigureTaxSection.systemValueDefaultState}}" visible="false"/> - <conditionalClick stepKey="clickCalculationSettingsAgain" selector="{{AdminConfigureTaxSection.defaultDestination}}" dependentSelector="{{AdminConfigureTaxSection.systemValueDefaultState}}" visible="false"/> - <checkOption stepKey="clickDefaultState" selector="{{AdminConfigureTaxSection.systemValueDefaultState}}"/> - <selectOption stepKey="selectDefaultState" selector="{{AdminConfigureTaxSection.dropdownDefaultState}}" userInput="California"/> - <fillField stepKey="fillDefaultPostCode" selector="{{AdminConfigureTaxSection.defaultPostCode}}" userInput=""/> - - <conditionalClick stepKey="clickShoppingCartDisplaySettings" selector="{{AdminConfigureTaxSection.shoppingCartDisplay}}" dependentSelector="{{AdminConfigureTaxSection.systemValueIncludeTaxTotalCart}}" visible="false"/> - <conditionalClick stepKey="clickShoppingCartDisplaySettingsAgain" selector="{{AdminConfigureTaxSection.shoppingCartDisplay}}" dependentSelector="{{AdminConfigureTaxSection.systemValueIncludeTaxTotalCart}}" visible="false"/> - <checkOption stepKey="clickTaxTotalCart" selector="{{AdminConfigureTaxSection.systemValueIncludeTaxTotalCart}}"/> - <selectOption stepKey="selectTaxTotalCart" selector="{{AdminConfigureTaxSection.dropdownIncludeTaxTotalCart}}" userInput="Yes"/> - <checkOption stepKey="clickDisplayTaxSummaryCart" selector="{{AdminConfigureTaxSection.systemValueDisplayTaxSummaryCart}}"/> - <selectOption stepKey="selectDisplayTaxSummaryCart" selector="{{AdminConfigureTaxSection.dropdownDisplayTaxSummaryCart}}" userInput="Yes"/> - <checkOption stepKey="clickDisplayZeroTaxCart" selector="{{AdminConfigureTaxSection.systemValueDisplayZeroTaxCart}}"/> - <selectOption stepKey="selectDisplayZeroTaxCart" selector="{{AdminConfigureTaxSection.dropdownDisplayZeroTaxCart}}" userInput="Yes"/> - - <conditionalClick stepKey="clickOrdersInvoicesCreditSales" selector="{{AdminConfigureTaxSection.ordersInvoicesCreditSales}}" dependentSelector="{{AdminConfigureTaxSection.systemValueIncludeTaxTotalSales}}" visible="false"/> - <conditionalClick stepKey="clickOrdersInvoicesCreditSalesAgain" selector="{{AdminConfigureTaxSection.ordersInvoicesCreditSales}}" dependentSelector="{{AdminConfigureTaxSection.systemValueIncludeTaxTotalSales}}" visible="false"/> - <checkOption stepKey="clickTaxTotalSales" selector="{{AdminConfigureTaxSection.systemValueIncludeTaxTotalSales}}"/> - <selectOption stepKey="selectTaxTotalSales" selector="{{AdminConfigureTaxSection.dropdownIncludeTaxTotalSales}}" userInput="Yes"/> - <checkOption stepKey="clickDisplayTaxSummarySales" selector="{{AdminConfigureTaxSection.systemValueDisplayTaxSummarySales}}"/> - <selectOption stepKey="selectDisplayTaxSummarySales" selector="{{AdminConfigureTaxSection.dropdownDisplayTaxSummarySales}}" userInput="Yes"/> - <checkOption stepKey="clickDisplayZeroTaxSales" selector="{{AdminConfigureTaxSection.systemValueDisplayZeroTaxSales}}"/> - <selectOption stepKey="selectDisplayZeroTaxSales" selector="{{AdminConfigureTaxSection.dropdownDisplayZeroTaxSales}}" userInput="Yes"/> - - <scrollToTopOfPage stepKey="scrollToTop"/> - <click stepKey="saveTaxOptions" selector="{{AdminCategoryMainActionsSection.SaveButton}}"/> - <see stepKey="seeSuccess" selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the configuration."/> - </actionGroup> - - <actionGroup name="addCustomTaxRate" extends="addNewTaxRateNoZip"> - <annotations> - <description>EXTENDS: addNewTaxRateNoZip. Removes 'fillZipCode' and 'fillRate'. Fills in the Zip Code and Rate. PLEASE NOTE: The values are Hardcoded.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddCustomTaxRateActionGroup` instead --> - <remove keyForRemoval="fillZipCode"/> - <remove keyForRemoval="fillRate"/> - <fillField stepKey="fillZipCode" selector="{{AdminTaxRulesSection.zipCode}}" userInput="US-NY-*-Rate 2" after="fillTaxIdentifier"/> - <fillField stepKey="fillRate" selector="{{AdminTaxRulesSection.rate}}" userInput="0" after="selectCountry"/> - </actionGroup> - - <actionGroup name="addNewTaxRateNoZip"> - <annotations> - <description>Goes to the Admin Tax Rules grid page. Adds the provided Tax Code.</description> - </annotations> - <arguments> - <argument name="taxCode"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddNewTaxRateNoZipActionGroup` instead --> - <click stepKey="addNewTaxRate" selector="{{AdminTaxRulesSection.addNewTaxRate}}"/> - - <fillField stepKey="fillTaxIdentifier" selector="{{AdminTaxRulesSection.taxIdentifier}}" userInput="{{taxCode.state}}-{{taxCode.rate}}"/> - <fillField stepKey="fillZipCode" selector="{{AdminTaxRulesSection.zipCode}}" userInput="{{taxCode.zip}}"/> - <selectOption stepKey="selectState" selector="{{AdminTaxRulesSection.state}}" userInput="{{taxCode.state}}"/> - <selectOption stepKey="selectCountry" selector="{{AdminTaxRulesSection.country}}" userInput="{{taxCode.country}}"/> - <fillField stepKey="fillRate" selector="{{AdminTaxRulesSection.rate}}" userInput="{{taxCode.rate}}"/> - - <click stepKey="saveTaxRate" selector="{{AdminTaxRulesSection.save}}"/> - </actionGroup> - - <actionGroup name="changeShippingTaxClass"> - <annotations> - <description>Goes to the 'Configuration' page for 'Tax'. Sets the 'Tax Class for Shipping' configuration setting to 'Taxable Goods'. Clicks on Save. Validates that the Success Message is present and correct.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `ChangeShippingTaxClassActionGroup` instead --> - <click selector="{{AdminMenuSection.stores}}" stepKey="clickOnSTORES"/> - <waitForPageLoad stepKey="waitForConfiguration"/> - <click selector="{{AdminMenuSection.configuration}}" stepKey="clickOnConfigurations"/> - <waitForPageLoad stepKey="waitForSales"/> - - <click selector="{{AdminMenuSection.stores}}" stepKey="clickOnSTORES1"/> - <waitForPageLoad stepKey="waitForConfiguration1"/> - <click selector="{{AdminMenuSection.configuration}}" stepKey="clickOnConfigurations1"/> - <waitForPageLoad stepKey="waitForSales1" time="5"/> - - <click selector="{{ConfigurationListSection.sales}}" stepKey="clickOnSales"/> - <waitForPageLoad stepKey="waitForPaymentMethods"/> - <click selector="{{AdminConfigureTaxSection.salesTax}}" stepKey="clickOnTax"/> - <waitForPageLoad stepKey="waitForTax"/> - <seeInCurrentUrl url="{{AdminTaxConfigurationPage.url}}" stepKey="adminTaxConfiguration"/> - <seeElement selector="{{AdminConfigureTaxSection.taxClasses}}" stepKey="taxClassSectionC"/> - <click selector="{{AdminConfigureTaxSection.taxClasses}}" stepKey="openTaxClassSection"/> - <click selector="{{AdminConfigureTaxSection.taxShippingClassSystem}}" stepKey="uncheckSystemValue"/> - <selectOption selector="{{AdminConfigureTaxSection.taxClassShipping}}" userInput="Taxable Goods" stepKey="setTaxClassForShipping"/> - - <scrollToTopOfPage stepKey="scrollToTop"/> - <click stepKey="saveTaxOptions" selector="{{AdminCategoryMainActionsSection.SaveButton}}"/> - <waitForPageLoad stepKey="waitForTaxSaved"/> - <see stepKey="seeSuccess" selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the configuration."/> - </actionGroup> - - <actionGroup name="setDefaultShippingTaxClass"> - <annotations> - <description>Goes to the 'Configuration' page via the Admin Side Menu. Sets the 'Tax Class for Shipping' to the System Default. Clicks on Save. Validates that the Success Message is present and correct.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SetDefaultShippingTaxClassActionGroup` instead --> - <click selector="{{AdminMenuSection.stores}}" stepKey="clickOnSTORES"/> - <waitForPageLoad stepKey="waitForConfiguration"/> - <click selector="{{AdminMenuSection.configuration}}" stepKey="clickOnConfigurations"/> - <waitForPageLoad stepKey="waitForSales"/> - - <click selector="{{AdminMenuSection.stores}}" stepKey="clickOnSTORES1"/> - <waitForPageLoad stepKey="waitForConfiguration1"/> - <click selector="{{AdminMenuSection.configuration}}" stepKey="clickOnConfigurations1"/> - <waitForPageLoad stepKey="waitForSales1"/> - - <click selector="{{ConfigurationListSection.sales}}" stepKey="clickOnSales"/> - <waitForPageLoad stepKey="waitForPaymentMethods"/> - <click selector="{{AdminConfigureTaxSection.salesTax}}" stepKey="clickOnTax"/> - <waitForPageLoad stepKey="waitForTax"/> - <seeElement selector="{{AdminConfigureTaxSection.taxClasses}}" stepKey="taxClassSectionC"/> - <click selector="{{AdminConfigureTaxSection.taxShippingClassSystem}}" stepKey="checkSystemDefaultValue"/> - <click selector="{{AdminConfigureTaxSection.taxClasses}}" stepKey="closeTaxClassSection"/> - - <scrollToTopOfPage stepKey="scrollToTop"/> - <click stepKey="saveTaxOptions" selector="{{AdminCategoryMainActionsSection.SaveButton}}"/> - <waitForPageLoad stepKey="waitForTaxSaved"/> - <see stepKey="seeSuccess" selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the configuration."/> - </actionGroup> - - <actionGroup name="addProductTaxClass"> - <annotations> - <description>Adds the provided Product Tax Class to a Tax Rule. Clicks on Save.</description> - </annotations> - <arguments> - <argument name="prodTaxClassName" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddProductTaxClassActionGroup` instead --> - <click stepKey="clickAdditionalSettings" selector="{{AdminTaxRulesSection.additionalSettings}}"/> - <click stepKey="clickProdAddNewTaxClassBtn" selector="{{AdminTaxRulesSection.productAddNewTaxClass}}"/> - <fillField stepKey="fillProdNewTaxClass" selector="{{AdminTaxRulesSection.fieldProdNewTaxClass}}" userInput="{{prodTaxClassName}}"/> - <click stepKey="saveProdTaxRate" selector="{{AdminTaxRulesSection.saveProdNewTaxClass}}"/> - </actionGroup> - - <actionGroup name="addNewTaxRuleActionGroup"> - <annotations> - <description>Goes to the Admin Tax Rules grid page. Clicks on the Add New Tax Rule button.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AddNewTaxRuleActionGroup` instead --> - <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRulePage"/> - <waitForPageLoad stepKey="waitForTaxRatePage"/> - <click stepKey="addNewTaxRate" selector="{{AdminGridMainControls.add}}"/> - </actionGroup> - - <actionGroup name="deleteProductTaxClass"> - <annotations> - <description>Goes to the Admin Tax Rule creation page. Deletes the provided Tax Class.</description> - </annotations> - <arguments> - <argument name="taxClassName" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `DeleteProductTaxClassActionGroup` instead --> - <amOnPage url="{{AdminNewTaxRulePage.url}}" stepKey="goToNewTaxRulePage"/> - <waitForPageLoad stepKey="waitForTaxRatePage"/> - <click stepKey="clickAdditionalSettings" selector="{{AdminTaxRulesSection.additionalSettings}}"/> - <scrollTo stepKey="scrollToAdditionalSettings" selector="{{AdminTaxRulesSection.additionalSettings}}"/> - <moveMouseOver stepKey="hoverDeleteElement" selector="{{AdminTaxRulesSection.deleteTaxClassName(taxClassName)}}"/> - <click stepKey="deleteFirstTaxClass" selector="{{AdminTaxRulesSection.deleteTaxClass(taxClassName)}}"/> - <waitForElementVisible selector="{{AdminTaxRulesSection.popUpDialogOK}}" stepKey="waitForElementBecomeVisible"/> - <click stepKey="acceptPopUpDialog" selector="{{AdminTaxRulesSection.popUpDialogOK}}"/> - <waitForPageLoad stepKey="waitForProductTaxClassDeleted"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Ui/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Ui/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml deleted file mode 100644 index 48d6b90ddb8dc..0000000000000 --- a/app/code/Magento/Ui/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml +++ /dev/null @@ -1,98 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<!-- -NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. - Please find the Comment with proper replacement for each of ActionGroups provided. ---> -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="searchAdminDataGridByKeyword"> - <annotations> - <description>Fills 'Search by keyword' on an Admin Grid page. Clicks on Submit Search.</description> - </annotations> - <arguments> - <argument name="keyword"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `SearchAdminDataGridByKeywordActionGroup` instead --> - <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> - <fillField selector="{{AdminDataGridHeaderSection.search}}" userInput="{{keyword}}" stepKey="fillKeywordSearchField"/> - <click selector="{{AdminDataGridHeaderSection.submitSearch}}" stepKey="clickKeywordSearch"/> - </actionGroup> - - <actionGroup name="resetAdminDataGridToDefaultView"> - <annotations> - <description>Resets an Admin Grid page to the 'Default View'.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `ResetAdminDataGridToDefaultViewActionGroup` instead --> - <click selector="{{AdminDataGridHeaderSection.bookmarkToggle}}" stepKey="openViewBookmarks"/> - <click selector="{{AdminDataGridHeaderSection.bookmarkOption('Default View')}}" stepKey="selectDefaultGridView"/> - <see selector="{{AdminDataGridHeaderSection.bookmarkToggle}}" userInput="Default View" stepKey="seeDefaultViewSelected"/> - </actionGroup> - - <actionGroup name="clearFiltersAdminDataGrid"> - <annotations> - <description>Clicks on 'Clear Filters' on an Admin Grid page.</description> - </annotations> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `ClearFiltersAdminDataGridActionGroup` instead --> - <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingOrderFilters"/> - </actionGroup> - - <actionGroup name="adminDataGridSelectPerPage"> - <annotations> - <description>Sets the provided preset 'per page' display setting on an Admin Grid page.</description> - </annotations> - <arguments> - <argument name="perPage" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminDataGridSelectPerPageActionGroup` instead --> - <click selector="{{AdminDataGridPaginationSection.perPageDropdown}}" stepKey="clickPerPageDropdown"/> - <click selector="{{AdminDataGridPaginationSection.perPageOption(perPage)}}" stepKey="selectCustomPerPage"/> - <waitForPageLoad stepKey="waitForGridLoad"/> - </actionGroup> - - <actionGroup name="adminDataGridSelectCustomPerPage"> - <annotations> - <description>Sets the provided custom 'per page' display setting on an Admin Grid page.</description> - </annotations> - <arguments> - <argument name="perPage"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminDataGridSelectCustomPerPageActionGroup` instead --> - <click selector="{{AdminDataGridPaginationSection.perPageDropdown}}" stepKey="clickPerPageDropdown"/> - <click selector="{{AdminDataGridPaginationSection.perPageOption('Custom')}}" stepKey="selectCustomPerPage"/> - <waitForElementVisible selector="{{AdminDataGridPaginationSection.perPageInput}}" time="30" stepKey="waitForInputVisible"/> - <fillField selector="{{AdminDataGridPaginationSection.perPageInput}}" userInput="{{perPage}}" stepKey="fillCustomPerPage"/> - <click selector="{{AdminDataGridPaginationSection.perPageApplyInput}}" stepKey="applyCustomPerPage"/> - <waitForLoadingMaskToDisappear stepKey="waitForGridLoad"/> - <seeInField selector="{{AdminDataGridPaginationSection.perPageDropDownValue}}" userInput="{{perPage}}" stepKey="seePerPageValueInDropDown"/> - </actionGroup> - - <actionGroup name="adminDataGridDeleteCustomPerPage"> - <annotations> - <description>Sets the provided custom 'per page' display setting on an Admin Grid page. Deletes the Items listed in a grid. Validates that the 'per page' count in NOT present.</description> - </annotations> - <arguments> - <argument name="perPage"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminDataGridDeleteCustomPerPageActionGroup` instead --> - <click selector="{{AdminDataGridPaginationSection.perPageDropdown}}" stepKey="clickPerPageDropdown1"/> - <click selector="{{AdminDataGridPaginationSection.perPageEditCustomValue(perPage)}}" stepKey="clickToEditCustomPerPage"/> - <waitForElementVisible selector="{{AdminDataGridPaginationSection.perPageDeleteCustomValue(perPage)}}" time="30" stepKey="waitForDeleteButtonVisible"/> - <click selector="{{AdminDataGridPaginationSection.perPageDeleteCustomValue(perPage)}}" stepKey="clickToDeleteCustomPerPage"/> - <waitForLoadingMaskToDisappear stepKey="waitForGridLoad"/> - <click selector="{{AdminDataGridPaginationSection.perPageDropdown}}" stepKey="clickPerPageDropdown"/> - <dontSeeElement selector="{{AdminDataGridPaginationSection.perPageDropDownItem(perPage)}}" stepKey="dontSeeDropDownItem"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml deleted file mode 100644 index c990db8cc3cf8..0000000000000 --- a/app/code/Magento/UrlRewrite/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml +++ /dev/null @@ -1,296 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<!-- -NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. - Please find the Comment with proper replacement for each of ActionGroups provided. ---> -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AdminAddUrlRewrite"> - <annotations> - <description>Goes to the Admin Add URL Rewrite edit page. Fills in the provided URL details. Clicks on Save. Validates that the Success Message is present.</description> - </annotations> - <arguments> - <argument name="category" type="string"/> - <argument name="customUrlRewriteValue" type="string"/> - <argument name="storeValue" type="string"/> - <argument name="requestPath" type="string"/> - <argument name="redirectTypeValue" type="string"/> - <argument name="description" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminAddUrlRewriteActionGroup` instead --> - <amOnPage url="{{AdminUrlRewriteEditPage.url}}" stepKey="openUrlRewriteEditPage"/> - <waitForElementVisible selector="{{AdminUrlRewriteEditSection.createCustomUrlRewrite}}" stepKey="waitForCreateUrlRewriteVisible"/> - <selectOption selector="{{AdminUrlRewriteEditSection.createCustomUrlRewrite}}" userInput="{{customUrlRewriteValue}}" stepKey="selectUrlRewriteTypeOption"/> - <waitForElementVisible selector="{{AdminUrlRewriteEditSection.categoryInTree(category)}}" stepKey="waitForCategoryInTreeVisible"/> - <click selector="{{AdminUrlRewriteEditSection.categoryInTree(category)}}" stepKey="clickOnCategoryInTree"/> - <waitForElementVisible selector="{{AdminUrlRewriteEditSection.store}}" stepKey="waitForStoreSelectVisible"/> - <selectOption selector="{{AdminUrlRewriteEditSection.store}}" userInput="{{storeValue}}" stepKey="selectStoreOption"/> - <fillField selector="{{AdminUrlRewriteEditSection.requestPath}}" userInput="{{requestPath}}" stepKey="fillRequestPathField"/> - <selectOption selector="{{AdminUrlRewriteEditSection.redirectType}}" userInput="{{redirectTypeValue}}" stepKey="selectRedirectType"/> - <fillField selector="{{AdminUrlRewriteEditSection.description}}" userInput="{{description}}" stepKey="fillDescriptionField"/> - <click selector="{{AdminMainActionsSection.save}}" stepKey="clickSaveButton"/> - <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForSuccessMessage"/> - <see selector="{{AdminMessagesSection.success}}" userInput="The URL Rewrite has been saved." stepKey="seeSuccessMessage"/> - </actionGroup> - - <actionGroup name="AdminAddUrlRewriteForProduct"> - <annotations> - <description>Adds the provided URL Rewrite details for a Product.</description> - </annotations> - <arguments> - <argument name="storeValue" type="string"/> - <argument name="requestPath" type="string"/> - <argument name="redirectTypeValue" type="string"/> - <argument name="description" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminAddUrlRewriteForProductActionGroup` instead --> - <waitForElementVisible selector="{{AdminUrlRewriteProductSection.skipCategoryButton}}" stepKey="waitForSkipCategoryButton"/> - <click selector="{{AdminUrlRewriteProductSection.skipCategoryButton}}" stepKey="clickOnSkipCategoryButton"/> - <waitForPageLoad stepKey="waitForProductPageToLoad"/> - <click selector="{{AdminUrlRewriteEditSection.store}}" stepKey="clickOnStore"/> - <click selector="{{AdminUrlRewriteEditSection.storeValue('storeValue')}}" stepKey="clickOnStoreValue"/> - <fillField selector="{{AdminUrlRewriteEditSection.requestPath}}" userInput="{{requestPath}}" stepKey="fillRequestPath"/> - <click selector="{{AdminUrlRewriteEditSection.redirectType}}" stepKey="selectRedirectType"/> - <click selector="{{AdminUrlRewriteEditSection.redirectTypeValue('redirectTypeValue')}}" stepKey="clickOnRedirectTypeValue"/> - <fillField selector="{{AdminUrlRewriteEditSection.description}}" userInput="{{description}}" stepKey="fillDescription"/> - <click selector="{{AdminUrlRewriteEditSection.saveButton}}" stepKey="clickOnSaveButton"/> - <seeElement selector="{{AdminUrlRewriteIndexSection.successMessage}}" stepKey="seeSuccessSaveMessage"/> - </actionGroup> - - <actionGroup name="AdminAddCustomUrlRewrite"> - <annotations> - <description>Goes to the Admin URL Rewrite edit page. Adds the provided Custom URL Rewrite details. Clicks on Save. Validates that the Success Message is present.</description> - </annotations> - <arguments> - <argument name="customUrlRewriteValue" type="string"/> - <argument name="storeValue" type="string"/> - <argument name="requestPath" type="string"/> - <argument name="targetPath" type="string"/> - <argument name="redirectTypeValue" type="string"/> - <argument name="description" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminAddCustomUrlRewriteActionGroup` instead --> - <amOnPage url="{{AdminUrlRewriteEditPage.url}}" stepKey="openUrlRewriteEditPage"/> - <waitForPageLoad stepKey="waitForUrlRewriteEditPageToLoad" after="openUrlRewriteEditPage"/> - <click selector="{{AdminUrlRewriteEditSection.createCustomUrlRewrite}}" stepKey="clickOnCustonUrlRewrite"/> - <click selector="{{AdminUrlRewriteEditSection.createCustomUrlRewriteValue('customUrlRewriteValue')}}" stepKey="selectCustom"/> - <click selector="{{AdminUrlRewriteEditSection.store}}" stepKey="clickOnStore"/> - <click selector="{{AdminUrlRewriteEditSection.storeValue('storeValue')}}" stepKey="clickOnStoreValue"/> - <fillField selector="{{AdminUrlRewriteEditSection.requestPath}}" userInput="{{requestPath}}" stepKey="fillRequestPath"/> - <fillField selector="{{AdminUrlRewriteEditSection.targetPath}}" userInput="{{targetPath}}" stepKey="fillTargetPath"/> - <click selector="{{AdminUrlRewriteEditSection.redirectType}}" stepKey="selectRedirectType"/> - <click selector="{{AdminUrlRewriteEditSection.redirectTypeValue('redirectTypeValue')}}" stepKey="selectRedirectTypeValue"/> - <fillField selector="{{AdminUrlRewriteEditSection.description}}" userInput="{{description}}" stepKey="fillDescription"/> - <click selector="{{AdminUrlRewriteEditSection.saveButton}}" stepKey="clickOnSaveButton"/> - <seeElement selector="{{AdminUrlRewriteIndexSection.successMessage}}" stepKey="seeSuccessSaveMessage"/> - </actionGroup> - - <actionGroup name="AdminUpdateUrlRewrite"> - <annotations> - <description>Updates the URL Rewrite fields with the provided details.</description> - </annotations> - <arguments> - <argument name="storeValue" type="string"/> - <argument name="requestPath" type="string"/> - <argument name="redirectTypeValue" type="string"/> - <argument name="description" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminUpdateUrlRewriteActionGroup` instead --> - <click selector="{{AdminUrlRewriteEditSection.store}}" stepKey="clickOnStore"/> - <click selector="{{AdminUrlRewriteEditSection.storeValue(storeValue)}}" stepKey="clickOnStoreValue"/> - <fillField selector="{{AdminUrlRewriteEditSection.requestPath}}" userInput="{{requestPath}}" stepKey="fillRequestPath"/> - <click selector="{{AdminUrlRewriteEditSection.redirectType}}" stepKey="selectRedirectType"/> - <click selector="{{AdminUrlRewriteEditSection.redirectTypeValue(redirectTypeValue)}}" stepKey="selectRedirectTypeValue"/> - <fillField selector="{{AdminUrlRewriteEditSection.description}}" userInput="{{description}}" stepKey="fillDescription"/> - <click selector="{{AdminUrlRewriteEditSection.saveButton}}" stepKey="clickOnSaveButton"/> - <seeElement selector="{{AdminUrlRewriteIndexSection.successMessage}}" stepKey="seeSuccessSaveMessage"/> - </actionGroup> - - <actionGroup name="AdminUpdateCustomUrlRewrite"> - <annotations> - <description>Updates the Custom URL Rewrite fields with the provided details.</description> - </annotations> - <arguments> - <argument name="storeValue" type="string"/> - <argument name="requestPath" type="string"/> - <argument name="targetPath" type="string"/> - <argument name="redirectTypeValue" type="string"/> - <argument name="description" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminUpdateCustomUrlRewriteActionGroup` instead --> - <click selector="{{AdminUrlRewriteEditSection.store}}" stepKey="clickOnStore"/> - <click selector="{{AdminUrlRewriteEditSection.storeValue('storeValue')}}" stepKey="clickOnStoreValue"/> - <fillField selector="{{AdminUrlRewriteEditSection.requestPath}}" userInput="{{requestPath}}" stepKey="fillRequestPath"/> - <fillField selector="{{AdminUrlRewriteEditSection.targetPath}}" userInput="{{targetPath}}" stepKey="fillTargetPath"/> - <selectOption selector="{{AdminUrlRewriteEditSection.redirectType}}" userInput="{{redirectTypeValue}}" stepKey="selectRedirectTypeValue"/> - <fillField selector="{{AdminUrlRewriteEditSection.description}}" userInput="{{description}}" stepKey="fillDescription"/> - <click selector="{{AdminUrlRewriteEditSection.saveButton}}" stepKey="clickOnSaveButton"/> - <seeElement selector="{{AdminUrlRewriteIndexSection.successMessage}}" stepKey="seeSuccessSaveMessage"/> - </actionGroup> - <actionGroup name="AdminSearchByRequestPath"> - <annotations> - <description>Goes to the Admin URL Rewrite grid page. Searches the grid based on the provided Redirect Path. Validates that the provided Redirect Path, Type and Target Path are present and correct in the grid.</description> - </annotations> - <arguments> - <argument name="redirectPath" type="string"/> - <argument name="redirectType" type="string"/> - <argument name="targetPath" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminSearchByRequestPathActionGroup` instead --> - <amOnPage url="{{AdminUrlRewriteIndexPage.url}}" stepKey="openUrlRewriteEditPage"/> - <waitForPageLoad stepKey="waitForUrlRewriteEditPageToLoad"/> - <click selector="{{AdminUrlRewriteIndexSection.resetButton}}" stepKey="clickOnResetButton"/> - <waitForPageLoad stepKey="waitForPageToLoad"/> - <fillField selector="{{AdminUrlRewriteIndexSection.requestPathFilter}}" userInput="{{redirectPath}}" stepKey="fillRedirectPathFilter"/> - <click selector="{{AdminUrlRewriteIndexSection.searchButton}}" stepKey="clickOnSearchButton"/> - <waitForPageLoad stepKey="waitForPageToLoad1"/> - <see selector="{{AdminUrlRewriteIndexSection.requestPathColumn('1')}}" userInput="{{redirectPath}}" stepKey="seeTheRedirectPathForOldUrl"/> - <see selector="{{AdminUrlRewriteIndexSection.targetPathColumn('1')}}" userInput="{{targetPath}}" stepKey="seeTheTargetPath"/> - <see selector="{{AdminUrlRewriteIndexSection.redirectTypeColumn('1')}}" userInput="{{redirectType}}" stepKey="seeTheRedirectTypeForOldUrl"/> - </actionGroup> - - <actionGroup name="AdminSearchUrlRewriteProductBySku"> - <annotations> - <description>Goes to the Admin URL Rewrite grid page. Searches the grid based on the provided Product SKU. Clicks on the 1st row in the grid.</description> - </annotations> - <arguments> - <argument name="productSku" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminSearchUrlRewriteProductBySkuActionGroup` instead --> - <amOnPage url="{{AdminUrlRewriteProductPage.url}}" stepKey="openUrlRewriteProductPage"/> - <waitForPageLoad stepKey="waitForUrlRewriteProductPageToLoad"/> - <click selector="{{AdminUrlRewriteProductSection.resetFilter}}" stepKey="clickOnResetFilter"/> - <waitForPageLoad stepKey="waitForPageToLoad"/> - <fillField selector="{{AdminUrlRewriteProductSection.skuFilter}}" userInput="{{productSku}}" stepKey="fillProductSkuFilter"/> - <click selector="{{AdminUrlRewriteProductSection.searchFilter}}" stepKey="clickOnSearchFilter"/> - <waitForPageLoad stepKey="waitForProductToLoad"/> - <click selector="{{AdminUrlRewriteProductSection.productRow}}" stepKey="clickOnFirstRow"/> - <waitForPageLoad stepKey="waitForProductCategoryPageToLoad"/> - </actionGroup> - - <actionGroup name="AdminSearchDeletedUrlRewrite"> - <annotations> - <description>Goes to the Admin URL Rewrite grid page. Searches the grid for the provided Request Path. Validates that it does NOT appear in the grid.</description> - </annotations> - <arguments> - <argument name="requestPath" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminSearchDeletedUrlRewriteActionGroup` instead --> - <amOnPage url="{{AdminUrlRewriteIndexPage.url}}" stepKey="openUrlRewriteEditPage"/> - <waitForPageLoad stepKey="waitForUrlRewriteEditPageToLoad"/> - <click selector="{{AdminUrlRewriteIndexSection.resetButton}}" stepKey="clickOnResetButton"/> - <waitForPageLoad stepKey="waitForPageToLoad"/> - <fillField selector="{{AdminUrlRewriteIndexSection.requestPathFilter}}" userInput="{{requestPath}}" stepKey="fillRedirectPathFilter"/> - <click selector="{{AdminUrlRewriteIndexSection.searchButton}}" stepKey="clickOnSearchButton"/> - <waitForPageLoad stepKey="waitForPageToLoad1"/> - <see selector="{{AdminUrlRewriteIndexSection.emptyRecords}}" userInput="We couldn't find any records." stepKey="seeEmptyRecordMessage"/> - </actionGroup> - - <actionGroup name="AdminDeleteUrlRewrite"> - <annotations> - <description>Goes to the Admin URL Rewrite grid page. Deletes the provided Request Path. Validates that the Success Message is present and correct.</description> - </annotations> - <arguments> - <argument name="requestPath" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminDeleteUrlRewriteActionGroup` instead --> - <amOnPage url="{{AdminUrlRewriteIndexPage.url}}" stepKey="openUrlRewriteEditPage"/> - <waitForPageLoad stepKey="waitForUrlRewriteEditPageToLoad"/> - <click selector="{{AdminUrlRewriteIndexSection.resetButton}}" stepKey="clickOnResetButton"/> - <waitForPageLoad stepKey="waitForPageToLoad"/> - <fillField selector="{{AdminUrlRewriteIndexSection.requestPathFilter}}" userInput="{{requestPath}}" stepKey="fillRedirectPathFilter"/> - <click selector="{{AdminUrlRewriteIndexSection.searchButton}}" stepKey="clickOnSearchButton"/> - <waitForPageLoad stepKey="waitForPageToLoad1"/> - <click selector="{{AdminUrlRewriteIndexSection.editButton('1')}}" stepKey="clickOnEditButton"/> - <waitForPageLoad stepKey="waitForEditPageToLoad"/> - <click selector="{{AdminUrlRewriteEditSection.deleteButton}}" stepKey="clickOnDeleteButton"/> - <waitForPageLoad stepKey="waitForPageToLoad2"/> - <waitForElementVisible selector="{{AdminUrlRewriteEditSection.okButton}}" stepKey="waitForOkButtonToVisible"/> - <click selector="{{AdminUrlRewriteEditSection.okButton}}" stepKey="clickOnOkButton"/> - <waitForPageLoad stepKey="waitForPageToLoad3"/> - <see selector="{{AdminUrlRewriteIndexSection.successMessage}}" userInput="You deleted the URL rewrite." stepKey="seeSuccessMessage"/> - </actionGroup> - - <actionGroup name="AssertPageByUrlRewriteIsNotFound"> - <annotations> - <description>Validates that the provided Request Path does NOT exist on the Storefront. Validates that the 'Whoops' message is present and correct.</description> - </annotations> - <arguments> - <argument name="requestPath" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertPageByUrlRewriteIsNotFoundActionGroup` instead --> - <amOnPage url="{{requestPath}}" stepKey="amOnPage"/> - <waitForPageLoad stepKey="waitForStorefrontPageLoad"/> - <see userInput="Whoops, our bad..." stepKey="seeWhoops"/> - </actionGroup> - - <actionGroup name="AdminSearchAndSelectUrlRewriteInGrid"> - <annotations> - <description>Goes to the Admin URL Rewrite grid page. Searches the grid for the provided Request Path. Clicks on Edit.</description> - </annotations> - <arguments> - <argument name="requestPath" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminSearchAndSelectUrlRewriteInGridActionGroup` instead --> - <amOnPage url="{{AdminUrlRewriteIndexPage.url}}" stepKey="openUrlRewriteEditPage"/> - <waitForPageLoad stepKey="waitForUrlRewriteEditPageToLoad"/> - <click selector="{{AdminUrlRewriteIndexSection.resetButton}}" stepKey="clickOnResetButton"/> - <waitForPageLoad stepKey="waitForPageToLoad"/> - <fillField selector="{{AdminUrlRewriteIndexSection.requestPathFilter}}" userInput="{{requestPath}}" stepKey="fillRedirectPathFilter"/> - <click selector="{{AdminUrlRewriteIndexSection.searchButton}}" stepKey="clickOnSearchButton"/> - <waitForPageLoad stepKey="waitForPageToLoad1"/> - <click selector="{{AdminUrlRewriteIndexSection.editButton('1')}}" stepKey="clickOnEditButton"/> - <waitForPageLoad stepKey="waitForEditPageToLoad"/> - </actionGroup> - - <actionGroup name="AssertStorefrontUrlRewriteRedirect"> - <annotations> - <description>Goes to the provided New URL. Validates that the redirect works and the provided Category is present.</description> - </annotations> - <arguments> - <argument name="category" type="string"/> - <argument name="newRequestPath" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertStorefrontUrlRewriteRedirectActionGroup` instead --> - <amOnPage url="{{newRequestPath}}" stepKey="openCategoryInStorefront"/> - <waitForPageLoad stepKey="waitForCategoryPageToLoad"/> - <seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(category)}}" stepKey="seeCategoryOnStoreNavigationBar"/> - <seeElement selector="{{StorefrontCategoryMainSection.CategoryTitle(category)}}" stepKey="seeCategoryInTitle"/> - </actionGroup> - - <actionGroup name="AssertStorefrontProductRedirect"> - <annotations> - <description>Goes to the provided New Product URL. Validates that the redirect works and the provided Product is present and correct.</description> - </annotations> - <arguments> - <argument name="productName" type="string"/> - <argument name="productSku" type="string"/> - <argument name="productRequestPath" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AssertStorefrontProductRedirectActionGroup` instead --> - <amOnPage url="{{productRequestPath}}" stepKey="openCategoryInStorefront"/> - <waitForPageLoad stepKey="waitForCategoryPageToLoad"/> - <see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{productName}}" stepKey="seeProductNameInStoreFrontPage"/> - <see selector="{{StorefrontProductInfoMainSection.productSku}}" userInput="{{productSku}}" stepKey="seeProductSkuInStoreFrontPage"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/User/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/User/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml deleted file mode 100644 index 0230f5b1c8e3e..0000000000000 --- a/app/code/Magento/User/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml +++ /dev/null @@ -1,69 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<!-- -NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. - Please find the Comment with proper replacement for each of ActionGroups provided. ---> -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - - - <actionGroup name="AdminAddNewUserRoleWithCustomRoleScopes" extends="AdminAddNewUserRoleActionGroup"> - <arguments> - <argument name="customWebsiteName" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminAddNewUserRoleWithCustomRoleScopesActionGroup` instead --> - <checkOption selector="{{AdminCreateRoleSection.selectWebsite(customWebsiteName)}}" stepKey="checkWebsite" after="selectRoleResources"/> - </actionGroup> - <actionGroup name="AdminFillUserRoleRequiredData" extends="AdminCreateRoleActionGroup"> - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminFillUserRoleRequiredDataActionGroup` instead --> - <remove keyForRemoval="clickRoleResourcesTab"/> - <remove keyForRemoval="waitForScopeSelection"/> - <remove keyForRemoval="selectResourceAccessCustom"/> - <remove keyForRemoval="waitForElementVisible"/> - <remove keyForRemoval="clickContentBlockCheckbox"/> - <remove keyForRemoval="clickSaveRoleButton"/> - <remove keyForRemoval="waitForPageLoad2"/> - </actionGroup> - <actionGroup name="AdminAddRestrictedRole" extends="AdminCreateRoleActionGroup"> - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminAddRestrictedRoleActionGroup` instead --> - <remove keyForRemoval="navigateToNewRole"/> - <remove keyForRemoval="waitForPageLoad1"/> - <remove keyForRemoval="fillRoleName"/> - <remove keyForRemoval="enterPassword"/> - <remove keyForRemoval="clickRoleResourcesTab"/> - <remove keyForRemoval="waitForScopeSelection"/> - <remove keyForRemoval="clickSaveRoleButton"/> - <remove keyForRemoval="waitForPageLoad2"/> - <scrollTo selector="{{AdminEditRoleInfoSection.blockName('restrictedRole')}}" x="0" y="-100" stepKey="scrollToResourceElement" after="selectResourceAccessCustom"/> - </actionGroup> - <actionGroup name="AdminCreateRole"> - <annotations> - <description>Clicks on 'Add New Role'. Fills in the provided details (Role, Resource, Scope and Websites). Clicks on Save. Validates that the Success Message is present and correct.</description> - </annotations> - <arguments> - <argument name="role" type="string" defaultValue=""/> - <argument name="resource" type="string" defaultValue="All"/> - <argument name="scope" type="string" defaultValue="Custom"/> - <argument name="websites" type="string" defaultValue="Main Website"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `AdminCreateRoleActionGroup` instead --> - <click selector="{{AdminCreateRoleSection.create}}" stepKey="clickToAddNewRole"/> - <fillField selector="{{AdminCreateRoleSection.name}}" userInput="{{role.name}}" stepKey="setRoleName"/> - <fillField stepKey="setPassword" selector="{{AdminCreateRoleSection.password}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}"/> - <click selector="{{AdminCreateRoleSection.roleResources}}" stepKey="clickToOpenRoleResources"/> - <waitForPageLoad stepKey="waitForRoleResourcePage" time="5"/> - <click stepKey="checkSales" selector="//a[text()='Sales']"/> - <click selector="{{AdminCreateRoleSection.save}}" stepKey="clickToSaveRole"/> - <waitForPageLoad stepKey="waitForPageLoad" time="10"/> - <see userInput="You saved the role." stepKey="seeSuccessMessage"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml deleted file mode 100644 index ca17b0275ed5b..0000000000000 --- a/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml +++ /dev/null @@ -1,99 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<!-- -NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. - Please find the Comment with proper replacement for each of ActionGroups provided. ---> -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - - <actionGroup name="StorefrontCustomerCheckProductInWishlist"> - <annotations> - <description>Validates that the provided Product details (Price and Name) are present in the Storefront Customer Dashboard Wish List.</description> - </annotations> - <arguments> - <argument name="productVar"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontCustomerCheckProductInWishlistActionGroup` instead --> - <waitForElement selector="{{StorefrontCustomerWishlistProductSection.ProductTitleByName(productVar.name)}}" time="30" stepKey="assertWishlistProductName"/> - <see userInput="${{productVar.price}}.00" selector="{{StorefrontCustomerWishlistProductSection.ProductPriceByName(productVar.name)}}" stepKey="AssertWishlistProductPrice"/> - <moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.ProductInfoByName(productVar.name)}}" stepKey="wishlistMoveMouseOverProduct"/> - <seeElement selector="{{StorefrontCustomerWishlistProductSection.ProductAddToCartByName(productVar.name)}}" stepKey="AssertWishlistAddToCart"/> - <seeElement selector="{{StorefrontCustomerWishlistProductSection.ProductImageByName(productVar.name)}}" stepKey="AssertWishlistProductImage"/> - </actionGroup> - - <actionGroup name="StorefrontCustomerCheckProductInWishlistSidebar"> - <annotations> - <description>Validates that the provided Product details (Name) are present in the Wish List side bar menu.</description> - </annotations> - <arguments> - <argument name="productVar"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontCustomerCheckProductInWishlistSidebarActionGroup` instead --> - <waitForElement selector="{{StorefrontCustomerWishlistSidebarSection.ProductTitleByName(productVar.name)}}" time="30" stepKey="assertWishlistSidebarProductName"/> - <see userInput="${{productVar.price}}.00" selector="{{StorefrontCustomerWishlistSidebarSection.ProductPriceByName(productVar.name)}}" stepKey="AssertWishlistSidebarProductPrice"/> - <seeElement selector="{{StorefrontCustomerWishlistSidebarSection.ProductAddToCartByName(productVar.name)}}" stepKey="AssertWishlistSidebarAddToCart"/> - <seeElement selector="{{StorefrontCustomerWishlistSidebarSection.ProductImageByName(productVar.name)}}" stepKey="AssertWishlistSidebarProductImage"/> - </actionGroup> - - <actionGroup name="StorefrontCustomerRemoveProductFromWishlistUsingSidebar"> - <annotations> - <description>Removes the provided Product from the Wish List side bar menu. Validates that the Success Message is present and correct.</description> - </annotations> - <arguments> - <argument name="product"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontCustomerRemoveProductFromWishlistUsingSidebarActionGroup` instead --> - <click selector="{{StorefrontCustomerWishlistSidebarSection.ProductRemoveByName(product.name)}}" stepKey="RemoveProductFromWishlistUsingSidebarClickRemoveItemFromWishlist"/> - <waitForElement selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="RemoveProductFromWishlistUsingSidebarWaitForSuccessMessage"/> - <see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="{{product.name}} has been removed from your Wish List." stepKey="RemoveProductFromWishlistUsingSidebarSeeProductNameRemovedFromWishlist"/> - </actionGroup> - - <actionGroup name="StorefrontCustomerAddProductToCartFromWishlistUsingSidebar"> - <annotations> - <description>Add the provided Product to the Cart from the Wish List side bar menu. Validates that the Success Message is present and correct.</description> - </annotations> - <arguments> - <argument name="product"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontCustomerAddProductToCartFromWishlistUsingSidebarActionGroup` instead --> - <click selector="{{StorefrontCustomerWishlistSidebarSection.ProductAddToCartByName(product.name)}}" stepKey="AddProductToCartFromWishlistUsingSidebarClickAddToCartFromWishlist"/> - <waitForElement selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="AddProductToCartFromWishlistUsingSidebarWaitForSuccessMessage"/> - <see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="You added {{product.name}} to your shopping cart." stepKey="AddProductToCartFromWishlistUsingSidebarSeeProductNameAddedToCartFromWishlist"/> - </actionGroup> - - <actionGroup name="StorefrontCustomerEditProductInWishlist"> - <annotations> - <description>Edits the provided Product on the Storefront Wish List page. Fills in the provided Description and Quantity. Validates that the Success Message is present and correct.</description> - </annotations> - <arguments> - <argument name="product"/> - <argument name="description" type="string"/> - <argument name="quantity" type="string"/> - </arguments> - - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontCustomerEditProductInWishlistActionGroup` instead --> - <moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.ProductInfoByName(product.name)}}" stepKey="mouseOverOnProduct"/> - <fillField selector="{{StorefrontCustomerWishlistProductSection.ProductDescription(product.name)}}" userInput="{{description}}" stepKey="fillDescription"/> - <fillField selector="{{StorefrontCustomerWishlistProductSection.ProductQuantity(product.name)}}" userInput="{{quantity}}" stepKey="fillQuantity"/> - <moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.ProductAddAllToCart}}" stepKey="mouseOver"/> - <click selector="{{StorefrontCustomerWishlistProductSection.ProductUpdateWishList}}" stepKey="submitUpdateWishlist"/> - <see selector="{{StorefrontCustomerWishlistProductSection.ProductSuccessUpdateMessage}}" userInput="{{product.name}} has been updated in your Wish List." stepKey="successMessage"/> - </actionGroup> - - <actionGroup name="StorefrontAssertCustomerWishlistIsEmpty"> - <!-- NOTICE: This ActionGroup is DEPRECATED! Use `StorefrontAssertCustomerWishlistIsEmptyActionGroup` instead --> - <dontSeeElement selector="{{StorefrontCustomerWishlistProductSection.pager}}" stepKey="checkThatPagerIsAbsent"/> - <see selector="{{StorefrontCustomerWishlistProductSection.wishlistEmpty}}" userInput="You have no items in your wish list." stepKey="checkNoItemsMessage"/> - </actionGroup> -</actionGroups> From 78bf9c21793fec6b3903e59cd1d36a720dfdac29 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Sat, 7 Dec 2019 08:56:32 +0700 Subject: [PATCH 0256/1143] Issue 25881: don't need override constant --- .../Magento/Backend/Controller/Adminhtml/Index/Denied.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Index/Denied.php b/app/code/Magento/Backend/Controller/Adminhtml/Index/Denied.php index e967a11fe204c..c1e4245dea063 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Index/Denied.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Index/Denied.php @@ -18,8 +18,5 @@ */ class Denied extends DeniedController implements HttpGetActionInterface { - /** - * Authorization level of a basic admin session - */ - const ADMIN_RESOURCE = 'Magento_Backend::admin'; + } From 30b5818dde145901eb0a7a0600ef65b9cd9a9cf3 Mon Sep 17 00:00:00 2001 From: lfolco <me@laurafolco.com> Date: Sat, 7 Dec 2019 15:56:25 -0500 Subject: [PATCH 0257/1143] Add plugin for SalesOrderItemRepository gift message (#19093) --- .../GiftMessage/Model/Plugin/OrderItemGet.php | 76 +++++++++++++++++++ app/code/Magento/GiftMessage/etc/di.xml | 3 + .../Api/OrderGetRepositoryTest.php | 56 ++++++++++++++ .../Api/OrderItemGetRepositoryTest.php | 69 +++++++++++++++++ 4 files changed, 204 insertions(+) create mode 100644 app/code/Magento/GiftMessage/Model/Plugin/OrderItemGet.php create mode 100644 dev/tests/api-functional/testsuite/Magento/GiftMessage/Api/OrderGetRepositoryTest.php create mode 100644 dev/tests/api-functional/testsuite/Magento/GiftMessage/Api/OrderItemGetRepositoryTest.php diff --git a/app/code/Magento/GiftMessage/Model/Plugin/OrderItemGet.php b/app/code/Magento/GiftMessage/Model/Plugin/OrderItemGet.php new file mode 100644 index 0000000000000..3de69da37eef8 --- /dev/null +++ b/app/code/Magento/GiftMessage/Model/Plugin/OrderItemGet.php @@ -0,0 +1,76 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\GiftMessage\Model\Plugin; + +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\GiftMessage\Api\OrderItemRepositoryInterface as GiftMessageItemRepositoryInterface; +use Magento\Sales\Api\Data\OrderItemExtensionFactory; +use Magento\Sales\Api\Data\OrderItemInterface; +use Magento\Sales\Api\OrderItemRepositoryInterface; + +/** + * Plugin for adding gift message to order item + */ +class OrderItemGet +{ + + /** + * @var OrderItemExtensionFactory + */ + private $orderItemExtensionFactory; + + /** + * @var GiftMessageItemRepositoryInterface + */ + private $giftMessageItemRepository; + + /** + * OrderItemGet constructor. + * + * @param GiftMessageItemRepositoryInterface $giftMessageItemRepository + * @param OrderItemExtensionFactory $orderItemExtensionFactory + */ + public function __construct( + GiftMessageItemRepositoryInterface $giftMessageItemRepository, + OrderItemExtensionFactory $orderItemExtensionFactory + ) { + $this->giftMessageItemRepository = $giftMessageItemRepository; + $this->orderItemExtensionFactory = $orderItemExtensionFactory; + } + + /** + * Add gift message for order item + * + * @param OrderItemRepositoryInterface $subject + * @param OrderItemInterface $orderItem + * @return OrderItemInterface + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function afterGet(OrderItemRepositoryInterface $subject, OrderItemInterface $orderItem) + { + $extensionAttributes = $orderItem->getExtensionAttributes(); + if ($extensionAttributes && $extensionAttributes->getGiftMessage()) { + return $orderItem; + } + try { + /* @var \Magento\GiftMessage\Api\Data\MessageInterface $giftMessage */ + $giftMessage = $this->giftMessageItemRepository->get( + $orderItem->getOrderId(), + $orderItem->getItemId() + ); + } catch (NoSuchEntityException $e) { + return $orderItem; + } + /** @var \Magento\Sales\Api\Data\OrderItemExtension $orderItemExtension */ + $orderItemExtension = $extensionAttributes ?: $this->orderItemExtensionFactory->create(); + $orderItemExtension->setGiftMessage($giftMessage); + $orderItem->setExtensionAttributes($orderItemExtension); + + return $orderItem; + } +} diff --git a/app/code/Magento/GiftMessage/etc/di.xml b/app/code/Magento/GiftMessage/etc/di.xml index 5333084c90b75..1b079f3c9fd55 100644 --- a/app/code/Magento/GiftMessage/etc/di.xml +++ b/app/code/Magento/GiftMessage/etc/di.xml @@ -37,4 +37,7 @@ </argument> </arguments> </type> + <type name="Magento\Sales\Api\OrderItemRepositoryInterface"> + <plugin name="get_gift_message" type="Magento\GiftMessage\Model\Plugin\OrderItemGet"/> + </type> </config> diff --git a/dev/tests/api-functional/testsuite/Magento/GiftMessage/Api/OrderGetRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/GiftMessage/Api/OrderGetRepositoryTest.php new file mode 100644 index 0000000000000..7ae7e200cfb5b --- /dev/null +++ b/dev/tests/api-functional/testsuite/Magento/GiftMessage/Api/OrderGetRepositoryTest.php @@ -0,0 +1,56 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\GiftMessage\Api; + +use Magento\TestFramework\TestCase\WebapiAbstract; + +class OrderGetRepositoryTest extends WebapiAbstract +{ + const SERVICE_VERSION = 'V1'; + + const SERVICE_NAME = 'giftMessageItemRepositoryV1'; + + const RESOURCE_PATH = '/V1/orders/'; + + /** + * @magentoDataFixture Magento/GiftMessage/_files/order_with_message.php + * @magentoConfigFixture default_store sales/gift_options/allow_order 1 + * @magentoAppIsolation enabled + * @magentoDbIsolation disabled + */ + public function testGet() + { + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + /** @var \Magento\Sales\Model\Order $order */ + $order = $objectManager->create(\Magento\Sales\Model\Order::class)->loadByIncrementId('100000001'); + $orderId = $order->getId(); + $serviceInfo = [ + 'rest' => [ + 'resourcePath' => self::RESOURCE_PATH . $orderId, + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET, + ], + 'soap' => [ + 'service' => self::SERVICE_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => self::SERVICE_NAME . 'Get', + ], + ]; + $expectedMessage = [ + 'recipient' => 'Mercutio', + 'sender' => 'Romeo', + 'message' => 'I thought all for the best.', + ]; + $requestData = ["orderId" => $orderId]; + $result = $this->_webApiCall($serviceInfo, $requestData); + $resultMessage = $result['extension_attributes']['gift_message']; + static::assertCount(5, $resultMessage); + unset($resultMessage['gift_message_id']); + unset($resultMessage['customer_id']); + static::assertEquals($expectedMessage, $resultMessage); + } +} diff --git a/dev/tests/api-functional/testsuite/Magento/GiftMessage/Api/OrderItemGetRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/GiftMessage/Api/OrderItemGetRepositoryTest.php new file mode 100644 index 0000000000000..f68b50b7746eb --- /dev/null +++ b/dev/tests/api-functional/testsuite/Magento/GiftMessage/Api/OrderItemGetRepositoryTest.php @@ -0,0 +1,69 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\GiftMessage\Api; + +use Magento\TestFramework\TestCase\WebapiAbstract; + +class OrderItemGetRepositoryTest extends WebapiAbstract +{ + + const SERVICE_VERSION = 'V1'; + + const SERVICE_NAME = 'giftMessageItemRepositoryV1'; + + const RESOURCE_PATH = '/V1/orders/items/'; + + /** + * @var \Magento\TestFramework\ObjectManager + */ + protected $objectManager; + + protected function setUp() + { + $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + } + + /** + * @magentoDataFixture Magento/GiftMessage/_files/order_with_message.php + * @magentoConfigFixture default_store sales/gift_options/allow_items 1 + * @magentoAppIsolation enabled + * @magentoDbIsolation disabled + */ + public function testGet() + { + /** @var \Magento\Sales\Model\Order $order */ + $order = $this->objectManager->create(\Magento\Sales\Model\Order::class)->loadByIncrementId('100000001'); + $items = $order->getItems(); + /** @var \Magento\Sales\Api\Data\OrderItemInterface $orderItem */ + $orderItem = array_shift($items); + $itemId = $orderItem->getItemId(); + $serviceInfo = [ + 'rest' => [ + 'resourcePath' => self::RESOURCE_PATH . $itemId, + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET, + ], + 'soap' => [ + 'service' => self::SERVICE_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => self::SERVICE_NAME . 'Get', + ], + ]; + $expectedMessage = [ + 'recipient' => 'Mercutio', + 'sender' => 'Romeo', + 'message' => 'I thought all for the best.', + ]; + $requestData = ["orderItemId" => $itemId]; + $result = $this->_webApiCall($serviceInfo, $requestData); + $resultMessage = $result['extension_attributes']['gift_message']; + static::assertCount(5, $resultMessage); + unset($resultMessage['gift_message_id']); + unset($resultMessage['customer_id']); + static::assertEquals($expectedMessage, $resultMessage); + } +} From 167e2ac04dcf3bcd6c9b7cf4aadb07ea67b1fd4a Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Sun, 8 Dec 2019 14:25:22 -0600 Subject: [PATCH 0258/1143] Change action groups name according to CE branch changes --- app/code/Magento/Bundle/Test/Mftf/Test/EndToEndB2CAdminTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/EndToEndB2CAdminTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/EndToEndB2CAdminTest.xml index 5f7a1827a6156..7e5db7643c2dd 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/EndToEndB2CAdminTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/EndToEndB2CAdminTest.xml @@ -31,7 +31,7 @@ <click selector="{{AdminAddProductsToOptionPanel.addSelectedProducts}}" stepKey="clickAddSelectedBundleProducts" after="selectFirstGridRow"/> <fillField selector="{{AdminProductFormBundleSection.firstProductQuantity}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty" after="clickAddSelectedBundleProducts"/> <actionGroup ref="SaveProductFormActionGroup" stepKey="saveBundleProduct" after="fillProductDefaultQty"/> - <actionGroup ref="viewBundleProductInAdminGrid" stepKey="viewBundleProductInGrid" after="saveBundleProduct"> + <actionGroup ref="ViewBundleProductInAdminGridActionGroup" stepKey="viewBundleProductInGrid" after="saveBundleProduct"> <argument name="product" value="BundleProduct"/> </actionGroup> From 850db28b947c495c9a320a449568319f478ed784 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Sun, 8 Dec 2019 22:24:05 +0100 Subject: [PATCH 0259/1143] Refactor: Add method hints to Tracking Status --- .../Shipping/Model/Tracking/Result/Status.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Shipping/Model/Tracking/Result/Status.php b/app/code/Magento/Shipping/Model/Tracking/Result/Status.php index cb24bd8ebb0e8..f3e4dcfe986f0 100644 --- a/app/code/Magento/Shipping/Model/Tracking/Result/Status.php +++ b/app/code/Magento/Shipping/Model/Tracking/Result/Status.php @@ -1,21 +1,25 @@ <?php +declare(strict_types=1); + /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Shipping\Model\Tracking\Result; /** - * Fields: - * - carrier: carrier code - * - carrierTitle: carrier title + * @method string getCarrier() + * @method Status setCarrier(string $carrierCode) + * @method string getCarrierTitle() + * @method Status setCarrierTitle(string $carrierTitle) */ -class Status extends \Magento\Shipping\Model\Tracking\Result\AbstractResult +class Status extends AbstractResult { /** * @return array */ - public function getAllData() + public function getAllData(): array { return $this->_data; } From ec9380ee1cbbf115534dba9a88ac1c1e87414cc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Sun, 8 Dec 2019 23:30:41 +0100 Subject: [PATCH 0260/1143] Refactor: Add method hints to Tracking Status --- app/code/Magento/Shipping/Model/Tracking/Result/Status.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/code/Magento/Shipping/Model/Tracking/Result/Status.php b/app/code/Magento/Shipping/Model/Tracking/Result/Status.php index f3e4dcfe986f0..04ff29139d926 100644 --- a/app/code/Magento/Shipping/Model/Tracking/Result/Status.php +++ b/app/code/Magento/Shipping/Model/Tracking/Result/Status.php @@ -9,6 +9,8 @@ namespace Magento\Shipping\Model\Tracking\Result; /** + * Tracking Status DataObject + * * @method string getCarrier() * @method Status setCarrier(string $carrierCode) * @method string getCarrierTitle() @@ -17,6 +19,8 @@ class Status extends AbstractResult { /** + * Returns all Status data + * * @return array */ public function getAllData(): array From aa3660e3f568dc791ce5df536bd47f4485a79120 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Sun, 8 Dec 2019 16:48:12 -0600 Subject: [PATCH 0261/1143] Change action groups name according to CE branch changes --- .../Mftf/Test/StorefrontCheckoutDisabledBundleProductTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutDisabledBundleProductTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutDisabledBundleProductTest.xml index 97eceae962bfb..f5cd6720c07ad 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutDisabledBundleProductTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutDisabledBundleProductTest.xml @@ -47,7 +47,7 @@ <deleteData createDataKey="createBundleDynamicProduct" stepKey="deleteBundleProduct"/> </after> <!-- Add simple product to the cart --> - <actionGroup ref="AddSimpleProductToCart" stepKey="cartAddSimpleProductToCart"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="cartAddSimpleProductToCart"> <argument name="product" value="$$createSimpleProduct$$"/> <argument name="productCount" value="1"/> </actionGroup> From ed040090be45363d7d7f98bc7674686b1a7194ed Mon Sep 17 00:00:00 2001 From: Dan Wallis <mrdanwallis@gmail.com> Date: Sun, 8 Dec 2019 22:55:26 +0000 Subject: [PATCH 0262/1143] Move invalidate action to its own ACL --- app/code/Magento/Indexer/Controller/Adminhtml/Indexer.php | 3 ++- app/code/Magento/Indexer/etc/acl.xml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer.php b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer.php index 5527c1b063e5e..b1b5264d5cce6 100644 --- a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer.php +++ b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer.php @@ -19,8 +19,9 @@ protected function _isAllowed() return $this->_authorization->isAllowed('Magento_Indexer::index'); case 'massOnTheFly': case 'massChangelog': - case 'massInvalidate': return $this->_authorization->isAllowed('Magento_Indexer::changeMode'); + case 'massInvalidate': + return $this->_authorization->isAllowed('Magento_Indexer::invalidate'); } return false; } diff --git a/app/code/Magento/Indexer/etc/acl.xml b/app/code/Magento/Indexer/etc/acl.xml index f49c672057a5e..520ab343bdab3 100644 --- a/app/code/Magento/Indexer/etc/acl.xml +++ b/app/code/Magento/Indexer/etc/acl.xml @@ -12,7 +12,8 @@ <resource id="Magento_Backend::system"> <resource id="Magento_Backend::tools"> <resource id="Magento_Indexer::index" title="Index Management" translate="title" sortOrder="30" /> - <resource id="Magento_Indexer::changeMode" title="Change indexer mode & invalidate index" translate="title" sortOrder="40" /> + <resource id="Magento_Indexer::changeMode" title="Change indexer mode" translate="title" sortOrder="40" /> + <resource id="Magento_Indexer::invalidate" title="Invalidate index" translate="title" sortOrder="50" /> </resource> </resource> </resource> From b6e58ad15f35924387cf92b9292bf91ea8ca0134 Mon Sep 17 00:00:00 2001 From: Dan Wallis <mrdanwallis@gmail.com> Date: Sun, 8 Dec 2019 22:57:40 +0000 Subject: [PATCH 0263/1143] Correct translation string --- app/code/Magento/Indexer/i18n/en_US.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Indexer/i18n/en_US.csv b/app/code/Magento/Indexer/i18n/en_US.csv index 7be25954a9012..8e27ce046ca0f 100644 --- a/app/code/Magento/Indexer/i18n/en_US.csv +++ b/app/code/Magento/Indexer/i18n/en_US.csv @@ -20,7 +20,7 @@ Never,Never "Field '%1' not found","Field '%1' not found" "Some Exception Message","Some Exception Message" "Test Phrase","Test Phrase" -"Change indexer mode & invalidate index","Change indexer mode & invalidate index" +"Change indexer mode","Change indexer mode" Indexer,Indexer Description,Description Mode,Mode From 2baf1ea4d195ca75d50555570a9a54f212014d03 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Sun, 8 Dec 2019 19:53:43 -0600 Subject: [PATCH 0264/1143] Change action groups name according to CE branch changes --- .../Mftf/Test/StorefrontCheckoutDisabledBundleProductTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutDisabledBundleProductTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutDisabledBundleProductTest.xml index f5cd6720c07ad..7405a3100728f 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutDisabledBundleProductTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutDisabledBundleProductTest.xml @@ -56,7 +56,7 @@ <waitForPageLoad stepKey="waitForPageLoad"/> <!-- Add bundle product to the cart --> <click selector="{{StorefrontBundleProductActionSection.customizeAndAddToCartButton}}" stepKey="clickCustomizeAndAddToCart"/> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProductToCart"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProductToCart"> <argument name="productName" value="$$createBundleDynamicProduct.name$$"/> </actionGroup> <!-- Login to admin panel --> From 927f9dc0eac20bd6f24a29a64083588ba080e7a5 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Sun, 8 Dec 2019 21:09:24 -0600 Subject: [PATCH 0265/1143] Change action groups name according to CE branch changes --- .../DeleteAllDuplicateProductUsingProductGridActionGroup.xml | 2 +- .../Test/Mftf/Test/NoErrorForMiniCartItemEditTest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteAllDuplicateProductUsingProductGridActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteAllDuplicateProductUsingProductGridActionGroup.xml index 8dabf2037bf39..8f057052d3e2c 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteAllDuplicateProductUsingProductGridActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteAllDuplicateProductUsingProductGridActionGroup.xml @@ -10,7 +10,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="DeleteAllDuplicateProductUsingProductGridActionGroup" extends="DeleteProductUsingProductGridActionGroup"> <annotations> - <description>EXTENDS: deleteProductUsingProductGrid. Removes 'seeProductSkuInGrid'.</description> + <description>EXTENDS: DeleteProductUsingProductGridActionGroup. Removes 'seeProductSkuInGrid'.</description> </annotations> <arguments> <argument name="product"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoErrorForMiniCartItemEditTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoErrorForMiniCartItemEditTest.xml index 2d0c4a05c1dec..85209595d620d 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoErrorForMiniCartItemEditTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoErrorForMiniCartItemEditTest.xml @@ -20,7 +20,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/> <createData entity="ApiCategory" stepKey="createCategory"/> <!-- Create Configurable product --> - <actionGroup ref="createConfigurableProduct" stepKey="createProduct"> + <actionGroup ref="CreateConfigurableProductActionGroup" stepKey="createProduct"> <argument name="product" value="_defaultProduct"/> <argument name="category" value="$$createCategory$$"/> </actionGroup> From dcfbbdf04a226cf4e8290e16109dcfbe142e2e4c Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Mon, 9 Dec 2019 00:27:18 -0600 Subject: [PATCH 0266/1143] Change action groups name according to CE branch changes --- .../Test/Mftf/ActionGroup/DeleteProductByNameActionGroup.xml | 2 +- .../Test/Mftf/Test/NoErrorForMiniCartItemEditTest.xml | 2 +- .../Sales/Test/Mftf/ActionGroup/OpenOrderByIdActionGroup.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductByNameActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductByNameActionGroup.xml index 0541a5ba67d30..3a4af44158497 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductByNameActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductByNameActionGroup.xml @@ -10,7 +10,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="DeleteProductByNameActionGroup" extends="DeleteProductBySkuActionGroup"> <annotations> - <description>EXTENDS: deleteProductBySku. Deletes the provided Product Name.</description> + <description>EXTENDS: DeleteProductBySkuActionGroup. Deletes the provided Product Name.</description> </annotations> <arguments> <argument name="sku" type="string" defaultValue=""/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoErrorForMiniCartItemEditTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoErrorForMiniCartItemEditTest.xml index 85209595d620d..42bad3e4bb8bf 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoErrorForMiniCartItemEditTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoErrorForMiniCartItemEditTest.xml @@ -28,7 +28,7 @@ <after> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <!-- Delete the first simple product --> - <actionGroup stepKey="deleteProduct1" ref="deleteProductBySku"> + <actionGroup stepKey="deleteProduct1" ref="DeleteProductBySkuActionGroup"> <argument name="sku" value="{{_defaultProduct.sku}}"/> </actionGroup> <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/OpenOrderByIdActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/OpenOrderByIdActionGroup.xml index ca05041140f47..16dacff3ecf81 100644 --- a/app/code/Magento/Sales/Test/Mftf/ActionGroup/OpenOrderByIdActionGroup.xml +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/OpenOrderByIdActionGroup.xml @@ -10,7 +10,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="OpenOrderByIdActionGroup" extends="FilterOrderGridByIdActionGroup"> <annotations> - <description>EXTENDS: filterOrderGridById. Clicks on the 1st row of the Admin Orders grid.</description> + <description>EXTENDS: FilterOrderGridByIdActionGroup. Clicks on the 1st row of the Admin Orders grid.</description> </annotations> <click selector="{{AdminDataGridTableSection.firstRow}}" after="clickOrderApplyFilters" stepKey="openOrderViewPage"/> From e64ce9d93b6b12f99f6d5b7c5e7b3d9a1de5547b Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Mon, 9 Dec 2019 01:07:24 -0600 Subject: [PATCH 0267/1143] Change action groups name according to CE branch changes --- .../AdminUpdateCmsPageRewriteEntityWithNoRedirectTest.xml | 4 ++-- ...dminUpdateCmsPageRewriteEntityWithPermanentReirectTest.xml | 4 ++-- ...minUpdateCmsPageRewriteEntityWithTemporaryRedirectTest.xml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithNoRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithNoRedirectTest.xml index 81dedfea7a35e..03027ce2ab7e9 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithNoRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithNoRedirectTest.xml @@ -29,7 +29,7 @@ <actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createCustomStoreView"/> <!-- Open CMS Edit Page, Get the CMS ID and Modify Store View Option to All Store Views --> - <actionGroup ref="navigateToCreatedCMSPage" stepKey="navigateToCreatedCMSPage"> + <actionGroup ref="NavigateToCreatedCMSPageActionGroup" stepKey="navigateToCreatedCMSPage"> <argument name="CMSPage" value="$$createCMSPage$$"/> </actionGroup> <grabFromCurrentUrl stepKey="cmsId" regex="#\/([0-9]*)?\/$#"/> @@ -71,7 +71,7 @@ <actionGroup ref="StorefrontSwitchStoreViewActionGroup" stepKey="storefrontSwitchToCustomStoreView"> <argument name="storeView" value="customStore"/> </actionGroup> - <actionGroup ref="navigateToStorefrontForCreatedPage" stepKey="navigateToTheStoreFront"> + <actionGroup ref="NavigateToStorefrontForCreatedPageActionGroup" stepKey="navigateToTheStoreFront"> <argument name="page" value="newrequestpath"/> </actionGroup> <actionGroup ref="AssertStoreFrontCMSPage" stepKey="assertCMSPage"> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithPermanentReirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithPermanentReirectTest.xml index f073794896c2c..9159b6536e486 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithPermanentReirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithPermanentReirectTest.xml @@ -29,7 +29,7 @@ <actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createCustomStoreView"/> <!-- Open CMS Edit Page, Get the CMS ID and Modify Store View Option to All Store Views --> - <actionGroup ref="navigateToCreatedCMSPage" stepKey="navigateToCreatedCMSPage"> + <actionGroup ref="NavigateToCreatedCMSPageActionGroup" stepKey="navigateToCreatedCMSPage"> <argument name="CMSPage" value="$$createCMSPage$$"/> </actionGroup> <grabFromCurrentUrl stepKey="cmsId" regex="#\/([0-9]*)?\/$#"/> @@ -67,7 +67,7 @@ </actionGroup> <!-- Assert Url Rewrite Cms Page Redirect --> - <actionGroup ref="navigateToStorefrontForCreatedPage" stepKey="navigateToTheStoreFront"> + <actionGroup ref="NavigateToStorefrontForCreatedPageActionGroup" stepKey="navigateToTheStoreFront"> <argument name="page" value="permanentrequestpath.htm"/> </actionGroup> <actionGroup ref="AssertStoreFrontCMSPage" stepKey="assertCMSPage"> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithTemporaryRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithTemporaryRedirectTest.xml index 8f04fe7cf9ab9..9e509808427bb 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithTemporaryRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithTemporaryRedirectTest.xml @@ -29,7 +29,7 @@ <actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createCustomStoreView"/> <!-- Open CMS Edit Page, Get the CMS ID and Modify Store View Option to All Store Views --> - <actionGroup ref="navigateToCreatedCMSPage" stepKey="navigateToCreatedCMSPage"> + <actionGroup ref="NavigateToCreatedCMSPageActionGroup" stepKey="navigateToCreatedCMSPage"> <argument name="CMSPage" value="$$createCMSPage$$"/> </actionGroup> <grabFromCurrentUrl stepKey="cmsId" regex="#\/([0-9]*)?\/$#"/> @@ -67,7 +67,7 @@ </actionGroup> <!-- Assert Url Rewrite Cms Page Redirect --> - <actionGroup ref="navigateToStorefrontForCreatedPage" stepKey="navigateToTheStoreFront"> + <actionGroup ref="NavigateToStorefrontForCreatedPageActionGroup" stepKey="navigateToTheStoreFront"> <argument name="page" value="temporaryrequestpath.html"/> </actionGroup> <actionGroup ref="AssertStoreFrontCMSPage" stepKey="assertCMSPage"> From fced55289bc6ce2ee6c7652bfa4b8cb5e80e2441 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Mon, 9 Dec 2019 01:42:18 -0600 Subject: [PATCH 0268/1143] Change action groups name according to CE branch changes --- ...minUpdateCmsPageRewriteEntityWithNoRedirectTest.xml | 10 +++++----- ...ateCmsPageRewriteEntityWithPermanentReirectTest.xml | 10 +++++----- ...teCmsPageRewriteEntityWithTemporaryRedirectTest.xml | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithNoRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithNoRedirectTest.xml index 03027ce2ab7e9..98c1839f99859 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithNoRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithNoRedirectTest.xml @@ -33,13 +33,13 @@ <argument name="CMSPage" value="$$createCMSPage$$"/> </actionGroup> <grabFromCurrentUrl stepKey="cmsId" regex="#\/([0-9]*)?\/$#"/> - <actionGroup ref="AddStoreViewToCmsPage" stepKey="updateStoreViewForCmsPage"> + <actionGroup ref="AddStoreViewToCmsPageActionGroup" stepKey="updateStoreViewForCmsPage"> <argument name="CMSPage" value="$$createCMSPage$$"/> <argument name="storeViewName" value="All Store Views"/> </actionGroup> <!--Create CMS Page URL Redirect--> - <actionGroup ref="AdminAddCustomUrlRewrite" stepKey="addCustomUrlRewrite"> + <actionGroup ref="AdminAddCustomUrlRewriteActionGroup" stepKey="addCustomUrlRewrite"> <argument name="customUrlRewriteValue" value="Custom"/> <argument name="storeValue" value="Default Store View"/> <argument name="requestPath" value="created-new-cms-page"/> @@ -49,7 +49,7 @@ </actionGroup> <!--Search created CMS page url rewrite in grid--> - <actionGroup ref="AdminSearchAndSelectUrlRewriteInGrid" stepKey="searchUrlRewrite"> + <actionGroup ref="AdminSearchAndSelectUrlRewriteInGridActionGroup" stepKey="searchUrlRewrite"> <argument name="requestPath" value="created-new-cms-page"/> </actionGroup> @@ -74,13 +74,13 @@ <actionGroup ref="NavigateToStorefrontForCreatedPageActionGroup" stepKey="navigateToTheStoreFront"> <argument name="page" value="newrequestpath"/> </actionGroup> - <actionGroup ref="AssertStoreFrontCMSPage" stepKey="assertCMSPage"> + <actionGroup ref="AssertStoreFrontCMSPageActionGroup" stepKey="assertCMSPage"> <argument name="cmsTitle" value="$$createCMSPage.title$$"/> <argument name="cmsContent" value="$$createCMSPage.content$$"/> <argument name="cmsContentHeading" value="$$createCMSPage.content_heading$$"/> </actionGroup> - <actionGroup ref="AdminDeleteUrlRewrite" stepKey="deleteCustomUrlRewrite"> + <actionGroup ref="AdminDeleteUrlRewriteActionGroup" stepKey="deleteCustomUrlRewrite"> <argument name="requestPath" value="newrequestpath"/> </actionGroup> <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteCustomStoreView"/> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithPermanentReirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithPermanentReirectTest.xml index 9159b6536e486..c99cdb95758e5 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithPermanentReirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithPermanentReirectTest.xml @@ -33,13 +33,13 @@ <argument name="CMSPage" value="$$createCMSPage$$"/> </actionGroup> <grabFromCurrentUrl stepKey="cmsId" regex="#\/([0-9]*)?\/$#"/> - <actionGroup ref="AddStoreViewToCmsPage" stepKey="updateStoreViewForCmsPage"> + <actionGroup ref="AddStoreViewToCmsPageActionGroup" stepKey="updateStoreViewForCmsPage"> <argument name="CMSPage" value="$$createCMSPage$$"/> <argument name="storeViewName" value="All Store Views"/> </actionGroup> <!--Create CMS Page URL Redirect--> - <actionGroup ref="AdminAddCustomUrlRewrite" stepKey="addCustomUrlRewrite"> + <actionGroup ref="AdminAddCustomUrlRewriteActionGroup" stepKey="addCustomUrlRewrite"> <argument name="customUrlRewriteValue" value="Custom"/> <argument name="storeValue" value="Default Store View"/> <argument name="requestPath" value="created-new-cms-page"/> @@ -49,7 +49,7 @@ </actionGroup> <!--Search created CMS page url rewrite in grid--> - <actionGroup ref="AdminSearchAndSelectUrlRewriteInGrid" stepKey="searchUrlRewrite"> + <actionGroup ref="AdminSearchAndSelectUrlRewriteInGridActionGroup" stepKey="searchUrlRewrite"> <argument name="requestPath" value="created-new-cms-page"/> </actionGroup> @@ -70,13 +70,13 @@ <actionGroup ref="NavigateToStorefrontForCreatedPageActionGroup" stepKey="navigateToTheStoreFront"> <argument name="page" value="permanentrequestpath.htm"/> </actionGroup> - <actionGroup ref="AssertStoreFrontCMSPage" stepKey="assertCMSPage"> + <actionGroup ref="AssertStoreFrontCMSPageActionGroup" stepKey="assertCMSPage"> <argument name="cmsTitle" value="$$createCMSPage.title$$"/> <argument name="cmsContent" value="$$createCMSPage.content$$"/> <argument name="cmsContentHeading" value="$$createCMSPage.content_heading$$"/> </actionGroup> - <actionGroup ref="AdminDeleteUrlRewrite" stepKey="deleteCustomUrlRewrite"> + <actionGroup ref="AdminDeleteUrlRewriteActionGroup" stepKey="deleteCustomUrlRewrite"> <argument name="requestPath" value="permanentrequestpath.htm"/> </actionGroup> <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteCustomStoreView"/> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithTemporaryRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithTemporaryRedirectTest.xml index 9e509808427bb..644f495856f07 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithTemporaryRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithTemporaryRedirectTest.xml @@ -33,13 +33,13 @@ <argument name="CMSPage" value="$$createCMSPage$$"/> </actionGroup> <grabFromCurrentUrl stepKey="cmsId" regex="#\/([0-9]*)?\/$#"/> - <actionGroup ref="AddStoreViewToCmsPage" stepKey="updateStoreViewForCmsPage"> + <actionGroup ref="AddStoreViewToCmsPageActionGroup" stepKey="updateStoreViewForCmsPage"> <argument name="CMSPage" value="$$createCMSPage$$"/> <argument name="storeViewName" value="All Store Views"/> </actionGroup> <!--Create CMS Page URL Redirect--> - <actionGroup ref="AdminAddCustomUrlRewrite" stepKey="addCustomUrlRewrite"> + <actionGroup ref="AdminAddCustomUrlRewriteActionGroup" stepKey="addCustomUrlRewrite"> <argument name="customUrlRewriteValue" value="Custom"/> <argument name="storeValue" value="Default Store View"/> <argument name="requestPath" value="created-new-cms-page"/> @@ -49,7 +49,7 @@ </actionGroup> <!--Search created CMS page url rewrite in grid--> - <actionGroup ref="AdminSearchAndSelectUrlRewriteInGrid" stepKey="searchUrlRewrite"> + <actionGroup ref="AdminSearchAndSelectUrlRewriteInGridActionGroup" stepKey="searchUrlRewrite"> <argument name="requestPath" value="created-new-cms-page"/> </actionGroup> @@ -70,13 +70,13 @@ <actionGroup ref="NavigateToStorefrontForCreatedPageActionGroup" stepKey="navigateToTheStoreFront"> <argument name="page" value="temporaryrequestpath.html"/> </actionGroup> - <actionGroup ref="AssertStoreFrontCMSPage" stepKey="assertCMSPage"> + <actionGroup ref="AssertStoreFrontCMSPageActionGroup" stepKey="assertCMSPage"> <argument name="cmsTitle" value="$$createCMSPage.title$$"/> <argument name="cmsContent" value="$$createCMSPage.content$$"/> <argument name="cmsContentHeading" value="$$createCMSPage.content_heading$$"/> </actionGroup> - <actionGroup ref="AdminDeleteUrlRewrite" stepKey="deleteCustomUrlRewrite"> + <actionGroup ref="AdminDeleteUrlRewriteActionGroup" stepKey="deleteCustomUrlRewrite"> <argument name="requestPath" value="temporaryrequestpath.html"/> </actionGroup> <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteCustomStoreView"/> From 4174d296263da39b78f80b60565c3c814d380ecf Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Mon, 9 Dec 2019 09:48:42 +0200 Subject: [PATCH 0269/1143] Fix static test --- .../View/Element/UiComponent/DataProvider/FilterPool.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/View/Element/UiComponent/DataProvider/FilterPool.php b/lib/internal/Magento/Framework/View/Element/UiComponent/DataProvider/FilterPool.php index 9cee6b6d5bb4c..2c0b16f27df8b 100644 --- a/lib/internal/Magento/Framework/View/Element/UiComponent/DataProvider/FilterPool.php +++ b/lib/internal/Magento/Framework/View/Element/UiComponent/DataProvider/FilterPool.php @@ -11,7 +11,7 @@ use Magento\Framework\Api\Search\SearchCriteriaInterface; /** - * Class FilterPool + * Filter poll apply filters from search criteria * * @api */ @@ -31,6 +31,8 @@ public function __construct(array $appliers = []) } /** + * Apply filters from search criteria + * * @param Collection $collection * @param SearchCriteriaInterface $criteria * @return void From 206f2dd8928ef5f2198c2c199f80bc568e59debf Mon Sep 17 00:00:00 2001 From: Lukasz Bajsarowicz <lukasz.bajsarowicz@gmail.com> Date: Mon, 9 Dec 2019 11:00:18 +0100 Subject: [PATCH 0270/1143] Update app/code/Magento/Shipping/Model/Tracking/Result/Status.php Co-Authored-By: Ihor Sviziev <ihor-sviziev@users.noreply.github.com> --- app/code/Magento/Shipping/Model/Tracking/Result/Status.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Shipping/Model/Tracking/Result/Status.php b/app/code/Magento/Shipping/Model/Tracking/Result/Status.php index 04ff29139d926..5f80c31120ec1 100644 --- a/app/code/Magento/Shipping/Model/Tracking/Result/Status.php +++ b/app/code/Magento/Shipping/Model/Tracking/Result/Status.php @@ -13,7 +13,7 @@ * * @method string getCarrier() * @method Status setCarrier(string $carrierCode) - * @method string getCarrierTitle() + * @method string|null getCarrierTitle() * @method Status setCarrierTitle(string $carrierTitle) */ class Status extends AbstractResult From 9a40b1656a6568963c540bd234889d736dbbf492 Mon Sep 17 00:00:00 2001 From: Lukasz Bajsarowicz <lukasz.bajsarowicz@gmail.com> Date: Mon, 9 Dec 2019 11:00:29 +0100 Subject: [PATCH 0271/1143] Update app/code/Magento/Shipping/Model/Tracking/Result/Status.php Co-Authored-By: Ihor Sviziev <ihor-sviziev@users.noreply.github.com> --- app/code/Magento/Shipping/Model/Tracking/Result/Status.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Shipping/Model/Tracking/Result/Status.php b/app/code/Magento/Shipping/Model/Tracking/Result/Status.php index 5f80c31120ec1..784b806fa3f86 100644 --- a/app/code/Magento/Shipping/Model/Tracking/Result/Status.php +++ b/app/code/Magento/Shipping/Model/Tracking/Result/Status.php @@ -11,7 +11,7 @@ /** * Tracking Status DataObject * - * @method string getCarrier() + * @method string|null getCarrier() * @method Status setCarrier(string $carrierCode) * @method string|null getCarrierTitle() * @method Status setCarrierTitle(string $carrierTitle) From 232e80880ac92153109032a5f5409aad6d5ae38d Mon Sep 17 00:00:00 2001 From: Max Romanov <maxromanov4669@gmail.com> Date: Mon, 9 Dec 2019 13:11:50 +0200 Subject: [PATCH 0272/1143] 14663-customer-group-rest-api-fix --- .../Model/ResourceModel/CustomerRepository.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/code/Magento/Customer/Model/ResourceModel/CustomerRepository.php b/app/code/Magento/Customer/Model/ResourceModel/CustomerRepository.php index 03cf4b1bdddec..1f2d3726b8fa7 100644 --- a/app/code/Magento/Customer/Model/ResourceModel/CustomerRepository.php +++ b/app/code/Magento/Customer/Model/ResourceModel/CustomerRepository.php @@ -214,6 +214,7 @@ public function save(CustomerInterface $customer, $passwordHash = null) $prevCustomerData ? $prevCustomerData->getStoreId() : $this->storeManager->getStore()->getId() ); } + $this->setCustomerGroupId($customerModel, $customerArr, $prevCustomerDataArr); // Need to use attribute set or future updates can cause data loss if (!$customerModel->getAttributeSetId()) { $customerModel->setAttributeSetId(CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER); @@ -452,4 +453,18 @@ private function setValidationFlag($customerArray, $customerModel) $customerModel->setData('ignore_validation_flag', true); } } + + /** + * Set customer group id + * + * @param Customer $customerModel + * @param array $customerArr + * @param array $prevCustomerDataArr + */ + private function setCustomerGroupId($customerModel, $customerArr, $prevCustomerDataArr) + { + if (!isset($customerArr['group_id']) && $prevCustomerDataArr && isset($prevCustomerDataArr['group_id'])) { + $customerModel->setGroupId($prevCustomerDataArr['group_id']); + } + } } From 9be67b62f0250a4c8b1af534ab49e44ff95b2d44 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Mon, 9 Dec 2019 12:59:53 +0200 Subject: [PATCH 0273/1143] Static test fix --- .../Model/OperationProcessor.php | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/AsynchronousOperations/Model/OperationProcessor.php b/app/code/Magento/AsynchronousOperations/Model/OperationProcessor.php index b1bc990159bf3..453f786bdf47b 100644 --- a/app/code/Magento/AsynchronousOperations/Model/OperationProcessor.php +++ b/app/code/Magento/AsynchronousOperations/Model/OperationProcessor.php @@ -8,24 +8,24 @@ namespace Magento\AsynchronousOperations\Model; -use Magento\Framework\Serialize\Serializer\Json; use Magento\AsynchronousOperations\Api\Data\OperationInterface; -use Magento\Framework\Bulk\OperationManagementInterface; use Magento\AsynchronousOperations\Model\ConfigInterface as AsyncConfig; -use Magento\Framework\MessageQueue\MessageValidator; -use Magento\Framework\MessageQueue\MessageEncoder; -use Magento\Framework\Exception\NoSuchEntityException; -use Magento\Framework\MessageQueue\ConsumerConfigurationInterface; -use Psr\Log\LoggerInterface; -use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Bulk\OperationManagementInterface; +use Magento\Framework\Communication\ConfigInterface as CommunicationConfig; use Magento\Framework\DB\Adapter\ConnectionException; use Magento\Framework\DB\Adapter\DeadlockException; use Magento\Framework\DB\Adapter\LockWaitException; +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\MessageQueue\ConsumerConfigurationInterface; +use Magento\Framework\MessageQueue\MessageEncoder; +use Magento\Framework\MessageQueue\MessageValidator; +use Magento\Framework\Serialize\Serializer\Json; use Magento\Framework\Webapi\ServiceOutputProcessor; -use Magento\Framework\Communication\ConfigInterface as CommunicationConfig; +use Psr\Log\LoggerInterface; /** - * Class OperationProcessor + * Proccess operation * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ @@ -136,7 +136,9 @@ public function process(string $encodedMessage) $result = $this->executeHandler($callback, $entityParams); $status = $result['status']; $errorCode = $result['error_code']; + // phpcs:disable Magento2.Performance.ForeachArrayMerge $messages = array_merge($messages, $result['messages']); + // phpcs:enable Magento2.Performance.ForeachArrayMerge $outputData = $result['output_data']; } } @@ -186,7 +188,9 @@ private function executeHandler($callback, $entityParams) 'output_data' => null ]; try { + // phpcs:disable Magento2.Functions.DiscouragedFunction $result['output_data'] = call_user_func_array($callback, $entityParams); + // phpcs:enable Magento2.Functions.DiscouragedFunction $result['messages'][] = sprintf('Service execution success %s::%s', get_class($callback[0]), $callback[1]); } catch (\Zend_Db_Adapter_Exception $e) { $this->logger->critical($e->getMessage()); From 9dc550be1bd09a2c44bf292d3c9ed7299367871c Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Mon, 9 Dec 2019 15:11:23 +0200 Subject: [PATCH 0274/1143] Static test fix --- .../Magento/AdminNotification/Block/Grid/Renderer/Actions.php | 2 -- .../Magento/AdminNotification/Block/Grid/Renderer/Notice.php | 2 -- .../Magento/AdminNotification/Block/Grid/Renderer/Severity.php | 2 -- 3 files changed, 6 deletions(-) diff --git a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php index 0a19531a34a0c..f74f62ef000e6 100644 --- a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php +++ b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php @@ -18,8 +18,6 @@ /** * Renderer class for action in the admin notifications grid - * - * @package Magento\AdminNotification\Block\Grid\Renderer */ class Actions extends AbstractRenderer { diff --git a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Notice.php b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Notice.php index bd553e97aff79..4aa5d90e08014 100644 --- a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Notice.php +++ b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Notice.php @@ -14,8 +14,6 @@ /** * Renderer class for notice in the admin notifications grid - * - * @package Magento\AdminNotification\Block\Grid\Renderer */ class Notice extends AbstractRenderer { diff --git a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Severity.php b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Severity.php index f7f8633e42e79..fd3d5c584d6fa 100644 --- a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Severity.php +++ b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Severity.php @@ -17,8 +17,6 @@ /** * Renderer class for severity in the admin notifications grid - * - * @package Magento\AdminNotification\Block\Grid\Renderer */ class Severity extends AbstractRenderer { From 1a1ca42ff4af7e5621455ed92eb76e5dddadeadb Mon Sep 17 00:00:00 2001 From: Max Romanov <maxromanov4669@gmail.com> Date: Mon, 9 Dec 2019 16:31:50 +0200 Subject: [PATCH 0275/1143] fix code style --- .../Customer/Model/ResourceModel/CustomerRepository.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Customer/Model/ResourceModel/CustomerRepository.php b/app/code/Magento/Customer/Model/ResourceModel/CustomerRepository.php index 1f2d3726b8fa7..323b6c5d53714 100644 --- a/app/code/Magento/Customer/Model/ResourceModel/CustomerRepository.php +++ b/app/code/Magento/Customer/Model/ResourceModel/CustomerRepository.php @@ -31,6 +31,8 @@ /** * Customer repository. * + * CRUD operations for customer entity + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.TooManyFields) */ @@ -187,8 +189,7 @@ public function save(CustomerInterface $customer, $passwordHash = null) { /** @var NewOperation|null $delegatedNewOperation */ $delegatedNewOperation = !$customer->getId() ? $this->delegatedStorage->consumeNewOperation() : null; - $prevCustomerData = null; - $prevCustomerDataArr = null; + $prevCustomerData = $prevCustomerDataArr = null; if ($customer->getId()) { $prevCustomerData = $this->getById($customer->getId()); $prevCustomerDataArr = $prevCustomerData->__toArray(); From b7bc81fc6a4b04c68546096dd07214d50e2aa40d Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Mon, 9 Dec 2019 22:11:29 +0700 Subject: [PATCH 0276/1143] MFTF: Access denied automation test --- .../AdminLoginWithRestrictPermissionTest.xml | 61 +++++++++++++++++++ ...minUserClickRoleResourceTabActionGroup.xml | 16 +++++ ...AdminUserOpenAdminRolesPageActionGroup.xml | 17 ++++++ .../AdminUserSaveRoleActionGroup.xml | 17 ++++++ 4 files changed, 111 insertions(+) create mode 100644 app/code/Magento/Backend/Test/Mftf/Test/AdminLoginWithRestrictPermissionTest.xml create mode 100644 app/code/Magento/User/Test/Mftf/ActionGroup/AdminUserClickRoleResourceTabActionGroup.xml create mode 100644 app/code/Magento/User/Test/Mftf/ActionGroup/AdminUserOpenAdminRolesPageActionGroup.xml create mode 100644 app/code/Magento/User/Test/Mftf/ActionGroup/AdminUserSaveRoleActionGroup.xml diff --git a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginWithRestrictPermissionTest.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginWithRestrictPermissionTest.xml new file mode 100644 index 0000000000000..a4e132b8065d2 --- /dev/null +++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginWithRestrictPermissionTest.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminLoginWithRestrictPermissionTest"> + <annotations> + <features value="Backend"/> + <title value="Login with restrict role."/> + <stories value="Login on the Admin Login page" /> + <testCaseId value="MC-29321" /> + <severity value="MAJOR" /> + <description value="Check login with restrict role."/> + <group value="login"/> + </annotations> + + <before> + <actionGroup ref="LoginAsAdmin" stepKey="logIn"/> + <!--Create user role--> + <actionGroup ref="AdminFillUserRoleRequiredData" stepKey="fillUserRoleRequiredData"> + <argument name="User" value="adminRole"/> + <argument name="restrictedRole" value="Media Gallery"/> + </actionGroup> + <actionGroup ref="AdminUserClickRoleResourceTabActionGroup" stepKey="switchToRoleResourceTab"/> + <actionGroup ref="AdminAddRestrictedRole" stepKey="addRestrictedRoleStores"> + <argument name="User" value="adminRole"/> + <argument name="restrictedRole" value="Media Gallery"/> + </actionGroup> + <actionGroup ref="AdminUserSaveRoleActionGroup" stepKey="saveRole"/> + <!--Create user and assign role to it--> + <actionGroup ref="AdminCreateUserActionGroup" stepKey="createAdminUser"> + <argument name="role" value="adminRole"/> + <argument name="User" value="admin2"/> + </actionGroup> + </before> + <after> + <actionGroup ref="logout" stepKey="logoutAsSaleRoleUser"/> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <!--Delete created data--> + <actionGroup ref="AdminUserOpenAdminRolesPageActionGroup" stepKey="navigateToUserRoleGrid"/> + <actionGroup ref="AdminDeleteRoleActionGroup" stepKey="deleteUserRole"> + <argument name="role" value="adminRole"/> + </actionGroup> + <actionGroup ref="AdminOpenAdminUsersPageActionGroup" stepKey="goToAllUsersPage"/> + <actionGroup ref="AdminDeleteNewUserActionGroup" stepKey="deleteUser"> + <argument name="userName" value="{{admin2.username}}"/> + </actionGroup> + </after> + <!--Log out of admin and login with newly created user--> + <actionGroup ref="logout" stepKey="logoutOfAdmin"/> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsNewUser"> + <argument name="adminUser" value="admin2"/> + </actionGroup> + <actionGroup ref="AssertUserRoleRestrictedAccessActionGroup" stepKey="assertRestrictPage"/> + </test> +</tests> diff --git a/app/code/Magento/User/Test/Mftf/ActionGroup/AdminUserClickRoleResourceTabActionGroup.xml b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminUserClickRoleResourceTabActionGroup.xml new file mode 100644 index 0000000000000..3e20eaf973674 --- /dev/null +++ b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminUserClickRoleResourceTabActionGroup.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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminUserClickRoleResourceTabActionGroup"> + <annotations> + <description>Switch to role resource tab.</description> + </annotations> + <click selector="{{AdminEditRoleInfoSection.roleResourcesTab}}" stepKey="clickRoleResourcesTab" /> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/User/Test/Mftf/ActionGroup/AdminUserOpenAdminRolesPageActionGroup.xml b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminUserOpenAdminRolesPageActionGroup.xml new file mode 100644 index 0000000000000..71be9117e5caf --- /dev/null +++ b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminUserOpenAdminRolesPageActionGroup.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminUserOpenAdminRolesPageActionGroup"> + <annotations> + <description>Navigate to User Role Grid</description> + </annotations> + <amOnPage url="{{AdminRolesPage.url}}" stepKey="navigateToUserRoleGrid" /> + <waitForPageLoad stepKey="waitForRolesGridLoad" /> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/User/Test/Mftf/ActionGroup/AdminUserSaveRoleActionGroup.xml b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminUserSaveRoleActionGroup.xml new file mode 100644 index 0000000000000..824e9407125f5 --- /dev/null +++ b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminUserSaveRoleActionGroup.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminUserSaveRoleActionGroup"> + <annotations> + <description>Click to Save Role</description> + </annotations> + <click selector="{{AdminEditRoleInfoSection.saveButton}}" stepKey="clickSaveRoleButton" /> + <see userInput="You saved the role." stepKey="seeUserRoleSavedMessage"/> + </actionGroup> +</actionGroups> From 799b72a666c42120961a7b147c1a34a687b27265 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Mon, 9 Dec 2019 10:29:01 -0600 Subject: [PATCH 0277/1143] Change action groups name according to CE branch changes --- .../Test/AdminUpdateCmsPageRewriteEntityWithNoRedirectTest.xml | 2 +- .../AdminUpdateCmsPageRewriteEntityWithPermanentReirectTest.xml | 2 +- ...AdminUpdateCmsPageRewriteEntityWithTemporaryRedirectTest.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithNoRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithNoRedirectTest.xml index 98c1839f99859..6467a5051631d 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithNoRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithNoRedirectTest.xml @@ -54,7 +54,7 @@ </actionGroup> <!-- Update URL Rewrite for CMS Page --> - <actionGroup ref="AdminUpdateUrlRewrite" stepKey="updateUrlRewriteFirstAttempt"> + <actionGroup ref="AdminUpdateUrlRewriteActionGroup" stepKey="updateUrlRewriteFirstAttempt"> <argument name="storeValue" value="{{customStore.name}}"/> <argument name="requestPath" value="newrequestpath"/> <argument name="redirectTypeValue" value="No"/> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithPermanentReirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithPermanentReirectTest.xml index c99cdb95758e5..3bf278db8410a 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithPermanentReirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithPermanentReirectTest.xml @@ -54,7 +54,7 @@ </actionGroup> <!-- Update URL Rewrite for CMS Page --> - <actionGroup ref="AdminUpdateUrlRewrite" stepKey="updateUrlRewrite"> + <actionGroup ref="AdminUpdateUrlRewriteActionGroup" stepKey="updateUrlRewrite"> <argument name="storeValue" value="Default Store View"/> <argument name="requestPath" value="permanentrequestpath.htm"/> <argument name="redirectTypeValue" value="Permanent (301)"/> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithTemporaryRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithTemporaryRedirectTest.xml index 644f495856f07..a7cadcdf753c3 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithTemporaryRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithTemporaryRedirectTest.xml @@ -54,7 +54,7 @@ </actionGroup> <!-- Update URL Rewrite for CMS Page --> - <actionGroup ref="AdminUpdateUrlRewrite" stepKey="updateUrlRewrite"> + <actionGroup ref="AdminUpdateUrlRewriteActionGroup" stepKey="updateUrlRewrite"> <argument name="storeValue" value="Default Store View"/> <argument name="requestPath" value="temporaryrequestpath.html"/> <argument name="redirectTypeValue" value="Temporary (302)"/> From 2c705123e2ea9f5fdb34fc89eaf568f2336c1239 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Szubert?= <bartlomiejszubert@gmail.com> Date: Tue, 1 Oct 2019 23:40:57 +0200 Subject: [PATCH 0278/1143] Fix #21684 - Currency sign for "Layered Navigation Price Step" is not according to default settings --- .../Catalog/Model/Category/DataProvider.php | 198 ++++++++---------- .../Unit/Model/Category/DataProviderTest.php | 112 +++++----- .../adminhtml/ui_component/category_form.xml | 1 - 3 files changed, 149 insertions(+), 162 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Category/DataProvider.php b/app/code/Magento/Catalog/Model/Category/DataProvider.php index 283e3f87686b9..e4fa897e65b67 100644 --- a/app/code/Magento/Catalog/Model/Category/DataProvider.php +++ b/app/code/Magento/Catalog/Model/Category/DataProvider.php @@ -20,8 +20,11 @@ use Magento\Eav\Model\Entity\Attribute\Source\SpecificSourceInterface; use Magento\Eav\Model\Entity\Type; use Magento\Framework\App\ObjectManager; +use Magento\Framework\App\RequestInterface; +use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Filesystem; +use Magento\Framework\Registry; use Magento\Framework\Stdlib\ArrayManager; use Magento\Framework\Stdlib\ArrayUtils; use Magento\Store\Model\Store; @@ -30,6 +33,7 @@ use Magento\Ui\DataProvider\EavValidationRules; use Magento\Ui\DataProvider\Modifier\PoolInterface; use Magento\Framework\AuthorizationInterface; +use Magento\Ui\DataProvider\ModifierPoolDataProvider; /** * Category form data provider. @@ -39,7 +43,7 @@ * @SuppressWarnings(PHPMD.TooManyFields) * @since 101.0.0 */ -class DataProvider extends \Magento\Ui\DataProvider\ModifierPoolDataProvider +class DataProvider extends ModifierPoolDataProvider { /** * @var string @@ -106,6 +110,15 @@ class DataProvider extends \Magento\Ui\DataProvider\ModifierPoolDataProvider 'position' ]; + /** + * Elements with currency symbol + * + * @var array + */ + private $elementsWithCurrencySymbol = [ + 'filter_price_range', + ]; + /** * @var EavValidationRules * @since 101.0.0 @@ -113,13 +126,13 @@ class DataProvider extends \Magento\Ui\DataProvider\ModifierPoolDataProvider protected $eavValidationRules; /** - * @var \Magento\Framework\Registry + * @var Registry * @since 101.0.0 */ protected $registry; /** - * @var \Magento\Framework\App\RequestInterface + * @var RequestInterface * @since 101.0.0 */ protected $request; @@ -171,16 +184,19 @@ class DataProvider extends \Magento\Ui\DataProvider\ModifierPoolDataProvider * @param EavValidationRules $eavValidationRules * @param CategoryCollectionFactory $categoryCollectionFactory * @param StoreManagerInterface $storeManager - * @param \Magento\Framework\Registry $registry + * @param Registry $registry * @param Config $eavConfig - * @param \Magento\Framework\App\RequestInterface $request + * @param RequestInterface $request * @param CategoryFactory $categoryFactory * @param array $meta * @param array $data * @param PoolInterface|null $pool * @param AuthorizationInterface|null $auth * @param ArrayUtils|null $arrayUtils - * @throws \Magento\Framework\Exception\LocalizedException + * @param ScopeOverriddenValue|null $scopeOverriddenValue + * @param ArrayManager|null $arrayManager + * @param Filesystem|null $fileInfo + * @throws LocalizedException * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -190,15 +206,18 @@ public function __construct( EavValidationRules $eavValidationRules, CategoryCollectionFactory $categoryCollectionFactory, StoreManagerInterface $storeManager, - \Magento\Framework\Registry $registry, + Registry $registry, Config $eavConfig, - \Magento\Framework\App\RequestInterface $request, + RequestInterface $request, CategoryFactory $categoryFactory, array $meta = [], array $data = [], PoolInterface $pool = null, ?AuthorizationInterface $auth = null, - ?ArrayUtils $arrayUtils = null + ?ArrayUtils $arrayUtils = null, + ScopeOverriddenValue $scopeOverriddenValue = null, + ArrayManager $arrayManager = null, + Filesystem $fileInfo = null ) { $this->eavValidationRules = $eavValidationRules; $this->collection = $categoryCollectionFactory->create(); @@ -210,6 +229,10 @@ public function __construct( $this->categoryFactory = $categoryFactory; $this->auth = $auth ?? ObjectManager::getInstance()->get(AuthorizationInterface::class); $this->arrayUtils = $arrayUtils ?? ObjectManager::getInstance()->get(ArrayUtils::class); + $this->scopeOverriddenValue = $scopeOverriddenValue ?: + ObjectManager::getInstance()->get(ScopeOverriddenValue::class); + $this->arrayManager = $arrayManager ?: ObjectManager::getInstance()->get(ArrayManager::class); + $this->fileInfo = $fileInfo ?: ObjectManager::getInstance()->get(Filesystem::class); parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data, $pool); } @@ -247,7 +270,7 @@ private function addUseDefaultValueCheckbox(Category $category, array $meta): ar $canDisplayUseDefault = $attribute->getScope() != EavAttributeInterface::SCOPE_GLOBAL_TEXT && $category->getId() && $category->getStoreId(); - $attributePath = $this->getArrayManager()->findPath($attributeCode, $meta); + $attributePath = $this->arrayManager->findPath($attributeCode, $meta); if (!$attributePath || !$canDisplayUseDefault @@ -256,14 +279,14 @@ private function addUseDefaultValueCheckbox(Category $category, array $meta): ar continue; } - $meta = $this->getArrayManager()->merge( + $meta = $this->arrayManager->merge( [$attributePath, 'arguments/data/config'], $meta, [ 'service' => [ 'template' => 'ui/form/element/helper/service', ], - 'disabled' => !$this->getScopeOverriddenValue()->containsValue( + 'disabled' => !$this->scopeOverriddenValue->containsValue( CategoryInterface::class, $category, $attributeCode, @@ -354,7 +377,7 @@ public function getData() * * @param Type $entityType * @return array - * @throws \Magento\Framework\Exception\LocalizedException + * @throws LocalizedException * @SuppressWarnings(PHPMD.NPathComplexity) * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @since 101.0.0 @@ -407,11 +430,22 @@ public function getAttributesMeta(Type $entityType) if ($category) { $attributeIsLocked = $category->isLockedAttribute($code); $meta[$code]['disabled'] = $attributeIsLocked; - $hasUseConfigField = (bool) array_search('use_config.' . $code, $fields, true); + $hasUseConfigField = (bool)array_search('use_config.' . $code, $fields, true); if ($hasUseConfigField && $meta[$code]['disabled']) { $meta['use_config.' . $code]['disabled'] = true; } } + + if (in_array($code, $this->elementsWithCurrencySymbol, false)) { + $requestScope = $this->request->getParam( + $this->requestScopeFieldName, + Store::DEFAULT_STORE_ID + ); + + $meta[$code]['addbefore'] = $this->storeManager->getStore($requestScope) + ->getBaseCurrency() + ->getCurrencySymbol(); + } } $result = []; @@ -560,16 +594,15 @@ private function convertValues($category, $categoryData): array unset($categoryData[$attributeCode]); $fileName = $category->getData($attributeCode); - $fileInfo = $this->getFileInfo(); - if ($fileInfo->isExist($fileName)) { - $stat = $fileInfo->getStat($fileName); - $mime = $fileInfo->getMimeType($fileName); + if ($this->fileInfo->isExist($fileName)) { + $stat = $this->fileInfo->getStat($fileName); + $mime = $this->fileInfo->getMimeType($fileName); // phpcs:ignore Magento2.Functions.DiscouragedFunction $categoryData[$attributeCode][0]['name'] = basename($fileName); - if ($fileInfo->isBeginsWithMediaDirectoryPath($fileName)) { + if ($this->fileInfo->isBeginsWithMediaDirectoryPath($fileName)) { $categoryData[$attributeCode][0]['url'] = $fileName; } else { $categoryData[$attributeCode][0]['url'] = $category->getImageUrl($attributeCode); @@ -611,53 +644,53 @@ protected function getFieldsMap() { return [ 'general' => [ - 'parent', - 'path', - 'is_active', - 'include_in_menu', - 'name', - ], + 'parent', + 'path', + 'is_active', + 'include_in_menu', + 'name', + ], 'content' => [ - 'image', - 'description', - 'landing_page', - ], + 'image', + 'description', + 'landing_page', + ], 'display_settings' => [ - 'display_mode', - 'is_anchor', - 'available_sort_by', - 'use_config.available_sort_by', - 'default_sort_by', - 'use_config.default_sort_by', - 'filter_price_range', - 'use_config.filter_price_range', - ], + 'display_mode', + 'is_anchor', + 'available_sort_by', + 'use_config.available_sort_by', + 'default_sort_by', + 'use_config.default_sort_by', + 'filter_price_range', + 'use_config.filter_price_range', + ], 'search_engine_optimization' => [ - 'url_key', - 'url_key_create_redirect', - 'url_key_group', - 'meta_title', - 'meta_keywords', - 'meta_description', - ], + 'url_key', + 'url_key_create_redirect', + 'url_key_group', + 'meta_title', + 'meta_keywords', + 'meta_description', + ], 'assign_products' => [ - ], + ], 'design' => [ - 'custom_use_parent_settings', - 'custom_apply_to_products', - 'custom_design', - 'page_layout', - 'custom_layout_update', - 'custom_layout_update_file' - ], + 'custom_use_parent_settings', + 'custom_apply_to_products', + 'custom_design', + 'page_layout', + 'custom_layout_update', + 'custom_layout_update_file' + ], 'schedule_design_update' => [ - 'custom_design_from', - 'custom_design_to', - ], + 'custom_design_from', + 'custom_design_to', + ], 'category_view_optimization' => [ - ], + ], 'category_permissions' => [ - ], + ], ]; } @@ -671,53 +704,4 @@ private function getFields(): array $fieldsMap = $this->getFieldsMap(); return $this->arrayUtils->flatten($fieldsMap); } - - /** - * Retrieve scope overridden value - * - * @return ScopeOverriddenValue - * @deprecated 101.1.0 - */ - private function getScopeOverriddenValue(): ScopeOverriddenValue - { - if (null === $this->scopeOverriddenValue) { - $this->scopeOverriddenValue = \Magento\Framework\App\ObjectManager::getInstance()->get( - ScopeOverriddenValue::class - ); - } - - return $this->scopeOverriddenValue; - } - - /** - * Retrieve array manager - * - * @return ArrayManager - * @deprecated 101.1.0 - */ - private function getArrayManager(): ArrayManager - { - if (null === $this->arrayManager) { - $this->arrayManager = \Magento\Framework\App\ObjectManager::getInstance()->get( - ArrayManager::class - ); - } - - return $this->arrayManager; - } - - /** - * Get FileInfo instance - * - * @return FileInfo - * - * @deprecated 101.1.0 - */ - private function getFileInfo(): FileInfo - { - if ($this->fileInfo === null) { - $this->fileInfo = ObjectManager::getInstance()->get(FileInfo::class); - } - return $this->fileInfo; - } } diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Category/DataProviderTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Category/DataProviderTest.php index 4c3450d555f1d..349ecc55e288d 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Category/DataProviderTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Category/DataProviderTest.php @@ -5,85 +5,98 @@ */ namespace Magento\Catalog\Test\Unit\Model\Category; +use Magento\Catalog\Model\Category; +use Magento\Catalog\Model\Category\Attribute\Backend\Image; use Magento\Catalog\Model\Category\DataProvider; use Magento\Catalog\Model\Category\FileInfo; use Magento\Catalog\Model\CategoryFactory; use Magento\Catalog\Model\ResourceModel\Category\Collection; use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory; +use Magento\Catalog\Model\ResourceModel\Eav\Attribute; use Magento\Eav\Model\Config; use Magento\Eav\Model\Entity\Type; use Magento\Framework\App\RequestInterface; +use Magento\Framework\AuthorizationInterface; use Magento\Framework\Registry; +use Magento\Framework\Stdlib\ArrayUtils; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Store\Model\Store; use Magento\Store\Model\StoreManagerInterface; use Magento\Ui\DataProvider\EavValidationRules; use Magento\Ui\DataProvider\Modifier\PoolInterface; -use Magento\Framework\Stdlib\ArrayUtils; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class DataProviderTest extends \PHPUnit\Framework\TestCase +class DataProviderTest extends TestCase { /** - * @var EavValidationRules|\PHPUnit_Framework_MockObject_MockObject + * @var EavValidationRules|MockObject */ private $eavValidationRules; /** - * @var CollectionFactory|\PHPUnit_Framework_MockObject_MockObject + * @var CollectionFactory|MockObject */ private $categoryCollectionFactory; /** - * @var StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject + * @var StoreManagerInterface|MockObject */ private $storeManager; /** - * @var Registry|\PHPUnit_Framework_MockObject_MockObject + * @var Registry|MockObject */ private $registry; /** - * @var Config|\PHPUnit_Framework_MockObject_MockObject + * @var Config|MockObject */ private $eavConfig; /** - * @var RequestInterface|\PHPUnit_Framework_MockObject_MockObject + * @var RequestInterface|MockObject */ private $request; /** - * @var CategoryFactory|\PHPUnit_Framework_MockObject_MockObject + * @var CategoryFactory|MockObject */ private $categoryFactory; /** - * @var Collection|\PHPUnit_Framework_MockObject_MockObject + * @var Collection|MockObject */ private $collection; /** - * @var Type|\PHPUnit_Framework_MockObject_MockObject + * @var Type|MockObject */ private $eavEntityMock; /** - * @var FileInfo|\PHPUnit_Framework_MockObject_MockObject + * @var FileInfo|MockObject */ private $fileInfo; /** - * @var PoolInterface|\PHPUnit_Framework_MockObject_MockObject + * @var PoolInterface|MockObject */ private $modifierPool; /** - * @var ArrayUtils|\PHPUnit_Framework_MockObject_MockObject + * @var ArrayUtils|MockObject */ private $arrayUtils; + /** + * @var AuthorizationInterface|MockObject + */ + private $auth; + /** * @inheritDoc */ @@ -96,8 +109,7 @@ protected function setUp() $this->collection = $this->getMockBuilder(Collection::class) ->disableOriginalConstructor() ->getMock(); - $this->collection->expects($this->any()) - ->method('addAttributeToSelect') + $this->collection->method('addAttributeToSelect') ->with('*') ->willReturnSelf(); @@ -105,8 +117,7 @@ protected function setUp() ->disableOriginalConstructor() ->setMethods(['create']) ->getMock(); - $this->categoryCollectionFactory->expects($this->any()) - ->method('create') + $this->categoryCollectionFactory->method('create') ->willReturn($this->collection); $this->storeManager = $this->getMockBuilder(StoreManagerInterface::class) @@ -138,6 +149,8 @@ protected function setUp() $this->modifierPool = $this->getMockBuilder(PoolInterface::class)->getMockForAbstractClass(); + $this->auth = $this->getMockBuilder(AuthorizationInterface::class)->getMockForAbstractClass(); + $this->arrayUtils = $this->getMockBuilder(ArrayUtils::class) ->setMethods(['flatten']) ->disableOriginalConstructor()->getMock(); @@ -152,12 +165,11 @@ private function getModel() ->method('getAttributeCollection') ->willReturn([]); - $this->eavConfig->expects($this->any()) - ->method('getEntityType') + $this->eavConfig->method('getEntityType') ->with('catalog_category') ->willReturn($this->eavEntityMock); - $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $objectManager = new ObjectManager($this); /** @var DataProvider $model */ $model = $objectManager->getObject( @@ -171,6 +183,7 @@ private function getModel() 'request' => $this->request, 'categoryFactory' => $this->categoryFactory, 'pool' => $this->modifierPool, + 'auth' => $this->auth, 'arrayUtils' => $this->arrayUtils ] ); @@ -204,35 +217,30 @@ public function testGetDataNoFileExists() 'image' => $fileName, ]; - $imageBackendMock = $this->getMockBuilder(\Magento\Catalog\Model\Category\Attribute\Backend\Image::class) - ->disableOriginalConstructor() + $imageBackendMock = $this->getMockBuilder(Image::class)->disableOriginalConstructor() ->getMock(); - $attributeMock = $this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class) + $attributeMock = $this->getMockBuilder(Attribute::class) ->disableOriginalConstructor() ->getMock(); $attributeMock->expects($this->once()) ->method('getBackend') ->willReturn($imageBackendMock); - $categoryMock = $this->getMockBuilder(\Magento\Catalog\Model\Category::class) + $categoryMock = $this->getMockBuilder(Category::class) ->disableOriginalConstructor() ->getMock(); $categoryMock->expects($this->exactly(2)) ->method('getData') - ->willReturnMap( - [ - ['', null, $categoryData], - ['image', null, $categoryData['image']], - ] - ); - $categoryMock->expects($this->any()) - ->method('getExistsStoreValueFlag') + ->willReturnMap([ + ['', null, $categoryData], + ['image', null, $categoryData['image']], + ]); + $categoryMock->method('getExistsStoreValueFlag') ->with('url_key') ->willReturn(false); - $categoryMock->expects($this->any()) - ->method('getStoreId') - ->willReturn(\Magento\Store\Model\Store::DEFAULT_STORE_ID); + $categoryMock->method('getStoreId') + ->willReturn(Store::DEFAULT_STORE_ID); $categoryMock->expects($this->once()) ->method('getId') ->willReturn($categoryId); @@ -253,7 +261,7 @@ public function testGetDataNoFileExists() $model = $this->getModel(); $result = $model->getData(); - $this->assertTrue(is_array($result)); + $this->assertInternalType('array', $result); $this->assertArrayHasKey($categoryId, $result); $this->assertArrayNotHasKey('image', $result[$categoryId]); } @@ -280,35 +288,31 @@ public function testGetData() ], ]; - $imageBackendMock = $this->getMockBuilder(\Magento\Catalog\Model\Category\Attribute\Backend\Image::class) + $imageBackendMock = $this->getMockBuilder(Image::class) ->disableOriginalConstructor() ->getMock(); - $attributeMock = $this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class) + $attributeMock = $this->getMockBuilder(Attribute::class) ->disableOriginalConstructor() ->getMock(); $attributeMock->expects($this->once()) ->method('getBackend') ->willReturn($imageBackendMock); - $categoryMock = $this->getMockBuilder(\Magento\Catalog\Model\Category::class) + $categoryMock = $this->getMockBuilder(Category::class) ->disableOriginalConstructor() ->getMock(); $categoryMock->expects($this->exactly(2)) ->method('getData') - ->willReturnMap( - [ - ['', null, $categoryData], - ['image', null, $categoryData['image']], - ] - ); - $categoryMock->expects($this->any()) - ->method('getExistsStoreValueFlag') + ->willReturnMap([ + ['', null, $categoryData], + ['image', null, $categoryData['image']], + ]); + $categoryMock->method('getExistsStoreValueFlag') ->with('url_key') ->willReturn(false); - $categoryMock->expects($this->any()) - ->method('getStoreId') - ->willReturn(\Magento\Store\Model\Store::DEFAULT_STORE_ID); + $categoryMock->method('getStoreId') + ->willReturn(Store::DEFAULT_STORE_ID); $categoryMock->expects($this->once()) ->method('getId') ->willReturn($categoryId); @@ -340,7 +344,7 @@ public function testGetData() $model = $this->getModel(); $result = $model->getData(); - $this->assertTrue(is_array($result)); + $this->assertInternalType('array', $result); $this->assertArrayHasKey($categoryId, $result); $this->assertArrayHasKey('image', $result[$categoryId]); @@ -351,14 +355,14 @@ public function testGetMetaWithoutParentInheritanceResolving() { $this->arrayUtils->expects($this->atLeastOnce())->method('flatten')->willReturn([1,3,3]); - $categoryMock = $this->getMockBuilder(\Magento\Catalog\Model\Category::class) + $categoryMock = $this->getMockBuilder(Category::class) ->disableOriginalConstructor() ->getMock(); $this->registry->expects($this->atLeastOnce()) ->method('registry') ->with('category') ->willReturn($categoryMock); - $attributeMock = $this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class) + $attributeMock = $this->getMockBuilder(Attribute::class) ->disableOriginalConstructor() ->getMock(); $categoryMock->expects($this->once()) diff --git a/app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml b/app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml index f2afef1215017..d3689a0db1306 100644 --- a/app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml +++ b/app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml @@ -354,7 +354,6 @@ <additionalClasses> <class name="admin__field-small">true</class> </additionalClasses> - <addBefore>$</addBefore> <label translate="true">Layered Navigation Price Step</label> </settings> </field> From 2a5c87ce994e8aa0e8fe206d0af0be64606bd5dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Szubert?= <bartlomiejszubert@gmail.com> Date: Thu, 3 Oct 2019 15:32:59 +0200 Subject: [PATCH 0279/1143] Fix #21684 - fix class imported --- app/code/Magento/Catalog/Model/Category/DataProvider.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Category/DataProvider.php b/app/code/Magento/Catalog/Model/Category/DataProvider.php index e4fa897e65b67..efa65246fc3d8 100644 --- a/app/code/Magento/Catalog/Model/Category/DataProvider.php +++ b/app/code/Magento/Catalog/Model/Category/DataProvider.php @@ -23,7 +23,6 @@ use Magento\Framework\App\RequestInterface; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Exception\NoSuchEntityException; -use Magento\Framework\Filesystem; use Magento\Framework\Registry; use Magento\Framework\Stdlib\ArrayManager; use Magento\Framework\Stdlib\ArrayUtils; @@ -168,7 +167,7 @@ class DataProvider extends ModifierPoolDataProvider private $arrayUtils; /** - * @var Filesystem + * @var FileInfo */ private $fileInfo; @@ -195,7 +194,7 @@ class DataProvider extends ModifierPoolDataProvider * @param ArrayUtils|null $arrayUtils * @param ScopeOverriddenValue|null $scopeOverriddenValue * @param ArrayManager|null $arrayManager - * @param Filesystem|null $fileInfo + * @param FileInfo|null $fileInfo * @throws LocalizedException * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -217,7 +216,7 @@ public function __construct( ?ArrayUtils $arrayUtils = null, ScopeOverriddenValue $scopeOverriddenValue = null, ArrayManager $arrayManager = null, - Filesystem $fileInfo = null + FileInfo $fileInfo = null ) { $this->eavValidationRules = $eavValidationRules; $this->collection = $categoryCollectionFactory->create(); @@ -232,7 +231,7 @@ public function __construct( $this->scopeOverriddenValue = $scopeOverriddenValue ?: ObjectManager::getInstance()->get(ScopeOverriddenValue::class); $this->arrayManager = $arrayManager ?: ObjectManager::getInstance()->get(ArrayManager::class); - $this->fileInfo = $fileInfo ?: ObjectManager::getInstance()->get(Filesystem::class); + $this->fileInfo = $fileInfo ?: ObjectManager::getInstance()->get(FileInfo::class); parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data, $pool); } From d3515492bc36c960ca41e201d06a81725df03b2b Mon Sep 17 00:00:00 2001 From: Nazarn96 <nazarn96@gmail.com> Date: Mon, 7 Oct 2019 16:03:03 +0300 Subject: [PATCH 0280/1143] Fix health index, and static test. --- .../Unit/Model/Category/DataProviderTest.php | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Category/DataProviderTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Category/DataProviderTest.php index 349ecc55e288d..4ce50537f27bd 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Category/DataProviderTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Category/DataProviderTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Test\Unit\Model\Category; use Magento\Catalog\Model\Category; @@ -232,10 +233,12 @@ public function testGetDataNoFileExists() ->getMock(); $categoryMock->expects($this->exactly(2)) ->method('getData') - ->willReturnMap([ - ['', null, $categoryData], - ['image', null, $categoryData['image']], - ]); + ->willReturnMap( + [ + ['', null, $categoryData], + ['image', null, $categoryData['image']], + ] + ); $categoryMock->method('getExistsStoreValueFlag') ->with('url_key') ->willReturn(false); @@ -304,10 +307,12 @@ public function testGetData() ->getMock(); $categoryMock->expects($this->exactly(2)) ->method('getData') - ->willReturnMap([ - ['', null, $categoryData], - ['image', null, $categoryData['image']], - ]); + ->willReturnMap( + [ + ['', null, $categoryData], + ['image', null, $categoryData['image']], + ] + ); $categoryMock->method('getExistsStoreValueFlag') ->with('url_key') ->willReturn(false); From 46ebfa5b535ead3bc8a63769ce6922016a3b18f4 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Mon, 9 Dec 2019 15:07:58 -0600 Subject: [PATCH 0281/1143] Change action groups name according to CE branch changes --- .../ActionGroup/GoToSpecifiedCreateProductPageActionGroup.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToSpecifiedCreateProductPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToSpecifiedCreateProductPageActionGroup.xml index 26041974dbc80..acbe990ad4c8c 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToSpecifiedCreateProductPageActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/GoToSpecifiedCreateProductPageActionGroup.xml @@ -16,7 +16,7 @@ <argument type="string" name="productType" defaultValue="simple"/> </arguments> - <comment userInput="actionGroup:GoToSpecifiedCreateProductPage" stepKey="actionGroupComment"/> + <comment userInput="actionGroup:GoToSpecifiedCreateProductPageActionGroup" stepKey="actionGroupComment"/> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductDropdown"/> <click selector="{{AdminProductGridActionSection.addTypeProduct(productType)}}" stepKey="clickAddProduct"/> From 9c4c965d82a076be62667c38f70c81af3a71b7a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Szubert?= <bartlomiejszubert@gmail.com> Date: Mon, 9 Dec 2019 22:12:47 +0100 Subject: [PATCH 0282/1143] Fix #21684 - code style fix --- app/code/Magento/Catalog/Model/Category/DataProvider.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Category/DataProvider.php b/app/code/Magento/Catalog/Model/Category/DataProvider.php index efa65246fc3d8..fe7258398d191 100644 --- a/app/code/Magento/Catalog/Model/Category/DataProvider.php +++ b/app/code/Magento/Catalog/Model/Category/DataProvider.php @@ -12,6 +12,7 @@ use Magento\Catalog\Model\Attribute\ScopeOverriddenValue; use Magento\Catalog\Model\Category; use Magento\Catalog\Model\Category\Attribute\Backend\Image as ImageBackendModel; +use Magento\Catalog\Model\Category\Attribute\Backend\LayoutUpdate; use Magento\Catalog\Model\CategoryFactory; use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory as CategoryCollectionFactory; use Magento\Catalog\Model\ResourceModel\Eav\Attribute as EavAttribute; @@ -195,7 +196,6 @@ class DataProvider extends ModifierPoolDataProvider * @param ScopeOverriddenValue|null $scopeOverriddenValue * @param ArrayManager|null $arrayManager * @param FileInfo|null $fileInfo - * @throws LocalizedException * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -484,7 +484,7 @@ protected function addUseConfigSettings($categoryData) /** * Add use default settings * - * @param \Magento\Catalog\Model\Category $category + * @param Category $category * @param array $categoryData * @return array * @deprecated 101.1.0 @@ -572,7 +572,7 @@ protected function filterFields($categoryData) /** * Converts category image data to acceptable for rendering format * - * @param \Magento\Catalog\Model\Category $category + * @param Category $category * @param array $categoryData * @return array */ @@ -582,7 +582,7 @@ private function convertValues($category, $categoryData): array if ($attributeCode === 'custom_layout_update_file') { if (!empty($categoryData['custom_layout_update'])) { $categoryData['custom_layout_update_file'] - = \Magento\Catalog\Model\Category\Attribute\Backend\LayoutUpdate::VALUE_USE_UPDATE_XML; + = LayoutUpdate::VALUE_USE_UPDATE_XML; } } if (!isset($categoryData[$attributeCode])) { From 46bfa6a6d301569d1f75160bea8655f5cdb1d16e Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@adobe.com> Date: Mon, 9 Dec 2019 14:25:11 -0600 Subject: [PATCH 0283/1143] MQE-1878: Stabilize community PR 742 --- .../StorefrontCustomerWishlistActionGroup.xml | 43 +++++++++++++++++++ ...eProductFromShoppingCartToWishlistTest.xml | 25 ++++++----- ...eProductFromShoppingCartToWishlistTest.xml | 25 ++++++----- ...eProductFromShoppingCartToWishlistTest.xml | 25 ++++++----- ...lProductFromShoppingCartToWishlistTest.xml | 16 +++---- 5 files changed, 86 insertions(+), 48 deletions(-) diff --git a/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerWishlistActionGroup.xml b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerWishlistActionGroup.xml index 4c1c088c102cd..5568f255304a7 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerWishlistActionGroup.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerWishlistActionGroup.xml @@ -135,4 +135,47 @@ <dontSeeElement selector="{{StorefrontCustomerWishlistProductSection.pager}}" stepKey="checkThatPagerIsAbsent"/> <see selector="{{StorefrontCustomerWishlistProductSection.wishlistEmpty}}" userInput="You have no items in your wish list." stepKey="checkNoItemsMessage"/> </actionGroup> + + <actionGroup name="AssertMoveProductToWishListSuccessMessage"> + <annotations> + <description>Moves a product from the cart to the wishlist.</description> + </annotations> + <arguments> + <argument name="productName" type="string"/> + </arguments> + <click selector="{{CheckoutCartProductSection.moveToWishlistByProductName(productName)}}" stepKey="moveToWishlist"/> + <waitForPageLoad stepKey="waitForMove"/> + <see userInput="{{productName}} has been moved to your wish list." selector="{{CheckoutCartMessageSection.successMessage}}" stepKey="assertSuccess"/> + </actionGroup> + + <actionGroup name="AssertProductIsPresentInWishList"> + <annotations> + <description>Go to storefront customer wishlist page and assert product name and price is present.</description> + </annotations> + <arguments> + <argument name="productName" type="string"/> + <argument name="productPrice" type="string"/> + </arguments> + <amOnPage url="{{StorefrontCustomerWishlistPage.url}}" stepKey="goToWishList"/> + <waitForPageLoad stepKey="waitForWishList"/> + <waitForElement selector="{{StorefrontCustomerWishlistProductSection.ProductTitleByName(productName)}}" time="30" stepKey="assertProductName"/> + <see userInput="{{productPrice}}" selector="{{StorefrontCustomerWishlistProductSection.ProductPriceByName(productName)}}" stepKey="assertProductPrice"/> + </actionGroup> + + <actionGroup name="AssertProductDetailsInWishlist"> + <annotations> + <description>Assert product name and price in wishlist on hover.</description> + </annotations> + <arguments> + <argument name="productName" type="string"/> + <argument name="label" type="string"/> + <argument name="labelValue" type="string"/> + </arguments> + <moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.ProductInfoByName(productName)}}" stepKey="moveMouseOverProductInfo"/> + <seeElement selector="{{StorefrontCustomerWishlistProductSection.ProductAddToCartByName(productName)}}" stepKey="seeAddToCart"/> + <seeElement selector="{{StorefrontCustomerWishlistProductSection.ProductImageByName(productName)}}" stepKey="seeImage"/> + <moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.productSeeDetailsByName(productName)}}" stepKey="moveMouseOverProductDetails"/> + <see userInput="{{label}}" selector="{{StorefrontCustomerWishlistProductSection.productSeeDetailsLabelByName(productName)}}" stepKey="seeLabel"/> + <see userInput="{{labelValue}}" selector="{{StorefrontCustomerWishlistProductSection.productSeeDetailsValueByName(productName)}}" stepKey="seeLabelValue"/> + </actionGroup> </actionGroups> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveConfigurableProductFromShoppingCartToWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveConfigurableProductFromShoppingCartToWishlistTest.xml index 317f937def3f1..49cd78ec1884f 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveConfigurableProductFromShoppingCartToWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveConfigurableProductFromShoppingCartToWishlistTest.xml @@ -141,23 +141,22 @@ <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="selectViewAndEditCart"/> <!-- Assert move product to wishlist success message --> - <click selector="{{CheckoutCartProductSection.moveToWishlistByProductName($$createConfigProduct.name$$)}}" stepKey="moveToWishlist"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <see userInput="$$createConfigProduct.name$$ has been moved to your wish list." selector="{{CheckoutCartMessageSection.successMessage}}" stepKey="assertMoveProductToWishlistSuccessMessage"/> + <actionGroup ref="AssertMoveProductToWishListSuccessMessage" stepKey="moveToWishlist"> + <argument name="productName" value="$$createConfigProduct.name$$"/> + </actionGroup> <!-- Assert product is present in wishlist --> - <amOnPage url="{{StorefrontCustomerWishlistPage.url}}" stepKey="goToWishlistPage"/> - <waitForPageLoad stepKey="waitForWishlistPage"/> - <waitForElement selector="{{StorefrontCustomerWishlistProductSection.ProductTitleByName($$createConfigProduct.name$$)}}" time="30" stepKey="assertWishlistProductName"/> - <see userInput="$20.00" selector="{{StorefrontCustomerWishlistProductSection.ProductPriceByName($$createConfigProduct.name$$)}}" stepKey="AssertWishlistProductPrice"/> + <actionGroup ref="AssertProductIsPresentInWishList" stepKey="assertProductPresent"> + <argument name="productName" value="$$createConfigProduct.name$$"/> + <argument name="productPrice" value="$20.00"/> + </actionGroup> <!-- Assert product details in Wishlist --> - <moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.ProductInfoByName($$createConfigProduct.name$$)}}" stepKey="wishlistMoveMouseOverProduct"/> - <seeElement selector="{{StorefrontCustomerWishlistProductSection.ProductAddToCartByName($$createConfigProduct.name$$)}}" stepKey="AssertWishlistAddToCart"/> - <seeElement selector="{{StorefrontCustomerWishlistProductSection.ProductImageByName($$createConfigProduct.name$$)}}" stepKey="AssertWishlistProductImage"/> - <moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.productSeeDetailsByName($$createConfigProduct.name$$)}}" stepKey="seeDetailsMoveMouseOverProduct"/> - <see userInput="$$createConfigProductAttribute.default_value$$" selector="{{StorefrontCustomerWishlistProductSection.productSeeDetailsLabelByName($$createConfigProduct.name$$)}}" stepKey="seeAttribute"/> - <see userInput="$$getConfigAttributeOption2.label$$" selector="{{StorefrontCustomerWishlistProductSection.productSeeDetailsValueByName($$createConfigProduct.name$$)}}" stepKey="seeOption"/> + <actionGroup ref="AssertProductDetailsInWishlist" stepKey="assertProductDetails"> + <argument name="productName" value="$$createConfigProduct.name$$"/> + <argument name="label" value="$$createConfigProductAttribute.default_value$$"/> + <argument name="labelValue" value="$$getConfigAttributeOption2.label$$"/> + </actionGroup> <actionGroup ref="AssertShoppingCartIsEmptyActionGroup" stepKey="assertCartIsEmpty"/> </test> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveDynamicBundleProductFromShoppingCartToWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveDynamicBundleProductFromShoppingCartToWishlistTest.xml index dcd69a61e596f..856ebdb7bb73a 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveDynamicBundleProductFromShoppingCartToWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveDynamicBundleProductFromShoppingCartToWishlistTest.xml @@ -87,23 +87,22 @@ <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="selectViewAndEditCart"/> <!-- Assert move product to wishlist success message --> - <click selector="{{CheckoutCartProductSection.moveToWishlistByProductName($$createBundleProduct.name$$)}}" stepKey="moveToWishlist"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <see userInput="$$createBundleProduct.name$$ has been moved to your wish list." selector="{{CheckoutCartMessageSection.successMessage}}" stepKey="assertMoveProductToWishlistSuccessMessage"/> + <actionGroup ref="AssertMoveProductToWishListSuccessMessage" stepKey="moveToWishlist"> + <argument name="productName" value="$$createBundleProduct.name$$"/> + </actionGroup> <!-- Assert product is present in wishlist --> - <amOnPage url="{{StorefrontCustomerWishlistPage.url}}" stepKey="goToWishlistPage"/> - <waitForPageLoad stepKey="waitForWishlistPage"/> - <waitForElement selector="{{StorefrontCustomerWishlistProductSection.ProductTitleByName($$createBundleProduct.name$$)}}" time="30" stepKey="assertWishlistProductName"/> - <see userInput="$100.00" selector="{{StorefrontCustomerWishlistProductSection.ProductPriceByName($$createBundleProduct.name$$)}}" stepKey="AssertWishlistProductPrice"/> + <actionGroup ref="AssertProductIsPresentInWishList" stepKey="assertProductPresent"> + <argument name="productName" value="$$createBundleProduct.name$$"/> + <argument name="productPrice" value="$100.00"/> + </actionGroup> <!-- Assert product details in Wishlist --> - <moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.ProductInfoByName($$createBundleProduct.name$$)}}" stepKey="wishlistMoveMouseOverProduct"/> - <seeElement selector="{{StorefrontCustomerWishlistProductSection.ProductAddToCartByName($$createBundleProduct.name$$)}}" stepKey="AssertWishlistAddToCart"/> - <seeElement selector="{{StorefrontCustomerWishlistProductSection.ProductImageByName($$createBundleProduct.name$$)}}" stepKey="AssertWishlistProductImage"/> - <moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.productSeeDetailsByName($$createBundleProduct.name$$)}}" stepKey="seeDetailsMoveMouseOverProduct"/> - <see userInput="$$createBundleOption1_1.title$$" selector="{{StorefrontCustomerWishlistProductSection.productSeeDetailsLabelByName($$createBundleProduct.name$$)}}" stepKey="seeBundleOption"/> - <see userInput="$$simpleProduct1.sku$$ $100.00" selector="{{StorefrontCustomerWishlistProductSection.productSeeDetailsValueByName($$createBundleProduct.name$$)}}" stepKey="seeProduct"/> + <actionGroup ref="AssertProductDetailsInWishlist" stepKey="assertProductDetails"> + <argument name="productName" value="$$createBundleProduct.name$$"/> + <argument name="label" value="$$createBundleOption1_1.title$$"/> + <argument name="labelValue" value="$$simpleProduct1.sku$$ $100.00"/> + </actionGroup> <actionGroup ref="AssertShoppingCartIsEmptyActionGroup" stepKey="assertCartIsEmpty"/> </test> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveFixedBundleProductFromShoppingCartToWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveFixedBundleProductFromShoppingCartToWishlistTest.xml index 4d99b05e9aa6a..9c3984d0287ec 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveFixedBundleProductFromShoppingCartToWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveFixedBundleProductFromShoppingCartToWishlistTest.xml @@ -78,23 +78,22 @@ <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="selectViewAndEditCart"/> <!-- Assert move product to wishlist success message --> - <click selector="{{CheckoutCartProductSection.moveToWishlistByProductName($$createBundleProduct.name$$)}}" stepKey="moveToWishlist"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <see userInput="$$createBundleProduct.name$$ has been moved to your wish list." selector="{{CheckoutCartMessageSection.successMessage}}" stepKey="assertMoveProductToWishlistSuccessMessage"/> + <actionGroup ref="AssertMoveProductToWishListSuccessMessage" stepKey="moveToWishlist"> + <argument name="productName" value="$$createBundleProduct.name$$"/> + </actionGroup> <!-- Assert product is present in wishlist --> - <amOnPage url="{{StorefrontCustomerWishlistPage.url}}" stepKey="goToWishlistPage"/> - <waitForPageLoad stepKey="waitForWishlistPage"/> - <waitForElement selector="{{StorefrontCustomerWishlistProductSection.ProductTitleByName($$createBundleProduct.name$$)}}" time="30" stepKey="assertWishlistProductName"/> - <see userInput="$101.23" selector="{{StorefrontCustomerWishlistProductSection.ProductPriceByName($$createBundleProduct.name$$)}}" stepKey="AssertWishlistProductPrice"/> + <actionGroup ref="AssertProductIsPresentInWishList" stepKey="assertProductPresent"> + <argument name="productName" value="$$createBundleProduct.name$$"/> + <argument name="productPrice" value="$101.23"/> + </actionGroup> <!-- Assert product details in Wishlist --> - <moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.ProductInfoByName($$createBundleProduct.name$$)}}" stepKey="wishlistMoveMouseOverProduct"/> - <seeElement selector="{{StorefrontCustomerWishlistProductSection.ProductAddToCartByName($$createBundleProduct.name$$)}}" stepKey="AssertWishlistAddToCart"/> - <seeElement selector="{{StorefrontCustomerWishlistProductSection.ProductImageByName($$createBundleProduct.name$$)}}" stepKey="AssertWishlistProductImage"/> - <moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.productSeeDetailsByName($$createBundleProduct.name$$)}}" stepKey="seeDetailsMoveMouseOverProduct"/> - <see userInput="$$createBundleOption1_1.title$$" selector="{{StorefrontCustomerWishlistProductSection.productSeeDetailsLabelByName($$createBundleProduct.name$$)}}" stepKey="seeBundleOption"/> - <see userInput="$$simpleProduct1.sku$$ $100.00" selector="{{StorefrontCustomerWishlistProductSection.productSeeDetailsValueByName($$createBundleProduct.name$$)}}" stepKey="seeProduct"/> + <actionGroup ref="AssertProductDetailsInWishlist" stepKey="assertProductDetails"> + <argument name="productName" value="$$createBundleProduct.name$$"/> + <argument name="label" value="$$createBundleOption1_1.title$$"/> + <argument name="labelValue" value="$$simpleProduct1.sku$$ $100.00"/> + </actionGroup> <actionGroup ref="AssertShoppingCartIsEmptyActionGroup" stepKey="assertCartIsEmpty"/> </test> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveVirtualProductFromShoppingCartToWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveVirtualProductFromShoppingCartToWishlistTest.xml index baaae80f7d081..20ac78dfbf731 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveVirtualProductFromShoppingCartToWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveVirtualProductFromShoppingCartToWishlistTest.xml @@ -53,16 +53,14 @@ <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="selectViewAndEditCart"/> <!-- Assert move product to wishlist success message --> - <click selector="{{CheckoutCartProductSection.moveToWishlistByProductName($$createProduct.name$$)}}" stepKey="moveToWishlist"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <see userInput="$$createProduct.name$$ has been moved to your wish list." selector="{{CheckoutCartMessageSection.successMessage}}" stepKey="assertMoveProductToWishlistSuccessMessage"/> - - <!-- Assert product is present in wishlist --> - <amOnPage url="{{StorefrontCustomerWishlistPage.url}}" stepKey="goToWishlistPage"/> - <waitForPageLoad stepKey="waitForWishlistPage"/> + <actionGroup ref="AssertMoveProductToWishListSuccessMessage" stepKey="moveToWishlist"> + <argument name="productName" value="$$createProduct.name$$"/> + </actionGroup> - <actionGroup ref="StorefrontCustomerCheckProductInWishlist" stepKey="assertProductIsPresentInWishlist"> - <argument name="productVar" value="$$createProduct$$"/> + <!-- Assert product is present in wishlist --> + <actionGroup ref="AssertProductIsPresentInWishList" stepKey="assertProductPresent"> + <argument name="productName" value="$$createProduct.name$$"/> + <argument name="productPrice" value="$$createProduct.price$$"/> </actionGroup> <!-- Assert cart is empty --> From d19de1ac568f7d0e54a53adca686926c6df38d6c Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Mon, 9 Dec 2019 15:46:49 -0600 Subject: [PATCH 0284/1143] Change action groups name according to CE branch changes --- .../Test/Mftf/ActionGroup/AddUpSellProductBySkuActionGroup.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddUpSellProductBySkuActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddUpSellProductBySkuActionGroup.xml index b107aab956beb..0ba6b479885e3 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddUpSellProductBySkuActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddUpSellProductBySkuActionGroup.xml @@ -10,7 +10,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="AddUpSellProductBySkuActionGroup" extends="AddRelatedProductBySkuActionGroup"> <annotations> - <description>EXTENDS: addRelatedProductBySku. Add the provided Product as an Up Sell Product.</description> + <description>EXTENDS: AddRelatedProductBySkuActionGroup. Add the provided Product as an Up Sell Product.</description> </annotations> <click selector="{{AdminProductFormRelatedUpSellCrossSellSection.AddUpSellProductsButton}}" stepKey="clickAddRelatedProductButton"/> From 41aad64a1aedc6be608ab624069e15860bb8c734 Mon Sep 17 00:00:00 2001 From: Dan Wallis <mrdanwallis@gmail.com> Date: Mon, 9 Dec 2019 22:19:40 +0000 Subject: [PATCH 0285/1143] Update values to make linter happy --- .../adminhtml/Magento/backend/web/css/source/_actions.less | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/design/adminhtml/Magento/backend/web/css/source/_actions.less b/app/design/adminhtml/Magento/backend/web/css/source/_actions.less index 28912d873ae00..c86e9cdbf0866 100644 --- a/app/design/adminhtml/Magento/backend/web/css/source/_actions.less +++ b/app/design/adminhtml/Magento/backend/web/css/source/_actions.less @@ -446,12 +446,12 @@ button { } &::after { - border-color: transparent transparent transparent #000; + border-color: transparent transparent transparent @color-black; border-style: solid; - border-width: 0.4rem 0 0.4rem 0.5rem; + border-width: .4rem 0 .4rem .5rem; content: ''; height: 0; - margin-top: -0.2rem; + margin-top: -.2rem; position: absolute; right: 1rem; top: 50%; From 8039f7498e4e1edca652fab745a52f1816d69584 Mon Sep 17 00:00:00 2001 From: Dmytro Poperechnyy <dpoperechnyy@magento.com> Date: Mon, 9 Dec 2019 19:04:18 -0600 Subject: [PATCH 0286/1143] MC-23411: Random failure of PAT builds --- setup/src/Magento/Setup/Fixtures/_files/dictionary.csv | 2 +- .../Setup/Model/Address/AddressDataGenerator.php | 2 +- setup/src/Magento/Setup/Model/DataGenerator.php | 10 +++++----- .../Setup/Model/Description/DescriptionGenerator.php | 2 +- .../Description/DescriptionParagraphGenerator.php | 2 +- .../Model/Description/DescriptionSentenceGenerator.php | 2 +- .../Setup/Model/Description/Mixin/BoldMixin.php | 2 +- .../Description/Mixin/Helper/RandomWordSelector.php | 2 +- .../Setup/Model/Description/Mixin/ItalicMixin.php | 2 +- .../Setup/Model/Description/Mixin/SpanMixin.php | 2 +- setup/src/Magento/Setup/Model/Dictionary.php | 2 +- 11 files changed, 15 insertions(+), 15 deletions(-) diff --git a/setup/src/Magento/Setup/Fixtures/_files/dictionary.csv b/setup/src/Magento/Setup/Fixtures/_files/dictionary.csv index c839b7c46f51c..ba188534a3e24 100644 --- a/setup/src/Magento/Setup/Fixtures/_files/dictionary.csv +++ b/setup/src/Magento/Setup/Fixtures/_files/dictionary.csv @@ -7370,4 +7370,4 @@ Gregory pine borrowed bow -disturbing \ No newline at end of file +disturbing diff --git a/setup/src/Magento/Setup/Model/Address/AddressDataGenerator.php b/setup/src/Magento/Setup/Model/Address/AddressDataGenerator.php index 1bbd152f2ba4e..2d450a4374c5e 100644 --- a/setup/src/Magento/Setup/Model/Address/AddressDataGenerator.php +++ b/setup/src/Magento/Setup/Model/Address/AddressDataGenerator.php @@ -18,7 +18,7 @@ class AddressDataGenerator public function generateAddress() { return [ - 'postcode' => random_int(10000, 99999) + 'postcode' => mt_rand(10000, 99999) ]; } } diff --git a/setup/src/Magento/Setup/Model/DataGenerator.php b/setup/src/Magento/Setup/Model/DataGenerator.php index 540433e5aa3ec..c7c975f2d993d 100644 --- a/setup/src/Magento/Setup/Model/DataGenerator.php +++ b/setup/src/Magento/Setup/Model/DataGenerator.php @@ -4,11 +4,11 @@ * See COPYING.txt for license details. */ -/** - * A custom adapter that allows generating arbitrary descriptions - */ namespace Magento\Setup\Model; +/** + * A custom adapter that allows generating arbitrary descriptions. + */ class DataGenerator { /** @@ -67,12 +67,12 @@ protected function readData() */ public function generate($minAmountOfWords, $maxAmountOfWords, $key = null) { - $numberOfWords = random_int($minAmountOfWords, $maxAmountOfWords); + $numberOfWords = mt_rand($minAmountOfWords, $maxAmountOfWords); $result = ''; if ($key === null || !array_key_exists($key, $this->generatedValues)) { for ($i = 0; $i < $numberOfWords; $i++) { - $result .= ' ' . $this->dictionaryData[random_int(0, count($this->dictionaryData) - 1)]; + $result .= ' ' . $this->dictionaryData[mt_rand(0, count($this->dictionaryData) - 1)]; } $result = trim($result); diff --git a/setup/src/Magento/Setup/Model/Description/DescriptionGenerator.php b/setup/src/Magento/Setup/Model/Description/DescriptionGenerator.php index a790bfdbe608d..807e1fde7d90d 100644 --- a/setup/src/Magento/Setup/Model/Description/DescriptionGenerator.php +++ b/setup/src/Magento/Setup/Model/Description/DescriptionGenerator.php @@ -63,7 +63,7 @@ public function generate() */ private function generateRawDescription() { - $paragraphsCount = random_int( + $paragraphsCount = mt_rand( $this->descriptionConfig['paragraphs']['count-min'], $this->descriptionConfig['paragraphs']['count-max'] ); diff --git a/setup/src/Magento/Setup/Model/Description/DescriptionParagraphGenerator.php b/setup/src/Magento/Setup/Model/Description/DescriptionParagraphGenerator.php index 57ece1f9558c3..50544e6ea9726 100644 --- a/setup/src/Magento/Setup/Model/Description/DescriptionParagraphGenerator.php +++ b/setup/src/Magento/Setup/Model/Description/DescriptionParagraphGenerator.php @@ -39,7 +39,7 @@ public function __construct( */ public function generate() { - $sentencesCount = random_int( + $sentencesCount = mt_rand( $this->paragraphConfig['sentences']['count-min'], $this->paragraphConfig['sentences']['count-max'] ); diff --git a/setup/src/Magento/Setup/Model/Description/DescriptionSentenceGenerator.php b/setup/src/Magento/Setup/Model/Description/DescriptionSentenceGenerator.php index 10b07e7e1c7a2..299b4b50bed0f 100644 --- a/setup/src/Magento/Setup/Model/Description/DescriptionSentenceGenerator.php +++ b/setup/src/Magento/Setup/Model/Description/DescriptionSentenceGenerator.php @@ -39,7 +39,7 @@ public function __construct( */ public function generate() { - $sentenceWordsCount = random_int( + $sentenceWordsCount = mt_rand( $this->sentenceConfig['words']['count-min'], $this->sentenceConfig['words']['count-max'] ); diff --git a/setup/src/Magento/Setup/Model/Description/Mixin/BoldMixin.php b/setup/src/Magento/Setup/Model/Description/Mixin/BoldMixin.php index 927759c4bfa7c..db208adc67de8 100644 --- a/setup/src/Magento/Setup/Model/Description/Mixin/BoldMixin.php +++ b/setup/src/Magento/Setup/Model/Description/Mixin/BoldMixin.php @@ -48,7 +48,7 @@ public function apply($text) return $this->wordWrapper->wrapWords( $text, - $this->randomWordSelector->getRandomWords($rawText, random_int(5, 8)), + $this->randomWordSelector->getRandomWords($rawText, mt_rand(5, 8)), '<b>%s</b>' ); } diff --git a/setup/src/Magento/Setup/Model/Description/Mixin/Helper/RandomWordSelector.php b/setup/src/Magento/Setup/Model/Description/Mixin/Helper/RandomWordSelector.php index c7efcc7f12e0f..0598db218728f 100644 --- a/setup/src/Magento/Setup/Model/Description/Mixin/Helper/RandomWordSelector.php +++ b/setup/src/Magento/Setup/Model/Description/Mixin/Helper/RandomWordSelector.php @@ -27,7 +27,7 @@ public function getRandomWords($source, $count) $randWords = []; $wordsSize = count($words); while ($count) { - $randWords[] = $words[random_int(0, $wordsSize - 1)]; + $randWords[] = $words[mt_rand(0, $wordsSize - 1)]; $count--; } diff --git a/setup/src/Magento/Setup/Model/Description/Mixin/ItalicMixin.php b/setup/src/Magento/Setup/Model/Description/Mixin/ItalicMixin.php index 7621bccf08773..87e033be330cf 100644 --- a/setup/src/Magento/Setup/Model/Description/Mixin/ItalicMixin.php +++ b/setup/src/Magento/Setup/Model/Description/Mixin/ItalicMixin.php @@ -48,7 +48,7 @@ public function apply($text) return $this->wordWrapper->wrapWords( $text, - $this->randomWordSelector->getRandomWords($rawText, random_int(5, 8)), + $this->randomWordSelector->getRandomWords($rawText, mt_rand(5, 8)), '<i>%s</i>' ); } diff --git a/setup/src/Magento/Setup/Model/Description/Mixin/SpanMixin.php b/setup/src/Magento/Setup/Model/Description/Mixin/SpanMixin.php index fe53ebef535a8..ed5a836129460 100644 --- a/setup/src/Magento/Setup/Model/Description/Mixin/SpanMixin.php +++ b/setup/src/Magento/Setup/Model/Description/Mixin/SpanMixin.php @@ -48,7 +48,7 @@ public function apply($text) return $this->wordWrapper->wrapWords( $text, - $this->randomWordSelector->getRandomWords($rawText, random_int(5, 8)), + $this->randomWordSelector->getRandomWords($rawText, mt_rand(5, 8)), '<span>%s</span>' ); } diff --git a/setup/src/Magento/Setup/Model/Dictionary.php b/setup/src/Magento/Setup/Model/Dictionary.php index 52f7cc1bb5148..630d35092d0fc 100644 --- a/setup/src/Magento/Setup/Model/Dictionary.php +++ b/setup/src/Magento/Setup/Model/Dictionary.php @@ -40,7 +40,7 @@ public function getRandWord() $this->readDictionary(); } - $randIndex = random_int(0, count($this->dictionary) - 1); + $randIndex = mt_rand(0, count($this->dictionary) - 1); return trim($this->dictionary[$randIndex]); } From 08f3f7fb14fcd3a4ee97253e7c3091b029d0ccb2 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Mon, 9 Dec 2019 22:42:03 -0600 Subject: [PATCH 0287/1143] Change action groups name according to CE branch changes --- ...igateToNewOrderPageExistingCustomerAndStoreActionGroup.xml | 4 ++-- .../Magento/Tax/Test/Mftf/Test/CheckCreditMemoTotalsTest.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/NavigateToNewOrderPageExistingCustomerAndStoreActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/NavigateToNewOrderPageExistingCustomerAndStoreActionGroup.xml index 08f70f69013f3..883f1047feb79 100644 --- a/app/code/Magento/Sales/Test/Mftf/ActionGroup/NavigateToNewOrderPageExistingCustomerAndStoreActionGroup.xml +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/NavigateToNewOrderPageExistingCustomerAndStoreActionGroup.xml @@ -8,9 +8,9 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="NavigateToNewOrderPageExistingCustomerAndStoreActionGroup" extends="navigateToNewOrderPageExistingCustomer"> + <actionGroup name="NavigateToNewOrderPageExistingCustomerAndStoreActionGroup" extends="NavigateToNewOrderPageExistingCustomerActionGroup"> <annotations> - <description>EXTENDS: navigateToNewOrderPageExistingCustomer. Clicks on the provided Store View.</description> + <description>EXTENDS: NavigateToNewOrderPageExistingCustomerActionGroup. Clicks on the provided Store View.</description> </annotations> <arguments> <argument name="storeView" defaultValue="_defaultStore"/> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/CheckCreditMemoTotalsTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/CheckCreditMemoTotalsTest.xml index 8cd6fc03a402a..e7964a2dd29eb 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/CheckCreditMemoTotalsTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/CheckCreditMemoTotalsTest.xml @@ -112,7 +112,7 @@ <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickAddSelectedProducts"/> <waitForPageLoad stepKey="waitForPageLoad3"/> <!--Set shipping method--> - <actionGroup stepKey="orderSelectFlatRateShipping" ref="OrderSelectFlatRateShippingActionGroup"/> + <actionGroup stepKey="OrderSelectFlatRateShippingActionGroup" ref="OrderSelectFlatRateShippingActionGroup"/> <!--Submit order--> <click stepKey="SubmitOrder" selector="{{AdminOrderFormActionSection.SubmitOrder}}"/> <waitForPageLoad stepKey="waitForPageLoad4"/> From 393ef91131c4649784a887abe42cb242921d94e8 Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Tue, 10 Dec 2019 10:11:19 +0200 Subject: [PATCH 0288/1143] MC-5233: DateTime product attributes support --- .../Unit/Ui/Component/ColumnFactoryTest.php | 3 ++- .../Product/Form/Modifier/EavTest.php | 3 ++- .../Catalog/Ui/Component/ColumnFactory.php | 2 +- .../Product/Form/Modifier/Eav.php | 2 +- .../catalog/product/attribute/js.phtml | 24 ++++++++++++------- .../Test/Unit/Model/Entity/AttributeTest.php | 23 +++++++++++------- .../Component/Form/Element/DataType/Date.php | 2 +- .../Unit/Component/Filters/Type/DateTest.php | 2 +- 8 files changed, 38 insertions(+), 23 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Ui/Component/ColumnFactoryTest.php b/app/code/Magento/Catalog/Test/Unit/Ui/Component/ColumnFactoryTest.php index 78e241100dc3b..b3acaa4b8bbed 100644 --- a/app/code/Magento/Catalog/Test/Unit/Ui/Component/ColumnFactoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Ui/Component/ColumnFactoryTest.php @@ -19,7 +19,7 @@ use PHPUnit\Framework\TestCase; /** - * ColumnFactory test. + * Test to Create columns factory on product grid page */ class ColumnFactoryTest extends TestCase { @@ -206,6 +206,7 @@ public function testCreateDateColumn( 'component' => 'Magento_Ui/js/grid/columns/date', 'timezone' => $expectedTimezone, 'dateFormat' => $expectedDateFormat, + '__disableTmpl' => ['label' => true], 'options' => [ 'showsTime' => $showsTime ] 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 6221704d51112..91e22407acc43 100644 --- 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 @@ -41,7 +41,7 @@ use PHPUnit\Framework\MockObject\MockObject; /** - * Class EavTest + * Class to test Data provider for eav attributes on product page * * @method Eav getModel * @SuppressWarnings(PHPMD.TooManyFields) @@ -692,6 +692,7 @@ public function setupAttributeMetaDataProvider() 'scopeLabel' => '', 'globalScope' => false, 'sortOrder' => 0, + '__disableTmpl' => ['label' => true, 'code' => true] ], 'locked' => false, 'frontendInput' => 'datetime', diff --git a/app/code/Magento/Catalog/Ui/Component/ColumnFactory.php b/app/code/Magento/Catalog/Ui/Component/ColumnFactory.php index 61bc518756ba6..b902e741c006c 100644 --- a/app/code/Magento/Catalog/Ui/Component/ColumnFactory.php +++ b/app/code/Magento/Catalog/Ui/Component/ColumnFactory.php @@ -15,7 +15,7 @@ use Magento\Ui\Component\Listing\Columns\ColumnInterface; /** - * Column Factory + * Create columns factory on product grid page * * @api * @since 100.0.2 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 bc5bee64912c7..25e816f79639a 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php @@ -40,7 +40,7 @@ use Magento\Eav\Model\ResourceModel\Entity\Attribute\CollectionFactory as AttributeCollectionFactory; /** - * Class Eav + * Data provider for eav attributes on product page * * @api * diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/js.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/js.phtml index 212a345f4bcbc..64384ac391a8d 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/js.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/js.phtml @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +use Magento\Catalog\Helper\Data; // phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis ?> @@ -63,7 +64,12 @@ function bindAttributeInputType() { checkOptionsPanelVisibility(); switchDefaultValueField(); - if($('frontend_input') && ($('frontend_input').value=='boolean' || $('frontend_input').value=='select' || $('frontend_input').value=='multiselect' || $('frontend_input').value=='price')){ + if ($('frontend_input') + && ($('frontend_input').value=='boolean' + || $('frontend_input').value=='select' + || $('frontend_input').value=='multiselect' + || $('frontend_input').value=='price') + ){ if($('is_filterable') && !$('is_filterable').getAttribute('readonly')){ $('is_filterable').disabled = false; } @@ -75,8 +81,7 @@ function bindAttributeInputType() if($('backend_type').options[i].value=='int') $('backend_type').selectedIndex = i; } } - } - else { + } else { if($('is_filterable')){ $('is_filterable').selectedIndex=0; $('is_filterable').disabled = true; @@ -203,21 +208,22 @@ function switchDefaultValueField() setRowVisibility('frontend_class', false); break; - <?php foreach ($this->helper(Magento\Catalog\Helper\Data::class)->getAttributeHiddenFields() as $type => $fields) :?> + <?php // phpcs:ignore Magento2.Templates.ThisInTemplate ?> + <?php foreach ($this->helper(Data::class)->getAttributeHiddenFields() as $type => $fields): ?> case '<?= $block->escapeJs($type) ?>': var isFrontTabHidden = false; - <?php foreach ($fields as $one) :?> - <?php if ($one == '_front_fieldset') :?> + <?php foreach ($fields as $one): ?> + <?php if ($one == '_front_fieldset'): ?> getFrontTab().hide(); isFrontTabHidden = true; - <?php elseif ($one == '_default_value') :?> + <?php elseif ($one == '_default_value'): ?> defaultValueTextVisibility = defaultValueTextareaVisibility = defaultValueDateVisibility = defaultValueYesnoVisibility = false; - <?php elseif ($one == '_scope') :?> + <?php elseif ($one == '_scope'): ?> scopeVisibility = false; - <?php else :?> + <?php else: ?> setRowVisibility('<?= $block->escapeJs($one) ?>', false); <?php endif; ?> <?php endforeach; ?> diff --git a/app/code/Magento/Eav/Test/Unit/Model/Entity/AttributeTest.php b/app/code/Magento/Eav/Test/Unit/Model/Entity/AttributeTest.php index 7aa5bca00f0b6..ae4ae7ee707e3 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/Entity/AttributeTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Entity/AttributeTest.php @@ -5,14 +5,21 @@ */ namespace Magento\Eav\Test\Unit\Model\Entity; +use Magento\Eav\Model\Entity\Attribute; +use Magento\Eav\Model\Entity\Attribute\FrontendLabel; +use Magento\Eav\Model\Entity\Attribute\FrontendLabelFactory; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + /** - * Class AttributeTest. + * Test for EAV Entity attribute model */ -class AttributeTest extends \PHPUnit\Framework\TestCase +class AttributeTest extends TestCase { /** * Attribute model to be tested - * @var \Magento\Eav\Model\Entity\Attribute|\PHPUnit_Framework_MockObject_MockObject + * @var Attribute|MockObject */ protected $_model; @@ -21,7 +28,7 @@ class AttributeTest extends \PHPUnit\Framework\TestCase */ protected function setUp() { - $this->_model = $this->createPartialMock(\Magento\Eav\Model\Entity\Attribute::class, ['__wakeup']); + $this->_model = $this->createPartialMock(Attribute::class, ['__wakeup']); } /** @@ -132,7 +139,7 @@ public function testGetFrontendLabels() { $attributeId = 1; $storeLabels = ['test_attribute_store1']; - $frontendLabelFactory = $this->getMockBuilder(\Magento\Eav\Model\Entity\Attribute\FrontendLabelFactory::class) + $frontendLabelFactory = $this->getMockBuilder(FrontendLabelFactory::class) ->disableOriginalConstructor() ->setMethods(['create']) ->getMock(); @@ -144,15 +151,15 @@ public function testGetFrontendLabels() '_resource' => $resource, 'frontendLabelFactory' => $frontendLabelFactory, ]; - $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $this->_model = $objectManager->getObject(\Magento\Eav\Model\Entity\Attribute::class, $arguments); + $objectManager = new ObjectManager($this); + $this->_model = $objectManager->getObject(Attribute::class, $arguments); $this->_model->setAttributeId($attributeId); $resource->expects($this->once()) ->method('getStoreLabelsByAttributeId') ->with($attributeId) ->willReturn($storeLabels); - $frontendLabel = $this->getMockBuilder(\Magento\Eav\Model\Entity\Attribute\FrontendLabel::class) + $frontendLabel = $this->getMockBuilder(FrontendLabel::class) ->setMethods(['setStoreId', 'setLabel']) ->disableOriginalConstructor() ->getMock(); diff --git a/app/code/Magento/Ui/Component/Form/Element/DataType/Date.php b/app/code/Magento/Ui/Component/Form/Element/DataType/Date.php index 6bf1eacd161cc..ef2df77e7daff 100644 --- a/app/code/Magento/Ui/Component/Form/Element/DataType/Date.php +++ b/app/code/Magento/Ui/Component/Form/Element/DataType/Date.php @@ -11,7 +11,7 @@ use Magento\Framework\View\Element\UiComponent\ContextInterface; /** - * Class Date + * UI component date type */ class Date extends AbstractDataType { diff --git a/app/code/Magento/Ui/Test/Unit/Component/Filters/Type/DateTest.php b/app/code/Magento/Ui/Test/Unit/Component/Filters/Type/DateTest.php index 31d7ca92c5985..20af2627fbb04 100644 --- a/app/code/Magento/Ui/Test/Unit/Component/Filters/Type/DateTest.php +++ b/app/code/Magento/Ui/Test/Unit/Component/Filters/Type/DateTest.php @@ -16,7 +16,7 @@ use PHPUnit\Framework\MockObject\MockObject; /** - * Class DateTest + * Test for Date grid filter functionality */ class DateTest extends \PHPUnit\Framework\TestCase { From ff6365a275fda5a93fc591bad6fb11aeffc83225 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Tue, 10 Dec 2019 11:00:58 +0200 Subject: [PATCH 0289/1143] Static-test fix --- .../Framework/App/ObjectManager/ConfigLoader/Compiled.php | 2 +- lib/internal/Magento/Framework/DB/Select/SelectRenderer.php | 2 +- lib/internal/Magento/Framework/Module/Dir.php | 4 +--- lib/internal/Magento/Framework/Phrase/Renderer/Translate.php | 4 +--- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php b/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php index 7408e8b230bd9..50769e9e17774 100644 --- a/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php +++ b/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php @@ -9,7 +9,7 @@ use Magento\Framework\ObjectManager\ConfigLoaderInterface; /** - * Class Compiled + * Load configuration files */ class Compiled implements ConfigLoaderInterface { diff --git a/lib/internal/Magento/Framework/DB/Select/SelectRenderer.php b/lib/internal/Magento/Framework/DB/Select/SelectRenderer.php index ce53c07789bde..7c239913987a7 100644 --- a/lib/internal/Magento/Framework/DB/Select/SelectRenderer.php +++ b/lib/internal/Magento/Framework/DB/Select/SelectRenderer.php @@ -8,7 +8,7 @@ use Magento\Framework\DB\Select; /** - * Class SelectRenderer + * Phrase renderer interface */ class SelectRenderer implements RendererInterface { diff --git a/lib/internal/Magento/Framework/Module/Dir.php b/lib/internal/Magento/Framework/Module/Dir.php index 99570b97e7251..4a03d0edc49fd 100644 --- a/lib/internal/Magento/Framework/Module/Dir.php +++ b/lib/internal/Magento/Framework/Module/Dir.php @@ -1,7 +1,5 @@ <?php /** - * Encapsulates directories structure of a Magento module - * * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ @@ -11,7 +9,7 @@ use Magento\Framework\Component\ComponentRegistrarInterface; /** - * Class Dir + * Encapsulates directories structure of a Magento module */ class Dir { diff --git a/lib/internal/Magento/Framework/Phrase/Renderer/Translate.php b/lib/internal/Magento/Framework/Phrase/Renderer/Translate.php index 4edf0fe049902..34f47a02bfcf4 100644 --- a/lib/internal/Magento/Framework/Phrase/Renderer/Translate.php +++ b/lib/internal/Magento/Framework/Phrase/Renderer/Translate.php @@ -1,7 +1,5 @@ <?php /** - * Translate Phrase renderer - * * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ @@ -12,7 +10,7 @@ use Psr\Log\LoggerInterface; /** - * Class Translate + * Translate Phrase renderer */ class Translate implements RendererInterface { From e9b92e5bfe75159a68c8db2d2cca72567c7408a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Chitesh=40wagento=2Ecom=E2=80=9D?= <hitesh@wagento.com> Date: Tue, 10 Dec 2019 14:42:04 +0530 Subject: [PATCH 0290/1143] [Fixed Radio alignment issue] --- .../web/css/source/module/checkout/_shipping.less | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_shipping.less b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_shipping.less index d0edf245dc5b8..661f1ff90ae26 100644 --- a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_shipping.less +++ b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_shipping.less @@ -184,6 +184,10 @@ padding-right: 0; width: 20px; } + + input[type="radio"] { + margin: 4px 5px 0 0; + } } tr { From 271a2862d39da787ed82175e15334deb00688ba4 Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Tue, 10 Dec 2019 11:40:45 +0200 Subject: [PATCH 0291/1143] MC-29273: [Magento Cloud] - When admin URL is different to front-base URL admin redirects to storefront --- .../Adminhtml/System/Currencysymbol/Save.php | 51 ++++++-- .../System/Currencysymbol/SaveTest.php | 116 +++++++++--------- 2 files changed, 101 insertions(+), 66 deletions(-) diff --git a/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currencysymbol/Save.php b/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currencysymbol/Save.php index f77976cc9e2f2..07c7c553ac792 100644 --- a/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currencysymbol/Save.php +++ b/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currencysymbol/Save.php @@ -5,37 +5,68 @@ */ namespace Magento\CurrencySymbol\Controller\Adminhtml\System\Currencysymbol; -use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface; +use Magento\Backend\App\Action; +use Magento\Backend\Model\View\Result\Redirect; +use Magento\CurrencySymbol\Controller\Adminhtml\System\Currencysymbol as CurrencysymbolController; +use Magento\CurrencySymbol\Model\System\CurrencysymbolFactory; +use Magento\Framework\App\Action\HttpPostActionInterface; +use Magento\Framework\Controller\ResultInterface; +use Magento\Framework\Filter\FilterManager; /** - * Class Save + * Controller to save currency symbol */ -class Save extends \Magento\CurrencySymbol\Controller\Adminhtml\System\Currencysymbol implements HttpPostActionInterface +class Save extends CurrencysymbolController implements HttpPostActionInterface { + /** + * @var FilterManager + */ + private $filterManager; + + /** + * @var CurrencysymbolFactory + */ + private $currencySymbolFactory; + + /** + * @param Action\Context $context + * @param FilterManager $filterManager + * @param CurrencysymbolFactory $currencySymbolFactory + */ + public function __construct( + Action\Context $context, + FilterManager $filterManager, + CurrencysymbolFactory $currencySymbolFactory + ) { + parent::__construct($context); + $this->filterManager = $filterManager; + $this->currencySymbolFactory = $currencySymbolFactory; + } + /** * Save custom Currency symbol * - * @return void + * @return ResultInterface */ public function execute() { + /** @var Redirect $resultRedirect */ + $resultRedirect = $this->resultRedirectFactory->create(); $symbolsDataArray = $this->getRequest()->getParam('custom_currency_symbol', null); if (is_array($symbolsDataArray)) { foreach ($symbolsDataArray as &$symbolsData) { - /** @var $filterManager \Magento\Framework\Filter\FilterManager */ - $filterManager = $this->_objectManager->get(\Magento\Framework\Filter\FilterManager::class); - $symbolsData = $filterManager->stripTags($symbolsData); + $symbolsData = $this->filterManager->stripTags($symbolsData); } } try { - $this->_objectManager->create(\Magento\CurrencySymbol\Model\System\Currencysymbol::class) - ->setCurrencySymbolsData($symbolsDataArray); + $currencySymbol = $this->currencySymbolFactory->create(); + $currencySymbol->setCurrencySymbolsData($symbolsDataArray); $this->messageManager->addSuccessMessage(__('You applied the custom currency symbols.')); } catch (\Exception $e) { $this->messageManager->addErrorMessage($e->getMessage()); } - $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl($this->getUrl('*'))); + return $resultRedirect->setPath('*'); } } diff --git a/app/code/Magento/CurrencySymbol/Test/Unit/Controller/Adminhtml/System/Currencysymbol/SaveTest.php b/app/code/Magento/CurrencySymbol/Test/Unit/Controller/Adminhtml/System/Currencysymbol/SaveTest.php index 06f4294ce6397..b3c69c352ac7d 100644 --- a/app/code/Magento/CurrencySymbol/Test/Unit/Controller/Adminhtml/System/Currencysymbol/SaveTest.php +++ b/app/code/Magento/CurrencySymbol/Test/Unit/Controller/Adminhtml/System/Currencysymbol/SaveTest.php @@ -5,132 +5,136 @@ */ namespace Magento\CurrencySymbol\Test\Unit\Controller\Adminhtml\System\Currencysymbol; +use Magento\Backend\Helper\Data; +use Magento\Backend\Model\View\Result\Redirect; +use Magento\Backend\Model\View\Result\RedirectFactory; +use Magento\CurrencySymbol\Controller\Adminhtml\System\Currencysymbol\Save; +use Magento\CurrencySymbol\Model\System\Currencysymbol; +use Magento\CurrencySymbol\Model\System\CurrencysymbolFactory; +use Magento\Framework\App\RequestInterface; +use Magento\Framework\App\Response\RedirectInterface; +use Magento\Framework\App\ResponseInterface; +use Magento\Framework\Filter\FilterManager; +use Magento\Framework\Message\ManagerInterface; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\MockObject\MockObject; /** - * Class SaveTest + * Test ot to save currency symbol controller */ -class SaveTest extends \PHPUnit\Framework\TestCase +class SaveTest extends TestCase { /** - * @var \Magento\CurrencySymbol\Controller\Adminhtml\System\Currencysymbol\Save + * @var Save */ protected $action; /** - * @var \Magento\Framework\App\RequestInterface|\PHPUnit_Framework_MockObject_MockObject + * @var RedirectFactory|MockObject + */ + private $resultRedirectFactory; + + /** + * @var RequestInterface|MockObject */ protected $requestMock; /** - * @var \Magento\Framework\App\ResponseInterface|\PHPUnit_Framework_MockObject_MockObject + * @var ResponseInterface|MockObject */ protected $responseMock; /** - * @var \Magento\Framework\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject + * @var ManagerInterface|MockObject */ - protected $objectManagerMock; + protected $messageManagerMock; /** - * @var \Magento\CurrencySymbol\Model\System\Currencysymbol|\PHPUnit_Framework_MockObject_MockObject + * @var RedirectInterface|MockObject */ - protected $currencySymbolMock; + protected $redirectMock; /** - * @var \Magento\Framework\Message\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject + * @var Data|MockObject */ - protected $messageManagerMock; + protected $helperMock; /** - * @var \Magento\Framework\App\Response\RedirectInterface|\PHPUnit_Framework_MockObject_MockObject + * @var FilterManager|MockObject */ - protected $redirectMock; + private $filterManager; /** - * @var \Magento\Backend\Helper\Data|\PHPUnit_Framework_MockObject_MockObject + * @var CurrencysymbolFactory|MockObject */ - protected $helperMock; + private $currencySymbolFactory; /** - * @var \Magento\Framework\Filter\FilterManager|\PHPUnit_Framework_MockObject_MockObject + * @inheritdoc */ - protected $filterManagerMock; - protected function setUp() { $objectManager = new ObjectManager($this); - - $this->requestMock = $this->createMock(\Magento\Framework\App\RequestInterface::class); - - $this->helperMock = $this->createMock(\Magento\Backend\Helper\Data::class); - - $this->redirectMock = $this->createMock(\Magento\Framework\App\Response\RedirectInterface::class); - + $this->requestMock = $this->createMock(RequestInterface::class); + $this->helperMock = $this->createMock(Data::class); + $this->redirectMock = $this->createMock(RedirectInterface::class); $this->responseMock = $this->createPartialMock( - \Magento\Framework\App\ResponseInterface::class, + ResponseInterface::class, ['setRedirect', 'sendResponse'] ); - - $this->currencySymbolMock = $this->createMock(\Magento\CurrencySymbol\Model\System\Currencysymbol::class); - - $this->filterManagerMock = $this->createPartialMock( - \Magento\Framework\Filter\FilterManager::class, + $this->messageManagerMock = $this->createMock(ManagerInterface::class); + $this->resultRedirectFactory = $this->createMock(RedirectFactory::class); + $this->filterManager = $this->createPartialMock( + FilterManager::class, ['stripTags'] ); + $this->currencySymbolFactory = $this->createMock(CurrencysymbolFactory::class); - $this->objectManagerMock = $this->createMock(\Magento\Framework\ObjectManagerInterface::class); - - $this->messageManagerMock = $this->createMock(\Magento\Framework\Message\ManagerInterface::class); $this->action = $objectManager->getObject( - \Magento\CurrencySymbol\Controller\Adminhtml\System\Currencysymbol\Save::class, + Save::class, [ 'request' => $this->requestMock, 'response' => $this->responseMock, - 'objectManager' => $this->objectManagerMock, 'redirect' => $this->redirectMock, 'helper' => $this->helperMock, - 'messageManager' => $this->messageManagerMock + 'messageManager' => $this->messageManagerMock, + 'resultRedirectFactory' => $this->resultRedirectFactory, + 'filterManager' => $this->filterManager, + 'currencySymbolFactory' => $this->currencySymbolFactory, ] ); } + /** + * Test to Save custom Currency symbol + */ public function testExecute() { $firstElement = 'firstElement'; $symbolsDataArray = [$firstElement]; - $redirectUrl = 'redirectUrl'; $this->requestMock->expects($this->once()) ->method('getParam') ->with('custom_currency_symbol') ->willReturn($symbolsDataArray); - $this->helperMock->expects($this->once())->method('getUrl')->with('*'); - $this->redirectMock->expects($this->once())->method('getRedirectUrl')->willReturn($redirectUrl); - - $this->currencySymbolMock->expects($this->once())->method('setCurrencySymbolsData')->with($symbolsDataArray); - $this->responseMock->expects($this->once())->method('setRedirect'); - - $this->filterManagerMock->expects($this->once()) + $currencySymbol = $this->createMock(Currencysymbol::class); + $currencySymbol->expects($this->once())->method('setCurrencySymbolsData')->with($symbolsDataArray); + $this->currencySymbolFactory->method('create')->willReturn($currencySymbol); + $this->filterManager->expects($this->once()) ->method('stripTags') ->with($firstElement) ->willReturn($firstElement); - $this->objectManagerMock->expects($this->once()) - ->method('create') - ->with(\Magento\CurrencySymbol\Model\System\Currencysymbol::class) - ->willReturn($this->currencySymbolMock); - - $this->objectManagerMock->expects($this->once()) - ->method('get') - ->with(\Magento\Framework\Filter\FilterManager::class) - ->willReturn($this->filterManagerMock); - $this->messageManagerMock->expects($this->once()) ->method('addSuccessMessage') ->with(__('You applied the custom currency symbols.')); - $this->action->execute(); + $redirect = $this->createMock(Redirect::class); + $redirect->expects($this->once())->method('setPath')->with('*')->willReturnSelf(); + $this->resultRedirectFactory->method('create')->willReturn($redirect); + + $this->assertEquals($redirect, $this->action->execute()); } } From 672df31da48164562c28694685c22971bde58548 Mon Sep 17 00:00:00 2001 From: Sathish <srsathish92@gmail.com> Date: Tue, 10 Dec 2019 15:25:31 +0530 Subject: [PATCH 0292/1143] Kept original class for backward compatibility --- app/code/Magento/Catalog/ViewModel/Product/Breadcrumbs.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/ViewModel/Product/Breadcrumbs.php b/app/code/Magento/Catalog/ViewModel/Product/Breadcrumbs.php index 330d1e0d3fbdf..88a799f9505d4 100644 --- a/app/code/Magento/Catalog/ViewModel/Product/Breadcrumbs.php +++ b/app/code/Magento/Catalog/ViewModel/Product/Breadcrumbs.php @@ -10,6 +10,7 @@ use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\App\ObjectManager; use Magento\Framework\DataObject; +use Magento\Framework\Serialize\Serializer\Json; use Magento\Framework\Serialize\Serializer\JsonHexTag; use Magento\Framework\View\Element\Block\ArgumentInterface; use Magento\Framework\Escaper; @@ -44,6 +45,7 @@ class Breadcrumbs extends DataObject implements ArgumentInterface /** * @param Data $catalogData * @param ScopeConfigInterface $scopeConfig + * @param Json|null $json * @param JsonHexTag $jsonSerializer * @param Escaper|null $escaper * @SuppressWarnings(PHPMD.UnusedFormalParameter) @@ -51,6 +53,7 @@ class Breadcrumbs extends DataObject implements ArgumentInterface public function __construct( Data $catalogData, ScopeConfigInterface $scopeConfig, + Json $json = null, JsonHexTag $jsonSerializer, Escaper $escaper = null ) { @@ -114,7 +117,7 @@ public function getJsonConfigurationHtmlEscaped() : string 'useCategoryPathInUrl' => (int)$this->isCategoryUsedInProductUrl(), 'product' => $this->escaper->escapeHtml($this->getProductName()) ] - ] + ] ); } From 5ae32934cda53256c35eabcce27d92cb516a7411 Mon Sep 17 00:00:00 2001 From: "rostyslav.hymon" <rostyslav.hymon@transoftgroup.com> Date: Tue, 10 Dec 2019 13:30:03 +0200 Subject: [PATCH 0293/1143] MC-29362: Sitemap grid does not use base URL --- app/code/Magento/Sitemap/Model/Sitemap.php | 43 ++++++++- .../Sitemap/Test/Unit/Model/SitemapTest.php | 95 +++++++++++++++---- 2 files changed, 116 insertions(+), 22 deletions(-) diff --git a/app/code/Magento/Sitemap/Model/Sitemap.php b/app/code/Magento/Sitemap/Model/Sitemap.php index 2baa6ff2c71a7..ea5659cf909ff 100644 --- a/app/code/Magento/Sitemap/Model/Sitemap.php +++ b/app/code/Magento/Sitemap/Model/Sitemap.php @@ -739,8 +739,11 @@ protected function _getFormattedLastmodDate($date) */ protected function _getDocumentRoot() { - return $this->filesystem->getDirectoryRead($this->documentRoot->getPath()) - ->getAbsolutePath(); + if (PHP_SAPI === 'cli') { + return $this->getDocumentRootFromBaseDir() ?? ''; + } + // phpcs:ignore Magento2.Functions.DiscouragedFunction + return realpath($this->_request->getServer('DOCUMENT_ROOT')); } /** @@ -754,10 +757,14 @@ protected function _getStoreBaseDomain() $storeParsedUrl = parse_url($this->_getStoreBaseUrl()); $url = $storeParsedUrl['scheme'] . '://' . $storeParsedUrl['host']; - $documentRoot = trim(str_replace('\\', '/', $this->_getDocumentRoot()), '/'); - $baseDir = trim(str_replace('\\', '/', $this->_getBaseDir()), '/'); + // Set document root to false if we were unable to get it + $documentRoot = $this->_getDocumentRoot() ?: false; + if ($documentRoot) { + $documentRoot = trim(str_replace(DIRECTORY_SEPARATOR, '/', $documentRoot), '/'); + } + $baseDir = trim(str_replace(DIRECTORY_SEPARATOR, '/', $this->_getBaseDir()), '/'); - if (strpos($baseDir, (string) $documentRoot) === 0) { + if ($documentRoot !== false && strpos($baseDir, (string) $documentRoot) === 0) { //case when basedir is in document root $installationFolder = trim(str_replace($documentRoot, '', $baseDir), '/'); $storeDomain = rtrim($url . '/' . $installationFolder, '/'); @@ -878,4 +885,30 @@ public function getIdentities() Value::CACHE_TAG . '_' . $this->getStoreId(), ]; } + + /** + * Get document root using base directory (root directory) and base path (base url path) + * + * Document root is determined using formula: BaseDir = DocumentRoot + BasePath. + * Returns <b>NULL</b> if BaseDir does not end with BasePath (e.g document root contains a symlink to BaseDir). + * + * @return string|null + */ + private function getDocumentRootFromBaseDir(): ?string + { + // phpcs:ignore Magento2.Functions.DiscouragedFunction + $basePath = rtrim(parse_url($this->_getStoreBaseUrl(UrlInterface::URL_TYPE_WEB), PHP_URL_PATH) ?: '', '/'); + $basePath = str_replace('/', DIRECTORY_SEPARATOR, $basePath); + $basePath = rtrim($basePath, DIRECTORY_SEPARATOR); + $baseDir = rtrim($this->_getBaseDir(), DIRECTORY_SEPARATOR); + $length = strlen($basePath); + if (!$length) { + $documentRoot = $baseDir; + } elseif (substr($baseDir, -$length) === $basePath) { + $documentRoot = rtrim(substr($baseDir, 0, strlen($baseDir) - $length), DIRECTORY_SEPARATOR); + } else { + $documentRoot = null; + } + return $documentRoot; + } } diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php index a5e40bf3fcff7..16d506c1cdfa3 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php @@ -5,6 +5,7 @@ */ namespace Magento\Sitemap\Test\Unit\Model; +use Magento\Framework\App\Request\Http; use Magento\Framework\DataObject; use Magento\Framework\Filesystem; use Magento\Framework\Filesystem\Directory\Write as DirectoryWrite; @@ -86,6 +87,15 @@ class SitemapTest extends \PHPUnit\Framework\TestCase */ private $configReaderMock; + /** + * @var Http|\PHPUnit_Framework_MockObject_MockObject + */ + private $request; + /** + * @var Store|\PHPUnit_Framework_MockObject_MockObject + */ + private $store; + /** * @inheritdoc */ @@ -143,6 +153,12 @@ protected function setUp() $this->configReaderMock = $this->getMockForAbstractClass(SitemapConfigReaderInterface::class); $this->itemProviderMock = $this->getMockForAbstractClass(ItemProviderInterface::class); + $this->request = $this->createMock(Http::class); + $this->store = $this->createPartialMock(Store::class, ['isFrontUrlSecure', 'getBaseUrl']); + $this->storeManagerMock = $this->createMock(StoreManagerInterface::class); + $this->storeManagerMock->expects($this->any()) + ->method('getStore') + ->willReturn($this->store); } /** @@ -476,25 +492,15 @@ function ($from, $to) { $model = $this->getModelMock(true); - $storeMock = $this->getMockBuilder(Store::class) - ->setMethods(['isFrontUrlSecure', 'getBaseUrl']) - ->disableOriginalConstructor() - ->getMock(); - - $storeMock->expects($this->atLeastOnce()) + $this->store->expects($this->atLeastOnce()) ->method('isFrontUrlSecure') ->willReturn(false); - $storeMock->expects($this->atLeastOnce()) + $this->store->expects($this->atLeastOnce()) ->method('getBaseUrl') ->with($this->isType('string'), false) ->willReturn('http://store.com/'); - $this->storeManagerMock->expects($this->atLeastOnce()) - ->method('getStore') - ->with(1) - ->willReturn($storeMock); - return $model; } @@ -599,10 +605,6 @@ private function getModelConstructorArgs() ->disableOriginalConstructor() ->getMock(); - $this->storeManagerMock = $this->getMockBuilder(StoreManagerInterface::class) - ->setMethods(['getStore']) - ->getMockForAbstractClass(); - $objectManager = new ObjectManager($this); $escaper = $objectManager->getObject(\Magento\Framework\Escaper::class); @@ -617,7 +619,8 @@ private function getModelConstructorArgs() 'filesystem' => $this->filesystemMock, 'itemProvider' => $this->itemProviderMock, 'configReader' => $this->configReaderMock, - 'escaper' => $escaper + 'escaper' => $escaper, + 'request' => $this->request, ] ); $constructArguments['resource'] = null; @@ -732,4 +735,62 @@ public static function siteUrlDataProvider() ] ]; } + + /** + * Check site URL getter + * + * @param string $storeBaseUrl + * @param string $baseDir + * @param string $documentRoot + * @dataProvider getDocumentRootFromBaseDirUrlDataProvider + */ + public function testGetDocumentRootFromBaseDir( + string $storeBaseUrl, + string $baseDir, + ?string $documentRoot + ) { + $this->store->setCode('store'); + $this->store->method('getBaseUrl')->willReturn($storeBaseUrl); + $this->directoryMock->method('getAbsolutePath')->willReturn($baseDir); + /** @var $model Sitemap */ + $model = $this->getMockBuilder(Sitemap::class) + ->setMethods(['_construct']) + ->setConstructorArgs($this->getModelConstructorArgs()) + ->getMock(); + + $method = new \ReflectionMethod($model, 'getDocumentRootFromBaseDir'); + $method->setAccessible(true); + $this->assertSame($documentRoot, $method->invoke($model)); + } + + /** + * Provides test cases for document root testing + * + * @return array + */ + public function getDocumentRootFromBaseDirUrlDataProvider(): array + { + return [ + [ + 'http://magento.com/', + '/var/www', + '/var/www', + ], + [ + 'http://magento.com/usa', + '/var/www/usa', + '/var/www', + ], + [ + 'http://magento.com/usa/tx', + '/var/www/usa/tx', + '/var/www', + ], + 'symlink <document root>/usa/txt -> /var/www/html' => [ + 'http://magento.com/usa/tx', + '/var/www/html', + null, + ], + ]; + } } From 200f51853bf8b5b10090d6ecd9abc46269ca364b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Chitesh=40wagento=2Ecom=E2=80=9D?= <hitesh@wagento.com> Date: Tue, 10 Dec 2019 17:05:01 +0530 Subject: [PATCH 0294/1143] [Removed spacing in submenu on hover desktop] --- lib/web/css/source/lib/_navigation.less | 2 +- lib/web/css/source/lib/variables/_navigation.less | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/web/css/source/lib/_navigation.less b/lib/web/css/source/lib/_navigation.less index 9b13c28227eb9..38cd042591722 100644 --- a/lib/web/css/source/lib/_navigation.less +++ b/lib/web/css/source/lib/_navigation.less @@ -459,7 +459,7 @@ } .submenu { - top: 0 !important; + top: -1px !important; left: 100% !important; } diff --git a/lib/web/css/source/lib/variables/_navigation.less b/lib/web/css/source/lib/variables/_navigation.less index 3ef1742547426..4801b8874abcc 100644 --- a/lib/web/css/source/lib/variables/_navigation.less +++ b/lib/web/css/source/lib/variables/_navigation.less @@ -91,7 +91,7 @@ @submenu-desktop__font-size: ''; @submenu-desktop__font-weight: @font-weight__bold; @submenu-desktop__min-width: 230px; -@submenu-desktop__padding: 15px 0; +@submenu-desktop__padding: 0; @submenu-desktop-arrow: true; // [true|false] @submenu-desktop-arrow__size: 10px; From 04f6ac08242db072a832350faf17cc2f90ad7aee Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Tue, 10 Dec 2019 13:42:52 +0200 Subject: [PATCH 0295/1143] MC-29388: Performance issue. The same item from change log table can be processed several times --- .../Framework/Mview/Test/Unit/ViewTest.php | 256 ++++++++++++++---- lib/internal/Magento/Framework/Mview/View.php | 35 ++- 2 files changed, 235 insertions(+), 56 deletions(-) diff --git a/lib/internal/Magento/Framework/Mview/Test/Unit/ViewTest.php b/lib/internal/Magento/Framework/Mview/Test/Unit/ViewTest.php index 54f6351e9651c..ebd9896e62558 100644 --- a/lib/internal/Magento/Framework/Mview/Test/Unit/ViewTest.php +++ b/lib/internal/Magento/Framework/Mview/Test/Unit/ViewTest.php @@ -5,44 +5,60 @@ */ namespace Magento\Framework\Mview\Test\Unit; +use Magento\Framework\Mview\ActionFactory; +use Magento\Framework\Mview\ActionInterface; +use Magento\Framework\Mview\ConfigInterface; use \Magento\Framework\Mview\View; +use Magento\Framework\Mview\View\Changelog; +use Magento\Framework\Mview\View\StateInterface; +use Magento\Framework\Mview\View\Subscription; +use Magento\Framework\Mview\View\SubscriptionFactory; +use Magento\Indexer\Model\Mview\View\State; +use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\MockObject\MockObject; -class ViewTest extends \PHPUnit\Framework\TestCase +/** + * Class to test Mview functionality + */ +class ViewTest extends TestCase { /** - * @var \Magento\Framework\Mview\View + * @var View */ protected $model; /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Mview\ConfigInterface + * @var MockObject|ConfigInterface */ protected $configMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Mview\ActionFactory + * @var MockObject|ActionFactory */ protected $actionFactoryMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Indexer\Model\Mview\View\State + * @var MockObject|State */ protected $stateMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Mview\View\Changelog + * @var MockObject|Changelog */ protected $changelogMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Mview\View\SubscriptionFactory + * @var MockObject|SubscriptionFactory */ protected $subscriptionFactoryMock; + /** + * @inheritdoc + */ protected function setUp() { $this->configMock = $this->getMockForAbstractClass( - \Magento\Framework\Mview\ConfigInterface::class, + ConfigInterface::class, [], '', false, @@ -50,9 +66,9 @@ protected function setUp() true, ['getView'] ); - $this->actionFactoryMock = $this->createPartialMock(\Magento\Framework\Mview\ActionFactory::class, ['get']); + $this->actionFactoryMock = $this->createPartialMock(ActionFactory::class, ['get']); $this->stateMock = $this->createPartialMock( - \Magento\Indexer\Model\Mview\View\State::class, + State::class, [ 'getViewId', 'loadByView', @@ -68,11 +84,11 @@ protected function setUp() ] ); $this->changelogMock = $this->createPartialMock( - \Magento\Framework\Mview\View\Changelog::class, + Changelog::class, ['getViewId', 'setViewId', 'create', 'drop', 'getVersion', 'getList', 'clear'] ); $this->subscriptionFactoryMock = $this->createPartialMock( - \Magento\Framework\Mview\View\SubscriptionFactory::class, + SubscriptionFactory::class, ['create'] ); $this->model = new View( @@ -84,24 +100,36 @@ protected function setUp() ); } + /** + * Test to Return view action class + */ public function testGetActionClass() { $this->model->setData('action_class', 'actionClass'); $this->assertEquals('actionClass', $this->model->getActionClass()); } + /** + * Test to Return view group + */ public function testGetGroup() { $this->model->setData('group', 'some_group'); $this->assertEquals('some_group', $this->model->getGroup()); } + /** + * Test to Return view subscriptions + */ public function testGetSubscriptions() { $this->model->setData('subscriptions', ['subscription']); $this->assertEquals(['subscription'], $this->model->getSubscriptions()); } + /** + * Test to Fill view data from config + */ public function testLoad() { $viewId = 'view_test'; @@ -114,10 +142,12 @@ public function testLoad() )->will( $this->returnValue($this->getViewData()) ); - $this->assertInstanceOf(\Magento\Framework\Mview\View::class, $this->model->load($viewId)); + $this->assertInstanceOf(View::class, $this->model->load($viewId)); } /** + * Test to Fill view data from config + * * @expectedException \InvalidArgumentException * @expectedExceptionMessage view_id view does not exist. */ @@ -136,18 +166,21 @@ public function testLoadWithException() $this->model->load($viewId); } + /** + * Test to Create subscriptions + */ public function testSubscribe() { $this->stateMock->expects($this->once()) ->method('getMode') - ->will($this->returnValue(\Magento\Framework\Mview\View\StateInterface::MODE_DISABLED)); + ->will($this->returnValue(StateInterface::MODE_DISABLED)); $this->stateMock->expects($this->once()) ->method('setMode') - ->with(\Magento\Framework\Mview\View\StateInterface::MODE_ENABLED) + ->with(StateInterface::MODE_ENABLED) ->will($this->returnSelf()); $this->changelogMock->expects($this->once()) ->method('create'); - $subscriptionMock = $this->createPartialMock(\Magento\Framework\Mview\View\Subscription::class, ['create']); + $subscriptionMock = $this->createPartialMock(Subscription::class, ['create']); $subscriptionMock->expects($this->exactly(1))->method('create'); $this->subscriptionFactoryMock->expects( $this->exactly(1) @@ -160,11 +193,14 @@ public function testSubscribe() $this->model->subscribe(); } + /** + * Test to Create subscriptions + */ public function testSubscribeEnabled() { $this->stateMock->expects($this->once()) ->method('getMode') - ->will($this->returnValue(\Magento\Framework\Mview\View\StateInterface::MODE_ENABLED)); + ->will($this->returnValue(StateInterface::MODE_ENABLED)); $this->stateMock->expects($this->never()) ->method('setMode'); $this->changelogMock->expects($this->never()) @@ -182,7 +218,7 @@ public function testSubscribeWithException() { $this->stateMock->expects($this->once()) ->method('getMode') - ->will($this->returnValue(\Magento\Framework\Mview\View\StateInterface::MODE_DISABLED)); + ->will($this->returnValue(StateInterface::MODE_DISABLED)); $this->changelogMock->expects($this->once()) ->method('create') @@ -196,18 +232,21 @@ function () { $this->model->subscribe(); } + /** + * Test to Remove subscriptions + */ public function testUnsubscribe() { $this->stateMock->expects($this->once()) ->method('getMode') - ->will($this->returnValue(\Magento\Framework\Mview\View\StateInterface::MODE_ENABLED)); + ->will($this->returnValue(StateInterface::MODE_ENABLED)); $this->stateMock->expects($this->once()) ->method('setMode') - ->with(\Magento\Framework\Mview\View\StateInterface::MODE_DISABLED) + ->with(StateInterface::MODE_DISABLED) ->will($this->returnSelf()); $this->changelogMock->expects($this->never()) ->method('drop'); - $subscriptionMock = $this->createPartialMock(\Magento\Framework\Mview\View\Subscription::class, ['remove']); + $subscriptionMock = $this->createPartialMock(Subscription::class, ['remove']); $subscriptionMock->expects($this->exactly(1))->method('remove'); $this->subscriptionFactoryMock->expects( $this->exactly(1) @@ -220,11 +259,14 @@ public function testUnsubscribe() $this->model->unsubscribe(); } + /** + * Test to Remove subscriptions + */ public function testUnsubscribeDisabled() { $this->stateMock->expects($this->once()) ->method('getMode') - ->will($this->returnValue(\Magento\Framework\Mview\View\StateInterface::MODE_DISABLED)); + ->will($this->returnValue(StateInterface::MODE_DISABLED)); $this->stateMock->expects($this->never()) ->method('setVersionId'); $this->stateMock->expects($this->never()) @@ -244,9 +286,9 @@ public function testUnsubscribeWithException() { $this->stateMock->expects($this->once()) ->method('getMode') - ->will($this->returnValue(\Magento\Framework\Mview\View\StateInterface::MODE_ENABLED)); + ->will($this->returnValue(StateInterface::MODE_ENABLED)); - $subscriptionMock = $this->createPartialMock(\Magento\Framework\Mview\View\Subscription::class, ['remove']); + $subscriptionMock = $this->createPartialMock(Subscription::class, ['remove']); $subscriptionMock->expects($this->exactly(1)) ->method('remove') ->willReturnCallback( @@ -262,6 +304,9 @@ function () { $this->model->unsubscribe(); } + /** + * Test to Materialize view by IDs in changelog + */ public function testUpdate() { $currentVersionId = 3; @@ -279,10 +324,10 @@ public function testUpdate() ->will($this->returnSelf()); $this->stateMock->expects($this->atLeastOnce()) ->method('getMode') - ->willReturn(\Magento\Framework\Mview\View\StateInterface::MODE_ENABLED); + ->willReturn(StateInterface::MODE_ENABLED); $this->stateMock->expects($this->exactly(2)) ->method('getStatus') - ->will($this->returnValue(\Magento\Framework\Mview\View\StateInterface::STATUS_IDLE)); + ->will($this->returnValue(StateInterface::STATUS_IDLE)); $this->stateMock->expects($this->exactly(2)) ->method('setStatus') ->will($this->returnSelf()); @@ -308,7 +353,7 @@ public function testUpdate() $this->returnValue($listId) ); - $actionMock = $this->createMock(\Magento\Framework\Mview\ActionInterface::class); + $actionMock = $this->createMock(ActionInterface::class); $actionMock->expects($this->once())->method('execute')->with($listId)->will($this->returnSelf()); $this->actionFactoryMock->expects( $this->once() @@ -325,6 +370,83 @@ public function testUpdate() } /** + * Test to Materialize view by IDs in changelog + */ + public function testUpdateEx(): void + { + $currentVersionId = 200100; + $lastVersionId = 1; + $listIdBatchOne = $this->generateChangeLog(100000, 1, 100); + $listIdBatchTwo = $this->generateChangeLog(100000, 1, 50); + $listIdBatchThree = $this->generateChangeLog(100, 100, 150); + + $this->stateMock->method('getViewId')->willReturn(1); + $this->stateMock->method('getVersionId')->willReturn($lastVersionId); + $this->stateMock->method('setVersionId')->willReturnSelf(); + $this->stateMock->expects($this->atLeastOnce()) + ->method('getMode') + ->willReturn(StateInterface::MODE_ENABLED); + $this->stateMock->expects($this->exactly(2)) + ->method('getStatus') + ->willReturn(StateInterface::STATUS_IDLE); + $this->stateMock->expects($this->exactly(2)) + ->method('setStatus') + ->willReturnSelf(); + $this->stateMock->expects($this->exactly(2)) + ->method('save') + ->willReturnSelf(); + $this->changelogMock + ->expects($this->once()) + ->method('getVersion') + ->willReturn($currentVersionId); + + $this->changelogMock->method('getList') + ->willReturnMap( + [ + [$lastVersionId, 100001, $listIdBatchOne], + [100001, 200001, $listIdBatchTwo], + [200001, $currentVersionId, $listIdBatchThree], + ] + ); + + $actionMock = $this->createMock(ActionInterface::class); + $actionMock->expects($this->once()) + ->method('execute') + ->with($this->generateChangeLog(150, 1, 150)) + ->willReturnSelf(); + $this->actionFactoryMock->method('get')->willReturn($actionMock); + $this->loadView(); + $this->model->update(); + } + + /** + * Generate change log + * + * @param int $count + * @param int $idFrom + * @param int $idTo + * @return array + */ + private function generateChangeLog(int $count, int $idFrom, int $idTo): array + { + $res = []; + $i = 0; + $id = $idFrom; + while ($i < $count) { + if ($id > $idTo) { + $id = $idFrom; + } + $res[] = $id; + $id++; + $i++; + } + + return $res; + } + + /** + * Test to Materialize view by IDs in changelog + * * @expectedException \Exception * @expectedExceptionMessage Test exception */ @@ -344,10 +466,10 @@ public function testUpdateWithException() ->method('setVersionId'); $this->stateMock->expects($this->atLeastOnce()) ->method('getMode') - ->willReturn(\Magento\Framework\Mview\View\StateInterface::MODE_ENABLED); + ->willReturn(StateInterface::MODE_ENABLED); $this->stateMock->expects($this->exactly(2)) ->method('getStatus') - ->will($this->returnValue(\Magento\Framework\Mview\View\StateInterface::STATUS_IDLE)); + ->will($this->returnValue(StateInterface::STATUS_IDLE)); $this->stateMock->expects($this->exactly(2)) ->method('setStatus') ->will($this->returnSelf()); @@ -373,7 +495,7 @@ public function testUpdateWithException() $this->returnValue($listId) ); - $actionMock = $this->createPartialMock(\Magento\Framework\Mview\ActionInterface::class, ['execute']); + $actionMock = $this->createPartialMock(ActionInterface::class, ['execute']); $actionMock->expects($this->once())->method('execute')->with($listId)->will( $this->returnCallback( function () { @@ -395,18 +517,21 @@ function () { $this->model->update(); } + /** + * Test to Suspend view updates and set version ID to changelog's end + */ public function testSuspend() { $this->stateMock->expects($this->once()) ->method('getMode') - ->will($this->returnValue(\Magento\Framework\Mview\View\StateInterface::MODE_ENABLED)); + ->will($this->returnValue(StateInterface::MODE_ENABLED)); $this->stateMock->expects($this->once()) ->method('setVersionId') ->with(11) ->will($this->returnSelf()); $this->stateMock->expects($this->once()) ->method('setStatus') - ->with(\Magento\Framework\Mview\View\StateInterface::STATUS_SUSPENDED) + ->with(StateInterface::STATUS_SUSPENDED) ->will($this->returnSelf()); $this->stateMock->expects($this->once()) ->method('save') @@ -420,11 +545,14 @@ public function testSuspend() $this->model->suspend(); } + /** + * Suspend view updates and set version ID to changelog's end + */ public function testSuspendDisabled() { $this->stateMock->expects($this->once()) ->method('getMode') - ->will($this->returnValue(\Magento\Framework\Mview\View\StateInterface::MODE_DISABLED)); + ->will($this->returnValue(StateInterface::MODE_DISABLED)); $this->stateMock->expects($this->never()) ->method('setVersionId'); $this->stateMock->expects($this->never()) @@ -439,14 +567,17 @@ public function testSuspendDisabled() $this->model->suspend(); } + /** + * Test to Resume view updates + */ public function testResume() { $this->stateMock->expects($this->once()) ->method('getStatus') - ->will($this->returnValue(\Magento\Framework\Mview\View\StateInterface::STATUS_SUSPENDED)); + ->will($this->returnValue(StateInterface::STATUS_SUSPENDED)); $this->stateMock->expects($this->once()) ->method('setStatus') - ->with(\Magento\Framework\Mview\View\StateInterface::STATUS_IDLE) + ->with(StateInterface::STATUS_IDLE) ->will($this->returnSelf()); $this->stateMock->expects($this->once()) ->method('save') @@ -457,6 +588,8 @@ public function testResume() } /** + * Test to Resume view updates + * * @param string $status * @dataProvider dataProviderResumeNotSuspended */ @@ -480,16 +613,19 @@ public function testResumeNotSuspended($status) public function dataProviderResumeNotSuspended() { return [ - [\Magento\Framework\Mview\View\StateInterface::STATUS_IDLE], - [\Magento\Framework\Mview\View\StateInterface::STATUS_WORKING], + [StateInterface::STATUS_IDLE], + [StateInterface::STATUS_WORKING], ]; } + /** + * Test to Clear precessed changelog entries + */ public function testClearChangelog() { $this->stateMock->expects($this->once()) ->method('getMode') - ->will($this->returnValue(\Magento\Framework\Mview\View\StateInterface::MODE_ENABLED)); + ->will($this->returnValue(StateInterface::MODE_ENABLED)); $this->stateMock->expects($this->once()) ->method('getVersionId') ->will($this->returnValue(11)); @@ -501,11 +637,14 @@ public function testClearChangelog() $this->model->clearChangelog(); } + /** + * Test to Clear precessed changelog entries + */ public function testClearChangelogDisabled() { $this->stateMock->expects($this->once()) ->method('getMode') - ->will($this->returnValue(\Magento\Framework\Mview\View\StateInterface::MODE_DISABLED)); + ->will($this->returnValue(StateInterface::MODE_DISABLED)); $this->stateMock->expects($this->never()) ->method('getVersionId'); $this->changelogMock->expects($this->never()) @@ -514,6 +653,9 @@ public function testClearChangelogDisabled() $this->model->clearChangelog(); } + /** + * Test to Return related state object + */ public function testSetState() { $this->model->setState($this->stateMock); @@ -521,6 +663,8 @@ public function testSetState() } /** + * Test to Check whether view is enabled + * * @param string $mode * @param bool $result * @dataProvider dataProviderIsEnabled @@ -539,12 +683,14 @@ public function testIsEnabled($mode, $result) public function dataProviderIsEnabled() { return [ - [\Magento\Framework\Mview\View\StateInterface::MODE_ENABLED, true], - [\Magento\Framework\Mview\View\StateInterface::MODE_DISABLED, false], + [StateInterface::MODE_ENABLED, true], + [StateInterface::MODE_DISABLED, false], ]; } /** + * Test to Check whether view is idle + * * @param string $status * @param bool $result * @dataProvider dataProviderIsIdle @@ -563,13 +709,15 @@ public function testIsIdle($status, $result) public function dataProviderIsIdle() { return [ - [\Magento\Framework\Mview\View\StateInterface::STATUS_IDLE, true], - [\Magento\Framework\Mview\View\StateInterface::STATUS_WORKING, false], - [\Magento\Framework\Mview\View\StateInterface::STATUS_SUSPENDED, false], + [StateInterface::STATUS_IDLE, true], + [StateInterface::STATUS_WORKING, false], + [StateInterface::STATUS_SUSPENDED, false], ]; } /** + * Test to Check whether view is working + * * @param string $status * @param bool $result * @dataProvider dataProviderIsWorking @@ -588,13 +736,15 @@ public function testIsWorking($status, $result) public function dataProviderIsWorking() { return [ - [\Magento\Framework\Mview\View\StateInterface::STATUS_IDLE, false], - [\Magento\Framework\Mview\View\StateInterface::STATUS_WORKING, true], - [\Magento\Framework\Mview\View\StateInterface::STATUS_SUSPENDED, false], + [StateInterface::STATUS_IDLE, false], + [StateInterface::STATUS_WORKING, true], + [StateInterface::STATUS_SUSPENDED, false], ]; } /** + * Test to Check whether view is suspended + * * @param string $status * @param bool $result * @dataProvider dataProviderIsSuspended @@ -613,12 +763,15 @@ public function testIsSuspended($status, $result) public function dataProviderIsSuspended() { return [ - [\Magento\Framework\Mview\View\StateInterface::STATUS_IDLE, false], - [\Magento\Framework\Mview\View\StateInterface::STATUS_WORKING, false], - [\Magento\Framework\Mview\View\StateInterface::STATUS_SUSPENDED, true], + [StateInterface::STATUS_IDLE, false], + [StateInterface::STATUS_WORKING, false], + [StateInterface::STATUS_SUSPENDED, true], ]; } + /** + * Test to Return view updated datetime + */ public function testGetUpdated() { $this->stateMock->expects($this->once()) @@ -627,6 +780,9 @@ public function testGetUpdated() $this->assertEquals('some datetime', $this->model->getUpdated()); } + /** + * Fill view data from config + */ protected function loadView() { $viewId = 'view_test'; diff --git a/lib/internal/Magento/Framework/Mview/View.php b/lib/internal/Magento/Framework/Mview/View.php index b2372eaaafaad..dade475a20482 100644 --- a/lib/internal/Magento/Framework/Mview/View.php +++ b/lib/internal/Magento/Framework/Mview/View.php @@ -291,16 +291,13 @@ public function update() */ private function executeAction(ActionInterface $action, int $lastVersionId, int $currentVersionId) { - $versionBatchSize = self::$maxVersionQueryBatch; $batchSize = isset($this->changelogBatchSize[$this->getChangelog()->getViewId()]) ? (int) $this->changelogBatchSize[$this->getChangelog()->getViewId()] : self::DEFAULT_BATCH_SIZE; - for ($vsFrom = $lastVersionId; $vsFrom < $currentVersionId; $vsFrom += $versionBatchSize) { - // Don't go past the current version for atomicity. - $versionTo = min($currentVersionId, $vsFrom + $versionBatchSize); - $ids = $this->getChangelog()->getList($vsFrom, $versionTo); - + $vsFrom = $lastVersionId; + while ($vsFrom < $currentVersionId) { + $ids = $this->getBatchOfIds($vsFrom, $currentVersionId); // We run the actual indexer in batches. // Chunked AFTER loading to avoid duplicates in separate chunks. $chunks = array_chunk($ids, $batchSize); @@ -310,6 +307,32 @@ private function executeAction(ActionInterface $action, int $lastVersionId, int } } + /** + * Get batch of entity ids + * + * @param int $lastVersionId + * @param int $currentVersionId + * @return array + */ + private function getBatchOfIds(int &$lastVersionId, int $currentVersionId): array + { + $ids = []; + $versionBatchSize = self::$maxVersionQueryBatch; + $idsBatchSize = self::$maxVersionQueryBatch; + for ($vsFrom = $lastVersionId; $vsFrom < $currentVersionId; $vsFrom += $versionBatchSize) { + // Don't go past the current version for atomicity. + $versionTo = min($currentVersionId, $vsFrom + $versionBatchSize); + /** To avoid duplicate ids need to flip and merge the array */ + $ids += array_flip($this->getChangelog()->getList($vsFrom, $versionTo)); + $lastVersionId = $versionTo; + if (count($ids) >= $idsBatchSize) { + break; + } + } + + return array_keys($ids); + } + /** * Suspend view updates and set version ID to changelog's end * From c63286e7ab569cbe2a18a69edd140a7779b6d75d Mon Sep 17 00:00:00 2001 From: Sathish <srsathish92@gmail.com> Date: Tue, 10 Dec 2019 18:12:27 +0530 Subject: [PATCH 0296/1143] Updated the jsonSerializer as optional parameters --- .../Catalog/ViewModel/Product/Breadcrumbs.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Catalog/ViewModel/Product/Breadcrumbs.php b/app/code/Magento/Catalog/ViewModel/Product/Breadcrumbs.php index 88a799f9505d4..1aad46fc1e2f5 100644 --- a/app/code/Magento/Catalog/ViewModel/Product/Breadcrumbs.php +++ b/app/code/Magento/Catalog/ViewModel/Product/Breadcrumbs.php @@ -33,36 +33,36 @@ class Breadcrumbs extends DataObject implements ArgumentInterface private $scopeConfig; /** - * @var JsonHexTag + * @var Escaper */ - private $jsonSerializer; + private $escaper; /** - * @var Escaper + * @var JsonHexTag */ - private $escaper; + private $jsonSerializer; /** * @param Data $catalogData * @param ScopeConfigInterface $scopeConfig * @param Json|null $json - * @param JsonHexTag $jsonSerializer * @param Escaper|null $escaper + * @param JsonHexTag|null $jsonSerializer * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function __construct( Data $catalogData, ScopeConfigInterface $scopeConfig, Json $json = null, - JsonHexTag $jsonSerializer, - Escaper $escaper = null + Escaper $escaper = null, + JsonHexTag $jsonSerializer = null ) { parent::__construct(); $this->catalogData = $catalogData; $this->scopeConfig = $scopeConfig; - $this->jsonSerializer = $jsonSerializer; $this->escaper = $escaper ?: ObjectManager::getInstance()->get(Escaper::class); + $this->jsonSerializer = $jsonSerializer ?: ObjectManager::getInstance()->get(JsonHexTag::class); } /** From 96f502e107bdb6f127207060055020b9d0a9c3ad Mon Sep 17 00:00:00 2001 From: maslii <maslii@users.noreply.github.com> Date: Tue, 10 Dec 2019 14:48:43 +0200 Subject: [PATCH 0297/1143] phpdoc fix return type --- app/code/Magento/Customer/Controller/Account/CreatePost.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/Controller/Account/CreatePost.php b/app/code/Magento/Customer/Controller/Account/CreatePost.php index a006cfe6725f3..e2a7c085a0b44 100644 --- a/app/code/Magento/Customer/Controller/Account/CreatePost.php +++ b/app/code/Magento/Customer/Controller/Account/CreatePost.php @@ -327,7 +327,7 @@ public function validateForCsrf(RequestInterface $request): ?bool /** * Create customer account action * - * @return void + * @return \Magento\Framework\Controller\Result\Redirect * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ From ab4fa339c24d0868fa7471d347ac98ad22f4d3fe Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Tue, 10 Dec 2019 20:28:28 +0700 Subject: [PATCH 0298/1143] Refactor and unit test for issue 25893 --- .../Adminhtml/Wysiwyg/Directive.php | 76 ++++++++++++++----- .../Adminhtml/Wysiwyg/DirectiveTest.php | 25 +++--- 2 files changed, 67 insertions(+), 34 deletions(-) diff --git a/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Directive.php b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Directive.php index db53c6a415ddd..97d0b35a2354f 100644 --- a/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Directive.php +++ b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Directive.php @@ -13,6 +13,14 @@ use Magento\Cms\Model\Template\Filter; use Magento\Cms\Model\Wysiwyg\Config; use Magento\Framework\App\Action\HttpGetActionInterface; +use Magento\Framework\Image\Adapter\AdapterInterface; +use Magento\Framework\Image\AdapterFactory; +use Psr\Log\LoggerInterface; +use Magento\Framework\Url\DecoderInterface; +use Magento\Framework\Controller\Result\Raw; +use Magento\Framework\Controller\Result\RawFactory; +use Magento\Backend\App\Action\Context; +use Magento\Framework\App\ObjectManager; /** * Process template text for wysiwyg editor. @@ -30,34 +38,68 @@ class Directive extends Action implements HttpGetActionInterface const ADMIN_RESOURCE = 'Magento_Cms::media_gallery'; /** - * @var \Magento\Framework\Url\DecoderInterface + * @var DecoderInterface */ protected $urlDecoder; /** - * @var \Magento\Framework\Controller\Result\RawFactory + * @var RawFactory */ protected $resultRawFactory; /** - * @param Action\Context $context - * @param \Magento\Framework\Url\DecoderInterface $urlDecoder - * @param \Magento\Framework\Controller\Result\RawFactory $resultRawFactory + * @var LoggerInterface + */ + private $logger; + + /** + * @var AdapterFactory + */ + private $adapterFactory; + + /** + * @var Config + */ + private $config; + + /** + * @var Filter + */ + private $filter; + + /** + * Constructor + * + * @param Context $context + * @param DecoderInterface $urlDecoder + * @param RawFactory $resultRawFactory + * @param AdapterFactory|null $adapterFactory + * @param LoggerInterface|null $logger + * @param Config|null $config + * @param Filter|null $filter */ public function __construct( - Action\Context $context, - \Magento\Framework\Url\DecoderInterface $urlDecoder, - \Magento\Framework\Controller\Result\RawFactory $resultRawFactory + Context $context, + DecoderInterface $urlDecoder, + RawFactory $resultRawFactory, + AdapterFactory $adapterFactory = null, + LoggerInterface $logger = null, + Config $config = null, + Filter $filter = null ) { parent::__construct($context); $this->urlDecoder = $urlDecoder; $this->resultRawFactory = $resultRawFactory; + $this->adapterFactory = $adapterFactory ?: ObjectManager::getInstance()->get(AdapterFactory::class); + $this->logger = $logger ?: ObjectManager::getInstance()->get(LoggerInterface::class); + $this->config = $config ?: ObjectManager::getInstance()->get(Config::class); + $this->filter = $filter ?: ObjectManager::getInstance()->get(Filter::class); } /** * Template directives callback * - * @return \Magento\Framework\Controller\Result\Raw + * @return Raw */ public function execute() { @@ -65,26 +107,24 @@ public function execute() $directive = $this->urlDecoder->decode($directive); try { /** @var Filter $filter */ - $filter = $this->_objectManager->create(Filter::class); - $imagePath = $filter->filter($directive); - /** @var \Magento\Framework\Image\Adapter\AdapterInterface $image */ - $image = $this->_objectManager->get(\Magento\Framework\Image\AdapterFactory::class)->create(); - /** @var \Magento\Framework\Controller\Result\Raw $resultRaw */ + $imagePath = $this->filter->filter($directive); + /** @var AdapterInterface $image */ + $image = $this->adapterFactory->create(); + /** @var Raw $resultRaw */ $resultRaw = $this->resultRawFactory->create(); $image->open($imagePath); $resultRaw->setHeader('Content-Type', $image->getMimeType()); $resultRaw->setContents($image->getImage()); } catch (\Exception $e) { /** @var Config $config */ - $config = $this->_objectManager->get(Config::class); - $imagePath = $config->getSkinImagePlaceholderPath(); + $imagePath = $this->config->getSkinImagePlaceholderPath(); try { $image->open($imagePath); $resultRaw->setHeader('Content-Type', $image->getMimeType()); $resultRaw->setContents($image->getImage()); - $this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e); + $this->logger->warning($e); } catch (\Exception $e) { - $this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e); + $this->logger->warning($e); } } return $resultRaw; diff --git a/app/code/Magento/Cms/Test/Unit/Controller/Adminhtml/Wysiwyg/DirectiveTest.php b/app/code/Magento/Cms/Test/Unit/Controller/Adminhtml/Wysiwyg/DirectiveTest.php index cede3a80cb98b..5fea276225622 100644 --- a/app/code/Magento/Cms/Test/Unit/Controller/Adminhtml/Wysiwyg/DirectiveTest.php +++ b/app/code/Magento/Cms/Test/Unit/Controller/Adminhtml/Wysiwyg/DirectiveTest.php @@ -151,7 +151,11 @@ protected function setUp() [ 'context' => $this->actionContextMock, 'urlDecoder' => $this->urlDecoderMock, - 'resultRawFactory' => $this->rawFactoryMock + 'resultRawFactory' => $this->rawFactoryMock, + 'adapterFactory' => $this->imageAdapterFactoryMock, + 'logger' => $this->loggerMock, + 'config' => $this->wysiwygConfigMock, + 'filter' => $this->templateFilterMock ] ); } @@ -228,7 +232,7 @@ public function testExecuteException() ->method('getImage') ->willReturn($imageBody); $this->loggerMock->expects($this->once()) - ->method('critical') + ->method('warning') ->with($exception); $this->rawFactoryMock->expects($this->any()) ->method('create') @@ -253,23 +257,12 @@ protected function prepareExecuteTest() ->method('decode') ->with($directiveParam) ->willReturn($directive); - $this->objectManagerMock->expects($this->once()) - ->method('create') - ->with(\Magento\Cms\Model\Template\Filter::class) - ->willReturn($this->templateFilterMock); + $this->templateFilterMock->expects($this->once()) ->method('filter') ->with($directive) ->willReturn(self::IMAGE_PATH); - $this->objectManagerMock->expects($this->any()) - ->method('get') - ->willReturnMap( - [ - [\Magento\Framework\Image\AdapterFactory::class, $this->imageAdapterFactoryMock], - [\Magento\Cms\Model\Wysiwyg\Config::class, $this->wysiwygConfigMock], - [\Psr\Log\LoggerInterface::class, $this->loggerMock] - ] - ); + $this->imageAdapterFactoryMock->expects($this->once()) ->method('create') ->willReturn($this->imageAdapterMock); @@ -301,7 +294,7 @@ public function testExecuteWithDeletedImage() ->willThrowException($exception); $this->loggerMock->expects($this->once()) - ->method('critical') + ->method('warning') ->with($exception); $this->wysiwygDirective->execute(); From e8eb43a84cb861cedda424aaf8be83aa1c6c1c29 Mon Sep 17 00:00:00 2001 From: Mastiuhin Olexandr <mastiuhin.olexandr@transoftgroup.com> Date: Tue, 10 Dec 2019 16:08:13 +0200 Subject: [PATCH 0299/1143] MC-25036: Marketing Email preview doesn't work with enabled js minification --- app/code/Magento/Email/composer.json | 1 + .../view/adminhtml/layout/adminhtml_email_template_preview.xml | 1 + 2 files changed, 2 insertions(+) diff --git a/app/code/Magento/Email/composer.json b/app/code/Magento/Email/composer.json index 548d9a422c132..9070fbac7c653 100644 --- a/app/code/Magento/Email/composer.json +++ b/app/code/Magento/Email/composer.json @@ -12,6 +12,7 @@ "magento/module-config": "*", "magento/module-store": "*", "magento/module-theme": "*", + "magento/module-require-js": "*", "magento/module-media-storage": "*", "magento/module-variable": "*" }, diff --git a/app/code/Magento/Email/view/adminhtml/layout/adminhtml_email_template_preview.xml b/app/code/Magento/Email/view/adminhtml/layout/adminhtml_email_template_preview.xml index e7cbc675ce386..886a76b3af6f8 100644 --- a/app/code/Magento/Email/view/adminhtml/layout/adminhtml_email_template_preview.xml +++ b/app/code/Magento/Email/view/adminhtml/layout/adminhtml_email_template_preview.xml @@ -17,6 +17,7 @@ <argument name="preview_form_view_model" xsi:type="object">Magento\Email\ViewModel\Template\Preview\Form</argument> </arguments> </block> + <block class="Magento\RequireJs\Block\Html\Head\Config" name="requirejs-config"/> </referenceContainer> </body> </page> From 25eb81ce660014deb8461be19babff66d6d4fda6 Mon Sep 17 00:00:00 2001 From: Sathish <srsathish92@gmail.com> Date: Tue, 10 Dec 2019 20:16:29 +0530 Subject: [PATCH 0300/1143] Updated the jsonSerializer position in unit test --- .../Test/Unit/ViewModel/Product/BreadcrumbsTest.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/ViewModel/Product/BreadcrumbsTest.php b/app/code/Magento/Catalog/Test/Unit/ViewModel/Product/BreadcrumbsTest.php index 38b5f35634ad7..a442041660893 100644 --- a/app/code/Magento/Catalog/Test/Unit/ViewModel/Product/BreadcrumbsTest.php +++ b/app/code/Magento/Catalog/Test/Unit/ViewModel/Product/BreadcrumbsTest.php @@ -12,6 +12,7 @@ use Magento\Catalog\ViewModel\Product\Breadcrumbs; use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Framework\Serialize\Serializer\JsonHexTag; /** * Unit test for Magento\Catalog\ViewModel\Product\Breadcrumbs. @@ -38,6 +39,11 @@ class BreadcrumbsTest extends \PHPUnit\Framework\TestCase */ private $objectManager; + /** + * @var JsonHexTag|\PHPUnit_Framework_MockObject_MockObject + */ + private $serializer; + /** * @inheritdoc */ @@ -54,15 +60,16 @@ protected function setUp() : void ->getMockForAbstractClass(); $escaper = $this->getObjectManager()->getObject(\Magento\Framework\Escaper::class); - $this->serializer = $this->createMock(\Magento\Framework\Serialize\Serializer\JsonHexTag::class); + + $this->serializer = $this->createMock(JsonHexTag::class); $this->viewModel = $this->getObjectManager()->getObject( Breadcrumbs::class, [ 'catalogData' => $this->catalogHelper, 'scopeConfig' => $this->scopeConfig, - 'jsonSerializer' => $this->serializer, - 'escaper' => $escaper + 'escaper' => $escaper, + 'jsonSerializer' => $this->serializer ] ); } From 721f8cedc063e405074c0ceaea200f0c44f905eb Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Tue, 10 Dec 2019 21:53:06 +0700 Subject: [PATCH 0301/1143] Update .csv for issue 25896 --- app/code/Magento/Cms/i18n/en_US.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Cms/i18n/en_US.csv b/app/code/Magento/Cms/i18n/en_US.csv index 2947c567d75ff..6a623f947cbc2 100644 --- a/app/code/Magento/Cms/i18n/en_US.csv +++ b/app/code/Magento/Cms/i18n/en_US.csv @@ -75,7 +75,7 @@ Pages,Pages "A block identifier with the same properties already exists in the selected store.","A block identifier with the same properties already exists in the selected store." "The page URL key contains capital letters or disallowed symbols.","The page URL key contains capital letters or disallowed symbols." "The page URL key cannot be made of only numbers.","The page URL key cannot be made of only numbers." -"Please rename the folder using only letters, numbers, underscores and dashes.","Please rename the folder using only letters, numbers, underscores and dashes." +"Please rename the folder using only Latin letters, numbers, underscores and dashes.","Please rename the folder using only Latin letters, numbers, underscores and dashes." "We found a directory with the same name. Please try another folder name.","We found a directory with the same name. Please try another folder name." "We cannot create a new directory.","We cannot create a new directory." "We cannot delete directory %1.","We cannot delete directory %1." From 37c85d61103eeecc5b6de303fe717bbd453949da Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@adobe.com> Date: Tue, 10 Dec 2019 09:55:10 -0600 Subject: [PATCH 0302/1143] MQE-1878: Stabilize community PR 742 --- ...ontMoveConfigurableProductFromShoppingCartToWishlistTest.xml | 2 +- ...ntMoveDynamicBundleProductFromShoppingCartToWishlistTest.xml | 2 +- ...rontMoveFixedBundleProductFromShoppingCartToWishlistTest.xml | 2 +- ...orefrontMoveVirtualProductFromShoppingCartToWishlistTest.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveConfigurableProductFromShoppingCartToWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveConfigurableProductFromShoppingCartToWishlistTest.xml index 49cd78ec1884f..46ea3497941fd 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveConfigurableProductFromShoppingCartToWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveConfigurableProductFromShoppingCartToWishlistTest.xml @@ -14,7 +14,7 @@ <title value="Move Configurable Product from Shopping Cart to Wishlist"/> <description value="Move Configurable Product from Shopping Cart to Wishlist"/> <severity value="CRITICAL"/> - <testCaseId value="MAGETWO-29545"/> + <testCaseId value="MC-14211"/> <group value="wishlist"/> <group value="mtf_migrated"/> </annotations> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveDynamicBundleProductFromShoppingCartToWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveDynamicBundleProductFromShoppingCartToWishlistTest.xml index 856ebdb7bb73a..6faf4c1002c1a 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveDynamicBundleProductFromShoppingCartToWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveDynamicBundleProductFromShoppingCartToWishlistTest.xml @@ -14,7 +14,7 @@ <title value="Move Dynamic Bundle Product from Shopping Cart to Wishlist"/> <description value="Move Dynamic Bundle Product from Shopping Cart to Wishlist"/> <severity value="CRITICAL"/> - <testCaseId value="MAGETWO-29545"/> + <testCaseId value="MC-14212"/> <group value="wishlist"/> <group value="mtf_migrated"/> </annotations> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveFixedBundleProductFromShoppingCartToWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveFixedBundleProductFromShoppingCartToWishlistTest.xml index 9c3984d0287ec..3906767d04cc1 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveFixedBundleProductFromShoppingCartToWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveFixedBundleProductFromShoppingCartToWishlistTest.xml @@ -14,7 +14,7 @@ <title value="Move Fixed Bundle Product from Shopping Cart to Wishlist"/> <description value="Move Fixed Bundle Product from Shopping Cart to Wishlist"/> <severity value="CRITICAL"/> - <testCaseId value="MAGETWO-29545"/> + <testCaseId value="MC-14213"/> <group value="wishlist"/> <group value="mtf_migrated"/> </annotations> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveVirtualProductFromShoppingCartToWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveVirtualProductFromShoppingCartToWishlistTest.xml index 20ac78dfbf731..dc1580797e5be 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveVirtualProductFromShoppingCartToWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveVirtualProductFromShoppingCartToWishlistTest.xml @@ -14,7 +14,7 @@ <title value="Move Virtual Product from Shopping Cart to Wishlist"/> <description value="Move Virtual Product from Shopping Cart to Wishlist"/> <severity value="CRITICAL"/> - <testCaseId value="MAGETWO-29545"/> + <testCaseId value="MC-14210"/> <group value="wishlist"/> <group value="mtf_migrated"/> </annotations> From 17a575a1ed64b6c74d969051877f01e25621ef58 Mon Sep 17 00:00:00 2001 From: Dmytro Cheshun <d.cheshun@atwix.com> Date: Tue, 10 Dec 2019 18:23:11 +0200 Subject: [PATCH 0303/1143] Restore the translatable phrase for backward compatibility --- app/code/Magento/Cms/i18n/en_US.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Cms/i18n/en_US.csv b/app/code/Magento/Cms/i18n/en_US.csv index 6a623f947cbc2..b860a8fb1041e 100644 --- a/app/code/Magento/Cms/i18n/en_US.csv +++ b/app/code/Magento/Cms/i18n/en_US.csv @@ -75,6 +75,7 @@ Pages,Pages "A block identifier with the same properties already exists in the selected store.","A block identifier with the same properties already exists in the selected store." "The page URL key contains capital letters or disallowed symbols.","The page URL key contains capital letters or disallowed symbols." "The page URL key cannot be made of only numbers.","The page URL key cannot be made of only numbers." +"Please rename the folder using only letters, numbers, underscores and dashes.","Please rename the folder using only letters, numbers, underscores and dashes." "Please rename the folder using only Latin letters, numbers, underscores and dashes.","Please rename the folder using only Latin letters, numbers, underscores and dashes." "We found a directory with the same name. Please try another folder name.","We found a directory with the same name. Please try another folder name." "We cannot create a new directory.","We cannot create a new directory." From d97d7f6e322f91f9d28fb19ccd77395f5ab3dbce Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Tue, 10 Dec 2019 11:28:53 -0600 Subject: [PATCH 0304/1143] Change action groups name according to CE branch changes --- ...WithRegularPriceOutOfStockVisibleInCategoryAndSearchTest.xml | 2 +- ...oductWithRegularPriceOutOfStockVisibleInCategoryOnlyTest.xml | 2 +- ...ProductWithRegularPriceOutOfStockVisibleInSearchOnlyTest.xml | 2 +- ...uctWithSpecialPriceInStockVisibleInCategoryAndSearchTest.xml | 2 +- ...WithSpecialPriceOutOfStockVisibleInCategoryAndSearchTest.xml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceOutOfStockVisibleInCategoryAndSearchTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceOutOfStockVisibleInCategoryAndSearchTest.xml index bbde98f8fc043..021ed5593c738 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceOutOfStockVisibleInCategoryAndSearchTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceOutOfStockVisibleInCategoryAndSearchTest.xml @@ -28,7 +28,7 @@ <createData entity="SimpleSubCategory" stepKey="categoryEntity"/> </before> <after> - <actionGroup ref="deleteProductBySku" stepKey="deleteDefaultVirtualProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteDefaultVirtualProduct"> <argument name="sku" value="{{updateVirtualProductRegularPrice5OutOfStock.sku}}"/> </actionGroup> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceOutOfStockVisibleInCategoryOnlyTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceOutOfStockVisibleInCategoryOnlyTest.xml index 15e5be210b73a..d74a6ce508b88 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceOutOfStockVisibleInCategoryOnlyTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceOutOfStockVisibleInCategoryOnlyTest.xml @@ -28,7 +28,7 @@ <createData entity="SimpleSubCategory" stepKey="categoryEntity"/> </before> <after> - <actionGroup ref="deleteProductBySku" stepKey="deleteDefaultVirtualProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteDefaultVirtualProduct"> <argument name="sku" value="{{updateVirtualProductRegularPrice5OutOfStock.sku}}"/> </actionGroup> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceOutOfStockVisibleInSearchOnlyTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceOutOfStockVisibleInSearchOnlyTest.xml index 8b4518007ea29..aa90d018f7710 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceOutOfStockVisibleInSearchOnlyTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceOutOfStockVisibleInSearchOnlyTest.xml @@ -27,7 +27,7 @@ </createData> </before> <after> - <actionGroup ref="deleteProductBySku" stepKey="deleteDefaultVirtualProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteDefaultVirtualProduct"> <argument name="sku" value="{{updateVirtualProductRegularPrice99OutOfStock.sku}}"/> </actionGroup> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithSpecialPriceInStockVisibleInCategoryAndSearchTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithSpecialPriceInStockVisibleInCategoryAndSearchTest.xml index 984c296845113..94ddb3dc5e5da 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithSpecialPriceInStockVisibleInCategoryAndSearchTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithSpecialPriceInStockVisibleInCategoryAndSearchTest.xml @@ -28,7 +28,7 @@ <createData entity="SimpleSubCategory" stepKey="categoryEntity"/> </before> <after> - <actionGroup ref="deleteProductBySku" stepKey="deleteDefaultVirtualProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteDefaultVirtualProduct"> <argument name="sku" value="{{updateVirtualProductSpecialPrice.sku}}"/> </actionGroup> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithSpecialPriceOutOfStockVisibleInCategoryAndSearchTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithSpecialPriceOutOfStockVisibleInCategoryAndSearchTest.xml index 1c590563d4cfc..a6a629b35091e 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithSpecialPriceOutOfStockVisibleInCategoryAndSearchTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithSpecialPriceOutOfStockVisibleInCategoryAndSearchTest.xml @@ -28,7 +28,7 @@ <createData entity="SimpleSubCategory" stepKey="categoryEntity"/> </before> <after> - <actionGroup ref="deleteProductBySku" stepKey="deleteDefaultVirtualProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteDefaultVirtualProduct"> <argument name="sku" value="{{updateVirtualProductSpecialPriceOutOfStock.sku}}"/> </actionGroup> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/> From d8bcc15617e792ea06bd6477f369dd5789734ef9 Mon Sep 17 00:00:00 2001 From: Dan Wallis <mrdanwallis@gmail.com> Date: Tue, 10 Dec 2019 19:05:33 +0000 Subject: [PATCH 0305/1143] Add confirmation step to index invalidation action --- app/code/Magento/Indexer/i18n/en_US.csv | 1 + .../Indexer/view/adminhtml/layout/indexer_indexer_list_grid.xml | 1 + 2 files changed, 2 insertions(+) diff --git a/app/code/Magento/Indexer/i18n/en_US.csv b/app/code/Magento/Indexer/i18n/en_US.csv index 8e27ce046ca0f..2935243856b4d 100644 --- a/app/code/Magento/Indexer/i18n/en_US.csv +++ b/app/code/Magento/Indexer/i18n/en_US.csv @@ -26,3 +26,4 @@ Description,Description Mode,Mode Status,Status Updated,Updated +"Are you sure you want to invalidate the selected index(es)?","Are you sure you want to invalidate the selected index(es)?" diff --git a/app/code/Magento/Indexer/view/adminhtml/layout/indexer_indexer_list_grid.xml b/app/code/Magento/Indexer/view/adminhtml/layout/indexer_indexer_list_grid.xml index 7c4eb22ce6128..501baa47e4938 100644 --- a/app/code/Magento/Indexer/view/adminhtml/layout/indexer_indexer_list_grid.xml +++ b/app/code/Magento/Indexer/view/adminhtml/layout/indexer_indexer_list_grid.xml @@ -33,6 +33,7 @@ <item name="invalidate_index" xsi:type="array"> <item name="label" xsi:type="string" translate="true">Invalidate index</item> <item name="url" xsi:type="string">*/indexer/massInvalidate</item> + <item name="confirm" xsi:type="string" translate="true">Are you sure you want to invalidate the selected index(es)?</item> </item> </argument> </arguments> From 5b5a194ce75de23a8d8d91ec20c4037cfd8d192c Mon Sep 17 00:00:00 2001 From: Dan Wallis <mrdanwallis@gmail.com> Date: Tue, 10 Dec 2019 19:11:45 +0000 Subject: [PATCH 0306/1143] Add class comments to appease linter --- app/code/Magento/Indexer/Controller/Adminhtml/Indexer.php | 3 +++ .../Indexer/Controller/Adminhtml/Indexer/ListAction.php | 3 +++ .../Indexer/Controller/Adminhtml/Indexer/MassChangelog.php | 3 +++ .../Indexer/Controller/Adminhtml/Indexer/MassInvalidate.php | 3 +++ .../Indexer/Controller/Adminhtml/Indexer/MassOnTheFly.php | 3 +++ 5 files changed, 15 insertions(+) diff --git a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer.php b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer.php index b1b5264d5cce6..f85a3e7577509 100644 --- a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer.php +++ b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer.php @@ -5,6 +5,9 @@ */ namespace Magento\Indexer\Controller\Adminhtml; +/** + * Abstract class used as part of inheritance tree for Indexer controllers + */ abstract class Indexer extends \Magento\Backend\App\Action { /** diff --git a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/ListAction.php b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/ListAction.php index 35cefbcda43e7..f0d7094d832d6 100644 --- a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/ListAction.php +++ b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/ListAction.php @@ -8,6 +8,9 @@ use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface; +/** + * Controller for indexer grid + */ class ListAction extends \Magento\Indexer\Controller\Adminhtml\Indexer implements HttpGetActionInterface { /** diff --git a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassChangelog.php b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassChangelog.php index 3dffd514218d6..6934284c8e65e 100644 --- a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassChangelog.php +++ b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassChangelog.php @@ -8,6 +8,9 @@ use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface; +/** + * Controller endpoint for mass action: set index mode as 'Update by Schedule' + */ class MassChangelog extends \Magento\Indexer\Controller\Adminhtml\Indexer implements HttpPostActionInterface { /** diff --git a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassInvalidate.php b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassInvalidate.php index 1cd204dfcf324..284343860afbe 100644 --- a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassInvalidate.php +++ b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassInvalidate.php @@ -7,6 +7,9 @@ use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface; +/** + * Controller endpoint for mass action: invalidate index + */ class MassInvalidate extends \Magento\Indexer\Controller\Adminhtml\Indexer implements HttpPostActionInterface { /** diff --git a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassOnTheFly.php b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassOnTheFly.php index 9f7faff8843a3..21fa7a61c621f 100644 --- a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassOnTheFly.php +++ b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassOnTheFly.php @@ -8,6 +8,9 @@ use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface; +/** + * Controller endpoint for mass action: set index mode as 'Update on Save' + */ class MassOnTheFly extends \Magento\Indexer\Controller\Adminhtml\Indexer implements HttpPostActionInterface { /** From 1022e6ea7812028f50bb802b9a1e14420d994e0e Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@adobe.com> Date: Tue, 10 Dec 2019 13:14:36 -0600 Subject: [PATCH 0307/1143] MQE-1878: Stabilize community PR 742 --- ...ntMoveConfigurableProductFromShoppingCartToWishlistTest.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveConfigurableProductFromShoppingCartToWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveConfigurableProductFromShoppingCartToWishlistTest.xml index 46ea3497941fd..70268f4e14e8f 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveConfigurableProductFromShoppingCartToWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveConfigurableProductFromShoppingCartToWishlistTest.xml @@ -106,6 +106,9 @@ <requiredEntity createDataKey="createConfigProduct"/> <requiredEntity createDataKey="createConfigChildProduct3"/> </createData> + + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> </before> <after> <!-- Delete data --> From 2da0d9db42b827f7ce41f50b0fede05a65da8520 Mon Sep 17 00:00:00 2001 From: Dan Wallis <mrdanwallis@gmail.com> Date: Tue, 10 Dec 2019 19:16:50 +0000 Subject: [PATCH 0308/1143] Avoid use of Object Manager --- .../Adminhtml/Indexer/MassInvalidate.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassInvalidate.php b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassInvalidate.php index 284343860afbe..a64daea9f276b 100644 --- a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassInvalidate.php +++ b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassInvalidate.php @@ -5,13 +5,27 @@ */ namespace Magento\Indexer\Controller\Adminhtml\Indexer; +use Magento\Backend\App\Action\Context; use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface; +use Magento\Framework\Indexer\IndexerRegistry; /** * Controller endpoint for mass action: invalidate index */ class MassInvalidate extends \Magento\Indexer\Controller\Adminhtml\Indexer implements HttpPostActionInterface { + /** + * @param Context $context + * @param IndexerRegistry $indexerRegistry + */ + public function __construct( + Context $context, + IndexerRegistry $indexerRegistry + ) { + parent::__construct($context); + $this->indexerRegistry = $indexerRegistry; + } + /** * Turn mview on for the given indexers * @@ -26,9 +40,7 @@ public function execute() try { foreach ($indexerIds as $indexerId) { /** @var \Magento\Framework\Indexer\IndexerInterface $model */ - $model = $this->_objectManager->get( - \Magento\Framework\Indexer\IndexerRegistry::class - )->get($indexerId); + $model = $this->indexerRegistry->get($indexerId); $model->invalidate(); } $this->messageManager->addSuccess( From e853bf692bbff2a4b3811bb14f8d3d09b24e9386 Mon Sep 17 00:00:00 2001 From: Buba Suma <soumah@adobe.com> Date: Tue, 10 Dec 2019 13:23:05 -0600 Subject: [PATCH 0309/1143] MC-17629: Control over search results min terms to match - Fix static tests --- .../Model/Config/Backend/MinimumShouldMatch.php | 5 ++++- .../Test/Unit/Model/Client/ElasticsearchTest.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Elasticsearch/Model/Config/Backend/MinimumShouldMatch.php b/app/code/Magento/Elasticsearch/Model/Config/Backend/MinimumShouldMatch.php index 434270c62d3d9..ea64ccd772682 100644 --- a/app/code/Magento/Elasticsearch/Model/Config/Backend/MinimumShouldMatch.php +++ b/app/code/Magento/Elasticsearch/Model/Config/Backend/MinimumShouldMatch.php @@ -34,7 +34,10 @@ public function validateValue(): void { if (strlen($this->getValue()) && !preg_match('/^((\d+<)?-?\d+%?\s?)+$/', $this->getValue())) { throw new LocalizedException( - __('Value for the field "%1" was not saved because of the incorrect format.', __('Minimum Terms to Match')) + __( + 'Value for the field "%1" was not saved because of the incorrect format.', + __('Minimum Terms to Match') + ) ); } } diff --git a/app/code/Magento/Elasticsearch6/Test/Unit/Model/Client/ElasticsearchTest.php b/app/code/Magento/Elasticsearch6/Test/Unit/Model/Client/ElasticsearchTest.php index 8bb27d366ae26..607624d7b5e8e 100644 --- a/app/code/Magento/Elasticsearch6/Test/Unit/Model/Client/ElasticsearchTest.php +++ b/app/code/Magento/Elasticsearch6/Test/Unit/Model/Client/ElasticsearchTest.php @@ -12,7 +12,7 @@ use Magento\Elasticsearch6\Model\Client\Elasticsearch; /** - * Class ElasticsearchTest + * Test elasticsearch client methods */ class ElasticsearchTest extends \PHPUnit\Framework\TestCase { From ad381ef6b3e56d1515e7766ddcfcba3a7514db20 Mon Sep 17 00:00:00 2001 From: Dan Wallis <mrdanwallis@gmail.com> Date: Tue, 10 Dec 2019 19:24:55 +0000 Subject: [PATCH 0310/1143] Directly return result redirect object --- .../Indexer/Controller/Adminhtml/Indexer/MassInvalidate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassInvalidate.php b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassInvalidate.php index a64daea9f276b..5551d8fda5178 100644 --- a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassInvalidate.php +++ b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassInvalidate.php @@ -55,6 +55,6 @@ public function execute() ); } } - $this->_redirect('*/*/list'); + return $this->resultRedirectFactory->create()->setPath('*/*/list'); } } From 8f3b2823fa6f2f7f1800bcab7c00961536b6685e Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Tue, 10 Dec 2019 13:53:45 -0600 Subject: [PATCH 0311/1143] Change action groups name according to CE branch changes --- .../Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml index cea026577f98f..d0502b41e2856 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml @@ -41,7 +41,7 @@ <after> <deleteData createDataKey="createSimpleProductApi" stepKey="deleteSimpleProductApi"/> <!-- Delete the rule --> - <actionGroup ref="RemoveCatalogPriceRule" stepKey="deletePriceRule"> + <actionGroup ref="RemoveCatalogPriceRuleActionGroup" stepKey="deletePriceRule"> <argument name="ruleName" value="{{CatalogRuleToPercent.name}}" /> </actionGroup> <!--Clear all filters in grid--> From fa095edbfafe4d99248ca7ea9e99bec3be415fcf Mon Sep 17 00:00:00 2001 From: Buba Suma <soumah@adobe.com> Date: Tue, 10 Dec 2019 14:02:38 -0600 Subject: [PATCH 0312/1143] MC-22572: Shuffle related, up-sale and cross-sale products either by priority and weight - Fix static tests --- .../templates/product/list/items.phtml | 50 ++++++++++--------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml index 8f1fe3fa6874c..fc4d85044a8d6 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml @@ -6,6 +6,8 @@ // phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis // phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect +// phpcs:disable Generic.Files.LineLength +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundHelper /* @var $block \Magento\Catalog\Block\Product\AbstractProduct */ ?> @@ -156,22 +158,22 @@ switch ($type = $block->getType()) { } ?> -<?php if ($exist) :?> +<?php if ($exist):?> -<?php if ($type == 'related' || $type == 'upsell') :?> -<?php if ($type == 'related') :?> +<?php if ($type == 'related' || $type == 'upsell'):?> +<?php if ($type == 'related'):?> <div class="block <?= $block->escapeHtmlAttr($class) ?>" data-mage-init='{"relatedProducts":{"relatedCheckbox":".related.checkbox"}}' data-limit="<?= $block->escapeHtmlAttr($limit) ?>" data-shuffle="<?= /* @noEscape */ $shuffle ?>" data-shuffle-weighted="<?= /* @noEscape */ $isWeightedRandom ?>"> - <?php else :?> + <?php else:?> <div class="block <?= $block->escapeHtmlAttr($class) ?>" data-mage-init='{"upsellProducts":{}}' data-limit="<?= $block->escapeHtmlAttr($limit) ?>" data-shuffle="<?= /* @noEscape */ $shuffle ?>" data-shuffle-weighted="<?= /* @noEscape */ $isWeightedRandom ?>"> <?php endif; ?> - <?php else :?> + <?php else:?> <div class="block <?= $block->escapeHtmlAttr($class) ?>"> <?php endif; ?> <div class="block-title title"> <strong id="block-<?= $block->escapeHtmlAttr($class) ?>-heading" role="heading" aria-level="2"><?= $block->escapeHtml($title) ?></strong> </div> <div class="block-content content" aria-labelledby="block-<?= $block->escapeHtmlAttr($class) ?>-heading"> - <?php if ($type == 'related' && $canItemsAddToCart) :?> + <?php if ($type == 'related' && $canItemsAddToCart):?> <div class="block-actions"> <?= $block->escapeHtml(__('Check items to add to the cart or')) ?> <button type="button" class="action select" data-role="select-all"><span><?= $block->escapeHtml(__('select all')) ?></span></button> @@ -179,16 +181,16 @@ switch ($type = $block->getType()) { <?php endif; ?> <div class="products wrapper grid products-grid products-<?= $block->escapeHtmlAttr($type) ?>"> <ol class="products list items product-items"> - <?php foreach ($items as $_item) :?> + <?php foreach ($items as $_item):?> <?php $available = ''; ?> - <?php if (!$_item->isComposite() && $_item->isSaleable() && $type == 'related') :?> - <?php if (!$_item->getRequiredOptions()) :?> + <?php if (!$_item->isComposite() && $_item->isSaleable() && $type == 'related'):?> + <?php if (!$_item->getRequiredOptions()):?> <?php $available = 'related-available'; ?> <?php endif; ?> <?php endif; ?> - <?php if ($type == 'related' || $type == 'upsell') :?> + <?php if ($type == 'related' || $type == 'upsell'):?> <li class="item product product-item" style="display: none;" data-shuffle-group="<?= $block->escapeHtmlAttr($_item->getPriority()) ?>" > - <?php else :?> + <?php else:?> <li class="item product product-item"> <?php endif; ?> <div class="product-item-info <?= /* @noEscape */ $available ?>"> @@ -203,12 +205,12 @@ switch ($type = $block->getType()) { <?= /* @noEscape */ $block->getProductPrice($_item) ?> - <?php if ($templateType) :?> + <?php if ($templateType):?> <?= $block->getReviewsSummaryHtml($_item, $templateType) ?> <?php endif; ?> - <?php if ($canItemsAddToCart && !$_item->isComposite() && $_item->isSaleable() && $type == 'related') :?> - <?php if (!$_item->getRequiredOptions()) :?> + <?php if ($canItemsAddToCart && !$_item->isComposite() && $_item->isSaleable() && $type == 'related'):?> + <?php if (!$_item->getRequiredOptions()):?> <div class="field choice related"> <input type="checkbox" class="checkbox related" id="related-checkbox<?= $block->escapeHtmlAttr($_item->getId()) ?>" name="related_products[]" value="<?= $block->escapeHtmlAttr($_item->getId()) ?>" /> <label class="label" for="related-checkbox<?= $block->escapeHtmlAttr($_item->getId()) ?>"><span><?= $block->escapeHtml(__('Add to Cart')) ?></span></label> @@ -216,16 +218,16 @@ switch ($type = $block->getType()) { <?php endif; ?> <?php endif; ?> - <?php if ($showAddTo || $showCart) :?> + <?php if ($showAddTo || $showCart):?> <div class="product actions product-item-actions"> - <?php if ($showCart) :?> + <?php if ($showCart):?> <div class="actions-primary"> - <?php if ($_item->isSaleable()) :?> - <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)) :?> + <?php if ($_item->isSaleable()):?> + <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)):?> <button class="action tocart primary" data-mage-init='{"redirectUrl": {"url": "<?= $block->escapeUrl($block->getAddToCartUrl($_item)) ?>"}}' type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> - <?php else :?> + <?php else:?> <?php $postDataHelper = $this->helper(Magento\Framework\Data\Helper\PostHelper::class); $postData = $postDataHelper->getPostData($block->escapeUrl($block->getAddToCartUrl($_item)), ['product' => $_item->getEntityId()]) ?> @@ -235,19 +237,19 @@ switch ($type = $block->getType()) { <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php endif; ?> - <?php else :?> - <?php if ($_item->getIsSalable()) :?> + <?php else:?> + <?php if ($_item->getIsSalable()):?> <div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div> - <?php else :?> + <?php else:?> <div class="stock unavailable"><span><?= $block->escapeHtml(__('Out of stock')) ?></span></div> <?php endif; ?> <?php endif; ?> </div> <?php endif; ?> - <?php if ($showAddTo) :?> + <?php if ($showAddTo):?> <div class="secondary-addto-links actions-secondary" data-role="add-to-links"> - <?php if ($addToBlock = $block->getChildBlock('addto')) :?> + <?php if ($addToBlock = $block->getChildBlock('addto')):?> <?= $addToBlock->setProduct($_item)->getChildHtml() ?> <?php endif; ?> </div> From 79f3fc8b9c4a58d701b5d6b583fb6712a8ecde17 Mon Sep 17 00:00:00 2001 From: Dan Wallis <mrdanwallis@gmail.com> Date: Tue, 10 Dec 2019 22:41:27 +0000 Subject: [PATCH 0313/1143] Update test constructor to include new parameter --- .../Unit/Controller/Adminhtml/Indexer/MassInvalidateTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Indexer/Test/Unit/Controller/Adminhtml/Indexer/MassInvalidateTest.php b/app/code/Magento/Indexer/Test/Unit/Controller/Adminhtml/Indexer/MassInvalidateTest.php index c80d8b7a7b5c6..a294aaaae4643 100644 --- a/app/code/Magento/Indexer/Test/Unit/Controller/Adminhtml/Indexer/MassInvalidateTest.php +++ b/app/code/Magento/Indexer/Test/Unit/Controller/Adminhtml/Indexer/MassInvalidateTest.php @@ -172,7 +172,7 @@ protected function setUp() */ public function testExecute($indexerIds, $exception) { - $this->controller = new \Magento\Indexer\Controller\Adminhtml\Indexer\MassInvalidate($this->contextMock); + $this->controller = new \Magento\Indexer\Controller\Adminhtml\Indexer\MassInvalidate($this->contextMock, $this->indexReg); $this->request->expects($this->any()) ->method('getParam')->with('indexer_ids') ->will($this->returnValue($indexerIds)); From dcd38bbd474acdd8b1ad02527dfc5ac90e65ba1f Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Tue, 10 Dec 2019 17:18:32 -0600 Subject: [PATCH 0314/1143] Change action groups name according to CE branch changes --- ...uctToWishListSuccessMessageActionGroup.xml | 22 +++++++++++++++++ ...ertProductDetailsInWishlistActionGroup.xml | 24 +++++++++++++++++++ ...tProductIsPresentInWishListActionGroup.xml | 15 ++++++++---- ...eProductFromShoppingCartToWishlistTest.xml | 6 ++--- ...eProductFromShoppingCartToWishlistTest.xml | 6 ++--- ...eProductFromShoppingCartToWishlistTest.xml | 6 ++--- ...lProductFromShoppingCartToWishlistTest.xml | 4 ++-- 7 files changed, 67 insertions(+), 16 deletions(-) diff --git a/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/AssertMoveProductToWishListSuccessMessageActionGroup.xml b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/AssertMoveProductToWishListSuccessMessageActionGroup.xml index e69de29bb2d1d..37d26f984b3eb 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/AssertMoveProductToWishListSuccessMessageActionGroup.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/AssertMoveProductToWishListSuccessMessageActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertMoveProductToWishListSuccessMessageActionGroup"> + <annotations> + <description>Moves a product from the cart to the wishlist.</description> + </annotations> + <arguments> + <argument name="productName" type="string"/> + </arguments> + <click selector="{{CheckoutCartProductSection.moveToWishlistByProductName(productName)}}" stepKey="moveToWishlist"/> + <waitForPageLoad stepKey="waitForMove"/> + <see userInput="{{productName}} has been moved to your wish list." selector="{{CheckoutCartMessageSection.successMessage}}" stepKey="assertSuccess"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/AssertProductDetailsInWishlistActionGroup.xml b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/AssertProductDetailsInWishlistActionGroup.xml index e69de29bb2d1d..4498882a206d1 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/AssertProductDetailsInWishlistActionGroup.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/AssertProductDetailsInWishlistActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertProductIsPresentInWishListActionGroup"> + <annotations> + <description>Go to storefront customer wishlist page and assert product name and price is present.</description> + </annotations> + <arguments> + <argument name="productName" type="string"/> + <argument name="productPrice" type="string"/> + </arguments> + <amOnPage url="{{StorefrontCustomerWishlistPage.url}}" stepKey="goToWishList"/> + <waitForPageLoad stepKey="waitForWishList"/> + <waitForElement selector="{{StorefrontCustomerWishlistProductSection.ProductTitleByName(productName)}}" time="30" stepKey="assertProductName"/> + <see userInput="{{productPrice}}" selector="{{StorefrontCustomerWishlistProductSection.ProductPriceByName(productName)}}" stepKey="assertProductPrice"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/AssertProductIsPresentInWishListActionGroup.xml b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/AssertProductIsPresentInWishListActionGroup.xml index 37d26f984b3eb..85c91e1a0f14c 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/AssertProductIsPresentInWishListActionGroup.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/AssertProductIsPresentInWishListActionGroup.xml @@ -8,15 +8,20 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AssertMoveProductToWishListSuccessMessageActionGroup"> + <actionGroup name="AssertProductDetailsInWishlistActionGroup"> <annotations> - <description>Moves a product from the cart to the wishlist.</description> + <description>Assert product name and price in wishlist on hover.</description> </annotations> <arguments> <argument name="productName" type="string"/> + <argument name="label" type="string"/> + <argument name="labelValue" type="string"/> </arguments> - <click selector="{{CheckoutCartProductSection.moveToWishlistByProductName(productName)}}" stepKey="moveToWishlist"/> - <waitForPageLoad stepKey="waitForMove"/> - <see userInput="{{productName}} has been moved to your wish list." selector="{{CheckoutCartMessageSection.successMessage}}" stepKey="assertSuccess"/> + <moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.ProductInfoByName(productName)}}" stepKey="moveMouseOverProductInfo"/> + <seeElement selector="{{StorefrontCustomerWishlistProductSection.ProductAddToCartByName(productName)}}" stepKey="seeAddToCart"/> + <seeElement selector="{{StorefrontCustomerWishlistProductSection.ProductImageByName(productName)}}" stepKey="seeImage"/> + <moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.productSeeDetailsByName(productName)}}" stepKey="moveMouseOverProductDetails"/> + <see userInput="{{label}}" selector="{{StorefrontCustomerWishlistProductSection.productSeeDetailsLabelByName(productName)}}" stepKey="seeLabel"/> + <see userInput="{{labelValue}}" selector="{{StorefrontCustomerWishlistProductSection.productSeeDetailsValueByName(productName)}}" stepKey="seeLabelValue"/> </actionGroup> </actionGroups> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveConfigurableProductFromShoppingCartToWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveConfigurableProductFromShoppingCartToWishlistTest.xml index 70268f4e14e8f..c7e1be33c963a 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveConfigurableProductFromShoppingCartToWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveConfigurableProductFromShoppingCartToWishlistTest.xml @@ -144,18 +144,18 @@ <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="selectViewAndEditCart"/> <!-- Assert move product to wishlist success message --> - <actionGroup ref="AssertMoveProductToWishListSuccessMessage" stepKey="moveToWishlist"> + <actionGroup ref="AssertMoveProductToWishListSuccessMessageActionGroup" stepKey="moveToWishlist"> <argument name="productName" value="$$createConfigProduct.name$$"/> </actionGroup> <!-- Assert product is present in wishlist --> - <actionGroup ref="AssertProductIsPresentInWishList" stepKey="assertProductPresent"> + <actionGroup ref="AssertProductIsPresentInWishListActionGroup" stepKey="assertProductPresent"> <argument name="productName" value="$$createConfigProduct.name$$"/> <argument name="productPrice" value="$20.00"/> </actionGroup> <!-- Assert product details in Wishlist --> - <actionGroup ref="AssertProductDetailsInWishlist" stepKey="assertProductDetails"> + <actionGroup ref="AssertProductDetailsInWishlistActionGroup" stepKey="assertProductDetails"> <argument name="productName" value="$$createConfigProduct.name$$"/> <argument name="label" value="$$createConfigProductAttribute.default_value$$"/> <argument name="labelValue" value="$$getConfigAttributeOption2.label$$"/> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveDynamicBundleProductFromShoppingCartToWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveDynamicBundleProductFromShoppingCartToWishlistTest.xml index 6faf4c1002c1a..d527056ca89fd 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveDynamicBundleProductFromShoppingCartToWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveDynamicBundleProductFromShoppingCartToWishlistTest.xml @@ -87,18 +87,18 @@ <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="selectViewAndEditCart"/> <!-- Assert move product to wishlist success message --> - <actionGroup ref="AssertMoveProductToWishListSuccessMessage" stepKey="moveToWishlist"> + <actionGroup ref="AssertMoveProductToWishListSuccessMessageActionGroup" stepKey="moveToWishlist"> <argument name="productName" value="$$createBundleProduct.name$$"/> </actionGroup> <!-- Assert product is present in wishlist --> - <actionGroup ref="AssertProductIsPresentInWishList" stepKey="assertProductPresent"> + <actionGroup ref="AssertProductIsPresentInWishListActionGroup" stepKey="assertProductPresent"> <argument name="productName" value="$$createBundleProduct.name$$"/> <argument name="productPrice" value="$100.00"/> </actionGroup> <!-- Assert product details in Wishlist --> - <actionGroup ref="AssertProductDetailsInWishlist" stepKey="assertProductDetails"> + <actionGroup ref="AssertProductDetailsInWishlistActionGroup" stepKey="assertProductDetails"> <argument name="productName" value="$$createBundleProduct.name$$"/> <argument name="label" value="$$createBundleOption1_1.title$$"/> <argument name="labelValue" value="$$simpleProduct1.sku$$ $100.00"/> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveFixedBundleProductFromShoppingCartToWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveFixedBundleProductFromShoppingCartToWishlistTest.xml index 3906767d04cc1..4d7371854dfef 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveFixedBundleProductFromShoppingCartToWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveFixedBundleProductFromShoppingCartToWishlistTest.xml @@ -78,18 +78,18 @@ <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="selectViewAndEditCart"/> <!-- Assert move product to wishlist success message --> - <actionGroup ref="AssertMoveProductToWishListSuccessMessage" stepKey="moveToWishlist"> + <actionGroup ref="AssertMoveProductToWishListSuccessMessageActionGroup" stepKey="moveToWishlist"> <argument name="productName" value="$$createBundleProduct.name$$"/> </actionGroup> <!-- Assert product is present in wishlist --> - <actionGroup ref="AssertProductIsPresentInWishList" stepKey="assertProductPresent"> + <actionGroup ref="AssertProductIsPresentInWishListActionGroup" stepKey="assertProductPresent"> <argument name="productName" value="$$createBundleProduct.name$$"/> <argument name="productPrice" value="$101.23"/> </actionGroup> <!-- Assert product details in Wishlist --> - <actionGroup ref="AssertProductDetailsInWishlist" stepKey="assertProductDetails"> + <actionGroup ref="AssertProductDetailsInWishlistActionGroup" stepKey="assertProductDetails"> <argument name="productName" value="$$createBundleProduct.name$$"/> <argument name="label" value="$$createBundleOption1_1.title$$"/> <argument name="labelValue" value="$$simpleProduct1.sku$$ $100.00"/> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveVirtualProductFromShoppingCartToWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveVirtualProductFromShoppingCartToWishlistTest.xml index dc1580797e5be..adf1e4953badc 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveVirtualProductFromShoppingCartToWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveVirtualProductFromShoppingCartToWishlistTest.xml @@ -53,12 +53,12 @@ <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="selectViewAndEditCart"/> <!-- Assert move product to wishlist success message --> - <actionGroup ref="AssertMoveProductToWishListSuccessMessage" stepKey="moveToWishlist"> + <actionGroup ref="AssertMoveProductToWishListSuccessMessageActionGroup" stepKey="moveToWishlist"> <argument name="productName" value="$$createProduct.name$$"/> </actionGroup> <!-- Assert product is present in wishlist --> - <actionGroup ref="AssertProductIsPresentInWishList" stepKey="assertProductPresent"> + <actionGroup ref="AssertProductIsPresentInWishListActionGroup" stepKey="assertProductPresent"> <argument name="productName" value="$$createProduct.name$$"/> <argument name="productPrice" value="$$createProduct.price$$"/> </actionGroup> From 6c321efd45f845003920274619dd6ac141966dbc Mon Sep 17 00:00:00 2001 From: Dan Wallis <mrdanwallis@gmail.com> Date: Tue, 10 Dec 2019 23:30:53 +0000 Subject: [PATCH 0315/1143] Fix unit test to match recent changes --- .../Adminhtml/Indexer/MassInvalidateTest.php | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Indexer/Test/Unit/Controller/Adminhtml/Indexer/MassInvalidateTest.php b/app/code/Magento/Indexer/Test/Unit/Controller/Adminhtml/Indexer/MassInvalidateTest.php index a294aaaae4643..66c0a8bbc1368 100644 --- a/app/code/Magento/Indexer/Test/Unit/Controller/Adminhtml/Indexer/MassInvalidateTest.php +++ b/app/code/Magento/Indexer/Test/Unit/Controller/Adminhtml/Indexer/MassInvalidateTest.php @@ -80,6 +80,11 @@ class MassInvalidateTest extends \PHPUnit\Framework\TestCase */ protected $session; + /** + * @var \Magento\Framework\Controller\Result\Redirect + */ + protected $resultRedirect; + /** * Set up test * @SuppressWarnings(PHPMD.ExcessiveMethodLength) @@ -100,7 +105,8 @@ protected function setUp() 'getRequest', 'getResponse', 'getObjectManager', - 'getMessageManager' + 'getMessageManager', + 'getResultRedirectFactory', ]); $this->response = $this->createPartialMock( @@ -140,6 +146,19 @@ protected function setUp() false ); + $resultRedirectFactory = $this->createPartialMock( + \Magento\Backend\Model\View\Result\RedirectFactory::class, + ['create'] + ); + $this->resultRedirect = $this->createPartialMock( + \Magento\Framework\Controller\Result\Redirect::class, + ['setPath'] + ); + $this->contextMock->expects($this->any())->method('getResultRedirectFactory') + ->willReturn($resultRedirectFactory); + $resultRedirectFactory->expects($this->any())->method('create') + ->willReturn($this->resultRedirect); + $this->response->expects($this->any())->method("setRedirect")->willReturn(1); $this->page = $this->createMock(\Magento\Framework\View\Result\Page::class); $this->config = $this->createMock(\Magento\Framework\View\Result\Page::class); @@ -172,7 +191,10 @@ protected function setUp() */ public function testExecute($indexerIds, $exception) { - $this->controller = new \Magento\Indexer\Controller\Adminhtml\Indexer\MassInvalidate($this->contextMock, $this->indexReg); + $this->controller = new \Magento\Indexer\Controller\Adminhtml\Indexer\MassInvalidate( + $this->contextMock, + $this->indexReg + ); $this->request->expects($this->any()) ->method('getParam')->with('indexer_ids') ->will($this->returnValue($indexerIds)); @@ -222,9 +244,9 @@ public function testExecute($indexerIds, $exception) $this->helper->expects($this->any())->method("getUrl")->willReturn("magento.com"); $this->response->expects($this->any())->method("setRedirect")->willReturn(1); + $this->resultRedirect->expects($this->once())->method('setPath')->with('*/*/list'); - $result = $this->controller->execute(); - $this->assertNull($result); + $this->controller->execute(); } /** From 777f409947c8fa9cf5128b84673df8370a56bc9a Mon Sep 17 00:00:00 2001 From: Dan Wallis <mrdanwallis@gmail.com> Date: Tue, 10 Dec 2019 23:59:20 +0000 Subject: [PATCH 0316/1143] Simplify test logic --- .../Adminhtml/Indexer/MassInvalidateTest.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/Indexer/Test/Unit/Controller/Adminhtml/Indexer/MassInvalidateTest.php b/app/code/Magento/Indexer/Test/Unit/Controller/Adminhtml/Indexer/MassInvalidateTest.php index 66c0a8bbc1368..ec061d2314329 100644 --- a/app/code/Magento/Indexer/Test/Unit/Controller/Adminhtml/Indexer/MassInvalidateTest.php +++ b/app/code/Magento/Indexer/Test/Unit/Controller/Adminhtml/Indexer/MassInvalidateTest.php @@ -227,18 +227,14 @@ public function testExecute($indexerIds, $exception) if ($exception) { if ($exception instanceof \Magento\Framework\Exception\LocalizedException) { - $expectError = 1; - $expectException = 0; + $this->messageManager->expects($this->exactly(1)) + ->method('addError') + ->with($exception->getMessage()); } else { - $expectError = 0; - $expectException = 1; + $this->messageManager->expects($this->exactly(1)) + ->method('addException') + ->with($exception, "We couldn't invalidate indexer(s) because of an error."); } - $this->messageManager->expects($this->exactly($expectError)) - ->method('addError') - ->with($exception->getMessage()); - $this->messageManager->expects($this->exactly($expectException)) - ->method('addException') - ->with($exception, "We couldn't invalidate indexer(s) because of an error."); } } From 9c32f0ad5fe4116abcbf0b1051027963d63bb045 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Tue, 10 Dec 2019 18:55:49 -0600 Subject: [PATCH 0317/1143] Change action groups name according to CE branch changes --- .../AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml | 2 +- .../Test/AdminDeleteCategoryUrlRewriteWithRequestPathTest.xml | 2 +- ...tMoveConfigurableProductFromShoppingCartToWishlistTest.xml | 4 ++-- ...MoveDynamicBundleProductFromShoppingCartToWishlistTest.xml | 4 ++-- ...ntMoveFixedBundleProductFromShoppingCartToWishlistTest.xml | 4 ++-- ...efrontMoveVirtualProductFromShoppingCartToWishlistTest.xml | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml index 5a05dab7aa707..97e1f16016045 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml @@ -28,7 +28,7 @@ </after> <!--Create the Category Url Rewrite--> - <actionGroup ref="AdminAddUrlRewrite" stepKey="addUrlRewrite"> + <actionGroup ref="AdminAddUrlRewriteActionGroup" stepKey="addUrlRewrite"> <argument name="category" value="$$category.name$$"/> <argument name="customUrlRewriteValue" value="For Category"/> <argument name="storeValue" value="Default Store View"/> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteWithRequestPathTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteWithRequestPathTest.xml index e94e10767c632..18c3e1abe59c4 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteWithRequestPathTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteWithRequestPathTest.xml @@ -28,7 +28,7 @@ </after> <!--Create the Category Url Rewrite--> - <actionGroup ref="AdminAddUrlRewrite" stepKey="addUrlRewriteSecondTime"> + <actionGroup ref="AdminAddUrlRewriteActionGroup" stepKey="addUrlRewriteSecondTime"> <argument name="category" value="$$category.name$$"/> <argument name="customUrlRewriteValue" value="For Category"/> <argument name="storeValue" value="Default Store View"/> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveConfigurableProductFromShoppingCartToWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveConfigurableProductFromShoppingCartToWishlistTest.xml index c7e1be33c963a..0f94a08328c95 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveConfigurableProductFromShoppingCartToWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveConfigurableProductFromShoppingCartToWishlistTest.xml @@ -136,12 +136,12 @@ <scrollTo selector="{{StorefrontProductInfoMainSection.productAddToWishlist}}" y="-200" stepKey="scroll"/> <!-- Add product to the cart and Assert add product to cart success message--> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartVirtualProductFromStorefrontProductPage"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartVirtualProductFromStorefrontProductPage"> <argument name="productName" value="$$createConfigProduct.name$$"/> </actionGroup> <!-- Select Mini Cart and select 'View And Edit Cart' --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="selectViewAndEditCart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="selectViewAndEditCart"/> <!-- Assert move product to wishlist success message --> <actionGroup ref="AssertMoveProductToWishListSuccessMessageActionGroup" stepKey="moveToWishlist"> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveDynamicBundleProductFromShoppingCartToWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveDynamicBundleProductFromShoppingCartToWishlistTest.xml index d527056ca89fd..76e1240b0df77 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveDynamicBundleProductFromShoppingCartToWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveDynamicBundleProductFromShoppingCartToWishlistTest.xml @@ -79,12 +79,12 @@ <fillField selector="{{StorefrontBundledSection.dropDownOptionOneQuantity($$createBundleOption1_1.title$$)}}" userInput="1" stepKey="fillQuantity00"/> <!-- Add product to the cart and Assert add product to cart success message--> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartVirtualProductFromStorefrontProductPage"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartVirtualProductFromStorefrontProductPage"> <argument name="productName" value="$$createBundleProduct.name$$"/> </actionGroup> <!-- Select Mini Cart and select 'View And Edit Cart' --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="selectViewAndEditCart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="selectViewAndEditCart"/> <!-- Assert move product to wishlist success message --> <actionGroup ref="AssertMoveProductToWishListSuccessMessageActionGroup" stepKey="moveToWishlist"> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveFixedBundleProductFromShoppingCartToWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveFixedBundleProductFromShoppingCartToWishlistTest.xml index 4d7371854dfef..2d83043f81318 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveFixedBundleProductFromShoppingCartToWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveFixedBundleProductFromShoppingCartToWishlistTest.xml @@ -70,12 +70,12 @@ <fillField selector="{{StorefrontBundledSection.dropDownOptionOneQuantity($$createBundleOption1_1.title$$)}}" userInput="1" stepKey="fillQuantity00"/> <!-- Add product to the cart and Assert add product to cart success message--> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartVirtualProductFromStorefrontProductPage"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartVirtualProductFromStorefrontProductPage"> <argument name="productName" value="$$createBundleProduct.name$$"/> </actionGroup> <!-- Select Mini Cart and select 'View And Edit Cart' --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="selectViewAndEditCart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="selectViewAndEditCart"/> <!-- Assert move product to wishlist success message --> <actionGroup ref="AssertMoveProductToWishListSuccessMessageActionGroup" stepKey="moveToWishlist"> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveVirtualProductFromShoppingCartToWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveVirtualProductFromShoppingCartToWishlistTest.xml index adf1e4953badc..ad10b8d01bbbd 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveVirtualProductFromShoppingCartToWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveVirtualProductFromShoppingCartToWishlistTest.xml @@ -45,12 +45,12 @@ <waitForPageLoad stepKey="waitForPageToLoad"/> <!-- Add Virtual product to the cart and Assert add product to cart success message--> - <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartVirtualProductFromStorefrontProductPage"> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartVirtualProductFromStorefrontProductPage"> <argument name="productName" value="$$createProduct.name$$"/> </actionGroup> <!-- Select Mini Cart and select 'View And Edit Cart' --> - <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="selectViewAndEditCart"/> + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="selectViewAndEditCart"/> <!-- Assert move product to wishlist success message --> <actionGroup ref="AssertMoveProductToWishListSuccessMessageActionGroup" stepKey="moveToWishlist"> From 802126ceaf0aba31101b83c0c7f934c8c0520ff4 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Tue, 10 Dec 2019 20:42:07 -0600 Subject: [PATCH 0318/1143] Change action groups name according to CE branch changes --- .../CreateNewPageWithAllValuesAndContentActionGroup.xml | 2 +- .../AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml | 4 ++-- .../Test/AdminDeleteCategoryUrlRewriteWithRequestPathTest.xml | 4 ++-- ...MoveDynamicBundleProductFromShoppingCartToWishlistTest.xml | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/CreateNewPageWithAllValuesAndContentActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/CreateNewPageWithAllValuesAndContentActionGroup.xml index 201e78fff6dbe..f231cdbbbfe37 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/CreateNewPageWithAllValuesAndContentActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/CreateNewPageWithAllValuesAndContentActionGroup.xml @@ -8,7 +8,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="CreateNewPageWithAllValuesAndContentActionGroup" extends="CreateNewPageWithAllValues"> + <actionGroup name="CreateNewPageWithAllValuesAndContentActionGroup" extends="CreateNewPageWithAllValuesActionGroup"> <arguments> <argument name="pageContent" type="string"/> </arguments> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml index 97e1f16016045..1c1f7af5a5cd5 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml @@ -38,7 +38,7 @@ </actionGroup> <!--Delete the Category Url Rewrite--> - <actionGroup ref="AdminDeleteUrlRewrite" stepKey="deleteCustomUrlRewrite"> + <actionGroup ref="AssertPageByUrlRewriteIsNotFoundActionGroup" stepKey="deleteCustomUrlRewrite"> <argument name="requestPath" value="-"/> </actionGroup> <actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="assertSuccessMessage"> @@ -46,7 +46,7 @@ </actionGroup> <!--Verify AssertPageByUrlRewriteIsNotFound--> - <actionGroup ref="AssertPageByUrlRewriteIsNotFound" stepKey="checkUrlOnFrontend"> + <actionGroup ref="AssertPageByUrlRewriteIsNotFoundActionGroup" stepKey="checkUrlOnFrontend"> <argument name="requestPath" value="-"/> </actionGroup> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteWithRequestPathTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteWithRequestPathTest.xml index 18c3e1abe59c4..7c4023c6d0f75 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteWithRequestPathTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteWithRequestPathTest.xml @@ -38,7 +38,7 @@ </actionGroup> <!--Delete the Category Url Rewrite--> - <actionGroup ref="AdminDeleteUrlRewrite" stepKey="deleteCustomUrlRewriteSecondTime"> + <actionGroup ref="AdminDeleteUrlRewriteActionGroup" stepKey="deleteCustomUrlRewriteSecondTime"> <argument name="requestPath" value="newrequestpath.html"/> </actionGroup> <actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="assertSuccessMessageSecondTime"> @@ -46,7 +46,7 @@ </actionGroup> <!--Verify AssertPageByUrlRewriteIsNotFound--> - <actionGroup ref="AssertPageByUrlRewriteIsNotFound" stepKey="checkUrlOnFrontendSecondTime"> + <actionGroup ref="AssertPageByUrlRewriteIsNotFoundActionGroup" stepKey="checkUrlOnFrontendSecondTime"> <argument name="requestPath" value="newrequestpath.html"/> </actionGroup> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveDynamicBundleProductFromShoppingCartToWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveDynamicBundleProductFromShoppingCartToWishlistTest.xml index 76e1240b0df77..3a823efbcdf61 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveDynamicBundleProductFromShoppingCartToWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveDynamicBundleProductFromShoppingCartToWishlistTest.xml @@ -46,12 +46,12 @@ <requiredEntity createDataKey="simpleProduct2"/> </createData> <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> - <actionGroup ref="goToProductPageViaID" stepKey="goToProduct"> + <actionGroup ref="GoToProductPageViaIDActionGroup" stepKey="goToProduct"> <argument name="productId" value="$$createBundleProduct.id$$"/> </actionGroup> <scrollTo selector="{{AdminProductFormBundleSection.contentDropDown}}" stepKey="scrollToBundleSection"/> <selectOption userInput="Separately" selector="{{AdminProductFormBundleSection.shipmentType}}" stepKey="selectSeparately"/> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <magentoCLI stepKey="reindex" command="indexer:reindex"/> <magentoCLI stepKey="flushCache" command="cache:flush"/> </before> From d37620eff93dd5e92381c1cad8c91a6229ffb1e1 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Wed, 11 Dec 2019 10:52:51 +0700 Subject: [PATCH 0319/1143] [Catalog] Cover Price Validation Result class by Unit Test --- .../Product/Price/Validation/ResultTest.php | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 app/code/Magento/Catalog/Test/Unit/Model/Product/Price/Validation/ResultTest.php diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Price/Validation/ResultTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Price/Validation/ResultTest.php new file mode 100644 index 0000000000000..7ed32d564ca19 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Price/Validation/ResultTest.php @@ -0,0 +1,91 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\Catalog\Test\Unit\Model\Product\Price\Validation; + +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\Catalog\Model\Product\Price\Validation\Result; +use PHPUnit\Framework\TestCase; +use Magento\Catalog\Api\Data\PriceUpdateResultInterface; +use Magento\Catalog\Api\Data\PriceUpdateResultInterfaceFactory; + +class ResultTest extends TestCase +{ + /** + * @var Result + */ + private $model; + + /** + * @var PriceUpdateResultInterfaceFactory|PHPUnit_Framework_MockObject_MockObject + */ + private $priceUpdateResultFactory; + + /** + * @var ObjectManagerHelper|PHPUnit_Framework_MockObject_MockObject + */ + private $objectManager; + + /** + * Setup environment for test + */ + protected function setUp() + { + $this->priceUpdateResultFactory = $this->getMockBuilder(PriceUpdateResultInterfaceFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + + $this->objectManager = new ObjectManagerHelper($this); + $this->model = $this->objectManager->getObject( + Result::class, + [ + 'priceUpdateResultFactory' => $this->priceUpdateResultFactory + ] + ); + + $this->model->addFailedItem(1, 'Invalid attribute color = 1', ['SKU' => 'ABC', 'storeId' => 1]); + $this->model->addFailedItem(2, 'Invalid attribute size = M', ['SKU' => 'DEF', 'storeId' => 1]); + } + + /** + * Test getFailedRowIds() function + */ + public function testGetFailedRowIds() + { + $this->assertEquals([1, 2], $this->model->getFailedRowIds()); + } + + /** + * Test getFailedItems() function + */ + public function testGetFailedItems() + { + $priceUpdateResult1 = $this->createMock(PriceUpdateResultInterface::class); + $priceUpdateResult2 = $this->createMock(PriceUpdateResultInterface::class); + + $this->priceUpdateResultFactory->expects($this->at(0)) + ->method('create') + ->willReturn($priceUpdateResult1); + $this->priceUpdateResultFactory->expects($this->at(1)) + ->method('create') + ->willReturn($priceUpdateResult2); + + $priceUpdateResult1->expects($this->once())->method('setMessage') + ->with('Invalid attribute color = 1'); + $priceUpdateResult1->expects($this->once())->method('setParameters') + ->with(['SKU' => 'ABC', 'storeId' => 1]); + + $priceUpdateResult2->expects($this->once())->method('setMessage') + ->with('Invalid attribute size = M'); + $priceUpdateResult2->expects($this->once())->method('setParameters') + ->with(['SKU' => 'DEF', 'storeId' => 1]); + + $this->assertEquals([$priceUpdateResult1, $priceUpdateResult2], $this->model->getFailedItems()); + } +} From c3a97c015461c39e58f58c41a8c818d2da909571 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Wed, 11 Dec 2019 15:06:30 +0700 Subject: [PATCH 0320/1143] [Customer] Cover CustomerData\Customer and CustomerData\JsLayoutDataProviderPool by Unit Test --- .../Test/Unit/CustomerData/CustomerTest.php | 90 +++++++++++++++++++ .../JsLayoutDataProviderPoolTest.php | 84 +++++++++++++++++ 2 files changed, 174 insertions(+) create mode 100644 app/code/Magento/Customer/Test/Unit/CustomerData/CustomerTest.php create mode 100644 app/code/Magento/Customer/Test/Unit/CustomerData/JsLayoutDataProviderPoolTest.php diff --git a/app/code/Magento/Customer/Test/Unit/CustomerData/CustomerTest.php b/app/code/Magento/Customer/Test/Unit/CustomerData/CustomerTest.php new file mode 100644 index 0000000000000..735c526878b6b --- /dev/null +++ b/app/code/Magento/Customer/Test/Unit/CustomerData/CustomerTest.php @@ -0,0 +1,90 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\Customer\Test\Unit\CustomerData; + +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\Customer\CustomerData\Customer as CustomerData; +use Magento\Customer\Helper\Session\CurrentCustomer; +use Magento\Customer\Helper\View; +use Magento\Customer\Api\Data\CustomerInterface; +use PHPUnit\Framework\TestCase; + +class CustomerTest extends TestCase +{ + /** + * @var ObjectManagerHelper + */ + private $objectManagerHelper; + + /** + * @var CustomerData + */ + private $customerData; + + /** + * @var CurrentCustomer + */ + private $currentCustomerMock; + + /** + * @var View + */ + private $customerViewHelperMock; + + /** + * Setup environment to test + */ + protected function setUp() + { + $this->currentCustomerMock = $this->createMock(CurrentCustomer::class); + $this->customerViewHelperMock = $this->createMock(View::class); + $this->objectManagerHelper = new ObjectManagerHelper($this); + + $this->customerData = $this->objectManagerHelper->getObject( + CustomerData::class, + [ + 'currentCustomer' => $this->currentCustomerMock, + 'customerViewHelper' => $this->customerViewHelperMock + ] + ); + } + + /** + * Test getSectionData() without customer Id + */ + public function testGetSectionDataWithoutCustomerId() + { + $this->currentCustomerMock->expects($this->any())->method('getCustomerId')->willReturn(null); + $this->assertEquals([], $this->customerData->getSectionData()); + } + + /** + * Test getSectionData() with customer + */ + public function testGetSectionDataWithCustomer() + { + $this->currentCustomerMock->expects($this->any())->method('getCustomerId')->willReturn(1); + $customerMock = $this->createMock(CustomerInterface::class); + $customerMock->expects($this->any())->method('getFirstname')->willReturn('John'); + $customerMock->expects($this->any())->method('getWebsiteId')->willReturn(1); + $this->currentCustomerMock->expects($this->any())->method('getCustomer')->willReturn($customerMock); + $this->customerViewHelperMock->expects($this->any())->method('getCustomerName') + ->with($customerMock) + ->willReturn('John Adam'); + + $this->assertEquals( + [ + 'fullname' => 'John Adam', + 'firstname' => 'John', + 'websiteId' => 1, + ], + $this->customerData->getSectionData() + ); + } +} diff --git a/app/code/Magento/Customer/Test/Unit/CustomerData/JsLayoutDataProviderPoolTest.php b/app/code/Magento/Customer/Test/Unit/CustomerData/JsLayoutDataProviderPoolTest.php new file mode 100644 index 0000000000000..7b7f6ec9f841b --- /dev/null +++ b/app/code/Magento/Customer/Test/Unit/CustomerData/JsLayoutDataProviderPoolTest.php @@ -0,0 +1,84 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\Customer\Test\Unit\CustomerData; + +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\Tax\CustomerData\CheckoutTotalsJsLayoutDataProvider as CheckoutTotalsJs; +use Magento\Customer\CustomerData\JsLayoutDataProviderPool; +use PHPUnit\Framework\TestCase; + +class JsLayoutDataProviderPoolTest extends TestCase +{ + /** + * @var ObjectManagerHelper + */ + private $objectManagerHelper; + + /** + * @var CheckoutTotalsJs + */ + private $checkoutTotalsJsLayoutDataProviderMock; + + /** + * @var JsLayoutDataProviderPool + */ + private $jsLayoutDataProviderPool; + + /** + * Setup environment to test + */ + protected function setUp() + { + $this->checkoutTotalsJsLayoutDataProviderMock = $this->createMock(CheckoutTotalsJs::class); + $this->objectManagerHelper = new ObjectManagerHelper($this); + + $this->jsLayoutDataProviderPool = $this->objectManagerHelper->getObject( + JsLayoutDataProviderPool::class, + [ + 'jsLayoutDataProviders' => [ + 'checkout_totals' => $this->checkoutTotalsJsLayoutDataProviderMock + ] + ] + ); + } + + /** + * Test getData() function + */ + public function testGetData() + { + $checkoutTotalsJsData = [ + 'components' => [ + 'minicart_content' => [ + 'children' => [ + 'subtotal.container' => [ + 'children' => [ + 'subtotal' => [ + 'children' => [ + 'subtotal.totals' => [ + 'config' => [ + 'display_cart_subtotal_incl_tax' => 1, + 'display_cart_subtotal_excl_tax' => 1 + ] + ], + ], + ], + ], + ], + ], + ], + ] + ]; + $this->checkoutTotalsJsLayoutDataProviderMock->expects($this->any()) + ->method('getData') + ->willReturn($checkoutTotalsJsData); + + $this->assertEquals($checkoutTotalsJsData, $this->jsLayoutDataProviderPool->getData()); + } +} From c273067b6a6236883ff623f40589b298c461692d Mon Sep 17 00:00:00 2001 From: "a.chorniy" <a.chorniy@atwix.com> Date: Wed, 11 Dec 2019 10:19:04 +0200 Subject: [PATCH 0321/1143] fix for system xml. --- app/code/Magento/Config/Model/Config/Structure.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Config/Model/Config/Structure.php b/app/code/Magento/Config/Model/Config/Structure.php index a380dc82a7c5e..a51a26a80ca46 100644 --- a/app/code/Magento/Config/Model/Config/Structure.php +++ b/app/code/Magento/Config/Model/Config/Structure.php @@ -398,7 +398,7 @@ private function getFieldsRecursively(array $elements = []) $this->getFieldsRecursively($element['children']) ); } else { - if ($element['_elementType'] === 'field' && isset($element['label'])) { + if ($element['_elementType'] === 'field') { $structurePath = (isset($element['path']) ? $element['path'] . '/' : '') . $element['id']; $configPath = isset($element['config_path']) ? $element['config_path'] : $structurePath; From eb408932576b485b668d8c44b0e2bacdda764eff Mon Sep 17 00:00:00 2001 From: "a.chorniy" <a.chorniy@atwix.com> Date: Wed, 11 Dec 2019 12:16:54 +0200 Subject: [PATCH 0322/1143] add ignore phpcs:ignore Magento2.Performance.ForeachArrayMerge.ForeachArrayMerge --- app/code/Magento/Config/Model/Config/Structure.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Config/Model/Config/Structure.php b/app/code/Magento/Config/Model/Config/Structure.php index a51a26a80ca46..a16920f0dc527 100644 --- a/app/code/Magento/Config/Model/Config/Structure.php +++ b/app/code/Magento/Config/Model/Config/Structure.php @@ -292,6 +292,7 @@ public function getFieldPathsByAttribute($attributeName, $attributeValue) foreach ($section['children'] as $group) { if (isset($group['children'])) { $path = $section['id'] . '/' . $group['id']; + // phpcs:ignore Magento2.Performance.ForeachArrayMerge.ForeachArrayMerge $result = array_merge( $result, $this->_getGroupFieldPathsByAttribute( From 4b81e7b87c1d2100b8f58f740d363d920ab4f223 Mon Sep 17 00:00:00 2001 From: Viktor Petryk <victor.petryk@transoftgroup.com> Date: Wed, 11 Dec 2019 12:47:52 +0200 Subject: [PATCH 0323/1143] MC-29444: Extra Values of UPS and USPS are in dropdown list Cart Price Rule - Condition - Shipping Method --- app/code/Magento/Ups/Model/Carrier.php | 55 +++++---- .../Ups/Test/Unit/Model/CarrierTest.php | 110 ++++++++++++++++-- app/code/Magento/Usps/etc/config.xml | 2 +- 3 files changed, 130 insertions(+), 37 deletions(-) diff --git a/app/code/Magento/Ups/Model/Carrier.php b/app/code/Magento/Ups/Model/Carrier.php index 9e33b86ea8215..e752b0005dbee 100644 --- a/app/code/Magento/Ups/Model/Carrier.php +++ b/app/code/Magento/Ups/Model/Carrier.php @@ -27,7 +27,8 @@ use Magento\Shipping\Model\Shipment\Request as Shipment; /** - * UPS shipping implementation + * UPS shipping implementation. + * * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ @@ -135,7 +136,9 @@ class Carrier extends AbstractCarrierOnline implements CarrierInterface * @inheritdoc */ protected $_debugReplacePrivateDataKeys = [ - 'UserId', 'Password', 'AccessLicenseNumber' + 'UserId', + 'Password', + 'AccessLicenseNumber', ]; /** @@ -352,9 +355,10 @@ public function setRequest(RateRequest $request) $destCountry = self::USA_COUNTRY_ID; } - //for UPS, puero rico state for US will assume as puerto rico country - if ($destCountry == self::USA_COUNTRY_ID && ($request->getDestPostcode() == '00912' || - $request->getDestRegionCode() == self::PUERTORICO_COUNTRY_ID) + //for UPS, puerto rico state for US will assume as puerto rico country + if ($destCountry == self::USA_COUNTRY_ID + && ($request->getDestPostcode() == '00912' + || $request->getDestRegionCode() == self::PUERTORICO_COUNTRY_ID) ) { $destCountry = self::PUERTORICO_COUNTRY_ID; } @@ -727,7 +731,7 @@ protected function _getXmlQuotes() <StateProvinceCode>{$shipperStateProvince}</StateProvinceCode> </Address> </Shipper> - + <ShipTo> <Address> <PostalCode>{$params['19_destPostal']}</PostalCode> @@ -743,7 +747,7 @@ protected function _getXmlQuotes() $xmlParams .= <<<XMLRequest </Address> </ShipTo> - + <ShipFrom> <Address> <PostalCode>{$params['15_origPostal']}</PostalCode> @@ -1302,20 +1306,23 @@ public function getResponse() } /** - * Get allowed shipping methods + * Get allowed shipping methods. * * @return array */ public function getAllowedMethods() { - $allowed = explode(',', $this->getConfigData('allowed_methods')); - $arr = []; - $isByCode = $this->getConfigData('type') == 'UPS_XML'; - foreach ($allowed as $code) { - $arr[$code] = $isByCode ? $this->getShipmentByCode($code) : $this->configHelper->getCode('method', $code); + $isUpsXml = $this->getConfigData('type') === 'UPS_XML'; + $origin = $this->getConfigData('origin_shipment'); + $allowedMethods = $isUpsXml + ? $this->configHelper->getCode('originShipment', $origin) + : $this->configHelper->getCode('method'); + $methods = []; + foreach ($allowedMethods as $methodCode => $methodData) { + $methods[$methodCode] = $methodData->getText(); } - return $arr; + return $methods; } /** @@ -1876,20 +1883,18 @@ public function getContainerTypes(\Magento\Framework\DataObject $params = null) ]; } $containerTypes = $containerTypes + [ - '03' => __('UPS Tube'), - '04' => __('PAK'), - '2a' => __('Small Express Box'), - '2b' => __('Medium Express Box'), - '2c' => __('Large Express Box'), - ]; + '03' => __('UPS Tube'), + '04' => __('PAK'), + '2a' => __('Small Express Box'), + '2b' => __('Medium Express Box'), + '2c' => __('Large Express Box'), + ]; } return ['00' => __('Customer Packaging')] + $containerTypes; - } elseif ($countryShipper == self::USA_COUNTRY_ID && - $countryRecipient == self::PUERTORICO_COUNTRY_ID && - ($method == '03' || - $method == '02' || - $method == '01') + } elseif ($countryShipper == self::USA_COUNTRY_ID + && $countryRecipient == self::PUERTORICO_COUNTRY_ID + && ($method == '03' || $method == '02' || $method == '01') ) { // Container types should be the same as for domestic $params->setCountryRecipient(self::USA_COUNTRY_ID); diff --git a/app/code/Magento/Ups/Test/Unit/Model/CarrierTest.php b/app/code/Magento/Ups/Test/Unit/Model/CarrierTest.php index 0d33087a0f3bc..7af86c30cb5b3 100644 --- a/app/code/Magento/Ups/Test/Unit/Model/CarrierTest.php +++ b/app/code/Magento/Ups/Test/Unit/Model/CarrierTest.php @@ -3,15 +3,16 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Ups\Test\Unit\Model; use Magento\Directory\Model\Country; use Magento\Directory\Model\CountryFactory; use Magento\Framework\App\Config\ScopeConfigInterface; -use Magento\Framework\DataObject; use Magento\Framework\HTTP\ClientFactory; use Magento\Framework\HTTP\ClientInterface; use Magento\Framework\Model\AbstractModel; +use Magento\Framework\Phrase; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use Magento\Quote\Model\Quote\Address\RateRequest; use Magento\Quote\Model\Quote\Address\RateResult\Error; @@ -20,11 +21,15 @@ use Magento\Shipping\Model\Rate\ResultFactory; use Magento\Shipping\Model\Simplexml\Element; use Magento\Shipping\Model\Simplexml\ElementFactory; +use Magento\Store\Model\ScopeInterface; +use Magento\Ups\Helper\Config; use Magento\Ups\Model\Carrier; use PHPUnit_Framework_MockObject_MockObject as MockObject; use Psr\Log\LoggerInterface; /** + * Unit tests for \Magento\Ups\Model\Carrier class. + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class CarrierTest extends \PHPUnit\Framework\TestCase @@ -92,17 +97,23 @@ class CarrierTest extends \PHPUnit\Framework\TestCase */ private $logger; + /** + * @var Config|MockObject + */ + private $configHelper; + + /** + * @inheritdoc + */ protected function setUp() { $this->helper = new ObjectManager($this); $this->scope = $this->getMockBuilder(ScopeConfigInterface::class) ->disableOriginalConstructor() + ->setMethods(['getValue', 'isSetFlag']) ->getMock(); - $this->scope->method('getValue') - ->willReturnCallback([$this, 'scopeConfigGetValue']); - $this->error = $this->getMockBuilder(Error::class) ->setMethods(['setCarrier', 'setCarrierTitle', 'setErrorMessage']) ->getMock(); @@ -143,6 +154,11 @@ protected function setUp() $this->logger = $this->getMockForAbstractClass(LoggerInterface::class); + $this->configHelper = $this->getMockBuilder(Config::class) + ->disableOriginalConstructor() + ->setMethods(['getCode']) + ->getMock(); + $this->model = $this->helper->getObject( Carrier::class, [ @@ -153,6 +169,7 @@ protected function setUp() 'xmlElFactory' => $xmlFactory, 'logger' => $this->logger, 'httpClientFactory' => $httpClientFactory, + 'configHelper' => $this->configHelper, ] ); } @@ -189,14 +206,17 @@ public function scopeConfigGetValue(string $path) * @param bool $freeShippingEnabled * @param int $requestSubtotal * @param int $expectedPrice + * @return void */ public function testGetMethodPrice( - $cost, - $shippingMethod, - $freeShippingEnabled, - $requestSubtotal, - $expectedPrice - ) { + int $cost, + string $shippingMethod, + bool $freeShippingEnabled, + int $requestSubtotal, + int $expectedPrice + ): void { + $this->scope->method('getValue') + ->willReturnCallback([$this, 'scopeConfigGetValue']); $path = 'carriers/' . $this->model->getCarrierCode() . '/'; $this->scope->method('isSetFlag') ->with($path . 'free_shipping_enable') @@ -244,8 +264,13 @@ public function getMethodPriceProvider() ]; } - public function testCollectRatesErrorMessage() + /** + * @return void + */ + public function testCollectRatesErrorMessage(): void { + $this->scope->method('getValue') + ->willReturnCallback([$this, 'scopeConfigGetValue']); $this->scope->method('isSetFlag') ->willReturn(false); @@ -373,6 +398,69 @@ public function countryDataProvider() ]; } + /** + * @dataProvider allowedMethodsDataProvider + * @param string $carrierType + * @param string $methodType + * @param string $methodCode + * @param string $methodTitle + * @param array $expectedMethods + * @return void + */ + public function testGetAllowedMethods( + string $carrierType, + string $methodType, + string $methodCode, + string $methodTitle, + array $expectedMethods + ): void { + $this->scope->method('getValue') + ->willReturnMap( + [ + [ + 'carriers/ups/type', + ScopeInterface::SCOPE_STORE, + null, + $carrierType + ], + [ + 'carriers/ups/origin_shipment', + ScopeInterface::SCOPE_STORE, + null, + 'Shipments Originating in United States', + ], + ] + ); + $this->configHelper->method('getCode') + ->with($methodType) + ->willReturn([$methodCode => new Phrase($methodTitle)]); + $actualMethods = $this->model->getAllowedMethods(); + $this->assertEquals($expectedMethods, $actualMethods); + } + + /** + * @return array + */ + public function allowedMethodsDataProvider(): array + { + return [ + [ + 'UPS', + 'method', + '1DM', + 'Next Day Air Early AM', + ['1DM' => 'Next Day Air Early AM'], + ], + [ + 'UPS_XML', + 'originShipment', + '01', + 'UPS Next Day Air', + ['01' => 'UPS Next Day Air'], + ], + ]; + } + /** * Creates mock for XML factory. * diff --git a/app/code/Magento/Usps/etc/config.xml b/app/code/Magento/Usps/etc/config.xml index 68c1b31fcd515..7bfe3dc86a06e 100644 --- a/app/code/Magento/Usps/etc/config.xml +++ b/app/code/Magento/Usps/etc/config.xml @@ -11,7 +11,7 @@ <usps> <active>0</active> <sallowspecific>0</sallowspecific> - <allowed_methods>0_FCLE,0_FCL,0_FCP,1,2,3,4,6,7,13,16,17,22,23,25,27,28,33,34,35,36,37,42,43,53,55,56,57,61,INT_1,INT_2,INT_4,INT_6,INT_7,INT_8,INT_9,INT_10,INT_11,INT_12,INT_13,INT_14,INT_15,INT_16,INT_20,INT_26</allowed_methods> + <allowed_methods>0_FCLE,0_FCL,0_FCP,1,2,3,4,6,7,13,16,17,22,23,25,27,28,33,34,35,36,37,42,43,53,57,61,INT_1,INT_2,INT_4,INT_6,INT_7,INT_8,INT_9,INT_10,INT_11,INT_12,INT_13,INT_14,INT_15,INT_16,INT_20</allowed_methods> <container>VARIABLE</container> <cutoff_cost /> <free_method /> From bad9717027a4b4a54eb427ed5915b9315f045034 Mon Sep 17 00:00:00 2001 From: Buba Suma <soumah@adobe.com> Date: Wed, 11 Dec 2019 13:43:45 +0200 Subject: [PATCH 0324/1143] MC-29417: hide_from_product_page not working for import using store views --- .../Model/Import/Product.php | 51 ++++++++------ .../Import/Product/MediaGalleryProcessor.php | 20 +++--- .../Model/Import/ProductTest.php | 70 +++++++++++++++++-- ...mport_change_image_label_for_storeview.csv | 2 + .../import_hide_image_for_storeview.csv | 2 + 5 files changed, 111 insertions(+), 34 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/import_change_image_label_for_storeview.csv create mode 100644 dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/import_hide_image_for_storeview.csv diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php index 8f70ea88f4ba7..7ebc397cbe650 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php @@ -1569,6 +1569,13 @@ protected function _saveProducts() continue; } + $storeId = !empty($rowData[self::COL_STORE]) + ? $this->getStoreIdByCode($rowData[self::COL_STORE]) + : Store::DEFAULT_STORE_ID; + $rowExistingImages = $existingImages[$storeId][$rowSku] ?? []; + $rowStoreMediaGalleryValues = $rowExistingImages; + $rowExistingImages += $existingImages[Store::DEFAULT_STORE_ID][$rowSku] ?? []; + if (self::SCOPE_STORE == $rowScope) { // set necessary data from SCOPE_DEFAULT row $rowData[self::COL_TYPE] = $this->skuProcessor->getNewSku($rowSku)['type_id']; @@ -1672,19 +1679,16 @@ protected function _saveProducts() // 5. Media gallery phase list($rowImages, $rowLabels) = $this->getImagesFromRow($rowData); - $storeId = !empty($rowData[self::COL_STORE]) - ? $this->getStoreIdByCode($rowData[self::COL_STORE]) - : Store::DEFAULT_STORE_ID; $imageHiddenStates = $this->getImagesHiddenStates($rowData); foreach (array_keys($imageHiddenStates) as $image) { - if (array_key_exists($rowSku, $existingImages) - && array_key_exists($image, $existingImages[$rowSku]) - ) { - $rowImages[self::COL_MEDIA_IMAGE][] = $image; + //Mark image as uploaded if it exists + if (array_key_exists($image, $rowExistingImages)) { $uploadedImages[$image] = $image; } - - if (empty($rowImages)) { + //Add image to hide to images list if it does not exist + if (empty($rowImages[self::COL_MEDIA_IMAGE]) + || !in_array($image, $rowImages[self::COL_MEDIA_IMAGE]) + ) { $rowImages[self::COL_MEDIA_IMAGE][] = $image; } } @@ -1725,24 +1729,29 @@ protected function _saveProducts() continue; } - if (isset($existingImages[$rowSku][$uploadedFile])) { - $currentFileData = $existingImages[$rowSku][$uploadedFile]; + if (isset($rowExistingImages[$uploadedFile])) { + $currentFileData = $rowExistingImages[$uploadedFile]; + $currentFileData['store_id'] = $storeId; + $storeMediaGalleryValueExists = isset($rowStoreMediaGalleryValues[$uploadedFile]); + if (array_key_exists($uploadedFile, $imageHiddenStates) + && $currentFileData['disabled'] != $imageHiddenStates[$uploadedFile] + ) { + $imagesForChangeVisibility[] = [ + 'disabled' => $imageHiddenStates[$uploadedFile], + 'imageData' => $currentFileData, + 'exists' => $storeMediaGalleryValueExists + ]; + $storeMediaGalleryValueExists = true; + } + if (isset($rowLabels[$column][$columnImageKey]) && $rowLabels[$column][$columnImageKey] != $currentFileData['label'] ) { $labelsForUpdate[] = [ 'label' => $rowLabels[$column][$columnImageKey], - 'imageData' => $currentFileData - ]; - } - - if (array_key_exists($uploadedFile, $imageHiddenStates) - && $currentFileData['disabled'] != $imageHiddenStates[$uploadedFile] - ) { - $imagesForChangeVisibility[] = [ - 'disabled' => $imageHiddenStates[$uploadedFile], - 'imageData' => $currentFileData + 'imageData' => $currentFileData, + 'exists' => $storeMediaGalleryValueExists ]; } } else { diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product/MediaGalleryProcessor.php b/app/code/Magento/CatalogImportExport/Model/Import/Product/MediaGalleryProcessor.php index 00e6da0ebe077..bd8523a4e396e 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product/MediaGalleryProcessor.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product/MediaGalleryProcessor.php @@ -12,7 +12,6 @@ use Magento\Framework\App\ResourceConnection; use Magento\Framework\EntityManager\MetadataPool; use Magento\ImportExport\Model\Import\ErrorProcessing\ProcessingErrorAggregatorInterface; -use Magento\Store\Model\Store; /** * Process and saves images during import. @@ -179,13 +178,15 @@ private function updateMediaGalleryField(array $data, $field) $insertData = []; foreach ($data as $datum) { $imageData = $datum['imageData']; + $exists = $datum['exists'] ?? true; - if ($imageData[$field] === null) { + if (!$exists) { $insertData[] = [ $field => $datum[$field], $this->getProductEntityLinkField() => $imageData[$this->getProductEntityLinkField()], 'value_id' => $imageData['value_id'], - 'store_id' => Store::DEFAULT_STORE_ID, + 'store_id' => $imageData['store_id'], + 'position' => $imageData['position'], ]; } else { $this->connection->update( @@ -196,7 +197,7 @@ private function updateMediaGalleryField(array $data, $field) [ $this->getProductEntityLinkField() . ' = ?' => $imageData[$this->getProductEntityLinkField()], 'value_id = ?' => $imageData['value_id'], - 'store_id = ?' => Store::DEFAULT_STORE_ID, + 'store_id = ?' => $imageData['store_id'], ] ); } @@ -240,14 +241,15 @@ public function getExistingImages(array $bunch) )->joinLeft( ['mgv' => $this->mediaGalleryValueTableName], sprintf( - '(mg.value_id = mgv.value_id AND mgv.%s = mgvte.%s AND mgv.store_id = %d)', + '(mgv.%s = mgvte.%s AND mg.value_id = mgv.value_id)', $this->getProductEntityLinkField(), - $this->getProductEntityLinkField(), - Store::DEFAULT_STORE_ID + $this->getProductEntityLinkField() ), [ + 'store_id' => 'mgv.store_id', 'label' => 'mgv.label', 'disabled' => 'mgv.disabled', + 'position' => 'mgv.position', ] )->joinInner( ['pe' => $this->productEntityTableName], @@ -259,7 +261,9 @@ public function getExistingImages(array $bunch) ); foreach ($this->connection->fetchAll($select) as $image) { - $result[$image['sku']][$image['value']] = $image; + $storeId = $image['store_id']; + unset($image['store_id']); + $result[$storeId][$image['sku']][$image['value']] = $image; } return $result; diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php index 3a039217d61fc..c47a4f340f983 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php @@ -29,6 +29,7 @@ use Magento\ImportExport\Model\Import; use Magento\ImportExport\Model\Import\Source\Csv; use Magento\Store\Model\Store; +use Magento\Store\Model\StoreManagerInterface; use Magento\UrlRewrite\Model\ResourceModel\UrlRewriteCollection; use Psr\Log\LoggerInterface; use Magento\TestFramework\Helper\Bootstrap as BootstrapHelper; @@ -386,14 +387,14 @@ public function testSaveCustomOptions(string $importFile, string $sku, int $expe public function testSaveCustomOptionsWithMultipleStoreViews() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var \Magento\Store\Model\StoreManagerInterface $storeManager */ - $storeManager = $objectManager->get(\Magento\Store\Model\StoreManagerInterface::class); + /** @var StoreManagerInterface $storeManager */ + $storeManager = $objectManager->get(StoreManagerInterface::class); $storeCodes = [ 'admin', 'default', 'secondstore', ]; - /** @var \Magento\Store\Model\StoreManagerInterface $storeManager */ + /** @var StoreManagerInterface $storeManager */ $importFile = 'product_with_custom_options_and_multiple_store_views.csv'; $sku = 'simple'; $pathToFile = __DIR__ . '/_files/' . $importFile; @@ -1187,7 +1188,7 @@ public function testProductsWithMultipleStores() $product->load($id); $this->assertEquals('1', $product->getHasOptions()); - $objectManager->get(\Magento\Store\Model\StoreManagerInterface::class)->setCurrentStore('fixturestore'); + $objectManager->get(StoreManagerInterface::class)->setCurrentStore('fixturestore'); /** @var \Magento\Catalog\Model\Product $simpleProduct */ $simpleProduct = $objectManager->create(\Magento\Catalog\Model\Product::class); @@ -2246,13 +2247,20 @@ function ($output, $error) { * Load product by given product sku * * @param string $sku + * @param mixed $store * @return \Magento\Catalog\Model\Product */ - private function getProductBySku($sku) + private function getProductBySku($sku, $store = null) { $resource = $this->objectManager->get(\Magento\Catalog\Model\ResourceModel\Product::class); $productId = $resource->getIdBySku($sku); $product = $this->objectManager->create(\Magento\Catalog\Model\Product::class); + if ($store) { + /** @var StoreManagerInterface $storeManager */ + $storeManager = $this->objectManager->get(StoreManagerInterface::class); + $store = $storeManager->getStore($store); + $product->setStoreId($store->getId()); + } $product->load($productId); return $product; @@ -2773,4 +2781,56 @@ public function testProductBaseImageAfterImport() $productAfterImport = $this->getProductBySku('simple_new'); $this->assertNotEquals('/no/exists/image/magento_image.jpg', $productAfterImport->getData('image')); } + + /** + * Tests that images are hidden only for a store view in "store_view_code". + * + * @magentoDataFixture mediaImportImageFixture + * @magentoDataFixture Magento/Store/_files/core_fixturestore.php + * @magentoDataFixture Magento/Catalog/_files/product_with_image.php + */ + public function testHideImageForStoreView() + { + $expectedImageFile = '/m/a/magento_image.jpg'; + $secondStoreCode = 'fixturestore'; + $productSku = 'simple'; + $this->importDataForMediaTest('import_hide_image_for_storeview.csv'); + $product = $this->getProductBySku($productSku); + $imageItems = $product->getMediaGalleryImages()->getItems(); + $this->assertCount(1, $imageItems); + $imageItem = array_shift($imageItems); + $this->assertEquals($expectedImageFile, $imageItem->getFile()); + $product = $this->getProductBySku($productSku, $secondStoreCode); + $imageItems = $product->getMediaGalleryImages()->getItems(); + $this->assertCount(0, $imageItems); + } + + /** + * Test that images labels are updated only for a store view in "store_view_code". + * + * @magentoDataFixture mediaImportImageFixture + * @magentoDataFixture Magento/Store/_files/core_fixturestore.php + * @magentoDataFixture Magento/Catalog/_files/product_with_image.php + */ + public function testChangeImageLabelForStoreView() + { + $expectedImageFile = '/m/a/magento_image.jpg'; + $expectedLabelForDefaultStoreView = 'Image Alt Text'; + $expectedLabelForSecondStoreView = 'Magento Logo'; + $secondStoreCode = 'fixturestore'; + $productSku = 'simple'; + $this->importDataForMediaTest('import_change_image_label_for_storeview.csv'); + $product = $this->getProductBySku($productSku); + $imageItems = $product->getMediaGalleryImages()->getItems(); + $this->assertCount(1, $imageItems); + $imageItem = array_shift($imageItems); + $this->assertEquals($expectedImageFile, $imageItem->getFile()); + $this->assertEquals($expectedLabelForDefaultStoreView, $imageItem->getLabel()); + $product = $this->getProductBySku($productSku, $secondStoreCode); + $imageItems = $product->getMediaGalleryImages()->getItems(); + $this->assertCount(1, $imageItems); + $imageItem = array_shift($imageItems); + $this->assertEquals($expectedImageFile, $imageItem->getFile()); + $this->assertEquals($expectedLabelForSecondStoreView, $imageItem->getLabel()); + } } diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/import_change_image_label_for_storeview.csv b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/import_change_image_label_for_storeview.csv new file mode 100644 index 0000000000000..95321df2b6b01 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/import_change_image_label_for_storeview.csv @@ -0,0 +1,2 @@ +"sku","store_view_code","base_image", "base_image_label" +"simple","fixturestore","/m/a/magento_image.jpg", "Magento Logo" diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/import_hide_image_for_storeview.csv b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/import_hide_image_for_storeview.csv new file mode 100644 index 0000000000000..8400dc17d2a29 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/import_hide_image_for_storeview.csv @@ -0,0 +1,2 @@ +"sku","store_view_code","hide_from_product_page" +"simple","fixturestore","/m/a/magento_image.jpg" From d407e0106d0311c064af7cd988396a852a1e152d Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Wed, 11 Dec 2019 14:46:00 +0200 Subject: [PATCH 0325/1143] Cover magento/magento2#25556 with jasmine test --- .../js/jasmine/tests/lib/mage/browser.test.js | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 dev/tests/js/jasmine/tests/lib/mage/browser.test.js diff --git a/dev/tests/js/jasmine/tests/lib/mage/browser.test.js b/dev/tests/js/jasmine/tests/lib/mage/browser.test.js new file mode 100644 index 0000000000000..2c60497ce1bcc --- /dev/null +++ b/dev/tests/js/jasmine/tests/lib/mage/browser.test.js @@ -0,0 +1,62 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +define([ + 'mage/adminhtml/browser', + 'jquery' +], function (browser, $) { + 'use strict'; + + var obj; + + beforeEach(function () { + + /** + * Dummy constructor to use for instantiation + * @constructor + */ + var Constr = function () {}; + + Constr.prototype = browser; + + obj = new Constr(); + }); + + describe('"openDialog" method', function () { + it('Opens dialog with provided targetElementId', function () { + var options = { + 'targetElementId': 1 + }; + + spyOn($, 'ajax').and.callFake( + function () { + return { + done: function (data) { + obj.targetElementId = 1; + } + } + }); + obj.openDialog('instance/url', 100, 100, 'title', options); + obj.openDialog('instance/url', 100, 100, 'title', options); + expect($.ajax.calls.count()).toBe(1); + + }); + + it('Opens dialog with provided url param', function () { + spyOn($, 'ajax').and.callFake( + function () { + return { + done: function (data) { + obj.targetElementId = 'instance/url'; + obj.modalLoaded = true; + } + } + }); + obj.openDialog('instance/url', 100, 100, 'title', undefined); + obj.openDialog('instance/url', 100, 100, 'title', undefined); + expect($.ajax.calls.count()).toBe(1); + }); + }); +}); From 47e3ada764fc943fc63d88671ce10b2877fe57d0 Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Mon, 25 Nov 2019 12:57:40 +0200 Subject: [PATCH 0326/1143] MC-4242: Newsletter subscriptions per website --- .../Mftf/Test/SearchEntityResultsTest.xml | 3 + .../Customer/Block/Account/Dashboard.php | 47 +- .../Customer/Block/Account/Dashboard/Info.php | 51 +- .../Block/Adminhtml/Edit/Tab/Newsletter.php | 371 +++++++--- .../Adminhtml/Edit/Tab/Newsletter/Grid.php | 105 ++- .../Form/Element/Newsletter/Subscriptions.php | 161 +++++ .../Adminhtml/Index/MassSubscribe.php | 18 +- .../Adminhtml/Index/MassUnsubscribe.php | 17 +- .../Controller/Adminhtml/Index/Save.php | 158 +++-- ...CustomerSubscribeNewsletterActionGroup.xml | 34 + ...CustomerSubscribeNewsletterActionGroup.xml | 36 + .../AdminEditCustomerNewsletterSection.xml | 4 +- ...stomerOnStorefrontSignupNewsletterTest.xml | 2 +- ...tomerSubscribeNewsletterPerWebsiteTest.xml | 101 +++ .../Adminhtml/Edit/Tab/NewsletterTest.php | 346 +++++++--- .../Element/Newsletter/SubscriptionsTest.php | 185 +++++ .../Adminhtml/Index/MassSubscribeTest.php | 118 ++-- .../Adminhtml/Index/MassUnsubscribeTest.php | 118 ++-- .../Controller/Adminhtml/Index/SaveTest.php | 348 +++++----- .../adminhtml/templates/tab/newsletter.phtml | 1 + .../Customer/ChangeSubscriptionStatus.php | 48 -- .../Model/Customer/CreateCustomerAccount.php | 25 +- .../Model/Customer/UpdateCustomerAccount.php | 23 +- .../Newsletter/Controller/Manage/Save.php | 29 +- .../Controller/Subscriber/NewAction.php | 54 +- .../Model/Plugin/CustomerPlugin.php | 281 ++++++-- .../Model/ResourceModel/Queue/Collection.php | 25 + .../Model/ResourceModel/Subscriber.php | 144 ++-- .../Magento/Newsletter/Model/Subscriber.php | 634 +++++++---------- .../Newsletter/Model/SubscriptionManager.php | 314 +++++++++ .../Model/SubscriptionManagerInterface.php | 51 ++ .../Unit/Model/Plugin/CustomerPluginTest.php | 389 ++++++----- .../Test/Unit/Model/SubscriberTest.php | 517 +++++++------- .../Unit/Model/SubscriptionManagerTest.php | 651 ++++++++++++++++++ app/code/Magento/Newsletter/etc/di.xml | 7 + app/code/Magento/Store/Model/System/Store.php | 62 +- .../web/css/source/_module.less | 30 + .../Adminhtml/Edit/Tab/NewsletterTest.php | 3 +- .../Controller/Adminhtml/IndexTest.php | 3 +- 39 files changed, 3817 insertions(+), 1697 deletions(-) create mode 100644 app/code/Magento/Customer/Block/Adminhtml/Form/Element/Newsletter/Subscriptions.php create mode 100644 app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerSubscribeNewsletterActionGroup.xml create mode 100644 app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCustomerSubscribeNewsletterActionGroup.xml create mode 100644 app/code/Magento/Customer/Test/Mftf/Test/AdminCustomerSubscribeNewsletterPerWebsiteTest.xml create mode 100644 app/code/Magento/Customer/Test/Unit/Block/Adminhtml/From/Element/Newsletter/SubscriptionsTest.php delete mode 100644 app/code/Magento/CustomerGraphQl/Model/Customer/ChangeSubscriptionStatus.php create mode 100644 app/code/Magento/Newsletter/Model/SubscriptionManager.php create mode 100644 app/code/Magento/Newsletter/Model/SubscriptionManagerInterface.php create mode 100644 app/code/Magento/Newsletter/Test/Unit/Model/SubscriptionManagerTest.php diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml b/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml index 3b60e4b09de28..40a02d2ce24f3 100644 --- a/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml +++ b/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml @@ -308,6 +308,9 @@ <createData entity="_defaultProduct" stepKey="createSimpleProduct"> <requiredEntity createDataKey="createCategory"/> </createData> + <!-- Perform reindex and flush cache --> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" arguments="full_page" stepKey="flushCache"/> </before> <after> <deleteData stepKey="deleteProduct" createDataKey="createSimpleProduct"/> diff --git a/app/code/Magento/Customer/Block/Account/Dashboard.php b/app/code/Magento/Customer/Block/Account/Dashboard.php index 8e0f79d45770a..547074d0bcd81 100644 --- a/app/code/Magento/Customer/Block/Account/Dashboard.php +++ b/app/code/Magento/Customer/Block/Account/Dashboard.php @@ -7,6 +7,14 @@ use Magento\Customer\Api\AccountManagementInterface; use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Customer\Api\Data\AddressInterface; +use Magento\Customer\Api\Data\CustomerInterface; +use Magento\Customer\Model\Session; +use Magento\Framework\Phrase; +use Magento\Framework\View\Element\Template; +use Magento\Framework\View\Element\Template\Context; +use Magento\Newsletter\Model\Subscriber; +use Magento\Newsletter\Model\SubscriberFactory; /** * Customer dashboard block @@ -14,20 +22,20 @@ * @api * @since 100.0.2 */ -class Dashboard extends \Magento\Framework\View\Element\Template +class Dashboard extends Template { /** - * @var \Magento\Newsletter\Model\Subscriber + * @var Subscriber */ protected $subscription; /** - * @var \Magento\Customer\Model\Session + * @var Session */ protected $customerSession; /** - * @var \Magento\Newsletter\Model\SubscriberFactory + * @var SubscriberFactory */ protected $subscriberFactory; @@ -42,19 +50,17 @@ class Dashboard extends \Magento\Framework\View\Element\Template protected $customerAccountManagement; /** - * Constructor - * - * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Customer\Model\Session $customerSession - * @param \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory + * @param Context $context + * @param Session $customerSession + * @param SubscriberFactory $subscriberFactory * @param CustomerRepositoryInterface $customerRepository * @param AccountManagementInterface $customerAccountManagement * @param array $data */ public function __construct( - \Magento\Framework\View\Element\Template\Context $context, - \Magento\Customer\Model\Session $customerSession, - \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory, + Context $context, + Session $customerSession, + SubscriberFactory $subscriberFactory, CustomerRepositoryInterface $customerRepository, AccountManagementInterface $customerAccountManagement, array $data = [] @@ -69,7 +75,7 @@ public function __construct( /** * Return the Customer given the customer Id stored in the session. * - * @return \Magento\Customer\Api\Data\CustomerInterface + * @return CustomerInterface */ public function getCustomer() { @@ -99,7 +105,7 @@ public function getAddressesUrl() /** * Retrieve the Url for editing the specified address. * - * @param \Magento\Customer\Api\Data\AddressInterface $address + * @param AddressInterface $address * @return string */ public function getAddressEditUrl($address) @@ -146,13 +152,14 @@ public function getWishlistUrl() /** * Retrieve the subscription object (i.e. the subscriber). * - * @return \Magento\Newsletter\Model\Subscriber + * @return Subscriber */ public function getSubscriptionObject() { if ($this->subscription === null) { - $this->subscription = - $this->_createSubscriber()->loadByCustomerId($this->customerSession->getCustomerId()); + $websiteId = (int)$this->_storeManager->getWebsite()->getId(); + $this->subscription = $this->_createSubscriber(); + $this->subscription->loadByCustomer((int)$this->getCustomer()->getId(), $websiteId); } return $this->subscription; @@ -171,7 +178,7 @@ public function getManageNewsletterUrl() /** * Retrieve subscription text, either subscribed or not. * - * @return \Magento\Framework\Phrase + * @return Phrase */ public function getSubscriptionText() { @@ -185,7 +192,7 @@ public function getSubscriptionText() /** * Retrieve the customer's primary addresses (i.e. default billing and shipping). * - * @return \Magento\Customer\Api\Data\AddressInterface[]|bool + * @return AddressInterface[]|bool */ public function getPrimaryAddresses() { @@ -230,7 +237,7 @@ public function getBackUrl() /** * Create an instance of a subscriber. * - * @return \Magento\Newsletter\Model\Subscriber + * @return Subscriber */ protected function _createSubscriber() { diff --git a/app/code/Magento/Customer/Block/Account/Dashboard/Info.php b/app/code/Magento/Customer/Block/Account/Dashboard/Info.php index 87132c3afb8bc..a48c706124c92 100644 --- a/app/code/Magento/Customer/Block/Account/Dashboard/Info.php +++ b/app/code/Magento/Customer/Block/Account/Dashboard/Info.php @@ -5,7 +5,15 @@ */ namespace Magento\Customer\Block\Account\Dashboard; +use Magento\Customer\Api\Data\CustomerInterface; +use Magento\Customer\Block\Form\Register; +use Magento\Customer\Helper\Session\CurrentCustomer; +use Magento\Customer\Helper\View; use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\View\Element\Template; +use Magento\Framework\View\Element\Template\Context; +use Magento\Newsletter\Model\Subscriber; +use Magento\Newsletter\Model\SubscriberFactory; /** * Dashboard Customer Info @@ -13,44 +21,44 @@ * @api * @since 100.0.2 */ -class Info extends \Magento\Framework\View\Element\Template +class Info extends Template { /** * Cached subscription object * - * @var \Magento\Newsletter\Model\Subscriber + * @var Subscriber */ protected $_subscription; /** - * @var \Magento\Newsletter\Model\SubscriberFactory + * @var SubscriberFactory */ protected $_subscriberFactory; /** - * @var \Magento\Customer\Helper\View + * @var View */ protected $_helperView; /** - * @var \Magento\Customer\Helper\Session\CurrentCustomer + * @var CurrentCustomer */ protected $currentCustomer; /** * Constructor * - * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Customer\Helper\Session\CurrentCustomer $currentCustomer - * @param \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory - * @param \Magento\Customer\Helper\View $helperView + * @param Context $context + * @param CurrentCustomer $currentCustomer + * @param SubscriberFactory $subscriberFactory + * @param View $helperView * @param array $data */ public function __construct( - \Magento\Framework\View\Element\Template\Context $context, - \Magento\Customer\Helper\Session\CurrentCustomer $currentCustomer, - \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory, - \Magento\Customer\Helper\View $helperView, + Context $context, + CurrentCustomer $currentCustomer, + SubscriberFactory $subscriberFactory, + View $helperView, array $data = [] ) { $this->currentCustomer = $currentCustomer; @@ -62,7 +70,7 @@ public function __construct( /** * Returns the Magento Customer Model for this block * - * @return \Magento\Customer\Api\Data\CustomerInterface|null + * @return CustomerInterface|null */ public function getCustomer() { @@ -84,6 +92,8 @@ public function getName() } /** + * Get the url to change password + * * @return string */ public function getChangePasswordUrl() @@ -94,7 +104,7 @@ public function getChangePasswordUrl() /** * Get Customer Subscription Object Information * - * @return \Magento\Newsletter\Model\Subscriber + * @return Subscriber */ public function getSubscriptionObject() { @@ -102,7 +112,8 @@ public function getSubscriptionObject() $this->_subscription = $this->_createSubscriber(); $customer = $this->getCustomer(); if ($customer) { - $this->_subscription->loadByCustomerId($customer->getId()); + $websiteId = (int)$this->_storeManager->getWebsite()->getId(); + $this->_subscription->loadByCustomer((int)$customer->getId(), $websiteId); } } return $this->_subscription; @@ -128,12 +139,14 @@ public function getIsSubscribed() public function isNewsletterEnabled() { return $this->getLayout() - ->getBlockSingleton(\Magento\Customer\Block\Form\Register::class) + ->getBlockSingleton(Register::class) ->isNewsletterEnabled(); } /** - * @return \Magento\Newsletter\Model\Subscriber + * Create new instance of Subscriber + * + * @return Subscriber */ protected function _createSubscriber() { @@ -141,7 +154,7 @@ protected function _createSubscriber() } /** - * @return string + * @inheritdoc */ protected function _toHtml() { diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter.php index 46a8dcfb28f1b..0d94a01698b31 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter.php @@ -5,14 +5,30 @@ */ namespace Magento\Customer\Block\Adminhtml\Edit\Tab; +use Magento\Backend\Block\Template\Context; +use Magento\Backend\Block\Widget\Form\Generic; use Magento\Customer\Api\AccountManagementInterface; +use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Customer\Api\Data\CustomerInterface; +use Magento\Customer\Block\Adminhtml\Form\Element\Newsletter\Subscriptions as SubscriptionsElement; use Magento\Customer\Controller\RegistryConstants; +use Magento\Customer\Model\Config\Share; +use Magento\Framework\Data\Form; +use Magento\Framework\Data\Form\Element\Fieldset; +use Magento\Framework\Data\FormFactory; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Registry; +use Magento\Newsletter\Model\Subscriber; +use Magento\Newsletter\Model\SubscriberFactory; +use Magento\Store\Model\System\Store as SystemStore; use Magento\Ui\Component\Layout\Tabs\TabInterface; /** * Customer account form block + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Newsletter extends \Magento\Backend\Block\Widget\Form\Generic implements TabInterface +class Newsletter extends Generic implements TabInterface { /** * @var string @@ -20,7 +36,7 @@ class Newsletter extends \Magento\Backend\Block\Widget\Form\Generic implements T protected $_template = 'Magento_Customer::tab/newsletter.phtml'; /** - * @var \Magento\Newsletter\Model\SubscriberFactory + * @var SubscriberFactory */ protected $_subscriberFactory; @@ -32,37 +48,57 @@ class Newsletter extends \Magento\Backend\Block\Widget\Form\Generic implements T /** * Core registry * - * @var \Magento\Framework\Registry + * @var Registry */ protected $_coreRegistry = null; /** - * Constructor - * - * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Data\FormFactory $formFactory - * @param \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory + * @var SystemStore + */ + private $systemStore; + + /** + * @var CustomerRepositoryInterface + */ + private $customerRepository; + + /** + * @var Share + */ + private $shareConfig; + + /** + * @param Context $context + * @param Registry $registry + * @param FormFactory $formFactory + * @param SubscriberFactory $subscriberFactory * @param AccountManagementInterface $customerAccountManagement + * @param SystemStore $systemStore + * @param CustomerRepositoryInterface $customerRepository + * @param Share $shareConfig * @param array $data */ public function __construct( - \Magento\Backend\Block\Template\Context $context, - \Magento\Framework\Registry $registry, - \Magento\Framework\Data\FormFactory $formFactory, - \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory, + Context $context, + Registry $registry, + FormFactory $formFactory, + SubscriberFactory $subscriberFactory, AccountManagementInterface $customerAccountManagement, + SystemStore $systemStore, + CustomerRepositoryInterface $customerRepository, + Share $shareConfig, array $data = [] ) { $this->_subscriberFactory = $subscriberFactory; $this->customerAccountManagement = $customerAccountManagement; parent::__construct($context, $registry, $formFactory, $data); + $this->systemStore = $systemStore; + $this->customerRepository = $customerRepository; + $this->shareConfig = $shareConfig; } /** - * Return Tab label - * - * @return \Magento\Framework\Phrase + * @inheritdoc */ public function getTabLabel() { @@ -70,9 +106,7 @@ public function getTabLabel() } /** - * Return Tab title - * - * @return \Magento\Framework\Phrase + * @inheritdoc */ public function getTabTitle() { @@ -80,9 +114,7 @@ public function getTabTitle() } /** - * Tab class getter - * - * @return string + * @inheritdoc */ public function getTabClass() { @@ -90,9 +122,7 @@ public function getTabClass() } /** - * Return URL link to Tab content - * - * @return string + * @inheritdoc */ public function getTabUrl() { @@ -100,9 +130,7 @@ public function getTabUrl() } /** - * Tab should be loaded trough Ajax call - * - * @return bool + * @inheritdoc */ public function isAjaxLoaded() { @@ -110,19 +138,15 @@ public function isAjaxLoaded() } /** - * Can show tab in tabs - * - * @return boolean + * @inheritdoc */ public function canShowTab() { - return $this->_coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER_ID); + return (bool)$this->getCurrentCustomerId(); } /** - * Tab is hidden - * - * @return boolean + * @inheritdoc */ public function isHidden() { @@ -130,77 +154,256 @@ public function isHidden() } /** - * Initialize the form. + * @inheritdoc + */ + protected function _prepareForm() + { + $this->initForm(); + + return $this; + } + + /** + * Init form values * * @return $this - * @SuppressWarnings(PHPMD.NPathComplexity) */ public function initForm() { if (!$this->canShowTab()) { return $this; } - /**@var \Magento\Framework\Data\Form $form */ + $form = $this->_formFactory->create(); $form->setHtmlIdPrefix('_newsletter'); - $customerId = $this->_coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER_ID); - $subscriber = $this->_subscriberFactory->create()->loadByCustomerId($customerId); - $this->_coreRegistry->register('subscriber', $subscriber, true); + $this->setForm($form); + $fieldset = $form->addFieldset( + 'base_fieldset', + [ + 'legend' => __('Newsletter Information'), + 'class' => 'customer-newsletter-fieldset' . (!$this->isSingleWebsiteMode() ? ' multi-website' : ''), + ] + ); - $fieldset = $form->addFieldset('base_fieldset', ['legend' => __('Newsletter Information')]); + $customerSubscriptions = $this->getCustomerSubscriptionsOnWebsites(); + if (empty($customerSubscriptions)) { + return $this; + } - $fieldset->addField( - 'subscription', + if ($this->isSingleWebsiteMode()) { + $this->prepareFormSingleWebsite($fieldset, $customerSubscriptions); + $this->updateFromSession($form, $this->getCurrentCustomerId()); + } else { + $this->prepareFormMultiplyWebsite($fieldset, $customerSubscriptions); + } + + if ($this->customerAccountManagement->isReadonly($this->getCurrentCustomerId())) { + $fieldset->setReadonly(true, true); + } + + return $this; + } + + /** + * Prepare form fields for single website mode + * + * @param Fieldset $fieldset + * @param array $subscriptions + * @return void + */ + private function prepareFormSingleWebsite(Fieldset $fieldset, array $subscriptions): void + { + $customer = $this->getCurrentCustomer(); + $websiteId = (int)$this->_storeManager->getStore($customer->getStoreId())->getWebsiteId(); + $customerSubscription = $subscriptions[$websiteId] ?? $this->retrieveSubscriberData($customer, $websiteId); + + $checkboxElement = $fieldset->addField( + 'subscription_status_' . $websiteId, 'checkbox', [ 'label' => __('Subscribed to Newsletter'), - 'name' => 'subscription', + 'name' => "subscription_status[$websiteId]", 'data-form-part' => $this->getData('target_form'), - 'onchange' => 'this.value = this.checked;' + 'value' => $customerSubscription['status'], + 'onchange' => 'this.value = this.checked;', ] ); - - if ($this->customerAccountManagement->isReadonly($customerId)) { - $form->getElement('subscription')->setReadonly(true, true); + $checkboxElement->setIsChecked($customerSubscription['status']); + if (!$this->isSingleStoreMode()) { + $fieldset->addField( + 'subscription_store_' . $websiteId, + 'select', + [ + 'label' => __('Subscribed on Store View'), + 'name' => "subscription_store[$websiteId]", + 'data-form-part' => $this->getData('target_form'), + 'values' => $customerSubscription['store_options'], + 'value' => $customerSubscription['store_id'] ?? null, + ] + ); } - $isSubscribed = $subscriber->isSubscribed(); - $form->setValues(['subscription' => $isSubscribed ? 'true' : 'false']); - $form->getElement('subscription')->setIsChecked($isSubscribed); - - $this->updateFromSession($form, $customerId); - - $changedDate = $this->getStatusChangedDate(); - if ($changedDate) { + if (!empty($customerSubscription['last_updated'])) { + $text = $customerSubscription['status'] ? __('Last Date Subscribed') : __('Last Date Unsubscribed'); $fieldset->addField( - 'change_status_date', + 'change_status_date_' . $websiteId, 'label', [ - 'label' => $isSubscribed ? __('Last Date Subscribed') : __('Last Date Unsubscribed'), - 'value' => $changedDate, + 'label' => $text, + 'value' => $customerSubscription['last_updated'], 'bold' => true ] ); } + } - $this->setForm($form); - return $this; + /** + * Prepare form fields for multiply website mode + * + * @param Fieldset $fieldset + * @param array $subscriptions + * @return void + */ + private function prepareFormMultiplyWebsite(Fieldset $fieldset, array $subscriptions): void + { + $fieldset->addType('customer_subscription', SubscriptionsElement::class); + $fieldset->addField( + 'subscription', + 'customer_subscription', + [ + 'label' => __('Subscribed to Newsletter'), + 'name' => 'subscription', + 'subscriptions' => $subscriptions, + 'target_form' => $this->getData('target_form'), + 'class' => 'newsletter-subscriptions', + 'customer_id' => $this->getCurrentCustomerId(), + ] + ); + } + + /** + * Get current customer id + * + * @return int + */ + private function getCurrentCustomerId(): int + { + return (int)$this->_coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER_ID); + } + + /** + * Get current customer model + * + * @return CustomerInterface|null + */ + private function getCurrentCustomer(): ?CustomerInterface + { + $customerId = $this->getCurrentCustomerId(); + try { + $customer = $this->customerRepository->getById($customerId); + } catch (NoSuchEntityException $e) { + return null; + } + + return $customer; + } + + /** + * Get Customer Subscriptions on Websites + * + * @return array + */ + private function getCustomerSubscriptionsOnWebsites(): array + { + $customer = $this->getCurrentCustomer(); + if ($customer === null) { + return []; + } + + $subscriptions = []; + foreach ($this->_storeManager->getWebsites() as $website) { + /** Skip websites without stores */ + if ($website->getStoresCount() === 0) { + continue; + } + $websiteId = (int)$website->getId(); + $subscriptions[$websiteId] = $this->retrieveSubscriberData($customer, $websiteId); + } + + return $subscriptions; + } + + /** + * Retrieve subscriber data + * + * @param CustomerInterface $customer + * @param int $websiteId + * @return array + */ + private function retrieveSubscriberData(CustomerInterface $customer, int $websiteId): array + { + $subscriber = $this->_subscriberFactory->create()->loadByCustomer((int)$customer->getId(), $websiteId); + $storeOptions = $this->systemStore->getStoreOptionsTree(false, [], [], [$websiteId]); + $subscriberData = $subscriber->getData(); + $subscriberData['last_updated'] = $this->getSubscriberStatusChangeDate($subscriber); + $subscriberData['website_id'] = $websiteId; + $subscriberData['website_name'] = $this->systemStore->getWebsiteName($websiteId); + $subscriberData['status'] = $subscriber->isSubscribed(); + $subscriberData['store_options'] = $storeOptions; + + return $subscriberData; + } + + /** + * Is single systemStore mode + * + * @return bool + */ + private function isSingleStoreMode(): bool + { + return $this->_storeManager->isSingleStoreMode(); + } + + /** + * Is single website mode + * + * @return bool + */ + private function isSingleWebsiteMode(): bool + { + return $this->isSingleStoreMode() + || !$this->shareConfig->isGlobalScope() + || count($this->_storeManager->getWebsites()) === 1; } /** * Update form elements from session data * - * @param \Magento\Framework\Data\Form $form + * @param Form $form * @param int $customerId * @return void */ - protected function updateFromSession(\Magento\Framework\Data\Form $form, $customerId) + protected function updateFromSession(Form $form, $customerId) { + if (!$this->isSingleWebsiteMode()) { + return; + } $data = $this->_backendSession->getCustomerFormData(); - if (!empty($data)) { - $dataCustomerId = isset($data['customer']['entity_id']) ? $data['customer']['entity_id'] : null; - if (isset($data['subscription']) && $dataCustomerId == $customerId) { - $form->getElement('subscription')->setIsChecked($data['subscription']); - } + $sessionCustomerId = $data['customer']['entity_id'] ?? null; + if ($sessionCustomerId === null || (int)$sessionCustomerId !== (int)$customerId) { + return; + } + + $websiteId = (int)$this->getCurrentCustomer()->getWebsiteId(); + $statusSessionValue = $data['subscription_status'][$websiteId] ?? null; + if ($statusSessionValue !== null) { + $subscribeElement = $form->getElement('subscription_status_' . $websiteId); + $subscribeElement->setValue($statusSessionValue); + $subscribeElement->setChecked($statusSessionValue); + } + $storeSessionValue = $data['subscription_store'][$websiteId] ?? null; + $storeElement = $form->getElement('subscription_store_' . $websiteId); + if ($storeSessionValue !== null && $storeElement !== null) { + $storeElement->setValue($storeSessionValue); } } @@ -211,28 +414,32 @@ protected function updateFromSession(\Magento\Framework\Data\Form $form, $custom */ public function getStatusChangedDate() { - $subscriber = $this->_coreRegistry->registry('subscriber'); - if ($subscriber->getChangeStatusAt()) { - return $this->formatDate( - $subscriber->getChangeStatusAt(), - \IntlDateFormatter::MEDIUM, - true - ); + $customer = $this->getCurrentCustomerId(); + if ($customer === null) { + return ''; } + $customerId = (int)$customer->getId(); + $subscriber = $this->_subscriberFactory->create()->loadByCustomer($customerId, (int)$customer->getWebsiteId()); - return null; + return $this->getSubscriberStatusChangeDate($subscriber); } /** + * Retrieve the date when the subscriber status changed + * + * @param Subscriber $subscriber * @return string */ - protected function _toHtml() + private function getSubscriberStatusChangeDate(Subscriber $subscriber): string { - if ($this->canShowTab()) { - $this->initForm(); - return parent::_toHtml(); - } else { + if (empty($subscriber->getChangeStatusAt())) { return ''; } + + return $this->formatDate( + $subscriber->getChangeStatusAt(), + \IntlDateFormatter::MEDIUM, + true + ); } } diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid.php index 4f49c3ba1db9b..97582fbdb19b2 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid.php @@ -5,47 +5,75 @@ */ namespace Magento\Customer\Block\Adminhtml\Edit\Tab\Newsletter; +use Magento\Backend\Block\Template\Context; +use Magento\Backend\Block\Widget\Grid\Extended; +use Magento\Backend\Helper\Data; +use Magento\Customer\Block\Adminhtml\Edit\Tab\Newsletter\Grid\Renderer\Action; +use Magento\Customer\Block\Adminhtml\Edit\Tab\Newsletter\Grid\Renderer\Status; +use Magento\Customer\Controller\RegistryConstants; +use Magento\Customer\Model\Config\Share; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\Registry; +use Magento\Newsletter\Model\ResourceModel\Queue\CollectionFactory; +use Magento\Store\Model\System\Store as SystemStore; + /** * Adminhtml newsletter queue grid block * * @api * @since 100.0.2 */ -class Grid extends \Magento\Backend\Block\Widget\Grid\Extended +class Grid extends Extended { /** * Core registry * - * @var \Magento\Framework\Registry|null + * @var Registry|null */ protected $_coreRegistry = null; /** - * @var \Magento\Newsletter\Model\ResourceModel\Queue\CollectionFactory + * @var CollectionFactory */ protected $_collectionFactory; /** - * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Backend\Helper\Data $backendHelper - * @param \Magento\Newsletter\Model\ResourceModel\Queue\CollectionFactory $collectionFactory - * @param \Magento\Framework\Registry $coreRegistry + * @var Share + */ + private $shareConfig; + + /** + * @var SystemStore + */ + private $systemStore; + + /** + * @param Context $context + * @param Data $backendHelper + * @param CollectionFactory $collectionFactory + * @param Registry $coreRegistry * @param array $data + * @param Share|null $shareConfig + * @param SystemStore|null $systemStore */ public function __construct( - \Magento\Backend\Block\Template\Context $context, - \Magento\Backend\Helper\Data $backendHelper, - \Magento\Newsletter\Model\ResourceModel\Queue\CollectionFactory $collectionFactory, - \Magento\Framework\Registry $coreRegistry, - array $data = [] + Context $context, + Data $backendHelper, + CollectionFactory $collectionFactory, + Registry $coreRegistry, + array $data = [], + Share $shareConfig = null, + SystemStore $systemStore = null ) { $this->_coreRegistry = $coreRegistry; $this->_collectionFactory = $collectionFactory; parent::__construct($context, $backendHelper, $data); + $this->shareConfig = $shareConfig ?? ObjectManager::getInstance()->get(Share::class); + $this->systemStore = $systemStore ?? ObjectManager::getInstance()->get(SystemStore::class); } /** - * @return void + * @inheritdoc */ protected function _construct() { @@ -60,7 +88,7 @@ protected function _construct() } /** - * @return string + * @inheritdoc */ public function getGridUrl() { @@ -68,22 +96,19 @@ public function getGridUrl() } /** - * @return $this + * @inheritdoc */ protected function _prepareCollection() { - /** @var $collection \Magento\Newsletter\Model\ResourceModel\Queue\Collection */ - $collection = $this->_collectionFactory->create()->addTemplateInfo()->addSubscriberFilter( - $this->_coreRegistry->registry('subscriber')->getId() - ); - + $customerId = $this->getCurrentCustomerId(); + $collection = $this->_collectionFactory->create()->addTemplateInfo()->addCustomerFilter($customerId); $this->setCollection($collection); return parent::_prepareCollection(); } /** - * @return $this + * @inheritdoc */ protected function _prepareColumns() { @@ -132,6 +157,19 @@ protected function _prepareColumns() ['header' => __('Subject'), 'align' => 'center', 'index' => 'template_subject'] ); + if ($this->isMultiplyWebsiteMode()) { + $this->addColumn( + 'store_view', + [ + 'header' => __('Store View'), + 'align' => 'center', + 'index' => 'subscriber_store_id', + 'type' => 'options', + 'option_groups' => $this->systemStore->getStoreValuesForForm(), + ] + ); + } + $this->addColumn( 'status', [ @@ -139,7 +177,7 @@ protected function _prepareColumns() 'align' => 'center', 'filter' => \Magento\Customer\Block\Adminhtml\Edit\Tab\Newsletter\Grid\Filter\Status::class, 'index' => 'queue_status', - 'renderer' => \Magento\Customer\Block\Adminhtml\Edit\Tab\Newsletter\Grid\Renderer\Status::class + 'renderer' => Status::class ] ); @@ -150,10 +188,31 @@ protected function _prepareColumns() 'align' => 'center', 'filter' => false, 'sortable' => false, - 'renderer' => \Magento\Customer\Block\Adminhtml\Edit\Tab\Newsletter\Grid\Renderer\Action::class + 'renderer' => Action::class ] ); return parent::_prepareColumns(); } + + /** + * Get current customer id + * + * @return int + */ + private function getCurrentCustomerId(): int + { + return (int)$this->_coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER_ID); + } + + /** + * Is multiply website mode + * + * @return bool + */ + private function isMultiplyWebsiteMode(): bool + { + return $this->shareConfig->isGlobalScope() + && count($this->_storeManager->getWebsites()) > 1; + } } diff --git a/app/code/Magento/Customer/Block/Adminhtml/Form/Element/Newsletter/Subscriptions.php b/app/code/Magento/Customer/Block/Adminhtml/Form/Element/Newsletter/Subscriptions.php new file mode 100644 index 0000000000000..e9686daa3e3ab --- /dev/null +++ b/app/code/Magento/Customer/Block/Adminhtml/Form/Element/Newsletter/Subscriptions.php @@ -0,0 +1,161 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Customer\Block\Adminhtml\Form\Element\Newsletter; + +use Magento\Framework\App\Request\DataPersistorInterface; +use Magento\Framework\Data\Form\Element\AbstractElement; +use Magento\Framework\Data\Form\Element\CollectionFactory; +use Magento\Framework\Data\Form\Element\Factory; +use Magento\Framework\Escaper; + +/** + * Customer Newsletter Subscriptions Element + */ +class Subscriptions extends AbstractElement +{ + /** + * @var DataPersistorInterface + */ + private $dataPersistor; + + /** + * @param Factory $factoryElement + * @param CollectionFactory $factoryCollection + * @param Escaper $escaper + * @param DataPersistorInterface $dataPersistor + * @param array $data + */ + public function __construct( + Factory $factoryElement, + CollectionFactory $factoryCollection, + Escaper $escaper, + DataPersistorInterface $dataPersistor, + $data = [] + ) { + $this->dataPersistor = $dataPersistor; + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); + } + + /** + * @inheritdoc + */ + public function getElementHtml() + { + $websiteHeader = $this->_escape(__('Website')); + $subscribedHeader = $this->_escape(__('Subscribed')); + $storeHeader = $this->_escape(__('Store View')); + $lastUpdatedHeader = $this->_escape(__('Last Updated At')); + $bodyHtml = ''; + foreach ($this->getData('subscriptions') as $subscriptions) { + $storeId = !empty($subscriptions['store_id']) ? (int)$subscriptions['store_id'] : null; + $websiteId = (int)$subscriptions['website_id']; + $websiteName = $this->_escape($subscriptions['website_name']); + $subscribed = (bool)$subscriptions['status']; + $options = (array)$subscriptions['store_options']; + $statusElement = $this->getSubscriptionStatusElementHtml($websiteId, $subscribed); + $storeSelectElement = $this->getStoreSelectElementHtml($websiteId, $options, $storeId); + $lastUpdated = !empty($subscriptions['last_updated']) ? $subscriptions['last_updated'] : ''; + + $bodyHtml .= "<tr><td>{$websiteName}</td><td class=\"subscriber-status\">$statusElement</td>" + . "<td>$storeSelectElement</td><td>$lastUpdated</td></tr>"; + } + $html = '<table class="admin__table-secondary">' + . "<tr><th>{$websiteHeader}</th><th class=\"subscriber-status\">{$subscribedHeader}</th>" + . "<th>{$storeHeader}</th><th>{$lastUpdatedHeader}</th></tr>" + . $bodyHtml + . '</table>'; + + return $html; + } + + /** + * Get store select element html + * + * @param int $websiteId + * @param array $options + * @param int|null $value + * @return string + */ + private function getStoreSelectElementHtml(int $websiteId, array $options, ?int $value): string + { + $name = $this->getData('name'); + $value = $this->getSessionFormValue("{$name}_store", $websiteId) ?? $value; + $elementId = $name . '_store_' . $websiteId; + $element = $this->_factoryElement->create( + 'select', + [ + 'data' => [ + 'name' => "{$name}_store[$websiteId]", + 'data-form-part' => $this->getData('target_form'), + 'values' => $options, + 'value' => $value, + 'required' => true, + ], + ] + ); + $element->setId($elementId); + $element->setForm($this->getForm()); + if ($this->getReadonly()) { + $element->setReadonly($this->getReadonly(), $this->getDisabled()); + } + + return $element->toHtml(); + } + + /** + * Get subscription status element html + * + * @param int $websiteId + * @param bool $value + * @return string + */ + private function getSubscriptionStatusElementHtml(int $websiteId, bool $value): string + { + $name = $this->getData('name'); + $value = $this->getSessionFormValue("{$name}_status", $websiteId) ?? $value; + $elementId = $name . '_status_' . $websiteId; + $element = $this->_factoryElement->create( + 'checkbox', + [ + 'data' => [ + 'name' => "{$name}_status[$websiteId]", + 'data-form-part' => $this->getData('target_form'), + 'value' => $value, + 'onchange' => 'this.value = this.checked;', + ], + ] + ); + $element->setId($elementId); + $element->setForm($this->getForm()); + $element->setIsChecked($value); + if ($this->getReadonly()) { + $element->setReadonly($this->getReadonly(), $this->getDisabled()); + } + + return $element->toHtml(); + } + + /** + * Get form data value from current session + * + * @param string $name + * @param int $arrayKey + * @return string|null + */ + private function getSessionFormValue(string $name, int $arrayKey): ?string + { + $data = $this->dataPersistor->get('customer_form'); + $currentCustomerId = $this->getData('customer_id'); + $sessionCustomerId = $data['customer']['entity_id'] ?? null; + if ($sessionCustomerId === null || $currentCustomerId !== (int)$sessionCustomerId) { + return null; + } + + return $data[$name][$arrayKey] ?? null; + } +} diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index/MassSubscribe.php b/app/code/Magento/Customer/Controller/Adminhtml/Index/MassSubscribe.php index 29a66bf1ff933..881c5caebcbee 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Index/MassSubscribe.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Index/MassSubscribe.php @@ -7,10 +7,10 @@ use Magento\Backend\App\Action\Context; use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface; +use Magento\Newsletter\Model\SubscriptionManagerInterface; use Magento\Ui\Component\MassAction\Filter; use Magento\Customer\Model\ResourceModel\Customer\CollectionFactory; use Magento\Customer\Api\CustomerRepositoryInterface; -use Magento\Newsletter\Model\SubscriberFactory; use Magento\Eav\Model\Entity\Collection\AbstractCollection; use Magento\Framework\Controller\ResultFactory; @@ -25,27 +25,27 @@ class MassSubscribe extends AbstractMassAction implements HttpPostActionInterfac protected $customerRepository; /** - * @var SubscriberFactory + * @var SubscriptionManagerInterface */ - protected $subscriberFactory; + private $subscriptionManager; /** * @param Context $context * @param Filter $filter * @param CollectionFactory $collectionFactory * @param CustomerRepositoryInterface $customerRepository - * @param SubscriberFactory $subscriberFactory + * @param SubscriptionManagerInterface $subscriptionManager */ public function __construct( Context $context, Filter $filter, CollectionFactory $collectionFactory, CustomerRepositoryInterface $customerRepository, - SubscriberFactory $subscriberFactory + SubscriptionManagerInterface $subscriptionManager ) { parent::__construct($context, $filter, $collectionFactory); $this->customerRepository = $customerRepository; - $this->subscriberFactory = $subscriberFactory; + $this->subscriptionManager = $subscriptionManager; } /** @@ -58,9 +58,9 @@ protected function massAction(AbstractCollection $collection) { $customersUpdated = 0; foreach ($collection->getAllIds() as $customerId) { - // Verify customer exists - $this->customerRepository->getById($customerId); - $this->subscriberFactory->create()->subscribeCustomerById($customerId); + $customer = $this->customerRepository->getById($customerId); + $storeId = (int)$customer->getStoreId(); + $this->subscriptionManager->subscribeCustomer($customerId, $storeId); $customersUpdated++; } diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index/MassUnsubscribe.php b/app/code/Magento/Customer/Controller/Adminhtml/Index/MassUnsubscribe.php index fddf18489b9a5..17f420d864df0 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Index/MassUnsubscribe.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Index/MassUnsubscribe.php @@ -9,7 +9,7 @@ use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface; use Magento\Framework\Controller\ResultFactory; use Magento\Backend\App\Action\Context; -use Magento\Newsletter\Model\SubscriberFactory; +use Magento\Newsletter\Model\SubscriptionManagerInterface; use Magento\Ui\Component\MassAction\Filter; use Magento\Customer\Model\ResourceModel\Customer\CollectionFactory; use Magento\Eav\Model\Entity\Collection\AbstractCollection; @@ -25,27 +25,27 @@ class MassUnsubscribe extends AbstractMassAction implements HttpPostActionInterf protected $customerRepository; /** - * @var SubscriberFactory + * @var SubscriptionManagerInterface */ - protected $subscriberFactory; + private $subscriptionManager; /** * @param Context $context * @param Filter $filter * @param CollectionFactory $collectionFactory * @param CustomerRepositoryInterface $customerRepository - * @param SubscriberFactory $subscriberFactory + * @param SubscriptionManagerInterface $subscriptionManager */ public function __construct( Context $context, Filter $filter, CollectionFactory $collectionFactory, CustomerRepositoryInterface $customerRepository, - SubscriberFactory $subscriberFactory + SubscriptionManagerInterface $subscriptionManager ) { parent::__construct($context, $filter, $collectionFactory); $this->customerRepository = $customerRepository; - $this->subscriberFactory = $subscriberFactory; + $this->subscriptionManager = $subscriptionManager; } /** @@ -59,8 +59,9 @@ protected function massAction(AbstractCollection $collection) $customersUpdated = 0; foreach ($collection->getAllIds() as $customerId) { // Verify customer exists - $this->customerRepository->getById($customerId); - $this->subscriberFactory->create()->unsubscribeCustomerById($customerId); + $customer = $this->customerRepository->getById($customerId); + $storeId = (int)$customer->getStoreId(); + $this->subscriptionManager->unsubscribeCustomer($customerId, $storeId); $customersUpdated++; } diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php b/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php index 3ee33af9ec073..b85b735ea9c4f 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php @@ -5,25 +5,45 @@ */ namespace Magento\Customer\Controller\Adminhtml\Index; +use Magento\Backend\App\Action\Context; +use Magento\Backend\Model\View\Result\ForwardFactory; +use Magento\Backend\Model\View\Result\Redirect; use Magento\Customer\Api\AccountManagementInterface; +use Magento\Customer\Api\AddressMetadataInterface; use Magento\Customer\Api\AddressRepositoryInterface; +use Magento\Customer\Api\CustomerMetadataInterface; use Magento\Customer\Api\CustomerRepositoryInterface; -use Magento\Customer\Model\Address\Mapper; -use Magento\Customer\Model\AddressRegistry; -use Magento\Framework\Api\DataObjectHelper; use Magento\Customer\Api\Data\AddressInterfaceFactory; -use Magento\Customer\Api\Data\CustomerInterfaceFactory; -use Magento\Framework\DataObjectFactory as ObjectFactory; -use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface; -use Magento\Customer\Api\AddressMetadataInterface; -use Magento\Customer\Api\CustomerMetadataInterface; +use Magento\Customer\Api\Data\AttributeMetadataInterface; use Magento\Customer\Api\Data\CustomerInterface; +use Magento\Customer\Api\Data\CustomerInterfaceFactory; use Magento\Customer\Controller\RegistryConstants; +use Magento\Customer\Helper\View; +use Magento\Customer\Model\Address\Mapper; +use Magento\Customer\Model\AddressFactory; +use Magento\Customer\Model\AddressRegistry; +use Magento\Customer\Model\CustomerFactory; use Magento\Customer\Model\EmailNotificationInterface; use Magento\Customer\Model\Metadata\Form; +use Magento\Customer\Model\Metadata\FormFactory; +use Magento\Framework\Api\DataObjectHelper; +use Magento\Framework\Api\ExtensibleDataObjectConverter; +use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\App\Response\Http\FileFactory; +use Magento\Framework\Controller\Result\JsonFactory; +use Magento\Framework\DataObject; +use Magento\Framework\DataObjectFactory as ObjectFactory; +use Magento\Framework\Exception\AbstractAggregateException; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Exception\NoSuchEntityException; -use Magento\Framework\App\ObjectManager; +use Magento\Framework\Math\Random; +use Magento\Framework\Reflection\DataObjectProcessor; +use Magento\Framework\Registry; +use Magento\Framework\View\Result\LayoutFactory; +use Magento\Framework\View\Result\PageFactory; +use Magento\Newsletter\Model\SubscriberFactory; +use Magento\Newsletter\Model\SubscriptionManagerInterface; /** * Save customer action. @@ -37,6 +57,11 @@ class Save extends \Magento\Customer\Controller\Adminhtml\Index implements HttpP */ private $emailNotification; + /** + * @var SubscriptionManagerInterface + */ + private $subscriptionManager; + /** * @var AddressRegistry */ @@ -45,60 +70,62 @@ class Save extends \Magento\Customer\Controller\Adminhtml\Index implements HttpP /** * Constructor * - * @param \Magento\Backend\App\Action\Context $context - * @param \Magento\Framework\Registry $coreRegistry - * @param \Magento\Framework\App\Response\Http\FileFactory $fileFactory - * @param \Magento\Customer\Model\CustomerFactory $customerFactory - * @param \Magento\Customer\Model\AddressFactory $addressFactory - * @param \Magento\Customer\Model\Metadata\FormFactory $formFactory - * @param \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory - * @param \Magento\Customer\Helper\View $viewHelper - * @param \Magento\Framework\Math\Random $random + * @param Context $context + * @param Registry $coreRegistry + * @param FileFactory $fileFactory + * @param CustomerFactory $customerFactory + * @param AddressFactory $addressFactory + * @param FormFactory $formFactory + * @param SubscriberFactory $subscriberFactory + * @param View $viewHelper + * @param Random $random * @param CustomerRepositoryInterface $customerRepository - * @param \Magento\Framework\Api\ExtensibleDataObjectConverter $extensibleDataObjectConverter + * @param ExtensibleDataObjectConverter $extensibleDataObjectConverter * @param Mapper $addressMapper * @param AccountManagementInterface $customerAccountManagement * @param AddressRepositoryInterface $addressRepository * @param CustomerInterfaceFactory $customerDataFactory * @param AddressInterfaceFactory $addressDataFactory * @param \Magento\Customer\Model\Customer\Mapper $customerMapper - * @param \Magento\Framework\Reflection\DataObjectProcessor $dataObjectProcessor + * @param DataObjectProcessor $dataObjectProcessor * @param DataObjectHelper $dataObjectHelper * @param ObjectFactory $objectFactory * @param \Magento\Framework\View\LayoutFactory $layoutFactory - * @param \Magento\Framework\View\Result\LayoutFactory $resultLayoutFactory - * @param \Magento\Framework\View\Result\PageFactory $resultPageFactory - * @param \Magento\Backend\Model\View\Result\ForwardFactory $resultForwardFactory - * @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory + * @param LayoutFactory $resultLayoutFactory + * @param PageFactory $resultPageFactory + * @param ForwardFactory $resultForwardFactory + * @param JsonFactory $resultJsonFactory + * @param SubscriptionManagerInterface $subscriptionManager * @param AddressRegistry|null $addressRegistry * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Backend\App\Action\Context $context, - \Magento\Framework\Registry $coreRegistry, - \Magento\Framework\App\Response\Http\FileFactory $fileFactory, - \Magento\Customer\Model\CustomerFactory $customerFactory, - \Magento\Customer\Model\AddressFactory $addressFactory, - \Magento\Customer\Model\Metadata\FormFactory $formFactory, - \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory, - \Magento\Customer\Helper\View $viewHelper, - \Magento\Framework\Math\Random $random, + Context $context, + Registry $coreRegistry, + FileFactory $fileFactory, + CustomerFactory $customerFactory, + AddressFactory $addressFactory, + FormFactory $formFactory, + SubscriberFactory $subscriberFactory, + View $viewHelper, + Random $random, CustomerRepositoryInterface $customerRepository, - \Magento\Framework\Api\ExtensibleDataObjectConverter $extensibleDataObjectConverter, + ExtensibleDataObjectConverter $extensibleDataObjectConverter, Mapper $addressMapper, AccountManagementInterface $customerAccountManagement, AddressRepositoryInterface $addressRepository, CustomerInterfaceFactory $customerDataFactory, AddressInterfaceFactory $addressDataFactory, \Magento\Customer\Model\Customer\Mapper $customerMapper, - \Magento\Framework\Reflection\DataObjectProcessor $dataObjectProcessor, + DataObjectProcessor $dataObjectProcessor, DataObjectHelper $dataObjectHelper, ObjectFactory $objectFactory, \Magento\Framework\View\LayoutFactory $layoutFactory, - \Magento\Framework\View\Result\LayoutFactory $resultLayoutFactory, - \Magento\Framework\View\Result\PageFactory $resultPageFactory, - \Magento\Backend\Model\View\Result\ForwardFactory $resultForwardFactory, - \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory, + LayoutFactory $resultLayoutFactory, + PageFactory $resultPageFactory, + ForwardFactory $resultForwardFactory, + JsonFactory $resultJsonFactory, + SubscriptionManagerInterface $subscriptionManager, AddressRegistry $addressRegistry = null ) { parent::__construct( @@ -128,6 +155,7 @@ public function __construct( $resultForwardFactory, $resultJsonFactory ); + $this->subscriptionManager = $subscriptionManager; $this->addressRegistry = $addressRegistry ?: ObjectManager::getInstance()->get(AddressRegistry::class); } @@ -186,7 +214,7 @@ protected function _extractData( $formData = $metadataForm->compactData($formData); // Initialize additional attributes - /** @var \Magento\Framework\DataObject $object */ + /** @var DataObject $object */ $object = $this->_objectFactory->create(['data' => $this->getRequest()->getPostValue()]); $requestData = $object->getData($scope); foreach ($additionalAttributes as $attributeCode) { @@ -196,7 +224,7 @@ protected function _extractData( // Unset unused attributes $formAttributes = $metadataForm->getAttributes(); foreach ($formAttributes as $attribute) { - /** @var \Magento\Customer\Api\Data\AttributeMetadataInterface $attribute */ + /** @var AttributeMetadataInterface $attribute */ $attributeCode = $attribute->getAttributeCode(); if ($attribute->getFrontendInput() != 'boolean' && $formData[$attributeCode] === false @@ -281,7 +309,7 @@ protected function _extractCustomerAddressData(array & $extractedCustomerData) /** * Save customer action * - * @return \Magento\Backend\Model\View\Result\Redirect + * @return Redirect * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.ExcessiveMethodLength) * @SuppressWarnings(PHPMD.NPathComplexity) @@ -312,7 +340,7 @@ public function execute() $this->dataObjectHelper->populateWithArray( $customer, $customerData, - \Magento\Customer\Api\Data\CustomerInterface::class + CustomerInterface::class ); $this->_eventManager->dispatch( @@ -334,17 +362,7 @@ public function execute() $customerId = $customer->getId(); } - $isSubscribed = null; - if ($this->_authorization->isAllowed(null)) { - $isSubscribed = $this->getRequest()->getPost('subscription'); - } - if ($isSubscribed !== null) { - if ($isSubscribed !== '0') { - $this->_subscriberFactory->create()->subscribeCustomerById($customerId); - } else { - $this->_subscriberFactory->create()->unsubscribeCustomerById($customerId); - } - } + $this->updateSubscriptions($customer); // After save $this->_eventManager->dispatch( @@ -364,7 +382,7 @@ public function execute() $this->_addSessionErrorMessages($messages); $this->_getSession()->setCustomerFormData($this->retrieveFormattedFormData()); $returnToEdit = true; - } catch (\Magento\Framework\Exception\AbstractAggregateException $exception) { + } catch (AbstractAggregateException $exception) { $errors = $exception->getErrors(); $messages = []; foreach ($errors as $error) { @@ -406,6 +424,34 @@ public function execute() return $resultRedirect; } + /** + * Update customer website subscriptions + * + * @param CustomerInterface $customer + * @return void + */ + private function updateSubscriptions(CustomerInterface $customer): void + { + if (!$this->_authorization->isAllowed(null)) { + return; + } + + $subscriptionStatus = (array)$this->getRequest()->getParam('subscription_status'); + $subscriptionStore = (array)$this->getRequest()->getParam('subscription_store'); + if (empty($subscriptionStatus)) { + return; + } + + foreach ($subscriptionStatus as $websiteId => $status) { + $storeId = $subscriptionStore[$websiteId] ?? $customer->getStoreId(); + if ($status) { + $this->subscriptionManager->subscribeCustomer((int)$customer->getId(), $storeId); + } else { + $this->subscriptionManager->unsubscribeCustomer((int)$customer->getId(), $storeId); + } + } + } + /** * Get email notification * @@ -415,7 +461,7 @@ public function execute() private function getEmailNotification() { if (!($this->emailNotification instanceof EmailNotificationInterface)) { - return \Magento\Framework\App\ObjectManager::getInstance()->get( + return ObjectManager::getInstance()->get( EmailNotificationInterface::class ); } else { diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerSubscribeNewsletterActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerSubscribeNewsletterActionGroup.xml new file mode 100644 index 0000000000000..49373bb7bebf9 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerSubscribeNewsletterActionGroup.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAssertCustomerIsSubscribedToNewsletters"> + <annotations> + <description>Verify that check box "Newsletter subscribed" is checked on "Newsletter" tab on customer edit page.</description> + </annotations> + <arguments> + <argument name="websiteId" type="string" defaultValue="1"/> + </arguments> + + <click selector="{{AdminEditCustomerInformationSection.newsLetter}}" stepKey="clickToNewsletterTabHeader"/> + <waitForPageLoad stepKey="waitForShowNewsletterTab"/> + <seeCheckboxIsChecked selector="{{AdminEditCustomerNewsletterSection.subscribedStatus(websiteId)}}" stepKey="assertSubscribedToNewsletter"/> + </actionGroup> + + <actionGroup name="AdminAssertCustomerIsSubscribedToNewslettersAndSelectedStoreView" extends="AdminAssertCustomerIsSubscribedToNewsletters"> + <annotations> + <description>Verify that check box "Newsletter subscribed" is checked and Store View is selected on "Newsletter" tab on customer edit page.</description> + </annotations> + <arguments> + <argument name="storeView"/> + </arguments> + + <seeOptionIsSelected selector="{{AdminEditCustomerNewsletterSection.subscribedStore(websiteId)}}" userInput="{{storeView.name}}" stepKey="assertSubscribedStoreView" after="assertSubscribedToNewsletter"/> + </actionGroup> +</actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCustomerSubscribeNewsletterActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCustomerSubscribeNewsletterActionGroup.xml new file mode 100644 index 0000000000000..49ea772569cc0 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCustomerSubscribeNewsletterActionGroup.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminSubscribeCustomerToNewsletters"> + <annotations> + <description>Set checkbox "Newsletter subscribed" on "Newsletter" tab on customer edit page.</description> + </annotations> + <arguments> + <argument name="websiteId" type="string" defaultValue="1"/> + </arguments> + + <click selector="{{AdminEditCustomerInformationSection.newsLetter}}" stepKey="clickToNewsletterTabHeader"/> + <waitForPageLoad stepKey="waitForShowNewsletterTab"/> + <checkOption selector="{{AdminEditCustomerNewsletterSection.subscribedStatus(websiteId)}}" stepKey="subscribeToNewsletter"/> + <click selector="{{AdminCustomerMainActionsSection.saveAndContinue}}" stepKey="saveAndContinue"/> + <waitForPageLoad stepKey="waitForSaving"/> + <see userInput="You saved the customer." stepKey="seeSuccessMessage"/> + </actionGroup> + + <actionGroup name="AdminSubscribeCustomerToNewslettersAndSelectStoreView" extends="AdminSubscribeCustomerToNewsletters"> + <annotations> + <description>Set checkbox "Newsletter subscribed" and select Store View on "Newsletter" tab on customer edit page.</description> + </annotations> + <arguments> + <argument name="storeView"/> + </arguments> + <selectOption selector="{{AdminEditCustomerNewsletterSection.subscribedStore(websiteId)}}" userInput="{{storeView.name}}" stepKey="selectSubscribeStoreView" after="subscribeToNewsletter"/> + </actionGroup> +</actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Customer/Test/Mftf/Section/AdminEditCustomerNewsletterSection.xml b/app/code/Magento/Customer/Test/Mftf/Section/AdminEditCustomerNewsletterSection.xml index 51b4b54c5c8b6..e6bdf2819e2a5 100644 --- a/app/code/Magento/Customer/Test/Mftf/Section/AdminEditCustomerNewsletterSection.xml +++ b/app/code/Magento/Customer/Test/Mftf/Section/AdminEditCustomerNewsletterSection.xml @@ -9,6 +9,8 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminEditCustomerNewsletterSection"> - <element name="subscribedToNewsletter" type="checkbox" selector="//div[@class='admin__field-control control']/input[@name='subscription']"/> + <element name="subscribedStatus" type="checkbox" selector="//div[@class='admin__field-control control']//input[@name='subscription_status[{{websiteId}}]']" parameterized="true"/> + <element name="subscribedStore" type="select" selector="//div[@class='admin__field-control control']//select[@name='subscription_store[{{websiteId}}]']" parameterized="true"/> + <element name="subscribedLastUpdatedDate" type="text" selector="//div[@class='admin__field-control control']//div[@class='field-change_status_date_{{websiteId}}']//div[@class='control-value']" parameterized="true"/> </section> </sections> \ No newline at end of file diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerOnStorefrontSignupNewsletterTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerOnStorefrontSignupNewsletterTest.xml index 22ad60ff5de34..5d09f819bcbc0 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerOnStorefrontSignupNewsletterTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerOnStorefrontSignupNewsletterTest.xml @@ -49,6 +49,6 @@ <waitForPageLoad stepKey="waitForEditLinkLoad"/> <click selector="{{AdminEditCustomerInformationSection.newsLetter}}" stepKey="clickNewsLetter"/> <waitForPageLoad stepKey="waitForNewsletterTabToOpen"/> - <seeCheckboxIsChecked selector="{{AdminEditCustomerNewsletterSection.subscribedToNewsletter}}" stepKey="seeAssertSubscribedToNewsletterCheckboxIsChecked"/> + <seeCheckboxIsChecked selector="{{AdminEditCustomerNewsletterSection.subscribedStatus('1')}}" stepKey="seeAssertSubscribedToNewsletterCheckboxIsChecked"/> </test> </tests> \ No newline at end of file diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCustomerSubscribeNewsletterPerWebsiteTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCustomerSubscribeNewsletterPerWebsiteTest.xml new file mode 100644 index 0000000000000..6c1a27c395917 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCustomerSubscribeNewsletterPerWebsiteTest.xml @@ -0,0 +1,101 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCustomerSubscribeNewsletterPerWebsiteTest"> + <annotations> + <features value="Customer"/> + <stories value="Customer Subscriptions"/> + <title value="Newsletter subscriptions per website"/> + <description value="Admin should be able to subscribe customer to newsletters on each website separately"/> + <testCaseId value="MC-22173"/> + <severity value="MAJOR"/> + <group value="customer"/> + </annotations> + <before> + <createData entity="CustomerAccountSharingGlobal" stepKey="setConfigCustomerAccountToGlobal"/> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView"> + <argument name="customStore" value="NewStoreViewData"/> + </actionGroup> + <actionGroup ref="DeleteCustomerByEmailActionGroup" stepKey="deleteCustomer"> + <argument name="email" value="{{CustomerEntityOne.email}}"/> + </actionGroup> + <actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite"> + <argument name="websiteName" value="{{secondCustomWebsite.name}}"/> + </actionGroup> + <actionGroup ref="logout" stepKey="logout"/> + <createData entity="CustomerAccountSharingDefault" stepKey="setConfigCustomerAccountDefault"/> + </after> + + <!-- Create a new Store View --> + <actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createStoreView"> + <argument name="customStore" value="NewStoreViewData"/> + </actionGroup> + <!-- Switch to the new Store View on storefront --> + <amOnPage url="{{StorefrontHomePage.url}}" stepKey="amOnHomePage"/> + <waitForPageLoad stepKey="waitForNavigateHomePage"/> + <actionGroup ref="StorefrontSwitchStoreViewActionGroup" stepKey="switchToCustomStoreView"> + <argument name="storeView" value="NewStoreViewData"/> + </actionGroup> + <!-- Create a new customer and sign up newsletter on the new Store View --> + <actionGroup ref="StorefrontCreateCustomerSignedUpNewsletterActionGroup" stepKey="createCustomer"> + <argument name="customer" value="CustomerEntityOne" /> + </actionGroup> + <!-- Go to the customer edit page on admin area --> + <actionGroup ref="AdminFilterCustomerByEmail" stepKey="filterCustomerGrid"> + <argument name="email" value="{{CustomerEntityOne.email}}"/> + </actionGroup> + <click selector="{{AdminCustomerGridSection.firstRowEditLink}}" stepKey="clickToEditCustomerPage"/> + <waitForPageLoad stepKey="waitForOpenCustomerPage"/> + <grabFromCurrentUrl regex="~(\d+)/~" stepKey="grabCustomerId"/> + <!-- Assert that created customer is subscribed to newsletter on the new Store View --> + <actionGroup ref="AdminAssertCustomerIsSubscribedToNewslettersAndSelectedStoreView" stepKey="assertSubscribedToNewsletter"> + <argument name="storeView" value="NewStoreViewData"/> + </actionGroup> + <!-- Create second website --> + <actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createSecondWebsite"> + <argument name="newWebsiteName" value="{{secondCustomWebsite.name}}"/> + <argument name="websiteCode" value="{{secondCustomWebsite.code}}"/> + </actionGroup> + <!-- Create second store --> + <actionGroup ref="AdminCreateNewStoreGroupActionGroup" stepKey="createSecondStoreGroup"> + <argument name="website" value="{{secondCustomWebsite.name}}"/> + <argument name="storeGroupName" value="{{SecondStoreGroupUnique.name}}"/> + <argument name="storeGroupCode" value="{{SecondStoreGroupUnique.code}}"/> + </actionGroup> + <!-- Create second store view --> + <actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createSecondStoreView"> + <argument name="StoreGroup" value="SecondStoreGroupUnique"/> + <argument name="customStore" value="SecondStoreUnique"/> + </actionGroup> + <!-- Grab second website id into $grabFromCurrentUrlGetSecondWebsiteId --> + <actionGroup ref="AdminGetWebsiteIdActionGroup" stepKey="getSecondWebsiteId"> + <argument name="website" value="secondCustomWebsite"/> + </actionGroup> + <!-- Go to the customer edit page on admin area --> + <actionGroup ref="AdminOpenCustomerEditPageActionGroup" stepKey="openCustomerEditPage"> + <argument name="customerId" value="$grabCustomerId"/> + </actionGroup> + <!-- Assert that customer still subscribed to newsletter on default website --> + <actionGroup ref="AdminAssertCustomerIsSubscribedToNewsletters" stepKey="assertStillSubscribedToNewsletter"/> + <!-- Subscribe to newsletters customer on the second website --> + <actionGroup ref="AdminSubscribeCustomerToNewslettersAndSelectStoreView" stepKey="subscribeToNewsletterSecondWebsite"> + <argument name="websiteId" value="$grabFromCurrentUrlGetSecondWebsiteId"/> + <argument name="storeView" value="SecondStoreUnique"/> + </actionGroup> + <!-- Assert that created customer is subscribed to newsletter on second website --> + <actionGroup ref="AdminAssertCustomerIsSubscribedToNewslettersAndSelectedStoreView" stepKey="assertSubscribedToNewsletterSecondWebsite"> + <argument name="websiteId" value="$grabFromCurrentUrlGetSecondWebsiteId"/> + <argument name="storeView" value="SecondStoreUnique"/> + </actionGroup> + </test> +</tests> \ No newline at end of file diff --git a/app/code/Magento/Customer/Test/Unit/Block/Adminhtml/Edit/Tab/NewsletterTest.php b/app/code/Magento/Customer/Test/Unit/Block/Adminhtml/Edit/Tab/NewsletterTest.php index 1c252bfc75a53..22a22742cdb8d 100644 --- a/app/code/Magento/Customer/Test/Unit/Block/Adminhtml/Edit/Tab/NewsletterTest.php +++ b/app/code/Magento/Customer/Test/Unit/Block/Adminhtml/Edit/Tab/NewsletterTest.php @@ -3,192 +3,322 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - namespace Magento\Customer\Test\Unit\Block\Adminhtml\Edit\Tab; +use Magento\Backend\Block\Template\Context; use Magento\Backend\Model\Session; +use Magento\Customer\Api\AccountManagementInterface; +use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Customer\Api\Data\CustomerInterface; +use Magento\Customer\Block\Adminhtml\Edit\Tab\Newsletter; use Magento\Customer\Controller\RegistryConstants; +use Magento\Customer\Model\Config\Share; +use Magento\Framework\Data\Form; +use Magento\Framework\Data\Form\Element\Checkbox; +use Magento\Framework\Data\Form\Element\Fieldset; +use \Magento\Framework\Data\Form\Element\Select; +use Magento\Framework\Data\FormFactory; +use Magento\Framework\Registry; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Framework\UrlInterface; +use Magento\Newsletter\Model\Subscriber; +use Magento\Newsletter\Model\SubscriberFactory; +use Magento\Store\Model\Store; +use Magento\Store\Model\StoreManagerInterface; +use Magento\Store\Model\System\Store as SystemStore; +use Magento\Store\Model\Website; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; /** + * Test Customer account form block + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class NewsletterTest extends \PHPUnit\Framework\TestCase +class NewsletterTest extends TestCase { /** - * @var \Magento\Customer\Block\Adminhtml\Edit\Tab\Newsletter + * @var Newsletter + */ + private $model; + + /** + * @var Context|MockObject + */ + private $contextMock; + + /** + * Store manager + * + * @var StoreManagerInterface|MockObject + */ + private $storeManager; + + /** + * @var Registry|MockObject */ - protected $model; + private $registryMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var FormFactory|MockObject */ - protected $contextMock; + private $formFactoryMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var SubscriberFactory|MockObject */ - protected $registryMock; + private $subscriberFactoryMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var AccountManagementInterface|MockObject */ - protected $formFactoryMock; + private $accountManagementMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var UrlInterface|MockObject */ - protected $subscriberFactoryMock; + private $urlBuilderMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var Session|MockObject */ - protected $accountManagementMock; + private $backendSessionMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var SystemStore|MockObject */ - protected $urlBuilderMock; + private $systemStore; /** - * @var Session|\PHPUnit_Framework_MockObject_MockObject + * @var CustomerRepositoryInterface|MockObject */ - protected $backendSessionMock; + private $customerRepository; + /** + * @var Share|MockObject + */ + private $shareConfig; + + /** + * @inheritdoc + */ public function setUp() { - $this->contextMock = $this->createMock(\Magento\Backend\Block\Template\Context::class); - $this->registryMock = $this->createMock(\Magento\Framework\Registry::class); - $this->formFactoryMock = $this->createMock(\Magento\Framework\Data\FormFactory::class); + $this->contextMock = $this->createMock(Context::class); + $this->registryMock = $this->createMock(Registry::class); + $this->formFactoryMock = $this->createMock(FormFactory::class); $this->subscriberFactoryMock = $this->createPartialMock( - \Magento\Newsletter\Model\SubscriberFactory::class, + SubscriberFactory::class, ['create'] ); - $this->accountManagementMock = $this->createMock(\Magento\Customer\Api\AccountManagementInterface::class); - $this->urlBuilderMock = $this->createMock(\Magento\Framework\UrlInterface::class); - $this->backendSessionMock = $this->getMockBuilder(\Magento\Backend\Model\Session::class) + $this->accountManagementMock = $this->createMock(AccountManagementInterface::class); + $this->urlBuilderMock = $this->createMock(UrlInterface::class); + $this->storeManager = $this->createMock(StoreManagerInterface::class); + $this->backendSessionMock = $this->getMockBuilder(Session::class) ->setMethods(['getCustomerFormData']) ->disableOriginalConstructor() ->getMock(); - $this->contextMock->expects($this->once())->method('getUrlBuilder')->willReturn($this->urlBuilderMock); - $this->contextMock->expects($this->once())->method('getBackendSession')->willReturn($this->backendSessionMock); - - $this->model = new \Magento\Customer\Block\Adminhtml\Edit\Tab\Newsletter( - $this->contextMock, - $this->registryMock, - $this->formFactoryMock, - $this->subscriberFactoryMock, - $this->accountManagementMock + $this->contextMock->expects($this->once()) + ->method('getUrlBuilder') + ->willReturn($this->urlBuilderMock); + $this->contextMock->expects($this->once()) + ->method('getBackendSession') + ->willReturn($this->backendSessionMock); + $this->contextMock->method('getStoreManager') + ->willReturn($this->storeManager); + $this->systemStore = $this->createMock(SystemStore::class); + $this->customerRepository = $this->createMock(CustomerRepositoryInterface::class); + $this->shareConfig = $this->createMock(Share::class); + + $objectManager = new ObjectManager($this); + $this->model = $objectManager->getObject( + Newsletter::class, + [ + 'context' => $this->contextMock, + 'registry' => $this->registryMock, + 'formFactory' => $this->formFactoryMock, + 'subscriberFactory' => $this->subscriberFactoryMock, + 'customerAccountManagement' => $this->accountManagementMock, + 'systemStore' => $this->systemStore, + 'customerRepository' => $this->customerRepository, + 'shareConfig' => $this->shareConfig, + ] ); } + /** + * Test to initialize the form without current customer + */ public function testInitFormCanNotShowTab() { - $this->registryMock->expects($this->once())->method('registry')->with(RegistryConstants::CURRENT_CUSTOMER_ID) + $this->registryMock->expects($this->once()) + ->method('registry') + ->with(RegistryConstants::CURRENT_CUSTOMER_ID) ->willReturn(false); + $this->assertSame($this->model, $this->model->initForm()); } + /** + * Test to initialize the form + */ public function testInitForm() { $customerId = 1; + $websiteId = 1; + $storeId = 2; + $websiteName = 'Website Name'; + $isSubscribed = true; - $subscriberMock = $this->createMock(\Magento\Newsletter\Model\Subscriber::class); - $fieldsetMock = $this->createMock(\Magento\Framework\Data\Form\Element\Fieldset::class); - $elementMock = $this->createPartialMock(\Magento\Framework\Data\Form\Element\Checkbox::class, ['setIsChecked']); - $formMock = $this->createPartialMock( - \Magento\Framework\Data\Form::class, - ['setHtmlIdPrefix', 'addFieldset', 'setValues', 'getElement', 'setForm', 'setParent', 'setBaseUrl'] - ); - $this->registryMock->expects($this->exactly(3)) - ->method('registry') - ->willReturnMap( - [ - [RegistryConstants::CURRENT_CUSTOMER_ID, $customerId], - ['subscriber', $subscriberMock], - ] - ); - $this->formFactoryMock->expects($this->once())->method('create')->willReturn($formMock); - $formMock->expects($this->once())->method('setHtmlIdPrefix')->with('_newsletter'); + $this->registryMock->method('registry')->with(RegistryConstants::CURRENT_CUSTOMER_ID) + ->willReturn($customerId); + + $customer = $this->createMock(CustomerInterface::class); + $customer->method('getWebsiteId')->willReturn($websiteId); + $customer->method('getStoreId')->willReturn($storeId); + $customer->method('getId')->willReturn($customerId); + $this->customerRepository->method('getById')->with($customerId)->willReturn($customer); + $subscriberMock = $this->createMock(Subscriber::class); + $subscriberMock->method('loadByCustomer')->with($customerId, $websiteId)->willReturnSelf(); + $subscriberMock->method('isSubscribed')->willReturn($isSubscribed); + $subscriberMock->method('getData')->willReturn([]); $this->subscriberFactoryMock->expects($this->once())->method('create')->willReturn($subscriberMock); - $subscriberMock->expects($this->once())->method('loadByCustomerId')->with($customerId)->willReturnSelf(); - $this->registryMock->expects($this->once())->method('register')->with('subscriber', $subscriberMock); - $formMock->expects($this->once())->method('addFieldset')->willReturn($fieldsetMock); - $fieldsetMock->expects($this->once())->method('addField')->willReturn($elementMock); - $this->accountManagementMock->expects($this->once())->method('isReadOnly')->with($customerId) - ->willReturn(false); - $subscriberMock->expects($this->once())->method('isSubscribed')->willReturn(true); - $this->urlBuilderMock->expects($this->once())->method('getBaseUrl')->willReturn('domain.com'); - $this->backendSessionMock->expects($this->once())->method('getCustomerFormData')->willReturn(null); + $website = $this->createMock(Website::class); + $website->method('getStoresCount')->willReturn(1); + $website->method('getId')->willReturn($websiteId); + $store = $this->createMock(Store::class); + $store->method('getWebsiteId')->willReturn($websiteId); + $this->storeManager->method('getStore')->with($storeId)->willReturn($store); + $this->storeManager->method('getWebsites')->willReturn([$website]); + $this->storeManager->method('isSingleStoreMode')->willReturn(true); + $this->systemStore->method('getStoreOptionsTree')->willReturn([]); + $this->systemStore->method('getWebsiteName')->with($websiteId)->willReturn($websiteName); - $formMock->expects($this->once()) - ->method('getElement') - ->willReturnMap( + $statusElementMock = $this->createMock(Checkbox::class); + $statusElementMock->expects($this->once()) + ->method('setIsChecked') + ->with($isSubscribed); + $fieldsetMock = $this->createMock(Fieldset::class); + $fieldsetMock->expects($this->once()) + ->method('addField') + ->with( + 'subscription_status_' . $websiteId, + 'checkbox', [ - ['subscription', $elementMock], + 'label' => __('Subscribed to Newsletter'), + 'name' => "subscription_status[$websiteId]", + 'data-form-part' => null, + 'value' => $isSubscribed, + 'onchange' => 'this.value = this.checked;' ] - ); - - $elementMock->expects($this->once()) - ->method('setIsChecked') - ->with(true); + ) + ->willReturn($statusElementMock); + $fieldsetMock->expects($this->once())->method('setReadonly')->with(true, true); + $formMock = $this->createPartialMock( + Form::class, + ['setHtmlIdPrefix', 'addFieldset', 'setValues', 'getElement', 'setForm', 'setParent', 'setBaseUrl'] + ); + $formMock->expects($this->once())->method('setHtmlIdPrefix')->with('_newsletter'); + $formMock->expects($this->once())->method('addFieldset')->willReturn($fieldsetMock); + $this->formFactoryMock->expects($this->once())->method('create')->willReturn($formMock); + $this->accountManagementMock->expects($this->once()) + ->method('isReadOnly') + ->with($customerId) + ->willReturn(true); + $this->backendSessionMock->expects($this->once()) + ->method('getCustomerFormData') + ->willReturn(null); $this->assertSame($this->model, $this->model->initForm()); } + /** + * Test to initialize the form with session form data + */ public function testInitFormWithCustomerFormData() { $customerId = 1; + $websiteId = 1; + $storeId = 2; + $websiteName = 'Website Name'; + $isSubscribed = true; + $isSubscribedCustomerSession = false; - $subscriberMock = $this->createMock(\Magento\Newsletter\Model\Subscriber::class); - $fieldsetMock = $this->createMock(\Magento\Framework\Data\Form\Element\Fieldset::class); - $elementMock = $this->createPartialMock(\Magento\Framework\Data\Form\Element\Checkbox::class, ['setIsChecked']); + $this->registryMock->method('registry')->with(RegistryConstants::CURRENT_CUSTOMER_ID) + ->willReturn($customerId); + $customer = $this->createMock(CustomerInterface::class); + $customer->method('getWebsiteId')->willReturn($websiteId); + $customer->method('getStoreId')->willReturn($storeId); + $customer->method('getId')->willReturn($customerId); + $this->customerRepository->method('getById')->with($customerId)->willReturn($customer); + $subscriberMock = $this->createMock(Subscriber::class); + $subscriberMock->method('loadByCustomer')->with($customerId, $websiteId)->willReturnSelf(); + $subscriberMock->method('isSubscribed')->willReturn($isSubscribed); + $subscriberMock->method('getData')->willReturn([]); + $this->subscriberFactoryMock->expects($this->once())->method('create')->willReturn($subscriberMock); + $website = $this->createMock(Website::class); + $website->method('getStoresCount')->willReturn(1); + $website->method('getId')->willReturn($websiteId); + $store = $this->createMock(Store::class); + $store->method('getWebsiteId')->willReturn($websiteId); + $this->storeManager->method('getStore')->with($storeId)->willReturn($store); + $this->storeManager->method('getWebsites')->willReturn([$website]); + $this->storeManager->method('isSingleStoreMode')->willReturn(true); + $this->systemStore->method('getStoreOptionsTree')->willReturn([]); + $this->systemStore->method('getWebsiteName')->with($websiteId)->willReturn($websiteName); + $statusElementMock = $this->createMock(Checkbox::class); + $statusElementMock->expects($this->once()) + ->method('setIsChecked') + ->with($isSubscribed); + $fieldsetMock = $this->createMock(Fieldset::class); + $fieldsetMock->expects($this->once()) + ->method('addField') + ->with( + 'subscription_status_' . $websiteId, + 'checkbox', + [ + 'label' => __('Subscribed to Newsletter'), + 'name' => "subscription_status[$websiteId]", + 'data-form-part' => null, + 'value' => $isSubscribed, + 'onchange' => 'this.value = this.checked;' + ] + ) + ->willReturn($statusElementMock); + $fieldsetMock->expects($this->once())->method('setReadonly')->with(true, true); + $statusElementForm = $this->createPartialMock(Checkbox::class, ['setChecked', 'setValue']); + $statusElementForm->method('setValue') + ->with($isSubscribedCustomerSession); + $statusElementForm->method('setChecked') + ->with($isSubscribedCustomerSession); + $storeElementForm = $this->createPartialMock(Select::class, ['setValue']); + $storeElementForm->method('setValue') + ->with(Store::DEFAULT_STORE_ID); $formMock = $this->createPartialMock( - \Magento\Framework\Data\Form::class, + Form::class, ['setHtmlIdPrefix', 'addFieldset', 'setValues', 'getElement', 'setForm', 'setParent', 'setBaseUrl'] ); - $this->registryMock->expects($this->exactly(3)) - ->method('registry') + $formMock->expects($this->once())->method('setHtmlIdPrefix')->with('_newsletter'); + $formMock->expects($this->once())->method('addFieldset')->willReturn($fieldsetMock); + $formMock->method('getElement') ->willReturnMap( [ - [RegistryConstants::CURRENT_CUSTOMER_ID, $customerId], - ['subscriber', $subscriberMock], + ['subscription_status_' . $websiteId, $statusElementForm], + ['subscription_store_' . $websiteId, $storeElementForm], ] ); $this->formFactoryMock->expects($this->once())->method('create')->willReturn($formMock); - $formMock->expects($this->once())->method('setHtmlIdPrefix')->with('_newsletter'); - $this->subscriberFactoryMock->expects($this->once())->method('create')->willReturn($subscriberMock); - $subscriberMock->expects($this->once())->method('loadByCustomerId')->with($customerId)->willReturnSelf(); - $formMock->expects($this->once())->method('addFieldset')->willReturn($fieldsetMock); - $fieldsetMock->expects($this->once())->method('addField')->willReturn($elementMock); - $this->accountManagementMock->expects($this->once())->method('isReadOnly')->with($customerId) - ->willReturn(false); - $subscriberMock->expects($this->once())->method('isSubscribed')->willReturn(false); - $this->urlBuilderMock->expects($this->once())->method('getBaseUrl')->willReturn('domain.com'); - + $this->accountManagementMock->expects($this->once()) + ->method('isReadOnly') + ->with($customerId) + ->willReturn(true); $this->backendSessionMock->expects($this->once()) ->method('getCustomerFormData') - ->willReturn([ - 'customer' => [ - 'entity_id' => $customerId, - ], - 'subscription' => true, - ]); - - $formMock->expects($this->exactly(2)) - ->method('getElement') - ->willReturnMap( - [ - ['subscription', $elementMock], - ] - ); - - $elementMock->expects($this->exactly(2)) - ->method('setIsChecked') - ->willReturnMap( + ->willReturn( [ - [false], - [true], + 'customer' => ['entity_id' => $customerId], + 'subscription_status' => [$websiteId => $isSubscribedCustomerSession] ] ); diff --git a/app/code/Magento/Customer/Test/Unit/Block/Adminhtml/From/Element/Newsletter/SubscriptionsTest.php b/app/code/Magento/Customer/Test/Unit/Block/Adminhtml/From/Element/Newsletter/SubscriptionsTest.php new file mode 100644 index 0000000000000..f6d6777654c5b --- /dev/null +++ b/app/code/Magento/Customer/Test/Unit/Block/Adminhtml/From/Element/Newsletter/SubscriptionsTest.php @@ -0,0 +1,185 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Customer\Test\Unit\Block\Adminhtml\From\Element\Newsletter; + +use Magento\Customer\Block\Adminhtml\Form\Element\Newsletter\Subscriptions; +use Magento\Framework\App\Request\DataPersistorInterface; +use Magento\Framework\Data\Form\Element\AbstractElement; +use Magento\Framework\Data\Form\Element\CollectionFactory; +use Magento\Framework\Data\Form\Element\Factory; +use Magento\Framework\Escaper; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +/** + * Test class for Customer Newsletter Subscriptions Element + */ +class SubscriptionsTest extends TestCase +{ + /** + * @var Factory|MockObject + */ + private $factoryElement; + + /** + * @var CollectionFactory|MockObject + */ + private $factoryCollection; + + /** + * @var Escaper|MockObject + */ + private $escaper; + + /** + * @var DataPersistorInterface|MockObject + */ + private $dataPersistor; + + /** + * @var Subscriptions + */ + private $element; + + /** + * @inheritdoc + */ + public function setUp() + { + $this->factoryElement = $this->createMock(Factory::class); + $this->factoryCollection = $this->createMock(CollectionFactory::class); + $this->escaper = $this->createMock(Escaper::class); + $this->dataPersistor = $this->createMock(DataPersistorInterface::class); + + $objectManager = new ObjectManager($this); + $this->element = $objectManager->getObject( + Subscriptions::class, + [ + 'factoryElement' => $this->factoryElement, + 'factoryCollection' => $this->factoryCollection, + 'escaper' => $this->escaper, + 'dataPersistor' => $this->dataPersistor, + 'data' => [] + ] + ); + } + + /** + * Test to Get the Html for the element + * + * @param array $data + * @param array $elementsHtml + * @param string $expectedHtml + * @return void + * @dataProvider getElementHtmlDataProvider + */ + public function testGetElementHtml(array $data, array $elementsHtml, string $expectedHtml): void + { + $this->escaper->method('escapeHtml')->withAnyParameters()->willReturnArgument(0); + $selectElementId = $data['name'] . '_store_' . $data['subscriptions'][0]['website_id']; + $selectElement = $this->createMock(AbstractElement::class); + $selectElement->expects($this->once())->method('setId')->with($selectElementId); + $selectElement->expects($this->once())->method('setForm')->willReturnSelf(); + $selectElement->method('toHtml')->willReturn($elementsHtml['store']); + $statusElementId = $data['name'] . '_status_' . $data['subscriptions'][0]['website_id']; + $statusElement = $this->createMock(AbstractElement::class); + $statusElement->expects($this->once())->method('setId')->with($statusElementId); + $statusElement->expects($this->once())->method('setForm')->willReturnSelf(); + $statusElement->method('toHtml')->willReturn($elementsHtml['status']); + $this->factoryElement->method('create')->willReturnMap( + [ + [ + 'select', + [ + 'data' => [ + 'name' => "{$data['name']}_store[{$data['subscriptions'][0]['website_id']}]", + 'data-form-part' => $data['target_form'], + 'values' => $data['subscriptions'][0]['store_options'], + 'value' => $data['subscriptions'][0]['store_id'], + 'required' => true, + ] + ], + $selectElement + ], + [ + 'checkbox', + [ + 'data' => [ + 'name' => "{$data['name']}_status[{$data['subscriptions'][0]['website_id']}]", + 'data-form-part' => $data['target_form'], + 'value' => $data['subscriptions'][0]['status'], + 'onchange' => 'this.value = this.checked;', + ] + ], + $statusElement + ] + ] + ); + $this->dataPersistor->method('get')->willReturn([]); + $this->element->setData($data); + + $this->assertEquals($expectedHtml, $this->element->getElementHtml()); + } + + /** + * Data provider for test to get the html + * + * @return array + */ + public function getElementHtmlDataProvider(): array + { + $customerId = 33; + $elementName = 'element_name'; + $targetForm = 'target_form'; + $websiteId = 1; + $websiteName = 'Website 1'; + $storeId = 2; + $status = true; + $storeOptions = ['array_of_store_options']; + $lastUpdated = 'last updated'; + $storeElementHtml = 'storeElementHtml'; + $statusElementHtml = 'statusElementHtml'; + $outputHtmlTemplate = "<table class=\"admin__table-secondary\">" + . "<tr><th>%s</th><th class=\"subscriber-status\">%s</th><th>%s</th><th>%s</th></tr>" + . "<tr><td>%s</td><td class=\"subscriber-status\">%s</td><td>%s</td><td>%s</td></tr></table>"; + + return [ + [ + 'data' => [ + 'customer_id' => $customerId, + 'name' => $elementName, + 'target_form' => $targetForm, + 'subscriptions' => [ + [ + 'store_id' => $storeId, + 'website_id' => $websiteId, + 'website_name' => $websiteName, + 'status' => $status, + 'store_options' => $storeOptions, + 'last_updated' => $lastUpdated, + ], + ], + ], + 'elementsHtml' => [ + 'status' => $statusElementHtml, + 'store' => $storeElementHtml, + ], + 'expectedHtml' => sprintf( + $outputHtmlTemplate, + 'Website', + 'Subscribed', + 'Store View', + 'Last Updated At', + $websiteName, + $statusElementHtml, + $storeElementHtml, + $lastUpdated + ) + ], + ]; + } +} diff --git a/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/MassSubscribeTest.php b/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/MassSubscribeTest.php index 33e578224400b..8f672fbfb4da6 100644 --- a/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/MassSubscribeTest.php +++ b/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/MassSubscribeTest.php @@ -6,119 +6,130 @@ namespace Magento\Customer\Test\Unit\Controller\Adminhtml\Index; +use Magento\Backend\Model\View\Result\Redirect; +use Magento\Backend\Model\View\Result\RedirectFactory; +use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Customer\Api\Data\CustomerInterface; +use Magento\Customer\Controller\Adminhtml\Index\MassSubscribe; +use Magento\Customer\Model\ResourceModel\Customer\Collection; +use Magento\Customer\Model\ResourceModel\Customer\CollectionFactory; use Magento\Framework\App\Action\Context; +use Magento\Framework\App\Request\Http; +use Magento\Framework\App\ResponseInterface; +use Magento\Framework\Controller\ResultFactory; +use Magento\Framework\Message\Manager; +use Magento\Framework\ObjectManager\ObjectManager; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\Newsletter\Model\SubscriptionManagerInterface; +use Magento\Ui\Component\MassAction\Filter; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; /** * Class MassSubscribeTest * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class MassSubscribeTest extends \PHPUnit\Framework\TestCase +class MassSubscribeTest extends TestCase { /** - * @var \Magento\Customer\Controller\Adminhtml\Index\MassSubscribe + * @var MassSubscribe */ protected $massAction; /** - * @var Context|\PHPUnit_Framework_MockObject_MockObject + * @var Context|MockObject */ protected $contextMock; /** - * @var \Magento\Backend\Model\View\Result\Redirect|\PHPUnit_Framework_MockObject_MockObject + * @var Redirect|MockObject */ protected $resultRedirectMock; /** - * @var \Magento\Framework\App\Request\Http|\PHPUnit_Framework_MockObject_MockObject + * @var Http|MockObject */ protected $requestMock; /** - * @var \Magento\Framework\App\ResponseInterface|\PHPUnit_Framework_MockObject_MockObject + * @var ResponseInterface|MockObject */ protected $responseMock; /** - * @var \Magento\Framework\Message\Manager|\PHPUnit_Framework_MockObject_MockObject + * @var Manager|MockObject */ protected $messageManagerMock; /** - * @var \Magento\Framework\ObjectManager\ObjectManager|\PHPUnit_Framework_MockObject_MockObject + * @var ObjectManager|MockObject */ protected $objectManagerMock; /** - * @var \Magento\Customer\Model\ResourceModel\Customer\Collection|\PHPUnit_Framework_MockObject_MockObject + * @var Collection|MockObject */ protected $customerCollectionMock; /** - * @var \Magento\Customer\Model\ResourceModel\Customer\CollectionFactory|\PHPUnit_Framework_MockObject_MockObject + * @var CollectionFactory|MockObject */ protected $customerCollectionFactoryMock; /** - * @var \Magento\Ui\Component\MassAction\Filter|\PHPUnit_Framework_MockObject_MockObject + * @var Filter|MockObject */ protected $filterMock; /** - * @var \Magento\Customer\Api\CustomerRepositoryInterface|\PHPUnit_Framework_MockObject_MockObject + * @var CustomerRepositoryInterface|MockObject */ protected $customerRepositoryMock; /** - * @var \Magento\Newsletter\Model\Subscriber|\PHPUnit_Framework_MockObject_MockObject + * @var SubscriptionManagerInterface|MockObject */ - protected $subscriberMock; + private $subscriptionManager; + /** + * @inheritdoc + */ protected function setUp() { $objectManagerHelper = new ObjectManagerHelper($this); $this->contextMock = $this->createMock(\Magento\Backend\App\Action\Context::class); - $resultRedirectFactory = $this->createMock(\Magento\Backend\Model\View\Result\RedirectFactory::class); - $this->responseMock = $this->createMock(\Magento\Framework\App\ResponseInterface::class); - $this->requestMock = $this->getMockBuilder(\Magento\Framework\App\Request\Http::class) + $resultRedirectFactory = $this->createMock(RedirectFactory::class); + $this->responseMock = $this->createMock(ResponseInterface::class); + $this->requestMock = $this->getMockBuilder(Http::class) ->disableOriginalConstructor()->getMock(); $this->objectManagerMock = $this->createPartialMock( - \Magento\Framework\ObjectManager\ObjectManager::class, + ObjectManager::class, ['create'] ); - $this->messageManagerMock = $this->createMock(\Magento\Framework\Message\Manager::class); + $this->messageManagerMock = $this->createMock(Manager::class); $this->customerCollectionMock = - $this->getMockBuilder(\Magento\Customer\Model\ResourceModel\Customer\Collection::class) + $this->getMockBuilder(Collection::class) ->disableOriginalConstructor() ->getMock(); $this->customerCollectionFactoryMock = - $this->getMockBuilder(\Magento\Customer\Model\ResourceModel\Customer\CollectionFactory::class) + $this->getMockBuilder(CollectionFactory::class) ->disableOriginalConstructor() ->setMethods(['create']) ->getMock(); - $redirectMock = $this->getMockBuilder(\Magento\Backend\Model\View\Result\Redirect::class) + $redirectMock = $this->getMockBuilder(Redirect::class) ->disableOriginalConstructor() ->getMock(); - $resultFactoryMock = $this->getMockBuilder(\Magento\Framework\Controller\ResultFactory::class) + $resultFactoryMock = $this->getMockBuilder(ResultFactory::class) ->disableOriginalConstructor() ->getMock(); $resultFactoryMock->expects($this->any()) ->method('create') - ->with(\Magento\Framework\Controller\ResultFactory::TYPE_REDIRECT) + ->with(ResultFactory::TYPE_REDIRECT) ->willReturn($redirectMock); - $this->subscriberMock = $this->createMock(\Magento\Newsletter\Model\Subscriber::class); - $subscriberFactoryMock = $this->getMockBuilder(\Magento\Newsletter\Model\SubscriberFactory::class) - ->setMethods(['create']) - ->disableOriginalConstructor() - ->getMock(); - $subscriberFactoryMock->expects($this->any()) - ->method('create') - ->willReturn($this->subscriberMock); - - $this->resultRedirectMock = $this->createMock(\Magento\Backend\Model\View\Result\Redirect::class); + $this->subscriptionManager = $this->createMock(SubscriptionManagerInterface::class); + $this->resultRedirectMock = $this->createMock(Redirect::class); $resultRedirectFactory->expects($this->any())->method('create')->willReturn($this->resultRedirectMock); $this->contextMock->expects($this->once())->method('getMessageManager')->willReturn($this->messageManagerMock); @@ -132,7 +143,7 @@ protected function setUp() ->method('getResultFactory') ->willReturn($resultFactoryMock); - $this->filterMock = $this->createMock(\Magento\Ui\Component\MassAction\Filter::class); + $this->filterMock = $this->createMock(Filter::class); $this->filterMock->expects($this->once()) ->method('getCollection') ->with($this->customerCollectionMock) @@ -140,35 +151,37 @@ protected function setUp() $this->customerCollectionFactoryMock->expects($this->once()) ->method('create') ->willReturn($this->customerCollectionMock); - $this->customerRepositoryMock = $this->getMockBuilder(\Magento\Customer\Api\CustomerRepositoryInterface::class) + $this->customerRepositoryMock = $this->getMockBuilder(CustomerRepositoryInterface::class) ->getMockForAbstractClass(); $this->massAction = $objectManagerHelper->getObject( - \Magento\Customer\Controller\Adminhtml\Index\MassSubscribe::class, + MassSubscribe::class, [ 'context' => $this->contextMock, 'filter' => $this->filterMock, 'collectionFactory' => $this->customerCollectionFactoryMock, 'customerRepository' => $this->customerRepositoryMock, - 'subscriberFactory' => $subscriberFactoryMock, + 'subscriptionManager' => $this->subscriptionManager, ] ); } + /** + * Test to mass subscribe customers to newsletters + */ public function testExecute() { - $customersIds = [10, 11, 12]; - - $this->customerCollectionMock->expects($this->any()) - ->method('getAllIds') - ->willReturn($customersIds); - - $this->customerRepositoryMock->expects($this->any()) - ->method('getById') - ->willReturnMap([[10, true], [11, true], [12, true]]); - - $this->subscriberMock->expects($this->any()) - ->method('subscribeCustomerById') - ->willReturnMap([[10, true], [11, true], [12, true]]); + $storeId = 2; + $customerId = 10; + $customersIds = [$customerId, $customerId, $customerId]; + + $this->customerCollectionMock->method('getAllIds')->willReturn($customersIds); + $customer = $this->createMock(CustomerInterface::class); + $customer->method('getStoreId')->willReturn($storeId); + $customer->method('getId')->willReturn($customerId); + $this->customerRepositoryMock->method('getById')->with($customerId)->willReturn($customer); + $this->subscriptionManager->expects($this->exactly(3)) + ->method('subscribeCustomer') + ->with($customerId, $storeId); $this->messageManagerMock->expects($this->once()) ->method('addSuccessMessage') @@ -182,6 +195,9 @@ public function testExecute() $this->massAction->execute(); } + /** + * Test to mass subscribe customers to newsletters with throws exception + */ public function testExecuteWithException() { $customersIds = [10, 11, 12]; diff --git a/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/MassUnsubscribeTest.php b/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/MassUnsubscribeTest.php index 971efc0e490bc..303a11989236f 100644 --- a/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/MassUnsubscribeTest.php +++ b/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/MassUnsubscribeTest.php @@ -6,119 +6,130 @@ namespace Magento\Customer\Test\Unit\Controller\Adminhtml\Index; +use Magento\Backend\Model\View\Result\Redirect; +use Magento\Backend\Model\View\Result\RedirectFactory; +use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Customer\Api\Data\CustomerInterface; +use Magento\Customer\Controller\Adminhtml\Index\MassUnsubscribe; +use Magento\Customer\Model\ResourceModel\Customer\Collection; +use Magento\Customer\Model\ResourceModel\Customer\CollectionFactory; use Magento\Framework\App\Action\Context; +use Magento\Framework\App\Request\Http; +use Magento\Framework\App\ResponseInterface; +use Magento\Framework\Controller\ResultFactory; +use Magento\Framework\Message\Manager; +use Magento\Framework\ObjectManager\ObjectManager; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\Newsletter\Model\SubscriptionManagerInterface; +use Magento\Ui\Component\MassAction\Filter; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; /** * Class MassUnsubscribeTest * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class MassUnsubscribeTest extends \PHPUnit\Framework\TestCase +class MassUnsubscribeTest extends TestCase { /** - * @var \Magento\Customer\Controller\Adminhtml\Index\MassUnsubscribe + * @var MassUnsubscribe */ protected $massAction; /** - * @var Context|\PHPUnit_Framework_MockObject_MockObject + * @var Context|MockObject */ protected $contextMock; /** - * @var \Magento\Backend\Model\View\Result\Redirect|\PHPUnit_Framework_MockObject_MockObject + * @var Redirect|MockObject */ protected $resultRedirectMock; /** - * @var \Magento\Framework\App\Request\Http|\PHPUnit_Framework_MockObject_MockObject + * @var Http|MockObject */ protected $requestMock; /** - * @var \Magento\Framework\App\ResponseInterface|\PHPUnit_Framework_MockObject_MockObject + * @var ResponseInterface|MockObject */ protected $responseMock; /** - * @var \Magento\Framework\Message\Manager|\PHPUnit_Framework_MockObject_MockObject + * @var Manager|MockObject */ protected $messageManagerMock; /** - * @var \Magento\Framework\ObjectManager\ObjectManager|\PHPUnit_Framework_MockObject_MockObject + * @var ObjectManager|MockObject */ protected $objectManagerMock; /** - * @var \Magento\Customer\Model\ResourceModel\Customer\Collection|\PHPUnit_Framework_MockObject_MockObject + * @var Collection|MockObject */ protected $customerCollectionMock; /** - * @var \Magento\Customer\Model\ResourceModel\Customer\CollectionFactory|\PHPUnit_Framework_MockObject_MockObject + * @var CollectionFactory|MockObject */ protected $customerCollectionFactoryMock; /** - * @var \Magento\Ui\Component\MassAction\Filter|\PHPUnit_Framework_MockObject_MockObject + * @var Filter|MockObject */ protected $filterMock; /** - * @var \Magento\Customer\Api\CustomerRepositoryInterface|\PHPUnit_Framework_MockObject_MockObject + * @var CustomerRepositoryInterface|MockObject */ protected $customerRepositoryMock; /** - * @var \Magento\Newsletter\Model\Subscriber|\PHPUnit_Framework_MockObject_MockObject + * @var SubscriptionManagerInterface|MockObject */ - protected $subscriberMock; + private $subscriptionManager; + /** + * @inheritdoc + */ protected function setUp() { $objectManagerHelper = new ObjectManagerHelper($this); $this->contextMock = $this->createMock(\Magento\Backend\App\Action\Context::class); - $resultRedirectFactory = $this->createMock(\Magento\Backend\Model\View\Result\RedirectFactory::class); - $this->responseMock = $this->createMock(\Magento\Framework\App\ResponseInterface::class); - $this->requestMock = $this->getMockBuilder(\Magento\Framework\App\Request\Http::class) + $resultRedirectFactory = $this->createMock(RedirectFactory::class); + $this->responseMock = $this->createMock(ResponseInterface::class); + $this->requestMock = $this->getMockBuilder(Http::class) ->disableOriginalConstructor()->getMock(); $this->objectManagerMock = $this->createPartialMock( - \Magento\Framework\ObjectManager\ObjectManager::class, + ObjectManager::class, ['create'] ); - $this->messageManagerMock = $this->createMock(\Magento\Framework\Message\Manager::class); + $this->messageManagerMock = $this->createMock(Manager::class); $this->customerCollectionMock = - $this->getMockBuilder(\Magento\Customer\Model\ResourceModel\Customer\Collection::class) + $this->getMockBuilder(Collection::class) ->disableOriginalConstructor() ->getMock(); $this->customerCollectionFactoryMock = - $this->getMockBuilder(\Magento\Customer\Model\ResourceModel\Customer\CollectionFactory::class) + $this->getMockBuilder(CollectionFactory::class) ->disableOriginalConstructor() ->setMethods(['create']) ->getMock(); - $redirectMock = $this->getMockBuilder(\Magento\Backend\Model\View\Result\Redirect::class) + $redirectMock = $this->getMockBuilder(Redirect::class) ->disableOriginalConstructor() ->getMock(); - $resultFactoryMock = $this->getMockBuilder(\Magento\Framework\Controller\ResultFactory::class) + $resultFactoryMock = $this->getMockBuilder(ResultFactory::class) ->disableOriginalConstructor() ->getMock(); $resultFactoryMock->expects($this->any()) ->method('create') - ->with(\Magento\Framework\Controller\ResultFactory::TYPE_REDIRECT) + ->with(ResultFactory::TYPE_REDIRECT) ->willReturn($redirectMock); - $this->subscriberMock = $this->createMock(\Magento\Newsletter\Model\Subscriber::class); - $subscriberFactoryMock = $this->getMockBuilder(\Magento\Newsletter\Model\SubscriberFactory::class) - ->setMethods(['create']) - ->disableOriginalConstructor() - ->getMock(); - $subscriberFactoryMock->expects($this->any()) - ->method('create') - ->willReturn($this->subscriberMock); - - $this->resultRedirectMock = $this->createMock(\Magento\Backend\Model\View\Result\Redirect::class); + $this->subscriptionManager = $this->createMock(SubscriptionManagerInterface::class); + $this->resultRedirectMock = $this->createMock(Redirect::class); $resultRedirectFactory->expects($this->any())->method('create')->willReturn($this->resultRedirectMock); $this->contextMock->expects($this->once())->method('getMessageManager')->willReturn($this->messageManagerMock); @@ -132,7 +143,7 @@ protected function setUp() ->method('getResultFactory') ->willReturn($resultFactoryMock); - $this->filterMock = $this->createMock(\Magento\Ui\Component\MassAction\Filter::class); + $this->filterMock = $this->createMock(Filter::class); $this->filterMock->expects($this->once()) ->method('getCollection') ->with($this->customerCollectionMock) @@ -140,35 +151,37 @@ protected function setUp() $this->customerCollectionFactoryMock->expects($this->once()) ->method('create') ->willReturn($this->customerCollectionMock); - $this->customerRepositoryMock = $this->getMockBuilder(\Magento\Customer\Api\CustomerRepositoryInterface::class) + $this->customerRepositoryMock = $this->getMockBuilder(CustomerRepositoryInterface::class) ->getMockForAbstractClass(); $this->massAction = $objectManagerHelper->getObject( - \Magento\Customer\Controller\Adminhtml\Index\MassUnsubscribe::class, + MassUnsubscribe::class, [ 'context' => $this->contextMock, 'filter' => $this->filterMock, 'collectionFactory' => $this->customerCollectionFactoryMock, 'customerRepository' => $this->customerRepositoryMock, - 'subscriberFactory' => $subscriberFactoryMock, + 'subscriptionManager' => $this->subscriptionManager, ] ); } + /** + * Test to mass unsubscribe customers from newsletters + */ public function testExecute() { - $customersIds = [10, 11, 12]; - - $this->customerCollectionMock->expects($this->any()) - ->method('getAllIds') - ->willReturn($customersIds); - - $this->customerRepositoryMock->expects($this->any()) - ->method('getById') - ->willReturnMap([[10, true], [11, true], [12, true]]); - - $this->subscriberMock->expects($this->any()) - ->method('unsubscribeCustomerById') - ->willReturnMap([[10, true], [11, true], [12, true]]); + $storeId = 2; + $customerId = 10; + $customersIds = [$customerId, $customerId, $customerId]; + + $this->customerCollectionMock->method('getAllIds')->willReturn($customersIds); + $customer = $this->createMock(CustomerInterface::class); + $customer->method('getStoreId')->willReturn($storeId); + $customer->method('getId')->willReturn($customerId); + $this->customerRepositoryMock->method('getById')->with($customerId)->willReturn($customer); + $this->subscriptionManager->expects($this->exactly(3)) + ->method('unsubscribeCustomer') + ->with($customerId, $storeId); $this->messageManagerMock->expects($this->once()) ->method('addSuccessMessage') @@ -182,6 +195,9 @@ public function testExecute() $this->massAction->execute(); } + /** + * Test to mass unsubscribe customers to newsletters with throws exception + */ public function testExecuteWithException() { $customersIds = [10, 11, 12]; diff --git a/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/SaveTest.php b/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/SaveTest.php index 9724ac13dde8c..2e729873961c0 100644 --- a/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/SaveTest.php +++ b/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/SaveTest.php @@ -5,13 +5,45 @@ */ namespace Magento\Customer\Test\Unit\Controller\Adminhtml\Index; +use Magento\Backend\App\Action\Context; +use Magento\Backend\Model\Session; +use Magento\Backend\Model\View\Result\Forward; +use Magento\Backend\Model\View\Result\ForwardFactory; +use Magento\Backend\Model\View\Result\RedirectFactory; +use Magento\Customer\Api\AddressRepositoryInterface; use Magento\Customer\Api\CustomerMetadataInterface; +use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Customer\Api\Data\AddressInterfaceFactory; use Magento\Customer\Api\Data\AttributeMetadataInterface; use Magento\Customer\Api\Data\CustomerInterface; +use Magento\Customer\Api\Data\CustomerInterfaceFactory; +use Magento\Customer\Controller\Adminhtml\Index\Save; use Magento\Customer\Controller\RegistryConstants; +use Magento\Customer\Model\AccountManagement; +use Magento\Customer\Model\Address\Mapper; use Magento\Customer\Model\EmailNotificationInterface; use Magento\Customer\Model\Metadata\Form; +use Magento\Customer\Model\Metadata\FormFactory; +use Magento\Framework\Api\DataObjectHelper; +use Magento\Framework\App\Request\Http; +use Magento\Framework\App\RequestInterface; +use Magento\Framework\AuthorizationInterface; use Magento\Framework\Controller\Result\Redirect; +use Magento\Framework\DataObject; +use Magento\Framework\DataObjectFactory; +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Message\Error; +use Magento\Framework\Message\ManagerInterface; +use Magento\Framework\Registry; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Framework\View\Page\Config; +use Magento\Framework\View\Page\Title; +use Magento\Framework\View\Result\Page; +use Magento\Framework\View\Result\PageFactory; +use Magento\Newsletter\Model\SubscriberFactory; +use Magento\Newsletter\Model\SubscriptionManagerInterface; +use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\MockObject\MockObject; /** * Testing Save Customer use case from admin page @@ -20,220 +52,226 @@ * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @covers \Magento\Customer\Controller\Adminhtml\Index\Save */ -class SaveTest extends \PHPUnit\Framework\TestCase +class SaveTest extends TestCase { /** - * @var \Magento\Customer\Controller\Adminhtml\Index\Save + * @var Save */ protected $model; /** - * @var \Magento\Backend\App\Action\Context + * @var Context */ protected $context; /** - * @var \Magento\Framework\App\RequestInterface|\PHPUnit_Framework_MockObject_MockObject + * @var RequestInterface|MockObject */ protected $requestMock; /** - * @var \Magento\Backend\Model\View\Result\ForwardFactory|\PHPUnit_Framework_MockObject_MockObject + * @var ForwardFactory|MockObject */ protected $resultForwardFactoryMock; /** - * @var \Magento\Backend\Model\View\Result\Forward|\PHPUnit_Framework_MockObject_MockObject + * @var Forward|MockObject */ protected $resultForwardMock; /** - * @var \Magento\Framework\View\Result\PageFactory|\PHPUnit_Framework_MockObject_MockObject + * @var PageFactory|MockObject */ protected $resultPageFactoryMock; /** - * @var \Magento\Framework\View\Result\Page|\PHPUnit_Framework_MockObject_MockObject + * @var Page|MockObject */ protected $resultPageMock; /** - * @var \Magento\Framework\View\Page\Config|\PHPUnit_Framework_MockObject_MockObject + * @var Config|MockObject */ protected $pageConfigMock; /** - * @var \Magento\Framework\View\Page\Title|\PHPUnit_Framework_MockObject_MockObject + * @var Title|MockObject */ protected $pageTitleMock; /** - * @var \Magento\Backend\Model\Session|\PHPUnit_Framework_MockObject_MockObject + * @var Session|MockObject */ protected $sessionMock; /** - * @var \Magento\Customer\Model\Metadata\FormFactory|\PHPUnit_Framework_MockObject_MockObject + * @var FormFactory|MockObject */ protected $formFactoryMock; /** - * @var \Magento\Framework\DataObjectFactory|\PHPUnit_Framework_MockObject_MockObject + * @var DataObjectFactory|MockObject */ protected $objectFactoryMock; /** - * @var \Magento\Customer\Api\Data\CustomerInterfaceFactory|\PHPUnit_Framework_MockObject_MockObject + * @var CustomerInterfaceFactory|MockObject */ protected $customerDataFactoryMock; /** - * @var \Magento\Customer\Api\CustomerRepositoryInterface|\PHPUnit_Framework_MockObject_MockObject + * @var CustomerRepositoryInterface|MockObject */ protected $customerRepositoryMock; /** - * @var \Magento\Customer\Model\Customer\Mapper|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Customer\Model\Customer\Mapper|MockObject */ protected $customerMapperMock; /** - * @var \Magento\Framework\Api\DataObjectHelper|\PHPUnit_Framework_MockObject_MockObject + * @var DataObjectHelper|MockObject */ protected $dataHelperMock; /** - * @var \Magento\Framework\AuthorizationInterface|\PHPUnit_Framework_MockObject_MockObject + * @var AuthorizationInterface|MockObject */ protected $authorizationMock; /** - * @var \Magento\Newsletter\Model\SubscriberFactory|\PHPUnit_Framework_MockObject_MockObject + * @var SubscriberFactory|MockObject */ protected $subscriberFactoryMock; /** - * @var \Magento\Framework\Registry|\PHPUnit_Framework_MockObject_MockObject + * @var Registry|MockObject */ protected $registryMock; /** - * @var \Magento\Framework\Message\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject + * @var ManagerInterface|MockObject */ protected $messageManagerMock; /** - * @var \Magento\Backend\Model\View\Result\RedirectFactory|\PHPUnit_Framework_MockObject_MockObject + * @var RedirectFactory|MockObject */ protected $redirectFactoryMock; /** - * @var \Magento\Customer\Model\AccountManagement|\PHPUnit_Framework_MockObject_MockObject + * @var AccountManagement|MockObject */ protected $managementMock; /** - * @var \Magento\Customer\Api\Data\AddressInterfaceFactory|\PHPUnit_Framework_MockObject_MockObject + * @var AddressInterfaceFactory|MockObject */ protected $addressDataFactoryMock; /** - * @var EmailNotificationInterface|\PHPUnit_Framework_MockObject_MockObject + * @var EmailNotificationInterface|MockObject */ protected $emailNotificationMock; /** - * @var \Magento\Customer\Model\Address\Mapper|\PHPUnit_Framework_MockObject_MockObject + * @var Mapper|MockObject */ protected $customerAddressMapperMock; /** - * @var \Magento\Customer\Api\AddressRepositoryInterface|\PHPUnit_Framework_MockObject_MockObject + * @var AddressRepositoryInterface|MockObject */ protected $customerAddressRepositoryMock; + /** + * @var SubscriptionManagerInterface|MockObject + */ + private $subscriptionManager; + /** * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ protected function setUp() { - $this->requestMock = $this->getMockBuilder(\Magento\Framework\App\Request\Http::class) + $this->requestMock = $this->getMockBuilder(Http::class) ->disableOriginalConstructor() ->getMock(); $this->resultForwardFactoryMock = $this->getMockBuilder( - \Magento\Backend\Model\View\Result\ForwardFactory::class + ForwardFactory::class )->disableOriginalConstructor() ->setMethods(['create']) ->getMock(); - $this->resultForwardMock = $this->getMockBuilder(\Magento\Backend\Model\View\Result\Forward::class) + $this->resultForwardMock = $this->getMockBuilder(Forward::class) ->disableOriginalConstructor() ->getMock(); - $this->resultPageFactoryMock = $this->getMockBuilder(\Magento\Framework\View\Result\PageFactory::class) + $this->resultPageFactoryMock = $this->getMockBuilder(PageFactory::class) ->disableOriginalConstructor() ->getMock(); - $this->resultPageMock = $this->getMockBuilder(\Magento\Framework\View\Result\Page::class) + $this->resultPageMock = $this->getMockBuilder(Page::class) ->disableOriginalConstructor() ->setMethods(['setActiveMenu', 'getConfig', 'addBreadcrumb']) ->getMock(); - $this->pageConfigMock = $this->getMockBuilder(\Magento\Framework\View\Page\Config::class) + $this->pageConfigMock = $this->getMockBuilder(Config::class) ->disableOriginalConstructor() ->getMock(); - $this->pageTitleMock = $this->getMockBuilder(\Magento\Framework\View\Page\Title::class) + $this->pageTitleMock = $this->getMockBuilder(Title::class) ->disableOriginalConstructor() ->getMock(); - $this->sessionMock = $this->getMockBuilder(\Magento\Backend\Model\Session::class) + $this->sessionMock = $this->getMockBuilder(Session::class) ->disableOriginalConstructor() ->setMethods(['unsCustomerFormData', 'setCustomerFormData']) ->getMock(); - $this->formFactoryMock = $this->getMockBuilder(\Magento\Customer\Model\Metadata\FormFactory::class) + $this->formFactoryMock = $this->getMockBuilder(FormFactory::class) ->disableOriginalConstructor() ->getMock(); - $this->objectFactoryMock = $this->getMockBuilder(\Magento\Framework\DataObjectFactory::class) + $this->objectFactoryMock = $this->getMockBuilder(DataObjectFactory::class) ->disableOriginalConstructor() ->setMethods(['create']) ->getMock(); $this->customerDataFactoryMock = $this->getMockBuilder( - \Magento\Customer\Api\Data\CustomerInterfaceFactory::class + CustomerInterfaceFactory::class )->disableOriginalConstructor() ->setMethods(['create']) ->getMock(); - $this->customerRepositoryMock = $this->getMockBuilder(\Magento\Customer\Api\CustomerRepositoryInterface::class) + $this->customerRepositoryMock = $this->getMockBuilder(CustomerRepositoryInterface::class) ->disableOriginalConstructor() ->getMock(); $this->customerAddressRepositoryMock = $this->getMockBuilder( - \Magento\Customer\Api\AddressRepositoryInterface::class + AddressRepositoryInterface::class )->disableOriginalConstructor()->getMock(); $this->customerMapperMock = $this->getMockBuilder( \Magento\Customer\Model\Customer\Mapper::class )->disableOriginalConstructor()->getMock(); $this->customerAddressMapperMock = $this->getMockBuilder( - \Magento\Customer\Model\Address\Mapper::class + Mapper::class )->disableOriginalConstructor()->getMock(); $this->dataHelperMock = $this->getMockBuilder( - \Magento\Framework\Api\DataObjectHelper::class + DataObjectHelper::class )->disableOriginalConstructor()->getMock(); - $this->authorizationMock = $this->getMockBuilder(\Magento\Framework\AuthorizationInterface::class) + $this->authorizationMock = $this->getMockBuilder(AuthorizationInterface::class) ->disableOriginalConstructor() ->getMock(); - $this->subscriberFactoryMock = $this->getMockBuilder(\Magento\Newsletter\Model\SubscriberFactory::class) + $this->subscriberFactoryMock = $this->getMockBuilder(SubscriberFactory::class) ->disableOriginalConstructor() ->setMethods(['create']) ->getMock(); - $this->registryMock = $this->getMockBuilder(\Magento\Framework\Registry::class) + $this->subscriptionManager = $this->createMock(SubscriptionManagerInterface::class); + $this->registryMock = $this->getMockBuilder(Registry::class) ->disableOriginalConstructor() ->getMock(); - $this->messageManagerMock = $this->getMockBuilder(\Magento\Framework\Message\ManagerInterface::class) + $this->messageManagerMock = $this->getMockBuilder(ManagerInterface::class) ->disableOriginalConstructor() ->getMock(); - $this->redirectFactoryMock = $this->getMockBuilder(\Magento\Backend\Model\View\Result\RedirectFactory::class) + $this->redirectFactoryMock = $this->getMockBuilder(RedirectFactory::class) ->disableOriginalConstructor() ->setMethods(['create']) ->getMock(); - $this->managementMock = $this->getMockBuilder(\Magento\Customer\Model\AccountManagement::class) + $this->managementMock = $this->getMockBuilder(AccountManagement::class) ->disableOriginalConstructor() ->setMethods(['createAccount']) ->getMock(); - $this->addressDataFactoryMock = $this->getMockBuilder(\Magento\Customer\Api\Data\AddressInterfaceFactory::class) + $this->addressDataFactoryMock = $this->getMockBuilder(AddressInterfaceFactory::class) ->disableOriginalConstructor() ->setMethods(['create']) ->getMock(); @@ -241,10 +279,10 @@ protected function setUp() ->disableOriginalConstructor() ->getMock(); - $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $objectManager = new ObjectManager($this); $this->model = $objectManager->getObject( - \Magento\Customer\Controller\Adminhtml\Index\Save::class, + Save::class, [ 'resultForwardFactory' => $this->resultForwardFactoryMock, 'resultPageFactory' => $this->resultPageFactoryMock, @@ -265,6 +303,7 @@ protected function setUp() 'resultRedirectFactory' => $this->redirectFactoryMock, 'addressRepository' => $this->customerAddressRepositoryMock, 'addressMapper' => $this->customerAddressMapperMock, + 'subscriptionManager' => $this->subscriptionManager, ] ); @@ -282,7 +321,10 @@ protected function setUp() public function testExecuteWithExistentCustomer() { $customerId = 22; - $subscription = 'true'; + $customerEmail = 'customer@email.com'; + $subscriptionWebsite = 1; + $subscriptionStatus = true; + $subscriptionStore = 3; $postValue = [ 'customer' => [ 'entity_id' => $customerId, @@ -290,7 +332,8 @@ public function testExecuteWithExistentCustomer() 'coolness' => false, 'disable_auto_group_change' => 'false', ], - 'subscription' => $subscription, + 'subscription_status' => [$subscriptionWebsite => $subscriptionStatus], + 'subscription_store' => [$subscriptionWebsite => $subscriptionStore], ]; $extractedData = [ 'entity_id' => $customerId, @@ -324,9 +367,9 @@ public function testExecuteWithExistentCustomer() 'id' => $customerId, ]; - /** @var AttributeMetadataInterface|\PHPUnit_Framework_MockObject_MockObject $customerFormMock */ + /** @var AttributeMetadataInterface|MockObject $customerFormMock */ $attributeMock = $this->getMockBuilder( - \Magento\Customer\Api\Data\AttributeMetadataInterface::class + AttributeMetadataInterface::class )->disableOriginalConstructor()->getMock(); $attributeMock->expects($this->atLeastOnce()) ->method('getAttributeCode') @@ -346,15 +389,20 @@ public function testExecuteWithExistentCustomer() ); $this->requestMock->expects($this->atLeastOnce()) ->method('getPost') + ->with('customer') + ->willReturn($postValue['customer']); + $this->requestMock->expects($this->atLeastOnce()) + ->method('getParam') ->willReturnMap( [ - ['customer', null, $postValue['customer']], - ['subscription', null, $subscription], + ['subscription_status', null, [$subscriptionWebsite => $subscriptionStatus]], + ['subscription_store', null, [$subscriptionWebsite => $subscriptionStore]], + ['back', false, true], ] ); - /** @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject $objectMock */ - $objectMock = $this->getMockBuilder(\Magento\Framework\DataObject::class) + /** @var DataObject|MockObject $objectMock */ + $objectMock = $this->getMockBuilder(DataObject::class) ->disableOriginalConstructor() ->getMock(); $objectMock->expects($this->atLeastOnce()) @@ -371,7 +419,7 @@ public function testExecuteWithExistentCustomer() ->willReturn($objectMock); $customerFormMock = $this->getMockBuilder( - \Magento\Customer\Model\Metadata\Form::class + Form::class )->disableOriginalConstructor()->getMock(); $customerFormMock->expects($this->once()) ->method('extractData') @@ -400,32 +448,26 @@ public function testExecuteWithExistentCustomer() ] ); - /** @var CustomerInterface|\PHPUnit_Framework_MockObject_MockObject $customerMock */ - $customerMock = $this->getMockBuilder( - \Magento\Customer\Api\Data\CustomerInterface::class - )->disableOriginalConstructor()->getMock(); - + /** @var CustomerInterface|MockObject $customerMock */ + $customerMock = $this->createMock(CustomerInterface::class); + $customerMock->method('getId')->willReturn($customerId); $this->customerDataFactoryMock->expects($this->once()) ->method('create') ->willReturn($customerMock); - - $this->customerRepositoryMock->expects($this->exactly(2)) - ->method('getById') + $this->customerRepositoryMock->method('getById') ->with($customerId) ->willReturn($customerMock); - $this->customerMapperMock->expects($this->exactly(2)) ->method('toFlatArray') ->with($customerMock) ->willReturn($savedData); - $this->dataHelperMock->expects($this->atLeastOnce()) ->method('populateWithArray') ->willReturnMap( [ [ $customerMock, - $mergedData, \Magento\Customer\Api\Data\CustomerInterface::class, + $mergedData, CustomerInterface::class, $this->dataHelperMock ], ] @@ -435,10 +477,7 @@ public function testExecuteWithExistentCustomer() ->method('save') ->with($customerMock) ->willReturnSelf(); - - $customerEmail = 'customer@email.com'; $customerMock->expects($this->once())->method('getEmail')->willReturn($customerEmail); - $customerMock->expects($this->once()) ->method('getAddresses') ->willReturn([]); @@ -453,25 +492,12 @@ public function testExecuteWithExistentCustomer() ->with(null) ->willReturn(true); - /** @var \Magento\Newsletter\Model\Subscriber|\PHPUnit_Framework_MockObject_MockObject $subscriberMock */ - $subscriberMock = $this->getMockBuilder(\Magento\Newsletter\Model\Subscriber::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->subscriberFactoryMock->expects($this->once()) - ->method('create') - ->with() - ->willReturn($subscriberMock); - - $subscriberMock->expects($this->once()) - ->method('subscribeCustomerById') - ->with($customerId); - $subscriberMock->expects($this->never()) - ->method('unsubscribeCustomerById'); + $this->subscriptionManager->expects($this->once()) + ->method($subscriptionStatus ? 'subscribeCustomer' : 'unsubscribeCustomer') + ->with($customerId, $subscriptionStore); $this->sessionMock->expects($this->once()) ->method('unsCustomerFormData'); - $this->registryMock->expects($this->once()) ->method('register') ->with(RegistryConstants::CURRENT_CUSTOMER_ID, $customerId); @@ -481,13 +507,8 @@ public function testExecuteWithExistentCustomer() ->with(__('You saved the customer.')) ->willReturnSelf(); - $this->requestMock->expects($this->once()) - ->method('getParam') - ->with('back', false) - ->willReturn(true); - - /** @var Redirect|\PHPUnit_Framework_MockObject_MockObject $redirectMock */ - $redirectMock = $this->getMockBuilder(\Magento\Framework\Controller\Result\Redirect::class) + /** @var Redirect|MockObject $redirectMock */ + $redirectMock = $this->getMockBuilder(Redirect::class) ->disableOriginalConstructor() ->getMock(); @@ -511,14 +532,17 @@ public function testExecuteWithExistentCustomer() public function testExecuteWithNewCustomer() { $customerId = 22; + $subscriptionWebsite = 1; + $subscriptionStatus = false; + $subscriptionStore = 3; - $subscription = '0'; $postValue = [ 'customer' => [ 'coolness' => false, 'disable_auto_group_change' => 'false', ], - 'subscription' => $subscription, + 'subscription_status' => [$subscriptionWebsite => $subscriptionStatus], + 'subscription_store' => [$subscriptionWebsite => $subscriptionStore], ]; $extractedData = [ 'coolness' => false, @@ -530,9 +554,9 @@ public function testExecuteWithNewCustomer() CustomerInterface::DEFAULT_SHIPPING => null, 'confirmation' => false, ]; - /** @var AttributeMetadataInterface|\PHPUnit_Framework_MockObject_MockObject $customerFormMock */ + /** @var AttributeMetadataInterface|MockObject $customerFormMock */ $attributeMock = $this->getMockBuilder( - \Magento\Customer\Api\Data\AttributeMetadataInterface::class + AttributeMetadataInterface::class )->disableOriginalConstructor()->getMock(); $attributeMock->expects($this->atLeastOnce()) ->method('getAttributeCode') @@ -552,15 +576,20 @@ public function testExecuteWithNewCustomer() ); $this->requestMock->expects($this->atLeastOnce()) ->method('getPost') + ->with('customer') + ->willReturn($postValue['customer']); + $this->requestMock->expects($this->atLeastOnce()) + ->method('getParam') ->willReturnMap( [ - ['customer', null, $postValue['customer']], - ['subscription', null, $subscription], + ['subscription_status', null, [$subscriptionWebsite => $subscriptionStatus]], + ['subscription_store', null, [$subscriptionWebsite => $subscriptionStore]], + ['back', false, false], ] ); - /** @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject $objectMock */ - $objectMock = $this->getMockBuilder(\Magento\Framework\DataObject::class) + /** @var DataObject|MockObject $objectMock */ + $objectMock = $this->getMockBuilder(DataObject::class) ->disableOriginalConstructor() ->getMock(); $objectMock->expects($this->atLeastOnce()) @@ -577,7 +606,7 @@ public function testExecuteWithNewCustomer() ->willReturn($objectMock); $customerFormMock = $this->getMockBuilder( - \Magento\Customer\Model\Metadata\Form::class + Form::class )->disableOriginalConstructor()->getMock(); $customerFormMock->expects($this->once()) ->method('extractData') @@ -607,60 +636,36 @@ public function testExecuteWithNewCustomer() ] ); - /** @var CustomerInterface|\PHPUnit_Framework_MockObject_MockObject $customerMock */ - $customerMock = $this->getMockBuilder( - \Magento\Customer\Api\Data\CustomerInterface::class - )->disableOriginalConstructor()->getMock(); - + /** @var CustomerInterface|MockObject $customerMock */ + $customerMock = $this->createMock(CustomerInterface::class); + $customerMock->method('getId')->willReturn($customerId); $this->customerDataFactoryMock->expects($this->once()) ->method('create') ->willReturn($customerMock); - $this->dataHelperMock->expects($this->atLeastOnce()) ->method('populateWithArray') ->willReturnMap( [ [ $customerMock, - $mergedData, \Magento\Customer\Api\Data\CustomerInterface::class, + $mergedData, CustomerInterface::class, $this->dataHelperMock ], ] ); - $this->managementMock->expects($this->once()) ->method('createAccount') ->with($customerMock, null, '') ->willReturn($customerMock); - - $customerMock->expects($this->once()) - ->method('getId') - ->willReturn($customerId); - $this->authorizationMock->expects($this->once()) ->method('isAllowed') ->with(null) ->willReturn(true); - - /** @var \Magento\Newsletter\Model\Subscriber|\PHPUnit_Framework_MockObject_MockObject $subscriberMock */ - $subscriberMock = $this->getMockBuilder(\Magento\Newsletter\Model\Subscriber::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->subscriberFactoryMock->expects($this->once()) - ->method('create') - ->with() - ->willReturn($subscriberMock); - - $subscriberMock->expects($this->once()) - ->method('unsubscribeCustomerById') - ->with($customerId); - $subscriberMock->expects($this->never()) - ->method('subscribeCustomerById'); - + $this->subscriptionManager->expects($this->once()) + ->method($subscriptionStatus ? 'subscribeCustomer' : 'unsubscribeCustomer') + ->with($customerId, $subscriptionStore); $this->sessionMock->expects($this->once()) ->method('unsCustomerFormData'); - $this->registryMock->expects($this->once()) ->method('register') ->with(RegistryConstants::CURRENT_CUSTOMER_ID, $customerId); @@ -670,13 +675,8 @@ public function testExecuteWithNewCustomer() ->with(__('You saved the customer.')) ->willReturnSelf(); - $this->requestMock->expects($this->once()) - ->method('getParam') - ->with('back', false) - ->willReturn(false); - - /** @var Redirect|\PHPUnit_Framework_MockObject_MockObject $redirectMock */ - $redirectMock = $this->getMockBuilder(\Magento\Framework\Controller\Result\Redirect::class) + /** @var Redirect|MockObject $redirectMock */ + $redirectMock = $this->getMockBuilder(Redirect::class) ->disableOriginalConstructor() ->getMock(); @@ -713,9 +713,9 @@ public function testExecuteWithNewCustomerAndValidationException() 'dob' => '1996-03-12', ]; - /** @var AttributeMetadataInterface|\PHPUnit_Framework_MockObject_MockObject $customerFormMock */ + /** @var AttributeMetadataInterface|MockObject $customerFormMock */ $attributeMock = $this->getMockBuilder( - \Magento\Customer\Api\Data\AttributeMetadataInterface::class + AttributeMetadataInterface::class )->disableOriginalConstructor()->getMock(); $attributeMock->expects($this->exactly(2)) ->method('getAttributeCode') @@ -741,8 +741,8 @@ public function testExecuteWithNewCustomerAndValidationException() ] ); - /** @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject $objectMock */ - $objectMock = $this->getMockBuilder(\Magento\Framework\DataObject::class) + /** @var DataObject|MockObject $objectMock */ + $objectMock = $this->getMockBuilder(DataObject::class) ->disableOriginalConstructor() ->getMock(); $objectMock->expects($this->exactly(2)) @@ -756,7 +756,7 @@ public function testExecuteWithNewCustomerAndValidationException() ->willReturn($objectMock); $customerFormMock = $this->getMockBuilder( - \Magento\Customer\Model\Metadata\Form::class + Form::class )->disableOriginalConstructor()->getMock(); $customerFormMock->expects($this->exactly(2)) ->method('extractData') @@ -780,9 +780,9 @@ public function testExecuteWithNewCustomerAndValidationException() Form::DONT_IGNORE_INVISIBLE )->willReturn($customerFormMock); - /** @var CustomerInterface|\PHPUnit_Framework_MockObject_MockObject $customerMock */ + /** @var CustomerInterface|MockObject $customerMock */ $customerMock = $this->getMockBuilder( - \Magento\Customer\Api\Data\CustomerInterface::class + CustomerInterface::class )->disableOriginalConstructor()->getMock(); $this->customerDataFactoryMock->expects($this->once()) @@ -814,7 +814,7 @@ public function testExecuteWithNewCustomerAndValidationException() $this->messageManagerMock->expects($this->once()) ->method('addMessage') - ->with(new \Magento\Framework\Message\Error('Validator Exception')); + ->with(new Error('Validator Exception')); $this->sessionMock->expects($this->once()) ->method('setCustomerFormData') @@ -825,8 +825,8 @@ public function testExecuteWithNewCustomerAndValidationException() ] ); - /** @var Redirect|\PHPUnit_Framework_MockObject_MockObject $redirectMock */ - $redirectMock = $this->getMockBuilder(\Magento\Framework\Controller\Result\Redirect::class) + /** @var Redirect|MockObject $redirectMock */ + $redirectMock = $this->getMockBuilder(Redirect::class) ->disableOriginalConstructor() ->getMock(); @@ -864,9 +864,9 @@ public function testExecuteWithNewCustomerAndLocalizedException() 'dob' => '1996-03-12', ]; - /** @var AttributeMetadataInterface|\PHPUnit_Framework_MockObject_MockObject $customerFormMock */ + /** @var AttributeMetadataInterface|MockObject $customerFormMock */ $attributeMock = $this->getMockBuilder( - \Magento\Customer\Api\Data\AttributeMetadataInterface::class + AttributeMetadataInterface::class )->disableOriginalConstructor()->getMock(); $attributeMock->expects($this->exactly(2)) ->method('getAttributeCode') @@ -892,8 +892,8 @@ public function testExecuteWithNewCustomerAndLocalizedException() ] ); - /** @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject $objectMock */ - $objectMock = $this->getMockBuilder(\Magento\Framework\DataObject::class) + /** @var DataObject|MockObject $objectMock */ + $objectMock = $this->getMockBuilder(DataObject::class) ->disableOriginalConstructor() ->getMock(); $objectMock->expects($this->exactly(2)) @@ -906,9 +906,9 @@ public function testExecuteWithNewCustomerAndLocalizedException() ->with(['data' => $postValue]) ->willReturn($objectMock); - /** @var Form|\PHPUnit_Framework_MockObject_MockObject $formMock */ + /** @var Form|MockObject $formMock */ $customerFormMock = $this->getMockBuilder( - \Magento\Customer\Model\Metadata\Form::class + Form::class )->disableOriginalConstructor()->getMock(); $customerFormMock->expects($this->exactly(2)) ->method('extractData') @@ -933,7 +933,7 @@ public function testExecuteWithNewCustomerAndLocalizedException() )->willReturn($customerFormMock); $customerMock = $this->getMockBuilder( - \Magento\Customer\Api\Data\CustomerInterface::class + CustomerInterface::class )->disableOriginalConstructor()->getMock(); $this->customerDataFactoryMock->expects($this->once()) @@ -943,7 +943,7 @@ public function testExecuteWithNewCustomerAndLocalizedException() $this->managementMock->expects($this->once()) ->method('createAccount') ->with($customerMock, null, '') - ->willThrowException(new \Magento\Framework\Exception\LocalizedException(__('Localized Exception'))); + ->willThrowException(new LocalizedException(__('Localized Exception'))); $customerMock->expects($this->never()) ->method('getId'); @@ -965,7 +965,7 @@ public function testExecuteWithNewCustomerAndLocalizedException() $this->messageManagerMock->expects($this->once()) ->method('addMessage') - ->with(new \Magento\Framework\Message\Error('Localized Exception')); + ->with(new Error('Localized Exception')); $this->sessionMock->expects($this->once()) ->method('setCustomerFormData') @@ -976,8 +976,8 @@ public function testExecuteWithNewCustomerAndLocalizedException() ] ); - /** @var Redirect|\PHPUnit_Framework_MockObject_MockObject $redirectMock */ - $redirectMock = $this->getMockBuilder(\Magento\Framework\Controller\Result\Redirect::class) + /** @var Redirect|MockObject $redirectMock */ + $redirectMock = $this->getMockBuilder(Redirect::class) ->disableOriginalConstructor() ->getMock(); @@ -1015,9 +1015,9 @@ public function testExecuteWithNewCustomerAndException() 'dob' => '1996-03-12', ]; - /** @var AttributeMetadataInterface|\PHPUnit_Framework_MockObject_MockObject $customerFormMock */ + /** @var AttributeMetadataInterface|MockObject $customerFormMock */ $attributeMock = $this->getMockBuilder( - \Magento\Customer\Api\Data\AttributeMetadataInterface::class + AttributeMetadataInterface::class )->disableOriginalConstructor()->getMock(); $attributeMock->expects($this->exactly(2)) ->method('getAttributeCode') @@ -1043,8 +1043,8 @@ public function testExecuteWithNewCustomerAndException() ] ); - /** @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject $objectMock */ - $objectMock = $this->getMockBuilder(\Magento\Framework\DataObject::class) + /** @var DataObject|MockObject $objectMock */ + $objectMock = $this->getMockBuilder(DataObject::class) ->disableOriginalConstructor() ->getMock(); $objectMock->expects($this->exactly(2)) @@ -1058,7 +1058,7 @@ public function testExecuteWithNewCustomerAndException() ->willReturn($objectMock); $customerFormMock = $this->getMockBuilder( - \Magento\Customer\Model\Metadata\Form::class + Form::class )->disableOriginalConstructor()->getMock(); $customerFormMock->expects($this->exactly(2)) ->method('extractData') @@ -1082,9 +1082,9 @@ public function testExecuteWithNewCustomerAndException() Form::DONT_IGNORE_INVISIBLE )->willReturn($customerFormMock); - /** @var CustomerInterface|\PHPUnit_Framework_MockObject_MockObject $customerMock */ + /** @var CustomerInterface|MockObject $customerMock */ $customerMock = $this->getMockBuilder( - \Magento\Customer\Api\Data\CustomerInterface::class + CustomerInterface::class )->disableOriginalConstructor()->getMock(); $this->customerDataFactoryMock->expects($this->once()) @@ -1128,8 +1128,8 @@ public function testExecuteWithNewCustomerAndException() ] ); - /** @var Redirect|\PHPUnit_Framework_MockObject_MockObject $redirectMock */ - $redirectMock = $this->getMockBuilder(\Magento\Framework\Controller\Result\Redirect::class) + /** @var Redirect|MockObject $redirectMock */ + $redirectMock = $this->getMockBuilder(Redirect::class) ->disableOriginalConstructor() ->getMock(); diff --git a/app/code/Magento/Customer/view/adminhtml/templates/tab/newsletter.phtml b/app/code/Magento/Customer/view/adminhtml/templates/tab/newsletter.phtml index 12d4902fb1892..d8bcc59689fac 100644 --- a/app/code/Magento/Customer/view/adminhtml/templates/tab/newsletter.phtml +++ b/app/code/Magento/Customer/view/adminhtml/templates/tab/newsletter.phtml @@ -4,6 +4,7 @@ * See COPYING.txt for license details. */ ?> +<?php /** @var \Magento\Customer\Block\Adminhtml\Edit\Tab\Newsletter $block */ ?> <div class="entry-edit"> <?= $block->getForm()->getHtml() ?> </div> diff --git a/app/code/Magento/CustomerGraphQl/Model/Customer/ChangeSubscriptionStatus.php b/app/code/Magento/CustomerGraphQl/Model/Customer/ChangeSubscriptionStatus.php deleted file mode 100644 index 1acb418e7bba6..0000000000000 --- a/app/code/Magento/CustomerGraphQl/Model/Customer/ChangeSubscriptionStatus.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -declare(strict_types=1); - -namespace Magento\CustomerGraphQl\Model\Customer; - -use Magento\Newsletter\Model\SubscriberFactory; - -/** - * Change subscription status. Subscribe OR unsubscribe if required - */ -class ChangeSubscriptionStatus -{ - /** - * @var SubscriberFactory - */ - private $subscriberFactory; - - /** - * @param SubscriberFactory $subscriberFactory - */ - public function __construct( - SubscriberFactory $subscriberFactory - ) { - $this->subscriberFactory = $subscriberFactory; - } - - /** - * Change subscription status. Subscribe OR unsubscribe if required - * - * @param int $customerId - * @param bool $subscriptionStatus - * @return void - */ - public function execute(int $customerId, bool $subscriptionStatus): void - { - $subscriber = $this->subscriberFactory->create()->loadByCustomerId($customerId); - - if ($subscriptionStatus === true && !$subscriber->isSubscribed()) { - $this->subscriberFactory->create()->subscribeCustomerById($customerId); - } elseif ($subscriptionStatus === false && $subscriber->isSubscribed()) { - $this->subscriberFactory->create()->unsubscribeCustomerById($customerId); - } - } -} diff --git a/app/code/Magento/CustomerGraphQl/Model/Customer/CreateCustomerAccount.php b/app/code/Magento/CustomerGraphQl/Model/Customer/CreateCustomerAccount.php index 969c205329f2b..a631b7ba86194 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Customer/CreateCustomerAccount.php +++ b/app/code/Magento/CustomerGraphQl/Model/Customer/CreateCustomerAccount.php @@ -14,6 +14,7 @@ use Magento\Framework\Exception\LocalizedException; use Magento\Framework\GraphQl\Exception\GraphQlInputException; use Magento\Framework\Reflection\DataObjectProcessor; +use Magento\Newsletter\Model\SubscriptionManagerInterface; use Magento\Store\Api\Data\StoreInterface; /** @@ -36,11 +37,6 @@ class CreateCustomerAccount */ private $accountManagement; - /** - * @var ChangeSubscriptionStatus - */ - private $changeSubscriptionStatus; - /** * @var ValidateCustomerData */ @@ -51,30 +47,35 @@ class CreateCustomerAccount */ private $dataObjectProcessor; + /** + * @var SubscriptionManagerInterface + */ + private $subscriptionManager; + /** * CreateCustomerAccount constructor. * * @param DataObjectHelper $dataObjectHelper * @param CustomerInterfaceFactory $customerFactory * @param AccountManagementInterface $accountManagement - * @param ChangeSubscriptionStatus $changeSubscriptionStatus * @param DataObjectProcessor $dataObjectProcessor * @param ValidateCustomerData $validateCustomerData + * @param SubscriptionManagerInterface $subscriptionManager */ public function __construct( DataObjectHelper $dataObjectHelper, CustomerInterfaceFactory $customerFactory, AccountManagementInterface $accountManagement, - ChangeSubscriptionStatus $changeSubscriptionStatus, DataObjectProcessor $dataObjectProcessor, - ValidateCustomerData $validateCustomerData + ValidateCustomerData $validateCustomerData, + SubscriptionManagerInterface $subscriptionManager ) { $this->dataObjectHelper = $dataObjectHelper; $this->customerFactory = $customerFactory; $this->accountManagement = $accountManagement; - $this->changeSubscriptionStatus = $changeSubscriptionStatus; $this->validateCustomerData = $validateCustomerData; $this->dataObjectProcessor = $dataObjectProcessor; + $this->subscriptionManager = $subscriptionManager; } /** @@ -94,7 +95,11 @@ public function execute(array $data, StoreInterface $store): CustomerInterface } if (isset($data['is_subscribed'])) { - $this->changeSubscriptionStatus->execute((int)$customer->getId(), (bool)$data['is_subscribed']); + if ((bool)$data['is_subscribed']) { + $this->subscriptionManager->subscribeCustomer((int)$customer->getId(), (int)$store->getId()); + } else { + $this->subscriptionManager->unsubscribeCustomer((int)$customer->getId(), (int)$store->getId()); + } } return $customer; } diff --git a/app/code/Magento/CustomerGraphQl/Model/Customer/UpdateCustomerAccount.php b/app/code/Magento/CustomerGraphQl/Model/Customer/UpdateCustomerAccount.php index f7bf26513dc2e..d82b8c6f941fa 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Customer/UpdateCustomerAccount.php +++ b/app/code/Magento/CustomerGraphQl/Model/Customer/UpdateCustomerAccount.php @@ -14,6 +14,7 @@ use Magento\Framework\GraphQl\Exception\GraphQlInputException; use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException; use Magento\Framework\Api\DataObjectHelper; +use Magento\Newsletter\Model\SubscriptionManagerInterface; use Magento\Store\Api\Data\StoreInterface; /** @@ -38,11 +39,6 @@ class UpdateCustomerAccount */ private $dataObjectHelper; - /** - * @var ChangeSubscriptionStatus - */ - private $changeSubscriptionStatus; - /** * @var ValidateCustomerData */ @@ -53,28 +49,33 @@ class UpdateCustomerAccount */ private $restrictedKeys; + /** + * @var SubscriptionManagerInterface + */ + private $subscriptionManager; + /** * @param SaveCustomer $saveCustomer * @param CheckCustomerPassword $checkCustomerPassword * @param DataObjectHelper $dataObjectHelper - * @param ChangeSubscriptionStatus $changeSubscriptionStatus * @param ValidateCustomerData $validateCustomerData + * @param SubscriptionManagerInterface $subscriptionManager * @param array $restrictedKeys */ public function __construct( SaveCustomer $saveCustomer, CheckCustomerPassword $checkCustomerPassword, DataObjectHelper $dataObjectHelper, - ChangeSubscriptionStatus $changeSubscriptionStatus, ValidateCustomerData $validateCustomerData, + SubscriptionManagerInterface $subscriptionManager, array $restrictedKeys = [] ) { $this->saveCustomer = $saveCustomer; $this->checkCustomerPassword = $checkCustomerPassword; $this->dataObjectHelper = $dataObjectHelper; $this->restrictedKeys = $restrictedKeys; - $this->changeSubscriptionStatus = $changeSubscriptionStatus; $this->validateCustomerData = $validateCustomerData; + $this->subscriptionManager = $subscriptionManager; } /** @@ -112,7 +113,11 @@ public function execute(CustomerInterface $customer, array $data, StoreInterface $this->saveCustomer->execute($customer); if (isset($data['is_subscribed'])) { - $this->changeSubscriptionStatus->execute((int)$customer->getId(), (bool)$data['is_subscribed']); + if ((bool)$data['is_subscribed']) { + $this->subscriptionManager->subscribeCustomer((int)$customer->getId(), (int)$store->getId()); + } else { + $this->subscriptionManager->unsubscribeCustomer((int)$customer->getId(), (int)$store->getId()); + } } } } diff --git a/app/code/Magento/Newsletter/Controller/Manage/Save.php b/app/code/Magento/Newsletter/Controller/Manage/Save.php index d7d511e2d1906..01012e39a992a 100644 --- a/app/code/Magento/Newsletter/Controller/Manage/Save.php +++ b/app/code/Magento/Newsletter/Controller/Manage/Save.php @@ -12,6 +12,7 @@ use Magento\Framework\App\Action\HttpGetActionInterface; use Magento\Framework\App\Action\HttpPostActionInterface; use Magento\Newsletter\Model\Subscriber; +use Magento\Newsletter\Model\SubscriptionManagerInterface; /** * Customers newsletter subscription save controller @@ -34,9 +35,9 @@ class Save extends \Magento\Newsletter\Controller\Manage implements HttpPostActi protected $customerRepository; /** - * @var \Magento\Newsletter\Model\SubscriberFactory + * @var SubscriptionManagerInterface */ - protected $subscriberFactory; + private $subscriptionManager; /** * Initialize dependencies. @@ -46,7 +47,7 @@ class Save extends \Magento\Newsletter\Controller\Manage implements HttpPostActi * @param \Magento\Framework\Data\Form\FormKey\Validator $formKeyValidator * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param CustomerRepository $customerRepository - * @param \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory + * @param SubscriptionManagerInterface $subscriptionManager */ public function __construct( \Magento\Framework\App\Action\Context $context, @@ -54,13 +55,13 @@ public function __construct( \Magento\Framework\Data\Form\FormKey\Validator $formKeyValidator, \Magento\Store\Model\StoreManagerInterface $storeManager, CustomerRepository $customerRepository, - \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory + SubscriptionManagerInterface $subscriptionManager ) { $this->storeManager = $storeManager; $this->formKeyValidator = $formKeyValidator; $this->customerRepository = $customerRepository; - $this->subscriberFactory = $subscriberFactory; parent::__construct($context, $customerSession); + $this->subscriptionManager = $subscriptionManager; } /** @@ -80,28 +81,24 @@ public function execute() } else { try { $customer = $this->customerRepository->getById($customerId); - $storeId = $this->storeManager->getStore()->getId(); + $storeId = (int)$this->storeManager->getStore()->getId(); $customer->setStoreId($storeId); - $isSubscribedState = $customer->getExtensionAttributes() - ->getIsSubscribed(); - $isSubscribedParam = (boolean)$this->getRequest() - ->getParam('is_subscribed', false); + $isSubscribedState = $customer->getExtensionAttributes()->getIsSubscribed(); + $isSubscribedParam = (boolean)$this->getRequest()->getParam('is_subscribed', false); if ($isSubscribedParam !== $isSubscribedState) { // No need to validate customer and customer address while saving subscription preferences $this->setIgnoreValidationFlag($customer); $this->customerRepository->save($customer); if ($isSubscribedParam) { - $subscribeModel = $this->subscriberFactory->create() - ->subscribeCustomerById($customerId); - $subscribeStatus = $subscribeModel->getStatus(); - if ($subscribeStatus == Subscriber::STATUS_SUBSCRIBED) { + $subscribeModel = $this->subscriptionManager->subscribeCustomer((int)$customerId, $storeId); + $subscribeStatus = (int)$subscribeModel->getStatus(); + if ($subscribeStatus === Subscriber::STATUS_SUBSCRIBED) { $this->messageManager->addSuccess(__('We have saved your subscription.')); } else { $this->messageManager->addSuccess(__('A confirmation request has been sent.')); } } else { - $this->subscriberFactory->create() - ->unsubscribeCustomerById($customerId); + $this->subscriptionManager->unsubscribeCustomer((int)$customerId, $storeId); $this->messageManager->addSuccess(__('We have removed your newsletter subscription.')); } } else { diff --git a/app/code/Magento/Newsletter/Controller/Subscriber/NewAction.php b/app/code/Magento/Newsletter/Controller/Subscriber/NewAction.php index 7557f1610b4f4..ea52ae8aaa864 100644 --- a/app/code/Magento/Newsletter/Controller/Subscriber/NewAction.php +++ b/app/code/Magento/Newsletter/Controller/Subscriber/NewAction.php @@ -4,7 +4,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - namespace Magento\Newsletter\Controller\Subscriber; use Magento\Customer\Api\AccountManagementInterface as CustomerAccountManagement; @@ -14,11 +13,14 @@ use Magento\Framework\App\Action\HttpPostActionInterface; use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\App\ObjectManager; +use Magento\Framework\Controller\Result\Redirect; +use Magento\Framework\Controller\ResultFactory; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Phrase; use Magento\Framework\Validator\EmailAddress as EmailValidator; use Magento\Newsletter\Controller\Subscriber as SubscriberController; use Magento\Newsletter\Model\Subscriber; +use Magento\Newsletter\Model\SubscriptionManagerInterface; use Magento\Store\Model\ScopeInterface; use Magento\Store\Model\StoreManagerInterface; use Magento\Newsletter\Model\SubscriberFactory; @@ -40,6 +42,11 @@ class NewAction extends SubscriberController implements HttpPostActionInterface */ private $emailValidator; + /** + * @var SubscriptionManagerInterface + */ + private $subscriptionManager; + /** * Initialize dependencies. * @@ -49,6 +56,7 @@ class NewAction extends SubscriberController implements HttpPostActionInterface * @param StoreManagerInterface $storeManager * @param CustomerUrl $customerUrl * @param CustomerAccountManagement $customerAccountManagement + * @param SubscriptionManagerInterface $subscriptionManager * @param EmailValidator $emailValidator */ public function __construct( @@ -58,9 +66,11 @@ public function __construct( StoreManagerInterface $storeManager, CustomerUrl $customerUrl, CustomerAccountManagement $customerAccountManagement, + SubscriptionManagerInterface $subscriptionManager, EmailValidator $emailValidator = null ) { $this->customerAccountManagement = $customerAccountManagement; + $this->subscriptionManager = $subscriptionManager; $this->emailValidator = $emailValidator ?: ObjectManager::getInstance()->get(EmailValidator::class); parent::__construct( $context, @@ -132,7 +142,7 @@ protected function validateEmailFormat($email) /** * New subscription action * - * @return \Magento\Framework\Controller\Result\Redirect + * @return Redirect */ public function execute() { @@ -144,29 +154,55 @@ public function execute() $this->validateGuestSubscription(); $this->validateEmailAvailable($email); - $subscriber = $this->_subscriberFactory->create()->loadByEmail($email); + $websiteId = (int)$this->_storeManager->getStore()->getWebsiteId(); + /** @var Subscriber $subscriber */ + $subscriber = $this->_subscriberFactory->create()->loadBySubscriberEmail($email, $websiteId); if ($subscriber->getId() - && (int) $subscriber->getSubscriberStatus() === Subscriber::STATUS_SUBSCRIBED - ) { + && (int)$subscriber->getSubscriberStatus() === Subscriber::STATUS_SUBSCRIBED) { throw new LocalizedException( __('This email address is already subscribed.') ); } - $status = (int) $this->_subscriberFactory->create()->subscribe($email); - $this->messageManager->addSuccessMessage($this->getSuccessMessage($status)); + $storeId = (int)$this->_storeManager->getStore()->getId(); + $currentCustomerId = $this->getSessionCustomerId($email); + $subscriber = $currentCustomerId + ? $this->subscriptionManager->subscribeCustomer($currentCustomerId, $storeId) + : $this->subscriptionManager->subscribe($email, $storeId); + $message = $this->getSuccessMessage((int)$subscriber->getSubscriberStatus()); + $this->messageManager->addSuccessMessage($message); } catch (LocalizedException $e) { $this->messageManager->addErrorMessage($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addExceptionMessage($e, __('Something went wrong with the subscription.')); } } - /** @var \Magento\Framework\Controller\Result\Redirect $redirect */ - $redirect = $this->resultFactory->create(\Magento\Framework\Controller\ResultFactory::TYPE_REDIRECT); + /** @var Redirect $redirect */ + $redirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); $redirectUrl = $this->_redirect->getRedirectUrl(); return $redirect->setUrl($redirectUrl); } + /** + * Get customer id from session if he is owner of the email + * + * @param string $email + * @return int|null + */ + private function getSessionCustomerId(string $email): ?int + { + if (!$this->_customerSession->isLoggedIn()) { + return null; + } + + $customer = $this->_customerSession->getCustomerDataObject(); + if ($customer->getEmail() !== $email) { + return null; + } + + return (int)$this->_customerSession->getId(); + } + /** * Get success message * diff --git a/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php b/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php index 309bfadab41b3..59e67e7aa32a7 100644 --- a/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php +++ b/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php @@ -5,12 +5,19 @@ */ namespace Magento\Newsletter\Model\Plugin; -use Magento\Customer\Api\CustomerRepositoryInterface as CustomerRepository; +use Magento\Customer\Api\CustomerRepositoryInterface; use Magento\Customer\Api\Data\CustomerInterface; -use Magento\Newsletter\Model\SubscriberFactory; +use Magento\Customer\Model\Config\Share; use Magento\Framework\Api\ExtensionAttributesFactory; -use Magento\Newsletter\Model\ResourceModel\Subscriber; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Newsletter\Model\Subscriber; +use Magento\Newsletter\Model\ResourceModel\Subscriber\CollectionFactory; use Magento\Customer\Api\Data\CustomerExtensionInterface; +use Magento\Newsletter\Model\SubscriberFactory; +use Magento\Newsletter\Model\SubscriptionManagerInterface; +use Magento\Store\Model\Store; +use Magento\Store\Model\StoreManagerInterface; +use Psr\Log\LoggerInterface; /** * Newsletter Plugin for customer @@ -18,42 +25,70 @@ class CustomerPlugin { /** - * Factory used for manipulating newsletter subscriptions - * - * @var SubscriberFactory + * @var ExtensionAttributesFactory */ - private $subscriberFactory; + private $extensionFactory; /** - * @var ExtensionAttributesFactory + * @var CollectionFactory */ - private $extensionFactory; + private $collectionFactory; + + /** + * @var SubscriptionManagerInterface + */ + private $subscriptionManager; /** - * @var Subscriber + * @var Share */ - private $subscriberResource; + private $shareConfig; + + /** + * @var StoreManagerInterface + */ + private $storeManager; /** * @var array */ - private $customerSubscriptionStatus = []; + private $customerSubscriber = []; + + /** + * @var SubscriberFactory + */ + private $subscriberFactory; + + /** + * @var LoggerInterface + */ + private $logger; /** - * Initialize dependencies. - * * @param SubscriberFactory $subscriberFactory * @param ExtensionAttributesFactory $extensionFactory - * @param Subscriber $subscriberResource + * @param CollectionFactory $collectionFactory + * @param SubscriptionManagerInterface $subscriptionManager + * @param Share $shareConfig + * @param StoreManagerInterface $storeManager + * @param LoggerInterface $logger */ public function __construct( SubscriberFactory $subscriberFactory, ExtensionAttributesFactory $extensionFactory, - Subscriber $subscriberResource + CollectionFactory $collectionFactory, + SubscriptionManagerInterface $subscriptionManager, + Share $shareConfig, + StoreManagerInterface $storeManager, + LoggerInterface $logger ) { $this->subscriberFactory = $subscriberFactory; $this->extensionFactory = $extensionFactory; - $this->subscriberResource = $subscriberResource; + $this->collectionFactory = $collectionFactory; + $this->subscriptionManager = $subscriptionManager; + $this->shareConfig = $shareConfig; + $this->storeManager = $storeManager; + $this->logger = $logger; } /** @@ -61,128 +96,228 @@ public function __construct( * * If we have extension attribute (is_subscribed) we need to subscribe that customer * - * @param CustomerRepository $subject + * @param CustomerRepositoryInterface $subject * @param CustomerInterface $result * @param CustomerInterface $customer * @return CustomerInterface * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function afterSave(CustomerRepository $subject, CustomerInterface $result, CustomerInterface $customer) - { - $resultId = $result->getId(); - /** @var \Magento\Newsletter\Model\Subscriber $subscriber */ - $subscriber = $this->subscriberFactory->create(); + public function afterSave( + CustomerRepositoryInterface $subject, + CustomerInterface $result, + CustomerInterface $customer + ) { + $subscriber = $this->getSubscriber($result); + $subscribeStatus = $this->getIsSubscribedFromExtensionAttr($customer) ?? $subscriber->isSubscribed(); + $needToUpdate = $this->isSubscriptionChanged($result, $subscriber, $subscribeStatus); - $subscriber->updateSubscription($resultId); - // update the result only if the original customer instance had different value. - $initialExtensionAttributes = $result->getExtensionAttributes(); - if ($initialExtensionAttributes === null) { - /** @var CustomerExtensionInterface $initialExtensionAttributes */ - $initialExtensionAttributes = $this->extensionFactory->create(CustomerInterface::class); - $result->setExtensionAttributes($initialExtensionAttributes); + /** + * If subscriber is waiting to confirm customer registration + * and customer is already confirmed registration + * than need to subscribe customer + */ + if ($subscriber->getStatus() === Subscriber::STATUS_UNCONFIRMED && empty($result->getConfirmation())) { + $needToUpdate = true; + $subscribeStatus = true; } + if ($needToUpdate) { + $storeId = $this->getCurrentStoreId($result); + $subscriber = $subscribeStatus + ? $this->subscriptionManager->subscribeCustomer((int)$result->getId(), $storeId) + : $this->subscriptionManager->unsubscribeCustomer((int)$result->getId(), $storeId); + $this->customerSubscriber[(int)$result->getId()] = $subscriber; + } + $this->addIsSubscribedExtensionAttr($result, $subscriber->isSubscribed()); + + return $result; + } + /** + * Get subscription status from extension customer attribute + * + * @param CustomerInterface $customer + * @return bool|null + */ + private function getIsSubscribedFromExtensionAttr(CustomerInterface $customer): ?bool + { $newExtensionAttributes = $customer->getExtensionAttributes(); - if ($newExtensionAttributes - && $initialExtensionAttributes->getIsSubscribed() !== $newExtensionAttributes->getIsSubscribed() - ) { - if ($newExtensionAttributes->getIsSubscribed()) { - $subscriber->subscribeCustomerById($resultId); - } else { - $subscriber->unsubscribeCustomerById($resultId); - } + if ($newExtensionAttributes === null || $newExtensionAttributes->getIsSubscribed() === null) { + return null; } - $isSubscribed = $subscriber->isSubscribed(); - $this->customerSubscriptionStatus[$resultId] = $isSubscribed; - $initialExtensionAttributes->setIsSubscribed($isSubscribed); + return (bool)$newExtensionAttributes->getIsSubscribed(); + } - return $result; + /** + * Get is customer subscription changed + * + * @param CustomerInterface $customer + * @param Subscriber $subscriber + * @param bool $newStatus + * @return bool + */ + private function isSubscriptionChanged(CustomerInterface $customer, Subscriber $subscriber, bool $newStatus): bool + { + if ($subscriber->isSubscribed() !== $newStatus) { + return true; + } + + if (!$subscriber->getId()) { + return false; + } + + /** + * If customer has changed email or subscriber was loaded by email + * than need to update customer subscription + */ + return $customer->getEmail() !== $subscriber->getEmail() || (int)$subscriber->getCustomerId() === 0; } /** * Plugin around delete customer that updates any newsletter subscription that may have existed. * - * @param CustomerRepository $subject + * @param CustomerRepositoryInterface $subject * @param callable $deleteCustomerById Function we are wrapping around * @param int $customerId Input to the function * @return bool */ public function aroundDeleteById( - CustomerRepository $subject, + CustomerRepositoryInterface $subject, callable $deleteCustomerById, $customerId ) { $customer = $subject->getById($customerId); $result = $deleteCustomerById($customerId); - /** @var \Magento\Newsletter\Model\Subscriber $subscriber */ - $subscriber = $this->subscriberFactory->create(); - $subscriber->loadByEmail($customer->getEmail()); - if ($subscriber->getId()) { - $subscriber->delete(); - } + $this->deleteSubscriptionsAfterCustomerDelete($customer); + return $result; } /** * Plugin after delete customer that updates any newsletter subscription that may have existed. * - * @param CustomerRepository $subject + * @param CustomerRepositoryInterface $subject * @param bool $result * @param CustomerInterface $customer * @return bool * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function afterDelete(CustomerRepository $subject, $result, CustomerInterface $customer) + public function afterDelete(CustomerRepositoryInterface $subject, $result, CustomerInterface $customer) { - $subscriber = $this->subscriberFactory->create(); - $subscriber->loadByEmail($customer->getEmail()); - if ($subscriber->getId()) { - $subscriber->delete(); - } + $this->deleteSubscriptionsAfterCustomerDelete($customer); return $result; } /** * Plugin after getById customer that obtains newsletter subscription status for given customer. * - * @param CustomerRepository $subject + * @param CustomerRepositoryInterface $subject * @param CustomerInterface $customer * @return CustomerInterface * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function afterGetById(CustomerRepository $subject, CustomerInterface $customer) + public function afterGetById(CustomerRepositoryInterface $subject, CustomerInterface $customer) { - $extensionAttributes = $customer->getExtensionAttributes(); + $isSubscribed = $this->getSubscriber($customer)->isSubscribed(); + $this->addIsSubscribedExtensionAttr($customer, $isSubscribed); + + return $customer; + } + /** + * Set Is Subscribed extension attribute + * + * @param CustomerInterface $customer + * @param bool $isSubscribed + */ + private function addIsSubscribedExtensionAttr(CustomerInterface $customer, bool $isSubscribed): void + { + $extensionAttributes = $customer->getExtensionAttributes(); if ($extensionAttributes === null) { /** @var CustomerExtensionInterface $extensionAttributes */ $extensionAttributes = $this->extensionFactory->create(CustomerInterface::class); $customer->setExtensionAttributes($extensionAttributes); } - if ($extensionAttributes->getIsSubscribed() === null) { - $isSubscribed = $this->isSubscribed($customer); - $extensionAttributes->setIsSubscribed($isSubscribed); + $extensionAttributes->setIsSubscribed($isSubscribed); + } + + /** + * Delete customer subscriptions + * + * @param CustomerInterface $customer + * @return void + */ + private function deleteSubscriptionsAfterCustomerDelete(CustomerInterface $customer): void + { + $collection = $this->collectionFactory->create(); + $collection->addFieldToFilter('subscriber_email', $customer->getEmail()); + if ($this->shareConfig->isWebsiteScope()) { + try { + $storeIds = $this->storeManager->getWebsite($customer->getWebsiteId())->getStoreIds(); + $collection->addFieldToFilter('store_id', ['in' => $storeIds]); + } catch (NoSuchEntityException $exception) { + $this->logger->error($exception); + } + } + /** @var Subscriber $subscriber */ + foreach ($collection as $subscriber) { + $subscriber->delete(); } + } - return $customer; + /** + * Get Subscriber model by customer + * + * @param CustomerInterface $customer + * @return Subscriber + */ + private function getSubscriber(CustomerInterface $customer): Subscriber + { + $customerId = (int)$customer->getId(); + if (isset($this->customerSubscriber[$customerId])) { + return $this->customerSubscriber[$customerId]; + } + + /** @var Subscriber $subscriber */ + $subscriber = $this->subscriberFactory->create(); + $websiteId = $this->getCurrentWebsiteId($customer); + $subscriber->loadByCustomer((int)$customer->getId(), $websiteId); + /** + * If subscriber was't found by customer id then try to find subscriber by customer email. + * It need when the customer is creating and he has already subscribed as guest by same email. + */ + if (!$subscriber->getId()) { + $subscriber->loadBySubscriberEmail((string)$customer->getEmail(), $websiteId); + } + $this->customerSubscriber[$customerId] = $subscriber; + + return $subscriber; } /** - * This method returns newsletters subscription status for given customer. + * Retrieve current website id * * @param CustomerInterface $customer - * @return bool + * @return int + */ + private function getCurrentWebsiteId(CustomerInterface $customer): int + { + return (int)$this->storeManager->getStore($this->getCurrentStoreId($customer))->getWebsiteId(); + } + + /** + * Retrieve current store id + * + * @param CustomerInterface $customer + * @return int */ - private function isSubscribed(CustomerInterface $customer) + private function getCurrentStoreId(CustomerInterface $customer): int { - $customerId = $customer->getId(); - if (!isset($this->customerSubscriptionStatus[$customerId])) { - $subscriber = $this->subscriberResource->loadByCustomerData($customer); - $this->customerSubscriptionStatus[$customerId] = isset($subscriber['subscriber_status']) - && $subscriber['subscriber_status'] == 1; + $storeId = (int)$this->storeManager->getStore()->getId(); + if ($storeId === Store::DEFAULT_STORE_ID) { + $storeId = (int)$customer->getStoreId(); } - return $this->customerSubscriptionStatus[$customerId]; + return $storeId; } } diff --git a/app/code/Magento/Newsletter/Model/ResourceModel/Queue/Collection.php b/app/code/Magento/Newsletter/Model/ResourceModel/Queue/Collection.php index 52009dad6614b..1fc68771e74cb 100644 --- a/app/code/Magento/Newsletter/Model/ResourceModel/Queue/Collection.php +++ b/app/code/Magento/Newsletter/Model/ResourceModel/Queue/Collection.php @@ -208,6 +208,31 @@ public function addSubscriberFilter($subscriberId) return $this; } + /** + * Set filter for queue by customer + * + * @param int $customerId + * @return $this + */ + public function addCustomerFilter(int $customerId): self + { + $this->getSelect() + ->join( + ['link' => $this->getTable('newsletter_queue_link')], + 'main_table.queue_id=link.queue_id', + ['letter_sent_at'] + )->join( + ['subscriber' => $this->getTable('newsletter_subscriber')], + 'link.subscriber_id=subscriber.subscriber_id', + ['subscriber_store_id' => 'subscriber.store_id'] + )->where( + 'subscriber.customer_id = ?', + $customerId + ); + + return $this; + } + /** * Add filter by only ready for sending item * diff --git a/app/code/Magento/Newsletter/Model/ResourceModel/Subscriber.php b/app/code/Magento/Newsletter/Model/ResourceModel/Subscriber.php index 8ca489d89c1df..6391219e23c7e 100644 --- a/app/code/Magento/Newsletter/Model/ResourceModel/Subscriber.php +++ b/app/code/Magento/Newsletter/Model/ResourceModel/Subscriber.php @@ -5,23 +5,30 @@ */ namespace Magento\Newsletter\Model\ResourceModel; +use Magento\Customer\Api\Data\CustomerInterface; use Magento\Framework\App\ObjectManager; +use Magento\Framework\DB\Adapter\AdapterInterface; +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Math\Random; +use Magento\Framework\Model\ResourceModel\Db\AbstractDb; +use Magento\Framework\Model\ResourceModel\Db\Context; +use Magento\Framework\Stdlib\DateTime\DateTime; +use Magento\Newsletter\Model\Subscriber as SubscriberModel; use Magento\Store\Model\StoreManagerInterface; /** * Newsletter subscriber resource model * - * @author Magento Core Team <core@magentocommerce.com> - * + * @author Magento Core Team <core@magentocommerce.com> * @api * @since 100.0.2 */ -class Subscriber extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb +class Subscriber extends AbstractDb { /** * DB connection * - * @var \Magento\Framework\DB\Adapter\AdapterInterface + * @var AdapterInterface */ protected $connection; @@ -42,12 +49,12 @@ class Subscriber extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb /** * Date * - * @var \Magento\Framework\Stdlib\DateTime\DateTime + * @var DateTime */ protected $_date; /** - * @var \Magento\Framework\Math\Random + * @var Random */ protected $mathRandom; @@ -61,16 +68,16 @@ class Subscriber extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb /** * Construct * - * @param \Magento\Framework\Model\ResourceModel\Db\Context $context - * @param \Magento\Framework\Stdlib\DateTime\DateTime $date - * @param \Magento\Framework\Math\Random $mathRandom + * @param Context $context + * @param DateTime $date + * @param Random $mathRandom * @param string $connectionName * @param StoreManagerInterface $storeManager */ public function __construct( - \Magento\Framework\Model\ResourceModel\Db\Context $context, - \Magento\Framework\Stdlib\DateTime\DateTime $date, - \Magento\Framework\Math\Random $mathRandom, + Context $context, + DateTime $date, + Random $mathRandom, $connectionName = null, StoreManagerInterface $storeManager = null ) { @@ -104,65 +111,51 @@ public function setMessagesScope($scope) } /** - * Load subscriber from DB by email + * Load by subscriber email * - * @param string $subscriberEmail + * @param string $email + * @param int $websiteId * @return array */ - public function loadByEmail($subscriberEmail) + public function loadBySubscriberEmail(string $email, int $websiteId): array { - $select = $this->connection->select()->from($this->getMainTable())->where('subscriber_email=:subscriber_email'); - - $result = $this->connection->fetchRow($select, ['subscriber_email' => $subscriberEmail]); - - if (!$result) { + $storeIds = $this->storeManager->getWebsite($websiteId)->getStoreIds(); + $select = $this->connection->select() + ->from($this->getMainTable()) + ->where('subscriber_email = ?', $email) + ->where('store_id IN (?)', $storeIds) + ->limit(1); + + $data = $this->connection->fetchRow($select); + if (!$data) { return []; } - return $result; + return $data; } /** - * Load subscriber by customer + * Load by customer id * - * @param \Magento\Customer\Api\Data\CustomerInterface $customer + * @param int $customerId + * @param int $websiteId * @return array */ - public function loadByCustomerData(\Magento\Customer\Api\Data\CustomerInterface $customer) + public function loadByCustomerId(int $customerId, int $websiteId): array { - $storeIds = $this->storeManager->getWebsite()->getStoreIds(); - - if ($customer->getId()) { - $select = $this->connection - ->select() - ->from($this->getMainTable()) - ->where('customer_id = ?', $customer->getId()) - ->where('store_id IN (?)', $storeIds) - ->limit(1); - - $result = $this->connection->fetchRow($select); - - if ($result) { - return $result; - } - } - - if ($customer->getEmail()) { - $select = $this->connection - ->select() - ->from($this->getMainTable()) - ->where('subscriber_email = ?', $customer->getEmail()) - ->where('store_id IN (?)', $storeIds) - ->limit(1); - - $result = $this->connection->fetchRow($select); - - if ($result) { - return $result; - } + $storeIds = $this->storeManager->getWebsite($websiteId)->getStoreIds(); + $select = $this->connection->select() + ->from($this->getMainTable()) + ->where('customer_id = ?', $customerId) + ->where('store_id IN (?)', $storeIds) + ->limit(1); + + $data = $this->connection->fetchRow($select); + if (!$data) { + return []; } - return []; + return $data; } /** @@ -178,12 +171,12 @@ protected function _generateRandomCode() /** * Updates data when subscriber received * - * @param \Magento\Newsletter\Model\Subscriber $subscriber + * @param SubscriberModel $subscriber * @param \Magento\Newsletter\Model\Queue $queue * @return $this - * @throws \Magento\Framework\Exception\LocalizedException + * @throws LocalizedException */ - public function received(\Magento\Newsletter\Model\Subscriber $subscriber, \Magento\Newsletter\Model\Queue $queue) + public function received(SubscriberModel $subscriber, \Magento\Newsletter\Model\Queue $queue) { $this->connection->beginTransaction(); try { @@ -196,8 +189,41 @@ public function received(\Magento\Newsletter\Model\Subscriber $subscriber, \Mage $this->connection->commit(); } catch (\Exception $e) { $this->connection->rollBack(); - throw new \Magento\Framework\Exception\LocalizedException(__('We cannot mark as received subscriber.')); + throw new LocalizedException(__('We cannot mark as received subscriber.')); } return $this; } + + /** + * Load subscriber from DB by email + * + * @param string $subscriberEmail + * @return array + * @deprecated The subscription should be loaded by website id + * @see loadBySubscriberEmail + */ + public function loadByEmail($subscriberEmail) + { + $websiteId = (int)$this->storeManager->getWebsite()->getId(); + return $this->loadBySubscriberEmail((string)$subscriberEmail, $websiteId); + } + + /** + * Load subscriber by customer + * + * @param CustomerInterface $customer + * @return array + * @deprecated The subscription should be loaded by website id + * @see loadByCustomerId + */ + public function loadByCustomerData(CustomerInterface $customer) + { + $websiteId = (int)$this->storeManager->getWebsite()->getId(); + $data = $this->loadByCustomerId((int)$customer->getId(), $websiteId); + if (empty($data)) { + $data = $this->loadBySubscriberEmail((string)$customer->getEmail(), $websiteId); + } + + return $data; + } } diff --git a/app/code/Magento/Newsletter/Model/Subscriber.php b/app/code/Magento/Newsletter/Model/Subscriber.php index 5df9feacf654b..f33b9929435c3 100644 --- a/app/code/Magento/Newsletter/Model/Subscriber.php +++ b/app/code/Magento/Newsletter/Model/Subscriber.php @@ -9,9 +9,23 @@ use Magento\Customer\Api\CustomerRepositoryInterface; use Magento\Customer\Api\Data\CustomerInterfaceFactory; use Magento\Framework\Api\DataObjectHelper; +use Magento\Framework\App\Area; +use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\App\ObjectManager; -use Magento\Framework\Exception\MailException; +use Magento\Framework\Data\Collection\AbstractDb; +use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Mail\Template\TransportBuilder; +use Magento\Framework\Math\Random; +use Magento\Framework\Model\AbstractModel; +use Magento\Framework\Model\Context; +use Magento\Framework\Model\ResourceModel\AbstractResource; +use Magento\Framework\Registry; +use Magento\Framework\Stdlib\DateTime\DateTime; +use Magento\Framework\Translate\Inline\StateInterface; +use Magento\Newsletter\Helper\Data; +use Magento\Store\Model\ScopeInterface; +use Magento\Store\Model\StoreManagerInterface; /** * Subscriber model @@ -33,12 +47,11 @@ * * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) - * @SuppressWarnings(PHPMD.CyclomaticComplexity) * * @api * @since 100.0.2 */ -class Subscriber extends \Magento\Framework\Model\AbstractModel +class Subscriber extends AbstractModel { const STATUS_SUBSCRIBED = 1; const STATUS_NOT_ACTIVE = 2; @@ -80,14 +93,14 @@ class Subscriber extends \Magento\Framework\Model\AbstractModel /** * Newsletter data * - * @var \Magento\Newsletter\Helper\Data + * @var Data */ protected $_newsletterData = null; /** * Core store config * - * @var \Magento\Framework\App\Config\ScopeConfigInterface + * @var ScopeConfigInterface */ protected $_scopeConfig; @@ -100,14 +113,14 @@ class Subscriber extends \Magento\Framework\Model\AbstractModel /** * Date - * @var \Magento\Framework\Stdlib\DateTime\DateTime + * @var DateTime */ private $dateTime; /** * Store manager * - * @var \Magento\Store\Model\StoreManagerInterface + * @var StoreManagerInterface */ protected $_storeManager; @@ -122,12 +135,12 @@ class Subscriber extends \Magento\Framework\Model\AbstractModel protected $customerAccountManagement; /** - * @var \Magento\Framework\Mail\Template\TransportBuilder + * @var TransportBuilder */ protected $_transportBuilder; /** - * @var \Magento\Framework\Translate\Inline\StateInterface + * @var StateInterface */ protected $inlineTranslation; @@ -142,51 +155,56 @@ class Subscriber extends \Magento\Framework\Model\AbstractModel private $dataObjectHelper; /** - * Initialize dependencies. - * - * @param \Magento\Framework\Model\Context $context - * @param \Magento\Framework\Registry $registry - * @param \Magento\Newsletter\Helper\Data $newsletterData - * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig - * @param \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder - * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @var SubscriptionManagerInterface + */ + private $subscriptionManager; + + /** + * @param Context $context + * @param Registry $registry + * @param Data $newsletterData + * @param ScopeConfigInterface $scopeConfig + * @param TransportBuilder $transportBuilder + * @param StoreManagerInterface $storeManager * @param \Magento\Customer\Model\Session $customerSession * @param CustomerRepositoryInterface $customerRepository * @param AccountManagementInterface $customerAccountManagement - * @param \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation - * @param \Magento\Framework\Model\ResourceModel\AbstractResource|null $resource - * @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection + * @param StateInterface $inlineTranslation + * @param AbstractResource|null $resource + * @param AbstractDb|null $resourceCollection * @param array $data - * @param \Magento\Framework\Stdlib\DateTime\DateTime|null $dateTime + * @param DateTime|null $dateTime * @param CustomerInterfaceFactory|null $customerFactory * @param DataObjectHelper|null $dataObjectHelper + * @param SubscriptionManagerInterface|null $subscriptionManager * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Framework\Model\Context $context, - \Magento\Framework\Registry $registry, - \Magento\Newsletter\Helper\Data $newsletterData, - \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, - \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder, - \Magento\Store\Model\StoreManagerInterface $storeManager, + Context $context, + Registry $registry, + Data $newsletterData, + ScopeConfigInterface $scopeConfig, + TransportBuilder $transportBuilder, + StoreManagerInterface $storeManager, \Magento\Customer\Model\Session $customerSession, CustomerRepositoryInterface $customerRepository, AccountManagementInterface $customerAccountManagement, - \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation, - \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, - \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, + StateInterface $inlineTranslation, + AbstractResource $resource = null, + AbstractDb $resourceCollection = null, array $data = [], - \Magento\Framework\Stdlib\DateTime\DateTime $dateTime = null, + DateTime $dateTime = null, CustomerInterfaceFactory $customerFactory = null, - DataObjectHelper $dataObjectHelper = null + DataObjectHelper $dataObjectHelper = null, + SubscriptionManagerInterface $subscriptionManager = null ) { $this->_newsletterData = $newsletterData; $this->_scopeConfig = $scopeConfig; $this->_transportBuilder = $transportBuilder; $this->_storeManager = $storeManager; $this->_customerSession = $customerSession; - $this->dateTime = $dateTime ?: \Magento\Framework\App\ObjectManager::getInstance()->get( - \Magento\Framework\Stdlib\DateTime\DateTime::class + $this->dateTime = $dateTime ?: ObjectManager::getInstance()->get( + DateTime::class ); $this->customerFactory = $customerFactory ?: ObjectManager::getInstance() ->get(CustomerInterfaceFactory::class); @@ -195,6 +213,8 @@ public function __construct( $this->customerRepository = $customerRepository; $this->customerAccountManagement = $customerAccountManagement; $this->inlineTranslation = $inlineTranslation; + $this->subscriptionManager = $subscriptionManager ?: ObjectManager::getInstance() + ->get(SubscriptionManagerInterface::class); parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -205,7 +225,7 @@ public function __construct( */ protected function _construct() { - $this->_init(\Magento\Newsletter\Model\ResourceModel\Subscriber::class); + $this->_init(ResourceModel\Subscriber::class); } /** @@ -357,51 +377,38 @@ public function isSubscribed() } /** - * Load subscriber data from resource model by email + * Load by subscriber email * - * @param string $subscriberEmail + * @param string $email + * @param int $websiteId * @return $this */ - public function loadByEmail($subscriberEmail) + public function loadBySubscriberEmail(string $email, int $websiteId): Subscriber { - $storeId = $this->_storeManager->getStore()->getId(); - $customerData = ['store_id' => $storeId, 'email'=> $subscriberEmail]; + /** @var ResourceModel\Subscriber $resource */ + $resource = $this->getResource(); + $data = $resource->loadBySubscriberEmail($email, $websiteId); + $this->addData($data); + $this->setOrigData(); - /** @var \Magento\Customer\Api\Data\CustomerInterface $customer */ - $customer = $this->customerFactory->create(); - $this->dataObjectHelper->populateWithArray( - $customer, - $customerData, - \Magento\Customer\Api\Data\CustomerInterface::class - ); - $this->addData($this->getResource()->loadByCustomerData($customer)); return $this; } /** - * Load subscriber info by customerId + * Load by customer id * * @param int $customerId + * @param int $websiteId * @return $this */ - public function loadByCustomerId($customerId) + public function loadByCustomer(int $customerId, int $websiteId): Subscriber { - try { - $customerData = $this->customerRepository->getById($customerId); - $customerData->setStoreId($this->_storeManager->getStore()->getId()); - if ($customerData->getWebsiteId() === null) { - $customerData->setWebsiteId($this->_storeManager->getStore()->getWebsiteId()); - } - $data = $this->getResource()->loadByCustomerData($customerData); - $this->addData($data); - if (!empty($data) && $customerData->getId() && !$this->getCustomerId()) { - $this->setCustomerId($customerData->getId()); - $this->setSubscriberConfirmCode($this->randomSequence()); - $this->save(); - } - // phpcs:ignore Magento2.CodeAnalysis.EmptyBlock - } catch (NoSuchEntityException $e) { - } + /** @var ResourceModel\Subscriber $resource */ + $resource = $this->getResource(); + $data = $resource->loadByCustomerId($customerId, $websiteId); + $this->addData($data); + $this->setOrigData(); + return $this; } @@ -418,95 +425,23 @@ public function randomSequence($length = 32) $char = array_merge(range('a', 'z'), range(0, 9)); $charLen = count($char) - 1; for ($i = 0; $i < $length; $i++) { - $disc = \Magento\Framework\Math\Random::getRandomNumber(0, $charLen); + $disc = Random::getRandomNumber(0, $charLen); $par[$i] = $char[$disc]; $id = $id . $char[$disc]; } return $id; } - /** - * Subscribes by email - * - * @param string $email - * @throws \Exception - * @return int - * - * @SuppressWarnings(PHPMD.CyclomaticComplexity) - * @SuppressWarnings(PHPMD.NPathComplexity) - */ - public function subscribe($email) - { - $this->loadByEmail($email); - - if ($this->getId() && $this->getStatus() == self::STATUS_SUBSCRIBED) { - return $this->getStatus(); - } - - if (!$this->getId()) { - $this->setSubscriberConfirmCode($this->randomSequence()); - } - - $isConfirmNeed = $this->_scopeConfig->getValue( - self::XML_PATH_CONFIRMATION_FLAG, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ) == 1 ? true : false; - - $isSubscribeOwnEmail = $this->_customerSession->isLoggedIn() - && $this->_customerSession->getCustomerDataObject()->getEmail() == $email; - - if (!$this->getId() || $this->getStatus() == self::STATUS_UNSUBSCRIBED - || $this->getStatus() == self::STATUS_NOT_ACTIVE - ) { - if ($isConfirmNeed === true) { - $this->setStatus(self::STATUS_NOT_ACTIVE); - } else { - $this->setStatus(self::STATUS_SUBSCRIBED); - } - $this->setSubscriberEmail($email); - } - - if ($isSubscribeOwnEmail) { - try { - $customer = $this->customerRepository->getById($this->_customerSession->getCustomerId()); - $this->setStoreId($customer->getStoreId()); - $this->setCustomerId($customer->getId()); - } catch (NoSuchEntityException $e) { - $this->setStoreId($this->_storeManager->getStore()->getId()); - $this->setCustomerId(0); - } - } else { - $this->setStoreId($this->_storeManager->getStore()->getId()); - $this->setCustomerId(0); - } - - $this->setStatusChanged(true); - - try { - /* Save model before sending out email */ - $this->save(); - if ($isConfirmNeed === true) { - $this->sendConfirmationRequestEmail(); - } else { - $this->sendConfirmationSuccessEmail(); - } - return $this->getStatus(); - } catch (\Exception $e) { - // phpcs:ignore Magento2.Exceptions.DirectThrow - throw new \Exception($e->getMessage()); - } - } - /** * Unsubscribes loaded subscription * - * @throws \Magento\Framework\Exception\LocalizedException + * @throws LocalizedException * @return $this */ public function unsubscribe() { if ($this->hasCheckCode() && $this->getCode() != $this->getCheckCode()) { - throw new \Magento\Framework\Exception\LocalizedException( + throw new LocalizedException( __('This is an invalid subscription confirmation code.') ); } @@ -518,149 +453,6 @@ public function unsubscribe() return $this; } - /** - * Subscribe the customer with the id provided - * - * @param int $customerId - * @return $this - */ - public function subscribeCustomerById($customerId) - { - return $this->_updateCustomerSubscription($customerId, true); - } - - /** - * Unsubscribe the customer with the id provided - * - * @param int $customerId - * @return $this - */ - public function unsubscribeCustomerById($customerId) - { - return $this->_updateCustomerSubscription($customerId, false); - } - - /** - * Update the subscription based on latest information of associated customer. - * - * @param int $customerId - * @return $this - */ - public function updateSubscription($customerId) - { - $this->loadByCustomerId($customerId); - $this->_updateCustomerSubscription($customerId, $this->isSubscribed()); - return $this; - } - - /** - * Saving customer subscription status - * - * @param int $customerId - * @param bool $subscribe indicates whether the customer should be subscribed or unsubscribed - * @return $this - * - * @SuppressWarnings(PHPMD.CyclomaticComplexity) - * @SuppressWarnings(PHPMD.NPathComplexity) - */ - protected function _updateCustomerSubscription($customerId, $subscribe) - { - try { - $customerData = $this->customerRepository->getById($customerId); - } catch (NoSuchEntityException $e) { - return $this; - } - - $this->loadByCustomerId($customerId); - if (!$subscribe && !$this->getId()) { - return $this; - } - - if (!$this->getId()) { - $this->setSubscriberConfirmCode($this->randomSequence()); - } - - $sendInformationEmail = false; - $status = self::STATUS_SUBSCRIBED; - $isConfirmNeed = $this->_scopeConfig->getValue( - self::XML_PATH_CONFIRMATION_FLAG, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ) == 1 ? true : false; - if ($subscribe) { - if (AccountManagementInterface::ACCOUNT_CONFIRMATION_REQUIRED - == $this->customerAccountManagement->getConfirmationStatus($customerId) - ) { - if ($this->getId() && $this->getStatus() == self::STATUS_SUBSCRIBED) { - // if a customer was already subscribed then keep the subscribed - $status = self::STATUS_SUBSCRIBED; - } else { - $status = self::STATUS_UNCONFIRMED; - } - } elseif ($isConfirmNeed) { - if ($this->getStatus() != self::STATUS_SUBSCRIBED) { - $status = self::STATUS_NOT_ACTIVE; - } - } - } elseif (($this->getStatus() == self::STATUS_UNCONFIRMED) && ($customerData->getConfirmation() === null)) { - $status = self::STATUS_SUBSCRIBED; - $sendInformationEmail = true; - } elseif (($this->getStatus() == self::STATUS_NOT_ACTIVE) && ($customerData->getConfirmation() === null)) { - $status = self::STATUS_NOT_ACTIVE; - } else { - $status = self::STATUS_UNSUBSCRIBED; - } - /** - * If subscription status has been changed then send email to the customer - */ - if ($status != self::STATUS_UNCONFIRMED && $status != $this->getStatus()) { - $sendInformationEmail = true; - } - - if ($status != $this->getStatus()) { - $this->setStatusChanged(true); - } - - $this->setStatus($status); - - $storeId = $customerData->getStoreId(); - if ((int)$customerData->getStoreId() === 0) { - $storeId = $this->_storeManager->getWebsite($customerData->getWebsiteId())->getDefaultStore()->getId(); - } - - if (!$this->getId()) { - $this->setStoreId($storeId) - ->setCustomerId($customerData->getId()) - ->setEmail($customerData->getEmail()); - } else { - $this->setStoreId($storeId) - ->setEmail($customerData->getEmail()); - } - - $this->save(); - $sendSubscription = $sendInformationEmail; - if ($sendSubscription === null xor $sendSubscription && $this->isStatusChanged()) { - try { - switch ($status) { - case self::STATUS_UNSUBSCRIBED: - $this->sendUnsubscriptionEmail(); - break; - case self::STATUS_SUBSCRIBED: - $this->sendConfirmationSuccessEmail(); - break; - case self::STATUS_NOT_ACTIVE: - if ($isConfirmNeed) { - $this->sendConfirmationRequestEmail(); - } - break; - } - } catch (MailException $e) { - // If we are not able to send a new account email, this should be ignored - $this->_logger->critical($e); - } - } - return $this; - } - /** * Confirms subscriber newsletter * @@ -684,10 +476,10 @@ public function confirm($code) /** * Mark receiving subscriber of queue newsletter * - * @param \Magento\Newsletter\Model\Queue $queue + * @param Queue $queue * @return Subscriber */ - public function received(\Magento\Newsletter\Model\Queue $queue) + public function received(Queue $queue) { $this->getResource()->received($this, $queue); return $this; @@ -700,54 +492,13 @@ public function received(\Magento\Newsletter\Model\Queue $queue) */ public function sendConfirmationRequestEmail() { - if ($this->getImportMode()) { - return $this; - } - - if (!$this->_scopeConfig->getValue( - self::XML_PATH_CONFIRM_EMAIL_TEMPLATE, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ) || !$this->_scopeConfig->getValue( - self::XML_PATH_CONFIRM_EMAIL_IDENTITY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ) - ) { - return $this; - } - - $this->inlineTranslation->suspend(); - - $this->_transportBuilder->setTemplateIdentifier( - $this->_scopeConfig->getValue( - self::XML_PATH_CONFIRM_EMAIL_TEMPLATE, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ) - )->setTemplateOptions( - [ - 'area' => \Magento\Framework\App\Area::AREA_FRONTEND, - 'store' => $this->_storeManager->getStore()->getId(), - ] - )->setTemplateVars( - [ - 'subscriber' => $this, - 'store' => $this->_storeManager->getStore(), - 'subscriber_data' => [ - 'confirmation_link' => $this->getConfirmationLink(), - ], - ] - )->setFrom( - $this->_scopeConfig->getValue( - self::XML_PATH_CONFIRM_EMAIL_IDENTITY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ) - )->addTo( - $this->getEmail(), - $this->getName() - ); - $transport = $this->_transportBuilder->getTransport(); - $transport->sendMessage(); - - $this->inlineTranslation->resume(); + $vars = [ + 'store' => $this->_storeManager->getStore($this->getStoreId()), + 'subscriber_data' => [ + 'confirmation_link' => $this->getConfirmationLink(), + ], + ]; + $this->sendEmail(self::XML_PATH_CONFIRM_EMAIL_TEMPLATE, self::XML_PATH_CONFIRM_EMAIL_IDENTITY, $vars); return $this; } @@ -759,48 +510,7 @@ public function sendConfirmationRequestEmail() */ public function sendConfirmationSuccessEmail() { - if ($this->getImportMode()) { - return $this; - } - - if (!$this->_scopeConfig->getValue( - self::XML_PATH_SUCCESS_EMAIL_TEMPLATE, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ) || !$this->_scopeConfig->getValue( - self::XML_PATH_SUCCESS_EMAIL_IDENTITY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ) - ) { - return $this; - } - - $this->inlineTranslation->suspend(); - - $this->_transportBuilder->setTemplateIdentifier( - $this->_scopeConfig->getValue( - self::XML_PATH_SUCCESS_EMAIL_TEMPLATE, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ) - )->setTemplateOptions( - [ - 'area' => \Magento\Framework\App\Area::AREA_FRONTEND, - 'store' => $this->_storeManager->getStore()->getId(), - ] - )->setTemplateVars( - ['subscriber' => $this] - )->setFrom( - $this->_scopeConfig->getValue( - self::XML_PATH_SUCCESS_EMAIL_IDENTITY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ) - )->addTo( - $this->getEmail(), - $this->getName() - ); - $transport = $this->_transportBuilder->getTransport(); - $transport->sendMessage(); - - $this->inlineTranslation->resume(); + $this->sendEmail(self::XML_PATH_SUCCESS_EMAIL_TEMPLATE, self::XML_PATH_SUCCESS_EMAIL_IDENTITY); return $this; } @@ -811,40 +521,45 @@ public function sendConfirmationSuccessEmail() * @return $this */ public function sendUnsubscriptionEmail() + { + $this->sendEmail(self::XML_PATH_UNSUBSCRIBE_EMAIL_TEMPLATE, self::XML_PATH_UNSUBSCRIBE_EMAIL_IDENTITY); + + return $this; + } + + /** + * Send email about change status + * + * @param string $emailTemplatePath + * @param string $emailIdentityPath + * @param array $templateVars + * @return void + */ + private function sendEmail(string $emailTemplatePath, string $emailIdentityPath, array $templateVars = []): void { if ($this->getImportMode()) { - return $this; + return; } - if (!$this->_scopeConfig->getValue( - self::XML_PATH_UNSUBSCRIBE_EMAIL_TEMPLATE, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ) || !$this->_scopeConfig->getValue( - self::XML_PATH_UNSUBSCRIBE_EMAIL_IDENTITY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ) - ) { - return $this; + + $template = $this->_scopeConfig->getValue($emailTemplatePath, ScopeInterface::SCOPE_STORE, $this->getStoreId()); + $identity = $this->_scopeConfig->getValue($emailIdentityPath, ScopeInterface::SCOPE_STORE, $this->getStoreId()); + if (!$template || !$identity) { + return; } + $templateVars += ['subscriber' => $this]; $this->inlineTranslation->suspend(); - $this->_transportBuilder->setTemplateIdentifier( - $this->_scopeConfig->getValue( - self::XML_PATH_UNSUBSCRIBE_EMAIL_TEMPLATE, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ) + $template )->setTemplateOptions( [ - 'area' => \Magento\Framework\App\Area::AREA_FRONTEND, - 'store' => $this->_storeManager->getStore()->getId(), + 'area' => Area::AREA_FRONTEND, + 'store' => $this->getStoreId(), ] )->setTemplateVars( - ['subscriber' => $this] + $templateVars )->setFrom( - $this->_scopeConfig->getValue( - self::XML_PATH_UNSUBSCRIBE_EMAIL_IDENTITY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ) + $identity )->addTo( $this->getEmail(), $this->getName() @@ -853,8 +568,6 @@ public function sendUnsubscriptionEmail() $transport->sendMessage(); $this->inlineTranslation->resume(); - - return $this; } /** @@ -884,4 +597,125 @@ public function beforeSave() } return $this; } + + /** + * Load subscriber data from resource model by email + * + * @param string $subscriberEmail + * @return $this + * @deprecated The subscription should be loaded by website id + * @see loadBySubscriberEmail + */ + public function loadByEmail($subscriberEmail) + { + $websiteId = (int)$this->_storeManager->getStore()->getWebsiteId(); + $this->loadBySubscriberEmail($subscriberEmail, $websiteId); + + return $this; + } + + /** + * Load subscriber info by customerId + * + * @param int $customerId + * @return $this + * @deprecated The subscription should be loaded by website id + * @see loadByCustomer + */ + public function loadByCustomerId($customerId) + { + try { + $customer = $this->customerRepository->getById($customerId); + $websiteId = (int)$this->_storeManager->getStore()->getWebsiteId(); + $this->loadByCustomer((int)$customerId, $websiteId); + if ($customer->getId() && !$this->getCustomerId()) { + $this->setCustomerId($customer->getId()); + $this->setSubscriberConfirmCode($this->randomSequence()); + $this->save(); + } + // phpcs:ignore Magento2.CodeAnalysis.EmptyBlock + } catch (NoSuchEntityException $e) { + } + return $this; + } + + /** + * Subscribes by email + * + * @param string $email + * @return int + * @deprecated The subscription should be updated by store id + * @see \Magento\Newsletter\Model\SubscriptionManager::subscribe + */ + public function subscribe($email) + { + $storeId = (int)$this->_storeManager->getStore()->getId(); + $subscriber = $this->subscriptionManager->subscribe($email, $storeId); + $this->addData($subscriber->getData()); + + return $this->getStatus(); + } + + /** + * Subscribe the customer with the id provided + * + * @param int $customerId + * @return $this + * @deprecated The subscription should be updated by store id + * @see \Magento\Newsletter\Model\SubscriptionManager::subscribeCustomer + */ + public function subscribeCustomerById($customerId) + { + return $this->_updateCustomerSubscription($customerId, true); + } + + /** + * Unsubscribe the customer with the id provided + * + * @param int $customerId + * @return $this + * @deprecated The subscription should be updated by store id + * @see \Magento\Newsletter\Model\SubscriptionManager::unsubscribeCustomer + */ + public function unsubscribeCustomerById($customerId) + { + return $this->_updateCustomerSubscription($customerId, false); + } + + /** + * Update the subscription based on latest information of associated customer. + * + * @param int $customerId + * @return $this + * @deprecated The subscription should be updated by store id + * @see \Magento\Newsletter\Model\SubscriptionManager::subscribeCustomer + */ + public function updateSubscription($customerId) + { + $this->loadByCustomerId($customerId); + $this->_updateCustomerSubscription($customerId, $this->isSubscribed()); + return $this; + } + + /** + * Saving customer subscription status + * + * @param int $customerId + * @param bool $subscribe indicates whether the customer should be subscribed or unsubscribed + * @return $this + * @deprecated The subscription should be updated by store id + * @see \Magento\Newsletter\Model\SubscriptionManager::subscribeCustomer + */ + protected function _updateCustomerSubscription($customerId, $subscribe) + { + $storeId = (int)$this->_storeManager->getStore()->getId(); + if ($subscribe) { + $subscriber = $this->subscriptionManager->subscribeCustomer((int)$customerId, $storeId); + } else { + $subscriber = $this->subscriptionManager->unsubscribeCustomer((int)$customerId, $storeId); + } + $this->addData($subscriber->getData()); + + return $this; + } } diff --git a/app/code/Magento/Newsletter/Model/SubscriptionManager.php b/app/code/Magento/Newsletter/Model/SubscriptionManager.php new file mode 100644 index 0000000000000..846d095625e0c --- /dev/null +++ b/app/code/Magento/Newsletter/Model/SubscriptionManager.php @@ -0,0 +1,314 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Newsletter\Model; + +use Magento\Customer\Api\AccountManagementInterface; +use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Customer\Api\Data\CustomerInterface; +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\Exception\MailException; +use Magento\Store\Model\ScopeInterface; +use Magento\Store\Model\StoreManagerInterface; +use Psr\Log\LoggerInterface; + +/** + * Class to update newsletter subscription status + */ +class SubscriptionManager implements SubscriptionManagerInterface +{ + /** + * @var SubscriberFactory + */ + private $subscriberFactory; + + /** + * @var LoggerInterface + */ + private $logger; + + /** + * @var StoreManagerInterface + */ + private $storeManager; + + /** + * @var ScopeConfigInterface + */ + private $scopeConfig; + + /** + * @var AccountManagementInterface + */ + private $customerAccountManagement; + + /** + * @var CustomerRepositoryInterface + */ + private $customerRepository; + + /** + * @param SubscriberFactory $subscriberFactory + * @param LoggerInterface $logger + * @param StoreManagerInterface $storeManager + * @param ScopeConfigInterface $scopeConfig + * @param AccountManagementInterface $customerAccountManagement + * @param CustomerRepositoryInterface $customerRepository + */ + public function __construct( + SubscriberFactory $subscriberFactory, + LoggerInterface $logger, + StoreManagerInterface $storeManager, + ScopeConfigInterface $scopeConfig, + AccountManagementInterface $customerAccountManagement, + CustomerRepositoryInterface $customerRepository + ) { + $this->subscriberFactory = $subscriberFactory; + $this->logger = $logger; + $this->storeManager = $storeManager; + $this->scopeConfig = $scopeConfig; + $this->customerAccountManagement = $customerAccountManagement; + $this->customerRepository = $customerRepository; + } + + /** + * @inheritdoc + */ + public function subscribe(string $email, int $storeId): Subscriber + { + $websiteId = (int)$this->storeManager->getStore($storeId)->getWebsiteId(); + $subscriber = $this->subscriberFactory->create()->loadBySubscriberEmail($email, $websiteId); + $currentStatus = (int)$subscriber->getStatus(); + if ($currentStatus === Subscriber::STATUS_SUBSCRIBED) { + return $subscriber; + } + + $status = $this->isConfirmNeed($storeId) ? Subscriber::STATUS_NOT_ACTIVE : Subscriber::STATUS_SUBSCRIBED; + if (!$subscriber->getId()) { + $subscriber->setSubscriberConfirmCode($subscriber->randomSequence()); + $subscriber->setSubscriberEmail($email); + } + $subscriber->setStatus($status) + ->setStoreId($storeId) + ->save(); + + $this->sendEmailAfterChangeStatus($subscriber); + + return $subscriber; + } + + /** + * @inheritdoc + */ + public function unsubscribe(string $email, int $storeId, string $confirmCode): Subscriber + { + $websiteId = (int)$this->storeManager->getStore($storeId)->getWebsiteId(); + /** @var Subscriber $subscriber */ + $subscriber = $this->subscriberFactory->create()->loadBySubscriberEmail($email, $websiteId); + if (!$subscriber->getId()) { + return $subscriber; + } + $subscriber->setCheckCode($confirmCode); + $subscriber->unsubscribe(); + + return $subscriber; + } + + /** + * @inheritdoc + */ + public function subscribeCustomer(int $customerId, int $storeId): Subscriber + { + return $this->updateCustomerSubscription($customerId, $storeId, true); + } + + /** + * @inheritdoc + */ + public function unsubscribeCustomer(int $customerId, int $storeId): Subscriber + { + return $this->updateCustomerSubscription($customerId, $storeId, false); + } + + /** + * Update customer newsletter subscription + * + * @param int $customerId + * @param int $storeId + * @param bool $status + * @return Subscriber + */ + private function updateCustomerSubscription(int $customerId, int $storeId, bool $status): Subscriber + { + $customer = $this->customerRepository->getById($customerId); + $websiteId = (int)$this->storeManager->getStore($storeId)->getWebsiteId(); + $subscriber = $this->loadSubscriberByCustomer($customer, $websiteId); + if (!$status && !$subscriber->getId()) { + return $subscriber; + } + + $newStatus = $this->getNewSubscriptionStatus($subscriber, $customer, $storeId, $status); + $needToSendLetter = $this->saveSubscriber($subscriber, $customer, $storeId, $newStatus); + if ($needToSendLetter) { + $this->sendEmailAfterChangeStatus($subscriber); + } + + return $subscriber; + } + + /** + * Load subscriber model by customer + * + * @param CustomerInterface $customer + * @param int $websiteId + * @return Subscriber + */ + private function loadSubscriberByCustomer(CustomerInterface $customer, int $websiteId): Subscriber + { + $subscriber = $this->subscriberFactory->create(); + $subscriber->loadByCustomer((int)$customer->getId(), $websiteId); + if (!$subscriber->getId()) { + $subscriber->loadBySubscriberEmail((string)$customer->getEmail(), $websiteId); + } + + return $subscriber; + } + + /** + * Save Subscriber model + * + * @param Subscriber $subscriber + * @param CustomerInterface $customer + * @param int $storeId + * @param int $status + * @return bool Need to send email + */ + private function saveSubscriber( + Subscriber $subscriber, + CustomerInterface $customer, + int $storeId, + int $status + ): bool { + $statusChanged = (int)$subscriber->getStatus() !== $status; + $emailChanged = $subscriber->getEmail() !== $customer->getEmail(); + if ($subscriber->getId() + && !$statusChanged + && (int)$subscriber->getCustomerId() === (int)$customer->getId() + && (int)$subscriber->getStoreId() === $storeId + && !$emailChanged + ) { + return false; + } + + if (!$subscriber->getId()) { + $subscriber->setSubscriberConfirmCode($subscriber->randomSequence()); + } + $subscriber->setStatus($status) + ->setStatusChanged($statusChanged) + ->setCustomerId($customer->getId()) + ->setStoreId($storeId) + ->setEmail($customer->getEmail()) + ->save(); + + if ($statusChanged) { + return true; + } + + /** + * If the subscriber is waiting to confirm from the customer + * and customer changed the email + * than need to send confirmation letter to the new email + */ + return $status === Subscriber::STATUS_NOT_ACTIVE && $emailChanged; + } + + /** + * Get new subscription status + * + * @param Subscriber $subscriber + * @param CustomerInterface $customer + * @param int $storeId + * @param bool $subscribe + * @return int + */ + private function getNewSubscriptionStatus( + Subscriber $subscriber, + CustomerInterface $customer, + int $storeId, + bool $subscribe + ): int { + $currentStatus = (int)$subscriber->getStatus(); + // If the current status is already as needed then return them + if (($subscribe && $currentStatus === Subscriber::STATUS_SUBSCRIBED) + || (!$subscribe && $currentStatus === Subscriber::STATUS_UNSUBSCRIBED) + ) { + return $currentStatus; + } + + $status = $currentStatus; + if ($subscribe) { + $customerConfirmStatus = $this->customerAccountManagement->getConfirmationStatus($customer->getId()); + if ($customerConfirmStatus === AccountManagementInterface::ACCOUNT_CONFIRMATION_REQUIRED) { + $status = Subscriber::STATUS_UNCONFIRMED; + } elseif ($this->isConfirmNeed($storeId)) { + $status = Subscriber::STATUS_NOT_ACTIVE; + } else { + $status = Subscriber::STATUS_SUBSCRIBED; + } + } elseif ($currentStatus === Subscriber::STATUS_SUBSCRIBED) { + $status = Subscriber::STATUS_UNSUBSCRIBED; + } + + return $status; + } + + /** + * Sends out email to customer after change subscription status + * + * @param Subscriber $subscriber + * @return void + */ + private function sendEmailAfterChangeStatus(Subscriber $subscriber): void + { + $status = (int)$subscriber->getStatus(); + if ($status === Subscriber::STATUS_UNCONFIRMED) { + return; + } + + try { + switch ($status) { + case Subscriber::STATUS_UNSUBSCRIBED: + $subscriber->sendUnsubscriptionEmail(); + break; + case Subscriber::STATUS_SUBSCRIBED: + $subscriber->sendConfirmationSuccessEmail(); + break; + case Subscriber::STATUS_NOT_ACTIVE: + $subscriber->sendConfirmationRequestEmail(); + break; + } + } catch (MailException $e) { + // If we are not able to send a new account email, this should be ignored + $this->logger->critical($e); + } + } + + /** + * Is need to confirm subscription + * + * @param int $storeId + * @return bool + */ + private function isConfirmNeed(int $storeId): bool + { + return (bool)$this->scopeConfig->isSetFlag( + Subscriber::XML_PATH_CONFIRMATION_FLAG, + ScopeInterface::SCOPE_STORE, + $storeId + ); + } +} diff --git a/app/code/Magento/Newsletter/Model/SubscriptionManagerInterface.php b/app/code/Magento/Newsletter/Model/SubscriptionManagerInterface.php new file mode 100644 index 0000000000000..8b92d825bdbcd --- /dev/null +++ b/app/code/Magento/Newsletter/Model/SubscriptionManagerInterface.php @@ -0,0 +1,51 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Newsletter\Model; + +/** + * Interface to update newsletter subscription status + */ +interface SubscriptionManagerInterface +{ + /** + * Subscribe to newsletters by email + * + * @param string $email + * @param int $storeId + * @return Subscriber + */ + public function subscribe(string $email, int $storeId): Subscriber; + + /** + * Unsubscribe from newsletters by email + * + * @param string $email + * @param int $storeId + * @param string $confirmCode + * @return Subscriber + */ + public function unsubscribe(string $email, int $storeId, string $confirmCode): Subscriber; + + /** + * Subscribe customer to newsletter + * + * @param int $customerId + * @param int $storeId + * @return Subscriber + */ + public function subscribeCustomer(int $customerId, int $storeId): Subscriber; + + /** + * Unsubscribe customer from newsletter + * + * @param int $customerId + * @param int $storeId + * @return Subscriber + */ + public function unsubscribeCustomer(int $customerId, int $storeId): Subscriber; +} diff --git a/app/code/Magento/Newsletter/Test/Unit/Model/Plugin/CustomerPluginTest.php b/app/code/Magento/Newsletter/Test/Unit/Model/Plugin/CustomerPluginTest.php index e809b7e37a432..52b3df8cb8aa6 100644 --- a/app/code/Magento/Newsletter/Test/Unit/Model/Plugin/CustomerPluginTest.php +++ b/app/code/Magento/Newsletter/Test/Unit/Model/Plugin/CustomerPluginTest.php @@ -5,149 +5,160 @@ */ namespace Magento\Newsletter\Test\Unit\Model\Plugin; +use Magento\Customer\Api\CustomerRepositoryInterface; use Magento\Customer\Api\Data\CustomerInterface; +use Magento\Customer\Model\Config\Share; use Magento\Customer\Model\ResourceModel\CustomerRepository; use Magento\Customer\Api\Data\CustomerExtensionInterface; use Magento\Framework\Api\ExtensionAttributesFactory; -use Magento\Newsletter\Model\ResourceModel\Subscriber; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Newsletter\Model\Plugin\CustomerPlugin; +use Magento\Newsletter\Model\ResourceModel\Subscriber\Collection; +use Magento\Newsletter\Model\ResourceModel\Subscriber\CollectionFactory; +use Magento\Newsletter\Model\Subscriber; +use Magento\Newsletter\Model\SubscriberFactory; +use Magento\Newsletter\Model\SubscriptionManagerInterface; +use Magento\Store\Api\Data\StoreInterface; +use Magento\Store\Model\StoreManagerInterface; +use Magento\Store\Model\Website; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; -class CustomerPluginTest extends \PHPUnit\Framework\TestCase +/** + * Class to test Newsletter Plugin for customer + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class CustomerPluginTest extends TestCase { /** - * @var \Magento\Newsletter\Model\Plugin\CustomerPlugin + * @var SubscriberFactory|MockObject */ - private $plugin; + private $subscriberFactory; /** - * @var \Magento\Newsletter\Model\SubscriberFactory|\PHPUnit_Framework_MockObject_MockObject + * @var ExtensionAttributesFactory|MockObject */ - private $subscriberFactory; + private $extensionFactory; /** - * @var \Magento\Newsletter\Model\Subscriber|\PHPUnit_Framework_MockObject_MockObject + * @var CollectionFactory|MockObject */ - private $subscriber; + private $collectionFactory; /** - * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager + * @var SubscriptionManagerInterface|MockObject */ - private $objectManager; + private $subscriptionManager; /** - * @var ExtensionAttributesFactory|\PHPUnit_Framework_MockObject_MockObject + * @var Share|MockObject */ - private $extensionFactoryMock; + private $shareConfig; /** - * @var CustomerExtensionInterface|\PHPUnit_Framework_MockObject_MockObject + * @var StoreManagerInterface|MockObject */ - private $customerExtensionMock; + private $storeManager; /** - * @var Subscriber|\PHPUnit_Framework_MockObject_MockObject + * @var ObjectManager */ - private $subscriberResourceMock; + private $objectManager; /** - * @var CustomerInterface|\PHPUnit_Framework_MockObject_MockObject + * @var CustomerPlugin */ - private $customerMock; + private $plugin; + /** + * @inheritdoc + */ protected function setUp() { - $this->subscriberFactory = $this->getMockBuilder(\Magento\Newsletter\Model\SubscriberFactory::class) - ->disableOriginalConstructor() - ->setMethods(['create']) - ->getMock(); - $this->subscriber = $this->getMockBuilder(\Magento\Newsletter\Model\Subscriber::class) - ->setMethods( - [ - 'loadByEmail', - 'getId', - 'delete', - 'updateSubscription', - 'subscribeCustomerById', - 'unsubscribeCustomerById', - 'isSubscribed', - ] - )->disableOriginalConstructor() - ->getMock(); - $this->extensionFactoryMock = $this->getMockBuilder(ExtensionAttributesFactory::class) - ->disableOriginalConstructor() - ->setMethods(['create']) - ->getMock(); - $this->customerExtensionMock = $this->getMockBuilder(CustomerExtensionInterface::class) - ->setMethods(['getIsSubscribed', 'setIsSubscribed']) - ->disableOriginalConstructor() - ->getMockForAbstractClass(); - $this->subscriberResourceMock = $this->getMockBuilder(Subscriber::class) - ->disableOriginalConstructor() - ->getMock(); - $this->customerMock = $this->getMockBuilder(CustomerInterface::class) - ->setMethods(['getExtensionAttributes']) - ->disableOriginalConstructor() - ->getMockForAbstractClass(); - $this->subscriberFactory->expects($this->any())->method('create')->willReturn($this->subscriber); - $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - + $this->subscriberFactory = $this->createMock(SubscriberFactory::class); + $this->extensionFactory = $this->createMock(ExtensionAttributesFactory::class); + $this->collectionFactory = $this->createMock(CollectionFactory::class); + $this->subscriptionManager = $this->createMock(SubscriptionManagerInterface::class); + $this->shareConfig = $this->createMock(Share::class); + $this->storeManager = $this->createMock(StoreManagerInterface::class); + $this->objectManager = new ObjectManager($this); $this->plugin = $this->objectManager->getObject( - \Magento\Newsletter\Model\Plugin\CustomerPlugin::class, + CustomerPlugin::class, [ 'subscriberFactory' => $this->subscriberFactory, - 'extensionFactory' => $this->extensionFactoryMock, - 'subscriberResource' => $this->subscriberResourceMock, + 'extensionFactory' => $this->extensionFactory, + 'collectionFactory' => $this->collectionFactory, + 'subscriptionManager' => $this->subscriptionManager, + 'shareConfig' => $this->shareConfig, + 'storeManager' => $this->storeManager, ] ); } /** - * @param bool $subscriptionOriginalValue - * @param bool $subscriptionNewValue + * Test to update customer subscription after save customer + * + * @param int|null $originalStatus + * @param bool|null $newValue + * @param bool|null $expectedSubscribe * @dataProvider afterSaveDataProvider - * @return void */ - public function testAfterSave($subscriptionOriginalValue, $subscriptionNewValue) + public function testAfterSave(?int $originalStatus, ?bool $newValue, ?bool $expectedSubscribe) { - $customerId = 1; - /** @var CustomerInterface | \PHPUnit_Framework_MockObject_MockObject $result */ - $result = $this->createMock(\Magento\Customer\Api\Data\CustomerInterface::class); - /** @var CustomerRepository | \PHPUnit_Framework_MockObject_MockObject $subject */ - $subject = $this->createMock(\Magento\Customer\Api\CustomerRepositoryInterface::class); + $storeId = 2; + $websiteId = 1; + $customerId = 3; + $customerEmail = 'email@example.com'; + + $store = $this->createMock(StoreInterface::class); + $store->method('getId')->willReturn($storeId); + $store->method('getWebsiteId')->willReturn($websiteId); + $this->storeManager->method('getStore')->willReturn($store); - /** @var CustomerExtensionInterface|\PHPUnit_Framework_MockObject_MockObject $resultExtensionAttributes */ - $resultExtensionAttributes = $this->getMockBuilder(CustomerExtensionInterface::class) - ->setMethods(['getIsSubscribed', 'setIsSubscribed']) - ->getMockForAbstractClass(); - $result->expects($this->atLeastOnce())->method('getId')->willReturn($customerId); - $result->expects($this->any())->method('getExtensionAttributes')->willReturn(null); - $this->extensionFactoryMock->expects($this->any()) - ->method('create') - ->willReturn($resultExtensionAttributes); - $result->expects($this->once()) - ->method('setExtensionAttributes') - ->with($resultExtensionAttributes) + $subscriber = $this->createMock(Subscriber::class); + $subscriber->method('getStatus')->willReturn($originalStatus); + $subscriber->method('getEmail')->willReturn($customerEmail); + $subscriber->method('isSubscribed')->willReturn($originalStatus === Subscriber::STATUS_SUBSCRIBED); + $subscriber->expects($this->once()) + ->method('loadByCustomer') + ->with($customerId, $websiteId) + ->willReturnSelf(); + $subscriber->expects($this->once()) + ->method('loadBySubscriberEmail') + ->with($customerEmail, $websiteId) ->willReturnSelf(); - $this->customerMock->expects($this->once()) - ->method('getExtensionAttributes') - ->willReturn($this->customerExtensionMock); - $resultExtensionAttributes->expects($this->any()) - ->method('getIsSubscribed') - ->willReturn($subscriptionOriginalValue); - $this->customerExtensionMock->expects($this->any()) - ->method('getIsSubscribed') - ->willReturn($subscriptionNewValue); + $this->subscriberFactory->method('create')->willReturn($subscriber); - if ($subscriptionOriginalValue !== $subscriptionNewValue) { - if ($subscriptionNewValue) { - $this->subscriber->expects($this->once())->method('subscribeCustomerById')->with($customerId); - } else { - $this->subscriber->expects($this->once())->method('unsubscribeCustomerById')->with($customerId); - } - $this->subscriber->expects($this->once())->method('isSubscribed')->willReturn($subscriptionNewValue); - $resultExtensionAttributes->expects($this->once())->method('setIsSubscribed')->with($subscriptionNewValue); + $customerExtension = $this->createPartialMock(CustomerExtensionInterface::class, ['getIsSubscribed']); + $customerExtension->method('getIsSubscribed')->willReturn($newValue); + /** @var CustomerInterface|MockObject $customer */ + $customer = $this->createMock(CustomerInterface::class); + $customer->method('getExtensionAttributes')->willReturn($customerExtension); + + $resultIsSubscribed = $newValue ?? $originalStatus === Subscriber::STATUS_SUBSCRIBED; + if ($expectedSubscribe !== null) { + $resultSubscriber = $this->createMock(Subscriber::class); + $resultSubscriber->method('isSubscribed')->willReturn($resultIsSubscribed); + $this->subscriptionManager->expects($this->once()) + ->method($expectedSubscribe ? 'subscribeCustomer' : 'unsubscribeCustomer') + ->with($customerId, $storeId) + ->willReturn($resultSubscriber); + } else { + $this->subscriptionManager->expects($this->never())->method('subscribeCustomer'); + $this->subscriptionManager->expects($this->never())->method('unsubscribeCustomer'); } + $resultExtension = $this->createPartialMock(CustomerExtensionInterface::class, ['setIsSubscribed']); + $resultExtension->expects($this->once())->method('setIsSubscribed')->with($resultIsSubscribed); + /** @var CustomerInterface|MockObject $result */ + $result = $this->createMock(CustomerInterface::class); + $result->method('getId')->willReturn($customerId); + $result->method('getEmail')->willReturn($customerEmail); + $result->method('getExtensionAttributes')->willReturn($resultExtension); - $this->assertEquals($result, $this->plugin->afterSave($subject, $result, $this->customerMock)); + /** @var CustomerRepository|MockObject $subject */ + $subject = $this->createMock(CustomerRepositoryInterface::class); + $this->assertEquals($result, $this->plugin->afterSave($subject, $result, $customer)); } /** @@ -156,115 +167,135 @@ public function testAfterSave($subscriptionOriginalValue, $subscriptionNewValue) public function afterSaveDataProvider() { return [ - [true, true], - [false, false], - [true, false], - [false, true], + [null, null, null], + [null, true, true], + [null, false, null], + [Subscriber::STATUS_SUBSCRIBED, null, null], + [Subscriber::STATUS_SUBSCRIBED, true, null], + [Subscriber::STATUS_SUBSCRIBED, false, false], + [Subscriber::STATUS_UNSUBSCRIBED, null, null], + [Subscriber::STATUS_UNSUBSCRIBED, true, true], + [Subscriber::STATUS_UNSUBSCRIBED, false, null], + [Subscriber::STATUS_UNCONFIRMED, null, true], + [Subscriber::STATUS_UNCONFIRMED, true, true], + [Subscriber::STATUS_UNCONFIRMED, false, true], ]; } + /** + * Test to delete subscriptions after delete customer + */ public function testAfterDelete() { - $subject = $this->createMock(\Magento\Customer\Api\CustomerRepositoryInterface::class); - $customer = $this->createMock(\Magento\Customer\Api\Data\CustomerInterface::class); - $customer->expects($this->once())->method('getEmail')->willReturn('test@test.com'); - $this->subscriber->expects($this->once())->method('loadByEmail')->with('test@test.com')->willReturnSelf(); - $this->subscriber->expects($this->once())->method('getId')->willReturn(1); - $this->subscriber->expects($this->once())->method('delete')->willReturnSelf(); + $customerEmail = 'email@example.com'; + $websiteId = 1; + $storeIds = [1, 2]; + + $subscriber = $this->createMock(Subscriber::class); + $subscriber->expects($this->once())->method('delete'); + $collection = $this->createMock(Collection::class); + $collection->expects($this->once()) + ->method('addFieldToFilter') + ->with('subscriber_email', $customerEmail) + ->willReturnSelf(); + $collection->method('getIterator')->willReturn(new \ArrayIterator([$subscriber])); + $this->collectionFactory->expects($this->once())->method('create')->willReturn($collection); + $this->shareConfig->method('isWebsiteScope')->willReturn(false); + $website = $this->createMock(Website::class); + $website->method('getStoreIds')->willReturn($storeIds); + $this->storeManager->method('getWebsite')->with($websiteId)->willReturn($website); - $this->assertEquals(true, $this->plugin->afterDelete($subject, true, $customer)); + /** @var CustomerRepositoryInterface|MockObject $subject */ + $subject = $this->createMock(CustomerRepositoryInterface::class); + /** @var CustomerInterface|MockObject $customer */ + $customer = $this->createMock(CustomerInterface::class); + $customer->method('getEmail')->willReturn($customerEmail); + + $this->assertTrue($this->plugin->afterDelete($subject, true, $customer)); } + /** + * Test to delete subscriptions after delete customer by id + */ public function testAroundDeleteById() { $customerId = 1; + $customerEmail = 'test@test.com'; + $websiteId = 1; + $storeIds = [1, 2]; $deleteCustomerById = function () { return true; }; - $subject = $this->createMock(\Magento\Customer\Api\CustomerRepositoryInterface::class); - $customer = $this->createMock(\Magento\Customer\Api\Data\CustomerInterface::class); - $subject->expects($this->once())->method('getById')->willReturn($customer); - $customer->expects($this->once())->method('getEmail')->willReturn('test@test.com'); - $this->subscriber->expects($this->once())->method('loadByEmail')->with('test@test.com')->willReturnSelf(); - $this->subscriber->expects($this->once())->method('getId')->willReturn(1); - $this->subscriber->expects($this->once())->method('delete')->willReturnSelf(); + $customer = $this->createMock(CustomerInterface::class); + $customer->expects($this->once())->method('getEmail')->willReturn($customerEmail); + /** @var CustomerRepositoryInterface|MockObject $subject */ + $subject = $this->createMock(CustomerRepositoryInterface::class); + $subject->expects($this->once())->method('getById')->with($customerId)->willReturn($customer); + + $subscriber = $this->createMock(Subscriber::class); + $subscriber->expects($this->once())->method('delete'); + $collection = $this->createMock(Collection::class); + $collection->expects($this->once()) + ->method('addFieldToFilter') + ->with('subscriber_email', $customerEmail) + ->willReturnSelf(); + $collection->method('getIterator')->willReturn(new \ArrayIterator([$subscriber])); + $this->collectionFactory->expects($this->once())->method('create')->willReturn($collection); + $this->shareConfig->method('isWebsiteScope')->willReturn(false); + $website = $this->createMock(Website::class); + $website->method('getStoreIds')->willReturn($storeIds); + $this->storeManager->method('getWebsite')->with($websiteId)->willReturn($website); - $this->assertEquals(true, $this->plugin->aroundDeleteById($subject, $deleteCustomerById, $customerId)); + $this->assertTrue($this->plugin->aroundDeleteById($subject, $deleteCustomerById, $customerId)); } /** - * @param int|null $subscriberStatusKey - * @param int|null $subscriberStatusValue - * @param bool $isSubscribed - * @dataProvider afterGetByIdDataProvider - * @return void + * Test to load extension attribute after get by id */ - public function testAfterGetByIdCreatesExtensionAttributesIfItIsNotSet( - $subscriberStatusKey, - $subscriberStatusValue, - $isSubscribed - ) { - $subject = $this->createMock(\Magento\Customer\Api\CustomerRepositoryInterface::class); - $subscriber = [$subscriberStatusKey => $subscriberStatusValue]; + public function testAfterGetByIdCreatesExtensionAttributes(): void + { + $storeId = 2; + $websiteId = 1; + $customerId = 3; + $customerEmail = 'email@example.com'; + $subscribed = true; - $this->extensionFactoryMock->expects($this->any()) - ->method('create') - ->willReturn($this->customerExtensionMock); - $this->customerMock->expects($this->once()) - ->method('setExtensionAttributes') - ->with($this->customerExtensionMock) - ->willReturnSelf(); - $this->customerMock->expects($this->any()) - ->method('getId') - ->willReturn(1); - $this->subscriberResourceMock->expects($this->once()) - ->method('loadByCustomerData') - ->with($this->customerMock) - ->willReturn($subscriber); - $this->customerExtensionMock->expects($this->once())->method('setIsSubscribed')->with($isSubscribed); + $store = $this->createMock(StoreInterface::class); + $store->method('getId')->willReturn($storeId); + $store->method('getWebsiteId')->willReturn($websiteId); + $this->storeManager->method('getStore')->willReturn($store); - $this->assertEquals( - $this->customerMock, - $this->plugin->afterGetById($subject, $this->customerMock) - ); - } + /** @var CustomerInterface|MockObject $customer */ + $customer = $this->createMock(CustomerInterface::class); + $customer->method('getId')->willReturn($customerId); + $customer->method('getEmail')->willReturn($customerEmail); - public function testAfterGetByIdSetsIsSubscribedFlagIfItIsNotSet() - { - $subject = $this->createMock(\Magento\Customer\Api\CustomerRepositoryInterface::class); - $subscriber = ['subscriber_id' => 1, 'subscriber_status' => 1]; - - $this->customerMock->expects($this->any()) - ->method('getExtensionAttributes') - ->willReturn($this->customerExtensionMock); - $this->customerExtensionMock->expects($this->any()) - ->method('getIsSubscribed') - ->willReturn(null); - $this->subscriberResourceMock->expects($this->once()) - ->method('loadByCustomerData') - ->with($this->customerMock) - ->willReturn($subscriber); - $this->customerExtensionMock->expects($this->once()) - ->method('setIsSubscribed') + $subscriber = $this->createMock(Subscriber::class); + $subscriber->method('getEmail')->willReturn($customerEmail); + $subscriber->method('isSubscribed')->willReturn($subscribed); + $subscriber->expects($this->once()) + ->method('loadByCustomer') + ->with($customerId, $websiteId) + ->willReturnSelf(); + $subscriber->expects($this->once()) + ->method('loadBySubscriberEmail') + ->with($customerEmail, $websiteId) ->willReturnSelf(); + $this->subscriberFactory->method('create')->willReturn($subscriber); - $this->assertEquals( - $this->customerMock, - $this->plugin->afterGetById($subject, $this->customerMock) + $customerExtension = $this->createPartialMock( + CustomerExtensionInterface::class, + ['getIsSubscribed', 'setIsSubscribed'] ); - } + $customerExtension->expects($this->once())->method('setIsSubscribed')->with($subscribed); + $this->extensionFactory->expects($this->once())->method('create')->willReturn($customerExtension); + $customer->expects($this->once())->method('setExtensionAttributes')->with($customerExtension); - /** - * @return array - */ - public function afterGetByIdDataProvider() - { - return [ - ['subscriber_status', 1, true], - ['subscriber_status', 2, false], - ['subscriber_status', 3, false], - ['subscriber_status', 4, false], - [null, null, false], - ]; + /** @var CustomerRepositoryInterface|MockObject $subject */ + $subject = $this->createMock(CustomerRepositoryInterface::class); + $this->assertEquals( + $customer, + $this->plugin->afterGetById($subject, $customer) + ); } } diff --git a/app/code/Magento/Newsletter/Test/Unit/Model/SubscriberTest.php b/app/code/Magento/Newsletter/Test/Unit/Model/SubscriberTest.php index 6ccbba9f8828b..c3814563aa46c 100644 --- a/app/code/Magento/Newsletter/Test/Unit/Model/SubscriberTest.php +++ b/app/code/Magento/Newsletter/Test/Unit/Model/SubscriberTest.php @@ -5,118 +5,152 @@ */ namespace Magento\Newsletter\Test\Unit\Model; +use Magento\Customer\Api\AccountManagementInterface; +use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Customer\Api\Data\CustomerInterfaceFactory; +use Magento\Customer\Model\Session; +use Magento\Framework\Api\DataObjectHelper; +use Magento\Framework\App\Area; +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\Mail\Template\TransportBuilder; +use Magento\Framework\Mail\TransportInterface; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Framework\Translate\Inline\StateInterface; +use Magento\Newsletter\Helper\Data; +use Magento\Newsletter\Model\Queue; use Magento\Newsletter\Model\Subscriber; +use Magento\Store\Api\Data\StoreInterface; +use Magento\Store\Model\ScopeInterface; +use Magento\Store\Model\StoreManagerInterface; +use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\MockObject\MockObject; /** + * Test Subscriber model functionality + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class SubscriberTest extends \PHPUnit\Framework\TestCase +class SubscriberTest extends TestCase { /** - * @var \Magento\Newsletter\Helper\Data|\PHPUnit_Framework_MockObject_MockObject + * @var Data|MockObject */ - protected $newsletterData; + private $newsletterData; /** - * @var \Magento\Framework\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject + * @var ScopeConfigInterface|MockObject */ - protected $scopeConfig; + private $scopeConfig; /** - * @var \Magento\Framework\Mail\Template\TransportBuilder|\PHPUnit_Framework_MockObject_MockObject + * @var TransportBuilder|MockObject */ - protected $transportBuilder; + private $transportBuilder; /** - * @var \Magento\Store\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject + * @var StoreManagerInterface|MockObject */ - protected $storeManager; + private $storeManager; /** - * @var \Magento\Customer\Model\Session|\PHPUnit_Framework_MockObject_MockObject + * @var Session|MockObject */ - protected $customerSession; + private $customerSession; /** - * @var \Magento\Customer\Api\CustomerRepositoryInterface|\PHPUnit_Framework_MockObject_MockObject + * @var CustomerRepositoryInterface|MockObject */ - protected $customerRepository; + private $customerRepository; /** - * @var \Magento\Customer\Api\AccountManagementInterface|\PHPUnit_Framework_MockObject_MockObject + * @var AccountManagementInterface|MockObject */ - protected $customerAccountManagement; + private $customerAccountManagement; /** - * @var \Magento\Framework\Translate\Inline\StateInterface|\PHPUnit_Framework_MockObject_MockObject + * @var StateInterface|MockObject */ - protected $inlineTranslation; + private $inlineTranslation; /** - * @var \Magento\Newsletter\Model\ResourceModel\Subscriber|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Newsletter\Model\ResourceModel\Subscriber|MockObject */ - protected $resource; + private $resource; /** - * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager + * @var ObjectManager */ - protected $objectManager; + private $objectManager; /** - * @var \Magento\Framework\Api\DataObjectHelper|\PHPUnit_Framework_MockObject_MockObject + * @var DataObjectHelper|MockObject */ private $dataObjectHelper; /** - * @var \Magento\Customer\Api\Data\CustomerInterfaceFactory|\PHPUnit_Framework_MockObject_MockObject + * @var CustomerInterfaceFactory|MockObject */ private $customerFactory; /** - * @var \Magento\Newsletter\Model\Subscriber + * @var Subscriber */ - protected $subscriber; + private $subscriber; + /** + * @inheritdoc + */ protected function setUp() { - $this->newsletterData = $this->createMock(\Magento\Newsletter\Helper\Data::class); - $this->scopeConfig = $this->createMock(\Magento\Framework\App\Config\ScopeConfigInterface::class); - $this->transportBuilder = $this->createPartialMock(\Magento\Framework\Mail\Template\TransportBuilder::class, [ + $this->newsletterData = $this->createMock(Data::class); + $this->scopeConfig = $this->createMock(ScopeConfigInterface::class); + $this->transportBuilder = $this->createPartialMock( + TransportBuilder::class, + [ 'setTemplateIdentifier', 'setTemplateOptions', 'setTemplateVars', 'setFrom', 'addTo', 'getTransport' - ]); - $this->storeManager = $this->createMock(\Magento\Store\Model\StoreManagerInterface::class); - $this->customerSession = $this->createPartialMock(\Magento\Customer\Model\Session::class, [ + ] + ); + $this->storeManager = $this->createMock(StoreManagerInterface::class); + $this->customerSession = $this->createPartialMock( + Session::class, + [ 'isLoggedIn', 'getCustomerDataObject', 'getCustomerId' - ]); - $this->customerRepository = $this->createMock(\Magento\Customer\Api\CustomerRepositoryInterface::class); - $this->customerAccountManagement = $this->createMock(\Magento\Customer\Api\AccountManagementInterface::class); - $this->inlineTranslation = $this->createMock(\Magento\Framework\Translate\Inline\StateInterface::class); - $this->resource = $this->createPartialMock(\Magento\Newsletter\Model\ResourceModel\Subscriber::class, [ + ] + ); + $this->customerRepository = $this->createMock(CustomerRepositoryInterface::class); + $this->customerAccountManagement = $this->createMock(AccountManagementInterface::class); + $this->inlineTranslation = $this->createMock(StateInterface::class); + $this->resource = $this->createPartialMock( + \Magento\Newsletter\Model\ResourceModel\Subscriber::class, + [ 'loadByEmail', 'getIdFieldName', 'save', - 'loadByCustomerData', - 'received' - ]); - $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + 'loadByCustomer', + 'received', + 'loadBySubscriberEmail', + 'loadByCustomerId', + ] + ); + $this->objectManager = new ObjectManager($this); - $this->customerFactory = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterfaceFactory::class) + $this->customerFactory = $this->getMockBuilder(CustomerInterfaceFactory::class) ->setMethods(['create']) ->disableOriginalConstructor() ->getMock(); - $this->dataObjectHelper = $this->getMockBuilder(\Magento\Framework\Api\DataObjectHelper::class) + $this->dataObjectHelper = $this->getMockBuilder(DataObjectHelper::class) ->disableOriginalConstructor() ->getMock(); $this->subscriber = $this->objectManager->getObject( - \Magento\Newsletter\Model\Subscriber::class, + Subscriber::class, [ 'newsletterData' => $this->newsletterData, 'scopeConfig' => $this->scopeConfig, @@ -128,250 +162,78 @@ protected function setUp() 'inlineTranslation' => $this->inlineTranslation, 'resource' => $this->resource, 'customerFactory' => $this->customerFactory, - 'dataObjectHelper' => $this->dataObjectHelper - ] - ); - } - - public function testSubscribe() - { - $email = 'subscriber_email@magento.com'; - $storeId = 1; - $customerData = ['store_id' => $storeId, 'email' => $email]; - $storeModel = $this->getMockBuilder(\Magento\Store\Model\Store::class) - ->disableOriginalConstructor() - ->getMock(); - $this->storeManager->expects($this->any())->method('getStore')->willReturn($storeModel); - $storeModel->expects($this->any())->method('getId')->willReturn($storeId); - $customer = $this->createMock(\Magento\Customer\Api\Data\CustomerInterface::class); - $this->customerFactory->expects($this->once())->method('create')->willReturn($customer); - $this->dataObjectHelper->expects($this->once())->method('populateWithArray')->with( - $customer, - $customerData, - \Magento\Customer\Api\Data\CustomerInterface::class - ); - $this->resource->expects($this->any())->method('loadByCustomerData')->with($customer)->willReturn( - [ - 'subscriber_status' => Subscriber::STATUS_UNSUBSCRIBED, - 'subscriber_email' => $email, - 'name' => 'subscriber_name' + 'dataObjectHelper' => $this->dataObjectHelper, ] ); - $this->scopeConfig->expects($this->any())->method('getValue')->willReturn(true); - $this->customerSession->expects($this->any())->method('isLoggedIn')->willReturn(true); - $customerDataModel = $this->createMock(\Magento\Customer\Api\Data\CustomerInterface::class); - $this->customerSession->expects($this->any())->method('getCustomerDataObject')->willReturn($customerDataModel); - $this->customerSession->expects($this->any())->method('getCustomerId')->willReturn(1); - $customerDataModel->expects($this->any())->method('getEmail')->willReturn($email); - $this->customerRepository->expects($this->any())->method('getById')->willReturn($customerDataModel); - $customerDataModel->expects($this->any())->method('getStoreId')->willReturn($storeId); - $customerDataModel->expects($this->any())->method('getId')->willReturn(1); - $this->sendEmailCheck(); - $this->resource->expects($this->atLeastOnce())->method('save')->willReturnSelf(); - - $this->assertEquals(Subscriber::STATUS_NOT_ACTIVE, $this->subscriber->subscribe($email)); } - public function testSubscribeNotLoggedIn() + /** + * Test to Load by subscriber email + * + * @return void + */ + public function testLoadBySubscriberEmail(): void { - $email = 'subscriber_email@magento.com'; - $storeId = 1; - $customerData = ['store_id' => $storeId, 'email' => $email]; - $storeModel = $this->getMockBuilder(\Magento\Store\Model\Store::class) - ->disableOriginalConstructor() - ->getMock(); - $this->storeManager->expects($this->any())->method('getStore')->willReturn($storeModel); - $storeModel->expects($this->any())->method('getId')->willReturn($storeId); - $customer = $this->createMock(\Magento\Customer\Api\Data\CustomerInterface::class); - $this->customerFactory->expects($this->once())->method('create')->willReturn($customer); - $this->dataObjectHelper->expects($this->once())->method('populateWithArray')->with( - $customer, - $customerData, - \Magento\Customer\Api\Data\CustomerInterface::class + $email = 'subscriber_email@example.com'; + $websiteId = 1; + $subscriberData = ['some_filed' => 'value']; + + $this->resource->expects($this->once()) + ->method('loadBySubscriberEmail') + ->with($email, $websiteId) + ->willReturn($subscriberData); + + $this->assertEquals( + $subscriberData, + $this->subscriber->loadBySubscriberEmail($email, $websiteId)->getData() ); - $this->resource->expects($this->any())->method('loadByCustomerData')->with($customer)->willReturn( - [ - 'subscriber_status' => Subscriber::STATUS_UNSUBSCRIBED, - 'subscriber_email' => $email, - 'name' => 'subscriber_name' - ] - ); - $this->scopeConfig->expects($this->any())->method('getValue')->willReturn(true); - $this->customerSession->expects($this->any())->method('isLoggedIn')->willReturn(false); - $customerDataModel = $this->createMock(\Magento\Customer\Api\Data\CustomerInterface::class); - $this->customerSession->expects($this->any())->method('getCustomerDataObject')->willReturn($customerDataModel); - $this->customerSession->expects($this->any())->method('getCustomerId')->willReturn(1); - $customerDataModel->expects($this->any())->method('getEmail')->willReturn($email); - $this->customerRepository->expects($this->any())->method('getById')->willReturn($customerDataModel); - $customerDataModel->expects($this->any())->method('getStoreId')->willReturn($storeId); - $customerDataModel->expects($this->any())->method('getId')->willReturn(1); - $this->sendEmailCheck(); - $this->resource->expects($this->atLeastOnce())->method('save')->willReturnSelf(); - - $this->assertEquals(Subscriber::STATUS_NOT_ACTIVE, $this->subscriber->subscribe($email)); } - public function testUpdateSubscription() - { - $storeId = 2; - $customerId = 1; - $customerDataMock = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class) - ->getMock(); - $this->customerRepository->expects($this->atLeastOnce()) - ->method('getById') - ->with($customerId)->willReturn($customerDataMock); - $this->resource->expects($this->atLeastOnce()) - ->method('loadByCustomerData') - ->with($customerDataMock) - ->willReturn( - [ - 'subscriber_id' => 1, - 'subscriber_status' => Subscriber::STATUS_SUBSCRIBED - ] - ); - $customerDataMock->expects($this->atLeastOnce())->method('getId')->willReturn('id'); - $this->resource->expects($this->atLeastOnce())->method('save')->willReturnSelf(); - $this->customerAccountManagement->expects($this->once()) - ->method('getConfirmationStatus') - ->with($customerId) - ->willReturn('account_confirmation_required'); - $customerDataMock->expects($this->exactly(2))->method('getStoreId')->willReturn($storeId); - $customerDataMock->expects($this->once())->method('getEmail')->willReturn('email'); - - $storeModel = $this->getMockBuilder(\Magento\Store\Model\Store::class) - ->disableOriginalConstructor() - ->setMethods(['getId']) - ->getMock(); - $this->storeManager->expects($this->any())->method('getStore')->willReturn($storeModel); - - $this->assertEquals($this->subscriber, $this->subscriber->updateSubscription($customerId)); - } - - public function testUnsubscribeCustomerById() + /** + * Test to Load by customer + * + * @return void + */ + public function testLoadByCustomer(): void { - $storeId = 2; $customerId = 1; - $customerDataMock = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class) - ->getMock(); - $this->customerRepository->expects($this->atLeastOnce()) - ->method('getById') - ->with($customerId)->willReturn($customerDataMock); - $this->resource->expects($this->atLeastOnce()) - ->method('loadByCustomerData') - ->with($customerDataMock) - ->willReturn( - [ - 'subscriber_id' => 1, - 'subscriber_status' => Subscriber::STATUS_SUBSCRIBED - ] - ); - $customerDataMock->expects($this->atLeastOnce())->method('getId')->willReturn('id'); - $this->resource->expects($this->atLeastOnce())->method('save')->willReturnSelf(); - $customerDataMock->expects($this->exactly(2))->method('getStoreId')->willReturn($storeId); - $customerDataMock->expects($this->once())->method('getEmail')->willReturn('email'); - $this->sendEmailCheck(); + $websiteId = 1; + $subscriberData = ['some_filed' => 'value']; - $this->subscriber->unsubscribeCustomerById($customerId); - } - - public function testSubscribeCustomerById() - { - $storeId = 2; - $customerId = 1; - $customerDataMock = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class) - ->getMock(); - $this->customerRepository->expects($this->atLeastOnce()) - ->method('getById') - ->with($customerId)->willReturn($customerDataMock); - $this->resource->expects($this->atLeastOnce()) - ->method('loadByCustomerData') - ->with($customerDataMock) - ->willReturn( - [ - 'subscriber_id' => 1, - 'subscriber_status' => Subscriber::STATUS_UNSUBSCRIBED - ] - ); - $customerDataMock->expects($this->atLeastOnce())->method('getId')->willReturn('id'); - $this->resource->expects($this->atLeastOnce())->method('save')->willReturnSelf(); - $customerDataMock->expects($this->exactly(2))->method('getStoreId')->willReturn($storeId); - $customerDataMock->expects($this->once())->method('getEmail')->willReturn('email'); - $this->sendEmailCheck(); + $this->resource->expects($this->once()) + ->method('loadByCustomerId') + ->with($customerId, $websiteId) + ->willReturn($subscriberData); - $this->subscriber->subscribeCustomerById($customerId); - } - - public function testSubscribeCustomerById1() - { - $storeId = 2; - $customerId = 1; - $customerDataMock = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class) - ->getMock(); - $this->customerRepository->expects($this->atLeastOnce()) - ->method('getById') - ->with($customerId)->willReturn($customerDataMock); - $this->resource->expects($this->atLeastOnce()) - ->method('loadByCustomerData') - ->with($customerDataMock) - ->willReturn( - [ - 'subscriber_id' => 1, - 'subscriber_status' => Subscriber::STATUS_UNSUBSCRIBED - ] - ); - $customerDataMock->expects($this->atLeastOnce())->method('getId')->willReturn('id'); - $this->resource->expects($this->atLeastOnce())->method('save')->willReturnSelf(); - $customerDataMock->expects($this->exactly(2))->method('getStoreId')->willReturn($storeId); - $customerDataMock->expects($this->once())->method('getEmail')->willReturn('email'); - $this->sendEmailCheck(); - $this->customerAccountManagement->expects($this->once()) - ->method('getConfirmationStatus') - ->willReturn(\Magento\Customer\Api\AccountManagementInterface::ACCOUNT_CONFIRMATION_NOT_REQUIRED); - $this->scopeConfig->expects($this->atLeastOnce())->method('getValue')->with()->willReturn(true); - - $this->subscriber->subscribeCustomerById($customerId); - $this->assertEquals(Subscriber::STATUS_NOT_ACTIVE, $this->subscriber->getStatus()); - } - - public function testSubscribeCustomerByIdAfterConfirmation() - { - $storeId = 2; - $customerId = 1; - $customerDataMock = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class) - ->getMock(); - $this->customerRepository->expects($this->atLeastOnce()) - ->method('getById') - ->with($customerId)->willReturn($customerDataMock); - $this->resource->expects($this->atLeastOnce()) - ->method('loadByCustomerData') - ->with($customerDataMock) - ->willReturn( - [ - 'subscriber_id' => 1, - 'subscriber_status' => Subscriber::STATUS_UNCONFIRMED - ] - ); - $customerDataMock->expects($this->atLeastOnce())->method('getId')->willReturn('id'); - $this->resource->expects($this->atLeastOnce())->method('save')->willReturnSelf(); - $customerDataMock->expects($this->exactly(2))->method('getStoreId')->willReturn($storeId); - $customerDataMock->expects($this->once())->method('getEmail')->willReturn('email'); - $this->sendEmailCheck(); - $this->customerAccountManagement->expects($this->never())->method('getConfirmationStatus'); - $this->scopeConfig->expects($this->atLeastOnce())->method('getValue')->with()->willReturn(true); - - $this->subscriber->updateSubscription($customerId); - $this->assertEquals(Subscriber::STATUS_SUBSCRIBED, $this->subscriber->getStatus()); + $this->assertEquals( + $subscriberData, + $this->subscriber->loadByCustomer($customerId, $websiteId)->getData() + ); } + /** + * Test to unsubscribe customer from newsletters + */ public function testUnsubscribe() { $this->resource->expects($this->once())->method('save')->willReturnSelf(); - $this->sendEmailCheck(); + $subscriberData = [ + 'store_id' => 2, + 'email' => 'subscriber_email@example.com', + 'name' => 'Subscriber Name', + ]; + $this->subscriber->setData($subscriberData); + $this->sendEmailCheck( + Subscriber::XML_PATH_UNSUBSCRIBE_EMAIL_TEMPLATE, + Subscriber::XML_PATH_UNSUBSCRIBE_EMAIL_IDENTITY + ); $this->assertEquals($this->subscriber, $this->subscriber->unsubscribe()); } /** + * Test to try unsubscribe customer from newsletters with wrong confirmation code + * * @expectedException \Magento\Framework\Exception\LocalizedException * @expectedExceptionMessage This is an invalid subscription confirmation code. */ @@ -383,6 +245,9 @@ public function testUnsubscribeException() $this->subscriber->unsubscribe(); } + /** + * Test to get subscriber full name + */ public function testGetSubscriberFullName() { $this->subscriber->setFirstname('John'); @@ -391,6 +256,9 @@ public function testGetSubscriberFullName() $this->assertEquals('John Doe', $this->subscriber->getSubscriberFullName()); } + /** + * Test to confirm customer subscription + */ public function testConfirm() { $code = 111; @@ -400,6 +268,9 @@ public function testConfirm() $this->assertTrue($this->subscriber->confirm($code)); } + /** + * Test to doesn't confirm customer subscription + */ public function testConfirmWrongCode() { $code = 111; @@ -408,9 +279,12 @@ public function testConfirmWrongCode() $this->assertFalse($this->subscriber->confirm($code)); } + /** + * Test to mark receiving subscriber of queue newsletter + */ public function testReceived() { - $queue = $this->getMockBuilder(\Magento\Newsletter\Model\Queue::class) + $queue = $this->getMockBuilder(Queue::class) ->disableOriginalConstructor() ->getMock(); $this->resource->expects($this->once())->method('received')->with($this->subscriber, $queue)->willReturnSelf(); @@ -419,28 +293,103 @@ public function testReceived() } /** - * @return $this + * Test to Sends out confirmation email + * + * @return void */ - protected function sendEmailCheck() + public function testSendConfirmationRequestEmail(): void { - $storeModel = $this->getMockBuilder(\Magento\Store\Model\Store::class) - ->disableOriginalConstructor() - ->setMethods(['getId']) - ->getMock(); - $transport = $this->createMock(\Magento\Framework\Mail\TransportInterface::class); - $this->scopeConfig->expects($this->any())->method('getValue')->willReturn(true); - $this->transportBuilder->expects($this->once())->method('setTemplateIdentifier')->willReturnSelf(); - $this->transportBuilder->expects($this->once())->method('setTemplateOptions')->willReturnSelf(); - $this->transportBuilder->expects($this->once())->method('setTemplateVars')->willReturnSelf(); - $this->transportBuilder->expects($this->once())->method('setFrom')->willReturnSelf(); - $this->transportBuilder->expects($this->once())->method('addTo')->willReturnSelf(); - $this->storeManager->expects($this->any())->method('getStore')->willReturn($storeModel); - $storeModel->expects($this->any())->method('getId')->willReturn(1); - $this->transportBuilder->expects($this->once())->method('getTransport')->willReturn($transport); + $confirmLink = 'confirm link'; + $storeId = 2; + $subscriberData = [ + 'store_id' => $storeId, + 'email' => 'subscriber_email@example.com', + 'name' => 'Subscriber Name', + ]; + $store = $this->createMock(StoreInterface::class); + $this->storeManager->method('getStore')->with($storeId)->willReturn($store); + $this->newsletterData->expects($this->once()) + ->method('getConfirmationUrl') + ->with($this->subscriber) + ->willReturn($confirmLink); + $this->subscriber->setData($subscriberData); + $this->sendEmailCheck( + Subscriber::XML_PATH_CONFIRM_EMAIL_TEMPLATE, + Subscriber::XML_PATH_CONFIRM_EMAIL_IDENTITY, + [ + 'store' => $store, + 'subscriber_data' => [ + 'confirmation_link' => $confirmLink, + ], + ] + ); + $this->assertEquals($this->subscriber, $this->subscriber->sendConfirmationRequestEmail()); + } + + /** + * Test to Sends out success email + * + * @return void + */ + public function testSendConfirmationSuccessEmail(): void + { + $subscriberData = [ + 'store_id' => 2, + 'email' => 'subscriber_email@example.com', + 'name' => 'Subscriber Name', + ]; + $this->subscriber->setData($subscriberData); + $this->sendEmailCheck( + Subscriber::XML_PATH_SUCCESS_EMAIL_TEMPLATE, + Subscriber::XML_PATH_SUCCESS_EMAIL_IDENTITY + ); + $this->assertEquals($this->subscriber, $this->subscriber->sendConfirmationSuccessEmail()); + } + + /** + * Check to send email + * + * @param string $templateConfigPath + * @param string $identityTemplatePath + * @return void + */ + private function sendEmailCheck(string $templateConfigPath, string $identityTemplatePath, array $vars = []): void + { + $template = 'email_template'; + $identity = 'email_identity'; + $vars += ['subscriber' => $this->subscriber]; + + $this->scopeConfig->method('getValue') + ->willReturnMap( + [ + [$templateConfigPath, ScopeInterface::SCOPE_STORE, $this->subscriber->getStoreId(), $template], + [$identityTemplatePath, ScopeInterface::SCOPE_STORE, $this->subscriber->getStoreId(), $identity], + ] + ); + $this->transportBuilder->expects($this->once()) + ->method('setTemplateIdentifier') + ->with($template) + ->willReturnSelf(); + $this->transportBuilder->expects($this->once()) + ->method('setTemplateOptions') + ->with(['area' => Area::AREA_FRONTEND, 'store' => $this->subscriber->getStoreId()]) + ->willReturnSelf(); + $this->transportBuilder->expects($this->once()) + ->method('setTemplateVars') + ->with($vars) + ->willReturnSelf(); + $this->transportBuilder->expects($this->once()) + ->method('setFrom') + ->with($identity) + ->willReturnSelf(); + $this->transportBuilder->expects($this->once()) + ->method('addTo') + ->with($this->subscriber->getEmail(), $this->subscriber->getName()) + ->willReturnSelf(); + $transport = $this->createMock(TransportInterface::class); $transport->expects($this->once())->method('sendMessage')->willReturnSelf(); + $this->transportBuilder->expects($this->once())->method('getTransport')->willReturn($transport); $this->inlineTranslation->expects($this->once())->method('suspend')->willReturnSelf(); $this->inlineTranslation->expects($this->once())->method('resume')->willReturnSelf(); - - return $this; } } diff --git a/app/code/Magento/Newsletter/Test/Unit/Model/SubscriptionManagerTest.php b/app/code/Magento/Newsletter/Test/Unit/Model/SubscriptionManagerTest.php new file mode 100644 index 0000000000000..ecb30f12742c8 --- /dev/null +++ b/app/code/Magento/Newsletter/Test/Unit/Model/SubscriptionManagerTest.php @@ -0,0 +1,651 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Newsletter\Test\Unit\Model; + +use Magento\Customer\Api\AccountManagementInterface; +use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Customer\Api\Data\CustomerInterface; +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Newsletter\Model\Subscriber; +use Magento\Newsletter\Model\SubscriberFactory; +use Magento\Newsletter\Model\SubscriptionManager; +use Magento\Store\Api\Data\StoreInterface; +use Magento\Store\Model\ScopeInterface; +use Magento\Store\Model\StoreManagerInterface; +use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\MockObject\MockObject; +use Psr\Log\LoggerInterface; + +/** + * Test to update newsletter subscription status + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class SubscriptionManagerTest extends TestCase +{ + /** + * @var SubscriberFactory|MockObject + */ + private $subscriberFactory; + + /** + * @var LoggerInterface|MockObject + */ + private $logger; + + /** + * @var StoreManagerInterface|MockObject + */ + private $storeManager; + + /** + * @var ScopeConfigInterface|MockObject + */ + private $scopeConfig; + + /** + * @var AccountManagementInterface|MockObject + */ + private $customerAccountManagement; + + /** + * @var CustomerRepositoryInterface|MockObject + */ + private $customerRepository; + + /** + * @var SubscriptionManager + */ + private $subscriptionManager; + + /** + * @inheritdoc + */ + protected function setUp() + { + $this->subscriberFactory = $this->createMock(SubscriberFactory::class); + $this->logger = $this->createMock(LoggerInterface::class); + $this->storeManager = $this->createMock(StoreManagerInterface::class); + $this->scopeConfig = $this->createMock(ScopeConfigInterface::class); + $this->customerAccountManagement = $this->createMock(AccountManagementInterface::class); + $this->customerRepository = $this->createMock(CustomerRepositoryInterface::class); + + $objectManager = new ObjectManager($this); + $this->subscriptionManager = $objectManager->getObject( + SubscriptionManager::class, + [ + 'subscriberFactory' => $this->subscriberFactory, + 'logger' => $this->logger, + 'storeManager' => $this->storeManager, + 'scopeConfig' => $this->scopeConfig, + 'customerAccountManagement' => $this->customerAccountManagement, + 'customerRepository' => $this->customerRepository, + ] + ); + } + + /** + * Test to Subscribe to newsletters by email + * + * @param array $subscriberData + * @param string $email + * @param int $storeId + * @param bool $isConfirmNeed + * @param array $expectedData + * @dataProvider subscribeDataProvider + */ + public function testSubscribe( + array $subscriberData, + string $email, + int $storeId, + bool $isConfirmNeed, + array $expectedData + ): void { + $websiteId = 1; + $store = $this->createMock(StoreInterface::class); + $store->method('getWebsiteId')->willReturn($websiteId); + $this->storeManager->method('getStore')->with($storeId)->willReturn($store); + /** @var Subscriber|MockObject $subscriber */ + $subscriber = $this->createPartialMock( + Subscriber::class, + [ + 'loadBySubscriberEmail', + 'randomSequence', + 'save', + 'sendConfirmationRequestEmail', + 'sendConfirmationSuccessEmail', + 'sendUnsubscriptionEmail' + ] + ); + $subscriber->expects($this->once()) + ->method('loadBySubscriberEmail') + ->with($email, $websiteId) + ->willReturnSelf(); + $subscriber->setData($subscriberData); + if (empty($subscriberData['id'])) { + $subscriber->method('randomSequence')->willReturn($expectedData['subscriber_confirm_code']); + } + $this->subscriberFactory->method('create')->willReturn($subscriber); + $this->scopeConfig->method('isSetFlag') + ->with(Subscriber::XML_PATH_CONFIRMATION_FLAG, ScopeInterface::SCOPE_STORE, $storeId) + ->willReturn($isConfirmNeed); + + $this->assertEquals( + $subscriber, + $this->subscriptionManager->subscribe($email, $storeId) + ); + $this->assertEquals($subscriber->getData(), $expectedData); + } + + /** + * Subscribe customer data provider + * + * @return array + */ + public function subscribeDataProvider(): array + { + return [ + 'Subscribe new' => [ + 'subscriber_data' => [], + 'email' => 'email@example.com', + 'store_id' => 1, + 'is_confirm_need' => false, + 'expected_data' => [ + 'subscriber_email' => 'email@example.com', + 'store_id' => 1, + 'subscriber_status' => Subscriber::STATUS_SUBSCRIBED, + 'subscriber_confirm_code' => '', + ], + ], + 'Subscribe new: confirm required' => [ + 'subscriber_data' => [], + 'email' => 'email@example.com', + 'store_id' => 1, + 'is_confirm_need' => true, + 'expected_data' => [ + 'subscriber_email' => 'email@example.com', + 'store_id' => 1, + 'subscriber_status' => Subscriber::STATUS_NOT_ACTIVE, + 'subscriber_confirm_code' => '', + ], + ], + 'Subscribe existing' => [ + 'subscriber_data' => [ + 'subscriber_id' => 1, + 'subscriber_email' => 'email@example.com', + 'store_id' => 1, + 'subscriber_status' => Subscriber::STATUS_UNSUBSCRIBED, + 'subscriber_confirm_code' => '', + 'customer_id' => 0, + ], + 'email' => 'email@example.com', + 'store_id' => 1, + 'is_confirm_need' => false, + 'expected_data' => [ + 'subscriber_id' => 1, + 'subscriber_email' => 'email@example.com', + 'store_id' => 1, + 'subscriber_status' => Subscriber::STATUS_SUBSCRIBED, + 'subscriber_confirm_code' => '', + 'customer_id' => 0, + ], + ], + ]; + } + + /** + * Test to Unsubscribe from newsletters by email + */ + public function testUnsubscribe(): void + { + $email = 'email@example.com'; + $storeId = 2; + $websiteId = 1; + $store = $this->createMock(StoreInterface::class); + $store->method('getWebsiteId')->willReturn($websiteId); + $this->storeManager->method('getStore')->with($storeId)->willReturn($store); + $confirmCode = 'confirm code'; + /** @var Subscriber|MockObject $subscriber */ + $subscriber = $this->createPartialMock( + Subscriber::class, + ['loadBySubscriberEmail', 'getId', 'setCheckCode', 'unsubscribe'] + ); + $subscriber->expects($this->once()) + ->method('loadBySubscriberEmail') + ->with($email, $websiteId) + ->willReturnSelf(); + $subscriber->method('getId')->willReturn(1); + $subscriber->expects($this->once())->method('setCheckCode')->with($confirmCode)->willReturnSelf(); + $subscriber->expects($this->once())->method('unsubscribe')->willReturnSelf(); + $this->subscriberFactory->method('create')->willReturn($subscriber); + + $this->assertEquals( + $subscriber, + $this->subscriptionManager->unsubscribe($email, $storeId, $confirmCode) + ); + } + + /** + * Test to Subscribe customer to newsletter + * + * @param array $subscriberData + * @param array $customerData + * @param int $storeId + * @param bool $isConfirmNeed + * @param array $expectedData + * @param bool $needToSendEmail + * @dataProvider subscribeCustomerDataProvider + */ + public function testSubscribeCustomer( + array $subscriberData, + array $customerData, + int $storeId, + bool $isConfirmNeed, + array $expectedData, + bool $needToSendEmail + ): void { + $websiteId = 1; + $customerId = $customerData['id']; + $store = $this->createMock(StoreInterface::class); + $store->method('getWebsiteId')->willReturn($websiteId); + $this->storeManager->method('getStore')->with($storeId)->willReturn($store); + /** @var CustomerInterface|MockObject $customer */ + $customer = $this->createMock(CustomerInterface::class); + $customer->method('getId')->willReturn($customerId); + $customer->method('getEmail')->willReturn($customerData['email']); + $this->customerRepository->method('getById')->with($customerId)->willReturn($customer); + /** @var Subscriber|MockObject $subscriber */ + $subscriber = $this->createPartialMock( + Subscriber::class, + [ + 'loadByCustomer', + 'loadBySubscriberEmail', + 'randomSequence', + 'save', + 'sendConfirmationRequestEmail', + 'sendConfirmationSuccessEmail', + 'sendUnsubscriptionEmail' + ] + ); + $subscriber->expects($this->once()) + ->method('loadByCustomer') + ->with($customerId, $websiteId) + ->willReturnSelf(); + if (empty($subscriberData['subscriber_id'])) { + $subscriber->expects($this->once()) + ->method('loadBySubscriberEmail') + ->with($customerData['email'], $websiteId) + ->willReturnSelf(); + } + $subscriber->setData($subscriberData); + if (empty($subscriberData['subscriber_id'])) { + $subscriber->method('randomSequence')->willReturn($expectedData['subscriber_confirm_code']); + } + $sendEmailMethod = $this->getSendEmailMethod($expectedData['subscriber_status'] ?? 0); + if ($needToSendEmail) { + $subscriber->expects($this->once())->method($sendEmailMethod); + } else { + $subscriber->expects($this->never())->method('sendConfirmationRequestEmail'); + $subscriber->expects($this->never())->method('sendConfirmationSuccessEmail'); + $subscriber->expects($this->never())->method('sendUnsubscriptionEmail'); + } + $this->subscriberFactory->method('create')->willReturn($subscriber); + $this->scopeConfig->method('isSetFlag') + ->with(Subscriber::XML_PATH_CONFIRMATION_FLAG, ScopeInterface::SCOPE_STORE, $storeId) + ->willReturn($isConfirmNeed); + $this->customerAccountManagement + ->method('getConfirmationStatus') + ->willReturn($customerData['confirmation_status']); + + $this->assertEquals( + $subscriber, + $this->subscriptionManager->subscribeCustomer($customerId, $storeId) + ); + $this->assertEquals($subscriber->getData(), $expectedData); + } + + /** + * Get expected send email method + * + * @param int $status + * @return string + */ + private function getSendEmailMethod(int $status): string + { + switch ($status) { + case Subscriber::STATUS_SUBSCRIBED: + $sendEmailMethod = 'sendConfirmationSuccessEmail'; + break; + case Subscriber::STATUS_NOT_ACTIVE: + $sendEmailMethod = 'sendConfirmationRequestEmail'; + break; + case Subscriber::STATUS_UNSUBSCRIBED: + $sendEmailMethod = 'sendUnsubscriptionEmail'; + break; + default: + $sendEmailMethod = ''; + } + + return $sendEmailMethod; + } + + /** + * Subscribe customer data provider + * + * @return array + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function subscribeCustomerDataProvider(): array + { + return [ + 'Subscribe new' => [ + 'subscriber_data' => [], + 'customer_data' => [ + 'id' => 1, + 'email' => 'email@example.com', + 'confirmation_status' => AccountManagementInterface::ACCOUNT_CONFIRMED, + ], + 'store_id' => 1, + 'is_confirm_need' => false, + 'expected_data' => [ + 'customer_id' => 1, + 'subscriber_email' => 'email@example.com', + 'store_id' => 1, + 'subscriber_status' => Subscriber::STATUS_SUBSCRIBED, + 'subscriber_confirm_code' => '', + ], + 'needToSendEmail' => true, + ], + 'Subscribe new: customer confirm required' => [ + 'subscriber_data' => [], + 'customer_data' => [ + 'id' => 1, + 'email' => 'email@example.com', + 'confirmation_status' => AccountManagementInterface::ACCOUNT_CONFIRMATION_REQUIRED, + ], + 'store_id' => 1, + 'is_confirm_need' => false, + 'expected_data' => [ + 'customer_id' => 1, + 'subscriber_email' => 'email@example.com', + 'store_id' => 1, + 'subscriber_status' => Subscriber::STATUS_UNCONFIRMED, + 'subscriber_confirm_code' => '', + ], + 'needToSendEmail' => false, + ], + 'Subscribe existing' => [ + 'subscriber_data' => [ + 'subscriber_id' => 1, + 'customer_id' => 1, + 'subscriber_email' => 'email@example.com', + 'store_id' => 1, + 'subscriber_status' => Subscriber::STATUS_UNSUBSCRIBED, + 'subscriber_confirm_code' => '', + ], + 'customer_data' => [ + 'id' => 1, + 'email' => 'email@example.com', + 'confirmation_status' => AccountManagementInterface::ACCOUNT_CONFIRMED, + ], + 'store_id' => 1, + 'is_confirm_need' => false, + 'expected_data' => [ + 'subscriber_id' => 1, + 'customer_id' => 1, + 'subscriber_email' => 'email@example.com', + 'store_id' => 1, + 'subscriber_status' => Subscriber::STATUS_SUBSCRIBED, + 'subscriber_confirm_code' => '', + ], + 'needToSendEmail' => true, + ], + 'Subscribe existing: subscription confirm required' => [ + 'subscriber_data' => [ + 'subscriber_id' => 1, + 'customer_id' => 1, + 'subscriber_email' => 'email@example.com', + 'store_id' => 1, + 'subscriber_status' => Subscriber::STATUS_UNSUBSCRIBED, + 'subscriber_confirm_code' => '', + ], + 'customer_data' => [ + 'id' => 1, + 'email' => 'email@example.com', + 'confirmation_status' => AccountManagementInterface::ACCOUNT_CONFIRMED, + ], + 'store_id' => 1, + 'is_confirm_need' => true, + 'expected_data' => [ + 'subscriber_id' => 1, + 'customer_id' => 1, + 'subscriber_email' => 'email@example.com', + 'store_id' => 1, + 'subscriber_status' => Subscriber::STATUS_NOT_ACTIVE, + 'subscriber_confirm_code' => '', + ], + 'needToSendEmail' => true, + ], + 'Update subscription data' => [ + 'subscriber_data' => [ + 'subscriber_id' => 1, + 'customer_id' => 1, + 'subscriber_email' => 'email@example.com', + 'store_id' => 1, + 'subscriber_status' => Subscriber::STATUS_SUBSCRIBED, + 'subscriber_confirm_code' => '', + ], + 'customer_data' => [ + 'id' => 1, + 'email' => 'email2@example.com', + 'confirmation_status' => AccountManagementInterface::ACCOUNT_CONFIRMED, + ], + 'store_id' => 2, + 'is_confirm_need' => false, + 'expected_data' => [ + 'subscriber_id' => 1, + 'customer_id' => 1, + 'subscriber_email' => 'email2@example.com', + 'store_id' => 2, + 'subscriber_status' => Subscriber::STATUS_SUBSCRIBED, + 'subscriber_confirm_code' => '', + ], + 'needToSendEmail' => false, + ], + 'Update subscription data: subscription confirm required ' => [ + 'subscriber_data' => [ + 'subscriber_id' => 1, + 'customer_id' => 1, + 'subscriber_email' => 'email@example.com', + 'store_id' => 1, + 'subscriber_status' => Subscriber::STATUS_NOT_ACTIVE, + 'subscriber_confirm_code' => '', + ], + 'customer_data' => [ + 'id' => 1, + 'email' => 'email2@example.com', + 'confirmation_status' => AccountManagementInterface::ACCOUNT_CONFIRMED, + ], + 'store_id' => 2, + 'is_confirm_need' => true, + 'expected_data' => [ + 'subscriber_id' => 1, + 'customer_id' => 1, + 'subscriber_email' => 'email2@example.com', + 'store_id' => 2, + 'subscriber_status' => Subscriber::STATUS_NOT_ACTIVE, + 'subscriber_confirm_code' => '', + ], + 'needToSendEmail' => true, + ], + ]; + } + + /** + * Test to Unsubscribe customer from newsletter + * + * @param array $subscriberData + * @param array $customerData + * @param int $storeId + * @param array $expectedData + * @param bool $needToSendEmail + * @dataProvider unsubscribeCustomerDataProvider + */ + public function testUnsubscribeCustomer( + array $subscriberData, + array $customerData, + int $storeId, + array $expectedData, + bool $needToSendEmail + ): void { + $websiteId = 1; + $customerId = $customerData['id']; + $store = $this->createMock(StoreInterface::class); + $store->method('getWebsiteId')->willReturn($websiteId); + $this->storeManager->method('getStore')->with($storeId)->willReturn($store); + /** @var CustomerInterface|MockObject $customer */ + $customer = $this->createMock(CustomerInterface::class); + $customer->method('getId')->willReturn($customerId); + $customer->method('getEmail')->willReturn($customerData['email']); + $this->customerRepository->method('getById')->with($customerId)->willReturn($customer); + /** @var Subscriber|MockObject $subscriber */ + $subscriber = $this->createPartialMock( + Subscriber::class, + [ + 'loadByCustomer', + 'loadBySubscriberEmail', + 'randomSequence', + 'save', + 'sendConfirmationRequestEmail', + 'sendConfirmationSuccessEmail', + 'sendUnsubscriptionEmail' + ] + ); + $subscriber->expects($this->once()) + ->method('loadByCustomer') + ->with($customerId, $websiteId) + ->willReturnSelf(); + if (empty($subscriberData['subscriber_id'])) { + $subscriber->expects($this->once()) + ->method('loadBySubscriberEmail') + ->with($customerData['email'], $websiteId) + ->willReturnSelf(); + } + $subscriber->setData($subscriberData); + $sendEmailMethod = $this->getSendEmailMethod($expectedData['subscriber_status'] ?? 0); + if ($needToSendEmail) { + $subscriber->expects($this->once())->method($sendEmailMethod); + } else { + $subscriber->expects($this->never())->method('sendConfirmationRequestEmail'); + $subscriber->expects($this->never())->method('sendConfirmationSuccessEmail'); + $subscriber->expects($this->never())->method('sendUnsubscriptionEmail'); + } + $this->subscriberFactory->method('create')->willReturn($subscriber); + + $this->assertEquals( + $subscriber, + $this->subscriptionManager->unsubscribeCustomer($customerId, $storeId) + ); + $this->assertEquals($subscriber->getData(), $expectedData); + } + + /** + * Unsubscribe customer data provider + * + * @return array + */ + public function unsubscribeCustomerDataProvider(): array + { + return [ + 'Unsubscribe new' => [ + 'subscriber_data' => [], + 'customer_data' => [ + 'id' => 1, + 'email' => 'email@example.com', + ], + 'store_id' => 1, + 'expected_data' => [ + ], + 'needToSendEmail' => false, + ], + 'Unsubscribe existing' => [ + 'subscriber_data' => [ + 'subscriber_id' => 1, + 'customer_id' => 1, + 'subscriber_email' => 'email@example.com', + 'store_id' => 1, + 'subscriber_status' => Subscriber::STATUS_SUBSCRIBED, + 'subscriber_confirm_code' => '', + ], + 'customer_data' => [ + 'id' => 1, + 'email' => 'email@example.com', + ], + 'store_id' => 1, + 'expected_data' => [ + 'subscriber_id' => 1, + 'customer_id' => 1, + 'subscriber_email' => 'email@example.com', + 'store_id' => 1, + 'subscriber_status' => Subscriber::STATUS_UNSUBSCRIBED, + 'subscriber_confirm_code' => '', + ], + 'needToSendEmail' => true, + ], + 'Unsubscribe existing: subscription confirm required' => [ + 'subscriber_data' => [ + 'subscriber_id' => 1, + 'customer_id' => 1, + 'subscriber_email' => 'email@example.com', + 'store_id' => 1, + 'subscriber_status' => Subscriber::STATUS_NOT_ACTIVE, + 'subscriber_confirm_code' => '', + ], + 'customer_data' => [ + 'id' => 1, + 'email' => 'email@example.com', + ], + 'store_id' => 1, + 'expected_data' => [ + 'subscriber_id' => 1, + 'customer_id' => 1, + 'subscriber_email' => 'email@example.com', + 'store_id' => 1, + 'subscriber_status' => Subscriber::STATUS_NOT_ACTIVE, + 'subscriber_confirm_code' => '', + ], + 'needToSendEmail' => false, + ], + 'Update subscription data' => [ + 'subscriber_data' => [ + 'subscriber_id' => 1, + 'customer_id' => 1, + 'subscriber_email' => 'email@example.com', + 'store_id' => 1, + 'subscriber_status' => Subscriber::STATUS_UNSUBSCRIBED, + 'subscriber_confirm_code' => '', + ], + 'customer_data' => [ + 'id' => 1, + 'email' => 'email2@example.com', + ], + 'store_id' => 2, + 'expected_data' => [ + 'subscriber_id' => 1, + 'customer_id' => 1, + 'subscriber_email' => 'email2@example.com', + 'store_id' => 2, + 'subscriber_status' => Subscriber::STATUS_UNSUBSCRIBED, + 'subscriber_confirm_code' => '', + ], + 'needToSendEmail' => false, + ], + ]; + } +} diff --git a/app/code/Magento/Newsletter/etc/di.xml b/app/code/Magento/Newsletter/etc/di.xml index 179ec19cccfc5..3c35936a2e8aa 100644 --- a/app/code/Magento/Newsletter/etc/di.xml +++ b/app/code/Magento/Newsletter/etc/di.xml @@ -25,4 +25,11 @@ <plugin name="update_newsletter_subscription_on_customer_update" type="Magento\Newsletter\Model\Plugin\CustomerPlugin"/> </type> + <type name="Magento\Newsletter\Model\Subscriber"> + <arguments> + <argument name="customerSession" xsi:type="object">Magento\Customer\Model\Session\Proxy</argument> + </arguments> + </type> + <preference for="Magento\Newsletter\Model\SubscriptionManagerInterface" + type="Magento\Newsletter\Model\SubscriptionManager"/> </config> diff --git a/app/code/Magento/Store/Model/System/Store.php b/app/code/Magento/Store/Model/System/Store.php index 744019b107247..d13781b8c146b 100644 --- a/app/code/Magento/Store/Model/System/Store.php +++ b/app/code/Magento/Store/Model/System/Store.php @@ -52,6 +52,11 @@ class Store extends \Magento\Framework\DataObject implements OptionSourceInterfa */ protected $_storeManager; + /** + * @var string + */ + private $nonEscapableNbspChar; + /** * Init model * Load Website, Group and Store collections @@ -61,6 +66,9 @@ class Store extends \Magento\Framework\DataObject implements OptionSourceInterfa public function __construct(\Magento\Store\Model\StoreManagerInterface $storeManager) { $this->_storeManager = $storeManager; + // phpcs:ignore Magento2.Functions.DiscouragedFunction + $this->nonEscapableNbspChar = html_entity_decode(' ', ENT_NOQUOTES, 'UTF-8'); + return $this->reload(); } @@ -121,9 +129,6 @@ public function getStoreValuesForForm($empty = false, $all = false) $options[] = ['label' => __('All Store Views'), 'value' => 0]; } - // phpcs:ignore Magento2.Functions.DiscouragedFunction - $nonEscapableNbspChar = html_entity_decode(' ', ENT_NOQUOTES, 'UTF-8'); - foreach ($this->_websiteCollection as $website) { $websiteShow = false; foreach ($this->_groupCollection as $group) { @@ -140,13 +145,13 @@ public function getStoreValuesForForm($empty = false, $all = false) $websiteShow = true; } $values[] = [ - 'label' => str_repeat($nonEscapableNbspChar, 4) . $store->getName(), + 'label' => str_repeat($this->nonEscapableNbspChar, 4) . $store->getName(), 'value' => $store->getId(), ]; } if (!empty($values)) { $options[] = [ - 'label' => str_repeat($nonEscapableNbspChar, 4) . $group->getName(), + 'label' => str_repeat($this->nonEscapableNbspChar, 4) . $group->getName(), 'value' => $values, ]; } @@ -216,6 +221,22 @@ public function getStoresStructure($isAll = false, $storeIds = [], $groupIds = [ return $out; } + /** + * Get store options in tree view + * + * @param bool $isAll + * @param array $storeIds + * @param array $groupIds + * @param array $websiteIds + * @return array Format: array(array('value' => '<value>', 'label' => '<label>'), ...) + */ + public function getStoreOptionsTree($isAll = false, $storeIds = [], $groupIds = [], $websiteIds = []): array + { + $storeStructure = $this->getStoresStructure($isAll, $storeIds, $groupIds, $websiteIds); + + return $this->retrieveOptionValues($storeStructure); + } + /** * Website label/value array getter, compatible with form dropdown options * @@ -480,4 +501,35 @@ public function toOptionArray() { return $this->getStoreValuesForForm(); } + + /** + * Retrieve option values + * + * Return array of options as value-label pairs in tree view + * + * @param array $structure + * @param bool $needSpacePrefix + * @return array + */ + private function retrieveOptionValues(array $structure, bool $needSpacePrefix = false): array + { + $prefix = ''; + if ($needSpacePrefix) { + $prefix = str_repeat($this->nonEscapableNbspChar, 4); + } + + $values = []; + foreach ($structure as $item) { + $value = !empty($item['children']) + ? $this->retrieveOptionValues($item['children'], true) + : $item['value']; + + $values[] = [ + 'label' => $prefix . $item['label'], + 'value' => $value, + ]; + } + + return $values; + } } diff --git a/app/design/adminhtml/Magento/backend/Magento_Customer/web/css/source/_module.less b/app/design/adminhtml/Magento/backend/Magento_Customer/web/css/source/_module.less index c8f2530df22e0..0c7dd7e7cb94c 100644 --- a/app/design/adminhtml/Magento/backend/Magento_Customer/web/css/source/_module.less +++ b/app/design/adminhtml/Magento/backend/Magento_Customer/web/css/source/_module.less @@ -78,3 +78,33 @@ } } } + +.customer-newsletter-fieldset.admin__fieldset { + &.multi-website { + > .admin__field > .admin__field-control { + width: ~'calc(100% * 0.75 - 30px)'; + + table { + th.subscriber-status { + text-align: center; + } + + td { + &.subscriber-status { + text-align: center; + } + + select.admin__control-select { + width: 100%; + } + } + } + } + } + + > .admin__field > .admin__field-control { + input[type='checkbox'] { + margin: 8px 0 0 0; + } + } +} diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/NewsletterTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/NewsletterTest.php index e28a9602b9377..a44101da77d6d 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/NewsletterTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/NewsletterTest.php @@ -61,12 +61,13 @@ public function tearDown() */ public function testRenderingNewsletterBlock() { + $websiteId = 1; $this->getRequest()->setParam('id', 1); $this->dispatch('backend/customer/index/edit'); $body = $this->getResponse()->getBody(); $this->assertContains('\u003Cspan\u003ENewsletter Information\u003C\/span\u003E', $body); - $this->assertContains('\u003Cinput id=\"_newslettersubscription\"', $body); + $this->assertContains('\u003Cinput id=\"_newslettersubscription_status_' . $websiteId . '\"', $body); $this->assertNotContains('checked="checked"', $body); $this->assertContains('\u003Cspan\u003ESubscribed to Newsletter\u003C\/span\u003E', $body); $this->assertContains('\u003ENo Newsletter Found\u003C', $body); diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php index 1b7f2c1f7efdd..4fc549f3caf86 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php @@ -128,6 +128,7 @@ public function testSaveActionWithInvalidFormData() public function testSaveActionExistingCustomerUnsubscribeNewsletter() { $customerId = 1; + $websiteId = 1; /** @var \Magento\Newsletter\Model\Subscriber $subscriber */ $subscriber = $this->objectManager->get(\Magento\Newsletter\Model\SubscriberFactory::class)->create(); @@ -144,7 +145,7 @@ public function testSaveActionExistingCustomerUnsubscribeNewsletter() 'lastname' => 'test lastname', 'sendemail_store_id' => 1 ], - 'subscription' => '0' + 'subscription_status' => [$websiteId => '0'] ]; $this->getRequest()->setPostValue($post)->setMethod(HttpRequest::METHOD_POST); $this->getRequest()->setParam('id', 1); From 72705ada1f90fa2afe7fdfdc14258c70d90bd014 Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Mon, 25 Nov 2019 15:10:52 +0200 Subject: [PATCH 0327/1143] MC-4242: Newsletter subscriptions per website --- app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php b/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php index 59e67e7aa32a7..424a42f629cdc 100644 --- a/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php +++ b/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php @@ -21,6 +21,8 @@ /** * Newsletter Plugin for customer + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class CustomerPlugin { From 644c063d7c8ae32dee8861ae73a0fcf6d1e779c4 Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Tue, 26 Nov 2019 09:21:18 +0200 Subject: [PATCH 0328/1143] MC-4242: Newsletter subscriptions per website --- .../Newsletter/Model/ResourceModel/Queue/Collection.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Newsletter/Model/ResourceModel/Queue/Collection.php b/app/code/Magento/Newsletter/Model/ResourceModel/Queue/Collection.php index 1fc68771e74cb..0553fae0f3b18 100644 --- a/app/code/Magento/Newsletter/Model/ResourceModel/Queue/Collection.php +++ b/app/code/Magento/Newsletter/Model/ResourceModel/Queue/Collection.php @@ -5,6 +5,8 @@ */ namespace Magento\Newsletter\Model\ResourceModel\Queue; +use Magento\Newsletter\Model\Subscriber; + /** * Newsletter queue collection. * @@ -214,7 +216,7 @@ public function addSubscriberFilter($subscriberId) * @param int $customerId * @return $this */ - public function addCustomerFilter(int $customerId): self + public function addCustomerFilter(int $customerId): Collection { $this->getSelect() ->join( From c16f055dae7c035c643bc66f27f6fa5173d2ce2a Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Tue, 26 Nov 2019 09:21:56 +0200 Subject: [PATCH 0329/1143] MC-4242: Newsletter subscriptions per website --- .../Magento/Newsletter/Model/ResourceModel/Queue/Collection.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/code/Magento/Newsletter/Model/ResourceModel/Queue/Collection.php b/app/code/Magento/Newsletter/Model/ResourceModel/Queue/Collection.php index 0553fae0f3b18..33c539fbba84f 100644 --- a/app/code/Magento/Newsletter/Model/ResourceModel/Queue/Collection.php +++ b/app/code/Magento/Newsletter/Model/ResourceModel/Queue/Collection.php @@ -5,8 +5,6 @@ */ namespace Magento\Newsletter\Model\ResourceModel\Queue; -use Magento\Newsletter\Model\Subscriber; - /** * Newsletter queue collection. * From 51c6d1d18c106a35b9fb4338e986dc38190b21f5 Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Wed, 27 Nov 2019 15:49:05 +0200 Subject: [PATCH 0330/1143] MC-4242: Newsletter subscriptions per website --- app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php b/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php index 424a42f629cdc..83bafe5bf2887 100644 --- a/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php +++ b/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php @@ -118,7 +118,7 @@ public function afterSave( * and customer is already confirmed registration * than need to subscribe customer */ - if ($subscriber->getStatus() === Subscriber::STATUS_UNCONFIRMED && empty($result->getConfirmation())) { + if ((int)$subscriber->getStatus() === Subscriber::STATUS_UNCONFIRMED && empty($result->getConfirmation())) { $needToUpdate = true; $subscribeStatus = true; } From 107d68a6929bbbd396e8fb6b68c88227d282c2a2 Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Tue, 3 Dec 2019 16:27:32 +0200 Subject: [PATCH 0331/1143] MC-4242: Newsletter subscriptions per website --- .../Magento/backend/web/css/styles-old.less | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/app/design/adminhtml/Magento/backend/web/css/styles-old.less b/app/design/adminhtml/Magento/backend/web/css/styles-old.less index 1703e87691788..247316ab0361b 100644 --- a/app/design/adminhtml/Magento/backend/web/css/styles-old.less +++ b/app/design/adminhtml/Magento/backend/web/css/styles-old.less @@ -3962,22 +3962,6 @@ .grid tr.headings th > span { white-space: normal; } - - .field { - &.field-subscription { - .admin__field-label { - margin-left: 10px; - float: none; - cursor: pointer; - } - - .admin__field-control { - float: left; - width: auto; - margin: 6px 0px 0px 0px; - } - } - } } } From 53548365e5c52bcdb76ce089b85276dbc447c6ff Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Thu, 5 Dec 2019 11:23:43 +0200 Subject: [PATCH 0332/1143] MC-4242: Newsletter subscriptions per website --- .../Adminhtml/Index/MassUnsubscribe.php | 45 +++++++++++++++++-- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index/MassUnsubscribe.php b/app/code/Magento/Customer/Controller/Adminhtml/Index/MassUnsubscribe.php index 17f420d864df0..723f325cb08c8 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Index/MassUnsubscribe.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Index/MassUnsubscribe.php @@ -6,10 +6,13 @@ namespace Magento\Customer\Controller\Adminhtml\Index; use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Customer\Api\Data\CustomerInterface; +use Magento\Customer\Model\Config\Share; use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface; use Magento\Framework\Controller\ResultFactory; use Magento\Backend\App\Action\Context; use Magento\Newsletter\Model\SubscriptionManagerInterface; +use Magento\Store\Model\StoreManagerInterface; use Magento\Ui\Component\MassAction\Filter; use Magento\Customer\Model\ResourceModel\Customer\CollectionFactory; use Magento\Eav\Model\Entity\Collection\AbstractCollection; @@ -29,23 +32,38 @@ class MassUnsubscribe extends AbstractMassAction implements HttpPostActionInterf */ private $subscriptionManager; + /** + * @var StoreManagerInterface + */ + private $storeManager; + + /** + * @var Share + */ + private $shareConfig; + /** * @param Context $context * @param Filter $filter * @param CollectionFactory $collectionFactory * @param CustomerRepositoryInterface $customerRepository * @param SubscriptionManagerInterface $subscriptionManager + * @param Share $shareConfig */ public function __construct( Context $context, Filter $filter, CollectionFactory $collectionFactory, CustomerRepositoryInterface $customerRepository, - SubscriptionManagerInterface $subscriptionManager + SubscriptionManagerInterface $subscriptionManager, + StoreManagerInterface $storeManager, + Share $shareConfig ) { parent::__construct($context, $filter, $collectionFactory); $this->customerRepository = $customerRepository; $this->subscriptionManager = $subscriptionManager; + $this->storeManager = $storeManager; + $this->shareConfig = $shareConfig; } /** @@ -60,8 +78,9 @@ protected function massAction(AbstractCollection $collection) foreach ($collection->getAllIds() as $customerId) { // Verify customer exists $customer = $this->customerRepository->getById($customerId); - $storeId = (int)$customer->getStoreId(); - $this->subscriptionManager->unsubscribeCustomer($customerId, $storeId); + foreach ($this->getUnsubscribeStoreIds($customer) as $storeId) { + $this->subscriptionManager->unsubscribeCustomer((int)$customerId, $storeId); + } $customersUpdated++; } @@ -74,4 +93,24 @@ protected function massAction(AbstractCollection $collection) return $resultRedirect; } + + /** + * Get store ids to unsubscribe customer + * + * @param CustomerInterface $customer + * @return array + */ + private function getUnsubscribeStoreIds(CustomerInterface $customer): array + { + $storeIds = []; + if ($this->shareConfig->isGlobalScope()) { + foreach ($this->storeManager->getStores() as $store) { + $storeIds[(int)$store->getWebsiteId()] = (int)$store->getId(); + } + } else { + $storeIds = [(int)$customer->getStoreId()]; + } + + return $storeIds; + } } From c6697f065e461a7f244c5379603ce2a75feece18 Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Thu, 5 Dec 2019 14:17:27 +0200 Subject: [PATCH 0333/1143] MC-4242: Newsletter subscriptions per website --- .../Controller/Adminhtml/Index/MassUnsubscribe.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index/MassUnsubscribe.php b/app/code/Magento/Customer/Controller/Adminhtml/Index/MassUnsubscribe.php index 723f325cb08c8..05f8a24e30c42 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Index/MassUnsubscribe.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Index/MassUnsubscribe.php @@ -5,6 +5,7 @@ */ namespace Magento\Customer\Controller\Adminhtml\Index; +use Magento\Backend\Model\View\Result\Redirect; use Magento\Customer\Api\CustomerRepositoryInterface; use Magento\Customer\Api\Data\CustomerInterface; use Magento\Customer\Model\Config\Share; @@ -48,6 +49,7 @@ class MassUnsubscribe extends AbstractMassAction implements HttpPostActionInterf * @param CollectionFactory $collectionFactory * @param CustomerRepositoryInterface $customerRepository * @param SubscriptionManagerInterface $subscriptionManager + * @param StoreManagerInterface $storeManager * @param Share $shareConfig */ public function __construct( @@ -70,13 +72,13 @@ public function __construct( * Customer mass unsubscribe action * * @param AbstractCollection $collection - * @return \Magento\Backend\Model\View\Result\Redirect + * @return Redirect */ protected function massAction(AbstractCollection $collection) { $customersUpdated = 0; foreach ($collection->getAllIds() as $customerId) { - // Verify customer exists + // Verify that customer exists $customer = $this->customerRepository->getById($customerId); foreach ($this->getUnsubscribeStoreIds($customer) as $storeId) { $this->subscriptionManager->unsubscribeCustomer((int)$customerId, $storeId); @@ -87,7 +89,7 @@ protected function massAction(AbstractCollection $collection) if ($customersUpdated) { $this->messageManager->addSuccessMessage(__('A total of %1 record(s) were updated.', $customersUpdated)); } - /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ + /** @var Redirect $resultRedirect */ $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); $resultRedirect->setPath($this->getComponentRefererUrl()); From 74958a2004335596deb3f3a2799f06b6d47b1a1f Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Mon, 9 Dec 2019 15:46:11 +0200 Subject: [PATCH 0334/1143] MC-4242: Newsletter subscriptions per website --- .../Customer/Controller/Adminhtml/Index/MassSubscribe.php | 2 +- .../Customer/Controller/Adminhtml/Index/MassUnsubscribe.php | 2 +- .../Test/Unit/Controller/Adminhtml/Index/MassSubscribeTest.php | 3 ++- .../Unit/Controller/Adminhtml/Index/MassUnsubscribeTest.php | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index/MassSubscribe.php b/app/code/Magento/Customer/Controller/Adminhtml/Index/MassSubscribe.php index 881c5caebcbee..453035ad3151b 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Index/MassSubscribe.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Index/MassSubscribe.php @@ -15,7 +15,7 @@ use Magento\Framework\Controller\ResultFactory; /** - * Class MassSubscribe + * Class to mass subscribe customers by ids */ class MassSubscribe extends AbstractMassAction implements HttpPostActionInterface { diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index/MassUnsubscribe.php b/app/code/Magento/Customer/Controller/Adminhtml/Index/MassUnsubscribe.php index 05f8a24e30c42..245e06699e6b0 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Index/MassUnsubscribe.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Index/MassUnsubscribe.php @@ -19,7 +19,7 @@ use Magento\Eav\Model\Entity\Collection\AbstractCollection; /** - * Class MassUnsubscribe + * Class to mass unsubscribe customers by ids */ class MassUnsubscribe extends AbstractMassAction implements HttpPostActionInterface { diff --git a/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/MassSubscribeTest.php b/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/MassSubscribeTest.php index 8f672fbfb4da6..d8b88bba2cdbe 100644 --- a/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/MassSubscribeTest.php +++ b/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/MassSubscribeTest.php @@ -26,7 +26,8 @@ use PHPUnit\Framework\TestCase; /** - * Class MassSubscribeTest + * Class to test mass subscribe customers by ids + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class MassSubscribeTest extends TestCase diff --git a/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/MassUnsubscribeTest.php b/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/MassUnsubscribeTest.php index 303a11989236f..8220d50f418be 100644 --- a/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/MassUnsubscribeTest.php +++ b/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/MassUnsubscribeTest.php @@ -26,7 +26,8 @@ use PHPUnit\Framework\TestCase; /** - * Class MassUnsubscribeTest + * Class to test mass unsubscribe customers by ids + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class MassUnsubscribeTest extends TestCase From 3ccaec554c95517564aa41dd72dc3771e2d94907 Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Mon, 9 Dec 2019 16:26:37 +0200 Subject: [PATCH 0335/1143] MC-4242: Newsletter subscriptions per website --- .../Test/Unit/Block/Adminhtml/Edit/Tab/NewsletterTest.php | 2 +- .../Customer/Block/Adminhtml/Edit/Tab/NewsletterTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Customer/Test/Unit/Block/Adminhtml/Edit/Tab/NewsletterTest.php b/app/code/Magento/Customer/Test/Unit/Block/Adminhtml/Edit/Tab/NewsletterTest.php index 22a22742cdb8d..d0ea012a11e1e 100644 --- a/app/code/Magento/Customer/Test/Unit/Block/Adminhtml/Edit/Tab/NewsletterTest.php +++ b/app/code/Magento/Customer/Test/Unit/Block/Adminhtml/Edit/Tab/NewsletterTest.php @@ -16,7 +16,7 @@ use Magento\Framework\Data\Form; use Magento\Framework\Data\Form\Element\Checkbox; use Magento\Framework\Data\Form\Element\Fieldset; -use \Magento\Framework\Data\Form\Element\Select; +use Magento\Framework\Data\Form\Element\Select; use Magento\Framework\Data\FormFactory; use Magento\Framework\Registry; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/NewsletterTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/NewsletterTest.php index a44101da77d6d..9ddba4b994b40 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/NewsletterTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/NewsletterTest.php @@ -9,7 +9,7 @@ use Magento\TestFramework\Helper\Bootstrap; /** - * Class NewsletterTest + * Test Customer account form block functionality * * @magentoAppArea adminhtml */ From ecca7514a4a956eea2fa7efb34f9f176f00d1e60 Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Tue, 10 Dec 2019 10:40:13 +0200 Subject: [PATCH 0336/1143] MC-4242: Newsletter subscriptions per website --- .../Magento/Newsletter/Model/Plugin/CustomerPlugin.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php b/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php index 83bafe5bf2887..60b279b659ca6 100644 --- a/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php +++ b/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php @@ -220,8 +220,11 @@ public function afterDelete(CustomerRepositoryInterface $subject, $result, Custo */ public function afterGetById(CustomerRepositoryInterface $subject, CustomerInterface $customer) { - $isSubscribed = $this->getSubscriber($customer)->isSubscribed(); - $this->addIsSubscribedExtensionAttr($customer, $isSubscribed); + $extensionAttributes = $customer->getExtensionAttributes(); + if ($extensionAttributes === null || $extensionAttributes->getIsSubscribed() === null) { + $isSubscribed = $this->getSubscriber($customer)->isSubscribed(); + $this->addIsSubscribedExtensionAttr($customer, $isSubscribed); + } return $customer; } From f4373bcce058fafbfc818a9e17bd355cd9b1d4ef Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Wed, 11 Dec 2019 15:12:13 +0200 Subject: [PATCH 0337/1143] static-test fix --- .../js/jasmine/tests/lib/mage/browser.test.js | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/dev/tests/js/jasmine/tests/lib/mage/browser.test.js b/dev/tests/js/jasmine/tests/lib/mage/browser.test.js index 2c60497ce1bcc..ce76f5ec02b64 100644 --- a/dev/tests/js/jasmine/tests/lib/mage/browser.test.js +++ b/dev/tests/js/jasmine/tests/lib/mage/browser.test.js @@ -33,10 +33,13 @@ define([ spyOn($, 'ajax').and.callFake( function () { return { - done: function (data) { - obj.targetElementId = 1; - } - } + /** + * Succes result of ajax request + */ + done: function () { + obj.targetElementId = 1; + } + }; }); obj.openDialog('instance/url', 100, 100, 'title', options); obj.openDialog('instance/url', 100, 100, 'title', options); @@ -48,11 +51,14 @@ define([ spyOn($, 'ajax').and.callFake( function () { return { - done: function (data) { - obj.targetElementId = 'instance/url'; - obj.modalLoaded = true; - } - } + /** + * Succes result of ajax request + */ + done: function () { + obj.targetElementId = 'instance/url'; + obj.modalLoaded = true; + } + }; }); obj.openDialog('instance/url', 100, 100, 'title', undefined); obj.openDialog('instance/url', 100, 100, 'title', undefined); From 034a0ed158d3a69da40a3afdee218c20fe33a0e8 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Tue, 10 Dec 2019 13:58:09 +0200 Subject: [PATCH 0338/1143] Fix Static Test --- .../Magento/Backend/Controller/Adminhtml/Index/Denied.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Index/Denied.php b/app/code/Magento/Backend/Controller/Adminhtml/Index/Denied.php index c1e4245dea063..0d5245b5c11b2 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Index/Denied.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Index/Denied.php @@ -13,10 +13,11 @@ /** * To display Denied Page - * - * Class Denied */ class Denied extends DeniedController implements HttpGetActionInterface { - + /** + * @see _isAllowed() + */ + public const ADMIN_RESOURCE = 'Magento_Backend::admin'; } From da17c67bc68de7020d777a15aa4ff7f985f7300f Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Wed, 11 Dec 2019 16:31:16 +0200 Subject: [PATCH 0339/1143] Ignore Denied controllerAclTest --- .../Magento/Backend/_files/controller_acl_test_whitelist_ce.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/_files/controller_acl_test_whitelist_ce.txt b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/_files/controller_acl_test_whitelist_ce.txt index 1119824f217bb..77da8c564c36a 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/_files/controller_acl_test_whitelist_ce.txt +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/_files/controller_acl_test_whitelist_ce.txt @@ -1,6 +1,7 @@ Magento\Security\Controller\Adminhtml\Session\Activity Magento\Security\Controller\Adminhtml\Session\LogoutAll Magento\Backend\Controller\Adminhtml\Denied +Magento\Backend\Controller\Adminhtml\Index\Denied Magento\Backend\Controller\Adminhtml\Noroute\Index Magento\Directory\Controller\Adminhtml\Json\CountryRegion Magento\Tax\Controller\Adminhtml\Rule\AjaxLoadRates From d12ab03ef3788575ff69f1dc1ed0d9dd785de2ef Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Wed, 11 Dec 2019 21:54:17 +0700 Subject: [PATCH 0340/1143] [InstantPurchase] Cover Ui/CustomerAddressesFormatter and Ui/ShippingMethodFormatter by Unit Test --- .../Ui/CustomerAddressesFormatterTest.php | 56 +++++++++++++++++++ .../Model/Ui/ShippingMethodFormatterTest.php | 46 +++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 app/code/Magento/InstantPurchase/Test/Unit/Model/Ui/CustomerAddressesFormatterTest.php create mode 100644 app/code/Magento/InstantPurchase/Test/Unit/Model/Ui/ShippingMethodFormatterTest.php diff --git a/app/code/Magento/InstantPurchase/Test/Unit/Model/Ui/CustomerAddressesFormatterTest.php b/app/code/Magento/InstantPurchase/Test/Unit/Model/Ui/CustomerAddressesFormatterTest.php new file mode 100644 index 0000000000000..2abe6b82bc3a9 --- /dev/null +++ b/app/code/Magento/InstantPurchase/Test/Unit/Model/Ui/CustomerAddressesFormatterTest.php @@ -0,0 +1,56 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\InstantPurchase\Test\Unit\Model\Ui; + +use Magento\InstantPurchase\Model\Ui\CustomerAddressesFormatter; +use Magento\Customer\Model\Address; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\Directory\Model\Country; +use PHPUnit\Framework\TestCase; + +class CustomerAddressesFormatterTest extends TestCase +{ + /** + * @var CustomerAddressesFormatter|\PHPUnit_Framework_MockObject_MockObject + */ + private $customerAddressesFormatter; + + /** + * Setup environment for testing + */ + protected function setUp() + { + $objectManager = new ObjectManagerHelper($this); + $this->customerAddressesFormatter = $objectManager->getObject(CustomerAddressesFormatter::class); + } + + /** + * Test format() + */ + public function testFormat() + { + $addressMock = $this->createPartialMock( + Address::class, + ['getName', 'getStreetFull', 'getCity', 'getRegion', 'getPostcode', 'getCountryModel'] + ); + $countryMock = $this->createMock(Country::class); + + $countryMock->expects($this->any())->method('getName')->willReturn('USA'); + $addressMock->expects($this->any())->method('getName')->willReturn('Address Name'); + $addressMock->expects($this->any())->method('getStreetFull')->willReturn('Address Street Full'); + $addressMock->expects($this->any())->method('getCity')->willReturn('Address City'); + $addressMock->expects($this->any())->method('getRegion')->willReturn('Address Region'); + $addressMock->expects($this->any())->method('getPostcode')->willReturn('Address Postcode'); + $addressMock->expects($this->any())->method('getCountryModel')->willReturn($countryMock); + + $this->assertEquals( + 'Address Name, Address Street Full, Address City, Address Region Address Postcode, USA', + $this->customerAddressesFormatter->format($addressMock) + ); + } +} diff --git a/app/code/Magento/InstantPurchase/Test/Unit/Model/Ui/ShippingMethodFormatterTest.php b/app/code/Magento/InstantPurchase/Test/Unit/Model/Ui/ShippingMethodFormatterTest.php new file mode 100644 index 0000000000000..632392bcb35e3 --- /dev/null +++ b/app/code/Magento/InstantPurchase/Test/Unit/Model/Ui/ShippingMethodFormatterTest.php @@ -0,0 +1,46 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\InstantPurchase\Test\Unit\Model\Ui; + +use Magento\InstantPurchase\Model\Ui\ShippingMethodFormatter; +use Magento\Quote\Api\Data\ShippingMethodInterface; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use PHPUnit\Framework\TestCase; + +class ShippingMethodFormatterTest extends TestCase +{ + /** + * @var ShippingMethodFormatter|\PHPUnit_Framework_MockObject_MockObject + */ + private $shippingMethodFormatter; + + /** + * Setup environment for testing + */ + protected function setUp() + { + $objectManager = new ObjectManagerHelper($this); + $this->shippingMethodFormatter = $objectManager->getObject(ShippingMethodFormatter::class); + } + + /** + * Test format() + */ + public function testFormat() + { + $shippingMethodMock = $this->createMock(ShippingMethodInterface::class, ['getCarrierTitle', 'getMethodTitle']); + + $shippingMethodMock->expects($this->any())->method('getCarrierTitle')->willReturn('flatrate'); + $shippingMethodMock->expects($this->any())->method('getMethodTitle')->willReturn('flatrate'); + + $this->assertEquals( + 'flatrate - flatrate', + $this->shippingMethodFormatter->format($shippingMethodMock) + ); + } +} From f8452c7a24b12af236b19b66f7d29b49421d0d54 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Wed, 11 Dec 2019 21:59:59 +0700 Subject: [PATCH 0341/1143] [InstantPurchase] Cover Ui/CustomerAddressesFormatter and Ui/ShippingMethodFormatter by Unit Test --- .../Test/Unit/Model/Ui/CustomerAddressesFormatterTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/InstantPurchase/Test/Unit/Model/Ui/CustomerAddressesFormatterTest.php b/app/code/Magento/InstantPurchase/Test/Unit/Model/Ui/CustomerAddressesFormatterTest.php index 2abe6b82bc3a9..2a53a36a46cd6 100644 --- a/app/code/Magento/InstantPurchase/Test/Unit/Model/Ui/CustomerAddressesFormatterTest.php +++ b/app/code/Magento/InstantPurchase/Test/Unit/Model/Ui/CustomerAddressesFormatterTest.php @@ -44,12 +44,12 @@ public function testFormat() $addressMock->expects($this->any())->method('getName')->willReturn('Address Name'); $addressMock->expects($this->any())->method('getStreetFull')->willReturn('Address Street Full'); $addressMock->expects($this->any())->method('getCity')->willReturn('Address City'); - $addressMock->expects($this->any())->method('getRegion')->willReturn('Address Region'); - $addressMock->expects($this->any())->method('getPostcode')->willReturn('Address Postcode'); + $addressMock->expects($this->any())->method('getRegion')->willReturn('California'); + $addressMock->expects($this->any())->method('getPostcode')->willReturn('12345'); $addressMock->expects($this->any())->method('getCountryModel')->willReturn($countryMock); $this->assertEquals( - 'Address Name, Address Street Full, Address City, Address Region Address Postcode, USA', + 'Address Name, Address Street Full, Address City, California 12345, USA', $this->customerAddressesFormatter->format($addressMock) ); } From 4c32e54843990a66fa715921bd2ce38c979ad23d Mon Sep 17 00:00:00 2001 From: Andrii Meysar <andrii.meysar@transoftgroup.com> Date: Wed, 11 Dec 2019 17:11:19 +0200 Subject: [PATCH 0342/1143] MC-29658: [2.4] Strange changes in the URL structure for subcategories --- setup/src/Magento/Setup/Fixtures/CategoriesFixture.php | 10 ++++++---- .../Setup/Test/Unit/Fixtures/CategoriesFixtureTest.php | 10 +++++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/setup/src/Magento/Setup/Fixtures/CategoriesFixture.php b/setup/src/Magento/Setup/Fixtures/CategoriesFixture.php index e8a0a469e2ee5..782f688f8a09e 100644 --- a/setup/src/Magento/Setup/Fixtures/CategoriesFixture.php +++ b/setup/src/Magento/Setup/Fixtures/CategoriesFixture.php @@ -9,6 +9,7 @@ use Magento\Catalog\Model\Category; use Magento\Catalog\Model\CategoryFactory; use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory; +use Magento\Store\Model\Store; use Magento\Store\Model\StoreManager; /** @@ -82,7 +83,7 @@ public function __construct( protected $priority = 20; /** - * {@inheritdoc} + * @inheritdoc */ public function execute() { @@ -97,7 +98,7 @@ public function execute() $category = $this->categoryFactory->create(); $category->load($parentCategoryId); // Need for generation url rewrites per all category store view - $category->setStoreId(\Magento\Store\Model\Store::DEFAULT_STORE_ID); + $category->setStoreId(Store::DEFAULT_STORE_ID); $categoryIndex = 1; $this->generateCategories( $category, @@ -130,6 +131,7 @@ private function generateCategories( $category->setId(null) ->setUrlKey(null) ->setUrlPath(null) + ->setStoreId(Store::DEFAULT_STORE_ID) ->setName($this->getCategoryName($parentCategory, $nestingLevel, $i)) ->setParentId($parentCategory->getId()) ->setLevel($parentCategory->getLevel() + 1) @@ -237,7 +239,7 @@ private function getCategoryPrefix() } /** - * {@inheritdoc} + * @inheritdoc */ public function getActionTitle() { @@ -245,7 +247,7 @@ public function getActionTitle() } /** - * {@inheritdoc} + * @inheritdoc */ public function introduceParamLabels() { diff --git a/setup/src/Magento/Setup/Test/Unit/Fixtures/CategoriesFixtureTest.php b/setup/src/Magento/Setup/Test/Unit/Fixtures/CategoriesFixtureTest.php index 9e2a7b46514bd..348afab198ab8 100644 --- a/setup/src/Magento/Setup/Test/Unit/Fixtures/CategoriesFixtureTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Fixtures/CategoriesFixtureTest.php @@ -12,6 +12,7 @@ use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use Magento\Setup\Fixtures\CategoriesFixture; use Magento\Setup\Fixtures\FixtureModel; +use Magento\Store\Model\Store; class CategoriesFixtureTest extends \PHPUnit\Framework\TestCase { @@ -40,7 +41,10 @@ class CategoriesFixtureTest extends \PHPUnit\Framework\TestCase */ private $categoryFactoryMock; - public function setUp() + /** + * @inhertidoc + */ + protected function setUp() { $this->fixtureModelMock = $this->createMock(FixtureModel::class); $this->collectionFactoryMock = $this->createPartialMock(CollectionFactory::class, ['create']); @@ -146,6 +150,10 @@ public function testExecute() $categoryMock->expects($this->once()) ->method('setIsActive') ->willReturnSelf(); + $categoryMock->expects($this->exactly(2)) + ->method('setStoreId') + ->with(Store::DEFAULT_STORE_ID) + ->willReturnSelf(); $this->categoryFactoryMock->expects($this->once())->method('create')->willReturn($categoryMock); From 9dea197f30e4dd40966805296efee6b69982710d Mon Sep 17 00:00:00 2001 From: Adam Mellen <github@mellen.io> Date: Wed, 11 Dec 2019 15:16:04 +0000 Subject: [PATCH 0343/1143] Updating wee -> weee as per https://github.com/magento/devdocs/pull/5911 --- app/code/Magento/Weee/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Weee/README.md b/app/code/Magento/Weee/README.md index 61f9b8d6d8970..ef433ec4c96f9 100644 --- a/app/code/Magento/Weee/README.md +++ b/app/code/Magento/Weee/README.md @@ -2,10 +2,10 @@ The Magento_Weee module enables the application of fees/fixed product taxes (FPT) on certain types of products, usually related to electronic devices and recycling. Fixed product taxes can be used to setup a WEEE tax that is a fixed amount, rather than a percentage of the product price. FPT can be configured to be displayed at various places in Magento. Rules, amounts, and display options can be configured in the backend. This module extends the existing functionality of Magento_Tax. -The Magento_Wee module includes the following: +The Magento_Weee module includes the following: * ability to add different number of fixed product taxes to product. They are treated as a product attribute; -* configuration of where Weee appears (on category, product, sales, invoice, or credit memo pages) and whether FPT should be taxed; +* configuration of where WEEE appears (on category, product, sales, invoice, or credit memo pages) and whether FPT should be taxed; * a new line item in the totals section. # System requirements From 01e0f9168b9724a99724dda89f3ee988c729476e Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Wed, 11 Dec 2019 22:28:55 +0700 Subject: [PATCH 0344/1143] [Newsletter] Refactor code and Cover Model/Observer class by Unit Test --- .../Magento/Newsletter/Model/Observer.php | 37 ++++++++--- .../Test/Unit/Model/ObserverTest.php | 63 +++++++++++++++++++ 2 files changed, 91 insertions(+), 9 deletions(-) create mode 100644 app/code/Magento/Newsletter/Test/Unit/Model/ObserverTest.php diff --git a/app/code/Magento/Newsletter/Model/Observer.php b/app/code/Magento/Newsletter/Model/Observer.php index d77371569601f..a6f8ffd461d08 100644 --- a/app/code/Magento/Newsletter/Model/Observer.php +++ b/app/code/Magento/Newsletter/Model/Observer.php @@ -3,8 +3,14 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + +declare(strict_types=1); + namespace Magento\Newsletter\Model; +use Magento\Newsletter\Model\ResourceModel\Queue\Collection; +use Magento\Newsletter\Model\ResourceModel\Queue\CollectionFactory; + /** * Newsletter module observer * @@ -12,20 +18,35 @@ */ class Observer { + /** + * Number of queue + */ + private const COUNT_OF_QUEUE = 3; + + /** + * Number of subscriptions + */ + private const COUNT_OF_SUBSCRIPTIONS = 20; + + /** + * First page in collection + */ + private const FIRST_PAGE = 1; + /** * Queue collection factory * - * @var \Magento\Newsletter\Model\ResourceModel\Queue\CollectionFactory + * @var CollectionFactory */ protected $_queueCollectionFactory; /** * Construct * - * @param \Magento\Newsletter\Model\ResourceModel\Queue\CollectionFactory $queueCollectionFactory + * @param CollectionFactory $queueCollectionFactory */ public function __construct( - \Magento\Newsletter\Model\ResourceModel\Queue\CollectionFactory $queueCollectionFactory + CollectionFactory $queueCollectionFactory ) { $this->_queueCollectionFactory = $queueCollectionFactory; } @@ -37,13 +58,11 @@ public function __construct( */ public function scheduledSend() { - $countOfQueue = 3; - $countOfSubscriptions = 20; - - /** @var \Magento\Newsletter\Model\ResourceModel\Queue\Collection $collection */ + /** @var Collection $collection */ $collection = $this->_queueCollectionFactory->create(); - $collection->setPageSize($countOfQueue)->setCurPage(1)->addOnlyForSendingFilter()->load(); + $collection->setPageSize(self::COUNT_OF_QUEUE) + ->setCurPage(self::FIRST_PAGE)->addOnlyForSendingFilter()->load(); - $collection->walk('sendPerSubscriber', [$countOfSubscriptions]); + $collection->walk('sendPerSubscriber', [self::COUNT_OF_SUBSCRIPTIONS]); } } diff --git a/app/code/Magento/Newsletter/Test/Unit/Model/ObserverTest.php b/app/code/Magento/Newsletter/Test/Unit/Model/ObserverTest.php new file mode 100644 index 0000000000000..7bf6d1e1c8671 --- /dev/null +++ b/app/code/Magento/Newsletter/Test/Unit/Model/ObserverTest.php @@ -0,0 +1,63 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Newsletter\Test\Unit\Model; + +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\Newsletter\Model\Observer; +use Magento\Newsletter\Model\ResourceModel\Queue\Collection; +use Magento\Newsletter\Model\ResourceModel\Queue\CollectionFactory; +use PHPUnit\Framework\TestCase; + +class ObserverTest extends TestCase +{ + /** + * @var Observer + */ + private $model; + + /** + * @var CollectionFactory|\PHPUnit_Framework_MockObject_MockObject + */ + private $collectionFactoryMock; + + /** + * Setup environment for test + */ + protected function setUp() + { + $objectManager = new ObjectManagerHelper($this); + + $this->collectionFactoryMock = $this->createPartialMock( + CollectionFactory::class, + ['create'] + ); + + $this->model = $objectManager->getObject( + Observer::class, + [ + 'queueCollectionFactory' => $this->collectionFactoryMock + ] + ); + } + + /** + * Test scheduledSend() method + */ + public function testScheduledSend() + { + $collectionMock = $this->createMock(Collection::class); + $this->collectionFactoryMock->expects($this->once())->method('create')->willReturn($collectionMock); + $collectionMock->expects($this->once())->method('setPageSize')->with(3)->willReturnSelf(); + $collectionMock->expects($this->once())->method('setCurPage')->with(1)->willReturnSelf(); + $collectionMock->expects($this->once())->method('addOnlyForSendingFilter')->willReturnSelf(); + $collectionMock->expects($this->once())->method('load')->willReturnSelf(); + $collectionMock->expects($this->once())->method('walk')->with('sendPerSubscriber', [20]); + + $this->model->scheduledSend(); + } +} From 3f4642ed3529467baafad828dd415749f0395176 Mon Sep 17 00:00:00 2001 From: Douglas Radburn <douglas.radburn@pinpointdesigns.co.uk> Date: Wed, 11 Dec 2019 15:32:16 +0000 Subject: [PATCH 0345/1143] Updated code test --- app/code/Magento/Theme/Block/Html/Pager.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Theme/Block/Html/Pager.php b/app/code/Magento/Theme/Block/Html/Pager.php index e86310b66bb4b..866203c72b83b 100644 --- a/app/code/Magento/Theme/Block/Html/Pager.php +++ b/app/code/Magento/Theme/Block/Html/Pager.php @@ -450,9 +450,11 @@ public function getLastPageUrl() */ public function getPageUrl($page) { - return $this->getPagerUrl([ - $this->getPageVarName() => $page > 1 ? $page : null, - ]); + return $this->getPagerUrl( + [ + $this->getPageVarName() => $page > 1 ? $page : null, + ] + ); } /** From 29f0417a28ad71d4dd42485b88da125ccd960a2e Mon Sep 17 00:00:00 2001 From: Mastiuhin Olexandr <mastiuhin.olexandr@transoftgroup.com> Date: Wed, 11 Dec 2019 18:08:28 +0200 Subject: [PATCH 0346/1143] MC-25098: Product is not deleted from minicart if not included in shared catalog --- app/code/Magento/Checkout/Model/Session.php | 4 +++ .../Magento/Checkout/Model/SessionTest.php | 30 +++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/app/code/Magento/Checkout/Model/Session.php b/app/code/Magento/Checkout/Model/Session.php index 4a4861fa9ccd2..7af00f1df8e95 100644 --- a/app/code/Magento/Checkout/Model/Session.php +++ b/app/code/Magento/Checkout/Model/Session.php @@ -272,6 +272,10 @@ public function getQuote() */ $quote = $this->quoteRepository->get($this->getQuoteId()); } + + if ($quote->getTotalsCollectedFlag() === false) { + $quote->collectTotals(); + } } catch (NoSuchEntityException $e) { $this->setQuoteId(null); } diff --git a/dev/tests/integration/testsuite/Magento/Checkout/Model/SessionTest.php b/dev/tests/integration/testsuite/Magento/Checkout/Model/SessionTest.php index 4682453012952..c7802f73a9a47 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/Model/SessionTest.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/Model/SessionTest.php @@ -7,6 +7,7 @@ use Magento\Catalog\Api\Data\ProductTierPriceInterface; use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product\Attribute\Source\Status; use Magento\Customer\Api\CustomerRepositoryInterface; use Magento\Customer\Model\Session as CustomerSession; use Magento\Framework\Api\FilterBuilder; @@ -54,6 +55,35 @@ protected function setUp() $this->checkoutSession = $this->objectManager->create(Session::class); } + /** + * Tests that quote items and totals are correct when product becomes unavailable. + * + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoDataFixture Magento/Sales/_files/quote.php + * @magentoAppIsolation enabled + */ + public function testGetQuoteWithUnavailableProduct() + { + $reservedOrderId = 'test01'; + $quoteGrandTotal = 10; + + $quote = $this->getQuote($reservedOrderId); + $this->assertEquals(1, $quote->getItemsCount()); + $this->assertCount(1, $quote->getItems()); + $this->assertEquals($quoteGrandTotal, $quote->getShippingAddress()->getBaseGrandTotal()); + + $productRepository = $this->objectManager->get(ProductRepositoryInterface::class); + $product = $productRepository->get('simple'); + $product->setStatus(Status::STATUS_DISABLED); + $productRepository->save($product); + $this->checkoutSession->setQuoteId($quote->getId()); + $quote = $this->checkoutSession->getQuote(); + + $this->assertEquals(0, $quote->getItemsCount()); + $this->assertEmpty($quote->getItems()); + $this->assertEquals(0, $quote->getShippingAddress()->getBaseGrandTotal()); + } + /** * Test covers case when quote is not yet initialized and customer data is set to checkout session model. * From 5a1e0fff4c94a732e327ae4aec969365185f0289 Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@adobe.com> Date: Wed, 11 Dec 2019 10:17:12 -0600 Subject: [PATCH 0347/1143] MQE-1921: [MTF-To-MFTF] Process PR 711 --- .../StorefrontClickHeaderLinkActionGroup.xml | 6 +-- .../StorefrontSeeHeaderLinksActionGroup.xml | 4 +- .../Mftf/Section/StorefrontHeaderSection.xml | 3 +- ...teAccountPasswordComplexityActionGroup.xml | 2 +- .../StorefrontCustomerCreateFormSection.xml | 2 +- .../NewCustomerPasswordComplexityTest.xml | 32 ++++++-------- .../Test/NewCustomerPasswordLengthTest.xml | 43 +++++++++++++++++++ .../NewCustomerPasswordComplexityTest.xml | 6 +-- 8 files changed, 66 insertions(+), 32 deletions(-) create mode 100644 app/code/Magento/Security/Test/Mftf/Test/NewCustomerPasswordLengthTest.xml diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontClickHeaderLinkActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontClickHeaderLinkActionGroup.xml index 46c06e909b4d9..052a5ac6a14e6 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontClickHeaderLinkActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontClickHeaderLinkActionGroup.xml @@ -9,9 +9,9 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="StorefrontClickHeaderLinkActionGroup"> <arguments> - <argument name="LinkName" type="string" defaultValue="Create an Account"/> + <argument name="linkName" type="string" defaultValue="Create an Account"/> </arguments> - <click stepKey="ClickTheLink" selector="{{StorefrontHeaderSection.HeaderLinkByText(LinkName)}}"/> - <waitForPageLoad stepKey="Wait"/> + <click stepKey="clickTheLink" selector="{{StorefrontHeaderSection.headerLinkByText(linkName)}}"/> + <waitForPageLoad stepKey="wait"/> </actionGroup> </actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontSeeHeaderLinksActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontSeeHeaderLinksActionGroup.xml index 3155cca583d59..f4498e3b6cdd7 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontSeeHeaderLinksActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontSeeHeaderLinksActionGroup.xml @@ -9,8 +9,8 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="StorefrontSeeHeaderLinksActionGroup"> <arguments> - <argument name="LinkName" type="string" defaultValue="Create an Account"/> + <argument name="linkName" type="string" defaultValue="Create an Account"/> </arguments> - <see stepKey="SeeElement" selector="{{StorefrontHeaderSection.headerlinks}}" userInput="{{LinkName}}"/> + <see stepKey="seeElement" selector="{{StorefrontHeaderSection.headerlinks}}" userInput="{{linkName}}"/> </actionGroup> </actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/Section/StorefrontHeaderSection.xml b/app/code/Magento/Cms/Test/Mftf/Section/StorefrontHeaderSection.xml index fefde1e6035f3..7b47c6b49db7b 100644 --- a/app/code/Magento/Cms/Test/Mftf/Section/StorefrontHeaderSection.xml +++ b/app/code/Magento/Cms/Test/Mftf/Section/StorefrontHeaderSection.xml @@ -10,7 +10,6 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="StorefrontHeaderSection"> <element name="headerlinks" type="text" selector="ul.header.links"/> - <element name="HeaderLinkByText" type="text" selector="//ul[contains(@class, 'header') and contains(@class, 'links')]/li/a[contains(text(),'{{LinkName}}')]" - parameterized="true" /> + <element name="headerLinkByText" type="text" selector="//ul[contains(@class, 'header') and contains(@class, 'links')]/li/a[contains(text(),'{{LinkName}}')]" parameterized="true"/> </section> </sections> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AssertMessageCustomerCreateAccountPasswordComplexityActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AssertMessageCustomerCreateAccountPasswordComplexityActionGroup.xml index 9d7dbc604f59d..95a03042bec3b 100644 --- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AssertMessageCustomerCreateAccountPasswordComplexityActionGroup.xml +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AssertMessageCustomerCreateAccountPasswordComplexityActionGroup.xml @@ -12,6 +12,6 @@ <arguments> <argument name="message" type="string"/> </arguments> - <see userInput="{{message}}" selector="{{StorefrontCustomerCreateFormSection.PasswordErrorMessages}}" stepKey="verifyMessage" /> + <see userInput="{{message}}" selector="{{StorefrontCustomerCreateFormSection.passwordErrorMessages}}" stepKey="verifyMessage"/> </actionGroup> </actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerCreateFormSection.xml b/app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerCreateFormSection.xml index 17048dda688e6..9fc26a03b04ee 100644 --- a/app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerCreateFormSection.xml +++ b/app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerCreateFormSection.xml @@ -17,7 +17,7 @@ <element name="passwordField" type="input" selector="#password"/> <element name="confirmPasswordField" type="input" selector="#password-confirmation"/> <element name="createAccountButton" type="button" selector="button.action.submit.primary" timeout="30"/> - <element name="PasswordErrorMessages" type="text" selector="#password-error"/> + <element name="passwordErrorMessages" type="text" selector="#password-error"/> </section> <section name="StoreFrontCustomerAdvancedAttributesSection"> <element name="textFieldAttribute" type="input" selector="//input[@id='{{var}}']" parameterized="true" /> diff --git a/app/code/Magento/Security/Test/Mftf/Test/NewCustomerPasswordComplexityTest.xml b/app/code/Magento/Security/Test/Mftf/Test/NewCustomerPasswordComplexityTest.xml index ccd97f83cd0a6..74a9c68cb2f79 100644 --- a/app/code/Magento/Security/Test/Mftf/Test/NewCustomerPasswordComplexityTest.xml +++ b/app/code/Magento/Security/Test/Mftf/Test/NewCustomerPasswordComplexityTest.xml @@ -11,39 +11,33 @@ <test name="NewCustomerPasswordComplexityTest"> <annotations> <features value="Security"/> - <stories value="Checking customer's password length and password complexity"/> - <title value="Notify the customer if password length or complexity is not match to requirements"/> - <description value="Show notifies to the customer if password length or complexity is not match to requirements"/> + <stories value="Checking customer's password complexity"/> + <title value="Notify the customer if password complexity does not match the requirements"/> + <description value="Notify the customer if password complexity does not match the requirements"/> + <testCaseId value="MC-14368"/> <group value="security"/> <group value="mtf_migrated"/> </annotations> - <!-- TEST BODY --> <!-- Go to storefront home page --> <actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="openStoreFrontHomePage"/> + <!-- See the Registration Link --> - <actionGroup ref="StorefrontSeeHeaderLinksActionGroup" stepKey="SeeTheLink"/> + <actionGroup ref="StorefrontSeeHeaderLinksActionGroup" stepKey="seeTheLink"/> + <!-- Click the Registration Link --> - <actionGroup ref="StorefrontClickHeaderLinkActionGroup" stepKey="ClickTheLink"> - <argument name="LinkName" value="Create an Account"/> - </actionGroup> - <!-- Fill Registration Form with Password length is bellow 8 Characters --> - <actionGroup ref="StorefrontFillCustomerAccountCreationFormActionGroup" stepKey="FillRegistrationFormPasswordLengthBellowEightCharacters"> - <argument name="customer" value="Simple_Customer_With_Password_Length_Is_Below_Eight_Characters"/> - </actionGroup> - <!-- See the Error --> - <actionGroup ref="AssertMessageCustomerCreateAccountPasswordComplexityActionGroup" stepKey="SeeTheErrorPasswordLength"> - <argument name="message" value="Minimum length of this field must be equal or greater than 8 symbols. Leading and trailing spaces will be ignored."/> + <actionGroup ref="StorefrontClickHeaderLinkActionGroup" stepKey="clickTheLink"> + <argument name="linkName" value="Create an Account"/> </actionGroup> + <!-- Fill Registration Form with not secure enough password --> - <actionGroup ref="StorefrontFillCustomerAccountCreationFormActionGroup" stepKey="FillRegistrationFormPasswordNotSecure"> + <actionGroup ref="StorefrontFillCustomerAccountCreationFormActionGroup" stepKey="fillRegistrationFormPasswordNotSecure"> <argument name="customer" value="Simple_Customer_With_Not_Secure_Password"/> </actionGroup> + <!-- See the Error --> - <actionGroup ref="AssertMessageCustomerCreateAccountPasswordComplexityActionGroup" stepKey="SeeTheErrorPasswordSecure"> + <actionGroup ref="AssertMessageCustomerCreateAccountPasswordComplexityActionGroup" stepKey="seeTheErrorPasswordSecure"> <argument name="message" value="Minimum of different classes of characters in password is 3. Classes of characters: Lower Case, Upper Case, Digits, Special Characters."/> </actionGroup> - <!--Test Body END--> - </test> </tests> diff --git a/app/code/Magento/Security/Test/Mftf/Test/NewCustomerPasswordLengthTest.xml b/app/code/Magento/Security/Test/Mftf/Test/NewCustomerPasswordLengthTest.xml new file mode 100644 index 0000000000000..a10059d0603c5 --- /dev/null +++ b/app/code/Magento/Security/Test/Mftf/Test/NewCustomerPasswordLengthTest.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="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="NewCustomerPasswordLengthTest"> + <annotations> + <features value="Security"/> + <stories value="Checking customer's password length"/> + <title value="Notify the customer if password length does not match the requirements"/> + <description value="Notify the customer if password length does not match the requirements"/> + <testCaseId value="MC-14367"/> + <group value="security"/> + <group value="mtf_migrated"/> + </annotations> + + <!-- Go to storefront home page --> + <actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="openStoreFrontHomePage"/> + + <!-- See the Registration Link --> + <actionGroup ref="StorefrontSeeHeaderLinksActionGroup" stepKey="seeTheLink"/> + + <!-- Click the Registration Link --> + <actionGroup ref="StorefrontClickHeaderLinkActionGroup" stepKey="clickTheLink"> + <argument name="linkName" value="Create an Account"/> + </actionGroup> + + <!-- Fill Registration Form with Password length is bellow 8 Characters --> + <actionGroup ref="StorefrontFillCustomerAccountCreationFormActionGroup" stepKey="fillRegistrationFormPasswordLengthBellowEightCharacters"> + <argument name="customer" value="Simple_Customer_With_Password_Length_Is_Below_Eight_Characters"/> + </actionGroup> + + <!-- See the Error --> + <actionGroup ref="AssertMessageCustomerCreateAccountPasswordComplexityActionGroup" stepKey="seeTheErrorPasswordLength"> + <argument name="message" value="Minimum length of this field must be equal or greater than 8 symbols. Leading and trailing spaces will be ignored."/> + </actionGroup> + </test> +</tests> diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/NewCustomerPasswordComplexityTest.xml b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/NewCustomerPasswordComplexityTest.xml index 7b6f3e981714c..534f692a36aef 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/NewCustomerPasswordComplexityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/NewCustomerPasswordComplexityTest.xml @@ -8,7 +8,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\Security\Test\TestCase\NewCustomerPasswordComplexityTest" summary="New customer password complexity" ticketId="MAGETWO-49044"> <variation name="PasswordLengthTest" summary="Customer password length is below 8 characters"> - <data name="tag" xsi:type="string">severity:S1</data> + <data name="tag" xsi:type="string">severity:S1,mftf_migrated:yes</data> <data name="customer/data/firstname" xsi:type="string">john</data> <data name="customer/data/lastname" xsi:type="string">doe</data> <data name="customer/data/email" xsi:type="string">johndoe%isolation%@example.com</data> @@ -16,10 +16,9 @@ <data name="customer/data/password" xsi:type="string">123123</data> <data name="customer/data/password_confirmation" xsi:type="string">123123</data> <constraint name="Magento\Security\Test\Constraint\AssertPasswordLengthErrorMessage" /> - <data name="tag" xsi:type="string">mftf_migrated:yes</data> </variation> <variation name="PasswordComplexityTest" summary="Customer password is not secure enough"> - <data name="tag" xsi:type="string">severity:S1</data> + <data name="tag" xsi:type="string">severity:S1,mftf_migrated:yes</data> <data name="customer/data/firstname" xsi:type="string">john</data> <data name="customer/data/lastname" xsi:type="string">doe</data> <data name="customer/data/email" xsi:type="string">johndoe%isolation%@example.com</data> @@ -27,7 +26,6 @@ <data name="customer/data/password" xsi:type="string">123123qa</data> <data name="customer/data/password_confirmation" xsi:type="string">123123qa</data> <constraint name="Magento\Security\Test\Constraint\AssertPasswordIsNotSecureEnoughMessage" /> - <data name="tag" xsi:type="string">mftf_migrated:yes</data> </variation> </testCase> </config> From 7fa6b5ee674b838e8e1c707d3ad37074af3b1691 Mon Sep 17 00:00:00 2001 From: Mastiuhin Olexandr <mastiuhin.olexandr@transoftgroup.com> Date: Wed, 11 Dec 2019 18:27:32 +0200 Subject: [PATCH 0348/1143] MC-25251: Slow catalog_product_price indexer for Bundle products --- .../Model/ResourceModel/Indexer/Price.php | 250 ++++++++++++------ 1 file changed, 167 insertions(+), 83 deletions(-) diff --git a/app/code/Magento/Bundle/Model/ResourceModel/Indexer/Price.php b/app/code/Magento/Bundle/Model/ResourceModel/Indexer/Price.php index 077ebd4422aab..a2fff5739f2f9 100644 --- a/app/code/Magento/Bundle/Model/ResourceModel/Indexer/Price.php +++ b/app/code/Magento/Bundle/Model/ResourceModel/Indexer/Price.php @@ -7,6 +7,7 @@ use Magento\Catalog\Api\Data\ProductInterface; use Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\BasePriceModifier; +use Magento\Framework\DB\Select; use Magento\Framework\Indexer\DimensionalIndexerInterface; use Magento\Framework\EntityManager\MetadataPool; use Magento\Catalog\Model\Indexer\Product\Price\TableMaintainer; @@ -394,8 +395,8 @@ private function calculateBundleOptionPrice($priceTable, $dimensions) $connection = $this->getConnection(); $this->prepareBundleSelectionTable(); - $this->calculateBundleSelectionPrice($dimensions, \Magento\Bundle\Model\Product\Price::PRICE_TYPE_FIXED); - $this->calculateBundleSelectionPrice($dimensions, \Magento\Bundle\Model\Product\Price::PRICE_TYPE_DYNAMIC); + $this->calculateFixedBundleSelectionPrice(); + $this->calculateDynamicBundleSelectionPrice($dimensions); $this->prepareBundleOptionTable(); @@ -426,84 +427,17 @@ private function calculateBundleOptionPrice($priceTable, $dimensions) } /** - * Calculate bundle product selections price by product type + * Get base select for bundle selection price * - * @param array $dimensions - * @param int $priceType - * @return void + * @return Select * @throws \Exception - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - private function calculateBundleSelectionPrice($dimensions, $priceType) + private function getBaseBundleSelectionPriceSelect(): Select { - $connection = $this->getConnection(); - - if ($priceType == \Magento\Bundle\Model\Product\Price::PRICE_TYPE_FIXED) { - $selectionPriceValue = $connection->getCheckSql( - 'bsp.selection_price_value IS NULL', - 'bs.selection_price_value', - 'bsp.selection_price_value' - ); - $selectionPriceType = $connection->getCheckSql( - 'bsp.selection_price_type IS NULL', - 'bs.selection_price_type', - 'bsp.selection_price_type' - ); - $priceExpr = new \Zend_Db_Expr( - $connection->getCheckSql( - $selectionPriceType . ' = 1', - 'ROUND(i.price * (' . $selectionPriceValue . ' / 100),4)', - $connection->getCheckSql( - 'i.special_price > 0 AND i.special_price < 100', - 'ROUND(' . $selectionPriceValue . ' * (i.special_price / 100),4)', - $selectionPriceValue - ) - ) . '* bs.selection_qty' - ); - - $tierExpr = $connection->getCheckSql( - 'i.base_tier IS NOT NULL', - $connection->getCheckSql( - $selectionPriceType . ' = 1', - 'ROUND(i.base_tier - (i.base_tier * (' . $selectionPriceValue . ' / 100)),4)', - $connection->getCheckSql( - 'i.tier_percent > 0', - 'ROUND((1 - i.tier_percent / 100) * ' . $selectionPriceValue . ',4)', - $selectionPriceValue - ) - ) . ' * bs.selection_qty', - 'NULL' - ); - - $priceExpr = $connection->getLeastSql( - [ - $priceExpr, - $connection->getIfNullSql($tierExpr, $priceExpr), - ] - ); - } else { - $price = 'idx.min_price * bs.selection_qty'; - $specialExpr = $connection->getCheckSql( - 'i.special_price > 0 AND i.special_price < 100', - 'ROUND(' . $price . ' * (i.special_price / 100), 4)', - $price - ); - $tierExpr = $connection->getCheckSql( - 'i.tier_percent IS NOT NULL', - 'ROUND((1 - i.tier_percent / 100) * ' . $price . ', 4)', - 'NULL' - ); - $priceExpr = $connection->getLeastSql( - [ - $specialExpr, - $connection->getIfNullSql($tierExpr, $price), - ] - ); - } - $metadata = $this->metadataPool->getMetadata(ProductInterface::class); $linkField = $metadata->getLinkField(); - $select = $connection->select()->from( + + $select = $this->getConnection()->select()->from( ['i' => $this->getBundlePriceTable()], ['entity_id', 'customer_group_id', 'website_id'] )->join( @@ -518,22 +452,173 @@ private function calculateBundleSelectionPrice($dimensions, $priceType) ['bs' => $this->getTable('catalog_product_bundle_selection')], 'bs.option_id = bo.option_id', ['selection_id'] - )->joinLeft( + ); + + return $select; + } + + /** + * Apply selections price for fixed bundles + * + * @return void + * @throws \Exception + */ + private function applyFixedBundleSelectionPrice() + { + $connection = $this->getConnection(); + + $selectionPriceValue = 'bsp.selection_price_value'; + $selectionPriceType = 'bsp.selection_price_type'; + $priceExpr = new \Zend_Db_Expr( + $connection->getCheckSql( + $selectionPriceType . ' = 1', + 'ROUND(i.price * (' . $selectionPriceValue . ' / 100),4)', + $connection->getCheckSql( + 'i.special_price > 0 AND i.special_price < 100', + 'ROUND(' . $selectionPriceValue . ' * (i.special_price / 100),4)', + $selectionPriceValue + ) + ) . '* bs.selection_qty' + ); + $tierExpr = $connection->getCheckSql( + 'i.base_tier IS NOT NULL', + $connection->getCheckSql( + $selectionPriceType . ' = 1', + 'ROUND(i.base_tier - (i.base_tier * (' . $selectionPriceValue . ' / 100)),4)', + $connection->getCheckSql( + 'i.tier_percent > 0', + 'ROUND((1 - i.tier_percent / 100) * ' . $selectionPriceValue . ',4)', + $selectionPriceValue + ) + ) . ' * bs.selection_qty', + 'NULL' + ); + $priceExpr = $connection->getLeastSql( + [ + $priceExpr, + $connection->getIfNullSql($tierExpr, $priceExpr), + ] + ); + + $select = $this->getBaseBundleSelectionPriceSelect(); + $select->joinInner( ['bsp' => $this->getTable('catalog_product_bundle_selection_price')], 'bs.selection_id = bsp.selection_id AND bsp.website_id = i.website_id', - [''] - )->join( + [] + )->where( + 'i.price_type=?', + \Magento\Bundle\Model\Product\Price::PRICE_TYPE_FIXED + )->columns( + [ + 'group_type' => $connection->getCheckSql("bo.type = 'select' OR bo.type = 'radio'", '0', '1'), + 'is_required' => 'bo.required', + 'price' => $priceExpr, + 'tier_price' => $tierExpr, + ] + ); + $query = $select->crossUpdateFromSelect($this->getBundleSelectionTable()); + $connection->query($query); + } + + /** + * Calculate selections price for fixed bundles + * + * @return void + * @throws \Exception + */ + private function calculateFixedBundleSelectionPrice() + { + $connection = $this->getConnection(); + + $selectionPriceValue = 'bs.selection_price_value'; + $selectionPriceType = 'bs.selection_price_type'; + $priceExpr = new \Zend_Db_Expr( + $connection->getCheckSql( + $selectionPriceType . ' = 1', + 'ROUND(i.price * (' . $selectionPriceValue . ' / 100),4)', + $connection->getCheckSql( + 'i.special_price > 0 AND i.special_price < 100', + 'ROUND(' . $selectionPriceValue . ' * (i.special_price / 100),4)', + $selectionPriceValue + ) + ) . '* bs.selection_qty' + ); + $tierExpr = $connection->getCheckSql( + 'i.base_tier IS NOT NULL', + $connection->getCheckSql( + $selectionPriceType . ' = 1', + 'ROUND(i.base_tier - (i.base_tier * (' . $selectionPriceValue . ' / 100)),4)', + $connection->getCheckSql( + 'i.tier_percent > 0', + 'ROUND((1 - i.tier_percent / 100) * ' . $selectionPriceValue . ',4)', + $selectionPriceValue + ) + ) . ' * bs.selection_qty', + 'NULL' + ); + $priceExpr = $connection->getLeastSql( + [ + $priceExpr, + $connection->getIfNullSql($tierExpr, $priceExpr), + ] + ); + + $select = $this->getBaseBundleSelectionPriceSelect(); + $select->where( + 'i.price_type=?', + \Magento\Bundle\Model\Product\Price::PRICE_TYPE_FIXED + )->columns( + [ + 'group_type' => $connection->getCheckSql("bo.type = 'select' OR bo.type = 'radio'", '0', '1'), + 'is_required' => 'bo.required', + 'price' => $priceExpr, + 'tier_price' => $tierExpr, + ] + ); + $query = $select->insertFromSelect($this->getBundleSelectionTable()); + $connection->query($query); + + $this->applyFixedBundleSelectionPrice(); + } + + /** + * Calculate selections price for dynamic bundles + * + * @param array $dimensions + * @return void + * @throws \Exception + */ + private function calculateDynamicBundleSelectionPrice($dimensions) + { + $connection = $this->getConnection(); + + $price = 'idx.min_price * bs.selection_qty'; + $specialExpr = $connection->getCheckSql( + 'i.special_price > 0 AND i.special_price < 100', + 'ROUND(' . $price . ' * (i.special_price / 100), 4)', + $price + ); + $tierExpr = $connection->getCheckSql( + 'i.tier_percent IS NOT NULL', + 'ROUND((1 - i.tier_percent / 100) * ' . $price . ', 4)', + 'NULL' + ); + $priceExpr = $connection->getLeastSql( + [ + $specialExpr, + $connection->getIfNullSql($tierExpr, $price), + ] + ); + + $select = $this->getBaseBundleSelectionPriceSelect(); + $select->join( ['idx' => $this->getMainTable($dimensions)], 'bs.product_id = idx.entity_id AND i.customer_group_id = idx.customer_group_id' . ' AND i.website_id = idx.website_id', [] - )->join( - ['e' => $this->getTable('catalog_product_entity')], - 'bs.product_id = e.entity_id AND e.required_options=0', - [] )->where( 'i.price_type=?', - $priceType + \Magento\Bundle\Model\Product\Price::PRICE_TYPE_DYNAMIC )->columns( [ 'group_type' => $connection->getCheckSql("bo.type = 'select' OR bo.type = 'radio'", '0', '1'), @@ -542,7 +627,6 @@ private function calculateBundleSelectionPrice($dimensions, $priceType) 'tier_price' => $tierExpr, ] ); - $query = $select->insertFromSelect($this->getBundleSelectionTable()); $connection->query($query); } From 0dd0db5943415f8892d5ee1e3b2811caaf679351 Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@adobe.com> Date: Wed, 11 Dec 2019 10:47:23 -0600 Subject: [PATCH 0349/1143] MQE-1921: [MTF-To-MFTF] Process PR 711 - Add annotations to new action groups --- .../Mftf/ActionGroup/StorefrontClickHeaderLinkActionGroup.xml | 4 ++++ .../Mftf/ActionGroup/StorefrontSeeHeaderLinksActionGroup.xml | 3 +++ ...sageCustomerCreateAccountPasswordComplexityActionGroup.xml | 3 +++ 3 files changed, 10 insertions(+) diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontClickHeaderLinkActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontClickHeaderLinkActionGroup.xml index 052a5ac6a14e6..48e7ec81ae1c1 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontClickHeaderLinkActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontClickHeaderLinkActionGroup.xml @@ -8,9 +8,13 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="StorefrontClickHeaderLinkActionGroup"> + <annotations> + <description>Clicks a link in the storefront header.</description> + </annotations> <arguments> <argument name="linkName" type="string" defaultValue="Create an Account"/> </arguments> + <click stepKey="clickTheLink" selector="{{StorefrontHeaderSection.headerLinkByText(linkName)}}"/> <waitForPageLoad stepKey="wait"/> </actionGroup> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontSeeHeaderLinksActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontSeeHeaderLinksActionGroup.xml index f4498e3b6cdd7..ec5c388ee1c6b 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontSeeHeaderLinksActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/StorefrontSeeHeaderLinksActionGroup.xml @@ -8,6 +8,9 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="StorefrontSeeHeaderLinksActionGroup"> + <annotations> + <description>See a link by name in the storefront header.</description> + </annotations> <arguments> <argument name="linkName" type="string" defaultValue="Create an Account"/> </arguments> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AssertMessageCustomerCreateAccountPasswordComplexityActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AssertMessageCustomerCreateAccountPasswordComplexityActionGroup.xml index 95a03042bec3b..b62f5435275a3 100644 --- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AssertMessageCustomerCreateAccountPasswordComplexityActionGroup.xml +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AssertMessageCustomerCreateAccountPasswordComplexityActionGroup.xml @@ -9,6 +9,9 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="AssertMessageCustomerCreateAccountPasswordComplexityActionGroup"> + <annotations> + <description>Assert is shown an error about their password during new user form filling.</description> + </annotations> <arguments> <argument name="message" type="string"/> </arguments> From 0b7b23616d1a391125cd7cb3230f09ac28572441 Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@adobe.com> Date: Wed, 11 Dec 2019 11:04:02 -0600 Subject: [PATCH 0350/1143] MQE-1857: [MTF-To-MFTF] Process PR 746 --- .../AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.xml | 9 +++++---- ...nDeleteCmsPageUrlRewriteWithPermanentRedirectTest.xml | 8 ++++---- ...nDeleteCmsPageUrlRewriteWithTemporaryRedirectTest.xml | 8 ++++---- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.xml index 4c3bd8179578c..b6cd116956812 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.xml @@ -6,16 +6,16 @@ */ --> -<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest"> <annotations> <stories value="Delete CMS Page URL rewrite with No Redirects"/> <title value="Delete CMS Page URL rewrite with No Redirects"/> <description value="Log in to admin and delete CMS Page URL rewrite with No Redirects"/> - <group value="cMSContent"/> + <testCaseId value="MC-14648"/> <group value="mtf_migrated"/> </annotations> - <before> <createData entity="simpleCmsPage" stepKey="createCMSPage"/> <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> @@ -46,14 +46,15 @@ <actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="assertSuccessMessage"> <argument name="message" value="You deleted the URL rewrite."/> </actionGroup> + <!--Search and verify AssertUrlRewriteNotInGrid--> <actionGroup ref="AdminSearchDeletedUrlRewrite" stepKey="searchDeletedUrlRewriteInGrid"> <argument name="requestPath" value="newrequestpath"/> </actionGroup> + <!--Verify AssertPageByUrlRewriteIsNotFound--> <actionGroup ref="AssertPageByUrlRewriteIsNotFound" stepKey="assertPageByUrlRewriteIsNotFound"> <argument name="requestPath" value="newrequestpath"/> </actionGroup> - </test> </tests> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithPermanentRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithPermanentRedirectTest.xml index 89f663b54e017..1f76493bac89c 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithPermanentRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithPermanentRedirectTest.xml @@ -6,16 +6,16 @@ */ --> -<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="AdminDeleteCmsPageUrlRewriteWithPermanentRedirectTest"> <annotations> <stories value="Delete CMS Page URL rewrite with Permanent Redirect"/> <title value="Delete CMS Page URL rewrite with Permanent Redirect"/> <description value="Log in to admin and delete CMS Page URL rewrite with Permanent Redirect"/> - <group value="cMSContent"/> + <testCaseId value="MC-14649"/> <group value="mtf_migrated"/> </annotations> - <before> <createData entity="simpleCmsPage" stepKey="createCMSPage"/> <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> @@ -46,10 +46,10 @@ <actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="assertSuccessMessage"> <argument name="message" value="You deleted the URL rewrite."/> </actionGroup> + <!-- Verify AssertPageByUrlRewriteIsNotFound --> <actionGroup ref="AssertPageByUrlRewriteIsNotFound" stepKey="assertPageByUrlRewriteIsNotFound"> <argument name="requestPath" value="permanentrequestpath.html"/> </actionGroup> - </test> </tests> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithTemporaryRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithTemporaryRedirectTest.xml index ad7aec335b7a3..c62f0ece7e780 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithTemporaryRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithTemporaryRedirectTest.xml @@ -6,16 +6,16 @@ */ --> -<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="AdminDeleteCmsPageUrlRewriteWithTemporaryRedirectTest"> <annotations> <stories value="Delete CMS Page URL rewrite with Temporary Redirect"/> <title value="Delete CMS Page URL rewrite with Temporary Redirect"/> <description value="Log in to admin and delete CMS Page URL rewrite with Temporary Redirect"/> - <group value="cMSContent"/> + <testCaseId value="MC-14650"/> <group value="mtf_migrated"/> </annotations> - <before> <createData entity="simpleCmsPage" stepKey="createCMSPage"/> <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> @@ -46,10 +46,10 @@ <actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="assertSuccessMessage"> <argument name="message" value="You deleted the URL rewrite."/> </actionGroup> + <!--Verify AssertPageByUrlRewriteIsNotFound--> <actionGroup ref="AssertPageByUrlRewriteIsNotFound" stepKey="assertPageByUrlRewriteIsNotFound"> <argument name="requestPath" value="temporaryrequestpath.html"/> </actionGroup> - </test> </tests> From 26e5774754cd2ce52707bd1327345c6a89f12d19 Mon Sep 17 00:00:00 2001 From: Dmytro Cheshun <d.cheshun@atwix.com> Date: Wed, 11 Dec 2019 21:06:27 +0200 Subject: [PATCH 0351/1143] Minor code style fixes --- .../js/jasmine/tests/lib/mage/browser.test.js | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/dev/tests/js/jasmine/tests/lib/mage/browser.test.js b/dev/tests/js/jasmine/tests/lib/mage/browser.test.js index ce76f5ec02b64..06f355908daca 100644 --- a/dev/tests/js/jasmine/tests/lib/mage/browser.test.js +++ b/dev/tests/js/jasmine/tests/lib/mage/browser.test.js @@ -12,7 +12,6 @@ define([ var obj; beforeEach(function () { - /** * Dummy constructor to use for instantiation * @constructor @@ -27,14 +26,14 @@ define([ describe('"openDialog" method', function () { it('Opens dialog with provided targetElementId', function () { var options = { - 'targetElementId': 1 - }; + 'targetElementId': 1 + }; spyOn($, 'ajax').and.callFake( - function () { + function () { return { /** - * Succes result of ajax request + * Success result of ajax request */ done: function () { obj.targetElementId = 1; @@ -44,22 +43,21 @@ define([ obj.openDialog('instance/url', 100, 100, 'title', options); obj.openDialog('instance/url', 100, 100, 'title', options); expect($.ajax.calls.count()).toBe(1); - }); it('Opens dialog with provided url param', function () { spyOn($, 'ajax').and.callFake( - function () { - return { - /** - * Succes result of ajax request - */ - done: function () { - obj.targetElementId = 'instance/url'; - obj.modalLoaded = true; - } - }; - }); + function () { + return { + /** + * Success result of ajax request + */ + done: function () { + obj.targetElementId = 'instance/url'; + obj.modalLoaded = true; + } + }; + }); obj.openDialog('instance/url', 100, 100, 'title', undefined); obj.openDialog('instance/url', 100, 100, 'title', undefined); expect($.ajax.calls.count()).toBe(1); From 0934026841b91b302dab5a06c5e2118cb1d2ac59 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Wed, 11 Dec 2019 13:38:10 -0600 Subject: [PATCH 0352/1143] Change action groups name according to CE branch changes --- .../AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml index 1c1f7af5a5cd5..4b9f37f628f34 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml @@ -38,7 +38,7 @@ </actionGroup> <!--Delete the Category Url Rewrite--> - <actionGroup ref="AssertPageByUrlRewriteIsNotFoundActionGroup" stepKey="deleteCustomUrlRewrite"> + <actionGroup ref="AdminDeleteUrlRewriteActionGroup" stepKey="deleteCustomUrlRewrite"> <argument name="requestPath" value="-"/> </actionGroup> <actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="assertSuccessMessage"> From 16ab63b347dd4628ed1cc1947929ff44b6bad90c Mon Sep 17 00:00:00 2001 From: Lukasz Lewandowski <luklewluk@gmail.com> Date: Wed, 11 Dec 2019 15:25:39 -0600 Subject: [PATCH 0353/1143] Fix caching Product Metadata getVersion --- lib/internal/Magento/Framework/App/ProductMetadata.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/App/ProductMetadata.php b/lib/internal/Magento/Framework/App/ProductMetadata.php index 052119713294b..8f989351743d2 100644 --- a/lib/internal/Magento/Framework/App/ProductMetadata.php +++ b/lib/internal/Magento/Framework/App/ProductMetadata.php @@ -85,8 +85,8 @@ public function getVersion() } else { $this->version = 'UNKNOWN'; } - $this->cache->save($this->version, self::VERSION_CACHE_KEY, [Config::CACHE_TAG]); } + $this->cache->save($this->version, self::VERSION_CACHE_KEY, [Config::CACHE_TAG]); } return $this->version; } From 09136b5ff8f0b4f1f78163ce4ab142b33a99f60d Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@adobe.com> Date: Wed, 11 Dec 2019 15:55:27 -0600 Subject: [PATCH 0354/1143] MQE-1857: [MTF-To-MFTF] Process PR 746 - Try to fix some flakiness --- .../Test/Mftf/Test/AdminCreateSimpleProductWithUnicodeTest.xml | 2 ++ .../Test/Mftf/Test/AdminCreateCreditMemoPartialRefundTest.xml | 1 + 2 files changed, 3 insertions(+) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithUnicodeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithUnicodeTest.xml index 94d488f216b49..eb4f2b5c25281 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithUnicodeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithUnicodeTest.xml @@ -31,6 +31,8 @@ <argument name="category" value="$$createPreReqCategory$$"/> <argument name="simpleProduct" value="ProductWithUnicode"/> </actionGroup> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> <actionGroup ref="AssertProductInStorefrontCategoryPage" stepKey="assertProductInStorefront1"> <argument name="category" value="$$createPreReqCategory$$"/> <argument name="product" value="ProductWithUnicode"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoPartialRefundTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoPartialRefundTest.xml index 418c0e72dc1fc..4b618495f19d5 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoPartialRefundTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoPartialRefundTest.xml @@ -80,6 +80,7 @@ <waitForPageLoad stepKey="waitForResultPage"/> <!-- Perform all assertions: assert refund success create message --> + <waitForElementVisible selector="{{AdminIndexManagementSection.successMessage}}" stepKey="waitForSuccessMessage"/> <see selector="{{AdminIndexManagementSection.successMessage}}" userInput="You created the credit memo." stepKey="assertRefundSuccessCreateMessage"/> <!-- Assert Credit Memo button --> From 264e6e6e86f4b0c7e17436ad72e331599a72c4ec Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Wed, 11 Dec 2019 21:27:49 -0600 Subject: [PATCH 0355/1143] Fix static --- .../Sales/view/adminhtml/templates/order/address/form.phtml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/address/form.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/address/form.phtml index b794c418de8d9..0cc23056b3c2f 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/address/form.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/address/form.phtml @@ -7,7 +7,11 @@ <div class="messages"> <div class="message message-notice"> <div class="message-inner"> - <div class="message-content"><?= $block->escapeHtml(__('Changing address information will not recalculate shipping, tax or other order amount.')) ?></div> + <div class="message-content"> + <?= $block->escapeHtml( + __('Changing address information will not recalculate shipping, tax or other order amount.') + ) ?> + </div> </div> </div> </div> From 4ce1365d58117883c7267be7abd5569c4dc99f45 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Thu, 12 Dec 2019 11:33:41 +0700 Subject: [PATCH 0356/1143] [Backend] Cover action admin/dashboard/ajaxBlock by Integration Test --- .../Adminhtml/Dashboard/AjaxBlockTest.php | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/Dashboard/AjaxBlockTest.php diff --git a/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/Dashboard/AjaxBlockTest.php b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/Dashboard/AjaxBlockTest.php new file mode 100644 index 0000000000000..3deb225cead18 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/Dashboard/AjaxBlockTest.php @@ -0,0 +1,69 @@ +<?php +/** + * + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\Backend\Controller\Adminhtml\Dashboard; + +use Magento\TestFramework\TestCase\AbstractBackendController; +use Magento\Framework\App\Request\Http as HttpRequest; + +/** + * @magentoAppArea adminhtml + */ +class AjaxBlockTest extends AbstractBackendController +{ + /** + * Test execute to check render block + * + * @dataProvider ajaxBlockDataProvider + */ + public function testExecute($block, $expectedResult) + { + $this->getRequest()->setMethod(HttpRequest::METHOD_POST); + $this->getRequest()->setParam('block', $block); + + $this->dispatch('backend/admin/dashboard/ajaxBlock/'); + + $this->assertEquals(200, $this->getResponse()->getHttpResponseCode()); + + $actual = $this->getResponse()->getBody(); + + $this->assertContains($expectedResult, $actual); + } + + /** + * Provides POST data and Expected Result + * + * @return array + */ + public function ajaxBlockDataProvider() + { + return [ + [ + 'tab_orders', + 'order_orders_period' + ], + [ + 'tab_amounts', + 'order_amounts_period' + ], + [ + 'totals', + 'dashboard_diagram_totals' + ], + [ + '', + '' + ], + [ + 'test_block', + '' + ] + ]; + } +} From 43e41fac06019d12e955d521cd9034b5954cb0d9 Mon Sep 17 00:00:00 2001 From: "rostyslav.hymon" <rostyslav.hymon@transoftgroup.com> Date: Thu, 12 Dec 2019 09:12:06 +0200 Subject: [PATCH 0357/1143] MC-29426: Orders in Payment System but not in Magento --- .../GuestPaymentInformationManagement.php | 50 ++++-------- .../Model/PaymentInformationManagement.php | 5 +- .../GuestPaymentInformationManagementTest.php | 77 +------------------ .../PaymentInformationManagementTest.php | 1 - .../Model/Coupon/UpdateCouponUsages.php | 12 +-- .../Plugin/CouponUsagesDecrement.php | 32 +++++--- .../Plugin/CouponUsagesIncrement.php | 15 ++-- app/code/Magento/SalesRule/etc/di.xml | 4 +- ...CouponDataAfterOrderCustomerAssignTest.php | 12 ++- .../SalesRule/Plugin/CouponUsagesTest.php | 32 +++++--- 10 files changed, 87 insertions(+), 153 deletions(-) diff --git a/app/code/Magento/Checkout/Model/GuestPaymentInformationManagement.php b/app/code/Magento/Checkout/Model/GuestPaymentInformationManagement.php index cae78389d4120..1d15a5dd7f176 100644 --- a/app/code/Magento/Checkout/Model/GuestPaymentInformationManagement.php +++ b/app/code/Magento/Checkout/Model/GuestPaymentInformationManagement.php @@ -56,11 +56,6 @@ class GuestPaymentInformationManagement implements \Magento\Checkout\Api\GuestPa */ private $logger; - /** - * @var ResourceConnection - */ - private $connectionPool; - /** * @param \Magento\Quote\Api\GuestBillingAddressManagementInterface $billingAddressManagement * @param \Magento\Quote\Api\GuestPaymentMethodManagementInterface $paymentMethodManagement @@ -68,7 +63,6 @@ class GuestPaymentInformationManagement implements \Magento\Checkout\Api\GuestPa * @param \Magento\Checkout\Api\PaymentInformationManagementInterface $paymentInformationManagement * @param \Magento\Quote\Model\QuoteIdMaskFactory $quoteIdMaskFactory * @param CartRepositoryInterface $cartRepository - * @param ResourceConnection $connectionPool * @codeCoverageIgnore */ public function __construct( @@ -77,8 +71,7 @@ public function __construct( \Magento\Quote\Api\GuestCartManagementInterface $cartManagement, \Magento\Checkout\Api\PaymentInformationManagementInterface $paymentInformationManagement, \Magento\Quote\Model\QuoteIdMaskFactory $quoteIdMaskFactory, - CartRepositoryInterface $cartRepository, - ResourceConnection $connectionPool = null + CartRepositoryInterface $cartRepository ) { $this->billingAddressManagement = $billingAddressManagement; $this->paymentMethodManagement = $paymentMethodManagement; @@ -86,7 +79,6 @@ public function __construct( $this->paymentInformationManagement = $paymentInformationManagement; $this->quoteIdMaskFactory = $quoteIdMaskFactory; $this->cartRepository = $cartRepository; - $this->connectionPool = $connectionPool ?: ObjectManager::getInstance()->get(ResourceConnection::class); } /** @@ -98,33 +90,23 @@ public function savePaymentInformationAndPlaceOrder( \Magento\Quote\Api\Data\PaymentInterface $paymentMethod, \Magento\Quote\Api\Data\AddressInterface $billingAddress = null ) { - $salesConnection = $this->connectionPool->getConnection('sales'); - $checkoutConnection = $this->connectionPool->getConnection('checkout'); - $salesConnection->beginTransaction(); - $checkoutConnection->beginTransaction(); - + $this->savePaymentInformation($cartId, $email, $paymentMethod, $billingAddress); try { - $this->savePaymentInformation($cartId, $email, $paymentMethod, $billingAddress); - try { - $orderId = $this->cartManagement->placeOrder($cartId); - } catch (\Magento\Framework\Exception\LocalizedException $e) { - throw new CouldNotSaveException( - __($e->getMessage()), - $e - ); - } catch (\Exception $e) { - $this->getLogger()->critical($e); - throw new CouldNotSaveException( - __('An error occurred on the server. Please try to place the order again.'), - $e - ); - } - $salesConnection->commit(); - $checkoutConnection->commit(); + $orderId = $this->cartManagement->placeOrder($cartId); + } catch (\Magento\Framework\Exception\LocalizedException $e) { + $this->getLogger()->critical( + 'Placing an order with quote_id ' . $cartId . ' is failed: ' . $e->getMessage() + ); + throw new CouldNotSaveException( + __($e->getMessage()), + $e + ); } catch (\Exception $e) { - $salesConnection->rollBack(); - $checkoutConnection->rollBack(); - throw $e; + $this->getLogger()->critical($e); + throw new CouldNotSaveException( + __('An error occurred on the server. Please try to place the order again.'), + $e + ); } return $orderId; diff --git a/app/code/Magento/Checkout/Model/PaymentInformationManagement.php b/app/code/Magento/Checkout/Model/PaymentInformationManagement.php index 2f1a36318ebc8..1f7931d7d3e6a 100644 --- a/app/code/Magento/Checkout/Model/PaymentInformationManagement.php +++ b/app/code/Magento/Checkout/Model/PaymentInformationManagement.php @@ -9,7 +9,7 @@ use Magento\Framework\Exception\CouldNotSaveException; /** - * Payment information management + * Payment information management service. * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ @@ -85,6 +85,9 @@ public function savePaymentInformationAndPlaceOrder( try { $orderId = $this->cartManagement->placeOrder($cartId); } catch (\Magento\Framework\Exception\LocalizedException $e) { + $this->getLogger()->critical( + 'Placing an order with quote_id ' . $cartId . ' is failed: ' . $e->getMessage() + ); throw new CouldNotSaveException( __($e->getMessage()), $e diff --git a/app/code/Magento/Checkout/Test/Unit/Model/GuestPaymentInformationManagementTest.php b/app/code/Magento/Checkout/Test/Unit/Model/GuestPaymentInformationManagementTest.php index 1de0ebce10f51..e3843991a181f 100644 --- a/app/code/Magento/Checkout/Test/Unit/Model/GuestPaymentInformationManagementTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Model/GuestPaymentInformationManagementTest.php @@ -7,8 +7,6 @@ namespace Magento\Checkout\Test\Unit\Model; -use Magento\Framework\App\ResourceConnection; -use Magento\Framework\DB\Adapter\AdapterInterface; use Magento\Quote\Model\Quote; use Magento\Quote\Model\Quote\Address; use Magento\Quote\Model\QuoteIdMask; @@ -53,11 +51,6 @@ class GuestPaymentInformationManagementTest extends \PHPUnit\Framework\TestCase */ private $loggerMock; - /** - * @var ResourceConnection|\PHPUnit_Framework_MockObject_MockObject - */ - private $resourceConnectionMock; - protected function setUp() { $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); @@ -75,10 +68,6 @@ protected function setUp() ['create'] ); $this->loggerMock = $this->createMock(\Psr\Log\LoggerInterface::class); - $this->resourceConnectionMock = $this->getMockBuilder(ResourceConnection::class) - ->disableOriginalConstructor() - ->getMock(); - $this->model = $objectManager->getObject( \Magento\Checkout\Model\GuestPaymentInformationManagement::class, [ @@ -86,8 +75,7 @@ protected function setUp() 'paymentMethodManagement' => $this->paymentMethodManagementMock, 'cartManagement' => $this->cartManagementMock, 'cartRepository' => $this->cartRepositoryMock, - 'quoteIdMaskFactory' => $this->quoteIdMaskFactoryMock, - 'connectionPool' => $this->resourceConnectionMock, + 'quoteIdMaskFactory' => $this->quoteIdMaskFactoryMock ] ); $objectManager->setBackwardCompatibleProperty($this->model, 'logger', $this->loggerMock); @@ -104,26 +92,6 @@ public function testSavePaymentInformationAndPlaceOrder() $billingAddressMock->expects($this->once())->method('setEmail')->with($email)->willReturnSelf(); - $adapterMockForSales = $this->getMockBuilder(AdapterInterface::class) - ->disableOriginalConstructor() - ->getMockForAbstractClass(); - $adapterMockForCheckout = $this->getMockBuilder(AdapterInterface::class) - ->disableOriginalConstructor() - ->getMockForAbstractClass(); - - $this->resourceConnectionMock->expects($this->at(0)) - ->method('getConnection') - ->with('sales') - ->willReturn($adapterMockForSales); - $adapterMockForSales->expects($this->once())->method('beginTransaction'); - $adapterMockForSales->expects($this->once())->method('commit'); - - $this->resourceConnectionMock->expects($this->at(1)) - ->method('getConnection') - ->with('checkout') - ->willReturn($adapterMockForCheckout); - $adapterMockForCheckout->expects($this->once())->method('beginTransaction'); - $adapterMockForCheckout->expects($this->once())->method('commit'); $this->paymentMethodManagementMock->expects($this->once())->method('set')->with($cartId, $paymentMock); $this->cartManagementMock->expects($this->once())->method('placeOrder')->with($cartId)->willReturn($orderId); @@ -146,27 +114,6 @@ public function testSavePaymentInformationAndPlaceOrderException() $this->getMockForAssignBillingAddress($cartId, $billingAddressMock); $billingAddressMock->expects($this->once())->method('setEmail')->with($email)->willReturnSelf(); - $adapterMockForSales = $this->getMockBuilder(AdapterInterface::class) - ->disableOriginalConstructor() - ->getMockForAbstractClass(); - $adapterMockForCheckout = $this->getMockBuilder(AdapterInterface::class) - ->disableOriginalConstructor() - ->getMockForAbstractClass(); - - $this->resourceConnectionMock->expects($this->at(0)) - ->method('getConnection') - ->with('sales') - ->willReturn($adapterMockForSales); - $adapterMockForSales->expects($this->once())->method('beginTransaction'); - $adapterMockForSales->expects($this->once())->method('rollback'); - - $this->resourceConnectionMock->expects($this->at(1)) - ->method('getConnection') - ->with('checkout') - ->willReturn($adapterMockForCheckout); - $adapterMockForCheckout->expects($this->once())->method('beginTransaction'); - $adapterMockForCheckout->expects($this->once())->method('rollback'); - $this->paymentMethodManagementMock->expects($this->once())->method('set')->with($cartId, $paymentMock); $exception = new \Magento\Framework\Exception\CouldNotSaveException(__('DB exception')); $this->cartManagementMock->expects($this->once())->method('placeOrder')->willThrowException($exception); @@ -236,31 +183,9 @@ public function testSavePaymentInformationAndPlaceOrderWithLocalizedException() $billingAddressMock->expects($this->once())->method('setEmail')->with($email)->willReturnSelf(); - $adapterMockForSales = $this->getMockBuilder(AdapterInterface::class) - ->disableOriginalConstructor() - ->getMockForAbstractClass(); - $adapterMockForCheckout = $this->getMockBuilder(AdapterInterface::class) - ->disableOriginalConstructor() - ->getMockForAbstractClass(); - - $this->resourceConnectionMock->expects($this->at(0)) - ->method('getConnection') - ->with('sales') - ->willReturn($adapterMockForSales); - $adapterMockForSales->expects($this->once())->method('beginTransaction'); - $adapterMockForSales->expects($this->once())->method('rollback'); - - $this->resourceConnectionMock->expects($this->at(1)) - ->method('getConnection') - ->with('checkout') - ->willReturn($adapterMockForCheckout); - $adapterMockForCheckout->expects($this->once())->method('beginTransaction'); - $adapterMockForCheckout->expects($this->once())->method('rollback'); - $this->paymentMethodManagementMock->expects($this->once())->method('set')->with($cartId, $paymentMock); $phrase = new \Magento\Framework\Phrase(__('DB exception')); $exception = new \Magento\Framework\Exception\LocalizedException($phrase); - $this->loggerMock->expects($this->never())->method('critical'); $this->cartManagementMock->expects($this->once())->method('placeOrder')->willThrowException($exception); $this->model->savePaymentInformationAndPlaceOrder($cartId, $email, $paymentMock, $billingAddressMock); diff --git a/app/code/Magento/Checkout/Test/Unit/Model/PaymentInformationManagementTest.php b/app/code/Magento/Checkout/Test/Unit/Model/PaymentInformationManagementTest.php index df5c255398ebd..ece395e3131f9 100644 --- a/app/code/Magento/Checkout/Test/Unit/Model/PaymentInformationManagementTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Model/PaymentInformationManagementTest.php @@ -157,7 +157,6 @@ public function testSavePaymentInformationAndPlaceOrderWithLocolizedException() $this->paymentMethodManagementMock->expects($this->once())->method('set')->with($cartId, $paymentMock); $phrase = new \Magento\Framework\Phrase(__('DB exception')); $exception = new \Magento\Framework\Exception\LocalizedException($phrase); - $this->loggerMock->expects($this->never())->method('critical'); $this->cartManagementMock->expects($this->once())->method('placeOrder')->willThrowException($exception); $this->model->savePaymentInformationAndPlaceOrder($cartId, $paymentMock, $billingAddressMock); diff --git a/app/code/Magento/SalesRule/Model/Coupon/UpdateCouponUsages.php b/app/code/Magento/SalesRule/Model/Coupon/UpdateCouponUsages.php index c4f7652e1a334..3236c80e1b7ed 100644 --- a/app/code/Magento/SalesRule/Model/Coupon/UpdateCouponUsages.php +++ b/app/code/Magento/SalesRule/Model/Coupon/UpdateCouponUsages.php @@ -7,7 +7,7 @@ namespace Magento\SalesRule\Model\Coupon; -use Magento\Sales\Model\Order; +use Magento\Sales\Api\Data\OrderInterface; use Magento\SalesRule\Model\Coupon; use Magento\SalesRule\Model\ResourceModel\Coupon\Usage; use Magento\SalesRule\Model\Rule\CustomerFactory; @@ -59,11 +59,11 @@ public function __construct( /** * Executes the current command. * - * @param Order $subject + * @param OrderInterface $subject * @param bool $increment - * @return Order + * @return OrderInterface */ - public function execute(Order $subject, bool $increment): Order + public function execute(OrderInterface $subject, bool $increment): OrderInterface { if (!$subject || !$subject->getAppliedRuleIds()) { return $subject; @@ -133,11 +133,11 @@ private function updateCustomerRuleUsages(bool $increment, int $ruleId, int $cus /** * Update the number of coupon usages. * - * @param Order $subject + * @param OrderInterface $subject * @param bool $increment * @param int $customerId */ - private function updateCouponUsages(Order $subject, bool $increment, int $customerId): void + private function updateCouponUsages(OrderInterface $subject, bool $increment, int $customerId): void { $this->coupon->load($subject->getCouponCode(), 'code'); if ($this->coupon->getId()) { diff --git a/app/code/Magento/SalesRule/Plugin/CouponUsagesDecrement.php b/app/code/Magento/SalesRule/Plugin/CouponUsagesDecrement.php index 5f28632a54cea..87a7c2ed1bd38 100644 --- a/app/code/Magento/SalesRule/Plugin/CouponUsagesDecrement.php +++ b/app/code/Magento/SalesRule/Plugin/CouponUsagesDecrement.php @@ -7,7 +7,8 @@ namespace Magento\SalesRule\Plugin; -use Magento\Sales\Model\Order; +use Magento\Sales\Model\OrderRepository; +use Magento\Sales\Model\Service\OrderService; use Magento\SalesRule\Model\Coupon\UpdateCouponUsages; /** @@ -20,30 +21,39 @@ class CouponUsagesDecrement */ private $updateCouponUsages; + /** + * @var OrderRepository + */ + private $orderRepository; + /** * @param UpdateCouponUsages $updateCouponUsages + * @param OrderRepository $orderRepository */ public function __construct( - UpdateCouponUsages $updateCouponUsages + UpdateCouponUsages $updateCouponUsages, + OrderRepository $orderRepository ) { $this->updateCouponUsages = $updateCouponUsages; + $this->orderRepository = $orderRepository; } /** * Decrements number of coupon usages after cancelling order. * - * @param Order $subject - * @param callable $proceed - * @return Order + * @param OrderService $subject + * @param bool $result + * @param int $orderId + * @return bool + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundCancel(Order $subject, callable $proceed): Order + public function afterCancel(OrderService $subject, bool $result, $orderId): bool { - $canCancel = $subject->canCancel(); - $returnValue = $proceed(); - if ($canCancel) { - $returnValue = $this->updateCouponUsages->execute($returnValue, false); + $order = $this->orderRepository->get($orderId); + if ($result) { + $this->updateCouponUsages->execute($order, false); } - return $returnValue; + return $result; } } diff --git a/app/code/Magento/SalesRule/Plugin/CouponUsagesIncrement.php b/app/code/Magento/SalesRule/Plugin/CouponUsagesIncrement.php index 473a368afb25a..14bbb5fce02a5 100644 --- a/app/code/Magento/SalesRule/Plugin/CouponUsagesIncrement.php +++ b/app/code/Magento/SalesRule/Plugin/CouponUsagesIncrement.php @@ -7,7 +7,8 @@ namespace Magento\SalesRule\Plugin; -use Magento\Sales\Model\Order; +use Magento\Sales\Api\Data\OrderInterface; +use Magento\Sales\Model\Service\OrderService; use Magento\SalesRule\Model\Coupon\UpdateCouponUsages; /** @@ -32,15 +33,15 @@ public function __construct( /** * Increments number of coupon usages after placing order. * - * @param Order $subject - * @param Order $result - * @return Order + * @param OrderService $subject + * @param OrderInterface $result + * @return OrderInterface * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function afterPlace(Order $subject, Order $result): Order + public function afterPlace(OrderService $subject, OrderInterface $result): OrderInterface { - $this->updateCouponUsages->execute($subject, true); + $this->updateCouponUsages->execute($result, true); - return $subject; + return $result; } } diff --git a/app/code/Magento/SalesRule/etc/di.xml b/app/code/Magento/SalesRule/etc/di.xml index abb581175e36a..4ba67e2fa5871 100644 --- a/app/code/Magento/SalesRule/etc/di.xml +++ b/app/code/Magento/SalesRule/etc/di.xml @@ -185,9 +185,9 @@ <type name="Magento\Quote\Model\Cart\CartTotalRepository"> <plugin name="coupon_label_plugin" type="Magento\SalesRule\Plugin\CartTotalRepository" /> </type> - <type name="Magento\Sales\Model\Order"> - <plugin name="coupon_uses_increment_plugin" type="Magento\SalesRule\Plugin\CouponUsagesIncrement" sortOrder="20"/> + <type name="Magento\Sales\Model\Service\OrderService"> <plugin name="coupon_uses_decrement_plugin" type="Magento\SalesRule\Plugin\CouponUsagesDecrement" /> + <plugin name="coupon_uses_increment_plugin" type="Magento\SalesRule\Plugin\CouponUsagesIncrement" sortOrder="20"/> </type> <preference for="Magento\SalesRule\Model\Spi\CodeLimitManagerInterface" diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/Model/Observer/AssignCouponDataAfterOrderCustomerAssignTest.php b/dev/tests/integration/testsuite/Magento/SalesRule/Model/Observer/AssignCouponDataAfterOrderCustomerAssignTest.php index 9eaca30e4bd5d..71d07342c108f 100644 --- a/dev/tests/integration/testsuite/Magento/SalesRule/Model/Observer/AssignCouponDataAfterOrderCustomerAssignTest.php +++ b/dev/tests/integration/testsuite/Magento/SalesRule/Model/Observer/AssignCouponDataAfterOrderCustomerAssignTest.php @@ -8,8 +8,8 @@ use Magento\Customer\Model\Data\Customer; use Magento\Customer\Model\GroupManagement; -use Magento\Framework\Controller\Result\Redirect; use Magento\Sales\Model\Order; +use Magento\Sales\Model\Service\OrderService; use Magento\SalesRule\Api\CouponRepositoryInterface; use Magento\SalesRule\Model\Coupon; use Magento\SalesRule\Model\Rule; @@ -17,8 +17,6 @@ use Magento\TestFramework\Helper\Bootstrap; /** - * Class AssignCouponDataAfterOrderCustomerAssignTest - * * @magentoAppIsolation enabled * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -80,6 +78,11 @@ class AssignCouponDataAfterOrderCustomerAssignTest extends \PHPUnit\Framework\Te */ private $customer; + /** + * @var OrderService + */ + private $orderService; + /** * @inheritdoc */ @@ -94,6 +97,7 @@ protected function setUp() $this->assignCouponToCustomerObserver = $this->objectManager->get( \Magento\SalesRule\Observer\AssignCouponDataAfterOrderCustomerAssignObserver::class ); + $this->orderService = $this->objectManager->get(OrderService::class); $this->salesRule = $this->prepareSalesRule(); $this->coupon = $this->attachSalesruleCoupon($this->salesRule); @@ -142,7 +146,7 @@ public function testOrderCancelingDecreasesCouponUsages() $this->processOrder($this->order); // Should not throw exception as bux is fixed now - $this->order->cancel(); + $this->orderService->cancel($this->order->getId()); $ruleCustomer = $this->getSalesruleCustomerUsage($this->customer, $this->salesRule); // Assert, that rule customer model has been created for specific customer diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/Plugin/CouponUsagesTest.php b/dev/tests/integration/testsuite/Magento/SalesRule/Plugin/CouponUsagesTest.php index e0477993eea52..23c4dbad12f62 100644 --- a/dev/tests/integration/testsuite/Magento/SalesRule/Plugin/CouponUsagesTest.php +++ b/dev/tests/integration/testsuite/Magento/SalesRule/Plugin/CouponUsagesTest.php @@ -9,6 +9,7 @@ use Magento\Framework\DataObject; use Magento\Framework\ObjectManagerInterface; use Magento\Sales\Model\Order; +use Magento\Sales\Model\Service\OrderService; use Magento\SalesRule\Model\Coupon; use Magento\SalesRule\Model\ResourceModel\Coupon\Usage; use Magento\TestFramework\Helper\Bootstrap; @@ -46,6 +47,24 @@ class CouponUsagesTest extends \PHPUnit\Framework\TestCase */ private $order; + /** + * @var OrderService + */ + private $orderService; + + /** + * @inheritdoc + */ + protected function setUp() + { + $this->objectManager = Bootstrap::getObjectManager(); + $this->coupon = $this->objectManager->get(Coupon::class); + $this->usage = $this->objectManager->get(Usage::class); + $this->couponUsage = $this->objectManager->get(DataObject::class); + $this->order = $this->objectManager->get(Order::class); + $this->orderService = $this->objectManager->get(OrderService::class); + } + /** * Test increasing coupon usages after after order placing and decreasing after order cancellation. * @@ -62,7 +81,7 @@ public function testOrderCancellation() $this->order->loadByIncrementId($orderId); // Make sure coupon usages value is incremented then order is placed. - $this->order->place(); + $this->orderService->place($this->order); $this->usage->loadByCustomerCoupon($this->couponUsage, $customerId, $this->coupon->getId()); $this->coupon->loadByCode($couponCode); @@ -76,7 +95,7 @@ public function testOrderCancellation() ); // Make sure order coupon usages value is decremented then order is cancelled. - $this->order->cancel(); + $this->orderService->cancel($this->order->getId()); $this->usage->loadByCustomerCoupon($this->couponUsage, $customerId, $this->coupon->getId()); $this->coupon->loadByCode($couponCode); @@ -89,13 +108,4 @@ public function testOrderCancellation() $this->couponUsage->getTimesUsed() ); } - - protected function setUp() - { - $this->objectManager = Bootstrap::getObjectManager(); - $this->coupon = $this->objectManager->get(Coupon::class); - $this->usage = $this->objectManager->get(Usage::class); - $this->couponUsage = $this->objectManager->get(DataObject::class); - $this->order = $this->objectManager->get(Order::class); - } } From 32fb4d3b02ebc1529b29a2158e7ccf59cd4384f8 Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Thu, 12 Dec 2019 09:38:43 +0200 Subject: [PATCH 0358/1143] MC-5233: DateTime product attributes support --- .../CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml b/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml index 3b60e4b09de28..1cec03a4c765e 100644 --- a/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml +++ b/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml @@ -308,6 +308,10 @@ <createData entity="_defaultProduct" stepKey="createSimpleProduct"> <requiredEntity createDataKey="createCategory"/> </createData> + + <!-- Perform reindex and flush cache --> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> </before> <after> <deleteData stepKey="deleteProduct" createDataKey="createSimpleProduct"/> From e7cc91e90b847405e5d41516b18bc3fea646a65c Mon Sep 17 00:00:00 2001 From: Serhiy Yelahin <serhiy.yelahin@transoftgroup.com> Date: Thu, 12 Dec 2019 11:48:39 +0200 Subject: [PATCH 0359/1143] MC-25109: B2B changing company admin carries over the addresses --- ...ustomerEditPageAddressesTabActionGroup.xml | 19 ++++++++++++ ...tAssertCustomerAddressItemsActionGroup.xml | 29 +++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminNavigateCustomerEditPageAddressesTabActionGroup.xml create mode 100644 app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontAssertCustomerAddressItemsActionGroup.xml diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminNavigateCustomerEditPageAddressesTabActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminNavigateCustomerEditPageAddressesTabActionGroup.xml new file mode 100644 index 0000000000000..790a99c9092bc --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminNavigateCustomerEditPageAddressesTabActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminNavigateCustomerEditPageAddressesTabActionGroup" extends="AdminOpenCustomerEditPageActionGroup"> + <annotations> + <description>EXTENDS: AdminOpenCustomerEditPageActionGroup. Navigates to Addresses Tab in Admin Customer Edit page for the provided Customer ID #.</description> + </annotations> + + <click selector="{{AdminEditCustomerInformationSection.addresses}}" after="waitForPageLoad" stepKey="navigateToAddressesTab"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontAssertCustomerAddressItemsActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontAssertCustomerAddressItemsActionGroup.xml new file mode 100644 index 0000000000000..e8dceb8f65926 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontAssertCustomerAddressItemsActionGroup.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontAssertCustomerAddressItemsActionGroup"> + <annotations> + <description>Validate that the Storefront Customer Address contains correct items.</description> + </annotations> + <arguments> + <argument name="address" type="entity"/> + </arguments> + + <seeInField selector="{{StorefrontCustomerAddressFormSection.firstName}}" userInput="{{address.firstName}}" stepKey="seeFirstName"/> + <seeInField selector="{{StorefrontCustomerAddressFormSection.lastName}}" userInput="{{address.lastName}}" stepKey="seeLastName"/> + <seeInField selector="{{StorefrontCustomerAddressFormSection.company}}" userInput="{{address.company}}" stepKey="seeCompany"/> + <seeInField selector="{{StorefrontCustomerAddressFormSection.phoneNumber}}" userInput="{{address.telephone}}" stepKey="seePhoneNumber"/> + <seeInField selector="{{StorefrontCustomerAddressFormSection.streetAddress}}" userInput="{{address.street[0]}}" stepKey="seeStreet"/> + <seeInField selector="{{StorefrontCustomerAddressFormSection.city}}" userInput="{{address.city}}" stepKey="seeCity"/> + <seeInField selector="{{StorefrontCustomerAddressFormSection.state}}" userInput="{{address.state}}" stepKey="seeState"/> + <seeInField selector="{{StorefrontCustomerAddressFormSection.zip}}" userInput="{{address.postcode}}" stepKey="seePostcode"/> + <seeInField selector="{{StorefrontCustomerAddressFormSection.country}}" userInput="{{address.country}}" stepKey="seeCountry"/> + </actionGroup> +</actionGroups> From 67c368b08dd667f1b5946c026bdd812ad6bf629b Mon Sep 17 00:00:00 2001 From: Viktor Petryk <victor.petryk@transoftgroup.com> Date: Thu, 12 Dec 2019 11:53:09 +0200 Subject: [PATCH 0360/1143] MC-29444: Extra Values of UPS and USPS are in dropdown list Cart Price Rule - Condition - Shipping Method --- app/code/Magento/Ups/Model/Carrier.php | 11 +++++++++-- .../Ups/Test/Unit/Model/CarrierTest.php | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Ups/Model/Carrier.php b/app/code/Magento/Ups/Model/Carrier.php index e752b0005dbee..28e194e65bd60 100644 --- a/app/code/Magento/Ups/Model/Carrier.php +++ b/app/code/Magento/Ups/Model/Carrier.php @@ -1312,13 +1312,20 @@ public function getResponse() */ public function getAllowedMethods() { + $allowedMethods = explode(',', (string)$this->getConfigData('allowed_methods')); $isUpsXml = $this->getConfigData('type') === 'UPS_XML'; $origin = $this->getConfigData('origin_shipment'); - $allowedMethods = $isUpsXml + + $availableByTypeMethods = $isUpsXml ? $this->configHelper->getCode('originShipment', $origin) : $this->configHelper->getCode('method'); + + $filteredMethods = array_filter($availableByTypeMethods, function ($methodCode) use ($allowedMethods) { + return in_array($methodCode, $allowedMethods); + }, ARRAY_FILTER_USE_KEY); + $methods = []; - foreach ($allowedMethods as $methodCode => $methodData) { + foreach ($filteredMethods as $methodCode => $methodData) { $methods[$methodCode] = $methodData->getText(); } diff --git a/app/code/Magento/Ups/Test/Unit/Model/CarrierTest.php b/app/code/Magento/Ups/Test/Unit/Model/CarrierTest.php index 7af86c30cb5b3..7e587f249e67a 100644 --- a/app/code/Magento/Ups/Test/Unit/Model/CarrierTest.php +++ b/app/code/Magento/Ups/Test/Unit/Model/CarrierTest.php @@ -404,6 +404,7 @@ public function countryDataProvider() * @param string $methodType * @param string $methodCode * @param string $methodTitle + * @param string $allowedMethods * @param array $expectedMethods * @return void */ @@ -412,11 +413,18 @@ public function testGetAllowedMethods( string $methodType, string $methodCode, string $methodTitle, + string $allowedMethods, array $expectedMethods ): void { $this->scope->method('getValue') ->willReturnMap( [ + [ + 'carriers/ups/allowed_methods', + ScopeInterface::SCOPE_STORE, + null, + $allowedMethods + ], [ 'carriers/ups/type', ScopeInterface::SCOPE_STORE, @@ -449,6 +457,15 @@ public function allowedMethodsDataProvider(): array 'method', '1DM', 'Next Day Air Early AM', + '', + [], + ], + [ + 'UPS', + 'method', + '1DM', + 'Next Day Air Early AM', + '1DM,1DML,1DA', ['1DM' => 'Next Day Air Early AM'], ], [ @@ -456,6 +473,7 @@ public function allowedMethodsDataProvider(): array 'originShipment', '01', 'UPS Next Day Air', + '01,02,03', ['01' => 'UPS Next Day Air'], ], ]; From b3e6049c96a607087ec1c9de14e0cc79b280ac71 Mon Sep 17 00:00:00 2001 From: Kaushik Chavda <chavda@team23.de> Date: Thu, 12 Dec 2019 10:56:45 +0100 Subject: [PATCH 0361/1143] #25591 & character in SKUs is shown as & in current variations list on configurable products - Fixed the issue SKU special character which change to encoded version. --- .../adminhtml/web/js/components/dynamic-rows-configurable.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/dynamic-rows-configurable.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/dynamic-rows-configurable.js index 7b04bebd4d73a..4624f07323d59 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/dynamic-rows-configurable.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/dynamic-rows-configurable.js @@ -219,7 +219,7 @@ define([ _.each(tmpData, function (row, index) { path = this.dataScope + '.' + this.index + '.' + (this.startIndex + index); row.attributes = $('<i></i>').text(row.attributes).html(); - row.sku = $('<i></i>').text(row.sku).html(); + row.sku = row.sku; this.source.set(path, row); }, this); @@ -405,7 +405,7 @@ define([ 'id': row.productId, 'product_link': row.productUrl, 'name': $('<i></i>').text(row.name).html(), - 'sku': $('<i></i>').text(row.sku).html(), + 'sku': row.sku, 'status': row.status, 'price': row.price, 'price_currency': row.priceCurrency, From ae8cb2cc39828276cb60e602a0dd878774beff7b Mon Sep 17 00:00:00 2001 From: Mastiuhin Olexandr <mastiuhin.olexandr@transoftgroup.com> Date: Thu, 12 Dec 2019 13:15:12 +0200 Subject: [PATCH 0362/1143] MC-25098: Product is not deleted from minicart if not included in shared catalog --- .../testsuite/Magento/Checkout/Model/SessionTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/Checkout/Model/SessionTest.php b/dev/tests/integration/testsuite/Magento/Checkout/Model/SessionTest.php index c7802f73a9a47..e0e390e89c97c 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/Model/SessionTest.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/Model/SessionTest.php @@ -18,7 +18,7 @@ use Magento\TestFramework\Helper\Bootstrap; /** - * Class SessionTest + * Checkout Session model test. * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ From 70b199cd3660b9e581c618f27ac7adc7db3c4114 Mon Sep 17 00:00:00 2001 From: divyajyothi5321 <54176640+divyajyothi5321@users.noreply.github.com> Date: Thu, 12 Dec 2019 17:22:03 +0530 Subject: [PATCH 0363/1143] Fixed the issue 25930 --- .../Magento/backend/web/css/source/components/_messages.less | 1 + 1 file changed, 1 insertion(+) diff --git a/app/design/adminhtml/Magento/backend/web/css/source/components/_messages.less b/app/design/adminhtml/Magento/backend/web/css/source/components/_messages.less index 15cd295885892..6660f780afdaf 100644 --- a/app/design/adminhtml/Magento/backend/web/css/source/components/_messages.less +++ b/app/design/adminhtml/Magento/backend/web/css/source/components/_messages.less @@ -44,6 +44,7 @@ .messages { .message { + .lib-wrap-words(); &:last-child { margin: 0 0 2rem; } From b67ab4377e58cb977e1ec95c86607943bad1144e Mon Sep 17 00:00:00 2001 From: Mastiuhin Olexandr <mastiuhin.olexandr@transoftgroup.com> Date: Thu, 12 Dec 2019 14:03:00 +0200 Subject: [PATCH 0364/1143] MC-29578: A lot of identical reviews are created after many times clicking on Submit Review button --- .../Review/view/frontend/templates/form.phtml | 14 ++++++++------ .../view/frontend/web/js/submit-review.js | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 app/code/Magento/Review/view/frontend/web/js/submit-review.js diff --git a/app/code/Magento/Review/view/frontend/templates/form.phtml b/app/code/Magento/Review/view/frontend/templates/form.phtml index f1340945043e9..6b00bf681c1e3 100644 --- a/app/code/Magento/Review/view/frontend/templates/form.phtml +++ b/app/code/Magento/Review/view/frontend/templates/form.phtml @@ -5,28 +5,29 @@ */ /** @var \Magento\Review\Block\Form $block */ +//phpcs:disable Generic.Files.LineLength ?> <div class="block review-add"> <div class="block-title"><strong><?= $block->escapeHtml(__('Write Your Own Review')) ?></strong></div> <div class="block-content"> -<?php if ($block->getAllowWriteReviewFlag()) : ?> +<?php if ($block->getAllowWriteReviewFlag()):?> <form action="<?= $block->escapeUrl($block->getAction()) ?>" class="review-form" method="post" id="review-form" data-role="product-review-form" data-bind="scope: 'review-form'"> <?= $block->getBlockHtml('formkey') ?> <?= $block->getChildHtml('form_fields_before') ?> <fieldset class="fieldset review-fieldset" data-hasrequired="<?= $block->escapeHtmlAttr(__('* Required Fields')) ?>"> <legend class="legend review-legend"><span><?= $block->escapeHtml(__("You're reviewing:")) ?></span><strong><?= $block->escapeHtml($block->getProductInfo()->getName()) ?></strong></legend><br /> - <?php if ($block->getRatings() && $block->getRatings()->getSize()) : ?> + <?php if ($block->getRatings() && $block->getRatings()->getSize()): ?> <span id="input-message-box"></span> <fieldset class="field required review-field-ratings"> <legend class="label"><span><?= $block->escapeHtml(__('Your Rating')) ?></span></legend><br/> <div class="control"> <div class="nested" id="product-review-table"> - <?php foreach ($block->getRatings() as $_rating) : ?> + <?php foreach ($block->getRatings() as $_rating): ?> <div class="field choice review-field-rating"> <label class="label" id="<?= $block->escapeHtml($_rating->getRatingCode()) ?>_rating_label"><span><?= $block->escapeHtml($_rating->getRatingCode()) ?></span></label> <div class="control review-control-vote"> <?php $options = $_rating->getOptions();?> - <?php $iterator = 1; foreach ($options as $_option) : ?> + <?php $iterator = 1; foreach ($options as $_option): ?> <input type="radio" name="ratings[<?= $block->escapeHtmlAttr($_rating->getId()) ?>]" @@ -84,11 +85,12 @@ }, "#review-form": { "Magento_Review/js/error-placement": {}, - "Magento_Review/js/validate-review": {} + "Magento_Review/js/validate-review": {}, + "Magento_Review/js/submit-review": {} } } </script> -<?php else : ?> +<?php else: ?> <div class="message info notlogged" id="review-form"> <div> <?= $block->escapeHtml(__('Only registered users can write reviews. Please <a href="%1">Sign in</a> or <a href="%2">create an account</a>', $block->getLoginLink(), $block->getRegisterUrl()), ['a']) ?> diff --git a/app/code/Magento/Review/view/frontend/web/js/submit-review.js b/app/code/Magento/Review/view/frontend/web/js/submit-review.js new file mode 100644 index 0000000000000..6399ce22ffe88 --- /dev/null +++ b/app/code/Magento/Review/view/frontend/web/js/submit-review.js @@ -0,0 +1,18 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +define([ + 'jquery' +], function ($) { + 'use strict'; + + return function (config, element) { + $(element).on('submit', function () { + if ($(this).valid()) { + $(this).find('.submit').attr('disabled', true); + } + }); + }; +}); From 3096b56dcebdd96d864ea09059997e4021333403 Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Thu, 12 Dec 2019 15:12:50 +0200 Subject: [PATCH 0365/1143] MC-25257: Special from / to date wrong on administrator Dutch locale --- .../Product/Initialization/Helper.php | 55 +++-------- .../Catalog/Model/Product/Filter/DateTime.php | 67 ++++++++++++++ .../Product/Initialization/HelperTest.php | 78 ++++++++++------ .../Model/Product/Filter/DateTimeTest.php | 91 +++++++++++++++++++ 4 files changed, 219 insertions(+), 72 deletions(-) create mode 100644 app/code/Magento/Catalog/Model/Product/Filter/DateTime.php create mode 100644 app/code/Magento/Catalog/Test/Unit/Model/Product/Filter/DateTimeTest.php diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php index 62bcb1c8cd6d7..2ae97223d6359 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php @@ -6,7 +6,6 @@ namespace Magento\Catalog\Controller\Adminhtml\Product\Initialization; -use DateTime; use Magento\Backend\Helper\Js; use Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory as CustomOptionFactory; use Magento\Catalog\Api\Data\ProductLinkInterfaceFactory as ProductLinkFactory; @@ -15,6 +14,8 @@ use Magento\Catalog\Api\ProductRepositoryInterface\Proxy as ProductRepository; use Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper\AttributeFilter; use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\Product\Authorization as ProductAuthorization; +use Magento\Catalog\Model\Product\Filter\DateTime as DateTimeFilter; use Magento\Catalog\Model\Product\Initialization\Helper\ProductLinks; use Magento\Catalog\Model\Product\Link\Resolver as LinkResolver; use Magento\Catalog\Model\Product\LinkTypeProvider; @@ -24,13 +25,13 @@ use Magento\Framework\Stdlib\DateTime\Filter\Date; use Magento\Store\Model\StoreManagerInterface; use Zend_Filter_Input; -use Magento\Catalog\Model\Product\Authorization as ProductAuthorization; /** * Product helper * * @api * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * @SuppressWarnings(PHPMD.TooManyFields) * @since 100.0.2 */ class Helper @@ -89,11 +90,6 @@ class Helper */ private $linkResolver; - /** - * @var \Magento\Framework\Stdlib\DateTime\Filter\DateTime - */ - private $dateTimeFilter; - /** * @var LinkTypeProvider */ @@ -114,6 +110,11 @@ class Helper */ private $localeFormat; + /** + * @var DateTimeFilter + */ + private $dateTimeFilter; + /** * Constructor * @@ -130,6 +131,7 @@ class Helper * @param AttributeFilter|null $attributeFilter * @param FormatInterface|null $localeFormat * @param ProductAuthorization|null $productAuthorization + * @param DateTimeFilter|null $dateTimeFilter * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -145,7 +147,8 @@ public function __construct( LinkTypeProvider $linkTypeProvider = null, AttributeFilter $attributeFilter = null, FormatInterface $localeFormat = null, - ?ProductAuthorization $productAuthorization = null + ?ProductAuthorization $productAuthorization = null, + ?DateTimeFilter $dateTimeFilter = null ) { $this->request = $request; $this->storeManager = $storeManager; @@ -162,6 +165,7 @@ public function __construct( $this->attributeFilter = $attributeFilter ?: $objectManager->get(AttributeFilter::class); $this->localeFormat = $localeFormat ?: $objectManager->get(FormatInterface::class); $this->productAuthorization = $productAuthorization ?? $objectManager->get(ProductAuthorization::class); + $this->dateTimeFilter = $dateTimeFilter ?? $objectManager->get(DateTimeFilter::class); } /** @@ -185,7 +189,6 @@ public function initializeFromData(Product $product, array $productData) } $productData = $this->normalize($productData); - $productData = $this->convertSpecialFromDateStringToObject($productData); if (!empty($productData['is_downloadable'])) { $productData['product_has_weight'] = 0; @@ -209,7 +212,7 @@ public function initializeFromData(Product $product, array $productData) foreach ($attributes as $attrKey => $attribute) { if ($attribute->getBackend()->getType() == 'datetime') { if (array_key_exists($attrKey, $productData) && $productData[$attrKey] != '') { - $dateFieldFilters[$attrKey] = $this->getDateTimeFilter(); + $dateFieldFilters[$attrKey] = $this->dateTimeFilter; } } } @@ -408,22 +411,6 @@ private function getLinkResolver() return $this->linkResolver; } - /** - * Get DateTimeFilter instance - * - * @return \Magento\Framework\Stdlib\DateTime\Filter\DateTime - * @deprecated 101.0.0 - */ - private function getDateTimeFilter() - { - if ($this->dateTimeFilter === null) { - $this->dateTimeFilter = ObjectManager::getInstance() - ->get(\Magento\Framework\Stdlib\DateTime\Filter\DateTime::class); - } - - return $this->dateTimeFilter; - } - /** * Remove ids of non selected websites from $websiteIds array and return filtered data * @@ -497,20 +484,4 @@ function ($valueData) { return $product->setOptions($customOptions); } - - /** - * Convert string date presentation into object - * - * @param array $productData - * @return array - */ - private function convertSpecialFromDateStringToObject($productData) - { - if (isset($productData['special_from_date']) && $productData['special_from_date'] != '') { - $productData['special_from_date'] = $this->getDateTimeFilter()->filter($productData['special_from_date']); - $productData['special_from_date'] = new DateTime($productData['special_from_date']); - } - - return $productData; - } } diff --git a/app/code/Magento/Catalog/Model/Product/Filter/DateTime.php b/app/code/Magento/Catalog/Model/Product/Filter/DateTime.php new file mode 100644 index 0000000000000..93b7d55458a9f --- /dev/null +++ b/app/code/Magento/Catalog/Model/Product/Filter/DateTime.php @@ -0,0 +1,67 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Model\Product\Filter; + +use Magento\Framework\Stdlib\DateTime as StdlibDateTime; +use Magento\Framework\Stdlib\DateTime\Filter\DateTime as StdlibDateTimeFilter; + +/** + * Product datetime fields values filter + */ +class DateTime implements \Zend_Filter_Interface +{ + /** + * @var StdlibDateTimeFilter + */ + private $stdlibDateTimeFilter; + + /** + * Initializes dependencies. + * + * @param StdlibDateTimeFilter $stdlibDateTimeFilter + */ + public function __construct(StdlibDateTimeFilter $stdlibDateTimeFilter) + { + $this->stdlibDateTimeFilter = $stdlibDateTimeFilter; + } + + /** + * Convert datetime from locale format to internal format; + * + * Make an additional check for MySql date format which is wrongly parsed by IntlDateFormatter + * + * @param mixed $value + * @return mixed|string + * @throws \Exception + */ + public function filter($value) + { + if (is_string($value)) { + $value = $this->createDateFromMySqlFormat($value) ?? $value; + } + return $this->stdlibDateTimeFilter->filter($value); + } + + /** + * Parse a string in MySql date format into a new DateTime object + * + * @param string $value + * @return \DateTime|null + */ + private function createDateFromMySqlFormat(string $value): ?\DateTime + { + $datetime = date_create_from_format(StdlibDateTime::DATETIME_PHP_FORMAT, $value); + if ($datetime === false) { + $datetime = date_create_from_format(StdlibDateTime::DATE_PHP_FORMAT, $value); + if ($datetime !== false) { + $datetime->setTime(0, 0, 0, 0); + } + } + return $datetime instanceof \DateTime ? $datetime : null; + } +} diff --git a/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/Initialization/HelperTest.php b/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/Initialization/HelperTest.php index 134c6f9edeaf7..2aea34244437d 100644 --- a/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/Initialization/HelperTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/Initialization/HelperTest.php @@ -165,6 +165,8 @@ protected function setUp() ->disableOriginalConstructor() ->getMock(); + $this->dateTimeFilterMock = $this->createMock(\Magento\Catalog\Model\Product\Filter\DateTime::class); + $this->helper = $this->objectManager->getObject( Helper::class, [ @@ -178,6 +180,7 @@ protected function setUp() 'linkTypeProvider' => $this->linkTypeProviderMock, 'attributeFilter' => $this->attributeFilterMock, 'localeFormat' => $this->localeFormatMock, + 'dateTimeFilter' => $this->dateTimeFilterMock ] ); @@ -188,11 +191,6 @@ protected function setUp() $resolverProperty = $helperReflection->getProperty('linkResolver'); $resolverProperty->setAccessible(true); $resolverProperty->setValue($this->helper, $this->linkResolverMock); - - $this->dateTimeFilterMock = $this->createMock(\Magento\Framework\Stdlib\DateTime\Filter\DateTime::class); - $dateTimeFilterProperty = $helperReflection->getProperty('dateTimeFilter'); - $dateTimeFilterProperty->setAccessible(true); - $dateTimeFilterProperty->setValue($this->helper, $this->dateTimeFilterMock); } /** @@ -226,6 +224,7 @@ public function testInitialize( ]; $specialFromDate = '2018-03-03 19:30:00'; $productData = [ + 'name' => 'Simple Product', 'stock_data' => ['stock_data'], 'options' => $optionsData, 'website_ids' => $websiteIds, @@ -235,30 +234,23 @@ public function testInitialize( $productData = array_merge($productData, ['tier_price' => $tierPrice]); } - $this->dateTimeFilterMock->expects($this->once()) + $this->dateTimeFilterMock + ->expects($this->once()) ->method('filter') - ->with($specialFromDate) - ->willReturn($specialFromDate); - - $attributeNonDate = $this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class) - ->disableOriginalConstructor() - ->getMock(); - $attributeDate = $this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class) - ->disableOriginalConstructor() - ->getMock(); - - $attributeNonDateBackEnd = - $this->getMockBuilder(\Magento\Eav\Model\Entity\Attribute\Backend\DefaultBackend::class) - ->disableOriginalConstructor() - ->getMock(); - $attributeDateBackEnd = $this->getMockBuilder(\Magento\Eav\Model\Entity\Attribute\Backend\Datetime::class) - ->disableOriginalConstructor() - ->getMock(); + ->willReturnArgument(0); - $attributeNonDate->expects($this->any())->method('getBackend')->willReturn($attributeNonDateBackEnd); - $attributeDate->expects($this->any())->method('getBackend')->willReturn($attributeDateBackEnd); - $attributeNonDateBackEnd->expects($this->any())->method('getType')->willReturn('non-datetime'); - $attributeDateBackEnd->expects($this->any())->method('getType')->willReturn('datetime'); + $this->setProductAttributes( + [ + [ + 'code' => 'name', + 'backend_type' => 'varchar', + ], + [ + 'code' => 'special_from_date', + 'backend_type' => 'datetime', + ] + ] + ); $useDefaults = ['attributeCode1', 'attributeCode2']; @@ -274,8 +266,6 @@ public function testInitialize( $this->productMock->expects($this->once())->method('isLockedAttribute')->with('media')->willReturn(true); $this->productMock->expects($this->once())->method('unlockAttribute')->with('media'); $this->productMock->expects($this->once())->method('lockAttribute')->with('media'); - $this->productMock->expects($this->once())->method('getAttributes') - ->willReturn([$attributeNonDate, $attributeDate]); $this->productMock->expects($this->any())->method('getSku')->willReturn('sku'); $this->productMock->expects($this->any())->method('getOptionsReadOnly')->willReturn(false); @@ -348,7 +338,35 @@ function () { } $this->assertEquals($expectedLinks, $resultLinks); - $this->assertEquals($specialFromDate, $productData['special_from_date']); + $this->assertEquals($specialFromDate, $this->productMock->getSpecialFromDate()); + } + + /** + * Mock product attributes + * + * @param array $attributes + */ + private function setProductAttributes(array $attributes): void + { + $attributesModels = []; + foreach ($attributes as $attribute) { + $attributeModel = $this->createMock(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class); + $backendModel = $attribute['backend_model'] + ?? $this->createMock(\Magento\Eav\Model\Entity\Attribute\Backend\DefaultBackend::class); + $attributeModel->expects($this->any()) + ->method('getBackend') + ->willReturn($backendModel); + $attributeModel->expects($this->any()) + ->method('getAttributeCode') + ->willReturn($attribute['code']); + $backendModel->expects($this->any()) + ->method('getType') + ->willReturn($attribute['backend_type']); + $attributesModels[$attribute['code']] = $attributeModel; + } + $this->productMock->expects($this->once()) + ->method('getAttributes') + ->willReturn($attributesModels); } /** diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Filter/DateTimeTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Filter/DateTimeTest.php new file mode 100644 index 0000000000000..aefa0b1cf106d --- /dev/null +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Filter/DateTimeTest.php @@ -0,0 +1,91 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Test\Unit\Model\Product\Filter; + +use Magento\Framework\Locale\Resolver; +use Magento\Framework\Locale\ResolverInterface; +use Magento\Framework\Stdlib\DateTime\Timezone; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use PHPUnit\Framework\TestCase; + +/** + * Test datetime filter + */ +class DateTimeTest extends TestCase +{ + /** + * @var string + */ + private $locale; + /** + * @var \Magento\Catalog\Model\Product\Filter\DateTime + */ + private $model; + + /** + * @inheritDoc + */ + protected function setUp() + { + parent::setUp(); + $objectManager = new ObjectManager($this); + $this->locale = Resolver::DEFAULT_LOCALE; + $localeResolver = $this->getMockForAbstractClass(ResolverInterface::class); + $localeResolver->expects($this->any()) + ->method('getLocale') + ->willReturnCallback( + function () { + return $this->locale; + } + ); + $timezone = $objectManager->getObject( + Timezone::class, + ['localeResolver' => $localeResolver] + ); + $stdlibDateTimeFilter = $objectManager->getObject( + \Magento\Framework\Stdlib\DateTime\Filter\DateTime::class, + ['localeDate' => $timezone] + ); + $this->model = $objectManager->getObject( + \Magento\Catalog\Model\Product\Filter\DateTime::class, + [ + 'stdlibDateTimeFilter' => $stdlibDateTimeFilter + ] + ); + } + + /** + * Test filter with different dates formats and locales + * + * @dataProvider provideFilter + */ + public function testFilter(string $date, string $expectedDate, string $locale = Resolver::DEFAULT_LOCALE) + { + $this->locale = $locale; + $this->assertEquals($expectedDate, $this->model->filter($date)); + } + + /** + * Provide date formats and locales + * + * @return array + */ + public function provideFilter(): array + { + return [ + ['1999-12-31', '1999-12-31 00:00:00', 'en_US'], + ['12-31-1999', '1999-12-31 00:00:00', 'en_US'], + ['12/31/1999', '1999-12-31 00:00:00', 'en_US'], + ['December 31, 1999', '1999-12-31 00:00:00', 'en_US'], + ['1999-12-31', '1999-12-31 00:00:00', 'fr_FR'], + ['31-12-1999', '1999-12-31 00:00:00', 'fr_FR'], + ['31/12/1999', '1999-12-31 00:00:00', 'fr_FR'], + ['31 Décembre 1999', '1999-12-31 00:00:00', 'fr_FR'], + ]; + } +} From edfc05b0634f253c2cf12687d288ae8b1e62190c Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Thu, 12 Dec 2019 15:22:36 +0200 Subject: [PATCH 0366/1143] MC-29449: Catalog Price Rule Not Applying on Admin Manage Shopping Cart --- .../ProcessAdminFinalPriceObserver.php | 20 +- .../ProcessAdminFinalPriceObserverTest.php | 191 ++++++++++++++++++ .../Model/Indexer/Product/PriceTest.php | 47 ++++- .../_files/catalog_rule_50_percent_off.php | 36 ++++ .../catalog_rule_50_percent_off_rollback.php | 28 +++ .../CatalogRule/_files/simple_products.php | 68 +++++-- .../_files/simple_products_rollback.php | 2 +- 7 files changed, 373 insertions(+), 19 deletions(-) create mode 100644 app/code/Magento/CatalogRule/Test/Unit/Observer/ProcessAdminFinalPriceObserverTest.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_50_percent_off.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_50_percent_off_rollback.php diff --git a/app/code/Magento/CatalogRule/Observer/ProcessAdminFinalPriceObserver.php b/app/code/Magento/CatalogRule/Observer/ProcessAdminFinalPriceObserver.php index 89ed519cfb8c8..0add936467471 100644 --- a/app/code/Magento/CatalogRule/Observer/ProcessAdminFinalPriceObserver.php +++ b/app/code/Magento/CatalogRule/Observer/ProcessAdminFinalPriceObserver.php @@ -7,9 +7,10 @@ namespace Magento\CatalogRule\Observer; -use Magento\Framework\Stdlib\DateTime\TimezoneInterface; -use Magento\Framework\Registry; use Magento\Framework\Event\ObserverInterface; +use Magento\Framework\Registry; +use Magento\Framework\Stdlib\DateTime\TimezoneInterface; +use Magento\Store\Model\StoreManagerInterface; /** * Observer for applying catalog rules on product for admin area @@ -23,6 +24,11 @@ class ProcessAdminFinalPriceObserver implements ObserverInterface */ protected $coreRegistry; + /** + * @var StoreManagerInterface + */ + protected $storeManager; + /** * @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface */ @@ -41,17 +47,20 @@ class ProcessAdminFinalPriceObserver implements ObserverInterface /** * @param RulePricesStorage $rulePricesStorage * @param Registry $coreRegistry + * @param StoreManagerInterface $storeManager * @param \Magento\CatalogRule\Model\ResourceModel\RuleFactory $resourceRuleFactory * @param TimezoneInterface $localeDate */ public function __construct( RulePricesStorage $rulePricesStorage, Registry $coreRegistry, + StoreManagerInterface $storeManager, \Magento\CatalogRule\Model\ResourceModel\RuleFactory $resourceRuleFactory, TimezoneInterface $localeDate ) { $this->rulePricesStorage = $rulePricesStorage; $this->coreRegistry = $coreRegistry; + $this->storeManager = $storeManager; $this->resourceRuleFactory = $resourceRuleFactory; $this->localeDate = $localeDate; } @@ -61,6 +70,7 @@ public function __construct( * * @param \Magento\Framework\Event\Observer $observer * @return $this + * @throws \Magento\Framework\Exception\NoSuchEntityException */ public function execute(\Magento\Framework\Event\Observer $observer) { @@ -74,13 +84,17 @@ public function execute(\Magento\Framework\Event\Observer $observer) $wId = $ruleData->getWebsiteId(); $gId = $ruleData->getCustomerGroupId(); $pId = $product->getId(); - $key = "{$date->format('Y-m-d H:i:s')}|{$wId}|{$gId}|{$pId}"; } elseif ($product->getWebsiteId() !== null && $product->getCustomerGroupId() !== null) { $wId = $product->getWebsiteId(); $gId = $product->getCustomerGroupId(); $pId = $product->getId(); $key = "{$date->format('Y-m-d H:i:s')}|{$wId}|{$gId}|{$pId}"; + } elseif ($product->getWebsiteId() === null && $product->getCustomerGroupId() !== null) { + $wId = $this->storeManager->getStore($storeId)->getWebsiteId(); + $gId = $product->getCustomerGroupId(); + $pId = $product->getId(); + $key = "{$date->format('Y-m-d H:i:s')}|{$wId}|{$gId}|{$pId}"; } if ($key) { diff --git a/app/code/Magento/CatalogRule/Test/Unit/Observer/ProcessAdminFinalPriceObserverTest.php b/app/code/Magento/CatalogRule/Test/Unit/Observer/ProcessAdminFinalPriceObserverTest.php new file mode 100644 index 0000000000000..558fef8660606 --- /dev/null +++ b/app/code/Magento/CatalogRule/Test/Unit/Observer/ProcessAdminFinalPriceObserverTest.php @@ -0,0 +1,191 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\CatalogRule\Test\Unit\Observer; + +use Magento\Catalog\Model\Product; +use Magento\CatalogRule\Model\ResourceModel\RuleFactory; +use Magento\CatalogRule\Observer\ProcessAdminFinalPriceObserver; +use Magento\CatalogRule\Observer\RulePricesStorage; +use Magento\Framework\Event; +use Magento\Framework\Event\Observer; +use Magento\Framework\Stdlib\DateTime\TimezoneInterface; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Store\Model\Store; +use Magento\Store\Model\StoreManagerInterface; +use Magento\Ui\Component\Form\Element\DataType\Date; +use PHPUnit\Framework\TestCase; + +/** + * Class ProcessAdminFinalPriceObserverTest + * + * Test class for Observer for applying catalog rules on product for admin area + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class ProcessAdminFinalPriceObserverTest extends TestCase +{ + /** + * @var ProcessAdminFinalPriceObserver + */ + private $observer; + + /** + * Store Manager mock + * + * @var StoreManagerInterface + */ + private $storeManagerMock; + + /** + * Locale Date mock + * + * @var TimezoneInterface + */ + private $localeDateMock; + + /** + * Resource Rule Factory mock + * + * @var RuleFactory + */ + private $resourceRuleFactoryMock; + + /** + * Rule Prices Storage mock + * + * @var RulePricesStorage + */ + private $rulePricesStorageMock; + + /** + * @var Event|\PHPUnit_Framework_MockObject_MockObject + */ + private $eventMock; + + /** + * @var Observer|\PHPUnit\Framework\MockObject\MockObject + */ + private $observerMock; + + protected function setUp() + { + $this->observerMock = $this + ->getMockBuilder(Observer::class) + ->disableOriginalConstructor() + ->getMock(); + $this->eventMock = $this + ->getMockBuilder(Event::class) + ->setMethods(['getProduct']) + ->disableOriginalConstructor() + ->getMock(); + $this->rulePricesStorageMock = $this->getMockBuilder(RulePricesStorage::class) + ->setMethods(['getWebsiteId', 'getRulePrice', 'getCustomerGroupId', 'setRulePrice']) + ->disableOriginalConstructor() + ->getMock(); + $this->storeManagerMock = $this->getMockBuilder(StoreManagerInterface::class) + ->setMethods(['getStore']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $this->resourceRuleFactoryMock = $this->getMockBuilder(RuleFactory::class) + ->setMethods(['create']) + ->disableOriginalConstructor() + ->getMock(); + $this->localeDateMock = $this->getMockBuilder(TimezoneInterface::class) + ->setMethods(['scopeDate']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $objectManagerHelper = new ObjectManager($this); + $this->observer = $objectManagerHelper->getObject( + ProcessAdminFinalPriceObserver::class, + [ + 'rulePricesStorage' => $this->rulePricesStorageMock, + 'storeManager' => $this->storeManagerMock, + 'resourceRuleFactory' => $this->resourceRuleFactoryMock, + 'localeDate' => $this->localeDateMock + ] + ); + } + + public function testExecute() + { + $finalPrice = 20.00; + $rulePrice = 10.00; + $storeId = 2; + $wId = 1; + $gId = 4; + $pId = 20; + $localeDateFormat = 'Y-m-d H:i:s'; + $date = '2019-12-02 08:00:00'; + $storeMock = $this->createMock(Store::class); + $this->observerMock + ->expects($this->atLeastOnce()) + ->method('getEvent') + ->willReturn($this->eventMock); + + $productMock = $this->getMockBuilder(Product::class) + ->setMethods( + [ + 'getStoreId', + 'getWebsiteId', + 'getId', + 'getData', + 'getCustomerGroupId', + 'setFinalPrice' + ] + ) + ->disableOriginalConstructor() + ->getMock(); + $dateMock = $this->getMockBuilder(Date::class) + ->setMethods(['format']) + ->disableOriginalConstructor() + ->getMock(); + + $this->localeDateMock->expects($this->once()) + ->method('scopeDate') + ->with($storeId) + ->willReturn($dateMock); + $dateMock->expects($this->once()) + ->method('format') + ->with($localeDateFormat) + ->willReturn($date); + $storeMock->expects($this->once()) + ->method('getWebsiteId') + ->willReturn($wId); + $this->storeManagerMock->expects($this->once()) + ->method('getStore') + ->with($storeId) + ->willReturn($storeMock); + $productMock->expects($this->once()) + ->method('getStoreId') + ->willReturn($storeId); + $productMock->expects($this->any()) + ->method('getCustomerGroupId') + ->willReturn($gId); + $productMock->expects($this->once()) + ->method('getId') + ->willReturn($pId); + $productMock->expects($this->once()) + ->method('getData') + ->with('final_price') + ->willReturn($finalPrice); + $this->rulePricesStorageMock->expects($this->any()) + ->method('getCustomerGroupId') + ->willReturn($gId); + $this->resourceRuleFactoryMock->expects($this->once()) + ->method('create') + ->willReturn($this->rulePricesStorageMock); + $this->rulePricesStorageMock->expects($this->any()) + ->method('getRulePrice') + ->willReturn($rulePrice); + $this->rulePricesStorageMock->expects($this->once()) + ->method('setRulePrice') + ->willReturnSelf(); + $this->eventMock + ->expects($this->atLeastOnce()) + ->method('getProduct') + ->willReturn($productMock); + $this->assertEquals($this->observer, $this->observer->execute($this->observerMock)); + } +} diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/Product/PriceTest.php b/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/Product/PriceTest.php index 495d19a2745e5..ce182f56898ef 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/Product/PriceTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/Product/PriceTest.php @@ -5,12 +5,13 @@ */ namespace Magento\CatalogRule\Model\Indexer\Product; -use Magento\TestFramework\Helper\Bootstrap; -use Magento\CatalogRule\Model\ResourceModel\Rule; -use Magento\Catalog\Model\ResourceModel\Product\Collection; use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\ProductRepository; +use Magento\Catalog\Model\ResourceModel\Product\Collection; +use Magento\CatalogRule\Model\ResourceModel\Rule; use Magento\Framework\Api\SearchCriteriaInterface; use Magento\Framework\Api\SortOrder; +use Magento\TestFramework\Helper\Bootstrap; class PriceTest extends \PHPUnit\Framework\TestCase { @@ -56,6 +57,46 @@ public function testPriceApplying() $this->assertEquals($simpleProduct->getFinalPrice(), $confProduct->getMinimalPrice()); } + /** + * @magentoDataFixtureBeforeTransaction Magento/CatalogRule/_files/simple_products.php + * @magentoDataFixtureBeforeTransaction Magento/CatalogRule/_files/catalog_rule_50_percent_off.php + * @magentoDbIsolation enabled + * @magentoAppIsolation enabled + */ + public function testPriceForSecondStore() + { + $customerGroupId = 1; + $websiteId = 2; + /** @var ProductRepository $productRepository */ + $productRepository = Bootstrap::getObjectManager()->create( + ProductRepository::class + ); + $simpleProduct = $productRepository->get('simple3'); + $simpleProduct->setPriceCalculation(true); + $this->assertEquals('simple3', $simpleProduct->getSku()); + $this->assertFalse( + $this->resourceRule->getRulePrice( + new \DateTime(), + $websiteId, + $customerGroupId, + $simpleProduct->getId() + ) + ); + $indexerBuilder = Bootstrap::getObjectManager()->get( + \Magento\CatalogRule\Model\Indexer\IndexBuilder::class + ); + $indexerBuilder->reindexById($simpleProduct->getId()); + $this->assertEquals( + $this->resourceRule->getRulePrice( + new \DateTime(), + $websiteId, + $customerGroupId, + $simpleProduct->getId() + ), + 25 + ); + } + /** * @magentoDataFixtureBeforeTransaction Magento/CatalogRule/_files/simple_products.php * @magentoDataFixtureBeforeTransaction Magento/CatalogRule/_files/rule_by_attribute.php diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_50_percent_off.php b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_50_percent_off.php new file mode 100644 index 0000000000000..ca5c8ecbbd59f --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_50_percent_off.php @@ -0,0 +1,36 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +use Magento\TestFramework\Helper\Bootstrap; + +/** + * Creates simple Catalog Rule with the following data: + * active, applied to all products, without time limits, with 50% off for all customers + */ +/** @var \Magento\CatalogRule\Model\Rule $rule */ +$catalogRule = Bootstrap::getObjectManager()->get(\Magento\CatalogRule\Model\RuleFactory::class)->create(); +$catalogRule->loadPost( + [ + 'name' => 'Test Catalog Rule 50% off', + 'is_active' => '1', + 'stop_rules_processing' => 0, + 'website_ids' => [2], + 'customer_group_ids' => [0, 1], + 'discount_amount' => 50, + 'simple_action' => 'by_percent', + 'from_date' => '', + 'to_date' => '', + 'sort_order' => 0, + 'sub_is_enable' => 0, + 'sub_discount_amount' => 0, + 'conditions' => [], + ] +); +$catalogRule->save(); +/** @var \Magento\CatalogRule\Model\Indexer\IndexBuilder $indexBuilder */ +$indexBuilder = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get(\Magento\CatalogRule\Model\Indexer\IndexBuilder::class); +$indexBuilder->reindexFull(); diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_50_percent_off_rollback.php b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_50_percent_off_rollback.php new file mode 100644 index 0000000000000..404bfd021492d --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_50_percent_off_rollback.php @@ -0,0 +1,28 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + +/** @var \Magento\CatalogRule\Model\ResourceModel\Rule $catalogRuleResource */ +$catalogRuleResource = $objectManager->create(\Magento\CatalogRule\Model\ResourceModel\Rule::class); + +//Retrieve second rule by name +$select = $catalogRuleResource->getConnection()->select(); +$select->from($catalogRuleResource->getMainTable(), 'rule_id'); +$select->where('name = ?', 'Test Catalog Rule 50% off'); +$ruleId = $catalogRuleResource->getConnection()->fetchOne($select); + +try { + /** @var \Magento\CatalogRule\Api\CatalogRuleRepositoryInterface $ruleRepository */ + $ruleRepository = $objectManager->create(\Magento\CatalogRule\Api\CatalogRuleRepositoryInterface::class); + $ruleRepository->deleteById($ruleId); +} catch (\Exception $ex) { + //Nothing to remove +} + +/** @var \Magento\CatalogRule\Model\Indexer\IndexBuilder $indexBuilder */ +$indexBuilder = $objectManager->get(\Magento\CatalogRule\Model\Indexer\IndexBuilder::class); +$indexBuilder->reindexFull(); diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/simple_products.php b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/simple_products.php index 84ce4e1bca87c..c40b641e58b1d 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/simple_products.php +++ b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/simple_products.php @@ -26,12 +26,14 @@ ->setPrice(10) ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) - ->setStockData([ - 'use_config_manage_stock' => 1, - 'qty' => 100, - 'is_qty_decimal' => 0, - 'is_in_stock' => 1, - ]); + ->setStockData( + [ + 'use_config_manage_stock' => 1, + 'qty' => 100, + 'is_qty_decimal' => 0, + 'is_in_stock' => 1, + ] + ); $productRepository->save($product); $productAction = $objectManager->get(\Magento\Catalog\Model\Product\Action::class); $productAction->updateAttributes([$product->getId()], ['test_attribute' => 'test_attribute_value'], $store->getId()); @@ -46,10 +48,52 @@ ->setPrice(9.9) ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) - ->setStockData([ - 'use_config_manage_stock' => 1, - 'qty' => 100, - 'is_qty_decimal' => 0, - 'is_in_stock' => 1, - ]); + ->setStockData( + [ + 'use_config_manage_stock' => 1, + 'qty' => 100, + 'is_qty_decimal' => 0, + 'is_in_stock' => 1, + ] + ); $productRepository->save($product); +$store = $objectManager->create(\Magento\Store\Model\Store::class); +$store->load('second_store_view', 'code'); +/** + * @var Website $website + */ +$website2 = $objectManager->get(\Magento\Store\Model\Website::class); +$website2->load('second_website', 'code'); +if (!$website2->getId()) { + /** @var \Magento\Store\Model\Website $website */ + $website2->setData( + [ + 'code' => 'second_website', + 'name' => 'Second Website', + + ] + ); + + $website2->save(); +} +$product = $objectManager->create(\Magento\Catalog\Model\Product::class) + ->setTypeId('simple') + ->setId(3) + ->setAttributeSetId($attributeSetId) + ->setWebsiteIds([$website2->getId()]) + ->setName('Simple Product 3') + ->setSku('simple3') + ->setPrice(50) + ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) + ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) + ->setStockData( + [ + 'use_config_manage_stock' => 1, + 'qty' => 100, + 'is_qty_decimal' => 0, + 'is_in_stock' => 1, + ] + ); +$productRepository->save($product); +$productAction = $objectManager->get(\Magento\Catalog\Model\Product\Action::class); +$productAction->updateAttributes([$product->getId()], ['test_attribute' => 'test_attribute_value'], $store->getId()); diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/simple_products_rollback.php b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/simple_products_rollback.php index 6625b1926fc10..e641f9f32df40 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/simple_products_rollback.php +++ b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/simple_products_rollback.php @@ -18,7 +18,7 @@ /** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */ $productRepository = $objectManager->get(\Magento\Catalog\Api\ProductRepositoryInterface::class); -foreach (['simple1', 'simple2'] as $sku) { +foreach (['simple1', 'simple2','simple3'] as $sku) { try { $product = $productRepository->get($sku, false, null, true); $productRepository->delete($product); From 97d2358bb6b2f9f85dcd1656aca7510d1455ecd0 Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@adobe.com> Date: Thu, 12 Dec 2019 09:22:57 -0600 Subject: [PATCH 0367/1143] MQE-1857: [MTF-To-MFTF] Process PR 746 - Remove unnecessary hardcoded ID reference --- .../AdminFilteringCategoryProductsUsingScopeSelectorTest.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminFilteringCategoryProductsUsingScopeSelectorTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminFilteringCategoryProductsUsingScopeSelectorTest.xml index 41b446b474078..501a5bd2282be 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminFilteringCategoryProductsUsingScopeSelectorTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminFilteringCategoryProductsUsingScopeSelectorTest.xml @@ -131,7 +131,6 @@ userInput="$$createProduct1.name$$" stepKey="seeProductName4"/> <see selector="{{AdminCategoryProductsGridSection.productGridNameProduct($$createProduct12.name$$)}}" userInput="$$createProduct12.name$$" stepKey="seeProductName5"/> - <waitForText userInput="$$createCategory.name$$ (ID: 6) (2)" stepKey="seeCorrectProductCount"/> <dontSee selector="{{AdminCategoryProductsGridSection.productGridNameProduct($$createProduct0.name$$)}}" userInput="$$createProduct0.name$$" stepKey="dontSeeProductName"/> <dontSee selector="{{AdminCategoryProductsGridSection.productGridNameProduct($$createProduct2.name$$)}}" @@ -151,7 +150,6 @@ userInput="$$createProduct2.name$$" stepKey="seeProductName6"/> <see selector="{{AdminCategoryProductsGridSection.productGridNameProduct($$createProduct12.name$$)}}" userInput="$$createProduct12.name$$" stepKey="seeProductName7"/> - <waitForText userInput="$$createCategory.name$$ (ID: 6) (2)" stepKey="seeCorrectProductCount2"/> <dontSee selector="{{AdminCategoryProductsGridSection.productGridNameProduct($$createProduct0.name$$)}}" userInput="$$createProduct0.name$$" stepKey="dontSeeProductName2"/> <dontSee selector="{{AdminCategoryProductsGridSection.productGridNameProduct($$createProduct2.name$$)}}" From efa362f0b2d4abf6d2f17f64e5e55f6e45288821 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Thu, 12 Dec 2019 23:06:28 +0700 Subject: [PATCH 0368/1143] [DownloadableImportExport] Cover Helper Data by Unit Test --- .../Test/Unit/Helper/DataTest.php | 278 ++++++++++++++++++ 1 file changed, 278 insertions(+) create mode 100644 app/code/Magento/DownloadableImportExport/Test/Unit/Helper/DataTest.php diff --git a/app/code/Magento/DownloadableImportExport/Test/Unit/Helper/DataTest.php b/app/code/Magento/DownloadableImportExport/Test/Unit/Helper/DataTest.php new file mode 100644 index 0000000000000..56dc11733cec4 --- /dev/null +++ b/app/code/Magento/DownloadableImportExport/Test/Unit/Helper/DataTest.php @@ -0,0 +1,278 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\DownloadableImportExport\Test\Unit\Helper; + +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\DownloadableImportExport\Helper\Data as HelperData; +use PHPUnit\Framework\TestCase; + +class DataTest extends TestCase +{ + /** + * @var HelperData + */ + private $helper; + + /** + * Setup environment for test + */ + protected function setUp() + { + $objectManagerHelper = new ObjectManagerHelper($this); + $this->helper = $objectManagerHelper->getObject(HelperData::class); + } + + /** + * Test isRowDownloadableEmptyOptions with dataProvider + * + * @param array $rowData + * @param bool $expected + * @dataProvider isRowDownloadableEmptyOptionsDataProvider + */ + public function testIsRowDownloadableEmptyOptions($rowData, $expected) + { + $this->assertEquals($expected, $this->helper->isRowDownloadableEmptyOptions($rowData)); + } + + /** + * Data Provider to test isRowDownloadableEmptyOptions + * + * @return array + */ + public function isRowDownloadableEmptyOptionsDataProvider() + { + return [ + 'Data set include downloadable link and sample' => [ + [ + 'downloadable_links' => 'https://magento2.com/download_link', + 'downloadable_samples' => 'https://magento2.com/sample_link' + ], + false + ], + 'Data set with empty' => [ + [ + 'downloadable_links' => '', + 'downloadable_samples' => '' + ], + true + ] + ]; + } + + /** + * Test isRowDownloadableNoValid with dataProvider + * + * @param array $rowData + * @param bool $expected + * @dataProvider isRowDownloadableNoValidDataProvider + */ + public function isRowDownloadableNoValid($rowData, $expected) + { + $this->assertEquals($expected, $this->helper->isRowDownloadableNoValid($rowData)); + } + + /** + * Data Provider to test isRowDownloadableEmptyOptions + * + * @return array + */ + public function isRowDownloadableNoValidDataProvider() + { + return [ + 'Data set include downloadable link and sample' => [ + [ + 'downloadable_links' => 'https://magento2.com/download_link', + 'downloadable_samples' => 'https://magento2.com/sample_link' + ], + true + ], + 'Data set with empty' => [ + [ + 'downloadable_links' => '', + 'downloadable_samples' => '' + ], + false + ] + ]; + } + + /** + * Test fillExistOptions with dataProvider + * + * @param array $base + * @param array $option + * @param array $existingOptions + * @param array $expected + * @dataProvider fillExistOptionsDataProvider + */ + public function testFillExistOptions($base, $option, $existingOptions, $expected) + { + $this->assertEquals($expected, $this->helper->fillExistOptions($base, $option, $existingOptions)); + } + + /** + * Data Provider to test fillExistOptions + * + * @return array + */ + public function fillExistOptionsDataProvider() + { + return [ + 'Data set 1' => [ + [], + [ + 'product_id' => 1, + 'sample_type' => 'sample_type1', + 'sample_url' => 'sample_url1', + 'sample_file' => 'sample_file1', + 'link_file' => 'link_file1', + 'link_type' => 'link_type1', + 'link_url' => 'link_url1' + ], + [ + [ + 'product_id' => 1, + 'sample_type' => 'sample_type1', + 'sample_url' => 'sample_url1', + 'sample_file' => 'sample_file1', + 'link_file' => 'link_file1', + 'link_type' => 'link_type1', + 'link_url' => 'link_url1' + ], + [ + 'product_id' => 2, + 'sample_type' => 'sample_type2', + 'sample_url' => 'sample_url2', + 'sample_file' => 'sample_file2', + 'link_file' => 'link_file2', + 'link_type' => 'link_type2', + 'link_url' => 'link_url2' + ] + ], + [ + 'product_id' => 1, + 'sample_type' => 'sample_type1', + 'sample_url' => 'sample_url1', + 'sample_file' => 'sample_file1', + 'link_file' => 'link_file1', + 'link_type' => 'link_type1', + 'link_url' => 'link_url1' + ] + ], + 'Data set 2' => [ + [], + [ + 'product_id' => 1, + 'sample_type' => 'sample_type1', + 'sample_url' => 'sample_url1', + 'sample_file' => 'sample_file1', + 'link_file' => 'link_file1', + 'link_type' => 'link_type1', + 'link_url' => 'link_url1' + ], + [], + [] + ] + ]; + } + + /** + * Test prepareDataForSave with dataProvider + * + * @param array $base + * @param array $replacement + * @param array $expected + * @dataProvider prepareDataForSaveDataProvider + */ + public function testPrepareDataForSave($base, $replacement, $expected) + { + $this->assertEquals($expected, $this->helper->prepareDataForSave($base, $replacement)); + } + + /** + * Data Provider to test prepareDataForSave + * + * @return array + */ + public function prepareDataForSaveDataProvider() + { + return [ + 'Data set 1' => [ + [], + [], + [] + ], + + 'Data set 2' => [ + [ + 'product_id' => 1, + 'sample_type' => 'sample_type1', + 'sample_url' => 'sample_url1', + 'sample_file' => 'sample_file1', + 'link_file' => 'link_file1', + 'link_type' => 'link_type1', + 'link_url' => 'link_url1' + ], + [ + [ + 'product_id' => 2, + 'sample_type' => 'sample_type2', + 'sample_url' => 'sample_url2', + 'sample_file' => 'sample_file2', + 'link_file' => 'link_file2', + 'link_type' => 'link_type2', + 'link_url' => 'link_url2' + ] + ], + [ + [ + 'product_id' => 2, + 'sample_type' => 'sample_type2', + 'sample_url' => 'sample_url2', + 'sample_file' => 'sample_file2', + 'link_file' => 'link_file2', + 'link_type' => 'link_type2', + 'link_url' => 'link_url2' + ] + ] + ] + ]; + } + + /** + * Test getTypeByValue with dataProvider + * + * @param string $option + * @param string $expected + * @dataProvider getTypeByValueDataProvider + */ + public function testGetTypeByValue($option, $expected) + { + $this->assertEquals($expected, $this->helper->getTypeByValue($option)); + } + + /** + * Data Provider for getTypeByValue + * + * @return array + */ + public function getTypeByValueDataProvider() + { + return [ + 'Case File Option Value' => [ + 'file1', + 'file' + ], + 'Case url Option Value' => [ + 'https://example.com', + 'url' + ] + ]; + } +} From 32d40dec5cbb5817e6a04daf999a9e024aacd2cf Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Thu, 12 Dec 2019 23:09:32 +0700 Subject: [PATCH 0369/1143] [DownloadableImportExport] Cover Helper Data by Unit Test --- .../Test/Unit/Helper/DataTest.php | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/DownloadableImportExport/Test/Unit/Helper/DataTest.php b/app/code/Magento/DownloadableImportExport/Test/Unit/Helper/DataTest.php index 56dc11733cec4..ce42514e52263 100644 --- a/app/code/Magento/DownloadableImportExport/Test/Unit/Helper/DataTest.php +++ b/app/code/Magento/DownloadableImportExport/Test/Unit/Helper/DataTest.php @@ -10,6 +10,7 @@ use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; use Magento\DownloadableImportExport\Helper\Data as HelperData; +use Magento\DownloadableImportExport\Model\Import\Product\Type\Downloadable; use PHPUnit\Framework\TestCase; class DataTest extends TestCase @@ -50,15 +51,15 @@ public function isRowDownloadableEmptyOptionsDataProvider() return [ 'Data set include downloadable link and sample' => [ [ - 'downloadable_links' => 'https://magento2.com/download_link', - 'downloadable_samples' => 'https://magento2.com/sample_link' + Downloadable::COL_DOWNLOADABLE_LINKS => 'https://magento2.com/download_link', + Downloadable::COL_DOWNLOADABLE_SAMPLES => 'https://magento2.com/sample_link' ], false ], 'Data set with empty' => [ [ - 'downloadable_links' => '', - 'downloadable_samples' => '' + Downloadable::COL_DOWNLOADABLE_LINKS => '', + Downloadable::COL_DOWNLOADABLE_SAMPLES => '' ], true ] @@ -87,15 +88,15 @@ public function isRowDownloadableNoValidDataProvider() return [ 'Data set include downloadable link and sample' => [ [ - 'downloadable_links' => 'https://magento2.com/download_link', - 'downloadable_samples' => 'https://magento2.com/sample_link' + Downloadable::COL_DOWNLOADABLE_LINKS => 'https://magento2.com/download_link', + Downloadable::COL_DOWNLOADABLE_SAMPLES => 'https://magento2.com/sample_link' ], true ], 'Data set with empty' => [ [ - 'downloadable_links' => '', - 'downloadable_samples' => '' + Downloadable::COL_DOWNLOADABLE_LINKS => '', + Downloadable::COL_DOWNLOADABLE_SAMPLES => '' ], false ] @@ -267,11 +268,11 @@ public function getTypeByValueDataProvider() return [ 'Case File Option Value' => [ 'file1', - 'file' + Downloadable::FILE_OPTION_VALUE ], 'Case url Option Value' => [ 'https://example.com', - 'url' + Downloadable::URL_OPTION_VALUE ] ]; } From bdf2c46b07930f1bb04649aafdd0d2c962ba9e7e Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Thu, 12 Dec 2019 10:32:35 -0600 Subject: [PATCH 0370/1143] Change action groups name according to CE branch changes --- ...uctAttributeAdvancedSectionActionGroup.xml | 20 ++++++++++++++ ...tAttributeWithDatetimeFieldActionGroup.xml | 26 +++++++++++++++++++ ...uctAttributeByAttributeCodeActionGroup.xml | 1 + ...teToCreatedProductAttributeActionGroup.xml | 1 + ...dminCreateDatetimeProductAttributeTest.xml | 8 +++--- ...SimpleProductWithDatetimeAttributeTest.xml | 2 +- 6 files changed, 53 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminNavigateToProductAttributeAdvancedSectionActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminNavigateToProductAttributeAdvancedSectionActionGroup.xml index e69de29bb2d1d..27aa0474c362d 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminNavigateToProductAttributeAdvancedSectionActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminNavigateToProductAttributeAdvancedSectionActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminNavigateToProductAttributeAdvancedSectionActionGroup"> + <annotations> + <description>Navigate and open Advanced Attribute Properties section on product attribute page</description> + </annotations> + + <scrollTo selector="{{AdvancedAttributePropertiesSection.AdvancedAttributePropertiesSectionToggle}}" stepKey="scrollToSection"/> + <conditionalClick selector="{{AdvancedAttributePropertiesSection.AdvancedAttributePropertiesSectionToggle}}" dependentSelector="{{AdvancedAttributePropertiesSection.AttributeCode}}" visible="false" stepKey="openSection"/> + <waitForElementVisible selector="{{AdvancedAttributePropertiesSection.AttributeCode}}" stepKey="waitForSlideOutSection"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateProductAttributeWithDatetimeFieldActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateProductAttributeWithDatetimeFieldActionGroup.xml index e69de29bb2d1d..545f36966feaa 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateProductAttributeWithDatetimeFieldActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateProductAttributeWithDatetimeFieldActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="CreateProductAttributeWithDatetimeFieldActionGroup" extends="createProductAttribute" insertAfter="checkRequired"> + <annotations> + <description>EXTENDS: createProductAttribute. Fills in the Attribute Code and Default Value (Attribute Type: Date and Time Field).</description> + </annotations> + <arguments> + <argument name="date" type="string"/> + </arguments> + + <scrollTo selector="{{AdvancedAttributePropertiesSection.AdvancedAttributePropertiesSectionToggle}}" stepKey="scrollToAdvancedSection"/> + <conditionalClick selector="{{AdvancedAttributePropertiesSection.AdvancedAttributePropertiesSectionToggle}}" dependentSelector="{{AdvancedAttributePropertiesSection.AttributeCode}}" visible="false" stepKey="openAdvancedSection"/> + <waitForElementVisible selector="{{AdvancedAttributePropertiesSection.AttributeCode}}" stepKey="waitForSlideOutAdvancedSection"/> + <fillField selector="{{AdvancedAttributePropertiesSection.AttributeCode}}" userInput="{{attribute.attribute_code}}" stepKey="fillCode"/> + <scrollTo selector="{{AdvancedAttributePropertiesSection.defaultValueDatetime}}" stepKey="scrollToDefaultField"/> + <fillField selector="{{AdvancedAttributePropertiesSection.defaultValueDatetime}}" userInput="{{date}}" stepKey="fillDefaultValue"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductAttributeByAttributeCodeActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductAttributeByAttributeCodeActionGroup.xml index c40a0f6d31dc0..7fbf6a9b2a178 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductAttributeByAttributeCodeActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductAttributeByAttributeCodeActionGroup.xml @@ -25,5 +25,6 @@ <click selector="{{AttributePropertiesSection.DeleteAttribute}}" stepKey="deleteAttribute"/> <click selector="{{ModalConfirmationSection.OkButton}}" stepKey="ClickOnDeleteButton"/> <waitForPageLoad stepKey="waitForPageLoad"/> + <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="waitForSuccessMessage"/> </actionGroup> </actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/NavigateToCreatedProductAttributeActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/NavigateToCreatedProductAttributeActionGroup.xml index 850939501eb81..57ce7de7f3c0b 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/NavigateToCreatedProductAttributeActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/NavigateToCreatedProductAttributeActionGroup.xml @@ -17,6 +17,7 @@ </arguments> <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/> + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingFilters"/> <fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" userInput="{{ProductAttribute.attribute_code}}" stepKey="setAttributeCode"/> <click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="searchForAttributeFromTheGrid"/> <click selector="{{AdminProductAttributeGridSection.FirstRow}}" stepKey="clickOnAttributeRow"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDatetimeProductAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDatetimeProductAttributeTest.xml index e46114ff752f6..5da824d2ccdb9 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDatetimeProductAttributeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDatetimeProductAttributeTest.xml @@ -20,7 +20,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="login"/> </before> <after> - <actionGroup ref="deleteProductAttribute" stepKey="deleteAttribute"> + <actionGroup ref="DeleteProductAttributeActionGroup" stepKey="deleteAttribute"> <argument name="ProductAttribute" value="DatetimeProductAttribute"/> </actionGroup> <actionGroup ref="AdminGridFilterResetActionGroup" stepKey="resetGridFilter"/> @@ -31,16 +31,16 @@ <!-- Create new datetime product attribute --> <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="goToProductAttributes"/> <waitForPageLoad stepKey="waitForPageLoadAttributes"/> - <actionGroup ref="CreateProductAttributeWithDatetimeField" stepKey="createAttribute"> + <actionGroup ref="CreateProductAttributeWithDatetimeFieldActionGroup" stepKey="createAttribute"> <argument name="attribute" value="DatetimeProductAttribute"/> <argument name="date" value="{$generateDefaultValue}"/> </actionGroup> <!-- Navigate to created product attribute --> - <actionGroup ref="navigateToCreatedProductAttribute" stepKey="navigateToAttribute"> + <actionGroup ref="NavigateToCreatedProductAttributeActionGroup" stepKey="navigateToAttribute"> <argument name="ProductAttribute" value="DatetimeProductAttribute"/> </actionGroup> <!-- Check the saved datetime default value --> - <actionGroup ref="AdminNavigateToProductAttributeAdvancedSection" stepKey="goToAdvancedSection"/> + <actionGroup ref="AdminNavigateToProductAttributeAdvancedSectionActionGroup" stepKey="goToAdvancedSection"/> <scrollTo selector="{{AdvancedAttributePropertiesSection.defaultValueDatetime}}" stepKey="scrollToDefaultValue"/> <seeInField userInput="{$generateDefaultValue}" selector="{{AdvancedAttributePropertiesSection.defaultValueDatetime}}" diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithDatetimeAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithDatetimeAttributeTest.xml index 6772e95b6ec27..41ad840930bc2 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithDatetimeAttributeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithDatetimeAttributeTest.xml @@ -42,7 +42,7 @@ <actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="openNewProductPage"/> <actionGroup ref="fillMainProductForm" stepKey="fillDefaultProductFields"/> <!-- Add datetime attribute --> - <actionGroup ref="addProductAttributeInProductModal" stepKey="addDatetimeAttribute"> + <actionGroup ref="AddProductAttributeInProductModalActionGroup" stepKey="addDatetimeAttribute"> <argument name="attributeCode" value="$createDatetimeAttribute.attribute_code$"/> </actionGroup> <!-- Flush config cache to reset product attributes in attribute set --> From 840afc3584858dd14dfc81f3e50d3d194185698f Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Thu, 12 Dec 2019 10:50:22 -0600 Subject: [PATCH 0371/1143] Change action groups name according to CE branch changes --- .../CreateProductAttributeWithDatetimeFieldActionGroup.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateProductAttributeWithDatetimeFieldActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateProductAttributeWithDatetimeFieldActionGroup.xml index 545f36966feaa..a4f0d22f6edb5 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateProductAttributeWithDatetimeFieldActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CreateProductAttributeWithDatetimeFieldActionGroup.xml @@ -8,7 +8,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="CreateProductAttributeWithDatetimeFieldActionGroup" extends="createProductAttribute" insertAfter="checkRequired"> + <actionGroup name="CreateProductAttributeWithDatetimeFieldActionGroup" extends="CreateProductAttributeActionGroup" insertAfter="checkRequired"> <annotations> <description>EXTENDS: createProductAttribute. Fills in the Attribute Code and Default Value (Attribute Type: Date and Time Field).</description> </annotations> From 28a41d9adb780ec751eed888563df58e0483e267 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Thu, 12 Dec 2019 11:44:57 -0600 Subject: [PATCH 0372/1143] Change action groups name according to CE branch changes --- .../AdminCreateSimpleProductWithDatetimeAttributeTest.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithDatetimeAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithDatetimeAttributeTest.xml index 41ad840930bc2..0f88fa9d6abf4 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithDatetimeAttributeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithDatetimeAttributeTest.xml @@ -23,10 +23,10 @@ </before> <after> <deleteData createDataKey="createDatetimeAttribute" stepKey="deleteDatetimeAttribute"/> - <actionGroup ref="deleteProductBySku" stepKey="deleteCreatedProduct"> + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteCreatedProduct"> <argument name="sku" value="{{_defaultProduct.sku}}"/> </actionGroup> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFiltersOnProductIndexPage"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFiltersOnProductIndexPage"/> <actionGroup ref="logout" stepKey="logout"/> </after> @@ -40,7 +40,7 @@ </createData> <!-- Open the new simple product page --> <actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="openNewProductPage"/> - <actionGroup ref="fillMainProductForm" stepKey="fillDefaultProductFields"/> + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillDefaultProductFields"/> <!-- Add datetime attribute --> <actionGroup ref="AddProductAttributeInProductModalActionGroup" stepKey="addDatetimeAttribute"> <argument name="attributeCode" value="$createDatetimeAttribute.attribute_code$"/> @@ -48,7 +48,7 @@ <!-- Flush config cache to reset product attributes in attribute set --> <magentoCLI command="cache:flush" arguments="config" stepKey="flushConfigCache"/> <!-- Save the product --> - <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!-- Check default value --> <scrollTo selector="{{AdminProductAttributesSection.sectionHeader}}" stepKey="goToAttributesSection"/> <click selector="{{AdminProductAttributesSection.sectionHeader}}" stepKey="openAttributesSection"/> From 46b676bb4ea3f19aed99566085e10db185ebb9c0 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Thu, 12 Dec 2019 13:26:52 -0600 Subject: [PATCH 0373/1143] Change action groups name according to CE branch changes --- .../Test/StorefrontFreeShippingDisplayWithInclTaxOptionTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/OfflineShipping/Test/Mftf/Test/StorefrontFreeShippingDisplayWithInclTaxOptionTest.xml b/app/code/Magento/OfflineShipping/Test/Mftf/Test/StorefrontFreeShippingDisplayWithInclTaxOptionTest.xml index db44a06b54a88..d2e092283e9bd 100644 --- a/app/code/Magento/OfflineShipping/Test/Mftf/Test/StorefrontFreeShippingDisplayWithInclTaxOptionTest.xml +++ b/app/code/Magento/OfflineShipping/Test/Mftf/Test/StorefrontFreeShippingDisplayWithInclTaxOptionTest.xml @@ -41,7 +41,7 @@ <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> </after> <!-- Add simple product to cart --> - <actionGroup ref="AddSimpleProductToCart" stepKey="addProductToCart"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToCart"> <argument name="product" value="$$createSimpleProduct$$"/> </actionGroup> <!-- Assert that taxes are applied correctly for CA --> From b7640b056a7b9baa16984643f13ea0d001fd7b68 Mon Sep 17 00:00:00 2001 From: Dan Wallis <mrdanwallis@gmail.com> Date: Thu, 12 Dec 2019 23:01:33 +0000 Subject: [PATCH 0374/1143] Position arrow by item, not centrally in menu --- .../Magento/backend/web/css/source/_actions.less | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/design/adminhtml/Magento/backend/web/css/source/_actions.less b/app/design/adminhtml/Magento/backend/web/css/source/_actions.less index c86e9cdbf0866..852c6c1f3799e 100644 --- a/app/design/adminhtml/Magento/backend/web/css/source/_actions.less +++ b/app/design/adminhtml/Magento/backend/web/css/source/_actions.less @@ -451,11 +451,9 @@ button { border-width: .4rem 0 .4rem .5rem; content: ''; height: 0; - margin-top: -.2rem; - position: absolute; - right: 1rem; - top: 50%; - transition: all .2s linear; + position: relative; + right: 1.2rem; + top: 1.4rem; width: 0; } } From 6d7f34ee9d1cb4de6347ef041acab7f875c74aea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Chitesh=40wagento=2Ecom=E2=80=9D?= <hitesh@wagento.com> Date: Fri, 13 Dec 2019 11:22:16 +0530 Subject: [PATCH 0375/1143] [changes as per requested] --- .../web/css/source/module/checkout/_shipping.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_shipping.less b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_shipping.less index 661f1ff90ae26..2eb634acc5daa 100644 --- a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_shipping.less +++ b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_shipping.less @@ -185,7 +185,7 @@ width: 20px; } - input[type="radio"] { + input[type='radio'] { margin: 4px 5px 0 0; } } From 68770d182cfa085dc3fc2361d4bcd4fd06a30dc3 Mon Sep 17 00:00:00 2001 From: "rostyslav.hymon" <rostyslav.hymon@transoftgroup.com> Date: Fri, 13 Dec 2019 09:07:58 +0200 Subject: [PATCH 0376/1143] MC-25187: Session lost after switching stores on different domains --- .../view/frontend/web/js/customer-data.js | 5 + .../Store/Controller/Store/Redirect.php | 33 +++- .../Store/Controller/Store/SwitchAction.php | 22 ++- .../Store/SwitchAction/CookieManager.php | 65 +++++++ .../Model/StoreSwitcher/HashGenerator.php | 69 +++---- .../Model/StoreSwitcher/HashProcessor.php | 127 ++++++++++++ app/code/Magento/Store/etc/di.xml | 2 +- .../Magento/Store/Model/HashGeneratorTest.php | 180 ------------------ .../Model/StoreSwitcher/RewriteUrlTest.php | 10 +- 9 files changed, 272 insertions(+), 241 deletions(-) create mode 100644 app/code/Magento/Store/Controller/Store/SwitchAction/CookieManager.php create mode 100644 app/code/Magento/Store/Model/StoreSwitcher/HashProcessor.php delete mode 100644 dev/tests/integration/testsuite/Magento/Store/Model/HashGeneratorTest.php diff --git a/app/code/Magento/Customer/view/frontend/web/js/customer-data.js b/app/code/Magento/Customer/view/frontend/web/js/customer-data.js index de3ff10bb057b..770ea47d754d3 100644 --- a/app/code/Magento/Customer/view/frontend/web/js/customer-data.js +++ b/app/code/Magento/Customer/view/frontend/web/js/customer-data.js @@ -214,6 +214,11 @@ define([ this.reload(storageInvalidation.keys(), false); } } + + if (!_.isEmpty($.cookieStorage.get('section_data_clean'))) { + this.reload(sectionConfig.getSectionNames(), true); + $.cookieStorage.set('section_data_clean', ''); + } }, /** diff --git a/app/code/Magento/Store/Controller/Store/Redirect.php b/app/code/Magento/Store/Controller/Store/Redirect.php index 21692e9d6dd1e..a5d0e481ba8fe 100644 --- a/app/code/Magento/Store/Controller/Store/Redirect.php +++ b/app/code/Magento/Store/Controller/Store/Redirect.php @@ -7,19 +7,25 @@ namespace Magento\Store\Controller\Store; +use Magento\Framework\App\Action\Action; use Magento\Framework\App\Action\Context; +use Magento\Framework\App\Action\HttpGetActionInterface; +use Magento\Framework\App\Action\HttpPostActionInterface; use Magento\Framework\App\ResponseInterface; +use Magento\Framework\Controller\ResultInterface; use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Session\Generic as Session; +use Magento\Framework\Session\SidResolverInterface; use Magento\Store\Api\StoreRepositoryInterface; use Magento\Store\Api\StoreResolverInterface; +use Magento\Store\Model\Store; use Magento\Store\Model\StoreResolver; -use Magento\Framework\Session\SidResolverInterface; -use Magento\Framework\Session\Generic as Session; +use Magento\Store\Model\StoreSwitcher\HashGenerator; /** * Builds correct url to target store and performs redirect. */ -class Redirect extends \Magento\Framework\App\Action\Action +class Redirect extends Action implements HttpGetActionInterface, HttpPostActionInterface { /** * @var StoreRepositoryInterface @@ -41,34 +47,44 @@ class Redirect extends \Magento\Framework\App\Action\Action */ private $session; + /** + * @var HashGenerator + */ + private $hashGenerator; + /** * @param Context $context * @param StoreRepositoryInterface $storeRepository * @param StoreResolverInterface $storeResolver * @param Session $session * @param SidResolverInterface $sidResolver + * @param HashGenerator $hashGenerator */ public function __construct( Context $context, StoreRepositoryInterface $storeRepository, StoreResolverInterface $storeResolver, Session $session, - SidResolverInterface $sidResolver + SidResolverInterface $sidResolver, + HashGenerator $hashGenerator ) { parent::__construct($context); $this->storeRepository = $storeRepository; $this->storeResolver = $storeResolver; $this->session = $session; $this->sidResolver = $sidResolver; + $this->hashGenerator = $hashGenerator; } /** - * @return ResponseInterface|\Magento\Framework\Controller\ResultInterface + * Performs store redirect + * + * @return ResponseInterface|ResultInterface * @throws NoSuchEntityException */ public function execute() { - /** @var \Magento\Store\Model\Store $currentStore */ + /** @var Store $currentStore */ $currentStore = $this->storeRepository->getById($this->storeResolver->getCurrentStoreId()); $targetStoreCode = $this->_request->getParam(StoreResolver::PARAM_NAME); $fromStoreCode = $this->_request->getParam('___from_store'); @@ -79,7 +95,7 @@ public function execute() } try { - /** @var \Magento\Store\Model\Store $targetStore */ + /** @var Store $fromStore */ $fromStore = $this->storeRepository->get($fromStoreCode); } catch (NoSuchEntityException $e) { $error = __('Requested store is not found'); @@ -103,6 +119,9 @@ public function execute() $query[$sidName] = $this->session->getSessionId(); } + $customerHash = $this->hashGenerator->generateHash($fromStore); + $query = array_merge($query, $customerHash); + $arguments = [ '_nosid' => true, '_query' => $query diff --git a/app/code/Magento/Store/Controller/Store/SwitchAction.php b/app/code/Magento/Store/Controller/Store/SwitchAction.php index d8ac1b308d7ed..41acb1605ec7c 100644 --- a/app/code/Magento/Store/Controller/Store/SwitchAction.php +++ b/app/code/Magento/Store/Controller/Store/SwitchAction.php @@ -11,7 +11,6 @@ use Magento\Framework\App\Action\Action; use Magento\Framework\App\Action\Context as ActionContext; use Magento\Framework\App\Http\Context as HttpContext; -use Magento\Framework\App\ObjectManager; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Store\Api\StoreCookieManagerInterface; use Magento\Store\Api\StoreRepositoryInterface; @@ -21,6 +20,7 @@ use Magento\Store\Model\StoreSwitcherInterface; use Magento\Framework\App\Action\HttpPostActionInterface; use Magento\Framework\App\Action\HttpGetActionInterface; +use Magento\Store\Controller\Store\SwitchAction\CookieManager; /** * Handles store switching url and makes redirect. @@ -56,6 +56,11 @@ class SwitchAction extends Action implements HttpGetActionInterface, HttpPostAct */ private $storeSwitcher; + /** + * @var CookieManager + */ + private $cookieManager; + /** * Initialize dependencies. * @@ -65,6 +70,7 @@ class SwitchAction extends Action implements HttpGetActionInterface, HttpPostAct * @param StoreRepositoryInterface $storeRepository * @param StoreManagerInterface $storeManager * @param StoreSwitcherInterface $storeSwitcher + * @param CookieManager $cookieManager */ public function __construct( ActionContext $context, @@ -72,7 +78,8 @@ public function __construct( HttpContext $httpContext, StoreRepositoryInterface $storeRepository, StoreManagerInterface $storeManager, - StoreSwitcherInterface $storeSwitcher = null + StoreSwitcherInterface $storeSwitcher, + CookieManager $cookieManager ) { parent::__construct($context); $this->storeCookieManager = $storeCookieManager; @@ -80,7 +87,8 @@ public function __construct( $this->storeRepository = $storeRepository; $this->storeManager = $storeManager; $this->messageManager = $context->getMessageManager(); - $this->storeSwitcher = $storeSwitcher ?: ObjectManager::getInstance()->get(StoreSwitcherInterface::class); + $this->storeSwitcher = $storeSwitcher; + $this->cookieManager = $cookieManager; } /** @@ -88,12 +96,13 @@ public function __construct( * * @return void * @throws StoreSwitcher\CannotSwitchStoreException + * @throws \Magento\Framework\Exception\InputException + * @throws \Magento\Framework\Stdlib\Cookie\CookieSizeLimitReachedException + * @throws \Magento\Framework\Stdlib\Cookie\FailureToSendException */ public function execute() { - $targetStoreCode = $this->_request->getParam( - \Magento\Store\Model\StoreManagerInterface::PARAM_NAME - ); + $targetStoreCode = $this->_request->getParam(StoreManagerInterface::PARAM_NAME); $fromStoreCode = $this->_request->getParam( '___from_store', $this->storeCookieManager->getStoreCodeFromCookie() @@ -115,6 +124,7 @@ public function execute() $this->messageManager->addErrorMessage($error); } else { $redirectUrl = $this->storeSwitcher->switch($fromStore, $targetStore, $requestedUrlToRedirect); + $this->cookieManager->setCookieForStore($targetStore); } $this->getResponse()->setRedirect($redirectUrl); diff --git a/app/code/Magento/Store/Controller/Store/SwitchAction/CookieManager.php b/app/code/Magento/Store/Controller/Store/SwitchAction/CookieManager.php new file mode 100644 index 0000000000000..182ae35b0ff61 --- /dev/null +++ b/app/code/Magento/Store/Controller/Store/SwitchAction/CookieManager.php @@ -0,0 +1,65 @@ +<?php +/** + * + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Store\Controller\Store\SwitchAction; + +use Magento\Framework\Stdlib\Cookie\CookieMetadataFactory; +use Magento\Framework\Stdlib\CookieManagerInterface; +use Magento\Store\Api\Data\StoreInterface; + +/** + * Handles store switching cookie for the frontend storage clean + * + * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) + */ +class CookieManager +{ + /** + * @var string + */ + const COOKIE_NAME = 'section_data_clean'; + + /** + * @var CookieMetadataFactory + */ + private $cookieMetadataFactory; + + /** + * @var CookieManagerInterface + */ + private $cookieManager; + + /** + * @param CookieMetadataFactory $cookieMetadataFactory + * @param CookieManagerInterface $cookieManager + */ + public function __construct( + CookieMetadataFactory $cookieMetadataFactory, + CookieManagerInterface $cookieManager + ) { + $this->cookieMetadataFactory = $cookieMetadataFactory; + $this->cookieManager = $cookieManager; + } + + /** + * Set cookie for store + * + * @param StoreInterface $targetStore + * @throws \Magento\Framework\Exception\InputException + * @throws \Magento\Framework\Stdlib\Cookie\CookieSizeLimitReachedException + * @throws \Magento\Framework\Stdlib\Cookie\FailureToSendException + */ + public function setCookieForStore(StoreInterface $targetStore) + { + $cookieMetadata = $this->cookieMetadataFactory->createPublicCookieMetadata() + ->setHttpOnly(false) + ->setDuration(15) + ->setPath($targetStore->getStorePath()); + $this->cookieManager->setPublicCookie(self::COOKIE_NAME, $targetStore->getCode(), $cookieMetadata); + } +} diff --git a/app/code/Magento/Store/Model/StoreSwitcher/HashGenerator.php b/app/code/Magento/Store/Model/StoreSwitcher/HashGenerator.php index 456941bd41c25..d1858939434b7 100644 --- a/app/code/Magento/Store/Model/StoreSwitcher/HashGenerator.php +++ b/app/code/Magento/Store/Model/StoreSwitcher/HashGenerator.php @@ -7,19 +7,18 @@ namespace Magento\Store\Model\StoreSwitcher; +use Magento\Authorization\Model\UserContextInterface; +use Magento\Framework\App\ActionInterface; +use Magento\Framework\App\DeploymentConfig as DeploymentConfig; +use Magento\Framework\Config\ConfigOptionsListConstants; +use Magento\Framework\Url\Helper\Data as UrlHelper; use Magento\Store\Api\Data\StoreInterface; use Magento\Store\Model\StoreSwitcher\HashGenerator\HashData; -use Magento\Store\Model\StoreSwitcherInterface; -use \Magento\Framework\App\DeploymentConfig as DeploymentConfig; -use Magento\Framework\Url\Helper\Data as UrlHelper; -use Magento\Framework\Config\ConfigOptionsListConstants; -use Magento\Authorization\Model\UserContextInterface; -use \Magento\Framework\App\ActionInterface; /** * Generate one time token and build redirect url */ -class HashGenerator implements StoreSwitcherInterface +class HashGenerator { /** * @var \Magento\Framework\App\DeploymentConfig @@ -52,48 +51,40 @@ public function __construct( } /** - * Builds redirect url with token + * Generate hash data for customer * - * @param StoreInterface $fromStore store where we came from - * @param StoreInterface $targetStore store where to go to - * @param string $redirectUrl original url requested for redirect after switching - * @return string redirect url - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @param StoreInterface $fromStore + * @return array */ - public function switch(StoreInterface $fromStore, StoreInterface $targetStore, string $redirectUrl): string + public function generateHash(StoreInterface $fromStore): array { - $targetUrl = $redirectUrl; + $key = (string)$this->deploymentConfig->get(ConfigOptionsListConstants::CONFIG_PATH_CRYPT_KEY); + $timeStamp = time(); + $customerId = null; - $encodedUrl = $this->urlHelper->getEncodedUrl($redirectUrl); + $result = []; if ($this->currentUser->getUserType() == UserContextInterface::USER_TYPE_CUSTOMER) { $customerId = $this->currentUser->getUserId(); - } - if ($customerId) { - // phpcs:ignore - $urlParts = parse_url($targetUrl); - $host = $urlParts['host']; - $scheme = $urlParts['scheme']; - $key = (string)$this->deploymentConfig->get(ConfigOptionsListConstants::CONFIG_PATH_CRYPT_KEY); - $timeStamp = time(); - $fromStoreCode = $fromStore->getCode(); - $data = implode(',', [$customerId, $timeStamp, $fromStoreCode]); - $signature = hash_hmac('sha256', $data, $key); - $targetUrl = $scheme . "://" . $host . '/stores/store/switchrequest'; - $targetUrl = $this->urlHelper->addRequestParam( - $targetUrl, - ['customer_id' => $customerId] - ); - $targetUrl = $this->urlHelper->addRequestParam($targetUrl, ['time_stamp' => $timeStamp]); - $targetUrl = $this->urlHelper->addRequestParam($targetUrl, ['signature' => $signature]); - $targetUrl = $this->urlHelper->addRequestParam($targetUrl, ['___from_store' => $fromStoreCode]); - $targetUrl = $this->urlHelper->addRequestParam( - $targetUrl, - [ActionInterface::PARAM_NAME_URL_ENCODED => $encodedUrl] + $data = implode( + ',', + [ + $customerId, + $timeStamp, + $fromStore->getCode() + ] ); + $signature = hash_hmac('sha256', $data, $key); + + $result = [ + 'customer_id' => $customerId, + 'time_stamp' => $timeStamp, + 'signature' => $signature + ]; } - return $targetUrl; + + return $result; } /** diff --git a/app/code/Magento/Store/Model/StoreSwitcher/HashProcessor.php b/app/code/Magento/Store/Model/StoreSwitcher/HashProcessor.php new file mode 100644 index 0000000000000..909fe9f6683f8 --- /dev/null +++ b/app/code/Magento/Store/Model/StoreSwitcher/HashProcessor.php @@ -0,0 +1,127 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Store\Model\StoreSwitcher; + +use Magento\Authorization\Model\UserContextInterface; +use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Customer\Model\ResourceModel\CustomerRepository; +use Magento\Customer\Model\Session as CustomerSession; +use Magento\Framework\App\DeploymentConfig as DeploymentConfig; +use Magento\Framework\App\RequestInterface; +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Message\ManagerInterface; +use Magento\Framework\Url\Helper\Data as UrlHelper; +use Magento\Store\Api\Data\StoreInterface; +use Magento\Store\Model\StoreSwitcher\HashGenerator\HashData; +use Magento\Store\Model\StoreSwitcherInterface; + +/** + * Process one time token and build redirect url + * + * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) + */ +class HashProcessor implements StoreSwitcherInterface +{ + /** + * @var HashGenerator + */ + private $hashGenerator; + + /** + * @var RequestInterface + */ + private $request; + + /** + * @var ManagerInterface + */ + private $messageManager; + + /** + * @var customerSession + */ + private $customerSession; + + /** + * @var CustomerRepositoryInterface + */ + private $customerRepository; + + /** + * @param HashGenerator $hashGenerator + * @param RequestInterface $request + * @param ManagerInterface $messageManager + * @param CustomerRepository $customerRepository + * @param CustomerSession $customerSession + */ + public function __construct( + HashGenerator $hashGenerator, + RequestInterface $request, + ManagerInterface $messageManager, + CustomerRepository $customerRepository, + CustomerSession $customerSession + ) { + $this->hashGenerator = $hashGenerator; + $this->request = $request; + $this->messageManager = $messageManager; + $this->customerSession = $customerSession; + $this->customerRepository = $customerRepository; + } + + /** + * Builds redirect url with token + * + * @param StoreInterface $fromStore store where we came from + * @param StoreInterface $targetStore store where to go to + * @param string $redirectUrl original url requested for redirect after switching + * @return string redirect url + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function switch(StoreInterface $fromStore, StoreInterface $targetStore, string $redirectUrl): string + { + $customerId = $this->request->getParam('customer_id'); + + if ($customerId) { + $fromStoreCode = (string)$this->request->getParam('___from_store'); + $timeStamp = (string)$this->request->getParam('time_stamp'); + $signature = (string)$this->request->getParam('signature'); + + $error = null; + + $data = new HashData( + [ + "customer_id" => $customerId, + "time_stamp" => $timeStamp, + "___from_store" => $fromStoreCode + ] + ); + + if ($redirectUrl && $this->hashGenerator->validateHash($signature, $data)) { + try { + $customer = $this->customerRepository->getById($customerId); + if (!$this->customerSession->isLoggedIn()) { + $this->customerSession->setCustomerDataAsLoggedIn($customer); + } + } catch (NoSuchEntityException $e) { + $error = __('The requested customer does not exist.'); + } catch (LocalizedException $e) { + $error = __('There was an error retrieving the customer record.'); + } + } else { + $error = __('The requested store cannot be found. Please check the request and try again.'); + } + + if ($error !== null) { + $this->messageManager->addErrorMessage($error); + } + } + + return $redirectUrl; + } +} diff --git a/app/code/Magento/Store/etc/di.xml b/app/code/Magento/Store/etc/di.xml index 3fa9c8314fdd1..8f4151b8fc966 100644 --- a/app/code/Magento/Store/etc/di.xml +++ b/app/code/Magento/Store/etc/di.xml @@ -436,7 +436,7 @@ <item name="cleanTargetUrl" xsi:type="object">Magento\Store\Model\StoreSwitcher\CleanTargetUrl</item> <item name="manageStoreCookie" xsi:type="object">Magento\Store\Model\StoreSwitcher\ManageStoreCookie</item> <item name="managePrivateContent" xsi:type="object">Magento\Store\Model\StoreSwitcher\ManagePrivateContent</item> - <item name="hashGenerator" xsi:type="object" sortOrder="1000">Magento\Store\Model\StoreSwitcher\HashGenerator</item> + <item name="hashProcessor" xsi:type="object" sortOrder="1000">Magento\Store\Model\StoreSwitcher\HashProcessor</item> </argument> </arguments> </type> diff --git a/dev/tests/integration/testsuite/Magento/Store/Model/HashGeneratorTest.php b/dev/tests/integration/testsuite/Magento/Store/Model/HashGeneratorTest.php deleted file mode 100644 index 1bacd79b74f49..0000000000000 --- a/dev/tests/integration/testsuite/Magento/Store/Model/HashGeneratorTest.php +++ /dev/null @@ -1,180 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -declare(strict_types=1); - -namespace Magento\Store\Model; - -use Magento\Framework\ObjectManagerInterface as ObjectManager; -use Magento\TestFramework\Helper\Bootstrap; -use Magento\Store\Model\StoreSwitcher\HashGenerator; -use Magento\Customer\Api\AccountManagementInterface; -use Magento\Customer\Model\Session as CustomerSession; -use \Magento\Framework\App\DeploymentConfig as DeploymentConfig; -use Magento\Framework\Config\ConfigOptionsListConstants; -use Magento\Framework\Url\Helper\Data as UrlHelper; -use Magento\Store\Model\StoreSwitcher\HashGenerator\HashData; - -/** - * Test class for \Magento\Store\Model\StoreSwitcher\HashGenerator - * @SuppressWarnings(PHPMD.CouplingBetweenObjects) - */ -class HashGeneratorTest extends \PHPUnit\Framework\TestCase -{ - /** - * @var HashGenerator - */ - private $hashGenerator; - - /** - * @var ObjectManager - */ - private $objectManager; - - /** - * @var int - */ - private $customerId; - - /** @var AccountManagementInterface */ - private $accountManagement; - - /** - * @var \Magento\Customer\Model\Authorization\CustomerSessionUserContext - */ - private $customerSessionUserContext; - - /** - * @var \Magento\Framework\App\DeploymentConfig - */ - private $deploymentConfig; - - /** - * @var string - */ - private $key; - - /** - * @var UrlHelper - */ - private $urlHelper; - - /** - * @var HashData - */ - private $hashData; - - /** - * @var CustomerSession - */ - private $customerSession; - - /** - * Class dependencies initialization - * @return void - * @throws \Magento\Framework\Exception\LocalizedException - */ - protected function setUp() - { - $this->objectManager = Bootstrap::getObjectManager(); - $this->customerSession = $this->objectManager->create( - CustomerSession::class - ); - $this->accountManagement = $this->objectManager->create(AccountManagementInterface::class); - $customer = $this->accountManagement->authenticate('customer@example.com', 'password'); - $this->customerSession->setCustomerDataAsLoggedIn($customer); - $this->customerSessionUserContext = $this->objectManager->create( - \Magento\Customer\Model\Authorization\CustomerSessionUserContext::class, - ['customerSession' => $this->customerSession] - ); - $this->hashGenerator = $this->objectManager->create( - StoreSwitcher\HashGenerator::class, - ['currentUser' => $this->customerSessionUserContext] - ); - $this->customerId = $customer->getId(); - $this->deploymentConfig = $this->objectManager->get(DeploymentConfig::class); - $this->key = (string)$this->deploymentConfig->get(ConfigOptionsListConstants::CONFIG_PATH_CRYPT_KEY); - $this->urlHelper=$this->objectManager->create(UrlHelper::class); - $this->hashData=$this->objectManager->create(HashData::class); - } - - /** - * @inheritdoc - */ - protected function tearDown() - { - $this->customerSession->logout(); - parent::tearDown(); - } - - /** - * @magentoAppIsolation enabled - * @magentoDataFixture Magento/Customer/_files/customer.php - * @return void - */ - public function testSwitch(): void - { - $redirectUrl = "http://domain.com/"; - $fromStoreCode = 'test'; - $fromStore = $this->createPartialMock(Store::class, ['getCode']); - $toStore = $this->createPartialMock(Store::class, ['getCode']); - $fromStore->expects($this->once())->method('getCode')->willReturn($fromStoreCode); - $targetUrl=$this->hashGenerator->switch($fromStore, $toStore, $redirectUrl); - // phpcs:ignore - $urlParts=parse_url($targetUrl, PHP_URL_QUERY); - $signature=''; - // phpcs:ignore - parse_str($urlParts, $params); - - if (isset($params['signature'])) { - $signature=$params['signature']; - } - $this->assertEquals($params['customer_id'], $this->customerId); - $this->assertEquals($params['___from_store'], $fromStoreCode); - - $data = new HashData( - [ - "customer_id" => $this->customerId, - "time_stamp" => $params['time_stamp'], - "___from_store" => $fromStoreCode - ] - ); - $this->assertTrue($this->hashGenerator->validateHash($signature, $data)); - } - - /** - * @magentoAppIsolation enabled - * @magentoDataFixture Magento/Customer/_files/customer.php - * @return void - */ - public function testValidateHashWithInCorrectData(): void - { - $timeStamp = 0; - $customerId = 8; - $fromStoreCode = 'store1'; - $data = new HashData( - [ - "customer_id" => $customerId, - "time_stamp" => $timeStamp, - "___from_store" => $fromStoreCode - ] - ); - $redirectUrl = "http://domain.com/"; - $fromStore = $this->createPartialMock(Store::class, ['getCode']); - $toStore = $this->createPartialMock(Store::class, ['getCode']); - $fromStore->expects($this->once())->method('getCode')->willReturn($fromStoreCode); - $targetUrl = $this->hashGenerator->switch($fromStore, $toStore, $redirectUrl); - // phpcs:ignore - $urlParts = parse_url($targetUrl,PHP_URL_QUERY); - $signature = ''; - // phpcs:ignore - parse_str($urlParts, $params); - - if (isset($params['signature'])) { - $signature = $params['signature']; - } - $this->assertFalse($this->hashGenerator->validateHash($signature, $data)); - } -} diff --git a/dev/tests/integration/testsuite/Magento/UrlRewrite/Model/StoreSwitcher/RewriteUrlTest.php b/dev/tests/integration/testsuite/Magento/UrlRewrite/Model/StoreSwitcher/RewriteUrlTest.php index 317d26abd3370..7e10eb8766aa1 100644 --- a/dev/tests/integration/testsuite/Magento/UrlRewrite/Model/StoreSwitcher/RewriteUrlTest.php +++ b/dev/tests/integration/testsuite/Magento/UrlRewrite/Model/StoreSwitcher/RewriteUrlTest.php @@ -11,12 +11,10 @@ use Magento\Customer\Api\CustomerRepositoryInterface; use Magento\Customer\Api\Data\CustomerInterface; use Magento\Customer\Model\Session; -use Magento\Framework\App\ActionInterface; use Magento\Framework\App\Config\ReinitableConfigInterface; use Magento\Framework\App\Config\Value; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\ObjectManagerInterface as ObjectManager; -use Magento\Framework\Url\DecoderInterface; use Magento\Store\Api\Data\StoreInterface; use Magento\Store\Api\StoreRepositoryInterface; use Magento\Store\Model\ScopeInterface; @@ -146,13 +144,9 @@ public function testSwitchCmsPageToAnotherStoreAsCustomer(): void $redirectUrl = "http://localhost/index.php/page-c/"; $expectedUrl = "http://localhost/index.php/page-c-on-2nd-store"; - /** @var DecoderInterface $decoder */ - $decoder = $this->objectManager->create(DecoderInterface::class); + $secureRedirectUrl = $this->storeSwitcher->switch($fromStore, $toStore, $redirectUrl); - parse_str(parse_url($secureRedirectUrl, PHP_URL_QUERY), $secureRedirectUrlQueryParams); - $encodedActualUrl = $secureRedirectUrlQueryParams[ActionInterface::PARAM_NAME_URL_ENCODED]; - $actualUrl = $decoder->decode($encodedActualUrl); - $this->assertEquals($expectedUrl, $actualUrl); + $this->assertEquals($expectedUrl, $secureRedirectUrl); } /** From 5819ded0ed228e0de105000d92da26531c07785a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Fri, 19 Jul 2019 11:33:26 +0200 Subject: [PATCH 0377/1143] Add Cron Jobs names to New Relic transactions --- .../Observer/ProcessCronQueueObserver.php | 54 ++++++--- .../Model/NewRelicWrapper.php | 19 +++- .../Plugin/CommandPlugin.php | 30 ++++- .../NewRelicReporting/Plugin/StatPlugin.php | 105 ++++++++++++++++++ .../Test/Unit/Plugin/CommandPluginTest.php | 105 ++++++++++++++++++ .../Test/Unit/Plugin/StatPluginTest.php | 97 ++++++++++++++++ app/code/Magento/NewRelicReporting/etc/di.xml | 12 +- 7 files changed, 400 insertions(+), 22 deletions(-) create mode 100644 app/code/Magento/NewRelicReporting/Plugin/StatPlugin.php create mode 100644 app/code/Magento/NewRelicReporting/Test/Unit/Plugin/CommandPluginTest.php create mode 100644 app/code/Magento/NewRelicReporting/Test/Unit/Plugin/StatPluginTest.php diff --git a/app/code/Magento/Cron/Observer/ProcessCronQueueObserver.php b/app/code/Magento/Cron/Observer/ProcessCronQueueObserver.php index 5c8aa1dc78abd..053ba43c1c20e 100644 --- a/app/code/Magento/Cron/Observer/ProcessCronQueueObserver.php +++ b/app/code/Magento/Cron/Observer/ProcessCronQueueObserver.php @@ -3,9 +3,11 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + /** * Handling cron jobs */ + namespace Magento\Cron\Observer; use Magento\Cron\Model\Schedule; @@ -69,6 +71,11 @@ class ProcessCronQueueObserver implements ObserverInterface */ const LOCK_PREFIX = 'CRON_GROUP_'; + /** + * Cron Job name pattern for Profiling + */ + const CRON_TIMERID = 'job %s'; + /** * @var \Magento\Cron\Model\ResourceModel\Schedule\Collection */ @@ -311,7 +318,7 @@ protected function _runJob($scheduledTime, $currentTime, $jobConfig, $schedule, $schedule->setExecutedAt(strftime('%Y-%m-%d %H:%M:%S', $this->dateTime->gmtTimestamp()))->save(); - $this->startProfiling(); + $this->startProfiling($jobCode); try { $this->logger->info(sprintf('Cron Job %s is run', $jobCode)); //phpcs:ignore Magento2.Functions.DiscouragedFunction @@ -323,7 +330,7 @@ protected function _runJob($scheduledTime, $currentTime, $jobConfig, $schedule, 'Cron Job %s has an error: %s. Statistics: %s', $jobCode, $e->getMessage(), - $this->getProfilingStat() + $this->getProfilingStat($jobCode) ) ); if (!$e instanceof \Exception) { @@ -335,7 +342,7 @@ protected function _runJob($scheduledTime, $currentTime, $jobConfig, $schedule, } throw $e; } finally { - $this->stopProfiling(); + $this->stopProfiling($jobCode); } $schedule->setStatus( @@ -351,7 +358,7 @@ protected function _runJob($scheduledTime, $currentTime, $jobConfig, $schedule, sprintf( 'Cron Job %s is successfully finished. Statistics: %s', $jobCode, - $this->getProfilingStat() + $this->getProfilingStat($jobCode) ) ); } @@ -359,32 +366,47 @@ protected function _runJob($scheduledTime, $currentTime, $jobConfig, $schedule, /** * Starts profiling * + * @param string $jobName * @return void */ - private function startProfiling() + private function startProfiling(string $jobName = '') { $this->statProfiler->clear(); - $this->statProfiler->start('job', microtime(true), memory_get_usage(true), memory_get_usage()); + $this->statProfiler->start( + sprintf(self::CRON_TIMERID, $jobName), + microtime(true), + memory_get_usage(true), + memory_get_usage() + ); } /** * Stops profiling * + * @param string $jobName * @return void */ - private function stopProfiling() + private function stopProfiling(string $jobName = '') { - $this->statProfiler->stop('job', microtime(true), memory_get_usage(true), memory_get_usage()); + $this->statProfiler->stop( + sprintf(self::CRON_TIMERID, $jobName), + microtime(true), + memory_get_usage(true), + memory_get_usage() + ); } /** * Retrieves statistics in the JSON format * + * @param string $jobName * @return string */ - private function getProfilingStat() + private function getProfilingStat(string $jobName): string { - $stat = $this->statProfiler->get('job'); + $stat = $this->statProfiler->get( + sprintf(self::CRON_TIMERID, $jobName) + ); unset($stat[Stat::START]); return json_encode($stat); } @@ -418,7 +440,9 @@ private function getNonExitedSchedules($groupId) 'status', [ 'in' => [ - Schedule::STATUS_PENDING, Schedule::STATUS_RUNNING, Schedule::STATUS_SUCCESS + Schedule::STATUS_PENDING, + Schedule::STATUS_RUNNING, + Schedule::STATUS_SUCCESS ] ] ); @@ -478,10 +502,10 @@ private function generateSchedules($groupId) /** * Generate jobs for config information * - * @param array $jobs - * @param array $exists - * @param string $groupId - * @return void + * @param array $jobs + * @param array $exists + * @param string $groupId + * @return void */ protected function _generateJobs($jobs, $exists, $groupId) { diff --git a/app/code/Magento/NewRelicReporting/Model/NewRelicWrapper.php b/app/code/Magento/NewRelicReporting/Model/NewRelicWrapper.php index bce42b4e90074..fa7f2f1090629 100644 --- a/app/code/Magento/NewRelicReporting/Model/NewRelicWrapper.php +++ b/app/code/Magento/NewRelicReporting/Model/NewRelicWrapper.php @@ -5,6 +5,8 @@ */ namespace Magento\NewRelicReporting\Model; +use Exception; + /** * Wrapper for New Relic functions * @@ -31,10 +33,10 @@ public function addCustomParameter($param, $value) /** * Wrapper for 'newrelic_notice_error' function * - * @param \Exception $exception + * @param Exception $exception * @return void */ - public function reportError($exception) + public function reportError(Exception $exception) { if ($this->isExtensionInstalled()) { newrelic_notice_error($exception->getMessage(), $exception); @@ -67,6 +69,19 @@ public function setTransactionName(string $transactionName): void } } + /** + * Wrapper for 'newrelic_end_transaction' + * + * @param bool $ignore + * @return void + */ + public function endTransaction($ignore = false) + { + if ($this->isExtensionInstalled()) { + newrelic_end_transaction($ignore); + } + } + /** * Checks whether newrelic-php5 agent is installed * diff --git a/app/code/Magento/NewRelicReporting/Plugin/CommandPlugin.php b/app/code/Magento/NewRelicReporting/Plugin/CommandPlugin.php index 04ad3d0504d34..d21f972da57c6 100644 --- a/app/code/Magento/NewRelicReporting/Plugin/CommandPlugin.php +++ b/app/code/Magento/NewRelicReporting/Plugin/CommandPlugin.php @@ -25,16 +25,24 @@ class CommandPlugin */ private $newRelicWrapper; + /** + * @var string[] + */ + private $skipCommands; + /** * @param Config $config * @param NewRelicWrapper $newRelicWrapper + * @param array $skipCommands */ public function __construct( Config $config, - NewRelicWrapper $newRelicWrapper + NewRelicWrapper $newRelicWrapper, + array $skipCommands = [] ) { $this->config = $config; $this->newRelicWrapper = $newRelicWrapper; + $this->skipCommands = $skipCommands; } /** @@ -46,10 +54,24 @@ public function __construct( */ public function beforeRun(Command $command, ...$args) { - $this->newRelicWrapper->setTransactionName( - sprintf('CLI %s', $command->getName()) - ); + if (!$this->isCommandSkipped($command)) { + $this->newRelicWrapper->setTransactionName( + sprintf('CLI %s', $command->getName()) + ); + } return $args; } + + /** + * Determines whether the Command is declared to be skipped + * + * @param Command $command + * @return bool + */ + private function isCommandSkipped(Command $command): bool + { + $commandName = $command->getName(); + return isset($this->skipCommands[$commandName]) && $this->skipCommands[$commandName] === true; + } } diff --git a/app/code/Magento/NewRelicReporting/Plugin/StatPlugin.php b/app/code/Magento/NewRelicReporting/Plugin/StatPlugin.php new file mode 100644 index 0000000000000..30dddfe11910a --- /dev/null +++ b/app/code/Magento/NewRelicReporting/Plugin/StatPlugin.php @@ -0,0 +1,105 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\NewRelicReporting\Plugin; + +use Magento\Framework\Profiler\Driver\Standard\Stat; +use Magento\NewRelicReporting\Model\Config; +use Magento\NewRelicReporting\Model\NewRelicWrapper; +use Psr\Log\LoggerInterface; + +/** + * Class StatPlugin handles single Cron Jobs transaction names + */ +class StatPlugin +{ + public const TIMER_NAME_CRON_PREFIX = 'job'; + + /** + * @var Config + */ + private $config; + + /** + * @var NewRelicWrapper + */ + private $newRelicWrapper; + + /** + * @var LoggerInterface + */ + private $logger; + + /** + * @param Config $config + * @param NewRelicWrapper $newRelicWrapper + * @param LoggerInterface $logger + */ + public function __construct( + Config $config, + NewRelicWrapper $newRelicWrapper, + LoggerInterface $logger + ) { + $this->config = $config; + $this->newRelicWrapper = $newRelicWrapper; + $this->logger = $logger; + } + + /** + * Before running original profiler, register NewRelic transaction + * + * @param Stat $schedule + * @param array $args + * @return array + * @see \Magento\Cron\Observer\ProcessCronQueueObserver::startProfiling + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function beforeStart(Stat $schedule, ...$args): array + { + $timerName = current($args); + + if ($this->isCronJob($timerName)) { + $this->newRelicWrapper->setTransactionName( + sprintf('Cron %s', $timerName) + ); + } + + return $args; + } + + /** + * Before stopping original profiler, close NewRelic transaction + * + * @param Stat $schedule + * @param array $args + * @return array + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function beforeStop(Stat $schedule, ...$args): array + { + $timerName = current($args); + + if ($this->isCronJob($timerName)) { + $this->newRelicWrapper->endTransaction(); + } + + return $args; + } + + /** + * Determines whether provided name is Cron Job + * + * @param string $timerName + * @return bool + */ + private function isCronJob(string $timerName): bool + { + return 0 === strpos($timerName, static::TIMER_NAME_CRON_PREFIX); + } +} diff --git a/app/code/Magento/NewRelicReporting/Test/Unit/Plugin/CommandPluginTest.php b/app/code/Magento/NewRelicReporting/Test/Unit/Plugin/CommandPluginTest.php new file mode 100644 index 0000000000000..f75997a6302bb --- /dev/null +++ b/app/code/Magento/NewRelicReporting/Test/Unit/Plugin/CommandPluginTest.php @@ -0,0 +1,105 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\NewRelicReporting\Test\Unit\Plugin; + +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\NewRelicReporting\Model\NewRelicWrapper; +use Magento\NewRelicReporting\Plugin\CommandPlugin; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; +use Symfony\Component\Console\Command\Command; + +class CommandPluginTest extends TestCase +{ + private const STUB_SKIPPED_COMMAND_NAME = 'skippedCommand'; + private const STUB_NON_SKIPPED_COMMAND_NAME = 'nonSkippedCommand'; + + /** + * @var ObjectManager + */ + private $objectManager; + + /** + * @var MockObject|NewRelicWrapper + */ + private $newRelicWrapperMock; + + /** + * ObjectManager and mocks necessary to run the tests + */ + protected function setUp() + { + $this->newRelicWrapperMock = $this->getMockBuilder(NewRelicWrapper::class) + ->disableOriginalConstructor() + ->setMethods(['setTransactionName']) + ->getMock(); + + $this->objectManager = new ObjectManager($this); + } + + /** + * When Command name is not in the list of skipped, handle New Relic transaction + */ + public function testNewRelicTransactionSetForNonSkippedCommand() + { + $nonSkippedCommand = $this->getCommandMock(self::STUB_NON_SKIPPED_COMMAND_NAME); + + $this->newRelicWrapperMock->expects($this->once()) + ->method('setTransactionName') + ->with(sprintf('CLI %s', self::STUB_NON_SKIPPED_COMMAND_NAME)); + + $commandPlugin = $this->getCommandPlugin([self::STUB_SKIPPED_COMMAND_NAME => true]); + $commandPlugin->beforeRun($nonSkippedCommand); + } + + /** + * When Command name is set to be skipped, do not let run New Relic transaction + */ + public function testNewRelicTransactionOmmitForSkippedCommand() + { + $skippedCommand = $this->getCommandMock(self::STUB_SKIPPED_COMMAND_NAME); + + $this->newRelicWrapperMock->expects($this->never()) + ->method('setTransactionName'); + + $commandPlugin = $this->getCommandPlugin([self::STUB_SKIPPED_COMMAND_NAME => true]); + $commandPlugin->beforeRun($skippedCommand); + } + + /** + * @param string $commandName + * @return Command|MockObject + */ + private function getCommandMock(string $commandName): Command + { + $commandMock = $this->getMockBuilder(Command::class) + ->disableOriginalConstructor() + ->setMethods(['getName']) + ->getMock(); + + $commandMock->method('getName') + ->willReturn($commandName); + + return $commandMock; + } + + /** + * @param string[] $skippedCommands + * @return CommandPlugin + */ + private function getCommandPlugin(array $skippedCommands): CommandPlugin + { + /** @var CommandPlugin $commandPlugin */ + $commandPlugin = $this->objectManager->getObject(CommandPlugin::class, [ + 'skipCommands' => $skippedCommands, + 'newRelicWrapper' => $this->newRelicWrapperMock + ]); + + return $commandPlugin; + } +} diff --git a/app/code/Magento/NewRelicReporting/Test/Unit/Plugin/StatPluginTest.php b/app/code/Magento/NewRelicReporting/Test/Unit/Plugin/StatPluginTest.php new file mode 100644 index 0000000000000..163f9a69992ed --- /dev/null +++ b/app/code/Magento/NewRelicReporting/Test/Unit/Plugin/StatPluginTest.php @@ -0,0 +1,97 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\NewRelicReporting\Test\Unit\Plugin; + +use Magento\Framework\Profiler\Driver\Standard\Stat; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\NewRelicReporting\Model\NewRelicWrapper; +use Magento\NewRelicReporting\Plugin\StatPlugin; +use PHPUnit\Framework\TestCase; +use PHPUnit_Framework_MockObject_MockObject as MockObject; + +class StatPluginTest extends TestCase +{ + private const STAT_NAME_NOT_CRON_JOB = 'NotCronJob'; + private const STAT_NAME_CRON_JOB = StatPlugin::TIMER_NAME_CRON_PREFIX . 'Name'; + + /** + * @var StatPlugin + */ + private $statPlugin; + + /** + * @var MockObject|NewRelicWrapper + */ + private $newRelicWrapperMock; + + /** + * @var MockObject|Stat + */ + private $statMock; + + /** + * Build class for testing + */ + public function setUp() + { + $objectManager = new ObjectManager($this); + + $this->statPlugin = $objectManager->getObject(StatPlugin::class, [ + 'newRelicWrapper' => $this->getNewRelicWrapperMock() + ]); + + $this->statMock = $this->getMockBuilder(Stat::class)->disableOriginalConstructor()->getMock(); + } + + /** + * Expects that NewRelic wrapper will never be called + */ + public function testNewRelicTransactionNameIsNotSetIfNotCronjobPattern() + { + $this->newRelicWrapperMock + ->expects($this->never()) + ->method('setTransactionName'); + $this->newRelicWrapperMock + ->expects($this->never()) + ->method('endTransaction'); + + $this->statPlugin->beforeStart($this->statMock, self::STAT_NAME_NOT_CRON_JOB); + $this->statPlugin->beforeStop($this->statMock, self::STAT_NAME_NOT_CRON_JOB); + } + + /** + * NewRelic Wrapper is called when Task name fits Cron Job pattern + */ + public function testNewRelicTransactionNameIsSetForCronjobNamePattern() + { + $this->newRelicWrapperMock + ->expects($this->once()) + ->method('setTransactionName'); + $this->newRelicWrapperMock + ->expects($this->once()) + ->method('endTransaction'); + + $this->statPlugin->beforeStart($this->statMock, self::STAT_NAME_CRON_JOB); + $this->statPlugin->beforeStop($this->statMock, self::STAT_NAME_CRON_JOB); + } + + /** + * @return NewRelicWrapper + */ + private function getNewRelicWrapperMock(): NewRelicWrapper + { + if (null === $this->newRelicWrapperMock) { + $this->newRelicWrapperMock = $this->getMockBuilder(NewRelicWrapper::class) + ->disableOriginalConstructor() + ->setMethods(['setTransactionName', 'endTransaction']) + ->getMock(); + } + + return $this->newRelicWrapperMock; + } +} diff --git a/app/code/Magento/NewRelicReporting/etc/di.xml b/app/code/Magento/NewRelicReporting/etc/di.xml index 15516f6df89be..cd8b0f46087a4 100644 --- a/app/code/Magento/NewRelicReporting/etc/di.xml +++ b/app/code/Magento/NewRelicReporting/etc/di.xml @@ -41,6 +41,16 @@ </arguments> </type> <type name="Symfony\Component\Console\Command\Command"> - <plugin name="newrelic-describe-commands" type="Magento\NewRelicReporting\Plugin\CommandPlugin"/> + <plugin name="newrelic-describe-commands" type="Magento\NewRelicReporting\Plugin\CommandPlugin"/> + </type> + <type name="Magento\Framework\Profiler\Driver\Standard\Stat"> + <plugin name="newrelic-describe-cronjobs" type="Magento\NewRelicReporting\Plugin\StatPlugin"/> + </type> + <type name="Magento\NewRelicReporting\Plugin\CommandPlugin"> + <arguments> + <argument name="skipCommands" xsi:type="array"> + <item xsi:type="boolean" name="cron:run">true</item> + </argument> + </arguments> </type> </config> From 647880beb9e4080b0c2149a6ecc82437fed08ed0 Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Fri, 13 Dec 2019 13:19:13 +0200 Subject: [PATCH 0378/1143] MC-25176: Storefront quick search leads to exception --- .../Product/FieldProvider/StaticField.php | 13 +- .../Product/FieldProvider/StaticFieldTest.php | 215 ++++++++++-------- app/code/Magento/Elasticsearch/etc/di.xml | 7 + .../Controller/QuickSearchTest.php | 62 +++++ 4 files changed, 199 insertions(+), 98 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Elasticsearch6/Controller/QuickSearchTest.php diff --git a/app/code/Magento/Elasticsearch/Model/Adapter/FieldMapper/Product/FieldProvider/StaticField.php b/app/code/Magento/Elasticsearch/Model/Adapter/FieldMapper/Product/FieldProvider/StaticField.php index 348a1c708a78c..7a5d6fcdcc1b1 100644 --- a/app/code/Magento/Elasticsearch/Model/Adapter/FieldMapper/Product/FieldProvider/StaticField.php +++ b/app/code/Magento/Elasticsearch/Model/Adapter/FieldMapper/Product/FieldProvider/StaticField.php @@ -62,6 +62,11 @@ class StaticField implements FieldProviderInterface */ private $fieldNameResolver; + /** + * @var array + */ + private $excludedAttributes; + /** * @param Config $eavConfig * @param FieldTypeConverterInterface $fieldTypeConverter @@ -70,6 +75,7 @@ class StaticField implements FieldProviderInterface * @param FieldIndexResolver $fieldIndexResolver * @param AttributeProvider $attributeAdapterProvider * @param FieldName\ResolverInterface|null $fieldNameResolver + * @param array $excludedAttributes */ public function __construct( Config $eavConfig, @@ -78,7 +84,8 @@ public function __construct( FieldTypeResolver $fieldTypeResolver, FieldIndexResolver $fieldIndexResolver, AttributeProvider $attributeAdapterProvider, - FieldName\ResolverInterface $fieldNameResolver = null + FieldName\ResolverInterface $fieldNameResolver = null, + array $excludedAttributes = [] ) { $this->eavConfig = $eavConfig; $this->fieldTypeConverter = $fieldTypeConverter; @@ -88,6 +95,7 @@ public function __construct( $this->attributeAdapterProvider = $attributeAdapterProvider; $this->fieldNameResolver = $fieldNameResolver ?: ObjectManager::getInstance() ->get(FieldName\ResolverInterface::class); + $this->excludedAttributes = $excludedAttributes; } /** @@ -103,6 +111,9 @@ public function getFields(array $context = []): array $allAttributes = []; foreach ($attributes as $attribute) { + if (in_array($attribute->getAttributeCode(), $this->excludedAttributes, true)) { + continue; + } $attributeAdapter = $this->attributeAdapterProvider->getByAttributeCode($attribute->getAttributeCode()); $fieldName = $this->fieldNameResolver->getFieldName($attributeAdapter); diff --git a/app/code/Magento/Elasticsearch/Test/Unit/Model/Adapter/FieldMapper/Product/FieldProvider/StaticFieldTest.php b/app/code/Magento/Elasticsearch/Test/Unit/Model/Adapter/FieldMapper/Product/FieldProvider/StaticFieldTest.php index c08a4298b42d2..a603d6ab47824 100644 --- a/app/code/Magento/Elasticsearch/Test/Unit/Model/Adapter/FieldMapper/Product/FieldProvider/StaticFieldTest.php +++ b/app/code/Magento/Elasticsearch/Test/Unit/Model/Adapter/FieldMapper/Product/FieldProvider/StaticFieldTest.php @@ -8,6 +8,7 @@ namespace Magento\Elasticsearch\Test\Unit\Model\Adapter\FieldMapper\Product\FieldProvider; use Magento\Eav\Model\Entity\Attribute\AbstractAttribute; +use Magento\Elasticsearch\Model\Adapter\FieldMapper\Product\FieldProvider\StaticField; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; use Magento\Eav\Model\Config; use Magento\Elasticsearch\Model\Adapter\FieldMapper\Product\AttributeProvider; @@ -22,56 +23,56 @@ as FieldIndexResolver; use Magento\Elasticsearch\Model\Adapter\FieldMapper\Product\FieldProvider\FieldName\ResolverInterface as FieldNameResolver; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; /** - * @SuppressWarnings(PHPMD) + * Unit tests for \Magento\Elasticsearch\Model\Adapter\FieldMapper\Product\FieldProvider\StaticField class. */ -class StaticFieldTest extends \PHPUnit\Framework\TestCase +class StaticFieldTest extends TestCase { /** - * @var \Magento\Elasticsearch\Model\Adapter\FieldMapper\Product\FieldProvider\StaticField + * @var StaticField */ private $provider; /** - * @var \Magento\Eav\Model\Config|\PHPUnit_Framework_MockObject_MockObject + * @var Config|MockObject */ private $eavConfig; /** - * @var FieldTypeConverterInterface + * @var FieldTypeConverterInterface|MockObject */ private $fieldTypeConverter; /** - * @var IndexTypeConverterInterface + * @var IndexTypeConverterInterface|MockObject */ private $indexTypeConverter; /** - * @var AttributeProvider + * @var AttributeProvider|MockObject */ private $attributeAdapterProvider; /** - * @var FieldIndexResolver + * @var FieldIndexResolver|MockObject */ private $fieldIndexResolver; /** - * @var FieldTypeResolver + * @var FieldTypeResolver|MockObject */ private $fieldTypeResolver; /** - * @var FieldNameResolver + * @var FieldNameResolver|MockObject */ private $fieldNameResolver; /** - * Set up test environment - * - * @return void + * @inheritdoc */ protected function setUp() { @@ -105,7 +106,7 @@ protected function setUp() $objectManager = new ObjectManagerHelper($this); $this->provider = $objectManager->getObject( - \Magento\Elasticsearch\Model\Adapter\FieldMapper\Product\FieldProvider\StaticField::class, + StaticField::class, [ 'eavConfig' => $this->eavConfig, 'fieldTypeConverter' => $this->fieldTypeConverter, @@ -114,37 +115,42 @@ protected function setUp() 'fieldIndexResolver' => $this->fieldIndexResolver, 'fieldTypeResolver' => $this->fieldTypeResolver, 'fieldNameResolver' => $this->fieldNameResolver, + 'excludedAttributes' => ['price'], ] ); } /** - * @dataProvider attributeProvider * @param string $attributeCode * @param string $inputType - * @param $indexType - * @param $isComplexType - * @param $complexType - * @param $isSortable - * @param $fieldName - * @param $compositeFieldName - * @param $sortFieldName + * @param string|bool $indexType + * @param bool $isComplexType + * @param string $complexType + * @param bool $isSortable + * @param bool $isTextType + * @param string $fieldName + * @param string $compositeFieldName + * @param string $sortFieldName * @param array $expected * @return void + * @dataProvider attributeProvider + * @SuppressWarnings(PHPMD.CyclomaticComplexity) + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function testGetAllAttributesTypes( - $attributeCode, - $inputType, + string $attributeCode, + string $inputType, $indexType, - $isComplexType, - $complexType, - $isSortable, - $isTextType, - $fieldName, - $compositeFieldName, - $sortFieldName, - $expected - ) { + bool $isComplexType, + string $complexType, + bool $isSortable, + bool $isTextType, + string $fieldName, + string $compositeFieldName, + string $sortFieldName, + array $expected + ): void { $this->fieldTypeResolver->expects($this->any()) ->method('getFieldType') ->willReturn($inputType); @@ -154,32 +160,28 @@ public function testGetAllAttributesTypes( $this->indexTypeConverter->expects($this->any()) ->method('convert') ->with($this->anything()) - ->will( - $this->returnCallback( - function ($type) { - if ($type === 'no_index') { - return 'no'; - } elseif ($type === 'no_analyze') { - return 'not_analyzed'; - } + ->willReturnCallback( + function ($type) { + if ($type === 'no_index') { + return 'no'; + } elseif ($type === 'no_analyze') { + return 'not_analyzed'; } - ) + } ); $this->fieldNameResolver->expects($this->any()) ->method('getFieldName') ->with($this->anything()) - ->will( - $this->returnCallback( - function ($attributeMock, $context) use ($fieldName, $compositeFieldName, $sortFieldName) { - if (empty($context)) { - return $fieldName; - } elseif ($context['type'] === 'sort') { - return $sortFieldName; - } elseif ($context['type'] === 'text') { - return $compositeFieldName; - } + ->willReturnCallback( + function ($attributeMock, $context) use ($fieldName, $compositeFieldName, $sortFieldName) { + if (empty($context)) { + return $fieldName; + } elseif ($context['type'] === 'sort') { + return $sortFieldName; + } elseif ($context['type'] === 'text') { + return $compositeFieldName; } - ) + } ); $productAttributeMock = $this->getMockBuilder(AbstractAttribute::class) @@ -215,23 +217,21 @@ function ($attributeMock, $context) use ($fieldName, $compositeFieldName, $sortF $this->fieldTypeConverter->expects($this->any()) ->method('convert') ->with($this->anything()) - ->will( - $this->returnCallback( - function ($type) use ($complexType) { - static $callCount = []; - $callCount[$type] = !isset($callCount[$type]) ? 1 : ++$callCount[$type]; + ->willReturnCallback( + function ($type) use ($complexType) { + static $callCount = []; + $callCount[$type] = !isset($callCount[$type]) ? 1 : ++$callCount[$type]; - if ($type === 'string') { - return 'string'; - } elseif ($type === 'float') { - return 'float'; - } elseif ($type === 'keyword') { - return 'string'; - } else { - return $complexType; - } + if ($type === 'string') { + return 'string'; + } elseif ($type === 'float') { + return 'float'; + } elseif ($type === 'keyword') { + return 'string'; + } else { + return $complexType; } - ) + } ); $this->assertEquals( @@ -242,8 +242,9 @@ function ($type) use ($complexType) { /** * @return array + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - public function attributeProvider() + public function attributeProvider(): array { return [ [ @@ -264,25 +265,25 @@ public function attributeProvider() 'fields' => [ 'keyword' => [ 'type' => 'string', - 'index' => 'not_analyzed' - ] - ] + 'index' => 'not_analyzed', + ], + ], ], 'category_ids_value' => [ - 'type' => 'string' + 'type' => 'string', ], 'store_id' => [ 'type' => 'string', - 'index' => 'no' - ] - ] + 'index' => 'no', + ], + ], ], [ 'attr_code', 'text', 'no', false, - null, + 'text', false, true, 'attr_code', @@ -295,22 +296,22 @@ public function attributeProvider() 'fields' => [ 'keyword' => [ 'type' => 'string', - 'index' => 'not_analyzed' - ] - ] + 'index' => 'not_analyzed', + ], + ], ], 'store_id' => [ 'type' => 'string', - 'index' => 'no' - ] + 'index' => 'no', + ], ], ], [ 'attr_code', 'text', - null, false, - null, + false, + 'text', false, false, 'attr_code', @@ -318,20 +319,21 @@ public function attributeProvider() '', [ 'attr_code' => [ - 'type' => 'text' + 'type' => 'text', + 'index' => false, ], 'store_id' => [ 'type' => 'string', - 'index' => 'no' - ] - ] + 'index' => 'no', + ], + ], ], [ 'attr_code', 'text', - null, false, - null, + false, + 'text', true, false, 'attr_code', @@ -340,19 +342,38 @@ public function attributeProvider() [ 'attr_code' => [ 'type' => 'text', + 'index' => false, 'fields' => [ 'sort_attr_code' => [ 'type' => 'string', - 'index' => 'not_analyzed' - ] - ] + 'index' => 'not_analyzed', + ], + ], ], 'store_id' => [ 'type' => 'string', - 'index' => 'no' - ] - ] - ] + 'index' => 'no', + ], + ], + ], + [ + 'price', + 'text', + false, + false, + 'text', + false, + false, + 'price', + '', + '', + [ + 'store_id' => [ + 'type' => 'string', + 'index' => 'no', + ], + ], + ], ]; } } diff --git a/app/code/Magento/Elasticsearch/etc/di.xml b/app/code/Magento/Elasticsearch/etc/di.xml index f42d957276d76..87cb04632ed6f 100644 --- a/app/code/Magento/Elasticsearch/etc/di.xml +++ b/app/code/Magento/Elasticsearch/etc/di.xml @@ -558,4 +558,11 @@ </argument> </arguments> </type> + <type name="Magento\Elasticsearch\Model\Adapter\FieldMapper\Product\FieldProvider\StaticField"> + <arguments> + <argument name="excludedAttributes" xsi:type="array"> + <item name="price" xsi:type="string">price</item> + </argument> + </arguments> + </type> </config> diff --git a/dev/tests/integration/testsuite/Magento/Elasticsearch6/Controller/QuickSearchTest.php b/dev/tests/integration/testsuite/Magento/Elasticsearch6/Controller/QuickSearchTest.php new file mode 100644 index 0000000000000..637d3d1a9d252 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Elasticsearch6/Controller/QuickSearchTest.php @@ -0,0 +1,62 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Elasticsearch6\Controller; + +use Magento\Store\Model\StoreManagerInterface; +use Magento\TestFramework\TestCase\AbstractController; + +/** + * Tests quick search on Storefront. + */ +class QuickSearchTest extends AbstractController +{ + /** + * @var StoreManagerInterface + */ + private $storeManager; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + $this->storeManager = $this->_objectManager->get(StoreManagerInterface::class); + } + + /** + * Tests quick search with "Price Navigation Step Calculation" sets to "Automatic (equalize product counts)". + * + * @magentoAppArea frontend + * @magentoDbIsolation disabled + * @magentoConfigFixture fixturestore_store catalog/layered_navigation/price_range_calculation improved + * @magentoConfigFixture fixturestore_store catalog/layered_navigation/one_price_interval 1 + * @magentoConfigFixture fixturestore_store catalog/layered_navigation/interval_division_limit 1 + * @magentoConfigFixture default/catalog/search/engine elasticsearch6 + * @magentoConfigFixture default_store catalog/search/elasticsearch6_index_prefix storefront_quick_search + * @magentoConfigFixture fixturestore_store catalog/search/elasticsearch6_index_prefix storefront_quick_search + * @magentoDataFixture Magento/Catalog/_files/products_for_search.php + * @magentoDataFixture Magento/Store/_files/core_fixturestore.php + * @magentoDataFixture Magento/CatalogSearch/_files/full_reindex.php + */ + public function testQuickSearchWithImprovedPriceRangeCalculation() + { + $secondStore = $this->storeManager->getStore('fixturestore'); + $this->storeManager->setCurrentStore($secondStore); + + try { + $this->dispatch('/catalogsearch/result/?q=search+product'); + $responseBody = $this->getResponse()->getBody(); + } finally { + $defaultStore = $this->storeManager->getStore('default'); + $this->storeManager->setCurrentStore($defaultStore); + } + + $this->assertContains('search product 1', $responseBody); + } +} From 21d569159022392d17c3e224cb79216b78ea2fda Mon Sep 17 00:00:00 2001 From: Mastiuhin Olexandr <mastiuhin.olexandr@transoftgroup.com> Date: Fri, 13 Dec 2019 13:40:09 +0200 Subject: [PATCH 0379/1143] MC-29745: Bundle child product with qty increments error --- .../CatalogInventory/Model/Quote/Item/QuantityValidator.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php index 502d9532e8a05..e67568b80898e 100644 --- a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php +++ b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php @@ -222,9 +222,11 @@ private function checkOptionsQtyIncrements(Item $quoteItem, array $options): voi { $removeErrors = true; foreach ($options as $option) { + $optionValue = $option->getValue(); + $optionQty = $quoteItem->getData('qty') * $optionValue; $result = $this->stockState->checkQtyIncrements( $option->getProduct()->getId(), - $quoteItem->getData('qty'), + $optionQty, $option->getProduct()->getStore()->getWebsiteId() ); if ($result->getHasError()) { From 50ff99cf2095a5048bafdbb151c01e3a56fb6c30 Mon Sep 17 00:00:00 2001 From: Andrii Beziazychnyi <a.beziazychnyi@atwix.com> Date: Fri, 13 Dec 2019 14:35:21 +0200 Subject: [PATCH 0380/1143] Refactor: Remove deprecated methods - removed deprecated method "loadConfigFile" from "Magento\Framework\App\DeploymentConfig\Reader" --- .../Framework/App/DeploymentConfig/Reader.php | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/lib/internal/Magento/Framework/App/DeploymentConfig/Reader.php b/lib/internal/Magento/Framework/App/DeploymentConfig/Reader.php index a53ea9423d449..df9dee7459464 100644 --- a/lib/internal/Magento/Framework/App/DeploymentConfig/Reader.php +++ b/lib/internal/Magento/Framework/App/DeploymentConfig/Reader.php @@ -124,21 +124,4 @@ public function load($fileKey = null) } return $result ?: []; } - - /** - * Loads the configuration file. - * - * @param string $fileKey The file key - * @param string $pathConfig The path config - * @param bool $ignoreInitialConfigFiles Whether ignore custom pools - * @return array - * @throws FileSystemException - * @throws RuntimeException - * @deprecated 100.2.0 Magento does not support custom config file pools since 2.2.0 version - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function loadConfigFile($fileKey, $pathConfig, $ignoreInitialConfigFiles = false) - { - return $this->load($fileKey); - } } From ed5dc878f6f16f05f3b3001c6fa8d10360d6f842 Mon Sep 17 00:00:00 2001 From: Yaroslav Rogoza <enarc@atwix.com> Date: Fri, 13 Dec 2019 15:42:17 +0100 Subject: [PATCH 0381/1143] Fixed keyboard arrow keys behavior for number fields in AdobeStock grid --- lib/web/jquery/jstree/jquery.hotkeys.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/web/jquery/jstree/jquery.hotkeys.js b/lib/web/jquery/jstree/jquery.hotkeys.js index 207c65bb06df6..c36582a503f43 100644 --- a/lib/web/jquery/jstree/jquery.hotkeys.js +++ b/lib/web/jquery/jstree/jquery.hotkeys.js @@ -53,7 +53,8 @@ * longer maintained by its author however we require content editable to behave as expected. */ if ( this !== event.target && (/textarea|select/i.test( event.target.nodeName ) || - event.target.type === "text" || jQuery(event.target).attr('contenteditable')) ) { + event.target.type === "text" || event.target.type === "number" || + jQuery(event.target).attr('contenteditable')) ) { return; } From ab6cabd682ae18a48aaf1429232047d90e4e881c Mon Sep 17 00:00:00 2001 From: Lukasz Lewandowski <llewandowski@gpmd.co.uk> Date: Fri, 13 Dec 2019 08:44:14 -0600 Subject: [PATCH 0382/1143] Add tests for cached getVersion and update class description --- .../Magento/Framework/App/ProductMetadata.php | 4 +--- .../App/Test/Unit/ProductMetadataTest.php | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/lib/internal/Magento/Framework/App/ProductMetadata.php b/lib/internal/Magento/Framework/App/ProductMetadata.php index 8f989351743d2..55e98bb085d41 100644 --- a/lib/internal/Magento/Framework/App/ProductMetadata.php +++ b/lib/internal/Magento/Framework/App/ProductMetadata.php @@ -13,9 +13,7 @@ use Magento\Framework\Composer\ComposerInformation; /** - * Class ProductMetadata - * - * @package Magento\Framework\App + * Magento application product metadata */ class ProductMetadata implements ProductMetadataInterface { diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ProductMetadataTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ProductMetadataTest.php index 8e1acc89437e2..bc1abb169b4f8 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/ProductMetadataTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/ProductMetadataTest.php @@ -5,6 +5,7 @@ */ namespace Magento\Framework\App\Test\Unit; +use Magento\Framework\App\CacheInterface; use Magento\Framework\App\ProductMetadata; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; @@ -20,16 +21,27 @@ class ProductMetadataTest extends \PHPUnit\Framework\TestCase */ private $composerInformationMock; + /** + * @var CacheInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $cacheMock; + protected function setUp() { $this->composerInformationMock = $this->getMockBuilder(\Magento\Framework\Composer\ComposerInformation::class) ->disableOriginalConstructor()->getMock(); + $this->cacheMock = $this->getMockBuilder(CacheInterface::class)->getMock(); + $objectManager = new ObjectManager($this); $this->productMetadata = $objectManager->getObject(ProductMetadata::class); $reflectionProperty = new \ReflectionProperty($this->productMetadata, 'composerInformation'); $reflectionProperty->setAccessible(true); $reflectionProperty->setValue($this->productMetadata, $this->composerInformationMock); + + $reflectionProperty = new \ReflectionProperty($this->productMetadata, 'cache'); + $reflectionProperty->setAccessible(true); + $reflectionProperty->setValue($this->productMetadata, $this->cacheMock); } /** @@ -40,11 +52,21 @@ protected function setUp() public function testGetVersion($packageList, $expectedVersion) { $this->composerInformationMock->expects($this->any())->method('getSystemPackages')->willReturn($packageList); + $this->cacheMock->expects($this->once())->method('save')->with($expectedVersion); $productVersion = $this->productMetadata->getVersion(); $this->assertNotEmpty($productVersion, 'Empty product version'); $this->assertEquals($expectedVersion, $productVersion); } + public function testGetVersionCached() + { + $expectedVersion = '1.2.3'; + $this->composerInformationMock->expects($this->never())->method('getSystemPackages'); + $this->cacheMock->expects($this->once())->method('load')->willReturn($expectedVersion); + $productVersion = $this->productMetadata->getVersion(); + $this->assertEquals($expectedVersion, $productVersion); + } + /** * @return array */ From 16d0cfc692b497e397df08ebe0ce0487827e46ea Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Fri, 13 Dec 2019 17:14:17 +0200 Subject: [PATCH 0383/1143] MC-4242: Newsletter subscriptions per website --- app/code/Magento/Newsletter/Model/Subscriber.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Newsletter/Model/Subscriber.php b/app/code/Magento/Newsletter/Model/Subscriber.php index f33b9929435c3..5c573f47aa0bf 100644 --- a/app/code/Magento/Newsletter/Model/Subscriber.php +++ b/app/code/Magento/Newsletter/Model/Subscriber.php @@ -628,7 +628,7 @@ public function loadByCustomerId($customerId) $customer = $this->customerRepository->getById($customerId); $websiteId = (int)$this->_storeManager->getStore()->getWebsiteId(); $this->loadByCustomer((int)$customerId, $websiteId); - if ($customer->getId() && !$this->getCustomerId()) { + if ($this->getId() && $customer->getId() && !$this->getCustomerId()) { $this->setCustomerId($customer->getId()); $this->setSubscriberConfirmCode($this->randomSequence()); $this->save(); From f1f7dadd2100a8d6d676510742a38f3672be6363 Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Fri, 13 Dec 2019 17:23:40 +0200 Subject: [PATCH 0384/1143] MC-4242: Newsletter subscriptions per website --- .../CustomerGraphQl/Model/Resolver/IsSubscribed.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/IsSubscribed.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/IsSubscribed.php index 4e49891b5870a..3e69723d4e771 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/IsSubscribed.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/IsSubscribed.php @@ -7,6 +7,7 @@ namespace Magento\CustomerGraphQl\Model\Resolver; +use Magento\Customer\Api\Data\CustomerInterface; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; use Magento\Framework\GraphQl\Config\Element\Field; @@ -45,10 +46,12 @@ public function resolve( if (!isset($value['model'])) { throw new LocalizedException(__('"model" value should be specified')); } - /** @var Customer $customer */ + /** @var CustomerInterface $customer */ $customer = $value['model']; + $customerId = (int)$customer->getId(); + $websiteId = (int)$customer->getWebsiteId(); + $status = $this->subscriberFactory->create()->loadByCustomer($customerId, $websiteId)->isSubscribed(); - $status = $this->subscriberFactory->create()->loadByCustomerId((int)$customer->getId())->isSubscribed(); return (bool)$status; } } From 0b7c34ef79307da52e088b6d3652663e9cd2c3a1 Mon Sep 17 00:00:00 2001 From: Lukasz Lewandowski <llewandowski@gpmd.co.uk> Date: Fri, 13 Dec 2019 09:26:43 -0600 Subject: [PATCH 0385/1143] Update tests --- .../Framework/App/Test/Unit/ProductMetadataTest.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ProductMetadataTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ProductMetadataTest.php index bc1abb169b4f8..c504c5f480669 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/ProductMetadataTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/ProductMetadataTest.php @@ -34,14 +34,10 @@ protected function setUp() $this->cacheMock = $this->getMockBuilder(CacheInterface::class)->getMock(); $objectManager = new ObjectManager($this); - $this->productMetadata = $objectManager->getObject(ProductMetadata::class); + $this->productMetadata = $objectManager->getObject(ProductMetadata::class, ['cache' => $this->cacheMock]); $reflectionProperty = new \ReflectionProperty($this->productMetadata, 'composerInformation'); $reflectionProperty->setAccessible(true); $reflectionProperty->setValue($this->productMetadata, $this->composerInformationMock); - - $reflectionProperty = new \ReflectionProperty($this->productMetadata, 'cache'); - $reflectionProperty->setAccessible(true); - $reflectionProperty->setValue($this->productMetadata, $this->cacheMock); } /** @@ -63,6 +59,7 @@ public function testGetVersionCached() $expectedVersion = '1.2.3'; $this->composerInformationMock->expects($this->never())->method('getSystemPackages'); $this->cacheMock->expects($this->once())->method('load')->willReturn($expectedVersion); + $this->cacheMock->expects($this->never())->method('save'); $productVersion = $this->productMetadata->getVersion(); $this->assertEquals($expectedVersion, $productVersion); } From 284e3edc3b97fb05c9f01b3e9932a542551fec87 Mon Sep 17 00:00:00 2001 From: Grzegorz Bogusz <grzegorz.bogusz@creativestyle.pl> Date: Fri, 13 Dec 2019 19:23:18 +0100 Subject: [PATCH 0386/1143] [issue-25974] Fix for "Amount of characters on a 'Area' Customizable Option counted differently on backend/frontend" --- .../Model/Product/Option/Type/Text.php | 12 ++ .../Model/Product/Option/Type/TextTest.php | 104 ++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/TextTest.php diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php b/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php index 9ffe75e513bce..0585e77734e3e 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php @@ -68,6 +68,7 @@ public function validateUserValue($values) // Check maximal length limit $maxCharacters = $option->getMaxCharacters(); + $value = $this->normalizeNewLineSymbols($value); if ($maxCharacters > 0 && $this->string->strlen($value) > $maxCharacters) { $this->setIsValid(false); throw new LocalizedException(__('The text is too long. Shorten the text and try again.')); @@ -101,4 +102,15 @@ public function getFormattedOptionValue($value) { return $this->_escaper->escapeHtml($value); } + + /** + * Normalize newline symbols + * + * @param string $value + * @return string + */ + private function normalizeNewLineSymbols($value) + { + return str_replace(["\r\n", "\n\r", "\r"], ["\n", "\n", "\n"], $value); + } } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/TextTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/TextTest.php new file mode 100644 index 0000000000000..29e7f327eeb9e --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/TextTest.php @@ -0,0 +1,104 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Catalog\Model\Product\Option\Type; + +use Magento\Catalog\Model\Product\Option; + +/** + * Test for customizable product option with "Text" type + */ +class TextTest extends \PHPUnit\Framework\TestCase +{ + /** + * @var Text + */ + protected $model; + + /** + * @var \Magento\Framework\ObjectManagerInterface + */ + private $objectManager; + + /** + * {@inheritDoc} + */ + protected function setUp() + { + $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->model = $this->objectManager->create( + Text::class + ); + } + + /** + * Check if newline symbols are normalized in option value + * + * @dataProvider optionValueDataProvider + * @param array $productOptionData + * @param string $optionValue + * @param string $expectedOptionValue + */ + public function testNormalizeNewlineSymbols( + array $productOptionData, + string $optionValue, + string $expectedOptionValue + ) { + $productOption = $this->objectManager->create( + Option::class, + ['data' => $productOptionData] + ); + + $this->model->setOption($productOption); + $this->model->setUserValue($optionValue); + $this->model->validateUserValue([]); + + $this->assertSame($expectedOptionValue, $this->model->getUserValue()); + } + + /** + * Data provider for testNormalizeNewlineSymbols + * + * @return array + */ + public function optionValueDataProvider() + { + return [ + [ + // $productOptionData + ['id' => 11, 'type' => 'area'], + // $optionValue + 'string string', + // $expectedOptionValue + 'string string' + ], + [ + // $productOptionData + ['id' => 11, 'type' => 'area'], + // $optionValue + "string \r\n string", + // $expectedOptionValue + "string \n string" + ], + [ + // $productOptionData + ['id' => 11, 'type' => 'area'], + // $optionValue + "string \n\r string", + // $expectedOptionValue + "string \n string" + ], + [ + // $productOptionData + ['id' => 11, 'type' => 'area'], + // $optionValue + "string \r string", + // $expectedOptionValue + "string \n string" + ] + ]; + } +} From f59c1ca61e034a7973e0ac08ab765cbe4060ed84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Tylek?= <pawel.tylek@creativestyle.pl> Date: Fri, 13 Dec 2019 19:24:10 +0100 Subject: [PATCH 0387/1143] MAGETWO-95866 Add horizontal scroll if elements extend menu's width --- .../Magento_Backend/web/css/source/module/_menu.less | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/_menu.less b/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/_menu.less index d0b17b3439d66..4332ac93ffcd2 100644 --- a/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/_menu.less +++ b/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/_menu.less @@ -17,7 +17,7 @@ @menu-logo__padding-bottom: 1.7rem; @menu-logo__outer-size: @menu-logo__padding-top + @menu-logo-img__height + @menu-logo__padding-bottom; -@menu-logo__padding-top: 1.7rem; +@menu-logo__padding-top: 1.7rem; @menu-logo-img__height: 4.1rem; @menu-logo-img__width: 3.5rem; @@ -37,6 +37,7 @@ @submenu__padding-horizontal: 1.5rem; @submenu__padding-vertical: 2rem; @submenu__z-index: @menu__z-index - 2; +@submenu__height: 720px; @submenu-column__width: 23.8rem; @submenu-column__width__l: 19.8rem; @submenu-title__color: @color-white; @@ -252,7 +253,6 @@ background-color: @submenu__background-color; box-shadow: 0 0 3px @color-black; left: 100%; // align all submenus with one Y axis line - min-height: ~'calc(@{menu-logo__outer-size} + 2rem + 100%)'; padding: @submenu__padding-vertical 0 0; position: absolute; top: 0; @@ -266,6 +266,13 @@ .ie11 & { height: 100%; } + + > ul[role="menu"] { + max-width: ~'calc(100vw - @{menu__width})'; + min-height: @submenu__height; + overflow-y: hidden; + overflow-x: auto; + } } &._show { From 7a2bc8fe52e570cfec0201fa36c7118eaf26f6a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Tylek?= <pawel.tylek@creativestyle.pl> Date: Fri, 13 Dec 2019 20:19:48 +0100 Subject: [PATCH 0388/1143] MAGETWO-95866 Fix tests --- .../Magento_Backend/web/css/source/module/_menu.less | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/_menu.less b/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/_menu.less index 4332ac93ffcd2..c84a54efd5028 100644 --- a/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/_menu.less +++ b/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/_menu.less @@ -267,11 +267,11 @@ height: 100%; } - > ul[role="menu"] { - max-width: ~'calc(100vw - @{menu__width})'; - min-height: @submenu__height; - overflow-y: hidden; + > ul[role='menu'] { overflow-x: auto; + overflow-y: hidden; + max-width: ~'calc(100vw - @{menu__width})'; + min-height: @submenu__height; } } From 3c0b60a33e1bda64eb694ac278f11d2f750a4eb0 Mon Sep 17 00:00:00 2001 From: Krzysztof Daniel <krzysztof.daniel@creativestyle.pl> Date: Fri, 13 Dec 2019 23:26:51 +0100 Subject: [PATCH 0389/1143] Fixes phpcs errors and warnings for Magento\Framework\View\Element I was working with those classes and spotted a few warnings and errors that prevent from smooth pull requests. Here are most fixes. --- .../Framework/View/Element/ExceptionHandlerBlockFactory.php | 1 + lib/internal/Magento/Framework/View/Element/FormKey.php | 2 ++ lib/internal/Magento/Framework/View/Element/Js/Components.php | 2 ++ lib/internal/Magento/Framework/View/Element/Js/Cookie.php | 4 ++++ lib/internal/Magento/Framework/View/Element/RendererList.php | 2 ++ lib/internal/Magento/Framework/View/Element/Template.php | 2 ++ .../Magento/Framework/View/Element/Template/File/Resolver.php | 1 + .../Magento/Framework/View/Element/UiComponentInterface.php | 2 ++ 8 files changed, 16 insertions(+) diff --git a/lib/internal/Magento/Framework/View/Element/ExceptionHandlerBlockFactory.php b/lib/internal/Magento/Framework/View/Element/ExceptionHandlerBlockFactory.php index 83f7dda94328f..b1c74777fb102 100644 --- a/lib/internal/Magento/Framework/View/Element/ExceptionHandlerBlockFactory.php +++ b/lib/internal/Magento/Framework/View/Element/ExceptionHandlerBlockFactory.php @@ -7,6 +7,7 @@ /** * Class ExceptionHandlerBlockFactory + * * @package Magento\Framework\View\Element */ class ExceptionHandlerBlockFactory diff --git a/lib/internal/Magento/Framework/View/Element/FormKey.php b/lib/internal/Magento/Framework/View/Element/FormKey.php index 072ba42b34f1d..e6ecd20435ce8 100644 --- a/lib/internal/Magento/Framework/View/Element/FormKey.php +++ b/lib/internal/Magento/Framework/View/Element/FormKey.php @@ -10,6 +10,8 @@ namespace Magento\Framework\View\Element; /** + * Element with FormKey + * * @api */ class FormKey extends \Magento\Framework\View\Element\AbstractBlock diff --git a/lib/internal/Magento/Framework/View/Element/Js/Components.php b/lib/internal/Magento/Framework/View/Element/Js/Components.php index 3f9be417d62be..8e33ca5581960 100644 --- a/lib/internal/Magento/Framework/View/Element/Js/Components.php +++ b/lib/internal/Magento/Framework/View/Element/Js/Components.php @@ -9,6 +9,8 @@ use Magento\Framework\View\Element\Template; /** + * Block for Components + * * @api */ class Components extends Template diff --git a/lib/internal/Magento/Framework/View/Element/Js/Cookie.php b/lib/internal/Magento/Framework/View/Element/Js/Cookie.php index c44bad026ecac..b37a9387c07f6 100644 --- a/lib/internal/Magento/Framework/View/Element/Js/Cookie.php +++ b/lib/internal/Magento/Framework/View/Element/Js/Cookie.php @@ -10,6 +10,8 @@ use Magento\Framework\View\Element\Template\Context; /** + * Block passes configuration for cookies set by JS + * * @api */ class Cookie extends Template @@ -75,6 +77,8 @@ public function getPath() } /** + * Get configured cookie lifetime + * * @return int */ public function getLifetime() diff --git a/lib/internal/Magento/Framework/View/Element/RendererList.php b/lib/internal/Magento/Framework/View/Element/RendererList.php index 30bc38aed28f3..96707c74dd253 100644 --- a/lib/internal/Magento/Framework/View/Element/RendererList.php +++ b/lib/internal/Magento/Framework/View/Element/RendererList.php @@ -6,6 +6,8 @@ namespace Magento\Framework\View\Element; /** + * Renderer List + * * @api */ class RendererList extends AbstractBlock diff --git a/lib/internal/Magento/Framework/View/Element/Template.php b/lib/internal/Magento/Framework/View/Element/Template.php index a1aa599156d2a..99c876b440665 100644 --- a/lib/internal/Magento/Framework/View/Element/Template.php +++ b/lib/internal/Magento/Framework/View/Element/Template.php @@ -10,6 +10,7 @@ /** * Standard Magento block. + * * Should be used when you declare a block in frontend area layout handle. * * Avoid extending this class. @@ -166,6 +167,7 @@ public function setTemplateContext($templateContext) /** * Internal constructor, that is called from real constructor + * * @return void */ protected function _construct() diff --git a/lib/internal/Magento/Framework/View/Element/Template/File/Resolver.php b/lib/internal/Magento/Framework/View/Element/Template/File/Resolver.php index abad0eee856c3..b13caa55d3174 100644 --- a/lib/internal/Magento/Framework/View/Element/Template/File/Resolver.php +++ b/lib/internal/Magento/Framework/View/Element/Template/File/Resolver.php @@ -10,6 +10,7 @@ /** * Class Resolver + * * @package Magento\Framework\View\Element\Template\File */ class Resolver diff --git a/lib/internal/Magento/Framework/View/Element/UiComponentInterface.php b/lib/internal/Magento/Framework/View/Element/UiComponentInterface.php index b5c3546084fcb..3ae2627881101 100644 --- a/lib/internal/Magento/Framework/View/Element/UiComponentInterface.php +++ b/lib/internal/Magento/Framework/View/Element/UiComponentInterface.php @@ -52,6 +52,8 @@ public function render(); public function addComponent($name, UiComponentInterface $component); /** + * Get component + * * @param string $name * @return UiComponentInterface */ From 75532257cf22ede587602be75e70f5c0c8a9d490 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Sat, 14 Dec 2019 19:05:16 +0700 Subject: [PATCH 0390/1143] [Catalog] Cover Component/FilterFactory by Unit Test --- .../Unit/Ui/Component/FilterFactoryTest.php | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 app/code/Magento/Catalog/Test/Unit/Ui/Component/FilterFactoryTest.php diff --git a/app/code/Magento/Catalog/Test/Unit/Ui/Component/FilterFactoryTest.php b/app/code/Magento/Catalog/Test/Unit/Ui/Component/FilterFactoryTest.php new file mode 100644 index 0000000000000..545b9e7326ff1 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Unit/Ui/Component/FilterFactoryTest.php @@ -0,0 +1,100 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Test\Unit\Ui\Component; + +use PHPUnit\Framework\TestCase; +use Magento\Catalog\Ui\Component\FilterFactory; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\Framework\View\Element\UiComponentFactory; +use Magento\Catalog\Api\Data\ProductAttributeInterface; +use Magento\Eav\Model\Entity\Attribute\Source\SourceInterface; +use Magento\Framework\View\Element\UiComponent\ContextInterface; + +class FilterFactoryTest extends TestCase +{ + /** + * @var FilterFactory + */ + private $filterFactory; + + /** + * @var UiComponentFactory|\PHPUnit_Framework_MockObject_MockObject + */ + private $componentFactoryMock; + + /** + * Setup environment for test + */ + protected function setUp() + { + $objectManager = new ObjectManagerHelper($this); + + $this->componentFactoryMock = $this->createMock(UiComponentFactory::class); + + $this->filterFactory = $objectManager->getObject( + FilterFactory::class, + [ + 'componentFactory' => $this->componentFactoryMock + ] + ); + } + + /** + * Test create() with use source attribute + */ + public function testCreateWithUseSourceAttribute() + { + $contextMock = $this->createMock(ContextInterface::class); + $attributeMock = $this->getMockBuilder(ProductAttributeInterface::class) + ->setMethods(['usesSource', 'getSource']) + ->getMockForAbstractClass(); + $attributeMock->method('getAttributeCode')->willReturn('color'); + $attributeMock->method('getDefaultFrontendLabel')->willReturn('Color'); + $attributeMock->method('usesSource')->willReturn(true); + $attributeMock->method('getSourceModel')->willReturn('getSourceModel value'); + $attributeMock->method('getFrontendInput')->willReturn('select'); + $sourceMock = $this->createMock(SourceInterface::class); + $attributeMock->method('getSource')->willReturn($sourceMock); + $sourceMock->method('getAllOptions')->willReturn( + [ + [ + 'value' => 1, + 'label' => 'Black', + ], + [ + 'value' => 2, + 'label' => 'White', + ] + ] + ); + $this->componentFactoryMock->expects($this->once()) + ->method('create') + ->with('color', 'filterSelect', [ + 'data' => [ + 'config' => [ + 'options' => [ + [ + 'value' => 1, + 'label' => 'Black', + ], + [ + 'value' => 2, + 'label' => 'White', + ] + ], + 'caption' => (string)__('Select...'), + 'dataScope' => 'color', + 'label' => (string)__('Color'), + ] + ], + 'context' => $contextMock + ]); + + $this->filterFactory->create($attributeMock, $contextMock); + } +} From ad48079535d018ddab62d7f1313d93a4268f859f Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Sat, 14 Dec 2019 20:11:23 +0700 Subject: [PATCH 0391/1143] [Persistent] Cover CustomerData by Unit Test --- .../Test/Unit/CustomerData/PersistentTest.php | 109 ++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 app/code/Magento/Persistent/Test/Unit/CustomerData/PersistentTest.php diff --git a/app/code/Magento/Persistent/Test/Unit/CustomerData/PersistentTest.php b/app/code/Magento/Persistent/Test/Unit/CustomerData/PersistentTest.php new file mode 100644 index 0000000000000..381555ed0fe79 --- /dev/null +++ b/app/code/Magento/Persistent/Test/Unit/CustomerData/PersistentTest.php @@ -0,0 +1,109 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\Persistent\Test\Unit\CustomerData; + +use PHPUnit\Framework\TestCase; +use Magento\Persistent\CustomerData\Persistent; +use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Customer\Helper\View; +use Magento\Persistent\Helper\Session; +use Magento\Persistent\Model\Session as PersistentSession; +use Magento\Customer\Api\Data\CustomerInterface; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; + +class PersistentTest extends TestCase +{ + /** + * @var Persistent + */ + private $customerData; + + /** + * @var Session + */ + private $persistentSessionHelperMock; + + /** + * @var View + */ + private $customerViewHelperMock; + + /** + * @var CustomerRepositoryInterface + */ + private $customerRepositoryMock; + + /** + * Setup environment for test + */ + protected function setUp() + { + $this->persistentSessionHelperMock = $this->createMock(Session::class); + $this->customerViewHelperMock = $this->createMock(View::class); + $this->customerRepositoryMock = $this->createMock(CustomerRepositoryInterface::class); + + $objectManager = new ObjectManagerHelper($this); + + $this->customerData = $objectManager->getObject( + Persistent::class, + [ + 'persistentSession' => $this->persistentSessionHelperMock, + 'customerViewHelper' => $this->customerViewHelperMock, + 'customerRepository' => $this->customerRepositoryMock + ] + ); + } + + /** + * Test getSectionData() when disable persistent + */ + public function testGetSectionDataWhenDisablePersistent() + { + $this->persistentSessionHelperMock->method('isPersistent')->willReturn(false); + + $this->assertEquals([], $this->customerData->getSectionData()); + } + + /** + * Test getSectionData() when customer doesn't login + */ + public function testGetSectionDataWithNotLogin() + { + $this->persistentSessionHelperMock->method('isPersistent')->willReturn(true); + + $persistentSessionMock = $this->createPartialMock(PersistentSession::class, ['getCustomerId']); + $persistentSessionMock->method('getCustomerId')->willReturn(null); + $this->persistentSessionHelperMock->method('getSession')->willReturn($persistentSessionMock); + + $this->assertEquals([], $this->customerData->getSectionData()); + } + + /** + * Test getSectionData() when customer login and enable persistent + */ + public function testGetSectionDataCustomerLoginAndEnablePersistent() + { + $this->persistentSessionHelperMock->method('isPersistent')->willReturn(true); + + $persistentSessionMock = $this->createPartialMock(PersistentSession::class, ['getCustomerId']); + $persistentSessionMock->method('getCustomerId')->willReturn(1); + $this->persistentSessionHelperMock->method('getSession')->willReturn($persistentSessionMock); + + $customerMock = $this->createMock(CustomerInterface::class); + $this->customerRepositoryMock->method('getById')->with(1)->willReturn($customerMock); + $this->customerViewHelperMock->method('getCustomerName')->with($customerMock)->willReturn('Adam John'); + + $this->assertEquals( + [ + 'fullname' => 'Adam John' + ], + $this->customerData->getSectionData() + ); + } +} From 1c699b25db84b0690888ee85f145bd336607d672 Mon Sep 17 00:00:00 2001 From: Eden Duong <quocviet312@gmail.com> Date: Sat, 14 Dec 2019 20:25:24 +0700 Subject: [PATCH 0392/1143] Update phpdocs --- .../Persistent/Test/Unit/CustomerData/PersistentTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Persistent/Test/Unit/CustomerData/PersistentTest.php b/app/code/Magento/Persistent/Test/Unit/CustomerData/PersistentTest.php index 381555ed0fe79..16df8181a0e61 100644 --- a/app/code/Magento/Persistent/Test/Unit/CustomerData/PersistentTest.php +++ b/app/code/Magento/Persistent/Test/Unit/CustomerData/PersistentTest.php @@ -25,17 +25,17 @@ class PersistentTest extends TestCase private $customerData; /** - * @var Session + * @var Session|\PHPUnit_Framework_MockObject_MockObject */ private $persistentSessionHelperMock; /** - * @var View + * @var View|\PHPUnit_Framework_MockObject_MockObject */ private $customerViewHelperMock; /** - * @var CustomerRepositoryInterface + * @var CustomerRepositoryInterface|\PHPUnit_Framework_MockObject_MockObject */ private $customerRepositoryMock; From fc04d190a098796680070a338d2b8124e117feb9 Mon Sep 17 00:00:00 2001 From: Giancarlo Peris <gperis93@gmail.com> Date: Sat, 14 Dec 2019 13:53:57 +0000 Subject: [PATCH 0393/1143] Initialise value as empty when color picker input is reset so the preview gets updated --- .../view/base/web/js/lib/knockout/bindings/color-picker.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/color-picker.js b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/color-picker.js index c678b85276093..1e8e89894d22f 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/color-picker.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/color-picker.js @@ -71,6 +71,11 @@ define([ update: function (element, valueAccessor, allBindings, viewModel) { var config = valueAccessor(); + /** Initialise value as empty if it is undefined when color picker input is reset **/ + if (config.value() === undefined) { + config.value(''); + } + if (tinycolor(config.value()).isValid() || config.value() === '') { $(element).spectrum('set', config.value()); From e704d62ef2af5b2bcbb31574c9b8bee8874c90e1 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Sat, 14 Dec 2019 21:06:18 +0700 Subject: [PATCH 0394/1143] [Downloadable] Cover Helper Data by Unit Test --- .../Test/Unit/Helper/DataTest.php | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 app/code/Magento/Downloadable/Test/Unit/Helper/DataTest.php diff --git a/app/code/Magento/Downloadable/Test/Unit/Helper/DataTest.php b/app/code/Magento/Downloadable/Test/Unit/Helper/DataTest.php new file mode 100644 index 0000000000000..7c59ef7d7ec64 --- /dev/null +++ b/app/code/Magento/Downloadable/Test/Unit/Helper/DataTest.php @@ -0,0 +1,86 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\Downloadable\Test\Unit\Helper; + +use Magento\Downloadable\Model\Link; +use Magento\Store\Model\ScopeInterface; +use PHPUnit\Framework\TestCase; +use Magento\Downloadable\Helper\Data; +use Magento\Framework\App\Helper\Context; +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; + +class DataTest extends TestCase +{ + /** + * @var Data + */ + private $helper; + + /** + * @var ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $scopeConfigMock; + + /** + * @var Context|\PHPUnit_Framework_MockObject_MockObject + */ + private $contextMock; + + /** + * Setup environment for test + */ + protected function setUp() + { + $this->scopeConfigMock = $this->createMock(ScopeConfigInterface::class); + $this->contextMock = $this->createMock(Context::class); + $this->contextMock->method('getScopeConfig')->willReturn($this->scopeConfigMock); + + $objectManager = new ObjectManagerHelper($this); + $this->helper = $objectManager->getObject( + Data::class, + ['context' => $this->contextMock] + ); + } + + /** + * Test getIsShareable() with data provider + * + * @param int $linkShareable + * @param bool $config + * @param bool $expectedResult + * @dataProvider getIsShareableDataProvider + */ + public function testGetIsShareable($linkShareable, $config, $expectedResult) + { + $this->scopeConfigMock->method('isSetFlag') + ->with(Link::XML_PATH_CONFIG_IS_SHAREABLE, ScopeInterface::SCOPE_STORE) + ->willReturn($config); + + $linkMock = $this->createMock(Link::class); + $linkMock->method('getIsShareable')->willReturn($linkShareable); + + $this->assertEquals($expectedResult, $this->helper->getIsShareable($linkMock)); + } + + /** + * Data provider for getIsShareable() + * + * @return array + */ + public function getIsShareableDataProvider() + { + return [ + 'link shareable yes' => [Link::LINK_SHAREABLE_YES, true, true], + 'link shareable no' => [Link::LINK_SHAREABLE_NO, true, false], + 'link shareable config true' => [Link::LINK_SHAREABLE_CONFIG, true, true], + 'link shareable config false' => [Link::LINK_SHAREABLE_CONFIG, false, false], + ]; + } +} From 179b85415038d327b29e6e2f390d7e35820ed5d8 Mon Sep 17 00:00:00 2001 From: pawankparmar <comp1@comp1-All-Series> Date: Sat, 14 Dec 2019 22:31:04 +0530 Subject: [PATCH 0395/1143] spelling fix and put space --- .../Api/Data/ProductRender/FormattedPriceInfoInterface.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Api/Data/ProductRender/FormattedPriceInfoInterface.php b/app/code/Magento/Catalog/Api/Data/ProductRender/FormattedPriceInfoInterface.php index 43e0de4f20176..65ff84ef719f0 100644 --- a/app/code/Magento/Catalog/Api/Data/ProductRender/FormattedPriceInfoInterface.php +++ b/app/code/Magento/Catalog/Api/Data/ProductRender/FormattedPriceInfoInterface.php @@ -66,7 +66,7 @@ public function getMinimalPrice(); /** * Set max regular price - * Max regular price is the same, as maximum price, except of excluding calculating special price and catalogules + * Max regular price is the same, as maximum price, except of excluding calculating special price and catalog rules * in it * * @param string $maxRegularPrice From f075d4e4120dc833867a3ddc047804b8e1ea9070 Mon Sep 17 00:00:00 2001 From: Sathish <srsathish92@gmail.com> Date: Sun, 15 Dec 2019 01:23:06 +0530 Subject: [PATCH 0396/1143] [Catalog] cover ViewModel AddToCompareAvailability by Unit Test --- .../Checker/AddToCompareAvailabilityTest.php | 118 ++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 app/code/Magento/Catalog/Test/Unit/ViewModel/Product/Checker/AddToCompareAvailabilityTest.php diff --git a/app/code/Magento/Catalog/Test/Unit/ViewModel/Product/Checker/AddToCompareAvailabilityTest.php b/app/code/Magento/Catalog/Test/Unit/ViewModel/Product/Checker/AddToCompareAvailabilityTest.php new file mode 100644 index 0000000000000..4295b11a58077 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Unit/ViewModel/Product/Checker/AddToCompareAvailabilityTest.php @@ -0,0 +1,118 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\Catalog\Test\Unit\ViewModel\Product\Checker; + +use Magento\Catalog\ViewModel\Product\Checker\AddToCompareAvailability; +use Magento\CatalogInventory\Api\StockConfigurationInterface; +use Magento\Catalog\Model\Product; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use PHPUnit\Framework\MockObject\MockObject; + +/** + * Unit test for Magento\Catalog\ViewModel\Product\Checker\AddToCompareAvailability. + */ +class AddToCompareAvailabilityTest extends \PHPUnit\Framework\TestCase +{ + + /** + * @var AddToCompareAvailability + */ + private $viewModel; + + /** + * @var StockConfigurationInterface|MockObject + */ + protected $stockConfiguration; + + /** + * @var ObjectManager + */ + private $objectManager; + + /** + * @inheritdoc + */ + protected function setUp(): void + { + + $this->stockConfiguration = + $this->getMockBuilder(StockConfigurationInterface::class) + ->getMock(); + + $this->viewModel = $this->getObjectManager()->getObject( + AddToCompareAvailability::class, + [ + 'stockConfiguration' => $this->stockConfiguration + ] + ); + } + + /** + * Test IsAvailableForCompare() with data provider + * + * @param bool $status + * @param bool $isSalable + * @param array $isInStock + * @param bool $isShowOutOfStock + * @return boolean + * @dataProvider isAvailableForCompareDataProvider + */ + public function testIsAvailableForCompare($status, $isSalable, $isInStock, $isShowOutOfStock): bool + { + $productMock = $this->getMockBuilder(Product::class) + ->disableOriginalConstructor() + ->getMock(); + + $productMock->expects($this->once()) + ->method('getStatus') + ->willReturn($status); + + $productMock->expects($this->any()) + ->method('isSalable') + ->willReturn($isSalable); + + $productMock->expects($this->any()) + ->method('getQuantityAndStockStatus') + ->willReturn($isInStock); + + $this->stockConfiguration->expects($this->any()) + ->method('isShowOutOfStock') + ->willReturn($isShowOutOfStock); + + return $this->viewModel->isAvailableForCompare($productMock); + } + + /** + * Data provider for isAvailableForCompare() + * + * @return array + */ + public function isAvailableForCompareDataProvider(): array + { + return [ + [1, true, ['is_in_stock' => true], false], + [1, true, ['is_in_stock' => false], true], + [1, true, [], false], + [1, false, [], false], + [2, true, ['is_in_stock' => true], false] + ]; + } + + /** + * @return ObjectManager + */ + private function getObjectManager(): ObjectManager + { + if (null === $this->objectManager) { + $this->objectManager = new ObjectManager($this); + } + + return $this->objectManager; + } +} From 0b806f9cf6d4f1cf89a294d18c552cc3eaa9c2ad Mon Sep 17 00:00:00 2001 From: Sathish <srsathish92@gmail.com> Date: Sun, 15 Dec 2019 02:19:06 +0530 Subject: [PATCH 0397/1143] Fixed the static tests & feedbacks --- .../Checker/AddToCompareAvailabilityTest.php | 33 +++++-------------- 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/ViewModel/Product/Checker/AddToCompareAvailabilityTest.php b/app/code/Magento/Catalog/Test/Unit/ViewModel/Product/Checker/AddToCompareAvailabilityTest.php index 4295b11a58077..88dba7ebee1c6 100644 --- a/app/code/Magento/Catalog/Test/Unit/ViewModel/Product/Checker/AddToCompareAvailabilityTest.php +++ b/app/code/Magento/Catalog/Test/Unit/ViewModel/Product/Checker/AddToCompareAvailabilityTest.php @@ -26,14 +26,9 @@ class AddToCompareAvailabilityTest extends \PHPUnit\Framework\TestCase private $viewModel; /** - * @var StockConfigurationInterface|MockObject + * @var StockConfigurationInterface|MockObject */ - protected $stockConfiguration; - - /** - * @var ObjectManager - */ - private $objectManager; + protected $stockConfigurationMock; /** * @inheritdoc @@ -41,14 +36,16 @@ class AddToCompareAvailabilityTest extends \PHPUnit\Framework\TestCase protected function setUp(): void { - $this->stockConfiguration = + $objectManager = new ObjectManager($this); + + $this->stockConfigurationMock = $this->getMockBuilder(StockConfigurationInterface::class) ->getMock(); - $this->viewModel = $this->getObjectManager()->getObject( + $this->viewModel = $objectManager->getObject( AddToCompareAvailability::class, [ - 'stockConfiguration' => $this->stockConfiguration + 'stockConfiguration' => $this->stockConfigurationMock ] ); } @@ -81,7 +78,7 @@ public function testIsAvailableForCompare($status, $isSalable, $isInStock, $isSh ->method('getQuantityAndStockStatus') ->willReturn($isInStock); - $this->stockConfiguration->expects($this->any()) + $this->stockConfigurationMock->expects($this->any()) ->method('isShowOutOfStock') ->willReturn($isShowOutOfStock); @@ -90,7 +87,7 @@ public function testIsAvailableForCompare($status, $isSalable, $isInStock, $isSh /** * Data provider for isAvailableForCompare() - * + * * @return array */ public function isAvailableForCompareDataProvider(): array @@ -103,16 +100,4 @@ public function isAvailableForCompareDataProvider(): array [2, true, ['is_in_stock' => true], false] ]; } - - /** - * @return ObjectManager - */ - private function getObjectManager(): ObjectManager - { - if (null === $this->objectManager) { - $this->objectManager = new ObjectManager($this); - } - - return $this->objectManager; - } } From 97fe3ffe0b0e891284301f7ef749ee96391ea013 Mon Sep 17 00:00:00 2001 From: Sathish <srsathish92@gmail.com> Date: Sun, 15 Dec 2019 03:08:39 +0530 Subject: [PATCH 0398/1143] Assert added with expected results --- .../Checker/AddToCompareAvailabilityTest.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/ViewModel/Product/Checker/AddToCompareAvailabilityTest.php b/app/code/Magento/Catalog/Test/Unit/ViewModel/Product/Checker/AddToCompareAvailabilityTest.php index 88dba7ebee1c6..1b743d26a4297 100644 --- a/app/code/Magento/Catalog/Test/Unit/ViewModel/Product/Checker/AddToCompareAvailabilityTest.php +++ b/app/code/Magento/Catalog/Test/Unit/ViewModel/Product/Checker/AddToCompareAvailabilityTest.php @@ -57,10 +57,11 @@ protected function setUp(): void * @param bool $isSalable * @param array $isInStock * @param bool $isShowOutOfStock - * @return boolean + * @param bool $expectedBool + * @return void * @dataProvider isAvailableForCompareDataProvider */ - public function testIsAvailableForCompare($status, $isSalable, $isInStock, $isShowOutOfStock): bool + public function testIsAvailableForCompare($status, $isSalable, $isInStock, $isShowOutOfStock, $expectedBool): void { $productMock = $this->getMockBuilder(Product::class) ->disableOriginalConstructor() @@ -82,7 +83,7 @@ public function testIsAvailableForCompare($status, $isSalable, $isInStock, $isSh ->method('isShowOutOfStock') ->willReturn($isShowOutOfStock); - return $this->viewModel->isAvailableForCompare($productMock); + $this->assertEquals($expectedBool, $this->viewModel->isAvailableForCompare($productMock)); } /** @@ -93,11 +94,11 @@ public function testIsAvailableForCompare($status, $isSalable, $isInStock, $isSh public function isAvailableForCompareDataProvider(): array { return [ - [1, true, ['is_in_stock' => true], false], - [1, true, ['is_in_stock' => false], true], - [1, true, [], false], - [1, false, [], false], - [2, true, ['is_in_stock' => true], false] + [1, true, ['is_in_stock' => true], false, true], + [1, true, ['is_in_stock' => false], true, true], + [1, true, [], false, true], + [1, false, [], false, false], + [2, true, ['is_in_stock' => true], false, false] ]; } } From 5cedaf8e26fe72b7335058be87ab2b1a39977382 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Sun, 15 Dec 2019 05:44:47 +0700 Subject: [PATCH 0399/1143] Refactor code --- .../Test/Unit/CustomerData/PersistentTest.php | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Persistent/Test/Unit/CustomerData/PersistentTest.php b/app/code/Magento/Persistent/Test/Unit/CustomerData/PersistentTest.php index 381555ed0fe79..15889a74439d7 100644 --- a/app/code/Magento/Persistent/Test/Unit/CustomerData/PersistentTest.php +++ b/app/code/Magento/Persistent/Test/Unit/CustomerData/PersistentTest.php @@ -16,26 +16,37 @@ use Magento\Persistent\Model\Session as PersistentSession; use Magento\Customer\Api\Data\CustomerInterface; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use PHPUnit\Framework\MockObject\MockObject; class PersistentTest extends TestCase { + /** + * Stub customer id + */ + private const STUB_CUSTOMER_ID = 1; + + /** + * Stub customer name + */ + private const STUB_CUSTOMER_NAME = 'Adam John'; + /** * @var Persistent */ private $customerData; /** - * @var Session + * @var Session|MockObject */ private $persistentSessionHelperMock; /** - * @var View + * @var View|MockObject */ private $customerViewHelperMock; /** - * @var CustomerRepositoryInterface + * @var CustomerRepositoryInterface|MockObject */ private $customerRepositoryMock; @@ -73,7 +84,7 @@ public function testGetSectionDataWhenDisablePersistent() /** * Test getSectionData() when customer doesn't login */ - public function testGetSectionDataWithNotLogin() + public function testGetSectionDataWhenCustomerNotLoggedInReturnsEmptyArray() { $this->persistentSessionHelperMock->method('isPersistent')->willReturn(true); @@ -92,16 +103,17 @@ public function testGetSectionDataCustomerLoginAndEnablePersistent() $this->persistentSessionHelperMock->method('isPersistent')->willReturn(true); $persistentSessionMock = $this->createPartialMock(PersistentSession::class, ['getCustomerId']); - $persistentSessionMock->method('getCustomerId')->willReturn(1); + $persistentSessionMock->method('getCustomerId')->willReturn(self::STUB_CUSTOMER_ID); $this->persistentSessionHelperMock->method('getSession')->willReturn($persistentSessionMock); $customerMock = $this->createMock(CustomerInterface::class); $this->customerRepositoryMock->method('getById')->with(1)->willReturn($customerMock); - $this->customerViewHelperMock->method('getCustomerName')->with($customerMock)->willReturn('Adam John'); + $this->customerViewHelperMock->method('getCustomerName')->with($customerMock) + ->willReturn(self::STUB_CUSTOMER_NAME); $this->assertEquals( [ - 'fullname' => 'Adam John' + 'fullname' => self::STUB_CUSTOMER_NAME ], $this->customerData->getSectionData() ); From bbfdb089bb5cbd7b61882896984ad87bea62deee Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Sun, 15 Dec 2019 06:02:50 +0700 Subject: [PATCH 0400/1143] Refactor code --- .../Unit/Ui/Component/FilterFactoryTest.php | 73 ++++++++++--------- 1 file changed, 38 insertions(+), 35 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Ui/Component/FilterFactoryTest.php b/app/code/Magento/Catalog/Test/Unit/Ui/Component/FilterFactoryTest.php index 545b9e7326ff1..4b43a41c42fad 100644 --- a/app/code/Magento/Catalog/Test/Unit/Ui/Component/FilterFactoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Ui/Component/FilterFactoryTest.php @@ -7,23 +7,45 @@ namespace Magento\Catalog\Test\Unit\Ui\Component; -use PHPUnit\Framework\TestCase; -use Magento\Catalog\Ui\Component\FilterFactory; -use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; -use Magento\Framework\View\Element\UiComponentFactory; use Magento\Catalog\Api\Data\ProductAttributeInterface; +use Magento\Catalog\Ui\Component\FilterFactory; use Magento\Eav\Model\Entity\Attribute\Source\SourceInterface; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use Magento\Framework\View\Element\UiComponent\ContextInterface; +use Magento\Framework\View\Element\UiComponentFactory; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; class FilterFactoryTest extends TestCase { + /** + * Stub attribute + */ + private const STUB_ATTRIBUTE = [ + 'attribute_code' => 'color', + 'default_frontend_label' => 'Color', + 'uses_source' => 'Color', + 'source_model' => 'getSourceModel value', + 'frontend_input' => 'select', + 'all_options' => [ + [ + 'value' => 1, + 'label' => 'Black', + ], + [ + 'value' => 2, + 'label' => 'White', + ] + ] + ]; + /** * @var FilterFactory */ private $filterFactory; /** - * @var UiComponentFactory|\PHPUnit_Framework_MockObject_MockObject + * @var UiComponentFactory|MockObject */ private $componentFactoryMock; @@ -32,7 +54,7 @@ class FilterFactoryTest extends TestCase */ protected function setUp() { - $objectManager = new ObjectManagerHelper($this); + $objectManager = new ObjectManager($this); $this->componentFactoryMock = $this->createMock(UiComponentFactory::class); @@ -53,43 +75,24 @@ public function testCreateWithUseSourceAttribute() $attributeMock = $this->getMockBuilder(ProductAttributeInterface::class) ->setMethods(['usesSource', 'getSource']) ->getMockForAbstractClass(); - $attributeMock->method('getAttributeCode')->willReturn('color'); - $attributeMock->method('getDefaultFrontendLabel')->willReturn('Color'); - $attributeMock->method('usesSource')->willReturn(true); - $attributeMock->method('getSourceModel')->willReturn('getSourceModel value'); - $attributeMock->method('getFrontendInput')->willReturn('select'); + $attributeMock->method('getAttributeCode')->willReturn(self::STUB_ATTRIBUTE['attribute_code']); + $attributeMock->method('getDefaultFrontendLabel') + ->willReturn(self::STUB_ATTRIBUTE['default_frontend_label']); + $attributeMock->method('usesSource')->willReturn(self::STUB_ATTRIBUTE['uses_source']); + $attributeMock->method('getSourceModel')->willReturn(self::STUB_ATTRIBUTE['source_model']); + $attributeMock->method('getFrontendInput')->willReturn(self::STUB_ATTRIBUTE['frontend_input']); $sourceMock = $this->createMock(SourceInterface::class); $attributeMock->method('getSource')->willReturn($sourceMock); - $sourceMock->method('getAllOptions')->willReturn( - [ - [ - 'value' => 1, - 'label' => 'Black', - ], - [ - 'value' => 2, - 'label' => 'White', - ] - ] - ); + $sourceMock->method('getAllOptions')->willReturn(self::STUB_ATTRIBUTE['all_options']); $this->componentFactoryMock->expects($this->once()) ->method('create') ->with('color', 'filterSelect', [ 'data' => [ 'config' => [ - 'options' => [ - [ - 'value' => 1, - 'label' => 'Black', - ], - [ - 'value' => 2, - 'label' => 'White', - ] - ], + 'options' => self::STUB_ATTRIBUTE['all_options'], 'caption' => (string)__('Select...'), - 'dataScope' => 'color', - 'label' => (string)__('Color'), + 'dataScope' => self::STUB_ATTRIBUTE['attribute_code'], + 'label' => (string)__(self::STUB_ATTRIBUTE['default_frontend_label']), ] ], 'context' => $contextMock From 78ba90500058250770676f3c60c826a23f1de366 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Sun, 15 Dec 2019 06:03:36 +0700 Subject: [PATCH 0401/1143] optimize import --- .../Persistent/Test/Unit/CustomerData/PersistentTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Persistent/Test/Unit/CustomerData/PersistentTest.php b/app/code/Magento/Persistent/Test/Unit/CustomerData/PersistentTest.php index 15889a74439d7..7120474ba0eee 100644 --- a/app/code/Magento/Persistent/Test/Unit/CustomerData/PersistentTest.php +++ b/app/code/Magento/Persistent/Test/Unit/CustomerData/PersistentTest.php @@ -8,15 +8,15 @@ namespace Magento\Persistent\Test\Unit\CustomerData; -use PHPUnit\Framework\TestCase; -use Magento\Persistent\CustomerData\Persistent; use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Customer\Api\Data\CustomerInterface; use Magento\Customer\Helper\View; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\Persistent\CustomerData\Persistent; use Magento\Persistent\Helper\Session; use Magento\Persistent\Model\Session as PersistentSession; -use Magento\Customer\Api\Data\CustomerInterface; -use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; class PersistentTest extends TestCase { From 50b006e1cfbb59d84914e8b7dd9d81afaf22cf01 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Sun, 15 Dec 2019 06:35:16 +0700 Subject: [PATCH 0402/1143] refactor code --- .../Persistent/Test/Unit/CustomerData/PersistentTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Persistent/Test/Unit/CustomerData/PersistentTest.php b/app/code/Magento/Persistent/Test/Unit/CustomerData/PersistentTest.php index 7120474ba0eee..a95f5530bb800 100644 --- a/app/code/Magento/Persistent/Test/Unit/CustomerData/PersistentTest.php +++ b/app/code/Magento/Persistent/Test/Unit/CustomerData/PersistentTest.php @@ -107,7 +107,7 @@ public function testGetSectionDataCustomerLoginAndEnablePersistent() $this->persistentSessionHelperMock->method('getSession')->willReturn($persistentSessionMock); $customerMock = $this->createMock(CustomerInterface::class); - $this->customerRepositoryMock->method('getById')->with(1)->willReturn($customerMock); + $this->customerRepositoryMock->method('getById')->with(self::STUB_CUSTOMER_ID)->willReturn($customerMock); $this->customerViewHelperMock->method('getCustomerName')->with($customerMock) ->willReturn(self::STUB_CUSTOMER_NAME); From 888ad592a5995e189783a20bf855d8b979338324 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Sun, 15 Dec 2019 07:12:55 +0700 Subject: [PATCH 0403/1143] refactor code --- .../Catalog/Test/Unit/Ui/Component/FilterFactoryTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Ui/Component/FilterFactoryTest.php b/app/code/Magento/Catalog/Test/Unit/Ui/Component/FilterFactoryTest.php index 4b43a41c42fad..e19284447c07d 100644 --- a/app/code/Magento/Catalog/Test/Unit/Ui/Component/FilterFactoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Ui/Component/FilterFactoryTest.php @@ -92,7 +92,7 @@ public function testCreateWithUseSourceAttribute() 'options' => self::STUB_ATTRIBUTE['all_options'], 'caption' => (string)__('Select...'), 'dataScope' => self::STUB_ATTRIBUTE['attribute_code'], - 'label' => (string)__(self::STUB_ATTRIBUTE['default_frontend_label']), + 'label' => self::STUB_ATTRIBUTE['default_frontend_label'], ] ], 'context' => $contextMock From 9e042b677e1d6e7af4efa2958697a4088b63400e Mon Sep 17 00:00:00 2001 From: Sathish <srsathish92@gmail.com> Date: Sun, 15 Dec 2019 06:37:41 +0530 Subject: [PATCH 0404/1143] Magic numbers replaced with class --- .../Product/Checker/AddToCompareAvailabilityTest.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/ViewModel/Product/Checker/AddToCompareAvailabilityTest.php b/app/code/Magento/Catalog/Test/Unit/ViewModel/Product/Checker/AddToCompareAvailabilityTest.php index 1b743d26a4297..682f652339820 100644 --- a/app/code/Magento/Catalog/Test/Unit/ViewModel/Product/Checker/AddToCompareAvailabilityTest.php +++ b/app/code/Magento/Catalog/Test/Unit/ViewModel/Product/Checker/AddToCompareAvailabilityTest.php @@ -11,6 +11,7 @@ use Magento\Catalog\ViewModel\Product\Checker\AddToCompareAvailability; use Magento\CatalogInventory\Api\StockConfigurationInterface; use Magento\Catalog\Model\Product; +use \Magento\Catalog\Model\Product\Attribute\Source\Status; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use PHPUnit\Framework\MockObject\MockObject; @@ -94,11 +95,11 @@ public function testIsAvailableForCompare($status, $isSalable, $isInStock, $isSh public function isAvailableForCompareDataProvider(): array { return [ - [1, true, ['is_in_stock' => true], false, true], - [1, true, ['is_in_stock' => false], true, true], - [1, true, [], false, true], - [1, false, [], false, false], - [2, true, ['is_in_stock' => true], false, false] + [Status::STATUS_ENABLED, true, ['is_in_stock' => true], false, true], + [Status::STATUS_ENABLED, true, ['is_in_stock' => false], true, true], + [Status::STATUS_ENABLED, true, [], false, true], + [Status::STATUS_ENABLED, false, [], false, false], + [Status::STATUS_DISABLED, true, ['is_in_stock' => true], false, false] ]; } } From a308d4add176b1250d19f8dec6abad9b655333e1 Mon Sep 17 00:00:00 2001 From: Sathish <srsathish92@gmail.com> Date: Sun, 15 Dec 2019 06:40:07 +0530 Subject: [PATCH 0405/1143] Magic numbers replaced with class --- .../ViewModel/Product/Checker/AddToCompareAvailabilityTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Unit/ViewModel/Product/Checker/AddToCompareAvailabilityTest.php b/app/code/Magento/Catalog/Test/Unit/ViewModel/Product/Checker/AddToCompareAvailabilityTest.php index 682f652339820..55bfbe8b4ec71 100644 --- a/app/code/Magento/Catalog/Test/Unit/ViewModel/Product/Checker/AddToCompareAvailabilityTest.php +++ b/app/code/Magento/Catalog/Test/Unit/ViewModel/Product/Checker/AddToCompareAvailabilityTest.php @@ -11,7 +11,7 @@ use Magento\Catalog\ViewModel\Product\Checker\AddToCompareAvailability; use Magento\CatalogInventory\Api\StockConfigurationInterface; use Magento\Catalog\Model\Product; -use \Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Catalog\Model\Product\Attribute\Source\Status; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use PHPUnit\Framework\MockObject\MockObject; From 689c1f62069f7cb4520820013cebcb3b8b906dc6 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Sun, 15 Dec 2019 11:26:12 +0700 Subject: [PATCH 0406/1143] Issue with reorder when disabled reorder setting from admin issue25130 --- .../Controller/AbstractController/Reorder.php | 23 ++- .../Unit/Controller/Guest/ReorderTest.php | 141 ++++++++++++++++++ app/code/Magento/Sales/i18n/en_US.csv | 2 + 3 files changed, 164 insertions(+), 2 deletions(-) create mode 100644 app/code/Magento/Sales/Test/Unit/Controller/Guest/ReorderTest.php diff --git a/app/code/Magento/Sales/Controller/AbstractController/Reorder.php b/app/code/Magento/Sales/Controller/AbstractController/Reorder.php index 65cb537e89fec..9a3c710c60b9f 100644 --- a/app/code/Magento/Sales/Controller/AbstractController/Reorder.php +++ b/app/code/Magento/Sales/Controller/AbstractController/Reorder.php @@ -4,16 +4,20 @@ * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Sales\Controller\AbstractController; use Magento\Framework\App\Action; use Magento\Framework\Registry; use Magento\Framework\App\Action\HttpPostActionInterface; +use Magento\Framework\App\ObjectManager; +use Magento\Sales\Helper\Reorder as ReorderHelper; /** * Abstract class for controllers Reorder(Customer) and Reorder(Guest) * - * @package Magento\Sales\Controller\AbstractController + * Class Magento\Sales\Controller\AbstractController\Reorder */ abstract class Reorder extends Action\Action implements HttpPostActionInterface { @@ -28,17 +32,27 @@ abstract class Reorder extends Action\Action implements HttpPostActionInterface protected $_coreRegistry; /** + * @var ReorderHelper + */ + private $reorderHelper; + + /** + * Constructor + * * @param Action\Context $context * @param OrderLoaderInterface $orderLoader * @param Registry $registry + * @param ReorderHelper|null $reorderHelper */ public function __construct( Action\Context $context, OrderLoaderInterface $orderLoader, - Registry $registry + Registry $registry, + ReorderHelper $reorderHelper = null ) { $this->orderLoader = $orderLoader; $this->_coreRegistry = $registry; + $this->reorderHelper = $reorderHelper ?: ObjectManager::getInstance()->get(ReorderHelper::class); parent::__construct($context); } @@ -57,6 +71,11 @@ public function execute() /** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */ $resultRedirect = $this->resultRedirectFactory->create(); + if (!$this->reorderHelper->canReorder($order->getId())) { + $this->messageManager->addErrorMessage(__("Reorder is not available.")); + return $resultRedirect->setPath('checkout/cart'); + } + /* @var $cart \Magento\Checkout\Model\Cart */ $cart = $this->_objectManager->get(\Magento\Checkout\Model\Cart::class); $items = $order->getItemsCollection(); diff --git a/app/code/Magento/Sales/Test/Unit/Controller/Guest/ReorderTest.php b/app/code/Magento/Sales/Test/Unit/Controller/Guest/ReorderTest.php new file mode 100644 index 0000000000000..62c3b46379ae5 --- /dev/null +++ b/app/code/Magento/Sales/Test/Unit/Controller/Guest/ReorderTest.php @@ -0,0 +1,141 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\Sales\Test\Unit\Controller\Guest; + +use Magento\Framework\App\Action\Context; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\App\RequestInterface; +use Magento\Framework\Controller\Result\Redirect; +use Magento\Framework\Controller\Result\RedirectFactory; +use Magento\Framework\Message\ManagerInterface as MessageManagerInterface; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Registry; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\Sales\Controller\Guest\OrderLoader; +use Magento\Sales\Controller\Guest\Reorder; +use Magento\Sales\Helper\Reorder as ReorderHelper; +use Magento\Sales\Model\Order; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +class ReorderTest extends TestCase +{ + /** + * Stub Order Id + */ + private const STUB_ORDER_ID = 1; + + /** + * @var Reorder + */ + private $reorder; + + /** + * @var Context|MockObject + */ + private $contextMock; + + /** + * @var Registry|MockObject + */ + private $registryMock; + + /** + * @var OrderLoader|MockObject + */ + private $orderLoaderMock; + + /** + * @var RequestInterface|MockObject + */ + private $requestMock; + + /** + * @var RedirectFactory|MockObject + */ + private $resultRedirectFactoryMock; + + /** + * @var ReorderHelper|MockObject + */ + private $reorderHelperMock; + + /** + * @var MessageManagerInterface|MockObject + */ + private $messageManagerMock; + + /** + * Setup environment for test + */ + protected function setUp() + { + $this->contextMock = $this->createMock(Context::class); + $this->registryMock = $this->createMock(Registry::class); + $this->orderLoaderMock = $this->createMock(OrderLoader::class); + $this->requestMock = $this->createMock(RequestInterface::class); + $this->resultRedirectFactoryMock = $this->createMock(RedirectFactory::class); + $this->reorderHelperMock = $this->createMock(ReorderHelper::class); + $this->messageManagerMock = $this->createMock(MessageManagerInterface::class); + + $this->contextMock->expects($this->once())->method('getRequest')->willReturn($this->requestMock); + $this->contextMock->expects($this->once())->method('getResultRedirectFactory') + ->willReturn($this->resultRedirectFactoryMock); + $this->contextMock->expects($this->once())->method('getMessageManager') + ->willReturn($this->messageManagerMock); + + $objectManagerMock = $this->createMock(ObjectManagerInterface::class); + $objectManagerMock->expects($this->once())->method('get') + ->with(ReorderHelper::class) + ->willReturn($this->reorderHelperMock); + + ObjectManager::setInstance($objectManagerMock); + + $objectManager = new ObjectManagerHelper($this); + $this->reorder = $objectManager->getObject( + Reorder::class, + [ + 'context' => $this->contextMock, + 'orderLoader' => $this->orderLoaderMock, + 'registry' => $this->registryMock + ] + ); + } + + /** + * Test execute() with the reorder is not allowed + */ + public function testExecuteWithReorderIsNotAllowed() + { + $this->orderLoaderMock->method('load') + ->with($this->requestMock) + ->willReturn($this->resultRedirectFactoryMock); + $orderMock = $this->createMock(Order::class); + $orderMock->method('getId')->willReturn(self::STUB_ORDER_ID); + $this->registryMock->expects($this->once())->method('registry') + ->with('current_order') + ->willReturn($orderMock); + + $resultRedirectMock = $this->createMock(Redirect::class); + $this->resultRedirectFactoryMock->expects($this->once())->method('create')->willReturn($resultRedirectMock); + $this->reorderHelperMock->method('canReorder')->with(self::STUB_ORDER_ID) + ->willReturn(false); + + /** Expected Error Message */ + $this->messageManagerMock->expects($this->once()) + ->method('addErrorMessage') + ->with('Reorder is not available.')->willReturnSelf(); + $resultRedirectMock->expects($this->once()) + ->method('setPath') + ->with('checkout/cart')->willReturnSelf(); + + /** Assert result */ + $this->assertEquals($resultRedirectMock, $this->reorder->execute()); + } +} diff --git a/app/code/Magento/Sales/i18n/en_US.csv b/app/code/Magento/Sales/i18n/en_US.csv index f30315437533f..e468235ee38ed 100644 --- a/app/code/Magento/Sales/i18n/en_US.csv +++ b/app/code/Magento/Sales/i18n/en_US.csv @@ -799,3 +799,5 @@ Refunds,Refunds "Allow Zero GrandTotal","Allow Zero GrandTotal" "Could not save the shipment tracking","Could not save the shipment tracking" "Please enter a coupon code!","Please enter a coupon code!" +"Please enter a coupon code!","Please enter a coupon code!" +"Reorder is not available.","Reorder is not available." From 0a1ae3b37f3c1b937a2000f6f7f45205a3d32145 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Sun, 15 Dec 2019 11:30:51 +0700 Subject: [PATCH 0407/1143] Refactor filter factory test --- .../Catalog/Test/Unit/Ui/Component/FilterFactoryTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Ui/Component/FilterFactoryTest.php b/app/code/Magento/Catalog/Test/Unit/Ui/Component/FilterFactoryTest.php index e19284447c07d..1e72b7ba35864 100644 --- a/app/code/Magento/Catalog/Test/Unit/Ui/Component/FilterFactoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Ui/Component/FilterFactoryTest.php @@ -86,7 +86,7 @@ public function testCreateWithUseSourceAttribute() $sourceMock->method('getAllOptions')->willReturn(self::STUB_ATTRIBUTE['all_options']); $this->componentFactoryMock->expects($this->once()) ->method('create') - ->with('color', 'filterSelect', [ + ->with(self::STUB_ATTRIBUTE['attribute_code'], 'filterSelect', [ 'data' => [ 'config' => [ 'options' => self::STUB_ATTRIBUTE['all_options'], From 3e456b29a421a03f635f0d22701bf378c935f9b0 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Sun, 15 Dec 2019 12:30:00 +0700 Subject: [PATCH 0408/1143] Fix static test --- .../Test/Unit/Controller/Guest/ReorderTest.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/Sales/Test/Unit/Controller/Guest/ReorderTest.php b/app/code/Magento/Sales/Test/Unit/Controller/Guest/ReorderTest.php index 62c3b46379ae5..1ba8ba0638cca 100644 --- a/app/code/Magento/Sales/Test/Unit/Controller/Guest/ReorderTest.php +++ b/app/code/Magento/Sales/Test/Unit/Controller/Guest/ReorderTest.php @@ -36,11 +36,6 @@ class ReorderTest extends TestCase */ private $reorder; - /** - * @var Context|MockObject - */ - private $contextMock; - /** * @var Registry|MockObject */ @@ -76,7 +71,7 @@ class ReorderTest extends TestCase */ protected function setUp() { - $this->contextMock = $this->createMock(Context::class); + $contextMock = $this->createMock(Context::class); $this->registryMock = $this->createMock(Registry::class); $this->orderLoaderMock = $this->createMock(OrderLoader::class); $this->requestMock = $this->createMock(RequestInterface::class); @@ -84,10 +79,10 @@ protected function setUp() $this->reorderHelperMock = $this->createMock(ReorderHelper::class); $this->messageManagerMock = $this->createMock(MessageManagerInterface::class); - $this->contextMock->expects($this->once())->method('getRequest')->willReturn($this->requestMock); - $this->contextMock->expects($this->once())->method('getResultRedirectFactory') + $contextMock->expects($this->once())->method('getRequest')->willReturn($this->requestMock); + $contextMock->expects($this->once())->method('getResultRedirectFactory') ->willReturn($this->resultRedirectFactoryMock); - $this->contextMock->expects($this->once())->method('getMessageManager') + $contextMock->expects($this->once())->method('getMessageManager') ->willReturn($this->messageManagerMock); $objectManagerMock = $this->createMock(ObjectManagerInterface::class); @@ -101,7 +96,7 @@ protected function setUp() $this->reorder = $objectManager->getObject( Reorder::class, [ - 'context' => $this->contextMock, + 'context' => $contextMock, 'orderLoader' => $this->orderLoaderMock, 'registry' => $this->registryMock ] From 8928539dea7d79501b888d2affdd00220952bb72 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Sun, 15 Dec 2019 14:39:46 +0700 Subject: [PATCH 0409/1143] Fix static test --- .../Magento/Sales/Test/Unit/Controller/Guest/ReorderTest.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/code/Magento/Sales/Test/Unit/Controller/Guest/ReorderTest.php b/app/code/Magento/Sales/Test/Unit/Controller/Guest/ReorderTest.php index 1ba8ba0638cca..c8d9ae53d4e47 100644 --- a/app/code/Magento/Sales/Test/Unit/Controller/Guest/ReorderTest.php +++ b/app/code/Magento/Sales/Test/Unit/Controller/Guest/ReorderTest.php @@ -24,6 +24,11 @@ use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; +/** + * Test class for Reorder + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class ReorderTest extends TestCase { /** From 74ffaf38a237204517d51e6cfd21421949335979 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Sun, 15 Dec 2019 17:14:59 +0700 Subject: [PATCH 0410/1143] Fix static test --- .../Sales/Controller/AbstractController/Reorder.php | 2 -- .../Sales/Test/Unit/Controller/Guest/ReorderTest.php | 10 ++++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Sales/Controller/AbstractController/Reorder.php b/app/code/Magento/Sales/Controller/AbstractController/Reorder.php index 9a3c710c60b9f..f53ecaa625bf5 100644 --- a/app/code/Magento/Sales/Controller/AbstractController/Reorder.php +++ b/app/code/Magento/Sales/Controller/AbstractController/Reorder.php @@ -16,8 +16,6 @@ /** * Abstract class for controllers Reorder(Customer) and Reorder(Guest) - * - * Class Magento\Sales\Controller\AbstractController\Reorder */ abstract class Reorder extends Action\Action implements HttpPostActionInterface { diff --git a/app/code/Magento/Sales/Test/Unit/Controller/Guest/ReorderTest.php b/app/code/Magento/Sales/Test/Unit/Controller/Guest/ReorderTest.php index c8d9ae53d4e47..964a10f232daf 100644 --- a/app/code/Magento/Sales/Test/Unit/Controller/Guest/ReorderTest.php +++ b/app/code/Magento/Sales/Test/Unit/Controller/Guest/ReorderTest.php @@ -113,17 +113,23 @@ protected function setUp() */ public function testExecuteWithReorderIsNotAllowed() { + $orderMock = $this->createMock(Order::class); + $orderMock->method('getId')->willReturn(self::STUB_ORDER_ID); + $this->orderLoaderMock->method('load') ->with($this->requestMock) ->willReturn($this->resultRedirectFactoryMock); - $orderMock = $this->createMock(Order::class); - $orderMock->method('getId')->willReturn(self::STUB_ORDER_ID); + $this->registryMock->expects($this->once())->method('registry') ->with('current_order') ->willReturn($orderMock); + $this->reorderHelperMock->method('canReorder')->with(self::STUB_ORDER_ID) + ->willReturn(false); + $resultRedirectMock = $this->createMock(Redirect::class); $this->resultRedirectFactoryMock->expects($this->once())->method('create')->willReturn($resultRedirectMock); + $this->reorderHelperMock->method('canReorder')->with(self::STUB_ORDER_ID) ->willReturn(false); From 56bf55ed2975af90f2daf646eee540f043831a99 Mon Sep 17 00:00:00 2001 From: Sathish <srsathish92@gmail.com> Date: Mon, 16 Dec 2019 01:16:57 +0530 Subject: [PATCH 0411/1143] [Contact] covered Model Config by Unit Test --- .../Contact/Test/Unit/Model/ConfigTest.php | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 app/code/Magento/Contact/Test/Unit/Model/ConfigTest.php diff --git a/app/code/Magento/Contact/Test/Unit/Model/ConfigTest.php b/app/code/Magento/Contact/Test/Unit/Model/ConfigTest.php new file mode 100644 index 0000000000000..56351bae87698 --- /dev/null +++ b/app/code/Magento/Contact/Test/Unit/Model/ConfigTest.php @@ -0,0 +1,127 @@ +<?php + +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\Contact\Test\Unit\Model; + +use Magento\Contact\Model\Config; +use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\MockObject\MockObject; +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Store\Model\ScopeInterface; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; + +/** + * Unit test for Magento\Contact\Model\Config + */ +class ConfigTest extends TestCase +{ + /** + * @var Config + */ + private $model; + + /** + * @var ScopeConfigInterface|MockObject + */ + private $scopeConfigMock; + + /** + * @inheritdoc + */ + protected function setUp(): void + { + $this->scopeConfigMock = $this->getMockBuilder(ScopeConfigInterface::class) + ->setMethods(['getValue', 'isSetFlag']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $objectManager = new ObjectManagerHelper($this); + $this->model = $objectManager->getObject( + Config::class, + [ + 'scopeConfig' => $this->scopeConfigMock + ] + ); + } + + /** + * Test isEnabled() + * + * @return void + */ + public function testIsEnabled(): void + { + $this->scopeConfigMock->expects($this->once()) + ->method('isSetFlag') + ->with(config::XML_PATH_ENABLED, ScopeInterface::SCOPE_STORE) + ->willReturn(true); + + $this->assertTrue(true, $this->model->isEnabled()); + } + + /** + * Test isNotEnabled() + * + * @return void + */ + public function testIsNotEnabled(): void + { + $this->scopeConfigMock->expects($this->once()) + ->method('isSetFlag') + ->with(config::XML_PATH_ENABLED, ScopeInterface::SCOPE_STORE) + ->willReturn(false); + + $this->assertFalse(false, $this->model->isEnabled()); + } + + /** + * Test emailTemplate() + * + * @return void + */ + public function testEmailTemplate(): void + { + $this->scopeConfigMock->expects($this->once()) + ->method('getValue') + ->with(config::XML_PATH_EMAIL_TEMPLATE, ScopeInterface::SCOPE_STORE) + ->willReturn('contact_email_email_template'); + + $this->assertEquals('contact_email_email_template', $this->model->emailTemplate()); + } + + /** + * Test emailSender() + * + * @return void + */ + public function testEmailSender(): void + { + $this->scopeConfigMock->expects($this->once()) + ->method('getValue') + ->with(config::XML_PATH_EMAIL_SENDER, ScopeInterface::SCOPE_STORE) + ->willReturn('custom2'); + + $this->assertEquals('custom2', $this->model->emailSender()); + } + + /** + * Test emailRecipient() + * + * @return void + */ + public function testEmailRecipient(): void + { + $this->scopeConfigMock->expects($this->once()) + ->method('getValue') + ->with(config::XML_PATH_EMAIL_RECIPIENT, ScopeInterface::SCOPE_STORE) + ->willReturn('hello@example.com'); + + $this->assertEquals('hello@example.com', $this->model->emailRecipient()); + } +} From 929a2c4edcf79242ca4cbdebe8bdaa019f4d8257 Mon Sep 17 00:00:00 2001 From: Matheus Gontijo <matheus@matheusgontijo.com> Date: Sun, 15 Dec 2019 17:24:11 -0300 Subject: [PATCH 0412/1143] fixed typo: "reviwGrid" to "reviewGrid" --- app/code/Magento/Review/Block/Adminhtml/Grid.php | 2 +- .../Review/Test/Mftf/Section/AdminReviewGridSection.xml | 8 ++++---- .../Test/Block/Adminhtml/Customer/Edit/Tab/Reviews.php | 2 +- .../app/Magento/Review/Test/Block/Adminhtml/Grid.php | 2 +- .../Magento/Review/Test/Page/Adminhtml/ReviewIndex.xml | 2 +- .../Magento/Customer/Controller/Adminhtml/IndexTest.php | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Review/Block/Adminhtml/Grid.php b/app/code/Magento/Review/Block/Adminhtml/Grid.php index 02477bb89610f..e20cb7554e094 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Grid.php +++ b/app/code/Magento/Review/Block/Adminhtml/Grid.php @@ -90,7 +90,7 @@ public function __construct( protected function _construct() { parent::_construct(); - $this->setId('reviwGrid'); + $this->setId('reviewGrid'); $this->setDefaultSort('created_at'); } diff --git a/app/code/Magento/Review/Test/Mftf/Section/AdminReviewGridSection.xml b/app/code/Magento/Review/Test/Mftf/Section/AdminReviewGridSection.xml index 2c5588cf2645b..981de91f357cb 100644 --- a/app/code/Magento/Review/Test/Mftf/Section/AdminReviewGridSection.xml +++ b/app/code/Magento/Review/Test/Mftf/Section/AdminReviewGridSection.xml @@ -9,11 +9,11 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminReviewGridSection"> - <element name="nickname" type="input" selector="#reviwGrid_filter_nickname"/> - <element name="status" type="select" selector="#reviwGrid_filter_status"/> + <element name="nickname" type="input" selector="#reviewGrid_filter_nickname"/> + <element name="status" type="select" selector="#reviewGrid_filter_status"/> <element name="firstRow" type="block" selector=".data-grid tbody tr:nth-of-type(1)"/> - <element name="massActions" type="button" selector="#reviwGrid_massaction-mass-select"/> - <element name="massActionsSelect" type="button" selector="#reviwGrid_massaction-select"/> + <element name="massActions" type="button" selector="#reviewGrid_massaction-mass-select"/> + <element name="massActionsSelect" type="button" selector="#reviewGrid_massaction-select"/> <element name="submit" type="button" selector=".admin__grid-massaction-form .action-default.scalable"/> <element name="acceptModal" type="button" selector=".modal-popup.confirm button.action-accept"/> </section> diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/Customer/Edit/Tab/Reviews.php b/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/Customer/Edit/Tab/Reviews.php index cd46dc24ee3e9..5000fb838ec73 100644 --- a/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/Customer/Edit/Tab/Reviews.php +++ b/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/Customer/Edit/Tab/Reviews.php @@ -18,7 +18,7 @@ class Reviews extends Tab * * @var string */ - protected $reviews = '#reviwGrid'; + protected $reviews = '#reviewGrid'; /** * Returns product reviews grid. diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/Grid.php b/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/Grid.php index 7614cd332bd04..23f877b96f3a2 100644 --- a/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/Grid.php +++ b/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/Grid.php @@ -27,7 +27,7 @@ class Grid extends GridAbstract 'selector' => 'input[name="title"]', ], 'status' => [ - 'selector' => '#reviwGrid_filter_status', + 'selector' => '#reviewGrid_filter_status', 'input' => 'select', ], 'nickname' => [ diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewIndex.xml b/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewIndex.xml index fa77210b11875..c533067e9516e 100644 --- a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewIndex.xml @@ -8,7 +8,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="ReviewIndex" area="Adminhtml" mca="review/product/index" module="Magento_Review"> <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector" /> - <block name="reviewGrid" class="Magento\Review\Test\Block\Adminhtml\Grid" locator="#reviwGrid" strategy="css selector" /> + <block name="reviewGrid" class="Magento\Review\Test\Block\Adminhtml\Grid" locator="#reviewGrid" strategy="css selector" /> <block name="reviewActions" class="Magento\Backend\Test\Block\GridPageActions" locator=".page-main-actions" strategy="css selector" /> </page> </config> diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php index 1b7f2c1f7efdd..b3826cd8daa8d 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php @@ -444,7 +444,7 @@ public function testProductReviewsAction() $this->getRequest()->setParam('id', 1); $this->dispatch('backend/customer/index/productReviews'); $body = $this->getResponse()->getBody(); - $this->assertContains('<div id="reviwGrid"', $body); + $this->assertContains('<div id="reviewGrid"', $body); } /** From 9b1883458be9e7c2481df3b08ca1865798921b1d Mon Sep 17 00:00:00 2001 From: Sathish <srsathish92@gmail.com> Date: Mon, 16 Dec 2019 02:18:28 +0530 Subject: [PATCH 0413/1143] Assert updated --- app/code/Magento/Contact/Test/Unit/Model/ConfigTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Contact/Test/Unit/Model/ConfigTest.php b/app/code/Magento/Contact/Test/Unit/Model/ConfigTest.php index 56351bae87698..a665b6b71c8c9 100644 --- a/app/code/Magento/Contact/Test/Unit/Model/ConfigTest.php +++ b/app/code/Magento/Contact/Test/Unit/Model/ConfigTest.php @@ -62,7 +62,7 @@ public function testIsEnabled(): void ->with(config::XML_PATH_ENABLED, ScopeInterface::SCOPE_STORE) ->willReturn(true); - $this->assertTrue(true, $this->model->isEnabled()); + $this->assertTrue($this->model->isEnabled()); } /** @@ -77,7 +77,7 @@ public function testIsNotEnabled(): void ->with(config::XML_PATH_ENABLED, ScopeInterface::SCOPE_STORE) ->willReturn(false); - $this->assertFalse(false, $this->model->isEnabled()); + $this->assertFalse($this->model->isEnabled()); } /** From 3fdf545e50e97eead23b184574beccb34ccbc49a Mon Sep 17 00:00:00 2001 From: pawankparmar <comp1@comp1-All-Series> Date: Mon, 16 Dec 2019 09:39:13 +0530 Subject: [PATCH 0414/1143] fix static test change --- .../Api/Data/ProductRender/FormattedPriceInfoInterface.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Api/Data/ProductRender/FormattedPriceInfoInterface.php b/app/code/Magento/Catalog/Api/Data/ProductRender/FormattedPriceInfoInterface.php index 65ff84ef719f0..a79033035ca22 100644 --- a/app/code/Magento/Catalog/Api/Data/ProductRender/FormattedPriceInfoInterface.php +++ b/app/code/Magento/Catalog/Api/Data/ProductRender/FormattedPriceInfoInterface.php @@ -164,4 +164,4 @@ public function getExtensionAttributes(); public function setExtensionAttributes( \Magento\Catalog\Api\Data\ProductRender\FormattedPriceInfoExtensionInterface $extensionAttributes ); -} +} \ No newline at end of file From 1d63932dadfaa6c604b599f28fbc3a4278fb9443 Mon Sep 17 00:00:00 2001 From: pawankparmar <comp1@comp1-All-Series> Date: Mon, 16 Dec 2019 10:13:18 +0530 Subject: [PATCH 0415/1143] fix static test change with phpcbf --- .../FormattedPriceInfoInterface.php | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/app/code/Magento/Catalog/Api/Data/ProductRender/FormattedPriceInfoInterface.php b/app/code/Magento/Catalog/Api/Data/ProductRender/FormattedPriceInfoInterface.php index a79033035ca22..5f192dcd98a17 100644 --- a/app/code/Magento/Catalog/Api/Data/ProductRender/FormattedPriceInfoInterface.php +++ b/app/code/Magento/Catalog/Api/Data/ProductRender/FormattedPriceInfoInterface.php @@ -23,7 +23,7 @@ interface FormattedPriceInfoInterface extends \Magento\Framework\Api\ExtensibleD * Retrieve html with final price * * @return string - * @since 101.1.0 + * @since 101.1.0 */ public function getFinalPrice(); @@ -31,9 +31,9 @@ public function getFinalPrice(); * Set the final price: usually it calculated as minimal price of the product * Can be different depends on type of product * - * @param string $finalPrice + * @param string $finalPrice * @return void - * @since 101.1.0 + * @since 101.1.0 */ public function setFinalPrice($finalPrice); @@ -42,16 +42,16 @@ public function setFinalPrice($finalPrice); * E.g. for product with custom options is price with the most expensive custom option * * @return string - * @since 101.1.0 + * @since 101.1.0 */ public function getMaxPrice(); /** * Set the max price of the product * - * @param string $maxPrice + * @param string $maxPrice * @return void - * @since 101.1.0 + * @since 101.1.0 */ public function setMaxPrice($maxPrice); @@ -60,7 +60,7 @@ public function setMaxPrice($maxPrice); * The minimal price is for example, the lowest price of all variations for complex product * * @return string - * @since 101.1.0 + * @since 101.1.0 */ public function getMinimalPrice(); @@ -69,9 +69,9 @@ public function getMinimalPrice(); * Max regular price is the same, as maximum price, except of excluding calculating special price and catalog rules * in it * - * @param string $maxRegularPrice + * @param string $maxRegularPrice * @return void - * @since 101.1.0 + * @since 101.1.0 */ public function setMaxRegularPrice($maxRegularPrice); @@ -79,16 +79,16 @@ public function setMaxRegularPrice($maxRegularPrice); * Retrieve max regular price * * @return string - * @since 101.1.0 + * @since 101.1.0 */ public function getMaxRegularPrice(); /** * The minimal regular price has the same behavior of calculation as max regular price, but is opposite price * - * @param string $minRegularPrice + * @param string $minRegularPrice * @return void - * @since 101.1.0 + * @since 101.1.0 */ public function setMinimalRegularPrice($minRegularPrice); @@ -96,7 +96,7 @@ public function setMinimalRegularPrice($minRegularPrice); * Retrieve minimal regular price * * @return string - * @since 101.1.0 + * @since 101.1.0 */ public function getMinimalRegularPrice(); @@ -105,9 +105,9 @@ public function getMinimalRegularPrice(); * * Special price - is temporary price, that can be set to specific product * - * @param string $specialPrice + * @param string $specialPrice * @return void - * @since 101.1.0 + * @since 101.1.0 */ public function setSpecialPrice($specialPrice); @@ -115,16 +115,16 @@ public function setSpecialPrice($specialPrice); * Retrieve special price * * @return string - * @since 101.1.0 + * @since 101.1.0 */ public function getSpecialPrice(); /** * Set minimal price * - * @param string $minimalPrice + * @param string $minimalPrice * @return void - * @since 101.1.0 + * @since 101.1.0 */ public function setMinimalPrice($minimalPrice); @@ -133,16 +133,16 @@ public function setMinimalPrice($minimalPrice); * Usually this price is corresponding to price in admin panel of product * * @return string - * @since 101.1.0 + * @since 101.1.0 */ public function getRegularPrice(); /** * Set regular price * - * @param string $regularPrice + * @param string $regularPrice * @return void - * @since 101.1.0 + * @since 101.1.0 */ public function setRegularPrice($regularPrice); @@ -150,16 +150,16 @@ public function setRegularPrice($regularPrice); * Retrieve existing extension attributes object or create a new one. * * @return \Magento\Catalog\Api\Data\ProductRender\FormattedPriceInfoExtensionInterface|null - * @since 101.1.0 + * @since 101.1.0 */ public function getExtensionAttributes(); /** * Set an extension attributes object. * - * @param \Magento\Catalog\Api\Data\ProductRender\FormattedPriceInfoExtensionInterface $extensionAttributes + * @param \Magento\Catalog\Api\Data\ProductRender\FormattedPriceInfoExtensionInterface $extensionAttributes * @return $this - * @since 101.1.0 + * @since 101.1.0 */ public function setExtensionAttributes( \Magento\Catalog\Api\Data\ProductRender\FormattedPriceInfoExtensionInterface $extensionAttributes From 4b0178429b1c75e456d7d433caa37148ea3657fb Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Sun, 15 Dec 2019 22:45:20 -0600 Subject: [PATCH 0416/1143] Change action groups name according to CE branch changes --- .../Test/AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.xml | 2 +- .../AdminDeleteCmsPageUrlRewriteWithPermanentRedirectTest.xml | 2 +- .../AdminDeleteCmsPageUrlRewriteWithTemporaryRedirectTest.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.xml index b6cd116956812..82dc8d9ef7377 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.xml @@ -40,7 +40,7 @@ </actionGroup> <!--Delete the URL Rewrite for CMS Page with No redirects--> - <actionGroup ref="AdminDeleteUrlRewrite" stepKey="deleteCustomUrlRewrite"> + <actionGroup ref="AdminDeleteUrlRewriteActionGroup" stepKey="deleteCustomUrlRewrite"> <argument name="requestPath" value="newrequestpath"/> </actionGroup> <actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="assertSuccessMessage"> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithPermanentRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithPermanentRedirectTest.xml index 1f76493bac89c..53be81c19f4f1 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithPermanentRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithPermanentRedirectTest.xml @@ -40,7 +40,7 @@ </actionGroup> <!-- Delete the URL Rewrite for CMS Page with permanent redirect--> - <actionGroup ref="AdminDeleteUrlRewrite" stepKey="deletePermanentUrlRewrite"> + <actionGroup ref="AdminDeleteUrlRewriteActionGroup" stepKey="deletePermanentUrlRewrite"> <argument name="requestPath" value="permanentrequestpath.html"/> </actionGroup> <actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="assertSuccessMessage"> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithTemporaryRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithTemporaryRedirectTest.xml index c62f0ece7e780..a5a0be6df767f 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithTemporaryRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithTemporaryRedirectTest.xml @@ -40,7 +40,7 @@ </actionGroup> <!-- Delete the URL Rewrite for CMS Page with with temporary redirect--> - <actionGroup ref="AdminDeleteUrlRewrite" stepKey="deleteTemporaryUrlRewrite"> + <actionGroup ref="AdminDeleteUrlRewriteActionGroup" stepKey="deleteTemporaryUrlRewrite"> <argument name="requestPath" value="temporaryrequestpath.html"/> </actionGroup> <actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="assertSuccessMessage"> From 454330355f7a166d53a4e7bc6bed68973b6be445 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Sun, 15 Dec 2019 23:04:20 -0600 Subject: [PATCH 0417/1143] Change action groups name according to CE branch changes --- .../Test/AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.xml index 82dc8d9ef7377..94065ec059840 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.xml @@ -48,7 +48,7 @@ </actionGroup> <!--Search and verify AssertUrlRewriteNotInGrid--> - <actionGroup ref="AdminSearchDeletedUrlRewrite" stepKey="searchDeletedUrlRewriteInGrid"> + <actionGroup ref="AdminSearchDeletedUrlRewriteActionGroup" stepKey="searchDeletedUrlRewriteInGrid"> <argument name="requestPath" value="newrequestpath"/> </actionGroup> From 804e2f857ec9ad192781c292a5ee3295de10d457 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Mon, 16 Dec 2019 12:08:41 +0700 Subject: [PATCH 0418/1143] [Downloadable] Cover the Observer SetHasDownloadableProductsObserver by Unit Test --- ...SetHasDownloadableProductsObserverTest.php | 185 ++++++++++++++++++ 1 file changed, 185 insertions(+) create mode 100644 app/code/Magento/Downloadable/Test/Unit/Observer/SetHasDownloadableProductsObserverTest.php diff --git a/app/code/Magento/Downloadable/Test/Unit/Observer/SetHasDownloadableProductsObserverTest.php b/app/code/Magento/Downloadable/Test/Unit/Observer/SetHasDownloadableProductsObserverTest.php new file mode 100644 index 0000000000000..cd79049465d06 --- /dev/null +++ b/app/code/Magento/Downloadable/Test/Unit/Observer/SetHasDownloadableProductsObserverTest.php @@ -0,0 +1,185 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\Downloadable\Test\Unit\Observer; + +use Magento\Catalog\Model\Product\Type as ProductType; +use Magento\Checkout\Model\Session as CheckoutSession; +use Magento\Downloadable\Model\Product\Type as DownloadableProductType; +use Magento\Downloadable\Observer\SetHasDownloadableProductsObserver; +use Magento\Framework\DataObject; +use Magento\Framework\Event\Observer; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Sales\Model\Order; +use Magento\Sales\Model\Order\Item; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +class SetHasDownloadableProductsObserverTest extends TestCase +{ + /** + * @var ObjectManager + */ + private $objectManager; + + /** + * @var CheckoutSession|MockObject + */ + private $checkoutSessionMock; + + /** + * @var SetHasDownloadableProductsObserver + */ + private $setHasDownloadableProductsObserver; + + /** + * @var Order|MockObject + */ + private $orderMock; + + /** + * Setup environment for test + */ + protected function setUp() + { + $this->objectManager = new ObjectManager($this); + + $this->orderMock = $this->createPartialMock(Order::class, ['getAllItems']); + + $this->checkoutSessionMock = $this->createPartialMock( + CheckoutSession::class, + [ + 'getHasDownloadableProducts', + 'setHasDownloadableProducts' + ] + ); + + + $this->setHasDownloadableProductsObserver = $this->objectManager->getObject( + SetHasDownloadableProductsObserver::class, + [ + 'checkoutSession' => $this->checkoutSessionMock + ] + ); + } + + /** + * Test execute with session has downloadable products + */ + public function testExecuteWithSessionHasDownloadableProducts() + { + $event = new DataObject(['item' => $this->orderMock]); + $observer = new Observer(['event' => $event]); + + $this->checkoutSessionMock->method('getHasDownloadableProducts')->willReturn(true); + $this->orderMock->method('getAllItems')->willReturn([]); + + $this->checkoutSessionMock->expects($this->never()) + ->method('setHasDownloadableProducts')->with(true); + + $this->setHasDownloadableProductsObserver->execute($observer); + } + + /** + * Test execute with session has no downloadable products with the data provider + * + * @dataProvider executeWithSessionNoDownloadableProductsDataProvider + */ + public function testExecuteWithSessionNoDownloadableProducts($allItems, $expectedCall) + { + $event = new DataObject(['order' => $this->orderMock]); + $observer = new Observer(['event' => $event]); + + $allOrderItemsMock = []; + foreach ($allItems as $item) { + $allOrderItemsMock[] = $this->createOrderItem(...$item); + } + + $this->checkoutSessionMock->method('getHasDownloadableProducts')->willReturn(false); + + $this->orderMock->method('getAllItems')->willReturn($allOrderItemsMock); + + $this->checkoutSessionMock->expects($expectedCall) + ->method('setHasDownloadableProducts')->with(true); + + $this->setHasDownloadableProductsObserver->execute($observer); + } + + /** + * Create Order Item Mock + * + * @param string $productType + * @param string $realProductType + * @param string $isDownloadable + * @return Item|MockObject + */ + private function createOrderItem( + $productType = DownloadableProductType::TYPE_DOWNLOADABLE, + $realProductType = DownloadableProductType::TYPE_DOWNLOADABLE, + $isDownloadable = '1' + ) { + $item = $this->createPartialMock( + Item::class, + ['getProductType', 'getRealProductType', 'getProductOptionByCode'] + ); + + $item->expects($this->any()) + ->method('getProductType') + ->willReturn($productType); + $item->expects($this->any()) + ->method('getRealProductType') + ->willReturn($realProductType); + $item->expects($this->any()) + ->method('getProductOptionByCode') + ->with('is_downloadable') + ->willReturn($isDownloadable); + + return $item; + } + + /** + * Data Provider for test execute with session has no downloadable product + * + * @return array + */ + public function executeWithSessionNoDownloadableProductsDataProvider() + { + return [ + 'Order has once item is downloadable product' => [ + [ + [ + DownloadableProductType::TYPE_DOWNLOADABLE, + DownloadableProductType::TYPE_DOWNLOADABLE, + '1' + ], + [ + ProductType::TYPE_SIMPLE, + ProductType::TYPE_SIMPLE, + '1' + ] + ], + $this->once() + ], + 'Order has all items are simple product' => [ + [ + [ + ProductType::TYPE_SIMPLE, + ProductType::TYPE_SIMPLE, + '0' + ], + [ + ProductType::TYPE_SIMPLE, + ProductType::TYPE_SIMPLE, + '0' + ] + ], + $this->never() + ], + ]; + } +} From aa09a07e4c62245e0d32268acdcc270f5460ed88 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Sun, 15 Dec 2019 23:23:50 -0600 Subject: [PATCH 0419/1143] Change action groups name according to CE branch changes --- .../Test/AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.xml | 2 +- .../AdminDeleteCmsPageUrlRewriteWithPermanentRedirectTest.xml | 2 +- .../AdminDeleteCmsPageUrlRewriteWithTemporaryRedirectTest.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.xml index 94065ec059840..c40dd3256114e 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.xml @@ -53,7 +53,7 @@ </actionGroup> <!--Verify AssertPageByUrlRewriteIsNotFound--> - <actionGroup ref="AssertPageByUrlRewriteIsNotFound" stepKey="assertPageByUrlRewriteIsNotFound"> + <actionGroup ref="AssertPageByUrlRewriteIsNotFoundActionGroup" stepKey="assertPageByUrlRewriteIsNotFound"> <argument name="requestPath" value="newrequestpath"/> </actionGroup> </test> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithPermanentRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithPermanentRedirectTest.xml index 53be81c19f4f1..741be6985d517 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithPermanentRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithPermanentRedirectTest.xml @@ -48,7 +48,7 @@ </actionGroup> <!-- Verify AssertPageByUrlRewriteIsNotFound --> - <actionGroup ref="AssertPageByUrlRewriteIsNotFound" stepKey="assertPageByUrlRewriteIsNotFound"> + <actionGroup ref="AssertPageByUrlRewriteIsNotFoundActionGroup" stepKey="assertPageByUrlRewriteIsNotFound"> <argument name="requestPath" value="permanentrequestpath.html"/> </actionGroup> </test> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithTemporaryRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithTemporaryRedirectTest.xml index a5a0be6df767f..43de4123f35a8 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithTemporaryRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithTemporaryRedirectTest.xml @@ -48,7 +48,7 @@ </actionGroup> <!--Verify AssertPageByUrlRewriteIsNotFound--> - <actionGroup ref="AssertPageByUrlRewriteIsNotFound" stepKey="assertPageByUrlRewriteIsNotFound"> + <actionGroup ref="AssertPageByUrlRewriteIsNotFoundActionGroup" stepKey="assertPageByUrlRewriteIsNotFound"> <argument name="requestPath" value="temporaryrequestpath.html"/> </actionGroup> </test> From 4002829574a00a8bad40acca3cb2af116cceb17c Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Mon, 16 Dec 2019 13:00:02 +0700 Subject: [PATCH 0420/1143] Fix static test --- .../Unit/Observer/SetHasDownloadableProductsObserverTest.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/Magento/Downloadable/Test/Unit/Observer/SetHasDownloadableProductsObserverTest.php b/app/code/Magento/Downloadable/Test/Unit/Observer/SetHasDownloadableProductsObserverTest.php index cd79049465d06..53d9878f46ea2 100644 --- a/app/code/Magento/Downloadable/Test/Unit/Observer/SetHasDownloadableProductsObserverTest.php +++ b/app/code/Magento/Downloadable/Test/Unit/Observer/SetHasDownloadableProductsObserverTest.php @@ -59,7 +59,6 @@ protected function setUp() ] ); - $this->setHasDownloadableProductsObserver = $this->objectManager->getObject( SetHasDownloadableProductsObserver::class, [ @@ -150,7 +149,7 @@ private function createOrderItem( public function executeWithSessionNoDownloadableProductsDataProvider() { return [ - 'Order has once item is downloadable product' => [ + 'Order has one item is downloadable product' => [ [ [ DownloadableProductType::TYPE_DOWNLOADABLE, From 78cdd70586a7babfd78a571ac2b2454b017fbd73 Mon Sep 17 00:00:00 2001 From: Ashna-Jahan <32352950+Ashna-Jahan@users.noreply.github.com> Date: Mon, 16 Dec 2019 12:31:11 +0530 Subject: [PATCH 0421/1143] Fix the issue. --- .../backend/web/css/source/forms/fields/_control-table.less | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less b/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less index 22957cb86cb55..fce92e873e5bb 100644 --- a/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less +++ b/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less @@ -244,11 +244,10 @@ .product_form_product_form_advanced_pricing_modal .admin__control-table td, .product_form_product_form_advanced_pricing_modal .admin__control-table th { - padding: 1.3rem 0.7rem 1.3rem 0.3; overflow-y: visible; } .product_form_product_form_advanced_pricing_modal .admin__fieldset { - margin: -40px; + margin-left: -30px; } .product_form_product_form_advanced_pricing_modal .admin__control-table-wrapper { From 2ae68386fc04fda7bb6ca9748277e81983732610 Mon Sep 17 00:00:00 2001 From: Grzegorz Bogusz <grzegorz.bogusz@creativestyle.pl> Date: Mon, 16 Dec 2019 08:20:47 +0100 Subject: [PATCH 0422/1143] Adjusted code after MR --- .../Model/Product/Option/Type/Text.php | 4 +- .../Model/Product/Option/Type/TextTest.php | 62 ++++++------------- 2 files changed, 21 insertions(+), 45 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php b/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php index 0585e77734e3e..10584026b3218 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php @@ -109,8 +109,8 @@ public function getFormattedOptionValue($value) * @param string $value * @return string */ - private function normalizeNewLineSymbols($value) + private function normalizeNewLineSymbols(string $value) { - return str_replace(["\r\n", "\n\r", "\r"], ["\n", "\n", "\n"], $value); + return str_replace(["\r\n", "\n\r", "\r"], "\n", $value); } } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/TextTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/TextTest.php index 29e7f327eeb9e..194c0eb85a59e 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/TextTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/TextTest.php @@ -7,19 +7,25 @@ namespace Magento\Catalog\Model\Product\Option\Type; use Magento\Catalog\Model\Product\Option; +use Magento\Tests\NamingConvention\true\mixed; +use PHPUnit\Framework\TestCase; +use Magento\Framework\ObjectManagerInterface; +use Magento\TestFramework\Helper\Bootstrap; /** * Test for customizable product option with "Text" type */ -class TextTest extends \PHPUnit\Framework\TestCase +class TextTest extends TestCase { + const STUB_OPTION_DATA = ['id' => 11, 'type' => 'area']; + /** * @var Text */ - protected $model; + protected $optionText; /** - * @var \Magento\Framework\ObjectManagerInterface + * @var ObjectManagerInterface */ private $objectManager; @@ -28,10 +34,8 @@ class TextTest extends \PHPUnit\Framework\TestCase */ protected function setUp() { - $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->model = $this->objectManager->create( - Text::class - ); + $this->objectManager = Bootstrap::getObjectManager(); + $this->optionText = $this->objectManager->create(Text::class); } /** @@ -52,11 +56,11 @@ public function testNormalizeNewlineSymbols( ['data' => $productOptionData] ); - $this->model->setOption($productOption); - $this->model->setUserValue($optionValue); - $this->model->validateUserValue([]); + $this->optionText->setOption($productOption); + $this->optionText->setUserValue($optionValue); + $this->optionText->validateUserValue([]); - $this->assertSame($expectedOptionValue, $this->model->getUserValue()); + $this->assertSame($expectedOptionValue, $this->optionText->getUserValue()); } /** @@ -67,38 +71,10 @@ public function testNormalizeNewlineSymbols( public function optionValueDataProvider() { return [ - [ - // $productOptionData - ['id' => 11, 'type' => 'area'], - // $optionValue - 'string string', - // $expectedOptionValue - 'string string' - ], - [ - // $productOptionData - ['id' => 11, 'type' => 'area'], - // $optionValue - "string \r\n string", - // $expectedOptionValue - "string \n string" - ], - [ - // $productOptionData - ['id' => 11, 'type' => 'area'], - // $optionValue - "string \n\r string", - // $expectedOptionValue - "string \n string" - ], - [ - // $productOptionData - ['id' => 11, 'type' => 'area'], - // $optionValue - "string \r string", - // $expectedOptionValue - "string \n string" - ] + [self::STUB_OPTION_DATA, 'string string', 'string string'], + [self::STUB_OPTION_DATA, "string \r\n string", "string \n string"], + [self::STUB_OPTION_DATA, "string \n\r string", "string \n string"], + [self::STUB_OPTION_DATA, "string \r string", "string \n string"] ]; } } From 7ae9ab1fcd8eb6380b484e033cb847ecbb407643 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Mon, 16 Dec 2019 15:46:03 +0700 Subject: [PATCH 0423/1143] [Backend] Cover Dashboard Helper Data by Unit Test --- .../Test/Unit/Helper/Dashboard/DataTest.php | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 app/code/Magento/Backend/Test/Unit/Helper/Dashboard/DataTest.php diff --git a/app/code/Magento/Backend/Test/Unit/Helper/Dashboard/DataTest.php b/app/code/Magento/Backend/Test/Unit/Helper/Dashboard/DataTest.php new file mode 100644 index 0000000000000..21c72cb6b4477 --- /dev/null +++ b/app/code/Magento/Backend/Test/Unit/Helper/Dashboard/DataTest.php @@ -0,0 +1,111 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\Backend\Test\Unit\Helper\Dashboard; + +use Magento\Backend\Helper\Dashboard\Data as HelperData; +use Magento\Framework\App\DeploymentConfig; +use Magento\Framework\Config\ConfigOptionsListConstants; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Store\Model\ResourceModel\Store\Collection as StoreCollection; +use Magento\Store\Model\Store; +use Magento\Store\Model\StoreManagerInterface; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +class DataTest extends TestCase +{ + /** + * Stub path install + */ + private const STUB_PATH_INSTALL = 'Sat, 6 Sep 2014 16:46:11 UTC'; + + /** + * Stub chart data hash + */ + private const STUB_CHART_DATA_HASH = '52870842b23068a78220e01eb9d4404d'; + + /** + * @var \Magento\Backend\Helper\Dashboard\Data + */ + private $helper; + + /** + * @var StoreManagerInterface|MockObject + */ + private $storeManagerMock; + + /** + * @var DeploymentConfig|MockObject + */ + private $deploymentConfigMock; + + /** + * Prepare environment for test + */ + protected function setUp() + { + $this->storeManagerMock = $this->createMock(StoreManagerInterface::class); + $this->deploymentConfigMock = $this->createMock(DeploymentConfig::class); + $this->deploymentConfigMock->expects($this->once())->method('get') + ->with(ConfigOptionsListConstants::CONFIG_PATH_INSTALL_DATE) + ->will($this->returnValue(self::STUB_PATH_INSTALL)); + + $objectManager = new ObjectManager($this); + $this->helper = $objectManager->getObject( + HelperData::class, + [ + 'storeManager' => $this->storeManagerMock, + 'deploymentConfig' => $this->deploymentConfigMock + ] + ); + } + + /** + * Test getStores() when $_stores attribute is null + */ + public function testGetStoresWhenStoreAttributeIsNull() + { + $storeMock = $this->createPartialMock(Store::class, ['getResourceCollection']); + $storeCollectionMock = $this->createMock(StoreCollection::class); + + $storeCollectionMock->expects($this->once())->method('load')->willReturnSelf(); + $storeMock->expects($this->once())->method('getResourceCollection')->willReturn($storeCollectionMock); + $this->storeManagerMock->expects($this->once())->method('getStore')->willReturn($storeMock); + + $this->assertEquals($storeCollectionMock, $this->helper->getStores()); + } + + /** + * Test getDatePeriods() method + */ + public function testGetDatePeriods() + { + $this->assertEquals( + [ + '24h' => (string)__('Last 24 Hours'), + '7d' => (string)__('Last 7 Days'), + '1m' => (string)__('Current Month'), + '1y' => (string)__('YTD'), + '2y' => (string)__('2YTD') + ], + $this->helper->getDatePeriods() + ); + } + + /** + * Test getChartDataHash() method + */ + public function testGetChartDataHash() + { + $this->assertEquals( + self::STUB_CHART_DATA_HASH, + $this->helper->getChartDataHash(self::STUB_PATH_INSTALL) + ); + } +} From ccc399a6920c4f1c9def5536f70094a87bdf1577 Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Mon, 16 Dec 2019 10:47:25 +0200 Subject: [PATCH 0424/1143] MC-4242: Newsletter subscriptions per website --- ...esAfterChangingUrlKeyForStoreViewAndMovingCategoryTest.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategoryTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategoryTest.xml index 52dce4d67f698..716bb60ce68bd 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategoryTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategoryTest.xml @@ -29,6 +29,10 @@ <requiredEntity createDataKey="createSecondCategory"/> </createData> + <!-- Reindex and flush the cache --> + <magentoCLI command="indexer:reindex" stepKey="runReindex"/> + <magentoCLI command="cache:flush" stepKey="cleanCache"/> + <!-- Log in to backend --> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> From 6bf903f0521c7ef1f2561af6db71e391ecdc39ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Tylek?= <pawel.tylek@creativestyle.pl> Date: Mon, 16 Dec 2019 10:24:30 +0100 Subject: [PATCH 0425/1143] MAGETWO-95866 Fix tests --- .../backend/Magento_Backend/web/css/source/module/_menu.less | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/_menu.less b/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/_menu.less index c84a54efd5028..29a7499ec72f4 100644 --- a/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/_menu.less +++ b/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/_menu.less @@ -268,10 +268,10 @@ } > ul[role='menu'] { - overflow-x: auto; - overflow-y: hidden; max-width: ~'calc(100vw - @{menu__width})'; min-height: @submenu__height; + overflow-x: auto; + overflow-y: hidden; } } From b394255d6d5c1df661c2c6cd5f6507f603b2d1f9 Mon Sep 17 00:00:00 2001 From: Sathish <srsathish92@gmail.com> Date: Mon, 16 Dec 2019 15:40:13 +0530 Subject: [PATCH 0426/1143] Removed duplicated logic with data provider --- .../Contact/Test/Unit/Model/ConfigTest.php | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/app/code/Magento/Contact/Test/Unit/Model/ConfigTest.php b/app/code/Magento/Contact/Test/Unit/Model/ConfigTest.php index a665b6b71c8c9..9456ea4b48105 100644 --- a/app/code/Magento/Contact/Test/Unit/Model/ConfigTest.php +++ b/app/code/Magento/Contact/Test/Unit/Model/ConfigTest.php @@ -54,30 +54,29 @@ protected function setUp(): void * Test isEnabled() * * @return void + * @dataProvider isEnabledDataProvider */ - public function testIsEnabled(): void + public function testIsEnabled($isSetFlag, $result): void { $this->scopeConfigMock->expects($this->once()) ->method('isSetFlag') ->with(config::XML_PATH_ENABLED, ScopeInterface::SCOPE_STORE) - ->willReturn(true); + ->willReturn($isSetFlag); - $this->assertTrue($this->model->isEnabled()); + $this->assertEquals($result, $this->model->isEnabled()); } /** - * Test isNotEnabled() + * Data provider for isEnabled() * - * @return void + * @return array */ - public function testIsNotEnabled(): void + public function isEnabledDataProvider(): array { - $this->scopeConfigMock->expects($this->once()) - ->method('isSetFlag') - ->with(config::XML_PATH_ENABLED, ScopeInterface::SCOPE_STORE) - ->willReturn(false); - - $this->assertFalse($this->model->isEnabled()); + return [ + [true, true], + [false, false] + ]; } /** From b8d5c105115e4ed143fe29d99f5f5e0e89ef8521 Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Mon, 16 Dec 2019 12:21:37 +0200 Subject: [PATCH 0427/1143] MC-4242: Newsletter subscriptions per website --- ...terChangingUrlKeyForStoreViewAndMovingCategoryTest.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategoryTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategoryTest.xml index 716bb60ce68bd..0986443fd5893 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategoryTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategoryTest.xml @@ -29,15 +29,15 @@ <requiredEntity createDataKey="createSecondCategory"/> </createData> - <!-- Reindex and flush the cache --> - <magentoCLI command="indexer:reindex" stepKey="runReindex"/> - <magentoCLI command="cache:flush" stepKey="cleanCache"/> - <!-- Log in to backend --> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <!--Create additional Store View in Main Website Store --> <actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createStoreView"/> + + <!-- Reindex and flush the cache --> + <magentoCLI command="indexer:reindex" stepKey="runReindex"/> + <magentoCLI command="cache:flush" stepKey="cleanCache"/> </before> <after> <deleteData createDataKey="createFirstCategory" stepKey="deleteFirstCategory"/> From 56d198d03f6fcc9f56da78cdad53023750a1a188 Mon Sep 17 00:00:00 2001 From: Ashna-Jahan <32352950+Ashna-Jahan@users.noreply.github.com> Date: Mon, 16 Dec 2019 16:17:14 +0530 Subject: [PATCH 0428/1143] fix Allure Report issue --- .../backend/web/css/source/forms/fields/_control-table.less | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less b/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less index fce92e873e5bb..0a81223525fbd 100644 --- a/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less +++ b/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less @@ -238,7 +238,8 @@ } } -.product_form_product_form_advanced_pricing_modal .admin__fieldset > .admin__field > .admin__field-label, .product_form_product_form_advanced_pricing_modal [class*='admin__control-grouped'] > .admin__field:first-child > .admin__field-label { +.product_form_product_form_advanced_pricing_modal .admin__fieldset > .admin__field > .admin__field-label, +.product_form_product_form_advanced_pricing_modal [class*='admin__control-grouped'] > .admin__field:first-child > .admin__field-label { margin-left: 0; } @@ -246,6 +247,7 @@ .product_form_product_form_advanced_pricing_modal .admin__control-table th { overflow-y: visible; } + .product_form_product_form_advanced_pricing_modal .admin__fieldset { margin-left: -30px; } From 18500e1410a96b06a7e59ac19733e84784b14cfc Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Mon, 16 Dec 2019 14:41:16 +0200 Subject: [PATCH 0429/1143] MC-4242: Newsletter subscriptions per website --- ...iesAfterChangingUrlKeyForStoreViewAndMovingCategoryTest.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategoryTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategoryTest.xml index 0986443fd5893..7b901658faa4a 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategoryTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategoryTest.xml @@ -80,7 +80,6 @@ <!-- Assert category url with custom store view --> <amOnPage url="{{StorefrontHomePage.url}}$$createSecondCategory.name$$/{{SimpleRootSubCategory.url_key}}.html" stepKey="amOnCategoryPage"/> <waitForPageLoad stepKey="waitForCategoryPageLoad"/> - <dontSee userInput="$$createSecondSimpleProduct.name$$" selector="{{StorefrontCategoryMainSection.productsList}}" stepKey="dontSeeProductInCategory"/> - <see selector="{{StorefrontCategoryMainSection.emptyProductMessage}}" userInput="We can't find products matching the selection." stepKey="seeEmptyProductMessage"/> + <see userInput="$$createFirstSimpleProduct.name$$" selector="{{StorefrontCategoryMainSection.productsList}}" stepKey="seeProductInCategory"/> </test> </tests> From 218c3ff32418c9dacb4da0ed812b226f81e8400a Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Mon, 16 Dec 2019 16:15:39 +0200 Subject: [PATCH 0430/1143] Reverting container class --- .../Theme/view/adminhtml/page_layout/admin-2columns-left.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Theme/view/adminhtml/page_layout/admin-2columns-left.xml b/app/code/Magento/Theme/view/adminhtml/page_layout/admin-2columns-left.xml index cee241233a199..9cb89746ad85d 100644 --- a/app/code/Magento/Theme/view/adminhtml/page_layout/admin-2columns-left.xml +++ b/app/code/Magento/Theme/view/adminhtml/page_layout/admin-2columns-left.xml @@ -31,7 +31,7 @@ </container> <container name="page.main.container" as="page_main_container" htmlId="page:main-container" htmlTag="div" htmlClass="page-columns"> <container name="main.col" as="main-col" htmlId="container" htmlTag="div" htmlClass="main-col"> - <container name="admin.scope.col.wrap" as="admin-scope-col-wrap" htmlTag="div" htmlClass="form-inline"> <!-- ToDo UI: remove this wrapper remove with old styles removal --> + <container name="admin.scope.col.wrap" as="admin-scope-col-wrap" htmlTag="div" htmlClass="admin__scope-old"> <!-- ToDo UI: remove this wrapper remove with old styles removal --> <container name="content" as="content"/> </container> </container> From b41122340955c4cac549e848fbdc241adab1680e Mon Sep 17 00:00:00 2001 From: "ivan.pletnyov" <ivan.pletnyov@transoftgroup.com> Date: Mon, 16 Dec 2019 16:29:44 +0200 Subject: [PATCH 0431/1143] MC-25069: Quick/Advanced Search on storefront by product attributes --- .../Controller/Advanced/ResultTest.php | 174 +++++++++++ .../Controller/Result/IndexTest.php | 55 ++++ .../Fulltext/Action/DataProviderTest.php | 95 +++--- .../Search/AttributeSearchWeightTest.php | 282 +++++++++++------- .../_files/product_for_search.php | 55 +++- .../_files/product_for_search_rollback.php | 36 ++- .../products_for_sku_search_weight_score.php | 68 ++++- ...s_for_sku_search_weight_score_rollback.php | 41 +++ .../_files/searchable_attribute.php | 77 +++-- .../Controller/Advanced/ResultTest.php | 37 +++ .../Controller/Result/IndexTest.php | 37 +++ .../fulltext/Action/DataProviderTest.php | 32 ++ .../Search/AttributeSearchWeightTest.php | 107 +++++++ 13 files changed, 888 insertions(+), 208 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/CatalogSearch/Controller/Advanced/ResultTest.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogSearch/Controller/Result/IndexTest.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogSearch/_files/products_for_sku_search_weight_score_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/Elasticsearch6/CatalogSearch/Controller/Advanced/ResultTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Elasticsearch6/CatalogSearch/Controller/Result/IndexTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Elasticsearch6/CatalogSearch/Model/Indexer/fulltext/Action/DataProviderTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Elasticsearch6/CatalogSearch/Model/Search/AttributeSearchWeightTest.php diff --git a/dev/tests/integration/testsuite/Magento/CatalogSearch/Controller/Advanced/ResultTest.php b/dev/tests/integration/testsuite/Magento/CatalogSearch/Controller/Advanced/ResultTest.php new file mode 100644 index 0000000000000..32b7df03f922d --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogSearch/Controller/Advanced/ResultTest.php @@ -0,0 +1,174 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\CatalogSearch\Controller\Advanced; + +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Catalog\Model\ResourceModel\Eav\Attribute; +use Magento\TestFramework\TestCase\AbstractController; +use Zend\Stdlib\Parameters; + +/** + * Test cases for catalog advanced search using mysql search engine. + * + * @magentoDbIsolation disabled + * @magentoAppIsolation enabled + */ +class ResultTest extends AbstractController +{ + /** + * @var ProductAttributeRepositoryInterface + */ + private $productAttributeRepository; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + $this->productAttributeRepository = $this->_objectManager->create(ProductAttributeRepositoryInterface::class); + } + + /** + * Advanced search test by difference product attributes. + * + * @magentoConfigFixture default/catalog/search/engine mysql + * @magentoAppArea frontend + * @magentoDataFixture Magento/CatalogSearch/_files/product_for_search.php + * @magentoDataFixture Magento/CatalogSearch/_files/full_reindex.php + * @dataProvider searchStringDataProvider + * + * @param array $searchParams + * @return void + */ + public function testExecute(array $searchParams): void + { + if ('' !== $searchParams['test_searchable_attribute']) { + $searchParams['test_searchable_attribute'] = $this->getAttributeOptionValueByOptionLabel( + 'test_searchable_attribute', + $searchParams['test_searchable_attribute'] + ); + } + + $this->getRequest()->setQuery( + $this->_objectManager->create( + Parameters::class, + [ + 'values' => $searchParams + ] + ) + ); + $this->dispatch('catalogsearch/advanced/result'); + $responseBody = $this->getResponse()->getBody(); + $this->assertContains('Simple product name', $responseBody); + } + + /** + * Data provider with strings for quick search. + * + * @return array + */ + public function searchStringDataProvider(): array + { + return [ + 'search_product_by_name' => [ + [ + 'name' => 'Simple product name', + 'sku' => '', + 'description' => '', + 'short_description' => '', + 'price' => [ + 'from' => '', + 'to' => '', + ], + 'test_searchable_attribute' => '', + ], + ], + 'search_product_by_sku' => [ + [ + 'name' => '', + 'sku' => 'simple_for_search', + 'description' => '', + 'short_description' => '', + 'price' => [ + 'from' => '', + 'to' => '', + ], + 'test_searchable_attribute' => '', + ], + ], + 'search_product_by_description' => [ + [ + 'name' => '', + 'sku' => '', + 'description' => 'Product description', + 'short_description' => '', + 'price' => [ + 'from' => '', + 'to' => '', + ], + 'test_searchable_attribute' => '', + ], + ], + 'search_product_by_short_description' => [ + [ + 'name' => '', + 'sku' => '', + 'description' => '', + 'short_description' => 'Product short description', + 'price' => [ + 'from' => '', + 'to' => '', + ], + 'test_searchable_attribute' => '', + ], + ], + 'search_product_by_price_range' => [ + [ + 'name' => '', + 'sku' => '', + 'description' => '', + 'short_description' => '', + 'price' => [ + 'from' => '50', + 'to' => '150', + ], + 'test_searchable_attribute' => '', + ], + ], + 'search_product_by_custom_attribute' => [ + [ + 'name' => '', + 'sku' => '', + 'description' => '', + 'short_description' => '', + 'price' => [ + 'from' => '', + 'to' => '', + ], + 'test_searchable_attribute' => 'Option 1', + ], + ], + ]; + } + + /** + * Return attribute option value by option label. + * + * @param string $attributeCode + * @param string $optionLabel + * @return null|string + */ + private function getAttributeOptionValueByOptionLabel(string $attributeCode, string $optionLabel): ?string + { + /** @var Attribute $attribute */ + $attribute = $this->productAttributeRepository->get($attributeCode); + + return $attribute->getSource()->getOptionId($optionLabel); + } +} diff --git a/dev/tests/integration/testsuite/Magento/CatalogSearch/Controller/Result/IndexTest.php b/dev/tests/integration/testsuite/Magento/CatalogSearch/Controller/Result/IndexTest.php new file mode 100644 index 0000000000000..0068d6cbaa015 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogSearch/Controller/Result/IndexTest.php @@ -0,0 +1,55 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\CatalogSearch\Controller\Result; + +use Magento\TestFramework\TestCase\AbstractController; + +/** + * Test cases for catalog quick search using mysql search engine. + * + * @magentoDbIsolation disabled + * @magentoAppIsolation enabled + */ +class IndexTest extends AbstractController +{ + /** + * Quick search test by difference product attributes. + * + * @magentoConfigFixture default/catalog/search/engine mysql + * @magentoAppArea frontend + * @magentoDataFixture Magento/CatalogSearch/_files/product_for_search.php + * @magentoDataFixture Magento/CatalogSearch/_files/full_reindex.php + * @dataProvider searchStringDataProvider + * + * @param string $searchString + * @return void + */ + public function testExecute(string $searchString): void + { + $this->getRequest()->setParam('q', $searchString); + $this->dispatch('catalogsearch/result'); + $responseBody = $this->getResponse()->getBody(); + $this->assertContains('Simple product name', $responseBody); + } + + /** + * Data provider with strings for quick search. + * + * @return array + */ + public function searchStringDataProvider(): array + { + return [ + 'search_product_by_name' => ['Simple product name'], + 'search_product_by_sku' => ['simple_for_search'], + 'search_product_by_description' => ['Product description'], + 'search_product_by_short_description' => ['Product short description'], + 'search_product_by_custom_attribute' => ['Option 1'], + ]; + } +} diff --git a/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/DataProviderTest.php b/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/DataProviderTest.php index d503c9678dfd6..c090f4ea0183c 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/DataProviderTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/DataProviderTest.php @@ -7,71 +7,84 @@ namespace Magento\CatalogSearch\Model\Indexer\Fulltext\Action; -use Magento\Catalog\Model\Product; -use Magento\Catalog\Model\ProductRepository as ProductRepository; -use Magento\CatalogSearch\Model\Indexer\Fulltext; +use Magento\Catalog\Api\ProductRepositoryInterface; use Magento\Framework\Api\Search\Document as SearchDocument; -use Magento\Framework\Indexer\IndexerRegistry; -use Magento\Framework\Search\AdapterInterface as AdapterInterface; use Magento\Framework\Search\Request\Builder as SearchRequestBuilder; use Magento\Framework\Search\Request\Config as SearchRequestConfig; use Magento\Search\Model\AdapterFactory as AdapterFactory; use Magento\TestFramework\Helper\Bootstrap; use Magento\TestFramework\ObjectManager; +use PHPUnit\Framework\TestCase; -class DataProviderTest extends \PHPUnit\Framework\TestCase +/** + * Search products by attribute value using mysql search engine. + */ +class DataProviderTest extends TestCase { + /** + * @var ObjectManager + */ + private $objectManager; + + /** + * @var SearchRequestConfig + */ + private $searchRequestConfig; + + /** + * @var SearchRequestBuilder + */ + private $requestBuilder; + + /** + * @var AdapterFactory + */ + private $adapterFactory; + + /** + * @var ProductRepositoryInterface + */ + private $productRepository; + /** * @inheritdoc */ - public static function setUpBeforeClass() + protected function setUp() { - /* - * Due to insufficient search engine isolation for Elasticsearch, this class must explicitly perform - * a fulltext reindex prior to running its tests. - * - * This should be removed upon completing MC-19455. - */ - $indexRegistry = Bootstrap::getObjectManager()->get(IndexerRegistry::class); - $fulltextIndexer = $indexRegistry->get(Fulltext::INDEXER_ID); - $fulltextIndexer->reindexAll(); + $this->objectManager = Bootstrap::getObjectManager(); + $this->searchRequestConfig = $this->objectManager->create(SearchRequestConfig::class); + $this->requestBuilder = $this->objectManager->create( + SearchRequestBuilder::class, + ['config' => $this->searchRequestConfig] + ); + $this->adapterFactory = $this->objectManager->get(AdapterFactory::class); + $this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class); + parent::setUp(); } /** + * Search product by custom attribute value. + * + * @magentoConfigFixture default/catalog/search/engine mysql * @magentoDataFixture Magento/CatalogSearch/_files/product_for_search.php + * @magentoDataFixture Magento/CatalogSearch/_files/full_reindex.php * @magentoDbIsolation disabled + * + * @return void */ - public function testSearchProductByAttribute() + public function testSearchProductByAttribute(): void { - /** @var ObjectManager $objectManager */ - $objectManager = Bootstrap::getObjectManager(); - - /** @var SearchRequestConfig $config */ - $config = $objectManager->create(SearchRequestConfig::class); - - /** @var SearchRequestBuilder $requestBuilder */ - $requestBuilder = $objectManager->create( - SearchRequestBuilder::class, - ['config' => $config] - ); - - $requestBuilder->bind('search_term', 'VALUE1'); - $requestBuilder->setRequestName('quick_search_container'); - $queryRequest = $requestBuilder->create(); - - /** @var AdapterInterface $adapter */ - $adapterFactory = $objectManager->create(AdapterFactory::class); - $adapter = $adapterFactory->create(); + $this->requestBuilder->bind('search_term', 'Option 1'); + $this->requestBuilder->setRequestName('quick_search_container'); + $queryRequest = $this->requestBuilder->create(); + $adapter = $this->adapterFactory->create(); $queryResponse = $adapter->query($queryRequest); $actualIds = []; - + /** @var SearchDocument $document */ foreach ($queryResponse as $document) { - /** @var SearchDocument $document */ $actualIds[] = $document->getId(); } - - /** @var Product $product */ - $product = $objectManager->create(ProductRepository::class)->get('simple'); + $product = $this->productRepository->get('simple_for_search'); $this->assertContains($product->getId(), $actualIds, 'Product not found by searchable attribute.'); } } diff --git a/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Search/AttributeSearchWeightTest.php b/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Search/AttributeSearchWeightTest.php index 775210669abd8..4ca8e0b0726d4 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Search/AttributeSearchWeightTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Search/AttributeSearchWeightTest.php @@ -8,172 +8,232 @@ namespace Magento\CatalogSearch\Model\Search; -use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Catalog\Model\Layer\Search as CatalogLayerSearch; use Magento\Catalog\Model\Product; -use Magento\Catalog\Model\ResourceModel\Eav\Attribute; -use Magento\Eav\Api\AttributeRepositoryInterface; -use Magento\Elasticsearch\SearchAdapter\ConnectionManager; -use Magento\Elasticsearch6\Model\Client\Elasticsearch as ElasticsearchClient; -use Magento\Framework\Exception\NoSuchEntityException; -use Magento\Framework\Exception\StateException; +use Magento\CatalogSearch\Model\ResourceModel\Fulltext\CollectionFactory; use Magento\Framework\Search\Request\Builder; use Magento\Framework\Search\Request\Config as RequestConfig; -use Magento\Framework\Search\Response\QueryResponse; -use Magento\Framework\Search\SearchEngineInterface; -use Magento\Indexer\Model\Indexer; +use Magento\Search\Model\Search; use Magento\TestFramework\Helper\Bootstrap; -use Magento\TestFramework\Helper\CacheCleaner; use Magento\TestFramework\ObjectManager; use PHPUnit\Framework\TestCase; /** - * Test for name over sku search weight of product attributes + * Test founded products order after quick search with changed attribute search weight using mysql search engine. * - * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @magentoAppIsolation enabled - * @magentoDbIsolation enabled */ class AttributeSearchWeightTest extends TestCase { - - /** @var $objectManager ObjectManager */ + /** + * @var $objectManager ObjectManager + */ private $objectManager; /** - * @var ConnectionManager + * @var ProductAttributeRepositoryInterface */ - private $connectionManager; + private $productAttributeRepository; /** - * @var ElasticsearchClient + * @var array */ - private $client; + private $collectedAttributesWeight = []; /** - * @var ProductRepositoryInterface + * @var CatalogLayerSearch */ - private $productRepository; + private $catalogLayerSearch; + /** + * @inheritdoc + */ protected function setUp() { $this->objectManager = Bootstrap::getObjectManager(); - $this->connectionManager = $this->objectManager->create(ConnectionManager::class); - $this->client = $this->connectionManager->getConnection(); - $this->productRepository = $this->objectManager->create(ProductRepositoryInterface::class); + $this->productAttributeRepository = $this->objectManager->get(ProductAttributeRepositoryInterface::class); + $this->catalogLayerSearch = $this->objectManager->get(CatalogLayerSearch::class); + $this->collectCurrentProductAttributesWeights(); } /** - * @param string $attributeName - * @param int $searchWeight - * @throws NoSuchEntityException - * @throws StateException + * @inheritdoc */ - private function setAttributeSearchWeight(string $attributeName, int $searchWeight) + protected function tearDown() { - /** @var AttributeRepositoryInterface $attributeRepository */ - $attributeRepository = $this->objectManager->create(AttributeRepositoryInterface::class); + $this->updateAttributesWeight($this->collectedAttributesWeight); + } - /** @var Attribute $attribute */ - $attribute = $attributeRepository->get('catalog_product', $attributeName); + /** + * Perform search by word and check founded product order in different cases. + * + * @magentoConfigFixture default/catalog/search/engine mysql + * @magentoDataFixture Magento/CatalogSearch/_files/products_for_sku_search_weight_score.php + * @magentoDataFixture Magento/CatalogSearch/_files/full_reindex.php + * @dataProvider attributeSearchWeightDataProvider + * @magentoDbIsolation disabled + * + * @param string $searchQuery + * @param array $attributeWeights + * @param array $expectedProductNames + * @return void + */ + public function testAttributeSearchWeight( + string $searchQuery, + array $attributeWeights, + array $expectedProductNames + ): void { + $this->updateAttributesWeight($attributeWeights); + $this->removeInstancesCache(); + $products = $this->findProducts($searchQuery); + $actualProductNames = $this->collectProductsName($products); + $this->assertEquals($expectedProductNames, $actualProductNames, 'Products order is not as expected.'); + } - if ($attribute) { - $attribute->setSearchWeight($searchWeight); - $attributeRepository->save($attribute); - } + /** + * Data provider with word for quick search, attributes weight and expected products name order. + * + * @return array + */ + public function attributeSearchWeightDataProvider(): array + { + return [ + 'sku_order_more_than_name' => [ + '1234-1234-1234-1234', + [ + 'sku' => 6, + 'name' => 5, + ], + [ + 'Simple', + '1234-1234-1234-1234', + ], + ], + 'name_order_more_than_sku' => [ + '1234-1234-1234-1234', + [ + 'name' => 6, + 'sku' => 5, + ], + [ + '1234-1234-1234-1234', + 'Simple', + ], + ], + 'search_by_word_from_description' => [ + 'Simple', + [ + 'test_searchable_attribute' => 8, + 'sku' => 6, + 'name' => 5, + 'description' => 1, + ], + [ + 'Product with attribute', + '1234-1234-1234-1234', + 'Simple', + 'Product with description', + ], + ], + 'search_by_attribute_option' => [ + 'Simple', + [ + 'description' => 10, + 'test_searchable_attribute' => 8, + 'sku' => 6, + 'name' => 1, + ], + [ + 'Product with description', + 'Product with attribute', + '1234-1234-1234-1234', + 'Simple', + ], + ], + ]; } /** - * @throws \Throwable + * Update attributes weight. + * + * @param array $attributeWeights + * @return void */ - private function reindex() + protected function updateAttributesWeight(array $attributeWeights): void { - CacheCleaner::cleanAll(); + foreach ($attributeWeights as $attributeCode => $weight) { + $attribute = $this->productAttributeRepository->get($attributeCode); - /** @var Indexer $indexer */ - $indexer = $this->objectManager->create(Indexer::class); - $indexer->load('catalogsearch_fulltext'); - $indexer->reindexAll(); + if ($attribute) { + $attribute->setSearchWeight($weight); + $this->productAttributeRepository->save($attribute); + } + } } /** - * @param string $query + * Get all names from founded products. + * + * @param Product[] $products * @return array - * @throws NoSuchEntityException */ - private function findProducts(string $query): array + protected function collectProductsName(array $products): array { - $config = $this->objectManager->create(RequestConfig::class); - - /** @var Builder $requestBuilder */ - $requestBuilder = $this->objectManager->create( - Builder::class, - ['config' => $config] - ); - $requestBuilder->bind('search_term', $query); - $requestBuilder->setRequestName('quick_search_container'); - - /** @var QueryResponse $searchResult */ - $searchResults = $this->objectManager->create(SearchEngineInterface::class) - ->search($requestBuilder->create()); - - $products = []; - foreach ($searchResults as $searchResult) { - $products [] = $this->productRepository->getById($searchResult->getId()); + $result = []; + foreach ($products as $product) { + $result[] = $product->getName(); } - return $products; + return $result; } /** - * @dataProvider skuOverNameAttributeSearchWeightDataProvider - * @magentoConfigFixture default/catalog/search/engine elasticsearch6 - * @magentoConfigFixture current_store catalog/search/elasticsearch_index_prefix composite_product_search - * @magentoDataFixture Magento/CatalogSearch/_files/products_for_sku_search_weight_score.php - * @param string $searchQuery - * @param int $skuSearchWeight - * @param int $nameSearchWeight - * @param string $firstMatchProductName - * @param string $secondMatchProductName - * @throws NoSuchEntityException - * @throws \Throwable + * Reindex catalogsearch fulltext index. + * + * @return void */ - public function testSkuOverNameAttributeSearchWeight( - string $searchQuery, - int $skuSearchWeight, - int $nameSearchWeight, - string $firstMatchProductName, - string $secondMatchProductName - ) { - $this->setAttributeSearchWeight('sku', $skuSearchWeight); - $this->setAttributeSearchWeight('name', $nameSearchWeight); - $this->reindex(); - - /** @var Product $products [] */ - $products = $this->findProducts($searchQuery); + protected function removeInstancesCache(): void + { + $this->objectManager->removeSharedInstance(RequestConfig::class); + $this->objectManager->removeSharedInstance(Builder::class); + $this->objectManager->removeSharedInstance(Search::class); + $this->objectManager->removeSharedInstance(CatalogLayerSearch::class); + } - $this->assertCount( - 2, - $products, - 'Expected to find 2 products, found ' . count($products) . '.' - ); - - $this->assertEquals( - $firstMatchProductName, - $products[0]->getData('name'), - 'Products order is not as expected.' - ); - $this->assertEquals( - $secondMatchProductName, - $products[1]->getData('name'), - 'Products order is not as expected.' - ); + /** + * Find products by search query. + * + * @param string $query + * @return Product[] + */ + protected function findProducts(string $query): array + { + $testProductCollection = $this->catalogLayerSearch->getProductCollection(); + $testProductCollection->addSearchFilter($query); + $testProductCollection->setOrder('relevance', 'desc'); + + return $testProductCollection->getItems(); } - public function skuOverNameAttributeSearchWeightDataProvider(): array + /** + * Collect weight of attributes which use in test. + * + * @return void + */ + private function collectCurrentProductAttributesWeights(): void { - return [ - ['1-2-3-4', 10, 5, 'test', '1-2-3-4'], - ['1-2-3-4', 5, 10, '1-2-3-4', 'test'], - ]; + if (empty($this->collectedAttributesWeight)) { + $attributeCodes = [ + 'sku', + 'name', + 'description', + 'test_searchable_attribute' + ]; + foreach ($attributeCodes as $attributeCode) { + $attribute = $this->productAttributeRepository->get($attributeCode); + $this->collectedAttributesWeight[$attribute->getAttributeCode()] = $attribute->getSearchWeight(); + } + } } } diff --git a/dev/tests/integration/testsuite/Magento/CatalogSearch/_files/product_for_search.php b/dev/tests/integration/testsuite/Magento/CatalogSearch/_files/product_for_search.php index afeb250a5921a..75654f8d7d272 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogSearch/_files/product_for_search.php +++ b/dev/tests/integration/testsuite/Magento/CatalogSearch/_files/product_for_search.php @@ -3,22 +3,49 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + declare(strict_types=1); require 'searchable_attribute.php'; -require __DIR__ . '/../../../Magento/Catalog/_files/product_simple.php'; - -/** @var $objectManager \Magento\TestFramework\ObjectManager */ -$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); -/** @var \Magento\Store\Model\StoreManager $storeManager */ -$storeManager = $objectManager->get(\Magento\Store\Model\StoreManager::class); -$storeManager->setIsSingleStoreModeAllowed(false); -/** @var \Magento\Store\Model\Store $store */ -$store = $storeManager->getStore('default'); +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Catalog\Model\Product\Type; +use Magento\Catalog\Model\Product\Visibility; +use Magento\Catalog\Model\ProductFactory; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\ObjectManager; -/** @var \Magento\Catalog\Model\Product $product */ -$product = $objectManager->create(\Magento\Catalog\Model\ProductRepository::class)->get('simple'); -/** @var \Magento\Catalog\Model\Product\Action $productAction */ -$productAction = $objectManager->create(\Magento\Catalog\Model\Product\Action::class); -$productAction->updateAttributes([$product->getId()], ['test_searchable_attribute' => 'VALUE1'], $store->getId()); +/** @var ObjectManager $objectManager */ +$objectManager = Bootstrap::getObjectManager(); +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->get(ProductRepositoryInterface::class); +/** @var ProductFactory $productFactory */ +$productFactory = $objectManager->get(ProductFactory::class); +$product = $productFactory->create(); +$product->isObjectNew(true); +$product->setTypeId(Type::TYPE_SIMPLE) + ->setAttributeSetId($product->getDefaultAttributeSetId()) + ->setWebsiteIds([1]) + ->setName('Simple product name') + ->setSku('simple_for_search') + ->setPrice(100) + ->setWeight(1) + ->setShortDescription('Product short description') + ->setTaxClassId(0) + ->setDescription('Product description') + ->setMetaTitle('meta title') + ->setMetaKeyword('meta keyword') + ->setMetaDescription('meta description') + ->setVisibility(Visibility::VISIBILITY_BOTH) + ->setStatus(Status::STATUS_ENABLED) + ->setTestSearchableAttribute($attribute->getSource()->getOptionId('Option 1')) + ->setStockData( + [ + 'use_config_manage_stock' => 1, + 'qty' => 100, + 'is_qty_decimal' => 0, + 'is_in_stock' => 1, + ] + ); +$productRepository->save($product); diff --git a/dev/tests/integration/testsuite/Magento/CatalogSearch/_files/product_for_search_rollback.php b/dev/tests/integration/testsuite/Magento/CatalogSearch/_files/product_for_search_rollback.php index 00e2096ca734a..84f2e12e03b2d 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogSearch/_files/product_for_search_rollback.php +++ b/dev/tests/integration/testsuite/Magento/CatalogSearch/_files/product_for_search_rollback.php @@ -3,25 +3,37 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + declare(strict_types=1); -/** @var $objectManager \Magento\TestFramework\ObjectManager */ -$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); -$registry = $objectManager->get(\Magento\Framework\Registry::class); +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product; +use Magento\Eav\Setup\EavSetup; +use Magento\Eav\Setup\EavSetupFactory; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Registry; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\ObjectManager; +/** @var ObjectManager $objectManager */ +$objectManager = Bootstrap::getObjectManager(); +/** @var EavSetupFactory $eavSetupFactory */ +$eavSetupFactory = $objectManager->create(EavSetupFactory::class); +/** @var Registry $registry */ +$registry = $objectManager->get(Registry::class); +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->create(ProductRepositoryInterface::class); $registry->unregister('isSecureArea'); $registry->register('isSecureArea', true); -/** @var \Magento\Catalog\Model\Product $product */ -$product = $objectManager->create(\Magento\Catalog\Model\ProductRepository::class)->get('simple'); -/** @var \Magento\Catalog\Model\ResourceModel\Product $productResource */ -$productResource = $objectManager->create(\Magento\Catalog\Model\ResourceModel\Product::class); -$productResource->delete($product); - -$eavSetupFactory = $objectManager->create(\Magento\Eav\Setup\EavSetupFactory::class); -/** @var \Magento\Eav\Setup\EavSetup $eavSetup */ +try { + $productRepository->deleteById('simple_for_search'); +} catch (NoSuchEntityException $e) { + //Product already deleted. +} +/** @var EavSetup $eavSetup */ $eavSetup = $eavSetupFactory->create(); -$eavSetup->removeAttribute(\Magento\Catalog\Model\Product::ENTITY, 'test_searchable_attribute'); +$eavSetup->removeAttribute(Product::ENTITY, 'test_searchable_attribute'); $registry->unregister('isSecureArea'); $registry->register('isSecureArea', false); diff --git a/dev/tests/integration/testsuite/Magento/CatalogSearch/_files/products_for_sku_search_weight_score.php b/dev/tests/integration/testsuite/Magento/CatalogSearch/_files/products_for_sku_search_weight_score.php index 96d5c256dc727..cb7aaa9f16a19 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogSearch/_files/products_for_sku_search_weight_score.php +++ b/dev/tests/integration/testsuite/Magento/CatalogSearch/_files/products_for_sku_search_weight_score.php @@ -3,22 +3,69 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + +require 'searchable_attribute.php'; 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\Model\ProductFactory; use Magento\TestFramework\Helper\Bootstrap; +$objectManager = Bootstrap::getObjectManager(); /** @var ProductRepositoryInterface $productRepository */ -$productRepository = Bootstrap::getObjectManager()->create(ProductRepositoryInterface::class); -$product = Bootstrap::getObjectManager()->create(Product::class); +$productRepository = $objectManager->create(ProductRepositoryInterface::class); +/** @var ProductFactory $productFactory */ +$productFactory = $objectManager->get(ProductFactory::class); +$product = $productFactory->create(); +$product->setTypeId(Type::TYPE_SIMPLE) + ->setAttributeSetId($product->getDefaultAttributeSetId()) + ->setWebsiteIds([1]) + ->setName('Simple') + ->setSku('1234-1234-1234-1234') + ->setPrice(10) + ->setTaxClassId(0) + ->setVisibility(Visibility::VISIBILITY_BOTH) + ->setStatus(Status::STATUS_ENABLED) + ->setStockData( + [ + 'use_config_manage_stock' => 1, + 'qty' => 100, + 'is_qty_decimal' => 0, + 'is_in_stock' => 1, + ] + ); +$productRepository->save($product); + +$product = $productFactory->create(); +$product->setTypeId(Type::TYPE_SIMPLE) + ->setAttributeSetId($product->getDefaultAttributeSetId()) + ->setWebsiteIds([1]) + ->setName('1234-1234-1234-1234') + ->setSku('Simple') + ->setPrice(10) + ->setTaxClassId(0) + ->setVisibility(Visibility::VISIBILITY_BOTH) + ->setStatus(Status::STATUS_ENABLED) + ->setStockData( + [ + 'use_config_manage_stock' => 1, + 'qty' => 100, + 'is_qty_decimal' => 0, + 'is_in_stock' => 1, + ] + ); +$productRepository->save($product); + +$product = $productFactory->create(); $product->setTypeId(Type::TYPE_SIMPLE) - ->setAttributeSetId(4) + ->setAttributeSetId($product->getDefaultAttributeSetId()) ->setWebsiteIds([1]) - ->setName('1-2-3-4') - ->setSku('testsku') + ->setName('Product with description') + ->setSku('product_with_description') + ->setDescription('Simple') ->setPrice(10) ->setTaxClassId(0) ->setVisibility(Visibility::VISIBILITY_BOTH) @@ -33,16 +80,17 @@ ); $productRepository->save($product); -$product = Bootstrap::getObjectManager()->create(Product::class); +$product = $productFactory->create(); $product->setTypeId(Type::TYPE_SIMPLE) - ->setAttributeSetId(4) + ->setAttributeSetId($product->getDefaultAttributeSetId()) ->setWebsiteIds([1]) - ->setName('test') - ->setSku('1-2-3-4') + ->setName('Product with attribute') + ->setSku('product_with_attribute') ->setPrice(10) ->setTaxClassId(0) ->setVisibility(Visibility::VISIBILITY_BOTH) ->setStatus(Status::STATUS_ENABLED) + ->setTestSearchableAttribute($attribute->getSource()->getOptionId('Simple')) ->setStockData( [ 'use_config_manage_stock' => 1, diff --git a/dev/tests/integration/testsuite/Magento/CatalogSearch/_files/products_for_sku_search_weight_score_rollback.php b/dev/tests/integration/testsuite/Magento/CatalogSearch/_files/products_for_sku_search_weight_score_rollback.php new file mode 100644 index 0000000000000..775d405654fdf --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogSearch/_files/products_for_sku_search_weight_score_rollback.php @@ -0,0 +1,41 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Registry; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var ProductAttributeRepositoryInterface $productAttributeRepository */ +$productAttributeRepository = $objectManager->get(ProductAttributeRepositoryInterface::class); +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->create(ProductRepositoryInterface::class); +/** @var Registry $registry */ +$registry = $objectManager->get(Registry::class); +$productSkus = ['1234-1234-1234-1234', 'Simple', 'product_with_description', 'product_with_attribute']; + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); + +foreach ($productSkus as $productSku) { + try { + $productRepository->deleteById($productSku); + } catch (NoSuchEntityException $e) { + //Product already deleted. + } +} + +try { + $productAttributeRepository->deleteById('test_searchable_attribute'); +} catch (NoSuchEntityException $e) { + //attribute already deleted. +} + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); diff --git a/dev/tests/integration/testsuite/Magento/CatalogSearch/_files/searchable_attribute.php b/dev/tests/integration/testsuite/Magento/CatalogSearch/_files/searchable_attribute.php index b25d39b1d40b8..0d20dcb24dfbf 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogSearch/_files/searchable_attribute.php +++ b/dev/tests/integration/testsuite/Magento/CatalogSearch/_files/searchable_attribute.php @@ -3,25 +3,62 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + declare(strict_types=1); -$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); -$eavSetupFactory = $objectManager->create(\Magento\Eav\Setup\EavSetupFactory::class); -/** @var \Magento\Eav\Setup\EavSetup $eavSetup */ -$eavSetup = $eavSetupFactory->create(); -$eavSetup->addAttribute( - \Magento\Catalog\Model\Product::ENTITY, - 'test_searchable_attribute', - [ - 'label' => 'Test-attribute', - 'global' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_STORE, - 'required' => 0, - 'user_defined' => 1, - 'searchable' => 1, - 'visible_on_front' => 1, - 'filterable_in_search' => 1, - 'used_in_product_listing' => 1, - 'is_used_in_grid' => 1, - 'is_filterable_in_grid' => 1, - ] -); +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\ResourceModel\Eav\AttributeFactory; +use Magento\Eav\Setup\EavSetup; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var AttributeFactory $attributeFactory */ +$attributeFactory = $objectManager->get(AttributeFactory::class); +/** @var ProductAttributeRepositoryInterface $productAttributeRepository */ +$productAttributeRepository = $objectManager->get(ProductAttributeRepositoryInterface::class); +$attribute = $attributeFactory->create()->loadByCode(Product::ENTITY, 'test_searchable_attribute'); +if (!$attribute->getId()) { + /** @var EavSetup $installer */ + $installer = $objectManager->create(EavSetup::class); + $attribute->setData( + [ + 'attribute_code' => 'test_searchable_attribute', + 'is_global' => 0, + 'is_user_defined' => 1, + 'frontend_input' => 'select', + 'is_unique' => 0, + 'is_required' => 0, + 'is_searchable' => 1, + 'is_visible_in_advanced_search' => 1, + 'is_comparable' => 0, + 'is_filterable' => 1, + 'is_filterable_in_search' => 1, + '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 Drop-Down Attribute'], + 'backend_type' => 'int', + 'option' => [ + 'value' => [ + 'option_1' => ['Option 1'], + 'option_2' => ['Option 2'], + 'option_3' => ['Option 3'], + 'option_4' => ['Simple'] + ], + 'order' => [ + 'option_1' => 1, + 'option_2' => 2, + 'option_3' => 3, + 'option_4' => 4, + ], + ], + ] + ); + $productAttributeRepository->save($attribute); + $attribute = $productAttributeRepository->get('test_searchable_attribute'); + /* Assign attribute to attribute set */ + $installer->addAttributeToGroup(Product::ENTITY, 'Default', 'Attributes', $attribute->getId()); +} diff --git a/dev/tests/integration/testsuite/Magento/Elasticsearch6/CatalogSearch/Controller/Advanced/ResultTest.php b/dev/tests/integration/testsuite/Magento/Elasticsearch6/CatalogSearch/Controller/Advanced/ResultTest.php new file mode 100644 index 0000000000000..5f20c1bf82062 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Elasticsearch6/CatalogSearch/Controller/Advanced/ResultTest.php @@ -0,0 +1,37 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Elasticsearch6\CatalogSearch\Controller\Advanced; + +use Magento\CatalogSearch\Controller\Advanced\ResultTest as CatalogSearchResultTest; + +/** + * Test cases for catalog advanced search using Elasticsearch 6.0+ search engine. + * + * @magentoDbIsolation disabled + * @magentoAppIsolation enabled + */ +class ResultTest extends CatalogSearchResultTest +{ + /** + * Advanced search test by difference product attributes. + * + * @magentoAppArea frontend + * @magentoConfigFixture default/catalog/search/engine elasticsearch6 + * @magentoDataFixture Magento/CatalogSearch/_files/product_for_search.php + * @magentoDataFixture Magento/CatalogSearch/_files/full_reindex.php + * @dataProvider searchStringDataProvider + * phpcs:disable Generic.CodeAnalysis.UselessOverridingMethod + * + * @param array $searchParams + * @return void + */ + public function testExecute(array $searchParams): void + { + parent::testExecute($searchParams); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Elasticsearch6/CatalogSearch/Controller/Result/IndexTest.php b/dev/tests/integration/testsuite/Magento/Elasticsearch6/CatalogSearch/Controller/Result/IndexTest.php new file mode 100644 index 0000000000000..492983eb8726d --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Elasticsearch6/CatalogSearch/Controller/Result/IndexTest.php @@ -0,0 +1,37 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Elasticsearch6\CatalogSearch\Controller\Result; + +use Magento\CatalogSearch\Controller\Result\IndexTest as CatalogSearchIndexTest; + +/** + * Test cases for catalog quick search using Elasticsearch 6.0+ search engine. + * + * @magentoDbIsolation disabled + * @magentoAppIsolation enabled + */ +class IndexTest extends CatalogSearchIndexTest +{ + /** + * Quick search test by difference product attributes. + * + * @magentoAppArea frontend + * @magentoConfigFixture default/catalog/search/engine elasticsearch6 + * @magentoDataFixture Magento/CatalogSearch/_files/product_for_search.php + * @magentoDataFixture Magento/CatalogSearch/_files/full_reindex.php + * @dataProvider searchStringDataProvider + * phpcs:disable Generic.CodeAnalysis.UselessOverridingMethod + * + * @param string $searchString + * @return void + */ + public function testExecute(string $searchString): void + { + parent::testExecute($searchString); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Elasticsearch6/CatalogSearch/Model/Indexer/fulltext/Action/DataProviderTest.php b/dev/tests/integration/testsuite/Magento/Elasticsearch6/CatalogSearch/Model/Indexer/fulltext/Action/DataProviderTest.php new file mode 100644 index 0000000000000..b50d9034c0f88 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Elasticsearch6/CatalogSearch/Model/Indexer/fulltext/Action/DataProviderTest.php @@ -0,0 +1,32 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Elasticsearch6\CatalogSearch\Model\Indexer\fulltext\Action; + +use Magento\CatalogSearch\Model\Indexer\Fulltext\Action\DataProviderTest as CatalogSearchDataProviderTest; + +/** + * Search products by attribute value using Elasticsearch 6.0+ search engine. + */ +class DataProviderTest extends CatalogSearchDataProviderTest +{ + /** + * Search product by custom attribute value. + * + * @magentoConfigFixture default/catalog/search/engine elasticsearch6 + * @magentoDataFixture Magento/CatalogSearch/_files/product_for_search.php + * @magentoDataFixture Magento/CatalogSearch/_files/full_reindex.php + * @magentoDbIsolation disabled + * phpcs:disable Generic.CodeAnalysis.UselessOverridingMethod + * + * @return void + */ + public function testSearchProductByAttribute(): void + { + parent::testSearchProductByAttribute(); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Elasticsearch6/CatalogSearch/Model/Search/AttributeSearchWeightTest.php b/dev/tests/integration/testsuite/Magento/Elasticsearch6/CatalogSearch/Model/Search/AttributeSearchWeightTest.php new file mode 100644 index 0000000000000..71dfebe5a4e84 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Elasticsearch6/CatalogSearch/Model/Search/AttributeSearchWeightTest.php @@ -0,0 +1,107 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Elasticsearch6\CatalogSearch\Model\Search; + +use Magento\CatalogSearch\Model\Search\AttributeSearchWeightTest as CatalogSearchAttributeSearchWeightTest; + +/** + * Test founded products order after quick search with changed attribute search weight + * using Elasticsearch 6.0+ search engine. + * + * @magentoAppIsolation enabled + */ +class AttributeSearchWeightTest extends CatalogSearchAttributeSearchWeightTest +{ + /** + * Perform search by word and check founded product order in different cases. + * + * @magentoConfigFixture default/catalog/search/engine elasticsearch6 + * @magentoDataFixture Magento/CatalogSearch/_files/products_for_sku_search_weight_score.php + * @magentoDataFixture Magento/CatalogSearch/_files/full_reindex.php + * @dataProvider attributeSearchWeightDataProvider + * @magentoDbIsolation enabled + * + * @param string $searchQuery + * @param array $attributeWeights + * @param array $expectedProductNames + * phpcs:disable Generic.CodeAnalysis.UselessOverridingMethod + * + * @return void + */ + public function testAttributeSearchWeight( + string $searchQuery, + array $attributeWeights, + array $expectedProductNames + ): void { + $this->markTestSkipped('This test need stabilization. MC-29260'); + parent::testAttributeSearchWeight($searchQuery, $attributeWeights, $expectedProductNames); + } + + /** + * Data provider with word for quick search, attributes weight and expected products name order. + * + * @return array + */ + public function attributeSearchWeightDataProvider(): array + { + return [ + 'sku_order_more_than_name' => [ + '1234-1234-1234-1234', + [ + 'sku' => 6, + 'name' => 5, + ], + [ + '1234-1234-1234-1234', + 'Simple', + ], + ], + 'name_order_more_than_sku' => [ + '1234-1234-1234-1234', + [ + 'name' => 6, + 'sku' => 5, + ], + [ + '1234-1234-1234-1234', + 'Simple', + ], + ], + 'search_by_word_from_description' => [ + 'Simple', + [ + 'name' => 10, + 'test_searchable_attribute' => 9, + 'sku' => 2, + 'description' => 1, + ], + [ + 'Simple', + 'Product with attribute', + '1234-1234-1234-1234', + 'Product with description', + ], + ], + 'search_by_attribute_option' => [ + 'Simple', + [ + 'name' => 10, + 'description' => 9, + 'test_searchable_attribute' => 7, + 'sku' => 2, + ], + [ + 'Simple', + 'Product with description', + 'Product with attribute', + '1234-1234-1234-1234', + ], + ], + ]; + } +} From 1a52c071f91bef9b89fa61d369d6d530a20974fb Mon Sep 17 00:00:00 2001 From: Mykhailo Matiola <mykhailo.matiola@transoftgroup.com> Date: Mon, 16 Dec 2019 16:54:51 +0200 Subject: [PATCH 0432/1143] MC-25146: Layered Navigation with different product attributes on Catalog Search Results page --- .../Block/Navigation/AbstractCategoryTest.php | 101 ------- .../Block/Navigation/AbstractFiltersTest.php | 278 ++++++++++++++++++ .../Category/AbstractFiltersTest.php | 161 ---------- .../Navigation/Category/BooleanFilterTest.php | 30 +- .../Navigation/Category/DecimalFilterTest.php | 28 +- .../Category/MultiselectFilterTest.php | 30 +- .../Navigation/Category/SelectFilterTest.php | 30 +- .../Block/Navigation/CategoryTest.php | 81 ++++- .../Navigation/Search/BooleanFilterTest.php | 81 +++++ .../Navigation/Search/DecimalFilterTest.php | 72 +++++ .../Search/MultiselectFilterTest.php | 84 ++++++ .../Navigation/Search/SelectFilterTest.php | 82 ++++++ .../Category/SwatchTextFilterTest.php | 31 +- .../Category/SwatchVisualFilterTest.php | 31 +- .../Search/SwatchTextFilterTest.php | 82 ++++++ .../Search/SwatchVisualFilterTest.php | 82 ++++++ 16 files changed, 983 insertions(+), 301 deletions(-) delete mode 100644 dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/AbstractCategoryTest.php create mode 100644 dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/AbstractFiltersTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/AbstractFiltersTest.php create mode 100644 dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Search/BooleanFilterTest.php create mode 100644 dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Search/DecimalFilterTest.php create mode 100644 dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Search/MultiselectFilterTest.php create mode 100644 dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Search/SelectFilterTest.php create mode 100644 dev/tests/integration/testsuite/Magento/SwatchesLayeredNavigation/Block/Navigation/Search/SwatchTextFilterTest.php create mode 100644 dev/tests/integration/testsuite/Magento/SwatchesLayeredNavigation/Block/Navigation/Search/SwatchVisualFilterTest.php diff --git a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/AbstractCategoryTest.php b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/AbstractCategoryTest.php deleted file mode 100644 index aad0fcd08656f..0000000000000 --- a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/AbstractCategoryTest.php +++ /dev/null @@ -1,101 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -declare(strict_types=1); - -namespace Magento\LayeredNavigation\Block\Navigation; - -use Magento\Catalog\Api\Data\CategoryInterface; -use Magento\Catalog\Model\ResourceModel\Category as CategoryResource; -use Magento\Catalog\Model\ResourceModel\Category\Collection; -use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory; -use Magento\Framework\ObjectManagerInterface; -use Magento\Framework\View\LayoutInterface; -use Magento\LayeredNavigation\Block\Navigation; -use Magento\Store\Model\Store; -use Magento\TestFramework\Helper\Bootstrap; -use PHPUnit\Framework\TestCase; - -/** - * Base class for filters block tests on category page. - */ -abstract class AbstractCategoryTest extends TestCase -{ - /** - * @var ObjectManagerInterface - */ - protected $objectManager; - - /** - * @var CollectionFactory - */ - protected $categoryCollectionFactory; - - /** - * @var CategoryResource - */ - protected $categoryResource; - - /** - * @var Navigation - */ - protected $navigationBlock; - - /** - * @var LayoutInterface - */ - protected $layout; - - /** - * @inheritdoc - */ - protected function setUp() - { - $this->objectManager = Bootstrap::getObjectManager(); - $this->categoryCollectionFactory = $this->objectManager->create(CollectionFactory::class); - $this->categoryResource = $this->objectManager->get(CategoryResource::class); - $this->layout = $this->objectManager->get(LayoutInterface::class); - $this->navigationBlock = $this->objectManager->create(Category::class); - parent::setUp(); - } - - /** - * Inits navigation block. - * - * @param string $categoryName - * @param int $storeId - * @return void - */ - protected function prepareNavigationBlock( - string $categoryName, - int $storeId = Store::DEFAULT_STORE_ID - ): void { - $category = $this->loadCategory($categoryName, $storeId); - $this->navigationBlock->getLayer()->setCurrentCategory($category); - $this->navigationBlock->setLayout($this->layout); - } - - /** - * Loads category by id. - * - * @param string $categoryName - * @param int $storeId - * @return CategoryInterface - */ - protected function loadCategory(string $categoryName, int $storeId): CategoryInterface - { - /** @var Collection $categoryCollection */ - $categoryCollection = $this->categoryCollectionFactory->create(); - /** @var CategoryInterface $category */ - $category = $categoryCollection->setStoreId($storeId) - ->addAttributeToSelect('display_mode', 'left') - ->addAttributeToFilter(CategoryInterface::KEY_NAME, $categoryName) - ->setPageSize(1) - ->getFirstItem(); - $category->setStoreId($storeId); - - return $category; - } -} diff --git a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/AbstractFiltersTest.php b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/AbstractFiltersTest.php new file mode 100644 index 0000000000000..472eac444b9d4 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/AbstractFiltersTest.php @@ -0,0 +1,278 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\LayeredNavigation\Block\Navigation; + +use Magento\Catalog\Api\Data\CategoryInterface; +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Layer\Filter\AbstractFilter; +use Magento\Catalog\Model\Layer\Filter\Item; +use Magento\Catalog\Model\Layer\Resolver; +use Magento\Catalog\Model\ResourceModel\Category\Collection; +use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory; +use Magento\CatalogSearch\Model\Indexer\Fulltext\Processor; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Search\Request\Builder; +use Magento\Framework\Search\Request\Config; +use Magento\Framework\View\LayoutInterface; +use Magento\LayeredNavigation\Block\Navigation; +use Magento\LayeredNavigation\Block\Navigation\Search as SearchNavigationBlock; +use Magento\LayeredNavigation\Block\Navigation\Category as CategoryNavigationBlock; +use Magento\Search\Model\Search; +use Magento\Store\Model\Store; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; + +/** + * Base class for custom filters in navigation block on category page. + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +abstract class AbstractFiltersTest extends TestCase +{ + /** + * @var ObjectManagerInterface + */ + protected $objectManager; + + /** + * @var CollectionFactory + */ + protected $categoryCollectionFactory; + + /** + * @var Navigation + */ + protected $navigationBlock; + + /** + * @var LayoutInterface + */ + protected $layout; + + /** + * @var ProductAttributeRepositoryInterface + */ + protected $attributeRepository; + + /** + * @var ProductRepositoryInterface + */ + protected $productRepository; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + $this->objectManager = Bootstrap::getObjectManager(); + $this->categoryCollectionFactory = $this->objectManager->create(CollectionFactory::class); + $this->layout = $this->objectManager->get(LayoutInterface::class); + $layerResolver = $this->objectManager->create(Resolver::class); + + if ($this->getLayerType() === Resolver::CATALOG_LAYER_SEARCH) { + $layerResolver->create(Resolver::CATALOG_LAYER_SEARCH); + $this->navigationBlock = $this->objectManager->create( + SearchNavigationBlock::class, + [ + 'layerResolver' => $layerResolver, + ] + ); + } else { + $this->navigationBlock = $this->objectManager->create(CategoryNavigationBlock::class); + } + + $this->attributeRepository = $this->objectManager->create(ProductAttributeRepositoryInterface::class); + $this->productRepository = $this->objectManager->create(ProductRepositoryInterface::class); + } + + /** + * Returns layer type for navigation block. + * + * @return string + */ + abstract protected function getLayerType(): string; + + /** + * Returns attribute code. + * + * @return string + */ + abstract protected function getAttributeCode(): string; + + /** + * Tests getFilters method from navigation block on category page. + * + * @param array $products + * @param array $attributeData + * @param array $expectation + * @param string $categoryName + * @return void + */ + protected function getCategoryFiltersAndAssert( + array $products, + array $attributeData, + array $expectation, + string $categoryName + ): void { + $this->updateAttribute($this->getAttributeCode(), $attributeData); + $this->updateProducts($products, $this->getAttributeCode()); + $this->clearInstanceAndReindexSearch(); + $category = $this->loadCategory($categoryName, Store::DEFAULT_STORE_ID); + $this->navigationBlock->getLayer()->setCurrentCategory($category); + $this->navigationBlock->setLayout($this->layout); + $filter = $this->getFilterByCode($this->navigationBlock->getFilters(), $this->getAttributeCode()); + + if ($attributeData['is_filterable']) { + $this->assertNotNull($filter); + $this->assertEquals($expectation, $this->prepareFilterItems($filter)); + } else { + $this->assertNull($filter); + } + } + + /** + * Tests getFilters method from navigation block on search page. + * + * @param array $products + * @param array $attributeData + * @param array $expectation + * @return void + */ + protected function getSearchFiltersAndAssert( + array $products, + array $attributeData, + array $expectation + ): void { + $this->updateAttribute($this->getAttributeCode(), $attributeData); + $this->updateProducts($products, $this->getAttributeCode()); + $this->clearInstanceAndReindexSearch(); + $this->navigationBlock->getRequest()->setParams(['q' => 'Simple Product']); + $this->navigationBlock->setLayout($this->layout); + $filter = $this->getFilterByCode($this->navigationBlock->getFilters(), $this->getAttributeCode()); + + if ($attributeData['is_filterable_in_search']) { + $this->assertNotNull($filter); + $this->assertEquals($expectation, $this->prepareFilterItems($filter)); + } else { + $this->assertNull($filter); + } + } + + /** + * Returns filter with specified attribute. + * + * @param AbstractFilter[] $filters + * @param string $code + * @return AbstractFilter|null + */ + protected function getFilterByCode(array $filters, string $code): ?AbstractFilter + { + $filter = array_filter( + $filters, + function (AbstractFilter $filter) use ($code) { + return $filter->getData('attribute_model') + && $filter->getData('attribute_model')->getAttributeCode() === $code; + } + ); + + return array_shift($filter); + } + + /** + * Updates attribute data. + * + * @param string $attributeCode + * @param array $data + * @return void + */ + protected function updateAttribute( + string $attributeCode, + array $data + ): void { + $attribute = $this->attributeRepository->get($attributeCode); + $attribute->addData($data); + $this->attributeRepository->save($attribute); + } + + /** + * Returns filter items as array. + * + * @param AbstractFilter $filter + * @return array + */ + protected function prepareFilterItems(AbstractFilter $filter): array + { + $items = []; + /** @var Item $item */ + foreach ($filter->getItems() as $item) { + $items[] = [ + 'label' => $item->getData('label'), + 'count' => $item->getData('count'), + ]; + } + + return $items; + } + + /** + * Update products data by attribute. + * + * @param array $products + * @param string $attributeCode + * @return void + */ + protected function updateProducts(array $products, string $attributeCode): void + { + $attribute = $this->attributeRepository->get($attributeCode); + + foreach ($products as $productSku => $stringValue) { + $product = $this->productRepository->get($productSku, false, Store::DEFAULT_STORE_ID, true); + $product->addData( + [$attribute->getAttributeCode() => $attribute->getSource()->getOptionId($stringValue)] + ); + $this->productRepository->save($product); + } + } + + /** + * Clears instances and rebuilds seqrch index. + * + * @return void + */ + protected function clearInstanceAndReindexSearch(): void + { + $this->objectManager->removeSharedInstance(Config::class); + $this->objectManager->removeSharedInstance(Builder::class); + $this->objectManager->removeSharedInstance(Search::class); + $this->objectManager->create(Processor::class)->reindexAll(); + } + + /** + * Loads category by id. + * + * @param string $categoryName + * @param int $storeId + * @return CategoryInterface + */ + protected function loadCategory(string $categoryName, int $storeId): CategoryInterface + { + /** @var Collection $categoryCollection */ + $categoryCollection = $this->categoryCollectionFactory->create(); + /** @var CategoryInterface $category */ + $category = $categoryCollection->setStoreId($storeId) + ->addAttributeToSelect('display_mode', 'left') + ->addAttributeToFilter(CategoryInterface::KEY_NAME, $categoryName) + ->setPageSize(1) + ->getFirstItem(); + $category->setStoreId($storeId); + + return $category; + } +} diff --git a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/AbstractFiltersTest.php b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/AbstractFiltersTest.php deleted file mode 100644 index 00c14b6a72d04..0000000000000 --- a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/AbstractFiltersTest.php +++ /dev/null @@ -1,161 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -declare(strict_types=1); - -namespace Magento\LayeredNavigation\Block\Navigation\Category; - -use Magento\Catalog\Api\ProductAttributeRepositoryInterface; -use Magento\Catalog\Api\ProductRepositoryInterface; -use Magento\Catalog\Model\Layer\Filter\AbstractFilter; -use Magento\Catalog\Model\Layer\Filter\Item; -use Magento\CatalogSearch\Model\Indexer\Fulltext\Processor; -use Magento\Framework\Search\Request\Builder; -use Magento\Framework\Search\Request\Config; -use Magento\LayeredNavigation\Block\Navigation\AbstractCategoryTest; -use Magento\Search\Model\Search; -use Magento\Store\Model\Store; - -/** - * Base class for custom filters in navigation block on category page. - */ -abstract class AbstractFiltersTest extends AbstractCategoryTest -{ - /** - * @var ProductAttributeRepositoryInterface - */ - protected $attributeRepository; - - /** - * @var ProductRepositoryInterface - */ - protected $productRepository; - - /** - * @inheritdoc - */ - protected function setUp() - { - parent::setUp(); - $this->attributeRepository = $this->objectManager->create(ProductAttributeRepositoryInterface::class); - $this->productRepository = $this->objectManager->create(ProductRepositoryInterface::class); - } - - /** - * Tests getFilters method from navigation block. - * - * @param array $products - * @param int $filterable - * @param array $expectation - * @param string $attributeCode - * @return void - */ - protected function getFiltersAndAssert( - array $products, - int $filterable, - array $expectation, - string $attributeCode - ): void { - $this->updateAttribute($attributeCode, $filterable); - $this->updateProducts($products, $attributeCode); - $this->prepareNavigationBlock('Category 999'); - $filter = $this->getFilterByCode($this->navigationBlock->getFilters(), $attributeCode); - - if ($filterable) { - $this->assertNotNull($filter); - $this->assertEquals($expectation, $this->prepareFilterItems($filter)); - } else { - $this->assertNull($filter); - } - } - - /** - * @inheritdoc - */ - protected function prepareNavigationBlock(string $categoryName, int $storeId = Store::DEFAULT_STORE_ID): void - { - $this->objectManager->removeSharedInstance(Config::class); - $this->objectManager->removeSharedInstance(Builder::class); - $this->objectManager->removeSharedInstance(Search::class); - $this->objectManager->create(Processor::class)->reindexAll(); - parent::prepareNavigationBlock($categoryName, $storeId); - } - - /** - * Returns filter with specified attribute. - * - * @param AbstractFilter[] $filters - * @param string $code - * @return AbstractFilter|null - */ - protected function getFilterByCode(array $filters, string $code): ?AbstractFilter - { - $filter = array_filter( - $filters, - function (AbstractFilter $filter) use ($code) { - return $filter->getData('attribute_model') - && $filter->getData('attribute_model')->getAttributeCode() === $code; - } - ); - - return array_shift($filter); - } - - /** - * Updates attribute data. - * - * @param string $attributeCode - * @param int $filterable - * @return void - */ - protected function updateAttribute( - string $attributeCode, - int $filterable - ): void { - $attribute = $this->attributeRepository->get($attributeCode); - $attribute->setData('is_filterable', $filterable); - $this->attributeRepository->save($attribute); - } - - /** - * Returns filter items as array. - * - * @param AbstractFilter $filter - * @return array - */ - protected function prepareFilterItems(AbstractFilter $filter): array - { - $items = []; - /** @var Item $item */ - foreach ($filter->getItems() as $item) { - $items[] = [ - 'label' => $item->getData('label'), - 'count' => $item->getData('count'), - ]; - } - - return $items; - } - - /** - * Update products data by attribute. - * - * @param array $products - * @param string $attributeCode - * @return void - */ - protected function updateProducts(array $products, string $attributeCode): void - { - $attribute = $this->attributeRepository->get($attributeCode); - - foreach ($products as $productSku => $stringValue) { - $product = $this->productRepository->get($productSku, false, Store::DEFAULT_STORE_ID, true); - $product->addData( - [$attribute->getAttributeCode() => $attribute->getSource()->getOptionId($stringValue)] - ); - $this->productRepository->save($product); - } - } -} diff --git a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/BooleanFilterTest.php b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/BooleanFilterTest.php index 83636ff55dce8..24787bc3c4ca8 100644 --- a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/BooleanFilterTest.php +++ b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/BooleanFilterTest.php @@ -8,6 +8,8 @@ namespace Magento\LayeredNavigation\Block\Navigation\Category; use Magento\Catalog\Model\Layer\Filter\AbstractFilter; +use Magento\Catalog\Model\Layer\Resolver; +use Magento\LayeredNavigation\Block\Navigation\AbstractFiltersTest; /** * Provides tests for custom boolean filter in navigation block on category page. @@ -23,13 +25,13 @@ class BooleanFilterTest extends AbstractFiltersTest * @magentoDataFixture Magento/Catalog/_files/category_with_different_price_products.php * @dataProvider getFiltersWithCustomAttributeDataProvider * @param array $products - * @param int $filterable + * @param array $attributeData * @param array $expectation * @return void */ - public function testGetFiltersWithCustomAttribute(array $products, int $filterable, array $expectation): void + public function testGetFiltersWithCustomAttribute(array $products, array $attributeData, array $expectation): void { - $this->getFiltersAndAssert($products, $filterable, $expectation, 'boolean_attribute'); + $this->getCategoryFiltersAndAssert($products, $attributeData, $expectation, 'Category 999'); } /** @@ -40,7 +42,7 @@ public function getFiltersWithCustomAttributeDataProvider(): array return [ 'not_used_in_navigation' => [ 'products_data' => [], - 'filterable' => 0, + 'attribute_data' => ['is_filterable' => 0], 'expectation' => [], ], 'used_in_navigation_with_results' => [ @@ -48,7 +50,7 @@ public function getFiltersWithCustomAttributeDataProvider(): array 'simple1000' => 'Yes', 'simple1001' => 'Yes', ], - 'filterable' => AbstractFilter::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS, + 'attribute_data' => ['is_filterable' => AbstractFilter::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS], 'expectation' => [ ['label' => 'Yes', 'count' => 2], ], @@ -58,7 +60,7 @@ public function getFiltersWithCustomAttributeDataProvider(): array 'simple1000' => 'Yes', 'simple1001' => 'Yes', ], - 'filterable' => 2, + 'attribute_data' => ['is_filterable' => 2], 'expectation' => [ ['label' => 'Yes', 'count' => 2], ['label' => 'No', 'count' => 0], @@ -66,4 +68,20 @@ public function getFiltersWithCustomAttributeDataProvider(): array ], ]; } + + /** + * @inheritdoc + */ + protected function getLayerType(): string + { + return Resolver::CATALOG_LAYER_CATEGORY; + } + + /** + * @inheritdoc + */ + protected function getAttributeCode(): string + { + return 'boolean_attribute'; + } } diff --git a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/DecimalFilterTest.php b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/DecimalFilterTest.php index e79b521f7f13c..c8cb6397b12fd 100644 --- a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/DecimalFilterTest.php +++ b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/DecimalFilterTest.php @@ -7,6 +7,8 @@ namespace Magento\LayeredNavigation\Block\Navigation\Category; +use Magento\Catalog\Model\Layer\Resolver; +use Magento\LayeredNavigation\Block\Navigation\AbstractFiltersTest; use Magento\Catalog\Model\Layer\Filter\AbstractFilter; use Magento\Catalog\Model\Layer\Filter\Item; use Magento\Store\Model\Store; @@ -25,13 +27,29 @@ class DecimalFilterTest extends AbstractFiltersTest * @magentoDataFixture Magento/Catalog/_files/category_with_different_price_products.php * @dataProvider getFiltersWithCustomAttributeDataProvider * @param array $products - * @param int $filterable + * @param array $attributeData * @param array $expectation * @return void */ - public function testGetFiltersWithCustomAttribute(array $products, int $filterable, array $expectation): void + public function testGetFiltersWithCustomAttribute(array $products, array $attributeData, array $expectation): void { - $this->getFiltersAndAssert($products, $filterable, $expectation, 'decimal_attribute'); + $this->getCategoryFiltersAndAssert($products, $attributeData, $expectation, 'Category 999'); + } + + /** + * @inheritdoc + */ + protected function getLayerType(): string + { + return Resolver::CATALOG_LAYER_CATEGORY; + } + + /** + * @inheritdoc + */ + protected function getAttributeCode(): string + { + return 'decimal_attribute'; } /** @@ -77,7 +95,7 @@ public function getFiltersWithCustomAttributeDataProvider(): array return [ 'not_used_in_navigation' => [ 'products_data' => [], - 'filterable' => 0, + 'attribute_data' => ['is_filterable' => 0], 'expectation' => [], ], 'used_in_navigation_with_results' => [ @@ -85,7 +103,7 @@ public function getFiltersWithCustomAttributeDataProvider(): array 'simple1000' => 10.00, 'simple1001' => 20.00, ], - 'filterable' => AbstractFilter::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS, + 'attribute_data' => ['is_filterable' => AbstractFilter::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS], 'expectation' => [ [ 'label' => '<span class="price">$10.00</span> - <span class="price">$19.99</span>', diff --git a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/MultiselectFilterTest.php b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/MultiselectFilterTest.php index 14d121eb15b79..f8391c60a30cf 100644 --- a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/MultiselectFilterTest.php +++ b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/MultiselectFilterTest.php @@ -7,6 +7,8 @@ namespace Magento\LayeredNavigation\Block\Navigation\Category; +use Magento\Catalog\Model\Layer\Resolver; +use Magento\LayeredNavigation\Block\Navigation\AbstractFiltersTest; use Magento\Catalog\Model\Layer\Filter\AbstractFilter; /** @@ -23,13 +25,13 @@ class MultiselectFilterTest extends AbstractFiltersTest * @magentoDataFixture Magento/Catalog/_files/category_with_different_price_products.php * @dataProvider getFiltersWithCustomAttributeDataProvider * @param array $products - * @param int $filterable + * @param array $attributeData * @param array $expectation * @return void */ - public function testGetFiltersWithCustomAttribute(array $products, int $filterable, array $expectation): void + public function testGetFiltersWithCustomAttribute(array $products, array $attributeData, array $expectation): void { - $this->getFiltersAndAssert($products, $filterable, $expectation, 'multiselect_attribute'); + $this->getCategoryFiltersAndAssert($products, $attributeData, $expectation, 'Category 999'); } /** @@ -40,7 +42,7 @@ public function getFiltersWithCustomAttributeDataProvider(): array return [ 'not_used_in_navigation' => [ 'products_data' => [], - 'filterable' => 0, + 'attribute_data' => ['is_filterable' => 0], 'expectation' => [], ], 'used_in_navigation_with_results' => [ @@ -48,7 +50,7 @@ public function getFiltersWithCustomAttributeDataProvider(): array 'simple1000' => 'Option 1', 'simple1001' => 'Option 2', ], - 'filterable' => AbstractFilter::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS, + 'attribute_data' => ['is_filterable' => AbstractFilter::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS], 'expectation' => [ ['label' => 'Option 1', 'count' => 1], ['label' => 'Option 2', 'count' => 1], @@ -59,7 +61,7 @@ public function getFiltersWithCustomAttributeDataProvider(): array 'simple1000' => 'Option 1', 'simple1001' => 'Option 2', ], - 'filterable' => 2, + 'attribute_data' => ['is_filterable' => 2], 'expectation' => [ ['label' => 'Option 1', 'count' => 1], ['label' => 'Option 2', 'count' => 1], @@ -69,4 +71,20 @@ public function getFiltersWithCustomAttributeDataProvider(): array ], ]; } + + /** + * @inheritdoc + */ + protected function getLayerType(): string + { + return Resolver::CATALOG_LAYER_CATEGORY; + } + + /** + * @inheritdoc + */ + protected function getAttributeCode(): string + { + return 'multiselect_attribute'; + } } diff --git a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/SelectFilterTest.php b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/SelectFilterTest.php index 76217e9683993..e2278239be242 100644 --- a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/SelectFilterTest.php +++ b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/SelectFilterTest.php @@ -7,6 +7,8 @@ namespace Magento\LayeredNavigation\Block\Navigation\Category; +use Magento\Catalog\Model\Layer\Resolver; +use Magento\LayeredNavigation\Block\Navigation\AbstractFiltersTest; use Magento\Catalog\Model\Layer\Filter\AbstractFilter; /** @@ -23,13 +25,13 @@ class SelectFilterTest extends AbstractFiltersTest * @magentoDataFixture Magento/Catalog/_files/category_with_different_price_products.php * @dataProvider getFiltersWithCustomAttributeDataProvider * @param array $products - * @param int $filterable + * @param array $attributeData * @param array $expectation * @return void */ - public function testGetFiltersWithCustomAttribute(array $products, int $filterable, array $expectation): void + public function testGetFiltersWithCustomAttribute(array $products, array $attributeData, array $expectation): void { - $this->getFiltersAndAssert($products, $filterable, $expectation, 'dropdown_attribute'); + $this->getCategoryFiltersAndAssert($products, $attributeData, $expectation, 'Category 999'); } /** @@ -40,7 +42,7 @@ public function getFiltersWithCustomAttributeDataProvider(): array return [ 'not_used_in_navigation' => [ 'products_data' => [], - 'filterable' => 0, + 'attribute_data' => ['is_filterable' => 0], 'expectation' => [], ], 'used_in_navigation_with_results' => [ @@ -48,7 +50,7 @@ public function getFiltersWithCustomAttributeDataProvider(): array 'simple1000' => 'Option 1', 'simple1001' => 'Option 2', ], - 'filterable' => AbstractFilter::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS, + 'attribute_data' => ['is_filterable' => AbstractFilter::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS], 'expectation' => [ ['label' => 'Option 1', 'count' => 1], ['label' => 'Option 2', 'count' => 1], @@ -59,7 +61,7 @@ public function getFiltersWithCustomAttributeDataProvider(): array 'simple1000' => 'Option 1', 'simple1001' => 'Option 2', ], - 'filterable' => 2, + 'attribute_data' => ['is_filterable' => 2], 'expectation' => [ ['label' => 'Option 1', 'count' => 1], ['label' => 'Option 2', 'count' => 1], @@ -68,4 +70,20 @@ public function getFiltersWithCustomAttributeDataProvider(): array ], ]; } + + /** + * @inheritdoc + */ + protected function getLayerType(): string + { + return Resolver::CATALOG_LAYER_CATEGORY; + } + + /** + * @inheritdoc + */ + protected function getAttributeCode(): string + { + return 'dropdown_attribute'; + } } diff --git a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/CategoryTest.php b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/CategoryTest.php index 3a2de697bd5ef..0efbd426e8375 100644 --- a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/CategoryTest.php +++ b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/CategoryTest.php @@ -7,10 +7,19 @@ namespace Magento\LayeredNavigation\Block\Navigation; +use Magento\Catalog\Api\Data\CategoryInterface; use Magento\Catalog\Api\Data\CategoryInterfaceFactory; use Magento\Catalog\Model\Category as CategoryModel; +use Magento\Catalog\Model\ResourceModel\Category as CategoryResource; +use Magento\Catalog\Model\ResourceModel\Category\Collection; +use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\View\LayoutInterface; +use Magento\LayeredNavigation\Block\Navigation; use Magento\Store\Model\Store; use Magento\Store\Model\StoreManagerInterface; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; /** * Provides tests for filters block on category page. @@ -19,8 +28,33 @@ * @magentoAppIsolation enabled * @magentoDbIsolation disabled */ -class CategoryTest extends AbstractCategoryTest +class CategoryTest extends TestCase { + /** + * @var ObjectManagerInterface + */ + protected $objectManager; + + /** + * @var CollectionFactory + */ + protected $categoryCollectionFactory; + + /** + * @var CategoryResource + */ + protected $categoryResource; + + /** + * @var Navigation + */ + protected $navigationBlock; + + /** + * @var LayoutInterface + */ + protected $layout; + /** * @var StoreManagerInterface */ @@ -31,8 +65,13 @@ class CategoryTest extends AbstractCategoryTest */ protected function setUp() { - parent::setUp(); + $this->objectManager = Bootstrap::getObjectManager(); + $this->categoryCollectionFactory = $this->objectManager->create(CollectionFactory::class); + $this->categoryResource = $this->objectManager->get(CategoryResource::class); + $this->layout = $this->objectManager->get(LayoutInterface::class); + $this->navigationBlock = $this->objectManager->create(Category::class); $this->storeManager = $this->objectManager->get(StoreManagerInterface::class); + parent::setUp(); } /** @@ -128,6 +167,44 @@ public function canShowBlockWithDisplayModeDataProviderOnStoreView(): array ]; } + /** + * Inits navigation block. + * + * @param string $categoryName + * @param int $storeId + * @return void + */ + private function prepareNavigationBlock( + string $categoryName, + int $storeId = Store::DEFAULT_STORE_ID + ): void { + $category = $this->loadCategory($categoryName, $storeId); + $this->navigationBlock->getLayer()->setCurrentCategory($category); + $this->navigationBlock->setLayout($this->layout); + } + + /** + * Loads category by id. + * + * @param string $categoryName + * @param int $storeId + * @return CategoryInterface + */ + private function loadCategory(string $categoryName, int $storeId): CategoryInterface + { + /** @var Collection $categoryCollection */ + $categoryCollection = $this->categoryCollectionFactory->create(); + /** @var CategoryInterface $category */ + $category = $categoryCollection->setStoreId($storeId) + ->addAttributeToSelect('display_mode', 'left') + ->addAttributeToFilter(CategoryInterface::KEY_NAME, $categoryName) + ->setPageSize(1) + ->getFirstItem(); + $category->setStoreId($storeId); + + return $category; + } + /** * Updates category display mode. * diff --git a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Search/BooleanFilterTest.php b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Search/BooleanFilterTest.php new file mode 100644 index 0000000000000..8f03ae3eed229 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Search/BooleanFilterTest.php @@ -0,0 +1,81 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\LayeredNavigation\Block\Navigation\Search; + +use Magento\Catalog\Model\Layer\Filter\AbstractFilter; +use Magento\Catalog\Model\Layer\Resolver; +use Magento\LayeredNavigation\Block\Navigation\Category\BooleanFilterTest as CategoryBooleanFilterTest; + +/** + * Provides tests for custom boolean filter in navigation block on search page. + * + * @magentoAppArea frontend + * @magentoAppIsolation enabled + * @magentoDbIsolation disabled + */ +class BooleanFilterTest extends CategoryBooleanFilterTest +{ + /** + * @magentoDataFixture Magento/Catalog/_files/product_boolean_attribute.php + * @magentoDataFixture Magento/Catalog/_files/category_with_different_price_products.php + * @dataProvider getFiltersWithCustomAttributeDataProvider + * @param array $products + * @param array $attributeData + * @param array $expectation + * @return void + */ + public function testGetFiltersWithCustomAttribute( + array $products, + array $attributeData, + array $expectation + ): void { + $this->getSearchFiltersAndAssert($products, $attributeData, $expectation); + } + + /** + * @return array + */ + public function getFiltersWithCustomAttributeDataProvider(): array + { + $dataProvider = parent::getFiltersWithCustomAttributeDataProvider(); + + $dataProvider = array_replace_recursive( + $dataProvider, + [ + 'not_used_in_navigation' => [ + 'attribute_data' => [ + 'is_filterable_in_search' => 0, + ], + ], + 'used_in_navigation_with_results' => [ + 'attribute_data' => [ + 'is_filterable_in_search' => 1, + ], + ], + 'used_in_navigation_without_results' => [ + 'attribute_data' => [ + 'is_filterable' => 0, + 'is_filterable_in_search' => 1, + ], + ], + ] + ); + //TODO uncomment after fix MC-29227 + //unset($dataProvider['used_in_navigation_without_results']['expectation'][1]); + + return $dataProvider; + } + + /** + * @inheritdoc + */ + protected function getLayerType(): string + { + return Resolver::CATALOG_LAYER_SEARCH; + } +} diff --git a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Search/DecimalFilterTest.php b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Search/DecimalFilterTest.php new file mode 100644 index 0000000000000..a4d8a64add4b7 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Search/DecimalFilterTest.php @@ -0,0 +1,72 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\LayeredNavigation\Block\Navigation\Search; + +use Magento\Catalog\Model\Layer\Filter\AbstractFilter; +use Magento\Catalog\Model\Layer\Resolver; +use Magento\LayeredNavigation\Block\Navigation\Category\DecimalFilterTest as CategoryDecimalFilterTest; + +/** + * Provides tests for custom price filter in navigation block on search page. + * + * @magentoAppArea frontend + * @magentoAppIsolation enabled + * @magentoDbIsolation disabled + */ +class DecimalFilterTest extends CategoryDecimalFilterTest +{ + /** + * @magentoDataFixture Magento/Catalog/_files/product_decimal_attribute.php + * @magentoDataFixture Magento/Catalog/_files/category_with_different_price_products.php + * @dataProvider getFiltersWithCustomAttributeDataProvider + * @param array $products + * @param array $attributeData + * @param array $expectation + * @return void + */ + public function testGetFiltersWithCustomAttribute( + array $products, + array $attributeData, + array $expectation + ): void { + $this->getSearchFiltersAndAssert($products, $attributeData, $expectation); + } + + /** + * @return array + */ + public function getFiltersWithCustomAttributeDataProvider(): array + { + $dataProvider = parent::getFiltersWithCustomAttributeDataProvider(); + + $dataProvider = array_replace_recursive( + $dataProvider, + [ + 'not_used_in_navigation' => [ + 'attribute_data' => ['is_filterable' => 0, 'is_filterable_in_search' => 0], + ], + 'used_in_navigation_with_results' => [ + 'attribute_data' => [ + 'is_filterable' => AbstractFilter::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS, + 'is_filterable_in_search' => 1, + ], + ], + ] + ); + + return $dataProvider; + } + + /** + * @inheritdoc + */ + protected function getLayerType(): string + { + return Resolver::CATALOG_LAYER_SEARCH; + } +} diff --git a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Search/MultiselectFilterTest.php b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Search/MultiselectFilterTest.php new file mode 100644 index 0000000000000..9220a81f507ee --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Search/MultiselectFilterTest.php @@ -0,0 +1,84 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\LayeredNavigation\Block\Navigation\Search; + +use Magento\Catalog\Model\Layer\Filter\AbstractFilter; +use Magento\Catalog\Model\Layer\Resolver; +use Magento\LayeredNavigation\Block\Navigation\Category\MultiselectFilterTest as CategoryMultiselectFilterTest; + +/** + * Provides tests for custom multiselect filter in navigation block on search page. + * + * @magentoAppArea frontend + * @magentoAppIsolation enabled + * @magentoDbIsolation disabled + */ +class MultiselectFilterTest extends CategoryMultiselectFilterTest +{ + /** + * @magentoDataFixture Magento/Catalog/_files/multiselect_attribute.php + * @magentoDataFixture Magento/Catalog/_files/category_with_different_price_products.php + * @dataProvider getFiltersWithCustomAttributeDataProvider + * @param array $products + * @param array $attributeData + * @param array $expectation + * @return void + */ + public function testGetFiltersWithCustomAttribute( + array $products, + array $attributeData, + array $expectation + ): void { + $this->getSearchFiltersAndAssert($products, $attributeData, $expectation); + } + + /** + * @return array + */ + public function getFiltersWithCustomAttributeDataProvider(): array + { + $dataProvider = parent::getFiltersWithCustomAttributeDataProvider(); + + $dataProvider = array_replace_recursive( + $dataProvider, + [ + 'not_used_in_navigation' => [ + 'attribute_data' => [ + 'is_filterable_in_search' => 0, + ], + ], + 'used_in_navigation_with_results' => [ + 'attribute_data' => [ + 'is_filterable' => AbstractFilter::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS, + 'is_filterable_in_search' => 1, + ], + ], + 'used_in_navigation_without_results' => [ + 'attribute_data' => [ + 'is_filterable' => 0, + 'is_filterable_in_search' => 1, + ], + ], + ] + ); + //TODO uncomment after fix MC-29227 + //unset($dataProvider['used_in_navigation_without_results']['expectation'][1]); + //unset($dataProvider['used_in_navigation_without_results']['expectation'][2]); + //unset($dataProvider['used_in_navigation_without_results']['expectation'][3]); + + return $dataProvider; + } + + /** + * @inheritdoc + */ + protected function getLayerType(): string + { + return Resolver::CATALOG_LAYER_SEARCH; + } +} diff --git a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Search/SelectFilterTest.php b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Search/SelectFilterTest.php new file mode 100644 index 0000000000000..d44994de7e31c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Search/SelectFilterTest.php @@ -0,0 +1,82 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\LayeredNavigation\Block\Navigation\Search; + +use Magento\Catalog\Model\Layer\Filter\AbstractFilter; +use Magento\Catalog\Model\Layer\Resolver; +use Magento\LayeredNavigation\Block\Navigation\Category\SelectFilterTest as CategorySelectFilterTest; + +/** + * Provides tests for custom select filter in navigation block on search page. + * + * @magentoAppArea frontend + * @magentoAppIsolation enabled + * @magentoDbIsolation disabled + */ +class SelectFilterTest extends CategorySelectFilterTest +{ + /** + * @magentoDataFixture Magento/Catalog/_files/product_dropdown_attribute.php + * @magentoDataFixture Magento/Catalog/_files/category_with_different_price_products.php + * @dataProvider getFiltersWithCustomAttributeDataProvider + * @param array $products + * @param array $attributeData + * @param array $expectation + * @return void + */ + public function testGetFiltersWithCustomAttribute( + array $products, + array $attributeData, + array $expectation + ): void { + $this->getSearchFiltersAndAssert($products, $attributeData, $expectation); + } + + /** + * @return array + */ + public function getFiltersWithCustomAttributeDataProvider(): array + { + $dataProvider = parent::getFiltersWithCustomAttributeDataProvider(); + + $dataProvider = array_replace_recursive( + $dataProvider, + [ + 'not_used_in_navigation' => [ + 'attribute_data' => [ + 'is_filterable_in_search' => 0, + ], + ], + 'used_in_navigation_with_results' => [ + 'attribute_data' => [ + 'is_filterable' => AbstractFilter::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS, + 'is_filterable_in_search' => 1, + ], + ], + 'used_in_navigation_without_results' => [ + 'attribute_data' => [ + 'is_filterable' => 0, + 'is_filterable_in_search' => 1, + ], + ], + ] + ); + //TODO uncomment after fix MC-29227 + //unset($dataProvider['used_in_navigation_without_results']['expectation'][2]); + + return $dataProvider; + } + + /** + * @inheritdoc + */ + protected function getLayerType(): string + { + return Resolver::CATALOG_LAYER_SEARCH; + } +} diff --git a/dev/tests/integration/testsuite/Magento/SwatchesLayeredNavigation/Block/Navigation/Category/SwatchTextFilterTest.php b/dev/tests/integration/testsuite/Magento/SwatchesLayeredNavigation/Block/Navigation/Category/SwatchTextFilterTest.php index 345d11e9948d2..a56c13ca92f2f 100644 --- a/dev/tests/integration/testsuite/Magento/SwatchesLayeredNavigation/Block/Navigation/Category/SwatchTextFilterTest.php +++ b/dev/tests/integration/testsuite/Magento/SwatchesLayeredNavigation/Block/Navigation/Category/SwatchTextFilterTest.php @@ -8,7 +8,8 @@ namespace Magento\SwatchesLayeredNavigation\Block\Navigation\Category; use Magento\Catalog\Model\Layer\Filter\AbstractFilter; -use Magento\LayeredNavigation\Block\Navigation\Category\AbstractFiltersTest; +use Magento\Catalog\Model\Layer\Resolver; +use Magento\LayeredNavigation\Block\Navigation\AbstractFiltersTest; /** * Provides tests for custom text swatch filter in navigation block on category page. @@ -24,13 +25,13 @@ class SwatchTextFilterTest extends AbstractFiltersTest * @magentoDataFixture Magento/Catalog/_files/category_with_different_price_products.php * @dataProvider getFiltersWithCustomAttributeDataProvider * @param array $products - * @param int $filterable + * @param array $attributeData * @param array $expectation * @return void */ - public function testGetFiltersWithCustomAttribute(array $products, int $filterable, array $expectation): void + public function testGetFiltersWithCustomAttribute(array $products, array $attributeData, array $expectation): void { - $this->getFiltersAndAssert($products, $filterable, $expectation, 'text_swatch_attribute'); + $this->getCategoryFiltersAndAssert($products, $attributeData, $expectation, 'Category 999'); } /** @@ -41,7 +42,7 @@ public function getFiltersWithCustomAttributeDataProvider(): array return [ 'not_used_in_navigation' => [ 'products_data' => [], - 'filterable' => 0, + 'attribute_data' => ['is_filterable' => 0], 'expectation' => [], ], 'used_in_navigation_with_results' => [ @@ -49,7 +50,7 @@ public function getFiltersWithCustomAttributeDataProvider(): array 'simple1000' => 'Option 1', 'simple1001' => 'Option 2', ], - 'filterable' => AbstractFilter::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS, + 'attribute_data' => ['is_filterable' => AbstractFilter::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS], 'expectation' => [ ['label' => 'Option 1', 'count' => 1], ['label' => 'Option 2', 'count' => 1], @@ -60,7 +61,7 @@ public function getFiltersWithCustomAttributeDataProvider(): array 'simple1000' => 'Option 1', 'simple1001' => 'Option 2', ], - 'filterable' => 2, + 'attribute_data' => ['is_filterable' => 2], 'expectation' => [ ['label' => 'Option 3', 'count' => 0], ['label' => 'Option 1', 'count' => 1], @@ -69,4 +70,20 @@ public function getFiltersWithCustomAttributeDataProvider(): array ], ]; } + + /** + * @inheritdoc + */ + protected function getLayerType(): string + { + return Resolver::CATALOG_LAYER_CATEGORY; + } + + /** + * @inheritdoc + */ + protected function getAttributeCode(): string + { + return 'text_swatch_attribute'; + } } diff --git a/dev/tests/integration/testsuite/Magento/SwatchesLayeredNavigation/Block/Navigation/Category/SwatchVisualFilterTest.php b/dev/tests/integration/testsuite/Magento/SwatchesLayeredNavigation/Block/Navigation/Category/SwatchVisualFilterTest.php index 6f34a7bad9ebc..9860e5a78c436 100644 --- a/dev/tests/integration/testsuite/Magento/SwatchesLayeredNavigation/Block/Navigation/Category/SwatchVisualFilterTest.php +++ b/dev/tests/integration/testsuite/Magento/SwatchesLayeredNavigation/Block/Navigation/Category/SwatchVisualFilterTest.php @@ -8,7 +8,8 @@ namespace Magento\SwatchesLayeredNavigation\Block\Navigation\Category; use Magento\Catalog\Model\Layer\Filter\AbstractFilter; -use Magento\LayeredNavigation\Block\Navigation\Category\AbstractFiltersTest; +use Magento\Catalog\Model\Layer\Resolver; +use Magento\LayeredNavigation\Block\Navigation\AbstractFiltersTest; /** * Provides tests for custom text swatch filter in navigation block on category page. @@ -24,13 +25,13 @@ class SwatchVisualFilterTest extends AbstractFiltersTest * @magentoDataFixture Magento/Catalog/_files/category_with_different_price_products.php * @dataProvider getFiltersWithCustomAttributeDataProvider * @param array $products - * @param int $filterable + * @param array $attributeData * @param array $expectation * @return void */ - public function testGetFiltersWithCustomAttribute(array $products, int $filterable, array $expectation): void + public function testGetFiltersWithCustomAttribute(array $products, array $attributeData, array $expectation): void { - $this->getFiltersAndAssert($products, $filterable, $expectation, 'visual_swatch_attribute'); + $this->getCategoryFiltersAndAssert($products, $attributeData, $expectation, 'Category 999'); } /** @@ -41,7 +42,7 @@ public function getFiltersWithCustomAttributeDataProvider(): array return [ 'not_used_in_navigation' => [ 'products_data' => [], - 'filterable' => 0, + 'attribute_data' => ['is_filterable' => 0], 'expectation' => [], ], 'used_in_navigation_with_results' => [ @@ -49,7 +50,7 @@ public function getFiltersWithCustomAttributeDataProvider(): array 'simple1000' => 'option 1', 'simple1001' => 'option 2', ], - 'filterable' => AbstractFilter::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS, + 'attribute_data' => ['is_filterable' => AbstractFilter::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS], 'expectation' => [ ['label' => 'option 1', 'count' => 1], ['label' => 'option 2', 'count' => 1], @@ -60,7 +61,7 @@ public function getFiltersWithCustomAttributeDataProvider(): array 'simple1000' => 'option 1', 'simple1001' => 'option 2', ], - 'filterable' => 2, + 'attribute_data' => ['is_filterable' => 2], 'expectation' => [ ['label' => 'option 1', 'count' => 1], ['label' => 'option 2', 'count' => 1], @@ -69,4 +70,20 @@ public function getFiltersWithCustomAttributeDataProvider(): array ], ]; } + + /** + * @inheritdoc + */ + protected function getLayerType(): string + { + return Resolver::CATALOG_LAYER_CATEGORY; + } + + /** + * @inheritdoc + */ + protected function getAttributeCode(): string + { + return 'visual_swatch_attribute'; + } } diff --git a/dev/tests/integration/testsuite/Magento/SwatchesLayeredNavigation/Block/Navigation/Search/SwatchTextFilterTest.php b/dev/tests/integration/testsuite/Magento/SwatchesLayeredNavigation/Block/Navigation/Search/SwatchTextFilterTest.php new file mode 100644 index 0000000000000..83867453a98ea --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/SwatchesLayeredNavigation/Block/Navigation/Search/SwatchTextFilterTest.php @@ -0,0 +1,82 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\SwatchesLayeredNavigation\Block\Navigation\Search; + +use Magento\Catalog\Model\Layer\Filter\AbstractFilter; +use Magento\Catalog\Model\Layer\Resolver; +use Magento\SwatchesLayeredNavigation\Block\Navigation\Category\SwatchTextFilterTest as CategorySwatchTextFilterTest; + +/** + * Provides tests for custom swatch text filter in navigation block on search page. + * + * @magentoAppArea frontend + * @magentoAppIsolation enabled + * @magentoDbIsolation disabled + */ +class SwatchTextFilterTest extends CategorySwatchTextFilterTest +{ + /** + * @magentoDataFixture Magento/Swatches/_files/product_text_swatch_attribute.php + * @magentoDataFixture Magento/Catalog/_files/category_with_different_price_products.php + * @dataProvider getFiltersWithCustomAttributeDataProvider + * @param array $products + * @param array $attributeData + * @param array $expectation + * @return void + */ + public function testGetFiltersWithCustomAttribute( + array $products, + array $attributeData, + array $expectation + ): void { + $this->getSearchFiltersAndAssert($products, $attributeData, $expectation); + } + + /** + * @return array + */ + public function getFiltersWithCustomAttributeDataProvider(): array + { + $dataProvider = parent::getFiltersWithCustomAttributeDataProvider(); + + $dataProvider = array_replace_recursive( + $dataProvider, + [ + 'not_used_in_navigation' => [ + 'attribute_data' => [ + 'is_filterable_in_search' => 0, + ], + ], + 'used_in_navigation_with_results' => [ + 'attribute_data' => [ + 'is_filterable' => AbstractFilter::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS, + 'is_filterable_in_search' => 1, + ], + ], + 'used_in_navigation_without_results' => [ + 'attribute_data' => [ + 'is_filterable' => 0, + 'is_filterable_in_search' => 1, + ], + ], + ] + ); + //TODO uncomment after fix MC-29227 + //unset($dataProvider['used_in_navigation_without_results']['expectation'][0]); + + return $dataProvider; + } + + /** + * @inheritdoc + */ + protected function getLayerType(): string + { + return Resolver::CATALOG_LAYER_SEARCH; + } +} diff --git a/dev/tests/integration/testsuite/Magento/SwatchesLayeredNavigation/Block/Navigation/Search/SwatchVisualFilterTest.php b/dev/tests/integration/testsuite/Magento/SwatchesLayeredNavigation/Block/Navigation/Search/SwatchVisualFilterTest.php new file mode 100644 index 0000000000000..47c7b09f2eb85 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/SwatchesLayeredNavigation/Block/Navigation/Search/SwatchVisualFilterTest.php @@ -0,0 +1,82 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\SwatchesLayeredNavigation\Block\Navigation\Search; + +use Magento\Catalog\Model\Layer\Filter\AbstractFilter; +use Magento\Catalog\Model\Layer\Resolver; +use Magento\SwatchesLayeredNavigation\Block\Navigation\Category\SwatchVisualFilterTest as CategorySwatchVisualTest; + +/** + * Provides tests for custom visual swatch filter in navigation block on search page. + * + * @magentoAppArea frontend + * @magentoAppIsolation enabled + * @magentoDbIsolation disabled + */ +class SwatchVisualFilterTest extends CategorySwatchVisualTest +{ + /** + * @magentoDataFixture Magento/Swatches/_files/product_visual_swatch_attribute.php + * @magentoDataFixture Magento/Catalog/_files/category_with_different_price_products.php + * @dataProvider getFiltersWithCustomAttributeDataProvider + * @param array $products + * @param array $attributeData + * @param array $expectation + * @return void + */ + public function testGetFiltersWithCustomAttribute( + array $products, + array $attributeData, + array $expectation + ): void { + $this->getSearchFiltersAndAssert($products, $attributeData, $expectation); + } + + /** + * @return array + */ + public function getFiltersWithCustomAttributeDataProvider(): array + { + $dataProvider = parent::getFiltersWithCustomAttributeDataProvider(); + + $dataProvider = array_replace_recursive( + $dataProvider, + [ + 'not_used_in_navigation' => [ + 'attribute_data' => [ + 'is_filterable_in_search' => 0, + ], + ], + 'used_in_navigation_with_results' => [ + 'attribute_data' => [ + 'is_filterable' => AbstractFilter::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS, + 'is_filterable_in_search' => 1, + ], + ], + 'used_in_navigation_without_results' => [ + 'attribute_data' => [ + 'is_filterable' => 0, + 'is_filterable_in_search' => 1, + ], + ], + ] + ); + //TODO uncomment after fix MC-29227 + //unset($dataProvider['used_in_navigation_without_results']['expectation'][2]); + + return $dataProvider; + } + + /** + * @inheritdoc + */ + protected function getLayerType(): string + { + return Resolver::CATALOG_LAYER_SEARCH; + } +} From a882be9e27c602755fd79c2cc79b217b358a9f38 Mon Sep 17 00:00:00 2001 From: divyajyothi5321 <54176640+divyajyothi5321@users.noreply.github.com> Date: Mon, 16 Dec 2019 20:45:15 +0530 Subject: [PATCH 0433/1143] 26064 issuefix --- app/code/Magento/Wishlist/Controller/Index/Send.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Wishlist/Controller/Index/Send.php b/app/code/Magento/Wishlist/Controller/Index/Send.php index 54aa53d829db5..1ff4e3a653a2d 100644 --- a/app/code/Magento/Wishlist/Controller/Index/Send.php +++ b/app/code/Magento/Wishlist/Controller/Index/Send.php @@ -204,7 +204,7 @@ public function execute() $error = __('Please enter an email address.'); } else { if (count($emails) > $emailsLeft) { - $error = __('This wish list can be shared %1 more times.', $emailsLeft); + $error = __('Maximum of %1 Emails can be Sent.', $emailsLeft); } else { foreach ($emails as $index => $email) { $email = trim($email); From 6ac10980c6322e949b13af43dfea320113586c2f Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Mon, 16 Dec 2019 23:13:53 +0700 Subject: [PATCH 0434/1143] [Msrp] Cover MsrpPriceCalculator by Unit Test --- .../Unit/Pricing/MsrpPriceCalculatorTest.php | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 app/code/Magento/Msrp/Test/Unit/Pricing/MsrpPriceCalculatorTest.php diff --git a/app/code/Magento/Msrp/Test/Unit/Pricing/MsrpPriceCalculatorTest.php b/app/code/Magento/Msrp/Test/Unit/Pricing/MsrpPriceCalculatorTest.php new file mode 100644 index 0000000000000..613547943c9a4 --- /dev/null +++ b/app/code/Magento/Msrp/Test/Unit/Pricing/MsrpPriceCalculatorTest.php @@ -0,0 +1,103 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\Msrp\Test\Unit\Pricing; + +use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\Product\Type as Type; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\GroupedProduct\Model\Product\Type\Grouped as GroupedType; +use Magento\Msrp\Pricing\MsrpPriceCalculator; +use Magento\MsrpGroupedProduct\Pricing\MsrpPriceCalculator as MsrpGroupedCalculator; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +class MsrpPriceCalculatorTest extends TestCase +{ + /** + * Test getMrspPriceValue() with the data provider below + * + * @param array $msrpPriceCalculators + * @param Product $productMock + * @param float $expected + * @dataProvider getMsrpPriceValueDataProvider + */ + public function testGetMsrpPriceValue($msrpPriceCalculators, $productMock, $expected) + { + $objectManager = new ObjectManager($this); + $pricing = $objectManager->getObject(MsrpPriceCalculator::class, + [ + 'msrpPriceCalculators' => $msrpPriceCalculators + ] + ); + + $this->assertEquals($expected, $pricing->getMsrpPriceValue($productMock)); + } + + /** + * Data Provider for test getMrspPriceValue() + * + * @return array + */ + public function getMsrpPriceValueDataProvider() + { + return [ + 'Get Mrsp Price with grouped product and price calculator is also grouped product type' => [ + [ + [ + 'productType' => GroupedType::TYPE_CODE, + 'priceCalculator' => $this->createPriceCalculatorMock( + MsrpGroupedCalculator::class, 23.50) + ] + ], + $this->createProductMock(GroupedType::TYPE_CODE, 0), + 23.50 + ], + 'Get Mrsp Price with simple product and price calculator is grouped product type' => [ + [ + [ + 'productType' => GroupedType::TYPE_CODE, + 'priceCalculator' => $this->createPriceCalculatorMock( + MsrpGroupedCalculator::class, 0) + ] + ], + $this->createProductMock(Type::TYPE_SIMPLE, 24.88), + 24.88 + ] + ]; + } + + /** + * Create Price Calculator Mock + * + * @param string $class + * @param float $msrpPriceValue + * @return MockObject + */ + private function createPriceCalculatorMock($class, $msrpPriceValue) + { + $priceCalculatorMock = $this->createMock($class); + $priceCalculatorMock->expects($this->any())->method('getMsrpPriceValue')->willReturn($msrpPriceValue); + return $priceCalculatorMock; + } + + /** + * Create Product Mock + * + * @param string $typeId + * @param float $msrp + * @return MockObject + */ + private function createProductMock($typeId, $msrp) + { + $productMock = $this->createPartialMock(Product::class, ['getTypeId', 'getMsrp']); + $productMock->expects($this->any())->method('getTypeId')->willReturn($typeId); + $productMock->expects($this->any())->method('getMsrp')->willReturn($msrp); + return $productMock; + } +} From fb7aa9c9c41ec300d697eb2fbb5b3398fbbd7a00 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Mon, 16 Dec 2019 23:37:11 +0700 Subject: [PATCH 0435/1143] fix static test --- .../Test/Unit/Pricing/MsrpPriceCalculatorTest.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Msrp/Test/Unit/Pricing/MsrpPriceCalculatorTest.php b/app/code/Magento/Msrp/Test/Unit/Pricing/MsrpPriceCalculatorTest.php index 613547943c9a4..aac6852b7000c 100644 --- a/app/code/Magento/Msrp/Test/Unit/Pricing/MsrpPriceCalculatorTest.php +++ b/app/code/Magento/Msrp/Test/Unit/Pricing/MsrpPriceCalculatorTest.php @@ -30,7 +30,8 @@ class MsrpPriceCalculatorTest extends TestCase public function testGetMsrpPriceValue($msrpPriceCalculators, $productMock, $expected) { $objectManager = new ObjectManager($this); - $pricing = $objectManager->getObject(MsrpPriceCalculator::class, + $pricing = $objectManager->getObject( + MsrpPriceCalculator::class, [ 'msrpPriceCalculators' => $msrpPriceCalculators ] @@ -52,7 +53,9 @@ public function getMsrpPriceValueDataProvider() [ 'productType' => GroupedType::TYPE_CODE, 'priceCalculator' => $this->createPriceCalculatorMock( - MsrpGroupedCalculator::class, 23.50) + MsrpGroupedCalculator::class, + 23.50 + ) ] ], $this->createProductMock(GroupedType::TYPE_CODE, 0), @@ -63,7 +66,9 @@ public function getMsrpPriceValueDataProvider() [ 'productType' => GroupedType::TYPE_CODE, 'priceCalculator' => $this->createPriceCalculatorMock( - MsrpGroupedCalculator::class, 0) + MsrpGroupedCalculator::class, + 0 + ) ] ], $this->createProductMock(Type::TYPE_SIMPLE, 24.88), From be81804df70a98ab61e7b79d383da8112e61de08 Mon Sep 17 00:00:00 2001 From: Sathish <srsathish92@gmail.com> Date: Mon, 16 Dec 2019 22:22:20 +0530 Subject: [PATCH 0436/1143] [GoogleAnalytics] covered Helper Data by Unit Test --- .../Test/Unit/Helper/DataTest.php | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 app/code/Magento/GoogleAnalytics/Test/Unit/Helper/DataTest.php diff --git a/app/code/Magento/GoogleAnalytics/Test/Unit/Helper/DataTest.php b/app/code/Magento/GoogleAnalytics/Test/Unit/Helper/DataTest.php new file mode 100644 index 0000000000000..ea1df498499de --- /dev/null +++ b/app/code/Magento/GoogleAnalytics/Test/Unit/Helper/DataTest.php @@ -0,0 +1,115 @@ +<?php + +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\GoogleAnalytics\Test\Unit\Helper; + +use Magento\GoogleAnalytics\Helper\Data as HelperData; +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Store\Model\ScopeInterface; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\MockObject\MockObject; + +/** + * Unit test for Magento\GoogleAnalytics\Helper\Data + */ +class DataTest extends TestCase +{ + /** + * @var HelperData + */ + private $helper; + + /** + * @var ScopeConfigInterface|MockObject + */ + private $scopeConfigMock; + + /** + * @inheritDoc + */ + protected function setUp(): void + { + $this->scopeConfigMock = $this->getMockBuilder(ScopeConfigInterface::class) + ->setMethods(['getValue', 'isSetFlag']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $objectManager = new ObjectManager($this); + $this->helper = $objectManager->getObject( + HelperData::class, + [ + 'scopeConfig' => $this->scopeConfigMock + ] + ); + } + + /** + * Test for isGoogleAnalyticsAvailable() + * + * @return void + * @dataProvider gaDataProvider + */ + public function testIsGoogleAnalyticsAvailable($value, $flag): void + { + $this->scopeConfigMock->expects($this->once()) + ->method('getValue') + ->with(HelperData::XML_PATH_ACCOUNT, ScopeInterface::SCOPE_STORE) + ->willReturn($value); + + $this->scopeConfigMock->expects($this->any()) + ->method('isSetFlag') + ->with(HelperData::XML_PATH_ACTIVE, ScopeInterface::SCOPE_STORE) + ->willReturn($flag); + + $this->assertEquals(($value && $flag), $this->helper->isGoogleAnalyticsAvailable()); + } + + /** + * Data provider for isGoogleAnalyticsAvailable() + * + * @return array + */ + public function gaDataProvider(): array + { + return [ + ['GA-XXXX', true], + ['GA-XXXX', false], + ['', true] + ]; + } + + /** + * Test for isAnonymizedIpActive() + * + * @return void + * @dataProvider yesNoDataProvider + */ + public function testIsAnonymizedIpActive($value): void + { + $this->scopeConfigMock->expects($this->once()) + ->method('getValue') + ->with(HelperData::XML_PATH_ANONYMIZE, ScopeInterface::SCOPE_STORE) + ->willReturn($value); + $this->assertEquals((bool) $value, $this->helper->isAnonymizedIpActive()); + } + + /** + * Data provider for isAnonymizedIpActive() + * + * @return array + */ + public function yesNoDataProvider(): array + { + return [ + ['Yes' => '1'], + ['No' => '0'] + ]; + } +} From cf0725a78721e28a60cf68af5c30844424c89d1f Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Mon, 16 Dec 2019 19:52:01 +0200 Subject: [PATCH 0437/1143] Covering the UrlBuilder ViewModel by Unit Test --- .../ViewModel/Page/Grid/UrlBuilderTest.php | 191 ++++++++++++++++++ 1 file changed, 191 insertions(+) create mode 100644 app/code/Magento/Cms/Test/Unit/ViewModel/Page/Grid/UrlBuilderTest.php diff --git a/app/code/Magento/Cms/Test/Unit/ViewModel/Page/Grid/UrlBuilderTest.php b/app/code/Magento/Cms/Test/Unit/ViewModel/Page/Grid/UrlBuilderTest.php new file mode 100644 index 0000000000000..c75f86b7e5ffb --- /dev/null +++ b/app/code/Magento/Cms/Test/Unit/ViewModel/Page/Grid/UrlBuilderTest.php @@ -0,0 +1,191 @@ +<?php +/*** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Cms\Test\Unit\ViewModel\Page\Grid; + +use Magento\Cms\ViewModel\Page\Grid\UrlBuilder; +use Magento\Framework\Url\EncoderInterface; +use Magento\Framework\UrlInterface; +use Magento\Store\Api\Data\StoreInterface; +use Magento\Store\Model\StoreManagerInterface; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +/** + * Class UrlBuilderTest + */ +class UrlBuilderTest extends TestCase +{ + /** + * @var UrlBuilder + */ + private $viewModel; + + /** + * @var UrlInterface|MockObject + */ + private $frontendUrlBuilderMock; + + /** + * @var EncoderInterface|MockObject + */ + private $urlEncoderMock; + + /** + * @var StoreManagerInterface|MockObject + */ + private $storeManagerMock; + + /** + * Set Up + */ + public function setUp() + { + $this->frontendUrlBuilderMock = $this->getMockBuilder(UrlInterface::class) + ->setMethods(['getUrl', 'setScope']) + ->getMockForAbstractClass(); + $this->urlEncoderMock = $this->createMock(EncoderInterface::class); + $this->storeManagerMock = $this->getMockBuilder(StoreManagerInterface::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->viewModel = new UrlBuilder( + $this->frontendUrlBuilderMock, + $this->urlEncoderMock, + $this->storeManagerMock + ); + } + + /** + * Testing url builder with no scope provided + * + * @dataProvider nonScopedUrlsDataProvider + * + * @param array $url + * @param string $expected + * @param string $store + * @param null $scope + */ + public function testUrlBuilderWithNoScope(array $url, string $expected, string $store, $scope = null) + { + $this->frontendUrlBuilderMock->expects($this->any()) + ->method('getUrl') + ->with($url['path'], $url['params']) + ->willReturn($expected); + + $result = $this->viewModel->getUrl($url['path'], $scope, $store); + + $this->assertSame($expected, $result); + } + + /** + * Providing a non scoped urls + * + * @return array + */ + public function nonScopedUrlsDataProvider(): array + { + return [ + [ + [ + 'path' => 'test/view', + 'params' => [ + '_current' => false, + '_nosid' => true + ] + ], + 'http://domain.com/test/view/', + 'en' + ] + ]; + } + + /** + * Testing url builder with a scope provided + * + * @dataProvider scopedUrlsDataProvider + * + * @param string $storeCode + * @param string $defaultStoreCode + * @param array $urlParams + * @param string $scope + */ + public function testScopedUrlBuilder( + string $storeCode, + string $defaultStoreCode, + array $urlParams, + string $scope = 'store' + ) { + /** @var StoreInterface|MockObject $storeMock */ + $storeMock = $this->createMock(StoreInterface::class); + $storeMock->expects($this->any()) + ->method('getCode') + ->willReturn($defaultStoreCode); + $this->storeManagerMock->expects($this->once()) + ->method('getDefaultStoreView') + ->willReturn($storeMock); + + $this->frontendUrlBuilderMock->expects($this->any()) + ->method('getUrl') + ->withConsecutive( + [ + 'test/index', + [ + '_current' => false, + '_nosid' => true, + '_query' => [ + StoreManagerInterface::PARAM_NAME => $storeCode + ] + ] + ], [ + 'stores/store/switch', + $urlParams + ] + ) + ->willReturnOnConsecutiveCalls( + 'http://domain.com/test', + 'http://domain.com/test/index' + ); + + $result = $this->viewModel->getUrl('test/index', $scope, $storeCode); + + $this->assertSame('http://domain.com/test/index', $result); + } + + /** + * Providing a scoped urls + * + * @return array + */ + public function scopedUrlsDataProvider(): array + { + $enStoreCode = 'en'; + $frStoreCode = 'fr'; + $scopedDefaultUrlParams = $defaultUrlParams = [ + '_current' => false, + '_nosid' => true, + '_query' => [ + '___store' => $enStoreCode, + 'uenc' => null, + ] + ]; + $scopedDefaultUrlParams['_query']['___from_store'] = $frStoreCode; + + return [ + [ + $enStoreCode, + $enStoreCode, + $defaultUrlParams, + ], + [ + $enStoreCode, + $frStoreCode, + $scopedDefaultUrlParams + ] + ]; + } +} From 59d6c757bf6a010ebb7fdd12af9650ea937be417 Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Mon, 16 Dec 2019 20:36:41 +0200 Subject: [PATCH 0438/1143] Small adjustments --- .../Cms/Test/Unit/ViewModel/Page/Grid/UrlBuilderTest.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Cms/Test/Unit/ViewModel/Page/Grid/UrlBuilderTest.php b/app/code/Magento/Cms/Test/Unit/ViewModel/Page/Grid/UrlBuilderTest.php index c75f86b7e5ffb..fbb2fb1eb65c5 100644 --- a/app/code/Magento/Cms/Test/Unit/ViewModel/Page/Grid/UrlBuilderTest.php +++ b/app/code/Magento/Cms/Test/Unit/ViewModel/Page/Grid/UrlBuilderTest.php @@ -17,6 +17,8 @@ /** * Class UrlBuilderTest + * + * Testing the UrlBuilder */ class UrlBuilderTest extends TestCase { @@ -141,7 +143,8 @@ public function testScopedUrlBuilder( StoreManagerInterface::PARAM_NAME => $storeCode ] ] - ], [ + ], + [ 'stores/store/switch', $urlParams ] From ad5c3e4c76f0bed775e614d38b2c3b3688918a9d Mon Sep 17 00:00:00 2001 From: Stanislav Ilnytskyi <stailx1@gmail.com> Date: Mon, 16 Dec 2019 20:12:29 +0100 Subject: [PATCH 0439/1143] #26065 isSaleable cache --- .../Model/Product/Type/Configurable.php | 35 +++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php index 5b50cc0ebd5e0..36981aafc34e2 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php @@ -102,6 +102,13 @@ class Configurable extends \Magento\Catalog\Model\Product\Type\AbstractType */ protected $_canConfigure = true; + /** + * Local cache + * + * @var array + */ + protected $isSaleableBySku = []; + /** * @var \Magento\Framework\App\Config\ScopeConfigInterface */ @@ -585,7 +592,7 @@ protected function getGalleryReadHandler() * @param \Magento\Catalog\Model\Product $product * @return \Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable\Product\Collection */ - public function getUsedProductCollection($product) + public function getLinkedProductCollection($product) { $collection = $this->_productCollectionFactory->create()->setFlag( 'product_children', @@ -600,6 +607,17 @@ public function getUsedProductCollection($product) return $collection; } + /** + * Retrieve related products collection. Extension point for listing + * + * @param \Magento\Catalog\Model\Product $product + * @return \Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable\Product\Collection + */ + public function getUsedProductCollection($product) + { + return $this->getLinkedProductCollection($product); + } + /** * Before save process * @@ -744,15 +762,26 @@ private function saveRelatedProducts(ProductInterface $product) */ public function isSalable($product) { + $storeId = $this->getStoreFilter($product); + if ($storeId instanceof \Magento\Store\Model\Store) { + $storeId = $storeId->getId(); + } + + if (isset($this->isSaleableBySku[$storeId][$product->getSku()])) { + return $this->isSaleableBySku[$storeId][$product->getSku()]; + } + $salable = parent::isSalable($product); if ($salable !== false) { - $collection = $this->getUsedProductCollection($product); - $collection->addStoreFilter($this->getStoreFilter($product)); + $collection = $this->getLinkedProductCollection($product); + $collection->addStoreFilter($storeId); $collection = $this->salableProcessor->process($collection); $salable = 0 !== $collection->getSize(); } + $this->isSaleableBySku[$storeId][$product->getSku()] = $salable; + return $salable; } From 193bce2eeacbb6b93be55007a8880c53accd94ae Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Mon, 16 Dec 2019 15:22:34 -0600 Subject: [PATCH 0440/1143] Change action groups name according to CE branch changes --- .../Test/Mftf/ActionGroup/AdminCreateStoreViewActionGroup.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateStoreViewActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateStoreViewActionGroup.xml index 7df225368779b..108b8014bf127 100644 --- a/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateStoreViewActionGroup.xml +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateStoreViewActionGroup.xml @@ -30,7 +30,6 @@ <waitForElementVisible selector="{{AdminConfirmationModalSection.ok}}" stepKey="waitForModal"/> <see selector="{{AdminConfirmationModalSection.title}}" userInput="Warning message" stepKey="seeWarningAboutTakingALongTimeToComplete"/> <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmModal"/> - <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForPageReload"/> - <see selector="{{AdminMessagesSection.success}}" userInput="You saved the store view." stepKey="seeSavedMessage"/> + <waitForText selector="{{AdminMessagesSection.success}}" userInput="You saved the store view." stepKey="seeSavedMessage"/> </actionGroup> </actionGroups> From 8258a162a4629d0ae00ed8c36adff846cb99fd89 Mon Sep 17 00:00:00 2001 From: Oleksandr Miroshnichenko <omiroshnichenko@magento.com> Date: Mon, 16 Dec 2019 15:25:24 -0600 Subject: [PATCH 0441/1143] add missed dependency on jquery ui core module --- app/code/Magento/Ui/view/base/web/js/modal/modal.js | 1 + 1 file changed, 1 insertion(+) 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 cefe79b42e503..bcbb2f3c31dbd 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 @@ -15,6 +15,7 @@ define([ 'text!ui/template/modal/modal-custom.html', 'Magento_Ui/js/lib/key-codes', 'jquery-ui-modules/widget', + 'jquery-ui-modules/core', 'mage/translate' ], function ($, _, template, popupTpl, slideTpl, customTpl, keyCodes) { 'use strict'; From b6819dc9a5440e9f75dc980bf9bc1645a10ca3ed Mon Sep 17 00:00:00 2001 From: Viktor Tymchynskyi <vtymchynskyi@magento.com> Date: Mon, 16 Dec 2019 15:28:21 -0600 Subject: [PATCH 0442/1143] MC-25203: Introduce PHPStan code analysis tool to the static build --- composer.json | 4 +- composer.lock | 554 +++++++++++------- .../Design/Theme/Edit/Tab/GeneralTest.php | 2 +- .../Formatters/FilteredErrorFormatter.php | 142 +++++ .../framework/Magento/PhpStan/autoload.php | 34 ++ .../CodingStandard/Tool/PhpStan.php | 108 ++++ dev/tests/static/framework/bootstrap.php | 4 +- .../Formatters/FilteredErrorFormatterTest.php | 143 +++++ .../Fixtures/ClassWithIgnoreAnnotation.php | 44 ++ .../Fixtures/ClassWithoutIgnoreAnnotation.php | 33 ++ .../ClassAnnotationStructureSniffTest.php | 9 +- .../MethodAnnotationStructureSniffTest.php | 6 +- .../Magento/Test/Php/LiveCodeTest.php | 36 ++ .../Php/_files/phpstan/blacklist/common.txt | 14 + .../Test/Php/_files/phpstan/phpstan.neon | 38 ++ .../Framework/EntityManager/TypeResolver.php | 6 +- .../Test/Unit/Config/ConfigTest.php | 90 +-- .../Unit/Autoloader/FactoryGenerator.php | 3 + 18 files changed, 988 insertions(+), 282 deletions(-) create mode 100644 dev/tests/static/framework/Magento/PhpStan/Formatters/FilteredErrorFormatter.php create mode 100644 dev/tests/static/framework/Magento/PhpStan/autoload.php create mode 100644 dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/PhpStan.php create mode 100644 dev/tests/static/framework/tests/unit/testsuite/Magento/PhpStan/Formatters/FilteredErrorFormatterTest.php create mode 100644 dev/tests/static/framework/tests/unit/testsuite/Magento/PhpStan/Formatters/Fixtures/ClassWithIgnoreAnnotation.php create mode 100644 dev/tests/static/framework/tests/unit/testsuite/Magento/PhpStan/Formatters/Fixtures/ClassWithoutIgnoreAnnotation.php create mode 100644 dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/blacklist/common.txt create mode 100644 dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/phpstan.neon diff --git a/composer.json b/composer.json index 4e78f54942576..59737c298b720 100644 --- a/composer.json +++ b/composer.json @@ -92,6 +92,7 @@ "pdepend/pdepend": "2.5.2", "phpcompatibility/php-compatibility": "^9.3", "phpmd/phpmd": "@stable", + "phpstan/phpstan": "^0.12.2", "phpunit/phpunit": "~6.5.0", "sebastian/phpcpd": "~3.0.0", "squizlabs/php_codesniffer": "~3.4.0" @@ -341,7 +342,8 @@ "Magento\\Tools\\": "dev/tools/Magento/Tools/", "Magento\\Tools\\Sanity\\": "dev/build/publication/sanity/Magento/Tools/Sanity/", "Magento\\TestFramework\\Inspection\\": "dev/tests/static/framework/Magento/TestFramework/Inspection/", - "Magento\\TestFramework\\Utility\\": "dev/tests/static/framework/Magento/TestFramework/Utility/" + "Magento\\TestFramework\\Utility\\": "dev/tests/static/framework/Magento/TestFramework/Utility/", + "Magento\\PhpStan\\": "dev/tests/static/framework/Magento/PhpStan/" } }, "prefer-stable": true diff --git a/composer.lock b/composer.lock index ba126b3eabefc..8391dd2f48518 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e3ad90186a7742707e4c12cda2580b35", + "content-hash": "7effdb746287f89357497d7bc2ed1bf4", "packages": [ { "name": "braintree/braintree_php", @@ -201,16 +201,16 @@ }, { "name": "composer/ca-bundle", - "version": "1.2.4", + "version": "1.2.5", "source": { "type": "git", "url": "https://github.com/composer/ca-bundle.git", - "reference": "10bb96592168a0f8e8f6dcde3532d9fa50b0b527" + "reference": "62e8fc2dc550e5d6d8c9360c7721662670f58149" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/10bb96592168a0f8e8f6dcde3532d9fa50b0b527", - "reference": "10bb96592168a0f8e8f6dcde3532d9fa50b0b527", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/62e8fc2dc550e5d6d8c9360c7721662670f58149", + "reference": "62e8fc2dc550e5d6d8c9360c7721662670f58149", "shasum": "" }, "require": { @@ -221,7 +221,7 @@ "require-dev": { "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8", "psr/log": "^1.0", - "symfony/process": "^2.5 || ^3.0 || ^4.0" + "symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0" }, "type": "library", "extra": { @@ -253,7 +253,7 @@ "ssl", "tls" ], - "time": "2019-08-30T08:44:50+00:00" + "time": "2019-12-11T14:44:42+00:00" }, { "name": "composer/composer", @@ -595,16 +595,16 @@ }, { "name": "guzzlehttp/guzzle", - "version": "6.4.1", + "version": "6.5.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "0895c932405407fd3a7368b6910c09a24d26db11" + "reference": "dbc2bc3a293ed6b1ae08a3651e2bfd213d19b6a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/0895c932405407fd3a7368b6910c09a24d26db11", - "reference": "0895c932405407fd3a7368b6910c09a24d26db11", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/dbc2bc3a293ed6b1ae08a3651e2bfd213d19b6a5", + "reference": "dbc2bc3a293ed6b1ae08a3651e2bfd213d19b6a5", "shasum": "" }, "require": { @@ -619,12 +619,13 @@ "psr/log": "^1.1" }, "suggest": { + "ext-intl": "Required for Internationalized Domain Name (IDN) support", "psr/log": "Required for using the Log middleware" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.3-dev" + "dev-master": "6.5-dev" } }, "autoload": { @@ -657,7 +658,7 @@ "rest", "web service" ], - "time": "2019-10-23T15:58:00+00:00" + "time": "2019-12-07T18:20:45+00:00" }, { "name": "guzzlehttp/promises", @@ -1065,16 +1066,16 @@ }, { "name": "magento/zendframework1", - "version": "1.14.2", + "version": "1.14.3", "source": { "type": "git", "url": "https://github.com/magento/zf1.git", - "reference": "8221062d42a198e431d183bbe672e5e1a2f98c5f" + "reference": "726855dfb080089dc7bc7b016624129f8e7bc4e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/magento/zf1/zipball/8221062d42a198e431d183bbe672e5e1a2f98c5f", - "reference": "8221062d42a198e431d183bbe672e5e1a2f98c5f", + "url": "https://api.github.com/repos/magento/zf1/zipball/726855dfb080089dc7bc7b016624129f8e7bc4e5", + "reference": "726855dfb080089dc7bc7b016624129f8e7bc4e5", "shasum": "" }, "require": { @@ -1108,7 +1109,7 @@ "ZF1", "framework" ], - "time": "2019-07-26T16:43:11+00:00" + "time": "2019-11-26T15:09:40+00:00" }, { "name": "monolog/monolog", @@ -2083,16 +2084,16 @@ }, { "name": "symfony/css-selector", - "version": "v4.3.8", + "version": "v4.4.1", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "f4b3ff6a549d9ed28b2b0ecd1781bf67cf220ee9" + "reference": "64acec7e0d67125e9f4656c68d4a38a42ab5a0b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/f4b3ff6a549d9ed28b2b0ecd1781bf67cf220ee9", - "reference": "f4b3ff6a549d9ed28b2b0ecd1781bf67cf220ee9", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/64acec7e0d67125e9f4656c68d4a38a42ab5a0b7", + "reference": "64acec7e0d67125e9f4656c68d4a38a42ab5a0b7", "shasum": "" }, "require": { @@ -2101,7 +2102,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -2132,20 +2133,20 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2019-10-02T08:36:26+00:00" + "time": "2019-10-12T00:35:04+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v4.3.8", + "version": "v4.3.9", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "0df002fd4f500392eabd243c2947061a50937287" + "reference": "87a1ae7480f2020818013605a65776b9033bcc4f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/0df002fd4f500392eabd243c2947061a50937287", - "reference": "0df002fd4f500392eabd243c2947061a50937287", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/87a1ae7480f2020818013605a65776b9033bcc4f", + "reference": "87a1ae7480f2020818013605a65776b9033bcc4f", "shasum": "" }, "require": { @@ -2202,7 +2203,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2019-11-03T09:04:05+00:00" + "time": "2019-11-28T13:25:45+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -2264,16 +2265,16 @@ }, { "name": "symfony/filesystem", - "version": "v4.3.8", + "version": "v4.4.1", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "9abbb7ef96a51f4d7e69627bc6f63307994e4263" + "reference": "40c2606131d56eff6f193b6e2ceb92414653b591" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/9abbb7ef96a51f4d7e69627bc6f63307994e4263", - "reference": "9abbb7ef96a51f4d7e69627bc6f63307994e4263", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/40c2606131d56eff6f193b6e2ceb92414653b591", + "reference": "40c2606131d56eff6f193b6e2ceb92414653b591", "shasum": "" }, "require": { @@ -2283,7 +2284,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -2310,20 +2311,20 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2019-08-20T14:07:54+00:00" + "time": "2019-11-26T23:16:41+00:00" }, { "name": "symfony/finder", - "version": "v4.3.8", + "version": "v4.4.1", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "72a068f77e317ae77c0a0495236ad292cfb5ce6f" + "reference": "ce8743441da64c41e2a667b8eb66070444ed911e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/72a068f77e317ae77c0a0495236ad292cfb5ce6f", - "reference": "72a068f77e317ae77c0a0495236ad292cfb5ce6f", + "url": "https://api.github.com/repos/symfony/finder/zipball/ce8743441da64c41e2a667b8eb66070444ed911e", + "reference": "ce8743441da64c41e2a667b8eb66070444ed911e", "shasum": "" }, "require": { @@ -2332,7 +2333,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -2359,20 +2360,20 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2019-10-30T12:53:54+00:00" + "time": "2019-11-17T21:56:56+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.12.0", + "version": "v1.13.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "550ebaac289296ce228a706d0867afc34687e3f4" + "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/550ebaac289296ce228a706d0867afc34687e3f4", - "reference": "550ebaac289296ce228a706d0867afc34687e3f4", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", + "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", "shasum": "" }, "require": { @@ -2384,7 +2385,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.12-dev" + "dev-master": "1.13-dev" } }, "autoload": { @@ -2417,20 +2418,20 @@ "polyfill", "portable" ], - "time": "2019-08-06T08:03:45+00:00" + "time": "2019-11-27T13:56:44+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.12.0", + "version": "v1.13.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17" + "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/b42a2f66e8f1b15ccf25652c3424265923eb4f17", - "reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f", + "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f", "shasum": "" }, "require": { @@ -2442,7 +2443,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.12-dev" + "dev-master": "1.13-dev" } }, "autoload": { @@ -2476,20 +2477,20 @@ "portable", "shim" ], - "time": "2019-08-06T08:03:45+00:00" + "time": "2019-11-27T14:18:11+00:00" }, { "name": "symfony/process", - "version": "v4.3.8", + "version": "v4.3.9", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "3b2e0cb029afbb0395034509291f21191d1a4db0" + "reference": "207dab1f17d34ad71ea72e9741ab8049a9d8251b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/3b2e0cb029afbb0395034509291f21191d1a4db0", - "reference": "3b2e0cb029afbb0395034509291f21191d1a4db0", + "url": "https://api.github.com/repos/symfony/process/zipball/207dab1f17d34ad71ea72e9741ab8049a9d8251b", + "reference": "207dab1f17d34ad71ea72e9741ab8049a9d8251b", "shasum": "" }, "require": { @@ -2525,7 +2526,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2019-10-28T17:07:32+00:00" + "time": "2019-11-28T10:05:26+00:00" }, { "name": "tedivm/jshrink", @@ -3529,16 +3530,16 @@ }, { "name": "zendframework/zend-http", - "version": "2.10.0", + "version": "2.11.1", "source": { "type": "git", "url": "https://github.com/zendframework/zend-http.git", - "reference": "4b4983178693a8fdda53b0bbee58552e2d2b1ac0" + "reference": "76000da8490b8685d63ff6f6ff8eefa459f6e9e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-http/zipball/4b4983178693a8fdda53b0bbee58552e2d2b1ac0", - "reference": "4b4983178693a8fdda53b0bbee58552e2d2b1ac0", + "url": "https://api.github.com/repos/zendframework/zend-http/zipball/76000da8490b8685d63ff6f6ff8eefa459f6e9e7", + "reference": "76000da8490b8685d63ff6f6ff8eefa459f6e9e7", "shasum": "" }, "require": { @@ -3559,8 +3560,8 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.10.x-dev", - "dev-develop": "2.11.x-dev" + "dev-master": "2.11.x-dev", + "dev-develop": "2.12.x-dev" } }, "autoload": { @@ -3580,7 +3581,7 @@ "zend", "zf" ], - "time": "2019-02-19T18:58:14+00:00" + "time": "2019-12-04T23:02:34+00:00" }, { "name": "zendframework/zend-hydrator", @@ -3644,22 +3645,26 @@ }, { "name": "zendframework/zend-i18n", - "version": "2.9.2", + "version": "2.10.1", "source": { "type": "git", "url": "https://github.com/zendframework/zend-i18n.git", - "reference": "e17a54b3aee333ab156958f570cde630acee8b07" + "reference": "84038e6a1838b611dcc491b1c40321fa4c3a123c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-i18n/zipball/e17a54b3aee333ab156958f570cde630acee8b07", - "reference": "e17a54b3aee333ab156958f570cde630acee8b07", + "url": "https://api.github.com/repos/zendframework/zend-i18n/zipball/84038e6a1838b611dcc491b1c40321fa4c3a123c", + "reference": "84038e6a1838b611dcc491b1c40321fa4c3a123c", "shasum": "" }, "require": { + "ext-intl": "*", "php": "^5.6 || ^7.0", "zendframework/zend-stdlib": "^2.7 || ^3.0" }, + "conflict": { + "phpspec/prophecy": "<1.9.0" + }, "require-dev": { "phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.5.16", "zendframework/zend-cache": "^2.6.1", @@ -3672,7 +3677,6 @@ "zendframework/zend-view": "^2.6.3" }, "suggest": { - "ext-intl": "Required for most features of Zend\\I18n; included in default builds of PHP", "zendframework/zend-cache": "Zend\\Cache component", "zendframework/zend-config": "Zend\\Config component", "zendframework/zend-eventmanager": "You should install this package to use the events in the translator", @@ -3685,8 +3689,8 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.9.x-dev", - "dev-develop": "2.10.x-dev" + "dev-master": "2.10.x-dev", + "dev-develop": "2.11.x-dev" }, "zf": { "component": "Zend\\I18n", @@ -3708,7 +3712,7 @@ "i18n", "zf" ], - "time": "2019-09-30T12:04:37+00:00" + "time": "2019-12-12T14:08:22+00:00" }, { "name": "zendframework/zend-inputfilter", @@ -4794,16 +4798,16 @@ }, { "name": "zendframework/zend-view", - "version": "2.11.3", + "version": "2.11.4", "source": { "type": "git", "url": "https://github.com/zendframework/zend-view.git", - "reference": "e766457bd6ce13c5354e443bb949511b6904d7f5" + "reference": "a8b1b2d9b52e191539be861a6529f8c8a0c06b9d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-view/zipball/e766457bd6ce13c5354e443bb949511b6904d7f5", - "reference": "e766457bd6ce13c5354e443bb949511b6904d7f5", + "url": "https://api.github.com/repos/zendframework/zend-view/zipball/a8b1b2d9b52e191539be861a6529f8c8a0c06b9d", + "reference": "a8b1b2d9b52e191539be861a6529f8c8a0c06b9d", "shasum": "" }, "require": { @@ -4877,7 +4881,7 @@ "view", "zf" ], - "time": "2019-10-11T21:10:04+00:00" + "time": "2019-12-04T08:40:50+00:00" } ], "packages-dev": [ @@ -5280,16 +5284,16 @@ }, { "name": "codeception/phpunit-wrapper", - "version": "6.7.0", + "version": "6.7.1", "source": { "type": "git", "url": "https://github.com/Codeception/phpunit-wrapper.git", - "reference": "93f59e028826464eac086052fa226e58967f6907" + "reference": "d3b611635b47a583dfaa1a9e98b98fa476d14025" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Codeception/phpunit-wrapper/zipball/93f59e028826464eac086052fa226e58967f6907", - "reference": "93f59e028826464eac086052fa226e58967f6907", + "url": "https://api.github.com/repos/Codeception/phpunit-wrapper/zipball/d3b611635b47a583dfaa1a9e98b98fa476d14025", + "reference": "d3b611635b47a583dfaa1a9e98b98fa476d14025", "shasum": "" }, "require": { @@ -5322,7 +5326,7 @@ } ], "description": "PHPUnit classes used by Codeception", - "time": "2019-08-18T15:43:35+00:00" + "time": "2019-11-23T18:22:38+00:00" }, { "name": "codeception/stub", @@ -6162,16 +6166,16 @@ }, { "name": "doctrine/cache", - "version": "1.9.1", + "version": "1.10.0", "source": { "type": "git", "url": "https://github.com/doctrine/cache.git", - "reference": "89a5c76c39c292f7798f964ab3c836c3f8192a55" + "reference": "382e7f4db9a12dc6c19431743a2b096041bcdd62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/89a5c76c39c292f7798f964ab3c836c3f8192a55", - "reference": "89a5c76c39c292f7798f964ab3c836c3f8192a55", + "url": "https://api.github.com/repos/doctrine/cache/zipball/382e7f4db9a12dc6c19431743a2b096041bcdd62", + "reference": "382e7f4db9a12dc6c19431743a2b096041bcdd62", "shasum": "" }, "require": { @@ -6238,10 +6242,9 @@ "memcached", "php", "redis", - "riak", "xcache" ], - "time": "2019-11-15T14:31:57+00:00" + "time": "2019-11-29T15:36:20+00:00" }, { "name": "doctrine/inflector", @@ -6620,16 +6623,16 @@ }, { "name": "fzaninotto/faker", - "version": "v1.9.0", + "version": "v1.9.1", "source": { "type": "git", "url": "https://github.com/fzaninotto/Faker.git", - "reference": "27a216cbe72327b2d6369fab721a5843be71e57d" + "reference": "fc10d778e4b84d5bd315dad194661e091d307c6f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/27a216cbe72327b2d6369fab721a5843be71e57d", - "reference": "27a216cbe72327b2d6369fab721a5843be71e57d", + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/fc10d778e4b84d5bd315dad194661e091d307c6f", + "reference": "fc10d778e4b84d5bd315dad194661e091d307c6f", "shasum": "" }, "require": { @@ -6642,7 +6645,9 @@ }, "type": "library", "extra": { - "branch-alias": [] + "branch-alias": { + "dev-master": "1.9-dev" + } }, "autoload": { "psr-4": { @@ -6664,7 +6669,7 @@ "faker", "fixtures" ], - "time": "2019-11-14T13:13:06+00:00" + "time": "2019-12-12T13:22:17+00:00" }, { "name": "grasmash/expander", @@ -7030,16 +7035,16 @@ }, { "name": "league/flysystem", - "version": "1.0.57", + "version": "1.0.61", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "0e9db7f0b96b9f12dcf6f65bc34b72b1a30ea55a" + "reference": "4fb13c01784a6c9f165a351e996871488ca2d8c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/0e9db7f0b96b9f12dcf6f65bc34b72b1a30ea55a", - "reference": "0e9db7f0b96b9f12dcf6f65bc34b72b1a30ea55a", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/4fb13c01784a6c9f165a351e996871488ca2d8c9", + "reference": "4fb13c01784a6c9f165a351e996871488ca2d8c9", "shasum": "" }, "require": { @@ -7110,7 +7115,7 @@ "sftp", "storage" ], - "time": "2019-10-16T21:01:05+00:00" + "time": "2019-12-08T21:46:50+00:00" }, { "name": "lusitanian/oauth", @@ -7344,16 +7349,16 @@ }, { "name": "mustache/mustache", - "version": "v2.12.0", + "version": "v2.13.0", "source": { "type": "git", "url": "https://github.com/bobthecow/mustache.php.git", - "reference": "fe8fe72e9d580591854de404cc59a1b83ca4d19e" + "reference": "e95c5a008c23d3151d59ea72484d4f72049ab7f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/mustache.php/zipball/fe8fe72e9d580591854de404cc59a1b83ca4d19e", - "reference": "fe8fe72e9d580591854de404cc59a1b83ca4d19e", + "url": "https://api.github.com/repos/bobthecow/mustache.php/zipball/e95c5a008c23d3151d59ea72484d4f72049ab7f4", + "reference": "e95c5a008c23d3151d59ea72484d4f72049ab7f4", "shasum": "" }, "require": { @@ -7386,20 +7391,20 @@ "mustache", "templating" ], - "time": "2017-07-11T12:54:05+00:00" + "time": "2019-11-23T21:40:31+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.9.3", + "version": "1.9.4", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea" + "reference": "579bb7356d91f9456ccd505f24ca8b667966a0a7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/007c053ae6f31bba39dfa19a7726f56e9763bbea", - "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/579bb7356d91f9456ccd505f24ca8b667966a0a7", + "reference": "579bb7356d91f9456ccd505f24ca8b667966a0a7", "shasum": "" }, "require": { @@ -7434,7 +7439,59 @@ "object", "object graph" ], - "time": "2019-08-09T12:45:53+00:00" + "time": "2019-12-15T19:12:40+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v4.3.0", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "9a9981c347c5c49d6dfe5cf826bb882b824080dc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/9a9981c347c5c49d6dfe5cf826bb882b824080dc", + "reference": "9a9981c347c5c49d6dfe5cf826bb882b824080dc", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=7.0" + }, + "require-dev": { + "ircmaxell/php-yacc": "0.0.5", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.3-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "time": "2019-11-08T13:50:10+00:00" }, { "name": "pdepend/pdepend", @@ -7926,20 +7983,20 @@ "authors": [ { "name": "Manuel Pichler", - "role": "Project Founder", "email": "github@manuel-pichler.de", - "homepage": "https://github.com/manuelpichler" + "homepage": "https://github.com/manuelpichler", + "role": "Project Founder" }, { "name": "Marc Würth", - "role": "Project Maintainer", "email": "ravage@bluewin.ch", - "homepage": "https://github.com/ravage84" + "homepage": "https://github.com/ravage84", + "role": "Project Maintainer" }, { "name": "Other contributors", - "role": "Contributors", - "homepage": "https://github.com/phpmd/phpmd/graphs/contributors" + "homepage": "https://github.com/phpmd/phpmd/graphs/contributors", + "role": "Contributors" } ], "description": "PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD.", @@ -7955,33 +8012,34 @@ }, { "name": "phpoption/phpoption", - "version": "1.5.2", + "version": "1.7.2", "source": { "type": "git", "url": "https://github.com/schmittjoh/php-option.git", - "reference": "2ba2586380f8d2b44ad1b9feb61c371020b27793" + "reference": "77f7c4d2e65413aff5b5a8cc8b3caf7a28d81959" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/2ba2586380f8d2b44ad1b9feb61c371020b27793", - "reference": "2ba2586380f8d2b44ad1b9feb61c371020b27793", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/77f7c4d2e65413aff5b5a8cc8b3caf7a28d81959", + "reference": "77f7c4d2e65413aff5b5a8cc8b3caf7a28d81959", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": "^5.5.9 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "^4.7|^5.0" + "bamarni/composer-bin-plugin": "^1.3", + "phpunit/phpunit": "^4.8.35 || ^5.0 || ^6.0 || ^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.5-dev" + "dev-master": "1.7-dev" } }, "autoload": { - "psr-0": { - "PhpOption\\": "src/" + "psr-4": { + "PhpOption\\": "src/PhpOption/" } }, "notification-url": "https://packagist.org/downloads/", @@ -7992,6 +8050,10 @@ { "name": "Johannes M. Schmitt", "email": "schmittjoh@gmail.com" + }, + { + "name": "Graham Campbell", + "email": "graham@alt-three.com" } ], "description": "Option Type for PHP", @@ -8001,7 +8063,7 @@ "php", "type" ], - "time": "2019-11-06T22:27:00+00:00" + "time": "2019-12-15T19:35:24+00:00" }, { "name": "phpspec/prophecy", @@ -8066,6 +8128,46 @@ ], "time": "2019-10-03T11:07:50+00:00" }, + { + "name": "phpstan/phpstan", + "version": "0.12.3", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "c15a6ea55da71d8133399306f560cfe4d30301b7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c15a6ea55da71d8133399306f560cfe4d30301b7", + "reference": "c15a6ea55da71d8133399306f560cfe4d30301b7", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.3.0", + "php": "^7.1" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.12-dev" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "time": "2019-12-14T13:41:17+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "5.3.2", @@ -9254,27 +9356,27 @@ }, { "name": "symfony/browser-kit", - "version": "v4.3.8", + "version": "v4.4.1", "source": { "type": "git", "url": "https://github.com/symfony/browser-kit.git", - "reference": "b14fa08508afd152257d5dcc7adb5f278654d972" + "reference": "e19e465c055137938afd40cfddd687e7511bbbf0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/b14fa08508afd152257d5dcc7adb5f278654d972", - "reference": "b14fa08508afd152257d5dcc7adb5f278654d972", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/e19e465c055137938afd40cfddd687e7511bbbf0", + "reference": "e19e465c055137938afd40cfddd687e7511bbbf0", "shasum": "" }, "require": { "php": "^7.1.3", - "symfony/dom-crawler": "~3.4|~4.0" + "symfony/dom-crawler": "^3.4|^4.0|^5.0" }, "require-dev": { - "symfony/css-selector": "~3.4|~4.0", - "symfony/http-client": "^4.3", - "symfony/mime": "^4.3", - "symfony/process": "~3.4|~4.0" + "symfony/css-selector": "^3.4|^4.0|^5.0", + "symfony/http-client": "^4.3|^5.0", + "symfony/mime": "^4.3|^5.0", + "symfony/process": "^3.4|^4.0|^5.0" }, "suggest": { "symfony/process": "" @@ -9282,7 +9384,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -9309,36 +9411,36 @@ ], "description": "Symfony BrowserKit Component", "homepage": "https://symfony.com", - "time": "2019-10-28T17:07:32+00:00" + "time": "2019-10-28T20:30:34+00:00" }, { "name": "symfony/config", - "version": "v4.3.8", + "version": "v4.4.1", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "8267214841c44d315a55242ea867684eb43c42ce" + "reference": "7aa5817f1b7a8ed377752b90fcc47dfb3c67b40c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/8267214841c44d315a55242ea867684eb43c42ce", - "reference": "8267214841c44d315a55242ea867684eb43c42ce", + "url": "https://api.github.com/repos/symfony/config/zipball/7aa5817f1b7a8ed377752b90fcc47dfb3c67b40c", + "reference": "7aa5817f1b7a8ed377752b90fcc47dfb3c67b40c", "shasum": "" }, "require": { "php": "^7.1.3", - "symfony/filesystem": "~3.4|~4.0", + "symfony/filesystem": "^3.4|^4.0|^5.0", "symfony/polyfill-ctype": "~1.8" }, "conflict": { "symfony/finder": "<3.4" }, "require-dev": { - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/event-dispatcher": "~3.4|~4.0", - "symfony/finder": "~3.4|~4.0", - "symfony/messenger": "~4.1", - "symfony/yaml": "~3.4|~4.0" + "symfony/event-dispatcher": "^3.4|^4.0|^5.0", + "symfony/finder": "^3.4|^4.0|^5.0", + "symfony/messenger": "^4.1|^5.0", + "symfony/service-contracts": "^1.1|^2", + "symfony/yaml": "^3.4|^4.0|^5.0" }, "suggest": { "symfony/yaml": "To use the yaml reference dumper" @@ -9346,7 +9448,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -9373,29 +9475,29 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2019-11-08T08:31:27+00:00" + "time": "2019-12-01T10:50:45+00:00" }, { "name": "symfony/dependency-injection", - "version": "v4.3.8", + "version": "v4.4.1", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "80c6d9e19467dfbba14f830ed478eb592ce51b64" + "reference": "ad46a4def1325befab696b49c839dffea3fc92bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/80c6d9e19467dfbba14f830ed478eb592ce51b64", - "reference": "80c6d9e19467dfbba14f830ed478eb592ce51b64", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/ad46a4def1325befab696b49c839dffea3fc92bd", + "reference": "ad46a4def1325befab696b49c839dffea3fc92bd", "shasum": "" }, "require": { "php": "^7.1.3", "psr/container": "^1.0", - "symfony/service-contracts": "^1.1.6" + "symfony/service-contracts": "^1.1.6|^2" }, "conflict": { - "symfony/config": "<4.3", + "symfony/config": "<4.3|>=5.0", "symfony/finder": "<3.4", "symfony/proxy-manager-bridge": "<3.4", "symfony/yaml": "<3.4" @@ -9406,8 +9508,8 @@ }, "require-dev": { "symfony/config": "^4.3", - "symfony/expression-language": "~3.4|~4.0", - "symfony/yaml": "~3.4|~4.0" + "symfony/expression-language": "^3.4|^4.0|^5.0", + "symfony/yaml": "^3.4|^4.0|^5.0" }, "suggest": { "symfony/config": "", @@ -9419,7 +9521,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -9446,20 +9548,20 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2019-11-08T16:22:27+00:00" + "time": "2019-12-01T10:19:36+00:00" }, { "name": "symfony/dom-crawler", - "version": "v4.3.8", + "version": "v4.4.1", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "4b9efd5708c3a38593e19b6a33e40867f4f89d72" + "reference": "36bbcab9369fc2f583220890efd43bf262d563fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/4b9efd5708c3a38593e19b6a33e40867f4f89d72", - "reference": "4b9efd5708c3a38593e19b6a33e40867f4f89d72", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/36bbcab9369fc2f583220890efd43bf262d563fd", + "reference": "36bbcab9369fc2f583220890efd43bf262d563fd", "shasum": "" }, "require": { @@ -9472,7 +9574,7 @@ }, "require-dev": { "masterminds/html5": "^2.6", - "symfony/css-selector": "~3.4|~4.0" + "symfony/css-selector": "^3.4|^4.0|^5.0" }, "suggest": { "symfony/css-selector": "" @@ -9480,7 +9582,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -9507,7 +9609,7 @@ ], "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2019-10-28T17:07:32+00:00" + "time": "2019-10-29T11:38:30+00:00" }, { "name": "symfony/http-foundation", @@ -9566,16 +9668,16 @@ }, { "name": "symfony/options-resolver", - "version": "v4.3.8", + "version": "v4.4.1", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "f46c7fc8e207bd8a2188f54f8738f232533765a4" + "reference": "2be23e63f33de16b49294ea6581f462932a77e2f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/f46c7fc8e207bd8a2188f54f8738f232533765a4", - "reference": "f46c7fc8e207bd8a2188f54f8738f232533765a4", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/2be23e63f33de16b49294ea6581f462932a77e2f", + "reference": "2be23e63f33de16b49294ea6581f462932a77e2f", "shasum": "" }, "require": { @@ -9584,7 +9686,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -9616,20 +9718,20 @@ "configuration", "options" ], - "time": "2019-10-28T20:59:01+00:00" + "time": "2019-10-28T21:57:16+00:00" }, { "name": "symfony/polyfill-php54", - "version": "v1.12.0", + "version": "v1.13.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php54.git", - "reference": "a043bcced870214922fbb4bf22679d431ec0296a" + "reference": "dd1618047426412036e98d159940d58a81fc392c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/a043bcced870214922fbb4bf22679d431ec0296a", - "reference": "a043bcced870214922fbb4bf22679d431ec0296a", + "url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/dd1618047426412036e98d159940d58a81fc392c", + "reference": "dd1618047426412036e98d159940d58a81fc392c", "shasum": "" }, "require": { @@ -9638,7 +9740,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.12-dev" + "dev-master": "1.13-dev" } }, "autoload": { @@ -9674,20 +9776,20 @@ "portable", "shim" ], - "time": "2019-08-06T08:03:45+00:00" + "time": "2019-11-27T13:56:44+00:00" }, { "name": "symfony/polyfill-php55", - "version": "v1.12.0", + "version": "v1.13.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php55.git", - "reference": "548bb39407e78e54f785b4e18c7e0d5d9e493265" + "reference": "b0d838f225725e2951af1aafc784d2e5ea7b656e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/548bb39407e78e54f785b4e18c7e0d5d9e493265", - "reference": "548bb39407e78e54f785b4e18c7e0d5d9e493265", + "url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/b0d838f225725e2951af1aafc784d2e5ea7b656e", + "reference": "b0d838f225725e2951af1aafc784d2e5ea7b656e", "shasum": "" }, "require": { @@ -9697,7 +9799,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.12-dev" + "dev-master": "1.13-dev" } }, "autoload": { @@ -9730,20 +9832,20 @@ "portable", "shim" ], - "time": "2019-08-06T08:03:45+00:00" + "time": "2019-11-27T13:56:44+00:00" }, { "name": "symfony/polyfill-php70", - "version": "v1.12.0", + "version": "v1.13.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "54b4c428a0054e254223797d2713c31e08610831" + "reference": "af23c7bb26a73b850840823662dda371484926c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/54b4c428a0054e254223797d2713c31e08610831", - "reference": "54b4c428a0054e254223797d2713c31e08610831", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/af23c7bb26a73b850840823662dda371484926c4", + "reference": "af23c7bb26a73b850840823662dda371484926c4", "shasum": "" }, "require": { @@ -9753,7 +9855,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.12-dev" + "dev-master": "1.13-dev" } }, "autoload": { @@ -9789,20 +9891,20 @@ "portable", "shim" ], - "time": "2019-08-06T08:03:45+00:00" + "time": "2019-11-27T13:56:44+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.12.0", + "version": "v1.13.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "04ce3335667451138df4307d6a9b61565560199e" + "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/04ce3335667451138df4307d6a9b61565560199e", - "reference": "04ce3335667451138df4307d6a9b61565560199e", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/66fea50f6cb37a35eea048d75a7d99a45b586038", + "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038", "shasum": "" }, "require": { @@ -9811,7 +9913,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.12-dev" + "dev-master": "1.13-dev" } }, "autoload": { @@ -9844,24 +9946,24 @@ "portable", "shim" ], - "time": "2019-08-06T08:03:45+00:00" + "time": "2019-11-27T13:56:44+00:00" }, { "name": "symfony/service-contracts", - "version": "v1.1.8", + "version": "v2.0.1", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "ffc7f5692092df31515df2a5ecf3b7302b3ddacf" + "reference": "144c5e51266b281231e947b51223ba14acf1a749" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/ffc7f5692092df31515df2a5ecf3b7302b3ddacf", - "reference": "ffc7f5692092df31515df2a5ecf3b7302b3ddacf", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/144c5e51266b281231e947b51223ba14acf1a749", + "reference": "144c5e51266b281231e947b51223ba14acf1a749", "shasum": "" }, "require": { - "php": "^7.1.3", + "php": "^7.2.5", "psr/container": "^1.0" }, "suggest": { @@ -9870,7 +9972,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -9902,30 +10004,30 @@ "interoperability", "standards" ], - "time": "2019-10-14T12:27:06+00:00" + "time": "2019-11-18T17:27:11+00:00" }, { "name": "symfony/stopwatch", - "version": "v4.3.8", + "version": "v4.4.1", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "e96c259de6abcd0cead71f0bf4d730d53ee464d0" + "reference": "5745b514fc56ae1907c6b8ed74f94f90f64694e9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/e96c259de6abcd0cead71f0bf4d730d53ee464d0", - "reference": "e96c259de6abcd0cead71f0bf4d730d53ee464d0", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/5745b514fc56ae1907c6b8ed74f94f90f64694e9", + "reference": "5745b514fc56ae1907c6b8ed74f94f90f64694e9", "shasum": "" }, "require": { "php": "^7.1.3", - "symfony/service-contracts": "^1.0" + "symfony/service-contracts": "^1.0|^2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -9952,20 +10054,20 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2019-11-05T14:48:09+00:00" + "time": "2019-11-05T16:11:08+00:00" }, { "name": "symfony/yaml", - "version": "v4.3.8", + "version": "v4.4.1", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "324cf4b19c345465fad14f3602050519e09e361d" + "reference": "76de473358fe802578a415d5bb43c296cf09d211" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/324cf4b19c345465fad14f3602050519e09e361d", - "reference": "324cf4b19c345465fad14f3602050519e09e361d", + "url": "https://api.github.com/repos/symfony/yaml/zipball/76de473358fe802578a415d5bb43c296cf09d211", + "reference": "76de473358fe802578a415d5bb43c296cf09d211", "shasum": "" }, "require": { @@ -9976,7 +10078,7 @@ "symfony/console": "<3.4" }, "require-dev": { - "symfony/console": "~3.4|~4.0" + "symfony/console": "^3.4|^4.0|^5.0" }, "suggest": { "symfony/console": "For validating YAML files using the lint command" @@ -9984,7 +10086,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -10011,7 +10113,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2019-10-30T12:58:49+00:00" + "time": "2019-11-12T14:51:11+00:00" }, { "name": "theseer/fdomdocument", @@ -10146,31 +10248,29 @@ }, { "name": "webmozart/assert", - "version": "1.5.0", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "88e6d84706d09a236046d686bbea96f07b3a34f4" + "reference": "573381c0a64f155a0d9a23f4b0c797194805b925" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/88e6d84706d09a236046d686bbea96f07b3a34f4", - "reference": "88e6d84706d09a236046d686bbea96f07b3a34f4", + "url": "https://api.github.com/repos/webmozart/assert/zipball/573381c0a64f155a0d9a23f4b0c797194805b925", + "reference": "573381c0a64f155a0d9a23f4b0c797194805b925", "shasum": "" }, "require": { "php": "^5.3.3 || ^7.0", "symfony/polyfill-ctype": "^1.8" }, + "conflict": { + "vimeo/psalm": "<3.6.0" + }, "require-dev": { "phpunit/phpunit": "^4.8.36 || ^7.5.13" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -10192,7 +10292,7 @@ "check", "validate" ], - "time": "2019-08-24T08:43:50+00:00" + "time": "2019-11-24T13:36:37+00:00" }, { "name": "weew/helpers-array", diff --git a/dev/tests/integration/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Tab/GeneralTest.php b/dev/tests/integration/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Tab/GeneralTest.php index 2539011f25a36..2613b71c24202 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Tab/GeneralTest.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Tab/GeneralTest.php @@ -16,7 +16,7 @@ class GeneralTest extends \PHPUnit\Framework\TestCase /** @var \Magento\Framework\View\Design\ThemeInterface */ protected $_theme; - /** @var \Magento\Theme\Block\Adminhtml\System\Design\Theme\Edit\Tab_General */ + /** @var \Magento\Theme\Block\Adminhtml\System\Design\Theme\Edit\Tab\General */ protected $_block; protected function setUp() diff --git a/dev/tests/static/framework/Magento/PhpStan/Formatters/FilteredErrorFormatter.php b/dev/tests/static/framework/Magento/PhpStan/Formatters/FilteredErrorFormatter.php new file mode 100644 index 0000000000000..b3a4bd9ae0791 --- /dev/null +++ b/dev/tests/static/framework/Magento/PhpStan/Formatters/FilteredErrorFormatter.php @@ -0,0 +1,142 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\PhpStan\Formatters; + +use PHPStan\Command\AnalysisResult; +use PHPStan\Command\ErrorFormatter\TableErrorFormatter; +use PHPStan\Command\Output; + +/** + * To mute the PHPStan error message add a comment above the reported error line. + * + * Example of usage: + * + * // phpstan:ignore "Method Magento\TestModule\TestClass::testMethod() invoked with 1 parameter, 0 required." + * $this->testMethod(1); + * + * or replace some part of error message with * + * + * // phpstan:ignore "Method * invoked with 1 parameter, 0 required." + * $this->testMethod(1); + * + * or just + * + * // phpstan:ignore + * $this->testMethod(1); + * + * or + * + * $this->testMethod(1); // phpstan:ignore + * + * The error message will be suppressed. + * + * @see \Magento\PhpStan\Formatters\Fixtures\ClassWithIgnoreAnnotation + */ +class FilteredErrorFormatter extends TableErrorFormatter +{ + private const MUTE_ERROR_ANNOTATION = 'phpstan:ignore'; + + private const NO_ERRORS = 0; + + /** + * @inheritdoc + */ + public function formatErrors(AnalysisResult $analysisResult, Output $output): int + { + if (!$analysisResult->hasErrors()) { + $style = $output->getStyle(); + $style->success('No errors'); + return self::NO_ERRORS; + } + + $fileSpecificErrorsWithoutIgnoredErrors = $this->clearIgnoredErrors( + $analysisResult->getFileSpecificErrors() + ); + + $clearedAnalysisResult = new AnalysisResult( + $fileSpecificErrorsWithoutIgnoredErrors, + $analysisResult->getNotFileSpecificErrors(), + $analysisResult->isDefaultLevelUsed(), + $analysisResult->hasInferrablePropertyTypesFromConstructor(), + $analysisResult->getProjectConfigFile() + ); + + return parent::formatErrors($clearedAnalysisResult, $output); + } + + /** + * Filters error list. + * + * @param array $fileSpecificErrors + * @return array + */ + private function clearIgnoredErrors(array $fileSpecificErrors): array + { + foreach ($fileSpecificErrors as $index => $error) { + $fileName = $error->getFile(); + // phpcs:ignore Magento2.Functions.DiscouragedFunction + if (!file_exists($fileName)) { + continue; + } + + $line = $error->getLine() ? $this->getLineWithMuteErrorAnnotation($error->getLine(), $fileName) : null; + if ($line === null) { + continue; + } + + $extractErrorPattern = '@' . self::MUTE_ERROR_ANNOTATION . '\s+"(.*?)"@'; + $errorPattern = preg_match($extractErrorPattern, $line, $result) ? $this->preparePattern($result[1]) : ''; + if ($errorPattern && !preg_match('@' . $errorPattern . '@i', $error->getMessage())) { + continue; + } + + unset($fileSpecificErrors[$index]); + } + + return $fileSpecificErrors; + } + + /** + * Returns context of the line with mute error annotation. + * + * @param int $errorLine + * @param string $fileName + * @return string|null + */ + private function getLineWithMuteErrorAnnotation(int $errorLine, string $fileName): ?string + { + $file = new \SplFileObject($fileName); + $lineNumbersToCheck = [ + $errorLine - 2, // the line above to the line that caused the error + $errorLine - 1, // the line that caused the error + $errorLine - 3, // the line two lines above to the line that caused the error + ]; + + foreach ($lineNumbersToCheck as $lineNumber) { + $file->seek($lineNumber > 0 ? $lineNumber : 0); + $line = $file->current(); + if (strpos($line, self::MUTE_ERROR_ANNOTATION) !== false) { + return $line; + } + } + + return null; + } + + /** + * Prepares error pattern. + * + * @param string $errorDescription + * @return string + */ + private function preparePattern(string $errorDescription) + { + // phpcs:ignore Magento2.Functions.DiscouragedFunction + return str_replace('*', '(?:.*?)', addcslashes(trim($errorDescription), '\()[]')); + } +} diff --git a/dev/tests/static/framework/Magento/PhpStan/autoload.php b/dev/tests/static/framework/Magento/PhpStan/autoload.php new file mode 100644 index 0000000000000..baf44b2381759 --- /dev/null +++ b/dev/tests/static/framework/Magento/PhpStan/autoload.php @@ -0,0 +1,34 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +// phpcs:disable + +use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\Code\Generator\Io; +use Magento\Framework\Filesystem\Driver\File; +use Magento\Framework\TestFramework\Unit\Autoloader\ExtensionAttributesGenerator; +use Magento\Framework\TestFramework\Unit\Autoloader\ExtensionAttributesInterfaceGenerator; +use Magento\Framework\TestFramework\Unit\Autoloader\FactoryGenerator; +use Magento\Framework\TestFramework\Unit\Autoloader\GeneratedClassesAutoloader; + +if (!defined('TESTS_TEMP_DIR')) { + //phpcs:ignore Magento2.Functions.DiscouragedFunction + define('TESTS_TEMP_DIR', dirname(__DIR__) . '/../../tmp'); +} + +$generatorIo = new Io( + new File(), + TESTS_TEMP_DIR . '/' . DirectoryList::getDefaultConfig()[DirectoryList::GENERATED_CODE][DirectoryList::PATH] +); +$generatedCodeAutoloader = new GeneratedClassesAutoloader( + [ + new ExtensionAttributesGenerator(), + new ExtensionAttributesInterfaceGenerator(), + new FactoryGenerator(), + ], + $generatorIo +); +spl_autoload_register([$generatedCodeAutoloader, 'load']); diff --git a/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/PhpStan.php b/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/PhpStan.php new file mode 100644 index 0000000000000..9048262722d48 --- /dev/null +++ b/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/PhpStan.php @@ -0,0 +1,108 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\TestFramework\CodingStandard\Tool; + +use Magento\TestFramework\CodingStandard\ToolInterface; + +/** + * PhpStan tool wrapper. + */ +class PhpStan implements ToolInterface +{ + /** + * Rule level to be used. + * + * @see https://github.com/phpstan/phpstan#rule-levels + */ + private const RULE_LEVEL = 0; + + /** + * Memory limit required by PHPStan for full Magento project scan. + */ + private const MEMORY_LIMIT = '4G'; + + /** + * Error formatter to be used. + * + * @see https://github.com/phpstan/phpstan#existing-error-formatters-to-be-used + */ + private const ERROR_FORMAT = 'filtered'; + + /** + * Report file. + * + * @var string + */ + private $reportFile; + + /** + * PHPStan configuration file in neon format. + * + * @var string + */ + private $confFile; + + /** + * @param string $confFile + * @param string $reportFile + */ + public function __construct(string $confFile, string $reportFile) + { + $this->reportFile = $reportFile; + $this->confFile = $confFile; + } + + /** + * @inheritdoc + * @SuppressWarnings(PHPMD.UnusedLocalVariable) + */ + public function canRun(): bool + { + // phpcs:disable Magento2.Security.InsecureFunction + exec($this->getCommand() . ' --version', $output, $exitCode); + return $exitCode === 0; + } + + /** + * @inheritdoc + * @SuppressWarnings(PHPMD.UnusedLocalVariable) + */ + public function run(array $whiteList): int + { + if (empty($whiteList)) { + return 0; + } + + $command = $this->getCommand() . ' analyse' . + ' --level ' . self::RULE_LEVEL . + ' --no-progress' . + ' --error-format=' . self::ERROR_FORMAT . + ' --memory-limit=' . self::MEMORY_LIMIT . + // phpcs:ignore Magento2.Functions.DiscouragedFunction + ' --configuration ' . escapeshellarg($this->confFile) . + ' ' . implode(' ', $whiteList) . + ' > ' . $this->reportFile; + + // phpcs:disable Magento2.Security.InsecureFunction + exec($command, $output, $exitCode); + + return $exitCode; + } + + /** + * Get PHPStan CLI command + * + * @return string + */ + private function getCommand(): string + { + // phpcs:ignore Magento2.Security.IncludeFile + $vendorDir = require BP . '/app/etc/vendor_path.php'; + return 'php ' . BP . '/' . $vendorDir . '/bin/phpstan'; + } +} diff --git a/dev/tests/static/framework/bootstrap.php b/dev/tests/static/framework/bootstrap.php index 5e3336ebc28de..e43337cf06026 100644 --- a/dev/tests/static/framework/bootstrap.php +++ b/dev/tests/static/framework/bootstrap.php @@ -4,6 +4,8 @@ * See COPYING.txt for license details. */ +// phpcs:disable + use Magento\Framework\App\Utility\Files; use Magento\Framework\Component\ComponentRegistrar; use Magento\Framework\Component\DirSearch; @@ -15,7 +17,7 @@ require __DIR__ . '/autoload.php'; if (!defined('TESTS_TEMP_DIR')) { - define('TESTS_TEMP_DIR', __DIR__ . DIRECTORY_SEPARATOR . 'tmp'); + define('TESTS_TEMP_DIR', dirname(__DIR__) . '/tmp'); } setCustomErrorHandler(); diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/PhpStan/Formatters/FilteredErrorFormatterTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/PhpStan/Formatters/FilteredErrorFormatterTest.php new file mode 100644 index 0000000000000..dfedd625fdb0e --- /dev/null +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/PhpStan/Formatters/FilteredErrorFormatterTest.php @@ -0,0 +1,143 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types = 1); + +namespace Magento\PhpStan\Formatters; + +use PHPStan\Analyser\Error; +use PHPStan\Command\AnalysisResult; +use PHPStan\File\FuzzyRelativePathHelper; +use PHPStan\ShouldNotHappenException; +use PHPStan\Testing\ErrorFormatterTestCase; + +/** + * Tests filter error formatter. + */ +class FilteredErrorFormatterTest extends ErrorFormatterTestCase +{ + protected const DIRECTORY_PATH = __DIR__ . '/Fixtures'; + + /** + * Tests errors filtering. + * + * @param string $message + * @param int $exitCode + * @param array $fileErrors + * @param string $expected + * @throws ShouldNotHappenException + * + * @dataProvider dataFormatterOutputProvider + */ + public function testFormatErrors( + string $message, + int $exitCode + array $fileErrors, + string $expected + ): void { + $formatter = new FilteredErrorFormatter( + new FuzzyRelativePathHelper(self::DIRECTORY_PATH, '/', []), + false, + false, + false, + true + ); + + $analysisResult = new AnalysisResult( + $fileErrors, + [], + false, + false, + null + ); + + $this->assertSame( + $exitCode, + $formatter->formatErrors( + $analysisResult, + $this->getOutput() + ), + sprintf('%s: response code do not match', $message) + ); + $this->assertEquals( + $expected, + $this->getOutputContent(), + sprintf('%s: output do not match', $message) + ); + } + + /** + * @return array + */ + public function dataFormatterOutputProvider(): array + { + // phpcs:disable Generic.Files.LineLength.TooLong + $errorMessage = 'Method Magento\PhpStan\Formatters\Fixtures\ClassWithIgnoreAnnotation::testMethod() invoked with 2 parameters, 1 required.'; + // phpcs:enable Generic.Files.LineLength.TooLong + + return [ + [ + 'No errors', + 0, + [], + "\n [OK] No errors\n\n", + ], + [ + 'All errors are suppressed by ignore annotations', + 0, + [ + new Error( + 'Method level error', + self::DIRECTORY_PATH . '/ClassWithIgnoreAnnotation.php', + 22 + ), + new Error( + $errorMessage, + self::DIRECTORY_PATH . '/ClassWithIgnoreAnnotation.php', + 25 + ), + new Error( + $errorMessage, + self::DIRECTORY_PATH . '/ClassWithIgnoreAnnotation.php', + 28 + ), + new Error( + $errorMessage, + self::DIRECTORY_PATH . '/ClassWithIgnoreAnnotation.php', + 31 + ), + new Error( + $errorMessage, + self::DIRECTORY_PATH . '/ClassWithIgnoreAnnotation.php', + 33 + ), + ], + "\n [OK] No errors\n\n", + ], + [ + 'Errors aren\'t suppressed by ignore annotations', + 1, + [ + new Error( + $errorMessage, + self::DIRECTORY_PATH . '/ClassWithoutIgnoreAnnotation.php', + 21 + ), + ], + // phpcs:disable Generic.Files.LineLength.TooLong + ' ------ --------------------------------------------------------------------------------------------------------------------------- + Line ClassWithoutIgnoreAnnotation.php + ------ --------------------------------------------------------------------------------------------------------------------------- + 21 Method Magento\PhpStan\Formatters\Fixtures\ClassWithIgnoreAnnotation::testMethod() invoked with 2 parameters, 1 required. + ------ --------------------------------------------------------------------------------------------------------------------------- + + [ERROR] Found 1 error + +', + // phpcs:enable Generic.Files.LineLength.TooLong + ] + ]; + } +} diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/PhpStan/Formatters/Fixtures/ClassWithIgnoreAnnotation.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/PhpStan/Formatters/Fixtures/ClassWithIgnoreAnnotation.php new file mode 100644 index 0000000000000..dc0637704ec82 --- /dev/null +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/PhpStan/Formatters/Fixtures/ClassWithIgnoreAnnotation.php @@ -0,0 +1,44 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\PhpStan\Formatters\Fixtures; + +/** + * Class ClassWithIgnoreAnnotation + * + * phpcs:ignoreFile + */ +class ClassWithIgnoreAnnotation +{ + /** + * Test method. + * phpstan:ignore "Method level error" + */ + public function getProductList() + { + // phpstan:ignore "Method Magento\PhpStan\Formatters\Fixtures\ClassWithIgnoreAnnotation::testMethod() invoked with 2 parameters, 1 required." + $this->testMethod('test1', 'test2'); + + // phpstan:ignore "Method * invoked with 2 parameters, 1 required." + $this->testMethod('test1', 'test2'); + + // phpstan:ignore + $this->testMethod('test1', 'test2'); + + $this->testMethod('test1', 'test2'); // phpstan:ignore + } + + /** + * @param string $arg1 + * @return string + */ + private function testMethod(string $arg1) + { + return $arg1; + } +} diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/PhpStan/Formatters/Fixtures/ClassWithoutIgnoreAnnotation.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/PhpStan/Formatters/Fixtures/ClassWithoutIgnoreAnnotation.php new file mode 100644 index 0000000000000..d46ba7c63d86a --- /dev/null +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/PhpStan/Formatters/Fixtures/ClassWithoutIgnoreAnnotation.php @@ -0,0 +1,33 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\PhpStan\Formatters\Fixtures; + +/** + * Class ClassWithoutIgnoreAnnotation + * phpcs:ignoreFile + */ +class ClassWithoutIgnoreAnnotation +{ + /** + * Test method. + */ + public function getProductList() + { + $this->testMethod('test1', 'test2'); + } + + /** + * @param string $arg1 + * @return string + */ + private function testMethod(string $arg1) + { + return $arg1; + } +} diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/Sniffs/Annotation/ClassAnnotationStructureSniffTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/Sniffs/Annotation/ClassAnnotationStructureSniffTest.php index b12cb1fbfcbd3..afe559fdd6759 100644 --- a/dev/tests/static/framework/tests/unit/testsuite/Magento/Sniffs/Annotation/ClassAnnotationStructureSniffTest.php +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/Sniffs/Annotation/ClassAnnotationStructureSniffTest.php @@ -4,6 +4,7 @@ * See COPYING.txt for license details. */ declare(strict_types=1); + namespace Magento\Sniffs\Annotation; class ClassAnnotationStructureSniffTest extends \PHPUnit\Framework\TestCase @@ -63,8 +64,8 @@ public function testProcess($fileUnderTest, $expectedReportFile) { $reportFile = __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'phpcs_report.txt'; $this->copyFile( - __DIR__ . DIRECTORY_SEPARATOR . '_files'. DIRECTORY_SEPARATOR, - TESTS_TEMP_DIR + __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR, + TESTS_TEMP_DIR . DIRECTORY_SEPARATOR ); $codeSniffer = new \Magento\TestFramework\CodingStandard\Tool\CodeSniffer( 'Magento', @@ -72,11 +73,11 @@ public function testProcess($fileUnderTest, $expectedReportFile) new \Magento\TestFramework\CodingStandard\Tool\CodeSniffer\Wrapper() ); $result = $codeSniffer->run( - [TESTS_TEMP_DIR . $fileUnderTest] + [TESTS_TEMP_DIR . DIRECTORY_SEPARATOR . $fileUnderTest] ); $actual = file_get_contents($reportFile); $expected = file_get_contents( - TESTS_TEMP_DIR . $expectedReportFile + TESTS_TEMP_DIR . DIRECTORY_SEPARATOR . $expectedReportFile ); unlink($reportFile); $this->assertEquals(2, $result); diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/Sniffs/Annotation/MethodAnnotationStructureSniffTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/Sniffs/Annotation/MethodAnnotationStructureSniffTest.php index b56239f4df8a5..d471597565077 100644 --- a/dev/tests/static/framework/tests/unit/testsuite/Magento/Sniffs/Annotation/MethodAnnotationStructureSniffTest.php +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/Sniffs/Annotation/MethodAnnotationStructureSniffTest.php @@ -54,7 +54,7 @@ public function testProcess($fileUnderTest, $expectedReportFile) $reportFile = __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'phpcs_report.txt'; $this->copyFile( __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR, - TESTS_TEMP_DIR + TESTS_TEMP_DIR . DIRECTORY_SEPARATOR ); $codeSniffer = new \Magento\TestFramework\CodingStandard\Tool\CodeSniffer( 'Magento', @@ -62,11 +62,11 @@ public function testProcess($fileUnderTest, $expectedReportFile) new \Magento\TestFramework\CodingStandard\Tool\CodeSniffer\Wrapper() ); $result = $codeSniffer->run( - [TESTS_TEMP_DIR . $fileUnderTest] + [TESTS_TEMP_DIR . DIRECTORY_SEPARATOR . $fileUnderTest] ); $actual = file_get_contents($reportFile); $expected = file_get_contents( - TESTS_TEMP_DIR . $expectedReportFile + TESTS_TEMP_DIR . DIRECTORY_SEPARATOR . $expectedReportFile ); unlink($reportFile); $this->assertEquals(2, $result); diff --git a/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php b/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php index a00c09ceadcef..8ccda77a25191 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php @@ -13,6 +13,7 @@ use Magento\TestFramework\CodingStandard\Tool\CodeSniffer\Wrapper; use Magento\TestFramework\CodingStandard\Tool\CopyPasteDetector; use Magento\TestFramework\CodingStandard\Tool\PhpCompatibility; +use Magento\TestFramework\CodingStandard\Tool\PhpStan; use PHPMD\TextUI\Command; /** @@ -465,4 +466,39 @@ public function testPhpCompatibility() 'PHP Compatibility detected violation(s):' . PHP_EOL . $report ); } + + /** + * Test code quality using PHPStan + * + * @throws \Exception + */ + public function testPhpStan() + { + $reportFile = self::$reportDir . '/phpstan_report.txt'; + $confFile = __DIR__ . '/_files/phpstan/phpstan.neon'; + + if (!file_exists($reportFile)) { + touch($reportFile); + } + + $fileList = self::getWhitelist(['php']); + $blackList = Files::init()->readLists(__DIR__ . '/_files/phpstan/blacklist/*.txt'); + if ($blackList) { + $blackListPattern = sprintf('#(%s)#i', implode('|', $blackList)); + $fileList = array_filter( + $fileList, + function ($path) use ($blackListPattern) { + return !preg_match($blackListPattern, $path); + } + ); + } + + $phpStan = new PhpStan($confFile, $reportFile); + $exitCode = $phpStan->run($fileList); + $report = file_get_contents($reportFile); + + $errorMessage = empty($report) ? + 'PHPStan command run failed.' : 'PHPStan detected violation(s):' . PHP_EOL . $report; + $this->assertEquals(0, $exitCode, $errorMessage); + } } diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/blacklist/common.txt new file mode 100644 index 0000000000000..34965bda0dba6 --- /dev/null +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/blacklist/common.txt @@ -0,0 +1,14 @@ +# Format: path to directory or path to file +# +# Example: +# app/code/Magento/Catalog +# dev/tests/static/framework/bootstrap.php +lib/internal/Magento/Framework/Interception/Test/Unit/Config/ConfigTest.php +lib/internal/Magento/Framework/Cache/Backend/Eaccelerator.php +dev/tests/integration/framework/deployTestModules.php +dev/tests/integration/testsuite/Magento/Framework/Session/ConfigTest.php +dev/tests/integration/testsuite/Magento/Framework/Session/SessionManagerTest.php +dev/tests/api-functional/testsuite/Magento/Customer/Api/AddressRepositoryTest.php +dev/tests/api-functional/testsuite/Magento/Framework/Model/Entity/HydratorTest.php +dev/tests/api-functional/testsuite/Magento/Integration/Model/AdminTokenServiceTest.php +dev/tests/api-functional/testsuite/Magento/Integration/Model/CustomerTokenServiceTest.php diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/phpstan.neon b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/phpstan.neon new file mode 100644 index 0000000000000..f4f6ff87f8175 --- /dev/null +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/phpstan.neon @@ -0,0 +1,38 @@ +parameters: + checkExplicitMixedMissingReturn: true + checkPhpDocMissingReturn: true + reportUnmatchedIgnoredErrors: false + excludes_analyse: + - %rootDir%/../../../lib/internal/Magento/Framework/ObjectManager/Test/Unit/* + - %rootDir%/../../../*/_files/* + - %rootDir%/../../../dev/tests/functional/* + - %rootDir%/../../../dev/tests/*/Fixtures/* + - %rootDir%/../../../dev/tests/*/tmp/* + - %rootDir%/../../../dev/tests/*/_generated/* + - %rootDir%/../../../pub/* + autoload_directories: + - %rootDir%/../../../dev/tests/static/framework/tests/unit/testsuite/Magento + - %rootDir%/../../../dev/tests/integration/framework/tests/unit/testsuite/Magento + - %rootDir%/../../../dev/tests/api-functional/_files/Magento + autoload_files: + - %rootDir%/../../../dev/tests/static/framework/autoload.php + - %rootDir%/../../../dev/tests/integration/framework/autoload.php + - %rootDir%/../../../dev/tests/api-functional/framework/autoload.php + - %rootDir%/../../../dev/tests/setup-integration/framework/autoload.php + - %rootDir%/../../../dev/tests/static/framework/Magento/PhpStan/autoload.php + ignoreErrors: + # Ignore PHPStan\Rules\Classes\UnusedConstructorParametersRule + - '#Constructor of class [a-zA-Z0-9\\_]+ has an unused parameter#' + # Ignore setCustomErrorHandler function not found in bootstrap files + - '#Function setCustomErrorHandler not found#' + # Ignore 'return statement is missing' error when 'void' is present in return type list + - '#Method (?:.*?) should return (?:.*?)void(?:.*?) but return statement is missing.#' + +services: + errorFormatter.filtered: + class: Magento\PhpStan\Formatters\FilteredErrorFormatter + arguments: + showTipsOfTheDay: false + checkThisOnly: false + inferPrivatePropertyTypeFromConstructor: true + checkMissingTypehints: %checkMissingTypehints% diff --git a/lib/internal/Magento/Framework/EntityManager/TypeResolver.php b/lib/internal/Magento/Framework/EntityManager/TypeResolver.php index 79cdbae126d7a..1f559c01f11b6 100644 --- a/lib/internal/Magento/Framework/EntityManager/TypeResolver.php +++ b/lib/internal/Magento/Framework/EntityManager/TypeResolver.php @@ -6,7 +6,7 @@ namespace Magento\Framework\EntityManager; /** - * Class TypeResolver + * Resolves types. */ class TypeResolver { @@ -20,7 +20,9 @@ class TypeResolver */ private $typeMapping = [ \Magento\SalesRule\Model\Rule::class => \Magento\SalesRule\Api\Data\RuleInterface::class, + // phpstan:ignore "Class Magento\SalesRule\Model\Rule\Interceptor not found." \Magento\SalesRule\Model\Rule\Interceptor::class => \Magento\SalesRule\Api\Data\RuleInterface::class, + // phpstan:ignore "Class Magento\SalesRule\Model\Rule\Proxy not found." \Magento\SalesRule\Model\Rule\Proxy::class => \Magento\SalesRule\Api\Data\RuleInterface::class ]; @@ -34,6 +36,8 @@ public function __construct(MetadataPool $metadataPool) } /** + * Resolves type. + * * @param object $type * @return string * @throws \Exception diff --git a/lib/internal/Magento/Framework/Interception/Test/Unit/Config/ConfigTest.php b/lib/internal/Magento/Framework/Interception/Test/Unit/Config/ConfigTest.php index 61eb2e62091ea..98bac47e8e1b0 100644 --- a/lib/internal/Magento/Framework/Interception/Test/Unit/Config/ConfigTest.php +++ b/lib/internal/Magento/Framework/Interception/Test/Unit/Config/ConfigTest.php @@ -6,8 +6,6 @@ namespace Magento\Framework\Interception\Test\Unit\Config; -use Magento\Framework\Serialize\SerializerInterface; - require_once __DIR__ . '/../Custom/Module/Model/Item.php'; require_once __DIR__ . '/../Custom/Module/Model/Item/Enhanced.php'; require_once __DIR__ . '/../Custom/Module/Model/ItemContainer.php'; @@ -89,48 +87,52 @@ public function testHasPluginsWhenDataIsNotCached($expectedResult, $type, $entit ->will($this->returnValue(null)); $this->omConfigMock->expects($this->any()) ->method('getOriginalInstanceType') - ->will($this->returnValueMap( - [ - [ - \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\ItemContainer::class, - \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\ItemContainer::class, - ], - [ - \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\Item::class, - \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\Item::class, - ], - [ - \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\Item\Enhanced::class, - \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\Item\Enhanced::class, - ], - [ - \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\ItemContainer\Enhanced::class, - \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\ItemContainer\Enhanced::class, - ], - [ - \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\ItemContainer\Proxy::class, - \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\ItemContainer\Proxy::class, - ], + ->will( + $this->returnValueMap( [ - \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\ItemProxy::class, - \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\ItemProxy::class, - ], - [ - \Magento\Framework\Interception\Custom\Module\Model\Backslash\ItemProxy::class, - \Magento\Framework\Interception\Custom\Module\Model\Backslash\ItemProxy::class - ], - [ - 'virtual_custom_item', - \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\Item::class - ], + [ + \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\ItemContainer::class, + \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\ItemContainer::class, + ], + [ + \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\Item::class, + \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\Item::class, + ], + [ + \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\Item\Enhanced::class, + \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\Item\Enhanced::class, + ], + [ + \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\ItemContainer\Enhanced::class, + \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\ItemContainer\Enhanced::class, + ], + [ + \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\ItemContainer\Proxy::class, + \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\ItemContainer\Proxy::class, + ], + [ + \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\Item\Proxy::class, + \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\Item\Proxy::class, + ], + [ + \Magento\Framework\Interception\Custom\Module\Model\Backslash\Item\Proxy::class, + \Magento\Framework\Interception\Custom\Module\Model\Backslash\Item\Proxy::class + ], + [ + 'virtual_custom_item', + \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\Item::class + ], + ] + ) + ); + $this->definitionMock->expects($this->any())->method('getClasses')->will( + $this->returnValue( + [ + \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\Item\Proxy::class, + \Magento\Framework\Interception\Custom\Module\Model\Backslash\Item\Proxy::class ] - )); - $this->definitionMock->expects($this->any())->method('getClasses')->will($this->returnValue( - [ - \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\ItemProxy::class, - \Magento\Framework\Interception\Custom\Module\Model\Backslash\ItemProxy::class - ] - )); + ) + ); $this->relationsMock->expects($this->any())->method('has')->will($this->returnValue($expectedResult)); $this->relationsMock->expects($this->any())->method('getParents')->will($this->returnValue($entityParents)); @@ -163,7 +165,7 @@ public function testHasPluginsWhenDataIsCached($expectedResult, $type) \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\Item\Enhanced::class => true, \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\ItemContainer\Enhanced::class => true, \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\ItemContainer\Proxy::class => true, - \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\ItemProxy::class => false, + \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\Item\Proxy::class => false, 'virtual_custom_item' => true ]; $this->readerMock->expects($this->never())->method('read'); @@ -221,7 +223,7 @@ public function hasPluginsDataProvider() [\Magento\Framework\Interception\Test\Unit\Custom\Module\Model\ItemContainer::class] ], [ - false, \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\ItemProxy::class, + false, \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\Item\Proxy::class, [] ], [ diff --git a/lib/internal/Magento/Framework/TestFramework/Unit/Autoloader/FactoryGenerator.php b/lib/internal/Magento/Framework/TestFramework/Unit/Autoloader/FactoryGenerator.php index df5b0b0e0ad0c..1a669ace443ec 100644 --- a/lib/internal/Magento/Framework/TestFramework/Unit/Autoloader/FactoryGenerator.php +++ b/lib/internal/Magento/Framework/TestFramework/Unit/Autoloader/FactoryGenerator.php @@ -43,6 +43,9 @@ public function generate($className) */ private function isFactory($className) { + if (!preg_match('/[\\\A-Z]/', substr(ltrim($className), 0, 1))) { + return false; + } $sourceName = rtrim(substr($className, 0, -strlen('Factory')), '\\'); return $sourceName . 'Factory' == $className; } From 40f35ee7ad5b5c3390e9cb297a7871019269c807 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Mon, 16 Dec 2019 16:11:43 -0600 Subject: [PATCH 0443/1143] Fix static --- .../view/frontend/templates/form.phtml | 36 ++++++++++++++++--- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Contact/view/frontend/templates/form.phtml b/app/code/Magento/Contact/view/frontend/templates/form.phtml index 053cf419e4225..2982a0a99f74c 100644 --- a/app/code/Magento/Contact/view/frontend/templates/form.phtml +++ b/app/code/Magento/Contact/view/frontend/templates/form.phtml @@ -17,29 +17,55 @@ $viewModel = $block->getViewModel(); data-mage-init='{"validation":{}}'> <fieldset class="fieldset"> <legend class="legend"><span><?= $block->escapeHtml(__('Write Us')) ?></span></legend><br /> - <div class="field note no-label"><?= $block->escapeHtml(__('Jot us a note and we’ll get back to you as quickly as possible.')) ?></div> + <div class="field note no-label"> + <?= $block->escapeHtml(__('Jot us a note and we’ll get back to you as quickly as possible.')) ?> + </div> <div class="field name required"> <label class="label" for="name"><span><?= $block->escapeHtml(__('Name')) ?></span></label> <div class="control"> - <input name="name" id="name" title="<?= $block->escapeHtmlAttr(__('Name')) ?>" value="<?= $block->escapeHtmlAttr($viewModel->getUserName()) ?>" class="input-text" type="text" data-validate="{required:true}"/> + <input name="name" + id="name" + title="<?= $block->escapeHtmlAttr(__('Name')) ?>" + value="<?= $block->escapeHtmlAttr($viewModel->getUserName()) ?>" + class="input-text" + type="text" + data-validate="{required:true}"/> </div> </div> <div class="field email required"> <label class="label" for="email"><span><?= $block->escapeHtml(__('Email')) ?></span></label> <div class="control"> - <input name="email" id="email" title="<?= $block->escapeHtmlAttr(__('Email')) ?>" value="<?= $block->escapeHtmlAttr($viewModel->getUserEmail()) ?>" class="input-text" type="email" data-validate="{required:true, 'validate-email':true}"/> + <input name="email" + id="email" + title="<?= $block->escapeHtmlAttr(__('Email')) ?>" + value="<?= $block->escapeHtmlAttr($viewModel->getUserEmail()) ?>" + class="input-text" + type="email" + data-validate="{required:true, 'validate-email':true}"/> </div> </div> <div class="field telephone"> <label class="label" for="telephone"><span><?= $block->escapeHtml(__('Phone Number')) ?></span></label> <div class="control"> - <input name="telephone" id="telephone" title="<?= $block->escapeHtmlAttr(__('Phone Number')) ?>" value="<?= $block->escapeHtmlAttr($viewModel->getUserTelephone()) ?>" class="input-text" type="text" /> + <input name="telephone" + id="telephone" + title="<?= $block->escapeHtmlAttr(__('Phone Number')) ?>" + value="<?= $block->escapeHtmlAttr($viewModel->getUserTelephone()) ?>" + class="input-text" + type="text" /> </div> </div> <div class="field comment required"> <label class="label" for="comment"><span><?= $block->escapeHtml(__('What’s on your mind?')) ?></span></label> <div class="control"> - <textarea name="comment" id="comment" title="<?= $block->escapeHtmlAttr(__('What’s on your mind?')) ?>" class="input-text" cols="5" rows="3" data-validate="{required:true}"><?= $block->escapeHtml($viewModel->getUserComment()) ?></textarea> + <textarea name="comment" + id="comment" + title="<?= $block->escapeHtmlAttr(__('What’s on your mind?')) ?>" + class="input-text" + cols="5" + rows="3" + data-validate="{required:true}"><?= $block->escapeHtml($viewModel->getUserComment()) ?> + </textarea> </div> </div> <?= $block->getChildHtml('form.additional.info') ?> From a4984838127857816256e4d0a0a4ed82f1d43ccb Mon Sep 17 00:00:00 2001 From: Viktor Tymchynskyi <vtymchynskyi@magento.com> Date: Mon, 16 Dec 2019 16:31:33 -0600 Subject: [PATCH 0444/1143] MC-25203: Introduce PHPStan code analysis tool to the static build - Fix test --- .../Magento/PhpStan/Formatters/FilteredErrorFormatterTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/PhpStan/Formatters/FilteredErrorFormatterTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/PhpStan/Formatters/FilteredErrorFormatterTest.php index dfedd625fdb0e..8512f311f15a2 100644 --- a/dev/tests/static/framework/tests/unit/testsuite/Magento/PhpStan/Formatters/FilteredErrorFormatterTest.php +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/PhpStan/Formatters/FilteredErrorFormatterTest.php @@ -33,7 +33,7 @@ class FilteredErrorFormatterTest extends ErrorFormatterTestCase */ public function testFormatErrors( string $message, - int $exitCode + int $exitCode, array $fileErrors, string $expected ): void { From aa419de0b281718352112a7e6540388efccd395f Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Mon, 16 Dec 2019 16:44:36 -0600 Subject: [PATCH 0445/1143] Fix codestyle --- app/code/Magento/Contact/view/frontend/templates/form.phtml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Contact/view/frontend/templates/form.phtml b/app/code/Magento/Contact/view/frontend/templates/form.phtml index 2982a0a99f74c..3a7c4c8b6d865 100644 --- a/app/code/Magento/Contact/view/frontend/templates/form.phtml +++ b/app/code/Magento/Contact/view/frontend/templates/form.phtml @@ -56,7 +56,9 @@ $viewModel = $block->getViewModel(); </div> </div> <div class="field comment required"> - <label class="label" for="comment"><span><?= $block->escapeHtml(__('What’s on your mind?')) ?></span></label> + <label class="label" for="comment"> + <span><?= $block->escapeHtml(__('What’s on your mind?')) ?></span> + </label> <div class="control"> <textarea name="comment" id="comment" From 9c51c71ad2f686a51026a014a984c2e22a481cf5 Mon Sep 17 00:00:00 2001 From: Viktor Tymchynskyi <vtymchynskyi@magento.com> Date: Mon, 16 Dec 2019 16:53:54 -0600 Subject: [PATCH 0446/1143] MC-25203: Introduce PHPStan code analysis tool to the static build - update composer --- composer.json | 2 +- composer.lock | 450 +++++++++++++++++++++++++------------------------- 2 files changed, 222 insertions(+), 230 deletions(-) diff --git a/composer.json b/composer.json index 59737c298b720..7e01980e32f58 100644 --- a/composer.json +++ b/composer.json @@ -92,7 +92,7 @@ "pdepend/pdepend": "2.5.2", "phpcompatibility/php-compatibility": "^9.3", "phpmd/phpmd": "@stable", - "phpstan/phpstan": "^0.12.2", + "phpstan/phpstan": "^0.12.3", "phpunit/phpunit": "~6.5.0", "sebastian/phpcpd": "~3.0.0", "squizlabs/php_codesniffer": "~3.4.0" diff --git a/composer.lock b/composer.lock index 8391dd2f48518..a63cdcdf4a1e1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7effdb746287f89357497d7bc2ed1bf4", + "content-hash": "38446350ff1ac4609f77d5d74213880d", "packages": [ { "name": "braintree/braintree_php", @@ -201,16 +201,16 @@ }, { "name": "composer/ca-bundle", - "version": "1.2.5", + "version": "1.2.4", "source": { "type": "git", "url": "https://github.com/composer/ca-bundle.git", - "reference": "62e8fc2dc550e5d6d8c9360c7721662670f58149" + "reference": "10bb96592168a0f8e8f6dcde3532d9fa50b0b527" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/62e8fc2dc550e5d6d8c9360c7721662670f58149", - "reference": "62e8fc2dc550e5d6d8c9360c7721662670f58149", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/10bb96592168a0f8e8f6dcde3532d9fa50b0b527", + "reference": "10bb96592168a0f8e8f6dcde3532d9fa50b0b527", "shasum": "" }, "require": { @@ -221,7 +221,7 @@ "require-dev": { "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8", "psr/log": "^1.0", - "symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0" + "symfony/process": "^2.5 || ^3.0 || ^4.0" }, "type": "library", "extra": { @@ -253,7 +253,7 @@ "ssl", "tls" ], - "time": "2019-12-11T14:44:42+00:00" + "time": "2019-08-30T08:44:50+00:00" }, { "name": "composer/composer", @@ -595,16 +595,16 @@ }, { "name": "guzzlehttp/guzzle", - "version": "6.5.0", + "version": "6.4.1", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "dbc2bc3a293ed6b1ae08a3651e2bfd213d19b6a5" + "reference": "0895c932405407fd3a7368b6910c09a24d26db11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/dbc2bc3a293ed6b1ae08a3651e2bfd213d19b6a5", - "reference": "dbc2bc3a293ed6b1ae08a3651e2bfd213d19b6a5", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/0895c932405407fd3a7368b6910c09a24d26db11", + "reference": "0895c932405407fd3a7368b6910c09a24d26db11", "shasum": "" }, "require": { @@ -619,13 +619,12 @@ "psr/log": "^1.1" }, "suggest": { - "ext-intl": "Required for Internationalized Domain Name (IDN) support", "psr/log": "Required for using the Log middleware" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.5-dev" + "dev-master": "6.3-dev" } }, "autoload": { @@ -658,7 +657,7 @@ "rest", "web service" ], - "time": "2019-12-07T18:20:45+00:00" + "time": "2019-10-23T15:58:00+00:00" }, { "name": "guzzlehttp/promises", @@ -1066,16 +1065,16 @@ }, { "name": "magento/zendframework1", - "version": "1.14.3", + "version": "1.14.2", "source": { "type": "git", "url": "https://github.com/magento/zf1.git", - "reference": "726855dfb080089dc7bc7b016624129f8e7bc4e5" + "reference": "8221062d42a198e431d183bbe672e5e1a2f98c5f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/magento/zf1/zipball/726855dfb080089dc7bc7b016624129f8e7bc4e5", - "reference": "726855dfb080089dc7bc7b016624129f8e7bc4e5", + "url": "https://api.github.com/repos/magento/zf1/zipball/8221062d42a198e431d183bbe672e5e1a2f98c5f", + "reference": "8221062d42a198e431d183bbe672e5e1a2f98c5f", "shasum": "" }, "require": { @@ -1109,7 +1108,7 @@ "ZF1", "framework" ], - "time": "2019-11-26T15:09:40+00:00" + "time": "2019-07-26T16:43:11+00:00" }, { "name": "monolog/monolog", @@ -2084,16 +2083,16 @@ }, { "name": "symfony/css-selector", - "version": "v4.4.1", + "version": "v4.3.8", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "64acec7e0d67125e9f4656c68d4a38a42ab5a0b7" + "reference": "f4b3ff6a549d9ed28b2b0ecd1781bf67cf220ee9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/64acec7e0d67125e9f4656c68d4a38a42ab5a0b7", - "reference": "64acec7e0d67125e9f4656c68d4a38a42ab5a0b7", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/f4b3ff6a549d9ed28b2b0ecd1781bf67cf220ee9", + "reference": "f4b3ff6a549d9ed28b2b0ecd1781bf67cf220ee9", "shasum": "" }, "require": { @@ -2102,7 +2101,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.4-dev" + "dev-master": "4.3-dev" } }, "autoload": { @@ -2133,20 +2132,20 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2019-10-12T00:35:04+00:00" + "time": "2019-10-02T08:36:26+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v4.3.9", + "version": "v4.3.8", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "87a1ae7480f2020818013605a65776b9033bcc4f" + "reference": "0df002fd4f500392eabd243c2947061a50937287" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/87a1ae7480f2020818013605a65776b9033bcc4f", - "reference": "87a1ae7480f2020818013605a65776b9033bcc4f", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/0df002fd4f500392eabd243c2947061a50937287", + "reference": "0df002fd4f500392eabd243c2947061a50937287", "shasum": "" }, "require": { @@ -2203,7 +2202,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2019-11-28T13:25:45+00:00" + "time": "2019-11-03T09:04:05+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -2265,16 +2264,16 @@ }, { "name": "symfony/filesystem", - "version": "v4.4.1", + "version": "v4.3.8", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "40c2606131d56eff6f193b6e2ceb92414653b591" + "reference": "9abbb7ef96a51f4d7e69627bc6f63307994e4263" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/40c2606131d56eff6f193b6e2ceb92414653b591", - "reference": "40c2606131d56eff6f193b6e2ceb92414653b591", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/9abbb7ef96a51f4d7e69627bc6f63307994e4263", + "reference": "9abbb7ef96a51f4d7e69627bc6f63307994e4263", "shasum": "" }, "require": { @@ -2284,7 +2283,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.4-dev" + "dev-master": "4.3-dev" } }, "autoload": { @@ -2311,20 +2310,20 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2019-11-26T23:16:41+00:00" + "time": "2019-08-20T14:07:54+00:00" }, { "name": "symfony/finder", - "version": "v4.4.1", + "version": "v4.3.8", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "ce8743441da64c41e2a667b8eb66070444ed911e" + "reference": "72a068f77e317ae77c0a0495236ad292cfb5ce6f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/ce8743441da64c41e2a667b8eb66070444ed911e", - "reference": "ce8743441da64c41e2a667b8eb66070444ed911e", + "url": "https://api.github.com/repos/symfony/finder/zipball/72a068f77e317ae77c0a0495236ad292cfb5ce6f", + "reference": "72a068f77e317ae77c0a0495236ad292cfb5ce6f", "shasum": "" }, "require": { @@ -2333,7 +2332,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.4-dev" + "dev-master": "4.3-dev" } }, "autoload": { @@ -2360,20 +2359,20 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2019-11-17T21:56:56+00:00" + "time": "2019-10-30T12:53:54+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.13.1", + "version": "v1.12.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3" + "reference": "550ebaac289296ce228a706d0867afc34687e3f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", - "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/550ebaac289296ce228a706d0867afc34687e3f4", + "reference": "550ebaac289296ce228a706d0867afc34687e3f4", "shasum": "" }, "require": { @@ -2385,7 +2384,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.12-dev" } }, "autoload": { @@ -2418,20 +2417,20 @@ "polyfill", "portable" ], - "time": "2019-11-27T13:56:44+00:00" + "time": "2019-08-06T08:03:45+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.13.1", + "version": "v1.12.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f" + "reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f", - "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/b42a2f66e8f1b15ccf25652c3424265923eb4f17", + "reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17", "shasum": "" }, "require": { @@ -2443,7 +2442,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.12-dev" } }, "autoload": { @@ -2477,20 +2476,20 @@ "portable", "shim" ], - "time": "2019-11-27T14:18:11+00:00" + "time": "2019-08-06T08:03:45+00:00" }, { "name": "symfony/process", - "version": "v4.3.9", + "version": "v4.3.8", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "207dab1f17d34ad71ea72e9741ab8049a9d8251b" + "reference": "3b2e0cb029afbb0395034509291f21191d1a4db0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/207dab1f17d34ad71ea72e9741ab8049a9d8251b", - "reference": "207dab1f17d34ad71ea72e9741ab8049a9d8251b", + "url": "https://api.github.com/repos/symfony/process/zipball/3b2e0cb029afbb0395034509291f21191d1a4db0", + "reference": "3b2e0cb029afbb0395034509291f21191d1a4db0", "shasum": "" }, "require": { @@ -2526,7 +2525,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2019-11-28T10:05:26+00:00" + "time": "2019-10-28T17:07:32+00:00" }, { "name": "tedivm/jshrink", @@ -3530,16 +3529,16 @@ }, { "name": "zendframework/zend-http", - "version": "2.11.1", + "version": "2.10.0", "source": { "type": "git", "url": "https://github.com/zendframework/zend-http.git", - "reference": "76000da8490b8685d63ff6f6ff8eefa459f6e9e7" + "reference": "4b4983178693a8fdda53b0bbee58552e2d2b1ac0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-http/zipball/76000da8490b8685d63ff6f6ff8eefa459f6e9e7", - "reference": "76000da8490b8685d63ff6f6ff8eefa459f6e9e7", + "url": "https://api.github.com/repos/zendframework/zend-http/zipball/4b4983178693a8fdda53b0bbee58552e2d2b1ac0", + "reference": "4b4983178693a8fdda53b0bbee58552e2d2b1ac0", "shasum": "" }, "require": { @@ -3560,8 +3559,8 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.11.x-dev", - "dev-develop": "2.12.x-dev" + "dev-master": "2.10.x-dev", + "dev-develop": "2.11.x-dev" } }, "autoload": { @@ -3581,7 +3580,7 @@ "zend", "zf" ], - "time": "2019-12-04T23:02:34+00:00" + "time": "2019-02-19T18:58:14+00:00" }, { "name": "zendframework/zend-hydrator", @@ -3645,26 +3644,22 @@ }, { "name": "zendframework/zend-i18n", - "version": "2.10.1", + "version": "2.9.2", "source": { "type": "git", "url": "https://github.com/zendframework/zend-i18n.git", - "reference": "84038e6a1838b611dcc491b1c40321fa4c3a123c" + "reference": "e17a54b3aee333ab156958f570cde630acee8b07" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-i18n/zipball/84038e6a1838b611dcc491b1c40321fa4c3a123c", - "reference": "84038e6a1838b611dcc491b1c40321fa4c3a123c", + "url": "https://api.github.com/repos/zendframework/zend-i18n/zipball/e17a54b3aee333ab156958f570cde630acee8b07", + "reference": "e17a54b3aee333ab156958f570cde630acee8b07", "shasum": "" }, "require": { - "ext-intl": "*", "php": "^5.6 || ^7.0", "zendframework/zend-stdlib": "^2.7 || ^3.0" }, - "conflict": { - "phpspec/prophecy": "<1.9.0" - }, "require-dev": { "phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.5.16", "zendframework/zend-cache": "^2.6.1", @@ -3677,6 +3672,7 @@ "zendframework/zend-view": "^2.6.3" }, "suggest": { + "ext-intl": "Required for most features of Zend\\I18n; included in default builds of PHP", "zendframework/zend-cache": "Zend\\Cache component", "zendframework/zend-config": "Zend\\Config component", "zendframework/zend-eventmanager": "You should install this package to use the events in the translator", @@ -3689,8 +3685,8 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.10.x-dev", - "dev-develop": "2.11.x-dev" + "dev-master": "2.9.x-dev", + "dev-develop": "2.10.x-dev" }, "zf": { "component": "Zend\\I18n", @@ -3712,7 +3708,7 @@ "i18n", "zf" ], - "time": "2019-12-12T14:08:22+00:00" + "time": "2019-09-30T12:04:37+00:00" }, { "name": "zendframework/zend-inputfilter", @@ -4798,16 +4794,16 @@ }, { "name": "zendframework/zend-view", - "version": "2.11.4", + "version": "2.11.3", "source": { "type": "git", "url": "https://github.com/zendframework/zend-view.git", - "reference": "a8b1b2d9b52e191539be861a6529f8c8a0c06b9d" + "reference": "e766457bd6ce13c5354e443bb949511b6904d7f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-view/zipball/a8b1b2d9b52e191539be861a6529f8c8a0c06b9d", - "reference": "a8b1b2d9b52e191539be861a6529f8c8a0c06b9d", + "url": "https://api.github.com/repos/zendframework/zend-view/zipball/e766457bd6ce13c5354e443bb949511b6904d7f5", + "reference": "e766457bd6ce13c5354e443bb949511b6904d7f5", "shasum": "" }, "require": { @@ -4881,7 +4877,7 @@ "view", "zf" ], - "time": "2019-12-04T08:40:50+00:00" + "time": "2019-10-11T21:10:04+00:00" } ], "packages-dev": [ @@ -5284,16 +5280,16 @@ }, { "name": "codeception/phpunit-wrapper", - "version": "6.7.1", + "version": "6.7.0", "source": { "type": "git", "url": "https://github.com/Codeception/phpunit-wrapper.git", - "reference": "d3b611635b47a583dfaa1a9e98b98fa476d14025" + "reference": "93f59e028826464eac086052fa226e58967f6907" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Codeception/phpunit-wrapper/zipball/d3b611635b47a583dfaa1a9e98b98fa476d14025", - "reference": "d3b611635b47a583dfaa1a9e98b98fa476d14025", + "url": "https://api.github.com/repos/Codeception/phpunit-wrapper/zipball/93f59e028826464eac086052fa226e58967f6907", + "reference": "93f59e028826464eac086052fa226e58967f6907", "shasum": "" }, "require": { @@ -5326,7 +5322,7 @@ } ], "description": "PHPUnit classes used by Codeception", - "time": "2019-11-23T18:22:38+00:00" + "time": "2019-08-18T15:43:35+00:00" }, { "name": "codeception/stub", @@ -6166,16 +6162,16 @@ }, { "name": "doctrine/cache", - "version": "1.10.0", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/doctrine/cache.git", - "reference": "382e7f4db9a12dc6c19431743a2b096041bcdd62" + "reference": "89a5c76c39c292f7798f964ab3c836c3f8192a55" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/382e7f4db9a12dc6c19431743a2b096041bcdd62", - "reference": "382e7f4db9a12dc6c19431743a2b096041bcdd62", + "url": "https://api.github.com/repos/doctrine/cache/zipball/89a5c76c39c292f7798f964ab3c836c3f8192a55", + "reference": "89a5c76c39c292f7798f964ab3c836c3f8192a55", "shasum": "" }, "require": { @@ -6242,9 +6238,10 @@ "memcached", "php", "redis", + "riak", "xcache" ], - "time": "2019-11-29T15:36:20+00:00" + "time": "2019-11-15T14:31:57+00:00" }, { "name": "doctrine/inflector", @@ -6623,16 +6620,16 @@ }, { "name": "fzaninotto/faker", - "version": "v1.9.1", + "version": "v1.9.0", "source": { "type": "git", "url": "https://github.com/fzaninotto/Faker.git", - "reference": "fc10d778e4b84d5bd315dad194661e091d307c6f" + "reference": "27a216cbe72327b2d6369fab721a5843be71e57d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/fc10d778e4b84d5bd315dad194661e091d307c6f", - "reference": "fc10d778e4b84d5bd315dad194661e091d307c6f", + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/27a216cbe72327b2d6369fab721a5843be71e57d", + "reference": "27a216cbe72327b2d6369fab721a5843be71e57d", "shasum": "" }, "require": { @@ -6645,9 +6642,7 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "1.9-dev" - } + "branch-alias": [] }, "autoload": { "psr-4": { @@ -6669,7 +6664,7 @@ "faker", "fixtures" ], - "time": "2019-12-12T13:22:17+00:00" + "time": "2019-11-14T13:13:06+00:00" }, { "name": "grasmash/expander", @@ -7035,16 +7030,16 @@ }, { "name": "league/flysystem", - "version": "1.0.61", + "version": "1.0.57", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "4fb13c01784a6c9f165a351e996871488ca2d8c9" + "reference": "0e9db7f0b96b9f12dcf6f65bc34b72b1a30ea55a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/4fb13c01784a6c9f165a351e996871488ca2d8c9", - "reference": "4fb13c01784a6c9f165a351e996871488ca2d8c9", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/0e9db7f0b96b9f12dcf6f65bc34b72b1a30ea55a", + "reference": "0e9db7f0b96b9f12dcf6f65bc34b72b1a30ea55a", "shasum": "" }, "require": { @@ -7115,7 +7110,7 @@ "sftp", "storage" ], - "time": "2019-12-08T21:46:50+00:00" + "time": "2019-10-16T21:01:05+00:00" }, { "name": "lusitanian/oauth", @@ -7349,16 +7344,16 @@ }, { "name": "mustache/mustache", - "version": "v2.13.0", + "version": "v2.12.0", "source": { "type": "git", "url": "https://github.com/bobthecow/mustache.php.git", - "reference": "e95c5a008c23d3151d59ea72484d4f72049ab7f4" + "reference": "fe8fe72e9d580591854de404cc59a1b83ca4d19e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/mustache.php/zipball/e95c5a008c23d3151d59ea72484d4f72049ab7f4", - "reference": "e95c5a008c23d3151d59ea72484d4f72049ab7f4", + "url": "https://api.github.com/repos/bobthecow/mustache.php/zipball/fe8fe72e9d580591854de404cc59a1b83ca4d19e", + "reference": "fe8fe72e9d580591854de404cc59a1b83ca4d19e", "shasum": "" }, "require": { @@ -7391,20 +7386,20 @@ "mustache", "templating" ], - "time": "2019-11-23T21:40:31+00:00" + "time": "2017-07-11T12:54:05+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.9.4", + "version": "1.9.3", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "579bb7356d91f9456ccd505f24ca8b667966a0a7" + "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/579bb7356d91f9456ccd505f24ca8b667966a0a7", - "reference": "579bb7356d91f9456ccd505f24ca8b667966a0a7", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/007c053ae6f31bba39dfa19a7726f56e9763bbea", + "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea", "shasum": "" }, "require": { @@ -7439,7 +7434,7 @@ "object", "object graph" ], - "time": "2019-12-15T19:12:40+00:00" + "time": "2019-08-09T12:45:53+00:00" }, { "name": "nikic/php-parser", @@ -8012,34 +8007,33 @@ }, { "name": "phpoption/phpoption", - "version": "1.7.2", + "version": "1.5.2", "source": { "type": "git", "url": "https://github.com/schmittjoh/php-option.git", - "reference": "77f7c4d2e65413aff5b5a8cc8b3caf7a28d81959" + "reference": "2ba2586380f8d2b44ad1b9feb61c371020b27793" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/77f7c4d2e65413aff5b5a8cc8b3caf7a28d81959", - "reference": "77f7c4d2e65413aff5b5a8cc8b3caf7a28d81959", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/2ba2586380f8d2b44ad1b9feb61c371020b27793", + "reference": "2ba2586380f8d2b44ad1b9feb61c371020b27793", "shasum": "" }, "require": { - "php": "^5.5.9 || ^7.0" + "php": ">=5.3.0" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.3", - "phpunit/phpunit": "^4.8.35 || ^5.0 || ^6.0 || ^7.0" + "phpunit/phpunit": "^4.7|^5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7-dev" + "dev-master": "1.5-dev" } }, "autoload": { - "psr-4": { - "PhpOption\\": "src/PhpOption/" + "psr-0": { + "PhpOption\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -8050,10 +8044,6 @@ { "name": "Johannes M. Schmitt", "email": "schmittjoh@gmail.com" - }, - { - "name": "Graham Campbell", - "email": "graham@alt-three.com" } ], "description": "Option Type for PHP", @@ -8063,7 +8053,7 @@ "php", "type" ], - "time": "2019-12-15T19:35:24+00:00" + "time": "2019-11-06T22:27:00+00:00" }, { "name": "phpspec/prophecy", @@ -9356,27 +9346,27 @@ }, { "name": "symfony/browser-kit", - "version": "v4.4.1", + "version": "v4.3.8", "source": { "type": "git", "url": "https://github.com/symfony/browser-kit.git", - "reference": "e19e465c055137938afd40cfddd687e7511bbbf0" + "reference": "b14fa08508afd152257d5dcc7adb5f278654d972" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/e19e465c055137938afd40cfddd687e7511bbbf0", - "reference": "e19e465c055137938afd40cfddd687e7511bbbf0", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/b14fa08508afd152257d5dcc7adb5f278654d972", + "reference": "b14fa08508afd152257d5dcc7adb5f278654d972", "shasum": "" }, "require": { "php": "^7.1.3", - "symfony/dom-crawler": "^3.4|^4.0|^5.0" + "symfony/dom-crawler": "~3.4|~4.0" }, "require-dev": { - "symfony/css-selector": "^3.4|^4.0|^5.0", - "symfony/http-client": "^4.3|^5.0", - "symfony/mime": "^4.3|^5.0", - "symfony/process": "^3.4|^4.0|^5.0" + "symfony/css-selector": "~3.4|~4.0", + "symfony/http-client": "^4.3", + "symfony/mime": "^4.3", + "symfony/process": "~3.4|~4.0" }, "suggest": { "symfony/process": "" @@ -9384,7 +9374,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.4-dev" + "dev-master": "4.3-dev" } }, "autoload": { @@ -9411,36 +9401,36 @@ ], "description": "Symfony BrowserKit Component", "homepage": "https://symfony.com", - "time": "2019-10-28T20:30:34+00:00" + "time": "2019-10-28T17:07:32+00:00" }, { "name": "symfony/config", - "version": "v4.4.1", + "version": "v4.3.8", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "7aa5817f1b7a8ed377752b90fcc47dfb3c67b40c" + "reference": "8267214841c44d315a55242ea867684eb43c42ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/7aa5817f1b7a8ed377752b90fcc47dfb3c67b40c", - "reference": "7aa5817f1b7a8ed377752b90fcc47dfb3c67b40c", + "url": "https://api.github.com/repos/symfony/config/zipball/8267214841c44d315a55242ea867684eb43c42ce", + "reference": "8267214841c44d315a55242ea867684eb43c42ce", "shasum": "" }, "require": { "php": "^7.1.3", - "symfony/filesystem": "^3.4|^4.0|^5.0", + "symfony/filesystem": "~3.4|~4.0", "symfony/polyfill-ctype": "~1.8" }, "conflict": { "symfony/finder": "<3.4" }, "require-dev": { - "symfony/event-dispatcher": "^3.4|^4.0|^5.0", - "symfony/finder": "^3.4|^4.0|^5.0", - "symfony/messenger": "^4.1|^5.0", - "symfony/service-contracts": "^1.1|^2", - "symfony/yaml": "^3.4|^4.0|^5.0" + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/event-dispatcher": "~3.4|~4.0", + "symfony/finder": "~3.4|~4.0", + "symfony/messenger": "~4.1", + "symfony/yaml": "~3.4|~4.0" }, "suggest": { "symfony/yaml": "To use the yaml reference dumper" @@ -9448,7 +9438,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.4-dev" + "dev-master": "4.3-dev" } }, "autoload": { @@ -9475,29 +9465,29 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2019-12-01T10:50:45+00:00" + "time": "2019-11-08T08:31:27+00:00" }, { "name": "symfony/dependency-injection", - "version": "v4.4.1", + "version": "v4.3.8", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "ad46a4def1325befab696b49c839dffea3fc92bd" + "reference": "80c6d9e19467dfbba14f830ed478eb592ce51b64" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/ad46a4def1325befab696b49c839dffea3fc92bd", - "reference": "ad46a4def1325befab696b49c839dffea3fc92bd", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/80c6d9e19467dfbba14f830ed478eb592ce51b64", + "reference": "80c6d9e19467dfbba14f830ed478eb592ce51b64", "shasum": "" }, "require": { "php": "^7.1.3", "psr/container": "^1.0", - "symfony/service-contracts": "^1.1.6|^2" + "symfony/service-contracts": "^1.1.6" }, "conflict": { - "symfony/config": "<4.3|>=5.0", + "symfony/config": "<4.3", "symfony/finder": "<3.4", "symfony/proxy-manager-bridge": "<3.4", "symfony/yaml": "<3.4" @@ -9508,8 +9498,8 @@ }, "require-dev": { "symfony/config": "^4.3", - "symfony/expression-language": "^3.4|^4.0|^5.0", - "symfony/yaml": "^3.4|^4.0|^5.0" + "symfony/expression-language": "~3.4|~4.0", + "symfony/yaml": "~3.4|~4.0" }, "suggest": { "symfony/config": "", @@ -9521,7 +9511,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.4-dev" + "dev-master": "4.3-dev" } }, "autoload": { @@ -9548,20 +9538,20 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2019-12-01T10:19:36+00:00" + "time": "2019-11-08T16:22:27+00:00" }, { "name": "symfony/dom-crawler", - "version": "v4.4.1", + "version": "v4.3.8", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "36bbcab9369fc2f583220890efd43bf262d563fd" + "reference": "4b9efd5708c3a38593e19b6a33e40867f4f89d72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/36bbcab9369fc2f583220890efd43bf262d563fd", - "reference": "36bbcab9369fc2f583220890efd43bf262d563fd", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/4b9efd5708c3a38593e19b6a33e40867f4f89d72", + "reference": "4b9efd5708c3a38593e19b6a33e40867f4f89d72", "shasum": "" }, "require": { @@ -9574,7 +9564,7 @@ }, "require-dev": { "masterminds/html5": "^2.6", - "symfony/css-selector": "^3.4|^4.0|^5.0" + "symfony/css-selector": "~3.4|~4.0" }, "suggest": { "symfony/css-selector": "" @@ -9582,7 +9572,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.4-dev" + "dev-master": "4.3-dev" } }, "autoload": { @@ -9609,7 +9599,7 @@ ], "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2019-10-29T11:38:30+00:00" + "time": "2019-10-28T17:07:32+00:00" }, { "name": "symfony/http-foundation", @@ -9668,16 +9658,16 @@ }, { "name": "symfony/options-resolver", - "version": "v4.4.1", + "version": "v4.3.8", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "2be23e63f33de16b49294ea6581f462932a77e2f" + "reference": "f46c7fc8e207bd8a2188f54f8738f232533765a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/2be23e63f33de16b49294ea6581f462932a77e2f", - "reference": "2be23e63f33de16b49294ea6581f462932a77e2f", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/f46c7fc8e207bd8a2188f54f8738f232533765a4", + "reference": "f46c7fc8e207bd8a2188f54f8738f232533765a4", "shasum": "" }, "require": { @@ -9686,7 +9676,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.4-dev" + "dev-master": "4.3-dev" } }, "autoload": { @@ -9718,20 +9708,20 @@ "configuration", "options" ], - "time": "2019-10-28T21:57:16+00:00" + "time": "2019-10-28T20:59:01+00:00" }, { "name": "symfony/polyfill-php54", - "version": "v1.13.1", + "version": "v1.12.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php54.git", - "reference": "dd1618047426412036e98d159940d58a81fc392c" + "reference": "a043bcced870214922fbb4bf22679d431ec0296a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/dd1618047426412036e98d159940d58a81fc392c", - "reference": "dd1618047426412036e98d159940d58a81fc392c", + "url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/a043bcced870214922fbb4bf22679d431ec0296a", + "reference": "a043bcced870214922fbb4bf22679d431ec0296a", "shasum": "" }, "require": { @@ -9740,7 +9730,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.12-dev" } }, "autoload": { @@ -9776,20 +9766,20 @@ "portable", "shim" ], - "time": "2019-11-27T13:56:44+00:00" + "time": "2019-08-06T08:03:45+00:00" }, { "name": "symfony/polyfill-php55", - "version": "v1.13.1", + "version": "v1.12.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php55.git", - "reference": "b0d838f225725e2951af1aafc784d2e5ea7b656e" + "reference": "548bb39407e78e54f785b4e18c7e0d5d9e493265" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/b0d838f225725e2951af1aafc784d2e5ea7b656e", - "reference": "b0d838f225725e2951af1aafc784d2e5ea7b656e", + "url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/548bb39407e78e54f785b4e18c7e0d5d9e493265", + "reference": "548bb39407e78e54f785b4e18c7e0d5d9e493265", "shasum": "" }, "require": { @@ -9799,7 +9789,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.12-dev" } }, "autoload": { @@ -9832,20 +9822,20 @@ "portable", "shim" ], - "time": "2019-11-27T13:56:44+00:00" + "time": "2019-08-06T08:03:45+00:00" }, { "name": "symfony/polyfill-php70", - "version": "v1.13.1", + "version": "v1.12.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "af23c7bb26a73b850840823662dda371484926c4" + "reference": "54b4c428a0054e254223797d2713c31e08610831" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/af23c7bb26a73b850840823662dda371484926c4", - "reference": "af23c7bb26a73b850840823662dda371484926c4", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/54b4c428a0054e254223797d2713c31e08610831", + "reference": "54b4c428a0054e254223797d2713c31e08610831", "shasum": "" }, "require": { @@ -9855,7 +9845,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.12-dev" } }, "autoload": { @@ -9891,20 +9881,20 @@ "portable", "shim" ], - "time": "2019-11-27T13:56:44+00:00" + "time": "2019-08-06T08:03:45+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.13.1", + "version": "v1.12.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038" + "reference": "04ce3335667451138df4307d6a9b61565560199e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/66fea50f6cb37a35eea048d75a7d99a45b586038", - "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/04ce3335667451138df4307d6a9b61565560199e", + "reference": "04ce3335667451138df4307d6a9b61565560199e", "shasum": "" }, "require": { @@ -9913,7 +9903,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.12-dev" } }, "autoload": { @@ -9946,24 +9936,24 @@ "portable", "shim" ], - "time": "2019-11-27T13:56:44+00:00" + "time": "2019-08-06T08:03:45+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.0.1", + "version": "v1.1.8", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "144c5e51266b281231e947b51223ba14acf1a749" + "reference": "ffc7f5692092df31515df2a5ecf3b7302b3ddacf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/144c5e51266b281231e947b51223ba14acf1a749", - "reference": "144c5e51266b281231e947b51223ba14acf1a749", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/ffc7f5692092df31515df2a5ecf3b7302b3ddacf", + "reference": "ffc7f5692092df31515df2a5ecf3b7302b3ddacf", "shasum": "" }, "require": { - "php": "^7.2.5", + "php": "^7.1.3", "psr/container": "^1.0" }, "suggest": { @@ -9972,7 +9962,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "1.1-dev" } }, "autoload": { @@ -10004,30 +9994,30 @@ "interoperability", "standards" ], - "time": "2019-11-18T17:27:11+00:00" + "time": "2019-10-14T12:27:06+00:00" }, { "name": "symfony/stopwatch", - "version": "v4.4.1", + "version": "v4.3.8", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "5745b514fc56ae1907c6b8ed74f94f90f64694e9" + "reference": "e96c259de6abcd0cead71f0bf4d730d53ee464d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/5745b514fc56ae1907c6b8ed74f94f90f64694e9", - "reference": "5745b514fc56ae1907c6b8ed74f94f90f64694e9", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/e96c259de6abcd0cead71f0bf4d730d53ee464d0", + "reference": "e96c259de6abcd0cead71f0bf4d730d53ee464d0", "shasum": "" }, "require": { "php": "^7.1.3", - "symfony/service-contracts": "^1.0|^2" + "symfony/service-contracts": "^1.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.4-dev" + "dev-master": "4.3-dev" } }, "autoload": { @@ -10054,20 +10044,20 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2019-11-05T16:11:08+00:00" + "time": "2019-11-05T14:48:09+00:00" }, { "name": "symfony/yaml", - "version": "v4.4.1", + "version": "v4.3.8", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "76de473358fe802578a415d5bb43c296cf09d211" + "reference": "324cf4b19c345465fad14f3602050519e09e361d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/76de473358fe802578a415d5bb43c296cf09d211", - "reference": "76de473358fe802578a415d5bb43c296cf09d211", + "url": "https://api.github.com/repos/symfony/yaml/zipball/324cf4b19c345465fad14f3602050519e09e361d", + "reference": "324cf4b19c345465fad14f3602050519e09e361d", "shasum": "" }, "require": { @@ -10078,7 +10068,7 @@ "symfony/console": "<3.4" }, "require-dev": { - "symfony/console": "^3.4|^4.0|^5.0" + "symfony/console": "~3.4|~4.0" }, "suggest": { "symfony/console": "For validating YAML files using the lint command" @@ -10086,7 +10076,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.4-dev" + "dev-master": "4.3-dev" } }, "autoload": { @@ -10113,7 +10103,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2019-11-12T14:51:11+00:00" + "time": "2019-10-30T12:58:49+00:00" }, { "name": "theseer/fdomdocument", @@ -10248,29 +10238,31 @@ }, { "name": "webmozart/assert", - "version": "1.6.0", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "573381c0a64f155a0d9a23f4b0c797194805b925" + "reference": "88e6d84706d09a236046d686bbea96f07b3a34f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/573381c0a64f155a0d9a23f4b0c797194805b925", - "reference": "573381c0a64f155a0d9a23f4b0c797194805b925", + "url": "https://api.github.com/repos/webmozart/assert/zipball/88e6d84706d09a236046d686bbea96f07b3a34f4", + "reference": "88e6d84706d09a236046d686bbea96f07b3a34f4", "shasum": "" }, "require": { "php": "^5.3.3 || ^7.0", "symfony/polyfill-ctype": "^1.8" }, - "conflict": { - "vimeo/psalm": "<3.6.0" - }, "require-dev": { "phpunit/phpunit": "^4.8.36 || ^7.5.13" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -10292,7 +10284,7 @@ "check", "validate" ], - "time": "2019-11-24T13:36:37+00:00" + "time": "2019-08-24T08:43:50+00:00" }, { "name": "weew/helpers-array", From 6c47a755e320539aed1ffe53087932184082802e Mon Sep 17 00:00:00 2001 From: Dan Wallis <mrdanwallis@gmail.com> Date: Tue, 17 Dec 2019 00:09:38 +0000 Subject: [PATCH 0447/1143] Fix unit tests --- .../Adminhtml/Indexer/MassInvalidateTest.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Indexer/Test/Unit/Controller/Adminhtml/Indexer/MassInvalidateTest.php b/app/code/Magento/Indexer/Test/Unit/Controller/Adminhtml/Indexer/MassInvalidateTest.php index ec061d2314329..7c5ed40a2ccef 100644 --- a/app/code/Magento/Indexer/Test/Unit/Controller/Adminhtml/Indexer/MassInvalidateTest.php +++ b/app/code/Magento/Indexer/Test/Unit/Controller/Adminhtml/Indexer/MassInvalidateTest.php @@ -204,9 +204,6 @@ public function testExecute($indexerIds, $exception) ->method('addError')->with(__('Please select indexers.')) ->will($this->returnValue(1)); } else { - $this->objectManager->expects($this->any()) - ->method('get')->with(\Magento\Framework\Indexer\IndexerRegistry::class) - ->will($this->returnValue($this->indexReg)); $indexerInterface = $this->getMockForAbstractClass( \Magento\Framework\Indexer\IndexerInterface::class, ['invalidate'], @@ -226,12 +223,16 @@ public function testExecute($indexerIds, $exception) ->will($this->returnValue(1)); if ($exception) { + $this->indexReg->expects($this->any()) + ->method('get')->with(2) + ->will($this->throwException($exception)); + if ($exception instanceof \Magento\Framework\Exception\LocalizedException) { - $this->messageManager->expects($this->exactly(1)) + $this->messageManager->expects($this->once()) ->method('addError') ->with($exception->getMessage()); } else { - $this->messageManager->expects($this->exactly(1)) + $this->messageManager->expects($this->once()) ->method('addException') ->with($exception, "We couldn't invalidate indexer(s) because of an error."); } @@ -260,11 +261,11 @@ public function executeDataProvider() 'exception' => null, ], 'set3' => [ - 'indexers' => [1], + 'indexers' => [2], 'exception' => new \Magento\Framework\Exception\LocalizedException(__('Test Phrase')), ], 'set4' => [ - 'indexers' => [1], + 'indexers' => [2], 'exception' => new \Exception(), ] ]; From 2be8374fe0262eccb232ff9614211c126d496a4b Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Tue, 17 Dec 2019 07:42:22 +0700 Subject: [PATCH 0448/1143] Refactor code --- .../Unit/Pricing/MsrpPriceCalculatorTest.php | 85 +++++++++---------- 1 file changed, 40 insertions(+), 45 deletions(-) diff --git a/app/code/Magento/Msrp/Test/Unit/Pricing/MsrpPriceCalculatorTest.php b/app/code/Magento/Msrp/Test/Unit/Pricing/MsrpPriceCalculatorTest.php index aac6852b7000c..24e10207ff14c 100644 --- a/app/code/Magento/Msrp/Test/Unit/Pricing/MsrpPriceCalculatorTest.php +++ b/app/code/Magento/Msrp/Test/Unit/Pricing/MsrpPriceCalculatorTest.php @@ -9,7 +9,7 @@ namespace Magento\Msrp\Test\Unit\Pricing; use Magento\Catalog\Model\Product; -use Magento\Catalog\Model\Product\Type as Type; +use Magento\Catalog\Model\Product\Type as ProductType; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use Magento\GroupedProduct\Model\Product\Type\Grouped as GroupedType; use Magento\Msrp\Pricing\MsrpPriceCalculator; @@ -19,6 +19,36 @@ class MsrpPriceCalculatorTest extends TestCase { + /** + * @var MsrpPriceCalculator + */ + private $pricing; + + /** + * @var MsrpGroupedCalculator|MockObject + */ + private $msrpGroupedCalculatorMock; + + /** + * Prepare environment to test + */ + protected function setUp() + { + $objectManager = new ObjectManager($this); + $this->msrpGroupedCalculatorMock = $this->createMock(MsrpGroupedCalculator::class); + $this->pricing = $objectManager->getObject( + MsrpPriceCalculator::class, + [ + 'msrpPriceCalculators' => [ + [ + 'productType' => GroupedType::TYPE_CODE, + 'priceCalculator' => $this->msrpGroupedCalculatorMock + ] + ] + ] + ); + } + /** * Test getMrspPriceValue() with the data provider below * @@ -27,17 +57,12 @@ class MsrpPriceCalculatorTest extends TestCase * @param float $expected * @dataProvider getMsrpPriceValueDataProvider */ - public function testGetMsrpPriceValue($msrpPriceCalculators, $productMock, $expected) + public function testGetMsrpPriceValue($msrpPriceCalculatorPrice, $productMock, $expected) { - $objectManager = new ObjectManager($this); - $pricing = $objectManager->getObject( - MsrpPriceCalculator::class, - [ - 'msrpPriceCalculators' => $msrpPriceCalculators - ] - ); + $this->msrpGroupedCalculatorMock->expects($this->any()) + ->method('getMsrpPriceValue')->willReturn($msrpPriceCalculatorPrice); - $this->assertEquals($expected, $pricing->getMsrpPriceValue($productMock)); + $this->assertEquals($expected, $this->pricing->getMsrpPriceValue($productMock)); } /** @@ -48,49 +73,19 @@ public function testGetMsrpPriceValue($msrpPriceCalculators, $productMock, $expe public function getMsrpPriceValueDataProvider() { return [ - 'Get Mrsp Price with grouped product and price calculator is also grouped product type' => [ - [ - [ - 'productType' => GroupedType::TYPE_CODE, - 'priceCalculator' => $this->createPriceCalculatorMock( - MsrpGroupedCalculator::class, - 23.50 - ) - ] - ], + 'Get Mrsp Price with product and msrp calculator and the same product type' => [ + 23.50, $this->createProductMock(GroupedType::TYPE_CODE, 0), 23.50 ], - 'Get Mrsp Price with simple product and price calculator is grouped product type' => [ - [ - [ - 'productType' => GroupedType::TYPE_CODE, - 'priceCalculator' => $this->createPriceCalculatorMock( - MsrpGroupedCalculator::class, - 0 - ) - ] - ], - $this->createProductMock(Type::TYPE_SIMPLE, 24.88), + 'Get Mrsp Price with product and msrp calculator and the different product type' => [ + 24.88, + $this->createProductMock(ProductType::TYPE_SIMPLE, 24.88), 24.88 ] ]; } - /** - * Create Price Calculator Mock - * - * @param string $class - * @param float $msrpPriceValue - * @return MockObject - */ - private function createPriceCalculatorMock($class, $msrpPriceValue) - { - $priceCalculatorMock = $this->createMock($class); - $priceCalculatorMock->expects($this->any())->method('getMsrpPriceValue')->willReturn($msrpPriceValue); - return $priceCalculatorMock; - } - /** * Create Product Mock * From 9b6d9d0436d5dd03960e08de1748eec76dfe07c8 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Tue, 17 Dec 2019 10:14:33 +0700 Subject: [PATCH 0449/1143] [Directory] Cover action directory/json/countryRegion by Integration Test --- .../Adminhtml/Json/CountryRegionTest.php | 50 +++++++++++++++++++ .../_files/example_region_in_country.php | 37 ++++++++++++++ .../example_region_in_country_rollback.php | 26 ++++++++++ 3 files changed, 113 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/Directory/Controller/Adminhtml/Json/CountryRegionTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Directory/_files/example_region_in_country.php create mode 100644 dev/tests/integration/testsuite/Magento/Directory/_files/example_region_in_country_rollback.php diff --git a/dev/tests/integration/testsuite/Magento/Directory/Controller/Adminhtml/Json/CountryRegionTest.php b/dev/tests/integration/testsuite/Magento/Directory/Controller/Adminhtml/Json/CountryRegionTest.php new file mode 100644 index 0000000000000..8d3b12aa34f1e --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Directory/Controller/Adminhtml/Json/CountryRegionTest.php @@ -0,0 +1,50 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Directory\Controller\Adminhtml\Json; + +use Magento\Framework\App\Request\Http as HttpRequest; +use Magento\TestFramework\TestCase\AbstractBackendController; + +/** + * @magentoAppArea adminhtml + */ +class CountryRegionTest extends AbstractBackendController +{ + /** + * Test Execute without param + */ + public function testExecuteWithNoCountryParam() + { + $this->getRequest()->setMethod(HttpRequest::METHOD_POST); + $this->getRequest()->setPostValue([]); + $this->dispatch('backend/directory/json/countryRegion'); + + $actual = $this->getResponse()->getBody(); + + $this->assertEquals('[]', $actual); + } + + /** + * Test Execute with region in the fixture + * + * @magentoDataFixture Magento/Directory/_files/example_region_in_country.php + */ + public function testExecute() + { + $this->getRequest()->setMethod(HttpRequest::METHOD_POST); + $this->getRequest()->setPostValue([ + 'parent' => 'WW' + ]); + $this->dispatch('backend/directory/json/countryRegion'); + + $actual = $this->getResponse()->getBody(); + + $this->assertContains('Example Region 1', $actual); + $this->assertContains('Example Region 2', $actual); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Directory/_files/example_region_in_country.php b/dev/tests/integration/testsuite/Magento/Directory/_files/example_region_in_country.php new file mode 100644 index 0000000000000..680c0079a795c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Directory/_files/example_region_in_country.php @@ -0,0 +1,37 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +use Magento\TestFramework\Helper\Bootstrap; +use Magento\Directory\Model\Region as RegionModel; +use Magento\Directory\Model\ResourceModel\Region as RegionResource; + +$objectManager = Bootstrap::getObjectManager(); + +$regionData = [ + [ + 'country_id' => 'WW', + 'code' => 'ER1', + 'default_name' => 'Example Region 1' + ], + [ + 'country_id' => 'WW', + 'code' => 'ER2', + 'default_name' => 'Example Region 2' + ] +]; + +/** @var RegionModel $region */ +$region = $objectManager->create(RegionModel::class); +/** @var RegionResource $regionResource */ +$regionResource = $objectManager->get(RegionResource::class); + +foreach ($regionData as $data) { + /** @var RegionModel $region */ + $region = $objectManager->create(RegionModel::class); + $regionResource->save($region); +} diff --git a/dev/tests/integration/testsuite/Magento/Directory/_files/example_region_in_country_rollback.php b/dev/tests/integration/testsuite/Magento/Directory/_files/example_region_in_country_rollback.php new file mode 100644 index 0000000000000..4f78873aa380f --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Directory/_files/example_region_in_country_rollback.php @@ -0,0 +1,26 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +use Magento\TestFramework\Helper\Bootstrap; +use Magento\Directory\Model\Region as RegionModel; +use Magento\Directory\Model\ResourceModel\Region as RegionResource; +use Magento\Directory\Model\ResourceModel\Region\Collection as RegionResourceCollection; + +$objectManager = Bootstrap::getObjectManager(); +$regionCode = ['ER1', 'ER2']; + +/** @var RegionResource $regionResource */ +$regionResource = $objectManager->get(RegionResource::class); + +$regionCollection = $objectManager->create(RegionResourceCollection::class) + ->addFieldToFilter('code', ['in' => $regionCode]); + +/** @var RegionModel $region */ +foreach ($regionCollection as $region) { + $regionResource->delete($region); +} From e3ce8c9f5bf263b12614af349a38be5e7168020b Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Tue, 17 Dec 2019 11:20:18 +0700 Subject: [PATCH 0450/1143] [Directory] Cover action directory/json/countryRegion by Integration Test --- .../Magento/Directory/_files/example_region_in_country.php | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/integration/testsuite/Magento/Directory/_files/example_region_in_country.php b/dev/tests/integration/testsuite/Magento/Directory/_files/example_region_in_country.php index 680c0079a795c..ba33b09a1f948 100644 --- a/dev/tests/integration/testsuite/Magento/Directory/_files/example_region_in_country.php +++ b/dev/tests/integration/testsuite/Magento/Directory/_files/example_region_in_country.php @@ -33,5 +33,6 @@ foreach ($regionData as $data) { /** @var RegionModel $region */ $region = $objectManager->create(RegionModel::class); + $region->setData($data); $regionResource->save($region); } From 91a4ba542cdfb99da5501468126744d23841d26d Mon Sep 17 00:00:00 2001 From: Serhii Voloshkov <serhii.voloshkov@transoftgroup.com> Date: Tue, 17 Dec 2019 09:50:07 +0200 Subject: [PATCH 0451/1143] MC-21347: Remove Customer module's dependency on Review --- .../Customer/Block/Account/Dashboard.php | 10 ------ .../Magento/Customer/Controller/Review.php | 11 ++++++- .../Customer/Controller/Review/Index.php | 10 +++++- .../Customer/Controller/Review/View.php | 10 +++++- app/code/Magento/Customer/composer.json | 1 - .../Block/Adminhtml/Edit/Tab/Reviews.php | 13 +++++--- .../Review/Block/Adminhtml/ReviewTab.php | 8 ++--- .../Adminhtml/Customer}/ProductReviews.php | 16 +++++++--- .../review_customer_productreviews.xml} | 2 +- .../Controller/Adminhtml/IndexTest.php | 11 ------- .../Adminhtml/Customer/ProductReviewsTest.php | 31 +++++++++++++++++++ 11 files changed, 82 insertions(+), 41 deletions(-) rename app/code/Magento/{Customer => Review}/Block/Adminhtml/Edit/Tab/Reviews.php (58%) rename app/code/Magento/{Customer/Controller/Adminhtml/Index => Review/Controller/Adminhtml/Customer}/ProductReviews.php (61%) rename app/code/Magento/{Customer/view/adminhtml/layout/customer_index_productreviews.xml => Review/view/adminhtml/layout/review_customer_productreviews.xml} (76%) create mode 100644 dev/tests/integration/testsuite/Magento/Review/Controller/Adminhtml/Customer/ProductReviewsTest.php diff --git a/app/code/Magento/Customer/Block/Account/Dashboard.php b/app/code/Magento/Customer/Block/Account/Dashboard.php index 547074d0bcd81..92537009175fd 100644 --- a/app/code/Magento/Customer/Block/Account/Dashboard.php +++ b/app/code/Magento/Customer/Block/Account/Dashboard.php @@ -129,16 +129,6 @@ public function getOrdersUrl() return ''; } - /** - * Retrieve the Url for customer reviews. - * - * @return string - */ - public function getReviewsUrl() - { - return $this->_urlBuilder->getUrl('review/customer/index', ['_secure' => true]); - } - /** * Retrieve the Url for managing customer wishlist. * diff --git a/app/code/Magento/Customer/Controller/Review.php b/app/code/Magento/Customer/Controller/Review.php index 3a26f58c9f7d7..cf4c0af780701 100644 --- a/app/code/Magento/Customer/Controller/Review.php +++ b/app/code/Magento/Customer/Controller/Review.php @@ -6,9 +6,16 @@ namespace Magento\Customer\Controller; use Magento\Framework\App\Action\Context; +use Magento\Framework\App\Action\HttpGetActionInterface; use Magento\Framework\View\Result\PageFactory; -class Review extends \Magento\Framework\App\Action\Action +/** + * Deprecated class which was in use as general class in Customer Account "My Product Reviews" tab. + * + * @deprecated Remove Customer module's dependency on Review. Non-used class. + * @see \Magento\Review\Controller\Customer + */ +class Review extends \Magento\Framework\App\Action\Action implements HttpGetActionInterface { /** * @var PageFactory @@ -28,6 +35,8 @@ public function __construct( } /** + * Main page in Customer Account "My Product Reviews" tab. + * * @return \Magento\Framework\View\Result\Page */ public function execute() diff --git a/app/code/Magento/Customer/Controller/Review/Index.php b/app/code/Magento/Customer/Controller/Review/Index.php index e11dea17d4df7..a7884c1dc763e 100644 --- a/app/code/Magento/Customer/Controller/Review/Index.php +++ b/app/code/Magento/Customer/Controller/Review/Index.php @@ -6,6 +6,14 @@ */ namespace Magento\Customer\Controller\Review; -class Index extends \Magento\Customer\Controller\Review +use Magento\Framework\App\Action\HttpGetActionInterface; + +/** + * Deprecated class which was in use as main page in Customer Account "My Product Reviews" tab. + * + * @deprecated Remove Customer module's dependency on Review. Non-used class. + * @see \Magento\Review\Controller\Customer\Index + */ +class Index extends \Magento\Customer\Controller\Review implements HttpGetActionInterface { } diff --git a/app/code/Magento/Customer/Controller/Review/View.php b/app/code/Magento/Customer/Controller/Review/View.php index 679452de680f2..f32c756fba1ca 100644 --- a/app/code/Magento/Customer/Controller/Review/View.php +++ b/app/code/Magento/Customer/Controller/Review/View.php @@ -6,6 +6,14 @@ */ namespace Magento\Customer\Controller\Review; -class View extends \Magento\Customer\Controller\Review +use Magento\Framework\App\Action\HttpGetActionInterface; + +/** + * Deprecated class which was in use as view page in Customer Account "My Product Reviews" tab. + * + * @deprecated Remove Customer module's dependency on Review. Non-used class. + * @see \Magento\Review\Controller\Customer\View + */ +class View extends \Magento\Customer\Controller\Review implements HttpGetActionInterface { } diff --git a/app/code/Magento/Customer/composer.json b/app/code/Magento/Customer/composer.json index 3e98818a67b74..a9bc41c36e703 100644 --- a/app/code/Magento/Customer/composer.json +++ b/app/code/Magento/Customer/composer.json @@ -19,7 +19,6 @@ "magento/module-newsletter": "*", "magento/module-page-cache": "*", "magento/module-quote": "*", - "magento/module-review": "*", "magento/module-sales": "*", "magento/module-store": "*", "magento/module-tax": "*", diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Reviews.php b/app/code/Magento/Review/Block/Adminhtml/Edit/Tab/Reviews.php similarity index 58% rename from app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Reviews.php rename to app/code/Magento/Review/Block/Adminhtml/Edit/Tab/Reviews.php index a10842fc0c6de..8105b9f4994a0 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Reviews.php +++ b/app/code/Magento/Review/Block/Adminhtml/Edit/Tab/Reviews.php @@ -3,18 +3,21 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Customer\Block\Adminhtml\Edit\Tab; +declare(strict_types=1); + +namespace Magento\Review\Block\Adminhtml\Edit\Tab; /** + * Review tab in adminhtml area. + * * @api - * @since 100.0.2 */ class Reviews extends \Magento\Review\Block\Adminhtml\Grid { /** - * Hide grid mass action elements + * Hide grid mass action elements. * - * @return \Magento\Customer\Block\Adminhtml\Edit\Tab\Reviews + * @return \Magento\Review\Block\Adminhtml\Edit\Tab\Reviews */ protected function _prepareMassaction() { @@ -28,6 +31,6 @@ protected function _prepareMassaction() */ public function getGridUrl() { - return $this->getUrl('customer/*/productReviews', ['_current' => true]); + return $this->getUrl('review/customer/productReviews', ['_current' => true]); } } diff --git a/app/code/Magento/Review/Block/Adminhtml/ReviewTab.php b/app/code/Magento/Review/Block/Adminhtml/ReviewTab.php index f62f8e2aa0d4c..9533be4acda54 100644 --- a/app/code/Magento/Review/Block/Adminhtml/ReviewTab.php +++ b/app/code/Magento/Review/Block/Adminhtml/ReviewTab.php @@ -11,9 +11,7 @@ use Magento\Ui\Component\Layout\Tabs\TabWrapper; /** - * Class ReviewTab - * - * @package Magento\Review\Block\Adminhtml + * Review tab block. */ class ReviewTab extends TabWrapper { @@ -30,8 +28,6 @@ class ReviewTab extends TabWrapper protected $isAjaxLoaded = true; /** - * Constructor - * * @param Context $context * @param Registry $registry * @param array $data @@ -67,6 +63,6 @@ public function getTabLabel() */ public function getTabUrl() { - return $this->getUrl('customer/*/productReviews', ['_current' => true]); + return $this->getUrl('review/customer/productReviews', ['_current' => true]); } } diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index/ProductReviews.php b/app/code/Magento/Review/Controller/Adminhtml/Customer/ProductReviews.php similarity index 61% rename from app/code/Magento/Customer/Controller/Adminhtml/Index/ProductReviews.php rename to app/code/Magento/Review/Controller/Adminhtml/Customer/ProductReviews.php index dca7820c3dbc4..63285b7242217 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Index/ProductReviews.php +++ b/app/code/Magento/Review/Controller/Adminhtml/Customer/ProductReviews.php @@ -3,21 +3,29 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Customer\Controller\Adminhtml\Index; +declare(strict_types=1); -class ProductReviews extends \Magento\Customer\Controller\Adminhtml\Index +namespace Magento\Review\Controller\Adminhtml\Customer; + +use Magento\Framework\App\Action\HttpPostActionInterface; + +/** + * Customer product reviews page. + */ +class ProductReviews extends \Magento\Customer\Controller\Adminhtml\Index implements HttpPostActionInterface { /** - * Get customer's product reviews list + * Get customer's product reviews list. * * @return \Magento\Framework\View\Result\Layout */ public function execute() { - $customerId = $this->initCurrentCustomer(); + $customerId = (int)$this->initCurrentCustomer(); $resultLayout = $this->resultLayoutFactory->create(); $block = $resultLayout->getLayout()->getBlock('admin.customer.reviews'); $block->setCustomerId($customerId)->setUseAjax(true); + return $resultLayout; } } diff --git a/app/code/Magento/Customer/view/adminhtml/layout/customer_index_productreviews.xml b/app/code/Magento/Review/view/adminhtml/layout/review_customer_productreviews.xml similarity index 76% rename from app/code/Magento/Customer/view/adminhtml/layout/customer_index_productreviews.xml rename to app/code/Magento/Review/view/adminhtml/layout/review_customer_productreviews.xml index dfbfcac04ac67..ee1cc4bfb0871 100644 --- a/app/code/Magento/Customer/view/adminhtml/layout/customer_index_productreviews.xml +++ b/app/code/Magento/Review/view/adminhtml/layout/review_customer_productreviews.xml @@ -7,6 +7,6 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd"> <container name="root" label="Root"> - <block class="Magento\Customer\Block\Adminhtml\Edit\Tab\Reviews" name="admin.customer.reviews"/> + <block class="Magento\Review\Block\Adminhtml\Edit\Tab\Reviews" name="admin.customer.reviews"/> </container> </layout> diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php index 4fc549f3caf86..4a7cc7591f7aa 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php @@ -437,17 +437,6 @@ public function testCartAction() $this->assertContains('<div id="customer_cart_grid1"', $body); } - /** - * @magentoDataFixture Magento/Customer/_files/customer_sample.php - */ - public function testProductReviewsAction() - { - $this->getRequest()->setParam('id', 1); - $this->dispatch('backend/customer/index/productReviews'); - $body = $this->getResponse()->getBody(); - $this->assertContains('<div id="reviwGrid"', $body); - } - /** * @magentoDataFixture Magento/Customer/_files/customer.php * @magentoDataFixture Magento/Customer/_files/customer_address.php diff --git a/dev/tests/integration/testsuite/Magento/Review/Controller/Adminhtml/Customer/ProductReviewsTest.php b/dev/tests/integration/testsuite/Magento/Review/Controller/Adminhtml/Customer/ProductReviewsTest.php new file mode 100644 index 0000000000000..cbd6617188a99 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Review/Controller/Adminhtml/Customer/ProductReviewsTest.php @@ -0,0 +1,31 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Review\Controller\Adminhtml\Customer; + +use Magento\Framework\App\Request\Http; +use Magento\TestFramework\TestCase\AbstractBackendController; + +/** + * Test for customer product reviews page. + */ +class ProductReviewsTest extends AbstractBackendController +{ + /** + * Check Customer product review action. + * + * @magentoDataFixture Magento/Customer/_files/customer_sample.php + * @return void + */ + public function testProductReviewsAction(): void + { + $this->getRequest()->setPostValue(['id' => 1])->setMethod(Http::METHOD_POST); + $this->dispatch('backend/review/customer/productReviews'); + $body = $this->getResponse()->getBody(); + $this->assertContains('<div id="reviwGrid"', $body); + } +} From cab418bb0c0fa69c1872dcd98a24278c0ce5bd3b Mon Sep 17 00:00:00 2001 From: Viktor Petryk <victor.petryk@transoftgroup.com> Date: Tue, 17 Dec 2019 10:17:48 +0200 Subject: [PATCH 0452/1143] MC-29444: Extra Values of UPS and USPS are in dropdown list Cart Price Rule - Condition - Shipping Method --- app/code/Magento/Ups/Model/Carrier.php | 2 +- app/code/Magento/Ups/Test/Unit/Model/CarrierTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Ups/Model/Carrier.php b/app/code/Magento/Ups/Model/Carrier.php index 28e194e65bd60..05f12f8999212 100644 --- a/app/code/Magento/Ups/Model/Carrier.php +++ b/app/code/Magento/Ups/Model/Carrier.php @@ -1901,7 +1901,7 @@ public function getContainerTypes(\Magento\Framework\DataObject $params = null) return ['00' => __('Customer Packaging')] + $containerTypes; } elseif ($countryShipper == self::USA_COUNTRY_ID && $countryRecipient == self::PUERTORICO_COUNTRY_ID - && ($method == '03' || $method == '02' || $method == '01') + && in_array($method, ['01', '02', '03']) ) { // Container types should be the same as for domestic $params->setCountryRecipient(self::USA_COUNTRY_ID); diff --git a/app/code/Magento/Ups/Test/Unit/Model/CarrierTest.php b/app/code/Magento/Ups/Test/Unit/Model/CarrierTest.php index 7e587f249e67a..34dd4f0fe142b 100644 --- a/app/code/Magento/Ups/Test/Unit/Model/CarrierTest.php +++ b/app/code/Magento/Ups/Test/Unit/Model/CarrierTest.php @@ -423,13 +423,13 @@ public function testGetAllowedMethods( 'carriers/ups/allowed_methods', ScopeInterface::SCOPE_STORE, null, - $allowedMethods + $allowedMethods, ], [ 'carriers/ups/type', ScopeInterface::SCOPE_STORE, null, - $carrierType + $carrierType, ], [ 'carriers/ups/origin_shipment', From 8451e0f6d4754d29c9458ab21ec60aafa674f8b9 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <51681547+engcom-Golf@users.noreply.github.com> Date: Tue, 17 Dec 2019 10:33:14 +0200 Subject: [PATCH 0453/1143] Fix static test --- .../Magento/Framework/View/Element/Template/File/Resolver.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/internal/Magento/Framework/View/Element/Template/File/Resolver.php b/lib/internal/Magento/Framework/View/Element/Template/File/Resolver.php index b13caa55d3174..cd7ba1dfaecda 100644 --- a/lib/internal/Magento/Framework/View/Element/Template/File/Resolver.php +++ b/lib/internal/Magento/Framework/View/Element/Template/File/Resolver.php @@ -9,9 +9,7 @@ use Magento\Framework\Serialize\Serializer\Json; /** - * Class Resolver - * - * @package Magento\Framework\View\Element\Template\File + * Resolver, returns template file name by template. */ class Resolver { From 2e7f74bc940752ff4faa682300cdac667b872695 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <51681547+engcom-Golf@users.noreply.github.com> Date: Tue, 17 Dec 2019 10:34:01 +0200 Subject: [PATCH 0454/1143] fix static test --- lib/internal/Magento/Framework/View/Element/RendererList.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/View/Element/RendererList.php b/lib/internal/Magento/Framework/View/Element/RendererList.php index 96707c74dd253..eba78867d7725 100644 --- a/lib/internal/Magento/Framework/View/Element/RendererList.php +++ b/lib/internal/Magento/Framework/View/Element/RendererList.php @@ -6,7 +6,7 @@ namespace Magento\Framework\View\Element; /** - * Renderer List + * Get renderer by code * * @api */ From 78dc52b87d6a4517799bc0f359b8016e0d40b21a Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <51681547+engcom-Golf@users.noreply.github.com> Date: Tue, 17 Dec 2019 10:34:58 +0200 Subject: [PATCH 0455/1143] fix static test fix --- .../Framework/View/Element/ExceptionHandlerBlockFactory.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/internal/Magento/Framework/View/Element/ExceptionHandlerBlockFactory.php b/lib/internal/Magento/Framework/View/Element/ExceptionHandlerBlockFactory.php index b1c74777fb102..b13ac2531ebc8 100644 --- a/lib/internal/Magento/Framework/View/Element/ExceptionHandlerBlockFactory.php +++ b/lib/internal/Magento/Framework/View/Element/ExceptionHandlerBlockFactory.php @@ -6,9 +6,7 @@ namespace Magento\Framework\View\Element; /** - * Class ExceptionHandlerBlockFactory - * - * @package Magento\Framework\View\Element + * Factory for BlockInterface */ class ExceptionHandlerBlockFactory { From 62a7ba8afa52c5457651fa02fe3f02c0b163768b Mon Sep 17 00:00:00 2001 From: Roman Zhupanyn <roma.dj.elf@gmail.com> Date: Tue, 17 Dec 2019 10:48:00 +0200 Subject: [PATCH 0456/1143] MC-24902: Storefront: Verify Category structure on storefront --- .../Magento/Catalog/Block/BreadcrumbsTest.php | 72 +++ .../Catalog/Block/Category/TopMenuTest.php | 429 +++++++++++++++++- .../categories_no_products_with_two_tree.php | 63 +++ ...ies_no_products_with_two_tree_rollback.php | 8 + .../category_in_second_root_category.php | 21 + ...egory_in_second_root_category_rollback.php | 8 + .../store_with_second_root_category.php | 72 +++ ...ore_with_second_root_category_rollback.php | 39 ++ 8 files changed, 710 insertions(+), 2 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Block/BreadcrumbsTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/categories_no_products_with_two_tree.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/categories_no_products_with_two_tree_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/category_in_second_root_category.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/category_in_second_root_category_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/Store/_files/store_with_second_root_category.php create mode 100644 dev/tests/integration/testsuite/Magento/Store/_files/store_with_second_root_category_rollback.php diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/BreadcrumbsTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/BreadcrumbsTest.php new file mode 100644 index 0000000000000..050ac6d0f55f9 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/BreadcrumbsTest.php @@ -0,0 +1,72 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Block; + +use Magento\Catalog\Api\CategoryRepositoryInterface; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Registry; +use Magento\Framework\View\LayoutInterface; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\Theme\Block\Html\Breadcrumbs as ThemeBreadcrumbs; +use PHPUnit\Framework\TestCase; + +/** + * Checks the behavior of breadcrumbs on the category view page. + * + * @magentoAppArea frontend + */ +class BreadcrumbsTest extends TestCase +{ + /** @var ObjectManagerInterface */ + private $objectManager; + + /** @var LayoutInterface */ + private $layout; + + /** @var CategoryRepositoryInterface */ + private $categoryRepository; + + /** @var Registry */ + private $registry; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + + $this->objectManager = Bootstrap::getObjectManager(); + $this->categoryRepository = $this->objectManager->create(CategoryRepositoryInterface::class); + $this->registry = $this->objectManager->get(Registry::class); + $this->layout = $this->objectManager->get(LayoutInterface::class); + } + + /** + * Checks the order of categories in breadcrumbs. + * + * @magentoDataFixture Magento/Catalog/_files/category_tree.php + * @return void + */ + public function testCategoriesSequence(): void + { + $category = $this->categoryRepository->get(402); + $this->registry->register('current_category', $category); + $themeBreadcrumbs = $this->layout->createBlock(ThemeBreadcrumbs::class, 'breadcrumbs'); + $this->layout->createBlock(Breadcrumbs::class); + $html = $themeBreadcrumbs->toHtml(); + + $actualCategories = preg_replace('/\s+/', '', strip_tags($html)); + $expectedCategories = __('Home') . 'Category1' . 'Category1.1' . 'Category1.1.1'; + self::assertEquals( + $expectedCategories, + $actualCategories, + 'The order of categories in breadcrumbs is not correct!' + ); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Category/TopMenuTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Category/TopMenuTest.php index 0dc8016c3ef8b..00ac61272bddc 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Category/TopMenuTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Category/TopMenuTest.php @@ -8,9 +8,15 @@ namespace Magento\Catalog\Block\Category; use Magento\Catalog\Api\CategoryRepositoryInterface; +use Magento\Catalog\Api\Data\CategoryInterface; +use Magento\Catalog\Model\Category; use Magento\Catalog\Model\CategoryFactory; +use Magento\Catalog\Model\ResourceModel\Category\Collection; +use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory; +use Magento\Framework\Data\Tree\Node; use Magento\Framework\ObjectManagerInterface; use Magento\Framework\View\LayoutInterface; +use Magento\Store\Model\StoreManagerInterface; use Magento\TestFramework\Helper\Bootstrap; use Magento\Theme\Block\Html\Topmenu; use PHPUnit\Framework\TestCase; @@ -26,6 +32,9 @@ class TopMenuTest extends TestCase /** @var ObjectManagerInterface */ private $objectManager; + /** @var LayoutInterface */ + private $layout; + /** @var Topmenu */ private $block; @@ -35,6 +44,9 @@ class TopMenuTest extends TestCase /** @var CategoryRepositoryInterface */ private $categoryRepository; + /** @var StoreManagerInterface */ + private $storeManager; + /** * @inheritdoc */ @@ -43,9 +55,11 @@ protected function setUp() parent::setUp(); $this->objectManager = Bootstrap::getObjectManager(); - $this->categoryFactory = $this->objectManager->create(CategoryFactory::class); + $this->categoryFactory = $this->objectManager->get(CategoryFactory::class); $this->categoryRepository = $this->objectManager->create(CategoryRepositoryInterface::class); - $this->block = $this->objectManager->get(LayoutInterface::class)->createBlock(Topmenu::class); + $this->layout = $this->objectManager->get(LayoutInterface::class); + $this->block = $this->layout->createBlock(Topmenu::class); + $this->storeManager = $this->objectManager->get(StoreManagerInterface::class); } /** @@ -100,4 +114,415 @@ public function invisibilityDataProvider(): array ], ]; } + + /** + * Check category visibility in the category tree in the menu + * + * @dataProvider categoriesVisibleInTreeProvider + * @magentoDataFixture Magento/Catalog/_files/category_tree.php + * @magentoAppIsolation enabled + * @param array $categories + * @param array $expectedCategories + * @return void + */ + public function testCategoriesInTreeVisible(array $categories, array $expectedCategories): void + { + $this->updateCategories($categories); + $output = $this->block->getHtml('level-top', 'submenu', 0); + foreach ($expectedCategories as $data) { + $this->assertContains( + $data['name'], + $output, + 'Category ' . $data['name'] . ' should appear in the menu!' + ); + } + } + + /** + * @return array + */ + public function categoriesVisibleInTreeProvider(): array + { + return [ + 'add_in_tree_visible' => [ + 'categories' => [ + [ + 'is_new_category' => true, + 'parent_name' => 'Category 1.1.1', + Category::KEY_NAME => 'Sub Category 1', + Category::KEY_IS_ACTIVE => true, + ], + ], + 'expectedCategories' => [ + [ + 'name' => 'Sub Category 1', + ], + ], + ], + 'child_visible_in_tree' => [ + 'categories' => [ + [ + 'is_new_category' => true, + 'parent_name' => 'Category 1.1', + Category::KEY_NAME => 'Sub Category 1', + Category::KEY_IS_ACTIVE => true, + ], + [ + 'is_new_category' => false, + 'category_name' => 'Category 1.1', + Category::KEY_IS_ACTIVE => false, + ], + ], + 'expectedCategories' => [ + [ + 'name' => 'Sub Category 1', + ], + [ + 'name' => 'Category 1.1.1', + ], + ], + ], + ]; + } + + /** + * Check invisibility of a category in the category tree in the menu + * + * @dataProvider categoriesInTreeInvisibleProvider + * @magentoDataFixture Magento/Catalog/_files/category_tree.php + * @magentoAppIsolation enabled + * @param array $categories + * @param array $expectedCategories + * @return void + */ + public function testCategoriesInTreeInvisible(array $categories, array $expectedCategories): void + { + $this->updateCategories($categories); + $output = $this->block->getHtml('level-top', 'submenu', 0); + foreach ($expectedCategories as $data) { + $this->assertNotContains( + $data['name'], + $output, + 'Category ' . $data['name'] . ' should not appear in the menu!' + ); + } + } + + /** + * @return array + */ + public function categoriesInTreeInvisibleProvider(): array + { + return [ + 'add_in_tree_category_disable' => [ + 'categories' => [ + [ + 'is_new_category' => true, + 'parent_name' => 'Category 1.1.1', + Category::KEY_NAME => 'Sub Category 1', + Category::KEY_IS_ACTIVE => false, + Category::KEY_INCLUDE_IN_MENU => true, + ], + ], + 'expectedCategories' => [ + [ + 'name' => 'Sub Category 1', + ], + ], + ], + 'add_in_tree_include_in_menu_disable' => [ + 'categories' => [ + [ + 'is_new_category' => true, + 'parent_name' => 'Category 1.1.1', + Category::KEY_NAME => 'Sub Category 1', + Category::KEY_IS_ACTIVE => true, + Category::KEY_INCLUDE_IN_MENU => false, + ], + ], + 'expectedCategories' => [ + [ + 'name' => 'Sub Category 1', + ], + ], + ], + 'child_invisible_in_tree' => [ + 'categories' => [ + [ + 'is_new_category' => true, + 'parent_name' => 'Default Category', + Category::KEY_NAME => 'Sub Category 1', + Category::KEY_IS_ACTIVE => true, + ], + [ + 'is_new_category' => false, + 'category_name' => 'Category 1', + Category::KEY_IS_ACTIVE => false, + ], + ], + 'expectedCategories' => [ + [ + 'name' => 'Category 1.1', + ], + [ + 'name' => 'Category 1.1.1', + ], + ], + ], + ]; + } + + /** + * Check menu structure after moving category or changing position + * + * @dataProvider menuStructureProvider + * @magentoDataFixture Magento/Catalog/_files/categories_no_products_with_two_tree.php + * @magentoAppIsolation enabled + * @param array $moveCategory + * @param array $expectedMenuTree + * @return void + */ + public function testMenuStructure(array $moveCategory, array $expectedMenuTree): void + { + /** @var Category $category */ + $category = $this->categoryRepository->get($this->getCategoryIdByName($moveCategory['name'])); + $category->move( + $this->getCategoryIdByName($moveCategory['parent_name']), + $this->getCategoryIdByName($moveCategory['after_category_name']) + ); + + $this->block->getHtml('level-top', 'submenu', 0); + + $menuTree = $this->getMenuTree($this->block->getMenu()); + $topLevelKeys = array_flip(array_keys($expectedMenuTree)); + $actualMenuTree = array_intersect_key($menuTree, $topLevelKeys); + $this->assertEquals( + $expectedMenuTree, + $actualMenuTree, + 'Error in displaying the menu tree after moving a category!' + ); + } + + /** + * @return array + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function menuStructureProvider(): array + { + return [ + 'move_to_default' => [ + 'moveCategory' => [ + 'name' => 'Category 1.1.1', + 'parent_name' => 'Default Category', + 'after_category_name' => '', + ], + 'expectedMenuTree' => [ + 'Category 1.1.1' => ['position' => '1'], + 'Category 1' => [ + 'position' => '2', + 'Category 1.1' => ['position' => '2-1'], + ], + ], + ], + 'move_to_not_default' => [ + 'moveCategory' => [ + 'name' => 'Movable Position 3', + 'parent_name' => 'Movable Position 2', + 'after_category_name' => '', + ], + 'expectedMenuTree' => [ + 'Movable Position 2' => [ + 'position' => '5', + 'Movable Position 3' => ['position' => '5-1'], + ], + 'Category 12' => ['position' => '6'], + ], + ], + 'move_tree_to_default' => [ + 'moveCategory' => [ + 'name' => 'Category 1.1', + 'parent_name' => 'Default Category', + 'after_category_name' => '', + ], + 'expectedMenuTree' => [ + 'Category 1.1' => [ + 'position' => '1', + 'Category 1.1.1' => ['position' => '1-1'], + ], + 'Category 1' => ['position' => '2'], + ], + ], + 'move_tree_to_other_tree' => [ + 'moveCategory' => [ + 'name' => 'Category 2.2', + 'parent_name' => 'Category 1.1', + 'after_category_name' => 'Category 1.1.1', + ], + 'expectedMenuTree' => [ + 'Category 1' => [ + 'position' => '1', + 'Category 1.1' => [ + 'position' => '1-1', + 'Category 1.1.1' => ['position' => '1-1-1'], + 'Category 2.2' => [ + 'position' => '1-1-2', + 'Category 2.2.1' => ['position' => '1-1-2-1'], + ], + ], + ], + 'Category 2' => [ + 'position' => '2', + 'Category 2.1' => ['position' => '2-1'], + ], + ], + ], + 'position_of_categories_in_default' => [ + 'moveCategory' => [ + 'name' => 'Category 12', + 'parent_name' => 'Default Category', + 'after_category_name' => 'Movable', + ], + 'expectedMenuTree' => [ + 'Movable' => ['position' => '3'], + 'Category 12' => ['position' => '4'], + 'Movable Position 1' => ['position' => '5'], + 'Movable Position 2' => ['position' => '6'], + 'Movable Position 3' => ['position' => '7'], + ], + ], + 'position_of_categories_in_tree' => [ + 'moveCategory' => [ + 'name' => 'Movable', + 'parent_name' => 'Category 2', + 'after_category_name' => 'Category 2.1', + ], + 'expectedMenuTree' => [ + 'Category 2' => [ + 'position' => '2', + 'Category 2.1' => ['position' => '2-1'], + 'Movable' => ['position' => '2-2'], + 'Category 2.2' => [ + 'position' => '2-3', + 'Category 2.2.1' => ['position' => '2-3-1'], + ], + ], + 'Movable Position 1' => ['position' => '3'], + ], + ], + ]; + } + + /** + * Test the display of category in menu on different websites + * + * @dataProvider multipleWebsitesCategoryDisplayProvider + * @magentoDataFixture Magento/Catalog/_files/category.php + * @magentoDataFixture Magento/Catalog/_files/category_in_second_root_category.php + * @param string $storeCode + * @param string $expectedCategory + * @param string $notExpectedCategory + * @return void + */ + public function testMultipleWebsitesCategoryDisplay( + string $storeCode, + string $expectedCategory, + string $notExpectedCategory + ): void { + $this->storeManager->setCurrentStore($storeCode); + $output = $this->block->getHtml('level-top', 'submenu', 0); + $this->assertContains( + $expectedCategory, + $output, + 'Category "' . $expectedCategory . '" should appear in the menu!' + ); + $this->assertNotContains( + $notExpectedCategory, + $output, + 'Category "' . $notExpectedCategory . '" should not appear in the menu!' + ); + } + + /** + * Provide test data to verify the display of category in menu on different websites. + * + * @return array + */ + public function multipleWebsitesCategoryDisplayProvider(): array + { + return [ + 'first_website' => [ + 'storeCode' => 'default', + 'expectedCategory' => '>Category 1<', + 'notExpectedCategory' => '>Root2 Category 1<', + ], + 'second_website' => [ + 'storeCode' => 'test_store_1', + 'expectedCategory' => '>Root2 Category 1<', + 'notExpectedCategory' => '>Category 1<', + ], + ]; + } + + /** + * Update existing categories or create new ones + * + * @param array $categories + * @return void + */ + private function updateCategories(array $categories): void + { + foreach ($categories as $categoryData) { + if (!$categoryData['is_new_category']) { + $category = $this->categoryRepository->get($this->getCategoryIdByName($categoryData['category_name'])); + unset($categoryData['category_name']); + } else { + $categoryData[Category::KEY_PARENT_ID] = $this->getCategoryIdByName($categoryData['parent_name']); + unset($categoryData['parent_name']); + $category = $this->categoryFactory->create(); + } + unset($categoryData['is_new_category']); + $category->addData($categoryData); + $this->categoryRepository->save($category); + } + } + + /** + * Get an array from the menu tree with category identifiers and their position + * + * @param Node $node + * @return array + */ + private function getMenuTree(Node $node): array + { + $nodes = []; + if (!is_null($node->getId())) { + $nodes['position'] = str_replace('nav-', '', $node->getData('position_class')); + } + $childrenNodes = $node->getChildren()->getNodes(); + /** @var Node $childNode */ + foreach ($childrenNodes as $childNode) { + $name = $childNode->getName(); + $nodes[$name] = $this->getMenuTree($childNode); + } + + return $nodes; + } + + /** + * @param string $name + * @return string|null + */ + private function getCategoryIdByName(string $name): ?string + { + $categoryCollectionFactory = $this->objectManager->get(CollectionFactory::class); + /** @var Collection $categoryCollection */ + $categoryCollection = $categoryCollectionFactory->create(); + /** @var $category Category */ + $category = $categoryCollection + ->addAttributeToFilter(CategoryInterface::KEY_NAME, $name) + ->setPageSize(1) + ->getFirstItem(); + + return $category->getId(); + } } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/categories_no_products_with_two_tree.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/categories_no_products_with_two_tree.php new file mode 100644 index 0000000000000..3f9191244e78f --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/categories_no_products_with_two_tree.php @@ -0,0 +1,63 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\Data\CategoryInterface; +use Magento\Catalog\Model\Category; +use Magento\Catalog\Model\CategoryFactory; +use Magento\Catalog\Model\ResourceModel\Category as CategoryResource; +use Magento\Catalog\Model\ResourceModel\Category\Collection; +use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory; + +require __DIR__ . '/categories_no_products.php'; + +$categoryFactory = $objectManager->get(CategoryFactory::class); +$categoryResource = $objectManager->create(CategoryResource::class); +$categoryCollectionFactory = $objectManager->get(CollectionFactory::class); +/** @var Collection $categoryCollection */ +$categoryCollection = $categoryCollectionFactory->create(); + +/** @var $category2 Category */ +$category2 = $categoryCollection + ->addAttributeToFilter(CategoryInterface::KEY_NAME, 'Category 2') + ->setPageSize(1) + ->getFirstItem(); + +/** @var $category21 Category */ +$category21 = $categoryFactory->create(); +$category21->isObjectNew(true); +$category21->setName('Category 2.1') + ->setParentId($category2->getId()) + ->setPath($category2->getPath()) + ->setAvailableSortBy('name') + ->setDefaultSortBy('name') + ->setIsActive(true) + ->setPosition(1); +$categoryResource->save($category21); + +/** @var $category22 Category */ +$category22 = $categoryFactory->create(); +$category22->isObjectNew(true); +$category22->setName('Category 2.2') + ->setParentId($category2->getId()) + ->setPath($category2->getPath()) + ->setAvailableSortBy('name') + ->setDefaultSortBy('name') + ->setIsActive(true) + ->setPosition(2); +$categoryResource->save($category22); + +/** @var $category221 Category */ +$category221 = $categoryFactory->create(); +$category221->isObjectNew(true); +$category221->setName('Category 2.2.1') + ->setParentId($category22->getId()) + ->setPath($category22->getPath()) + ->setAvailableSortBy('name') + ->setDefaultSortBy('name') + ->setIsActive(true) + ->setPosition(1); +$categoryResource->save($category221); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/categories_no_products_with_two_tree_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/categories_no_products_with_two_tree_rollback.php new file mode 100644 index 0000000000000..f7fcb3a5b4928 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/categories_no_products_with_two_tree_rollback.php @@ -0,0 +1,8 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +require __DIR__ . '/categories_no_products_rollback.php'; diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/category_in_second_root_category.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/category_in_second_root_category.php new file mode 100644 index 0000000000000..aa9c970b7b426 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/category_in_second_root_category.php @@ -0,0 +1,21 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Model\Category; + +require __DIR__ . '/../../Store/_files/store_with_second_root_category.php'; + +/** @var Category $category */ +$category = $categoryFactory->create(); +$category->isObjectNew(true); +$category->setName('Root2 Category 1') + ->setParentId($rootCategory->getId()) + ->setAvailableSortBy(['position', 'name']) + ->setDefaultSortBy('name') + ->setIsActive(true) + ->setPosition(1); +$categoryRepository->save($category); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/category_in_second_root_category_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/category_in_second_root_category_rollback.php new file mode 100644 index 0000000000000..9c74b2fad7edd --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/category_in_second_root_category_rollback.php @@ -0,0 +1,8 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +require __DIR__ . '/../../Store/_files/store_with_second_root_category_rollback.php'; diff --git a/dev/tests/integration/testsuite/Magento/Store/_files/store_with_second_root_category.php b/dev/tests/integration/testsuite/Magento/Store/_files/store_with_second_root_category.php new file mode 100644 index 0000000000000..e43346ece194b --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Store/_files/store_with_second_root_category.php @@ -0,0 +1,72 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +require __DIR__ . '/website.php'; + +use Magento\Catalog\Api\CategoryRepositoryInterface; +use Magento\Catalog\Api\Data\CategoryInterface; +use Magento\Catalog\Model\Category; +use Magento\Catalog\Model\CategoryFactory; +use Magento\Catalog\Model\ResourceModel\Category\Collection; +use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory; +use Magento\Store\Model\Group; +use Magento\Store\Model\GroupFactory; +use Magento\Store\Model\ResourceModel\Group as GroupResource; +use Magento\Store\Model\ResourceModel\Store as StoreResource; +use Magento\Store\Model\Store; +use Magento\Store\Model\StoreFactory; +use Magento\Store\Model\StoreManagerInterface; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +$categoryCollectionFactory = $objectManager->get(CollectionFactory::class); + +/** @var Collection $categoryCollection */ +$categoryCollection = $categoryCollectionFactory->create(); +$rootCategory = $categoryCollection + ->addAttributeToFilter(CategoryInterface::KEY_NAME, 'Second Root Category') + ->setPageSize(1) + ->getFirstItem(); + +$categoryFactory = $objectManager->get(CategoryFactory::class); +$categoryRepository = $objectManager->create(CategoryRepositoryInterface::class); + +/** @var Category $rootCategory */ +$rootCategory = $categoryFactory->create(); +$rootCategory->isObjectNew(true); +$rootCategory->setName('Second Root Category') + ->setParentId(Category::TREE_ROOT_ID) + ->setIsActive(true) + ->setPosition(2); +$rootCategory = $categoryRepository->save($rootCategory); + +$groupFactory = $objectManager->get(GroupFactory::class); +/** @var GroupResource $groupResource */ +$groupResource = $objectManager->create(GroupResource::class); +/** @var Group $storeGroup */ +$storeGroup = $groupFactory->create(); +$storeGroup->setCode('test_store_group_1') + ->setName('Test Store Group 1') + ->setRootCategoryId($rootCategory->getId()) + ->setWebsite($website); +$groupResource->save($storeGroup); + +$storeFactory = $objectManager->get(StoreFactory::class); +/** @var StoreResource $storeResource */ +$storeResource = $objectManager->create(StoreResource::class); +/** @var Store $store */ +$store = $storeFactory->create(); +$store->setCode('test_store_1') + ->setName('Test Store 1') + ->setWebsiteId($website->getId()) + ->setGroup($storeGroup) + ->setSortOrder(10) + ->setIsActive(1); +$storeResource->save($store); + +/* Refresh stores memory cache */ +$objectManager->get(StoreManagerInterface::class)->reinitStores(); diff --git a/dev/tests/integration/testsuite/Magento/Store/_files/store_with_second_root_category_rollback.php b/dev/tests/integration/testsuite/Magento/Store/_files/store_with_second_root_category_rollback.php new file mode 100644 index 0000000000000..eae8b8f64d3e9 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Store/_files/store_with_second_root_category_rollback.php @@ -0,0 +1,39 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +require __DIR__ . '/website_rollback.php'; + +use Magento\Catalog\Api\CategoryRepositoryInterface; +use Magento\Catalog\Api\Data\CategoryInterface; +use Magento\Catalog\Model\CategoryRepository; +use Magento\Catalog\Model\ResourceModel\Category\Collection; +use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory; +use Magento\Framework\Registry; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var CategoryRepository $categoryRepository */ +$categoryRepository = $objectManager->create(CategoryRepositoryInterface::class); +$categoryCollectionFactory = $objectManager->get(CollectionFactory::class); + +/** @var Registry $registry */ +$registry = $objectManager->get(Registry::class); +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); + +/** @var Collection $categoryCollection */ +$categoryCollection = $categoryCollectionFactory->create(); +$category = $categoryCollection + ->addAttributeToFilter(CategoryInterface::KEY_NAME, 'Second Root Category') + ->setPageSize(1) + ->getFirstItem(); +if ($category->getId()) { + $categoryRepository->delete($category); +} + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); From 1e915d4bc3600f8049cadc6746f1b4cfcf930f29 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Tue, 17 Dec 2019 10:12:25 +0200 Subject: [PATCH 0457/1143] Cover changes with unit test --- .../Test/Unit/Model/MethodListTest.php | 34 ++++++++++++++----- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Payment/Test/Unit/Model/MethodListTest.php b/app/code/Magento/Payment/Test/Unit/Model/MethodListTest.php index 3f4af635974e8..ee42b2bd03507 100644 --- a/app/code/Magento/Payment/Test/Unit/Model/MethodListTest.php +++ b/app/code/Magento/Payment/Test/Unit/Model/MethodListTest.php @@ -6,8 +6,8 @@ namespace Magento\Payment\Test\Unit\Model; -use Magento\Payment\Model\MethodList; use Magento\Payment\Model\Method\AbstractMethod; +use Magento\Payment\Model\MethodList; class MethodListTest extends \PHPUnit\Framework\TestCase { @@ -36,6 +36,11 @@ class MethodListTest extends \PHPUnit\Framework\TestCase */ protected $specificationFactoryMock; + /** + * @var array $additionalChecks + */ + private $additionalChecks; + protected function setUp() { $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); @@ -49,10 +54,14 @@ protected function setUp() )->disableOriginalConstructor()->getMock(); $this->specificationFactoryMock = $this->createMock(\Magento\Payment\Model\Checks\SpecificationFactory::class); + + $this->additionalChecks = ['acme_custom_payment_method_check' => 'acme_custom_payment_method_check']; + $this->methodList = $this->objectManager->getObject( \Magento\Payment\Model\MethodList::class, [ - 'specificationFactory' => $this->specificationFactoryMock + 'specificationFactory' => $this->specificationFactoryMock, + 'additionalChecks' => $this->additionalChecks ] ); @@ -68,6 +77,9 @@ protected function setUp() ); } + /** + * Verify available payment methods + */ public function testGetAvailableMethods() { $storeId = 1; @@ -90,13 +102,17 @@ public function testGetAvailableMethods() $this->specificationFactoryMock->expects($this->atLeastOnce()) ->method('create') - ->with([ - AbstractMethod::CHECK_USE_CHECKOUT, - AbstractMethod::CHECK_USE_FOR_COUNTRY, - AbstractMethod::CHECK_USE_FOR_CURRENCY, - AbstractMethod::CHECK_ORDER_TOTAL_MIN_MAX - ]) - ->will($this->returnValue($compositeMock)); + ->with( + array_merge( + [ + AbstractMethod::CHECK_USE_CHECKOUT, + AbstractMethod::CHECK_USE_FOR_COUNTRY, + AbstractMethod::CHECK_USE_FOR_CURRENCY, + AbstractMethod::CHECK_ORDER_TOTAL_MIN_MAX + ], + $this->additionalChecks + ) + )->will($this->returnValue($compositeMock)); $methodMock = $this->getMockForAbstractClass(\Magento\Payment\Api\Data\PaymentMethodInterface::class); $this->paymentMethodList->expects($this->once()) From dd7479d20dd1afbfaa470c9012c0dea61be00fff Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Tue, 17 Dec 2019 17:11:21 +0700 Subject: [PATCH 0458/1143] [Search] Cover SynonymActions Column by Unit Test --- .../Listing/Column/SynonymActionsTest.php | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 app/code/Magento/Search/Test/Unit/Ui/Component/Listing/Column/SynonymActionsTest.php diff --git a/app/code/Magento/Search/Test/Unit/Ui/Component/Listing/Column/SynonymActionsTest.php b/app/code/Magento/Search/Test/Unit/Ui/Component/Listing/Column/SynonymActionsTest.php new file mode 100644 index 0000000000000..7ba1eab0437f0 --- /dev/null +++ b/app/code/Magento/Search/Test/Unit/Ui/Component/Listing/Column/SynonymActionsTest.php @@ -0,0 +1,122 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\Search\Test\Unit\Ui\Component\Listing\Column; + +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Framework\UrlInterface; +use Magento\Search\Ui\Component\Listing\Column\SynonymActions; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +class SynonymActionsTest extends TestCase +{ + /** + * @var SynonymActions + */ + private $synonymActions; + + /** + * @var UrlInterface|MockObject + */ + private $urlBuilderMock; + + /** + * Setup environment to test + */ + protected function setup() + { + $this->urlBuilderMock = $this->createMock(UrlInterface::class); + + $objectManager = new ObjectManager($this); + + $this->synonymActions = $objectManager->getObject( + SynonymActions::class, + [ + 'urlBuilder' => $this->urlBuilderMock, + 'data' => [ + 'name' => 'actions' + ] + ] + ); + } + + /** + * Test prepareDataSource() with data source has no item + */ + public function testPrepareDataSourceWithNoItem() + { + $dataSource = [ + 'data' => [] + ]; + $expected = [ + 'data' => [] + ]; + /** + * Assert Result + */ + $this->assertEquals($expected, $this->synonymActions->prepareDataSource($dataSource)); + } + + /** + * Test prepareDataSource() with data source has items + */ + public function testPrepareDataSourceWithItems() + { + $dataSource = [ + 'data' => [ + 'items' => [ + [ + 'group_id' => 1 + ] + ] + ] + ]; + $expected = [ + 'data' => [ + 'items' => [ + [ + 'group_id' => 1, + 'actions' => [ + 'delete' => [ + 'href' => 'http://localhost/magento2/admin/search/synonyms/delete/group_id/1', + 'label' => (string)__('Delete'), + 'confirm' => [ + 'title' => (string)__('Delete'), + 'message' => (string)__( + 'Are you sure you want to delete synonym group with id: %1?', + 1 + ) + ], + '__disableTmpl' => true + ], + 'edit' => [ + 'href' => 'http://localhost/magento2/admin/search/synonyms/edit/group_id/1', + 'label' => (string)__('View/Edit'), + '__disableTmpl' => true + ] + ] + ] + ] + ] + ]; + + $this->urlBuilderMock->expects($this->at(0))->method('getUrl') + ->with(SynonymActions::SYNONYM_URL_PATH_DELETE, ['group_id' => 1]) + ->willReturn('http://localhost/magento2/admin/search/synonyms/delete/group_id/1'); + + $this->urlBuilderMock->expects($this->at(1))->method('getUrl') + ->with(SynonymActions::SYNONYM_URL_PATH_EDIT, ['group_id' => 1]) + ->willReturn('http://localhost/magento2/admin/search/synonyms/edit/group_id/1'); + + /** + * Assert Result + */ + $this->assertEquals($expected, $this->synonymActions->prepareDataSource($dataSource)); + } +} From b0d2f6535389c43e17d71380febd55bd12567887 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Tue, 17 Dec 2019 14:33:41 +0200 Subject: [PATCH 0459/1143] Cover changes with jasmine test --- .../base/js/lib/ko/bind/color-picker.test.js | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/ko/bind/color-picker.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/ko/bind/color-picker.test.js index 9b756a2f2a49a..afbd7e8e94c2d 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/ko/bind/color-picker.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/ko/bind/color-picker.test.js @@ -85,5 +85,28 @@ define([ expect($.fn.init).toHaveBeenCalledWith($input, undefined); }); + + it('Verify config value is empty when reset colorpicker intput', function () { + var value = { + configStuffInHere: true, + value: jasmine.createSpy().and.returnValue(undefined) + }, + valueAccessor = jasmine.createSpy().and.returnValue(value), + viewModel = { + disabled: jasmine.createSpy().and.returnValue(false) + }; + + $.fn.spectrum = jasmine.createSpy(); + $input = jasmine.createSpy(); + + ko.bindingHandlers.colorPicker.update($input, valueAccessor, null, viewModel); + expect($.fn.spectrum).toHaveBeenCalledTimes(1); + expect(valueAccessor().value).toHaveBeenCalledTimes(4); + + value.value = jasmine.createSpy().and.returnValue(''); + ko.bindingHandlers.colorPicker.update($input, valueAccessor, null, viewModel); + expect($.fn.spectrum).toHaveBeenCalledTimes(3); + expect(valueAccessor().value).toHaveBeenCalledTimes(5); + }); }); }); From 1c3ee947270eb0465aef2710f3c216795747bbaf Mon Sep 17 00:00:00 2001 From: Mastiuhin Olexandr <mastiuhin.olexandr@transoftgroup.com> Date: Tue, 17 Dec 2019 14:44:30 +0200 Subject: [PATCH 0460/1143] MC-29523: Category image saves to pub/media/catalog/tmp/category --- .../Category/Attribute/Backend/Image.php | 68 +++++----- .../Magento/Catalog/Model/ImageUploader.php | 6 +- .../Category/Attribute/Backend/ImageTest.php | 120 +++++++++++++++--- app/code/Magento/Catalog/etc/di.xml | 5 + 4 files changed, 142 insertions(+), 57 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Image.php b/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Image.php index 4880214e5c6a6..865160da14a6f 100644 --- a/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Image.php +++ b/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Image.php @@ -5,8 +5,12 @@ */ namespace Magento\Catalog\Model\Category\Attribute\Backend; +use Magento\Catalog\Model\ImageUploader; use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\App\ObjectManager; use Magento\Framework\File\Uploader; +use Magento\Store\Api\Data\StoreInterface; +use Magento\Store\Model\StoreManagerInterface; /** * Catalog category image attribute backend model @@ -45,7 +49,7 @@ class Image extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend protected $_logger; /** - * @var \Magento\Catalog\Model\ImageUploader + * @var ImageUploader */ private $imageUploader; @@ -54,19 +58,32 @@ class Image extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend */ private $additionalData = '_additional_data_'; + /** + * @var StoreManagerInterface + */ + private $storeManager; + /** * @param \Psr\Log\LoggerInterface $logger * @param \Magento\Framework\Filesystem $filesystem * @param \Magento\MediaStorage\Model\File\UploaderFactory $fileUploaderFactory + * @param StoreManagerInterface $storeManager + * @param ImageUploader $imageUploader */ public function __construct( \Psr\Log\LoggerInterface $logger, \Magento\Framework\Filesystem $filesystem, - \Magento\MediaStorage\Model\File\UploaderFactory $fileUploaderFactory + \Magento\MediaStorage\Model\File\UploaderFactory $fileUploaderFactory, + StoreManagerInterface $storeManager = null, + ImageUploader $imageUploader = null ) { $this->_filesystem = $filesystem; $this->_fileUploaderFactory = $fileUploaderFactory; $this->_logger = $logger; + $this->storeManager = $storeManager ?? + ObjectManager::getInstance()->get(StoreManagerInterface::class); + $this->imageUploader = $imageUploader ?? + ObjectManager::getInstance()->get(ImageUploader::class); } /** @@ -94,13 +111,13 @@ private function getUploadedImageName($value) */ private function checkUniqueImageName(string $imageName): string { - $imageUploader = $this->getImageUploader(); $mediaDirectory = $this->_filesystem->getDirectoryWrite(DirectoryList::MEDIA); $imageAbsolutePath = $mediaDirectory->getAbsolutePath( - $imageUploader->getBasePath() . DIRECTORY_SEPARATOR . $imageName + $this->imageUploader->getBasePath() . DIRECTORY_SEPARATOR . $imageName ); - $imageName = Uploader::getNewFilename($imageAbsolutePath); + // phpcs:ignore Magento2.Functions.DiscouragedFunction + $imageName = call_user_func([Uploader::class, 'getNewFilename'], $imageAbsolutePath); return $imageName; } @@ -119,7 +136,18 @@ public function beforeSave($object) $attributeName = $this->getAttribute()->getName(); $value = $object->getData($attributeName); - if ($this->fileResidesOutsideCategoryDir($value)) { + if ($this->isTmpFileAvailable($value) && $imageName = $this->getUploadedImageName($value)) { + try { + /** @var StoreInterface $store */ + $store = $this->storeManager->getStore(); + $baseMediaDir = $store->getBaseMediaDir(); + $newImgRelativePath = $this->imageUploader->moveFileFromTmp($imageName, true); + $value[0]['url'] = '/' . $baseMediaDir . '/' . $newImgRelativePath; + $value[0]['name'] = $value[0]['url']; + } catch (\Exception $e) { + $this->_logger->critical($e); + } + } elseif ($this->fileResidesOutsideCategoryDir($value)) { // use relative path for image attribute so we know it's outside of category dir when we fetch it // phpcs:ignore Magento2.Functions.DiscouragedFunction $value[0]['url'] = parse_url($value[0]['url'], PHP_URL_PATH); @@ -139,23 +167,6 @@ public function beforeSave($object) return parent::beforeSave($object); } - /** - * Get Instance of Category Image Uploader. - * - * @return \Magento\Catalog\Model\ImageUploader - * - * @deprecated 101.0.0 - */ - private function getImageUploader() - { - if ($this->imageUploader === null) { - $this->imageUploader = \Magento\Framework\App\ObjectManager::getInstance() - ->get(\Magento\Catalog\CategoryImageUpload::class); - } - - return $this->imageUploader; - } - /** * Check if temporary file is available for new image upload. * @@ -194,19 +205,10 @@ private function fileResidesOutsideCategoryDir($value) * * @param \Magento\Framework\DataObject $object * @return \Magento\Catalog\Model\Category\Attribute\Backend\Image + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function afterSave($object) { - $value = $object->getData($this->additionalData . $this->getAttribute()->getName()); - - if ($this->isTmpFileAvailable($value) && $imageName = $this->getUploadedImageName($value)) { - try { - $this->getImageUploader()->moveFileFromTmp($imageName); - } catch (\Exception $e) { - $this->_logger->critical($e); - } - } - return $this; } } diff --git a/app/code/Magento/Catalog/Model/ImageUploader.php b/app/code/Magento/Catalog/Model/ImageUploader.php index 825823276261f..0c3e008fa8bb5 100644 --- a/app/code/Magento/Catalog/Model/ImageUploader.php +++ b/app/code/Magento/Catalog/Model/ImageUploader.php @@ -191,12 +191,12 @@ public function getFilePath($path, $imageName) * Checking file for moving and move it * * @param string $imageName - * + * @param bool $returnRelativePath * @return string * * @throws \Magento\Framework\Exception\LocalizedException */ - public function moveFileFromTmp($imageName) + public function moveFileFromTmp($imageName, $returnRelativePath = false) { $baseTmpPath = $this->getBaseTmpPath(); $basePath = $this->getBasePath(); @@ -226,7 +226,7 @@ public function moveFileFromTmp($imageName) ); } - return $imageName; + return $returnRelativePath ? $baseImagePath : $imageName; } /** diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Category/Attribute/Backend/ImageTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Category/Attribute/Backend/ImageTest.php index a76ae5244076f..f8a89f9d9fd90 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Category/Attribute/Backend/ImageTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Category/Attribute/Backend/ImageTest.php @@ -3,10 +3,14 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Test\Unit\Model\Category\Attribute\Backend; use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\Exception\FileSystemException; use Magento\Framework\Filesystem\Directory\WriteInterface; +use Magento\Store\Model\Store; +use Magento\Store\Model\StoreManagerInterface; /** * Test for Magento\Catalog\Model\Category\Attribute\Backend\Image class. @@ -39,6 +43,16 @@ class ImageTest extends \PHPUnit\Framework\TestCase */ private $filesystem; + /** + * @var StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject; + */ + private $storeManagerInterfaceMock; + + /** + * @var Store|\PHPUnit_Framework_MockObject_MockObject + */ + private $storeMock; + /** * @inheritdoc */ @@ -56,10 +70,6 @@ protected function setUp() ['getName'] ); - $this->attribute->expects($this->once()) - ->method('getName') - ->will($this->returnValue('test_attribute')); - $this->logger = $this->getMockForAbstractClass( \Psr\Log\LoggerInterface::class, [], @@ -75,6 +85,14 @@ protected function setUp() ['moveFileFromTmp', 'getBasePath'] ); + $this->storeManagerInterfaceMock = $this->getMockBuilder( + StoreManagerInterface::class + )->disableOriginalConstructor()->getMock(); + + $this->storeMock = $this->getMockBuilder( + Store::class + )->disableOriginalConstructor()->getMock(); + $this->filesystem = $this->getMockBuilder(\Magento\Framework\Filesystem::class)->disableOriginalConstructor() ->getMock(); } @@ -97,6 +115,10 @@ public function deletedValueDataProvider() */ public function testBeforeSaveValueDeletion($value) { + $this->attribute->expects($this->once()) + ->method('getName') + ->will($this->returnValue('test_attribute')); + $model = $this->objectManager->getObject(\Magento\Catalog\Model\Category\Attribute\Backend\Image::class); $model->setAttribute($this->attribute); @@ -132,6 +154,10 @@ public function invalidValueDataProvider() */ public function testBeforeSaveValueInvalid($value) { + $this->attribute->expects($this->once()) + ->method('getName') + ->will($this->returnValue('test_attribute')); + $model = $this->objectManager->getObject(\Magento\Catalog\Model\Category\Attribute\Backend\Image::class); $model->setAttribute($this->attribute); @@ -147,7 +173,11 @@ public function testBeforeSaveValueInvalid($value) */ public function testBeforeSaveAttributeFileName() { - $model = $this->setUpModelForAfterSave(); + $this->attribute->expects($this->once()) + ->method('getName') + ->will($this->returnValue('test_attribute')); + + $model = $this->setUpModelForTests(); $mediaDirectoryMock = $this->createMock(WriteInterface::class); $this->filesystem->expects($this->once()) ->method('getDirectoryWrite') @@ -177,7 +207,11 @@ public function testBeforeSaveAttributeFileName() */ public function testBeforeSaveAttributeFileNameOutsideOfCategoryDir() { - $model = $this->setUpModelForAfterSave(); + $this->attribute->expects($this->once()) + ->method('getName') + ->will($this->returnValue('test_attribute')); + + $model = $this->setUpModelForTests(); $model->setAttribute($this->attribute); $imagePath = '/pub/media/wysiwyg/test123.jpg'; $this->filesystem @@ -211,7 +245,19 @@ public function testBeforeSaveAttributeFileNameOutsideOfCategoryDir() */ public function testBeforeSaveTemporaryAttribute() { - $model = $this->setUpModelForAfterSave(); + $this->attribute->expects($this->once()) + ->method('getName') + ->will($this->returnValue('test_attribute')); + + $this->storeManagerInterfaceMock->expects($this->once()) + ->method('getStore') + ->willReturn($this->storeMock); + + $this->storeMock->expects($this->once()) + ->method('getBaseMediaDir') + ->willReturn('pub/media'); + + $model = $this->setUpModelForTests(); $model->setAttribute($this->attribute); $mediaDirectoryMock = $this->createMock(WriteInterface::class); @@ -220,10 +266,16 @@ public function testBeforeSaveTemporaryAttribute() ->with(DirectoryList::MEDIA) ->willReturn($mediaDirectoryMock); + $this->imageUploader->expects($this->any())->method('moveFileFromTmp')->willReturn('test123.jpg'); + $object = new \Magento\Framework\DataObject( [ 'test_attribute' => [ - ['name' => 'test123.jpg', 'tmp_name' => 'abc123', 'url' => 'http://www.example.com/test123.jpg'], + [ + 'name' => 'test123.jpg', + 'tmp_name' => 'abc123', + 'url' => 'http://www.example.com/pub/media/temp/test123.jpg' + ], ], ] ); @@ -232,7 +284,7 @@ public function testBeforeSaveTemporaryAttribute() $this->assertEquals( [ - ['name' => 'test123.jpg', 'tmp_name' => 'abc123', 'url' => 'http://www.example.com/test123.jpg'], + ['name' => '/pub/media/test123.jpg', 'tmp_name' => 'abc123', 'url' => '/pub/media/test123.jpg'], ], $object->getData('_additional_data_test_attribute') ); @@ -257,7 +309,7 @@ public function testBeforeSaveAttributeStringValue() /** * @return \Magento\Catalog\Model\Category\Attribute\Backend\Image */ - private function setUpModelForAfterSave() + private function setUpModelForTests() { $objectManagerMock = $this->createPartialMock(\Magento\Framework\App\ObjectManager::class, ['get']); @@ -268,7 +320,7 @@ private function setUpModelForAfterSave() ->will( $this->returnCallback( function ($class, $params = []) use ($imageUploaderMock) { - if ($class == \Magento\Catalog\CategoryImageUpload::class) { + if ($class == "\Magento\Catalog\CategoryImageUpload") { return $imageUploaderMock; } @@ -283,6 +335,7 @@ function ($class, $params = []) use ($imageUploaderMock) { 'objectManager' => $objectManagerMock, 'logger' => $this->logger, 'filesystem' => $this->filesystem, + 'storeManager' => $this->storeManagerInterfaceMock ] ); $this->objectManager->setBackwardCompatibleProperty($model, 'imageUploader', $this->imageUploader); @@ -307,12 +360,13 @@ public function attributeValueDataProvider() * @dataProvider attributeValueDataProvider * * @param array $value + * @throws FileSystemException */ - public function testAfterSaveWithAdditionalData($value) + public function testBeforeSaveWithAdditionalData($value) { - $model = $this->setUpModelForAfterSave(); + $model = $this->setUpModelForTests(); - $this->imageUploader->expects($this->once()) + $this->imageUploader->expects($this->never()) ->method('moveFileFromTmp') ->with($this->equalTo('test1234.jpg')); @@ -323,17 +377,18 @@ public function testAfterSaveWithAdditionalData($value) ] ); - $model->afterSave($object); + $model->beforeSave($object); } /** * @dataProvider attributeValueDataProvider * * @param array $value + * @throws FileSystemException */ - public function testAfterSaveWithoutAdditionalData($value) + public function testBeforeSaveWithoutAdditionalData($value) { - $model = $this->setUpModelForAfterSave(); + $model = $this->setUpModelForTests(); $this->imageUploader->expects($this->never()) ->method('moveFileFromTmp'); @@ -344,15 +399,38 @@ public function testAfterSaveWithoutAdditionalData($value) ] ); - $model->afterSave($object); + $model->beforeSave($object); } /** * Test afterSaveWithExceptions. */ - public function testAfterSaveWithExceptions() + public function testBeforeSaveWithExceptions() { - $model = $this->setUpModelForAfterSave(); + $model = $this->setUpModelForTests(); + + $this->storeManagerInterfaceMock->expects($this->once()) + ->method('getStore') + ->willReturn($this->storeMock); + + $this->storeMock->expects($this->once()) + ->method('getBaseMediaDir') + ->willReturn('pub/media'); + + $this->attribute->expects($this->once()) + ->method('getName') + ->will($this->returnValue('_additional_data_test_attribute')); + + $mediaDirectoryMock = $this->createMock(WriteInterface::class); + $this->filesystem->expects($this->any()) + ->method('getDirectoryWrite') + ->with(DirectoryList::MEDIA) + ->willReturn($mediaDirectoryMock); + $this->imageUploader->expects($this->any())->method('getBasePath')->willReturn('base/path'); + $mediaDirectoryMock->expects($this->any()) + ->method('getAbsolutePath') + ->with('base/path/test1234.jpg') + ->willReturn('absolute/path/base/path/test1234.jpg'); $exception = new \Exception(); @@ -370,6 +448,6 @@ public function testAfterSaveWithExceptions() ] ); - $model->afterSave($object); + $model->beforeSave($object); } } diff --git a/app/code/Magento/Catalog/etc/di.xml b/app/code/Magento/Catalog/etc/di.xml index af7b9af2d8b7e..eda6dbd2d9d6f 100644 --- a/app/code/Magento/Catalog/etc/di.xml +++ b/app/code/Magento/Catalog/etc/di.xml @@ -238,6 +238,11 @@ <argument name="imageUploader" xsi:type="object">Magento\Catalog\CategoryImageUpload</argument> </arguments> </type> + <type name="Magento\Catalog\Model\Category\Attribute\Backend\Image"> + <arguments> + <argument name="imageUploader" xsi:type="object">Magento\Catalog\CategoryImageUpload</argument> + </arguments> + </type> <type name="Magento\Catalog\Model\Session"> <arguments> <argument name="storage" xsi:type="object">Magento\Catalog\Model\Session\Storage</argument> From d6ffc1ee760748a926c521b177668ff5d36dc9f6 Mon Sep 17 00:00:00 2001 From: Yurii Sapiha <yurasapiga93@gmail.com> Date: Tue, 17 Dec 2019 15:17:32 +0200 Subject: [PATCH 0461/1143] MC-25243: Storefront: Simple product with custom attribute per multiple websites/storeviews, countries/states --- .../View/Attribute/AbstractAttributeTest.php | 233 ++++++++++++++++ .../View/Attribute/DateAttributeTest.php | 64 +++++ .../View/Attribute/DropdownAttributeTest.php | 95 +++++++ .../Attribute/MultiSelectAttributeTest.php | 103 +++++++ .../View/Attribute/PriceAttributeTest.php | 74 +++++ .../View/Attribute/TextAreaAttributeTest.php | 60 +++++ .../View/Attribute/TextAttributeTest.php | 95 +++++++ .../View/Attribute/YesNoAttributeTest.php | 50 ++++ .../_files/dropdown_attribute_with_html.php | 69 +++++ .../dropdown_attribute_with_html_rollback.php | 27 ++ .../multiselect_attribute_with_html.php | 68 +++++ ...ltiselect_attribute_with_html_rollback.php | 27 ++ .../Attribute/TextSwatchAttributeTest.php | 63 +++++ .../Attribute/VisualSwatchAttributeTest.php | 63 +++++ .../FixedProductTaxAttributeTest.php | 252 ++++++++++++++++++ .../Form/Modifier/Eav/FixedAttributeTest.php | 2 +- .../Weee/_files/fixed_product_attribute.php | 2 + 17 files changed, 1346 insertions(+), 1 deletion(-) create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/AbstractAttributeTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/DateAttributeTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/DropdownAttributeTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/MultiSelectAttributeTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/PriceAttributeTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/TextAreaAttributeTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/TextAttributeTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/YesNoAttributeTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/dropdown_attribute_with_html.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/dropdown_attribute_with_html_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/multiselect_attribute_with_html.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/multiselect_attribute_with_html_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/Swatches/Block/Product/View/Attribute/TextSwatchAttributeTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Swatches/Block/Product/View/Attribute/VisualSwatchAttributeTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Weee/Block/Product/View/Attribute/FixedProductTaxAttributeTest.php diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/AbstractAttributeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/AbstractAttributeTest.php new file mode 100644 index 0000000000000..399abea6a0760 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/AbstractAttributeTest.php @@ -0,0 +1,233 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Block\Product\View\Attribute; + +use Magento\Catalog\Api\Data\ProductAttributeInterface; +use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Block\Product\View\Attributes; +use Magento\Catalog\Helper\Output; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Registry; +use Magento\Framework\View\LayoutInterface; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; + +/** + * Class consist of base logic for custom attributes view tests + */ +abstract class AbstractAttributeTest extends TestCase +{ + /** @var ObjectManagerInterface */ + protected $objectManager; + + /** @var LayoutInterface */ + private $layout; + + /** @var ProductRepositoryInterface */ + private $productRepository; + + /** @var ProductAttributeRepositoryInterface */ + private $attributeRepository; + + /** @var Registry */ + private $registry; + + /** @var Attributes */ + private $block; + + /** @var ProductAttributeInterface */ + private $attribute; + + /** @var Output */ + private $outputHelper; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + + $this->objectManager = Bootstrap::getObjectManager(); + $this->layout = $this->objectManager->get(LayoutInterface::class); + $this->productRepository = $this->objectManager->create(ProductRepositoryInterface::class); + $this->attributeRepository = $this->objectManager->create(ProductAttributeRepositoryInterface::class); + $this->registry = $this->objectManager->get(Registry::class); + $this->block = $this->layout->createBlock(Attributes::class); + $this->outputHelper = $this->objectManager->create(Output::class); + } + + /** + * Process custom attribute view + * + * @param string $sku + * @param string $attributeValue + * @param string $expectedAttributeValue + * @return void + */ + protected function processAttributeView( + string $sku, + string $attributeValue, + string $expectedAttributeValue + ): void { + $this->updateAttribute(['is_visible_on_front' => true]); + $product = $this->updateProduct($sku, $attributeValue); + $this->registerProduct($product); + $data = $this->block->getAdditionalData(); + $this->assertEquals($this->prepareExpectedData($expectedAttributeValue), $data); + } + + /** + * Process custom attribute with default value view when new value set + * + * @param string $sku + * @param string $attributeValue + * @param string $expectedAttributeValue + * @return void + */ + protected function processNonDefaultAttributeValueView( + string $sku, + string $attributeValue, + string $expectedAttributeValue + ): void { + $this->updateAttribute(['is_visible_on_front' => true, 'default_value' => $this->getDefaultAttributeValue()]); + $product = $this->updateProduct($sku, $attributeValue); + $this->registerProduct($product); + $data = $this->block->getAdditionalData(); + $this->assertEquals($this->prepareExpectedData($expectedAttributeValue), $data); + } + + /** + * Procces custom attribute view with default value + * + * @param string $sku + * @param string $expectedAttributeValue + * @return void + */ + protected function processDefaultValueAttributeView(string $sku, string $expectedAttributeValue): void + { + $this->updateAttribute(['is_visible_on_front' => true, 'default_value' => $this->getDefaultAttributeValue()]); + $product = $this->productRepository->save($this->productRepository->get($sku)); + $this->registerProduct($product); + $data = $this->block->getAdditionalData(); + $this->assertEquals($this->prepareExpectedData($expectedAttributeValue), $data); + } + + /** + * Procces attribute value view with html tags + * + * @param string $sku + * @param bool $allowHtmlTags + * @param string $attributeValue + * @param string $expectedAttributeValue + * @return void + */ + protected function processAttributeHtmlOutput( + string $sku, + bool $allowHtmlTags, + string $attributeValue, + string $expectedAttributeValue + ): void { + $this->updateAttribute(['is_visible_on_front' => true, 'is_html_allowed_on_front' => $allowHtmlTags]); + $product = $this->updateProduct($sku, $attributeValue); + $this->registerProduct($product); + $data = $this->block->getAdditionalData(); + $dataItem = $data[$this->getAttributeCode()] ?? null; + $this->assertNotNull($dataItem); + $output = $this->outputHelper->productAttribute($product, $dataItem['value'], $dataItem['code']); + $this->assertEquals($expectedAttributeValue, $output); + } + + /** + * Get attribute + * + * @return ProductAttributeInterface + */ + protected function getAttribute(): ProductAttributeInterface + { + if ($this->attribute === null) { + $this->attribute = $this->attributeRepository->get($this->getAttributeCode()); + } + + return $this->attribute; + } + + /** + * Prepare expected data + * + * @param string $expectedValue + * @return array + */ + private function prepareExpectedData(string $expectedValue): array + { + return [ + $this->getAttributeCode() => [ + 'label' => $this->getAttribute()->getStoreLabel(), + 'value' => $expectedValue, + 'code' => $this->getAttributeCode(), + ], + ]; + } + + /** + * Update product + * + * @param string $productSku + * @param string $attributeValue + * @return ProductInterface + */ + private function updateProduct(string $productSku, string $attributeValue): ProductInterface + { + $product = $this->productRepository->get($productSku); + $product->addData([$this->getAttributeCode() => $attributeValue]); + + return $this->productRepository->save($product); + } + + /** + * Register product + * + * @param ProductInterface $product + * @return void + */ + private function registerProduct(ProductInterface $product): void + { + $this->registry->unregister('product'); + $this->registry->register('product', $product); + } + + /** + * Update attribute + * + * @param array $data + * @return void + */ + private function updateAttribute(array $data): void + { + $attribute = $this->getAttribute(); + $attribute->addData($data); + + $this->attributeRepository->save($attribute); + } + + /** + * Get attribute code for current test + * + * @return string + */ + abstract protected function getAttributeCode(): string; + + /** + * Get default value for current attribute + * + * @return string + */ + abstract protected function getDefaultAttributeValue(): string; +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/DateAttributeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/DateAttributeTest.php new file mode 100644 index 0000000000000..ec63fdc4806cf --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/DateAttributeTest.php @@ -0,0 +1,64 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Block\Product\View\Attribute; + +/** + * Class checks date attribute displaying on frontend + * + * @magentoDbIsolation disabled + * @magentoDataFixture Magento/Catalog/_files/product_date_attribute.php + * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + */ +class DateAttributeTest extends AbstractAttributeTest +{ + /** + * @magentoConfigFixture default_store general/locale/timezone UTC + * @return void + */ + public function testAttributeView(): void + { + $attributeValue = $this->getAttribute()->getBackend()->formatDate('12/20/19'); + $this->processAttributeView('simple2', $attributeValue, 'Dec 20, 2019'); + } + + /** + * @magentoConfigFixture default_store general/locale/timezone UTC + * @return void + */ + public function testAttributeWithNonDefaultValueView(): void + { + $attributeValue = $this->getAttribute()->getBackend()->formatDate('12/20/19'); + $this->processNonDefaultAttributeValueView('simple2', $attributeValue, 'Dec 20, 2019'); + } + + /** + * @magentoConfigFixture default_store general/locale/timezone UTC + * @return void + */ + public function testAttributeWithDefaultValueView(): void + { + $this->markTestSkipped('Test is blocked by issue MC-28950'); + $this->processDefaultValueAttributeView('simple2', $this->getDefaultAttributeValue()); + } + + /** + * @inheritdoc + */ + protected function getAttributeCode(): string + { + return 'date_attribute'; + } + + /** + * @inheritdoc + */ + protected function getDefaultAttributeValue(): string + { + return $this->getAttribute()->getBackend()->formatDate('11/20/19'); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/DropdownAttributeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/DropdownAttributeTest.php new file mode 100644 index 0000000000000..98799822dcfb0 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/DropdownAttributeTest.php @@ -0,0 +1,95 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Block\Product\View\Attribute; + +/** + * Class checks dropdown attribute displaying on frontend + * + * @magentoDbIsolation enabled + * @magentoAppIsolation enabled + * @magentoDataFixture Magento/Catalog/_files/dropdown_attribute.php + * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + */ +class DropdownAttributeTest extends AbstractAttributeTest +{ + /** @var string */ + private $attributeCode; + + /** + * @return void + */ + public function testAttributeView(): void + { + $attributeValue = $this->getAttribute()->getSource()->getOptionId('Option 2'); + $this->processAttributeView('simple2', $attributeValue, 'Option 2'); + } + + /** + * @return void + */ + public function testAttributeWithNonDefaultValueView(): void + { + $attributeValue = $this->getAttribute()->getSource()->getOptionId('Option 2'); + $this->processNonDefaultAttributeValueView('simple2', $attributeValue, 'Option 2'); + } + + /** + * @dataProvider attributeWithTagsProvider + * @magentoAppArea frontend + * @magentoDataFixture Magento/Catalog/_files/dropdown_attribute_with_html.php + * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + * @param bool $allowHtmlTags + * @param string $attributeValue + * @param string $expectedAttributeValue + * @return void + */ + public function testAttributeWithHtmlTags( + bool $allowHtmlTags, + string $attributeValue, + string $expectedAttributeValue + ): void { + $this->attributeCode = 'dropdown_attribute_with_html'; + $attributeValue = $this->getAttribute()->getSource()->getOptionId($attributeValue); + $this->processAttributeHtmlOutput('simple2', $allowHtmlTags, $attributeValue, $expectedAttributeValue); + } + + /** + * @return array + */ + public function attributeWithTagsProvider(): array + { + return [ + 'allow_html_tags' => [ + 'allow_html_tags' => true, + 'attribute_value' => '<h2>Option 2</h2>', + 'expected_attribute_value' => '<h2>Option 2</h2>', + ], + 'disallow_html_tags' => [ + 'allow_html_tags' => false, + 'attribute_value' => '<h2>Option 2</h2>', + 'expected_attribute_value' => '<h2>Option 2</h2>', + ], + ]; + } + + /** + * @inheritdoc + */ + protected function getAttributeCode(): string + { + return $this->attributeCode ?? 'dropdown_attribute'; + } + + /** + * @inheritdoc + */ + protected function getDefaultAttributeValue(): string + { + return $this->getAttribute()->getSource()->getOptionId('Option 1'); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/MultiSelectAttributeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/MultiSelectAttributeTest.php new file mode 100644 index 0000000000000..758de8f53ba93 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/MultiSelectAttributeTest.php @@ -0,0 +1,103 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Block\Product\View\Attribute; + +/** + * Class checks multi select attribute displaying on frontend + * + * @magentoDbIsolation disabled + * @magentoDataFixture Magento/Catalog/_files/multiselect_attribute.php + * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + */ +class MultiSelectAttributeTest extends AbstractAttributeTest +{ + /** @var string */ + private $attributeCode; + + /** + * @return void + */ + public function testAttributeView(): void + { + $attributeValue = $this->getAttribute()->getSource()->getOptionId('Option 2'); + $this->processAttributeView('simple2', $attributeValue, 'Option 2'); + } + + /** + * @return void + */ + public function testAttributeWithNonDefaultValueView(): void + { + $attributeValue = $this->getAttribute()->getSource()->getOptionId('Option 2'); + $this->processNonDefaultAttributeValueView('simple2', $attributeValue, 'Option 2'); + } + + /** + * @return void + */ + public function testAttributeWithDefaultValueView(): void + { + $this->markTestSkipped('Test is blocked by issue MC-29019'); + $this->processDefaultValueAttributeView('simple2', 'Option 1'); + } + + /** + * @dataProvider attributeWithTagsProvider + * @magentoAppArea frontend + * @magentoDataFixture Magento/Catalog/_files/multiselect_attribute_with_html.php + * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + * @param bool $allowHtmlTags + * @param string $attributeValue + * @param string $expectedAttributeValue + * @return void + */ + public function testAttributeWithHtmlTags( + bool $allowHtmlTags, + string $attributeValue, + string $expectedAttributeValue + ): void { + $this->attributeCode = 'multiselect_attribute_with_html'; + $attributeValue = $this->getAttribute()->getSource()->getOptionId($attributeValue); + $this->processAttributeHtmlOutput('simple2', $allowHtmlTags, $attributeValue, $expectedAttributeValue); + } + + /** + * @return array + */ + public function attributeWithTagsProvider(): array + { + return [ + 'allow_html_tags' => [ + 'allow_html_tags' => true, + 'attribute_value' => '<h2>Option 2</h2>', + 'expected_attribute_value' => '<h2>Option 2</h2>', + ], + 'disallow_html_tags' => [ + 'allow_html_tags' => false, + 'attribute_value' => '<h2>Option 2</h2>', + 'expected_attribute_value' => '<h2>Option 2</h2>', + ], + ]; + } + + /** + * @inheritdoc + */ + protected function getAttributeCode(): string + { + return $this->attributeCode ?? 'multiselect_attribute'; + } + + /** + * @inheritdoc + */ + protected function getDefaultAttributeValue(): string + { + return $this->getAttribute()->getSource()->getOptionId('Option 1'); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/PriceAttributeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/PriceAttributeTest.php new file mode 100644 index 0000000000000..ae3c145294b56 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/PriceAttributeTest.php @@ -0,0 +1,74 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Block\Product\View\Attribute; + +use Magento\Directory\Model\PriceCurrency; + +/** + * Class checks price attribute displaying on frontend + * + * @magentoDbIsolation enabled + * @magentoDataFixture Magento/Catalog/_files/product_decimal_attribute.php + * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + */ +class PriceAttributeTest extends AbstractAttributeTest +{ + /** @var PriceCurrency */ + private $priceCurrency; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + + $this->priceCurrency = $this->objectManager->create(PriceCurrency::class); + } + + /** + * @dataProvider pricesDataProvider + * @param string $price + * @return void + */ + public function testAttributeView(string $price): void + { + $this->processAttributeView('simple2', $price, $this->priceCurrency->convertAndFormat($price)); + } + + /** + * @return array + */ + public function pricesDataProvider(): array + { + return [ + 'zero_price' => [ + 'price' => '0', + ], + 'positive_price' => [ + 'price' => '150', + ], + ]; + } + + /** + * @inheritdoc + */ + protected function getAttributeCode(): string + { + return 'decimal_attribute'; + } + + /** + * @inheritdoc + */ + protected function getDefaultAttributeValue(): string + { + return ''; + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/TextAreaAttributeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/TextAreaAttributeTest.php new file mode 100644 index 0000000000000..45414c8788922 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/TextAreaAttributeTest.php @@ -0,0 +1,60 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Block\Product\View\Attribute; + +/** + * Class checks textarea attribute displaying on frontend + * + * @magentoDbIsolation enabled + * @magentoDataFixture Magento/Catalog/_files/product_text_attribute.php + * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + */ +class TextAreaAttributeTest extends AbstractAttributeTest +{ + /** + * @return void + */ + public function testAttributeView(): void + { + $attributeValue = 'Value for text area attribute'; + $this->processAttributeView('simple2', $attributeValue, $attributeValue); + } + + /** + * @return void + */ + public function testAttributeWithNonDefaultValueView(): void + { + $attributeValue = 'Text area attribute value'; + $this->processNonDefaultAttributeValueView('simple2', $attributeValue, $attributeValue); + } + + /** + * @return void + */ + public function testAttributeWithDefaultValueView(): void + { + $this->processDefaultValueAttributeView('simple2', $this->getDefaultAttributeValue()); + } + + /** + * @inheritdic + */ + protected function getAttributeCode(): string + { + return 'text_attribute'; + } + + /** + * @inheritdic + */ + protected function getDefaultAttributeValue(): string + { + return 'Default value for text area attribute'; + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/TextAttributeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/TextAttributeTest.php new file mode 100644 index 0000000000000..b61c5fd22d5b0 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/TextAttributeTest.php @@ -0,0 +1,95 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Block\Product\View\Attribute; + +/** + * Class checks text attribute displaying on frontend + * + * @magentoDbIsolation enabled + * @magentoDataFixture Magento/Catalog/_files/product_varchar_attribute.php + * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + */ +class TextAttributeTest extends AbstractAttributeTest +{ + /** + * @return void + */ + public function testAttributeView(): void + { + $attributeValue = 'Text attribute value'; + $this->processAttributeView('simple2', $attributeValue, $attributeValue); + } + + /** + * @return void + */ + public function testAttributeWithNonDefaultValueView(): void + { + $attributeValue = 'Non default text attribute value'; + $this->processNonDefaultAttributeValueView('simple2', $attributeValue, $attributeValue); + } + + /** + * @return void + */ + public function testAttributeWithDefaultValueView(): void + { + $this->processDefaultValueAttributeView('simple2', $this->getDefaultAttributeValue()); + } + + /** + * @dataProvider attributeWithTagsProvider + * @magentoAppArea frontend + * @param bool $allowHtmlTags + * @param string $attributeValue + * @param string $expectedAttributeValue + * @return void + */ + public function testAttributeWithHtmlTags( + bool $allowHtmlTags, + string $attributeValue, + string $expectedAttributeValue + ): void { + $this->processAttributeHtmlOutput('simple2', $allowHtmlTags, $attributeValue, $expectedAttributeValue); + } + + /** + * @return array + */ + public function attributeWithTagsProvider(): array + { + return [ + 'allow_html_tags' => [ + 'allow_html_tags' => true, + 'attribute_value' => '<h2>Text with <p>html inside</p></h2>', + 'expected_attribute_value' => '<h2>Text with <p>html inside</p></h2>', + ], + 'disallow_html_tags' => [ + 'allow_html_tags' => false, + 'attribute_value' => '<h2>Text with <p>html inside</p></h2>', + 'expected_attribute_value' => '<h2>Text with <p>html inside</p></h2>', + ], + ]; + } + + /** + * @inheritdoc + */ + protected function getAttributeCode(): string + { + return 'varchar_attribute'; + } + + /** + * @inheritdoc + */ + protected function getDefaultAttributeValue(): string + { + return 'Default value for text attribute'; + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/YesNoAttributeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/YesNoAttributeTest.php new file mode 100644 index 0000000000000..8d95b8d02e2fc --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/YesNoAttributeTest.php @@ -0,0 +1,50 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Block\Product\View\Attribute; + +/** + * Class checks boolean attribute displaying on frontend + * + * @magentoDbIsolation enabled + * @magentoDataFixture Magento/Catalog/_files/product_boolean_attribute.php + * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + */ +class YesNoAttributeTest extends AbstractAttributeTest +{ + /** + * @return void + */ + public function testAttributeWithNonDefaultValueView(): void + { + $this->processNonDefaultAttributeValueView('simple2', '0', 'No'); + } + + /** + * @return void + */ + public function testAttributeWithDefaultValueView(): void + { + $this->processDefaultValueAttributeView('simple2', 'Yes'); + } + + /** + * @inheritdoc + */ + protected function getAttributeCode(): string + { + return 'boolean_attribute'; + } + + /** + * @inheritdoc + */ + protected function getDefaultAttributeValue(): string + { + return '1'; + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/dropdown_attribute_with_html.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/dropdown_attribute_with_html.php new file mode 100644 index 0000000000000..76ab08720f18c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/dropdown_attribute_with_html.php @@ -0,0 +1,69 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\Data\ProductAttributeInterface; +use Magento\Catalog\Model\ResourceModel\Eav\Attribute; +use Magento\Catalog\Model\ResourceModel\Eav\AttributeFactory; +use Magento\Catalog\Setup\CategorySetup; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var $installer CategorySetup */ +$installer = $objectManager->create(CategorySetup::class); +/** @var AttributeFactory $attributeFactory */ +$attributeFactory = $objectManager->get(AttributeFactory::class); +/** @var Attribute $attribute */ +$attribute = $attributeFactory->create(); +$entityTypeId = $installer->getEntityTypeId(ProductAttributeInterface::ENTITY_TYPE_CODE); + +if (!$attribute->loadByCode($entityTypeId, 'dropdown_attribute_with_html')->getId()) { + /** @var $installer CategorySetup */ + $installer = $objectManager->create(CategorySetup::class); + $attribute->setData( + [ + 'attribute_code' => 'dropdown_attribute_with_html', + 'entity_type_id' => $entityTypeId, + 'is_global' => 0, + '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' => 1, + 'used_in_product_listing' => 1, + 'used_for_sort_by' => 0, + 'frontend_label' => ['Drop-Down Attribute'], + 'backend_type' => 'int', + 'option' => [ + 'value' => [ + 'option_1' => ['<h2>Option 1</h2>'], + 'option_2' => ['<h2>Option 2</h2>'], + 'option_3' => ['<h2>Option 3</h2>'], + ], + 'order' => [ + 'option_1' => 1, + 'option_2' => 2, + 'option_3' => 3, + ], + ], + ] + ); + $attribute->save(); + /* Assign attribute to attribute set */ + $installer->addAttributeToGroup( + $entityTypeId, + 'Default', + 'Attributes', + $attribute->getId() + ); +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/dropdown_attribute_with_html_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/dropdown_attribute_with_html_rollback.php new file mode 100644 index 0000000000000..e6357b6967112 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/dropdown_attribute_with_html_rollback.php @@ -0,0 +1,27 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\Framework\Registry; +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; + +$objectManager = Bootstrap::getObjectManager(); +$registry = $objectManager->get(Registry::class); +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); +/** @var ProductAttributeRepositoryInterface $attributeRepository */ +$attributeRepository = $objectManager->create(ProductAttributeRepositoryInterface::class); + +try { + $attributeRepository->deleteById('dropdown_attribute_with_html'); +} catch (NoSuchEntityException $e) { + //already deleted +} + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/multiselect_attribute_with_html.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/multiselect_attribute_with_html.php new file mode 100644 index 0000000000000..bb2bb5016b426 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/multiselect_attribute_with_html.php @@ -0,0 +1,68 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\Data\ProductAttributeInterface; +use Magento\Catalog\Model\ResourceModel\Eav\Attribute; +use Magento\Catalog\Model\ResourceModel\Eav\AttributeFactory; +use Magento\Catalog\Setup\CategorySetup; +use Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var $installer CategorySetup */ +$installer = $objectManager->create(CategorySetup::class); +/** @var $attributeFactory AttributeFactory */ +$attributeFactory = $objectManager->get(AttributeFactory::class); +/** @var $attribute Attribute */ +$attribute = $attributeFactory->create(); +$entityTypeId = $installer->getEntityTypeId(ProductAttributeInterface::ENTITY_TYPE_CODE); +if (!$attribute->loadByCode($entityTypeId, 'multiselect_attribute_with_html')->getAttributeId()) { + $attribute->setData( + [ + 'attribute_code' => 'multiselect_attribute_with_html', + 'entity_type_id' => $entityTypeId, + 'is_global' => 1, + 'is_user_defined' => 1, + 'frontend_input' => 'multiselect', + 'is_unique' => 0, + 'is_required' => 0, + 'is_searchable' => 0, + 'is_visible_in_advanced_search' => 0, + 'is_comparable' => 0, + 'is_filterable' => 1, + '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' => ['Multiselect Attribute'], + 'backend_type' => 'varchar', + 'backend_model' => ArrayBackend::class, + 'option' => [ + 'value' => [ + 'option_1' => ['<h2>Option 1</h2>'], + 'option_2' => ['<h2>Option 2</h2>'], + 'option_3' => ['<h2>Option 3</h2>'], + ], + 'order' => [ + 'option_1' => 1, + 'option_2' => 2, + 'option_3' => 3, + ], + ], + ] + ); + $attribute->save(); + /* Assign attribute to attribute set */ + $installer->addAttributeToGroup( + $entityTypeId, + 'Default', + 'General', + $attribute->getId() + ); +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/multiselect_attribute_with_html_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/multiselect_attribute_with_html_rollback.php new file mode 100644 index 0000000000000..898c9bec0d635 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/multiselect_attribute_with_html_rollback.php @@ -0,0 +1,27 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\Framework\Registry; +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; + +$objectManager = Bootstrap::getObjectManager(); +$registry = $objectManager->get(Registry::class); +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); +/** @var ProductAttributeRepositoryInterface $attributeRepository */ +$attributeRepository = $objectManager->create(ProductAttributeRepositoryInterface::class); + +try { + $attributeRepository->deleteById('multiselect_attribute_with_html'); +} catch (NoSuchEntityException $e) { + //already deleted +} + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); diff --git a/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/View/Attribute/TextSwatchAttributeTest.php b/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/View/Attribute/TextSwatchAttributeTest.php new file mode 100644 index 0000000000000..20f4cf50803b8 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/View/Attribute/TextSwatchAttributeTest.php @@ -0,0 +1,63 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Swatches\Block\Product\View\Attribute; + +use Magento\Catalog\Block\Product\View\Attribute\AbstractAttributeTest; + +/** + * Class checks text attribute displaying on frontend + * + * @magentoDbIsolation enabled + * @magentoAppIsolation enabled + * @magentoDataFixture Magento/Swatches/_files/product_text_swatch_attribute.php + * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + */ +class TextSwatchAttributeTest extends AbstractAttributeTest +{ + /** + * @return void + */ + public function testAttributeView(): void + { + $attributeValue = $this->getAttribute()->getSource()->getOptionId('Option 2'); + $this->processAttributeView('simple2', $attributeValue, 'Option 2'); + } + + /** + * @return void + */ + public function testAttributeWithNonDefaultValueView(): void + { + $attributeValue = $this->getAttribute()->getSource()->getOptionId('Option 2'); + $this->processNonDefaultAttributeValueView('simple2', $attributeValue, 'Option 2'); + } + + /** + * @return void + */ + public function tesAttributeWithDefaultValueView(): void + { + $this->processDefaultValueAttributeView('simple2', 'Option 1'); + } + + /** + * @inheritdoc + */ + protected function getAttributeCode(): string + { + return 'text_swatch_attribute'; + } + + /** + * @inheritdoc + */ + protected function getDefaultAttributeValue(): string + { + return $this->getAttribute()->getSource()->getOptionId('Option 1'); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/View/Attribute/VisualSwatchAttributeTest.php b/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/View/Attribute/VisualSwatchAttributeTest.php new file mode 100644 index 0000000000000..0108a99543def --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/View/Attribute/VisualSwatchAttributeTest.php @@ -0,0 +1,63 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Swatches\Block\Product\View\Attribute; + +use Magento\Catalog\Block\Product\View\Attribute\AbstractAttributeTest; + +/** + * Class checks visual swatch attribute displaying on frontend + * + * @magentoDbIsolation enabled + * @magentoAppIsolation enabled + * @magentoDataFixture Magento/Swatches/_files/product_visual_swatch_attribute.php + * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + */ +class VisualSwatchAttributeTest extends AbstractAttributeTest +{ + /** + * @return void + */ + public function testAttributeView(): void + { + $attributeValue = $this->getAttribute()->getSource()->getOptionId('option 2'); + $this->processAttributeView('simple2', $attributeValue, 'option 2'); + } + + /** + * @return void + */ + public function testAttributeWithNonDefaultValueView(): void + { + $attributeValue = $this->getAttribute()->getSource()->getOptionId('option 2'); + $this->processNonDefaultAttributeValueView('simple2', $attributeValue, 'option 2'); + } + + /** + * @return void + */ + public function tesAttributeWithDefaultValueView(): void + { + $this->processDefaultValueAttributeView('simple2', 'option 1'); + } + + /** + * @inheritdoc + */ + protected function getAttributeCode(): string + { + return 'visual_swatch_attribute'; + } + + /** + * @inheritdoc + */ + protected function getDefaultAttributeValue(): string + { + return $this->getAttribute()->getSource()->getOptionId('option 1'); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Weee/Block/Product/View/Attribute/FixedProductTaxAttributeTest.php b/dev/tests/integration/testsuite/Magento/Weee/Block/Product/View/Attribute/FixedProductTaxAttributeTest.php new file mode 100644 index 0000000000000..6cb7d6dc0346d --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Weee/Block/Product/View/Attribute/FixedProductTaxAttributeTest.php @@ -0,0 +1,252 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Weee\Block\Product\View\Attribute; + +use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Block\Product\ListProduct; +use Magento\Catalog\Pricing\Render as CatalogPricingRender; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Pricing\Render; +use Magento\Framework\Pricing\Render\RendererPool; +use Magento\Framework\Registry; +use Magento\Framework\View\LayoutInterface; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; + +/** + * Class checks FPT attribute displaying on frontend + * + * @magentoDbIsolation enabled + * @magentoAppIsolation enabled + * @magentoAppArea frontend + * @magentoDataFixture Magento/Weee/_files/fixed_product_attribute.php + * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + */ +class FixedProductTaxAttributeTest extends TestCase +{ + /** @var array */ + private const TEST_TAX_DATA = [ + [ + 'region_id' => '1', + 'country' => 'US', + 'val' => '', + 'value' => '5', + 'website_id' => '1', + 'state' => '', + ] + ]; + + /** @var ObjectManagerInterface */ + private $objectManager; + + /** @var ProductRepositoryInterface */ + private $productRepository; + + /** @var string */ + private $attributeCode; + + /** @var LayoutInterface */ + private $layout; + + /** @var ListProduct */ + private $productListBlock; + + /** @var Registry */ + private $registry; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + + $this->objectManager = Bootstrap::getObjectManager(); + $this->productRepository = $this->objectManager->create(ProductRepositoryInterface::class); + $this->layout = $this->objectManager->get(LayoutInterface::class); + $this->productListBlock = $this->layout->createBlock(ListProduct::class); + $this->attributeCode = 'fixed_product_attribute'; + $this->registry = $this->objectManager->get(Registry::class); + } + + /** + * @inheritdoc + */ + protected function tearDown() + { + $this->registry->unregister('product'); + + parent::tearDown(); + } + + /** + * @magentoConfigFixture default_store tax/weee/enable 1 + * @magentoConfigFixture default_store tax/weee/display_list 0 + */ + public function testFPTCategoryPageIncludingFPTOnly(): void + { + $this->prepareLayoutCategoryPage(); + $product = $this->updateProduct('simple2', self::TEST_TAX_DATA); + $productPrice = $this->productListBlock->getProductPrice($product); + $this->assertEquals('$15.00', preg_replace('/\s+/', '', strip_tags($productPrice))); + } + + /** + * @magentoConfigFixture default_store tax/weee/enable 1 + * @magentoConfigFixture default_store tax/weee/display_list 1 + */ + public function testFPTCategoryPageIncludingFPTAndDescription(): void + { + $this->prepareLayoutCategoryPage(); + $product = $this->updateProduct('simple2', self::TEST_TAX_DATA); + $productPrice = $this->productListBlock->getProductPrice($product); + $this->assertContains('data-label="fixed product tax"', $productPrice); + $this->assertEquals('$15.00$5.00', preg_replace('/\s+/', '', strip_tags($productPrice))); + } + + /** + * @magentoConfigFixture default_store tax/weee/enable 1 + * @magentoConfigFixture default_store tax/weee/display_list 2 + */ + public function testFPTCategoryPageExcludingFPTIncludingDescriptionAndPrice(): void + { + $this->prepareLayoutCategoryPage(); + $product = $this->updateProduct('simple2', self::TEST_TAX_DATA); + $productPrice = $this->productListBlock->getProductPrice($product); + $this->assertContains('data-label="fixed product tax"', $productPrice); + $this->assertEquals('$10.00$5.00$15.00', preg_replace('/\s+/', '', strip_tags($productPrice))); + } + + /** + * @magentoConfigFixture default_store tax/weee/enable 1 + * @magentoConfigFixture default_store tax/weee/display_list 3 + */ + public function testFPTCategoryPageExcludingFPT(): void + { + $this->prepareLayoutCategoryPage(); + $product = $this->updateProduct('simple2', self::TEST_TAX_DATA); + $productPrice = $this->productListBlock->getProductPrice($product); + $this->assertEquals('$10.00', preg_replace('/\s+/', '', strip_tags($productPrice))); + } + + /** + * @magentoConfigFixture default_store tax/weee/enable 1 + * @magentoConfigFixture default_store tax/weee/display_list 0 + */ + public function testFPTProductPageIncludingFPTOnly(): void + { + $product = $this->updateProduct('simple2', self::TEST_TAX_DATA); + $this->registerProduct($product); + $block = $this->prepareLayoutProductPage(); + $productPrice = $block->toHtml(); + $this->assertEquals('$15.00', preg_replace('/\s+/', '', strip_tags($productPrice))); + } + + /** + * @magentoConfigFixture default_store tax/weee/enable 1 + * @magentoConfigFixture default_store tax/weee/display_list 1 + */ + public function testFPTProductPageIncludingFPTAndDescription(): void + { + $product = $this->updateProduct('simple2', self::TEST_TAX_DATA); + $this->registerProduct($product); + $block = $this->prepareLayoutProductPage(); + $productPrice = $block->toHtml(); + $this->assertContains('data-label="fixed product tax"', $productPrice); + $this->assertEquals('$15.00$5.00', preg_replace('/\s+/', '', strip_tags($productPrice))); + } + + /** + * @magentoConfigFixture default_store tax/weee/enable 1 + * @magentoConfigFixture default_store tax/weee/display_list 2 + */ + public function testFPTProductPageExcludingFPTIncludingDescriptionAndPrice(): void + { + $product = $this->updateProduct('simple2', self::TEST_TAX_DATA); + $this->registerProduct($product); + $block = $this->prepareLayoutProductPage(); + $productPrice = $block->toHtml(); + $this->assertContains('data-label="fixed product tax"', $productPrice); + $this->assertEquals('$10.00$5.00$15.00', preg_replace('/\s+/', '', strip_tags($productPrice))); + } + + /** + * @magentoConfigFixture default_store tax/weee/enable 1 + * @magentoConfigFixture default_store tax/weee/display_list 3 + */ + public function testFPTProductPageExcludingFPT(): void + { + $product = $this->updateProduct('simple2', self::TEST_TAX_DATA); + $this->registerProduct($product); + $block = $this->prepareLayoutProductPage(); + $productPrice = $block->toHtml(); + $this->assertEquals('$10.00', preg_replace('/\s+/', '', strip_tags($productPrice))); + } + + /** + * Update product + * + * @param string $productSku + * @param array $data + * @return ProductInterface + */ + private function updateProduct(string $productSku, array $data): ProductInterface + { + $product = $this->productRepository->get($productSku); + $product->addData([$this->attributeCode => $data]); + + return $this->productRepository->save($product); + } + + /** + * Prepare layout for category page view + * + * @return void + */ + private function prepareLayoutCategoryPage(): void + { + $this->layout->createBlock(RendererPool::class, 'render.product.prices'); + $block = $this->objectManager->create(Render::class); + $block->setPriceRenderHandle('catalog_product_prices'); + $block->setLayout($this->layout); + $this->layout->addBlock($block, 'product.price.render.default'); + } + + /** + * Prepare layout for product page + * + * @return CatalogPricingRender + */ + private function prepareLayoutProductPage(): CatalogPricingRender + { + $render = $this->objectManager->create(Render::class); + $render->setPriceRenderHandle('catalog_product_prices'); + $this->layout->addBlock($render, 'product.price.render.default'); + $block = $this->objectManager->create(CatalogPricingRender::class); + $block->setPriceRender('product.price.render.default'); + $block->setPriceTypeCode('final_price'); + $this->layout->addBlock($block, 'render.product.prices'); + $block->setLayout($this->layout); + $render->setLayout($this->layout); + + return $block; + } + + /** + * Register the product + * + * @param ProductInterface $product + * @return void + */ + private function registerProduct(ProductInterface $product): void + { + $this->registry->unregister('product'); + $this->registry->register('product', $product); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Weee/Ui/DataProvider/Product/Form/Modifier/Eav/FixedAttributeTest.php b/dev/tests/integration/testsuite/Magento/Weee/Ui/DataProvider/Product/Form/Modifier/Eav/FixedAttributeTest.php index 0987d8fbe57dd..c082d8184c72d 100644 --- a/dev/tests/integration/testsuite/Magento/Weee/Ui/DataProvider/Product/Form/Modifier/Eav/FixedAttributeTest.php +++ b/dev/tests/integration/testsuite/Magento/Weee/Ui/DataProvider/Product/Form/Modifier/Eav/FixedAttributeTest.php @@ -65,7 +65,7 @@ private function getAttributeMeta(): array return [ 'visible' => '1', 'required' => '0', - 'label' => '', + 'label' => 'fixed product tax', 'code' => 'fixed_product_attribute', 'source' => 'product-details', 'scopeLabel' => '[GLOBAL]', diff --git a/dev/tests/integration/testsuite/Magento/Weee/_files/fixed_product_attribute.php b/dev/tests/integration/testsuite/Magento/Weee/_files/fixed_product_attribute.php index a20d1cac94228..a74305d7db424 100644 --- a/dev/tests/integration/testsuite/Magento/Weee/_files/fixed_product_attribute.php +++ b/dev/tests/integration/testsuite/Magento/Weee/_files/fixed_product_attribute.php @@ -25,6 +25,8 @@ 'is_static' => 1, 'attribute_set_id' => $defaultSetId, 'attribute_group_id' => $attributeGroupId, + 'frontend_input' => 'weee', + 'frontend_label' => 'fixed product tax', ]; /** @var \Magento\Catalog\Model\Entity\Attribute $attribute */ From a86d795528c62e3c0b04f7d392ea9fba38e7759d Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Tue, 17 Dec 2019 15:21:26 +0200 Subject: [PATCH 0462/1143] Static test fix --- .../Adminhtml/Indexer/MassInvalidateTest.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Indexer/Test/Unit/Controller/Adminhtml/Indexer/MassInvalidateTest.php b/app/code/Magento/Indexer/Test/Unit/Controller/Adminhtml/Indexer/MassInvalidateTest.php index 7c5ed40a2ccef..167baebaa9da2 100644 --- a/app/code/Magento/Indexer/Test/Unit/Controller/Adminhtml/Indexer/MassInvalidateTest.php +++ b/app/code/Magento/Indexer/Test/Unit/Controller/Adminhtml/Indexer/MassInvalidateTest.php @@ -6,6 +6,8 @@ namespace Magento\Indexer\Test\Unit\Controller\Adminhtml\Indexer; /** + * Mass invalidate Test + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class MassInvalidateTest extends \PHPUnit\Framework\TestCase @@ -91,7 +93,9 @@ class MassInvalidateTest extends \PHPUnit\Framework\TestCase */ protected function setUp() { - $this->contextMock = $this->createPartialMock(\Magento\Backend\App\Action\Context::class, [ + $this->contextMock = $this->createPartialMock( + \Magento\Backend\App\Action\Context::class, + [ 'getAuthorization', 'getSession', 'getActionFlag', @@ -107,14 +111,17 @@ protected function setUp() 'getObjectManager', 'getMessageManager', 'getResultRedirectFactory', - ]); + ] + ); $this->response = $this->createPartialMock( \Magento\Framework\App\ResponseInterface::class, ['setRedirect', 'sendResponse'] ); - $this->view = $this->createPartialMock(\Magento\Framework\App\ViewInterface::class, [ + $this->view = $this->createPartialMock( + \Magento\Framework\App\ViewInterface::class, + [ 'loadLayout', 'getPage', 'getConfig', @@ -129,7 +136,8 @@ protected function setUp() 'addActionLayoutHandles', 'setIsLayoutLoaded', 'isLayoutLoaded' - ]); + ] + ); $this->session = $this->createPartialMock(\Magento\Backend\Model\Session::class, ['setIsUrlNotice']); $this->session->expects($this->any())->method('setIsUrlNotice')->willReturn($this->objectManager); From 41a583abd83a20c21bbc80c044ad9f6f0ebcc63b Mon Sep 17 00:00:00 2001 From: Sathish <srsathish92@gmail.com> Date: Tue, 17 Dec 2019 18:58:35 +0530 Subject: [PATCH 0463/1143] Expected result added with data provider --- .../Test/Unit/Helper/DataTest.php | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/GoogleAnalytics/Test/Unit/Helper/DataTest.php b/app/code/Magento/GoogleAnalytics/Test/Unit/Helper/DataTest.php index ea1df498499de..4da5b70e10b91 100644 --- a/app/code/Magento/GoogleAnalytics/Test/Unit/Helper/DataTest.php +++ b/app/code/Magento/GoogleAnalytics/Test/Unit/Helper/DataTest.php @@ -53,10 +53,13 @@ protected function setUp(): void /** * Test for isGoogleAnalyticsAvailable() * + * @param string $value + * @param bool $flag + * @param bool $result * @return void * @dataProvider gaDataProvider */ - public function testIsGoogleAnalyticsAvailable($value, $flag): void + public function testIsGoogleAnalyticsAvailable($value, $flag, $result): void { $this->scopeConfigMock->expects($this->once()) ->method('getValue') @@ -68,7 +71,7 @@ public function testIsGoogleAnalyticsAvailable($value, $flag): void ->with(HelperData::XML_PATH_ACTIVE, ScopeInterface::SCOPE_STORE) ->willReturn($flag); - $this->assertEquals(($value && $flag), $this->helper->isGoogleAnalyticsAvailable()); + $this->assertEquals($result, $this->helper->isGoogleAnalyticsAvailable()); } /** @@ -79,25 +82,27 @@ public function testIsGoogleAnalyticsAvailable($value, $flag): void public function gaDataProvider(): array { return [ - ['GA-XXXX', true], - ['GA-XXXX', false], - ['', true] + ['GA-XXXX', true, true], + ['GA-XXXX', false, false], + ['', true, false] ]; } /** * Test for isAnonymizedIpActive() * + * @param string $value + * @param bool $result * @return void * @dataProvider yesNoDataProvider */ - public function testIsAnonymizedIpActive($value): void + public function testIsAnonymizedIpActive($value, $result): void { $this->scopeConfigMock->expects($this->once()) ->method('getValue') ->with(HelperData::XML_PATH_ANONYMIZE, ScopeInterface::SCOPE_STORE) ->willReturn($value); - $this->assertEquals((bool) $value, $this->helper->isAnonymizedIpActive()); + $this->assertEquals($result, $this->helper->isAnonymizedIpActive()); } /** @@ -108,8 +113,8 @@ public function testIsAnonymizedIpActive($value): void public function yesNoDataProvider(): array { return [ - ['Yes' => '1'], - ['No' => '0'] + ['Yes' => '1', 'result' => true], + ['No' => '0', 'result' => false] ]; } } From edbd6b5668307a1a4343f8772ed5869985c4fe1e Mon Sep 17 00:00:00 2001 From: Mastiuhin Olexandr <mastiuhin.olexandr@transoftgroup.com> Date: Tue, 17 Dec 2019 15:28:45 +0200 Subject: [PATCH 0464/1143] MC-29545: [Magento Cloud] - ElasticSearch Not Working Correctly (Alphabetical sorting) --- .../BatchDataMapper/ProductDataMapper.php | 22 +++++- .../Model/Indexer/ReindexAllTest.php | 68 +++++++++++++++++++ 2 files changed, 89 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Elasticsearch/Model/Adapter/BatchDataMapper/ProductDataMapper.php b/app/code/Magento/Elasticsearch/Model/Adapter/BatchDataMapper/ProductDataMapper.php index 270ca37e2d42c..16c4b3eb953f6 100644 --- a/app/code/Magento/Elasticsearch/Model/Adapter/BatchDataMapper/ProductDataMapper.php +++ b/app/code/Magento/Elasticsearch/Model/Adapter/BatchDataMapper/ProductDataMapper.php @@ -77,6 +77,13 @@ class ProductDataMapper implements BatchDataMapperInterface 'tax_class_id' ]; + /** + * @var string[] + */ + private $sortableAttributesValuesToImplode = [ + 'name', + ]; + /** * Construction for DocumentDataMapper * @@ -86,6 +93,7 @@ class ProductDataMapper implements BatchDataMapperInterface * @param AdditionalFieldsProviderInterface $additionalFieldsProvider * @param DataProvider $dataProvider * @param array $excludedAttributes + * @param array $sortableAttributesValuesToImplode */ public function __construct( Builder $builder, @@ -93,12 +101,17 @@ public function __construct( DateFieldType $dateFieldType, AdditionalFieldsProviderInterface $additionalFieldsProvider, DataProvider $dataProvider, - array $excludedAttributes = [] + array $excludedAttributes = [], + array $sortableAttributesValuesToImplode = [] ) { $this->builder = $builder; $this->fieldMapper = $fieldMapper; $this->dateFieldType = $dateFieldType; $this->excludedAttributes = array_merge($this->defaultExcludedAttributes, $excludedAttributes); + $this->sortableAttributesValuesToImplode = array_merge( + $this->sortableAttributesValuesToImplode, + $sortableAttributesValuesToImplode + ); $this->additionalFieldsProvider = $additionalFieldsProvider; $this->dataProvider = $dataProvider; $this->attributeOptionsCache = []; @@ -241,6 +254,13 @@ private function prepareAttributeValues( } } + if ($attribute->getUsedForSortBy() + && in_array($attribute->getAttributeCode(), $this->sortableAttributesValuesToImplode) + && count($attributeValues) > 1 + ) { + $attributeValues = [$productId => implode(' ', $attributeValues)]; + } + return $attributeValues; } diff --git a/dev/tests/integration/testsuite/Magento/Elasticsearch/Model/Indexer/ReindexAllTest.php b/dev/tests/integration/testsuite/Magento/Elasticsearch/Model/Indexer/ReindexAllTest.php index 7d4aa8e005e4e..031e0d6ad6fd1 100644 --- a/dev/tests/integration/testsuite/Magento/Elasticsearch/Model/Indexer/ReindexAllTest.php +++ b/dev/tests/integration/testsuite/Magento/Elasticsearch/Model/Indexer/ReindexAllTest.php @@ -79,6 +79,42 @@ public function testSearchAll() self::assertGreaterThanOrEqual(2, $result); } + /** + * Test sorting of all products after full reindex + * + * @magentoDbIsolation enabled + * @magentoConfigFixture default/catalog/search/engine elasticsearch6 + * @magentoConfigFixture current_store catalog/search/elasticsearch_index_prefix indexerhandlertest_configurable + * @magentoDataFixture Magento/ConfigurableProduct/_files/configurable_products.php + */ + public function testSort() + { + /** @var $productFifth \Magento\Catalog\Model\Product */ + $productSimple = Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); + $productSimple->setTypeId('simple') + ->setAttributeSetId(4) + ->setWebsiteIds([1]) + ->setName('ABC') + ->setSku('abc-first-in-sort') + ->setPrice(20) + ->setMetaTitle('meta title') + ->setMetaKeyword('meta keyword') + ->setMetaDescription('meta description') + ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) + ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) + ->setStockData(['use_config_manage_stock' => 0]) + ->save(); + $productConfigurableOption = $this->productRepository->get('simple_10'); + $productConfigurableOption->setName('1ABC'); + $this->productRepository->save($productConfigurableOption); + $this->reindexAll(); + $productSimple = $this->productRepository->get('abc-first-in-sort'); + $result = $this->sortByName(); + $firstInSearchResults = (int) $result[0]['_id']; + $productSimpleId = (int) $productSimple->getId(); + $this->assertEquals($productSimpleId, $firstInSearchResults); + } + /** * Test search of specific product after full reindex * @@ -125,6 +161,38 @@ private function searchByName($text) return isset($queryResult['hits']['hits']) ? $queryResult['hits']['hits'] : []; } + /** + * @return array + */ + private function sortByName() + { + $storeId = $this->storeManager->getDefaultStoreView()->getId(); + $searchQuery = [ + 'index' => $this->searchIndexNameResolver->getIndexName($storeId, 'catalogsearch_fulltext'), + 'type' => $this->clientConfig->getEntityType(), + 'body' => [ + 'sort' => [ + 'name.sort_name' => [ + 'order' => 'asc' + ], + ], + 'query' => [ + 'bool' => [ + 'must' => [ + [ + 'terms' => [ + 'visibility' => [2, 4], + ], + ], + ], + ], + ], + ], + ]; + $queryResult = $this->client->query($searchQuery); + return isset($queryResult['hits']['hits']) ? $queryResult['hits']['hits'] : []; + } + /** * Make fulltext catalog search reindex * From 45bb4289d526df48a8f2329041fb379a5fde2c79 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Tue, 17 Dec 2019 15:45:11 +0200 Subject: [PATCH 0465/1143] Fix Test name --- .../Unit/Controller/Adminhtml/Indexer/MassInvalidateTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Indexer/Test/Unit/Controller/Adminhtml/Indexer/MassInvalidateTest.php b/app/code/Magento/Indexer/Test/Unit/Controller/Adminhtml/Indexer/MassInvalidateTest.php index 167baebaa9da2..e0d4a505bc64d 100644 --- a/app/code/Magento/Indexer/Test/Unit/Controller/Adminhtml/Indexer/MassInvalidateTest.php +++ b/app/code/Magento/Indexer/Test/Unit/Controller/Adminhtml/Indexer/MassInvalidateTest.php @@ -6,7 +6,7 @@ namespace Magento\Indexer\Test\Unit\Controller\Adminhtml\Indexer; /** - * Mass invalidate Test + * Test for Mass invalidate action * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ From 6d064fd6c3db28076d5b62cd1734b8aff48f7fb1 Mon Sep 17 00:00:00 2001 From: Mastiuhin Olexandr <mastiuhin.olexandr@transoftgroup.com> Date: Tue, 17 Dec 2019 16:27:56 +0200 Subject: [PATCH 0466/1143] MC-29633: Bundle Product tax class can be changed from dashboard in store view --- .../Form/Modifier/AbstractModifierTest.php | 1 + .../Product/Form/Modifier/BundlePriceTest.php | 173 ++++++++++++++++++ .../Product/Form/Modifier/BundlePrice.php | 20 +- 3 files changed, 192 insertions(+), 2 deletions(-) create mode 100644 app/code/Magento/Bundle/Test/Unit/Ui/DataProvider/Product/Form/Modifier/BundlePriceTest.php diff --git a/app/code/Magento/Bundle/Test/Unit/Ui/DataProvider/Product/Form/Modifier/AbstractModifierTest.php b/app/code/Magento/Bundle/Test/Unit/Ui/DataProvider/Product/Form/Modifier/AbstractModifierTest.php index ccb6226ccd833..bfe0f04d59cb2 100644 --- a/app/code/Magento/Bundle/Test/Unit/Ui/DataProvider/Product/Form/Modifier/AbstractModifierTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Ui/DataProvider/Product/Form/Modifier/AbstractModifierTest.php @@ -45,6 +45,7 @@ protected function setUp() $this->locatorMock = $this->getMockBuilder(LocatorInterface::class) ->getMockForAbstractClass(); $this->productMock = $this->getMockBuilder(ProductInterface::class) + ->setMethods(['getPriceType']) ->getMockForAbstractClass(); $this->locatorMock->expects($this->any()) diff --git a/app/code/Magento/Bundle/Test/Unit/Ui/DataProvider/Product/Form/Modifier/BundlePriceTest.php b/app/code/Magento/Bundle/Test/Unit/Ui/DataProvider/Product/Form/Modifier/BundlePriceTest.php new file mode 100644 index 0000000000000..b0519f1ebddba --- /dev/null +++ b/app/code/Magento/Bundle/Test/Unit/Ui/DataProvider/Product/Form/Modifier/BundlePriceTest.php @@ -0,0 +1,173 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Bundle\Test\Unit\Ui\DataProvider\Product\Form\Modifier; + +use Magento\Bundle\Ui\DataProvider\Product\Form\Modifier\BundlePrice; +use Magento\Catalog\Api\Data\ProductAttributeInterface; +use Magento\Framework\Stdlib\ArrayManager; + +class BundlePriceTest extends AbstractModifierTest +{ + /** + * @return BundlePrice + */ + protected function createModel() + { + return $this->objectManager->getObject( + BundlePrice::class, + [ + 'locator' => $this->locatorMock, + 'arrayManager' => $this->arrayManagerMock + ] + ); + } + + /** + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function testModifyMeta() + { + $this->productMock->expects($this->any()) + ->method('getId') + ->willReturn(true); + $this->productMock->expects($this->any()) + ->method('getPriceType') + ->willReturn(0); + $priceTypePath = 'bundle-items/children/' . BundlePrice::CODE_PRICE_TYPE; + $priceTypeConfigPath = $priceTypePath . BundlePrice::META_CONFIG_PATH; + $pricePath = 'product-details/children/' . ProductAttributeInterface::CODE_PRICE; + $priceConfigPath = $pricePath . BundlePrice::META_CONFIG_PATH; + $sourceMeta = [ + 'bundle-items' => [ + 'children' => [ + BundlePrice::CODE_PRICE_TYPE => [] + ] + ] + ]; + $priceTypeParams = [ + 'disabled' => true, + 'valueMap' => [ + 'false' => '1', + 'true' => '0' + ], + 'validation' => [ + 'required-entry' => false + ] + ]; + $priceTypeMeta = [ + 'bundle-items' => [ + 'children' => [ + BundlePrice::CODE_PRICE_TYPE => $priceTypeParams + ] + ] + ]; + $priceParams = [ + 'imports' => [ + 'disabled' => 'ns = ${ $.ns }, index = ' . BundlePrice::CODE_PRICE_TYPE . ':checked' + ] + ]; + $priceMeta = [ + 'product-details' => [ + 'children' => [ + BundlePrice::CODE_PRICE_TYPE => [] + ] + ], + 'bundle-items' => [ + 'children' => [ + ProductAttributeInterface::CODE_PRICE => $priceParams + ] + ] + ]; + $taxParams = [ + 'service' => [ + 'template' => '' + ] + ]; + + $this->arrayManagerMock->expects($this->any()) + ->method('findPath') + ->willReturnMap( + [ + [ + BundlePrice::CODE_PRICE_TYPE, + $sourceMeta, + null, + 'children', + ArrayManager::DEFAULT_PATH_DELIMITER, + $priceTypePath + ], + [ + ProductAttributeInterface::CODE_PRICE, + $priceTypeMeta, + BundlePrice::DEFAULT_GENERAL_PANEL . '/children', + 'children', + ArrayManager::DEFAULT_PATH_DELIMITER, + $pricePath + ], + [ + BundlePrice::CODE_TAX_CLASS_ID, + $priceMeta, + null, + 'children', + ArrayManager::DEFAULT_PATH_DELIMITER, + $pricePath + ], + [ + BundlePrice::CODE_TAX_CLASS_ID, + $priceMeta, + null, + 'children', + ArrayManager::DEFAULT_PATH_DELIMITER, + $pricePath + ] + ] + ); + $this->arrayManagerMock->expects($this->exactly(4)) + ->method('merge') + ->willReturnMap( + [ + [ + $priceTypeConfigPath, + $sourceMeta, + $priceTypeParams, + ArrayManager::DEFAULT_PATH_DELIMITER, + $priceTypeMeta + ], + [ + $priceConfigPath, + $priceTypeMeta, + $priceParams, + ArrayManager::DEFAULT_PATH_DELIMITER, + $priceMeta + ], + [ + $priceConfigPath, + $priceMeta, + $priceParams, + ArrayManager::DEFAULT_PATH_DELIMITER, + $priceMeta + ], + [ + $priceConfigPath, + $priceMeta, + $taxParams, + ArrayManager::DEFAULT_PATH_DELIMITER, + $priceMeta + ] + ] + ); + + $this->assertSame($priceMeta, $this->getModel()->modifyMeta($sourceMeta)); + } + + public function testModifyData() + { + $expectedData = []; + $this->assertEquals($expectedData, $this->getModel()->modifyData($expectedData)); + } +} diff --git a/app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundlePrice.php b/app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundlePrice.php index 92326bb1521b4..d7da7513c3aac 100644 --- a/app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundlePrice.php +++ b/app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundlePrice.php @@ -5,6 +5,7 @@ */ namespace Magento\Bundle\Ui\DataProvider\Product\Form\Modifier; +use Magento\Bundle\Model\Product\Price; use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier; use Magento\Catalog\Api\Data\ProductAttributeInterface; use Magento\Framework\Stdlib\ArrayManager; @@ -39,7 +40,7 @@ public function __construct( $this->locator = $locator; $this->arrayManager = $arrayManager; } - + /** * @inheritdoc */ @@ -89,7 +90,22 @@ public function modifyMeta(array $meta) ] ] ); - + if ($this->locator->getProduct()->getPriceType() == Price::PRICE_TYPE_DYNAMIC) { + $meta = $this->arrayManager->merge( + $this->arrayManager->findPath( + static::CODE_TAX_CLASS_ID, + $meta, + null, + 'children' + ) . static::META_CONFIG_PATH, + $meta, + [ + 'service' => [ + 'template' => '' + ] + ] + ); + } return $meta; } From 31cf17980f506124bb34f0a40b8322cf7bf2af95 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Tue, 17 Dec 2019 16:48:54 +0200 Subject: [PATCH 0467/1143] add massChangeLog to white list words test --- .../testsuite/Magento/Test/Legacy/_files/words_ce.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/words_ce.xml b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/words_ce.xml index 92e7b15efed29..06b46c8bf744e 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/words_ce.xml +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/words_ce.xml @@ -32,6 +32,14 @@ <item> <path>CHANGELOG.md</path> </item> + <item> + <path>app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassChangelog.php</path> + <word>massChangelog</word> + </item> + <item> + <path>app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassChangelog.php</path> + <word>massChangelog</word> + </item> <item> <path>composer.lock</path> </item> From 8201ea2a15fafa5a50560b3c9890092b059bb619 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Tue, 17 Dec 2019 22:14:55 +0700 Subject: [PATCH 0468/1143] [GiftMessage] Cover Observer SalesEventOrderItemToQuoteItemObserver by Unit Test --- ...sEventOrderItemToQuoteItemObserverTest.php | 196 ++++++++++++++++++ 1 file changed, 196 insertions(+) create mode 100644 app/code/Magento/GiftMessage/Test/Unit/Observer/SalesEventOrderItemToQuoteItemObserverTest.php diff --git a/app/code/Magento/GiftMessage/Test/Unit/Observer/SalesEventOrderItemToQuoteItemObserverTest.php b/app/code/Magento/GiftMessage/Test/Unit/Observer/SalesEventOrderItemToQuoteItemObserverTest.php new file mode 100644 index 0000000000000..1df1c1101ccd1 --- /dev/null +++ b/app/code/Magento/GiftMessage/Test/Unit/Observer/SalesEventOrderItemToQuoteItemObserverTest.php @@ -0,0 +1,196 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\GiftMessage\Test\Unit\Observer; + +use Magento\Framework\Event; +use Magento\Framework\Event\Observer; +use Magento\Framework\Message\MessageInterface; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\GiftMessage\Helper\Message as MessageHelper; +use Magento\GiftMessage\Model\Message as MessageModel; +use Magento\GiftMessage\Model\MessageFactory; +use Magento\GiftMessage\Observer\SalesEventOrderItemToQuoteItemObserver; +use Magento\Quote\Model\Quote\Item as QuoteItem; +use Magento\Sales\Model\Order; +use Magento\Sales\Model\Order\Item as OrderItem; +use Magento\Store\Model\Store; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class SalesEventOrderItemToQuoteItemObserverTest extends TestCase +{ + /** + * Stub message id + */ + private const STUB_MESSAGE_ID = 1; + + /** + * Stub new message id + */ + private const STUB_NEW_MESSAGE_ID = 2; + + /** + * @var SalesEventOrderItemToQuoteItemObserver + */ + private $observer; + + /** + * @var MessageFactory|MockObject + */ + private $messageFactoryMock; + + /** + * @var MessageHelper|MockObject + */ + private $giftMessageHelperMock; + + /** + * @var Observer|MockObject + */ + private $observerMock; + + /** + * @var Event|MockObject + */ + private $eventMock; + + /** + * @var Order|MockObject + */ + private $orderMock; + + /** + * @var OrderItem|MockObject + */ + private $orderItemMock; + + /** + * @var Store|MockObject + */ + private $storeMock; + + /** + * @var MessageInterface|MockObject + */ + private $messageMock; + + /** + * @var QuoteItem|MockObject + */ + private $quoteItemMock; + + /** + * Prepare environment for test + */ + public function setUp(): void + { + $this->messageFactoryMock = $this->createMock(MessageFactory::class); + $this->giftMessageHelperMock = $this->createMock(MessageHelper::class); + $this->observerMock = $this->createMock(Observer::class); + $this->eventMock = $this->createPartialMock(Event::class, ['getOrderItem', 'getQuoteItem']); + $this->orderItemMock = $this->createPartialMock( + OrderItem::class, + ['getOrder', 'getStoreId', 'getGiftMessageId'] + ); + $this->quoteItemMock = $this->createPartialMock(QuoteItem::class, ['setGiftMessageId']); + $this->orderMock = $this->createPartialMock(Order::class, ['getReordered']); + $this->storeMock = $this->createMock(Store::class); + $this->messageMock = $this->createMock(MessageModel::class); + + $objectManager = new ObjectManager($this); + + $this->observer = $objectManager->getObject( + SalesEventOrderItemToQuoteItemObserver::class, + [ + 'messageFactory' => $this->messageFactoryMock, + 'giftMessageMessage' => $this->giftMessageHelperMock + ] + ); + } + + /** + * Tests duplicating gift message from order item to quote item + * + * @param bool $orderIsReordered + * @param bool $isMessagesAllowed + * @dataProvider giftMessageDataProvider + */ + public function testExecute($orderIsReordered, $isMessagesAllowed) + { + $this->eventMock->expects($this->atLeastOnce()) + ->method('getOrderItem') + ->willReturn($this->orderItemMock); + + $this->orderItemMock->expects($this->atLeastOnce()) + ->method('getOrder') + ->willReturn($this->orderMock); + + $this->observerMock->expects($this->atLeastOnce()) + ->method('getEvent') + ->willReturn($this->eventMock); + + if (!$orderIsReordered && $isMessagesAllowed) { + $this->eventMock + ->expects($this->atLeastOnce()) + ->method('getQuoteItem') + ->willReturn($this->quoteItemMock); + $this->orderMock->expects($this->once()) + ->method('getReordered') + ->willReturn($orderIsReordered); + $this->orderItemMock->expects($this->once()) + ->method('getGiftMessageId') + ->willReturn(self::STUB_MESSAGE_ID); + $this->giftMessageHelperMock->expects($this->once()) + ->method('isMessagesAllowed') + ->willReturn($isMessagesAllowed); + $this->messageFactoryMock->expects($this->once()) + ->method('create') + ->willReturn($this->messageMock); + $this->messageMock->expects($this->once()) + ->method('load') + ->with(self::STUB_MESSAGE_ID) + ->willReturnSelf(); + $this->messageMock->expects($this->once()) + ->method('setId') + ->with(null) + ->willReturnSelf(); + $this->messageMock->expects($this->once()) + ->method('save') + ->willReturnSelf(); + $this->messageMock->expects($this->once()) + ->method('getId') + ->willReturn(self::STUB_NEW_MESSAGE_ID); + $this->quoteItemMock->expects($this->once()) + ->method('setGiftMessageId') + ->with(self::STUB_NEW_MESSAGE_ID) + ->willReturnSelf(); + } + + /** Run observer */ + $this->observer->execute($this->observerMock); + } + + /** + * Providing gift message data for test + * + * @return array + */ + public function giftMessageDataProvider() + { + return [ + 'order is not reordered, messages is allowed' => [false, true], + 'order is reordered, messages is allowed' => [true, true], + 'order is reordered, messages is not allowed' => [true, false], + 'order is not reordered, messages is not allowed' => [false, false] + ]; + } +} From 97b128635b82ce74c9ee1e92e1792a0a40fb089a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 12 Dec 2019 11:20:35 +0100 Subject: [PATCH 0469/1143] Add information about the path that is not allowed --- app/code/Magento/MediaStorage/App/Media.php | 49 +++-- .../MediaStorage/Test/Unit/App/MediaTest.php | 184 +++++++++++------- 2 files changed, 146 insertions(+), 87 deletions(-) diff --git a/app/code/Magento/MediaStorage/App/Media.php b/app/code/Magento/MediaStorage/App/Media.php index e1644ebaf5a48..15bf7bb62e970 100644 --- a/app/code/Magento/MediaStorage/App/Media.php +++ b/app/code/Magento/MediaStorage/App/Media.php @@ -5,22 +5,31 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\MediaStorage\App; +use Closure; +use Exception; +use LogicException; use Magento\Catalog\Model\View\Asset\PlaceholderFactory; +use Magento\Framework\App; +use Magento\Framework\App\Area; +use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\App\ResponseInterface; use Magento\Framework\App\State; +use Magento\Framework\AppInterface; use Magento\Framework\Filesystem; +use Magento\Framework\Filesystem\Directory\WriteInterface; +use Magento\MediaStorage\Model\File\Storage\Config; use Magento\MediaStorage\Model\File\Storage\ConfigFactory; use Magento\MediaStorage\Model\File\Storage\Response; -use Magento\Framework\App; -use Magento\Framework\App\Filesystem\DirectoryList; -use Magento\Framework\AppInterface; +use Magento\MediaStorage\Model\File\Storage\Synchronization; use Magento\MediaStorage\Model\File\Storage\SynchronizationFactory; -use Magento\Framework\App\Area; -use Magento\MediaStorage\Model\File\Storage\Config; use Magento\MediaStorage\Service\ImageResize; /** + * Media Storage + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Media implements AppInterface @@ -28,7 +37,7 @@ class Media implements AppInterface /** * Authorization function * - * @var \Closure + * @var Closure */ private $isAllowed; @@ -59,7 +68,7 @@ class Media implements AppInterface private $response; /** - * @var \Magento\Framework\Filesystem\Directory\WriteInterface + * @var WriteInterface */ private $directory; @@ -92,7 +101,7 @@ class Media implements AppInterface * @param ConfigFactory $configFactory * @param SynchronizationFactory $syncFactory * @param Response $response - * @param \Closure $isAllowed + * @param Closure $isAllowed * @param string $mediaDirectory * @param string $configCacheFile * @param string $relativeFileName @@ -106,7 +115,7 @@ public function __construct( ConfigFactory $configFactory, SynchronizationFactory $syncFactory, Response $response, - \Closure $isAllowed, + Closure $isAllowed, $mediaDirectory, $configCacheFile, $relativeFileName, @@ -120,6 +129,7 @@ public function __construct( $this->directory = $filesystem->getDirectoryWrite(DirectoryList::PUB); $mediaDirectory = trim($mediaDirectory); if (!empty($mediaDirectory)) { + // phpcs:ignore Magento2.Functions.DiscouragedFunction $this->mediaDirectoryPath = str_replace('\\', '/', realpath($mediaDirectory)); } $this->configCacheFile = $configCacheFile; @@ -135,9 +145,9 @@ public function __construct( * Run application * * @return Response - * @throws \LogicException + * @throws LogicException */ - public function launch() + public function launch(): ResponseInterface { $this->appState->setAreaCode(Area::AREA_GLOBAL); @@ -150,12 +160,12 @@ public function launch() $allowedResources = $config->getAllowedResources(); $isAllowed = $this->isAllowed; if (!$isAllowed($this->relativeFileName, $allowedResources)) { - throw new \LogicException('The specified path is not allowed.'); + throw new LogicException('The path is not allowed: ' . $this->relativeFileName); } } try { - /** @var \Magento\MediaStorage\Model\File\Storage\Synchronization $sync */ + /** @var Synchronization $sync */ $sync = $this->syncFactory->create(['directory' => $this->directory]); $sync->synchronize($this->relativeFileName); $this->imageResize->resizeFromImageName($this->getOriginalImage($this->relativeFileName)); @@ -164,14 +174,19 @@ public function launch() } else { $this->setPlaceholderImage(); } - } catch (\Exception $e) { + } catch (Exception $e) { $this->setPlaceholderImage(); } return $this->response; } - private function setPlaceholderImage() + /** + * Set Placeholder as a response + * + * @return void + */ + private function setPlaceholderImage(): void { $placeholder = $this->placeholderFactory->create(['type' => 'image']); $this->response->setFilePath($placeholder->getPath()); @@ -189,9 +204,9 @@ private function getOriginalImage(string $resizedImagePath): string } /** - * {@inheritdoc} + * @inheritdoc */ - public function catchException(App\Bootstrap $bootstrap, \Exception $exception) + public function catchException(App\Bootstrap $bootstrap, Exception $exception) { $this->response->setHttpResponseCode(404); if ($bootstrap->isDeveloperMode()) { diff --git a/app/code/Magento/MediaStorage/Test/Unit/App/MediaTest.php b/app/code/Magento/MediaStorage/Test/Unit/App/MediaTest.php index 90075d11c6af3..e6f43dd435869 100644 --- a/app/code/Magento/MediaStorage/Test/Unit/App/MediaTest.php +++ b/app/code/Magento/MediaStorage/Test/Unit/App/MediaTest.php @@ -3,145 +3,118 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\MediaStorage\Test\Unit\App; +use Exception; +use LogicException; use Magento\Catalog\Model\View\Asset\Placeholder; use Magento\Catalog\Model\View\Asset\PlaceholderFactory; +use Magento\Framework\App\Bootstrap; use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\Filesystem; +use Magento\Framework\Filesystem\Directory\Read; +use Magento\Framework\Filesystem\Directory\WriteInterface; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\MediaStorage\App\Media; +use Magento\MediaStorage\Model\File\Storage\Config; +use Magento\MediaStorage\Model\File\Storage\ConfigFactory; +use Magento\MediaStorage\Model\File\Storage\Response; +use Magento\MediaStorage\Model\File\Storage\Synchronization; +use Magento\MediaStorage\Model\File\Storage\SynchronizationFactory; +use PHPUnit\Framework\TestCase; +use PHPUnit_Framework_MockObject_MockObject as MockObject; /** - * Class MediaTest + * Verification for Media class + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class MediaTest extends \PHPUnit\Framework\TestCase +class MediaTest extends TestCase { const MEDIA_DIRECTORY = 'mediaDirectory'; const RELATIVE_FILE_PATH = 'test/file.png'; const CACHE_FILE_PATH = 'var'; /** - * @var \Magento\MediaStorage\App\Media + * @var Media */ - private $model; + private $mediaModel; /** - * @var \Magento\MediaStorage\Model\File\Storage\ConfigFactory|\PHPUnit_Framework_MockObject_MockObject + * @var ConfigFactory|MockObject */ private $configFactoryMock; /** - * @var \Magento\MediaStorage\Model\File\Storage\SynchronizationFactory|\PHPUnit_Framework_MockObject_MockObject + * @var SynchronizationFactory|MockObject */ private $syncFactoryMock; /** - * @var callable - */ - private $closure; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var Config|MockObject */ private $configMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var Synchronization|MockObject */ private $sync; /** - * @var \Magento\MediaStorage\Model\File\Storage\Response|\PHPUnit_Framework_MockObject_MockObject + * @var Response|MockObject */ private $responseMock; /** - * @var \Magento\Framework\Filesystem|\PHPUnit_Framework_MockObject_MockObject + * @var Filesystem|MockObject */ private $filesystemMock; /** - * @var \Magento\Framework\Filesystem\Directory\Read|\PHPUnit_Framework_MockObject_MockObject + * @var Read|MockObject */ private $directoryMock; protected function setUp() { - $this->closure = function () { - return true; - }; - $this->configMock = $this->createMock(\Magento\MediaStorage\Model\File\Storage\Config::class); - $this->sync = $this->createMock(\Magento\MediaStorage\Model\File\Storage\Synchronization::class); + $this->configMock = $this->createMock(Config::class); + $this->sync = $this->createMock(Synchronization::class); $this->configFactoryMock = $this->createPartialMock( - \Magento\MediaStorage\Model\File\Storage\ConfigFactory::class, + ConfigFactory::class, ['create'] ); $this->configFactoryMock->expects($this->any()) ->method('create') ->will($this->returnValue($this->configMock)); $this->syncFactoryMock = $this->createPartialMock( - \Magento\MediaStorage\Model\File\Storage\SynchronizationFactory::class, + SynchronizationFactory::class, ['create'] ); $this->syncFactoryMock->expects($this->any()) ->method('create') ->will($this->returnValue($this->sync)); - $this->filesystemMock = $this->createMock(\Magento\Framework\Filesystem::class); - $this->directoryMock = $this->getMockForAbstractClass( - \Magento\Framework\Filesystem\Directory\WriteInterface::class - ); + $this->filesystemMock = $this->createMock(Filesystem::class); + $this->directoryMock = $this->getMockForAbstractClass(WriteInterface::class); $this->filesystemMock->expects($this->any()) ->method('getDirectoryWrite') ->with(DirectoryList::PUB) ->will($this->returnValue($this->directoryMock)); - $this->responseMock = $this->createMock(\Magento\MediaStorage\Model\File\Storage\Response::class); - - $objectManager = new ObjectManager($this); - $this->model = $objectManager->getObject( - \Magento\MediaStorage\App\Media::class, - [ - 'configFactory' => $this->configFactoryMock, - 'syncFactory' => $this->syncFactoryMock, - 'response' => $this->responseMock, - 'isAllowed' => $this->closure, - 'mediaDirectory' => false, - 'configCacheFile' => self::CACHE_FILE_PATH, - 'relativeFileName' => self::RELATIVE_FILE_PATH, - 'filesystem' => $this->filesystemMock, - 'placeholderFactory' => $this->createConfiguredMock( - PlaceholderFactory::class, - [ - 'create' => $this->createMock(Placeholder::class) - ] - ), - ] - ); + $this->responseMock = $this->createMock(Response::class); } protected function tearDown() { - unset($this->model); + unset($this->mediaModel); } public function testProcessRequestCreatesConfigFileMediaDirectoryIsNotProvided() { - $objectManager = new ObjectManager($this); - $this->model = $objectManager->getObject( - \Magento\MediaStorage\App\Media::class, - [ - 'configFactory' => $this->configFactoryMock, - 'syncFactory' => $this->syncFactoryMock, - 'response' => $this->responseMock, - 'isAllowed' => $this->closure, - 'mediaDirectory' => false, - 'configCacheFile' => self::CACHE_FILE_PATH, - 'relativeFileName' => self::RELATIVE_FILE_PATH, - 'filesystem' => $this->filesystemMock - ] - ); + $this->mediaModel = $this->getMediaModel(); + $filePath = '/absolute/path/to/test/file.png'; $this->directoryMock->expects($this->any()) ->method('getAbsolutePath') @@ -158,11 +131,13 @@ public function testProcessRequestCreatesConfigFileMediaDirectoryIsNotProvided() ->with(self::RELATIVE_FILE_PATH) ->will($this->returnValue(true)); $this->responseMock->expects($this->once())->method('setFilePath')->with($filePath); - $this->model->launch(); + $this->mediaModel->launch(); } public function testProcessRequestReturnsFileIfItsProperlySynchronized() { + $this->mediaModel = $this->getMediaModel(); + $filePath = '/absolute/path/to/test/file.png'; $this->sync->expects($this->once())->method('synchronize')->with(self::RELATIVE_FILE_PATH); $this->directoryMock->expects($this->once()) @@ -178,11 +153,13 @@ public function testProcessRequestReturnsFileIfItsProperlySynchronized() ] )); $this->responseMock->expects($this->once())->method('setFilePath')->with($filePath); - $this->assertSame($this->responseMock, $this->model->launch()); + $this->assertSame($this->responseMock, $this->mediaModel->launch()); } public function testProcessRequestReturnsNotFoundIfFileIsNotSynchronized() { + $this->mediaModel = $this->getMediaModel(); + $this->sync->expects($this->once())->method('synchronize')->with(self::RELATIVE_FILE_PATH); $this->directoryMock->expects($this->once()) ->method('getAbsolutePath') @@ -192,7 +169,7 @@ public function testProcessRequestReturnsNotFoundIfFileIsNotSynchronized() ->method('isReadable') ->with(self::RELATIVE_FILE_PATH) ->will($this->returnValue(false)); - $this->assertSame($this->responseMock, $this->model->launch()); + $this->assertSame($this->responseMock, $this->mediaModel->launch()); } /** @@ -203,8 +180,12 @@ public function testProcessRequestReturnsNotFoundIfFileIsNotSynchronized() */ public function testCatchException($isDeveloper, $setBodyCalls) { - $bootstrap = $this->createMock(\Magento\Framework\App\Bootstrap::class); - $exception = $this->createMock(\Exception::class); + /** @var Bootstrap|MockObject $bootstrap */ + $bootstrap = $this->createMock(Bootstrap::class); + + /** @var Exception|MockObject $exception */ + $exception = $this->createMock(Exception::class); + $this->responseMock->expects($this->once()) ->method('setHttpResponseCode') ->with(404); @@ -215,7 +196,32 @@ public function testCatchException($isDeveloper, $setBodyCalls) ->method('setBody'); $this->responseMock->expects($this->once()) ->method('sendResponse'); - $this->model->catchException($bootstrap, $exception); + + $this->isAllowed = true; + $this->mediaModel = $this->getMediaModel(); + + $this->mediaModel->catchException($bootstrap, $exception); + } + + public function testExceptionWhenIsAllowedReturnsFalse() + { + $this->mediaModel = $this->getMediaModel(false); + + $filePath = '/absolute/path/to/test/file.png'; + $this->directoryMock->expects($this->any()) + ->method('getAbsolutePath') + ->will($this->returnValueMap( + [ + [null, self::MEDIA_DIRECTORY], + [self::RELATIVE_FILE_PATH, $filePath], + ] + )); + $this->configMock->expects($this->once())->method('save'); + + $this->expectException(LogicException::class); + $this->expectExceptionMessage('The path is not allowed: ' . self::RELATIVE_FILE_PATH); + + $this->mediaModel->launch(); } /** @@ -228,4 +234,42 @@ public function catchExceptionDataProvider() 'developer mode' => [true, 1], ]; } + + /** + * Generates Media class instance for test + * + * @param bool $isAllowed + * @return Media + */ + protected function getMediaModel(bool $isAllowed = true): Media + { + $objectManager = new ObjectManager($this); + + $isAllowedCallback = function () use ($isAllowed) { + return $isAllowed; + }; + + /** @var Media $mediaClass */ + $mediaClass = $objectManager->getObject( + Media::class, + [ + 'configFactory' => $this->configFactoryMock, + 'syncFactory' => $this->syncFactoryMock, + 'response' => $this->responseMock, + 'isAllowed' => $isAllowedCallback, + 'mediaDirectory' => false, + 'configCacheFile' => self::CACHE_FILE_PATH, + 'relativeFileName' => self::RELATIVE_FILE_PATH, + 'filesystem' => $this->filesystemMock, + 'placeholderFactory' => $this->createConfiguredMock( + PlaceholderFactory::class, + [ + 'create' => $this->createMock(Placeholder::class) + ] + ), + ] + ); + + return $mediaClass; + } } From 13f34cd6e15c0e1ce1b1183761d3ca4bfc318c22 Mon Sep 17 00:00:00 2001 From: Marco Oliveira <marcoaacoliveira@gmail.com> Date: Tue, 17 Dec 2019 15:14:50 -0300 Subject: [PATCH 0470/1143] Fixing #26083 --- app/code/Magento/Payment/Model/Info.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Payment/Model/Info.php b/app/code/Magento/Payment/Model/Info.php index 3b7f93be776ee..39a5a4cdc70a3 100644 --- a/app/code/Magento/Payment/Model/Info.php +++ b/app/code/Magento/Payment/Model/Info.php @@ -188,6 +188,7 @@ public function getAdditionalInformation($key = null) */ public function unsAdditionalInformation($key = null) { + $this->_initAdditionalInformation(); if ($key && isset($this->_additionalInformation[$key])) { unset($this->_additionalInformation[$key]); return $this->setData('additional_information', $this->_additionalInformation); From 8b7458e01f8c07a6f8de3718df318eb236366469 Mon Sep 17 00:00:00 2001 From: Denis Kopylov <dkopylov@magenius.team> Date: Tue, 17 Dec 2019 22:21:06 +0300 Subject: [PATCH 0471/1143] Resolve merge conflict for bug/wrong-behavior-of-grid-row-click --- .../Magento/Sales/view/adminhtml/web/order/create/scripts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js b/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js index a2be5fc735581..e138112ac3f5a 100644 --- a/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js +++ b/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js @@ -169,7 +169,7 @@ define([ }, selectAddress: function (el, container) { - id = el.value; + var id = el.value; if (id.length == 0) { id = '0'; } From 32227d2773836da0574db70fac8aad46ac0dad83 Mon Sep 17 00:00:00 2001 From: Marco Oliveira <marcoaacoliveira@gmail.com> Date: Tue, 17 Dec 2019 16:37:50 -0300 Subject: [PATCH 0472/1143] Removing an unnecessary , --- app/code/Magento/Payment/Model/Info.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Payment/Model/Info.php b/app/code/Magento/Payment/Model/Info.php index 39a5a4cdc70a3..3ca9b072e8321 100644 --- a/app/code/Magento/Payment/Model/Info.php +++ b/app/code/Magento/Payment/Model/Info.php @@ -38,7 +38,7 @@ class Info extends AbstractExtensibleModel implements InfoInterface * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory - * @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory, + * @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Framework\Encryption\EncryptorInterface $encryptor * @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource From f6df6cd490cedf6f75d9800bd33ad357516091b5 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Tue, 17 Dec 2019 16:07:03 -0600 Subject: [PATCH 0473/1143] Change action groups name according to CE branch changes --- ...roductAttributeByAttributeCodeActionGroup.xml | 16 +++++----------- ...pdownProductAttributeFromAttributeSetTest.xml | 7 +++++-- .../Test/AdminDeleteProductAttributeTest.xml | 7 +++++-- ...FieldProductAttributeFromAttributeSetTest.xml | 7 +++++-- ...eteUsedInConfigurableProductAttributeTest.xml | 2 +- ...minCheckResultsOfColorAndOtherFiltersTest.xml | 4 ++-- ...frontElasticsearch6SearchInvalidValueTest.xml | 7 +++++-- ...AdminCartRulesAppliedForProductInCartTest.xml | 1 + ...roductWithAttributesImagesAndSwatchesTest.xml | 7 +++++-- 9 files changed, 34 insertions(+), 24 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductAttributeByAttributeCodeActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductAttributeByAttributeCodeActionGroup.xml index 7fbf6a9b2a178..ddba6649161ef 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductAttributeByAttributeCodeActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductAttributeByAttributeCodeActionGroup.xml @@ -10,21 +10,15 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="DeleteProductAttributeByAttributeCodeActionGroup"> <annotations> - <description>Goes to the Admin Product Attributes grid page. Filters the grid for the provided Product Attribute Code. Deletes the Product Attribute from the grid. Validates that the Success Message is present.</description> + <description>Delete a Product Attribute from the Product Attribute creation/edit page.</description> </annotations> <arguments> - <argument name="ProductAttributeCode" type="string"/> + <argument name="productAttributeCode" type="string"/> </arguments> - <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/> - <waitForPageLoad stepKey="waitForAttributeGridPageLoad"/> - <fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" userInput="{{ProductAttributeCode}}" stepKey="setAttributeCode"/> - <click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="searchForAttributeFromTheGrid"/> - <click selector="{{AdminProductAttributeGridSection.FirstRow}}" stepKey="clickOnAttributeRow"/> - <waitForPageLoad stepKey="waitForPageLoad2"/> + <waitForPageLoad stepKey="waitForViewAdminProductAttributeLoad" time="30"/> <click selector="{{AttributePropertiesSection.DeleteAttribute}}" stepKey="deleteAttribute"/> - <click selector="{{ModalConfirmationSection.OkButton}}" stepKey="ClickOnDeleteButton"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="waitForSuccessMessage"/> + <click selector="{{ModalConfirmationSection.OkButton}}" stepKey="clickOnConfirmOk"/> + <waitForPageLoad stepKey="waitForViewProductAttributePageLoad"/> </actionGroup> </actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteDropdownProductAttributeFromAttributeSetTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteDropdownProductAttributeFromAttributeSetTest.xml index bded224a86563..3abe68a503b57 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteDropdownProductAttributeFromAttributeSetTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteDropdownProductAttributeFromAttributeSetTest.xml @@ -49,8 +49,11 @@ <waitForPageLoad stepKey="waitForPageToSave"/> <see userInput="You saved the attribute set" selector="{{AdminMessagesSection.success}}" stepKey="successMessage"/> <!--Delete product attribute from product attribute grid --> - <actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteProductAttribute"> - <argument name="ProductAttributeCode" value="$$attribute.attribute_code$$"/> + <actionGroup ref="OpenProductAttributeFromSearchResultInGridActionGroup" stepKey="openProductAttributeFromSearchResultInGrid"> + <argument name="productAttributeCode" value="$$attribute.attribute_code$$"/> + </actionGroup> + <actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteProductAttributeByAttributeCode"> + <argument name="productAttributeCode" value="$$attribute.attribute_code$$"/> </actionGroup> <actionGroup ref="AssertProductAttributeRemovedSuccessfullyActionGroup" stepKey="deleteProductAttributeSuccess"/> <!--Confirm Attribute is not present in Product Attribute Grid --> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductAttributeTest.xml index f81b05c61a669..4060182a9bace 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductAttributeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductAttributeTest.xml @@ -24,8 +24,11 @@ <after> <actionGroup ref="logout" stepKey="logout"/> </after> - <actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteProductAttribute"> - <argument name="ProductAttributeCode" value="$$createProductAttribute.attribute_code$$"/> + <actionGroup ref="OpenProductAttributeFromSearchResultInGridActionGroup" stepKey="openProductAttributeFromSearchResultInGrid"> + <argument name="productAttributeCode" value="$$createProductAttribute.attribute_code$$"/> + </actionGroup> + <actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteProductAttributeByAttributeCode"> + <argument name="productAttributeCode" value="$$createProductAttribute.attribute_code$$"/> </actionGroup> <actionGroup ref="AssertProductAttributeRemovedSuccessfullyActionGroup" stepKey="deleteProductAttributeSuccess"/> <!-- Assert the product attribute is not in the grid by Attribute code --> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteTextFieldProductAttributeFromAttributeSetTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteTextFieldProductAttributeFromAttributeSetTest.xml index f5fc104fa2b8d..4f05c364fda0e 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteTextFieldProductAttributeFromAttributeSetTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteTextFieldProductAttributeFromAttributeSetTest.xml @@ -55,8 +55,11 @@ <waitForPageLoad stepKey="waitForProductToLoad"/> <seeElement selector="{{AdminProductFormSection.newAddedAttribute($$attribute.attribute_code$$)}}" stepKey="seeProductAttributeIsAdded"/> <!--Delete product attribute from product attribute grid --> - <actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteProductAttribute"> - <argument name="ProductAttributeCode" value="$$attribute.attribute_code$$"/> + <actionGroup ref="OpenProductAttributeFromSearchResultInGridActionGroup" stepKey="openProductAttributeFromSearchResultInGrid"> + <argument name="productAttributeCode" value="$$attribute.attribute_code$$"/> + </actionGroup> + <actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteProductAttributeByAttributeCode"> + <argument name="productAttributeCode" value="$$attribute.attribute_code$$"/> </actionGroup> <actionGroup ref="AssertProductAttributeRemovedSuccessfullyActionGroup" stepKey="deleteProductAttributeSuccess"/> <!-- Confirm attribute is not present in product attribute grid --> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/DeleteUsedInConfigurableProductAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/DeleteUsedInConfigurableProductAttributeTest.xml index 6706175a4da54..0daf8361ef9d1 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/DeleteUsedInConfigurableProductAttributeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/DeleteUsedInConfigurableProductAttributeTest.xml @@ -81,7 +81,7 @@ <!-- Click Delete Attribute button --> <actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteProductAttributeByAttributeCode"> - <argument name="ProductAttributeCode" value="$$productAttributeHandle.attribute_code$$"/> + <argument name="productAttributeCode" value="$$productAttributeHandle.attribute_code$$"/> </actionGroup> <!-- Should see error message: This attribute is used in configurable products. --> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckResultsOfColorAndOtherFiltersTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckResultsOfColorAndOtherFiltersTest.xml index 826718de80d5b..fabd4a2c253b6 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckResultsOfColorAndOtherFiltersTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckResultsOfColorAndOtherFiltersTest.xml @@ -95,14 +95,14 @@ <argument name="productAttributeCode" value="$$createConfigProductAttribute.attribute_code$$"/> </actionGroup> <actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteProductAttributeByAttributeCode"> - <argument name="ProductAttributeCode" value="$$createConfigProductAttribute.attribute_code$$"/> + <argument name="productAttributeCode" value="$$createConfigProductAttribute.attribute_code$$"/> </actionGroup> <!-- Delete Second attribute --> <actionGroup ref="OpenProductAttributeFromSearchResultInGridActionGroup" stepKey="openSecondProductAttributeFromSearchResultInGrid"> <argument name="productAttributeCode" value="$$createConfigProductAttribute2.attribute_code$$"/> </actionGroup> <actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteSecondProductAttributeByAttributeCode"> - <argument name="ProductAttributeCode" value="$$createConfigProductAttribute2.attribute_code$$"/> + <argument name="productAttributeCode" value="$$createConfigProductAttribute2.attribute_code$$"/> </actionGroup> <actionGroup ref="AssertProductAttributeRemovedSuccessfullyActionGroup" stepKey="deleteProductAttributeSuccess"/> <!-- Clear filters --> diff --git a/app/code/Magento/Elasticsearch6/Test/Mftf/Test/StorefrontElasticsearch6SearchInvalidValueTest.xml b/app/code/Magento/Elasticsearch6/Test/Mftf/Test/StorefrontElasticsearch6SearchInvalidValueTest.xml index 1d171664a21f2..050ce1263d10d 100644 --- a/app/code/Magento/Elasticsearch6/Test/Mftf/Test/StorefrontElasticsearch6SearchInvalidValueTest.xml +++ b/app/code/Magento/Elasticsearch6/Test/Mftf/Test/StorefrontElasticsearch6SearchInvalidValueTest.xml @@ -34,8 +34,11 @@ <magentoCLI command="config:set {{SetMinQueryLength3Config.path}} {{SetMinQueryLength3Config.value}}" stepKey="setMinQueryLengthPreviousState"/> <!--Delete created data--> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteProductAttribute"> - <argument name="ProductAttributeCode" value="{{textProductAttribute.attribute_code}}"/> + <actionGroup ref="OpenProductAttributeFromSearchResultInGridActionGroup" stepKey="openProductAttributeFromSearchResultInGrid"> + <argument name="productAttributeCode" value="{{textProductAttribute.attribute_code}}"/> + </actionGroup> + <actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteProductAttributeByAttributeCode"> + <argument name="productAttributeCode" value="{{textProductAttribute.attribute_code}}"/> </actionGroup> <actionGroup ref="AssertProductAttributeRemovedSuccessfullyActionGroup" stepKey="deleteProductAttributeSuccess"/> <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCartRulesAppliedForProductInCartTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCartRulesAppliedForProductInCartTest.xml index e493ea389f389..916416dcd9141 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCartRulesAppliedForProductInCartTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCartRulesAppliedForProductInCartTest.xml @@ -99,6 +99,7 @@ <!--Go to Storefront and add product to cart and checkout from cart--> <amOnPage url="{{StorefrontProductPage.url($$simpleProduct.custom_attributes[url_key]$$)}}" stepKey="goToProductPage"/> + <waitForPageLoad stepKey="waitForProductPage" /> <fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="2" stepKey="setQuantity"/> <actionGroup ref="StorefrontAddToCartCustomOptionsProductPageActionGroup" stepKey="AddProductToCard"> <argument name="productName" value="$$simpleProduct.name$$"/> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/AdminSaveConfigurableProductWithAttributesImagesAndSwatchesTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/AdminSaveConfigurableProductWithAttributesImagesAndSwatchesTest.xml index a9e70193dd876..d034faeefbdc0 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/AdminSaveConfigurableProductWithAttributesImagesAndSwatchesTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/AdminSaveConfigurableProductWithAttributesImagesAndSwatchesTest.xml @@ -59,8 +59,11 @@ </before> <after> <!-- Delete product attribute and clear grid filter --> - <actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteProductAttribute"> - <argument name="ProductAttributeCode" value="{{VisualSwatchProductAttribute.attribute_code}}"/> + <actionGroup ref="OpenProductAttributeFromSearchResultInGridActionGroup" stepKey="openProductAttributeFromSearchResultInGrid"> + <argument name="productAttributeCode" value="{{VisualSwatchProductAttribute.attribute_code}}"/> + </actionGroup> + <actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteProductAttributeByAttributeCode"> + <argument name="productAttributeCode" value="{{VisualSwatchProductAttribute.attribute_code}}"/> </actionGroup> <actionGroup ref="AssertProductAttributeRemovedSuccessfullyActionGroup" stepKey="deleteProductAttributeSuccess"/> <actionGroup ref="AdminGridFilterResetActionGroup" stepKey="clearAttributesGridFilter"/> From 7c6bbe36676a453c567b7928c5ad434d02ec0d98 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Tue, 17 Dec 2019 16:40:15 -0600 Subject: [PATCH 0474/1143] Change action groups name according to CE branch changes --- .../Test/Mftf/Test/AdminVirtualSetEditRelatedProductsTest.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminVirtualSetEditRelatedProductsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminVirtualSetEditRelatedProductsTest.xml index a8d8face1a1e6..f70f5757ec5c2 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminVirtualSetEditRelatedProductsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminVirtualSetEditRelatedProductsTest.xml @@ -17,6 +17,9 @@ <severity value="CRITICAL"/> <testCaseId value="MC-3415"/> <group value="Catalog"/> + <skip> + <issueId value="MC-194"/> + </skip> </annotations> <before></before> <after> From a77faf33bff263f273de6942f2c495676364df17 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Wed, 18 Dec 2019 07:51:37 +0700 Subject: [PATCH 0475/1143] Refactor code to pass review --- .../Listing/Column/SynonymActionsTest.php | 51 ++++++++++++++----- 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/app/code/Magento/Search/Test/Unit/Ui/Component/Listing/Column/SynonymActionsTest.php b/app/code/Magento/Search/Test/Unit/Ui/Component/Listing/Column/SynonymActionsTest.php index 7ba1eab0437f0..d5563ec1cb289 100644 --- a/app/code/Magento/Search/Test/Unit/Ui/Component/Listing/Column/SynonymActionsTest.php +++ b/app/code/Magento/Search/Test/Unit/Ui/Component/Listing/Column/SynonymActionsTest.php @@ -16,6 +16,21 @@ class SynonymActionsTest extends TestCase { + /** + * Stub synonym group id + */ + private const STUB_SYNONYM_GROUP_ID = 1; + + /** + * Synonym group delete url + */ + private const SYNONYM_GROUP_DELETE_URL = 'http://localhost/magento2/admin/search/synonyms/delete/group_id/%d'; + + /** + * Synonym group edit url + */ + private const SYNONYM_GROUP_EDIT_URL = 'http://localhost/magento2/admin/search/synonyms/edit/group_id/%d'; + /** * @var SynonymActions */ @@ -72,31 +87,38 @@ public function testPrepareDataSourceWithItems() 'data' => [ 'items' => [ [ - 'group_id' => 1 + 'group_id' => self::STUB_SYNONYM_GROUP_ID ] ] ] ]; + $expected = [ 'data' => [ 'items' => [ [ - 'group_id' => 1, + 'group_id' => self::STUB_SYNONYM_GROUP_ID, 'actions' => [ 'delete' => [ - 'href' => 'http://localhost/magento2/admin/search/synonyms/delete/group_id/1', + 'href' => sprintf( + self::SYNONYM_GROUP_DELETE_URL, + self::STUB_SYNONYM_GROUP_ID + ), 'label' => (string)__('Delete'), 'confirm' => [ 'title' => (string)__('Delete'), 'message' => (string)__( 'Are you sure you want to delete synonym group with id: %1?', - 1 + self::STUB_SYNONYM_GROUP_ID ) ], '__disableTmpl' => true ], 'edit' => [ - 'href' => 'http://localhost/magento2/admin/search/synonyms/edit/group_id/1', + 'href' => sprintf( + self::SYNONYM_GROUP_EDIT_URL, + self::STUB_SYNONYM_GROUP_ID + ), 'label' => (string)__('View/Edit'), '__disableTmpl' => true ] @@ -106,13 +128,18 @@ public function testPrepareDataSourceWithItems() ] ]; - $this->urlBuilderMock->expects($this->at(0))->method('getUrl') - ->with(SynonymActions::SYNONYM_URL_PATH_DELETE, ['group_id' => 1]) - ->willReturn('http://localhost/magento2/admin/search/synonyms/delete/group_id/1'); - - $this->urlBuilderMock->expects($this->at(1))->method('getUrl') - ->with(SynonymActions::SYNONYM_URL_PATH_EDIT, ['group_id' => 1]) - ->willReturn('http://localhost/magento2/admin/search/synonyms/edit/group_id/1'); + $this->urlBuilderMock->method('getUrl')->will( + $this->returnValueMap([ + [ + SynonymActions::SYNONYM_URL_PATH_DELETE, ['group_id' => self::STUB_SYNONYM_GROUP_ID], + sprintf(self::SYNONYM_GROUP_DELETE_URL, self::STUB_SYNONYM_GROUP_ID) + ], + [ + SynonymActions::SYNONYM_URL_PATH_EDIT, ['group_id' => self::STUB_SYNONYM_GROUP_ID], + sprintf(self::SYNONYM_GROUP_EDIT_URL, self::STUB_SYNONYM_GROUP_ID) + ] + ]) + ); /** * Assert Result From 85036fa5f76417765a42d66ebb50a93de00e8532 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Wed, 18 Dec 2019 09:00:55 +0700 Subject: [PATCH 0476/1143] Refactor code to pass review --- ...sEventOrderItemToQuoteItemObserverTest.php | 153 +++++++++++------- 1 file changed, 91 insertions(+), 62 deletions(-) diff --git a/app/code/Magento/GiftMessage/Test/Unit/Observer/SalesEventOrderItemToQuoteItemObserverTest.php b/app/code/Magento/GiftMessage/Test/Unit/Observer/SalesEventOrderItemToQuoteItemObserverTest.php index 1df1c1101ccd1..5ac75caa4b512 100644 --- a/app/code/Magento/GiftMessage/Test/Unit/Observer/SalesEventOrderItemToQuoteItemObserverTest.php +++ b/app/code/Magento/GiftMessage/Test/Unit/Observer/SalesEventOrderItemToQuoteItemObserverTest.php @@ -93,7 +93,10 @@ class SalesEventOrderItemToQuoteItemObserverTest extends TestCase */ public function setUp(): void { - $this->messageFactoryMock = $this->createMock(MessageFactory::class); + $this->messageFactoryMock = $this->getMockBuilder(MessageFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); $this->giftMessageHelperMock = $this->createMock(MessageHelper::class); $this->observerMock = $this->createMock(Observer::class); $this->eventMock = $this->createPartialMock(Event::class, ['getOrderItem', 'getQuoteItem']); @@ -106,6 +109,18 @@ public function setUp(): void $this->storeMock = $this->createMock(Store::class); $this->messageMock = $this->createMock(MessageModel::class); + $this->eventMock->expects($this->atLeastOnce()) + ->method('getOrderItem') + ->willReturn($this->orderItemMock); + + $this->orderItemMock->expects($this->atLeastOnce()) + ->method('getOrder') + ->willReturn($this->orderMock); + + $this->observerMock->expects($this->atLeastOnce()) + ->method('getEvent') + ->willReturn($this->eventMock); + $objectManager = new ObjectManager($this); $this->observer = $objectManager->getObject( @@ -118,79 +133,93 @@ public function setUp(): void } /** - * Tests duplicating gift message from order item to quote item - * - * @param bool $orderIsReordered - * @param bool $isMessagesAllowed - * @dataProvider giftMessageDataProvider + * Test when the order is reorder */ - public function testExecute($orderIsReordered, $isMessagesAllowed) + public function testReorder() { - $this->eventMock->expects($this->atLeastOnce()) - ->method('getOrderItem') - ->willReturn($this->orderItemMock); + $this->orderMock->expects($this->once()) + ->method('getReordered') + ->willReturn(true); - $this->orderItemMock->expects($this->atLeastOnce()) - ->method('getOrder') - ->willReturn($this->orderMock); + $this->giftMessageHelperMock->expects($this->never()) + ->method('isMessagesAllowed'); - $this->observerMock->expects($this->atLeastOnce()) - ->method('getEvent') - ->willReturn($this->eventMock); + $this->eventMock + ->expects($this->never()) + ->method('getQuoteItem') + ->willReturn($this->quoteItemMock); + + /** Run observer */ + $this->observer->execute($this->observerMock); + } - if (!$orderIsReordered && $isMessagesAllowed) { - $this->eventMock - ->expects($this->atLeastOnce()) - ->method('getQuoteItem') - ->willReturn($this->quoteItemMock); - $this->orderMock->expects($this->once()) - ->method('getReordered') - ->willReturn($orderIsReordered); - $this->orderItemMock->expects($this->once()) - ->method('getGiftMessageId') - ->willReturn(self::STUB_MESSAGE_ID); - $this->giftMessageHelperMock->expects($this->once()) - ->method('isMessagesAllowed') - ->willReturn($isMessagesAllowed); - $this->messageFactoryMock->expects($this->once()) - ->method('create') - ->willReturn($this->messageMock); - $this->messageMock->expects($this->once()) - ->method('load') - ->with(self::STUB_MESSAGE_ID) - ->willReturnSelf(); - $this->messageMock->expects($this->once()) - ->method('setId') - ->with(null) - ->willReturnSelf(); - $this->messageMock->expects($this->once()) - ->method('save') - ->willReturnSelf(); - $this->messageMock->expects($this->once()) - ->method('getId') - ->willReturn(self::STUB_NEW_MESSAGE_ID); - $this->quoteItemMock->expects($this->once()) - ->method('setGiftMessageId') - ->with(self::STUB_NEW_MESSAGE_ID) - ->willReturnSelf(); - } + /** + * Test when the order is new reorder and gift message is not allowed + */ + public function testNewOrderWhenGiftMessageIsNotAllowed() + { + $this->orderMock->expects($this->once()) + ->method('getReordered') + ->willReturn(false); + + $this->giftMessageHelperMock->expects($this->once()) + ->method('isMessagesAllowed') + ->willReturn(false); + + $this->eventMock + ->expects($this->never()) + ->method('getQuoteItem') + ->willReturn($this->quoteItemMock); /** Run observer */ $this->observer->execute($this->observerMock); } /** - * Providing gift message data for test - * - * @return array + * Test when the order is new reorder and gift message is allowed */ - public function giftMessageDataProvider() + public function testNewOrderWhenGiftMessageIsAllowed() { - return [ - 'order is not reordered, messages is allowed' => [false, true], - 'order is reordered, messages is allowed' => [true, true], - 'order is reordered, messages is not allowed' => [true, false], - 'order is not reordered, messages is not allowed' => [false, false] - ]; + $this->orderMock->expects($this->once()) + ->method('getReordered') + ->willReturn(false); + + $this->giftMessageHelperMock->expects($this->once()) + ->method('isMessagesAllowed') + ->willReturn(true); + + $this->eventMock + ->expects($this->atLeastOnce()) + ->method('getQuoteItem') + ->willReturn($this->quoteItemMock); + + $this->orderItemMock->expects($this->once()) + ->method('getGiftMessageId') + ->willReturn(self::STUB_MESSAGE_ID); + + $this->messageFactoryMock->expects($this->once()) + ->method('create') + ->willReturn($this->messageMock); + $this->messageMock->expects($this->once()) + ->method('load') + ->with(self::STUB_MESSAGE_ID) + ->willReturnSelf(); + $this->messageMock->expects($this->once()) + ->method('setId') + ->with(null) + ->willReturnSelf(); + $this->messageMock->expects($this->once()) + ->method('save') + ->willReturnSelf(); + $this->messageMock->expects($this->once()) + ->method('getId') + ->willReturn(self::STUB_NEW_MESSAGE_ID); + $this->quoteItemMock->expects($this->once()) + ->method('setGiftMessageId') + ->with(self::STUB_NEW_MESSAGE_ID) + ->willReturnSelf(); + + /** Run observer */ + $this->observer->execute($this->observerMock); } } From b92c9aacc8d2ff658c197bbbcb924c8fb16f9fd3 Mon Sep 17 00:00:00 2001 From: pawankparmar <comp1@comp1-All-Series> Date: Wed, 18 Dec 2019 10:42:28 +0530 Subject: [PATCH 0477/1143] Remove extra spaces --- .../FormattedPriceInfoInterface.php | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/app/code/Magento/Catalog/Api/Data/ProductRender/FormattedPriceInfoInterface.php b/app/code/Magento/Catalog/Api/Data/ProductRender/FormattedPriceInfoInterface.php index 5f192dcd98a17..65ff84ef719f0 100644 --- a/app/code/Magento/Catalog/Api/Data/ProductRender/FormattedPriceInfoInterface.php +++ b/app/code/Magento/Catalog/Api/Data/ProductRender/FormattedPriceInfoInterface.php @@ -23,7 +23,7 @@ interface FormattedPriceInfoInterface extends \Magento\Framework\Api\ExtensibleD * Retrieve html with final price * * @return string - * @since 101.1.0 + * @since 101.1.0 */ public function getFinalPrice(); @@ -31,9 +31,9 @@ public function getFinalPrice(); * Set the final price: usually it calculated as minimal price of the product * Can be different depends on type of product * - * @param string $finalPrice + * @param string $finalPrice * @return void - * @since 101.1.0 + * @since 101.1.0 */ public function setFinalPrice($finalPrice); @@ -42,16 +42,16 @@ public function setFinalPrice($finalPrice); * E.g. for product with custom options is price with the most expensive custom option * * @return string - * @since 101.1.0 + * @since 101.1.0 */ public function getMaxPrice(); /** * Set the max price of the product * - * @param string $maxPrice + * @param string $maxPrice * @return void - * @since 101.1.0 + * @since 101.1.0 */ public function setMaxPrice($maxPrice); @@ -60,7 +60,7 @@ public function setMaxPrice($maxPrice); * The minimal price is for example, the lowest price of all variations for complex product * * @return string - * @since 101.1.0 + * @since 101.1.0 */ public function getMinimalPrice(); @@ -69,9 +69,9 @@ public function getMinimalPrice(); * Max regular price is the same, as maximum price, except of excluding calculating special price and catalog rules * in it * - * @param string $maxRegularPrice + * @param string $maxRegularPrice * @return void - * @since 101.1.0 + * @since 101.1.0 */ public function setMaxRegularPrice($maxRegularPrice); @@ -79,16 +79,16 @@ public function setMaxRegularPrice($maxRegularPrice); * Retrieve max regular price * * @return string - * @since 101.1.0 + * @since 101.1.0 */ public function getMaxRegularPrice(); /** * The minimal regular price has the same behavior of calculation as max regular price, but is opposite price * - * @param string $minRegularPrice + * @param string $minRegularPrice * @return void - * @since 101.1.0 + * @since 101.1.0 */ public function setMinimalRegularPrice($minRegularPrice); @@ -96,7 +96,7 @@ public function setMinimalRegularPrice($minRegularPrice); * Retrieve minimal regular price * * @return string - * @since 101.1.0 + * @since 101.1.0 */ public function getMinimalRegularPrice(); @@ -105,9 +105,9 @@ public function getMinimalRegularPrice(); * * Special price - is temporary price, that can be set to specific product * - * @param string $specialPrice + * @param string $specialPrice * @return void - * @since 101.1.0 + * @since 101.1.0 */ public function setSpecialPrice($specialPrice); @@ -115,16 +115,16 @@ public function setSpecialPrice($specialPrice); * Retrieve special price * * @return string - * @since 101.1.0 + * @since 101.1.0 */ public function getSpecialPrice(); /** * Set minimal price * - * @param string $minimalPrice + * @param string $minimalPrice * @return void - * @since 101.1.0 + * @since 101.1.0 */ public function setMinimalPrice($minimalPrice); @@ -133,16 +133,16 @@ public function setMinimalPrice($minimalPrice); * Usually this price is corresponding to price in admin panel of product * * @return string - * @since 101.1.0 + * @since 101.1.0 */ public function getRegularPrice(); /** * Set regular price * - * @param string $regularPrice + * @param string $regularPrice * @return void - * @since 101.1.0 + * @since 101.1.0 */ public function setRegularPrice($regularPrice); @@ -150,18 +150,18 @@ public function setRegularPrice($regularPrice); * Retrieve existing extension attributes object or create a new one. * * @return \Magento\Catalog\Api\Data\ProductRender\FormattedPriceInfoExtensionInterface|null - * @since 101.1.0 + * @since 101.1.0 */ public function getExtensionAttributes(); /** * Set an extension attributes object. * - * @param \Magento\Catalog\Api\Data\ProductRender\FormattedPriceInfoExtensionInterface $extensionAttributes + * @param \Magento\Catalog\Api\Data\ProductRender\FormattedPriceInfoExtensionInterface $extensionAttributes * @return $this - * @since 101.1.0 + * @since 101.1.0 */ public function setExtensionAttributes( \Magento\Catalog\Api\Data\ProductRender\FormattedPriceInfoExtensionInterface $extensionAttributes ); -} \ No newline at end of file +} From d2a4865fee168c7b0e143346609f729b13e1c8bc Mon Sep 17 00:00:00 2001 From: Grzegorz Bogusz <grzegorz.bogusz@creativestyle.pl> Date: Wed, 18 Dec 2019 06:58:02 +0100 Subject: [PATCH 0478/1143] Added @SuppressWarnings(PHPMD.CookieAndSessionMisuse) to Text class --- app/code/Magento/Catalog/Model/Product/Option/Type/Text.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php b/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php index 10584026b3218..71a6556dc8858 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php @@ -10,6 +10,8 @@ /** * Catalog product option text type + * + * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) */ class Text extends \Magento\Catalog\Model\Product\Option\Type\DefaultType { From 6e68a470c5ed94ba4f1cd9a031fc81e5b99907fd Mon Sep 17 00:00:00 2001 From: Grzegorz Bogusz <grzegorz.bogusz@creativestyle.pl> Date: Wed, 18 Dec 2019 07:03:13 +0100 Subject: [PATCH 0479/1143] Organized imports in test class --- .../Magento/Catalog/Model/Product/Option/Type/TextTest.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/TextTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/TextTest.php index 194c0eb85a59e..74082c339bd79 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/TextTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/TextTest.php @@ -7,10 +7,9 @@ namespace Magento\Catalog\Model\Product\Option\Type; use Magento\Catalog\Model\Product\Option; -use Magento\Tests\NamingConvention\true\mixed; -use PHPUnit\Framework\TestCase; use Magento\Framework\ObjectManagerInterface; use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; /** * Test for customizable product option with "Text" type From e830f2e93ffb37a48d149ad4f4a3a18bcbe218a4 Mon Sep 17 00:00:00 2001 From: divyajyothi5321 <54176640+divyajyothi5321@users.noreply.github.com> Date: Wed, 18 Dec 2019 12:37:36 +0530 Subject: [PATCH 0480/1143] Added requested Changes --- app/code/Magento/Wishlist/Controller/Index/Send.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/Wishlist/Controller/Index/Send.php b/app/code/Magento/Wishlist/Controller/Index/Send.php index 1ff4e3a653a2d..f0bd2c4b4b37c 100644 --- a/app/code/Magento/Wishlist/Controller/Index/Send.php +++ b/app/code/Magento/Wishlist/Controller/Index/Send.php @@ -27,7 +27,6 @@ /** * Class Send * - * @package Magento\Wishlist\Controller\Index * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Send extends \Magento\Wishlist\Controller\AbstractIndex implements Action\HttpPostActionInterface From b2a3277a89d1fc1007e9afd25ebfa83e012f662a Mon Sep 17 00:00:00 2001 From: Mykhailo Matiola <mykhailo.matiola@transoftgroup.com> Date: Wed, 18 Dec 2019 09:23:11 +0200 Subject: [PATCH 0481/1143] MC-25192: Sorting products in category page --- .../Block/Product/ListProduct/SortingTest.php | 321 ++++++++++++++++++ ...not_empty_layered_navigation_attribute.php | 49 +++ ..._layered_navigation_attribute_rollback.php | 8 + 3 files changed, 378 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ListProduct/SortingTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/products_with_not_empty_layered_navigation_attribute.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/products_with_not_empty_layered_navigation_attribute_rollback.php diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ListProduct/SortingTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ListProduct/SortingTest.php new file mode 100644 index 0000000000000..d3c7972453a4b --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ListProduct/SortingTest.php @@ -0,0 +1,321 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Block\Product\ListProduct; + +use Magento\Catalog\Api\CategoryRepositoryInterface; +use Magento\Catalog\Api\Data\CategoryInterface; +use Magento\Catalog\Block\Product\ListProduct; +use Magento\Catalog\Block\Product\ProductList\Toolbar; +use Magento\Catalog\Model\Config; +use Magento\Catalog\Model\ResourceModel\Category\Collection; +use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory; +use Magento\Framework\App\Config\MutableScopeConfigInterface; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\View\LayoutInterface; +use Magento\Store\Model\ScopeInterface; +use Magento\Store\Model\Store; +use Magento\Store\Model\StoreManagerInterface; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; + +/** + * Tests for products sorting on category page. + * + * @magentoDbIsolation disabled + * @magentoAppIsolation enabled + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class SortingTest extends TestCase +{ + /** + * @var ObjectManagerInterface + */ + private $objectManager; + + /** + * @var ListProduct + */ + private $block; + + /** + * @var CollectionFactory + */ + private $categoryCollectionFactory; + + /** + * @var CategoryRepositoryInterface + */ + private $categoryRepository; + + /** + * @var StoreManagerInterface + */ + private $storeManager; + + /** + * @var LayoutInterface + */ + private $layout; + + /** + * @var MutableScopeConfigInterface + */ + private $scopeConfig; + + /** + * @inheritdoc + */ + protected function setUp() + { + $this->objectManager = Bootstrap::getObjectManager(); + $this->storeManager = $this->objectManager->get(StoreManagerInterface::class); + $this->layout = $this->objectManager->get(LayoutInterface::class); + $this->layout->createBlock(Toolbar::class, 'product_list_toolbar'); + $this->block = $this->layout->createBlock(ListProduct::class)->setToolbarBlockName('product_list_toolbar'); + $this->categoryCollectionFactory = $this->objectManager->get(CollectionFactory::class); + $this->categoryRepository = $this->objectManager->get(CategoryRepositoryInterface::class); + $this->scopeConfig = $this->objectManager->get(MutableScopeConfigInterface::class); + parent::setUp(); + } + + /** + * @magentoDataFixture Magento/Catalog/_files/products_with_not_empty_layered_navigation_attribute.php + * @dataProvider productListSortOrderDataProvider + * @param string $sortBy + * @param string $direction + * @param array $expectation + * @return void + */ + public function testProductListSortOrder(string $sortBy, string $direction, array $expectation): void + { + $category = $this->updateCategorySortBy('Category 1', Store::DEFAULT_STORE_ID, $sortBy); + $this->renderBlock($category, $direction); + $this->assertBlockSorting($sortBy, $expectation); + } + + /** + * @magentoDataFixture Magento/Catalog/_files/products_with_not_empty_layered_navigation_attribute.php + * @dataProvider productListSortOrderDataProvider + * @param string $sortBy + * @param string $direction + * @param array $expectation + * @return void + */ + public function testProductListSortOrderWithConfig(string $sortBy, string $direction, array $expectation): void + { + $this->objectManager->removeSharedInstance(Config::class); + $this->scopeConfig->setValue( + Config::XML_PATH_LIST_DEFAULT_SORT_BY, + $sortBy, + ScopeInterface::SCOPE_STORE, + Store::DEFAULT_STORE_ID + ); + $category = $this->updateCategorySortBy('Category 1', Store::DEFAULT_STORE_ID, null); + $this->renderBlock($category, $direction); + $this->assertBlockSorting($sortBy, $expectation); + } + + /** + * @return array + */ + public function productListSortOrderDataProvider(): array + { + return [ + 'default_order_price_asc' => [ + 'sort' => 'price', + 'direction' => 'asc', + 'expectation' => ['simple1', 'simple2', 'simple3'], + ], + 'default_order_price_desc' => [ + 'sort' => 'price', + 'direction' => 'desc', + 'expectation' => ['simple3', 'simple2', 'simple1'], + ], + 'default_order_position_asc' => [ + 'sort' => 'position', + 'direction' => 'asc', + 'expectation' => ['simple1', 'simple2', 'simple3'], + ], + 'default_order_position_desc' => [ + 'sort' => 'position', + 'direction' => 'desc', + 'expectation' => ['simple3', 'simple2', 'simple1'], + ], + 'default_order_name_asc' => [ + 'sort' => 'name', + 'direction' => 'asc', + 'expectation' => ['simple1', 'simple2', 'simple3'], + ], + 'default_order_name_desc' => [ + 'sort' => 'name', + 'direction' => 'desc', + 'expectation' => ['simple3', 'simple2', 'simple1'], + ], + 'default_order_custom_attribute_asc' => [ + 'sort' => 'test_configurable', + 'direction' => 'asc', + 'expectation' => ['simple1', 'simple3', 'simple2'], + ], + 'default_order_custom_attribute_desc' => [ + 'sort' => 'test_configurable', + 'direction' => 'desc', + 'expectation' => ['simple3', 'simple2', 'simple1'], + ], + ]; + } + + /** + * @magentoDataFixture Magento/Store/_files/second_store.php + * @magentoDataFixture Magento/Catalog/_files/products_with_not_empty_layered_navigation_attribute.php + * @dataProvider productListSortOrderDataProviderOnStoreView + * @param string $sortBy + * @param string $direction + * @param array $expectation + * @param string $defaultSortBy + * @return void + */ + public function testProductListSortOrderOnStoreView( + string $sortBy, + string $direction, + array $expectation, + string $defaultSortBy + ): void { + $secondStoreId = (int)$this->storeManager->getStore('fixture_second_store')->getId(); + $this->updateCategorySortBy('Category 1', Store::DEFAULT_STORE_ID, $defaultSortBy); + $category = $this->updateCategorySortBy('Category 1', $secondStoreId, $sortBy); + $this->renderBlock($category, $direction); + $this->assertBlockSorting($sortBy, $expectation); + } + + /** + * @magentoDataFixture Magento/Store/_files/second_store.php + * @magentoDataFixture Magento/Catalog/_files/products_with_not_empty_layered_navigation_attribute.php + * @dataProvider productListSortOrderDataProviderOnStoreView + * @param string $sortBy + * @param string $direction + * @param array $expectation + * @param string $defaultSortBy + * @return void + */ + public function testProductListSortOrderWithConfigOnStoreView( + string $sortBy, + string $direction, + array $expectation, + string $defaultSortBy + ): void { + $this->objectManager->removeSharedInstance(Config::class); + $secondStoreId = (int)$this->storeManager->getStore('fixture_second_store')->getId(); + $this->scopeConfig->setValue( + Config::XML_PATH_LIST_DEFAULT_SORT_BY, + $defaultSortBy, + ScopeInterface::SCOPE_STORE, + Store::DEFAULT_STORE_ID + ); + $this->scopeConfig->setValue( + Config::XML_PATH_LIST_DEFAULT_SORT_BY, + $sortBy, + ScopeInterface::SCOPE_STORE, + 'fixture_second_store' + ); + $this->updateCategorySortBy('Category 1', Store::DEFAULT_STORE_ID, null); + $category = $this->updateCategorySortBy('Category 1', $secondStoreId, null); + $this->renderBlock($category, $direction); + $this->assertBlockSorting($sortBy, $expectation); + } + + /** + * @return array + */ + public function productListSortOrderDataProviderOnStoreView(): array + { + return array_merge_recursive( + $this->productListSortOrderDataProvider(), + [ + 'default_order_price_asc' => ['default_sort' => 'position'], + 'default_order_price_desc' => ['default_sort' => 'position'], + 'default_order_position_asc' => ['default_sort' => 'price'], + 'default_order_position_desc' => ['default_sort' => 'price'], + 'default_order_name_asc' => ['default_sort' => 'price'], + 'default_order_name_desc' => ['default_sort' => 'price'], + 'default_order_custom_attribute_asc' => ['default_sort' => 'price'], + 'default_order_custom_attribute_desc' => ['default_sort' => 'price'], + ] + ); + } + + /** + * Renders block to apply sorting. + * + * @param CategoryInterface $category + * @param string $direction + * @return void + */ + private function renderBlock(CategoryInterface $category, string $direction): void + { + $this->block->getLayer()->setCurrentCategory($category); + $this->block->setDefaultDirection($direction); + $this->block->toHtml(); + } + + /** + * Checks product list block correct sorting. + * + * @param string $sortBy + * @param array $expectation + * @return void + */ + private function assertBlockSorting(string $sortBy, array $expectation): void + { + $this->assertArrayHasKey($sortBy, $this->block->getAvailableOrders()); + $this->assertEquals($sortBy, $this->block->getSortBy()); + $this->assertEquals($expectation, $this->block->getLoadedProductCollection()->getColumnValues('sku')); + } + + /** + * Loads category by name. + * + * @param string $categoryName + * @param int $storeId + * @return CategoryInterface + */ + private function loadCategory(string $categoryName, int $storeId): CategoryInterface + { + /** @var Collection $categoryCollection */ + $categoryCollection = $this->categoryCollectionFactory->create(); + $categoryId = $categoryCollection->setStoreId($storeId) + ->addAttributeToFilter(CategoryInterface::KEY_NAME, $categoryName) + ->setPageSize(1) + ->getFirstItem() + ->getId(); + + return $this->categoryRepository->get($categoryId, $storeId); + } + + /** + * Updates category default sort by field. + * + * @param string $categoryName + * @param int $storeId + * @param string|null $sortBy + * @return CategoryInterface + */ + private function updateCategorySortBy( + string $categoryName, + int $storeId, + ?string $sortBy + ): CategoryInterface { + $oldStoreId = $this->storeManager->getStore()->getId(); + $this->storeManager->setCurrentStore($storeId); + $category = $this->loadCategory($categoryName, $storeId); + $category->addData(['default_sort_by' => $sortBy]); + $category = $this->categoryRepository->save($category); + $this->storeManager->setCurrentStore($oldStoreId); + + return $category; + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/products_with_not_empty_layered_navigation_attribute.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/products_with_not_empty_layered_navigation_attribute.php new file mode 100644 index 0000000000000..16268e5d98dc0 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/products_with_not_empty_layered_navigation_attribute.php @@ -0,0 +1,49 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\CategoryRepositoryInterface; +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Store\Model\Store; +use Magento\Store\Model\StoreManagerInterface; +use Magento\TestFramework\Helper\Bootstrap; + +require __DIR__ . '/products_with_layered_navigation_attribute.php'; + +$objectManager = Bootstrap::getObjectManager(); +/** @var StoreManagerInterface $storeManager */ +$storeManager = $objectManager->get(StoreManagerInterface::class); +/** @var ProductAttributeRepositoryInterface $attributeRepository */ +$attributeRepository = $objectManager->create(ProductAttributeRepositoryInterface::class); +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->create(ProductRepositoryInterface::class); +/** @var CategoryRepositoryInterface $categoryRepository */ +$categoryRepository = $objectManager->create(CategoryRepositoryInterface::class); +$attribute = $attributeRepository->get('test_configurable'); + +$firstProduct = $productRepository->get('simple1'); +$firstProduct->setData('test_configurable', $attribute->getSource()->getOptionId('Option 1')); +$productRepository->save($firstProduct); + +$secondProduct = $productRepository->get('simple2'); +$secondProduct->setData('test_configurable', $attribute->getSource()->getOptionId('Option 2')); +$productRepository->save($secondProduct); + +$thirdProduct = $productRepository->get('simple3'); +$thirdProduct->setData('test_configurable', $attribute->getSource()->getOptionId('Option 2')); +$thirdProduct->setStatus(Status::STATUS_ENABLED); +$productRepository->save($thirdProduct); + +$oldStoreId = $storeManager->getStore()->getId(); +$storeManager->setCurrentStore(Store::DEFAULT_STORE_ID); +$category->addData(['available_sort_by' => 'position,name,price,test_configurable']); +try { + $categoryRepository->save($category); +} finally { + $storeManager->setCurrentStore($oldStoreId); +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/products_with_not_empty_layered_navigation_attribute_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/products_with_not_empty_layered_navigation_attribute_rollback.php new file mode 100644 index 0000000000000..ae6dae0667801 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/products_with_not_empty_layered_navigation_attribute_rollback.php @@ -0,0 +1,8 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +require __DIR__ . '/products_with_layered_navigation_attribute_rollback.php'; From 0d220177689ce7ffbfcb29ed9316e46b708a02c5 Mon Sep 17 00:00:00 2001 From: divyajyothi5321 <54176640+divyajyothi5321@users.noreply.github.com> Date: Wed, 18 Dec 2019 13:53:30 +0530 Subject: [PATCH 0482/1143] Changes Added --- app/code/Magento/Wishlist/Controller/Index/Send.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Wishlist/Controller/Index/Send.php b/app/code/Magento/Wishlist/Controller/Index/Send.php index f0bd2c4b4b37c..b7c93473cde94 100644 --- a/app/code/Magento/Wishlist/Controller/Index/Send.php +++ b/app/code/Magento/Wishlist/Controller/Index/Send.php @@ -25,7 +25,7 @@ use Magento\Customer\Model\Customer; /** - * Class Send + * Class Send Email Wishlist Controller * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ From c4baf83e4d811ba436b4fdb1205f9abdf4f655f9 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Wed, 18 Dec 2019 15:57:24 +0700 Subject: [PATCH 0483/1143] Remove redundant line --- app/code/Magento/Sales/i18n/en_US.csv | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/Sales/i18n/en_US.csv b/app/code/Magento/Sales/i18n/en_US.csv index e468235ee38ed..970df2770a524 100644 --- a/app/code/Magento/Sales/i18n/en_US.csv +++ b/app/code/Magento/Sales/i18n/en_US.csv @@ -799,5 +799,4 @@ Refunds,Refunds "Allow Zero GrandTotal","Allow Zero GrandTotal" "Could not save the shipment tracking","Could not save the shipment tracking" "Please enter a coupon code!","Please enter a coupon code!" -"Please enter a coupon code!","Please enter a coupon code!" "Reorder is not available.","Reorder is not available." From 652ac7f9859068cddb5172acca5b2e195d3c1195 Mon Sep 17 00:00:00 2001 From: Mykhailo Matiola <mykhailo.matiola@transoftgroup.com> Date: Wed, 18 Dec 2019 11:57:53 +0200 Subject: [PATCH 0484/1143] MC-25146: Layered Navigation with different product attributes on Catalog Search Results page --- .../Magento/Test/Php/_files/phpstan/blacklist/common.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/blacklist/common.txt index 34965bda0dba6..4ac0984238828 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/blacklist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/blacklist/common.txt @@ -8,6 +8,7 @@ lib/internal/Magento/Framework/Cache/Backend/Eaccelerator.php dev/tests/integration/framework/deployTestModules.php dev/tests/integration/testsuite/Magento/Framework/Session/ConfigTest.php dev/tests/integration/testsuite/Magento/Framework/Session/SessionManagerTest.php +dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/AbstractFiltersTest.php dev/tests/api-functional/testsuite/Magento/Customer/Api/AddressRepositoryTest.php dev/tests/api-functional/testsuite/Magento/Framework/Model/Entity/HydratorTest.php dev/tests/api-functional/testsuite/Magento/Integration/Model/AdminTokenServiceTest.php From cc38f81c655b7287cd08c111838fb52df1a7a9f3 Mon Sep 17 00:00:00 2001 From: Mykhailo Matiola <mykhailo.matiola@transoftgroup.com> Date: Wed, 18 Dec 2019 13:18:29 +0200 Subject: [PATCH 0485/1143] MC-25146: Layered Navigation with different product attributes on Catalog Search Results page --- .../Magento/Test/Php/_files/phpstan/blacklist/common.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/blacklist/common.txt index 4ac0984238828..f54defbd57604 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/blacklist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/blacklist/common.txt @@ -9,6 +9,7 @@ dev/tests/integration/framework/deployTestModules.php dev/tests/integration/testsuite/Magento/Framework/Session/ConfigTest.php dev/tests/integration/testsuite/Magento/Framework/Session/SessionManagerTest.php dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/AbstractFiltersTest.php +dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/CategoryTest.php dev/tests/api-functional/testsuite/Magento/Customer/Api/AddressRepositoryTest.php dev/tests/api-functional/testsuite/Magento/Framework/Model/Entity/HydratorTest.php dev/tests/api-functional/testsuite/Magento/Integration/Model/AdminTokenServiceTest.php From f935b9a1a57060ee796388f9d5671e3162f91f38 Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Wed, 18 Dec 2019 15:00:48 +0200 Subject: [PATCH 0486/1143] Covering the ResetQuoteAddresses by Unit Test --- .../Unit/Plugin/ResetQuoteAddressesTest.php | 178 ++++++++++++++++++ 1 file changed, 178 insertions(+) create mode 100644 app/code/Magento/Checkout/Test/Unit/Plugin/ResetQuoteAddressesTest.php diff --git a/app/code/Magento/Checkout/Test/Unit/Plugin/ResetQuoteAddressesTest.php b/app/code/Magento/Checkout/Test/Unit/Plugin/ResetQuoteAddressesTest.php new file mode 100644 index 0000000000000..a8e0904c69780 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Unit/Plugin/ResetQuoteAddressesTest.php @@ -0,0 +1,178 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Checkout\Test\Unit\Plugin; + +use Magento\Checkout\Plugin\Model\Quote\ResetQuoteAddresses; +use Magento\Quote\Api\Data\CartExtensionInterface; +use Magento\Quote\Model\Quote; +use Magento\Quote\Model\Quote\Address; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +/** + * Class ResetQuoteAddressesTest + * + * Test of clearing quote addresses after all items were removed. + */ +class ResetQuoteAddressesTest extends TestCase +{ + /** + * @var ResetQuoteAddresses + */ + private $plugin; + + /** + * @var Quote|MockObject + */ + private $quoteMock; + + /** + * @var CartExtensionInterface|MockObject + */ + private $extensionAttributesMock; + + /** + * Set Up + */ + protected function setUp() + { + $this->quoteMock = $this->createPartialMock(Quote::class, + [ + 'getAllAddresses', + 'getAllVisibleItems', + 'removeAddress', + 'getExtensionAttributes', + 'isVirtual', + ] + ); + $this->extensionAttributesMock = $this->getMockBuilder(CartExtensionInterface::class) + ->setMethods( + [ + 'getShippingAssignments', + 'setShippingAssignments' + ] + ) + ->getMockForAbstractClass(); + + $this->plugin = new ResetQuoteAddresses(); + } + + /** + * Test removing the addresses from a non empty quote + */ + public function testRemovingTheAddressesFromNonEmptyQuote() + { + $quoteVisibleItems = [1, 2]; + + $this->quoteMock->expects($this->any()) + ->method('getAllVisibleItems') + ->will($this->returnValue($quoteVisibleItems)); + $this->quoteMock->expects($this->never()) + ->method('getAllAddresses') + ->willReturnSelf(); + + $this->plugin->afterRemoveItem($this->quoteMock, $this->quoteMock, 1); + } + + /** + * Test clearing the addresses from an empty quote + * + * @dataProvider quoteDataProvider + * @param bool $isVirtualQuote + * @param bool $quoteHasAddresses + * @param $extensionAttributes + */ + public function testClearingTheAddressesFromEmptyQuote( + bool $isVirtualQuote, + bool $quoteHasAddresses, + $extensionAttributes + ) { + $quoteVisibleItems = []; + + $this->quoteMock->expects($this->any()) + ->method('getAllVisibleItems') + ->will($this->returnValue($quoteVisibleItems)); + + if ($quoteHasAddresses) { + $address = $this->createPartialMock(Address::class, + [ + 'getId' + ] + ); + + $address->expects($this->any()) + ->method('getId') + ->willReturn(1); + + $addresses = [$address]; + + $this->quoteMock->expects($this->any()) + ->method('getAllAddresses') + ->will($this->returnValue($addresses)); + + $this->quoteMock->expects($this->exactly(count($addresses))) + ->method('removeAddress') + ->willReturnSelf(); + } else { + $this->quoteMock->expects($this->any()) + ->method('getAllAddresses') + ->willReturn([]); + } + + $this->quoteMock->expects($this->once()) + ->method('getExtensionAttributes') + ->willReturn($this->extensionAttributesMock); + + $this->quoteMock->expects($this->once()) + ->method('isVirtual') + ->willReturn($isVirtualQuote); + + if ($isVirtualQuote && $extensionAttributes) { + $this->extensionAttributesMock->expects($this->any()) + ->method('getShippingAssignments') + ->willReturn([1]); + + $this->extensionAttributesMock->expects($this->once()) + ->method('setShippingAssignments') + ->willReturnSelf(); + } + + $this->plugin->afterRemoveItem($this->quoteMock, $this->quoteMock, 1); + } + + /** + * Quote information data provider + * + * @return array + */ + public function quoteDataProvider(): array + { + return [ + 'Test case with virtual quote' => [ + true, + true, + null + ], + 'Test case with virtual quote and without a quote address' => [ + true, + false, + null + ], + 'Test case with a non virtual quote without extension attributes' => [ + false, + true, + [] + ], + 'Test case with a non virtual quote with shipping assignments' => [ + false, + true, + [1] + ] + ]; + } +} From 98c915436055b02bec9d7122cf09f41169de28f6 Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Wed, 18 Dec 2019 15:28:08 +0200 Subject: [PATCH 0487/1143] Fixing static tests --- .../Checkout/Test/Unit/Plugin/ResetQuoteAddressesTest.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Checkout/Test/Unit/Plugin/ResetQuoteAddressesTest.php b/app/code/Magento/Checkout/Test/Unit/Plugin/ResetQuoteAddressesTest.php index a8e0904c69780..cdda9c2822762 100644 --- a/app/code/Magento/Checkout/Test/Unit/Plugin/ResetQuoteAddressesTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Plugin/ResetQuoteAddressesTest.php @@ -41,8 +41,7 @@ class ResetQuoteAddressesTest extends TestCase */ protected function setUp() { - $this->quoteMock = $this->createPartialMock(Quote::class, - [ + $this->quoteMock = $this->createPartialMock(Quote::class, [ 'getAllAddresses', 'getAllVisibleItems', 'removeAddress', @@ -99,8 +98,7 @@ public function testClearingTheAddressesFromEmptyQuote( ->will($this->returnValue($quoteVisibleItems)); if ($quoteHasAddresses) { - $address = $this->createPartialMock(Address::class, - [ + $address = $this->createPartialMock(Address::class, [ 'getId' ] ); From 1db525a9ffd8f4e68bdf6981db064f64764dee65 Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Wed, 18 Dec 2019 16:09:39 +0200 Subject: [PATCH 0488/1143] Fixing static tests --- .../Unit/Plugin/ResetQuoteAddressesTest.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/app/code/Magento/Checkout/Test/Unit/Plugin/ResetQuoteAddressesTest.php b/app/code/Magento/Checkout/Test/Unit/Plugin/ResetQuoteAddressesTest.php index cdda9c2822762..60db2a36b34dc 100644 --- a/app/code/Magento/Checkout/Test/Unit/Plugin/ResetQuoteAddressesTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Plugin/ResetQuoteAddressesTest.php @@ -42,13 +42,12 @@ class ResetQuoteAddressesTest extends TestCase protected function setUp() { $this->quoteMock = $this->createPartialMock(Quote::class, [ - 'getAllAddresses', - 'getAllVisibleItems', - 'removeAddress', - 'getExtensionAttributes', - 'isVirtual', - ] - ); + 'getAllAddresses', + 'getAllVisibleItems', + 'removeAddress', + 'getExtensionAttributes', + 'isVirtual', + ]); $this->extensionAttributesMock = $this->getMockBuilder(CartExtensionInterface::class) ->setMethods( [ @@ -98,10 +97,7 @@ public function testClearingTheAddressesFromEmptyQuote( ->will($this->returnValue($quoteVisibleItems)); if ($quoteHasAddresses) { - $address = $this->createPartialMock(Address::class, [ - 'getId' - ] - ); + $address = $this->createPartialMock(Address::class, ['getId']); $address->expects($this->any()) ->method('getId') From 27d9b2c035a8e7a405d1b47cc98b34492aaccb46 Mon Sep 17 00:00:00 2001 From: Kevin Kozan <kkozan@adobe.com> Date: Wed, 18 Dec 2019 08:55:23 -0600 Subject: [PATCH 0489/1143] MQE-1927: Deliver MFTF 2.5.4 to 2.4-develop - Composer version bump --- composer.json | 2 +- composer.lock | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 7e01980e32f58..ab767fdac286d 100644 --- a/composer.json +++ b/composer.json @@ -88,7 +88,7 @@ "friendsofphp/php-cs-fixer": "~2.14.0", "lusitanian/oauth": "~0.8.10", "magento/magento-coding-standard": "*", - "magento/magento2-functional-testing-framework": "2.5.3", + "magento/magento2-functional-testing-framework": "2.5.4", "pdepend/pdepend": "2.5.2", "phpcompatibility/php-compatibility": "^9.3", "phpmd/phpmd": "@stable", diff --git a/composer.lock b/composer.lock index a63cdcdf4a1e1..b6d834610059a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "38446350ff1ac4609f77d5d74213880d", + "content-hash": "8d8e6b87c1f6ac98b3b7331eba9473f3", "packages": [ { "name": "braintree/braintree_php", @@ -7220,21 +7220,21 @@ }, { "name": "magento/magento2-functional-testing-framework", - "version": "2.5.3", + "version": "2.5.4", "source": { "type": "git", "url": "https://github.com/magento/magento2-functional-testing-framework.git", - "reference": "f627085a469da79e4a628d4bf0452f12aefa4389" + "reference": "4f482ce22a755a812b76f81020ae71d502f9d043" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/magento/magento2-functional-testing-framework/zipball/f627085a469da79e4a628d4bf0452f12aefa4389", - "reference": "f627085a469da79e4a628d4bf0452f12aefa4389", + "url": "https://api.github.com/repos/magento/magento2-functional-testing-framework/zipball/4f482ce22a755a812b76f81020ae71d502f9d043", + "reference": "4f482ce22a755a812b76f81020ae71d502f9d043", "shasum": "" }, "require": { "allure-framework/allure-codeception": "~1.3.0", - "codeception/codeception": "~2.3.4 || ~2.4.0 ", + "codeception/codeception": "~2.4.5", "composer/composer": "^1.4", "consolidation/robo": "^1.0.0", "csharpru/vault-php": "~3.5.3", @@ -7294,7 +7294,7 @@ "magento", "testing" ], - "time": "2019-10-31T14:52:02+00:00" + "time": "2019-12-12T20:14:00+00:00" }, { "name": "mikey179/vfsstream", From dd7403c2957aad27e23ed4a1ad378c50a5902dbc Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Wed, 18 Dec 2019 16:58:40 +0200 Subject: [PATCH 0490/1143] MC-25187: Session lost after switching stores on different domains --- app/code/Magento/Store/Controller/Store/Redirect.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Store/Controller/Store/Redirect.php b/app/code/Magento/Store/Controller/Store/Redirect.php index a5d0e481ba8fe..5d61275e72a28 100644 --- a/app/code/Magento/Store/Controller/Store/Redirect.php +++ b/app/code/Magento/Store/Controller/Store/Redirect.php @@ -128,5 +128,7 @@ public function execute() ]; $this->_redirect->redirect($this->_response, 'stores/store/switch', $arguments); } + + return null; } } From 5f2f318f51b21416f0acb06860abb42401efb04c Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Wed, 18 Dec 2019 13:02:29 -0600 Subject: [PATCH 0491/1143] Change action groups name according to CE branch changes --- .../AdminCategoryAssignProductActionGroup.xml | 1 + ...lectNotLoggedInCustomerGroupActionGroup.xml | 18 ------------------ 2 files changed, 1 insertion(+), 18 deletions(-) delete mode 100644 app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/SelectNotLoggedInCustomerGroupActionGroup.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCategoryAssignProductActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCategoryAssignProductActionGroup.xml index 9dc661ae5ecad..454c65c8bc5c3 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCategoryAssignProductActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCategoryAssignProductActionGroup.xml @@ -17,6 +17,7 @@ </arguments> <conditionalClick selector="{{AdminCategoryBasicFieldSection.productsInCategory}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="false" stepKey="clickOnProductInCategory"/> + <scrollTo stepKey="scrollToProductGrid" selector="{{AdminCategoryBasicFieldSection.productsInCategory}}" x="0" y="-80" /> <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickOnResetFilter"/> <fillField selector="{{AdminCategoryContentSection.productTableColumnSku}}" userInput="{{productSku}}" stepKey="fillSkuFilter"/> <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickSearchButton"/> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/SelectNotLoggedInCustomerGroupActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/SelectNotLoggedInCustomerGroupActionGroup.xml deleted file mode 100644 index 38b64803acadd..0000000000000 --- a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/SelectNotLoggedInCustomerGroupActionGroup.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. - */ ---> - -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="SelectNotLoggedInCustomerGroupActionGroup"> - <annotations> - <description>Selects the 'NOT LOGGED IN' Customer Group for a Catalog Price Rule on the creation/edit page.</description> - </annotations> - - <selectOption selector="{{AdminNewCatalogPriceRule.customerGroups}}" userInput="NOT LOGGED IN" stepKey="selectCustomerGroup"/> - </actionGroup> -</actionGroups> From 731c456463ede2d22a408447386dd83818bb3c63 Mon Sep 17 00:00:00 2001 From: Roman Hanin <rganin@adobe.com> Date: Wed, 18 Dec 2019 13:57:11 -0600 Subject: [PATCH 0492/1143] B2B-272: Remove Ship To column, fix pagination selector --- app/code/Magento/Theme/view/frontend/templates/html/pager.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Theme/view/frontend/templates/html/pager.phtml b/app/code/Magento/Theme/view/frontend/templates/html/pager.phtml index bd50fa39d4099..a6cd29c3713ac 100644 --- a/app/code/Magento/Theme/view/frontend/templates/html/pager.phtml +++ b/app/code/Magento/Theme/view/frontend/templates/html/pager.phtml @@ -120,7 +120,7 @@ <strong class="limiter-label"><?= $block->escapeHtml(__('Show')) ?></strong> <select id="limiter" data-mage-init='{"redirectUrl": {"event":"change"}}' class="limiter-options"> <?php foreach ($block->getAvailableLimit() as $_key => $_limit) : ?> - <option value="<?= $block->escapeHtmlAttr($block->getLimitUrl($_key)) ?>" + <option value="<?= $block->escapeUrl($block->getLimitUrl($_key)) ?>" <?php if ($block->isLimitCurrent($_key)) : ?> selected="selected"<?php endif ?>> <?= $block->escapeHtml($_limit) ?> From 72c74a256b1b1179ee3f60aa42b46c0bcaaf67d3 Mon Sep 17 00:00:00 2001 From: Roman Hanin <rganin@adobe.com> Date: Wed, 18 Dec 2019 14:41:57 -0600 Subject: [PATCH 0493/1143] B2B-272: Remove Ship To column, fix pagination selector --- .../Magento/Theme/view/frontend/templates/html/pager.phtml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Theme/view/frontend/templates/html/pager.phtml b/app/code/Magento/Theme/view/frontend/templates/html/pager.phtml index a6cd29c3713ac..d225ff1377c4a 100644 --- a/app/code/Magento/Theme/view/frontend/templates/html/pager.phtml +++ b/app/code/Magento/Theme/view/frontend/templates/html/pager.phtml @@ -20,7 +20,9 @@ <p class="toolbar-amount"> <span class="toolbar-number"> <?php if ($block->getLastPageNum()>1) : ?> - <?= $block->escapeHtml(__('Items %1 to %2 of %3 total', $block->getFirstNum(), $block->getLastNum(), $block->getTotalNum())) ?> + <?= $block->escapeHtml( + __('Items %1 to %2 of %3 total', $block->getFirstNum(), $block->getLastNum(), $block->getTotalNum()) + ) ?> <?php elseif ($block->getTotalNum() == 1) : ?> <?= $block->escapeHtml(__('%1 Item', $block->getTotalNum())) ?> <?php else : ?> From ccc0c71457cea73e2c58b184ea283317f732f469 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Wed, 18 Dec 2019 14:43:36 -0600 Subject: [PATCH 0494/1143] Remove redundant line --- app/code/Magento/MediaStorage/Test/Unit/App/MediaTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/MediaStorage/Test/Unit/App/MediaTest.php b/app/code/Magento/MediaStorage/Test/Unit/App/MediaTest.php index e6f43dd435869..8d3211684d377 100644 --- a/app/code/Magento/MediaStorage/Test/Unit/App/MediaTest.php +++ b/app/code/Magento/MediaStorage/Test/Unit/App/MediaTest.php @@ -197,7 +197,6 @@ public function testCatchException($isDeveloper, $setBodyCalls) $this->responseMock->expects($this->once()) ->method('sendResponse'); - $this->isAllowed = true; $this->mediaModel = $this->getMediaModel(); $this->mediaModel->catchException($bootstrap, $exception); From 6bef438824fa583bd3c1b01e9f51a9b47f213c68 Mon Sep 17 00:00:00 2001 From: Roman Hanin <rganin@adobe.com> Date: Wed, 18 Dec 2019 16:31:12 -0600 Subject: [PATCH 0495/1143] B2B-272: Remove Ship To column, fix pagination selector --- .../view/frontend/templates/html/pager.phtml | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/app/code/Magento/Theme/view/frontend/templates/html/pager.phtml b/app/code/Magento/Theme/view/frontend/templates/html/pager.phtml index d225ff1377c4a..6b28dbd4521a0 100644 --- a/app/code/Magento/Theme/view/frontend/templates/html/pager.phtml +++ b/app/code/Magento/Theme/view/frontend/templates/html/pager.phtml @@ -10,33 +10,33 @@ * @see \Magento\Theme\Block\Html\Pager */ ?> -<?php if ($block->getCollection()->getSize()) : ?> +<?php if ($block->getCollection()->getSize()): ?> - <?php if ($block->getUseContainer()) : ?> + <?php if ($block->getUseContainer()): ?> <div class="pager"> <?php endif ?> - <?php if ($block->getShowAmounts()) : ?> + <?php if ($block->getShowAmounts()): ?> <p class="toolbar-amount"> <span class="toolbar-number"> - <?php if ($block->getLastPageNum()>1) : ?> + <?php if ($block->getLastPageNum()>1): ?> <?= $block->escapeHtml( __('Items %1 to %2 of %3 total', $block->getFirstNum(), $block->getLastNum(), $block->getTotalNum()) ) ?> - <?php elseif ($block->getTotalNum() == 1) : ?> + <?php elseif ($block->getTotalNum() == 1): ?> <?= $block->escapeHtml(__('%1 Item', $block->getTotalNum())) ?> - <?php else : ?> + <?php else: ?> <?= $block->escapeHtml(__('%1 Item(s)', $block->getTotalNum())) ?> <?php endif; ?> </span> </p> <?php endif ?> - <?php if ($block->getLastPageNum()>1) : ?> + <?php if ($block->getLastPageNum()>1): ?> <div class="pages"> <strong class="label pages-label" id="paging-label"><?= $block->escapeHtml(__('Page')) ?></strong> <ul class="items pages-items" aria-labelledby="paging-label"> - <?php if (!$block->isFirstPage()) : ?> + <?php if (!$block->isFirstPage()): ?> <li class="item pages-item-previous"> <?php $text = $block->getAnchorTextForPrevious() ? $block->getAnchorTextForPrevious() : '';?> <a class="<?= $block->escapeHtmlAttr($text ? 'link ' : 'action ') ?> previous" @@ -48,7 +48,7 @@ </li> <?php endif;?> - <?php if ($block->canShowFirst()) : ?> + <?php if ($block->canShowFirst()): ?> <li class="item"> <a class="page first" href="<?= $block->escapeUrl($block->getFirstPageUrl()) ?>"> <span class="label"><?= $block->escapeHtml(__('Page')) ?></span> @@ -57,7 +57,7 @@ </li> <?php endif;?> - <?php if ($block->canShowPreviousJump()) : ?> + <?php if ($block->canShowPreviousJump()): ?> <li class="item"> <a class="page previous jump" title="" @@ -67,15 +67,15 @@ </li> <?php endif;?> - <?php foreach ($block->getFramePages() as $_page) : ?> - <?php if ($block->isPageCurrent($_page)) : ?> + <?php foreach ($block->getFramePages() as $_page): ?> + <?php if ($block->isPageCurrent($_page)): ?> <li class="item current"> <strong class="page"> <span class="label"><?= $block->escapeHtml(__('You\'re currently reading page')) ?></span> <span><?= $block->escapeHtml($_page) ?></span> </strong> </li> - <?php else : ?> + <?php else: ?> <li class="item"> <a href="<?= $block->escapeUrl($block->getPageUrl($_page)) ?>" class="page"> <span class="label"><?= $block->escapeHtml(__('Page')) ?></span> @@ -85,7 +85,7 @@ <?php endif;?> <?php endforeach;?> - <?php if ($block->canShowNextJump()) : ?> + <?php if ($block->canShowNextJump()): ?> <li class="item"> <a class="page next jump" title="" href="<?= $block->escapeUrl($block->getNextJumpUrl()) ?>"> <span>...</span> @@ -93,7 +93,7 @@ </li> <?php endif;?> - <?php if ($block->canShowLast()) : ?> + <?php if ($block->canShowLast()): ?> <li class="item"> <a class="page last" href="<?= $block->escapeUrl($block->getLastPageUrl()) ?>"> <span class="label"><?= $block->escapeHtml(__('Page')) ?></span> @@ -102,7 +102,7 @@ </li> <?php endif;?> - <?php if (!$block->isLastPage()) : ?> + <?php if (!$block->isLastPage()): ?> <li class="item pages-item-next"> <?php $text = $block->getAnchorTextForNext() ? $block->getAnchorTextForNext() : '';?> <a class="<?= /* @noEscape */ $text ? 'link ' : 'action ' ?> next" @@ -117,13 +117,13 @@ </div> <?php endif; ?> - <?php if ($block->isShowPerPage()) : ?> + <?php if ($block->isShowPerPage()): ?> <div class="limiter"> <strong class="limiter-label"><?= $block->escapeHtml(__('Show')) ?></strong> <select id="limiter" data-mage-init='{"redirectUrl": {"event":"change"}}' class="limiter-options"> - <?php foreach ($block->getAvailableLimit() as $_key => $_limit) : ?> + <?php foreach ($block->getAvailableLimit() as $_key => $_limit): ?> <option value="<?= $block->escapeUrl($block->getLimitUrl($_key)) ?>" - <?php if ($block->isLimitCurrent($_key)) : ?> + <?php if ($block->isLimitCurrent($_key)): ?> selected="selected"<?php endif ?>> <?= $block->escapeHtml($_limit) ?> </option> @@ -133,7 +133,7 @@ </div> <?php endif ?> - <?php if ($block->getUseContainer()) : ?> + <?php if ($block->getUseContainer()): ?> </div> <?php endif ?> From 2400f8bdd2e119a39f0eb097d4ff1f07715ec5fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 19 Dec 2019 03:28:35 +0100 Subject: [PATCH 0496/1143] Unit Test for WishlistGraphQL --- .../Resolver/CustomerWishlistResolver.php | 11 +- .../Unit/CustomerWishlistResolverTest.php | 154 ++++++++++++++++++ 2 files changed, 162 insertions(+), 3 deletions(-) create mode 100644 app/code/Magento/WishlistGraphQl/Test/Unit/CustomerWishlistResolverTest.php diff --git a/app/code/Magento/WishlistGraphQl/Model/Resolver/CustomerWishlistResolver.php b/app/code/Magento/WishlistGraphQl/Model/Resolver/CustomerWishlistResolver.php index e866b9cead03c..a84ce0e965b6d 100644 --- a/app/code/Magento/WishlistGraphQl/Model/Resolver/CustomerWishlistResolver.php +++ b/app/code/Magento/WishlistGraphQl/Model/Resolver/CustomerWishlistResolver.php @@ -8,10 +8,11 @@ namespace Magento\WishlistGraphQl\Model\Resolver; use Magento\Framework\GraphQl\Config\Element\Field; +use Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException; use Magento\Framework\GraphQl\Query\ResolverInterface; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; +use Magento\Wishlist\Model\Wishlist; use Magento\Wishlist\Model\WishlistFactory; -use Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException; /** * Fetches customer wishlist data @@ -44,9 +45,13 @@ public function resolve( if (false === $context->getExtensionAttributes()->getIsCustomer()) { throw new GraphQlAuthorizationException(__('The current customer isn\'t authorized.')); } - $wishlist = $this->wishlistFactory->create()->loadByCustomerId($context->getUserId(), true); + + /** @var Wishlist $wishlist */ + $wishlist = $this->wishlistFactory->create(); + $wishlist->loadByCustomerId($context->getUserId(), true); + return [ - 'id' => (string) $wishlist->getId(), + 'id' => (string)$wishlist->getId(), 'sharing_code' => $wishlist->getSharingCode(), 'updated_at' => $wishlist->getUpdatedAt(), 'items_count' => $wishlist->getItemsCount(), diff --git a/app/code/Magento/WishlistGraphQl/Test/Unit/CustomerWishlistResolverTest.php b/app/code/Magento/WishlistGraphQl/Test/Unit/CustomerWishlistResolverTest.php new file mode 100644 index 0000000000000..efb05b2314c73 --- /dev/null +++ b/app/code/Magento/WishlistGraphQl/Test/Unit/CustomerWishlistResolverTest.php @@ -0,0 +1,154 @@ +<?php +declare(strict_types=1); + +namespace Magento\WishlistGraphQl\Test\Unit; + +use Magento\Framework\GraphQl\Config\Element\Field; +use Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException; +use Magento\Framework\GraphQl\Query\Resolver\ContextInterface; +use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\GraphQl\Model\Query\ContextExtensionInterface; +use Magento\Wishlist\Model\Wishlist; +use Magento\Wishlist\Model\WishlistFactory; +use Magento\WishlistGraphQl\Model\Resolver\CustomerWishlistResolver; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +class CustomerWishlistResolverTest extends TestCase +{ + private const STUB_CUSTOMER_ID = 1; + + /** + * @var MockObject|ContextInterface + */ + private $contextMock; + + /** + * @var MockObject|ContextExtensionInterface + */ + private $extensionAttributesMock; + + /** + * @var MockObject|WishlistFactory + */ + private $wishlistFactoryMock; + + /** + * @var MockObject|Wishlist + */ + private $wishlistMock; + + /** + * @var CustomerWishlistResolver + */ + private $resolver; + + /** + * Build the Testing Environment + */ + protected function setUp() + { + $this->contextMock = $this->getMockBuilder(ContextInterface::class) + ->setMethods(['getExtensionAttributes', 'getUserId']) + ->getMock(); + + $this->extensionAttributesMock = $this->getMockBuilder(ContextExtensionInterface::class) + ->setMethods(['getIsCustomer']) + ->getMock(); + + $this->contextMock->method('getExtensionAttributes') + ->willReturn($this->extensionAttributesMock); + + $this->wishlistFactoryMock = $this->getMockBuilder(WishlistFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + + $this->wishlistMock = $this->getMockBuilder(Wishlist::class) + ->disableOriginalConstructor() + ->setMethods(['loadByCustomerId', 'getId', 'getSharingCode', 'getUpdatedAt', 'getItemsCount']) + ->getMock(); + + $objectManager = new ObjectManager($this); + $this->resolver = $objectManager->getObject(CustomerWishlistResolver::class, [ + 'wishlistFactory' => $this->wishlistFactoryMock + ]); + } + + public function testThrowExceptionWhenUserNotAuthorized(): void + { + // Given + $this->extensionAttributesMock->method('getIsCustomer') + ->willReturn(false); + + // Then + $this->expectException(GraphQlAuthorizationException::class); + $this->wishlistFactoryMock->expects($this->never()) + ->method('create'); + + // When + $this->resolver->resolve( + $this->getFieldStub(), + $this->contextMock, + $this->getResolveInfoStub() + ); + } + + public function testFactoryCreatesWishlistByAuthorizedCustomerId(): void + { + // Given + $this->extensionAttributesMock->method('getIsCustomer') + ->willReturn(true); + + $this->contextMock->method('getUserId') + ->willReturn(self::STUB_CUSTOMER_ID); + + // Then + $this->wishlistMock->expects($this->once()) + ->method('loadByCustomerId') + ->with(self::STUB_CUSTOMER_ID) + ->willReturnSelf(); + + $this->wishlistFactoryMock->expects($this->once()) + ->method('create') + ->willReturn($this->wishlistMock); + + // When + $this->resolver->resolve( + $this->getFieldStub(), + $this->contextMock, + $this->getResolveInfoStub() + ); + } + + /** + * Returns stub for Field + * + * @return MockObject|Field + */ + private function getFieldStub(): Field + { + /** @var MockObject|Field $fieldMock */ + $fieldMock = $this->getMockBuilder(Field::class) + ->disableOriginalConstructor() + ->getMock(); + + return $fieldMock; + } + + /** + * Returns stub for ResolveInfo + * + * @return MockObject|ResolveInfo + */ + private function getResolveInfoStub(): ResolveInfo + { + /** @var MockObject|ResolveInfo $resolveInfoMock */ + $resolveInfoMock = $this->getMockBuilder(ResolveInfo::class) + ->disableOriginalConstructor() + ->getMock(); + + return $resolveInfoMock; + } +} From ae831af39b49b64bf420e840c6fd9b4d3eadf3c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 19 Dec 2019 03:47:23 +0100 Subject: [PATCH 0497/1143] Unit Test for WeeeGraphQl --- .../Test/Unit/FixedProductTaxTest.php | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 app/code/Magento/WeeeGraphQl/Test/Unit/FixedProductTaxTest.php diff --git a/app/code/Magento/WeeeGraphQl/Test/Unit/FixedProductTaxTest.php b/app/code/Magento/WeeeGraphQl/Test/Unit/FixedProductTaxTest.php new file mode 100644 index 0000000000000..427504d85d676 --- /dev/null +++ b/app/code/Magento/WeeeGraphQl/Test/Unit/FixedProductTaxTest.php @@ -0,0 +1,69 @@ +<?php +declare(strict_types=1); + +namespace Magento\WeeeGraphQl\Test\Unit; + +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\GraphQl\Config\Element\Field; +use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\WeeeGraphQl\Model\Resolver\FixedProductTax; +use PHPUnit\Framework\TestCase; +use PHPUnit_Framework_MockObject_MockObject as MockObject; + +class FixedProductTaxTest extends TestCase +{ + /** + * @var FixedProductTax + */ + private $resolver; + + /** + * Build the Testing Environment + */ + protected function setUp() + { + $objectManager = new ObjectManager($this); + $this->resolver = $objectManager->getObject(FixedProductTax::class); + } + + public function testExceptionWhenNoModelSpecified(): void + { + $this->expectException(LocalizedException::class); + $this->expectExceptionMessageRegExp('/value should be specified/'); + + $this->resolver->resolve( + $this->getFieldStub(), + null, + $this->getResolveInfoStub() + ); + } + + /** + * Returns stub for Field + * + * @return MockObject|Field + */ + private function getFieldStub(): Field + { + /** @var MockObject|Field $fieldMock */ + $fieldMock = $this->getMockBuilder(Field::class) + ->disableOriginalConstructor() + ->getMock(); + return $fieldMock; + } + + /** + * Returns stub for ResolveInfo + * + * @return MockObject|ResolveInfo + */ + private function getResolveInfoStub(): ResolveInfo + { + /** @var MockObject|ResolveInfo $resolveInfoMock */ + $resolveInfoMock = $this->getMockBuilder(ResolveInfo::class) + ->disableOriginalConstructor() + ->getMock(); + return $resolveInfoMock; + } +} From 456e6a7cddf843244d68ee0aa21111ff25f4e50e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 19 Dec 2019 03:50:34 +0100 Subject: [PATCH 0498/1143] Add missing Copyright block --- .../Test/Unit/CustomerWishlistResolverTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/code/Magento/WishlistGraphQl/Test/Unit/CustomerWishlistResolverTest.php b/app/code/Magento/WishlistGraphQl/Test/Unit/CustomerWishlistResolverTest.php index efb05b2314c73..2dff9b5c0e694 100644 --- a/app/code/Magento/WishlistGraphQl/Test/Unit/CustomerWishlistResolverTest.php +++ b/app/code/Magento/WishlistGraphQl/Test/Unit/CustomerWishlistResolverTest.php @@ -1,4 +1,8 @@ <?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ declare(strict_types=1); namespace Magento\WishlistGraphQl\Test\Unit; From dff6cbfbff6329755fdd15e0f8857860de6ae513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 19 Dec 2019 03:50:59 +0100 Subject: [PATCH 0499/1143] Add missing Copyright block --- .../Magento/WeeeGraphQl/Test/Unit/FixedProductTaxTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/code/Magento/WeeeGraphQl/Test/Unit/FixedProductTaxTest.php b/app/code/Magento/WeeeGraphQl/Test/Unit/FixedProductTaxTest.php index 427504d85d676..778ff8eaef4cc 100644 --- a/app/code/Magento/WeeeGraphQl/Test/Unit/FixedProductTaxTest.php +++ b/app/code/Magento/WeeeGraphQl/Test/Unit/FixedProductTaxTest.php @@ -1,4 +1,8 @@ <?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ declare(strict_types=1); namespace Magento\WeeeGraphQl\Test\Unit; From ceb49c9a73c32f7c3f44a0057fed912be18beb70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 19 Dec 2019 04:05:22 +0100 Subject: [PATCH 0500/1143] Additional Unit Test for Weee --- .../Test/Unit/FixedProductTaxTest.php | 79 ++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/WeeeGraphQl/Test/Unit/FixedProductTaxTest.php b/app/code/Magento/WeeeGraphQl/Test/Unit/FixedProductTaxTest.php index 778ff8eaef4cc..9e5812282545a 100644 --- a/app/code/Magento/WeeeGraphQl/Test/Unit/FixedProductTaxTest.php +++ b/app/code/Magento/WeeeGraphQl/Test/Unit/FixedProductTaxTest.php @@ -7,30 +7,81 @@ namespace Magento\WeeeGraphQl\Test\Unit; +use Magento\Framework\DataObject; use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\GraphQl\Query\Resolver\ContextInterface; use Magento\Framework\GraphQl\Config\Element\Field; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\GraphQl\Model\Query\ContextExtensionInterface; +use Magento\Weee\Helper\Data as WeeeHelper; use Magento\WeeeGraphQl\Model\Resolver\FixedProductTax; use PHPUnit\Framework\TestCase; use PHPUnit_Framework_MockObject_MockObject as MockObject; class FixedProductTaxTest extends TestCase { + const STUB_STORE_ID = 1; + + /** + * @var MockObject|ContextInterface + */ + private $contextMock; + + /** + * @var MockObject|ContextExtensionInterface + */ + private $extensionAttributesMock; + /** * @var FixedProductTax */ private $resolver; + /** + * @var MockObject|WeeeHelper + */ + private $weeeHelperMock; + + /** + * @var MockObject|DataObject + */ + private $productMock; + /** * Build the Testing Environment */ protected function setUp() { + $this->contextMock = $this->getMockBuilder(ContextInterface::class) + ->setMethods(['getExtensionAttributes']) + ->getMock(); + + $this->extensionAttributesMock = $this->getMockBuilder(ContextExtensionInterface::class) + ->setMethods(['getStore']) + ->getMock(); + + $this->contextMock->method('getExtensionAttributes') + ->willReturn($this->extensionAttributesMock); + + $this->productMock = $this->getMockBuilder(DataObject::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->weeeHelperMock = $this->getMockBuilder(WeeeHelper::class) + ->disableOriginalConstructor() + ->setMethods(['isEnabled', 'getProductWeeeAttributesForDisplay']) + ->getMock(); + $objectManager = new ObjectManager($this); - $this->resolver = $objectManager->getObject(FixedProductTax::class); + $this->resolver = $objectManager->getObject(FixedProductTax::class, [ + 'weeeHelper' => $this->weeeHelperMock + ]); } + /** + * Verifies if the Exception is being thrown when no Product Model passed to resolver + */ public function testExceptionWhenNoModelSpecified(): void { $this->expectException(LocalizedException::class); @@ -43,6 +94,32 @@ public function testExceptionWhenNoModelSpecified(): void ); } + /** + * Verifies that Attributes for display are not being fetched if feature not enabled in store + */ + public function testNotGettingAttributesWhenWeeeDisabledForStore(): void + { + // Given + $this->extensionAttributesMock->method('getStore') + ->willreturn(self::STUB_STORE_ID); + + // When + $this->weeeHelperMock->method('isEnabled') + ->with(self::STUB_STORE_ID) + ->willReturn(false); + + // Then + $this->weeeHelperMock->expects($this->never()) + ->method('getProductWeeeAttributesForDisplay'); + + $this->resolver->resolve( + $this->getFieldStub(), + $this->contextMock, + $this->getResolveInfoStub(), + ['model' => $this->productMock] + ); + } + /** * Returns stub for Field * From 565c34f59b853e4b2b2f5eb3c0adbf39ae4d94db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 19 Dec 2019 04:07:17 +0100 Subject: [PATCH 0501/1143] Add missing docblocks --- .../Test/Unit/CustomerWishlistResolverTest.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/code/Magento/WishlistGraphQl/Test/Unit/CustomerWishlistResolverTest.php b/app/code/Magento/WishlistGraphQl/Test/Unit/CustomerWishlistResolverTest.php index 2dff9b5c0e694..f5baa5183e558 100644 --- a/app/code/Magento/WishlistGraphQl/Test/Unit/CustomerWishlistResolverTest.php +++ b/app/code/Magento/WishlistGraphQl/Test/Unit/CustomerWishlistResolverTest.php @@ -80,6 +80,9 @@ protected function setUp() ]); } + /** + * Verify if Authorization exception is being thrown when User not logged in + */ public function testThrowExceptionWhenUserNotAuthorized(): void { // Given @@ -99,6 +102,9 @@ public function testThrowExceptionWhenUserNotAuthorized(): void ); } + /** + * Verify if Wishlist instance is created for currently Authorized user + */ public function testFactoryCreatesWishlistByAuthorizedCustomerId(): void { // Given From dd5fb66ae37a3907375cc71e580544fc25ed6fb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 19 Dec 2019 04:24:13 +0100 Subject: [PATCH 0502/1143] Changes to Magento Version module and Unit Tests --- .../Version/Controller/Index/Index.php | 36 +++++++++--- .../Test/Unit/Controller/Index/IndexTest.php | 56 ++++++++++--------- 2 files changed, 59 insertions(+), 33 deletions(-) diff --git a/app/code/Magento/Version/Controller/Index/Index.php b/app/code/Magento/Version/Controller/Index/Index.php index 0db9b5f80d483..7ed039dae22b4 100644 --- a/app/code/Magento/Version/Controller/Index/Index.php +++ b/app/code/Magento/Version/Controller/Index/Index.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Version\Controller\Index; use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface; @@ -16,6 +17,8 @@ */ class Index extends Action implements HttpGetActionInterface { + const DEV_PREFIX = 'dev-'; + /** * @var ProductMetadataInterface */ @@ -41,16 +44,14 @@ public function execute() { $version = $this->productMetadata->getVersion(); $versionParts = explode('.', $version); - if ((!isset($versionParts[0]) || !isset($versionParts[1])) - || $this->isGitBasedInstallation($version) - ) { + if ($this->isGitBasedInstallation($version) || !$this->isCorrectVersion($versionParts)) { return; } - $majorMinorVersion = $versionParts[0] . '.' . $versionParts[1]; + $this->getResponse()->setBody( $this->productMetadata->getName() . '/' . - $majorMinorVersion . ' (' . - $this->productMetadata->getEdition() . ')' + $this->getMajorMinorVersion($versionParts) . + ' (' . $this->productMetadata->getEdition() . ')' ); } @@ -62,7 +63,26 @@ public function execute() */ private function isGitBasedInstallation($fullVersion) { - $versionParts = explode('-', $fullVersion); - return (isset($versionParts[0]) && $versionParts[0] == 'dev'); + return 0 === strpos($fullVersion, self::DEV_PREFIX); + } + + /** + * Verifies if the Magento version is correct + * + * @param array $versionParts + * @return bool + */ + private function isCorrectVersion(array $versionParts): bool + { + return isset($versionParts[0]) && isset($versionParts[1]); + } + + /** + * @param array $versionParts + * @return string + */ + private function getMajorMinorVersion(array $versionParts): string + { + return $versionParts[0] . '.' . $versionParts[1]; } } diff --git a/app/code/Magento/Version/Test/Unit/Controller/Index/IndexTest.php b/app/code/Magento/Version/Test/Unit/Controller/Index/IndexTest.php index 6f8daa9d8008d..f5dd438bbfa38 100644 --- a/app/code/Magento/Version/Test/Unit/Controller/Index/IndexTest.php +++ b/app/code/Magento/Version/Test/Unit/Controller/Index/IndexTest.php @@ -12,11 +12,9 @@ use Magento\Framework\App\ProductMetadataInterface; use Magento\Framework\App\ResponseInterface; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use PHPUnit\Framework\TestCase; -/** - * Class \Magento\Version\Test\Unit\Controller\Index\IndexTest - */ -class IndexTest extends \PHPUnit\Framework\TestCase +class IndexTest extends TestCase { /** * @var VersionIndex @@ -26,72 +24,80 @@ class IndexTest extends \PHPUnit\Framework\TestCase /** * @var Context */ - private $context; + private $contextMock; /** * @var ProductMetadataInterface */ - private $productMetadata; + private $productMetadataMock; /** * @var ResponseInterface */ - private $response; + private $responseMock; /** * Prepare test preconditions */ protected function setUp() { - $this->context = $this->getMockBuilder(Context::class) + $this->contextMock = $this->getMockBuilder(Context::class) ->disableOriginalConstructor() ->getMock(); - $this->productMetadata = $this->getMockBuilder(ProductMetadataInterface::class) + $this->productMetadataMock = $this->getMockBuilder(ProductMetadataInterface::class) ->disableOriginalConstructor() ->setMethods(['getName', 'getEdition', 'getVersion']) ->getMock(); - $this->response = $this->getMockBuilder(ResponseInterface::class) + $this->responseMock = $this->getMockBuilder(ResponseInterface::class) ->disableOriginalConstructor() ->setMethods(['setBody', 'sendResponse']) ->getMock(); - $this->context->expects($this->any()) + $this->contextMock->expects($this->any()) ->method('getResponse') - ->willReturn($this->response); + ->willReturn($this->responseMock); - $helper = new ObjectManager($this); + $objectManager = new ObjectManager($this); - $this->model = $helper->getObject( + $this->model = $objectManager->getObject( 'Magento\Version\Controller\Index\Index', [ - 'context' => $this->context, - 'productMetadata' => $this->productMetadata + 'context' => $this->contextMock, + 'productMetadata' => $this->productMetadataMock ] ); } /** - * Test with Git Base version + * Git Base version does not return information about version */ - public function testExecuteWithGitBase() + public function testGitBasedInstallationDoesNotReturnVersion() { - $this->productMetadata->expects($this->any())->method('getVersion')->willReturn('dev-2.3'); + $this->productMetadataMock->expects($this->any()) + ->method('getVersion') + ->willReturn('dev-2.3'); + + $this->responseMock->expects($this->never()) + ->method('setBody'); + $this->assertNull($this->model->execute()); } /** - * Test with Community Version + * Magento Community returns information about major and minor version of product */ - public function testExecuteWithCommunityVersion() + public function testCommunityVersionDisplaysMajorMinorVersionAndEditionName() { - $this->productMetadata->expects($this->any())->method('getVersion')->willReturn('2.3.3'); - $this->productMetadata->expects($this->any())->method('getEdition')->willReturn('Community'); - $this->productMetadata->expects($this->any())->method('getName')->willReturn('Magento'); - $this->response->expects($this->once())->method('setBody') + $this->productMetadataMock->expects($this->any())->method('getVersion')->willReturn('2.3.3'); + $this->productMetadataMock->expects($this->any())->method('getEdition')->willReturn('Community'); + $this->productMetadataMock->expects($this->any())->method('getName')->willReturn('Magento'); + + $this->responseMock->expects($this->once())->method('setBody') ->with('Magento/2.3 (Community)') ->will($this->returnSelf()); + $this->model->execute(); } } From 7b311ef9448dc674dd1528489bbcfc36f10a9136 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Thu, 19 Dec 2019 10:25:10 +0700 Subject: [PATCH 0503/1143] [Weee] Cover Weee Plugin by Unit Test --- .../Helper/ProcessTaxAttributeTest.php | 157 ++++++++++++++++++ .../Ui/DataProvider/WeeeSettingsTest.php | 74 +++++++++ 2 files changed, 231 insertions(+) create mode 100644 app/code/Magento/Weee/Test/Unit/Plugin/Catalog/Controller/Adminhtml/Product/Initialization/Helper/ProcessTaxAttributeTest.php create mode 100644 app/code/Magento/Weee/Test/Unit/Plugin/Ui/DataProvider/WeeeSettingsTest.php diff --git a/app/code/Magento/Weee/Test/Unit/Plugin/Catalog/Controller/Adminhtml/Product/Initialization/Helper/ProcessTaxAttributeTest.php b/app/code/Magento/Weee/Test/Unit/Plugin/Catalog/Controller/Adminhtml/Product/Initialization/Helper/ProcessTaxAttributeTest.php new file mode 100644 index 0000000000000..28134a4c00363 --- /dev/null +++ b/app/code/Magento/Weee/Test/Unit/Plugin/Catalog/Controller/Adminhtml/Product/Initialization/Helper/ProcessTaxAttributeTest.php @@ -0,0 +1,157 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Weee\Test\Unit\Plugin\Catalog\Controller\Adminhtml\Product\Initialization\Helper; + +use Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper; +use Magento\Catalog\Model\Product; +use Magento\Eav\Model\Entity\Attribute\AbstractAttribute; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Weee\Plugin\Catalog\Controller\Adminhtml\Product\Initialization\Helper\ProcessTaxAttribute; +use PHPUnit\Framework\MockObject\Matcher\InvokedCount as InvokedCountMatcher; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +class ProcessTaxAttributeTest extends TestCase +{ + /** + * Weee frontend input + */ + private const WEEE_FRONTEND_INPUT = 'weee'; + + /** + * Text frontend input + */ + private const TEXT_FRONTEND_INPUT = 'text'; + + /** + * Stub weee attribute code + */ + private const STUB_WEEE_ATTRIBUTE_CODE = 'weee_1'; + + /** + * Stub weee attribute value + */ + private const STUB_WEEE_ATTRIBUTE_VALUE = 1122; + + /** + * @var ProcessTaxAttribute + */ + private $plugin; + + /** + * @var Helper|MockObject + */ + private $subjectMock; + + /** + * @var Product|MockObject + */ + private $productMock; + + /** + * @var Product|MockObject + */ + private $resultMock; + + /** + * Prepare environment for test + */ + protected function setUp() + { + $this->subjectMock = $this->createMock(Helper::class); + $this->resultMock = $this->createMock(Product::class); + $this->productMock = $this->createMock(Product::class); + + $objectManager = new ObjectManager($this); + $this->plugin = $objectManager->getObject(ProcessTaxAttribute::class); + } + + /** + * Test afterInitializeFromData when attributes are empty + */ + public function testAfterInitializeFromDataWhenAttributesAreEmpty() + { + $this->resultMock->expects($this->any())->method('getAttributes') + ->willReturn([]); + + $this->resultMock->expects($this->never())->method('setData')->willReturnSelf(); + + $this->plugin->afterInitializeFromData($this->subjectMock, $this->resultMock, $this->productMock, []); + } + + /** + * Test afterInitializeFromData when attributes do not include weee frontend input + */ + public function testAfterInitializeFromDataWhenAttributesDoNotIncludeWeee() + { + /** @var AbstractAttribute|MockObject $attributeMock */ + $attributeMock = $this->createMock(AbstractAttribute::class); + + $attributeMock->expects($this->any())->method('getFrontendInput') + ->willReturn(self::TEXT_FRONTEND_INPUT); + + $this->resultMock->expects($this->any())->method('getAttributes') + ->willReturn([$attributeMock]); + + $this->resultMock->expects($this->never())->method('setData')->willReturnSelf(); + + $this->plugin->afterInitializeFromData($this->subjectMock, $this->resultMock, $this->productMock, []); + } + + /** + * Test afterInitializeFromData when attributes include weee + * + * @param array $productData + * @param InvokedCountMatcher $expected + * @dataProvider afterInitializeFromDataWhenAttributesIncludeWeeeDataProvider + */ + public function testAfterInitializeFromDataWhenAttributesIncludeWeee($productData, $expected) + { + /** @var AbstractAttribute|MockObject $attributeMock */ + $attributeMock = $this->createMock(AbstractAttribute::class); + + $attributeMock->expects($this->any())->method('getFrontendInput') + ->willReturn(self::WEEE_FRONTEND_INPUT); + $attributeMock->expects($this->any())->method('getAttributeCode') + ->willReturn(self::STUB_WEEE_ATTRIBUTE_CODE); + $this->resultMock->expects($this->any())->method('getAttributes') + ->willReturn([$attributeMock]); + + $this->resultMock->expects($expected)->method('setData') + ->with(self::STUB_WEEE_ATTRIBUTE_CODE, []) + ->willReturnSelf(); + + $this->plugin->afterInitializeFromData( + $this->subjectMock, + $this->resultMock, + $this->productMock, + $productData + ); + } + + /** + * ProductData data provider for testAfterInitializeFromDataWhenAttributesIncludeWeee + * + * @return array + */ + public function afterInitializeFromDataWhenAttributesIncludeWeeeDataProvider() + { + return [ + 'Product data includes wee' => [ + [ + self::STUB_WEEE_ATTRIBUTE_CODE => self::STUB_WEEE_ATTRIBUTE_VALUE + ], + $this->never() + ], + 'Product data does not include wee' => [ + [], + $this->once() + ] + ]; + } +} diff --git a/app/code/Magento/Weee/Test/Unit/Plugin/Ui/DataProvider/WeeeSettingsTest.php b/app/code/Magento/Weee/Test/Unit/Plugin/Ui/DataProvider/WeeeSettingsTest.php new file mode 100644 index 0000000000000..0ac9c55313538 --- /dev/null +++ b/app/code/Magento/Weee/Test/Unit/Plugin/Ui/DataProvider/WeeeSettingsTest.php @@ -0,0 +1,74 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\Weee\Test\Unit\Plugin\Ui\DataProvider; + +use Magento\Catalog\Ui\DataProvider\Product\Listing\DataProvider; +use Magento\Framework\App\Config; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Weee\Model\Config as WeeeConfig; +use Magento\Weee\Plugin\Ui\DataProvider\WeeeSettings; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +class WeeeSettingsTest extends TestCase +{ + /** + * Stub settings fpt display product list + */ + private const STUB_FPT_DISPLAY_PRODUCT_LIST = '1'; + + /** + * @var WeeeSettings + */ + private $plugin; + + /** + * @var DataProvider|MockObject + */ + protected $subjectMock; + + /** + * @var Config|MockObject + */ + private $configMock; + + /** + * Prepare environment for test + */ + protected function setUp() + { + $this->configMock = $this->createMock(Config::class); + $this->subjectMock = $this->createMock(DataProvider::class); + + $objectManager = new ObjectManager($this); + $this->plugin = $objectManager->getObject( + WeeeSettings::class, + [ + 'config' => $this->configMock + ] + ); + } + + /** + * Test plugin afterGetData + */ + public function testAfterGetDataWhenConfigIsYesResultIsEmpty() + { + $this->configMock->expects($this->any())->method('getValue') + ->with(WeeeConfig::XML_PATH_FPT_DISPLAY_PRODUCT_LIST) + ->willReturn(self::STUB_FPT_DISPLAY_PRODUCT_LIST); + + $this->assertEquals( + [ + 'displayWeee' => self::STUB_FPT_DISPLAY_PRODUCT_LIST + ], + $this->plugin->afterGetData($this->subjectMock, []) + ); + } +} From 2be5545e8ab4fdb88acf3ad18ec0be56d132da74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 19 Dec 2019 04:27:23 +0100 Subject: [PATCH 0504/1143] Add missing description for method --- app/code/Magento/Version/Controller/Index/Index.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Version/Controller/Index/Index.php b/app/code/Magento/Version/Controller/Index/Index.php index 7ed039dae22b4..d2ffa0fb6dd4d 100644 --- a/app/code/Magento/Version/Controller/Index/Index.php +++ b/app/code/Magento/Version/Controller/Index/Index.php @@ -78,6 +78,8 @@ private function isCorrectVersion(array $versionParts): bool } /** + * Returns string only with Major and Minor version number + * * @param array $versionParts * @return string */ From 6be7d1e0119d9d58506721dffdb6a26093ebdbbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 19 Dec 2019 04:30:17 +0100 Subject: [PATCH 0505/1143] Reformat XML files --- app/code/Magento/Version/etc/frontend/routes.xml | 2 +- app/code/Magento/Version/etc/module.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Version/etc/frontend/routes.xml b/app/code/Magento/Version/etc/frontend/routes.xml index a3988030478ff..3550a0c6a15f5 100644 --- a/app/code/Magento/Version/etc/frontend/routes.xml +++ b/app/code/Magento/Version/etc/frontend/routes.xml @@ -8,7 +8,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd"> <router id="standard"> <route id="magento_version" frontName="magento_version"> - <module name="Magento_Version" /> + <module name="Magento_Version"/> </route> </router> </config> diff --git a/app/code/Magento/Version/etc/module.xml b/app/code/Magento/Version/etc/module.xml index fe8ace51ea07d..b21ef687e164d 100644 --- a/app/code/Magento/Version/etc/module.xml +++ b/app/code/Magento/Version/etc/module.xml @@ -6,6 +6,6 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> - <module name="Magento_Version" > + <module name="Magento_Version"> </module> </config> From ba51b436e7614985049b91efa9dbfaddf2bff669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 19 Dec 2019 04:39:14 +0100 Subject: [PATCH 0506/1143] Introduce strict_types --- app/code/Magento/Version/Controller/Index/Index.php | 7 ++++--- .../Version/Test/Unit/Controller/Index/IndexTest.php | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Version/Controller/Index/Index.php b/app/code/Magento/Version/Controller/Index/Index.php index d2ffa0fb6dd4d..a6accaeb7d52f 100644 --- a/app/code/Magento/Version/Controller/Index/Index.php +++ b/app/code/Magento/Version/Controller/Index/Index.php @@ -4,12 +4,13 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Version\Controller\Index; -use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface; use Magento\Framework\App\Action\Action; use Magento\Framework\App\Action\Context; +use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface; use Magento\Framework\App\ProductMetadataInterface; /** @@ -40,7 +41,7 @@ public function __construct(Context $context, ProductMetadataInterface $productM * * @return void */ - public function execute() + public function execute(): void { $version = $this->productMetadata->getVersion(); $versionParts = explode('.', $version); @@ -61,7 +62,7 @@ public function execute() * @param string $fullVersion * @return bool */ - private function isGitBasedInstallation($fullVersion) + private function isGitBasedInstallation($fullVersion): bool { return 0 === strpos($fullVersion, self::DEV_PREFIX); } diff --git a/app/code/Magento/Version/Test/Unit/Controller/Index/IndexTest.php b/app/code/Magento/Version/Test/Unit/Controller/Index/IndexTest.php index f5dd438bbfa38..9a42fd81cd882 100644 --- a/app/code/Magento/Version/Test/Unit/Controller/Index/IndexTest.php +++ b/app/code/Magento/Version/Test/Unit/Controller/Index/IndexTest.php @@ -7,11 +7,11 @@ namespace Magento\Version\Test\Unit\Controller\Index; -use Magento\Version\Controller\Index\Index as VersionIndex; use Magento\Framework\App\Action\Context; use Magento\Framework\App\ProductMetadataInterface; use Magento\Framework\App\ResponseInterface; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Version\Controller\Index\Index as VersionIndex; use PHPUnit\Framework\TestCase; class IndexTest extends TestCase @@ -73,7 +73,7 @@ protected function setUp() /** * Git Base version does not return information about version */ - public function testGitBasedInstallationDoesNotReturnVersion() + public function testGitBasedInstallationDoesNotReturnVersion(): void { $this->productMetadataMock->expects($this->any()) ->method('getVersion') @@ -88,7 +88,7 @@ public function testGitBasedInstallationDoesNotReturnVersion() /** * Magento Community returns information about major and minor version of product */ - public function testCommunityVersionDisplaysMajorMinorVersionAndEditionName() + public function testCommunityVersionDisplaysMajorMinorVersionAndEditionName(): void { $this->productMetadataMock->expects($this->any())->method('getVersion')->willReturn('2.3.3'); $this->productMetadataMock->expects($this->any())->method('getEdition')->willReturn('Community'); From 2ad3c354d0b5595a604e7292b7b6d30c09bb9921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 19 Dec 2019 04:58:29 +0100 Subject: [PATCH 0507/1143] Fix Static Analysis --- app/code/Magento/Version/Controller/Index/Index.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/Magento/Version/Controller/Index/Index.php b/app/code/Magento/Version/Controller/Index/Index.php index a6accaeb7d52f..53bcd4b4ff700 100644 --- a/app/code/Magento/Version/Controller/Index/Index.php +++ b/app/code/Magento/Version/Controller/Index/Index.php @@ -36,8 +36,7 @@ public function __construct(Context $context, ProductMetadataInterface $productM } /** - * Sets the response body to ProductName/Major.MinorVersion (Edition). E.g.: Magento/0.42 (Community). Omits patch - * version from response + * Sets the response body to ProductName/Major.MinorVersion (Edition). * * @return void */ From cfd5c22848f82f29f69cd42ffbcc8e09fa848568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Szubert?= <bartlomiejszubert@gmail.com> Date: Thu, 19 Dec 2019 05:00:50 +0100 Subject: [PATCH 0508/1143] Fix #25390 - fix backward incompatible constructor in UPS carrier, cleanup of class imports --- app/code/Magento/Ups/Model/Carrier.php | 160 ++++++++++++++----------- 1 file changed, 90 insertions(+), 70 deletions(-) diff --git a/app/code/Magento/Ups/Model/Carrier.php b/app/code/Magento/Ups/Model/Carrier.php index 9e33b86ea8215..103ba9d3fb4b7 100644 --- a/app/code/Magento/Ups/Model/Carrier.php +++ b/app/code/Magento/Ups/Model/Carrier.php @@ -7,6 +7,12 @@ namespace Magento\Ups\Model; +use Magento\CatalogInventory\Api\StockRegistryInterface; +use Magento\Directory\Helper\Data; +use Magento\Directory\Model\CountryFactory; +use Magento\Directory\Model\CurrencyFactory; +use Magento\Directory\Model\RegionFactory; +use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\App\ObjectManager; use Magento\Framework\Async\CallbackDeferred; use Magento\Framework\DataObject; @@ -15,16 +21,30 @@ use Magento\Framework\HTTP\AsyncClient\Request; use Magento\Framework\HTTP\AsyncClientInterface; use Magento\Framework\HTTP\ClientFactory; +use Magento\Framework\Locale\FormatInterface; use Magento\Framework\Xml\Security; use Magento\Quote\Model\Quote\Address\RateRequest; use Magento\Quote\Model\Quote\Address\RateResult\Error; +use Magento\Quote\Model\Quote\Address\RateResult\ErrorFactory as RateErrorFactory; +use Magento\Quote\Model\Quote\Address\RateResult\MethodFactory as RateMethodFactory; +use Magento\Sales\Model\Order\Shipment as OrderShipment; use Magento\Shipping\Model\Carrier\AbstractCarrierOnline; use Magento\Shipping\Model\Carrier\CarrierInterface; use Magento\Shipping\Model\Rate\Result; use Magento\Shipping\Model\Rate\Result\ProxyDeferredFactory; +use Magento\Shipping\Model\Rate\ResultFactory as RateFactory; use Magento\Shipping\Model\Simplexml\Element; +use Magento\Shipping\Model\Simplexml\ElementFactory; +use Magento\Shipping\Model\Tracking\Result\ErrorFactory as TrackErrorFactory; +use Magento\Shipping\Model\Tracking\Result\StatusFactory as TrackStatusFactory; +use Magento\Shipping\Model\Tracking\ResultFactory as TrackFactory; +use Magento\Store\Model\ScopeInterface; use Magento\Ups\Helper\Config; use Magento\Shipping\Model\Shipment\Request as Shipment; +use Psr\Log\LoggerInterface; +use RuntimeException; +use Throwable; +use Zend_Http_Client; /** * UPS shipping implementation @@ -117,12 +137,12 @@ class Carrier extends AbstractCarrierOnline implements CarrierInterface protected $_customizableContainerTypes = ['CP', 'CSP']; /** - * @var \Magento\Framework\Locale\FormatInterface + * @var FormatInterface */ protected $_localeFormat; /** - * @var \Psr\Log\LoggerInterface + * @var LoggerInterface */ protected $_logger; @@ -149,22 +169,22 @@ class Carrier extends AbstractCarrierOnline implements CarrierInterface private $deferredProxyFactory; /** - * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig - * @param \Magento\Quote\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory - * @param \Psr\Log\LoggerInterface $logger + * @param ScopeConfigInterface $scopeConfig + * @param RateErrorFactory $rateErrorFactory + * @param LoggerInterface $logger * @param Security $xmlSecurity - * @param \Magento\Shipping\Model\Simplexml\ElementFactory $xmlElFactory - * @param \Magento\Shipping\Model\Rate\ResultFactory $rateFactory - * @param \Magento\Quote\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory - * @param \Magento\Shipping\Model\Tracking\ResultFactory $trackFactory - * @param \Magento\Shipping\Model\Tracking\Result\ErrorFactory $trackErrorFactory - * @param \Magento\Shipping\Model\Tracking\Result\StatusFactory $trackStatusFactory - * @param \Magento\Directory\Model\RegionFactory $regionFactory - * @param \Magento\Directory\Model\CountryFactory $countryFactory - * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory - * @param \Magento\Directory\Helper\Data $directoryData - * @param \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry - * @param \Magento\Framework\Locale\FormatInterface $localeFormat + * @param ElementFactory $xmlElFactory + * @param RateFactory $rateFactory + * @param RateMethodFactory $rateMethodFactory + * @param TrackFactory $trackFactory + * @param TrackErrorFactory $trackErrorFactory + * @param TrackStatusFactory $trackStatusFactory + * @param RegionFactory $regionFactory + * @param CountryFactory $countryFactory + * @param CurrencyFactory $currencyFactory + * @param Data $directoryData + * @param StockRegistryInterface $stockRegistry + * @param FormatInterface $localeFormat * @param Config $configHelper * @param ClientFactory $httpClientFactory * @param array $data @@ -175,27 +195,27 @@ class Carrier extends AbstractCarrierOnline implements CarrierInterface * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function __construct( - \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, - \Magento\Quote\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory, - \Psr\Log\LoggerInterface $logger, + ScopeConfigInterface $scopeConfig, + RateErrorFactory $rateErrorFactory, + LoggerInterface $logger, Security $xmlSecurity, - \Magento\Shipping\Model\Simplexml\ElementFactory $xmlElFactory, - \Magento\Shipping\Model\Rate\ResultFactory $rateFactory, - \Magento\Quote\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory, - \Magento\Shipping\Model\Tracking\ResultFactory $trackFactory, - \Magento\Shipping\Model\Tracking\Result\ErrorFactory $trackErrorFactory, - \Magento\Shipping\Model\Tracking\Result\StatusFactory $trackStatusFactory, - \Magento\Directory\Model\RegionFactory $regionFactory, - \Magento\Directory\Model\CountryFactory $countryFactory, - \Magento\Directory\Model\CurrencyFactory $currencyFactory, - \Magento\Directory\Helper\Data $directoryData, - \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry, - \Magento\Framework\Locale\FormatInterface $localeFormat, + ElementFactory $xmlElFactory, + RateFactory $rateFactory, + RateMethodFactory $rateMethodFactory, + TrackFactory $trackFactory, + TrackErrorFactory $trackErrorFactory, + TrackStatusFactory $trackStatusFactory, + RegionFactory $regionFactory, + CountryFactory $countryFactory, + CurrencyFactory $currencyFactory, + Data $directoryData, + StockRegistryInterface $stockRegistry, + FormatInterface $localeFormat, Config $configHelper, ClientFactory $httpClientFactory, array $data = [], ?AsyncClientInterface $asyncHttpClient = null, - ?ProxyDeferredFactory $proxyDeferredFactory + ?ProxyDeferredFactory $proxyDeferredFactory = null ) { parent::__construct( $scopeConfig, @@ -265,7 +285,7 @@ public function setRequest(RateRequest $request) { $this->_request = $request; - $rowRequest = new \Magento\Framework\DataObject(); + $rowRequest = new DataObject(); if ($request->getLimitMethod()) { $rowRequest->setAction($this->configHelper->getCode('action', 'single')); @@ -300,8 +320,8 @@ public function setRequest(RateRequest $request) $origCountry = $request->getOrigCountry(); } else { $origCountry = $this->_scopeConfig->getValue( - \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_COUNTRY_ID, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + OrderShipment::XML_PATH_STORE_COUNTRY_ID, + ScopeInterface::SCOPE_STORE, $request->getStoreId() ); } @@ -312,8 +332,8 @@ public function setRequest(RateRequest $request) $origRegionCode = $request->getOrigRegionCode(); } else { $origRegionCode = $this->_scopeConfig->getValue( - \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_REGION_ID, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + OrderShipment::XML_PATH_STORE_REGION_ID, + ScopeInterface::SCOPE_STORE, $request->getStoreId() ); } @@ -327,8 +347,8 @@ public function setRequest(RateRequest $request) } else { $rowRequest->setOrigPostal( $this->_scopeConfig->getValue( - \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_ZIP, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + OrderShipment::XML_PATH_STORE_ZIP, + ScopeInterface::SCOPE_STORE, $request->getStoreId() ) ); @@ -339,8 +359,8 @@ public function setRequest(RateRequest $request) } else { $rowRequest->setOrigCity( $this->_scopeConfig->getValue( - \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_CITY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + OrderShipment::XML_PATH_STORE_CITY, + ScopeInterface::SCOPE_STORE, $request->getStoreId() ) ); @@ -516,7 +536,7 @@ protected function _getCgiQuotes() if (!$url) { $url = $this->_defaultCgiGatewayUrl; } - $client = new \Zend_Http_Client(); + $client = new Zend_Http_Client(); $client->setUri($url); $client->setConfig(['maxredirects' => 0, 'timeout' => 30]); $client->setParameterGet($params); @@ -525,7 +545,7 @@ protected function _getCgiQuotes() $debugData['result'] = $responseBody; $this->_setCachedQuotes($params, $responseBody); - } catch (\Throwable $e) { + } catch (Throwable $e) { $debugData['result'] = ['error' => $e->getMessage(), 'code' => $e->getCode()]; $responseBody = ''; } @@ -727,7 +747,7 @@ protected function _getXmlQuotes() <StateProvinceCode>{$shipperStateProvince}</StateProvinceCode> </Address> </Shipper> - + <ShipTo> <Address> <PostalCode>{$params['19_destPostal']}</PostalCode> @@ -743,7 +763,7 @@ protected function _getXmlQuotes() $xmlParams .= <<<XMLRequest </Address> </ShipTo> - + <ShipFrom> <Address> <PostalCode>{$params['15_origPostal']}</PostalCode> @@ -1056,7 +1076,7 @@ protected function setXMLAccessRequest() * Get cgi tracking * * @param string[] $trackings - * @return \Magento\Shipping\Model\Tracking\ResultFactory + * @return TrackFactory */ protected function _getCgiTracking($trackings) { @@ -1321,13 +1341,13 @@ public function getAllowedMethods() /** * Form XML for shipment request * - * @param \Magento\Framework\DataObject $request + * @param DataObject $request * @return string * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - protected function _formShipmentRequest(\Magento\Framework\DataObject $request) + protected function _formShipmentRequest(DataObject $request) { $packageParams = $request->getPackageParams(); $height = $packageParams->getHeight(); @@ -1339,7 +1359,7 @@ protected function _formShipmentRequest(\Magento\Framework\DataObject $request) $itemsDesc = []; $itemsShipment = $request->getPackageItems(); foreach ($itemsShipment as $itemShipment) { - $item = new \Magento\Framework\DataObject(); + $item = new DataObject(); $item->setData($itemShipment); $itemsDesc[] = $item->getName(); } @@ -1533,7 +1553,7 @@ protected function _formShipmentRequest(\Magento\Framework\DataObject $request) * Send and process shipment accept request * * @param Element $shipmentConfirmResponse - * @return \Magento\Framework\DataObject + * @return DataObject * @deprecated New asynchronous methods introduced. * @see requestToShipment */ @@ -1559,18 +1579,18 @@ protected function _sendShipmentAcceptRequest(Element $shipmentConfirmResponse) $xmlResponse = $deferredResponse->get()->getBody(); $debugData['result'] = $xmlResponse; $this->_setCachedQuotes($xmlRequest, $xmlResponse); - } catch (\Throwable $e) { + } catch (Throwable $e) { $debugData['result'] = ['error' => $e->getMessage(), 'code' => $e->getCode()]; $xmlResponse = ''; } try { $response = $this->_xmlElFactory->create(['data' => $xmlResponse]); - } catch (\Throwable $e) { + } catch (Throwable $e) { $debugData['result'] = ['error' => $e->getMessage(), 'code' => $e->getCode()]; } - $result = new \Magento\Framework\DataObject(); + $result = new DataObject(); if (isset($response->Error)) { $result->setErrors((string)$response->Error->ErrorDescription); } else { @@ -1609,7 +1629,7 @@ public function getShipAcceptUrl() * @param DataObject[] $packages * @return string[] Quote IDs. * @throws LocalizedException - * @throws \RuntimeException + * @throws RuntimeException */ private function requestQuotes(array $packages): array { @@ -1640,13 +1660,13 @@ private function requestQuotes(array $packages): array try { /** @var Element $response */ $response = $this->_xmlElFactory->create(['data' => $httpResponse->getBody()]); - } catch (\Throwable $e) { - throw new \RuntimeException($e->getMessage()); + } catch (Throwable $e) { + throw new RuntimeException($e->getMessage()); } if (isset($response->Response->Error) && in_array($response->Response->Error->ErrorSeverity, ['Hard', 'Transient']) ) { - throw new \RuntimeException((string)$response->Response->Error->ErrorDescription); + throw new RuntimeException((string)$response->Response->Error->ErrorDescription); } $ids[] = $response->ShipmentDigest; @@ -1661,7 +1681,7 @@ private function requestQuotes(array $packages): array * @param string[] $quoteIds * @return DataObject[] * @throws LocalizedException - * @throws \RuntimeException + * @throws RuntimeException */ private function requestShipments(array $quoteIds): array { @@ -1697,11 +1717,11 @@ private function requestShipments(array $quoteIds): array try { /** @var Element $response */ $response = $this->_xmlElFactory->create(['data' => $httpResponse->getBody()]); - } catch (\Throwable $e) { - throw new \RuntimeException($e->getMessage()); + } catch (Throwable $e) { + throw new RuntimeException($e->getMessage()); } if (isset($response->Error)) { - throw new \RuntimeException((string)$response->Error->ErrorDescription); + throw new RuntimeException((string)$response->Error->ErrorDescription); } else { $shippingLabelContent = (string)$response->ShipmentResults->PackageResults->LabelImage->GraphicImage; $trackingNumber = (string)$response->ShipmentResults->PackageResults->TrackingNumber; @@ -1726,7 +1746,7 @@ private function requestShipments(array $quoteIds): array protected function _doShipmentRequest(DataObject $request) { $this->_prepareShipmentRequest($request); - $result = new \Magento\Framework\DataObject(); + $result = new DataObject(); $rawXmlRequest = $this->_formShipmentRequest($request); $this->setXMLAccessRequest(); $xmlRequest = $this->_xmlAccessRequest . $rawXmlRequest; @@ -1747,14 +1767,14 @@ protected function _doShipmentRequest(DataObject $request) $xmlResponse = $deferredResponse->get()->getBody(); $debugData['result'] = $xmlResponse; $this->_setCachedQuotes($xmlRequest, $xmlResponse); - } catch (\Throwable $e) { + } catch (Throwable $e) { $debugData['result'] = ['code' => $e->getCode(), 'error' => $e->getMessage()]; } } try { $response = $this->_xmlElFactory->create(['data' => $xmlResponse]); - } catch (\Throwable $e) { + } catch (Throwable $e) { $debugData['result'] = ['error' => $e->getMessage(), 'code' => $e->getCode()]; $result->setErrors($e->getMessage()); } @@ -1827,7 +1847,7 @@ public function requestToShipment($request) $labels = $this->requestShipments($quoteIds); } catch (LocalizedException $exception) { return new DataObject(['errors' => [$exception->getMessage()]]); - } catch (\RuntimeException $exception) { + } catch (RuntimeException $exception) { return new DataObject(['errors' => __('Failed to send items')]); } // phpcs:enable @@ -1848,11 +1868,11 @@ public function returnOfShipment($request) /** * Return container types of carrier * - * @param \Magento\Framework\DataObject|null $params + * @param DataObject|null $params * @return array|bool * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ - public function getContainerTypes(\Magento\Framework\DataObject $params = null) + public function getContainerTypes(DataObject $params = null) { if ($params === null) { return $this->_getAllowedContainers($params); @@ -1932,10 +1952,10 @@ public function getContainerTypesFilter() /** * Return delivery confirmation types of carrier * - * @param \Magento\Framework\DataObject|null $params + * @param DataObject|null $params * @return array|bool */ - public function getDeliveryConfirmationTypes(\Magento\Framework\DataObject $params = null) + public function getDeliveryConfirmationTypes(DataObject $params = null) { $countryRecipient = $params != null ? $params->getCountryRecipient() : null; $deliveryConfirmationTypes = []; From 2179e73729b37f3aaebf0229f043f69e8d775b40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 19 Dec 2019 05:04:27 +0100 Subject: [PATCH 0509/1143] `use` section does not need leading backslash --- app/code/Magento/AdminAnalytics/registration.php | 2 +- app/code/Magento/AdminNotification/registration.php | 2 +- app/code/Magento/AdvancedPricingImportExport/registration.php | 2 +- app/code/Magento/AdvancedSearch/registration.php | 2 +- app/code/Magento/Amqp/registration.php | 2 +- app/code/Magento/AmqpStore/registration.php | 2 +- app/code/Magento/AsynchronousOperations/registration.php | 2 +- app/code/Magento/Authorization/registration.php | 2 +- app/code/Magento/Authorizenet/registration.php | 2 +- app/code/Magento/AuthorizenetAcceptjs/registration.php | 2 +- app/code/Magento/AuthorizenetCardinal/registration.php | 2 +- app/code/Magento/Backend/registration.php | 2 +- app/code/Magento/Backup/registration.php | 2 +- app/code/Magento/Braintree/registration.php | 2 +- app/code/Magento/Bundle/registration.php | 2 +- app/code/Magento/BundleImportExport/registration.php | 2 +- app/code/Magento/CacheInvalidate/registration.php | 2 +- app/code/Magento/Captcha/registration.php | 2 +- app/code/Magento/CardinalCommerce/registration.php | 2 +- app/code/Magento/Catalog/registration.php | 2 +- app/code/Magento/CatalogImportExport/registration.php | 2 +- app/code/Magento/CatalogInventory/registration.php | 2 +- app/code/Magento/CatalogRule/registration.php | 2 +- app/code/Magento/CatalogRuleConfigurable/registration.php | 2 +- app/code/Magento/CatalogSearch/registration.php | 2 +- app/code/Magento/CatalogUrlRewrite/registration.php | 2 +- app/code/Magento/CatalogWidget/registration.php | 2 +- app/code/Magento/Checkout/registration.php | 2 +- app/code/Magento/CheckoutAgreements/registration.php | 2 +- app/code/Magento/Cms/registration.php | 2 +- app/code/Magento/CmsUrlRewrite/registration.php | 2 +- app/code/Magento/Config/registration.php | 2 +- app/code/Magento/ConfigurableImportExport/registration.php | 2 +- app/code/Magento/ConfigurableProduct/registration.php | 2 +- app/code/Magento/ConfigurableProductSales/registration.php | 2 +- app/code/Magento/Contact/registration.php | 2 +- app/code/Magento/Cookie/registration.php | 2 +- app/code/Magento/Cron/registration.php | 2 +- app/code/Magento/Csp/registration.php | 2 +- app/code/Magento/CurrencySymbol/registration.php | 2 +- app/code/Magento/Customer/registration.php | 2 +- app/code/Magento/CustomerImportExport/registration.php | 2 +- app/code/Magento/Deploy/registration.php | 2 +- app/code/Magento/Developer/registration.php | 2 +- app/code/Magento/Dhl/registration.php | 2 +- app/code/Magento/Directory/registration.php | 2 +- app/code/Magento/Downloadable/registration.php | 2 +- app/code/Magento/DownloadableImportExport/registration.php | 2 +- app/code/Magento/Eav/registration.php | 2 +- app/code/Magento/Email/registration.php | 2 +- app/code/Magento/EncryptionKey/registration.php | 2 +- app/code/Magento/Fedex/registration.php | 2 +- app/code/Magento/GiftMessage/registration.php | 2 +- app/code/Magento/GoogleAdwords/registration.php | 2 +- app/code/Magento/GoogleAnalytics/registration.php | 2 +- app/code/Magento/GoogleOptimizer/registration.php | 2 +- app/code/Magento/GroupedCatalogInventory/registration.php | 2 +- app/code/Magento/GroupedImportExport/registration.php | 2 +- app/code/Magento/GroupedProduct/registration.php | 2 +- app/code/Magento/ImportExport/registration.php | 2 +- app/code/Magento/Indexer/registration.php | 2 +- app/code/Magento/InstantPurchase/registration.php | 2 +- app/code/Magento/Integration/registration.php | 2 +- app/code/Magento/LayeredNavigation/registration.php | 2 +- app/code/Magento/Marketplace/registration.php | 2 +- app/code/Magento/MediaStorage/registration.php | 2 +- app/code/Magento/MessageQueue/registration.php | 2 +- app/code/Magento/Msrp/registration.php | 2 +- app/code/Magento/MsrpConfigurableProduct/registration.php | 2 +- app/code/Magento/MsrpGroupedProduct/registration.php | 2 +- app/code/Magento/Multishipping/registration.php | 2 +- app/code/Magento/MysqlMq/registration.php | 2 +- app/code/Magento/NewRelicReporting/registration.php | 2 +- app/code/Magento/Newsletter/registration.php | 2 +- app/code/Magento/OfflinePayments/registration.php | 2 +- app/code/Magento/OfflineShipping/registration.php | 2 +- app/code/Magento/PageCache/registration.php | 2 +- app/code/Magento/Payment/registration.php | 2 +- app/code/Magento/Paypal/registration.php | 2 +- app/code/Magento/PaypalCaptcha/registration.php | 2 +- app/code/Magento/PaypalGraphQl/registration.php | 2 +- app/code/Magento/Persistent/registration.php | 2 +- app/code/Magento/ProductAlert/registration.php | 2 +- app/code/Magento/ProductVideo/registration.php | 2 +- app/code/Magento/Quote/registration.php | 2 +- app/code/Magento/Reports/registration.php | 2 +- app/code/Magento/RequireJs/registration.php | 2 +- app/code/Magento/Review/registration.php | 2 +- app/code/Magento/Robots/registration.php | 2 +- app/code/Magento/Rss/registration.php | 2 +- app/code/Magento/Rule/registration.php | 2 +- app/code/Magento/Sales/registration.php | 2 +- app/code/Magento/SalesInventory/registration.php | 2 +- app/code/Magento/SalesRule/registration.php | 2 +- app/code/Magento/SalesSequence/registration.php | 2 +- app/code/Magento/SampleData/registration.php | 2 +- app/code/Magento/Search/registration.php | 2 +- app/code/Magento/Security/registration.php | 2 +- app/code/Magento/SendFriend/registration.php | 2 +- app/code/Magento/Shipping/registration.php | 2 +- app/code/Magento/Signifyd/registration.php | 2 +- app/code/Magento/Sitemap/registration.php | 2 +- app/code/Magento/Store/registration.php | 2 +- app/code/Magento/Swagger/registration.php | 2 +- app/code/Magento/SwaggerWebapi/registration.php | 2 +- app/code/Magento/SwaggerWebapiAsync/registration.php | 2 +- app/code/Magento/Swatches/registration.php | 2 +- app/code/Magento/SwatchesLayeredNavigation/registration.php | 2 +- app/code/Magento/Tax/registration.php | 2 +- app/code/Magento/TaxImportExport/registration.php | 2 +- app/code/Magento/Theme/registration.php | 2 +- app/code/Magento/Tinymce3/registration.php | 2 +- app/code/Magento/Translation/registration.php | 2 +- app/code/Magento/Ui/registration.php | 2 +- app/code/Magento/Ups/registration.php | 2 +- app/code/Magento/UrlRewrite/registration.php | 2 +- app/code/Magento/User/registration.php | 2 +- app/code/Magento/Usps/registration.php | 2 +- app/code/Magento/Variable/registration.php | 2 +- app/code/Magento/Vault/registration.php | 2 +- app/code/Magento/Version/registration.php | 2 +- app/code/Magento/Webapi/registration.php | 2 +- app/code/Magento/WebapiSecurity/registration.php | 2 +- app/code/Magento/Weee/registration.php | 2 +- app/code/Magento/Widget/registration.php | 2 +- app/code/Magento/Wishlist/registration.php | 2 +- app/design/adminhtml/Magento/backend/registration.php | 2 +- app/design/frontend/Magento/blank/registration.php | 2 +- app/design/frontend/Magento/luma/registration.php | 2 +- app/i18n/Magento/de_DE/registration.php | 2 +- app/i18n/Magento/en_US/registration.php | 2 +- app/i18n/Magento/es_ES/registration.php | 2 +- app/i18n/Magento/fr_FR/registration.php | 2 +- app/i18n/Magento/nl_NL/registration.php | 2 +- app/i18n/Magento/pt_BR/registration.php | 2 +- app/i18n/Magento/zh_Hans_CN/registration.php | 2 +- .../Test/Annotation/_files/components/a/aa/aaa/registration.php | 2 +- .../Test/Annotation/_files/components/a/aa/registration.php | 2 +- .../Test/Annotation/_files/components/b/registration.php | 2 +- .../Magento/Test/Annotation/_files/components/registration.php | 2 +- .../design/adminhtml/Magento/test_default/registration.php | 2 +- .../testsuite/Magento/Deploy/_files/zoom1/registration.php | 2 +- .../testsuite/Magento/Deploy/_files/zoom2/registration.php | 2 +- .../testsuite/Magento/Deploy/_files/zoom3/registration.php | 2 +- .../_files/design/adminhtml/Magento/default/registration.php | 2 +- .../design/adminhtml/Vendor/custom_theme/registration.php | 2 +- .../_files/design/adminhtml/Vendor/default/registration.php | 2 +- .../_files/design/frontend/Magento/default/registration.php | 2 +- .../_files/design/frontend/Vendor/custom_theme/registration.php | 2 +- .../_files/design/frontend/Vendor/default/registration.php | 2 +- .../Framework/App/Language/_files/bar/en_gb/registration.php | 2 +- .../Framework/App/Language/_files/bar/en_us/registration.php | 2 +- .../Framework/App/Language/_files/baz/en_gb/registration.php | 2 +- .../Framework/App/Language/_files/first/en_us/registration.php | 2 +- .../Framework/App/Language/_files/foo/en_au/registration.php | 2 +- .../Framework/App/Language/_files/my/ru_ru/registration.php | 2 +- .../Framework/App/Language/_files/second/en_gb/registration.php | 2 +- .../Framework/App/Language/_files/theirs/ru_ru/registration.php | 2 +- .../App/Utility/_files/fixtures/language/registration.php | 2 +- .../App/Utility/_files/fixtures/library/registration.php | 2 +- .../App/Utility/_files/fixtures/module/registration.php | 2 +- .../App/Utility/_files/fixtures/theme/registration.php | 2 +- .../Css/PreProcessor/_files/code/Magento/Other/registration.php | 2 +- .../Css/PreProcessor/_files/code/Magento/Third/registration.php | 2 +- .../_files/design/frontend/Test/default/registration.php | 2 +- .../_files/design/frontend/Test/parent/registration.php | 2 +- .../Framework/View/_files/Fixture_Module/registration.php | 2 +- .../Framework/View/_files/UiComponent/theme/registration.php | 2 +- .../_files/fallback/app/code/ViewTest_Module/registration.php | 2 +- .../design/frontend/Vendor/custom_theme/registration.php | 2 +- .../design/frontend/Vendor/custom_theme2/registration.php | 2 +- .../fallback/design/frontend/Vendor/default/registration.php | 2 +- .../design/frontend/Vendor/standalone_theme/registration.php | 2 +- .../Magento/Framework/View/_files/static/theme/registration.php | 2 +- .../Command/_files/root/app/code/Magento/A/registration.php | 2 +- .../Command/_files/root/app/code/Magento/B/registration.php | 2 +- .../Command/_files/root/app/code/Magento/C/registration.php | 2 +- .../Command/_files/root/app/code/Magento/D/registration.php | 2 +- .../Model/_files/design/adminhtml/Vendor/test/registration.php | 2 +- .../_files/design/area_two/Vendor/theme_one/registration.php | 2 +- .../_files/design/design_area/Vendor/theme_one/registration.php | 2 +- .../_files/design/frontend/Magento/default/registration.php | 2 +- .../design/frontend/Magento/default_iphone/registration.php | 2 +- .../design/frontend/Test/cache_test_theme/registration.php | 2 +- .../Model/_files/design/frontend/Test/default/registration.php | 2 +- .../_files/design/frontend/Test/publication/registration.php | 2 +- .../_files/design/frontend/Test/test_theme/registration.php | 2 +- .../_files/design/frontend/Vendor/custom_theme/registration.php | 2 +- .../_files/design/frontend/Vendor/default/registration.php | 2 +- lib/internal/Magento/Framework/Amqp/registration.php | 2 +- lib/internal/Magento/Framework/Bulk/registration.php | 2 +- lib/internal/Magento/Framework/MessageQueue/registration.php | 2 +- lib/internal/Magento/Framework/registration.php | 2 +- setup/src/Magento/Setup/registration.php | 2 +- 194 files changed, 194 insertions(+), 194 deletions(-) diff --git a/app/code/Magento/AdminAnalytics/registration.php b/app/code/Magento/AdminAnalytics/registration.php index 65c9955d396a8..7d45f9f2b82e5 100644 --- a/app/code/Magento/AdminAnalytics/registration.php +++ b/app/code/Magento/AdminAnalytics/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_AdminAnalytics', __DIR__); diff --git a/app/code/Magento/AdminNotification/registration.php b/app/code/Magento/AdminNotification/registration.php index 8d427a458c18d..de8995efdb137 100644 --- a/app/code/Magento/AdminNotification/registration.php +++ b/app/code/Magento/AdminNotification/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_AdminNotification', __DIR__); diff --git a/app/code/Magento/AdvancedPricingImportExport/registration.php b/app/code/Magento/AdvancedPricingImportExport/registration.php index 7a1d2feeccd45..8429e82b27fda 100644 --- a/app/code/Magento/AdvancedPricingImportExport/registration.php +++ b/app/code/Magento/AdvancedPricingImportExport/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_AdvancedPricingImportExport', __DIR__); diff --git a/app/code/Magento/AdvancedSearch/registration.php b/app/code/Magento/AdvancedSearch/registration.php index c82ffa8e7e4d6..2c600f550dcf5 100644 --- a/app/code/Magento/AdvancedSearch/registration.php +++ b/app/code/Magento/AdvancedSearch/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_AdvancedSearch', __DIR__); diff --git a/app/code/Magento/Amqp/registration.php b/app/code/Magento/Amqp/registration.php index 17d8382c698e8..2e4a4f362f1a3 100644 --- a/app/code/Magento/Amqp/registration.php +++ b/app/code/Magento/Amqp/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Amqp', __DIR__); diff --git a/app/code/Magento/AmqpStore/registration.php b/app/code/Magento/AmqpStore/registration.php index 4922879bfbf16..22ce677dc8302 100644 --- a/app/code/Magento/AmqpStore/registration.php +++ b/app/code/Magento/AmqpStore/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_AmqpStore', __DIR__); diff --git a/app/code/Magento/AsynchronousOperations/registration.php b/app/code/Magento/AsynchronousOperations/registration.php index d384df583fb5a..748f9d35aad5c 100644 --- a/app/code/Magento/AsynchronousOperations/registration.php +++ b/app/code/Magento/AsynchronousOperations/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_AsynchronousOperations', __DIR__); diff --git a/app/code/Magento/Authorization/registration.php b/app/code/Magento/Authorization/registration.php index 0007aeba9a1ba..a4520bdcdb26b 100644 --- a/app/code/Magento/Authorization/registration.php +++ b/app/code/Magento/Authorization/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Authorization', __DIR__); diff --git a/app/code/Magento/Authorizenet/registration.php b/app/code/Magento/Authorizenet/registration.php index b96b8227bbbf8..cb3bedaaee27d 100644 --- a/app/code/Magento/Authorizenet/registration.php +++ b/app/code/Magento/Authorizenet/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Authorizenet', __DIR__); diff --git a/app/code/Magento/AuthorizenetAcceptjs/registration.php b/app/code/Magento/AuthorizenetAcceptjs/registration.php index 5338c9a4ddc80..52a0c497a0993 100644 --- a/app/code/Magento/AuthorizenetAcceptjs/registration.php +++ b/app/code/Magento/AuthorizenetAcceptjs/registration.php @@ -6,6 +6,6 @@ declare(strict_types=1); -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_AuthorizenetAcceptjs', __DIR__); diff --git a/app/code/Magento/AuthorizenetCardinal/registration.php b/app/code/Magento/AuthorizenetCardinal/registration.php index 0153e9eaa4d29..7d663df3c3e3a 100644 --- a/app/code/Magento/AuthorizenetCardinal/registration.php +++ b/app/code/Magento/AuthorizenetCardinal/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_AuthorizenetCardinal', __DIR__); diff --git a/app/code/Magento/Backend/registration.php b/app/code/Magento/Backend/registration.php index a7a5a58ca0d9c..8f0c19af6e89a 100644 --- a/app/code/Magento/Backend/registration.php +++ b/app/code/Magento/Backend/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Backend', __DIR__); diff --git a/app/code/Magento/Backup/registration.php b/app/code/Magento/Backup/registration.php index 811e3c5657484..59864b84d8217 100644 --- a/app/code/Magento/Backup/registration.php +++ b/app/code/Magento/Backup/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Backup', __DIR__); diff --git a/app/code/Magento/Braintree/registration.php b/app/code/Magento/Braintree/registration.php index 9a266e9706c7d..1a0d00ec6557d 100644 --- a/app/code/Magento/Braintree/registration.php +++ b/app/code/Magento/Braintree/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Braintree', __DIR__); diff --git a/app/code/Magento/Bundle/registration.php b/app/code/Magento/Bundle/registration.php index 85d0b8d5c7a3e..bd7dc39cb4ad6 100644 --- a/app/code/Magento/Bundle/registration.php +++ b/app/code/Magento/Bundle/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Bundle', __DIR__); diff --git a/app/code/Magento/BundleImportExport/registration.php b/app/code/Magento/BundleImportExport/registration.php index 2f68e2e05c036..db96b4d9dd470 100644 --- a/app/code/Magento/BundleImportExport/registration.php +++ b/app/code/Magento/BundleImportExport/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_BundleImportExport', __DIR__); diff --git a/app/code/Magento/CacheInvalidate/registration.php b/app/code/Magento/CacheInvalidate/registration.php index 5910edade1092..1c1ac92e330b0 100644 --- a/app/code/Magento/CacheInvalidate/registration.php +++ b/app/code/Magento/CacheInvalidate/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_CacheInvalidate', __DIR__); diff --git a/app/code/Magento/Captcha/registration.php b/app/code/Magento/Captcha/registration.php index d6c49c719c969..6721e4abcec61 100644 --- a/app/code/Magento/Captcha/registration.php +++ b/app/code/Magento/Captcha/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Captcha', __DIR__); diff --git a/app/code/Magento/CardinalCommerce/registration.php b/app/code/Magento/CardinalCommerce/registration.php index 26fb168fb0ae2..714c7692cf4b5 100644 --- a/app/code/Magento/CardinalCommerce/registration.php +++ b/app/code/Magento/CardinalCommerce/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_CardinalCommerce', __DIR__); diff --git a/app/code/Magento/Catalog/registration.php b/app/code/Magento/Catalog/registration.php index fb94e04aa2be0..e18d43d9a36d8 100644 --- a/app/code/Magento/Catalog/registration.php +++ b/app/code/Magento/Catalog/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Catalog', __DIR__); diff --git a/app/code/Magento/CatalogImportExport/registration.php b/app/code/Magento/CatalogImportExport/registration.php index 144a7cdaeeea0..bd6683f4af4d1 100644 --- a/app/code/Magento/CatalogImportExport/registration.php +++ b/app/code/Magento/CatalogImportExport/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_CatalogImportExport', __DIR__); diff --git a/app/code/Magento/CatalogInventory/registration.php b/app/code/Magento/CatalogInventory/registration.php index da5cb708ea17f..d39cc2074d890 100644 --- a/app/code/Magento/CatalogInventory/registration.php +++ b/app/code/Magento/CatalogInventory/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_CatalogInventory', __DIR__); diff --git a/app/code/Magento/CatalogRule/registration.php b/app/code/Magento/CatalogRule/registration.php index ec3cbee2e1582..fb370fedf3752 100644 --- a/app/code/Magento/CatalogRule/registration.php +++ b/app/code/Magento/CatalogRule/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_CatalogRule', __DIR__); diff --git a/app/code/Magento/CatalogRuleConfigurable/registration.php b/app/code/Magento/CatalogRuleConfigurable/registration.php index 0cc791e23a9a4..5f60111f246f1 100644 --- a/app/code/Magento/CatalogRuleConfigurable/registration.php +++ b/app/code/Magento/CatalogRuleConfigurable/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_CatalogRuleConfigurable', __DIR__); diff --git a/app/code/Magento/CatalogSearch/registration.php b/app/code/Magento/CatalogSearch/registration.php index 959e26c84a722..31f792d2ea90c 100644 --- a/app/code/Magento/CatalogSearch/registration.php +++ b/app/code/Magento/CatalogSearch/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_CatalogSearch', __DIR__); diff --git a/app/code/Magento/CatalogUrlRewrite/registration.php b/app/code/Magento/CatalogUrlRewrite/registration.php index 50a5544c738d0..f00aaf5bb5518 100644 --- a/app/code/Magento/CatalogUrlRewrite/registration.php +++ b/app/code/Magento/CatalogUrlRewrite/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_CatalogUrlRewrite', __DIR__); diff --git a/app/code/Magento/CatalogWidget/registration.php b/app/code/Magento/CatalogWidget/registration.php index f9e6a76047ad9..09cd043c70c76 100644 --- a/app/code/Magento/CatalogWidget/registration.php +++ b/app/code/Magento/CatalogWidget/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_CatalogWidget', __DIR__); diff --git a/app/code/Magento/Checkout/registration.php b/app/code/Magento/Checkout/registration.php index 741146232ee25..ca98e2eef761f 100644 --- a/app/code/Magento/Checkout/registration.php +++ b/app/code/Magento/Checkout/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Checkout', __DIR__); diff --git a/app/code/Magento/CheckoutAgreements/registration.php b/app/code/Magento/CheckoutAgreements/registration.php index b4d4ce25d2826..15562341a94ae 100644 --- a/app/code/Magento/CheckoutAgreements/registration.php +++ b/app/code/Magento/CheckoutAgreements/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_CheckoutAgreements', __DIR__); diff --git a/app/code/Magento/Cms/registration.php b/app/code/Magento/Cms/registration.php index d9feda25d6118..aa55b4932fdba 100644 --- a/app/code/Magento/Cms/registration.php +++ b/app/code/Magento/Cms/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Cms', __DIR__); diff --git a/app/code/Magento/CmsUrlRewrite/registration.php b/app/code/Magento/CmsUrlRewrite/registration.php index aad46cb41827c..6acd495235110 100644 --- a/app/code/Magento/CmsUrlRewrite/registration.php +++ b/app/code/Magento/CmsUrlRewrite/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_CmsUrlRewrite', __DIR__); diff --git a/app/code/Magento/Config/registration.php b/app/code/Magento/Config/registration.php index 8a57e9d5c2217..a6dd84b3a23ef 100644 --- a/app/code/Magento/Config/registration.php +++ b/app/code/Magento/Config/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Config', __DIR__); diff --git a/app/code/Magento/ConfigurableImportExport/registration.php b/app/code/Magento/ConfigurableImportExport/registration.php index 103565fb30a93..305ff345893c0 100644 --- a/app/code/Magento/ConfigurableImportExport/registration.php +++ b/app/code/Magento/ConfigurableImportExport/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_ConfigurableImportExport', __DIR__); diff --git a/app/code/Magento/ConfigurableProduct/registration.php b/app/code/Magento/ConfigurableProduct/registration.php index fdb3fba0c9912..80572b8609ec6 100644 --- a/app/code/Magento/ConfigurableProduct/registration.php +++ b/app/code/Magento/ConfigurableProduct/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_ConfigurableProduct', __DIR__); diff --git a/app/code/Magento/ConfigurableProductSales/registration.php b/app/code/Magento/ConfigurableProductSales/registration.php index 99affe39c15c1..a6d88cff482e4 100644 --- a/app/code/Magento/ConfigurableProductSales/registration.php +++ b/app/code/Magento/ConfigurableProductSales/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_ConfigurableProductSales', __DIR__); diff --git a/app/code/Magento/Contact/registration.php b/app/code/Magento/Contact/registration.php index b280b2e0b81a2..0d8b36f51eda5 100644 --- a/app/code/Magento/Contact/registration.php +++ b/app/code/Magento/Contact/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Contact', __DIR__); diff --git a/app/code/Magento/Cookie/registration.php b/app/code/Magento/Cookie/registration.php index 64f13f19968ce..5b5b7b1f3c96f 100644 --- a/app/code/Magento/Cookie/registration.php +++ b/app/code/Magento/Cookie/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Cookie', __DIR__); diff --git a/app/code/Magento/Cron/registration.php b/app/code/Magento/Cron/registration.php index d22298a2efc37..97f162d76ec52 100644 --- a/app/code/Magento/Cron/registration.php +++ b/app/code/Magento/Cron/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Cron', __DIR__); diff --git a/app/code/Magento/Csp/registration.php b/app/code/Magento/Csp/registration.php index 90f4a25452858..337cfbc23f2de 100644 --- a/app/code/Magento/Csp/registration.php +++ b/app/code/Magento/Csp/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Csp', __DIR__); diff --git a/app/code/Magento/CurrencySymbol/registration.php b/app/code/Magento/CurrencySymbol/registration.php index 4dea4264e8b62..bf30fc7fe6a7b 100644 --- a/app/code/Magento/CurrencySymbol/registration.php +++ b/app/code/Magento/CurrencySymbol/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_CurrencySymbol', __DIR__); diff --git a/app/code/Magento/Customer/registration.php b/app/code/Magento/Customer/registration.php index 744defc54ab27..4b88dbdab1d0e 100644 --- a/app/code/Magento/Customer/registration.php +++ b/app/code/Magento/Customer/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Customer', __DIR__); diff --git a/app/code/Magento/CustomerImportExport/registration.php b/app/code/Magento/CustomerImportExport/registration.php index 1cfb0ed8899ad..68a23fe6be57c 100644 --- a/app/code/Magento/CustomerImportExport/registration.php +++ b/app/code/Magento/CustomerImportExport/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_CustomerImportExport', __DIR__); diff --git a/app/code/Magento/Deploy/registration.php b/app/code/Magento/Deploy/registration.php index 138d03fd303cf..6cd92601dff88 100644 --- a/app/code/Magento/Deploy/registration.php +++ b/app/code/Magento/Deploy/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Deploy', __DIR__); diff --git a/app/code/Magento/Developer/registration.php b/app/code/Magento/Developer/registration.php index 1d3fb6148ce1f..e99b1ed24b104 100644 --- a/app/code/Magento/Developer/registration.php +++ b/app/code/Magento/Developer/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Developer', __DIR__); diff --git a/app/code/Magento/Dhl/registration.php b/app/code/Magento/Dhl/registration.php index 4d69e96f1ff8a..a8a0b58a5c6f3 100644 --- a/app/code/Magento/Dhl/registration.php +++ b/app/code/Magento/Dhl/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Dhl', __DIR__); diff --git a/app/code/Magento/Directory/registration.php b/app/code/Magento/Directory/registration.php index 17dece4a9d79d..142b6a3114384 100644 --- a/app/code/Magento/Directory/registration.php +++ b/app/code/Magento/Directory/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Directory', __DIR__); diff --git a/app/code/Magento/Downloadable/registration.php b/app/code/Magento/Downloadable/registration.php index c50856603fa50..a99b7129eebc8 100644 --- a/app/code/Magento/Downloadable/registration.php +++ b/app/code/Magento/Downloadable/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Downloadable', __DIR__); diff --git a/app/code/Magento/DownloadableImportExport/registration.php b/app/code/Magento/DownloadableImportExport/registration.php index 0dcd082deb6d8..35147034c8d1e 100644 --- a/app/code/Magento/DownloadableImportExport/registration.php +++ b/app/code/Magento/DownloadableImportExport/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_DownloadableImportExport', __DIR__); diff --git a/app/code/Magento/Eav/registration.php b/app/code/Magento/Eav/registration.php index 6506d5cd06738..07b222f67f633 100644 --- a/app/code/Magento/Eav/registration.php +++ b/app/code/Magento/Eav/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Eav', __DIR__); diff --git a/app/code/Magento/Email/registration.php b/app/code/Magento/Email/registration.php index 70601ab3d3b04..132f509e93cc0 100644 --- a/app/code/Magento/Email/registration.php +++ b/app/code/Magento/Email/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Email', __DIR__); diff --git a/app/code/Magento/EncryptionKey/registration.php b/app/code/Magento/EncryptionKey/registration.php index 4426a9200e571..773cf44a207c4 100644 --- a/app/code/Magento/EncryptionKey/registration.php +++ b/app/code/Magento/EncryptionKey/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_EncryptionKey', __DIR__); diff --git a/app/code/Magento/Fedex/registration.php b/app/code/Magento/Fedex/registration.php index bb44e20ec4674..3562091f9ba68 100644 --- a/app/code/Magento/Fedex/registration.php +++ b/app/code/Magento/Fedex/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Fedex', __DIR__); diff --git a/app/code/Magento/GiftMessage/registration.php b/app/code/Magento/GiftMessage/registration.php index c7268d09cf929..78676ef9c32d0 100644 --- a/app/code/Magento/GiftMessage/registration.php +++ b/app/code/Magento/GiftMessage/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_GiftMessage', __DIR__); diff --git a/app/code/Magento/GoogleAdwords/registration.php b/app/code/Magento/GoogleAdwords/registration.php index 76aa83a3a55f9..e6ef3f7625f19 100644 --- a/app/code/Magento/GoogleAdwords/registration.php +++ b/app/code/Magento/GoogleAdwords/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_GoogleAdwords', __DIR__); diff --git a/app/code/Magento/GoogleAnalytics/registration.php b/app/code/Magento/GoogleAnalytics/registration.php index c2a8471a50ba2..6eae65b9d159e 100644 --- a/app/code/Magento/GoogleAnalytics/registration.php +++ b/app/code/Magento/GoogleAnalytics/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_GoogleAnalytics', __DIR__); diff --git a/app/code/Magento/GoogleOptimizer/registration.php b/app/code/Magento/GoogleOptimizer/registration.php index 36b94ef06eb18..4ba336ece8916 100644 --- a/app/code/Magento/GoogleOptimizer/registration.php +++ b/app/code/Magento/GoogleOptimizer/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_GoogleOptimizer', __DIR__); diff --git a/app/code/Magento/GroupedCatalogInventory/registration.php b/app/code/Magento/GroupedCatalogInventory/registration.php index 8899a48edf6d5..f9b2729acb45a 100644 --- a/app/code/Magento/GroupedCatalogInventory/registration.php +++ b/app/code/Magento/GroupedCatalogInventory/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_GroupedCatalogInventory', __DIR__); diff --git a/app/code/Magento/GroupedImportExport/registration.php b/app/code/Magento/GroupedImportExport/registration.php index 90beb26820c47..de4aec530794e 100644 --- a/app/code/Magento/GroupedImportExport/registration.php +++ b/app/code/Magento/GroupedImportExport/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_GroupedImportExport', __DIR__); diff --git a/app/code/Magento/GroupedProduct/registration.php b/app/code/Magento/GroupedProduct/registration.php index 8fd2f11a2f628..c3a7c4c12b1c6 100644 --- a/app/code/Magento/GroupedProduct/registration.php +++ b/app/code/Magento/GroupedProduct/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_GroupedProduct', __DIR__); diff --git a/app/code/Magento/ImportExport/registration.php b/app/code/Magento/ImportExport/registration.php index 5ecc71fa8676c..85df9b374fb4c 100644 --- a/app/code/Magento/ImportExport/registration.php +++ b/app/code/Magento/ImportExport/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_ImportExport', __DIR__); diff --git a/app/code/Magento/Indexer/registration.php b/app/code/Magento/Indexer/registration.php index dda2240601779..0a5f37e97ac82 100644 --- a/app/code/Magento/Indexer/registration.php +++ b/app/code/Magento/Indexer/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Indexer', __DIR__); diff --git a/app/code/Magento/InstantPurchase/registration.php b/app/code/Magento/InstantPurchase/registration.php index 74b4f3e92cf44..1f2fce8c12c07 100644 --- a/app/code/Magento/InstantPurchase/registration.php +++ b/app/code/Magento/InstantPurchase/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_InstantPurchase', __DIR__); diff --git a/app/code/Magento/Integration/registration.php b/app/code/Magento/Integration/registration.php index d73b6ae57eeb5..6d0fea09e2a40 100644 --- a/app/code/Magento/Integration/registration.php +++ b/app/code/Magento/Integration/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Integration', __DIR__); diff --git a/app/code/Magento/LayeredNavigation/registration.php b/app/code/Magento/LayeredNavigation/registration.php index 7c4f8dff9c920..9df0a63ae945f 100644 --- a/app/code/Magento/LayeredNavigation/registration.php +++ b/app/code/Magento/LayeredNavigation/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_LayeredNavigation', __DIR__); diff --git a/app/code/Magento/Marketplace/registration.php b/app/code/Magento/Marketplace/registration.php index 7d4bbca27f15f..6ccf343d76427 100644 --- a/app/code/Magento/Marketplace/registration.php +++ b/app/code/Magento/Marketplace/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Marketplace', __DIR__); diff --git a/app/code/Magento/MediaStorage/registration.php b/app/code/Magento/MediaStorage/registration.php index 8bfa83028eeeb..552f668426125 100644 --- a/app/code/Magento/MediaStorage/registration.php +++ b/app/code/Magento/MediaStorage/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_MediaStorage', __DIR__); diff --git a/app/code/Magento/MessageQueue/registration.php b/app/code/Magento/MessageQueue/registration.php index e27fa71517427..5608dbce482a9 100644 --- a/app/code/Magento/MessageQueue/registration.php +++ b/app/code/Magento/MessageQueue/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_MessageQueue', __DIR__); diff --git a/app/code/Magento/Msrp/registration.php b/app/code/Magento/Msrp/registration.php index 0c0269b39eeac..147d789975c3e 100644 --- a/app/code/Magento/Msrp/registration.php +++ b/app/code/Magento/Msrp/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Msrp', __DIR__); diff --git a/app/code/Magento/MsrpConfigurableProduct/registration.php b/app/code/Magento/MsrpConfigurableProduct/registration.php index d4d58ec3c013b..e0772ae9c78fd 100644 --- a/app/code/Magento/MsrpConfigurableProduct/registration.php +++ b/app/code/Magento/MsrpConfigurableProduct/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_MsrpConfigurableProduct', __DIR__); diff --git a/app/code/Magento/MsrpGroupedProduct/registration.php b/app/code/Magento/MsrpGroupedProduct/registration.php index c5a261e66c640..a429ec00cd437 100644 --- a/app/code/Magento/MsrpGroupedProduct/registration.php +++ b/app/code/Magento/MsrpGroupedProduct/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_MsrpGroupedProduct', __DIR__); diff --git a/app/code/Magento/Multishipping/registration.php b/app/code/Magento/Multishipping/registration.php index 6598a8e431ca8..f19d2c4d740d8 100644 --- a/app/code/Magento/Multishipping/registration.php +++ b/app/code/Magento/Multishipping/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Multishipping', __DIR__); diff --git a/app/code/Magento/MysqlMq/registration.php b/app/code/Magento/MysqlMq/registration.php index e13a38b468005..b0799f79b463f 100644 --- a/app/code/Magento/MysqlMq/registration.php +++ b/app/code/Magento/MysqlMq/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_MysqlMq', __DIR__); diff --git a/app/code/Magento/NewRelicReporting/registration.php b/app/code/Magento/NewRelicReporting/registration.php index 39984a11e26a3..8d43f8d1de563 100644 --- a/app/code/Magento/NewRelicReporting/registration.php +++ b/app/code/Magento/NewRelicReporting/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_NewRelicReporting', __DIR__); diff --git a/app/code/Magento/Newsletter/registration.php b/app/code/Magento/Newsletter/registration.php index 421b594ad6b88..b1a5714ff8a4d 100644 --- a/app/code/Magento/Newsletter/registration.php +++ b/app/code/Magento/Newsletter/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Newsletter', __DIR__); diff --git a/app/code/Magento/OfflinePayments/registration.php b/app/code/Magento/OfflinePayments/registration.php index 4b5473194f1e4..f3d1fd1488c76 100644 --- a/app/code/Magento/OfflinePayments/registration.php +++ b/app/code/Magento/OfflinePayments/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_OfflinePayments', __DIR__); diff --git a/app/code/Magento/OfflineShipping/registration.php b/app/code/Magento/OfflineShipping/registration.php index ce3611a90c657..5c2ff2d82f1fd 100644 --- a/app/code/Magento/OfflineShipping/registration.php +++ b/app/code/Magento/OfflineShipping/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_OfflineShipping', __DIR__); diff --git a/app/code/Magento/PageCache/registration.php b/app/code/Magento/PageCache/registration.php index 32628ae4446c9..69d49f120d4cf 100644 --- a/app/code/Magento/PageCache/registration.php +++ b/app/code/Magento/PageCache/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_PageCache', __DIR__); diff --git a/app/code/Magento/Payment/registration.php b/app/code/Magento/Payment/registration.php index 12f826a2ad5ce..9b1fb56a89600 100644 --- a/app/code/Magento/Payment/registration.php +++ b/app/code/Magento/Payment/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Payment', __DIR__); diff --git a/app/code/Magento/Paypal/registration.php b/app/code/Magento/Paypal/registration.php index f915d1d7b18d7..5b86f0d1ed627 100644 --- a/app/code/Magento/Paypal/registration.php +++ b/app/code/Magento/Paypal/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Paypal', __DIR__); diff --git a/app/code/Magento/PaypalCaptcha/registration.php b/app/code/Magento/PaypalCaptcha/registration.php index 4dac0582a6d1b..79f8a56411078 100644 --- a/app/code/Magento/PaypalCaptcha/registration.php +++ b/app/code/Magento/PaypalCaptcha/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_PaypalCaptcha', __DIR__); diff --git a/app/code/Magento/PaypalGraphQl/registration.php b/app/code/Magento/PaypalGraphQl/registration.php index 2e1676bc087cc..d3eb5dd3095a6 100644 --- a/app/code/Magento/PaypalGraphQl/registration.php +++ b/app/code/Magento/PaypalGraphQl/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_PaypalGraphQl', __DIR__); diff --git a/app/code/Magento/Persistent/registration.php b/app/code/Magento/Persistent/registration.php index bc77434391517..4ff1c96a45ae8 100644 --- a/app/code/Magento/Persistent/registration.php +++ b/app/code/Magento/Persistent/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Persistent', __DIR__); diff --git a/app/code/Magento/ProductAlert/registration.php b/app/code/Magento/ProductAlert/registration.php index d1492a6d10db6..f049de4aef26a 100644 --- a/app/code/Magento/ProductAlert/registration.php +++ b/app/code/Magento/ProductAlert/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_ProductAlert', __DIR__); diff --git a/app/code/Magento/ProductVideo/registration.php b/app/code/Magento/ProductVideo/registration.php index 39f0c452d3611..e49e231283f42 100644 --- a/app/code/Magento/ProductVideo/registration.php +++ b/app/code/Magento/ProductVideo/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_ProductVideo', __DIR__); diff --git a/app/code/Magento/Quote/registration.php b/app/code/Magento/Quote/registration.php index f74a3ac5ff9e5..da3425918cf0f 100644 --- a/app/code/Magento/Quote/registration.php +++ b/app/code/Magento/Quote/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Quote', __DIR__); diff --git a/app/code/Magento/Reports/registration.php b/app/code/Magento/Reports/registration.php index f903b78961992..6ab949d92db73 100644 --- a/app/code/Magento/Reports/registration.php +++ b/app/code/Magento/Reports/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Reports', __DIR__); diff --git a/app/code/Magento/RequireJs/registration.php b/app/code/Magento/RequireJs/registration.php index 8e2104a874ad4..4920ac99bbe96 100644 --- a/app/code/Magento/RequireJs/registration.php +++ b/app/code/Magento/RequireJs/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_RequireJs', __DIR__); diff --git a/app/code/Magento/Review/registration.php b/app/code/Magento/Review/registration.php index 3325f6194118f..0588c9a1a7620 100644 --- a/app/code/Magento/Review/registration.php +++ b/app/code/Magento/Review/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Review', __DIR__); diff --git a/app/code/Magento/Robots/registration.php b/app/code/Magento/Robots/registration.php index 36d898abfa9fb..343344d3910ff 100644 --- a/app/code/Magento/Robots/registration.php +++ b/app/code/Magento/Robots/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Robots', __DIR__); diff --git a/app/code/Magento/Rss/registration.php b/app/code/Magento/Rss/registration.php index 4ab2ddf494665..dc8ba0d5d88ba 100644 --- a/app/code/Magento/Rss/registration.php +++ b/app/code/Magento/Rss/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Rss', __DIR__); diff --git a/app/code/Magento/Rule/registration.php b/app/code/Magento/Rule/registration.php index 00c72c5c0a9ba..21bce7ba05833 100644 --- a/app/code/Magento/Rule/registration.php +++ b/app/code/Magento/Rule/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Rule', __DIR__); diff --git a/app/code/Magento/Sales/registration.php b/app/code/Magento/Sales/registration.php index db3b2aebce0bb..6945521f30abe 100644 --- a/app/code/Magento/Sales/registration.php +++ b/app/code/Magento/Sales/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Sales', __DIR__); diff --git a/app/code/Magento/SalesInventory/registration.php b/app/code/Magento/SalesInventory/registration.php index a6c9a6bc3e669..f2c0adf20a039 100644 --- a/app/code/Magento/SalesInventory/registration.php +++ b/app/code/Magento/SalesInventory/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_SalesInventory', __DIR__); diff --git a/app/code/Magento/SalesRule/registration.php b/app/code/Magento/SalesRule/registration.php index b3e6cf5bc1b14..53305ca8287f7 100644 --- a/app/code/Magento/SalesRule/registration.php +++ b/app/code/Magento/SalesRule/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_SalesRule', __DIR__); diff --git a/app/code/Magento/SalesSequence/registration.php b/app/code/Magento/SalesSequence/registration.php index 57b9c79bc1055..576b3dc5b9efb 100644 --- a/app/code/Magento/SalesSequence/registration.php +++ b/app/code/Magento/SalesSequence/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_SalesSequence', __DIR__); diff --git a/app/code/Magento/SampleData/registration.php b/app/code/Magento/SampleData/registration.php index 05c37ae1aec60..2e86fc7e1cc48 100644 --- a/app/code/Magento/SampleData/registration.php +++ b/app/code/Magento/SampleData/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_SampleData', __DIR__); diff --git a/app/code/Magento/Search/registration.php b/app/code/Magento/Search/registration.php index 177f95971c8af..48210f971c4c0 100644 --- a/app/code/Magento/Search/registration.php +++ b/app/code/Magento/Search/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Search', __DIR__); diff --git a/app/code/Magento/Security/registration.php b/app/code/Magento/Security/registration.php index b5bc1db3aec6e..80cc28f8d2103 100644 --- a/app/code/Magento/Security/registration.php +++ b/app/code/Magento/Security/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Security', __DIR__); diff --git a/app/code/Magento/SendFriend/registration.php b/app/code/Magento/SendFriend/registration.php index f8edd64000b50..37453eca71e3a 100644 --- a/app/code/Magento/SendFriend/registration.php +++ b/app/code/Magento/SendFriend/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_SendFriend', __DIR__); diff --git a/app/code/Magento/Shipping/registration.php b/app/code/Magento/Shipping/registration.php index 10a1bc529a534..9652f5a61a3bc 100644 --- a/app/code/Magento/Shipping/registration.php +++ b/app/code/Magento/Shipping/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Shipping', __DIR__); diff --git a/app/code/Magento/Signifyd/registration.php b/app/code/Magento/Signifyd/registration.php index 72b11f7eac214..e7fa9cfd2f9b3 100644 --- a/app/code/Magento/Signifyd/registration.php +++ b/app/code/Magento/Signifyd/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Signifyd', __DIR__); diff --git a/app/code/Magento/Sitemap/registration.php b/app/code/Magento/Sitemap/registration.php index 9fc965c854779..b713ddb98f381 100644 --- a/app/code/Magento/Sitemap/registration.php +++ b/app/code/Magento/Sitemap/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Sitemap', __DIR__); diff --git a/app/code/Magento/Store/registration.php b/app/code/Magento/Store/registration.php index 62be25fbdf6ab..64b5f9df52c0c 100644 --- a/app/code/Magento/Store/registration.php +++ b/app/code/Magento/Store/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Store', __DIR__); diff --git a/app/code/Magento/Swagger/registration.php b/app/code/Magento/Swagger/registration.php index 7d7b8d2662a1f..562f7d2e5196d 100644 --- a/app/code/Magento/Swagger/registration.php +++ b/app/code/Magento/Swagger/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Swagger', __DIR__); diff --git a/app/code/Magento/SwaggerWebapi/registration.php b/app/code/Magento/SwaggerWebapi/registration.php index 595497df7cfeb..bc551c2ea3cd5 100644 --- a/app/code/Magento/SwaggerWebapi/registration.php +++ b/app/code/Magento/SwaggerWebapi/registration.php @@ -6,6 +6,6 @@ declare(strict_types=1); -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_SwaggerWebapi', __DIR__); diff --git a/app/code/Magento/SwaggerWebapiAsync/registration.php b/app/code/Magento/SwaggerWebapiAsync/registration.php index 8805b81ca28a1..6af92fe040fd5 100644 --- a/app/code/Magento/SwaggerWebapiAsync/registration.php +++ b/app/code/Magento/SwaggerWebapiAsync/registration.php @@ -6,6 +6,6 @@ declare(strict_types=1); -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_SwaggerWebapiAsync', __DIR__); diff --git a/app/code/Magento/Swatches/registration.php b/app/code/Magento/Swatches/registration.php index 8589c4b71ea47..7f1f20aa18cc2 100644 --- a/app/code/Magento/Swatches/registration.php +++ b/app/code/Magento/Swatches/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Swatches', __DIR__); diff --git a/app/code/Magento/SwatchesLayeredNavigation/registration.php b/app/code/Magento/SwatchesLayeredNavigation/registration.php index f773212378ce1..8ddcbb0753810 100644 --- a/app/code/Magento/SwatchesLayeredNavigation/registration.php +++ b/app/code/Magento/SwatchesLayeredNavigation/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_SwatchesLayeredNavigation', __DIR__); diff --git a/app/code/Magento/Tax/registration.php b/app/code/Magento/Tax/registration.php index 3568ba311e9f2..2d36e0cc4c992 100644 --- a/app/code/Magento/Tax/registration.php +++ b/app/code/Magento/Tax/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Tax', __DIR__); diff --git a/app/code/Magento/TaxImportExport/registration.php b/app/code/Magento/TaxImportExport/registration.php index 63093dc25aa6d..67b67b55cbeee 100644 --- a/app/code/Magento/TaxImportExport/registration.php +++ b/app/code/Magento/TaxImportExport/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TaxImportExport', __DIR__); diff --git a/app/code/Magento/Theme/registration.php b/app/code/Magento/Theme/registration.php index 8f2b360da9d33..c00f6e4ba2136 100644 --- a/app/code/Magento/Theme/registration.php +++ b/app/code/Magento/Theme/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Theme', __DIR__); diff --git a/app/code/Magento/Tinymce3/registration.php b/app/code/Magento/Tinymce3/registration.php index fd57434a6280f..1e561dd1ae36a 100644 --- a/app/code/Magento/Tinymce3/registration.php +++ b/app/code/Magento/Tinymce3/registration.php @@ -3,6 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Tinymce3', __DIR__); diff --git a/app/code/Magento/Translation/registration.php b/app/code/Magento/Translation/registration.php index 2e3adaf378181..7c6266026c5b0 100644 --- a/app/code/Magento/Translation/registration.php +++ b/app/code/Magento/Translation/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Translation', __DIR__); diff --git a/app/code/Magento/Ui/registration.php b/app/code/Magento/Ui/registration.php index 28d4d44e82d9b..d6d80766703fe 100644 --- a/app/code/Magento/Ui/registration.php +++ b/app/code/Magento/Ui/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Ui', __DIR__); diff --git a/app/code/Magento/Ups/registration.php b/app/code/Magento/Ups/registration.php index 4c87e21b00ac7..c9d7f2b58c86f 100644 --- a/app/code/Magento/Ups/registration.php +++ b/app/code/Magento/Ups/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Ups', __DIR__); diff --git a/app/code/Magento/UrlRewrite/registration.php b/app/code/Magento/UrlRewrite/registration.php index 225a51f517569..87a28d518fab3 100644 --- a/app/code/Magento/UrlRewrite/registration.php +++ b/app/code/Magento/UrlRewrite/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_UrlRewrite', __DIR__); diff --git a/app/code/Magento/User/registration.php b/app/code/Magento/User/registration.php index c00bc0a633803..9a81d456f5f57 100644 --- a/app/code/Magento/User/registration.php +++ b/app/code/Magento/User/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_User', __DIR__); diff --git a/app/code/Magento/Usps/registration.php b/app/code/Magento/Usps/registration.php index 988089ccda954..32fe2a6a49fbd 100644 --- a/app/code/Magento/Usps/registration.php +++ b/app/code/Magento/Usps/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Usps', __DIR__); diff --git a/app/code/Magento/Variable/registration.php b/app/code/Magento/Variable/registration.php index a35a0da8b2c79..c68fbb63c2e64 100644 --- a/app/code/Magento/Variable/registration.php +++ b/app/code/Magento/Variable/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Variable', __DIR__); diff --git a/app/code/Magento/Vault/registration.php b/app/code/Magento/Vault/registration.php index 704dd359d139c..4959a7f61cd7c 100644 --- a/app/code/Magento/Vault/registration.php +++ b/app/code/Magento/Vault/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Vault', __DIR__); diff --git a/app/code/Magento/Version/registration.php b/app/code/Magento/Version/registration.php index 24daee14ec3da..e2a8d758ae15b 100644 --- a/app/code/Magento/Version/registration.php +++ b/app/code/Magento/Version/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Version', __DIR__); diff --git a/app/code/Magento/Webapi/registration.php b/app/code/Magento/Webapi/registration.php index 1ce2579e4e7c8..1836a29955e86 100644 --- a/app/code/Magento/Webapi/registration.php +++ b/app/code/Magento/Webapi/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Webapi', __DIR__); diff --git a/app/code/Magento/WebapiSecurity/registration.php b/app/code/Magento/WebapiSecurity/registration.php index a25eea9deb660..fc6d8e76c9754 100644 --- a/app/code/Magento/WebapiSecurity/registration.php +++ b/app/code/Magento/WebapiSecurity/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_WebapiSecurity', __DIR__); diff --git a/app/code/Magento/Weee/registration.php b/app/code/Magento/Weee/registration.php index 874705ab5c6b1..73623ce882acb 100644 --- a/app/code/Magento/Weee/registration.php +++ b/app/code/Magento/Weee/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Weee', __DIR__); diff --git a/app/code/Magento/Widget/registration.php b/app/code/Magento/Widget/registration.php index 27e924eba367e..c7821664fdaca 100644 --- a/app/code/Magento/Widget/registration.php +++ b/app/code/Magento/Widget/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Widget', __DIR__); diff --git a/app/code/Magento/Wishlist/registration.php b/app/code/Magento/Wishlist/registration.php index ea46a972ef449..b4c9f523ab95f 100644 --- a/app/code/Magento/Wishlist/registration.php +++ b/app/code/Magento/Wishlist/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Wishlist', __DIR__); diff --git a/app/design/adminhtml/Magento/backend/registration.php b/app/design/adminhtml/Magento/backend/registration.php index 039f3a141e382..e15cc9c18604b 100644 --- a/app/design/adminhtml/Magento/backend/registration.php +++ b/app/design/adminhtml/Magento/backend/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'adminhtml/Magento/backend', __DIR__); diff --git a/app/design/frontend/Magento/blank/registration.php b/app/design/frontend/Magento/blank/registration.php index 211f3fca131cc..297ae6d98ee41 100644 --- a/app/design/frontend/Magento/blank/registration.php +++ b/app/design/frontend/Magento/blank/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Magento/blank', __DIR__); diff --git a/app/design/frontend/Magento/luma/registration.php b/app/design/frontend/Magento/luma/registration.php index 41921c06fd040..f8a2c3bdb8b2e 100644 --- a/app/design/frontend/Magento/luma/registration.php +++ b/app/design/frontend/Magento/luma/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Magento/luma', __DIR__); diff --git a/app/i18n/Magento/de_DE/registration.php b/app/i18n/Magento/de_DE/registration.php index 12f479d30b1e1..fae5a938af236 100644 --- a/app/i18n/Magento/de_DE/registration.php +++ b/app/i18n/Magento/de_DE/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'magento_de_de', __DIR__); diff --git a/app/i18n/Magento/en_US/registration.php b/app/i18n/Magento/en_US/registration.php index a8fd609af0592..25c6ce2b53eda 100644 --- a/app/i18n/Magento/en_US/registration.php +++ b/app/i18n/Magento/en_US/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'magento_en_us', __DIR__); diff --git a/app/i18n/Magento/es_ES/registration.php b/app/i18n/Magento/es_ES/registration.php index b22457a5be4d9..6109afe6b3aa2 100644 --- a/app/i18n/Magento/es_ES/registration.php +++ b/app/i18n/Magento/es_ES/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'magento_es_es', __DIR__); diff --git a/app/i18n/Magento/fr_FR/registration.php b/app/i18n/Magento/fr_FR/registration.php index ed866adf28cd1..bca5547092867 100644 --- a/app/i18n/Magento/fr_FR/registration.php +++ b/app/i18n/Magento/fr_FR/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'magento_fr_fr', __DIR__); diff --git a/app/i18n/Magento/nl_NL/registration.php b/app/i18n/Magento/nl_NL/registration.php index b86c41cd8c76d..27a93b13df5eb 100644 --- a/app/i18n/Magento/nl_NL/registration.php +++ b/app/i18n/Magento/nl_NL/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'magento_nl_nl', __DIR__); diff --git a/app/i18n/Magento/pt_BR/registration.php b/app/i18n/Magento/pt_BR/registration.php index eec9dc7895f29..edfbb40f0a78e 100644 --- a/app/i18n/Magento/pt_BR/registration.php +++ b/app/i18n/Magento/pt_BR/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'magento_pt_br', __DIR__); diff --git a/app/i18n/Magento/zh_Hans_CN/registration.php b/app/i18n/Magento/zh_Hans_CN/registration.php index 675778b201e41..da291a0d1b98b 100644 --- a/app/i18n/Magento/zh_Hans_CN/registration.php +++ b/app/i18n/Magento/zh_Hans_CN/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'magento_zh_hans_cn', __DIR__); diff --git a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/_files/components/a/aa/aaa/registration.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/_files/components/a/aa/aaa/registration.php index 6dba3551281e3..b3a410e609d52 100644 --- a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/_files/components/a/aa/aaa/registration.php +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/_files/components/a/aa/aaa/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Magento/theme', __DIR__); diff --git a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/_files/components/a/aa/registration.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/_files/components/a/aa/registration.php index 30dd39c36f2a4..045a53181a7d3 100644 --- a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/_files/components/a/aa/registration.php +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/_files/components/a/aa/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'magento_language', __DIR__); diff --git a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/_files/components/b/registration.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/_files/components/b/registration.php index 8d3b9b440fd7d..8c3c7576dc3f4 100644 --- a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/_files/components/b/registration.php +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/_files/components/b/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::LIBRARY, 'magento/library', __DIR__); diff --git a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/_files/components/registration.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/_files/components/registration.php index ddc564ae5a143..effc8b6954787 100644 --- a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/_files/components/registration.php +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/_files/components/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_ModuleOne', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/_files/design/adminhtml/Magento/test_default/registration.php b/dev/tests/integration/testsuite/Magento/Backend/Block/_files/design/adminhtml/Magento/test_default/registration.php index 89cf740bbd4f4..31ad793efca38 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/_files/design/adminhtml/Magento/test_default/registration.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/_files/design/adminhtml/Magento/test_default/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'adminhtml/BackendTest/test_default', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Deploy/_files/zoom1/registration.php b/dev/tests/integration/testsuite/Magento/Deploy/_files/zoom1/registration.php index 52d41c2a2ebb3..21c05427ed6f5 100644 --- a/dev/tests/integration/testsuite/Magento/Deploy/_files/zoom1/registration.php +++ b/dev/tests/integration/testsuite/Magento/Deploy/_files/zoom1/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Magento/zoom1', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Deploy/_files/zoom2/registration.php b/dev/tests/integration/testsuite/Magento/Deploy/_files/zoom2/registration.php index a6979a1cae451..b40bf194aee19 100644 --- a/dev/tests/integration/testsuite/Magento/Deploy/_files/zoom2/registration.php +++ b/dev/tests/integration/testsuite/Magento/Deploy/_files/zoom2/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Magento/zoom2', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Deploy/_files/zoom3/registration.php b/dev/tests/integration/testsuite/Magento/Deploy/_files/zoom3/registration.php index fc0867f7d0107..bd6adc89add51 100644 --- a/dev/tests/integration/testsuite/Magento/Deploy/_files/zoom3/registration.php +++ b/dev/tests/integration/testsuite/Magento/Deploy/_files/zoom3/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Magento/zoom3', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Magento/default/registration.php b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Magento/default/registration.php index 4ef58e212e553..fd9a15a8185c7 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Magento/default/registration.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Magento/default/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'adminhtml/Magento_EmailTest/default', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Vendor/custom_theme/registration.php b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Vendor/custom_theme/registration.php index dac1b36e4880f..b03665afa7861 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Vendor/custom_theme/registration.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Vendor/custom_theme/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'adminhtml/Vendor_EmailTest/custom_theme', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Vendor/default/registration.php b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Vendor/default/registration.php index 879ba0266769e..e38e516d784e2 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Vendor/default/registration.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Vendor/default/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'adminhtml/Vendor_EmailTest/default', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Magento/default/registration.php b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Magento/default/registration.php index 92f1ead3c6d55..2cba0d2b2378c 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Magento/default/registration.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Magento/default/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Magento_EmailTest/default', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Vendor/custom_theme/registration.php b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Vendor/custom_theme/registration.php index d2953eb161503..39d4b3364aa0c 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Vendor/custom_theme/registration.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Vendor/custom_theme/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Vendor_EmailTest/custom_theme', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Vendor/default/registration.php b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Vendor/default/registration.php index 3d310791d8f48..3f46f3beb6962 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Vendor/default/registration.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Vendor/default/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Vendor_EmailTest/default', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_gb/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_gb/registration.php index 9c774ed93ae56..6eb6124298e84 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_gb/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_gb/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'bar_en_gb', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_us/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_us/registration.php index 19127f4a0e2c8..7f792bf5941ca 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_us/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_us/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'bar_en_us', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/baz/en_gb/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/baz/en_gb/registration.php index c66abb59b91c1..d065d77ad8ca3 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/baz/en_gb/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/baz/en_gb/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'baz_en_gb', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/first/en_us/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/first/en_us/registration.php index d15b384138fbc..48dfbf20c9f26 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/first/en_us/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/first/en_us/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'first_en_us', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/foo/en_au/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/foo/en_au/registration.php index b8deab01733d0..ba7fd323cfd94 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/foo/en_au/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/foo/en_au/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'foo_en_au', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/my/ru_ru/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/my/ru_ru/registration.php index c9e0d2dbf14b4..e7e7a045a36a7 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/my/ru_ru/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/my/ru_ru/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'my_ru_ru', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/second/en_gb/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/second/en_gb/registration.php index 742164c4fa56d..6c84974fea235 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/second/en_gb/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/second/en_gb/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'second_en_gb', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/theirs/ru_ru/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/theirs/ru_ru/registration.php index 6924c5e624d32..e78422d5ebeb3 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/theirs/ru_ru/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/theirs/ru_ru/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'theirs_ru_ru', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Utility/_files/fixtures/language/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Utility/_files/fixtures/language/registration.php index 0c8673f00dbf6..1a5326ad6627d 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Utility/_files/fixtures/language/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Utility/_files/fixtures/language/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'magento_test_lang', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Utility/_files/fixtures/library/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Utility/_files/fixtures/library/registration.php index 037159b48ce64..f14a169b2e56b 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Utility/_files/fixtures/library/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Utility/_files/fixtures/library/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::LIBRARY, 'magento/test', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Utility/_files/fixtures/module/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Utility/_files/fixtures/module/registration.php index 5e082df446665..95def30dd5f26 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Utility/_files/fixtures/module/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Utility/_files/fixtures/module/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Module', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Utility/_files/fixtures/theme/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Utility/_files/fixtures/theme/registration.php index c286f6c57d87f..da95bfe5f1519 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Utility/_files/fixtures/theme/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Utility/_files/fixtures/theme/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Test/theme', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/_files/code/Magento/Other/registration.php b/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/_files/code/Magento/Other/registration.php index 1b40e66b1f7a1..34fb5831076b8 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/_files/code/Magento/Other/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/_files/code/Magento/Other/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'MagentoFrameworkCssTest_Other', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/_files/code/Magento/Third/registration.php b/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/_files/code/Magento/Third/registration.php index dfc0010056f6c..add6e676f220c 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/_files/code/Magento/Third/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/_files/code/Magento/Third/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'MagentoFrameworkCssTest_Third', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/_files/design/frontend/Test/default/registration.php b/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/_files/design/frontend/Test/default/registration.php index 1c605694456d2..2fc5a738b3c66 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/_files/design/frontend/Test/default/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/_files/design/frontend/Test/default/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/FrameworkCssTest/default', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/_files/design/frontend/Test/parent/registration.php b/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/_files/design/frontend/Test/parent/registration.php index e8b4db3543611..d856d3cd7be29 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/_files/design/frontend/Test/parent/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/_files/design/frontend/Test/parent/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/FrameworkCssTest/parent', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/_files/Fixture_Module/registration.php b/dev/tests/integration/testsuite/Magento/Framework/View/_files/Fixture_Module/registration.php index da748f3b3299b..7e073d8f7cf50 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/View/_files/Fixture_Module/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/View/_files/Fixture_Module/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Fixture_Module', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/_files/UiComponent/theme/registration.php b/dev/tests/integration/testsuite/Magento/Framework/View/_files/UiComponent/theme/registration.php index cbba56dcaafa2..886dad410ba72 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/View/_files/UiComponent/theme/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/View/_files/UiComponent/theme/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'adminhtml/FrameworkViewUiComponent/default', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/app/code/ViewTest_Module/registration.php b/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/app/code/ViewTest_Module/registration.php index 7b1644fc8f40a..eafa89e3abf29 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/app/code/ViewTest_Module/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/app/code/ViewTest_Module/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'ViewTest_Module', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/design/frontend/Vendor/custom_theme/registration.php b/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/design/frontend/Vendor/custom_theme/registration.php index 6150fcb34dc85..219ec82584f50 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/design/frontend/Vendor/custom_theme/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/design/frontend/Vendor/custom_theme/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Vendor_ViewTest/custom_theme', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/design/frontend/Vendor/custom_theme2/registration.php b/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/design/frontend/Vendor/custom_theme2/registration.php index a1d5f994fb75d..938ab2a46e5c0 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/design/frontend/Vendor/custom_theme2/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/design/frontend/Vendor/custom_theme2/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Vendor_ViewTest/custom_theme2', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/design/frontend/Vendor/default/registration.php b/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/design/frontend/Vendor/default/registration.php index 8302085feb23f..36caee1923ac3 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/design/frontend/Vendor/default/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/design/frontend/Vendor/default/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Vendor_ViewTest/default', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/design/frontend/Vendor/standalone_theme/registration.php b/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/design/frontend/Vendor/standalone_theme/registration.php index ad8402df470e1..5b9e91753c424 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/design/frontend/Vendor/standalone_theme/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/design/frontend/Vendor/standalone_theme/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Vendor_ViewTest/standalone_theme', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/_files/static/theme/registration.php b/dev/tests/integration/testsuite/Magento/Framework/View/_files/static/theme/registration.php index c2e0ac8d8c34e..d51fc082d90cc 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/View/_files/static/theme/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/View/_files/static/theme/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/FrameworkViewMinifier/default', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code/Magento/A/registration.php b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code/Magento/A/registration.php index f4f907d8814f0..990c43e2ae22b 100644 --- a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code/Magento/A/registration.php +++ b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code/Magento/A/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_A', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code/Magento/B/registration.php b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code/Magento/B/registration.php index e5746b1350c08..8a615308ffafd 100644 --- a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code/Magento/B/registration.php +++ b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code/Magento/B/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_B', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code/Magento/C/registration.php b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code/Magento/C/registration.php index 6e987dcef353e..34a4e9f6be45b 100644 --- a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code/Magento/C/registration.php +++ b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code/Magento/C/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_C', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code/Magento/D/registration.php b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code/Magento/D/registration.php index f243f094d7a10..34b6e22067d67 100644 --- a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code/Magento/D/registration.php +++ b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code/Magento/D/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_D', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/adminhtml/Vendor/test/registration.php b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/adminhtml/Vendor/test/registration.php index e1e5021b46204..f2dad036d5265 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/adminhtml/Vendor/test/registration.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/adminhtml/Vendor/test/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'adminhtml/FrameworkThemeTest/test', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/area_two/Vendor/theme_one/registration.php b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/area_two/Vendor/theme_one/registration.php index 3499cf9743a4b..32f7321714c4d 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/area_two/Vendor/theme_one/registration.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/area_two/Vendor/theme_one/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'area_two/FrameworkThemeTest/theme_one', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/design_area/Vendor/theme_one/registration.php b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/design_area/Vendor/theme_one/registration.php index 29e5fa798ca7d..4c1c9297b7ccc 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/design_area/Vendor/theme_one/registration.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/design_area/Vendor/theme_one/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'design_area/FrameworkThemeTest/theme_one', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Magento/default/registration.php b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Magento/default/registration.php index f9c18ad1a2ca5..cc40b0c221176 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Magento/default/registration.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Magento/default/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Magento_FrameworkThemeTest/default', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Magento/default_iphone/registration.php b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Magento/default_iphone/registration.php index 30cc438826189..713abc2dd5245 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Magento/default_iphone/registration.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Magento/default_iphone/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Magento_FrameworkThemeTest/default_iphone', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/cache_test_theme/registration.php b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/cache_test_theme/registration.php index 40aba67cf4bda..db6a478fc65a4 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/cache_test_theme/registration.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/cache_test_theme/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Test_FrameworkThemeTest/cache_test_theme', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/default/registration.php b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/default/registration.php index 3e6938955b6d7..3cfea7d3edf06 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/default/registration.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/default/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Test_FrameworkThemeTest/default', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/publication/registration.php b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/publication/registration.php index f3668dd5ec603..f59384e42f41b 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/publication/registration.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/publication/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Test_FrameworkThemeTest/publication', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/test_theme/registration.php b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/test_theme/registration.php index adcbacd78594c..0a1c9e5ef8e79 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/test_theme/registration.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/test_theme/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Test_FrameworkThemeTest/test_theme', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Vendor/custom_theme/registration.php b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Vendor/custom_theme/registration.php index e1ce31a7c8d0b..b0e80d1106d22 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Vendor/custom_theme/registration.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Vendor/custom_theme/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Vendor_FrameworkThemeTest/custom_theme', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Vendor/default/registration.php b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Vendor/default/registration.php index f2e0918421ba0..1c2d96475f9fc 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Vendor/default/registration.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Vendor/default/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Vendor_FrameworkThemeTest/default', __DIR__); diff --git a/lib/internal/Magento/Framework/Amqp/registration.php b/lib/internal/Magento/Framework/Amqp/registration.php index ab14d5aab8e94..0e97ffb62a8b8 100644 --- a/lib/internal/Magento/Framework/Amqp/registration.php +++ b/lib/internal/Magento/Framework/Amqp/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::LIBRARY, 'magento/framework-amqp', __DIR__); diff --git a/lib/internal/Magento/Framework/Bulk/registration.php b/lib/internal/Magento/Framework/Bulk/registration.php index f9f5606b76841..00c35b91e4a24 100644 --- a/lib/internal/Magento/Framework/Bulk/registration.php +++ b/lib/internal/Magento/Framework/Bulk/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::LIBRARY, 'magento/framework-bulk', __DIR__); diff --git a/lib/internal/Magento/Framework/MessageQueue/registration.php b/lib/internal/Magento/Framework/MessageQueue/registration.php index aafb0fcffa7c5..d6b908671f9b7 100644 --- a/lib/internal/Magento/Framework/MessageQueue/registration.php +++ b/lib/internal/Magento/Framework/MessageQueue/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::LIBRARY, 'magento/framework-message-queue', __DIR__); diff --git a/lib/internal/Magento/Framework/registration.php b/lib/internal/Magento/Framework/registration.php index 19012a264346c..69ba0ac6273e6 100644 --- a/lib/internal/Magento/Framework/registration.php +++ b/lib/internal/Magento/Framework/registration.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::LIBRARY, 'magento/framework', __DIR__); diff --git a/setup/src/Magento/Setup/registration.php b/setup/src/Magento/Setup/registration.php index e78c32a7f193b..bff16d976bb24 100644 --- a/setup/src/Magento/Setup/registration.php +++ b/setup/src/Magento/Setup/registration.php @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ -use \Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::SETUP, 'magento/setup', __DIR__); From 927e0636e2d2f108787d40be1def2a00f1d6eaad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 19 Dec 2019 05:11:01 +0100 Subject: [PATCH 0510/1143] Reduce sleep time for Unit Test of Consumer to 0 seconds --- .../Test/Unit/Model/ConsumerRunnerTest.php | 53 +++++++++++-------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/app/code/Magento/MessageQueue/Test/Unit/Model/ConsumerRunnerTest.php b/app/code/Magento/MessageQueue/Test/Unit/Model/ConsumerRunnerTest.php index 46a142bf488be..5f4bd9178a890 100644 --- a/app/code/Magento/MessageQueue/Test/Unit/Model/ConsumerRunnerTest.php +++ b/app/code/Magento/MessageQueue/Test/Unit/Model/ConsumerRunnerTest.php @@ -3,20 +3,27 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\MessageQueue\Test\Unit\Model; -use Magento\Framework\MessageQueue\ConsumerInterface; -use Magento\MessageQueue\Model\ConsumerRunner; +use Magento\Framework\App\MaintenanceMode; use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\MessageQueue\ConsumerFactory; +use Magento\Framework\MessageQueue\ConsumerInterface; use Magento\Framework\Phrase; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\MessageQueue\Model\ConsumerRunner; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; -/** - * Unit tests for consumer runner - */ -class ConsumerRunnerTest extends \PHPUnit\Framework\TestCase +class ConsumerRunnerTest extends TestCase { - /** @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager */ + const STUB_SLEEP_INTERVAL = 0; + + /** + * @var ObjectManager + */ private $objectManager; /** @@ -25,12 +32,12 @@ class ConsumerRunnerTest extends \PHPUnit\Framework\TestCase private $consumerRunner; /** - * @var \Magento\Framework\MessageQueue\ConsumerFactory|\PHPUnit_Framework_MockObject_MockObject + * @var ConsumerFactory|MockObject */ private $consumerFactoryMock; /** - * @var \Magento\Framework\App\MaintenanceMode|\PHPUnit_Framework_MockObject_MockObject + * @var MaintenanceMode|MockObject */ private $maintenanceModeMock; @@ -39,21 +46,23 @@ class ConsumerRunnerTest extends \PHPUnit\Framework\TestCase */ protected function setUp() { - $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $this->consumerFactoryMock = $this->getMockBuilder(\Magento\Framework\MessageQueue\ConsumerFactory::class) + $this->objectManager = new ObjectManager($this); + + $this->consumerFactoryMock = $this->getMockBuilder(ConsumerFactory::class) ->disableOriginalConstructor() ->getMock(); - $this->maintenanceModeMock = $this->getMockBuilder(\Magento\Framework\App\MaintenanceMode::class) + $this->maintenanceModeMock = $this->getMockBuilder(MaintenanceMode::class) ->disableOriginalConstructor() ->getMock(); + $this->consumerRunner = $this->objectManager->getObject( - \Magento\MessageQueue\Model\ConsumerRunner::class, + ConsumerRunner::class, [ 'consumerFactory' => $this->consumerFactoryMock, - 'maintenanceMode' => $this->maintenanceModeMock + 'maintenanceMode' => $this->maintenanceModeMock, + 'maintenanceSleepInterval' => self::STUB_SLEEP_INTERVAL ] ); - parent::setUp(); } /** @@ -64,8 +73,8 @@ protected function setUp() public function testMagicMethod() { $isMaintenanceModeOn = false; - /** @var ConsumerInterface|\PHPUnit_Framework_MockObject_MockObject $consumerMock */ - $consumerMock = $this->getMockBuilder(\Magento\Framework\MessageQueue\ConsumerInterface::class)->getMock(); + /** @var ConsumerInterface|MockObject $consumerMock */ + $consumerMock = $this->getMockBuilder(ConsumerInterface::class)->getMock(); $consumerMock->expects($this->once())->method('process'); $consumerName = 'someConsumerName'; $this->consumerFactoryMock @@ -81,12 +90,13 @@ public function testMagicMethod() /** * Ensure that exception will be thrown if requested magic method does not correspond to any declared consumer. * - * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage "nonDeclaredConsumer" callback method specified in crontab.xml must * @return void */ public function testMagicMethodNoRelatedConsumer() { + $this->expectException(LocalizedException::class); + $this->expectExceptionMessage('"nonDeclaredConsumer" callback method specified in crontab.xml must'); + $consumerName = 'nonDeclaredConsumer'; $this->consumerFactoryMock ->expects($this->once()) @@ -105,8 +115,9 @@ public function testMagicMethodNoRelatedConsumer() public function testMagicMethodMaintenanceModeIsOn() { $isMaintenanceModeOn = true; - /** @var ConsumerInterface|\PHPUnit_Framework_MockObject_MockObject $consumerMock */ - $consumerMock = $this->getMockBuilder(\Magento\Framework\MessageQueue\ConsumerInterface::class)->getMock(); + + /** @var ConsumerInterface|MockObject $consumerMock */ + $consumerMock = $this->getMockBuilder(ConsumerInterface::class)->getMock(); $consumerMock->expects($this->never())->method('process'); $consumerName = 'someConsumerName'; $this->consumerFactoryMock From 2e1ef16d755bbc6b0f675d8624b47b8f6cf35fa8 Mon Sep 17 00:00:00 2001 From: Roman Hanin <rganin@adobe.com> Date: Thu, 19 Dec 2019 00:09:15 -0600 Subject: [PATCH 0511/1143] B2B-272: Remove Ship To column, fix pagination selector --- app/code/Magento/Sales/Block/Order/History.php | 10 ++++++++++ .../Sales/view/frontend/templates/order/history.phtml | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Block/Order/History.php b/app/code/Magento/Sales/Block/Order/History.php index c06a5d8b24c1e..09300424212fe 100644 --- a/app/code/Magento/Sales/Block/Order/History.php +++ b/app/code/Magento/Sales/Block/Order/History.php @@ -188,4 +188,14 @@ public function getBackUrl() { return $this->getUrl('customer/account/'); } + + /** + * Get message for no orders. + * + * @return \Magento\Framework\Phrase + */ + public function getEmptyOrdersMessage() + { + return __('You have placed no orders.'); + } } diff --git a/app/code/Magento/Sales/view/frontend/templates/order/history.phtml b/app/code/Magento/Sales/view/frontend/templates/order/history.phtml index a785ca93511ad..bc1887c7669ca 100644 --- a/app/code/Magento/Sales/view/frontend/templates/order/history.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/order/history.phtml @@ -59,5 +59,5 @@ <div class="order-products-toolbar toolbar bottom"><?= $block->getPagerHtml() ?></div> <?php endif ?> <?php else : ?> - <div class="message info empty"><span><?= $block->escapeHtml(__('You have placed no orders.')) ?></span></div> + <div class="message info empty"><span><?= $block->escapeHtml($block->getEmptyOrdersMessage()) ?></span></div> <?php endif ?> From c4a3c0084eeb076f3620f98b716cd04e8113b004 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Thu, 19 Dec 2019 11:01:17 +0200 Subject: [PATCH 0512/1143] Cover changes with unit test --- .../Model/Config/Source/AllmethodsTest.php | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 app/code/Magento/Shipping/Test/Unit/Model/Config/Source/AllmethodsTest.php diff --git a/app/code/Magento/Shipping/Test/Unit/Model/Config/Source/AllmethodsTest.php b/app/code/Magento/Shipping/Test/Unit/Model/Config/Source/AllmethodsTest.php new file mode 100644 index 0000000000000..b3810b6042eee --- /dev/null +++ b/app/code/Magento/Shipping/Test/Unit/Model/Config/Source/AllmethodsTest.php @@ -0,0 +1,106 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Shipping\Test\Unit\Model; + +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Shipping\Model\Carrier\AbstractCarrierInterface; +use Magento\Shipping\Model\Config; +use Magento\Shipping\Model\Config\Source\Allmethods; +use PHPUnit\Framework\MockObject\MockObject; + +/** + * Tests for Allmethods Class + */ +class InfoTest extends \PHPUnit\Framework\TestCase +{ + /** + * @var ScopeConfigInterface|MockObject $scopeConfig + */ + private $scopeConfig; + + /** + * @var Config|MockObject $shippingConfig + */ + private $shippingConfig; + + /** + * @var Allmethods $allmethods + */ + private $allmethods; + + /** + * @var MockObject + */ + private $carriersMock; + + /** + * @inheritdoc + */ + protected function setUp() + { + $this->scopeConfig = $this->createMock(ScopeConfigInterface::class); + $this->shippingConfig = $this->createMock(Config::class); + $this->carriersMock = $this->getMockBuilder(AbstractCarrierInterface::class) + ->setMethods( + [ + 'isActive', + 'getAllowedMethods' + ] + )->getMockForAbstractClass(); + + $this->allmethods = new Allmethods( + $this->scopeConfig, + $this->shippingConfig + ); + } + + /** + * Ensure that options converted correctly + * + * @dataProvider getCarriersMethodsProvider + * @param array $expectedArray + * @return void + */ + public function testToOptionArray(array $expectedArray): void + { + $expectedArray['getAllCarriers'] = [$this->carriersMock]; + + $this->shippingConfig->expects($this->once()) + ->method('getAllCarriers') + ->willReturn($expectedArray['getAllCarriers']); + $this->carriersMock->expects($this->once()) + ->method('isActive') + ->willReturn(true); + $this->carriersMock->expects($this->once()) + ->method('getAllowedMethods') + ->willReturn($expectedArray['allowedMethods']); + $this->assertEquals([$expectedArray['expected_result']], $this->allmethods->toOptionArray()); + } + + /** + * Returns providers data for test + * + * @return array + */ + public function getCarriersMethodsProvider(): array + { + return [ + [ + [ + 'allowedMethods' => [null => 'method_title'], + 'expected_result' => [ 'value' => [], 'label' => null], + 'getAllCarriers' => [] + ], + [ + 'allowedMethods' => ['method_code' => 'method_title'], + 'expected_result' => [ 'value' => [], 'label' => 'method_code'], + 'getAllCarriers' => [] + ] + + ] + ]; + } +} From fd7633b28417b6e621808ae9c10cbb707f1b7821 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Thu, 19 Dec 2019 11:29:05 +0200 Subject: [PATCH 0513/1143] fix static test --- .../Magento/Shipping/Model/Config/Source/Allmethods.php | 6 +++++- .../Test/Unit/Model/Config/Source/AllmethodsTest.php | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Shipping/Model/Config/Source/Allmethods.php b/app/code/Magento/Shipping/Model/Config/Source/Allmethods.php index bafb9ed49cf30..f64c24856eba5 100644 --- a/app/code/Magento/Shipping/Model/Config/Source/Allmethods.php +++ b/app/code/Magento/Shipping/Model/Config/Source/Allmethods.php @@ -5,6 +5,9 @@ */ namespace Magento\Shipping\Model\Config\Source; +/** + * @inheritdoc + */ class Allmethods implements \Magento\Framework\Option\ArrayInterface { /** @@ -33,6 +36,7 @@ public function __construct( /** * Return array of carriers. + * * If $isActiveOnlyFlag is set to true, will return only active carriers * * @param bool $isActiveOnlyFlag @@ -59,7 +63,7 @@ public function toOptionArray($isActiveOnlyFlag = false) /** Check it $carrierMethods array was well formed */ if (!$methodCode) { - continue; + continue; } $methods[$carrierCode]['value'][] = [ 'value' => $carrierCode . '_' . $methodCode, diff --git a/app/code/Magento/Shipping/Test/Unit/Model/Config/Source/AllmethodsTest.php b/app/code/Magento/Shipping/Test/Unit/Model/Config/Source/AllmethodsTest.php index b3810b6042eee..985cc0e53bad5 100644 --- a/app/code/Magento/Shipping/Test/Unit/Model/Config/Source/AllmethodsTest.php +++ b/app/code/Magento/Shipping/Test/Unit/Model/Config/Source/AllmethodsTest.php @@ -3,7 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Shipping\Test\Unit\Model; +namespace Magento\Shipping\Test\Unit\Model\Config\Source; use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Shipping\Model\Carrier\AbstractCarrierInterface; @@ -14,7 +14,7 @@ /** * Tests for Allmethods Class */ -class InfoTest extends \PHPUnit\Framework\TestCase +class AllmethodsTest extends \PHPUnit\Framework\TestCase { /** * @var ScopeConfigInterface|MockObject $scopeConfig From cc1c96bd3ce491adc41fabda12b81d0e265b5431 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 19 Dec 2019 11:06:16 +0100 Subject: [PATCH 0514/1143] Replace literal with reference to class --- .../Magento/Version/Test/Unit/Controller/Index/IndexTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Version/Test/Unit/Controller/Index/IndexTest.php b/app/code/Magento/Version/Test/Unit/Controller/Index/IndexTest.php index 9a42fd81cd882..3fc2cecabe990 100644 --- a/app/code/Magento/Version/Test/Unit/Controller/Index/IndexTest.php +++ b/app/code/Magento/Version/Test/Unit/Controller/Index/IndexTest.php @@ -62,7 +62,7 @@ protected function setUp() $objectManager = new ObjectManager($this); $this->model = $objectManager->getObject( - 'Magento\Version\Controller\Index\Index', + VersionIndex::class, [ 'context' => $this->contextMock, 'productMetadata' => $this->productMetadataMock From 1fa6f0895f127f85635912fc5973669d84c3b08d Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Thu, 19 Dec 2019 13:03:09 +0200 Subject: [PATCH 0515/1143] Revert, igone changed_files file --- .../Controller/Adminhtml/Indexer/MassInvalidate.php | 5 +++++ .../testsuite/Magento/Test/Legacy/_files/words_ce.xml | 8 -------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassInvalidate.php b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassInvalidate.php index 5551d8fda5178..0cc203a547b3a 100644 --- a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassInvalidate.php +++ b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassInvalidate.php @@ -14,6 +14,11 @@ */ class MassInvalidate extends \Magento\Indexer\Controller\Adminhtml\Indexer implements HttpPostActionInterface { + /** + * @var IndexerRegistry $indexerRegistry + */ + private $indexerRegistry; + /** * @param Context $context * @param IndexerRegistry $indexerRegistry diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/words_ce.xml b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/words_ce.xml index 06b46c8bf744e..92e7b15efed29 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/words_ce.xml +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/words_ce.xml @@ -32,14 +32,6 @@ <item> <path>CHANGELOG.md</path> </item> - <item> - <path>app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassChangelog.php</path> - <word>massChangelog</word> - </item> - <item> - <path>app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassChangelog.php</path> - <word>massChangelog</word> - </item> <item> <path>composer.lock</path> </item> From 63bf4fef932e72952ee318817bead66be7f6963a Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Thu, 19 Dec 2019 14:16:15 +0200 Subject: [PATCH 0516/1143] MC-25109: B2B changing company admin carries over the addresses --- .../Sales/Test/Mftf/Test/StorefrontOrderPagerDisplayedTest.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/Sales/Test/Mftf/Test/StorefrontOrderPagerDisplayedTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/StorefrontOrderPagerDisplayedTest.xml index 0e58bb84988a2..aef3e884c4712 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/StorefrontOrderPagerDisplayedTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/StorefrontOrderPagerDisplayedTest.xml @@ -89,6 +89,9 @@ <!-- Customer is created --> <createData entity="Simple_US_Customer" stepKey="createCustomer"/> + <!-- Reindex and flush the cache to display products on the category page --> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> </before> <after> <!-- Delete category and products --> From 629c51649b4683ed0680af621f3d3fe4685924b4 Mon Sep 17 00:00:00 2001 From: Sathish <srsathish92@gmail.com> Date: Thu, 19 Dec 2019 19:06:43 +0530 Subject: [PATCH 0517/1143] Code refactor, updated Unit Test with JsonHexTag Serializer --- .../Magento/Checkout/Block/Cart/Shipping.php | 51 +++-- .../Test/Unit/Block/Cart/ShippingTest.php | 200 +++++++++++++----- 2 files changed, 181 insertions(+), 70 deletions(-) diff --git a/app/code/Magento/Checkout/Block/Cart/Shipping.php b/app/code/Magento/Checkout/Block/Cart/Shipping.php index c52b7fe18814f..f8347fadeb947 100644 --- a/app/code/Magento/Checkout/Block/Cart/Shipping.php +++ b/app/code/Magento/Checkout/Block/Cart/Shipping.php @@ -3,8 +3,18 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Checkout\Block\Cart; +use Magento\Checkout\Model\CompositeConfigProvider; +use Magento\Checkout\Block\Checkout\LayoutProcessorInterface; +use Magento\Framework\Serialize\Serializer\Json; +use Magento\Framework\Serialize\Serializer\JsonHexTag; +use Magento\Framework\View\Element\Template\Context; +use Magento\Customer\Model\Session as customerSession; +use Magento\Checkout\Model\Session as checkoutSession; +use Magento\Framework\App\ObjectManager; + /** * @api * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -12,45 +22,52 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart { /** - * @var \Magento\Checkout\Model\CompositeConfigProvider + * @var CompositeConfigProvider */ protected $configProvider; /** - * @var array|\Magento\Checkout\Block\Checkout\LayoutProcessorInterface[] + * @var array|LayoutProcessorInterface[] */ protected $layoutProcessors; /** - * @var \Magento\Framework\Serialize\Serializer\Json + * @var Json */ private $serializer; /** - * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Customer\Model\Session $customerSession - * @param \Magento\Checkout\Model\Session $checkoutSession - * @param \Magento\Checkout\Model\CompositeConfigProvider $configProvider + * @var JsonHexTag + */ + private $jsonHexTagSerializer; + + /** + * @param Context $context + * @param customerSession $customerSession + * @param checkoutSession $checkoutSession + * @param CompositeConfigProvider $configProvider * @param array $layoutProcessors * @param array $data - * @param \Magento\Framework\Serialize\Serializer\Json|null $serializer + * @param Json|null $serializer + * @param JsonHexTag|null $jsonHexTagSerializer * @throws \RuntimeException */ public function __construct( - \Magento\Framework\View\Element\Template\Context $context, - \Magento\Customer\Model\Session $customerSession, - \Magento\Checkout\Model\Session $checkoutSession, - \Magento\Checkout\Model\CompositeConfigProvider $configProvider, + Context $context, + customerSession $customerSession, + checkoutSession $checkoutSession, + CompositeConfigProvider $configProvider, array $layoutProcessors = [], array $data = [], - \Magento\Framework\Serialize\Serializer\Json $serializer = null + Json $serializer = null, + JsonHexTag $jsonHexTagSerializer = null ) { $this->configProvider = $configProvider; $this->layoutProcessors = $layoutProcessors; parent::__construct($context, $customerSession, $checkoutSession, $data); $this->_isScopePrivate = true; - $this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance() - ->get(\Magento\Framework\Serialize\Serializer\Json::class); + $this->serializer = $serializer ?: ObjectManager::getInstance()->get(Json::class); + $this->jsonHexTagSerializer = $jsonHexTagSerializer ?: ObjectManager::getInstance()->get(JsonHexTag::class); } /** @@ -75,7 +92,7 @@ public function getJsLayout() $this->jsLayout = $processor->process($this->jsLayout); } - return json_encode($this->jsLayout, JSON_HEX_TAG); + return $this->jsonHexTagSerializer->serialize($this->jsLayout); } /** @@ -95,6 +112,6 @@ public function getBaseUrl() */ public function getSerializedCheckoutConfig() { - return json_encode($this->getCheckoutConfig(), JSON_HEX_TAG); + return $this->jsonHexTagSerializer->serialize($this->getCheckoutConfig()); } } diff --git a/app/code/Magento/Checkout/Test/Unit/Block/Cart/ShippingTest.php b/app/code/Magento/Checkout/Test/Unit/Block/Cart/ShippingTest.php index 302188224b97a..e5f33cf0d408f 100644 --- a/app/code/Magento/Checkout/Test/Unit/Block/Cart/ShippingTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Block/Cart/ShippingTest.php @@ -3,44 +3,61 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + +declare(strict_types=1); + namespace Magento\Checkout\Test\Unit\Block\Cart; +use Magento\Checkout\Block\Cart\Shipping; +use Magento\Checkout\Model\CompositeConfigProvider; +use Magento\Checkout\Block\Checkout\LayoutProcessorInterface; +use Magento\Framework\Serialize\Serializer\Json; +use Magento\Framework\Serialize\Serializer\JsonHexTag; +use Magento\Framework\View\Element\Template\Context; +use Magento\Customer\Model\Session as customerSession; +use Magento\Checkout\Model\Session as checkoutSession; +use Magento\Store\Model\StoreManagerInterface; +use PHPUnit\Framework\MockObject\MockObject; + +/** + * Unit Test for Magento\Checkout\Block\Cart\Shipping + */ class ShippingTest extends \PHPUnit\Framework\TestCase { /** - * @var \Magento\Checkout\Block\Cart\Shipping + * @var Shipping */ - protected $model; + protected $block; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var Context|MockObject */ - protected $context; + protected $contextMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var customerSession|MockObject */ - protected $customerSession; + protected $customerSessionMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var checkoutSession|MockObject */ - protected $checkoutSession; + protected $checkoutSessionMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var CompositeConfigProvider|MockObject */ - protected $configProvider; + protected $configProviderMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var LayoutProcessorInterface|MockObject */ - protected $layoutProcessor; + protected $layoutProcessorMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var StoreManagerInterface|MockObject */ - protected $storeManager; + protected $storeManagerMock; /** * @var array @@ -48,17 +65,28 @@ class ShippingTest extends \PHPUnit\Framework\TestCase protected $layout; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var Json|MockObject */ - private $serializer; + private $serializerMock; - protected function setUp() + /** + * @var JsonHexTag|MockObject + */ + private $jsonHexTagSerializerMock; + + /** + * @inheritDoc + */ + protected function setUp(): void { - $this->context = $this->createMock(\Magento\Framework\View\Element\Template\Context::class); - $this->customerSession = $this->createMock(\Magento\Customer\Model\Session::class); - $this->checkoutSession = $this->createMock(\Magento\Checkout\Model\Session::class); - $this->configProvider = $this->createMock(\Magento\Checkout\Model\CompositeConfigProvider::class); - $this->layoutProcessor = $this->createMock(\Magento\Checkout\Block\Checkout\LayoutProcessorInterface::class); + $this->contextMock = $this->createMock(Context::class); + $this->customerSessionMock = $this->createMock(customerSession::class); + $this->checkoutSessionMock = $this->createMock(checkoutSession::class); + $this->configProviderMock = $this->createMock(CompositeConfigProvider::class); + $this->layoutProcessorMock = $this->createMock(LayoutProcessorInterface::class); + $this->serializerMock = $this->createMock(JsonHexTag::class); + $this->jsonHexTagSerializerMock = $this->createMock(JsonHexTag::class); + $this->storeManagerMock = $this->createMock(StoreManagerInterface::class); $this->layout = [ 'components' => [ 'firstComponent' => ['param' => 'value'], @@ -66,59 +94,125 @@ protected function setUp() ] ]; - $this->storeManager = $this->createMock(\Magento\Store\Model\StoreManagerInterface::class); - $this->context->expects($this->once())->method('getStoreManager')->willReturn($this->storeManager); - $this->serializer = $this->createMock(\Magento\Framework\Serialize\Serializer\Json::class); + $this->contextMock->expects($this->once()) + ->method('getStoreManager') + ->willReturn($this->storeManagerMock); - $this->model = new \Magento\Checkout\Block\Cart\Shipping( - $this->context, - $this->customerSession, - $this->checkoutSession, - $this->configProvider, - [$this->layoutProcessor], + $this->block = new Shipping( + $this->contextMock, + $this->customerSessionMock, + $this->checkoutSessionMock, + $this->configProviderMock, + [$this->layoutProcessorMock], ['jsLayout' => $this->layout], - $this->serializer + $this->serializerMock, + $this->jsonHexTagSerializerMock ); } - public function testGetCheckoutConfig() + /** + * Test for getCheckoutConfig + * + * @return void + */ + public function testGetCheckoutConfig(): void { $config = ['param' => 'value']; - $this->configProvider->expects($this->once())->method('getConfig')->willReturn($config); - $this->assertEquals($config, $this->model->getCheckoutConfig()); + $this->configProviderMock->expects($this->once()) + ->method('getConfig') + ->willReturn($config); + + $this->assertEquals($config, $this->block->getCheckoutConfig()); } - public function testGetJsLayout() + /** + * Test for getJsLayout() + * + * @return void + * @dataProvider getJsLayoutDataProvider + */ + public function testGetJsLayout(array $layoutProcessed, string $jsonLayoutProcessed): void { - $layoutProcessed = $this->layout; - $layoutProcessed['components']['thirdComponent'] = ['param' => 'value']; - $jsonLayoutProcessed = json_encode($layoutProcessed); - - $this->layoutProcessor->expects($this->once()) + $this->layoutProcessorMock->expects($this->once()) ->method('process') ->with($this->layout) ->willReturn($layoutProcessed); - $this->assertEquals( - $jsonLayoutProcessed, - $this->model->getJsLayout() - ); + $this->jsonHexTagSerializerMock->expects($this->once()) + ->method('serialize') + ->willReturn($jsonLayoutProcessed); + + $this->assertEquals($jsonLayoutProcessed, $this->block->getJsLayout()); } - public function testGetBaseUrl() + /** + * Data for getJsLayout() + * + * @return array + */ + public function getJsLayoutDataProvider(): array + { + $layoutProcessed = $this->layout; + $layoutProcessed['components']['thirdComponent'] = ['param' => 'value']; + return [ + [ + $layoutProcessed, + '{"components":{"firstComponent":{"param":"value"},"secondComponent":{"param":"value"},"thirdComponent":{"param":"value"}}}' + ] + ]; + } + + /** + * Test for getBaseUrl() + * + * @return void + */ + public function testGetBaseUrl(): void { $baseUrl = 'baseUrl'; $storeMock = $this->createPartialMock(\Magento\Store\Model\Store::class, ['getBaseUrl']); - $storeMock->expects($this->once())->method('getBaseUrl')->willReturn($baseUrl); - $this->storeManager->expects($this->once())->method('getStore')->willReturn($storeMock); - $this->assertEquals($baseUrl, $this->model->getBaseUrl()); + $storeMock->expects($this->once()) + ->method('getBaseUrl') + ->willReturn($baseUrl); + + $this->storeManagerMock->expects($this->once()) + ->method('getStore') + ->willReturn($storeMock); + + $this->assertEquals($baseUrl, $this->block->getBaseUrl()); } - public function testGetSerializedCheckoutConfig() + /** + * Test for getSerializedCheckoutConfig() + * + * @return void + * @dataProvider jsonEncodeDataProvider + */ + public function testGetSerializedCheckoutConfig(array $checkoutConfig, string $expectedJson): void { - $checkoutConfig = ['checkout', 'config']; - $this->configProvider->expects($this->once())->method('getConfig')->willReturn($checkoutConfig); + $this->configProviderMock->expects($this->once()) + ->method('getConfig') + ->willReturn($checkoutConfig); + + $this->jsonHexTagSerializerMock->expects($this->once()) + ->method('serialize') + ->willReturn($expectedJson); + + $this->assertEquals($expectedJson, $this->block->getSerializedCheckoutConfig()); + } - $this->assertEquals(json_encode($checkoutConfig), $this->model->getSerializedCheckoutConfig()); + /** + * Data for getSerializedCheckoutConfig() + * + * @return array + */ + public function jsonEncodeDataProvider(): array + { + return [ + [ + ['checkout', 'config'], + '["checkout","config"]' + ] + ]; } } From 9b84a0438a8228e1fbeac2f6fde67e7dbc6440f6 Mon Sep 17 00:00:00 2001 From: "rostyslav.hymon" <rostyslav.hymon@transoftgroup.com> Date: Thu, 19 Dec 2019 15:39:20 +0200 Subject: [PATCH 0518/1143] MC-29677: Customizable Options are not imported when row_id is not equal to entity_id for products --- .../ProductCustomOptionsDataProviderTest.php | 37 ++++++++++++++++++- .../ProductCustomOptionsDataProvider.php | 30 +++++++++++++-- 2 files changed, 62 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/ProductCustomOptionsDataProviderTest.php b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/ProductCustomOptionsDataProviderTest.php index 0e0cb676cdf3e..143ef4461173a 100644 --- a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/ProductCustomOptionsDataProviderTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/ProductCustomOptionsDataProviderTest.php @@ -11,6 +11,9 @@ use Magento\Framework\App\RequestInterface; use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection; use Magento\Framework\DB\Select as DbSelect; +use Magento\Framework\EntityManager\MetadataPool; +use Magento\Framework\EntityManager\EntityMetadataInterface; +use Magento\Ui\DataProvider\Modifier\PoolInterface; class ProductCustomOptionsDataProviderTest extends \PHPUnit\Framework\TestCase { @@ -44,6 +47,21 @@ class ProductCustomOptionsDataProviderTest extends \PHPUnit\Framework\TestCase */ protected $dbSelectMock; + /** + * @var MetadataPool|\PHPUnit_Framework_MockObject_MockObject + */ + private $metadataPool; + + /** + * @var EntityMetadataInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $entityMetadata; + + /** + * @var PoolInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $modifiersPool; + protected function setUp() { $this->collectionFactoryMock = $this->getMockBuilder(CollectionFactory::class) @@ -73,12 +91,29 @@ protected function setUp() ->method('create') ->willReturn($this->collectionMock); + $this->modifiersPool = $this->getMockBuilder(PoolInterface::class) + ->getMockForAbstractClass(); + $this->entityMetadata = $this->getMockBuilder(EntityMetadataInterface::class) + ->getMockForAbstractClass(); + $this->entityMetadata->expects($this->any()) + ->method('getLinkField') + ->willReturn('entity_id'); + $this->metadataPool = $this->getMockBuilder(MetadataPool::class) + ->disableOriginalConstructor() + ->setMethods(['getMetadata']) + ->getMock(); + $this->metadataPool->expects($this->any()) + ->method('getMetadata') + ->willReturn($this->entityMetadata); + $this->objectManagerHelper = new ObjectManagerHelper($this); $this->dataProvider = $this->objectManagerHelper->getObject( ProductCustomOptionsDataProvider::class, [ 'collectionFactory' => $this->collectionFactoryMock, - 'request' => $this->requestMock + 'request' => $this->requestMock, + 'modifiersPool' => $this->modifiersPool, + 'metadataPool' => $this->metadataPool ] ); } diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/ProductCustomOptionsDataProvider.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/ProductCustomOptionsDataProvider.php index b8e9155b8eab1..6de75e79b56da 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/ProductCustomOptionsDataProvider.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/ProductCustomOptionsDataProvider.php @@ -12,6 +12,9 @@ use Magento\Catalog\Api\Data\ProductInterface; use Magento\Catalog\Model\Product\Option as ProductOption; use Magento\Framework\DataObject; +use Magento\Framework\EntityManager\MetadataPool; +use Magento\Framework\App\ObjectManager; +use Magento\Ui\DataProvider\Modifier\PoolInterface; /** * DataProvider for grid on Import Custom Options modal panel @@ -39,6 +42,11 @@ class ProductCustomOptionsDataProvider extends ProductDataProvider */ protected $productOptionValueModel; + /** + * @var MetadataPool + */ + private $metadataPool; + /** * @param string $name * @param string $primaryFieldName @@ -51,6 +59,8 @@ class ProductCustomOptionsDataProvider extends ProductDataProvider * @param \Magento\Ui\DataProvider\AddFilterToCollectionInterface[] $addFilterStrategies * @param array $meta * @param array $data + * @param PoolInterface|null $modifiersPool + * @param MetadataPool|null $metadataPool * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -64,7 +74,9 @@ public function __construct( array $addFieldStrategies = [], array $addFilterStrategies = [], array $meta = [], - array $data = [] + array $data = [], + PoolInterface $modifiersPool = null, + MetadataPool $metadataPool = null ) { parent::__construct( $name, @@ -74,16 +86,19 @@ public function __construct( $addFieldStrategies, $addFilterStrategies, $meta, - $data + $data, + $modifiersPool ); $this->request = $request; $this->productOptionRepository = $productOptionRepository; $this->productOptionValueModel = $productOptionValueModel; + $this->metadataPool = $metadataPool ?: ObjectManager::getInstance() + ->get(MetadataPool::class); } /** - * {@inheritdoc} + * @inheritdoc * @since 101.0.0 */ public function getData() @@ -95,9 +110,16 @@ public function getData() $this->getCollection()->getSelect()->where('e.entity_id != ?', $currentProductId); } + try { + $entityMetadata = $this->metadataPool->getMetadata(ProductInterface::class); + $linkField = $entityMetadata->getLinkField(); + } catch (\Exception $e) { + $linkField = 'entity_id'; + } + $this->getCollection()->getSelect()->distinct()->join( ['opt' => $this->getCollection()->getTable('catalog_product_option')], - 'opt.product_id = e.entity_id', + 'opt.product_id = e.' . $linkField, null ); $this->getCollection()->load(); From 6222a6aabf9fa573bf08b452207194c5ac45e378 Mon Sep 17 00:00:00 2001 From: Mastiuhin Olexandr <mastiuhin.olexandr@transoftgroup.com> Date: Thu, 19 Dec 2019 16:23:05 +0200 Subject: [PATCH 0519/1143] MC-29891: rest/async/bulk/V1/orders doesn't work --- app/code/Magento/Sales/etc/webapi.xml | 2 +- app/code/Magento/WebapiAsync/Model/Config.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Sales/etc/webapi.xml b/app/code/Magento/Sales/etc/webapi.xml index 492dff8057039..63d7c24ecd16f 100644 --- a/app/code/Magento/Sales/etc/webapi.xml +++ b/app/code/Magento/Sales/etc/webapi.xml @@ -253,7 +253,7 @@ <resource ref="Magento_Sales::ship" /> </resources> </route> - <route url="/V1/orders/" method="POST"> + <route url="/V1/orders" method="POST"> <service class="Magento\Sales\Api\OrderRepositoryInterface" method="save"/> <resources> <resource ref="Magento_Sales::create" /> diff --git a/app/code/Magento/WebapiAsync/Model/Config.php b/app/code/Magento/WebapiAsync/Model/Config.php index 16c24643ba355..7980be479dfa5 100644 --- a/app/code/Magento/WebapiAsync/Model/Config.php +++ b/app/code/Magento/WebapiAsync/Model/Config.php @@ -179,7 +179,7 @@ private function generateTopicNameFromService($serviceInterface, $serviceMethod, */ private function generateKey($typeName, $methodName, $delimiter = '\\', $lcfirst = true) { - $parts = explode($delimiter, ltrim($typeName, $delimiter)); + $parts = explode($delimiter, trim($typeName, $delimiter)); foreach ($parts as &$part) { $part = ltrim($part, ':'); if ($lcfirst === true) { From fea83cde7acce907bcc6e8f82ab3c1e6c7378975 Mon Sep 17 00:00:00 2001 From: Sathish <srsathish92@gmail.com> Date: Thu, 19 Dec 2019 20:21:05 +0530 Subject: [PATCH 0520/1143] Fixed static test --- app/code/Magento/Checkout/Block/Cart/Shipping.php | 4 ++++ .../Magento/Checkout/Test/Unit/Block/Cart/ShippingTest.php | 7 +++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Checkout/Block/Cart/Shipping.php b/app/code/Magento/Checkout/Block/Cart/Shipping.php index f8347fadeb947..870cc8dace120 100644 --- a/app/code/Magento/Checkout/Block/Cart/Shipping.php +++ b/app/code/Magento/Checkout/Block/Cart/Shipping.php @@ -16,6 +16,8 @@ use Magento\Framework\App\ObjectManager; /** + * Cart Shipping Block + * * @api * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ @@ -107,6 +109,8 @@ public function getBaseUrl() } /** + * Get Serialized Checkout Config + * * @return bool|string * @since 100.2.0 */ diff --git a/app/code/Magento/Checkout/Test/Unit/Block/Cart/ShippingTest.php b/app/code/Magento/Checkout/Test/Unit/Block/Cart/ShippingTest.php index e5f33cf0d408f..1e2dd08cb20ae 100644 --- a/app/code/Magento/Checkout/Test/Unit/Block/Cart/ShippingTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Block/Cart/ShippingTest.php @@ -89,8 +89,7 @@ protected function setUp(): void $this->storeManagerMock = $this->createMock(StoreManagerInterface::class); $this->layout = [ 'components' => [ - 'firstComponent' => ['param' => 'value'], - 'secondComponent' => ['param' => 'value'], + 'firstComponent' => ['param' => 'value'] ] ]; @@ -153,11 +152,11 @@ public function testGetJsLayout(array $layoutProcessed, string $jsonLayoutProces public function getJsLayoutDataProvider(): array { $layoutProcessed = $this->layout; - $layoutProcessed['components']['thirdComponent'] = ['param' => 'value']; + $layoutProcessed['components']['secondComponent'] = ['param' => 'value']; return [ [ $layoutProcessed, - '{"components":{"firstComponent":{"param":"value"},"secondComponent":{"param":"value"},"thirdComponent":{"param":"value"}}}' + '{"components":{"firstComponent":{"param":"value"},"secondComponent":{"param":"value"}}}' ] ]; } From 9f81875441ed608b4b0029ead9576ab9fd64af09 Mon Sep 17 00:00:00 2001 From: Eden <eden@magestore.com> Date: Thu, 19 Dec 2019 22:18:30 +0700 Subject: [PATCH 0521/1143] [ImportExport] Cover Export Source Model by Unit Test --- .../Unit/Model/Source/Export/EntityTest.php | 95 +++++++++++++++++++ .../Unit/Model/Source/Export/FormatTest.php | 86 +++++++++++++++++ 2 files changed, 181 insertions(+) create mode 100644 app/code/Magento/ImportExport/Test/Unit/Model/Source/Export/EntityTest.php create mode 100644 app/code/Magento/ImportExport/Test/Unit/Model/Source/Export/FormatTest.php diff --git a/app/code/Magento/ImportExport/Test/Unit/Model/Source/Export/EntityTest.php b/app/code/Magento/ImportExport/Test/Unit/Model/Source/Export/EntityTest.php new file mode 100644 index 0000000000000..d839e97be8278 --- /dev/null +++ b/app/code/Magento/ImportExport/Test/Unit/Model/Source/Export/EntityTest.php @@ -0,0 +1,95 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\ImportExport\Test\Unit\Model\Source\Export; + +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\ImportExport\Model\Export\ConfigInterface; +use Magento\ImportExport\Model\Source\Export\Entity; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +class EntityTest extends TestCase +{ + /** + * @var ConfigInterface|MockObject + */ + private $exportConfigMock; + + /** + * @var Entity + */ + private $model; + + /** + * Setup environment for test + */ + protected function setUp() + { + $this->exportConfigMock = $this->createMock(ConfigInterface::class); + + $objectManager = new ObjectManager($this); + $this->model = $objectManager->getObject( + Entity::class, + [ + 'exportConfig' => $this->exportConfigMock + ] + ); + } + + /** + * Test toOptionArray with data provider + * + * @param array $entities + * @param array $expected + * @dataProvider toOptionArrayDataProvider + */ + public function testToOptionArray($entities, $expected) + { + $this->exportConfigMock->expects($this->any())->method('getEntities')->willReturn($entities); + + $this->assertEquals($expected, $this->model->toOptionArray()); + } + + /** + * Data Provider for test toOptionArray + * + * @return array + */ + public function toOptionArrayDataProvider() + { + return [ + 'Empty Entity' => [ + [], + [ + [ + 'label' => (string)__('-- Please Select --'), + 'value' => '' + ] + ] + ], + 'Has entities' => [ + [ + 'entity1' => [ + 'label' => 'Entity 1' + ] + ], + [ + [ + 'label' => (string)__('-- Please Select --'), + 'value' => '' + ], + [ + 'label' => (string)__('Entity 1'), + 'value' => 'entity1' + ] + ] + ] + ]; + } +} diff --git a/app/code/Magento/ImportExport/Test/Unit/Model/Source/Export/FormatTest.php b/app/code/Magento/ImportExport/Test/Unit/Model/Source/Export/FormatTest.php new file mode 100644 index 0000000000000..416bab2c124f1 --- /dev/null +++ b/app/code/Magento/ImportExport/Test/Unit/Model/Source/Export/FormatTest.php @@ -0,0 +1,86 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\ImportExport\Test\Unit\Model\Source\Export; + +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\ImportExport\Model\Export\ConfigInterface; +use Magento\ImportExport\Model\Source\Export\Format; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +class FormatTest extends TestCase +{ + /** + * @var ConfigInterface|MockObject + */ + private $exportConfigMock; + + /** + * @var Format + */ + private $model; + + /** + * Setup environment for test + */ + protected function setUp() + { + $this->exportConfigMock = $this->createMock(ConfigInterface::class); + + $objectManager = new ObjectManager($this); + $this->model = $objectManager->getObject( + Format::class, + [ + 'exportConfig' => $this->exportConfigMock + ] + ); + } + + /** + * Test toOptionArray with data provider + * + * @param array $fileFormats + * @param array $expected + * @dataProvider toOptionArrayDataProvider + */ + public function testToOptionArray($fileFormats, $expected) + { + $this->exportConfigMock->expects($this->any())->method('getFileFormats')->willReturn($fileFormats); + + $this->assertEquals($expected, $this->model->toOptionArray()); + } + + /** + * Data Provider for test toOptionArray + * + * @return array + */ + public function toOptionArrayDataProvider() + { + return [ + 'Empty file format' => [ + [], + [] + ], + 'Has file format' => [ + [ + 'fileFormat1' => [ + 'label' => 'File Format 1' + ] + ], + [ + [ + 'label' => (string)__('File Format 1'), + 'value' => 'fileFormat1' + ] + ] + ] + ]; + } +} From ab43702d2e75ba642ee3d696f6dd555c586e4ca3 Mon Sep 17 00:00:00 2001 From: Eden Duong <quocviet312@gmail.com> Date: Thu, 19 Dec 2019 22:23:45 +0700 Subject: [PATCH 0522/1143] Update app/code/Magento/Weee/Test/Unit/Plugin/Catalog/Controller/Adminhtml/Product/Initialization/Helper/ProcessTaxAttributeTest.php Co-Authored-By: Dmytro Cheshun <d.cheshun@atwix.com> --- .../Product/Initialization/Helper/ProcessTaxAttributeTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Weee/Test/Unit/Plugin/Catalog/Controller/Adminhtml/Product/Initialization/Helper/ProcessTaxAttributeTest.php b/app/code/Magento/Weee/Test/Unit/Plugin/Catalog/Controller/Adminhtml/Product/Initialization/Helper/ProcessTaxAttributeTest.php index 28134a4c00363..002a4f40bff14 100644 --- a/app/code/Magento/Weee/Test/Unit/Plugin/Catalog/Controller/Adminhtml/Product/Initialization/Helper/ProcessTaxAttributeTest.php +++ b/app/code/Magento/Weee/Test/Unit/Plugin/Catalog/Controller/Adminhtml/Product/Initialization/Helper/ProcessTaxAttributeTest.php @@ -79,7 +79,7 @@ public function testAfterInitializeFromDataWhenAttributesAreEmpty() $this->resultMock->expects($this->any())->method('getAttributes') ->willReturn([]); - $this->resultMock->expects($this->never())->method('setData')->willReturnSelf(); + $this->resultMock->expects($this->never())->method('setData'); $this->plugin->afterInitializeFromData($this->subjectMock, $this->resultMock, $this->productMock, []); } From 1c727bb82fc1ff47202c6d1d87f2ee87a1509e30 Mon Sep 17 00:00:00 2001 From: Eden Duong <quocviet312@gmail.com> Date: Thu, 19 Dec 2019 22:23:52 +0700 Subject: [PATCH 0523/1143] Update app/code/Magento/Weee/Test/Unit/Plugin/Catalog/Controller/Adminhtml/Product/Initialization/Helper/ProcessTaxAttributeTest.php Co-Authored-By: Dmytro Cheshun <d.cheshun@atwix.com> --- .../Product/Initialization/Helper/ProcessTaxAttributeTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Weee/Test/Unit/Plugin/Catalog/Controller/Adminhtml/Product/Initialization/Helper/ProcessTaxAttributeTest.php b/app/code/Magento/Weee/Test/Unit/Plugin/Catalog/Controller/Adminhtml/Product/Initialization/Helper/ProcessTaxAttributeTest.php index 002a4f40bff14..2c88d3e0f0251 100644 --- a/app/code/Magento/Weee/Test/Unit/Plugin/Catalog/Controller/Adminhtml/Product/Initialization/Helper/ProcessTaxAttributeTest.php +++ b/app/code/Magento/Weee/Test/Unit/Plugin/Catalog/Controller/Adminhtml/Product/Initialization/Helper/ProcessTaxAttributeTest.php @@ -98,7 +98,7 @@ public function testAfterInitializeFromDataWhenAttributesDoNotIncludeWeee() $this->resultMock->expects($this->any())->method('getAttributes') ->willReturn([$attributeMock]); - $this->resultMock->expects($this->never())->method('setData')->willReturnSelf(); + $this->resultMock->expects($this->never())->method('setData'); $this->plugin->afterInitializeFromData($this->subjectMock, $this->resultMock, $this->productMock, []); } From e9939e04e6c45e80fa8cc619adc20be0c54df88b Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Thu, 19 Dec 2019 17:36:02 +0200 Subject: [PATCH 0524/1143] Adjusting the Unit Test --- .../Unit/Plugin/ResetQuoteAddressesTest.php | 145 +++++++++++++----- 1 file changed, 104 insertions(+), 41 deletions(-) diff --git a/app/code/Magento/Checkout/Test/Unit/Plugin/ResetQuoteAddressesTest.php b/app/code/Magento/Checkout/Test/Unit/Plugin/ResetQuoteAddressesTest.php index 60db2a36b34dc..0ec644a381955 100644 --- a/app/code/Magento/Checkout/Test/Unit/Plugin/ResetQuoteAddressesTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Plugin/ResetQuoteAddressesTest.php @@ -21,6 +21,21 @@ */ class ResetQuoteAddressesTest extends TestCase { + /** + * @var int + */ + private const STUB_ADDRESS_ID = 1; + + /** + * @var int + */ + private const STUB_ITEM_ID = 1; + + /** + * @var array + */ + private const STUB_QUOTE_ITEMS = [1, 2]; + /** * @var ResetQuoteAddresses */ @@ -65,11 +80,9 @@ protected function setUp() */ public function testRemovingTheAddressesFromNonEmptyQuote() { - $quoteVisibleItems = [1, 2]; - $this->quoteMock->expects($this->any()) ->method('getAllVisibleItems') - ->will($this->returnValue($quoteVisibleItems)); + ->will($this->returnValue(static::STUB_QUOTE_ITEMS)); $this->quoteMock->expects($this->never()) ->method('getAllAddresses') ->willReturnSelf(); @@ -78,46 +91,81 @@ public function testRemovingTheAddressesFromNonEmptyQuote() } /** - * Test clearing the addresses from an empty quote + * Test clearing the addresses from an empty quote with addresses + * + * @dataProvider quoteAddressesDataProvider * - * @dataProvider quoteDataProvider * @param bool $isVirtualQuote - * @param bool $quoteHasAddresses - * @param $extensionAttributes + * @param array $extensionAttributes */ - public function testClearingTheAddressesFromEmptyQuote( + public function testClearingAddressesSuccessfullyFromEmptyQuoteWithAddress( bool $isVirtualQuote, - bool $quoteHasAddresses, - $extensionAttributes + array $extensionAttributes ) { - $quoteVisibleItems = []; - $this->quoteMock->expects($this->any()) ->method('getAllVisibleItems') - ->will($this->returnValue($quoteVisibleItems)); + ->will($this->returnValue([])); - if ($quoteHasAddresses) { - $address = $this->createPartialMock(Address::class, ['getId']); + $address = $this->createPartialMock(Address::class, ['getId']); - $address->expects($this->any()) - ->method('getId') - ->willReturn(1); + $address->expects($this->any()) + ->method('getId') + ->willReturn(static::STUB_ADDRESS_ID); - $addresses = [$address]; + $addresses = [$address]; - $this->quoteMock->expects($this->any()) - ->method('getAllAddresses') - ->will($this->returnValue($addresses)); + $this->quoteMock->expects($this->any()) + ->method('getAllAddresses') + ->will($this->returnValue($addresses)); - $this->quoteMock->expects($this->exactly(count($addresses))) - ->method('removeAddress') + $this->quoteMock->expects($this->exactly(count($addresses))) + ->method('removeAddress') + ->willReturnSelf(); + + $this->quoteMock->expects($this->once()) + ->method('getExtensionAttributes') + ->willReturn($this->extensionAttributesMock); + + $this->quoteMock->expects($this->once()) + ->method('isVirtual') + ->willReturn($isVirtualQuote); + + if (!$isVirtualQuote && $extensionAttributes) { + $this->extensionAttributesMock->expects($this->any()) + ->method('getShippingAssignments') + ->willReturn($extensionAttributes); + + $this->extensionAttributesMock->expects($this->once()) + ->method('setShippingAssignments') ->willReturnSelf(); - } else { - $this->quoteMock->expects($this->any()) - ->method('getAllAddresses') - ->willReturn([]); } + $this->plugin->afterRemoveItem($this->quoteMock, $this->quoteMock, static::STUB_ITEM_ID); + } + + /** + * Test clearing the addresses from an empty quote + * + * @dataProvider quoteNoAddressesDataProvider + * + * @param bool $isVirtualQuote + * @param array $extensionAttributes + */ + public function testClearingTheAddressesFromEmptyQuote( + bool $isVirtualQuote, + array $extensionAttributes + ) { + $quoteVisibleItems = []; + $addresses = []; + + $this->quoteMock->expects($this->any()) + ->method('getAllVisibleItems') + ->will($this->returnValue($quoteVisibleItems)); + + $this->quoteMock->expects($this->any()) + ->method('getAllAddresses') + ->willReturn($addresses); + $this->quoteMock->expects($this->once()) ->method('getExtensionAttributes') ->willReturn($this->extensionAttributesMock); @@ -126,45 +174,60 @@ public function testClearingTheAddressesFromEmptyQuote( ->method('isVirtual') ->willReturn($isVirtualQuote); - if ($isVirtualQuote && $extensionAttributes) { + if (!$isVirtualQuote && $extensionAttributes) { $this->extensionAttributesMock->expects($this->any()) ->method('getShippingAssignments') - ->willReturn([1]); + ->willReturn($extensionAttributes); $this->extensionAttributesMock->expects($this->once()) ->method('setShippingAssignments') ->willReturnSelf(); } - $this->plugin->afterRemoveItem($this->quoteMock, $this->quoteMock, 1); + $this->plugin->afterRemoveItem($this->quoteMock, $this->quoteMock, static::STUB_ITEM_ID); } /** - * Quote information data provider + * Quote without address data provider * * @return array */ - public function quoteDataProvider(): array + public function quoteNoAddressesDataProvider(): array { return [ 'Test case with virtual quote' => [ true, - true, - null - ], - 'Test case with virtual quote and without a quote address' => [ - true, - false, - null + [] ], 'Test case with a non virtual quote without extension attributes' => [ false, - true, [] ], 'Test case with a non virtual quote with shipping assignments' => [ false, + [1] + ] + ]; + } + + /** + * Quote with address information data provider + * + * @return array + */ + public function quoteAddressesDataProvider(): array + { + return [ + 'Test case with a virtual quote and no shipping assignments' => [ true, + [] + ], + 'Test case with a virtual quote and with shipping assignments' => [ + true, + [1] + ], + 'Test case with none virtual quote and with shipping assignments' => [ + false, [1] ] ]; From 54fe070c63ea4ccad8dd4f3b9821e112e89f1f7e Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Thu, 19 Dec 2019 17:37:51 +0200 Subject: [PATCH 0525/1143] Small adjustments --- .../Checkout/Test/Unit/Plugin/ResetQuoteAddressesTest.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Checkout/Test/Unit/Plugin/ResetQuoteAddressesTest.php b/app/code/Magento/Checkout/Test/Unit/Plugin/ResetQuoteAddressesTest.php index 0ec644a381955..d5d3e3e8b0469 100644 --- a/app/code/Magento/Checkout/Test/Unit/Plugin/ResetQuoteAddressesTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Plugin/ResetQuoteAddressesTest.php @@ -31,6 +31,11 @@ class ResetQuoteAddressesTest extends TestCase */ private const STUB_ITEM_ID = 1; + /** + * @var int + */ + private const STUB_SHIPPING_ASSIGNMENTS = 1; + /** * @var array */ @@ -133,7 +138,7 @@ public function testClearingAddressesSuccessfullyFromEmptyQuoteWithAddress( if (!$isVirtualQuote && $extensionAttributes) { $this->extensionAttributesMock->expects($this->any()) ->method('getShippingAssignments') - ->willReturn($extensionAttributes); + ->willReturn([static::STUB_SHIPPING_ASSIGNMENTS]); $this->extensionAttributesMock->expects($this->once()) ->method('setShippingAssignments') From 37a953f450a4aa5b83cd2e23fdd40e08abe9118d Mon Sep 17 00:00:00 2001 From: Mastiuhin Olexandr <mastiuhin.olexandr@transoftgroup.com> Date: Thu, 19 Dec 2019 19:01:07 +0200 Subject: [PATCH 0526/1143] MC-29786: Radio buttons for shipping methods are disabled in shopping cart --- .../view/frontend/web/template/cart/shipping-rates.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/template/cart/shipping-rates.html b/app/code/Magento/Checkout/view/frontend/web/template/cart/shipping-rates.html index 5d1889519a302..9f0d436056924 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/cart/shipping-rates.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/cart/shipping-rates.html @@ -24,7 +24,8 @@ checked: $parents[1].selectedShippingMethod, attr: { value: carrier_code + '_' + method_code, - id: 's_method_' + carrier_code + '_' + method_code + id: 's_method_' + carrier_code + '_' + method_code, + disabled: false } "/> <label class="label" data-bind="attr: {for: 's_method_' + carrier_code + '_' + method_code}"> From 52b66acf17e049dc2c5c7d9e12bd6d29d6a1a16d Mon Sep 17 00:00:00 2001 From: Michael Bottens <michael.bottens@blueacorn.com> Date: Tue, 12 Nov 2019 12:06:45 -0500 Subject: [PATCH 0527/1143] #1057: Emulate area code for graphql category/product attributes --- app/code/Magento/CatalogGraphQl/etc/graphql/di.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/code/Magento/CatalogGraphQl/etc/graphql/di.xml b/app/code/Magento/CatalogGraphQl/etc/graphql/di.xml index 066a7b38d8967..ed548efc896f8 100644 --- a/app/code/Magento/CatalogGraphQl/etc/graphql/di.xml +++ b/app/code/Magento/CatalogGraphQl/etc/graphql/di.xml @@ -176,4 +176,10 @@ </argument> </arguments> </type> + + <type name="Magento\Catalog\Helper\Data"> + <arguments> + <argument name="templateFilterModel" xsi:type="string">Magento\Widget\Model\Template\FilterEmulate</argument> + </arguments> + </type> </config> From 5fcac84a5d0a080279ff77e681aae051afd9490c Mon Sep 17 00:00:00 2001 From: Karyna Tsymbal <k.tsymbal@atwix.com> Date: Wed, 20 Nov 2019 15:44:32 +0200 Subject: [PATCH 0528/1143] GraphQl Issue#1061 - Remove redundant logic from resolvers --- .../Customer/SetPaymentMethodTest.php | 120 +----------------- .../Customer/SetPaymentMethodTest.php | 29 ----- .../Braintree/Guest/SetPaymentMethodTest.php | 33 ----- .../Customer/AddSimpleProductToCartTest.php | 56 -------- .../Customer/AddVirtualProductToCartTest.php | 55 -------- .../Quote/Customer/ApplyCouponToCartTest.php | 43 ------- .../GraphQl/Quote/Customer/PlaceOrderTest.php | 20 --- .../Customer/RemoveCouponFromCartTest.php | 23 ---- .../Quote/Customer/RemoveItemFromCartTest.php | 44 ------- .../Customer/SetBillingAddressOnCartTest.php | 9 -- .../SetPaymentMethodAndPlaceOrderTest.php | 11 -- .../Customer/SetPaymentMethodOnCartTest.php | 8 -- .../Customer/SetShippingAddressOnCartTest.php | 13 -- .../Customer/SetShippingMethodsOnCartTest.php | 24 ---- .../Quote/Customer/UpdateCartItemsTest.php | 37 ------ .../Guest/AddSimpleProductToCartTest.php | 51 -------- .../Guest/AddVirtualProductToCartTest.php | 52 -------- .../Quote/Guest/ApplyCouponToCartTest.php | 43 ------- .../Quote/Guest/ApplyCouponsToCartTest.php | 43 ------- .../GraphQl/Quote/Guest/PlaceOrderTest.php | 19 --- .../Quote/Guest/RemoveCouponFromCartTest.php | 22 ---- .../Quote/Guest/RemoveItemFromCartTest.php | 43 ------- .../Guest/SetBillingAddressOnCartTest.php | 52 -------- .../Guest/SetPaymentMethodOnCartTest.php | 8 -- .../Guest/SetShippingAddressOnCartTest.php | 56 -------- .../Guest/SetShippingMethodsOnCartTest.php | 24 ---- .../Quote/Guest/UpdateCartItemsTest.php | 36 ------ 27 files changed, 1 insertion(+), 973 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/AuthorizenetAcceptjs/Customer/SetPaymentMethodTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/AuthorizenetAcceptjs/Customer/SetPaymentMethodTest.php index e9ab4456fae81..d6954c249f209 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/AuthorizenetAcceptjs/Customer/SetPaymentMethodTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/AuthorizenetAcceptjs/Customer/SetPaymentMethodTest.php @@ -157,38 +157,7 @@ function (string $maskedQuoteId) { [ 'Required parameter "authorizenet_acceptjs" for "payment_method" is missing.' ] - ], - [ - function (string $maskedQuoteId) { - return $this->getEmptyAcceptJsInput($maskedQuoteId); - }, - [ - 'Field AuthorizenetInput.cc_last_4 of required type Int! was not provided.', - 'Field AuthorizenetInput.opaque_data_descriptor of required type String! was not provided.', - 'Field AuthorizenetInput.opaque_data_value of required type String! was not provided.' - ] - - ], - [ - function (string $maskedQuoteId) { - return $this->getMissingCcLastFourAcceptJsInput( - $maskedQuoteId, - static::VALID_DESCRIPTOR, - static::VALID_NONCE - ); - }, - [ - 'Field AuthorizenetInput.cc_last_4 of required type Int! was not provided', - ] - ], - [ - function (string $maskedQuoteId) { - return $this->getMissingOpaqueDataValueAcceptJsInput($maskedQuoteId, static::VALID_DESCRIPTOR); - }, - [ - 'Field AuthorizenetInput.opaque_data_value of required type String! was not provided', - ] - ], + ] ]; } @@ -218,93 +187,6 @@ private function getInvalidSetPaymentMutation(string $maskedQuoteId): string QUERY; } - /** - * Get setPaymentMethodOnCart missing required additional data properties - * - * @param string $maskedQuoteId - * @return string - */ - private function getEmptyAcceptJsInput(string $maskedQuoteId): string - { - return <<<QUERY -mutation { - setPaymentMethodOnCart(input:{ - cart_id:"{$maskedQuoteId}" - payment_method:{ - code:"authorizenet_acceptjs" - authorizenet_acceptjs: {} - } - }) { - cart { - selected_payment_method { - code - } - } - } -} -QUERY; - } - - /** - * Get setPaymentMethodOnCart missing required additional data properties - * - * @param string $maskedQuoteId - * @return string - */ - private function getMissingCcLastFourAcceptJsInput(string $maskedQuoteId, string $descriptor, string $nonce): string - { - return <<<QUERY -mutation { - setPaymentMethodOnCart(input:{ - cart_id:"{$maskedQuoteId}" - payment_method:{ - code:"authorizenet_acceptjs" - authorizenet_acceptjs:{ - opaque_data_descriptor: "{$descriptor}" - opaque_data_value: "{$nonce}" - } - } - }) { - cart { - selected_payment_method { - code - } - } - } -} -QUERY; - } - - /** - * Get setPaymentMethodOnCart missing required additional data properties - * - * @param string $maskedQuoteId - * @return string - */ - private function getMissingOpaqueDataValueAcceptJsInput(string $maskedQuoteId, string $descriptor): string - { - return <<<QUERY -mutation { - setPaymentMethodOnCart(input:{ - cart_id:"{$maskedQuoteId}" - payment_method:{ - code:"authorizenet_acceptjs" - authorizenet_acceptjs:{ - opaque_data_descriptor: "{$descriptor}" - cc_last_4: 1111 - } - } - }) { - cart { - selected_payment_method { - code - } - } - } -} -QUERY; - } - private function assertPlaceOrderResponse(array $response, string $reservedOrderId): void { self::assertArrayHasKey('placeOrder', $response); diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Braintree/Customer/SetPaymentMethodTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Braintree/Customer/SetPaymentMethodTest.php index a282b295c2974..fbaa3a98613cf 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Braintree/Customer/SetPaymentMethodTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Braintree/Customer/SetPaymentMethodTest.php @@ -270,35 +270,6 @@ public function testSetPaymentMethodInvalidMethodInput(string $methodCode) $this->graphQlMutation($setPaymentQuery, [], '', $this->getHeaderMap()); } - /** - * @magentoConfigFixture default_store carriers/flatrate/active 1 - * @magentoConfigFixture default_store payment/braintree/active 1 - * @magentoConfigFixture default_store payment/braintree_cc_vault/active 1 - * @magentoConfigFixture default_store payment/braintree/environment sandbox - * @magentoConfigFixture default_store payment/braintree/merchant_id def_merchant_id - * @magentoConfigFixture default_store payment/braintree/public_key def_public_key - * @magentoConfigFixture default_store payment/braintree/private_key def_private_key - * @magentoApiDataFixture Magento/Customer/_files/customer.php - * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php - * @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php - * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php - * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php - * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_billing_address.php - * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_flatrate_shipping_method.php - * @expectedException \Exception - */ - public function testSetPaymentMethodWithoutRequiredPaymentMethodInput() - { - $reservedOrderId = 'test_quote'; - $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute($reservedOrderId); - - $setPaymentQuery = $this->getSetPaymentBraintreeQueryInvalidPaymentMethodInput($maskedQuoteId); - $this->expectExceptionMessage( - 'Field BraintreeInput.is_active_payment_token_enabler of required type Boolean! was not provided.' - ); - $this->graphQlMutation($setPaymentQuery, [], '', $this->getHeaderMap()); - } - public function dataProviderTestSetPaymentMethodInvalidInput(): array { return [ diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Braintree/Guest/SetPaymentMethodTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Braintree/Guest/SetPaymentMethodTest.php index c0a7491cbc1bf..b000d6e7ff347 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Braintree/Guest/SetPaymentMethodTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Braintree/Guest/SetPaymentMethodTest.php @@ -129,39 +129,6 @@ public function testSetPaymentMethodInvalidInput() $this->graphQlMutation($setPaymentQuery); } - /** - * @magentoConfigFixture default_store carriers/flatrate/active 1 - * @magentoConfigFixture default_store payment/braintree/active 1 - * @magentoConfigFixture default_store payment/braintree/environment sandbox - * @magentoConfigFixture default_store payment/braintree/merchant_id def_merchant_id - * @magentoConfigFixture default_store payment/braintree/public_key def_public_key - * @magentoConfigFixture default_store payment/braintree/private_key def_private_key - * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php - * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php - * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/set_guest_email.php - * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php - * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php - * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_billing_address.php - * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_flatrate_shipping_method.php - * @expectedException \Exception - */ - public function testSetPaymentMethodInvalidMethodInput() - { - $reservedOrderId = 'test_quote'; - $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute($reservedOrderId); - - $setPaymentQuery = $this->getSetPaymentBraintreeQueryInvalidMethodInput($maskedQuoteId); - - $this->expectExceptionMessage( - 'Field BraintreeInput.is_active_payment_token_enabler of required type Boolean! was not provided' - ); - $this->expectExceptionMessage( - 'Field BraintreeInput.payment_method_nonce of required type String! was not provided.' - ); - - $this->graphQlMutation($setPaymentQuery); - } - private function assertPlaceOrderResponse(array $response, string $reservedOrderId): void { self::assertArrayHasKey('placeOrder', $response); diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddSimpleProductToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddSimpleProductToCartTest.php index 0c676d86a33da..aca98e946054c 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddSimpleProductToCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddSimpleProductToCartTest.php @@ -82,32 +82,6 @@ public function testAddSimpleProductToCart() self::assertEquals('USD', $rowTotalIncludingTax['currency']); } - /** - * @magentoApiDataFixture Magento/Customer/_files/customer.php - * @expectedException Exception - * @expectedExceptionMessage Field AddSimpleProductsToCartInput.cart_id of required type String! was not provided. - */ - public function testAddSimpleProductToCartIfCartIdIsMissed() - { - $query = <<<QUERY -mutation { - addSimpleProductsToCart( - input: { - cart_items: [] - } - ) { - cart { - items { - id - } - } - } -} -QUERY; - - $this->graphQlMutation($query, [], '', $this->getHeaderMap()); - } - /** * @magentoApiDataFixture Magento/Customer/_files/customer.php * @expectedException Exception @@ -135,36 +109,6 @@ public function testAddSimpleProductToCartIfCartIdIsEmpty() $this->graphQlMutation($query, [], '', $this->getHeaderMap()); } - /** - * @magentoApiDataFixture Magento/Customer/_files/customer.php - * @expectedException Exception - */ - public function testAddSimpleProductToCartIfCartItemsAreMissed() - { - $query = <<<QUERY -mutation { - addSimpleProductsToCart( - input: { - cart_id: "cart_id" - } - ) { - cart { - items { - id - } - } - } -} -QUERY; - - $this->expectExceptionMessage( - 'Field AddSimpleProductsToCartInput.cart_items of required type' - . ' [SimpleProductCartItemInput]! was not provided.' - ); - - $this->graphQlMutation($query, [], '', $this->getHeaderMap()); - } - /** * @magentoApiDataFixture Magento/Customer/_files/customer.php * @expectedException Exception diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddVirtualProductToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddVirtualProductToCartTest.php index a7a3028f2a369..4805721de625a 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddVirtualProductToCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddVirtualProductToCartTest.php @@ -54,32 +54,6 @@ public function testAddVirtualProductToCart() self::assertEquals($sku, $response['addVirtualProductsToCart']['cart']['items'][0]['product']['sku']); } - /** - * @magentoApiDataFixture Magento/Customer/_files/customer.php - * @expectedException Exception - * @expectedExceptionMessage Field AddSimpleProductsToCartInput.cart_id of required type String! was not provided. - */ - public function testAddVirtualProductToCartIfCartIdIsMissed() - { - $query = <<<QUERY -mutation { - addSimpleProductsToCart( - input: { - cart_items: [] - } - ) { - cart { - items { - id - } - } - } -} -QUERY; - - $this->graphQlMutation($query, [], '', $this->getHeaderMap()); - } - /** * @magentoApiDataFixture Magento/Customer/_files/customer.php * @expectedException Exception @@ -107,35 +81,6 @@ public function testAddVirtualProductToCartIfCartIdIsEmpty() $this->graphQlMutation($query, [], '', $this->getHeaderMap()); } - /** - * @magentoApiDataFixture Magento/Customer/_files/customer.php - */ - public function testAddVirtualProductToCartIfCartItemsAreMissed() - { - $query = <<<QUERY -mutation { - addSimpleProductsToCart( - input: { - cart_id: "cart_id" - } - ) { - cart { - items { - id - } - } - } -} -QUERY; - $this->expectException(\Exception::class); - $this->expectExceptionMessage( - 'Field AddSimpleProductsToCartInput.cart_items of required type [SimpleProductCartItemInput]!' - . ' was not provided.' - ); - - $this->graphQlMutation($query, [], '', $this->getHeaderMap()); - } - /** * @magentoApiDataFixture Magento/Customer/_files/customer.php * @expectedException Exception diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/ApplyCouponToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/ApplyCouponToCartTest.php index fa96443eaee1e..d96bf77f2ef0e 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/ApplyCouponToCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/ApplyCouponToCartTest.php @@ -183,49 +183,6 @@ public function testApplyCouponWhichIsNotApplicable() $this->graphQlMutation($query, [], '', $this->getHeaderMap()); } - /** - * @param string $input - * @param string $message - * @dataProvider dataProviderUpdateWithMissedRequiredParameters - * @magentoApiDataFixture Magento/Customer/_files/customer.php - * @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php - * @expectedException \Exception - */ - public function testApplyCouponWithMissedRequiredParameters(string $input, string $message) - { - $query = <<<QUERY -mutation { - applyCouponToCart(input: {{$input}}) { - cart { - applied_coupon { - code - } - } - } -} -QUERY; - - $this->expectExceptionMessage($message); - $this->graphQlMutation($query, [], '', $this->getHeaderMap()); - } - - /** - * @return array - */ - public function dataProviderUpdateWithMissedRequiredParameters(): array - { - return [ - 'missed_cart_id' => [ - 'coupon_code: "test"', - 'Field ApplyCouponToCartInput.cart_id of required type String! was not provided.' - ], - 'missed_coupon_code' => [ - 'cart_id: "test_quote"', - 'Field ApplyCouponToCartInput.coupon_code of required type String! was not provided.' - ], - ]; - } - /** * Retrieve customer authorization headers * diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/PlaceOrderTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/PlaceOrderTest.php index 189d5ceab838d..88c57cf2fb282 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/PlaceOrderTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/PlaceOrderTest.php @@ -103,26 +103,6 @@ public function testPlaceOrderIfCartIdIsEmpty() $this->graphQlMutation($query, [], '', $this->getHeaderMap()); } - /** - * @magentoApiDataFixture Magento/Customer/_files/customer.php - * @expectedException Exception - * @expectedExceptionMessage Field PlaceOrderInput.cart_id of required type String! was not provided. - */ - public function testPlaceOrderIfCartIdIsMissed() - { - $query = <<<QUERY -mutation { - placeOrder(input: {}) { - order { - order_number - } - } -} -QUERY; - - $this->graphQlMutation($query, [], '', $this->getHeaderMap()); - } - /** * @magentoApiDataFixture Magento/Customer/_files/customer.php * @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/RemoveCouponFromCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/RemoveCouponFromCartTest.php index d4390e902a3f9..1b5a308b5a9a8 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/RemoveCouponFromCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/RemoveCouponFromCartTest.php @@ -70,29 +70,6 @@ public function testRemoveCouponFromCartIfCartIdIsEmpty() $this->graphQlMutation($query, [], '', $this->getHeaderMap()); } - /** - * @magentoApiDataFixture Magento/Customer/_files/customer.php - * @expectedException Exception - * @expectedExceptionMessage Field RemoveCouponFromCartInput.cart_id of required type String! was not provided. - */ - public function testRemoveCouponFromCartIfCartIdIsMissed() - { - $query = <<<QUERY -mutation { - removeCouponFromCart(input: {}) { - cart { - applied_coupon { - code - } - } - } -} - -QUERY; - - $this->graphQlMutation($query, [], '', $this->getHeaderMap()); - } - /** * @magentoApiDataFixture Magento/Customer/_files/customer.php * @expectedException Exception diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/RemoveItemFromCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/RemoveItemFromCartTest.php index a14aacc974af6..c93db424834ef 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/RemoveItemFromCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/RemoveItemFromCartTest.php @@ -90,50 +90,6 @@ public function testRemoveNonExistentItem() $this->graphQlMutation($query, [], '', $this->getHeaderMap()); } - /** - * @magentoApiDataFixture Magento/Customer/_files/customer.php - * @param string $input - * @param string $message - * @dataProvider dataProviderUpdateWithMissedRequiredParameters - */ - public function testUpdateWithMissedItemRequiredParameters(string $input, string $message) - { - $query = <<<QUERY -mutation { - removeItemFromCart( - input: { - {$input} - } - ) { - cart { - items { - quantity - } - } - } -} -QUERY; - $this->expectExceptionMessage($message); - $this->graphQlMutation($query, [], '', $this->getHeaderMap()); - } - - /** - * @return array - */ - public function dataProviderUpdateWithMissedRequiredParameters(): array - { - return [ - 'missed_cart_id' => [ - 'cart_item_id: 1', - 'Field RemoveItemFromCartInput.cart_id of required type String! was not provided.' - ], - 'missed_cart_item_id' => [ - 'cart_id: "test_quote"', - 'Field RemoveItemFromCartInput.cart_item_id of required type Int! was not provided.' - ], - ]; - } - /** * _security * @magentoApiDataFixture Magento/Customer/_files/customer.php diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetBillingAddressOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetBillingAddressOnCartTest.php index 19a10d9466a32..05323a5a7ddf4 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetBillingAddressOnCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetBillingAddressOnCartTest.php @@ -653,15 +653,6 @@ public function testSetBillingAddressWithoutRequiredParameters(string $input, st public function dataProviderSetWithoutRequiredParameters(): array { return [ - 'missed_billing_address' => [ - 'cart_id: "cart_id_value"', - 'Field SetBillingAddressOnCartInput.billing_address of required type BillingAddressInput!' - . ' was not provided.', - ], - 'missed_cart_id' => [ - 'billing_address: {}', - 'Field SetBillingAddressOnCartInput.cart_id of required type String! was not provided.' - ], 'missed_region' => [ 'cart_id: "cart_id_value" billing_address: { diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetPaymentMethodAndPlaceOrderTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetPaymentMethodAndPlaceOrderTest.php index 543ce6fe9c8e7..b31ce8a7302a9 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetPaymentMethodAndPlaceOrderTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetPaymentMethodAndPlaceOrderTest.php @@ -132,17 +132,6 @@ public function testSetPaymentOnCartWithException(string $input, string $message public function dataProviderSetPaymentOnCartWithException(): array { return [ - 'missed_cart_id' => [ - 'payment_method: { - code: "' . Checkmo::PAYMENT_METHOD_CHECKMO_CODE . '" - }', - 'Field SetPaymentMethodAndPlaceOrderInput.cart_id of required type String! was not provided.', - ], - 'missed_payment_method' => [ - 'cart_id: "cart_id_value"', - 'Field SetPaymentMethodAndPlaceOrderInput.payment_method of required type PaymentMethodInput!' - . ' was not provided.', - ], 'place_order_with_out_of_stock_products' => [ 'cart_id: "cart_id_value" payment_method: { diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetPaymentMethodOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetPaymentMethodOnCartTest.php index da190be333600..57aeda3295268 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetPaymentMethodOnCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetPaymentMethodOnCartTest.php @@ -233,14 +233,6 @@ public function testSetDisabledPaymentOnCart() public function dataProviderSetPaymentMethodWithoutRequiredParameters(): array { return [ - 'missed_cart_id' => [ - 'payment_method: {code: "' . Checkmo::PAYMENT_METHOD_CHECKMO_CODE . '"}', - 'Field SetPaymentMethodOnCartInput.cart_id of required type String! was not provided.' - ], - 'missed_payment_method' => [ - 'cart_id: "cart_id_value"', - 'Field SetPaymentMethodOnCartInput.payment_method of required type PaymentMethodInput! was not provided' - ], 'missed_payment_method_code' => [ 'cart_id: "cart_id_value", payment_method: {code: ""}', 'Required parameter "code" for "payment_method" is missing.' diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetShippingAddressOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetShippingAddressOnCartTest.php index 47a3a13f05221..2a19fb0d10d6a 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetShippingAddressOnCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetShippingAddressOnCartTest.php @@ -511,19 +511,6 @@ public function testSetNewShippingAddressWithMissedRequiredStreetParameters() public function dataProviderUpdateWithMissedRequiredParameters(): array { return [ - 'missed_shipping_addresses' => [ - 'cart_id: "cart_id_value"', - 'Field SetShippingAddressesOnCartInput.shipping_addresses of required type [ShippingAddressInput]! ' . - 'was not provided.', - ], - 'missed_city' => [ - 'shipping_addresses: [ { address: { save_in_address_book: false } } ]', - 'Field CartAddressInput.city of required type String! was not provided' - ], - 'missed_cart_id' => [ - 'shipping_addresses: {}', - 'Field SetShippingAddressesOnCartInput.cart_id of required type String! was not provided.' - ], 'missed_region' => [ 'cart_id: "cart_id_value" shipping_addresses: [{ diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetShippingMethodsOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetShippingMethodsOnCartTest.php index 149a2fbb1da32..293bfdaf502d9 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetShippingMethodsOnCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetShippingMethodsOnCartTest.php @@ -169,28 +169,10 @@ public function testSetShippingMethodWithWrongParameters(string $input, string $ public function dataProviderSetShippingMethodWithWrongParameters(): array { return [ - 'missed_cart_id' => [ - 'shipping_methods: [{ - carrier_code: "flatrate" - method_code: "flatrate" - }]', - 'Field SetShippingMethodsOnCartInput.cart_id of required type String! was not provided.' - ], - 'missed_shipping_methods' => [ - 'cart_id: "cart_id_value"', - 'Field SetShippingMethodsOnCartInput.shipping_methods of required type [ShippingMethodInput]!' - . ' was not provided.' - ], 'shipping_methods_are_empty' => [ 'cart_id: "cart_id_value" shipping_methods: []', 'Required parameter "shipping_methods" is missing' ], - 'missed_carrier_code' => [ - 'cart_id: "cart_id_value", shipping_methods: [{ - method_code: "flatrate" - }]', - 'Field ShippingMethodInput.carrier_code of required type String! was not provided.' - ], 'empty_carrier_code' => [ 'cart_id: "cart_id_value", shipping_methods: [{ carrier_code: "" @@ -205,12 +187,6 @@ public function dataProviderSetShippingMethodWithWrongParameters(): array }]', 'Carrier with such method not found: wrong-carrier-code, flatrate' ], - 'missed_method_code' => [ - 'cart_id: "cart_id_value", shipping_methods: [{ - carrier_code: "flatrate" - }]', - 'Field ShippingMethodInput.method_code of required type String! was not provided.' - ], 'empty_method_code' => [ 'cart_id: "cart_id_value", shipping_methods: [{ carrier_code: "flatrate" diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/UpdateCartItemsTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/UpdateCartItemsTest.php index 1ec2de36a0bc2..b351872a69bc7 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/UpdateCartItemsTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/UpdateCartItemsTest.php @@ -209,35 +209,6 @@ public function testUpdateItemInAnotherCustomerCart() $this->graphQlMutation($query, [], '', $this->getHeaderMap()); } - /** - * @magentoApiDataFixture Magento/Customer/_files/customer.php - * @expectedException \Exception - * @expectedExceptionMessage Field UpdateCartItemsInput.cart_id of required type String! was not provided. - */ - public function testUpdateWithMissedCartItemId() - { - $query = <<<QUERY -mutation { - updateCartItems(input: { - cart_items: [ - { - cart_item_id: 1 - quantity: 2 - } - ] - }) { - cart { - items { - id - quantity - } - } - } -} -QUERY; - $this->graphQlMutation($query, [], '', $this->getHeaderMap()); - } - /** * @param string $input * @param string $message @@ -275,14 +246,6 @@ public function testUpdateWithMissedItemRequiredParameters(string $input, string public function dataProviderUpdateWithMissedRequiredParameters(): array { return [ - 'missed_cart_items' => [ - '', - 'Field UpdateCartItemsInput.cart_items of required type [CartItemUpdateInput]! was not provided.' - ], - 'missed_cart_item_id' => [ - 'cart_items: [{ quantity: 2 }]', - 'Field CartItemUpdateInput.cart_item_id of required type Int! was not provided.' - ], 'missed_cart_item_qty' => [ 'cart_items: [{ cart_item_id: 1 }]', 'Required parameter "quantity" for "cart_items" is missing.' diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddSimpleProductToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddSimpleProductToCartTest.php index 59f11be6d5b45..01ae565f00bf6 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddSimpleProductToCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddSimpleProductToCartTest.php @@ -79,31 +79,6 @@ public function testAddSimpleProductToCart() self::assertEquals('USD', $rowTotalIncludingTax['currency']); } - /** - * @expectedException Exception - * @expectedExceptionMessage Field AddSimpleProductsToCartInput.cart_id of required type String! was not provided. - */ - public function testAddSimpleProductToCartIfCartIdIsMissed() - { - $query = <<<QUERY -mutation { - addSimpleProductsToCart( - input: { - cart_items: [] - } - ) { - cart { - items { - id - } - } - } -} -QUERY; - - $this->graphQlMutation($query); - } - /** * @expectedException Exception * @expectedExceptionMessage Required parameter "cart_id" is missing @@ -130,32 +105,6 @@ public function testAddSimpleProductToCartIfCartIdIsEmpty() $this->graphQlMutation($query); } - public function testAddSimpleProductToCartIfCartItemsAreMissed() - { - $query = <<<QUERY -mutation { - addSimpleProductsToCart( - input: { - cart_id: "cart_id" - } - ) { - cart { - items { - id - } - } - } -} -QUERY; - $this->expectException(\Exception::class); - $this->expectExceptionMessage( - 'Field AddSimpleProductsToCartInput.cart_items of required type [SimpleProductCartItemInput]!' - . ' was not provided.' - ); - - $this->graphQlMutation($query); - } - /** * @expectedException Exception * @expectedExceptionMessage Required parameter "cart_items" is missing diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddVirtualProductToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddVirtualProductToCartTest.php index c5723d137d070..3811a60ffc522 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddVirtualProductToCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddVirtualProductToCartTest.php @@ -51,31 +51,6 @@ public function testAddVirtualProductToCart() self::assertEquals($sku, $response['addVirtualProductsToCart']['cart']['items'][0]['product']['sku']); } - /** - * @expectedException Exception - * @expectedExceptionMessage Field AddSimpleProductsToCartInput.cart_id of required type String! was not provided. - */ - public function testAddVirtualProductToCartIfCartIdIsMissed() - { - $query = <<<QUERY -mutation { - addSimpleProductsToCart( - input: { - cart_items: [] - } - ) { - cart { - items { - id - } - } - } -} -QUERY; - - $this->graphQlMutation($query); - } - /** * @expectedException Exception * @expectedExceptionMessage Required parameter "cart_id" is missing @@ -102,33 +77,6 @@ public function testAddVirtualProductToCartIfCartIdIsEmpty() $this->graphQlMutation($query); } - public function testAddVirtualProductToCartIfCartItemsAreMissed() - { - $query = <<<QUERY -mutation { - addSimpleProductsToCart( - input: { - cart_id: "cart_id" - } - ) { - cart { - items { - id - } - } - } -} -QUERY; - - $this->expectException(\Exception::class); - $this->expectExceptionMessage( - 'Field AddSimpleProductsToCartInput.cart_items of required type [SimpleProductCartItemInput]!' - . ' was not provided.' - ); - - $this->graphQlMutation($query); - } - /** * @expectedException Exception * @expectedExceptionMessage Required parameter "cart_items" is missing diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/ApplyCouponToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/ApplyCouponToCartTest.php index 865837e6bd629..454f01b5cde19 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/ApplyCouponToCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/ApplyCouponToCartTest.php @@ -150,49 +150,6 @@ public function testApplyCouponWhichIsNotApplicable() $this->graphQlMutation($query); } - /** - * @param string $input - * @param string $message - * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php - * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php - * @dataProvider dataProviderUpdateWithMissedRequiredParameters - * @expectedException \Exception - */ - public function testApplyCouponWithMissedRequiredParameters(string $input, string $message) - { - $query = <<<QUERY -mutation { - applyCouponToCart(input: {{$input}}) { - cart { - applied_coupon { - code - } - } - } -} -QUERY; - - $this->expectExceptionMessage($message); - $this->graphQlMutation($query); - } - - /** - * @return array - */ - public function dataProviderUpdateWithMissedRequiredParameters(): array - { - return [ - 'missed_cart_id' => [ - 'coupon_code: "test"', - 'Field ApplyCouponToCartInput.cart_id of required type String! was not provided.' - ], - 'missed_coupon_code' => [ - 'cart_id: "test_quote"', - 'Field ApplyCouponToCartInput.coupon_code of required type String! was not provided.' - ], - ]; - } - /** * @param string $maskedQuoteId * @param string $couponCode diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/ApplyCouponsToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/ApplyCouponsToCartTest.php index 7d5e21cd25b8a..0344e274d6fbc 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/ApplyCouponsToCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/ApplyCouponsToCartTest.php @@ -127,49 +127,6 @@ public function testApplyCouponsWhichIsNotApplicable() $this->graphQlMutation($query); } - /** - * @param string $input - * @param string $message - * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php - * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php - * @dataProvider dataProviderUpdateWithMissedRequiredParameters - * @expectedException \Exception - */ - public function testApplyCouponsWithMissedRequiredParameters(string $input, string $message) - { - $query = <<<QUERY -mutation { - applyCouponToCart(input: {{$input}}) { - cart { - applied_coupons { - code - } - } - } -} -QUERY; - - $this->expectExceptionMessage($message); - $this->graphQlMutation($query); - } - - /** - * @return array - */ - public function dataProviderUpdateWithMissedRequiredParameters(): array - { - return [ - 'missed_cart_id' => [ - 'coupon_code: "test"', - 'Field ApplyCouponToCartInput.cart_id of required type String! was not provided.' - ], - 'missed_coupon_code' => [ - 'cart_id: "test_quote"', - 'Field ApplyCouponToCartInput.coupon_code of required type String! was not provided.' - ], - ]; - } - /** * @param string $maskedQuoteId * @param string $couponCode diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/PlaceOrderTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/PlaceOrderTest.php index c6c1d3be99c59..bf31d3c6fa3f4 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/PlaceOrderTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/PlaceOrderTest.php @@ -95,25 +95,6 @@ public function testPlaceOrderIfCartIdIsEmpty() $this->graphQlMutation($query); } - /** - * @expectedException Exception - * @expectedExceptionMessage Field PlaceOrderInput.cart_id of required type String! was not provided. - */ - public function testPlaceOrderIfCartIdIsMissed() - { - $query = <<<QUERY -mutation { - placeOrder(input: {}) { - order { - order_number - } - } -} -QUERY; - - $this->graphQlMutation($query); - } - /** * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php * @magentoConfigFixture default_store carriers/flatrate/active 1 diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/RemoveCouponFromCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/RemoveCouponFromCartTest.php index 12c3918fcd0ac..e94a70cbd929f 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/RemoveCouponFromCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/RemoveCouponFromCartTest.php @@ -61,28 +61,6 @@ public function testRemoveCouponFromCartIfCartIdIsEmpty() $this->graphQlMutation($query); } - /** - * @expectedException Exception - * @expectedExceptionMessage Field RemoveCouponFromCartInput.cart_id of required type String! was not provided. - */ - public function testRemoveCouponFromCartIfCartIdIsMissed() - { - $query = <<<QUERY -mutation { - removeCouponFromCart(input: {}) { - cart { - applied_coupon { - code - } - } - } -} - -QUERY; - - $this->graphQlMutation($query); - } - /** * @expectedException Exception * @expectedExceptionMessage Could not find a cart with ID "non_existent_masked_id" diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/RemoveItemFromCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/RemoveItemFromCartTest.php index c3a66291251c7..6f105259bf65c 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/RemoveItemFromCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/RemoveItemFromCartTest.php @@ -80,49 +80,6 @@ public function testRemoveNonExistentItem() $this->graphQlMutation($query); } - /** - * @param string $input - * @param string $message - * @dataProvider dataProviderUpdateWithMissedRequiredParameters - */ - public function testUpdateWithMissedItemRequiredParameters(string $input, string $message) - { - $query = <<<QUERY -mutation { - removeItemFromCart( - input: { - {$input} - } - ) { - cart { - items { - quantity - } - } - } -} -QUERY; - $this->expectExceptionMessage($message); - $this->graphQlMutation($query); - } - - /** - * @return array - */ - public function dataProviderUpdateWithMissedRequiredParameters(): array - { - return [ - 'missed_cart_id' => [ - 'cart_item_id: 1', - 'Field RemoveItemFromCartInput.cart_id of required type String! was not provided.' - ], - 'missed_cart_item_id' => [ - 'cart_id: "test_quote"', - 'Field RemoveItemFromCartInput.cart_item_id of required type Int! was not provided.' - ], - ]; - } - /** * _security * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetBillingAddressOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetBillingAddressOnCartTest.php index 87335bd5c96dd..ea77ad35d2693 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetBillingAddressOnCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetBillingAddressOnCartTest.php @@ -296,58 +296,6 @@ public function testSetBillingAddressOnNonExistentCart() $this->graphQlMutation($query); } - /** - * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php - * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php - * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php - * - * @dataProvider dataProviderSetWithoutRequiredParameters - * @param string $input - * @param string $message - * @throws \Exception - */ - public function testSetBillingAddressWithoutRequiredParameters(string $input, string $message) - { - $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); - $input = str_replace('cart_id_value', $maskedQuoteId, $input); - - $query = <<<QUERY -mutation { - setBillingAddressOnCart( - input: { - {$input} - } - ) { - cart { - billing_address { - city - } - } - } -} -QUERY; - $this->expectExceptionMessage($message); - $this->graphQlMutation($query); - } - - /** - * @return array - */ - public function dataProviderSetWithoutRequiredParameters(): array - { - return [ - 'missed_billing_address' => [ - 'cart_id: "cart_id_value"', - 'Field SetBillingAddressOnCartInput.billing_address of required type BillingAddressInput!' - . ' was not provided.', - ], - 'missed_cart_id' => [ - 'billing_address: {}', - 'Field SetBillingAddressOnCartInput.cart_id of required type String! was not provided.' - ] - ]; - } - /** * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetPaymentMethodOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetPaymentMethodOnCartTest.php index 24ba3e78f9b4e..c3e35f0bf80e8 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetPaymentMethodOnCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetPaymentMethodOnCartTest.php @@ -183,14 +183,6 @@ public function testSetPaymentMethodWithoutRequiredParameters(string $input, str public function dataProviderSetPaymentMethodWithoutRequiredParameters(): array { return [ - 'missed_cart_id' => [ - 'payment_method: {code: "' . Checkmo::PAYMENT_METHOD_CHECKMO_CODE . '"}', - 'Field SetPaymentMethodOnCartInput.cart_id of required type String! was not provided.' - ], - 'missed_payment_method' => [ - 'cart_id: "cart_id_value"', - 'Field SetPaymentMethodOnCartInput.payment_method of required type PaymentMethodInput! was not provided' - ], 'missed_payment_method_code' => [ 'cart_id: "cart_id_value", payment_method: {code: ""}', 'Required parameter "code" for "payment_method" is missing.' diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetShippingAddressOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetShippingAddressOnCartTest.php index b142de71e89a3..53a20b775530b 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetShippingAddressOnCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetShippingAddressOnCartTest.php @@ -208,40 +208,6 @@ public function testSetShippingAddressToCustomerCart() $this->graphQlMutation($query); } - /** - * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php - * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php - * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php - * - * @dataProvider dataProviderUpdateWithMissedRequiredParameters - * @param string $input - * @param string $message - * @throws \Exception - */ - public function testSetNewShippingAddressWithMissedRequiredParameters(string $input, string $message) - { - $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); - $input = str_replace('cart_id_value', $maskedQuoteId, $input); - - $query = <<<QUERY -mutation { - setShippingAddressesOnCart( - input: { - {$input} - } - ) { - cart { - shipping_addresses { - city - } - } - } -} -QUERY; - $this->expectExceptionMessage($message); - $this->graphQlMutation($query); - } - /** * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php @@ -285,28 +251,6 @@ public function testSetNewShippingAddressOnCartWithRedundantStreetLine() $this->graphQlMutation($query); } - /** - * @return array - */ - public function dataProviderUpdateWithMissedRequiredParameters(): array - { - return [ - 'missed_shipping_addresses' => [ - 'cart_id: "cart_id_value"', - 'Field SetShippingAddressesOnCartInput.shipping_addresses of required type [ShippingAddressInput]! ' . - 'was not provided.', - ], - 'missed_city' => [ - 'shipping_addresses: [ { address: { save_in_address_book: false } } ]', - 'Field CartAddressInput.city of required type String! was not provided' - ], - 'missed_cart_id' => [ - 'shipping_addresses: {}', - 'Field SetShippingAddressesOnCartInput.cart_id of required type String! was not provided.' - ] - ]; - } - /** * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetShippingMethodsOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetShippingMethodsOnCartTest.php index 007ada1ce57cf..0a49136421e9a 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetShippingMethodsOnCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetShippingMethodsOnCartTest.php @@ -186,28 +186,10 @@ public function testSetShippingMethodWithWrongParameters(string $input, string $ public function dataProviderSetShippingMethodWithWrongParameters(): array { return [ - 'missed_cart_id' => [ - 'shipping_methods: [{ - carrier_code: "flatrate" - method_code: "flatrate" - }]', - 'Field SetShippingMethodsOnCartInput.cart_id of required type String! was not provided.' - ], - 'missed_shipping_methods' => [ - 'cart_id: "cart_id_value"', - 'Field SetShippingMethodsOnCartInput.shipping_methods of required type [ShippingMethodInput]!' - . ' was not provided.' - ], 'shipping_methods_are_empty' => [ 'cart_id: "cart_id_value" shipping_methods: []', 'Required parameter "shipping_methods" is missing' ], - 'missed_carrier_code' => [ - 'cart_id: "cart_id_value", shipping_methods: [{ - method_code: "flatrate" - }]', - 'Field ShippingMethodInput.carrier_code of required type String! was not provided.' - ], 'empty_carrier_code' => [ 'cart_id: "cart_id_value", shipping_methods: [{ carrier_code: "" @@ -222,12 +204,6 @@ public function dataProviderSetShippingMethodWithWrongParameters(): array }]', 'Carrier with such method not found: wrong-carrier-code, flatrate' ], - 'missed_method_code' => [ - 'cart_id: "cart_id_value", shipping_methods: [{ - carrier_code: "flatrate" - }]', - 'Field ShippingMethodInput.method_code of required type String! was not provided.' - ], 'empty_method_code' => [ 'cart_id: "cart_id_value", shipping_methods: [{ carrier_code: "flatrate" diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/UpdateCartItemsTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/UpdateCartItemsTest.php index 48d58a0dd8f17..761993d983db8 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/UpdateCartItemsTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/UpdateCartItemsTest.php @@ -181,34 +181,6 @@ public function testUpdateItemFromCustomerCart() $this->graphQlMutation($query); } - /** - * @expectedException \Exception - * @expectedExceptionMessage Field UpdateCartItemsInput.cart_id of required type String! was not provided. - */ - public function testUpdateWithMissedCartItemId() - { - $query = <<<QUERY -mutation { - updateCartItems(input: { - cart_items: [ - { - cart_item_id: 1 - quantity: 2 - } - ] - }) { - cart { - items { - id - quantity - } - } - } -} -QUERY; - $this->graphQlMutation($query); - } - /** * @param string $input * @param string $message @@ -246,14 +218,6 @@ public function testUpdateWithMissedItemRequiredParameters(string $input, string public function dataProviderUpdateWithMissedRequiredParameters(): array { return [ - 'missed_cart_items' => [ - '', - 'Field UpdateCartItemsInput.cart_items of required type [CartItemUpdateInput]! was not provided.' - ], - 'missed_cart_item_id' => [ - 'cart_items: [{ quantity: 2 }]', - 'Field CartItemUpdateInput.cart_item_id of required type Int! was not provided.' - ], 'missed_cart_item_qty' => [ 'cart_items: [{ cart_item_id: 1 }]', 'Required parameter "quantity" for "cart_items" is missing.' From 8fd5c7868a41ae660626cfe077388f02fa0b6a7b Mon Sep 17 00:00:00 2001 From: Vaha <vaha@atwix.com> Date: Wed, 27 Nov 2019 16:15:01 +0200 Subject: [PATCH 0529/1143] magento/graphql-ce#808: [Test coverage] Add disabled variation of Configurable Product to cart --- .../AddConfigurableProductToCartTest.php | 60 ++++++++++++++++++- ...oduct_configurable_disable_first_child.php | 37 ++++++++++++ ...duct_configurable_zero_qty_first_child.php | 28 +++++++++ 3 files changed, 122 insertions(+), 3 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_disable_first_child.php create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child.php diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/AddConfigurableProductToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/AddConfigurableProductToCartTest.php index b1858e843bf0f..f8eab768ca74d 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/AddConfigurableProductToCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/AddConfigurableProductToCartTest.php @@ -199,7 +199,7 @@ public function testAddVariationFromAnotherConfigurableProductWithDifferentSuper /** * @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable_sku.php * @magentoApiDataFixture Magento/Checkout/_files/active_quote.php - * @expectedException \Exception + * @expectedException Exception * @expectedExceptionMessage The requested qty is not available */ public function testAddProductIfQuantityIsNotAvailable() @@ -224,7 +224,7 @@ public function testAddProductIfQuantityIsNotAvailable() /** * @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable_sku.php * @magentoApiDataFixture Magento/Checkout/_files/active_quote.php - * @expectedException \Exception + * @expectedException Exception * @expectedExceptionMessage Could not find a product with SKU "configurable_no_exist" */ public function testAddNonExistentConfigurableProductParentToCart() @@ -263,7 +263,7 @@ public function testAddNonExistentConfigurableProductVariationToCart() 2000 ); - $this->expectException(\Exception::class); + $this->expectException(Exception::class); $this->expectExceptionMessage( 'Could not add the product with SKU configurable to the shopping cart: The product that was requested ' . 'doesn\'t exist. Verify the product and try again.' @@ -272,6 +272,60 @@ public function testAddNonExistentConfigurableProductVariationToCart() $this->graphQlMutation($query); } + /** + * @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable_sku.php + * @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable_disable_first_child.php + * @magentoApiDataFixture Magento/Checkout/_files/active_quote.php + */ + public function testAddDisabledVariationToCart() + { + $searchResponse = $this->graphQlQuery($this->getFetchProductQuery('configurable')); + $product = current($searchResponse['products']['items']); + $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_order_1'); + $parentSku = $product['sku']; + $sku = 'simple_10'; + $query = $this->getQuery( + $maskedQuoteId, + $parentSku, + $sku, + 1 + ); + + $this->expectException(Exception::class); + $this->expectExceptionMessage( + 'Could not add the product with SKU configurable to the shopping cart: This product is out of stock.' + ); + + $this->graphQlMutation($query); + } + + /** + * @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable_sku.php + * @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child.php + * @magentoApiDataFixture Magento/Checkout/_files/active_quote.php + */ + public function testOutOfStockVariationToCart() + { + $searchResponse = $this->graphQlQuery($this->getFetchProductQuery('configurable')); + $product = current($searchResponse['products']['items']); + $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_order_1'); + $parentSku = $product['sku']; + $sku = 'simple_10'; + $query = $this->getQuery( + $maskedQuoteId, + $parentSku, + $sku, + 1 + ); + + $this->expectException(Exception::class); + $this->expectExceptionMessage( + 'Could not add the product with SKU configurable to the shopping cart: This product is out of stock.' + ); + + $this->graphQlMutation($query); + } + /** * @param string $maskedQuoteId * @param string $parentSku diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_disable_first_child.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_disable_first_child.php new file mode 100644 index 0000000000000..257db999417d1 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_disable_first_child.php @@ -0,0 +1,37 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\Data\ProductAttributeInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\Product\Action; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\ConfigurableProduct\Model\Product\Type\Configurable; +use Magento\TestFramework\Helper\Bootstrap; + +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = Bootstrap::getObjectManager()->get(ProductRepositoryInterface::class); + +try { + /** @var Product $configurableProduct */ + $configurableProduct = $productRepository->get('configurable'); + /** @var Configurable $productTypeInstance */ + $productTypeInstance = $configurableProduct->getTypeInstance(); + /** @var Product $child */ + foreach ($productTypeInstance->getUsedProducts($configurableProduct) as $child) { + + $productAction = Bootstrap::getObjectManager()->get(Action::class); + $productAction->updateAttributes( + [$child->getId()], + [ProductAttributeInterface::CODE_STATUS => Status::STATUS_DISABLED], + $child->getStoreId() + ); + break; + } +} catch (Exception $e) { + // Nothing to remove +} diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child.php new file mode 100644 index 0000000000000..77d90e91726a4 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child.php @@ -0,0 +1,28 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product as ProductModel; +use Magento\TestFramework\Helper\Bootstrap; + +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = Bootstrap::getObjectManager()->get(ProductRepositoryInterface::class); + +try { + $configurableProduct = $productRepository->get('configurable'); + $productTypeInstance = $configurableProduct->getTypeInstance(); + + /** @var ProductModel $child */ + foreach ($productTypeInstance->getUsedProducts($configurableProduct) as $child) { + $childProduct = $productRepository->getById($child->getId()); + $childProduct->setStockData(['use_config_manage_stock' => 1, 'qty' => 0, 'is_qty_decimal' => 0, 'is_in_stock' => 0]); + $productRepository->save($childProduct); + break; + } +} catch (Exception $e) { + // Nothing to remove +} From 201f9be15d8bbb9e944b4587aff1c9025fabcea1 Mon Sep 17 00:00:00 2001 From: Vaha <vaha@atwix.com> Date: Thu, 28 Nov 2019 18:34:21 +0200 Subject: [PATCH 0530/1143] magento/graphql-ce#808: [Test coverage] Add disabled variation of Configurable Product to cart, improved fixtures --- .../AddConfigurableProductToCartTest.php | 2 -- ...oduct_configurable_disable_first_child.php | 31 ++++++------------- ...figurable_disable_first_child_roolback.php | 8 +++++ ...duct_configurable_zero_qty_first_child.php | 21 +++---------- ...igurable_zero_qty_first_child_roolback.php | 8 +++++ 5 files changed, 31 insertions(+), 39 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_disable_first_child_roolback.php create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child_roolback.php diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/AddConfigurableProductToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/AddConfigurableProductToCartTest.php index f8eab768ca74d..dac59d1e34077 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/AddConfigurableProductToCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/AddConfigurableProductToCartTest.php @@ -273,7 +273,6 @@ public function testAddNonExistentConfigurableProductVariationToCart() } /** - * @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable_sku.php * @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable_disable_first_child.php * @magentoApiDataFixture Magento/Checkout/_files/active_quote.php */ @@ -300,7 +299,6 @@ public function testAddDisabledVariationToCart() } /** - * @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable_sku.php * @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child.php * @magentoApiDataFixture Magento/Checkout/_files/active_quote.php */ diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_disable_first_child.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_disable_first_child.php index 257db999417d1..e7b644b318fd2 100644 --- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_disable_first_child.php +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_disable_first_child.php @@ -5,33 +5,22 @@ */ declare(strict_types=1); +require __DIR__ . '/product_configurable_sku.php'; + use Magento\Catalog\Api\Data\ProductAttributeInterface; -use Magento\Catalog\Api\ProductRepositoryInterface; -use Magento\Catalog\Model\Product; use Magento\Catalog\Model\Product\Action; use Magento\Catalog\Model\Product\Attribute\Source\Status; -use Magento\ConfigurableProduct\Model\Product\Type\Configurable; use Magento\TestFramework\Helper\Bootstrap; -/** @var ProductRepositoryInterface $productRepository */ -$productRepository = Bootstrap::getObjectManager()->get(ProductRepositoryInterface::class); - +$childSku = 'simple_10'; try { - /** @var Product $configurableProduct */ - $configurableProduct = $productRepository->get('configurable'); - /** @var Configurable $productTypeInstance */ - $productTypeInstance = $configurableProduct->getTypeInstance(); - /** @var Product $child */ - foreach ($productTypeInstance->getUsedProducts($configurableProduct) as $child) { - - $productAction = Bootstrap::getObjectManager()->get(Action::class); - $productAction->updateAttributes( - [$child->getId()], - [ProductAttributeInterface::CODE_STATUS => Status::STATUS_DISABLED], - $child->getStoreId() - ); - break; - } + $childProduct = $productRepository->get($childSku); + $productAction = Bootstrap::getObjectManager()->get(Action::class); + $productAction->updateAttributes( + [$childProduct->getEntityId()], + [ProductAttributeInterface::CODE_STATUS => Status::STATUS_DISABLED], + $childProduct->getStoreId() + ); } catch (Exception $e) { // Nothing to remove } diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_disable_first_child_roolback.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_disable_first_child_roolback.php new file mode 100644 index 0000000000000..7c73fa65cfcd1 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_disable_first_child_roolback.php @@ -0,0 +1,8 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +require __DIR__ . '/product_configurable_sku_rollback.php'; diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child.php index 77d90e91726a4..f813beab19610 100644 --- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child.php +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child.php @@ -5,24 +5,13 @@ */ declare(strict_types=1); -use Magento\Catalog\Api\ProductRepositoryInterface; -use Magento\Catalog\Model\Product as ProductModel; -use Magento\TestFramework\Helper\Bootstrap; - -/** @var ProductRepositoryInterface $productRepository */ -$productRepository = Bootstrap::getObjectManager()->get(ProductRepositoryInterface::class); +require __DIR__ . '/product_configurable_sku.php'; +$childSku = 'simple_10'; try { - $configurableProduct = $productRepository->get('configurable'); - $productTypeInstance = $configurableProduct->getTypeInstance(); - - /** @var ProductModel $child */ - foreach ($productTypeInstance->getUsedProducts($configurableProduct) as $child) { - $childProduct = $productRepository->getById($child->getId()); - $childProduct->setStockData(['use_config_manage_stock' => 1, 'qty' => 0, 'is_qty_decimal' => 0, 'is_in_stock' => 0]); - $productRepository->save($childProduct); - break; - } + $childProduct = $productRepository->get($childSku); + $childProduct->setStockData(['use_config_manage_stock' => 1, 'qty' => 0, 'is_qty_decimal' => 0, 'is_in_stock' => 0]); + $productRepository->save($childProduct); } catch (Exception $e) { // Nothing to remove } diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child_roolback.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child_roolback.php new file mode 100644 index 0000000000000..7c73fa65cfcd1 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child_roolback.php @@ -0,0 +1,8 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +require __DIR__ . '/product_configurable_sku_rollback.php'; From ad9115c5cfc20006e52b7106ab3741ed9272fbd4 Mon Sep 17 00:00:00 2001 From: Vaha <vaha@atwix.com> Date: Thu, 28 Nov 2019 22:41:57 +0200 Subject: [PATCH 0531/1143] magento/graphql-ce#808: [Test coverage] Add disabled variation of Configurable Product to cart, improved fixtures (line limit) --- .../_files/product_configurable_zero_qty_first_child.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child.php index f813beab19610..f8cce222f6605 100644 --- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child.php +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child.php @@ -10,7 +10,12 @@ $childSku = 'simple_10'; try { $childProduct = $productRepository->get($childSku); - $childProduct->setStockData(['use_config_manage_stock' => 1, 'qty' => 0, 'is_qty_decimal' => 0, 'is_in_stock' => 0]); + $childProduct->setStockData([ + 'use_config_manage_stock' => 1, + 'qty' => 0, + 'is_qty_decimal' => 0, + 'is_in_stock' => 0 + ]); $productRepository->save($childProduct); } catch (Exception $e) { // Nothing to remove From 5eae8f1b28a50b6f4ff4019e590df1205a04b1e4 Mon Sep 17 00:00:00 2001 From: Lena Orobei <oorobei@magento.com> Date: Fri, 6 Dec 2019 13:04:23 -0600 Subject: [PATCH 0532/1143] magento/graphql-ce#808: [Test coverage] Add disabled variation of Configurable Product to cart - code style fixes --- .../product_configurable_zero_qty_first_child.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child.php index f8cce222f6605..5dcc461d83759 100644 --- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child.php +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child.php @@ -10,12 +10,14 @@ $childSku = 'simple_10'; try { $childProduct = $productRepository->get($childSku); - $childProduct->setStockData([ - 'use_config_manage_stock' => 1, - 'qty' => 0, - 'is_qty_decimal' => 0, - 'is_in_stock' => 0 - ]); + $childProduct->setStockData( + [ + 'use_config_manage_stock' => 1, + 'qty' => 0, + 'is_qty_decimal' => 0, + 'is_in_stock' => 0 + ] + ); $productRepository->save($childProduct); } catch (Exception $e) { // Nothing to remove From 2d76c5addb9d7b8c772ebc11eaa61e254771d325 Mon Sep 17 00:00:00 2001 From: Lena Orobei <oorobei@magento.com> Date: Fri, 6 Dec 2019 13:21:04 -0600 Subject: [PATCH 0533/1143] magento/graphql-ce#1061: Remove redundant logic from resolvers --- .../Model/AuthorizenetDataProvider.php | 15 ----------- .../Model/BraintreeDataProvider.php | 13 --------- .../Customer/SetPaymentMethodTest.php | 27 ------------------- .../Braintree/Guest/SetPaymentMethodTest.php | 25 ----------------- 4 files changed, 80 deletions(-) diff --git a/app/code/Magento/AuthorizenetGraphQl/Model/AuthorizenetDataProvider.php b/app/code/Magento/AuthorizenetGraphQl/Model/AuthorizenetDataProvider.php index ffbacbf6ac88c..27d0693884121 100644 --- a/app/code/Magento/AuthorizenetGraphQl/Model/AuthorizenetDataProvider.php +++ b/app/code/Magento/AuthorizenetGraphQl/Model/AuthorizenetDataProvider.php @@ -49,21 +49,6 @@ public function getData(array $data): array __('Required parameter "authorizenet_acceptjs" for "payment_method" is missing.') ); } - if (!isset($data[self::PATH_ADDITIONAL_DATA]['opaque_data_descriptor'])) { - throw new GraphQlInputException( - __('Required parameter "opaque_data_descriptor" for "authorizenet_acceptjs" is missing.') - ); - } - if (!isset($data[self::PATH_ADDITIONAL_DATA]['opaque_data_value'])) { - throw new GraphQlInputException( - __('Required parameter "opaque_data_value" for "authorizenet_acceptjs" is missing.') - ); - } - if (!isset($data[self::PATH_ADDITIONAL_DATA]['cc_last_4'])) { - throw new GraphQlInputException( - __('Required parameter "cc_last_4" for "authorizenet_acceptjs" is missing.') - ); - } $additionalData = $this->arrayManager->get(static::PATH_ADDITIONAL_DATA, $data); foreach ($additionalData as $key => $value) { diff --git a/app/code/Magento/BraintreeGraphQl/Model/BraintreeDataProvider.php b/app/code/Magento/BraintreeGraphQl/Model/BraintreeDataProvider.php index 23ca1d88e3625..cb5c4a31837b4 100644 --- a/app/code/Magento/BraintreeGraphQl/Model/BraintreeDataProvider.php +++ b/app/code/Magento/BraintreeGraphQl/Model/BraintreeDataProvider.php @@ -31,19 +31,6 @@ public function getData(array $args): array __('Required parameter "braintree" for "payment_method" is missing.') ); } - - if (!isset($args[self::PATH_ADDITIONAL_DATA]['payment_method_nonce'])) { - throw new GraphQlInputException( - __('Required parameter "payment_method_nonce" for "braintree" is missing.') - ); - } - - if (!isset($args[self::PATH_ADDITIONAL_DATA]['is_active_payment_token_enabler'])) { - throw new GraphQlInputException( - __('Required parameter "is_active_payment_token_enabler" for "braintree" is missing.') - ); - } - return $args[self::PATH_ADDITIONAL_DATA]; } } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Braintree/Customer/SetPaymentMethodTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Braintree/Customer/SetPaymentMethodTest.php index fbaa3a98613cf..a36a4f5d38223 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Braintree/Customer/SetPaymentMethodTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Braintree/Customer/SetPaymentMethodTest.php @@ -380,33 +380,6 @@ private function getSetPaymentBraintreeQueryInvalidInput(string $maskedQuoteId, QUERY; } - /** - * @param string $maskedQuoteId - * @return string - */ - private function getSetPaymentBraintreeQueryInvalidPaymentMethodInput(string $maskedQuoteId): string - { - return <<<QUERY -mutation { - setPaymentMethodOnCart(input:{ - cart_id:"{$maskedQuoteId}" - payment_method:{ - code:"braintree" - braintree:{ - payment_method_nonce:"fake-valid-nonce" - } - } - }) { - cart { - selected_payment_method { - code - } - } - } -} -QUERY; - } - /** * @param string $maskedQuoteId * @param string $methodCode diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Braintree/Guest/SetPaymentMethodTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Braintree/Guest/SetPaymentMethodTest.php index b000d6e7ff347..5376634c05146 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Braintree/Guest/SetPaymentMethodTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Braintree/Guest/SetPaymentMethodTest.php @@ -198,31 +198,6 @@ private function getSetPaymentBraintreeQueryInvalidInput(string $maskedQuoteId): QUERY; } - /** - * @param string $maskedQuoteId - * @return string - */ - private function getSetPaymentBraintreeQueryInvalidMethodInput(string $maskedQuoteId): string - { - return <<<QUERY -mutation { - setPaymentMethodOnCart(input:{ - cart_id:"{$maskedQuoteId}" - payment_method:{ - code:"braintree" - braintree: {} - } - }) { - cart { - selected_payment_method { - code - } - } - } -} -QUERY; - } - /** * @param string $maskedQuoteId * @return string From b254712a9d550d56a151aa11d91f9145811af1e3 Mon Sep 17 00:00:00 2001 From: Lena Orobei <oorobei@magento.com> Date: Fri, 6 Dec 2019 14:45:30 -0600 Subject: [PATCH 0534/1143] magento/graphql-ce#808: [Test coverage] Add disabled variation of Configurable Product to cart --- ...oduct_configurable_disable_first_child.php | 19 ++++++-------- ...igurable_disable_first_child_rollback.php} | 0 ...duct_configurable_zero_qty_first_child.php | 25 ++++++++----------- ...gurable_zero_qty_first_child_rollback.php} | 0 4 files changed, 19 insertions(+), 25 deletions(-) rename dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/{product_configurable_disable_first_child_roolback.php => product_configurable_disable_first_child_rollback.php} (100%) rename dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/{product_configurable_zero_qty_first_child_roolback.php => product_configurable_zero_qty_first_child_rollback.php} (100%) diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_disable_first_child.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_disable_first_child.php index e7b644b318fd2..51d192f76c807 100644 --- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_disable_first_child.php +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_disable_first_child.php @@ -13,14 +13,11 @@ use Magento\TestFramework\Helper\Bootstrap; $childSku = 'simple_10'; -try { - $childProduct = $productRepository->get($childSku); - $productAction = Bootstrap::getObjectManager()->get(Action::class); - $productAction->updateAttributes( - [$childProduct->getEntityId()], - [ProductAttributeInterface::CODE_STATUS => Status::STATUS_DISABLED], - $childProduct->getStoreId() - ); -} catch (Exception $e) { - // Nothing to remove -} + +$childProduct = $productRepository->get($childSku); +$productAction = Bootstrap::getObjectManager()->get(Action::class); +$productAction->updateAttributes( + [$childProduct->getEntityId()], + [ProductAttributeInterface::CODE_STATUS => Status::STATUS_DISABLED], + $childProduct->getStoreId() +); diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_disable_first_child_roolback.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_disable_first_child_rollback.php similarity index 100% rename from dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_disable_first_child_roolback.php rename to dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_disable_first_child_rollback.php diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child.php index 5dcc461d83759..b923ae6399cc3 100644 --- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child.php +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child.php @@ -8,17 +8,14 @@ require __DIR__ . '/product_configurable_sku.php'; $childSku = 'simple_10'; -try { - $childProduct = $productRepository->get($childSku); - $childProduct->setStockData( - [ - 'use_config_manage_stock' => 1, - 'qty' => 0, - 'is_qty_decimal' => 0, - 'is_in_stock' => 0 - ] - ); - $productRepository->save($childProduct); -} catch (Exception $e) { - // Nothing to remove -} + +$childProduct = $productRepository->get($childSku); +$childProduct->setStockData( + [ + 'use_config_manage_stock' => 1, + 'qty' => 0, + 'is_qty_decimal' => 0, + 'is_in_stock' => 0 + ] +); +$productRepository->save($childProduct); diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child_roolback.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child_rollback.php similarity index 100% rename from dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child_roolback.php rename to dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child_rollback.php From ee228afd4c469d590332dc6f79130fab88ab6857 Mon Sep 17 00:00:00 2001 From: Lena Orobei <oorobei@magento.com> Date: Mon, 9 Dec 2019 13:17:12 -0600 Subject: [PATCH 0535/1143] magento/graphql-ce#808: [Test coverage] Add disabled variation of Configurable Product to cart --- .../ConfigurableProduct/AddConfigurableProductToCartTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/AddConfigurableProductToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/AddConfigurableProductToCartTest.php index dac59d1e34077..8e6400a9a3b93 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/AddConfigurableProductToCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/AddConfigurableProductToCartTest.php @@ -292,7 +292,7 @@ public function testAddDisabledVariationToCart() $this->expectException(Exception::class); $this->expectExceptionMessage( - 'Could not add the product with SKU configurable to the shopping cart: This product is out of stock.' + 'Could not add the product with SKU configurable to the shopping cart' ); $this->graphQlMutation($query); @@ -318,7 +318,7 @@ public function testOutOfStockVariationToCart() $this->expectException(Exception::class); $this->expectExceptionMessage( - 'Could not add the product with SKU configurable to the shopping cart: This product is out of stock.' + 'Could not add the product with SKU configurable to the shopping cart' ); $this->graphQlMutation($query); From 746f813e50ccf2e795499e6fce9f5ee617e172c8 Mon Sep 17 00:00:00 2001 From: Sathish <srsathish92@gmail.com> Date: Fri, 20 Dec 2019 00:41:06 +0530 Subject: [PATCH 0536/1143] Feedback updated with object manager helper & stub --- .../Test/Unit/Block/Cart/ShippingTest.php | 72 +++++++++++-------- 1 file changed, 42 insertions(+), 30 deletions(-) diff --git a/app/code/Magento/Checkout/Test/Unit/Block/Cart/ShippingTest.php b/app/code/Magento/Checkout/Test/Unit/Block/Cart/ShippingTest.php index 1e2dd08cb20ae..5ab4615c52828 100644 --- a/app/code/Magento/Checkout/Test/Unit/Block/Cart/ShippingTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Block/Cart/ShippingTest.php @@ -14,16 +14,34 @@ use Magento\Framework\Serialize\Serializer\Json; use Magento\Framework\Serialize\Serializer\JsonHexTag; use Magento\Framework\View\Element\Template\Context; -use Magento\Customer\Model\Session as customerSession; -use Magento\Checkout\Model\Session as checkoutSession; +use Magento\Customer\Model\Session as CustomerSession; +use Magento\Checkout\Model\Session as CheckoutSession; use Magento\Store\Model\StoreManagerInterface; +use Magento\Store\Model\Store; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; /** * Unit Test for Magento\Checkout\Block\Cart\Shipping */ -class ShippingTest extends \PHPUnit\Framework\TestCase +class ShippingTest extends TestCase { + + /** + * Stub Preinitialized Componets + */ + private const STUB_PREINITIALIZED_COMPONENTS = [ + 'components' => [ + 'firstComponent' => ['param' => 'value'] + ] + ]; + + /** + * Stub Base URL + */ + private const STUB_BASE_URL = 'baseurl'; + /** * @var Shipping */ @@ -35,12 +53,12 @@ class ShippingTest extends \PHPUnit\Framework\TestCase protected $contextMock; /** - * @var customerSession|MockObject + * @var CustomerSession|MockObject */ protected $customerSessionMock; /** - * @var checkoutSession|MockObject + * @var CheckoutSession|MockObject */ protected $checkoutSessionMock; @@ -57,7 +75,7 @@ class ShippingTest extends \PHPUnit\Framework\TestCase /** * @var StoreManagerInterface|MockObject */ - protected $storeManagerMock; + protected $storeManagerInterfaceMock; /** * @var array @@ -80,32 +98,26 @@ class ShippingTest extends \PHPUnit\Framework\TestCase protected function setUp(): void { $this->contextMock = $this->createMock(Context::class); - $this->customerSessionMock = $this->createMock(customerSession::class); - $this->checkoutSessionMock = $this->createMock(checkoutSession::class); + $this->customerSessionMock = $this->createMock(CustomerSession::class); + $this->checkoutSessionMock = $this->createMock(CheckoutSession::class); $this->configProviderMock = $this->createMock(CompositeConfigProvider::class); $this->layoutProcessorMock = $this->createMock(LayoutProcessorInterface::class); $this->serializerMock = $this->createMock(JsonHexTag::class); $this->jsonHexTagSerializerMock = $this->createMock(JsonHexTag::class); - $this->storeManagerMock = $this->createMock(StoreManagerInterface::class); - $this->layout = [ - 'components' => [ - 'firstComponent' => ['param' => 'value'] - ] - ]; + $this->storeManagerInterfaceMock = $this->createMock(StoreManagerInterface::class); + $this->layout = self::STUB_PREINITIALIZED_COMPONENTS; - $this->contextMock->expects($this->once()) - ->method('getStoreManager') - ->willReturn($this->storeManagerMock); - - $this->block = new Shipping( - $this->contextMock, - $this->customerSessionMock, - $this->checkoutSessionMock, - $this->configProviderMock, - [$this->layoutProcessorMock], - ['jsLayout' => $this->layout], - $this->serializerMock, - $this->jsonHexTagSerializerMock + $objectManager = new ObjectManager($this); + $this->block = $objectManager->getObject( + Shipping::class, + [ + 'configProvider' => $this->configProviderMock, + 'layoutProcessors' => [$this->layoutProcessorMock], + 'jsLayout' => $this->layout, + 'serializer' => $this->serializerMock, + 'jsonHexTagSerializer' => $this->jsonHexTagSerializerMock, + 'storeManager' => $this->storeManagerInterfaceMock + ] ); } @@ -168,13 +180,13 @@ public function getJsLayoutDataProvider(): array */ public function testGetBaseUrl(): void { - $baseUrl = 'baseUrl'; - $storeMock = $this->createPartialMock(\Magento\Store\Model\Store::class, ['getBaseUrl']); + $baseUrl = self::STUB_BASE_URL; + $storeMock = $this->createPartialMock(Store::class, ['getBaseUrl']); $storeMock->expects($this->once()) ->method('getBaseUrl') ->willReturn($baseUrl); - $this->storeManagerMock->expects($this->once()) + $this->storeManagerInterfaceMock->expects($this->once()) ->method('getStore') ->willReturn($storeMock); From 1e1cbf5dc979b951e1de87fdef29ea6666864619 Mon Sep 17 00:00:00 2001 From: Sathish <srsathish92@gmail.com> Date: Fri, 20 Dec 2019 01:00:07 +0530 Subject: [PATCH 0537/1143] PascalCase updated --- app/code/Magento/Checkout/Block/Cart/Shipping.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Checkout/Block/Cart/Shipping.php b/app/code/Magento/Checkout/Block/Cart/Shipping.php index 870cc8dace120..712ee84afd232 100644 --- a/app/code/Magento/Checkout/Block/Cart/Shipping.php +++ b/app/code/Magento/Checkout/Block/Cart/Shipping.php @@ -11,8 +11,8 @@ use Magento\Framework\Serialize\Serializer\Json; use Magento\Framework\Serialize\Serializer\JsonHexTag; use Magento\Framework\View\Element\Template\Context; -use Magento\Customer\Model\Session as customerSession; -use Magento\Checkout\Model\Session as checkoutSession; +use Magento\Customer\Model\Session as CustomerSession; +use Magento\Checkout\Model\Session as CheckoutSession; use Magento\Framework\App\ObjectManager; /** @@ -45,8 +45,8 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart /** * @param Context $context - * @param customerSession $customerSession - * @param checkoutSession $checkoutSession + * @param CustomerSession $customerSession + * @param CheckoutSession $checkoutSession * @param CompositeConfigProvider $configProvider * @param array $layoutProcessors * @param array $data @@ -56,8 +56,8 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart */ public function __construct( Context $context, - customerSession $customerSession, - checkoutSession $checkoutSession, + CustomerSession $customerSession, + CheckoutSession $checkoutSession, CompositeConfigProvider $configProvider, array $layoutProcessors = [], array $data = [], From ebbe8131927704cbd27a381e1d160896a014786c Mon Sep 17 00:00:00 2001 From: Lena Orobei <oorobei@magento.com> Date: Thu, 19 Dec 2019 14:38:42 -0600 Subject: [PATCH 0538/1143] Forward-port magento/graphql-ce#443 and magento/graphql-ce#1073 --- .../Model/Customer/ValidateCustomerData.php | 22 +- .../DataProvider/SwatchDataProvider.php | 250 ++++++++++++++++++ .../Resolver/Product/Options/SwatchData.php | 56 ++++ .../Options/SwatchDataTypeResolver.php | 34 +++ .../SwatchesGraphQl/etc/graphql/di.xml | 2 +- .../SwatchesGraphQl/etc/schema.graphqls | 20 ++ .../GraphQl/Customer/CreateCustomerTest.php | 43 ++- .../Swatches/ProductSwatchDataTest.php | 166 ++++++++++++ .../_files/text_swatch_attribute_rollback.php | 23 ++ .../_files/textual_swatch_attribute.php | 103 ++++++++ ..._attribute_with_different_options_type.php | 116 ++++++++ ...e_with_different_options_type_rollback.php | 34 +++ ..._with_enabled_product_image_for_swatch.php | 35 +++ ...bled_product_image_for_swatch_rollback.php | 11 + 14 files changed, 900 insertions(+), 15 deletions(-) create mode 100644 app/code/Magento/SwatchesGraphQl/Model/Resolver/Product/Options/DataProvider/SwatchDataProvider.php create mode 100644 app/code/Magento/SwatchesGraphQl/Model/Resolver/Product/Options/SwatchData.php create mode 100644 app/code/Magento/SwatchesGraphQl/Model/Resolver/Product/Options/SwatchDataTypeResolver.php create mode 100644 dev/tests/api-functional/testsuite/Magento/GraphQl/Swatches/ProductSwatchDataTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Swatches/_files/text_swatch_attribute_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/Swatches/_files/textual_swatch_attribute.php create mode 100644 dev/tests/integration/testsuite/Magento/Swatches/_files/visual_swatch_attribute_with_different_options_type.php create mode 100644 dev/tests/integration/testsuite/Magento/Swatches/_files/visual_swatch_attribute_with_different_options_type_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/Swatches/_files/visual_swatch_attribute_with_enabled_product_image_for_swatch.php create mode 100644 dev/tests/integration/testsuite/Magento/Swatches/_files/visual_swatch_attribute_with_enabled_product_image_for_swatch_rollback.php diff --git a/app/code/Magento/CustomerGraphQl/Model/Customer/ValidateCustomerData.php b/app/code/Magento/CustomerGraphQl/Model/Customer/ValidateCustomerData.php index 794cb0048592d..3861ce324ea7d 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Customer/ValidateCustomerData.php +++ b/app/code/Magento/CustomerGraphQl/Model/Customer/ValidateCustomerData.php @@ -8,9 +8,10 @@ namespace Magento\CustomerGraphQl\Model\Customer; use Magento\Framework\GraphQl\Exception\GraphQlInputException; +use Magento\Framework\Validator\EmailAddress as EmailAddressValidator; /** - * Class ValidateCustomerData + * Customer data validation used during customer account creation and updating */ class ValidateCustomerData { @@ -21,14 +22,23 @@ class ValidateCustomerData */ private $getAllowedCustomerAttributes; + /** + * @var EmailAddressValidator + */ + private $emailAddressValidator; + /** * ValidateCustomerData constructor. * * @param GetAllowedCustomerAttributes $getAllowedCustomerAttributes + * @param EmailAddressValidator $emailAddressValidator */ - public function __construct(GetAllowedCustomerAttributes $getAllowedCustomerAttributes) - { + public function __construct( + GetAllowedCustomerAttributes $getAllowedCustomerAttributes, + EmailAddressValidator $emailAddressValidator + ) { $this->getAllowedCustomerAttributes = $getAllowedCustomerAttributes; + $this->emailAddressValidator = $emailAddressValidator; } /** @@ -59,5 +69,11 @@ public function execute(array $customerData): void __('Required parameters are missing: %1', [implode(', ', $errorInput)]) ); } + + if (isset($customerData['email']) && !$this->emailAddressValidator->isValid($customerData['email'])) { + throw new GraphQlInputException( + __('"%1" is not a valid email address.', $customerData['email']) + ); + } } } diff --git a/app/code/Magento/SwatchesGraphQl/Model/Resolver/Product/Options/DataProvider/SwatchDataProvider.php b/app/code/Magento/SwatchesGraphQl/Model/Resolver/Product/Options/DataProvider/SwatchDataProvider.php new file mode 100644 index 0000000000000..9e62ae928fb53 --- /dev/null +++ b/app/code/Magento/SwatchesGraphQl/Model/Resolver/Product/Options/DataProvider/SwatchDataProvider.php @@ -0,0 +1,250 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\SwatchesGraphQl\Model\Resolver\Product\Options\DataProvider; + +use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Catalog\Model\Product\Image\UrlBuilder; +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Exception\RuntimeException; +use Magento\Framework\GraphQl\Query\EnumLookup; +use Magento\Swatches\Helper\Data as SwatchData; +use Magento\Swatches\Helper\Media as SwatchesMedia; +use Magento\Swatches\Model\Swatch; + +/** + * Swatch data provider + */ +class SwatchDataProvider +{ + /** + * @var SwatchData + */ + private $swatchHelper; + + /** + * @var SwatchesMedia + */ + private $swatchMediaHelper; + + /** + * @var UrlBuilder + */ + private $imageUrlBuilder; + + /** + * @var EnumLookup + */ + private $enumLookup; + + /** + * SwatchDataProvider constructor. + * + * @param SwatchData $swatchHelper + * @param SwatchesMedia $swatchMediaHelper + * @param UrlBuilder $imageUrlBuilder + * @param EnumLookup $enumLookup + */ + public function __construct( + SwatchData $swatchHelper, + SwatchesMedia $swatchMediaHelper, + UrlBuilder $imageUrlBuilder, + EnumLookup $enumLookup + ) { + $this->swatchHelper = $swatchHelper; + $this->swatchMediaHelper = $swatchMediaHelper; + $this->imageUrlBuilder = $imageUrlBuilder; + $this->enumLookup = $enumLookup; + } + + /** + * Get swatch data + * + * @param string $optionId + * @param ProductInterface $product + * + * @return array + * + * @throws LocalizedException + * @throws NoSuchEntityException + * @throws \LogicException + */ + public function getData(string $optionId, ProductInterface $product): array + { + $swatches = $this->swatchHelper->getSwatchesByOptionsId([$optionId]); + if (!isset($swatches[$optionId], $swatches[$optionId]['type'], $swatches[$optionId]['value'])) { + return null; + } + + $type = (int)$swatches[$optionId]['type']; + $value = $swatches[$optionId]['value']; + $thumbnail = null; + + // change value & thumbnail if type is 'visual' + if ($type === Swatch::SWATCH_TYPE_VISUAL_IMAGE) { + $thumbnail = $this->swatchMediaHelper->getSwatchAttributeImage(Swatch::SWATCH_THUMBNAIL_NAME, $value); + $value = $this->swatchMediaHelper->getSwatchAttributeImage(Swatch::SWATCH_IMAGE_NAME, $value); + } + + $attributeData = $this->getSwatchAttributeDataByOptionId($product, $optionId); + // check if swatch value should be getting from related product image + if (!$this->isUseProductImageForSwatch($attributeData)) { + return $this->getResultArray($value, $type, $thumbnail); + } + + // get product with existing image + $variationProduct = $this->getVariationProduct($attributeData, $optionId, $product); + if (null === $variationProduct) { + return $this->getResultArray($value, $type, $thumbnail); + } + + // set 'visual' type, because the product image is using as swatch value + $type = Swatch::SWATCH_TYPE_VISUAL_IMAGE; + + // get image from child product + $productImage = $this->getSwatchProductImage($variationProduct, Swatch::SWATCH_IMAGE_NAME); + if (null !== $productImage) { + $value = $productImage; + } + + // get thumbnail from child product + $productThumbnail = $this->getSwatchProductImage($variationProduct, Swatch::SWATCH_THUMBNAIL_NAME); + if (null !== $productThumbnail) { + $thumbnail = $productThumbnail; + } + + return $this->getResultArray($value, $type, $thumbnail); + } + + /** + * Get result array + * + * @param string $value + * @param int $type + * @param null|string $thumbnail + * + * @return array + * + * @throws RuntimeException + */ + private function getResultArray(string $value, int $type, ?string $thumbnail) + { + return [ + 'value' => $value, + 'type' => $this->enumLookup->getEnumValueFromField('SwatchTypeEnum', (string)$type), + 'thumbnail' => $thumbnail + ]; + } + + /** + * Is swatch images should be getting from related simple products + * + * @param array $attributeData + * + * @return bool + */ + private function isUseProductImageForSwatch(array $attributeData) : bool + { + return isset($attributeData['use_product_image_for_swatch']) && $attributeData['use_product_image_for_swatch']; + } + + /** + * Get simple product with first variation swatch image or image + * + * @param array $attributeData + * @param string $optionId + * @param ProductInterface $product + * + * @return ProductInterface|null + */ + private function getVariationProduct(array $attributeData, string $optionId, ProductInterface $product) : ?ProductInterface + { + $attributeCode = $attributeData['attribute_code']; + $requiredAttributes = [ + $attributeCode => $optionId + ]; + + $variationProduct = $this->swatchHelper->loadFirstVariationWithSwatchImage($product, $requiredAttributes); + if ($variationProduct instanceof ProductInterface) { + return $variationProduct; + } + + $variationProduct = $this->swatchHelper->loadFirstVariationWithImage($product, $requiredAttributes); + if ($variationProduct instanceof ProductInterface) { + return $variationProduct; + } + + return null; + } + + /** + * Get swatch product image + * + * @param ProductInterface $product + * @param string $imageType + * + * @return string|null + */ + private function getSwatchProductImage(ProductInterface $product, $imageType) : ?string + { + if ($this->isProductHasImage($product, Swatch::SWATCH_IMAGE_NAME)) { + $swatchImageId = $imageType; + $imageAttributes = ['type' => Swatch::SWATCH_IMAGE_NAME]; + } elseif ($this->isProductHasImage($product, 'image')) { + $swatchImageId = $imageType == Swatch::SWATCH_IMAGE_NAME ? 'swatch_image_base' : 'swatch_thumb_base'; + $imageAttributes = ['type' => 'image']; + } + + if (empty($swatchImageId) || empty($imageAttributes['type'])) { + return null; + } + + return $this->imageUrlBuilder->getUrl($product->getData($imageAttributes['type']), $swatchImageId); + } + + /** + * Is product has image + * + * @param ProductInterface $product + * @param string $imageType + * + * @return bool + */ + private function isProductHasImage(ProductInterface $product, string $imageType) : bool + { + return $product->getData($imageType) !== null && $product->getData($imageType) != SwatchData::EMPTY_IMAGE_VALUE; + } + + /** + * Get swatch attribute data by option id + * + * @param ProductInterface $product + * @param string $optionId + * + * @return array + * + * @throws LocalizedException + * @throws \LogicException + * @throws NoSuchEntityException + */ + private function getSwatchAttributeDataByOptionId(ProductInterface $product, string $optionId) : array + { + $attributesData = $this->swatchHelper->getSwatchAttributesAsArray($product); + foreach ($attributesData as $attributeData) { + if (!isset($attributeData['options']) || !is_array($attributeData['options'])) { + continue; + } + + if (array_key_exists($optionId, $attributeData['options'])) { + return $attributeData; + } + } + + throw new LocalizedException(__(sprintf('Cannot find the attribute with option id "%1".', $optionId))); + } +} diff --git a/app/code/Magento/SwatchesGraphQl/Model/Resolver/Product/Options/SwatchData.php b/app/code/Magento/SwatchesGraphQl/Model/Resolver/Product/Options/SwatchData.php new file mode 100644 index 0000000000000..9fea3b3ff59e5 --- /dev/null +++ b/app/code/Magento/SwatchesGraphQl/Model/Resolver/Product/Options/SwatchData.php @@ -0,0 +1,56 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\SwatchesGraphQl\Model\Resolver\Product\Options; + +use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\GraphQl\Config\Element\Field; +use Magento\Framework\GraphQl\Query\ResolverInterface; +use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; +use Magento\SwatchesGraphQl\Model\Resolver\Product\Options\DataProvider\SwatchDataProvider; + +/** + * Class SwatchData + * + * Product swatch data resolver, used for GraphQL request processing + */ +class SwatchData implements ResolverInterface +{ + /** + * @var SwatchDataProvider + */ + private $swatchDataProvider; + + /** + * SwatchData constructor. + * + * @param SwatchDataProvider $swatchDataProvider + */ + public function __construct( + SwatchDataProvider $swatchDataProvider + ) { + $this->swatchDataProvider = $swatchDataProvider; + } + + /** + * @inheritdoc + */ + public function resolve( + Field $field, + $context, + ResolveInfo $info, + array $value = null, + array $args = null + ) { + if (!array_key_exists('model', $value) || !$value['model'] instanceof ProductInterface) { + throw new LocalizedException(__('"model" value should be specified')); + } + + return $this->swatchDataProvider->getData($value['value_index'], $value['model']); + } +} diff --git a/app/code/Magento/SwatchesGraphQl/Model/Resolver/Product/Options/SwatchDataTypeResolver.php b/app/code/Magento/SwatchesGraphQl/Model/Resolver/Product/Options/SwatchDataTypeResolver.php new file mode 100644 index 0000000000000..96f584524fd27 --- /dev/null +++ b/app/code/Magento/SwatchesGraphQl/Model/Resolver/Product/Options/SwatchDataTypeResolver.php @@ -0,0 +1,34 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\SwatchesGraphQl\Model\Resolver\Product\Options; + +use Magento\Framework\GraphQl\Query\Resolver\TypeResolverInterface; +use Magento\Swatches\Model\Swatch; + +/** + * Resolver for swatch data interface. + */ +class SwatchDataTypeResolver implements TypeResolverInterface +{ + /** + * {@inheritdoc} + */ + public function resolveType(array $data): string + { + switch ($data['type']) { + case Swatch::SWATCH_TYPE_TEXTUAL: + return 'TextSwatchData'; + case Swatch::SWATCH_TYPE_VISUAL_COLOR; + return 'ColorSwatchData'; + case Swatch::SWATCH_TYPE_VISUAL_IMAGE; + return 'ImageSwatchData'; + default: + return ''; + } + } +} diff --git a/app/code/Magento/SwatchesGraphQl/etc/graphql/di.xml b/app/code/Magento/SwatchesGraphQl/etc/graphql/di.xml index 34f65d8e30e57..07391aead332b 100644 --- a/app/code/Magento/SwatchesGraphQl/etc/graphql/di.xml +++ b/app/code/Magento/SwatchesGraphQl/etc/graphql/di.xml @@ -16,4 +16,4 @@ </argument> </arguments> </type> -</config> \ No newline at end of file +</config> diff --git a/app/code/Magento/SwatchesGraphQl/etc/schema.graphqls b/app/code/Magento/SwatchesGraphQl/etc/schema.graphqls index bdd2631e7aa10..f986723a24545 100644 --- a/app/code/Magento/SwatchesGraphQl/etc/schema.graphqls +++ b/app/code/Magento/SwatchesGraphQl/etc/schema.graphqls @@ -26,4 +26,24 @@ type SwatchLayerFilterItem implements LayerFilterItemInterface, SwatchLayerFilte type SwatchData { type: String @doc(description: "Type of swatch filter item: 1 - text, 2 - image") value: String @doc(description: "Value for swatch item (text or image link)") +} + +type ConfigurableProductOptionsValues { + swatch_data: SwatchDataInterface @doc(description: "Swatch data for configurable product option") @resolver(class: "Magento\\SwatchesGraphQl\\Model\\Resolver\\Product\\Options\\SwatchData") +} + +interface SwatchDataInterface @typeResolver(class: "Magento\\SwatchesGraphQl\\Model\\Resolver\\Product\\Options\\SwatchDataTypeResolver") { + value: String @doc(description: "Value of swatch item (HEX color code, image link or textual value)") +} + +type ImageSwatchData implements SwatchDataInterface { + thumbnail: String @doc(description: "Thumbnail swatch image URL") +} + +type TextSwatchData implements SwatchDataInterface { + +} + +type ColorSwatchData implements SwatchDataInterface { + } \ No newline at end of file diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerTest.php index a6455a9728fec..3da51088f0af6 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerTest.php @@ -172,24 +172,25 @@ public function testCreateCustomerIfEmailMissed() } /** - * @expectedException \Exception - * @expectedExceptionMessage "Email" is not a valid email address. + * @dataProvider invalidEmailAddressDataProvider + * + * @param string $email + * @throws \Exception */ - public function testCreateCustomerIfEmailIsNotValid() + public function testCreateCustomerIfEmailIsNotValid(string $email) { - $newFirstname = 'Richard'; - $newLastname = 'Rowe'; - $currentPassword = 'test123#'; - $newEmail = 'email'; + $firstname = 'Richard'; + $lastname = 'Rowe'; + $password = 'test123#'; $query = <<<QUERY mutation { createCustomer( input: { - firstname: "{$newFirstname}" - lastname: "{$newLastname}" - email: "{$newEmail}" - password: "{$currentPassword}" + firstname: "{$firstname}" + lastname: "{$lastname}" + email: "{$email}" + password: "{$password}" is_subscribed: true } ) { @@ -203,9 +204,29 @@ public function testCreateCustomerIfEmailIsNotValid() } } QUERY; + $this->expectExceptionMessage('"' . $email . '" is not a valid email address.'); $this->graphQlMutation($query); } + /** + * @return array + */ + public function invalidEmailAddressDataProvider(): array + { + return [ + ['plainaddress'], + ['jØrgen@somedomain.com'], + ['#@%^%#$@#$@#.com'], + ['@example.com'], + ['Joe Smith <email@example.com>'], + ['email.example.com'], + ['email@example@example.com'], + ['email@example.com (Joe Smith)'], + ['email@example'], + ['“email”@example.com'], + ]; + } + /** * @expectedException \Exception * @expectedExceptionMessage Field "test123" is not defined by type CustomerInput. diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Swatches/ProductSwatchDataTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Swatches/ProductSwatchDataTest.php new file mode 100644 index 0000000000000..ab4e001e9d633 --- /dev/null +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Swatches/ProductSwatchDataTest.php @@ -0,0 +1,166 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\GraphQl\Swatches; + +use Magento\Catalog\Model\Product\Image\UrlBuilder; +use Magento\Swatches\Helper\Media as SwatchesMedia; +use Magento\Swatches\Model\Swatch; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\TestCase\GraphQlAbstract; + +/** + * Class ProductSwatchDataTest + */ +class ProductSwatchDataTest extends GraphQlAbstract +{ + /** + * @var SwatchesMedia + */ + private $swatchMediaHelper; + + /** + * @var UrlBuilder + */ + private $imageUrlBuilder; + + /** + * @inheritdoc + */ + protected function setUp() + { + $objectManager = Bootstrap::getObjectManager(); + $this->swatchMediaHelper = $objectManager->get(SwatchesMedia::class); + $this->imageUrlBuilder = $objectManager->get(UrlBuilder::class); + } + + /** + * @param string $productSku + * + * @return mixed + * @throws \PHPUnit\Framework\Exception + */ + private function getSwatchDataValues($productSku = 'configurable') + { + $query = <<<QUERY +{ + products(filter: {sku: {eq: "{$productSku}"}}) { + items { + ... on ConfigurableProduct{ + configurable_options{ + values { + swatch_data{ + type + value + thumbnail + } + } + } + } + } + } +} +QUERY; + $response = $this->graphQlQuery($query); + + $this->assertArrayHasKey('products', $response); + $this->assertArrayHasKey('items', $response['products']); + $this->assertArrayHasKey(0, $response['products']['items']); + + $product = $response['products']['items'][0]; + $this->assertArrayHasKey('configurable_options', $product); + $this->assertArrayHasKey(0, $product['configurable_options']); + + $option = $product['configurable_options'][0]; + $this->assertArrayHasKey('values', $option); + + return $option['values']; + } + + /** + * @magentoApiDataFixture Magento/Swatches/_files/visual_swatch_attribute_with_enabled_product_image_for_swatch.php + */ + public function testGetSwatchDataForVisualOptionsWithProductImage() + { + $productSku = 'configurable_12345'; + $productImage = '/m/a/magento_image.jpg'; + $swatchImageName = '/visual_swatch_attribute_option_type_image.jpg'; + $expectedValues = [ + 0 => [ + 'swatch_data' => [ + 'type' => 'IMAGE', + 'value' => $this->imageUrlBuilder->getUrl($productImage, Swatch::SWATCH_IMAGE_NAME), + 'thumbnail' => $this->imageUrlBuilder->getUrl($productImage, Swatch::SWATCH_THUMBNAIL_NAME), + ], + ], + 1 => [ + 'swatch_data' => [ + 'type' => 'IMAGE', + 'value' => $this->swatchMediaHelper->getSwatchAttributeImage(Swatch::SWATCH_IMAGE_NAME, $swatchImageName), + 'thumbnail' => $this->swatchMediaHelper->getSwatchAttributeImage(Swatch::SWATCH_THUMBNAIL_NAME, $swatchImageName), + ], + ], + 2 => [ + 'swatch_data' => NULL, + ], + ]; + + $values = $this->getSwatchDataValues($productSku); + $this->assertEquals($values, $expectedValues); + } + + /** + * @magentoApiDataFixture Magento/Swatches/_files/textual_swatch_attribute.php + * @magentoApiDataFixture Magento/ConfigurableProduct/_files/configurable_products.php + */ + public function testGetSwatchDataForTextualOptions() + { + $expectType = "TEXTUAL"; + $expectValue = "option 1"; + $expectThumbnail = null; + + $values = $this->getSwatchDataValues(); + $this->assertArrayHasKey(0, $values); + + $value = $values[0]; + $this->assertArrayHasKey('swatch_data', $value); + $this->assertEquals($expectType, $value['swatch_data']['type']); + $this->assertEquals($expectValue, $value['swatch_data']['value']); + $this->assertEquals($expectThumbnail, $value['swatch_data']['thumbnail']); + } + + /** + * @magentoApiDataFixture Magento/Swatches/_files/visual_swatch_attribute_with_different_options_type.php + * @magentoApiDataFixture Magento/ConfigurableProduct/_files/configurable_products.php + */ + public function testGetSwatchDataForVisualOptions() + { + $imageName = '/visual_swatch_attribute_option_type_image.jpg'; + $expectedValues = [ + 0 => [ + 'swatch_data' => [ + 'type' => 'COLOR', + 'value' => '#000000', + 'thumbnail' => NULL, + ], + ], + 1 => [ + 'swatch_data' => [ + 'type' => 'IMAGE', + 'value' => $this->swatchMediaHelper->getSwatchAttributeImage(Swatch::SWATCH_IMAGE_NAME, $imageName), + 'thumbnail' => $this->swatchMediaHelper->getSwatchAttributeImage(Swatch::SWATCH_THUMBNAIL_NAME, $imageName), + ], + ], + 2 => [ + 'swatch_data' => NULL, + ], + ]; + + $values = $this->getSwatchDataValues(); + $this->assertEquals($values, $expectedValues); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Swatches/_files/text_swatch_attribute_rollback.php b/dev/tests/integration/testsuite/Magento/Swatches/_files/text_swatch_attribute_rollback.php new file mode 100644 index 0000000000000..3b1810766c915 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Swatches/_files/text_swatch_attribute_rollback.php @@ -0,0 +1,23 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +/** @var \Magento\Framework\Registry $registry */ +$registry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(\Magento\Framework\Registry::class); + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); + +/** @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute */ +$attribute = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class); + +$attribute->loadByCode(4, 'test_configurable'); + +if ($attribute->getId()) { + $attribute->delete(); +} + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); diff --git a/dev/tests/integration/testsuite/Magento/Swatches/_files/textual_swatch_attribute.php b/dev/tests/integration/testsuite/Magento/Swatches/_files/textual_swatch_attribute.php new file mode 100644 index 0000000000000..26602d2b2e2f0 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Swatches/_files/textual_swatch_attribute.php @@ -0,0 +1,103 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\Data\ProductAttributeInterface; +use Magento\Catalog\Setup\CategorySetup; +use Magento\Eav\Api\AttributeRepositoryInterface; +use Magento\Eav\Api\Data\AttributeOptionInterface; +use Magento\Swatches\Model\Swatch; +use Magento\TestFramework\Helper\Bootstrap; + +/** @var $installer CategorySetup */ +$installer = Bootstrap::getObjectManager()->create(\Magento\Catalog\Setup\CategorySetup::class); +/** @var AttributeRepositoryInterface $attributeRepository */ +$attributeRepository = Bootstrap::getObjectManager()->create(AttributeRepositoryInterface::class); + +// Add attribute data +$data = [ + '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', +]; + +$optionsPerAttribute = 3; + +$data['frontend_input'] = 'select'; +$data['swatch_input_type'] = Swatch::SWATCH_INPUT_TYPE_TEXT; + +$data['swatchtext']['value'] = array_reduce( + range(1, $optionsPerAttribute), + function ($values, $index) use ($optionsPerAttribute) { + $values['option_' . $index] = ['option ' . $index]; + return $values; + }, + [] +); + +$data['optiontext']['value'] = array_reduce( + range(1, $optionsPerAttribute), + function ($values, $index) use ($optionsPerAttribute) { + $values['option_' . $index] = ['option ' . $index]; + return $values; + }, + [] +); + +$data['optiontext']['order'] = array_reduce( + range(1, $optionsPerAttribute), + function ($values, $index) use ($optionsPerAttribute) { + $values['option_' . $index] = $index; + return $values; + }, + [] +); + +$data['options']['option'] = array_reduce( + range(1, $optionsPerAttribute), + function ($values, $index) use ($optionsPerAttribute) { + $values[] = [ + 'label' => 'option ' . $index, + 'value' => 'option_' . $index, + ]; + return $values; + }, + [] +); + +$options = []; +foreach ($data['options']['option'] as $optionData) { + $options[] = Bootstrap::getObjectManager()->create(AttributeOptionInterface::class) + ->setLabel($optionData['label']) + ->setValue($optionData['value']); +} + +$attribute = Bootstrap::getObjectManager()->create( + ProductAttributeInterface::class, + ['data' => $data] +); + +$attribute->setOptions($options); +$attributeRepository->save($attribute); + +/* Assign attribute to attribute set */ +$installer->addAttributeToGroup('catalog_product', 'Default', 'General', $attribute->getId()); diff --git a/dev/tests/integration/testsuite/Magento/Swatches/_files/visual_swatch_attribute_with_different_options_type.php b/dev/tests/integration/testsuite/Magento/Swatches/_files/visual_swatch_attribute_with_different_options_type.php new file mode 100644 index 0000000000000..a4a755c4b92db --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Swatches/_files/visual_swatch_attribute_with_different_options_type.php @@ -0,0 +1,116 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\Data\ProductAttributeInterface; +use Magento\Catalog\Setup\CategorySetup; +use Magento\Eav\Api\AttributeRepositoryInterface; +use Magento\Eav\Api\Data\AttributeOptionInterface; +use Magento\Setup\Fixtures\ImagesGenerator\ImagesGenerator; +use Magento\Swatches\Helper\Media as SwatchesMedia; +use Magento\Swatches\Model\Swatch; +use Magento\TestFramework\Helper\Bootstrap; + +/** @var $installer CategorySetup */ +$installer = Bootstrap::getObjectManager()->create(\Magento\Catalog\Setup\CategorySetup::class); +/** @var AttributeRepositoryInterface $attributeRepository */ +$attributeRepository = Bootstrap::getObjectManager()->create(AttributeRepositoryInterface::class); + +// Generate swatch image +/** @var ImagesGenerator $imagesGenerator */ +$imagesGenerator = Bootstrap::getObjectManager()->get(ImagesGenerator::class); +/** @var SwatchesMedia $swatchesMedia */ +$swatchesMedia = Bootstrap::getObjectManager()->get(SwatchesMedia::class); +$imageName = 'visual_swatch_attribute_option_type_image.jpg'; +$imagesGenerator->generate([ + 'image-width' => 110, + 'image-height' => 90, + 'image-name' => $imageName, +]); +$imagePath = substr($swatchesMedia->moveImageFromTmp($imageName), 1); +$swatchesMedia->generateSwatchVariations($imagePath); + +// Add attribute data +$data = [ + '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', +]; + +$optionsPerAttribute = 3; + +$data['frontend_input'] = 'select'; +$data['swatch_input_type'] = Swatch::SWATCH_INPUT_TYPE_VISUAL; + +$data['swatchvisual']['value'] = [ + 'option_1' => '#000000', // HEX color (color type) + 'option_2' => $imagePath, // image path (image type) + 'option_3' => null, // null (empty type) +]; + +$data['optionvisual']['value'] = array_reduce( + range(1, $optionsPerAttribute), + function ($values, $index) use ($optionsPerAttribute) { + $values['option_' . $index] = ['option ' . $index]; + return $values; + }, + [] +); + +$data['optionvisual']['order'] = array_reduce( + range(1, $optionsPerAttribute), + function ($values, $index) use ($optionsPerAttribute) { + $values['option_' . $index] = $index; + return $values; + }, + [] +); + +$data['options']['option'] = array_reduce( + range(1, $optionsPerAttribute), + function ($values, $index) use ($optionsPerAttribute) { + $values[] = [ + 'label' => 'option ' . $index, + 'value' => 'option_' . $index, + ]; + return $values; + }, + [] +); + +$options = []; +foreach ($data['options']['option'] as $optionData) { + $options[] = Bootstrap::getObjectManager()->create(AttributeOptionInterface::class) + ->setLabel($optionData['label']) + ->setValue($optionData['value']); +} + +$attribute = Bootstrap::getObjectManager()->create( + ProductAttributeInterface::class, + ['data' => $data] +); + +$attribute->setOptions($options); +$attributeRepository->save($attribute); + +/* Assign attribute to attribute set */ +$installer->addAttributeToGroup('catalog_product', 'Default', 'General', $attribute->getId()); diff --git a/dev/tests/integration/testsuite/Magento/Swatches/_files/visual_swatch_attribute_with_different_options_type_rollback.php b/dev/tests/integration/testsuite/Magento/Swatches/_files/visual_swatch_attribute_with_different_options_type_rollback.php new file mode 100644 index 0000000000000..ef1db34708fb3 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Swatches/_files/visual_swatch_attribute_with_different_options_type_rollback.php @@ -0,0 +1,34 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\Filesystem; +use Magento\Framework\Filesystem\Directory\WriteInterface; +use Magento\Swatches\Helper\Media as SwatchesMedia; +use Magento\TestFramework\Helper\Bootstrap; + +/** @var WriteInterface $mediaDirectory */ +$mediaDirectory = Bootstrap::getObjectManager()->get(Filesystem::class) + ->getDirectoryWrite( + DirectoryList::MEDIA + ); + +/** @var SwatchesMedia $swatchesMedia */ +$swatchesMedia = Bootstrap::getObjectManager()->get(SwatchesMedia::class); + +$testImageName = 'visual_swatch_attribute_option_type_image.jpg'; +$testImageSwatchPath = $swatchesMedia->getAttributeSwatchPath($testImageName); +$mediaDirectory->delete($testImageSwatchPath); + +$imageConfig = $swatchesMedia->getImageConfig(); +$swatchTypes = ['swatch_image', 'swatch_thumb']; + +foreach ($swatchTypes as $swatchType) { + $absolutePath = $mediaDirectory->getAbsolutePath($swatchesMedia->getSwatchCachePath($swatchType)); + $swatchTypePath = $absolutePath . $swatchesMedia->getFolderNameSize($swatchType, $imageConfig) . '/' . $testImageName; + $mediaDirectory->delete($swatchTypePath); +} diff --git a/dev/tests/integration/testsuite/Magento/Swatches/_files/visual_swatch_attribute_with_enabled_product_image_for_swatch.php b/dev/tests/integration/testsuite/Magento/Swatches/_files/visual_swatch_attribute_with_enabled_product_image_for_swatch.php new file mode 100644 index 0000000000000..0e171094516ba --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Swatches/_files/visual_swatch_attribute_with_enabled_product_image_for_swatch.php @@ -0,0 +1,35 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Model\Product; + +require __DIR__ . '/visual_swatch_attribute_with_different_options_type.php'; +require __DIR__ . '/../../../Magento/ConfigurableProduct/_files/configurable_products.php'; +require __DIR__ . '/../../../Magento/Catalog/_files/product_image.php'; + +// set 'Product Image for Swatch' for attribute +$attribute->setData('use_product_image_for_swatch', 1); +$attributeRepository->save($attribute); + +// get first child and set image +$childrenProducts = $product->getTypeInstance()->getUsedProducts($product); +/** @var Product $firstChildSimpleProduct */ +$firstChildSimpleProduct = array_shift($childrenProducts); +$firstChildSimpleProduct + ->setImage('/m/a/magento_image.jpg') + ->setSmallImage('/m/a/magento_image.jpg') + ->setThumbnail('/m/a/magento_image.jpg') + ->setData('media_gallery', ['images' => [ + [ + 'file' => '/m/a/magento_image.jpg', + 'position' => 1, + 'label' => 'Image Alt Text', + 'disabled' => 0, + 'media_type' => 'image' + ], + ]]) + ->save(); diff --git a/dev/tests/integration/testsuite/Magento/Swatches/_files/visual_swatch_attribute_with_enabled_product_image_for_swatch_rollback.php b/dev/tests/integration/testsuite/Magento/Swatches/_files/visual_swatch_attribute_with_enabled_product_image_for_swatch_rollback.php new file mode 100644 index 0000000000000..c708971326162 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Swatches/_files/visual_swatch_attribute_with_enabled_product_image_for_swatch_rollback.php @@ -0,0 +1,11 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +require __DIR__ . '/visual_swatch_attribute_with_different_options_type_rollback.php'; +require __DIR__ . '/../../../Magento/ConfigurableProduct/_files/configurable_products_rollback.php'; +require __DIR__ . '/../../../Magento/Catalog/_files/product_image_rollback.php'; + From 468da78a555d0a4dad5c17c8ab5caf8466069bca Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Fri, 20 Dec 2019 11:04:02 +0200 Subject: [PATCH 0539/1143] refactor to backward compatibility --- .../Controller/Adminhtml/Denied/Index.php | 28 +++++++++++++++++++ .../Controller/Adminhtml/Index/Denied.php | 23 --------------- app/code/Magento/Backend/Model/Url.php | 2 +- .../Backend/Test/Unit/Model/UrlTest.php | 2 +- .../controller_acl_test_whitelist_ce.txt | 1 - 5 files changed, 30 insertions(+), 26 deletions(-) create mode 100644 app/code/Magento/Backend/Controller/Adminhtml/Denied/Index.php delete mode 100644 app/code/Magento/Backend/Controller/Adminhtml/Index/Denied.php diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Denied/Index.php b/app/code/Magento/Backend/Controller/Adminhtml/Denied/Index.php new file mode 100644 index 0000000000000..bfefab94f4836 --- /dev/null +++ b/app/code/Magento/Backend/Controller/Adminhtml/Denied/Index.php @@ -0,0 +1,28 @@ +<?php +/** + * + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Backend\Controller\Adminhtml\Denied; + +use Magento\Backend\Controller\Adminhtml\Denied; +use Magento\Framework\App\Action\HttpGetActionInterface as HttpGet; +use Magento\Framework\App\Action\HttpPostActionInterface as HttpPost; + +/** + * Denied Action + */ +class Index extends Denied implements HttpGet, HttpPost +{ + + /** + * Check if user has permissions to access this controller + * + * @return bool + */ + protected function _isAllowed() + { + return true; + } +} diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Index/Denied.php b/app/code/Magento/Backend/Controller/Adminhtml/Index/Denied.php deleted file mode 100644 index 0d5245b5c11b2..0000000000000 --- a/app/code/Magento/Backend/Controller/Adminhtml/Index/Denied.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php -/** - * - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -declare(strict_types=1); - -namespace Magento\Backend\Controller\Adminhtml\Index; - -use Magento\Backend\Controller\Adminhtml\Denied as DeniedController; -use Magento\Framework\App\Action\HttpGetActionInterface; - -/** - * To display Denied Page - */ -class Denied extends DeniedController implements HttpGetActionInterface -{ - /** - * @see _isAllowed() - */ - public const ADMIN_RESOURCE = 'Magento_Backend::admin'; -} diff --git a/app/code/Magento/Backend/Model/Url.php b/app/code/Magento/Backend/Model/Url.php index ba0c3d1cfacee..97f82647d9445 100644 --- a/app/code/Magento/Backend/Model/Url.php +++ b/app/code/Magento/Backend/Model/Url.php @@ -349,7 +349,7 @@ public function findFirstAvailableMenu() if ($user) { $user->setHasAvailableResources(false); } - $action = '*/*/denied'; + $action = '*/denied'; } return $action; } diff --git a/app/code/Magento/Backend/Test/Unit/Model/UrlTest.php b/app/code/Magento/Backend/Test/Unit/Model/UrlTest.php index ad42108cb5eea..1ef3b3980441e 100644 --- a/app/code/Magento/Backend/Test/Unit/Model/UrlTest.php +++ b/app/code/Magento/Backend/Test/Unit/Model/UrlTest.php @@ -190,7 +190,7 @@ public function testFindFirstAvailableMenuDenied() $this->_menuMock->expects($this->any())->method('getFirstAvailableChild')->will($this->returnValue(null)); - $this->assertEquals('*/*/denied', $this->_model->findFirstAvailableMenu()); + $this->assertEquals('*/denied', $this->_model->findFirstAvailableMenu()); } public function testFindFirstAvailableMenu() diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/_files/controller_acl_test_whitelist_ce.txt b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/_files/controller_acl_test_whitelist_ce.txt index 77da8c564c36a..1119824f217bb 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/_files/controller_acl_test_whitelist_ce.txt +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/_files/controller_acl_test_whitelist_ce.txt @@ -1,7 +1,6 @@ Magento\Security\Controller\Adminhtml\Session\Activity Magento\Security\Controller\Adminhtml\Session\LogoutAll Magento\Backend\Controller\Adminhtml\Denied -Magento\Backend\Controller\Adminhtml\Index\Denied Magento\Backend\Controller\Adminhtml\Noroute\Index Magento\Directory\Controller\Adminhtml\Json\CountryRegion Magento\Tax\Controller\Adminhtml\Rule\AjaxLoadRates From d34a54c263c8fe86cc82b5c4c10667eea8e74224 Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Fri, 20 Dec 2019 11:55:46 +0200 Subject: [PATCH 0540/1143] Covering the SetAttributeTabBlockObserver for Bundles by Unit Test --- .../SetAttributeTabBlockObserverTest.php | 112 ++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 app/code/Magento/Bundle/Test/Unit/Observer/SetAttributeTabBlockObserverTest.php diff --git a/app/code/Magento/Bundle/Test/Unit/Observer/SetAttributeTabBlockObserverTest.php b/app/code/Magento/Bundle/Test/Unit/Observer/SetAttributeTabBlockObserverTest.php new file mode 100644 index 0000000000000..67368bdf89409 --- /dev/null +++ b/app/code/Magento/Bundle/Test/Unit/Observer/SetAttributeTabBlockObserverTest.php @@ -0,0 +1,112 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Bundle\Test\Unit\Observer; + +use Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Attributes; +use Magento\Bundle\Observer\SetAttributeTabBlockObserver; +use Magento\Catalog\Helper\Catalog; +use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\Product\Type; +use Magento\Framework\Event; +use Magento\Framework\Event\Observer; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +/** + * Class SetAttributeTabBlockObserverTest + * + * Test setting attribute tab block for bundle products + */ +class SetAttributeTabBlockObserverTest extends TestCase +{ + /** + * @var SetAttributeTabBlockObserver + */ + private $observer; + + /** + * @var Catalog|MockObject + */ + private $helperCatalogMock; + + /** + * @var Observer|MockObject + */ + private $observerMock; + + /** + * @var Event|MockObject + */ + private $eventMock; + + /** + * @var Product|MockObject + */ + private $productMock; + + /** + * Set Up + */ + public function setUp() + { + $this->helperCatalogMock = $this->createMock(Catalog::class); + $this->observerMock = $this->createMock(Observer::class); + $this->eventMock = $this->getMockBuilder(Event::class) + ->disableOriginalConstructor() + ->setMethods(['getProduct']) + ->getMock(); + $this->productMock = $this->getMockBuilder(Product::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->observer = new SetAttributeTabBlockObserver( + $this->helperCatalogMock + ); + } + + /** + * Test setting attribute tab block for bundle product + */ + public function testAddingAttributeTabForBundleProduct() + { + $this->productMock->expects($this->any()) + ->method('getTypeId') + ->willReturn(Type::TYPE_BUNDLE); + $this->eventMock->expects($this->any()) + ->method('getProduct') + ->willReturn($this->productMock); + $this->observerMock->expects($this->any()) + ->method('getEvent') + ->willReturn($this->eventMock); + $this->helperCatalogMock->expects($this->once()) + ->method('setAttributeTabBlock') + ->with(Attributes::class); + + $this->observer->execute($this->observerMock); + } + + /** + * Test setting attribute tab block for a non bundle product + */ + public function testAddingAttributeTabForNonBundleProduct() + { + $this->productMock->expects($this->any()) + ->method('getTypeId') + ->willReturn(Type::TYPE_VIRTUAL); + $this->eventMock->expects($this->any()) + ->method('getProduct') + ->willReturn($this->productMock); + $this->observerMock->expects($this->any()) + ->method('getEvent') + ->willReturn($this->eventMock); + $this->helperCatalogMock->expects($this->never()) + ->method('setAttributeTabBlock'); + + $this->observer->execute($this->observerMock); + } +} From df7b502c8fbb11b294a119abc232db1c422466eb Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Fri, 20 Dec 2019 12:23:38 +0200 Subject: [PATCH 0541/1143] Covering the InvalidatePriceIndexUponConfigChangeObserver for CatalogInventory by Unit Test --- ...PriceIndexUponConfigChangeObserverTest.php | 113 ++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 app/code/Magento/CatalogInventory/Test/Unit/Observer/InvalidatePriceIndexUponConfigChangeObserverTest.php diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Observer/InvalidatePriceIndexUponConfigChangeObserverTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Observer/InvalidatePriceIndexUponConfigChangeObserverTest.php new file mode 100644 index 0000000000000..9762b59c3e883 --- /dev/null +++ b/app/code/Magento/CatalogInventory/Test/Unit/Observer/InvalidatePriceIndexUponConfigChangeObserverTest.php @@ -0,0 +1,113 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\CatalogInventory\Test\Unit\Observer; + +use Magento\Catalog\Model\Indexer\Product\Price\Processor; +use Magento\CatalogInventory\Model\Configuration; +use Magento\CatalogInventory\Observer\InvalidatePriceIndexUponConfigChangeObserver; +use Magento\Framework\Event; +use Magento\Framework\Event\Observer; +use Magento\Framework\Indexer\IndexerInterface; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +/** + * Class InvalidatePriceIndexUponConfigChangeObserverTest + * + * Testing invalidating product price index onn config changing + */ +class InvalidatePriceIndexUponConfigChangeObserverTest extends TestCase +{ + /** + * @var InvalidatePriceIndexUponConfigChangeObserver + */ + private $observer; + + /** + * @var Processor|MockObject + */ + private $priceIndexProcessorMock; + + /** + * @var Observer|MockObject + */ + private $observerMock; + + /** + * @var Event|MockObject + */ + private $eventMock; + + /** + * @var IndexerInterface|MockObject + */ + private $indexerMock; + + /** + * Set Up + */ + public function setUp() + { + $this->priceIndexProcessorMock = $this->createMock(Processor::class); + $this->indexerMock = $this->getMockBuilder(IndexerInterface::class) + ->getMockForAbstractClass(); + $this->observerMock = $this->createMock(Observer::class); + $this->eventMock = $this->getMockBuilder(Event::class) + ->disableOriginalConstructor() + ->setMethods(['getChangedPaths']) + ->getMock(); + + $this->observer = new InvalidatePriceIndexUponConfigChangeObserver( + $this->priceIndexProcessorMock + ); + } + + /** + * Testing invalidating product price index on catalog inventory config changes + */ + public function testInvalidatingPriceOnChangingOutOfStockConfig() + { + $changedPaths = [Configuration::XML_PATH_SHOW_OUT_OF_STOCK]; + + $this->eventMock->expects($this->once()) + ->method('getChangedPaths') + ->willReturn($changedPaths); + $this->observerMock->expects($this->once()) + ->method('getEvent') + ->willReturn($this->eventMock); + $this->indexerMock->expects($this->once()) + ->method('invalidate'); + $this->priceIndexProcessorMock->expects($this->once()) + ->method('getIndexer') + ->willReturn($this->indexerMock); + + $this->observer->execute($this->observerMock); + } + + /** + * Testing invalidating product price index on changing any other config + */ + public function testInvalidatingPriceOnChangingAnyOtherConfig() + { + $changedPaths = [Configuration::XML_PATH_ITEM_AUTO_RETURN]; + + $this->eventMock->expects($this->once()) + ->method('getChangedPaths') + ->willReturn($changedPaths); + $this->observerMock->expects($this->once()) + ->method('getEvent') + ->willReturn($this->eventMock); + $this->indexerMock->expects($this->never()) + ->method('invalidate'); + $this->priceIndexProcessorMock->expects($this->never()) + ->method('getIndexer') + ->willReturn($this->indexerMock); + + $this->observer->execute($this->observerMock); + } +} From f9cf1882fa890caade0e9894e26218c82ff9867c Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Fri, 20 Dec 2019 12:32:05 +0200 Subject: [PATCH 0542/1143] Adding ObjectManager usage --- .../Unit/Observer/SetAttributeTabBlockObserverTest.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Bundle/Test/Unit/Observer/SetAttributeTabBlockObserverTest.php b/app/code/Magento/Bundle/Test/Unit/Observer/SetAttributeTabBlockObserverTest.php index 67368bdf89409..08f6a05bd10bf 100644 --- a/app/code/Magento/Bundle/Test/Unit/Observer/SetAttributeTabBlockObserverTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Observer/SetAttributeTabBlockObserverTest.php @@ -14,6 +14,7 @@ use Magento\Catalog\Model\Product\Type; use Magento\Framework\Event; use Magento\Framework\Event\Observer; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; @@ -54,6 +55,7 @@ class SetAttributeTabBlockObserverTest extends TestCase */ public function setUp() { + $objectManager = new ObjectManager($this); $this->helperCatalogMock = $this->createMock(Catalog::class); $this->observerMock = $this->createMock(Observer::class); $this->eventMock = $this->getMockBuilder(Event::class) @@ -64,8 +66,11 @@ public function setUp() ->disableOriginalConstructor() ->getMock(); - $this->observer = new SetAttributeTabBlockObserver( - $this->helperCatalogMock + $this->observer = $objectManager->getObject( + SetAttributeTabBlockObserver::class, + [ + 'helperCatalog' => $this->helperCatalogMock + ] ); } From 82fee14d8ae788c0da5eb1f23d5f335376b90613 Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Fri, 20 Dec 2019 12:34:02 +0200 Subject: [PATCH 0543/1143] Adding ObjectManager --- .../InvalidatePriceIndexUponConfigChangeObserverTest.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Observer/InvalidatePriceIndexUponConfigChangeObserverTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Observer/InvalidatePriceIndexUponConfigChangeObserverTest.php index 9762b59c3e883..1dd7df8952473 100644 --- a/app/code/Magento/CatalogInventory/Test/Unit/Observer/InvalidatePriceIndexUponConfigChangeObserverTest.php +++ b/app/code/Magento/CatalogInventory/Test/Unit/Observer/InvalidatePriceIndexUponConfigChangeObserverTest.php @@ -13,6 +13,7 @@ use Magento\Framework\Event; use Magento\Framework\Event\Observer; use Magento\Framework\Indexer\IndexerInterface; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; @@ -53,6 +54,7 @@ class InvalidatePriceIndexUponConfigChangeObserverTest extends TestCase */ public function setUp() { + $objectManager = new ObjectManager($this); $this->priceIndexProcessorMock = $this->createMock(Processor::class); $this->indexerMock = $this->getMockBuilder(IndexerInterface::class) ->getMockForAbstractClass(); @@ -62,8 +64,11 @@ public function setUp() ->setMethods(['getChangedPaths']) ->getMock(); - $this->observer = new InvalidatePriceIndexUponConfigChangeObserver( - $this->priceIndexProcessorMock + $this->observer = $objectManager->getObject( + InvalidatePriceIndexUponConfigChangeObserver::class, + [ + 'priceIndexProcessor' => $this->priceIndexProcessorMock + ] ); } From 8251bc91a45ffb61cdfb0015ccf570f63f23484b Mon Sep 17 00:00:00 2001 From: divyajyothi5321 <54176640+divyajyothi5321@users.noreply.github.com> Date: Fri, 20 Dec 2019 17:07:29 +0530 Subject: [PATCH 0544/1143] Update Send.php --- app/code/Magento/Wishlist/Controller/Index/Send.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/Wishlist/Controller/Index/Send.php b/app/code/Magento/Wishlist/Controller/Index/Send.php index b7c93473cde94..2f1813cf886ed 100644 --- a/app/code/Magento/Wishlist/Controller/Index/Send.php +++ b/app/code/Magento/Wishlist/Controller/Index/Send.php @@ -318,7 +318,6 @@ protected function addLayoutHandles(ResultLayout $resultLayout) * * @param int $wishlistId * @param \Magento\Framework\View\Result\Layout $resultLayout - * @return mixed */ protected function getRssLink($wishlistId, ResultLayout $resultLayout) { From 3cd62c7ff2c9d95316cbf4cab152a7b8d09f9678 Mon Sep 17 00:00:00 2001 From: "rostyslav.hymon" <rostyslav.hymon@transoftgroup.com> Date: Fri, 20 Dec 2019 14:03:11 +0200 Subject: [PATCH 0545/1143] MC-29866: getBasePrice function returns a string sometimes --- .../Catalog/Model/Product/Type/Price.php | 4 +- .../Catalog/Model/Product/Type/PriceTest.php | 210 ++++++++++++++---- 2 files changed, 167 insertions(+), 47 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Type/Price.php b/app/code/Magento/Catalog/Model/Product/Type/Price.php index 814865fa75917..e702965270639 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/Price.php +++ b/app/code/Magento/Catalog/Model/Product/Type/Price.php @@ -262,7 +262,7 @@ protected function _applyTierPrice($product, $qty, $finalPrice) $tierPrice = $product->getTierPrice($qty); if (is_numeric($tierPrice)) { - $finalPrice = min($finalPrice, $tierPrice); + $finalPrice = min($finalPrice, (float) $tierPrice); } return $finalPrice; } @@ -645,7 +645,7 @@ public function calculateSpecialPrice( ) { if ($specialPrice !== null && $specialPrice != false) { if ($this->_localeDate->isScopeDateInInterval($store, $specialPriceFrom, $specialPriceTo)) { - $finalPrice = min($finalPrice, $specialPrice); + $finalPrice = min($finalPrice, (float) $specialPrice); } } return $finalPrice; diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/PriceTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/PriceTest.php index 8d3a119873afb..3672b8b065bf5 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/PriceTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/PriceTest.php @@ -3,105 +3,225 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Catalog\Model\Product\Type; +use Magento\Catalog\Api\Data\ProductCustomOptionInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\Product\Option; +use Magento\Customer\Model\Session; +use Magento\Framework\DataObject; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\ObjectManager; +use PHPUnit\Framework\TestCase; /** + * Simple product price test. + * * @magentoDataFixture Magento/Catalog/_files/product_simple.php + * @magentoDbIsolation enabled */ -class PriceTest extends \PHPUnit\Framework\TestCase +class PriceTest extends TestCase { /** - * @var \Magento\Catalog\Model\Product\Type\Price + * @var ObjectManager */ - protected $_model; + private $objectManager; - protected function setUp() + /** + * @var Price + */ + private $productPrice; + + /** + * @var ProductRepositoryInterface + */ + private $productRepository; + + /** + * @var Session + */ + private $customerSession; + + /** + * @inheritdoc + */ + protected function setUp(): void { - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - \Magento\Catalog\Model\Product\Type\Price::class - ); + $this->objectManager = Bootstrap::getObjectManager(); + $this->productPrice = $this->objectManager->create(Price::class); + $this->productRepository = $this->objectManager->create(ProductRepositoryInterface::class); + $this->customerSession = $this->objectManager->get(Session::class); } - public function testGetPrice() + /** + * Assert that for logged user product price equal to price from catalog rule. + * + * @magentoDataFixture Magento/Catalog/_files/product_simple.php + * @magentoDataFixture Magento/CatalogRule/_files/catalog_rule_6_off_logged_user.php + * @magentoDataFixture Magento/Customer/_files/customer.php + * + * @magentoDbIsolation disabled + * @magentoAppArea frontend + * @magentoAppIsolation enabled + * + * @return void + */ + public function testPriceByRuleForLoggedUser(): void { - $this->assertEquals('test', $this->_model->getPrice(new \Magento\Framework\DataObject(['price' => 'test']))); + $product = $this->productRepository->get('simple'); + $this->assertEquals(10, $this->productPrice->getFinalPrice(1, $product)); + $this->customerSession->setCustomerId(1); + try { + $this->assertEquals(4, $this->productPrice->getFinalPrice(1, $product)); + } finally { + $this->customerSession->setCustomerId(null); + } } - public function testGetFinalPrice() + /** + * Assert price for different customer groups. + * + * @magentoDataFixture Magento/Catalog/_files/simple_product_with_tier_price_for_logged_user.php + * @magentoDataFixture Magento/Customer/_files/customer.php + * + * @magentoAppIsolation enabled + * + * @return void + */ + public function testTierPriceWithDifferentCustomerGroups(): void { - $repository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - \Magento\Catalog\Model\ProductRepository::class - ); - $product = $repository->get('simple'); - // fixture + $product = $this->productRepository->get('simple'); + $this->assertEquals(8, $this->productPrice->getFinalPrice(2, $product)); + $this->assertEquals(5, $this->productPrice->getFinalPrice(3, $product)); + $this->customerSession->setCustomerId(1); + try { + $this->assertEquals(1, $this->productPrice->getFinalPrice(3, $product)); + } finally { + $this->customerSession->setCustomerId(null); + } + } + + /** + * Get price from custom object. + * + * @return void + */ + public function testGetPrice(): void + { + $objectWithPrice = $this->objectManager->create(DataObject::class, ['data' => ['price' => 9.0]]); + $this->assertEquals(9.0, $this->productPrice->getPrice($objectWithPrice)); + } + + /** + * Get base price from product. + * + * @return void + */ + public function testGetBasePrice(): void + { + $product = $this->productRepository->get('simple'); + $this->assertSame(10.0, $this->productPrice->getBasePrice($product)); + } + + /** + * Get product final price for different product count. + * + * @return void + */ + public function testGetFinalPrice(): void + { + $product = $this->productRepository->get('simple'); // regular & tier prices - $this->assertEquals(10.0, $this->_model->getFinalPrice(1, $product)); - $this->assertEquals(8.0, $this->_model->getFinalPrice(2, $product)); - $this->assertEquals(5.0, $this->_model->getFinalPrice(5, $product)); + $this->assertEquals(10.0, $this->productPrice->getFinalPrice(1, $product)); + $this->assertEquals(8.0, $this->productPrice->getFinalPrice(2, $product)); + $this->assertEquals(5.0, $this->productPrice->getFinalPrice(5, $product)); // with options $buyRequest = $this->prepareBuyRequest($product); $product->getTypeInstance()->prepareForCart($buyRequest, $product); //product price + options price(10+1+2+3+3) - $this->assertEquals(19.0, $this->_model->getFinalPrice(1, $product)); + $this->assertEquals(19.0, $this->productPrice->getFinalPrice(1, $product)); //product tier price + options price(5+1+2+3+3) - $this->assertEquals(14.0, $this->_model->getFinalPrice(5, $product)); - } - - public function testGetFormatedPrice() - { - $repository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - \Magento\Catalog\Model\ProductRepository::class - ); - $product = $repository->get('simple'); - // fixture - $this->assertEquals('<span class="price">$10.00</span>', $this->_model->getFormatedPrice($product)); + $this->assertEquals(14.0, $this->productPrice->getFinalPrice(5, $product)); } - public function testCalculatePrice() + /** + * Assert that formated price is correct. + * + * @return void + */ + public function testGetFormatedPrice(): void { - $this->assertEquals(10, $this->_model->calculatePrice(10, 8, '1970-12-12 23:59:59', '1971-01-01 01:01:01')); - $this->assertEquals(8, $this->_model->calculatePrice(10, 8, '1970-12-12 23:59:59', '2034-01-01 01:01:01')); + $product = $this->productRepository->get('simple'); + $this->assertEquals('<span class="price">$10.00</span>', $this->productPrice->getFormatedPrice($product)); } - public function testCalculateSpecialPrice() + /** + * Test calculate price by date. + * + * @return void + */ + public function testCalculatePrice(): void { $this->assertEquals( 10, - $this->_model->calculateSpecialPrice(10, 8, '1970-12-12 23:59:59', '1971-01-01 01:01:01') + $this->productPrice->calculatePrice(10, 8, '1970-12-12 23:59:59', '1971-01-01 01:01:01') ); $this->assertEquals( 8, - $this->_model->calculateSpecialPrice(10, 8, '1970-12-12 23:59:59', '2034-01-01 01:01:01') + $this->productPrice->calculatePrice(10, 8, '1970-12-12 23:59:59', '2034-01-01 01:01:01') + ); + } + + /** + * Test calculate price by date. + * + * @return void + */ + public function testCalculateSpecialPrice(): void + { + $this->assertSame( + 10.0, + $this->productPrice->calculateSpecialPrice(10.0, 8.0, '1970-12-12 23:59:59', '1971-01-01 01:01:01') + ); + $this->assertSame( + 8.0, + $this->productPrice->calculateSpecialPrice(10.0, 8.0, '1970-12-12 23:59:59', '2034-01-01 01:01:01') ); } - public function testIsTierPriceFixed() + /** + * Assert that product tier price is fixed. + * + * @return void + */ + public function testIsTierPriceFixed(): void { - $this->assertTrue($this->_model->isTierPriceFixed()); + $this->assertTrue($this->productPrice->isTierPriceFixed()); } /** - * Build buy request based on product custom options + * Build buy request based on product custom options. * * @param Product $product - * @return \Magento\Framework\DataObject + * @return DataObject */ - private function prepareBuyRequest(Product $product) + private function prepareBuyRequest(Product $product): DataObject { $options = []; - /** @var $option \Magento\Catalog\Model\Product\Option */ + /** @var Option $option */ foreach ($product->getOptions() as $option) { switch ($option->getGroupByType()) { - case \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_GROUP_DATE: + case ProductCustomOptionInterface::OPTION_GROUP_DATE: $value = ['year' => 2013, 'month' => 8, 'day' => 9, 'hour' => 13, 'minute' => 35]; break; - case \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_GROUP_SELECT: + case ProductCustomOptionInterface::OPTION_GROUP_SELECT: $value = key($option->getValues()); break; default: @@ -111,6 +231,6 @@ private function prepareBuyRequest(Product $product) $options[$option->getId()] = $value; } - return new \Magento\Framework\DataObject(['qty' => 1, 'options' => $options]); + return $this->objectManager->create(DataObject::class, ['data' => ['qty' => 1, 'options' => $options]]); } } From 51a83785e0af99a03020d0a2da7d5a5dca8cb7f0 Mon Sep 17 00:00:00 2001 From: Viktor Petryk <victor.petryk@transoftgroup.com> Date: Fri, 20 Dec 2019 14:10:38 +0200 Subject: [PATCH 0546/1143] MC-29444: Extra Values of UPS and USPS are in dropdown list Cart Price Rule - Condition - Shipping Method --- app/code/Magento/Ups/Model/Carrier.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Ups/Model/Carrier.php b/app/code/Magento/Ups/Model/Carrier.php index 05f12f8999212..7a2123629ca12 100644 --- a/app/code/Magento/Ups/Model/Carrier.php +++ b/app/code/Magento/Ups/Model/Carrier.php @@ -1320,13 +1320,11 @@ public function getAllowedMethods() ? $this->configHelper->getCode('originShipment', $origin) : $this->configHelper->getCode('method'); - $filteredMethods = array_filter($availableByTypeMethods, function ($methodCode) use ($allowedMethods) { - return in_array($methodCode, $allowedMethods); - }, ARRAY_FILTER_USE_KEY); - $methods = []; - foreach ($filteredMethods as $methodCode => $methodData) { - $methods[$methodCode] = $methodData->getText(); + foreach ($availableByTypeMethods as $methodCode => $methodData) { + if (in_array($methodCode, $allowedMethods)) { + $methods[$methodCode] = $methodData->getText(); + } } return $methods; From c7bb3b4ede5450c69059b9ea0e314d577ff5a3ad Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Fri, 20 Dec 2019 14:47:01 +0200 Subject: [PATCH 0547/1143] Covering the ProductAttributeGridBuildObserver for LayeredNavigation by Unit Test --- .../ProductAttributeGridBuildObserverTest.php | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 app/code/Magento/LayeredNavigation/Test/Unit/Observer/Grid/ProductAttributeGridBuildObserverTest.php diff --git a/app/code/Magento/LayeredNavigation/Test/Unit/Observer/Grid/ProductAttributeGridBuildObserverTest.php b/app/code/Magento/LayeredNavigation/Test/Unit/Observer/Grid/ProductAttributeGridBuildObserverTest.php new file mode 100644 index 0000000000000..f21908d11ad44 --- /dev/null +++ b/app/code/Magento/LayeredNavigation/Test/Unit/Observer/Grid/ProductAttributeGridBuildObserverTest.php @@ -0,0 +1,102 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\LayeredNavigation\Test\Unit\Observer\Grid; + +use Magento\Catalog\Block\Adminhtml\Product\Attribute\Grid; +use Magento\Framework\Event\Observer; +use Magento\Framework\Module\Manager; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\LayeredNavigation\Observer\Grid\ProductAttributeGridBuildObserver; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +/** + * Class ProductAttributeGridBuildObserverTest + * + * Testing adding new grid column for Layered Navigation + */ +class ProductAttributeGridBuildObserverTest extends TestCase +{ + /** + * @var ProductAttributeGridBuildObserver + */ + private $observer; + + /** + * @var Manager|MockObject + */ + private $moduleManagerMock; + + /** + * @var Observer|MockObject + */ + private $observerMock; + + /** + * @var Grid|MockObject + */ + private $gridMock; + + /** + * Set Up + */ + protected function setUp() + { + $objectManager = new ObjectManager($this); + $this->moduleManagerMock = $this->createMock(Manager::class); + $this->gridMock = $this->createMock(Grid::class); + $this->observerMock = $this->getMockBuilder(Observer::class) + ->disableOriginalConstructor() + ->setMethods(['getGrid']) + ->getMock(); + + $this->observer = $objectManager->getObject( + ProductAttributeGridBuildObserver::class, + [ + 'moduleManager' => $this->moduleManagerMock, + ] + ); + } + + /** + * Testing the column adding if the output is not enabled + */ + public function testColumnAddingOnDisabledOutput() + { + $enabledOutput = false; + + $this->moduleManagerMock->expects($this->once()) + ->method('isOutputEnabled') + ->with('Magento_LayeredNavigation') + ->willReturn($enabledOutput); + + $this->observerMock->expects($this->never()) + ->method('getGrid'); + + $this->observer->execute($this->observerMock); + } + + /** + * Testing the column adding if the output is enabled + */ + public function testColumnAddingOnEnabledOutput() + { + $enabledOutput = true; + + $this->moduleManagerMock->expects($this->once()) + ->method('isOutputEnabled') + ->with('Magento_LayeredNavigation') + ->willReturn($enabledOutput); + + $this->observerMock->expects($this->once()) + ->method('getGrid') + ->willReturn($this->gridMock); + + $this->observer->execute($this->observerMock); + } +} From d1e4bbe8d5d85265266d125a2a9bf9bf862e4990 Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Fri, 20 Dec 2019 15:27:51 +0200 Subject: [PATCH 0548/1143] MC-29916: [Magento Cloud] Configurable product images missing in the admin --- .../Import/Product/MediaGalleryProcessor.php | 266 +++++++++++------- .../Model/Import/ProductTest.php | 107 +++++++ ...import_configurable_product_multistore.csv | 5 + 3 files changed, 270 insertions(+), 108 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/import_configurable_product_multistore.csv diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product/MediaGalleryProcessor.php b/app/code/Magento/CatalogImportExport/Model/Import/Product/MediaGalleryProcessor.php index bd8523a4e396e..a94a87a44b32a 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product/MediaGalleryProcessor.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product/MediaGalleryProcessor.php @@ -108,40 +108,161 @@ public function __construct( public function saveMediaGallery(array $mediaGalleryData) { $this->initMediaGalleryResources(); - $mediaGalleryDataGlobal = array_replace_recursive(...$mediaGalleryData); - $imageNames = []; - $multiInsertData = []; - $valueToProductId = []; - foreach ($mediaGalleryDataGlobal as $productSku => $mediaGalleryRows) { - $productId = $this->skuProcessor->getNewSku($productSku)[$this->getProductEntityLinkField()]; - $insertedGalleryImgs = []; - foreach ($mediaGalleryRows as $insertValue) { - if (!in_array($insertValue['value'], $insertedGalleryImgs)) { - $valueArr = [ - 'attribute_id' => $insertValue['attribute_id'], - 'value' => $insertValue['value'], + $mediaGalleryValues = []; + $mediaGalleryValueData = []; + $productMediaGalleryValueData = []; + $mediaGalleryValueToEntityData = []; + $mediaGalleryValueToStoreData = []; + $productLinkIdField = $this->getProductEntityLinkField(); + foreach ($mediaGalleryData as $storeId => $storeMediaGalleryData) { + foreach ($storeMediaGalleryData as $sku => $productMediaGalleryData) { + $productId = $this->skuProcessor->getNewSku($sku)[$productLinkIdField]; + $productMediaGalleryValueData[$productId] = $productMediaGalleryValueData[$productId] ?? []; + foreach ($productMediaGalleryData as $data) { + if (!in_array($data['value'], $productMediaGalleryValueData[$productId])) { + $productMediaGalleryValueData[$productId][] = $data['value']; + $mediaGalleryValueData[] = [ + 'attribute_id' => $data['attribute_id'], + 'value' => $data['value'], + ]; + $mediaGalleryValueToEntityData[] = [ + 'value' => $data['value'], + $productLinkIdField => $productId, + ]; + } + $mediaGalleryValues[] = $data['value']; + $mediaGalleryValueToStoreData[] = [ + 'value' => $data['value'], + 'store_id' => $storeId, + $productLinkIdField => $productId, + 'label' => $data['label'], + 'position' => $data['position'], + 'disabled' => $data['disabled'], ]; - $valueToProductId[$insertValue['value']][] = $productId; - $imageNames[] = $insertValue['value']; - $multiInsertData[] = $valueArr; - $insertedGalleryImgs[] = $insertValue['value']; } } } - $oldMediaValues = $this->connection->fetchAssoc( - $this->connection->select()->from($this->mediaGalleryTableName, ['value_id', 'value']) - ->where('value IN (?)', $imageNames) - ); - $this->connection->insertOnDuplicate($this->mediaGalleryTableName, $multiInsertData); - $newMediaSelect = $this->connection->select()->from($this->mediaGalleryTableName, ['value_id', 'value']) - ->where('value IN (?)', $imageNames); - if (array_keys($oldMediaValues)) { - $newMediaSelect->where('value_id NOT IN (?)', array_keys($oldMediaValues)); + try { + $mediaValueIdValueMap = []; + $oldMediaValues = $this->connection->fetchCol( + $this->connection->select() + ->from($this->mediaGalleryTableName, ['value_id']) + ->where('value IN (?)', $mediaGalleryValues) + ); + $this->connection->insertOnDuplicate( + $this->mediaGalleryTableName, + $mediaGalleryValueData + ); + $newMediaSelect = $this->connection->select() + ->from($this->mediaGalleryTableName, ['value_id', 'value']) + ->where('value IN (?)', $mediaGalleryValues); + if ($oldMediaValues) { + $newMediaSelect->where('value_id NOT IN (?)', $oldMediaValues); + } + $mediaValueIdValueMap = $this->connection->fetchPairs($newMediaSelect); + $productIdMediaValueIdMap = $this->getProductIdMediaValueIdMap( + $productMediaGalleryValueData, + $mediaValueIdValueMap + ); + $mediaGalleryValueToEntityData = $this->prepareMediaGalleryValueToEntityData( + $mediaGalleryValueToEntityData, + $productIdMediaValueIdMap + ); + $this->connection->insertOnDuplicate( + $this->mediaGalleryEntityToValueTableName, + $mediaGalleryValueToEntityData, + ['value_id'] + ); + $mediaGalleryValueToStoreData = $this->prepareMediaGalleryValueData( + $mediaGalleryValueToStoreData, + $productIdMediaValueIdMap + ); + $this->connection->insertOnDuplicate( + $this->mediaGalleryValueTableName, + $mediaGalleryValueToStoreData, + ['value_id', 'store_id', $productLinkIdField, 'label', 'position', 'disabled'] + ); + } catch (\Throwable $exception) { + if ($mediaValueIdValueMap) { + $this->connection->delete( + $this->mediaGalleryTableName, + $this->connection->quoteInto('value_id IN (?)', array_keys($mediaValueIdValueMap)) + ); + } + throw $exception; } - $newMediaValues = $this->connection->fetchAssoc($newMediaSelect); - foreach ($mediaGalleryData as $storeId => $storeMediaGalleryData) { - $this->processMediaPerStore((int)$storeId, $storeMediaGalleryData, $newMediaValues, $valueToProductId); + } + + /** + * Get media values IDs per products IDs + * + * @param array $productMediaGalleryValueData + * @param array $mediaValueIdValueMap + * @return array + */ + private function getProductIdMediaValueIdMap( + array $productMediaGalleryValueData, + array $mediaValueIdValueMap + ): array { + $productIdMediaValueIdMap = []; + foreach ($productMediaGalleryValueData as $productId => $productMediaGalleryValues) { + foreach ($productMediaGalleryValues as $productMediaGalleryValue) { + foreach ($mediaValueIdValueMap as $valueId => $value) { + if ($productMediaGalleryValue === $value) { + $productIdMediaValueIdMap[$productId][$value] = $valueId; + unset($mediaValueIdValueMap[$valueId]); + break; + } + } + } + } + return $productIdMediaValueIdMap; + } + + /** + * Prepare media entity gallery value to entity data for insert + * + * @param array $mediaGalleryValueToEntityData + * @param array $productIdMediaValueIdMap + * @return array + */ + private function prepareMediaGalleryValueToEntityData( + array $mediaGalleryValueToEntityData, + array $productIdMediaValueIdMap + ): array { + $productLinkIdField = $this->getProductEntityLinkField(); + foreach ($mediaGalleryValueToEntityData as $index => $data) { + $productId = $data[$productLinkIdField]; + $value = $data['value']; + $mediaGalleryValueToEntityData[$index]['value_id'] = $productIdMediaValueIdMap[$productId][$value]; + unset($mediaGalleryValueToEntityData[$index]['value']); + } + return $mediaGalleryValueToEntityData; + } + + /** + * Prepare media entity gallery value data for insert + * + * @param array $mediaGalleryValueData + * @param array $productIdMediaValueIdMap + * @return array + */ + private function prepareMediaGalleryValueData( + array $mediaGalleryValueData, + array $productIdMediaValueIdMap + ): array { + $productLinkIdField = $this->getProductEntityLinkField(); + $lastPositions = $this->getLastMediaPositionPerProduct(array_keys($productIdMediaValueIdMap)); + foreach ($mediaGalleryValueData as $index => $data) { + $productId = $data[$productLinkIdField]; + $value = $data['value']; + $position = $data['position']; + $storeId = $data['store_id']; + $mediaGalleryValueData[$index]['value_id'] = $productIdMediaValueIdMap[$productId][$value]; + $mediaGalleryValueData[$index]['position'] = $position + ($lastPositions[$storeId][$productId] ?? 0); + unset($mediaGalleryValueData[$index]['value']); } + return $mediaGalleryValueData; } /** @@ -289,13 +410,12 @@ private function initMediaGalleryResources() } /** - * Get the last media position for each product from the given list + * Get the last media position for each product per store from the given list * - * @param int $storeId * @param array $productIds * @return array */ - private function getLastMediaPositionPerProduct(int $storeId, array $productIds): array + private function getLastMediaPositionPerProduct(array $productIds): array { $result = []; if ($productIds) { @@ -305,95 +425,25 @@ private function getLastMediaPositionPerProduct(int $storeId, array $productIds) $positions = $this->connection->fetchAll( $this->connection ->select() - ->from($this->mediaGalleryValueTableName, [$productKeyName, 'position']) + ->from($this->mediaGalleryValueTableName, [$productKeyName, 'store_id', 'position']) ->where("$productKeyName IN (?)", $productIds) - ->where('value_id is not null') - ->where('store_id = ?', $storeId) ); - // Make sure the result contains all product ids even if the product has no media files - $result = array_fill_keys($productIds, 0); // Find the largest position for each product foreach ($positions as $record) { $productId = $record[$productKeyName]; - $result[$productId] = $result[$productId] < $record['position'] + $storeId = $record['store_id']; + if (!isset($result[$storeId][$productId])) { + $result[$storeId][$productId] = 0; + } + $result[$storeId][$productId] = $result[$storeId][$productId] < $record['position'] ? $record['position'] - : $result[$productId]; + : $result[$storeId][$productId]; } } return $result; } - /** - * Save media gallery data per store. - * - * @param int $storeId - * @param array $mediaGalleryData - * @param array $newMediaValues - * @param array $valueToProductId - * @return void - */ - private function processMediaPerStore( - int $storeId, - array $mediaGalleryData, - array $newMediaValues, - array $valueToProductId - ) { - $multiInsertData = []; - $dataForSkinnyTable = []; - $lastMediaPositionPerProduct = $this->getLastMediaPositionPerProduct( - $storeId, - array_unique(array_merge(...array_values($valueToProductId))) - ); - - foreach ($mediaGalleryData as $mediaGalleryRows) { - foreach ($mediaGalleryRows as $insertValue) { - foreach ($newMediaValues as $valueId => $values) { - if ($values['value'] == $insertValue['value']) { - $insertValue['value_id'] = $valueId; - $insertValue[$this->getProductEntityLinkField()] - = array_shift($valueToProductId[$values['value']]); - unset($newMediaValues[$valueId]); - break; - } - } - if (isset($insertValue['value_id'])) { - $productId = $insertValue[$this->getProductEntityLinkField()]; - $valueArr = [ - 'value_id' => $insertValue['value_id'], - 'store_id' => $storeId, - $this->getProductEntityLinkField() => $productId, - 'label' => $insertValue['label'], - 'position' => $lastMediaPositionPerProduct[$productId] + $insertValue['position'], - 'disabled' => $insertValue['disabled'], - ]; - $multiInsertData[] = $valueArr; - $dataForSkinnyTable[] = [ - 'value_id' => $insertValue['value_id'], - $this->getProductEntityLinkField() => $insertValue[$this->getProductEntityLinkField()], - ]; - } - } - } - try { - $this->connection->insertOnDuplicate( - $this->mediaGalleryValueTableName, - $multiInsertData, - ['value_id', 'store_id', $this->getProductEntityLinkField(), 'label', 'position', 'disabled'] - ); - $this->connection->insertOnDuplicate( - $this->mediaGalleryEntityToValueTableName, - $dataForSkinnyTable, - ['value_id'] - ); - } catch (\Exception $e) { - $this->connection->delete( - $this->mediaGalleryTableName, - $this->connection->quoteInto('value_id IN (?)', $newMediaValues) - ); - } - } - /** * Get product entity link field. * diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php index c47a4f340f983..855fcbb1f35ae 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php @@ -2833,4 +2833,111 @@ public function testChangeImageLabelForStoreView() $this->assertEquals($expectedImageFile, $imageItem->getFile()); $this->assertEquals($expectedLabelForSecondStoreView, $imageItem->getLabel()); } + + /** + * Test that configurable product images are imported correctly. + * + * @magentoDataFixture mediaImportImageFixture + * @magentoDataFixture Magento/Store/_files/core_fixturestore.php + * @magentoDataFixture Magento/ConfigurableProduct/_files/configurable_attribute.php + */ + public function testImportConfigurableProductImages() + { + $this->importDataForMediaTest('import_configurable_product_multistore.csv'); + $expected = [ + 'import-configurable-option-1' => [ + [ + 'file' => '/m/a/magento_image.jpg', + 'label' => 'Base Image Label - Option 1', + ], + [ + 'file' => '/m/a/magento_small_image.jpg', + 'label' => 'Small Image Label - Option 1', + ], + [ + 'file' => '/m/a/magento_thumbnail.jpg', + 'label' => 'Thumbnail Image Label - Option 1', + ], + [ + 'file' => '/m/a/magento_additional_image_one.jpg', + 'label' => '', + ], + ], + 'import-configurable-option-2' => [ + [ + 'file' => '/m/a/magento_image.jpg', + 'label' => 'Base Image Label - Option 2', + ], + [ + 'file' => '/m/a/magento_small_image.jpg', + 'label' => 'Small Image Label - Option 2', + ], + [ + 'file' => '/m/a/magento_thumbnail.jpg', + 'label' => 'Thumbnail Image Label - Option 2', + ], + [ + 'file' => '/m/a/magento_additional_image_two.jpg', + 'label' => '', + ], + ], + 'import-configurable' => [ + [ + 'file' => '/m/a/magento_image.jpg', + 'label' => 'Base Image Label - Configurable', + ], + [ + 'file' => '/m/a/magento_small_image.jpg', + 'label' => 'Small Image Label - Configurable', + ], + [ + 'file' => '/m/a/magento_thumbnail.jpg', + 'label' => 'Thumbnail Image Label - Configurable', + ], + [ + 'file' => '/m/a/magento_additional_image_three.jpg', + 'label' => '', + ], + ] + ]; + $actual = []; + $products = ['import-configurable-option-1', 'import-configurable-option-2', 'import-configurable']; + foreach ($products as $sku) { + $product = $this->getProductBySku($sku); + $gallery = $product->getMediaGalleryImages(); + foreach ($gallery->getItems() as $item) { + $actual[$sku][] = $item->toArray(['file', 'label']); + } + } + $this->assertEquals($expected, $actual); + + $expected['import-configurable'] = [ + [ + 'file' => '/m/a/magento_image.jpg', + 'label' => 'Base Image Label - Configurable (fixturestore)', + ], + [ + 'file' => '/m/a/magento_small_image.jpg', + 'label' => 'Small Image Label - Configurable (fixturestore)', + ], + [ + 'file' => '/m/a/magento_thumbnail.jpg', + 'label' => 'Thumbnail Image Label - Configurable (fixturestore)', + ], + [ + 'file' => '/m/a/magento_additional_image_three.jpg', + 'label' => '', + ], + ]; + + $actual = []; + foreach ($products as $sku) { + $product = $this->getProductBySku($sku, 'fixturestore'); + $gallery = $product->getMediaGalleryImages(); + foreach ($gallery->getItems() as $item) { + $actual[$sku][] = $item->toArray(['file', 'label']); + } + } + $this->assertEquals($expected, $actual); + } } diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/import_configurable_product_multistore.csv b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/import_configurable_product_multistore.csv new file mode 100644 index 0000000000000..c13e9b10e90ae --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/import_configurable_product_multistore.csv @@ -0,0 +1,5 @@ +"sku","store_view_code","product_type","categories","name","base_image","base_image_label","thumbnail_image","thumbnail_image_label","small_image","small_image_label","additional_images","weight","product_online","tax_class_name","visibility","price","url_key","allow_backorders","min_cart_qty","max_cart_qty","is_in_stock","additional_attributes","configurable_variations","configurable_variation_labels","qty","attribute_set_code" +"import-configurable-option-1",,"simple","Default Category","import-configurable-option-1","magento_image.jpg","Base Image Label - Option 1","magento_thumbnail.jpg","Thumbnail Image Label - Option 1","magento_small_image.jpg","Small Image Label - Option 1","magento_additional_image_one.jpg","1","1","Taxable Goods","Not Visible Individually","14.99","import-configurable-option-1-key","0","1","10","1","test_configurable=Option 1",,,"100","Default" +"import-configurable-option-2",,"simple","Default Category","import-configurable-option-2","magento_image.jpg","Base Image Label - Option 2","magento_thumbnail.jpg","Thumbnail Image Label - Option 2","magento_small_image.jpg","Small Image Label - Option 2","magento_additional_image_two.jpg","1","1","Taxable Goods","Not Visible Individually","14.99","import-configurable-option-2-key","0","1","10","1","test_configurable=Option 2",,,"100","Default" +"import-configurable",,"configurable","Default Category","import-configurable","magento_image.jpg","Base Image Label - Configurable","magento_thumbnail.jpg","Thumbnail Image Label - Configurable","magento_small_image.jpg","Small Image Label - Configurable","magento_additional_image_three.jpg","1","1","Taxable Goods","Catalog, Search","14.99","import-configurable-key","0",,,,,"sku=import-configurable-option-1,test_configurable=Option 1|sku=import-configurable-option-2,test_configurable=Option 2","test_configurable=test_configurable=test_configurable",,"Default" +"import-configurable","fixturestore","configurable",,"import-configurable (fixturestore)","magento_image.jpg","Base Image Label - Configurable (fixturestore)","magento_thumbnail.jpg","Thumbnail Image Label - Configurable (fixturestore)","magento_small_image.jpg","Small Image Label - Configurable (fixturestore)",,,,,,,,,,,,,,,,"Default" From 8ae8b6216234ff4b8c1a11e3176b14a334ee54cd Mon Sep 17 00:00:00 2001 From: Serhii Voloshkov <serhii.voloshkov@transoftgroup.com> Date: Fri, 20 Dec 2019 12:59:05 +0200 Subject: [PATCH 0549/1143] MC-21347: Remove Customer module's dependency on Review --- .../Customer/Controller/Review/Index.php | 4 +-- .../Customer/Controller/Review/View.php | 4 +-- .../Block/Adminhtml/Edit/Tab/Reviews.php | 6 ++-- .../Adminhtml/Customer/ProductReviews.php | 34 ++++++++++++++++--- .../Adminhtml/Customer/ProductReviewsTest.php | 2 +- 5 files changed, 39 insertions(+), 11 deletions(-) diff --git a/app/code/Magento/Customer/Controller/Review/Index.php b/app/code/Magento/Customer/Controller/Review/Index.php index a7884c1dc763e..df87ffe8c18f7 100644 --- a/app/code/Magento/Customer/Controller/Review/Index.php +++ b/app/code/Magento/Customer/Controller/Review/Index.php @@ -6,7 +6,7 @@ */ namespace Magento\Customer\Controller\Review; -use Magento\Framework\App\Action\HttpGetActionInterface; +use Magento\Customer\Controller\Review; /** * Deprecated class which was in use as main page in Customer Account "My Product Reviews" tab. @@ -14,6 +14,6 @@ * @deprecated Remove Customer module's dependency on Review. Non-used class. * @see \Magento\Review\Controller\Customer\Index */ -class Index extends \Magento\Customer\Controller\Review implements HttpGetActionInterface +class Index extends Review { } diff --git a/app/code/Magento/Customer/Controller/Review/View.php b/app/code/Magento/Customer/Controller/Review/View.php index f32c756fba1ca..d870810d77098 100644 --- a/app/code/Magento/Customer/Controller/Review/View.php +++ b/app/code/Magento/Customer/Controller/Review/View.php @@ -6,7 +6,7 @@ */ namespace Magento\Customer\Controller\Review; -use Magento\Framework\App\Action\HttpGetActionInterface; +use Magento\Customer\Controller\Review; /** * Deprecated class which was in use as view page in Customer Account "My Product Reviews" tab. @@ -14,6 +14,6 @@ * @deprecated Remove Customer module's dependency on Review. Non-used class. * @see \Magento\Review\Controller\Customer\View */ -class View extends \Magento\Customer\Controller\Review implements HttpGetActionInterface +class View extends Review { } diff --git a/app/code/Magento/Review/Block/Adminhtml/Edit/Tab/Reviews.php b/app/code/Magento/Review/Block/Adminhtml/Edit/Tab/Reviews.php index 8105b9f4994a0..15d41fad0a595 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Edit/Tab/Reviews.php +++ b/app/code/Magento/Review/Block/Adminhtml/Edit/Tab/Reviews.php @@ -7,17 +7,19 @@ namespace Magento\Review\Block\Adminhtml\Edit\Tab; +use Magento\Review\Block\Adminhtml\Grid; + /** * Review tab in adminhtml area. * * @api */ -class Reviews extends \Magento\Review\Block\Adminhtml\Grid +class Reviews extends Grid { /** * Hide grid mass action elements. * - * @return \Magento\Review\Block\Adminhtml\Edit\Tab\Reviews + * @return Reviews */ protected function _prepareMassaction() { diff --git a/app/code/Magento/Review/Controller/Adminhtml/Customer/ProductReviews.php b/app/code/Magento/Review/Controller/Adminhtml/Customer/ProductReviews.php index 63285b7242217..3ab49154a47a7 100644 --- a/app/code/Magento/Review/Controller/Adminhtml/Customer/ProductReviews.php +++ b/app/code/Magento/Review/Controller/Adminhtml/Customer/ProductReviews.php @@ -7,22 +7,48 @@ namespace Magento\Review\Controller\Adminhtml\Customer; +use Magento\Backend\App\Action; +use Magento\Backend\App\Action\Context; +use Magento\Customer\Model\CustomerIdProvider; use Magento\Framework\App\Action\HttpPostActionInterface; +use Magento\Framework\Controller\ResultFactory; +use Magento\Framework\View\Result\Layout; /** * Customer product reviews page. */ -class ProductReviews extends \Magento\Customer\Controller\Adminhtml\Index implements HttpPostActionInterface +class ProductReviews extends Action implements HttpPostActionInterface { + /** + * Authorization level of a basic admin session + * + * @see _isAllowed() + */ + const ADMIN_RESOURCE = 'Magento_Review::reviews_all'; + + /** @var CustomerIdProvider */ + private $customerIdProvider; + + /** + * @param Context $context + * @param CustomerIdProvider $customerIdProvider + */ + public function __construct(Context $context, CustomerIdProvider $customerIdProvider) + { + $this->customerIdProvider = $customerIdProvider; + parent::__construct($context); + } + /** * Get customer's product reviews list. * - * @return \Magento\Framework\View\Result\Layout + * @return Layout */ public function execute() { - $customerId = (int)$this->initCurrentCustomer(); - $resultLayout = $this->resultLayoutFactory->create(); + $customerId = $this->customerIdProvider->getCustomerId(); + /** @var \Magento\Framework\View\Result\Layout $resultLayout */ + $resultLayout = $this->resultFactory->create(ResultFactory::TYPE_LAYOUT); $block = $resultLayout->getLayout()->getBlock('admin.customer.reviews'); $block->setCustomerId($customerId)->setUseAjax(true); diff --git a/dev/tests/integration/testsuite/Magento/Review/Controller/Adminhtml/Customer/ProductReviewsTest.php b/dev/tests/integration/testsuite/Magento/Review/Controller/Adminhtml/Customer/ProductReviewsTest.php index cbd6617188a99..4203fb9c16b29 100644 --- a/dev/tests/integration/testsuite/Magento/Review/Controller/Adminhtml/Customer/ProductReviewsTest.php +++ b/dev/tests/integration/testsuite/Magento/Review/Controller/Adminhtml/Customer/ProductReviewsTest.php @@ -26,6 +26,6 @@ public function testProductReviewsAction(): void $this->getRequest()->setPostValue(['id' => 1])->setMethod(Http::METHOD_POST); $this->dispatch('backend/review/customer/productReviews'); $body = $this->getResponse()->getBody(); - $this->assertContains('<div id="reviwGrid"', $body); + $this->assertContains('<div id="reviewGrid"', $body); } } From f5db9f664bcc45f18adc54a2987970f27c2cb068 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Fri, 20 Dec 2019 12:24:34 +0200 Subject: [PATCH 0550/1143] Fix failed mftf test --- .../Magento/Backend/Controller/Adminhtml/Denied/Index.php | 1 - .../Test/Mftf/Test/AdminLoginWithRestrictPermissionTest.xml | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Denied/Index.php b/app/code/Magento/Backend/Controller/Adminhtml/Denied/Index.php index bfefab94f4836..c06c0a0f01650 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Denied/Index.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Denied/Index.php @@ -15,7 +15,6 @@ */ class Index extends Denied implements HttpGet, HttpPost { - /** * Check if user has permissions to access this controller * diff --git a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginWithRestrictPermissionTest.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginWithRestrictPermissionTest.xml index a4e132b8065d2..e664a4a5f3e2f 100644 --- a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginWithRestrictPermissionTest.xml +++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginWithRestrictPermissionTest.xml @@ -22,12 +22,12 @@ <before> <actionGroup ref="LoginAsAdmin" stepKey="logIn"/> <!--Create user role--> - <actionGroup ref="AdminFillUserRoleRequiredData" stepKey="fillUserRoleRequiredData"> + <actionGroup ref="AdminFillUserRoleRequiredDataActionGroup" stepKey="fillUserRoleRequiredData"> <argument name="User" value="adminRole"/> <argument name="restrictedRole" value="Media Gallery"/> </actionGroup> <actionGroup ref="AdminUserClickRoleResourceTabActionGroup" stepKey="switchToRoleResourceTab"/> - <actionGroup ref="AdminAddRestrictedRole" stepKey="addRestrictedRoleStores"> + <actionGroup ref="AdminAddRestrictedRoleActionGroup" stepKey="addRestrictedRoleStores"> <argument name="User" value="adminRole"/> <argument name="restrictedRole" value="Media Gallery"/> </actionGroup> From d4b68c72a1dd12db257f5eba6261f966a6d42e2f Mon Sep 17 00:00:00 2001 From: Gihovani Filipp <gihovani@gmail.com> Date: Fri, 20 Dec 2019 16:19:39 -0300 Subject: [PATCH 0551/1143] Remove blank space at the end of label Removed white space because in crowdin translation there is no space at end of text --- app/code/Magento/Cron/etc/adminhtml/system.xml | 2 +- app/code/Magento/Cron/i18n/en_US.csv | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Cron/etc/adminhtml/system.xml b/app/code/Magento/Cron/etc/adminhtml/system.xml index c8753f1b0b56f..cef45ba386be2 100644 --- a/app/code/Magento/Cron/etc/adminhtml/system.xml +++ b/app/code/Magento/Cron/etc/adminhtml/system.xml @@ -12,7 +12,7 @@ <label>Cron (Scheduled Tasks)</label> <comment>For correct URLs generated during cron runs please make sure that Web > Secure and Unsecure Base URLs are explicitly set. All the times are in minutes.</comment> <group id="template" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0"> - <label>Cron configuration options for group: </label> + <label>Cron configuration options for group:</label> <field id="schedule_generate_every" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> <label>Generate Schedules Every</label> <validate>validate-zero-or-greater validate-digits</validate> diff --git a/app/code/Magento/Cron/i18n/en_US.csv b/app/code/Magento/Cron/i18n/en_US.csv index b1969d7723315..df9aef7f13747 100644 --- a/app/code/Magento/Cron/i18n/en_US.csv +++ b/app/code/Magento/Cron/i18n/en_US.csv @@ -11,7 +11,7 @@ Monthly,Monthly "Test exception","Test exception" "Cron (Scheduled Tasks)","Cron (Scheduled Tasks)" "For correct URLs generated during cron runs please make sure that Web > Secure and Unsecure Base URLs are explicitly set. All the times are in minutes.","For correct URLs generated during cron runs please make sure that Web > Secure and Unsecure Base URLs are explicitly set. All the times are in minutes." -"Cron configuration options for group: ","Cron configuration options for group: " +"Cron configuration options for group:","Cron configuration options for group:" "Generate Schedules Every","Generate Schedules Every" "Schedule Ahead for","Schedule Ahead for" "Missed if Not Run Within","Missed if Not Run Within" From 0621d52235993e3eec4835490e1939af09137481 Mon Sep 17 00:00:00 2001 From: Ravi Chandra <ravi.chandra@krishtechnolabs.com> Date: Mon, 23 Dec 2019 10:34:31 +0530 Subject: [PATCH 0552/1143] Changing the data type for quote column customer_note --- app/code/Magento/Quote/etc/db_schema.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Quote/etc/db_schema.xml b/app/code/Magento/Quote/etc/db_schema.xml index d41591c619cde..44a5f275b4d9f 100644 --- a/app/code/Magento/Quote/etc/db_schema.xml +++ b/app/code/Magento/Quote/etc/db_schema.xml @@ -56,7 +56,7 @@ <column xsi:type="varchar" name="customer_lastname" nullable="true" length="255" comment="Customer Lastname"/> <column xsi:type="varchar" name="customer_suffix" nullable="true" length="40" comment="Customer Suffix"/> <column xsi:type="datetime" name="customer_dob" on_update="false" nullable="true" comment="Customer Dob"/> - <column xsi:type="varchar" name="customer_note" nullable="true" length="255" comment="Customer Note"/> + <column xsi:type="text" name="customer_note" nullable="true" comment="Customer Note"/> <column xsi:type="smallint" name="customer_note_notify" padding="5" unsigned="true" nullable="true" identity="false" default="1" comment="Customer Note Notify"/> <column xsi:type="smallint" name="customer_is_guest" padding="5" unsigned="true" nullable="true" From 20af9fcf6165ba42a70f9382a30ea7a92b53a7c8 Mon Sep 17 00:00:00 2001 From: Serhiy Yelahin <serhiy.yelahin@transoftgroup.com> Date: Mon, 23 Dec 2019 10:32:28 +0200 Subject: [PATCH 0553/1143] MC-29896: [QUESTION] Stretched Out Images --- .../view/frontend/web/template/product/image_with_borders.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/view/frontend/web/template/product/image_with_borders.html b/app/code/Magento/Catalog/view/frontend/web/template/product/image_with_borders.html index d59237c190f71..f8b8ede792566 100644 --- a/app/code/Magento/Catalog/view/frontend/web/template/product/image_with_borders.html +++ b/app/code/Magento/Catalog/view/frontend/web/template/product/image_with_borders.html @@ -6,6 +6,6 @@ --> <span class="product-image-container" data-bind="style: {width: width + 'px'}"> <span class="product-image-wrapper" data-bind="style: {'padding-bottom': height/width*100 + '%'}"> - <img class="product-image-photo" data-bind="attr: {src: src, alt: alt}, style: {width: width + 'px', height: height + 'px'}" /> + <img class="product-image-photo" data-bind="attr: {src: src, alt: alt}, style: {width: 'auto', height: 'auto'}" /> </span> </span> From 0802b480a0f29e3d9e609d33915abf8e4dbf2e10 Mon Sep 17 00:00:00 2001 From: divyajyothi5321 <54176640+divyajyothi5321@users.noreply.github.com> Date: Mon, 23 Dec 2019 14:09:27 +0530 Subject: [PATCH 0554/1143] added requested changes --- app/code/Magento/Wishlist/Controller/Index/Send.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Wishlist/Controller/Index/Send.php b/app/code/Magento/Wishlist/Controller/Index/Send.php index 2f1813cf886ed..283400a6f94ea 100644 --- a/app/code/Magento/Wishlist/Controller/Index/Send.php +++ b/app/code/Magento/Wishlist/Controller/Index/Send.php @@ -203,7 +203,7 @@ public function execute() $error = __('Please enter an email address.'); } else { if (count($emails) > $emailsLeft) { - $error = __('Maximum of %1 Emails can be Sent.', $emailsLeft); + $error = __('Maximum of %1 emails can be sent.', $emailsLeft); } else { foreach ($emails as $index => $email) { $email = trim($email); From ffab78e0cb1c2a73ffbded3cda0c75cd0ff9542d Mon Sep 17 00:00:00 2001 From: Ravi Chandra <ravi.chandra@krishtechnolabs.com> Date: Mon, 23 Dec 2019 14:34:26 +0530 Subject: [PATCH 0555/1143] Fixed Issue with tier price 0 when saving product second time --- .../Model/Product/Attribute/Backend/TierPrice/UpdateHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/UpdateHandler.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/UpdateHandler.php index 0daa1dfb5c8eb..065eb4abc5e8f 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/UpdateHandler.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/UpdateHandler.php @@ -129,7 +129,7 @@ private function updateValues(array $valuesToUpdate, array $oldValues): bool { $isChanged = false; foreach ($valuesToUpdate as $key => $value) { - if ((!empty($value['value']) + if ((($value['value'])!== null && (float)$oldValues[$key]['price'] !== $this->localeFormat->getNumber($value['value']) ) || $this->getPercentage($oldValues[$key]) !== $this->getPercentage($value) ) { From c188e03da4049a7e610d7f2c41497138ff5b1255 Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Mon, 23 Dec 2019 12:46:17 +0200 Subject: [PATCH 0556/1143] MC-25187: Session lost after switching stores on different domains --- .../Test/Mftf/Test/StorefrontShareWishlistEntityTest.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontShareWishlistEntityTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontShareWishlistEntityTest.xml index 87c5ed950949f..bb566ef2d03a4 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontShareWishlistEntityTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontShareWishlistEntityTest.xml @@ -26,6 +26,10 @@ <requiredEntity createDataKey="category"/> </createData> <createData entity="Simple_US_Customer" stepKey="customer"/> + + <!-- Perform reindex and flush cache --> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> </before> <after> <deleteData createDataKey="category" stepKey="deleteCategory"/> From 0c72dd4fa81554dda63c6354161a4351bb8a06cc Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Mon, 23 Dec 2019 15:28:15 +0200 Subject: [PATCH 0557/1143] MC-24268: MFTF\Integration\WebApi Tests failed if magento installed with 'db-prefix' --- .../Catalog/Model/Indexer/Category/Flat/Action/Full.php | 5 +++-- .../Catalog/Model/Indexer/Product/Flat/AbstractAction.php | 2 +- .../Model/ResourceModel/GetPurchasedDownloadableProducts.php | 4 ++-- .../Model/CategoryUrlRewriteGeneratorTest.php | 2 +- .../testsuite/Magento/Webapi/_files/webapi_user.php | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Action/Full.php b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Action/Full.php index a62e3d8f83b85..57fb3d64dea4a 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Action/Full.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Action/Full.php @@ -79,6 +79,7 @@ protected function populateFlatTables(array $stores) } $category['store_id'] = $store->getId(); $data[] = $this->prepareValuesToInsert( + // phpcs:ignore Magento2.Performance.ForeachArrayMerge array_merge($category, $attributesData[$category[$linkField]]) ); } @@ -183,7 +184,7 @@ private function getActualStoreTablesForCategoryFlat(): array foreach ($this->storeManager->getStores() as $store) { $actualStoreTables[] = sprintf( '%s_store_%s', - $this->connection->getTableName('catalog_category_flat'), + $this->connection->getTableName($this->getTableName('catalog_category_flat')), $store->getId() ); } @@ -199,7 +200,7 @@ private function getActualStoreTablesForCategoryFlat(): array private function deleteAbandonedStoreCategoryFlatTables(): void { $existentTables = $this->connection->getTables( - $this->connection->getTableName('catalog_category_flat_store_%') + $this->connection->getTableName($this->getTableName('catalog_category_flat_store_%')) ); $actualStoreTables = $this->getActualStoreTablesForCategoryFlat(); diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/AbstractAction.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/AbstractAction.php index a0acacd4dfd2f..565ac1b121980 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/AbstractAction.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/AbstractAction.php @@ -222,7 +222,7 @@ protected function _updateRelationProducts($storeId, $productIds = null) ['t' => $this->_productIndexerHelper->getTable($relation->getTable())], ['entity_table.entity_id', $relation->getChildFieldName(), new \Zend_Db_Expr('1')] )->join( - ['entity_table' => $this->_connection->getTableName('catalog_product_entity')], + ['entity_table' => $this->_productIndexerHelper->getTable('catalog_product_entity')], "entity_table.{$metadata->getLinkField()} = t.{$relation->getParentFieldName()}", [] )->join( diff --git a/app/code/Magento/DownloadableGraphQl/Model/ResourceModel/GetPurchasedDownloadableProducts.php b/app/code/Magento/DownloadableGraphQl/Model/ResourceModel/GetPurchasedDownloadableProducts.php index 82f448ec450f6..4bbdfdb360415 100644 --- a/app/code/Magento/DownloadableGraphQl/Model/ResourceModel/GetPurchasedDownloadableProducts.php +++ b/app/code/Magento/DownloadableGraphQl/Model/ResourceModel/GetPurchasedDownloadableProducts.php @@ -39,13 +39,13 @@ public function execute(int $customerId): array { $connection = $this->resourceConnection->getConnection(); $allowedItemsStatuses = [Item::LINK_STATUS_PENDING_PAYMENT, Item::LINK_STATUS_PAYMENT_REVIEW]; - $downloadablePurchasedTable = $connection->getTableName('downloadable_link_purchased'); + $downloadablePurchasedTable = $this->resourceConnection->getTableName('downloadable_link_purchased'); /* The fields names are hardcoded since there's no existing name reference in the code */ $selectQuery = $connection->select() ->from($downloadablePurchasedTable) ->joinLeft( - ['item' => $connection->getTableName('downloadable_link_purchased_item')], + ['item' => $this->resourceConnection->getTableName('downloadable_link_purchased_item')], "$downloadablePurchasedTable.purchased_id = item.purchased_id" ) ->where("$downloadablePurchasedTable.customer_id = ?", $customerId) diff --git a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php index b6fa2fac2ca80..67a1e0bb43ecb 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php @@ -351,7 +351,7 @@ private function getCountOfRewrites($productId, $categoryId): string $model = $this->objectManager->get(Product::class); $connection = $model->getConnection(); $select = $connection->select(); - $select->from(Product::TABLE_NAME, 'COUNT(*)'); + $select->from($model->getTable(Product::TABLE_NAME), 'COUNT(*)'); $select->where('category_id = ?', $categoryId); $select->where('product_id = ?', $productId); return $connection->fetchOne($select); diff --git a/dev/tests/integration/testsuite/Magento/Webapi/_files/webapi_user.php b/dev/tests/integration/testsuite/Magento/Webapi/_files/webapi_user.php index 63479bee9cf6d..50204998c7da3 100644 --- a/dev/tests/integration/testsuite/Magento/Webapi/_files/webapi_user.php +++ b/dev/tests/integration/testsuite/Magento/Webapi/_files/webapi_user.php @@ -15,7 +15,7 @@ ->create(Magento\Framework\App\ResourceConnection::class); $adapter = $connection->getConnection(); $select = $adapter->select() - ->from('authorization_role', ['role_id']) + ->from($connection->getTableName('authorization_role'), ['role_id']) ->where('role_name = ?', 'Administrators') ->where('parent_id = ?', 0) ->limit(1); From 526817cb1919b722eeb3c27562ed277b7530fb20 Mon Sep 17 00:00:00 2001 From: Yaroslav Rogoza <enarc@atwix.com> Date: Mon, 23 Dec 2019 17:57:26 +0100 Subject: [PATCH 0558/1143] Jasmine test coverage --- .../lib/jquery/jstree/jquery.hotkeys.test.js | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 dev/tests/js/jasmine/tests/lib/jquery/jstree/jquery.hotkeys.test.js diff --git a/dev/tests/js/jasmine/tests/lib/jquery/jstree/jquery.hotkeys.test.js b/dev/tests/js/jasmine/tests/lib/jquery/jstree/jquery.hotkeys.test.js new file mode 100644 index 0000000000000..b9d8ab1d4a82c --- /dev/null +++ b/dev/tests/js/jasmine/tests/lib/jquery/jstree/jquery.hotkeys.test.js @@ -0,0 +1,73 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +define([ + 'jquery', + 'jquery/jstree/jquery.hotkeys' +], function ($) { + 'use strict'; + + describe('Test for jquery/jstree/jquery.hotkeys', function () { + var divElement = $('<div></div>'), + divBodyAfterTrigger = 'pressed', + inputNumberElement = $('<input type="number">'); + + beforeAll(function () { + $(document).bind('keyup', 'right', function () { + // Change element body to track a trigger action + divElement.html(divBodyAfterTrigger); + }); + + $(document).bind('keyup', 'left', function () { + // Change element body to track a trigger action + divElement.html(divBodyAfterTrigger); + }); + + }); + + beforeEach(function () { + inputNumberElement.appendTo(document.body); + divElement.appendTo(document.body); + }); + + afterEach(function () { + divElement.remove(); + inputNumberElement.remove(); + }); + + it('Check "left key" hotkey is not being processed when number input is focused', function () { + var keypress = $.Event("keyup"); + keypress.which = 37; // "left arrow" key + inputNumberElement.trigger(keypress); + + expect(divElement.html()).toEqual(''); + }); + + it('Check "right key" hotkey is not being processed when number input is focused', function () { + var keypress = $.Event("keyup"); + keypress.which = 39; // "right arrow" key + inputNumberElement.trigger(keypress); + + expect(divElement.html()).toEqual(''); + }); + + it('Check "left key" hotkey is being processed when registered on the page', function () { + var keypress = $.Event("keyup"); + keypress.which = 37; // "left arrow" key + divElement.trigger(keypress); + + expect(divElement.html()).toEqual(divBodyAfterTrigger); + }); + + it('Check "right key" hotkey is being processed when registered on the page', function () { + var keypress = $.Event("keyup"); + keypress.which = 39; // "right arrow" key + $('body').trigger(keypress); + + expect(divElement.html()).toEqual(divBodyAfterTrigger); + }); + + }); +}); From 80398d0386391c0d5f626c3dc9f774fecf6c6b98 Mon Sep 17 00:00:00 2001 From: pawankparmar <comp1@comp1-All-Series> Date: Tue, 24 Dec 2019 10:44:54 +0530 Subject: [PATCH 0559/1143] Adjust space b/w Short and Long Description --- .../Api/Data/ProductRender/FormattedPriceInfoInterface.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/code/Magento/Catalog/Api/Data/ProductRender/FormattedPriceInfoInterface.php b/app/code/Magento/Catalog/Api/Data/ProductRender/FormattedPriceInfoInterface.php index 65ff84ef719f0..abcc4bfe4ede2 100644 --- a/app/code/Magento/Catalog/Api/Data/ProductRender/FormattedPriceInfoInterface.php +++ b/app/code/Magento/Catalog/Api/Data/ProductRender/FormattedPriceInfoInterface.php @@ -29,6 +29,7 @@ public function getFinalPrice(); /** * Set the final price: usually it calculated as minimal price of the product + * * Can be different depends on type of product * * @param string $finalPrice @@ -39,6 +40,7 @@ public function setFinalPrice($finalPrice); /** * Retrieve max price of a product + * * E.g. for product with custom options is price with the most expensive custom option * * @return string @@ -57,6 +59,7 @@ public function setMaxPrice($maxPrice); /** * Retrieve the minimal price of the product or variation + * * The minimal price is for example, the lowest price of all variations for complex product * * @return string @@ -130,6 +133,7 @@ public function setMinimalPrice($minimalPrice); /** * Regular price - is price of product without discounts and special price with taxes and fixed product tax + * * Usually this price is corresponding to price in admin panel of product * * @return string From f49510b06beda972ae031a2a53764ff9cd14592d Mon Sep 17 00:00:00 2001 From: pawankparmar <comp1@comp1-All-Series> Date: Tue, 24 Dec 2019 11:49:02 +0530 Subject: [PATCH 0560/1143] Remove Whitespace --- .../Data/ProductRender/FormattedPriceInfoInterface.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Catalog/Api/Data/ProductRender/FormattedPriceInfoInterface.php b/app/code/Magento/Catalog/Api/Data/ProductRender/FormattedPriceInfoInterface.php index abcc4bfe4ede2..d111de1b04b94 100644 --- a/app/code/Magento/Catalog/Api/Data/ProductRender/FormattedPriceInfoInterface.php +++ b/app/code/Magento/Catalog/Api/Data/ProductRender/FormattedPriceInfoInterface.php @@ -29,7 +29,7 @@ public function getFinalPrice(); /** * Set the final price: usually it calculated as minimal price of the product - * + * * Can be different depends on type of product * * @param string $finalPrice @@ -40,7 +40,7 @@ public function setFinalPrice($finalPrice); /** * Retrieve max price of a product - * + * * E.g. for product with custom options is price with the most expensive custom option * * @return string @@ -59,7 +59,7 @@ public function setMaxPrice($maxPrice); /** * Retrieve the minimal price of the product or variation - * + * * The minimal price is for example, the lowest price of all variations for complex product * * @return string @@ -133,7 +133,7 @@ public function setMinimalPrice($minimalPrice); /** * Regular price - is price of product without discounts and special price with taxes and fixed product tax - * + * * Usually this price is corresponding to price in admin panel of product * * @return string From e50c17fb6f3adb9271712a3d025b321798cc6be3 Mon Sep 17 00:00:00 2001 From: Viktor Petryk <victor.petryk@transoftgroup.com> Date: Tue, 24 Dec 2019 09:31:06 +0200 Subject: [PATCH 0561/1143] MC-29023: Custom attribute values cannot be saved in Admin panel --- .../Product/AddAttributeToTemplate.php | 18 +++- ...nExpandProductAttributesTabActionGroup.xml | 19 ++++ ...nPresentInLayeredNavigationActionGroup.xml | 26 ++++++ .../StorefrontCategorySidebarSection.xml | 4 +- ...tomAttributeValuesAfterProductSaveTest.xml | 91 +++++++++++++++++++ 5 files changed, 153 insertions(+), 5 deletions(-) create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminExpandProductAttributesTabActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontAttributeOptionPresentInLayeredNavigationActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckCustomAttributeValuesAfterProductSaveTest.xml diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/AddAttributeToTemplate.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/AddAttributeToTemplate.php index a05602403e08f..21312e4614dc3 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/AddAttributeToTemplate.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/AddAttributeToTemplate.php @@ -17,9 +17,11 @@ use Magento\Eav\Api\Data\AttributeGroupInterfaceFactory; use Magento\Eav\Api\Data\AttributeInterface; use Magento\Eav\Api\Data\AttributeSetInterface; +use Magento\Eav\Model\Cache\Type as CacheType; use Magento\Framework\Api\ExtensionAttributesFactory; use Magento\Framework\Api\SearchCriteriaBuilder; use Magento\Framework\App\Action\HttpPostActionInterface; +use Magento\Framework\App\CacheInterface; use Magento\Framework\App\ObjectManager; use Magento\Framework\Controller\Result\Json; use Magento\Framework\Controller\Result\JsonFactory; @@ -29,7 +31,7 @@ use Psr\Log\LoggerInterface; /** - * Class AddAttributeToTemplate + * Assign attribute to attribute set. * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ @@ -80,6 +82,11 @@ class AddAttributeToTemplate extends Product implements HttpPostActionInterface */ protected $extensionAttributesFactory; + /** + * @var CacheInterface + */ + private $cache; + /** * Constructor * @@ -94,8 +101,8 @@ class AddAttributeToTemplate extends Product implements HttpPostActionInterface * @param AttributeManagementInterface $attributeManagement * @param LoggerInterface $logger * @param ExtensionAttributesFactory $extensionAttributesFactory + * @param CacheInterface|null $cache * @SuppressWarnings(PHPMD.ExcessiveParameterList) - * @SuppressWarnings(PHPMD.LongVariable) * @SuppressWarnings(PHPMD.NPathComplexity) */ public function __construct( @@ -109,7 +116,8 @@ public function __construct( SearchCriteriaBuilder $searchCriteriaBuilder = null, AttributeManagementInterface $attributeManagement = null, LoggerInterface $logger = null, - ExtensionAttributesFactory $extensionAttributesFactory = null + ExtensionAttributesFactory $extensionAttributesFactory = null, + CacheInterface $cache = null ) { parent::__construct($context, $productBuilder); $this->resultJsonFactory = $resultJsonFactory; @@ -129,6 +137,7 @@ public function __construct( ->get(LoggerInterface::class); $this->extensionAttributesFactory = $extensionAttributesFactory ?: ObjectManager::getInstance() ->get(ExtensionAttributesFactory::class); + $this->cache = $cache ?? ObjectManager::getInstance()->get(CacheInterface::class); } /** @@ -203,6 +212,7 @@ function (AttributeInterface $attribute) use ($attributeSet, $attributeGroup) { ); } ); + $this->cache->clean([CacheType::CACHE_TAG]); } catch (LocalizedException $e) { $response->setError(true); $response->setMessage($e->getMessage()); @@ -223,7 +233,7 @@ function (AttributeInterface $attribute) use ($attributeSet, $attributeGroup) { */ private function getBasicAttributeSearchCriteriaBuilder() { - $attributeIds = (array) $this->getRequest()->getParam('attributeIds', []); + $attributeIds = (array)$this->getRequest()->getParam('attributeIds', []); if (empty($attributeIds['selected'])) { throw new LocalizedException(__('Attributes were missing and must be specified.')); diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminExpandProductAttributesTabActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminExpandProductAttributesTabActionGroup.xml new file mode 100644 index 0000000000000..a423681c0a490 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminExpandProductAttributesTabActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminExpandProductAttributesTabActionGroup"> + <annotations> + <description>Expands the 'Attributes' tab on the Admin Product page.</description> + </annotations> + + <scrollTo selector="{{AdminProductAttributeSection.attributeSectionHeader}}" stepKey="scrollToAttributesTab"/> + <conditionalClick selector="{{AdminProductAttributeSection.attributeSectionHeader}}" dependentSelector="{{AdminProductAttributeSection.attributeSection}}" visible="false" stepKey="expandAttributesTab"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontAttributeOptionPresentInLayeredNavigationActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontAttributeOptionPresentInLayeredNavigationActionGroup.xml new file mode 100644 index 0000000000000..46d017b9094e8 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontAttributeOptionPresentInLayeredNavigationActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertStorefrontAttributeOptionPresentInLayeredNavigationActionGroup"> + <annotations> + <description>Clicks on the attribute label. Checks for attribute option presence.</description> + </annotations> + <arguments> + <argument name="attributeLabel" type="string" defaultValue="{{ProductAttributeFrontendLabel.label}}"/> + <argument name="attributeOptionLabel" type="string" defaultValue="{{Option1Store0.label}}"/> + <argument name="attributeOptionPosition" type="string" defaultValue="1"/> + </arguments> + + <waitForElementVisible selector="{{StorefrontCategorySidebarSection.filterOptionsTitle(attributeLabel)}}" stepKey="waitForAttributeVisible"/> + <conditionalClick selector="{{StorefrontCategorySidebarSection.filterOptionsTitle(attributeLabel)}}" dependentSelector="{{StorefrontCategorySidebarSection.activeFilterOptions}}" visible="false" stepKey="clickToExpandAttribute"/> + <waitForElementVisible selector="{{StorefrontCategorySidebarSection.activeFilterOptions}}" stepKey="waitForAttributeOptionsVisible"/> + <see selector="{{StorefrontCategorySidebarSection.activeFilterOptionItemByPosition(attributeOptionPosition)}}" userInput="{{attributeOptionLabel}}" stepKey="assertAttributeOptionInLayeredNavigation"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategorySidebarSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategorySidebarSection.xml index 2ec7997f87b7e..d629441782551 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategorySidebarSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategorySidebarSection.xml @@ -15,8 +15,10 @@ <element name="optionQty" type="text" selector=".filter-options-content .item .count"/> <element name="filterOptionByLabel" type="button" selector=" div.filter-options-item div[option-label='{{optionLabel}}']" parameterized="true"/> <element name="removeFilter" type="button" selector="div.filter-current .remove"/> + <element name="activeFilterOptions" type="text" selector=".filter-options-item.active .items"/> + <element name="activeFilterOptionItemByPosition" type="text" selector=".filter-options-item.active .items li:nth-child({{itemPosition}}) a" parameterized="true"/> </section> <section name="StorefrontCategorySidebarMobileSection"> <element name="shopByButton" type="button" selector="//div[contains(@class, 'filter-title')]/strong[contains(text(), 'Shop By')]"/> </section> -</sections> \ No newline at end of file +</sections> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckCustomAttributeValuesAfterProductSaveTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckCustomAttributeValuesAfterProductSaveTest.xml new file mode 100644 index 0000000000000..7c6f6ab66f63d --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckCustomAttributeValuesAfterProductSaveTest.xml @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCheckCustomAttributeValuesAfterProductSaveTest"> + <annotations> + <features value="Catalog"/> + <stories value="Product attributes"/> + <title value="Saving custom attribute values using UI"/> + <description value="Checks that saved custom attribute values are reflected on the product's edit page"/> + <severity value="MAJOR"/> + <testCaseId value="MC-29653"/> + <useCaseId value="MC-29023"/> + <group value="catalog"/> + </annotations> + <before> + <!-- Create multi select product attribute --> + <createData entity="productAttributeMultiselectTwoOptions" stepKey="createMultiSelectProductAttribute"/> + <!-- Add options to created product attribute --> + <createData entity="productAttributeOption1" stepKey="addFirstOptionToAttribute"> + <requiredEntity createDataKey="createMultiSelectProductAttribute"/> + </createData> + <createData entity="productAttributeOption2" stepKey="addSecondOptionToAttribute"> + <requiredEntity createDataKey="createMultiSelectProductAttribute"/> + </createData> + <createData entity="productAttributeOption3" stepKey="addThirdOptionToAttribute"> + <requiredEntity createDataKey="createMultiSelectProductAttribute"/> + </createData> + <!-- Create simple product --> + <createData entity="SimpleProduct2" stepKey="createSimpleProduct"/> + <magentoCLI command="indexer:reindex" arguments="catalogsearch_fulltext" stepKey="reindexCatalogSearch"/> + <!-- Login to Admin page --> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <!-- Delete created entities --> + <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> + <deleteData createDataKey="createMultiSelectProductAttribute" stepKey="deleteMultiSelectProductAttribute"/> + <!-- Logout from Admin page --> + <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + </after> + + <!-- Open created product for edit --> + <amOnPage url="{{AdminProductEditPage.url($createSimpleProduct.id$)}}" stepKey="goToProductEditPage"/> + <waitForPageLoad stepKey="waitForProductPageLoad"/> + + <!-- Add created attribute to the product --> + <actionGroup ref="AddProductAttributeInProductModalActionGroup" stepKey="addAttributeToProduct"> + <argument name="attributeCode" value="$createMultiSelectProductAttribute.attribute_code$"/> + </actionGroup> + <waitForPageLoad stepKey="waitForAttributeAdded"/> + + <!-- Expand 'Attributes' tab --> + <actionGroup ref="AdminExpandProductAttributesTabActionGroup" stepKey="expandAttributesTab"/> + <!-- Check created attribute presents in the 'Attributes' tab --> + <seeElement selector="{{AdminProductAttributesSection.attributeDropdownByCode($createMultiSelectProductAttribute.attribute_code$)}}" stepKey="assertAttributeIsPresentInTab"/> + <!-- Select attribute options --> + <selectOption selector="{{AdminProductAttributesSection.attributeDropdownByCode($createMultiSelectProductAttribute.attribute_code$)}}" parameterArray="[$addFirstOptionToAttribute.option[store_labels][0][label]$, $addThirdOptionToAttribute.option[store_labels][0][label]$]" stepKey="selectAttributeOptions"/> + <!-- Save product --> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductForm"/> + + <!-- Check attribute options are selected --> + <actionGroup ref="AdminExpandProductAttributesTabActionGroup" stepKey="expandAttributesTabAfterProductSave"/> + <seeOptionIsSelected selector="{{AdminProductAttributesSection.attributeDropdownByCode($createMultiSelectProductAttribute.attribute_code$)}}" userInput="$addFirstOptionToAttribute.option[store_labels][0][label]$" stepKey="assertFirstOptionIsSelected"/> + <seeOptionIsSelected selector="{{AdminProductAttributesSection.attributeDropdownByCode($createMultiSelectProductAttribute.attribute_code$)}}" userInput="$addThirdOptionToAttribute.option[store_labels][0][label]$" stepKey="assertThirdOptionIsSelected"/> + + <!-- Search for the product on Storefront --> + <amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToHomePage"/> + <waitForPageLoad stepKey="waitForHomePageLoad"/> + <actionGroup ref="StorefrontCheckQuickSearchActionGroup" stepKey="searchProductOnStorefront"> + <argument name="phrase" value="$createSimpleProduct.name$"/> + </actionGroup> + + <!-- Assert that attribute values present in layered navigation --> + <actionGroup ref="AssertStorefrontAttributeOptionPresentInLayeredNavigationActionGroup" stepKey="assertFirstAttributeOptionPresence"> + <argument name="attributeLabel" value="$createMultiSelectProductAttribute.attribute[frontend_labels][0][label]$"/> + <argument name="attributeOptionLabel" value="$addFirstOptionToAttribute.option[store_labels][0][label]$"/> + <argument name="attributeOptionPosition" value="1"/> + </actionGroup> + <actionGroup ref="AssertStorefrontAttributeOptionPresentInLayeredNavigationActionGroup" stepKey="assertThirdAttributeOptionPresence"> + <argument name="attributeLabel" value="$createMultiSelectProductAttribute.attribute[frontend_labels][0][label]$"/> + <argument name="attributeOptionLabel" value="$addThirdOptionToAttribute.option[store_labels][0][label]$"/> + <argument name="attributeOptionPosition" value="2"/> + </actionGroup> + </test> +</tests> From 9882e96dab666d5609e47af52d7130e5c33a7a6c Mon Sep 17 00:00:00 2001 From: divyajyothi5321 <54176640+divyajyothi5321@users.noreply.github.com> Date: Tue, 24 Dec 2019 14:24:55 +0530 Subject: [PATCH 0562/1143] Added Fix for issue 26168 --- .../web/css/source/module/checkout/_payments.less | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_payments.less b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_payments.less index eb9c069053661..494483ff60dda 100644 --- a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_payments.less +++ b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_payments.less @@ -133,6 +133,10 @@ .lib-css(line-height, @checkout-billing-address-details__line-height); .lib-css(padding, @checkout-billing-address-details__padding); } + + input[type="checkbox"] { + vertical-align: top; + } } .payment-method-note { From a729f62278afff3c79cdfb7998a1f5a8446b3d0a Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Tue, 24 Dec 2019 12:35:44 +0200 Subject: [PATCH 0563/1143] MC-24239: [Integration Test] CategoryTree::getTree() returns all the child categories --- .../integration/testsuite/Magento/Sales/_files/quotes.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/quotes.php b/dev/tests/integration/testsuite/Magento/Sales/_files/quotes.php index 508563df2d5c0..bd0ae81b15862 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/quotes.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/quotes.php @@ -5,6 +5,7 @@ */ declare(strict_types=1); +use Magento\Framework\App\Config; use Magento\Store\Model\StoreRepository; use Magento\Quote\Model\QuoteFactory; use Magento\Quote\Model\Quote; @@ -23,6 +24,9 @@ $quoteRepository = $objectManager->get(QuoteRepository::class); /** @var StoreRepository $storeRepository */ $storeRepository = $objectManager->get(StoreRepository::class); +/** @var Config $appConfig */ +$appConfig = $objectManager->get(Config::class); +$appConfig->clean(); /** @var Store $defaultStore */ $defaultStore = $storeRepository->getActiveStoreByCode('default'); From 216d2c127c311244f52b5530286b2679488ed033 Mon Sep 17 00:00:00 2001 From: divyajyothi5321 <54176640+divyajyothi5321@users.noreply.github.com> Date: Tue, 24 Dec 2019 18:12:20 +0530 Subject: [PATCH 0564/1143] Added Fix for 26164 --- .../luma/Magento_Checkout/web/css/source/module/_cart.less | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_cart.less b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_cart.less index cbf1d185a5a08..87990c3e48280 100644 --- a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_cart.less +++ b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_cart.less @@ -267,6 +267,10 @@ .lib-icon-font-symbol( @_icon-font-content: @icon-trash ); + + &:hover { + .lib-css(text-decoration, @link__text-decoration); + } } } From 666d4c0ff2b3a498d97acd101ae1ec86592bee70 Mon Sep 17 00:00:00 2001 From: Ravi Chandra <ravi.chandra@krishtechnolabs.com> Date: Tue, 24 Dec 2019 18:29:37 +0530 Subject: [PATCH 0565/1143] Fixed Special Price class not added in configurable product page --- app/code/Magento/Swatches/view/base/web/js/swatch-renderer.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Swatches/view/base/web/js/swatch-renderer.js b/app/code/Magento/Swatches/view/base/web/js/swatch-renderer.js index 894a4518f4de8..c80962a44d0dc 100644 --- a/app/code/Magento/Swatches/view/base/web/js/swatch-renderer.js +++ b/app/code/Magento/Swatches/view/base/web/js/swatch-renderer.js @@ -952,6 +952,8 @@ define([ isShow = typeof result != 'undefined' && result.oldPrice.amount !== result.finalPrice.amount; + $productPrice.find('span:first').toggleClass('special-price',isShow); + $product.find(this.options.slyOldPriceSelector)[isShow ? 'show' : 'hide'](); if (typeof result != 'undefined' && result.tierPrices && result.tierPrices.length) { From c0373016d4da3e154f7a65cbe2987cc5319fe6b5 Mon Sep 17 00:00:00 2001 From: Yaroslav Rogoza <enarc@atwix.com> Date: Tue, 24 Dec 2019 17:30:27 +0100 Subject: [PATCH 0566/1143] Code style fixes --- .../lib/jquery/jstree/jquery.hotkeys.test.js | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/dev/tests/js/jasmine/tests/lib/jquery/jstree/jquery.hotkeys.test.js b/dev/tests/js/jasmine/tests/lib/jquery/jstree/jquery.hotkeys.test.js index b9d8ab1d4a82c..6041b70abc7f7 100644 --- a/dev/tests/js/jasmine/tests/lib/jquery/jstree/jquery.hotkeys.test.js +++ b/dev/tests/js/jasmine/tests/lib/jquery/jstree/jquery.hotkeys.test.js @@ -15,15 +15,15 @@ define([ inputNumberElement = $('<input type="number">'); beforeAll(function () { - $(document).bind('keyup', 'right', function () { - // Change element body to track a trigger action + /** + * Insert text to the divElement + */ + var addHtmlToDivElement = function () { divElement.html(divBodyAfterTrigger); - }); + }; - $(document).bind('keyup', 'left', function () { - // Change element body to track a trigger action - divElement.html(divBodyAfterTrigger); - }); + $(document).bind('keyup', 'right', addHtmlToDivElement); + $(document).bind('keyup', 'left', addHtmlToDivElement); }); @@ -38,7 +38,8 @@ define([ }); it('Check "left key" hotkey is not being processed when number input is focused', function () { - var keypress = $.Event("keyup"); + var keypress = $.Event('keyup'); + keypress.which = 37; // "left arrow" key inputNumberElement.trigger(keypress); @@ -46,7 +47,8 @@ define([ }); it('Check "right key" hotkey is not being processed when number input is focused', function () { - var keypress = $.Event("keyup"); + var keypress = $.Event('keyup'); + keypress.which = 39; // "right arrow" key inputNumberElement.trigger(keypress); @@ -54,7 +56,8 @@ define([ }); it('Check "left key" hotkey is being processed when registered on the page', function () { - var keypress = $.Event("keyup"); + var keypress = $.Event('keyup'); + keypress.which = 37; // "left arrow" key divElement.trigger(keypress); @@ -62,7 +65,8 @@ define([ }); it('Check "right key" hotkey is being processed when registered on the page', function () { - var keypress = $.Event("keyup"); + var keypress = $.Event('keyup'); + keypress.which = 39; // "right arrow" key $('body').trigger(keypress); From feceb401df48f199acc2b5a7f7e1a0a5400a65bc Mon Sep 17 00:00:00 2001 From: DmitryTsymbal <d.tsymbal@atwix.com> Date: Wed, 25 Dec 2019 18:39:12 +0200 Subject: [PATCH 0567/1143] Delete Product URL Rewrite --- ...AdminDeleteProductURLRewriteEntityTest.xml | 57 +++++++++++++++++++ .../DeleteProductUrlRewriteEntityTest.xml | 1 + 2 files changed, 58 insertions(+) create mode 100644 app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteProductURLRewriteEntityTest.xml diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteProductURLRewriteEntityTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteProductURLRewriteEntityTest.xml new file mode 100644 index 0000000000000..f9c57a0c0bf4c --- /dev/null +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteProductURLRewriteEntityTest.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminDeleteProductURLRewriteEntityTest"> + <annotations> + <stories value="Delete Product UrlRewrite"/> + <title value="Delete created product URL rewrite"/> + <description value="Login as admin, create product with category and UrlRewrite, delete created URL rewrite"/> + <group value="mtf_migrated"/> + </annotations> + + <before> + <actionGroup ref="LoginAsAdmin" stepKey="login"/> + <createData entity="SimpleSubCategory" stepKey="createCategory"/> + <createData entity="SimpleProduct" stepKey="createSimpleProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + </before> + <after> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <!--Filter and Select the created Product --> + <actionGroup ref="AdminSearchUrlRewriteProductBySkuActionGroup" stepKey="searchProduct"> + <argument name="productSku" value="$$createSimpleProduct.sku$$"/> + </actionGroup> + + <!-- Update the Store, RequestPath, RedirectType and Description --> + <actionGroup ref="AdminAddUrlRewriteForProductActionGroup" stepKey="addUrlRewrite"> + <argument name="storeValue" value="Default Store View"/> + <argument name="requestPath" value="{{FirstLevelSubCat.name_lwr}}/{{_defaultProduct.urlKey}}.html"/> + <argument name="redirectTypeValue" value="Temporary (302)"/> + <argument name="description" value="End To End Test"/> + </actionGroup> + + <!--Delete Created Rewrite, Assert Success Message --> + <actionGroup ref="AdminDeleteUrlRewriteActionGroup" stepKey="deleteCreatedRewrite"> + <argument name="requestPath" value="{{FirstLevelSubCat.name_lwr}}/{{_defaultProduct.urlKey}}.html"/> + </actionGroup> + <!-- Assert Deleted Rewrite is Not in Grid --> + <actionGroup ref="AdminSearchDeletedUrlRewriteActionGroup" stepKey="searchDeletedURLRewriteInGrid"> + <argument name="requestPath" value="{{FirstLevelSubCat.name_lwr}}/{{_defaultProduct.urlKey}}.html"/> + </actionGroup> + <!-- Assert Page By Url Rewrite is Not Found --> + <actionGroup ref="AssertPageByUrlRewriteIsNotFoundActionGroup" stepKey="amOnPage"> + <argument name="requestPath" value="{{FirstLevelSubCat.name_lwr}}/{{_defaultProduct.urlKey}}.html"/> + </actionGroup> + </test> +</tests> diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/DeleteProductUrlRewriteEntityTest.xml b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/DeleteProductUrlRewriteEntityTest.xml index 7a98f463072cb..7e8f8729716b0 100644 --- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/DeleteProductUrlRewriteEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/DeleteProductUrlRewriteEntityTest.xml @@ -8,6 +8,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\UrlRewrite\Test\TestCase\DeleteProductUrlRewriteEntityTest" summary="Delete Product URL Rewrites" ticketId="MAGETWO-23287"> <variation name="DeleteProductUrlRewriteEntityTestVariation1"> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <data name="productRedirect/dataset" xsi:type="string">default_without_target</data> <data name="productRedirect/data/target_path/entity" xsi:type="string">product/%catalogProductSimple::product_100_dollar%</data> <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteDeletedMessage" /> From 715af4f65e9f63a89e8ca41cd0be41b98541f08d Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Wed, 25 Dec 2019 20:49:28 -0600 Subject: [PATCH 0568/1143] Update StorefrontFotoramaArrowsTest.xml Fix action group according to changes in mainline --- .../Catalog/Test/Mftf/Test/StorefrontFotoramaArrowsTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontFotoramaArrowsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontFotoramaArrowsTest.xml index 25d1dcedea0d5..239ec975a9663 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontFotoramaArrowsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontFotoramaArrowsTest.xml @@ -47,7 +47,7 @@ <actionGroup ref="addProductImage" stepKey="addThirdImageToProduct"> <argument name="image" value="TestImageNew"/> </actionGroup> - <actionGroup ref="saveProductForm" stepKey="saveSimpleProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveSimpleProduct"/> <!-- Assert product in storefront product page --> <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openCreatedProductPage"> From 56a0f6cc582b4dc0e24beb10286ad4de4de06cc1 Mon Sep 17 00:00:00 2001 From: Serhii Voloshkov <serhii.voloshkov@transoftgroup.com> Date: Thu, 26 Dec 2019 09:24:36 +0200 Subject: [PATCH 0569/1143] MC-29967: [Braintree] Place Order button is not disabled --- .../js/view/payment/method-renderer/vault.js | 18 +++ .../frontend/web/template/payment/form.html | 5 +- .../payment/method-renderer/vault.test.js | 123 ++++++++++++++++++ 3 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 dev/tests/js/jasmine/tests/app/code/Magento/Vault/view/frontend/web/js/view/payment/method-renderer/vault.test.js diff --git a/app/code/Magento/Vault/view/frontend/web/js/view/payment/method-renderer/vault.js b/app/code/Magento/Vault/view/frontend/web/js/view/payment/method-renderer/vault.js index 732bd4961f4fc..9a2e75f6c07d1 100644 --- a/app/code/Magento/Vault/view/frontend/web/js/view/payment/method-renderer/vault.js +++ b/app/code/Magento/Vault/view/frontend/web/js/view/payment/method-renderer/vault.js @@ -104,6 +104,24 @@ define( : false; }, + /** + * Return state of place order button. + * + * @return {Boolean} + */ + isButtonActive: function () { + return this.isActive() && this.isPlaceOrderActionAllowed(); + }, + + /** + * Check if payment is active. + * + * @return {Boolean} + */ + isActive: function () { + return this.isChecked() === this.getId(); + }, + /** * @returns {*} */ diff --git a/app/code/Magento/Vault/view/frontend/web/template/payment/form.html b/app/code/Magento/Vault/view/frontend/web/template/payment/form.html index 5f32281686a65..98c0fbfb00177 100644 --- a/app/code/Magento/Vault/view/frontend/web/template/payment/form.html +++ b/app/code/Magento/Vault/view/frontend/web/template/payment/form.html @@ -49,7 +49,10 @@ type="submit" data-bind=" click: placeOrder, - attr: {title: $t('Place Order')}"> + attr: {title: $t('Place Order')}, + enable: isButtonActive() + " + disabled> <span translate="'Place Order'"></span> </button> </div> diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Vault/view/frontend/web/js/view/payment/method-renderer/vault.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Vault/view/frontend/web/js/view/payment/method-renderer/vault.test.js new file mode 100644 index 0000000000000..f24d8d085da5c --- /dev/null +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Vault/view/frontend/web/js/view/payment/method-renderer/vault.test.js @@ -0,0 +1,123 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +define([ + 'squire', + 'ko' +], function (Squire, ko) { + 'use strict'; + + var injector = new Squire(), + vault, + mocks = { + 'Magento_Checkout/js/model/checkout-data-resolver': { + resolveBillingAddress: jasmine.createSpy().and.returnValue(true) + }, + 'Magento_Checkout/js/checkout-data': { + setSelectedPaymentMethod: jasmine.createSpy().and.returnValue(false) + }, + 'Magento_Checkout/js/model/quote': { + billingAddress: ko.observable(null), + shippingAddress: ko.observable(null), + paymentMethod: ko.observable(null), + totals: ko.observable({}) + } + }, + billingAddress = { + city: 'Culver City', + company: 'Magento', + country_id: 'US',// jscs:ignore requireCamelCaseOrUpperCaseIdentifiers + firstname: 'John', + lastname: 'Doe', + postcode: '90230', + region: '', + region_id: '12',// jscs:ignore requireCamelCaseOrUpperCaseIdentifiers + street: { + 0: '6161 West Centinela Avenue', + 1: '' + }, + telephone: '+15555555555' + }; + + beforeEach(function (done) { + window.checkoutConfig = { + quoteData: { + /* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */ + entity_Id: 1 + }, + formKey: 'formKey' + }; + injector.mock(mocks); + injector.require(['Magento_Vault/js/view/payment/method-renderer/vault'], function (Constr) { + var params = { + index: 'vaultIndex', + item: { + method: 'vault' + } + }; + + vault = new Constr(params); + // eslint-disable-next-line max-nested-callbacks + /** Stub */ + vault.isChecked = function () { + return mocks['Magento_Checkout/js/model/quote'].paymentMethod() ? + mocks['Magento_Checkout/js/model/quote'].paymentMethod().method : null; + }; + done(); + }); + }); + + afterEach(function () { + try { + injector.remove(); + injector.clean(); + } catch (e) { + } + mocks['Magento_Checkout/js/model/quote'].billingAddress(null); + mocks['Magento_Checkout/js/model/quote'].paymentMethod(null); + }); + + describe('Magento_Vault/js/view/payment/method-renderer/vault', function () { + + it('There is no payment method and billing address', function () { + expect(vault.isButtonActive()).toBeFalsy(); + + expect(vault.isActive()).toBeFalsy(); + expect(vault.isPlaceOrderActionAllowed()).toBeFalsy(); + }); + + it('Payment method exist but place order action is not allowed', function () { + vault.selectPaymentMethod(); + expect(mocks['Magento_Checkout/js/model/quote'].paymentMethod().method).toEqual('vaultIndex'); + + expect(vault.isButtonActive()).toBeFalsy(); + + expect(vault.isActive()).toBeTruthy(); + expect(vault.isPlaceOrderActionAllowed()).toBeFalsy(); + + }); + + it('Billing address exist but there is no selected payment method', function () { + mocks['Magento_Checkout/js/model/quote'].billingAddress(billingAddress); + + expect(vault.isButtonActive()).toBeFalsy(); + + expect(vault.isActive()).toBeFalsy(); + expect(vault.isPlaceOrderActionAllowed).toBeTruthy(); + }); + + it('Button is active', function () { + vault.selectPaymentMethod(); + expect(mocks['Magento_Checkout/js/model/quote'].paymentMethod().method).toEqual('vaultIndex'); + + mocks['Magento_Checkout/js/model/quote'].billingAddress(billingAddress); + + expect(vault.isButtonActive()).toBeTruthy(); + + expect(vault.isActive()).toBeTruthy(); + expect(vault.isPlaceOrderActionAllowed()).toBeTruthy(); + }); + }); +}); From 934338c35070359a34c1214cb590c3a0c5d1160d Mon Sep 17 00:00:00 2001 From: Yurii Sapiha <yurasapiga93@gmail.com> Date: Thu, 26 Dec 2019 10:55:13 +0200 Subject: [PATCH 0570/1143] MC-29691: Storefront: Simple product with custom attribute per multiple websites/storeviews, countries/states --- .../View/Attribute/AbstractAttributeTest.php | 39 ++- .../View/Attribute/DropdownAttributeTest.php | 39 +++ .../View/Attribute/TextAttributeTest.php | 39 +++ .../_files/customer_with_uk_address.php | 78 ++++++ .../customer_with_uk_address_rollback.php | 30 +++ .../FixedProductTaxAttributeTest.php | 233 ++++++++++++++++-- 6 files changed, 434 insertions(+), 24 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Customer/_files/customer_with_uk_address.php create mode 100644 dev/tests/integration/testsuite/Magento/Customer/_files/customer_with_uk_address_rollback.php diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/AbstractAttributeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/AbstractAttributeTest.php index 399abea6a0760..80e2ac52cecd6 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/AbstractAttributeTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/AbstractAttributeTest.php @@ -16,6 +16,7 @@ use Magento\Framework\ObjectManagerInterface; use Magento\Framework\Registry; use Magento\Framework\View\LayoutInterface; +use Magento\Store\Model\StoreManagerInterface; use Magento\TestFramework\Helper\Bootstrap; use PHPUnit\Framework\TestCase; @@ -48,6 +49,9 @@ abstract class AbstractAttributeTest extends TestCase /** @var Output */ private $outputHelper; + /** @var StoreManagerInterface */ + private $storeManager; + /** * @inheritdoc */ @@ -62,6 +66,7 @@ protected function setUp() $this->registry = $this->objectManager->get(Registry::class); $this->block = $this->layout->createBlock(Attributes::class); $this->outputHelper = $this->objectManager->create(Output::class); + $this->storeManager = $this->objectManager->get(StoreManagerInterface::class); } /** @@ -145,6 +150,35 @@ protected function processAttributeHtmlOutput( $this->assertEquals($expectedAttributeValue, $output); } + /** + * Process attribute view per store views + * + * @param string $sku + * @param int $attributeScopeValue + * @param string $attributeValue + * @param string $expectedAttributeValue + * @param string $storeCode + * @return void + */ + protected function processMultiStoreView( + string $sku, + int $attributeScopeValue, + string $attributeValue, + string $storeCode + ): void { + $currentStore = $this->storeManager->getStore(); + $this->updateAttribute(['is_global' => $attributeScopeValue, 'is_visible_on_front' => true]); + $this->storeManager->setCurrentStore($storeCode); + + try { + $product = $this->updateProduct($sku, $attributeValue); + $this->registerProduct($product); + $this->assertEquals($this->prepareExpectedData($attributeValue), $this->block->getAdditionalData()); + } finally { + $this->storeManager->setCurrentStore($currentStore); + } + } + /** * Get attribute * @@ -185,8 +219,11 @@ private function prepareExpectedData(string $expectedValue): array */ private function updateProduct(string $productSku, string $attributeValue): ProductInterface { + $value = $this->getAttribute()->usesSource() + ? $this->attribute->getSource()->getOptionId($attributeValue) + : $attributeValue; $product = $this->productRepository->get($productSku); - $product->addData([$this->getAttributeCode() => $attributeValue]); + $product->addData([$this->getAttributeCode() => $value]); return $this->productRepository->save($product); } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/DropdownAttributeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/DropdownAttributeTest.php index 98799822dcfb0..f6c7e81b13a23 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/DropdownAttributeTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/DropdownAttributeTest.php @@ -7,6 +7,8 @@ namespace Magento\Catalog\Block\Product\View\Attribute; +use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface; + /** * Class checks dropdown attribute displaying on frontend * @@ -77,6 +79,43 @@ public function attributeWithTagsProvider(): array ]; } + /** + * @magentoDbIsolation disabled + * + * @magentoDataFixture Magento/Catalog/_files/dropdown_attribute.php + * @magentoDataFixture Magento/Store/_files/core_fixturestore.php + * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + * + * @return void + */ + public function testAttributePerStoreView(): void + { + $this->processMultiStoreView( + 'simple2', + ScopedAttributeInterface::SCOPE_STORE, + 'Option 3', + 'fixturestore' + ); + } + + /** + * @magentoDbIsolation disabled + * + * @magentoDataFixture Magento/Catalog/_files/dropdown_attribute.php + * @magentoDataFixture Magento/Catalog/_files/product_two_websites.php + * + * @return void + */ + public function testAttributePerWebsites(): void + { + $this->processMultiStoreView( + 'simple-on-two-websites', + ScopedAttributeInterface::SCOPE_WEBSITE, + 'Option 3', + 'fixture_second_store' + ); + } + /** * @inheritdoc */ diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/TextAttributeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/TextAttributeTest.php index b61c5fd22d5b0..dae5fad160128 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/TextAttributeTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Attribute/TextAttributeTest.php @@ -7,6 +7,8 @@ namespace Magento\Catalog\Block\Product\View\Attribute; +use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface; + /** * Class checks text attribute displaying on frontend * @@ -77,6 +79,43 @@ public function attributeWithTagsProvider(): array ]; } + /** + * @magentoDbIsolation disabled + * + * @magentoDataFixture Magento/Catalog/_files/product_varchar_attribute.php + * @magentoDataFixture Magento/Store/_files/core_fixturestore.php + * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + * + * @return void + */ + public function testAttributePerStoreView(): void + { + $this->processMultiStoreView( + 'simple2', + ScopedAttributeInterface::SCOPE_STORE, + 'second store view value', + 'fixturestore' + ); + } + + /** + * @magentoDbIsolation disabled + * + * @magentoDataFixture Magento/Catalog/_files/product_two_websites.php + * @magentoDataFixture Magento/Catalog/_files/product_varchar_attribute.php + * + * @return void + */ + public function testAttributePerWebsites(): void + { + $this->processMultiStoreView( + 'simple-on-two-websites', + ScopedAttributeInterface::SCOPE_WEBSITE, + 'second website value', + 'fixture_second_store' + ); + } + /** * @inheritdoc */ diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/customer_with_uk_address.php b/dev/tests/integration/testsuite/Magento/Customer/_files/customer_with_uk_address.php new file mode 100644 index 0000000000000..a7ad0bb82719f --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Customer/_files/customer_with_uk_address.php @@ -0,0 +1,78 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Customer\Api\AddressMetadataInterface; +use Magento\Customer\Api\AddressRepositoryInterface; +use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Customer\Api\Data\AddressInterface; +use Magento\Customer\Model\Address; +use Magento\Customer\Model\AddressFactory; +use Magento\Customer\Model\CustomerFactory; +use Magento\Customer\Model\CustomerRegistry; +use Magento\Customer\Model\AddressRegistry; +use Magento\Store\Api\WebsiteRepositoryInterface; +use Magento\Store\Model\Website; +use Magento\Store\Model\WebsiteRepository; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var CustomerRepositoryInterface $customerRepository */ +$customerRepository = $objectManager->create(CustomerRepositoryInterface::class); +/** @var CustomerFactory $customerFactory */ +$customerFactory = $objectManager->get(CustomerFactory::class); +$customer = $customerFactory->create(); +/** @var CustomerRegistry $customerRegistry */ +$customerRegistry = $objectManager->get(CustomerRegistry::class); +/** @var WebsiteRepository $websiteRepository */ +$websiteRepository = $objectManager->create(WebsiteRepositoryInterface::class); +/** @var Website $mainWebsite */ +$mainWebsite = $websiteRepository->get('base'); +$customer->setWebsiteId($mainWebsite->getId()) + ->setEmail('customer_uk_address@test.com') + ->setPassword('password') + ->setGroupId(1) + ->setStoreId($mainWebsite->getDefaultStore()->getId()) + ->setIsActive(1) + ->setPrefix('Mr.') + ->setFirstname('John') + ->setMiddlename('A') + ->setLastname('Smith') + ->setSuffix('Esq.') + ->setTaxvat('12') + ->setGender(0); +/** @var AddressFactory $customerAddressFactory */ +$customerAddressFactory = $objectManager->get(AddressFactory::class); +/** @var AddressRepositoryInterface $customerAddressRepository */ +$customerAddressRepository = $objectManager->create(AddressRepositoryInterface::class); +/** @var Address $customerAddress */ +$customerAddress = $customerAddressFactory->create(); +$customerAddress->isObjectNew(true); +$customerAddress->setData( + [ + 'attribute_set_id' => AddressMetadataInterface::ATTRIBUTE_SET_ID_ADDRESS, + AddressInterface::TELEPHONE => 3468676, + AddressInterface::POSTCODE => 'EC1A 1AA', + AddressInterface::COUNTRY_ID => 'GB', + AddressInterface::CITY => 'London', + AddressInterface::COMPANY => 'CompanyName', + AddressInterface::STREET => 'test street address', + AddressInterface::LASTNAME => 'Smith', + AddressInterface::FIRSTNAME => 'John', + AddressInterface::REGION_ID => 1, + ] +); +$customer->addAddress($customerAddress); +$customer->isObjectNew(true); +$customerDataModel = $customerRepository->save($customer->getDataModel()); +$addressId = $customerDataModel->getAddresses()[0]->getId(); +$customerDataModel->setDefaultShipping($addressId); +$customerDataModel->setDefaultBilling($addressId); +$customerRepository->save($customerDataModel); +$customerRegistry->remove($customerDataModel->getId()); +/** @var AddressRegistry $addressRegistry */ +$addressRegistry = $objectManager->get(AddressRegistry::class); +$addressRegistry->remove($customerAddress->getId()); diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/customer_with_uk_address_rollback.php b/dev/tests/integration/testsuite/Magento/Customer/_files/customer_with_uk_address_rollback.php new file mode 100644 index 0000000000000..e00d80833ea04 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Customer/_files/customer_with_uk_address_rollback.php @@ -0,0 +1,30 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Customer\Api\AddressRepositoryInterface; +use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Registry; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var Registry $registry */ +$registry = $objectManager->get(Registry::class); +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); +/** @var CustomerRepositoryInterface $customerRepository */ +$customerRepository = $objectManager->get(CustomerRepositoryInterface::class); + +try { + $customer = $customerRepository->get('customer_uk_address@test.com'); + $customerRepository->delete($customer); +} catch (NoSuchEntityException $exception) { + //Already deleted +} + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); diff --git a/dev/tests/integration/testsuite/Magento/Weee/Block/Product/View/Attribute/FixedProductTaxAttributeTest.php b/dev/tests/integration/testsuite/Magento/Weee/Block/Product/View/Attribute/FixedProductTaxAttributeTest.php index 6cb7d6dc0346d..a0aeb13f77518 100644 --- a/dev/tests/integration/testsuite/Magento/Weee/Block/Product/View/Attribute/FixedProductTaxAttributeTest.php +++ b/dev/tests/integration/testsuite/Magento/Weee/Block/Product/View/Attribute/FixedProductTaxAttributeTest.php @@ -11,11 +11,14 @@ use Magento\Catalog\Api\ProductRepositoryInterface; use Magento\Catalog\Block\Product\ListProduct; use Magento\Catalog\Pricing\Render as CatalogPricingRender; +use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Customer\Model\Session; use Magento\Framework\ObjectManagerInterface; use Magento\Framework\Pricing\Render; use Magento\Framework\Pricing\Render\RendererPool; use Magento\Framework\Registry; use Magento\Framework\View\LayoutInterface; +use Magento\Store\Model\StoreManagerInterface; use Magento\TestFramework\Helper\Bootstrap; use PHPUnit\Framework\TestCase; @@ -27,20 +30,12 @@ * @magentoAppArea frontend * @magentoDataFixture Magento/Weee/_files/fixed_product_attribute.php * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class FixedProductTaxAttributeTest extends TestCase { - /** @var array */ - private const TEST_TAX_DATA = [ - [ - 'region_id' => '1', - 'country' => 'US', - 'val' => '', - 'value' => '5', - 'website_id' => '1', - 'state' => '', - ] - ]; + /** @var array */ + private $textTaxData; /** @var ObjectManagerInterface */ private $objectManager; @@ -60,6 +55,18 @@ class FixedProductTaxAttributeTest extends TestCase /** @var Registry */ private $registry; + /** @var StoreManagerInterface */ + private $storeManager; + + /** @var CustomerRepositoryInterface */ + private $customerRepository; + + /** @var Session */ + private $customerSession; + + /** @var int */ + private $baseWebsiteId; + /** * @inheritdoc */ @@ -73,6 +80,19 @@ protected function setUp() $this->productListBlock = $this->layout->createBlock(ListProduct::class); $this->attributeCode = 'fixed_product_attribute'; $this->registry = $this->objectManager->get(Registry::class); + $this->storeManager = $this->objectManager->get(StoreManagerInterface::class); + $this->customerRepository = $this->objectManager->create(CustomerRepositoryInterface::class); + $this->customerSession = $this->objectManager->get(Session::class); + $this->baseWebsiteId = (int) $this->storeManager->getWebsite('base')->getId(); + $this->textTaxData = [ + [ + 'country' => 'US', + 'val' => '', + 'value' => '5', + 'website_id' => $this->baseWebsiteId, + 'state' => '', + ] + ]; } /** @@ -81,6 +101,8 @@ protected function setUp() protected function tearDown() { $this->registry->unregister('product'); + $this->registry->unregister('current_product'); + $this->customerSession->logout(); parent::tearDown(); } @@ -88,11 +110,13 @@ protected function tearDown() /** * @magentoConfigFixture default_store tax/weee/enable 1 * @magentoConfigFixture default_store tax/weee/display_list 0 + * + * @return void */ public function testFPTCategoryPageIncludingFPTOnly(): void { $this->prepareLayoutCategoryPage(); - $product = $this->updateProduct('simple2', self::TEST_TAX_DATA); + $product = $this->updateProduct('simple2', $this->textTaxData); $productPrice = $this->productListBlock->getProductPrice($product); $this->assertEquals('$15.00', preg_replace('/\s+/', '', strip_tags($productPrice))); } @@ -100,11 +124,13 @@ public function testFPTCategoryPageIncludingFPTOnly(): void /** * @magentoConfigFixture default_store tax/weee/enable 1 * @magentoConfigFixture default_store tax/weee/display_list 1 + * + * @return void */ public function testFPTCategoryPageIncludingFPTAndDescription(): void { $this->prepareLayoutCategoryPage(); - $product = $this->updateProduct('simple2', self::TEST_TAX_DATA); + $product = $this->updateProduct('simple2', $this->textTaxData); $productPrice = $this->productListBlock->getProductPrice($product); $this->assertContains('data-label="fixed product tax"', $productPrice); $this->assertEquals('$15.00$5.00', preg_replace('/\s+/', '', strip_tags($productPrice))); @@ -113,11 +139,13 @@ public function testFPTCategoryPageIncludingFPTAndDescription(): void /** * @magentoConfigFixture default_store tax/weee/enable 1 * @magentoConfigFixture default_store tax/weee/display_list 2 + * + * @return void */ public function testFPTCategoryPageExcludingFPTIncludingDescriptionAndPrice(): void { $this->prepareLayoutCategoryPage(); - $product = $this->updateProduct('simple2', self::TEST_TAX_DATA); + $product = $this->updateProduct('simple2', $this->textTaxData); $productPrice = $this->productListBlock->getProductPrice($product); $this->assertContains('data-label="fixed product tax"', $productPrice); $this->assertEquals('$10.00$5.00$15.00', preg_replace('/\s+/', '', strip_tags($productPrice))); @@ -126,22 +154,26 @@ public function testFPTCategoryPageExcludingFPTIncludingDescriptionAndPrice(): v /** * @magentoConfigFixture default_store tax/weee/enable 1 * @magentoConfigFixture default_store tax/weee/display_list 3 + * + * @return void */ public function testFPTCategoryPageExcludingFPT(): void { $this->prepareLayoutCategoryPage(); - $product = $this->updateProduct('simple2', self::TEST_TAX_DATA); + $product = $this->updateProduct('simple2', $this->textTaxData); $productPrice = $this->productListBlock->getProductPrice($product); $this->assertEquals('$10.00', preg_replace('/\s+/', '', strip_tags($productPrice))); } /** * @magentoConfigFixture default_store tax/weee/enable 1 - * @magentoConfigFixture default_store tax/weee/display_list 0 + * @magentoConfigFixture default_store tax/weee/display 0 + * + * @return void */ public function testFPTProductPageIncludingFPTOnly(): void { - $product = $this->updateProduct('simple2', self::TEST_TAX_DATA); + $product = $this->updateProduct('simple2', $this->textTaxData); $this->registerProduct($product); $block = $this->prepareLayoutProductPage(); $productPrice = $block->toHtml(); @@ -150,11 +182,13 @@ public function testFPTProductPageIncludingFPTOnly(): void /** * @magentoConfigFixture default_store tax/weee/enable 1 - * @magentoConfigFixture default_store tax/weee/display_list 1 + * @magentoConfigFixture default_store tax/weee/display 1 + * + * @return void */ public function testFPTProductPageIncludingFPTAndDescription(): void { - $product = $this->updateProduct('simple2', self::TEST_TAX_DATA); + $product = $this->updateProduct('simple2', $this->textTaxData); $this->registerProduct($product); $block = $this->prepareLayoutProductPage(); $productPrice = $block->toHtml(); @@ -164,11 +198,13 @@ public function testFPTProductPageIncludingFPTAndDescription(): void /** * @magentoConfigFixture default_store tax/weee/enable 1 - * @magentoConfigFixture default_store tax/weee/display_list 2 + * @magentoConfigFixture default_store tax/weee/display 2 + * + * @return void */ public function testFPTProductPageExcludingFPTIncludingDescriptionAndPrice(): void { - $product = $this->updateProduct('simple2', self::TEST_TAX_DATA); + $product = $this->updateProduct('simple2', $this->textTaxData); $this->registerProduct($product); $block = $this->prepareLayoutProductPage(); $productPrice = $block->toHtml(); @@ -178,11 +214,148 @@ public function testFPTProductPageExcludingFPTIncludingDescriptionAndPrice(): vo /** * @magentoConfigFixture default_store tax/weee/enable 1 - * @magentoConfigFixture default_store tax/weee/display_list 3 + * @magentoConfigFixture default_store tax/weee/display 3 + * + * @return void */ public function testFPTProductPageExcludingFPT(): void { - $product = $this->updateProduct('simple2', self::TEST_TAX_DATA); + $product = $this->updateProduct('simple2', $this->textTaxData); + $this->registerProduct($product); + $block = $this->prepareLayoutProductPage(); + $productPrice = $block->toHtml(); + $this->assertEquals('$10.00', preg_replace('/\s+/', '', strip_tags($productPrice))); + } + + /** + * @magentoDbIsolation disabled + * + * @magentoConfigFixture default/catalog/price/scope 1 + * @magentoConfigFixture fixture_second_store_store tax/weee/enable 1 + * @magentoConfigFixture fixture_second_store_store tax/weee/display 2 + * + * @magentoDataFixture Magento/Weee/_files/fixed_product_attribute.php + * @magentoDataFixture Magento/Catalog/_files/product_two_websites.php + * + * @return void + */ + public function testFPTPerWebsites(): void + { + $currentStore = $this->storeManager->getStore(); + try { + $secondStore = $this->storeManager->getStore('fixture_second_store'); + $taxData = [ + [ + 'region_id' => '1', + 'country' => 'US', + 'val' => '', + 'value' => '5', + 'website_id' => $secondStore->getWebsiteId(), + 'state' => '', + ] + ]; + $this->storeManager->setCurrentStore($secondStore); + $product = $this->updateProduct('simple-on-two-websites', $taxData); + $this->registerProduct($product); + $block = $this->prepareLayoutProductPage(); + $productPrice = $block->toHtml(); + $this->assertEquals('$10.00$5.00$15.00', preg_replace('/\s+/', '', strip_tags($productPrice))); + } finally { + $this->storeManager->setCurrentStore($currentStore); + } + } + + /** + * @magentoConfigFixture default_store tax/weee/enable 1 + * @magentoConfigFixture default_store tax/weee/display 0 + * + * @magentoDataFixture Magento/Weee/_files/fixed_product_attribute.php + * @magentoDataFixture Magento/Customer/_files/customer_one_address.php + * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + * + * @return void + */ + public function testApplyTwoFPTForCustomer(): void + { + $email = 'customer_one_address@test.com'; + $expectedPrice = '$30.00'; + $taxData = [ + [ + 'country' => 'US', + 'val' => '', + 'value' => '5', + 'website_id' => $this->baseWebsiteId, + 'state' => '', + ], + [ + 'country' => 'US', + 'val' => '', + 'value' => '15', + 'website_id' => $this->baseWebsiteId, + 'state' => 1, + ] + ]; + $this->loginCustomerByEmail($email); + $product = $this->updateProduct('simple2', $taxData); + $this->registerProduct($product); + $block = $this->prepareLayoutProductPage(); + $productPrice = $block->toHtml(); + $this->assertEquals($expectedPrice, preg_replace('/\s+/', '', strip_tags($productPrice))); + } + + /** + * @magentoConfigFixture default_store tax/defaults/country GB + * @magentoConfigFixture default_store tax/weee/enable 1 + * @magentoConfigFixture default_store tax/weee/display 0 + * + * @magentoDataFixture Magento/Weee/_files/fixed_product_attribute.php + * @magentoDataFixture Magento/Customer/_files/customer_no_address.php + * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + * + * @return void + */ + public function testApplyFPTWithoutAddressCustomer(): void + { + $email = 'customer5@example.com'; + $expectedPrice = '$10.00'; + $taxData = [ + [ + 'country' => 'US', + 'val' => '', + 'value' => '5', + 'website_id' => $this->baseWebsiteId, + 'state' => '', + ], + [ + 'country' => 'US', + 'val' => '', + 'value' => '15', + 'website_id' => $this->baseWebsiteId, + 'state' => 1, + ], + ]; + $this->loginCustomerByEmail($email); + $product = $this->updateProduct('simple2', $taxData); + $this->registerProduct($product); + $block = $this->prepareLayoutProductPage(); + $productPrice = $block->toHtml(); + $this->assertEquals($expectedPrice, preg_replace('/\s+/', '', strip_tags($productPrice))); + } + + /** + * @magentoConfigFixture default_store tax/weee/enable 1 + * @magentoConfigFixture default_store tax/weee/display 0 + * + * @magentoDataFixture Magento/Weee/_files/fixed_product_attribute.php + * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + * @magentoDataFixture Magento/Customer/_files/customer_with_uk_address.php + * + * @return void + */ + public function testApplyFPTWithForeignCountryAddress(): void + { + $this->loginCustomerByEmail('customer_uk_address@test.com'); + $product = $this->updateProduct('simple2', $this->textTaxData); $this->registerProduct($product); $block = $this->prepareLayoutProductPage(); $productPrice = $block->toHtml(); @@ -248,5 +421,19 @@ private function registerProduct(ProductInterface $product): void { $this->registry->unregister('product'); $this->registry->register('product', $product); + $this->registry->unregister('current_product'); + $this->registry->register('current_product', $product); + } + + /** + * Login customer by email + * + * @param string $email + * @return void + */ + private function loginCustomerByEmail(string $email): void + { + $customer = $this->customerRepository->get($email); + $this->customerSession->loginById($customer->getId()); } } From 3751889f34f82bb72127aee5022a7c202d0d46f9 Mon Sep 17 00:00:00 2001 From: Yurii Sapiha <yurasapiga93@gmail.com> Date: Thu, 26 Dec 2019 11:01:14 +0200 Subject: [PATCH 0571/1143] MC-29686: Storefront: Out of Stock product on category page with config Show Out of Stock=Yes --- .../ProductInCategoriesViewTest.php | 13 +++++ .../out_of_stock_product_with_category.php | 53 +++++++++++++++++++ ...f_stock_product_with_category_rollback.php | 30 +++++++++++ 3 files changed, 96 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/out_of_stock_product_with_category.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/out_of_stock_product_with_category_rollback.php diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ListProduct/ProductInCategoriesViewTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ListProduct/ProductInCategoriesViewTest.php index b9adb051981c0..48f6e455a5b9f 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ListProduct/ProductInCategoriesViewTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ListProduct/ProductInCategoriesViewTest.php @@ -100,6 +100,19 @@ public function productDataProvider(): array ]; } + /** + * @magentoConfigFixture default_store cataloginventory/options/show_out_of_stock 1 + * @magentoDataFixture Magento/Catalog/_files/out_of_stock_product_with_category.php + * @return void + */ + public function testCategoryOutOfStockProductView(): void + { + $collection = $this->getCategoryProductCollection(333); + + $this->assertEquals(1, $collection->getSize()); + $this->assertEquals('out-of-stock-product', $collection->getFirstItem()->getSku()); + } + /** * @magentoDataFixture Magento/Catalog/_files/category_product.php * @dataProvider productVisibilityProvider diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/out_of_stock_product_with_category.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/out_of_stock_product_with_category.php new file mode 100644 index 0000000000000..43670125e0315 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/out_of_stock_product_with_category.php @@ -0,0 +1,53 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\CategoryLinkManagementInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Catalog\Model\Product\Type; +use Magento\Catalog\Model\Product\Visibility; +use Magento\Catalog\Model\ProductFactory; +use Magento\TestFramework\Helper\Bootstrap; + +require __DIR__ . '/category.php'; + +$objectManager = Bootstrap::getObjectManager(); +/** @var ProductFactory $productFactory */ +$productFactory = $objectManager->get(ProductFactory::class); +/** @var CategoryLinkManagementInterface $categoryLinkManagement */ +$categoryLinkManagement = $objectManager->get(CategoryLinkManagementInterface::class); +$product = $productFactory->create(); +$product->isObjectNew(true); +$product->setTypeId(Type::TYPE_SIMPLE) + ->setAttributeSetId($product->getDefaultAttributeSetId()) + ->setWebsiteIds([1]) + ->setName('Simple Product Out Of Stock') + ->setSku('out-of-stock-product') + ->setPrice(10) + ->setWeight(1) + ->setShortDescription("Short description") + ->setTaxClassId(0) + ->setDescription('Description with <b>html tag</b>') + ->setMetaTitle('meta title') + ->setMetaKeyword('meta keyword') + ->setMetaDescription('meta description') + ->setVisibility(Visibility::VISIBILITY_BOTH) + ->setStatus(Status::STATUS_ENABLED) + ->setCategoryIds([333]) + ->setStockData( + [ + 'use_config_manage_stock' => 1, + 'qty' => 0, + 'is_qty_decimal' => 0, + 'is_in_stock' => 0, + ] + ) + ->setCanSaveCustomOptions(true) + ->setHasOptions(true); +/** @var ProductRepositoryInterface $productRepositoryFactory */ +$productRepository = $objectManager->create(ProductRepositoryInterface::class); +$productRepository->save($product); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/out_of_stock_product_with_category_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/out_of_stock_product_with_category_rollback.php new file mode 100644 index 0000000000000..ee07b064adc66 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/out_of_stock_product_with_category_rollback.php @@ -0,0 +1,30 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Registry; +use Magento\TestFramework\Helper\Bootstrap; + +require __DIR__ . '/category_rollback.php'; + +$objectManager = Bootstrap::getObjectManager(); +/** @var Registry $registry */ +$registry = $objectManager->get(Registry::class); + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->create(ProductRepositoryInterface::class); + +try { + $productRepository->deleteById('out-of-stock-product'); +} catch (NoSuchEntityException $e) { + //already removed +} +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); From 63ec3e575ca3f9621867e891c102a4bd0f55ed5d Mon Sep 17 00:00:00 2001 From: divyajyothi5321 <54176640+divyajyothi5321@users.noreply.github.com> Date: Thu, 26 Dec 2019 14:44:55 +0530 Subject: [PATCH 0572/1143] Added fix for - 26176 --- .../luma/Magento_Newsletter/web/css/source/_module.less | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/design/frontend/Magento/luma/Magento_Newsletter/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Newsletter/web/css/source/_module.less index 5d44a32b9391b..cebde47e35191 100644 --- a/app/design/frontend/Magento/luma/Magento_Newsletter/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_Newsletter/web/css/source/_module.less @@ -81,6 +81,13 @@ .block.newsletter { max-width: 44%; width: max-content; + + .form.subscribe { + > .field, + > .actions { + float: left; + } + } } } From e520c8b45ee5aaea9d19e3e48bc85bf65a6b871d Mon Sep 17 00:00:00 2001 From: divyajyothi5321 <54176640+divyajyothi5321@users.noreply.github.com> Date: Thu, 26 Dec 2019 15:12:48 +0530 Subject: [PATCH 0573/1143] Added Fix for - 26181 --- .../Magento_Catalog/web/css/source/module/_listings.less | 8 ++++++++ 1 file changed, 8 insertions(+) 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 7745900f1766c..b7fcbf7888b38 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 @@ -108,6 +108,14 @@ .actions-primary { display: inline-block; vertical-align: middle; + + > .stock.unavailable { + line-height: 1; + padding: @indent__s 11px; + color: @color-orange-red1; + border: 1px solid @color-orange-red1; + font-weight: @font-weight__semibold; + } } } From adc7908db1db52171e4ec60ffe0eaad152535230 Mon Sep 17 00:00:00 2001 From: divyajyothi5321 <54176640+divyajyothi5321@users.noreply.github.com> Date: Thu, 26 Dec 2019 15:33:51 +0530 Subject: [PATCH 0574/1143] Added necessary indentations --- .../luma/Magento_Newsletter/web/css/source/_module.less | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/design/frontend/Magento/luma/Magento_Newsletter/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Newsletter/web/css/source/_module.less index cebde47e35191..a72f31d72ce48 100644 --- a/app/design/frontend/Magento/luma/Magento_Newsletter/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_Newsletter/web/css/source/_module.less @@ -84,9 +84,9 @@ .form.subscribe { > .field, - > .actions { - float: left; - } + > .actions { + float: left; + } } } } From aaf147837c1da4fcd5229236387bc46d4c44319d Mon Sep 17 00:00:00 2001 From: divyajyothi5321 <54176640+divyajyothi5321@users.noreply.github.com> Date: Thu, 26 Dec 2019 15:54:52 +0530 Subject: [PATCH 0575/1143] Added necessary indentations --- .../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 b7fcbf7888b38..9b088ae0e9025 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 @@ -110,12 +110,12 @@ vertical-align: middle; > .stock.unavailable { - line-height: 1; + line-height: 1; padding: @indent__s 11px; color: @color-orange-red1; border: 1px solid @color-orange-red1; font-weight: @font-weight__semibold; - } + } } } From b87672a94535a9cb5c7cec3f6cc522aec9f5505b Mon Sep 17 00:00:00 2001 From: divyajyothi5321 <54176640+divyajyothi5321@users.noreply.github.com> Date: Thu, 26 Dec 2019 16:45:19 +0530 Subject: [PATCH 0576/1143] Added Changes --- .../Magento_Catalog/web/css/source/module/_listings.less | 6 +++--- 1 file changed, 3 insertions(+), 3 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 9b088ae0e9025..8c71f87360807 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 @@ -110,11 +110,11 @@ vertical-align: middle; > .stock.unavailable { - line-height: 1; - padding: @indent__s 11px; - color: @color-orange-red1; border: 1px solid @color-orange-red1; + color: @color-orange-red1; font-weight: @font-weight__semibold; + line-height: 1; + padding: @indent__s 11px; } } } From 23dfe2baf9c324f4a45bf8614dbe8bcdea2aae10 Mon Sep 17 00:00:00 2001 From: Serhii Voloshkov <serhii.voloshkov@transoftgroup.com> Date: Thu, 26 Dec 2019 14:03:55 +0200 Subject: [PATCH 0577/1143] MC-29967: [Braintree] Place Order button is not disabled --- .../web/js/view/payment/method-renderer/vault.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Vault/view/frontend/web/js/view/payment/method-renderer/vault.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Vault/view/frontend/web/js/view/payment/method-renderer/vault.test.js index f24d8d085da5c..3724a3ab0c9f3 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Vault/view/frontend/web/js/view/payment/method-renderer/vault.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Vault/view/frontend/web/js/view/payment/method-renderer/vault.test.js @@ -88,7 +88,7 @@ define([ expect(vault.isPlaceOrderActionAllowed()).toBeFalsy(); }); - it('Payment method exist but place order action is not allowed', function () { + it('Payment method exists, but place order action is not allowed', function () { vault.selectPaymentMethod(); expect(mocks['Magento_Checkout/js/model/quote'].paymentMethod().method).toEqual('vaultIndex'); @@ -99,7 +99,7 @@ define([ }); - it('Billing address exist but there is no selected payment method', function () { + it('Billing address exists, but there is no selected payment method', function () { mocks['Magento_Checkout/js/model/quote'].billingAddress(billingAddress); expect(vault.isButtonActive()).toBeFalsy(); From e037d514215f9e662b5585a5ab967ca4edcde3af Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Thu, 26 Dec 2019 14:05:28 +0200 Subject: [PATCH 0578/1143] Fix static test, civer with jasmine test --- .../view/base/web/js/swatch-renderer.js | 2 +- .../frontend/web/js/swatch-renderer.test.js | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Swatches/view/base/web/js/swatch-renderer.js b/app/code/Magento/Swatches/view/base/web/js/swatch-renderer.js index c80962a44d0dc..ee55beb440f59 100644 --- a/app/code/Magento/Swatches/view/base/web/js/swatch-renderer.js +++ b/app/code/Magento/Swatches/view/base/web/js/swatch-renderer.js @@ -952,7 +952,7 @@ define([ isShow = typeof result != 'undefined' && result.oldPrice.amount !== result.finalPrice.amount; - $productPrice.find('span:first').toggleClass('special-price',isShow); + $productPrice.find('span:first').toggleClass('special-price', isShow); $product.find(this.options.slyOldPriceSelector)[isShow ? 'show' : 'hide'](); diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.test.js index bf0ff3466c529..f486123ba0bd3 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.test.js @@ -28,6 +28,7 @@ define([ id: optionId }] }; + widget.options = { classes: { optionClass: 'swatch-option' @@ -50,6 +51,7 @@ define([ } } }; + optionConfig = widget.options.jsonSwatchConfig[attribute.id]; html = $(widget._RenderSwatchOptions(attribute, 'option-label-control-id-1'))[0]; }); @@ -76,5 +78,25 @@ define([ expect(html.style.height).toEqual(swathImageHeight + 'px'); expect(html.style.width).toEqual(swathImageWidth + 'px'); }); + + it('check udate price method', function () { + var productPriceMock = { + find: jasmine.createSpy().and.returnValue({ + hide: jasmine.createSpy(), + priceBox: jasmine.createSpy().and.returnValue(''), + trigger: jasmine.createSpy(), + find: jasmine.createSpy().and.returnValue({ + toggleClass: jasmine.createSpy() + }) + }) + }; + + widget.element = { + parents: jasmine.createSpy().and.returnValue(productPriceMock) + }; + widget._getNewPrices = jasmine.createSpy().and.returnValue(undefined); + widget._UpdatePrice(); + expect(productPriceMock.find().find.calls.count()).toBe(1); + }); }); }); From 748fd85bc7c963b665c73428f098f5d70d0e0ccc Mon Sep 17 00:00:00 2001 From: OlgaVasyltsun <olga.vasyltsun@gmail.com> Date: Thu, 26 Dec 2019 16:52:32 +0200 Subject: [PATCH 0579/1143] MC-29047: Fix MFTF test --- ...ProductDetailPageNameAndUrlActionGroup.xml | 24 ++++ ...rontCategoryPageOpenProductActionGroup.xml | 21 +++ ...tCheckCategorySimpleProductActionGroup.xml | 1 + ...urableProductCategoryViewChildOnlyTest.xml | 4 +- ...uctChildAssignedToSeparateCategoryTest.XML | 134 ++++++++++++++++++ 5 files changed, 182 insertions(+), 2 deletions(-) create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontProductDetailPageNameAndUrlActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryPageOpenProductActionGroup.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontShouldSeeOnlyConfigurableProductChildAssignedToSeparateCategoryTest.XML diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontProductDetailPageNameAndUrlActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontProductDetailPageNameAndUrlActionGroup.xml new file mode 100644 index 0000000000000..e31fef0f463e1 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontProductDetailPageNameAndUrlActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertStorefrontProductDetailPageNameAndUrlActionGroup"> + <annotations> + <description>Validates that the Product name and Url are correct.</description> + </annotations> + <arguments> + <argument name="productName" defaultValue="{{ApiSimpleProduct.name}}" type="string"/> + <argument name="productUrl" defaultValue="{{ApiSimpleProduct.urlKey}}" type="string"/> + </arguments> + + <seeInCurrentUrl url="{{StorefrontProductPage.url(productUrl)}}" stepKey="checkUrl"/> + <seeInTitle userInput="{{productName}}" stepKey="assertProductNameTitle"/> + <see userInput="{{productName}}" selector="{{StorefrontProductInfoMainSection.productName}}" stepKey="assertProductName"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryPageOpenProductActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryPageOpenProductActionGroup.xml new file mode 100644 index 0000000000000..86ce7a602315d --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryPageOpenProductActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCategoryPageOpenProductActionGroup"> + <annotations> + <description>Click on the provided product on category page.</description> + </annotations> + <arguments> + <argument name="productName" type="string" defaultValue="{{ApiSimpleProduct.name}}"/> + </arguments> + + <click selector="{{StorefrontCategoryMainSection.specifiedProductItemInfo(productName)}}" stepKey="openProductPage"/> + <waitForPageLoad stepKey="waitForProductPageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckCategorySimpleProductActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckCategorySimpleProductActionGroup.xml index 1f8234498ffa7..33956073bcd88 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckCategorySimpleProductActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckCategorySimpleProductActionGroup.xml @@ -16,6 +16,7 @@ <argument name="product"/> </arguments> + <waitForElementVisible selector="{{StorefrontCategoryProductSection.ProductTitleByName(productName)}}" stepKey="waitForProduct"/> <seeElement selector="{{StorefrontCategoryProductSection.ProductTitleByName(product.name)}}" stepKey="assertProductName"/> <see userInput="${{product.price}}.00" selector="{{StorefrontCategoryProductSection.ProductPriceByName(product.name)}}" stepKey="AssertProductPrice"/> <!-- @TODO: MAGETWO-80272 Move to Magento_Checkout --> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductCategoryViewChildOnlyTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductCategoryViewChildOnlyTest.xml index 9d7807c543def..6c9b985bf38f7 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductCategoryViewChildOnlyTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductCategoryViewChildOnlyTest.xml @@ -12,13 +12,13 @@ <annotations> <features value="ConfigurableProduct"/> <stories value="View configurable product child in storefront"/> - <title value="It should be possible to only view the child product of a configurable product"/> + <title value="DEPRECATED It should be possible to only view the child product of a configurable product"/> <description value="Create configurable product, add to category such that only child variation is visible in category"/> <severity value="CRITICAL"/> <testCaseId value="MC-5832"/> <group value="ConfigurableProduct"/> <skip> - <issueId value="MC-17140"/> + <issueId value="DEPRECATED">Use StorefrontShouldSeeOnlyConfigurableProductChildAssignedToSeparateCategoryTest instead</issueId> </skip> </annotations> <before> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontShouldSeeOnlyConfigurableProductChildAssignedToSeparateCategoryTest.XML b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontShouldSeeOnlyConfigurableProductChildAssignedToSeparateCategoryTest.XML new file mode 100644 index 0000000000000..7df075f2179f6 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontShouldSeeOnlyConfigurableProductChildAssignedToSeparateCategoryTest.XML @@ -0,0 +1,134 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="StorefrontShouldSeeOnlyConfigurableProductChildAssignedToSeparateCategoryTest"> + <annotations> + <features value="ConfigurableProduct"/> + <stories value="View products"/> + <title value="It should be possible to only view the child product of a configurable product"/> + <description value="Create configurable product, add to category such that only child variation is visible in category"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-5832"/> + <group value="configurable_product"/> + </annotations> + <before> + <!-- Create the category --> + <createData entity="ApiCategory" stepKey="createCategory"/> + <createData entity="_defaultCategory" stepKey="secondCategory"/> + + <!-- Create an attribute with two options to be used in the first child product --> + <createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/> + <createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </createData> + <createData entity="productAttributeOption2" stepKey="createConfigProductAttributeOption2"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </createData> + + <!-- Add the attribute we just created to default attribute set --> + <createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </createData> + + <!-- Get the first option of the attribute we created --> + <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </getData> + + <!-- Get the second option of the attribute we created --> + <getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeOption2"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </getData> + + <!-- Create the configurable product and add it to the category --> + <createData entity="ApiConfigurableProduct" stepKey="createConfigProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + + <!-- Create a simple product and give it the attribute with the first option --> + <createData entity="ApiSimpleOne" stepKey="createConfigChildProduct1"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="getConfigAttributeOption1"/> + </createData> + + <!-- Create a simple product and give it the attribute with the second option --> + <createData entity="ApiSimpleTwo" stepKey="createConfigChildProduct2"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="getConfigAttributeOption2"/> + </createData> + + <createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption"> + <requiredEntity createDataKey="createConfigProduct"/> + <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="getConfigAttributeOption1"/> + <requiredEntity createDataKey="getConfigAttributeOption2"/> + </createData> + + <!-- Add the first simple product to the configurable product --> + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild1"> + <requiredEntity createDataKey="createConfigProduct"/> + <requiredEntity createDataKey="createConfigChildProduct1"/> + </createData> + + <!-- Add the second simple product to the configurable product --> + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild2"> + <requiredEntity createDataKey="createConfigProduct"/> + <requiredEntity createDataKey="createConfigChildProduct2"/> + </createData> + + <actionGroup ref="LoginAsAdmin" stepKey="loginToAdmin"/> + </before> + + <after> + <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> + <deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct1"/> + <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/> + <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> + <deleteData createDataKey="createCategory" stepKey="deleteApiCategory"/> + <deleteData createDataKey="secondCategory" stepKey="deleteSecondCategory"/> + <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + </after> + + <!-- Go to the product page for the first product --> + <actionGroup ref="goToProductPageViaID" stepKey="openConfigChildProduct1Page"> + <argument name="productId" value="$$createConfigChildProduct1.id$$"/> + </actionGroup> + + <!-- Edit the visibility the first simple product --> + <selectOption selector="{{AdminProductFormSection.visibility}}" userInput="Catalog, Search" stepKey="selectVisibilityCatalogSearch"/> + <!--Add to category--> + <actionGroup ref="AdminAssignCategoryToProductAndSaveActionGroup" stepKey="addProductToCategoryAndSaveProduct"> + <argument name="categoryName" value="$$secondCategory.name$$"/> + </actionGroup> + + <magentoCLI command="indexer:reindex" arguments="catalogsearch_fulltext" stepKey="reindexSearchIndex"/> + + <!-- Go to storefront to view child product --> + <actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="goToSecondCategoryStorefront"> + <argument name="category" value="$$secondCategory$$"/> + </actionGroup> + <actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="seeChildProductInCategory"> + <argument name="product" value="$createConfigChildProduct1$"/> + </actionGroup> + <actionGroup ref="StorefrontCheckProductIsMissingInCategoryProductsPageActionGroup" stepKey="dontSeeOtherChildProduct"> + <argument name="productName" value="$$createConfigChildProduct2.name$$"/> + </actionGroup> + <actionGroup ref="StorefrontCheckProductIsMissingInCategoryProductsPageActionGroup" stepKey="dontSeeParentProduct"> + <argument name="productName" value="$$createConfigProduct.name$$"/> + </actionGroup> + <actionGroup ref="StorefrontCategoryPageOpenProductActionGroup" stepKey="openConfigChildProductFromCategoryPage"> + <argument name="productName" value="$$createConfigChildProduct1.name$$"/> + </actionGroup> + <actionGroup ref="AssertStorefrontProductDetailPageNameAndUrlActionGroup" stepKey="checkStorefrontConfigChildProductPage"> + <argument name="productName" value="$$createConfigChildProduct1.name$$"/> + <argument name="productUrl" value="$$createConfigChildProduct1.custom_attributes[url_key]$$"/> + </actionGroup> + </test> +</tests> From 6cf13db2afa4679da922c5973a70a792011804d7 Mon Sep 17 00:00:00 2001 From: Patrick McLain <pmclain@somethingdigital.com> Date: Thu, 26 Dec 2019 14:56:16 -0500 Subject: [PATCH 0580/1143] Allow wishlist share when all items are out of stock Clicking `Share` on the wishlist view page updates and saves the wishlist before redirecting to the share page. The redirection to the share page only happens when the post body includes wishlist descriptions. Because qty and comment are disabled for out of stock wishlist items these properties are not sent with the post resulting in the share redirect being unreachable when all items are out of stock. This commit updates the controller flow separating the logic conditions for saving and sharing. This allows sharing wishlist where all items are out of stock. --- .../Magento/Wishlist/Controller/Index/Update.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Wishlist/Controller/Index/Update.php b/app/code/Magento/Wishlist/Controller/Index/Update.php index e5fbd4b93f82e..ca096217ab9cb 100644 --- a/app/code/Magento/Wishlist/Controller/Index/Update.php +++ b/app/code/Magento/Wishlist/Controller/Index/Update.php @@ -70,7 +70,12 @@ public function execute() } $post = $this->getRequest()->getPostValue(); - if ($post && isset($post['description']) && is_array($post['description'])) { + $resultRedirect->setPath('*', ['wishlist_id' => $wishlist->getId()]); + if (!$post) { + return $resultRedirect; + } + + if (isset($post['description']) && is_array($post['description'])) { $updatedItems = 0; foreach ($post['description'] as $itemId => $description) { @@ -136,13 +141,12 @@ public function execute() $this->messageManager->addErrorMessage(__('Can\'t update wish list')); } } + } - if (isset($post['save_and_share'])) { - $resultRedirect->setPath('*/*/share', ['wishlist_id' => $wishlist->getId()]); - return $resultRedirect; - } + if (isset($post['save_and_share'])) { + $resultRedirect->setPath('*/*/share', ['wishlist_id' => $wishlist->getId()]); } - $resultRedirect->setPath('*', ['wishlist_id' => $wishlist->getId()]); + return $resultRedirect; } } From 860af386adae830d5ba50b5ae3fb66946ad6badd Mon Sep 17 00:00:00 2001 From: Patrick McLain <pmclain@somethingdigital.com> Date: Thu, 26 Dec 2019 16:20:15 -0500 Subject: [PATCH 0581/1143] Fix static tests --- app/code/Magento/Wishlist/Controller/Index/Update.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Wishlist/Controller/Index/Update.php b/app/code/Magento/Wishlist/Controller/Index/Update.php index ca096217ab9cb..ceb001a61c405 100644 --- a/app/code/Magento/Wishlist/Controller/Index/Update.php +++ b/app/code/Magento/Wishlist/Controller/Index/Update.php @@ -11,7 +11,7 @@ use Magento\Framework\Controller\ResultFactory; /** - * Class Update + * Controller for updating wishlists */ class Update extends \Magento\Wishlist\Controller\AbstractIndex implements HttpPostActionInterface { From 5e284e0dec5559315e18e6e9505fc19e6fb6a807 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Thu, 26 Dec 2019 20:17:02 -0600 Subject: [PATCH 0582/1143] Fix action group according to changes in mainline --- .../Catalog/Test/Mftf/Test/StorefrontFotoramaArrowsTest.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontFotoramaArrowsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontFotoramaArrowsTest.xml index 239ec975a9663..1a8e0c95a304c 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontFotoramaArrowsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontFotoramaArrowsTest.xml @@ -38,13 +38,13 @@ </actionGroup> <!-- Add images to product --> - <actionGroup ref="addProductImage" stepKey="addFirstImageToProduct"> + <actionGroup ref="AddProductImageActionGroup" stepKey="addFirstImageToProduct"> <argument name="image" value="MagentoLogo"/> </actionGroup> - <actionGroup ref="addProductImage" stepKey="addSecondImageToProduct"> + <actionGroup ref="AddProductImageActionGroup" stepKey="addSecondImageToProduct"> <argument name="image" value="ProductImage"/> </actionGroup> - <actionGroup ref="addProductImage" stepKey="addThirdImageToProduct"> + <actionGroup ref="AddProductImageActionGroup" stepKey="addThirdImageToProduct"> <argument name="image" value="TestImageNew"/> </actionGroup> <actionGroup ref="SaveProductFormActionGroup" stepKey="saveSimpleProduct"/> From 4e266f2ef1c310a2b8f3846c33e6fb26034e6dd9 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Thu, 26 Dec 2019 22:09:28 -0600 Subject: [PATCH 0583/1143] Fix action group according to changes in mainline --- .../Mftf/Test/ProductAttributeWithoutValueInCompareListTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/ProductAttributeWithoutValueInCompareListTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/ProductAttributeWithoutValueInCompareListTest.xml index f32ce60706423..f1288da1e6125 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/ProductAttributeWithoutValueInCompareListTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/ProductAttributeWithoutValueInCompareListTest.xml @@ -23,7 +23,7 @@ <createData entity="CatalogAttributeSet" stepKey="createAttributeSet"/> <amOnPage url="{{AdminProductAttributeSetEditPage.url}}/$$createAttributeSet.attribute_set_id$$/" stepKey="onAttributeSetEdit"/> - <actionGroup ref="AssignAttributeToGroup" stepKey="assignAttributeToGroup"> + <actionGroup ref="AssignAttributeToGroupActionGroup" stepKey="assignAttributeToGroup"> <argument name="group" value="Product Details"/> <argument name="attribute" value="$$createProductAttribute.attribute_code$$"/> </actionGroup> From 03e4cb8d5afb3b55ee6af3af1cdc86dcd69c3eca Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Thu, 26 Dec 2019 22:10:34 -0600 Subject: [PATCH 0584/1143] Update actiongroup according to changes in mainline --- .../StorefrontNoJavascriptErrorOnAddYourReviewClickTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Review/Test/Mftf/Test/StorefrontNoJavascriptErrorOnAddYourReviewClickTest.xml b/app/code/Magento/Review/Test/Mftf/Test/StorefrontNoJavascriptErrorOnAddYourReviewClickTest.xml index 667e352cde837..72b175d2dcacb 100644 --- a/app/code/Magento/Review/Test/Mftf/Test/StorefrontNoJavascriptErrorOnAddYourReviewClickTest.xml +++ b/app/code/Magento/Review/Test/Mftf/Test/StorefrontNoJavascriptErrorOnAddYourReviewClickTest.xml @@ -22,7 +22,7 @@ <createData entity="CatalogAttributeSet" stepKey="createAttributeSet"/> <amOnPage url="{{AdminProductAttributeSetEditPage.url}}/$$createAttributeSet.attribute_set_id$$/" stepKey="onAttributeSetEdit"/> - <actionGroup ref="AssignAttributeToGroup" stepKey="assignAttributeToGroup"> + <actionGroup ref="AssignAttributeToGroupActionGroup" stepKey="assignAttributeToGroup"> <argument name="group" value="Product Details"/> <argument name="attribute" value="$$createProductAttribute.attribute_code$$"/> </actionGroup> From 8ecddac6d3c8dc38186e58478fa0ab9c45e93aa1 Mon Sep 17 00:00:00 2001 From: OlgaVasyltsun <olga.vasyltsun@gmail.com> Date: Fri, 27 Dec 2019 09:05:37 +0200 Subject: [PATCH 0585/1143] MC-29047: Fix MFTF test --- .../StorefrontCheckCategorySimpleProductActionGroup.xml | 2 +- ...yConfigurableProductChildAssignedToSeparateCategoryTest.xml} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename app/code/Magento/ConfigurableProduct/Test/Mftf/Test/{StorefrontShouldSeeOnlyConfigurableProductChildAssignedToSeparateCategoryTest.XML => StorefrontShouldSeeOnlyConfigurableProductChildAssignedToSeparateCategoryTest.xml} (98%) diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckCategorySimpleProductActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckCategorySimpleProductActionGroup.xml index 33956073bcd88..ef8d5e3a1212a 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckCategorySimpleProductActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckCategorySimpleProductActionGroup.xml @@ -16,7 +16,7 @@ <argument name="product"/> </arguments> - <waitForElementVisible selector="{{StorefrontCategoryProductSection.ProductTitleByName(productName)}}" stepKey="waitForProduct"/> + <waitForElementVisible selector="{{StorefrontCategoryProductSection.ProductTitleByName(product.name)}}" stepKey="waitForProduct"/> <seeElement selector="{{StorefrontCategoryProductSection.ProductTitleByName(product.name)}}" stepKey="assertProductName"/> <see userInput="${{product.price}}.00" selector="{{StorefrontCategoryProductSection.ProductPriceByName(product.name)}}" stepKey="AssertProductPrice"/> <!-- @TODO: MAGETWO-80272 Move to Magento_Checkout --> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontShouldSeeOnlyConfigurableProductChildAssignedToSeparateCategoryTest.XML b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontShouldSeeOnlyConfigurableProductChildAssignedToSeparateCategoryTest.xml similarity index 98% rename from app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontShouldSeeOnlyConfigurableProductChildAssignedToSeparateCategoryTest.XML rename to app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontShouldSeeOnlyConfigurableProductChildAssignedToSeparateCategoryTest.xml index 7df075f2179f6..56a4e35995ba2 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontShouldSeeOnlyConfigurableProductChildAssignedToSeparateCategoryTest.XML +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontShouldSeeOnlyConfigurableProductChildAssignedToSeparateCategoryTest.xml @@ -97,7 +97,7 @@ </after> <!-- Go to the product page for the first product --> - <actionGroup ref="goToProductPageViaID" stepKey="openConfigChildProduct1Page"> + <actionGroup ref="GoToProductPageViaIDActionGroup" stepKey="openConfigChildProduct1Page"> <argument name="productId" value="$$createConfigChildProduct1.id$$"/> </actionGroup> From b51f02a4e439e8290d92c9d86bb9ec3b0f131a62 Mon Sep 17 00:00:00 2001 From: Mykhailo Matiola <mykhailo.matiola@transoftgroup.com> Date: Fri, 27 Dec 2019 10:48:48 +0200 Subject: [PATCH 0586/1143] MC-25125: Layered Navigation with different Scope for attribute --- ...fferent_price_products_on_two_websites.php | 26 +++ ...rice_products_on_two_websites_rollback.php | 9 + .../Block/Navigation/AbstractFiltersTest.php | 55 +++--- .../Navigation/Category/DecimalFilterTest.php | 9 +- .../Navigation/Category/FilterScopeTest.php | 160 ++++++++++++++++++ 5 files changed, 234 insertions(+), 25 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/category_with_different_price_products_on_two_websites.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/category_with_different_price_products_on_two_websites_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/FilterScopeTest.php diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/category_with_different_price_products_on_two_websites.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/category_with_different_price_products_on_two_websites.php new file mode 100644 index 0000000000000..91a5ece179ba6 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/category_with_different_price_products_on_two_websites.php @@ -0,0 +1,26 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Store\Api\WebsiteRepositoryInterface; +use Magento\TestFramework\Helper\Bootstrap; + +require __DIR__ . '/category_with_different_price_products.php'; +require __DIR__ . '/../../Store/_files/second_website_with_two_stores.php'; + +$objectManager = Bootstrap::getObjectManager(); +/** @var WebsiteRepositoryInterface $websiteRepository */ +$websiteRepository = $objectManager->get(WebsiteRepositoryInterface::class); +$defaultWebsiteId = $websiteRepository->get('base')->getId(); +$websiteId = $websiteRepository->get('test')->getId(); + +$product = $productRepository->get('simple1000'); +$product->setWebsiteIds([$defaultWebsiteId, $websiteId]); +$productRepository->save($product); + +$product = $productRepository->get('simple1001'); +$product->setWebsiteIds([$defaultWebsiteId, $websiteId]); +$productRepository->save($product); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/category_with_different_price_products_on_two_websites_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/category_with_different_price_products_on_two_websites_rollback.php new file mode 100644 index 0000000000000..d4c531c4da4db --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/category_with_different_price_products_on_two_websites_rollback.php @@ -0,0 +1,9 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +require __DIR__ . '/category_with_different_price_products_rollback.php'; +require __DIR__ . '/../../Store/_files/second_website_with_two_stores_rollback.php'; diff --git a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/AbstractFiltersTest.php b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/AbstractFiltersTest.php index 472eac444b9d4..fed8c76852872 100644 --- a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/AbstractFiltersTest.php +++ b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/AbstractFiltersTest.php @@ -74,22 +74,9 @@ protected function setUp() $this->objectManager = Bootstrap::getObjectManager(); $this->categoryCollectionFactory = $this->objectManager->create(CollectionFactory::class); $this->layout = $this->objectManager->get(LayoutInterface::class); - $layerResolver = $this->objectManager->create(Resolver::class); - - if ($this->getLayerType() === Resolver::CATALOG_LAYER_SEARCH) { - $layerResolver->create(Resolver::CATALOG_LAYER_SEARCH); - $this->navigationBlock = $this->objectManager->create( - SearchNavigationBlock::class, - [ - 'layerResolver' => $layerResolver, - ] - ); - } else { - $this->navigationBlock = $this->objectManager->create(CategoryNavigationBlock::class); - } - $this->attributeRepository = $this->objectManager->create(ProductAttributeRepositoryInterface::class); $this->productRepository = $this->objectManager->create(ProductRepositoryInterface::class); + $this->createNavigationBlockInstance(); } /** @@ -121,7 +108,7 @@ protected function getCategoryFiltersAndAssert( array $expectation, string $categoryName ): void { - $this->updateAttribute($this->getAttributeCode(), $attributeData); + $this->updateAttribute($attributeData); $this->updateProducts($products, $this->getAttributeCode()); $this->clearInstanceAndReindexSearch(); $category = $this->loadCategory($categoryName, Store::DEFAULT_STORE_ID); @@ -150,7 +137,7 @@ protected function getSearchFiltersAndAssert( array $attributeData, array $expectation ): void { - $this->updateAttribute($this->getAttributeCode(), $attributeData); + $this->updateAttribute($attributeData); $this->updateProducts($products, $this->getAttributeCode()); $this->clearInstanceAndReindexSearch(); $this->navigationBlock->getRequest()->setParams(['q' => 'Simple Product']); @@ -188,15 +175,13 @@ function (AbstractFilter $filter) use ($code) { /** * Updates attribute data. * - * @param string $attributeCode * @param array $data * @return void */ protected function updateAttribute( - string $attributeCode, array $data ): void { - $attribute = $this->attributeRepository->get($attributeCode); + $attribute = $this->attributeRepository->get($this->getAttributeCode()); $attribute->addData($data); $this->attributeRepository->save($attribute); } @@ -226,14 +211,18 @@ protected function prepareFilterItems(AbstractFilter $filter): array * * @param array $products * @param string $attributeCode + * @param int $storeId * @return void */ - protected function updateProducts(array $products, string $attributeCode): void - { + protected function updateProducts( + array $products, + string $attributeCode, + int $storeId = Store::DEFAULT_STORE_ID + ): void { $attribute = $this->attributeRepository->get($attributeCode); foreach ($products as $productSku => $stringValue) { - $product = $this->productRepository->get($productSku, false, Store::DEFAULT_STORE_ID, true); + $product = $this->productRepository->get($productSku, false, $storeId, true); $product->addData( [$attribute->getAttributeCode() => $attribute->getSource()->getOptionId($stringValue)] ); @@ -275,4 +264,26 @@ protected function loadCategory(string $categoryName, int $storeId): CategoryInt return $category; } + + /** + * Creates navigation block instance. + * + * @return void + */ + protected function createNavigationBlockInstance(): void + { + $layerResolver = $this->objectManager->create(Resolver::class); + + if ($this->getLayerType() === Resolver::CATALOG_LAYER_SEARCH) { + $layerResolver->create(Resolver::CATALOG_LAYER_SEARCH); + $this->navigationBlock = $this->objectManager->create( + SearchNavigationBlock::class, + [ + 'layerResolver' => $layerResolver, + ] + ); + } else { + $this->navigationBlock = $this->objectManager->create(CategoryNavigationBlock::class); + } + } } diff --git a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/DecimalFilterTest.php b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/DecimalFilterTest.php index c8cb6397b12fd..eb4148d77b21e 100644 --- a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/DecimalFilterTest.php +++ b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/DecimalFilterTest.php @@ -74,12 +74,15 @@ protected function prepareFilterItems(AbstractFilter $filter): array /** * @inheritdoc */ - protected function updateProducts(array $products, string $attributeCode): void - { + protected function updateProducts( + array $products, + string $attributeCode, + int $storeId = Store::DEFAULT_STORE_ID + ): void { $attribute = $this->attributeRepository->get($attributeCode); foreach ($products as $productSku => $value) { - $product = $this->productRepository->get($productSku, false, Store::DEFAULT_STORE_ID, true); + $product = $this->productRepository->get($productSku, false, $storeId, true); $product->addData( [$attribute->getAttributeCode() => $value] ); diff --git a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/FilterScopeTest.php b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/FilterScopeTest.php new file mode 100644 index 0000000000000..5dad3c0cafa24 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/FilterScopeTest.php @@ -0,0 +1,160 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\LayeredNavigation\Block\Navigation\Category; + +use Magento\Catalog\Model\Layer\Filter\AbstractFilter; +use Magento\Catalog\Model\Layer\Resolver; +use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface; +use Magento\LayeredNavigation\Block\Navigation\AbstractFiltersTest; +use Magento\Store\Model\StoreManagerInterface; + +/** + * Provides tests for custom filter with different scopes in navigation block on category page. + * + * @magentoAppArea frontend + * @magentoAppIsolation enabled + * @magentoDbIsolation disabled + */ +class FilterScopeTest extends AbstractFiltersTest +{ + /** + * @var StoreManagerInterface + */ + private $storeManager; + + /** + * @var int + */ + private $oldStoreId; + + /** + * @var int + */ + private $currentStoreId; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + $this->storeManager = $this->objectManager->get(StoreManagerInterface::class); + $this->oldStoreId = (int)$this->storeManager->getStore()->getId(); + $this->currentStoreId = (int)$this->storeManager->getStore('fixture_second_store')->getId(); + } + + /** + * @magentoDataFixture Magento/Catalog/_files/product_dropdown_attribute.php + * @magentoDataFixture Magento/Catalog/_files/category_with_different_price_products_on_two_websites.php + * @dataProvider filtersWithScopeDataProvider + * @param int $scope + * @param array $products + * @param array $expectation + * @return void + */ + public function testGetFilters(int $scope, array $products, array $expectation): void + { + $this->updateAttribute( + [ + 'is_filterable' => AbstractFilter::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS, + 'is_global' => $scope, + ] + ); + $this->updateProductsOnStore($products); + $this->clearInstanceAndReindexSearch(); + try { + $this->storeManager->setCurrentStore($this->currentStoreId); + $this->navigationBlock->getLayer()->setCurrentCategory( + $this->loadCategory('Category 999', $this->currentStoreId) + ); + $this->navigationBlock->setLayout($this->layout); + $filter = $this->getFilterByCode($this->navigationBlock->getFilters(), $this->getAttributeCode()); + $this->assertNotNull($filter); + $this->assertEquals($expectation, $this->prepareFilterItems($filter)); + } finally { + $this->storeManager->setCurrentStore($this->oldStoreId); + } + } + + /** + * @return array + */ + public function filtersWithScopeDataProvider(): array + { + return [ + 'with_scope_store' => [ + 'scope' => ScopedAttributeInterface::SCOPE_STORE, + 'products' => [ + 'default' => ['simple1000' => 'Option 1', 'simple1001' => 'Option 2'], + 'fixture_second_store' => ['simple1000' => 'Option 2', 'simple1001' => 'Option 3'], + ], + 'expectation' => [ + ['label' => 'Option 2', 'count' => 1], + ['label' => 'Option 3', 'count' => 1], + ], + ], + 'with_scope_website' => [ + 'scope' => ScopedAttributeInterface::SCOPE_WEBSITE, + 'products' => [ + 'default' => ['simple1000' => 'Option 3', 'simple1001' => 'Option 2'], + 'fixture_second_store' => ['simple1000' => 'Option 1', 'simple1001' => 'Option 2'], + ], + 'expectation' => [ + ['label' => 'Option 1', 'count' => 1], + ['label' => 'Option 2', 'count' => 1], + ], + ], + 'with_scope_global' => [ + 'scope' => ScopedAttributeInterface::SCOPE_GLOBAL, + 'products' => [ + 'default' => ['simple1000' => 'Option 1'], + 'fixture_second_store' => ['simple1001' => 'Option 2'], + ], + 'expectation' => [ + ['label' => 'Option 1', 'count' => 1], + ['label' => 'Option 2', 'count' => 1], + ], + ], + ]; + } + + /** + * @inheritdoc + */ + protected function getLayerType(): string + { + return Resolver::CATALOG_LAYER_CATEGORY; + } + + /** + * @inheritdoc + */ + protected function getAttributeCode(): string + { + return 'dropdown_attribute'; + } + + /** + * Updates products data for store. + * + * @param array $productsData + * @return void + */ + private function updateProductsOnStore(array $productsData): void + { + try { + foreach ($productsData as $storeCode => $products) { + $storeId = (int)$this->storeManager->getStore($storeCode)->getId(); + $this->storeManager->setCurrentStore($storeId); + $this->updateProducts($products, $this->getAttributeCode(), $storeId); + } + } finally { + $this->storeManager->setCurrentStore($this->oldStoreId); + } + } +} From 8d4759b1b17167ac950e5c05440c62956950aea4 Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Fri, 27 Dec 2019 11:55:19 +0200 Subject: [PATCH 0587/1143] MC-29864: Incorrect MC-13493 behaviour when ElasticSearch enabled --- .../Model/ResourceModel/Fulltext/Collection.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection.php b/app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection.php index 3506437ea038d..30a7c723940e2 100644 --- a/app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection.php +++ b/app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection.php @@ -385,6 +385,8 @@ public function addFieldToFilter($field, $condition = null) public function clear() { $this->searchResult = null; + $this->setFlag('has_category_filter', false); + return parent::clear(); } @@ -394,6 +396,8 @@ public function clear() protected function _reset() { $this->searchResult = null; + $this->setFlag('has_category_filter', false); + return parent::_reset(); } @@ -423,7 +427,11 @@ public function _loadEntities($printQuery = false, $logQuery = false) throw $e; } + $position = 0; foreach ($rows as $value) { + if ($this->getFlag('has_category_filter')) { + $value['cat_index_position'] = $position++; + } $object = $this->getNewEmptyItem()->setData($value); $this->addItem($object); if (isset($this->_itemsById[$object->getId()])) { @@ -432,6 +440,9 @@ public function _loadEntities($printQuery = false, $logQuery = false) $this->_itemsById[$object->getId()] = [$object]; } } + if ($this->getFlag('has_category_filter')) { + $this->setFlag('has_category_filter', false); + } return $this; } @@ -669,6 +680,7 @@ public function addCategoryFilter(\Magento\Catalog\Model\Category $category) if ($this->defaultFilterStrategyApplyChecker->isApplicable()) { parent::addCategoryFilter($category); } else { + $this->setFlag('has_category_filter', true); $this->_productLimitationPrice(); } From 27f7626fe3d2518e3f36a9f72e551191b134a299 Mon Sep 17 00:00:00 2001 From: "ivan.pletnyov" <ivan.pletnyov@transoftgroup.com> Date: Fri, 27 Dec 2019 14:40:02 +0200 Subject: [PATCH 0588/1143] MC-29689: Admin: Check Product Price index table --- .../Product/Save/AdvancedPricingTest.php | 105 ++++++++++ .../Catalog/Model/Product/Type/PriceTest.php | 193 ++++++++++++++---- ...roduct_with_tier_price_for_logged_user.php | 23 +++ ...th_tier_price_for_logged_user_rollback.php | 8 + .../_files/catalog_rule_6_off_logged_user.php | 38 ++++ ...atalog_rule_6_off_logged_user_rollback.php | 29 +++ 6 files changed, 354 insertions(+), 42 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Save/AdvancedPricingTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/simple_product_with_tier_price_for_logged_user.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/simple_product_with_tier_price_for_logged_user_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_6_off_logged_user.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_6_off_logged_user_rollback.php diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Save/AdvancedPricingTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Save/AdvancedPricingTest.php new file mode 100644 index 0000000000000..da4cf6335fb05 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Save/AdvancedPricingTest.php @@ -0,0 +1,105 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Controller\Adminhtml\Product\Save; + +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Customer\Api\Data\GroupInterface; +use Magento\Framework\App\Request\Http; +use Magento\Framework\Message\MessageInterface; +use Magento\TestFramework\TestCase\AbstractBackendController; + +/** + * Test cases for set advanced price to product. + * + * @magentoAppArea adminhtml + * @magentoDbIsolation enabled + */ +class AdvancedPricingTest extends AbstractBackendController +{ + /** + * @var ProductRepositoryInterface + */ + private $productRepository; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + $this->productRepository = $this->_objectManager->get(ProductRepositoryInterface::class); + } + + /** + * Assert that special price correctly saved to product. + * + * @magentoDataFixture Magento/Catalog/_files/product_without_options.php + * + * @return void + */ + public function testAddSpecialPriceToProduct(): void + { + $product = $this->productRepository->get('simple'); + $postData = [ + 'product' => [ + 'special_price' => 8, + ], + ]; + $this->assertNull($product->getSpecialPrice()); + $this->dispatchWithData((int)$product->getEntityId(), $postData); + $product = $this->productRepository->get('simple', false, null, true); + $this->assertEquals(8, $product->getSpecialPrice()); + } + + /** + * Assert that tier price correctly saved to product. + * + * @magentoDataFixture Magento/Catalog/_files/product_without_options.php + * + * @return void + */ + public function testAddTierPriceToProduct(): void + { + $product = $this->productRepository->get('simple'); + $postData = [ + 'product' => [ + 'tier_price' => [ + [ + 'website_id' => '0', + 'cust_group' => GroupInterface::CUST_GROUP_ALL, + 'price_qty' => '100', + 'price' => 5, + 'value_type' => 'fixed', + ] + ], + ], + ]; + $this->assertEquals(10, $product->getTierPrice(100)); + $this->dispatchWithData((int)$product->getEntityId(), $postData); + $product = $this->productRepository->get('simple', false, null, true); + $this->assertEquals(5, $product->getTierPrice(100)); + } + + /** + * Dispatch product save with data. + * + * @param int $productId + * @param array $productPostData + * @return void + */ + private function dispatchWithData(int $productId, array $productPostData): void + { + $this->getRequest()->setPostValue($productPostData); + $this->getRequest()->setMethod(Http::METHOD_POST); + $this->dispatch('backend/catalog/product/save/id/' . $productId); + $this->assertSessionMessages( + $this->contains('You saved the product.'), + MessageInterface::TYPE_SUCCESS + ); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/PriceTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/PriceTest.php index 8d3a119873afb..fe7207d310345 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/PriceTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/PriceTest.php @@ -3,105 +3,214 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Catalog\Model\Product\Type; +use Magento\Catalog\Api\Data\ProductCustomOptionInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\Product\Option; +use Magento\Customer\Model\Session; +use Magento\Framework\DataObject; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\ObjectManager; +use PHPUnit\Framework\TestCase; /** + * Simple product price test. + * * @magentoDataFixture Magento/Catalog/_files/product_simple.php + * @magentoDbIsolation enabled */ -class PriceTest extends \PHPUnit\Framework\TestCase +class PriceTest extends TestCase { /** - * @var \Magento\Catalog\Model\Product\Type\Price + * @var ObjectManager + */ + private $objectManager; + + /** + * @var Price */ - protected $_model; + private $productPrice; - protected function setUp() + /** + * @var ProductRepositoryInterface + */ + private $productRepository; + + /** + * @var Session + */ + private $customerSession; + + /** + * @inheritdoc + */ + protected function setUp(): void { - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - \Magento\Catalog\Model\Product\Type\Price::class - ); + $this->objectManager = Bootstrap::getObjectManager(); + $this->productPrice = $this->objectManager->create(Price::class); + $this->productRepository = $this->objectManager->create(ProductRepositoryInterface::class); + $this->customerSession = $this->objectManager->get(Session::class); } - public function testGetPrice() + /** + * Assert that for logged user product price equal to price from catalog rule. + * + * @magentoDataFixture Magento/Catalog/_files/product_simple.php + * @magentoDataFixture Magento/CatalogRule/_files/catalog_rule_6_off_logged_user.php + * @magentoDataFixture Magento/Customer/_files/customer.php + * + * @magentoDbIsolation disabled + * @magentoAppArea frontend + * @magentoAppIsolation enabled + * + * @return void + */ + public function testPriceByRuleForLoggedUser(): void { - $this->assertEquals('test', $this->_model->getPrice(new \Magento\Framework\DataObject(['price' => 'test']))); + $product = $this->productRepository->get('simple'); + $this->assertEquals(10, $this->productPrice->getFinalPrice(1, $product)); + $this->customerSession->setCustomerId(1); + try { + $this->assertEquals(4, $this->productPrice->getFinalPrice(1, $product)); + } finally { + $this->customerSession->setCustomerId(null); + } } - public function testGetFinalPrice() + /** + * Assert price for different customer groups. + * + * @magentoDataFixture Magento/Catalog/_files/simple_product_with_tier_price_for_logged_user.php + * @magentoDataFixture Magento/Customer/_files/customer.php + * + * @magentoAppIsolation enabled + * + * @return void + */ + public function testTierPriceWithDifferentCustomerGroups(): void { - $repository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - \Magento\Catalog\Model\ProductRepository::class - ); - $product = $repository->get('simple'); - // fixture + $product = $this->productRepository->get('simple'); + $this->assertEquals(8, $this->productPrice->getFinalPrice(2, $product)); + $this->assertEquals(5, $this->productPrice->getFinalPrice(3, $product)); + $this->customerSession->setCustomerId(1); + try { + $this->assertEquals(1, $this->productPrice->getFinalPrice(3, $product)); + } finally { + $this->customerSession->setCustomerId(null); + } + } + + /** + * Get price from custom object. + * + * @return void + */ + public function testGetPrice(): void + { + $objectWithPrice = $this->objectManager->create(DataObject::class, ['data' => ['price' => 'test']]); + $this->assertEquals('test', $this->productPrice->getPrice($objectWithPrice)); + } + + /** + * Get product final price for different product count. + * + * @return void + */ + public function testGetFinalPrice(): void + { + $product = $this->productRepository->get('simple'); // regular & tier prices - $this->assertEquals(10.0, $this->_model->getFinalPrice(1, $product)); - $this->assertEquals(8.0, $this->_model->getFinalPrice(2, $product)); - $this->assertEquals(5.0, $this->_model->getFinalPrice(5, $product)); + $this->assertEquals(10.0, $this->productPrice->getFinalPrice(1, $product)); + $this->assertEquals(8.0, $this->productPrice->getFinalPrice(2, $product)); + $this->assertEquals(5.0, $this->productPrice->getFinalPrice(5, $product)); // with options $buyRequest = $this->prepareBuyRequest($product); $product->getTypeInstance()->prepareForCart($buyRequest, $product); //product price + options price(10+1+2+3+3) - $this->assertEquals(19.0, $this->_model->getFinalPrice(1, $product)); + $this->assertEquals(19.0, $this->productPrice->getFinalPrice(1, $product)); //product tier price + options price(5+1+2+3+3) - $this->assertEquals(14.0, $this->_model->getFinalPrice(5, $product)); + $this->assertEquals(14.0, $this->productPrice->getFinalPrice(5, $product)); } - public function testGetFormatedPrice() + /** + * Assert that formated price is correct. + * + * @return void + */ + public function testGetFormatedPrice(): void { - $repository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - \Magento\Catalog\Model\ProductRepository::class - ); - $product = $repository->get('simple'); - // fixture - $this->assertEquals('<span class="price">$10.00</span>', $this->_model->getFormatedPrice($product)); + $product = $this->productRepository->get('simple'); + $this->assertEquals('<span class="price">$10.00</span>', $this->productPrice->getFormatedPrice($product)); } - public function testCalculatePrice() + /** + * Test calculate price by date. + * + * @return void + */ + public function testCalculatePrice(): void { - $this->assertEquals(10, $this->_model->calculatePrice(10, 8, '1970-12-12 23:59:59', '1971-01-01 01:01:01')); - $this->assertEquals(8, $this->_model->calculatePrice(10, 8, '1970-12-12 23:59:59', '2034-01-01 01:01:01')); + $this->assertEquals( + 10, + $this->productPrice->calculatePrice(10, 8, '1970-12-12 23:59:59', '1971-01-01 01:01:01') + ); + $this->assertEquals( + 8, + $this->productPrice->calculatePrice(10, 8, '1970-12-12 23:59:59', '2034-01-01 01:01:01') + ); } - public function testCalculateSpecialPrice() + /** + * Test calculate price by date. + * + * @return void + */ + public function testCalculateSpecialPrice(): void { $this->assertEquals( 10, - $this->_model->calculateSpecialPrice(10, 8, '1970-12-12 23:59:59', '1971-01-01 01:01:01') + $this->productPrice->calculateSpecialPrice(10, 8, '1970-12-12 23:59:59', '1971-01-01 01:01:01') ); $this->assertEquals( 8, - $this->_model->calculateSpecialPrice(10, 8, '1970-12-12 23:59:59', '2034-01-01 01:01:01') + $this->productPrice->calculateSpecialPrice(10, 8, '1970-12-12 23:59:59', '2034-01-01 01:01:01') ); } - public function testIsTierPriceFixed() + /** + * Assert that product tier price is fixed. + * + * @return void + */ + public function testIsTierPriceFixed(): void { - $this->assertTrue($this->_model->isTierPriceFixed()); + $this->assertTrue($this->productPrice->isTierPriceFixed()); } /** - * Build buy request based on product custom options + * Build buy request based on product custom options. * * @param Product $product - * @return \Magento\Framework\DataObject + * @return DataObject */ - private function prepareBuyRequest(Product $product) + private function prepareBuyRequest(Product $product): DataObject { $options = []; - /** @var $option \Magento\Catalog\Model\Product\Option */ + /** @var Option $option */ foreach ($product->getOptions() as $option) { switch ($option->getGroupByType()) { - case \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_GROUP_DATE: + case ProductCustomOptionInterface::OPTION_GROUP_DATE: $value = ['year' => 2013, 'month' => 8, 'day' => 9, 'hour' => 13, 'minute' => 35]; break; - case \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_GROUP_SELECT: + case ProductCustomOptionInterface::OPTION_GROUP_SELECT: $value = key($option->getValues()); break; default: @@ -111,6 +220,6 @@ private function prepareBuyRequest(Product $product) $options[$option->getId()] = $value; } - return new \Magento\Framework\DataObject(['qty' => 1, 'options' => $options]); + return $this->objectManager->create(DataObject::class, ['data' => ['qty' => 1, 'options' => $options]]); } } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/simple_product_with_tier_price_for_logged_user.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/simple_product_with_tier_price_for_logged_user.php new file mode 100644 index 0000000000000..e7e64566a4371 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/simple_product_with_tier_price_for_logged_user.php @@ -0,0 +1,23 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +require __DIR__ . '/product_simple.php'; + +$product = $productRepository->get('simple', false, null, true); +$tierPrices = $product->getTierPrices() ?? []; +$tierPriceExtensionAttributes = $tpExtensionAttributesFactory->create()->setWebsiteId($adminWebsite->getId()); +$tierPrices[] = $tierPriceFactory->create( + [ + 'data' => [ + 'customer_group_id' => 1, + 'qty' => 3, + 'value' => 1 + ] + ] +)->setExtensionAttributes($tierPriceExtensionAttributes); +$product->setTierPrices($tierPrices); +$productRepository->save($product); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/simple_product_with_tier_price_for_logged_user_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/simple_product_with_tier_price_for_logged_user_rollback.php new file mode 100644 index 0000000000000..e17fdac4904c9 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/simple_product_with_tier_price_for_logged_user_rollback.php @@ -0,0 +1,8 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +require __DIR__ . '/product_simple_rollback.php'; diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_6_off_logged_user.php b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_6_off_logged_user.php new file mode 100644 index 0000000000000..3343a837d17db --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_6_off_logged_user.php @@ -0,0 +1,38 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\CatalogRule\Api\CatalogRuleRepositoryInterface; +use Magento\CatalogRule\Api\Data\RuleInterface; +use Magento\CatalogRule\Api\Data\RuleInterfaceFactory; +use Magento\CatalogRule\Model\Indexer\IndexBuilder; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var IndexBuilder $indexBuilder */ +$indexBuilder = $objectManager->get(IndexBuilder::class); +/** @var CatalogRuleRepositoryInterface $catalogRuleRepository */ +$catalogRuleRepository = $objectManager->get(CatalogRuleRepositoryInterface::class); +/** @var RuleInterfaceFactory $catalogRuleFactory */ +$catalogRuleFactory = $objectManager->get(RuleInterfaceFactory::class); +$catalogRule = $catalogRuleFactory->create( + [ + 'data' => [ + RuleInterface::IS_ACTIVE => 1, + RuleInterface::NAME => 'Test Catalog Rule for logged user', + 'customer_group_ids' => 1, + RuleInterface::DISCOUNT_AMOUNT => 6, + 'website_ids' => [1], + RuleInterface::SIMPLE_ACTION => 'by_fixed', + RuleInterface::STOP_RULES_PROCESSING => false, + RuleInterface::SORT_ORDER => 0, + 'sub_is_enable' => 0, + 'sub_discount_amount' => 0, + ] + ] +); +$catalogRuleRepository->save($catalogRule); +$indexBuilder->reindexFull(); diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_6_off_logged_user_rollback.php b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_6_off_logged_user_rollback.php new file mode 100644 index 0000000000000..37c2c8c1f2173 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_6_off_logged_user_rollback.php @@ -0,0 +1,29 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\CatalogRule\Api\CatalogRuleRepositoryInterface; +use Magento\CatalogRule\Model\Indexer\IndexBuilder; +use Magento\CatalogRule\Model\ResourceModel\Rule\CollectionFactory; +use Magento\CatalogRule\Model\Rule; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var IndexBuilder $indexBuilder */ +$indexBuilder = $objectManager->get(IndexBuilder::class); +/** @var CatalogRuleRepositoryInterface $ruleRepository */ +$ruleRepository = $objectManager->create(CatalogRuleRepositoryInterface::class); +/** @var CollectionFactory $ruleCollectionFactory */ +$ruleCollectionFactory = $objectManager->get(CollectionFactory::class); +$ruleCollection = $ruleCollectionFactory->create(); +$ruleCollection->addFieldToFilter('name', ['eq' => 'Test Catalog Rule for logged user']); +$ruleCollection->setPageSize(1); +/** @var Rule $rule */ +$rule = $ruleCollection->getFirstItem(); +if ($rule->getId()) { + $ruleRepository->delete($rule); +} +$indexBuilder->reindexFull(); From 27a415cf85cfc30bebd810e5d037334f3fcd53e8 Mon Sep 17 00:00:00 2001 From: "ivan.pletnyov" <ivan.pletnyov@transoftgroup.com> Date: Fri, 27 Dec 2019 14:45:35 +0200 Subject: [PATCH 0589/1143] MC-24952: Storefront: Product custom options on product page --- .../View/Options/DateGroupDataProvider.php | 210 ++++++++++ .../View/Options/FileGroupDataProvider.php | 134 +++++++ .../View/Options/SelectGroupDataProvider.php | 363 ++++++++++++++++++ .../View/Options/TextGroupDataProvider.php | 212 ++++++++++ .../View/Options/RenderOptionsTest.php | 295 ++++++++++++++ 5 files changed, 1214 insertions(+) create mode 100644 dev/tests/integration/framework/Magento/TestFramework/Catalog/Block/Product/View/Options/DateGroupDataProvider.php create mode 100644 dev/tests/integration/framework/Magento/TestFramework/Catalog/Block/Product/View/Options/FileGroupDataProvider.php create mode 100644 dev/tests/integration/framework/Magento/TestFramework/Catalog/Block/Product/View/Options/SelectGroupDataProvider.php create mode 100644 dev/tests/integration/framework/Magento/TestFramework/Catalog/Block/Product/View/Options/TextGroupDataProvider.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Options/RenderOptionsTest.php diff --git a/dev/tests/integration/framework/Magento/TestFramework/Catalog/Block/Product/View/Options/DateGroupDataProvider.php b/dev/tests/integration/framework/Magento/TestFramework/Catalog/Block/Product/View/Options/DateGroupDataProvider.php new file mode 100644 index 0000000000000..7f9d5362c4f83 --- /dev/null +++ b/dev/tests/integration/framework/Magento/TestFramework/Catalog/Block/Product/View/Options/DateGroupDataProvider.php @@ -0,0 +1,210 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\TestFramework\Catalog\Block\Product\View\Options; + +use Magento\Catalog\Api\Data\ProductCustomOptionInterface; +use Magento\Catalog\Model\Product\Option; + +/** + * Data provider with product custom options from date group(date, date & time, time). + */ +class DateGroupDataProvider +{ + /** + * Return options data. + * + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + * + * @return array + */ + public function getData(): array + { + return [ + 'type_date_required' => [ + [ + Option::KEY_TITLE => 'Test option date title 1', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_DATE, + Option::KEY_IS_REQUIRE => 1, + Option::KEY_PRICE => 10, + Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_SKU => 'test-option-date-title-1', + ], + [ + 'block_with_required_class' => '<div class="field date required"', + 'title' => '<span>Test option date title 1</span>', + 'price' => 'data-price-amount="10"', + ], + ], + 'type_date_not_required' => [ + [ + Option::KEY_TITLE => 'Test option date title 2', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_DATE, + Option::KEY_IS_REQUIRE => 0, + Option::KEY_PRICE => 10, + Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_SKU => 'test-option-date-title-2', + ], + [ + 'block_with_required_class' => '<div class="field date"', + 'title' => '<span>Test option date title 2</span>', + 'price' => 'data-price-amount="10"', + ], + ], + 'type_date_fixed_price' => [ + [ + Option::KEY_TITLE => 'Test option date title 3', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_DATE, + Option::KEY_IS_REQUIRE => 0, + Option::KEY_PRICE => 50, + Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_SKU => 'test-option-date-title-3', + ], + [ + 'block_with_required_class' => '<div class="field date"', + 'title' => '<span>Test option date title 3</span>', + 'price' => 'data-price-amount="50"', + ], + ], + 'type_date_percent_price' => [ + [ + Option::KEY_TITLE => 'Test option date title 4', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_DATE, + Option::KEY_IS_REQUIRE => 0, + Option::KEY_PRICE => 50, + Option::KEY_PRICE_TYPE => 'percent', + Option::KEY_SKU => 'test-option-date-title-4', + ], + [ + 'block_with_required_class' => '<div class="field date"', + 'title' => '<span>Test option date title 4</span>', + 'price' => 'data-price-amount="5"', + ], + ], + 'type_date_and_time_required' => [ + [ + Option::KEY_TITLE => 'Test option date and time title 1', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_DATE_TIME, + Option::KEY_IS_REQUIRE => 1, + Option::KEY_PRICE => 10, + Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_SKU => 'test-option-date-and-time-title-1', + ], + [ + 'block_with_required_class' => '<div class="field date required"', + 'title' => '<span>Test option date and time title 1</span>', + 'price' => 'data-price-amount="10"', + ], + ], + 'type_date_and_time_not_required' => [ + [ + Option::KEY_TITLE => 'Test option date and time title 2', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_DATE_TIME, + Option::KEY_IS_REQUIRE => 0, + Option::KEY_PRICE => 10, + Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_SKU => 'test-option-date-and-time-title-2', + ], + [ + 'block_with_required_class' => '<div class="field date"', + 'title' => '<span>Test option date and time title 2</span>', + 'price' => 'data-price-amount="10"', + ], + ], + 'type_date_and_time_fixed_price' => [ + [ + Option::KEY_TITLE => 'Test option date and time title 3', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_DATE_TIME, + Option::KEY_IS_REQUIRE => 0, + Option::KEY_PRICE => 50, + Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_SKU => 'test-option-date-and-time-title-3', + ], + [ + 'block_with_required_class' => '<div class="field date"', + 'title' => '<span>Test option date and time title 3</span>', + 'price' => 'data-price-amount="50"', + ], + ], + 'type_date_and_time_percent_price' => [ + [ + Option::KEY_TITLE => 'Test option date and time title 4', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_DATE_TIME, + Option::KEY_IS_REQUIRE => 0, + Option::KEY_PRICE => 50, + Option::KEY_PRICE_TYPE => 'percent', + Option::KEY_SKU => 'test-option-date-and-time-title-4', + ], + [ + 'block_with_required_class' => '<div class="field date"', + 'title' => '<span>Test option date and time title 4</span>', + 'price' => 'data-price-amount="5"', + ], + ], + 'type_time_required' => [ + [ + Option::KEY_TITLE => 'Test option time title 1', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_TIME, + Option::KEY_IS_REQUIRE => 1, + Option::KEY_PRICE => 10, + Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_SKU => 'test-option-time-title-1', + ], + [ + 'block_with_required_class' => '<div class="field date required"', + 'title' => '<span>Test option time title 1</span>', + 'price' => 'data-price-amount="10"', + ], + ], + 'type_time_not_required' => [ + [ + Option::KEY_TITLE => 'Test option time title 2', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_TIME, + Option::KEY_IS_REQUIRE => 0, + Option::KEY_PRICE => 10, + Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_SKU => 'test-option-time-title-2', + ], + [ + 'block_with_required_class' => '<div class="field date"', + 'title' => '<span>Test option time title 2</span>', + 'price' => 'data-price-amount="10"', + ], + ], + 'type_time_fixed_price' => [ + [ + Option::KEY_TITLE => 'Test option time title 3', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_TIME, + Option::KEY_IS_REQUIRE => 0, + Option::KEY_PRICE => 50, + Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_SKU => 'test-option-time-title-3', + ], + [ + 'block_with_required_class' => '<div class="field date"', + 'title' => '<span>Test option time title 3</span>', + 'price' => 'data-price-amount="50"', + ], + ], + 'type_time_percent_price' => [ + [ + Option::KEY_TITLE => 'Test option time title 4', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_TIME, + Option::KEY_IS_REQUIRE => 0, + Option::KEY_PRICE => 50, + Option::KEY_PRICE_TYPE => 'percent', + Option::KEY_SKU => 'test-option-time-title-4', + ], + [ + 'block_with_required_class' => '<div class="field date"', + 'title' => '<span>Test option time title 4</span>', + 'price' => 'data-price-amount="5"', + ], + ], + ]; + } +} diff --git a/dev/tests/integration/framework/Magento/TestFramework/Catalog/Block/Product/View/Options/FileGroupDataProvider.php b/dev/tests/integration/framework/Magento/TestFramework/Catalog/Block/Product/View/Options/FileGroupDataProvider.php new file mode 100644 index 0000000000000..c28cb770a806e --- /dev/null +++ b/dev/tests/integration/framework/Magento/TestFramework/Catalog/Block/Product/View/Options/FileGroupDataProvider.php @@ -0,0 +1,134 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\TestFramework\Catalog\Block\Product\View\Options; + +use Magento\Catalog\Api\Data\ProductCustomOptionInterface; +use Magento\Catalog\Model\Product\Option; + +/** + * Data provider with product custom options from file group(file). + */ +class FileGroupDataProvider +{ + /** + * Return options data. + * + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + * + * @return array + */ + public function getData(): array + { + return [ + 'type_file_required' => [ + [ + Option::KEY_TITLE => 'Test option file title 1', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_FILE, + Option::KEY_IS_REQUIRE => 1, + Option::KEY_PRICE => 10, + Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_SKU => 'test-option-file-title-1', + Option::KEY_SORT_ORDER => 1, + Option::KEY_FILE_EXTENSION => 'png, jpg', + ], + [ + 'block_with_required_class' => '<div class="field file required">', + 'label_for_created_option' => '<label class="label" for="options_%s_file"', + 'title' => '<span>Test option file title 1</span>', + 'price' => 'data-price-amount="10"', + 'required_element' => '/<input type="file"/', + 'file_extension' => '<strong>png, jpg</strong>', + ], + ], + 'type_file_not_required' => [ + [ + Option::KEY_TITLE => 'Test option file title 2', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_FILE, + Option::KEY_IS_REQUIRE => 0, + Option::KEY_PRICE => 10, + Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_SKU => 'test-option-file-title-2', + Option::KEY_SORT_ORDER => 1, + Option::KEY_FILE_EXTENSION => 'png, jpg', + ], + [ + 'block_with_required_class' => '<div class="field file">', + 'label_for_created_option' => '<label class="label" for="options_%s_file"', + 'title' => '<span>Test option file title 2</span>', + 'price' => 'data-price-amount="10"', + 'required_element' => '/<input type="file"/', + 'file_extension' => '<strong>png, jpg</strong>', + ], + ], + 'type_file_fixed_price' => [ + [ + Option::KEY_TITLE => 'Test option file title 3', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_FILE, + Option::KEY_IS_REQUIRE => 0, + Option::KEY_PRICE => 50, + Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_SKU => 'test-option-file-title-3', + Option::KEY_SORT_ORDER => 1, + Option::KEY_FILE_EXTENSION => 'png, jpg', + ], + [ + 'block_with_required_class' => '<div class="field file">', + 'label_for_created_option' => '<label class="label" for="options_%s_file"', + 'title' => '<span>Test option file title 3</span>', + 'price' => 'data-price-amount="50"', + 'required_element' => '/<input type="file"/', + 'file_extension' => '<strong>png, jpg</strong>', + ], + ], + 'type_file_percent_price' => [ + [ + Option::KEY_TITLE => 'Test option file title 4', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_FILE, + Option::KEY_IS_REQUIRE => 0, + Option::KEY_PRICE => 50, + Option::KEY_PRICE_TYPE => 'percent', + Option::KEY_SKU => 'test-option-file-title-4', + Option::KEY_SORT_ORDER => 1, + Option::KEY_FILE_EXTENSION => 'png, jpg', + ], + [ + 'block_with_required_class' => '<div class="field file">', + 'label_for_created_option' => '<label class="label" for="options_%s_file"', + 'title' => '<span>Test option file title 4</span>', + 'price' => 'data-price-amount="5"', + 'required_element' => '/<input type="file"/', + 'file_extension' => '<strong>png, jpg</strong>', + ], + ], + 'type_file_with_width_and_height' => [ + [ + Option::KEY_TITLE => 'Test option file title 5', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_FILE, + Option::KEY_IS_REQUIRE => 0, + Option::KEY_PRICE => 50, + Option::KEY_PRICE_TYPE => 'percent', + Option::KEY_SKU => 'test-option-file-title-5', + Option::KEY_SORT_ORDER => 1, + Option::KEY_FILE_EXTENSION => 'png, jpg', + Option::KEY_IMAGE_SIZE_X => 10, + Option::KEY_IMAGE_SIZE_Y => 81, + ], + [ + 'block_with_required_class' => '<div class="field file">', + 'label_for_created_option' => '<label class="label" for="options_%s_file"', + 'title' => '<span>Test option file title 5</span>', + 'price' => 'data-price-amount="5"', + 'required_element' => '/<input type="file"/', + 'file_extension' => '<strong>png, jpg</strong>', + 'file_width' => '/%s:.*<strong>10 px.<\/strong>/', + 'file_height' => '/%s:.*<strong>81 px.<\/strong>/', + ], + ], + ]; + } +} diff --git a/dev/tests/integration/framework/Magento/TestFramework/Catalog/Block/Product/View/Options/SelectGroupDataProvider.php b/dev/tests/integration/framework/Magento/TestFramework/Catalog/Block/Product/View/Options/SelectGroupDataProvider.php new file mode 100644 index 0000000000000..2a13c1cd45466 --- /dev/null +++ b/dev/tests/integration/framework/Magento/TestFramework/Catalog/Block/Product/View/Options/SelectGroupDataProvider.php @@ -0,0 +1,363 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\TestFramework\Catalog\Block\Product\View\Options; + +use Magento\Catalog\Api\Data\ProductCustomOptionInterface; +use Magento\Catalog\Model\Product\Option; +use Magento\Catalog\Model\Product\Option\Value; + +/** + * Data provider with product custom options from select group(drop-down, radio buttons, checkbox, multiple select). + */ +class SelectGroupDataProvider +{ + /** + * Return options data. + * + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + * + * @return array + */ + public function getData(): array + { + return [ + 'type_drop_down_required' => [ + [ + Option::KEY_TITLE => 'Test option drop-down title 1', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_DROP_DOWN, + Option::KEY_IS_REQUIRE => 1, + ], + [ + Value::KEY_TITLE => 'Test option drop-down title 1 value 1', + Value::KEY_PRICE => 10, + Value::KEY_PRICE_TYPE => 'fixed', + Value::KEY_SKU => 'test-option-drop-down-title-1-value-1', + ], + [ + 'block_with_required_class' => '<div class="field required">', + 'label_for_created_option' => '<label class="label" for="select_%s">', + 'title' => '<span>Test option drop-down title 1</span>', + 'required_element' => '/<select/', + 'option_value_item' => '/<option value="%s" price="10" >%s \+\s{11}\$10.00.*/', + 'not_contain_arr' => [ + '/<select.*multiple="multiple"/', + ], + ], + ], + 'type_drop_down_not_required' => [ + [ + Option::KEY_TITLE => 'Test option drop-down title 2', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_DROP_DOWN, + Option::KEY_IS_REQUIRE => 0, + ], + [ + Value::KEY_TITLE => 'Test option drop-down title 2 value 1', + Value::KEY_PRICE => 10, + Value::KEY_PRICE_TYPE => 'fixed', + Value::KEY_SKU => 'test-option-drop-down-title-2-value-1', + ], + [ + 'block_with_required_class' => '<div class="field">', + 'label_for_created_option' => '<label class="label" for="select_%s">', + 'title' => '<span>Test option drop-down title 2</span>', + 'required_element' => '/<select/', + 'option_value_item' => '/<option value="%s" price="10" >%s \+\s{11}\$10.00.*/', + 'not_contain_arr' => [ + '/<select.*multiple="multiple"/', + ], + ], + ], + 'type_drop_down_value_fixed_price' => [ + [ + Option::KEY_TITLE => 'Test option drop-down title 3', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_DROP_DOWN, + Option::KEY_IS_REQUIRE => 0, + ], + [ + Value::KEY_TITLE => 'Test option drop-down title 3 value 1', + Value::KEY_PRICE => 50, + Value::KEY_PRICE_TYPE => 'fixed', + Value::KEY_SKU => 'test-option-drop-down-title-3-value-1', + ], + [ + 'block_with_required_class' => '<div class="field">', + 'label_for_created_option' => '<label class="label" for="select_%s">', + 'title' => '<span>Test option drop-down title 3</span>', + 'required_element' => '/<select/', + 'option_value_item' => '/<option value="%s" price="50" >%s \+\s{11}\$50.00.*/', + 'not_contain_arr' => [ + '/<select.*multiple="multiple"/', + ], + ], + ], + 'type_drop_down_value_percent_price' => [ + [ + Option::KEY_TITLE => 'Test option drop-down title 4', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_DROP_DOWN, + Option::KEY_IS_REQUIRE => 0, + ], + [ + Value::KEY_TITLE => 'Test option drop-down title 4 value 1', + Value::KEY_PRICE => 50, + Value::KEY_PRICE_TYPE => 'percent', + Value::KEY_SKU => 'test-option-drop-down-title-4-value-1', + ], + [ + 'block_with_required_class' => '<div class="field">', + 'label_for_created_option' => '<label class="label" for="select_%s">', + 'title' => '<span>Test option drop-down title 4</span>', + 'required_element' => '/<select/', + 'option_value_item' => '/<option value="%s" price="5" >%s \+\s{11}\$5.00.*/', + 'not_contain_arr' => [ + '/<select.*multiple="multiple"/', + ], + ], + ], + 'type_radio_button_required' => [ + [ + Option::KEY_TITLE => 'Test option radio-button title 1', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_RADIO, + Option::KEY_IS_REQUIRE => 1, + ], + [ + Value::KEY_TITLE => 'Test option radio-button title 1 value 1', + Value::KEY_PRICE => 10, + Value::KEY_PRICE_TYPE => 'fixed', + Value::KEY_SKU => 'test-option-radio-button-title-1-value-1', + ], + [ + 'block_with_required_class' => '<div class="field required">', + 'label_for_created_option' => '<label class="label" for="select_%s">', + 'title' => '<span>Test option radio-button title 1</span>', + 'required_element' => '/<input type="radio"/', + 'price' => 'data-price-amount="10"', + ], + ], + 'type_radio_button_not_required' => [ + [ + Option::KEY_TITLE => 'Test option radio-button title 2', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_RADIO, + Option::KEY_IS_REQUIRE => 0, + ], + [ + Value::KEY_TITLE => 'Test option radio-button title 2 value 1', + Value::KEY_PRICE => 10, + Value::KEY_PRICE_TYPE => 'fixed', + Value::KEY_SKU => 'test-option-radio-button-title-2-value-1', + ], + [ + 'block_with_required_class' => '<div class="field">', + 'label_for_created_option' => '<label class="label" for="select_%s">', + 'title' => '<span>Test option radio-button title 2</span>', + 'required_element' => '/<input type="radio"/', + 'price' => 'data-price-amount="10"', + ], + ], + 'type_radio_button_value_fixed_price' => [ + [ + Option::KEY_TITLE => 'Test option radio-button title 3', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_RADIO, + Option::KEY_IS_REQUIRE => 0, + ], + [ + Value::KEY_TITLE => 'Test option radio-button title 3 value 1', + Value::KEY_PRICE => 50, + Value::KEY_PRICE_TYPE => 'fixed', + Value::KEY_SKU => 'test-option-radio-button-title-3-value-1', + ], + [ + 'block_with_required_class' => '<div class="field">', + 'label_for_created_option' => '<label class="label" for="select_%s">', + 'title' => '<span>Test option radio-button title 3</span>', + 'required_element' => '/<input type="radio"/', + 'price' => 'data-price-amount="50"', + ], + ], + 'type_radio_button_value_percent_price' => [ + [ + Option::KEY_TITLE => 'Test option radio-button title 4', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_RADIO, + Option::KEY_IS_REQUIRE => 0, + ], + [ + Value::KEY_TITLE => 'Test option radio-button title 4 value 1', + Value::KEY_PRICE => 50, + Value::KEY_PRICE_TYPE => 'percent', + Value::KEY_SKU => 'test-option-radio-button-title-4-value-1', + ], + [ + 'block_with_required_class' => '<div class="field">', + 'label_for_created_option' => '<label class="label" for="select_%s">', + 'title' => '<span>Test option radio-button title 4</span>', + 'required_element' => '/<input type="radio"/', + 'price' => 'data-price-amount="5"', + ], + ], + 'type_checkbox_required' => [ + [ + Option::KEY_TITLE => 'Test option checkbox title 1', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_CHECKBOX, + Option::KEY_IS_REQUIRE => 1, + ], + [ + Value::KEY_TITLE => 'Test option checkbox title 1 value 1', + Value::KEY_PRICE => 10, + Value::KEY_PRICE_TYPE => 'fixed', + Value::KEY_SKU => 'test-option-checkbox-title-1-value-1', + ], + [ + 'block_with_required_class' => '<div class="field required">', + 'label_for_created_option' => '<label class="label" for="select_%s">', + 'title' => '<span>Test option checkbox title 1</span>', + 'required_element' => '/<input type="checkbox"/', + 'price' => 'data-price-amount="10"', + ], + ], + 'type_checkbox_not_required' => [ + [ + Option::KEY_TITLE => 'Test option checkbox title 2', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_CHECKBOX, + Option::KEY_IS_REQUIRE => 0, + ], + [ + Value::KEY_TITLE => 'Test option checkbox title 2 value 1', + Value::KEY_PRICE => 10, + Value::KEY_PRICE_TYPE => 'fixed', + Value::KEY_SKU => 'test-option-checkbox-title-2-value-1', + ], + [ + 'block_with_required_class' => '<div class="field">', + 'label_for_created_option' => '<label class="label" for="select_%s">', + 'title' => '<span>Test option checkbox title 2</span>', + 'required_element' => '/<input type="checkbox"/', + 'price' => 'data-price-amount="10"', + ], + ], + 'type_checkbox_value_fixed_price' => [ + [ + Option::KEY_TITLE => 'Test option checkbox title 3', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_CHECKBOX, + Option::KEY_IS_REQUIRE => 0, + ], + [ + Value::KEY_TITLE => 'Test option checkbox title 3 value 1', + Value::KEY_PRICE => 50, + Value::KEY_PRICE_TYPE => 'fixed', + Value::KEY_SKU => 'test-option-checkbox-title-3-value-1', + ], + [ + 'block_with_required_class' => '<div class="field">', + 'label_for_created_option' => '<label class="label" for="select_%s">', + 'title' => '<span>Test option checkbox title 3</span>', + 'required_element' => '/<input type="checkbox"/', + 'price' => 'data-price-amount="50"', + ], + ], + 'type_checkbox_value_percent_price' => [ + [ + Option::KEY_TITLE => 'Test option checkbox title 4', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_CHECKBOX, + Option::KEY_IS_REQUIRE => 0, + ], + [ + Value::KEY_TITLE => 'Test option checkbox title 4 value 1', + Value::KEY_PRICE => 50, + Value::KEY_PRICE_TYPE => 'percent', + Value::KEY_SKU => 'test-option-checkbox-title-4-value-1', + ], + [ + 'block_with_required_class' => '<div class="field">', + 'label_for_created_option' => '<label class="label" for="select_%s">', + 'title' => '<span>Test option checkbox title 4</span>', + 'required_element' => '/<input type="checkbox"/', + 'price' => 'data-price-amount="5"', + ], + ], + 'type_multiselect_required' => [ + [ + Option::KEY_TITLE => 'Test option multiselect title 1', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_MULTIPLE, + Option::KEY_IS_REQUIRE => 1, + ], + [ + Value::KEY_TITLE => 'Test option multiselect title 1 value 1', + Value::KEY_PRICE => 10, + Value::KEY_PRICE_TYPE => 'fixed', + Value::KEY_SKU => 'test-option-multiselect-title-1-value-1', + ], + [ + 'block_with_required_class' => '<div class="field required">', + 'label_for_created_option' => '<label class="label" for="select_%s">', + 'title' => '<span>Test option multiselect title 1</span>', + 'required_element' => '/<select.*multiple="multiple"/', + 'option_value_item' => '/<option value="%s" price="10" >%s \+\s{11}\$10.00.*/', + ], + ], + 'type_multiselect_not_required' => [ + [ + Option::KEY_TITLE => 'Test option multiselect title 2', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_MULTIPLE, + Option::KEY_IS_REQUIRE => 0, + ], + [ + Value::KEY_TITLE => 'Test option multiselect title 2 value 1', + Value::KEY_PRICE => 10, + Value::KEY_PRICE_TYPE => 'fixed', + Value::KEY_SKU => 'test-option-multiselect-title-2-value-1', + ], + [ + 'block_with_required_class' => '<div class="field">', + 'label_for_created_option' => '<label class="label" for="select_%s">', + 'title' => '<span>Test option multiselect title 2</span>', + 'required_element' => '/<select.*multiple="multiple"/', + 'option_value_item' => '/<option value="%s" price="10" >%s \+\s{11}\$10.00.*/', + ], + ], + 'type_multiselect_value_fixed_price' => [ + [ + Option::KEY_TITLE => 'Test option multiselect title 3', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_MULTIPLE, + Option::KEY_IS_REQUIRE => 0, + ], + [ + Value::KEY_TITLE => 'Test option multiselect title 3 value 1', + Value::KEY_PRICE => 50, + Value::KEY_PRICE_TYPE => 'fixed', + Value::KEY_SKU => 'test-option-multiselect-title-3-value-1', + ], + [ + 'block_with_required_class' => '<div class="field">', + 'label_for_created_option' => '<label class="label" for="select_%s">', + 'title' => '<span>Test option multiselect title 3</span>', + 'required_element' => '/<select.*multiple="multiple"/', + 'option_value_item' => '/<option value="%s" price="50" >%s \+\s{11}\$50.00.*/', + ], + ], + 'type_multiselect_value_percent_price' => [ + [ + Option::KEY_TITLE => 'Test option multiselect title 4', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_MULTIPLE, + Option::KEY_IS_REQUIRE => 0, + ], + [ + Value::KEY_TITLE => 'Test option multiselect title 4 value 1', + Value::KEY_PRICE => 50, + Value::KEY_PRICE_TYPE => 'percent', + Value::KEY_SKU => 'test-option-multiselect-title-4-value-1', + ], + [ + 'block_with_required_class' => '<div class="field">', + 'label_for_created_option' => '<label class="label" for="select_%s">', + 'title' => '<span>Test option multiselect title 4</span>', + 'required_element' => '/<select.*multiple="multiple"/', + 'option_value_item' => '/<option value="%s" price="5" >%s \+\s{11}\$5.00.*/', + ], + ], + ]; + } +} diff --git a/dev/tests/integration/framework/Magento/TestFramework/Catalog/Block/Product/View/Options/TextGroupDataProvider.php b/dev/tests/integration/framework/Magento/TestFramework/Catalog/Block/Product/View/Options/TextGroupDataProvider.php new file mode 100644 index 0000000000000..75a6da0593d73 --- /dev/null +++ b/dev/tests/integration/framework/Magento/TestFramework/Catalog/Block/Product/View/Options/TextGroupDataProvider.php @@ -0,0 +1,212 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\TestFramework\Catalog\Block\Product\View\Options; + +use Magento\Catalog\Api\Data\ProductCustomOptionInterface; +use Magento\Catalog\Model\Product\Option; + +/** + * Data provider with product custom options from text group(field, area). + */ +class TextGroupDataProvider +{ + /** + * Return options data. + * + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + * + * @return array + */ + public function getData(): array + { + return [ + 'type_field_required' => [ + [ + Option::KEY_TITLE => 'Test option field title 1', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_FIELD, + Option::KEY_IS_REQUIRE => 1, + Option::KEY_PRICE => 10, + Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_SKU => 'test-option-field-title-1', + Option::KEY_MAX_CHARACTERS => 0, + ], + [ + 'block_with_required_class' => '<div class="field required">', + 'label_for_created_option' => '<label class="label" for="options_%s_text">', + 'title' => '<span>Test option field title 1</span>', + 'price' => 'data-price-amount="10"', + 'required_element' => '/<input type="text"/', + ], + ], + 'type_field_not_required' => [ + [ + Option::KEY_TITLE => 'Test option field title 2', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_FIELD, + Option::KEY_IS_REQUIRE => 0, + Option::KEY_PRICE => 10, + Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_SKU => 'test-option-field-title-2', + Option::KEY_MAX_CHARACTERS => 0, + ], + [ + 'block_with_required_class' => '<div class="field">', + 'label_for_created_option' => '<label class="label" for="options_%s_text">', + 'title' => '<span>Test option field title 2</span>', + 'price' => 'data-price-amount="10"', + 'required_element' => '/<input type="text"/', + ], + ], + 'type_field_fixed_price' => [ + [ + Option::KEY_TITLE => 'Test option field title 3', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_FIELD, + Option::KEY_IS_REQUIRE => 0, + Option::KEY_PRICE => 50, + Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_SKU => 'test-option-field-title-3', + Option::KEY_MAX_CHARACTERS => 0, + ], + [ + 'block_with_required_class' => '<div class="field">', + 'label_for_created_option' => '<label class="label" for="options_%s_text">', + 'title' => '<span>Test option field title 3</span>', + 'price' => 'data-price-amount="50"', + 'required_element' => '/<input type="text"/', + ], + ], + 'type_field_percent_price' => [ + [ + Option::KEY_TITLE => 'Test option field title 4', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_FIELD, + Option::KEY_IS_REQUIRE => 0, + Option::KEY_PRICE => 50, + Option::KEY_PRICE_TYPE => 'percent', + Option::KEY_SKU => 'test-option-field-title-4', + Option::KEY_MAX_CHARACTERS => 0, + ], + [ + 'block_with_required_class' => '<div class="field">', + 'label_for_created_option' => '<label class="label" for="options_%s_text">', + 'title' => '<span>Test option field title 4</span>', + 'price' => 'data-price-amount="5"', + 'required_element' => '/<input type="text"/', + ], + ], + 'type_field_max_characters' => [ + [ + Option::KEY_TITLE => 'Test option field title 5', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_FIELD, + Option::KEY_IS_REQUIRE => 0, + Option::KEY_PRICE => 10, + Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_SKU => 'test-option-field-title-5', + Option::KEY_MAX_CHARACTERS => 99, + ], + [ + 'block_with_required_class' => '<div class="field">', + 'label_for_created_option' => '<label class="label" for="options_%s_text">', + 'title' => '<span>Test option field title 5</span>', + 'price' => 'data-price-amount="10"', + 'required_element' => '/<input type="text"/', + 'max_characters' => 'Maximum 99 characters', + ], + ], + 'type_area_required' => [ + [ + Option::KEY_TITLE => 'Test option area title 1', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_AREA, + Option::KEY_IS_REQUIRE => 1, + Option::KEY_PRICE => 10, + Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_SKU => 'test-option-area-title-1', + Option::KEY_MAX_CHARACTERS => 0, + ], + [ + 'block_with_required_class' => '<div class="field textarea required">', + 'label_for_created_option' => '<label class="label" for="options_%s_text">', + 'title' => '<span>Test option area title 1</span>', + 'price' => 'data-price-amount="10"', + 'required_element' => '/<textarea/', + ], + ], + 'type_area_not_required' => [ + [ + Option::KEY_TITLE => 'Test option area title 2', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_AREA, + Option::KEY_IS_REQUIRE => 0, + Option::KEY_PRICE => 10, + Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_SKU => 'test-option-area-title-2', + Option::KEY_MAX_CHARACTERS => 0, + ], + [ + 'block_with_required_class' => '<div class="field textarea">', + 'label_for_created_option' => '<label class="label" for="options_%s_text">', + 'title' => '<span>Test option area title 2</span>', + 'price' => 'data-price-amount="10"', + 'required_element' => '/<textarea/', + ], + ], + 'type_area_fixed_price' => [ + [ + Option::KEY_TITLE => 'Test option area title 3', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_AREA, + Option::KEY_IS_REQUIRE => 0, + Option::KEY_PRICE => 50, + Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_SKU => 'test-option-area-title-3', + Option::KEY_MAX_CHARACTERS => 0, + ], + [ + 'block_with_required_class' => '<div class="field textarea">', + 'label_for_created_option' => '<label class="label" for="options_%s_text">', + 'title' => '<span>Test option area title 3</span>', + 'price' => 'data-price-amount="50"', + 'required_element' => '/<textarea/', + ], + ], + 'type_area_percent_price' => [ + [ + Option::KEY_TITLE => 'Test option area title 4', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_AREA, + Option::KEY_IS_REQUIRE => 0, + Option::KEY_PRICE => 50, + Option::KEY_PRICE_TYPE => 'percent', + Option::KEY_SKU => 'test-option-area-title-4', + Option::KEY_MAX_CHARACTERS => 0, + ], + [ + 'block_with_required_class' => '<div class="field textarea">', + 'label_for_created_option' => '<label class="label" for="options_%s_text">', + 'title' => '<span>Test option area title 4</span>', + 'price' => 'data-price-amount="5"', + 'required_element' => '/<textarea/', + ], + ], + 'type_area_max_characters' => [ + [ + Option::KEY_TITLE => 'Test option area title 5', + Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_AREA, + Option::KEY_IS_REQUIRE => 0, + Option::KEY_PRICE => 10, + Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_SKU => 'test-option-area-title-5', + Option::KEY_MAX_CHARACTERS => 99, + ], + [ + 'block_with_required_class' => '<div class="field textarea">', + 'label_for_created_option' => '<label class="label" for="options_%s_text">', + 'title' => '<span>Test option area title 5</span>', + 'price' => 'data-price-amount="10"', + 'required_element' => '/<textarea/', + 'max_characters' => 'Maximum 99 characters', + ], + ], + ]; + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Options/RenderOptionsTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Options/RenderOptionsTest.php new file mode 100644 index 0000000000000..e83563a6ad474 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Options/RenderOptionsTest.php @@ -0,0 +1,295 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Block\Product\View\Options; + +use Magento\Catalog\Api\Data\ProductCustomOptionInterface; +use Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory; +use Magento\Catalog\Api\Data\ProductCustomOptionValuesInterfaceFactory; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Block\Product\View\Options; +use Magento\Catalog\Model\Product\Option; +use Magento\Catalog\Model\Product\Option\Value; +use Magento\Framework\View\Element\Template; +use Magento\Framework\View\Result\Page; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\Helper\CacheCleaner; +use Magento\TestFramework\ObjectManager; +use PHPUnit\Framework\TestCase; + +/** + * Assert that product custom options render as expected. + * + * @magentoDbIsolation disabled + * @magentoAppArea frontend + */ +class RenderOptionsTest extends TestCase +{ + /** + * @var ObjectManager + */ + private $objectManager; + + /** + * @var ProductRepositoryInterface + */ + private $productRepository; + + /** + * @var ProductCustomOptionInterfaceFactory + */ + private $productCustomOptionFactory; + + /** + * @var ProductCustomOptionValuesInterfaceFactory + */ + private $productCustomOptionValuesFactory; + + /** + * @var Page + */ + private $page; + + /** + * @inheritdoc + */ + protected function setUp() + { + CacheCleaner::cleanAll(); + $this->objectManager = Bootstrap::getObjectManager(); + $this->productRepository = $this->objectManager->create(ProductRepositoryInterface::class); + $this->productCustomOptionFactory = $this->objectManager->get(ProductCustomOptionInterfaceFactory::class); + $this->productCustomOptionValuesFactory = $this->objectManager->get( + ProductCustomOptionValuesInterfaceFactory::class + ); + $this->page = $this->objectManager->create(Page::class); + parent::setUp(); + } + + /** + * Check that options from text group(field, area) render as expected. + * + * @magentoDataFixture Magento/Catalog/_files/product_without_options_with_stock_data.php + * @dataProvider \Magento\TestFramework\Catalog\Block\Product\View\Options\TextGroupDataProvider::getData() + * + * @param array $optionData + * @param array $checkArray + * @return void + */ + public function testRenderCustomOptionsFromTextGroup(array $optionData, array $checkArray): void + { + $option = $this->addOptionToProduct($optionData); + $optionHtml = $this->getOptionHtml(); + $this->baseOptionAsserts($option, $optionHtml, $checkArray); + + if ($optionData[Option::KEY_MAX_CHARACTERS] > 0) { + $this->assertContains($checkArray['max_characters'], $optionHtml); + } else { + $this->assertNotContains('class="character-counter', $optionHtml); + } + } + + /** + * Check that options from file group(file) render as expected. + * + * @magentoDataFixture Magento/Catalog/_files/product_without_options_with_stock_data.php + * @dataProvider \Magento\TestFramework\Catalog\Block\Product\View\Options\FileGroupDataProvider::getData() + * + * @param array $optionData + * @param array $checkArray + * @return void + */ + public function testRenderCustomOptionsFromFileGroup(array $optionData, array $checkArray): void + { + $option = $this->addOptionToProduct($optionData); + $optionHtml = $this->getOptionHtml(); + $this->baseOptionAsserts($option, $optionHtml, $checkArray); + $this->assertContains($checkArray['file_extension'], $optionHtml); + + if (isset($checkArray['file_width'])) { + $checkArray['file_width'] = sprintf($checkArray['file_width'], __('Maximum image width')); + $this->assertRegExp($checkArray['file_width'], $optionHtml); + } + + if (isset($checkArray['file_height'])) { + $checkArray['file_height'] = sprintf($checkArray['file_height'], __('Maximum image height')); + $this->assertRegExp($checkArray['file_height'], $optionHtml); + } + } + + /** + * Check that options from select group(drop-down, radio buttons, checkbox, multiple select) render as expected. + * + * @magentoDataFixture Magento/Catalog/_files/product_without_options_with_stock_data.php + * @dataProvider \Magento\TestFramework\Catalog\Block\Product\View\Options\SelectGroupDataProvider::getData() + * + * @param array $optionData + * @param array $optionValueData + * @param array $checkArray + * @return void + */ + public function testRenderCustomOptionsFromSelectGroup( + array $optionData, + array $optionValueData, + array $checkArray + ): void { + $option = $this->addOptionToProduct($optionData, $optionValueData); + $optionValues = $option->getValues(); + $optionValue = reset($optionValues); + $optionHtml = $this->getOptionHtml(); + $this->baseOptionAsserts($option, $optionHtml, $checkArray); + + if (isset($checkArray['not_contain_arr'])) { + foreach ($checkArray['not_contain_arr'] as $notContainPattern) { + $this->assertNotRegExp($notContainPattern, $optionHtml); + } + } + + if (isset($checkArray['option_value_item'])) { + $checkArray['option_value_item'] = sprintf( + $checkArray['option_value_item'], + $optionValue->getOptionTypeId(), + $optionValueData[Value::KEY_TITLE] + ); + $this->assertRegExp($checkArray['option_value_item'], $optionHtml); + } + } + + /** + * Check that options from date group(date, date & time, time) render as expected. + * + * @magentoDataFixture Magento/Catalog/_files/product_without_options_with_stock_data.php + * @dataProvider \Magento\TestFramework\Catalog\Block\Product\View\Options\DateGroupDataProvider::getData() + * + * @param array $optionData + * @param array $checkArray + * @return void + */ + public function testRenderCustomOptionsFromDateGroup(array $optionData, array $checkArray): void + { + $option = $this->addOptionToProduct($optionData); + $optionHtml = $this->getOptionHtml(); + $this->baseOptionAsserts($option, $optionHtml, $checkArray); + + switch ($optionData[Option::KEY_TYPE]) { + case ProductCustomOptionInterface::OPTION_TYPE_DATE: + $this->assertContains("<select name=\"options[{$option->getOptionId()}][month]\"", $optionHtml); + $this->assertContains("<select name=\"options[{$option->getOptionId()}][day]\"", $optionHtml); + $this->assertContains("<select name=\"options[{$option->getOptionId()}][year]\"", $optionHtml); + $this->assertNotContains("<select name=\"options[{$option->getOptionId()}][hour]\"", $optionHtml); + $this->assertNotContains("<select name=\"options[{$option->getOptionId()}][minute]\"", $optionHtml); + $this->assertNotContains("<select name=\"options[{$option->getOptionId()}][day_part]\"", $optionHtml); + break; + case ProductCustomOptionInterface::OPTION_TYPE_DATE_TIME: + $this->assertContains("<select name=\"options[{$option->getOptionId()}][month]\"", $optionHtml); + $this->assertContains("<select name=\"options[{$option->getOptionId()}][day]\"", $optionHtml); + $this->assertContains("<select name=\"options[{$option->getOptionId()}][year]\"", $optionHtml); + $this->assertContains("<select name=\"options[{$option->getOptionId()}][hour]\"", $optionHtml); + $this->assertContains("<select name=\"options[{$option->getOptionId()}][minute]\"", $optionHtml); + $this->assertContains("<select name=\"options[{$option->getOptionId()}][day_part]\"", $optionHtml); + break; + case ProductCustomOptionInterface::OPTION_TYPE_TIME: + $this->assertNotContains("<select name=\"options[{$option->getOptionId()}][month]\"", $optionHtml); + $this->assertNotContains("<select name=\"options[{$option->getOptionId()}][day]\"", $optionHtml); + $this->assertNotContains("<select name=\"options[{$option->getOptionId()}][year]\"", $optionHtml); + $this->assertContains("<select name=\"options[{$option->getOptionId()}][hour]\"", $optionHtml); + $this->assertContains("<select name=\"options[{$option->getOptionId()}][minute]\"", $optionHtml); + $this->assertContains("<select name=\"options[{$option->getOptionId()}][day_part]\"", $optionHtml); + break; + } + } + + /** + * Base asserts for rendered options. + * + * @param ProductCustomOptionInterface $option + * @param string $optionHtml + * @param array $checkArray + * @return void + */ + private function baseOptionAsserts( + ProductCustomOptionInterface $option, + string $optionHtml, + array $checkArray + ): void { + $this->assertContains($checkArray['block_with_required_class'], $optionHtml); + $this->assertContains($checkArray['title'], $optionHtml); + + if (isset($checkArray['label_for_created_option'])) { + $checkArray['label_for_created_option'] = sprintf( + $checkArray['label_for_created_option'], + $option->getOptionId() + ); + $this->assertContains($checkArray['label_for_created_option'], $optionHtml); + } + + if (isset($checkArray['price'])) { + $this->assertContains($checkArray['price'], $optionHtml); + } + + if (isset($checkArray['required_element'])) { + $this->assertRegExp($checkArray['required_element'], $optionHtml); + } + } + + /** + * Add custom option to product with data. + * + * @param array $optionData + * @param array $optionValueData + * @return ProductCustomOptionInterface + */ + private function addOptionToProduct(array $optionData, array $optionValueData = []): ProductCustomOptionInterface + { + $product = $this->productRepository->get('simple'); + $optionData[Option::KEY_PRODUCT_SKU] = $product->getSku(); + + if (!empty($optionValueData)) { + $optionValueData = $this->productCustomOptionValuesFactory->create(['data' => $optionValueData]); + $optionData['values'] = [$optionValueData]; + } + + $option = $this->productCustomOptionFactory->create(['data' => $optionData]); + $product->setOptions([$option]); + $createdOptions = $this->productRepository->save($product)->getOptions(); + + return reset($createdOptions); + } + + /** + * Render custom options block. + * + * @return string + */ + private function getOptionHtml(): string + { + $product = $this->productRepository->get('simple'); + $optionsBlock = $this->getOptionsBlock(); + $optionsBlock->setProduct($product); + + return $optionsBlock->toHtml(); + } + + /** + * Get options block. + * + * @return Options + */ + private function getOptionsBlock(): Options + { + $this->page->addHandle([ + 'default', + 'catalog_product_view', + ]); + $this->page->getLayout()->generateXml(); + /** @var Template $productInfoFormOptionsBlock */ + $productInfoFormOptionsBlock = $this->page->getLayout()->getBlock('product.info.form.options'); + $optionsWrapperBlock = $productInfoFormOptionsBlock->getChildBlock('product_options_wrapper'); + + return $optionsWrapperBlock->getChildBlock('product_options'); + } +} From bc6ec62c9c361a2ad12013127062d123c24d7edc Mon Sep 17 00:00:00 2001 From: "ivan.pletnyov" <ivan.pletnyov@transoftgroup.com> Date: Fri, 27 Dec 2019 14:52:28 +0200 Subject: [PATCH 0590/1143] MC-24931: Admin: Delete product attribute --- .../AbstractDeleteAttributeControllerTest.php | 83 ++++++++++ .../CatalogAttributesControllerTest.php | 145 ++++++++++++++++++ .../DeleteAttributeControllerErrorTest.php | 79 ++++++++++ .../_files/product_texteditor_attribute.php | 51 ++++++ .../product_texteditor_attribute_rollback.php | 27 ++++ .../SwatchesAttributesControllerTest.php | 48 ++++++ .../Delete/WeeeAttributesControllerTest.php | 34 ++++ 7 files changed, 467 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Delete/AbstractDeleteAttributeControllerTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Delete/CatalogAttributesControllerTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Delete/DeleteAttributeControllerErrorTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Eav/_files/product_texteditor_attribute.php create mode 100644 dev/tests/integration/testsuite/Magento/Eav/_files/product_texteditor_attribute_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Delete/SwatchesAttributesControllerTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Weee/Controller/Adminhtml/Product/Attribute/Delete/WeeeAttributesControllerTest.php diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Delete/AbstractDeleteAttributeControllerTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Delete/AbstractDeleteAttributeControllerTest.php new file mode 100644 index 0000000000000..6f1ff8567349f --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Delete/AbstractDeleteAttributeControllerTest.php @@ -0,0 +1,83 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Controller\Adminhtml\Product\Attribute\Delete; + +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Framework\App\Request\Http; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Message\MessageInterface; +use Magento\TestFramework\TestCase\AbstractBackendController; + +/** + * Abstract delete attribute test using catalog/product_attribute/delete controller action. + */ +abstract class AbstractDeleteAttributeControllerTest extends AbstractBackendController +{ + /** + * @var string + */ + protected $uri = 'backend/catalog/product_attribute/delete/attribute_id/%s'; + + /** + * @var ProductAttributeRepositoryInterface + */ + private $productAttributeRepository; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + $this->productAttributeRepository = $this->_objectManager->get(ProductAttributeRepositoryInterface::class); + } + + /** + * Delete attribute via controller action. + * + * @param string $attributeCode + * @return void + */ + protected function dispatchDeleteAttribute(string $attributeCode): void + { + $attribute = $this->productAttributeRepository->get($attributeCode); + $this->getRequest()->setMethod(Http::METHOD_POST); + $this->dispatch(sprintf($this->uri, $attribute->getAttributeId())); + $this->assertSessionMessages( + $this->equalTo([(string)__('You deleted the product attribute.')]), + MessageInterface::TYPE_SUCCESS + ); + } + + /** + * Assert that attribute is deleted from DB. + * + * @param string $attributeCode + * @return void + */ + protected function assertAttributeIsDeleted(string $attributeCode): void + { + $this->expectExceptionObject( + new NoSuchEntityException( + __( + 'The attribute with a "%1" attributeCode doesn\'t exist. Verify the attribute and try again.', + $attributeCode + ) + ) + ); + $this->productAttributeRepository->get($attributeCode); + } + + /** + * @inheritdoc + */ + public function testAclHasAccess() + { + $this->markTestIncomplete('AclHasAccess test is not complete'); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Delete/CatalogAttributesControllerTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Delete/CatalogAttributesControllerTest.php new file mode 100644 index 0000000000000..e95737209cb7f --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Delete/CatalogAttributesControllerTest.php @@ -0,0 +1,145 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Controller\Adminhtml\Product\Attribute\Delete; + +/** + * Delete catalog product attributes with input types like "media_image", "price", + * "date", "select", "multiselect", "textarea", "texteditor", "text" and "boolean". + * Attributes from Magento_Catalog and Magento_Eav modules. + * + * @magentoAppArea adminhtml + * @magentoDbIsolation enabled + */ +class CatalogAttributesControllerTest extends AbstractDeleteAttributeControllerTest +{ + /** + * Assert that attribute with input type "media_image" will be deleted + * after dispatch delete product attribute action. + * + * @magentoDataFixture Magento/Catalog/_files/product_image_attribute.php + * + * @return void + */ + public function testDeleteMediaImageAttribute(): void + { + $this->dispatchDeleteAttribute('image_attribute'); + $this->assertAttributeIsDeleted('image_attribute'); + } + + /** + * Assert that attribute with input type "price" will be deleted + * after dispatch delete product attribute action. + * + * @magentoDataFixture Magento/Catalog/_files/product_decimal_attribute.php + * + * @return void + */ + public function testDeletePriceAttribute(): void + { + $this->dispatchDeleteAttribute('decimal_attribute'); + $this->assertAttributeIsDeleted('decimal_attribute'); + } + + /** + * Assert that attribute with input type "date" will be deleted + * after dispatch delete product attribute action. + * + * @magentoDataFixture Magento/Catalog/_files/product_date_attribute.php + * + * @return void + */ + public function testDeleteDateAttribute(): void + { + $this->dispatchDeleteAttribute('date_attribute'); + $this->assertAttributeIsDeleted('date_attribute'); + } + + /** + * Assert that attribute with input type "select" will be deleted + * after dispatch delete product attribute action. + * + * @magentoDataFixture Magento/Catalog/_files/product_dropdown_attribute.php + * + * @return void + */ + public function testDeleteSelectAttribute(): void + { + $this->dispatchDeleteAttribute('dropdown_attribute'); + $this->assertAttributeIsDeleted('dropdown_attribute'); + } + + /** + * Assert that attribute with input type "multiselect" will be deleted + * after dispatch delete product attribute action. + * + * @magentoDataFixture Magento/Catalog/_files/multiselect_attribute.php + * + * @return void + */ + public function testDeleteMultiselectAttribute(): void + { + $this->dispatchDeleteAttribute('multiselect_attribute'); + $this->assertAttributeIsDeleted('multiselect_attribute'); + } + + /** + * Assert that attribute with input type "textarea" will be deleted + * after dispatch delete product attribute action. + * + * @magentoDataFixture Magento/Catalog/_files/product_text_attribute.php + * + * @return void + */ + public function testDeleteTextareaAttribute(): void + { + $this->dispatchDeleteAttribute('text_attribute'); + $this->assertAttributeIsDeleted('text_attribute'); + } + + /** + * Assert that attribute with input type "texteditor" will be deleted + * after dispatch delete product attribute action. + * + * @magentoDataFixture Magento/Eav/_files/product_texteditor_attribute.php + * + * @return void + */ + public function testDeleteTextEditorAttribute(): void + { + $this->dispatchDeleteAttribute('text_editor_attribute'); + $this->assertAttributeIsDeleted('text_editor_attribute'); + } + + /** + * Assert that attribute with input type "text" will be deleted + * after dispatch delete product attribute action. + * + * @magentoDataFixture Magento/Catalog/_files/product_varchar_attribute.php + * + * @return void + */ + public function testDeleteTextAttribute(): void + { + $this->dispatchDeleteAttribute('varchar_attribute'); + $this->assertAttributeIsDeleted('varchar_attribute'); + } + + /** + * Assert that attribute with input type "boolean" will be deleted + * after dispatch delete product attribute action. + * + * @magentoDataFixture Magento/Catalog/_files/product_boolean_attribute.php + * + * @return void + */ + public function testDeleteBooleanAttribute(): void + { + $this->dispatchDeleteAttribute('boolean_attribute'); + $this->assertAttributeIsDeleted('boolean_attribute'); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Delete/DeleteAttributeControllerErrorTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Delete/DeleteAttributeControllerErrorTest.php new file mode 100644 index 0000000000000..31aef9c85b9bd --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Delete/DeleteAttributeControllerErrorTest.php @@ -0,0 +1,79 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Controller\Adminhtml\Product\Attribute\Delete; + +use Magento\Catalog\Model\Category; +use Magento\Eav\Api\AttributeRepositoryInterface; +use Magento\Framework\App\Request\Http; +use Magento\Framework\Escaper; +use Magento\Framework\Message\MessageInterface; + +/** + * Error during delete attribute using catalog/product_attribute/delete controller action. + * + * @magentoAppArea adminhtml + * @magentoDbIsolation enabled + */ +class DeleteAttributeControllerErrorTest extends AbstractDeleteAttributeControllerTest +{ + /** + * @var Escaper + */ + private $escaper; + + /** + * @var AttributeRepositoryInterface + */ + private $attributeRepository; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + $this->escaper = $this->_objectManager->get(Escaper::class); + $this->attributeRepository = $this->_objectManager->get(AttributeRepositoryInterface::class); + } + + /** + * Try to delete attribute via controller action without attribute ID. + * + * @return void + */ + public function testDispatchWithoutAttributeId(): void + { + $this->getRequest()->setMethod(Http::METHOD_POST); + $this->dispatch(sprintf($this->uri, '')); + $this->assertSessionMessages( + $this->equalTo([$this->escaper->escapeHtml((string)__('We can\'t find an attribute to delete.'))]), + MessageInterface::TYPE_ERROR + ); + } + + /** + * Try to delete category attribute via controller action. + * + * @magentoDataFixture Magento/Catalog/_files/category_attribute.php + * + * @return void + */ + public function testDispatchWithNonProductAttribute(): void + { + $categoryAttribute = $this->attributeRepository->get( + Category::ENTITY, + 'test_attribute_code_666' + ); + $this->getRequest()->setMethod(Http::METHOD_POST); + $this->dispatch(sprintf($this->uri, $categoryAttribute->getAttributeId())); + $this->assertSessionMessages( + $this->equalTo([$this->escaper->escapeHtml((string)__('We can\'t delete the attribute.'))]), + MessageInterface::TYPE_ERROR + ); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Eav/_files/product_texteditor_attribute.php b/dev/tests/integration/testsuite/Magento/Eav/_files/product_texteditor_attribute.php new file mode 100644 index 0000000000000..1ac4a35e8c6a5 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Eav/_files/product_texteditor_attribute.php @@ -0,0 +1,51 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\ResourceModel\Eav\AttributeFactory; +use Magento\Eav\Setup\EavSetup; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\Catalog\Model\Product\Attribute\Frontend\Inputtype\Presentation; + +$objectManager = Bootstrap::getObjectManager(); +/** @var AttributeFactory $attributeFactory */ +$attributeFactory = $objectManager->get(AttributeFactory::class); +/** @var ProductAttributeRepositoryInterface $productAttributeRepository */ +$productAttributeRepository = $objectManager->get(ProductAttributeRepositoryInterface::class); +$attribute = $attributeFactory->create()->loadByCode(Product::ENTITY, 'text_editor_attribute'); +if (!$attribute->getId()) { + /** @var Presentation $presentation */ + $presentation = $objectManager->get(Presentation::class); + /** @var EavSetup $installer */ + $installer = $objectManager->create(EavSetup::class); + $attributeData = [ + 'attribute_code' => 'text_editor_attribute', + 'is_global' => 1, + 'is_user_defined' => 1, + 'frontend_input' => 'texteditor', + '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' => ['Text editor attribute'], + 'backend_type' => 'text', + ]; + $attribute->setData($presentation->convertPresentationDataToInputType($attributeData)); + $productAttributeRepository->save($attribute); + $attribute = $productAttributeRepository->get('text_editor_attribute'); + /* Assign attribute to attribute set */ + $installer->addAttributeToGroup(Product::ENTITY, 'Default', 'Attributes', $attribute->getId()); +} diff --git a/dev/tests/integration/testsuite/Magento/Eav/_files/product_texteditor_attribute_rollback.php b/dev/tests/integration/testsuite/Magento/Eav/_files/product_texteditor_attribute_rollback.php new file mode 100644 index 0000000000000..e3b1fa0202a44 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Eav/_files/product_texteditor_attribute_rollback.php @@ -0,0 +1,27 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Registry; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var ProductAttributeRepositoryInterface $productAttributeRepository */ +$productAttributeRepository = $objectManager->get(ProductAttributeRepositoryInterface::class); +/** @var Registry $registry */ +$registry = $objectManager->get(Registry::class); +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); +try { + $attribute = $productAttributeRepository->get('text_editor_attribute'); + $productAttributeRepository->delete($attribute); +} catch (NoSuchEntityException $e) { + //Attribute already deleted. +} +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); diff --git a/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Delete/SwatchesAttributesControllerTest.php b/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Delete/SwatchesAttributesControllerTest.php new file mode 100644 index 0000000000000..1ff53b312e65a --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Delete/SwatchesAttributesControllerTest.php @@ -0,0 +1,48 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Swatches\Controller\Adminhtml\Product\Attribute\Delete; + +use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Delete\AbstractDeleteAttributeControllerTest; + +/** + * Delete catalog product attributes with input types like "swatch_text" and "swatch_visual". + * Attributes from Magento_Swatches module. + * + * @magentoAppArea adminhtml + * @magentoDbIsolation enabled + */ +class SwatchesAttributesControllerTest extends AbstractDeleteAttributeControllerTest +{ + /** + * Assert that attribute with input type "swatch_text" will be deleted + * after dispatch delete product attribute action. + * + * @magentoDataFixture Magento/Swatches/_files/product_text_swatch_attribute.php + * + * @return void + */ + public function testDeleteSwatchTextAttribute(): void + { + $this->dispatchDeleteAttribute('text_swatch_attribute'); + $this->assertAttributeIsDeleted('text_swatch_attribute'); + } + + /** + * Assert that attribute with input type "swatch_visual" will be deleted + * after dispatch delete product attribute action. + * + * @magentoDataFixture Magento/Swatches/_files/swatch_attribute.php + * + * @return void + */ + public function testDeleteSwatchVisualAttribute(): void + { + $this->dispatchDeleteAttribute('color_swatch'); + $this->assertAttributeIsDeleted('color_swatch'); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Weee/Controller/Adminhtml/Product/Attribute/Delete/WeeeAttributesControllerTest.php b/dev/tests/integration/testsuite/Magento/Weee/Controller/Adminhtml/Product/Attribute/Delete/WeeeAttributesControllerTest.php new file mode 100644 index 0000000000000..19e4ea2259641 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Weee/Controller/Adminhtml/Product/Attribute/Delete/WeeeAttributesControllerTest.php @@ -0,0 +1,34 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Weee\Controller\Adminhtml\Product\Attribute\Delete; + +use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Delete\AbstractDeleteAttributeControllerTest; + +/** + * Delete catalog product attributes with input types like "weee". + * Attributes from Magento_Weee module. + * + * @magentoAppArea adminhtml + * @magentoDbIsolation enabled + */ +class WeeeAttributesControllerTest extends AbstractDeleteAttributeControllerTest +{ + /** + * Assert that attribute with input type "weee" will be deleted + * after dispatch delete product attribute action. + * + * @magentoDataFixture Magento/Weee/_files/fixed_product_attribute.php + * + * @return void + */ + public function testDeleteSwatchTextAttribute(): void + { + $this->dispatchDeleteAttribute('fixed_product_attribute'); + $this->assertAttributeIsDeleted('fixed_product_attribute'); + } +} From ad1059fb9a0abb316a6cb92b62ef9fee546f1f77 Mon Sep 17 00:00:00 2001 From: Marco Oliveira <marcoaacoliveira@gmail.com> Date: Fri, 27 Dec 2019 15:40:25 -0300 Subject: [PATCH 0591/1143] Adding coverage test cases, fixing Order/Payment/Info that had the same problem. --- .../Sales/Model/Order/Payment/Info.php | 1 + .../Magento/Payment/Model/PaymentInfoTest.php | 64 ++++++++++++++ .../Magento/Payment/_files/payment_info.php | 83 +++++++++++++++++++ 3 files changed, 148 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/Payment/Model/PaymentInfoTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Payment/_files/payment_info.php diff --git a/app/code/Magento/Sales/Model/Order/Payment/Info.php b/app/code/Magento/Sales/Model/Order/Payment/Info.php index fee846fe6a62c..479d96b5842d9 100644 --- a/app/code/Magento/Sales/Model/Order/Payment/Info.php +++ b/app/code/Magento/Sales/Model/Order/Payment/Info.php @@ -192,6 +192,7 @@ public function getAdditionalInformation($key = null) */ public function unsAdditionalInformation($key = null) { + $this->initAdditionalInformation(); if ($key && isset($this->additionalInformation[$key])) { unset($this->additionalInformation[$key]); return $this->setData('additional_information', $this->additionalInformation); diff --git a/dev/tests/integration/testsuite/Magento/Payment/Model/PaymentInfoTest.php b/dev/tests/integration/testsuite/Magento/Payment/Model/PaymentInfoTest.php new file mode 100644 index 0000000000000..7a4efe4a22ce9 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Payment/Model/PaymentInfoTest.php @@ -0,0 +1,64 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Payment\Model; + +use Magento\Sales\Model\Order; +use Magento\Quote\Model\Quote; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\ObjectManager; + +/** + * @magentoAppArea adminhtml + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class PaymentInfoTest extends \PHPUnit\Framework\TestCase +{ + /** + * @var ObjectManager + */ + protected $_objectManager; + + /** + * @var Order + */ + protected $_order; + + /** @var Quote */ + protected $_quote; + + protected function setUp() + { + $this->_objectManager = Bootstrap::getObjectManager(); + $this->_order = $this->_objectManager->create( + Order::class + ); + $this->_quote = $this->_objectManager->create( + Quote::class + ); + } + + /** + * @magentoDbIsolation enabled + * @magentoAppIsolation enabled + * @magentoDataFixture Magento/Payment/_files/payment_info.php + */ + public function testUnsetPaymentInformation() + { + $order = $this->_order->loadByIncrementId('100000001'); + /** @var \Magento\Sales\Model\Order\Payment $paymentOrder */ + $paymentOrder = $order->getPayment(); + $paymentOrder->unsAdditionalInformation('testing'); + + $quote = $this->_quote->load('reserved_order_id', 'reserved_order_id'); + /** @var \Magento\Quote\Model\Quote\Payment $paymentQuote */ + $paymentQuote = $quote->getPayment(); + $paymentQuote->unsAdditionalInformation('testing'); + + + $this->assertFalse($paymentOrder->hasAdditionalInformation('testing')); + $this->assertFalse($paymentQuote->hasAdditionalInformation('testing')); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Payment/_files/payment_info.php b/dev/tests/integration/testsuite/Magento/Payment/_files/payment_info.php new file mode 100644 index 0000000000000..bf40cb6b99820 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Payment/_files/payment_info.php @@ -0,0 +1,83 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +use Magento\Quote\Api\CartRepositoryInterface; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\Sales\Model\Order\Address; +use Magento\Sales\Model\Order\Payment; +use Magento\Paypal\Model\Config; +use Magento\Sales\Model\Order; +use Magento\Quote\Model\Quote; +use Magento\Quote\Model\Quote\Payment as PaymentQuote; + +/** @var $objectManager \Magento\TestFramework\ObjectManager */ +$objectManager = Bootstrap::getObjectManager(); + +$addressData = [ + 'firstname' => 'guest', + 'lastname' => 'guest', + 'email' => 'customer@example.com', + 'street' => 'street', + 'city' => 'Los Angeles', + 'region' => 'CA', + 'postcode' => '1', + 'country_id' => 'US', + 'telephone' => '1' +]; +$billingAddress = $objectManager->create( + Address::class, + ['data' => $addressData] +); +$billingAddress->setAddressType('billing'); +$shippingAddress = clone $billingAddress; +$shippingAddress->setId(null)->setAddressType('shipping'); + +/** @var Payment $paymentOrder */ +$paymentOrder = $objectManager->create( + Payment::class +); + +$paymentOrder->setMethod(Config::METHOD_WPP_EXPRESS); +$paymentOrder->setAdditionalInformation('testing', 'testing additional data'); + +$amount = 100; + +/** @var Order $order */ +$order = $objectManager->create(Order::class); +$order->setCustomerEmail('co@co.co') + ->setIncrementId('100000001') + ->setSubtotal($amount) + ->setBaseSubtotal($amount) + ->setBaseGrandTotal($amount) + ->setGrandTotal($amount) + ->setBaseCurrencyCode('USD') + ->setCustomerIsGuest(true) + ->setStoreId(1) + ->setEmailSent(true) + ->setBillingAddress($billingAddress) + ->setShippingAddress($shippingAddress) + ->setPayment($paymentOrder); +$order->save(); + + + +/** @var Quote $quote */ +$quote = $objectManager->create(Quote::class); +$quote->setStoreId(1) + ->setIsActive(true) + ->setIsMultiShipping(false) + ->setReservedOrderId('reserved_order_id'); + +$quote->getPayment() + ->setMethod(Config::METHOD_WPP_EXPRESS) + ->setAdditionalInformation('testing', 'testing additional data'); + +$quote->collectTotals(); + + +/** @var CartRepositoryInterface $repository */ +$repository = $objectManager->get(CartRepositoryInterface::class); +$repository->save($quote); From 408b725157f031a81119cb27816d204d48b45b97 Mon Sep 17 00:00:00 2001 From: Marco Oliveira <marcoaacoliveira@gmail.com> Date: Fri, 27 Dec 2019 16:04:17 -0300 Subject: [PATCH 0592/1143] Removing unnecessary line. --- .../testsuite/Magento/Payment/Model/PaymentInfoTest.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Payment/Model/PaymentInfoTest.php b/dev/tests/integration/testsuite/Magento/Payment/Model/PaymentInfoTest.php index 7a4efe4a22ce9..3d037ceb17044 100644 --- a/dev/tests/integration/testsuite/Magento/Payment/Model/PaymentInfoTest.php +++ b/dev/tests/integration/testsuite/Magento/Payment/Model/PaymentInfoTest.php @@ -56,8 +56,7 @@ public function testUnsetPaymentInformation() /** @var \Magento\Quote\Model\Quote\Payment $paymentQuote */ $paymentQuote = $quote->getPayment(); $paymentQuote->unsAdditionalInformation('testing'); - - + $this->assertFalse($paymentOrder->hasAdditionalInformation('testing')); $this->assertFalse($paymentQuote->hasAdditionalInformation('testing')); } From 438e6067de61f98c90c27067ff91e88a7e1ad6b5 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Fri, 27 Dec 2019 14:51:21 -0600 Subject: [PATCH 0593/1143] Update action group due to changes in mainline --- .../Mftf/Test/ProductAttributeWithoutValueInCompareListTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/ProductAttributeWithoutValueInCompareListTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/ProductAttributeWithoutValueInCompareListTest.xml index f1288da1e6125..70d2fb63941c7 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/ProductAttributeWithoutValueInCompareListTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/ProductAttributeWithoutValueInCompareListTest.xml @@ -27,7 +27,7 @@ <argument name="group" value="Product Details"/> <argument name="attribute" value="$$createProductAttribute.attribute_code$$"/> </actionGroup> - <actionGroup ref="SaveAttributeSet" stepKey="SaveAttributeSet"/> + <actionGroup ref="SaveAttributeSetActionGroup" stepKey="SaveAttributeSet"/> <createData entity="_defaultCategory" stepKey="createCategory"/> <createData entity="_defaultProduct" stepKey="createProductDefault"> <requiredEntity createDataKey="createCategory"/> From ccc9b63e0c404bf50cb8ff3311ad9a51abede010 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Fri, 27 Dec 2019 17:01:51 -0600 Subject: [PATCH 0594/1143] Add action group --- .../SeeProductInComparisonListActionGroup.xml | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/SeeProductInComparisonListActionGroup.xml diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/SeeProductInComparisonListActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/SeeProductInComparisonListActionGroup.xml new file mode 100644 index 0000000000000..44dc8353d314d --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/SeeProductInComparisonListActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SeeProductInComparisonListActionGroup"> + <annotations> + <description>Validate that the Product is present in the comparison list</description> + </annotations> + <arguments> + <argument name="productVar"/> + </arguments> + + <amOnPage url="{{StorefrontProductComparePage.url}}" stepKey="navigateToComparePage"/> + <waitForPageLoad stepKey="waitForStorefrontProductComparePageLoad"/> + <seeElement selector="{{StorefrontProductCompareMainSection.ProductLinkByName(productVar.name)}}" + stepKey="seeProductInCompareList"/> + </actionGroup> +</actionGroups> From 0b1d6544ff35dc5d4a70ea1fa102552dbda40d74 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Fri, 27 Dec 2019 17:55:38 -0600 Subject: [PATCH 0595/1143] Update action group due to changes in mainline --- .../Test/Mftf/Test/AdminCreateOrderWithDateTimeOptionUITest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithDateTimeOptionUITest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithDateTimeOptionUITest.xml index 06c2375a26616..7e58e55c8981e 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithDateTimeOptionUITest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithDateTimeOptionUITest.xml @@ -32,7 +32,7 @@ <deleteData createDataKey="createCustomer" stepKey="deleteSimpleCustomer"/> </after> - <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderWithExistingCustomer"> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderWithExistingCustomer"> <argument name="customer" value="$$createCustomer$$"/> </actionGroup> From 6d092dc8a2e394641c5a46c353ae9e3bb75c9f81 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Fri, 27 Dec 2019 20:59:50 -0600 Subject: [PATCH 0596/1143] Update actiongroup name due to changes in mainline --- .../StorefrontNoJavascriptErrorOnAddYourReviewClickTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Review/Test/Mftf/Test/StorefrontNoJavascriptErrorOnAddYourReviewClickTest.xml b/app/code/Magento/Review/Test/Mftf/Test/StorefrontNoJavascriptErrorOnAddYourReviewClickTest.xml index 72b175d2dcacb..99e418a950c69 100644 --- a/app/code/Magento/Review/Test/Mftf/Test/StorefrontNoJavascriptErrorOnAddYourReviewClickTest.xml +++ b/app/code/Magento/Review/Test/Mftf/Test/StorefrontNoJavascriptErrorOnAddYourReviewClickTest.xml @@ -26,7 +26,7 @@ <argument name="group" value="Product Details"/> <argument name="attribute" value="$$createProductAttribute.attribute_code$$"/> </actionGroup> - <actionGroup ref="SaveAttributeSet" stepKey="SaveAttributeSet"/> + <actionGroup ref="SaveAttributeSetActionGroup" stepKey="SaveAttributeSet"/> <createData entity="_defaultCategory" stepKey="createCategory"/> <createData entity="SimpleProductWithCustomAttributeSet" stepKey="createProduct"> <requiredEntity createDataKey="createCategory"/> From cbfd175023ccbdaffef1f0b7b8786143a63453f5 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Sat, 28 Dec 2019 11:34:16 -0600 Subject: [PATCH 0597/1143] Remove unused action group --- .../Test/Mftf/ActionGroup/StorefrontCompareActionGroup.xml | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCompareActionGroup.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCompareActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCompareActionGroup.xml deleted file mode 100644 index e69de29bb2d1d..0000000000000 From 0fb43446d90346f94c7e04ef52c7eecdcb597d1b Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Sun, 29 Dec 2019 12:49:14 -0600 Subject: [PATCH 0598/1143] Fix static --- .../Order/Payment/State/RegisterCaptureNotificationCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 d8afcc71cc6af..2551092a64e9a 100644 --- a/app/code/Magento/Sales/Model/Order/Payment/State/RegisterCaptureNotificationCommand.php +++ b/app/code/Magento/Sales/Model/Order/Payment/State/RegisterCaptureNotificationCommand.php @@ -14,7 +14,7 @@ /** * Class RegisterCaptureNotificationCommand * - * @package Magento\Sales\Model\Order\Payment\State + * Command that Register Capture Notification */ class RegisterCaptureNotificationCommand implements CommandInterface { From dbcb81df310cb16d07e9f8b8397fe529239dba9b Mon Sep 17 00:00:00 2001 From: Yogesh Suhagiya <yksuhagiya@gmail.com> Date: Mon, 30 Dec 2019 11:34:12 +0530 Subject: [PATCH 0599/1143] Fixed transaction issues --- app/code/Magento/CatalogUrlRewrite/etc/adminhtml/system.xml | 6 ++---- app/code/Magento/CatalogUrlRewrite/i18n/en_US.csv | 3 ++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/system.xml b/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/system.xml index 1e1f4e86fa3dc..ad0ff68192af4 100644 --- a/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/system.xml +++ b/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/system.xml @@ -28,13 +28,11 @@ <label>Create Permanent Redirect for URLs if URL Key Changed</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="generate_category_product_rewrites" translate="label" type="select" sortOrder="6" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="generate_category_product_rewrites" translate="label comment" type="select" sortOrder="6" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> <label>Generate "category/product" URL Rewrites</label> <backend_model>Magento\CatalogUrlRewrite\Model\TableCleaner</backend_model> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> - <comment> - <![CDATA[<strong style="color:red">Warning!</strong> Turning this option off will result in permanent removal of category/product URL rewrites without an ability to restore them.]]> - </comment> + <comment><![CDATA[<strong style="color:red">Warning!</strong> Turning this option off will result in permanent removal of category/product URL rewrites without an ability to restore them.]]></comment> <frontend_class>generate_category_product_rewrites</frontend_class> </field> </group> diff --git a/app/code/Magento/CatalogUrlRewrite/i18n/en_US.csv b/app/code/Magento/CatalogUrlRewrite/i18n/en_US.csv index 0f21e8ddf9fc9..1dddaa458a16c 100644 --- a/app/code/Magento/CatalogUrlRewrite/i18n/en_US.csv +++ b/app/code/Magento/CatalogUrlRewrite/i18n/en_US.csv @@ -5,5 +5,6 @@ "Product URL Suffix","Product URL Suffix" "Use Categories Path for Product URLs","Use Categories Path for Product URLs" "Create Permanent Redirect for URLs if URL Key Changed","Create Permanent Redirect for URLs if URL Key Changed" -"Generate "category/product" URL Rewrites","Generate "category/product" URL Rewrites" +"Generate ""category/product"" URL Rewrites","Generate ""category/product"" URL Rewrites" "URL key ""%1"" matches a reserved endpoint name (%2). Use another URL key.","URL key ""%1"" matches a reserved endpoint name (%2). Use another URL key." +"<strong style=""color:red"">Warning!</strong> Turning this option off will result in permanent removal of category/product URL rewrites without an ability to restore them.","<strong style=""color:red"">Warning!</strong> Turning this option off will result in permanent removal of category/product URL rewrites without an ability to restore them." From 1ca03a336588fded3f516b8d7ffe57f8201f718a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Mon, 30 Dec 2019 12:13:38 +0100 Subject: [PATCH 0600/1143] #26206 Add information about currently reindexed index. --- .../Indexer/Console/Command/IndexerReindexCommand.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Indexer/Console/Command/IndexerReindexCommand.php b/app/code/Magento/Indexer/Console/Command/IndexerReindexCommand.php index fffa4503e14a7..7e4ec766dc089 100644 --- a/app/code/Magento/Indexer/Console/Command/IndexerReindexCommand.php +++ b/app/code/Magento/Indexer/Console/Command/IndexerReindexCommand.php @@ -76,6 +76,7 @@ protected function execute(InputInterface $input, OutputInterface $output) { $returnValue = Cli::RETURN_FAILURE; foreach ($this->getIndexers($input) as $indexer) { + $output->write($indexer->getTitle() . ' '); try { $this->validateIndexerStatus($indexer); $startTime = microtime(true); @@ -90,8 +91,9 @@ protected function execute(InputInterface $input, OutputInterface $output) } } $resultTime = microtime(true) - $startTime; + $output->writeln( - $indexer->getTitle() . ' index has been rebuilt successfully in ' . gmdate('H:i:s', $resultTime) + __('index has been rebuilt successfully in %time', ['time' => gmdate('H:i:s', $resultTime)]) ); $returnValue = Cli::RETURN_SUCCESS; } catch (LocalizedException $e) { @@ -111,7 +113,7 @@ protected function execute(InputInterface $input, OutputInterface $output) */ protected function getIndexers(InputInterface $input) { - $indexers = parent::getIndexers($input); + $indexers = parent::getIndexers($input); $allIndexers = $this->getAllIndexers(); if (!array_diff_key($allIndexers, $indexers)) { return $indexers; From 21bdc6731bc22af6aee7d1fdd5433e5c9ab2f3d5 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Mon, 30 Dec 2019 15:05:17 +0200 Subject: [PATCH 0601/1143] Cover changes with Unit test --- .../Test/Unit/Controller/Index/UpdateTest.php | 119 ++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateTest.php diff --git a/app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateTest.php b/app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateTest.php new file mode 100644 index 0000000000000..db21ff5de13c6 --- /dev/null +++ b/app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateTest.php @@ -0,0 +1,119 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Wishlist\Test\Unit\Controller\Index; + +use Magento\Backend\Model\View\Result\Redirect; +use Magento\Framework\App\Action\Context; +use Magento\Framework\App\RequestInterface; +use Magento\Framework\Controller\ResultFactory; +use Magento\Framework\Data\Form\FormKey\Validator; +use Magento\Wishlist\Controller\Index\Update; +use Magento\Wishlist\Controller\WishlistProviderInterface; +use Magento\Wishlist\Model\LocaleQuantityProcessor; +use PHPUnit\Framework\TestCase; + +/** + * Test for upate controller wishlist + */ +class UpdateTest extends TestCase +{ + /** + * @var Validator $formKeyValidator + */ + private $formKeyValidator; + + /** + * @var WishlistProviderInterface $wishlistProvider + */ + private $wishlistProvider; + + /** + * @var LocaleQuantityProcessor $quantityProcessor + */ + private $quantityProcessor; + + /** + * @var Update $updateController + */ + private $updateController; + + /** + * @var $context + */ + private $context; + + /** + * @var Redirect $resultRedirect + */ + private $resultRedirect; + + /** + * @var ResultFactory $resultFatory + */ + private $resultFactory; + + /** + * @var RequestInterface $requestMock + */ + private $requestMock; + + /** + * @inheritdoc + */ + protected function setUp() + { + $this->formKeyValidator = $this->createMock(Validator::class); + $this->wishlistProvider = $this->createMock(WishlistProviderInterface::class); + $this->quantityProcessor = $this->createMock(LocaleQuantityProcessor::class); + $this->context = $this->createMock(Context::class); + $this->resultRedirect = $this->createMock(Redirect::class); + $this->resultFactory = $this->createPartialMock(ResultFactory::class, ['create']); + $this->requestMock = $this->getMockBuilder(RequestInterface::class) + ->setMethods(['getPostValue']) + ->getMockForAbstractClass(); + + $this->context->expects($this->once()) + ->method('getResultFactory') + ->willReturn($this->resultFactory); + + $this->resultFactory->expects($this->any()) + ->method('create') + ->willReturn($this->resultRedirect); + $this->context->expects($this->any()) + ->method('getRequest') + ->willReturn($this->requestMock); + + $this->updateController = new Update( + $this->context, + $this->formKeyValidator, + $this->wishlistProvider, + $this->quantityProcessor + ); + } + + /** + * Test for update method Wishlist controller. + * + * Check if there is not post value result redirect returned. + * + * @return void + */ + public function testUpdate(): void + { + $this->formKeyValidator->expects($this->once()) + ->method('validate') + ->willReturn(true); + + $wishlist = $this->createMock(\Magento\Wishlist\Model\Wishlist::class); + $this->wishlistProvider->expects($this->once()) + ->method('getWishlist') + ->willReturn($wishlist); + $this->requestMock->expects($this->once()) + ->method('getPostValue') + ->willReturn(null); + $this->assertEquals($this->resultRedirect, $this->updateController->execute()); + } +} From 7117ac4e49df34d04a149d591c49f51d029beb1e Mon Sep 17 00:00:00 2001 From: divyajyothi5321 <54176640+divyajyothi5321@users.noreply.github.com> Date: Mon, 30 Dec 2019 20:07:28 +0530 Subject: [PATCH 0602/1143] Added Changes --- .../web/css/source/module/_listings.less | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 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 8c71f87360807..e6c595dd08628 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 @@ -110,11 +110,10 @@ vertical-align: middle; > .stock.unavailable { - border: 1px solid @color-orange-red1; - color: @color-orange-red1; - font-weight: @font-weight__semibold; line-height: 1; - padding: @indent__s 11px; + padding-bottom: @indent__s; + padding-top: @indent__s; + padding-right: 24px; } } } @@ -424,7 +423,19 @@ } } -// +// +// Mobile +// _____________________________________________ + +.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__s) { + .product-item-actions { + .actions-primary { + display: block; + } + } +} + +// // Desktop // _____________________________________________ From 135df0bc846d06ae00758fb86fb36cf54c852820 Mon Sep 17 00:00:00 2001 From: divyajyothi5321 <54176640+divyajyothi5321@users.noreply.github.com> Date: Mon, 30 Dec 2019 20:36:56 +0530 Subject: [PATCH 0603/1143] Added necessary indentations --- .../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 e6c595dd08628..4c1517184e7f8 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 @@ -112,8 +112,8 @@ > .stock.unavailable { line-height: 1; padding-bottom: @indent__s; - padding-top: @indent__s; padding-right: 24px; + padding-top: @indent__s; } } } From 3c3018d3ce6132c28072cda40a9edf73d1de3915 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Mon, 30 Dec 2019 18:14:17 +0200 Subject: [PATCH 0604/1143] Cover changes with unit test --- .../Test/Unit/Controller/Index/UpdateTest.php | 149 +++++++++++++++++- 1 file changed, 141 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateTest.php b/app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateTest.php index db21ff5de13c6..86de21fd7f983 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateTest.php @@ -10,13 +10,19 @@ use Magento\Framework\App\RequestInterface; use Magento\Framework\Controller\ResultFactory; use Magento\Framework\Data\Form\FormKey\Validator; +use Magento\Framework\Exception\NotFoundException; +use Magento\Framework\Message\ManagerInterface; +use Magento\Framework\ObjectManagerInterface; use Magento\Wishlist\Controller\Index\Update; use Magento\Wishlist\Controller\WishlistProviderInterface; +use Magento\Wishlist\Helper\Data; +use Magento\Wishlist\Model\Item; use Magento\Wishlist\Model\LocaleQuantityProcessor; use PHPUnit\Framework\TestCase; /** * Test for upate controller wishlist + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class UpdateTest extends TestCase { @@ -60,6 +66,16 @@ class UpdateTest extends TestCase */ private $requestMock; + /** + * @var ObjectManagerInterface $objectManagerMock + */ + private $objectManagerMock; + + /** + * @var ManagerInterface $messageManager + */ + private $messageManager; + /** * @inheritdoc */ @@ -74,10 +90,14 @@ protected function setUp() $this->requestMock = $this->getMockBuilder(RequestInterface::class) ->setMethods(['getPostValue']) ->getMockForAbstractClass(); + $this->objectManagerMock = $this->createMock(ObjectManagerInterface::class); $this->context->expects($this->once()) - ->method('getResultFactory') - ->willReturn($this->resultFactory); + ->method('getResultFactory') + ->willReturn($this->resultFactory); + $this->context->expects($this->once()) + ->method('getObjectManager') + ->willReturn($this->objectManagerMock); $this->resultFactory->expects($this->any()) ->method('create') @@ -86,6 +106,11 @@ protected function setUp() ->method('getRequest') ->willReturn($this->requestMock); + $this->messageManager = $this->createMock(ManagerInterface::class); + $this->context->expects($this->any()) + ->method('getMessageManager') + ->willReturn($this->messageManager); + $this->updateController = new Update( $this->context, $this->formKeyValidator, @@ -97,23 +122,131 @@ protected function setUp() /** * Test for update method Wishlist controller. * - * Check if there is not post value result redirect returned. - * + * @dataProvider getWishlistDataProvider * @return void */ - public function testUpdate(): void + public function testUpdate(array $wishlistDataProvider): void { $this->formKeyValidator->expects($this->once()) - ->method('validate') - ->willReturn(true); + ->method('validate') + ->willReturn(true); $wishlist = $this->createMock(\Magento\Wishlist\Model\Wishlist::class); + $this->wishlistProvider->expects($this->once()) ->method('getWishlist') ->willReturn($wishlist); + $wishlist->expects($this->exactly(2)) + ->method('getId') + ->willReturn($wishlistDataProvider['wishlist_data']['id']); $this->requestMock->expects($this->once()) ->method('getPostValue') - ->willReturn(null); + ->willReturn($wishlistDataProvider['post_data']); + $this->resultRedirect->expects($this->once()) + ->method('setPath') + ->with('*', ['wishlist_id' => $wishlistDataProvider['wishlist_data']['id']]); + $itemMock = $this->getMockBuilder(Item::class) + ->disableOriginalConstructor() + ->setMethods( + [ + 'load', + 'getId', + 'getWishlistId', + 'setQty', + 'save', + 'getDescription', + 'setDescription', + 'getProduct', + 'getName' + ] + )->getMock(); + + $this->objectManagerMock->expects($this->once()) + ->method('create') + ->with(Item::class) + ->willReturn($itemMock); + $itemMock->expects($this->once()) + ->method('load') + ->with(1) + ->willReturnSelf(); + $itemMock->expects($this->once()) + ->method('getWishLIstId') + ->willReturn($wishlistDataProvider['wishlist_data']['id']); + $itemMock->expects($this->once()) + ->method('getDescription') + ->willReturn(''); + $itemMock->expects($this->once()) + ->method('setDescription') + ->willReturnSelf(); + $itemMock->expects($this->once()) + ->method('setQty') + ->willReturnSelf(); + $dataMock = $this->createMock(Data::class); + + $this->objectManagerMock->expects($this->exactly(2)) + ->method('get') + ->with(Data::class) + ->willReturn($dataMock); + $dataMock->expects($this->once()) + ->method('defaultCommentString') + ->willReturn(''); + $dataMock->expects($this->once()) + ->method('calculate'); + $this->quantityProcessor->expects($this->once()) + ->method('process') + ->willReturn($wishlistDataProvider['post_data']['qty']); + + $productMock = $this->getMockBuilder(\Magento\Catalog\Model\Product::class) + ->disableOriginalConstructor() + ->getMock(); + $itemMock->expects($this->once()) + ->method('getProduct') + ->willReturn($productMock); + $productMock->expects($this->once()) + ->method('getName') + ->willReturn('product'); + $this->messageManager->expects($this->once()) + ->method('addSuccessMessage'); $this->assertEquals($this->resultRedirect, $this->updateController->execute()); } + + /** + * Check if wishlist not availbale, and exception is shown + */ + public function testUpdateWithNotFoundException() + { + $this->formKeyValidator->expects($this->once()) + ->method('validate') + ->willReturn(true); + $this->wishlistProvider->expects($this->once()) + ->method('getWishlist') + ->willReturn(null); + $this->expectException(NotFoundException::class); + $this->updateController->execute(); + } + + /** + * Dataprovider for Update test + * + * @return array + */ + public function getWishlistDataProvider(): array + { + return [ + [ + [ + 'wishlist_data' => [ + 'id' => 1, + + ], + 'post_data' => [ + 'qty' => [1 => 12], + 'description' => [ + 1 => 'Description for item_id 1' + ] + ] + ] + ] + ]; + } } From 79fe786afcc193a6424e5d2d31e8120a06d8700b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Mon, 30 Dec 2019 13:07:54 +0100 Subject: [PATCH 0605/1143] #26206 Improve the output, fix the implementation of array_merge() in foreach() --- .../Console/Command/IndexerReindexCommand.php | 55 +++++++++---------- .../Command/IndexerReindexCommandTest.php | 24 ++++++-- 2 files changed, 44 insertions(+), 35 deletions(-) diff --git a/app/code/Magento/Indexer/Console/Command/IndexerReindexCommand.php b/app/code/Magento/Indexer/Console/Command/IndexerReindexCommand.php index 7e4ec766dc089..858fcdeb02c6c 100644 --- a/app/code/Magento/Indexer/Console/Command/IndexerReindexCommand.php +++ b/app/code/Magento/Indexer/Console/Command/IndexerReindexCommand.php @@ -6,16 +6,16 @@ namespace Magento\Indexer\Console\Command; +use Magento\Framework\App\ObjectManagerFactory; use Magento\Framework\Console\Cli; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Indexer\Config\DependencyInfoProvider; +use Magento\Framework\Indexer\ConfigInterface; use Magento\Framework\Indexer\IndexerInterface; use Magento\Framework\Indexer\IndexerRegistry; use Magento\Framework\Indexer\StateInterface; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Magento\Framework\Indexer\ConfigInterface; -use Magento\Framework\App\ObjectManagerFactory; /** * Command to run indexers @@ -76,9 +76,11 @@ protected function execute(InputInterface $input, OutputInterface $output) { $returnValue = Cli::RETURN_FAILURE; foreach ($this->getIndexers($input) as $indexer) { - $output->write($indexer->getTitle() . ' '); try { $this->validateIndexerStatus($indexer); + + $output->write($indexer->getTitle() . ' index '); + $startTime = microtime(true); $indexerConfig = $this->getConfig()->getIndexer($indexer->getId()); $sharedIndex = $indexerConfig['shared_index']; @@ -93,16 +95,19 @@ protected function execute(InputInterface $input, OutputInterface $output) $resultTime = microtime(true) - $startTime; $output->writeln( - __('index has been rebuilt successfully in %time', ['time' => gmdate('H:i:s', $resultTime)]) + __('has been rebuilt successfully in %time', ['time' => gmdate('H:i:s', $resultTime)]) ); $returnValue = Cli::RETURN_SUCCESS; } catch (LocalizedException $e) { - $output->writeln($e->getMessage()); + $output->writeln(__('exception: %message', ['message' => $e->getMessage()])); } catch (\Exception $e) { - $output->writeln($indexer->getTitle() . ' indexer process unknown error:'); + $output->writeln('process unknown error:'); $output->writeln($e->getMessage()); + + $output->writeln($e->getTraceAsString(), OutputInterface::VERBOSITY_DEBUG); } } + return $returnValue; } @@ -119,19 +124,17 @@ protected function getIndexers(InputInterface $input) return $indexers; } - $relatedIndexers = []; - $dependentIndexers = []; + $relatedIndexers = [[]]; + $dependentIndexers = [[]]; + foreach ($indexers as $indexer) { - $relatedIndexers = array_merge( - $relatedIndexers, - $this->getRelatedIndexerIds($indexer->getId()) - ); - $dependentIndexers = array_merge( - $dependentIndexers, - $this->getDependentIndexerIds($indexer->getId()) - ); + array_push($relatedIndexers, $this->getRelatedIndexerIds($indexer->getId())); + array_push($dependentIndexers, $this->getDependentIndexerIds($indexer->getId())); } + $relatedIndexers = array_merge(...$relatedIndexers); + $dependentIndexers = array_merge(...$dependentIndexers); + $invalidRelatedIndexers = []; foreach (array_unique($relatedIndexers) as $relatedIndexer) { if ($allIndexers[$relatedIndexer]->isInvalid()) { @@ -161,15 +164,13 @@ protected function getIndexers(InputInterface $input) */ private function getRelatedIndexerIds(string $indexerId) { - $relatedIndexerIds = []; + $relatedIndexerIds = [[]]; foreach ($this->getDependencyInfoProvider()->getIndexerIdsToRunBefore($indexerId) as $relatedIndexerId) { - $relatedIndexerIds = array_merge( - $relatedIndexerIds, - [$relatedIndexerId], - $this->getRelatedIndexerIds($relatedIndexerId) - ); + array_push($relatedIndexerIds, [$relatedIndexerId], $this->getRelatedIndexerIds($relatedIndexerId)); } + $relatedIndexerIds = array_merge(...$relatedIndexerIds); + return array_unique($relatedIndexerIds); } @@ -181,19 +182,15 @@ private function getRelatedIndexerIds(string $indexerId) */ private function getDependentIndexerIds(string $indexerId) { - $dependentIndexerIds = []; + $dependentIndexerIds = [[]]; foreach (array_keys($this->getConfig()->getIndexers()) as $id) { $dependencies = $this->getDependencyInfoProvider()->getIndexerIdsToRunBefore($id); if (array_search($indexerId, $dependencies) !== false) { - $dependentIndexerIds = array_merge( - $dependentIndexerIds, - [$id], - $this->getDependentIndexerIds($id) - ); + array_push($dependentIndexerIds, [$id], $this->getDependentIndexerIds($id)); } } - return array_unique($dependentIndexerIds); + return array_unique(array_merge(...$dependentIndexerIds)); } /** diff --git a/app/code/Magento/Indexer/Test/Unit/Console/Command/IndexerReindexCommandTest.php b/app/code/Magento/Indexer/Test/Unit/Console/Command/IndexerReindexCommandTest.php index bdfeff8a89eb9..3a1bf113b942a 100644 --- a/app/code/Magento/Indexer/Test/Unit/Console/Command/IndexerReindexCommandTest.php +++ b/app/code/Magento/Indexer/Test/Unit/Console/Command/IndexerReindexCommandTest.php @@ -22,6 +22,7 @@ */ class IndexerReindexCommandTest extends AbstractIndexerCommandCommonSetup { + const STUB_INDEXER_NAME = 'Indexer Name'; /** * Command being tested * @@ -107,7 +108,7 @@ public function testExecuteAll() [ $this->getIndexerMock( ['reindexAll', 'getStatus'], - ['indexer_id' => 'id_indexerOne', 'title' => 'Title_indexerOne'] + ['indexer_id' => 'id_indexerOne', 'title' => self::STUB_INDEXER_NAME] ) ] ); @@ -117,7 +118,10 @@ public function testExecuteAll() $commandTester->execute([]); $actualValue = $commandTester->getDisplay(); $this->assertSame(Cli::RETURN_SUCCESS, $commandTester->getStatusCode()); - $this->assertStringStartsWith('Title_indexerOne index has been rebuilt successfully in', $actualValue); + $this->assertStringStartsWith( + self::STUB_INDEXER_NAME . ' index has been rebuilt successfully in', + $actualValue + ); } /** @@ -174,6 +178,7 @@ public function testExecuteWithIndex( $this->objectManagerFactory, $this->indexerRegistryMock ); + $commandTester = new CommandTester($this->command); $commandTester->execute(['index' => $inputIndexers]); $this->assertSame(Cli::RETURN_SUCCESS, $commandTester->getStatusCode()); @@ -344,7 +349,8 @@ public function executeWithIndexDataProvider() ], 'With dependencies and multiple indexers in request' => [ 'inputIndexers' => [ - 'indexer_1', 'indexer_3' + 'indexer_1', + 'indexer_3' ], 'indexers' => [ 'indexer_2' => [ @@ -405,7 +411,10 @@ public function executeWithIndexDataProvider() public function testExecuteWithLocalizedException() { $this->configureAdminArea(); - $indexerOne = $this->getIndexerMock(['reindexAll', 'getStatus'], ['indexer_id' => 'indexer_1']); + $indexerOne = $this->getIndexerMock( + ['reindexAll', 'getStatus'], + ['indexer_id' => 'indexer_1', 'title' => self::STUB_INDEXER_NAME] + ); $localizedException = new LocalizedException(new Phrase('Some Exception Message')); $indexerOne->expects($this->once())->method('reindexAll')->will($this->throwException($localizedException)); $this->initIndexerCollectionByItems([$indexerOne]); @@ -414,7 +423,10 @@ public function testExecuteWithLocalizedException() $commandTester->execute(['index' => ['indexer_1']]); $actualValue = $commandTester->getDisplay(); $this->assertSame(Cli::RETURN_FAILURE, $commandTester->getStatusCode()); - $this->assertStringStartsWith('Some Exception Message', $actualValue); + $this->assertStringStartsWith( + self::STUB_INDEXER_NAME . ' index exception: Some Exception Message', + $actualValue + ); } public function testExecuteWithException() @@ -433,7 +445,7 @@ public function testExecuteWithException() $commandTester->execute(['index' => ['indexer_1']]); $actualValue = $commandTester->getDisplay(); $this->assertSame(Cli::RETURN_FAILURE, $commandTester->getStatusCode()); - $this->assertStringStartsWith('Title_indexer_1' . ' indexer process unknown error:', $actualValue); + $this->assertStringStartsWith('Title_indexer_1' . ' index process unknown error:', $actualValue); } public function testExecuteWithExceptionInGetIndexers() From 6a7179a7f7b1ec7d80dfe124477dc2c967d516ae Mon Sep 17 00:00:00 2001 From: divyajyothi5321 <54176640+divyajyothi5321@users.noreply.github.com> Date: Tue, 31 Dec 2019 10:59:22 +0530 Subject: [PATCH 0606/1143] Added Indentations --- .../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 4c1517184e7f8..9dba96f89639e 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 @@ -423,7 +423,7 @@ } } -// +// // Mobile // _____________________________________________ @@ -435,7 +435,7 @@ } } -// +// // Desktop // _____________________________________________ From 118f0c08f30bc6f4651d296b7e8d56e92ba9aa75 Mon Sep 17 00:00:00 2001 From: OlgaVasyltsun <olga.vasyltsun@gmail.com> Date: Tue, 31 Dec 2019 08:27:44 +0200 Subject: [PATCH 0607/1143] MC-29047: Fix MFTF test --- ...lyConfigurableProductChildAssignedToSeparateCategoryTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontShouldSeeOnlyConfigurableProductChildAssignedToSeparateCategoryTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontShouldSeeOnlyConfigurableProductChildAssignedToSeparateCategoryTest.xml index 56a4e35995ba2..5f2fc5c8caca7 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontShouldSeeOnlyConfigurableProductChildAssignedToSeparateCategoryTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontShouldSeeOnlyConfigurableProductChildAssignedToSeparateCategoryTest.xml @@ -15,7 +15,7 @@ <title value="It should be possible to only view the child product of a configurable product"/> <description value="Create configurable product, add to category such that only child variation is visible in category"/> <severity value="CRITICAL"/> - <testCaseId value="MC-5832"/> + <testCaseId value="MC-25651"/> <group value="configurable_product"/> </annotations> <before> From 4c545f23dd44026a87ab001e8294075cc98b1fea Mon Sep 17 00:00:00 2001 From: divyajyothi5321 <54176640+divyajyothi5321@users.noreply.github.com> Date: Tue, 31 Dec 2019 14:02:22 +0530 Subject: [PATCH 0608/1143] Added Changes --- .../web/css/source/module/_listings.less | 25 +++++-------------- 1 file changed, 6 insertions(+), 19 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 9dba96f89639e..3a3cfe3cd2231 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 @@ -108,13 +108,6 @@ .actions-primary { display: inline-block; vertical-align: middle; - - > .stock.unavailable { - line-height: 1; - padding-bottom: @indent__s; - padding-right: 24px; - padding-top: @indent__s; - } } } @@ -286,6 +279,12 @@ } } } + + .product-item-actions { + .actions-primary { + display: block; + } + } } .media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__s) { @@ -423,18 +422,6 @@ } } -// -// Mobile -// _____________________________________________ - -.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__s) { - .product-item-actions { - .actions-primary { - display: block; - } - } -} - // // Desktop // _____________________________________________ From 3a7ec0d71b080c221e9212863bf0efe407336465 Mon Sep 17 00:00:00 2001 From: divyajyothi5321 <54176640+divyajyothi5321@users.noreply.github.com> Date: Tue, 31 Dec 2019 14:36:07 +0530 Subject: [PATCH 0609/1143] Update _listings.less --- .../Magento_Catalog/web/css/source/module/_listings.less | 7 +++++++ 1 file changed, 7 insertions(+) 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 3a3cfe3cd2231..d106fa8886c05 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 @@ -108,6 +108,13 @@ .actions-primary { display: inline-block; vertical-align: middle; + + > .stock.unavailable { + line-height: 1; + padding-bottom: @indent__s; + padding-right: 24px; + padding-top: @indent__s; + } } } From 66502c89c2a30ff756fb0b89a9f7202744f24167 Mon Sep 17 00:00:00 2001 From: Paavo Pokkinen <paavo.pokkinen@vaimo.com> Date: Tue, 31 Dec 2019 12:20:01 +0200 Subject: [PATCH 0610/1143] SEO: Do not follow links on filter optoins --- .../view/frontend/templates/product/layered/renderer.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Swatches/view/frontend/templates/product/layered/renderer.phtml b/app/code/Magento/Swatches/view/frontend/templates/product/layered/renderer.phtml index b22429eafc8e8..0680290e25002 100644 --- a/app/code/Magento/Swatches/view/frontend/templates/product/layered/renderer.phtml +++ b/app/code/Magento/Swatches/view/frontend/templates/product/layered/renderer.phtml @@ -15,7 +15,7 @@ attribute-id="<?= $block->escapeHtmlAttr($swatchData['attribute_id']) ?>"> <div class="swatch-attribute-options clearfix"> <?php foreach ($swatchData['options'] as $option => $label) : ?> - <a href="<?= $block->escapeUrl($label['link']) ?>" + <a href="<?= $block->escapeUrl($label['link']) ?>" rel="nofollow" aria-label="<?= $block->escapeHtmlAttr($label['label']) ?>" class="swatch-option-link-layered"> <?php if (isset($swatchData['swatches'][$option]['type'])) : ?> From 29635ccb34eaea1463446a2ebe6f61c5e81406d7 Mon Sep 17 00:00:00 2001 From: Paavo Pokkinen <paavo.pokkinen@vaimo.com> Date: Tue, 31 Dec 2019 12:43:44 +0200 Subject: [PATCH 0611/1143] Add rel=nofollow on filter links --- .../view/frontend/templates/layer/filter.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/filter.phtml b/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/filter.phtml index cd04b346b16a6..7313207ecf663 100644 --- a/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/filter.phtml +++ b/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/filter.phtml @@ -18,7 +18,7 @@ <?php foreach ($filterItems as $filterItem) : ?> <li class="item"> <?php if ($filterItem->getCount() > 0) : ?> - <a href="<?= $block->escapeUrl($filterItem->getUrl()) ?>"> + <a href="<?= $block->escapeUrl($filterItem->getUrl()) ?>" rel="nofollow"> <?= /* @noEscape */ $filterItem->getLabel() ?> <?php if ($this->helper(\Magento\Catalog\Helper\Data::class)->shouldDisplayProductCountOnLayer()) : ?> <span class="count"><?= /* @noEscape */ (int)$filterItem->getCount() ?><span class="filter-count-label"> From e4e4b4e3849dc4a645b352b03ec1535d9733a681 Mon Sep 17 00:00:00 2001 From: Sathish <srsathish92@gmail.com> Date: Tue, 31 Dec 2019 17:16:21 +0530 Subject: [PATCH 0612/1143] Removed the sortable option from cache grid --- .../Backend/view/adminhtml/layout/adminhtml_cache_block.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_cache_block.xml b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_cache_block.xml index 6d2ecd8d36a99..0fbf777bdf607 100644 --- a/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_cache_block.xml +++ b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_cache_block.xml @@ -80,6 +80,7 @@ <argument name="type" xsi:type="string">options</argument> <argument name="width" xsi:type="string">120</argument> <argument name="align" xsi:type="string">left</argument> + <argument name="sortable" xsi:type="string">0</argument> <argument name="options" xsi:type="array"> <item name="disabled" xsi:type="array"> <item name="value" xsi:type="string">0</item> From 2b5720c84624084226e2df6fd0c0d605ebfaf0dd Mon Sep 17 00:00:00 2001 From: Riccardo Tempesta <riccardo.tempesta@gmail.com> Date: Tue, 31 Dec 2019 18:03:31 +0100 Subject: [PATCH 0613/1143] FIX issue#26217 - Wrong fields selection while using fragments on GraphQL products query --- .../Products/Query/FieldSelection.php | 54 +++---------------- 1 file changed, 7 insertions(+), 47 deletions(-) diff --git a/app/code/Magento/CatalogGraphQl/Model/Resolver/Products/Query/FieldSelection.php b/app/code/Magento/CatalogGraphQl/Model/Resolver/Products/Query/FieldSelection.php index ffa0a3e6848e1..64ab128b22ab4 100644 --- a/app/code/Magento/CatalogGraphQl/Model/Resolver/Products/Query/FieldSelection.php +++ b/app/code/Magento/CatalogGraphQl/Model/Resolver/Products/Query/FieldSelection.php @@ -7,7 +7,6 @@ namespace Magento\CatalogGraphQl\Model\Resolver\Products\Query; -use GraphQL\Language\AST\SelectionNode; use Magento\Framework\GraphQl\Query\FieldTranslator; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; @@ -37,57 +36,18 @@ public function __construct(FieldTranslator $fieldTranslator) */ public function getProductsFieldSelection(ResolveInfo $resolveInfo): array { - return $this->getProductFields($resolveInfo); - } + $productFields = $resolveInfo->getFieldSelection(1); + $sectionNames = ['items', 'product']; - /** - * Return field names for all requested product fields. - * - * @param ResolveInfo $info - * @return string[] - */ - private function getProductFields(ResolveInfo $info): array - { $fieldNames = []; - foreach ($info->fieldNodes as $node) { - if ($node->name->value !== 'products' && $node->name->value !== 'variants') { - continue; - } - foreach ($node->selectionSet->selections as $selection) { - if ($selection->name->value !== 'items' && $selection->name->value !== 'product') { - continue; - } - $fieldNames[] = $this->collectProductFieldNames($selection, $fieldNames); - } - } - if (!empty($fieldNames)) { - $fieldNames = array_merge(...$fieldNames); - } - return $fieldNames; - } - - /** - * Collect field names for each node in selection - * - * @param SelectionNode $selection - * @param array $fieldNames - * @return array - */ - private function collectProductFieldNames(SelectionNode $selection, array $fieldNames = []): array - { - foreach ($selection->selectionSet->selections as $itemSelection) { - if ($itemSelection->kind === 'InlineFragment') { - foreach ($itemSelection->selectionSet->selections as $inlineSelection) { - if ($inlineSelection->kind === 'InlineFragment') { - continue; - } - $fieldNames[] = $this->fieldTranslator->translate($inlineSelection->name->value); + foreach ($sectionNames as $sectionName) { + if (isset($productFields[$sectionName])) { + foreach (array_keys($productFields[$sectionName]) as $fieldName) { + $fieldNames[] = $this->fieldTranslator->translate($fieldName); } - continue; } - $fieldNames[] = $this->fieldTranslator->translate($itemSelection->name->value); } - return $fieldNames; + return array_unique($fieldNames); } } From d6a73f9f678df05f9731dcb435857c64002e872a Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Tue, 31 Dec 2019 15:44:48 -0600 Subject: [PATCH 0614/1143] Fix static --- .../Framework/Setup/Declaration/Schema/Dto/Factories/Json.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Json.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Json.php index ec20e4a9438f3..5c9c88bb4fe26 100644 --- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Json.php +++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Json.php @@ -10,6 +10,8 @@ /** * Class Json + * + * Json Factory */ class Json implements FactoryInterface { From 84b131070043a4ad47f8bfa7a4999c42ed9940ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 2 Jan 2020 00:33:45 +0100 Subject: [PATCH 0615/1143] Set of fixes for Integration and Functional tests failing because of date used --- ...dminCreateDatetimeProductAttributeTest.xml | 2 +- .../Report/Product/Viewed/CollectionTest.php | 52 +++++++++---------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDatetimeProductAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDatetimeProductAttributeTest.xml index 5da824d2ccdb9..981af5b5abb4a 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDatetimeProductAttributeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDatetimeProductAttributeTest.xml @@ -27,7 +27,7 @@ <actionGroup ref="logout" stepKey="logout"/> </after> <!-- Generate the datetime default value --> - <generateDate date="now" format="m/j/y g:i A" stepKey="generateDefaultValue"/> + <generateDate date="now" format="n/j/y g:i A" stepKey="generateDefaultValue"/> <!-- Create new datetime product attribute --> <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="goToProductAttributes"/> <waitForPageLoad stepKey="waitForPageLoadAttributes"/> diff --git a/dev/tests/integration/testsuite/Magento/Reports/Model/ResourceModel/Report/Product/Viewed/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Reports/Model/ResourceModel/Report/Product/Viewed/CollectionTest.php index fff057fd05688..18b6aa6405663 100644 --- a/dev/tests/integration/testsuite/Magento/Reports/Model/ResourceModel/Report/Product/Viewed/CollectionTest.php +++ b/dev/tests/integration/testsuite/Magento/Reports/Model/ResourceModel/Report/Product/Viewed/CollectionTest.php @@ -72,20 +72,20 @@ public function testTableSelection($period, $expectedTable, $dateFrom, $dateTo, $this->assertArrayHasKey('tableName', $from[$dbTableName]); } else { $union = $this->_collection->getSelect()->getPart('union'); + $count = count($union); if ($period !== null && $dateFrom !== null && $dateTo !== null && $period != 'month') { - $count = count($union); if ($period == 'year') { if ($dbTableName == "report_viewed_product_aggregated_daily") { - $this->assertEquals($count, 2); + $this->assertEquals(2, $count); } if ($dbTableName == "report_viewed_product_aggregated_yearly") { - $this->assertEquals($count, 3); + $this->assertEquals(3, $count); } } else { - $this->assertEquals($count, 3); + $this->assertEquals(3, $count); } } else { - $this->assertEquals(count($union), 2); + $this->assertEquals(2, $count); } } } @@ -98,8 +98,8 @@ public function testTableSelection($period, $expectedTable, $dateFrom, $dateTo, */ public function tableForPeriodDataProvider() { - $dateNow = date('Y-m-d', time()); - $dateYearAgo = date('Y-m-d', strtotime($dateNow . ' -1 year')); + $dateFrom = '2019-10-15'; + $dateYearBefore = date('Y-m-d', strtotime($dateFrom . ' -1 year')); return [ [ 'period' => 'year', @@ -111,32 +111,32 @@ public function tableForPeriodDataProvider() [ 'period' => 'year', 'table' => 'report_viewed_product_aggregated_yearly', - 'date_from' => $dateYearAgo, - 'date_to' => $dateNow, + 'date_from' => $dateYearBefore, + 'date_to' => $dateFrom, ], [ 'period' => 'year', 'table' => 'report_viewed_product_aggregated_yearly', - 'date_from' => $dateYearAgo, + 'date_from' => $dateYearBefore, 'date_to' => null, ], [ 'period' => 'month', 'table' => 'report_viewed_product_aggregated_monthly', 'date_from' => null, - 'date_to' => $dateNow, + 'date_to' => $dateFrom, ], [ 'period' => 'year', 'table' => 'report_viewed_product_aggregated_yearly', - 'date_from' => $dateYearAgo, + 'date_from' => $dateYearBefore, 'date_to' => null, ], [ 'period' => 'year', 'table' => 'report_viewed_product_aggregated_yearly', 'date_from' => null, - 'date_to' => $dateNow, + 'date_to' => $dateFrom, ], [ 'period' => 'month', @@ -147,19 +147,19 @@ public function tableForPeriodDataProvider() [ 'period' => 'month', 'table' => 'report_viewed_product_aggregated_monthly', - 'date_from' => $dateYearAgo, - 'date_to' => $dateYearAgo, + 'date_from' => $dateYearBefore, + 'date_to' => $dateYearBefore, ], [ 'period' => 'month', 'table' => 'report_viewed_product_aggregated_monthly', 'date_from' => null, - 'date_to' => $dateYearAgo, + 'date_to' => $dateYearBefore, ], [ 'period' => 'month', 'table' => 'report_viewed_product_aggregated_monthly', - 'date_from' => $dateYearAgo, + 'date_from' => $dateYearBefore, 'date_to' => null, ], [ @@ -177,32 +177,32 @@ public function tableForPeriodDataProvider() [ 'period' => null, 'table' => 'report_viewed_product_aggregated_daily', - 'date_from' => $dateYearAgo, - 'date_to' => $dateNow, + 'date_from' => $dateYearBefore, + 'date_to' => $dateFrom, ], [ 'period' => null, 'table' => 'report_viewed_product_aggregated_daily', - 'date_from' => $dateNow, - 'date_to' => $dateNow, + 'date_from' => $dateFrom, + 'date_to' => $dateFrom, ], [ 'period' => 'day', 'table' => 'report_viewed_product_aggregated_daily', - 'date_from' => $dateYearAgo, - 'date_to' => $dateYearAgo, + 'date_from' => $dateYearBefore, + 'date_to' => $dateYearBefore, ], [ 'period' => 'year', 'table' => 'report_viewed_product_aggregated_daily', - 'date_from' => $dateYearAgo, - 'date_to' => $dateYearAgo, + 'date_from' => $dateYearBefore, + 'date_to' => $dateYearBefore, ], [ 'period' => 'year', 'table' => 'report_viewed_product_aggregated_daily', 'date_from' => null, - 'date_to' => $dateYearAgo, + 'date_to' => $dateYearBefore, ], [ 'period' => null, From 80684d725413f93744b37c33b02301506a394110 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Tue, 31 Dec 2019 11:39:46 +0100 Subject: [PATCH 0616/1143] #26206 Changes requested during Code Review --- .../Console/Command/IndexerReindexCommand.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Indexer/Console/Command/IndexerReindexCommand.php b/app/code/Magento/Indexer/Console/Command/IndexerReindexCommand.php index 858fcdeb02c6c..c7207c853b95e 100644 --- a/app/code/Magento/Indexer/Console/Command/IndexerReindexCommand.php +++ b/app/code/Magento/Indexer/Console/Command/IndexerReindexCommand.php @@ -128,8 +128,8 @@ protected function getIndexers(InputInterface $input) $dependentIndexers = [[]]; foreach ($indexers as $indexer) { - array_push($relatedIndexers, $this->getRelatedIndexerIds($indexer->getId())); - array_push($dependentIndexers, $this->getDependentIndexerIds($indexer->getId())); + $relatedIndexers[] = $this->getRelatedIndexerIds($indexer->getId()); + $dependentIndexers[] = $this->getDependentIndexerIds($indexer->getId()); } $relatedIndexers = array_merge(...$relatedIndexers); @@ -162,16 +162,15 @@ protected function getIndexers(InputInterface $input) * @param string $indexerId * @return array */ - private function getRelatedIndexerIds(string $indexerId) + private function getRelatedIndexerIds(string $indexerId): array { $relatedIndexerIds = [[]]; foreach ($this->getDependencyInfoProvider()->getIndexerIdsToRunBefore($indexerId) as $relatedIndexerId) { - array_push($relatedIndexerIds, [$relatedIndexerId], $this->getRelatedIndexerIds($relatedIndexerId)); + $relatedIndexerIds[] = [$relatedIndexerId]; + $relatedIndexerIds[] = $this->getRelatedIndexerIds($relatedIndexerId); } - $relatedIndexerIds = array_merge(...$relatedIndexerIds); - - return array_unique($relatedIndexerIds); + return array_unique(array_merge(...$relatedIndexerIds)); } /** @@ -180,13 +179,14 @@ private function getRelatedIndexerIds(string $indexerId) * @param string $indexerId * @return array */ - private function getDependentIndexerIds(string $indexerId) + private function getDependentIndexerIds(string $indexerId): array { $dependentIndexerIds = [[]]; foreach (array_keys($this->getConfig()->getIndexers()) as $id) { $dependencies = $this->getDependencyInfoProvider()->getIndexerIdsToRunBefore($id); if (array_search($indexerId, $dependencies) !== false) { - array_push($dependentIndexerIds, [$id], $this->getDependentIndexerIds($id)); + $dependentIndexerIds[] = [$id]; + $dependentIndexerIds[] = $this->getDependentIndexerIds($id); } } From add2bbb8f6b82f450dbf7e466f12f93254c0eed0 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Thu, 2 Jan 2020 11:35:27 +0200 Subject: [PATCH 0617/1143] cover changes with unit test --- .../Test/Unit/Controller/Index/SendTest.php | 57 ++++++++++++++++--- 1 file changed, 50 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Wishlist/Test/Unit/Controller/Index/SendTest.php b/app/code/Magento/Wishlist/Test/Unit/Controller/Index/SendTest.php index 47148f7878134..c70c2a1a6a9b6 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Controller/Index/SendTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Controller/Index/SendTest.php @@ -5,7 +5,10 @@ */ namespace Magento\Wishlist\Test\Unit\Controller\Index; +use Magento\Captcha\Helper\Data as CaptchaHelper; +use Magento\Captcha\Model\DefaultModel as CaptchaModel; use Magento\Customer\Model\Data\Customer as CustomerData; +use Magento\Customer\Model\Session; use Magento\Framework\App\Action\Context as ActionContext; use Magento\Framework\App\RequestInterface; use Magento\Framework\Controller\Result\Redirect as ResultRedirect; @@ -14,15 +17,13 @@ use Magento\Framework\Event\ManagerInterface as EventManagerInterface; use Magento\Framework\Mail\TransportInterface; use Magento\Framework\Message\ManagerInterface; +use Magento\Framework\Phrase; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use Magento\Framework\UrlInterface; use Magento\Framework\View\Result\Layout as ResultLayout; use Magento\Store\Model\Store; use Magento\Wishlist\Controller\Index\Send; use Magento\Wishlist\Controller\WishlistProviderInterface; -use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; -use Magento\Captcha\Helper\Data as CaptchaHelper; -use Magento\Captcha\Model\DefaultModel as CaptchaModel; -use Magento\Customer\Model\Session; /** * @SuppressWarnings(PHPMD.TooManyFields) @@ -212,7 +213,12 @@ protected function setUp() ); } - public function testExecuteNoFormKeyValidated() + /** + * Verify execute method without Form Key validated + * + * @return void + */ + public function testExecuteNoFormKeyValidated(): void { $this->formKeyValidator->expects($this->once()) ->method('validate') @@ -228,8 +234,43 @@ public function testExecuteNoFormKeyValidated() } /** - * @expectedException \Magento\Framework\Exception\NotFoundException - * @expectedExceptionMessage Page not found. + * Verify execute with no emails left + * + * @return void + */ + public function testExecuteWithNoEmailLeft(): void + { + $expectedMessage = new Phrase('Maximum of %1 emails can be sent.', [0]); + + $this->formKeyValidator->expects($this->once()) + ->method('validate') + ->with($this->request) + ->willReturn(true); + + $this->request->expects($this->at(0)) + ->method('getPost') + ->with('emails') + ->willReturn('some.Email@gmail.com', 'some.email2@gmail.com'); + $this->request->expects($this->at(1)) + ->method('getPost') + ->with('message'); + $wishlist = $this->createMock(\Magento\Wishlist\Model\Wishlist::class); + $this->wishlistProvider->expects($this->once()) + ->method('getWishlist') + ->willReturn($wishlist); + $this->resultRedirect->expects($this->once()) + ->method('setPath') + ->with('*/*/share') + ->willReturnSelf(); + $this->messageManager->expects($this->once()) + ->method('addErrorMessage') + ->with($expectedMessage); + + $this->assertEquals($this->resultRedirect, $this->model->execute()); + } + + /** + * Execute method with no wishlist available */ public function testExecuteNoWishlistAvailable() { @@ -241,6 +282,8 @@ public function testExecuteNoWishlistAvailable() $this->wishlistProvider->expects($this->once()) ->method('getWishlist') ->willReturn(null); + $this->expectException(\Magento\Framework\Exception\NotFoundException::class); + $this->expectExceptionMessage('Page not found'); $this->model->execute(); } From 69f6da07a6443eddd099f7f53ebc52bf3f7f2ba0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Chitesh=40wagento=2Ecom=E2=80=9D?= <hitesh@wagento.com> Date: Thu, 2 Jan 2020 15:21:14 +0530 Subject: [PATCH 0618/1143] [Align some space between input and update button Minicart] --- .../blank/Magento_Checkout/web/css/source/module/_minicart.less | 2 ++ .../luma/Magento_Checkout/web/css/source/module/_minicart.less | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/_minicart.less b/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/_minicart.less index 133dd0fe721bb..ba07580e17c03 100644 --- a/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/_minicart.less +++ b/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/_minicart.less @@ -348,6 +348,7 @@ .update-cart-item { .lib-font-size(11); vertical-align: top; + margin-left: 5px; } .subtitle { @@ -399,6 +400,7 @@ } .update-cart-item { float: right; + margin-left: 0; } } } diff --git a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less index 43ccee738a45e..556a3ca689afb 100644 --- a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less +++ b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less @@ -377,6 +377,7 @@ .update-cart-item { .lib-font-size(11); vertical-align: top; + margin-left: 5px; } .subtitle { @@ -428,6 +429,7 @@ } .update-cart-item { float: right; + margin-left: 0; } } } From 3182759c834cdb623a2194b75e5ae6bd4188577d Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Thu, 2 Jan 2020 12:42:49 +0200 Subject: [PATCH 0619/1143] Cover changes with unit test --- .../Unit/Model/ResourceModel/CustomerRepositoryTest.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/CustomerRepositoryTest.php b/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/CustomerRepositoryTest.php index 8032399e14881..015213847e7ee 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/CustomerRepositoryTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/CustomerRepositoryTest.php @@ -211,6 +211,7 @@ public function testSave() 'setFirstFailure', 'setLockExpires', 'save', + 'setGroupId' ] ); @@ -245,9 +246,15 @@ public function testSave() $this->customer->expects($this->atLeastOnce()) ->method('getId') ->willReturn($customerId); - $this->customer->expects($this->atLeastOnce()) + $this->customer->expects($this->at(4)) ->method('__toArray') ->willReturn([]); + $this->customer->expects($this->at(3)) + ->method('__toArray') + ->willReturn(['group_id' => 1]); + $customerModel->expects($this->once()) + ->method('setGroupId') + ->with(1); $this->customerRegistry->expects($this->atLeastOnce()) ->method('retrieve') ->with($customerId) From 3bce77fda3f048829b217b49dc37368fc6bf79e4 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Thu, 2 Jan 2020 13:12:42 +0200 Subject: [PATCH 0620/1143] fix phpStan test --- .../Magento/Customer/Model/ResourceModel/CustomerRepository.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Customer/Model/ResourceModel/CustomerRepository.php b/app/code/Magento/Customer/Model/ResourceModel/CustomerRepository.php index 323b6c5d53714..0611a2df641e7 100644 --- a/app/code/Magento/Customer/Model/ResourceModel/CustomerRepository.php +++ b/app/code/Magento/Customer/Model/ResourceModel/CustomerRepository.php @@ -17,6 +17,7 @@ use Magento\Customer\Model\Data\CustomerSecureFactory; use Magento\Customer\Model\Delegation\Data\NewOperation; use Magento\Customer\Model\Delegation\Storage as DelegatedStorage; +use Magento\Customer\Model\ResourceModel\Customer\Collection; use Magento\Framework\Api\DataObjectHelper; use Magento\Framework\Api\ExtensibleDataObjectConverter; use Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface; From c39e85c84449f86b2c9d27d377e548547273883f Mon Sep 17 00:00:00 2001 From: divyajyothi5321 <54176640+divyajyothi5321@users.noreply.github.com> Date: Thu, 2 Jan 2020 16:58:27 +0530 Subject: [PATCH 0621/1143] Added Fix for 25936 --- .../luma/Magento_Catalog/web/css/source/_module.less | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less index 9b6986249b009..27533a0eb598f 100644 --- a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less @@ -174,9 +174,9 @@ width: 100%; .price-box { - display: table-cell; + display: inline-block; vertical-align: top; - width: 1px; + width: auto; .price-container { > span { @@ -228,7 +228,8 @@ } .product-info-stock-sku { - display: table-cell; + display: inline-block; + float: right; padding-bottom: @indent__s; padding-left: 10%; text-align: right; From 1fd25977b0c27b8aee5e765afdd46cee3cb69906 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Chitesh=40wagento=2Ecom=E2=80=9D?= <hitesh@wagento.com> Date: Thu, 2 Jan 2020 17:04:38 +0530 Subject: [PATCH 0622/1143] [Correct oth Menu spacing issue] --- .../frontend/Magento/blank/web/css/source/_navigation.less | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/design/frontend/Magento/blank/web/css/source/_navigation.less b/app/design/frontend/Magento/blank/web/css/source/_navigation.less index 21b7315779764..d34e256330159 100644 --- a/app/design/frontend/Magento/blank/web/css/source/_navigation.less +++ b/app/design/frontend/Magento/blank/web/css/source/_navigation.less @@ -142,7 +142,7 @@ display: block; } } - } + } .header.links { .lib-list-reset-styles(); border-bottom: 1px solid @color-gray82; @@ -154,7 +154,7 @@ &.greet.welcome { border-top: 1px solid @color-gray82; font-weight: @font-weight__bold; - padding: .8rem @indent__base; + padding: .8rem 15px; } > a { @@ -168,7 +168,7 @@ .lib-css(text-decoration, @navigation-level0-item__text-decoration); display: block; font-weight: @font-weight__bold; - padding: .8rem @indent__base; + padding: .8rem 15px; } .header.links { From 7e5e6c773712359e303f4b4ee1ebc1b2fb8b85af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Chitesh=40wagento=2Ecom=E2=80=9D?= <hitesh@wagento.com> Date: Thu, 2 Jan 2020 17:39:32 +0530 Subject: [PATCH 0623/1143] [Align some space between input and update button Minicart] --- .../blank/Magento_Checkout/web/css/source/module/_minicart.less | 2 +- .../luma/Magento_Checkout/web/css/source/module/_minicart.less | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/_minicart.less b/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/_minicart.less index ba07580e17c03..c9b1d41857eee 100644 --- a/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/_minicart.less +++ b/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/_minicart.less @@ -347,8 +347,8 @@ .update-cart-item { .lib-font-size(11); - vertical-align: top; margin-left: 5px; + vertical-align: top; } .subtitle { diff --git a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less index 556a3ca689afb..14c754623cf03 100644 --- a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less +++ b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less @@ -376,8 +376,8 @@ .update-cart-item { .lib-font-size(11); - vertical-align: top; margin-left: 5px; + vertical-align: top; } .subtitle { From 2d2f1e05625ee4eb83dbabb78f09c667b863e554 Mon Sep 17 00:00:00 2001 From: Vaha <vaha@atwix.com> Date: Thu, 2 Jan 2020 17:29:18 +0200 Subject: [PATCH 0624/1143] #26240: fixed logic for getting option price index for selected swatch option --- .../view/base/web/js/swatch-renderer.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Swatches/view/base/web/js/swatch-renderer.js b/app/code/Magento/Swatches/view/base/web/js/swatch-renderer.js index ee55beb440f59..77c386c05323b 100644 --- a/app/code/Magento/Swatches/view/base/web/js/swatch-renderer.js +++ b/app/code/Magento/Swatches/view/base/web/js/swatch-renderer.js @@ -759,7 +759,7 @@ define([ $(document).trigger('updateMsrpPriceBlock', [ - _.findKey($widget.options.jsonConfig.index, $widget.options.jsonConfig.defaultValues), + this._getSelectedOptionPriceIndex(), $widget.options.jsonConfig.optionPrices ]); @@ -770,6 +770,21 @@ define([ $input.trigger('change'); }, + /** + * Get selected option price index + * + * @return {String|undefined} + * @private + */ + _getSelectedOptionPriceIndex: function () { + var allowedProduct = this._getAllowedProductWithMinPrice(this._CalcProducts()); + if (_.isEmpty(allowedProduct)) { + return undefined; + } + + return allowedProduct; + }, + /** * Get human readable attribute code (eg. size, color) by it ID from configuration * From e79febaf020687637fb15a3308a3f1702d4c9040 Mon Sep 17 00:00:00 2001 From: Lena Orobei <oorobei@magento.com> Date: Thu, 2 Jan 2020 11:56:13 -0600 Subject: [PATCH 0625/1143] Forward-port magento/graphql-ce#443 and magento/graphql-ce#1073 --- .../DataProvider/SwatchDataProvider.php | 208 +----------------- .../Resolver/Product/Options/SwatchData.php | 8 +- .../Options/SwatchDataTypeResolver.php | 9 +- .../SwatchesGraphQl/etc/schema.graphqls | 2 +- .../Swatches/ProductSwatchDataTest.php | 145 +++++------- ...e_with_different_options_type_rollback.php | 5 +- ...bled_product_image_for_swatch_rollback.php | 1 - 7 files changed, 75 insertions(+), 303 deletions(-) diff --git a/app/code/Magento/SwatchesGraphQl/Model/Resolver/Product/Options/DataProvider/SwatchDataProvider.php b/app/code/Magento/SwatchesGraphQl/Model/Resolver/Product/Options/DataProvider/SwatchDataProvider.php index 9e62ae928fb53..e7cd4c567da7f 100644 --- a/app/code/Magento/SwatchesGraphQl/Model/Resolver/Product/Options/DataProvider/SwatchDataProvider.php +++ b/app/code/Magento/SwatchesGraphQl/Model/Resolver/Product/Options/DataProvider/SwatchDataProvider.php @@ -7,18 +7,12 @@ namespace Magento\SwatchesGraphQl\Model\Resolver\Product\Options\DataProvider; -use Magento\Catalog\Api\Data\ProductInterface; -use Magento\Catalog\Model\Product\Image\UrlBuilder; -use Magento\Framework\Exception\LocalizedException; -use Magento\Framework\Exception\NoSuchEntityException; -use Magento\Framework\Exception\RuntimeException; -use Magento\Framework\GraphQl\Query\EnumLookup; use Magento\Swatches\Helper\Data as SwatchData; use Magento\Swatches\Helper\Media as SwatchesMedia; use Magento\Swatches\Model\Swatch; /** - * Swatch data provider + * Data provider for options swatches. */ class SwatchDataProvider { @@ -32,219 +26,41 @@ class SwatchDataProvider */ private $swatchMediaHelper; - /** - * @var UrlBuilder - */ - private $imageUrlBuilder; - - /** - * @var EnumLookup - */ - private $enumLookup; - /** * SwatchDataProvider constructor. * * @param SwatchData $swatchHelper * @param SwatchesMedia $swatchMediaHelper - * @param UrlBuilder $imageUrlBuilder - * @param EnumLookup $enumLookup */ public function __construct( SwatchData $swatchHelper, - SwatchesMedia $swatchMediaHelper, - UrlBuilder $imageUrlBuilder, - EnumLookup $enumLookup + SwatchesMedia $swatchMediaHelper ) { $this->swatchHelper = $swatchHelper; $this->swatchMediaHelper = $swatchMediaHelper; - $this->imageUrlBuilder = $imageUrlBuilder; - $this->enumLookup = $enumLookup; } /** - * Get swatch data + * Returns swatch data by option ID. * * @param string $optionId - * @param ProductInterface $product - * - * @return array - * - * @throws LocalizedException - * @throws NoSuchEntityException - * @throws \LogicException + * @return array|null */ - public function getData(string $optionId, ProductInterface $product): array + public function getData(string $optionId): ?array { $swatches = $this->swatchHelper->getSwatchesByOptionsId([$optionId]); - if (!isset($swatches[$optionId], $swatches[$optionId]['type'], $swatches[$optionId]['value'])) { + if (!isset($swatches[$optionId]['type'], $swatches[$optionId]['value'])) { return null; } - $type = (int)$swatches[$optionId]['type']; $value = $swatches[$optionId]['value']; - $thumbnail = null; - - // change value & thumbnail if type is 'visual' + $data = ['value' => $value, 'type' => $type]; if ($type === Swatch::SWATCH_TYPE_VISUAL_IMAGE) { - $thumbnail = $this->swatchMediaHelper->getSwatchAttributeImage(Swatch::SWATCH_THUMBNAIL_NAME, $value); - $value = $this->swatchMediaHelper->getSwatchAttributeImage(Swatch::SWATCH_IMAGE_NAME, $value); + $data['thumbnail'] = $this->swatchMediaHelper->getSwatchAttributeImage( + Swatch::SWATCH_THUMBNAIL_NAME, + $value + ); } - - $attributeData = $this->getSwatchAttributeDataByOptionId($product, $optionId); - // check if swatch value should be getting from related product image - if (!$this->isUseProductImageForSwatch($attributeData)) { - return $this->getResultArray($value, $type, $thumbnail); - } - - // get product with existing image - $variationProduct = $this->getVariationProduct($attributeData, $optionId, $product); - if (null === $variationProduct) { - return $this->getResultArray($value, $type, $thumbnail); - } - - // set 'visual' type, because the product image is using as swatch value - $type = Swatch::SWATCH_TYPE_VISUAL_IMAGE; - - // get image from child product - $productImage = $this->getSwatchProductImage($variationProduct, Swatch::SWATCH_IMAGE_NAME); - if (null !== $productImage) { - $value = $productImage; - } - - // get thumbnail from child product - $productThumbnail = $this->getSwatchProductImage($variationProduct, Swatch::SWATCH_THUMBNAIL_NAME); - if (null !== $productThumbnail) { - $thumbnail = $productThumbnail; - } - - return $this->getResultArray($value, $type, $thumbnail); - } - - /** - * Get result array - * - * @param string $value - * @param int $type - * @param null|string $thumbnail - * - * @return array - * - * @throws RuntimeException - */ - private function getResultArray(string $value, int $type, ?string $thumbnail) - { - return [ - 'value' => $value, - 'type' => $this->enumLookup->getEnumValueFromField('SwatchTypeEnum', (string)$type), - 'thumbnail' => $thumbnail - ]; - } - - /** - * Is swatch images should be getting from related simple products - * - * @param array $attributeData - * - * @return bool - */ - private function isUseProductImageForSwatch(array $attributeData) : bool - { - return isset($attributeData['use_product_image_for_swatch']) && $attributeData['use_product_image_for_swatch']; - } - - /** - * Get simple product with first variation swatch image or image - * - * @param array $attributeData - * @param string $optionId - * @param ProductInterface $product - * - * @return ProductInterface|null - */ - private function getVariationProduct(array $attributeData, string $optionId, ProductInterface $product) : ?ProductInterface - { - $attributeCode = $attributeData['attribute_code']; - $requiredAttributes = [ - $attributeCode => $optionId - ]; - - $variationProduct = $this->swatchHelper->loadFirstVariationWithSwatchImage($product, $requiredAttributes); - if ($variationProduct instanceof ProductInterface) { - return $variationProduct; - } - - $variationProduct = $this->swatchHelper->loadFirstVariationWithImage($product, $requiredAttributes); - if ($variationProduct instanceof ProductInterface) { - return $variationProduct; - } - - return null; - } - - /** - * Get swatch product image - * - * @param ProductInterface $product - * @param string $imageType - * - * @return string|null - */ - private function getSwatchProductImage(ProductInterface $product, $imageType) : ?string - { - if ($this->isProductHasImage($product, Swatch::SWATCH_IMAGE_NAME)) { - $swatchImageId = $imageType; - $imageAttributes = ['type' => Swatch::SWATCH_IMAGE_NAME]; - } elseif ($this->isProductHasImage($product, 'image')) { - $swatchImageId = $imageType == Swatch::SWATCH_IMAGE_NAME ? 'swatch_image_base' : 'swatch_thumb_base'; - $imageAttributes = ['type' => 'image']; - } - - if (empty($swatchImageId) || empty($imageAttributes['type'])) { - return null; - } - - return $this->imageUrlBuilder->getUrl($product->getData($imageAttributes['type']), $swatchImageId); - } - - /** - * Is product has image - * - * @param ProductInterface $product - * @param string $imageType - * - * @return bool - */ - private function isProductHasImage(ProductInterface $product, string $imageType) : bool - { - return $product->getData($imageType) !== null && $product->getData($imageType) != SwatchData::EMPTY_IMAGE_VALUE; - } - - /** - * Get swatch attribute data by option id - * - * @param ProductInterface $product - * @param string $optionId - * - * @return array - * - * @throws LocalizedException - * @throws \LogicException - * @throws NoSuchEntityException - */ - private function getSwatchAttributeDataByOptionId(ProductInterface $product, string $optionId) : array - { - $attributesData = $this->swatchHelper->getSwatchAttributesAsArray($product); - foreach ($attributesData as $attributeData) { - if (!isset($attributeData['options']) || !is_array($attributeData['options'])) { - continue; - } - - if (array_key_exists($optionId, $attributeData['options'])) { - return $attributeData; - } - } - - throw new LocalizedException(__(sprintf('Cannot find the attribute with option id "%1".', $optionId))); + return $data; } } diff --git a/app/code/Magento/SwatchesGraphQl/Model/Resolver/Product/Options/SwatchData.php b/app/code/Magento/SwatchesGraphQl/Model/Resolver/Product/Options/SwatchData.php index 9fea3b3ff59e5..980f779e8e9f6 100644 --- a/app/code/Magento/SwatchesGraphQl/Model/Resolver/Product/Options/SwatchData.php +++ b/app/code/Magento/SwatchesGraphQl/Model/Resolver/Product/Options/SwatchData.php @@ -7,8 +7,6 @@ namespace Magento\SwatchesGraphQl\Model\Resolver\Product\Options; -use Magento\Catalog\Api\Data\ProductInterface; -use Magento\Framework\Exception\LocalizedException; use Magento\Framework\GraphQl\Config\Element\Field; use Magento\Framework\GraphQl\Query\ResolverInterface; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; @@ -47,10 +45,6 @@ public function resolve( array $value = null, array $args = null ) { - if (!array_key_exists('model', $value) || !$value['model'] instanceof ProductInterface) { - throw new LocalizedException(__('"model" value should be specified')); - } - - return $this->swatchDataProvider->getData($value['value_index'], $value['model']); + return $this->swatchDataProvider->getData($value['value_index']); } } diff --git a/app/code/Magento/SwatchesGraphQl/Model/Resolver/Product/Options/SwatchDataTypeResolver.php b/app/code/Magento/SwatchesGraphQl/Model/Resolver/Product/Options/SwatchDataTypeResolver.php index 96f584524fd27..add6f7123b921 100644 --- a/app/code/Magento/SwatchesGraphQl/Model/Resolver/Product/Options/SwatchDataTypeResolver.php +++ b/app/code/Magento/SwatchesGraphQl/Model/Resolver/Product/Options/SwatchDataTypeResolver.php @@ -7,6 +7,7 @@ namespace Magento\SwatchesGraphQl\Model\Resolver\Product\Options; +use Magento\Framework\Exception\LocalizedException; use Magento\Framework\GraphQl\Query\Resolver\TypeResolverInterface; use Magento\Swatches\Model\Swatch; @@ -16,19 +17,19 @@ class SwatchDataTypeResolver implements TypeResolverInterface { /** - * {@inheritdoc} + * @inheritdoc */ public function resolveType(array $data): string { switch ($data['type']) { case Swatch::SWATCH_TYPE_TEXTUAL: return 'TextSwatchData'; - case Swatch::SWATCH_TYPE_VISUAL_COLOR; + case Swatch::SWATCH_TYPE_VISUAL_COLOR: return 'ColorSwatchData'; - case Swatch::SWATCH_TYPE_VISUAL_IMAGE; + case Swatch::SWATCH_TYPE_VISUAL_IMAGE: return 'ImageSwatchData'; default: - return ''; + throw new LocalizedException(__('Unsupported swatch type')); } } } diff --git a/app/code/Magento/SwatchesGraphQl/etc/schema.graphqls b/app/code/Magento/SwatchesGraphQl/etc/schema.graphqls index f986723a24545..c51468ccd2856 100644 --- a/app/code/Magento/SwatchesGraphQl/etc/schema.graphqls +++ b/app/code/Magento/SwatchesGraphQl/etc/schema.graphqls @@ -46,4 +46,4 @@ type TextSwatchData implements SwatchDataInterface { type ColorSwatchData implements SwatchDataInterface { -} \ No newline at end of file +} diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Swatches/ProductSwatchDataTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Swatches/ProductSwatchDataTest.php index ab4e001e9d633..c356012c71f47 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Swatches/ProductSwatchDataTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Swatches/ProductSwatchDataTest.php @@ -7,14 +7,13 @@ namespace Magento\GraphQl\Swatches; -use Magento\Catalog\Model\Product\Image\UrlBuilder; use Magento\Swatches\Helper\Media as SwatchesMedia; use Magento\Swatches\Model\Swatch; use Magento\TestFramework\Helper\Bootstrap; use Magento\TestFramework\TestCase\GraphQlAbstract; /** - * Class ProductSwatchDataTest + * Test for configurable product option swatch data */ class ProductSwatchDataTest extends GraphQlAbstract { @@ -23,11 +22,6 @@ class ProductSwatchDataTest extends GraphQlAbstract */ private $swatchMediaHelper; - /** - * @var UrlBuilder - */ - private $imageUrlBuilder; - /** * @inheritdoc */ @@ -35,28 +29,24 @@ protected function setUp() { $objectManager = Bootstrap::getObjectManager(); $this->swatchMediaHelper = $objectManager->get(SwatchesMedia::class); - $this->imageUrlBuilder = $objectManager->get(UrlBuilder::class); } /** - * @param string $productSku - * - * @return mixed - * @throws \PHPUnit\Framework\Exception + * @magentoApiDataFixture Magento/Swatches/_files/text_swatch_attribute.php + * @magentoApiDataFixture Magento/ConfigurableProduct/_files/configurable_products.php */ - private function getSwatchDataValues($productSku = 'configurable') + public function testTextSwatchDataValues() { + $productSku = 'configurable'; $query = <<<QUERY { - products(filter: {sku: {eq: "{$productSku}"}}) { + products(filter: {sku: {eq: "$productSku"}}) { items { ... on ConfigurableProduct{ configurable_options{ values { swatch_data{ - type value - thumbnail } } } @@ -77,90 +67,61 @@ private function getSwatchDataValues($productSku = 'configurable') $option = $product['configurable_options'][0]; $this->assertArrayHasKey('values', $option); - - return $option['values']; - } - - /** - * @magentoApiDataFixture Magento/Swatches/_files/visual_swatch_attribute_with_enabled_product_image_for_swatch.php - */ - public function testGetSwatchDataForVisualOptionsWithProductImage() - { - $productSku = 'configurable_12345'; - $productImage = '/m/a/magento_image.jpg'; - $swatchImageName = '/visual_swatch_attribute_option_type_image.jpg'; - $expectedValues = [ - 0 => [ - 'swatch_data' => [ - 'type' => 'IMAGE', - 'value' => $this->imageUrlBuilder->getUrl($productImage, Swatch::SWATCH_IMAGE_NAME), - 'thumbnail' => $this->imageUrlBuilder->getUrl($productImage, Swatch::SWATCH_THUMBNAIL_NAME), - ], - ], - 1 => [ - 'swatch_data' => [ - 'type' => 'IMAGE', - 'value' => $this->swatchMediaHelper->getSwatchAttributeImage(Swatch::SWATCH_IMAGE_NAME, $swatchImageName), - 'thumbnail' => $this->swatchMediaHelper->getSwatchAttributeImage(Swatch::SWATCH_THUMBNAIL_NAME, $swatchImageName), - ], - ], - 2 => [ - 'swatch_data' => NULL, - ], - ]; - - $values = $this->getSwatchDataValues($productSku); - $this->assertEquals($values, $expectedValues); - } - - /** - * @magentoApiDataFixture Magento/Swatches/_files/textual_swatch_attribute.php - * @magentoApiDataFixture Magento/ConfigurableProduct/_files/configurable_products.php - */ - public function testGetSwatchDataForTextualOptions() - { - $expectType = "TEXTUAL"; - $expectValue = "option 1"; - $expectThumbnail = null; - - $values = $this->getSwatchDataValues(); - $this->assertArrayHasKey(0, $values); - - $value = $values[0]; - $this->assertArrayHasKey('swatch_data', $value); - $this->assertEquals($expectType, $value['swatch_data']['type']); - $this->assertEquals($expectValue, $value['swatch_data']['value']); - $this->assertEquals($expectThumbnail, $value['swatch_data']['thumbnail']); + $length = count($option['values']); + for ($i = 0; $i < $length; $i++) { + $this->assertEquals('option ' . ($i + 1), $option['values'][$i]['swatch_data']['value']); + } } /** * @magentoApiDataFixture Magento/Swatches/_files/visual_swatch_attribute_with_different_options_type.php * @magentoApiDataFixture Magento/ConfigurableProduct/_files/configurable_products.php */ - public function testGetSwatchDataForVisualOptions() + public function testVisualSwatchDataValues() { + $productSku = 'configurable'; $imageName = '/visual_swatch_attribute_option_type_image.jpg'; - $expectedValues = [ - 0 => [ - 'swatch_data' => [ - 'type' => 'COLOR', - 'value' => '#000000', - 'thumbnail' => NULL, - ], - ], - 1 => [ - 'swatch_data' => [ - 'type' => 'IMAGE', - 'value' => $this->swatchMediaHelper->getSwatchAttributeImage(Swatch::SWATCH_IMAGE_NAME, $imageName), - 'thumbnail' => $this->swatchMediaHelper->getSwatchAttributeImage(Swatch::SWATCH_THUMBNAIL_NAME, $imageName), - ], - ], - 2 => [ - 'swatch_data' => NULL, - ], - ]; + $color = '#000000'; + $query = <<<QUERY +{ + products(filter: {sku: {eq: "$productSku"}}) { + items { + ... on ConfigurableProduct{ + configurable_options{ + values { + swatch_data{ + value + ... on ImageSwatchData { + thumbnail + } + } + } + } + } + } + } +} +QUERY; + $response = $this->graphQlQuery($query); + + $this->assertArrayHasKey('products', $response); + $this->assertArrayHasKey('items', $response['products']); + $this->assertArrayHasKey(0, $response['products']['items']); - $values = $this->getSwatchDataValues(); - $this->assertEquals($values, $expectedValues); + $product = $response['products']['items'][0]; + $this->assertArrayHasKey('configurable_options', $product); + $this->assertArrayHasKey(0, $product['configurable_options']); + + $option = $product['configurable_options'][0]; + $this->assertArrayHasKey('values', $option); + $this->assertEquals($color, $option['values'][0]['swatch_data']['value']); + $this->assertContains( + $option['values'][1]['swatch_data']['value'], + $this->swatchMediaHelper->getSwatchAttributeImage(Swatch::SWATCH_IMAGE_NAME, $imageName) + ); + $this->assertEquals( + $option['values'][1]['swatch_data']['thumbnail'], + $this->swatchMediaHelper->getSwatchAttributeImage(Swatch::SWATCH_THUMBNAIL_NAME, $imageName) + ); } } diff --git a/dev/tests/integration/testsuite/Magento/Swatches/_files/visual_swatch_attribute_with_different_options_type_rollback.php b/dev/tests/integration/testsuite/Magento/Swatches/_files/visual_swatch_attribute_with_different_options_type_rollback.php index ef1db34708fb3..7f9328368464e 100644 --- a/dev/tests/integration/testsuite/Magento/Swatches/_files/visual_swatch_attribute_with_different_options_type_rollback.php +++ b/dev/tests/integration/testsuite/Magento/Swatches/_files/visual_swatch_attribute_with_different_options_type_rollback.php @@ -29,6 +29,7 @@ foreach ($swatchTypes as $swatchType) { $absolutePath = $mediaDirectory->getAbsolutePath($swatchesMedia->getSwatchCachePath($swatchType)); - $swatchTypePath = $absolutePath . $swatchesMedia->getFolderNameSize($swatchType, $imageConfig) . '/' . $testImageName; + $swatchTypePath = $absolutePath . $swatchesMedia->getFolderNameSize($swatchType, $imageConfig) . + '/' . $testImageName; $mediaDirectory->delete($swatchTypePath); -} +} \ No newline at end of file diff --git a/dev/tests/integration/testsuite/Magento/Swatches/_files/visual_swatch_attribute_with_enabled_product_image_for_swatch_rollback.php b/dev/tests/integration/testsuite/Magento/Swatches/_files/visual_swatch_attribute_with_enabled_product_image_for_swatch_rollback.php index c708971326162..85c02049a992a 100644 --- a/dev/tests/integration/testsuite/Magento/Swatches/_files/visual_swatch_attribute_with_enabled_product_image_for_swatch_rollback.php +++ b/dev/tests/integration/testsuite/Magento/Swatches/_files/visual_swatch_attribute_with_enabled_product_image_for_swatch_rollback.php @@ -8,4 +8,3 @@ require __DIR__ . '/visual_swatch_attribute_with_different_options_type_rollback.php'; require __DIR__ . '/../../../Magento/ConfigurableProduct/_files/configurable_products_rollback.php'; require __DIR__ . '/../../../Magento/Catalog/_files/product_image_rollback.php'; - From aba1a24ee2146a85c6728fba78ee9c701792a40c Mon Sep 17 00:00:00 2001 From: Lena Orobei <oorobei@magento.com> Date: Thu, 2 Jan 2020 12:51:42 -0600 Subject: [PATCH 0626/1143] Forward-port magento/graphql-ce#443 and magento/graphql-ce#1073 --- ...al_swatch_attribute_with_different_options_type_rollback.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/Swatches/_files/visual_swatch_attribute_with_different_options_type_rollback.php b/dev/tests/integration/testsuite/Magento/Swatches/_files/visual_swatch_attribute_with_different_options_type_rollback.php index 7f9328368464e..c480906619a4a 100644 --- a/dev/tests/integration/testsuite/Magento/Swatches/_files/visual_swatch_attribute_with_different_options_type_rollback.php +++ b/dev/tests/integration/testsuite/Magento/Swatches/_files/visual_swatch_attribute_with_different_options_type_rollback.php @@ -32,4 +32,4 @@ $swatchTypePath = $absolutePath . $swatchesMedia->getFolderNameSize($swatchType, $imageConfig) . '/' . $testImageName; $mediaDirectory->delete($swatchTypePath); -} \ No newline at end of file +} From b45d7ac9cc817ef64ea25deef1fe84fe48e9aa91 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky <firster@atwix.com> Date: Wed, 11 Dec 2019 18:47:53 +0200 Subject: [PATCH 0627/1143] =?UTF-8?q?magento/magento2#:=20Remove=20unused?= =?UTF-8?q?=20=E2=80=9CDefault=20Email=20Domain=E2=80=9D=20option=20and=20?= =?UTF-8?q?related=20to=20it=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/code/Magento/Customer/etc/adminhtml/system.xml | 3 --- app/code/Magento/Customer/etc/config.xml | 1 - app/code/Magento/Sales/Model/AdminOrder/Create.php | 5 ++++- app/code/Magento/Sales/etc/di.xml | 3 --- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Customer/etc/adminhtml/system.xml b/app/code/Magento/Customer/etc/adminhtml/system.xml index 2bd1041214801..a973941d556ab 100644 --- a/app/code/Magento/Customer/etc/adminhtml/system.xml +++ b/app/code/Magento/Customer/etc/adminhtml/system.xml @@ -86,9 +86,6 @@ <comment>To show VAT number on Storefront, set Show VAT Number on Storefront option to Yes.</comment> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="email_domain" translate="label" type="text" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> - <label>Default Email Domain</label> - </field> <field id="email_template" translate="label comment" type="select" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Default Welcome Email</label> <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> diff --git a/app/code/Magento/Customer/etc/config.xml b/app/code/Magento/Customer/etc/config.xml index da4b80536e631..5f10ba32b273f 100644 --- a/app/code/Magento/Customer/etc/config.xml +++ b/app/code/Magento/Customer/etc/config.xml @@ -15,7 +15,6 @@ <confirm>0</confirm> <default_group>1</default_group> <tax_calculation_address_type>billing</tax_calculation_address_type> - <email_domain>example.com</email_domain> <email_identity>general</email_identity> <email_template>customer_create_account_email_template</email_template> <email_no_password_template>customer_create_account_email_no_password_template</email_no_password_template> diff --git a/app/code/Magento/Sales/Model/AdminOrder/Create.php b/app/code/Magento/Sales/Model/AdminOrder/Create.php index cf6d55d8c76f3..7396118aa9fc0 100644 --- a/app/code/Magento/Sales/Model/AdminOrder/Create.php +++ b/app/code/Magento/Sales/Model/AdminOrder/Create.php @@ -29,7 +29,10 @@ class Create extends \Magento\Framework\DataObject implements \Magento\Checkout\Model\Cart\CartInterface { /** - * Xml default email domain path + * Path to "CUSTOMERS > Customer Configuration > Create New Account Options > Default Email Domain" setting + * + * @deprecated since version 2.2.6 + * @see \Magento\Sales\Model\AdminOrder\Create. Constant usage has been removed from _getNewCustomerEmail() method. */ const XML_PATH_DEFAULT_EMAIL_DOMAIN = 'customer/create_account/email_domain'; diff --git a/app/code/Magento/Sales/etc/di.xml b/app/code/Magento/Sales/etc/di.xml index f6618c9884d60..8e8d8b007ae40 100644 --- a/app/code/Magento/Sales/etc/di.xml +++ b/app/code/Magento/Sales/etc/di.xml @@ -1008,9 +1008,6 @@ <item name="sales_email/shipment/copy_to" xsi:type="string">1</item> <item name="sales_email/shipment_comment/copy_to" xsi:type="string">1</item> </argument> - <argument name="environment" xsi:type="array"> - <item name="customer/create_account/email_domain" xsi:type="string">1</item> - </argument> </arguments> </type> <preference From 388f2e95d36ddae1ecb2a6c2730672e55c859720 Mon Sep 17 00:00:00 2001 From: Daniel Renaud <drenaud@magento.com> Date: Thu, 2 Jan 2020 16:35:15 -0600 Subject: [PATCH 0628/1143] MC-25215: [Forwardport] [GraphQL] Row_id is used as id for product resolver - MC-25216: [Forwardport] [GraphQL] Deprecate fields in ProductInterface - MC-29135: [Forwardport] Throw GraphQL input exception when provided store is not enabled --- .../Model/Resolver/Product/EntityIdToId.php | 2 +- .../CatalogGraphQl/etc/schema.graphqls | 4 +- .../HttpRequestValidator/StoreValidator.php | 12 ++-- .../Magento/StoreGraphQl/etc/schema.graphqls | 14 ++--- .../GraphQl/Bundle/BundleProductViewTest.php | 16 ------ .../GraphQl/Catalog/ProductViewTest.php | 14 ----- .../Catalog/VirtualProductViewTest.php | 6 -- .../ConfigurableProductViewTest.php | 2 +- .../GraphQl/Store/StoreValidatorTest.php | 56 +++++++++++++++++++ .../Magento/GraphQl/Tax/ProductViewTest.php | 6 -- .../Magento/Store/_files/inactive_store.php | 34 +++++++++++ .../Store/_files/inactive_store_rollback.php | 24 ++++++++ 12 files changed, 130 insertions(+), 60 deletions(-) create mode 100644 dev/tests/api-functional/testsuite/Magento/GraphQl/Store/StoreValidatorTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Store/_files/inactive_store.php create mode 100644 dev/tests/integration/testsuite/Magento/Store/_files/inactive_store_rollback.php diff --git a/app/code/Magento/CatalogGraphQl/Model/Resolver/Product/EntityIdToId.php b/app/code/Magento/CatalogGraphQl/Model/Resolver/Product/EntityIdToId.php index ada3caad5f9f8..701ee70204486 100644 --- a/app/code/Magento/CatalogGraphQl/Model/Resolver/Product/EntityIdToId.php +++ b/app/code/Magento/CatalogGraphQl/Model/Resolver/Product/EntityIdToId.php @@ -53,7 +53,7 @@ public function resolve( $product = $value['model']; $productId = $product->getData( - $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField() + $this->metadataPool->getMetadata(ProductInterface::class)->getIdentifierField() ); return $productId; diff --git a/app/code/Magento/CatalogGraphQl/etc/schema.graphqls b/app/code/Magento/CatalogGraphQl/etc/schema.graphqls index f70a32a1b549e..8da50beacb2fe 100644 --- a/app/code/Magento/CatalogGraphQl/etc/schema.graphqls +++ b/app/code/Magento/CatalogGraphQl/etc/schema.graphqls @@ -100,8 +100,8 @@ interface ProductInterface @typeResolver(class: "Magento\\CatalogGraphQl\\Model\ created_at: String @doc(description: "Timestamp indicating when the product was created.") updated_at: String @doc(description: "Timestamp indicating when the product was updated.") country_of_manufacture: String @doc(description: "The product's country of origin.") - type_id: String @doc(description: "One of simple, virtual, bundle, downloadable, grouped, or configurable.") - websites: [Website] @doc(description: "An array of websites in which the product is available.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\Websites") + type_id: String @doc(description: "One of simple, virtual, bundle, downloadable, grouped, or configurable.") @deprecated(reason: "Use __typename instead.") + websites: [Website] @doc(description: "An array of websites in which the product is available.") @deprecated(reason: "The field should not be used on the storefront.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\Websites") product_links: [ProductLinksInterface] @doc(description: "An array of ProductLinks objects.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\BatchProductLinks") media_gallery_entries: [MediaGalleryEntry] @deprecated(reason: "Use product's `media_gallery` instead") @doc(description: "An array of MediaGalleryEntry objects.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\MediaGalleryEntries") price: ProductPrices @deprecated(reason: "Use price_range for product price information.") @doc(description: "A ProductPrices object, indicating the price of an item.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\Price") diff --git a/app/code/Magento/StoreGraphQl/Controller/HttpRequestValidator/StoreValidator.php b/app/code/Magento/StoreGraphQl/Controller/HttpRequestValidator/StoreValidator.php index 144905d728141..3d41c975e591a 100644 --- a/app/code/Magento/StoreGraphQl/Controller/HttpRequestValidator/StoreValidator.php +++ b/app/code/Magento/StoreGraphQl/Controller/HttpRequestValidator/StoreValidator.php @@ -44,13 +44,11 @@ public function validate(HttpRequestInterface $request): void if (!empty($headerValue)) { $storeCode = ltrim(rtrim($headerValue)); $stores = $this->storeManager->getStores(false, true); - if (!isset($stores[$storeCode])) { - if (strtolower($storeCode) !== 'default') { - $this->storeManager->setCurrentStore(null); - throw new GraphQlInputException( - __("Requested store is not found") - ); - } + if ((!isset($stores[$storeCode]) && strtolower($storeCode) !== 'default') + || !$stores[$storeCode]->getIsActive() + ) { + $this->storeManager->setCurrentStore(null); + throw new GraphQlInputException(__('Requested store is not found')); } } } diff --git a/app/code/Magento/StoreGraphQl/etc/schema.graphqls b/app/code/Magento/StoreGraphQl/etc/schema.graphqls index aaef3aa13dbaf..919c94684eb21 100644 --- a/app/code/Magento/StoreGraphQl/etc/schema.graphqls +++ b/app/code/Magento/StoreGraphQl/etc/schema.graphqls @@ -4,13 +4,13 @@ type Query { storeConfig : StoreConfig @resolver(class: "Magento\\StoreGraphQl\\Model\\Resolver\\StoreConfigResolver") @doc(description: "The store config query") @cache(cacheable: false) } -type Website @doc(description: "The type contains information about a website") { - id : Int @doc(description: "The ID number assigned to the website") - name : String @doc(description: "The website name. Websites use this name to identify it easier.") - code : String @doc(description: "A code assigned to the website to identify it") - sort_order : Int @doc(description: "The attribute to use for sorting websites") - default_group_id : String @doc(description: "The default group ID that the website has") - is_default : Boolean @doc(description: "Specifies if this is the default website") +type Website @doc(description: "Website is deprecated because it is should not be used on storefront. The type contains information about a website") { + id : Int @deprecated(reason: "The field should not be used on the storefront.") @doc(description: "The ID number assigned to the website") + name : String @deprecated(reason: "The field should not be used on the storefront.") @doc(description: "The website name. Websites use this name to identify it easier.") + code : String @deprecated(reason: "The field should not be used on the storefront.") @doc(description: "A code assigned to the website to identify it") + sort_order : Int @deprecated(reason: "The field should not be used on the storefront.") @doc(description: "The attribute to use for sorting websites") + default_group_id : String @deprecated(reason: "The field should not be used on the storefront.") @doc(description: "The default group ID that the website has") + is_default : Boolean @deprecated(reason: "The field should not be used on the storefront.") @doc(description: "Specifies if this is the default website") } type StoreConfig @doc(description: "The type contains information about a store config") { diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Bundle/BundleProductViewTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Bundle/BundleProductViewTest.php index 5d08078cf7646..e7d939bc76c37 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Bundle/BundleProductViewTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Bundle/BundleProductViewTest.php @@ -10,7 +10,6 @@ use Magento\Bundle\Model\Product\OptionList; use Magento\Catalog\Api\Data\ProductInterface; use Magento\Catalog\Api\ProductRepositoryInterface; -use Magento\Framework\EntityManager\MetadataPool; use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\TestFramework\ObjectManager; use Magento\TestFramework\TestCase\GraphQlAbstract; @@ -83,12 +82,7 @@ public function testAllFieldsBundleProducts() /** @var ProductRepositoryInterface $productRepository */ $productRepository = ObjectManager::getInstance()->get(ProductRepositoryInterface::class); - /** @var MetadataPool $metadataPool */ - $metadataPool = ObjectManager::getInstance()->get(MetadataPool::class); $bundleProduct = $productRepository->get($productSku, false, null, true); - $bundleProduct->setId( - $bundleProduct->getData($metadataPool->getMetadata(ProductInterface::class)->getLinkField()) - ); if ((bool)$bundleProduct->getShipmentType()) { $this->assertEquals('SEPARATELY', $response['products']['items'][0]['ship_bundle_items']); } else { @@ -182,12 +176,7 @@ public function testBundleProductWithNotVisibleChildren() /** @var ProductRepositoryInterface $productRepository */ $productRepository = ObjectManager::getInstance()->get(ProductRepositoryInterface::class); - /** @var MetadataPool $metadataPool */ - $metadataPool = ObjectManager::getInstance()->get(MetadataPool::class); $bundleProduct = $productRepository->get($productSku, false, null, true); - $bundleProduct->setId( - $bundleProduct->getData($metadataPool->getMetadata(ProductInterface::class)->getLinkField()) - ); if ((bool)$bundleProduct->getShipmentType()) { $this->assertEquals('SEPARATELY', $response['products']['items'][0]['ship_bundle_items']); } else { @@ -238,7 +227,6 @@ private function assertBundleProductOptions($product, $actualResponse) $actualResponse['items'], "Precondition failed: 'bundle product items' must not be empty" ); - $metadataPool = ObjectManager::getInstance()->get(MetadataPool::class); /** @var OptionList $optionList */ $optionList = ObjectManager::getInstance()->get(\Magento\Bundle\Model\Product\OptionList::class); $options = $optionList->getItems($product); @@ -249,10 +237,6 @@ private function assertBundleProductOptions($product, $actualResponse) $childProductSku = $bundleProductLink->getSku(); $productRepository = ObjectManager::getInstance()->get(ProductRepositoryInterface::class); $childProduct = $productRepository->get($childProductSku); - /** @var MetadataPool $metadataPool */ - $childProduct->setId( - $childProduct->getData($metadataPool->getMetadata(ProductInterface::class)->getLinkField()) - ); $this->assertEquals(1, count($options)); $this->assertResponseFields( $actualResponse['items'][0], diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductViewTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductViewTest.php index 3ade1a0ef17d0..9d6a5e6d414e0 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductViewTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductViewTest.php @@ -13,7 +13,6 @@ use Magento\Catalog\Api\ProductRepositoryInterface; use Magento\Catalog\Model\Category; use Magento\Framework\DataObject; -use Magento\Framework\EntityManager\MetadataPool; use Magento\TestFramework\ObjectManager; use Magento\TestFramework\TestCase\GraphQlAbstract; @@ -270,11 +269,6 @@ public function testQueryAllFieldsSimpleProduct() /** @var ProductRepositoryInterface $productRepository */ $productRepository = ObjectManager::getInstance()->get(ProductRepositoryInterface::class); $product = $productRepository->get($productSku, false, null, true); - /** @var MetadataPool $metadataPool */ - $metadataPool = ObjectManager::getInstance()->get(MetadataPool::class); - $product->setId( - $product->getData($metadataPool->getMetadata(ProductInterface::class)->getLinkField()) - ); $this->assertArrayHasKey('products', $response); $this->assertArrayHasKey('items', $response['products']); $this->assertEquals(1, count($response['products']['items'])); @@ -656,15 +650,7 @@ public function testProductPrices() */ $productRepository = ObjectManager::getInstance()->get(ProductRepositoryInterface::class); $firstProduct = $productRepository->get($firstProductSku, false, null, true); - /** @var MetadataPool $metadataPool */ - $metadataPool = ObjectManager::getInstance()->get(MetadataPool::class); - $firstProduct->setId( - $firstProduct->getData($metadataPool->getMetadata(ProductInterface::class)->getLinkField()) - ); $secondProduct = $productRepository->get($secondProductSku, false, null, true); - $secondProduct->setId( - $secondProduct->getData($metadataPool->getMetadata(ProductInterface::class)->getLinkField()) - ); self::assertNotNull($response['products']['items'][0]['price'], "price must be not null"); self::assertCount(2, $response['products']['items']); $this->assertBaseFields($firstProduct, $response['products']['items'][0]); diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/VirtualProductViewTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/VirtualProductViewTest.php index 58b6d4f0e4ea2..80206b232585f 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/VirtualProductViewTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/VirtualProductViewTest.php @@ -9,7 +9,6 @@ use Magento\Catalog\Api\Data\ProductInterface; use Magento\Catalog\Api\ProductRepositoryInterface; -use Magento\Framework\EntityManager\MetadataPool; use Magento\TestFramework\ObjectManager; use Magento\TestFramework\TestCase\GraphQlAbstract; @@ -57,11 +56,6 @@ public function testQueryAllFieldsVirtualProduct() /** @var ProductRepositoryInterface $productRepository */ $productRepository = ObjectManager::getInstance()->get(ProductRepositoryInterface::class); $product = $productRepository->get($productSku, false, null, true); - /** @var MetadataPool $metadataPool */ - $metadataPool = ObjectManager::getInstance()->get(MetadataPool::class); - $product->setId( - $product->getData($metadataPool->getMetadata(ProductInterface::class)->getLinkField()) - ); $this->assertArrayHasKey('products', $response); $this->assertArrayHasKey('items', $response['products']); $this->assertEquals(1, count($response['products']['items'])); diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/ConfigurableProductViewTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/ConfigurableProductViewTest.php index 4729cae92717d..4837e2c6ec98a 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/ConfigurableProductViewTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/ConfigurableProductViewTest.php @@ -243,7 +243,7 @@ private function assertBaseFields($product, $actualResponse) 'expected_value' => $product->getData( $metadataPool->getMetadata( ProductInterface::class - )->getLinkField() + )->getIdentifierField() ) ], ['response_field' => 'name', 'expected_value' => $product->getName()], diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Store/StoreValidatorTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Store/StoreValidatorTest.php new file mode 100644 index 0000000000000..3e5f868a21da5 --- /dev/null +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Store/StoreValidatorTest.php @@ -0,0 +1,56 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\GraphQl\Store; + +use Magento\TestFramework\TestCase\GraphQlAbstract; + +/** + * Test the GraphQL `Store` header validation + */ +class StoreValidatorTest extends GraphQlAbstract +{ + /** + * @param string $storeCode + * @param string $errorMessage + * + * @dataProvider dataProviderInvalidStore + * @magentoApiDataFixture Magento/Store/_files/inactive_store.php + */ + public function testInvalidStoreHeader(string $storeCode, string $errorMessage) + { + $query + = <<<QUERY +{ + storeConfig{ + code + } +} +QUERY; + $this->expectExceptionMessage($errorMessage); + $this->graphQlMutation($query, [], '', ['Store' => $storeCode]); + } + + /** + * Data provider with invalid store codes and expected error messages + * + * @return array + */ + public function dataProviderInvalidStore(): array + { + return [ + 'non_existing' => [ + 'non_existing', + 'Requested store is not found' + ], + 'inactive_store' => [ + 'inactive_store', + 'Requested store is not found' + ] + ]; + } +} diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Tax/ProductViewTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Tax/ProductViewTest.php index 1dc5a813de2b8..461b5673235dd 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Tax/ProductViewTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Tax/ProductViewTest.php @@ -9,7 +9,6 @@ use Magento\Catalog\Api\Data\ProductInterface; use Magento\Catalog\Api\ProductRepositoryInterface; -use Magento\Framework\EntityManager\MetadataPool; use Magento\TestFramework\ObjectManager; use Magento\TestFramework\TestCase\GraphQlAbstract; use Magento\Store\Model\StoreManagerInterface; @@ -208,11 +207,6 @@ public function testQueryAllFieldsSimpleProduct() /** @var \Magento\Catalog\Model\Product $product */ $product = $this->productRepository->get($productSku, false, null, true); - /** @var MetadataPool $metadataPool */ - $metadataPool = ObjectManager::getInstance()->get(MetadataPool::class); - $product->setId( - $product->getData($metadataPool->getMetadata(ProductInterface::class)->getLinkField()) - ); $this->assertArrayHasKey('products', $response); $this->assertArrayHasKey('items', $response['products']); $this->assertEquals(1, count($response['products']['items'])); diff --git a/dev/tests/integration/testsuite/Magento/Store/_files/inactive_store.php b/dev/tests/integration/testsuite/Magento/Store/_files/inactive_store.php new file mode 100644 index 0000000000000..bcd170bf3c2d7 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Store/_files/inactive_store.php @@ -0,0 +1,34 @@ +<?php +/** + * Create store fixture + * + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +/** @var \Magento\Store\Model\Store $store */ +$store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Store\Model\Store::class); +if (!$store->load('inactive_store', 'code')->getId()) { + $websiteId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + \Magento\Store\Model\StoreManagerInterface::class + )->getWebsite() + ->getId(); + $groupId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + \Magento\Store\Model\StoreManagerInterface::class + )->getWebsite()->getDefaultGroupId(); + $store->setCode( + 'inactive_store' + )->setWebsiteId( + $websiteId + )->setGroupId( + $groupId + )->setName( + 'Inactive Store' + )->setSortOrder( + 15 + )->setIsActive( + 0 + ); + $store->save(); +} diff --git a/dev/tests/integration/testsuite/Magento/Store/_files/inactive_store_rollback.php b/dev/tests/integration/testsuite/Magento/Store/_files/inactive_store_rollback.php new file mode 100644 index 0000000000000..4b03d2b0d5fde --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Store/_files/inactive_store_rollback.php @@ -0,0 +1,24 @@ +<?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 Magento\Store\Model\Store $store */ +$store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Store\Model\Store::class); +$store->load('inactive_store'); + +if ($store->getId()) { + $store->delete(); +} + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); From 51053121809197e7ed604af6c17057ecf7ff9ce5 Mon Sep 17 00:00:00 2001 From: Oleksandr Gorkun <ogorkun@magento.com> Date: Thu, 2 Jan 2020 18:18:36 -0600 Subject: [PATCH 0629/1143] MC-29565: [2.4.x] Remove 'getSessionIdQueryParam()' calls --- app/code/Magento/Customer/Model/Session.php | 14 ++-- .../Customer/Test/Unit/Model/SessionTest.php | 4 +- .../Store/Controller/Store/Redirect.php | 36 ++-------- app/code/Magento/Store/Model/Store.php | 8 +-- .../Magento/Customer/Model/SessionTest.php | 31 ++++++++ .../Framework/Session/SessionManagerTest.php | 22 +++--- .../testsuite/Magento/Framework/UrlTest.php | 7 +- .../View/Element/AbstractBlockTest.php | 70 +++++++++++++++---- .../Store/Controller/Store/RedirectTest.php | 40 +++++++++++ .../Magento/Store/Model/StoreTest.php | 22 +++++- .../Magento/Framework/Session/SidResolver.php | 30 ++------ .../Magento/Framework/Test/Unit/UrlTest.php | 38 +++++----- lib/internal/Magento/Framework/Url.php | 27 ++----- .../Framework/View/Element/AbstractBlock.php | 19 +---- 14 files changed, 206 insertions(+), 162 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Store/Controller/Store/RedirectTest.php diff --git a/app/code/Magento/Customer/Model/Session.php b/app/code/Magento/Customer/Model/Session.php index e9dc7700ec090..77fc626316f18 100644 --- a/app/code/Magento/Customer/Model/Session.php +++ b/app/code/Magento/Customer/Model/Session.php @@ -108,6 +108,11 @@ class Session extends \Magento\Framework\Session\SessionManager */ protected $response; + /** + * @var AccountConfirmation + */ + private $accountConfirmation; + /** * Session constructor. * @@ -511,13 +516,6 @@ public function authenticate($loginUrl = null) $this->response->setRedirect($loginUrl); } else { $arguments = $this->_customerUrl->getLoginUrlParams(); - if ($this->_createUrl()->getUseSession()) { - $arguments += [ - '_query' => [ - $this->sidResolver->getSessionIdQueryParam($this->_session) => $this->_session->getSessionId(), - ] - ]; - } $this->response->setRedirect( $this->_createUrl()->getUrl(\Magento\Customer\Model\Url::ROUTE_ACCOUNT_LOGIN, $arguments) ); @@ -535,8 +533,6 @@ public function authenticate($loginUrl = null) */ protected function _setAuthUrl($key, $url) { - $url = $this->_coreUrl->removeRequestParam($url, $this->sidResolver->getSessionIdQueryParam($this)); - // Add correct session ID to URL if needed $url = $this->_createUrl()->getRebuiltUrl($url); return $this->storage->setData($key, $url); } diff --git a/app/code/Magento/Customer/Test/Unit/Model/SessionTest.php b/app/code/Magento/Customer/Test/Unit/Model/SessionTest.php index 8565790990df1..a1733b233ea66 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/SessionTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/SessionTest.php @@ -147,10 +147,10 @@ public function testAuthenticate() $urlMock->expects($this->once()) ->method('getRebuiltUrl') ->willReturn(''); - $this->urlFactoryMock->expects($this->exactly(4)) + $this->urlFactoryMock->expects($this->exactly(3)) ->method('create') ->willReturn($urlMock); - $urlMock->expects($this->once()) + $urlMock->expects($this->never()) ->method('getUseSession') ->willReturn(false); diff --git a/app/code/Magento/Store/Controller/Store/Redirect.php b/app/code/Magento/Store/Controller/Store/Redirect.php index 5d61275e72a28..8f63a43f5db7c 100644 --- a/app/code/Magento/Store/Controller/Store/Redirect.php +++ b/app/code/Magento/Store/Controller/Store/Redirect.php @@ -11,11 +11,7 @@ use Magento\Framework\App\Action\Context; use Magento\Framework\App\Action\HttpGetActionInterface; use Magento\Framework\App\Action\HttpPostActionInterface; -use Magento\Framework\App\ResponseInterface; -use Magento\Framework\Controller\ResultInterface; use Magento\Framework\Exception\NoSuchEntityException; -use Magento\Framework\Session\Generic as Session; -use Magento\Framework\Session\SidResolverInterface; use Magento\Store\Api\StoreRepositoryInterface; use Magento\Store\Api\StoreResolverInterface; use Magento\Store\Model\Store; @@ -23,7 +19,7 @@ use Magento\Store\Model\StoreSwitcher\HashGenerator; /** - * Builds correct url to target store and performs redirect. + * Builds correct url to target store (group) and performs redirect. */ class Redirect extends Action implements HttpGetActionInterface, HttpPostActionInterface { @@ -37,16 +33,6 @@ class Redirect extends Action implements HttpGetActionInterface, HttpPostActionI */ private $storeResolver; - /** - * @var SidResolverInterface - */ - private $sidResolver; - - /** - * @var Session - */ - private $session; - /** * @var HashGenerator */ @@ -56,30 +42,28 @@ class Redirect extends Action implements HttpGetActionInterface, HttpPostActionI * @param Context $context * @param StoreRepositoryInterface $storeRepository * @param StoreResolverInterface $storeResolver - * @param Session $session - * @param SidResolverInterface $sidResolver + * @param \Magento\Framework\Session\Generic $session + * @param \Magento\Framework\Session\SidResolverInterface $sidResolver * @param HashGenerator $hashGenerator + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function __construct( Context $context, StoreRepositoryInterface $storeRepository, StoreResolverInterface $storeResolver, - Session $session, - SidResolverInterface $sidResolver, + \Magento\Framework\Session\Generic $session, + \Magento\Framework\Session\SidResolverInterface $sidResolver, HashGenerator $hashGenerator ) { parent::__construct($context); $this->storeRepository = $storeRepository; $this->storeResolver = $storeResolver; - $this->session = $session; - $this->sidResolver = $sidResolver; $this->hashGenerator = $hashGenerator; } /** - * Performs store redirect + * @inheritDoc * - * @return ResponseInterface|ResultInterface * @throws NoSuchEntityException */ public function execute() @@ -113,12 +97,6 @@ public function execute() \Magento\Framework\App\ActionInterface::PARAM_NAME_URL_ENCODED => $encodedUrl, ]; - if ($this->sidResolver->getUseSessionInUrl()) { - // allow customers to stay logged in during store switching - $sidName = $this->sidResolver->getSessionIdQueryParam($this->session); - $query[$sidName] = $this->session->getSessionId(); - } - $customerHash = $this->hashGenerator->generateHash($fromStore); $query = array_merge($query, $customerHash); diff --git a/app/code/Magento/Store/Model/Store.php b/app/code/Magento/Store/Model/Store.php index 5eda6f4a9b57d..68df88622d095 100644 --- a/app/code/Magento/Store/Model/Store.php +++ b/app/code/Magento/Store/Model/Store.php @@ -278,6 +278,7 @@ class Store extends AbstractExtensibleModel implements /** * @var \Magento\Framework\Session\SidResolverInterface + * @deprecated Not used anymore. */ protected $_sidResolver; @@ -1199,7 +1200,6 @@ public function isDefault() */ public function getCurrentUrl($fromStore = true) { - $sidQueryParam = $this->_sidResolver->getSessionIdQueryParam($this->_getSession()); $requestString = $this->_url->escape(ltrim($this->_request->getRequestString(), '/')); $storeUrl = $this->getUrl('', ['_secure' => $this->_storeManager->getStore()->isCurrentlySecure()]); @@ -1218,12 +1218,6 @@ public function getCurrentUrl($fromStore = true) } $currQuery = $this->_request->getQueryValue(); - if (isset($currQuery[$sidQueryParam]) - && !empty($currQuery[$sidQueryParam]) - && $this->_getSession()->getSessionIdForHost($storeUrl) != $currQuery[$sidQueryParam] - ) { - unset($currQuery[$sidQueryParam]); - } foreach ($currQuery as $key => $value) { $storeParsedQuery[$key] = $value; diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/SessionTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/SessionTest.php index 9497e93dd47b2..4b6d3e3019dc1 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Model/SessionTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Model/SessionTest.php @@ -6,9 +6,12 @@ namespace Magento\Customer\Model; use Magento\Framework\App\PageCache\FormKey; +use Magento\Framework\App\ResponseInterface; +use Magento\Framework\Session\SidResolverInterface; use Magento\Framework\Stdlib\Cookie\CookieMetadataFactory; use Magento\Framework\Stdlib\Cookie\PublicCookieMetadata; use Magento\TestFramework\Helper\Bootstrap; +use Magento\Framework\App\Response\Http as HttpResponse; /** * @magentoDataFixture Magento/Customer/_files/customer.php @@ -29,6 +32,11 @@ class SessionTest extends \PHPUnit\Framework\TestCase /** @var PublicCookieMetadata $cookieMetadata */ protected $cookieMetadata; + /** + * @var HttpResponse + */ + private $response; + protected function setUp() { $this->_customerSession = Bootstrap::getObjectManager()->create( @@ -48,6 +56,7 @@ protected function setUp() 'form_key', $this->cookieMetadata ); + $this->response = Bootstrap::getObjectManager()->get(ResponseInterface::class); } public function testLoginById() @@ -100,4 +109,26 @@ public function testLogoutActionFlushesFormKey() $this->assertNotEquals($beforeKey, $afterKey); } + + /** + * Check that SID is not used in redirects. + * + * @return void + * @magentoConfigFixture current_store web/session/use_frontend_sid 1 + */ + public function testNoSid(): void + { + $this->_customerSession->authenticate(); + $location = (string)$this->response->getHeader('Location'); + $this->assertNotEmpty($location); + $this->assertNotContains(SidResolverInterface::SESSION_ID_QUERY_PARAM .'=', $location); + $beforeAuthUrl = $this->_customerSession->getData('before_auth_url'); + $this->assertNotEmpty($beforeAuthUrl); + $this->assertNotContains(SidResolverInterface::SESSION_ID_QUERY_PARAM .'=', $beforeAuthUrl); + + $this->_customerSession->authenticate('/customer/account'); + $location = (string)$this->response->getHeader('Location'); + $this->assertNotEmpty($location); + $this->assertNotContains(SidResolverInterface::SESSION_ID_QUERY_PARAM .'=', $location); + } } diff --git a/dev/tests/integration/testsuite/Magento/Framework/Session/SessionManagerTest.php b/dev/tests/integration/testsuite/Magento/Framework/Session/SessionManagerTest.php index 3205c19445ee1..482a3c9cbd619 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Session/SessionManagerTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Session/SessionManagerTest.php @@ -52,7 +52,7 @@ function ini_set($varName, $newValue) SessionManagerTest::$isIniSetInvoked[$varName] = $newValue; return true; } - return call_user_func_array('\ini_set', func_get_args()); + return call_user_func_array('\ini_set', [$varName, $newValue]); } /** @@ -213,15 +213,16 @@ public function testDestroy() public function testSetSessionId() { $this->initializeModel(); - $sessionId = $this->model->getSessionId(); - $this->appState->expects($this->atLeastOnce()) + $this->assertNotEmpty($this->model->getSessionId()); + $this->appState->expects($this->any()) ->method('getAreaCode') ->willReturn(\Magento\Framework\App\Area::AREA_FRONTEND); - $this->model->setSessionId($this->sidResolver->getSid($this->model)); - $this->assertEquals($sessionId, $this->model->getSessionId()); $this->model->setSessionId('test'); $this->assertEquals('test', $this->model->getSessionId()); + /* Use not valid identifier */ + $this->model->setSessionId('test_id'); + $this->assertEquals('test', $this->model->getSessionId()); } /** @@ -230,17 +231,14 @@ public function testSetSessionId() public function testSetSessionIdFromParam() { $this->initializeModel(); - $this->appState->expects($this->atLeastOnce()) + $this->appState->expects($this->any()) ->method('getAreaCode') ->willReturn(\Magento\Framework\App\Area::AREA_FRONTEND); + $currentId = $this->model->getSessionId(); $this->assertNotEquals('test_id', $this->model->getSessionId()); - $this->request->getQuery()->set($this->sidResolver->getSessionIdQueryParam($this->model), 'test-id'); - $this->model->setSessionId($this->sidResolver->getSid($this->model)); - $this->assertEquals('test-id', $this->model->getSessionId()); - /* Use not valid identifier */ - $this->request->getQuery()->set($this->sidResolver->getSessionIdQueryParam($this->model), 'test_id'); + $this->request->getQuery()->set(SidResolverInterface::SESSION_ID_QUERY_PARAM, 'test-id'); $this->model->setSessionId($this->sidResolver->getSid($this->model)); - $this->assertEquals('test-id', $this->model->getSessionId()); + $this->assertEquals($currentId, $this->model->getSessionId()); } public function testGetSessionIdForHost() diff --git a/dev/tests/integration/testsuite/Magento/Framework/UrlTest.php b/dev/tests/integration/testsuite/Magento/Framework/UrlTest.php index db830d228201c..081857348d7da 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/UrlTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/UrlTest.php @@ -477,6 +477,8 @@ public function testGetDirectUrl() } /** + * Check that SID is removed from URL. + * * Note: isolation flushes the URL memory cache * @magentoAppIsolation enabled * @@ -485,11 +487,8 @@ public function testGetDirectUrl() */ public function testSessionUrlVar() { - $sessionId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - \Magento\Framework\Session\Generic::class - )->getSessionId(); $sessionUrl = $this->model->sessionUrlVar('<a href="http://example.com/?___SID=U">www.example.com</a>'); - $this->assertEquals('<a href="http://example.com/?SID=' . $sessionId . '">www.example.com</a>', $sessionUrl); + $this->assertEquals('<a href="http://example.com/">www.example.com</a>', $sessionUrl); } public function testUseSessionIdForUrl() diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Element/AbstractBlockTest.php b/dev/tests/integration/testsuite/Magento/Framework/View/Element/AbstractBlockTest.php index 5f0c7176bce7a..a398207c9e649 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/View/Element/AbstractBlockTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/View/Element/AbstractBlockTest.php @@ -5,15 +5,19 @@ */ namespace Magento\Framework\View\Element; -use Magento\Framework\View\Element\AbstractBlock; +use Magento\Framework\Math\Random; +use Magento\Framework\Session\SessionManagerInterface; +use Magento\Framework\Session\SidResolverInterface; +use Magento\TestFramework\Helper\Bootstrap; /** * @magentoAppIsolation enabled + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class AbstractBlockTest extends \PHPUnit\Framework\TestCase { /** - * @var \Magento\Framework\View\Element\AbstractBlock + * @var AbstractBlock */ protected $_block; @@ -24,22 +28,29 @@ class AbstractBlockTest extends \PHPUnit\Framework\TestCase protected static $_mocks = []; + /** + * @var SessionManagerInterface + */ + private $session; + protected function setUp() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(\Magento\Framework\App\State::class) - ->setAreaCode('frontend'); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - \Magento\Framework\View\DesignInterface::class - )->setDefaultDesignTheme(); + /** @var \Magento\Framework\App\State $state */ + $state = Bootstrap::getObjectManager()->get(\Magento\Framework\App\State::class); + $state->setAreaCode('frontend'); + /** @var \Magento\Framework\View\DesignInterface $design */ + $design = Bootstrap::getObjectManager()->get(\Magento\Framework\View\DesignInterface::class); + $design->setDefaultDesignTheme(); $this->_block = $this->getMockForAbstractClass( - \Magento\Framework\View\Element\AbstractBlock::class, + AbstractBlock::class, [ - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + Bootstrap::getObjectManager()->get( \Magento\Framework\View\Element\Context::class ), ['module_name' => 'Magento_Theme'] ] ); + $this->session = Bootstrap::getObjectManager()->get(SessionManagerInterface::class); } /** @@ -113,9 +124,9 @@ public function testSetGetNameInLayout() ); $layout->createBlock(\Magento\Framework\View\Element\Template::class, $name); $block = $layout->getBlock($name); - $this->assertInstanceOf(\Magento\Framework\View\Element\AbstractBlock::class, $block); + $this->assertInstanceOf(AbstractBlock::class, $block); $block->setNameInLayout($name); - $this->assertInstanceOf(\Magento\Framework\View\Element\AbstractBlock::class, $layout->getBlock($name)); + $this->assertInstanceOf(AbstractBlock::class, $layout->getBlock($name)); $this->assertEquals($name, $block->getNameInLayout()); $this->assertTrue($layout->hasElement($name)); $newName = 'new_name'; @@ -549,7 +560,7 @@ public function testGetCacheKeyInfo() public function testGetCacheKey() { $name = uniqid('block.'); - $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + $block = Bootstrap::getObjectManager()->get( \Magento\Framework\View\LayoutInterface::class )->createBlock( \Magento\Framework\View\Element\Text::class @@ -564,6 +575,35 @@ public function testGetCacheKey() $this->assertEquals(AbstractBlock::CACHE_KEY_PREFIX . 'key', $block->getCacheKey()); } + /** + * Check that SIDs inside blocks are not being replaced. + * + * @return void + * @magentoCache block_html enabled + */ + public function testNoSid(): void + { + $blockId = 'block-with-sid' .Random::getRandomNumber(1, 9999); + $block = $this->_createBlockWithLayout( + $blockId, + $blockId, + \Magento\Framework\View\Element\Text::class + ); + $outerId = 'block-outer' .Random::getRandomNumber(1, 9999); + $outer = $this->_createBlockWithLayout($outerId, $outerId); + $block->setText( + $text = 'Some text with ' .SidResolverInterface::SESSION_ID_QUERY_PARAM + .'=' .$this->session->getSessionId() + ); + $block->setData('cache_lifetime', 3600); + //Caching the block's content + $outer->getBlockHtml($blockId); + //New ID generated, must not be replace in block's content. + $this->session->regenerateId(); + $html = $outer->getBlockHtml($blockId); + $this->assertEquals($text, $html); + } + /** * Create <N> sample blocks * @@ -610,7 +650,7 @@ protected function _createSampleBlocks( protected function _createBlockWithLayout( $name = 'block', $alias = null, - $type = \Magento\Framework\View\Element\AbstractBlock::class + $type = AbstractBlock::class ) { $typePart = explode('\\', $type); $mockClass = array_pop($typePart) . 'Mock'; @@ -618,7 +658,7 @@ protected function _createBlockWithLayout( self::$_mocks[$mockClass] = $this->getMockForAbstractClass( $type, [ - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + Bootstrap::getObjectManager()->get( \Magento\Framework\View\Element\Context::class ), ['module_name' => 'Magento_Theme'] @@ -627,7 +667,7 @@ protected function _createBlockWithLayout( ); } if ($this->_layout === null) { - $this->_layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + $this->_layout = Bootstrap::getObjectManager()->get( \Magento\Framework\View\LayoutInterface::class ); } diff --git a/dev/tests/integration/testsuite/Magento/Store/Controller/Store/RedirectTest.php b/dev/tests/integration/testsuite/Magento/Store/Controller/Store/RedirectTest.php new file mode 100644 index 0000000000000..df45846dfc832 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Store/Controller/Store/RedirectTest.php @@ -0,0 +1,40 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Store\Controller\Store; + +use Magento\Framework\Session\SidResolverInterface; +use Magento\Store\Model\StoreResolver; +use Magento\TestFramework\TestCase\AbstractController; + +/** + * Test Redirect controller. + * + * @magentoAppArea frontend + */ +class RedirectTest extends AbstractController +{ + /** + * Check that there's no SID in redirect URL. + * + * @return void + * @magentoDataFixture Magento/Store/_files/store.php + * @magentoDataFixture Magento/Store/_files/second_store.php + * @magentoConfigFixture current_store web/session/use_frontend_sid 1 + */ + public function testNoSid(): void + { + $this->getRequest()->setParam(StoreResolver::PARAM_NAME, 'fixture_second_store'); + $this->getRequest()->setParam('___from_store', 'test'); + + $this->dispatch('/stores/store/redirect'); + + $result = (string)$this->getResponse()->getHeader('location'); + $this->assertNotEmpty($result); + $this->assertNotContains(SidResolverInterface::SESSION_ID_QUERY_PARAM .'=', $result); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php b/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php index 00de5544d8fb7..623335f7a30d7 100644 --- a/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php +++ b/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php @@ -9,9 +9,12 @@ use Magento\Catalog\Model\ProductRepository; use Magento\Framework\App\Bootstrap; use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\App\RequestInterface; +use Magento\Framework\Session\SidResolverInterface; use Magento\Framework\UrlInterface; use Magento\Store\Api\StoreRepositoryInterface; use Zend\Stdlib\Parameters; +use Magento\Framework\App\Request\Http as HttpRequest; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -29,6 +32,11 @@ class StoreTest extends \PHPUnit\Framework\TestCase */ protected $model; + /** + * @var HttpRequest + */ + private $request; + protected function setUp() { $this->model = $this->_getStoreModel(); @@ -40,6 +48,7 @@ protected function setUp() protected function _getStoreModel() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->request = $objectManager->get(RequestInterface::class); $this->modelParams = [ 'context' => $objectManager->get(\Magento\Framework\Model\Context::class), 'registry' => $objectManager->get(\Magento\Framework\Registry::class), @@ -49,7 +58,7 @@ protected function _getStoreModel() 'coreFileStorageDatabase' => $objectManager->get(\Magento\MediaStorage\Helper\File\Storage\Database::class), 'configCacheType' => $objectManager->get(\Magento\Framework\App\Cache\Type\Config::class), 'url' => $objectManager->get(\Magento\Framework\Url::class), - 'request' => $objectManager->get(\Magento\Framework\App\RequestInterface::class), + 'request' => $this->request, 'configDataResource' => $objectManager->get(\Magento\Config\Model\ResourceModel\Config\Data::class), 'filesystem' => $objectManager->get(\Magento\Framework\Filesystem::class), 'config' => $objectManager->get(\Magento\Framework\App\Config\ReinitableConfigInterface::class), @@ -292,6 +301,13 @@ public function testGetCurrentUrl() $this->assertStringEndsWith('default', $this->model->getCurrentUrl()); $this->assertStringEndsNotWith('default', $this->model->getCurrentUrl(false)); + $this->model + ->expects($this->any())->method('getUrl') + ->willReturn('http://localhost/index.php?' .SidResolverInterface::SESSION_ID_QUERY_PARAM .'=12345'); + $this->request->setParams([SidResolverInterface::SESSION_ID_QUERY_PARAM, '12345']); + $this->request->setQueryValue(SidResolverInterface::SESSION_ID_QUERY_PARAM, '12345'); + $this->assertContains(SidResolverInterface::SESSION_ID_QUERY_PARAM .'=12345', $this->model->getCurrentUrl()); + /** @var \Magento\Store\Model\Store $secondStore */ $secondStore = $objectManager->get(StoreRepositoryInterface::class)->get('secondstore'); @@ -306,11 +322,11 @@ public function testGetCurrentUrl() $url ); $this->assertEquals( - $secondStore->getBaseUrl() . '?___from_store=default', + $secondStore->getBaseUrl() . '?SID=12345&___from_store=default', $secondStore->getCurrentUrl() ); $this->assertEquals( - $secondStore->getBaseUrl(), + $secondStore->getBaseUrl() . '?SID=12345', $secondStore->getCurrentUrl(false) ); } diff --git a/lib/internal/Magento/Framework/Session/SidResolver.php b/lib/internal/Magento/Framework/Session/SidResolver.php index 041995d20fcd2..fd7af781981a9 100644 --- a/lib/internal/Magento/Framework/Session/SidResolver.php +++ b/lib/internal/Magento/Framework/Session/SidResolver.php @@ -10,7 +10,8 @@ use Magento\Framework\App\State; /** - * Class SidResolver + * Resolves SID by processing request parameters. + * * @deprecated 2.3.3 SIDs in URLs are no longer used */ class SidResolver implements SidResolverInterface @@ -27,11 +28,13 @@ class SidResolver implements SidResolverInterface /** * @var \Magento\Framework\UrlInterface + * @deprecated Not used anymore. */ protected $urlBuilder; /** * @var \Magento\Framework\App\RequestInterface + * @deprecated Not used anymore. */ protected $request; @@ -60,11 +63,6 @@ class SidResolver implements SidResolverInterface */ protected $_scopeType; - /** - * @var State - */ - private $appState; - /** * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Framework\UrlInterface $urlBuilder @@ -72,6 +70,7 @@ class SidResolver implements SidResolverInterface * @param string $scopeType * @param array $sidNameMap * @param State|null $appState + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function __construct( \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, @@ -86,34 +85,19 @@ public function __construct( $this->request = $request; $this->sidNameMap = $sidNameMap; $this->_scopeType = $scopeType; - $this->appState = $appState ?: \Magento\Framework\App\ObjectManager::getInstance()->get(State::class); } /** * Get Sid * * @param SessionManagerInterface $session - * * @return string|null * @throws \Magento\Framework\Exception\LocalizedException + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function getSid(SessionManagerInterface $session) { - if ($this->appState->getAreaCode() !== \Magento\Framework\App\Area::AREA_FRONTEND) { - return null; - } - - $sidKey = null; - - $useSidOnFrontend = $this->getUseSessionInUrl(); - if ($useSidOnFrontend && $this->request->getQuery( - $this->getSessionIdQueryParam($session), - false - ) && $this->urlBuilder->isOwnOriginUrl() - ) { - $sidKey = $this->request->getQuery($this->getSessionIdQueryParam($session)); - } - return $sidKey; + return null; } /** diff --git a/lib/internal/Magento/Framework/Test/Unit/UrlTest.php b/lib/internal/Magento/Framework/Test/Unit/UrlTest.php index 046a9d63fc8f4..9c063505a1349 100644 --- a/lib/internal/Magento/Framework/Test/Unit/UrlTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/UrlTest.php @@ -108,7 +108,7 @@ protected function getRouteParamsResolverFactory($resolve = true) { $routeParamsResolverFactoryMock = $this->createMock(\Magento\Framework\Url\RouteParamsResolverFactory::class); if ($resolve) { - $routeParamsResolverFactoryMock->expects($this->once())->method('create') + $routeParamsResolverFactoryMock->expects($this->any())->method('create') ->will($this->returnValue($this->routeParamsResolverMock)); } return $routeParamsResolverFactoryMock; @@ -467,10 +467,10 @@ public function testGetRedirectUrl() ] ); - $this->sidResolverMock->expects($this->once())->method('getUseSessionInUrl')->will($this->returnValue(true)); - $this->sessionMock->expects($this->once())->method('getSessionIdForHost')->will($this->returnValue(false)); - $this->sidResolverMock->expects($this->once())->method('getUseSessionVar')->will($this->returnValue(true)); - $this->routeParamsResolverMock->expects($this->once())->method('hasData')->with('secure_is_forced') + $this->sidResolverMock->expects($this->any())->method('getUseSessionInUrl')->will($this->returnValue(true)); + $this->sessionMock->expects($this->any())->method('getSessionIdForHost')->will($this->returnValue(false)); + $this->sidResolverMock->expects($this->any())->method('getUseSessionVar')->will($this->returnValue(true)); + $this->routeParamsResolverMock->expects($this->any())->method('hasData')->with('secure_is_forced') ->will($this->returnValue(true)); $this->sidResolverMock->expects($this->never())->method('getSessionIdQueryParam'); $this->queryParamsResolverMock->expects($this->once()) @@ -491,11 +491,11 @@ public function testGetRedirectUrlWithSessionId() ] ); - $this->sidResolverMock->expects($this->once())->method('getUseSessionInUrl')->will($this->returnValue(true)); - $this->sessionMock->expects($this->once())->method('getSessionIdForHost') + $this->sidResolverMock->expects($this->never())->method('getUseSessionInUrl')->will($this->returnValue(true)); + $this->sessionMock->expects($this->never())->method('getSessionIdForHost') ->will($this->returnValue('session-id')); - $this->sidResolverMock->expects($this->once())->method('getUseSessionVar')->will($this->returnValue(false)); - $this->sidResolverMock->expects($this->once())->method('getSessionIdQueryParam'); + $this->sidResolverMock->expects($this->never())->method('getUseSessionVar')->will($this->returnValue(false)); + $this->sidResolverMock->expects($this->never())->method('getSessionIdQueryParam'); $this->queryParamsResolverMock->expects($this->once()) ->method('getQuery') ->will($this->returnValue('foo=bar')); @@ -540,10 +540,10 @@ public function testAddSessionParam() 'queryParamsResolver' => $this->queryParamsResolverMock, ]); - $this->sidResolverMock->expects($this->once())->method('getSessionIdQueryParam')->with($this->sessionMock) + $this->sidResolverMock->expects($this->never())->method('getSessionIdQueryParam')->with($this->sessionMock) ->will($this->returnValue('sid')); - $this->sessionMock->expects($this->once())->method('getSessionId')->will($this->returnValue('session-id')); - $this->queryParamsResolverMock->expects($this->once())->method('setQueryParam')->with('sid', 'session-id'); + $this->sessionMock->expects($this->never())->method('getSessionId')->will($this->returnValue('session-id')); + $this->queryParamsResolverMock->expects($this->never())->method('setQueryParam')->with('sid', 'session-id'); $model->addSessionParam(); } @@ -681,10 +681,10 @@ public function testSessionUrlVarWithMatchedHostsAndBaseUrl($html, $result) ] ); - $requestMock->expects($this->once()) + $requestMock->expects($this->any()) ->method('getHttpHost') ->will($this->returnValue('localhost')); - $this->scopeMock->expects($this->once()) + $this->scopeMock->expects($this->any()) ->method('getBaseUrl') ->will($this->returnValue('http://localhost')); $this->scopeResolverMock->expects($this->any()) @@ -709,20 +709,20 @@ public function testSessionUrlVarWithoutMatchedHostsAndBaseUrl() ] ); - $requestMock->expects($this->once())->method('getHttpHost')->will($this->returnValue('localhost')); - $this->scopeMock->expects($this->once()) + $requestMock->expects($this->never())->method('getHttpHost')->will($this->returnValue('localhost')); + $this->scopeMock->expects($this->any()) ->method('getBaseUrl') ->will($this->returnValue('http://example.com')); $this->scopeResolverMock->expects($this->any()) ->method('getScope') ->will($this->returnValue($this->scopeMock)); - $this->sidResolverMock->expects($this->once())->method('getSessionIdQueryParam') + $this->sidResolverMock->expects($this->never())->method('getSessionIdQueryParam') ->will($this->returnValue('SID')); - $this->sessionMock->expects($this->once())->method('getSessionId') + $this->sessionMock->expects($this->never())->method('getSessionId') ->will($this->returnValue('session-id')); $this->assertEquals( - '<a href="http://example.com/?SID=session-id">www.example.com</a>', + '<a href="http://example.com/">www.example.com</a>', $model->sessionUrlVar('<a href="http://example.com/?___SID=U">www.example.com</a>') ); } diff --git a/lib/internal/Magento/Framework/Url.php b/lib/internal/Magento/Framework/Url.php index c67a20f0a157d..83f5704e16486 100644 --- a/lib/internal/Magento/Framework/Url.php +++ b/lib/internal/Magento/Framework/Url.php @@ -763,10 +763,6 @@ public function getRouteUrl($routePath = null, $routeParams = null) */ public function addSessionParam() { - $this->setQueryParam( - $this->_sidResolver->getSessionIdQueryParam($this->_session), - $this->_session->getSessionId() - ); return $this; } @@ -972,18 +968,10 @@ private function createUrl($routePath = null, array $routeParams = null) * @param string $url * * @return \Magento\Framework\UrlInterface + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ protected function _prepareSessionUrl($url) { - if (!$this->getUseSession()) { - return $this; - } - $sessionId = $this->_session->getSessionIdForHost($url); - if ($this->_sidResolver->getUseSessionVar() && !$sessionId) { - $this->setQueryParam('___SID', $this->_isSecure() ? 'S' : 'U'); - } elseif ($sessionId) { - $this->setQueryParam($this->_sidResolver->getSessionIdQueryParam($this->_session), $sessionId); - } return $this; } @@ -1067,15 +1055,10 @@ public function sessionUrlVar($html) */ // @codingStandardsIgnoreEnd function ($match) { - if ($this->useSessionIdForUrl($match[2] == 'S')) { - return $match[1] . $this->_sidResolver->getSessionIdQueryParam($this->_session) . '=' - . $this->_session->getSessionId() . (isset($match[3]) ? $match[3] : ''); - } else { - if ($match[1] == '?') { - return isset($match[3]) ? '?' : ''; - } elseif ($match[1] == '&' || $match[1] == '&') { - return $match[3] ?? ''; - } + if ($match[1] == '?') { + return isset($match[3]) ? '?' : ''; + } elseif ($match[1] == '&' || $match[1] == '&') { + return $match[3] ?? ''; } }, $html diff --git a/lib/internal/Magento/Framework/View/Element/AbstractBlock.php b/lib/internal/Magento/Framework/View/Element/AbstractBlock.php index a70b87b8099f6..e03e4e599bec8 100644 --- a/lib/internal/Magento/Framework/View/Element/AbstractBlock.php +++ b/lib/internal/Magento/Framework/View/Element/AbstractBlock.php @@ -55,6 +55,7 @@ abstract class AbstractBlock extends \Magento\Framework\DataObject implements Bl * SID Resolver * * @var \Magento\Framework\Session\SidResolverInterface + * @deprecated Not used anymore. */ protected $_sidResolver; @@ -1116,18 +1117,7 @@ protected function _loadCache() return $html; } $loadAction = function () { - $cacheKey = $this->getCacheKey(); - $cacheData = $this->_cache->load($cacheKey); - if ($cacheData) { - $cacheData = str_replace( - $this->_getSidPlaceholder($cacheKey), - $this->_sidResolver->getSessionIdQueryParam($this->_session) - . '=' - . $this->_session->getSessionId(), - $cacheData - ); - } - return $cacheData; + return $this->_cache->load($this->getCacheKey()); }; $saveAction = function ($data) { @@ -1157,11 +1147,6 @@ protected function _saveCache($data) return false; } $cacheKey = $this->getCacheKey(); - $data = str_replace( - $this->_sidResolver->getSessionIdQueryParam($this->_session) . '=' . $this->_session->getSessionId(), - $this->_getSidPlaceholder($cacheKey), - $data - ); $this->_cache->save($data, $cacheKey, array_unique($this->getCacheTags()), $this->getCacheLifetime()); return $this; From c8c31bccd12a851901274093bc05968fc05df9e9 Mon Sep 17 00:00:00 2001 From: Vaha <vaha@atwix.com> Date: Fri, 3 Jan 2020 08:46:52 +0200 Subject: [PATCH 0630/1143] #26240: added empty line before 'if' --- app/code/Magento/Swatches/view/base/web/js/swatch-renderer.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Swatches/view/base/web/js/swatch-renderer.js b/app/code/Magento/Swatches/view/base/web/js/swatch-renderer.js index 77c386c05323b..aa7b6c7a076ea 100644 --- a/app/code/Magento/Swatches/view/base/web/js/swatch-renderer.js +++ b/app/code/Magento/Swatches/view/base/web/js/swatch-renderer.js @@ -778,6 +778,7 @@ define([ */ _getSelectedOptionPriceIndex: function () { var allowedProduct = this._getAllowedProductWithMinPrice(this._CalcProducts()); + if (_.isEmpty(allowedProduct)) { return undefined; } From 6134b10749e71d861922ecfa899aaa0b9d60a658 Mon Sep 17 00:00:00 2001 From: OlgaVasyltsun <olga.vasyltsun@gmail.com> Date: Fri, 3 Jan 2020 09:23:17 +0200 Subject: [PATCH 0631/1143] MC-24169: Fix Skipped MFTF Tests From MC-17140: MC-5719, MC-10924 --- ...ontOpenOrderFromSuccessPageActionGroup.xml | 23 ++++++++ .../Section/CheckoutSuccessMainSection.xml | 1 + ...dminChangeAllCustomersGroupViaGridTest.xml | 22 ++++++++ ...inChangeSingleCustomerGroupViaGridTest.xml | 55 +++++++++++++++++++ .../Mftf/Test/ChangeCustomerGroupTest.xml | 9 ++- ...eateCreditMemoFromOrderPageActionGroup.xml | 22 ++++++++ .../Section/AdminCreditMemoTotalSection.xml | 2 +- 7 files changed, 130 insertions(+), 4 deletions(-) create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontOpenOrderFromSuccessPageActionGroup.xml create mode 100644 app/code/Magento/Customer/Test/Mftf/Test/AdminChangeAllCustomersGroupViaGridTest.xml create mode 100644 app/code/Magento/Customer/Test/Mftf/Test/AdminChangeSingleCustomerGroupViaGridTest.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminStartCreateCreditMemoFromOrderPageActionGroup.xml diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontOpenOrderFromSuccessPageActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontOpenOrderFromSuccessPageActionGroup.xml new file mode 100644 index 0000000000000..80c9ff0a45135 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontOpenOrderFromSuccessPageActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontOpenOrderFromSuccessPageActionGroup"> + <annotations> + <description>Click order number link from checkout success page and check order number on order view page.</description> + </annotations> + <arguments> + <argument name="orderNumber" defaultValue="000000001" type="string"/> + </arguments> + + <click selector="{{CheckoutSuccessMainSection.orderLinkByOrderNumber(orderNumber)}}" stepKey="clickOrderNumberLink"/> + <waitForPageLoad stepKey="waitForOrderPageIsLoaded"/> + <see userInput="Order # {{orderNumber}}" selector="{{StorefrontCustomerOrderViewSection.orderTitle}}" stepKey="assertOrderNumberIsCorrect"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutSuccessMainSection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutSuccessMainSection.xml index c486e13ecf58b..d15b89e58a550 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutSuccessMainSection.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutSuccessMainSection.xml @@ -20,5 +20,6 @@ <element name="createAnAccount" type="button" selector="[data-bind*="i18n: 'Create an Account'"]" timeout="30"/> <element name="printLink" type="button" selector=".print" timeout="30"/> <element name="orderNumberWithoutLink" type="text" selector="//div[contains(@class, 'checkout-success')]//p/span"/> + <element name="orderLinkByOrderNumber" type="text" selector="//div[contains(@class,'success')]//a[contains(.,'{{orderNumber}}')]" parameterized="true" timeout="30"/> </section> </sections> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminChangeAllCustomersGroupViaGridTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminChangeAllCustomersGroupViaGridTest.xml new file mode 100644 index 0000000000000..59c50f905878b --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminChangeAllCustomersGroupViaGridTest.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="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminChangeAllCustomersGroupViaGridTest" extends="AdminChangeSingleCustomerGroupViaGridTest"> + <annotations> + <title value="Change all customers' group via grid"/> + <description value="Select All customers to change their group"/> + <testCaseId value="MC-26040"/> + </annotations> + + <remove keyForRemoval="filterCustomer"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" before="selectCustomer" stepKey="clearFilters"/> + <actionGroup ref="AdminSelectAllCustomers" stepKey="selectCustomer"/> + </test> +</tests> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminChangeSingleCustomerGroupViaGridTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminChangeSingleCustomerGroupViaGridTest.xml new file mode 100644 index 0000000000000..2478334de3baf --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminChangeSingleCustomerGroupViaGridTest.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="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminChangeSingleCustomerGroupViaGridTest"> + <annotations> + <features value="Customer"/> + <title value="Change a single customer group via grid"/> + <description value="From the selection of All Customers select a single customer to change their group"/> + <severity value="MAJOR"/> + <testCaseId value="MC-26039"/> + <stories value="Customer Edit"/> + <group value="customer"/> + <group value="mtf_migrated"/> + </annotations> + + <before> + <createData entity="Simple_US_Customer" stepKey="createCustomer"/> + <createData entity="CustomerGroupChange" stepKey="createCustomerGroup"/> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <!--Delete created data--> + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> + <deleteData createDataKey="createCustomerGroup" stepKey="deleteCustomerGroup"/> + <actionGroup ref="NavigateToAllCustomerPage" stepKey="navigateToCustomersPage"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearCustomersGridFilter"/> + <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + </after> + + <actionGroup ref="NavigateToAllCustomerPage" stepKey="navigateToCustomersPage"/> + <actionGroup ref="AdminFilterCustomerGridByEmail" stepKey="filterCustomer"> + <argument name="email" value="$$createCustomer.email$$"/> + </actionGroup> + <actionGroup ref="AdminSelectCustomerByEmail" stepKey="selectCustomer"> + <argument name="customerEmail" value="$$createCustomer.email$$"/> + </actionGroup> + <actionGroup ref="SetCustomerGroupForSelectedCustomersViaGrid" stepKey="setCustomerGroup"> + <argument name="groupName" value="$$createCustomerGroup.code$$"/> + </actionGroup> + <actionGroup ref="AdminFilterCustomerGridByEmail" stepKey="filterCustomerAfterGroupChange"> + <argument name="email" value="$$createCustomer.email$$"/> + </actionGroup> + <actionGroup ref="VerifyCustomerGroupForCustomer" stepKey="verifyCustomerGroupSet"> + <argument name="customerEmail" value="$$createCustomer.email$$"/> + <argument name="groupName" value="$$createCustomerGroup.code$$"/> + </actionGroup> + </test> +</tests> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/ChangeCustomerGroupTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/ChangeCustomerGroupTest.xml index d9b71e1e6e9ba..7de52875d4341 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/ChangeCustomerGroupTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/ChangeCustomerGroupTest.xml @@ -10,13 +10,16 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="ChangingSingleCustomerGroupViaGrid"> <annotations> - <title value="Change a single customer group via grid"/> + <title value="DEPRECATED Change a single customer group via grid"/> <description value="From the selection of All Customers select a single customer to change their group"/> <severity value="MAJOR"/> <testCaseId value="MC-10921"/> <stories value="Change Customer Group"/> <group value="customer"/> <group value="mtf_migrated"/> + <skip> + <issueId value="DEPRECATED">Use AdminChangeSingleCustomerGroupViaGridTest instead</issueId> + </skip> </annotations> <before> @@ -60,7 +63,7 @@ <test name="ChangingAllCustomerGroupViaGrid" extends="ChangingSingleCustomerGroupViaGrid"> <annotations> - <title value="Change all customers' group via grid"/> + <title value="DEPRECATED Change all customers' group via grid"/> <description value="Select All customers to change their group"/> <severity value="MAJOR"/> <testCaseId value="MC-10924"/> @@ -68,7 +71,7 @@ <group value="customer"/> <group value="mtf_migrated"/> <skip> - <issueId value="MC-17140"/> + <issueId value="DEPRECATED">Use AdminChangeAllCustomersGroupViaGridTest instead</issueId> </skip> </annotations> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminStartCreateCreditMemoFromOrderPageActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminStartCreateCreditMemoFromOrderPageActionGroup.xml new file mode 100644 index 0000000000000..e10c438652d90 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminStartCreateCreditMemoFromOrderPageActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminStartCreateCreditMemoFromOrderPageActionGroup"> + <annotations> + <description>Start to create Credit Memo from order page</description> + </annotations> + <click selector="{{AdminOrderDetailsMainActionsSection.creditMemo}}" stepKey="clickCreditMemoButton"/> + <conditionalClick selector="{{AdminConfirmationModalSection.ok}}" dependentSelector="{{AdminConfirmationModalSection.ok}}" + visible="true" stepKey="acceptModal"/> + <waitForPageLoad time="30" stepKey="waitPageLoaded"/> + <seeInCurrentUrl url="{{AdminCreditMemoNewPage.url}}" stepKey="seeNewCreditMemoUrl"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Memo" stepKey="seeNewCreditMemoPageTitle"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/Section/AdminCreditMemoTotalSection.xml b/app/code/Magento/Sales/Test/Mftf/Section/AdminCreditMemoTotalSection.xml index 6b4bdf69361a5..10a10e77ea57c 100644 --- a/app/code/Magento/Sales/Test/Mftf/Section/AdminCreditMemoTotalSection.xml +++ b/app/code/Magento/Sales/Test/Mftf/Section/AdminCreditMemoTotalSection.xml @@ -18,7 +18,7 @@ <element name="appendComments" type="checkbox" selector=".order-totals-actions #notify_customer"/> <element name="emailCopy" type="checkbox" selector=".order-totals-actions #send_email"/> <element name="refundStoreCredit" type="checkbox" selector=".order-totals-actions .field-refund-store-credit input[type='checkbox']"/> - <element name="submitRefundOffline" type="button" selector=".order-totals-actions button[data-ui-id='order-items-submit-button']" timeout="30"/> + <element name="submitRefundOffline" type="button" selector=".order-totals-actions button[data-ui-id='order-items-submit-button']" timeout="60"/> <element name="creditMemoItem" type="text" selector="#sales_order_view_tabs_order_creditmemos"/> <element name="viewMemo" type="text" selector="div#sales_order_view_tabs_order_creditmemos_content a.action-menu-item"/> <element name="refundOffline" type="button" selector=".order-totals-actions button[data-ui-id='order-items-submit-offline']"/> From abc8006c02ca91f8dca41cb26fd515eaacd82593 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Fri, 3 Jan 2020 11:21:46 +0200 Subject: [PATCH 0632/1143] Cover changes with jasmnine test --- .../view/frontend/js/configurable.test.js | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/frontend/js/configurable.test.js diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/frontend/js/configurable.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/frontend/js/configurable.test.js new file mode 100644 index 0000000000000..daaf04002d71b --- /dev/null +++ b/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/frontend/js/configurable.test.js @@ -0,0 +1,38 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +define([ + 'jquery', + 'Magento_ConfigurableProduct/js/configurable' +], function ($, Configurable) { + 'use strict'; + + var widget; + + beforeEach(function () { + widget = new Configurable(); + widget.options = { + spConfig: { + attributes: + { + 'size': { + options: $('<div><p class="2"></p></div>') + } + } + }, + values: { + } + }; + }); + + describe('Magento_ConfigurableProduct/js/configurable', function () { + + it('check if attribute value is possible to be set as configurable option', function () { + expect($.mage.configurable).toBeDefined(); + widget._parseQueryParams('http://magento.com/product?color=red&size=2'); + expect(widget.options.values.size).toBe('2'); + }); + }); +}); From c6d6aaba1cc94f3d13101326ebbf011ec430ac37 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Fri, 3 Jan 2020 14:30:41 +0200 Subject: [PATCH 0633/1143] COver changes with unit test --- .../Unit/Model/Product/Type/GroupedTest.php | 165 +++++++++++++++--- 1 file changed, 138 insertions(+), 27 deletions(-) diff --git a/app/code/Magento/GroupedProduct/Test/Unit/Model/Product/Type/GroupedTest.php b/app/code/Magento/GroupedProduct/Test/Unit/Model/Product/Type/GroupedTest.php index e50d6491a6aca..3af5c1c726593 100644 --- a/app/code/Magento/GroupedProduct/Test/Unit/Model/Product/Type/GroupedTest.php +++ b/app/code/Magento/GroupedProduct/Test/Unit/Model/Product/Type/GroupedTest.php @@ -8,6 +8,8 @@ use Magento\GroupedProduct\Model\Product\Type\Grouped; /** + * Tests for Grouped product + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class GroupedTest extends \PHPUnit\Framework\TestCase @@ -42,6 +44,9 @@ class GroupedTest extends \PHPUnit\Framework\TestCase */ private $serializer; + /** + * @inheritdoc + */ protected function setUp() { $this->objectHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); @@ -74,12 +79,22 @@ protected function setUp() ); } - public function testHasWeightFalse() + /** + * Verify has weight is false + * + * @return void + */ + public function testHasWeightFalse(): void { $this->assertFalse($this->_model->hasWeight(), 'This product has weight, but it should not'); } - public function testGetChildrenIds() + /** + * Verify children ids. + * + * @return void + */ + public function testGetChildrenIds(): void { $parentId = 12345; $childrenIds = [100, 200, 300]; @@ -96,7 +111,12 @@ public function testGetChildrenIds() $this->assertEquals($childrenIds, $this->_model->getChildrenIds($parentId)); } - public function testGetParentIdsByChild() + /** + * Verify get parents by child products + * + * @return void + */ + public function testGetParentIdsByChild(): void { $childId = 12345; $parentIds = [100, 200, 300]; @@ -113,7 +133,12 @@ public function testGetParentIdsByChild() $this->assertEquals($parentIds, $this->_model->getParentIdsByChild($childId)); } - public function testGetAssociatedProducts() + /** + * Verify get associated products + * + * @return void + */ + public function testGetAssociatedProducts(): void { $cached = true; $associatedProducts = [5, 7, 11, 13, 17]; @@ -123,12 +148,14 @@ public function testGetAssociatedProducts() } /** + * Verify able to set status filter + * * @param int $status * @param array $filters * @param array $result * @dataProvider addStatusFilterDataProvider */ - public function testAddStatusFilter($status, $filters, $result) + public function testAddStatusFilter($status, $filters, $result): void { $this->product->expects($this->once())->method('getData')->will($this->returnValue($filters)); $this->product->expects($this->once())->method('setData')->with('_cache_instance_status_filters', $result); @@ -136,14 +163,21 @@ public function testAddStatusFilter($status, $filters, $result) } /** + * Data Provider for Status Filter + * * @return array */ - public function addStatusFilterDataProvider() + public function addStatusFilterDataProvider(): array { return [[1, [], [1]], [1, false, [1]]]; } - public function testSetSaleableStatus() + /** + * Verify able to set salable status + * + * @return void + */ + public function testSetSaleableStatus(): void { $key = '_cache_instance_status_filters'; $saleableIds = [300, 800, 500]; @@ -159,7 +193,12 @@ public function testSetSaleableStatus() $this->assertEquals($this->_model, $this->_model->setSaleableStatus($this->product)); } - public function testGetStatusFiltersNoData() + /** + * Verify status filter with no data. + * + * @return void + */ + public function testGetStatusFiltersNoData(): void { $result = [ \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED, @@ -169,7 +208,12 @@ public function testGetStatusFiltersNoData() $this->assertEquals($result, $this->_model->getStatusFilters($this->product)); } - public function testGetStatusFiltersWithData() + /** + * Verify status filter with data + * + * @return void + */ + public function testGetStatusFiltersWithData(): void { $result = [ \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED, @@ -180,7 +224,12 @@ public function testGetStatusFiltersWithData() $this->assertEquals($result, $this->_model->getStatusFilters($this->product)); } - public function testGetAssociatedProductIdsCached() + /** + * Verify AssociatedProducts Ids with cache + * + * @return void + */ + public function testGetAssociatedProductIdsCached(): void { $key = '_cache_instance_associated_product_ids'; $cachedData = [300, 303, 306]; @@ -192,7 +241,12 @@ public function testGetAssociatedProductIdsCached() $this->assertEquals($cachedData, $this->_model->getAssociatedProductIds($this->product)); } - public function testGetAssociatedProductIdsNonCached() + /** + * Verify AssociatedProducts Ids with no cached. + * + * @return void + */ + public function testGetAssociatedProductIdsNonCached(): void { $args = $this->objectHelper->getConstructArguments( \Magento\GroupedProduct\Model\Product\Type\Grouped::class, @@ -236,7 +290,12 @@ public function testGetAssociatedProductIdsNonCached() $this->assertEquals($associatedIds, $model->getAssociatedProductIds($this->product)); } - public function testGetAssociatedProductCollection() + /** + * Verify Associated Product collection + * + * @return void + */ + public function testGetAssociatedProductCollection(): void { $link = $this->createPartialMock( \Magento\Catalog\Model\Product\Link::class, @@ -261,6 +320,8 @@ public function testGetAssociatedProductCollection() } /** + * Verify Proccess buy request + * * @param array $superGroup * @param array $result * @dataProvider processBuyRequestDataProvider @@ -274,9 +335,11 @@ public function testProcessBuyRequest($superGroup, $result) } /** + * dataProvider for buy request + * * @return array */ - public function processBuyRequestDataProvider() + public function processBuyRequestDataProvider(): array { return [ 'positive' => [[1, 2, 3], ['super_group' => [1, 2, 3]]], @@ -285,9 +348,12 @@ public function processBuyRequestDataProvider() } /** + * Get Children Msrp when children product with Msrp + * + * @return void * @SuppressWarnings(PHPMD.UnusedLocalVariable) */ - public function testGetChildrenMsrpWhenNoChildrenWithMsrp() + public function testGetChildrenMsrpWhenNoChildrenWithMsrp(): void { $key = '_cache_instance_associated_products'; @@ -298,7 +364,12 @@ public function testGetChildrenMsrpWhenNoChildrenWithMsrp() $this->assertEquals(0, $this->_model->getChildrenMsrp($this->product)); } - public function testPrepareForCartAdvancedEmpty() + /** + * Prepare for card method with advanced empty + * + * @return void + */ + public function testPrepareForCartAdvancedEmpty(): void { $this->product = $this->createMock(\Magento\Catalog\Model\Product::class); $buyRequest = new \Magento\Framework\DataObject(); @@ -381,7 +452,12 @@ public function testPrepareForCartAdvancedEmpty() ); } - public function testPrepareForCartAdvancedNoProductsStrictTrue() + /** + * Prepare for card with no products set strict option true + * + * @return void + */ + public function testPrepareForCartAdvancedNoProductsStrictTrue(): void { $buyRequest = new \Magento\Framework\DataObject(); $buyRequest->setSuperGroup([0 => 0]); @@ -404,7 +480,12 @@ public function testPrepareForCartAdvancedNoProductsStrictTrue() ); } - public function testPrepareForCartAdvancedNoProductsStrictFalse() + /** + * Prepare for card with no products and set strict to false + * + * @return void + */ + public function testPrepareForCartAdvancedNoProductsStrictFalse(): void { $buyRequest = new \Magento\Framework\DataObject(); $buyRequest->setSuperGroup([0 => 0]); @@ -429,7 +510,12 @@ public function testPrepareForCartAdvancedNoProductsStrictFalse() ); } - public function testPrepareForCartAdvancedWithProductsStrictFalseStringResult() + /** + * Verify Prepare for cart product with Product strict flase and string result + * + * @return false + */ + public function testPrepareForCartAdvancedWithProductsStrictFalseStringResult(): void { $associatedProduct = $this->createMock(\Magento\Catalog\Model\Product::class); $associatedId = 9384; @@ -463,7 +549,12 @@ public function testPrepareForCartAdvancedWithProductsStrictFalseStringResult() ); } - public function testPrepareForCartAdvancedWithProductsStrictFalseEmptyArrayResult() + /** + * Verify prepare for cart with strict option set to false and empty array + * + * @return void + */ + public function testPrepareForCartAdvancedWithProductsStrictFalseEmptyArrayResult(): void { $expectedMsg = "Cannot process the item."; $associatedProduct = $this->createMock(\Magento\Catalog\Model\Product::class); @@ -498,7 +589,12 @@ public function testPrepareForCartAdvancedWithProductsStrictFalseEmptyArrayResul ); } - public function testPrepareForCartAdvancedWithProductsStrictFalse() + /** + * Prepare for cart product with Product strict option st to false. + * + * @return void + */ + public function testPrepareForCartAdvancedWithProductsStrictFalse(): void { $associatedProduct = $this->createMock(\Magento\Catalog\Model\Product::class); $associatedId = 9384; @@ -541,7 +637,12 @@ public function testPrepareForCartAdvancedWithProductsStrictFalse() ); } - public function testPrepareForCartAdvancedWithProductsStrictTrue() + /** + * Verify prepare for cart with Product strict option true + * + * @return void + */ + public function testPrepareForCartAdvancedWithProductsStrictTrue(): void { $associatedProduct = $this->createMock(\Magento\Catalog\Model\Product::class); $associatedId = 9384; @@ -587,15 +688,20 @@ public function testPrepareForCartAdvancedWithProductsStrictTrue() ); } - public function testPrepareForCartAdvancedZeroQty() + /** + * Verify prepare for card with sold out option + * + * @return void + */ + public function testPrepareForCartAdvancedZeroQtyAndSoldOutOption(): void { $expectedMsg = "Please specify the quantity of product(s)."; - $associatedId = 9384; + $associatedId = 91; $associatedProduct = $this->createMock(\Magento\Catalog\Model\Product::class); - $associatedProduct->expects($this->atLeastOnce())->method('getId')->will($this->returnValue($associatedId)); - + $associatedProduct->expects($this->atLeastOnce())->method('getId')->will($this->returnValue(90)); + $associatedProduct->expects($this->once())->method('isSalable')->willReturn(true); $buyRequest = new \Magento\Framework\DataObject(); - $buyRequest->setSuperGroup([$associatedId => 0]); + $buyRequest->setSuperGroup([$associatedId => 90]); $cached = true; $this->product @@ -609,7 +715,12 @@ public function testPrepareForCartAdvancedZeroQty() $this->assertEquals($expectedMsg, $this->_model->prepareForCartAdvanced($buyRequest, $this->product)); } - public function testFlushAssociatedProductsCache() + /** + * Verify flush cache for associated products + * + * @return void + */ + public function testFlushAssociatedProductsCache(): void { $productMock = $this->createPartialMock(\Magento\Catalog\Model\Product::class, ['unsetData']); $productMock->expects($this->once()) From 82b29aac0789f2c2a5e0aad598df3a472c00d759 Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Fri, 3 Jan 2020 14:58:20 +0200 Subject: [PATCH 0634/1143] Removing the delete buttons for default customer groups --- .../Listing/Column/GroupActionsTest.php | 251 ++++++++++++++++++ .../Component/Listing/Column/GroupActions.php | 60 +++-- 2 files changed, 288 insertions(+), 23 deletions(-) create mode 100644 app/code/Magento/Customer/Test/Unit/Ui/Component/Listing/Column/GroupActionsTest.php diff --git a/app/code/Magento/Customer/Test/Unit/Ui/Component/Listing/Column/GroupActionsTest.php b/app/code/Magento/Customer/Test/Unit/Ui/Component/Listing/Column/GroupActionsTest.php new file mode 100644 index 0000000000000..51e652b15f53f --- /dev/null +++ b/app/code/Magento/Customer/Test/Unit/Ui/Component/Listing/Column/GroupActionsTest.php @@ -0,0 +1,251 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Customer\Test\Unit\Ui\Component\Listing\Column; + +use Magento\Customer\Api\GroupManagementInterface; +use Magento\Customer\Ui\Component\Listing\Column\GroupActions; +use Magento\Framework\Escaper; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Framework\UrlInterface; +use Magento\Framework\View\Element\UiComponent\ContextInterface; +use Magento\Framework\View\Element\UiComponentFactory; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +/** + * Class GroupActionsTest + */ +class GroupActionsTest extends TestCase +{ + /** + * @var GroupActions + */ + private $component; + + /** + * @var ContextInterface|MockObject + */ + private $contextMock; + + /** + * @var UiComponentFactory|MockObject + */ + private $uiComponentFactoryMock; + + /** + * @var UrlInterface|MockObject + */ + private $urlBuilderMock; + + /** + * @var Escaper|MockObject + */ + private $escaperMock; + + /** + * @var GroupManagementInterface|MockObject + */ + private $groupManagementMock; + + /** + * Set Up + */ + public function setUp() + { + $objectManager = new ObjectManager($this); + + $this->contextMock = $this->getMockBuilder(ContextInterface::class)->getMockForAbstractClass(); + $this->uiComponentFactoryMock = $this->createMock(UiComponentFactory::class); + $this->escaperMock = $this->createMock(Escaper::class); + $this->groupManagementMock = $this->createMock(GroupManagementInterface::class); + $this->urlBuilderMock = $this->getMockForAbstractClass( + UrlInterface::class, + [], + '', + false + ); + + $this->component = $objectManager->getObject( + GroupActions::class, + [ + 'context' => $this->contextMock, + 'uiComponentFactory' => $this->uiComponentFactoryMock, + 'urlBuilder' => $this->urlBuilderMock, + 'escaper' => $this->escaperMock, + 'components' => [], + 'data' => [ + 'name' => 'name' + ], + 'groupManagement' => $this->groupManagementMock + ] + ); + } + + /** + * Test data source with a non default customer group + * + * @dataProvider customerGroupsDataProvider + * + * @param array $items + * @param bool $isDefaultGroup + * @param array $expected + */ + public function testPrepareDataSourceWithNonDefaultGroup(array $items, bool $isDefaultGroup, array $expected) + { + $customerGroup = 'General'; + $dataSource = [ + 'data' => [ + 'items' => $items + ] + ]; + $expectedDataSource = [ + 'data' => [ + 'items' => $expected + ] + ]; + + $this->groupManagementMock->expects($this->any()) + ->method('isReadonly') + ->with(1) + ->willReturn($isDefaultGroup); + $this->escaperMock->expects($this->any()) + ->method('escapeHtml') + ->with($customerGroup) + ->willReturn($customerGroup); + $this->urlBuilderMock->expects($this->any()) + ->method('getUrl') + ->willReturnMap( + [ + ['customer/group/edit', ['id' => 1], 'http://magento.com/customer/group/edit'], + ['customer/group/delete', ['id' => 1], 'http://magento.com/customer/group/delete'] + ] + ); + + $dataSource = $this->component->prepareDataSource($dataSource); + $this->assertEquals($expectedDataSource, $dataSource); + } + + /** + * Test data source with a default customer group + * + * @dataProvider customerGroupsDataProvider + */ + public function testPrepareDataSourceWithDefaultGroup() + { + $isDefaultGroup = true; + $dataSource = [ + 'data' => [ + 'items' => [ + [ + 'customer_group_id' => 1, + 'customer_group_code' => 'General', + ], + [ + 'customer_group_id' => 0, + 'customer_group_code' => 'Not Logged In', + ], + ] + ] + ]; + $expectedDataSource = [ + 'data' => [ + 'items' => [ + [ + 'customer_group_id' => 1, + 'customer_group_code' => 'General', + 'name' => [ + 'edit' => [ + 'href' => 'http://magento.com/customer/group/edit', + 'label' => __('Edit'), + '__disableTmpl' => true, + ] + ] + ], + [ + 'customer_group_id' => 0, + 'customer_group_code' => 'Not Logged In', + 'name' => [ + 'edit' => [ + 'href' => 'http://magento.com/customer/group/edit', + 'label' => __('Edit'), + '__disableTmpl' => true, + ] + ] + ] + ] + ] + ]; + + $this->groupManagementMock->expects($this->any()) + ->method('isReadonly') + ->willReturn($isDefaultGroup); + $this->escaperMock->expects($this->any()) + ->method('escapeHtml') + ->willReturnMap( + [ + ['General', null, 'General'], + ['Not Logged In', null, 'Not Logged In'] + ] + ); + $this->urlBuilderMock->expects($this->any()) + ->method('getUrl') + ->willReturnMap( + [ + ['customer/group/edit', ['id' => 1], 'http://magento.com/customer/group/edit'], + ['customer/group/edit', ['id' => 0], 'http://magento.com/customer/group/edit'] + ] + ); + + $dataSource = $this->component->prepareDataSource($dataSource); + $this->assertEquals($expectedDataSource, $dataSource); + } + + /** + * Providing customer group data + * + * @return array + */ + public function customerGroupsDataProvider(): array + { + return [ + [ + [ + [ + 'customer_group_id' => 1, + 'customer_group_code' => 'General', + ], + ], + false, + [ + [ + 'customer_group_id' => 1, + 'customer_group_code' => 'General', + 'name' => [ + 'edit' => [ + 'href' => 'http://magento.com/customer/group/edit', + 'label' => __('Edit'), + '__disableTmpl' => true, + ], + 'delete' => [ + 'href' => 'http://magento.com/customer/group/delete', + 'label' => __('Delete'), + 'post' => true, + '__disableTmpl' => true, + 'confirm' => [ + 'title' => __('Delete %1', 'General'), + 'message' => __( + 'Are you sure you want to delete a %1 record?', + 'General' + ) + ], + ] + ] + ] + ] + ] + ]; + } +} diff --git a/app/code/Magento/Customer/Ui/Component/Listing/Column/GroupActions.php b/app/code/Magento/Customer/Ui/Component/Listing/Column/GroupActions.php index 5d974088b0d54..5f575aacb2e10 100644 --- a/app/code/Magento/Customer/Ui/Component/Listing/Column/GroupActions.php +++ b/app/code/Magento/Customer/Ui/Component/Listing/Column/GroupActions.php @@ -8,6 +8,10 @@ namespace Magento\Customer\Ui\Component\Listing\Column; +use Magento\Customer\Api\GroupManagementInterface; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\UrlInterface; use Magento\Framework\View\Element\UiComponent\ContextInterface; use Magento\Framework\View\Element\UiComponentFactory; @@ -16,6 +20,8 @@ /** * Class GroupActions + * + * Customer Groups actions column */ class GroupActions extends Column { @@ -25,6 +31,11 @@ class GroupActions extends Column const URL_PATH_EDIT = 'customer/group/edit'; const URL_PATH_DELETE = 'customer/group/delete'; + /** + * @var GroupManagementInterface + */ + private $groupManagement; + /** * @var UrlInterface */ @@ -44,6 +55,7 @@ class GroupActions extends Column * @param Escaper $escaper * @param array $components * @param array $data + * @param GroupManagementInterface $groupManagement */ public function __construct( ContextInterface $context, @@ -51,10 +63,13 @@ public function __construct( UrlInterface $urlBuilder, Escaper $escaper, array $components = [], - array $data = [] + array $data = [], + GroupManagementInterface $groupManagement = null ) { $this->urlBuilder = $urlBuilder; $this->escaper = $escaper; + $this->groupManagement = $groupManagement ?: ObjectManager::getInstance()->get(GroupManagementInterface::class);; + parent::__construct($context, $uiComponentFactory, $components, $data); } @@ -63,6 +78,8 @@ public function __construct( * * @param array $dataSource * @return array + * @throws LocalizedException + * @throws NoSuchEntityException */ public function prepareDataSource(array $dataSource) { @@ -83,29 +100,26 @@ public function prepareDataSource(array $dataSource) ], ]; - // hide delete action for 'NOT LOGGED IN' group - if ($item['customer_group_id'] == 0 && $item['customer_group_code']) { - continue; + if (!$this->groupManagement->isReadonly($item['customer_group_id'])) { + $item[$this->getData('name')]['delete'] = [ + 'href' => $this->urlBuilder->getUrl( + static::URL_PATH_DELETE, + [ + 'id' => $item['customer_group_id'] + ] + ), + 'label' => __('Delete'), + 'confirm' => [ + 'title' => __('Delete %1', $this->escaper->escapeHtml($title)), + 'message' => __( + 'Are you sure you want to delete a %1 record?', + $this->escaper->escapeHtml($title) + ) + ], + 'post' => true, + '__disableTmpl' => true + ]; } - - $item[$this->getData('name')]['delete'] = [ - 'href' => $this->urlBuilder->getUrl( - static::URL_PATH_DELETE, - [ - 'id' => $item['customer_group_id'] - ] - ), - 'label' => __('Delete'), - 'confirm' => [ - 'title' => __('Delete %1', $this->escaper->escapeHtml($title)), - 'message' => __( - 'Are you sure you want to delete a %1 record?', - $this->escaper->escapeHtml($title) - ) - ], - 'post' => true, - '__disableTmpl' => true - ]; } } } From 3064b666219424399e3671a72639dc8b972e6990 Mon Sep 17 00:00:00 2001 From: DmitryTsymbal <d.tsymbal@atwix.com> Date: Fri, 3 Jan 2020 15:08:17 +0200 Subject: [PATCH 0635/1143] Create Integration Entity With Duplicated Name Test --- ...ntegrationEntityWithDuplicatedNameTest.xml | 58 +++++++++++++++++++ ...reateIntegrationWithDuplicatedNameTest.xml | 1 + 2 files changed, 59 insertions(+) create mode 100644 app/code/Magento/Integration/Test/Mftf/Test/AdminCreateIntegrationEntityWithDuplicatedNameTest.xml diff --git a/app/code/Magento/Integration/Test/Mftf/Test/AdminCreateIntegrationEntityWithDuplicatedNameTest.xml b/app/code/Magento/Integration/Test/Mftf/Test/AdminCreateIntegrationEntityWithDuplicatedNameTest.xml new file mode 100644 index 0000000000000..842500f7d7195 --- /dev/null +++ b/app/code/Magento/Integration/Test/Mftf/Test/AdminCreateIntegrationEntityWithDuplicatedNameTest.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="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateIntegrationEntityWithDuplicatedNameTest"> + <annotations> + <features value="Integration"/> + <stories value="Creating System Integration With Duplicated Name"/> + <title value="Admin System Integration With Duplicated Name"/> + <description value="Admin Creates New Integration With Duplicated Name"/> + <group value="integration"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> + </before> + <after> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <!-- TEST BODY --> + <!-- Navigate To Integrations Page --> + <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToIntegrationsPage"> + <argument name="menuUiId" value="{{AdminMenuSystem.dataUiId}}"/> + <argument name="submenuUiId" value="{{AdminMenuSystemExtensionsIntegrations.dataUiId}}"/> + </actionGroup> + <!-- Click the "Add New Integration" button --> + <actionGroup ref="AdminNavigateToCreateIntegrationPageActionGroup" stepKey="clickAddNewIntegrationButton"/> + <!-- Create New Integration --> + <actionGroup ref="AdminCreatesNewIntegrationActionGroup" stepKey="createNewIntegration"> + <argument name="name" value="Integration1"/> + <argument name="password" value="{{_ENV.MAGENTO_ADMIN_PASSWORD}}"/> + </actionGroup> + <!-- Submit The Form --> + <actionGroup ref="AdminSubmitNewIntegrationFormActionGroup" stepKey="submitTheForm"/> + <!-- Click the "Add New Integration" button --> + <actionGroup ref="AdminNavigateToCreateIntegrationPageActionGroup" stepKey="clickAddNewIntegrationButtonSecondTime"/> + <!-- Create New Integration With Duplicated Name--> + <actionGroup ref="AdminCreatesNewIntegrationActionGroup" stepKey="createNewIntegrationWithDuplicatedName"> + <argument name="name" value="Integration1"/> + <argument name="password" value="{{_ENV.MAGENTO_ADMIN_PASSWORD}}"/> + </actionGroup> + <!-- Submit The Form --> + <actionGroup ref="AdminSubmitNewIntegrationFormActionGroup" stepKey="submitTheFormWithDuplicatedName"/> + <!-- See Error Message--> + <actionGroup ref="AssertAdminMessageCreateIntegrationEntityActionGroup" stepKey="seeErrorMessage"> + <argument name="message" value="The integration with name "Integration1" exists."/> + <argument value="error" name="messageType"/> + </actionGroup> + <!-- END TEST BODY --> + </test> +</tests> diff --git a/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/CreateIntegrationWithDuplicatedNameTest.xml b/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/CreateIntegrationWithDuplicatedNameTest.xml index 0a3fff5b3e510..2cd14d9de05a1 100644 --- a/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/CreateIntegrationWithDuplicatedNameTest.xml +++ b/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/CreateIntegrationWithDuplicatedNameTest.xml @@ -8,6 +8,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\Integration\Test\TestCase\CreateIntegrationWithDuplicatedNameTest" summary="Create Integration with existing name" ticketId="MAGETWO-16756"> <variation name="CreateIntegrationWithDuplicatedNameTestVariation1"> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <data name="integration/dataset" xsi:type="string">default</data> <constraint name="Magento\Integration\Test\Constraint\AssertIntegrationNameDuplicationErrorMessage" /> </variation> From 198f6e00afa8fa93f7e4927f9edccf43334f5569 Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Fri, 3 Jan 2020 15:09:43 +0200 Subject: [PATCH 0636/1143] Static tests --- .../Test/Unit/Ui/Component/Listing/Column/GroupActionsTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Customer/Test/Unit/Ui/Component/Listing/Column/GroupActionsTest.php b/app/code/Magento/Customer/Test/Unit/Ui/Component/Listing/Column/GroupActionsTest.php index 51e652b15f53f..51cf0e5395b47 100644 --- a/app/code/Magento/Customer/Test/Unit/Ui/Component/Listing/Column/GroupActionsTest.php +++ b/app/code/Magento/Customer/Test/Unit/Ui/Component/Listing/Column/GroupActionsTest.php @@ -17,6 +17,8 @@ /** * Class GroupActionsTest + * + * Testing GroupAction grid column */ class GroupActionsTest extends TestCase { From dd541f0019d06ae79aab2d65278d464ac2c0c281 Mon Sep 17 00:00:00 2001 From: DmitryTsymbal <d.tsymbal@atwix.com> Date: Fri, 3 Jan 2020 15:20:33 +0200 Subject: [PATCH 0637/1143] Comments Deleting --- ...CreateIntegrationEntityWithDuplicatedNameTest.xml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/app/code/Magento/Integration/Test/Mftf/Test/AdminCreateIntegrationEntityWithDuplicatedNameTest.xml b/app/code/Magento/Integration/Test/Mftf/Test/AdminCreateIntegrationEntityWithDuplicatedNameTest.xml index 842500f7d7195..d1809cf909f9c 100644 --- a/app/code/Magento/Integration/Test/Mftf/Test/AdminCreateIntegrationEntityWithDuplicatedNameTest.xml +++ b/app/code/Magento/Integration/Test/Mftf/Test/AdminCreateIntegrationEntityWithDuplicatedNameTest.xml @@ -23,36 +23,26 @@ <after> <actionGroup ref="logout" stepKey="logout"/> </after> - - <!-- TEST BODY --> - <!-- Navigate To Integrations Page --> + <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToIntegrationsPage"> <argument name="menuUiId" value="{{AdminMenuSystem.dataUiId}}"/> <argument name="submenuUiId" value="{{AdminMenuSystemExtensionsIntegrations.dataUiId}}"/> </actionGroup> - <!-- Click the "Add New Integration" button --> <actionGroup ref="AdminNavigateToCreateIntegrationPageActionGroup" stepKey="clickAddNewIntegrationButton"/> - <!-- Create New Integration --> <actionGroup ref="AdminCreatesNewIntegrationActionGroup" stepKey="createNewIntegration"> <argument name="name" value="Integration1"/> <argument name="password" value="{{_ENV.MAGENTO_ADMIN_PASSWORD}}"/> </actionGroup> - <!-- Submit The Form --> <actionGroup ref="AdminSubmitNewIntegrationFormActionGroup" stepKey="submitTheForm"/> - <!-- Click the "Add New Integration" button --> <actionGroup ref="AdminNavigateToCreateIntegrationPageActionGroup" stepKey="clickAddNewIntegrationButtonSecondTime"/> - <!-- Create New Integration With Duplicated Name--> <actionGroup ref="AdminCreatesNewIntegrationActionGroup" stepKey="createNewIntegrationWithDuplicatedName"> <argument name="name" value="Integration1"/> <argument name="password" value="{{_ENV.MAGENTO_ADMIN_PASSWORD}}"/> </actionGroup> - <!-- Submit The Form --> <actionGroup ref="AdminSubmitNewIntegrationFormActionGroup" stepKey="submitTheFormWithDuplicatedName"/> - <!-- See Error Message--> <actionGroup ref="AssertAdminMessageCreateIntegrationEntityActionGroup" stepKey="seeErrorMessage"> <argument name="message" value="The integration with name "Integration1" exists."/> <argument value="error" name="messageType"/> </actionGroup> - <!-- END TEST BODY --> </test> </tests> From 86ff8fa07a878a10c5b188173a6a0b1d4ad00e72 Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Fri, 3 Jan 2020 15:39:29 +0200 Subject: [PATCH 0638/1143] Static tests --- .../Customer/Ui/Component/Listing/Column/GroupActions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/Ui/Component/Listing/Column/GroupActions.php b/app/code/Magento/Customer/Ui/Component/Listing/Column/GroupActions.php index 5f575aacb2e10..e5a536dc6ecd6 100644 --- a/app/code/Magento/Customer/Ui/Component/Listing/Column/GroupActions.php +++ b/app/code/Magento/Customer/Ui/Component/Listing/Column/GroupActions.php @@ -68,7 +68,7 @@ public function __construct( ) { $this->urlBuilder = $urlBuilder; $this->escaper = $escaper; - $this->groupManagement = $groupManagement ?: ObjectManager::getInstance()->get(GroupManagementInterface::class);; + $this->groupManagement = $groupManagement ?: ObjectManager::getInstance()->get(GroupManagementInterface::class); parent::__construct($context, $uiComponentFactory, $components, $data); } From 6dc048354c717d82318f604d2a3819a53cf8eb82 Mon Sep 17 00:00:00 2001 From: Oleksandr Gorkun <ogorkun@magento.com> Date: Fri, 3 Jan 2020 10:32:29 -0600 Subject: [PATCH 0639/1143] MC-29565: [2.4.x] Remove 'getSessionIdQueryParam()' calls --- app/code/Magento/Customer/Model/Session.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Customer/Model/Session.php b/app/code/Magento/Customer/Model/Session.php index 77fc626316f18..e1a8f53c208ff 100644 --- a/app/code/Magento/Customer/Model/Session.php +++ b/app/code/Magento/Customer/Model/Session.php @@ -19,6 +19,7 @@ * @method string getNoReferer() * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) + * @SuppressWarnings(PHPMD.TooManyFields) * @since 100.0.2 */ class Session extends \Magento\Framework\Session\SessionManager From c0ab1d9c7a3ee84b1c880ee3fb2d16793a7edb9d Mon Sep 17 00:00:00 2001 From: Oleksandr Gorkun <ogorkun@magento.com> Date: Fri, 3 Jan 2020 10:46:58 -0600 Subject: [PATCH 0640/1143] MC-29567: [2.4.x] Remove SID query parameter-related method calls --- .../Magento/Backend/Block/Media/Uploader.php | 2 +- .../Product/Helper/Form/Gallery/Content.php | 2 +- .../Magento/Catalog/Model/Product/Url.php | 5 ---- .../Test/Unit/Model/Product/UrlTest.php | 7 +++--- .../Wysiwyg/Images/Content/Uploader.php | 4 ++- .../Form/Modifier/ConfigurablePanel.php | 2 +- app/code/Magento/Customer/Model/Session.php | 7 ------ .../Customer/Test/Unit/Model/SessionTest.php | 4 +-- .../Product/Edit/Tab/Downloadable/Links.php | 4 +-- .../Product/Edit/Tab/Downloadable/Samples.php | 4 +-- .../Product/Form/Modifier/LinksTest.php | 4 +-- .../Product/Form/Modifier/SamplesTest.php | 4 +-- .../Product/Form/Modifier/Data/Links.php | 6 ++--- .../Product/Form/Modifier/Data/Samples.php | 4 +-- .../Product/Form/Modifier/Links.php | 4 +-- .../Product/Form/Modifier/Samples.php | 2 +- .../Magento/Email/Model/AbstractTemplate.php | 1 - .../Test/Unit/Model/AbstractTemplateTest.php | 7 ++---- .../Test/Unit/Model/TemplateTest.php | 2 +- .../Store/Controller/Store/Redirect.php | 10 ++------ .../GraphQl/CatalogCms/CategoryBlockTest.php | 2 +- .../Magento/GraphQl/Cms/CmsBlockTest.php | 4 +-- .../Framework/Session/SessionManagerTest.php | 10 ++++---- .../Magento/Framework/App/Router/Base.php | 2 +- .../Magento/Framework/Session/SidResolver.php | 19 +++----------- .../Magento/Framework/Test/Unit/UrlTest.php | 20 +++++++-------- lib/internal/Magento/Framework/Url.php | 25 +++---------------- 27 files changed, 58 insertions(+), 109 deletions(-) diff --git a/app/code/Magento/Backend/Block/Media/Uploader.php b/app/code/Magento/Backend/Block/Media/Uploader.php index 84fa487281ac8..e95b6397cd244 100644 --- a/app/code/Magento/Backend/Block/Media/Uploader.php +++ b/app/code/Magento/Backend/Block/Media/Uploader.php @@ -87,7 +87,7 @@ protected function _construct() $this->setId($this->getId() . '_Uploader'); - $uploadUrl = $this->_urlBuilder->addSessionParam()->getUrl('adminhtml/*/upload'); + $uploadUrl = $this->_urlBuilder->getUrl('adminhtml/*/upload'); $this->getConfig()->setUrl($uploadUrl); $this->getConfig()->setParams(['form_key' => $this->getFormKey()]); $this->getConfig()->setFileField('file'); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php index f5d0ec7da617e..8e6011c09a27f 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php @@ -95,7 +95,7 @@ protected function _prepareLayout() ); $this->getUploader()->getConfig()->setUrl( - $this->_urlBuilder->addSessionParam()->getUrl('catalog/product_gallery/upload') + $this->_urlBuilder->getUrl('catalog/product_gallery/upload') )->setFileField( 'image' )->setFilters( diff --git a/app/code/Magento/Catalog/Model/Product/Url.php b/app/code/Magento/Catalog/Model/Product/Url.php index 2760b0f9fddb6..8867cc7a690c1 100644 --- a/app/code/Magento/Catalog/Model/Product/Url.php +++ b/app/code/Magento/Catalog/Model/Product/Url.php @@ -101,15 +101,10 @@ public function getUrlInStore(\Magento\Catalog\Model\Product $product, $params = */ public function getProductUrl($product, $useSid = null) { - if ($useSid === null) { - $useSid = $this->sidResolver->getUseSessionInUrl(); - } - $params = []; if (!$useSid) { $params['_nosid'] = true; } - return $this->getUrl($product, $params); } diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/UrlTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/UrlTest.php index ef7aad2cbb802..c7b6402cd3877 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/UrlTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/UrlTest.php @@ -159,12 +159,11 @@ public function testGetUrl( $this->assertEquals($requestPathProduct, $this->model->getUrlInStore($product, $routeParams)); break; case 'getProductUrl': - $this->assertEquals($requestPathProduct, $this->model->getProductUrl($product, true)); + $this->assertEquals($requestPathProduct, $this->model->getProductUrl($product, null)); $this->sidResolver - ->expects($this->once()) + ->expects($this->never()) ->method('getUseSessionInUrl') ->will($this->returnValue(true)); - $this->assertEquals($requestPathProduct, $this->model->getProductUrl($product, null)); break; } } @@ -212,7 +211,7 @@ public function getUrlDataProvider() 1, 1, [], - ['_direct' => '/product/url/path', '_query' => []], + ['_direct' => '/product/url/path', '_query' => [], '_nosid' => true], null, null, ] diff --git a/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content/Uploader.php b/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content/Uploader.php index cf0fc34b217e4..07b66fc53fa84 100644 --- a/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content/Uploader.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content/Uploader.php @@ -35,6 +35,8 @@ public function __construct( } /** + * Constructor + * * @return void */ protected function _construct() @@ -49,7 +51,7 @@ protected function _construct() $files[] = '*.' . $ext; } $this->getConfig()->setUrl( - $this->_urlBuilder->addSessionParam()->getUrl('cms/*/upload', ['type' => $type]) + $this->_urlBuilder->getUrl('cms/*/upload', ['type' => $type]) )->setFileField( 'image' )->setFilters( diff --git a/app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/ConfigurablePanel.php b/app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/ConfigurablePanel.php index e0cc83922e03e..16119dcb5c866 100644 --- a/app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/ConfigurablePanel.php +++ b/app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/ConfigurablePanel.php @@ -447,7 +447,7 @@ protected function getRows() 'smallImage' => '${$.provider}:${$.parentScope}.small_image', ], 'uploaderConfig' => [ - 'url' => $this->urlBuilder->addSessionParam()->getUrl( + 'url' => $this->urlBuilder->getUrl( 'catalog/product_gallery/upload' ), ], diff --git a/app/code/Magento/Customer/Model/Session.php b/app/code/Magento/Customer/Model/Session.php index e9dc7700ec090..14e8cb9a60d67 100644 --- a/app/code/Magento/Customer/Model/Session.php +++ b/app/code/Magento/Customer/Model/Session.php @@ -511,13 +511,6 @@ public function authenticate($loginUrl = null) $this->response->setRedirect($loginUrl); } else { $arguments = $this->_customerUrl->getLoginUrlParams(); - if ($this->_createUrl()->getUseSession()) { - $arguments += [ - '_query' => [ - $this->sidResolver->getSessionIdQueryParam($this->_session) => $this->_session->getSessionId(), - ] - ]; - } $this->response->setRedirect( $this->_createUrl()->getUrl(\Magento\Customer\Model\Url::ROUTE_ACCOUNT_LOGIN, $arguments) ); diff --git a/app/code/Magento/Customer/Test/Unit/Model/SessionTest.php b/app/code/Magento/Customer/Test/Unit/Model/SessionTest.php index 8565790990df1..a1733b233ea66 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/SessionTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/SessionTest.php @@ -147,10 +147,10 @@ public function testAuthenticate() $urlMock->expects($this->once()) ->method('getRebuiltUrl') ->willReturn(''); - $this->urlFactoryMock->expects($this->exactly(4)) + $this->urlFactoryMock->expects($this->exactly(3)) ->method('create') ->willReturn($urlMock); - $urlMock->expects($this->once()) + $urlMock->expects($this->never()) ->method('getUseSession') ->willReturn(false); diff --git a/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php b/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php index 47c66c98fc8fb..e0026765f269b 100644 --- a/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php +++ b/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php @@ -11,7 +11,7 @@ * @author Magento Core Team <core@magentocommerce.com> * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * - * @deprecated + * @deprecated in favor of new class which adds grid links * @see \Magento\Downloadable\Ui\DataProvider\Product\Form\Modifier\Links */ class Links extends \Magento\Backend\Block\Template @@ -398,7 +398,7 @@ public function getFileFieldName($type) */ public function getUploadUrl($type) { - return $this->_urlFactory->create()->addSessionParam()->getUrl( + return $this->_urlFactory->create()->getUrl( 'adminhtml/downloadable_file/upload', ['type' => $type, '_secure' => true] ); diff --git a/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Samples.php b/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Samples.php index f245aeeeead67..83a5a93405158 100644 --- a/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Samples.php +++ b/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Samples.php @@ -10,7 +10,7 @@ * * @author Magento Core Team <core@magentocommerce.com> * - * @deprecated + * @deprecated because of new class which adds grids samples * @see \Magento\Downloadable\Ui\DataProvider\Product\Form\Modifier\Samples */ class Samples extends \Magento\Backend\Block\Widget @@ -250,7 +250,7 @@ public function getUploadButtonHtml() */ public function getConfigJson() { - $url = $this->_urlFactory->create()->addSessionParam()->getUrl( + $url = $this->_urlFactory->create()->getUrl( 'adminhtml/downloadable_file/upload', ['type' => 'samples', '_secure' => true] ); diff --git a/app/code/Magento/Downloadable/Test/Unit/Ui/DataProvider/Product/Form/Modifier/LinksTest.php b/app/code/Magento/Downloadable/Test/Unit/Ui/DataProvider/Product/Form/Modifier/LinksTest.php index cff48420938b1..4a1039340342f 100644 --- a/app/code/Magento/Downloadable/Test/Unit/Ui/DataProvider/Product/Form/Modifier/LinksTest.php +++ b/app/code/Magento/Downloadable/Test/Unit/Ui/DataProvider/Product/Form/Modifier/LinksTest.php @@ -17,7 +17,7 @@ use Magento\Framework\Stdlib\ArrayManager; /** - * Class LinksTest + * Test for class Magento\Downloadable\Ui\DataProvider\Product\Form\Modifier\Links * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class LinksTest extends \PHPUnit\Framework\TestCase @@ -169,7 +169,7 @@ public function testModifyMeta() ->method('toOptionArray'); $this->shareableMock->expects($this->once()) ->method('toOptionArray'); - $this->urlBuilderMock->expects($this->exactly(2)) + $this->urlBuilderMock->expects($this->never()) ->method('addSessionParam') ->willReturnSelf(); $this->urlBuilderMock->expects($this->exactly(2)) diff --git a/app/code/Magento/Downloadable/Test/Unit/Ui/DataProvider/Product/Form/Modifier/SamplesTest.php b/app/code/Magento/Downloadable/Test/Unit/Ui/DataProvider/Product/Form/Modifier/SamplesTest.php index 420950d08e101..41d56f0f380bb 100644 --- a/app/code/Magento/Downloadable/Test/Unit/Ui/DataProvider/Product/Form/Modifier/SamplesTest.php +++ b/app/code/Magento/Downloadable/Test/Unit/Ui/DataProvider/Product/Form/Modifier/SamplesTest.php @@ -16,7 +16,7 @@ use Magento\Framework\Stdlib\ArrayManager; /** - * Class SamplesTest + * Test for class Magento\Downloadable\Ui\DataProvider\Product\Form\Modifier\Samples * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class SamplesTest extends \PHPUnit\Framework\TestCase @@ -141,7 +141,7 @@ public function testModifyMeta() ->method('isSingleStoreMode'); $this->typeUploadMock->expects($this->once()) ->method('toOptionArray'); - $this->urlBuilderMock->expects($this->once()) + $this->urlBuilderMock->expects($this->never()) ->method('addSessionParam') ->willReturnSelf(); $this->urlBuilderMock->expects($this->once()) diff --git a/app/code/Magento/Downloadable/Ui/DataProvider/Product/Form/Modifier/Data/Links.php b/app/code/Magento/Downloadable/Ui/DataProvider/Product/Form/Modifier/Data/Links.php index 0a3ea2fc6ba19..3be1094f7a4b7 100644 --- a/app/code/Magento/Downloadable/Ui/DataProvider/Product/Form/Modifier/Data/Links.php +++ b/app/code/Magento/Downloadable/Ui/DataProvider/Product/Form/Modifier/Data/Links.php @@ -16,7 +16,7 @@ use Magento\Framework\Exception\ValidatorException; /** - * Class Links + * Grid class to add links * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Links @@ -162,7 +162,7 @@ protected function addSampleFile(array $linkData, LinkInterface $link) 'name' => $this->downloadableFile->getFileFromPathFile($sampleFile), 'size' => $this->downloadableFile->getFileSize($file), 'status' => 'old', - 'url' => $this->urlBuilder->addSessionParam()->getUrl( + 'url' => $this->urlBuilder->getUrl( 'adminhtml/downloadable_product_edit/link', ['id' => $link->getId(), 'type' => 'sample', '_secure' => true] ), @@ -191,7 +191,7 @@ protected function addLinkFile(array $linkData, LinkInterface $link) 'name' => $this->downloadableFile->getFileFromPathFile($linkFile), 'size' => $this->downloadableFile->getFileSize($file), 'status' => 'old', - 'url' => $this->urlBuilder->addSessionParam()->getUrl( + 'url' => $this->urlBuilder->getUrl( 'adminhtml/downloadable_product_edit/link', ['id' => $link->getId(), 'type' => 'link', '_secure' => true] ), diff --git a/app/code/Magento/Downloadable/Ui/DataProvider/Product/Form/Modifier/Data/Samples.php b/app/code/Magento/Downloadable/Ui/DataProvider/Product/Form/Modifier/Data/Samples.php index 988f429de1d87..bf2faede3a6dd 100644 --- a/app/code/Magento/Downloadable/Ui/DataProvider/Product/Form/Modifier/Data/Samples.php +++ b/app/code/Magento/Downloadable/Ui/DataProvider/Product/Form/Modifier/Data/Samples.php @@ -16,7 +16,7 @@ use Magento\Downloadable\Api\Data\SampleInterface; /** - * Class Samples + * Class to add samples * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Samples @@ -143,7 +143,7 @@ protected function addSampleFile(array $sampleData, SampleInterface $sample) 'name' => $this->downloadableFile->getFileFromPathFile($sampleFile), 'size' => $this->downloadableFile->getFileSize($file), 'status' => 'old', - 'url' => $this->urlBuilder->addSessionParam()->getUrl( + 'url' => $this->urlBuilder->getUrl( 'adminhtml/downloadable_product_edit/sample', ['id' => $sample->getId(), '_secure' => true] ), diff --git a/app/code/Magento/Downloadable/Ui/DataProvider/Product/Form/Modifier/Links.php b/app/code/Magento/Downloadable/Ui/DataProvider/Product/Form/Modifier/Links.php index c4824f913daf8..8c98d871a12d2 100644 --- a/app/code/Magento/Downloadable/Ui/DataProvider/Product/Form/Modifier/Links.php +++ b/app/code/Magento/Downloadable/Ui/DataProvider/Product/Form/Modifier/Links.php @@ -339,7 +339,7 @@ protected function getFileColumn() 'elementTmpl' => 'Magento_Downloadable/components/file-uploader', 'fileInputName' => 'links', 'uploaderConfig' => [ - 'url' => $this->urlBuilder->addSessionParam()->getUrl( + 'url' => $this->urlBuilder->getUrl( 'adminhtml/downloadable_file/upload', ['type' => 'links', '_secure' => true] ), @@ -406,7 +406,7 @@ protected function getSampleColumn() 'fileInputName' => 'link_samples', 'labelVisible' => false, 'uploaderConfig' => [ - 'url' => $this->urlBuilder->addSessionParam()->getUrl( + 'url' => $this->urlBuilder->getUrl( 'adminhtml/downloadable_file/upload', ['type' => 'link_samples', '_secure' => true] ), diff --git a/app/code/Magento/Downloadable/Ui/DataProvider/Product/Form/Modifier/Samples.php b/app/code/Magento/Downloadable/Ui/DataProvider/Product/Form/Modifier/Samples.php index 81c5918eb24ae..474fc56c10043 100644 --- a/app/code/Magento/Downloadable/Ui/DataProvider/Product/Form/Modifier/Samples.php +++ b/app/code/Magento/Downloadable/Ui/DataProvider/Product/Form/Modifier/Samples.php @@ -273,7 +273,7 @@ protected function getSampleColumn() 'elementTmpl' => 'Magento_Downloadable/components/file-uploader', 'fileInputName' => 'samples', 'uploaderConfig' => [ - 'url' => $this->urlBuilder->addSessionParam()->getUrl( + 'url' => $this->urlBuilder->getUrl( 'adminhtml/downloadable_file/upload', ['type' => 'samples', '_secure' => true] ), diff --git a/app/code/Magento/Email/Model/AbstractTemplate.php b/app/code/Magento/Email/Model/AbstractTemplate.php index 8acb0a9fddb75..3d4fc252b57ff 100644 --- a/app/code/Magento/Email/Model/AbstractTemplate.php +++ b/app/code/Magento/Email/Model/AbstractTemplate.php @@ -339,7 +339,6 @@ public function loadDefault($templateId) public function getProcessedTemplate(array $variables = []) { $processor = $this->getTemplateFilter() - ->setUseSessionInUrl(false) ->setPlainTemplateMode($this->isPlain()) ->setIsChildTemplate($this->isChildTemplate()) ->setTemplateProcessor([$this, 'getTemplateContent']); diff --git a/app/code/Magento/Email/Test/Unit/Model/AbstractTemplateTest.php b/app/code/Magento/Email/Test/Unit/Model/AbstractTemplateTest.php index 036ab1b273fb0..0b17337716b91 100644 --- a/app/code/Magento/Email/Test/Unit/Model/AbstractTemplateTest.php +++ b/app/code/Magento/Email/Test/Unit/Model/AbstractTemplateTest.php @@ -177,7 +177,7 @@ public function testGetProcessedTemplate($variables, $templateType, $storeId, $e ->disableOriginalConstructor() ->getMock(); - $filterTemplate->expects($this->once()) + $filterTemplate->expects($this->never()) ->method('setUseSessionInUrl') ->with(false) ->will($this->returnSelf()); @@ -253,7 +253,6 @@ public function testGetProcessedTemplateException() $filterTemplate = $this->getMockBuilder(\Magento\Email\Model\Template\Filter::class) ->setMethods( [ - 'setUseSessionInUrl', 'setPlainTemplateMode', 'setIsChildTemplate', 'setDesignParams', @@ -267,9 +266,7 @@ public function testGetProcessedTemplateException() ) ->disableOriginalConstructor() ->getMock(); - $filterTemplate->expects($this->once()) - ->method('setUseSessionInUrl') - ->will($this->returnSelf()); + $filterTemplate->expects($this->once()) ->method('setPlainTemplateMode') ->will($this->returnSelf()); diff --git a/app/code/Magento/Newsletter/Test/Unit/Model/TemplateTest.php b/app/code/Magento/Newsletter/Test/Unit/Model/TemplateTest.php index b53ac39f0e4e2..eb55d365cafa2 100644 --- a/app/code/Magento/Newsletter/Test/Unit/Model/TemplateTest.php +++ b/app/code/Magento/Newsletter/Test/Unit/Model/TemplateTest.php @@ -268,7 +268,7 @@ class_exists(\Magento\Newsletter\Model\Template\Filter::class, true); ) ->disableOriginalConstructor() ->getMock(); - $filterTemplate->expects($this->once()) + $filterTemplate->expects($this->never()) ->method('setUseSessionInUrl') ->with(false) ->will($this->returnSelf()); diff --git a/app/code/Magento/Store/Controller/Store/Redirect.php b/app/code/Magento/Store/Controller/Store/Redirect.php index 5d61275e72a28..c05fe98e465d1 100644 --- a/app/code/Magento/Store/Controller/Store/Redirect.php +++ b/app/code/Magento/Store/Controller/Store/Redirect.php @@ -77,9 +77,9 @@ public function __construct( } /** - * Performs store redirect + * Builds Redirect Url * - * @return ResponseInterface|ResultInterface + * @return ResponseInterface|\Magento\Framework\Controller\ResultInterface * @throws NoSuchEntityException */ public function execute() @@ -113,12 +113,6 @@ public function execute() \Magento\Framework\App\ActionInterface::PARAM_NAME_URL_ENCODED => $encodedUrl, ]; - if ($this->sidResolver->getUseSessionInUrl()) { - // allow customers to stay logged in during store switching - $sidName = $this->sidResolver->getSessionIdQueryParam($this->session); - $query[$sidName] = $this->session->getSessionId(); - } - $customerHash = $this->hashGenerator->generateHash($fromStore); $query = array_merge($query, $customerHash); diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogCms/CategoryBlockTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogCms/CategoryBlockTest.php index 52985422c3355..5788313c4704e 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogCms/CategoryBlockTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogCms/CategoryBlockTest.php @@ -29,7 +29,7 @@ public function testCategoryCmsBlock() $blockRepository = Bootstrap::getObjectManager()->get(BlockRepositoryInterface::class); $block = $blockRepository->getById($blockId); $filter = Bootstrap::getObjectManager()->get(FilterEmulate::class); - $renderedContent = $filter->setUseSessionInUrl(false)->filter($block->getContent()); + $renderedContent = $filter->filter($block->getContent()); /** @var CategoryRepositoryInterface $categoryRepository */ $categoryRepository = Bootstrap::getObjectManager()->get(CategoryRepositoryInterface::class); diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Cms/CmsBlockTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Cms/CmsBlockTest.php index d598a463a48a7..f0b7ab1b924b6 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Cms/CmsBlockTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Cms/CmsBlockTest.php @@ -43,7 +43,7 @@ public function testGetCmsBlock() { $cmsBlock = $this->blockRepository->getById('enabled_block'); $cmsBlockData = $cmsBlock->getData(); - $renderedContent = $this->filterEmulate->setUseSessionInUrl(false)->filter($cmsBlock->getContent()); + $renderedContent = $this->filterEmulate->filter($cmsBlock->getContent()); $query = <<<QUERY @@ -77,7 +77,7 @@ public function testGetCmsBlockByBlockId() $cmsBlock = $this->blockRepository->getById('enabled_block'); $cmsBlockData = $cmsBlock->getData(); $blockId = $cmsBlockData['block_id']; - $renderedContent = $this->filterEmulate->setUseSessionInUrl(false)->filter($cmsBlock->getContent()); + $renderedContent = $this->filterEmulate->filter($cmsBlock->getContent()); $query = <<<QUERY diff --git a/dev/tests/integration/testsuite/Magento/Framework/Session/SessionManagerTest.php b/dev/tests/integration/testsuite/Magento/Framework/Session/SessionManagerTest.php index 3205c19445ee1..ef04da90679c5 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Session/SessionManagerTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Session/SessionManagerTest.php @@ -52,7 +52,7 @@ function ini_set($varName, $newValue) SessionManagerTest::$isIniSetInvoked[$varName] = $newValue; return true; } - return call_user_func_array('\ini_set', func_get_args()); + return call_user_func_array('\ini_set', [$varName, $newValue]); } /** @@ -214,7 +214,7 @@ public function testSetSessionId() { $this->initializeModel(); $sessionId = $this->model->getSessionId(); - $this->appState->expects($this->atLeastOnce()) + $this->appState->expects($this->any()) ->method('getAreaCode') ->willReturn(\Magento\Framework\App\Area::AREA_FRONTEND); $this->model->setSessionId($this->sidResolver->getSid($this->model)); @@ -230,17 +230,17 @@ public function testSetSessionId() public function testSetSessionIdFromParam() { $this->initializeModel(); - $this->appState->expects($this->atLeastOnce()) + $this->appState->expects($this->any()) ->method('getAreaCode') ->willReturn(\Magento\Framework\App\Area::AREA_FRONTEND); $this->assertNotEquals('test_id', $this->model->getSessionId()); $this->request->getQuery()->set($this->sidResolver->getSessionIdQueryParam($this->model), 'test-id'); $this->model->setSessionId($this->sidResolver->getSid($this->model)); - $this->assertEquals('test-id', $this->model->getSessionId()); + $this->assertNotEquals('test-id', $this->model->getSessionId()); /* Use not valid identifier */ $this->request->getQuery()->set($this->sidResolver->getSessionIdQueryParam($this->model), 'test_id'); $this->model->setSessionId($this->sidResolver->getSid($this->model)); - $this->assertEquals('test-id', $this->model->getSessionId()); + $this->assertNotEquals('test-id', $this->model->getSessionId()); } public function testGetSessionIdForHost() diff --git a/lib/internal/Magento/Framework/App/Router/Base.php b/lib/internal/Magento/Framework/App/Router/Base.php index 9c0d1633e8bba..a0a3f6f8fd4aa 100644 --- a/lib/internal/Magento/Framework/App/Router/Base.php +++ b/lib/internal/Magento/Framework/App/Router/Base.php @@ -374,6 +374,6 @@ protected function _checkShouldBeSecure(\Magento\Framework\App\RequestInterface */ protected function _shouldRedirectToSecure() { - return $this->_url->getUseSession(); + return false; } } diff --git a/lib/internal/Magento/Framework/Session/SidResolver.php b/lib/internal/Magento/Framework/Session/SidResolver.php index 041995d20fcd2..667535bfa392c 100644 --- a/lib/internal/Magento/Framework/Session/SidResolver.php +++ b/lib/internal/Magento/Framework/Session/SidResolver.php @@ -10,7 +10,7 @@ use Magento\Framework\App\State; /** - * Class SidResolver + * Resolves SID by processing request parameters. * @deprecated 2.3.3 SIDs in URLs are no longer used */ class SidResolver implements SidResolverInterface @@ -96,24 +96,11 @@ public function __construct( * * @return string|null * @throws \Magento\Framework\Exception\LocalizedException + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function getSid(SessionManagerInterface $session) { - if ($this->appState->getAreaCode() !== \Magento\Framework\App\Area::AREA_FRONTEND) { - return null; - } - - $sidKey = null; - - $useSidOnFrontend = $this->getUseSessionInUrl(); - if ($useSidOnFrontend && $this->request->getQuery( - $this->getSessionIdQueryParam($session), - false - ) && $this->urlBuilder->isOwnOriginUrl() - ) { - $sidKey = $this->request->getQuery($this->getSessionIdQueryParam($session)); - } - return $sidKey; + return null; } /** diff --git a/lib/internal/Magento/Framework/Test/Unit/UrlTest.php b/lib/internal/Magento/Framework/Test/Unit/UrlTest.php index 046a9d63fc8f4..b6d8a1bd9b6c4 100644 --- a/lib/internal/Magento/Framework/Test/Unit/UrlTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/UrlTest.php @@ -108,7 +108,7 @@ protected function getRouteParamsResolverFactory($resolve = true) { $routeParamsResolverFactoryMock = $this->createMock(\Magento\Framework\Url\RouteParamsResolverFactory::class); if ($resolve) { - $routeParamsResolverFactoryMock->expects($this->once())->method('create') + $routeParamsResolverFactoryMock->expects($this->any())->method('create') ->will($this->returnValue($this->routeParamsResolverMock)); } return $routeParamsResolverFactoryMock; @@ -183,7 +183,7 @@ public function testGetUseSession() $this->assertFalse((bool)$model->getUseSession()); $model->setUseSession(true); - $this->assertTrue($model->getUseSession()); + $this->assertFalse($model->getUseSession()); } public function testGetBaseUrlNotLinkType() @@ -467,10 +467,10 @@ public function testGetRedirectUrl() ] ); - $this->sidResolverMock->expects($this->once())->method('getUseSessionInUrl')->will($this->returnValue(true)); - $this->sessionMock->expects($this->once())->method('getSessionIdForHost')->will($this->returnValue(false)); - $this->sidResolverMock->expects($this->once())->method('getUseSessionVar')->will($this->returnValue(true)); - $this->routeParamsResolverMock->expects($this->once())->method('hasData')->with('secure_is_forced') + $this->sidResolverMock->expects($this->any())->method('getUseSessionInUrl')->will($this->returnValue(true)); + $this->sessionMock->expects($this->any())->method('getSessionIdForHost')->will($this->returnValue(false)); + $this->sidResolverMock->expects($this->any())->method('getUseSessionVar')->will($this->returnValue(true)); + $this->routeParamsResolverMock->expects($this->any())->method('hasData')->with('secure_is_forced') ->will($this->returnValue(true)); $this->sidResolverMock->expects($this->never())->method('getSessionIdQueryParam'); $this->queryParamsResolverMock->expects($this->once()) @@ -491,11 +491,11 @@ public function testGetRedirectUrlWithSessionId() ] ); - $this->sidResolverMock->expects($this->once())->method('getUseSessionInUrl')->will($this->returnValue(true)); - $this->sessionMock->expects($this->once())->method('getSessionIdForHost') + $this->sidResolverMock->expects($this->never())->method('getUseSessionInUrl')->will($this->returnValue(true)); + $this->sessionMock->expects($this->never())->method('getSessionIdForHost') ->will($this->returnValue('session-id')); - $this->sidResolverMock->expects($this->once())->method('getUseSessionVar')->will($this->returnValue(false)); - $this->sidResolverMock->expects($this->once())->method('getSessionIdQueryParam'); + $this->sidResolverMock->expects($this->never())->method('getUseSessionVar')->will($this->returnValue(false)); + $this->sidResolverMock->expects($this->never())->method('getSessionIdQueryParam'); $this->queryParamsResolverMock->expects($this->once()) ->method('getQuery') ->will($this->returnValue('foo=bar')); diff --git a/lib/internal/Magento/Framework/Url.php b/lib/internal/Magento/Framework/Url.php index c67a20f0a157d..fd1c4759ce42f 100644 --- a/lib/internal/Magento/Framework/Url.php +++ b/lib/internal/Magento/Framework/Url.php @@ -111,7 +111,7 @@ class Url extends \Magento\Framework\DataObject implements \Magento\Framework\Ur * * @var bool */ - protected $_useSession; + protected $_useSession = false; /** * Url security info list @@ -292,10 +292,7 @@ public function setUseSession($useSession) */ public function getUseSession() { - if ($this->_useSession === null) { - $this->_useSession = $this->_sidResolver->getUseSessionInUrl(); - } - return $this->_useSession; + return false; } /** @@ -945,10 +942,6 @@ private function createUrl($routePath = null, array $routeParams = null) } } - if ($noSid !== true) { - $this->_prepareSessionUrl($url); - } - $query = $this->_getQuery($escapeQuery); if ($query) { $mark = strpos($url, '?') === false ? '?' : ($escapeQuery ? '&' : '&'); @@ -972,18 +965,10 @@ private function createUrl($routePath = null, array $routeParams = null) * @param string $url * * @return \Magento\Framework\UrlInterface + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ protected function _prepareSessionUrl($url) { - if (!$this->getUseSession()) { - return $this; - } - $sessionId = $this->_session->getSessionIdForHost($url); - if ($this->_sidResolver->getUseSessionVar() && !$sessionId) { - $this->setQueryParam('___SID', $this->_isSecure() ? 'S' : 'U'); - } elseif ($sessionId) { - $this->setQueryParam($this->_sidResolver->getSessionIdQueryParam($this->_session), $sessionId); - } return $this; } @@ -1004,8 +989,6 @@ public function getRebuiltUrl($url) } $url = $this->getScheme() . '://' . $this->getHost() . $port . $this->getPath(); - $this->_prepareSessionUrl($url); - $query = $this->_getQuery(); if ($query) { $url .= '?' . $query; @@ -1118,7 +1101,7 @@ public function isOwnOriginUrl() } /** - * Return frontend redirect URL with SID and other session parameters if any + * Return frontend redirect URL without SID * * @param string $url * From 42f90cfd8b7606d4788b6f846de0a0a711cdb302 Mon Sep 17 00:00:00 2001 From: Oleksandr Gorkun <ogorkun@magento.com> Date: Fri, 3 Jan 2020 10:48:46 -0600 Subject: [PATCH 0641/1143] MC-29567: [2.4.x] Remove SID query parameter-related method calls --- app/code/Magento/Customer/Model/Session.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/code/Magento/Customer/Model/Session.php b/app/code/Magento/Customer/Model/Session.php index 14e8cb9a60d67..07f4c0499c5a6 100644 --- a/app/code/Magento/Customer/Model/Session.php +++ b/app/code/Magento/Customer/Model/Session.php @@ -19,6 +19,7 @@ * @method string getNoReferer() * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) + * @SuppressWarnings(PHPMD.TooManyFields) * @since 100.0.2 */ class Session extends \Magento\Framework\Session\SessionManager @@ -108,6 +109,11 @@ class Session extends \Magento\Framework\Session\SessionManager */ protected $response; + /** + * @var AccountConfirmation + */ + private $accountConfirmation; + /** * Session constructor. * From 9f14f7d456d35a3df06f05244d9ab91201eb2963 Mon Sep 17 00:00:00 2001 From: Anusha Vattam <avattam@adobe.com> Date: Fri, 3 Jan 2020 10:49:59 -0600 Subject: [PATCH 0642/1143] MC-20074: Fix Skipped MFTF Tests From MC-17140: MC-14104, MC-14502, MC-14532 - Unskipped the 14104-JSMinificationTest --- .../Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml index 38749dfd792ca..d3b2916ee5825 100644 --- a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml +++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml @@ -18,9 +18,6 @@ <severity value="MAJOR"/> <group value="backend"/> <group value="mtf_migrated"/> - <skip> - <issueId value="MC-17140"/> - </skip> </annotations> <before> <magentoCLI command="config:set {{MinifyJavaScriptFilesEnableConfigData.path}} {{MinifyJavaScriptFilesEnableConfigData.value}}" stepKey="enableJsMinification"/> From 837675cf7299be85b90f8640166c7b8001e2d835 Mon Sep 17 00:00:00 2001 From: Lena Orobei <oorobei@magento.com> Date: Fri, 3 Jan 2020 11:41:34 -0600 Subject: [PATCH 0643/1143] Forward-port magento/graphql-ce#443 and magento/graphql-ce#1073 --- .../{textual_swatch_attribute.php => text_swatch_attribute.php} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename dev/tests/integration/testsuite/Magento/Swatches/_files/{textual_swatch_attribute.php => text_swatch_attribute.php} (100%) diff --git a/dev/tests/integration/testsuite/Magento/Swatches/_files/textual_swatch_attribute.php b/dev/tests/integration/testsuite/Magento/Swatches/_files/text_swatch_attribute.php similarity index 100% rename from dev/tests/integration/testsuite/Magento/Swatches/_files/textual_swatch_attribute.php rename to dev/tests/integration/testsuite/Magento/Swatches/_files/text_swatch_attribute.php From d16d30a5fa0a390cd5e1bfd8845ebb47cc917408 Mon Sep 17 00:00:00 2001 From: Oleksandr Gorkun <ogorkun@magento.com> Date: Fri, 3 Jan 2020 12:46:10 -0600 Subject: [PATCH 0644/1143] MC-29567: [2.4.x] Remove SID query parameter-related method calls --- .../Magento/Email/Test/Unit/Model/AbstractTemplateTest.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/code/Magento/Email/Test/Unit/Model/AbstractTemplateTest.php b/app/code/Magento/Email/Test/Unit/Model/AbstractTemplateTest.php index 0b17337716b91..8598138e77c50 100644 --- a/app/code/Magento/Email/Test/Unit/Model/AbstractTemplateTest.php +++ b/app/code/Magento/Email/Test/Unit/Model/AbstractTemplateTest.php @@ -69,9 +69,6 @@ protected function setUp() $this->design = $this->getMockBuilder(\Magento\Framework\View\DesignInterface::class) ->disableOriginalConstructor() ->getMock(); - $this->registry = $this->getMockBuilder(\Magento\Framework\Registry::class) - ->disableOriginalConstructor() - ->getMock(); $this->appEmulation = $this->getMockBuilder(\Magento\Store\Model\App\Emulation::class) ->disableOriginalConstructor() ->getMock(); From 9a4ccb7b6129060b00faf26dbdb3a9a6aa6c4284 Mon Sep 17 00:00:00 2001 From: Max Romanov <maxromanov4669@gmail.com> Date: Sat, 4 Jan 2020 14:07:13 +0200 Subject: [PATCH 0645/1143] 11209-wishlist-add-grouped-product-error --- .../Model/Wishlist/Product/Item.php | 90 +++++++++ .../Unit/Model/Wishlist/Product/ItemTest.php | 179 ++++++++++++++++++ .../GroupedProduct/etc/frontend/di.xml | 12 ++ 3 files changed, 281 insertions(+) create mode 100644 app/code/Magento/GroupedProduct/Model/Wishlist/Product/Item.php create mode 100644 app/code/Magento/GroupedProduct/Test/Unit/Model/Wishlist/Product/ItemTest.php create mode 100644 app/code/Magento/GroupedProduct/etc/frontend/di.xml diff --git a/app/code/Magento/GroupedProduct/Model/Wishlist/Product/Item.php b/app/code/Magento/GroupedProduct/Model/Wishlist/Product/Item.php new file mode 100644 index 0000000000000..9eaa54f1ff66e --- /dev/null +++ b/app/code/Magento/GroupedProduct/Model/Wishlist/Product/Item.php @@ -0,0 +1,90 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\GroupedProduct\Model\Wishlist\Product; + +use Magento\Wishlist\Model\Item as WishlistItem; +use Magento\GroupedProduct\Model\Product\Type\Grouped as TypeGrouped; +use Magento\Catalog\Model\Product; + +/** + * Wishlist logic for grouped product + */ +class Item +{ + /** + * Modify Wishlist item based on associated product qty + * + * @param WishlistItem $subject + * @param Product $product + * @return array + * @throws \Magento\Framework\Exception\LocalizedException + */ + public function beforeRepresentProduct( + WishlistItem $subject, + Product $product + ) { + if ($product->getTypeId() === TypeGrouped::TYPE_CODE + && $product->getId() === $subject->getProduct()->getId() + ) { + $itemOptions = $subject->getOptionsByCode(); + $productOptions = $product->getCustomOptions(); + + $diff = array_diff_key($itemOptions, $productOptions); + + if (!$diff) { + $buyRequest = $subject->getBuyRequest(); + $superGroupInfo = $buyRequest->getData('super_group'); + + foreach ($itemOptions as $key => $itemOption) { + if (preg_match('/associated_product_\d+/', $key)) { + $simpleId = str_replace('associated_product_', '', $key); + $prodQty = $productOptions[$key]->getValue(); + + $itemOption->setValue($itemOption->getValue() + $prodQty); + + if (isset($superGroupInfo[$simpleId])) { + $superGroupInfo[$simpleId] = $itemOptions[$key]->getValue(); + } + } + } + + $buyRequest->setData('super_group', $superGroupInfo); + + $subject->setOptions($itemOptions); + $subject->mergeBuyRequest($buyRequest); + } + } + + return [$product]; + } + + /** + * Remove associated_product_id key. associated_product_id contains qty + * + * @param WishlistItem $subject + * @param array $options1 + * @param array $options2 + * @return array + */ + public function beforeCompareOptions( + WishlistItem $subject, + $options1, + $options2 + ) { + $diff = array_diff_key($options1, $options2); + + if (!$diff) { + foreach ($options1 as $key => $val) { + if (preg_match('/associated_product_\d+/', $key)) { + unset($options1[$key]); + unset($options2[$key]); + } + } + } + + return [$options1, $options2]; + } +} diff --git a/app/code/Magento/GroupedProduct/Test/Unit/Model/Wishlist/Product/ItemTest.php b/app/code/Magento/GroupedProduct/Test/Unit/Model/Wishlist/Product/ItemTest.php new file mode 100644 index 0000000000000..7929c50eb487d --- /dev/null +++ b/app/code/Magento/GroupedProduct/Test/Unit/Model/Wishlist/Product/ItemTest.php @@ -0,0 +1,179 @@ +<?php +/** + * + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\GroupedProduct\Test\Unit\Model\Wishlist\Product; + +use Magento\GroupedProduct\Model\Product\Type\Grouped as TypeGrouped; + +/** + * Unit test for Wishlist Item Plugin. + */ +class ItemTest extends \PHPUnit\Framework\TestCase +{ + /** + * @var \Magento\GroupedProduct\Model\Wishlist\Product\Item + */ + protected $model; + + /** + * @var \Magento\Catalog\Model\Product|\PHPUnit_Framework_MockObject_MockObject + */ + protected $productMock; + + /** + * @var \Magento\Wishlist\Model\Item|\PHPUnit_Framework_MockObject_MockObject + */ + protected $subjectMock; + + /** + * Init Mock Objects + */ + protected function setUp() + { + $this->subjectMock = $this->createPartialMock( + \Magento\Wishlist\Model\Item::class, + [ + 'getOptionsByCode', + 'getBuyRequest', + 'setOptions', + 'mergeBuyRequest', + 'getProduct' + ] + ); + + $this->productMock = $this->createPartialMock( + \Magento\Catalog\Model\Product::class, + [ + 'getId', + 'getTypeId', + 'getCustomOptions' + ] + ); + + $this->model = new \Magento\GroupedProduct\Model\Wishlist\Product\Item(); + } + + /** + * Test Before Represent Product method + */ + public function testBeforeRepresentProduct() + { + $superGroup = [ + 'super_group' => [ + 33 => "0", + 34 => 3, + 35 => "0" + ] + ]; + + $superGroupObj = new \Magento\Framework\DataObject($superGroup); + + $this->productMock->expects($this->once())->method('getId')->willReturn(34); + $this->productMock->expects($this->once())->method('getTypeId') + ->willReturn(TypeGrouped::TYPE_CODE); + $this->productMock->expects($this->once())->method('getCustomOptions') + ->willReturn( + $this->getProductAssocOption(2, 34) + ); + + $wishlistItemProductMock = $this->createPartialMock( + \Magento\Catalog\Model\Product::class, + [ + 'getId', + ] + ); + $wishlistItemProductMock->expects($this->once())->method('getId')->willReturn(34); + + $this->subjectMock->expects($this->once())->method('getProduct') + ->willReturn($wishlistItemProductMock); + $this->subjectMock->expects($this->once())->method('getOptionsByCode') + ->willReturn( + $this->getWishlistAssocOption(3, 5, 34) + ); + $this->subjectMock->expects($this->once())->method('getBuyRequest')->willReturn($superGroupObj); + + $this->model->beforeRepresentProduct($this->subjectMock, $this->productMock); + } + + /** + * Test Before Compare Options method with same keys + */ + public function testBeforeCompareOptionsSameKeys() + { + $options1 = ['associated_product_34' => 3]; + $options2 = ['associated_product_34' => 2]; + + $res = $this->model->beforeCompareOptions($this->subjectMock, $options1, $options2); + + $this->assertEquals([], $res[0]); + $this->assertEquals([], $res[1]); + } + + /** + * Test Before Compare Options method with diff keys + */ + public function testBeforeCompareOptionsDiffKeys() + { + $options1 = ['associated_product_1' => 3]; + $options2 = ['associated_product_34' => 2]; + + $res = $this->model->beforeCompareOptions($this->subjectMock, $options1, $options2); + + $this->assertEquals($options1, $res[0]); + $this->assertEquals($options2, $res[1]); + } + + /** + * Return mock array with wishlist options + * + * @param int $initVal + * @param int $resVal + * @param int $prodId + * @return array + */ + private function getWishlistAssocOption($initVal, $resVal, $prodId) + { + $items = []; + + $optionMock = $this->createPartialMock( + \Magento\Wishlist\Model\Item\Option::class, + [ + 'getValue', + ] + ); + $optionMock->expects($this->at(0))->method('getValue')->willReturn($initVal); + $optionMock->expects($this->at(1))->method('getValue')->willReturn($resVal); + + $items['associated_product_' . $prodId] = $optionMock; + + return $items; + } + + /** + * Return mock array with product options + * + * @param int $initVal + * @param int $prodId + * @return array + */ + private function getProductAssocOption($initVal, $prodId) + { + $items = []; + + $optionMock = $this->createPartialMock( + \Magento\Catalog\Model\Product\Configuration\Item\Option::class, + [ + 'getValue', + ] + ); + + $optionMock->expects($this->once())->method('getValue')->willReturn($initVal); + + $items['associated_product_' . $prodId] = $optionMock; + + return $items; + } +} diff --git a/app/code/Magento/GroupedProduct/etc/frontend/di.xml b/app/code/Magento/GroupedProduct/etc/frontend/di.xml new file mode 100644 index 0000000000000..21ed87e91cb6c --- /dev/null +++ b/app/code/Magento/GroupedProduct/etc/frontend/di.xml @@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<!-- +/** + * 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:ObjectManager/etc/config.xsd"> + <type name="Magento\Wishlist\Model\Item"> + <plugin name="groupedProductWishlistProcessor" type="Magento\GroupedProduct\Model\Wishlist\Product\Item" /> + </type> +</config> From 2819c7c65f9cb74785d891f9b354c91aaec343fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Sat, 4 Jan 2020 17:07:23 +0100 Subject: [PATCH 0646/1143] Fix invalid Schema location --- .../Test/Mftf/Section/CaptchaFormsDisplayingSection.xml | 2 +- .../Magento/Catalog/Test/Mftf/Metadata/image_content-meta.xml | 2 +- .../ActionGroup/FilterOrderStatusByLabelAndCodeActionGroup.xml | 2 +- .../Test/Mftf/ActionGroup/SelectActionForOrdersActionGroup.xml | 2 +- .../Sales/Test/Mftf/Page/StorefrontCustomerSignOutPage.xml | 2 +- .../Sales/Test/Mftf/Page/StorefrontSalesOrderPrintPage.xml | 2 +- .../Magento/Sales/Test/Mftf/Section/SalesOrderPrintSection.xml | 2 +- .../Magento/Store/Test/Mftf/Data/StorePaymentMethodsData.xml | 3 ++- .../Magento/Store/Test/Mftf/Data/StoreShippingMethodsData.xml | 3 ++- .../Store/Test/Mftf/Metadata/store_payment_methods-meta.xml | 2 +- .../Store/Test/Mftf/Metadata/store_shipping_methods-meta.xml | 2 +- .../Magento/Tax/Test/Mftf/Section/AdminTaxReportsSection.xml | 2 +- 12 files changed, 14 insertions(+), 12 deletions(-) diff --git a/app/code/Magento/Captcha/Test/Mftf/Section/CaptchaFormsDisplayingSection.xml b/app/code/Magento/Captcha/Test/Mftf/Section/CaptchaFormsDisplayingSection.xml index 4c974e6fced05..9103c4191544c 100644 --- a/app/code/Magento/Captcha/Test/Mftf/Section/CaptchaFormsDisplayingSection.xml +++ b/app/code/Magento/Captcha/Test/Mftf/Section/CaptchaFormsDisplayingSection.xml @@ -7,7 +7,7 @@ --> <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"> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="CaptchaFormsDisplayingSection"> <element name="store" type="button" selector="#menu-magento-backend-stores"/> <element name="config" type="button" selector="//li[@data-ui-id='menu-magento-config-system-config']//span"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Metadata/image_content-meta.xml b/app/code/Magento/Catalog/Test/Mftf/Metadata/image_content-meta.xml index 8b12a2fbbbc5d..ac75a819548ae 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Metadata/image_content-meta.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Metadata/image_content-meta.xml @@ -7,7 +7,7 @@ --> <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"> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataOperation.xsd"> <operation name="CreateImageContent" dataType="ImageContent" type="create"> <field key="base64_encoded_data" required="true">string</field> <field key="type" required="true">string</field> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/FilterOrderStatusByLabelAndCodeActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/FilterOrderStatusByLabelAndCodeActionGroup.xml index 96e562cb95c6f..06ff1597dc608 100644 --- a/app/code/Magento/Sales/Test/Mftf/ActionGroup/FilterOrderStatusByLabelAndCodeActionGroup.xml +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/FilterOrderStatusByLabelAndCodeActionGroup.xml @@ -7,7 +7,7 @@ --> <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"> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="FilterOrderStatusByLabelAndCodeActionGroup"> <arguments> <argument name="statusLabel" type="string"/> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/SelectActionForOrdersActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/SelectActionForOrdersActionGroup.xml index 073eb03b11bfa..4351c44ed75aa 100644 --- a/app/code/Magento/Sales/Test/Mftf/ActionGroup/SelectActionForOrdersActionGroup.xml +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/SelectActionForOrdersActionGroup.xml @@ -7,7 +7,7 @@ --> <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"> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="SelectActionForOrdersActionGroup"> <arguments> <argument name="action" type="string"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Page/StorefrontCustomerSignOutPage.xml b/app/code/Magento/Sales/Test/Mftf/Page/StorefrontCustomerSignOutPage.xml index 4e89e5476c3bc..0cfc9f2231f85 100644 --- a/app/code/Magento/Sales/Test/Mftf/Page/StorefrontCustomerSignOutPage.xml +++ b/app/code/Magento/Sales/Test/Mftf/Page/StorefrontCustomerSignOutPage.xml @@ -7,6 +7,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"> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> <page name="StorefrontCustomerSignOutPage" url="/customer/account/logout/" area="storefront" module="Magento_Customer"/> </pages> diff --git a/app/code/Magento/Sales/Test/Mftf/Page/StorefrontSalesOrderPrintPage.xml b/app/code/Magento/Sales/Test/Mftf/Page/StorefrontSalesOrderPrintPage.xml index 874e6889ec58c..437449aa887d2 100644 --- a/app/code/Magento/Sales/Test/Mftf/Page/StorefrontSalesOrderPrintPage.xml +++ b/app/code/Magento/Sales/Test/Mftf/Page/StorefrontSalesOrderPrintPage.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"> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> <page name="StorefrontSalesOrderPrintPage" url="/sales/order/print/order_id/{{var1}}/" parameterized="true" area="storefront" module="Magento_Sales"> <section name="SalesOrderPrintSection"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Section/SalesOrderPrintSection.xml b/app/code/Magento/Sales/Test/Mftf/Section/SalesOrderPrintSection.xml index b08a66140fabf..7c1d7319e30ea 100644 --- a/app/code/Magento/Sales/Test/Mftf/Section/SalesOrderPrintSection.xml +++ b/app/code/Magento/Sales/Test/Mftf/Section/SalesOrderPrintSection.xml @@ -7,7 +7,7 @@ --> <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"> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="SalesOrderPrintSection"> <element name="isOrderPrintPage" type="block" selector=".preview-area"/> </section> diff --git a/app/code/Magento/Store/Test/Mftf/Data/StorePaymentMethodsData.xml b/app/code/Magento/Store/Test/Mftf/Data/StorePaymentMethodsData.xml index 912399142fa61..27a6150b95798 100644 --- a/app/code/Magento/Store/Test/Mftf/Data/StorePaymentMethodsData.xml +++ b/app/code/Magento/Store/Test/Mftf/Data/StorePaymentMethodsData.xml @@ -5,7 +5,8 @@ * 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"> +<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> <entity name="PaymentMethodsSettingConfig" type="zero_subtotal_checkout_config_state"> <requiredEntity type="active">active</requiredEntity> <requiredEntity type="order_status">orderStatus</requiredEntity> diff --git a/app/code/Magento/Store/Test/Mftf/Data/StoreShippingMethodsData.xml b/app/code/Magento/Store/Test/Mftf/Data/StoreShippingMethodsData.xml index 11b8931618f70..3b749928308bd 100644 --- a/app/code/Magento/Store/Test/Mftf/Data/StoreShippingMethodsData.xml +++ b/app/code/Magento/Store/Test/Mftf/Data/StoreShippingMethodsData.xml @@ -5,7 +5,8 @@ * 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"> +<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> <entity name="FreeShippingMethodsSettingConfig" type="free_shipping_config_state"> <requiredEntity type="active">active</requiredEntity> </entity> diff --git a/app/code/Magento/Store/Test/Mftf/Metadata/store_payment_methods-meta.xml b/app/code/Magento/Store/Test/Mftf/Metadata/store_payment_methods-meta.xml index cbad7265cbbd6..1995dceb3bf0b 100644 --- a/app/code/Magento/Store/Test/Mftf/Metadata/store_payment_methods-meta.xml +++ b/app/code/Magento/Store/Test/Mftf/Metadata/store_payment_methods-meta.xml @@ -7,7 +7,7 @@ --> <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"> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataOperation.xsd"> <operation name="EnableZeroSubtotalCheckoutConfigState" dataType="zero_subtotal_checkout_config_state" type="create" auth="adminFormKey" url="/admin/system_config/save/section/payment/" method="POST"> <object key="groups" dataType="zero_subtotal_checkout_config_state"> <object key="free" dataType="zero_subtotal_checkout_config_state"> diff --git a/app/code/Magento/Store/Test/Mftf/Metadata/store_shipping_methods-meta.xml b/app/code/Magento/Store/Test/Mftf/Metadata/store_shipping_methods-meta.xml index 6f88bca760204..091d0ae673f7a 100644 --- a/app/code/Magento/Store/Test/Mftf/Metadata/store_shipping_methods-meta.xml +++ b/app/code/Magento/Store/Test/Mftf/Metadata/store_shipping_methods-meta.xml @@ -7,7 +7,7 @@ --> <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"> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataOperation.xsd"> <operation name="EnableFreeShippingConfigState" dataType="free_shipping_config_state" type="create" auth="adminFormKey" url="/admin/system_config/save/section/carriers/" method="POST"> <object key="groups" dataType="free_shipping_config_state"> <object key="freeshipping" dataType="free_shipping_config_state"> diff --git a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxReportsSection.xml b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxReportsSection.xml index 80101687e173e..71bc4cbceff83 100644 --- a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxReportsSection.xml +++ b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxReportsSection.xml @@ -7,7 +7,7 @@ --> <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"> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminTaxReportsSection"> <element name="refreshStatistics" type="button" selector="//a[contains(text(),'here')]"/> <element name="fromDate" type="input" selector="#sales_report_from"/> From f076e553211d4e6a4a9ffdd48b0521ab0ee3bf38 Mon Sep 17 00:00:00 2001 From: lfolco <me@laurafolco.com> Date: Sat, 4 Jan 2020 14:57:30 -0500 Subject: [PATCH 0647/1143] Update SOAP tests to test changed functionality (#19093) --- .../Api/OrderGetRepositoryTest.php | 6 ++---- .../Api/OrderItemGetRepositoryTest.php | 20 ++++--------------- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/GiftMessage/Api/OrderGetRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/GiftMessage/Api/OrderGetRepositoryTest.php index 7ae7e200cfb5b..91d1954581da7 100644 --- a/dev/tests/api-functional/testsuite/Magento/GiftMessage/Api/OrderGetRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GiftMessage/Api/OrderGetRepositoryTest.php @@ -12,9 +12,7 @@ class OrderGetRepositoryTest extends WebapiAbstract { const SERVICE_VERSION = 'V1'; - - const SERVICE_NAME = 'giftMessageItemRepositoryV1'; - + const SERVICE_NAME = 'salesOrderRepositoryV1'; const RESOURCE_PATH = '/V1/orders/'; /** @@ -45,7 +43,7 @@ public function testGet() 'sender' => 'Romeo', 'message' => 'I thought all for the best.', ]; - $requestData = ["orderId" => $orderId]; + $requestData = ['id' => $orderId]; $result = $this->_webApiCall($serviceInfo, $requestData); $resultMessage = $result['extension_attributes']['gift_message']; static::assertCount(5, $resultMessage); diff --git a/dev/tests/api-functional/testsuite/Magento/GiftMessage/Api/OrderItemGetRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/GiftMessage/Api/OrderItemGetRepositoryTest.php index f68b50b7746eb..074133835f6da 100644 --- a/dev/tests/api-functional/testsuite/Magento/GiftMessage/Api/OrderItemGetRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GiftMessage/Api/OrderItemGetRepositoryTest.php @@ -11,23 +11,10 @@ class OrderItemGetRepositoryTest extends WebapiAbstract { - const SERVICE_VERSION = 'V1'; - - const SERVICE_NAME = 'giftMessageItemRepositoryV1'; - + const SERVICE_NAME = 'salesOrderItemRepositoryV1'; const RESOURCE_PATH = '/V1/orders/items/'; - /** - * @var \Magento\TestFramework\ObjectManager - */ - protected $objectManager; - - protected function setUp() - { - $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - } - /** * @magentoDataFixture Magento/GiftMessage/_files/order_with_message.php * @magentoConfigFixture default_store sales/gift_options/allow_items 1 @@ -36,8 +23,9 @@ protected function setUp() */ public function testGet() { + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); /** @var \Magento\Sales\Model\Order $order */ - $order = $this->objectManager->create(\Magento\Sales\Model\Order::class)->loadByIncrementId('100000001'); + $order = $objectManager->create(\Magento\Sales\Model\Order::class)->loadByIncrementId('100000001'); $items = $order->getItems(); /** @var \Magento\Sales\Api\Data\OrderItemInterface $orderItem */ $orderItem = array_shift($items); @@ -58,7 +46,7 @@ public function testGet() 'sender' => 'Romeo', 'message' => 'I thought all for the best.', ]; - $requestData = ["orderItemId" => $itemId]; + $requestData = ['id' => $itemId]; $result = $this->_webApiCall($serviceInfo, $requestData); $resultMessage = $result['extension_attributes']['gift_message']; static::assertCount(5, $resultMessage); From fe984387fc73f559599f27798642e5c22b55ae62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Szubert?= <bartlomiejszubert@gmail.com> Date: Sat, 4 Jan 2020 22:38:32 +0100 Subject: [PATCH 0648/1143] Fix #14913 - bookmark views become uneditable after deleting the first bookmark view --- .../grid/controls/bookmarks/bookmarks.html | 6 ++--- .../grid/controls/bookmarks/view.html | 22 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/templates/grid/controls/bookmarks/bookmarks.html b/app/code/Magento/Ui/view/base/web/templates/grid/controls/bookmarks/bookmarks.html index 36a3232c3e61a..6d50ed7e5bd03 100644 --- a/app/code/Magento/Ui/view/base/web/templates/grid/controls/bookmarks/bookmarks.html +++ b/app/code/Magento/Ui/view/base/web/templates/grid/controls/bookmarks/bookmarks.html @@ -9,9 +9,9 @@ <span class="admin__action-dropdown-text" translate="activeView.label"/> </button> <ul class="admin__action-dropdown-menu"> - <repeat args="foreach: viewsArray, item: '$view'"> - <li css="_edit: isEditing($view().index)" outerClick="endEdit.bind($data, $view().index)" template="viewTmpl"/> - </repeat> + <!-- ko foreach: { data: viewsArray, as: '$view'} --> + <li css="_edit: $parent.isEditing($view.index)" outerClick="$parent.endEdit.bind($parent, $view.index)" template="$parent.viewTmpl"/> + <!-- /ko --> <li visible="hasChanges" outerClick="hideCustom.bind($data)" css=" _edit: customVisible, diff --git a/app/code/Magento/Ui/view/base/web/templates/grid/controls/bookmarks/view.html b/app/code/Magento/Ui/view/base/web/templates/grid/controls/bookmarks/view.html index 521ce9fc806ac..1262fce544599 100644 --- a/app/code/Magento/Ui/view/base/web/templates/grid/controls/bookmarks/view.html +++ b/app/code/Magento/Ui/view/base/web/templates/grid/controls/bookmarks/view.html @@ -4,36 +4,36 @@ * See COPYING.txt for license details. */ --> -<div class="action-dropdown-menu-item-edit" if="$view().editable"> +<div class="action-dropdown-menu-item-edit" if="$view.editable"> <input class="admin__control-text" data-bind=" - value: $view().value, - hasFocus: isEditing($view().index), + value: $view.value, + hasFocus: $parent.isEditing($view.index), autoselect, attr: { - placeholder: $view().label + placeholder: $view.label }, keyboard: { - 13: updateAndSave.bind($data, $view().index), - 27: endEdit.bind($data, $view().index) + 13: $parent.updateAndSave.bind($parent, $view.index), + 27: $parent.endEdit.bind($parent, $view.index) }" type="text"> - <button class="action-submit" type="button" attr="title: $t('Save all changes')" click="updateAndSave.bind($data, $view().index)"> + <button class="action-submit" type="button" attr="title: $t('Save all changes')" click="$parent.updateAndSave.bind($parent, $view.index)"> <span translate="'Submit'"/> </button> <div class="action-dropdown-menu-item-actions"> - <button class="action-delete" type="button" attr="title: $t('Delete bookmark')" click="removeView.bind($data, $view().index)"> + <button class="action-delete" type="button" attr="title: $t('Delete bookmark')" click="$parent.removeView.bind($parent, $view.index)"> <span translate="'Delete'"/> </button> </div> </div> <div class="action-dropdown-menu-item"> - <a href="" class="action-dropdown-menu-link" translate="$view().label" click="applyView.bind($data, $view().index)" closeCollapsible/> + <a href="" class="action-dropdown-menu-link" translate="$view.label" click="$parent.applyView.bind($parent, $view.index)" closeCollapsible/> - <div class="action-dropdown-menu-item-actions" if="$view().editable"> - <button class="action-edit" type="button" attr="title: $t('Edit bookmark')" click="editView.bind($data, $view().index)"> + <div class="action-dropdown-menu-item-actions" if="$view.editable"> + <button class="action-edit" type="button" attr="title: $t('Edit bookmark')" click="$parent.editView.bind($parent, $view.index)"> <span translate="'Edit'"/> </button> </div> From b015b65baa6d54dbffd85f11e37d62ca1a28d5da Mon Sep 17 00:00:00 2001 From: aleromano89 <alx.romano89@gmail.com> Date: Sat, 4 Jan 2020 23:20:19 +0100 Subject: [PATCH 0649/1143] fix issue #23521 --- .../Downloadable/Test/Unit/Helper/DownloadTest.php | 6 +++++- .../Downloadable/Test/Unit/_files/download_mock.php | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Downloadable/Test/Unit/Helper/DownloadTest.php b/app/code/Magento/Downloadable/Test/Unit/Helper/DownloadTest.php index 9551cfe982bd5..d4ebf0a7e3fb9 100644 --- a/app/code/Magento/Downloadable/Test/Unit/Helper/DownloadTest.php +++ b/app/code/Magento/Downloadable/Test/Unit/Helper/DownloadTest.php @@ -17,7 +17,10 @@ */ class DownloadTest extends \PHPUnit\Framework\TestCase { - /** @var DownloadHelper */ + /** @var array Result of get_headers() function */ + public static $headers; + + /** @var DownloadHelper */ protected $_helper; /** @var Filesystem|\PHPUnit_Framework_MockObject_MockObject */ @@ -230,6 +233,7 @@ protected function _setupUrlMocks($size = self::FILE_SIZE, $url = self::URL, $ad $this->returnValue($this->_handleMock) ); + self::$headers = ['200 OK']; $this->_helper->setResource($url, DownloadHelper::LINK_TYPE_URL); } diff --git a/app/code/Magento/Downloadable/Test/Unit/_files/download_mock.php b/app/code/Magento/Downloadable/Test/Unit/_files/download_mock.php index e634f0ffa341d..bb3c4715a48e4 100644 --- a/app/code/Magento/Downloadable/Test/Unit/_files/download_mock.php +++ b/app/code/Magento/Downloadable/Test/Unit/_files/download_mock.php @@ -22,3 +22,13 @@ function mime_content_type() { return DownloadTest::$mimeContentType; } + +/** + * Override standard function + * + * @return array + */ +function get_headers() +{ + return DownloadTest::$headers; +} From 5fe745450451d43764281da227bf70e2aaec5735 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Szubert?= <bartlomiejszubert@gmail.com> Date: Sun, 5 Jan 2020 11:28:05 +0100 Subject: [PATCH 0650/1143] Fix #14001 - M2.2.3 directory_country_region_name locale fix? 8bytes zh_Hans_CN(11bytes) ca_ES_VALENCIA(14bytes) --- app/code/Magento/Directory/etc/db_schema.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Directory/etc/db_schema.xml b/app/code/Magento/Directory/etc/db_schema.xml index 163e972423b98..a9fb2c536a3fd 100644 --- a/app/code/Magento/Directory/etc/db_schema.xml +++ b/app/code/Magento/Directory/etc/db_schema.xml @@ -45,7 +45,7 @@ </table> <table name="directory_country_region_name" resource="default" engine="innodb" comment="Directory Country Region Name"> - <column xsi:type="varchar" name="locale" nullable="false" length="8" comment="Locale"/> + <column xsi:type="varchar" name="locale" nullable="false" length="16" comment="Locale"/> <column xsi:type="int" name="region_id" padding="10" unsigned="true" nullable="false" identity="false" default="0" comment="Region ID"/> <column xsi:type="varchar" name="name" nullable="true" length="255" comment="Region Name"/> From bb16e33f41d14fac93ae93e56b051f485e0d53d2 Mon Sep 17 00:00:00 2001 From: Marco Oliveira <marcoaacoliveira@gmail.com> Date: Sun, 5 Jan 2020 11:54:14 -0300 Subject: [PATCH 0651/1143] Solving #22964 It was needed to change the appendTimeIfNeeded, because isn't right to transform DateTime without hour into with hour just appending a string in the end of other string. --- .../Framework/Stdlib/DateTime/Timezone.php | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php b/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php index 118a3e053bd79..2e4ef10a76141 100644 --- a/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php +++ b/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php @@ -182,7 +182,7 @@ public function date($date = null, $locale = null, $useTimezone = true, $include new \DateTimeZone($timezone) ); - $date = $this->appendTimeIfNeeded($date, $includeTime); + $date = $this->appendTimeIfNeeded($date, $includeTime, $timezone, $locale); $date = $formatter->parse($date) ?: (new \DateTime($date))->getTimestamp(); break; } @@ -347,16 +347,31 @@ public function convertConfigTimeToUtc($date, $format = 'Y-m-d H:i:s') } /** - * Retrieve date with time - * * @param string $date - * @param bool $includeTime + * @param boolean $includeTime + * @param string $timezone + * @param string $locale * @return string */ - private function appendTimeIfNeeded($date, $includeTime) + private function appendTimeIfNeeded($date, $includeTime, $timezone, $locale) { if ($includeTime && !preg_match('/\d{1}:\d{2}/', $date)) { - $date .= " 0:00am"; + + $formatterWithoutHour = new \IntlDateFormatter( + $locale, + \IntlDateFormatter::SHORT, + \IntlDateFormatter::NONE, + new \DateTimeZone($timezone) + ); + $convertedDate = $formatterWithoutHour->parse($date); + $formatterWithHour = new \IntlDateFormatter( + $locale, + \IntlDateFormatter::SHORT, + \IntlDateFormatter::SHORT, + new \DateTimeZone($timezone) + ); + + $date = $formatterWithHour->format($convertedDate); } return $date; } From 05ecfda9c34698c670ff8fc302632e52fe82f9de Mon Sep 17 00:00:00 2001 From: aleromano89 <alx.romano89@gmail.com> Date: Sun, 5 Jan 2020 16:57:41 +0100 Subject: [PATCH 0652/1143] fix indentation --- .../Downloadable/Test/Unit/Helper/DownloadTest.php | 8 ++++---- .../Downloadable/Test/Unit/_files/download_mock.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Downloadable/Test/Unit/Helper/DownloadTest.php b/app/code/Magento/Downloadable/Test/Unit/Helper/DownloadTest.php index d4ebf0a7e3fb9..f90c3f27b27c7 100644 --- a/app/code/Magento/Downloadable/Test/Unit/Helper/DownloadTest.php +++ b/app/code/Magento/Downloadable/Test/Unit/Helper/DownloadTest.php @@ -17,10 +17,10 @@ */ class DownloadTest extends \PHPUnit\Framework\TestCase { - /** @var array Result of get_headers() function */ - public static $headers; + /** @var array Result of get_headers() function */ + public static $headers; - /** @var DownloadHelper */ + /** @var DownloadHelper */ protected $_helper; /** @var Filesystem|\PHPUnit_Framework_MockObject_MockObject */ @@ -233,7 +233,7 @@ protected function _setupUrlMocks($size = self::FILE_SIZE, $url = self::URL, $ad $this->returnValue($this->_handleMock) ); - self::$headers = ['200 OK']; + self::$headers = ['200 OK']; $this->_helper->setResource($url, DownloadHelper::LINK_TYPE_URL); } diff --git a/app/code/Magento/Downloadable/Test/Unit/_files/download_mock.php b/app/code/Magento/Downloadable/Test/Unit/_files/download_mock.php index bb3c4715a48e4..7ab3bc939f4d0 100644 --- a/app/code/Magento/Downloadable/Test/Unit/_files/download_mock.php +++ b/app/code/Magento/Downloadable/Test/Unit/_files/download_mock.php @@ -30,5 +30,5 @@ function mime_content_type() */ function get_headers() { - return DownloadTest::$headers; + return DownloadTest::$headers; } From d12ac2178592c7a999e14e04b98b6f319357a725 Mon Sep 17 00:00:00 2001 From: Marco Oliveira <marcoaacoliveira@gmail.com> Date: Sun, 5 Jan 2020 13:31:28 -0300 Subject: [PATCH 0653/1143] Fixing code style and creating new cases tests. --- .../Magento/Framework/Stdlib/DateTime/Timezone.php | 2 ++ .../Stdlib/Test/Unit/DateTime/TimezoneTest.php | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php b/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php index 2e4ef10a76141..70435df54aa68 100644 --- a/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php +++ b/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php @@ -347,6 +347,8 @@ public function convertConfigTimeToUtc($date, $format = 'Y-m-d H:i:s') } /** + * Append time to DateTime + * * @param string $date * @param boolean $includeTime * @param string $timezone diff --git a/lib/internal/Magento/Framework/Stdlib/Test/Unit/DateTime/TimezoneTest.php b/lib/internal/Magento/Framework/Stdlib/Test/Unit/DateTime/TimezoneTest.php index 53980e574c267..fef6bbbbddb54 100644 --- a/lib/internal/Magento/Framework/Stdlib/Test/Unit/DateTime/TimezoneTest.php +++ b/lib/internal/Magento/Framework/Stdlib/Test/Unit/DateTime/TimezoneTest.php @@ -128,6 +128,18 @@ public function dateIncludeTimeDataProvider(): array true, // include time 1495170060 // expected timestamp ], + 'Parse greek d/m/y date without time' => [ + '30/10/2021', // datetime + 'el_GR', // locale + false, // include time + 1635552000 // expected timestamp + ], + 'Parse greek d/m/y date with time' => [ + '30/10/21, 12:00 π.μ.', // datetime + 'el_GR', // locale + true, // include time + 1635552000 // expected timestamp + ], ]; } From 32be47258b96b18f8f589635ff4bd22a6aeabe32 Mon Sep 17 00:00:00 2001 From: Marco Oliveira <marcoaacoliveira@gmail.com> Date: Sun, 5 Jan 2020 14:50:32 -0300 Subject: [PATCH 0654/1143] Changing timestamp to correspond to Chicago TimeZone --- .../Framework/Stdlib/Test/Unit/DateTime/TimezoneTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/internal/Magento/Framework/Stdlib/Test/Unit/DateTime/TimezoneTest.php b/lib/internal/Magento/Framework/Stdlib/Test/Unit/DateTime/TimezoneTest.php index fef6bbbbddb54..1de5fc8967bd7 100644 --- a/lib/internal/Magento/Framework/Stdlib/Test/Unit/DateTime/TimezoneTest.php +++ b/lib/internal/Magento/Framework/Stdlib/Test/Unit/DateTime/TimezoneTest.php @@ -132,13 +132,13 @@ public function dateIncludeTimeDataProvider(): array '30/10/2021', // datetime 'el_GR', // locale false, // include time - 1635552000 // expected timestamp + 1635570000 // expected timestamp ], 'Parse greek d/m/y date with time' => [ - '30/10/21, 12:00 π.μ.', // datetime + '30/10/2021, 12:00 π.μ.', // datetime 'el_GR', // locale true, // include time - 1635552000 // expected timestamp + 1635570000 // expected timestamp ], ]; } From 6a19b1297a7f740ecb4cedcd4afbd6a42e70904a Mon Sep 17 00:00:00 2001 From: Marco Oliveira <marcoaacoliveira@gmail.com> Date: Sun, 5 Jan 2020 15:02:59 -0300 Subject: [PATCH 0655/1143] Making test similar to others. --- .../Framework/Stdlib/Test/Unit/DateTime/TimezoneTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Stdlib/Test/Unit/DateTime/TimezoneTest.php b/lib/internal/Magento/Framework/Stdlib/Test/Unit/DateTime/TimezoneTest.php index 1de5fc8967bd7..566992c70b5e3 100644 --- a/lib/internal/Magento/Framework/Stdlib/Test/Unit/DateTime/TimezoneTest.php +++ b/lib/internal/Magento/Framework/Stdlib/Test/Unit/DateTime/TimezoneTest.php @@ -135,10 +135,10 @@ public function dateIncludeTimeDataProvider(): array 1635570000 // expected timestamp ], 'Parse greek d/m/y date with time' => [ - '30/10/2021, 12:00 π.μ.', // datetime + '30/10/2021, 12:01 π.μ.', // datetime 'el_GR', // locale true, // include time - 1635570000 // expected timestamp + 1635570060 // expected timestamp ], ]; } From 6e80158edd564a14d2643798584d3f9331b4fff9 Mon Sep 17 00:00:00 2001 From: Marco Oliveira <marcoaacoliveira@gmail.com> Date: Sun, 5 Jan 2020 16:59:24 -0300 Subject: [PATCH 0656/1143] Standardizing thrown exceptions --- .../Magento/Framework/Stdlib/DateTime/Timezone.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php b/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php index 70435df54aa68..533c4cc513e72 100644 --- a/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php +++ b/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php @@ -354,6 +354,7 @@ public function convertConfigTimeToUtc($date, $format = 'Y-m-d H:i:s') * @param string $timezone * @param string $locale * @return string + * @throws LocalizedException */ private function appendTimeIfNeeded($date, $includeTime, $timezone, $locale) { @@ -366,6 +367,16 @@ private function appendTimeIfNeeded($date, $includeTime, $timezone, $locale) new \DateTimeZone($timezone) ); $convertedDate = $formatterWithoutHour->parse($date); + + if (!$convertedDate) { + throw new LocalizedException( + new Phrase( + 'Could not append time to DateTime' + ) + ); + + } + $formatterWithHour = new \IntlDateFormatter( $locale, \IntlDateFormatter::SHORT, From 8ee89af88ec90b3992fb26b305ec63d39c0f4b2e Mon Sep 17 00:00:00 2001 From: Marco Oliveira <marcoaacoliveira@gmail.com> Date: Sun, 5 Jan 2020 20:28:55 -0300 Subject: [PATCH 0657/1143] Using MEDIUM size for dates in format so it doesn't lose anymore reference in 2099. --- lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php b/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php index 533c4cc513e72..e9873b39a6090 100644 --- a/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php +++ b/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php @@ -362,7 +362,7 @@ private function appendTimeIfNeeded($date, $includeTime, $timezone, $locale) $formatterWithoutHour = new \IntlDateFormatter( $locale, - \IntlDateFormatter::SHORT, + \IntlDateFormatter::MEDIUM, \IntlDateFormatter::NONE, new \DateTimeZone($timezone) ); @@ -379,7 +379,7 @@ private function appendTimeIfNeeded($date, $includeTime, $timezone, $locale) $formatterWithHour = new \IntlDateFormatter( $locale, - \IntlDateFormatter::SHORT, + \IntlDateFormatter::MEDIUM, \IntlDateFormatter::SHORT, new \DateTimeZone($timezone) ); From acf41666b7f4493b63469f4d436d7565dd1b9023 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Mon, 6 Jan 2020 06:15:32 +0100 Subject: [PATCH 0658/1143] Replace incorrect use of <amOnPage> with <actionGroup> for Admin log out --- .../Mftf/ActionGroup/AdminLogoutActionGroup.xml | 14 ++++++++++++++ .../Mftf/Test/PriceRuleCategoryNestingTest.xml | 2 +- ...omerWishListShareOptionsInputValidationTest.xml | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 app/code/Magento/Backend/Test/Mftf/ActionGroup/AdminLogoutActionGroup.xml diff --git a/app/code/Magento/Backend/Test/Mftf/ActionGroup/AdminLogoutActionGroup.xml b/app/code/Magento/Backend/Test/Mftf/ActionGroup/AdminLogoutActionGroup.xml new file mode 100644 index 0000000000000..de0def48a1f52 --- /dev/null +++ b/app/code/Magento/Backend/Test/Mftf/ActionGroup/AdminLogoutActionGroup.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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminLogoutActionGroup"> + <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/PriceRuleCategoryNestingTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/PriceRuleCategoryNestingTest.xml index 091e09e32f1e6..f99b19f4a6289 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/PriceRuleCategoryNestingTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/PriceRuleCategoryNestingTest.xml @@ -32,7 +32,7 @@ </before> <after> <deleteData createDataKey="subcategory1" stepKey="deleteCategory1"/> - <amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}/admin/auth/logout/" stepKey="amOnLogoutPage"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!-- Login as admin and open page for creation new Price Rule --> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/AdminCustomerWishListShareOptionsInputValidationTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/AdminCustomerWishListShareOptionsInputValidationTest.xml index da51bdf917e37..32c16ff7f5a55 100755 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/AdminCustomerWishListShareOptionsInputValidationTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/AdminCustomerWishListShareOptionsInputValidationTest.xml @@ -26,7 +26,7 @@ <argument name="emailTextLengthLimit" value="{{Wishlist.default_email_text_length_limit}}"/> </actionGroup> <checkOption selector="{{WishListShareOptionsSection.useSystemValueForWishListEmailTextLimit}}" stepKey="checkUseSystemValueForWishListEmailTextLimit"/> - <amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <actionGroup ref="setEmailTextLengthLimitActionGroup" stepKey="setEmailTextLengthLimitToMin"> From bb39dd03c63515edda774146794e573cad351900 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Mon, 6 Jan 2020 06:34:10 +0100 Subject: [PATCH 0659/1143] Replace incorrect URLs in Tests and ActionGroups --- .../Test/Mftf/Test/StorefrontAdminEditDataTest.xml | 4 ++-- .../Mftf/Test/StorefrontEditBundleProductTest.xml | 4 ++-- .../Mftf/Test/AdminApplyTierPriceToProductTest.xml | 4 ++-- .../Test/AdminCheckPaginationInStorefrontTest.xml | 2 +- ...urableProductWithAssignedSimpleProductsTest.xml | 2 +- ...ogRuleForConfigurableProductWithOptionsTest.xml | 2 +- .../Mftf/Test/CheckCheckoutSuccessPageTest.xml | 2 +- .../ConfigAdminAccountSharingActionGroup.xml | 2 +- ...ProductWithTwoOptionsAssignedToCategoryTest.xml | 2 +- ...WithTwoOptionsWithoutAssignedToCategoryTest.xml | 2 +- .../SignUpNewUserFromStorefrontActionGroup.xml | 14 +++++++------- .../UpdateIndexerByScheduleActionGroup.xml | 2 +- .../ActionGroup/UpdateIndexerOnSaveActionGroup.xml | 2 +- .../VerifySubscribedNewsletterDisplayedTest.xml | 2 +- .../Mftf/ActionGroup/ClearCacheActionGroup.xml | 2 +- .../Mftf/ActionGroup/ClearPageCacheActionGroup.xml | 2 +- 16 files changed, 25 insertions(+), 25 deletions(-) diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAdminEditDataTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAdminEditDataTest.xml index 75e1fa5d7cd4d..05100284a3fe9 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAdminEditDataTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAdminEditDataTest.xml @@ -79,7 +79,7 @@ <waitForPageLoad stepKey="waitForElementAdded"/> <!-- Go to the shopping cart page and grab the value of the option title --> - <amOnPage url="/checkout/cart/" stepKey="onPageShoppingCart"/> + <amOnPage url="{{CheckoutCartPage.url}}" stepKey="onPageShoppingCart"/> <waitForPageLoad stepKey="waitForCartPageLoad"/> <grabTextFrom selector="{{CheckoutCartProductSection.nthBundleOptionName('1')}}" stepKey="grabTotalBefore"/> @@ -100,7 +100,7 @@ <see stepKey="assertSuccess2" selector="{{AdminProductMessagesSection.successMessage}}" userInput="You saved the product."/> <!-- Go to the shopping cart page and make sure the title has changed --> - <amOnPage url="/checkout/cart/" stepKey="onPageShoppingCart1"/> + <amOnPage url="{{CheckoutCartPage.url}}" stepKey="onPageShoppingCart1"/> <waitForPageLoad stepKey="waitForCartPageLoad1"/> <grabTextFrom selector="{{CheckoutCartProductSection.nthBundleOptionName('1')}}" stepKey="grabTotalAfter"/> <assertNotEquals expected="{$grabTotalBefore}" expectedType="string" actual="{$grabTotalAfter}" actualType="string" stepKey="assertNotEquals"/> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontEditBundleProductTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontEditBundleProductTest.xml index 0ac47a27f1f95..9dbd6e26bddc4 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontEditBundleProductTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontEditBundleProductTest.xml @@ -86,7 +86,7 @@ <waitForPageLoad stepKey="waitForElementAdded2"/> <!-- Go to the shopping cart page and edit the first product --> - <amOnPage url="/checkout/cart/" stepKey="onPageShoppingCart"/> + <amOnPage url="{{CheckoutCartPage.url}}" stepKey="onPageShoppingCart"/> <waitForPageLoad stepKey="waitForCartPageLoad"/> <waitForElementVisible stepKey="waitForInfoDropdown" selector="{{CheckoutCartSummarySection.total}}"/> <waitForPageLoad stepKey="waitForCartPageLoad3"/> @@ -104,7 +104,7 @@ <waitForPageLoad stepKey="waitForElementAdded3"/> <!-- Go to the shopping cart page --> - <amOnPage url="/checkout/cart/" stepKey="onPageShoppingCart2"/> + <amOnPage url="{{CheckoutCartPage.url}}" stepKey="onPageShoppingCart2"/> <waitForPageLoad stepKey="waitForCartPageLoad2"/> <!-- Assert that the options are both there and the proce no longer matches --> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminApplyTierPriceToProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminApplyTierPriceToProductTest.xml index 6edb7daf50026..4f1618e076642 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminApplyTierPriceToProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminApplyTierPriceToProductTest.xml @@ -60,7 +60,7 @@ <seeElement selector="{{StorefrontCategoryProductSection.productPriceFinal('90')}}" stepKey="assertProductFinalPriceIs90_1"/> <seeElement selector="{{StorefrontCategoryProductSection.productPriceLabel('Regular Price')}}" stepKey="assertRegularPriceLabel_1"/> <seeElement selector="{{StorefrontCategoryProductSection.productPriceOld('100')}}" stepKey="assertRegularPriceAmount_1"/> - <amOnPage url="customer/account/logout/" stepKey="logoutCustomer1"/> + <amOnPage url="{{StorefrontCustomerLogoutPage.url}}" stepKey="logoutCustomer1"/> <waitForPageLoad time="30" stepKey="waitForPageLoad2"/> <amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="navigateToCategoryPage2"/> <waitForPageLoad time="30" stepKey="waitForPageLoad3"/> @@ -116,7 +116,7 @@ <seeElement selector="{{StorefrontCategoryProductSection.productPriceFinal('100')}}" stepKey="assertProductFinalPriceIs100_2"/> <seeElement selector="{{StorefrontCategoryProductSection.productPriceLabel('As low as')}}" stepKey="assertAsLowAsPriceLabel_1"/> <seeElement selector="{{StorefrontCategoryProductSection.productPriceLinkAfterLabel('As low as', '82')}}" stepKey="assertPriceAfterAsLowAsLabel_1"/> - <amOnPage url="customer/account/logout/" stepKey="logoutCustomer2"/> + <amOnPage url="{{StorefrontCustomerLogoutPage.url}}" stepKey="logoutCustomer2"/> <waitForPageLoad time="30" stepKey="waitForPageLoad7"/> <amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="navigateToCategoryPage6"/> <waitForPageLoad time="30" stepKey="waitForPageLoad8"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckPaginationInStorefrontTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckPaginationInStorefrontTest.xml index 1b72458747067..6eb7b7ea456b3 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckPaginationInStorefrontTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckPaginationInStorefrontTest.xml @@ -115,7 +115,7 @@ <click selector="{{CatalogProductsSection.resetFilter}}" stepKey="clickOnResetFilter"/> <waitForPageLoad stepKey="waitForPageToLoad3"/> <selectOption selector="{{AdminProductGridFilterSection.productPerPage}}" userInput="30" stepKey="selectPagePerView"/> - <wait stepKey="waitFroPageToLoad1" time="30"/> + <waitForPageLoad stepKey="waitFroPageToLoad1" time="30"/> <fillField selector="{{AdminCategoryContentSection.productTableColumnName}}" userInput="pagi" stepKey="selectProduct1"/> <click selector="{{AdminCategoryContentSection.productSearch}}" stepKey="clickSearchButton"/> <waitForPageLoad stepKey="waitFroPageToLoad2"/> diff --git a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProductsTest.xml b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProductsTest.xml index 71ab764453b20..1bc794ae80cd7 100644 --- a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProductsTest.xml +++ b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProductsTest.xml @@ -258,7 +258,7 @@ </actionGroup> <!--Assert products prices in the cart --> - <amOnPage url="/checkout/cart/" stepKey="amOnShoppingCartPage"/> + <amOnPage url="{{CheckoutCartPage.url}}" stepKey="amOnShoppingCartPage"/> <waitForPageLoad stepKey="waitForShoppingCartPageLoad"/> <see userInput="$210.69" selector="{{CheckoutCartProductSection.ProductPriceByOption($$createFirstConfigProductAttributeFirstOption.option[store_labels][1][label]$$)}}" stepKey="assertFirstProductPriceForFirstProductOption"/> <see userInput="$120.70" selector="{{CheckoutCartProductSection.ProductPriceByOption($$createFirstConfigProductAttributeSecondOption.option[store_labels][1][label]$$)}}" stepKey="assertFirstProductPriceForSecondProductOption"/> diff --git a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptionsTest.xml b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptionsTest.xml index bfe7aadeca5ec..fcf5e2c038047 100644 --- a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptionsTest.xml +++ b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptionsTest.xml @@ -212,7 +212,7 @@ </actionGroup> <!--Assert product price in the cart --> - <amOnPage url="/checkout/cart/" stepKey="amOnShoppingCartPage"/> + <amOnPage url="{{CheckoutCartPage.url}}" stepKey="amOnShoppingCartPage"/> <waitForPageLoad stepKey="waitForShoppingCartPageLoad"/> <see userInput="{{CatalogRuleToFixed.discount_amount}}" selector="{{CheckoutCartProductSection.ProductPriceByOption($$createConfigProductAttributeFirstOption.option[store_labels][1][label]$$)}}" stepKey="assertProductPriceForFirstProductOption"/> <see userInput="$110.70" selector="{{CheckoutCartProductSection.ProductPriceByOption($$createConfigProductAttributeSecondOption.option[store_labels][1][label]$$)}}" stepKey="assertProductPriceForSecondProductOption"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/CheckCheckoutSuccessPageTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/CheckCheckoutSuccessPageTest.xml index 971af9688e754..5f898492ad016 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/CheckCheckoutSuccessPageTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/CheckCheckoutSuccessPageTest.xml @@ -28,7 +28,7 @@ <after> <!--Logout from customer account--> - <amOnPage url="customer/account/logout/" stepKey="logoutCustomerOne"/> + <amOnPage url="{{StorefrontCustomerLogoutPage.url}}" stepKey="logoutCustomerOne"/> <waitForPageLoad stepKey="waitLogoutCustomerOne"/> <actionGroup ref="logout" stepKey="adminLogout"/> <deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/> diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/ConfigAdminAccountSharingActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/ConfigAdminAccountSharingActionGroup.xml index 4e11dd6e971de..976f64a457074 100644 --- a/app/code/Magento/Config/Test/Mftf/ActionGroup/ConfigAdminAccountSharingActionGroup.xml +++ b/app/code/Magento/Config/Test/Mftf/ActionGroup/ConfigAdminAccountSharingActionGroup.xml @@ -13,7 +13,7 @@ <description>Goes to the 'Configuration' page for 'Admin'. Enables 'Admin Account Sharing'. Clicks on the Save button.</description> </annotations> - <amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}/admin/system_config/edit/section/admin/" stepKey="navigateToConfigurationPage"/> + <amOnPage url="{{AdminConfigAdvancedAdmin.url}}" stepKey="navigateToConfigurationPage"/> <waitForPageLoad stepKey="wait1"/> <conditionalClick stepKey="expandSecurityTab" selector="{{AdminSection.SecurityTab}}" dependentSelector="{{AdminSection.CheckIfTabExpand}}" visible="true"/> <waitForElementVisible selector="{{AdminSection.AdminAccountSharing}}" stepKey="waitForAdminAccountSharingDrpDown"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTwoOptionsAssignedToCategoryTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTwoOptionsAssignedToCategoryTest.xml index 2f4fc97cb48ff..6ab4734a074a5 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTwoOptionsAssignedToCategoryTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTwoOptionsAssignedToCategoryTest.xml @@ -131,7 +131,7 @@ <waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" stepKey="waitForSuccessMessage"/> <!-- Assert configurable product in cart --> - <amOnPage url="/checkout/cart/" stepKey="amOnShoppingCartPage"/> + <amOnPage url="{{CheckoutCartPage.url}}" stepKey="amOnShoppingCartPage"/> <waitForPageLoad stepKey="waitForShoppingCartPageLoad"/> <actionGroup ref="StorefrontCheckCartConfigurableProductActionGroup" stepKey="storefrontCheckCartConfigurableProductActionGroup"> <argument name="product" value="ApiConfigurableProduct"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTwoOptionsWithoutAssignedToCategoryTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTwoOptionsWithoutAssignedToCategoryTest.xml index 0d8f8bfb65c16..14303aa9b650b 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTwoOptionsWithoutAssignedToCategoryTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTwoOptionsWithoutAssignedToCategoryTest.xml @@ -113,7 +113,7 @@ <waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" stepKey="waitForSuccessMessage"/> <!-- Assert configurable product in cart --> - <amOnPage url="/checkout/cart/" stepKey="amOnShoppingCartPage"/> + <amOnPage url="{{CheckoutCartPage.url}}" stepKey="amOnShoppingCartPage"/> <waitForPageLoad stepKey="waitForShoppingCartPageLoad"/> <actionGroup ref="StorefrontCheckCartConfigurableProductActionGroup" stepKey="storefrontCheckCartConfigurableProductActionGroup"> <argument name="product" value="ApiConfigurableProduct"/> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/SignUpNewUserFromStorefrontActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/SignUpNewUserFromStorefrontActionGroup.xml index 44988b202ab57..4260417b46fd0 100644 --- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/SignUpNewUserFromStorefrontActionGroup.xml +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/SignUpNewUserFromStorefrontActionGroup.xml @@ -117,10 +117,10 @@ <arguments> <argument name="address"/> </arguments> - - <amOnPage url="customer/address/index/" stepKey="goToAddressPage"/> + + <amOnPage url="{{StorefrontCustomerAddressesPage.url}}" stepKey="goToAddressPage"/> <waitForPageLoad stepKey="waitForAddressPageLoad"/> - + <!--Verify customer default billing address--> <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.firstname}} {{address.lastname}}" stepKey="seeAssertCustomerDefaultBillingAddressFirstnameAndLastname"/> <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.company}}" stepKey="seeAssertCustomerDefaultBillingAddressCompany"/> @@ -139,7 +139,7 @@ <argument name="address"/> </arguments> - <amOnPage url="customer/address/index/" stepKey="goToAddressPage"/> + <amOnPage url="{{StorefrontCustomerAddressesPage.url}}" stepKey="goToAddressPage"/> <waitForPageLoad stepKey="waitForAddressPageLoad"/> <!--Verify customer default shipping address--> <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.firstname}} {{address.lastname}}" stepKey="seeAssertCustomerDefaultShippingAddressFirstnameAndLastname"/> @@ -159,7 +159,7 @@ <argument name="address"/> </arguments> - <amOnPage url="customer/address/index/" stepKey="goToAddressPage"/> + <amOnPage url="{{StorefrontCustomerAddressesPage.url}}" stepKey="goToAddressPage"/> <waitForPageLoad stepKey="waitForAddressPageLoad"/> <!--Verify customer default billing address--> @@ -180,7 +180,7 @@ <argument name="address"/> </arguments> - <amOnPage url="customer/address/index/" stepKey="goToAddressPage"/> + <amOnPage url="{{StorefrontCustomerAddressesPage.url}}" stepKey="goToAddressPage"/> <waitForPageLoad stepKey="waitForAddressPageLoad"/> <!--Verify customer default shipping address--> @@ -202,7 +202,7 @@ </arguments> <!--Verify customer name on frontend--> - <amOnPage url="customer/account/edit/" stepKey="goToAddressPage"/> + <amOnPage url="{{StorefrontCustomerEditPage.url}}" stepKey="goToAddressPage"/> <waitForPageLoad stepKey="waitForAddressPageLoad"/> <click selector="{{StorefrontCustomerSidebarSection.sidebarCurrentTab('Account Information')}}" stepKey="clickAccountInformationFromSidebarCurrentTab"/> <waitForPageLoad stepKey="waitForAccountInformationTabToOpen"/> diff --git a/app/code/Magento/Indexer/Test/Mftf/ActionGroup/UpdateIndexerByScheduleActionGroup.xml b/app/code/Magento/Indexer/Test/Mftf/ActionGroup/UpdateIndexerByScheduleActionGroup.xml index 04a5b97469c8e..3b6c8c1504a3a 100644 --- a/app/code/Magento/Indexer/Test/Mftf/ActionGroup/UpdateIndexerByScheduleActionGroup.xml +++ b/app/code/Magento/Indexer/Test/Mftf/ActionGroup/UpdateIndexerByScheduleActionGroup.xml @@ -16,7 +16,7 @@ <argument name="indexerName" type="string"/> </arguments> - <amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}/indexer/indexer/list/" stepKey="amOnIndexManagementPage"/> + <amOnPage url="{{AdminIndexManagementPage.url}}" stepKey="amOnIndexManagementPage"/> <waitForPageLoad stepKey="waitForIndexManagementPageToLoad"/> <click selector="{{AdminIndexManagementSection.indexerCheckbox(indexerName)}}" stepKey="selectIndexer1"/> <selectOption selector="{{AdminIndexManagementSection.massActionSelect}}" userInput="change_mode_changelog" stepKey="selectUpdateBySchedule"/> diff --git a/app/code/Magento/Indexer/Test/Mftf/ActionGroup/UpdateIndexerOnSaveActionGroup.xml b/app/code/Magento/Indexer/Test/Mftf/ActionGroup/UpdateIndexerOnSaveActionGroup.xml index 65be57a335006..023b5b8e0aa0e 100644 --- a/app/code/Magento/Indexer/Test/Mftf/ActionGroup/UpdateIndexerOnSaveActionGroup.xml +++ b/app/code/Magento/Indexer/Test/Mftf/ActionGroup/UpdateIndexerOnSaveActionGroup.xml @@ -16,7 +16,7 @@ <argument name="indexerName" type="string"/> </arguments> - <amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}/indexer/indexer/list/" stepKey="amOnIndexManagementPage2"/> + <amOnPage url="{{AdminIndexManagementPage.url}}" stepKey="amOnIndexManagementPage2"/> <waitForPageLoad stepKey="waitForIndexManagementPageToLoad2"/> <click selector="{{AdminIndexManagementSection.indexerCheckbox(indexerName)}}" stepKey="selectIndexer2"/> <selectOption selector="{{AdminIndexManagementSection.massActionSelect}}" userInput="change_mode_onthefly" stepKey="selectUpdateOnSave"/> diff --git a/app/code/Magento/Newsletter/Test/Mftf/Test/VerifySubscribedNewsletterDisplayedTest.xml b/app/code/Magento/Newsletter/Test/Mftf/Test/VerifySubscribedNewsletterDisplayedTest.xml index 740b8fbaa0ab7..200eb0e49f5b2 100644 --- a/app/code/Magento/Newsletter/Test/Mftf/Test/VerifySubscribedNewsletterDisplayedTest.xml +++ b/app/code/Magento/Newsletter/Test/Mftf/Test/VerifySubscribedNewsletterDisplayedTest.xml @@ -57,7 +57,7 @@ <argument name="Customer" value="CustomerEntityOne"/> </actionGroup> <!--Sign Out--> - <amOnPage url="customer/account/logout/" stepKey="customerOnLogoutPage"/> + <amOnPage url="{{StorefrontCustomerLogoutPage.url}}" stepKey="customerOnLogoutPage"/> <waitForPageLoad stepKey="waitLogoutCustomer"/> <!--Create new Account with the same email address. (unchecked Sign Up for Newsletter checkbox)--> <actionGroup ref="StorefrontCreateNewAccountNewsletterUncheckedActionGroup" stepKey="createNewAccountNewsletterUnchecked"> diff --git a/app/code/Magento/PageCache/Test/Mftf/ActionGroup/ClearCacheActionGroup.xml b/app/code/Magento/PageCache/Test/Mftf/ActionGroup/ClearCacheActionGroup.xml index 4bd68fa1e9929..ea76b133bb414 100644 --- a/app/code/Magento/PageCache/Test/Mftf/ActionGroup/ClearCacheActionGroup.xml +++ b/app/code/Magento/PageCache/Test/Mftf/ActionGroup/ClearCacheActionGroup.xml @@ -13,7 +13,7 @@ <description>Goes to the Admin Cache Management page. Clicks on 'Flush Magento Cache'.</description> </annotations> - <amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}/admin/cache/" stepKey="goToNewCustomVarialePage"/> + <amOnPage url="{{AdminCacheManagementPage.url}}" stepKey="goToCacheManagement"/> <waitForPageLoad stepKey="waitForPageLoad"/> <click selector="{{AdminCacheManagementSection.FlushMagentoCache}}" stepKey="clickFlushMagentoCache"/> <waitForPageLoad stepKey="waitForCacheFlush"/> diff --git a/app/code/Magento/PageCache/Test/Mftf/ActionGroup/ClearPageCacheActionGroup.xml b/app/code/Magento/PageCache/Test/Mftf/ActionGroup/ClearPageCacheActionGroup.xml index 88ed167e24e1a..3c0d2aa8082b1 100644 --- a/app/code/Magento/PageCache/Test/Mftf/ActionGroup/ClearPageCacheActionGroup.xml +++ b/app/code/Magento/PageCache/Test/Mftf/ActionGroup/ClearPageCacheActionGroup.xml @@ -13,7 +13,7 @@ <description>Goes to the Admin Cache Management page. Selects 'Refresh'. Checks the 'Page Cache' row. Clicks on Submit.</description> </annotations> - <amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}/admin/cache/" stepKey="goToCacheManagementPage"/> + <amOnPage url="{{AdminCacheManagementPage.url}}" stepKey="goToCacheManagementPage"/> <waitForPageLoad stepKey="waitForPageLoad"/> <click selector="{{AdminCacheManagementSection.actionDropDown}}" stepKey="actionSelection"/> <click selector="{{AdminCacheManagementSection.refreshOption}}" stepKey="selectRefreshOption"/> From c85410d14fc4db09d21ebbc37f880330a7094390 Mon Sep 17 00:00:00 2001 From: Marco Oliveira <marcoaacoliveira@gmail.com> Date: Mon, 6 Jan 2020 04:25:24 -0300 Subject: [PATCH 0660/1143] Making formatter with IntlDateFormatter::MEDIUM, to solve errors when trying to convert a bigger string into timestamp. --- lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php b/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php index e9873b39a6090..2568a5ccf21c1 100644 --- a/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php +++ b/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php @@ -177,7 +177,7 @@ public function date($date = null, $locale = null, $useTimezone = true, $include $timeType = $includeTime ? \IntlDateFormatter::SHORT : \IntlDateFormatter::NONE; $formatter = new \IntlDateFormatter( $locale, - \IntlDateFormatter::SHORT, + \IntlDateFormatter::MEDIUM, $timeType, new \DateTimeZone($timezone) ); From 4a751093851852a3eaf71f08803f661a6523a2d4 Mon Sep 17 00:00:00 2001 From: "rostyslav.hymon" <rostyslav.hymon@transoftgroup.com> Date: Mon, 6 Jan 2020 09:32:37 +0200 Subject: [PATCH 0661/1143] MC-29951: [On-Prem] Out of stock items included in Category Filtering --- .../CustomAttributeStockStatusFilter.php | 100 +++++++++++ .../Search/FilterMapper/FilterMapper.php | 38 ++-- .../Search/FilterMapper/StockStatusFilter.php | 114 +++--------- .../FilterMapper/StockStatusQueryBuilder.php | 106 +++++++++++ .../ResourceModel/Fulltext/CollectionTest.php | 156 ++++++++++++++++ .../product_configurable_two_options.php | 166 ++++++++++++++++++ ...duct_configurable_two_options_rollback.php | 49 ++++++ .../Magento/CatalogSearch/_files/requests.xml | 38 ++++ 8 files changed, 663 insertions(+), 104 deletions(-) create mode 100644 app/code/Magento/CatalogSearch/Model/Search/FilterMapper/CustomAttributeStockStatusFilter.php create mode 100644 app/code/Magento/CatalogSearch/Model/Search/FilterMapper/StockStatusQueryBuilder.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogSearch/_files/product_configurable_two_options.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogSearch/_files/product_configurable_two_options_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogSearch/_files/requests.xml diff --git a/app/code/Magento/CatalogSearch/Model/Search/FilterMapper/CustomAttributeStockStatusFilter.php b/app/code/Magento/CatalogSearch/Model/Search/FilterMapper/CustomAttributeStockStatusFilter.php new file mode 100644 index 0000000000000..28aa3df2d56b4 --- /dev/null +++ b/app/code/Magento/CatalogSearch/Model/Search/FilterMapper/CustomAttributeStockStatusFilter.php @@ -0,0 +1,100 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\CatalogSearch\Model\Search\FilterMapper; + +use Magento\Catalog\Model\Product; +use Magento\CatalogSearch\Model\Adapter\Mysql\Filter\AliasResolver; +use Magento\Eav\Model\Config as EavConfig; +use Magento\Framework\DB\Select; +use Magento\Framework\Search\Request\FilterInterface; + +/** + * Add stock status filter for each requested filter + */ +class CustomAttributeStockStatusFilter +{ + /** + * Suffix to append to filter name in order to generate stock status table alias for JOIN clause + */ + private const STOCK_STATUS_TABLE_ALIAS_SUFFIX = '_stock_index'; + /** + * Attribute types to apply + */ + private const TARGET_ATTRIBUTE_TYPES = [ + 'select', + 'multiselect' + ]; + /** + * @var EavConfig + */ + private $eavConfig; + /** + * @var AliasResolver + */ + private $aliasResolver; + /** + * @var StockStatusQueryBuilder|null + */ + private $stockStatusQueryBuilder; + + /** + * @param EavConfig $eavConfig + * @param AliasResolver $aliasResolver + * @param StockStatusQueryBuilder $stockStatusQueryBuilder + */ + public function __construct( + EavConfig $eavConfig, + AliasResolver $aliasResolver, + StockStatusQueryBuilder $stockStatusQueryBuilder + ) { + $this->eavConfig = $eavConfig; + $this->aliasResolver = $aliasResolver; + $this->stockStatusQueryBuilder = $stockStatusQueryBuilder; + } + + /** + * Apply stock status filter to provided filter + * + * @param Select $select + * @param mixed $values + * @param FilterInterface[] $filters + * @return Select + */ + public function apply(Select $select, $values = null, FilterInterface ...$filters): Select + { + $select = clone $select; + foreach ($filters as $filter) { + if ($this->isApplicable($filter)) { + $mainTableAlias = $this->aliasResolver->getAlias($filter); + $stockTableAlias = $mainTableAlias . self::STOCK_STATUS_TABLE_ALIAS_SUFFIX; + $select = $this->stockStatusQueryBuilder->apply( + $select, + $mainTableAlias, + $stockTableAlias, + 'source_id', + $values + ); + } + } + return $select; + } + + /** + * Check if stock status filter is applicable to provided filter + * + * @param FilterInterface $filter + * @return bool + */ + private function isApplicable(FilterInterface $filter): bool + { + $attribute = $this->eavConfig->getAttribute(Product::ENTITY, $filter->getField()); + return $attribute + && $filter->getType() === FilterInterface::TYPE_TERM + && in_array($attribute->getFrontendInput(), self::TARGET_ATTRIBUTE_TYPES, true); + } +} diff --git a/app/code/Magento/CatalogSearch/Model/Search/FilterMapper/FilterMapper.php b/app/code/Magento/CatalogSearch/Model/Search/FilterMapper/FilterMapper.php index 7136fad5b19a9..1c4a803c1dd00 100644 --- a/app/code/Magento/CatalogSearch/Model/Search/FilterMapper/FilterMapper.php +++ b/app/code/Magento/CatalogSearch/Model/Search/FilterMapper/FilterMapper.php @@ -9,13 +9,14 @@ use Magento\CatalogSearch\Model\Search\SelectContainer\SelectContainer; use Magento\CatalogSearch\Model\Adapter\Mysql\Filter\AliasResolver; use Magento\CatalogInventory\Model\Stock; +use Magento\Framework\App\ObjectManager; /** - * Class FilterMapper * This class applies filters to Select based on SelectContainer configuration * - * @deprecated + * @deprecated MySQL search engine is not recommended. * @see \Magento\ElasticSearch + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class FilterMapper { @@ -43,6 +44,10 @@ class FilterMapper * @var StockStatusFilter */ private $stockStatusFilter; + /** + * @var CustomAttributeStockStatusFilter + */ + private $customAttributeStockStatusFilter; /** * @param AliasResolver $aliasResolver @@ -50,24 +55,27 @@ class FilterMapper * @param FilterStrategyInterface $filterStrategy * @param VisibilityFilter $visibilityFilter * @param StockStatusFilter $stockStatusFilter + * @param CustomAttributeStockStatusFilter|null $customAttributeStockStatusFilter */ public function __construct( AliasResolver $aliasResolver, CustomAttributeFilter $customAttributeFilter, FilterStrategyInterface $filterStrategy, VisibilityFilter $visibilityFilter, - StockStatusFilter $stockStatusFilter + StockStatusFilter $stockStatusFilter, + ?CustomAttributeStockStatusFilter $customAttributeStockStatusFilter = null ) { $this->aliasResolver = $aliasResolver; $this->customAttributeFilter = $customAttributeFilter; $this->filterStrategy = $filterStrategy; $this->visibilityFilter = $visibilityFilter; $this->stockStatusFilter = $stockStatusFilter; + $this->customAttributeStockStatusFilter = $customAttributeStockStatusFilter + ?? ObjectManager::getInstance()->get(CustomAttributeStockStatusFilter::class); } /** - * Applies filters to Select query in SelectContainer - * based on SelectContainer configuration + * Applies filters to Select query in SelectContainer based on SelectContainer configuration * * @param SelectContainer $selectContainer * @return SelectContainer @@ -79,22 +87,22 @@ public function applyFilters(SelectContainer $selectContainer) { $select = $selectContainer->getSelect(); - if ($selectContainer->hasCustomAttributesFilters()) { - $select = $this->customAttributeFilter->apply($select, ...$selectContainer->getCustomAttributesFilters()); - } - - $filterType = StockStatusFilter::FILTER_JUST_ENTITY; - if ($selectContainer->hasCustomAttributesFilters()) { - $filterType = StockStatusFilter::FILTER_ENTITY_AND_SUB_PRODUCTS; - } - $select = $this->stockStatusFilter->apply( $select, Stock::STOCK_IN_STOCK, - $filterType, + StockStatusFilter::FILTER_JUST_ENTITY, $selectContainer->isShowOutOfStockEnabled() ); + if ($selectContainer->hasCustomAttributesFilters()) { + $select = $this->customAttributeFilter->apply($select, ...$selectContainer->getCustomAttributesFilters()); + $select = $this->customAttributeStockStatusFilter->apply( + $select, + $selectContainer->isShowOutOfStockEnabled() ? null : Stock::STOCK_IN_STOCK, + ...$selectContainer->getCustomAttributesFilters() + ); + } + $appliedFilters = []; if ($selectContainer->hasVisibilityFilter()) { diff --git a/app/code/Magento/CatalogSearch/Model/Search/FilterMapper/StockStatusFilter.php b/app/code/Magento/CatalogSearch/Model/Search/FilterMapper/StockStatusFilter.php index 0e3ba0d4e669f..420c69a7325f6 100644 --- a/app/code/Magento/CatalogSearch/Model/Search/FilterMapper/StockStatusFilter.php +++ b/app/code/Magento/CatalogSearch/Model/Search/FilterMapper/StockStatusFilter.php @@ -6,6 +6,7 @@ namespace Magento\CatalogSearch\Model\Search\FilterMapper; +use Magento\Framework\App\ObjectManager; use Magento\Framework\App\ResourceConnection; use Magento\Framework\DB\Select; use Magento\Framework\Search\Adapter\Mysql\ConditionManager; @@ -13,10 +14,9 @@ use Magento\CatalogInventory\Api\StockRegistryInterface; /** - * Class StockStatusFilter * Adds filter by stock status to base select * - * @deprecated + * @deprecated MySQL search engine is not recommended. * @see \Magento\ElasticSearch */ class StockStatusFilter @@ -56,23 +56,31 @@ class StockStatusFilter * @var StockRegistryInterface */ private $stockRegistry; + /** + * @var StockStatusQueryBuilder + */ + private $stockStatusQueryBuilder; /** * @param ResourceConnection $resourceConnection * @param ConditionManager $conditionManager * @param StockConfigurationInterface $stockConfiguration * @param StockRegistryInterface $stockRegistry + * @param StockStatusQueryBuilder|null $stockStatusQueryBuilder */ public function __construct( ResourceConnection $resourceConnection, ConditionManager $conditionManager, StockConfigurationInterface $stockConfiguration, - StockRegistryInterface $stockRegistry + StockRegistryInterface $stockRegistry, + ?StockStatusQueryBuilder $stockStatusQueryBuilder = null ) { $this->resourceConnection = $resourceConnection; $this->conditionManager = $conditionManager; $this->stockConfiguration = $stockConfiguration; $this->stockRegistry = $stockRegistry; + $this->stockStatusQueryBuilder = $stockStatusQueryBuilder + ?? ObjectManager::getInstance()->get(StockStatusQueryBuilder::class); } /** @@ -94,99 +102,27 @@ public function apply(Select $select, $stockValues, $type, $showOutOfStockFlag) $select = clone $select; $mainTableAlias = $this->extractTableAliasFromSelect($select); - $this->addMainStockStatusJoin($select, $stockValues, $mainTableAlias, $showOutOfStockFlag); + $select = $this->stockStatusQueryBuilder->apply( + $select, + $mainTableAlias, + 'stock_index', + 'entity_id', + $showOutOfStockFlag ? null : $stockValues + ); if ($type === self::FILTER_ENTITY_AND_SUB_PRODUCTS) { - $this->addSubProductsStockStatusJoin($select, $stockValues, $mainTableAlias, $showOutOfStockFlag); + $select = $this->stockStatusQueryBuilder->apply( + $select, + $mainTableAlias, + 'sub_products_stock_index', + 'source_id', + $showOutOfStockFlag ? null : $stockValues + ); } return $select; } - /** - * Adds filter join for products by stock status - * In case when $showOutOfStockFlag is true - joins are still required to filter only enabled products - * - * @param Select $select - * @param array|int $stockValues - * @param string $mainTableAlias - * @param bool $showOutOfStockFlag - * @return void - */ - private function addMainStockStatusJoin(Select $select, $stockValues, $mainTableAlias, $showOutOfStockFlag) - { - $catalogInventoryTable = $this->resourceConnection->getTableName('cataloginventory_stock_status'); - $select->joinInner( - ['stock_index' => $catalogInventoryTable], - $this->conditionManager->combineQueries( - [ - sprintf('stock_index.product_id = %s.entity_id', $mainTableAlias), - $this->conditionManager->generateCondition( - 'stock_index.website_id', - '=', - $this->stockConfiguration->getDefaultScopeId() - ), - $showOutOfStockFlag - ? '' - : $this->conditionManager->generateCondition( - 'stock_index.stock_status', - is_array($stockValues) ? 'in' : '=', - $stockValues - ), - $this->conditionManager->generateCondition( - 'stock_index.stock_id', - '=', - (int) $this->stockRegistry->getStock()->getStockId() - ), - ], - Select::SQL_AND - ), - [] - ); - } - - /** - * Adds filter join for sub products by stock status - * In case when $showOutOfStockFlag is true - joins are still required to filter only enabled products - * - * @param Select $select - * @param array|int $stockValues - * @param string $mainTableAlias - * @param bool $showOutOfStockFlag - * @return void - */ - private function addSubProductsStockStatusJoin(Select $select, $stockValues, $mainTableAlias, $showOutOfStockFlag) - { - $catalogInventoryTable = $this->resourceConnection->getTableName('cataloginventory_stock_status'); - $select->joinInner( - ['sub_products_stock_index' => $catalogInventoryTable], - $this->conditionManager->combineQueries( - [ - sprintf('sub_products_stock_index.product_id = %s.source_id', $mainTableAlias), - $this->conditionManager->generateCondition( - 'sub_products_stock_index.website_id', - '=', - $this->stockConfiguration->getDefaultScopeId() - ), - $showOutOfStockFlag - ? '' - : $this->conditionManager->generateCondition( - 'sub_products_stock_index.stock_status', - is_array($stockValues) ? 'in' : '=', - $stockValues - ), - $this->conditionManager->generateCondition( - 'sub_products_stock_index.stock_id', - '=', - (int) $this->stockRegistry->getStock()->getStockId() - ), - ], - Select::SQL_AND - ), - [] - ); - } - /** * Extracts alias for table that is used in FROM clause in Select * diff --git a/app/code/Magento/CatalogSearch/Model/Search/FilterMapper/StockStatusQueryBuilder.php b/app/code/Magento/CatalogSearch/Model/Search/FilterMapper/StockStatusQueryBuilder.php new file mode 100644 index 0000000000000..2d0d408875661 --- /dev/null +++ b/app/code/Magento/CatalogSearch/Model/Search/FilterMapper/StockStatusQueryBuilder.php @@ -0,0 +1,106 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\CatalogSearch\Model\Search\FilterMapper; + +use Magento\CatalogInventory\Model\ResourceModel\Stock\Status as StockStatusResourceModel; +use Magento\Framework\DB\Select; +use Magento\Framework\Search\Adapter\Mysql\ConditionManager; +use Magento\CatalogInventory\Api\StockConfigurationInterface; +use Magento\CatalogInventory\Api\StockRegistryInterface; + +/** + * Add stock status filter to Select + */ +class StockStatusQueryBuilder +{ + /** + * @var StockStatusResourceModel + */ + private $stockStatusResourceModel; + + /** + * @var ConditionManager + */ + private $conditionManager; + + /** + * @var StockConfigurationInterface + */ + private $stockConfiguration; + + /** + * @var StockRegistryInterface + */ + private $stockRegistry; + + /** + * @param StockStatusResourceModel $stockStatusResourceModel + * @param ConditionManager $conditionManager + * @param StockConfigurationInterface $stockConfiguration + * @param StockRegistryInterface $stockRegistry + */ + public function __construct( + StockStatusResourceModel $stockStatusResourceModel, + ConditionManager $conditionManager, + StockConfigurationInterface $stockConfiguration, + StockRegistryInterface $stockRegistry + ) { + $this->stockStatusResourceModel = $stockStatusResourceModel; + $this->conditionManager = $conditionManager; + $this->stockConfiguration = $stockConfiguration; + $this->stockRegistry = $stockRegistry; + } + + /** + * Add stock filter to Select + * + * @param Select $select + * @param string $mainTableAlias + * @param string $stockTableAlias + * @param string $joinField + * @param mixed $values + * @return Select + */ + public function apply( + Select $select, + string $mainTableAlias, + string $stockTableAlias, + string $joinField, + $values = null + ): Select { + $select->joinInner( + [$stockTableAlias => $this->stockStatusResourceModel->getMainTable()], + $this->conditionManager->combineQueries( + [ + sprintf('%s.product_id = %s.%s', $stockTableAlias, $mainTableAlias, $joinField), + $this->conditionManager->generateCondition( + sprintf('%s.website_id', $stockTableAlias), + '=', + $this->stockConfiguration->getDefaultScopeId() + ), + $values === null + ? '' + : $this->conditionManager->generateCondition( + sprintf('%s.stock_status', $stockTableAlias), + is_array($values) ? 'in' : '=', + $values + ), + $this->conditionManager->generateCondition( + sprintf('%s.stock_id', $stockTableAlias), + '=', + (int) $this->stockRegistry->getStock()->getStockId() + ), + ], + Select::SQL_AND + ), + [] + ); + + return $select; + } +} diff --git a/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/ResourceModel/Fulltext/CollectionTest.php b/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/ResourceModel/Fulltext/CollectionTest.php index 8863834078214..55465e938e71b 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/ResourceModel/Fulltext/CollectionTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/ResourceModel/Fulltext/CollectionTest.php @@ -40,6 +40,7 @@ public function testLoadWithFilterSearch($request, $filters, $expectedCount) /** * @dataProvider filtersDataProviderQuickSearch * @magentoDataFixture Magento/Framework/Search/_files/products.php + * @magentoAppIsolation enabled */ public function testLoadWithFilterQuickSearch($filters, $expectedCount) { @@ -61,6 +62,7 @@ public function testLoadWithFilterQuickSearch($filters, $expectedCount) /** * @dataProvider filtersDataProviderCatalogView * @magentoDataFixture Magento/Framework/Search/_files/products.php + * @magentoAppIsolation enabled */ public function testLoadWithFilterCatalogView($filters, $expectedCount) { @@ -78,6 +80,7 @@ public function testLoadWithFilterCatalogView($filters, $expectedCount) /** * @magentoDataFixture Magento/Framework/Search/_files/products_with_the_same_search_score.php + * @magentoAppIsolation enabled */ public function testSearchResultsAreTheSameForSameRequests() { @@ -142,4 +145,157 @@ public function filtersDataProviderCatalogView() [[], 5], ]; } + + /** + * Test configurable product with multiple options + * + * @magentoDataFixture Magento/CatalogSearch/_files/product_configurable_two_options.php + * @magentoConfigFixture default/catalog/search/engine mysql + * @magentoDataFixture Magento/CatalogSearch/_files/full_reindex.php + * @magentoAppIsolation enabled + * @dataProvider configurableProductWithMultipleOptionsDataProvider + * @param array $filters + * @param bool $found + * @param array $outOfStock + * @throws \Magento\Framework\Exception\NoSuchEntityException + */ + public function testConfigurableProductWithMultipleOptions(array $filters, bool $found, array $outOfStock = []) + { + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + /**@var $stockRegistry \Magento\CatalogInventory\Model\StockRegistry */ + $stockRegistry = $objectManager->get(\Magento\CatalogInventory\Model\StockRegistry::class); + /**@var $stockItemRepository \Magento\CatalogInventory\Api\StockItemRepositoryInterface */ + $stockItemRepository = $objectManager->get(\Magento\CatalogInventory\Api\StockItemRepositoryInterface::class); + $collection = $objectManager->create( + \Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection::class, + ['searchRequestName' => 'filter_by_configurable_product_options'] + ); + foreach ($outOfStock as $sku) { + $stockItem = $stockRegistry->getStockItemBySku($sku); + $stockItem->setQty(0); + $stockItem->setIsInStock(0); + $stockItemRepository->save($stockItem); + } + + $options = ['test_configurable', 'test_configurable_2']; + foreach ($options as $option) { + if (isset($filters[$option])) { + $filters[$option] = $this->getOptionValue($option, $filters[$option]); + } + } + $filters['category_ids'] = 2; + foreach ($filters as $field => $value) { + $collection->addFieldToFilter($field, $value); + } + $collection->load(); + $items = $collection->getItems(); + if ($found) { + $this->assertCount(1, $items); + $item = array_shift($items); + $this->assertEquals('configurable_with_2_opts', $item['sku']); + } + $this->assertCount(0, $items); + } + + /** + * Provide filters to test configurable product with multiple options + * + * @return array + */ + public function configurableProductWithMultipleOptionsDataProvider(): array + { + return [ + [ + [], + true + ], + [ + ['test_configurable' => 'Option 1'], + true + ], + [ + ['test_configurable' => 'Option 2'], + true + ], + [ + ['test_configurable_2' => 'Option 1'], + true + ], + [ + ['test_configurable_2' => 'Option 2'], + true + ], + [ + ['test_configurable' => 'Option 1', 'test_configurable_2' => 'Option 1'], + true + ], + [ + ['test_configurable' => 'Option 1', 'test_configurable_2' => 'Option 2'], + true + ], + [ + ['test_configurable' => 'Option 2', 'test_configurable_2' => 'Option 1'], + true + ], + [ + ['test_configurable' => 'Option 2', 'test_configurable_2' => 'Option 2'], + true + ], + [ + ['test_configurable' => 'Option 2', 'test_configurable_2' => 'Option 2'], + false, + [ + 'configurable2_option_12', + 'configurable2_option_22', + ] + ], + [ + ['test_configurable' => 'Option 2', 'test_configurable_2' => 'Option 2'], + false, + [ + 'configurable2_option_21', + 'configurable2_option_22', + ] + ], + [ + ['test_configurable' => 'Option 2'], + false, + [ + 'configurable2_option_21', + 'configurable2_option_22', + ] + ], + [ + [], + false, + [ + 'configurable2_option_11', + 'configurable2_option_12', + 'configurable2_option_21', + 'configurable2_option_22', + ] + ], + ]; + } + + /** + * Get attribute option value by label + * + * @param string $attributeName + * @param string $optionLabel + * @return string|null + */ + private function getOptionValue(string $attributeName, string $optionLabel): ?string + { + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $eavConfig = $objectManager->get(\Magento\Eav\Model\Config::class); + $attribute = $eavConfig->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $attributeName); + $option = null; + foreach ($attribute->getOptions() as $option) { + if ($option->getLabel() === $optionLabel) { + return $option->getValue(); + } + } + return null; + } } diff --git a/dev/tests/integration/testsuite/Magento/CatalogSearch/_files/product_configurable_two_options.php b/dev/tests/integration/testsuite/Magento/CatalogSearch/_files/product_configurable_two_options.php new file mode 100644 index 0000000000000..67bd8b831b878 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogSearch/_files/product_configurable_two_options.php @@ -0,0 +1,166 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +require __DIR__ . '/../../../Magento/ConfigurableProduct/_files/configurable_attribute.php'; +require __DIR__ . '/../../../Magento/ConfigurableProduct/_files/configurable_attribute_2.php'; + +use Magento\Catalog\Api\CategoryLinkManagementInterface; +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\CatalogInventory\Model\Stock\Item; +use Magento\ConfigurableProduct\Helper\Product\Options\Factory; +use Magento\ConfigurableProduct\Model\Product\Type\Configurable; +use Magento\Eav\Api\AttributeRepositoryInterface; +use Magento\Eav\Api\Data\AttributeOptionInterface; +use Magento\Framework\Search\Request\Config; +use Magento\Framework\Search\Request\Config\Converter; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var AttributeRepositoryInterface $attributeRepository */ +$attributeRepository = $objectManager->create(AttributeRepositoryInterface::class); +/** @var \Magento\Eav\Model\Config $eavConfig */ +$eavConfig = $objectManager->get(\Magento\Eav\Model\Config::class); +$attributes = ['test_configurable', 'test_configurable_2']; +foreach ($attributes as $attributeName) { + $attributeModel = $eavConfig->getAttribute(Product::ENTITY, $attributeName); + $attributeModel->addData([ + 'is_searchable' => 1, + 'is_filterable' => 1, + 'is_filterable_in_search' => 1, + 'is_visible_in_advanced_search' => 1, + ]); + $attributeRepository->save($attributeModel); +} + +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->create(ProductRepositoryInterface::class); + +/** @var $installer CategorySetup */ +$installer = $objectManager->create(CategorySetup::class); + +/** @var AttributeOptionInterface[] $options */ +$options = $attribute->getOptions(); + +$attribute1Values = []; +$attribute2Values = []; +$attributeSetId = $installer->getAttributeSetId('catalog_product', 'Default'); +$associatedProductIds = []; +array_shift($options); +$index1 = 1; +foreach ($options as $option1) { + /** @var AttributeOptionInterface[] $options */ + $options2 = $attribute2->getOptions(); + array_shift($options2); + $index2 = 1; + foreach ($options2 as $option2) { + /** @var $product Product */ + $product = $objectManager->create(Product::class); + $product->setTypeId(Type::TYPE_SIMPLE) + ->setAttributeSetId($attributeSetId) + ->setWebsiteIds([1]) + ->setName('Configurable2 Option' . $index1 . $index2) + ->setSku('configurable2_option_' . $index1 . $index2) + ->setPrice(random_int(10, 100)) + ->setTestConfigurable($option1->getValue()) + ->setTestConfigurable2($option2->getValue()) + ->setVisibility(Visibility::VISIBILITY_NOT_VISIBLE) + ->setStatus(Status::STATUS_ENABLED) + ->setStockData(['use_config_manage_stock' => 1, 'qty' => 100, 'is_qty_decimal' => 0, 'is_in_stock' => 1]); + + $product = $productRepository->save($product); + + /** @var Item $stockItem */ + $stockItem = $objectManager->create(Item::class); + $stockItem->load($product->getId(), 'product_id'); + + if (!$stockItem->getProductId()) { + $stockItem->setProductId($product->getId()); + } + $stockItem->setUseConfigManageStock(1); + $stockItem->setQty(1000); + $stockItem->setIsQtyDecimal(0); + $stockItem->setIsInStock(1); + $stockItem->save(); + + $attribute1Values[] = [ + 'label' => 'test1', + 'attribute_id' => $attribute->getId(), + 'value_index' => $option1->getValue(), + ]; + $attribute2Values[] = [ + 'label' => 'test2', + 'attribute_id' => $attribute2->getId(), + 'value_index' => $option2->getValue(), + ]; + $associatedProductIds[] = $product->getId(); + $index2++; + } + $index1++; +} + +/** @var $product Product */ +$product = $objectManager->create(Product::class); + +/** @var Factory $optionsFactory */ +$optionsFactory = $objectManager->create(Factory::class); + +$configurableAttributesData = [ + [ + 'attribute_id' => $attribute->getId(), + 'code' => $attribute->getAttributeCode(), + 'label' => $attribute->getStoreLabel(), + 'position' => '0', + 'values' => $attribute1Values, + ], + [ + 'attribute_id' => $attribute2->getId(), + 'code' => $attribute2->getAttributeCode(), + 'label' => $attribute2->getStoreLabel(), + 'position' => '1', + 'values' => $attribute2Values, + ], +]; + +$configurableOptions = $optionsFactory->create($configurableAttributesData); + +$extensionConfigurableAttributes = $product->getExtensionAttributes(); +$extensionConfigurableAttributes->setConfigurableProductOptions($configurableOptions); +$extensionConfigurableAttributes->setConfigurableProductLinks($associatedProductIds); + +$product->setExtensionAttributes($extensionConfigurableAttributes); + +$product->setTypeId(Configurable::TYPE_CODE) + ->setAttributeSetId($attributeSetId) + ->setWebsiteIds([1]) + ->setName('configurable with 2 opts') + ->setSku('configurable_with_2_opts') + ->setVisibility(Visibility::VISIBILITY_BOTH) + ->setStatus(Status::STATUS_ENABLED) + ->setStockData(['use_config_manage_stock' => 1, 'is_in_stock' => 1]); + +$productRepository->save($product); + +/** @var CategoryLinkManagementInterface $categoryLinkManagement */ +$categoryLinkManagement = $objectManager->create(CategoryLinkManagementInterface::class); + +$categoryLinkManagement->assignProductToCategories( + $product->getSku(), + [2] +); + +/** @var Converter $converter */ +$converter = $objectManager->create(Converter::class); +$document = new DOMDocument(); +$document->load(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'requests.xml'); +$requestConfig = $converter->convert($document); +/** @var Config $config */ +$config = $objectManager->get(Config::class); +$config->merge($requestConfig); diff --git a/dev/tests/integration/testsuite/Magento/CatalogSearch/_files/product_configurable_two_options_rollback.php b/dev/tests/integration/testsuite/Magento/CatalogSearch/_files/product_configurable_two_options_rollback.php new file mode 100644 index 0000000000000..4bb2ea4fa8178 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogSearch/_files/product_configurable_two_options_rollback.php @@ -0,0 +1,49 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\CatalogInventory\Model\Stock\Status; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Registry; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); + +/** @var Registry $registry */ +$registry = $objectManager->get(Registry::class); + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); + +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->get(ProductRepositoryInterface::class); +$list = [ + 'configurable2_option_11', + 'configurable2_option_12', + 'configurable2_option_21', + 'configurable2_option_22', + 'configurable_with_2_opts' +]; + +foreach ($list as $sku) { + try { + $product = $productRepository->get($sku, true); + + $stockStatus = $objectManager->create(Status::class); + $stockStatus->load($product->getEntityId(), 'product_id'); + $stockStatus->delete(); + + $productRepository->delete($product); + } catch (NoSuchEntityException $e) { + //Product already removed + } +} + +require __DIR__ . '/../../../Magento/ConfigurableProduct/_files/configurable_attribute_rollback.php'; +require __DIR__ . '/../../../Magento/ConfigurableProduct/_files/configurable_attribute_2_rollback.php'; + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); diff --git a/dev/tests/integration/testsuite/Magento/CatalogSearch/_files/requests.xml b/dev/tests/integration/testsuite/Magento/CatalogSearch/_files/requests.xml new file mode 100644 index 0000000000000..660aa36cc291d --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogSearch/_files/requests.xml @@ -0,0 +1,38 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<requests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Search/etc/search_request_merged.xsd"> + <request query="filter_by_configurable_product_options" index="catalogsearch_fulltext"> + <dimensions> + <dimension name="scope" value="default"/> + </dimensions> + <queries> + <query xsi:type="boolQuery" name="filter_by_configurable_product_options" boost="1"> + <queryReference clause="must" ref="category"/> + <queryReference clause="must" ref="test_configurable"/> + <queryReference clause="must" ref="test_configurable_2"/> + </query> + <query xsi:type="filteredQuery" name="category"> + <filterReference clause="must" ref="category_filter"/> + </query> + <query xsi:type="filteredQuery" name="test_configurable"> + <filterReference clause="must" ref="test_configurable_filter"/> + </query> + <query xsi:type="filteredQuery" name="test_configurable_2"> + <filterReference clause="must" ref="test_configurable_2_filter"/> + </query> + </queries> + <filters> + <filter xsi:type="termFilter" name="category_filter" field="category_ids" value="$category_ids$"/> + <filter xsi:type="termFilter" name="test_configurable_filter" field="test_configurable" value="$test_configurable$"/> + <filter xsi:type="termFilter" name="test_configurable_2_filter" field="test_configurable_2" value="$test_configurable_2$"/> + </filters> + <aggregations/> + <from>0</from> + <size>10</size> + </request> +</requests> From 265c843cbe64afe31e21e5112ccd13c02b6ed21c Mon Sep 17 00:00:00 2001 From: Serhii Voloshkov <serhii.voloshkov@transoftgroup.com> Date: Mon, 6 Jan 2020 09:50:01 +0200 Subject: [PATCH 0662/1143] MC-21347: Remove Customer module's dependency on Review --- .../Magento/Customer/Controller/Review.php | 46 ------------------- .../Customer/Controller/Review/Index.php | 19 -------- .../Customer/Controller/Review/View.php | 19 -------- 3 files changed, 84 deletions(-) delete mode 100644 app/code/Magento/Customer/Controller/Review.php delete mode 100644 app/code/Magento/Customer/Controller/Review/Index.php delete mode 100644 app/code/Magento/Customer/Controller/Review/View.php diff --git a/app/code/Magento/Customer/Controller/Review.php b/app/code/Magento/Customer/Controller/Review.php deleted file mode 100644 index cf4c0af780701..0000000000000 --- a/app/code/Magento/Customer/Controller/Review.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Customer\Controller; - -use Magento\Framework\App\Action\Context; -use Magento\Framework\App\Action\HttpGetActionInterface; -use Magento\Framework\View\Result\PageFactory; - -/** - * Deprecated class which was in use as general class in Customer Account "My Product Reviews" tab. - * - * @deprecated Remove Customer module's dependency on Review. Non-used class. - * @see \Magento\Review\Controller\Customer - */ -class Review extends \Magento\Framework\App\Action\Action implements HttpGetActionInterface -{ - /** - * @var PageFactory - */ - protected $resultPageFactory; - - /** - * @param Context $context - * @param PageFactory $resultPageFactory - */ - public function __construct( - Context $context, - PageFactory $resultPageFactory - ) { - parent::__construct($context); - $this->resultPageFactory = $resultPageFactory; - } - - /** - * Main page in Customer Account "My Product Reviews" tab. - * - * @return \Magento\Framework\View\Result\Page - */ - public function execute() - { - return $this->resultPageFactory->create(); - } -} diff --git a/app/code/Magento/Customer/Controller/Review/Index.php b/app/code/Magento/Customer/Controller/Review/Index.php deleted file mode 100644 index df87ffe8c18f7..0000000000000 --- a/app/code/Magento/Customer/Controller/Review/Index.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php -/** - * - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Customer\Controller\Review; - -use Magento\Customer\Controller\Review; - -/** - * Deprecated class which was in use as main page in Customer Account "My Product Reviews" tab. - * - * @deprecated Remove Customer module's dependency on Review. Non-used class. - * @see \Magento\Review\Controller\Customer\Index - */ -class Index extends Review -{ -} diff --git a/app/code/Magento/Customer/Controller/Review/View.php b/app/code/Magento/Customer/Controller/Review/View.php deleted file mode 100644 index d870810d77098..0000000000000 --- a/app/code/Magento/Customer/Controller/Review/View.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php -/** - * - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Customer\Controller\Review; - -use Magento\Customer\Controller\Review; - -/** - * Deprecated class which was in use as view page in Customer Account "My Product Reviews" tab. - * - * @deprecated Remove Customer module's dependency on Review. Non-used class. - * @see \Magento\Review\Controller\Customer\View - */ -class View extends Review -{ -} From 2860283bd1797bab573925501964712e0c177ed8 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Mon, 6 Jan 2020 11:29:20 +0200 Subject: [PATCH 0663/1143] Cover changes with unit test --- .../Theme/Test/Unit/Block/Html/PagerTest.php | 109 ++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 app/code/Magento/Theme/Test/Unit/Block/Html/PagerTest.php diff --git a/app/code/Magento/Theme/Test/Unit/Block/Html/PagerTest.php b/app/code/Magento/Theme/Test/Unit/Block/Html/PagerTest.php new file mode 100644 index 0000000000000..79a06e64479c7 --- /dev/null +++ b/app/code/Magento/Theme/Test/Unit/Block/Html/PagerTest.php @@ -0,0 +1,109 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Theme\Test\Unit\Block\Html; + +use Magento\Framework\App\Config; +use Magento\Framework\Data\Collection; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Framework\UrlInterface; +use Magento\Framework\View\Element\Template\Context; +use Magento\Theme\Block\Html\Pager; +use PHPUnit\Framework\TestCase; + +/** + * Test For Page class + */ +class PagerTest extends TestCase +{ + + /** + * @var Pager $pager + */ + private $pager; + + /** + * @var Context $context + */ + private $context; + + /** + * @var Config $scopeConfig + */ + private $scopeConfig; + + /** + * @var ObjectManager $objectManager + */ + private $objectManager; + + /** + * @var UrlInterface $urlBuilderMock + */ + private $urlBuilderMock; + + /** + * @inheritdoc + */ + protected function setUp() + { + $this->context = $this->createMock(Context::class); + $this->urlBuilderMock = $this->createMock(UrlInterface::class); + $this->context->expects($this->any()) + ->method('getUrlBuilder') + ->willReturn($this->urlBuilderMock); + $this->scopeConfig = $this->createMock(Config::class); + $this->pager = (new ObjectManager($this))->getObject( + Pager::class, + ['context' => $this->context] + ); + } + + /** + * Verify current page Url + * + * @return void + */ + public function testGetPageUrl(): void + { + $expectedPageUrl = 'page-url'; + $this->urlBuilderMock->expects($this->once()) + ->method('getUrl') + ->willReturn($expectedPageUrl); + $this->assertEquals($expectedPageUrl, $this->pager->getPageUrl(0)); + } + + /** + * Verify get pages method. + * + * @return void + */ + public function testGetPages(): void + { + $expectedPages = range(1, 5); + $collectionMock = $this->createMock(Collection::class); + $collectionMock->expects($this->exactly(2)) + ->method('getCurPage') + ->willReturn(2); + $collectionMock->expects($this->any()) + ->method('getLastPageNumber') + ->willReturn(10); + $this->setCollectionProperty($collectionMock); + $this->assertEquals($expectedPages, $this->pager->getPages()); + } + + /** + * Set Collection + * + * @return void + */ + private function setCollectionProperty($collection): void + { + $reflection = new \ReflectionClass($this->pager); + $reflection_property = $reflection->getProperty('_collection'); + $reflection_property->setAccessible(true); + $reflection_property->setValue($this->pager, $collection); + } +} From 9c4991a5828b34c98e753ecc62dda592a6ff54fc Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Mon, 6 Jan 2020 11:51:45 +0200 Subject: [PATCH 0664/1143] fix static test --- app/code/Magento/Theme/Test/Unit/Block/Html/PagerTest.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/code/Magento/Theme/Test/Unit/Block/Html/PagerTest.php b/app/code/Magento/Theme/Test/Unit/Block/Html/PagerTest.php index 79a06e64479c7..2fa1c637f1838 100644 --- a/app/code/Magento/Theme/Test/Unit/Block/Html/PagerTest.php +++ b/app/code/Magento/Theme/Test/Unit/Block/Html/PagerTest.php @@ -34,11 +34,6 @@ class PagerTest extends TestCase */ private $scopeConfig; - /** - * @var ObjectManager $objectManager - */ - private $objectManager; - /** * @var UrlInterface $urlBuilderMock */ From d05e25bdd421321dff3da3576d0b63c18141728e Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Mon, 6 Jan 2020 12:22:43 +0200 Subject: [PATCH 0665/1143] MC-30224: [2.4] Deleting an empty user model caused deleting admin role --- .../Magento/User/Model/ResourceModel/User.php | 20 ++++++------ .../User/Model/ResourceModel/UserTest.php | 31 ++++++++++++++++++- 2 files changed, 41 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/User/Model/ResourceModel/User.php b/app/code/Magento/User/Model/ResourceModel/User.php index 4eaf6116056dd..b5927bbe4cef0 100644 --- a/app/code/Magento/User/Model/ResourceModel/User.php +++ b/app/code/Magento/User/Model/ResourceModel/User.php @@ -258,15 +258,17 @@ public function delete(\Magento\Framework\Model\AbstractModel $user) $uid = $user->getId(); $connection->beginTransaction(); - try { - $connection->delete($this->getMainTable(), ['user_id = ?' => $uid]); - $connection->delete( - $this->getTable('authorization_role'), - ['user_id = ?' => $uid, 'user_type = ?' => UserContextInterface::USER_TYPE_ADMIN] - ); - } catch (\Magento\Framework\Exception\LocalizedException $e) { - $connection->rollBack(); - return false; + if ($uid) { + try { + $connection->delete($this->getMainTable(), ['user_id = ?' => $uid]); + $connection->delete( + $this->getTable('authorization_role'), + ['user_id = ?' => $uid, 'user_type = ?' => UserContextInterface::USER_TYPE_ADMIN] + ); + } catch (\Magento\Framework\Exception\LocalizedException $e) { + $connection->rollBack(); + return false; + } } $connection->commit(); $this->_afterDelete($user); diff --git a/dev/tests/integration/testsuite/Magento/User/Model/ResourceModel/UserTest.php b/dev/tests/integration/testsuite/Magento/User/Model/ResourceModel/UserTest.php index 53a0b748c32f6..d9f11b3d2f08e 100644 --- a/dev/tests/integration/testsuite/Magento/User/Model/ResourceModel/UserTest.php +++ b/dev/tests/integration/testsuite/Magento/User/Model/ResourceModel/UserTest.php @@ -5,9 +5,11 @@ */ namespace Magento\User\Model\ResourceModel; +use Magento\Authorization\Model\ResourceModel\Role\Collection as UserRoleCollection; +use Magento\Authorization\Model\UserContextInterface; use Magento\TestFramework\Helper\Bootstrap; -use Magento\User\Model\User; use Magento\User\Model\ResourceModel\User as UserResourceModel; +use Magento\User\Model\User; /** * @magentoAppArea adminhtml @@ -46,6 +48,33 @@ public function testGetLatestPasswordWhenZeroPasswordLifetime() ); } + /** + * Test that user role is not deleted after deleting empty user + */ + public function testDelete() + { + $this->checkRoleCollectionSize(); + /** @var User $user */ + $user = Bootstrap::getObjectManager()->create( + User::class + ); + $this->model->delete($user); + $this->checkRoleCollectionSize(); + } + + /** + * Ensure that role collection size is correct + */ + private function checkRoleCollectionSize() + { + /** @var UserRoleCollection $roleCollection */ + $roleCollection = Bootstrap::getObjectManager()->create( + UserRoleCollection::class + ); + $roleCollection->setUserFilter(0, UserContextInterface::USER_TYPE_ADMIN); + $this->assertEquals(1, $roleCollection->getSize()); + } + public function testCountAll() { $this->assertSame(1, $this->model->countAll()); From ae0ab69a18e99422315828f30a65025920ae0b5f Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Mon, 6 Jan 2020 13:08:31 +0200 Subject: [PATCH 0666/1143] Cover changes with unit test --- .../Unit/Controller/Category/ViewTest.php | 44 ++++++++++++++++++- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Controller/Category/ViewTest.php b/app/code/Magento/Catalog/Test/Unit/Controller/Category/ViewTest.php index b826f25d7c591..6413eb389e2e2 100644 --- a/app/code/Magento/Catalog/Test/Unit/Controller/Category/ViewTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Controller/Category/ViewTest.php @@ -178,7 +178,13 @@ protected function setUp() ); } - public function testApplyCustomLayoutUpdate() + /** + * Apply custom layout update is correct + * + * @dataProvider getInvokationData + * @return void + */ + public function testApplyCustomLayoutUpdate(array $expectedData): void { $categoryId = 123; $pageLayout = 'page_layout'; @@ -199,11 +205,45 @@ public function testApplyCustomLayoutUpdate() \Magento\Framework\DataObject::class, ['getPageLayout', 'getLayoutUpdates'] ); + $this->expectationForPageLayoutHandles($expectedData); $settings->expects($this->atLeastOnce())->method('getPageLayout')->will($this->returnValue($pageLayout)); $settings->expects($this->once())->method('getLayoutUpdates')->willReturn(['update1', 'update2']); - $this->catalogDesign->expects($this->any())->method('getDesignSettings')->will($this->returnValue($settings)); $this->action->execute(); } + + /** + * Expected invocation for Layout Handles + * + * @param array $data + * @return void + */ + private function expectationForPageLayoutHandles($data): void + { + $index = 2; + foreach ($data as $expectedData) { + $this->page->expects($this->at($index)) + ->method('addPageLayoutHandles') + ->with($expectedData[0], $expectedData[1], $expectedData[2]); + $index++; + } + } + + /** + * Data provider for execute method. + * + * @return array + */ + public function getInvokationData(): array + { + return [ + [ + 'layoutHandles' => [ + [['type' => 'default_without_children'], null, false], + [['displaymode' => ''], null, false] + ] + ] + ]; + } } From 890206a44c65ec36da40549a32b2183309aeebac Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Mon, 6 Jan 2020 13:11:57 +0200 Subject: [PATCH 0667/1143] fix typo --- .../Catalog/Test/Unit/Controller/Category/ViewTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Controller/Category/ViewTest.php b/app/code/Magento/Catalog/Test/Unit/Controller/Category/ViewTest.php index 6413eb389e2e2..bdcb5c66657fd 100644 --- a/app/code/Magento/Catalog/Test/Unit/Controller/Category/ViewTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Controller/Category/ViewTest.php @@ -181,7 +181,7 @@ protected function setUp() /** * Apply custom layout update is correct * - * @dataProvider getInvokationData + * @dataProvider getInvocationData * @return void */ public function testApplyCustomLayoutUpdate(array $expectedData): void @@ -235,7 +235,7 @@ private function expectationForPageLayoutHandles($data): void * * @return array */ - public function getInvokationData(): array + public function getInvocationData(): array { return [ [ From e3b7d351c962624e85f8946fbf35b474d64e408a Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Mon, 6 Jan 2020 13:29:43 +0200 Subject: [PATCH 0668/1143] MC-29946: [On Prem] - When transaction is declined, no default shipping / billing gets set after entering another card --- .../Model/ResourceModel/Address/Relation.php | 66 ++++++++++++---- .../ResourceModel/AddressRepositoryTest.php | 78 ++++++++++++++----- 2 files changed, 107 insertions(+), 37 deletions(-) diff --git a/app/code/Magento/Customer/Model/ResourceModel/Address/Relation.php b/app/code/Magento/Customer/Model/ResourceModel/Address/Relation.php index ae342a1b10dd8..cf837e2924161 100644 --- a/app/code/Magento/Customer/Model/ResourceModel/Address/Relation.php +++ b/app/code/Magento/Customer/Model/ResourceModel/Address/Relation.php @@ -1,14 +1,18 @@ <?php /** - * Customer address entity resource model - * * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Customer\Model\ResourceModel\Address; +use Magento\Customer\Api\Data\CustomerInterface; use Magento\Customer\Model\Address; use Magento\Customer\Model\Customer; +use Magento\Customer\Model\CustomerFactory; +use Magento\Customer\Model\CustomerRegistry; +use Magento\Framework\Model\AbstractModel; use Magento\Framework\Model\ResourceModel\Db\VersionControl\RelationInterface; /** @@ -17,29 +21,36 @@ class Relation implements RelationInterface { /** - * @var \Magento\Customer\Model\CustomerFactory + * @var CustomerFactory */ protected $customerFactory; /** - * @param \Magento\Customer\Model\CustomerFactory $customerFactory + * @var CustomerRegistry */ - public function __construct(\Magento\Customer\Model\CustomerFactory $customerFactory) - { + private $customerRegistry; + + /** + * @param CustomerFactory $customerFactory + * @param CustomerRegistry $customerRegistry + */ + public function __construct( + CustomerFactory $customerFactory, + CustomerRegistry $customerRegistry + ) { $this->customerFactory = $customerFactory; + $this->customerRegistry = $customerRegistry; } /** * Process object relations * - * @param \Magento\Framework\Model\AbstractModel $object + * @param AbstractModel $object * @return void */ - public function processRelation(\Magento\Framework\Model\AbstractModel $object) + public function processRelation(AbstractModel $object): void { - /** - * @var $object Address - */ + /** @var $object Address */ if (!$object->getIsCustomerSaveTransaction() && $object->getId()) { $customer = $this->customerFactory->create()->load($object->getCustomerId()); @@ -53,6 +64,7 @@ public function processRelation(\Magento\Framework\Model\AbstractModel $object) $changedAddresses, $customer->getResource()->getConnection()->quoteInto('entity_id = ?', $customer->getId()) ); + $this->updateCustomerRegistry($customer, $changedAddresses); } } } @@ -71,12 +83,12 @@ private function getDefaultBillingChangedAddress( array $changedAddresses ): array { if ($object->getIsDefaultBilling()) { - $changedAddresses['default_billing'] = $object->getId(); + $changedAddresses[CustomerInterface::DEFAULT_BILLING] = $object->getId(); } elseif ($customer->getDefaultBillingAddress() && $object->getIsDefaultBilling() === false && (int)$customer->getDefaultBillingAddress()->getId() === (int)$object->getId() ) { - $changedAddresses['default_billing'] = null; + $changedAddresses[CustomerInterface::DEFAULT_BILLING] = null; } return $changedAddresses; @@ -96,27 +108,47 @@ private function getDefaultShippingChangedAddress( array $changedAddresses ): array { if ($object->getIsDefaultShipping()) { - $changedAddresses['default_shipping'] = $object->getId(); + $changedAddresses[CustomerInterface::DEFAULT_SHIPPING] = $object->getId(); } elseif ($customer->getDefaultShippingAddress() && $object->getIsDefaultShipping() === false && (int)$customer->getDefaultShippingAddress()->getId() === (int)$object->getId() ) { - $changedAddresses['default_shipping'] = null; + $changedAddresses[CustomerInterface::DEFAULT_SHIPPING] = null; } return $changedAddresses; } + /** + * Push updated customer entity to the registry. + * + * @param Customer $customer + * @param array $changedAddresses + * @return void + */ + private function updateCustomerRegistry(Customer $customer, array $changedAddresses): void + { + if (array_key_exists(CustomerInterface::DEFAULT_BILLING, $changedAddresses)) { + $customer->setDefaultBilling($changedAddresses[CustomerInterface::DEFAULT_BILLING]); + } + + if (array_key_exists(CustomerInterface::DEFAULT_SHIPPING, $changedAddresses)) { + $customer->setDefaultShipping($changedAddresses[CustomerInterface::DEFAULT_SHIPPING]); + } + + $this->customerRegistry->push($customer); + } + /** * Checks if address has chosen as default and has had an id * * @deprecated Is not used anymore due to changes in logic of save of address. * If address was default and becomes not default than default address id for customer must be * set to null - * @param \Magento\Framework\Model\AbstractModel $object + * @param AbstractModel $object * @return bool */ - protected function isAddressDefault(\Magento\Framework\Model\AbstractModel $object) + protected function isAddressDefault(AbstractModel $object) { return $object->getId() && ($object->getIsDefaultBilling() || $object->getIsDefaultShipping()); } diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/AddressRepositoryTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/AddressRepositoryTest.php index 299d09d9400de..fb88a66423e65 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/AddressRepositoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/AddressRepositoryTest.php @@ -40,6 +40,8 @@ class AddressRepositoryTest extends \PHPUnit\Framework\TestCase /** @var \Magento\Framework\Api\DataObjectHelper */ private $dataObjectHelper; + private $customerRegistry; + /** * Set up. */ @@ -56,6 +58,7 @@ protected function setUp() \Magento\Customer\Api\Data\AddressInterfaceFactory::class ); $this->dataObjectHelper = $this->objectManager->create(\Magento\Framework\Api\DataObjectHelper::class); + $this->customerRegistry = $this->objectManager->get(\Magento\Customer\Model\CustomerRegistry::class); $regionFactory = $this->objectManager->get(RegionInterfaceFactory::class); $region = $regionFactory->create() @@ -96,10 +99,7 @@ protected function setUp() */ protected function tearDown() { - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var \Magento\Customer\Model\CustomerRegistry $customerRegistry */ - $customerRegistry = $objectManager->get(\Magento\Customer\Model\CustomerRegistry::class); - $customerRegistry->remove(1); + $this->customerRegistry->remove(1); } /** @@ -506,6 +506,60 @@ public function testSaveAddressWithRestrictedCountries() self::assertNotEmpty($saved->getId()); } + /** + * Test for saving address with extra spaces in phone. + * + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoDataFixture Magento/Customer/_files/customer_address.php + */ + public function testSaveNewAddressWithExtraSpacesInPhone() + { + $proposedAddress = $this->_createSecondAddress() + ->setCustomerId(1) + ->setTelephone(' 123456 '); + $returnedAddress = $this->repository->save($proposedAddress); + $savedAddress = $this->repository->getById($returnedAddress->getId()); + $this->assertEquals('123456', $savedAddress->getTelephone()); + } + + /** + * Scenario for customer's default shipping and billing address saving and rollback. + * + * @magentoDataFixture Magento/Customer/_files/customer_without_addresses.php + */ + public function testCustomerAddressRelationSynchronisation() + { + /** + * Creating new address which is default shipping and billing for existing customer. + */ + $address = $this->expectedAddresses[0]; + $address->setId(null); + $address->setCustomerId(1); + $address->setIsDefaultShipping(true); + $address->setIsDefaultBilling(true); + $savedAddress = $this->repository->save($address); + + /** + * Customer registry should be updated with default shipping and billing addresses. + */ + $customer = $this->getCustomer('customer@example.com', 1); + $this->assertEquals($savedAddress->getId(), $customer->getDefaultShipping()); + $this->assertEquals($savedAddress->getId(), $customer->getDefaultBilling()); + + /** + * Registry should be clean up for reading data from DB. + */ + $this->repository->deleteById($savedAddress->getId()); + $this->customerRegistry->removeByEmail('customer@example.com'); + + /** + * Customer's default shipping and billing addresses should be updated. + */ + $customer = $this->getCustomer('customer@example.com', 1); + $this->assertNull($customer->getDefaultShipping()); + $this->assertNull($customer->getDefaultBilling()); + } + /** * Helper function that returns an Address Data Object that matches the data from customer_address fixture * @@ -571,20 +625,4 @@ private function getWebsite(string $code): WebsiteInterface $repository = $this->objectManager->get(WebsiteRepositoryInterface::class); return $repository->get($code); } - - /** - * Test for saving address with extra spaces in phone. - * - * @magentoDataFixture Magento/Customer/_files/customer.php - * @magentoDataFixture Magento/Customer/_files/customer_address.php - */ - public function testSaveNewAddressWithExtraSpacesInPhone() - { - $proposedAddress = $this->_createSecondAddress() - ->setCustomerId(1) - ->setTelephone(' 123456 '); - $returnedAddress = $this->repository->save($proposedAddress); - $savedAddress = $this->repository->getById($returnedAddress->getId()); - $this->assertEquals('123456', $savedAddress->getTelephone()); - } } From 4cd5cd211ba8e169f7b717169eb1ecd00e7d2c36 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Mon, 6 Jan 2020 13:51:07 +0200 Subject: [PATCH 0669/1143] Fix phpStan --- app/code/Magento/Catalog/Controller/Category/View.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Catalog/Controller/Category/View.php b/app/code/Magento/Catalog/Controller/Category/View.php index cecae0b2ea8ac..552af244f0097 100644 --- a/app/code/Magento/Catalog/Controller/Category/View.php +++ b/app/code/Magento/Catalog/Controller/Category/View.php @@ -9,6 +9,7 @@ use Magento\Catalog\Api\CategoryRepositoryInterface; use Magento\Catalog\Helper\Category as CategoryHelper; use Magento\Catalog\Model\Category; +use Magento\Catalog\Model\Category\Attribute\LayoutUpdateManager; use Magento\Catalog\Model\Design; use Magento\Catalog\Model\Layer\Resolver; use Magento\Catalog\Model\Product\ProductList\ToolbarMemorizer; @@ -30,7 +31,6 @@ use Magento\Framework\View\Result\PageFactory; use Magento\Store\Model\StoreManagerInterface; use Psr\Log\LoggerInterface; -use Magento\Catalog\Model\Category\Attribute\LayoutUpdateManager; /** * View a category on storefront. Needs to be accessible by POST because of the store switching. @@ -208,8 +208,10 @@ protected function _initCategory() * @return ResultInterface * @throws NoSuchEntityException */ - public function execute() + public function execute(): ?ResultInterface { + $result = null; + if ($this->_request->getParam(ActionInterface::PARAM_NAME_URL_ENCODED)) { return $this->resultRedirectFactory->create()->setUrl($this->_redirect->getRedirectUrl()); } @@ -251,8 +253,9 @@ public function execute() return $page; } elseif (!$this->getResponse()->isRedirect()) { - return $this->resultForwardFactory->create()->forward('noroute'); + $result = $this->resultForwardFactory->create()->forward('noroute'); } + return $result; } /** From cfd7771232d328da6c5ed6903b53984e06b027e7 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Mon, 6 Jan 2020 15:37:41 +0200 Subject: [PATCH 0670/1143] Cover changes with unit test --- .../Test/Unit/Model/Config/StructureTest.php | 128 ++++++++++++++---- .../Unit/Model/_files/converted_config.php | 14 +- 2 files changed, 108 insertions(+), 34 deletions(-) diff --git a/app/code/Magento/Config/Test/Unit/Model/Config/StructureTest.php b/app/code/Magento/Config/Test/Unit/Model/Config/StructureTest.php index a17faf8f35883..93f143b99a42d 100644 --- a/app/code/Magento/Config/Test/Unit/Model/Config/StructureTest.php +++ b/app/code/Magento/Config/Test/Unit/Model/Config/StructureTest.php @@ -50,6 +50,9 @@ class StructureTest extends \PHPUnit\Framework\TestCase */ protected $_structureData; + /** + * @inheritdoc + */ protected function setUp() { $this->_flyweightFactory = $this->getMockBuilder(FlyweightFactory::class) @@ -82,7 +85,12 @@ protected function setUp() ); } - public function testGetTabsBuildsSectionTree() + /** + * Verify tabs build section tree + * + * @return void + */ + public function testGetTabsBuildsSectionTree(): void { $expected = ['tab1' => ['children' => ['section1' => ['tab' => 'tab1']]]]; @@ -108,7 +116,12 @@ public function testGetTabsBuildsSectionTree() $this->assertEquals($this->_tabIteratorMock, $model->getTabs()); } - public function testGetSectionList() + /** + * Verify get section list method + * + * @return void + */ + public function testGetSectionList(): void { $expected = [ 'section1_child_id_1' => true, @@ -152,6 +165,8 @@ public function testGetSectionList() } /** + * Verify Get Element return empty element if element is requested + * * @param string $path * @param string $expectedType * @param string $expectedId @@ -174,6 +189,8 @@ public function testGetElementReturnsEmptyElementIfNotExistingElementIsRequested } /** + * Verify get Element return empty by path element if not exist + * * @param string $path * @param string $expectedType * @param string $expectedId @@ -196,6 +213,8 @@ public function testGetElementReturnsEmptyByConfigPathElementIfNotExistingElemen } /** + * Verify Element return e,pty element if not exists + * * @param string $expectedType * @param string $expectedId * @param string $expectedPath @@ -234,14 +253,24 @@ public function emptyElementDataProvider() ]; } - public function testGetElementReturnsProperElementByPath() + /** + * Verify get element returns proper element by path + * + * @return void + */ + public function testGetElementReturnsProperElementByPath(): void { $elementMock = $this->getElementPathReturnsProperElementByPath(); $this->assertEquals($elementMock, $this->_model->getElement('section_1/group_level_1/field_3')); } - public function testGetElementByConfigPathReturnsProperElementByPath() + /** + * Verify get element by config path return proper path + * + * @return void + */ + public function testGetElementByConfigPathReturnsProperElementByPath(): void { $elementMock = $this->getElementPathReturnsProperElementByPath(); @@ -249,6 +278,8 @@ public function testGetElementByConfigPathReturnsProperElementByPath() } /** + * Build mock element + * * @return Mock */ private function getElementPathReturnsProperElementByPath() @@ -271,7 +302,12 @@ private function getElementPathReturnsProperElementByPath() return $elementMock; } - public function testGetElementByPathPartsIfSectionDataIsEmpty() + /** + * Verefy get element by path part + * + * @return void + */ + public function testGetElementByPathPartsIfSectionDataIsEmpty(): void { $fieldData = [ 'id' => 'field_3', @@ -342,7 +378,12 @@ public function testGetFirstSectionReturnsFirstAllowedSection() $this->assertEquals('currentSection', $this->_model->getFirstSection()->getData()); } - public function testGetElementReturnsProperElementByPathCachesObject() + /** + * Verify get element return element by path caches object + * + * @return void + */ + public function testGetElementReturnsProperElementByPathCachesObject(): void { $elementMock = $this->getElementReturnsProperElementByPathCachesObject(); @@ -350,7 +391,12 @@ public function testGetElementReturnsProperElementByPathCachesObject() $this->assertEquals($elementMock, $this->_model->getElement('section_1/group_level_1/field_3')); } - public function testGetElementByConfigPathReturnsProperElementByPathCachesObject() + /** + * Verify Get Element by id returns proper element + * + * @return void + */ + public function testGetElementByConfigPathReturnsProperElementByPathCachesObject(): void { $elementMock = $this->getElementReturnsProperElementByPathCachesObject(); @@ -393,6 +439,8 @@ public function testGetFieldPathsByAttribute($attributeName, $attributeValue, $p } /** + * DataProvider + * * @return array */ public function getFieldPathsByAttributeDataProvider() @@ -411,33 +459,53 @@ public function getFieldPathsByAttributeDataProvider() ]; } - public function testGetFieldPaths() + /** + * Verify get Fields paths method + * + * @dataProvider getFieldPaths + * @param array $expected + * @return void + */ + public function testGetFieldPaths(array $expected): void { - $expected = [ - 'section/group/field2' => [ - 'field_2' - ], - 'field_3' => [ - 'field_3', - 'field_3' - ], - 'field_3_1' => [ - 'field_3_1' - ], - 'field_3_1_1' => [ - 'field_3_1_1' - ], - 'section/group/field4' => [ - 'field_4', - ], - 'field_5' => [ - 'field_5', - ], - ]; - $this->assertSame( $expected, $this->_model->getFieldPaths() ); } + + /** + * dataprovider for Field Paths + * + * @return array + */ + public function getFieldPaths(): array + { + return [ + [ + [ + 'section/group/field2' => [ + 'field_2' + ], + 'field_3' => [ + 'field_3', + 'field_3' + ], + 'field_3_1' => [ + 'field_3_1' + ], + 'field_3_1_1' => [ + 'field_3_1_1' + ], + 'section/group/field4' => [ + 'field_4', + ], + 'field_5' => [ + 'field_5', + ], + 'section_3' => ['section_3'] + ] + ] + ]; + } } diff --git a/app/code/Magento/Config/Test/Unit/Model/_files/converted_config.php b/app/code/Magento/Config/Test/Unit/Model/_files/converted_config.php index ef2447338dc07..8f4b152e4dcd1 100644 --- a/app/code/Magento/Config/Test/Unit/Model/_files/converted_config.php +++ b/app/code/Magento/Config/Test/Unit/Model/_files/converted_config.php @@ -76,7 +76,7 @@ 'translate' => 'label', 'showInWebsite' => '1', 'backend_model' => - \Magento\Config\Model\Config\Backend\Encrypted::class, + \Magento\Config\Model\Config\Backend\Encrypted::class, 'type' => 'text', 'label' => 'Field 3.1.1', '_elementType' => 'field', @@ -158,14 +158,14 @@ ], '_elementType' => 'field', ], - 'field_5' => [ + 'field_5' => [ 'id' => 'field_5', 'translate' => 'label', 'showInWebsite' => '1', 'type' => 'text', 'label' => '', '_elementType' => 'field', - ], + ], ], '_elementType' => 'group', ], @@ -190,7 +190,13 @@ ], '_elementType' => 'section', ], - ], + 'section_3' => [ + 'id' => 'section_3', + 'type' => 'text', + 'tab' => 'tab_1', + '_elementType' => 'field' + ], + ], ], ], ]; From 5e6c59522154c4c72db3d6f2472869bf33657cd8 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Mon, 6 Jan 2020 15:58:44 +0200 Subject: [PATCH 0671/1143] Static test fix --- .../Config/Test/Unit/Model/_files/converted_config.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Config/Test/Unit/Model/_files/converted_config.php b/app/code/Magento/Config/Test/Unit/Model/_files/converted_config.php index 8f4b152e4dcd1..54fd5719c4881 100644 --- a/app/code/Magento/Config/Test/Unit/Model/_files/converted_config.php +++ b/app/code/Magento/Config/Test/Unit/Model/_files/converted_config.php @@ -75,8 +75,7 @@ 'id' => 'field_3_1_1', 'translate' => 'label', 'showInWebsite' => '1', - 'backend_model' => - \Magento\Config\Model\Config\Backend\Encrypted::class, + 'backend_model' => \Magento\Config\Model\Config\Backend\Encrypted::class, 'type' => 'text', 'label' => 'Field 3.1.1', '_elementType' => 'field', @@ -196,7 +195,7 @@ 'tab' => 'tab_1', '_elementType' => 'field' ], - ], + ], ], ], ]; From b60c0dc35da998d2fac96fe340d26f72c4bcdf13 Mon Sep 17 00:00:00 2001 From: Lukasz Bajsarowicz <lukasz.bajsarowicz@gmail.com> Date: Mon, 6 Jan 2020 15:06:40 +0100 Subject: [PATCH 0672/1143] Update app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckPaginationInStorefrontTest.xml Co-Authored-By: Ihor Sviziev <ihor-sviziev@users.noreply.github.com> --- .../Test/Mftf/Test/AdminCheckPaginationInStorefrontTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckPaginationInStorefrontTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckPaginationInStorefrontTest.xml index 6eb7b7ea456b3..668a4e096c83d 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckPaginationInStorefrontTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckPaginationInStorefrontTest.xml @@ -115,7 +115,7 @@ <click selector="{{CatalogProductsSection.resetFilter}}" stepKey="clickOnResetFilter"/> <waitForPageLoad stepKey="waitForPageToLoad3"/> <selectOption selector="{{AdminProductGridFilterSection.productPerPage}}" userInput="30" stepKey="selectPagePerView"/> - <waitForPageLoad stepKey="waitFroPageToLoad1" time="30"/> + <waitForPageLoad stepKey="waitForPageToLoad1" time="30"/> <fillField selector="{{AdminCategoryContentSection.productTableColumnName}}" userInput="pagi" stepKey="selectProduct1"/> <click selector="{{AdminCategoryContentSection.productSearch}}" stepKey="clickSearchButton"/> <waitForPageLoad stepKey="waitFroPageToLoad2"/> From ff1aa7e5f0a37bf13c9c466c50297843bd949d47 Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Mon, 6 Jan 2020 16:44:06 +0200 Subject: [PATCH 0673/1143] MC-29804: [Magento Cloud] JsFooterPlugin.php Bug --- app/code/Magento/Theme/Controller/Result/JsFooterPlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Theme/Controller/Result/JsFooterPlugin.php b/app/code/Magento/Theme/Controller/Result/JsFooterPlugin.php index 317ab39d307cd..6a80dec460660 100644 --- a/app/code/Magento/Theme/Controller/Result/JsFooterPlugin.php +++ b/app/code/Magento/Theme/Controller/Result/JsFooterPlugin.php @@ -41,7 +41,7 @@ public function beforeSendResponse(Http $subject) { $content = $subject->getContent(); $script = []; - if (strpos($content, '</body') !== false) { + if (is_string($content) && strpos($content, '</body') !== false) { if ($this->scopeConfig->isSetFlag( self::XML_PATH_DEV_MOVE_JS_TO_BOTTOM, ScopeInterface::SCOPE_STORE From f563d2c9f33055291db7ae1ae33d14dde8862154 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Mon, 6 Jan 2020 16:33:29 +0100 Subject: [PATCH 0674/1143] Fix duplicated stepKey after typo fix --- .../Test/Mftf/Test/AdminCheckPaginationInStorefrontTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckPaginationInStorefrontTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckPaginationInStorefrontTest.xml index 668a4e096c83d..5bb9cc8a080df 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckPaginationInStorefrontTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckPaginationInStorefrontTest.xml @@ -115,7 +115,7 @@ <click selector="{{CatalogProductsSection.resetFilter}}" stepKey="clickOnResetFilter"/> <waitForPageLoad stepKey="waitForPageToLoad3"/> <selectOption selector="{{AdminProductGridFilterSection.productPerPage}}" userInput="30" stepKey="selectPagePerView"/> - <waitForPageLoad stepKey="waitForPageToLoad1" time="30"/> + <waitForPageLoad stepKey="waitForPageToLoadProductPerPage" time="30"/> <fillField selector="{{AdminCategoryContentSection.productTableColumnName}}" userInput="pagi" stepKey="selectProduct1"/> <click selector="{{AdminCategoryContentSection.productSearch}}" stepKey="clickSearchButton"/> <waitForPageLoad stepKey="waitFroPageToLoad2"/> From 327acbc9ee945a85cfd3a0862bd5462747bb6e94 Mon Sep 17 00:00:00 2001 From: Daniel Renaud <drenaud@magento.com> Date: Mon, 6 Jan 2020 09:39:08 -0600 Subject: [PATCH 0675/1143] MC-25215: [Forwardport] [GraphQL] Row_id is used as id for product resolver - Fix static failure --- .../testsuite/Magento/GraphQl/Bundle/BundleProductViewTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Bundle/BundleProductViewTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Bundle/BundleProductViewTest.php index e7d939bc76c37..4c58241590540 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Bundle/BundleProductViewTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Bundle/BundleProductViewTest.php @@ -15,7 +15,7 @@ use Magento\TestFramework\TestCase\GraphQlAbstract; /** - * Bundle product view test + * Test querying Bundle products */ class BundleProductViewTest extends GraphQlAbstract { From 7079ff504290e8e3017ea7363357209c06780790 Mon Sep 17 00:00:00 2001 From: Daniel Renaud <drenaud@magento.com> Date: Mon, 6 Jan 2020 12:20:13 -0600 Subject: [PATCH 0676/1143] MC-29135: [Forwardport] Throw GraphQL input exception when provided store is not enabled --- .../HttpRequestValidator/StoreValidator.php | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/StoreGraphQl/Controller/HttpRequestValidator/StoreValidator.php b/app/code/Magento/StoreGraphQl/Controller/HttpRequestValidator/StoreValidator.php index 3d41c975e591a..5d0a4edd44b73 100644 --- a/app/code/Magento/StoreGraphQl/Controller/HttpRequestValidator/StoreValidator.php +++ b/app/code/Magento/StoreGraphQl/Controller/HttpRequestValidator/StoreValidator.php @@ -42,14 +42,30 @@ public function validate(HttpRequestInterface $request): void { $headerValue = $request->getHeader('Store'); if (!empty($headerValue)) { - $storeCode = ltrim(rtrim($headerValue)); - $stores = $this->storeManager->getStores(false, true); - if ((!isset($stores[$storeCode]) && strtolower($storeCode) !== 'default') - || !$stores[$storeCode]->getIsActive() - ) { + $storeCode = trim($headerValue); + if (!$this->isStoreActive($storeCode)) { $this->storeManager->setCurrentStore(null); throw new GraphQlInputException(__('Requested store is not found')); } } } + + /** + * Check if provided store code corresponds to an active store + * + * @param string $storeCode + * @return bool + */ + private function isStoreActive(string $storeCode): bool + { + $stores = $this->storeManager->getStores(false, true); + if (strtolower($storeCode) === 'default') { + return true; + } + if (isset($stores[$storeCode])) { + return (bool)$stores[$storeCode]->getIsActive(); + } + + return false; + } } From a45d23ccfaebd16a697e5ad6f4cded46e4c0da1c Mon Sep 17 00:00:00 2001 From: Krissy Hiserote <khiserote@magento.com> Date: Mon, 6 Jan 2020 13:09:44 -0600 Subject: [PATCH 0677/1143] MC-25269: Upgrade from 2.3.x CE with SD to 2.3.x EE fails - move trigger updates from recurring data to recurring schema --- app/code/Magento/Indexer/Setup/Recurring.php | 17 +++++- .../Magento/Indexer/Setup/RecurringData.php | 56 ------------------- 2 files changed, 16 insertions(+), 57 deletions(-) delete mode 100644 app/code/Magento/Indexer/Setup/RecurringData.php diff --git a/app/code/Magento/Indexer/Setup/Recurring.php b/app/code/Magento/Indexer/Setup/Recurring.php index 2f1946fab1ab7..3fba052497c4e 100644 --- a/app/code/Magento/Indexer/Setup/Recurring.php +++ b/app/code/Magento/Indexer/Setup/Recurring.php @@ -6,6 +6,7 @@ namespace Magento\Indexer\Setup; +use Magento\Framework\App\ObjectManager; use Magento\Framework\Encryption\Encryptor; use Magento\Framework\Encryption\EncryptorInterface; use Magento\Framework\Indexer\StateInterface; @@ -13,6 +14,7 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\SchemaSetupInterface; +use Magento\Framework\Indexer\IndexerInterfaceFactory; use Magento\Framework\Indexer\ConfigInterface; use Magento\Indexer\Model\Indexer\State; use Magento\Indexer\Model\Indexer\StateFactory; @@ -51,6 +53,11 @@ class Recurring implements InstallSchemaInterface */ private $stateFactory; + /** + * @var IndexerInterfaceFactory + */ + private $indexerFactory; + /** * Init * @@ -59,19 +66,22 @@ class Recurring implements InstallSchemaInterface * @param ConfigInterface $config * @param EncryptorInterface $encryptor * @param EncoderInterface $encoder + * @param IndexerInterfaceFactory|null $indexerFactory */ public function __construct( CollectionFactory $statesFactory, StateFactory $stateFactory, ConfigInterface $config, EncryptorInterface $encryptor, - EncoderInterface $encoder + EncoderInterface $encoder, + IndexerInterfaceFactory $indexerFactory = null ) { $this->statesFactory = $statesFactory; $this->stateFactory = $stateFactory; $this->config = $config; $this->encryptor = $encryptor; $this->encoder = $encoder; + $this->indexerFactory = $indexerFactory ?: ObjectManager::getInstance()->get(IndexerInterfaceFactory::class); } /** @@ -107,6 +117,11 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con $state->setStatus(StateInterface::STATUS_INVALID); $state->save(); } + + $indexer = $this->indexerFactory->create()->load($indexerId); + if ($indexer->isScheduled()) { + $indexer->getView()->unsubscribe()->subscribe(); + } } } } diff --git a/app/code/Magento/Indexer/Setup/RecurringData.php b/app/code/Magento/Indexer/Setup/RecurringData.php deleted file mode 100644 index 1f6ea09ba853f..0000000000000 --- a/app/code/Magento/Indexer/Setup/RecurringData.php +++ /dev/null @@ -1,56 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Indexer\Setup; - -use Magento\Framework\Indexer\IndexerInterfaceFactory; -use Magento\Framework\Setup\InstallDataInterface; -use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataSetupInterface; -use Magento\Framework\Indexer\ConfigInterface; - -/** - * Recurring data upgrade for indexer module - */ -class RecurringData implements InstallDataInterface -{ - /** - * @var IndexerInterfaceFactory - */ - private $indexerFactory; - - /** - * @var ConfigInterface - */ - private $configInterface; - - /** - * RecurringData constructor. - * - * @param IndexerInterfaceFactory $indexerFactory - * @param ConfigInterface $configInterface - */ - public function __construct( - IndexerInterfaceFactory $indexerFactory, - ConfigInterface $configInterface - ) { - $this->indexerFactory = $indexerFactory; - $this->configInterface = $configInterface; - } - - /** - * {@inheritdoc} - */ - public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) - { - foreach (array_keys($this->configInterface->getIndexers()) as $indexerId) { - $indexer = $this->indexerFactory->create()->load($indexerId); - if ($indexer->isScheduled()) { - $indexer->getView()->unsubscribe()->subscribe(); - } - } - } -} From 571900ac97dfbf7222ca75e4f487047f2823621e Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@adobe.com> Date: Mon, 6 Jan 2020 13:37:34 -0600 Subject: [PATCH 0678/1143] B2B-286: Order search across websites - Fix AdminReorderWithCatalogPriceTest; this test uses the order ID and not its increment ID as is expected by the filter grid - Disable company config in StorefrontVerifyOrdersVisibleInCompanyStructureAcrossMultipleWebsites --- .../Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml index d0502b41e2856..4c7c8b163a38c 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml @@ -52,10 +52,9 @@ </after> <!-- Login as admin --> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - <!--Open order by Id--> - <actionGroup ref="OpenOrderByIdActionGroup" stepKey="openOrderById"> - <argument name="orderId" value="$createGuestCart.return$"/> - </actionGroup> + <!--Open order page by Id--> + <amOnPage url="{{AdminOrderPage.url($createGuestCart.return$)}}" stepKey="navigateToOrderPage"/> + <waitForPageLoad stepKey="waitForCreatedOrderPage"/> <!--Reorder--> <click selector="{{AdminOrderDetailsMainActionsSection.reorder}}" stepKey="clickReorder"/> <!--Verify order item row--> From 243c9df89e1a8b0fc410678e43fdc045e6759305 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Mon, 6 Jan 2020 16:01:52 -0600 Subject: [PATCH 0679/1143] Fix code style --- lib/internal/Magento/Framework/App/Bootstrap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/App/Bootstrap.php b/lib/internal/Magento/Framework/App/Bootstrap.php index e98631ec4adbd..cb86552489472 100644 --- a/lib/internal/Magento/Framework/App/Bootstrap.php +++ b/lib/internal/Magento/Framework/App/Bootstrap.php @@ -225,7 +225,7 @@ public function getParams() * * @param string $type * @param array $arguments - * @return \Magento\Framework\AppInterface + * @return \Magento\Framework\AppInterface | void * @throws \InvalidArgumentException */ public function createApplication($type, $arguments = []) From f7a8831fc919dcda56b2928e669bb4d81a783632 Mon Sep 17 00:00:00 2001 From: Anusha Vattam <avattam@adobe.com> Date: Mon, 6 Jan 2020 16:14:51 -0600 Subject: [PATCH 0680/1143] MC:20074: Fix Skipped MFTF Tests From MC-17140: MC-14104, MC-14502, MC-14532 - Added changes for the JS Login test --- .../Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml index d3b2916ee5825..fe59292a8b0d3 100644 --- a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml +++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml @@ -22,6 +22,7 @@ <before> <magentoCLI command="config:set {{MinifyJavaScriptFilesEnableConfigData.path}} {{MinifyJavaScriptFilesEnableConfigData.value}}" stepKey="enableJsMinification"/> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <see userInput="Dashboard" selector="{{AdminHeaderSection.pageTitle}}" stepKey="seeDashboardTitle"/> </before> <after> <magentoCLI command="config:set {{MinifyJavaScriptFilesDisableConfigData.path}} {{MinifyJavaScriptFilesDisableConfigData.value}}" stepKey="disableJsMinification"/> From ae280acd2e87aebfa3bb8cb66fe6a940fa057035 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Tue, 7 Jan 2020 00:52:58 +0100 Subject: [PATCH 0681/1143] HOTFIX: Invalid use of OpenOrderById (used `entity_id` instead of `increment_id`) --- .../AdminOpenOrderByEntityIdActionGroup.xml | 17 +++++++++++++++++ .../Test/AdminReorderWithCatalogPriceTest.xml | 4 ++-- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOpenOrderByEntityIdActionGroup.xml diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOpenOrderByEntityIdActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOpenOrderByEntityIdActionGroup.xml new file mode 100644 index 0000000000000..c1beb0ee9790a --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOpenOrderByEntityIdActionGroup.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminOpenOrderByEntityIdActionGroup"> + <arguments> + <argument name="entityId" type="string"/> + </arguments> + <amOnPage url="{{AdminOrderPage.url(entityId)}}" stepKey="openOrder"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml index d0502b41e2856..64974a1c357e4 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml @@ -53,8 +53,8 @@ <!-- Login as admin --> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <!--Open order by Id--> - <actionGroup ref="OpenOrderByIdActionGroup" stepKey="openOrderById"> - <argument name="orderId" value="$createGuestCart.return$"/> + <actionGroup ref="AdminOpenOrderByEntityIdActionGroup" stepKey="openOrderById"> + <argument name="entityId" value="$createGuestCart.return$"/> </actionGroup> <!--Reorder--> <click selector="{{AdminOrderDetailsMainActionsSection.reorder}}" stepKey="clickReorder"/> From fedf6713407082aafc0fb2b5af60438cccde7ea2 Mon Sep 17 00:00:00 2001 From: Prabhu Ram <pganapat@adobe.com> Date: Mon, 6 Jan 2020 19:23:24 -0600 Subject: [PATCH 0682/1143] MC-24172: Fix Skipped MFTF Tests From MC-17140: MC-14770, MC-14771, MC-14772 - Unskip and run --- .../ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml | 3 --- .../ApplyCatalogRuleForSimpleProductAndFixedMethodTest.xml | 3 --- ...ApplyCatalogRuleForSimpleProductForNewCustomerGroupTest.xml | 3 --- 3 files changed, 9 deletions(-) diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml index b9e7bfb4d41e4..be2e31d0766bd 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml @@ -17,9 +17,6 @@ <testCaseId value="MC-14770"/> <group value="CatalogRule"/> <group value="mtf_migrated"/> - <skip> - <issueId value="MC-17140"/> - </skip> </annotations> <before> <!-- Login as Admin --> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductAndFixedMethodTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductAndFixedMethodTest.xml index 3405d0c4e776d..7b7953c1d9b06 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductAndFixedMethodTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductAndFixedMethodTest.xml @@ -17,9 +17,6 @@ <testCaseId value="MC-14771"/> <group value="CatalogRule"/> <group value="mtf_migrated"/> - <skip> - <issueId value="MC-17140"/> - </skip> </annotations> <before> <!-- Login as Admin --> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductForNewCustomerGroupTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductForNewCustomerGroupTest.xml index c3bcde92bd1f2..e4af21cac6723 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductForNewCustomerGroupTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductForNewCustomerGroupTest.xml @@ -17,9 +17,6 @@ <testCaseId value="MC-14772"/> <group value="CatalogRule"/> <group value="mtf_migrated"/> - <skip> - <issueId value="MC-17140"/> - </skip> </annotations> <before> <!-- Login as Admin --> From d9a4bca7a289ea6c024d02989a6a29db54b1e5de Mon Sep 17 00:00:00 2001 From: Daniel Ruf <d.ruf@bitexpert.de> Date: Tue, 7 Jan 2020 08:34:32 +0100 Subject: [PATCH 0683/1143] Remove extraneous whitespace - #26275 --- .../view/frontend/web/template/form/element/email.html | 8 ++------ .../Customer/view/frontend/templates/address/edit.phtml | 4 +--- .../Ui/view/frontend/web/templates/form/field.html | 6 +----- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/template/form/element/email.html b/app/code/Magento/Checkout/view/frontend/web/template/form/element/email.html index 8d6142e07fcf0..8e71d5845cec8 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/form/element/email.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/form/element/email.html @@ -14,9 +14,7 @@ method="post"> <fieldset id="customer-email-fieldset" class="fieldset" data-bind="blockLoader: isLoading"> <div class="field required"> - <label class="label" for="customer-email"> - <span data-bind="i18n: 'Email Address'"></span> - </label> + <label class="label" for="customer-email"><span data-bind="i18n: 'Email Address'"></span></label> <div class="control _with-tooltip"> <input class="input-text" type="email" @@ -35,9 +33,7 @@ <!--Hidden fields --> <fieldset class="fieldset hidden-fields" data-bind="fadeVisible: isPasswordVisible"> <div class="field"> - <label class="label" for="customer-password"> - <span data-bind="i18n: 'Password'"></span> - </label> + <label class="label" for="customer-password"><span data-bind="i18n: 'Password'"></span></label> <div class="control"> <input class="input-text" data-bind=" diff --git a/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml b/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml index cf5b60568ad05..a3a7a0ea57946 100644 --- a/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml @@ -39,9 +39,7 @@ <legend class="legend"><span><?= $block->escapeHtml(__('Address')) ?></span></legend><br> <?php $_streetValidationClass = $this->helper(\Magento\Customer\Helper\Address::class)->getAttributeValidationClass('street'); ?> <div class="field street required"> - <label for="street_1" class="label"> - <span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('street') ?></span> - </label> + <label for="street_1" class="label"><span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('street') ?></span></label> <div class="control"> <input type="text" name="street[]" diff --git a/app/code/Magento/Ui/view/frontend/web/templates/form/field.html b/app/code/Magento/Ui/view/frontend/web/templates/form/field.html index cbd3242b451b4..8ef49e307747b 100644 --- a/app/code/Magento/Ui/view/frontend/web/templates/form/field.html +++ b/app/code/Magento/Ui/view/frontend/web/templates/form/field.html @@ -6,11 +6,7 @@ --> <div class="field" data-bind="visible: visible, attr: {'name': element.dataScope}, css: additionalClasses"> - <label class="label" data-bind="attr: { for: element.uid }"> - <!-- ko if: element.label --> - <span translate="element.label"></span> - <!-- /ko --> - </label> + <label class="label" data-bind="attr: { for: element.uid }"><!-- ko if: element.label --><span translate="element.label"></span><!-- /ko --></label> <div class="control" data-bind="css: {'_with-tooltip': element.tooltip}"> <!-- ko ifnot: element.hasAddons() --> From 51f4964bf339e7b233e09797cd8762208b974bf2 Mon Sep 17 00:00:00 2001 From: Daniel Ruf <d.ruf@bitexpert.de> Date: Tue, 7 Jan 2020 09:29:08 +0100 Subject: [PATCH 0684/1143] Remove spaces to resolve codestyle warnings --- .../frontend/templates/address/edit.phtml | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml b/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml index a3a7a0ea57946..476d7dc94c56e 100644 --- a/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml @@ -22,15 +22,15 @@ <input type="hidden" name="error_url" value="<?= $block->escapeUrl($block->getErrorUrl()) ?>"> <?= $block->getNameBlockHtml() ?> - <?php if ($_company->isEnabled()) : ?> + <?php if ($_company->isEnabled()): ?> <?= $_company->setCompany($block->getAddress()->getCompany())->toHtml() ?> <?php endif ?> - <?php if ($_telephone->isEnabled()) : ?> + <?php if ($_telephone->isEnabled()): ?> <?= $_telephone->setTelephone($block->getAddress()->getTelephone())->toHtml() ?> <?php endif ?> - <?php if ($_fax->isEnabled()) : ?> + <?php if ($_fax->isEnabled()): ?> <?= $_fax->setFax($block->getAddress()->getFax())->toHtml() ?> <?php endif ?> @@ -49,7 +49,7 @@ class="input-text <?= $block->escapeHtmlAttr($_streetValidationClass) ?>"/> <div class="nested"> <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?> - <?php for ($_i = 1, $_n = $this->helper(\Magento\Customer\Helper\Address::class)->getStreetLines(); $_i < $_n; $_i++) : ?> + <?php for ($_i = 1, $_n = $this->helper(\Magento\Customer\Helper\Address::class)->getStreetLines(); $_i < $_n; $_i++): ?> <div class="field additional"> <label class="label" for="street_<?= /* @noEscape */ $_i + 1 ?>"> <span><?= $block->escapeHtml(__('Street Address %1', $_i + 1)) ?></span> @@ -67,7 +67,7 @@ </div> </div> - <?php if ($this->helper(\Magento\Customer\Helper\Address::class)->isVatAttributeVisible()) : ?> + <?php if ($this->helper(\Magento\Customer\Helper\Address::class)->isVatAttributeVisible()): ?> <div class="field taxvat"> <label class="label" for="vat_id"> <span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('vat_id') ?></span> @@ -134,33 +134,33 @@ </div> </div> - <?php if ($block->isDefaultBilling()) : ?> + <?php if ($block->isDefaultBilling()): ?> <div class="message info"> <span><?= $block->escapeHtml(__("It's a default billing address.")) ?></span> </div> - <?php elseif ($block->canSetAsDefaultBilling()) : ?> + <?php elseif ($block->canSetAsDefaultBilling()): ?> <div class="field choice set billing"> <input type="checkbox" id="primary_billing" name="default_billing" value="1" class="checkbox"> <label class="label" for="primary_billing"> <span><?= $block->escapeHtml(__('Use as my default billing address')) ?></span> </label> </div> - <?php else : ?> + <?php else: ?> <input type="hidden" name="default_billing" value="1" /> <?php endif; ?> - <?php if ($block->isDefaultShipping()) : ?> + <?php if ($block->isDefaultShipping()): ?> <div class="message info"> <span><?= $block->escapeHtml(__("It's a default shipping address.")) ?></span> </div> - <?php elseif ($block->canSetAsDefaultShipping()) : ?> + <?php elseif ($block->canSetAsDefaultShipping()): ?> <div class="field choice set shipping"> <input type="checkbox" id="primary_shipping" name="default_shipping" value="1" class="checkbox"> <label class="label" for="primary_shipping"> <span><?= $block->escapeHtml(__('Use as my default shipping address')) ?></span> </label> </div> - <?php else : ?> + <?php else: ?> <input type="hidden" name="default_shipping" value="1"> <?php endif; ?> </fieldset> From 8fe06ff1c4e362160d4cbad50dfec8b4b0551b4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Szubert?= <bartlomiejszubert@gmail.com> Date: Sun, 5 Jan 2020 12:19:18 +0100 Subject: [PATCH 0685/1143] Fix #7065 - page.main.title is translating title --- app/code/Magento/Theme/Block/Html/Title.php | 53 +++++++- .../Theme/Test/Unit/Block/Html/TitleTest.php | 124 +++++++++++++++--- app/code/Magento/Theme/etc/config.xml | 1 + app/code/Magento/Theme/etc/di.xml | 4 + .../ui_component/design_config_form.xml | 14 ++ 5 files changed, 172 insertions(+), 24 deletions(-) diff --git a/app/code/Magento/Theme/Block/Html/Title.php b/app/code/Magento/Theme/Block/Html/Title.php index ea0feb403180c..9059afe19ab05 100644 --- a/app/code/Magento/Theme/Block/Html/Title.php +++ b/app/code/Magento/Theme/Block/Html/Title.php @@ -5,7 +5,9 @@ */ namespace Magento\Theme\Block\Html; +use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\View\Element\Template; +use Magento\Store\Model\ScopeInterface; /** * Html page title block @@ -19,6 +21,16 @@ */ class Title extends Template { + /** + * Config path to 'Translate Title' header settings + */ + private const XML_PATH_HEADER_TRANSLATE_TITLE = 'design/header/translate_title'; + + /** + * @var ScopeConfigInterface + */ + private $scopeConfig; + /** * Own page title to display on the page * @@ -26,6 +38,22 @@ class Title extends Template */ protected $pageTitle; + /** + * Constructor + * + * @param Template\Context $context + * @param ScopeConfigInterface $scopeConfig + * @param array $data + */ + public function __construct( + Template\Context $context, + ScopeConfigInterface $scopeConfig, + array $data = [] + ) { + parent::__construct($context, $data); + $this->scopeConfig = $scopeConfig; + } + /** * Provide own page title or pick it from Head Block * @@ -36,7 +64,10 @@ public function getPageTitle() if (!empty($this->pageTitle)) { return $this->pageTitle; } - return __($this->pageConfig->getTitle()->getShort()); + + $pageTitle = $this->pageConfig->getTitle()->getShort(); + + return $this->shouldTranslateTitle() ? __($pageTitle) : $pageTitle; } /** @@ -46,10 +77,9 @@ public function getPageTitle() */ public function getPageHeading() { - if (!empty($this->pageTitle)) { - return __($this->pageTitle); - } - return __($this->pageConfig->getTitle()->getShortHeading()); + $pageTitle = !empty($this->pageTitle) ? $this->pageTitle : $this->pageConfig->getTitle()->getShortHeading(); + + return $this->shouldTranslateTitle() ? __($pageTitle) : $pageTitle; } /** @@ -62,4 +92,17 @@ public function setPageTitle($pageTitle) { $this->pageTitle = $pageTitle; } + + /** + * Check if page title should be translated + * + * @return bool + */ + private function shouldTranslateTitle(): bool + { + return $this->scopeConfig->isSetFlag( + static::XML_PATH_HEADER_TRANSLATE_TITLE, + ScopeInterface::SCOPE_STORE + ); + } } diff --git a/app/code/Magento/Theme/Test/Unit/Block/Html/TitleTest.php b/app/code/Magento/Theme/Test/Unit/Block/Html/TitleTest.php index a4d56748eee6b..d6357d8d61995 100644 --- a/app/code/Magento/Theme/Test/Unit/Block/Html/TitleTest.php +++ b/app/code/Magento/Theme/Test/Unit/Block/Html/TitleTest.php @@ -5,29 +5,51 @@ */ namespace Magento\Theme\Test\Unit\Block\Html; +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\Phrase; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\Framework\View\Element\Template\Context; +use Magento\Framework\View\Page\Config; +use Magento\Framework\View\Page\Title as PageTitle; +use Magento\Store\Model\ScopeInterface; +use Magento\Theme\Block\Html\Title; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; -class TitleTest extends \PHPUnit\Framework\TestCase +/** + * Test class for \Magento\Theme\Block\Html\Title + */ +class TitleTest extends TestCase { + /** + * Config path to 'Translate Title' header settings + */ + private const XML_PATH_HEADER_TRANSLATE_TITLE = 'design/header/translate_title'; + /** * @var ObjectManagerHelper */ - protected $objectManagerHelper; + private $objectManagerHelper; + + /** + * @var Config|MockObject + */ + private $pageConfigMock; /** - * @var \Magento\Framework\View\Page\Config|\PHPUnit_Framework_MockObject_MockObject + * @var PageTitle|MockObject */ - protected $pageConfigMock; + private $pageTitleMock; /** - * @var \Magento\Framework\View\Page\Title|\PHPUnit_Framework_MockObject_MockObject + * @var ScopeConfigInterface|MockObject */ - protected $pageTitleMock; + private $scopeConfigMock; /** - * @var \Magento\Theme\Block\Html\Title + * @var Title */ - protected $htmlTitle; + private $htmlTitle; /** * @return void @@ -35,17 +57,22 @@ class TitleTest extends \PHPUnit\Framework\TestCase protected function setUp() { $this->objectManagerHelper = new ObjectManagerHelper($this); - $this->pageConfigMock = $this->createMock(\Magento\Framework\View\Page\Config::class); - $this->pageTitleMock = $this->createMock(\Magento\Framework\View\Page\Title::class); + $this->pageConfigMock = $this->createMock(Config::class); + $this->pageTitleMock = $this->createMock(PageTitle::class); $context = $this->objectManagerHelper->getObject( - \Magento\Framework\View\Element\Template\Context::class, + Context::class, ['pageConfig' => $this->pageConfigMock] ); + $this->scopeConfigMock = $this->getMockForAbstractClass(ScopeConfigInterface::class); + $this->htmlTitle = $this->objectManagerHelper->getObject( - \Magento\Theme\Block\Html\Title::class, - ['context' => $context] + Title::class, + [ + 'context' => $context, + 'scopeConfig' => $this->scopeConfigMock + ] ); } @@ -64,10 +91,16 @@ public function testGetPageTitleWithSetPageTitle() } /** + * @param bool $shouldTranslateTitle + * * @return void + * @dataProvider dataProviderShouldTranslateTitle */ - public function testGetPageTitle() + public function testGetPageTitle($shouldTranslateTitle) { + $this->scopeConfigMock->method('isSetFlag') + ->with(static::XML_PATH_HEADER_TRANSLATE_TITLE, ScopeInterface::SCOPE_STORE) + ->willReturn($shouldTranslateTitle); $title = 'some title'; $this->pageTitleMock->expects($this->once()) @@ -77,28 +110,58 @@ public function testGetPageTitle() ->method('getTitle') ->willReturn($this->pageTitleMock); - $this->assertEquals($title, $this->htmlTitle->getPageTitle()); + $result = $this->htmlTitle->getPageTitle(); + + if ($shouldTranslateTitle) { + $this->assertInstanceOf(Phrase::class, $result); + } else { + $this->assertInternalType('string', $result); + } + + $this->assertEquals($title, $result); } /** + * @param bool $shouldTranslateTitle + * * @return void + * @dataProvider dataProviderShouldTranslateTitle */ - public function testGetPageHeadingWithSetPageTitle() + public function testGetPageHeadingWithSetPageTitle($shouldTranslateTitle) { + $this->scopeConfigMock->method('isSetFlag') + ->with(static::XML_PATH_HEADER_TRANSLATE_TITLE, ScopeInterface::SCOPE_STORE) + ->willReturn($shouldTranslateTitle); + $title = 'some title'; $this->htmlTitle->setPageTitle($title); $this->pageConfigMock->expects($this->never()) ->method('getTitle'); - $this->assertEquals($title, $this->htmlTitle->getPageHeading()); + $result = $this->htmlTitle->getPageHeading(); + + if ($shouldTranslateTitle) { + $this->assertInstanceOf(Phrase::class, $result); + } else { + $this->assertInternalType('string', $result); + } + + $this->assertEquals($title, $result); } /** + * @param bool $shouldTranslateTitle + * * @return void + * @dataProvider dataProviderShouldTranslateTitle */ - public function testGetPageHeading() + public function testGetPageHeading($shouldTranslateTitle) { + $this->scopeConfigMock->method('isSetFlag') + ->with(static::XML_PATH_HEADER_TRANSLATE_TITLE, ScopeInterface::SCOPE_STORE) + ->willReturn($shouldTranslateTitle); + $title = 'some title'; $this->pageTitleMock->expects($this->once()) @@ -108,6 +171,29 @@ public function testGetPageHeading() ->method('getTitle') ->willReturn($this->pageTitleMock); - $this->assertEquals($title, $this->htmlTitle->getPageHeading()); + $result = $this->htmlTitle->getPageHeading(); + + if ($shouldTranslateTitle) { + $this->assertInstanceOf(Phrase::class, $result); + } else { + $this->assertInternalType('string', $result); + } + + $this->assertEquals($title, $result); + } + + /** + * @return array + */ + public function dataProviderShouldTranslateTitle(): array + { + return [ + [ + true + ], + [ + false + ] + ]; } } diff --git a/app/code/Magento/Theme/etc/config.xml b/app/code/Magento/Theme/etc/config.xml index 1515c357e094e..c733f2a9503ee 100644 --- a/app/code/Magento/Theme/etc/config.xml +++ b/app/code/Magento/Theme/etc/config.xml @@ -43,6 +43,7 @@ Disallow: /*SID= </search_engine_robots> <header translate="welcome"> <welcome>Default welcome msg!</welcome> + <translate_title>1</translate_title> </header> <footer translate="copyright"> <copyright>Copyright © 2013-present Magento, Inc. All rights reserved.</copyright> diff --git a/app/code/Magento/Theme/etc/di.xml b/app/code/Magento/Theme/etc/di.xml index 62f51e74b6007..9e06f6c0f4e51 100644 --- a/app/code/Magento/Theme/etc/di.xml +++ b/app/code/Magento/Theme/etc/di.xml @@ -206,6 +206,10 @@ <item name="path" xsi:type="string">design/header/welcome</item> <item name="fieldset" xsi:type="string">other_settings/header</item> </item> + <item name="header_translate_title" xsi:type="array"> + <item name="path" xsi:type="string">design/header/translate_title</item> + <item name="fieldset" xsi:type="string">other_settings/header</item> + </item> <item name="footer_copyright" xsi:type="array"> <item name="path" xsi:type="string">design/footer/copyright</item> <item name="fieldset" xsi:type="string">other_settings/footer</item> diff --git a/app/code/Magento/Theme/view/adminhtml/ui_component/design_config_form.xml b/app/code/Magento/Theme/view/adminhtml/ui_component/design_config_form.xml index bc1f36222dd60..dfe11f3120cd8 100644 --- a/app/code/Magento/Theme/view/adminhtml/ui_component/design_config_form.xml +++ b/app/code/Magento/Theme/view/adminhtml/ui_component/design_config_form.xml @@ -208,6 +208,20 @@ <dataScope>header_logo_alt</dataScope> </settings> </field> + <field name="header_translate_title" formElement="select"> + <settings> + <dataType>text</dataType> + <label translate="true">Translate Title</label> + <dataScope>header_translate_title</dataScope> + </settings> + <formElements> + <select> + <settings> + <options class="Magento\Config\Model\Config\Source\Yesno"/> + </settings> + </select> + </formElements> + </field> </fieldset> <fieldset name="footer"> <settings> From 557247fcd9c55119dcf97bc4804366aefe2274b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Chitesh=40wagento=2Ecom=E2=80=9D?= <hitesh@wagento.com> Date: Tue, 7 Jan 2020 16:21:00 +0530 Subject: [PATCH 0686/1143] [Fixed Jump Datepicker issue in Catalog Price Rule] --- .../backend/web/css/source/components/_calendar-temp.less | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/design/adminhtml/Magento/backend/web/css/source/components/_calendar-temp.less b/app/design/adminhtml/Magento/backend/web/css/source/components/_calendar-temp.less index 11b187db3d1e4..3ed4ac91d32a4 100644 --- a/app/design/adminhtml/Magento/backend/web/css/source/components/_calendar-temp.less +++ b/app/design/adminhtml/Magento/backend/web/css/source/components/_calendar-temp.less @@ -47,10 +47,6 @@ vertical-align: top; z-index: 1; - &:active { - .scale(.975); - } - + .admin__control-support-text, + .admin__control-label { margin-left: @action__height + .5rem; From 574f052a3ad4ca82735d0b487d6ceb854066cc8b Mon Sep 17 00:00:00 2001 From: Daniel Ruf <d.ruf@bitexpert.de> Date: Tue, 7 Jan 2020 12:36:32 +0100 Subject: [PATCH 0687/1143] Extract some values and helpers Extract them to shorten lines and resolve codestyle warnings --- .../frontend/templates/address/edit.phtml | 41 +++++++++++-------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml b/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml index 476d7dc94c56e..440b397359839 100644 --- a/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml @@ -9,6 +9,12 @@ <?php $_company = $block->getLayout()->createBlock(\Magento\Customer\Block\Widget\Company::class) ?> <?php $_telephone = $block->getLayout()->createBlock(\Magento\Customer\Block\Widget\Telephone::class) ?> <?php $_fax = $block->getLayout()->createBlock(\Magento\Customer\Block\Widget\Fax::class) ?> +<?php $_country_id = $block->getAttributeData()->getFrontendLabel('country_id'); ?> +<?php $_street = $block->getAttributeData()->getFrontendLabel('street'); ?> +<?php $_city = $block->getAttributeData()->getFrontendLabel('city'); ?> +<?php $_region = $block->getAttributeData()->getFrontendLabel('region'); ?> +<?php $_data_helper = $this->helper(\Magento\Directory\Helper\Data::class); ?> +<?php $_address_helper = $this->helper(\Magento\Customer\Helper\Address::class); ?> <form class="form-address-edit" action="<?= $block->escapeUrl($block->getSaveUrl()) ?>" method="post" @@ -37,19 +43,19 @@ </fieldset> <fieldset class="fieldset"> <legend class="legend"><span><?= $block->escapeHtml(__('Address')) ?></span></legend><br> - <?php $_streetValidationClass = $this->helper(\Magento\Customer\Helper\Address::class)->getAttributeValidationClass('street'); ?> + <?php $_streetValidationClass = $_address_helper->getAttributeValidationClass('street'); ?> <div class="field street required"> - <label for="street_1" class="label"><span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('street') ?></span></label> + <label for="street_1" class="label"><span><?= /* @noEscape */ $_street ?></span></label> <div class="control"> <input type="text" name="street[]" value="<?= $block->escapeHtmlAttr($block->getStreetLine(1)) ?>" - title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('street') ?>" + title="<?= /* @noEscape */ $_street ?>" id="street_1" class="input-text <?= $block->escapeHtmlAttr($_streetValidationClass) ?>"/> <div class="nested"> <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?> - <?php for ($_i = 1, $_n = $this->helper(\Magento\Customer\Helper\Address::class)->getStreetLines(); $_i < $_n; $_i++): ?> + <?php for ($_i = 1, $_n = $_address_helper->getStreetLines(); $_i < $_n; $_i++): ?> <div class="field additional"> <label class="label" for="street_<?= /* @noEscape */ $_i + 1 ?>"> <span><?= $block->escapeHtml(__('Street Address %1', $_i + 1)) ?></span> @@ -67,7 +73,7 @@ </div> </div> - <?php if ($this->helper(\Magento\Customer\Helper\Address::class)->isVatAttributeVisible()): ?> + <?php if ($_address_helper->isVatAttributeVisible()): ?> <div class="field taxvat"> <label class="label" for="vat_id"> <span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('vat_id') ?></span> @@ -77,29 +83,29 @@ name="vat_id" value="<?= $block->escapeHtmlAttr($block->getAddress()->getVatId()) ?>" title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('vat_id') ?>" - class="input-text <?= $block->escapeHtmlAttr($this->helper(\Magento\Customer\Helper\Address::class)->getAttributeValidationClass('vat_id')) ?>" + class="input-text <?= $block->escapeHtmlAttr($_address_helper->getAttributeValidationClass('vat_id')) ?>" id="vat_id"> </div> </div> <?php endif; ?> <div class="field city required"> - <label class="label" for="city"><span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('city') ?></span></label> + <label class="label" for="city"><span><?= /* @noEscape */ $_city ?></span></label> <div class="control"> <input type="text" name="city" value="<?= $block->escapeHtmlAttr($block->getAddress()->getCity()) ?>" title="<?= $block->escapeHtmlAttr(__('City')) ?>" - class="input-text <?= $block->escapeHtmlAttr($this->helper(\Magento\Customer\Helper\Address::class)->getAttributeValidationClass('city')) ?>" + class="input-text <?= $block->escapeHtmlAttr($_address_helper->getAttributeValidationClass('city')) ?>" id="city"> </div> </div> <div class="field region required"> <label class="label" for="region_id"> - <span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('region') ?></span> + <span><?= /* @noEscape */ $_region ?></span> </label> <div class="control"> <select id="region_id" name="region_id" - title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('region') ?>" + title="<?= /* @noEscape */ $_region ?>" class="validate-select region_id" <?= /* @noEscape */ !$block->getConfig('general/region/display_all') ? ' disabled="disabled"' : '' ?>> <option value=""><?= $block->escapeHtml(__('Please select a region, state or province.')) ?></option> </select> @@ -107,8 +113,8 @@ id="region" name="region" value="<?= $block->escapeHtmlAttr($block->getRegion()) ?>" - title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('region') ?>" - class="input-text validate-not-number-first <?= $block->escapeHtmlAttr($this->helper(\Magento\Customer\Helper\Address::class)->getAttributeValidationClass('region')) ?>"<?= !$block->getConfig('general/region/display_all') ? ' disabled="disabled"' : '' ?>/> + title="<?= /* @noEscape */ $_region ?>" + class="input-text validate-not-number-first <?= $block->escapeHtmlAttr($_address_helper->getAttributeValidationClass('region')) ?>"<?= !$block->getConfig('general/region/display_all') ? ' disabled="disabled"' : '' ?>/> </div> </div> <div class="field zip required"> @@ -121,14 +127,14 @@ value="<?= $block->escapeHtmlAttr($block->getAddress()->getPostcode()) ?>" title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('postcode') ?>" id="zip" - class="input-text validate-zip-international <?= $block->escapeHtmlAttr($this->helper(\Magento\Customer\Helper\Address::class)->getAttributeValidationClass('postcode')) ?>"> + class="input-text validate-zip-international <?= $block->escapeHtmlAttr($_address_helper->getAttributeValidationClass('postcode')) ?>"> <div role="alert" class="message warning" style="display:none"> <span></span> </div> </div> </div> <div class="field country required"> - <label class="label" for="country"><span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('country_id') ?></span></label> + <label class="label" for="country"><span><?= /* @noEscape */ $_country_id ?></span></label> <div class="control"> <?= $block->getCountryHtmlSelect() ?> </div> @@ -189,14 +195,15 @@ }, "#country": { "regionUpdater": { - "optionalRegionAllowed": <?= /* @noEscape */ $block->getConfig('general/region/display_all') ? 'true' : 'false' ?>, + "optionalRegionAllowed": + <?= /* @noEscape */ $block->getConfig('general/region/display_all') ? 'true' : 'false' ?>, "regionListId": "#region_id", "regionInputId": "#region", "postcodeId": "#zip", "form": "#form-validate", - "regionJson": <?= /* @noEscape */ $this->helper(\Magento\Directory\Helper\Data::class)->getRegionJson() ?>, + "regionJson": <?= /* @noEscape */ $_helper->getRegionJson() ?>, "defaultRegion": "<?= (int) $block->getRegionId() ?>", - "countriesWithOptionalZip": <?= /* @noEscape */ $this->helper(\Magento\Directory\Helper\Data::class)->getCountriesWithOptionalZip(true) ?> + "countriesWithOptionalZip": <?= /* @noEscape */ $_data_helper->getCountriesWithOptionalZip(true) ?> } } } From 0edeb06a2ef7f0af108756d3cb62069b976e207a Mon Sep 17 00:00:00 2001 From: Daniel Ruf <d.ruf@bitexpert.de> Date: Tue, 7 Jan 2020 14:05:42 +0100 Subject: [PATCH 0688/1143] Shorten lines to resolve codestyle warnings --- .../frontend/templates/address/edit.phtml | 42 ++++++++++++------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml b/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml index 440b397359839..a1ab969568c3b 100644 --- a/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml @@ -13,8 +13,20 @@ <?php $_street = $block->getAttributeData()->getFrontendLabel('street'); ?> <?php $_city = $block->getAttributeData()->getFrontendLabel('city'); ?> <?php $_region = $block->getAttributeData()->getFrontendLabel('region'); ?> -<?php $_data_helper = $this->helper(\Magento\Directory\Helper\Data::class); ?> -<?php $_address_helper = $this->helper(\Magento\Customer\Helper\Address::class); ?> +<?php $_selectRegion = 'Please select a region, state or province.'; ?> +<?php $_displayAll = $block->getConfig('general/region/display_all'); ?> + +<?php $_dataHelper = $this->helper(\Magento\Directory\Helper\Data::class); ?> +<?php $_addressHelper = $this->helper(\Magento\Customer\Helper\Address::class); ?> + +<?php $_vatidValidationClass = $block->escapeHtmlAttr($_addressHelper->getAttributeValidationClass('vat_id')); ?> +<?php $_cityValidationClass = $block->escapeHtmlAttr($_addressHelper->getAttributeValidationClass('city')); ?> +<?php $_postcodeValidationClass_value = $_addressHelper->getAttributeValidationClass('postcode'); ?> +<?php $_postcodeValidationClass = $block->escapeHtmlAttr($_postcodeValidationClass_value); ?> +<?php $_streetValidationClass = $_addressHelper->getAttributeValidationClass('street'); ?> +<?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?> +<?php $_regionValidationClass = $block->escapeHtmlAttr($_addressHelper->getAttributeValidationClass('region')); ?> + <form class="form-address-edit" action="<?= $block->escapeUrl($block->getSaveUrl()) ?>" method="post" @@ -43,7 +55,6 @@ </fieldset> <fieldset class="fieldset"> <legend class="legend"><span><?= $block->escapeHtml(__('Address')) ?></span></legend><br> - <?php $_streetValidationClass = $_address_helper->getAttributeValidationClass('street'); ?> <div class="field street required"> <label for="street_1" class="label"><span><?= /* @noEscape */ $_street ?></span></label> <div class="control"> @@ -54,8 +65,7 @@ id="street_1" class="input-text <?= $block->escapeHtmlAttr($_streetValidationClass) ?>"/> <div class="nested"> - <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?> - <?php for ($_i = 1, $_n = $_address_helper->getStreetLines(); $_i < $_n; $_i++): ?> + <?php for ($_i = 1, $_n = $_addressHelper->getStreetLines(); $_i < $_n; $_i++): ?> <div class="field additional"> <label class="label" for="street_<?= /* @noEscape */ $_i + 1 ?>"> <span><?= $block->escapeHtml(__('Street Address %1', $_i + 1)) ?></span> @@ -73,7 +83,7 @@ </div> </div> - <?php if ($_address_helper->isVatAttributeVisible()): ?> + <?php if ($_addressHelper->isVatAttributeVisible()): ?> <div class="field taxvat"> <label class="label" for="vat_id"> <span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('vat_id') ?></span> @@ -83,7 +93,7 @@ name="vat_id" value="<?= $block->escapeHtmlAttr($block->getAddress()->getVatId()) ?>" title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('vat_id') ?>" - class="input-text <?= $block->escapeHtmlAttr($_address_helper->getAttributeValidationClass('vat_id')) ?>" + class="input-text <?= $_vatidValidationClass ?>" id="vat_id"> </div> </div> @@ -95,7 +105,7 @@ name="city" value="<?= $block->escapeHtmlAttr($block->getAddress()->getCity()) ?>" title="<?= $block->escapeHtmlAttr(__('City')) ?>" - class="input-text <?= $block->escapeHtmlAttr($_address_helper->getAttributeValidationClass('city')) ?>" + class="input-text <?= $_cityValidationClass ?>" id="city"> </div> </div> @@ -106,15 +116,17 @@ <div class="control"> <select id="region_id" name="region_id" title="<?= /* @noEscape */ $_region ?>" - class="validate-select region_id" <?= /* @noEscape */ !$block->getConfig('general/region/display_all') ? ' disabled="disabled"' : '' ?>> - <option value=""><?= $block->escapeHtml(__('Please select a region, state or province.')) ?></option> + class="validate-select region_id" + <?= /* @noEscape */ !$_displayAll ? ' disabled="disabled"' : '' ?>> + <option value=""><?= $block->escapeHtml(__($_selectRegion)) ?></option> </select> <input type="text" id="region" name="region" value="<?= $block->escapeHtmlAttr($block->getRegion()) ?>" title="<?= /* @noEscape */ $_region ?>" - class="input-text validate-not-number-first <?= $block->escapeHtmlAttr($_address_helper->getAttributeValidationClass('region')) ?>"<?= !$block->getConfig('general/region/display_all') ? ' disabled="disabled"' : '' ?>/> + class="input-text validate-not-number-first<?= $_regionValidationClass ?>" + <?= !$_displayAll ? ' disabled="disabled"' : '' ?>/> </div> </div> <div class="field zip required"> @@ -127,7 +139,7 @@ value="<?= $block->escapeHtmlAttr($block->getAddress()->getPostcode()) ?>" title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('postcode') ?>" id="zip" - class="input-text validate-zip-international <?= $block->escapeHtmlAttr($_address_helper->getAttributeValidationClass('postcode')) ?>"> + class="input-text validate-zip-international <?= $_postcodeValidationClass ?>"> <div role="alert" class="message warning" style="display:none"> <span></span> </div> @@ -196,14 +208,14 @@ "#country": { "regionUpdater": { "optionalRegionAllowed": - <?= /* @noEscape */ $block->getConfig('general/region/display_all') ? 'true' : 'false' ?>, + <?= /* @noEscape */ $_displayAll ? 'true' : 'false' ?>, "regionListId": "#region_id", "regionInputId": "#region", "postcodeId": "#zip", "form": "#form-validate", - "regionJson": <?= /* @noEscape */ $_helper->getRegionJson() ?>, + "regionJson": <?= /* @noEscape */ $_dataHelper->getRegionJson() ?>, "defaultRegion": "<?= (int) $block->getRegionId() ?>", - "countriesWithOptionalZip": <?= /* @noEscape */ $_data_helper->getCountriesWithOptionalZip(true) ?> + "countriesWithOptionalZip": <?= /* @noEscape */ $_dataHelper->getCountriesWithOptionalZip(true) ?> } } } From 0c4cb77402e5f34edc4eae6ba4d52b12b04e5477 Mon Sep 17 00:00:00 2001 From: Manuel Canepa <manuelcanepa@gmail.com> Date: Tue, 7 Jan 2020 13:14:45 -0300 Subject: [PATCH 0689/1143] Add Visual Code catalog generator --- .../Model/XmlCatalog/Format/VsCode.php | 129 ++++++++++++++++++ app/code/Magento/Developer/etc/di.xml | 1 + 2 files changed, 130 insertions(+) create mode 100644 app/code/Magento/Developer/Model/XmlCatalog/Format/VsCode.php diff --git a/app/code/Magento/Developer/Model/XmlCatalog/Format/VsCode.php b/app/code/Magento/Developer/Model/XmlCatalog/Format/VsCode.php new file mode 100644 index 0000000000000..cedf650a1e8ee --- /dev/null +++ b/app/code/Magento/Developer/Model/XmlCatalog/Format/VsCode.php @@ -0,0 +1,129 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Developer\Model\XmlCatalog\Format; + +use Magento\Framework\App\ObjectManager; +use Magento\Framework\DomDocument\DomDocumentFactory; +use Magento\Framework\Exception\FileSystemException; +use Magento\Framework\Filesystem\Directory\ReadFactory; +use Magento\Framework\Filesystem\Directory\ReadInterface; +use Magento\Framework\Filesystem\File\WriteFactory; + +/** + * Class VsCode generates URN catalog for VsCode + */ +class VsCode implements FormatInterface +{ + private const PROJECT_PATH_IDENTIFIER = '..'; + + /** + * @var ReadInterface + */ + private $currentDirRead; + + /** + * @var WriteFactory + */ + private $fileWriteFactory; + + /** + * @var DomDocumentFactory + */ + private $domDocumentFactory; + + /** + * @param ReadFactory $readFactory + * @param WriteFactory $fileWriteFactory + * @param DomDocumentFactory $domDocumentFactory + */ + public function __construct( + ReadFactory $readFactory, + WriteFactory $fileWriteFactory, + DomDocumentFactory $domDocumentFactory = null + ) { + $this->currentDirRead = $readFactory->create(getcwd()); + $this->fileWriteFactory = $fileWriteFactory; + $this->domDocumentFactory = $domDocumentFactory ?: ObjectManager::getInstance()->get(DomDocumentFactory::class); + } + + /** + * Generate Catalog of URNs for the VsCode + * + * @param string[] $dictionary + * @param string $configFilePath relative path to the PhpStorm misc.xml + * @return void + */ + public function generateCatalog(array $dictionary, $configFilePath) + { + $catalogNode = null; + + try { + $file = $this->fileWriteFactory->create( + $configFilePath, + \Magento\Framework\Filesystem\DriverPool::FILE, + 'r' + ); + $dom = $this->domDocumentFactory->create(); + $fileContent = $file->readAll(); + if (!empty($fileContent)) { + $dom->loadXML($fileContent); + } else { + $this->initEmptyFile($dom); + } + $xpath = new \DOMXPath($dom); + $nodeList = $xpath->query('/catalog'); + $catalogNode = $nodeList->item(0); + $file->close(); + } catch (FileSystemException $f) { + //create file if does not exists + $dom = $this->domDocumentFactory->create(); + $catalogNode = $this->initEmptyFile($dom); + } + + foreach ($dictionary as $urn => $xsdPath) { + $node = $dom->createElement('system'); + $node->setAttribute('systemId', $urn); + $node->setAttribute('uri', $this->getFileLocationInProject($xsdPath)); + $catalogNode->appendChild($node); + } + $dom->formatOutput = true; + $file = $this->fileWriteFactory->create( + $configFilePath, + \Magento\Framework\Filesystem\DriverPool::FILE, + 'w' + ); + $file->write($dom->saveXML()); + $file->close(); + } + + /** + * Setup basic empty dom elements + * + * @param \DOMDocument $dom + * @return \DOMElement + */ + private function initEmptyFile(\DOMDocument $dom) + { + $catalogNode = $dom->createElement('catalog'); + + $catalogNode->setAttribute('xmlns', 'urn:oasis:names:tc:entity:xmlns:xml:catalog'); + $dom->appendChild($catalogNode); + + return $catalogNode; + } + + /** + * Resolve xsdpath to xml project path + * + * @param string $xsdPath + * @return string + */ + private function getFileLocationInProject(string $xsdPath): string + { + return self::PROJECT_PATH_IDENTIFIER . DIRECTORY_SEPARATOR . $this->currentDirRead->getRelativePath($xsdPath); + } +} diff --git a/app/code/Magento/Developer/etc/di.xml b/app/code/Magento/Developer/etc/di.xml index 98adcbb3a8295..d8f8eb6c1221e 100644 --- a/app/code/Magento/Developer/etc/di.xml +++ b/app/code/Magento/Developer/etc/di.xml @@ -18,6 +18,7 @@ <arguments> <argument name="formats" xsi:type="array"> <item name="phpstorm" xsi:type="object">Magento\Developer\Model\XmlCatalog\Format\PhpStorm</item> + <item name="vscode" xsi:type="object">Magento\Developer\Model\XmlCatalog\Format\VsCode</item> </argument> </arguments> </type> From 040b212001a285bd1261f550bae1aab76acd5582 Mon Sep 17 00:00:00 2001 From: Iryna Lagno <ilagno@adobe.com> Date: Tue, 7 Jan 2020 11:44:17 -0600 Subject: [PATCH 0690/1143] MC-30257: Price of a Bundle Product is calculated incorrectly at the product page --- .../Bundle/view/base/web/js/price-bundle.js | 42 ++++++++--- .../Catalog/view/base/web/js/price-box.js | 1 + .../Bundle/base/js/price-bundle.test.js | 73 +++++++++++++++++++ 3 files changed, 104 insertions(+), 12 deletions(-) create mode 100644 dev/tests/js/jasmine/tests/app/code/Magento/Bundle/base/js/price-bundle.test.js diff --git a/app/code/Magento/Bundle/view/base/web/js/price-bundle.js b/app/code/Magento/Bundle/view/base/web/js/price-bundle.js index 49ee253ad1e88..207a97c270eeb 100644 --- a/app/code/Magento/Bundle/view/base/web/js/price-bundle.js +++ b/app/code/Magento/Bundle/view/base/web/js/price-bundle.js @@ -28,7 +28,8 @@ define([ controlContainer: 'dd', // should be eliminated priceFormat: {}, isFixedPrice: false, - optionTierPricesBlocksSelector: '#option-tier-prices-{1} [data-role="selection-tier-prices"]' + optionTierPricesBlocksSelector: '#option-tier-prices-{1} [data-role="selection-tier-prices"]', + isOptionsInitialized: false }; $.widget('mage.priceBundle', { @@ -53,20 +54,37 @@ define([ priceBox = $(this.options.priceBoxSelector, form), qty = $(this.options.qtyFieldSelector, form); - if (priceBox.data('magePriceBox') && - priceBox.priceBox('option') && - priceBox.priceBox('option').priceConfig - ) { - if (priceBox.priceBox('option').priceConfig.optionTemplate) { - this._setOption('optionTemplate', priceBox.priceBox('option').priceConfig.optionTemplate); + this._updatePriceBox(); + priceBox.on('price-box-initialized', this._updatePriceBox.bind(this)); + options.on('change', this._onBundleOptionChanged.bind(this)); + qty.on('change', this._onQtyFieldChanged.bind(this)); + }, + + /** + * Update price box config with bundle option prices + * @private + */ + _updatePriceBox: function () { + var form = this.element, + options = $(this.options.productBundleSelector, form), + priceBox = $(this.options.priceBoxSelector, form); + + if (!this.options.isOptionsInitialized) { + if (priceBox.data('magePriceBox') && + priceBox.priceBox('option') && + priceBox.priceBox('option').priceConfig + ) { + if (priceBox.priceBox('option').priceConfig.optionTemplate) { //eslint-disable-line max-depth + this._setOption('optionTemplate', priceBox.priceBox('option').priceConfig.optionTemplate); + } + this._setOption('priceFormat', priceBox.priceBox('option').priceConfig.priceFormat); + priceBox.priceBox('setDefault', this.options.optionConfig.prices); + this.options.isOptionsInitialized = true; } - this._setOption('priceFormat', priceBox.priceBox('option').priceConfig.priceFormat); - priceBox.priceBox('setDefault', this.options.optionConfig.prices); + this._applyOptionNodeFix(options); } - this._applyOptionNodeFix(options); - options.on('change', this._onBundleOptionChanged.bind(this)); - qty.on('change', this._onQtyFieldChanged.bind(this)); + return this; }, /** diff --git a/app/code/Magento/Catalog/view/base/web/js/price-box.js b/app/code/Magento/Catalog/view/base/web/js/price-box.js index 02ae6eadef672..6ca7f24b90c36 100644 --- a/app/code/Magento/Catalog/view/base/web/js/price-box.js +++ b/app/code/Magento/Catalog/view/base/web/js/price-box.js @@ -49,6 +49,7 @@ define([ box.on('reloadPrice', this.reloadPrice.bind(this)); box.on('updatePrice', this.onUpdatePrice.bind(this)); + box.trigger('price-box-initialized'); }, /** diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Bundle/base/js/price-bundle.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Bundle/base/js/price-bundle.test.js new file mode 100644 index 0000000000000..04dd5a9b51407 --- /dev/null +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Bundle/base/js/price-bundle.test.js @@ -0,0 +1,73 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +define([ + 'jquery', + 'Magento_Bundle/js/price-bundle', + 'Magento_Catalog/js/price-box' +], function ($) { + 'use strict'; + + describe('Magento_Bundle/js/price-bundle', function () { + + var htmlContainer; + + beforeEach(function () { + htmlContainer = $('<div class="price-final_price" data-role="priceBox"><ul class="price-box"></ul></div>'); + }); + + afterEach(function () { + htmlContainer.remove(); + }); + + it('Widget extends jQuery object.', function () { + expect($.fn.priceBundle).toBeDefined(); + }); + + it('Check _updatePriceBox method call.', function () { + + spyOn($.mage.priceBundle.prototype, '_updatePriceBox'); + + htmlContainer.priceBundle(); + + expect($.mage.priceBundle.prototype._updatePriceBox).toEqual(jasmine.any(Function)); + expect($.mage.priceBundle.prototype._updatePriceBox).toHaveBeenCalledTimes(1); + }); + + it('Check _updatePriceBox method call after priceBox was initialized.', function () { + spyOn($.mage.priceBundle.prototype, '_updatePriceBox').and.callThrough(); + htmlContainer.priceBundle(); + $('.price-box', htmlContainer).priceBox(); + expect($.mage.priceBundle.prototype._updatePriceBox).toEqual(jasmine.any(Function)); + expect($.mage.priceBundle.prototype._updatePriceBox).toHaveBeenCalledTimes(2); + }); + + it('Check _applyOptionNodeFix method doesn\'t call after priceBox initialization.', function () { + var optionConfig = { + optionConfig: { + prices: {} + } + }, + priceConfig = { + priceConfig: 10 + }; + + spyOn($.mage.priceBundle.prototype, '_applyOptionNodeFix').and.callThrough(); + htmlContainer.priceBundle(optionConfig); + $('.price-box', htmlContainer).priceBox(priceConfig); + $('.price-box', htmlContainer).trigger('price-box-initialized'); + expect($.mage.priceBundle.prototype._applyOptionNodeFix).toEqual(jasmine.any(Function)); + expect($.mage.priceBundle.prototype._applyOptionNodeFix).toHaveBeenCalledTimes(2); + }); + + it('Check _updatePriceBox method call before priceBox was initialized.', function () { + spyOn($.mage.priceBundle.prototype, '_updatePriceBox').and.callThrough(); + $('.price-box', htmlContainer).priceBox(); + htmlContainer.priceBundle(); + expect($.mage.priceBundle.prototype._updatePriceBox).toEqual(jasmine.any(Function)); + expect($.mage.priceBundle.prototype._updatePriceBox).toHaveBeenCalledTimes(1); + }); + }); +}); From 8b6683724d5f0d09df1465e7c9d51a327b58bb48 Mon Sep 17 00:00:00 2001 From: Krissy Hiserote <khiserote@magento.com> Date: Tue, 7 Jan 2020 12:48:38 -0600 Subject: [PATCH 0691/1143] MC-25269: Upgrade from 2.3.x CE with SD to 2.3.x EE fails - remove object manager from setup recurring script --- app/code/Magento/Indexer/Setup/Recurring.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Indexer/Setup/Recurring.php b/app/code/Magento/Indexer/Setup/Recurring.php index 3fba052497c4e..1e5c79c9b10d4 100644 --- a/app/code/Magento/Indexer/Setup/Recurring.php +++ b/app/code/Magento/Indexer/Setup/Recurring.php @@ -6,7 +6,6 @@ namespace Magento\Indexer\Setup; -use Magento\Framework\App\ObjectManager; use Magento\Framework\Encryption\Encryptor; use Magento\Framework\Encryption\EncryptorInterface; use Magento\Framework\Indexer\StateInterface; @@ -66,7 +65,7 @@ class Recurring implements InstallSchemaInterface * @param ConfigInterface $config * @param EncryptorInterface $encryptor * @param EncoderInterface $encoder - * @param IndexerInterfaceFactory|null $indexerFactory + * @param IndexerInterfaceFactory $indexerFactory */ public function __construct( CollectionFactory $statesFactory, @@ -74,14 +73,14 @@ public function __construct( ConfigInterface $config, EncryptorInterface $encryptor, EncoderInterface $encoder, - IndexerInterfaceFactory $indexerFactory = null + IndexerInterfaceFactory $indexerFactory ) { $this->statesFactory = $statesFactory; $this->stateFactory = $stateFactory; $this->config = $config; $this->encryptor = $encryptor; $this->encoder = $encoder; - $this->indexerFactory = $indexerFactory ?: ObjectManager::getInstance()->get(IndexerInterfaceFactory::class); + $this->indexerFactory = $indexerFactory; } /** From de50d748f624ca11d6ee06fdf16051616850d06b Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko <lytvynen@adobe.com> Date: Tue, 7 Jan 2020 13:33:11 -0600 Subject: [PATCH 0692/1143] MC-30260: CatalogWidget products list doesn't display products from the children categories of 2nd level and up --- .../Block/Product/ProductsList.php | 4 +- .../product_in_nested_anchor_categories.php | 75 +++++++++++++++++++ ...t_in_nested_anchor_categories_rollback.php | 35 +++++++++ .../Block/Product/ProductListTest.php | 2 +- 4 files changed, 113 insertions(+), 3 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/product_in_nested_anchor_categories.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/product_in_nested_anchor_categories_rollback.php diff --git a/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php b/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php index a27f5a3dc5e52..3adedeab326c4 100644 --- a/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php +++ b/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php @@ -373,8 +373,8 @@ private function updateAnchorCategoryConditions(array $condition): array return $condition; } - if ($category->getIsAnchor() && $category->getChildren()) { - $children = explode(',', $category->getChildren()); + if ($category->getIsAnchor() && $category->getChildren(true)) { + $children = explode(',', $category->getChildren(true)); $condition['operator'] = "()"; $condition['value'] = array_merge([$categoryId], $children); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_in_nested_anchor_categories.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_in_nested_anchor_categories.php new file mode 100644 index 0000000000000..49464c139af82 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_in_nested_anchor_categories.php @@ -0,0 +1,75 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +$categories = [ + [ + 'id' => 444, + 'parentId' => 2, + 'level' => 2, + 'path' => '1/2/3' + ], + [ + 'id' => 445, + 'parentId' => 444, + 'level' => 3, + 'path' => '1/2/4' + ], + [ + 'id' => 446, + 'parentId' => 445, + 'level' => 4, + 'path' => '1/2/5' + ], +]; + +$products = [ + [ + 'id' => 444, + 'categoryIDs' => [446] + ], + [ + 'id' => 445, + 'categoryIDs' => [446] + ] +]; + +foreach ($categories as $category) { + $categoryModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create(\Magento\Catalog\Model\Category::class); + $categoryModel->isObjectNew(true); + $categoryModel->setId($category['id']) + ->setName('Category ' . $category['id']) + ->setParentId($category['parentId']) + ->setPath($category['path']) + ->setLevel($category['level']) + ->setAvailableSortBy('name') + ->setDefaultSortBy('name') + ->setIsActive(true) + ->setPosition(1) + ->setAvailableSortBy(['position']) + ->save(); +} + +foreach ($products as $product) { + /** @var $product \Magento\Catalog\Model\Product */ + $productModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create(\Magento\Catalog\Model\Product::class); + $productModel->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE) + ->setId($product['id']) + ->setAttributeSetId(4) + ->setStoreId(1) + ->setWebsiteIds([1]) + ->setName('Simple Product ' . $product['id']) + ->setSku('simple' . $product['id']) + ->setPrice(10) + ->setWeight(18) + ->setStockData(['use_config_manage_stock' => 0]) + ->setCategoryIds($product['categoryIDs']) + ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) + ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) + ->save(); +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_in_nested_anchor_categories_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_in_nested_anchor_categories_rollback.php new file mode 100644 index 0000000000000..f735caa801794 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_in_nested_anchor_categories_rollback.php @@ -0,0 +1,35 @@ +<?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); + +$categoryIDs = [444, 445, 446]; +$productIDs = [444, 445]; + +foreach ($productIDs as $productID) { + /** @var $product \Magento\Catalog\Model\Product */ + $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create(\Magento\Catalog\Model\Product::class); + $product->load($productID); + if ($product->getId()) { + $product->delete(); + } +} + +foreach ($categoryIDs as $categoryID) { + /** @var $category \Magento\Catalog\Model\Category */ + $category = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create(\Magento\Catalog\Model\Category::class); + $category->load($categoryID); + if ($category->getId()) { + $category->delete(); + } +} diff --git a/dev/tests/integration/testsuite/Magento/CatalogWidget/Block/Product/ProductListTest.php b/dev/tests/integration/testsuite/Magento/CatalogWidget/Block/Product/ProductListTest.php index 1ca8485ddbd26..f11083dd2ba91 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogWidget/Block/Product/ProductListTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogWidget/Block/Product/ProductListTest.php @@ -222,7 +222,7 @@ public function testProductListWithDateAttribute() * 4. Load collection for product list widget and make sure that number of loaded products is correct * * @magentoDbIsolation disabled - * @magentoDataFixture Magento/Catalog/_files/product_in_multiple_categories.php + * @magentoDataFixture Magento/Catalog/_files/product_in_nested_anchor_categories.php */ public function testCreateAnchorCollection() { From 31f13e584de55f80a847b7ffc6ae87a7defd464a Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko <lytvynen@adobe.com> Date: Tue, 7 Jan 2020 14:07:41 -0600 Subject: [PATCH 0693/1143] MC-30260: CatalogWidget products list doesn't display products from the children categories of 2nd level and up --- .../Magento/CatalogWidget/Block/Product/ProductsList.php | 6 +++--- .../Catalog/_files/product_in_nested_anchor_categories.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php b/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php index 3adedeab326c4..4a75c806aa37b 100644 --- a/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php +++ b/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php @@ -373,9 +373,9 @@ private function updateAnchorCategoryConditions(array $condition): array return $condition; } - if ($category->getIsAnchor() && $category->getChildren(true)) { - $children = explode(',', $category->getChildren(true)); - + $children = $category->getIsAnchor() ? $category->getChildren(true) : []; + if ($children) { + $children = explode(',', $children); $condition['operator'] = "()"; $condition['value'] = array_merge([$categoryId], $children); } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_in_nested_anchor_categories.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_in_nested_anchor_categories.php index 49464c139af82..39d939575f5bf 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_in_nested_anchor_categories.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_in_nested_anchor_categories.php @@ -16,13 +16,13 @@ 'id' => 445, 'parentId' => 444, 'level' => 3, - 'path' => '1/2/4' + 'path' => '1/2/3/4' ], [ 'id' => 446, 'parentId' => 445, 'level' => 4, - 'path' => '1/2/5' + 'path' => '1/2/3/4/5' ], ]; From f30a06a6695f590f261953d2b576efcb1ce512a3 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Tue, 7 Jan 2020 21:05:30 +0200 Subject: [PATCH 0694/1143] Refactoring config fixtures --- .../Test/Unit/Model/Config/StructureTest.php | 4 +-- .../Unit/Model/_files/converted_config.php | 26 ++++++++++++++++--- .../Test/Unit/Model/_files/system_2.xml | 6 +++++ 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Config/Test/Unit/Model/Config/StructureTest.php b/app/code/Magento/Config/Test/Unit/Model/Config/StructureTest.php index 93f143b99a42d..57e57fcd2503f 100644 --- a/app/code/Magento/Config/Test/Unit/Model/Config/StructureTest.php +++ b/app/code/Magento/Config/Test/Unit/Model/Config/StructureTest.php @@ -502,8 +502,8 @@ public function getFieldPaths(): array ], 'field_5' => [ 'field_5', - ], - 'section_3' => ['section_3'] + 'field_5' + ] ] ] ]; diff --git a/app/code/Magento/Config/Test/Unit/Model/_files/converted_config.php b/app/code/Magento/Config/Test/Unit/Model/_files/converted_config.php index 54fd5719c4881..ed6cc868f8d08 100644 --- a/app/code/Magento/Config/Test/Unit/Model/_files/converted_config.php +++ b/app/code/Magento/Config/Test/Unit/Model/_files/converted_config.php @@ -75,7 +75,8 @@ 'id' => 'field_3_1_1', 'translate' => 'label', 'showInWebsite' => '1', - 'backend_model' => \Magento\Config\Model\Config\Backend\Encrypted::class, + 'backend_model' => + \Magento\Config\Model\Config\Backend\Encrypted::class, 'type' => 'text', 'label' => 'Field 3.1.1', '_elementType' => 'field', @@ -192,9 +193,26 @@ 'section_3' => [ 'id' => 'section_3', 'type' => 'text', - 'tab' => 'tab_1', - '_elementType' => 'field' - ], + '_elementType' => 'section', + 'children' => [ + 'group_5' => [ + 'id' => 'group_5', + 'type' => 'text', + 'showInDefault' => 1, + 'showInWebsite' => 1, + 'showInStore' => 1, + '_elementType' => 'group', + 'children' => [ + 'field_5' => [ + 'id' => 'field_5', + 'showInWebsite' => '1', + 'type' => 'text', + '_elementType' => 'field', + ] + ] + ] + ] + ] ], ], ], diff --git a/app/code/Magento/Config/Test/Unit/Model/_files/system_2.xml b/app/code/Magento/Config/Test/Unit/Model/_files/system_2.xml index c4001f47ced0b..715d7cf4e8a61 100644 --- a/app/code/Magento/Config/Test/Unit/Model/_files/system_2.xml +++ b/app/code/Magento/Config/Test/Unit/Model/_files/system_2.xml @@ -86,5 +86,11 @@ </depends> </group> </section> + <section id="section_3" type="text"> + <group id="group_5" type="text" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="field_5" showInWebsite="1" type="text"> + </field> + </group> + </section> </system> </config> From fb208a8d6b4d738bb2e59c2771dd1223f4448fcb Mon Sep 17 00:00:00 2001 From: Daniel Ruf <827205+DanielRuf@users.noreply.github.com> Date: Tue, 7 Jan 2020 19:00:39 +0100 Subject: [PATCH 0695/1143] Fix JavaScript config --- .../Customer/view/frontend/templates/address/edit.phtml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml b/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml index a1ab969568c3b..b72c7e6c7bb2b 100644 --- a/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml @@ -207,8 +207,7 @@ }, "#country": { "regionUpdater": { - "optionalRegionAllowed": - <?= /* @noEscape */ $_displayAll ? 'true' : 'false' ?>, + "optionalRegionAllowed": <?= /* @noEscape */ $_displayAll ? 'true' : 'false' ?>, "regionListId": "#region_id", "regionInputId": "#region", "postcodeId": "#zip", From c1c363fceaf6a0782412b56f0f97dc46e677e036 Mon Sep 17 00:00:00 2001 From: Daniel Ruf <mac1@daniel-ruf.de> Date: Tue, 7 Jan 2020 21:39:37 +0100 Subject: [PATCH 0696/1143] Fix indentation --- .../Magento/Customer/view/frontend/templates/address/edit.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml b/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml index b72c7e6c7bb2b..7a19ed448eff1 100644 --- a/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml @@ -126,7 +126,7 @@ value="<?= $block->escapeHtmlAttr($block->getRegion()) ?>" title="<?= /* @noEscape */ $_region ?>" class="input-text validate-not-number-first<?= $_regionValidationClass ?>" - <?= !$_displayAll ? ' disabled="disabled"' : '' ?>/> + <?= !$_displayAll ? ' disabled="disabled"' : '' ?>/> </div> </div> <div class="field zip required"> From 36dd5acf9db8b2a19568468a461c8f19fa8d6876 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Tue, 7 Jan 2020 14:52:59 -0600 Subject: [PATCH 0697/1143] Replace inheritdoc with full declaration --- .../Magento/Catalog/Model/Product/Option.php | 91 +++++++++++++++---- 1 file changed, 71 insertions(+), 20 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Option.php b/app/code/Magento/Catalog/Model/Product/Option.php index ca5251de13e69..128f420e033c2 100644 --- a/app/code/Magento/Catalog/Model/Product/Option.php +++ b/app/code/Magento/Catalog/Model/Product/Option.php @@ -205,7 +205,10 @@ public function __construct( } /** - * @inheritdoc + * Get resource instance + * + * @return \Magento\Framework\Model\ResourceModel\Db\AbstractDb + * @deprecated 101.1.0 because resource models should be used directly */ protected function _getResource() { @@ -570,7 +573,9 @@ public function getSearchableData($productId, $storeId) } /** - * @inheritdoc + * Clearing object's data + * + * @return $this */ protected function _clearData() { @@ -580,7 +585,9 @@ protected function _clearData() } /** - * @inheritdoc + * Clearing cyclic references + * + * @return $this */ protected function _clearReferences() { @@ -601,7 +608,9 @@ protected function _getValidationRulesBeforeSave() } /** - * @inheritdoc + * Get product SKU + * + * @return string */ public function getProductSku() { @@ -613,7 +622,9 @@ public function getProductSku() } /** - * @inheritdoc + * Get option id + * + * @return int|null * @codeCoverageIgnoreStart */ public function getOptionId() @@ -622,7 +633,9 @@ public function getOptionId() } /** - * @inheritdoc + * Get option title + * + * @return string */ public function getTitle() { @@ -630,7 +643,9 @@ public function getTitle() } /** - * @inheritdoc + * Get option type + * + * @return string */ public function getType() { @@ -638,7 +653,9 @@ public function getType() } /** - * @inheritdoc + * Get sort order + * + * @return int */ public function getSortOrder() { @@ -646,7 +663,10 @@ public function getSortOrder() } /** - * @inheritdoc + * Get is require + * + * @return bool + * @SuppressWarnings(PHPMD.BooleanGetMethodName) */ public function getIsRequire() { @@ -654,7 +674,9 @@ public function getIsRequire() } /** - * @inheritdoc + * Get price type + * + * @return string|null */ public function getPriceType() { @@ -662,7 +684,9 @@ public function getPriceType() } /** - * @inheritdoc + * Get Sku + * + * @return string|null */ public function getSku() { @@ -710,7 +734,10 @@ public function getImageSizeY() } /** - * @inheritdoc + * Set product SKU + * + * @param string $productSku + * @return $this */ public function setProductSku($productSku) { @@ -718,7 +745,10 @@ public function setProductSku($productSku) } /** - * @inheritdoc + * Set option id + * + * @param int $optionId + * @return $this */ public function setOptionId($optionId) { @@ -726,7 +756,10 @@ public function setOptionId($optionId) } /** - * @inheritdoc + * Set option title + * + * @param string $title + * @return $this */ public function setTitle($title) { @@ -734,7 +767,10 @@ public function setTitle($title) } /** - * @inheritdoc + * Set option type + * + * @param string $type + * @return $this */ public function setType($type) { @@ -742,7 +778,10 @@ public function setType($type) } /** - * @inheritdoc + * Set sort order + * + * @param int $sortOrder + * @return $this */ public function setSortOrder($sortOrder) { @@ -750,7 +789,10 @@ public function setSortOrder($sortOrder) } /** - * @inheritdoc + * Set is require + * + * @param bool $isRequired + * @return $this */ public function setIsRequire($isRequired) { @@ -758,7 +800,10 @@ public function setIsRequire($isRequired) } /** - * @inheritdoc + * Set price + * + * @param float $price + * @return $this */ public function setPrice($price) { @@ -766,7 +811,10 @@ public function setPrice($price) } /** - * @inheritdoc + * Set price type + * + * @param string $priceType + * @return $this */ public function setPriceType($priceType) { @@ -774,7 +822,10 @@ public function setPriceType($priceType) } /** - * @inheritdoc + * Set Sku + * + * @param string $sku + * @return $this */ public function setSku($sku) { From 82cfc5e5cae032df86c44064673aea7e09d2533a Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Tue, 7 Jan 2020 14:55:16 -0600 Subject: [PATCH 0698/1143] Fix static --- app/code/Magento/Catalog/Model/Product/Option/Value.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Model/Product/Option/Value.php b/app/code/Magento/Catalog/Model/Product/Option/Value.php index fce39614248ca..da70c747806e1 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Value.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Value.php @@ -113,7 +113,7 @@ public function __construct( } /** - * @inheritDoc + * @return void */ protected function _construct() { From 7d8ab4c87cf37d8326117cb77d6889956752c685 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Tue, 7 Jan 2020 14:58:52 -0600 Subject: [PATCH 0699/1143] The test is broken --- .../lib/jquery/jstree/jquery.hotkeys.test.js | 77 ------------------- 1 file changed, 77 deletions(-) delete mode 100644 dev/tests/js/jasmine/tests/lib/jquery/jstree/jquery.hotkeys.test.js diff --git a/dev/tests/js/jasmine/tests/lib/jquery/jstree/jquery.hotkeys.test.js b/dev/tests/js/jasmine/tests/lib/jquery/jstree/jquery.hotkeys.test.js deleted file mode 100644 index 6041b70abc7f7..0000000000000 --- a/dev/tests/js/jasmine/tests/lib/jquery/jstree/jquery.hotkeys.test.js +++ /dev/null @@ -1,77 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - -define([ - 'jquery', - 'jquery/jstree/jquery.hotkeys' -], function ($) { - 'use strict'; - - describe('Test for jquery/jstree/jquery.hotkeys', function () { - var divElement = $('<div></div>'), - divBodyAfterTrigger = 'pressed', - inputNumberElement = $('<input type="number">'); - - beforeAll(function () { - /** - * Insert text to the divElement - */ - var addHtmlToDivElement = function () { - divElement.html(divBodyAfterTrigger); - }; - - $(document).bind('keyup', 'right', addHtmlToDivElement); - $(document).bind('keyup', 'left', addHtmlToDivElement); - - }); - - beforeEach(function () { - inputNumberElement.appendTo(document.body); - divElement.appendTo(document.body); - }); - - afterEach(function () { - divElement.remove(); - inputNumberElement.remove(); - }); - - it('Check "left key" hotkey is not being processed when number input is focused', function () { - var keypress = $.Event('keyup'); - - keypress.which = 37; // "left arrow" key - inputNumberElement.trigger(keypress); - - expect(divElement.html()).toEqual(''); - }); - - it('Check "right key" hotkey is not being processed when number input is focused', function () { - var keypress = $.Event('keyup'); - - keypress.which = 39; // "right arrow" key - inputNumberElement.trigger(keypress); - - expect(divElement.html()).toEqual(''); - }); - - it('Check "left key" hotkey is being processed when registered on the page', function () { - var keypress = $.Event('keyup'); - - keypress.which = 37; // "left arrow" key - divElement.trigger(keypress); - - expect(divElement.html()).toEqual(divBodyAfterTrigger); - }); - - it('Check "right key" hotkey is being processed when registered on the page', function () { - var keypress = $.Event('keyup'); - - keypress.which = 39; // "right arrow" key - $('body').trigger(keypress); - - expect(divElement.html()).toEqual(divBodyAfterTrigger); - }); - - }); -}); From 98e1159d2bf6ef57c646bdd9c6ca09e6729af9bc Mon Sep 17 00:00:00 2001 From: Daniel Ruf <mac1@daniel-ruf.de> Date: Tue, 7 Jan 2020 22:11:46 +0100 Subject: [PATCH 0700/1143] Escape output --- .../view/frontend/templates/address/edit.phtml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml b/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml index 7a19ed448eff1..cf8a7b354a3d8 100644 --- a/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml @@ -19,13 +19,13 @@ <?php $_dataHelper = $this->helper(\Magento\Directory\Helper\Data::class); ?> <?php $_addressHelper = $this->helper(\Magento\Customer\Helper\Address::class); ?> -<?php $_vatidValidationClass = $block->escapeHtmlAttr($_addressHelper->getAttributeValidationClass('vat_id')); ?> -<?php $_cityValidationClass = $block->escapeHtmlAttr($_addressHelper->getAttributeValidationClass('city')); ?> +<?php $_vatidValidationClass = $_addressHelper->getAttributeValidationClass('vat_id'); ?> +<?php $_cityValidationClass = $_addressHelper->getAttributeValidationClass('city'); ?> <?php $_postcodeValidationClass_value = $_addressHelper->getAttributeValidationClass('postcode'); ?> -<?php $_postcodeValidationClass = $block->escapeHtmlAttr($_postcodeValidationClass_value); ?> +<?php $_postcodeValidationClass = $_postcodeValidationClass_value; ?> <?php $_streetValidationClass = $_addressHelper->getAttributeValidationClass('street'); ?> <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?> -<?php $_regionValidationClass = $block->escapeHtmlAttr($_addressHelper->getAttributeValidationClass('region')); ?> +<?php $_regionValidationClass = $_addressHelper->getAttributeValidationClass('region'); ?> <form class="form-address-edit" action="<?= $block->escapeUrl($block->getSaveUrl()) ?>" @@ -93,7 +93,7 @@ name="vat_id" value="<?= $block->escapeHtmlAttr($block->getAddress()->getVatId()) ?>" title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('vat_id') ?>" - class="input-text <?= $_vatidValidationClass ?>" + class="input-text <?= $block->escapeHtmlAttr($_vatidValidationClass) ?>" id="vat_id"> </div> </div> @@ -105,7 +105,7 @@ name="city" value="<?= $block->escapeHtmlAttr($block->getAddress()->getCity()) ?>" title="<?= $block->escapeHtmlAttr(__('City')) ?>" - class="input-text <?= $_cityValidationClass ?>" + class="input-text <?= $block->escapeHtmlAttr($_cityValidationClass) ?>" id="city"> </div> </div> @@ -125,7 +125,8 @@ name="region" value="<?= $block->escapeHtmlAttr($block->getRegion()) ?>" title="<?= /* @noEscape */ $_region ?>" - class="input-text validate-not-number-first<?= $_regionValidationClass ?>" + class="input-text validate-not-number-first + <?= $block->escapeHtmlAttr($_regionValidationClass) ?>" <?= !$_displayAll ? ' disabled="disabled"' : '' ?>/> </div> </div> @@ -139,7 +140,8 @@ value="<?= $block->escapeHtmlAttr($block->getAddress()->getPostcode()) ?>" title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('postcode') ?>" id="zip" - class="input-text validate-zip-international <?= $_postcodeValidationClass ?>"> + class="input-text validate-zip-international + <?= $block->escapeHtmlAttr($_postcodeValidationClass) ?>"> <div role="alert" class="message warning" style="display:none"> <span></span> </div> From ec8a756f8ac32e058c48eaa848e9c5c3593e2acc Mon Sep 17 00:00:00 2001 From: Max Romanov <maxromanov4669@gmail.com> Date: Tue, 7 Jan 2020 23:18:29 +0200 Subject: [PATCH 0701/1143] 11209-wishlist-add-grouped-product-error --- .../GroupedProduct/Model/Wishlist/Product/Item.php | 3 ++- .../Test/Unit/Model/Wishlist/Product/ItemTest.php | 12 ++++++++---- app/code/Magento/GroupedProduct/composer.json | 3 ++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/GroupedProduct/Model/Wishlist/Product/Item.php b/app/code/Magento/GroupedProduct/Model/Wishlist/Product/Item.php index 9eaa54f1ff66e..c692629131c8d 100644 --- a/app/code/Magento/GroupedProduct/Model/Wishlist/Product/Item.php +++ b/app/code/Magento/GroupedProduct/Model/Wishlist/Product/Item.php @@ -68,6 +68,7 @@ public function beforeRepresentProduct( * @param array $options1 * @param array $options2 * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function beforeCompareOptions( WishlistItem $subject, @@ -77,7 +78,7 @@ public function beforeCompareOptions( $diff = array_diff_key($options1, $options2); if (!$diff) { - foreach ($options1 as $key => $val) { + foreach (array_keys($options1) as $key) { if (preg_match('/associated_product_\d+/', $key)) { unset($options1[$key]); unset($options2[$key]); diff --git a/app/code/Magento/GroupedProduct/Test/Unit/Model/Wishlist/Product/ItemTest.php b/app/code/Magento/GroupedProduct/Test/Unit/Model/Wishlist/Product/ItemTest.php index 7929c50eb487d..1edf5e8ce2d95 100644 --- a/app/code/Magento/GroupedProduct/Test/Unit/Model/Wishlist/Product/ItemTest.php +++ b/app/code/Magento/GroupedProduct/Test/Unit/Model/Wishlist/Product/ItemTest.php @@ -61,6 +61,10 @@ protected function setUp() */ public function testBeforeRepresentProduct() { + $testSimpleProdId = 34; + $prodInitQty = 2; + $prodQtyInWishlist = 3; + $resWishlistQty = $prodInitQty + $prodQtyInWishlist; $superGroup = [ 'super_group' => [ 33 => "0", @@ -71,12 +75,12 @@ public function testBeforeRepresentProduct() $superGroupObj = new \Magento\Framework\DataObject($superGroup); - $this->productMock->expects($this->once())->method('getId')->willReturn(34); + $this->productMock->expects($this->once())->method('getId')->willReturn($testSimpleProdId); $this->productMock->expects($this->once())->method('getTypeId') ->willReturn(TypeGrouped::TYPE_CODE); $this->productMock->expects($this->once())->method('getCustomOptions') ->willReturn( - $this->getProductAssocOption(2, 34) + $this->getProductAssocOption($prodInitQty, $testSimpleProdId) ); $wishlistItemProductMock = $this->createPartialMock( @@ -85,13 +89,13 @@ public function testBeforeRepresentProduct() 'getId', ] ); - $wishlistItemProductMock->expects($this->once())->method('getId')->willReturn(34); + $wishlistItemProductMock->expects($this->once())->method('getId')->willReturn($testSimpleProdId); $this->subjectMock->expects($this->once())->method('getProduct') ->willReturn($wishlistItemProductMock); $this->subjectMock->expects($this->once())->method('getOptionsByCode') ->willReturn( - $this->getWishlistAssocOption(3, 5, 34) + $this->getWishlistAssocOption($prodQtyInWishlist, $resWishlistQty, $testSimpleProdId) ); $this->subjectMock->expects($this->once())->method('getBuyRequest')->willReturn($superGroupObj); diff --git a/app/code/Magento/GroupedProduct/composer.json b/app/code/Magento/GroupedProduct/composer.json index 68063c05ddf7b..3cb41387d2c6d 100644 --- a/app/code/Magento/GroupedProduct/composer.json +++ b/app/code/Magento/GroupedProduct/composer.json @@ -18,7 +18,8 @@ "magento/module-quote": "*", "magento/module-sales": "*", "magento/module-store": "*", - "magento/module-ui": "*" + "magento/module-ui": "*", + "magento/module-wishlist": "*" }, "suggest": { "magento/module-grouped-product-sample-data": "*" From f71f1236983de85a517d2b6cd1b7fe34f09548ee Mon Sep 17 00:00:00 2001 From: Anusha Vattam <avattam@adobe.com> Date: Tue, 7 Jan 2020 15:43:35 -0600 Subject: [PATCH 0702/1143] MC-20074: Fix Skipped MFTF Tests From MC-17140: MC-14104, MC-14502, MC-14532 - Added changes to mftf JS test --- .../Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml index fe59292a8b0d3..2057aeae3e18f 100644 --- a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml +++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml @@ -21,7 +21,7 @@ </annotations> <before> <magentoCLI command="config:set {{MinifyJavaScriptFilesEnableConfigData.path}} {{MinifyJavaScriptFilesEnableConfigData.value}}" stepKey="enableJsMinification"/> - <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <actionGroup ref="LoginActionGroup" stepKey="loginAsAdmin"/> <see userInput="Dashboard" selector="{{AdminHeaderSection.pageTitle}}" stepKey="seeDashboardTitle"/> </before> <after> From 10cc12a26209b38b210c9e67a64ab9d378d7e1bc Mon Sep 17 00:00:00 2001 From: Daniel Ruf <mac1@daniel-ruf.de> Date: Tue, 7 Jan 2020 23:03:11 +0100 Subject: [PATCH 0703/1143] Migrate helper to ViewModel --- .../Magento/Customer/ViewModel/Address.php | 75 +++++++++++++++++++ .../frontend/layout/customer_address_form.xml | 1 + .../frontend/templates/address/edit.phtml | 20 ++--- 3 files changed, 87 insertions(+), 9 deletions(-) create mode 100644 app/code/Magento/Customer/ViewModel/Address.php diff --git a/app/code/Magento/Customer/ViewModel/Address.php b/app/code/Magento/Customer/ViewModel/Address.php new file mode 100644 index 0000000000000..c9c712f2f364f --- /dev/null +++ b/app/code/Magento/Customer/ViewModel/Address.php @@ -0,0 +1,75 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Customer\ViewModel; + +use Magento\Directory\Helper\Data as DataHelper; +use Magento\Customer\Helper\Address as AddressHelper; +use Magento\Framework\View\Element\Block\ArgumentInterface; + +/** + * Customer address view model. + */ + +class Address implements ArgumentInterface +{ + /** + * Data helper + * + * @var DataHelper + */ + private $helperData; + + /** + * Address helper + * + * @var AddressHelper + */ + private $helperAddress; + + /** + * @param Data $helperData + * @param Address $helperAddress + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function __construct( + Data $helperData, + Address $helperAddress + ) { + $this->helperData= $helperData; + $this->helperAddress= $helperAddress; + } + + public function dataGetAttributeValidationClass($param) + { + return $this->dataAddress->getAttributeValidationClass($param); + } + + public function addressGetAttributeValidationClass($param) + { + return $this->helperAddress->getAttributeValidationClass($param); + } + + public function addressGetStreetLines() + { + return $this->helperAddress->getStreetLines(); + } + + public function addressIsVatAttributeVisible() + { + return $this->helperAddress->isVatAttributeVisible(); + } + + public function dataGetRegionJson() + { + return $this->helperData->getRegionJson(); + } + + public function dataGetCountriesWithOptionalZip() + { + return $this->helperData->getCountriesWithOptionalZip(); + } +} diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_address_form.xml b/app/code/Magento/Customer/view/frontend/layout/customer_address_form.xml index f5ee2b347a5b2..6f316cb2b07e4 100644 --- a/app/code/Magento/Customer/view/frontend/layout/customer_address_form.xml +++ b/app/code/Magento/Customer/view/frontend/layout/customer_address_form.xml @@ -21,6 +21,7 @@ <arguments> <argument name="attribute_data" xsi:type="object">Magento\Customer\Block\DataProviders\AddressAttributeData</argument> <argument name="post_code_config" xsi:type="object">Magento\Customer\Block\DataProviders\PostCodesPatternsAttributeData</argument> + <argument name="view_model" xsi:type="object">Magento\Customer\ViewModel\Data</argument> </arguments> </block> </referenceContainer> diff --git a/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml b/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml index cf8a7b354a3d8..bcb05fecb3dc1 100644 --- a/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml @@ -5,6 +5,8 @@ */ /** @var \Magento\Customer\Block\Address\Edit $block */ +/** @var \Magento\Customer\ViewModel\Address $viewModel */ +$viewModel = $block->getData('viewModel'); ?> <?php $_company = $block->getLayout()->createBlock(\Magento\Customer\Block\Widget\Company::class) ?> <?php $_telephone = $block->getLayout()->createBlock(\Magento\Customer\Block\Widget\Telephone::class) ?> @@ -19,13 +21,13 @@ <?php $_dataHelper = $this->helper(\Magento\Directory\Helper\Data::class); ?> <?php $_addressHelper = $this->helper(\Magento\Customer\Helper\Address::class); ?> -<?php $_vatidValidationClass = $_addressHelper->getAttributeValidationClass('vat_id'); ?> -<?php $_cityValidationClass = $_addressHelper->getAttributeValidationClass('city'); ?> -<?php $_postcodeValidationClass_value = $_addressHelper->getAttributeValidationClass('postcode'); ?> +<?php $_vatidValidationClass = $viewModel->addressGetAttributeValidationClass('vat_id'); ?> +<?php $_cityValidationClass = $viewModel->addressGetAttributeValidationClass('city'); ?> +<?php $_postcodeValidationClass_value = $viewModel->addressGetAttributeValidationClass('postcode'); ?> <?php $_postcodeValidationClass = $_postcodeValidationClass_value; ?> -<?php $_streetValidationClass = $_addressHelper->getAttributeValidationClass('street'); ?> +<?php $_streetValidationClass = $viewModel->addressGetAttributeValidationClass('street'); ?> <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?> -<?php $_regionValidationClass = $_addressHelper->getAttributeValidationClass('region'); ?> +<?php $_regionValidationClass = $viewModel->addressGetAttributeValidationClass('region'); ?> <form class="form-address-edit" action="<?= $block->escapeUrl($block->getSaveUrl()) ?>" @@ -65,7 +67,7 @@ id="street_1" class="input-text <?= $block->escapeHtmlAttr($_streetValidationClass) ?>"/> <div class="nested"> - <?php for ($_i = 1, $_n = $_addressHelper->getStreetLines(); $_i < $_n; $_i++): ?> + <?php for ($_i = 1, $_n = $viewModel->addressGetStreetLines(); $_i < $_n; $_i++): ?> <div class="field additional"> <label class="label" for="street_<?= /* @noEscape */ $_i + 1 ?>"> <span><?= $block->escapeHtml(__('Street Address %1', $_i + 1)) ?></span> @@ -83,7 +85,7 @@ </div> </div> - <?php if ($_addressHelper->isVatAttributeVisible()): ?> + <?php if ($viewModel->addressGetisVatAttributeVisible()): ?> <div class="field taxvat"> <label class="label" for="vat_id"> <span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('vat_id') ?></span> @@ -214,9 +216,9 @@ "regionInputId": "#region", "postcodeId": "#zip", "form": "#form-validate", - "regionJson": <?= /* @noEscape */ $_dataHelper->getRegionJson() ?>, + "regionJson": <?= /* @noEscape */ $viewModel->dataGetRegionJson() ?>, "defaultRegion": "<?= (int) $block->getRegionId() ?>", - "countriesWithOptionalZip": <?= /* @noEscape */ $_dataHelper->getCountriesWithOptionalZip(true) ?> + "countriesWithOptionalZip": <?= /* @noEscape */ $viewModel->dataGetCountriesWithOptionalZip(true) ?> } } } From d86c358e68cfc466067fcdc7ee5ecf604888fea3 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets <vzaets@magento.com> Date: Tue, 7 Jan 2020 16:24:58 -0600 Subject: [PATCH 0704/1143] Fix static --- app/code/Magento/Catalog/Model/Product/Option/Value.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Catalog/Model/Product/Option/Value.php b/app/code/Magento/Catalog/Model/Product/Option/Value.php index da70c747806e1..783bda4699792 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Value.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Value.php @@ -113,6 +113,8 @@ public function __construct( } /** + * Override parent _construct method + * * @return void */ protected function _construct() From ff4ead556dc0540e321bc2f9de6e835b04bf73d0 Mon Sep 17 00:00:00 2001 From: Daniel Ruf <mac1@daniel-ruf.de> Date: Wed, 8 Jan 2020 00:04:10 +0100 Subject: [PATCH 0705/1143] Resolve codestyle errors --- .../Magento/Customer/ViewModel/Address.php | 45 ++++++++++++++++--- .../frontend/templates/address/edit.phtml | 3 -- 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Customer/ViewModel/Address.php b/app/code/Magento/Customer/ViewModel/Address.php index c9c712f2f364f..1cb67a53da315 100644 --- a/app/code/Magento/Customer/ViewModel/Address.php +++ b/app/code/Magento/Customer/ViewModel/Address.php @@ -14,6 +14,9 @@ * Customer address view model. */ + /** + * Address view model + */ class Address implements ArgumentInterface { /** @@ -31,43 +34,75 @@ class Address implements ArgumentInterface private $helperAddress; /** - * @param Data $helperData - * @param Address $helperAddress + * Constructor + * + * @param DataHelper $helperData + * @param AddressHelper $helperAddress * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function __construct( - Data $helperData, - Address $helperAddress + DataHelper $helperData, + AddressHelper $helperAddress ) { $this->helperData= $helperData; $this->helperAddress= $helperAddress; } + /** + * Returns data validation class + * + * @return mixed + */ public function dataGetAttributeValidationClass($param) { - return $this->dataAddress->getAttributeValidationClass($param); + return $this->helperData->getAttributeValidationClass($param); } + /** + * Returns address validation class + * + * @return mixed + */ public function addressGetAttributeValidationClass($param) { return $this->helperAddress->getAttributeValidationClass($param); } + /** + * Returns street lines + * + * @return mixed + */ public function addressGetStreetLines() { return $this->helperAddress->getStreetLines(); } + /** + * Returns if VAT attribute is visible + * + * @return boolean + */ public function addressIsVatAttributeVisible() { return $this->helperAddress->isVatAttributeVisible(); } + /** + * Returns region JSON + * + * @return mixed + */ public function dataGetRegionJson() { return $this->helperData->getRegionJson(); } + /** + * Returns rcountries with optional zip + * + * @return mixed + */ public function dataGetCountriesWithOptionalZip() { return $this->helperData->getCountriesWithOptionalZip(); diff --git a/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml b/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml index bcb05fecb3dc1..1ab6500aeb908 100644 --- a/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml @@ -18,9 +18,6 @@ $viewModel = $block->getData('viewModel'); <?php $_selectRegion = 'Please select a region, state or province.'; ?> <?php $_displayAll = $block->getConfig('general/region/display_all'); ?> -<?php $_dataHelper = $this->helper(\Magento\Directory\Helper\Data::class); ?> -<?php $_addressHelper = $this->helper(\Magento\Customer\Helper\Address::class); ?> - <?php $_vatidValidationClass = $viewModel->addressGetAttributeValidationClass('vat_id'); ?> <?php $_cityValidationClass = $viewModel->addressGetAttributeValidationClass('city'); ?> <?php $_postcodeValidationClass_value = $viewModel->addressGetAttributeValidationClass('postcode'); ?> From 535b7c8ab30702d087ac3958cbe2e45c13859daf Mon Sep 17 00:00:00 2001 From: Daniel Ruf <mac1@daniel-ruf.de> Date: Wed, 8 Jan 2020 00:08:05 +0100 Subject: [PATCH 0706/1143] Fix class name --- .../Customer/view/frontend/layout/customer_address_form.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_address_form.xml b/app/code/Magento/Customer/view/frontend/layout/customer_address_form.xml index 6f316cb2b07e4..29343c6066846 100644 --- a/app/code/Magento/Customer/view/frontend/layout/customer_address_form.xml +++ b/app/code/Magento/Customer/view/frontend/layout/customer_address_form.xml @@ -21,7 +21,7 @@ <arguments> <argument name="attribute_data" xsi:type="object">Magento\Customer\Block\DataProviders\AddressAttributeData</argument> <argument name="post_code_config" xsi:type="object">Magento\Customer\Block\DataProviders\PostCodesPatternsAttributeData</argument> - <argument name="view_model" xsi:type="object">Magento\Customer\ViewModel\Data</argument> + <argument name="view_model" xsi:type="object">Magento\Customer\ViewModel\Address</argument> </arguments> </block> </referenceContainer> From 4b86376704ed5bd19b9e83d052a9625d609bc779 Mon Sep 17 00:00:00 2001 From: Daniel Ruf <mac1@daniel-ruf.de> Date: Wed, 8 Jan 2020 00:38:13 +0100 Subject: [PATCH 0707/1143] Fix codestyle --- .../Magento/Customer/ViewModel/Address.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Customer/ViewModel/Address.php b/app/code/Magento/Customer/ViewModel/Address.php index 1cb67a53da315..e4fca9ac2e33d 100644 --- a/app/code/Magento/Customer/ViewModel/Address.php +++ b/app/code/Magento/Customer/ViewModel/Address.php @@ -15,8 +15,8 @@ */ /** - * Address view model - */ + * Address view model + */ class Address implements ArgumentInterface { /** @@ -35,7 +35,7 @@ class Address implements ArgumentInterface /** * Constructor - * + * * @param DataHelper $helperData * @param AddressHelper $helperAddress * @SuppressWarnings(PHPMD.UnusedFormalParameter) @@ -50,7 +50,7 @@ public function __construct( /** * Returns data validation class - * + * @param mixed $param * @return mixed */ public function dataGetAttributeValidationClass($param) @@ -60,7 +60,7 @@ public function dataGetAttributeValidationClass($param) /** * Returns address validation class - * + * @param mixed $param * @return mixed */ public function addressGetAttributeValidationClass($param) @@ -70,7 +70,7 @@ public function addressGetAttributeValidationClass($param) /** * Returns street lines - * + * * @return mixed */ public function addressGetStreetLines() @@ -80,7 +80,7 @@ public function addressGetStreetLines() /** * Returns if VAT attribute is visible - * + * * @return boolean */ public function addressIsVatAttributeVisible() @@ -90,7 +90,7 @@ public function addressIsVatAttributeVisible() /** * Returns region JSON - * + * * @return mixed */ public function dataGetRegionJson() @@ -100,7 +100,7 @@ public function dataGetRegionJson() /** * Returns rcountries with optional zip - * + * * @return mixed */ public function dataGetCountriesWithOptionalZip() From 3165046a04ef94be789d1028eca0048c5991227b Mon Sep 17 00:00:00 2001 From: Daniel Ruf <mac1@daniel-ruf.de> Date: Wed, 8 Jan 2020 01:33:10 +0100 Subject: [PATCH 0708/1143] Add lines to resolve codestyle errors --- app/code/Magento/Customer/ViewModel/Address.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Customer/ViewModel/Address.php b/app/code/Magento/Customer/ViewModel/Address.php index e4fca9ac2e33d..11237aab0bf1f 100644 --- a/app/code/Magento/Customer/ViewModel/Address.php +++ b/app/code/Magento/Customer/ViewModel/Address.php @@ -50,6 +50,7 @@ public function __construct( /** * Returns data validation class + * * @param mixed $param * @return mixed */ @@ -60,6 +61,7 @@ public function dataGetAttributeValidationClass($param) /** * Returns address validation class + * * @param mixed $param * @return mixed */ From 66a76f3c8c5618731dd3286dd5bbda05bda0f272 Mon Sep 17 00:00:00 2001 From: Daniel Ruf <mac1@daniel-ruf.de> Date: Wed, 8 Jan 2020 01:33:23 +0100 Subject: [PATCH 0709/1143] Fix argument name --- .../Customer/view/frontend/layout/customer_address_form.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_address_form.xml b/app/code/Magento/Customer/view/frontend/layout/customer_address_form.xml index 29343c6066846..4b6355cb6e323 100644 --- a/app/code/Magento/Customer/view/frontend/layout/customer_address_form.xml +++ b/app/code/Magento/Customer/view/frontend/layout/customer_address_form.xml @@ -21,7 +21,7 @@ <arguments> <argument name="attribute_data" xsi:type="object">Magento\Customer\Block\DataProviders\AddressAttributeData</argument> <argument name="post_code_config" xsi:type="object">Magento\Customer\Block\DataProviders\PostCodesPatternsAttributeData</argument> - <argument name="view_model" xsi:type="object">Magento\Customer\ViewModel\Address</argument> + <argument name="viewModel" xsi:type="object">Magento\Customer\ViewModel\Address</argument> </arguments> </block> </referenceContainer> From ca19b0690d3178bef00050c8edcdb975ff8199ad Mon Sep 17 00:00:00 2001 From: Daniel Ruf <mac1@daniel-ruf.de> Date: Wed, 8 Jan 2020 01:35:54 +0100 Subject: [PATCH 0710/1143] Use recommended argument name and magic getter --- .../Customer/view/frontend/layout/customer_address_form.xml | 2 +- .../Magento/Customer/view/frontend/templates/address/edit.phtml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_address_form.xml b/app/code/Magento/Customer/view/frontend/layout/customer_address_form.xml index 4b6355cb6e323..29343c6066846 100644 --- a/app/code/Magento/Customer/view/frontend/layout/customer_address_form.xml +++ b/app/code/Magento/Customer/view/frontend/layout/customer_address_form.xml @@ -21,7 +21,7 @@ <arguments> <argument name="attribute_data" xsi:type="object">Magento\Customer\Block\DataProviders\AddressAttributeData</argument> <argument name="post_code_config" xsi:type="object">Magento\Customer\Block\DataProviders\PostCodesPatternsAttributeData</argument> - <argument name="viewModel" xsi:type="object">Magento\Customer\ViewModel\Address</argument> + <argument name="view_model" xsi:type="object">Magento\Customer\ViewModel\Address</argument> </arguments> </block> </referenceContainer> diff --git a/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml b/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml index 1ab6500aeb908..9a64129f4cfd4 100644 --- a/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml @@ -6,7 +6,7 @@ /** @var \Magento\Customer\Block\Address\Edit $block */ /** @var \Magento\Customer\ViewModel\Address $viewModel */ -$viewModel = $block->getData('viewModel'); +$viewModel = $block->getViewModel(); ?> <?php $_company = $block->getLayout()->createBlock(\Magento\Customer\Block\Widget\Company::class) ?> <?php $_telephone = $block->getLayout()->createBlock(\Magento\Customer\Block\Widget\Telephone::class) ?> From 155e8a988bdf476ca58fa46c467a2e39dea96780 Mon Sep 17 00:00:00 2001 From: Manuel Canepa <manuelcanepa@gmail.com> Date: Wed, 8 Jan 2020 01:09:08 -0300 Subject: [PATCH 0711/1143] Add format fixes --- .../Model/XmlCatalog/Format/VsCode.php | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/app/code/Magento/Developer/Model/XmlCatalog/Format/VsCode.php b/app/code/Magento/Developer/Model/XmlCatalog/Format/VsCode.php index cedf650a1e8ee..1b881633329d9 100644 --- a/app/code/Magento/Developer/Model/XmlCatalog/Format/VsCode.php +++ b/app/code/Magento/Developer/Model/XmlCatalog/Format/VsCode.php @@ -3,14 +3,15 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare (strict_types = 1); namespace Magento\Developer\Model\XmlCatalog\Format; -use Magento\Framework\App\ObjectManager; use Magento\Framework\DomDocument\DomDocumentFactory; use Magento\Framework\Exception\FileSystemException; use Magento\Framework\Filesystem\Directory\ReadFactory; use Magento\Framework\Filesystem\Directory\ReadInterface; +use Magento\Framework\Filesystem\DriverPool; use Magento\Framework\Filesystem\File\WriteFactory; /** @@ -19,6 +20,8 @@ class VsCode implements FormatInterface { private const PROJECT_PATH_IDENTIFIER = '..'; + private const FILE_MODE_READ = 'r'; + private const FILE_MODE_WRITE = 'w'; /** * @var ReadInterface @@ -47,26 +50,22 @@ public function __construct( ) { $this->currentDirRead = $readFactory->create(getcwd()); $this->fileWriteFactory = $fileWriteFactory; - $this->domDocumentFactory = $domDocumentFactory ?: ObjectManager::getInstance()->get(DomDocumentFactory::class); + $this->domDocumentFactory = $domDocumentFactory; } /** * Generate Catalog of URNs for the VsCode * * @param string[] $dictionary - * @param string $configFilePath relative path to the PhpStorm misc.xml + * @param string $configFile relative path to the VsCode catalog.xml * @return void */ - public function generateCatalog(array $dictionary, $configFilePath) + public function generateCatalog(array $dictionary, $configFile): void { $catalogNode = null; try { - $file = $this->fileWriteFactory->create( - $configFilePath, - \Magento\Framework\Filesystem\DriverPool::FILE, - 'r' - ); + $file = $this->fileWriteFactory->create($configFile, DriverPool::FILE, self::FILE_MODE_READ); $dom = $this->domDocumentFactory->create(); $fileContent = $file->readAll(); if (!empty($fileContent)) { @@ -91,11 +90,7 @@ public function generateCatalog(array $dictionary, $configFilePath) $catalogNode->appendChild($node); } $dom->formatOutput = true; - $file = $this->fileWriteFactory->create( - $configFilePath, - \Magento\Framework\Filesystem\DriverPool::FILE, - 'w' - ); + $file = $this->fileWriteFactory->create($configFile, DriverPool::FILE, self::FILE_MODE_WRITE); $file->write($dom->saveXML()); $file->close(); } @@ -106,7 +101,7 @@ public function generateCatalog(array $dictionary, $configFilePath) * @param \DOMDocument $dom * @return \DOMElement */ - private function initEmptyFile(\DOMDocument $dom) + private function initEmptyFile(\DOMDocument $dom): \DOMElement { $catalogNode = $dom->createElement('catalog'); From 60b7f1caa1e1921abd2dd17f2dc40e0924585b53 Mon Sep 17 00:00:00 2001 From: Daniel Ruf <d.ruf@bitexpert.de> Date: Wed, 8 Jan 2020 08:03:21 +0100 Subject: [PATCH 0712/1143] Fix method name --- .../Magento/Customer/view/frontend/templates/address/edit.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml b/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml index 9a64129f4cfd4..6cf71f1e56a47 100644 --- a/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml @@ -82,7 +82,7 @@ $viewModel = $block->getViewModel(); </div> </div> - <?php if ($viewModel->addressGetisVatAttributeVisible()): ?> + <?php if ($viewModel->addressIsVatAttributeVisible()): ?> <div class="field taxvat"> <label class="label" for="vat_id"> <span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('vat_id') ?></span> From 5d0e12bd42e1c19b718f2e22f246db039e015520 Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Wed, 8 Jan 2020 09:26:02 +0200 Subject: [PATCH 0713/1143] Adjusting the Unit Test --- .../Listing/Column/GroupActionsTest.php | 112 ++++++++++++++---- 1 file changed, 86 insertions(+), 26 deletions(-) diff --git a/app/code/Magento/Customer/Test/Unit/Ui/Component/Listing/Column/GroupActionsTest.php b/app/code/Magento/Customer/Test/Unit/Ui/Component/Listing/Column/GroupActionsTest.php index 51cf0e5395b47..02cacea5c2601 100644 --- a/app/code/Magento/Customer/Test/Unit/Ui/Component/Listing/Column/GroupActionsTest.php +++ b/app/code/Magento/Customer/Test/Unit/Ui/Component/Listing/Column/GroupActionsTest.php @@ -22,6 +22,36 @@ */ class GroupActionsTest extends TestCase { + /** + * @var int + */ + private const STUB_NOT_LOGGED_IN_CUSTOMER_GROUP_ID = 0; + + /** + * @var string + */ + private const STUB_NOT_LOGGED_IN_CUSTOMER_GROUP_NAME = 'Not Logged In'; + + /** + * @var int + */ + private const STUB_GENERAL_CUSTOMER_GROUP_ID = 1; + + /** + * @var string + */ + private const STUB_GENERAL_CUSTOMER_GROUP_NAME = 'General'; + + /** + * @var string + */ + private const STUB_GROUP_EDIT_URL = 'http://magento.com/customer/group/edit'; + + /** + * @var string + */ + private const STUB_GROUP_DELETE_URL = 'http://magento.com/customer/group/delete'; + /** * @var GroupActions */ @@ -97,7 +127,6 @@ public function setUp() */ public function testPrepareDataSourceWithNonDefaultGroup(array $items, bool $isDefaultGroup, array $expected) { - $customerGroup = 'General'; $dataSource = [ 'data' => [ 'items' => $items @@ -111,18 +140,29 @@ public function testPrepareDataSourceWithNonDefaultGroup(array $items, bool $isD $this->groupManagementMock->expects($this->any()) ->method('isReadonly') - ->with(1) + ->with(static::STUB_GENERAL_CUSTOMER_GROUP_ID) ->willReturn($isDefaultGroup); $this->escaperMock->expects($this->any()) ->method('escapeHtml') - ->with($customerGroup) - ->willReturn($customerGroup); + ->with(static::STUB_GENERAL_CUSTOMER_GROUP_NAME) + ->willReturn(static::STUB_GENERAL_CUSTOMER_GROUP_NAME); $this->urlBuilderMock->expects($this->any()) ->method('getUrl') ->willReturnMap( [ - ['customer/group/edit', ['id' => 1], 'http://magento.com/customer/group/edit'], - ['customer/group/delete', ['id' => 1], 'http://magento.com/customer/group/delete'] + [ + 'customer/group/edit', + [ + 'id' => static::STUB_GENERAL_CUSTOMER_GROUP_ID + ], + static::STUB_GROUP_EDIT_URL], + [ + 'customer/group/delete', + [ + 'id' => static::STUB_GENERAL_CUSTOMER_GROUP_ID + ], + static::STUB_GROUP_DELETE_URL + ] ] ); @@ -142,12 +182,12 @@ public function testPrepareDataSourceWithDefaultGroup() 'data' => [ 'items' => [ [ - 'customer_group_id' => 1, - 'customer_group_code' => 'General', + 'customer_group_id' => static::STUB_GENERAL_CUSTOMER_GROUP_ID, + 'customer_group_code' => static::STUB_GENERAL_CUSTOMER_GROUP_NAME, ], [ - 'customer_group_id' => 0, - 'customer_group_code' => 'Not Logged In', + 'customer_group_id' => static::STUB_NOT_LOGGED_IN_CUSTOMER_GROUP_ID, + 'customer_group_code' => static::STUB_NOT_LOGGED_IN_CUSTOMER_GROUP_NAME, ], ] ] @@ -156,22 +196,22 @@ public function testPrepareDataSourceWithDefaultGroup() 'data' => [ 'items' => [ [ - 'customer_group_id' => 1, - 'customer_group_code' => 'General', + 'customer_group_id' => static::STUB_GENERAL_CUSTOMER_GROUP_ID, + 'customer_group_code' => static::STUB_GENERAL_CUSTOMER_GROUP_NAME, 'name' => [ 'edit' => [ - 'href' => 'http://magento.com/customer/group/edit', + 'href' => static::STUB_GROUP_EDIT_URL, 'label' => __('Edit'), '__disableTmpl' => true, ] ] ], [ - 'customer_group_id' => 0, - 'customer_group_code' => 'Not Logged In', + 'customer_group_id' => static::STUB_NOT_LOGGED_IN_CUSTOMER_GROUP_ID, + 'customer_group_code' => static::STUB_NOT_LOGGED_IN_CUSTOMER_GROUP_NAME, 'name' => [ 'edit' => [ - 'href' => 'http://magento.com/customer/group/edit', + 'href' => static::STUB_GROUP_EDIT_URL, 'label' => __('Edit'), '__disableTmpl' => true, ] @@ -188,16 +228,36 @@ public function testPrepareDataSourceWithDefaultGroup() ->method('escapeHtml') ->willReturnMap( [ - ['General', null, 'General'], - ['Not Logged In', null, 'Not Logged In'] + [ + static::STUB_GENERAL_CUSTOMER_GROUP_NAME, + null, + static::STUB_GENERAL_CUSTOMER_GROUP_NAME + ], + [ + static::STUB_NOT_LOGGED_IN_CUSTOMER_GROUP_NAME, + null, + static::STUB_NOT_LOGGED_IN_CUSTOMER_GROUP_NAME + ] ] ); $this->urlBuilderMock->expects($this->any()) ->method('getUrl') ->willReturnMap( [ - ['customer/group/edit', ['id' => 1], 'http://magento.com/customer/group/edit'], - ['customer/group/edit', ['id' => 0], 'http://magento.com/customer/group/edit'] + [ + 'customer/group/edit', + [ + 'id' => static::STUB_GENERAL_CUSTOMER_GROUP_ID + ], + static::STUB_GROUP_EDIT_URL + ], + [ + 'customer/group/edit', + [ + 'id' => static::STUB_NOT_LOGGED_IN_CUSTOMER_GROUP_ID + ], + static::STUB_GROUP_EDIT_URL + ] ] ); @@ -216,23 +276,23 @@ public function customerGroupsDataProvider(): array [ [ [ - 'customer_group_id' => 1, - 'customer_group_code' => 'General', + 'customer_group_id' => static::STUB_GENERAL_CUSTOMER_GROUP_ID, + 'customer_group_code' => static::STUB_GENERAL_CUSTOMER_GROUP_NAME, ], ], false, [ [ - 'customer_group_id' => 1, - 'customer_group_code' => 'General', + 'customer_group_id' => static::STUB_GENERAL_CUSTOMER_GROUP_ID, + 'customer_group_code' => static::STUB_GENERAL_CUSTOMER_GROUP_NAME, 'name' => [ 'edit' => [ - 'href' => 'http://magento.com/customer/group/edit', + 'href' => static::STUB_GROUP_EDIT_URL, 'label' => __('Edit'), '__disableTmpl' => true, ], 'delete' => [ - 'href' => 'http://magento.com/customer/group/delete', + 'href' => static::STUB_GROUP_DELETE_URL, 'label' => __('Delete'), 'post' => true, '__disableTmpl' => true, From 1eed0f183d9cbaa038ba2cbec8722eaed9505e5f Mon Sep 17 00:00:00 2001 From: Daniel Ruf <d.ruf@bitexpert.de> Date: Wed, 8 Jan 2020 09:13:41 +0100 Subject: [PATCH 0714/1143] Add missing parameter and update DocBlocks --- .../Magento/Customer/ViewModel/Address.php | 51 ++++++++++++------- 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/app/code/Magento/Customer/ViewModel/Address.php b/app/code/Magento/Customer/ViewModel/Address.php index 11237aab0bf1f..a6bcbfcb40676 100644 --- a/app/code/Magento/Customer/ViewModel/Address.php +++ b/app/code/Magento/Customer/ViewModel/Address.php @@ -8,6 +8,7 @@ use Magento\Directory\Helper\Data as DataHelper; use Magento\Customer\Helper\Address as AddressHelper; +use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\View\Element\Block\ArgumentInterface; /** @@ -49,31 +50,41 @@ public function __construct( } /** - * Returns data validation class + * Get string with frontend validation classes for attribute * - * @param mixed $param - * @return mixed + * @param string $attributeCode + * + * @return string + * + * @throws \Magento\Framework\Exception\LocalizedException */ - public function dataGetAttributeValidationClass($param) + public function dataGetAttributeValidationClass($attributeCode) { - return $this->helperData->getAttributeValidationClass($param); + return $this->helperData->getAttributeValidationClass($attributeCode); } /** - * Returns address validation class + * Get string with frontend validation classes for attribute + * + * @param string $attributeCode * - * @param mixed $param - * @return mixed + * @return string + * + * @throws \Magento\Framework\Exception\LocalizedException */ - public function addressGetAttributeValidationClass($param) + public function addressGetAttributeValidationClass($attributeCode) { - return $this->helperAddress->getAttributeValidationClass($param); + return $this->helperAddress->getAttributeValidationClass($attributeCode); } /** - * Returns street lines + * Return Number of Lines in a Street Address for store + * + * @param \Magento\Store\Model\Store|int|string $store * - * @return mixed + * @return int + * @throws NoSuchEntityException + * @throws \Magento\Framework\Exception\LocalizedException */ public function addressGetStreetLines() { @@ -81,7 +92,7 @@ public function addressGetStreetLines() } /** - * Returns if VAT attribute is visible + * Check if VAT ID address attribute has to be shown on frontend (on Customer Address management forms) * * @return boolean */ @@ -91,9 +102,10 @@ public function addressIsVatAttributeVisible() } /** - * Returns region JSON + * Retrieve regions data json * - * @return mixed + * @return string + * @throws NoSuchEntityException */ public function dataGetRegionJson() { @@ -101,12 +113,13 @@ public function dataGetRegionJson() } /** - * Returns rcountries with optional zip + * Return ISO2 country codes, which have optional Zip/Postal pre-configured * - * @return mixed + * @param bool $asJson + * @return array|string */ - public function dataGetCountriesWithOptionalZip() + public function dataGetCountriesWithOptionalZip($asJson) { - return $this->helperData->getCountriesWithOptionalZip(); + return $this->helperData->getCountriesWithOptionalZip($asJson); } } From 62d8ba9a1389b51cab44f0a0f0ffd400cbe7a9e4 Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Wed, 8 Jan 2020 11:27:32 +0200 Subject: [PATCH 0715/1143] Adding client validation for Conversion ID --- app/code/Magento/GoogleAdwords/etc/adminhtml/system.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/GoogleAdwords/etc/adminhtml/system.xml b/app/code/Magento/GoogleAdwords/etc/adminhtml/system.xml index c312028cf63be..74a16ae6acc62 100644 --- a/app/code/Magento/GoogleAdwords/etc/adminhtml/system.xml +++ b/app/code/Magento/GoogleAdwords/etc/adminhtml/system.xml @@ -17,6 +17,7 @@ <field id="conversion_id" translate="label" type="text" sortOrder="11" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Conversion ID</label> <backend_model>Magento\GoogleAdwords\Model\Config\Backend\ConversionId</backend_model> + <validate>required-entry validate-number</validate> <depends> <field id="*/*/active">1</field> </depends> From 4b34eeab2563581e5d373a824c2b0cac574094a1 Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Wed, 8 Jan 2020 10:48:21 +0200 Subject: [PATCH 0716/1143] MC-25138: 24/36 product limit on Category page occur fatal --- .../Mftf/Data/CatalogStorefrontConfigData.xml | 135 ++++++++++-------- ...StorefrontCategoryBottomToolbarSection.xml | 1 + ...ntQuickSearchWithPaginationActionGroup.xml | 22 +++ .../Collection/SearchResultApplier.php | 29 +++- ...ductQuickSearchUsingElasticSearch6Test.xml | 67 +++++++++ ...ElasticSearch6WithNotAvailablePageTest.xml | 46 ++++++ 6 files changed, 233 insertions(+), 67 deletions(-) create mode 100644 app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontQuickSearchWithPaginationActionGroup.xml create mode 100644 app/code/Magento/Elasticsearch6/Test/Mftf/Test/StorefrontProductQuickSearchUsingElasticSearch6Test.xml create mode 100644 app/code/Magento/Elasticsearch6/Test/Mftf/Test/StorefrontProductQuickSearchUsingElasticSearch6WithNotAvailablePageTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/CatalogStorefrontConfigData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/CatalogStorefrontConfigData.xml index abf01f00dbbcc..be04c297cec25 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Data/CatalogStorefrontConfigData.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Data/CatalogStorefrontConfigData.xml @@ -1,63 +1,72 @@ -<?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="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> - <entity name="RememberPaginationCatalogStorefrontConfig" type="catalog_storefront_config"> - <requiredEntity type="grid_per_page_values">GridPerPageValues</requiredEntity> - <requiredEntity type="remember_pagination">RememberCategoryPagination</requiredEntity> - </entity> - - <entity name="GridPerPageValues" type="grid_per_page_values"> - <data key="value">9,12,20,24</data> - </entity> - - <entity name="RememberCategoryPagination" type="remember_pagination"> - <data key="value">1</data> - </entity> - - <entity name="DefaultCatalogStorefrontConfiguration" type="default_catalog_storefront_config"> - <requiredEntity type="catalogStorefrontFlagZero">DefaultCatalogStorefrontFlagZero</requiredEntity> - <data key="list_allow_all">DefaultListAllowAll</data> - <data key="flat_catalog_product">DefaultFlatCatalogProduct</data> - </entity> - - <entity name="DefaultCatalogStorefrontFlagZero" type="catalogStorefrontFlagZero"> - <data key="value">0</data> - </entity> - - <entity name="DefaultListAllowAll" type="list_allow_all"> - <data key="value">0</data> - </entity> - - <entity name="DefaultFlatCatalogProduct" type="flat_catalog_product"> - <data key="value">0</data> - </entity> - - <entity name="UseFlatCatalogCategoryAndProduct" type="catalog_storefront_config"> - <requiredEntity type="flat_catalog_product">UseFlatCatalogProduct</requiredEntity> - <requiredEntity type="flat_catalog_category">UseFlatCatalogCategory</requiredEntity> - </entity> - - <entity name="UseFlatCatalogProduct" type="flat_catalog_product"> - <data key="value">1</data> - </entity> - - <entity name="UseFlatCatalogCategory" type="flat_catalog_category"> - <data key="value">1</data> - </entity> - - <entity name="DefaultFlatCatalogCategoryAndProduct" type="catalog_storefront_config"> - <requiredEntity type="flat_catalog_product">DefaultFlatCatalogProduct</requiredEntity> - <requiredEntity type="flat_catalog_category">DefaultFlatCatalogCategory</requiredEntity> - </entity> - - <entity name="DefaultFlatCatalogCategory" type="flat_catalog_category"> - <data key="value">0</data> - </entity> -</entities> +<?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="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> + <entity name="RememberPaginationCatalogStorefrontConfig" type="catalog_storefront_config"> + <requiredEntity type="grid_per_page_values">GridPerPageValues</requiredEntity> + <requiredEntity type="remember_pagination">RememberCategoryPagination</requiredEntity> + </entity> + + <entity name="GridPerPageValues" type="grid_per_page_values"> + <data key="value">9,12,20,24</data> + </entity> + + <entity name="RememberCategoryPagination" type="remember_pagination"> + <data key="value">1</data> + </entity> + + <entity name="DefaultCatalogStorefrontConfiguration" type="default_catalog_storefront_config"> + <requiredEntity type="catalogStorefrontFlagZero">DefaultCatalogStorefrontFlagZero</requiredEntity> + <data key="list_allow_all">DefaultListAllowAll</data> + <data key="flat_catalog_product">DefaultFlatCatalogProduct</data> + </entity> + + <entity name="DefaultCatalogStorefrontFlagZero" type="catalogStorefrontFlagZero"> + <data key="value">0</data> + </entity> + + <entity name="DefaultListAllowAll" type="list_allow_all"> + <data key="value">0</data> + </entity> + + <entity name="DefaultFlatCatalogProduct" type="flat_catalog_product"> + <data key="value">0</data> + </entity> + + <entity name="UseFlatCatalogCategoryAndProduct" type="catalog_storefront_config"> + <requiredEntity type="flat_catalog_product">UseFlatCatalogProduct</requiredEntity> + <requiredEntity type="flat_catalog_category">UseFlatCatalogCategory</requiredEntity> + </entity> + + <entity name="UseFlatCatalogProduct" type="flat_catalog_product"> + <data key="value">1</data> + </entity> + + <entity name="UseFlatCatalogCategory" type="flat_catalog_category"> + <data key="value">1</data> + </entity> + + <entity name="DefaultFlatCatalogCategoryAndProduct" type="catalog_storefront_config"> + <requiredEntity type="flat_catalog_product">DefaultFlatCatalogProduct</requiredEntity> + <requiredEntity type="flat_catalog_category">DefaultFlatCatalogCategory</requiredEntity> + </entity> + + <entity name="DefaultFlatCatalogCategory" type="flat_catalog_category"> + <data key="value">0</data> + </entity> + + <entity name="DefaultGridPerPageValuesConfigData"> + <data key="path">catalog/frontend/grid_per_page_values</data> + <data key="value">12,24,36</data> + </entity> + <entity name="CustomGridPerPageValuesConfigData"> + <data key="path">catalog/frontend/grid_per_page_values</data> + <data key="value">1,2</data> + </entity> +</entities> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryBottomToolbarSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryBottomToolbarSection.xml index 7ce795c78f25b..09eb4ad954274 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryBottomToolbarSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryBottomToolbarSection.xml @@ -12,5 +12,6 @@ <element name="previousPage" type="button" selector=".//*[@class='toolbar toolbar-products'][2]//a[contains(@class, 'previous')]" timeout="30"/> <element name="pageNumber" type="text" selector="//*[@class='toolbar toolbar-products'][2]//a[contains(@class, 'page')]//span[2][contains(text() ,'{{var1}}')]" parameterized="true"/> <element name="perPage" type="select" selector="//*[@class='toolbar toolbar-products'][2]//select[@id='limiter']"/> + <element name="currentPage" type="text" selector=".products.wrapper + .toolbar-products .pages .current span:nth-of-type(2)"/> </section> </sections> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontQuickSearchWithPaginationActionGroup.xml b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontQuickSearchWithPaginationActionGroup.xml new file mode 100644 index 0000000000000..95ebfa40adb26 --- /dev/null +++ b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontQuickSearchWithPaginationActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontQuickSearchWithPaginationActionGroup"> + <annotations> + <description>Navigate to catalog search page with prepared GET params to get search results with particular page number.</description> + </annotations> + <arguments> + <argument name="phrase" type="string" defaultValue="{{_defaultProduct.name}}"/> + <argument name="pageNumber" type="string" defaultValue="1"/> + </arguments> + <amOnPage url="{{StorefrontCatalogSearchPage.url}}?q={{phrase}}&p={{pageNumber}}" stepKey="navigateToCatalogSearchPageWithPreparedRequest"/> + <waitForPageLoad stepKey="waitForCatalogSearchPageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Elasticsearch/Model/ResourceModel/Fulltext/Collection/SearchResultApplier.php b/app/code/Magento/Elasticsearch/Model/ResourceModel/Fulltext/Collection/SearchResultApplier.php index ad52f81bf8eda..acbd05f31a927 100644 --- a/app/code/Magento/Elasticsearch/Model/ResourceModel/Fulltext/Collection/SearchResultApplier.php +++ b/app/code/Magento/Elasticsearch/Model/ResourceModel/Fulltext/Collection/SearchResultApplier.php @@ -60,6 +60,7 @@ public function apply() { if (empty($this->searchResult->getItems())) { $this->collection->getSelect()->where('NULL'); + return; } @@ -85,13 +86,33 @@ public function apply() private function sliceItems(array $items, int $size, int $currentPage): array { if ($size !== 0) { - $offset = ($currentPage - 1) * $size; - if ($offset < 0) { - $offset = 0; + // Check that current page is in a range of allowed page numbers, based on items count and items per page, + // than calculate offset for slicing items array. + $itemsCount = count($items); + $maxAllowedPageNumber = ceil($itemsCount/$size); + if ($currentPage < 1) { + $currentPage = 1; + } + if ($currentPage > $maxAllowedPageNumber) { + $currentPage = $maxAllowedPageNumber; } - $items = array_slice($items, $offset, $this->size); + + $offset = $this->getOffset($currentPage, $size); + $items = array_slice($items, $offset, $size); } return $items; } + + /** + * Get offset for given page. + * + * @param int $pageNumber + * @param int $pageSize + * @return int + */ + private function getOffset(int $pageNumber, int $pageSize): int + { + return ($pageNumber - 1) * $pageSize; + } } diff --git a/app/code/Magento/Elasticsearch6/Test/Mftf/Test/StorefrontProductQuickSearchUsingElasticSearch6Test.xml b/app/code/Magento/Elasticsearch6/Test/Mftf/Test/StorefrontProductQuickSearchUsingElasticSearch6Test.xml new file mode 100644 index 0000000000000..e763df7dd3227 --- /dev/null +++ b/app/code/Magento/Elasticsearch6/Test/Mftf/Test/StorefrontProductQuickSearchUsingElasticSearch6Test.xml @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="StorefrontProductQuickSearchUsingElasticSearch6Test"> + <annotations> + <features value="CatalogSearch"/> + <stories value="Storefront Search"/> + <title value="Product quick search doesn't throw exception after ES is chosen as search engine with different amount per page"/> + <description value="Verify no elastic search exception is thrown when searching for products, when displayed products per page are greater or equal the size of available products."/> + <severity value="BLOCKER"/> + <testCaseId value="MC-28917"/> + <useCaseId value="MC-25138"/> + <group value="catalog"/> + <group value="elasticsearch"/> + <group value="SearchEngineElasticsearch"/> + <group value="catalog_search"/> + </annotations> + <before> + <createData entity="SimpleProduct2" stepKey="createFirstProduct"> + <field key="name">AAA Product Simple AAA</field> + </createData> + <createData entity="SimpleProduct2" stepKey="createSecondProduct"> + <field key="name">Product Simple AAA</field> + </createData> + <magentoCLI command="config:set {{CustomGridPerPageValuesConfigData.path}} {{CustomGridPerPageValuesConfigData.value}}" stepKey="setCustomGridPerPageValues"/> + </before> + + <after> + <deleteData createDataKey="createFirstProduct" stepKey="deleteFirstProduct"/> + <deleteData createDataKey="createSecondProduct" stepKey="deleteSecondProduct"/> + <magentoCLI command="config:set {{DefaultGridPerPageValuesConfigData.path}} {{DefaultGridPerPageValuesConfigData.value}}" stepKey="setDefaultGridPerPageValues"/> + </after> + + <actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="openStorefrontHomePage"/> + <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="quickSearchSimpleProduct"> + <argument name="phrase" value="AAA"/> + </actionGroup> + <actionGroup ref="AssertProductOnCategoryPageActionGroup" stepKey="assertFirstProductOnCatalogSearchPage"> + <argument name="product" value="$createFirstProduct$"/> + </actionGroup> + <actionGroup ref="StorefrontCheckProductIsMissingInCategoryProductsPageActionGroup" stepKey="assertSecondProductIsMissingOnCatalogSearchPage"> + <argument name="productName" value="$createSecondProduct.name$"/> + </actionGroup> + <click selector="{{StorefrontCategoryBottomToolbarSection.nextPage}}" stepKey="clickNextPageCatalogSearchPager"/> + <actionGroup ref="AssertProductOnCategoryPageActionGroup" stepKey="assertSecondProductOnCatalogSearchPage"> + <argument name="product" value="$createSecondProduct$"/> + </actionGroup> + <actionGroup ref="StorefrontCheckProductIsMissingInCategoryProductsPageActionGroup" stepKey="assertFirstProductIsMissingOnCatalogSearchPage"> + <argument name="productName" value="$createFirstProduct.name$"/> + </actionGroup> + <selectOption selector="{{StorefrontCategoryBottomToolbarSection.perPage}}" userInput="2" stepKey="selectDisplayedProductInGridPerPage"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <actionGroup ref="AssertProductOnCategoryPageActionGroup" stepKey="assertFirstProductDisplayedOnCatalogSearchPage"> + <argument name="product" value="$createFirstProduct$"/> + </actionGroup> + <actionGroup ref="AssertProductOnCategoryPageActionGroup" stepKey="assertSecondProductDisplayedOnCatalogSearchPage"> + <argument name="product" value="$createSecondProduct$"/> + </actionGroup> + </test> +</tests> diff --git a/app/code/Magento/Elasticsearch6/Test/Mftf/Test/StorefrontProductQuickSearchUsingElasticSearch6WithNotAvailablePageTest.xml b/app/code/Magento/Elasticsearch6/Test/Mftf/Test/StorefrontProductQuickSearchUsingElasticSearch6WithNotAvailablePageTest.xml new file mode 100644 index 0000000000000..b4eb436fc1b2a --- /dev/null +++ b/app/code/Magento/Elasticsearch6/Test/Mftf/Test/StorefrontProductQuickSearchUsingElasticSearch6WithNotAvailablePageTest.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="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="StorefrontProductQuickSearchUsingElasticSearch6WithNotAvailablePageTest" extends="StorefrontProductQuickSearchUsingElasticSearch6Test"> + <annotations> + <features value="CatalogSearch"/> + <stories value="Storefront Search"/> + <title value="Product quick search doesn't throw exception after ES is chosen as search engine with selected page out of range"/> + <description value="Verify no elastic search exception is thrown when try to get page with selected page out of range."/> + <severity value="BLOCKER"/> + <testCaseId value="MC-29383"/> + <useCaseId value="MC-25138"/> + <group value="catalog"/> + <group value="elasticsearch"/> + <group value="SearchEngineElasticsearch"/> + <group value="catalog_search"/> + </annotations> + <remove keyForRemoval="selectDisplayedProductInGridPerPage"/> + <remove keyForRemoval="assertFirstProductDisplayedOnCatalogSearchPage"/> + <remove keyForRemoval="assertSecondProductDisplayedOnCatalogSearchPage"/> + <grabTextFrom selector="{{StorefrontCategoryBottomToolbarSection.currentPage}}" stepKey="grabNumberOfLastPage"/> + <actionGroup ref="StorefrontQuickSearchWithPaginationActionGroup" stepKey="navigateToUnavailableCatalogSearchResultPage"> + <argument name="phrase" value="AAA"/> + <argument name="pageNumber" value="999"/> + </actionGroup> + <scrollTo selector="{{StorefrontCategoryBottomToolbarSection.currentPage}}" stepKey="scrollToBottomToolbarPager"/> + <grabTextFrom selector="{{StorefrontCategoryBottomToolbarSection.currentPage}}" stepKey="grabNumberOfCurrentPage"/> + <assertEquals stepKey="assertCurrentPageIsLastPageOfCatalogSearchResult"> + <expectedResult type="variable">grabNumberOfLastPage</expectedResult> + <actualResult type="variable">grabNumberOfCurrentPage</actualResult> + </assertEquals> + <actionGroup ref="AssertProductOnCategoryPageActionGroup" stepKey="assertProductOnLastCatalogSearchPage"> + <argument name="product" value="$createSecondProduct$"/> + </actionGroup> + <actionGroup ref="StorefrontCheckProductIsMissingInCategoryProductsPageActionGroup" stepKey="assertFirstProductIsMissingOnLastCatalogSearchPage"> + <argument name="productName" value="$createFirstProduct.name$"/> + </actionGroup> + </test> +</tests> From 941e51155dcf135be20d16a8c39138df93e14ee8 Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Wed, 8 Jan 2020 11:28:59 +0200 Subject: [PATCH 0717/1143] Covering the client validation fix by MFTF --- .../AdminCheckUseSystemValueActionGroup.xml | 18 ++++++++ .../AdminToggleEnabledActionGroup.xml | 18 ++++++++ .../AdminUncheckUseSystemValueActionGroup.xml | 18 ++++++++ .../AssertAdminValidationErrorActionGroup.xml | 20 ++++++++ .../Test/Mftf/Section/AdminConfigSection.xml | 1 + ...oGoogleAdwordsConfigurationActionGroup.xml | 15 ++++++ .../Page/AdminGoogleAdwordsConfigPage.xml | 14 ++++++ .../AdminGoogleAdwordsConfigSection.xml | 13 ++++++ .../AdminValidateConversionIdConfigTest.xml | 46 +++++++++++++++++++ 9 files changed, 163 insertions(+) create mode 100644 app/code/Magento/Config/Test/Mftf/ActionGroup/AdminCheckUseSystemValueActionGroup.xml create mode 100644 app/code/Magento/Config/Test/Mftf/ActionGroup/AdminToggleEnabledActionGroup.xml create mode 100644 app/code/Magento/Config/Test/Mftf/ActionGroup/AdminUncheckUseSystemValueActionGroup.xml create mode 100644 app/code/Magento/Config/Test/Mftf/ActionGroup/AssertAdminValidationErrorActionGroup.xml create mode 100644 app/code/Magento/GoogleAdwords/Test/Mftf/ActionGroup/AdminNavigateToGoogleAdwordsConfigurationActionGroup.xml create mode 100644 app/code/Magento/GoogleAdwords/Test/Mftf/Page/AdminGoogleAdwordsConfigPage.xml create mode 100644 app/code/Magento/GoogleAdwords/Test/Mftf/Section/AdminGoogleAdwordsConfigSection.xml create mode 100644 app/code/Magento/GoogleAdwords/Test/Mftf/Test/AdminValidateConversionIdConfigTest.xml diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/AdminCheckUseSystemValueActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/AdminCheckUseSystemValueActionGroup.xml new file mode 100644 index 0000000000000..10c36ced4cee3 --- /dev/null +++ b/app/code/Magento/Config/Test/Mftf/ActionGroup/AdminCheckUseSystemValueActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCheckUseSystemValueActionGroup"> + <arguments> + <argument name="rowId" type="string"/> + </arguments> + + <checkOption selector="{{AdminConfigSection.useSystemValue(rowId)}}" stepKey="checkUseSystemValue"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/AdminToggleEnabledActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/AdminToggleEnabledActionGroup.xml new file mode 100644 index 0000000000000..1fe36cf9ae390 --- /dev/null +++ b/app/code/Magento/Config/Test/Mftf/ActionGroup/AdminToggleEnabledActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminToggleEnabledActionGroup"> + <arguments> + <argument name="element" type="string"/> + <argument name="state" type="string" defaultValue="Yes"/> + </arguments> + <selectOption selector="{{element}}" userInput="{{state}}" stepKey="switchActiveState"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/AdminUncheckUseSystemValueActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/AdminUncheckUseSystemValueActionGroup.xml new file mode 100644 index 0000000000000..25ecd6fe09a27 --- /dev/null +++ b/app/code/Magento/Config/Test/Mftf/ActionGroup/AdminUncheckUseSystemValueActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminUncheckUseSystemValueActionGroup"> + <arguments> + <argument name="rowId" type="string"/> + </arguments> + + <uncheckOption selector="{{AdminConfigSection.useSystemValue(rowId)}}" stepKey="uncheckUseSystemValue"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/AssertAdminValidationErrorActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/AssertAdminValidationErrorActionGroup.xml new file mode 100644 index 0000000000000..768eefd26a4f9 --- /dev/null +++ b/app/code/Magento/Config/Test/Mftf/ActionGroup/AssertAdminValidationErrorActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertAdminValidationErrorActionGroup"> + <arguments> + <argument name="inputId" type="string"/> + <argument name="errorMessage" type="string" defaultValue="This is a required field."/> + </arguments> + + <see selector="{{AdminConfigSection.errorElement(inputId)}}" userInput="{{errorMessage}}" + stepKey="seeElementValidationError"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Config/Test/Mftf/Section/AdminConfigSection.xml b/app/code/Magento/Config/Test/Mftf/Section/AdminConfigSection.xml index a4fb3c7e32975..de01de3c7f4a8 100644 --- a/app/code/Magento/Config/Test/Mftf/Section/AdminConfigSection.xml +++ b/app/code/Magento/Config/Test/Mftf/Section/AdminConfigSection.xml @@ -22,5 +22,6 @@ <element name="useSystemValue" type="checkbox" selector="#{{configRowId}} > .use-default > input" parameterized="true"/> <element name="collapsibleSectionByTitle" type="text" selector="//form[@id='config-edit-form']//div[@class='section-config'][contains(.,'{{sectionTitle}}')]" parameterized="true" /> <element name="expandedSectionByTitle" type="text" selector="//form[@id='config-edit-form']//div[@class='section-config active'][contains(.,'{{sectionTitle}}')]" parameterized="true" /> + <element name="errorElement" type="text" selector="#{{inputId}}-error" parameterized="true" /> </section> </sections> diff --git a/app/code/Magento/GoogleAdwords/Test/Mftf/ActionGroup/AdminNavigateToGoogleAdwordsConfigurationActionGroup.xml b/app/code/Magento/GoogleAdwords/Test/Mftf/ActionGroup/AdminNavigateToGoogleAdwordsConfigurationActionGroup.xml new file mode 100644 index 0000000000000..c581862a3b34c --- /dev/null +++ b/app/code/Magento/GoogleAdwords/Test/Mftf/ActionGroup/AdminNavigateToGoogleAdwordsConfigurationActionGroup.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminNavigateToGoogleAdwordsConfigurationActionGroup"> + <amOnPage url="{{AdminGoogleAdwordsConfigPage.url}}" stepKey="navigateToConfigurationPage"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/GoogleAdwords/Test/Mftf/Page/AdminGoogleAdwordsConfigPage.xml b/app/code/Magento/GoogleAdwords/Test/Mftf/Page/AdminGoogleAdwordsConfigPage.xml new file mode 100644 index 0000000000000..842b867ed9407 --- /dev/null +++ b/app/code/Magento/GoogleAdwords/Test/Mftf/Page/AdminGoogleAdwordsConfigPage.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="urn:magento:mftf:Page/etc/PageObject.xsd"> + <page name="AdminGoogleAdwordsConfigPage" url="admin/system_config/edit/section/google/" area="admin" + module="Magento_Config"> + <section name="AdminGoogleAdwordsConfigSection"/> + </page> +</pages> diff --git a/app/code/Magento/GoogleAdwords/Test/Mftf/Section/AdminGoogleAdwordsConfigSection.xml b/app/code/Magento/GoogleAdwords/Test/Mftf/Section/AdminGoogleAdwordsConfigSection.xml new file mode 100644 index 0000000000000..407cbe1c0db81 --- /dev/null +++ b/app/code/Magento/GoogleAdwords/Test/Mftf/Section/AdminGoogleAdwordsConfigSection.xml @@ -0,0 +1,13 @@ +<?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="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="AdminGoogleAdwordsConfigSection"> + <element name="active" type="text" selector="#google_adwords #google_adwords_active"/> + </section> +</sections> diff --git a/app/code/Magento/GoogleAdwords/Test/Mftf/Test/AdminValidateConversionIdConfigTest.xml b/app/code/Magento/GoogleAdwords/Test/Mftf/Test/AdminValidateConversionIdConfigTest.xml new file mode 100644 index 0000000000000..9ac74cface330 --- /dev/null +++ b/app/code/Magento/GoogleAdwords/Test/Mftf/Test/AdminValidateConversionIdConfigTest.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="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminValidateConversionIdConfigTest"> + <annotations> + <stories value="Admin validates the conversion ID when configuring the Google Adwords"/> + <title value="Admin validates the conversion ID when configuring the Google Adwords"/> + <description value="Testing for a required Conversion ID when configuring the Google Adwords"/> + <severity value="MINOR"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <actionGroup ref="AdminNavigateToGoogleAdwordsConfigurationActionGroup" stepKey="goToConfigPage"/> + <actionGroup ref="AdminExpandConfigSectionActionGroup" stepKey="expandingGoogleAdwordsSection"> + <argument name="sectionName" value="Google AdWords"/> + </actionGroup> + <actionGroup ref="AdminUncheckUseSystemValueActionGroup" stepKey="uncheckUseSystemValue"> + <argument name="rowId" value="row_google_adwords_active"/> + </actionGroup> + <actionGroup ref="AdminToggleEnabledActionGroup" stepKey="enableGoogleAdwordsConfig"> + <argument name="element" value="{{AdminGoogleAdwordsConfigSection.active}}"/> + </actionGroup> + + + + <actionGroup ref="AdminClickFormActionButtonActionGroup" stepKey="clickSaveCustomVariable"> + <argument name="buttonSelector" value="{{AdminMainActionsSection.save}}"/> + </actionGroup> + + + <actionGroup ref="AssertAdminValidationErrorActionGroup" stepKey="seeRequiredValidationErrorForConversionId"> + <argument name="inputId" value="google_adwords_conversion_id"/> + </actionGroup> + </test> +</tests> From 362b4def9a444b9a39d09a3f0bad73ed4800831e Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Wed, 8 Jan 2020 11:51:27 +0200 Subject: [PATCH 0718/1143] Covering the client validation fix by MFTF --- .../Test/Mftf/Section/AdminGoogleAdwordsConfigSection.xml | 3 ++- .../Test/Mftf/Test/AdminValidateConversionIdConfigTest.xml | 5 ----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/GoogleAdwords/Test/Mftf/Section/AdminGoogleAdwordsConfigSection.xml b/app/code/Magento/GoogleAdwords/Test/Mftf/Section/AdminGoogleAdwordsConfigSection.xml index 407cbe1c0db81..d6ee2ced1afe1 100644 --- a/app/code/Magento/GoogleAdwords/Test/Mftf/Section/AdminGoogleAdwordsConfigSection.xml +++ b/app/code/Magento/GoogleAdwords/Test/Mftf/Section/AdminGoogleAdwordsConfigSection.xml @@ -8,6 +8,7 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminGoogleAdwordsConfigSection"> - <element name="active" type="text" selector="#google_adwords #google_adwords_active"/> + <element name="active" type="text" selector="#google_adwords_active"/> + <element name="conversionId" type="text" selector="#google_adwords_conversion_id"/> </section> </sections> diff --git a/app/code/Magento/GoogleAdwords/Test/Mftf/Test/AdminValidateConversionIdConfigTest.xml b/app/code/Magento/GoogleAdwords/Test/Mftf/Test/AdminValidateConversionIdConfigTest.xml index 9ac74cface330..7c0214a8654c8 100644 --- a/app/code/Magento/GoogleAdwords/Test/Mftf/Test/AdminValidateConversionIdConfigTest.xml +++ b/app/code/Magento/GoogleAdwords/Test/Mftf/Test/AdminValidateConversionIdConfigTest.xml @@ -31,14 +31,9 @@ <actionGroup ref="AdminToggleEnabledActionGroup" stepKey="enableGoogleAdwordsConfig"> <argument name="element" value="{{AdminGoogleAdwordsConfigSection.active}}"/> </actionGroup> - - - <actionGroup ref="AdminClickFormActionButtonActionGroup" stepKey="clickSaveCustomVariable"> <argument name="buttonSelector" value="{{AdminMainActionsSection.save}}"/> </actionGroup> - - <actionGroup ref="AssertAdminValidationErrorActionGroup" stepKey="seeRequiredValidationErrorForConversionId"> <argument name="inputId" value="google_adwords_conversion_id"/> </actionGroup> From f37eb0548e1105660c4bf8ef21f13bdc2b4112d8 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Wed, 8 Jan 2020 11:58:44 +0200 Subject: [PATCH 0719/1143] Add more cases to test --- .../Unit/Controller/Category/ViewTest.php | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Controller/Category/ViewTest.php b/app/code/Magento/Catalog/Test/Unit/Controller/Category/ViewTest.php index bdcb5c66657fd..595f81cc4ecd3 100644 --- a/app/code/Magento/Catalog/Test/Unit/Controller/Category/ViewTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Controller/Category/ViewTest.php @@ -205,6 +205,15 @@ public function testApplyCustomLayoutUpdate(array $expectedData): void \Magento\Framework\DataObject::class, ['getPageLayout', 'getLayoutUpdates'] ); + $this->category->expects($this->at(1)) + ->method('hasChildren') + ->willReturn(true); + $this->category->expects($this->at(2)) + ->method('hasChildren') + ->willReturn($expectedData[1][0]['type'] === 'default' ? true : false); + $this->category->expects($this->once()) + ->method('getDisplayMode') + ->willReturn($expectedData[2][0]['displaymode']); $this->expectationForPageLayoutHandles($expectedData); $settings->expects($this->atLeastOnce())->method('getPageLayout')->will($this->returnValue($pageLayout)); $settings->expects($this->once())->method('getLayoutUpdates')->willReturn(['update1', 'update2']); @@ -221,7 +230,8 @@ public function testApplyCustomLayoutUpdate(array $expectedData): void */ private function expectationForPageLayoutHandles($data): void { - $index = 2; + $index = 1; + foreach ($data as $expectedData) { $this->page->expects($this->at($index)) ->method('addPageLayoutHandles') @@ -240,8 +250,23 @@ public function getInvocationData(): array return [ [ 'layoutHandles' => [ + [['type' => 'default'], null, false], + [['type' => 'default_without_children'], null, false], + [['displaymode' => 'products'], null, false] + ] + ], + [ + 'layoutHandles' => [ + [['type' => 'default'], null, false], [['type' => 'default_without_children'], null, false], - [['displaymode' => ''], null, false] + [['displaymode' => 'page'], null, false] + ] + ], + [ + 'layoutHandles' => [ + [['type' => 'default'], null, false], + [['type' => 'default'], null, false], + [['displaymode' => 'poducts_and_page'], null, false] ] ] ]; From f095f730a5296589a8cb42fd19527522f9db5b7a Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <engcom-vendorworker-foxtrot@adobe.com> Date: Wed, 8 Jan 2020 13:03:12 +0200 Subject: [PATCH 0720/1143] magento/magento2#24460: Static test fix. --- app/code/Magento/Catalog/Model/Product.php | 4 ++++ .../Magento/Framework/Model/AbstractExtensibleModel.php | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product.php b/app/code/Magento/Catalog/Model/Product.php index 97b48b1952fcd..12444c9cce202 100644 --- a/app/code/Magento/Catalog/Model/Product.php +++ b/app/code/Magento/Catalog/Model/Product.php @@ -2160,6 +2160,7 @@ public function reset() */ public function getCacheIdTags() { + // phpstan:ignore $tags = parent::getCacheIdTags(); $affectedCategoryIds = $this->getAffectedCategoryIds(); if (!$affectedCategoryIds) { @@ -2340,6 +2341,7 @@ public function isDisabled() public function getImage() { $this->getTypeInstance()->setImageFromChildProduct($this); + // phpstan:ignore return parent::getImage(); } @@ -2403,6 +2405,7 @@ public function reloadPriceInfo() } } + // phpcs:disable PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames /** * Return Data Object data in array format. * @@ -2411,6 +2414,7 @@ public function reloadPriceInfo() */ public function __toArray() { + // phpcs:enable PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames $data = $this->_data; $hasToArray = function ($model) { return is_object($model) && method_exists($model, '__toArray') && is_callable([$model, '__toArray']); diff --git a/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php b/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php index b88954bd21ce8..c1f44da5b2f19 100644 --- a/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php +++ b/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php @@ -127,8 +127,6 @@ protected function filterCustomAttributes($data) /** * Initialize customAttributes based on existing data - * - * @return $this */ protected function initializeCustomAttributes() { From c721ae4d574002a30cf8d98ff2c2ebfd59d7e91f Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Wed, 8 Jan 2020 13:57:11 +0200 Subject: [PATCH 0721/1143] cover changes with unit test --- .../Import/Product/Type/ConfigurableTest.php | 194 ++++++++++-------- 1 file changed, 111 insertions(+), 83 deletions(-) diff --git a/app/code/Magento/ConfigurableImportExport/Test/Unit/Model/Import/Product/Type/ConfigurableTest.php b/app/code/Magento/ConfigurableImportExport/Test/Unit/Model/Import/Product/Type/ConfigurableTest.php index 8d75fd902e911..a66229ab13131 100644 --- a/app/code/Magento/ConfigurableImportExport/Test/Unit/Model/Import/Product/Type/ConfigurableTest.php +++ b/app/code/Magento/ConfigurableImportExport/Test/Unit/Model/Import/Product/Type/ConfigurableTest.php @@ -9,8 +9,8 @@ use Magento\ConfigurableImportExport; /** - * Class ConfigurableTest - * @package Magento\ConfigurableImportExport\Test\Unit\Model\Import\Product\Type + * Configurable import export tests + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class ConfigurableTest extends \Magento\ImportExport\Test\Unit\Model\Import\AbstractImportTestCase @@ -78,6 +78,8 @@ class ConfigurableTest extends \Magento\ImportExport\Test\Unit\Model\Import\Abst protected $productEntityLinkField = 'entity_id'; /** + * @inheritdoc + * * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ protected function setUp() @@ -270,10 +272,12 @@ protected function setUp() } /** + * Bunches data provider + * * @return array * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - protected function _getBunch() + protected function _getBunch(): array { return [[ 'sku' => 'configurableskuI22', @@ -393,9 +397,11 @@ protected function _getBunch() } /** + * Super attributes data provider + * * @return array */ - protected function _getSuperAttributes() + protected function _getSuperAttributes(): array { return [ 'testattr2' => [ @@ -445,31 +451,23 @@ protected function _getSuperAttributes() } /** + * Verify save mtethod + * * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function testSaveData() { $newSkus = array_change_key_case([ - 'configurableskuI22' => - [$this->productEntityLinkField => 1, 'type_id' => 'configurable', 'attr_set_code' => 'Default'], - 'testconf2-attr2val1-testattr3v1' => - [$this->productEntityLinkField => 2, 'type_id' => 'simple', 'attr_set_code' => 'Default'], - 'testconf2-attr2val1-testattr30v1' => - [$this->productEntityLinkField => 20, 'type_id' => 'simple', 'attr_set_code' => 'Default'], - 'testconf2-attr2val1-testattr3v2' => - [$this->productEntityLinkField => 3, 'type_id' => 'simple', 'attr_set_code' => 'Default'], - 'testSimple' => - [$this->productEntityLinkField => 4, 'type_id' => 'simple', 'attr_set_code' => 'Default'], - 'testSimpleToSkip' => - [$this->productEntityLinkField => 5, 'type_id' => 'simple', 'attr_set_code' => 'Default'], - 'configurableskuI22withoutLabels' => - [$this->productEntityLinkField => 6, 'type_id' => 'configurable', 'attr_set_code' => 'Default'], - 'configurableskuI22withoutVariations' => - [$this->productEntityLinkField => 7, 'type_id' => 'configurable', 'attr_set_code' => 'Default'], - 'configurableskuI22Duplicated' => - [$this->productEntityLinkField => 8, 'type_id' => 'configurable', 'attr_set_code' => 'Default'], - 'configurableskuI22BadPrice' => - [$this->productEntityLinkField => 9, 'type_id' => 'configurable', 'attr_set_code' => 'Default'], + 'configurableskuI22' => [$this->productEntityLinkField => 1, 'type_id' => 'configurable', 'attr_set_code' => 'Default'], + 'testconf2-attr2val1-testattr3v1' => [$this->productEntityLinkField => 2, 'type_id' => 'simple', 'attr_set_code' => 'Default'], + 'testconf2-attr2val1-testattr30v1' => [$this->productEntityLinkField => 20, 'type_id' => 'simple', 'attr_set_code' => 'Default'], + 'testconf2-attr2val1-testattr3v2' => [$this->productEntityLinkField => 3, 'type_id' => 'simple', 'attr_set_code' => 'Default'], + 'testSimple' => [$this->productEntityLinkField => 4, 'type_id' => 'simple', 'attr_set_code' => 'Default'], + 'testSimpleToSkip' => [$this->productEntityLinkField => 5, 'type_id' => 'simple', 'attr_set_code' => 'Default'], + 'configurableskuI22withoutLabels' => [$this->productEntityLinkField => 6, 'type_id' => 'configurable', 'attr_set_code' => 'Default'], + 'configurableskuI22withoutVariations' => [$this->productEntityLinkField => 7, 'type_id' => 'configurable', 'attr_set_code' => 'Default'], + 'configurableskuI22Duplicated' => [$this->productEntityLinkField => 8, 'type_id' => 'configurable', 'attr_set_code' => 'Default'], + 'configurableskuI22BadPrice' => [$this->productEntityLinkField => 9, 'type_id' => 'configurable', 'attr_set_code' => 'Default'], ]); $this->_entityModel->expects($this->any()) ->method('getNewSku') @@ -527,6 +525,8 @@ public function testSaveData() } /** + * Callback for is row allowed to import + * * @param $rowData * @param $rowNum * @return bool @@ -540,72 +540,28 @@ public function isRowAllowedToImport($rowData, $rowNum) return true; } - public function testIsRowValid() + /** + * Verify is row valid method + * + * @dataProvider getProductDataIsValidRow + * @param array $productData + * @return void + */ + public function testIsRowValid(array $productData): void { $bunch = $this->_getBunch(); - $badProduct = [ - 'sku' => 'configurableskuI22BadPrice', - 'store_view_code' => null, - 'attribute_set_code' => 'Default', - 'product_type' => 'configurable', - 'name' => 'Configurable Product 21 BadPrice', - 'product_websites' => 'website_1', - 'configurable_variation_labels' => 'testattr2=Select Color, testattr3=Select Size', - 'configurable_variations' => 'sku=testconf2-attr2val1-testattr3v1,' - . 'testattr2=attr2val1_DOESNT_EXIST,' - . 'testattr3=testattr3v1,' - . 'display=1|sku=testconf2-attr2val1-testattr3v2,' - . 'testattr2=attr2val1,' - . 'testattr3=testattr3v2,' - . 'display=0', - '_store' => null, - '_attribute_set' => 'Default', - '_type' => 'configurable', - '_product_websites' => 'website_1', - ]; // Checking that variations' field names are case-insensitive with this // product. $caseInsensitiveSKU = 'configurableskuI22CaseInsensitive'; - $caseInsensitiveProduct = [ - 'sku' => $caseInsensitiveSKU, - 'store_view_code' => null, - 'attribute_set_code' => 'Default', - 'product_type' => 'configurable', - 'name' => 'Configurable Product 21', - 'product_websites' => 'website_1', - 'configurable_variation_labels' => 'testattr2=Select Color, testattr3=Select Size', - 'configurable_variations' => 'SKU=testconf2-attr2val1-testattr3v1,' - . 'testattr2=attr2val1,' - . 'testattr3=testattr3v1,' - . 'display=1|sku=testconf2-attr2val1-testattr3v2,' - . 'testattr2=attr2val1,' - . 'testattr3=testattr3v2,' - . 'display=0', - '_store' => null, - '_attribute_set' => 'Default', - '_type' => 'configurable', - '_product_websites' => 'website_1', - ]; - $bunch[] = $badProduct; - $bunch[] = $caseInsensitiveProduct; + $productData['caseInsencitiveProduct']['sku'] = $caseInsensitiveSKU; + $bunch[] = $productData['bad_product']; + $bunch[] = $productData['caseInsencitiveProduct']; // Set _attributes to avoid error in Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType. $this->setPropertyValue($this->configurable, '_attributes', [ - $badProduct[\Magento\CatalogImportExport\Model\Import\Product::COL_ATTR_SET] => [], + $productData['bad_product'][\Magento\CatalogImportExport\Model\Import\Product::COL_ATTR_SET] => [], ]); // Avoiding errors about attributes not being super - $this->setPropertyValue( - $this->configurable, - '_superAttributes', - [ - 'testattr2' => ['options' => ['attr2val1' => 1]], - 'testattr3' => [ - 'options' => [ - 'testattr3v2' => 1, - 'testattr3v1' => 1, - ], - ], - ] - ); + $this->setPropertyValue($this->configurable,'_superAttributes', $productData['super_attributes']); foreach ($bunch as $rowData) { $result = $this->configurable->isRowValid($rowData, 0, !isset($this->_oldSku[$rowData['sku']])); @@ -616,7 +572,77 @@ public function testIsRowValid() } } - public function testRowValidationForNumericalSkus() + /** + * Data provider for isValidRows test. + * + * @return array + */ + public function getProductDataIsValidRow(): array + { + return [ + [ + [ + 'bad_product' => [ + 'sku' => 'configurableskuI22BadPrice', + 'store_view_code' => null, + 'attribute_set_code' => 'Default', + 'product_type' => 'configurable', + 'name' => 'Configurable Product 21 BadPrice', + 'product_websites' => 'website_1', + 'configurable_variation_labels' => 'testattr2=Select Color, testattr3=Select Size', + 'configurable_variations' => 'sku=testconf2-attr2val1-testattr3v1,' + . 'testattr2=attr2val1_DOESNT_EXIST,' + . 'testattr3=testattr3v1,' + . 'display=1|sku=testconf2-attr2val1-testattr3v2,' + . 'testattr2=attr2val1,' + . 'testattr3=testattr3v2,' + . 'display=0', + '_store' => null, + '_attribute_set' => 'Default', + '_type' => 'configurable', + '_product_websites' => 'website_1', + ], + 'caseInsencitiveProduct' => [ + 'sku' => '', + 'store_view_code' => null, + 'attribute_set_code' => 'Default', + 'product_type' => 'configurable', + 'name' => 'Configurable Product 21', + 'product_websites' => 'website_1', + 'configurable_variation_labels' => 'testattr2=Select Color, testattr3=Select Size', + 'configurable_variations' => 'SKU=testconf2-attr2val1-testattr3v1,' + . 'testattr2=attr2val1,' + . 'testattr3=testattr3v1=sx=sl,' + . 'display=1|sku=testconf2-attr2val1-testattr3v2,' + . 'testattr2=attr2val1,' + . 'testattr3=testattr3v2,' + . 'display=0', + '_store' => null, + '_attribute_set' => 'Default', + '_type' => 'configurable', + '_product_websites' => 'website_1', + ], + 'super_attributes' => + [ + 'testattr2' => ['options' => ['attr2val1' => 1]], + 'testattr3' => [ + 'options' => [ + 'testattr3v2' => 1, + 'testattr3v1=sx=sl' => 1, + ], + ], + ] + ] + ] + ]; + } + + /** + * Verify row validation with numeric skus + * + * @return void + */ + public function testRowValidationForNumericalSkus(): void { // Set _attributes to avoid error in Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType. $this->setPropertyValue($this->configurable, '_attributes', [ @@ -649,9 +675,11 @@ public function testRowValidationForNumericalSkus() } /** + * Row validation Data Provider + * * @return array */ - public function rowValidationDataProvider() + public function rowValidationDataProvider(): array { return [ 'duplicateProduct' => [ From 2dc4f1e9adc7f6f943680ce8eba1d2f243263dba Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Wed, 8 Jan 2020 14:04:50 +0200 Subject: [PATCH 0722/1143] static test fix --- .../Import/Product/Type/ConfigurableTest.php | 41 ++++++++++++------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/app/code/Magento/ConfigurableImportExport/Test/Unit/Model/Import/Product/Type/ConfigurableTest.php b/app/code/Magento/ConfigurableImportExport/Test/Unit/Model/Import/Product/Type/ConfigurableTest.php index a66229ab13131..826eee580e402 100644 --- a/app/code/Magento/ConfigurableImportExport/Test/Unit/Model/Import/Product/Type/ConfigurableTest.php +++ b/app/code/Magento/ConfigurableImportExport/Test/Unit/Model/Import/Product/Type/ConfigurableTest.php @@ -458,20 +458,30 @@ protected function _getSuperAttributes(): array public function testSaveData() { $newSkus = array_change_key_case([ - 'configurableskuI22' => [$this->productEntityLinkField => 1, 'type_id' => 'configurable', 'attr_set_code' => 'Default'], - 'testconf2-attr2val1-testattr3v1' => [$this->productEntityLinkField => 2, 'type_id' => 'simple', 'attr_set_code' => 'Default'], - 'testconf2-attr2val1-testattr30v1' => [$this->productEntityLinkField => 20, 'type_id' => 'simple', 'attr_set_code' => 'Default'], - 'testconf2-attr2val1-testattr3v2' => [$this->productEntityLinkField => 3, 'type_id' => 'simple', 'attr_set_code' => 'Default'], - 'testSimple' => [$this->productEntityLinkField => 4, 'type_id' => 'simple', 'attr_set_code' => 'Default'], - 'testSimpleToSkip' => [$this->productEntityLinkField => 5, 'type_id' => 'simple', 'attr_set_code' => 'Default'], - 'configurableskuI22withoutLabels' => [$this->productEntityLinkField => 6, 'type_id' => 'configurable', 'attr_set_code' => 'Default'], - 'configurableskuI22withoutVariations' => [$this->productEntityLinkField => 7, 'type_id' => 'configurable', 'attr_set_code' => 'Default'], - 'configurableskuI22Duplicated' => [$this->productEntityLinkField => 8, 'type_id' => 'configurable', 'attr_set_code' => 'Default'], - 'configurableskuI22BadPrice' => [$this->productEntityLinkField => 9, 'type_id' => 'configurable', 'attr_set_code' => 'Default'], + 'configurableskuI22' => + [$this->productEntityLinkField => 1, 'type_id' => 'configurable', 'attr_set_code' => 'Default'], + 'testconf2-attr2val1-testattr3v1' => + [$this->productEntityLinkField => 2, 'type_id' => 'simple', 'attr_set_code' => 'Default'], + 'testconf2-attr2val1-testattr30v1' => + [$this->productEntityLinkField => 20, 'type_id' => 'simple', 'attr_set_code' => 'Default'], + 'testconf2-attr2val1-testattr3v2' => + [$this->productEntityLinkField => 3, 'type_id' => 'simple', 'attr_set_code' => 'Default'], + 'testSimple' => + [$this->productEntityLinkField => 4, 'type_id' => 'simple', 'attr_set_code' => 'Default'], + 'testSimpleToSkip' => + [$this->productEntityLinkField => 5, 'type_id' => 'simple', 'attr_set_code' => 'Default'], + 'configurableskuI22withoutLabels' => + [$this->productEntityLinkField => 6, 'type_id' => 'configurable', 'attr_set_code' => 'Default'], + 'configurableskuI22withoutVariations' => + [$this->productEntityLinkField => 7, 'type_id' => 'configurable', 'attr_set_code' => 'Default'], + 'configurableskuI22Duplicated' => + [$this->productEntityLinkField => 8, 'type_id' => 'configurable', 'attr_set_code' => 'Default'], + 'configurableskuI22BadPrice' => + [$this->productEntityLinkField => 9, 'type_id' => 'configurable', 'attr_set_code' => 'Default'], ]); $this->_entityModel->expects($this->any()) - ->method('getNewSku') - ->will($this->returnValue($newSkus)); + ->method('getNewSku') + ->will($this->returnValue($newSkus)); // at(0) is select() call, quoteIdentifier() is invoked at(1) and at(2) $this->_connection->expects($this->at(1))->method('quoteIdentifier')->with('m.attribute_id')->willReturn('a'); @@ -561,7 +571,7 @@ public function testIsRowValid(array $productData): void $productData['bad_product'][\Magento\CatalogImportExport\Model\Import\Product::COL_ATTR_SET] => [], ]); // Avoiding errors about attributes not being super - $this->setPropertyValue($this->configurable,'_superAttributes', $productData['super_attributes']); + $this->setPropertyValue($this->configurable, '_superAttributes', $productData['super_attributes']); foreach ($bunch as $rowData) { $result = $this->configurable->isRowValid($rowData, 0, !isset($this->_oldSku[$rowData['sku']])); @@ -573,6 +583,7 @@ public function testIsRowValid(array $productData): void } /** + * * Data provider for isValidRows test. * * @return array @@ -621,8 +632,8 @@ public function getProductDataIsValidRow(): array '_attribute_set' => 'Default', '_type' => 'configurable', '_product_websites' => 'website_1', - ], - 'super_attributes' => + ], + 'super_attributes' => [ 'testattr2' => ['options' => ['attr2val1' => 1]], 'testattr3' => [ From 68170c1a4a7b8b849e3a19d40ffe37ae3ae06292 Mon Sep 17 00:00:00 2001 From: OlgaVasyltsun <olga.vasyltsun@gmail.com> Date: Wed, 8 Jan 2020 14:10:37 +0200 Subject: [PATCH 0723/1143] MC-23870: Error messages on Checkout when 'Syncronize with Backend' option is turned ON --- .../ProductFrontendAction/Synchronizer.php | 31 +++-- .../Catalog/view/frontend/layout/default.xml | 3 + .../SynchronizerTest.php | 106 ++++++++++++++++++ 3 files changed, 129 insertions(+), 11 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Model/Product/ProductFrontendAction/SynchronizerTest.php diff --git a/app/code/Magento/Catalog/Model/Product/ProductFrontendAction/Synchronizer.php b/app/code/Magento/Catalog/Model/Product/ProductFrontendAction/Synchronizer.php index 24775a791e59f..ec2e697ccc849 100644 --- a/app/code/Magento/Catalog/Model/Product/ProductFrontendAction/Synchronizer.php +++ b/app/code/Magento/Catalog/Model/Product/ProductFrontendAction/Synchronizer.php @@ -125,9 +125,16 @@ private function filterNewestActions(array $productsData, $typeId) $lifetime = $this->getLifeTimeByNamespace($typeId); $actionsNumber = $lifetime * self::TIME_TO_DO_ONE_ACTION; - uasort($productsData, function (array $firstProduct, array $secondProduct) { - return $firstProduct['added_at'] > $secondProduct['added_at']; - }); + uasort( + $productsData, + function (array $firstProduct, array $secondProduct) { + if (isset($firstProduct['added_at'], $secondProduct['added_at'])) { + return $firstProduct['added_at'] > $secondProduct['added_at']; + } + + return false; + } + ); return array_slice($productsData, 0, $actionsNumber, true); } @@ -185,15 +192,17 @@ public function syncActions(array $productsData, $typeId) foreach ($productsData as $productId => $productData) { /** @var ProductFrontendActionInterface $action */ - $action = $this->productFrontendActionFactory->create([ - 'data' => [ - 'visitor_id' => $customerId ? null : $visitorId, - 'customer_id' => $this->session->getCustomerId(), - 'added_at' => $productData['added_at'], - 'product_id' => $productId, - 'type_id' => $typeId + $action = $this->productFrontendActionFactory->create( + [ + 'data' => [ + 'visitor_id' => $customerId ? null : $visitorId, + 'customer_id' => $this->session->getCustomerId(), + 'added_at' => $productData['added_at'], + 'product_id' => $productId, + 'type_id' => $typeId + ] ] - ]); + ); $this->entityManager->save($action); } diff --git a/app/code/Magento/Catalog/view/frontend/layout/default.xml b/app/code/Magento/Catalog/view/frontend/layout/default.xml index 3dff3e9b3c1f8..8f414724f51db 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/default.xml +++ b/app/code/Magento/Catalog/view/frontend/layout/default.xml @@ -26,6 +26,9 @@ <item name="updateRequestConfig" xsi:type="array"> <item name="url" xsi:type="serviceUrl" path="/products-render-info"/> </item> + <item name="requestConfig" xsi:type="array"> + <item name="syncUrl" xsi:type="url" path="catalog/product/frontend_action_synchronize"/> + </item> </item> </argument> </arguments> diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/ProductFrontendAction/SynchronizerTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/ProductFrontendAction/SynchronizerTest.php new file mode 100644 index 0000000000000..3ea30005e9f6c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/ProductFrontendAction/SynchronizerTest.php @@ -0,0 +1,106 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Model\Product\ProductFrontendAction; + +use Magento\Catalog\Model\ProductRepository; + +/** + * Test for \Magento\Catalog\Model\Product\ProductFrontendAction\Synchronizer. + */ +class SynchronizerTest extends \PHPUnit\Framework\TestCase +{ + /** + * @var Synchronizer + */ + private $synchronizer; + + /** + * @var ProductRepository + */ + private $productRepository; + + /** + * @inheritDoc + */ + protected function setUp() + { + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + + $this->synchronizer = $objectManager->get(Synchronizer::class); + $this->productRepository = $objectManager->get(ProductRepository::class); + } + + /** + * @magentoDataFixture Magento/Catalog/_files/product_simple.php + * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + * + * @return void + */ + public function testSyncActions(): void + { + $actionsType = 'recently_viewed_product'; + $product1 = $this->productRepository->get('simple'); + $product2 = $this->productRepository->get('simple2'); + $product1Id = $product1->getId(); + $product2Id = $product2->getId(); + $productsData = [ + $product1Id => [ + 'added_at' => '1576582660', + 'product_id' => $product1Id, + ], + $product2Id => [ + 'added_at' => '1576587153', + 'product_id' => $product2Id, + ], + ]; + + $this->synchronizer->syncActions($productsData, $actionsType); + + $synchronizedCollection = $this->synchronizer->getActionsByType($actionsType); + $synchronizedCollection->addFieldToFilter( + 'product_id', + [ + $product1Id, + $product2Id, + ] + ); + + foreach ($synchronizedCollection as $item) { + $this->assertArrayHasKey($item->getProductId(), $productsData); + $this->assertEquals($productsData[$item->getProductId()]['added_at'], $item->getAddedAt()); + } + } + + /** + * @magentoDataFixture Magento/Catalog/_files/product_simple.php + * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + * + * @return void + */ + public function testSyncActionsWithoutActionsType(): void + { + $product1 = $this->productRepository->get('simple'); + $product2 = $this->productRepository->get('simple2'); + $product1Id = $product1->getId(); + $product2Id = $product2->getId(); + $productsData = [ + $product1Id => [ + 'id' => $product1Id, + 'name' => $product1->getName(), + 'type' => $product1->getTypeId(), + ], + $product2Id => [ + 'id' => $product2Id, + 'name' => $product2->getName(), + 'type' => $product2->getTypeId(), + ], + ]; + + $this->synchronizer->syncActions($productsData, ''); + } +} From 2dd6b141ae43a6b9ce924909cddf535a0225c949 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Wed, 8 Jan 2020 14:33:06 +0200 Subject: [PATCH 0724/1143] fix phpStan --- .../Unit/Model/Import/Product/Type/ConfigurableTest.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/ConfigurableImportExport/Test/Unit/Model/Import/Product/Type/ConfigurableTest.php b/app/code/Magento/ConfigurableImportExport/Test/Unit/Model/Import/Product/Type/ConfigurableTest.php index 826eee580e402..85b8dc5ec1d04 100644 --- a/app/code/Magento/ConfigurableImportExport/Test/Unit/Model/Import/Product/Type/ConfigurableTest.php +++ b/app/code/Magento/ConfigurableImportExport/Test/Unit/Model/Import/Product/Type/ConfigurableTest.php @@ -410,7 +410,6 @@ protected function _getSuperAttributes(): array 'attribute_code' => 'testattr2', 'is_global' => '1', 'is_visible' => '1', - 'is_static' => '0', 'is_required' => '0', 'is_unique' => '0', 'frontend_label' => 'testattr2', @@ -432,7 +431,6 @@ protected function _getSuperAttributes(): array 'attribute_code' => 'testattr3', 'is_global' => '1', 'is_visible' => '1', - 'is_static' => '0', 'is_required' => '0', 'is_unique' => '0', 'frontend_label' => 'testattr3', @@ -480,8 +478,8 @@ public function testSaveData() [$this->productEntityLinkField => 9, 'type_id' => 'configurable', 'attr_set_code' => 'Default'], ]); $this->_entityModel->expects($this->any()) - ->method('getNewSku') - ->will($this->returnValue($newSkus)); + ->method('getNewSku') + ->will($this->returnValue($newSkus)); // at(0) is select() call, quoteIdentifier() is invoked at(1) and at(2) $this->_connection->expects($this->at(1))->method('quoteIdentifier')->with('m.attribute_id')->willReturn('a'); @@ -574,7 +572,7 @@ public function testIsRowValid(array $productData): void $this->setPropertyValue($this->configurable, '_superAttributes', $productData['super_attributes']); foreach ($bunch as $rowData) { - $result = $this->configurable->isRowValid($rowData, 0, !isset($this->_oldSku[$rowData['sku']])); + $result = $this->configurable->isRowValid($rowData, 0, false); $this->assertNotNull($result); if ($rowData['sku'] === $caseInsensitiveSKU) { $this->assertTrue($result); From f7d8602ff1c960298c6b1c5888ca307a34fc7267 Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Wed, 8 Jan 2020 14:50:57 +0200 Subject: [PATCH 0725/1143] Fixing the redirect after saving the currency symbols --- .../Controller/Adminhtml/System/Currencysymbol/Save.php | 2 +- .../Controller/Adminhtml/System/Currencysymbol/SaveTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currencysymbol/Save.php b/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currencysymbol/Save.php index 07c7c553ac792..f4d69096475d5 100644 --- a/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currencysymbol/Save.php +++ b/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currencysymbol/Save.php @@ -67,6 +67,6 @@ public function execute() $this->messageManager->addErrorMessage($e->getMessage()); } - return $resultRedirect->setPath('*'); + return $resultRedirect->setPath('adminhtml/*/'); } } diff --git a/app/code/Magento/CurrencySymbol/Test/Unit/Controller/Adminhtml/System/Currencysymbol/SaveTest.php b/app/code/Magento/CurrencySymbol/Test/Unit/Controller/Adminhtml/System/Currencysymbol/SaveTest.php index b3c69c352ac7d..e4dfc7a3dc765 100644 --- a/app/code/Magento/CurrencySymbol/Test/Unit/Controller/Adminhtml/System/Currencysymbol/SaveTest.php +++ b/app/code/Magento/CurrencySymbol/Test/Unit/Controller/Adminhtml/System/Currencysymbol/SaveTest.php @@ -132,7 +132,7 @@ public function testExecute() ->with(__('You applied the custom currency symbols.')); $redirect = $this->createMock(Redirect::class); - $redirect->expects($this->once())->method('setPath')->with('*')->willReturnSelf(); + $redirect->expects($this->once())->method('setPath')->with('adminhtml/*/')->willReturnSelf(); $this->resultRedirectFactory->method('create')->willReturn($redirect); $this->assertEquals($redirect, $this->action->execute()); From 897bb9f0d51683c35de2403647149b08b10fd7a8 Mon Sep 17 00:00:00 2001 From: Lyzun Oleksandr <alex.nuzil@gmail.com> Date: Wed, 8 Jan 2020 17:25:31 +0100 Subject: [PATCH 0726/1143] Add Ramsey dependency --- lib/internal/Magento/Framework/composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/composer.json b/lib/internal/Magento/Framework/composer.json index dfbfb5a25debe..3b365232bfc63 100644 --- a/lib/internal/Magento/Framework/composer.json +++ b/lib/internal/Magento/Framework/composer.json @@ -39,7 +39,8 @@ "zendframework/zend-validator": "^2.6.0", "zendframework/zend-mail": "^2.9.0", "zendframework/zend-mime": "^2.5.0", - "guzzlehttp/guzzle": "^6.3.3" + "guzzlehttp/guzzle": "^6.3.3", + "ramsey/uuid": "~3.8.0" }, "archive": { "exclude": [ From 0b7a99d7a330216a829056af1b7eb876c14657db Mon Sep 17 00:00:00 2001 From: "a.chorniy" <a.chorniy@atwix.com> Date: Wed, 8 Jan 2020 18:39:16 +0200 Subject: [PATCH 0727/1143] Issue-25968 - Added additional checking for returning needed variable type --- app/code/Magento/Sales/Model/Order/Item.php | 8 +++++++- .../Sales/Test/Unit/Model/Order/ItemTest.php | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Model/Order/Item.php b/app/code/Magento/Sales/Model/Order/Item.php index a0eff45179ac8..f9e585098aef4 100644 --- a/app/code/Magento/Sales/Model/Order/Item.php +++ b/app/code/Magento/Sales/Model/Order/Item.php @@ -1319,7 +1319,13 @@ public function getParentItemId() */ public function getPrice() { - return $this->getData(OrderItemInterface::PRICE); + $price = $this->getData(OrderItemInterface::PRICE); + + if ($price === null) { + return $price; + } + + return (float) $price; } /** diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/ItemTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/ItemTest.php index 76bfd62a7b889..e74af4739d8c9 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/ItemTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/ItemTest.php @@ -348,4 +348,22 @@ public function getItemQtyVariants() ] ]; } + + /** + * Test getPrice() method + */ + public function testGetPrice() + { + $price = 9.99; + $this->model->setPrice($price); + $this->assertEquals($price, $this->model->getPrice()); + + $newPrice = 5.53; + $this->model->setData(\Magento\Sales\Api\Data\OrderItemInterface::PRICE, $newPrice); + $this->assertEquals($newPrice, $this->model->getPrice()); + + $nullablePrice = null; + $this->model->setPrice($nullablePrice); + $this->assertEquals($nullablePrice, $this->model->getPrice()); + } } From 316d0e746c2790ff3ee9740eff2213ce113150fe Mon Sep 17 00:00:00 2001 From: Anusha Vattam <avattam@adobe.com> Date: Wed, 8 Jan 2020 10:48:22 -0600 Subject: [PATCH 0728/1143] MC:20074: Fix Skipped MFTF Tests From MC-17140: MC-14104, MC-14502, MC-14532 - Added the changes to the JS test --- .../Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml index 2057aeae3e18f..046bd59025e61 100644 --- a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml +++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml @@ -21,7 +21,10 @@ </annotations> <before> <magentoCLI command="config:set {{MinifyJavaScriptFilesEnableConfigData.path}} {{MinifyJavaScriptFilesEnableConfigData.value}}" stepKey="enableJsMinification"/> - <actionGroup ref="LoginActionGroup" stepKey="loginAsAdmin"/> + <amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}" stepKey="navigateToAdminPage"/> + <fillField userInput="{{_ENV.MAGENTO_ADMIN_USERNAME}}" selector="{{AdminLoginFormSection.username}}" stepKey="fillUsernameOnLoginPage"/> + <fillField userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}" selector="{{AdminLoginFormSection.password}}" stepKey="fillPasswordOnPage"/> + <click selector="{{AdminLoginFormSection.signIn}}" stepKey="clickAdminLogin"/> <see userInput="Dashboard" selector="{{AdminHeaderSection.pageTitle}}" stepKey="seeDashboardTitle"/> </before> <after> From 3237e1840ed653333517922eade603b75efc53c1 Mon Sep 17 00:00:00 2001 From: Soumya Unnikrishnan <sunnikri@adobe.com> Date: Wed, 8 Jan 2020 13:38:42 -0600 Subject: [PATCH 0729/1143] MQE-1949: [MTF-to-MFTF] Delete Product URL Rewrite #757 Added test case ids and updated action group names. --- .../AddStoreViewToCmsPageActionGroup.xml | 2 +- .../AdminFillCMSPageContentFieldActionGroup.xml | 2 +- .../AdminOpenCreateNewCMSPageActionGroup.xml | 2 +- .../AdminSelectCMSPageFromGridActionGroup.xml | 2 +- ...ssertCMSPageNotFoundOnStorefrontActionGroup.xml | 2 +- .../Cms/Test/Mftf/Section/CmsNewPagePiwSection.xml | 2 +- .../Test/AdminCMSPageCreateDisabledPageTest.xml | 8 +++++--- .../AdminCMSPageCreatePageForDefaultStoreTest.xml | 12 +++++++----- ...AdminCMSPageCreatePageInSingleStoreModeTest.xml | 14 ++++++++------ .../Test/Mftf/Test/AdminCMSPageCreatePageTest.xml | 12 +++++++----- .../Test/AdminCMSPageCreatePageWithBlockTest.xml | 10 ++++++---- ...eateIntegrationEntityWithDuplicatedNameTest.xml | 2 ++ .../AdminDeleteProductURLRewriteEntityTest.xml | 3 +++ 13 files changed, 44 insertions(+), 29 deletions(-) diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AddStoreViewToCmsPageActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AddStoreViewToCmsPageActionGroup.xml index 505f3bebbf70c..fabf6480b174b 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AddStoreViewToCmsPageActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AddStoreViewToCmsPageActionGroup.xml @@ -10,7 +10,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="AddStoreViewToCmsPageActionGroup" extends="NavigateToCreatedCMSPageActionGroup"> <annotations> - <description>EXTENDS: navigateToCreatedCMSPage. Adds the provided Store View to a Page.</description> + <description>EXTENDS: NavigateToCreatedCMSPageActionGroup. Adds the provided Store View to a Page.</description> </annotations> <arguments> <argument name="storeViewName" type="string"/> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminFillCMSPageContentFieldActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminFillCMSPageContentFieldActionGroup.xml index 9bd440695ecf2..f62ee4a8a4ccd 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminFillCMSPageContentFieldActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminFillCMSPageContentFieldActionGroup.xml @@ -13,4 +13,4 @@ </arguments> <fillField selector="{{CmsNewPagePageContentSection.content}}" userInput="{{content}}" stepKey="fillFieldContent"/> </actionGroup> -</actionGroups> \ No newline at end of file +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminOpenCreateNewCMSPageActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminOpenCreateNewCMSPageActionGroup.xml index c9f97855be79d..79ce1bc9d8e47 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminOpenCreateNewCMSPageActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminOpenCreateNewCMSPageActionGroup.xml @@ -11,4 +11,4 @@ <amOnPage url="{{CmsNewPagePage.url}}" stepKey="navigateToCreateNewPage"/> <waitForPageLoad stepKey="waitForNewPagePageLoad"/> </actionGroup> -</actionGroups> \ No newline at end of file +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminSelectCMSPageFromGridActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminSelectCMSPageFromGridActionGroup.xml index 6a08b8fa89eef..bd721b4d7d40c 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminSelectCMSPageFromGridActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminSelectCMSPageFromGridActionGroup.xml @@ -13,4 +13,4 @@ </arguments> <click selector="{{CmsPagesPageActionsSection.select(identifier)}}" stepKey="clickSelectCMSPage" /> </actionGroup> -</actionGroups> \ No newline at end of file +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageNotFoundOnStorefrontActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageNotFoundOnStorefrontActionGroup.xml index bcffadc7c2b05..ff5724a55dec9 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageNotFoundOnStorefrontActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertCMSPageNotFoundOnStorefrontActionGroup.xml @@ -15,4 +15,4 @@ <see userInput="Whoops, our bad..." stepKey="seePageErrorNotFound"/> </actionGroup> -</actionGroups> \ No newline at end of file +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/Section/CmsNewPagePiwSection.xml b/app/code/Magento/Cms/Test/Mftf/Section/CmsNewPagePiwSection.xml index cccdbaddfb4d2..7bb6e606d7943 100644 --- a/app/code/Magento/Cms/Test/Mftf/Section/CmsNewPagePiwSection.xml +++ b/app/code/Magento/Cms/Test/Mftf/Section/CmsNewPagePiwSection.xml @@ -13,4 +13,4 @@ <element name="selectStoreView" type="select" selector="//option[contains(text(),'{{var1}}')]" parameterized="true"/> <element name="storeIdDropdown" type="select" selector="//div[@data-bind="scope: 'cms_page_form.cms_page_form'"]//select[@name='store_id']"/> </section> -</sections> \ No newline at end of file +</sections> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreateDisabledPageTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreateDisabledPageTest.xml index dc40310b15191..b2def26279dc5 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreateDisabledPageTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreateDisabledPageTest.xml @@ -12,8 +12,10 @@ <features value="Cms"/> <title value="Create disabled CMS Page via the Admin"/> <description value="Admin should be able to create a CMS Page"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-14677"/> <group value="backend"/> - <group value="cMSContent"/> + <group value="Cms"/> <group value="mtf_migrated"/> </annotations> <before> @@ -29,7 +31,7 @@ <!--Fill the CMS page form--> <actionGroup ref="FillOutCMSPageContent" stepKey="fillBasicPageDataForDisabledPage"/> <!--Verify successfully saved--> - <actionGroup ref="saveCmsPage" stepKey="saveDisabledPage"/> + <actionGroup ref="SaveCmsPageActionGroup" stepKey="saveDisabledPage"/> <!--Check that page is disabled on frontend--> <actionGroup ref="StorefrontGoToCMSPageActionGroup" stepKey="goToCMSPageOnStorefront"> <argument name="identifier" value="{{_duplicatedCMSPage.identifier}}"/> @@ -40,4 +42,4 @@ <argument name="UrlKey" value="{{_duplicatedCMSPage.identifier}}"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageForDefaultStoreTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageForDefaultStoreTest.xml index eaab13202c89d..b381ae429ed2b 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageForDefaultStoreTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageForDefaultStoreTest.xml @@ -12,8 +12,10 @@ <features value="Cms"/> <title value="Create CMS Page via the Admin for default store"/> <description value="Admin should be able to create a CMS Page"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-14676"/> <group value="backend"/> - <group value="cMSContent"/> + <group value="Cms"/> <group value="mtf_migrated"/> </annotations> <before> @@ -30,13 +32,13 @@ <argument name="storeViewName" value="Default Store View"/> </actionGroup> <!--Verify successfully saved--> - <actionGroup ref="saveCmsPage" stepKey="savePageWithDefaultStore"/> + <actionGroup ref="SaveCmsPageActionGroup" stepKey="savePageWithDefaultStore"/> <!--Navigate to page in Admin--> - <actionGroup ref="navigateToCreatedCMSPage" stepKey="navigateToCMSPageWithDefaultStoreInAdmin"> + <actionGroup ref="NavigateToCreatedCMSPageActionGroup" stepKey="navigateToCMSPageWithDefaultStoreInAdmin"> <argument name="CMSPage" value="_duplicatedCMSPage"/> </actionGroup> <!--Verify Page Data in Admin--> - <actionGroup ref="AssertCMSPageContent" stepKey="verifyPageWithDefaultStoreDataInAdmin"/> + <actionGroup ref="AssertCMSPageContentActionGroup" stepKey="verifyPageWithDefaultStoreDataInAdmin"/> <!--Verify Store ID--> <actionGroup ref="AssertCMSPageStoreIdActionGroup" stepKey="verifyStoreId"> <argument name="storeId" value="1"/> @@ -46,4 +48,4 @@ <argument name="UrlKey" value="{{_duplicatedCMSPage.identifier}}"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageInSingleStoreModeTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageInSingleStoreModeTest.xml index a550ce6f4a9c5..ef083ae61069d 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageInSingleStoreModeTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageInSingleStoreModeTest.xml @@ -12,8 +12,10 @@ <features value="Cms"/> <title value="Create CMS Page via the Admin in single store mode"/> <description value="Admin should be able to create a CMS Page"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-14679"/> <group value="backend"/> - <group value="cMSContent"/> + <group value="Cms"/> <group value="mtf_migrated"/> </annotations> <before> @@ -29,25 +31,25 @@ <!--Fill the CMS page form--> <actionGroup ref="FillOutCMSPageContent" stepKey="fillBasicPageDataForPageWithDefaultStore"/> <!--Verify successfully saved--> - <actionGroup ref="saveCmsPage" stepKey="savePageInSingleStoreMode"/> + <actionGroup ref="SaveCmsPageActionGroup" stepKey="savePageInSingleStoreMode"/> <!--verify page on frontend--> <actionGroup ref="StorefrontGoToCMSPageActionGroup" stepKey="navigateToPageOnStoreFront"> <argument name="identifier" value="{{_duplicatedCMSPage.identifier}}"/> </actionGroup> - <actionGroup ref="AssertStoreFrontCMSPage" stepKey="verifyPageDataOnFrontend"> + <actionGroup ref="AssertStoreFrontCMSPageActionGroup" stepKey="verifyPageDataOnFrontend"> <argument name="cmsTitle" value="{{_duplicatedCMSPage.title}}"/> <argument name="cmsContent" value="{{_duplicatedCMSPage.content}}"/> <argument name="cmsContentHeading" value="{{_duplicatedCMSPage.content_heading}}"/> </actionGroup> <!--Navigate to page in Admin--> - <actionGroup ref="navigateToCreatedCMSPage" stepKey="navigateToCMSPageInAdminInSingleStoreMode"> + <actionGroup ref="NavigateToCreatedCMSPageActionGroup" stepKey="navigateToCMSPageInAdminInSingleStoreMode"> <argument name="CMSPage" value="_duplicatedCMSPage"/> </actionGroup> <!--Verify Page Data in Admin--> - <actionGroup ref="AssertCMSPageContent" stepKey="verifyPageDataInAdminInSingleStoreMode"/> + <actionGroup ref="AssertCMSPageContentActionGroup" stepKey="verifyPageDataInAdminInSingleStoreMode"/> <!--Delete page--> <actionGroup ref="DeletePageByUrlKeyActionGroup" stepKey="deletePageInSingleStoreMode"> <argument name="UrlKey" value="{{_duplicatedCMSPage.identifier}}"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageTest.xml index 4e1a5b5ed6422..536c7055c9932 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageTest.xml @@ -12,8 +12,10 @@ <features value="Cms"/> <title value="Create CMS Page via the Admin"/> <description value="Admin should be able to create a CMS Page"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-14675"/> <group value="backend"/> - <group value="cMSContent"/> + <group value="Cms"/> <group value="mtf_migrated"/> </annotations> <before> @@ -26,19 +28,19 @@ <actionGroup ref="AdminOpenCreateNewCMSPageActionGroup" stepKey="navigateToCreateNewPage"/> <actionGroup ref="FillOutCMSPageContent" stepKey="fillBasicPageData"/> <!--verify successfully saved--> - <actionGroup ref="saveCmsPage" stepKey="saveNewPage"/> + <actionGroup ref="SaveCmsPageActionGroup" stepKey="saveNewPage"/> <!--verify page on frontend--> <actionGroup ref="StorefrontGoToCMSPageActionGroup" stepKey="navigateToPageOnStoreFront"> <argument name="identifier" value="{{_duplicatedCMSPage.identifier}}"/> </actionGroup> - <actionGroup ref="AssertStoreFrontCMSPage" stepKey="verifyPageDataOnFrontend"> + <actionGroup ref="AssertStoreFrontCMSPageActionGroup" stepKey="verifyPageDataOnFrontend"> <argument name="cmsTitle" value="{{_duplicatedCMSPage.title}}"/> <argument name="cmsContent" value="{{_duplicatedCMSPage.content}}"/> <argument name="cmsContentHeading" value="{{_duplicatedCMSPage.content_heading}}"/> </actionGroup> <!--verify page in grid--> <actionGroup ref="AdminOpenCMSPagesGridActionGroup" stepKey="openCMSPagesGridActionGroup"/> - <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearGridFilters"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearGridFilters"/> <actionGroup ref="SortByIdDescendingActionGroup" stepKey="sortGridByIdDescending"/> <actionGroup ref="AdminSelectCMSPageFromGridActionGroup" stepKey="verifyPageInGrid"> <argument name="identifier" value="_duplicatedCMSPage.identifier"/> @@ -47,4 +49,4 @@ <argument name="UrlKey" value="{{_duplicatedCMSPage.identifier}}"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageWithBlockTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageWithBlockTest.xml index c4112111aa839..396507dddaca1 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageWithBlockTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageWithBlockTest.xml @@ -12,8 +12,10 @@ <features value="Cms"/> <title value="Create CMS Page that contains block content via the Admin"/> <description value="Admin should be able to create a CMS Page"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-14678"/> <group value="backend"/> - <group value="cMSContent"/> + <group value="Cms"/> <group value="mtf_migrated"/> </annotations> <before> @@ -32,12 +34,12 @@ <argument name="storeViewName" value="Default Store View"/> </actionGroup> <!--Verify successfully saved--> - <actionGroup ref="saveCmsPage" stepKey="savePageWithBlock"/> + <actionGroup ref="SaveCmsPageActionGroup" stepKey="savePageWithBlock"/> <!--verify page on frontend--> <actionGroup ref="StorefrontGoToCMSPageActionGroup" stepKey="navigateToPageOnStoreFront"> <argument name="identifier" value="{{_duplicatedCMSPage.identifier}}"/> </actionGroup> - <actionGroup ref="AssertStoreFrontCMSPage" stepKey="verifyPageWithBlockDataOnFrontend"> + <actionGroup ref="AssertStoreFrontCMSPageActionGroup" stepKey="verifyPageWithBlockDataOnFrontend"> <argument name="cmsTitle" value="{{_duplicatedCMSPage.title}}"/> <argument name="cmsContent" value="bla bla bla"/> <argument name="cmsContentHeading" value="{{_duplicatedCMSPage.content_heading}}"/> @@ -47,4 +49,4 @@ <argument name="UrlKey" value="{{_duplicatedCMSPage.identifier}}"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Integration/Test/Mftf/Test/AdminCreateIntegrationEntityWithDuplicatedNameTest.xml b/app/code/Magento/Integration/Test/Mftf/Test/AdminCreateIntegrationEntityWithDuplicatedNameTest.xml index d1809cf909f9c..b23436d474ed8 100644 --- a/app/code/Magento/Integration/Test/Mftf/Test/AdminCreateIntegrationEntityWithDuplicatedNameTest.xml +++ b/app/code/Magento/Integration/Test/Mftf/Test/AdminCreateIntegrationEntityWithDuplicatedNameTest.xml @@ -14,6 +14,8 @@ <stories value="Creating System Integration With Duplicated Name"/> <title value="Admin System Integration With Duplicated Name"/> <description value="Admin Creates New Integration With Duplicated Name"/> + <severity value="MAJOR"/> + <testCaseId value="MC-19889"/> <group value="integration"/> <group value="mtf_migrated"/> </annotations> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteProductURLRewriteEntityTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteProductURLRewriteEntityTest.xml index f9c57a0c0bf4c..2becb177ee72b 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteProductURLRewriteEntityTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteProductURLRewriteEntityTest.xml @@ -12,6 +12,9 @@ <stories value="Delete Product UrlRewrite"/> <title value="Delete created product URL rewrite"/> <description value="Login as admin, create product with category and UrlRewrite, delete created URL rewrite"/> + <testCaseId value="MC-5347"/> + <severity value="MAJOR"/> + <group value="urlRewrite"/> <group value="mtf_migrated"/> </annotations> From c5872d0477a5aff79cb431f1d689c04c448407b8 Mon Sep 17 00:00:00 2001 From: Anusha Vattam <avattam@adobe.com> Date: Wed, 8 Jan 2020 13:59:43 -0600 Subject: [PATCH 0730/1143] MC:20074: Fix Skipped MFTF Tests From MC-17140: MC-14104, MC-14502, MC-14532 - Added the changes to the JS test back with new time out --- .../Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml index 046bd59025e61..f268917c6930b 100644 --- a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml +++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml @@ -20,12 +20,8 @@ <group value="mtf_migrated"/> </annotations> <before> - <magentoCLI command="config:set {{MinifyJavaScriptFilesEnableConfigData.path}} {{MinifyJavaScriptFilesEnableConfigData.value}}" stepKey="enableJsMinification"/> - <amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}" stepKey="navigateToAdminPage"/> - <fillField userInput="{{_ENV.MAGENTO_ADMIN_USERNAME}}" selector="{{AdminLoginFormSection.username}}" stepKey="fillUsernameOnLoginPage"/> - <fillField userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}" selector="{{AdminLoginFormSection.password}}" stepKey="fillPasswordOnPage"/> - <click selector="{{AdminLoginFormSection.signIn}}" stepKey="clickAdminLogin"/> - <see userInput="Dashboard" selector="{{AdminHeaderSection.pageTitle}}" stepKey="seeDashboardTitle"/> + <magentoCLI command="config:set {{MinifyJavaScriptFilesEnableConfigData.path}} {{MinifyJavaScriptFilesEnableConfigData.value}}" stepKey="enableJsMinification" timeout="30"/> + <actionGroup ref="LoginActionGroup" stepKey="loginAsAdmin"/> </before> <after> <magentoCLI command="config:set {{MinifyJavaScriptFilesDisableConfigData.path}} {{MinifyJavaScriptFilesDisableConfigData.value}}" stepKey="disableJsMinification"/> From 6aeeb2378d275c13409d5fe37ef29c2f8f28c50d Mon Sep 17 00:00:00 2001 From: Soumya Unnikrishnan <sunnikri@adobe.com> Date: Wed, 8 Jan 2020 14:50:05 -0600 Subject: [PATCH 0731/1143] MQE-1931: [MTF-To-MFTF] Process PR 718 Added test case ids and updated action group names --- .../Test/Mftf/Test/AdminCreateActiveHtmlTermEntityTest.xml | 4 ++-- .../Test/Mftf/Test/AdminCreateActiveTextTermEntityTest.xml | 4 ++-- .../Mftf/Test/AdminCreateDisabledTextTermEntityTest.xml | 4 ++-- .../AdminCreateEnabledTextTermOnMultishippingEntityTest.xml | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveHtmlTermEntityTest.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveHtmlTermEntityTest.xml index ed9f5959be9d4..3b180576b557c 100644 --- a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveHtmlTermEntityTest.xml +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveHtmlTermEntityTest.xml @@ -15,7 +15,7 @@ <title value="Create active HTML checkout agreement"/> <description value="Admin should be able to create active HTML checkout agreement"/> <severity value="CRITICAL"/> - <testCaseId value=""/> + <testCaseId value="MC-14668"/> <group value="checkoutAgreements"/> <group value="mtf_migrated"/> </annotations> @@ -39,7 +39,7 @@ <actionGroup ref="AdminAssertTermInGridActionGroup" stepKey="assertTermInGrid"> <argument name="termName" value="{{activeHtmlTerm.name}}"/> </actionGroup> - <actionGroup ref="AddSimpleProductToCart" stepKey="addProductToTheCart"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToTheCart"> <argument name="product" value="$$createdProduct$$"/> </actionGroup> <actionGroup ref="StorefrontProcessCheckoutToPaymentActionGroup" stepKey="processCheckoutToThePaymentMethodsPage"/> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveTextTermEntityTest.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveTextTermEntityTest.xml index 2a95c44a6d4eb..9b2d3da9ece34 100644 --- a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveTextTermEntityTest.xml +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveTextTermEntityTest.xml @@ -15,7 +15,7 @@ <title value="Create active text checkout agreement"/> <description value="Admin should be able to create active text checkout agreement"/> <severity value="CRITICAL"/> - <testCaseId value=""/> + <testCaseId value="MC-14667"/> <group value="checkoutAgreements"/> <group value="mtf_migrated"/> </annotations> @@ -39,7 +39,7 @@ <actionGroup ref="AdminAssertTermInGridActionGroup" stepKey="assertTermInGrid"> <argument name="termName" value="{{activeTextTerm.name}}"/> </actionGroup> - <actionGroup ref="AddSimpleProductToCart" stepKey="addProductToTheCart"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToTheCart"> <argument name="product" value="$$createdProduct$$"/> </actionGroup> <actionGroup ref="StorefrontProcessCheckoutToPaymentActionGroup" stepKey="processCheckoutToThePaymentMethodsPage"/> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateDisabledTextTermEntityTest.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateDisabledTextTermEntityTest.xml index d279d38f854d1..8a1efcdce85e1 100644 --- a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateDisabledTextTermEntityTest.xml +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateDisabledTextTermEntityTest.xml @@ -15,7 +15,7 @@ <title value="Create disabled text checkout agreement"/> <description value="Admin should be able to create disabled text checkout agreement"/> <severity value="CRITICAL"/> - <testCaseId value=""/> + <testCaseId value="MC-14669"/> <group value="checkoutAgreements"/> <group value="mtf_migrated"/> </annotations> @@ -39,7 +39,7 @@ <actionGroup ref="AdminAssertTermInGridActionGroup" stepKey="assertTermInGrid"> <argument name="termName" value="{{disabledTextTerm.name}}"/> </actionGroup> - <actionGroup ref="AddSimpleProductToCart" stepKey="addProductToTheCart"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToTheCart"> <argument name="product" value="$$createdProduct$$"/> </actionGroup> <actionGroup ref="StorefrontProcessCheckoutToPaymentActionGroup" stepKey="processCheckoutToThePaymentMethodsPage"/> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateEnabledTextTermOnMultishippingEntityTest.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateEnabledTextTermOnMultishippingEntityTest.xml index e579d2653b44d..93e8e6a01d543 100644 --- a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateEnabledTextTermOnMultishippingEntityTest.xml +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateEnabledTextTermOnMultishippingEntityTest.xml @@ -15,7 +15,7 @@ <title value="Create enabled text checkout multishipping agreement"/> <description value="Admin should be able to create enabled text checkout multishipping agreement"/> <severity value="CRITICAL"/> - <testCaseId value=""/> + <testCaseId value="MC-14670"/> <group value="checkoutAgreements"/> <group value="mtf_migrated"/> </annotations> @@ -43,10 +43,10 @@ <actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerLogin"> <argument name="Customer" value="$$createdCustomer$$" /> </actionGroup> - <actionGroup ref="AddSimpleProductToCart" stepKey="addProduct1ToTheCart"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProduct1ToTheCart"> <argument name="product" value="$$createdProduct1$$"/> </actionGroup> - <actionGroup ref="AddSimpleProductToCart" stepKey="addProduct2ToTheCart"> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProduct2ToTheCart"> <argument name="product" value="$$createdProduct2$$"/> </actionGroup> <actionGroup ref="StorefrontAssertTermRequireMessageInMultishippingCheckoutActionGroup" stepKey="assertTermInCheckout"> From bcd925ae4b0a403985591523b4d5b7ebe87b26f2 Mon Sep 17 00:00:00 2001 From: Anusha Vattam <avattam@adobe.com> Date: Wed, 8 Jan 2020 15:56:38 -0600 Subject: [PATCH 0732/1143] MC:20074: Fix Skipped MFTF Tests From MC-17140: MC-14104, MC-14502, MC-14532 - Added the changes to the JS with CLI new commands --- .../Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml index f268917c6930b..13bbfabf2e939 100644 --- a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml +++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml @@ -20,14 +20,15 @@ <group value="mtf_migrated"/> </annotations> <before> - <magentoCLI command="config:set {{MinifyJavaScriptFilesEnableConfigData.path}} {{MinifyJavaScriptFilesEnableConfigData.value}}" stepKey="enableJsMinification" timeout="30"/> - <actionGroup ref="LoginActionGroup" stepKey="loginAsAdmin"/> + <magentoCLI command="config:set {{MinifyJavaScriptFilesEnableConfigData.path}} {{MinifyJavaScriptFilesEnableConfigData.value}}" stepKey="enableJsMinification"/> + <magentoCLI command="cache:clean config" stepKey="cleanCache"/> </before> <after> <magentoCLI command="config:set {{MinifyJavaScriptFilesDisableConfigData.path}} {{MinifyJavaScriptFilesDisableConfigData.value}}" stepKey="disableJsMinification"/> <actionGroup ref="logout" stepKey="logout"/> </after> - + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <see userInput="Dashboard" selector="{{AdminHeaderSection.pageTitle}}" stepKey="seeDashboardTitle"/> <actionGroup ref="AssertAdminSuccessLoginActionGroup" stepKey="loggedInSuccessfully"/> <actionGroup ref="AssertAdminPageIsNot404ActionGroup" stepKey="dontSee404Page"/> </test> From 7a7719177e279e68488631590238f7576b265da1 Mon Sep 17 00:00:00 2001 From: Soumya Unnikrishnan <sunnikri@adobe.com> Date: Wed, 8 Jan 2020 15:57:55 -0600 Subject: [PATCH 0733/1143] MQE-1920: [MTF-To-MFTF] Process PR 701 Added wait to fix jenkins failure --- .../Test/Mftf/ActionGroup/AdminOpenCMSPagesGridActionGroup.xml | 2 +- .../Test/Mftf/ActionGroup/FillOutCMSPageContentActionGroup.xml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminOpenCMSPagesGridActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminOpenCMSPagesGridActionGroup.xml index 1ae07d55f376d..fe2bf741c5bdc 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminOpenCMSPagesGridActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminOpenCMSPagesGridActionGroup.xml @@ -16,4 +16,4 @@ <amOnPage url="{{CmsPagesPage.url}}" stepKey="navigateToCMSPagesGrid"/> <waitForPageLoad stepKey="waitForPageLoad"/> </actionGroup> -</actionGroups> \ No newline at end of file +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/FillOutCMSPageContentActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/FillOutCMSPageContentActionGroup.xml index 3a0a2f3b75b55..1bf74ba206bbd 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/FillOutCMSPageContentActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/FillOutCMSPageContentActionGroup.xml @@ -15,8 +15,9 @@ <fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{_duplicatedCMSPage.title}}" stepKey="fillFieldTitle"/> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickExpandContentTabForPage"/> - <fillField selector="{{CmsNewPagePageContentSection.content}}" userInput="{{_duplicatedCMSPage.content}}" stepKey="fillFieldContent"/> + <waitForElementVisible selector="{{CmsNewPagePageContentSection.contentHeading}}" stepKey="waitForContentSection"/> <fillField selector="{{CmsNewPagePageContentSection.contentHeading}}" userInput="{{_duplicatedCMSPage.content_heading}}" stepKey="fillFieldContentHeading"/> + <fillField selector="{{CmsNewPagePageContentSection.content}}" userInput="{{_duplicatedCMSPage.content}}" stepKey="fillFieldContent"/> <click selector="{{CmsNewPagePageSeoSection.header}}" stepKey="clickExpandSearchEngineOptimisation"/> <fillField selector="{{CmsNewPagePageSeoSection.urlKey}}" userInput="{{_duplicatedCMSPage.identifier}}" stepKey="fillFieldUrlKey"/> </actionGroup> From 631282eadb8e24cd752ab3ba91f3e74e91e2c0e0 Mon Sep 17 00:00:00 2001 From: Lena Orobei <oorobei@magento.com> Date: Wed, 8 Jan 2020 16:02:04 -0600 Subject: [PATCH 0734/1143] - added api-functional test for product fragment --- .../GraphQl/Catalog/ProductFragmentTest.php | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductFragmentTest.php diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductFragmentTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductFragmentTest.php new file mode 100644 index 0000000000000..32a2f8f763572 --- /dev/null +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductFragmentTest.php @@ -0,0 +1,54 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\GraphQl\Catalog; + +use Magento\TestFramework\TestCase\GraphQlAbstract; + +/** + * Test for simple product fragment. + */ +class ProductFragmentTest extends GraphQlAbstract +{ + /** + * @magentoApiDataFixture Magento/Catalog/_files/product_simple.php + */ + public function testSimpleProductFragment() + { + $sku = 'simple'; + $name = 'Simple Product'; + $price = 10; + + $query = <<<QUERY +query GetProduct { + products(filter: { sku: { eq: "$sku" } }) { + items { + sku + ...BasicProductInformation + } + } +} + +fragment BasicProductInformation on ProductInterface { + sku + name + price { + regularPrice { + amount { + value + } + } + } +} +QUERY; + $result = $this->graphQlQuery($query); + $actualProductData = $result['products']['items'][0]; + $this->assertNotEmpty($actualProductData); + $this->assertEquals($name, $actualProductData['name']); + $this->assertEquals($price, $actualProductData['price']['regularPrice']['amount']['value']); + } +} From 1ed7dc9be4844d6c2743d9f0afa190c65405f5dd Mon Sep 17 00:00:00 2001 From: Anusha Vattam <avattam@adobe.com> Date: Wed, 8 Jan 2020 17:39:05 -0600 Subject: [PATCH 0735/1143] MC:20074: Fix Skipped MFTF Tests From MC-17140: MC-14104, MC-14502, MC-14532 - Added the changes to CE test --- .../Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml index 13bbfabf2e939..5550e3b317b0d 100644 --- a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml +++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml @@ -22,13 +22,14 @@ <before> <magentoCLI command="config:set {{MinifyJavaScriptFilesEnableConfigData.path}} {{MinifyJavaScriptFilesEnableConfigData.value}}" stepKey="enableJsMinification"/> <magentoCLI command="cache:clean config" stepKey="cleanCache"/> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> <magentoCLI command="config:set {{MinifyJavaScriptFilesDisableConfigData.path}} {{MinifyJavaScriptFilesDisableConfigData.value}}" stepKey="disableJsMinification"/> <actionGroup ref="logout" stepKey="logout"/> </after> - <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <see userInput="Dashboard" selector="{{AdminHeaderSection.pageTitle}}" stepKey="seeDashboardTitle"/> + <waitForPageLoad stepKey="waitForPageLoadOnDashboard"/> <actionGroup ref="AssertAdminSuccessLoginActionGroup" stepKey="loggedInSuccessfully"/> <actionGroup ref="AssertAdminPageIsNot404ActionGroup" stepKey="dontSee404Page"/> </test> From 60f4f5b8ffc4f7e0eca17e0fe95da5bd90278ca1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 9 Jan 2020 01:06:57 +0100 Subject: [PATCH 0736/1143] REFACTOR: Extract Action Groups to separate files (MFTF best practices) --- .../AdminAssignImageRolesActionGroup.xml | 10 --------- ...ssignImageRolesIfUnassignedActionGroup.xml | 21 +++++++++++++++++++ 2 files changed, 21 insertions(+), 10 deletions(-) create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssignImageRolesIfUnassignedActionGroup.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssignImageRolesActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssignImageRolesActionGroup.xml index e5cefda0aca96..12602615db8ef 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssignImageRolesActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssignImageRolesActionGroup.xml @@ -25,14 +25,4 @@ <checkOption selector="{{AdminProductImagesSection.roleSwatch}}" stepKey="checkRoleSwatch"/> <click selector="{{AdminSlideOutDialogSection.closeButton}}" stepKey="clickCloseButton"/> </actionGroup> - <actionGroup name="AdminAssignImageRolesIfUnassignedActionGroup" extends="AdminAssignImageRolesActionGroup"> - <annotations> - <description>Requires the navigation to the Product Creation page. Assign the Base, Small, Thumbnail, and Swatch Roles to image.</description> - </annotations> - - <conditionalClick selector="{{AdminProductImagesSection.roleBase}}" dependentSelector="{{AdminProductImagesSection.isRoleChecked('Base')}}" visible="false" stepKey="checkRoleBase"/> - <conditionalClick selector="{{AdminProductImagesSection.roleSmall}}" dependentSelector="{{AdminProductImagesSection.isRoleChecked('Small')}}" visible="false" stepKey="checkRoleSmall"/> - <conditionalClick selector="{{AdminProductImagesSection.roleThumbnail}}" dependentSelector="{{AdminProductImagesSection.isRoleChecked('Thumbnail')}}" visible="false" stepKey="checkRoleThumbnail"/> - <conditionalClick selector="{{AdminProductImagesSection.roleSwatch}}" dependentSelector="{{AdminProductImagesSection.isRoleChecked('Swatch')}}" visible="false" stepKey="checkRoleSwatch"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssignImageRolesIfUnassignedActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssignImageRolesIfUnassignedActionGroup.xml new file mode 100644 index 0000000000000..ca82882b141cb --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssignImageRolesIfUnassignedActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAssignImageRolesIfUnassignedActionGroup" extends="AdminAssignImageRolesActionGroup"> + <annotations> + <description>Requires the navigation to the Product Creation page. Assign the Base, Small, Thumbnail, and Swatch Roles to image.</description> + </annotations> + + <conditionalClick selector="{{AdminProductImagesSection.roleBase}}" dependentSelector="{{AdminProductImagesSection.isRoleChecked('Base')}}" visible="false" stepKey="checkRoleBase"/> + <conditionalClick selector="{{AdminProductImagesSection.roleSmall}}" dependentSelector="{{AdminProductImagesSection.isRoleChecked('Small')}}" visible="false" stepKey="checkRoleSmall"/> + <conditionalClick selector="{{AdminProductImagesSection.roleThumbnail}}" dependentSelector="{{AdminProductImagesSection.isRoleChecked('Thumbnail')}}" visible="false" stepKey="checkRoleThumbnail"/> + <conditionalClick selector="{{AdminProductImagesSection.roleSwatch}}" dependentSelector="{{AdminProductImagesSection.isRoleChecked('Swatch')}}" visible="false" stepKey="checkRoleSwatch"/> + </actionGroup> +</actionGroups> From 9df75b0ec5cb88a0b87681a8a5d7165e6c50aa8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 9 Jan 2020 01:12:54 +0100 Subject: [PATCH 0737/1143] REFACTOR: Extract Action Groups to separate files (MFTF best practices) --- .../AdminOrderActionOnGridActionGroup.xml | 7 ------- .../AdminTwoOrderActionOnGridActionGroup.xml | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminTwoOrderActionOnGridActionGroup.xml diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionOnGridActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionOnGridActionGroup.xml index a9091deb039fc..20f475d4c0d78 100644 --- a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionOnGridActionGroup.xml +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionOnGridActionGroup.xml @@ -19,11 +19,4 @@ <click selector="{{AdminOrdersGridSection.dropdownActionItem(action)}}" stepKey="selectAction"/> <waitForPageLoad stepKey="waitForResults"/> </actionGroup> - <actionGroup name="AdminTwoOrderActionOnGridActionGroup" extends="AdminOrderActionOnGridActionGroup"> - <arguments> - <argument name="secondOrderId" type="string"/> - </arguments> - <checkOption selector="{{AdminOrdersGridSection.selectOrderID(secondOrderId)}}" stepKey="selectSecondOrder" after="waitForCheck"/> - <waitForLoadingMaskToDisappear stepKey="waitForSecondCheck" after="selectSecondOrder"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminTwoOrderActionOnGridActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminTwoOrderActionOnGridActionGroup.xml new file mode 100644 index 0000000000000..4cb0a45078125 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminTwoOrderActionOnGridActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminTwoOrderActionOnGridActionGroup" extends="AdminOrderActionOnGridActionGroup"> + <arguments> + <argument name="secondOrderId" type="string"/> + </arguments> + <checkOption selector="{{AdminOrdersGridSection.selectOrderID(secondOrderId)}}" stepKey="selectSecondOrder" after="waitForCheck"/> + <waitForLoadingMaskToDisappear stepKey="waitForSecondCheck" after="selectSecondOrder"/> + </actionGroup> +</actionGroups> From 0e5643f0771198baac06ccc4211d4afce52b7423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 9 Jan 2020 01:20:04 +0100 Subject: [PATCH 0738/1143] REFACTOR: Extract Action Groups to separate files (MFTF best practices) --- ...fStorefrontIsOpenedViaCustomerViewTest.xml | 4 +- .../Test/AdminCreatingShippingLabelTest.xml | 2 +- ...ectnessInvoicedItemInBundleProductTest.xml | 2 +- .../AdminGoToShipmentTabActionGroup.xml | 15 ++++ .../ActionGroup/AdminShipmentActionGroup.xml | 85 ------------------- ...ShipmentCreateShippingLabelActionGroup.xml | 27 ++++++ .../GoToShipmentIntoOrderActionGroup.xml | 20 +++++ .../SeeProductInShipmentItemsActionGroup.xml | 21 +++++ .../SubmitShipmentIntoOrderActionGroup.xml | 20 +++++ ...ifyBasicShipmentInformationActionGroup.xml | 34 ++++++++ .../Test/Mftf/Test/EndToEndB2CAdminTest.xml | 10 +-- 11 files changed, 146 insertions(+), 94 deletions(-) create mode 100644 app/code/Magento/Shipping/Test/Mftf/ActionGroup/AdminGoToShipmentTabActionGroup.xml delete mode 100644 app/code/Magento/Shipping/Test/Mftf/ActionGroup/AdminShipmentActionGroup.xml create mode 100644 app/code/Magento/Shipping/Test/Mftf/ActionGroup/AdminShipmentCreateShippingLabelActionGroup.xml create mode 100644 app/code/Magento/Shipping/Test/Mftf/ActionGroup/GoToShipmentIntoOrderActionGroup.xml create mode 100644 app/code/Magento/Shipping/Test/Mftf/ActionGroup/SeeProductInShipmentItemsActionGroup.xml create mode 100644 app/code/Magento/Shipping/Test/Mftf/ActionGroup/SubmitShipmentIntoOrderActionGroup.xml create mode 100644 app/code/Magento/Shipping/Test/Mftf/ActionGroup/VerifyBasicShipmentInformationActionGroup.xml diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminPanelIsFrozenIfStorefrontIsOpenedViaCustomerViewTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminPanelIsFrozenIfStorefrontIsOpenedViaCustomerViewTest.xml index ee32214435428..16125c6ddf250 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminPanelIsFrozenIfStorefrontIsOpenedViaCustomerViewTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminPanelIsFrozenIfStorefrontIsOpenedViaCustomerViewTest.xml @@ -46,8 +46,8 @@ <actionGroup ref="StartCreateInvoiceFromOrderPageActionGroup" stepKey="startCreateInvoice"/> <actionGroup ref="SubmitInvoiceActionGroup" stepKey="submitInvoice"/> - <actionGroup ref="goToShipmentIntoOrder" stepKey="goToShipment"/> - <actionGroup ref="submitShipmentIntoOrder" stepKey="submitShipment"/> + <actionGroup ref="GoToShipmentIntoOrderActionGroup" stepKey="goToShipment"/> + <actionGroup ref="SubmitShipmentIntoOrderActionGroup" stepKey="submitShipment"/> <!--Create Credit Memo--> <actionGroup ref="StartToCreateCreditMemoActionGroup" stepKey="startToCreateCreditMemo"> diff --git a/app/code/Magento/Fedex/Test/Mftf/Test/AdminCreatingShippingLabelTest.xml b/app/code/Magento/Fedex/Test/Mftf/Test/AdminCreatingShippingLabelTest.xml index 928ce5a2a918f..016c609ae7762 100644 --- a/app/code/Magento/Fedex/Test/Mftf/Test/AdminCreatingShippingLabelTest.xml +++ b/app/code/Magento/Fedex/Test/Mftf/Test/AdminCreatingShippingLabelTest.xml @@ -111,7 +111,7 @@ <!--Create Invoice--> <actionGroup ref="AdminCreateInvoiceActionGroup" stepKey="createInvoice"/> <!--Create shipping label--> - <actionGroup ref="goToShipmentIntoOrder" stepKey="goToShipmentIntoOrder"/> + <actionGroup ref="GoToShipmentIntoOrderActionGroup" stepKey="goToShipmentIntoOrder"/> <checkOption selector="{{AdminShipmentTotalSection.createShippingLabel}}" stepKey="checkCreateShippingLabel"/> <click selector="{{AdminShipmentMainActionsSection.submitShipment}}" stepKey="clickSubmitShipment"/> <actionGroup ref="AdminShipmentCreateShippingLabelActionGroup" stepKey="createPackage"> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCorrectnessInvoicedItemInBundleProductTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCorrectnessInvoicedItemInBundleProductTest.xml index 622718d721577..e499f72004986 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCorrectnessInvoicedItemInBundleProductTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCorrectnessInvoicedItemInBundleProductTest.xml @@ -88,7 +88,7 @@ <actionGroup ref="SubmitInvoiceActionGroup" stepKey="submitInvoice"/> <!--Verify invoiced items qty in ship tab--> - <actionGroup ref="goToShipmentIntoOrder" stepKey="goToShipment"/> + <actionGroup ref="GoToShipmentIntoOrderActionGroup" stepKey="goToShipment"/> <grabTextFrom selector="{{AdminShipmentItemsSection.itemQtyInvoiced('1')}}" stepKey="grabInvoicedItemQty"/> <assertEquals expected="5" expectedType="string" actual="$grabInvoicedItemQty" stepKey="assertInvoicedItemsQty"/> </test> diff --git a/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AdminGoToShipmentTabActionGroup.xml b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AdminGoToShipmentTabActionGroup.xml new file mode 100644 index 0000000000000..ff2522d110eeb --- /dev/null +++ b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AdminGoToShipmentTabActionGroup.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminGoToShipmentTabActionGroup"> + <click selector="{{AdminOrderDetailsOrderViewSection.shipments}}" stepKey="clickOrderShipmentsTab"/> + <waitForLoadingMaskToDisappear stepKey="waitForShipmentTabLoad" after="clickOrderShipmentsTab"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AdminShipmentActionGroup.xml b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AdminShipmentActionGroup.xml deleted file mode 100644 index 631db885ab3d9..0000000000000 --- a/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AdminShipmentActionGroup.xml +++ /dev/null @@ -1,85 +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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="verifyBasicShipmentInformation"> - <annotations> - <description>Validates that the provided Customer, Shipping Address, Billing Address and Customer Group are present and correct on the view Admin Order page.</description> - </annotations> - <arguments> - <argument name="customer" defaultValue=""/> - <argument name="shippingAddress" defaultValue=""/> - <argument name="billingAddress" defaultValue=""/> - <argument name="customerGroup" defaultValue="GeneralCustomerGroup"/> - </arguments> - - <see selector="{{AdminShipmentOrderInformationSection.customerName}}" userInput="{{customer.firstname}}" stepKey="seeCustomerName"/> - <see selector="{{AdminShipmentOrderInformationSection.customerEmail}}" userInput="{{customer.email}}" stepKey="seeCustomerEmail"/> - <see selector="{{AdminShipmentOrderInformationSection.customerGroup}}" userInput="{{customerGroup.code}}" stepKey="seeCustomerGroup"/> - <see selector="{{AdminShipmentAddressInformationSection.billingAddress}}" userInput="{{billingAddress.street[0]}}" stepKey="seeBillingAddressStreet"/> - <see selector="{{AdminShipmentAddressInformationSection.billingAddress}}" userInput="{{billingAddress.city}}" stepKey="seeBillingAddressCity"/> - <see selector="{{AdminShipmentAddressInformationSection.billingAddress}}" userInput="{{billingAddress.country_id}}" stepKey="seeBillingAddressCountry"/> - <see selector="{{AdminShipmentAddressInformationSection.billingAddress}}" userInput="{{billingAddress.postcode}}" stepKey="seeBillingAddressPostcode"/> - <see selector="{{AdminShipmentAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.street[0]}}" stepKey="seeShippingAddressStreet"/> - <see selector="{{AdminShipmentAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.city}}" stepKey="seeShippingAddressCity"/> - <see selector="{{AdminShipmentAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.country_id}}" stepKey="seeShippingAddressCountry"/> - <see selector="{{AdminShipmentAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.postcode}}" stepKey="seeShippingAddressPostcode"/> - </actionGroup> - - <actionGroup name="seeProductInShipmentItems"> - <annotations> - <description>Validates that the provided Product is present and correct on the view Admin Order Shipment page under the 'Items Shipped' section.</description> - </annotations> - <arguments> - <argument name="product"/> - </arguments> - - <see selector="{{AdminShipmentItemsSection.skuColumn}}" userInput="{{product.sku}}" stepKey="seeProductSkuInGrid"/> - </actionGroup> - - <actionGroup name="goToShipmentIntoOrder"> - <annotations> - <description>Clicks on the 'Ship' button on the view Admin Order page. Validates that the URL and Page Title are present and correct.</description> - </annotations> - - <click selector="{{AdminOrderDetailsMainActionsSection.ship}}" stepKey="clickShipAction"/> - <seeInCurrentUrl url="{{AdminShipmentNewPage.url}}" stepKey="seeOrderShipmentUrl"/> - <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Shipment" stepKey="seePageNameNewInvoicePage"/> - </actionGroup> - - <actionGroup name="submitShipmentIntoOrder"> - <annotations> - <description>Clicks on the 'Submit Shipment' button on the view Admin Order Shipment page. Validates that the URL and Page Title are present and correct.</description> - </annotations> - - <click selector="{{AdminShipmentMainActionsSection.submitShipment}}" stepKey="clickSubmitShipment"/> - <seeInCurrentUrl url="{{AdminOrderDetailsPage.url}}" stepKey="seeViewOrderPageShipping"/> - <see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="The shipment has been created." stepKey="seeShipmentCreateSuccess"/> - </actionGroup> - <actionGroup name="AdminShipmentCreateShippingLabelActionGroup"> - <arguments> - <argument name="productName" type="string" defaultValue="{{SimpleProduct.name}}"/> - </arguments> - <waitForElementVisible selector="{{AdminShipmentCreatePackageMainSection.addProductsToPackage}}" stepKey="waitForAddProductElement"/> - <click selector="{{AdminShipmentCreatePackageMainSection.addProductsToPackage}}" stepKey="clickAddProducts"/> - <waitForElementVisible selector="{{AdminShipmentCreatePackageProductGridSection.concreteProductCheckbox('productName')}}" stepKey="waitForProductBeVisible"/> - <checkOption selector="{{AdminShipmentCreatePackageProductGridSection.concreteProductCheckbox('productName')}}" stepKey="checkProductCheckbox"/> - <waitForElementVisible selector="{{AdminShipmentCreatePackageMainSection.addSelectedProductToPackage}}" stepKey="waitForAddSelectedProductElement"/> - <click selector="{{AdminShipmentCreatePackageMainSection.addSelectedProductToPackage}}" stepKey="clickAddSelectedProduct"/> - <waitForElementNotVisible selector="{{AdminShipmentCreatePackageMainSection.saveButtonDisabled}}" stepKey="waitForBeEnabled"/> - <click selector="{{AdminShipmentCreatePackageMainSection.save}}" stepKey="clickSave"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskDisappear"/> - <waitForPageLoad stepKey="waitForSaving"/> - <see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="The shipment has been created. You created the shipping label." stepKey="seeShipmentCreateSuccess"/> - </actionGroup> - <actionGroup name="AdminGoToShipmentTabActionGroup"> - <click selector="{{AdminOrderDetailsOrderViewSection.shipments}}" stepKey="clickOrderShipmentsTab"/> - <waitForLoadingMaskToDisappear stepKey="waitForShipmentTabLoad" after="clickOrderShipmentsTab"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AdminShipmentCreateShippingLabelActionGroup.xml b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AdminShipmentCreateShippingLabelActionGroup.xml new file mode 100644 index 0000000000000..663b6088395c4 --- /dev/null +++ b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AdminShipmentCreateShippingLabelActionGroup.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminShipmentCreateShippingLabelActionGroup"> + <arguments> + <argument name="productName" type="string" defaultValue="{{SimpleProduct.name}}"/> + </arguments> + <waitForElementVisible selector="{{AdminShipmentCreatePackageMainSection.addProductsToPackage}}" stepKey="waitForAddProductElement"/> + <click selector="{{AdminShipmentCreatePackageMainSection.addProductsToPackage}}" stepKey="clickAddProducts"/> + <waitForElementVisible selector="{{AdminShipmentCreatePackageProductGridSection.concreteProductCheckbox('productName')}}" stepKey="waitForProductBeVisible"/> + <checkOption selector="{{AdminShipmentCreatePackageProductGridSection.concreteProductCheckbox('productName')}}" stepKey="checkProductCheckbox"/> + <waitForElementVisible selector="{{AdminShipmentCreatePackageMainSection.addSelectedProductToPackage}}" stepKey="waitForAddSelectedProductElement"/> + <click selector="{{AdminShipmentCreatePackageMainSection.addSelectedProductToPackage}}" stepKey="clickAddSelectedProduct"/> + <waitForElementNotVisible selector="{{AdminShipmentCreatePackageMainSection.saveButtonDisabled}}" stepKey="waitForBeEnabled"/> + <click selector="{{AdminShipmentCreatePackageMainSection.save}}" stepKey="clickSave"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskDisappear"/> + <waitForPageLoad stepKey="waitForSaving"/> + <see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="The shipment has been created. You created the shipping label." stepKey="seeShipmentCreateSuccess"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Shipping/Test/Mftf/ActionGroup/GoToShipmentIntoOrderActionGroup.xml b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/GoToShipmentIntoOrderActionGroup.xml new file mode 100644 index 0000000000000..7a4280cf7d6d5 --- /dev/null +++ b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/GoToShipmentIntoOrderActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="GoToShipmentIntoOrderActionGroup"> + <annotations> + <description>Clicks on the 'Ship' button on the view Admin Order page. Validates that the URL and Page Title are present and correct.</description> + </annotations> + + <click selector="{{AdminOrderDetailsMainActionsSection.ship}}" stepKey="clickShipAction"/> + <seeInCurrentUrl url="{{AdminShipmentNewPage.url}}" stepKey="seeOrderShipmentUrl"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Shipment" stepKey="seePageNameNewInvoicePage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Shipping/Test/Mftf/ActionGroup/SeeProductInShipmentItemsActionGroup.xml b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/SeeProductInShipmentItemsActionGroup.xml new file mode 100644 index 0000000000000..8ba2eff4def0f --- /dev/null +++ b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/SeeProductInShipmentItemsActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SeeProductInShipmentItemsActionGroup"> + <annotations> + <description>Validates that the provided Product is present and correct on the view Admin Order Shipment page under the 'Items Shipped' section.</description> + </annotations> + <arguments> + <argument name="product"/> + </arguments> + + <see selector="{{AdminShipmentItemsSection.skuColumn}}" userInput="{{product.sku}}" stepKey="seeProductSkuInGrid"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Shipping/Test/Mftf/ActionGroup/SubmitShipmentIntoOrderActionGroup.xml b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/SubmitShipmentIntoOrderActionGroup.xml new file mode 100644 index 0000000000000..8592566ff83b7 --- /dev/null +++ b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/SubmitShipmentIntoOrderActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SubmitShipmentIntoOrderActionGroup"> + <annotations> + <description>Clicks on the 'Submit Shipment' button on the view Admin Order Shipment page. Validates that the URL and Page Title are present and correct.</description> + </annotations> + + <click selector="{{AdminShipmentMainActionsSection.submitShipment}}" stepKey="clickSubmitShipment"/> + <seeInCurrentUrl url="{{AdminOrderDetailsPage.url}}" stepKey="seeViewOrderPageShipping"/> + <see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="The shipment has been created." stepKey="seeShipmentCreateSuccess"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Shipping/Test/Mftf/ActionGroup/VerifyBasicShipmentInformationActionGroup.xml b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/VerifyBasicShipmentInformationActionGroup.xml new file mode 100644 index 0000000000000..d76ba42003b81 --- /dev/null +++ b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/VerifyBasicShipmentInformationActionGroup.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="VerifyBasicShipmentInformationActionGroup"> + <annotations> + <description>Validates that the provided Customer, Shipping Address, Billing Address and Customer Group are present and correct on the view Admin Order page.</description> + </annotations> + <arguments> + <argument name="customer" defaultValue=""/> + <argument name="shippingAddress" defaultValue=""/> + <argument name="billingAddress" defaultValue=""/> + <argument name="customerGroup" defaultValue="GeneralCustomerGroup"/> + </arguments> + + <see selector="{{AdminShipmentOrderInformationSection.customerName}}" userInput="{{customer.firstname}}" stepKey="seeCustomerName"/> + <see selector="{{AdminShipmentOrderInformationSection.customerEmail}}" userInput="{{customer.email}}" stepKey="seeCustomerEmail"/> + <see selector="{{AdminShipmentOrderInformationSection.customerGroup}}" userInput="{{customerGroup.code}}" stepKey="seeCustomerGroup"/> + <see selector="{{AdminShipmentAddressInformationSection.billingAddress}}" userInput="{{billingAddress.street[0]}}" stepKey="seeBillingAddressStreet"/> + <see selector="{{AdminShipmentAddressInformationSection.billingAddress}}" userInput="{{billingAddress.city}}" stepKey="seeBillingAddressCity"/> + <see selector="{{AdminShipmentAddressInformationSection.billingAddress}}" userInput="{{billingAddress.country_id}}" stepKey="seeBillingAddressCountry"/> + <see selector="{{AdminShipmentAddressInformationSection.billingAddress}}" userInput="{{billingAddress.postcode}}" stepKey="seeBillingAddressPostcode"/> + <see selector="{{AdminShipmentAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.street[0]}}" stepKey="seeShippingAddressStreet"/> + <see selector="{{AdminShipmentAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.city}}" stepKey="seeShippingAddressCity"/> + <see selector="{{AdminShipmentAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.country_id}}" stepKey="seeShippingAddressCountry"/> + <see selector="{{AdminShipmentAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.postcode}}" stepKey="seeShippingAddressPostcode"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Shipping/Test/Mftf/Test/EndToEndB2CAdminTest.xml b/app/code/Magento/Shipping/Test/Mftf/Test/EndToEndB2CAdminTest.xml index a0edf4e13a80f..f1126e52359a0 100644 --- a/app/code/Magento/Shipping/Test/Mftf/Test/EndToEndB2CAdminTest.xml +++ b/app/code/Magento/Shipping/Test/Mftf/Test/EndToEndB2CAdminTest.xml @@ -14,7 +14,7 @@ <seeInCurrentUrl url="{{AdminShipmentNewPage.url}}" stepKey="seeOrderShipmentUrl" after="clickShipAction"/> <see selector="{{AdminShipmentOrderInformationSection.orderStatus}}" userInput="Processing" stepKey="seeShipmentOrderStatus" after="seeOrderShipmentUrl"/> - <actionGroup ref="verifyBasicShipmentInformation" stepKey="checkBasicShipmentOrderInfo" after="seeShipmentOrderStatus"> + <actionGroup ref="VerifyBasicShipmentInformationActionGroup" stepKey="checkBasicShipmentOrderInfo" after="seeShipmentOrderStatus"> <argument name="customer" value="Simple_US_Customer"/> <argument name="shippingAddress" value="US_Address_TX"/> <argument name="billingAddress" value="US_Address_TX"/> @@ -34,17 +34,17 @@ <see selector="{{AdminOrderShipmentsTabSection.gridRow('1')}}" userInput="{{Simple_US_Customer.firstname}}" stepKey="seeOrderShipmentInTabGrid" after="waitForShipmentTabLoad"/> <click selector="{{AdminOrderShipmentsTabSection.viewGridRow('1')}}" stepKey="clickRowToViewShipment" after="seeOrderShipmentInTabGrid"/> <see selector="{{AdminShipmentOrderInformationSection.orderId}}" userInput="$getOrderId" stepKey="seeOrderIdOnShipment" after="clickRowToViewShipment"/> - <actionGroup ref="verifyBasicShipmentInformation" stepKey="checkShipmentOrderInformation" after="seeOrderIdOnShipment"> + <actionGroup ref="VerifyBasicShipmentInformationActionGroup" stepKey="checkShipmentOrderInformation" after="seeOrderIdOnShipment"> <argument name="customer" value="Simple_US_Customer"/> <argument name="shippingAddress" value="US_Address_TX"/> <argument name="billingAddress" value="US_Address_TX"/> </actionGroup> - <actionGroup ref="seeProductInShipmentItems" stepKey="seeSimpleProductInShipmentItems" after="checkShipmentOrderInformation"> + <actionGroup ref="SeeProductInShipmentItemsActionGroup" stepKey="seeSimpleProductInShipmentItems" after="checkShipmentOrderInformation"> <argument name="product" value="SimpleProduct"/> </actionGroup> - <actionGroup ref="seeProductInShipmentItems" stepKey="seeConfigurableProductInShipmentItems" after="seeSimpleProductInShipmentItems"> + <actionGroup ref="SeeProductInShipmentItemsActionGroup" stepKey="seeConfigurableProductInShipmentItems" after="seeSimpleProductInShipmentItems"> <argument name="product" value="BaseConfigurableProduct"/> </actionGroup> <click selector="{{AdminShipmentOrderInformationSection.orderId}}" stepKey="clickOrderIdOnShipment" after="seeConfigurableProductInShipmentItems"/> </test> -</tests> \ No newline at end of file +</tests> From 2f46384b0d783a0d19f0f2ca4164abc33c91ca8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 9 Jan 2020 01:27:52 +0100 Subject: [PATCH 0739/1143] REFACTOR: Extract Action Groups to separate files (MFTF best practices) --- .../AdminCloneProductWithDuplicateUrlTest.xml | 4 ++-- .../AdminCreateProductDuplicateUrlkeyTest.xml | 4 ++-- ...dPageNumberAfterSaveAndCloseActionTest.xml | 2 +- ...roductGridFilteringByDateAttributeTest.xml | 2 +- ...bleProductPriceAdditionalStoreViewTest.xml | 12 +++++------ ...efrontVisibilityOfDuplicateProductTest.xml | 2 +- .../AdminFormSaveAndCloseActionGroup.xml | 20 +++++++++++++++++++ ... AdminFormSaveAndDuplicateActionGroup.xml} | 16 +++------------ 8 files changed, 36 insertions(+), 26 deletions(-) create mode 100644 app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminFormSaveAndCloseActionGroup.xml rename app/code/Magento/Ui/Test/Mftf/ActionGroup/{AdminSaveAndCloseActionGroup.xml => AdminFormSaveAndDuplicateActionGroup.xml} (57%) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCloneProductWithDuplicateUrlTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCloneProductWithDuplicateUrlTest.xml index ee9e364758899..cef5bc622c6cf 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCloneProductWithDuplicateUrlTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCloneProductWithDuplicateUrlTest.xml @@ -38,7 +38,7 @@ <waitForPageLoad stepKey="waitForSimpleProductPageLoad"/> <!--Save and duplicated the product once--> <comment userInput="Save and duplicated the product once" stepKey="commentSaveAndDuplicateProduct"/> - <actionGroup ref="AdminFormSaveAndDuplicate" stepKey="saveAndDuplicateProductFormFirstTime"/> + <actionGroup ref="AdminFormSaveAndDuplicateActionGroup" stepKey="saveAndDuplicateProductFormFirstTime"/> <conditionalClick selector="{{AdminProductSEOSection.sectionHeader}}" dependentSelector="{{AdminProductSEOSection.urlKeyInput}}" visible="false" stepKey="openSEOSection"/> <grabValueFrom selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="grabDuplicatedProductUrlKey"/> <assertContains expected="$$createSimpleProduct.custom_attributes[url_key]$$" actual="$grabDuplicatedProductUrlKey" stepKey="assertDuplicatedProductUrlKey"/> @@ -65,7 +65,7 @@ <comment userInput="Save and duplicated the product second time" stepKey="commentSaveAndDuplicateProduct1"/> <amOnPage url="{{AdminProductEditPage.url($$createSimpleProduct.id$$)}}" stepKey="goToProductEditPage1"/> <waitForPageLoad stepKey="waitForSimpleProductPageLoad2"/> - <actionGroup ref="AdminFormSaveAndDuplicate" stepKey="saveAndDuplicateProductFormSecondTime"/> + <actionGroup ref="AdminFormSaveAndDuplicateActionGroup" stepKey="saveAndDuplicateProductFormSecondTime"/> <conditionalClick selector="{{AdminProductSEOSection.sectionHeader}}" dependentSelector="{{AdminProductSEOSection.urlKeyInput}}" visible="false" stepKey="openProductSEOSection"/> <waitForElementVisible selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="waitForUrlKeyField"/> <grabValueFrom selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="grabSecondDuplicatedProductUrlKey"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductDuplicateUrlkeyTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductDuplicateUrlkeyTest.xml index f5e42bb84549c..eacb69db38e9a 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductDuplicateUrlkeyTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductDuplicateUrlkeyTest.xml @@ -72,7 +72,7 @@ <argument name="product" value="$$createSimpleProduct$$"/> </actionGroup> <!--Save and duplicated the product once--> - <actionGroup ref="AdminFormSaveAndDuplicate" stepKey="saveAndDuplicateProductForm1"/> + <actionGroup ref="AdminFormSaveAndDuplicateActionGroup" stepKey="saveAndDuplicateProductForm1"/> <actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForSimpleProduct2"> <argument name="product" value="$$createSimpleProduct$$"/> </actionGroup> @@ -80,6 +80,6 @@ <argument name="product" value="$$createSimpleProduct$$"/> </actionGroup> <!--Save and duplicated the product second time--> - <actionGroup ref="AdminFormSaveAndDuplicate" stepKey="saveAndDuplicateProductForm2"/> + <actionGroup ref="AdminFormSaveAndDuplicateActionGroup" stepKey="saveAndDuplicateProductForm2"/> </test> </tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminGridPageNumberAfterSaveAndCloseActionTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminGridPageNumberAfterSaveAndCloseActionTest.xml index fbc0354482a32..81d032850bf5a 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminGridPageNumberAfterSaveAndCloseActionTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminGridPageNumberAfterSaveAndCloseActionTest.xml @@ -61,7 +61,7 @@ <actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openEditProduct2"> <argument name="product" value="$$product2$$"/> </actionGroup> - <actionGroup ref="AdminFormSaveAndClose" stepKey="saveAndCloseProduct"/> + <actionGroup ref="AdminFormSaveAndCloseActionGroup" stepKey="saveAndCloseProduct"/> <waitForPageLoad stepKey="waitForPageLoad1"/> <seeInField selector="{{AdminDataGridPaginationSection.currentPage}}" userInput="2" stepKey="seeOnSecondPageOrderGrid"/> </test> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridFilteringByDateAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridFilteringByDateAttributeTest.xml index df2b525a56086..d9f894fa5736b 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridFilteringByDateAttributeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridFilteringByDateAttributeTest.xml @@ -48,7 +48,7 @@ <actionGroup ref="FilterProductGridBySetNewFromDateActionGroup" stepKey="filterProductGridToCheckSetAsNewColumn"/> <click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnFirstRowProductGrid"/> <waitForPageLoad stepKey="waitForProductEditPageToLoad"/> - <actionGroup ref="AdminFormSaveAndClose" stepKey="saveAndCloseProductForm"/> + <actionGroup ref="AdminFormSaveAndCloseActionGroup" stepKey="saveAndCloseProductForm"/> <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="expandFilters"/> <seeInField selector="{{AdminProductGridFilterSection.newFromDateFilter}}" userInput="05/16/2018" stepKey="checkForNewFromDate"/> <click selector="{{AdminProductGridFilterSection.columnsDropdown}}" stepKey="openColumnsDropdown2"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ConfigurableProductPriceAdditionalStoreViewTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ConfigurableProductPriceAdditionalStoreViewTest.xml index 0b078bc7d2a98..124f0eea2e77a 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ConfigurableProductPriceAdditionalStoreViewTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ConfigurableProductPriceAdditionalStoreViewTest.xml @@ -140,7 +140,7 @@ <waitForElementVisible selector="{{AdminProductFormSection.enableProductLabel}}" stepKey="waitForProductEnableSlider"/> <click selector="{{AdminProductFormSection.enableProductLabel}}" stepKey="enableProductForSecondStoreView"/> <seeCheckboxIsChecked selector="{{AdminProductFormSection.productStatus}}" stepKey="seeThatProductIsEnabled"/> - <actionGroup ref="AdminFormSaveAndClose" stepKey="enabledConfigProductSecondStore"/> + <actionGroup ref="AdminFormSaveAndCloseActionGroup" stepKey="enabledConfigProductSecondStore"/> <!--go to admin and open product edit page to enable child product for second store view --> <amOnPage url="{{AdminProductEditPage.url($$createConfigProduct.id$$)}}" stepKey="goToProductEditPage2"/> @@ -154,7 +154,7 @@ <click selector="{{AdminProductFormConfigurationsSection.enableProductBtn}}" stepKey="clickEnableChildProduct1"/> <click selector="{{AdminProductFormConfigurationsSection.actionsBtn('2')}}" stepKey="clickToExpandActionsForSecondVariation2"/> <click selector="{{AdminProductFormConfigurationsSection.enableProductBtn}}" stepKey="clickEnableChildProduct2"/> - <actionGroup ref="AdminFormSaveAndClose" stepKey="saveAll"/> + <actionGroup ref="AdminFormSaveAndCloseActionGroup" stepKey="saveAll"/> <!-- assert second store view storefront category list page --> <amOnPage url="/second_store_view/" stepKey="amOnsecondStoreFront1"/> @@ -168,7 +168,7 @@ <waitForPageLoad stepKey="waitChild1EditPageToLoad"/> <click selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="openProduct1InWebsitesSection"/> <click selector="{{ProductInWebsitesSection.website('Second Website')}}" stepKey="selectSecondWebsite1"/> - <actionGroup ref="AdminFormSaveAndClose" stepKey="saveUpdatedChild1Again"/> + <actionGroup ref="AdminFormSaveAndCloseActionGroup" stepKey="saveUpdatedChild1Again"/> <!--go to admin again and open child product1 and enable for second store view--> <amOnPage url="{{AdminProductEditPage.url($$createConfigChildProduct1.id$$)}}" stepKey="goToProduct1EditPage"/> @@ -180,14 +180,14 @@ <see userInput="Second Store View" selector="{{AdminMainActionsSection.storeSwitcher}}" stepKey="seeNewStoreViewNameP1"/> <waitForElementVisible selector="{{AdminProductFormSection.enableProductLabel}}" stepKey="waitForProductEnableSliderP1"/> <seeCheckboxIsChecked selector="{{AdminProductFormSection.productStatus}}" stepKey="seeThatProduct1IsEnabled"/> - <actionGroup ref="AdminFormSaveAndClose" stepKey="save2UpdatedChild1"/> + <actionGroup ref="AdminFormSaveAndCloseActionGroup" stepKey="save2UpdatedChild1"/> <!--go to admin and open child product2 edit page and assign it to the second website --> <amOnPage url="{{AdminProductEditPage.url($$createConfigChildProduct2.id$$)}}" stepKey="goToProduct2EditPage"/> <waitForPageLoad stepKey="waitChild2EditPageToLoad"/> <click selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="openProduct2InWebsitesSection"/> <click selector="{{ProductInWebsitesSection.website('Second Website')}}" stepKey="selectSecondWebsite2"/> - <actionGroup ref="AdminFormSaveAndClose" stepKey="saveUpdatedChild2"/> + <actionGroup ref="AdminFormSaveAndCloseActionGroup" stepKey="saveUpdatedChild2"/> <!--go to admin again and open child product2 and enable for second store view--> <amOnPage url="{{AdminProductEditPage.url($$createConfigChildProduct2.id$$)}}" stepKey="goToProduct2EditPage2"/> @@ -199,7 +199,7 @@ <see userInput="Second Store View" selector="{{AdminMainActionsSection.storeSwitcher}}" stepKey="seeNewStoreViewNameP2"/> <waitForElementVisible selector="{{AdminProductFormSection.enableProductLabel}}" stepKey="waitForProductEnableSliderP2"/> <seeCheckboxIsChecked selector="{{AdminProductFormSection.productStatus}}" stepKey="seeThatProduct2IsEnabled"/> - <actionGroup ref="AdminFormSaveAndClose" stepKey="save2UpdatedChild2"/> + <actionGroup ref="AdminFormSaveAndCloseActionGroup" stepKey="save2UpdatedChild2"/> <!-- assert storefront category list page --> <amOnPage url="/second_store_view/" stepKey="amOnsecondStoreFront"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontVisibilityOfDuplicateProductTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontVisibilityOfDuplicateProductTest.xml index 2cdad86aa0b2c..b8b0007c63d5f 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontVisibilityOfDuplicateProductTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontVisibilityOfDuplicateProductTest.xml @@ -114,7 +114,7 @@ <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> <!--Duplicate the product--> <comment userInput="Duplicate the product" stepKey="commentDuplicateProduct"/> - <actionGroup ref="AdminFormSaveAndDuplicate" stepKey="saveAndDuplicateProductForm"/> + <actionGroup ref="AdminFormSaveAndDuplicateActionGroup" stepKey="saveAndDuplicateProductForm"/> <click selector="{{AdminProductFormSection.enableProductLabel}}" stepKey="clickEnableProduct"/> <fillField selector="{{AdminProductFormSection.productName}}" userInput="$$createConfigProduct.name$$-Updated" stepKey="fillProductName"/> <selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="1" stepKey="selectInStock"/> diff --git a/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminFormSaveAndCloseActionGroup.xml b/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminFormSaveAndCloseActionGroup.xml new file mode 100644 index 0000000000000..a1b8c8c7609e1 --- /dev/null +++ b/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminFormSaveAndCloseActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminFormSaveAndCloseActionGroup"> + <annotations> + <description>Clicks on 'Save and Close'. Validates that the Success Message is present.</description> + </annotations> + + <click selector="{{AdminProductFormActionSection.saveArrow}}" stepKey="openSaveDropDown"/> + <click selector="{{AdminProductFormActionSection.saveAndClose}}" stepKey="clickOnSaveAndClose"/> + <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="assertSaveMessageSuccess"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminSaveAndCloseActionGroup.xml b/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminFormSaveAndDuplicateActionGroup.xml similarity index 57% rename from app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminSaveAndCloseActionGroup.xml rename to app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminFormSaveAndDuplicateActionGroup.xml index d4e1c7e3ba873..322fbffd90427 100644 --- a/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminSaveAndCloseActionGroup.xml +++ b/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminFormSaveAndDuplicateActionGroup.xml @@ -7,18 +7,8 @@ --> <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AdminFormSaveAndClose"> - <annotations> - <description>Clicks on 'Save and Close'. Validates that the Success Message is present.</description> - </annotations> - - <click selector="{{AdminProductFormActionSection.saveArrow}}" stepKey="openSaveDropDown"/> - <click selector="{{AdminProductFormActionSection.saveAndClose}}" stepKey="clickOnSaveAndClose"/> - <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="assertSaveMessageSuccess"/> - </actionGroup> - - <actionGroup name="AdminFormSaveAndDuplicate"> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminFormSaveAndDuplicateActionGroup"> <annotations> <description>Clicks on 'Save and Duplicate'. Validates that the Success Message is present and correct.</description> </annotations> @@ -27,5 +17,5 @@ <click selector="{{AdminProductFormActionSection.saveAndDuplicate}}" stepKey="clickOnSaveAndDuplicate"/> <see selector="{{AdminProductMessagesSection.successMessage}}" stepKey="assertSaveSuccess" userInput="You saved the product."/> <see selector="{{AdminProductMessagesSection.successMessage}}" stepKey="assertDuplicateSuccess" userInput="You duplicated the product."/> - </actionGroup> + </actionGroup> </actionGroups> From 710d6920bbf7ef6569c74d91989f19768ffd6483 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 9 Jan 2020 01:31:55 +0100 Subject: [PATCH 0740/1143] REFACTOR: Extract Action Groups to separate files (MFTF best practices) --- ...figurableProductInWishlistActionGroup.xml} | 18 +------------ ...bleProductInWishlistSidebarActionGroup.xml | 26 +++++++++++++++++++ .../Test/EndToEndB2CLoggedInUserTest.xml | 4 +-- 3 files changed, 29 insertions(+), 19 deletions(-) rename dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductWishlist/ActionGroup/{StorefrontCustomerWishlistActionGroup.xml => StorefrontCustomerCheckConfigurableProductInWishlistActionGroup.xml} (57%) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductWishlist/ActionGroup/StorefrontCustomerCheckConfigurableProductInWishlistSidebarActionGroup.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductWishlist/ActionGroup/StorefrontCustomerWishlistActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductWishlist/ActionGroup/StorefrontCustomerCheckConfigurableProductInWishlistActionGroup.xml similarity index 57% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductWishlist/ActionGroup/StorefrontCustomerWishlistActionGroup.xml rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductWishlist/ActionGroup/StorefrontCustomerCheckConfigurableProductInWishlistActionGroup.xml index 598ff8deabcc0..8ea33d82f278a 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductWishlist/ActionGroup/StorefrontCustomerWishlistActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductWishlist/ActionGroup/StorefrontCustomerCheckConfigurableProductInWishlistActionGroup.xml @@ -9,7 +9,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <!-- Check configurable product in wishlist --> - <actionGroup name="StorefrontCustomerCheckConfigurableProductInWishlist"> + <actionGroup name="StorefrontCustomerCheckConfigurableProductInWishlistActionGroup"> <annotations> <description>Validates that the provided Configurable Product and Product Option is present in the Storefront Wish List.</description> </annotations> @@ -24,20 +24,4 @@ <seeElement selector="{{StorefrontCustomerWishlistProductSection.ProductAddToCartByName(productVar.name)}}" stepKey="AssertWishlistAddToCart"/> <seeElement selector="{{StorefrontCustomerWishlistProductSection.ProductImageByName(productVar.name)}}" stepKey="AssertWishlistProductImage"/> </actionGroup> - - <!-- Check configurable product in wishlist sidebar --> - <actionGroup name="StorefrontCustomerCheckConfigurableProductInWishlistSidebar"> - <annotations> - <description>Validates that the provided Configurable Product and Product Option is present in the Storefront Wish List sidebar.</description> - </annotations> - <arguments> - <argument name="productVar"/> - <argument name="optionProductVar"/> - </arguments> - - <waitForElement selector="{{StorefrontCustomerWishlistSidebarSection.ProductTitleByName(productVar.name)}}" time="30" stepKey="assertWishlistSidebarProductName"/> - <see userInput="${{optionProductVar.price}}.00" selector="{{StorefrontCustomerWishlistSidebarSection.ProductPriceByName(productVar.name)}}" stepKey="AssertWishlistSidebarProductPrice"/> - <seeElement selector="{{StorefrontCustomerWishlistSidebarSection.ProductAddToCartByName(productVar.name)}}" stepKey="AssertWishlistSidebarAddToCart"/> - <seeElement selector="{{StorefrontCustomerWishlistSidebarSection.ProductImageByName(productVar.name)}}" stepKey="AssertWishlistSidebarProductImage"/> - </actionGroup> </actionGroups> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductWishlist/ActionGroup/StorefrontCustomerCheckConfigurableProductInWishlistSidebarActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductWishlist/ActionGroup/StorefrontCustomerCheckConfigurableProductInWishlistSidebarActionGroup.xml new file mode 100644 index 0000000000000..604e97bf0a515 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductWishlist/ActionGroup/StorefrontCustomerCheckConfigurableProductInWishlistSidebarActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <!-- Check configurable product in wishlist sidebar --> + <actionGroup name="StorefrontCustomerCheckConfigurableProductInWishlistSidebarActionGroup"> + <annotations> + <description>Validates that the provided Configurable Product and Product Option is present in the Storefront Wish List sidebar.</description> + </annotations> + <arguments> + <argument name="productVar"/> + <argument name="optionProductVar"/> + </arguments> + + <waitForElement selector="{{StorefrontCustomerWishlistSidebarSection.ProductTitleByName(productVar.name)}}" time="30" stepKey="assertWishlistSidebarProductName"/> + <see userInput="${{optionProductVar.price}}.00" selector="{{StorefrontCustomerWishlistSidebarSection.ProductPriceByName(productVar.name)}}" stepKey="AssertWishlistSidebarProductPrice"/> + <seeElement selector="{{StorefrontCustomerWishlistSidebarSection.ProductAddToCartByName(productVar.name)}}" stepKey="AssertWishlistSidebarAddToCart"/> + <seeElement selector="{{StorefrontCustomerWishlistSidebarSection.ProductImageByName(productVar.name)}}" stepKey="AssertWishlistSidebarProductImage"/> + </actionGroup> +</actionGroups> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductWishlist/Test/EndToEndB2CLoggedInUserTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductWishlist/Test/EndToEndB2CLoggedInUserTest.xml index cb3d9edbc1cbb..ec6edcea3b357 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductWishlist/Test/EndToEndB2CLoggedInUserTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductWishlist/Test/EndToEndB2CLoggedInUserTest.xml @@ -17,11 +17,11 @@ <actionGroup ref="StorefrontCustomerAddProductToWishlistActionGroup" after="wishlistClickConfigurableProduct" stepKey="wishlistAddConfigurableProductToWishlist"> <argument name="productVar" value="$$createConfigProduct$$"/> </actionGroup> - <actionGroup ref="StorefrontCustomerCheckConfigurableProductInWishlist" after="wishlistAddConfigurableProductToWishlist" stepKey="wishlistCheckConfigurableProductInWishlist"> + <actionGroup ref="StorefrontCustomerCheckConfigurableProductInWishlistActionGroup" after="wishlistAddConfigurableProductToWishlist" stepKey="wishlistCheckConfigurableProductInWishlist"> <argument name="productVar" value="$$createConfigProduct$$"/> <argument name="optionProductVar" value="$$createConfigChildProduct1$$"/> </actionGroup> - <actionGroup ref="StorefrontCustomerCheckConfigurableProductInWishlistSidebar" after="wishlistCheckConfigurableProductInWishlist" stepKey="wishlistCheckConfigurableProductInWishlistSidebar"> + <actionGroup ref="StorefrontCustomerCheckConfigurableProductInWishlistSidebarActionGroup" after="wishlistCheckConfigurableProductInWishlist" stepKey="wishlistCheckConfigurableProductInWishlistSidebar"> <argument name="productVar" value="$$createConfigProduct$$"/> <argument name="optionProductVar" value="$$createConfigChildProduct1$$"/> </actionGroup> From 93e0800e97f4166b216539318f001952b475e49d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 9 Jan 2020 01:55:44 +0100 Subject: [PATCH 0741/1143] REFACTOR: Extract Action Groups to separate files (MFTF best practices) --- .../ActionGroup/_Deprecated_ActionGroup.xml | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 app/code/Magento/Shipping/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml diff --git a/app/code/Magento/Shipping/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml new file mode 100644 index 0000000000000..30b5def5fe670 --- /dev/null +++ b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <!-- Temporary file to pass CI verification --> + <actionGroup name="goToShipmentIntoOrder"> + <annotations> + <description>Clicks on the 'Ship' button on the view Admin Order page. Validates that the URL and Page Title are present and correct.</description> + </annotations> + + <click selector="{{AdminOrderDetailsMainActionsSection.ship}}" stepKey="clickShipAction"/> + <seeInCurrentUrl url="{{AdminShipmentNewPage.url}}" stepKey="seeOrderShipmentUrl"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Shipment" stepKey="seePageNameNewInvoicePage"/> + </actionGroup> + <actionGroup name="submitShipmentIntoOrder"> + <annotations> + <description>Clicks on the 'Submit Shipment' button on the view Admin Order Shipment page. Validates that the URL and Page Title are present and correct.</description> + </annotations> + + <click selector="{{AdminShipmentMainActionsSection.submitShipment}}" stepKey="clickSubmitShipment"/> + <seeInCurrentUrl url="{{AdminOrderDetailsPage.url}}" stepKey="seeViewOrderPageShipping"/> + <see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="The shipment has been created." stepKey="seeShipmentCreateSuccess"/> + </actionGroup> +</actionGroups> From d5fa89c0d9e1467246034eb9efe6d23ebd986966 Mon Sep 17 00:00:00 2001 From: Soumya Unnikrishnan <sunnikri@adobe.com> Date: Wed, 8 Jan 2020 18:59:03 -0600 Subject: [PATCH 0742/1143] MQE-1920: [MTF-To-MFTF] Process PR 701 Added wait to fix jenkins failure --- .../Test/Mftf/ActionGroup/FillOutCMSPageContentActionGroup.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/FillOutCMSPageContentActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/FillOutCMSPageContentActionGroup.xml index 1bf74ba206bbd..a4ffff5c8760a 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/FillOutCMSPageContentActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/FillOutCMSPageContentActionGroup.xml @@ -15,8 +15,8 @@ <fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{_duplicatedCMSPage.title}}" stepKey="fillFieldTitle"/> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickExpandContentTabForPage"/> - <waitForElementVisible selector="{{CmsNewPagePageContentSection.contentHeading}}" stepKey="waitForContentSection"/> <fillField selector="{{CmsNewPagePageContentSection.contentHeading}}" userInput="{{_duplicatedCMSPage.content_heading}}" stepKey="fillFieldContentHeading"/> + <wait time="5" stepKey="waitForTextAreaToAppear"/> <fillField selector="{{CmsNewPagePageContentSection.content}}" userInput="{{_duplicatedCMSPage.content}}" stepKey="fillFieldContent"/> <click selector="{{CmsNewPagePageSeoSection.header}}" stepKey="clickExpandSearchEngineOptimisation"/> <fillField selector="{{CmsNewPagePageSeoSection.urlKey}}" userInput="{{_duplicatedCMSPage.identifier}}" stepKey="fillFieldUrlKey"/> From fc8dee7377202d75c789d2200c412e11d63d1cbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 9 Jan 2020 02:50:27 +0100 Subject: [PATCH 0743/1143] REFACTOR: Extract Action Groups to separate files (MFTF best practices) --- .../ActionGroup/_Deprecated_ActionGroup.xml | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/app/code/Magento/Shipping/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml index 30b5def5fe670..28160ae9e4ebb 100644 --- a/app/code/Magento/Shipping/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml +++ b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml @@ -27,4 +27,37 @@ <seeInCurrentUrl url="{{AdminOrderDetailsPage.url}}" stepKey="seeViewOrderPageShipping"/> <see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="The shipment has been created." stepKey="seeShipmentCreateSuccess"/> </actionGroup> + <actionGroup name="seeProductInShipmentItems"> + <annotations> + <description>Validates that the provided Product is present and correct on the view Admin Order Shipment page under the 'Items Shipped' section.</description> + </annotations> + <arguments> + <argument name="product"/> + </arguments> + + <see selector="{{AdminShipmentItemsSection.skuColumn}}" userInput="{{product.sku}}" stepKey="seeProductSkuInGrid"/> + </actionGroup> + <actionGroup name="verifyBasicShipmentInformation"> + <annotations> + <description>Validates that the provided Customer, Shipping Address, Billing Address and Customer Group are present and correct on the view Admin Order page.</description> + </annotations> + <arguments> + <argument name="customer" defaultValue=""/> + <argument name="shippingAddress" defaultValue=""/> + <argument name="billingAddress" defaultValue=""/> + <argument name="customerGroup" defaultValue="GeneralCustomerGroup"/> + </arguments> + + <see selector="{{AdminShipmentOrderInformationSection.customerName}}" userInput="{{customer.firstname}}" stepKey="seeCustomerName"/> + <see selector="{{AdminShipmentOrderInformationSection.customerEmail}}" userInput="{{customer.email}}" stepKey="seeCustomerEmail"/> + <see selector="{{AdminShipmentOrderInformationSection.customerGroup}}" userInput="{{customerGroup.code}}" stepKey="seeCustomerGroup"/> + <see selector="{{AdminShipmentAddressInformationSection.billingAddress}}" userInput="{{billingAddress.street[0]}}" stepKey="seeBillingAddressStreet"/> + <see selector="{{AdminShipmentAddressInformationSection.billingAddress}}" userInput="{{billingAddress.city}}" stepKey="seeBillingAddressCity"/> + <see selector="{{AdminShipmentAddressInformationSection.billingAddress}}" userInput="{{billingAddress.country_id}}" stepKey="seeBillingAddressCountry"/> + <see selector="{{AdminShipmentAddressInformationSection.billingAddress}}" userInput="{{billingAddress.postcode}}" stepKey="seeBillingAddressPostcode"/> + <see selector="{{AdminShipmentAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.street[0]}}" stepKey="seeShippingAddressStreet"/> + <see selector="{{AdminShipmentAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.city}}" stepKey="seeShippingAddressCity"/> + <see selector="{{AdminShipmentAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.country_id}}" stepKey="seeShippingAddressCountry"/> + <see selector="{{AdminShipmentAddressInformationSection.shippingAddress}}" userInput="{{shippingAddress.postcode}}" stepKey="seeShippingAddressPostcode"/> + </actionGroup> </actionGroups> From cdb6e7ef1a4a6c511263bfcca613a954acf4835d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 9 Jan 2020 03:02:44 +0100 Subject: [PATCH 0744/1143] REFACTOR: Extract Action Groups to separate files (MFTF best practices) --- .../ActionGroup/_Deprecated_ActionGroup.xml | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 app/code/Magento/Ui/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml diff --git a/app/code/Magento/Ui/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Ui/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml new file mode 100644 index 0000000000000..681ada9484618 --- /dev/null +++ b/app/code/Magento/Ui/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminFormSaveAndClose"> + <annotations> + <description>Clicks on 'Save and Close'. Validates that the Success Message is present.</description> + </annotations> + + <click selector="{{AdminProductFormActionSection.saveArrow}}" stepKey="openSaveDropDown"/> + <click selector="{{AdminProductFormActionSection.saveAndClose}}" stepKey="clickOnSaveAndClose"/> + <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="assertSaveMessageSuccess"/> + </actionGroup> + <actionGroup name="AdminFormSaveAndDuplicate"> + <annotations> + <description>Clicks on 'Save and Duplicate'. Validates that the Success Message is present and correct.</description> + </annotations> + + <click selector="{{AdminProductFormActionSection.saveArrow}}" stepKey="openSaveDropDown"/> + <click selector="{{AdminProductFormActionSection.saveAndDuplicate}}" stepKey="clickOnSaveAndDuplicate"/> + <see selector="{{AdminProductMessagesSection.successMessage}}" stepKey="assertSaveSuccess" userInput="You saved the product."/> + <see selector="{{AdminProductMessagesSection.successMessage}}" stepKey="assertDuplicateSuccess" userInput="You duplicated the product."/> + </actionGroup> +</actionGroups> From ee152fcab0a5913d21d79ed4ced54a65c96f76bc Mon Sep 17 00:00:00 2001 From: Ravi Chandra <ravi.chandra@krishtechnolabs.com> Date: Thu, 9 Jan 2020 10:31:56 +0530 Subject: [PATCH 0745/1143] Add automated test for update TierPrice --- .../Attribute/Backend/TierPrice/UpdateHandlerTest.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Backend/TierPrice/UpdateHandlerTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Backend/TierPrice/UpdateHandlerTest.php index fde793d5c5f89..c389a88043dd5 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Backend/TierPrice/UpdateHandlerTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Backend/TierPrice/UpdateHandlerTest.php @@ -128,6 +128,12 @@ public function testExecute(): void ['entity_id', $originalProductId] ] ); + $this->assertEquals($this->assertNotNull($newTierPrices[0]['price']), + $this->tierPriceResource->expects($this->atLeastOnce()) + ->method('updateValues')->with($newTierPrices, $originalTierPrices)->willReturn(true)); + $this->assertEquals($this->assertNull($newTierPrices[0]['price']), + $this->tierPriceResource->expects($this->atLeastOnce()) + ->method('updateValues')->with($newTierPrices, $originalTierPrices)->willReturn(false)); $product->expects($this->atLeastOnce())->method('getStoreId')->willReturn(0); $product->expects($this->atLeastOnce())->method('setData')->with('tier_price_changed', 1); $store = $this->getMockBuilder(\Magento\Store\Api\Data\StoreInterface::class) @@ -163,7 +169,6 @@ public function testExecute(): void $this->tierPriceResource->expects($this->exactly(2))->method('savePriceData')->willReturnSelf(); $this->tierPriceResource->expects($this->once())->method('deletePriceData') ->with($productId, null, $priceIdToDelete); - $this->assertEquals($product, $this->updateHandler->execute($product)); } From b613a1633f81c171350c0b7d78db140f228cc42f Mon Sep 17 00:00:00 2001 From: DianaRusin <rusind95@gmail.com> Date: Thu, 9 Jan 2020 10:05:19 +0200 Subject: [PATCH 0746/1143] MC-25250: DropDown attribute with label 'select' break product edit page --- app/code/Magento/Backend/view/adminhtml/web/js/translate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Backend/view/adminhtml/web/js/translate.js b/app/code/Magento/Backend/view/adminhtml/web/js/translate.js index d6e1547600c4e..d40c32e816126 100644 --- a/app/code/Magento/Backend/view/adminhtml/web/js/translate.js +++ b/app/code/Magento/Backend/view/adminhtml/web/js/translate.js @@ -35,7 +35,7 @@ define([ * @return {String} */ this.translate = function (text) { - return _data[text] ? _data[text] : text; + return (typeof _data[text] === 'string') ? _data[text]: text; }; return this; From b2ac86ec5a841c7c1374cca9897aac5c856adb6d Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Thu, 9 Jan 2020 10:55:07 +0200 Subject: [PATCH 0747/1143] MC-29960: [Magento Cloud] Unable to delete CSV files from Export Grid --- .../Component/Columns/ExportGridActions.php | 10 ++- .../DataProvider/ExportFileDataProvider.php | 33 ++++++++- .../Adminhtml/Export/File/DeleteTest.php | 58 +++++++++++++--- .../Adminhtml/Export/File/DownloadTest.php | 68 ++++++++++++++----- 4 files changed, 135 insertions(+), 34 deletions(-) diff --git a/app/code/Magento/ImportExport/Ui/Component/Columns/ExportGridActions.php b/app/code/Magento/ImportExport/Ui/Component/Columns/ExportGridActions.php index b5e36ccd9fbab..2cdc39866a521 100644 --- a/app/code/Magento/ImportExport/Ui/Component/Columns/ExportGridActions.php +++ b/app/code/Magento/ImportExport/Ui/Component/Columns/ExportGridActions.php @@ -56,11 +56,17 @@ public function prepareDataSource(array $dataSource) $name = $this->getData('name'); if (isset($item['file_name'])) { $item[$name]['view'] = [ - 'href' => $this->urlBuilder->getUrl(Download::URL, ['filename' => $item['file_name']]), + 'href' => $this->urlBuilder->getUrl( + Download::URL, + ['_query' => ['filename' => $item['file_name']]] + ), 'label' => __('Download') ]; $item[$name]['delete'] = [ - 'href' => $this->urlBuilder->getUrl(Delete::URL, ['filename' => $item['file_name']]), + 'href' => $this->urlBuilder->getUrl( + Delete::URL, + ['_query' => ['filename' => $item['file_name']]] + ), 'label' => __('Delete'), 'confirm' => [ 'title' => __('Delete'), diff --git a/app/code/Magento/ImportExport/Ui/DataProvider/ExportFileDataProvider.php b/app/code/Magento/ImportExport/Ui/DataProvider/ExportFileDataProvider.php index 83203f1ad8aff..57d1982d3500f 100644 --- a/app/code/Magento/ImportExport/Ui/DataProvider/ExportFileDataProvider.php +++ b/app/code/Magento/ImportExport/Ui/DataProvider/ExportFileDataProvider.php @@ -100,7 +100,7 @@ public function getData() } $result = []; foreach ($files as $file) { - $result['items'][]['file_name'] = $this->fileIO->getPathInfo($file)['basename']; + $result['items'][]['file_name'] = $this->getPathToExportFile($this->fileIO->getPathInfo($file)); } $pageSize = (int) $this->request->getParam('paging')['pageSize']; @@ -112,6 +112,31 @@ public function getData() return $result; } + /** + * Return relative export file path after "var/export" + * + * @param mixed $file + * @return string + */ + private function getPathToExportFile($file): string + { + $directory = $this->fileSystem->getDirectoryRead(DirectoryList::VAR_DIR); + $delimiter = '/'; + $cutPath = explode( + $delimiter, + $directory->getAbsolutePath() . 'export' + ); + $filePath = explode( + $delimiter, + $file['dirname'] + ); + + return ltrim( + implode($delimiter, array_diff($filePath, $cutPath)) . $delimiter . $file['basename'], + $delimiter + ); + } + /** * Get files from directory path, sort them by date modified and return sorted array of full path to files * @@ -127,8 +152,10 @@ private function getExportFiles(string $directoryPath): array return []; } foreach ($files as $filePath) { - //phpcs:ignore Magento2.Functions.DiscouragedFunction - $sortedFiles[filemtime($filePath)] = $filePath; + if ($this->file->isFile($filePath)) { + //phpcs:ignore Magento2.Functions.DiscouragedFunction + $sortedFiles[filemtime($filePath)] = $filePath; + } } //sort array elements using key value krsort($sortedFiles); diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/Export/File/DeleteTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/Export/File/DeleteTest.php index 91764684da173..6b1463aa1a9df 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/Export/File/DeleteTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/Export/File/DeleteTest.php @@ -29,6 +29,16 @@ class DeleteTest extends AbstractBackendController */ private $fileName = 'catalog_product.csv'; + /** + * @var Filesystem + */ + private $fileSystem; + + /** + * @var string + */ + private $sourceFilePath; + /** * @inheritdoc */ @@ -36,35 +46,61 @@ protected function setUp() { parent::setUp(); - $filesystem = $this->_objectManager->get(Filesystem::class); - $sourceFilePath = __DIR__ . '/../../Import/_files' . DIRECTORY_SEPARATOR . $this->fileName; - $destinationFilePath = 'export' . DIRECTORY_SEPARATOR . $this->fileName; + $this->fileSystem = $this->_objectManager->get(Filesystem::class); + $this->sourceFilePath = __DIR__ . '/../../Import/_files' . DIRECTORY_SEPARATOR . $this->fileName; //Refers to tests 'var' directory - $this->varDirectory = $filesystem->getDirectoryRead(DirectoryList::VAR_DIR); - //Refers to application root directory - $rootDirectory = $filesystem->getDirectoryWrite(DirectoryList::ROOT); - $rootDirectory->copyFile($sourceFilePath, $this->varDirectory->getAbsolutePath($destinationFilePath)); + $this->varDirectory = $this->fileSystem->getDirectoryRead(DirectoryList::VAR_DIR); } /** * Check that file can be removed under var/export directory. * + * @param string $file + * @dataProvider testExecuteProvider * @return void * @magentoConfigFixture default_store admin/security/use_form_key 1 */ - public function testExecute(): void + public function testExecute($file): void { + $fullPath = 'export/' . $file; + $this->copyFile($fullPath); $request = $this->getRequest(); - $request->setParam('filename', $this->fileName); + $request->setParam('filename', $file); $request->setMethod(Http::METHOD_POST); - if ($this->varDirectory->isExist('export/' . $this->fileName)) { + if ($this->varDirectory->isExist($fullPath)) { $this->dispatch('backend/admin/export_file/delete'); } else { throw new \AssertionError('Export product file supposed to exist'); } - $this->assertFalse($this->varDirectory->isExist('export/' . $this->fileName)); + $this->assertFalse($this->varDirectory->isExist($fullPath)); + } + + /** + * Copy csv file from sourceFilePath to destinationFilePath + * + * @param $destinationFilePath + * @return void + */ + private function copyFile($destinationFilePath): void + { + //Refers to application root directory + $rootDirectory = $this->fileSystem->getDirectoryWrite(DirectoryList::ROOT); + $rootDirectory->copyFile($this->sourceFilePath, $this->varDirectory->getAbsolutePath($destinationFilePath)); + } + + /** + * Csv file path for copying from sourceFilePath and for future deleting + * + * @return array + */ + public static function testExecuteProvider(): array + { + return [ + ['catalog_product.csv'], + ['test/catalog_product.csv'] + ]; } /** diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/Export/File/DownloadTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/Export/File/DownloadTest.php index 073ecc6fd06a4..578df4290a99e 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/Export/File/DownloadTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/Export/File/DownloadTest.php @@ -7,7 +7,6 @@ namespace Magento\ImportExport\Controller\Adminhtml\Export\File; -use Magento\Backend\Model\Auth\Session; use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\App\Request\Http; use Magento\Framework\Filesystem; @@ -16,7 +15,6 @@ use Magento\TestFramework\TestCase\AbstractBackendController; use Magento\Backend\Model\UrlInterface as BackendUrl; use Magento\Backend\Model\Auth; -use Magento\TestFramework\Bootstrap as TestBootstrap; /** * Test for \Magento\ImportExport\Controller\Adminhtml\Export\File\Download class. @@ -28,11 +26,6 @@ class DownloadTest extends AbstractBackendController */ private $fileName = 'catalog_product.csv'; - /** - * @var string - */ - private $filesize; - /** * @var Auth */ @@ -43,6 +36,21 @@ class DownloadTest extends AbstractBackendController */ private $backendUrl; + /** + * @var WriteInterface + */ + private $varDirectory; + + /** + * @var Filesystem + */ + private $fileSystem; + + /** + * @var string + */ + private $sourceFilePath; + /** * @inheritdoc */ @@ -50,31 +58,29 @@ protected function setUp() { parent::setUp(); - $filesystem = $this->_objectManager->get(Filesystem::class); + $this->fileSystem = $this->_objectManager->get(Filesystem::class); $auth = $this->_objectManager->get(Auth::class); $auth->getAuthStorage()->setIsFirstPageAfterLogin(false); $this->backendUrl = $this->_objectManager->get(BackendUrl::class); $this->backendUrl->turnOnSecretKey(); - - $sourceFilePath = __DIR__ . '/../../Import/_files' . DIRECTORY_SEPARATOR . $this->fileName; - $destinationFilePath = 'export' . DIRECTORY_SEPARATOR . $this->fileName; + $this->sourceFilePath = __DIR__ . '/../../Import/_files' . DIRECTORY_SEPARATOR . $this->fileName; //Refers to tests 'var' directory - $varDirectory = $filesystem->getDirectoryRead(DirectoryList::VAR_DIR); - //Refers to application root directory - $rootDirectory = $filesystem->getDirectoryWrite(DirectoryList::ROOT); - $rootDirectory->copyFile($sourceFilePath, $varDirectory->getAbsolutePath($destinationFilePath)); - $this->filesize = $varDirectory->stat($destinationFilePath)['size']; + $this->varDirectory = $this->fileSystem->getDirectoryRead(DirectoryList::VAR_DIR); } /** * Check that file can be downloaded. * + * @param string $file + * @dataProvider testExecuteProvider * @return void * @magentoConfigFixture default_store admin/security/use_form_key 1 * @magentoAppArea adminhtml */ - public function testExecute(): void + public function testExecute($file): void { + $this->copyFile('export/' . $file); + $fileSize = $this->varDirectory->stat('export/' . $file)['size']; $request = $this->getRequest(); list($routeName, $controllerName, $actionName) = explode('/', Download::URL); $request->setMethod(Http::METHOD_GET) @@ -104,12 +110,38 @@ public function testExecute(): void 'Incorrect response header "content-disposition"' ); $this->assertEquals( - $this->filesize, + $fileSize, $contentLength->getFieldValue(), 'Incorrect response header "content-length"' ); } + /** + * Copy csv file from sourceFilePath to destinationFilePath + * + * @param $destinationFilePath + * @return void + */ + private function copyFile($destinationFilePath): void + { + //Refers to application root directory + $rootDirectory = $this->fileSystem->getDirectoryWrite(DirectoryList::ROOT); + $rootDirectory->copyFile($this->sourceFilePath, $this->varDirectory->getAbsolutePath($destinationFilePath)); + } + + /** + * Csv file path for copying from sourceFilePath and for future deleting + * + * @return array + */ + public static function testExecuteProvider(): array + { + return [ + ['catalog_product.csv'], + ['test/catalog_product.csv'] + ]; + } + /** * @inheritdoc */ From 64c0d3ee1a99fb82b59bfd94d93a6d38d09b1440 Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Thu, 9 Jan 2020 11:34:15 +0200 Subject: [PATCH 0748/1143] MC-30140: Some environment variables do not lock the settings in the backend --- .../Magento/Config/Block/System/Config/Form/Field.php | 6 +++++- .../Test/Unit/Block/System/Config/Form/FieldTest.php | 8 ++++---- lib/web/mage/adminhtml/form.js | 3 ++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Config/Block/System/Config/Form/Field.php b/app/code/Magento/Config/Block/System/Config/Form/Field.php index e4b582a1f0504..ac4a85b7d3bc6 100644 --- a/app/code/Magento/Config/Block/System/Config/Form/Field.php +++ b/app/code/Magento/Config/Block/System/Config/Form/Field.php @@ -43,6 +43,10 @@ public function render(\Magento\Framework\Data\Form\Element\AbstractElement $ele $element->setDisabled(true); } + if ($element->getIsDisableInheritance()) { + $element->setReadonly(true); + } + $html = '<td class="label"><label for="' . $element->getHtmlId() . '"><span' . $this->_renderScopeLabel($element) . '>' . @@ -94,7 +98,7 @@ protected function _renderInheritCheckbox(\Magento\Framework\Data\Form\Element\A $htmlId = $element->getHtmlId(); $namePrefix = preg_replace('#\[value\](\[\])?$#', '', $element->getName()); $checkedHtml = $element->getInherit() == 1 ? 'checked="checked"' : ''; - $disabled = $element->getIsDisableInheritance() == true ? ' disabled="disabled"' : ''; + $disabled = $element->getIsDisableInheritance() == true ? ' disabled="disabled" readonly="1"' : ''; $html = '<td class="use-default">'; $html .= '<input id="' . diff --git a/app/code/Magento/Config/Test/Unit/Block/System/Config/Form/FieldTest.php b/app/code/Magento/Config/Test/Unit/Block/System/Config/Form/FieldTest.php index 6be1fe04b68dd..d942af9352e6c 100644 --- a/app/code/Magento/Config/Test/Unit/Block/System/Config/Form/FieldTest.php +++ b/app/code/Magento/Config/Test/Unit/Block/System/Config/Form/FieldTest.php @@ -7,8 +7,6 @@ /** * Test how class render field html element in Stores Configuration - * - * @package Magento\Config\Test\Unit\Block\System\Config\Form */ class FieldTest extends \PHPUnit\Framework\TestCase { @@ -72,6 +70,7 @@ protected function setUp() 'getCanUseDefaultValue', 'setDisabled', 'getTooltip', + 'setReadonly' ] ); @@ -179,7 +178,8 @@ public function testRenderInheritCheckbox() $this->_elementMock->expects($this->any())->method('getCanUseWebsiteValue')->will($this->returnValue(true)); $this->_elementMock->expects($this->any())->method('getCanUseDefaultValue')->will($this->returnValue(true)); $this->_elementMock->expects($this->once())->method('setDisabled')->with(true); - $this->_elementMock->expects($this->once())->method('getIsDisableInheritance')->willReturn(true); + $this->_elementMock->method('getIsDisableInheritance')->willReturn(true); + $this->_elementMock->method('setReadonly')->with(true); $expected = '<td class="use-default">'; $expected .= '<input id="' . @@ -187,7 +187,7 @@ public function testRenderInheritCheckbox() '_inherit" name="' . $this->_testData['name'] . '[inherit]" type="checkbox" value="1"' . - ' class="checkbox config-inherit" checked="checked"' . ' disabled="disabled"' . + ' class="checkbox config-inherit" checked="checked"' . ' disabled="disabled"' . ' readonly="1"' . ' onclick="toggleValueElements(this, Element.previous(this.parentNode))" /> '; $expected .= '<label for="' . $this->_testData['htmlId'] . '_inherit" class="inherit">Use Website</label>'; diff --git a/lib/web/mage/adminhtml/form.js b/lib/web/mage/adminhtml/form.js index 487c71484e4c5..4dfbde6afa9d7 100644 --- a/lib/web/mage/adminhtml/form.js +++ b/lib/web/mage/adminhtml/form.js @@ -494,7 +494,8 @@ define([ inputs.each(function (item) { // don't touch hidden inputs (and Use Default inputs too), bc they may have custom logic if ((!item.type || item.type != 'hidden') && !($(item.id + '_inherit') && $(item.id + '_inherit').checked) && //eslint-disable-line - !(currentConfig['can_edit_price'] != undefined && !currentConfig['can_edit_price']) //eslint-disable-line + !(currentConfig['can_edit_price'] != undefined && !currentConfig['can_edit_price']) && //eslint-disable-line + !item.getAttribute('readonly') //eslint-disable-line ) { item.disabled = false; jQuery(item).removeClass('ignore-validate'); From 9d29a983ef7d37aaaa21ab678ed4b09a6ac89bb4 Mon Sep 17 00:00:00 2001 From: Ivan Gerchak <ivang@ven.com> Date: Thu, 9 Jan 2020 11:36:17 +0200 Subject: [PATCH 0749/1143] Fix the wrong behavior of validation scroll on the iPhone X --- lib/web/mage/validation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/web/mage/validation.js b/lib/web/mage/validation.js index 63926af9e8e48..18e7b6413bc96 100644 --- a/lib/web/mage/validation.js +++ b/lib/web/mage/validation.js @@ -1970,7 +1970,7 @@ define([ } if (firstActive.length) { - $('body').stop().animate({ + $('html, body').stop().animate({ scrollTop: firstActive.offset().top - windowHeight / 2 }); firstActive.focus(); From 35478d2f9c5b9c1260f7bd0b2e197e494b61f68e Mon Sep 17 00:00:00 2001 From: DianaRusin <rusind95@gmail.com> Date: Thu, 9 Jan 2020 13:58:08 +0200 Subject: [PATCH 0750/1143] MC-25250: DropDown attribute with label 'select' break product edit page --- app/code/Magento/Backend/view/adminhtml/web/js/translate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Backend/view/adminhtml/web/js/translate.js b/app/code/Magento/Backend/view/adminhtml/web/js/translate.js index d40c32e816126..eae1394c15027 100644 --- a/app/code/Magento/Backend/view/adminhtml/web/js/translate.js +++ b/app/code/Magento/Backend/view/adminhtml/web/js/translate.js @@ -35,7 +35,7 @@ define([ * @return {String} */ this.translate = function (text) { - return (typeof _data[text] === 'string') ? _data[text]: text; + return typeof _data[text] === 'string' ? _data[text] : text; }; return this; From 0e4f6ce0d35f90e8a2cd371d63d98f15ce85605e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 9 Jan 2020 13:40:46 +0100 Subject: [PATCH 0751/1143] REFACTOR: Extract Action Groups to separate files (MFTF best practices) --- .../ActionGroup/_Deprecated_ActionGroup.xml | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductWishlist/ActionGroup/_Deprecated_ActionGroup.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductWishlist/ActionGroup/_Deprecated_ActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductWishlist/ActionGroup/_Deprecated_ActionGroup.xml new file mode 100644 index 0000000000000..e00a96b41b974 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductWishlist/ActionGroup/_Deprecated_ActionGroup.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCustomerCheckConfigurableProductInWishlist"> + <annotations> + <description>Validates that the provided Configurable Product and Product Option is present in the Storefront Wish List.</description> + </annotations> + <arguments> + <argument name="productVar"/> + <argument name="optionProductVar"/> + </arguments> + + <waitForElement selector="{{StorefrontCustomerWishlistProductSection.ProductTitleByName(productVar.name)}}" time="30" stepKey="assertWishlistProductName"/> + <see userInput="${{optionProductVar.price}}.00" selector="{{StorefrontCustomerWishlistProductSection.ProductPriceByName(productVar.name)}}" stepKey="AssertWishlistProductPrice"/> + <moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.ProductInfoByName(productVar.name)}}" stepKey="wishlistMoveMouseOverProduct"/> + <seeElement selector="{{StorefrontCustomerWishlistProductSection.ProductAddToCartByName(productVar.name)}}" stepKey="AssertWishlistAddToCart"/> + <seeElement selector="{{StorefrontCustomerWishlistProductSection.ProductImageByName(productVar.name)}}" stepKey="AssertWishlistProductImage"/> + </actionGroup> + <actionGroup name="StorefrontCustomerCheckConfigurableProductInWishlistSidebar"> + <annotations> + <description>Validates that the provided Configurable Product and Product Option is present in the Storefront Wish List sidebar.</description> + </annotations> + <arguments> + <argument name="productVar"/> + <argument name="optionProductVar"/> + </arguments> + + <waitForElement selector="{{StorefrontCustomerWishlistSidebarSection.ProductTitleByName(productVar.name)}}" time="30" stepKey="assertWishlistSidebarProductName"/> + <see userInput="${{optionProductVar.price}}.00" selector="{{StorefrontCustomerWishlistSidebarSection.ProductPriceByName(productVar.name)}}" stepKey="AssertWishlistSidebarProductPrice"/> + <seeElement selector="{{StorefrontCustomerWishlistSidebarSection.ProductAddToCartByName(productVar.name)}}" stepKey="AssertWishlistSidebarAddToCart"/> + <seeElement selector="{{StorefrontCustomerWishlistSidebarSection.ProductImageByName(productVar.name)}}" stepKey="AssertWishlistSidebarProductImage"/> + </actionGroup> +</actionGroups> From 592cb1e90eb42fd763fa71cbcaa588caaf3834c8 Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Thu, 9 Jan 2020 14:54:50 +0200 Subject: [PATCH 0752/1143] MC-30224: [2.4] Deleting an empty user model caused deleting admin role --- .../Magento/User/Model/ResourceModel/User.php | 33 +++++---- .../User/Model/ResourceModel/UserTest.php | 68 +++++++++++++------ 2 files changed, 67 insertions(+), 34 deletions(-) diff --git a/app/code/Magento/User/Model/ResourceModel/User.php b/app/code/Magento/User/Model/ResourceModel/User.php index b5927bbe4cef0..d9bc555b8e391 100644 --- a/app/code/Magento/User/Model/ResourceModel/User.php +++ b/app/code/Magento/User/Model/ResourceModel/User.php @@ -13,6 +13,7 @@ use Magento\Authorization\Model\UserContextInterface; use Magento\Framework\Acl\Data\CacheInterface; use Magento\Framework\App\ObjectManager; +use Magento\Framework\Exception\LocalizedException; use Magento\User\Model\Backend\Config\ObserverConfig; use Magento\User\Model\User as ModelUser; @@ -249,29 +250,33 @@ protected function _afterLoad(\Magento\Framework\Model\AbstractModel $user) * * @param \Magento\Framework\Model\AbstractModel $user * @return bool - * @throws \Magento\Framework\Exception\LocalizedException + * @throws LocalizedException */ public function delete(\Magento\Framework\Model\AbstractModel $user) { + $uid = $user->getId(); + if (!$uid) { + return false; + } + $this->_beforeDelete($user); $connection = $this->getConnection(); - - $uid = $user->getId(); $connection->beginTransaction(); - if ($uid) { - try { - $connection->delete($this->getMainTable(), ['user_id = ?' => $uid]); - $connection->delete( - $this->getTable('authorization_role'), - ['user_id = ?' => $uid, 'user_type = ?' => UserContextInterface::USER_TYPE_ADMIN] - ); - } catch (\Magento\Framework\Exception\LocalizedException $e) { - $connection->rollBack(); - return false; - } + try { + $connection->delete($this->getMainTable(), ['user_id = ?' => $uid]); + $connection->delete( + $this->getTable('authorization_role'), + ['user_id = ?' => $uid, 'user_type = ?' => UserContextInterface::USER_TYPE_ADMIN] + ); + } catch (LocalizedException $e) { + $connection->rollBack(); + + return false; } + $connection->commit(); $this->_afterDelete($user); + return true; } diff --git a/dev/tests/integration/testsuite/Magento/User/Model/ResourceModel/UserTest.php b/dev/tests/integration/testsuite/Magento/User/Model/ResourceModel/UserTest.php index d9f11b3d2f08e..0eabe3a214ec2 100644 --- a/dev/tests/integration/testsuite/Magento/User/Model/ResourceModel/UserTest.php +++ b/dev/tests/integration/testsuite/Magento/User/Model/ResourceModel/UserTest.php @@ -3,42 +3,60 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\User\Model\ResourceModel; use Magento\Authorization\Model\ResourceModel\Role\Collection as UserRoleCollection; +use Magento\Authorization\Model\ResourceModel\Role\CollectionFactory as UserRoleCollectionFactory; use Magento\Authorization\Model\UserContextInterface; use Magento\TestFramework\Helper\Bootstrap; use Magento\User\Model\ResourceModel\User as UserResourceModel; use Magento\User\Model\User; +use Magento\User\Model\UserFactory; /** * @magentoAppArea adminhtml */ class UserTest extends \PHPUnit\Framework\TestCase { - /** @var UserResourceModel */ + /** + * @var UserResourceModel + */ private $model; + /** + * @var UserRoleCollectionFactory + */ + private $userRoleCollectionFactory; + + /** + * @var UserFactory + */ + private $userFactory; + + /** + * @inheritdoc + */ protected function setUp() { - $this->model = Bootstrap::getObjectManager()->get( - UserResourceModel::class - ); + $this->model = Bootstrap::getObjectManager()->get(UserResourceModel::class); + $this->userRoleCollectionFactory = Bootstrap::getObjectManager()->get(UserRoleCollectionFactory::class); + $this->userFactory = Bootstrap::getObjectManager()->get(UserFactory::class); } /** * Tests if latest password is stored after user creating * when password lifetime config value is zero (disabled as fact) * + * @return void * @magentoConfigFixture current_store admin/security/password_lifetime 0 * @magentoDataFixture Magento/User/_files/dummy_user.php */ - public function testGetLatestPasswordWhenZeroPasswordLifetime() + public function testGetLatestPasswordWhenZeroPasswordLifetime(): void { /** @var User $user */ - $user = Bootstrap::getObjectManager()->create( - User::class - ); + $user = $this->userFactory->create(); $user->loadByUsername('dummy_username'); $latestPassword = $this->model->getLatestPassword($user->getId()); @@ -49,38 +67,48 @@ public function testGetLatestPasswordWhenZeroPasswordLifetime() } /** - * Test that user role is not deleted after deleting empty user + * Test that user role is not deleted after deleting empty user. + * + * @return void */ - public function testDelete() + public function testDelete(): void { $this->checkRoleCollectionSize(); /** @var User $user */ - $user = Bootstrap::getObjectManager()->create( - User::class - ); + $user = $this->userFactory->create(); $this->model->delete($user); $this->checkRoleCollectionSize(); } /** - * Ensure that role collection size is correct + * Ensure that role collection size is correct. + * + * @return void */ - private function checkRoleCollectionSize() + private function checkRoleCollectionSize(): void { /** @var UserRoleCollection $roleCollection */ - $roleCollection = Bootstrap::getObjectManager()->create( - UserRoleCollection::class - ); + $roleCollection = $this->userRoleCollectionFactory->create(); $roleCollection->setUserFilter(0, UserContextInterface::USER_TYPE_ADMIN); $this->assertEquals(1, $roleCollection->getSize()); } - public function testCountAll() + /** + * Check total user count. + * + * @return void + */ + public function testCountAll(): void { $this->assertSame(1, $this->model->countAll()); } - public function testGetValidationRulesBeforeSave() + /** + * Check validation rules has correct type. + * + * @return void + */ + public function testGetValidationRulesBeforeSave(): void { $rules = $this->model->getValidationRulesBeforeSave(); $this->assertInstanceOf('Zend_Validate_Interface', $rules); From 493a74ddadd3df4635b65f8b866a966e78e905ba Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Thu, 9 Jan 2020 15:30:27 +0200 Subject: [PATCH 0753/1143] MC-29841: Insecure Session Handling --- .../Customer/Model/AccountManagement.php | 69 ++++++++++--------- app/code/Magento/Customer/Model/Visitor.php | 8 ++- 2 files changed, 44 insertions(+), 33 deletions(-) diff --git a/app/code/Magento/Customer/Model/AccountManagement.php b/app/code/Magento/Customer/Model/AccountManagement.php index 985cfe0621bf8..55da6a62f0625 100644 --- a/app/code/Magento/Customer/Model/AccountManagement.php +++ b/app/code/Magento/Customer/Model/AccountManagement.php @@ -68,49 +68,55 @@ class AccountManagement implements AccountManagementInterface /** * Configuration paths for create account email template * - * @deprecated + * @deprecated Get rid of Helpers in Password Security Management + * @see EmailNotification::XML_PATH_REGISTER_EMAIL_TEMPLATE */ const XML_PATH_REGISTER_EMAIL_TEMPLATE = 'customer/create_account/email_template'; /** * Configuration paths for register no password email template * - * @deprecated + * @deprecated Get rid of Helpers in Password Security Management + * @see EmailNotification::XML_PATH_REGISTER_EMAIL_TEMPLATE */ const XML_PATH_REGISTER_NO_PASSWORD_EMAIL_TEMPLATE = 'customer/create_account/email_no_password_template'; /** * Configuration paths for remind email identity * - * @deprecated + * @deprecated Get rid of Helpers in Password Security Management + * @see EmailNotification::XML_PATH_REGISTER_EMAIL_TEMPLATE */ const XML_PATH_REGISTER_EMAIL_IDENTITY = 'customer/create_account/email_identity'; /** * Configuration paths for remind email template * - * @deprecated + * @deprecated Get rid of Helpers in Password Security Management + * @see EmailNotification::XML_PATH_REGISTER_EMAIL_TEMPLATE */ const XML_PATH_REMIND_EMAIL_TEMPLATE = 'customer/password/remind_email_template'; /** * Configuration paths for forgot email email template * - * @deprecated + * @deprecated Get rid of Helpers in Password Security Management + * @see EmailNotification::XML_PATH_REGISTER_EMAIL_TEMPLATE */ const XML_PATH_FORGOT_EMAIL_TEMPLATE = 'customer/password/forgot_email_template'; /** * Configuration paths for forgot email identity * - * @deprecated + * @deprecated Get rid of Helpers in Password Security Management + * @see EmailNotification::XML_PATH_REGISTER_EMAIL_TEMPLATE */ const XML_PATH_FORGOT_EMAIL_IDENTITY = 'customer/password/forgot_email_identity'; /** * Configuration paths for account confirmation required * - * @deprecated + * @deprecated Get rid of Helpers in Password Security Management * @see AccountConfirmation::XML_PATH_IS_CONFIRM */ const XML_PATH_IS_CONFIRM = 'customer/create_account/confirm'; @@ -118,42 +124,48 @@ class AccountManagement implements AccountManagementInterface /** * Configuration paths for account confirmation email template * - * @deprecated + * @deprecated Get rid of Helpers in Password Security Management + * @see EmailNotification::XML_PATH_REGISTER_EMAIL_TEMPLATE */ const XML_PATH_CONFIRM_EMAIL_TEMPLATE = 'customer/create_account/email_confirmation_template'; /** * Configuration paths for confirmation confirmed email template * - * @deprecated + * @deprecated Get rid of Helpers in Password Security Management + * @see EmailNotification::XML_PATH_REGISTER_EMAIL_TEMPLATE */ const XML_PATH_CONFIRMED_EMAIL_TEMPLATE = 'customer/create_account/email_confirmed_template'; /** * Constants for the type of new account email to be sent * - * @deprecated + * @deprecated Get rid of Helpers in Password Security Management + * @see EmailNotificationInterface::NEW_ACCOUNT_EMAIL_REGISTERED */ const NEW_ACCOUNT_EMAIL_REGISTERED = 'registered'; /** * Welcome email, when password setting is required * - * @deprecated + * @deprecated Get rid of Helpers in Password Security Management + * @see EmailNotificationInterface::NEW_ACCOUNT_EMAIL_REGISTERED */ const NEW_ACCOUNT_EMAIL_REGISTERED_NO_PASSWORD = 'registered_no_password'; /** * Welcome email, when confirmation is enabled * - * @deprecated + * @deprecated Get rid of Helpers in Password Security Management + * @see EmailNotificationInterface::NEW_ACCOUNT_EMAIL_REGISTERED */ const NEW_ACCOUNT_EMAIL_CONFIRMATION = 'confirmation'; /** * Confirmation email, when account is confirmed * - * @deprecated + * @deprecated Get rid of Helpers in Password Security Management + * @see EmailNotificationInterface::NEW_ACCOUNT_EMAIL_REGISTERED */ const NEW_ACCOUNT_EMAIL_CONFIRMED = 'confirmed'; @@ -179,14 +191,15 @@ class AccountManagement implements AccountManagementInterface /** * Configuration path to customer reset password email template * - * @deprecated + * @deprecated Get rid of Helpers in Password Security Management + * @see Magento/Customer/Model/EmailNotification::XML_PATH_REGISTER_EMAIL_TEMPLATE */ const XML_PATH_RESET_PASSWORD_TEMPLATE = 'customer/password/reset_password_template'; /** * Minimum password length * - * @deprecated + * @deprecated Get rid of Helpers in Password Security Management */ const MIN_PASSWORD_LENGTH = 6; @@ -526,6 +539,7 @@ public function resendConfirmation($email, $websiteId = null, $redirectUrl = '') // If we are not able to send a new account email, this should be ignored $this->logger->critical($e); } + return true; } /** @@ -671,17 +685,16 @@ public function initiatePasswordReset($email, $template, $websiteId = null) */ private function handleUnknownTemplate($template) { - throw new InputException( - __( - 'Invalid value of "%value" provided for the %fieldName field. Possible values: %template1 or %template2.', - [ - 'value' => $template, - 'fieldName' => 'template', - 'template1' => AccountManagement::EMAIL_REMINDER, - 'template2' => AccountManagement::EMAIL_RESET - ] - ) + $phrase = __( + 'Invalid value of "%value" provided for the %fieldName field. Possible values: %template1 or %template2.', + [ + 'value' => $template, + 'fieldName' => 'template', + 'template1' => AccountManagement::EMAIL_REMINDER, + 'template2' => AccountManagement::EMAIL_RESET + ] ); + throw new InputException($phrase); } /** @@ -713,12 +726,6 @@ public function resetPassword($email, $resetToken, $newPassword) $customerSecure->setRpTokenCreatedAt(null); $customerSecure->setPasswordHash($this->createPasswordHash($newPassword)); $this->destroyCustomerSessions($customer->getId()); - if ($this->sessionManager->isSessionExists()) { - //delete old session and move data to the new session - //use this instead of $this->sessionManager->regenerateId because last one doesn't delete old session - // phpcs:ignore Magento2.Functions.DiscouragedFunction - session_regenerate_id(true); - } $this->customerRepository->save($customer); return true; diff --git a/app/code/Magento/Customer/Model/Visitor.php b/app/code/Magento/Customer/Model/Visitor.php index 6935b9dca7f28..5fa1af69e9bdd 100644 --- a/app/code/Magento/Customer/Model/Visitor.php +++ b/app/code/Magento/Customer/Model/Visitor.php @@ -12,7 +12,8 @@ /** * Class Visitor * - * @package Magento\Customer\Model + * Used to track sessions of the logged in customers + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) */ @@ -173,7 +174,7 @@ public function initByRequest($observer) if ($this->requestSafety->isSafeMethod()) { return $this; } - + if (!$this->getId()) { $this->setSessionId($this->session->getSessionId()); $this->save(); @@ -199,6 +200,9 @@ public function saveByRequest($observer) } try { + if ($this->session->getSessionId() && $this->getSessionId() != $this->session->getSessionId()) { + $this->setSessionId($this->session->getSessionId()); + } $this->save(); $this->_eventManager->dispatch('visitor_activity_save', ['visitor' => $this]); $this->session->setVisitorData($this->getData()); From 6043415681b9d80f361b4f03ecb68ef10e659fa2 Mon Sep 17 00:00:00 2001 From: Anusha Vattam <avattam@adobe.com> Date: Thu, 9 Jan 2020 07:57:25 -0600 Subject: [PATCH 0754/1143] MC:20074: Fix Skipped MFTF Tests From MC-17140: MC-14104, MC-14502, MC-14532 - Added JS File Test modifications --- .../Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml index 5550e3b317b0d..ad255c5d2bdee 100644 --- a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml +++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml @@ -28,7 +28,6 @@ <magentoCLI command="config:set {{MinifyJavaScriptFilesDisableConfigData.path}} {{MinifyJavaScriptFilesDisableConfigData.value}}" stepKey="disableJsMinification"/> <actionGroup ref="logout" stepKey="logout"/> </after> - <see userInput="Dashboard" selector="{{AdminHeaderSection.pageTitle}}" stepKey="seeDashboardTitle"/> <waitForPageLoad stepKey="waitForPageLoadOnDashboard"/> <actionGroup ref="AssertAdminSuccessLoginActionGroup" stepKey="loggedInSuccessfully"/> <actionGroup ref="AssertAdminPageIsNot404ActionGroup" stepKey="dontSee404Page"/> From 78a3b4d0aeac3ba4074bd04f3b9f717fca91b3f8 Mon Sep 17 00:00:00 2001 From: Soumya Unnikrishnan <sunnikri@adobe.com> Date: Thu, 9 Jan 2020 09:56:54 -0600 Subject: [PATCH 0755/1143] MQE-1920: [MTF-To-MFTF] Process PR 701 Added scroll to page content. --- .../Test/Mftf/ActionGroup/FillOutCMSPageContentActionGroup.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/FillOutCMSPageContentActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/FillOutCMSPageContentActionGroup.xml index a4ffff5c8760a..0ee195ae13a3c 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/FillOutCMSPageContentActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/FillOutCMSPageContentActionGroup.xml @@ -16,7 +16,7 @@ <fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{_duplicatedCMSPage.title}}" stepKey="fillFieldTitle"/> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickExpandContentTabForPage"/> <fillField selector="{{CmsNewPagePageContentSection.contentHeading}}" userInput="{{_duplicatedCMSPage.content_heading}}" stepKey="fillFieldContentHeading"/> - <wait time="5" stepKey="waitForTextAreaToAppear"/> + <scrollTo selector="{{CmsNewPagePageContentSection.content}}" stepKey="scrollToPageContent"/> <fillField selector="{{CmsNewPagePageContentSection.content}}" userInput="{{_duplicatedCMSPage.content}}" stepKey="fillFieldContent"/> <click selector="{{CmsNewPagePageSeoSection.header}}" stepKey="clickExpandSearchEngineOptimisation"/> <fillField selector="{{CmsNewPagePageSeoSection.urlKey}}" userInput="{{_duplicatedCMSPage.identifier}}" stepKey="fillFieldUrlKey"/> From c540a599d5ce9a811eadc596bb924d9dd2ebf8a7 Mon Sep 17 00:00:00 2001 From: Manuel Canepa <manuelcanepa@gmail.com> Date: Thu, 9 Jan 2020 13:36:01 -0300 Subject: [PATCH 0756/1143] Add Unit Tests --- .../Model/XmlCatalog/Format/VsCode.php | 30 ++- .../Command/XmlCatalogGenerateCommandTest.php | 54 +++++ .../Model/XmlCatalog/Format/VsCodeTest.php | 217 ++++++++++++++++++ .../Format/_files/invalid_catalog.xml | 2 + .../Format/_files/valid_catalog.xml | 7 + 5 files changed, 302 insertions(+), 8 deletions(-) create mode 100644 app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/VsCodeTest.php create mode 100644 app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/_files/invalid_catalog.xml create mode 100644 app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/_files/valid_catalog.xml diff --git a/app/code/Magento/Developer/Model/XmlCatalog/Format/VsCode.php b/app/code/Magento/Developer/Model/XmlCatalog/Format/VsCode.php index 1b881633329d9..9ba53757c478c 100644 --- a/app/code/Magento/Developer/Model/XmlCatalog/Format/VsCode.php +++ b/app/code/Magento/Developer/Model/XmlCatalog/Format/VsCode.php @@ -20,8 +20,9 @@ class VsCode implements FormatInterface { private const PROJECT_PATH_IDENTIFIER = '..'; - private const FILE_MODE_READ = 'r'; - private const FILE_MODE_WRITE = 'w'; + public const XMLNS = 'urn:oasis:names:tc:entity:xmlns:xml:catalog'; + public const FILE_MODE_READ = 'r'; + public const FILE_MODE_WRITE = 'w'; /** * @var ReadInterface @@ -46,7 +47,7 @@ class VsCode implements FormatInterface public function __construct( ReadFactory $readFactory, WriteFactory $fileWriteFactory, - DomDocumentFactory $domDocumentFactory = null + DomDocumentFactory $domDocumentFactory ) { $this->currentDirRead = $readFactory->create(getcwd()); $this->fileWriteFactory = $fileWriteFactory; @@ -73,9 +74,12 @@ public function generateCatalog(array $dictionary, $configFile): void } else { $this->initEmptyFile($dom); } - $xpath = new \DOMXPath($dom); - $nodeList = $xpath->query('/catalog'); - $catalogNode = $nodeList->item(0); + $catalogNode = $dom->getElementsByTagName('catalog')->item(0); + + if ($catalogNode == null) { + $dom = $this->domDocumentFactory->create(); + $catalogNode = $this->initEmptyFile($dom); + } $file->close(); } catch (FileSystemException $f) { //create file if does not exists @@ -83,13 +87,23 @@ public function generateCatalog(array $dictionary, $configFile): void $catalogNode = $this->initEmptyFile($dom); } + $xpath = new \DOMXPath($dom); + $xpath->registerNamespace('xmlns', self::XMLNS); + foreach ($dictionary as $urn => $xsdPath) { - $node = $dom->createElement('system'); + // Find an existing urn + $existingNode = $xpath->query("/xmlns:catalog/xmlns:system[@systemId='" . $urn . "']")->item(0); + $node = $existingNode ?? $dom->createElement('system'); $node->setAttribute('systemId', $urn); $node->setAttribute('uri', $this->getFileLocationInProject($xsdPath)); $catalogNode->appendChild($node); } $dom->formatOutput = true; + $dom->preserveWhiteSpace = false; + + // Reload to keep pretty format + $dom->loadXML($dom->saveXML()); + $file = $this->fileWriteFactory->create($configFile, DriverPool::FILE, self::FILE_MODE_WRITE); $file->write($dom->saveXML()); $file->close(); @@ -105,7 +119,7 @@ private function initEmptyFile(\DOMDocument $dom): \DOMElement { $catalogNode = $dom->createElement('catalog'); - $catalogNode->setAttribute('xmlns', 'urn:oasis:names:tc:entity:xmlns:xml:catalog'); + $catalogNode->setAttribute('xmlns', self::XMLNS); $dom->appendChild($catalogNode); return $catalogNode; diff --git a/app/code/Magento/Developer/Test/Unit/Console/Command/XmlCatalogGenerateCommandTest.php b/app/code/Magento/Developer/Test/Unit/Console/Command/XmlCatalogGenerateCommandTest.php index e5c6525cfeb55..04d41efb793b8 100644 --- a/app/code/Magento/Developer/Test/Unit/Console/Command/XmlCatalogGenerateCommandTest.php +++ b/app/code/Magento/Developer/Test/Unit/Console/Command/XmlCatalogGenerateCommandTest.php @@ -66,4 +66,58 @@ public function testExecuteBadType() $commandTester->execute([XmlCatalogGenerateCommand::IDE_FILE_PATH_ARGUMENT => 'test']); $this->assertEquals('', $commandTester->getDisplay()); } + + public function testExecuteVsCodeFormat() + { + $fixtureXmlFile = __DIR__ . '/_files/test.xml'; + + $filesMock = $this->createPartialMock(\Magento\Framework\App\Utility\Files::class, ['getXmlCatalogFiles']); + $filesMock->expects($this->at(0)) + ->method('getXmlCatalogFiles') + ->will($this->returnValue([[$fixtureXmlFile]])); + $filesMock->expects($this->at(1)) + ->method('getXmlCatalogFiles') + ->will($this->returnValue([])); + $urnResolverMock = $this->createMock(\Magento\Framework\Config\Dom\UrnResolver::class); + $urnResolverMock->expects($this->once()) + ->method('getRealPath') + ->with($this->equalTo('urn:magento:framework:Module/etc/module.xsd')) + ->will($this->returnValue($fixtureXmlFile)); + + $vscodeFormatMock = $this->createMock(\Magento\Developer\Model\XmlCatalog\Format\VsCode::class); + $vscodeFormatMock->expects($this->once()) + ->method('generateCatalog') + ->with( + $this->equalTo(['urn:magento:framework:Module/etc/module.xsd' => $fixtureXmlFile]), + $this->equalTo('test') + )->will($this->returnValue(null)); + + $formats = ['vscode' => $vscodeFormatMock]; + $readFactory = $this->createMock(\Magento\Framework\Filesystem\Directory\ReadFactory::class); + $readDirMock = $this->createMock(\Magento\Framework\Filesystem\Directory\ReadInterface::class); + + $content = file_get_contents($fixtureXmlFile); + + $readDirMock->expects($this->once()) + ->method('readFile') + ->with($this->equalTo('test.xml')) + ->will($this->returnValue($content)); + $readFactory->expects($this->once()) + ->method('create') + ->will($this->returnValue($readDirMock)); + + $this->command = new XmlCatalogGenerateCommand( + $filesMock, + $urnResolverMock, + $readFactory, + $formats + ); + + $commandTester = new CommandTester($this->command); + $commandTester->execute([ + '--' . XmlCatalogGenerateCommand::IDE_OPTION => 'vscode', + XmlCatalogGenerateCommand::IDE_FILE_PATH_ARGUMENT => 'test', + ]); + $this->assertEquals('', $commandTester->getDisplay()); + } } diff --git a/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/VsCodeTest.php b/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/VsCodeTest.php new file mode 100644 index 0000000000000..f03de7ca7cf30 --- /dev/null +++ b/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/VsCodeTest.php @@ -0,0 +1,217 @@ +<?php + +namespace Magento\Developer\Test\Unit\Model\XmlCatalog\Format; + +use Magento\Developer\Model\XmlCatalog\Format\VsCode; +use Magento\Framework\DomDocument\DomDocumentFactory; +use Magento\Framework\Exception\FileSystemException; +use Magento\Framework\Filesystem\Directory\ReadFactory; +use Magento\Framework\Filesystem\Directory\ReadInterface; +use Magento\Framework\Filesystem\DriverPool; +use Magento\Framework\Filesystem\File\WriteFactory; + +class VsCodeTest extends \PHPUnit\Framework\TestCase +{ + /** + * @var Magento\Developer\Model\XmlCatalog\Format\VsCode + */ + protected $vscodeFormat; + + /** + * @var Magento\Framework\Filesystem\Directory\ReadFactory + */ + protected $readFactory; + + /** + * @var Magento\Framework\Filesystem\File\WriteFactory + */ + protected $fileWriteFactory; + + /** + * @var Magento\Framework\DomDocument\DomDocumentFactory + */ + protected $domFactory; + + protected $dictionary = [ + 'urn:magento:framework:Acl/etc/acl.xsd' => 'vendor/magento/framework/Acl/etc/acl.xsd', + 'urn:magento:module:Magento_Store:etc/config.xsd' => 'vendor/magento/module-store/etc/config.xsd', + 'urn:magento:module:Magento_Cron:etc/crontab.xsd' => 'vendor/magento/module-cron/etc/crontab.xsd', + 'urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd' => 'vendor/magento/framework/Setup/Declaration/Schema/etc/schema.xsd', + ]; + + public function setUp() + { + + $currentDirRead = $this->createMock(ReadInterface::class); + $currentDirRead->expects($this->any()) + ->method('getRelativePath') + ->willReturnCallback(function ($xsdPath) { + return $xsdPath; + }); + + $this->readFactory = $this->createMock(ReadFactory::class); + $this->readFactory->expects($this->once()) + ->method('create') + ->withAnyParameters() + ->willReturn($currentDirRead); + + $this->fileWriteFactory = $this->createMock(WriteFactory::class); + $this->domFactory = new DomDocumentFactory(); + + $this->vscodeFormat = new VsCode( + $this->readFactory, + $this->fileWriteFactory, + $this->domFactory + ); + } + + public function testGenerateNewValidCatalog() + { + $configFile = 'test'; + $fixtureXmlFile = __DIR__ . '/_files/valid_catalog.xml'; + $content = file_get_contents($fixtureXmlFile); + + $message = __("The \"%1.xml\" file doesn't exist.", $configFile); + + $this->fileWriteFactory->expects($this->at(0)) + ->method('create') + ->with( + $configFile, + DriverPool::FILE, + VsCode::FILE_MODE_READ + ) + ->willThrowException(new FileSystemException($message)); + + $file = $this->createMock(\Magento\Framework\Filesystem\File\Write::class); + $file->expects($this->once()) + ->method('write') + ->with($content); + + $this->fileWriteFactory->expects($this->at(1)) + ->method('create') + ->with( + $configFile, + DriverPool::FILE, + VsCode::FILE_MODE_WRITE + ) + ->willReturn($file); + + $this->vscodeFormat->generateCatalog($this->dictionary, $configFile); + } + + public function testGenerateExistingValidCatalog() + { + $configFile = 'test'; + $fixtureXmlFile = __DIR__ . '/_files/valid_catalog.xml'; + $content = file_get_contents($fixtureXmlFile); + + $file = $this->createMock(\Magento\Framework\Filesystem\File\Read::class); + $file->expects($this->once()) + ->method('readAll') + ->withAnyParameters() + ->willReturn($content); + + $this->fileWriteFactory->expects($this->at(0)) + ->method('create') + ->with( + $configFile, + DriverPool::FILE, + VsCode::FILE_MODE_READ + ) + ->willReturn($file); + + $file = $this->createMock(\Magento\Framework\Filesystem\File\Write::class); + $file->expects($this->once()) + ->method('write') + ->with($content); + + $this->fileWriteFactory->expects($this->at(1)) + ->method('create') + ->with( + $configFile, + DriverPool::FILE, + VsCode::FILE_MODE_WRITE + ) + ->willReturn($file); + + $this->vscodeFormat->generateCatalog($this->dictionary, $configFile); + } + + public function testGenerateExistingEmptyValidCatalog() + { + $configFile = 'test'; + $fixtureXmlFile = __DIR__ . '/_files/valid_catalog.xml'; + $content = file_get_contents($fixtureXmlFile); + + $file = $this->createMock(\Magento\Framework\Filesystem\File\Read::class); + $file->expects($this->once()) + ->method('readAll') + ->withAnyParameters() + ->willReturn(''); + + $this->fileWriteFactory->expects($this->at(0)) + ->method('create') + ->with( + $configFile, + DriverPool::FILE, + VsCode::FILE_MODE_READ + ) + ->willReturn($file); + + $file = $this->createMock(\Magento\Framework\Filesystem\File\Write::class); + $file->expects($this->once()) + ->method('write') + ->with($content); + + $this->fileWriteFactory->expects($this->at(1)) + ->method('create') + ->with( + $configFile, + DriverPool::FILE, + VsCode::FILE_MODE_WRITE + ) + ->willReturn($file); + + $this->vscodeFormat->generateCatalog($this->dictionary, $configFile); + } + + public function testGenerateExistingInvalidValidCatalog() + { + $configFile = 'test'; + $invalidXmlFile = __DIR__ . '/_files/invalid_catalog.xml'; + $invalidContent = file_get_contents($invalidXmlFile); + $validXmlFile = __DIR__ . '/_files/valid_catalog.xml'; + $validContent = file_get_contents($validXmlFile); + + $file = $this->createMock(\Magento\Framework\Filesystem\File\Read::class); + $file->expects($this->once()) + ->method('readAll') + ->withAnyParameters() + ->willReturn($invalidContent); + + $this->fileWriteFactory->expects($this->at(0)) + ->method('create') + ->with( + $configFile, + DriverPool::FILE, + VsCode::FILE_MODE_READ + ) + ->willReturn($file); + + $file = $this->createMock(\Magento\Framework\Filesystem\File\Write::class); + $file->expects($this->once()) + ->method('write') + ->with($validContent); + + $this->fileWriteFactory->expects($this->at(1)) + ->method('create') + ->with( + $configFile, + DriverPool::FILE, + VsCode::FILE_MODE_WRITE + ) + ->willReturn($file); + + $this->vscodeFormat->generateCatalog($this->dictionary, $configFile); + } +} diff --git a/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/_files/invalid_catalog.xml b/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/_files/invalid_catalog.xml new file mode 100644 index 0000000000000..fe6ba3f75f93e --- /dev/null +++ b/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/_files/invalid_catalog.xml @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<root /> diff --git a/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/_files/valid_catalog.xml b/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/_files/valid_catalog.xml new file mode 100644 index 0000000000000..ab3973dd89189 --- /dev/null +++ b/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/_files/valid_catalog.xml @@ -0,0 +1,7 @@ +<?xml version="1.0"?> +<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"> + <system systemId="urn:magento:framework:Acl/etc/acl.xsd" uri="../vendor/magento/framework/Acl/etc/acl.xsd"/> + <system systemId="urn:magento:module:Magento_Store:etc/config.xsd" uri="../vendor/magento/module-store/etc/config.xsd"/> + <system systemId="urn:magento:module:Magento_Cron:etc/crontab.xsd" uri="../vendor/magento/module-cron/etc/crontab.xsd"/> + <system systemId="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd" uri="../vendor/magento/framework/Setup/Declaration/Schema/etc/schema.xsd"/> +</catalog> From a07ddfe2d91723eec53acb418b9ab1019799f764 Mon Sep 17 00:00:00 2001 From: Soumya Unnikrishnan <sunnikri@adobe.com> Date: Thu, 9 Jan 2020 10:50:21 -0600 Subject: [PATCH 0757/1143] MQE-1920: [MTF-To-MFTF] Process PR 701 Moved CMS tests with FillOutCMSPageContent step to WYSIWYGDisabledSuite. --- .../Test/Mftf/Test/AdminCMSPageCreatePageForDefaultStoreTest.xml | 1 + .../Mftf/Test/AdminCMSPageCreatePageInSingleStoreModeTest.xml | 1 + .../Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageTest.xml | 1 + .../Cms/Test/Mftf/Test/AdminCMSPageCreatePageWithBlockTest.xml | 1 + 4 files changed, 4 insertions(+) diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageForDefaultStoreTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageForDefaultStoreTest.xml index b381ae429ed2b..a9f5fcd8b17e0 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageForDefaultStoreTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageForDefaultStoreTest.xml @@ -17,6 +17,7 @@ <group value="backend"/> <group value="Cms"/> <group value="mtf_migrated"/> + <group value="WYSIWYGDisabled"/> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageInSingleStoreModeTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageInSingleStoreModeTest.xml index ef083ae61069d..1ec85f90f46ef 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageInSingleStoreModeTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageInSingleStoreModeTest.xml @@ -17,6 +17,7 @@ <group value="backend"/> <group value="Cms"/> <group value="mtf_migrated"/> + <group value="WYSIWYGDisabled"/> </annotations> <before> <magentoCLI command="config:set {{StorefrontSingleStoreModeEnabledConfigData.path}} {{StorefrontSingleStoreModeEnabledConfigData.value}}" stepKey="enableSingleStoreMode" /> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageTest.xml index 536c7055c9932..947fa92f2c8ff 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageTest.xml @@ -17,6 +17,7 @@ <group value="backend"/> <group value="Cms"/> <group value="mtf_migrated"/> + <group value="WYSIWYGDisabled"/> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageWithBlockTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageWithBlockTest.xml index 396507dddaca1..a6c67dc61dd97 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageWithBlockTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageWithBlockTest.xml @@ -17,6 +17,7 @@ <group value="backend"/> <group value="Cms"/> <group value="mtf_migrated"/> + <group value="WYSIWYGDisabled"/> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> From 8f30b1e75f999695cde7fa0d53df5d6e7da4385f Mon Sep 17 00:00:00 2001 From: Mychailo <mikellkalakailo@gmail.com> Date: Thu, 9 Jan 2020 18:55:18 +0200 Subject: [PATCH 0758/1143] Update app/code/Magento/Catalog/Model/ResourceModel/Eav/Attribute.php Co-Authored-By: Slava Mankivski <mankivsk@adobe.com> --- app/code/Magento/Catalog/Model/ResourceModel/Eav/Attribute.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Eav/Attribute.php b/app/code/Magento/Catalog/Model/ResourceModel/Eav/Attribute.php index f2853c792dbb8..f2647a222d06a 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Eav/Attribute.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Eav/Attribute.php @@ -383,7 +383,7 @@ public function getApplyTo() /** * Retrieve source model * - * @return mixed|string|null + * @return \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource|string|null */ public function getSourceModel() { From 5958409d4016223ccdec69283ac79050f48781ea Mon Sep 17 00:00:00 2001 From: Daniel Ruf <d.ruf@bitexpert.de> Date: Thu, 9 Jan 2020 17:56:17 +0100 Subject: [PATCH 0759/1143] Correctly set required street field --- .../Customer/view/frontend/templates/address/edit.phtml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml b/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml index 6cf71f1e56a47..1d940296f334a 100644 --- a/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml @@ -23,9 +23,8 @@ $viewModel = $block->getViewModel(); <?php $_postcodeValidationClass_value = $viewModel->addressGetAttributeValidationClass('postcode'); ?> <?php $_postcodeValidationClass = $_postcodeValidationClass_value; ?> <?php $_streetValidationClass = $viewModel->addressGetAttributeValidationClass('street'); ?> -<?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?> +<?php $_streetValidationClassNotRequired = trim(str_replace('required-entry', '', $_streetValidationClass)); ?> <?php $_regionValidationClass = $viewModel->addressGetAttributeValidationClass('region'); ?> - <form class="form-address-edit" action="<?= $block->escapeUrl($block->getSaveUrl()) ?>" method="post" @@ -74,7 +73,8 @@ $viewModel = $block->getViewModel(); value="<?= $block->escapeHtmlAttr($block->getStreetLine($_i + 1)) ?>" title="<?= $block->escapeHtmlAttr(__('Street Address %1', $_i + 1)) ?>" id="street_<?= /* @noEscape */ $_i + 1 ?>" - class="input-text <?= $block->escapeHtmlAttr($_streetValidationClass) ?>"> + class="input-text + <?= $block->escapeHtmlAttr($_streetValidationClassNotRequired) ?>"> </div> </div> <?php endfor; ?> From 7a4b904b9af51c82cea74b53dc9392b305942803 Mon Sep 17 00:00:00 2001 From: Soumya Unnikrishnan <sunnikri@adobe.com> Date: Thu, 9 Jan 2020 11:35:44 -0600 Subject: [PATCH 0760/1143] MQE-1920: [MTF-To-MFTF] Process PR 701 Adding cache flush to fix B2B failure. --- .../Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml index d0502b41e2856..99b2b2e6782af 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml @@ -36,6 +36,8 @@ <updateData createDataKey="createGuestCart" entity="GuestOrderPaymentMethod" stepKey="sendGuestPaymentInformation"> <requiredEntity createDataKey="createGuestCart"/> </updateData> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> <!--END Create order via API--> </before> <after> From 6c3a643d22d5e5c436b47e68c90acc87af7fdcb8 Mon Sep 17 00:00:00 2001 From: Soumya Unnikrishnan <sunnikri@adobe.com> Date: Thu, 9 Jan 2020 13:05:00 -0600 Subject: [PATCH 0761/1143] MQE-1920: [MTF-To-MFTF] Process PR 701 Adding cache flush to fix EE failure. --- .../AddressStateFieldShouldNotAcceptJustIntegerValuesTest.xml | 2 ++ .../Cms/Test/Mftf/Test/AdminCMSPageCreateDisabledPageTest.xml | 1 + 2 files changed, 3 insertions(+) diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/AddressStateFieldShouldNotAcceptJustIntegerValuesTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/AddressStateFieldShouldNotAcceptJustIntegerValuesTest.xml index f3e31d23f715b..dd454d7aca10b 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/AddressStateFieldShouldNotAcceptJustIntegerValuesTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/AddressStateFieldShouldNotAcceptJustIntegerValuesTest.xml @@ -23,6 +23,8 @@ <createData entity="ApiSimpleProduct" stepKey="createProduct"> <requiredEntity createDataKey="createCategory"/> </createData> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> </before> <after> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreateDisabledPageTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreateDisabledPageTest.xml index b2def26279dc5..5b83807eca244 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreateDisabledPageTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreateDisabledPageTest.xml @@ -17,6 +17,7 @@ <group value="backend"/> <group value="Cms"/> <group value="mtf_migrated"/> + <group value="WYSIWYGDisabled"/> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> From 918fd028fd9d768946e52a4edbcbd4dc0a77a434 Mon Sep 17 00:00:00 2001 From: Ravi Chandra <ravi.chandra@krishtechnolabs.com> Date: Fri, 10 Jan 2020 11:58:52 +0530 Subject: [PATCH 0762/1143] Fixed static test --- .../Backend/TierPrice/UpdateHandlerTest.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Backend/TierPrice/UpdateHandlerTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Backend/TierPrice/UpdateHandlerTest.php index c389a88043dd5..88adec0e20376 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Backend/TierPrice/UpdateHandlerTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Backend/TierPrice/UpdateHandlerTest.php @@ -128,12 +128,16 @@ public function testExecute(): void ['entity_id', $originalProductId] ] ); - $this->assertEquals($this->assertNotNull($newTierPrices[0]['price']), - $this->tierPriceResource->expects($this->atLeastOnce()) - ->method('updateValues')->with($newTierPrices, $originalTierPrices)->willReturn(true)); - $this->assertEquals($this->assertNull($newTierPrices[0]['price']), - $this->tierPriceResource->expects($this->atLeastOnce()) - ->method('updateValues')->with($newTierPrices, $originalTierPrices)->willReturn(false)); + $this->assertEquals( + $this->assertNotNull($newTierPrices[0]['price']), + $this->tierPriceResource->expects($this->atLeastOnce()) + ->method('updateValues')->with($newTierPrices, $originalTierPrices)->willReturn(true) + ); + $this->assertEquals( + $this->assertNull($newTierPrices[0]['price']), + $this->tierPriceResource->expects($this->atLeastOnce()) + ->method('updateValues')->with($newTierPrices, $originalTierPrices)->willReturn(false) + ); $product->expects($this->atLeastOnce())->method('getStoreId')->willReturn(0); $product->expects($this->atLeastOnce())->method('setData')->with('tier_price_changed', 1); $store = $this->getMockBuilder(\Magento\Store\Api\Data\StoreInterface::class) From 065353971c4dd2e835723d2702f391000cddb219 Mon Sep 17 00:00:00 2001 From: Tejash Kumbhare <tejas@wagento.com> Date: Fri, 10 Jan 2020 12:10:59 +0530 Subject: [PATCH 0763/1143] Module xml extra end tag removed --- app/code/Magento/AdvancedPricingImportExport/etc/module.xml | 3 +-- app/code/Magento/Dhl/etc/module.xml | 3 +-- app/code/Magento/Rss/etc/module.xml | 3 +-- app/code/Magento/Translation/etc/module.xml | 3 +-- app/code/Magento/Ups/etc/module.xml | 3 +-- 5 files changed, 5 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/AdvancedPricingImportExport/etc/module.xml b/app/code/Magento/AdvancedPricingImportExport/etc/module.xml index 230fb17ae5544..4482ba7a0a5e8 100644 --- a/app/code/Magento/AdvancedPricingImportExport/etc/module.xml +++ b/app/code/Magento/AdvancedPricingImportExport/etc/module.xml @@ -6,6 +6,5 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> - <module name="Magento_AdvancedPricingImportExport" > - </module> + <module name="Magento_AdvancedPricingImportExport" /> </config> diff --git a/app/code/Magento/Dhl/etc/module.xml b/app/code/Magento/Dhl/etc/module.xml index b1af1baf97fc2..c8f63d08f87a5 100644 --- a/app/code/Magento/Dhl/etc/module.xml +++ b/app/code/Magento/Dhl/etc/module.xml @@ -6,6 +6,5 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> - <module name="Magento_Dhl" > - </module> + <module name="Magento_Dhl" /> </config> diff --git a/app/code/Magento/Rss/etc/module.xml b/app/code/Magento/Rss/etc/module.xml index 196d8c3ac5655..eb56eef3d526f 100644 --- a/app/code/Magento/Rss/etc/module.xml +++ b/app/code/Magento/Rss/etc/module.xml @@ -6,6 +6,5 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> - <module name="Magento_Rss" > - </module> + <module name="Magento_Rss" /> </config> diff --git a/app/code/Magento/Translation/etc/module.xml b/app/code/Magento/Translation/etc/module.xml index 23ebfe1b0751d..f3f146b65416c 100644 --- a/app/code/Magento/Translation/etc/module.xml +++ b/app/code/Magento/Translation/etc/module.xml @@ -6,6 +6,5 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> - <module name="Magento_Translation" > - </module> + <module name="Magento_Translation" /> </config> diff --git a/app/code/Magento/Ups/etc/module.xml b/app/code/Magento/Ups/etc/module.xml index cc4599627ffb9..70cf0bc5ae98a 100644 --- a/app/code/Magento/Ups/etc/module.xml +++ b/app/code/Magento/Ups/etc/module.xml @@ -6,6 +6,5 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> - <module name="Magento_Ups" > - </module> + <module name="Magento_Ups" /> </config> From 0d8699cf96118fb67e621a57ad62fb2b67e142c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Chitesh=40wagento=2Ecom=E2=80=9D?= <hitesh@wagento.com> Date: Fri, 10 Jan 2020 12:17:21 +0530 Subject: [PATCH 0764/1143] [Changes as per sugession] --- .../frontend/Magento/blank/web/css/source/_navigation.less | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/design/frontend/Magento/blank/web/css/source/_navigation.less b/app/design/frontend/Magento/blank/web/css/source/_navigation.less index d34e256330159..0eeb175260fbd 100644 --- a/app/design/frontend/Magento/blank/web/css/source/_navigation.less +++ b/app/design/frontend/Magento/blank/web/css/source/_navigation.less @@ -154,7 +154,7 @@ &.greet.welcome { border-top: 1px solid @color-gray82; font-weight: @font-weight__bold; - padding: .8rem 15px; + padding: .8rem 15px .8rem @submenu__padding-left; } > a { @@ -168,7 +168,7 @@ .lib-css(text-decoration, @navigation-level0-item__text-decoration); display: block; font-weight: @font-weight__bold; - padding: .8rem 15px; + padding: .8rem 15px .8rem @submenu__padding-left; } .header.links { From 2d670758953465c2a9b4e89eec6018455416b078 Mon Sep 17 00:00:00 2001 From: "rostyslav.hymon" <rostyslav.hymon@transoftgroup.com> Date: Fri, 10 Jan 2020 09:47:17 +0200 Subject: [PATCH 0765/1143] MC-30201: ES6.0+ Display all products on page --- ...tProductsDisplayUsingElasticSearchTest.xml | 222 ++++++++++++++++++ .../Collection/SearchResultApplier.php | 2 + 2 files changed, 224 insertions(+) create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/StoreFrontProductsDisplayUsingElasticSearchTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StoreFrontProductsDisplayUsingElasticSearchTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StoreFrontProductsDisplayUsingElasticSearchTest.xml new file mode 100644 index 0000000000000..c444a567bf7c5 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/StoreFrontProductsDisplayUsingElasticSearchTest.xml @@ -0,0 +1,222 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="StoreFrontProductsDisplayUsingElasticSearchTest"> + <annotations> + <stories value="Display All Products"/> + <title value="Display All Products on a Page"/> + <description value="Set Up Elastic Search and Display all Products on Page"/> + <testCaseId value="MC-30209"/> + <severity value="CRITICAL"/> + <group value="Catalog"/> + </annotations> + <before> + <!-- Login Admin --> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <!--Create Category and Simple Products--> + <createData entity="SimpleSubCategory" stepKey="createCategory1"/> + <createData entity="SimpleProduct" stepKey="createSimpleProduct"> + <requiredEntity createDataKey="createCategory1"/> + </createData> + <createData entity="SimpleProduct" stepKey="createSimpleProduct2"> + <requiredEntity createDataKey="createCategory1"/> + </createData> + <createData entity="SimpleProduct" stepKey="createSimpleProduct3"> + <requiredEntity createDataKey="createCategory1"/> + </createData> + <createData entity="SimpleProduct" stepKey="createSimpleProduct4"> + <requiredEntity createDataKey="createCategory1"/> + </createData> + <createData entity="SimpleProduct" stepKey="createSimpleProduct5"> + <requiredEntity createDataKey="createCategory1"/> + </createData> + <createData entity="SimpleProduct" stepKey="createSimpleProduct6"> + <requiredEntity createDataKey="createCategory1"/> + </createData> + <createData entity="SimpleProduct" stepKey="createSimpleProduct7"> + <requiredEntity createDataKey="createCategory1"/> + </createData> + <createData entity="SimpleProduct" stepKey="createSimpleProduct8"> + <requiredEntity createDataKey="createCategory1"/> + </createData> + <createData entity="SimpleProduct" stepKey="createSimpleProduct9"> + <requiredEntity createDataKey="createCategory1"/> + </createData> + <createData entity="SimpleProduct" stepKey="createSimpleProduct10"> + <requiredEntity createDataKey="createCategory1"/> + </createData> + <createData entity="SimpleProduct" stepKey="createSimpleProduct11"> + <requiredEntity createDataKey="createCategory1"/> + </createData> + <createData entity="SimpleProduct" stepKey="createSimpleProduct12"> + <requiredEntity createDataKey="createCategory1"/> + </createData> + <createData entity="SimpleProduct" stepKey="createSimpleProduct13"> + <requiredEntity createDataKey="createCategory1"/> + </createData> + <createData entity="SimpleProduct" stepKey="createSimpleProduct14"> + <requiredEntity createDataKey="createCategory1"/> + </createData> + + <createData entity="SimpleProduct" stepKey="createSimpleProduct15"> + <requiredEntity createDataKey="createCategory1"/> + </createData> + + <createData entity="SimpleProduct" stepKey="createSimpleProduct16"> + <requiredEntity createDataKey="createCategory1"/> + </createData> + + <createData entity="SimpleProduct" stepKey="createSimpleProduct17"> + <requiredEntity createDataKey="createCategory1"/> + </createData> + + <createData entity="SimpleProduct" stepKey="createSimpleProduct18"> + <requiredEntity createDataKey="createCategory1"/> + </createData> + + <createData entity="SimpleProduct" stepKey="createSimpleProduct19"> + <requiredEntity createDataKey="createCategory1"/> + </createData> + + <createData entity="SimpleProduct" stepKey="createSimpleProduct20"> + <requiredEntity createDataKey="createCategory1"/> + </createData> + + <createData entity="SimpleProduct" stepKey="createSimpleProduct21"> + <requiredEntity createDataKey="createCategory1"/> + </createData> + + <createData entity="SimpleProduct" stepKey="createSimpleProduct22"> + <requiredEntity createDataKey="createCategory1"/> + </createData> + + <createData entity="SimpleProduct" stepKey="createSimpleProduct23"> + <requiredEntity createDataKey="createCategory1"/> + </createData> + + <createData entity="SimpleProduct" stepKey="createSimpleProduct24"> + <requiredEntity createDataKey="createCategory1"/> + </createData> + + <createData entity="SimpleProduct" stepKey="createSimpleProduct25"> + <requiredEntity createDataKey="createCategory1"/> + </createData> + + <createData entity="SimpleProduct" stepKey="createSimpleProduct26"> + <requiredEntity createDataKey="createCategory1"/> + </createData> + <createData entity="SimpleProduct" stepKey="createSimpleProduct27"> + <requiredEntity createDataKey="createCategory1"/> + </createData> + <createData entity="SimpleProduct" stepKey="createSimpleProduct28"> + <requiredEntity createDataKey="createCategory1"/> + </createData> + + <createData entity="SimpleProduct" stepKey="createSimpleProduct29"> + <requiredEntity createDataKey="createCategory1"/> + </createData> + <createData entity="SimpleProduct" stepKey="createSimpleProduct30"> + <requiredEntity createDataKey="createCategory1"/> + </createData> + + <!--Enable ElasticSearch as search engine.--> + <magentoCLI command="config:set catalog/search/engine elasticsearch6" stepKey="enableElasticSearchAsSearchEngine"/> + <magentoCLI command="indexer:reindex" stepKey="performReindexAfterElasticSearchEnable"/> + <magentoCLI command="cache:flush" stepKey="cleanCacheAfterElasticSearchEnable"/> + + </before> + <after> + <!--Delete created products, category --> + <deleteData createDataKey="createCategory1" stepKey="deleteCategory"/> + <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct1"/> + <deleteData createDataKey="createSimpleProduct2" stepKey="deleteSimpleProduct2"/> + <deleteData createDataKey="createSimpleProduct3" stepKey="deleteSimpleProduct3"/> + <deleteData createDataKey="createSimpleProduct4" stepKey="deleteSimpleProduct4"/> + <deleteData createDataKey="createSimpleProduct5" stepKey="deleteSimpleProduct5"/> + <deleteData createDataKey="createSimpleProduct6" stepKey="deleteSimpleProduct6"/> + <deleteData createDataKey="createSimpleProduct7" stepKey="deleteSimpleProduct7"/> + <deleteData createDataKey="createSimpleProduct8" stepKey="deleteSimpleProduct8"/> + <deleteData createDataKey="createSimpleProduct9" stepKey="deleteSimpleProduct9"/> + <deleteData createDataKey="createSimpleProduct10" stepKey="deleteSimpleProduct10"/> + <deleteData createDataKey="createSimpleProduct11" stepKey="deleteSimpleProduct11"/> + <deleteData createDataKey="createSimpleProduct12" stepKey="deleteSimpleProduct12"/> + <deleteData createDataKey="createSimpleProduct13" stepKey="deleteSimpleProduct13"/> + <deleteData createDataKey="createSimpleProduct14" stepKey="deleteSimpleProduct14"/> + <deleteData createDataKey="createSimpleProduct15" stepKey="deleteSimpleProduct15"/> + <deleteData createDataKey="createSimpleProduct16" stepKey="deleteSimpleProduct16"/> + <deleteData createDataKey="createSimpleProduct17" stepKey="deleteSimpleProduct17"/> + <deleteData createDataKey="createSimpleProduct18" stepKey="deleteSimpleProduct18"/> + <deleteData createDataKey="createSimpleProduct19" stepKey="deleteSimpleProduct19"/> + <deleteData createDataKey="createSimpleProduct20" stepKey="deleteSimpleProduct20"/> + <deleteData createDataKey="createSimpleProduct21" stepKey="deleteSimpleProduct21"/> + <deleteData createDataKey="createSimpleProduct22" stepKey="deleteSimpleProduct22"/> + <deleteData createDataKey="createSimpleProduct23" stepKey="deleteSimpleProduct23"/> + <deleteData createDataKey="createSimpleProduct24" stepKey="deleteSimpleProduct24"/> + <deleteData createDataKey="createSimpleProduct25" stepKey="deleteSimpleProduct25"/> + <deleteData createDataKey="createSimpleProduct26" stepKey="deleteSimpleProduct26"/> + <deleteData createDataKey="createSimpleProduct27" stepKey="deleteSimpleProduct27"/> + <deleteData createDataKey="createSimpleProduct28" stepKey="deleteSimpleProduct28"/> + <deleteData createDataKey="createSimpleProduct29" stepKey="deleteSimpleProduct29"/> + <deleteData createDataKey="createSimpleProduct30" stepKey="deleteSimpleProduct30"/> + + + <!--Revert ElasticSearch as search engine.--> + <actionGroup ref="ResetSearchEngineConfiguration" stepKey="resetCatalogSearchConfiguration"/> + <magentoCLI command="indexer:reindex" stepKey="performReindexAfterElasticSearchDisable"/> + <magentoCLI command="cache:flush" stepKey="cleanCacheAfterElasticSearchDisable"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <!--Open Storefront on the myCategory page--> + <amOnPage url="/$$createCategory1.name$$.html" stepKey="GoToStorefrontCategory"/> + <waitForPageLoad stepKey="waitForStorefrontCategoryPageLoad"/> + + <!--Select 12 items per page and verify number of products displayed in each page --> + <conditionalClick selector="{{StorefrontCategoryTopToolbarSection.gridMode}}" visible="true" dependentSelector="{{StorefrontCategoryTopToolbarSection.gridMode}}" stepKey="seeProductGridIsActive"/> + <scrollTo selector="{{StorefrontCategoryBottomToolbarSection.perPage}}" stepKey="scrollToBottomToolbarSection"/> + <selectOption selector="{{StorefrontCategoryBottomToolbarSection.perPage}}" userInput="12" stepKey="selectPerPageOption"/> + <!--Verify number of products displayed in First Page --> + <seeNumberOfElements selector="{{StorefrontCategoryMainSection.productLink}}" userInput="12" stepKey="seeNumberOfProductsInFirstPage"/> + <!--Verify number of products displayed in Second Page --> + <scrollTo selector="{{StorefrontCategoryBottomToolbarSection.nextPage}}" stepKey="scrollToNextButton"/> + <click selector="{{StorefrontCategoryBottomToolbarSection.nextPage}}" stepKey="clickOnNextPage"/> + <waitForPageLoad stepKey="waitForPageToLoad4"/> + <seeNumberOfElements selector="{{StorefrontCategoryMainSection.productLink}}" userInput="12" stepKey="seeNumberOfProductsInSecondPage"/> + <!--Verify number of products displayed in third Page --> + <scrollTo selector="{{StorefrontCategoryBottomToolbarSection.nextPage}}" stepKey="scrollToNextButton1"/> + <click selector="{{StorefrontCategoryBottomToolbarSection.nextPage}}" stepKey="clickOnNextPage1"/> + <waitForPageLoad stepKey="waitForPageToLoad2"/> + <seeNumberOfElements selector="{{StorefrontCategoryMainSection.productLink}}" userInput="6" stepKey="seeNumberOfProductsInThirdPage"/> + + <!--Select First Page using page number--> + <scrollTo selector="{{StorefrontCategoryBottomToolbarSection.previousPage}}" stepKey="scrollToPreviousPage4"/> + <click selector="{{StorefrontCategoryBottomToolbarSection.pageNumber('1')}}" stepKey="clickOnFirstPage"/> + <waitForPageLoad stepKey="waitForPageToLoad9"/> + <seeNumberOfElements selector="{{StorefrontCategoryMainSection.productLink}}" userInput="12" stepKey="seeNumberOfProductsFirstPage2"/> + <!--Select 24 items per page and verify number of products displayed in each page --> + <scrollTo selector="{{StorefrontCategoryBottomToolbarSection.perPage}}" stepKey="scrollToPerPage"/> + <selectOption selector="{{StorefrontCategoryBottomToolbarSection.perPage}}" userInput="24" stepKey="selectPerPageOption1"/> + <waitForPageLoad stepKey="waitForPageToLoad10"/> + <seeNumberOfElements selector="{{StorefrontCategoryMainSection.productLink}}" userInput="24" stepKey="seeNumberOfProductsInFirstPage3"/> + <scrollTo selector="{{StorefrontCategoryBottomToolbarSection.nextPage}}" stepKey="scrollToNextButton2"/> + <click selector="{{StorefrontCategoryBottomToolbarSection.nextPage}}" stepKey="clickOnNextPage2"/> + <waitForPageLoad stepKey="waitForPageToLoad11"/> + <seeNumberOfElements selector="{{StorefrontCategoryMainSection.productLink}}" userInput="6" stepKey="seeNumberOfProductsInSecondPage3"/> + <!--Select First Page using page number--> + <scrollTo selector="{{StorefrontCategoryBottomToolbarSection.pageNumber('1')}}" stepKey="scrollToPreviousPage5"/> + <click selector="{{StorefrontCategoryBottomToolbarSection.pageNumber('1')}}" stepKey="clickOnFirstPage2"/> + <waitForPageLoad stepKey="waitForPageToLoad13"/> + <!--Select 36 items per page and verify number of products displayed in each page --> + <scrollTo selector="{{StorefrontCategoryBottomToolbarSection.perPage}}" stepKey="scrollToPerPage4"/> + <selectOption selector="{{StorefrontCategoryBottomToolbarSection.perPage}}" userInput="36" stepKey="selectPerPageOption2"/> + <waitForPageLoad stepKey="waitForPageToLoad12"/> + <seeNumberOfElements selector="{{StorefrontCategoryMainSection.productLink}}" userInput="30" stepKey="seeNumberOfProductsInFirstPage4"/> + </test> +</tests> diff --git a/app/code/Magento/Elasticsearch/Model/ResourceModel/Fulltext/Collection/SearchResultApplier.php b/app/code/Magento/Elasticsearch/Model/ResourceModel/Fulltext/Collection/SearchResultApplier.php index ad52f81bf8eda..2ee34b6b4c5b1 100644 --- a/app/code/Magento/Elasticsearch/Model/ResourceModel/Fulltext/Collection/SearchResultApplier.php +++ b/app/code/Magento/Elasticsearch/Model/ResourceModel/Fulltext/Collection/SearchResultApplier.php @@ -85,6 +85,8 @@ public function apply() private function sliceItems(array $items, int $size, int $currentPage): array { if ($size !== 0) { + $totalPages = (int) ceil(count($items)/$size); + $currentPage = min($currentPage, $totalPages); $offset = ($currentPage - 1) * $size; if ($offset < 0) { $offset = 0; From ad71c044d99536ff629337beffd779ae3e010d28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Chitesh=40wagento=2Ecom=E2=80=9D?= <hitesh@wagento.com> Date: Fri, 10 Jan 2020 14:39:01 +0530 Subject: [PATCH 0766/1143] [Changes as per sugession] --- .../frontend/Magento/blank/web/css/source/_navigation.less | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/design/frontend/Magento/blank/web/css/source/_navigation.less b/app/design/frontend/Magento/blank/web/css/source/_navigation.less index 0eeb175260fbd..fad906a089400 100644 --- a/app/design/frontend/Magento/blank/web/css/source/_navigation.less +++ b/app/design/frontend/Magento/blank/web/css/source/_navigation.less @@ -154,7 +154,7 @@ &.greet.welcome { border-top: 1px solid @color-gray82; font-weight: @font-weight__bold; - padding: .8rem 15px .8rem @submenu__padding-left; + padding: .8rem @submenu__padding-left; } > a { @@ -168,7 +168,7 @@ .lib-css(text-decoration, @navigation-level0-item__text-decoration); display: block; font-weight: @font-weight__bold; - padding: .8rem 15px .8rem @submenu__padding-left; + padding: .8rem @submenu__padding-left; } .header.links { From 74a244f10fc0b945960167b713489df22b202154 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Fri, 10 Jan 2020 12:15:31 +0200 Subject: [PATCH 0767/1143] Refactor per review comments, add new test case --- .../Test/Unit/Controller/Index/UpdateTest.php | 214 +++++++++++------- 1 file changed, 130 insertions(+), 84 deletions(-) diff --git a/app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateTest.php b/app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateTest.php index 86de21fd7f983..e6c07d35b46fd 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateTest.php @@ -13,12 +13,15 @@ use Magento\Framework\Exception\NotFoundException; use Magento\Framework\Message\ManagerInterface; use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; use Magento\Wishlist\Controller\Index\Update; use Magento\Wishlist\Controller\WishlistProviderInterface; use Magento\Wishlist\Helper\Data; use Magento\Wishlist\Model\Item; use Magento\Wishlist\Model\LocaleQuantityProcessor; +use Magento\Wishlist\Model\Wishlist; use PHPUnit\Framework\TestCase; +use PHPUnit_Framework_MockObject_MockObject as MockObject; /** * Test for upate controller wishlist @@ -27,19 +30,33 @@ class UpdateTest extends TestCase { /** - * @var Validator $formKeyValidator + * Wishlist item id + * + * @var int + */ + private const ITEM_ID = 1; + + /** + * Product qty for wishlist + * + * @var int */ - private $formKeyValidator; + private const WISHLIST_PRODUCT_QTY = 21; /** - * @var WishlistProviderInterface $wishlistProvider + * @var MockObject|Validator $formKeyValidatorMock */ - private $wishlistProvider; + private $formKeyValidatorMock; /** - * @var LocaleQuantityProcessor $quantityProcessor + * @var MockObject|WishlistProviderInterface $wishlistProviderMock */ - private $quantityProcessor; + private $wishlistProviderMock; + + /** + * @var MockObject|LocaleQuantityProcessor $quantityProcessorMock + */ + private $quantityProcessorMock; /** * @var Update $updateController @@ -47,75 +64,76 @@ class UpdateTest extends TestCase private $updateController; /** - * @var $context + * @var MockObject|Context$contextMock */ - private $context; + private $contextMock; /** - * @var Redirect $resultRedirect + * @var MockObject|Redirect $resultRedirectMock */ - private $resultRedirect; + private $resultRedirectMock; /** - * @var ResultFactory $resultFatory + * @var MockObject|ResultFactory $resultFatoryMock */ - private $resultFactory; + private $resultFactoryMock; /** - * @var RequestInterface $requestMock + * @var MockObject|RequestInterface $requestMock */ private $requestMock; /** - * @var ObjectManagerInterface $objectManagerMock + * @var MockObject|ObjectManagerInterface $objectManagerMock */ private $objectManagerMock; /** - * @var ManagerInterface $messageManager + * @var MockObject|ManagerInterface $messageManagerMock */ - private $messageManager; + private $messageManagerMock; /** * @inheritdoc */ protected function setUp() { - $this->formKeyValidator = $this->createMock(Validator::class); - $this->wishlistProvider = $this->createMock(WishlistProviderInterface::class); - $this->quantityProcessor = $this->createMock(LocaleQuantityProcessor::class); - $this->context = $this->createMock(Context::class); - $this->resultRedirect = $this->createMock(Redirect::class); - $this->resultFactory = $this->createPartialMock(ResultFactory::class, ['create']); + $this->formKeyValidatorMock = $this->createMock(Validator::class); + $this->wishlistProviderMock = $this->createMock(WishlistProviderInterface::class); + $this->quantityProcessorMock = $this->createMock(LocaleQuantityProcessor::class); + $this->contextMock = $this->createMock(Context::class); + $this->resultRedirectMock = $this->createMock(Redirect::class); + $this->resultFactoryMock = $this->createPartialMock(ResultFactory::class, ['create']); + $this->messageManagerMock = $this->createMock(ManagerInterface::class); + $this->objectManagerMock = $this->createMock(ObjectManagerInterface::class); $this->requestMock = $this->getMockBuilder(RequestInterface::class) ->setMethods(['getPostValue']) ->getMockForAbstractClass(); - $this->objectManagerMock = $this->createMock(ObjectManagerInterface::class); - $this->context->expects($this->once()) + $this->resultFactoryMock->expects($this->any()) + ->method('create') + ->willReturn($this->resultRedirectMock); + $this->contextMock->expects($this->once()) ->method('getResultFactory') - ->willReturn($this->resultFactory); - $this->context->expects($this->once()) + ->willReturn($this->resultFactoryMock); + $this->contextMock->expects($this->once()) ->method('getObjectManager') ->willReturn($this->objectManagerMock); - - $this->resultFactory->expects($this->any()) - ->method('create') - ->willReturn($this->resultRedirect); - $this->context->expects($this->any()) + $this->contextMock->expects($this->any()) ->method('getRequest') ->willReturn($this->requestMock); - - $this->messageManager = $this->createMock(ManagerInterface::class); - $this->context->expects($this->any()) + $this->contextMock->expects($this->any()) ->method('getMessageManager') - ->willReturn($this->messageManager); + ->willReturn($this->messageManagerMock); - $this->updateController = new Update( - $this->context, - $this->formKeyValidator, - $this->wishlistProvider, - $this->quantityProcessor + $this->updateController = (new ObjectManagerHelper($this))->getObject( + Update::class, + [ + 'context' => $this->contextMock, + '_formKeyValidator' => $this->formKeyValidatorMock, + 'wishlistProvider' => $this->wishlistProviderMock, + 'quantityProcessor' => $this->quantityProcessorMock + ] ); } @@ -123,28 +141,13 @@ protected function setUp() * Test for update method Wishlist controller. * * @dataProvider getWishlistDataProvider + * @param array $wishlistDataProvider + * @param array $postData * @return void */ - public function testUpdate(array $wishlistDataProvider): void + public function testUpdate(array $wishlistDataProvider, array $postData): void { - $this->formKeyValidator->expects($this->once()) - ->method('validate') - ->willReturn(true); - - $wishlist = $this->createMock(\Magento\Wishlist\Model\Wishlist::class); - - $this->wishlistProvider->expects($this->once()) - ->method('getWishlist') - ->willReturn($wishlist); - $wishlist->expects($this->exactly(2)) - ->method('getId') - ->willReturn($wishlistDataProvider['wishlist_data']['id']); - $this->requestMock->expects($this->once()) - ->method('getPostValue') - ->willReturn($wishlistDataProvider['post_data']); - $this->resultRedirect->expects($this->once()) - ->method('setPath') - ->with('*', ['wishlist_id' => $wishlistDataProvider['wishlist_data']['id']]); + $wishlist = $this->createMock(Wishlist::class); $itemMock = $this->getMockBuilder(Item::class) ->disableOriginalConstructor() ->setMethods( @@ -160,7 +163,27 @@ public function testUpdate(array $wishlistDataProvider): void 'getName' ] )->getMock(); + $dataMock = $this->createMock(Data::class); + $productMock = $this->getMockBuilder(\Magento\Catalog\Model\Product::class) + ->disableOriginalConstructor() + ->getMock(); + $this->formKeyValidatorMock->expects($this->once()) + ->method('validate') + ->with($this->requestMock) + ->willReturn(true); + $this->wishlistProviderMock->expects($this->once()) + ->method('getWishlist') + ->willReturn($wishlist); + $wishlist->expects($this->exactly(2)) + ->method('getId') + ->willReturn($wishlistDataProvider['id']); + $this->requestMock->expects($this->once()) + ->method('getPostValue') + ->willReturn($postData); + $this->resultRedirectMock->expects($this->once()) + ->method('setPath') + ->with('*', ['wishlist_id' => $wishlistDataProvider['id']]); $this->objectManagerMock->expects($this->once()) ->method('create') ->with(Item::class) @@ -171,7 +194,7 @@ public function testUpdate(array $wishlistDataProvider): void ->willReturnSelf(); $itemMock->expects($this->once()) ->method('getWishLIstId') - ->willReturn($wishlistDataProvider['wishlist_data']['id']); + ->willReturn($wishlistDataProvider['id']); $itemMock->expects($this->once()) ->method('getDescription') ->willReturn(''); @@ -181,8 +204,6 @@ public function testUpdate(array $wishlistDataProvider): void $itemMock->expects($this->once()) ->method('setQty') ->willReturnSelf(); - $dataMock = $this->createMock(Data::class); - $this->objectManagerMock->expects($this->exactly(2)) ->method('get') ->with(Data::class) @@ -192,33 +213,62 @@ public function testUpdate(array $wishlistDataProvider): void ->willReturn(''); $dataMock->expects($this->once()) ->method('calculate'); - $this->quantityProcessor->expects($this->once()) + $this->quantityProcessorMock->expects($this->once()) ->method('process') - ->willReturn($wishlistDataProvider['post_data']['qty']); - - $productMock = $this->getMockBuilder(\Magento\Catalog\Model\Product::class) - ->disableOriginalConstructor() - ->getMock(); + ->willReturn($postData['qty']); $itemMock->expects($this->once()) ->method('getProduct') ->willReturn($productMock); $productMock->expects($this->once()) ->method('getName') ->willReturn('product'); - $this->messageManager->expects($this->once()) + $this->messageManagerMock->expects($this->once()) ->method('addSuccessMessage'); - $this->assertEquals($this->resultRedirect, $this->updateController->execute()); + + $this->assertEquals($this->resultRedirectMock, $this->updateController->execute()); + } + + /** + * Verify update method if post data not available + * + * @dataProvider getWishlistDataProvider + * @param array $wishlistDataProvider + * @return void + */ + public function testUpdateRedirectWhenNoPostData(array $wishlistDataProvider): void + { + $wishlist = $this->createMock(Wishlist::class); + + $this->formKeyValidatorMock->expects($this->once()) + ->method('validate') + ->willReturn(true); + $this->wishlistProviderMock->expects($this->once()) + ->method('getWishlist') + ->willReturn($wishlist); + $wishlist->expects($this->exactly(1)) + ->method('getId') + ->willReturn($wishlistDataProvider['id']); + $this->resultRedirectMock->expects($this->once()) + ->method('setPath') + ->with('*', ['wishlist_id' => $wishlistDataProvider['id']]); + $this->requestMock->expects($this->once()) + ->method('getPostValue') + ->willReturn(null); + + $this->assertEquals($this->resultRedirectMock, $this->updateController->execute()); } /** * Check if wishlist not availbale, and exception is shown + * + * @return void */ - public function testUpdateWithNotFoundException() + public function testUpdateThrowsNotFoundExceptionWhenWishlistDoNotExist(): void { - $this->formKeyValidator->expects($this->once()) + $this->formKeyValidatorMock->expects($this->once()) ->method('validate') ->willReturn(true); - $this->wishlistProvider->expects($this->once()) + $this->wishlistProviderMock->expects($this->once()) ->method('getWishlist') ->willReturn(null); $this->expectException(NotFoundException::class); @@ -232,21 +282,17 @@ public function testUpdateWithNotFoundException() */ public function getWishlistDataProvider(): array { - return [ + return [ [ - 'wishlist_data' => [ - 'id' => 1, - + [ + 'id' => self::ITEM_ID ], - 'post_data' => [ - 'qty' => [1 => 12], - 'description' => [ - 1 => 'Description for item_id 1' - ] + [ + 'qty' => [self::ITEM_ID => self::WISHLIST_PRODUCT_QTY], + 'description' => [self::ITEM_ID => 'Description for item_id 1'] ] ] - ] - ]; + ]; } } From 1748633667a1a0eef94b47ebd54963b33e338068 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Fri, 10 Jan 2020 12:56:24 +0200 Subject: [PATCH 0768/1143] rename const with prefix "stub" move Object Manager to separate variable --- .../Test/Unit/Controller/Index/UpdateTest.php | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateTest.php b/app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateTest.php index e6c07d35b46fd..88aeec5e5a924 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateTest.php @@ -29,19 +29,9 @@ */ class UpdateTest extends TestCase { - /** - * Wishlist item id - * - * @var int - */ - private const ITEM_ID = 1; + private const STUB_ITEM_ID = 1; - /** - * Product qty for wishlist - * - * @var int - */ - private const WISHLIST_PRODUCT_QTY = 21; + private const STUB_WISHLIST_PRODUCT_QTY = 21; /** * @var MockObject|Validator $formKeyValidatorMock @@ -126,7 +116,9 @@ protected function setUp() ->method('getMessageManager') ->willReturn($this->messageManagerMock); - $this->updateController = (new ObjectManagerHelper($this))->getObject( + $objectManager = new ObjectManagerHelper($this); + + $this->updateController = $objectManager->getObject( Update::class, [ 'context' => $this->contextMock, @@ -286,11 +278,11 @@ public function getWishlistDataProvider(): array [ [ [ - 'id' => self::ITEM_ID + 'id' => self::STUB_ITEM_ID ], [ - 'qty' => [self::ITEM_ID => self::WISHLIST_PRODUCT_QTY], - 'description' => [self::ITEM_ID => 'Description for item_id 1'] + 'qty' => [self::STUB_ITEM_ID => self::STUB_WISHLIST_PRODUCT_QTY], + 'description' => [self::STUB_ITEM_ID => 'Description for item_id 1'] ] ] ]; From d99e231663538cc35ef883077266337af9bfc06b Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Fri, 10 Jan 2020 13:25:33 +0200 Subject: [PATCH 0769/1143] MC-29775: [Magento Cloud] Recently Viewed products issues in Multi website and store setup --- .../Magento/Catalog/view/frontend/web/js/product/provider.js | 3 ++- .../frontend/web/js/product/storage/ids-storage-compare.js | 3 ++- .../Catalog/view/frontend/web/js/product/view/provider.js | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Catalog/view/frontend/web/js/product/provider.js b/app/code/Magento/Catalog/view/frontend/web/js/product/provider.js index b29ebe7d57d1c..ca9381c45e2ab 100644 --- a/app/code/Magento/Catalog/view/frontend/web/js/product/provider.js +++ b/app/code/Magento/Catalog/view/frontend/web/js/product/provider.js @@ -143,7 +143,8 @@ define([ _.each(ids, function (id) { if ( currentTime - id['added_at'] < ~~this.idsStorage.lifetime && - !_.contains(currentProductIds, id['product_id']) + !_.contains(currentProductIds, id['product_id']) && + (!id.hasOwnProperty('website_id') || id['website_id'] === window.checkout.websiteId) ) { _ids[id['product_id']] = id; diff --git a/app/code/Magento/Catalog/view/frontend/web/js/product/storage/ids-storage-compare.js b/app/code/Magento/Catalog/view/frontend/web/js/product/storage/ids-storage-compare.js index 2dc6105ca24d5..a904d8ed3b3da 100644 --- a/app/code/Magento/Catalog/view/frontend/web/js/product/storage/ids-storage-compare.js +++ b/app/code/Magento/Catalog/view/frontend/web/js/product/storage/ids-storage-compare.js @@ -72,7 +72,8 @@ define([ _.each(data, function (item) { result[item.id] = { 'added_at': new Date().getTime() / 1000, - 'product_id': item.id + 'product_id': item.id, + 'website_id': window.checkout.websiteId }; }); diff --git a/app/code/Magento/Catalog/view/frontend/web/js/product/view/provider.js b/app/code/Magento/Catalog/view/frontend/web/js/product/view/provider.js index 9d3746973ef58..f4ce882dd668b 100644 --- a/app/code/Magento/Catalog/view/frontend/web/js/product/view/provider.js +++ b/app/code/Magento/Catalog/view/frontend/web/js/product/view/provider.js @@ -90,7 +90,8 @@ define([ _.each(this.data.items, function (item, key) { result[key] = { 'added_at': new Date().getTime() / 1000, - 'product_id': key + 'product_id': key, + 'website_id': window.checkout.websiteId }; }, this); From 66027118ad00f61052aa3e53a6986030c2c81f17 Mon Sep 17 00:00:00 2001 From: "rostyslav.hymon" <rostyslav.hymon@transoftgroup.com> Date: Fri, 10 Jan 2020 13:43:33 +0200 Subject: [PATCH 0770/1143] MC-29866: getBasePrice function returns a string sometimes --- .../Catalog/Model/Product/Type/PriceTest.php | 75 ++----------------- 1 file changed, 8 insertions(+), 67 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/PriceTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/PriceTest.php index 3672b8b065bf5..1759118d0cbb3 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/PriceTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/PriceTest.php @@ -11,7 +11,6 @@ use Magento\Catalog\Api\ProductRepositoryInterface; use Magento\Catalog\Model\Product; use Magento\Catalog\Model\Product\Option; -use Magento\Customer\Model\Session; use Magento\Framework\DataObject; use Magento\TestFramework\Helper\Bootstrap; use Magento\TestFramework\ObjectManager; @@ -40,68 +39,14 @@ class PriceTest extends TestCase */ private $productRepository; - /** - * @var Session - */ - private $customerSession; - /** * @inheritdoc */ - protected function setUp(): void + protected function setUp() { $this->objectManager = Bootstrap::getObjectManager(); $this->productPrice = $this->objectManager->create(Price::class); $this->productRepository = $this->objectManager->create(ProductRepositoryInterface::class); - $this->customerSession = $this->objectManager->get(Session::class); - } - - /** - * Assert that for logged user product price equal to price from catalog rule. - * - * @magentoDataFixture Magento/Catalog/_files/product_simple.php - * @magentoDataFixture Magento/CatalogRule/_files/catalog_rule_6_off_logged_user.php - * @magentoDataFixture Magento/Customer/_files/customer.php - * - * @magentoDbIsolation disabled - * @magentoAppArea frontend - * @magentoAppIsolation enabled - * - * @return void - */ - public function testPriceByRuleForLoggedUser(): void - { - $product = $this->productRepository->get('simple'); - $this->assertEquals(10, $this->productPrice->getFinalPrice(1, $product)); - $this->customerSession->setCustomerId(1); - try { - $this->assertEquals(4, $this->productPrice->getFinalPrice(1, $product)); - } finally { - $this->customerSession->setCustomerId(null); - } - } - - /** - * Assert price for different customer groups. - * - * @magentoDataFixture Magento/Catalog/_files/simple_product_with_tier_price_for_logged_user.php - * @magentoDataFixture Magento/Customer/_files/customer.php - * - * @magentoAppIsolation enabled - * - * @return void - */ - public function testTierPriceWithDifferentCustomerGroups(): void - { - $product = $this->productRepository->get('simple'); - $this->assertEquals(8, $this->productPrice->getFinalPrice(2, $product)); - $this->assertEquals(5, $this->productPrice->getFinalPrice(3, $product)); - $this->customerSession->setCustomerId(1); - try { - $this->assertEquals(1, $this->productPrice->getFinalPrice(3, $product)); - } finally { - $this->customerSession->setCustomerId(null); - } } /** @@ -134,6 +79,7 @@ public function testGetBasePrice(): void public function testGetFinalPrice(): void { $product = $this->productRepository->get('simple'); + // fixture // regular & tier prices $this->assertEquals(10.0, $this->productPrice->getFinalPrice(1, $product)); @@ -159,6 +105,7 @@ public function testGetFinalPrice(): void public function testGetFormatedPrice(): void { $product = $this->productRepository->get('simple'); + // fixture $this->assertEquals('<span class="price">$10.00</span>', $this->productPrice->getFormatedPrice($product)); } @@ -169,14 +116,8 @@ public function testGetFormatedPrice(): void */ public function testCalculatePrice(): void { - $this->assertEquals( - 10, - $this->productPrice->calculatePrice(10, 8, '1970-12-12 23:59:59', '1971-01-01 01:01:01') - ); - $this->assertEquals( - 8, - $this->productPrice->calculatePrice(10, 8, '1970-12-12 23:59:59', '2034-01-01 01:01:01') - ); + $this->assertEquals(10, $this->productPrice->calculatePrice(10, 8, '1970-12-12 23:59:59', '1971-01-01 01:01:01')); + $this->assertEquals(8, $this->productPrice->calculatePrice(10, 8, '1970-12-12 23:59:59', '2034-01-01 01:01:01')); } /** @@ -207,7 +148,7 @@ public function testIsTierPriceFixed(): void } /** - * Build buy request based on product custom options. + * Build buy request based on product custom options * * @param Product $product * @return DataObject @@ -215,7 +156,7 @@ public function testIsTierPriceFixed(): void private function prepareBuyRequest(Product $product): DataObject { $options = []; - /** @var Option $option */ + /** @var $option Option */ foreach ($product->getOptions() as $option) { switch ($option->getGroupByType()) { case ProductCustomOptionInterface::OPTION_GROUP_DATE: @@ -231,6 +172,6 @@ private function prepareBuyRequest(Product $product): DataObject $options[$option->getId()] = $value; } - return $this->objectManager->create(DataObject::class, ['data' => ['qty' => 1, 'options' => $options]]); + return new DataObject(['qty' => 1, 'options' => $options]); } } From 399fe8eb8f463bf85702e10e0c81c8cfe99a2abf Mon Sep 17 00:00:00 2001 From: Tejash Kumbhare <tejas@wagento.com> Date: Fri, 10 Jan 2020 17:18:20 +0530 Subject: [PATCH 0771/1143] model xml issues fixed --- app/code/Magento/AdvancedPricingImportExport/etc/module.xml | 2 +- app/code/Magento/Dhl/etc/module.xml | 2 +- app/code/Magento/Rss/etc/module.xml | 2 +- app/code/Magento/Translation/etc/module.xml | 2 +- app/code/Magento/Ups/etc/module.xml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/AdvancedPricingImportExport/etc/module.xml b/app/code/Magento/AdvancedPricingImportExport/etc/module.xml index 4482ba7a0a5e8..ac7e6f860382b 100644 --- a/app/code/Magento/AdvancedPricingImportExport/etc/module.xml +++ b/app/code/Magento/AdvancedPricingImportExport/etc/module.xml @@ -6,5 +6,5 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> - <module name="Magento_AdvancedPricingImportExport" /> + <module name="Magento_AdvancedPricingImportExport"/> </config> diff --git a/app/code/Magento/Dhl/etc/module.xml b/app/code/Magento/Dhl/etc/module.xml index c8f63d08f87a5..e46bb72ad7b3c 100644 --- a/app/code/Magento/Dhl/etc/module.xml +++ b/app/code/Magento/Dhl/etc/module.xml @@ -6,5 +6,5 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> - <module name="Magento_Dhl" /> + <module name="Magento_Dhl"/> </config> diff --git a/app/code/Magento/Rss/etc/module.xml b/app/code/Magento/Rss/etc/module.xml index eb56eef3d526f..c00b53e716230 100644 --- a/app/code/Magento/Rss/etc/module.xml +++ b/app/code/Magento/Rss/etc/module.xml @@ -6,5 +6,5 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> - <module name="Magento_Rss" /> + <module name="Magento_Rss"/> </config> diff --git a/app/code/Magento/Translation/etc/module.xml b/app/code/Magento/Translation/etc/module.xml index f3f146b65416c..5bf40ec19b6e2 100644 --- a/app/code/Magento/Translation/etc/module.xml +++ b/app/code/Magento/Translation/etc/module.xml @@ -6,5 +6,5 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> - <module name="Magento_Translation" /> + <module name="Magento_Translation"/> </config> diff --git a/app/code/Magento/Ups/etc/module.xml b/app/code/Magento/Ups/etc/module.xml index 70cf0bc5ae98a..1c449f6b1cdb5 100644 --- a/app/code/Magento/Ups/etc/module.xml +++ b/app/code/Magento/Ups/etc/module.xml @@ -6,5 +6,5 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> - <module name="Magento_Ups" /> + <module name="Magento_Ups"/> </config> From 0e505138be83891a2079cb6397e0006c583974c2 Mon Sep 17 00:00:00 2001 From: "rostyslav.hymon" <rostyslav.hymon@transoftgroup.com> Date: Fri, 10 Jan 2020 14:51:47 +0200 Subject: [PATCH 0772/1143] MC-29866: getBasePrice function returns a string sometimes --- .../Magento/Catalog/Model/Product/Type/PriceTest.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/PriceTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/PriceTest.php index 1759118d0cbb3..f91df5daa4c73 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/PriceTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/PriceTest.php @@ -116,8 +116,14 @@ public function testGetFormatedPrice(): void */ public function testCalculatePrice(): void { - $this->assertEquals(10, $this->productPrice->calculatePrice(10, 8, '1970-12-12 23:59:59', '1971-01-01 01:01:01')); - $this->assertEquals(8, $this->productPrice->calculatePrice(10, 8, '1970-12-12 23:59:59', '2034-01-01 01:01:01')); + $this->assertEquals( + 10, + $this->productPrice->calculatePrice(10, 8, '1970-12-12 23:59:59', '1971-01-01 01:01:01') + ); + $this->assertEquals( + 8, + $this->productPrice->calculatePrice(10, 8, '1970-12-12 23:59:59', '2034-01-01 01:01:01') + ); } /** From 6d7b457abb3faae9acece068d4be21d1b69a06c8 Mon Sep 17 00:00:00 2001 From: Max Romanov <maxromanov4669@gmail.com> Date: Fri, 10 Jan 2020 14:52:18 +0200 Subject: [PATCH 0773/1143] 11209-wishlist-add-grouped-product-error --- .../GroupedProduct/Model/Wishlist/Product/Item.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/GroupedProduct/Model/Wishlist/Product/Item.php b/app/code/Magento/GroupedProduct/Model/Wishlist/Product/Item.php index c692629131c8d..d84df510195f3 100644 --- a/app/code/Magento/GroupedProduct/Model/Wishlist/Product/Item.php +++ b/app/code/Magento/GroupedProduct/Model/Wishlist/Product/Item.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\GroupedProduct\Model\Wishlist\Product; use Magento\Wishlist\Model\Item as WishlistItem; @@ -25,7 +27,7 @@ class Item public function beforeRepresentProduct( WishlistItem $subject, Product $product - ) { + ): array { if ($product->getTypeId() === TypeGrouped::TYPE_CODE && $product->getId() === $subject->getProduct()->getId() ) { @@ -72,9 +74,9 @@ public function beforeRepresentProduct( */ public function beforeCompareOptions( WishlistItem $subject, - $options1, - $options2 - ) { + array $options1, + array $options2 + ): array { $diff = array_diff_key($options1, $options2); if (!$diff) { From b8a23bdd61a35ea6f9c3d731b1c9b893e8164f11 Mon Sep 17 00:00:00 2001 From: "ivan.pletnyov" <ivan.pletnyov@transoftgroup.com> Date: Fri, 10 Jan 2020 15:57:10 +0200 Subject: [PATCH 0774/1143] MC-25073: Storefront: Check special/tier/group/rule/option price for product --- .../ListProduct/CheckProductPriceTest.php | 310 ++++++++++++++++++ .../product_simple_tax_none_rollback.php | 11 +- .../product_simple_with_fixed_tier_price.php | 40 +++ ..._with_fixed_tier_price_for_logged_user.php | 39 +++ ...ed_tier_price_for_logged_user_rollback.php | 8 + ...h_fixed_tier_price_for_not_logged_user.php | 40 +++ ...ier_price_for_not_logged_user_rollback.php | 8 + ..._simple_with_fixed_tier_price_rollback.php | 8 + ...product_simple_with_percent_tier_price.php | 40 +++ ...imple_with_percent_tier_price_rollback.php | 8 + ...rice_to_discount_value_not_logged_user.php | 43 +++ ...iscount_value_not_logged_user_rollback.php | 29 ++ ...ice_to_this_percentage_not_logged_user.php | 43 +++ ...is_percentage_not_logged_user_rollback.php | 29 ++ ..._apply_as_fixed_amount_not_logged_user.php | 43 +++ ..._fixed_amount_not_logged_user_rollback.php | 29 ++ ...percentage_of_original_not_logged_user.php | 43 +++ ...e_of_original_not_logged_user_rollback.php | 29 ++ 18 files changed, 793 insertions(+), 7 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ListProduct/CheckProductPriceTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_fixed_tier_price.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_fixed_tier_price_for_logged_user.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_fixed_tier_price_for_logged_user_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_fixed_tier_price_for_not_logged_user.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_fixed_tier_price_for_not_logged_user_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_fixed_tier_price_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_percent_tier_price.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_percent_tier_price_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_adjust_final_price_to_discount_value_not_logged_user.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_adjust_final_price_to_discount_value_not_logged_user_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_adjust_final_price_to_this_percentage_not_logged_user.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_adjust_final_price_to_this_percentage_not_logged_user_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_apply_as_fixed_amount_not_logged_user.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_apply_as_fixed_amount_not_logged_user_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_apply_as_percentage_of_original_not_logged_user.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_apply_as_percentage_of_original_not_logged_user_rollback.php diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ListProduct/CheckProductPriceTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ListProduct/CheckProductPriceTest.php new file mode 100644 index 0000000000000..511b2afe2e0f4 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ListProduct/CheckProductPriceTest.php @@ -0,0 +1,310 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Block\Product\ListProduct; + +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Block\Product\ListProduct; +use Magento\Customer\Model\Session; +use Magento\Framework\View\Element\Template; +use Magento\Framework\View\Result\PageFactory; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\ObjectManager; +use PHPUnit\Framework\TestCase; + +/** + * Check that product price render correctly on category page. + * + * @magentoDbIsolation enabled + * @magentoAppArea frontend + */ +class CheckProductPriceTest extends TestCase +{ + /** + * @var ObjectManager + */ + private $objectManager; + + /** + * @var PageFactory + */ + private $pageFactory; + + /** + * @var ProductRepositoryInterface + */ + private $productRepository; + + /** + * @var Session + */ + private $customerSession; + + /** + * @inheritdoc + */ + protected function setUp() + { + $this->objectManager = Bootstrap::getObjectManager(); + $this->pageFactory = $this->objectManager->get(PageFactory::class); + $this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class); + $this->customerSession = $this->objectManager->create(Session::class); + parent::setUp(); + } + + /** + * Assert that product price without additional price configurations will render as expected. + * + * @magentoDataFixture Magento/Catalog/_files/product_simple_tax_none.php + * + * @return void + */ + public function testCheckProductPriceWithoutAdditionalPriceConfigurations(): void + { + $priceHtml = $this->getProductPriceHtml('simple-product-tax-none'); + $this->assertFinalPrice($priceHtml, 205.00); + } + + /** + * Assert that product special price rendered correctly. + * + * @magentoDataFixture Magento/Catalog/_files/product_special_price.php + * + * @return void + */ + public function testCheckSpecialPrice(): void + { + $priceHtml = $this->getProductPriceHtml('simple'); + $this->assertFinalPrice($priceHtml, 5.99); + $this->assertRegularPrice($priceHtml, 10.00); + } + + /** + * Assert that product with fixed tier price is renders correctly. + * + * @magentoDataFixture Magento/Catalog/_files/product_simple_with_fixed_tier_price.php + * + * @return void + */ + public function testCheckFixedTierPrice(): void + { + $priceHtml = $this->getProductPriceHtml('simple-product-tax-none'); + $this->assertFinalPrice($priceHtml, 205.00); + $this->assertAsLowAsPrice($priceHtml, 40.00); + } + + /** + * Assert that price of product with percent tier price rendered correctly. + * + * @magentoDataFixture Magento/Catalog/_files/product_simple_with_percent_tier_price.php + * + * @return void + */ + public function testCheckPercentTierPrice(): void + { + $priceHtml = $this->getProductPriceHtml('simple-product-tax-none'); + $this->assertFinalPrice($priceHtml, 205.00); + $this->assertAsLowAsPrice($priceHtml, 102.50); + } + + /** + * Assert that price of product with fixed tier price for not logged user is renders correctly. + * + * @magentoDataFixture Magento/Catalog/_files/product_simple_with_fixed_tier_price_for_not_logged_user.php + * + * @return void + */ + public function testCheckFixedTierPriceForNotLoggedUser(): void + { + $priceHtml = $this->getProductPriceHtml('simple-product-tax-none'); + $this->assertFinalPrice($priceHtml, 30.00); + $this->assertRegularPrice($priceHtml, 205.00); + } + + /** + * Assert that price of product with fixed tier price for logged user is renders correctly. + * + * @magentoDataFixture Magento/Catalog/_files/product_simple_with_fixed_tier_price_for_logged_user.php + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoDbIsolation disabled + * @magentoAppArea frontend + * @magentoAppIsolation enabled + * + * @return void + */ + public function testCheckFixedTierPriceForLoggedUser(): void + { + $priceHtml = $this->getProductPriceHtml('simple-product-tax-none'); + $this->assertFinalPrice($priceHtml, 205.00); + $this->assertNotRegExp('/\$10/', $priceHtml); + $this->customerSession->setCustomerId(1); + try { + $priceHtml = $this->getProductPriceHtml('simple-product-tax-none'); + $this->assertFinalPrice($priceHtml, 10.00); + $this->assertRegularPrice($priceHtml, 205.00); + } finally { + $this->customerSession->setCustomerId(null); + } + } + + /** + * Assert that price of product with catalog rule with action equal to "Apply as percentage of original" + * is renders correctly. + * + * @magentoDataFixture Magento/Catalog/_files/product_simple_tax_none.php + * @magentoDataFixture Magento/CatalogRule/_files/rule_apply_as_percentage_of_original_not_logged_user.php + * @magentoDbIsolation disabled + * @magentoAppArea frontend + * + * @return void + */ + public function testCheckPriceRendersCorrectlyWithApplyAsPercentageOfOriginalRule(): void + { + $priceHtml = $this->getProductPriceHtml('simple-product-tax-none'); + $this->assertFinalPrice($priceHtml, 184.50); + $this->assertRegularPrice($priceHtml, 205.00); + } + + /** + * Assert that price of product with catalog rule with action equal to "Apply as fixed amount" + * is renders correctly. + * + * @magentoDataFixture Magento/Catalog/_files/product_simple_tax_none.php + * @magentoDataFixture Magento/CatalogRule/_files/rule_apply_as_fixed_amount_not_logged_user.php + * @magentoDbIsolation disabled + * @magentoAppArea frontend + * + * @return void + */ + public function testCheckPriceRendersCorrectlyWithApplyAsFixedAmountRule(): void + { + $priceHtml = $this->getProductPriceHtml('simple-product-tax-none'); + $this->assertFinalPrice($priceHtml, 195.00); + $this->assertRegularPrice($priceHtml, 205.00); + } + + /** + * Assert that price of product with catalog rule with action equal to "Adjust final price to this percentage" + * is renders correctly. + * + * @magentoDataFixture Magento/Catalog/_files/product_simple_tax_none.php + * @magentoDataFixture Magento/CatalogRule/_files/rule_adjust_final_price_to_this_percentage_not_logged_user.php + * @magentoDbIsolation disabled + * @magentoAppArea frontend + * + * @return void + */ + public function testCheckPriceRendersCorrectlyWithAdjustFinalPriceToThisPercentageRule(): void + { + $priceHtml = $this->getProductPriceHtml('simple-product-tax-none'); + $this->assertFinalPrice($priceHtml, 20.50); + $this->assertRegularPrice($priceHtml, 205.00); + } + + /** + * Assert that price of product with catalog rule with action equal to "Adjust final price to discount value" + * is renders correctly. + * + * @magentoDataFixture Magento/Catalog/_files/product_simple_tax_none.php + * @magentoDataFixture Magento/CatalogRule/_files/rule_adjust_final_price_to_discount_value_not_logged_user.php + * @magentoDbIsolation disabled + * @magentoAppArea frontend + * + * @return void + */ + public function testCheckPriceRendersCorrectlyWithAdjustFinalPriceToDiscountValueRule(): void + { + $priceHtml = $this->getProductPriceHtml('simple-product-tax-none'); + $this->assertFinalPrice($priceHtml, 10.00); + $this->assertRegularPrice($priceHtml, 205.00); + } + + /** + * Assert that price html contain "As low as" label and expected price amount. + * + * @param string $priceHtml + * @param float $expectedPrice + * @return void + */ + private function assertAsLowAsPrice(string $priceHtml, float $expectedPrice): void + { + $this->assertRegExp( + sprintf( + '/<span class="price-label">As low as<\/span> {1,}<span.*data-price-amount="%s".*>\$%01.2f<\/span>/', + round($expectedPrice, 2), + $expectedPrice + ), + $priceHtml + ); + } + + /** + * Assert that price html contain expected final price amount. + * + * @param string $priceHtml + * @param float $expectedPrice + * @return void + */ + private function assertFinalPrice(string $priceHtml, float $expectedPrice): void + { + $this->assertRegExp( + sprintf( + '/data-price-type="finalPrice".*<span class="price">\$%01.2f<\/span><\/span>/', + $expectedPrice + ), + $priceHtml + ); + } + + /** + * Assert that price html contain "Regular price" label and expected price amount. + * + * @param string $priceHtml + * @param float $expectedPrice + * @return void + */ + private function assertRegularPrice(string $priceHtml, float $expectedPrice): void + { + $regex = '<span class="price-label">Regular Price<\/span> {1,}<span.*data-price-amount="%s".*>\$%01.2f<\/span>'; + $this->assertRegExp( + sprintf("/{$regex}/", round($expectedPrice, 2), $expectedPrice), + $priceHtml + ); + } + + /** + * Return html of product price without new line characters. + * + * @param string $sku + * @return string + */ + private function getProductPriceHtml(string $sku): string + { + $product = $this->productRepository->get($sku, false, null, true); + + return preg_replace('/[\n\r]/', '', $this->getListProductBlock()->getProductPrice($product)); + } + + /** + * Get list product block from layout. + * + * @return ListProduct + */ + private function getListProductBlock(): ListProduct + { + $page = $this->pageFactory->create(); + $page->addHandle([ + 'default', + 'catalog_category_view', + ]); + $page->getLayout()->generateXml(); + /** @var Template $categoryProductsBlock */ + $categoryProductsBlock = $page->getLayout()->getBlock('category.products'); + + return $categoryProductsBlock->getChildBlock('product_list'); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_tax_none_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_tax_none_rollback.php index ceffb1c87d970..79245d255a7e6 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_tax_none_rollback.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_tax_none_rollback.php @@ -5,9 +5,9 @@ */ declare(strict_types=1); -use Magento\Catalog\Api\Data\ProductInterface; use Magento\Catalog\Api\ProductRepositoryInterface; use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Registry; use Magento\TestFramework\Helper\Bootstrap; use Magento\TestFramework\ObjectManager; @@ -15,19 +15,16 @@ $objectManager = Bootstrap::getObjectManager(); /** @var ProductRepositoryInterface $productRepository */ $productRepository = $objectManager->get(ProductRepositoryInterface::class); -/** @var \Magento\Framework\Registry $registry */ -$registry =$objectManager->get(\Magento\Framework\Registry::class); - +/** @var Registry $registry */ +$registry = $objectManager->get(Registry::class); $registry->unregister('isSecureArea'); $registry->register('isSecureArea', true); - try { - /** @var ProductInterface $product */ $product = $productRepository->get('simple-product-tax-none', false, null, true); $productRepository->delete($product); } catch (NoSuchEntityException $e) { // isolation on } - +$productRepository->cleanCache(); $registry->unregister('isSecureArea'); $registry->register('isSecureArea', false); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_fixed_tier_price.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_fixed_tier_price.php new file mode 100644 index 0000000000000..31576f2baf55b --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_fixed_tier_price.php @@ -0,0 +1,40 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\Data\ProductTierPriceExtensionFactory; +use Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory; +use Magento\Customer\Model\Group; +use Magento\Store\Api\WebsiteRepositoryInterface; + +require __DIR__ . '/product_simple_tax_none.php'; + +$product = $productRepository->get('simple-product-tax-none'); +/** @var WebsiteRepositoryInterface $websiteRepository */ +$websiteRepository = $objectManager->get(WebsiteRepositoryInterface::class); +/** @var ProductTierPriceInterfaceFactory $tierPriceFactory */ +$tierPriceFactory = $objectManager->get(ProductTierPriceInterfaceFactory::class); +/** @var ProductTierPriceExtensionFactory $tpExtensionAttributeFactory */ +$tpExtensionAttributeFactory = $objectManager->get(ProductTierPriceExtensionFactory::class); +$adminWebsite = $websiteRepository->get('admin'); +$tierPriceExtensionAttribute = $tpExtensionAttributeFactory->create( + [ + 'data' => [ + 'website_id' => $adminWebsite->getId(), + ] + ] +); +$tierPrices[] = $tierPriceFactory->create( + [ + 'data' => [ + 'customer_group_id' => Group::CUST_GROUP_ALL, + 'qty' => 2, + 'value' => 40 + ] + ] +)->setExtensionAttributes($tierPriceExtensionAttribute); +$product->setTierPrices($tierPrices); +$productRepository->save($product); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_fixed_tier_price_for_logged_user.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_fixed_tier_price_for_logged_user.php new file mode 100644 index 0000000000000..44a4c82c277d4 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_fixed_tier_price_for_logged_user.php @@ -0,0 +1,39 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\Data\ProductTierPriceExtensionFactory; +use Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory; +use Magento\Store\Api\WebsiteRepositoryInterface; + +require __DIR__ . '/product_simple_tax_none.php'; + +$product = $productRepository->get('simple-product-tax-none'); +/** @var WebsiteRepositoryInterface $websiteRepository */ +$websiteRepository = $objectManager->get(WebsiteRepositoryInterface::class); +/** @var ProductTierPriceInterfaceFactory $tierPriceFactory */ +$tierPriceFactory = $objectManager->get(ProductTierPriceInterfaceFactory::class); +/** @var ProductTierPriceExtensionFactory $tpExtensionAttributeFactory */ +$tpExtensionAttributeFactory = $objectManager->get(ProductTierPriceExtensionFactory::class); +$adminWebsite = $websiteRepository->get('admin'); +$tierPriceExtensionAttribute = $tpExtensionAttributeFactory->create( + [ + 'data' => [ + 'website_id' => $adminWebsite->getId(), + ] + ] +); +$tierPrices[] = $tierPriceFactory->create( + [ + 'data' => [ + 'customer_group_id' => 1, + 'qty' => 1, + 'value' => 10 + ] + ] +)->setExtensionAttributes($tierPriceExtensionAttribute); +$product->setTierPrices($tierPrices); +$productRepository->save($product); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_fixed_tier_price_for_logged_user_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_fixed_tier_price_for_logged_user_rollback.php new file mode 100644 index 0000000000000..554f953580a5c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_fixed_tier_price_for_logged_user_rollback.php @@ -0,0 +1,8 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +require __DIR__ . '/product_simple_tax_none_rollback.php'; diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_fixed_tier_price_for_not_logged_user.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_fixed_tier_price_for_not_logged_user.php new file mode 100644 index 0000000000000..68afbe529808e --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_fixed_tier_price_for_not_logged_user.php @@ -0,0 +1,40 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\Data\ProductTierPriceExtensionFactory; +use Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory; +use Magento\Customer\Model\Group; +use Magento\Store\Api\WebsiteRepositoryInterface; + +require __DIR__ . '/product_simple_tax_none.php'; + +$product = $productRepository->get('simple-product-tax-none'); +/** @var WebsiteRepositoryInterface $websiteRepository */ +$websiteRepository = $objectManager->get(WebsiteRepositoryInterface::class); +/** @var ProductTierPriceInterfaceFactory $tierPriceFactory */ +$tierPriceFactory = $objectManager->get(ProductTierPriceInterfaceFactory::class); +/** @var ProductTierPriceExtensionFactory $tpExtensionAttributeFactory */ +$tpExtensionAttributeFactory = $objectManager->get(ProductTierPriceExtensionFactory::class); +$adminWebsite = $websiteRepository->get('admin'); +$tierPriceExtensionAttribute = $tpExtensionAttributeFactory->create( + [ + 'data' => [ + 'website_id' => $adminWebsite->getId(), + ] + ] +); +$tierPrices[] = $tierPriceFactory->create( + [ + 'data' => [ + 'customer_group_id' => Group::NOT_LOGGED_IN_ID, + 'qty' => 1, + 'value' => 30 + ] + ] +)->setExtensionAttributes($tierPriceExtensionAttribute); +$product->setTierPrices($tierPrices); +$productRepository->save($product); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_fixed_tier_price_for_not_logged_user_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_fixed_tier_price_for_not_logged_user_rollback.php new file mode 100644 index 0000000000000..554f953580a5c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_fixed_tier_price_for_not_logged_user_rollback.php @@ -0,0 +1,8 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +require __DIR__ . '/product_simple_tax_none_rollback.php'; diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_fixed_tier_price_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_fixed_tier_price_rollback.php new file mode 100644 index 0000000000000..554f953580a5c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_fixed_tier_price_rollback.php @@ -0,0 +1,8 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +require __DIR__ . '/product_simple_tax_none_rollback.php'; diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_percent_tier_price.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_percent_tier_price.php new file mode 100644 index 0000000000000..0bef251a254f3 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_percent_tier_price.php @@ -0,0 +1,40 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\Data\ProductTierPriceExtensionFactory; +use Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory; +use Magento\Customer\Model\Group; +use Magento\Store\Api\WebsiteRepositoryInterface; + +require __DIR__ . '/product_simple_tax_none.php'; + +$product = $productRepository->get('simple-product-tax-none'); +/** @var WebsiteRepositoryInterface $websiteRepository */ +$websiteRepository = $objectManager->get(WebsiteRepositoryInterface::class); +/** @var ProductTierPriceInterfaceFactory $tierPriceFactory */ +$tierPriceFactory = $objectManager->get(ProductTierPriceInterfaceFactory::class); +/** @var ProductTierPriceExtensionFactory $tpExtensionAttributeFactory */ +$tpExtensionAttributeFactory = $objectManager->get(ProductTierPriceExtensionFactory::class); +$adminWebsite = $websiteRepository->get('admin'); +$tierPriceExtensionAttribute = $tpExtensionAttributeFactory->create( + [ + 'data' => [ + 'website_id' => $adminWebsite->getId(), + 'percentage_value' => 50, + ] + ] +); +$tierPrices[] = $tierPriceFactory->create( + [ + 'data' => [ + 'customer_group_id' => Group::CUST_GROUP_ALL, + 'qty' => 2, + ] + ] +)->setExtensionAttributes($tierPriceExtensionAttribute); +$product->setTierPrices($tierPrices); +$productRepository->save($product); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_percent_tier_price_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_percent_tier_price_rollback.php new file mode 100644 index 0000000000000..554f953580a5c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_percent_tier_price_rollback.php @@ -0,0 +1,8 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +require __DIR__ . '/product_simple_tax_none_rollback.php'; diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_adjust_final_price_to_discount_value_not_logged_user.php b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_adjust_final_price_to_discount_value_not_logged_user.php new file mode 100644 index 0000000000000..55824abe28ee9 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_adjust_final_price_to_discount_value_not_logged_user.php @@ -0,0 +1,43 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\CatalogRule\Api\CatalogRuleRepositoryInterface; +use Magento\CatalogRule\Api\Data\RuleInterface; +use Magento\CatalogRule\Api\Data\RuleInterfaceFactory; +use Magento\CatalogRule\Model\Indexer\IndexBuilder; +use Magento\Customer\Model\Group; +use Magento\Store\Model\WebsiteRepository; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var WebsiteRepository $websiteRepository */ +$websiteRepository = $objectManager->get(WebsiteRepository::class); +$baseWebsite = $websiteRepository->get('base'); +/** @var IndexBuilder $indexBuilder */ +$indexBuilder = $objectManager->get(IndexBuilder::class); +/** @var CatalogRuleRepositoryInterface $catalogRuleRepository */ +$catalogRuleRepository = $objectManager->get(CatalogRuleRepositoryInterface::class); +/** @var RuleInterfaceFactory $catalogRuleFactory */ +$catalogRuleFactory = $objectManager->get(RuleInterfaceFactory::class); +$catalogRule = $catalogRuleFactory->create( + [ + 'data' => [ + RuleInterface::IS_ACTIVE => 1, + RuleInterface::NAME => 'Rule adjust final price to discount value. Not logged user.', + 'customer_group_ids' => Group::NOT_LOGGED_IN_ID, + RuleInterface::DISCOUNT_AMOUNT => 10, + 'website_ids' => [$baseWebsite->getId()], + RuleInterface::SIMPLE_ACTION => 'to_fixed', + RuleInterface::STOP_RULES_PROCESSING => false, + RuleInterface::SORT_ORDER => 0, + 'sub_is_enable' => 0, + 'sub_discount_amount' => 0, + ] + ] +); +$catalogRuleRepository->save($catalogRule); +$indexBuilder->reindexFull(); diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_adjust_final_price_to_discount_value_not_logged_user_rollback.php b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_adjust_final_price_to_discount_value_not_logged_user_rollback.php new file mode 100644 index 0000000000000..8b77787d40f14 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_adjust_final_price_to_discount_value_not_logged_user_rollback.php @@ -0,0 +1,29 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\CatalogRule\Api\CatalogRuleRepositoryInterface; +use Magento\CatalogRule\Model\Indexer\IndexBuilder; +use Magento\CatalogRule\Model\ResourceModel\Rule\CollectionFactory; +use Magento\CatalogRule\Model\Rule; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var IndexBuilder $indexBuilder */ +$indexBuilder = $objectManager->get(IndexBuilder::class); +/** @var CatalogRuleRepositoryInterface $ruleRepository */ +$ruleRepository = $objectManager->create(CatalogRuleRepositoryInterface::class); +/** @var CollectionFactory $ruleCollectionFactory */ +$ruleCollectionFactory = $objectManager->get(CollectionFactory::class); +$ruleCollection = $ruleCollectionFactory->create(); +$ruleCollection->addFieldToFilter('name', ['eq' => 'Rule adjust final price to discount value. Not logged user.']); +$ruleCollection->setPageSize(1); +/** @var Rule $rule */ +$rule = $ruleCollection->getFirstItem(); +if ($rule->getId()) { + $ruleRepository->delete($rule); +} +$indexBuilder->reindexFull(); diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_adjust_final_price_to_this_percentage_not_logged_user.php b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_adjust_final_price_to_this_percentage_not_logged_user.php new file mode 100644 index 0000000000000..233e231d7cac4 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_adjust_final_price_to_this_percentage_not_logged_user.php @@ -0,0 +1,43 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\CatalogRule\Api\CatalogRuleRepositoryInterface; +use Magento\CatalogRule\Api\Data\RuleInterface; +use Magento\CatalogRule\Api\Data\RuleInterfaceFactory; +use Magento\CatalogRule\Model\Indexer\IndexBuilder; +use Magento\Customer\Model\Group; +use Magento\Store\Model\WebsiteRepository; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var WebsiteRepository $websiteRepository */ +$websiteRepository = $objectManager->get(WebsiteRepository::class); +$baseWebsite = $websiteRepository->get('base'); +/** @var IndexBuilder $indexBuilder */ +$indexBuilder = $objectManager->get(IndexBuilder::class); +/** @var CatalogRuleRepositoryInterface $catalogRuleRepository */ +$catalogRuleRepository = $objectManager->get(CatalogRuleRepositoryInterface::class); +/** @var RuleInterfaceFactory $catalogRuleFactory */ +$catalogRuleFactory = $objectManager->get(RuleInterfaceFactory::class); +$catalogRule = $catalogRuleFactory->create( + [ + 'data' => [ + RuleInterface::IS_ACTIVE => 1, + RuleInterface::NAME => 'Rule adjust final price to this percentage. Not logged user.', + 'customer_group_ids' => Group::NOT_LOGGED_IN_ID, + RuleInterface::DISCOUNT_AMOUNT => 10, + 'website_ids' => [$baseWebsite->getId()], + RuleInterface::SIMPLE_ACTION => 'to_percent', + RuleInterface::STOP_RULES_PROCESSING => false, + RuleInterface::SORT_ORDER => 0, + 'sub_is_enable' => 0, + 'sub_discount_amount' => 0, + ] + ] +); +$catalogRuleRepository->save($catalogRule); +$indexBuilder->reindexFull(); diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_adjust_final_price_to_this_percentage_not_logged_user_rollback.php b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_adjust_final_price_to_this_percentage_not_logged_user_rollback.php new file mode 100644 index 0000000000000..5b1b6501019b8 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_adjust_final_price_to_this_percentage_not_logged_user_rollback.php @@ -0,0 +1,29 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\CatalogRule\Api\CatalogRuleRepositoryInterface; +use Magento\CatalogRule\Model\Indexer\IndexBuilder; +use Magento\CatalogRule\Model\ResourceModel\Rule\CollectionFactory; +use Magento\CatalogRule\Model\Rule; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var IndexBuilder $indexBuilder */ +$indexBuilder = $objectManager->get(IndexBuilder::class); +/** @var CatalogRuleRepositoryInterface $ruleRepository */ +$ruleRepository = $objectManager->create(CatalogRuleRepositoryInterface::class); +/** @var CollectionFactory $ruleCollectionFactory */ +$ruleCollectionFactory = $objectManager->get(CollectionFactory::class); +$ruleCollection = $ruleCollectionFactory->create(); +$ruleCollection->addFieldToFilter('name', ['eq' => 'Rule adjust final price to this percentage. Not logged user.']); +$ruleCollection->setPageSize(1); +/** @var Rule $rule */ +$rule = $ruleCollection->getFirstItem(); +if ($rule->getId()) { + $ruleRepository->delete($rule); +} +$indexBuilder->reindexFull(); diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_apply_as_fixed_amount_not_logged_user.php b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_apply_as_fixed_amount_not_logged_user.php new file mode 100644 index 0000000000000..c37e74de0054c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_apply_as_fixed_amount_not_logged_user.php @@ -0,0 +1,43 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\CatalogRule\Api\CatalogRuleRepositoryInterface; +use Magento\CatalogRule\Api\Data\RuleInterface; +use Magento\CatalogRule\Api\Data\RuleInterfaceFactory; +use Magento\CatalogRule\Model\Indexer\IndexBuilder; +use Magento\Customer\Model\Group; +use Magento\Store\Model\WebsiteRepository; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var WebsiteRepository $websiteRepository */ +$websiteRepository = $objectManager->get(WebsiteRepository::class); +$baseWebsite = $websiteRepository->get('base'); +/** @var IndexBuilder $indexBuilder */ +$indexBuilder = $objectManager->get(IndexBuilder::class); +/** @var CatalogRuleRepositoryInterface $catalogRuleRepository */ +$catalogRuleRepository = $objectManager->get(CatalogRuleRepositoryInterface::class); +/** @var RuleInterfaceFactory $catalogRuleFactory */ +$catalogRuleFactory = $objectManager->get(RuleInterfaceFactory::class); +$catalogRule = $catalogRuleFactory->create( + [ + 'data' => [ + RuleInterface::IS_ACTIVE => 1, + RuleInterface::NAME => 'Rule apply as fixed amount. Not logged user.', + 'customer_group_ids' => Group::NOT_LOGGED_IN_ID, + RuleInterface::DISCOUNT_AMOUNT => 10, + 'website_ids' => [$baseWebsite->getId()], + RuleInterface::SIMPLE_ACTION => 'by_fixed', + RuleInterface::STOP_RULES_PROCESSING => false, + RuleInterface::SORT_ORDER => 0, + 'sub_is_enable' => 0, + 'sub_discount_amount' => 0, + ] + ] +); +$catalogRuleRepository->save($catalogRule); +$indexBuilder->reindexFull(); diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_apply_as_fixed_amount_not_logged_user_rollback.php b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_apply_as_fixed_amount_not_logged_user_rollback.php new file mode 100644 index 0000000000000..33b72dac08924 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_apply_as_fixed_amount_not_logged_user_rollback.php @@ -0,0 +1,29 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\CatalogRule\Api\CatalogRuleRepositoryInterface; +use Magento\CatalogRule\Model\Indexer\IndexBuilder; +use Magento\CatalogRule\Model\ResourceModel\Rule\CollectionFactory; +use Magento\CatalogRule\Model\Rule; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var IndexBuilder $indexBuilder */ +$indexBuilder = $objectManager->get(IndexBuilder::class); +/** @var CatalogRuleRepositoryInterface $ruleRepository */ +$ruleRepository = $objectManager->create(CatalogRuleRepositoryInterface::class); +/** @var CollectionFactory $ruleCollectionFactory */ +$ruleCollectionFactory = $objectManager->get(CollectionFactory::class); +$ruleCollection = $ruleCollectionFactory->create(); +$ruleCollection->addFieldToFilter('name', ['eq' => 'Rule apply as fixed amount. Not logged user.']); +$ruleCollection->setPageSize(1); +/** @var Rule $rule */ +$rule = $ruleCollection->getFirstItem(); +if ($rule->getId()) { + $ruleRepository->delete($rule); +} +$indexBuilder->reindexFull(); diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_apply_as_percentage_of_original_not_logged_user.php b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_apply_as_percentage_of_original_not_logged_user.php new file mode 100644 index 0000000000000..633a265241e33 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_apply_as_percentage_of_original_not_logged_user.php @@ -0,0 +1,43 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\CatalogRule\Api\CatalogRuleRepositoryInterface; +use Magento\CatalogRule\Api\Data\RuleInterface; +use Magento\CatalogRule\Api\Data\RuleInterfaceFactory; +use Magento\CatalogRule\Model\Indexer\IndexBuilder; +use Magento\Customer\Model\Group; +use Magento\Store\Model\WebsiteRepository; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var WebsiteRepository $websiteRepository */ +$websiteRepository = $objectManager->get(WebsiteRepository::class); +$baseWebsite = $websiteRepository->get('base'); +/** @var IndexBuilder $indexBuilder */ +$indexBuilder = $objectManager->get(IndexBuilder::class); +/** @var CatalogRuleRepositoryInterface $catalogRuleRepository */ +$catalogRuleRepository = $objectManager->get(CatalogRuleRepositoryInterface::class); +/** @var RuleInterfaceFactory $catalogRuleFactory */ +$catalogRuleFactory = $objectManager->get(RuleInterfaceFactory::class); +$catalogRule = $catalogRuleFactory->create( + [ + 'data' => [ + RuleInterface::IS_ACTIVE => 1, + RuleInterface::NAME => 'Rule apply as percentage of original. Not logged user.', + 'customer_group_ids' => Group::NOT_LOGGED_IN_ID, + RuleInterface::DISCOUNT_AMOUNT => 10, + 'website_ids' => [$baseWebsite->getId()], + RuleInterface::SIMPLE_ACTION => 'by_percent', + RuleInterface::STOP_RULES_PROCESSING => false, + RuleInterface::SORT_ORDER => 0, + 'sub_is_enable' => 0, + 'sub_discount_amount' => 0, + ] + ] +); +$catalogRuleRepository->save($catalogRule); +$indexBuilder->reindexFull(); diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_apply_as_percentage_of_original_not_logged_user_rollback.php b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_apply_as_percentage_of_original_not_logged_user_rollback.php new file mode 100644 index 0000000000000..d9a1e61b7022e --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_apply_as_percentage_of_original_not_logged_user_rollback.php @@ -0,0 +1,29 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\CatalogRule\Api\CatalogRuleRepositoryInterface; +use Magento\CatalogRule\Model\Indexer\IndexBuilder; +use Magento\CatalogRule\Model\ResourceModel\Rule\CollectionFactory; +use Magento\CatalogRule\Model\Rule; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var IndexBuilder $indexBuilder */ +$indexBuilder = $objectManager->get(IndexBuilder::class); +/** @var CatalogRuleRepositoryInterface $ruleRepository */ +$ruleRepository = $objectManager->create(CatalogRuleRepositoryInterface::class); +/** @var CollectionFactory $ruleCollectionFactory */ +$ruleCollectionFactory = $objectManager->get(CollectionFactory::class); +$ruleCollection = $ruleCollectionFactory->create(); +$ruleCollection->addFieldToFilter('name', ['eq' => 'Rule apply as percentage of original. Not logged user.']); +$ruleCollection->setPageSize(1); +/** @var Rule $rule */ +$rule = $ruleCollection->getFirstItem(); +if ($rule->getId()) { + $ruleRepository->delete($rule); +} +$indexBuilder->reindexFull(); From 984d6b95f2444e3821070d745bf34cd7577e2f1b Mon Sep 17 00:00:00 2001 From: Manuel Canepa <manuelcanepa@gmail.com> Date: Fri, 10 Jan 2020 11:02:54 -0300 Subject: [PATCH 0775/1143] Class import Vars name --- .../Model/XmlCatalog/Format/VsCodeTest.php | 208 +++++++++++------- 1 file changed, 132 insertions(+), 76 deletions(-) diff --git a/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/VsCodeTest.php b/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/VsCodeTest.php index f03de7ca7cf30..64b9f367e5198 100644 --- a/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/VsCodeTest.php +++ b/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/VsCodeTest.php @@ -8,72 +8,87 @@ use Magento\Framework\Filesystem\Directory\ReadFactory; use Magento\Framework\Filesystem\Directory\ReadInterface; use Magento\Framework\Filesystem\DriverPool; +use Magento\Framework\Filesystem\File\Read; +use Magento\Framework\Filesystem\File\Write; use Magento\Framework\Filesystem\File\WriteFactory; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; -class VsCodeTest extends \PHPUnit\Framework\TestCase +class VsCodeTest extends TestCase { /** - * @var Magento\Developer\Model\XmlCatalog\Format\VsCode + * @var VsCode */ - protected $vscodeFormat; + private $vscodeFormat; /** - * @var Magento\Framework\Filesystem\Directory\ReadFactory + * @var MockObject|ReadFactory */ - protected $readFactory; + private $readFactoryMock; /** - * @var Magento\Framework\Filesystem\File\WriteFactory + * @var MockObject|WriteFactory */ - protected $fileWriteFactory; + private $fileWriteFactoryMock; /** - * @var Magento\Framework\DomDocument\DomDocumentFactory + * @var DomDocumentFactory */ - protected $domFactory; + private $domFactory; - protected $dictionary = [ - 'urn:magento:framework:Acl/etc/acl.xsd' => 'vendor/magento/framework/Acl/etc/acl.xsd', - 'urn:magento:module:Magento_Store:etc/config.xsd' => 'vendor/magento/module-store/etc/config.xsd', - 'urn:magento:module:Magento_Cron:etc/crontab.xsd' => 'vendor/magento/module-cron/etc/crontab.xsd', - 'urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd' => 'vendor/magento/framework/Setup/Declaration/Schema/etc/schema.xsd', - ]; + /** + * @var ObjectManager + */ + private $objectManagerHelper; public function setUp() { + $this->objectManagerHelper = new ObjectManager($this); - $currentDirRead = $this->createMock(ReadInterface::class); - $currentDirRead->expects($this->any()) + $currentDirReadMock = $this->createMock(ReadInterface::class); + $currentDirReadMock->expects($this->any()) ->method('getRelativePath') ->willReturnCallback(function ($xsdPath) { return $xsdPath; }); - $this->readFactory = $this->createMock(ReadFactory::class); - $this->readFactory->expects($this->once()) + $this->readFactoryMock = $this->createMock(ReadFactory::class); + $this->readFactoryMock->expects($this->once()) ->method('create') ->withAnyParameters() - ->willReturn($currentDirRead); - - $this->fileWriteFactory = $this->createMock(WriteFactory::class); - $this->domFactory = new DomDocumentFactory(); - - $this->vscodeFormat = new VsCode( - $this->readFactory, - $this->fileWriteFactory, - $this->domFactory + ->willReturn($currentDirReadMock); + + $this->fileWriteFactoryMock = $this->createMock(WriteFactory::class); + $this->domFactory = $this->objectManagerHelper->getObject(DomDocumentFactory::class); + + $vscodeFormatArgs = $this->objectManagerHelper->getConstructArguments( + VsCode::class, + [ + 'readFactory' => $this->readFactoryMock, + 'fileWriteFactory' => $this->fileWriteFactoryMock, + 'domDocumentFactory' => $this->domFactory, + ] ); + + $this->vscodeFormat = $this->objectManagerHelper->getObject(VsCode::class, $vscodeFormatArgs); } - public function testGenerateNewValidCatalog() + /** + * Test generation of new valid catalog + * + * @param string $content + * @param array $dictionary + * @dataProvider dictionaryDataProvider + * @return void + */ + public function testGenerateNewValidCatalog($content, $dictionary) { $configFile = 'test'; - $fixtureXmlFile = __DIR__ . '/_files/valid_catalog.xml'; - $content = file_get_contents($fixtureXmlFile); $message = __("The \"%1.xml\" file doesn't exist.", $configFile); - $this->fileWriteFactory->expects($this->at(0)) + $this->fileWriteFactoryMock->expects($this->at(0)) ->method('create') ->with( $configFile, @@ -82,136 +97,177 @@ public function testGenerateNewValidCatalog() ) ->willThrowException(new FileSystemException($message)); - $file = $this->createMock(\Magento\Framework\Filesystem\File\Write::class); - $file->expects($this->once()) + $fileMock = $this->createMock(Write::class); + $fileMock->expects($this->once()) ->method('write') ->with($content); - $this->fileWriteFactory->expects($this->at(1)) + $this->fileWriteFactoryMock->expects($this->at(1)) ->method('create') ->with( $configFile, DriverPool::FILE, VsCode::FILE_MODE_WRITE ) - ->willReturn($file); + ->willReturn($fileMock); - $this->vscodeFormat->generateCatalog($this->dictionary, $configFile); + $this->vscodeFormat->generateCatalog($dictionary, $configFile); } - public function testGenerateExistingValidCatalog() + /** + * Test modify existing valid catalog + * + * @param string $content + * @param array $dictionary + * @dataProvider dictionaryDataProvider + * @return void + */ + public function testGenerateExistingValidCatalog($content, $dictionary) { $configFile = 'test'; - $fixtureXmlFile = __DIR__ . '/_files/valid_catalog.xml'; - $content = file_get_contents($fixtureXmlFile); - $file = $this->createMock(\Magento\Framework\Filesystem\File\Read::class); - $file->expects($this->once()) + $fileMock = $this->createMock(Read::class); + $fileMock->expects($this->once()) ->method('readAll') ->withAnyParameters() ->willReturn($content); - $this->fileWriteFactory->expects($this->at(0)) + $this->fileWriteFactoryMock->expects($this->at(0)) ->method('create') ->with( $configFile, DriverPool::FILE, VsCode::FILE_MODE_READ ) - ->willReturn($file); + ->willReturn($fileMock); - $file = $this->createMock(\Magento\Framework\Filesystem\File\Write::class); - $file->expects($this->once()) + $fileMock = $this->createMock(Write::class); + $fileMock->expects($this->once()) ->method('write') ->with($content); - $this->fileWriteFactory->expects($this->at(1)) + $this->fileWriteFactoryMock->expects($this->at(1)) ->method('create') ->with( $configFile, DriverPool::FILE, VsCode::FILE_MODE_WRITE ) - ->willReturn($file); + ->willReturn($fileMock); - $this->vscodeFormat->generateCatalog($this->dictionary, $configFile); + $this->vscodeFormat->generateCatalog($dictionary, $configFile); } - public function testGenerateExistingEmptyValidCatalog() + /** + * Test modify existing empty catalog + * + * @param string $content + * @param array $dictionary + * @dataProvider dictionaryDataProvider + * @return void + */ + public function testGenerateExistingEmptyValidCatalog($content, $dictionary) { $configFile = 'test'; - $fixtureXmlFile = __DIR__ . '/_files/valid_catalog.xml'; - $content = file_get_contents($fixtureXmlFile); - $file = $this->createMock(\Magento\Framework\Filesystem\File\Read::class); - $file->expects($this->once()) + $fileMock = $this->createMock(Read::class); + $fileMock->expects($this->once()) ->method('readAll') ->withAnyParameters() ->willReturn(''); - $this->fileWriteFactory->expects($this->at(0)) + $this->fileWriteFactoryMock->expects($this->at(0)) ->method('create') ->with( $configFile, DriverPool::FILE, VsCode::FILE_MODE_READ ) - ->willReturn($file); + ->willReturn($fileMock); - $file = $this->createMock(\Magento\Framework\Filesystem\File\Write::class); - $file->expects($this->once()) + $fileMock = $this->createMock(Write::class); + $fileMock->expects($this->once()) ->method('write') ->with($content); - $this->fileWriteFactory->expects($this->at(1)) + $this->fileWriteFactoryMock->expects($this->at(1)) ->method('create') ->with( $configFile, DriverPool::FILE, VsCode::FILE_MODE_WRITE ) - ->willReturn($file); + ->willReturn($fileMock); - $this->vscodeFormat->generateCatalog($this->dictionary, $configFile); + $this->vscodeFormat->generateCatalog($dictionary, $configFile); } - public function testGenerateExistingInvalidValidCatalog() + /** + * Test modify existing invalid catalog + * + * @param string $content + * @param array $dictionary + * @dataProvider dictionaryDataProvider + * @return void + */ + public function testGenerateExistingInvalidValidCatalog($content, $dictionary, $invalidContent) { $configFile = 'test'; - $invalidXmlFile = __DIR__ . '/_files/invalid_catalog.xml'; - $invalidContent = file_get_contents($invalidXmlFile); - $validXmlFile = __DIR__ . '/_files/valid_catalog.xml'; - $validContent = file_get_contents($validXmlFile); - $file = $this->createMock(\Magento\Framework\Filesystem\File\Read::class); - $file->expects($this->once()) + $fileMock = $this->createMock(Read::class); + $fileMock->expects($this->once()) ->method('readAll') ->withAnyParameters() ->willReturn($invalidContent); - $this->fileWriteFactory->expects($this->at(0)) + $this->fileWriteFactoryMock->expects($this->at(0)) ->method('create') ->with( $configFile, DriverPool::FILE, VsCode::FILE_MODE_READ ) - ->willReturn($file); + ->willReturn($fileMock); - $file = $this->createMock(\Magento\Framework\Filesystem\File\Write::class); - $file->expects($this->once()) + $fileMock = $this->createMock(Write::class); + $fileMock->expects($this->once()) ->method('write') - ->with($validContent); + ->with($content); - $this->fileWriteFactory->expects($this->at(1)) + $this->fileWriteFactoryMock->expects($this->at(1)) ->method('create') ->with( $configFile, DriverPool::FILE, VsCode::FILE_MODE_WRITE ) - ->willReturn($file); + ->willReturn($fileMock); + + $this->vscodeFormat->generateCatalog($dictionary, $configFile); + } + + /** + * Data provider for test + * + * @return array + */ + public function dictionaryDataProvider() + { + $fixtureXmlFile = __DIR__ . '/_files/valid_catalog.xml'; + $content = file_get_contents($fixtureXmlFile); + $invalidXmlFile = __DIR__ . '/_files/invalid_catalog.xml'; + $invalidContent = file_get_contents($invalidXmlFile); - $this->vscodeFormat->generateCatalog($this->dictionary, $configFile); + return [ + [ + $content, + ['urn:magento:framework:Acl/etc/acl.xsd' => 'vendor/magento/framework/Acl/etc/acl.xsd', + 'urn:magento:module:Magento_Store:etc/config.xsd' => 'vendor/magento/module-store/etc/config.xsd', + 'urn:magento:module:Magento_Cron:etc/crontab.xsd' => 'vendor/magento/module-cron/etc/crontab.xsd', + 'urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd' => 'vendor/magento/framework/Setup/Declaration/Schema/etc/schema.xsd'], + $invalidContent, + ], + ]; } + } From 8bace19e2a2513ae4c2eefc0a48e05e11ad628d0 Mon Sep 17 00:00:00 2001 From: "ivan.pletnyov" <ivan.pletnyov@transoftgroup.com> Date: Fri, 10 Jan 2020 16:23:10 +0200 Subject: [PATCH 0776/1143] MC-30331: Storefront: Visible/Not-Visible child products of configurable product on storefront --- .../Model/Layer/QuickSearchByQuery.php | 51 ++++ .../Search/AttributeSearchWeightTest.php | 69 +---- .../Type/RenderConfigurableOptionsTest.php | 145 ++++++++++ .../Model/FindByUrlRewriteTest.php | 267 ++++++++++++++++++ .../Model/QuickSearchTest.php | 170 +++++++++++ ...urable_product_with_two_child_products.php | 93 ++++++ ...oduct_with_two_child_products_rollback.php | 29 ++ .../Model/QuickSearchTest.php | 69 +++++ 8 files changed, 831 insertions(+), 62 deletions(-) create mode 100644 dev/tests/integration/framework/Magento/TestFramework/Catalog/Model/Layer/QuickSearchByQuery.php create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/RenderConfigurableOptionsTest.php create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/FindByUrlRewriteTest.php create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/QuickSearchTest.php create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_two_child_products.php create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_two_child_products_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/Elasticsearch6/ConfigurableProduct/Model/QuickSearchTest.php diff --git a/dev/tests/integration/framework/Magento/TestFramework/Catalog/Model/Layer/QuickSearchByQuery.php b/dev/tests/integration/framework/Magento/TestFramework/Catalog/Model/Layer/QuickSearchByQuery.php new file mode 100644 index 0000000000000..506aba9f6bd84 --- /dev/null +++ b/dev/tests/integration/framework/Magento/TestFramework/Catalog/Model/Layer/QuickSearchByQuery.php @@ -0,0 +1,51 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\TestFramework\Catalog\Model\Layer; + +use Magento\Catalog\Model\Layer\SearchFactory; +use Magento\Catalog\Model\ResourceModel\Product\Collection; + +/** + * Quick search products by query. + */ +class QuickSearchByQuery +{ + /** + * @var SearchFactory + */ + private $searchFactory; + + /** + * @param SearchFactory $searchFactory + */ + public function __construct( + SearchFactory $searchFactory + ) { + $this->searchFactory = $searchFactory; + } + + /** + * Flush search instances cache and find products by search query. + * + * @param string $query + * @param string $sortedField + * @param string $sortOrder + * @return Collection + */ + public function execute( + string $query, + string $sortedField = 'relevance', + string $sortOrder = 'desc' + ): Collection { + $productCollection = $this->searchFactory->create()->getProductCollection(); + $productCollection->addSearchFilter($query); + $productCollection->setOrder($sortedField, $sortOrder); + + return $productCollection; + } +} diff --git a/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Search/AttributeSearchWeightTest.php b/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Search/AttributeSearchWeightTest.php index 4ca8e0b0726d4..bfde20950d105 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Search/AttributeSearchWeightTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Search/AttributeSearchWeightTest.php @@ -3,18 +3,12 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - declare(strict_types=1); namespace Magento\CatalogSearch\Model\Search; use Magento\Catalog\Api\ProductAttributeRepositoryInterface; -use Magento\Catalog\Model\Layer\Search as CatalogLayerSearch; -use Magento\Catalog\Model\Product; -use Magento\CatalogSearch\Model\ResourceModel\Fulltext\CollectionFactory; -use Magento\Framework\Search\Request\Builder; -use Magento\Framework\Search\Request\Config as RequestConfig; -use Magento\Search\Model\Search; +use Magento\TestFramework\Catalog\Model\Layer\QuickSearchByQuery; use Magento\TestFramework\Helper\Bootstrap; use Magento\TestFramework\ObjectManager; use PHPUnit\Framework\TestCase; @@ -42,9 +36,9 @@ class AttributeSearchWeightTest extends TestCase private $collectedAttributesWeight = []; /** - * @var CatalogLayerSearch + * @var QuickSearchByQuery */ - private $catalogLayerSearch; + private $quickSearchByQuery; /** * @inheritdoc @@ -53,7 +47,7 @@ protected function setUp() { $this->objectManager = Bootstrap::getObjectManager(); $this->productAttributeRepository = $this->objectManager->get(ProductAttributeRepositoryInterface::class); - $this->catalogLayerSearch = $this->objectManager->get(CatalogLayerSearch::class); + $this->quickSearchByQuery = $this->objectManager->get(QuickSearchByQuery::class); $this->collectCurrentProductAttributesWeights(); } @@ -85,9 +79,7 @@ public function testAttributeSearchWeight( array $expectedProductNames ): void { $this->updateAttributesWeight($attributeWeights); - $this->removeInstancesCache(); - $products = $this->findProducts($searchQuery); - $actualProductNames = $this->collectProductsName($products); + $actualProductNames = $this->quickSearchByQuery->execute($searchQuery)->getColumnValues('name'); $this->assertEquals($expectedProductNames, $actualProductNames, 'Products order is not as expected.'); } @@ -164,58 +156,11 @@ protected function updateAttributesWeight(array $attributeWeights): void { foreach ($attributeWeights as $attributeCode => $weight) { $attribute = $this->productAttributeRepository->get($attributeCode); - - if ($attribute) { - $attribute->setSearchWeight($weight); - $this->productAttributeRepository->save($attribute); - } + $attribute->setSearchWeight($weight); + $this->productAttributeRepository->save($attribute); } } - /** - * Get all names from founded products. - * - * @param Product[] $products - * @return array - */ - protected function collectProductsName(array $products): array - { - $result = []; - foreach ($products as $product) { - $result[] = $product->getName(); - } - - return $result; - } - - /** - * Reindex catalogsearch fulltext index. - * - * @return void - */ - protected function removeInstancesCache(): void - { - $this->objectManager->removeSharedInstance(RequestConfig::class); - $this->objectManager->removeSharedInstance(Builder::class); - $this->objectManager->removeSharedInstance(Search::class); - $this->objectManager->removeSharedInstance(CatalogLayerSearch::class); - } - - /** - * Find products by search query. - * - * @param string $query - * @return Product[] - */ - protected function findProducts(string $query): array - { - $testProductCollection = $this->catalogLayerSearch->getProductCollection(); - $testProductCollection->addSearchFilter($query); - $testProductCollection->setOrder('relevance', 'desc'); - - return $testProductCollection->getItems(); - } - /** * Collect weight of attributes which use in test. * diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/RenderConfigurableOptionsTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/RenderConfigurableOptionsTest.php new file mode 100644 index 0000000000000..6a8dea32be620 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/RenderConfigurableOptionsTest.php @@ -0,0 +1,145 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\ConfigurableProduct\Block\Product\View\Type; + +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Block\Product\View; +use Magento\Catalog\Model\Product\Visibility; +use Magento\ConfigurableProduct\Helper\Data; +use Magento\ConfigurableProduct\Model\ConfigurableAttributeData; +use Magento\Framework\Registry; +use Magento\Framework\Serialize\Serializer\Json; +use Magento\Framework\View\Result\Page; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\ObjectManager; +use PHPUnit\Framework\TestCase; + +/** + * Test cases related to render configurable options. + * + * @magentoAppArea frontend + * @magentoDbIsolation enabled + */ +class RenderConfigurableOptionsTest extends TestCase +{ + /** + * @var ObjectManager + */ + private $objectManager; + + /** + * @var Data + */ + private $configurableHelper; + + /** + * @var ProductRepositoryInterface + */ + private $productRepository; + + /** + * @var ConfigurableAttributeData + */ + private $configurableAttributeData; + + /** + * @var Registry + */ + private $registry; + + /** + * @var Page + */ + private $page; + + /** + * @var Json + */ + private $json; + + /** + * @inheritdoc + */ + protected function setUp() + { + $this->objectManager = Bootstrap::getObjectManager(); + $this->configurableHelper = $this->objectManager->get(Data::class); + $this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class); + $this->configurableAttributeData = $this->objectManager->get(ConfigurableAttributeData::class); + $this->registry = $this->objectManager->get(Registry::class); + $this->page = $this->objectManager->create(Page::class); + $this->json = $this->objectManager->get(Json::class); + parent::setUp(); + } + + /** + * Assert that all configurable options was rendered correctly if one of + * child product is visible on catalog\search. + * + * @magentoDataFixture Magento/ConfigurableProduct/_files/configurable_product_with_two_child_products.php + * + * @return void + */ + public function testRenderConfigurableOptionsBlockWithOneVisibleOption(): void + { + $configurableProduct = $this->productRepository->get('Configurable product'); + $childProduct = $this->productRepository->get('Simple option 1'); + $childProduct->setVisibility(Visibility::VISIBILITY_BOTH); + $this->productRepository->save($childProduct); + $allProducts = $configurableProduct->getTypeInstance()->getUsedProducts($configurableProduct, null); + $options = $this->configurableHelper->getOptions($configurableProduct, $allProducts); + $confAttrData = $this->configurableAttributeData->getAttributesData($configurableProduct, $options); + $attributesJson = str_replace( + ['[', ']'], + ['\[', '\]'], + $this->json->serialize($confAttrData['attributes']) + ); + $optionsHtml = $this->getConfigurableOptionsHtml('Configurable product'); + $this->assertRegExp("/\"spConfig\": {\"attributes\":{$attributesJson}/", $optionsHtml); + } + + /** + * Render configurable options block. + * + * @param string $configurableSku + * @return string + */ + private function getConfigurableOptionsHtml(string $configurableSku): string + { + $product = $this->productRepository->get($configurableSku); + $this->registry->unregister('product'); + $this->registry->register('product', $product); + $optionsBlock = $this->getOptionsWrapperBlockWithOnlyConfigurableBlock(); + $optionHtml = $optionsBlock->toHtml(); + $this->registry->unregister('product'); + + return $optionHtml; + } + + /** + * Get options wrapper without extra blocks(only configurable child block). + * + * @return View + */ + private function getOptionsWrapperBlockWithOnlyConfigurableBlock(): View + { + $this->page->addHandle([ + 'default', + 'catalog_product_view', + 'catalog_product_view_type_configurable', + ]); + $this->page->getLayout()->generateXml(); + + /** @var View $productInfoOptionsWrapper */ + $productInfoOptionsWrapper = $this->page->getLayout()->getBlock('product.info.options.wrapper'); + $productInfoOptionsWrapper->unsetChild('product_options'); + $productInfoOptionsWrapper->unsetChild('html_calendar'); + + return $productInfoOptionsWrapper; + } +} diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/FindByUrlRewriteTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/FindByUrlRewriteTest.php new file mode 100644 index 0000000000000..23ab905fa0eab --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/FindByUrlRewriteTest.php @@ -0,0 +1,267 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\ConfigurableProduct\Model; + +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product\Visibility; +use Magento\Catalog\Model\ResourceModel\Product as ProductResource; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\ObjectManager; +use Magento\UrlRewrite\Model\ResourceModel\UrlRewriteCollection; +use Magento\UrlRewrite\Model\ResourceModel\UrlRewriteCollectionFactory; +use Magento\UrlRewrite\Model\UrlRewrite as UrlRewriteItem; +use Magento\UrlRewrite\Service\V1\Data\UrlRewrite; +use PHPUnit\Framework\TestCase; + +/** + * Test cases related to check that URL rewrite has created or not. + */ +class FindByUrlRewriteTest extends TestCase +{ + /** + * @var ObjectManager + */ + private $objectManger; + + /** + * @var ProductResource + */ + private $productResource; + + /** + * @var ProductRepositoryInterface + */ + private $productRepository; + + /** + * @var UrlRewriteCollectionFactory + */ + private $urlRewriteCollectionFactory; + + /** + * @inheritdoc + */ + protected function setUp() + { + $this->objectManger = Bootstrap::getObjectManager(); + $this->productResource = $this->objectManger->get(ProductResource::class); + $this->productRepository = $this->objectManger->get(ProductRepositoryInterface::class); + $this->urlRewriteCollectionFactory = $this->objectManger->get(UrlRewriteCollectionFactory::class); + parent::setUp(); + } + + /** + * Assert that product is available by URL rewrite with different visibility. + * + * @magentoDataFixture Magento/ConfigurableProduct/_files/configurable_product_with_two_child_products.php + * @dataProvider visibilityWithExpectedResultDataProvider + * @magentoDbIsolation enabled + * + * @param array $productsData + * @return void + */ + public function testCheckIsUrlRewriteForChildrenProductsHasCreated(array $productsData): void + { + $this->checkConfigurableUrlRewriteWasCreated(); + $this->updateProductsVisibility($productsData); + $productIdsBySkus = $this->getProductIdsBySkus($productsData); + $urlRewritesCollection = $this->getUrlRewritesCollectionByProductIds($productIdsBySkus); + $expectedCount = 0; + foreach ($productsData as $productData) { + $productId = $productIdsBySkus[$productData['sku']]; + /** @var UrlRewriteItem $urlRewrite */ + $urlRewrite = $urlRewritesCollection->getItemByColumnValue( + UrlRewrite::TARGET_PATH, + "catalog/product/view/id/{$productId}" + ); + if ($productData['url_rewrite_created']) { + $this->assertNotNull($urlRewrite); + $this->assertEquals($productId, $urlRewrite->getEntityId()); + $this->assertEquals('product', $urlRewrite->getEntityType()); + $expectedCount++; + } else { + $this->assertNull($urlRewrite); + } + } + $this->assertCount($expectedCount, $urlRewritesCollection); + } + + /** + * Return products visibility, expected result and other product additional data. + * + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + * + * @return array + */ + public function visibilityWithExpectedResultDataProvider(): array + { + return [ + 'visibility_for_both_product_only_catalog' => [ + [ + [ + 'sku' => 'Simple option 1', + 'visibility' => Visibility::VISIBILITY_IN_CATALOG, + 'url_rewrite_created' => true, + ], + [ + 'sku' => 'Simple option 2', + 'visibility' => Visibility::VISIBILITY_IN_CATALOG, + 'url_rewrite_created' => true, + ], + ], + ], + 'visibility_for_both_product_catalog_search' => [ + [ + [ + 'sku' => 'Simple option 1', + 'visibility' => Visibility::VISIBILITY_BOTH, + 'url_rewrite_created' => true, + ], + [ + 'sku' => 'Simple option 2', + 'visibility' => Visibility::VISIBILITY_BOTH, + 'url_rewrite_created' => true, + ], + ], + ], + 'visibility_for_both_product_only_search' => [ + [ + [ + 'sku' => 'Simple option 1', + 'visibility' => Visibility::VISIBILITY_IN_SEARCH, + 'url_rewrite_created' => true, + ], + [ + 'sku' => 'Simple option 2', + 'visibility' => Visibility::VISIBILITY_IN_SEARCH, + 'url_rewrite_created' => true, + ], + ], + ], + 'visibility_for_both_product_not_visible_individuality' => [ + [ + [ + 'sku' => 'Simple option 1', + 'visibility' => Visibility::VISIBILITY_NOT_VISIBLE, + 'url_rewrite_created' => false, + ], + [ + 'sku' => 'Simple option 2', + 'visibility' => Visibility::VISIBILITY_NOT_VISIBLE, + 'url_rewrite_created' => false, + ], + ], + ], + 'visibility_for_one_product_only_catalog' => [ + [ + [ + 'sku' => 'Simple option 1', + 'visibility' => Visibility::VISIBILITY_IN_CATALOG, + 'url_rewrite_created' => true, + ], + [ + 'sku' => 'Simple option 2', + 'visibility' => Visibility::VISIBILITY_NOT_VISIBLE, + 'url_rewrite_created' => false, + ], + ], + ], + 'visibility_for_one_product_catalog_search' => [ + [ + [ + 'sku' => 'Simple option 1', + 'visibility' => Visibility::VISIBILITY_BOTH, + 'url_rewrite_created' => true, + ], + [ + 'sku' => 'Simple option 2', + 'visibility' => Visibility::VISIBILITY_NOT_VISIBLE, + 'url_rewrite_created' => false, + ], + ], + ], + 'visibility_for_one_product_only_search' => [ + [ + [ + 'sku' => 'Simple option 1', + 'visibility' => Visibility::VISIBILITY_IN_SEARCH, + 'url_rewrite_created' => true, + ], + [ + 'sku' => 'Simple option 2', + 'visibility' => Visibility::VISIBILITY_NOT_VISIBLE, + 'url_rewrite_created' => false, + ], + ], + ], + ]; + } + + /** + * Update products visibility. + * + * @param array $productsData + * @return void + */ + private function updateProductsVisibility(array $productsData): void + { + foreach ($productsData as $productData) { + $product = $this->productRepository->get($productData['sku']); + $product->setVisibility($productData['visibility']); + $this->productRepository->save($product); + } + } + + /** + * Get URL rewrite collection by product ids. + * + * @param int[] $productIds + * @param string $storeCode + * @return UrlRewriteCollection + */ + private function getUrlRewritesCollectionByProductIds( + array $productIds, + string $storeCode = 'default' + ): UrlRewriteCollection { + $collection = $this->urlRewriteCollectionFactory->create(); + $collection->addStoreFilter($storeCode); + $collection->addFieldToFilter(UrlRewrite::ENTITY_TYPE, ['eq' => 'product']); + $collection->addFieldToFilter(UrlRewrite::ENTITY_ID, ['in' => $productIds]); + + return $collection; + } + + /** + * Check that configurable url rewrite was created. + * + * @return void + */ + private function checkConfigurableUrlRewriteWasCreated(): void + { + $configurableProduct = $this->productRepository->get('Configurable product'); + $configurableUrlRewrite = $this->getUrlRewritesCollectionByProductIds([$configurableProduct->getId()]) + ->getFirstItem(); + $this->assertEquals( + $configurableUrlRewrite->getTargetPath(), + "catalog/product/view/id/{$configurableProduct->getId()}" + ); + } + + /** + * Load all product ids by skus. + * + * @param array $productsData + * @return array + */ + private function getProductIdsBySkus(array $productsData): array + { + $skus = array_column($productsData, 'sku'); + + return $this->productResource->getProductsIdsBySkus($skus); + } +} diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/QuickSearchTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/QuickSearchTest.php new file mode 100644 index 0000000000000..6884be3b04d14 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/QuickSearchTest.php @@ -0,0 +1,170 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\ConfigurableProduct\Model; + +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\Product\Visibility; +use Magento\TestFramework\Catalog\Model\Layer\QuickSearchByQuery; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\ObjectManager; +use PHPUnit\Framework\TestCase; + +/** + * Test cases related to find configurable product via quick search using mysql search engine. + * + * @magentoDataFixture Magento/ConfigurableProduct/_files/configurable_product_with_two_child_products.php + * @magentoDataFixture Magento/CatalogSearch/_files/full_reindex.php + * + * @magentoDbIsolation disabled + * @magentoAppIsolation enabled + */ +class QuickSearchTest extends TestCase +{ + /** + * @var ObjectManager + */ + private $objectManager; + + /** + * @var QuickSearchByQuery + */ + private $quickSearchByQuery; + + /** + * @var ProductRepositoryInterface + */ + private $productRepository; + + /** + * @inheritdoc + */ + protected function setUp() + { + $this->objectManager = Bootstrap::getObjectManager(); + $this->quickSearchByQuery = $this->objectManager->get(QuickSearchByQuery::class); + $this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class); + parent::setUp(); + } + + /** + * Assert that configurable child products has not found by query using mysql search engine. + * + * @magentoConfigFixture default/catalog/search/engine mysql + * + * @return void + */ + public function testChildProductsHasNotFoundedByQuery(): void + { + $this->checkThatOnlyConfigurableProductIsAvailableBySearch('Configurable Option'); + } + + /** + * Assert that child product of configurable will be available by search after + * set to product visibility by catalog and search using mysql search engine. + * + * @magentoConfigFixture default/catalog/search/engine mysql + * @dataProvider productAvailabilityInSearchByVisibilityDataProvider + * + * @param int $visibility + * @param bool $expectedResult + * @return void + */ + public function testOneOfChildIsAvailableBySearch(int $visibility, bool $expectedResult): void + { + $this->checkThatOnlyConfigurableProductIsAvailableBySearch('Configurable Option'); + $this->updateProductVisibility($visibility); + $this->checkProductAvailabilityInSearch($expectedResult); + $this->checkThatOnlyConfigurableProductIsAvailableBySearch('White'); + } + + /** + * Return data with product visibility and expected result. + * + * @return array + */ + public function productAvailabilityInSearchByVisibilityDataProvider(): array + { + return [ + 'visible_catalog_only' => [ + Visibility::VISIBILITY_IN_CATALOG, + false, + ], + 'visible_catalog_and_search' => [ + Visibility::VISIBILITY_BOTH, + true, + ], + 'visible_search_only' => [ + Visibility::VISIBILITY_IN_SEARCH, + true, + ], + 'visible_search_not_visible_individuality' => [ + Visibility::VISIBILITY_NOT_VISIBLE, + false, + ], + ]; + } + + /** + * Assert that configurable product was found by option value using mysql search engine. + * + * @magentoConfigFixture default/catalog/search/engine mysql + * + * @return void + */ + public function testSearchByOptionValue(): void + { + $this->checkThatOnlyConfigurableProductIsAvailableBySearch('Option 1'); + } + + /** + * Assert that anyone child product is not available by quick search. + * + * @param string $searchQuery + * + * @return void + */ + private function checkThatOnlyConfigurableProductIsAvailableBySearch(string $searchQuery): void + { + $searchResult = $this->quickSearchByQuery->execute($searchQuery); + $this->assertCount(1, $searchResult->getItems()); + /** @var Product $configurableProduct */ + $configurableProduct = $searchResult->getFirstItem(); + $this->assertEquals('Configurable product', $configurableProduct->getSku()); + } + + /** + * Update product visibility. + * + * @param int $visibility + * @return void + */ + private function updateProductVisibility(int $visibility): void + { + $childProduct = $this->productRepository->get('Simple option 1'); + $childProduct->setVisibility($visibility); + $this->productRepository->save($childProduct); + } + + /** + * Assert that configurable and one of child product is available by search. + * + * @param bool $firstChildIsVisible + * @return void + */ + private function checkProductAvailabilityInSearch(bool $firstChildIsVisible): void + { + $searchResult = $this->quickSearchByQuery->execute('Black'); + $this->assertNotNull($searchResult->getItemByColumnValue(Product::SKU, 'Configurable product')); + $this->assertEquals( + $firstChildIsVisible, + (bool)$searchResult->getItemByColumnValue(Product::SKU, 'Simple option 1') + ); + $this->assertNull($searchResult->getItemByColumnValue(Product::SKU, 'Simple option 2')); + } +} diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_two_child_products.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_two_child_products.php new file mode 100644 index 0000000000000..bdf7b1e87d77c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_two_child_products.php @@ -0,0 +1,93 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\Data\ProductExtensionInterfaceFactory; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Catalog\Model\Product\Type; +use Magento\Catalog\Model\Product\Visibility; +use Magento\Catalog\Model\ProductFactory; +use Magento\CatalogInventory\Model\Stock\ItemFactory; +use Magento\ConfigurableProduct\Helper\Product\Options\Factory; +use Magento\ConfigurableProduct\Model\Product\Type\Configurable; +use Magento\Eav\Api\Data\AttributeOptionInterface; +use Magento\Store\Api\WebsiteRepositoryInterface; +use Magento\TestFramework\Helper\Bootstrap; + +require __DIR__ . '/configurable_attribute.php'; + +$objectManager = Bootstrap::getObjectManager(); +/** @var Factory $optionsFactory */ +$optionsFactory = $objectManager->get(Factory::class); +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->get(ProductRepositoryInterface::class); +/** @var ProductExtensionInterfaceFactory $productExtensionFactory */ +$productExtensionFactory = $objectManager->get(ProductExtensionInterfaceFactory::class); +/** @var ProductFactory $productFactory */ +$productFactory = $objectManager->get(ProductFactory::class); +/** @var WebsiteRepositoryInterface $websiteRepository */ +$websiteRepository = $objectManager->get(WebsiteRepositoryInterface::class); +$baseWebsite = $websiteRepository->get('base'); +/** @var AttributeOptionInterface[] $options */ +$options = $attribute->getOptions(); +$associatedProductIds = $attributeValues = []; +$simpleProductsData = [ + ['Simple option 1', 10, 'Black'], + ['Simple option 2', 20, 'White'], +]; +foreach ($options as $option) { + if (!$option->getValue()) { + continue; + } + [$productSku, $productPrice, $productDescription] = array_shift($simpleProductsData); + $product = $productFactory->create(); + $product->isObjectNew(true); + $product->setTypeId(Type::TYPE_SIMPLE) + ->setAttributeSetId($product->getDefaultAttributeSetId()) + ->setWebsiteIds([$baseWebsite->getId()]) + ->setName('Configurable ' . $option->getLabel()) + ->setSku($productSku) + ->setPrice($productPrice) + ->setTestConfigurable($option->getValue()) + ->setDescription($productDescription) + ->setVisibility(Visibility::VISIBILITY_NOT_VISIBLE) + ->setStatus(Status::STATUS_ENABLED) + ->setStockData(['use_config_manage_stock' => 1, 'qty' => 100, 'is_qty_decimal' => 0, 'is_in_stock' => 1]); + $product = $productRepository->save($product); + $attributeValues[] = [ + 'label' => 'test', + 'attribute_id' => $attribute->getId(), + 'value_index' => $option->getValue(), + ]; + $associatedProductIds[] = $product->getId(); +} +$product = $productFactory->create(); +$product->isObjectNew(true); +$product->setTypeId(Configurable::TYPE_CODE) + ->setAttributeSetId($product->getDefaultAttributeSetId()) + ->setWebsiteIds([$baseWebsite->getId()]) + ->setName('Configurable product with two child') + ->setSku('Configurable product') + ->setVisibility(Visibility::VISIBILITY_BOTH) + ->setStatus(Status::STATUS_ENABLED) + ->setStockData(['use_config_manage_stock' => 1, 'is_in_stock' => 1]); +$configurableOptions = $optionsFactory->create( + [ + [ + 'attribute_id' => $attribute->getId(), + 'code' => $attribute->getAttributeCode(), + 'label' => $attribute->getStoreLabel(), + 'position' => '0', + 'values' => $attributeValues, + ], + ] +); +$extensionConfigurableAttributes = $product->getExtensionAttributes() ?? $productExtensionFactory->create(); +$extensionConfigurableAttributes->setConfigurableProductOptions($configurableOptions); +$extensionConfigurableAttributes->setConfigurableProductLinks($associatedProductIds); +$product->setExtensionAttributes($extensionConfigurableAttributes); +$productRepository->save($product); diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_two_child_products_rollback.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_two_child_products_rollback.php new file mode 100644 index 0000000000000..b0d9b3d80e11e --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_two_child_products_rollback.php @@ -0,0 +1,29 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Registry; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var Registry $registry */ +$registry = $objectManager->get(Registry::class); +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->get(ProductRepositoryInterface::class); +foreach (['Simple option 1', 'Simple option 2', 'Configurable product'] as $sku) { + try { + $productRepository->deleteById($sku); + } catch (NoSuchEntityException $e) { + //Product has deleted. + } +} +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); +require __DIR__ . '/configurable_attribute_rollback.php'; diff --git a/dev/tests/integration/testsuite/Magento/Elasticsearch6/ConfigurableProduct/Model/QuickSearchTest.php b/dev/tests/integration/testsuite/Magento/Elasticsearch6/ConfigurableProduct/Model/QuickSearchTest.php new file mode 100644 index 0000000000000..50cb4974a9cf1 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Elasticsearch6/ConfigurableProduct/Model/QuickSearchTest.php @@ -0,0 +1,69 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Elasticsearch6\ConfigurableProduct\Model; + +use Magento\ConfigurableProduct\Model\QuickSearchTest as ConfigurableProductQuickSearchTest; + +/** + * Test cases related to find configurable product via quick search using Elasticsearch 6.0+ search engine. + * + * @magentoDataFixture Magento/ConfigurableProduct/_files/configurable_product_with_two_child_products.php + * @magentoDataFixture Magento/CatalogSearch/_files/full_reindex.php + * + * @magentoDbIsolation disabled + * @magentoAppIsolation enabled + */ +class QuickSearchTest extends ConfigurableProductQuickSearchTest +{ + /** + * Assert that configurable child products has not found by query using Elasticsearch 6.0+ search engine. + * + * phpcs:disable Generic.CodeAnalysis.UselessOverridingMethod + * + * @magentoConfigFixture default/catalog/search/engine elasticsearch6 + * + * @return void + */ + public function testChildProductsHasNotFoundedByQuery(): void + { + parent::testChildProductsHasNotFoundedByQuery(); + } + + /** + * Assert that child product of configurable will be available by search after + * set to product visibility by catalog and search using Elasticsearch 6.0+ search engine. + * + * phpcs:disable Generic.CodeAnalysis.UselessOverridingMethod + * + * @magentoConfigFixture default/catalog/search/engine elasticsearch6 + * + * @dataProvider productAvailabilityInSearchByVisibilityDataProvider + * + * @param int $visibility + * @param bool $expectedResult + * @return void + */ + public function testOneOfChildIsAvailableBySearch(int $visibility, bool $expectedResult): void + { + parent::testOneOfChildIsAvailableBySearch($visibility, $expectedResult); + } + + /** + * Assert that configurable product was found by option value using Elasticsearch 6.0+ search engine. + * + * phpcs:disable Generic.CodeAnalysis.UselessOverridingMethod + * + * @magentoConfigFixture default/catalog/search/engine elasticsearch6 + * + * @return void + */ + public function testSearchByOptionValue(): void + { + parent::testSearchByOptionValue(); + } +} From 8273d77d778cbff64ac35dfb14a2181a9112799d Mon Sep 17 00:00:00 2001 From: Lyzun Oleksandr <alex.nuzil@gmail.com> Date: Fri, 10 Jan 2020 16:10:33 +0100 Subject: [PATCH 0777/1143] Add Class description --- lib/internal/Magento/Framework/DataObject/IdentityValidator.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/internal/Magento/Framework/DataObject/IdentityValidator.php b/lib/internal/Magento/Framework/DataObject/IdentityValidator.php index b17e04585531a..e8c068a093cb5 100644 --- a/lib/internal/Magento/Framework/DataObject/IdentityValidator.php +++ b/lib/internal/Magento/Framework/DataObject/IdentityValidator.php @@ -11,6 +11,8 @@ /** * Class IdentityValidator + * + * Class for validating Uuid's */ class IdentityValidator implements IdentityValidatorInterface { From 638ccd5bde4ff0d966231cb22c232270a2f2e706 Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Fri, 10 Jan 2020 18:45:01 +0200 Subject: [PATCH 0778/1143] MC-25108: MFTF Flakiness because of bad design - StoreFrontMyAccountWithMultishipmentTest --- ...tomerOrderMatchesGrandTotalActionGroup.xml | 28 +++++ ...oreFrontMyAccountWithMultishipmentTest.xml | 4 +- .../StorefrontOrderWithMultishippingTest.xml | 105 ++++++++++++++++++ ...rontCustomerOrdersViewOrderActionGroup.xml | 22 ++++ .../StorefrontCustomerOrdersGridSection.xml | 4 +- 5 files changed, 159 insertions(+), 4 deletions(-) create mode 100644 app/code/Magento/Multishipping/Test/Mftf/ActionGroup/AssertStorefrontCustomerOrderMatchesGrandTotalActionGroup.xml create mode 100644 app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontOrderWithMultishippingTest.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/StorefrontCustomerOrdersViewOrderActionGroup.xml diff --git a/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/AssertStorefrontCustomerOrderMatchesGrandTotalActionGroup.xml b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/AssertStorefrontCustomerOrderMatchesGrandTotalActionGroup.xml new file mode 100644 index 0000000000000..9281cdf03a1ab --- /dev/null +++ b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/AssertStorefrontCustomerOrderMatchesGrandTotalActionGroup.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <actionGroup name="AssertStorefrontCustomerOrderMatchesGrandTotalActionGroup"> + <grabTextFrom selector="{{StorefrontSalesOrderSection.salesOrderPrice('subtotal')}}" stepKey="grabValueForSubtotal"/> + <grabTextFrom selector="{{StorefrontSalesOrderSection.salesOrderPrice('shipping')}}" stepKey="grabValueForShippingHandling"/> + <grabTextFrom selector="{{StorefrontSalesOrderSection.salesOrderPrice('grand_total')}}" stepKey="grabValueForGrandTotal"/> + <executeJS function=" + var grandTotal = '{$grabValueForGrandTotal}'.substr(1); + return (grandTotal);" stepKey="grandTotalValue"/> + <executeJS function=" + var subtotal = '{$grabValueForSubtotal}'.substr(1); + var handling = '{$grabValueForShippingHandling}'.substr(1); + var subtotalHandling = (parseFloat(subtotal) + parseFloat(handling)).toFixed(2); + return (subtotalHandling);" stepKey="sumTotalValue"/> + <assertEquals stepKey="assertSubTotalPrice"> + <expectedResult type="variable">sumTotalValue</expectedResult> + <actualResult type="variable">grandTotalValue</actualResult> + </assertEquals> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontMyAccountWithMultishipmentTest.xml b/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontMyAccountWithMultishipmentTest.xml index ad68b709c5729..d8b6a35a4885c 100644 --- a/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontMyAccountWithMultishipmentTest.xml +++ b/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontMyAccountWithMultishipmentTest.xml @@ -12,13 +12,13 @@ <annotations> <features value="Multishipping"/> <stories value="Shipping price shows 0 on Order view page after multiple address checkout"/> - <title value="Verify Shipping price for Storefront after multiple address checkout"/> + <title value="DEPRECATED. Verify Shipping price for Storefront after multiple address checkout"/> <description value="Verify that shipping price on My account matches with shipping method prices after multiple addresses checkout (Order view page)"/> <severity value="CRITICAL"/> <testCaseId value="MC-19303"/> <group value="multishipping"/> <skip> - <issueId value="MC-22683"/> + <issueId value="DEPRECATED">Please use StorefrontOrderWithMultishippingTest instead</issueId> </skip> </annotations> diff --git a/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontOrderWithMultishippingTest.xml b/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontOrderWithMultishippingTest.xml new file mode 100644 index 0000000000000..26a1892cb679e --- /dev/null +++ b/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontOrderWithMultishippingTest.xml @@ -0,0 +1,105 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="StorefrontOrderWithMultishippingTest"> + <annotations> + <features value="Multishipping"/> + <stories value="Shipping price shows 0 on Order view page after multiple address checkout"/> + <title value="Verify Shipping price for Storefront after multiple address checkout"/> + <description value="Verify that shipping price on My account matches with shipping method prices after multiple addresses checkout (Order view page)"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-28900"/> + <group value="catalog"/> + <group value="sales"/> + <group value="multishipping"/> + </annotations> + + <before> + <createData entity="SimpleProduct2" stepKey="createProduct1"/> + <createData entity="SimpleProduct2" stepKey="createProduct2"/> + <createData entity="Simple_US_Customer_Two_Addresses" stepKey="createCustomer"/> + <!-- Set configurations --> + <magentoCLI command="config:set {{EnableMultiShippingCheckoutMultiple.path}} {{EnableMultiShippingCheckoutMultiple.value}}" stepKey="allowShippingToMultipleAddresses"/> + <magentoCLI command="config:set {{EnableFreeShippingMethod.path}} {{EnableFreeShippingMethod.value}}" stepKey="enableFreeShipping"/> + <magentoCLI command="config:set {{EnableFlatRateShippingMethod.path}} {{EnableFlatRateShippingMethod.value}}" stepKey="enableFlatRateShipping"/> + <magentoCLI command="config:set {{EnableCheckMoneyOrderPaymentMethod.path}} {{EnableCheckMoneyOrderPaymentMethod.value}}" stepKey="enableCheckMoneyOrderPaymentMethod"/> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginToStorefrontAccount"> + <argument name="Customer" value="$$createCustomer$$"/> + </actionGroup> + </before> + + <after> + <deleteData createDataKey="createProduct1" stepKey="deleteProduct1"/> + <deleteData createDataKey="createProduct2" stepKey="deleteProduct2"/> + <!-- Need logout before customer delete. Fatal error appears otherwise --> + <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/> + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> + <magentoCLI command="config:set {{DisableMultiShippingCheckoutMultiple.path}} {{DisableMultiShippingCheckoutMultiple.value}}" stepKey="withdrawShippingToMultipleAddresses"/> + <magentoCLI command="config:set {{DisableFreeShippingMethod.path}} {{DisableFreeShippingMethod.value}}" stepKey="disableFreeShipping"/> + <actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearAllOrdersGridFilters"/> + <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + </after> + + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addSimpleProduct1ToCart"> + <argument name="product" value="$$createProduct1$$"/> + </actionGroup> + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addSimpleProduct2ToCart"> + <argument name="product" value="$$createProduct2$$"/> + </actionGroup> + <actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openCart"/> + <actionGroup ref="CheckingWithMultipleAddressesActionGroup" stepKey="checkoutWithMultipleAddresses"/> + <waitForPageLoad stepKey="waitForShippingInfoPageLoad"/> + <actionGroup ref="SelectMultiShippingInfoActionGroup" stepKey="checkoutWithMultipleShipping"/> + <!--Select Check / Money order Payment method--> + <actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/> + <actionGroup ref="SelectBillingInfoActionGroup" stepKey="checkoutWithPaymentMethod"/> + <waitForPageLoad stepKey="waitForReviewOrderPageLoad"/> + <actionGroup ref="ReviewOrderForMultiShipmentActionGroup" stepKey="reviewOrderForMultiShipment"> + <argument name="totalNameForFirstOrder" value="Shipping & Handling"/> + <argument name="totalPositionForFirstOrder" value="1"/> + <argument name="totalNameForSecondOrder" value="Shipping & Handling"/> + <argument name="totalPositionForSecondOrder" value="2"/> + </actionGroup> + <waitForPageLoad stepKey="waitForPlaceOrderPageLoad"/> + <actionGroup ref="StorefrontPlaceOrderForMultipleAddressesActionGroup" stepKey="placeOrder"> + <argument name="firstOrderPosition" value="1"/> + <argument name="secondOrderPosition" value="2"/> + </actionGroup> + <waitForPageLoad stepKey="waitForOrderPageLoad"/> + + <!-- Check first order--> + <actionGroup ref="StorefrontCustomerOrdersViewOrderActionGroup" stepKey="openFirstOrder"> + <argument name="orderNumber" value="{$getFirstOrderIdPlaceOrder}"/> + </actionGroup> + <actionGroup ref="AssertStorefrontCustomerOrderMatchesGrandTotalActionGroup" stepKey="checkFirstOrderTotals"/> + <!-- Check second order--> + <actionGroup ref="StorefrontCustomerOrdersViewOrderActionGroup" stepKey="openSecondOrder"> + <argument name="orderNumber" value="{$getSecondOrderIdPlaceOrder}"/> + </actionGroup> + <actionGroup ref="AssertStorefrontCustomerOrderMatchesGrandTotalActionGroup" stepKey="checkSecondOrderTotals"/> + + <!--Assert order in orders grid --> + <!-- Go to order page --> + <actionGroup ref="OpenOrderByIdActionGroup" stepKey="openFirstOrderPage"> + <argument name="orderId" value="{$getFirstOrderIdPlaceOrder}"/> + </actionGroup> + <!-- Check status --> + <see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="Pending" stepKey="seeFirstOrderPendingStatus"/> + <actionGroup ref="AdminSalesOrderActionGroup" stepKey="validateOrderTotalsForFirstOrder"/> + <!-- Go to order page --> + <actionGroup ref="OpenOrderByIdActionGroup" stepKey="openSecondOrderPage"> + <argument name="orderId" value="{$getSecondOrderIdPlaceOrder}"/> + </actionGroup> + <!-- Check status --> + <see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="Pending" stepKey="seeSecondOrderPendingStatus"/> + <actionGroup ref="AdminSalesOrderActionGroup" stepKey="validateOrderTotalsForSecondOrder"/> + </test> +</tests> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/StorefrontCustomerOrdersViewOrderActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/StorefrontCustomerOrdersViewOrderActionGroup.xml new file mode 100644 index 0000000000000..88d79268d440e --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/StorefrontCustomerOrdersViewOrderActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCustomerOrdersViewOrderActionGroup"> + <annotations> + <description>Navigate to customer dashboard -> orders. Press 'View Order' button for specified order number. Notice: customer should be logged in.</description> + </annotations> + <arguments> + <argument name="orderNumber" type="string" defaultValue="000000001"/> + </arguments> + + <amOnPage url="{{StorefrontCustomerOrdersHistoryPage.url}}" stepKey="openCustomerOrdersHistoryPage"/> + <click selector="{{StorefrontCustomerOrdersGridSection.orderView(orderNumber)}}" stepKey="clickViewOrderButton"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/Section/StorefrontCustomerOrdersGridSection.xml b/app/code/Magento/Sales/Test/Mftf/Section/StorefrontCustomerOrdersGridSection.xml index c0deb9ab55d2b..5b079891f657a 100644 --- a/app/code/Magento/Sales/Test/Mftf/Section/StorefrontCustomerOrdersGridSection.xml +++ b/app/code/Magento/Sales/Test/Mftf/Section/StorefrontCustomerOrdersGridSection.xml @@ -9,7 +9,7 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="StorefrontCustomerOrdersGridSection"> - <element name="orderView" type="button" selector="//td[text()='{{orderNumber}}']/following-sibling::td[@class='col actions']/a[contains(@class, 'view')]" parameterized="true" /> - <element name="reorderBtn" type="button" selector="//td[text()='{{orderNumber}}']/following-sibling::td[@class='col actions']/a[contains(@class, 'order')]" parameterized="true" /> + <element name="orderView" type="button" selector="//td[text()='{{orderNumber}}']/following-sibling::td[@class='col actions']/a[contains(@class, 'view')]" parameterized="true" timeout="30" /> + <element name="reorderBtn" type="button" selector="//td[text()='{{orderNumber}}']/following-sibling::td[@class='col actions']/a[contains(@class, 'order')]" parameterized="true" timeout="30" /> </section> </sections> From 02727a8c14be4ae2ba5a3efe6ccd8ab1b34d25cf Mon Sep 17 00:00:00 2001 From: Soumya Unnikrishnan <sunnikri@adobe.com> Date: Fri, 10 Jan 2020 11:44:53 -0600 Subject: [PATCH 0779/1143] MQE-1931: [MTF-To-MFTF] Process PR 718 Added cache flush to resolve ee b2b jenkins errors --- .../Test/Mftf/Test/AdminCreateActiveHtmlTermEntityTest.xml | 2 ++ .../Test/Mftf/Test/AdminCreateActiveTextTermEntityTest.xml | 2 ++ .../Test/Mftf/Test/AdminCreateDisabledTextTermEntityTest.xml | 2 ++ .../AdminCreateEnabledTextTermOnMultishippingEntityTest.xml | 2 ++ 4 files changed, 8 insertions(+) diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveHtmlTermEntityTest.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveHtmlTermEntityTest.xml index 3b180576b557c..dc329ae63ba21 100644 --- a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveHtmlTermEntityTest.xml +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveHtmlTermEntityTest.xml @@ -23,6 +23,8 @@ <magentoCLI command="config:set checkout/options/enable_agreements 1" stepKey="setEnableTermsOnCheckout"/> <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin" /> <createData entity="SimpleTwo" stepKey="createdProduct"/> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> </before> <after> <magentoCLI command="config:set checkout/options/enable_agreements 0" stepKey="setDisableTermsOnCheckout"/> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveTextTermEntityTest.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveTextTermEntityTest.xml index 9b2d3da9ece34..a7baa061750c5 100644 --- a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveTextTermEntityTest.xml +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveTextTermEntityTest.xml @@ -23,6 +23,8 @@ <magentoCLI command="config:set checkout/options/enable_agreements 1" stepKey="setEnableTermsOnCheckout"/> <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin" /> <createData entity="SimpleTwo" stepKey="createdProduct"/> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> </before> <after> <magentoCLI command="config:set checkout/options/enable_agreements 0" stepKey="setDisableTermsOnCheckout"/> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateDisabledTextTermEntityTest.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateDisabledTextTermEntityTest.xml index 8a1efcdce85e1..d5f35fc79fbed 100644 --- a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateDisabledTextTermEntityTest.xml +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateDisabledTextTermEntityTest.xml @@ -23,6 +23,8 @@ <magentoCLI command="config:set checkout/options/enable_agreements 1" stepKey="setEnableTermsOnCheckout"/> <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin" /> <createData entity="SimpleTwo" stepKey="createdProduct"/> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> </before> <after> <magentoCLI command="config:set checkout/options/enable_agreements 0" stepKey="setDisableTermsOnCheckout"/> diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateEnabledTextTermOnMultishippingEntityTest.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateEnabledTextTermOnMultishippingEntityTest.xml index 93e8e6a01d543..462b13ae386c4 100644 --- a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateEnabledTextTermOnMultishippingEntityTest.xml +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateEnabledTextTermOnMultishippingEntityTest.xml @@ -25,6 +25,8 @@ <createData entity="Simple_US_Customer_Multiple_Addresses" stepKey="createdCustomer"/> <createData entity="SimpleTwo" stepKey="createdProduct1"/> <createData entity="SimpleTwo" stepKey="createdProduct2"/> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> </before> <after> <magentoCLI command="config:set checkout/options/enable_agreements 0" stepKey="setDisableTermsOnCheckout"/> From 999c094652cf97d5dc4f7b4a327e0e8a8572218c Mon Sep 17 00:00:00 2001 From: Anusha Vattam <avattam@adobe.com> Date: Fri, 10 Jan 2020 12:03:46 -0600 Subject: [PATCH 0780/1143] MC:20074: Fix Skipped MFTF Tests From MC-17140: MC-14104, MC-14502, MC-14532 - Reordered the test steps --- .../Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml index ad255c5d2bdee..5550e3b317b0d 100644 --- a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml +++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml @@ -28,6 +28,7 @@ <magentoCLI command="config:set {{MinifyJavaScriptFilesDisableConfigData.path}} {{MinifyJavaScriptFilesDisableConfigData.value}}" stepKey="disableJsMinification"/> <actionGroup ref="logout" stepKey="logout"/> </after> + <see userInput="Dashboard" selector="{{AdminHeaderSection.pageTitle}}" stepKey="seeDashboardTitle"/> <waitForPageLoad stepKey="waitForPageLoadOnDashboard"/> <actionGroup ref="AssertAdminSuccessLoginActionGroup" stepKey="loggedInSuccessfully"/> <actionGroup ref="AssertAdminPageIsNot404ActionGroup" stepKey="dontSee404Page"/> From fa932951dffc557d0de2dd150edec16666be65e3 Mon Sep 17 00:00:00 2001 From: Soumya Unnikrishnan <sunnikri@adobe.com> Date: Fri, 10 Jan 2020 14:47:14 -0600 Subject: [PATCH 0781/1143] MQE-1931: [MTF-To-MFTF] Process PR 718 Added scroll to description for WebDriverException --- .../Test/AdminUpdateCategoryWithInactiveIncludeInMenuTest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryWithInactiveIncludeInMenuTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryWithInactiveIncludeInMenuTest.xml index 3fea9c0eed7ca..0c705c180d073 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryWithInactiveIncludeInMenuTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryWithInactiveIncludeInMenuTest.xml @@ -39,6 +39,7 @@ <click selector="{{AdminCategoryBasicFieldSection.includeInMenuLabel}}" stepKey="disableIncludeInMenu"/> <scrollTo selector="{{AdminCategoryContentSection.sectionHeader}}" x="0" y="-80" stepKey="scrollToContent"/> <click selector="{{AdminCategoryContentSection.sectionHeader}}" stepKey="selectContent"/> + <scrollTo selector="{{AdminCategoryContentSection.description}}" x="0" y="-80" stepKey="scrollToDescription"/> <fillField selector="{{AdminCategoryContentSection.description}}" userInput="Updated category Description Fields" stepKey="fillUpdatedDescription"/> <scrollTo selector="{{AdminCategorySEOSection.SectionHeader}}" x="0" y="-80" stepKey="scrollToSearchEngineOptimization"/> <click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="selectSearchEngineOptimization"/> From 6d6a4b00e22cf6ebfc54849e673fe37cb6c6c64b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Szubert?= <bartlomiejszubert@gmail.com> Date: Sun, 12 Jan 2020 01:21:23 +0100 Subject: [PATCH 0782/1143] Make WYSIWYG configuration options depend on wysiwyg being enabled --- app/code/Magento/Catalog/etc/adminhtml/system.xml | 3 +++ app/code/Magento/Cms/etc/adminhtml/system.xml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/app/code/Magento/Catalog/etc/adminhtml/system.xml b/app/code/Magento/Catalog/etc/adminhtml/system.xml index c80363038ac60..a1e49700d4083 100644 --- a/app/code/Magento/Catalog/etc/adminhtml/system.xml +++ b/app/code/Magento/Catalog/etc/adminhtml/system.xml @@ -173,6 +173,9 @@ <label>Use Static URLs for Media Content in WYSIWYG</label> <comment>Media content will be inserted into the editor as a static URL. Media content is not updated if the system configuration base URL changes.</comment> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> + <depends> + <field id="enabled" negative="1">disabled</field> + </depends> </field> </group> </section> diff --git a/app/code/Magento/Cms/etc/adminhtml/system.xml b/app/code/Magento/Cms/etc/adminhtml/system.xml index 20d543440565b..e38efb89b74f8 100644 --- a/app/code/Magento/Cms/etc/adminhtml/system.xml +++ b/app/code/Magento/Cms/etc/adminhtml/system.xml @@ -61,6 +61,9 @@ <field id="editor" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> <label>WYSIWYG Editor</label> <source_model>Magento\Cms\Model\Config\Source\Wysiwyg\Editor</source_model> + <depends> + <field id="enabled" negative="1">disabled</field> + </depends> </field> </group> </section> From 73899c3df37f49128d81cd4ce37edc09b40df60d Mon Sep 17 00:00:00 2001 From: Soumya Unnikrishnan <sunnikri@adobe.com> Date: Sat, 11 Jan 2020 19:02:58 -0600 Subject: [PATCH 0783/1143] MQE-1931: [MTF-To-MFTF] Process PR 718 Added wait for page load to fix jenkins failure --- .../Test/Mftf/Test/AdminAdvancedReportingNavigateMenuTest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Analytics/Test/Mftf/Test/AdminAdvancedReportingNavigateMenuTest.xml b/app/code/Magento/Analytics/Test/Mftf/Test/AdminAdvancedReportingNavigateMenuTest.xml index 67d6715285697..d400bcf5f22fc 100644 --- a/app/code/Magento/Analytics/Test/Mftf/Test/AdminAdvancedReportingNavigateMenuTest.xml +++ b/app/code/Magento/Analytics/Test/Mftf/Test/AdminAdvancedReportingNavigateMenuTest.xml @@ -30,6 +30,7 @@ <argument name="submenuUiId" value="{{AdminMenuReportsBusinessIntelligenceAdvancedReporting.dataUiId}}"/> </actionGroup> <switchToNextTab stepKey="switchToNewTab"/> + <waitForPageLoad stepKey="waitForAdvancedReportingPageLoad"/> <seeInCurrentUrl url="advancedreporting.rjmetrics.com/report" stepKey="seeAssertAdvancedReportingPageUrl"/> </test> </tests> From 341b54b1805bff89fa33da24d2651d19b7d31416 Mon Sep 17 00:00:00 2001 From: Patrick McLain <pat@pmclain.com> Date: Sun, 12 Jan 2020 10:25:37 -0500 Subject: [PATCH 0784/1143] Remove Filename Normalization in Delete Controller Filenames are normalized when saving to the server via the uploader. https://github.com/magento/magento2/blob/241271e8417c4264d44682169aa2032e955d6942/lib/internal/Magento/Framework/File/Uploader.php#L391-L407 This normalization was added to the admin delete controller in 2.2.0 https://github.com/magento/magento2/commit/09d662e2a163049d7d09c8e23e60a547a4b0400a#diff-7c65d1bd4c41efed1d26ddf72f15aa91R62 This change prevents admin users from deleting CMS images not conforming to the uploader normalization. For instance an image on the server named ` - .jpg` would have it's name normalized to ` _ .jpg` in the delete controller which causes the deletion to fail. Fixes magento/adobe-stock-integration#889 --- .../Adminhtml/Wysiwyg/Images/DeleteFiles.php | 2 +- .../Wysiwyg/Images/DeleteFilesTest.php | 27 ++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFiles.php b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFiles.php index 6f57efad41e75..df0764a2e26c6 100644 --- a/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFiles.php +++ b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFiles.php @@ -79,7 +79,7 @@ public function execute() /** @var \Magento\Framework\Filesystem $filesystem */ $filesystem = $this->_objectManager->get(\Magento\Framework\Filesystem::class); $dir = $filesystem->getDirectoryRead(DirectoryList::MEDIA); - $filePath = $path . '/' . \Magento\Framework\File\Uploader::getCorrectFileName($file); + $filePath = $path . '/' . $file; if ($dir->isFile($dir->getRelativePath($filePath)) && !preg_match('#.htaccess#', $file)) { $this->getStorage()->deleteFile($filePath); } diff --git a/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFilesTest.php b/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFilesTest.php index 1fc07d32c77b9..98c3b3fd36ce7 100644 --- a/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFilesTest.php @@ -75,22 +75,43 @@ protected function setUp() * Execute method with correct directory path and file name to check that files under WYSIWYG media directory * can be removed. * + * @param string $filename * @return void + * @dataProvider executeDataProvider */ - public function testExecute() + public function testExecute(string $filename) { + $filePath = $this->fullDirectoryPath . DIRECTORY_SEPARATOR . $filename; + $fixtureDir = realpath(__DIR__ . '/../../../../../Catalog/_files'); + copy($fixtureDir . '/' . $this->fileName, $filePath); + $this->model->getRequest()->setMethod('POST') - ->setPostValue('files', [$this->imagesHelper->idEncode($this->fileName)]); + ->setPostValue('files', [$this->imagesHelper->idEncode($filename)]); $this->model->getStorage()->getSession()->setCurrentPath($this->fullDirectoryPath); $this->model->execute(); $this->assertFalse( $this->mediaDirectory->isExist( - $this->mediaDirectory->getRelativePath($this->fullDirectoryPath . '/' . $this->fileName) + $this->mediaDirectory->getRelativePath($this->fullDirectoryPath . '/' . $filename) ) ); } + /** + * DataProvider for testExecute + * + * @return array + */ + public function executeDataProvider(): array + { + return [ + ['magento_small_image.jpg'], + ['_.jpg'], + [' - .jpg'], + ['-.jpg'], + ]; + } + /** * Check that htaccess file couldn't be removed via * \Magento\Cms\Controller\Adminhtml\Wysiwyg\Images\DeleteFiles::execute method From 5ce399a1a6d5d850e01948438db7e61810d73cc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Szubert?= <bartlomiejszubert@gmail.com> Date: Sun, 12 Jan 2020 16:43:56 +0100 Subject: [PATCH 0785/1143] Cleanup system.xml files --- .../AdminAnalytics/etc/adminhtml/system.xml | 4 +- .../etc/adminhtml/system.xml | 8 +- .../AdvancedSearch/etc/adminhtml/system.xml | 30 +--- .../Analytics/etc/adminhtml/system.xml | 12 +- .../etc/adminhtml/system.xml | 4 +- .../Authorizenet/etc/adminhtml/system.xml | 42 ++--- .../etc/adminhtml/system.xml | 38 ++-- .../etc/adminhtml/system.xml | 2 +- .../Magento/Backend/etc/adminhtml/system.xml | 98 +++++------ app/code/Magento/Backend/etc/config.xml | 3 - .../Magento/Backup/etc/adminhtml/system.xml | 14 +- .../Braintree/etc/adminhtml/system.xml | 72 ++++---- .../Magento/Captcha/etc/adminhtml/system.xml | 40 ++--- .../CardinalCommerce/etc/adminhtml/system.xml | 14 +- .../Magento/Catalog/etc/adminhtml/system.xml | 30 ++-- app/code/Magento/Catalog/etc/config.xml | 2 + .../CatalogInventory/etc/adminhtml/system.xml | 26 +-- .../Magento/CatalogInventory/etc/config.xml | 1 + .../CatalogSearch/etc/adminhtml/system.xml | 2 +- .../etc/adminhtml/system.xml | 2 +- .../Magento/Checkout/etc/adminhtml/system.xml | 8 +- app/code/Magento/Checkout/etc/config.xml | 1 + .../etc/adminhtml/system.xml | 2 +- .../Magento/CheckoutAgreements/etc/config.xml | 16 ++ app/code/Magento/Cms/etc/adminhtml/system.xml | 2 +- .../Magento/Contact/etc/adminhtml/system.xml | 9 + .../Magento/Cookie/etc/adminhtml/system.xml | 2 +- .../Magento/Cron/etc/adminhtml/system.xml | 18 +- .../Magento/Customer/etc/adminhtml/system.xml | 60 +++---- app/code/Magento/Customer/etc/config.xml | 4 + .../Developer/etc/adminhtml/system.xml | 2 +- app/code/Magento/Dhl/etc/adminhtml/system.xml | 42 ++--- .../Directory/etc/adminhtml/system.xml | 32 ++-- .../Downloadable/etc/adminhtml/system.xml | 12 +- app/code/Magento/Downloadable/etc/config.xml | 3 +- app/code/Magento/Eav/etc/adminhtml/system.xml | 4 +- .../Elasticsearch/etc/adminhtml/system.xml | 36 ++-- .../Elasticsearch6/etc/adminhtml/system.xml | 27 +-- app/code/Magento/Email/etc/config.xml | 1 + .../Magento/Fedex/etc/adminhtml/system.xml | 54 +++--- .../GiftMessage/etc/adminhtml/system.xml | 6 +- .../GoogleAnalytics/etc/adminhtml/system.xml | 2 +- .../Magento/GoogleAnalytics/etc/config.xml | 16 ++ .../InstantPurchase/etc/adminhtml/system.xml | 3 + .../Integration/etc/adminhtml/system.xml | 26 +-- .../MediaStorage/etc/adminhtml/system.xml | 8 +- .../Magento/Msrp/etc/adminhtml/system.xml | 6 +- .../Multishipping/etc/adminhtml/system.xml | 11 +- .../Magento/MysqlMq/etc/adminhtml/system.xml | 10 +- .../Newsletter/etc/adminhtml/system.xml | 3 + .../OfflinePayments/etc/adminhtml/system.xml | 56 +++--- .../OfflineShipping/etc/adminhtml/system.xml | 54 +++--- .../PageCache/etc/adminhtml/system.xml | 22 +-- .../Magento/Payment/etc/adminhtml/system.xml | 12 +- .../Magento/Paypal/etc/adminhtml/system.xml | 4 +- .../PaypalCaptcha/etc/adminhtml/system.xml | 4 +- .../Persistent/etc/adminhtml/system.xml | 16 +- .../ProductAlert/etc/adminhtml/system.xml | 14 +- .../ProductVideo/etc/adminhtml/system.xml | 4 +- .../Magento/Reports/etc/adminhtml/system.xml | 28 +-- .../Magento/Review/etc/adminhtml/system.xml | 7 +- .../Magento/Sales/etc/adminhtml/system.xml | 162 +++++++++++++++--- app/code/Magento/Sales/etc/config.xml | 3 + .../SalesRule/etc/adminhtml/system.xml | 12 +- .../Magento/Search/etc/adminhtml/system.xml | 2 +- .../SendFriend/etc/adminhtml/system.xml | 15 ++ .../Magento/Shipping/etc/adminhtml/system.xml | 16 +- app/code/Magento/Shipping/etc/config.xml | 3 + .../Magento/Signifyd/etc/adminhtml/system.xml | 16 +- .../Magento/Sitemap/etc/adminhtml/system.xml | 21 ++- app/code/Magento/Tax/etc/adminhtml/system.xml | 22 +-- .../Translation/etc/adminhtml/system.xml | 2 +- app/code/Magento/Ui/etc/adminhtml/system.xml | 4 +- app/code/Magento/Ups/etc/adminhtml/system.xml | 66 +++---- .../Magento/User/etc/adminhtml/system.xml | 2 +- app/code/Magento/User/etc/config.xml | 1 + .../Magento/Usps/etc/adminhtml/system.xml | 54 +++--- .../WebapiSecurity/etc/adminhtml/system.xml | 4 +- .../Magento/Weee/etc/adminhtml/system.xml | 34 +++- .../Magento/Wishlist/etc/adminhtml/system.xml | 13 +- app/code/Magento/Wishlist/etc/config.xml | 3 + 81 files changed, 883 insertions(+), 663 deletions(-) create mode 100644 app/code/Magento/CheckoutAgreements/etc/config.xml create mode 100644 app/code/Magento/GoogleAnalytics/etc/config.xml diff --git a/app/code/Magento/AdminAnalytics/etc/adminhtml/system.xml b/app/code/Magento/AdminAnalytics/etc/adminhtml/system.xml index d6867e74c4760..a79635de5d1cd 100644 --- a/app/code/Magento/AdminAnalytics/etc/adminhtml/system.xml +++ b/app/code/Magento/AdminAnalytics/etc/adminhtml/system.xml @@ -8,9 +8,9 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> <section id="admin"> - <group id="usage" translate="label" type="text" sortOrder="2000" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="usage" translate="label" type="text" sortOrder="2000" showInDefault="1"> <label>Admin Usage</label> - <field id="enabled" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="enabled" translate="label comment" type="select" sortOrder="1" showInDefault="1"> <label>Enable Admin Usage Tracking</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <comment>Allow Magento to track admin usage in order to improve the quality and user experience.</comment> diff --git a/app/code/Magento/AdminNotification/etc/adminhtml/system.xml b/app/code/Magento/AdminNotification/etc/adminhtml/system.xml index 71f25741ca851..1df75be1316db 100644 --- a/app/code/Magento/AdminNotification/etc/adminhtml/system.xml +++ b/app/code/Magento/AdminNotification/etc/adminhtml/system.xml @@ -8,17 +8,17 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> <section id="system"> - <group id="adminnotification" translate="label" type="text" sortOrder="250" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="adminnotification" translate="label" type="text" sortOrder="250" showInDefault="1"> <label>Notifications</label> - <field id="use_https" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="use_https" translate="label" type="select" sortOrder="1" showInDefault="1" canRestore="1"> <label>Use HTTPS to Get Feed</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="frequency" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="frequency" translate="label" type="select" sortOrder="2" showInDefault="1" canRestore="1"> <label>Update Frequency</label> <source_model>Magento\AdminNotification\Model\Config\Source\Frequency</source_model> </field> - <field id="last_update" translate="label" type="label" sortOrder="3" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="last_update" translate="label" type="label" sortOrder="3" showInDefault="1"> <label>Last Update</label> <frontend_model>Magento\Config\Block\System\Config\Form\Field\Notification</frontend_model> </field> diff --git a/app/code/Magento/AdvancedSearch/etc/adminhtml/system.xml b/app/code/Magento/AdvancedSearch/etc/adminhtml/system.xml index 905dd3e7d1819..ecf8e328f51cb 100644 --- a/app/code/Magento/AdvancedSearch/etc/adminhtml/system.xml +++ b/app/code/Magento/AdvancedSearch/etc/adminhtml/system.xml @@ -10,37 +10,19 @@ <system> <section id="catalog"> <group id="search"> - <field id="search_recommendations_enabled" - translate="label comment" - type="select" - sortOrder="80" - showInDefault="1" - showInWebsite="1" - showInStore="1"> + <field id="search_recommendations_enabled" translate="label comment" type="select" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Enable Search Recommendations</label> <comment>When you enable this option your site may slow down.</comment> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="search_recommendations_count" - translate="label" - type="text" - sortOrder="81" - showInDefault="1" - showInWebsite="1" - showInStore="1"> + <field id="search_recommendations_count" translate="label" type="text" sortOrder="81" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Search Recommendations Count</label> <validate>validate-digits</validate> <depends> <field id="search_recommendations_enabled">1</field> </depends> </field> - <field id="search_recommendations_count_results_enabled" - translate="label" - type="select" - sortOrder="82" - showInDefault="1" - showInWebsite="1" - showInStore="1"> + <field id="search_recommendations_count_results_enabled" translate="label" type="select" sortOrder="82" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Show Results Count for Each Recommendation</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <depends> @@ -48,19 +30,19 @@ </depends> </field> <!--<group id="suggestions">--> - <field id="search_suggestion_enabled" translate="label comment" type="select" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="search_suggestion_enabled" translate="label comment" type="select" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Enable Search Suggestions</label> <comment>When you enable this option your site may slow down.</comment> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="search_suggestion_count" translate="label" type="text" sortOrder="91" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="search_suggestion_count" translate="label" type="text" sortOrder="91" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Search Suggestions Count</label> <validate>validate-digits validate-zero-or-greater</validate> <depends> <field id="search_suggestion_enabled">1</field> </depends> </field> - <field id="search_suggestion_count_results_enabled" translate="label comment" type="select" sortOrder="92" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="search_suggestion_count_results_enabled" translate="label comment" type="select" sortOrder="92" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Show Results Count for Each Suggestion</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <comment>When you enable this option your site may slow down.</comment> diff --git a/app/code/Magento/Analytics/etc/adminhtml/system.xml b/app/code/Magento/Analytics/etc/adminhtml/system.xml index 2a04128099345..999d565353329 100644 --- a/app/code/Magento/Analytics/etc/adminhtml/system.xml +++ b/app/code/Magento/Analytics/etc/adminhtml/system.xml @@ -7,29 +7,29 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> - <section id="analytics" translate="label" type="text" sortOrder="1150" showInDefault="1" showInWebsite="1" showInStore="0"> + <section id="analytics" translate="label" type="text" sortOrder="1150" showInDefault="1" showInWebsite="1"> <label>Advanced Reporting</label> <tab>general</tab> <resource>Magento_Analytics::analytics_settings</resource> - <group id="general" translate="label comment" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0"> + <group id="general" translate="label comment" type="text" sortOrder="10" showInDefault="1" showInWebsite="1"> <label>Advanced Reporting</label> <comment><![CDATA[This service provides a dynamic suite of reports with rich insights about your business. Your reports can be accessed securely on a personalized dashboard outside of the admin panel by clicking on the "Go to Advanced Reporting" link. </br> For more information, see our <a target="_blank" href="https://magento.com/legal/terms/cloud-terms"> terms and conditions</a>.]]></comment> - <field id="enabled" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="enabled" translate="label" type="select" sortOrder="10" showInDefault="1"> <label>Advanced Reporting Service</label> <source_model>Magento\Config\Model\Config\Source\Enabledisable</source_model> <backend_model>Magento\Analytics\Model\Config\Backend\Enabled</backend_model> <frontend_model>Magento\Analytics\Block\Adminhtml\System\Config\SubscriptionStatusLabel</frontend_model> <config_path>analytics/subscription/enabled</config_path> </field> - <field id="collection_time" translate="label" type="time" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="collection_time" translate="label" type="time" sortOrder="20" showInDefault="1"> <label>Time of day to send data</label> <frontend_model>Magento\Analytics\Block\Adminhtml\System\Config\CollectionTimeLabel</frontend_model> <backend_model>Magento\Analytics\Model\Config\Backend\CollectionTime</backend_model> </field> - <field id="vertical" translate="hint label comment" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="vertical" translate="hint label comment" type="select" sortOrder="30" showInDefault="1" showInWebsite="1"> <hint>Industry Data</hint> <label>Industry</label> <comment>In order to personalize your Advanced Reporting experience, please select your industry.</comment> @@ -40,7 +40,7 @@ <field id="analytics/general/enabled">1</field> </depends> </field> - <field id="additional_comment" translate="label comment" type="label" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="additional_comment" translate="label comment" type="label" sortOrder="40" showInDefault="1"> <label><![CDATA[<strong>Get more insights from Magento Business Intelligence</strong>]]></label> <comment><![CDATA[Magento Business Intelligence provides you with a simple and clear path to becoming more data driven.</br> Learn more about <a target="_blank" diff --git a/app/code/Magento/AsynchronousOperations/etc/adminhtml/system.xml b/app/code/Magento/AsynchronousOperations/etc/adminhtml/system.xml index e373a4fc78b13..77469ff8ad0a0 100644 --- a/app/code/Magento/AsynchronousOperations/etc/adminhtml/system.xml +++ b/app/code/Magento/AsynchronousOperations/etc/adminhtml/system.xml @@ -9,9 +9,9 @@ <system> <section id="system"> <tab>advanced</tab> - <group id="bulk" translate="label" showInDefault="1" showInWebsite="0" showInStore="0" sortOrder="600"> + <group id="bulk" translate="label" showInDefault="1" sortOrder="600"> <label>Bulk Actions</label> - <field id="lifetime" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="lifetime" translate="label" type="text" sortOrder="10" showInDefault="1"> <label>Days Saved in Log</label> <validate>validate-zero-or-greater validate-digits</validate> </field> diff --git a/app/code/Magento/Authorizenet/etc/adminhtml/system.xml b/app/code/Magento/Authorizenet/etc/adminhtml/system.xml index 3f2037f70b2df..fe91967ed4a62 100644 --- a/app/code/Magento/Authorizenet/etc/adminhtml/system.xml +++ b/app/code/Magento/Authorizenet/etc/adminhtml/system.xml @@ -10,88 +10,88 @@ <section id="payment"> <group id="authorizenet_directpost" translate="label" type="text" sortOrder="34" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Authorize.Net Direct Post (Deprecated)</label> - <field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Enabled</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="payment_action" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="payment_action" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Payment Action</label> <source_model>Magento\Authorizenet\Model\Source\PaymentAction</source_model> </field> <field id="title" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Title</label> </field> - <field id="login" translate="label" type="obscure" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="login" translate="label" type="obscure" sortOrder="40" showInDefault="1" showInWebsite="1"> <label>API Login ID</label> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> </field> - <field id="trans_key" translate="label" type="obscure" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="trans_key" translate="label" type="obscure" sortOrder="50" showInDefault="1" showInWebsite="1"> <label>Transaction Key</label> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> </field> - <field id="signature_key" translate="label" type="obscure" sortOrder="55" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="signature_key" translate="label" type="obscure" sortOrder="55" showInDefault="1" showInWebsite="1"> <label>Signature Key</label> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> </field> - <field id="trans_md5" translate="label" type="obscure" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="trans_md5" translate="label" type="obscure" sortOrder="60" showInDefault="1" showInWebsite="1"> <label>Merchant MD5</label> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> </field> - <field id="order_status" translate="label" type="select" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="order_status" translate="label" type="select" sortOrder="70" showInDefault="1" showInWebsite="1" canRestore="1"> <label>New Order Status</label> <source_model>Magento\Sales\Model\Config\Source\Order\Status\Processing</source_model> </field> - <field id="test" translate="label" type="select" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="test" translate="label" type="select" sortOrder="80" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Test Mode</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="cgi_url" translate="label" type="text" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="cgi_url" translate="label" type="text" sortOrder="90" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Gateway URL</label> </field> - <field id="cgi_url_td" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="cgi_url_td" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Transaction Details URL</label> </field> - <field id="currency" translate="label" type="select" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="currency" translate="label" type="select" sortOrder="110" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Accepted Currency</label> <source_model>Magento\Config\Model\Config\Source\Locale\Currency</source_model> </field> - <field id="debug" translate="label" type="select" sortOrder="120" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="debug" translate="label" type="select" sortOrder="120" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Debug</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="email_customer" translate="label" type="select" sortOrder="130" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="email_customer" translate="label" type="select" sortOrder="130" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Email Customer</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="merchant_email" translate="label" type="text" sortOrder="140" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="merchant_email" translate="label" type="text" sortOrder="140" showInDefault="1" showInWebsite="1"> <label>Merchant's Email</label> <validate>validate-email</validate> </field> - <field id="cctypes" translate="label" type="multiselect" sortOrder="150" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="cctypes" translate="label" type="multiselect" sortOrder="150" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Credit Card Types</label> <source_model>Magento\Authorizenet\Model\Source\Cctype</source_model> </field> - <field id="useccv" translate="label" type="select" sortOrder="160" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="useccv" translate="label" type="select" sortOrder="160" showInDefault="1" showInWebsite="1"> <label>Credit Card Verification</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="allowspecific" translate="label" type="allowspecific" sortOrder="170" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="allowspecific" translate="label" type="allowspecific" sortOrder="170" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Payment from Applicable Countries</label> <source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model> </field> - <field id="specificcountry" translate="label" type="multiselect" sortOrder="180" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="specificcountry" translate="label" type="multiselect" sortOrder="180" showInDefault="1" showInWebsite="1"> <label>Payment from Specific Countries</label> <source_model>Magento\Directory\Model\Config\Source\Country</source_model> </field> - <field id="min_order_total" translate="label" type="text" sortOrder="190" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="min_order_total" translate="label" type="text" sortOrder="190" showInDefault="1" showInWebsite="1"> <label>Minimum Order Total</label> <validate>validate-number validate-zero-or-greater</validate> </field> - <field id="max_order_total" translate="label" type="text" sortOrder="200" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="max_order_total" translate="label" type="text" sortOrder="200" showInDefault="1" showInWebsite="1"> <label>Maximum Order Total</label> <validate>validate-number validate-zero-or-greater</validate> </field> - <field id="sort_order" translate="label" type="text" sortOrder="210" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="sort_order" translate="label" type="text" sortOrder="210" showInDefault="1" showInWebsite="1"> <label>Sort Order</label> <frontend_class>validate-number</frontend_class> </field> diff --git a/app/code/Magento/AuthorizenetAcceptjs/etc/adminhtml/system.xml b/app/code/Magento/AuthorizenetAcceptjs/etc/adminhtml/system.xml index 7cd00959d9772..86b6d3a198d81 100644 --- a/app/code/Magento/AuthorizenetAcceptjs/etc/adminhtml/system.xml +++ b/app/code/Magento/AuthorizenetAcceptjs/etc/adminhtml/system.xml @@ -10,7 +10,7 @@ <section id="payment"> <group id="authorizenet_acceptjs" translate="label" type="text" sortOrder="34" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Authorize.Net (Deprecated)</label> - <field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Enabled</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <requires> @@ -25,17 +25,17 @@ <label>Title</label> <config_path>payment/authorizenet_acceptjs/title</config_path> </field> - <field id="environment" translate="label" type="select" sortOrder="15" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="environment" translate="label" type="select" sortOrder="15" showInDefault="1" showInWebsite="1"> <label>Environment</label> <source_model>Magento\AuthorizenetAcceptjs\Model\Adminhtml\Source\Environment</source_model> <config_path>payment/authorizenet_acceptjs/environment</config_path> </field> - <field id="payment_action" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="payment_action" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Payment Action</label> <source_model>Magento\AuthorizenetAcceptjs\Model\Adminhtml\Source\PaymentAction</source_model> <config_path>payment/authorizenet_acceptjs/payment_action</config_path> </field> - <field id="login" translate="label" type="obscure" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="login" translate="label" type="obscure" sortOrder="30" showInDefault="1" showInWebsite="1"> <label>API Login ID</label> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> <config_path>payment/authorizenet_acceptjs/login</config_path> @@ -44,7 +44,7 @@ <field id="*/authorizenet_acceptjs/active">1</field> </depends> </field> - <field id="trans_key" translate="label" type="obscure" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="trans_key" translate="label" type="obscure" sortOrder="40" showInDefault="1" showInWebsite="1"> <label>Transaction Key</label> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> <config_path>payment/authorizenet_acceptjs/trans_key</config_path> @@ -53,7 +53,7 @@ <field id="*/authorizenet_acceptjs/active">1</field> </depends> </field> - <field id="public_client_key" translate="label" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="public_client_key" translate="label" sortOrder="50" showInDefault="1" showInWebsite="1"> <label>Public Client Key</label> <config_path>payment/authorizenet_acceptjs/public_client_key</config_path> <validate>required-entry</validate> @@ -61,7 +61,7 @@ <field id="*/authorizenet_acceptjs/active">1</field> </depends> </field> - <field id="trans_signature_key" translate="label" type="obscure" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="trans_signature_key" translate="label" type="obscure" sortOrder="60" showInDefault="1" showInWebsite="1"> <label>Signature Key</label> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> <config_path>payment/authorizenet_acceptjs/trans_signature_key</config_path> @@ -70,7 +70,7 @@ <field id="*/authorizenet_acceptjs/active">1</field> </depends> </field> - <field id="trans_md5" translate="label" type="obscure" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="trans_md5" translate="label" type="obscure" sortOrder="70" showInDefault="1" showInWebsite="1"> <label>Merchant MD5 (deprecated)</label> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> <config_path>payment/authorizenet_acceptjs/trans_md5</config_path> @@ -79,55 +79,55 @@ </depends> </field> </group> - <group id="advanced" translate="label" showInDefault="1" showInWebsite="1" showInStore="0" sortOrder="20"> + <group id="advanced" translate="label" showInDefault="1" showInWebsite="1" sortOrder="20"> <label>Advanced Authorize.Net Settings</label> <attribute type="expanded">0</attribute> - <field id="currency" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="currency" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Accepted Currency</label> <source_model>Magento\Config\Model\Config\Source\Locale\Currency</source_model> <config_path>payment/authorizenet_acceptjs/currency</config_path> </field> - <field id="debug" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="debug" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Debug</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <config_path>payment/authorizenet_acceptjs/debug</config_path> </field> - <field id="email_customer" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="email_customer" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Email Customer</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <config_path>payment/authorizenet_acceptjs/email_customer</config_path> </field> - <field id="cvv_enabled" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="cvv_enabled" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Enable Credit Card Verification Field</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <config_path>payment/authorizenet_acceptjs/cvv_enabled</config_path> </field> - <field id="cctypes" translate="label" type="multiselect" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="cctypes" translate="label" type="multiselect" sortOrder="50" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Credit Card Types</label> <source_model>Magento\AuthorizenetAcceptjs\Model\Adminhtml\Source\Cctype</source_model> <config_path>payment/authorizenet_acceptjs/cctypes</config_path> </field> - <field id="allowspecific" translate="label" type="allowspecific" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="allowspecific" translate="label" type="allowspecific" sortOrder="60" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Payment from Applicable Countries</label> <source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model> <config_path>payment/authorizenet_acceptjs/allowspecific</config_path> </field> - <field id="specificcountry" translate="label" type="multiselect" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="specificcountry" translate="label" type="multiselect" sortOrder="70" showInDefault="1" showInWebsite="1"> <label>Payment from Specific Countries</label> <source_model>Magento\Directory\Model\Config\Source\Country</source_model> <config_path>payment/authorizenet_acceptjs/specificcountry</config_path> </field> - <field id="min_order_total" translate="label" type="text" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="min_order_total" translate="label" type="text" sortOrder="80" showInDefault="1" showInWebsite="1"> <label>Minimum Order Total</label> <config_path>payment/authorizenet_acceptjs/min_order_total</config_path> <validate>validate-number validate-zero-or-greater</validate> </field> - <field id="max_order_total" translate="label" type="text" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="max_order_total" translate="label" type="text" sortOrder="90" showInDefault="1" showInWebsite="1"> <label>Maximum Order Total</label> <config_path>payment/authorizenet_acceptjs/max_order_total</config_path> <validate>validate-number validate-zero-or-greater</validate> </field> - <field id="sort_order" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="sort_order" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1"> <label>Sort Order</label> <frontend_class>validate-number</frontend_class> <config_path>payment/authorizenet_acceptjs/sort_order</config_path> diff --git a/app/code/Magento/AuthorizenetCardinal/etc/adminhtml/system.xml b/app/code/Magento/AuthorizenetCardinal/etc/adminhtml/system.xml index 2be287a5e8743..cf8ad28d26d0e 100644 --- a/app/code/Magento/AuthorizenetCardinal/etc/adminhtml/system.xml +++ b/app/code/Magento/AuthorizenetCardinal/etc/adminhtml/system.xml @@ -10,7 +10,7 @@ <section id="three_d_secure"> <group id="cardinal"> <group id="config"> - <field id="enabled_authorize" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="enabled_authorize" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1"> <label>Enable for Authorize.Net</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <config_path>three_d_secure/cardinal/enabled_authorizenet</config_path> diff --git a/app/code/Magento/Backend/etc/adminhtml/system.xml b/app/code/Magento/Backend/etc/adminhtml/system.xml index 4a92ed8124bf8..3a2b3554cc4a0 100644 --- a/app/code/Magento/Backend/etc/adminhtml/system.xml +++ b/app/code/Magento/Backend/etc/adminhtml/system.xml @@ -20,7 +20,7 @@ @deprecated Magento does not support custom disabling/enabling modules output since 2.2.0 version. Section 'Advanced' was disabled. This section will be removed from code in one release. --> - <section id="advanced" translate="label" type="text" sortOrder="910" showInDefault="0" showInWebsite="0" showInStore="0"> + <section id="advanced" translate="label" type="text" sortOrder="910"> <label>Advanced</label> <tab>advanced</tab> <resource>Magento_Config::advanced</resource> @@ -131,7 +131,7 @@ </depends> <comment>Add the following parameter to the URL to show template hints ?templatehints=[parameter_value]</comment> </field> - <field id="template_hints_admin" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="template_hints_admin" translate="label" type="select" sortOrder="20" showInDefault="1"> <label>Enable Template Path Hints for Admin</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> @@ -162,7 +162,7 @@ <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <backend_model>Magento\Config\Model\Config\Backend\Translate</backend_model> </field> - <field id="active_admin" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="active_admin" translate="label comment" type="select" sortOrder="20" showInDefault="1"> <label>Enabled for Admin</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <backend_model>Magento\Config\Model\Config\Backend\Translate</backend_model> @@ -197,18 +197,18 @@ <comment>Minification is not applied in developer mode.</comment> </field> </group> - <group id="image" translate="label" type="text" sortOrder="120" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="image" translate="label" type="text" sortOrder="120" showInDefault="1"> <label>Image Processing Settings</label> - <field id="default_adapter" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="default_adapter" translate="label comment" type="select" sortOrder="10" showInDefault="1" canRestore="1"> <label>Image Adapter</label> <source_model>Magento\Config\Model\Config\Source\Image\Adapter</source_model> <backend_model>Magento\Config\Model\Config\Backend\Image\Adapter</backend_model> <comment>When the adapter was changed, please flush Catalog Images Cache.</comment> </field> </group> - <group id="static" translate="label" type="text" sortOrder="130" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="static" translate="label" type="text" sortOrder="130" showInDefault="1"> <label>Static Files Settings</label> - <field id="sign" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="sign" translate="label" type="select" sortOrder="10" showInDefault="1" canRestore="1"> <label>Sign Static Files</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> @@ -220,7 +220,7 @@ <resource>Magento_Config::config_general</resource> <group id="country" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Country Options</label> - <field id="allow" translate="label" type="multiselect" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="allow" translate="label" type="multiselect" sortOrder="2" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Allow Countries</label> <source_model>Magento\Directory\Model\Config\Source\Country</source_model> <can_be_empty>1</can_be_empty> @@ -229,7 +229,7 @@ <label>Default Country</label> <source_model>Magento\Directory\Model\Config\Source\Country</source_model> </field> - <field id="eu_countries" translate="label" type="multiselect" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="eu_countries" translate="label" type="multiselect" sortOrder="30" showInDefault="1" canRestore="1"> <label>European Union Countries</label> <source_model>Magento\Directory\Model\Config\Source\Country</source_model> </field> @@ -241,7 +241,7 @@ </group> <group id="locale" translate="label" type="text" sortOrder="8" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Locale Options</label> - <field id="timezone" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="timezone" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1"> <label>Timezone</label> <source_model>Magento\Config\Model\Config\Source\Locale\Timezone</source_model> <backend_model>Magento\Config\Model\Config\Backend\Locale\Timezone</backend_model> @@ -271,35 +271,35 @@ <field id="hours" translate="label" type="text" sortOrder="22" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Store Hours of Operation</label> </field> - <field id="country_id" translate="label" type="select" sortOrder="25" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="country_id" translate="label" type="select" sortOrder="25" showInDefault="1" showInWebsite="1"> <label>Country</label> <source_model>Magento\Directory\Model\Config\Source\Country</source_model> <frontend_class>countries</frontend_class> <can_be_empty>1</can_be_empty> </field> - <field id="region_id" translate="label" type="text" sortOrder="27" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="region_id" translate="label" type="text" sortOrder="27" showInDefault="1" showInWebsite="1"> <label>Region/State</label> </field> - <field id="postcode" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="postcode" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1"> <label>ZIP/Postal Code</label> </field> - <field id="city" translate="label" type="text" sortOrder="45" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="city" translate="label" type="text" sortOrder="45" showInDefault="1" showInWebsite="1"> <label>City</label> </field> - <field id="street_line1" translate="label" type="text" sortOrder="55" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="street_line1" translate="label" type="text" sortOrder="55" showInDefault="1" showInWebsite="1"> <label>Street Address</label> </field> - <field id="street_line2" translate="label" type="text" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="street_line2" translate="label" type="text" sortOrder="60" showInDefault="1" showInWebsite="1"> <label>Street Address Line 2</label> </field> - <field id="merchant_vat_number" translate="label" type="text" sortOrder="61" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="merchant_vat_number" translate="label" type="text" sortOrder="61" showInDefault="1" showInWebsite="1"> <label>VAT Number</label> <can_be_empty>1</can_be_empty> </field> </group> - <group id="single_store_mode" translate="label" type="text" sortOrder="150" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="single_store_mode" translate="label" type="text" sortOrder="150" showInDefault="1"> <label>Single-Store Mode</label> - <field id="enabled" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="enabled" translate="label comment" type="select" sortOrder="10" showInDefault="1"> <label>Enable Single-Store Mode</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <comment>This setting will not be taken into account if system has more than one store view.</comment> @@ -326,7 +326,7 @@ <validate>validate-digits validate-digits-range digits-range-0-65535</validate> <comment>Please enter at least 0 and at most 65535 (For Windows server only).</comment> </field> - <field id="set_return_path" translate="label" type="select" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="set_return_path" translate="label" type="select" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Set Return-Path</label> <source_model>Magento\Config\Model\Config\Source\Yesnocustom</source_model> </field> @@ -341,12 +341,12 @@ </group> <group id="upload_configuration" translate="label" type="text" sortOrder="1000" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Images Upload Configuration</label> - <field id="enable_resize" translate="label" type="select" sortOrder="200" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="enable_resize" translate="label" type="select" sortOrder="200" showInDefault="1" canRestore="1"> <label>Enable Frontend Resize</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <comment>Resize performed via javascript before file upload.</comment> </field> - <field id="max_width" translate="label comment" type="text" sortOrder="300" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="max_width" translate="label comment" type="text" sortOrder="300" showInDefault="1" canRestore="1"> <label>Maximum Width</label> <validate>validate-greater-than-zero validate-number required-entry</validate> <comment>Maximum allowed width for uploaded image.</comment> @@ -354,7 +354,7 @@ <field id="enable_resize">1</field> </depends> </field> - <field id="max_height" translate="label comment" type="text" sortOrder="400" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="max_height" translate="label comment" type="text" sortOrder="400" showInDefault="1" canRestore="1"> <label>Maximum Height</label> <validate>validate-greater-than-zero validate-number required-entry</validate> <comment>Maximum allowed height for uploaded image.</comment> @@ -364,37 +364,37 @@ </field> </group> </section> - <section id="admin" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0"> + <section id="admin" translate="label" type="text" sortOrder="20" showInDefault="1"> <label>Admin</label> <tab>advanced</tab> <resource>Magento_Config::config_admin</resource> - <group id="emails" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="emails" translate="label" type="text" sortOrder="10" showInDefault="1"> <label>Admin User Emails</label> - <field id="forgot_email_template" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="forgot_email_template" translate="label comment" type="select" sortOrder="10" showInDefault="1" canRestore="1"> <label>Forgot Password Email Template</label> <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> - <field id="forgot_email_identity" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="forgot_email_identity" translate="label" type="select" sortOrder="20" showInDefault="1" canRestore="1"> <label>Forgot and Reset Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> </field> </group> - <group id="startup" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="startup" translate="label" type="text" sortOrder="20" showInDefault="1"> <label>Startup Page</label> - <field id="menu_item_id" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="menu_item_id" translate="label" type="select" sortOrder="1" showInDefault="1" canRestore="1"> <label>Startup Page</label> <source_model>Magento\Config\Model\Config\Source\Admin\Page</source_model> </field> </group> - <group id="url" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="url" translate="label" type="text" sortOrder="30" showInDefault="1"> <label>Admin Base URL</label> - <field id="use_custom" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="use_custom" translate="label" type="select" sortOrder="1" showInDefault="1" canRestore="1"> <label>Use Custom Admin URL</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <backend_model>Magento\Config\Model\Config\Backend\Admin\Usecustom</backend_model> </field> - <field id="custom" translate="label comment" type="text" sortOrder="2" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="custom" translate="label comment" type="text" sortOrder="2" showInDefault="1" canRestore="1"> <label>Custom Admin URL</label> <backend_model>Magento\Config\Model\Config\Backend\Admin\Custom</backend_model> <depends> @@ -402,12 +402,12 @@ </depends> <comment>Make sure that base URL ends with '/' (slash), e.g. http://yourdomain/magento/</comment> </field> - <field id="use_custom_path" translate="label" type="select" sortOrder="3" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="use_custom_path" translate="label" type="select" sortOrder="3" showInDefault="1" canRestore="1"> <label>Use Custom Admin Path</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <backend_model>Magento\Config\Model\Config\Backend\Admin\Custompath</backend_model> </field> - <field id="custom_path" translate="label comment" type="text" sortOrder="4" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="custom_path" translate="label comment" type="text" sortOrder="4" showInDefault="1" canRestore="1"> <label>Custom Admin Path</label> <validate>required-entry validate-alphanum</validate> <backend_model>Magento\Config\Model\Config\Backend\Admin\Custompath</backend_model> @@ -417,33 +417,33 @@ <comment>You will have to sign in after you save your custom admin path.</comment> </field> </group> - <group id="security" translate="label" type="text" sortOrder="35" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="security" translate="label" type="text" sortOrder="35" showInDefault="1"> <label>Security</label> - <field id="password_reset_link_expiration_period" translate="label comment" type="text" sortOrder="7" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="password_reset_link_expiration_period" translate="label comment" type="text" sortOrder="7" showInDefault="1" canRestore="1"> <label>Recovery Link Expiration Period (hours)</label> <comment>Please enter a number 1 or greater in this field.</comment> <validate>required-entry integer validate-greater-than-zero</validate> <backend_model>Magento\Config\Model\Config\Backend\Admin\Password\Link\Expirationperiod</backend_model> </field> - <field id="use_form_key" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="use_form_key" translate="label" type="select" sortOrder="10" showInDefault="1" canRestore="1"> <label>Add Secret Key to URLs</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <backend_model>Magento\Config\Model\Config\Backend\Admin\Usesecretkey</backend_model> </field> - <field id="use_case_sensitive_login" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="use_case_sensitive_login" translate="label" type="select" sortOrder="20" showInDefault="1" canRestore="1"> <label>Login is Case Sensitive</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="session_lifetime" translate="label comment" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="session_lifetime" translate="label comment" sortOrder="30" showInDefault="1" canRestore="1"> <label>Admin Session Lifetime (seconds)</label> <comment>Please enter at least 60 and at most 31536000 (one year).</comment> <backend_model>Magento\Backend\Model\Config\SessionLifetime\BackendModel</backend_model> <validate>validate-digits validate-digits-range digits-range-60-31536000</validate> </field> </group> - <group id="dashboard" translate="label" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="dashboard" translate="label" sortOrder="40" showInDefault="1"> <label>Dashboard</label> - <field id="enable_charts" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="enable_charts" translate="label" type="select" sortOrder="1" showInDefault="1" canRestore="1"> <label>Enable Charts</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> @@ -455,7 +455,7 @@ <resource>Magento_Config::web</resource> <group id="url" translate="label" type="text" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Url Options</label> - <field id="use_store" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="use_store" translate="label comment" type="select" sortOrder="10" showInDefault="1" canRestore="1"> <label>Add Store Code to Urls</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <backend_model>Magento\Config\Model\Config\Backend\Store</backend_model> @@ -529,7 +529,7 @@ <backend_model>Magento\Config\Model\Config\Backend\Secure</backend_model> <comment>Enter https protocol to use Secure URLs on Storefront.</comment> </field> - <field id="use_in_adminhtml" translate="label comment" type="select" sortOrder="60" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="use_in_adminhtml" translate="label comment" type="select" sortOrder="60" showInDefault="1" canRestore="1"> <label>Use Secure URLs in Admin</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <backend_model>Magento\Config\Model\Config\Backend\Secure</backend_model> @@ -555,7 +555,7 @@ <field id="use_in_adminhtml">1</field> </depends> </field> - <field id="offloader_header" translate="label" type="text" sortOrder="90" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="offloader_header" translate="label" type="text" sortOrder="90" showInDefault="1" canRestore="1"> <label>Offloader header</label> </field> </group> @@ -568,21 +568,21 @@ <label>Default No-route URL</label> </field> </group> - <group id="session" translate="label" type="text" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="0"> + <group id="session" translate="label" type="text" sortOrder="60" showInDefault="1" showInWebsite="1"> <label>Session Validation Settings</label> - <field id="use_remote_addr" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="use_remote_addr" translate="label" type="select" sortOrder="1" showInDefault="1" canRestore="1"> <label>Validate REMOTE_ADDR</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="use_http_via" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="use_http_via" translate="label" type="select" sortOrder="20" showInDefault="1" canRestore="1"> <label>Validate HTTP_VIA</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="use_http_x_forwarded_for" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="use_http_x_forwarded_for" translate="label" type="select" sortOrder="30" showInDefault="1" canRestore="1"> <label>Validate HTTP_X_FORWARDED_FOR</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="use_http_user_agent" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="use_http_user_agent" translate="label" type="select" sortOrder="40" showInDefault="1" canRestore="1"> <label>Validate HTTP_USER_AGENT</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> diff --git a/app/code/Magento/Backend/etc/config.xml b/app/code/Magento/Backend/etc/config.xml index 8283fa18dd370..6c568370d9610 100644 --- a/app/code/Magento/Backend/etc/config.xml +++ b/app/code/Magento/Backend/etc/config.xml @@ -11,9 +11,6 @@ <template> <minify_html>0</minify_html> </template> - <static> - <sign>1</sign> - </static> </dev> <system> <media_storage_configuration> diff --git a/app/code/Magento/Backup/etc/adminhtml/system.xml b/app/code/Magento/Backup/etc/adminhtml/system.xml index 78e0aae1dd4c2..577762037ceb4 100644 --- a/app/code/Magento/Backup/etc/adminhtml/system.xml +++ b/app/code/Magento/Backup/etc/adminhtml/system.xml @@ -8,21 +8,21 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> <section id="system"> - <group id="backup" translate="label" type="text" sortOrder="500" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="backup" translate="label" type="text" sortOrder="500" showInDefault="1"> <label>Backup Settings</label> - <field id="functionality_enabled" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="functionality_enabled" translate="label" type="select" sortOrder="5" showInDefault="1"> <label>Enable Backup</label> <comment>Disabled by default for security reasons.</comment> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="enabled" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="enabled" translate="label" type="select" sortOrder="10" showInDefault="1"> <label>Enable Scheduled Backup</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <depends> <field id="functionality_enabled">1</field> </depends> </field> - <field id="type" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="type" translate="label" type="select" sortOrder="20" showInDefault="1"> <label>Scheduled Backup Type</label> <depends> <field id="enabled">1</field> @@ -30,14 +30,14 @@ </depends> <source_model>Magento\Backup\Model\Config\Source\Type</source_model> </field> - <field id="time" translate="label" type="time" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="time" translate="label" type="time" sortOrder="30" showInDefault="1"> <label>Start Time</label> <depends> <field id="enabled">1</field> <field id="functionality_enabled">1</field> </depends> </field> - <field id="frequency" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="frequency" translate="label" type="select" sortOrder="40" showInDefault="1"> <label>Frequency</label> <depends> <field id="enabled">1</field> @@ -46,7 +46,7 @@ <source_model>Magento\Cron\Model\Config\Source\Frequency</source_model> <backend_model>Magento\Backup\Model\Config\Backend\Cron</backend_model> </field> - <field id="maintenance" translate="label comment" type="select" sortOrder="50" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="maintenance" translate="label comment" type="select" sortOrder="50" showInDefault="1"> <label>Maintenance Mode</label> <comment>Please put your store into maintenance mode during backup.</comment> <depends> diff --git a/app/code/Magento/Braintree/etc/adminhtml/system.xml b/app/code/Magento/Braintree/etc/adminhtml/system.xml index bd4346e095c6d..06268536e880e 100644 --- a/app/code/Magento/Braintree/etc/adminhtml/system.xml +++ b/app/code/Magento/Braintree/etc/adminhtml/system.xml @@ -8,7 +8,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> <section id="payment"> - <group id="braintree_section" sortOrder="6" showInDefault="0" showInWebsite="0" showInStore="0"> + <group id="braintree_section" sortOrder="6"> <group id="braintree" translate="label comment" type="text" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Braintree</label> <comment><![CDATA[Accept credit/debit cards and PayPal in your Magento store.<br/>No setup or monthly fees and your customers never leave your store to complete the purchase.]]></comment> @@ -16,7 +16,7 @@ <frontend_model>Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Payment</frontend_model> <attribute type="activity_path">payment/braintree/active</attribute> <attribute type="displayIn">recommended_solutions</attribute> - <field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1"> <label>Enable this Solution</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <config_path>payment/braintree/active</config_path> @@ -24,7 +24,7 @@ <group id="braintree_required"/> </requires> </field> - <field id="active_braintree_paypal" translate="label" type="select" sortOrder="11" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="active_braintree_paypal" translate="label" type="select" sortOrder="11" showInDefault="1" showInWebsite="1"> <label>Enable PayPal through Braintree</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <config_path>payment/braintree_paypal/active</config_path> @@ -32,7 +32,7 @@ <group id="braintree_required"/> </requires> </field> - <field id="braintree_cc_vault_active" translate="label" type="select" sortOrder="12" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="braintree_cc_vault_active" translate="label" type="select" sortOrder="12" showInDefault="1" showInWebsite="1"> <label>Vault Enabled</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <config_path>payment/braintree_cc_vault/active</config_path> @@ -52,86 +52,86 @@ <label>Title</label> <config_path>payment/braintree/title</config_path> </field> - <field id="environment" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="environment" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1"> <label>Environment</label> <source_model>Magento\Braintree\Model\Adminhtml\Source\Environment</source_model> <config_path>payment/braintree/environment</config_path> </field> - <field id="payment_action" translate="label" type="select" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="payment_action" translate="label" type="select" sortOrder="50" showInDefault="1" showInWebsite="1"> <label>Payment Action</label> <source_model>Magento\Braintree\Model\Adminhtml\Source\PaymentAction</source_model> <config_path>payment/braintree/payment_action</config_path> </field> - <field id="merchant_id" translate="label" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="merchant_id" translate="label" sortOrder="90" showInDefault="1" showInWebsite="1"> <label>Merchant ID</label> <config_path>payment/braintree/merchant_id</config_path> </field> - <field id="public_key" translate="label" type="obscure" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="public_key" translate="label" type="obscure" sortOrder="100" showInDefault="1" showInWebsite="1"> <label>Public Key</label> <config_path>payment/braintree/public_key</config_path> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> </field> - <field id="private_key" translate="label" type="obscure" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="private_key" translate="label" type="obscure" sortOrder="110" showInDefault="1" showInWebsite="1"> <label>Private Key</label> <config_path>payment/braintree/private_key</config_path> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> </field> </group> - <group id="braintree_advanced" translate="label" showInDefault="1" showInWebsite="1" showInStore="0" sortOrder="20"> + <group id="braintree_advanced" translate="label" showInDefault="1" showInWebsite="1" sortOrder="20"> <label>Advanced Braintree Settings</label> <frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model> - <field id="braintree_cc_vault_title" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="braintree_cc_vault_title" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1"> <label>Vault Title</label> <config_path>payment/braintree_cc_vault/title</config_path> </field> - <field id="merchant_account_id" translate="label comment" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="merchant_account_id" translate="label comment" sortOrder="30" showInDefault="1" showInWebsite="1"> <label>Merchant Account ID</label> <comment>If you don't specify the merchant account to use to process a transaction, Braintree will process it using your default merchant account.</comment> <config_path>payment/braintree/merchant_account_id</config_path> </field> - <field id="fraudprotection" translate="label comment" type="select" sortOrder="34" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="fraudprotection" translate="label comment" type="select" sortOrder="34" showInDefault="1" showInWebsite="1"> <label>Advanced Fraud Protection</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <comment>Be sure to Enable Advanced Fraud Protection in Your Braintree Account in Settings/Processing Section</comment> <config_path>payment/braintree/fraudprotection</config_path> </field> - <field id="debug" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="debug" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="1"> <label>Debug</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <config_path>payment/braintree/debug</config_path> </field> - <field id="useccv" translate="label comment" type="select" sortOrder="150" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="useccv" translate="label comment" type="select" sortOrder="150" showInDefault="1" showInWebsite="1"> <label>CVV Verification</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <comment>Be sure to Enable AVS and/or CVV in Your Braintree Account in Settings/Processing Section.</comment> <config_path>payment/braintree/useccv</config_path> </field> - <field id="cctypes" translate="label" type="multiselect" sortOrder="160" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="cctypes" translate="label" type="multiselect" sortOrder="160" showInDefault="1" showInWebsite="1"> <label>Credit Card Types</label> <source_model>Magento\Braintree\Model\Adminhtml\Source\CcType</source_model> <config_path>payment/braintree/cctypes</config_path> </field> - <field id="sort_order" translate="label" type="text" sortOrder="230" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="sort_order" translate="label" type="text" sortOrder="230" showInDefault="1" showInWebsite="1"> <label>Sort Order</label> <frontend_class>validate-number</frontend_class> <config_path>payment/braintree/sort_order</config_path> </field> </group> - <group id="braintree_country_specific" translate="label" showInDefault="1" showInWebsite="1" showInStore="0" sortOrder="30"> + <group id="braintree_country_specific" translate="label" showInDefault="1" showInWebsite="1" sortOrder="30"> <label>Country Specific Settings</label> <frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model> - <field id="allowspecific" translate="label" type="allowspecific" sortOrder="200" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="allowspecific" translate="label" type="allowspecific" sortOrder="200" showInDefault="1" showInWebsite="1"> <label>Payment from Applicable Countries</label> <source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model> <config_path>payment/braintree/allowspecific</config_path> </field> - <field id="specificcountry" translate="label" type="multiselect" sortOrder="210" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="specificcountry" translate="label" type="multiselect" sortOrder="210" showInDefault="1" showInWebsite="1"> <label>Payment from Specific Countries</label> <source_model>Magento\Braintree\Model\Adminhtml\System\Config\Country</source_model> <can_be_empty>1</can_be_empty> <config_path>payment/braintree/specificcountry</config_path> </field> - <field id="countrycreditcard" translate="label" sortOrder="220" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="countrycreditcard" translate="label" sortOrder="220" showInDefault="1" showInWebsite="1"> <label>Country Specific Credit Card Types</label> <frontend_model>Magento\Braintree\Block\Adminhtml\Form\Field\CountryCreditCard</frontend_model> <backend_model>Magento\Braintree\Model\Adminhtml\System\Config\CountryCreditCard</backend_model> @@ -146,7 +146,7 @@ <config_path>payment/braintree_paypal/title</config_path> <comment>It is recommended to set this value to "PayPal" per store views.</comment> </field> - <field id="braintree_paypal_vault_active" translate="label" type="select" sortOrder="21" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="braintree_paypal_vault_active" translate="label" type="select" sortOrder="21" showInDefault="1" showInWebsite="1"> <label>Vault Enabled</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <config_path>payment/braintree_paypal_vault/active</config_path> @@ -154,7 +154,7 @@ <group id="braintree_required"/> </requires> </field> - <field id="sort_order" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="sort_order" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1"> <label>Sort Order</label> <frontend_class>validate-number</frontend_class> <config_path>payment/braintree_paypal/sort_order</config_path> @@ -163,68 +163,68 @@ <label>Override Merchant Name</label> <config_path>payment/braintree_paypal/merchant_name_override</config_path> </field> - <field id="payment_action" translate="label" type="select" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="payment_action" translate="label" type="select" sortOrder="50" showInDefault="1" showInWebsite="1"> <label>Payment Action</label> <source_model>Magento\Braintree\Model\Adminhtml\Source\PaymentAction</source_model> <config_path>payment/braintree_paypal/payment_action</config_path> </field> - <field id="allowspecific" translate="label" type="allowspecific" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="allowspecific" translate="label" type="allowspecific" sortOrder="70" showInDefault="1" showInWebsite="1"> <label>Payment from Applicable Countries</label> <source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model> <config_path>payment/braintree_paypal/allowspecific</config_path> </field> - <field id="specificcountry" translate="label" type="multiselect" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="specificcountry" translate="label" type="multiselect" sortOrder="80" showInDefault="1" showInWebsite="1"> <label>Payment from Specific Countries</label> <source_model>Magento\Braintree\Model\Adminhtml\System\Config\Country</source_model> <can_be_empty>1</can_be_empty> <config_path>payment/braintree_paypal/specificcountry</config_path> </field> - <field id="require_billing_address" translate="label comment" type="select" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="require_billing_address" translate="label comment" type="select" sortOrder="90" showInDefault="1" showInWebsite="1"> <label>Require Customer's Billing Address</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <config_path>payment/braintree_paypal/require_billing_address</config_path> <comment>This feature needs be enabled first for the merchant account through PayPal technical support.</comment> </field> - <field id="allow_shipping_address_override" translate="label" type="select" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="allow_shipping_address_override" translate="label" type="select" sortOrder="100" showInDefault="1" showInWebsite="1"> <label>Allow to Edit Shipping Address Entered During Checkout on PayPal Side</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <config_path>payment/braintree_paypal/allow_shipping_address_override</config_path> </field> - <field id="debug" translate="label" type="select" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="debug" translate="label" type="select" sortOrder="110" showInDefault="1" showInWebsite="1"> <label>Debug</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <config_path>payment/braintree_paypal/debug</config_path> </field> - <field id="display_on_shopping_cart" translate="label comment" type="select" sortOrder="120" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="display_on_shopping_cart" translate="label comment" type="select" sortOrder="120" showInDefault="1" showInWebsite="1"> <label>Display on Shopping Cart</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <config_path>payment/braintree_paypal/display_on_shopping_cart</config_path> <comment>Also affects mini-shopping cart.</comment> </field> - <field id="skip_order_review" translate="label" type="select" sortOrder="120" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="skip_order_review" translate="label" type="select" sortOrder="120" showInDefault="1" showInWebsite="1"> <label>Skip Order Review</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <config_path>payment/braintree_paypal/skip_order_review</config_path> </field> </group> - <group id="braintree_3dsecure" translate="label" showInDefault="1" showInWebsite="1" showInStore="0" sortOrder="41"> + <group id="braintree_3dsecure" translate="label" showInDefault="1" showInWebsite="1" sortOrder="41"> <label>3D Secure Verification Settings</label> <frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model> - <field id="verify_3dsecure" translate="label" type="select" sortOrder="150" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="verify_3dsecure" translate="label" type="select" sortOrder="150" showInDefault="1" showInWebsite="1"> <label>3D Secure Verification</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <config_path>payment/braintree/verify_3dsecure</config_path> </field> - <field id="threshold_amount" translate="label" type="text" sortOrder="151" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="threshold_amount" translate="label" type="text" sortOrder="151" showInDefault="1" showInWebsite="1"> <label>Threshold Amount</label> <config_path>payment/braintree/threshold_amount</config_path> </field> - <field id="allowspecific" translate="label" type="allowspecific" sortOrder="152" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="allowspecific" translate="label" type="allowspecific" sortOrder="152" showInDefault="1" showInWebsite="1"> <label>Verify for Applicable Countries</label> <source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model> <config_path>payment/braintree/verify_all_countries</config_path> </field> - <field id="specificcountry" translate="label" type="multiselect" sortOrder="153" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="specificcountry" translate="label" type="multiselect" sortOrder="153" showInDefault="1" showInWebsite="1"> <label>Verify for Specific Countries</label> <source_model>Magento\Braintree\Model\Adminhtml\System\Config\Country</source_model> <can_be_empty>1</can_be_empty> diff --git a/app/code/Magento/Captcha/etc/adminhtml/system.xml b/app/code/Magento/Captcha/etc/adminhtml/system.xml index a05430989418d..ac4197c976ea0 100644 --- a/app/code/Magento/Captcha/etc/adminhtml/system.xml +++ b/app/code/Magento/Captcha/etc/adminhtml/system.xml @@ -8,34 +8,34 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> <section id="admin"> - <group id="captcha" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0"> + <group id="captcha" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1"> <label>CAPTCHA</label> - <field id="enable" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="enable" translate="label" type="select" sortOrder="1" showInDefault="1" canRestore="1"> <label>Enable CAPTCHA in Admin</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="font" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="font" translate="label" type="select" sortOrder="2" showInDefault="1" canRestore="1"> <label>Font</label> <source_model>Magento\Captcha\Model\Config\Font</source_model> <depends> <field id="enable">1</field> </depends> </field> - <field id="forms" translate="label" type="multiselect" sortOrder="3" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="forms" translate="label" type="multiselect" sortOrder="3" showInDefault="1" canRestore="1"> <label>Forms</label> <source_model>Magento\Captcha\Model\Config\Form\Backend</source_model> <depends> <field id="enable">1</field> </depends> </field> - <field id="mode" translate="label" type="select" sortOrder="4" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="mode" translate="label" type="select" sortOrder="4" showInDefault="1" canRestore="1"> <label>Displaying Mode</label> <source_model>Magento\Captcha\Model\Config\Mode</source_model> <depends> <field id="enable">1</field> </depends> </field> - <field id="failed_attempts_login" translate="label comment" type="text" sortOrder="5" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="failed_attempts_login" translate="label comment" type="text" sortOrder="5" showInDefault="1" canRestore="1"> <label>Number of Unsuccessful Attempts to Login</label> <comment>If 0 is specified, CAPTCHA on the Login form will be always available.</comment> <depends> @@ -44,14 +44,14 @@ </depends> <frontend_class>required-entry validate-digits</frontend_class> </field> - <field id="timeout" translate="label" type="text" sortOrder="6" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="timeout" translate="label" type="text" sortOrder="6" showInDefault="1" canRestore="1"> <label>CAPTCHA Timeout (minutes)</label> <depends> <field id="enable">1</field> </depends> <frontend_class>required-entry validate-digits</frontend_class> </field> - <field id="length" translate="label comment" type="text" sortOrder="7" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="length" translate="label comment" type="text" sortOrder="7" showInDefault="1" canRestore="1"> <label>Number of Symbols</label> <comment>Please specify 8 symbols at the most. Range allowed (e.g. 3-5)</comment> <depends> @@ -59,7 +59,7 @@ </depends> <frontend_class>required-entry</frontend_class> </field> - <field id="symbols" translate="label comment" type="text" sortOrder="8" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="symbols" translate="label comment" type="text" sortOrder="8" showInDefault="1" canRestore="1"> <label>Symbols Used in CAPTCHA</label> <comment> <![CDATA[Please use only letters (a-z or A-Z) or numbers (0-9) in this field. No spaces or other characters are allowed.<br />Similar looking characters (e.g. "i", "l", "1") decrease chance of correct recognition by customer.]]> @@ -69,7 +69,7 @@ </depends> <frontend_class>required-entry validate-alphanum</frontend_class> </field> - <field id="case_sensitive" translate="label" type="select" sortOrder="9" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="case_sensitive" translate="label" type="select" sortOrder="9" showInDefault="1" canRestore="1"> <label>Case Sensitive</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <depends> @@ -79,20 +79,20 @@ </group> </section> <section id="customer"> - <group id="captcha" translate="label" type="text" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="0"> + <group id="captcha" translate="label" type="text" sortOrder="110" showInDefault="1" showInWebsite="1"> <label>CAPTCHA</label> - <field id="enable" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="enable" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Enable CAPTCHA on Storefront</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="font" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="font" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Font</label> <source_model>Magento\Captcha\Model\Config\Font</source_model> <depends> <field id="enable">1</field> </depends> </field> - <field id="forms" translate="label comment" type="multiselect" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="forms" translate="label comment" type="multiselect" sortOrder="3" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Forms</label> <source_model>Magento\Captcha\Model\Config\Form\Frontend</source_model> <comment>CAPTCHA for "Create user" and "Forgot password" forms is always enabled if chosen.</comment> @@ -100,14 +100,14 @@ <field id="enable">1</field> </depends> </field> - <field id="mode" translate="label" type="select" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="mode" translate="label" type="select" sortOrder="4" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Displaying Mode</label> <source_model>Magento\Captcha\Model\Config\Mode</source_model> <depends> <field id="enable">1</field> </depends> </field> - <field id="failed_attempts_login" translate="label comment" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="failed_attempts_login" translate="label comment" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Number of Unsuccessful Attempts to Login</label> <comment>If 0 is specified, CAPTCHA on the Login form will be always available.</comment> <depends> @@ -116,14 +116,14 @@ </depends> <frontend_class>required-entry validate-digits</frontend_class> </field> - <field id="timeout" translate="label" type="text" sortOrder="6" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="timeout" translate="label" type="text" sortOrder="6" showInDefault="1" showInWebsite="1" canRestore="1"> <label>CAPTCHA Timeout (minutes)</label> <depends> <field id="enable">1</field> </depends> <frontend_class>required-entry validate-digits</frontend_class> </field> - <field id="length" translate="label comment" type="text" sortOrder="7" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="length" translate="label comment" type="text" sortOrder="7" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Number of Symbols</label> <comment>Please specify 8 symbols at the most. Range allowed (e.g. 3-5)</comment> <depends> @@ -131,7 +131,7 @@ </depends> <frontend_class>required-entry validate-range range-1-8</frontend_class> </field> - <field id="symbols" translate="label comment" type="text" sortOrder="8" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="symbols" translate="label comment" type="text" sortOrder="8" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Symbols Used in CAPTCHA</label> <comment> <![CDATA[Please use only letters (a-z or A-Z) or numbers (0-9) in this field. No spaces or other characters are allowed.<br />Similar looking characters (e.g. "i", "l", "1") decrease chance of correct recognition by customer.]]> @@ -141,7 +141,7 @@ </depends> <frontend_class>required-entry validate-alphanum</frontend_class> </field> - <field id="case_sensitive" translate="label" type="select" sortOrder="9" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="case_sensitive" translate="label" type="select" sortOrder="9" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Case Sensitive</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <depends> diff --git a/app/code/Magento/CardinalCommerce/etc/adminhtml/system.xml b/app/code/Magento/CardinalCommerce/etc/adminhtml/system.xml index 046475baba676..6312696ba97e0 100644 --- a/app/code/Magento/CardinalCommerce/etc/adminhtml/system.xml +++ b/app/code/Magento/CardinalCommerce/etc/adminhtml/system.xml @@ -11,11 +11,11 @@ <label>3D Secure</label> <tab>sales</tab> <resource>Magento_Sales::three_d_secure</resource> - <group id="cardinal" type="text" sortOrder="13" showInDefault="1" showInWebsite="1" showInStore="0"> - <group id="config" translate="label comment" sortOrder="15" showInDefault="1" showInWebsite="1" showInStore="0"> + <group id="cardinal" type="text" sortOrder="13" showInDefault="1" showInWebsite="1"> + <group id="config" translate="label comment" sortOrder="15" showInDefault="1" showInWebsite="1"> <label>CardinalCommerce</label> <comment><![CDATA[Please visit <a href="https://www.cardinalcommerce.com/" target="_blank">www.cardinalcommerce.com</a> to get the CardinalCommerce credentials and find out more details about PSD2 SCA requirements. For support contact <a href="mailto:support@cardinalcommerce.com">support@cardinalcommerce.com</a>.]]></comment> - <field id="environment" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="environment" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1"> <label>Environment</label> <source_model>Magento\CardinalCommerce\Model\Adminhtml\Source\Environment</source_model> <config_path>three_d_secure/cardinal/environment</config_path> @@ -23,7 +23,7 @@ <field id="enabled_authorize">1</field> </depends> </field> - <field id="org_unit_id" translate="label" type="obscure" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="org_unit_id" translate="label" type="obscure" sortOrder="30" showInDefault="1" showInWebsite="1"> <label>Org Unit Id</label> <config_path>three_d_secure/cardinal/org_unit_id</config_path> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> @@ -31,7 +31,7 @@ <field id="enabled_authorize">1</field> </depends> </field> - <field id="api_key" translate="label" type="obscure" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="api_key" translate="label" type="obscure" sortOrder="40" showInDefault="1" showInWebsite="1"> <label>API Key</label> <config_path>three_d_secure/cardinal/api_key</config_path> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> @@ -39,7 +39,7 @@ <field id="enabled_authorize">1</field> </depends> </field> - <field id="api_identifier" translate="label" type="obscure" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="api_identifier" translate="label" type="obscure" sortOrder="50" showInDefault="1" showInWebsite="1"> <label>API Identifier</label> <config_path>three_d_secure/cardinal/api_identifier</config_path> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> @@ -47,7 +47,7 @@ <field id="enabled_authorize">1</field> </depends> </field> - <field id="debug" translate="label" type="select" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="debug" translate="label" type="select" sortOrder="60" showInDefault="1" showInWebsite="1"> <label>Debug</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <config_path>three_d_secure/cardinal/debug</config_path> diff --git a/app/code/Magento/Catalog/etc/adminhtml/system.xml b/app/code/Magento/Catalog/etc/adminhtml/system.xml index a1e49700d4083..80b323cfdb250 100644 --- a/app/code/Magento/Catalog/etc/adminhtml/system.xml +++ b/app/code/Magento/Catalog/etc/adminhtml/system.xml @@ -20,30 +20,30 @@ <resource>Magento_Catalog::config_catalog</resource> <group id="fields_masks" translate="label" type="text" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Product Fields Auto-Generation</label> - <field id="sku" translate="label comment" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="sku" translate="label comment" type="text" sortOrder="10" showInDefault="1" canRestore="1"> <label>Mask for SKU</label> <comment>Use {{name}} as Product Name placeholder</comment> </field> - <field id="meta_title" translate="label comment" type="text" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="meta_title" translate="label comment" type="text" sortOrder="20" showInDefault="1" canRestore="1"> <label>Mask for Meta Title</label> <comment>Use {{name}} as Product Name placeholder</comment> </field> - <field id="meta_keyword" translate="label comment" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="meta_keyword" translate="label comment" type="text" sortOrder="30" showInDefault="1" canRestore="1"> <label>Mask for Meta Keywords</label> <comment>Use {{name}} as Product Name or {{sku}} as Product SKU placeholders</comment> </field> - <field id="meta_description" translate="label comment" type="text" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="meta_description" translate="label comment" type="text" sortOrder="40" showInDefault="1" canRestore="1"> <label>Mask for Meta Description</label> <comment>Use {{name}} and {{description}} as Product Name and Product Description placeholders</comment> </field> </group> - <group id="recently_products" translate="label" type="text" sortOrder="350" showInDefault="1" showInWebsite="1" showInStore="0"> + <group id="recently_products" translate="label" type="text" sortOrder="350" showInDefault="1" showInWebsite="1"> <label>Recently Viewed/Compared Products</label> - <field id="recently_viewed_lifetime" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="recently_viewed_lifetime" translate="label" type="text" sortOrder="40" showInDefault="1" canRestore="1"> <label>Lifetime of products in Recently Viewed Widget</label> <validate>validate-number validate-zero-or-greater</validate> </field> - <field id="recently_compared_lifetime" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="recently_compared_lifetime" translate="label" type="text" sortOrder="40" showInDefault="1" canRestore="1"> <label>Lifetime of products in Recently Compared Widget</label> <validate>validate-number validate-zero-or-greater</validate> </field> @@ -78,12 +78,12 @@ <comment>Must be in the allowed values list.</comment> <validate>validate-per-page-value</validate> </field> - <field id="flat_catalog_category" translate="label" type="select" sortOrder="100" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="flat_catalog_category" translate="label" type="select" sortOrder="100" showInDefault="1" canRestore="1"> <label>Use Flat Catalog Category</label> <backend_model>Magento\Catalog\Model\Indexer\Category\Flat\System\Config\Mode</backend_model> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="flat_catalog_product" translate="label" type="select" sortOrder="100" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="flat_catalog_product" translate="label" type="select" sortOrder="100" showInDefault="1" canRestore="1"> <label>Use Flat Catalog Product</label> <backend_model>Magento\Catalog\Model\Indexer\Product\Flat\System\Config\Mode</backend_model> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> @@ -93,12 +93,12 @@ <comment>Applies to category pages.</comment> <source_model>Magento\Catalog\Model\Config\Source\ListSort</source_model> </field> - <field id="list_allow_all" translate="label comment" type="select" sortOrder="6" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="list_allow_all" translate="label comment" type="select" sortOrder="6" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Allow All Products per Page</label> <comment>Whether to show "All" option in the "Show X Per Page" dropdown.</comment> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="remember_pagination" translate="label comment" type="select" sortOrder="7" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="remember_pagination" translate="label comment" type="select" sortOrder="7" showInDefault="1" canRestore="1"> <label>Remember Category Pagination</label> <comment>Changing may affect SEO and cache storage consumption.</comment> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> @@ -128,9 +128,9 @@ <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> </group> - <group id="price" translate="label" type="text" sortOrder="400" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="price" translate="label" type="text" sortOrder="400" showInDefault="1"> <label>Price</label> - <field id="scope" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="scope" translate="label comment" type="select" sortOrder="1" showInDefault="1"> <label>Catalog Price Scope</label> <comment><![CDATA[This defines the base currency scope ("Currency Setup" > "Currency Options" > "Base Currency").]]></comment> <backend_model>Magento\Catalog\Model\Indexer\Product\Price\System\Config\PriceScope</backend_model> @@ -169,7 +169,7 @@ </section> <section id="cms"> <group id="wysiwyg"> - <field id="use_static_urls_in_catalog" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="use_static_urls_in_catalog" translate="label comment" type="select" sortOrder="10" showInDefault="1"> <label>Use Static URLs for Media Content in WYSIWYG</label> <comment>Media content will be inserted into the editor as a static URL. Media content is not updated if the system configuration base URL changes.</comment> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> @@ -216,7 +216,7 @@ <resource>Magento_Config::config_system</resource> <group id="upload_configuration" translate="label" type="text" sortOrder="1000" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Images Upload Configuration</label> - <field id="jpeg_quality" translate="label comment" type="text" sortOrder="100" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="jpeg_quality" translate="label comment" type="text" sortOrder="100" showInDefault="1" canRestore="1"> <label>Quality</label> <validate>validate-digits validate-digits-range digits-range-1-100 required-entry</validate> <comment>Jpeg quality for resized images 1-100%.</comment> diff --git a/app/code/Magento/Catalog/etc/config.xml b/app/code/Magento/Catalog/etc/config.xml index 8506d2ae03032..59fc4b6d947d9 100644 --- a/app/code/Magento/Catalog/etc/config.xml +++ b/app/code/Magento/Catalog/etc/config.xml @@ -28,7 +28,9 @@ <grid_per_page>12</grid_per_page> <list_per_page>10</list_per_page> <flat_catalog_category>0</flat_catalog_category> + <flat_catalog_product>0</flat_catalog_product> <default_sort_by>position</default_sort_by> + <list_allow_all>0</list_allow_all> <parse_url_directives>1</parse_url_directives> <remember_pagination>0</remember_pagination> </frontend> diff --git a/app/code/Magento/CatalogInventory/etc/adminhtml/system.xml b/app/code/Magento/CatalogInventory/etc/adminhtml/system.xml index 546f838b9b428..a5a8476b20a02 100644 --- a/app/code/Magento/CatalogInventory/etc/adminhtml/system.xml +++ b/app/code/Magento/CatalogInventory/etc/adminhtml/system.xml @@ -13,21 +13,21 @@ <resource>Magento_CatalogInventory::cataloginventory</resource> <group id="options" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Stock Options</label> - <field id="can_subtract" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="can_subtract" translate="label" type="select" sortOrder="2" showInDefault="1" canRestore="1"> <label>Decrease Stock When Order is Placed</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="can_back_in_stock" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="can_back_in_stock" translate="label" type="select" sortOrder="2" showInDefault="1" canRestore="1"> <label>Set Items' Status to be In Stock When Order is Cancelled</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="show_out_of_stock" translate="label comment" type="select" sortOrder="3" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="show_out_of_stock" translate="label comment" type="select" sortOrder="3" showInDefault="1" canRestore="1"> <label>Display Out of Stock Products</label> <comment>Products will still be shown by direct product URLs.</comment> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <backend_model>Magento\CatalogInventory\Model\Config\Backend\ShowOutOfStock</backend_model> </field> - <field id="stock_threshold_qty" translate="label" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="stock_threshold_qty" translate="label" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Only X left Threshold</label> <validate>validate-number</validate> </field> @@ -41,45 +41,45 @@ <![CDATA[Please note that these settings apply to individual items in the cart, not to the entire cart.]]> </comment> <label>Product Stock Options</label> - <field id="manage_stock" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="manage_stock" translate="label comment" type="select" sortOrder="1" showInDefault="1" canRestore="1"> <label>Manage Stock</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <backend_model>Magento\CatalogInventory\Model\Config\Backend\Managestock</backend_model> <comment>Changing can take some time due to processing whole catalog.</comment> </field> - <field id="backorders" translate="label comment" type="select" sortOrder="3" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="backorders" translate="label comment" type="select" sortOrder="3" showInDefault="1" canRestore="1"> <label>Backorders</label> <source_model>Magento\CatalogInventory\Model\Source\Backorders</source_model> <backend_model>Magento\CatalogInventory\Model\Config\Backend\Backorders</backend_model> <comment>Changing can take some time due to processing whole catalog.</comment> </field> - <field id="max_sale_qty" translate="label" type="text" sortOrder="4" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="max_sale_qty" translate="label" type="text" sortOrder="4" showInDefault="1" canRestore="1"> <label>Maximum Qty Allowed in Shopping Cart</label> <validate>validate-number validate-greater-than-zero</validate> </field> - <field id="min_qty" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="min_qty" translate="label" type="text" sortOrder="5" showInDefault="1" canRestore="1"> <label>Out-of-Stock Threshold</label> <validate>validate-number</validate> <backend_model>Magento\CatalogInventory\Model\System\Config\Backend\Minqty</backend_model> </field> - <field id="min_sale_qty" translate="label" sortOrder="6" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="min_sale_qty" translate="label" sortOrder="6" showInDefault="1" canRestore="1"> <label>Minimum Qty Allowed in Shopping Cart</label> <frontend_model>Magento\CatalogInventory\Block\Adminhtml\Form\Field\Minsaleqty</frontend_model> <backend_model>Magento\CatalogInventory\Model\System\Config\Backend\Minsaleqty</backend_model> </field> - <field id="notify_stock_qty" translate="label" type="text" sortOrder="7" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="notify_stock_qty" translate="label" type="text" sortOrder="7" showInDefault="1" canRestore="1"> <label>Notify for Quantity Below</label> <validate>validate-number</validate> </field> - <field id="auto_return" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="auto_return" translate="label" type="select" sortOrder="10" showInDefault="1" canRestore="1"> <label>Automatically Return Credit Memo Item to Stock</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="enable_qty_increments" translate="label" type="select" sortOrder="8" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="enable_qty_increments" translate="label" type="select" sortOrder="8" showInDefault="1" canRestore="1"> <label>Enable Qty Increments</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="qty_increments" translate="label" type="text" sortOrder="9" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="qty_increments" translate="label" type="text" sortOrder="9" showInDefault="1" canRestore="1"> <label>Qty Increments</label> <validate>validate-number validate-greater-than-zero</validate> <backend_model>Magento\CatalogInventory\Model\System\Config\Backend\Qtyincrements</backend_model> diff --git a/app/code/Magento/CatalogInventory/etc/config.xml b/app/code/Magento/CatalogInventory/etc/config.xml index 976b3f4cad510..21641b3a4cfcd 100644 --- a/app/code/Magento/CatalogInventory/etc/config.xml +++ b/app/code/Magento/CatalogInventory/etc/config.xml @@ -22,6 +22,7 @@ <min_sale_qty>1</min_sale_qty> <min_qty>0</min_qty> <notify_stock_qty>1</notify_stock_qty> + <auto_return>0</auto_return> <enable_qty_increments>0</enable_qty_increments> <qty_increments>1</qty_increments> </item_options> diff --git a/app/code/Magento/CatalogSearch/etc/adminhtml/system.xml b/app/code/Magento/CatalogSearch/etc/adminhtml/system.xml index c358062b88a41..e875a48aa29dc 100644 --- a/app/code/Magento/CatalogSearch/etc/adminhtml/system.xml +++ b/app/code/Magento/CatalogSearch/etc/adminhtml/system.xml @@ -38,7 +38,7 @@ <label>Autocomplete Limit</label> <validate>validate-digits</validate> </field> - <field id="enable_eav_indexer" translate="label" type="select" sortOrder="18" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="enable_eav_indexer" translate="label" type="select" sortOrder="18" showInDefault="1" canRestore="1"> <label>Enable EAV Indexer</label> <comment>Enable/Disable Product EAV indexer to improve indexation speed. Make sure that indexer is not used by 3rd party extensions.</comment> <depends> diff --git a/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/system.xml b/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/system.xml index ad0ff68192af4..75d395473f969 100644 --- a/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/system.xml +++ b/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/system.xml @@ -28,7 +28,7 @@ <label>Create Permanent Redirect for URLs if URL Key Changed</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="generate_category_product_rewrites" translate="label comment" type="select" sortOrder="6" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="generate_category_product_rewrites" translate="label comment" type="select" sortOrder="6" showInDefault="1" canRestore="1"> <label>Generate "category/product" URL Rewrites</label> <backend_model>Magento\CatalogUrlRewrite\Model\TableCleaner</backend_model> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> diff --git a/app/code/Magento/Checkout/etc/adminhtml/system.xml b/app/code/Magento/Checkout/etc/adminhtml/system.xml index 399474a36bfc7..7454c2b6524f3 100644 --- a/app/code/Magento/Checkout/etc/adminhtml/system.xml +++ b/app/code/Magento/Checkout/etc/adminhtml/system.xml @@ -21,7 +21,7 @@ <label>Allow Guest Checkout</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="display_billing_address_on" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="display_billing_address_on" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Display Billing Address On</label> <source_model>\Magento\Checkout\Model\Adminhtml\BillingAddressDisplayOptions</source_model> </field> @@ -32,7 +32,7 @@ </group> <group id="cart" translate="label" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Shopping Cart</label> - <field id="delete_quote_after" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="delete_quote_after" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Quote Lifetime (days)</label> <validate>validate-zero-or-greater validate-digits</validate> </field> @@ -49,9 +49,9 @@ <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> </group> - <group id="cart_link" translate="label" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="0"> + <group id="cart_link" translate="label" sortOrder="3" showInDefault="1" showInWebsite="1"> <label>My Cart Link</label> - <field id="use_qty" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="use_qty" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Display Cart Summary</label> <source_model>Magento\Checkout\Model\Config\Source\Cart\Summary</source_model> </field> diff --git a/app/code/Magento/Checkout/etc/config.xml b/app/code/Magento/Checkout/etc/config.xml index f8c2e7ebcb503..c8408f6d902fa 100644 --- a/app/code/Magento/Checkout/etc/config.xml +++ b/app/code/Magento/Checkout/etc/config.xml @@ -11,6 +11,7 @@ <options> <onepage_checkout_enabled>1</onepage_checkout_enabled> <guest_checkout>1</guest_checkout> + <display_billing_address_on>0</display_billing_address_on> <max_items_display_count>10</max_items_display_count> </options> <cart> diff --git a/app/code/Magento/CheckoutAgreements/etc/adminhtml/system.xml b/app/code/Magento/CheckoutAgreements/etc/adminhtml/system.xml index 64ffb2b5dc21a..496f3fec70e5e 100644 --- a/app/code/Magento/CheckoutAgreements/etc/adminhtml/system.xml +++ b/app/code/Magento/CheckoutAgreements/etc/adminhtml/system.xml @@ -9,7 +9,7 @@ <system> <section id="checkout"> <group id="options"> - <field id="enable_agreements" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="enable_agreements" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Enable Terms and Conditions</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> diff --git a/app/code/Magento/CheckoutAgreements/etc/config.xml b/app/code/Magento/CheckoutAgreements/etc/config.xml new file mode 100644 index 0000000000000..e2932af0c25cb --- /dev/null +++ b/app/code/Magento/CheckoutAgreements/etc/config.xml @@ -0,0 +1,16 @@ +<?xml version="1.0"?> +<!-- +/** + * 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:module:Magento_Store:etc/config.xsd"> + <default> + <checkout> + <options> + <enable_agreements>0</enable_agreements> + </options> + </checkout> + </default> +</config> diff --git a/app/code/Magento/Cms/etc/adminhtml/system.xml b/app/code/Magento/Cms/etc/adminhtml/system.xml index e38efb89b74f8..785d0e3710f4f 100644 --- a/app/code/Magento/Cms/etc/adminhtml/system.xml +++ b/app/code/Magento/Cms/etc/adminhtml/system.xml @@ -58,7 +58,7 @@ <label>Enable WYSIWYG Editor</label> <source_model>Magento\Cms\Model\Config\Source\Wysiwyg\Enabled</source_model> </field> - <field id="editor" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="editor" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" canRestore="1"> <label>WYSIWYG Editor</label> <source_model>Magento\Cms\Model\Config\Source\Wysiwyg\Editor</source_model> <depends> diff --git a/app/code/Magento/Contact/etc/adminhtml/system.xml b/app/code/Magento/Contact/etc/adminhtml/system.xml index b5974e4d42e84..c1437c7778b79 100644 --- a/app/code/Magento/Contact/etc/adminhtml/system.xml +++ b/app/code/Magento/Contact/etc/adminhtml/system.xml @@ -24,15 +24,24 @@ <field id="recipient_email" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Send Emails To</label> <validate>validate-email</validate> + <depends> + <field id="*/contact/enabled">1</field> + </depends> </field> <field id="sender_email_identity" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> + <depends> + <field id="*/contact/enabled">1</field> + </depends> </field> <field id="email_template" translate="label comment" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Email Template</label> <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> + <depends> + <field id="*/contact/enabled">1</field> + </depends> </field> </group> </section> diff --git a/app/code/Magento/Cookie/etc/adminhtml/system.xml b/app/code/Magento/Cookie/etc/adminhtml/system.xml index 9790410969055..d1dcbf45ae5be 100644 --- a/app/code/Magento/Cookie/etc/adminhtml/system.xml +++ b/app/code/Magento/Cookie/etc/adminhtml/system.xml @@ -29,7 +29,7 @@ </comment> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="cookie_restriction" translate="label" type="select" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="cookie_restriction" translate="label" type="select" sortOrder="50" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Cookie Restriction Mode</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <backend_model>Magento\Cookie\Model\Config\Backend\Cookie</backend_model> diff --git a/app/code/Magento/Cron/etc/adminhtml/system.xml b/app/code/Magento/Cron/etc/adminhtml/system.xml index cef45ba386be2..2bd6611e57473 100644 --- a/app/code/Magento/Cron/etc/adminhtml/system.xml +++ b/app/code/Magento/Cron/etc/adminhtml/system.xml @@ -8,36 +8,36 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> <section id="system"> - <group id="cron" translate="label comment" type="text" sortOrder="15" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="cron" translate="label comment" type="text" sortOrder="15" showInDefault="1"> <label>Cron (Scheduled Tasks)</label> <comment>For correct URLs generated during cron runs please make sure that Web > Secure and Unsecure Base URLs are explicitly set. All the times are in minutes.</comment> - <group id="template" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="template" translate="label" type="text" sortOrder="10" showInDefault="1"> <label>Cron configuration options for group:</label> - <field id="schedule_generate_every" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="schedule_generate_every" translate="label" type="text" sortOrder="10" showInDefault="1" canRestore="1"> <label>Generate Schedules Every</label> <validate>validate-zero-or-greater validate-digits</validate> </field> - <field id="schedule_ahead_for" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="schedule_ahead_for" translate="label" type="text" sortOrder="20" showInDefault="1" canRestore="1"> <label>Schedule Ahead for</label> <validate>validate-zero-or-greater validate-digits</validate> </field> - <field id="schedule_lifetime" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="schedule_lifetime" translate="label" type="text" sortOrder="30" showInDefault="1" canRestore="1"> <label>Missed if Not Run Within</label> <validate>validate-zero-or-greater validate-digits</validate> </field> - <field id="history_cleanup_every" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="history_cleanup_every" translate="label" type="text" sortOrder="40" showInDefault="1" canRestore="1"> <label>History Cleanup Every</label> <validate>validate-zero-or-greater validate-digits</validate> </field> - <field id="history_success_lifetime" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="history_success_lifetime" translate="label" type="text" sortOrder="50" showInDefault="1" canRestore="1"> <label>Success History Lifetime</label> <validate>validate-zero-or-greater validate-digits</validate> </field> - <field id="history_failure_lifetime" translate="label" type="text" sortOrder="60" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="history_failure_lifetime" translate="label" type="text" sortOrder="60" showInDefault="1" canRestore="1"> <label>Failure History Lifetime</label> <validate>validate-zero-or-greater validate-digits</validate> </field> - <field id="use_separate_process" translate="label" type="select" sortOrder="70" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="use_separate_process" translate="label" type="select" sortOrder="70" showInDefault="1" canRestore="1"> <label>Use Separate Process</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> diff --git a/app/code/Magento/Customer/etc/adminhtml/system.xml b/app/code/Magento/Customer/etc/adminhtml/system.xml index 2bd1041214801..fca625d847a1d 100644 --- a/app/code/Magento/Customer/etc/adminhtml/system.xml +++ b/app/code/Magento/Customer/etc/adminhtml/system.xml @@ -15,10 +15,10 @@ <label>Customer Configuration</label> <tab>customer</tab> <resource>Magento_Customer::config_customer</resource> - <group id="account_share" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="account_share" translate="label" type="text" sortOrder="10" showInDefault="1"> <label>Account Sharing Options</label> <hide_in_single_store_mode>1</hide_in_single_store_mode> - <field id="scope" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="scope" translate="label" type="select" sortOrder="1" showInDefault="1" canRestore="1"> <label>Share Customer Accounts</label> <backend_model>Magento\Customer\Model\Config\Share</backend_model> <source_model>Magento\Customer\Model\Config\Share</source_model> @@ -26,7 +26,7 @@ </group> <group id="create_account" translate="label" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Create New Account Options</label> - <field id="auto_group_assign" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="auto_group_assign" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Enable Automatic Assignment to Customer Group</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> @@ -76,12 +76,12 @@ <field id="auto_group_assign">1</field> </depends> </field> - <field id="viv_disable_auto_group_assign_default" translate="label" type="select" sortOrder="57" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="viv_disable_auto_group_assign_default" translate="label" type="select" sortOrder="57" showInDefault="1" canRestore="1"> <label>Default Value for Disable Automatic Group Changes Based on VAT ID</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <backend_model>Magento\Customer\Model\Config\Backend\CreateAccount\DisableAutoGroupAssignDefault</backend_model> </field> - <field id="vat_frontend_visibility" translate="label comment" type="select" sortOrder="58" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="vat_frontend_visibility" translate="label comment" type="select" sortOrder="58" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Show VAT Number on Storefront</label> <comment>To show VAT number on Storefront, set Show VAT Number on Storefront option to Yes.</comment> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> @@ -106,7 +106,7 @@ <label>Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> </field> - <field id="confirm" translate="label" type="select" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="confirm" translate="label" type="select" sortOrder="90" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Require Emails Confirmation</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> @@ -123,7 +123,7 @@ ]]></comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> - <field id="generate_human_friendly_id" translate="label" type="select" sortOrder="120" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="generate_human_friendly_id" translate="label" type="select" sortOrder="120" showInDefault="1" canRestore="1"> <label>Generate Human-Friendly Customer ID</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> @@ -149,33 +149,33 @@ <label>Password Template Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> </field> - <field id="reset_link_expiration_period" translate="label comment" type="text" sortOrder="60" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="reset_link_expiration_period" translate="label comment" type="text" sortOrder="60" showInDefault="1" canRestore="1"> <label>Recovery Link Expiration Period (hours)</label> <comment>Please enter a number 1 or greater in this field.</comment> <validate>required-entry validate-digits validate-digits-range digits-range-1-</validate> <backend_model>Magento\Customer\Model\Config\Backend\Password\Link\Expirationperiod</backend_model> </field> - <field id="required_character_classes_number" translate="label comment" type="text" sortOrder="70" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="required_character_classes_number" translate="label comment" type="text" sortOrder="70" showInDefault="1" canRestore="1"> <label>Number of Required Character Classes</label> <comment>Number of different character classes required in password: Lowercase, Uppercase, Digits, Special Characters.</comment> <validate>required-entry validate-digits validate-digits-range digits-range-1-4</validate> </field> - <field id="minimum_password_length" translate="label comment" type="text" sortOrder="80" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="minimum_password_length" translate="label comment" type="text" sortOrder="80" showInDefault="1" canRestore="1"> <label>Minimum Password Length</label> <comment>Please enter a number 1 or greater in this field.</comment> <validate>required-entry validate-digits validate-digits-range digits-range-1-</validate> </field> - <field id="lockout_failures" translate="label comment" sortOrder="70" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="lockout_failures" translate="label comment" sortOrder="70" showInDefault="1" canRestore="1"> <label>Maximum Login Failures to Lockout Account</label> <comment>Use 0 to disable account locking.</comment> <frontend_class>required-entry validate-digits</frontend_class> </field> - <field id="lockout_threshold" translate="label comment" sortOrder="80" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="lockout_threshold" translate="label comment" sortOrder="80" showInDefault="1" canRestore="1"> <label>Lockout Time (minutes)</label> <comment>Account will be unlocked after provided time.</comment> <frontend_class>required-entry validate-digits</frontend_class> </field> - <field id="autocomplete_on_storefront" type="select" translate="label" sortOrder="65" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="autocomplete_on_storefront" type="select" translate="label" sortOrder="65" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Enable Autocomplete on login/forgot password forms</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> @@ -195,68 +195,68 @@ </group> <group id="address" translate="label" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Name and Address Options</label> - <field id="street_lines" translate="label comment" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="street_lines" translate="label comment" sortOrder="10" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Number of Lines in a Street Address</label> <backend_model>Magento\Customer\Model\Config\Backend\Address\Street</backend_model> <comment>Valid range: 1-4</comment> <validate>required-entry validate-digits validate-digits-range digits-range-1-4</validate> </field> - <field id="prefix_show" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="prefix_show" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Show Prefix</label> <source_model>Magento\Config\Model\Config\Source\Nooptreq</source_model> <backend_model>Magento\Customer\Model\Config\Backend\Show\Address</backend_model> <comment>The title that goes before name (Mr., Mrs., etc.)</comment> </field> - <field id="prefix_options" translate="label comment" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="prefix_options" translate="label comment" sortOrder="30" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Prefix Dropdown Options</label> <comment> <![CDATA[Semicolon (;) separated values.<br/>Leave empty for open text field.]]> </comment> </field> - <field id="middlename_show" translate="label comment" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="middlename_show" translate="label comment" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Show Middle Name (initial)</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <comment>Always optional.</comment> <backend_model>Magento\Customer\Model\Config\Backend\Show\Address</backend_model> </field> - <field id="suffix_show" translate="label comment" type="select" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="suffix_show" translate="label comment" type="select" sortOrder="50" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Show Suffix</label> <source_model>Magento\Config\Model\Config\Source\Nooptreq</source_model> <comment>The suffix that goes after name (Jr., Sr., etc.)</comment> <backend_model>Magento\Customer\Model\Config\Backend\Show\Address</backend_model> </field> - <field id="suffix_options" translate="label comment" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="suffix_options" translate="label comment" sortOrder="60" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Suffix Dropdown Options</label> <comment> <![CDATA[Semicolon (;) separated values.<br/>Leave empty for open text field.]]> </comment> </field> - <field id="dob_show" translate="label" type="select" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="dob_show" translate="label" type="select" sortOrder="70" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Show Date of Birth</label> <source_model>Magento\Config\Model\Config\Source\Nooptreq</source_model> <backend_model>Magento\Customer\Model\Config\Backend\Show\Customer</backend_model> </field> - <field id="taxvat_show" translate="label" type="select" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="taxvat_show" translate="label" type="select" sortOrder="80" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Show Tax/VAT Number</label> <source_model>Magento\Config\Model\Config\Source\Nooptreq</source_model> <backend_model>Magento\Customer\Model\Config\Backend\Show\Customer</backend_model> </field> - <field id="gender_show" translate="label" type="select" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="gender_show" translate="label" type="select" sortOrder="90" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Show Gender</label> <source_model>Magento\Config\Model\Config\Source\Nooptreq</source_model> <backend_model>Magento\Customer\Model\Config\Backend\Show\Customer</backend_model> </field> - <field id="telephone_show" translate="label" type="select" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="telephone_show" translate="label" type="select" sortOrder="100" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Show Telephone</label> <source_model>Magento\Config\Model\Config\Source\Nooptreq</source_model> <backend_model>Magento\Customer\Model\Config\Backend\Show\AddressOnly</backend_model> </field> - <field id="company_show" translate="label" type="select" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="company_show" translate="label" type="select" sortOrder="110" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Show Company</label> <source_model>Magento\Config\Model\Config\Source\Nooptreq</source_model> <backend_model>Magento\Customer\Model\Config\Backend\Show\AddressOnly</backend_model> </field> - <field id="fax_show" translate="label" type="select" sortOrder="120" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="fax_show" translate="label" type="select" sortOrder="120" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Show Fax</label> <source_model>Magento\Config\Model\Config\Source\Nooptreq</source_model> <backend_model>Magento\Customer\Model\Config\Backend\Show\AddressOnly</backend_model> @@ -264,7 +264,7 @@ </group> <group id="startup" translate="label" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Login Options</label> - <field id="redirect_dashboard" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="redirect_dashboard" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Redirect Customer to Account Dashboard after Logging in</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <comment>Customer will stay on the current page if "No" is selected.</comment> @@ -286,14 +286,14 @@ <label>PDF</label> </field> </group> - <group id="online_customers" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="online_customers" translate="label" type="text" sortOrder="10" showInDefault="1"> <label>Online Customers Options</label> - <field id="online_minutes_interval" translate="label comment" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="online_minutes_interval" translate="label comment" type="text" sortOrder="1" showInDefault="1"> <label>Online Minutes Interval</label> <validate>validate-number validate-greater-than-zero</validate> <comment>Leave empty for default (15 minutes).</comment> </field> - <field id="section_data_lifetime" translate="label comment" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="section_data_lifetime" translate="label comment" type="text" sortOrder="1" showInDefault="1"> <label>Customer Data Lifetime</label> <validate>validate-number validate-greater-than-zero</validate> <comment>Please specify value in minutes.</comment> @@ -302,7 +302,7 @@ </section> <section id="general"> <group id="store_information"> - <field id="validate_vat_number" translate="button_label" sortOrder="62" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="validate_vat_number" translate="button_label" sortOrder="62" showInDefault="1" showInWebsite="1"> <button_label>Validate VAT Number</button_label> <frontend_model>Magento\Customer\Block\Adminhtml\System\Config\Validatevat</frontend_model> </field> diff --git a/app/code/Magento/Customer/etc/config.xml b/app/code/Magento/Customer/etc/config.xml index da4b80536e631..e50e6294c924d 100644 --- a/app/code/Magento/Customer/etc/config.xml +++ b/app/code/Magento/Customer/etc/config.xml @@ -12,6 +12,7 @@ <scope>1</scope> </account_share> <create_account> + <auto_group_assign>0</auto_group_assign> <confirm>0</confirm> <default_group>1</default_group> <tax_calculation_address_type>billing</tax_calculation_address_type> @@ -21,7 +22,9 @@ <email_no_password_template>customer_create_account_email_no_password_template</email_no_password_template> <email_confirmation_template>customer_create_account_email_confirmation_template</email_confirmation_template> <email_confirmed_template>customer_create_account_email_confirmed_template</email_confirmed_template> + <viv_disable_auto_group_assign_default>0</viv_disable_auto_group_assign_default> <vat_frontend_visibility>0</vat_frontend_visibility> + <generate_human_friendly_id>0</generate_human_friendly_id> </create_account> <default> <group>1</group> @@ -50,6 +53,7 @@ <suffix_show /> <suffix_options /> <dob_show /> + <taxvat_show /> <gender_show /> <telephone_show>req</telephone_show> <company_show>opt</company_show> diff --git a/app/code/Magento/Developer/etc/adminhtml/system.xml b/app/code/Magento/Developer/etc/adminhtml/system.xml index 197dc6f981acf..10449ab428726 100644 --- a/app/code/Magento/Developer/etc/adminhtml/system.xml +++ b/app/code/Magento/Developer/etc/adminhtml/system.xml @@ -9,7 +9,7 @@ <section id="dev"> <group id="front_end_development_workflow" translate="label" type="text" sortOrder="8" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Frontend Development Workflow</label> - <field id="type" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="type" translate="label comment" type="select" sortOrder="1" showInDefault="1" canRestore="1"> <label>Workflow type</label> <comment>Not available in production mode.</comment> <source_model>Magento\Developer\Model\Config\Source\WorkflowType</source_model> diff --git a/app/code/Magento/Dhl/etc/adminhtml/system.xml b/app/code/Magento/Dhl/etc/adminhtml/system.xml index 93a16821e385d..1728219236d9f 100644 --- a/app/code/Magento/Dhl/etc/adminhtml/system.xml +++ b/app/code/Magento/Dhl/etc/adminhtml/system.xml @@ -10,39 +10,39 @@ <section id="carriers"> <group id="dhl" translate="label" type="text" sortOrder="140" showInDefault="1" showInWebsite="1" showInStore="1"> <label>DHL</label> - <field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Enabled for Checkout</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> <field id="title" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Title</label> </field> - <field id="id" translate="label" type="obscure" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="id" translate="label" type="obscure" sortOrder="50" showInDefault="1" showInWebsite="1"> <label>Access ID</label> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> </field> - <field id="password" translate="label" type="obscure" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="password" translate="label" type="obscure" sortOrder="60" showInDefault="1" showInWebsite="1"> <label>Password</label> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> </field> - <field id="account" translate="label" type="text" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="account" translate="label" type="text" sortOrder="70" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Account Number</label> </field> - <field id="content_type" translate="label comment" type="select" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="content_type" translate="label comment" type="select" sortOrder="90" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Content Type (Non Domestic)</label> <comment>Whether to use Documents or NonDocuments service for non domestic shipments. (Shipments within the EU are classed as domestic)</comment> <source_model>Magento\Dhl\Model\Source\Contenttype</source_model> </field> - <field id="handling_type" translate="label" type="select" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="handling_type" translate="label" type="select" sortOrder="100" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Calculate Handling Fee</label> <source_model>Magento\Shipping\Model\Source\HandlingType</source_model> </field> - <field id="handling_action" translate="label comment" type="select" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="handling_action" translate="label comment" type="select" sortOrder="110" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Handling Applied</label> <comment>"Per Order" allows a single handling fee for the entire order. "Per Package" allows an individual handling fee for each package.</comment> <source_model>Magento\Shipping\Model\Source\HandlingAction</source_model> </field> - <field id="handling_fee" translate="label" type="text" sortOrder="120" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="handling_fee" translate="label" type="text" sortOrder="120" showInDefault="1" showInWebsite="1"> <label>Handling Fee</label> <validate>validate-number validate-zero-or-greater</validate> </field> @@ -78,22 +78,22 @@ <field id="size">1</field> </depends> </field> - <field id="doc_methods" translate="label" type="multiselect" sortOrder="170" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="doc_methods" translate="label" type="multiselect" sortOrder="170" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Documents Allowed Methods</label> <source_model>Magento\Dhl\Model\Source\Method\Doc</source_model> </field> - <field id="nondoc_methods" translate="label" type="multiselect" sortOrder="170" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="nondoc_methods" translate="label" type="multiselect" sortOrder="170" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Non Documents Allowed Methods</label> <source_model>Magento\Dhl\Model\Source\Method\Nondoc</source_model> </field> - <field id="ready_time" translate="label comment" type="text" sortOrder="180" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="ready_time" translate="label comment" type="text" sortOrder="180" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Ready time</label> <comment>Package ready time after order submission (in hours).</comment> </field> <field id="specificerrmsg" translate="label" type="textarea" sortOrder="800" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Displayed Error Message</label> </field> - <field id="free_method_doc" translate="label" type="select" sortOrder="1200" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="free_method_doc" translate="label" type="select" sortOrder="1200" showInDefault="1" showInWebsite="1"> <label>Free Method</label> <frontend_class>free-method</frontend_class> <source_model>Magento\Dhl\Model\Source\Method\Freedoc</source_model> @@ -101,7 +101,7 @@ <field id="content_type">D</field> </depends> </field> - <field id="free_method_nondoc" translate="label" type="select" sortOrder="1200" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="free_method_nondoc" translate="label" type="select" sortOrder="1200" showInDefault="1" showInWebsite="1"> <label>Free Method</label> <frontend_class>free-method</frontend_class> <source_model>Magento\Dhl\Model\Source\Method\Freenondoc</source_model> @@ -109,41 +109,41 @@ <field id="content_type">N</field> </depends> </field> - <field id="free_shipping_enable" translate="label" type="select" sortOrder="1210" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="free_shipping_enable" translate="label" type="select" sortOrder="1210" showInDefault="1" showInWebsite="1"> <label>Enable Free Shipping Threshold</label> <source_model>Magento\Config\Model\Config\Source\Enabledisable</source_model> </field> - <field id="free_shipping_subtotal" translate="label" type="text" sortOrder="1220" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="free_shipping_subtotal" translate="label" type="text" sortOrder="1220" showInDefault="1" showInWebsite="1"> <label>Free Shipping Amount Threshold</label> <validate>validate-number validate-zero-or-greater</validate> <depends> <field id="free_shipping_enable">1</field> </depends> </field> - <field id="sallowspecific" translate="label" type="select" sortOrder="1900" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="sallowspecific" translate="label" type="select" sortOrder="1900" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Ship to Applicable Countries</label> <frontend_class>shipping-applicable-country</frontend_class> <source_model>Magento\Shipping\Model\Config\Source\Allspecificcountries</source_model> </field> - <field id="specificcountry" translate="label" type="multiselect" sortOrder="1910" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="specificcountry" translate="label" type="multiselect" sortOrder="1910" showInDefault="1" showInWebsite="1"> <label>Ship to Specific Countries</label> <source_model>Magento\Directory\Model\Config\Source\Country</source_model> <can_be_empty>1</can_be_empty> </field> - <field id="showmethod" translate="label" type="select" sortOrder="1940" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="showmethod" translate="label" type="select" sortOrder="1940" showInDefault="1" showInWebsite="1"> <label>Show Method if Not Applicable</label> <frontend_class>shipping-skip-hide</frontend_class> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="sort_order" translate="label" type="text" sortOrder="2000" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="sort_order" translate="label" type="text" sortOrder="2000" showInDefault="1" showInWebsite="1"> <label>Sort Order</label> <validate>validate-number validate-zero-or-greater</validate> </field> - <field id="debug" translate="label" type="select" sortOrder="1950" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="debug" translate="label" type="select" sortOrder="1950" showInDefault="1" showInWebsite="1"> <label>Debug</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="sandbox_mode" translate="label" type="select" sortOrder="1960" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="sandbox_mode" translate="label" type="select" sortOrder="1960" showInDefault="1" showInWebsite="1"> <label>Sandbox Mode</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> diff --git a/app/code/Magento/Directory/etc/adminhtml/system.xml b/app/code/Magento/Directory/etc/adminhtml/system.xml index 5f97a5e8d90d6..6fa47037d2645 100644 --- a/app/code/Magento/Directory/etc/adminhtml/system.xml +++ b/app/code/Magento/Directory/etc/adminhtml/system.xml @@ -13,7 +13,7 @@ <resource>Magento_Config::currency</resource> <group id="options" translate="label" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Currency Options</label> - <field id="base" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="base" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Base Currency</label> <frontend_model>Magento\Directory\Block\Adminhtml\Frontend\Currency\Base</frontend_model> <source_model>Magento\Config\Model\Config\Source\Locale\Currency</source_model> @@ -34,31 +34,31 @@ <can_be_empty>1</can_be_empty> </field> </group> - <group id="fixerio" translate="label" sortOrder="35" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="fixerio" translate="label" sortOrder="35" showInDefault="1"> <label>Fixer.io</label> - <field id="api_key" translate="label" type="obscure" sortOrder="5" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="api_key" translate="label" type="obscure" sortOrder="5" showInDefault="1"> <label>API Key</label> <config_path>currency/fixerio/api_key</config_path> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> </field> - <field id="timeout" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="timeout" translate="label" type="text" sortOrder="10" showInDefault="1"> <label>Connection Timeout in Seconds</label> <validate>validate-zero-or-greater validate-number</validate> </field> </group> - <group id="currencyconverterapi" translate="label" sortOrder="45" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="currencyconverterapi" translate="label" sortOrder="45" showInDefault="1"> <label>Currency Converter API</label> - <field id="api_key" translate="label" type="obscure" sortOrder="5" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="api_key" translate="label" type="obscure" sortOrder="5" showInDefault="1"> <label>API Key</label> <config_path>currency/currencyconverterapi/api_key</config_path> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> </field> - <field id="timeout" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="timeout" translate="label" type="text" sortOrder="10" showInDefault="1"> <label>Connection Timeout in Seconds</label> <validate>validate-zero-or-greater validate-number</validate> </field> </group> - <group id="import" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="import" translate="label" type="text" sortOrder="50" showInDefault="1"> <label>Scheduled Import Settings</label> <field id="enabled" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Enabled</label> @@ -71,14 +71,14 @@ <field id="enabled">1</field> </depends> </field> - <field id="error_email_identity" translate="label" type="select" sortOrder="6" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="error_email_identity" translate="label" type="select" sortOrder="6" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Error Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> <depends> <field id="enabled">1</field> </depends> </field> - <field id="error_email_template" translate="label comment" type="select" sortOrder="7" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="error_email_template" translate="label comment" type="select" sortOrder="7" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Error Email Template</label> <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> @@ -110,9 +110,9 @@ </group> </section> <section id="system"> - <group id="currency" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="currency" translate="label" type="text" sortOrder="50" showInDefault="1"> <label>Currency</label> - <field id="installed" translate="label" type="multiselect" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="installed" translate="label" type="multiselect" sortOrder="1" showInDefault="1" canRestore="1"> <label>Installed Currencies</label> <backend_model>Magento\Config\Model\Config\Backend\Locale</backend_model> <source_model>Magento\Config\Model\Config\Source\Locale\Currency\All</source_model> @@ -122,20 +122,20 @@ </section> <section id="general"> <group id="country"> - <field id="optional_zip_countries" translate="label" type="multiselect" sortOrder="3" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="optional_zip_countries" translate="label" type="multiselect" sortOrder="3" showInDefault="1" canRestore="1"> <label>Zip/Postal Code is Optional for</label> <source_model>Magento\Directory\Model\Config\Source\Country</source_model> <can_be_empty>1</can_be_empty> </field> </group> - <group id="region" translate="label" type="text" sortOrder="4" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="region" translate="label" type="text" sortOrder="4" showInDefault="1"> <label>State Options</label> - <field id="state_required" translate="label" type="multiselect" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="state_required" translate="label" type="multiselect" sortOrder="1" showInDefault="1"> <label>State is Required for</label> <source_model>Magento\Directory\Model\Config\Source\Country</source_model> <can_be_empty>1</can_be_empty> </field> - <field id="display_all" translate="label" type="select" sortOrder="8" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="display_all" translate="label" type="select" sortOrder="8" showInDefault="1"> <label>Allow to Choose State if It is Optional for Country</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> diff --git a/app/code/Magento/Downloadable/etc/adminhtml/system.xml b/app/code/Magento/Downloadable/etc/adminhtml/system.xml index 77f2cc0503631..31b2f64ec018c 100644 --- a/app/code/Magento/Downloadable/etc/adminhtml/system.xml +++ b/app/code/Magento/Downloadable/etc/adminhtml/system.xml @@ -10,15 +10,15 @@ <section id="catalog"> <group id="downloadable" translate="label" type="text" sortOrder="600" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Downloadable Product Options</label> - <field id="order_item_status" translate="label" type="select" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="order_item_status" translate="label" type="select" sortOrder="100" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Order Item Status to Enable Downloads</label> <source_model>Magento\Downloadable\Model\System\Config\Source\Orderitemstatus</source_model> </field> - <field id="downloads_number" translate="label" type="text" sortOrder="200" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="downloads_number" translate="label" type="text" sortOrder="200" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Default Maximum Number of Downloads</label> <validate>validate-digits validate-zero-or-greater</validate> </field> - <field id="shareable" translate="label" type="select" sortOrder="300" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="shareable" translate="label" type="select" sortOrder="300" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Shareable</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> @@ -28,15 +28,15 @@ <field id="links_title" translate="label" type="text" sortOrder="500" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Default Link Title</label> </field> - <field id="links_target_new_window" translate="label" type="select" sortOrder="600" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="links_target_new_window" translate="label" type="select" sortOrder="600" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Open Links in New Window</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="content_disposition" translate="label" type="select" sortOrder="700" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="content_disposition" translate="label" type="select" sortOrder="700" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Use Content-Disposition</label> <source_model>Magento\Downloadable\Model\System\Config\Source\Contentdisposition</source_model> </field> - <field id="disable_guest_checkout" translate="label comment" type="select" sortOrder="800" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="disable_guest_checkout" translate="label comment" type="select" sortOrder="800" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Disable Guest Checkout if Cart Contains Downloadable Items</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <comment>Guest checkout will only work with shareable.</comment> diff --git a/app/code/Magento/Downloadable/etc/config.xml b/app/code/Magento/Downloadable/etc/config.xml index 578ff1e008660..26f2457f6bf3c 100644 --- a/app/code/Magento/Downloadable/etc/config.xml +++ b/app/code/Magento/Downloadable/etc/config.xml @@ -9,8 +9,9 @@ <default> <catalog> <downloadable> - <downloads_number>0</downloads_number> <order_item_status>9</order_item_status> + <downloads_number>0</downloads_number> + <shareable>0</shareable> <samples_title>Samples</samples_title> <links_title>Links</links_title> <links_target_new_window>1</links_target_new_window> diff --git a/app/code/Magento/Eav/etc/adminhtml/system.xml b/app/code/Magento/Eav/etc/adminhtml/system.xml index 86916abe812d9..2fe1564786997 100644 --- a/app/code/Magento/Eav/etc/adminhtml/system.xml +++ b/app/code/Magento/Eav/etc/adminhtml/system.xml @@ -8,9 +8,9 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> <section id="dev"> - <group id="caching" translate="label" type="text" sortOrder="120" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="caching" translate="label" type="text" sortOrder="120" showInDefault="1"> <label>Caching Settings</label> - <field id="cache_user_defined_attributes" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="cache_user_defined_attributes" translate="label comment" type="select" sortOrder="10" showInDefault="1" canRestore="1"> <label>Cache User Defined Attributes</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <comment>By default only system EAV attributes are cached.</comment> diff --git a/app/code/Magento/Elasticsearch/etc/adminhtml/system.xml b/app/code/Magento/Elasticsearch/etc/adminhtml/system.xml index 7e3c83dae9847..6d87c4948a9d9 100644 --- a/app/code/Magento/Elasticsearch/etc/adminhtml/system.xml +++ b/app/code/Magento/Elasticsearch/etc/adminhtml/system.xml @@ -10,52 +10,52 @@ <section id="catalog"> <group id="search"> <!-- Elasticsearch 2.0+ --> - <field id="elasticsearch_server_hostname" translate="label" type="text" sortOrder="61" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="elasticsearch_server_hostname" translate="label" type="text" sortOrder="61" showInDefault="1"> <label>Elasticsearch Server Hostname</label> <depends> <field id="engine">elasticsearch</field> </depends> </field> - <field id="elasticsearch_server_port" translate="label" type="text" sortOrder="62" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="elasticsearch_server_port" translate="label" type="text" sortOrder="62" showInDefault="1"> <label>Elasticsearch Server Port</label> <depends> <field id="engine">elasticsearch</field> </depends> </field> - <field id="elasticsearch_index_prefix" translate="label" type="text" sortOrder="63" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="elasticsearch_index_prefix" translate="label" type="text" sortOrder="63" showInDefault="1"> <label>Elasticsearch Index Prefix</label> <depends> <field id="engine">elasticsearch</field> </depends> </field> - <field id="elasticsearch_enable_auth" translate="label" type="select" sortOrder="64" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="elasticsearch_enable_auth" translate="label" type="select" sortOrder="64" showInDefault="1"> <label>Enable Elasticsearch HTTP Auth</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <depends> <field id="engine">elasticsearch</field> </depends> </field> - <field id="elasticsearch_username" translate="label" type="text" sortOrder="65" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="elasticsearch_username" translate="label" type="text" sortOrder="65" showInDefault="1"> <label>Elasticsearch HTTP Username</label> <depends> <field id="engine">elasticsearch</field> <field id="elasticsearch_enable_auth">1</field> </depends> </field> - <field id="elasticsearch_password" translate="label" type="text" sortOrder="66" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="elasticsearch_password" translate="label" type="text" sortOrder="66" showInDefault="1"> <label>Elasticsearch HTTP Password</label> <depends> <field id="engine">elasticsearch</field> <field id="elasticsearch_enable_auth">1</field> </depends> </field> - <field id="elasticsearch_server_timeout" translate="label" type="text" sortOrder="67" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="elasticsearch_server_timeout" translate="label" type="text" sortOrder="67" showInDefault="1"> <label>Elasticsearch Server Timeout</label> <depends> <field id="engine">elasticsearch</field> </depends> </field> - <field id="elasticsearch_test_connect_wizard" translate="button_label" sortOrder="68" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="elasticsearch_test_connect_wizard" translate="button_label" sortOrder="68" showInDefault="1"> <label/> <button_label>Test Connection</button_label> <frontend_model>Magento\Elasticsearch\Block\Adminhtml\System\Config\TestConnection</frontend_model> @@ -63,7 +63,7 @@ <field id="engine">elasticsearch</field> </depends> </field> - <field id="elasticsearch_minimum_should_match" translate="label" type="text" sortOrder="93" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="elasticsearch_minimum_should_match" translate="label" type="text" sortOrder="93" showInDefault="1"> <label>Minimum Terms to Match</label> <depends> <field id="engine">elasticsearch</field> @@ -72,52 +72,52 @@ <backend_model>Magento\Elasticsearch\Model\Config\Backend\MinimumShouldMatch</backend_model> </field> <!-- Elasticsearch 5.x --> - <field id="elasticsearch5_server_hostname" translate="label" type="text" sortOrder="61" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="elasticsearch5_server_hostname" translate="label" type="text" sortOrder="61" showInDefault="1"> <label>Elasticsearch Server Hostname</label> <depends> <field id="engine">elasticsearch5</field> </depends> </field> - <field id="elasticsearch5_server_port" translate="label" type="text" sortOrder="62" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="elasticsearch5_server_port" translate="label" type="text" sortOrder="62" showInDefault="1"> <label>Elasticsearch Server Port</label> <depends> <field id="engine">elasticsearch5</field> </depends> </field> - <field id="elasticsearch5_index_prefix" translate="label" type="text" sortOrder="63" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="elasticsearch5_index_prefix" translate="label" type="text" sortOrder="63" showInDefault="1"> <label>Elasticsearch Index Prefix</label> <depends> <field id="engine">elasticsearch5</field> </depends> </field> - <field id="elasticsearch5_enable_auth" translate="label" type="select" sortOrder="64" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="elasticsearch5_enable_auth" translate="label" type="select" sortOrder="64" showInDefault="1"> <label>Enable Elasticsearch HTTP Auth</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <depends> <field id="engine">elasticsearch5</field> </depends> </field> - <field id="elasticsearch5_username" translate="label" type="text" sortOrder="65" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="elasticsearch5_username" translate="label" type="text" sortOrder="65" showInDefault="1"> <label>Elasticsearch HTTP Username</label> <depends> <field id="engine">elasticsearch5</field> <field id="elasticsearch5_enable_auth">1</field> </depends> </field> - <field id="elasticsearch5_password" translate="label" type="text" sortOrder="66" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="elasticsearch5_password" translate="label" type="text" sortOrder="66" showInDefault="1"> <label>Elasticsearch HTTP Password</label> <depends> <field id="engine">elasticsearch5</field> <field id="elasticsearch5_enable_auth">1</field> </depends> </field> - <field id="elasticsearch5_server_timeout" translate="label" type="text" sortOrder="67" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="elasticsearch5_server_timeout" translate="label" type="text" sortOrder="67" showInDefault="1"> <label>Elasticsearch Server Timeout</label> <depends> <field id="engine">elasticsearch5</field> </depends> </field> - <field id="elasticsearch5_test_connect_wizard" translate="button_label" sortOrder="68" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="elasticsearch5_test_connect_wizard" translate="button_label" sortOrder="68" showInDefault="1"> <label/> <button_label>Test Connection</button_label> <frontend_model>Magento\Elasticsearch\Block\Adminhtml\System\Config\Elasticsearch5\TestConnection</frontend_model> @@ -125,7 +125,7 @@ <field id="engine">elasticsearch5</field> </depends> </field> - <field id="elasticsearch5_minimum_should_match" translate="label" type="text" sortOrder="93" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="elasticsearch5_minimum_should_match" translate="label" type="text" sortOrder="93" showInDefault="1"> <label>Minimum Terms to Match</label> <depends> <field id="engine">elasticsearch5</field> diff --git a/app/code/Magento/Elasticsearch6/etc/adminhtml/system.xml b/app/code/Magento/Elasticsearch6/etc/adminhtml/system.xml index 5c6a9357a5f6f..fee234ada43b4 100644 --- a/app/code/Magento/Elasticsearch6/etc/adminhtml/system.xml +++ b/app/code/Magento/Elasticsearch6/etc/adminhtml/system.xml @@ -11,32 +11,28 @@ <section id="catalog"> <group id="search"> <!-- Elasticsearch 6.x --> - <field id="elasticsearch6_server_hostname" translate="label" type="text" sortOrder="71" - showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="elasticsearch6_server_hostname" translate="label" type="text" sortOrder="71" showInDefault="1"> <label>Elasticsearch Server Hostname</label> <depends> <field id="engine">elasticsearch6</field> </depends> </field> - <field id="elasticsearch6_server_port" translate="label" type="text" sortOrder="72" showInDefault="1" - showInWebsite="0" showInStore="0"> + <field id="elasticsearch6_server_port" translate="label" type="text" sortOrder="72" showInDefault="1"> <label>Elasticsearch Server Port</label> <depends> <field id="engine">elasticsearch6</field> </depends> </field> - <field id="elasticsearch6_index_prefix" translate="label" type="text" sortOrder="73" showInDefault="1" - showInWebsite="0" showInStore="0"> + <field id="elasticsearch6_index_prefix" translate="label" type="text" sortOrder="73" showInDefault="1"> <label>Elasticsearch Index Prefix</label> <depends> <field id="engine">elasticsearch6</field> </depends> </field> - <field id="elasticsearch6_enable_auth" translate="label" type="select" sortOrder="74" showInDefault="1" - showInWebsite="0" showInStore="0"> + <field id="elasticsearch6_enable_auth" translate="label" type="select" sortOrder="74" showInDefault="1"> <label>Enable Elasticsearch HTTP Auth</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <depends> @@ -44,8 +40,7 @@ </depends> </field> - <field id="elasticsearch6_username" translate="label" type="text" sortOrder="75" showInDefault="1" - showInWebsite="0" showInStore="0"> + <field id="elasticsearch6_username" translate="label" type="text" sortOrder="75" showInDefault="1"> <label>Elasticsearch HTTP Username</label> <depends> <field id="engine">elasticsearch6</field> @@ -53,8 +48,7 @@ </depends> </field> - <field id="elasticsearch6_password" translate="label" type="text" sortOrder="76" showInDefault="1" - showInWebsite="0" showInStore="0"> + <field id="elasticsearch6_password" translate="label" type="text" sortOrder="76" showInDefault="1"> <label>Elasticsearch HTTP Password</label> <depends> <field id="engine">elasticsearch6</field> @@ -62,16 +56,14 @@ </depends> </field> - <field id="elasticsearch6_server_timeout" translate="label" type="text" sortOrder="77" showInDefault="1" - showInWebsite="0" showInStore="0"> + <field id="elasticsearch6_server_timeout" translate="label" type="text" sortOrder="77" showInDefault="1"> <label>Elasticsearch Server Timeout</label> <depends> <field id="engine">elasticsearch6</field> </depends> </field> - <field id="elasticsearch6_test_connect_wizard" translate="button_label" sortOrder="78" showInDefault="1" - showInWebsite="0" showInStore="0"> + <field id="elasticsearch6_test_connect_wizard" translate="button_label" sortOrder="78" showInDefault="1"> <label/> <button_label>Test Connection</button_label> <frontend_model>Magento\Elasticsearch6\Block\Adminhtml\System\Config\TestConnection</frontend_model> @@ -79,8 +71,7 @@ <field id="engine">elasticsearch6</field> </depends> </field> - <field id="elasticsearch6_minimum_should_match" translate="label" type="text" sortOrder="93" showInDefault="1" - showInWebsite="0" showInStore="0"> + <field id="elasticsearch6_minimum_should_match" translate="label" type="text" sortOrder="93" showInDefault="1"> <label>Minimum Terms to Match</label> <depends> <field id="engine">elasticsearch6</field> diff --git a/app/code/Magento/Email/etc/config.xml b/app/code/Magento/Email/etc/config.xml index 0731fc79c15f7..a9837a4f2917c 100644 --- a/app/code/Magento/Email/etc/config.xml +++ b/app/code/Magento/Email/etc/config.xml @@ -27,6 +27,7 @@ <disable>0</disable> <host>localhost</host> <port>25</port> + <set_return_path>0</set_return_path> </smtp> </system> <trans_email> diff --git a/app/code/Magento/Fedex/etc/adminhtml/system.xml b/app/code/Magento/Fedex/etc/adminhtml/system.xml index fdbe10a1a352e..f164a8e21e0ae 100644 --- a/app/code/Magento/Fedex/etc/adminhtml/system.xml +++ b/app/code/Magento/Fedex/etc/adminhtml/system.xml @@ -10,101 +10,101 @@ <section id="carriers"> <group id="fedex" translate="label" type="text" sortOrder="120" showInDefault="1" showInWebsite="1" showInStore="1"> <label>FedEx</label> - <field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Enabled for Checkout</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> <field id="title" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Title</label> </field> - <field id="account" translate="label comment" type="obscure" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="account" translate="label comment" type="obscure" sortOrder="40" showInDefault="1" showInWebsite="1"> <label>Account ID</label> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> <comment>Please make sure to use only digits here. No dashes are allowed.</comment> </field> - <field id="meter_number" translate="label" type="obscure" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="meter_number" translate="label" type="obscure" sortOrder="50" showInDefault="1" showInWebsite="1"> <label>Meter Number</label> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> </field> - <field id="key" translate="label" type="obscure" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="key" translate="label" type="obscure" sortOrder="60" showInDefault="1" showInWebsite="1"> <label>Key</label> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> </field> - <field id="password" translate="label" type="obscure" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="password" translate="label" type="obscure" sortOrder="70" showInDefault="1" showInWebsite="1"> <label>Password</label> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> </field> - <field id="sandbox_mode" translate="label" type="select" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="sandbox_mode" translate="label" type="select" sortOrder="80" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Sandbox Mode</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="production_webservices_url" translate="label" type="text" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="production_webservices_url" translate="label" type="text" sortOrder="90" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Web-Services URL (Production)</label> <depends> <field id="sandbox_mode">0</field> </depends> </field> - <field id="sandbox_webservices_url" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="sandbox_webservices_url" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Web-Services URL (Sandbox)</label> <depends> <field id="sandbox_mode">1</field> </depends> </field> - <field id="shipment_requesttype" translate="label" type="select" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="shipment_requesttype" translate="label" type="select" sortOrder="110" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Packages Request Type</label> <source_model>Magento\Shipping\Model\Config\Source\Online\Requesttype</source_model> </field> - <field id="packaging" translate="label" type="select" sortOrder="120" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="packaging" translate="label" type="select" sortOrder="120" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Packaging</label> <source_model>Magento\Fedex\Model\Source\Packaging</source_model> </field> - <field id="dropoff" translate="label" type="select" sortOrder="130" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="dropoff" translate="label" type="select" sortOrder="130" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Dropoff</label> <source_model>Magento\Fedex\Model\Source\Dropoff</source_model> </field> - <field id="unit_of_measure" translate="label" type="select" sortOrder="135" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="unit_of_measure" translate="label" type="select" sortOrder="135" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Weight Unit</label> <source_model>Magento\Fedex\Model\Source\Unitofmeasure</source_model> </field> - <field id="max_package_weight" translate="label" type="text" sortOrder="140" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="max_package_weight" translate="label" type="text" sortOrder="140" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Maximum Package Weight (Please consult your shipping carrier for maximum supported shipping weight)</label> <validate>validate-number validate-zero-or-greater</validate> </field> - <field id="handling_type" translate="label" type="select" sortOrder="150" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="handling_type" translate="label" type="select" sortOrder="150" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Calculate Handling Fee</label> <source_model>Magento\Shipping\Model\Source\HandlingType</source_model> </field> - <field id="handling_action" translate="label" type="select" sortOrder="160" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="handling_action" translate="label" type="select" sortOrder="160" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Handling Applied</label> <source_model>Magento\Shipping\Model\Source\HandlingAction</source_model> </field> - <field id="handling_fee" translate="label" type="text" sortOrder="170" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="handling_fee" translate="label" type="text" sortOrder="170" showInDefault="1" showInWebsite="1"> <label>Handling Fee</label> <validate>validate-number validate-zero-or-greater</validate> </field> - <field id="residence_delivery" translate="label" type="select" sortOrder="180" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="residence_delivery" translate="label" type="select" sortOrder="180" showInDefault="1" showInWebsite="1"> <label>Residential Delivery</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="allowed_methods" translate="label" type="multiselect" sortOrder="190" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="allowed_methods" translate="label" type="multiselect" sortOrder="190" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Allowed Methods</label> <source_model>Magento\Fedex\Model\Source\Method</source_model> <can_be_empty>1</can_be_empty> </field> - <field id="smartpost_hubid" translate="label comment" type="text" sortOrder="200" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="smartpost_hubid" translate="label comment" type="text" sortOrder="200" showInDefault="1" showInWebsite="1"> <label>Hub ID</label> <comment>The field is applicable if the Smart Post method is selected.</comment> </field> - <field id="free_method" translate="label" type="select" sortOrder="210" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="free_method" translate="label" type="select" sortOrder="210" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Free Method</label> <frontend_class>free-method</frontend_class> <source_model>Magento\Fedex\Model\Source\Freemethod</source_model> </field> - <field id="free_shipping_enable" translate="label" type="select" sortOrder="220" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="free_shipping_enable" translate="label" type="select" sortOrder="220" showInDefault="1" showInWebsite="1"> <label>Enable Free Shipping Threshold</label> <source_model>Magento\Config\Model\Config\Source\Enabledisable</source_model> </field> - <field id="free_shipping_subtotal" translate="label" type="text" sortOrder="230" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="free_shipping_subtotal" translate="label" type="text" sortOrder="230" showInDefault="1" showInWebsite="1"> <label>Free Shipping Amount Threshold</label> <validate>validate-number validate-zero-or-greater</validate> <depends> @@ -114,26 +114,26 @@ <field id="specificerrmsg" translate="label" type="textarea" sortOrder="240" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Displayed Error Message</label> </field> - <field id="sallowspecific" translate="label" type="select" sortOrder="250" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="sallowspecific" translate="label" type="select" sortOrder="250" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Ship to Applicable Countries</label> <frontend_class>shipping-applicable-country</frontend_class> <source_model>Magento\Shipping\Model\Config\Source\Allspecificcountries</source_model> </field> - <field id="specificcountry" translate="label" type="multiselect" sortOrder="260" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="specificcountry" translate="label" type="multiselect" sortOrder="260" showInDefault="1" showInWebsite="1"> <label>Ship to Specific Countries</label> <source_model>Magento\Directory\Model\Config\Source\Country</source_model> <can_be_empty>1</can_be_empty> </field> - <field id="debug" translate="label" type="select" sortOrder="270" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="debug" translate="label" type="select" sortOrder="270" showInDefault="1" showInWebsite="1"> <label>Debug</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="showmethod" translate="label" type="select" sortOrder="280" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="showmethod" translate="label" type="select" sortOrder="280" showInDefault="1" showInWebsite="1"> <label>Show Method if Not Applicable</label> <frontend_class>shipping-skip-hide</frontend_class> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="sort_order" translate="label" type="text" sortOrder="290" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="sort_order" translate="label" type="text" sortOrder="290" showInDefault="1" showInWebsite="1"> <label>Sort Order</label> <validate>validate-number validate-zero-or-greater</validate> </field> diff --git a/app/code/Magento/GiftMessage/etc/adminhtml/system.xml b/app/code/Magento/GiftMessage/etc/adminhtml/system.xml index 6779ea6f28174..fa437a0735cf4 100644 --- a/app/code/Magento/GiftMessage/etc/adminhtml/system.xml +++ b/app/code/Magento/GiftMessage/etc/adminhtml/system.xml @@ -8,13 +8,13 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> <section id="sales"> - <group id="gift_options" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="0"> + <group id="gift_options" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1"> <label>Gift Options</label> - <field id="allow_order" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="allow_order" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Allow Gift Messages on Order Level</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="allow_items" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="allow_items" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Allow Gift Messages for Order Items</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> diff --git a/app/code/Magento/GoogleAnalytics/etc/adminhtml/system.xml b/app/code/Magento/GoogleAnalytics/etc/adminhtml/system.xml index 3491b4d456b81..dd59de40a8528 100644 --- a/app/code/Magento/GoogleAnalytics/etc/adminhtml/system.xml +++ b/app/code/Magento/GoogleAnalytics/etc/adminhtml/system.xml @@ -13,7 +13,7 @@ <resource>Magento_GoogleAnalytics::google</resource> <group id="analytics" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Google Analytics</label> - <field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Enable</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> diff --git a/app/code/Magento/GoogleAnalytics/etc/config.xml b/app/code/Magento/GoogleAnalytics/etc/config.xml new file mode 100644 index 0000000000000..f3c9cc67f86ae --- /dev/null +++ b/app/code/Magento/GoogleAnalytics/etc/config.xml @@ -0,0 +1,16 @@ +<?xml version="1.0"?> +<!-- +/** + * 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:module:Magento_Store:etc/config.xsd"> + <default> + <google> + <analytics> + <active>0</active> + </analytics> + </google> + </default> +</config> diff --git a/app/code/Magento/InstantPurchase/etc/adminhtml/system.xml b/app/code/Magento/InstantPurchase/etc/adminhtml/system.xml index 76785c023ed0b..d87c91b293717 100644 --- a/app/code/Magento/InstantPurchase/etc/adminhtml/system.xml +++ b/app/code/Magento/InstantPurchase/etc/adminhtml/system.xml @@ -17,6 +17,9 @@ </field> <field id="button_text" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Button Text</label> + <depends> + <field id="active">1</field> + </depends> </field> </group> </section> diff --git a/app/code/Magento/Integration/etc/adminhtml/system.xml b/app/code/Magento/Integration/etc/adminhtml/system.xml index ddaae76700255..6ef569a1d8a2f 100644 --- a/app/code/Magento/Integration/etc/adminhtml/system.xml +++ b/app/code/Magento/Integration/etc/adminhtml/system.xml @@ -11,58 +11,58 @@ <label>OAuth</label> <tab>service</tab> <resource>Magento_Integration::config_oauth</resource> - <group id="access_token_lifetime" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="access_token_lifetime" translate="label" type="text" sortOrder="100" showInDefault="1"> <label>Access Token Expiration</label> - <field id="customer" translate="label comment" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="customer" translate="label comment" type="text" sortOrder="30" showInDefault="1" canRestore="1"> <label>Customer Token Lifetime (hours)</label> <comment>We will disable this feature if the value is empty.</comment> <validate>required-entry validate-zero-or-greater validate-number</validate> </field> - <field id="admin" translate="label comment" type="text" sortOrder="60" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="admin" translate="label comment" type="text" sortOrder="60" showInDefault="1" canRestore="1"> <label>Admin Token Lifetime (hours)</label> <comment>We will disable this feature if the value is empty.</comment> <validate>required-entry validate-zero-or-greater validate-number</validate> </field> </group> - <group id="cleanup" translate="label" type="text" sortOrder="300" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="cleanup" translate="label" type="text" sortOrder="300" showInDefault="1"> <label>Cleanup Settings</label> - <field id="cleanup_probability" translate="label comment" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="cleanup_probability" translate="label comment" type="text" sortOrder="10" showInDefault="1" canRestore="1"> <label>Cleanup Probability</label> <comment>Integer. Launch cleanup in X OAuth requests. 0 (not recommended) - to disable cleanup</comment> <validate>required-entry validate-zero-or-greater validate-digits</validate> </field> - <field id="expiration_period" translate="label comment" type="text" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="expiration_period" translate="label comment" type="text" sortOrder="20" showInDefault="1" canRestore="1"> <label>Expiration Period</label> <comment>Cleanup entries older than X minutes.</comment> <validate>required-entry validate-zero-or-greater validate-number</validate> </field> </group> - <group id="consumer" translate="label" type="text" sortOrder="400" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="consumer" translate="label" type="text" sortOrder="400" showInDefault="1"> <label>Consumer Settings</label> - <field id="expiration_period" translate="label comment" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="expiration_period" translate="label comment" type="text" sortOrder="30" showInDefault="1" canRestore="1"> <label>Expiration Period</label> <comment>Consumer key/secret will expire if not used within X seconds after Oauth token exchange starts.</comment> <validate>required-entry validate-zero-or-greater validate-number</validate> </field> - <field id="post_maxredirects" translate="label comment" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="post_maxredirects" translate="label comment" type="text" sortOrder="30" showInDefault="1" canRestore="1"> <label>OAuth consumer credentials HTTP Post maxredirects</label> <comment>Number of maximum redirects for OAuth consumer credentials Post request.</comment> <validate>required-entry validate-zero-or-greater validate-digits</validate> </field> - <field id="post_timeout" translate="label comment" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="post_timeout" translate="label comment" type="text" sortOrder="30" showInDefault="1" canRestore="1"> <label>OAuth consumer credentials HTTP Post timeout</label> <comment>Timeout for OAuth consumer credentials Post request within X seconds.</comment> <validate>required-entry validate-zero-or-greater validate-number</validate> </field> </group> - <group id="authentication_lock" translate="label" type="text" sortOrder="400" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="authentication_lock" translate="label" type="text" sortOrder="400" showInDefault="1"> <label>Authentication Locks</label> - <field id="max_failures_count" translate="label comment" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="max_failures_count" translate="label comment" type="text" sortOrder="30" showInDefault="1" canRestore="1"> <label>Maximum Login Failures to Lock Out Account</label> <comment>Maximum Number of authentication failures to lock out account.</comment> <validate>required-entry validate-zero-or-greater validate-digits</validate> </field> - <field id="timeout" translate="label comment" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="timeout" translate="label comment" type="text" sortOrder="30" showInDefault="1" canRestore="1"> <label>Lockout Time (seconds)</label> <comment>Period of time in seconds after which account will be unlocked.</comment> <validate>required-entry validate-zero-or-greater validate-number</validate> diff --git a/app/code/Magento/MediaStorage/etc/adminhtml/system.xml b/app/code/Magento/MediaStorage/etc/adminhtml/system.xml index 2c7219fe8afaa..9c8c2c5b24398 100644 --- a/app/code/Magento/MediaStorage/etc/adminhtml/system.xml +++ b/app/code/Magento/MediaStorage/etc/adminhtml/system.xml @@ -10,11 +10,11 @@ <section id="system" type="text" sortOrder="900" showInDefault="1" showInWebsite="1" showInStore="1"> <group id="media_storage_configuration" translate="label" type="text" sortOrder="900" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Storage Configuration for Media</label> - <field id="media_storage" translate="label" type="select" sortOrder="100" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="media_storage" translate="label" type="select" sortOrder="100" showInDefault="1"> <label>Media Storage</label> <source_model>Magento\MediaStorage\Model\Config\Source\Storage\Media\Storage</source_model> </field> - <field id="media_database" translate="label" type="select" sortOrder="200" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="media_database" translate="label" type="select" sortOrder="200" showInDefault="1"> <label>Select Media Database</label> <source_model>Magento\MediaStorage\Model\Config\Source\Storage\Media\Database</source_model> <backend_model>Magento\MediaStorage\Model\Config\Backend\Storage\Media\Database</backend_model> @@ -22,11 +22,11 @@ <field id="media_storage">1</field> </depends> </field> - <field id="synchronize" translate="label comment" type="button" sortOrder="300" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="synchronize" translate="label comment" type="button" sortOrder="300" showInDefault="1"> <frontend_model>Magento\MediaStorage\Block\System\Config\System\Storage\Media\Synchronize</frontend_model> <comment>After selecting a new media storage location, press the Synchronize button to transfer all media to that location and then "Save Config". Media will not be available in the new location until the synchronization process is complete.</comment> </field> - <field id="configuration_update_time" translate="label" type="text" sortOrder="400" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="configuration_update_time" translate="label" type="text" sortOrder="400" showInDefault="1" canRestore="1"> <label>Environment Update Time</label> <validate>validate-zero-or-greater validate-digits</validate> </field> diff --git a/app/code/Magento/Msrp/etc/adminhtml/system.xml b/app/code/Magento/Msrp/etc/adminhtml/system.xml index c20d753a2e794..8f6c3750c3835 100644 --- a/app/code/Magento/Msrp/etc/adminhtml/system.xml +++ b/app/code/Magento/Msrp/etc/adminhtml/system.xml @@ -8,16 +8,16 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> <section id="sales"> - <group id="msrp" translate="label" type="text" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="0"> + <group id="msrp" translate="label" type="text" sortOrder="110" showInDefault="1" showInWebsite="1"> <label>Minimum Advertised Price</label> - <field id="enabled" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="enabled" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Enable MAP</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <comment> <![CDATA[<strong style="color:red">Warning!</strong> Enabling MAP by default will hide all product prices on Storefront.]]> </comment> </field> - <field id="display_price_type" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="display_price_type" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Display Actual Price</label> <source_model>Magento\Msrp\Model\Product\Attribute\Source\Type</source_model> </field> diff --git a/app/code/Magento/Multishipping/etc/adminhtml/system.xml b/app/code/Magento/Multishipping/etc/adminhtml/system.xml index f30782b357c73..909db7b883904 100644 --- a/app/code/Magento/Multishipping/etc/adminhtml/system.xml +++ b/app/code/Magento/Multishipping/etc/adminhtml/system.xml @@ -7,19 +7,22 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> - <section id="multishipping" translate="label" type="text" sortOrder="311" showInDefault="1" showInWebsite="1" showInStore="0"> + <section id="multishipping" translate="label" type="text" sortOrder="311" showInDefault="1" showInWebsite="1"> <label>Multishipping Settings</label> <tab>sales</tab> <resource>Magento_Multishipping::config_multishipping</resource> - <group id="options" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="0"> + <group id="options" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1"> <label>Options</label> - <field id="checkout_multiple" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="checkout_multiple" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Allow Shipping to Multiple Addresses</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="checkout_multiple_maximum_qty" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="checkout_multiple_maximum_qty" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Maximum Qty Allowed for Shipping to Multiple Addresses</label> <validate>validate-number</validate> + <depends> + <field id="checkout_multiple">1</field> + </depends> </field> </group> </section> diff --git a/app/code/Magento/MysqlMq/etc/adminhtml/system.xml b/app/code/Magento/MysqlMq/etc/adminhtml/system.xml index 045a176a48e87..835283ee263c2 100644 --- a/app/code/Magento/MysqlMq/etc/adminhtml/system.xml +++ b/app/code/Magento/MysqlMq/etc/adminhtml/system.xml @@ -8,22 +8,22 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> <section id="system"> - <group id="mysqlmq" translate="label comment" type="text" sortOrder="15" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="mysqlmq" translate="label comment" type="text" sortOrder="15" showInDefault="1"> <label>MySQL Message Queue Cleanup</label> <comment>All the times are in minutes. Use "0" if you want to skip automatic clearance.</comment> - <field id="retry_inprogress_after" translate="label" type="text" sortOrder="60" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="retry_inprogress_after" translate="label" type="text" sortOrder="60" showInDefault="1"> <label>Retry Messages In Progress After</label> <validate>validate-zero-or-greater validate-digits</validate> </field> - <field id="successful_messages_lifetime" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="successful_messages_lifetime" translate="label" type="text" sortOrder="50" showInDefault="1"> <label>Successful Messages Lifetime</label> <validate>validate-zero-or-greater validate-digits</validate> </field> - <field id="failed_messages_lifetime" translate="label" type="text" sortOrder="60" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="failed_messages_lifetime" translate="label" type="text" sortOrder="60" showInDefault="1"> <label>Failed Messages Lifetime</label> <validate>validate-zero-or-greater validate-digits</validate> </field> - <field id="new_messages_lifetime" translate="label" type="text" sortOrder="60" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="new_messages_lifetime" translate="label" type="text" sortOrder="60" showInDefault="1"> <label>New Messages Lifetime</label> <validate>validate-zero-or-greater validate-digits</validate> </field> diff --git a/app/code/Magento/Newsletter/etc/adminhtml/system.xml b/app/code/Magento/Newsletter/etc/adminhtml/system.xml index 16af7b2158dde..01dc4777f5d31 100644 --- a/app/code/Magento/Newsletter/etc/adminhtml/system.xml +++ b/app/code/Magento/Newsletter/etc/adminhtml/system.xml @@ -20,6 +20,9 @@ </group> <group id="subscription" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Subscription Options</label> + <depends> + <field id="*/general/active">1</field> + </depends> <field id="allow_guest_subscribe" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Allow Guest Subscription</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> diff --git a/app/code/Magento/OfflinePayments/etc/adminhtml/system.xml b/app/code/Magento/OfflinePayments/etc/adminhtml/system.xml index aedab33239f9f..23793f970a7d9 100644 --- a/app/code/Magento/OfflinePayments/etc/adminhtml/system.xml +++ b/app/code/Magento/OfflinePayments/etc/adminhtml/system.xml @@ -10,26 +10,26 @@ <section id="payment" type="text" sortOrder="400" showInDefault="1" showInWebsite="1" showInStore="1"> <group id="checkmo" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Check / Money Order</label> - <field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Enabled</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="order_status" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="order_status" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" canRestore="1"> <label>New Order Status</label> <source_model>Magento\Sales\Model\Config\Source\Order\Status\NewStatus</source_model> </field> - <field id="sort_order" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="sort_order" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1"> <label>Sort Order</label> <frontend_class>validate-number</frontend_class> </field> <field id="title" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Title</label> </field> - <field id="allowspecific" translate="label" type="allowspecific" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="allowspecific" translate="label" type="allowspecific" sortOrder="50" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Payment from Applicable Countries</label> <source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model> </field> - <field id="specificcountry" translate="label" type="multiselect" sortOrder="51" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="specificcountry" translate="label" type="multiselect" sortOrder="51" showInDefault="1" showInWebsite="1"> <label>Payment from Specific Countries</label> <source_model>Magento\Directory\Model\Config\Source\Country</source_model> <can_be_empty>1</can_be_empty> @@ -40,11 +40,11 @@ <field id="mailing_address" translate="label" type="textarea" sortOrder="62" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Send Check to</label> </field> - <field id="min_order_total" translate="label" type="text" sortOrder="98" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="min_order_total" translate="label" type="text" sortOrder="98" showInDefault="1" showInWebsite="1"> <label>Minimum Order Total</label> <validate>validate-number validate-zero-or-greater</validate> </field> - <field id="max_order_total" translate="label" type="text" sortOrder="99" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="max_order_total" translate="label" type="text" sortOrder="99" showInDefault="1" showInWebsite="1"> <label>Maximum Order Total</label> <validate>validate-number validate-zero-or-greater</validate> </field> @@ -52,35 +52,35 @@ </group> <group id="purchaseorder" translate="label" type="text" sortOrder="32" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Purchase Order</label> - <field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Enabled</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="order_status" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="order_status" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" canRestore="1"> <label>New Order Status</label> <source_model>Magento\Sales\Model\Config\Source\Order\Status\NewStatus</source_model> </field> - <field id="sort_order" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="sort_order" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1"> <label>Sort Order</label> <frontend_class>validate-number</frontend_class> </field> <field id="title" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Title</label> </field> - <field id="allowspecific" translate="label" type="allowspecific" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="allowspecific" translate="label" type="allowspecific" sortOrder="50" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Payment from Applicable Countries</label> <source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model> </field> - <field id="specificcountry" translate="label" type="multiselect" sortOrder="51" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="specificcountry" translate="label" type="multiselect" sortOrder="51" showInDefault="1" showInWebsite="1"> <label>Payment from Specific Countries</label> <source_model>Magento\Directory\Model\Config\Source\Country</source_model> <can_be_empty>1</can_be_empty> </field> - <field id="min_order_total" translate="label" type="text" sortOrder="98" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="min_order_total" translate="label" type="text" sortOrder="98" showInDefault="1" showInWebsite="1"> <label>Minimum Order Total</label> <validate>validate-number validate-zero-or-greater</validate> </field> - <field id="max_order_total" translate="label" type="text" sortOrder="99" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="max_order_total" translate="label" type="text" sortOrder="99" showInDefault="1" showInWebsite="1"> <label>Maximum Order Total</label> <validate>validate-number validate-zero-or-greater</validate> </field> @@ -88,22 +88,22 @@ </group> <group id="banktransfer" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Bank Transfer Payment</label> - <field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Enabled</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> <field id="title" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Title</label> </field> - <field id="order_status" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="order_status" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" canRestore="1"> <label>New Order Status</label> <source_model>Magento\Sales\Model\Config\Source\Order\Status\NewStatus</source_model> </field> - <field id="allowspecific" translate="label" type="allowspecific" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="allowspecific" translate="label" type="allowspecific" sortOrder="50" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Payment from Applicable Countries</label> <source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model> </field> - <field id="specificcountry" translate="label" type="multiselect" sortOrder="51" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="specificcountry" translate="label" type="multiselect" sortOrder="51" showInDefault="1" showInWebsite="1"> <label>Payment from Specific Countries</label> <source_model>Magento\Directory\Model\Config\Source\Country</source_model> <can_be_empty>1</can_be_empty> @@ -111,37 +111,37 @@ <field id="instructions" translate="label" type="textarea" sortOrder="62" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Instructions</label> </field> - <field id="min_order_total" translate="label" type="text" sortOrder="98" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="min_order_total" translate="label" type="text" sortOrder="98" showInDefault="1" showInWebsite="1"> <label>Minimum Order Total</label> <validate>validate-number validate-zero-or-greater</validate> </field> - <field id="max_order_total" translate="label" type="text" sortOrder="99" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="max_order_total" translate="label" type="text" sortOrder="99" showInDefault="1" showInWebsite="1"> <label>Maximum Order Total</label> <validate>validate-number validate-zero-or-greater</validate> </field> - <field id="sort_order" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="sort_order" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1"> <label>Sort Order</label> <validate>validate-number</validate> </field> </group> <group id="cashondelivery" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Cash On Delivery Payment</label> - <field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Enabled</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> <field id="title" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Title</label> </field> - <field id="order_status" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="order_status" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" canRestore="1"> <label>New Order Status</label> <source_model>Magento\Sales\Model\Config\Source\Order\Status\NewStatus</source_model> </field> - <field id="allowspecific" translate="label" type="allowspecific" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="allowspecific" translate="label" type="allowspecific" sortOrder="50" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Payment from Applicable Countries</label> <source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model> </field> - <field id="specificcountry" translate="label" type="multiselect" sortOrder="51" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="specificcountry" translate="label" type="multiselect" sortOrder="51" showInDefault="1" showInWebsite="1"> <label>Payment from Specific Countries</label> <source_model>Magento\Directory\Model\Config\Source\Country</source_model> <can_be_empty>1</can_be_empty> @@ -149,15 +149,15 @@ <field id="instructions" translate="label" type="textarea" sortOrder="62" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Instructions</label> </field> - <field id="min_order_total" translate="label" type="text" sortOrder="98" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="min_order_total" translate="label" type="text" sortOrder="98" showInDefault="1" showInWebsite="1"> <label>Minimum Order Total</label> <validate>validate-number validate-zero-or-greater</validate> </field> - <field id="max_order_total" translate="label" type="text" sortOrder="99" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="max_order_total" translate="label" type="text" sortOrder="99" showInDefault="1" showInWebsite="1"> <label>Maximum Order Total</label> <validate>validate-number validate-zero-or-greater</validate> </field> - <field id="sort_order" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="sort_order" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1"> <label>Sort Order</label> <validate>validate-number</validate> </field> diff --git a/app/code/Magento/OfflineShipping/etc/adminhtml/system.xml b/app/code/Magento/OfflineShipping/etc/adminhtml/system.xml index cb75bddf4d7bd..768aab0499046 100644 --- a/app/code/Magento/OfflineShipping/etc/adminhtml/system.xml +++ b/app/code/Magento/OfflineShipping/etc/adminhtml/system.xml @@ -10,47 +10,47 @@ <section id="carriers" type="text" sortOrder="320" showInDefault="1" showInWebsite="1" showInStore="1"> <group id="flatrate" translate="label" type="text" sortOrder="0" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Flat Rate</label> - <field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Enabled</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> <field id="name" translate="label" type="text" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Method Name</label> </field> - <field id="price" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="price" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Price</label> <validate>validate-number validate-zero-or-greater</validate> </field> - <field id="handling_type" translate="label" type="select" sortOrder="7" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="handling_type" translate="label" type="select" sortOrder="7" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Calculate Handling Fee</label> <source_model>Magento\Shipping\Model\Source\HandlingType</source_model> </field> - <field id="handling_fee" translate="label" type="text" sortOrder="8" showInDefault="1" showInWebsite="1" showInStore="0" > + <field id="handling_fee" translate="label" type="text" sortOrder="8" showInDefault="1" showInWebsite="1" > <label>Handling Fee</label> <validate>validate-number validate-zero-or-greater</validate> </field> - <field id="sort_order" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="sort_order" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1"> <label>Sort Order</label> <validate>validate-number validate-zero-or-greater</validate> </field> <field id="title" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Title</label> </field> - <field id="type" translate="label" type="select" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="type" translate="label" type="select" sortOrder="4" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Type</label> <source_model>Magento\OfflineShipping\Model\Config\Source\Flatrate</source_model> </field> - <field id="sallowspecific" translate="label" type="select" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="sallowspecific" translate="label" type="select" sortOrder="90" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Ship to Applicable Countries</label> <frontend_class>shipping-applicable-country</frontend_class> <source_model>Magento\Shipping\Model\Config\Source\Allspecificcountries</source_model> </field> - <field id="specificcountry" translate="label" type="multiselect" sortOrder="91" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="specificcountry" translate="label" type="multiselect" sortOrder="91" showInDefault="1" showInWebsite="1"> <label>Ship to Specific Countries</label> <source_model>Magento\Directory\Model\Config\Source\Country</source_model> <can_be_empty>1</can_be_empty> </field> - <field id="showmethod" translate="label" type="select" sortOrder="92" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="showmethod" translate="label" type="select" sortOrder="92" showInDefault="1" showInWebsite="1"> <label>Show Method if Not Applicable</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <frontend_class>shipping-skip-hide</frontend_class> @@ -61,54 +61,54 @@ </group> <group id="tablerate" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Table Rates</label> - <field id="handling_type" translate="label" type="select" sortOrder="7" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="handling_type" translate="label" type="select" sortOrder="7" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Calculate Handling Fee</label> <source_model>Magento\Shipping\Model\Source\HandlingType</source_model> </field> - <field id="handling_fee" translate="label" type="text" sortOrder="8" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="handling_fee" translate="label" type="text" sortOrder="8" showInDefault="1" showInWebsite="1"> <label>Handling Fee</label> <validate>validate-number validate-zero-or-greater</validate> </field> - <field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Enabled</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="condition_name" translate="label" type="select" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="condition_name" translate="label" type="select" sortOrder="4" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Condition</label> <source_model>Magento\OfflineShipping\Model\Config\Source\Tablerate</source_model> </field> - <field id="include_virtual_price" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="include_virtual_price" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Include Virtual Products in Price Calculation</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="export" translate="label" type="Magento\OfflineShipping\Block\Adminhtml\Form\Field\Export" sortOrder="5" showInDefault="0" showInWebsite="1" showInStore="0"> + <field id="export" translate="label" type="Magento\OfflineShipping\Block\Adminhtml\Form\Field\Export" sortOrder="5" showInWebsite="1"> <label>Export</label> </field> - <field id="import" translate="label" type="Magento\OfflineShipping\Block\Adminhtml\Form\Field\Import" sortOrder="6" showInDefault="0" showInWebsite="1" showInStore="0"> + <field id="import" translate="label" type="Magento\OfflineShipping\Block\Adminhtml\Form\Field\Import" sortOrder="6" showInWebsite="1"> <label>Import</label> <backend_model>Magento\OfflineShipping\Model\Config\Backend\Tablerate</backend_model> </field> <field id="name" translate="label" type="text" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Method Name</label> </field> - <field id="sort_order" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="sort_order" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1"> <label>Sort Order</label> <validate>validate-number validate-zero-or-greater</validate> </field> <field id="title" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Title</label> </field> - <field id="sallowspecific" translate="label" type="select" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="sallowspecific" translate="label" type="select" sortOrder="90" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Ship to Applicable Countries</label> <frontend_class>shipping-applicable-country</frontend_class> <source_model>Magento\Shipping\Model\Config\Source\Allspecificcountries</source_model> </field> - <field id="specificcountry" translate="label" type="multiselect" sortOrder="91" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="specificcountry" translate="label" type="multiselect" sortOrder="91" showInDefault="1" showInWebsite="1"> <label>Ship to Specific Countries</label> <source_model>Magento\Directory\Model\Config\Source\Country</source_model> <can_be_empty>1</can_be_empty> </field> - <field id="showmethod" translate="label" type="select" sortOrder="92" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="showmethod" translate="label" type="select" sortOrder="92" showInDefault="1" showInWebsite="1"> <label>Show Method if Not Applicable</label> <frontend_class>shipping-skip-hide</frontend_class> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> @@ -119,39 +119,39 @@ </group> <group id="freeshipping" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Free Shipping</label> - <field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Enabled</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="free_shipping_subtotal" translate="label" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="free_shipping_subtotal" translate="label" type="text" sortOrder="4" showInDefault="1" showInWebsite="1"> <label>Minimum Order Amount</label> <validate>validate-number validate-zero-or-greater</validate> </field> - <field id="tax_including" translate="label" sortOrder="5" type="select" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="tax_including" translate="label" sortOrder="5" type="select" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Include Tax to Amount</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> <field id="name" translate="label" type="text" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Method Name</label> </field> - <field id="sort_order" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="sort_order" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1"> <label>Sort Order</label> <validate>validate-number validate-zero-or-greater</validate> </field> <field id="title" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Title</label> </field> - <field id="sallowspecific" translate="label" type="select" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="sallowspecific" translate="label" type="select" sortOrder="90" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Ship to Applicable Countries</label> <frontend_class>shipping-applicable-country</frontend_class> <source_model>Magento\Shipping\Model\Config\Source\Allspecificcountries</source_model> </field> - <field id="specificcountry" translate="label" type="multiselect" sortOrder="91" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="specificcountry" translate="label" type="multiselect" sortOrder="91" showInDefault="1" showInWebsite="1"> <label>Ship to Specific Countries</label> <source_model>Magento\Directory\Model\Config\Source\Country</source_model> <can_be_empty>1</can_be_empty> </field> - <field id="showmethod" translate="label" type="select" sortOrder="92" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="showmethod" translate="label" type="select" sortOrder="92" showInDefault="1" showInWebsite="1"> <label>Show Method if Not Applicable</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <frontend_class>shipping-skip-hide</frontend_class> diff --git a/app/code/Magento/PageCache/etc/adminhtml/system.xml b/app/code/Magento/PageCache/etc/adminhtml/system.xml index 234e3e48a95d8..4ffc20958748d 100644 --- a/app/code/Magento/PageCache/etc/adminhtml/system.xml +++ b/app/code/Magento/PageCache/etc/adminhtml/system.xml @@ -8,15 +8,15 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> <section id="system"> - <group id="full_page_cache" translate="label" showInDefault="1" showInWebsite="0" showInStore="0" sortOrder="600"> + <group id="full_page_cache" translate="label" showInDefault="1" sortOrder="600"> <label>Full Page Cache</label> - <field id="caching_application" translate="label" type="select" sortOrder="0" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="caching_application" translate="label" type="select" sortOrder="0" showInDefault="1" canRestore="1"> <label>Caching Application</label> <source_model>Magento\PageCache\Model\System\Config\Source\Application</source_model> </field> - <group id="varnish" translate="label" showInDefault="1" showInWebsite="0" showInStore="0" sortOrder="605"> + <group id="varnish" translate="label" showInDefault="1" sortOrder="605"> <label>Varnish Configuration</label> - <field id="access_list" type="text" translate="label comment" sortOrder="15" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="access_list" type="text" translate="label comment" sortOrder="15" showInDefault="1"> <label>Access list</label> <comment>IPs access list separated with ',' that can purge Varnish configuration for config file generation. If field is empty default value localhost will be saved.</comment> @@ -25,7 +25,7 @@ <field id="caching_application">1</field> </depends> </field> - <field id="backend_host" type="text" translate="label comment" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="backend_host" type="text" translate="label comment" sortOrder="20" showInDefault="1"> <label>Backend host</label> <comment>Specify backend host for config file generation. If field is empty default value localhost will be saved.</comment> <backend_model>Magento\PageCache\Model\System\Config\Backend\Varnish</backend_model> @@ -33,7 +33,7 @@ <field id="caching_application">1</field> </depends> </field> - <field id="backend_port" type="text" translate="label comment" sortOrder="25" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="backend_port" type="text" translate="label comment" sortOrder="25" showInDefault="1"> <label>Backend port</label> <comment>Specify backend port for config file generation. If field is empty default value 8080 will be saved.</comment> <backend_model>Magento\PageCache\Model\System\Config\Backend\Varnish</backend_model> @@ -41,7 +41,7 @@ <field id="caching_application">1</field> </depends> </field> - <field id="grace_period" type="text" translate="label comment" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="grace_period" type="text" translate="label comment" sortOrder="30" showInDefault="1"> <label>Grace period</label> <comment>Specify grace period in seconds for config file generation. If field is empty default value 300 will be saved. This grace period will be used to serve cached content when the server is healthy. If the server is not healthy, cached content will be served for 3 days before failing.</comment> <backend_model>Magento\PageCache\Model\System\Config\Backend\Varnish</backend_model> @@ -49,20 +49,20 @@ <field id="caching_application">1</field> </depends> </field> - <field id="export_button_version4" translate="label" type="button" sortOrder="35" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="export_button_version4" translate="label" type="button" sortOrder="35" showInDefault="1"> <label>Export Configuration</label> <frontend_model>Magento\PageCache\Block\System\Config\Form\Field\Export\Varnish4</frontend_model> <depends> <field id="caching_application">1</field> </depends> </field> - <field id="export_button_version5" type="button" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="export_button_version5" type="button" sortOrder="40" showInDefault="1"> <frontend_model>Magento\PageCache\Block\System\Config\Form\Field\Export\Varnish5</frontend_model> <depends> <field id="caching_application">1</field> </depends> </field> - <field id="export_button_version6" type="button" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="export_button_version6" type="button" sortOrder="40" showInDefault="1"> <frontend_model>Magento\PageCache\Block\System\Config\Form\Field\Export\Varnish6</frontend_model> <depends> <field id="caching_application">1</field> @@ -72,7 +72,7 @@ <field id="caching_application">2</field> </depends> </group> - <field id="ttl" type="text" translate="label comment" sortOrder="5" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="ttl" type="text" translate="label comment" sortOrder="5" showInDefault="1" canRestore="1"> <label>TTL for public content</label> <validate>validate-zero-or-greater validate-digits</validate> <comment>Public content cache lifetime in seconds. If field is empty default value 86400 will be saved. </comment> diff --git a/app/code/Magento/Payment/etc/adminhtml/system.xml b/app/code/Magento/Payment/etc/adminhtml/system.xml index d168dc13a397b..1e8b617d31326 100644 --- a/app/code/Magento/Payment/etc/adminhtml/system.xml +++ b/app/code/Magento/Payment/etc/adminhtml/system.xml @@ -13,33 +13,33 @@ <resource>Magento_Payment::payment</resource> <group id="free" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Zero Subtotal Checkout</label> - <field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Enabled</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="order_status" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="order_status" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" canRestore="1"> <label>New Order Status</label> <source_model>Magento\Sales\Model\Config\Source\Order\Status\Newprocessing</source_model> </field> - <field id="payment_action" translate="label" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="payment_action" translate="label" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Automatically Invoice All Items</label> <source_model>Magento\Payment\Model\Source\Invoice</source_model> <depends> <field id="order_status" separator=",">processing</field> </depends> </field> - <field id="sort_order" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="sort_order" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Sort Order</label> <frontend_class>validate-number</frontend_class> </field> <field id="title" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Title</label> </field> - <field id="allowspecific" translate="label" type="allowspecific" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="allowspecific" translate="label" type="allowspecific" sortOrder="50" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Payment from Applicable Countries</label> <source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model> </field> - <field id="specificcountry" translate="label" type="multiselect" sortOrder="51" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="specificcountry" translate="label" type="multiselect" sortOrder="51" showInDefault="1" showInWebsite="1"> <label>Payment from Specific Countries</label> <source_model>Magento\Directory\Model\Config\Source\Country</source_model> <can_be_empty>1</can_be_empty> diff --git a/app/code/Magento/Paypal/etc/adminhtml/system.xml b/app/code/Magento/Paypal/etc/adminhtml/system.xml index 88bb61f2cdc99..80e9523c752e4 100644 --- a/app/code/Magento/Paypal/etc/adminhtml/system.xml +++ b/app/code/Magento/Paypal/etc/adminhtml/system.xml @@ -8,10 +8,10 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> <section id="payment"> - <group id="account" translate="label" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0"> + <group id="account" translate="label" sortOrder="1" showInDefault="1" showInWebsite="1"> <label>Merchant Location</label> <frontend_model>Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded</frontend_model> - <field id="merchant_country" type="select" translate="label comment" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="merchant_country" type="select" translate="label comment" sortOrder="5" showInDefault="1" showInWebsite="1"> <label>Merchant Country</label> <comment>If not specified, Default Country from General Config will be used.</comment> <frontend_model>Magento\Paypal\Block\Adminhtml\System\Config\Field\Country</frontend_model> diff --git a/app/code/Magento/PaypalCaptcha/etc/adminhtml/system.xml b/app/code/Magento/PaypalCaptcha/etc/adminhtml/system.xml index 12afd8ceda60e..aa5eb371ba1a8 100644 --- a/app/code/Magento/PaypalCaptcha/etc/adminhtml/system.xml +++ b/app/code/Magento/PaypalCaptcha/etc/adminhtml/system.xml @@ -8,8 +8,8 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> <section id="customer"> - <group id="captcha" translate="label" type="text" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="0"> - <field id="forms" translate="label comment" type="multiselect" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <group id="captcha" translate="label" type="text" sortOrder="110" showInDefault="1" showInWebsite="1"> + <field id="forms" translate="label comment" type="multiselect" sortOrder="3" showInDefault="1" showInWebsite="1" canRestore="1"> <comment>CAPTCHA for "Create user", "Forgot password", "Payflow Pro" forms is always enabled if chosen.</comment> </field> </group> diff --git a/app/code/Magento/Persistent/etc/adminhtml/system.xml b/app/code/Magento/Persistent/etc/adminhtml/system.xml index 2db7cb0df0bd1..18882c0072877 100644 --- a/app/code/Magento/Persistent/etc/adminhtml/system.xml +++ b/app/code/Magento/Persistent/etc/adminhtml/system.xml @@ -7,46 +7,46 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> - <section id="persistent" translate="label" type="text" sortOrder="500" showInDefault="1" showInWebsite="1" showInStore="0"> + <section id="persistent" translate="label" type="text" sortOrder="500" showInDefault="1" showInWebsite="1"> <class>separator-top</class> <label>Persistent Shopping Cart</label> <tab>customer</tab> <resource>Magento_Persistent::persistent</resource> - <group id="options" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0"> + <group id="options" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1"> <label>General Options</label> - <field id="enabled" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="enabled" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Enable Persistence</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="lifetime" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="lifetime" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Persistence Lifetime (seconds)</label> <validate>validate-digits validate-digits-range digits-range-0-3153600000</validate> <depends> <field id="enabled">1</field> </depends> </field> - <field id="remember_enabled" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="remember_enabled" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Enable "Remember Me"</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <depends> <field id="enabled">1</field> </depends> </field> - <field id="remember_default" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="remember_default" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" canRestore="1"> <label>"Remember Me" Default Value</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <depends> <field id="enabled">1</field> </depends> </field> - <field id="logout_clear" translate="label" type="select" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="logout_clear" translate="label" type="select" sortOrder="50" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Clear Persistence on Sign Out</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <depends> <field id="enabled">1</field> </depends> </field> - <field id="shopping_cart" translate="label" type="select" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="shopping_cart" translate="label" type="select" sortOrder="60" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Persist Shopping Cart</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <depends> diff --git a/app/code/Magento/ProductAlert/etc/adminhtml/system.xml b/app/code/Magento/ProductAlert/etc/adminhtml/system.xml index edf4940ff504a..2af3b905d2faf 100644 --- a/app/code/Magento/ProductAlert/etc/adminhtml/system.xml +++ b/app/code/Magento/ProductAlert/etc/adminhtml/system.xml @@ -14,7 +14,7 @@ <label>Allow Alert When Product Price Changes</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="allow_stock" translate="label" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="allow_stock" translate="label" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Allow Alert When Product Comes Back in Stock</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> @@ -33,25 +33,25 @@ <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> </field> </group> - <group id="productalert_cron" translate="label" type="text" sortOrder="260" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="productalert_cron" translate="label" type="text" sortOrder="260" showInDefault="1"> <label>Product Alerts Run Settings</label> - <field id="frequency" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="frequency" translate="label" type="select" sortOrder="1" showInDefault="1"> <label>Frequency</label> <source_model>Magento\Cron\Model\Config\Source\Frequency</source_model> <backend_model>Magento\Cron\Model\Config\Backend\Product\Alert</backend_model> </field> - <field id="time" translate="label" type="time" sortOrder="2" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="time" translate="label" type="time" sortOrder="2" showInDefault="1"> <label>Start Time</label> </field> - <field id="error_email" translate="label" type="text" sortOrder="3" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="error_email" translate="label" type="text" sortOrder="3" showInDefault="1"> <label>Error Email Recipient</label> <validate>validate-email</validate> </field> - <field id="error_email_identity" translate="label" type="select" sortOrder="4" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="error_email_identity" translate="label" type="select" sortOrder="4" showInDefault="1" canRestore="1"> <label>Error Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> </field> - <field id="error_email_template" translate="label comment" type="select" sortOrder="5" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="error_email_template" translate="label comment" type="select" sortOrder="5" showInDefault="1" canRestore="1"> <label>Error Email Template</label> <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> diff --git a/app/code/Magento/ProductVideo/etc/adminhtml/system.xml b/app/code/Magento/ProductVideo/etc/adminhtml/system.xml index aa8749f69b409..aa70f3a5096c5 100644 --- a/app/code/Magento/ProductVideo/etc/adminhtml/system.xml +++ b/app/code/Magento/ProductVideo/etc/adminhtml/system.xml @@ -8,9 +8,9 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> <section id="catalog"> - <group id="product_video" translate="label" type="text" sortOrder="350" showInDefault="1" showInWebsite="1" showInStore="0"> + <group id="product_video" translate="label" type="text" sortOrder="350" showInDefault="1" showInWebsite="1"> <label>Product Video</label> - <field id="youtube_api_key" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="youtube_api_key" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1"> <label>YouTube API Key</label> </field> <field id="play_if_base" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> diff --git a/app/code/Magento/Reports/etc/adminhtml/system.xml b/app/code/Magento/Reports/etc/adminhtml/system.xml index 40eba9f3a6bb2..66507afda5b3b 100644 --- a/app/code/Magento/Reports/etc/adminhtml/system.xml +++ b/app/code/Magento/Reports/etc/adminhtml/system.xml @@ -8,9 +8,9 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> <section id="catalog"> - <group id="recently_products" translate="label" type="text" sortOrder="350" showInDefault="1" showInWebsite="1" showInStore="0"> + <group id="recently_products" translate="label" type="text" sortOrder="350" showInDefault="1" showInWebsite="1"> <label>Recently Viewed/Compared Products</label> - <field id="scope" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="scope" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Show for Current</label> <source_model>Magento\Config\Model\Config\Source\Reports\Scope</source_model> <hide_in_single_store_mode>1</hide_in_single_store_mode> @@ -25,30 +25,30 @@ </field> </group> </section> - <section id="reports" translate="label" type="text" sortOrder="1000" showInDefault="1" showInWebsite="0" showInStore="0"> + <section id="reports" translate="label" type="text" sortOrder="1000" showInDefault="1"> <label>Reports</label> <tab>general</tab> <resource>Magento_Reports::reports</resource> - <group id="dashboard" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="dashboard" translate="label" type="text" sortOrder="1" showInDefault="1"> <label>Dashboard</label> - <field id="ytd_start" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="ytd_start" translate="label" type="select" sortOrder="1" showInDefault="1" canRestore="1"> <label>Year-To-Date Starts</label> <frontend_model>Magento\Reports\Block\Adminhtml\Config\Form\Field\YtdStart</frontend_model> </field> - <field id="mtd_start" translate="label comment" type="select" sortOrder="2" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="mtd_start" translate="label comment" type="select" sortOrder="2" showInDefault="1" canRestore="1"> <label>Current Month Starts</label> <frontend_model>Magento\Reports\Block\Adminhtml\Config\Form\Field\MtdStart</frontend_model> <comment>Select day of the month.</comment> </field> </group> - <group id="options" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="options" translate="label" type="text" sortOrder="1" showInDefault="1"> <label>General Options</label> - <field id="enabled" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="enabled" translate="label comment" type="select" sortOrder="1" showInDefault="1" canRestore="1"> <label>Enable Reports</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <comment>If disabled, all report events will be disabled</comment> </field> - <field id="product_view_enabled" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="product_view_enabled" translate="label comment" type="select" sortOrder="1" showInDefault="1"> <label>Enable "Product View" Report</label> <comment>If enabled, will collect statistic of viewed product pages</comment> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> @@ -56,7 +56,7 @@ <field id="enabled">1</field> </depends> </field> - <field id="product_send_enabled" translate="label comment" type="select" sortOrder="2" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="product_send_enabled" translate="label comment" type="select" sortOrder="2" showInDefault="1"> <label>Enable "Send Product Link To Friend" Report</label> <comment>If enabled, will collect statistic of product links sent to friend</comment> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> @@ -64,7 +64,7 @@ <field id="enabled">1</field> </depends> </field> - <field id="product_compare_enabled" translate="label comment" type="select" sortOrder="3" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="product_compare_enabled" translate="label comment" type="select" sortOrder="3" showInDefault="1"> <label>Enable "Add Product To Compare List" Report</label> <comment>If enabled, will collect statistic of products added to Compare List</comment> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> @@ -72,7 +72,7 @@ <field id="enabled">1</field> </depends> </field> - <field id="product_to_cart_enabled" translate="label comment" type="select" sortOrder="4" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="product_to_cart_enabled" translate="label comment" type="select" sortOrder="4" showInDefault="1"> <label>Enable "Product Added To Cart" Report</label> <comment>If enabled, will collect statistic of products added to Cart</comment> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> @@ -80,7 +80,7 @@ <field id="enabled">1</field> </depends> </field> - <field id="product_to_wishlist_enabled" translate="label comment" type="select" sortOrder="5" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="product_to_wishlist_enabled" translate="label comment" type="select" sortOrder="5" showInDefault="1"> <label>Enable "Product Added To WishList" Report</label> <comment>If enabled, will collect statistic of products added to WishList</comment> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> @@ -88,7 +88,7 @@ <field id="enabled">1</field> </depends> </field> - <field id="wishlist_share_enabled" translate="label comment" type="select" sortOrder="6" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="wishlist_share_enabled" translate="label comment" type="select" sortOrder="6" showInDefault="1"> <label>Enable "Share WishList" Report</label> <comment>If enabled, will collect statistic of shared WishLists</comment> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> diff --git a/app/code/Magento/Review/etc/adminhtml/system.xml b/app/code/Magento/Review/etc/adminhtml/system.xml index a24ed29dc2c23..1ddae2118c5a7 100644 --- a/app/code/Magento/Review/etc/adminhtml/system.xml +++ b/app/code/Magento/Review/etc/adminhtml/system.xml @@ -8,15 +8,18 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> <section id="catalog"> - <group id="review" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="0"> + <group id="review" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1"> <label>Product Reviews</label> <field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Enabled</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="allow_guest" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="allow_guest" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Allow Guests to Write Reviews</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> + <depends> + <field id="active">1</field> + </depends> </field> </group> </section> diff --git a/app/code/Magento/Sales/etc/adminhtml/system.xml b/app/code/Magento/Sales/etc/adminhtml/system.xml index 473d3068d69c7..84caeca093bad 100644 --- a/app/code/Magento/Sales/etc/adminhtml/system.xml +++ b/app/code/Magento/Sales/etc/adminhtml/system.xml @@ -17,31 +17,31 @@ <resource>Magento_Sales::config_sales</resource> <group id="general" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1"> <label>General</label> - <field id="hide_customer_ip" translate="label comment" type="select" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="hide_customer_ip" translate="label comment" type="select" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Hide Customer IP</label> <comment>Choose whether a customer IP is shown in orders, invoices, shipments, and credit memos.</comment> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> </group> - <group id="totals_sort" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0"> + <group id="totals_sort" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1"> <label>Checkout Totals Sort Order</label> - <field id="discount" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="discount" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Discount</label> <validate>required-number validate-number</validate> </field> - <field id="grand_total" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="grand_total" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Grand Total</label> <validate>required-number validate-number</validate> </field> - <field id="shipping" translate="label" type="text" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="shipping" translate="label" type="text" sortOrder="3" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Shipping</label> <validate>required-number validate-number</validate> </field> - <field id="subtotal" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="subtotal" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Subtotal</label> <validate>required-number validate-number</validate> </field> - <field id="tax" translate="label" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="tax" translate="label" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Tax</label> <validate>required-number validate-number</validate> </field> @@ -86,21 +86,21 @@ </group> <group id="minimum_order" translate="label" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Minimum Order Amount</label> - <field id="active" translate="label" sortOrder="5" type="select" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="active" translate="label" sortOrder="5" type="select" showInDefault="1" showInWebsite="1"> <label>Enable</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="amount" translate="label comment" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="amount" translate="label comment" sortOrder="10" showInDefault="1" showInWebsite="1"> <label>Minimum Amount</label> <validate>validate-number validate-greater-than-zero</validate> <comment>Subtotal after discount.</comment> </field> - <field id="include_discount_amount" translate="label" sortOrder="12" type="select" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="include_discount_amount" translate="label" sortOrder="12" type="select" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Include Discount Amount</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <comment>Choosing yes will be used subtotal after discount, otherwise only subtotal will be used.</comment> </field> - <field id="tax_including" translate="label" sortOrder="15" type="select" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="tax_including" translate="label" sortOrder="15" type="select" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Include Tax to Amount</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> @@ -111,7 +111,7 @@ <field id="error_message" translate="label" sortOrder="30" type="textarea" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Error to Show in Shopping Cart</label> </field> - <field id="multi_address" translate="label" sortOrder="40" type="select" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="multi_address" translate="label" sortOrder="40" type="select" showInDefault="1" showInWebsite="1"> <label>Validate Each Address Separately in Multi-address Checkout</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> @@ -124,17 +124,17 @@ <comment>We'll use the default error above if you leave this empty.</comment> </field> </group> - <group id="dashboard" translate="label" sortOrder="60" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="dashboard" translate="label" sortOrder="60" showInDefault="1"> <label>Dashboard</label> - <field id="use_aggregated_data" translate="label comment" sortOrder="10" type="select" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="use_aggregated_data" translate="label comment" sortOrder="10" type="select" showInDefault="1" canRestore="1"> <label>Use Aggregated Data</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <comment>Improves dashboard performance but provides non-realtime data.</comment> </field> </group> - <group id="orders" translate="label" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="0"> + <group id="orders" translate="label" sortOrder="70" showInDefault="1" showInWebsite="1"> <label>Orders Cron Settings</label> - <field id="delete_pending_after" translate="label" type="text" sortOrder="6" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="delete_pending_after" translate="label" type="text" sortOrder="6" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Pending Payment Order Lifetime (minutes)</label> <validate>validate-number validate-greater-than-zero</validate> </field> @@ -144,14 +144,14 @@ <label>Sales Emails</label> <tab>sales</tab> <resource>Magento_Sales::sales_email</resource> - <group id="general" type="text" sortOrder="0" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="general" type="text" sortOrder="0" showInDefault="1"> <label>General Settings</label> - <field id="async_sending" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="async_sending" translate="label" type="select" sortOrder="1" showInDefault="1" canRestore="1"> <label>Asynchronous sending</label> <source_model>Magento\Config\Model\Config\Source\Enabledisable</source_model> <backend_model>Magento\Sales\Model\Config\Backend\Email\AsyncSending</backend_model> </field> - <field id="sending_limit" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="sending_limit" translate="label" type="text" sortOrder="2" showInDefault="1" canRestore="1"> <label>Limit per cron run</label> <comment>Limit how many entities (orders/shipments/etc) will be processed during one cron run.</comment> <validate>required-number validate-number validate-greater-than-zero</validate> @@ -169,25 +169,40 @@ <field id="identity" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>New Order Confirmation Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="template" translate="label comment" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>New Order Confirmation Template</label> <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="guest_template" translate="label comment" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>New Order Confirmation Template for Guest</label> <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="copy_to" translate="label comment" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Send Order Email Copy To</label> <comment>Comma-separated.</comment> <validate>validate-emails</validate> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="copy_method" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Send Order Email Copy Method</label> <source_model>Magento\Config\Model\Config\Source\Email\Method</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> </group> <group id="order_comment" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1"> @@ -199,25 +214,40 @@ <field id="identity" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Order Comment Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="template" translate="label comment" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Order Comment Email Template</label> <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="guest_template" translate="label comment" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Order Comment Email Template for Guest</label> <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="copy_to" translate="label comment" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Send Order Comment Email Copy To</label> <comment>Comma-separated.</comment> <validate>validate-emails</validate> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="copy_method" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Send Order Comments Email Copy Method</label> <source_model>Magento\Config\Model\Config\Source\Email\Method</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> </group> <group id="invoice" translate="label" type="text" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1"> @@ -229,25 +259,40 @@ <field id="identity" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Invoice Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="template" translate="label comment" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Invoice Email Template</label> <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="guest_template" translate="label comment" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Invoice Email Template for Guest</label> <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="copy_to" translate="label comment" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Send Invoice Email Copy To</label> <comment>Comma-separated.</comment> <validate>validate-emails</validate> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="copy_method" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Send Invoice Email Copy Method</label> <source_model>Magento\Config\Model\Config\Source\Email\Method</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> </group> <group id="invoice_comment" translate="label" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1"> @@ -259,25 +304,40 @@ <field id="identity" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Invoice Comment Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="template" translate="label comment" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Invoice Comment Email Template</label> <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="guest_template" translate="label comment" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Invoice Comment Email Template for Guest</label> <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="copy_to" translate="label comment" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Send Invoice Comment Email Copy To</label> <comment>Comma-separated.</comment> <validate>validate-emails</validate> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="copy_method" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Send Invoice Comments Email Copy Method</label> <source_model>Magento\Config\Model\Config\Source\Email\Method</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> </group> <group id="shipment" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1"> @@ -289,25 +349,40 @@ <field id="identity" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Shipment Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="template" translate="label comment" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Shipment Email Template</label> <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="guest_template" translate="label comment" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Shipment Email Template for Guest</label> <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="copy_to" translate="label comment" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Send Shipment Email Copy To</label> <comment>Comma-separated.</comment> <validate>validate-emails</validate> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="copy_method" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Send Shipment Email Copy Method</label> <source_model>Magento\Config\Model\Config\Source\Email\Method</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> </group> <group id="shipment_comment" translate="label" type="text" sortOrder="6" showInDefault="1" showInWebsite="1" showInStore="1"> @@ -319,25 +394,40 @@ <field id="identity" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Shipment Comment Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="template" translate="label comment" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Shipment Comment Email Template</label> <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="guest_template" translate="label comment" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Shipment Comment Email Template for Guest</label> <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="copy_to" translate="label comment" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Send Shipment Comment Email Copy To</label> <comment>Comma-separated.</comment> <validate>validate-emails</validate> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="copy_method" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Send Shipment Comments Email Copy Method</label> <source_model>Magento\Config\Model\Config\Source\Email\Method</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> </group> <group id="creditmemo" translate="label" type="text" sortOrder="7" showInDefault="1" showInWebsite="1" showInStore="1"> @@ -349,25 +439,40 @@ <field id="identity" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Credit Memo Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="template" translate="label comment" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Credit Memo Email Template</label> <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="guest_template" translate="label comment" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Credit Memo Email Template for Guest</label> <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="copy_to" translate="label comment" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Send Credit Memo Email Copy To</label> <comment>Comma-separated.</comment> <validate>validate-emails</validate> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="copy_method" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Send Credit Memo Email Copy Method</label> <source_model>Magento\Config\Model\Config\Source\Email\Method</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> </group> <group id="creditmemo_comment" translate="label" type="text" sortOrder="8" showInDefault="1" showInWebsite="1" showInStore="1"> @@ -379,25 +484,40 @@ <field id="identity" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Credit Memo Comment Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="template" translate="label comment" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Credit Memo Comment Email Template</label> <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="guest_template" translate="label comment" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Credit Memo Comment Email Template for Guest</label> <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="copy_to" translate="label comment" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Send Credit Memo Comment Email Copy To</label> <comment>Comma-separated.</comment> <validate>validate-emails</validate> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="copy_method" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Send Credit Memo Comments Email Copy Method</label> <source_model>Magento\Config\Model\Config\Source\Email\Method</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> </group> </section> @@ -437,9 +557,9 @@ </group> </section> <section id="dev"> - <group id="grid" translate="label" type="text" sortOrder="131" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="grid" translate="label" type="text" sortOrder="131" showInDefault="1"> <label>Grid Settings</label> - <field id="async_indexing" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="async_indexing" translate="label" type="select" sortOrder="1" showInDefault="1" canRestore="1"> <label>Asynchronous indexing</label> <source_model>Magento\Config\Model\Config\Source\Enabledisable</source_model> <backend_model>Magento\Sales\Model\Config\Backend\Grid\AsyncIndexing</backend_model> diff --git a/app/code/Magento/Sales/etc/config.xml b/app/code/Magento/Sales/etc/config.xml index 2480da4ad214b..6918146d86337 100644 --- a/app/code/Magento/Sales/etc/config.xml +++ b/app/code/Magento/Sales/etc/config.xml @@ -8,6 +8,9 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd"> <default> <sales> + <general> + <hide_customer_ip>0</hide_customer_ip> + </general> <totals_sort> <discount>20</discount> <grand_total>100</grand_total> diff --git a/app/code/Magento/SalesRule/etc/adminhtml/system.xml b/app/code/Magento/SalesRule/etc/adminhtml/system.xml index 0e30d1484c637..2655add5f8bbf 100644 --- a/app/code/Magento/SalesRule/etc/adminhtml/system.xml +++ b/app/code/Magento/SalesRule/etc/adminhtml/system.xml @@ -7,29 +7,29 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> - <section id="promo" translate="label" type="text" sortOrder="400" showInDefault="1" showInWebsite="0" showInStore="0"> + <section id="promo" translate="label" type="text" sortOrder="400" showInDefault="1"> <class>separator-top</class> <label>Promotions</label> <tab>customer</tab> <resource>Magento_SalesRule::config_promo</resource> <group id="auto_generated_coupon_codes" translate="label" showInDefault="1" sortOrder="10"> <label>Auto Generated Specific Coupon Codes</label> - <field id="length" translate="label comment" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="length" translate="label comment" type="text" sortOrder="10" showInDefault="1" canRestore="1"> <label>Code Length</label> <comment>Excluding prefix, suffix and separators.</comment> <frontend_class>validate-digits</frontend_class> </field> - <field id="format" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="format" translate="label" type="select" sortOrder="20" showInDefault="1" canRestore="1"> <label>Code Format</label> <source_model>Magento\SalesRule\Model\System\Config\Source\Coupon\Format</source_model> </field> - <field id="prefix" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="prefix" translate="label" type="text" sortOrder="30" showInDefault="1"> <label>Code Prefix</label> </field> - <field id="suffix" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="suffix" translate="label" type="text" sortOrder="40" showInDefault="1"> <label>Code Suffix</label> </field> - <field id="dash" translate="label comment" type="text" sortOrder="50" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="dash" translate="label comment" type="text" sortOrder="50" showInDefault="1"> <label>Dash Every X Characters</label> <comment>If empty no separation.</comment> <frontend_class>validate-digits</frontend_class> diff --git a/app/code/Magento/Search/etc/adminhtml/system.xml b/app/code/Magento/Search/etc/adminhtml/system.xml index d3b7f64fbe0c4..8a539c9528e8e 100644 --- a/app/code/Magento/Search/etc/adminhtml/system.xml +++ b/app/code/Magento/Search/etc/adminhtml/system.xml @@ -9,7 +9,7 @@ <system> <section id="catalog"> <group id="search"> - <field id="engine" translate="label" type="select" sortOrder="19" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="engine" translate="label" type="select" sortOrder="19" showInDefault="1"> <label>Search Engine</label> <source_model>Magento\Search\Model\Adminhtml\System\Config\Source\Engine</source_model> </field> diff --git a/app/code/Magento/SendFriend/etc/adminhtml/system.xml b/app/code/Magento/SendFriend/etc/adminhtml/system.xml index 5cace4bcf92db..6360c42655a09 100644 --- a/app/code/Magento/SendFriend/etc/adminhtml/system.xml +++ b/app/code/Magento/SendFriend/etc/adminhtml/system.xml @@ -24,22 +24,37 @@ <label>Select Email Template</label> <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="allow_guest" translate="label" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Allow for Guests</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="max_recipients" translate="label" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Max Recipients</label> <frontend_class>validate-digits</frontend_class> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="max_per_hour" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Max Products Sent in 1 Hour</label> <frontend_class>validate-digits</frontend_class> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="check_by" translate="label" type="select" sortOrder="6" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Limit Sending By</label> <source_model>Magento\SendFriend\Model\Source\Checktype</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> </group> </section> diff --git a/app/code/Magento/Shipping/etc/adminhtml/system.xml b/app/code/Magento/Shipping/etc/adminhtml/system.xml index b0d38bc0d61a1..29862bdcfc8b1 100644 --- a/app/code/Magento/Shipping/etc/adminhtml/system.xml +++ b/app/code/Magento/Shipping/etc/adminhtml/system.xml @@ -11,32 +11,32 @@ <label>Shipping Settings</label> <tab>sales</tab> <resource>Magento_Shipping::config_shipping</resource> - <group id="origin" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0"> + <group id="origin" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1"> <label>Origin</label> - <field id="country_id" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="country_id" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Country</label> <frontend_class>countries</frontend_class> <source_model>Magento\Directory\Model\Config\Source\Country</source_model> </field> - <field id="region_id" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="region_id" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Region/State</label> </field> - <field id="postcode" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="postcode" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" canRestore="1"> <label>ZIP/Postal Code</label> </field> - <field id="city" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="city" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="1"> <label>City</label> </field> - <field id="street_line1" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="street_line1" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1"> <label>Street Address</label> </field> - <field id="street_line2" translate="label" type="text" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="street_line2" translate="label" type="text" sortOrder="60" showInDefault="1" showInWebsite="1"> <label>Street Address Line 2</label> </field> </group> <group id="shipping_policy" translate="label" type="text" sortOrder="120" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Shipping Policy Parameters</label> - <field id="enable_shipping_policy" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="enable_shipping_policy" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Apply custom Shipping Policy</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> diff --git a/app/code/Magento/Shipping/etc/config.xml b/app/code/Magento/Shipping/etc/config.xml index 4c2e018191b59..e1a71ef9741bb 100644 --- a/app/code/Magento/Shipping/etc/config.xml +++ b/app/code/Magento/Shipping/etc/config.xml @@ -13,6 +13,9 @@ <postcode>90034</postcode> <region_id>12</region_id> </origin> + <shipping_policy> + <enable_shipping_policy>0</enable_shipping_policy> + </shipping_policy> </shipping> </default> </config> diff --git a/app/code/Magento/Signifyd/etc/adminhtml/system.xml b/app/code/Magento/Signifyd/etc/adminhtml/system.xml index 272ce78aec2e5..182a67e4e1f35 100644 --- a/app/code/Magento/Signifyd/etc/adminhtml/system.xml +++ b/app/code/Magento/Signifyd/etc/adminhtml/system.xml @@ -11,9 +11,9 @@ <label>Fraud Protection</label> <tab>sales</tab> <resource>Magento_Sales::fraud_protection</resource> - <group id="signifyd" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0"> + <group id="signifyd" type="text" sortOrder="10" showInDefault="1" showInWebsite="1"> <fieldset_css>signifyd-logo-header</fieldset_css> - <group id="about" translate="label comment" sortOrder="15" showInDefault="1" showInWebsite="1" showInStore="0"> + <group id="about" translate="label comment" sortOrder="15" showInDefault="1" showInWebsite="1"> <frontend_model>Magento\Signifyd\Block\Adminhtml\System\Config\Fieldset\Info</frontend_model> <fieldset_css>signifyd-about-header</fieldset_css> <label><![CDATA[Protect your store from fraud with Guaranteed Fraud Protection by Signifyd.]]></label> @@ -26,17 +26,17 @@ </comment> <more_url>https://www.signifyd.com/magento-guaranteed-fraud-protection</more_url> </group> - <group id="config" translate="label comment" sortOrder="15" showInDefault="1" showInWebsite="1" showInStore="0"> + <group id="config" translate="label comment" sortOrder="15" showInDefault="1" showInWebsite="1"> <fieldset_css>signifyd-about-header</fieldset_css> <label>Configuration</label> <comment><![CDATA[<a href="https://www.signifyd.com/resources/manual/magento-2/signifyd-on-magento-integration-guide/" target="_blank">View our setup guide</a> for step-by-step instructions on how to integrate Signifyd with Magento.<br />For support contact <a href="mailto:support@signifyd.com">support@signifyd.com</a>.]]> </comment> - <field id="active" translate="label" type="select" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="active" translate="label" type="select" showInDefault="1" showInWebsite="1"> <label>Enable this Solution</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <config_path>fraud_protection/signifyd/active</config_path> </field> - <field id="api_key" translate="label" type="obscure" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="api_key" translate="label" type="obscure" sortOrder="20" showInDefault="1" showInWebsite="1"> <label>API Key</label> <comment><![CDATA[Your API key can be found on the <a href="http://signifyd.com/settings" target="_blank">settings page</a> in the Signifyd console.]]></comment> <config_path>fraud_protection/signifyd/api_key</config_path> @@ -45,7 +45,7 @@ <field id="active">1</field> </depends> </field> - <field id="api_url" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="api_url" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1"> <label>API URL</label> <config_path>fraud_protection/signifyd/api_url</config_path> <comment>Don’t change unless asked to do so.</comment> @@ -53,7 +53,7 @@ <field id="active">1</field> </depends> </field> - <field id="debug" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="debug" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="1"> <label>Debug</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <config_path>fraud_protection/signifyd/debug</config_path> @@ -61,7 +61,7 @@ <field id="active">1</field> </depends> </field> - <field id="webhook_url" translate="label comment" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="webhook_url" translate="label comment" type="text" sortOrder="50" showInDefault="1" showInWebsite="1"> <label>Webhook URL</label> <comment><![CDATA[Your webhook URL will be used to <a href="https://app.signifyd.com/settings/notifications" target="_blank">configure</a> a guarantee completed webhook in Signifyd. Webhooks are used to sync Signifyd`s guarantee decisions back to Magento.]]></comment> <attribute type="handler_url">signifyd/webhooks/handler</attribute> diff --git a/app/code/Magento/Sitemap/etc/adminhtml/system.xml b/app/code/Magento/Sitemap/etc/adminhtml/system.xml index c3c9c85027354..57c426c68e83f 100644 --- a/app/code/Magento/Sitemap/etc/adminhtml/system.xml +++ b/app/code/Magento/Sitemap/etc/adminhtml/system.xml @@ -51,7 +51,7 @@ <comment>Valid values range from 0.0 to 1.0.</comment> </field> </group> - <group id="generate" translate="label" type="text" sortOrder="4" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="generate" translate="label" type="text" sortOrder="4" showInDefault="1"> <label>Generation Settings</label> <field id="enabled" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Enabled</label> @@ -60,23 +60,38 @@ <field id="error_email" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Error Email Recipient</label> <validate>validate-email</validate> + <depends> + <field id="enabled">1</field> + </depends> </field> - <field id="error_email_identity" translate="label" type="select" sortOrder="6" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="error_email_identity" translate="label" type="select" sortOrder="6" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Error Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> - <field id="error_email_template" translate="label comment" type="select" sortOrder="7" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="error_email_template" translate="label comment" type="select" sortOrder="7" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Error Email Template</label> <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="frequency" translate="label" type="select" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Frequency</label> <source_model>Magento\Cron\Model\Config\Source\Frequency</source_model> <backend_model>Magento\Cron\Model\Config\Backend\Sitemap</backend_model> + <depends> + <field id="enabled">1</field> + </depends> </field> <field id="time" translate="label" type="time" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Start Time</label> + <depends> + <field id="enabled">1</field> + </depends> </field> </group> <group id="limit" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1"> diff --git a/app/code/Magento/Tax/etc/adminhtml/system.xml b/app/code/Magento/Tax/etc/adminhtml/system.xml index 7fc1744b8e27e..c1e1286041ce6 100644 --- a/app/code/Magento/Tax/etc/adminhtml/system.xml +++ b/app/code/Magento/Tax/etc/adminhtml/system.xml @@ -14,59 +14,59 @@ <resource>Magento_Tax::config_tax</resource> <group id="classes" translate="label" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Tax Classes</label> - <field id="shipping_tax_class" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="shipping_tax_class" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Tax Class for Shipping</label> <source_model>Magento\Tax\Model\TaxClass\Source\Product</source_model> </field> - <field id="default_product_tax_class" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="default_product_tax_class" translate="label" type="select" sortOrder="20" showInDefault="1" canRestore="1"> <label>Default Tax Class for Product</label> <source_model>Magento\Tax\Model\TaxClass\Source\Product</source_model> <backend_model>Magento\Tax\Model\Config\TaxClass</backend_model> </field> - <field id="default_customer_tax_class" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="default_customer_tax_class" translate="label" type="select" sortOrder="30" showInDefault="1" canRestore="1"> <label>Default Tax Class for Customer</label> <source_model>Magento\Tax\Model\TaxClass\Source\Customer</source_model> </field> </group> <group id="calculation" translate="label" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Calculation Settings</label> - <field id="algorithm" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="algorithm" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Tax Calculation Method Based On</label> <source_model>Magento\Tax\Model\System\Config\Source\Algorithm</source_model> </field> - <field id="based_on" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="based_on" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Tax Calculation Based On</label> <source_model>Magento\Tax\Model\Config\Source\Basedon</source_model> <backend_model>Magento\Tax\Model\Config\Notification</backend_model> </field> - <field id="price_includes_tax" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="price_includes_tax" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Catalog Prices</label> <comment>This sets whether catalog prices entered from Magento Admin include tax.</comment> <backend_model>Magento\Tax\Model\Config\Price\IncludePrice</backend_model> <source_model>Magento\Tax\Model\System\Config\Source\PriceType</source_model> </field> - <field id="shipping_includes_tax" translate="label comment" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="shipping_includes_tax" translate="label comment" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Shipping Prices</label> <comment>This sets whether shipping amounts entered from Magento Admin or obtained from gateways include tax.</comment> <backend_model>Magento\Tax\Model\Config\Price\IncludePrice</backend_model> <source_model>Magento\Tax\Model\System\Config\Source\PriceType</source_model> </field> - <field id="apply_after_discount" translate="label comment" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="apply_after_discount" translate="label comment" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Apply Customer Tax</label> <source_model>Magento\Tax\Model\System\Config\Source\Apply</source_model> <backend_model>Magento\Tax\Model\Config\Notification</backend_model> </field> - <field id="discount_tax" translate="label comment" type="select" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="discount_tax" translate="label comment" type="select" sortOrder="50" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Apply Discount On Prices</label> <source_model>Magento\Tax\Model\System\Config\Source\PriceType</source_model> <backend_model>Magento\Tax\Model\Config\Notification</backend_model> <comment>Warning: To apply the discount on prices including tax and apply the tax after discount, set Catalog Prices to “Including Tax”.</comment> </field> - <field id="apply_tax_on" translate="label" type="select" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="apply_tax_on" translate="label" type="select" sortOrder="60" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Apply Tax On</label> <source_model>Magento\Tax\Model\Config\Source\Apply\On</source_model> </field> - <field id="cross_border_trade_enabled" translate="label comment" type="select" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="cross_border_trade_enabled" translate="label comment" type="select" sortOrder="70" showInDefault="1" showInWebsite="1"> <label>Enable Cross Border Trade</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <comment>When catalog price includes tax, enable this setting to fix the price no matter what the customer's tax rate.</comment> diff --git a/app/code/Magento/Translation/etc/adminhtml/system.xml b/app/code/Magento/Translation/etc/adminhtml/system.xml index ab854f8a4db52..b19ac5d1bfb09 100644 --- a/app/code/Magento/Translation/etc/adminhtml/system.xml +++ b/app/code/Magento/Translation/etc/adminhtml/system.xml @@ -9,7 +9,7 @@ <system> <section id="dev"> <group id="js"> - <field id="translate_strategy" translate="label comment" type="select" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="translate_strategy" translate="label comment" type="select" sortOrder="30" showInDefault="1" canRestore="1"> <label>Translation Strategy</label> <source_model>Magento\Translation\Model\Js\Config\Source\Strategy</source_model> <comment>Please put your store into maintenance mode and redeploy static files after changing strategy</comment> diff --git a/app/code/Magento/Ui/etc/adminhtml/system.xml b/app/code/Magento/Ui/etc/adminhtml/system.xml index ab4272f8d2a34..77af492c70b36 100644 --- a/app/code/Magento/Ui/etc/adminhtml/system.xml +++ b/app/code/Magento/Ui/etc/adminhtml/system.xml @@ -9,12 +9,12 @@ <system> <section id="dev"> <group id="js"> - <field id="session_storage_logging" translate="label comment" type="select" sortOrder="100" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="session_storage_logging" translate="label comment" type="select" sortOrder="100" showInDefault="1" canRestore="1"> <label>Log JS Errors to Session Storage</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <comment>If enabled, can be used by functional tests for extended reporting</comment> </field> - <field id="session_storage_key" translate="label comment" type="text" sortOrder="110" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="session_storage_key" translate="label comment" type="text" sortOrder="110" showInDefault="1" canRestore="1"> <label>Log JS Errors to Session Storage Key</label> <comment>Use this key to retrieve collected js errors</comment> </field> diff --git a/app/code/Magento/Ups/etc/adminhtml/system.xml b/app/code/Magento/Ups/etc/adminhtml/system.xml index c6a2516e96170..3a1676d221977 100644 --- a/app/code/Magento/Ups/etc/adminhtml/system.xml +++ b/app/code/Magento/Ups/etc/adminhtml/system.xml @@ -10,147 +10,147 @@ <section id="carriers"> <group id="ups" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1"> <label>UPS</label> - <field id="access_license_number" translate="label" type="obscure" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="access_license_number" translate="label" type="obscure" sortOrder="30" showInDefault="1" showInWebsite="1"> <label>Access License Number</label> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> <depends> <field id="carriers/ups/active">1</field> </depends> </field> - <field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Enabled for Checkout</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="allowed_methods" translate="label" type="multiselect" sortOrder="170" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="allowed_methods" translate="label" type="multiselect" sortOrder="170" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Allowed Methods</label> <source_model>Magento\Ups\Model\Config\Source\Method</source_model> <can_be_empty>1</can_be_empty> </field> - <field id="shipment_requesttype" translate="label" type="select" sortOrder="47" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="shipment_requesttype" translate="label" type="select" sortOrder="47" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Packages Request Type</label> <source_model>Magento\Shipping\Model\Config\Source\Online\Requesttype</source_model> </field> - <field id="container" translate="label" type="select" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="container" translate="label" type="select" sortOrder="50" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Container</label> <source_model>Magento\Ups\Model\Config\Source\Container</source_model> </field> - <field id="free_shipping_enable" translate="label" type="select" sortOrder="210" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="free_shipping_enable" translate="label" type="select" sortOrder="210" showInDefault="1" showInWebsite="1"> <label>Enable Free Shipping Threshold</label> <source_model>Magento\Config\Model\Config\Source\Enabledisable</source_model> </field> - <field id="free_shipping_subtotal" translate="label" type="text" sortOrder="220" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="free_shipping_subtotal" translate="label" type="text" sortOrder="220" showInDefault="1" showInWebsite="1"> <label>Free Shipping Amount Threshold</label> <validate>validate-number validate-zero-or-greater</validate> <depends> <field id="free_shipping_enable">1</field> </depends> </field> - <field id="dest_type" translate="label" type="select" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="dest_type" translate="label" type="select" sortOrder="60" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Destination Type</label> <source_model>Magento\Ups\Model\Config\Source\DestType</source_model> </field> - <field id="free_method" translate="label" type="select" sortOrder="200" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="free_method" translate="label" type="select" sortOrder="200" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Free Method</label> <frontend_class>free-method</frontend_class> <source_model>Magento\Ups\Model\Config\Source\Freemethod</source_model> </field> - <field id="gateway_url" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="gateway_url" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Gateway URL</label> <backend_model>Magento\Ups\Model\Config\Backend\UpsUrl</backend_model> </field> - <field id="gateway_xml_url" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="gateway_xml_url" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Gateway XML URL</label> <backend_model>Magento\Ups\Model\Config\Backend\UpsUrl</backend_model> </field> - <field id="handling_type" translate="label" type="select" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="handling_type" translate="label" type="select" sortOrder="110" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Calculate Handling Fee</label> <source_model>Magento\Shipping\Model\Source\HandlingType</source_model> </field> - <field id="handling_action" translate="label" type="select" sortOrder="120" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="handling_action" translate="label" type="select" sortOrder="120" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Handling Applied</label> <source_model>Magento\Shipping\Model\Source\HandlingAction</source_model> </field> - <field id="handling_fee" translate="label" type="text" sortOrder="130" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="handling_fee" translate="label" type="text" sortOrder="130" showInDefault="1" showInWebsite="1"> <label>Handling Fee</label> <validate>validate-number validate-zero-or-greater</validate> </field> - <field id="max_package_weight" translate="label" type="text" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="max_package_weight" translate="label" type="text" sortOrder="80" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Maximum Package Weight (Please consult your shipping carrier for maximum supported shipping weight)</label> <validate>validate-number validate-zero-or-greater</validate> </field> - <field id="min_package_weight" translate="label" type="text" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="min_package_weight" translate="label" type="text" sortOrder="90" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Minimum Package Weight (Please consult your shipping carrier for minimum supported shipping weight)</label> <validate>validate-number validate-zero-or-greater</validate> </field> - <field id="origin_shipment" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="origin_shipment" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Origin of the Shipment</label> <source_model>Magento\Ups\Model\Config\Source\OriginShipment</source_model> </field> - <field id="password" translate="label" type="obscure" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="password" translate="label" type="obscure" sortOrder="30" showInDefault="1" showInWebsite="1"> <label>Password</label> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> <depends> <field id="carriers/ups/active">1</field> </depends> </field> - <field id="pickup" translate="label" type="select" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="pickup" translate="label" type="select" sortOrder="80" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Pickup Method</label> <source_model>Magento\Ups\Model\Config\Source\Pickup</source_model> </field> - <field id="sort_order" translate="label" type="text" sortOrder="1000" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="sort_order" translate="label" type="text" sortOrder="1000" showInDefault="1" showInWebsite="1"> <label>Sort Order</label> <validate>validate-number validate-zero-or-greater</validate> </field> <field id="title" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Title</label> </field> - <field id="tracking_xml_url" translate="label" type="text" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="tracking_xml_url" translate="label" type="text" sortOrder="60" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Tracking XML URL</label> <backend_model>Magento\Ups\Model\Config\Backend\UpsUrl</backend_model> </field> - <field id="type" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="type" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" canRestore="1"> <label>UPS Type</label> <source_model>Magento\Ups\Model\Config\Source\Type</source_model> </field> - <field id="is_account_live" translate="label" type="select" sortOrder="25" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="is_account_live" translate="label" type="select" sortOrder="25" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Live Account</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="unit_of_measure" translate="label" type="select" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="unit_of_measure" translate="label" type="select" sortOrder="60" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Weight Unit</label> <source_model>Magento\Ups\Model\Config\Source\Unitofmeasure</source_model> </field> - <field id="username" translate="label" type="obscure" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="username" translate="label" type="obscure" sortOrder="30" showInDefault="1" showInWebsite="1"> <label>User ID</label> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> <depends> <field id="carriers/ups/active">1</field> </depends> </field> - <field id="negotiated_active" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="negotiated_active" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Enable Negotiated Rates</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="include_taxes" translate="label" type="select" sortOrder="45" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="include_taxes" translate="label" type="select" sortOrder="45" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Request Tax-Inclusive Rate</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <comment>When applicable, taxes (sales tax, VAT etc.) are included in the rate.</comment> </field> - <field id="shipper_number" translate="label comment" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="shipper_number" translate="label comment" type="text" sortOrder="50" showInDefault="1" showInWebsite="1"> <label>Shipper Number</label> <comment>Required for negotiated rates; 6-character UPS</comment> </field> - <field id="sallowspecific" translate="label" type="select" sortOrder="900" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="sallowspecific" translate="label" type="select" sortOrder="900" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Ship to Applicable Countries</label> <frontend_class>shipping-applicable-country</frontend_class> <source_model>Magento\Shipping\Model\Config\Source\Allspecificcountries</source_model> </field> - <field id="specificcountry" translate="label" type="multiselect" sortOrder="910" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="specificcountry" translate="label" type="multiselect" sortOrder="910" showInDefault="1" showInWebsite="1"> <label>Ship to Specific Countries</label> <source_model>Magento\Directory\Model\Config\Source\Country</source_model> <can_be_empty>1</can_be_empty> </field> - <field id="showmethod" translate="label" type="select" sortOrder="920" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="showmethod" translate="label" type="select" sortOrder="920" showInDefault="1" showInWebsite="1"> <label>Show Method if Not Applicable</label> <frontend_class>shipping-skip-hide</frontend_class> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> @@ -158,12 +158,12 @@ <field id="specificerrmsg" translate="label" type="textarea" sortOrder="800" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Displayed Error Message</label> </field> - <field id="mode_xml" translate="label comment" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="mode_xml" translate="label comment" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Mode</label> <comment>This enables or disables SSL verification of the Magento server by UPS.</comment> <source_model>Magento\Shipping\Model\Config\Source\Online\Mode</source_model> </field> - <field id="debug" translate="label" type="select" sortOrder="920" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="debug" translate="label" type="select" sortOrder="920" showInDefault="1" showInWebsite="1"> <label>Debug</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> diff --git a/app/code/Magento/User/etc/adminhtml/system.xml b/app/code/Magento/User/etc/adminhtml/system.xml index 6c57b268968c3..584b40a023c93 100644 --- a/app/code/Magento/User/etc/adminhtml/system.xml +++ b/app/code/Magento/User/etc/adminhtml/system.xml @@ -9,7 +9,7 @@ <system> <section id="admin"> <group id="emails"> - <field id="user_notification_template" translate="label comment" type="select" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <field id="user_notification_template" translate="label comment" type="select" sortOrder="40" showInDefault="1" canRestore="1"> <label>User Notification Template</label> <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> diff --git a/app/code/Magento/User/etc/config.xml b/app/code/Magento/User/etc/config.xml index c1f51bcbecef4..57631df18bb85 100644 --- a/app/code/Magento/User/etc/config.xml +++ b/app/code/Magento/User/etc/config.xml @@ -16,6 +16,7 @@ </emails> <security> <password_reset_link_expiration_period>2</password_reset_link_expiration_period> + <use_case_sensitive_login>0</use_case_sensitive_login> <lockout_failures>6</lockout_failures> <lockout_threshold>30</lockout_threshold> <password_lifetime>90</password_lifetime> diff --git a/app/code/Magento/Usps/etc/adminhtml/system.xml b/app/code/Magento/Usps/etc/adminhtml/system.xml index 0849572e7eb1c..b01f7be9a19f9 100644 --- a/app/code/Magento/Usps/etc/adminhtml/system.xml +++ b/app/code/Magento/Usps/etc/adminhtml/system.xml @@ -10,102 +10,102 @@ <section id="carriers"> <group id="usps" translate="label" type="text" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="1"> <label>USPS</label> - <field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Enabled for Checkout</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="gateway_url" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="gateway_url" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Gateway URL</label> </field> - <field id="gateway_secure_url" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="gateway_secure_url" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Secure Gateway URL</label> </field> <field id="title" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Title</label> </field> - <field id="userid" translate="label" type="obscure" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="userid" translate="label" type="obscure" sortOrder="50" showInDefault="1" showInWebsite="1"> <label>User ID</label> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> </field> - <field id="password" translate="label" type="obscure" sortOrder="53" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="password" translate="label" type="obscure" sortOrder="53" showInDefault="1" showInWebsite="1"> <label>Password</label> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> </field> - <field id="mode" translate="label" type="select" sortOrder="54" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="mode" translate="label" type="select" sortOrder="54" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Mode</label> <source_model>Magento\Shipping\Model\Config\Source\Online\Mode</source_model> </field> - <field id="shipment_requesttype" translate="label" type="select" sortOrder="55" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="shipment_requesttype" translate="label" type="select" sortOrder="55" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Packages Request Type</label> <source_model>Magento\Shipping\Model\Config\Source\Online\Requesttype</source_model> </field> - <field id="container" translate="label" type="select" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="container" translate="label" type="select" sortOrder="60" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Container</label> <source_model>Magento\Usps\Model\Source\Container</source_model> </field> - <field id="size" translate="label" type="select" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="size" translate="label" type="select" sortOrder="70" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Size</label> <source_model>Magento\Usps\Model\Source\Size</source_model> </field> - <field id="width" translate="label" type="text" sortOrder="73" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="width" translate="label" type="text" sortOrder="73" showInDefault="1" showInWebsite="1"> <label>Width</label> <depends> <field id="size">LARGE</field> </depends> </field> - <field id="length" translate="label" type="text" sortOrder="72" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="length" translate="label" type="text" sortOrder="72" showInDefault="1" showInWebsite="1"> <label>Length</label> <depends> <field id="size">LARGE</field> </depends> </field> - <field id="height" translate="label" type="text" sortOrder="74" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="height" translate="label" type="text" sortOrder="74" showInDefault="1" showInWebsite="1"> <label>Height</label> <depends> <field id="size">LARGE</field> </depends> </field> - <field id="girth" translate="label" type="text" sortOrder="76" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="girth" translate="label" type="text" sortOrder="76" showInDefault="1" showInWebsite="1"> <label>Girth</label> <depends> <field id="size">LARGE</field> </depends> </field> - <field id="machinable" translate="label" type="select" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="machinable" translate="label" type="select" sortOrder="80" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Machinable</label> <source_model>Magento\Usps\Model\Source\Machinable</source_model> </field> - <field id="max_package_weight" translate="label" type="text" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="max_package_weight" translate="label" type="text" sortOrder="90" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Maximum Package Weight (Please consult your shipping carrier for maximum supported shipping weight)</label> <validate>validate-number validate-zero-or-greater</validate> </field> - <field id="handling_type" translate="label" type="select" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="handling_type" translate="label" type="select" sortOrder="100" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Calculate Handling Fee</label> <source_model>Magento\Shipping\Model\Source\HandlingType</source_model> </field> - <field id="handling_action" translate="label" type="select" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="handling_action" translate="label" type="select" sortOrder="110" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Handling Applied</label> <source_model>Magento\Shipping\Model\Source\HandlingAction</source_model> </field> - <field id="handling_fee" translate="label" type="text" sortOrder="120" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="handling_fee" translate="label" type="text" sortOrder="120" showInDefault="1" showInWebsite="1"> <label>Handling Fee</label> <validate>validate-number validate-zero-or-greater</validate> </field> - <field id="allowed_methods" translate="label" type="multiselect" sortOrder="130" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="allowed_methods" translate="label" type="multiselect" sortOrder="130" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Allowed Methods</label> <source_model>Magento\Usps\Model\Source\Method</source_model> <can_be_empty>1</can_be_empty> </field> - <field id="free_method" translate="label" type="select" sortOrder="140" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="free_method" translate="label" type="select" sortOrder="140" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Free Method</label> <frontend_class>free-method</frontend_class> <source_model>Magento\Usps\Model\Source\Freemethod</source_model> </field> - <field id="free_shipping_enable" translate="label" type="select" sortOrder="160" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="free_shipping_enable" translate="label" type="select" sortOrder="160" showInDefault="1" showInWebsite="1"> <label>Enable Free Shipping Threshold</label> <source_model>Magento\Config\Model\Config\Source\Enabledisable</source_model> </field> - <field id="free_shipping_subtotal" translate="label" type="text" sortOrder="165" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="free_shipping_subtotal" translate="label" type="text" sortOrder="165" showInDefault="1" showInWebsite="1"> <label>Free Shipping Amount Threshold</label> <validate>validate-number validate-zero-or-greater</validate> <depends> @@ -115,26 +115,26 @@ <field id="specificerrmsg" translate="label" type="textarea" sortOrder="170" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Displayed Error Message</label> </field> - <field id="sallowspecific" translate="label" type="select" sortOrder="180" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="sallowspecific" translate="label" type="select" sortOrder="180" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Ship to Applicable Countries</label> <frontend_class>shipping-applicable-country</frontend_class> <source_model>Magento\Shipping\Model\Config\Source\Allspecificcountries</source_model> </field> - <field id="specificcountry" translate="label" type="multiselect" sortOrder="190" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="specificcountry" translate="label" type="multiselect" sortOrder="190" showInDefault="1" showInWebsite="1"> <label>Ship to Specific Countries</label> <source_model>Magento\Directory\Model\Config\Source\Country</source_model> <can_be_empty>1</can_be_empty> </field> - <field id="debug" translate="label" type="select" sortOrder="200" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="debug" translate="label" type="select" sortOrder="200" showInDefault="1" showInWebsite="1"> <label>Debug</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="showmethod" translate="label" type="select" sortOrder="210" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="showmethod" translate="label" type="select" sortOrder="210" showInDefault="1" showInWebsite="1"> <label>Show Method if Not Applicable</label> <frontend_class>shipping-skip-hide</frontend_class> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="sort_order" translate="label" type="text" sortOrder="220" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="sort_order" translate="label" type="text" sortOrder="220" showInDefault="1" showInWebsite="1"> <label>Sort Order</label> <validate>validate-number validate-zero-or-greater</validate> </field> diff --git a/app/code/Magento/WebapiSecurity/etc/adminhtml/system.xml b/app/code/Magento/WebapiSecurity/etc/adminhtml/system.xml index d6f40f5ac2023..ea60d34f78b0f 100644 --- a/app/code/Magento/WebapiSecurity/etc/adminhtml/system.xml +++ b/app/code/Magento/WebapiSecurity/etc/adminhtml/system.xml @@ -6,9 +6,9 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> <section id="webapi" type="text" sortOrder="102" showInDefault="1" showInWebsite="1" showInStore="1"> - <group id="webapisecurity" translate="label" type="text" sortOrder="250" showInDefault="1" showInWebsite="0" showInStore="0"> + <group id="webapisecurity" translate="label" type="text" sortOrder="250" showInDefault="1"> <label>Web API Security</label> - <field id="allow_insecure" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="allow_insecure" translate="label comment" type="select" sortOrder="1" showInDefault="1"> <label>Allow Anonymous Guest Access</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <comment>This feature applies only to CMS, Catalog and Store APIs. Please consult your developers for details on potential security risks.</comment> diff --git a/app/code/Magento/Weee/etc/adminhtml/system.xml b/app/code/Magento/Weee/etc/adminhtml/system.xml index d3e9efb8f0b46..68ceae482daaa 100644 --- a/app/code/Magento/Weee/etc/adminhtml/system.xml +++ b/app/code/Magento/Weee/etc/adminhtml/system.xml @@ -10,39 +10,57 @@ <section id="tax"> <group id="weee" translate="label" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Fixed Product Taxes</label> - <field id="enable" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="enable" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Enable FPT</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="display_list" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="display_list" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Display Prices In Product Lists</label> <source_model>Magento\Weee\Model\Config\Source\Display</source_model> + <depends> + <field id="enable">1</field> + </depends> </field> - <field id="display" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="display" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Display Prices On Product View Page</label> <source_model>Magento\Weee\Model\Config\Source\Display</source_model> + <depends> + <field id="enable">1</field> + </depends> </field> - <field id="display_sales" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="display_sales" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Display Prices In Sales Modules</label> <source_model>Magento\Weee\Model\Config\Source\Display</source_model> + <depends> + <field id="enable">1</field> + </depends> </field> - <field id="display_email" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="display_email" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Display Prices In Emails</label> <source_model>Magento\Weee\Model\Config\Source\Display</source_model> + <depends> + <field id="enable">1</field> + </depends> </field> - <field id="apply_vat" translate="label" type="select" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="apply_vat" translate="label" type="select" sortOrder="60" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Apply Tax To FPT</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> + <depends> + <field id="enable">1</field> + </depends> </field> - <field id="include_in_subtotal" translate="label" type="select" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="include_in_subtotal" translate="label" type="select" sortOrder="70" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Include FPT In Subtotal</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> + <depends> + <field id="enable">1</field> + </depends> </field> </group> </section> <section id="sales"> <group id="totals_sort"> - <field id="weee" translate="label" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="weee" translate="label" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Fixed Product Tax</label> <validate>required-number validate-number</validate> </field> diff --git a/app/code/Magento/Wishlist/etc/adminhtml/system.xml b/app/code/Magento/Wishlist/etc/adminhtml/system.xml index e61c07abca993..efadd6c4d58ba 100644 --- a/app/code/Magento/Wishlist/etc/adminhtml/system.xml +++ b/app/code/Magento/Wishlist/etc/adminhtml/system.xml @@ -13,6 +13,9 @@ <resource>Magento_Wishlist::config_wishlist</resource> <group id="email" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Share Options</label> + <depends> + <field id="*/general/active">1</field> + </depends> <field id="email_identity" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> @@ -42,11 +45,17 @@ <field id="show_in_sidebar" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Show in Sidebar</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> + <depends> + <field id="active">1</field> + </depends> </field> </group> - <group id="wishlist_link" translate="label" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="0"> + <group id="wishlist_link" translate="label" sortOrder="3" showInDefault="1" showInWebsite="1"> <label>My Wish List Link</label> - <field id="use_qty" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0"> + <depends> + <field id="*/general/active">1</field> + </depends> + <field id="use_qty" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Display Wish List Summary</label> <source_model>Magento\Wishlist\Model\Config\Source\Summary</source_model> </field> diff --git a/app/code/Magento/Wishlist/etc/config.xml b/app/code/Magento/Wishlist/etc/config.xml index dd88e63bc90ad..780d6b904fedc 100644 --- a/app/code/Magento/Wishlist/etc/config.xml +++ b/app/code/Magento/Wishlist/etc/config.xml @@ -18,6 +18,9 @@ <number_limit>10</number_limit> <text_limit>255</text_limit> </email> + <wishlist_link> + <use_qty>0</use_qty> + </wishlist_link> </wishlist> <captcha translate="label"> <frontend> From 7cb90f2a36debd62431acbf6b1790100b207f170 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky <firster@atwix.com> Date: Wed, 8 Jan 2020 17:48:14 +0200 Subject: [PATCH 0786/1143] magento/magento2#: Unit test for \Magento\Review\Observer\CatalogProductListCollectionAppendSummaryFieldsObserver --- ...lectionAppendSummaryFieldsObserverTest.php | 149 ++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 app/code/Magento/Review/Test/Unit/Observer/CatalogProductListCollectionAppendSummaryFieldsObserverTest.php diff --git a/app/code/Magento/Review/Test/Unit/Observer/CatalogProductListCollectionAppendSummaryFieldsObserverTest.php b/app/code/Magento/Review/Test/Unit/Observer/CatalogProductListCollectionAppendSummaryFieldsObserverTest.php new file mode 100644 index 0000000000000..fe86954d77c51 --- /dev/null +++ b/app/code/Magento/Review/Test/Unit/Observer/CatalogProductListCollectionAppendSummaryFieldsObserverTest.php @@ -0,0 +1,149 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types = 1); + +namespace Magento\Review\Test\Unit\Observer; + +use Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection; +use Magento\Framework\Event; +use Magento\Framework\Event\Observer; +use Magento\Review\Model\ResourceModel\Review\Summary; +use Magento\Review\Model\ResourceModel\Review\SummaryFactory; +use Magento\Review\Observer\CatalogProductListCollectionAppendSummaryFieldsObserver; +use Magento\Store\Api\Data\StoreInterface; +use Magento\Store\Model\StoreManagerInterface; +use MockObject; +use PHPUnit\Framework\TestCase; + +/** + * Test class for \Magento\Review\Observer\CatalogProductListCollectionAppendSummaryFieldsObserver + */ +class CatalogProductListCollectionAppendSummaryFieldsObserverTest extends TestCase +{ + private const STORE_ID = '1'; + + /** + * @var Event|MockObject + */ + private $eventMock; + + /** + * Testable Object + * + * @var CatalogProductListCollectionAppendSummaryFieldsObserver + */ + private $observer; + + /** + * @var Observer|MockObject + */ + private $observerMock; + + /** + * @var Collection|MockObject + */ + private $productCollectionMock; + + /** + * @var StoreInterface|MockObject + */ + private $storeMock; + + /** + * @var StoreManagerInterface|MockObject + */ + private $storeManagerMock; + + /** + * @var Summary|MockObject + */ + private $sumResourceMock; + + /** + * @var SummaryFactory|MockObject + */ + private $sumResourceFactoryMock; + + /** + * @inheritdoc + */ + protected function setUp() : void + { + $this->eventMock = $this->getMockBuilder(Event::class) + ->disableOriginalConstructor() + ->setMethods(['getCollection']) + ->getMock(); + + $this->observerMock = $this->createMock(Observer::class); + + $this->productCollectionMock = $this->getMockBuilder(Collection::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->storeManagerMock = $this->getMockBuilder(StoreManagerInterface::class) + ->disableOriginalConstructor() + ->setMethods(['getStore']) + ->getMockForAbstractClass(); + + $this->storeMock = $this->getMockBuilder(StoreInterface::class) + ->disableOriginalConstructor() + ->setMethods(['getId']) + ->getMockForAbstractClass(); + + $this->sumResourceMock = $this->createPartialMock( + Summary::class, + ['appendSummaryFieldsToCollection'] + ); + + $this->sumResourceFactoryMock = $this->getMockBuilder(SummaryFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + + $this->observer = new CatalogProductListCollectionAppendSummaryFieldsObserver( + $this->sumResourceFactoryMock, + $this->storeManagerMock + ); + } + + /** + * Product listing test + */ + public function testAddSummaryFieldToProductsCollection() : void + { + $this->eventMock + ->expects($this->once()) + ->method('getCollection') + ->willReturn($this->productCollectionMock); + + $this->observerMock + ->expects($this->once()) + ->method('getEvent') + ->willReturn($this->eventMock); + + $this->storeManagerMock + ->expects($this->once()) + ->method('getStore') + ->willReturn($this->storeMock); + + $this->storeMock + ->expects($this->once()) + ->method('getId') + ->willReturn(self::STORE_ID); + + $this->sumResourceFactoryMock + ->expects($this->once()) + ->method('create') + ->willReturn($this->sumResourceMock); + + $this->sumResourceMock + ->expects($this->once()) + ->method('appendSummaryFieldsToCollection') + ->willReturn($this->sumResourceMock); + + $this->observer->execute($this->observerMock); + } +} From f4f61f7265c16446ea2444bac6e867192580dce6 Mon Sep 17 00:00:00 2001 From: Tejash Kumbhare <tejas@wagento.com> Date: Mon, 13 Jan 2020 11:38:54 +0530 Subject: [PATCH 0787/1143] Add to Compare link not showing in mobile view under 640px --- .../Magento/luma/Magento_Catalog/web/css/source/_module.less | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less index 27533a0eb598f..e3296c3bcf825 100644 --- a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less @@ -623,11 +623,6 @@ // _____________________________________________ .media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__s) { - .product-social-links { - .action.tocompare { - display: none; - } - } .product-info-price { margin: 0 -@indent__s 0; From 08996dba645bfba42a2a1db24074f50e4bb1989b Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Mon, 13 Jan 2020 11:06:57 +0200 Subject: [PATCH 0788/1143] Add case with Please select option --- .../view/frontend/js/configurable.test.js | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/frontend/js/configurable.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/frontend/js/configurable.test.js index daaf04002d71b..a2cd8aee1b985 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/frontend/js/configurable.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/frontend/js/configurable.test.js @@ -9,17 +9,31 @@ define([ ], function ($, Configurable) { 'use strict'; - var widget; + var widget, + option = '<select name=\'super_attribute[93]\'' + + 'data-selector=\'super_attribute[93]\'' + + 'data-validate=\'{required:true}\'' + + 'id=\'attribute93\'' + + 'class=\'super-attribute-select\'>' + + '<option value=\'\'></option>' + + '</select>', + selectElement = $(option); beforeEach(function () { widget = new Configurable(); widget.options = { spConfig: { + chooseText: 'Chose an Option...', attributes: { 'size': { options: $('<div><p class="2"></p></div>') } + }, + prices: { + finalPrice: { + amount: 12 + } } }, values: { @@ -34,5 +48,13 @@ define([ widget._parseQueryParams('http://magento.com/product?color=red&size=2'); expect(widget.options.values.size).toBe('2'); }); + + it('check if attribute value is possible to be set as option with "please select option"', function () { + expect($.mage.configurable).toBeDefined(); + widget._fillSelect(selectElement[0]); + expect(selectElement[0].options[0].innerHTML).toBe(widget.options.spConfig.chooseText); + widget._parseQueryParams('http://magento.com/product?color=red&size=2'); + expect(widget.options.values.size).toBe('2'); + }); }); }); From b94c4abbbdd9780936ac399a3c1e054800c4c43b Mon Sep 17 00:00:00 2001 From: Viktor Sevch <svitja@ukr.net> Date: Mon, 13 Jan 2020 11:36:21 +0200 Subject: [PATCH 0789/1143] MC-23546: Child Configurable product does not save disabled status via API --- .../Mftf/Test/SearchEntityResultsTest.xml | 4 +- ...ontQuickSearchConfigurableChildrenTest.xml | 109 ++++++++++++++++++ 2 files changed, 111 insertions(+), 2 deletions(-) create mode 100644 app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontQuickSearchConfigurableChildrenTest.xml diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml b/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml index cc6f202272e3b..c289fc7868a10 100644 --- a/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml +++ b/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml @@ -607,14 +607,14 @@ <test name="QuickSearchConfigurableChildren"> <annotations> <stories value="Search Product on Storefront"/> - <title value="User should be able to use Quick Search to a configurable product's child products"/> + <title value="Deprecated. User should be able to use Quick Search to a configurable product's child products"/> <description value="Use Quick Search to find a configurable product with enabled/disable children"/> <severity value="MAJOR"/> <testCaseId value="MC-14798"/> <group value="CatalogSearch"/> <group value="mtf_migrated"/> <skip> - <issueId value="MC-15101"/> + <issueId value="DEPRECATED">Use StorefrontQuickSearchConfigurableChildrenTest instead.</issueId> </skip> </annotations> <before> diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontQuickSearchConfigurableChildrenTest.xml b/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontQuickSearchConfigurableChildrenTest.xml new file mode 100644 index 0000000000000..03ce878ef4f9f --- /dev/null +++ b/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontQuickSearchConfigurableChildrenTest.xml @@ -0,0 +1,109 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="StorefrontQuickSearchConfigurableChildrenTest"> + <annotations> + <stories value="Search Product on Storefront"/> + <title value="User should be able to use Quick Search to a configurable product's child products"/> + <description value="Use Quick Search to find a configurable product with enabled/disable children"/> + <severity value="MAJOR"/> + <testCaseId value="MC-14798"/> + <group value="CatalogSearch"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <!-- Create the category --> + <createData entity="ApiCategory" stepKey="createCategory"/> + <!-- Create blank AttributeSet--> + <createData entity="CatalogAttributeSet" stepKey="createAttributeSet"/> + <!-- Create an attribute with two options to be used in the first child product --> + <createData entity="hiddenDropdownAttributeWithOptions" stepKey="createProductAttribute"/> + <createData entity="productAttributeOption1" stepKey="createProductAttributeOption"> + <requiredEntity createDataKey="createProductAttribute"/> + </createData> + + <!-- Assign attribute to set --> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <actionGroup ref="GoToAttributeGridPageActionGroup" stepKey="goToAttributeSetPage"/> + <actionGroup ref="GoToAttributeSetByNameActionGroup" stepKey="openAttributeSetByName"> + <argument name="name" value="$createAttributeSet.attribute_set_name$"/> + </actionGroup> + <actionGroup ref="AssignAttributeToGroupActionGroup" stepKey="assignAttributeToGroup"> + <argument name="group" value="Product Details"/> + <argument name="attribute" value="$createProductAttribute.attribute_code$"/> + </actionGroup> + <actionGroup ref="SaveAttributeSetActionGroup" stepKey="savePage"/> + + <!-- Get the first option of the attribute we created --> + <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getAttributeOption"> + <requiredEntity createDataKey="createProductAttribute"/> + </getData> + + <!-- Create a simple product --> + <createData entity="ApiSimpleOneHidden" storeCode="all" stepKey="createSimpleProduct"> + <field key="attribute_set_id">$createAttributeSet.attribute_set_id$</field> + <requiredEntity createDataKey="createProductAttribute"/> + <requiredEntity createDataKey="getAttributeOption"/> + </createData> + <updateData entity="ApiSimpleProductUpdateDescription" createDataKey="createSimpleProduct" stepKey="updateSimpleProduct"/> + + <!-- Create the configurable product --> + <createData entity="ApiConfigurableProduct" stepKey="createConfigurableProduct"> + <field key="attribute_set_id">$createAttributeSet.attribute_set_id$</field> + <requiredEntity createDataKey="createCategory"/> + </createData> + <!-- Create the configurable product option --> + <createData entity="ConfigurableProductOneOption" stepKey="createConfigProductOption"> + <requiredEntity createDataKey="createConfigurableProduct"/> + <requiredEntity createDataKey="createProductAttribute"/> + <requiredEntity createDataKey="getAttributeOption"/> + </createData> + <!-- Add the first simple product to the configurable product --> + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild"> + <requiredEntity createDataKey="createConfigurableProduct"/> + <requiredEntity createDataKey="createSimpleProduct"/> + </createData> + + <!-- Perform reindex --> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + </before> + <after> + <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <deleteData createDataKey="createConfigurableProduct" stepKey="deleteConfigurableProduct"/> + <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> + <deleteData createDataKey="createProductAttribute" stepKey="deleteProductAttribute"/> + <deleteData createDataKey="createAttributeSet" stepKey="deleteAttributeSet"/> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + </after> + <amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToHomePage"/> + <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="searchStorefront"> + <argument name="phrase" value="$createConfigurableProduct.name$"/> + </actionGroup> + <actionGroup ref="StorefrontQuickSearchCheckProductNameInGridActionGroup" stepKey="seeProductInGrid"> + <argument name="productName" value="$createConfigurableProduct.name$"/> + <argument name="index" value="1"/> + </actionGroup> + + <!-- Disable Child Product --> + <actionGroup ref="GoToProductPageViaIDActionGroup" stepKey="openSimpleProduct"> + <argument name="productId" value="$createSimpleProduct.id$"/> + </actionGroup> + <actionGroup ref="ToggleProductEnabledActionGroup" stepKey="disableProduct"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> + + <amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToHomePageAgain"/> + <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="searchStorefrontAgain"> + <argument name="phrase" value="$createConfigurableProduct.name$"/> + </actionGroup> + <actionGroup ref="StorefrontQuickSearchCheckProductNameNotInGridActionGroup" stepKey="dontSeeProductAnymore"> + <argument name="productName" value="$createConfigurableProduct.name$"/> + </actionGroup> + </test> +</tests> From ede11880e0c3875dce7e53f27fa5b1bff123f77c Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Mon, 13 Jan 2020 13:18:32 +0200 Subject: [PATCH 0790/1143] MC-29023: Custom attribute values cannot be saved in Admin panel --- .../Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml index 917a4ac58464f..861f379988031 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml @@ -17,6 +17,9 @@ <severity value="CRITICAL"/> <testCaseId value="MC-5922"/> <group value="checkout"/> + <skip> + <issueId value="MC-30111"/> + </skip> </annotations> <before> <createData entity="SimpleSubCategory" stepKey="simplecategory"/> From f22ead837c9ef59621aed2b75ef348480c02172a Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Mon, 13 Jan 2020 13:20:43 +0200 Subject: [PATCH 0791/1143] Refactor test with .find() undefined method of js prototype --- .../view/frontend/js/configurable.test.js | 60 +++++++++++++++++-- 1 file changed, 54 insertions(+), 6 deletions(-) diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/frontend/js/configurable.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/frontend/js/configurable.test.js index a2cd8aee1b985..5cf7b823f144d 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/frontend/js/configurable.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/frontend/js/configurable.test.js @@ -20,6 +20,45 @@ define([ selectElement = $(option); beforeEach(function () { + //remove this lines when jasmine version will be upgraded + if (!Array.prototype.find) { + Object.defineProperty(Array.prototype, 'find', {//eslint-disable-line + enumerable: false, + configurable: true, + writable: true, + + /** + * Find method + */ + value: function (predicate) { + var list = Object(this), + length = list.length >>> 0, + thisArg = arguments[1], + value, + i; + + if (this == null) { + throw new TypeError('Array.prototype.find called on null or undefined'); + } + + if (typeof predicate !== 'function') { + throw new TypeError('predicate must be a function'); + } + + for (i = 0; i < length; i++) { + if (i in list) { + value = list[i]; + + if (predicate.call(thisArg, value, i, list)) {//eslint-disable-line + return value; + } + } + } + + return undefined; + } + }); + } widget = new Configurable(); widget.options = { spConfig: { @@ -27,7 +66,17 @@ define([ attributes: { 'size': { - options: $('<div><p class="2"></p></div>') + options: [ + { + id: '2', + value: '2' + }, + { + id: 3, + value: 'red' + + } + ] } }, prices: { @@ -45,16 +94,15 @@ define([ it('check if attribute value is possible to be set as configurable option', function () { expect($.mage.configurable).toBeDefined(); - widget._parseQueryParams('http://magento.com/product?color=red&size=2'); + widget._parseQueryParams('size=2'); expect(widget.options.values.size).toBe('2'); }); - it('check if attribute value is possible to be set as option with "please select option"', function () { + it('check that attribute value is not set id provided option does not exists', function () { expect($.mage.configurable).toBeDefined(); + widget._parseQueryParams('size=10'); widget._fillSelect(selectElement[0]); - expect(selectElement[0].options[0].innerHTML).toBe(widget.options.spConfig.chooseText); - widget._parseQueryParams('http://magento.com/product?color=red&size=2'); - expect(widget.options.values.size).toBe('2'); + expect(widget.options.values.size).toBe(undefined); }); }); }); From eff3d4294741a554ced30f2f3787053907903462 Mon Sep 17 00:00:00 2001 From: Yurii Sapiha <yurasapiga93@gmail.com> Date: Mon, 13 Jan 2020 13:33:15 +0200 Subject: [PATCH 0792/1143] MC-30330: Storefront: View configurable product on storefront --- .../Product/View/Type/ConfigurableTest.php | 163 +++++-- .../Listing/CategoryPageViewTest.php | 109 +++++ .../Configurable/ProductPageViewTest.php | 414 ++++++++++++++++++ ...igurable_product_text_swatch_attribute.php | 93 ++++ ...product_text_swatch_attribute_rollback.php | 44 ++ .../configurable_product_two_attributes.php | 120 +++++ ...urable_product_two_attributes_rollback.php | 52 +++ ...urable_product_visual_swatch_attribute.php | 93 ++++ ...oduct_visual_swatch_attribute_rollback.php | 46 ++ 9 files changed, 1098 insertions(+), 36 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Swatches/Block/Product/Renderer/Configurable/Listing/CategoryPageViewTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Swatches/Block/Product/Renderer/Configurable/ProductPageViewTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_text_swatch_attribute.php create mode 100644 dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_text_swatch_attribute_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_two_attributes.php create mode 100644 dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_two_attributes_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_visual_swatch_attribute.php create mode 100644 dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_visual_swatch_attribute_rollback.php diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/ConfigurableTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/ConfigurableTest.php index feca63015ca7c..75f5b9928b881 100644 --- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/ConfigurableTest.php +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/ConfigurableTest.php @@ -3,79 +3,102 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\ConfigurableProduct\Block\Product\View\Type; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\ResourceModel\Product as ProductResource; +use Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable\Attribute\Collection; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Serialize\SerializerInterface; +use Magento\Framework\View\LayoutInterface; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; + /** - * Test class for \Magento\ConfigurableProduct\Block\Product\View\Type\Configurable. + * Test class to check configurable product view behaviour + * + * @see \Magento\ConfigurableProduct\Block\Product\View\Type\Configurable * * @magentoAppIsolation enabled * @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php */ -class ConfigurableTest extends \PHPUnit\Framework\TestCase +class ConfigurableTest extends TestCase { - /** - * @var \Magento\ConfigurableProduct\Block\Product\View\Type\Configurable - */ - protected $_block; + /** @var ObjectManagerInterface */ + private $objectManager; + + /** @var Configurable */ + private $block; + + /** @var Product */ + private $product; + + /** @var LayoutInterface */ + private $layout; + + /** @var ProductRepositoryInterface */ + private $productRepository; + + /** @var SerializerInterface */ + private $json; + + /** @var ProductResource */ + private $productResource; /** - * @var \Magento\Catalog\Model\Product + * @inheritdoc */ - protected $_product; - protected function setUp() { - $this->_product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - \Magento\Catalog\Model\Product::class - ); - $this->_product->load(1); - $this->_block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - \Magento\Framework\View\LayoutInterface::class - )->createBlock( - \Magento\ConfigurableProduct\Block\Product\View\Type\Configurable::class - ); - $this->_block->setProduct($this->_product); + $this->objectManager = Bootstrap::getObjectManager(); + $this->productRepository = $this->objectManager->create(ProductRepositoryInterface::class); + $this->product = $this->productRepository->get('configurable'); + $this->layout = $this->objectManager->get(LayoutInterface::class); + $this->block = $this->layout->createBlock(Configurable::class); + $this->json = $this->objectManager->get(SerializerInterface::class); + $this->block->setProduct($this->product); + $this->productResource = $this->objectManager->create(ProductResource::class); } /** - * @magentoAppIsolation enabled + * @return void */ - public function testGetAllowAttributes() + public function testGetAllowAttributes(): void { - $attributes = $this->_block->getAllowAttributes(); - $this->assertInstanceOf( - \Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable\Attribute\Collection::class, - $attributes - ); + $attributes = $this->block->getAllowAttributes(); + $this->assertInstanceOf(Collection::class, $attributes); $this->assertGreaterThanOrEqual(1, $attributes->getSize()); } /** - * @magentoAppIsolation enabled + * @return void */ - public function testHasOptions() + public function testHasOptions(): void { - $this->assertTrue($this->_block->hasOptions()); + $this->assertTrue($this->block->hasOptions()); } /** - * @magentoAppIsolation enabled + * @return void */ - public function testGetAllowProducts() + public function testGetAllowProducts(): void { - $products = $this->_block->getAllowProducts(); + $products = $this->block->getAllowProducts(); $this->assertGreaterThanOrEqual(2, count($products)); foreach ($products as $product) { - $this->assertInstanceOf(\Magento\Catalog\Model\Product::class, $product); + $this->assertInstanceOf(Product::class, $product); } } /** - * @magentoAppIsolation enabled + * @return void */ - public function testGetJsonConfig() + public function testGetJsonConfig(): void { - $config = json_decode($this->_block->getJsonConfig(), true); + $config = $this->json->unserialize($this->block->getJsonConfig()); $this->assertNotEmpty($config); $this->assertArrayHasKey('productId', $config); $this->assertEquals(1, $config['productId']); @@ -84,4 +107,72 @@ public function testGetJsonConfig() $this->assertArrayHasKey('prices', $config); $this->assertArrayHasKey('basePrice', $config['prices']); } + + /** + * @dataProvider expectedDataProvider + * + * @param string $label + * @param array $expectedConfig + * @return void + */ + public function testConfigurableProductView(string $label, array $expectedConfig): void + { + $attributes = $this->block->decorateArray($this->block->getAllowAttributes()); + $this->assertCount(1, $attributes); + $attribute = $attributes->getFirstItem(); + $this->assertEquals($label, $attribute->getLabel()); + $config = $this->json->unserialize($this->block->getJsonConfig())['attributes'] ?? null; + $this->assertNotNull($config); + $this->assertConfig(reset($config), $expectedConfig); + } + + /** + * @return array + */ + public function expectedDataProvider(): array + { + return [ + [ + 'label' => 'Test Configurable', + 'config_data' => [ + 'label' => 'Test Configurable', + 'options' => [ + [ + 'label' => 'Option 1', + 'sku' => 'simple_10', + ], + [ + 'label' => 'Option 2', + 'sku' => 'simple_20', + ], + ], + ], + ], + ]; + } + + /** + * Assert that data was generated + * + * @param array $data + * @param array $expectedData + * @return void + */ + private function assertConfig($data, $expectedData): void + { + $this->assertEquals($expectedData['label'], $data['label']); + $skus = array_column($expectedData['options'], 'sku'); + $idBySkuMap = $this->productResource->getProductsIdsBySkus($skus); + foreach ($expectedData['options'] as &$option) { + $sku = $option['sku']; + unset($option['sku']); + $option['products'] = [$idBySkuMap[$sku]]; + foreach ($data['options'] as $actualOption) { + if ($option['label'] === $actualOption['label']) { + unset($actualOption['id']); + $this->assertEquals($option, $actualOption); + } + } + } + } } diff --git a/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/Renderer/Configurable/Listing/CategoryPageViewTest.php b/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/Renderer/Configurable/Listing/CategoryPageViewTest.php new file mode 100644 index 0000000000000..7f842bf49644e --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/Renderer/Configurable/Listing/CategoryPageViewTest.php @@ -0,0 +1,109 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Swatches\Block\Product\Renderer\Configurable\Listing; + +use Magento\Swatches\Block\Product\Renderer\Configurable\ProductPageViewTest; +use Magento\Swatches\Block\Product\Renderer\Listing\Configurable; + +/** + * Test class to check configurable product with swatch attributes view behaviour on category page + * + * @magentoDbIsolation enabled + * @magentoAppIsolation enabled + */ +class CategoryPageViewTest extends ProductPageViewTest +{ + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + + $this->block = $this->layout->createBlock(Configurable::class); + $this->template = 'Magento_Swatches::product/listing/renderer.phtml'; + } + + /** + * @magentoDataFixture Magento/Swatches/_files/configurable_product_visual_swatch_attribute.php + * + * @dataProvider expectedVisualSwatchDataProvider + * + * @param array $expectedConfig + * @param array $expectedSwatchConfig + * @return void + */ + public function testCategoryPageVisualSwatchAttributeView(array $expectedConfig, array $expectedSwatchConfig): void + { + $this->checkProductViewCategoryPage($expectedConfig, $expectedSwatchConfig, ['visual_swatch_attribute']); + } + + /** + * @magentoDataFixture Magento/Swatches/_files/configurable_product_text_swatch_attribute.php + * + * @dataProvider expectedTextSwatchDataProvider + * + * @param array $expectedConfig + * @param array $expectedSwatchConfig + * @return void + */ + public function testCategoryPageTextSwatchAttributeView(array $expectedConfig, array $expectedSwatchConfig): void + { + $this->checkProductViewCategoryPage($expectedConfig, $expectedSwatchConfig, ['text_swatch_attribute']); + } + + /** + * @magentoDataFixture Magento/Swatches/_files/configurable_product_two_attributes.php + * + * @dataProvider expectedTwoAttributesProvider + * + * @param array $expectedConfig + * @param array $expectedSwatchConfig + * @return void + */ + public function testCategoryPageTwoAttributesView(array $expectedConfig, array $expectedSwatchConfig): void + { + $this->checkProductViewCategoryPage( + $expectedConfig, + $expectedSwatchConfig, + ['visual_swatch_attribute', 'text_swatch_attribute'] + ); + } + + /** + * Check configurable product view on category view page + * + * @param array $expectedConfig + * @param array $expectedSwatchConfig + * @param array $attributes + * @return void + */ + private function checkProductViewCategoryPage( + array $expectedConfig, + array $expectedSwatchConfig, + array $attributes + ): void { + $this->setAttributeUsedInProductListing($attributes); + $this->checkProductView($expectedConfig, $expectedSwatchConfig); + } + + /** + * Set used in product listing attributes value to true + * + * @param array $attributeCodes + * @return void + */ + private function setAttributeUsedInProductListing(array $attributeCodes): void + { + foreach ($attributeCodes as $attributeCode) { + $attribute = $this->productAttributeRepository->get($attributeCode); + $attribute->setUsedInProductListing('1'); + $this->productAttributeRepository->save($attribute); + } + } +} diff --git a/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/Renderer/Configurable/ProductPageViewTest.php b/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/Renderer/Configurable/ProductPageViewTest.php new file mode 100644 index 0000000000000..2d016ef48faf5 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/Renderer/Configurable/ProductPageViewTest.php @@ -0,0 +1,414 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Swatches\Block\Product\Renderer\Configurable; + +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\ResourceModel\Product as ProductResource; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Registry; +use Magento\Framework\Serialize\SerializerInterface; +use Magento\Framework\View\LayoutInterface; +use Magento\Swatches\Block\Product\Renderer\Configurable; +use Magento\Swatches\Model\Swatch; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; + +/** + * Test class to check configurable product with swatch attributes view behaviour on product page + * + * @magentoDbIsolation enabled + * @magentoAppIsolation enabled + */ +class ProductPageViewTest extends TestCase +{ + /** @var ObjectManagerInterface */ + protected $objectManager; + + /** @var Configurable */ + protected $block; + + /** @var string */ + protected $template; + + /** @var ProductAttributeRepositoryInterface */ + protected $productAttributeRepository; + + /** @var LayoutInterface */ + protected $layout; + + /** @var ProductRepositoryInterface */ + private $productRepository; + + /** @var Registry */ + private $registry; + + /** @var SerializerInterface */ + private $json; + + /** @var ProductResource */ + private $productResource; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + + $this->objectManager = Bootstrap::getObjectManager(); + $this->productRepository = $this->objectManager->create(ProductRepositoryInterface::class); + $this->layout = $this->objectManager->get(LayoutInterface::class); + $this->block = $this->layout->createBlock(Configurable::class); + $this->registry = $this->objectManager->get(Registry::class); + $this->json = $this->objectManager->get(SerializerInterface::class); + $this->productAttributeRepository = $this->objectManager->create(ProductAttributeRepositoryInterface::class); + $this->productResource = $this->objectManager->create(ProductResource::class); + $this->template = Configurable::SWATCH_RENDERER_TEMPLATE; + } + + /** + * @magentoDataFixture Magento/Swatches/_files/configurable_product_text_swatch_attribute.php + * + * @dataProvider expectedTextSwatchDataProvider + * + * @param array $expectedConfig + * @param array $expectedSwatchConfig + * @return void + */ + public function testProductPageTextSwatchAttributeView(array $expectedConfig, array $expectedSwatchConfig): void + { + $this->checkProductView($expectedConfig, $expectedSwatchConfig); + } + + /** + * @return array + */ + public function expectedTextSwatchDataProvider(): array + { + return [ + [ + 'json_config' => [ + 'text_swatch_attribute' => [ + 'label' => 'Text swatch attribute', + 'options' => [ + ['label' => 'Option 3', 'skus' => ['simple_option_3']], + ['label' => 'Option 1', 'skus' => ['simple_option_1']], + ['label' => 'Option 2', 'skus' => ['simple_option_2']], + ], + ], + ], + 'json_swatch_config' => [ + Swatch::SWATCH_INPUT_TYPE_TEXT => [ + [ + 'type' => Swatch::SWATCH_TYPE_TEXTUAL, + 'value' => 'Swatch 3', + 'label' => 'Option 3', + ], + [ + 'type' => Swatch::SWATCH_TYPE_TEXTUAL, + 'value' => 'Swatch 1', + 'label' => 'Option 1', + ], + [ + 'type' => Swatch::SWATCH_TYPE_TEXTUAL, + 'value' => 'Swatch 2', + 'label' => 'Option 2', + ], + 'additional_data' => "{\"swatch_input_type\":\"text\"}", + ], + + ], + ], + ]; + } + + /** + * @magentoDataFixture Magento/Swatches/_files/configurable_product_visual_swatch_attribute.php + * + * @dataProvider expectedVisualSwatchDataProvider + * + * @param array $expectedConfig + * @param array $expectedSwatchConfig + * @return void + */ + public function testProductPageVisualSwatchAttributeView(array $expectedConfig, array $expectedSwatchConfig): void + { + $this->checkProductView($expectedConfig, $expectedSwatchConfig); + } + + /** + * @return array + */ + public function expectedVisualSwatchDataProvider(): array + { + return [ + [ + 'json_config' => [ + 'visual_swatch_attribute' => [ + 'label' => 'Visual swatch attribute', + 'options' => [ + ['label' => 'option 3', 'skus' => ['simple_option_3']], + ['label' => 'option 2', 'skus' => ['simple_option_2']], + ['label' => 'option 1', 'skus' => ['simple_option_1']], + ], + ], + ], + 'json_swatch_config' => [ + Swatch::SWATCH_INPUT_TYPE_VISUAL => [ + [ + 'type' => Swatch::SWATCH_TYPE_VISUAL_COLOR, + 'value' => '#555555', + 'label' => 'option 1', + ], + [ + 'type' => Swatch::SWATCH_TYPE_VISUAL_COLOR, + 'value' => '#aaaaaa', + 'label' => 'option 2', + ], + [ + 'type' => Swatch::SWATCH_TYPE_VISUAL_COLOR, + 'value' => '#ffffff', + 'label' => 'option 3', + ], + 'additional_data' => "{\"swatch_input_type\":\"visual\"}", + ], + ], + ], + ]; + } + + /** + * @magentoDataFixture Magento/Swatches/_files/configurable_product_two_attributes.php + * + * @dataProvider expectedTwoAttributesProvider + * + * @param array $expectedConfig + * @param array $expectedSwatchConfig + * @return void + */ + public function testProductPageTwoAttributesView(array $expectedConfig, array $expectedSwatchConfig): void + { + $this->checkProductView($expectedConfig, $expectedSwatchConfig); + } + + /** + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + * @return array + */ + public function expectedTwoAttributesProvider(): array + { + return [ + [ + 'json_config' => [ + 'visual_swatch_attribute' => [ + 'label' => 'Visual swatch attribute', + 'options' => [ + [ + 'label' => 'option 3', + 'skus' => [ + 'simple_option_3_option_3', + 'simple_option_1_option_3', + 'simple_option_2_option_3', + ], + ], + [ + 'label' => 'option 2', + 'skus' => [ + 'simple_option_3_option_2', + 'simple_option_1_option_2', + 'simple_option_2_option_2', + ], + ], + [ + 'label' => 'option 1', + 'skus' => [ + 'simple_option_3_option_1', + 'simple_option_1_option_1', + 'simple_option_2_option_1', + ], + ], + ], + ], + 'text_swatch_attribute' => [ + 'label' => 'Text swatch attribute', + 'options' => [ + [ + 'label' => 'Option 3', + 'skus' => [ + 'simple_option_3_option_1', + 'simple_option_3_option_2', + 'simple_option_3_option_3', + ], + ], + [ + 'label' => 'Option 2', + 'skus' => [ + 'simple_option_2_option_1', + 'simple_option_2_option_2', + 'simple_option_2_option_3', + ], + ], + [ + 'label' => 'Option 1', + 'skus' => [ + 'simple_option_1_option_1', + 'simple_option_1_option_2', + 'simple_option_1_option_3', + ], + ], + ], + ], + + ], + 'json_swatch_config' => [ + Swatch::SWATCH_INPUT_TYPE_VISUAL => [ + [ + 'type' => Swatch::SWATCH_TYPE_VISUAL_COLOR, + 'value' => '#555555', + 'label' => 'option 1', + ], + [ + 'type' => Swatch::SWATCH_TYPE_VISUAL_COLOR, + 'value' => '#aaaaaa', + 'label' => 'option 2', + ], + [ + 'type' => Swatch::SWATCH_TYPE_VISUAL_COLOR, + 'value' => '#ffffff', + 'label' => 'option 3', + ], + 'additional_data' => "{\"swatch_input_type\":\"visual\"}", + ], + Swatch::SWATCH_INPUT_TYPE_TEXT => [ + [ + 'type' => Swatch::SWATCH_TYPE_TEXTUAL, + 'value' => 'Swatch 3', + 'label' => 'Option 3', + ], + [ + 'type' => Swatch::SWATCH_TYPE_TEXTUAL, + 'value' => 'Swatch 1', + 'label' => 'Option 1', + ], + [ + 'type' => Swatch::SWATCH_TYPE_TEXTUAL, + 'value' => 'Swatch 2', + 'label' => 'Option 2', + ], + 'additional_data' => "{\"swatch_input_type\":\"text\"}", + ], + ], + ], + ]; + } + + /** + * Check configurable product view + * + * @param $expectedConfig + * @param $expectedSwatchConfig + * @return void + */ + protected function checkProductView($expectedConfig, $expectedSwatchConfig): void + { + $actualConfig = $this->generateBlockJsonConfigData(); + $this->checkResultIsNotEmpty($actualConfig); + $this->assertConfig($actualConfig['json_config'], $expectedConfig); + $this->assertSwatchConfig($actualConfig['json_swatch_config'], $expectedSwatchConfig); + } + + /** + * Generate block config data + * + * @return array + */ + + private function generateBlockJsonConfigData(): array + { + $product = $this->productRepository->get('configurable'); + $this->block->setProduct($product); + $this->block->setTemplate($this->template); + $jsonConfig = $this->json->unserialize($this->block->getJsonConfig())['attributes'] ?? []; + $jsonSwatchConfig = $this->json->unserialize($this->block->getJsonSwatchConfig()); + + return ['json_config' => $jsonConfig, 'json_swatch_config' => $jsonSwatchConfig]; + } + + /** + * Assert that correct data was generated + * + * @param array $actualData + * @param array $expectedData + * @return void + */ + private function assertSwatchConfig(array $actualData, array $expectedData): void + { + foreach ($actualData as $actualDataItem) { + $currentType = $this->json->unserialize($actualDataItem['additional_data'])['swatch_input_type'] ?? null; + $this->assertNotNull($currentType); + $this->assertEquals($expectedData[$currentType]['additional_data'], $actualDataItem['additional_data']); + unset($actualDataItem['additional_data']); + foreach ($actualDataItem as $item) { + $this->assertContains($item, $expectedData[$currentType]); + } + } + } + + /** + * Assert that correct swatch data was generated + * + * @param array $actualData + * @param array $expectedData + * @return void + */ + private function assertConfig(array $actualData, array $expectedData): void + { + foreach ($actualData as $actualDataItem) { + $expectedItem = $expectedData[$actualDataItem['code']]; + $this->assertEquals($expectedItem['label'], $actualDataItem['label']); + $this->checkOptions($actualDataItem, $expectedItem); + } + } + + /** + * Check result is not not empty + * + * @param array $result + */ + private function checkResultIsNotEmpty(array $result): void + { + foreach ($result as $item) { + $this->assertNotEmpty($item); + } + } + + /** + * Check attribute options + * + * @param array $actualDataItem + * @param array $expectedItem + * @return void + */ + private function checkOptions(array $actualDataItem, array $expectedItem): void + { + foreach ($expectedItem['options'] as $expectedOption) { + $expectedSkus = array_values($expectedOption['skus']); + $expectedIds = array_values($this->productResource->getProductsIdsBySkus($expectedSkus)); + foreach ($actualDataItem['options'] as $option) { + if ($option['label'] === $expectedOption['label']) { + $this->assertEquals( + sort($expectedIds), + sort($option['products']), + 'Wrong product linked as option' + ); + } + } + } + } +} diff --git a/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_text_swatch_attribute.php b/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_text_swatch_attribute.php new file mode 100644 index 0000000000000..b5586acdfeebf --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_text_swatch_attribute.php @@ -0,0 +1,93 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\Data\ProductExtensionFactory; +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Catalog\Model\Product\Type as ProductType; +use Magento\Catalog\Model\Product\Visibility; +use Magento\Catalog\Model\ProductFactory; +use Magento\ConfigurableProduct\Helper\Product\Options\Factory; +use Magento\ConfigurableProduct\Model\Product\Type\Configurable; +use Magento\Framework\ObjectManagerInterface; +use Magento\Store\Api\WebsiteRepositoryInterface; +use Magento\TestFramework\Helper\Bootstrap; + +require __DIR__ . '/product_text_swatch_attribute.php'; + +/** @var ObjectManagerInterface $objectManager */ +$objectManager = Bootstrap::getObjectManager(); +/** @var ProductAttributeRepositoryInterface $productAttributeRepository */ +$productAttributeRepository = $objectManager->create(ProductAttributeRepositoryInterface::class); +$attribute = $productAttributeRepository->get('text_swatch_attribute'); +$options = $attribute->getOptions(); +/** @var WebsiteRepositoryInterface $websiteRepository */ +$websiteRepository = $objectManager->get(WebsiteRepositoryInterface::class); +$baseWebsite = $websiteRepository->get('base'); +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->create(ProductRepositoryInterface::class); +/** @var ProductFactory $productFactory */ +$productFactory = $objectManager->get(ProductFactory::class); +$attributeValues = []; +$associatedProductIds = []; +$rootCategoryId = $baseWebsite->getDefaultStore()->getRootCategoryId(); +array_shift($options); + +foreach ($options as $option) { + $product = $productFactory->create(); + $product->setTypeId(ProductType::TYPE_SIMPLE) + ->setAttributeSetId($product->getDefaultAttributeSetId()) + ->setWebsiteIds([$baseWebsite->getId()]) + ->setName('Configurable Option ' . $option->getLabel()) + ->setSku(strtolower(str_replace(' ', '_', 'simple ' . $option->getLabel()))) + ->setPrice(150) + ->setTextSwatchAttribute($option->getValue()) + ->setVisibility(Visibility::VISIBILITY_NOT_VISIBLE) + ->setStatus(Status::STATUS_ENABLED) + ->setCategoryIds([$rootCategoryId]) + ->setStockData(['use_config_manage_stock' => 1, 'qty' => 100, 'is_qty_decimal' => 0, 'is_in_stock' => 1]); + $product = $productRepository->save($product); + + $attributeValues[] = [ + 'label' => 'test', + 'attribute_id' => $attribute->getId(), + 'value_index' => $option->getValue(), + ]; + $associatedProductIds[] = $product->getId(); +} +/** @var Factory $optionsFactory */ +$optionsFactory = $objectManager->get(Factory::class); +$configurableAttributesData = [ + [ + 'attribute_id' => $attribute->getId(), + 'code' => $attribute->getAttributeCode(), + 'label' => $attribute->getStoreLabel(), + 'position' => '0', + 'values' => $attributeValues, + ], +]; +$configurableOptions = $optionsFactory->create($configurableAttributesData); + +$product = $productFactory->create(); +/** @var ProductExtensionFactory $extensionAttributesFactory */ +$extensionAttributesFactory = $objectManager->get(ProductExtensionFactory::class); +$extensionConfigurableAttributes = $product->getExtensionAttributes() ?: $extensionAttributesFactory->create(); +$extensionConfigurableAttributes->setConfigurableProductOptions($configurableOptions); +$extensionConfigurableAttributes->setConfigurableProductLinks($associatedProductIds); +$product->setExtensionAttributes($extensionConfigurableAttributes); + +$product->setTypeId(Configurable::TYPE_CODE) + ->setAttributeSetId($product->getDefaultAttributeSetId()) + ->setWebsiteIds([$baseWebsite->getId()]) + ->setName('Configurable Product') + ->setSku('configurable') + ->setVisibility(Visibility::VISIBILITY_BOTH) + ->setStatus(Status::STATUS_ENABLED) + ->setCategoryIds([$rootCategoryId]) + ->setStockData(['use_config_manage_stock' => 1, 'is_in_stock' => 1]); +$productRepository->save($product); diff --git a/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_text_swatch_attribute_rollback.php b/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_text_swatch_attribute_rollback.php new file mode 100644 index 0000000000000..f5c91e255e1a3 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_text_swatch_attribute_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\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Registry; +use Magento\TestFramework\Helper\Bootstrap; + +/** @var ObjectManagerInterface $objectManager */ +$objectManager = Bootstrap::getObjectManager(); +/** @var Registry $registry */ +$registry = $objectManager->get(Registry::class); +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->get(ProductRepositoryInterface::class); +/** @var ProductAttributeRepositoryInterface $productAttributeRepository */ +$productAttributeRepository = $objectManager->get(ProductAttributeRepositoryInterface::class); +$attribute = $productAttributeRepository->get('text_swatch_attribute'); +$options = $attribute->getOptions(); +array_shift($options); +$productsArray = []; +foreach ($options as $option) { + $productsArray [] = strtolower(str_replace(' ', '_', 'simple ' . $option->getLabel())); +} +$productsArray[] = 'configurable'; +foreach ($productsArray as $sku) { + try { + $productRepository->deleteById($sku); + } catch (NoSuchEntityException $e) { + //Product already removed + } +} + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); + +require __DIR__ . '/product_text_swatch_attribute_rollback.php'; diff --git a/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_two_attributes.php b/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_two_attributes.php new file mode 100644 index 0000000000000..b0d1948ac8be2 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_two_attributes.php @@ -0,0 +1,120 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\Data\ProductExtensionFactory; +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Catalog\Model\Product\Type as ProductType; +use Magento\Catalog\Model\Product\Visibility; +use Magento\Catalog\Model\ProductFactory; +use Magento\ConfigurableProduct\Helper\Product\Options\Factory; +use Magento\ConfigurableProduct\Model\Product\Type\Configurable; +use Magento\Framework\ObjectManagerInterface; +use Magento\Store\Api\WebsiteRepositoryInterface; +use Magento\TestFramework\Helper\Bootstrap; + +require __DIR__ . '/product_text_swatch_attribute.php'; +require __DIR__ . '/product_visual_swatch_attribute.php'; + +/** @var ObjectManagerInterface $objectManager */ +$objectManager = Bootstrap::getObjectManager(); +/** @var ProductAttributeRepositoryInterface $productAttributeRepository */ +$productAttributeRepository = $objectManager->get(ProductAttributeRepositoryInterface::class); +$attribute = $productAttributeRepository->get('text_swatch_attribute'); +$secondAttribute = $productAttributeRepository->get('visual_swatch_attribute'); +$options = $attribute->getOptions(); +$secondAttributeOptions = $secondAttribute->getOptions(); +/** @var WebsiteRepositoryInterface $websiteRepository */ +$websiteRepository = $objectManager->get(WebsiteRepositoryInterface::class); +$baseWebsite = $websiteRepository->get('base'); +/** @var ProductAttributeRepositoryInterface $productRepository */ +$productRepository = $objectManager->create(ProductRepositoryInterface::class); +$attributeValues = []; +$secondAttributeValues = []; +$associatedProductIds = []; +$associatedProductIdsViaSecondAttribute = []; +$attributeSetId = $installer->getAttributeSetId(Product::ENTITY, 'Default'); +$productFactory = $objectManager->get(ProductFactory::class); +$rootCategoryId = $baseWebsite->getDefaultStore()->getRootCategoryId(); +array_shift($options); +array_shift($secondAttributeOptions); + +foreach ($options as $option) { + foreach ($secondAttributeOptions as $secondAttrOption) { + $product = $productFactory->create(); + $product->setTypeId(ProductType::TYPE_SIMPLE) + ->setAttributeSetId($product->getDefaultAttributeSetId()) + ->setWebsiteIds([$baseWebsite->getId()]) + ->setName('Configurable Option ' . $option->getLabel()) + ->setSku( + strtolower( + str_replace(' ', '_', 'simple ' . $option->getLabel() . '_' . $secondAttrOption->getLabel()) + ) + ) + ->setPrice(150) + ->setTextSwatchAttribute($option->getValue()) + ->setVisualSwatchAttribute($secondAttrOption->getValue()) + ->setVisibility(Visibility::VISIBILITY_NOT_VISIBLE) + ->setStatus(Status::STATUS_ENABLED) + ->setCategoryIds([$rootCategoryId]) + ->setStockData(['use_config_manage_stock' => 1, 'qty' => 100, 'is_qty_decimal' => 0, 'is_in_stock' => 1]); + $product = $productRepository->save($product, true); + $associatedProductIds[] = $product->getId(); + } + + $attributeValues[] = [ + 'label' => 'test1', + 'attribute_id' => $attribute->getId(), + 'value_index' => $option->getValue(), + ]; +} +foreach ($secondAttributeOptions as $secondAttrOption) { + $secondAttributeValues[] = [ + 'label' => 'test2', + 'attribute_id' => $secondAttribute->getId(), + 'value_index' => $secondAttrOption->getValue(), + ]; +} + +$allAttributes = [$attribute, $secondAttribute]; +$optionsFactory = $objectManager->get(Factory::class); + +foreach ($allAttributes as $attribute) { + $configurableAttributesData[] = + [ + 'attribute_id' => $attribute->getId(), + 'code' => $attribute->getAttributeCode(), + 'label' => $attribute->getStoreLabel(), + 'position' => '0', + 'values' => $attribute->getAttributeCode() === 'text_swatch_attribute' + ? $attributeValues + : $secondAttributeValues, + ]; + +} + +$configurableOptions = $optionsFactory->create($configurableAttributesData); +$product = $productFactory->create(); +/** @var ProductExtensionFactory $extensionAttributesFactory */ +$extensionAttributesFactory = $objectManager->get(ProductExtensionFactory::class); +$extensionConfigurableAttributes = $product->getExtensionAttributes() ?: $extensionAttributesFactory->create(); +$extensionConfigurableAttributes->setConfigurableProductOptions($configurableOptions); +$extensionConfigurableAttributes->setConfigurableProductLinks($associatedProductIds); +$product->setExtensionAttributes($extensionConfigurableAttributes); + +$product->setTypeId(Configurable::TYPE_CODE) + ->setAttributeSetId($product->getDefaultAttributeSetId()) + ->setWebsiteIds([$baseWebsite->getId()]) + ->setName('Configurable Product') + ->setSku('configurable') + ->setVisibility(Visibility::VISIBILITY_BOTH) + ->setStatus(Status::STATUS_ENABLED) + ->setCategoryIds([$rootCategoryId]) + ->setStockData(['use_config_manage_stock' => 1, 'is_in_stock' => 1]); +$productRepository->save($product); diff --git a/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_two_attributes_rollback.php b/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_two_attributes_rollback.php new file mode 100644 index 0000000000000..c92330e49688b --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_two_attributes_rollback.php @@ -0,0 +1,52 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Registry; +use Magento\TestFramework\Helper\Bootstrap; + +/** @var ObjectManagerInterface $objectManager */ +$objectManager = Bootstrap::getObjectManager(); +/** @var Registry $registry */ +$registry = $objectManager->get(Registry::class); +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->get(ProductRepositoryInterface::class); +/** @var ProductAttributeRepositoryInterface $productAttributeRepository */ +$productAttributeRepository = $objectManager->create(ProductAttributeRepositoryInterface::class); +$options = $productAttributeRepository->get('text_swatch_attribute')->getOptions(); +$secondAttributeOptions = $productAttributeRepository->get('visual_swatch_attribute')->getOptions(); +array_shift($options); +array_shift($secondAttributeOptions); +$productsArray = []; + +foreach ($options as $option) { + foreach ($secondAttributeOptions as $secondAttrOption) { + $productsArray[] = strtolower( + str_replace(' ', '_', 'simple ' . $option->getLabel() . '_' . $secondAttrOption->getLabel()) + ); + } +} + +$productsArray[] = 'configurable'; +foreach ($productsArray as $sku) { + try { + $productRepository->deleteById($sku); + } catch (NoSuchEntityException $e) { + //Product already removed + } +} + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); + +require __DIR__ . '/product_text_swatch_attribute_rollback.php'; +require __DIR__ . '/product_visual_swatch_attribute_rollback.php'; diff --git a/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_visual_swatch_attribute.php b/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_visual_swatch_attribute.php new file mode 100644 index 0000000000000..c47be2717f5a8 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_visual_swatch_attribute.php @@ -0,0 +1,93 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\Data\ProductExtensionFactory; +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Catalog\Model\Product\Type as ProductType; +use Magento\Catalog\Model\Product\Visibility; +use Magento\Catalog\Model\ProductFactory; +use Magento\ConfigurableProduct\Helper\Product\Options\Factory; +use Magento\ConfigurableProduct\Model\Product\Type\Configurable; +use Magento\Framework\ObjectManagerInterface; +use Magento\Store\Api\WebsiteRepositoryInterface; +use Magento\TestFramework\Helper\Bootstrap; + +require __DIR__ . '/product_visual_swatch_attribute.php'; + +/** @var ObjectManagerInterface $objectManager */ +$objectManager = Bootstrap::getObjectManager(); +/** @var ProductAttributeRepositoryInterface $productAttributeRepository */ +$productAttributeRepository = $objectManager->create(ProductAttributeRepositoryInterface::class); +$attribute = $productAttributeRepository->get('visual_swatch_attribute'); +$options = $attribute->getOptions(); +/** @var WebsiteRepositoryInterface $websiteRepository */ +$websiteRepository = $objectManager->get(WebsiteRepositoryInterface::class); +$baseWebsite = $websiteRepository->get('base'); +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->create(ProductRepositoryInterface::class); +/** @var ProductFactory $productFactory */ +$productFactory = $objectManager->get(ProductFactory::class); +$attributeValues = []; +$associatedProductIds = []; +$rootCategoryId = $baseWebsite->getDefaultStore()->getRootCategoryId(); +array_shift($options); + +foreach ($options as $option) { + $product = $productFactory->create(); + $product->setTypeId(ProductType::TYPE_SIMPLE) + ->setAttributeSetId($product->getDefaultAttributeSetId()) + ->setWebsiteIds([$baseWebsite->getId()]) + ->setName('Configurable Option ' . $option->getLabel()) + ->setSku(strtolower(str_replace(' ', '_', 'simple ' . $option->getLabel()))) + ->setPrice(150) + ->setVisualSwatchAttribute($option->getValue()) + ->setVisibility(Visibility::VISIBILITY_NOT_VISIBLE) + ->setStatus(Status::STATUS_ENABLED) + ->setCategoryIds([$rootCategoryId]) + ->setStockData(['use_config_manage_stock' => 1, 'qty' => 100, 'is_qty_decimal' => 0, 'is_in_stock' => 1]); + $product = $productRepository->save($product); + + $attributeValues[] = [ + 'label' => 'test', + 'attribute_id' => $attribute->getId(), + 'value_index' => $option->getValue(), + ]; + $associatedProductIds[] = $product->getId(); +} +/** @var Factory $optionsFactory */ +$optionsFactory = $objectManager->get(Factory::class); +$configurableAttributesData = [ + [ + 'attribute_id' => $attribute->getId(), + 'code' => $attribute->getAttributeCode(), + 'label' => $attribute->getStoreLabel(), + 'position' => '0', + 'values' => $attributeValues, + ], +]; +$configurableOptions = $optionsFactory->create($configurableAttributesData); + +$product = $productFactory->create(); +/** @var ProductExtensionFactory $extensionAttributesFactory */ +$extensionAttributesFactory = $objectManager->get(ProductExtensionFactory::class); +$extensionConfigurableAttributes = $product->getExtensionAttributes() ?: $extensionAttributesFactory->create(); +$extensionConfigurableAttributes->setConfigurableProductOptions($configurableOptions); +$extensionConfigurableAttributes->setConfigurableProductLinks($associatedProductIds); +$product->setExtensionAttributes($extensionConfigurableAttributes); + +$product->setTypeId(Configurable::TYPE_CODE) + ->setAttributeSetId($product->getDefaultAttributeSetId()) + ->setWebsiteIds([$baseWebsite->getId()]) + ->setName('Configurable Product') + ->setSku('configurable') + ->setVisibility(Visibility::VISIBILITY_BOTH) + ->setStatus(Status::STATUS_ENABLED) + ->setCategoryIds([$rootCategoryId]) + ->setStockData(['use_config_manage_stock' => 1, 'is_in_stock' => 1]); +$productRepository->save($product); diff --git a/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_visual_swatch_attribute_rollback.php b/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_visual_swatch_attribute_rollback.php new file mode 100644 index 0000000000000..22ea728f36327 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_visual_swatch_attribute_rollback.php @@ -0,0 +1,46 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Registry; +use Magento\TestFramework\Helper\Bootstrap; + +/** @var ObjectManagerInterface $objectManager */ +$objectManager = Bootstrap::getObjectManager(); +/** @var Registry $registry */ +$registry = $objectManager->get(Registry::class); +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->get(ProductRepositoryInterface::class); +/** @var ProductAttributeRepositoryInterface $productAttributeRepository */ +$productAttributeRepository = $objectManager->create(ProductAttributeRepositoryInterface::class); +$attribute = $productAttributeRepository->get('visual_swatch_attribute'); +$options = $attribute->getOptions(); +array_shift($options); +$productsArray = []; + +foreach ($options as $option) { + $productsArray [] = strtolower(str_replace(' ', '_', 'simple ' . $option->getLabel())); +} + +$productsArray[] = 'configurable'; +foreach ($productsArray as $sku) { + try { + $productRepository->deleteById($sku); + } catch (NoSuchEntityException $e) { + //Product already removed + } +} + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); + +require __DIR__ . '/product_visual_swatch_attribute_rollback.php'; From 0228d4bf27c243d10b0dfcef56cca5bd13579f8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Sun, 12 Jan 2020 02:16:07 +0100 Subject: [PATCH 0793/1143] Refactor + `array_merge` in loop replace + PHPCS fixes --- .../CatalogInventory/Model/StockIndex.php | 45 +++++---- .../Model/Search/FiltersExtractor.php | 37 ++++---- .../Model/Category/Plugin/Store/Group.php | 46 ++++----- .../Block/Product/ProductsList.php | 78 +++++++++------- .../Model/AgreementsValidator.php | 16 ++-- .../Model/System/Currencysymbol.php | 15 +-- .../Observer/CurrencyDisplayOptionsTest.php | 11 ++- .../Model/Address/CompositeValidator.php | 6 +- .../Magento/Customer/Model/Metadata/Form.php | 8 +- .../Attribute/Source/CountryWithWebsites.php | 48 ++++++---- .../Model/Import/Address.php | 18 ++-- .../Model/Import/Customer.php | 16 ++-- app/code/Magento/Deploy/Package/Package.php | 9 +- .../Package/Processor/PreProcessor/Css.php | 13 ++- .../Command/XmlCatalogGenerateCommand.php | 56 ++++++----- .../Directory/Model/AllowedCountries.php | 8 +- .../Attribute/Edit/Options/Options.php | 11 +-- app/code/Magento/Eav/Model/Form.php | 12 ++- .../Product/CompositeFieldProvider.php | 6 +- .../Block/Cart/Item/Renderer/Grouped.php | 6 +- .../Block/Stockqty/Type/Grouped.php | 6 +- .../ProcessingErrorAggregator.php | 16 ++-- .../Activate/Permissions/Tab/Webapi.php | 16 ++-- .../PageCache/Model/Layout/LayoutPlugin.php | 6 +- .../Gateway/Validator/ValidatorComposite.php | 22 ++--- .../Structure/PaymentSectionModifier.php | 24 +++-- .../Cart/BuyRequest/BuyRequestBuilder.php | 6 +- .../Magento/Reports/Block/Product/Viewed.php | 9 +- .../Adminhtml/Items/Column/DefaultColumn.php | 10 +- .../Block/Order/Email/Items/DefaultItems.php | 18 ++-- .../Order/Email/Items/Order/DefaultOrder.php | 30 +++--- .../Order/Item/Renderer/DefaultRenderer.php | 39 ++++---- .../Model/Order/Pdf/Items/AbstractItems.php | 83 ++++++++++------- .../Provider/NotSyncedDataProvider.php | 13 ++- .../Magento/Search/Model/Autocomplete.php | 11 ++- .../Search/Model/SynonymGroupRepository.php | 17 ++-- .../Calculation/Rate/Collection.php | 65 +++++++------ .../Magento/Weee/Model/Total/Quote/Weee.php | 93 ++++++++++--------- 38 files changed, 523 insertions(+), 426 deletions(-) diff --git a/app/code/Magento/CatalogInventory/Model/StockIndex.php b/app/code/Magento/CatalogInventory/Model/StockIndex.php index 41db057cf149c..af211b98386bd 100644 --- a/app/code/Magento/CatalogInventory/Model/StockIndex.php +++ b/app/code/Magento/CatalogInventory/Model/StockIndex.php @@ -10,12 +10,15 @@ use Magento\Catalog\Model\Product\Website as ProductWebsite; use Magento\Catalog\Model\ProductFactory; use Magento\CatalogInventory\Api\StockIndexInterface; +use Magento\CatalogInventory\Model\ResourceModel\Stock\Status as StockStatusResourceModel; use Magento\CatalogInventory\Model\Spi\StockRegistryProviderInterface; use Magento\Catalog\Api\ProductRepositoryInterface; use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Framework\App\ObjectManager; /** - * Class StockIndex + * Index responsible for Stock + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class StockIndex implements StockIndexInterface @@ -31,7 +34,7 @@ class StockIndex implements StockIndexInterface protected $productRepository; /** - * @var \Magento\CatalogInventory\Model\ResourceModel\Stock\Status + * @var StockStatusResourceModel */ protected $stockStatusResource; @@ -47,6 +50,11 @@ class StockIndex implements StockIndexInterface */ protected $websites; + /** + * @var ProductWebsite + */ + private $productWebsite; + /** * Product Type Instances cache * @@ -88,7 +96,7 @@ public function rebuild($productId = null, $scopeId = null) } else { $lastProductId = 0; while (true) { - /** @var \Magento\CatalogInventory\Model\ResourceModel\Stock\Status $resource */ + /** @var StockStatusResourceModel $resource */ $resource = $this->getStockStatusResource(); $productCollection = $resource->getProductCollection($lastProductId); if (!$productCollection) { @@ -132,7 +140,7 @@ public function updateProductStockStatus($productId, $websiteId) * @param int $websiteId * @param int $qty * @param int $status - * @return $this + * @return void * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ protected function processChildren( @@ -160,10 +168,12 @@ protected function processChildren( $requiredChildrenIds = $typeInstance->getChildrenIds($productId, true); if ($requiredChildrenIds) { - $childrenIds = []; + $childrenIds = [[]]; foreach ($requiredChildrenIds as $groupedChildrenIds) { - $childrenIds = array_merge($childrenIds, $groupedChildrenIds); + $childrenIds[] = $groupedChildrenIds; } + $childrenIds = array_merge(...$childrenIds); + $childrenWebsites = $this->productWebsite->getWebsites($childrenIds); foreach ($websitesWithStores as $websiteId => $storeId) { $childrenStatus = $this->getStockStatusResource()->getProductStatus($childrenIds, $storeId); @@ -201,7 +211,7 @@ protected function processChildren( protected function getWebsitesWithDefaultStores($websiteId = null) { if ($this->websites === null) { - /** @var \Magento\CatalogInventory\Model\ResourceModel\Stock\Status $resource */ + /** @var StockStatusResourceModel $resource */ $resource = $this->getStockStatusResource(); $this->websites = $resource->getWebsiteStores(); } @@ -217,17 +227,19 @@ protected function getWebsitesWithDefaultStores($websiteId = null) * * @param int $productId * @param int $websiteId - * @return $this + * @return void */ protected function processParents($productId, $websiteId) { - $parentIds = []; + $parentIds = [[]]; foreach ($this->getProductTypeInstances() as $typeInstance) { /* @var $typeInstance AbstractType */ - $parentIds = array_merge($parentIds, $typeInstance->getParentIdsByChild($productId)); + $parentIds[] = $typeInstance->getParentIdsByChild($productId); } - if (!$parentIds) { + $parentIds = array_merge(...$parentIds); + + if (empty($parentIds)) { return $this; } @@ -244,8 +256,7 @@ protected function processParents($productId, $websiteId) } /** - * Retrieve Product Type Instances - * as key - type code, value - instance model + * Retrieve Product Type Instances as key - type code, value - instance model * * @return array */ @@ -262,14 +273,14 @@ protected function getProductTypeInstances() } /** - * @return \Magento\CatalogInventory\Model\ResourceModel\Stock\Status + * Returns ResourceModel for Stock Status + * + * @return StockStatusResourceModel */ protected function getStockStatusResource() { if (empty($this->stockStatusResource)) { - $this->stockStatusResource = \Magento\Framework\App\ObjectManager::getInstance()->get( - \Magento\CatalogInventory\Model\ResourceModel\Stock\Status::class - ); + $this->stockStatusResource = ObjectManager::getInstance()->get(StockStatusResourceModel::class); } return $this->stockStatusResource; } diff --git a/app/code/Magento/CatalogSearch/Model/Search/FiltersExtractor.php b/app/code/Magento/CatalogSearch/Model/Search/FiltersExtractor.php index 55c8582979912..63d7ee0e6e4c0 100644 --- a/app/code/Magento/CatalogSearch/Model/Search/FiltersExtractor.php +++ b/app/code/Magento/CatalogSearch/Model/Search/FiltersExtractor.php @@ -10,11 +10,10 @@ use Magento\Framework\Search\Request\Filter\BoolExpression; /** - * Class FiltersExtractor * Extracts filters from QueryInterface * - * @deprecated - * @see \Magento\ElasticSearch + * @deprecated Use Magento\Elasticsearch implementation of QueryInterface + * @see \Magento\Elasticsearch */ class FiltersExtractor { @@ -26,19 +25,19 @@ class FiltersExtractor */ public function extractFiltersFromQuery(QueryInterface $query) { - $filters = []; + $filters = [[]]; switch ($query->getType()) { case QueryInterface::TYPE_BOOL: /** @var \Magento\Framework\Search\Request\Query\BoolExpression $query */ foreach ($query->getMust() as $subQuery) { - $filters = array_merge($filters, $this->extractFiltersFromQuery($subQuery)); + $filters[] = $this->extractFiltersFromQuery($subQuery); } foreach ($query->getShould() as $subQuery) { - $filters = array_merge($filters, $this->extractFiltersFromQuery($subQuery)); + $filters[] = $this->extractFiltersFromQuery($subQuery); } foreach ($query->getMustNot() as $subQuery) { - $filters = array_merge($filters, $this->extractFiltersFromQuery($subQuery)); + $filters[] = $this->extractFiltersFromQuery($subQuery); } break; @@ -46,9 +45,9 @@ public function extractFiltersFromQuery(QueryInterface $query) /** @var Filter $query */ $filter = $query->getReference(); if (FilterInterface::TYPE_BOOL === $filter->getType()) { - $filters = array_merge($filters, $this->getFiltersFromBoolFilter($filter)); + $filters[] = $this->getFiltersFromBoolFilter($filter); } else { - $filters[] = $filter; + $filters[] = [$filter]; } break; @@ -56,39 +55,41 @@ public function extractFiltersFromQuery(QueryInterface $query) break; } - return $filters; + return array_merge(...$filters); } /** + * Returns list of filters from Bool filter + * * @param BoolExpression $boolExpression * @return FilterInterface[] */ private function getFiltersFromBoolFilter(BoolExpression $boolExpression) { - $filters = []; + $filters = [[]]; /** @var BoolExpression $filter */ foreach ($boolExpression->getMust() as $filter) { if ($filter->getType() === FilterInterface::TYPE_BOOL) { - $filters = array_merge($filters, $this->getFiltersFromBoolFilter($filter)); + $filters[] = $this->getFiltersFromBoolFilter($filter); } else { - $filters[] = $filter; + $filters[] = [$filter]; } } foreach ($boolExpression->getShould() as $filter) { if ($filter->getType() === FilterInterface::TYPE_BOOL) { - $filters = array_merge($filters, $this->getFiltersFromBoolFilter($filter)); + $filters[] = $this->getFiltersFromBoolFilter($filter); } else { - $filters[] = $filter; + $filters[] = [$filter]; } } foreach ($boolExpression->getMustNot() as $filter) { if ($filter->getType() === FilterInterface::TYPE_BOOL) { - $filters = array_merge($filters, $this->getFiltersFromBoolFilter($filter)); + $filters[] = $this->getFiltersFromBoolFilter($filter); } else { - $filters[] = $filter; + $filters[] = [$filter]; } } - return $filters; + return array_merge(...$filters); } } diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/Group.php b/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/Group.php index 1dbfad6cf5219..308b82e38c43a 100644 --- a/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/Group.php +++ b/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/Group.php @@ -5,6 +5,7 @@ */ namespace Magento\CatalogUrlRewrite\Model\Category\Plugin\Store; +use Magento\Store\Model\ResourceModel\Group as StoreGroup; use Magento\UrlRewrite\Model\UrlPersistInterface; use Magento\UrlRewrite\Service\V1\Data\UrlRewrite; use Magento\Catalog\Model\CategoryFactory; @@ -16,37 +17,39 @@ use Magento\Framework\Model\AbstractModel; /** + * Generate Product and Category URLs + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Group { /** - * @var \Magento\UrlRewrite\Model\UrlPersistInterface + * @var UrlPersistInterface */ protected $urlPersist; /** - * @var \Magento\Catalog\Model\CategoryFactory + * @var CategoryFactory */ protected $categoryFactory; /** - * @var \Magento\Catalog\Model\ProductFactory + * @var ProductFactory */ protected $productFactory; /** - * @var \Magento\CatalogUrlRewrite\Model\CategoryUrlRewriteGenerator + * @var CategoryUrlRewriteGenerator */ protected $categoryUrlRewriteGenerator; /** - * @var \Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator + * @var ProductUrlRewriteGenerator */ protected $productUrlRewriteGenerator; /** - * @var \Magento\Store\Model\StoreManagerInterface + * @var StoreManagerInterface */ protected $storeManager; @@ -77,15 +80,15 @@ public function __construct( /** * Perform updating url for categories and products assigned to the group * - * @param \Magento\Store\Model\ResourceModel\Group $subject - * @param \Magento\Store\Model\ResourceModel\Group $result + * @param StoreGroup $subject + * @param StoreGroup $result * @param AbstractModel $group - * @return \Magento\Store\Model\ResourceModel\Group + * @return StoreGroup * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function afterSave( - \Magento\Store\Model\ResourceModel\Group $subject, - \Magento\Store\Model\ResourceModel\Group $result, + StoreGroup $subject, + StoreGroup $result, AbstractModel $group ) { if (!$group->isObjectNew() @@ -118,7 +121,7 @@ public function afterSave( */ protected function generateProductUrls($websiteId, $originWebsiteId) { - $urls = []; + $urls = [[]]; $websiteIds = $websiteId != $originWebsiteId ? [$websiteId, $originWebsiteId] : [$websiteId]; @@ -130,33 +133,30 @@ protected function generateProductUrls($websiteId, $originWebsiteId) foreach ($collection as $product) { /** @var \Magento\Catalog\Model\Product $product */ $product->setStoreId(Store::DEFAULT_STORE_ID); - $urls = array_merge( - $urls, - $this->productUrlRewriteGenerator->generate($product) - ); + $urls[] = $this->productUrlRewriteGenerator->generate($product); } - return $urls; + return array_merge(...$urls); } /** + * Generate url rewrites for categories assigned to store + * * @param int $rootCategoryId * @param array $storeIds * @return array */ protected function generateCategoryUrls($rootCategoryId, $storeIds) { - $urls = []; + $urls = [[]]; $categories = $this->categoryFactory->create()->getCategories($rootCategoryId, 1, false, true); foreach ($categories as $category) { /** @var \Magento\Catalog\Model\Category $category */ $category->setStoreId(Store::DEFAULT_STORE_ID); $category->setStoreIds($storeIds); - $urls = array_merge( - $urls, - $this->categoryUrlRewriteGenerator->generate($category) - ); + $urls[] = $this->categoryUrlRewriteGenerator->generate($category); } - return $urls; + + return array_merge(...$urls); } } diff --git a/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php b/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php index 9e47830debfc4..22e3a7382cdac 100644 --- a/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php +++ b/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php @@ -6,15 +6,26 @@ namespace Magento\CatalogWidget\Block\Product; +use Magento\Catalog\Block\Product\AbstractProduct; +use Magento\Catalog\Block\Product\Context; +use Magento\Catalog\Block\Product\Widget\Html\Pager as ProductBlockPager; use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\Product\Visibility as ProductVisibility; +use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory as ProductCollectionFactory; +use Magento\CatalogWidget\Model\Rule; +use Magento\Framework\App\Http\Context as HttpContext; use Magento\Framework\App\ObjectManager; use Magento\Framework\App\ActionInterface; use Magento\Framework\DataObject\IdentityInterface; use Magento\Framework\Pricing\PriceCurrencyInterface; use Magento\Framework\Serialize\Serializer\Json; +use Magento\Framework\Url\EncoderInterface as UrlEncoderInterface; +use Magento\Framework\View\Element\RendererList; use Magento\Framework\View\LayoutFactory; +use Magento\Rule\Model\Condition\Sql\Builder as SqlConditionBuilder; use Magento\Widget\Block\BlockInterface; use Magento\Framework\Url\EncoderInterface; +use Magento\Widget\Helper\Conditions as ConditionsHelper; /** * Catalog Products List widget block @@ -22,7 +33,7 @@ * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ -class ProductsList extends \Magento\Catalog\Block\Product\AbstractProduct implements BlockInterface, IdentityInterface +class ProductsList extends AbstractProduct implements BlockInterface, IdentityInterface { /** * Default value for products count that will be shown @@ -32,7 +43,8 @@ class ProductsList extends \Magento\Catalog\Block\Product\AbstractProduct implem /** * Name of request parameter for page number value * - * @deprecated + * @deprecated No longer used for Magento Core + * @see self::getData('page_var_name') */ const PAGE_VAR_NAME = 'np'; @@ -49,41 +61,41 @@ class ProductsList extends \Magento\Catalog\Block\Product\AbstractProduct implem /** * Instance of pager block * - * @var \Magento\Catalog\Block\Product\Widget\Html\Pager + * @var ProductBlockPager */ protected $pager; /** - * @var \Magento\Framework\App\Http\Context + * @var HttpContext */ protected $httpContext; /** * Catalog product visibility * - * @var \Magento\Catalog\Model\Product\Visibility + * @var ProductVisibility */ protected $catalogProductVisibility; /** * Product collection factory * - * @var \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory + * @var ProductCollectionFactory */ protected $productCollectionFactory; /** - * @var \Magento\Rule\Model\Condition\Sql\Builder + * @var SqlConditionBuilder */ protected $sqlBuilder; /** - * @var \Magento\CatalogWidget\Model\Rule + * @var Rule */ protected $rule; /** - * @var \Magento\Widget\Helper\Conditions + * @var ConditionsHelper */ protected $conditionsHelper; @@ -105,38 +117,38 @@ class ProductsList extends \Magento\Catalog\Block\Product\AbstractProduct implem private $layoutFactory; /** - * @var \Magento\Framework\Url\EncoderInterface|null + * @var UrlEncoderInterface|null */ private $urlEncoder; /** - * @var \Magento\Framework\View\Element\RendererList + * @var RendererList */ private $rendererListBlock; /** - * @param \Magento\Catalog\Block\Product\Context $context - * @param \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory - * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility - * @param \Magento\Framework\App\Http\Context $httpContext - * @param \Magento\Rule\Model\Condition\Sql\Builder $sqlBuilder - * @param \Magento\CatalogWidget\Model\Rule $rule - * @param \Magento\Widget\Helper\Conditions $conditionsHelper + * @param Context $context + * @param ProductCollectionFactory $productCollectionFactory + * @param ProductVisibility $catalogProductVisibility + * @param HttpContext $httpContext + * @param SqlConditionBuilder $sqlBuilder + * @param Rule $rule + * @param ConditionsHelper $conditionsHelper * @param array $data * @param Json|null $json * @param LayoutFactory|null $layoutFactory - * @param \Magento\Framework\Url\EncoderInterface|null $urlEncoder + * @param UrlEncoderInterface|null $urlEncoder * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Catalog\Block\Product\Context $context, - \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory, - \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, - \Magento\Framework\App\Http\Context $httpContext, - \Magento\Rule\Model\Condition\Sql\Builder $sqlBuilder, - \Magento\CatalogWidget\Model\Rule $rule, - \Magento\Widget\Helper\Conditions $conditionsHelper, + Context $context, + ProductCollectionFactory $productCollectionFactory, + ProductVisibility $catalogProductVisibility, + HttpContext $httpContext, + SqlConditionBuilder $sqlBuilder, + Rule $rule, + ConditionsHelper $conditionsHelper, array $data = [], Json $json = null, LayoutFactory $layoutFactory = null, @@ -173,7 +185,8 @@ protected function _construct() $this->addData([ 'cache_lifetime' => 86400, - 'cache_tags' => [\Magento\Catalog\Model\Product::CACHE_TAG, + 'cache_tags' => [ + Product::CACHE_TAG, ], ]); } @@ -210,7 +223,7 @@ public function getCacheKeyInfo() * @SuppressWarnings(PHPMD.NPathComplexity) */ public function getProductPriceHtml( - \Magento\Catalog\Model\Product $product, + Product $product, $priceType = null, $renderZone = \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, array $arguments = [] @@ -418,7 +431,7 @@ public function getPagerHtml() if ($this->showPager() && $this->getProductCollection()->getSize() > $this->getProductsPerPage()) { if (!$this->pager) { $this->pager = $this->getLayout()->createBlock( - \Magento\Catalog\Block\Product\Widget\Html\Pager::class, + ProductBlockPager::class, $this->getWidgetPagerBlockName() ); @@ -444,16 +457,17 @@ public function getPagerHtml() */ public function getIdentities() { - $identities = []; + $identities = [[]]; if ($this->getProductCollection()) { foreach ($this->getProductCollection() as $product) { if ($product instanceof IdentityInterface) { - $identities = array_merge($identities, $product->getIdentities()); + $identities[] = $product->getIdentities(); } } } + $identities = array_merge(...$identities); - return $identities ?: [\Magento\Catalog\Model\Product::CACHE_TAG]; + return $identities ?: [Product::CACHE_TAG]; } /** diff --git a/app/code/Magento/CheckoutAgreements/Model/AgreementsValidator.php b/app/code/Magento/CheckoutAgreements/Model/AgreementsValidator.php index 8d25ba88c0f82..2643e69ba1efd 100644 --- a/app/code/Magento/CheckoutAgreements/Model/AgreementsValidator.php +++ b/app/code/Magento/CheckoutAgreements/Model/AgreementsValidator.php @@ -5,13 +5,15 @@ */ namespace Magento\CheckoutAgreements\Model; +use Magento\Checkout\Api\AgreementsValidatorInterface; + /** - * Class AgreementsValidator + * Validator for Checkout Agreements */ -class AgreementsValidator implements \Magento\Checkout\Api\AgreementsValidatorInterface +class AgreementsValidator implements AgreementsValidatorInterface { /** - * @var \Magento\CheckoutAgreements\Model\AgreementsProviderInterface[] + * @var AgreementsProviderInterface[] */ protected $agreementsProviders; @@ -33,11 +35,13 @@ public function __construct($list = null) public function isValid($agreementIds = []) { $agreementIds = $agreementIds === null ? [] : $agreementIds; - $requiredAgreements = []; + $requiredAgreements = [[]]; foreach ($this->agreementsProviders as $agreementsProvider) { - $requiredAgreements = array_merge($requiredAgreements, $agreementsProvider->getRequiredAgreementIds()); + $requiredAgreements[] = $agreementsProvider->getRequiredAgreementIds(); } - $agreementsDiff = array_diff($requiredAgreements, $agreementIds); + + $agreementsDiff = array_diff(array_merge(...$requiredAgreements), $agreementIds); + return empty($agreementsDiff); } } diff --git a/app/code/Magento/CurrencySymbol/Model/System/Currencysymbol.php b/app/code/Magento/CurrencySymbol/Model/System/Currencysymbol.php index 6c7019986cce0..d48df02d9de27 100644 --- a/app/code/Magento/CurrencySymbol/Model/System/Currencysymbol.php +++ b/app/code/Magento/CurrencySymbol/Model/System/Currencysymbol.php @@ -292,7 +292,8 @@ protected function _unserializeStoreConfig($configPath, $storeId = null) */ protected function getAllowedCurrencies() { - $allowedCurrencies = explode( + $allowedCurrencies = [[]]; + $allowedCurrencies[] = explode( self::ALLOWED_CURRENCIES_CONFIG_SEPARATOR, $this->_scopeConfig->getValue( self::XML_PATH_ALLOWED_CURRENCIES, @@ -318,23 +319,17 @@ protected function getAllowedCurrencies() if (!$websiteShow) { $websiteShow = true; $websiteSymbols = $website->getConfig(self::XML_PATH_ALLOWED_CURRENCIES); - $allowedCurrencies = array_merge( - $allowedCurrencies, - explode(self::ALLOWED_CURRENCIES_CONFIG_SEPARATOR, $websiteSymbols) - ); + $allowedCurrencies[] = explode(self::ALLOWED_CURRENCIES_CONFIG_SEPARATOR, $websiteSymbols); } $storeSymbols = $this->_scopeConfig->getValue( self::XML_PATH_ALLOWED_CURRENCIES, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ); - $allowedCurrencies = array_merge( - $allowedCurrencies, - explode(self::ALLOWED_CURRENCIES_CONFIG_SEPARATOR, $storeSymbols) - ); + $allowedCurrencies[] = explode(self::ALLOWED_CURRENCIES_CONFIG_SEPARATOR, $storeSymbols); } } } - return array_unique($allowedCurrencies); + return array_unique(array_merge(...$allowedCurrencies)); } } diff --git a/app/code/Magento/CurrencySymbol/Test/Unit/Observer/CurrencyDisplayOptionsTest.php b/app/code/Magento/CurrencySymbol/Test/Unit/Observer/CurrencyDisplayOptionsTest.php index dd0d7ffc8cc68..ae8c12c2019b8 100644 --- a/app/code/Magento/CurrencySymbol/Test/Unit/Observer/CurrencyDisplayOptionsTest.php +++ b/app/code/Magento/CurrencySymbol/Test/Unit/Observer/CurrencyDisplayOptionsTest.php @@ -6,6 +6,7 @@ namespace Magento\CurrencySymbol\Test\Unit\Observer; use Magento\CurrencySymbol\Model\System\CurrencysymbolFactory; +use Magento\Framework\Locale\Currency; /** * Test for \Magento\CurrencySymbol\Observer\CurrencyDisplayOptions @@ -65,7 +66,7 @@ protected function setUp() public function testCurrencyDisplayOptionsEmpty() { $baseData = [ - \Magento\Framework\Locale\Currency::CURRENCY_OPTION_NAME => 'US Dollar' + Currency::CURRENCY_OPTION_NAME => 'US Dollar' ]; $sampleCurrencyOptionObject = new \Magento\Framework\DataObject($baseData); @@ -83,7 +84,7 @@ public function testCurrencyDisplayOptionsEmpty() public function testCurrencyDisplayOptions() { $baseData = [ - \Magento\Framework\Locale\Currency::CURRENCY_OPTION_NAME => 'US Dollar' + Currency::CURRENCY_OPTION_NAME => 'US Dollar' ]; $sampleCurrencyOptionObject = new \Magento\Framework\DataObject($baseData); $sampleCurrency = 'USD'; @@ -92,9 +93,9 @@ public function testCurrencyDisplayOptions() $expectedCurrencyOptions = array_merge( $baseData, [ - \Magento\Framework\Locale\Currency::CURRENCY_OPTION_NAME => 'US Dollar', - \Magento\Framework\Locale\Currency::CURRENCY_OPTION_SYMBOL => $sampleCurrencySymbol, - \Magento\Framework\Locale\Currency::CURRENCY_OPTION_DISPLAY => \Magento\Framework\Currency::USE_SYMBOL + Currency::CURRENCY_OPTION_NAME => 'US Dollar', + Currency::CURRENCY_OPTION_SYMBOL => $sampleCurrencySymbol, + Currency::CURRENCY_OPTION_DISPLAY => \Magento\Framework\Currency::USE_SYMBOL ] ); diff --git a/app/code/Magento/Customer/Model/Address/CompositeValidator.php b/app/code/Magento/Customer/Model/Address/CompositeValidator.php index 1d16a929532f5..4c77f10c11de4 100644 --- a/app/code/Magento/Customer/Model/Address/CompositeValidator.php +++ b/app/code/Magento/Customer/Model/Address/CompositeValidator.php @@ -30,11 +30,11 @@ public function __construct( */ public function validate(AbstractAddress $address) { - $errors = []; + $errors = [[]]; foreach ($this->validators as $validator) { - $errors = array_merge($errors, $validator->validate($address)); + $errors[] = $validator->validate($address); } - return $errors; + return array_merge(...$errors); } } diff --git a/app/code/Magento/Customer/Model/Metadata/Form.php b/app/code/Magento/Customer/Model/Metadata/Form.php index 6df969f625376..85637ebf508b8 100644 --- a/app/code/Magento/Customer/Model/Metadata/Form.php +++ b/app/code/Magento/Customer/Model/Metadata/Form.php @@ -9,6 +9,8 @@ use Magento\Customer\Api\CustomerMetadataInterface; /** + * Customer Form metadata model + * * @api * @since 100.0.2 */ @@ -361,11 +363,11 @@ public function validateData(array $data) { $validator = $this->_getValidator($data); if (!$validator->isValid(false)) { - $messages = []; + $messages = [[]]; foreach ($validator->getMessages() as $errorMessages) { - $messages = array_merge($messages, (array)$errorMessages); + $messages[] = (array)$errorMessages; } - return $messages; + return array_merge(...$messages); } return true; } diff --git a/app/code/Magento/Customer/Model/ResourceModel/Address/Attribute/Source/CountryWithWebsites.php b/app/code/Magento/Customer/Model/ResourceModel/Address/Attribute/Source/CountryWithWebsites.php index ce6278b446302..020067570efb4 100644 --- a/app/code/Magento/Customer/Model/ResourceModel/Address/Attribute/Source/CountryWithWebsites.php +++ b/app/code/Magento/Customer/Model/ResourceModel/Address/Attribute/Source/CountryWithWebsites.php @@ -12,18 +12,28 @@ namespace Magento\Customer\Model\ResourceModel\Address\Attribute\Source; use Magento\Customer\Model\Config\Share; +use Magento\Customer\Model\Config\Share as CustomerShareConfig; use Magento\Directory\Model\AllowedCountries; +use Magento\Directory\Model\ResourceModel\Country\Collection as CountryCollection; +use Magento\Directory\Model\ResourceModel\Country\CollectionFactory as CountryCollectionFactory; +use Magento\Eav\Model\Entity\Attribute\Source\Table; +use Magento\Eav\Model\ResourceModel\Entity\Attribute\Option\CollectionFactory as OptionCollectionFactory; +use Magento\Eav\Model\ResourceModel\Entity\Attribute\OptionFactory as AttrubuteOptionFactory; use Magento\Store\Model\ScopeInterface; +use Magento\Store\Model\StoreManagerInterface; -class CountryWithWebsites extends \Magento\Eav\Model\Entity\Attribute\Source\Table +/** + * Return allowed countries for specified website + */ +class CountryWithWebsites extends Table { /** - * @var \Magento\Directory\Model\ResourceModel\Country\CollectionFactory + * @var CountryCollectionFactory */ private $countriesFactory; /** - * @var \Magento\Directory\Model\AllowedCountries + * @var AllowedCountries */ private $allowedCountriesReader; @@ -33,7 +43,7 @@ class CountryWithWebsites extends \Magento\Eav\Model\Entity\Attribute\Source\Tab private $options; /** - * @var \Magento\Store\Model\StoreManagerInterface + * @var StoreManagerInterface */ private $storeManager; @@ -43,21 +53,20 @@ class CountryWithWebsites extends \Magento\Eav\Model\Entity\Attribute\Source\Tab private $shareConfig; /** - * CountryWithWebsites constructor. - * @param \Magento\Eav\Model\ResourceModel\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory - * @param \Magento\Eav\Model\ResourceModel\Entity\Attribute\OptionFactory $attrOptionFactory - * @param \Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countriesFactory + * @param OptionCollectionFactory $attrOptionCollectionFactory + * @param AttrubuteOptionFactory $attrOptionFactory + * @param CountryCollectionFactory $countriesFactory * @param AllowedCountries $allowedCountriesReader - * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param StoreManagerInterface $storeManager * @param Share $shareConfig */ public function __construct( - \Magento\Eav\Model\ResourceModel\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory, - \Magento\Eav\Model\ResourceModel\Entity\Attribute\OptionFactory $attrOptionFactory, - \Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countriesFactory, - \Magento\Directory\Model\AllowedCountries $allowedCountriesReader, - \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Customer\Model\Config\Share $shareConfig + OptionCollectionFactory $attrOptionCollectionFactory, + AttrubuteOptionFactory $attrOptionFactory, + CountryCollectionFactory $countriesFactory, + AllowedCountries $allowedCountriesReader, + StoreManagerInterface $storeManager, + CustomerShareConfig $shareConfig ) { $this->countriesFactory = $countriesFactory; $this->allowedCountriesReader = $allowedCountriesReader; @@ -72,19 +81,22 @@ public function __construct( public function getAllOptions($withEmpty = true, $defaultValues = false) { if (!$this->options) { - $allowedCountries = []; $websiteIds = []; if (!$this->shareConfig->isGlobalScope()) { + $allowedCountries = [[]]; + foreach ($this->storeManager->getWebsites() as $website) { $countries = $this->allowedCountriesReader ->getAllowedCountries(ScopeInterface::SCOPE_WEBSITE, $website->getId()); - $allowedCountries = array_merge($allowedCountries, $countries); + $allowedCountries[] = $countries; foreach ($countries as $countryCode) { $websiteIds[$countryCode][] = $website->getId(); } } + + $allowedCountries = array_unique(array_merge(...$allowedCountries)); } else { $allowedCountries = $this->allowedCountriesReader->getAllowedCountries(); } @@ -106,7 +118,7 @@ public function getAllOptions($withEmpty = true, $defaultValues = false) /** * Create Countries Collection with all countries * - * @return \Magento\Directory\Model\ResourceModel\Country\Collection + * @return CountryCollection */ private function createCountriesCollection() { diff --git a/app/code/Magento/CustomerImportExport/Model/Import/Address.php b/app/code/Magento/CustomerImportExport/Model/Import/Address.php index 1a8859d5bd7bf..55c58282bcae4 100644 --- a/app/code/Magento/CustomerImportExport/Model/Import/Address.php +++ b/app/code/Magento/CustomerImportExport/Model/Import/Address.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\CustomerImportExport\Model\Import; use Magento\Customer\Model\ResourceModel\Address\Attribute\Source\CountryWithWebsites as CountryWithWebsitesSource; @@ -224,7 +225,11 @@ class Address extends AbstractCustomer * @array */ protected $validColumnNames = [ - "region_id", "vat_is_valid", "vat_request_date", "vat_request_id", "vat_request_success" + "region_id", + "vat_is_valid", + "vat_request_date", + "vat_request_id", + "vat_request_success" ]; /** @@ -507,11 +512,12 @@ public function validateData() protected function _importData() { //Preparing data for mass validation/import. - $rows = []; + $rows = [[]]; while ($bunch = $this->_dataSourceModel->getNextBunch()) { - $rows = array_merge($rows, $bunch); + $rows[] = $bunch; } - $this->prepareCustomerData($rows); + + $this->prepareCustomerData(array_merge(...$rows)); unset($bunch, $rows); $this->_dataSourceModel->getIterator()->rewind(); @@ -586,7 +592,7 @@ protected function _mergeEntityAttributes(array $newAttributes, array $attribute * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ - protected function _prepareDataForUpdate(array $rowData):array + protected function _prepareDataForUpdate(array $rowData): array { $email = strtolower($rowData[self::COLUMN_EMAIL]); $customerId = $this->_getCustomerId($email, $rowData[self::COLUMN_WEBSITE]); @@ -636,7 +642,7 @@ protected function _prepareDataForUpdate(array $rowData):array if ($attributeParams['is_static']) { $entityRow[$attributeAlias] = $value; } else { - $attributes[$attributeParams['table']][$addressId][$attributeParams['id']]= $value; + $attributes[$attributeParams['table']][$addressId][$attributeParams['id']] = $value; } } } diff --git a/app/code/Magento/CustomerImportExport/Model/Import/Customer.php b/app/code/Magento/CustomerImportExport/Model/Import/Customer.php index f86ebaea69730..92b94304186ea 100644 --- a/app/code/Magento/CustomerImportExport/Model/Import/Customer.php +++ b/app/code/Magento/CustomerImportExport/Model/Import/Customer.php @@ -500,8 +500,8 @@ protected function _importData() { while ($bunch = $this->_dataSourceModel->getNextBunch()) { $this->prepareCustomerData($bunch); - $entitiesToCreate = []; - $entitiesToUpdate = []; + $entitiesToCreate = [[]]; + $entitiesToUpdate = [[]]; $entitiesToDelete = []; $attributesToSave = []; @@ -521,10 +521,10 @@ protected function _importData() ); } elseif ($this->getBehavior($rowData) == \Magento\ImportExport\Model\Import::BEHAVIOR_ADD_UPDATE) { $processedData = $this->_prepareDataForUpdate($rowData); - // phpcs:disable Magento2.Performance.ForeachArrayMerge - $entitiesToCreate = array_merge($entitiesToCreate, $processedData[self::ENTITIES_TO_CREATE_KEY]); - $entitiesToUpdate = array_merge($entitiesToUpdate, $processedData[self::ENTITIES_TO_UPDATE_KEY]); - // phpcs:enable + + $entitiesToCreate[] = $processedData[self::ENTITIES_TO_CREATE_KEY]; + $entitiesToUpdate[] = $processedData[self::ENTITIES_TO_UPDATE_KEY]; + foreach ($processedData[self::ATTRIBUTES_TO_SAVE_KEY] as $tableName => $customerAttributes) { if (!isset($attributesToSave[$tableName])) { $attributesToSave[$tableName] = []; @@ -534,6 +534,10 @@ protected function _importData() } } } + + $entitiesToCreate = array_merge(...$entitiesToCreate); + $entitiesToUpdate = array_merge(...$entitiesToUpdate); + $this->updateItemsCounterStats($entitiesToCreate, $entitiesToUpdate, $entitiesToDelete); /** * Save prepared data diff --git a/app/code/Magento/Deploy/Package/Package.php b/app/code/Magento/Deploy/Package/Package.php index 423f3072c4620..4821d32454675 100644 --- a/app/code/Magento/Deploy/Package/Package.php +++ b/app/code/Magento/Deploy/Package/Package.php @@ -443,12 +443,11 @@ public function getResultMap() */ public function getParentMap() { - $map = []; + $map = [[]]; foreach ($this->getParentPackages() as $parentPackage) { - // phpcs:ignore Magento2.Performance.ForeachArrayMerge.ForeachArrayMerge - $map = array_merge($map, $parentPackage->getMap()); + $map[] = $parentPackage->getMap(); } - return $map; + return array_merge(...$map); } /** @@ -462,10 +461,8 @@ public function getParentFiles($type = null) $files = [[]]; foreach ($this->getParentPackages() as $parentPackage) { if ($type === null) { - // phpcs:ignore Magento2.Performance.ForeachArrayMerge.ForeachArrayMerge $files[] = $parentPackage->getFiles(); } else { - // phpcs:ignore Magento2.Performance.ForeachArrayMerge.ForeachArrayMerge $files[] = $parentPackage->getFilesByType($type); } } diff --git a/app/code/Magento/Deploy/Package/Processor/PreProcessor/Css.php b/app/code/Magento/Deploy/Package/Processor/PreProcessor/Css.php index b3461e3ab4a22..42775a2e2f6bf 100644 --- a/app/code/Magento/Deploy/Package/Processor/PreProcessor/Css.php +++ b/app/code/Magento/Deploy/Package/Processor/PreProcessor/Css.php @@ -3,12 +3,14 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Deploy\Package\Processor\PreProcessor; use Magento\Deploy\Console\DeployStaticOptions; use Magento\Deploy\Package\Package; use Magento\Deploy\Package\PackageFile; use Magento\Deploy\Package\Processor\ProcessorInterface; +use Magento\Framework\Css\PreProcessor\Instruction\Import; use Magento\Framework\Filesystem; use Magento\Framework\Filesystem\Directory\ReadInterface; use Magento\Framework\App\Filesystem\DirectoryList; @@ -92,8 +94,7 @@ public function process(Package $package, array $options) } /** - * Checks if there are imports of CSS files or images within the given CSS file - * which exists in the current package + * Checks if there are imports of CSS files or images within the given CSS file which exists in the current package * * @param PackageFile $parentFile * @param Package $package @@ -126,6 +127,7 @@ private function hasOverrides(PackageFile $parentFile, Package $package) * @param string $filePath * @param string $fullPath * @return void + * phpcs:disable Magento2.Functions.DiscouragedFunction */ private function buildMap($packagePath, $filePath, $fullPath) { @@ -141,11 +143,7 @@ private function buildMap($packagePath, $filePath, $fullPath) $packagePath . '/' . pathinfo($filePath, PATHINFO_DIRNAME) . '/' . $matchContent['path'] ); }; - preg_replace_callback( - \Magento\Framework\Css\PreProcessor\Instruction\Import::REPLACE_PATTERN, - $callback, - $content - ); + preg_replace_callback(Import::REPLACE_PATTERN, $callback, $content); preg_match_all(CssResolver::REGEX_CSS_RELATIVE_URLS, $content, $matches); if (!empty($matches[0]) && !empty($matches[1])) { @@ -177,6 +175,7 @@ private function buildMap($packagePath, $filePath, $fullPath) * * @param string $fileName * @return array + * phpcs:disable Magento2.Performance.ForeachArrayMerge */ private function collectFileMap($fileName) { diff --git a/app/code/Magento/Developer/Console/Command/XmlCatalogGenerateCommand.php b/app/code/Magento/Developer/Console/Command/XmlCatalogGenerateCommand.php index 323b8e1016291..9e473ccaa2d92 100644 --- a/app/code/Magento/Developer/Console/Command/XmlCatalogGenerateCommand.php +++ b/app/code/Magento/Developer/Console/Command/XmlCatalogGenerateCommand.php @@ -6,7 +6,12 @@ namespace Magento\Developer\Console\Command; +use Magento\Developer\Model\XmlCatalog\Format\FormatInterface; +use Magento\Framework\App\Utility\Files; +use Magento\Framework\Config\Dom\UrnResolver; +use Magento\Framework\Console\Cli; use Magento\Framework\Exception\InputException; +use Magento\Framework\Filesystem\Directory\ReadFactory; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; @@ -34,37 +39,37 @@ class XmlCatalogGenerateCommand extends Command const IDE_FILE_PATH_ARGUMENT = 'path'; /** - * @var \Magento\Framework\App\Utility\Files + * @var Files */ private $filesUtility; /** - * @var \Magento\Framework\Config\Dom\UrnResolver + * @var UrnResolver */ private $urnResolver; /** - * @var \Magento\Framework\Filesystem\Directory\ReadFactory + * @var ReadFactory */ private $readFactory; /** * Supported formats * - * @var \Magento\Developer\Model\XmlCatalog\Format\FormatInterface[] + * @var FormatInterface[] */ private $formats; /** - * @param \Magento\Framework\App\Utility\Files $filesUtility - * @param \Magento\Framework\Config\Dom\UrnResolver $urnResolver - * @param \Magento\Framework\Filesystem\Directory\ReadFactory $readFactory - * @param \Magento\Developer\Model\XmlCatalog\Format\FormatInterface[] $formats + * @param Files $filesUtility + * @param UrnResolver $urnResolver + * @param ReadFactory $readFactory + * @param FormatInterface[] $formats */ public function __construct( - \Magento\Framework\App\Utility\Files $filesUtility, - \Magento\Framework\Config\Dom\UrnResolver $urnResolver, - \Magento\Framework\Filesystem\Directory\ReadFactory $readFactory, + Files $filesUtility, + UrnResolver $urnResolver, + ReadFactory $readFactory, array $formats = [] ) { $this->filesUtility = $filesUtility; @@ -75,7 +80,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ protected function configure() { @@ -86,7 +91,7 @@ protected function configure() self::IDE_OPTION, null, InputOption::VALUE_REQUIRED, - 'Format in which catalog will be generated. Supported: ['. + 'Format in which catalog will be generated. Supported: [' . implode(', ', $this->getSupportedFormats()) . ']', 'phpstorm' ), @@ -111,19 +116,21 @@ private function getUrnDictionary(OutputInterface $output) $files = $this->filesUtility->getXmlCatalogFiles('*.xml'); $files = array_merge($files, $this->filesUtility->getXmlCatalogFiles('*.xsd')); - $urns = []; + $urns = [[]]; foreach ($files as $file) { + // phpcs:ignore Magento2.Functions.DiscouragedFunction $fileDir = dirname($file[0]); + // phpcs:ignore Magento2.Functions.DiscouragedFunction $fileName = basename($file[0]); $read = $this->readFactory->create($fileDir); $content = $read->readFile($fileName); $matches = []; preg_match_all('/schemaLocation="(urn\:magento\:[^"]*)"/i', $content, $matches); if (isset($matches[1])) { - $urns = array_merge($urns, $matches[1]); + $urns[] = $matches[1]; } } - $urns = array_unique($urns); + $urns = array_unique(array_merge(...$urns)); $paths = []; foreach ($urns as $urn) { try { @@ -139,27 +146,32 @@ private function getUrnDictionary(OutputInterface $output) } /** - * {@inheritdoc} + * @inheritdoc + * * @throws \InvalidArgumentException */ protected function execute(InputInterface $input, OutputInterface $output) { $ideName = $input->getOption(self::IDE_OPTION); - $ideFilePath = $input->getArgument(self::IDE_FILE_PATH_ARGUMENT); + $ideFilePath = $input->getArgument(self::IDE_FILE_PATH_ARGUMENT); $urnDictionary = $this->getUrnDictionary($output); - if ($formatter = $this->getFormatters($ideName)) { - $formatter->generateCatalog($urnDictionary, $ideFilePath); - } else { + + $formatter = $this->getFormatters($ideName); + if (!$formatter instanceof FormatInterface) { throw new InputException(__("Format for IDE '%1' is not supported", $ideName)); } + + $formatter->generateCatalog($urnDictionary, $ideFilePath); + + return Cli::RETURN_SUCCESS; } /** * Get formatter based on format * * @param string $format - * @return \Magento\Developer\Model\XmlCatalog\Format\FormatInterface|false + * @return FormatInterface|false */ private function getFormatters($format) { diff --git a/app/code/Magento/Directory/Model/AllowedCountries.php b/app/code/Magento/Directory/Model/AllowedCountries.php index b9f2d829dd1a6..2ceeb70ba5b01 100644 --- a/app/code/Magento/Directory/Model/AllowedCountries.php +++ b/app/code/Magento/Directory/Model/AllowedCountries.php @@ -62,13 +62,11 @@ public function getAllowedCountries( switch ($scope) { case ScopeInterface::SCOPE_WEBSITES: case ScopeInterface::SCOPE_STORES: - $allowedCountries = []; + $allowedCountries = [[]]; foreach ($scopeCode as $singleFilter) { - $allowedCountries = array_merge( - $allowedCountries, - $this->getCountriesFromConfig($this->getSingleScope($scope), $singleFilter) - ); + $allowedCountries[] = $this->getCountriesFromConfig($this->getSingleScope($scope), $singleFilter); } + $allowedCountries = array_merge(...$allowedCountries); break; default: $allowedCountries = $this->getCountriesFromConfig($scope, $scopeCode); diff --git a/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Options/Options.php b/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Options/Options.php index 7af7bf447c45a..69f417e1ea732 100644 --- a/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Options/Options.php +++ b/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Options/Options.php @@ -152,10 +152,10 @@ protected function _prepareOptionValues( $inputType = ''; } - $values = []; + $values = [[]]; $isSystemAttribute = is_array($optionCollection); if ($isSystemAttribute) { - $values = $this->getPreparedValues($optionCollection, $isSystemAttribute, $inputType, $defaultValues); + $values[] = $this->getPreparedValues($optionCollection, $isSystemAttribute, $inputType, $defaultValues); } else { $optionCollection->setPageSize(200); $pageCount = $optionCollection->getLastPageNumber(); @@ -163,15 +163,12 @@ protected function _prepareOptionValues( while ($currentPage <= $pageCount) { $optionCollection->clear(); $optionCollection->setCurPage($currentPage); - $values = array_merge( - $values, - $this->getPreparedValues($optionCollection, $isSystemAttribute, $inputType, $defaultValues) - ); + $values[] = $this->getPreparedValues($optionCollection, $isSystemAttribute, $inputType, $defaultValues); $currentPage++; } } - return $values; + return array_merge(...$values); } /** diff --git a/app/code/Magento/Eav/Model/Form.php b/app/code/Magento/Eav/Model/Form.php index a34b53eede354..074c6cf46a2f4 100644 --- a/app/code/Magento/Eav/Model/Form.php +++ b/app/code/Magento/Eav/Model/Form.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Eav\Model; use Magento\Framework\App\RequestInterface; @@ -10,6 +11,7 @@ /** * EAV Entity Form Model * + * phpcs:disable Magento2.Classes.AbstractApi * @api * @SuppressWarnings(PHPMD.TooManyFields) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -274,8 +276,8 @@ public function getStore() /** * Return current form code * - * @throws \Magento\Framework\Exception\LocalizedException * @return string + * @throws \Magento\Framework\Exception\LocalizedException */ public function getFormCode() { @@ -303,8 +305,8 @@ public function getEntityType() /** * Return current entity instance * - * @throws \Magento\Framework\Exception\LocalizedException * @return \Magento\Framework\Model\AbstractModel + * @throws \Magento\Framework\Exception\LocalizedException */ public function getEntity() { @@ -485,11 +487,11 @@ public function validateData(array $data) { $validator = $this->_getValidator($data); if (!$validator->isValid($this->getEntity())) { - $messages = []; + $messages = [[]]; foreach ($validator->getMessages() as $errorMessages) { - $messages = array_merge($messages, (array)$errorMessages); + $messages[] = (array)$errorMessages; } - return $messages; + return array_merge(...$messages); } return true; } diff --git a/app/code/Magento/Elasticsearch/Model/Adapter/FieldMapper/Product/CompositeFieldProvider.php b/app/code/Magento/Elasticsearch/Model/Adapter/FieldMapper/Product/CompositeFieldProvider.php index 8038c8c05bc1c..b276b67ff7fba 100644 --- a/app/code/Magento/Elasticsearch/Model/Adapter/FieldMapper/Product/CompositeFieldProvider.php +++ b/app/code/Magento/Elasticsearch/Model/Adapter/FieldMapper/Product/CompositeFieldProvider.php @@ -40,12 +40,12 @@ public function __construct(array $providers) */ public function getFields(array $context = []): array { - $allAttributes = []; + $allAttributes = [[]]; foreach ($this->providers as $provider) { - $allAttributes = array_merge($allAttributes, $provider->getFields($context)); + $allAttributes[] = $provider->getFields($context); } - return $allAttributes; + return array_merge(...$allAttributes); } } diff --git a/app/code/Magento/GroupedProduct/Block/Cart/Item/Renderer/Grouped.php b/app/code/Magento/GroupedProduct/Block/Cart/Item/Renderer/Grouped.php index e85d4eeca730a..197be38fb7f5f 100644 --- a/app/code/Magento/GroupedProduct/Block/Cart/Item/Renderer/Grouped.php +++ b/app/code/Magento/GroupedProduct/Block/Cart/Item/Renderer/Grouped.php @@ -45,10 +45,10 @@ public function getGroupedProduct() */ public function getIdentities() { - $identities = parent::getIdentities(); + $identities = [parent::getIdentities()]; if ($this->getItem()) { - $identities = array_merge($identities, $this->getGroupedProduct()->getIdentities()); + $identities[] = $this->getGroupedProduct()->getIdentities(); } - return $identities; + return array_merge(...$identities); } } diff --git a/app/code/Magento/GroupedProduct/Block/Stockqty/Type/Grouped.php b/app/code/Magento/GroupedProduct/Block/Stockqty/Type/Grouped.php index f666cf8d90af9..97dc90ec93493 100644 --- a/app/code/Magento/GroupedProduct/Block/Stockqty/Type/Grouped.php +++ b/app/code/Magento/GroupedProduct/Block/Stockqty/Type/Grouped.php @@ -32,10 +32,10 @@ protected function _getChildProducts() */ public function getIdentities() { - $identities = []; + $identities = [[]]; foreach ($this->getChildProducts() as $item) { - $identities = array_merge($identities, $item->getIdentities()); + $identities[] = $item->getIdentities(); } - return $identities; + return array_merge(...$identities); } } diff --git a/app/code/Magento/ImportExport/Model/Import/ErrorProcessing/ProcessingErrorAggregator.php b/app/code/Magento/ImportExport/Model/Import/ErrorProcessing/ProcessingErrorAggregator.php index 028bf2c464d4b..eed98c10704ad 100644 --- a/app/code/Magento/ImportExport/Model/Import/ErrorProcessing/ProcessingErrorAggregator.php +++ b/app/code/Magento/ImportExport/Model/Import/ErrorProcessing/ProcessingErrorAggregator.php @@ -237,16 +237,12 @@ public function hasFatalExceptions() */ public function getAllErrors() { - $result = []; if (empty($this->items)) { - return $result; - } - - foreach (array_values($this->items['rows']) as $errors) { - $result = array_merge($result, $errors); + return []; } - return $result; + $errors = array_values($this->items['rows']); + return array_merge(...$errors); } /** @@ -257,14 +253,14 @@ public function getAllErrors() */ public function getErrorsByCode(array $codes) { - $result = []; + $result = [[]]; foreach ($codes as $code) { if (isset($this->items['codes'][$code])) { - $result = array_merge($result, $this->items['codes'][$code]); + $result[] = $this->items['codes'][$code]; } } - return $result; + return array_merge(...$result); } /** diff --git a/app/code/Magento/Integration/Block/Adminhtml/Integration/Activate/Permissions/Tab/Webapi.php b/app/code/Magento/Integration/Block/Adminhtml/Integration/Activate/Permissions/Tab/Webapi.php index 3c719a5814615..2d323fea34e7d 100644 --- a/app/code/Magento/Integration/Block/Adminhtml/Integration/Activate/Permissions/Tab/Webapi.php +++ b/app/code/Magento/Integration/Block/Adminhtml/Integration/Activate/Permissions/Tab/Webapi.php @@ -105,7 +105,7 @@ protected function _construct() } /** - * {@inheritdoc} + * @inheritdoc */ public function canShowTab() { @@ -116,7 +116,7 @@ public function canShowTab() } /** - * {@inheritdoc} + * @inheritdoc * * @codeCoverageIgnore */ @@ -126,7 +126,7 @@ public function getTabLabel() } /** - * {@inheritdoc} + * @inheritdoc * * @codeCoverageIgnore */ @@ -136,7 +136,7 @@ public function getTabTitle() } /** - * {@inheritdoc} + * @inheritdoc * * @codeCoverageIgnore */ @@ -222,13 +222,13 @@ public function isTreeEmpty() */ protected function _getAllResourceIds(array $resources) { - $resourceIds = []; + $resourceIds = [[]]; foreach ($resources as $resource) { - $resourceIds[] = $resource['id']; + $resourceIds[] = [$resource['id']]; if (isset($resource['children'])) { - $resourceIds = array_merge($resourceIds, $this->_getAllResourceIds($resource['children'])); + $resourceIds[] = $this->_getAllResourceIds($resource['children']); } } - return $resourceIds; + return array_merge(...$resourceIds); } } diff --git a/app/code/Magento/PageCache/Model/Layout/LayoutPlugin.php b/app/code/Magento/PageCache/Model/Layout/LayoutPlugin.php index 88619673ad425..8c6f9fb543d84 100644 --- a/app/code/Magento/PageCache/Model/Layout/LayoutPlugin.php +++ b/app/code/Magento/PageCache/Model/Layout/LayoutPlugin.php @@ -71,7 +71,7 @@ public function afterGenerateXml(\Magento\Framework\View\Layout $subject, $resul public function afterGetOutput(\Magento\Framework\View\Layout $subject, $result) { if ($subject->isCacheable() && $this->config->isEnabled()) { - $tags = []; + $tags = [[]]; foreach ($subject->getAllBlocks() as $block) { if ($block instanceof \Magento\Framework\DataObject\IdentityInterface) { $isEsiBlock = $block->getTtl() > 0; @@ -80,10 +80,10 @@ public function afterGetOutput(\Magento\Framework\View\Layout $subject, $result) continue; } // phpcs:ignore - $tags = array_merge($tags, $block->getIdentities()); + $tags[] = $block->getIdentities(); } } - $tags = array_unique($tags); + $tags = array_unique(array_merge(...$tags)); $this->response->setHeader('X-Magento-Tags', implode(',', $tags)); } return $result; diff --git a/app/code/Magento/Payment/Gateway/Validator/ValidatorComposite.php b/app/code/Magento/Payment/Gateway/Validator/ValidatorComposite.php index 8ea97d31ed4d9..f96c08a9605a8 100644 --- a/app/code/Magento/Payment/Gateway/Validator/ValidatorComposite.php +++ b/app/code/Magento/Payment/Gateway/Validator/ValidatorComposite.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Payment\Gateway\Validator; use Magento\Framework\ObjectManager\TMap; @@ -57,26 +58,25 @@ public function __construct( public function validate(array $validationSubject) { $isValid = true; - $failsDescriptionAggregate = []; - $errorCodesAggregate = []; + $failsDescriptionAggregate = [[]]; + $errorCodesAggregate = [[]]; foreach ($this->validators as $key => $validator) { $result = $validator->validate($validationSubject); if (!$result->isValid()) { $isValid = false; - $failsDescriptionAggregate = array_merge( - $failsDescriptionAggregate, - $result->getFailsDescription() - ); - $errorCodesAggregate = array_merge( - $errorCodesAggregate, - $result->getErrorCodes() - ); + $failsDescriptionAggregate[] = $result->getFailsDescription(); + $errorCodesAggregate[] = $result->getErrorCodes(); + if (!empty($this->chainBreakingValidators[$key])) { break; } } } - return $this->createResult($isValid, $failsDescriptionAggregate, $errorCodesAggregate); + return $this->createResult( + $isValid, + array_merge(...$failsDescriptionAggregate), + array_merge(...$errorCodesAggregate) + ); } } diff --git a/app/code/Magento/Paypal/Model/Config/Structure/PaymentSectionModifier.php b/app/code/Magento/Paypal/Model/Config/Structure/PaymentSectionModifier.php index f1c414e6faa9b..61410499e956e 100644 --- a/app/code/Magento/Paypal/Model/Config/Structure/PaymentSectionModifier.php +++ b/app/code/Magento/Paypal/Model/Config/Structure/PaymentSectionModifier.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Paypal\Model\Config\Structure; /** @@ -60,9 +61,9 @@ public function modify(array $initialStructure) unset($childData['children'][$moveInstruction['section']]); unset($moveInstruction['data']['displayIn']); $changedStructure - [$moveInstruction['parent']] - ['children'] - [$moveInstruction['section']] = $moveInstruction['data']; + [$moveInstruction['parent']] + ['children'] + [$moveInstruction['section']] = $moveInstruction['data']; } } if (!isset($moveInstructions[$childSection])) { @@ -83,7 +84,7 @@ public function modify(array $initialStructure) */ private function getMoveInstructions($section, $data) { - $moved = []; + $moved = [[]]; if (array_key_exists('children', $data)) { foreach ($data['children'] as $childSection => $childData) { @@ -91,23 +92,20 @@ private function getMoveInstructions($section, $data) if (isset($movedChildren[$childSection])) { unset($data['children'][$childSection]); } - $moved = array_merge($moved, $movedChildren); + $moved[] = $movedChildren; } } if (isset($data['displayIn']) && in_array($data['displayIn'], self::$specialGroups)) { - $moved = array_merge( - [ - $section => [ + $moved[] = [ + $section => [ 'parent' => $data['displayIn'], 'section' => $section, 'data' => $data - ] - ], - $moved - ); + ] + ]; } - return $moved; + return array_merge(...$moved); } } diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/BuyRequest/BuyRequestBuilder.php b/app/code/Magento/QuoteGraphQl/Model/Cart/BuyRequest/BuyRequestBuilder.php index 90f32e96a5fde..c14cc1324732c 100644 --- a/app/code/Magento/QuoteGraphQl/Model/Cart/BuyRequest/BuyRequestBuilder.php +++ b/app/code/Magento/QuoteGraphQl/Model/Cart/BuyRequest/BuyRequestBuilder.php @@ -45,11 +45,11 @@ public function __construct( */ public function build(array $cartItemData): DataObject { - $requestData = []; + $requestData = [[]]; foreach ($this->providers as $provider) { - $requestData = array_merge($requestData, $provider->execute($cartItemData)); + $requestData[] = $provider->execute($cartItemData); } - return $this->dataObjectFactory->create(['data' => $requestData]); + return $this->dataObjectFactory->create(['data' => array_merge(...$requestData)]); } } diff --git a/app/code/Magento/Reports/Block/Product/Viewed.php b/app/code/Magento/Reports/Block/Product/Viewed.php index 5f9fdf8533523..ba4d03182213a 100644 --- a/app/code/Magento/Reports/Block/Product/Viewed.php +++ b/app/code/Magento/Reports/Block/Product/Viewed.php @@ -59,8 +59,7 @@ public function getCount() } /** - * Prepare to html - * check has viewed products + * Prepare to html check has viewed products * * @return string */ @@ -77,10 +76,10 @@ protected function _toHtml() */ public function getIdentities() { - $identities = []; + $identities = [[]]; foreach ($this->getItemsCollection() as $item) { - $identities = array_merge($identities, $item->getIdentities()); + $identities[] = $item->getIdentities(); } - return $identities; + return array_merge(...$identities); } } diff --git a/app/code/Magento/Sales/Block/Adminhtml/Items/Column/DefaultColumn.php b/app/code/Magento/Sales/Block/Adminhtml/Items/Column/DefaultColumn.php index 80dcce2fd1be4..efef617acf900 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Items/Column/DefaultColumn.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Items/Column/DefaultColumn.php @@ -68,19 +68,19 @@ public function getItem() */ public function getOrderOptions() { - $result = []; + $result = [[]]; if ($options = $this->getItem()->getProductOptions()) { if (isset($options['options'])) { - $result = array_merge($result, $options['options']); + $result[] = $options['options']; } if (isset($options['additional_options'])) { - $result = array_merge($result, $options['additional_options']); + $result[] = $options['additional_options']; } if (!empty($options['attributes_info'])) { - $result = array_merge($options['attributes_info'], $result); + $result[] = $options['attributes_info']; } } - return $result; + return array_merge(...$result); } /** diff --git a/app/code/Magento/Sales/Block/Order/Email/Items/DefaultItems.php b/app/code/Magento/Sales/Block/Order/Email/Items/DefaultItems.php index 0aa4f807700b6..064405daf89a8 100644 --- a/app/code/Magento/Sales/Block/Order/Email/Items/DefaultItems.php +++ b/app/code/Magento/Sales/Block/Order/Email/Items/DefaultItems.php @@ -29,27 +29,31 @@ public function getOrder() } /** + * Returns Items options as array + * * @return array */ public function getItemOptions() { - $result = []; + $result = [[]]; if ($options = $this->getItem()->getOrderItem()->getProductOptions()) { if (isset($options['options'])) { - $result = array_merge($result, $options['options']); + $result[] = $options['options']; } if (isset($options['additional_options'])) { - $result = array_merge($result, $options['additional_options']); + $result[] = $options['additional_options']; } if (isset($options['attributes_info'])) { - $result = array_merge($result, $options['attributes_info']); + $result[] = $options['attributes_info']; } } - return $result; + return array_merge(...$result); } /** + * Formats the value in HTML + * * @param string|array $value * @return string */ @@ -70,7 +74,9 @@ public function getValueHtml($value) } /** - * @param mixed $item + * Returns Product SKU for Item provided + * + * @param OrderItem $item * @return mixed */ public function getSku($item) diff --git a/app/code/Magento/Sales/Block/Order/Email/Items/Order/DefaultOrder.php b/app/code/Magento/Sales/Block/Order/Email/Items/Order/DefaultOrder.php index ae2dec6aefa6e..0291a1275c350 100644 --- a/app/code/Magento/Sales/Block/Order/Email/Items/Order/DefaultOrder.php +++ b/app/code/Magento/Sales/Block/Order/Email/Items/Order/DefaultOrder.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Block\Order\Email\Items\Order; use Magento\Sales\Model\Order\Item as OrderItem; @@ -27,48 +28,49 @@ public function getOrder() } /** + * Returns array of Item options + * * @return array */ public function getItemOptions() { - $result = []; + $result = [[]]; if ($options = $this->getItem()->getProductOptions()) { if (isset($options['options'])) { - $result = array_merge($result, $options['options']); + $result[] = $options['options']; } if (isset($options['additional_options'])) { - $result = array_merge($result, $options['additional_options']); + $result[] = $options['additional_options']; } if (isset($options['attributes_info'])) { - $result = array_merge($result, $options['attributes_info']); + $result[] = $options['attributes_info']; } } - return $result; + return array_merge(...$result); } /** + * Formats the value in HTML + * * @param string|array $value * @return string */ public function getValueHtml($value) { if (is_array($value)) { - return sprintf( - '%d', - $value['qty'] - ) . ' x ' . $this->escapeHtml( - $value['title'] - ) . " " . $this->getItem()->getOrder()->formatPrice( - $value['price'] - ); + return sprintf('%d', $value['qty']) + . ' x ' . $this->escapeHtml($value['title']) + . " " . $this->getItem()->getOrder()->formatPrice($value['price']); } else { return $this->escapeHtml($value); } } /** - * @param mixed $item + * Returns Product SKU for Item provided + * + * @param OrderItem $item * @return mixed */ public function getSku($item) diff --git a/app/code/Magento/Sales/Block/Order/Item/Renderer/DefaultRenderer.php b/app/code/Magento/Sales/Block/Order/Item/Renderer/DefaultRenderer.php index 2e119d0bf887a..bca6d49760d9a 100644 --- a/app/code/Magento/Sales/Block/Order/Item/Renderer/DefaultRenderer.php +++ b/app/code/Magento/Sales/Block/Order/Item/Renderer/DefaultRenderer.php @@ -6,7 +6,12 @@ namespace Magento\Sales\Block\Order\Item\Renderer; -use Magento\Sales\Model\Order\CreditMemo\Item as CreditMemoItem; +use Magento\Catalog\Model\Product\OptionFactory; +use Magento\Framework\DataObject; +use Magento\Framework\Stdlib\StringUtils; +use Magento\Framework\View\Element\AbstractBlock; +use Magento\Framework\View\Element\Template\Context; +use Magento\Sales\Model\Order\Creditmemo\Item as CreditMemoItem; use Magento\Sales\Model\Order\Invoice\Item as InvoiceItem; use Magento\Sales\Model\Order\Item as OrderItem; @@ -21,25 +26,25 @@ class DefaultRenderer extends \Magento\Framework\View\Element\Template /** * Magento string lib * - * @var \Magento\Framework\Stdlib\StringUtils + * @var StringUtils */ protected $string; /** - * @var \Magento\Catalog\Model\Product\OptionFactory + * @var OptionFactory */ protected $_productOptionFactory; /** - * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Framework\Stdlib\StringUtils $string - * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory + * @param Context $context + * @param StringUtils $string + * @param OptionFactory $productOptionFactory * @param array $data */ public function __construct( - \Magento\Framework\View\Element\Template\Context $context, - \Magento\Framework\Stdlib\StringUtils $string, - \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, + Context $context, + StringUtils $string, + OptionFactory $productOptionFactory, array $data = [] ) { $this->string = $string; @@ -50,10 +55,10 @@ public function __construct( /** * Set item. * - * @param \Magento\Framework\DataObject $item + * @param DataObject $item * @return $this */ - public function setItem(\Magento\Framework\DataObject $item) + public function setItem(DataObject $item) { $this->setData('item', $item); return $this; @@ -86,7 +91,7 @@ public function getOrder() */ public function getOrderItem() { - if ($this->getItem() instanceof \Magento\Sales\Model\Order\Item) { + if ($this->getItem() instanceof OrderItem) { return $this->getItem(); } else { return $this->getItem()->getOrderItem(); @@ -100,20 +105,20 @@ public function getOrderItem() */ public function getItemOptions() { - $result = []; + $result = [[]]; $options = $this->getOrderItem()->getProductOptions(); if ($options) { if (isset($options['options'])) { - $result = array_merge($result, $options['options']); + $result[] = $options['options']; } if (isset($options['additional_options'])) { - $result = array_merge($result, $options['additional_options']); + $result[] = $options['additional_options']; } if (isset($options['attributes_info'])) { - $result = array_merge($result, $options['attributes_info']); + $result[] = $options['attributes_info']; } } - return $result; + return array_merge(...$result); } /** diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Items/AbstractItems.php b/app/code/Magento/Sales/Model/Order/Pdf/Items/AbstractItems.php index 422ff1746c9a6..29e011217ef20 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Items/AbstractItems.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Items/AbstractItems.php @@ -6,41 +6,54 @@ namespace Magento\Sales\Model\Order\Pdf\Items; use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\Data\Collection\AbstractDb; +use Magento\Framework\DataObject; +use Magento\Framework\Filesystem; +use Magento\Framework\Filesystem\Directory\ReadInterface; +use Magento\Framework\Filter\FilterManager; +use Magento\Framework\Model\AbstractModel; +use Magento\Framework\Model\Context; +use Magento\Framework\Model\ResourceModel\AbstractResource; +use Magento\Framework\Registry; +use Magento\Sales\Model\Order; +use Magento\Sales\Model\Order\Pdf\AbstractPdf; +use Magento\Tax\Helper\Data as TaxHelper; /** * Sales Order Pdf Items renderer Abstract * + * phpcs:disable Magento2.Classes.AbstractApi * @api * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @since 100.0.2 */ -abstract class AbstractItems extends \Magento\Framework\Model\AbstractModel +abstract class AbstractItems extends AbstractModel { /** * Order model * - * @var \Magento\Sales\Model\Order + * @var Order */ protected $_order; /** * Source model (invoice, shipment, creditmemo) * - * @var \Magento\Framework\Model\AbstractModel + * @var AbstractModel */ protected $_source; /** * Item object * - * @var \Magento\Framework\DataObject + * @var DataObject */ protected $_item; /** * Pdf object * - * @var \Magento\Sales\Model\Order\Pdf\AbstractPdf + * @var AbstractPdf */ protected $_pdf; @@ -54,38 +67,38 @@ abstract class AbstractItems extends \Magento\Framework\Model\AbstractModel /** * Tax data * - * @var \Magento\Tax\Helper\Data + * @var TaxHelper */ protected $_taxData; /** - * @var \Magento\Framework\Filesystem\Directory\ReadInterface + * @var ReadInterface */ protected $_rootDirectory; /** - * @var \Magento\Framework\Filter\FilterManager + * @var FilterManager */ protected $filterManager; /** - * @param \Magento\Framework\Model\Context $context - * @param \Magento\Framework\Registry $registry - * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Framework\Filesystem $filesystem , - * @param \Magento\Framework\Filter\FilterManager $filterManager - * @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource - * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection + * @param Context $context + * @param Registry $registry + * @param TaxHelper $taxData + * @param Filesystem $filesystem , + * @param FilterManager $filterManager + * @param AbstractResource $resource + * @param AbstractDb $resourceCollection * @param array $data */ public function __construct( - \Magento\Framework\Model\Context $context, - \Magento\Framework\Registry $registry, - \Magento\Tax\Helper\Data $taxData, - \Magento\Framework\Filesystem $filesystem, - \Magento\Framework\Filter\FilterManager $filterManager, - \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, - \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, + Context $context, + Registry $registry, + TaxHelper $taxData, + Filesystem $filesystem, + FilterManager $filterManager, + AbstractResource $resource = null, + AbstractDb $resourceCollection = null, array $data = [] ) { $this->filterManager = $filterManager; @@ -97,10 +110,10 @@ public function __construct( /** * Set order model * - * @param \Magento\Sales\Model\Order $order + * @param Order $order * @return $this */ - public function setOrder(\Magento\Sales\Model\Order $order) + public function setOrder(Order $order) { $this->_order = $order; return $this; @@ -109,10 +122,10 @@ public function setOrder(\Magento\Sales\Model\Order $order) /** * Set Source model * - * @param \Magento\Framework\Model\AbstractModel $source + * @param AbstractModel $source * @return $this */ - public function setSource(\Magento\Framework\Model\AbstractModel $source) + public function setSource(AbstractModel $source) { $this->_source = $source; return $this; @@ -121,10 +134,10 @@ public function setSource(\Magento\Framework\Model\AbstractModel $source) /** * Set item object * - * @param \Magento\Framework\DataObject $item + * @param DataObject $item * @return $this */ - public function setItem(\Magento\Framework\DataObject $item) + public function setItem(DataObject $item) { $this->_item = $item; return $this; @@ -133,10 +146,10 @@ public function setItem(\Magento\Framework\DataObject $item) /** * Set Pdf model * - * @param \Magento\Sales\Model\Order\Pdf\AbstractPdf $pdf + * @param AbstractPdf $pdf * @return $this */ - public function setPdf(\Magento\Sales\Model\Order\Pdf\AbstractPdf $pdf) + public function setPdf(AbstractPdf $pdf) { $this->_pdf = $pdf; return $this; @@ -313,20 +326,20 @@ public function getItemPricesForDisplay() */ public function getItemOptions() { - $result = []; + $result = [[]]; $options = $this->getItem()->getOrderItem()->getProductOptions(); if ($options) { if (isset($options['options'])) { - $result = array_merge($result, $options['options']); + $result[] = $options['options']; } if (isset($options['additional_options'])) { - $result = array_merge($result, $options['additional_options']); + $result[] = $options['additional_options']; } if (isset($options['attributes_info'])) { - $result = array_merge($result, $options['attributes_info']); + $result[] = $options['attributes_info']; } } - return $result; + return array_merge(...$result); } /** diff --git a/app/code/Magento/Sales/Model/ResourceModel/Provider/NotSyncedDataProvider.php b/app/code/Magento/Sales/Model/ResourceModel/Provider/NotSyncedDataProvider.php index aa2ac20f8f55c..645e411b80b67 100644 --- a/app/code/Magento/Sales/Model/ResourceModel/Provider/NotSyncedDataProvider.php +++ b/app/code/Magento/Sales/Model/ResourceModel/Provider/NotSyncedDataProvider.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Model\ResourceModel\Provider; use Magento\Framework\ObjectManager\TMapFactory; @@ -21,10 +22,8 @@ class NotSyncedDataProvider implements NotSyncedDataProviderInterface * @param TMapFactory $tmapFactory * @param array $providers */ - public function __construct( - TMapFactory $tmapFactory, - array $providers = [] - ) { + public function __construct(TMapFactory $tmapFactory, array $providers = []) + { $this->providers = $tmapFactory->create( [ 'array' => $providers, @@ -38,11 +37,11 @@ public function __construct( */ public function getIds($mainTableName, $gridTableName) { - $result = []; + $result = [[]]; foreach ($this->providers as $provider) { - $result = array_merge($result, $provider->getIds($mainTableName, $gridTableName)); + $result[] = $provider->getIds($mainTableName, $gridTableName); } - return array_unique($result); + return array_unique(array_merge(...$result)); } } diff --git a/app/code/Magento/Search/Model/Autocomplete.php b/app/code/Magento/Search/Model/Autocomplete.php index b50cd330d5d95..45957e8795744 100644 --- a/app/code/Magento/Search/Model/Autocomplete.php +++ b/app/code/Magento/Search/Model/Autocomplete.php @@ -5,6 +5,9 @@ */ namespace Magento\Search\Model; +/** + * Provides list of Autocomplete items + */ class Autocomplete implements AutocompleteInterface { /** @@ -23,15 +26,15 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ public function getItems() { - $data = []; + $data = [[]]; foreach ($this->dataProviders as $dataProvider) { - $data = array_merge($data, $dataProvider->getItems()); + $data[] = $dataProvider->getItems(); } - return $data; + return array_merge(...$data); } } diff --git a/app/code/Magento/Search/Model/SynonymGroupRepository.php b/app/code/Magento/Search/Model/SynonymGroupRepository.php index 75d7049afd949..dbc2b66b1f047 100644 --- a/app/code/Magento/Search/Model/SynonymGroupRepository.php +++ b/app/code/Magento/Search/Model/SynonymGroupRepository.php @@ -7,6 +7,7 @@ namespace Magento\Search\Model; use Magento\Framework\Exception\CouldNotDeleteException; +use Magento\Framework\Phrase; use Magento\Search\Api\Data\SynonymGroupInterface; use Magento\Search\Api\SynonymGroupRepositoryInterface; use Magento\Search\Model\ResourceModel\SynonymGroup as SynonymGroupResourceModel; @@ -37,7 +38,7 @@ class SynonymGroupRepository implements SynonymGroupRepositoryInterface * @param SynonymGroupResourceModel $resourceModel */ public function __construct( - \Magento\Search\Model\SynonymGroupFactory $synonymGroupFactory, + SynonymGroupFactory $synonymGroupFactory, SynonymGroupResourceModel $resourceModel ) { $this->synonymGroupFactory = $synonymGroupFactory; @@ -64,8 +65,8 @@ public function save(SynonymGroupInterface $synonymGroup, $errorOnMergeConflict * Deletes a synonym group * * @param SynonymGroupInterface $synonymGroup - * @throws CouldNotDeleteException * @return bool + * @throws CouldNotDeleteException */ public function delete(SynonymGroupInterface $synonymGroup) { @@ -149,17 +150,17 @@ private function create(SynonymGroupInterface $synonymGroup, $errorOnMergeConfli */ private function merge(SynonymGroupInterface $synonymGroupToMerge, array $matchingGroupIds) { - $mergedSynonyms = []; + $mergedSynonyms = [[]]; foreach ($matchingGroupIds as $groupId) { /** @var SynonymGroup $synonymGroupModel */ $synonymGroupModel = $this->synonymGroupFactory->create(); $synonymGroupModel->load($groupId); - $mergedSynonyms = array_merge($mergedSynonyms, explode(',', $synonymGroupModel->getSynonymGroup())); + $mergedSynonyms[] = explode(',', $synonymGroupModel->getSynonymGroup()); $synonymGroupModel->delete(); } - $mergedSynonyms = array_merge($mergedSynonyms, explode(',', $synonymGroupToMerge->getSynonymGroup())); - $mergedSynonyms = array_unique($mergedSynonyms); - return $mergedSynonyms; + $mergedSynonyms[] = explode(',', $synonymGroupToMerge->getSynonymGroup()); + + return array_unique(array_merge(...$mergedSynonyms)); } /** @@ -222,7 +223,7 @@ private function update( * Gets merge conflict exception message * * @param string[] $matchingSynonymGroups - * @return \Magento\Framework\Phrase + * @return Phrase */ private function getExceptionMessage($matchingSynonymGroups) { diff --git a/app/code/Magento/Tax/Model/ResourceModel/Calculation/Rate/Collection.php b/app/code/Magento/Tax/Model/ResourceModel/Calculation/Rate/Collection.php index 9b344f6e96f65..7863b70f6626a 100644 --- a/app/code/Magento/Tax/Model/ResourceModel/Calculation/Rate/Collection.php +++ b/app/code/Magento/Tax/Model/ResourceModel/Calculation/Rate/Collection.php @@ -7,9 +7,25 @@ /** * Tax rate collection */ + namespace Magento\Tax\Model\ResourceModel\Calculation\Rate; -class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection +use Magento\Framework\Data\Collection\Db\FetchStrategyInterface; +use Magento\Framework\Data\Collection\EntityFactory; +use Magento\Framework\DB\Adapter\AdapterInterface; +use Magento\Framework\Event\ManagerInterface; +use Magento\Framework\Model\ResourceModel\Db\AbstractDb; +use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection; +use Magento\Store\Model\Store; +use Magento\Store\Model\StoreManagerInterface; +use Magento\Tax\Model\Calculation\Rate; +use Magento\Tax\Model\ResourceModel\Calculation\Rate as RateResourceModel; +use Psr\Log\LoggerInterface; + +/** + * Collection of Calculation Rates + */ +class Collection extends AbstractCollection { /** * Value of fetched from DB of rules per cycle @@ -17,27 +33,27 @@ class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\Ab const TAX_RULES_CHUNK_SIZE = 1000; /** - * @var \Magento\Store\Model\StoreManagerInterface + * @var StoreManagerInterface */ protected $_storeManager; /** - * @param \Magento\Framework\Data\Collection\EntityFactory $entityFactory - * @param \Psr\Log\LoggerInterface $logger - * @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy - * @param \Magento\Framework\Event\ManagerInterface $eventManager - * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param EntityFactory $entityFactory + * @param LoggerInterface $logger + * @param FetchStrategyInterface $fetchStrategy + * @param ManagerInterface $eventManager + * @param StoreManagerInterface $storeManager * @param mixed $connection - * @param \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource + * @param AbstractDb $resource */ public function __construct( - \Magento\Framework\Data\Collection\EntityFactory $entityFactory, - \Psr\Log\LoggerInterface $logger, - \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, - \Magento\Framework\Event\ManagerInterface $eventManager, - \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Framework\DB\Adapter\AdapterInterface $connection = null, - \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null + EntityFactory $entityFactory, + LoggerInterface $logger, + FetchStrategyInterface $fetchStrategy, + ManagerInterface $eventManager, + StoreManagerInterface $storeManager, + AdapterInterface $connection = null, + AbstractDb $resource = null ) { $this->_storeManager = $storeManager; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); @@ -50,10 +66,7 @@ public function __construct( */ protected function _construct() { - $this->_init( - \Magento\Tax\Model\Calculation\Rate::class, - \Magento\Tax\Model\ResourceModel\Calculation\Rate::class - ); + $this->_init(Rate::class, RateResourceModel::class); } /** @@ -90,7 +103,7 @@ public function joinRegionTable() /** * Join rate title for specified store * - * @param \Magento\Store\Model\Store|string|int $store + * @param Store|string|int $store * @return $this */ public function joinTitle($store = null) @@ -170,12 +183,10 @@ public function toOptionHash() } /** - * Convert items array to hash for select options - * using fetchItem method - * - * @see fetchItem() + * Convert items array to hash for select options using fetchItem method * * @return array + * @see fetchItem() */ public function toOptionHashOptimized() { @@ -195,7 +206,7 @@ public function getOptionRates() { $size = self::TAX_RULES_CHUNK_SIZE; $page = 1; - $rates = []; + $rates = [[]]; do { $offset = $size * ($page - 1); $this->getSelect()->reset(); @@ -206,11 +217,11 @@ public function getOptionRates() ) ->limit($size, $offset); - $rates = array_merge($rates, $this->toOptionArray()); + $rates[] = $this->toOptionArray(); $this->clear(); $page++; } while ($this->getSize() > $offset); - return $rates; + return array_merge(...$rates); } } diff --git a/app/code/Magento/Weee/Model/Total/Quote/Weee.php b/app/code/Magento/Weee/Model/Total/Quote/Weee.php index 96a40c9533f8f..449c6cd688668 100644 --- a/app/code/Magento/Weee/Model/Total/Quote/Weee.php +++ b/app/code/Magento/Weee/Model/Total/Quote/Weee.php @@ -7,10 +7,19 @@ namespace Magento\Weee\Model\Total\Quote; use Magento\Framework\Pricing\PriceCurrencyInterface; +use Magento\Quote\Api\Data\ShippingAssignmentInterface; +use Magento\Quote\Model\Quote; +use Magento\Quote\Model\Quote\Address; +use Magento\Quote\Model\Quote\Address\Total; use Magento\Quote\Model\Quote\Address\Total\AbstractTotal; +use Magento\Quote\Model\Quote\Item\AbstractItem; use Magento\Store\Model\Store; use Magento\Tax\Model\Sales\Total\Quote\CommonTaxCollector; +use Magento\Weee\Helper\Data as WeeHelper; +/** + * Calculate totals for Quote + */ class Weee extends AbstractTotal { /** @@ -23,7 +32,7 @@ class Weee extends AbstractTotal const ITEM_TYPE = 'weee'; /** - * @var \Magento\Weee\Helper\Data + * @var WeeHelper */ protected $weeeData; @@ -66,11 +75,11 @@ class Weee extends AbstractTotal protected $priceCurrency; /** - * @param \Magento\Weee\Helper\Data $weeeData + * @param WeeHelper $weeeData * @param PriceCurrencyInterface $priceCurrency */ public function __construct( - \Magento\Weee\Helper\Data $weeeData, + WeeHelper $weeeData, PriceCurrencyInterface $priceCurrency ) { $this->priceCurrency = $priceCurrency; @@ -82,15 +91,15 @@ public function __construct( /** * Collect Weee amounts for the quote / order * - * @param \Magento\Quote\Model\Quote $quote - * @param \Magento\Quote\Api\Data\ShippingAssignmentInterface $shippingAssignment - * @param \Magento\Quote\Model\Quote\Address\Total $total + * @param Quote $quote + * @param ShippingAssignmentInterface $shippingAssignment + * @param Total $total * @return $this */ public function collect( - \Magento\Quote\Model\Quote $quote, - \Magento\Quote\Api\Data\ShippingAssignmentInterface $shippingAssignment, - \Magento\Quote\Model\Quote\Address\Total $total + Quote $quote, + ShippingAssignmentInterface $shippingAssignment, + Total $total ) { AbstractTotal::collect($quote, $shippingAssignment, $total); $this->_store = $quote->getStore(); @@ -130,16 +139,16 @@ public function collect( /** * Calculate item fixed tax and prepare information for discount and regular taxation * - * @param \Magento\Quote\Model\Quote\Address $address - * @param \Magento\Quote\Model\Quote\Address\Total $total - * @param \Magento\Quote\Model\Quote\Item\AbstractItem $item - * @return void|$this + * @param Address $address + * @param Total $total + * @param AbstractItem $item + * @return void|$this * @SuppressWarnings(PHPMD.ExcessiveMethodLength) * @SuppressWarnings(PHPMD.UnusedLocalVariable) */ protected function process( - \Magento\Quote\Model\Quote\Address $address, - \Magento\Quote\Model\Quote\Address\Total $total, + Address $address, + Total $total, $item ) { $attributes = $this->weeeData->getProductWeeeAttributes( @@ -248,12 +257,12 @@ protected function process( /** * Process row amount based on FPT total amount configuration setting * - * @param \Magento\Quote\Model\Quote\Address\Total $total - * @param float $rowValueExclTax - * @param float $baseRowValueExclTax - * @param float $rowValueInclTax - * @param float $baseRowValueInclTax - * @return $this + * @param Total $total + * @param float $rowValueExclTax + * @param float $baseRowValueExclTax + * @param float $rowValueInclTax + * @param float $baseRowValueInclTax + * @return $this */ protected function processTotalAmount( $total, @@ -279,8 +288,7 @@ protected function processTotalAmount( } /** - * Increment and return counter. This function is intended to be used to generate temporary - * id for an item. + * Increment and return counter. This function is intended to be used to generate temporary id for an item. * * @return int */ @@ -292,25 +300,26 @@ protected function getNextIncrement() /** * Recalculate parent item amounts based on children results * - * @param \Magento\Quote\Model\Quote\Item\AbstractItem $item - * @return void - * + * @param AbstractItem $item + * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - protected function recalculateParent(\Magento\Quote\Model\Quote\Item\AbstractItem $item) + protected function recalculateParent(AbstractItem $item) { - $associatedTaxables = []; + $associatedTaxables = [[]]; foreach ($item->getChildren() as $child) { - $associatedTaxables = array_merge($associatedTaxables, $child->getAssociatedTaxables()); + $associatedTaxables[] = $child->getAssociatedTaxables(); } - $item->setAssociatedTaxables($associatedTaxables); + $item->setAssociatedTaxables( + array_unique(array_merge(...$associatedTaxables)) + ); } /** * Reset information about Tax and Wee on FPT for shopping cart item * - * @param \Magento\Quote\Model\Quote\Item\AbstractItem $item - * @return void + * @param AbstractItem $item + * @return void */ protected function resetItemData($item) { @@ -332,24 +341,24 @@ protected function resetItemData($item) } /** - * @param \Magento\Quote\Model\Quote $quote - * @param \Magento\Quote\Model\Quote\Address\Total $total + * Return `null` instead of original empty array + * + * @param Quote $quote + * @param Total $total * @return array|null * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function fetch(\Magento\Quote\Model\Quote $quote, \Magento\Quote\Model\Quote\Address\Total $total) + public function fetch(Quote $quote, Total $total) { return null; } /** - * Process model configuration array. - * This method can be used for changing totals collect sort order - * - * @param array $config - * @param Store $store - * @return array + * Process model configuration array. This method can be used for changing totals collect sort order * + * @param array $config + * @param Store $store + * @return array * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function processConfigArray($config, $store) @@ -360,7 +369,7 @@ public function processConfigArray($config, $store) /** * No aggregated label for fixed product tax * - * TODO: fix + * @TODO: fix * @return string */ public function getLabel() From 89e587b6b1ab2bce6faf68e4bf5d35c6ed3ff06b Mon Sep 17 00:00:00 2001 From: Yurii Sapiha <yurasapiga93@gmail.com> Date: Mon, 13 Jan 2020 13:40:01 +0200 Subject: [PATCH 0794/1143] MC-30332: Storefront: Configurable Product with Out Of Stock Child(s) --- .../Model/DeleteConfigurableProduct.php | 70 +++++ .../ConfigurableViewOnCategoryPageTest.php | 83 +++++ .../ConfigurableViewOnProductPageTest.php | 290 ++++++++++++++++++ .../Product/Type/Configurable/SalableTest.php | 121 ++++++++ ...ble_product_with_out_of_stock_children.php | 104 +++++++ ...ct_with_out_of_stock_children_rollback.php | 19 ++ 6 files changed, 687 insertions(+) create mode 100644 dev/tests/integration/framework/Magento/TestFramework/ConfigurableProduct/Model/DeleteConfigurableProduct.php create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/ConfigurableViewOnCategoryPageTest.php create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/ConfigurableViewOnProductPageTest.php create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/Configurable/SalableTest.php create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_out_of_stock_children.php create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_out_of_stock_children_rollback.php diff --git a/dev/tests/integration/framework/Magento/TestFramework/ConfigurableProduct/Model/DeleteConfigurableProduct.php b/dev/tests/integration/framework/Magento/TestFramework/ConfigurableProduct/Model/DeleteConfigurableProduct.php new file mode 100644 index 0000000000000..3414efa1e30ed --- /dev/null +++ b/dev/tests/integration/framework/Magento/TestFramework/ConfigurableProduct/Model/DeleteConfigurableProduct.php @@ -0,0 +1,70 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\TestFramework\ConfigurableProduct\Model; + +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\ResourceModel\Product as ProductResource; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Registry; + +/** + * Delete configurable product with linked products + */ +class DeleteConfigurableProduct +{ + /** @var ProductRepositoryInterface */ + private $productRepository; + + /** @var ProductResource */ + private $productResource; + + /** @var Registry */ + private $registry; + + /** + * @param ProductRepositoryInterface $productRepository + * @param ProductResource $productResource + * @param Registry $registry + */ + public function __construct( + ProductRepositoryInterface $productRepository, + ProductResource $productResource, + Registry $registry + ) { + $this->productRepository = $productRepository; + $this->productResource = $productResource; + $this->registry = $registry; + } + + /** + * Delete configurable product and linked products + * + * @param string $sku + * @return void + */ + public function execute(string $sku): void + { + $configurableProduct = $this->productRepository->get($sku, false, null, true); + $childrenIds = $configurableProduct->getExtensionAttributes()->getConfigurableProductLinks(); + $childrenSkus = array_column($this->productResource->getProductsSku($childrenIds), 'sku'); + $childrenSkus[] = $sku; + $this->registry->unregister('isSecureArea'); + $this->registry->register('isSecureArea', true); + + foreach ($childrenSkus as $childSku) { + try { + $this->productRepository->deleteById($childSku); + } catch (NoSuchEntityException $e) { + //product already removed + } + } + + $this->registry->unregister('isSecureArea'); + $this->registry->register('isSecureArea', false); + } +} diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/ConfigurableViewOnCategoryPageTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/ConfigurableViewOnCategoryPageTest.php new file mode 100644 index 0000000000000..94aa958b44c26 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/ConfigurableViewOnCategoryPageTest.php @@ -0,0 +1,83 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\ConfigurableProduct\Block\Product\View\Type; + +use Magento\Catalog\Block\Product\ListProduct; +use Magento\Eav\Model\Entity\Collection\AbstractCollection; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\View\LayoutInterface; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; + +/** + * Class checks configurable product displaying on category view page + * + * @magentoDbIsolation disabled + * @magentoAppIsolation enabled + * @magentoAppArea frontend + * @magentoDataFixture Magento/ConfigurableProduct/_files/configurable_product_with_out_of_stock_children.php + */ +class ConfigurableViewOnCategoryPageTest extends TestCase +{ + /** @var ObjectManagerInterface */ + private $objectManager; + + /** @var LayoutInterface */ + private $layout; + + /** @var ListProduct $listingBlock */ + private $listingBlock; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + + $this->objectManager = Bootstrap::getObjectManager(); + $this->layout = $this->objectManager->get(LayoutInterface::class); + $this->listingBlock = $this->layout->createBlock(ListProduct::class); + $this->listingBlock->setCategoryId(333); + } + + /** + * @magentoConfigFixture current_store cataloginventory/options/show_out_of_stock 1 + * + * @return void + */ + public function testOutOfStockProductWithEnabledConfigView(): void + { + $collection = $this->listingBlock->getLoadedProductCollection(); + $this->assertCollectionSize(1, $collection); + } + + /** + * @magentoConfigFixture current_store cataloginventory/options/show_out_of_stock 0 + * + * @return void + */ + public function testOutOfStockProductWithDisabledConfigView(): void + { + $collection = $this->listingBlock->getLoadedProductCollection(); + $this->assertCollectionSize(0, $collection); + } + + /** + * Check collection size + * + * @param int $expectedSize + * @param AbstractCollection $collection + * @return void + */ + private function assertCollectionSize(int $expectedSize, AbstractCollection $collection): void + { + $this->assertEquals($expectedSize, $collection->getSize()); + $this->assertCount($expectedSize, $collection->getItems()); + } +} diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/ConfigurableViewOnProductPageTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/ConfigurableViewOnProductPageTest.php new file mode 100644 index 0000000000000..21ba9d2764b91 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/ConfigurableViewOnProductPageTest.php @@ -0,0 +1,290 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\ConfigurableProduct\Block\Product\View\Type; + +use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Catalog\Model\ResourceModel\Product as ProductResource; +use Magento\CatalogInventory\Api\Data\StockStatusInterface; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Serialize\SerializerInterface; +use Magento\Framework\View\LayoutInterface; +use Magento\Store\Model\Store; +use Magento\Store\Model\StoreManagerInterface; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; + +/** + * Class checks configurable product view with out of stock children + * + * @magentoAppArea frontend + * @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class ConfigurableViewOnProductPageTest extends TestCase +{ + private const STOCK_DISPLAY_TEMPLATE = 'Magento_Catalog::product/view/type/default.phtml'; + + /** @var ObjectManagerInterface */ + private $objectManager; + + /** @var ProductRepositoryInterface */ + private $productRepository; + + /** @var LayoutInterface */ + private $layout; + + /** @var Configurable */ + private $block; + + /** @var SerializerInterface */ + private $json; + + /** @var ProductResource */ + private $productResource; + + /** @var StoreManagerInterface */ + private $storeManager; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + + $this->objectManager = Bootstrap::getObjectManager(); + $this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class); + $this->productRepository->cleanCache(); + $this->layout = $this->objectManager->get(LayoutInterface::class); + $this->block = $this->layout->createBlock(Configurable::class); + $this->json = $this->objectManager->get(SerializerInterface::class); + $this->productResource = $this->objectManager->get(ProductResource::class); + $this->storeManager = $this->objectManager->get(StoreManagerInterface::class); + } + + /** + * @dataProvider oneChildNotVisibleDataProvider + * @magentoDbIsolation disabled + * + * @param string $sku + * @param array $data + * @param array $expectedData + * @return void + */ + public function testOneChildNotVisible(string $sku, array $data, array $expectedData): void + { + $configurableProduct = $this->prepareConfigurableProduct($sku, $data); + $result = $this->renderStockBlock($configurableProduct); + $this->performAsserts($result, $expectedData); + } + + /** + * @return array + */ + public function oneChildNotVisibleDataProvider(): array + { + return [ + 'one_child_out_of_stock' => [ + 'sku' => 'simple_10', + 'data' => [ + 'stock_data' => [ + 'use_config_manage_stock' => 1, + 'is_in_stock' => StockStatusInterface::STATUS_OUT_OF_STOCK, + ], + ], + 'expected_data' => [ + 'stock_status' => 'In stock', + 'options' => [ + [ + 'label' => 'Option 2', + 'product' => 'simple_20', + ], + ], + ], + ], + 'one_child_disabled' => [ + 'sku' => 'simple_10', + 'data' => [ + 'status' => Status::STATUS_DISABLED, + 'stock_data' => [ + 'use_config_manage_stock' => 1, + 'is_in_stock' => StockStatusInterface::STATUS_IN_STOCK, + ], + ], + 'expected_data' => [ + 'stock_status' => 'In stock', + 'options' => [ + [ + 'label' => 'Option 2', + 'product' => 'simple_20', + ], + ], + ], + ], + ]; + } + + /** + * @magentoConfigFixture current_store cataloginventory/options/show_out_of_stock 1 + * + * @dataProvider oneChildNotVisibleDataProviderWithEnabledConfig + * + * @param string $sku + * @param array $data + * @param array $expectedData + * @return void + */ + public function testOneChildNotVisibleWithEnabledShowOutOfStockProducts( + string $sku, + array $data, + array $expectedData + ): void { + $configurableProduct = $this->prepareConfigurableProduct($sku, $data); + $result = $this->renderStockBlock($configurableProduct); + $this->performAsserts($result, $expectedData); + } + + /** + * @return array + */ + public function oneChildNotVisibleDataProviderWithEnabledConfig(): array + { + return [ + 'one_child_out_of_stock' => [ + 'sku' => 'simple_10', + 'data' => [ + 'stock_data' => [ + 'use_config_manage_stock' => 1, + 'is_in_stock' => StockStatusInterface::STATUS_OUT_OF_STOCK, + ], + ], + 'expected_data' => [ + 'stock_status' => 'In stock', + 'options' => [ + [ + 'label' => 'Option 2', + 'product' => 'simple_20' + ], + [ + 'label' => 'Option 1', + 'product' => 'simple_10', + ], + ], + ], + ], + 'one_child_disabled' => [ + 'sku' => 'simple_10', + 'data' => [ + 'status' => Status::STATUS_DISABLED, + 'stock_data' => [ + 'use_config_manage_stock' => 1, + 'is_in_stock' => StockStatusInterface::STATUS_IN_STOCK, + ], + ], + 'expected_data' => [ + 'stock_status' => 'In stock', + 'options' => [ + [ + 'label' => 'Option 2', + 'product' => 'simple_20', + ], + ], + ], + ], + ]; + } + + /** + * Update product with data + * + * @param array $sku + * @param array $data + * @return void + */ + private function updateProduct(string $sku, array $data): void + { + $currentStore = $this->storeManager->getStore(); + try { + $this->storeManager->setCurrentStore(Store::DEFAULT_STORE_ID); + $product = $this->productRepository->get($sku); + $product->addData($data); + $this->productRepository->save($product); + } finally { + $this->storeManager->setCurrentStore($currentStore); + } + } + + /** + * Check attribute options + * + * @param array $actualData + * @param array $expectedData + * @return void + */ + private function assertConfig(array $actualData, array $expectedData): void + { + $this->assertCount(count($expectedData), $actualData['options_data'], 'Redundant options were loaded'); + $sku = array_column($expectedData, 'product'); + $idBySkuMapping = $this->productResource->getProductsIdsBySkus($sku); + foreach ($expectedData as $expectedOption) { + $expectedId = $idBySkuMapping[$expectedOption['product']]; + $itemToCheck = $actualData['options_data'][$expectedId] ?? null; + $this->assertNotNull($itemToCheck); + foreach ($actualData['attributes']['options'] as $actualAttributeDataItem) { + if ($actualAttributeDataItem['id'] === reset($itemToCheck)) { + $this->assertEquals($expectedOption['label'], $actualAttributeDataItem['label']); + } + } + } + } + + /** + * Render stock block + * + * @param ProductInterface $configurableProduct + * @return string + */ + private function renderStockBlock(ProductInterface $configurableProduct): string + { + $this->block->setProduct($configurableProduct); + $this->block->setTemplate(self::STOCK_DISPLAY_TEMPLATE); + + return $this->block->toHtml(); + } + + /** + * Perform test asserts + * + * @param string $result + * @param array $expectedData + * @return void + */ + private function performAsserts(string $result, array $expectedData): void + { + $this->assertEquals((string)__($expectedData['stock_status']), trim(strip_tags($result))); + $config = $this->json->unserialize($this->block->getJsonConfig()); + $dataToCheck = ['attributes' => reset($config['attributes']), 'options_data' => $config['index']]; + $this->assertConfig($dataToCheck, $expectedData['options']); + } + + /** + * Prepare configurable product with children to test + * + * @param string $sku + * @param array $data + * @return ProductInterface + */ + private function prepareConfigurableProduct(string $sku, array $data): ProductInterface + { + $this->updateProduct($sku, $data); + + return $this->productRepository->get('configurable', false, null, true); + } +} diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/Configurable/SalableTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/Configurable/SalableTest.php new file mode 100644 index 0000000000000..33c82dce21963 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/Configurable/SalableTest.php @@ -0,0 +1,121 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\ConfigurableProduct\Model\Product\Type\Configurable; + +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\CatalogInventory\Api\Data\StockStatusInterface; +use Magento\Framework\ObjectManagerInterface; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; + +/** + * Check is configurable product salable with different conditions + * + * @magentoAppArea frontend + */ +class SalableTest extends TestCase +{ + /** @var ObjectManagerInterface */ + private $objectManager; + + /** @var ProductRepositoryInterface */ + private $productRepository; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + + $this->objectManager = Bootstrap::getObjectManager(); + $this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class); + $this->productRepository->cleanCache(); + } + + /** + * @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php + * + * @dataProvider salableDataProvider + * + * @param array $productSkus + * @param array $productData + * @param bool $expectedValue + * @return void + */ + public function testIsSalable(array $productSkus, array $productData, bool $expectedValue): void + { + $this->updateProduct($productSkus, $productData); + $configurableProduct = $this->productRepository->get('configurable', false, null, true); + + $this->assertEquals($expectedValue, $configurableProduct->getIsSalable()); + } + + /** + * @return array + */ + public function salableDataProvider(): array + { + return [ + 'all children enabled_and_in_stock' => [ + 'product_skus' => [], + 'data' => [], + 'expected_value' => true, + ], + 'one_child_out_of_stock' => [ + 'product_skus' => ['simple_10'], + 'data' => [ + 'stock_data' => [ + 'use_config_manage_stock' => 1, + 'is_in_stock' => StockStatusInterface::STATUS_OUT_OF_STOCK, + ], + ], + 'expected_value' => true, + ], + 'one_child_disabled' => [ + 'product_skus' => ['simple_10'], + 'data' => ['status' => Status::STATUS_DISABLED], + 'expected_value' => true, + ], + 'all_children_disabled' => [ + 'product_skus' => ['simple_10', 'simple_20'], + 'data' => ['status' => Status::STATUS_DISABLED], + 'expected_value' => false, + ], + 'all_children_out_of_stock' => [ + 'product_skus' => ['simple_10', 'simple_20'], + 'data' => [ + 'stock_data' => [ + 'use_config_manage_stock' => 1, + 'is_in_stock' => StockStatusInterface::STATUS_OUT_OF_STOCK, + ], + ], + 'expected_value' => false, + ] + ]; + } + + /** + * Update product with data + * + * @param array $skus + * @param array $data + * @return void + */ + private function updateProduct(array $skus, array $data): void + { + if (!empty($skus)) { + foreach ($skus as $sku) { + $product = $this->productRepository->get($sku); + $product->addData($data); + $this->productRepository->save($product); + } + } + } +} diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_out_of_stock_children.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_out_of_stock_children.php new file mode 100644 index 0000000000000..5c749584b2917 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_out_of_stock_children.php @@ -0,0 +1,104 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\Data\ProductExtensionFactory; +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Catalog\Model\Product\Type as ProductType; +use Magento\Catalog\Model\Product\Visibility; +use Magento\Catalog\Model\ProductFactory; +use Magento\CatalogInventory\Api\Data\StockStatusInterface; +use Magento\ConfigurableProduct\Helper\Product\Options\Factory; +use Magento\ConfigurableProduct\Model\Product\Type\Configurable; +use Magento\Framework\ObjectManagerInterface; +use Magento\Store\Api\WebsiteRepositoryInterface; +use Magento\TestFramework\Helper\Bootstrap; + +require __DIR__ . '/configurable_attribute.php'; +require __DIR__ . '/../../Catalog/_files/category.php'; + +/** @var ObjectManagerInterface $objectManager */ +$objectManager = Bootstrap::getObjectManager(); +/** @var ProductAttributeRepositoryInterface $productAttributeRepository */ +$productAttributeRepository = $objectManager->create(ProductAttributeRepositoryInterface::class); +$attribute = $productAttributeRepository->get('test_configurable'); +$options = $attribute->getOptions(); +/** @var WebsiteRepositoryInterface $websiteRepository */ +$websiteRepository = $objectManager->get(WebsiteRepositoryInterface::class); +$baseWebsite = $websiteRepository->get('base'); +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->create(ProductRepositoryInterface::class); +/** @var ProductFactory $productFactory */ +$productFactory = $objectManager->get(ProductFactory::class); +$attributeValues = []; +$associatedProductIds = []; +$rootCategoryId = $baseWebsite->getDefaultStore()->getRootCategoryId(); +array_shift($options); + +foreach ($options as $option) { + $product = $productFactory->create(); + $product->setTypeId(ProductType::TYPE_SIMPLE) + ->setAttributeSetId($product->getDefaultAttributeSetId()) + ->setWebsiteIds([$baseWebsite->getId()]) + ->setName('Configurable Option ' . $option->getLabel()) + ->setSku(strtolower(str_replace(' ', '_', 'simple ' . $option->getLabel()))) + ->setPrice(150) + ->setTestConfigurable($option->getValue()) + ->setVisibility(Visibility::VISIBILITY_NOT_VISIBLE) + ->setStatus(Status::STATUS_ENABLED) + ->setCategoryIds([$rootCategoryId, 333]) + ->setStockData([ + 'use_config_manage_stock' => 1, + 'qty' => 100, + 'is_qty_decimal' => 0, + 'is_in_stock' => StockStatusInterface::STATUS_OUT_OF_STOCK + ]); + $product = $productRepository->save($product); + + $attributeValues[] = [ + 'label' => 'test', + 'attribute_id' => $attribute->getId(), + 'value_index' => $option->getValue(), + ]; + $associatedProductIds[] = $product->getId(); +} +/** @var Factory $optionsFactory */ +$optionsFactory = $objectManager->get(Factory::class); +$configurableAttributesData = [ + [ + 'attribute_id' => $attribute->getId(), + 'code' => $attribute->getAttributeCode(), + 'label' => $attribute->getStoreLabel(), + 'position' => '0', + 'values' => $attributeValues, + ], +]; +$configurableOptions = $optionsFactory->create($configurableAttributesData); + +$product = $productFactory->create(); +/** @var ProductExtensionFactory $extensionAttributesFactory */ +$extensionAttributesFactory = $objectManager->get(ProductExtensionFactory::class); +$extensionConfigurableAttributes = $product->getExtensionAttributes() ?: $extensionAttributesFactory->create(); +$extensionConfigurableAttributes->setConfigurableProductOptions($configurableOptions); +$extensionConfigurableAttributes->setConfigurableProductLinks($associatedProductIds); +$product->setExtensionAttributes($extensionConfigurableAttributes); + +$product->setTypeId(Configurable::TYPE_CODE) + ->setAttributeSetId($product->getDefaultAttributeSetId()) + ->setWebsiteIds([$baseWebsite->getId()]) + ->setName('Configurable Product') + ->setSku('configurable') + ->setVisibility(Visibility::VISIBILITY_BOTH) + ->setStatus(Status::STATUS_ENABLED) + ->setCategoryIds([$rootCategoryId, 333]) + ->setStockData([ + 'use_config_manage_stock' => 1, + 'qty' => 100, + 'is_in_stock' => StockStatusInterface::STATUS_IN_STOCK + ]); +$productRepository->save($product); diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_out_of_stock_children_rollback.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_out_of_stock_children_rollback.php new file mode 100644 index 0000000000000..d13b7688f6d91 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_out_of_stock_children_rollback.php @@ -0,0 +1,19 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Framework\ObjectManagerInterface; +use Magento\TestFramework\ConfigurableProduct\Model\DeleteConfigurableProduct; +use Magento\TestFramework\Helper\Bootstrap; + +/** @var ObjectManagerInterface $objectManager */ +$objectManager = Bootstrap::getObjectManager(); +/** @var DeleteConfigurableProduct $deleteConfigurableProductService */ +$deleteConfigurableProductService = $objectManager->get(DeleteConfigurableProduct::class); +$deleteConfigurableProductService->execute('configurable'); + +require __DIR__ . '/configurable_attribute_rollback.php'; +require __DIR__ . '/../../Catalog/_files/category_rollback.php'; From 882fa18b167c22aef4891d3828639c709b8c0eff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Mon, 13 Jan 2020 13:26:32 +0100 Subject: [PATCH 0795/1143] Code Review changes --- .../CatalogInventory/Model/StockIndex.php | 25 ++++++------ .../Block/Product/ProductsList.php | 5 ++- .../ProcessingErrorAggregator.php | 2 +- .../PageCache/Model/Layout/LayoutPlugin.php | 38 +++++++++++-------- 4 files changed, 39 insertions(+), 31 deletions(-) diff --git a/app/code/Magento/CatalogInventory/Model/StockIndex.php b/app/code/Magento/CatalogInventory/Model/StockIndex.php index af211b98386bd..ad0cff43c6ac9 100644 --- a/app/code/Magento/CatalogInventory/Model/StockIndex.php +++ b/app/code/Magento/CatalogInventory/Model/StockIndex.php @@ -6,15 +6,16 @@ namespace Magento\CatalogInventory\Model; +use Magento\Catalog\Model\Product; use Magento\Catalog\Model\Product\Type as ProductType; use Magento\Catalog\Model\Product\Website as ProductWebsite; -use Magento\Catalog\Model\ProductFactory; use Magento\CatalogInventory\Api\StockIndexInterface; use Magento\CatalogInventory\Model\ResourceModel\Stock\Status as StockStatusResourceModel; use Magento\CatalogInventory\Model\Spi\StockRegistryProviderInterface; use Magento\Catalog\Api\ProductRepositoryInterface; use Magento\Catalog\Model\Product\Attribute\Source\Status; use Magento\Framework\App\ObjectManager; +use Magento\Store\Model\Website; /** * Index responsible for Stock @@ -123,7 +124,7 @@ public function updateProductStockStatus($productId, $websiteId) { $item = $this->stockRegistryProvider->getStockItem($productId, $websiteId); - $status = \Magento\CatalogInventory\Model\Stock\Status::STATUS_IN_STOCK; + $status = Stock\Status::STATUS_IN_STOCK; $qty = 0; if ($item->getItemId()) { $status = $item->getIsInStock(); @@ -147,9 +148,9 @@ protected function processChildren( $productId, $websiteId, $qty = 0, - $status = \Magento\CatalogInventory\Model\Stock\Status::STATUS_IN_STOCK + $status = Stock\Status::STATUS_IN_STOCK ) { - if ($status == \Magento\CatalogInventory\Model\Stock\Status::STATUS_OUT_OF_STOCK) { + if ($status == Stock\Status::STATUS_OUT_OF_STOCK) { $this->getStockStatusResource()->saveProductStatus($productId, $status, $qty, $websiteId); return; } @@ -158,11 +159,11 @@ protected function processChildren( $websitesWithStores = $this->getWebsitesWithDefaultStores($websiteId); foreach (array_keys($websitesWithStores) as $websiteId) { - /* @var $website \Magento\Store\Model\Website */ + /* @var $website Website */ $statuses[$websiteId] = $status; } - /** @var \Magento\Catalog\Model\Product $product */ + /** @var Product $product */ $product = $this->productRepository->getById($productId); $typeInstance = $product->getTypeInstance(); @@ -187,7 +188,7 @@ protected function processChildren( && in_array($websiteId, $childrenWebsites[$childId]) && $childrenStatus[$childId] == Status::STATUS_ENABLED && isset($childrenStock[$childId]) - && $childrenStock[$childId] == \Magento\CatalogInventory\Model\Stock\Status::STATUS_IN_STOCK + && $childrenStock[$childId] == Stock\Status::STATUS_IN_STOCK ) { $optionStatus = true; } @@ -206,7 +207,7 @@ protected function processChildren( * Retrieve website models * * @param int|null $websiteId - * @return array + * @return Website[] */ protected function getWebsitesWithDefaultStores($websiteId = null) { @@ -233,19 +234,19 @@ protected function processParents($productId, $websiteId) { $parentIds = [[]]; foreach ($this->getProductTypeInstances() as $typeInstance) { - /* @var $typeInstance AbstractType */ + /* @var ProductType\AbstractType $typeInstance */ $parentIds[] = $typeInstance->getParentIdsByChild($productId); } $parentIds = array_merge(...$parentIds); if (empty($parentIds)) { - return $this; + return; } foreach ($parentIds as $parentId) { $item = $this->stockRegistryProvider->getStockItem($parentId, $websiteId); - $status = \Magento\CatalogInventory\Model\Stock\Status::STATUS_IN_STOCK; + $status = Stock\Status::STATUS_IN_STOCK; $qty = 0; if ($item->getItemId()) { $status = $item->getIsInStock(); @@ -258,7 +259,7 @@ protected function processParents($productId, $websiteId) /** * Retrieve Product Type Instances as key - type code, value - instance model * - * @return array + * @return ProductType\AbstractType[] */ protected function getProductTypeInstances() { diff --git a/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php b/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php index 22e3a7382cdac..63aaf85245651 100644 --- a/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php +++ b/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php @@ -187,7 +187,8 @@ protected function _construct() 'cache_lifetime' => 86400, 'cache_tags' => [ Product::CACHE_TAG, - ], ]); + ], + ]); } /** @@ -208,7 +209,7 @@ public function getCacheKeyInfo() $this->_storeManager->getStore()->getId(), $this->_design->getDesignTheme()->getId(), $this->httpContext->getValue(\Magento\Customer\Model\Context::CONTEXT_GROUP), - (int) $this->getRequest()->getParam($this->getData('page_var_name'), 1), + (int)$this->getRequest()->getParam($this->getData('page_var_name'), 1), $this->getProductsPerPage(), $this->getProductsCount(), $conditions, diff --git a/app/code/Magento/ImportExport/Model/Import/ErrorProcessing/ProcessingErrorAggregator.php b/app/code/Magento/ImportExport/Model/Import/ErrorProcessing/ProcessingErrorAggregator.php index eed98c10704ad..5ea6227231543 100644 --- a/app/code/Magento/ImportExport/Model/Import/ErrorProcessing/ProcessingErrorAggregator.php +++ b/app/code/Magento/ImportExport/Model/Import/ErrorProcessing/ProcessingErrorAggregator.php @@ -237,7 +237,7 @@ public function hasFatalExceptions() */ public function getAllErrors() { - if (empty($this->items)) { + if (empty($this->items) || empty($this->items['rows'])) { return []; } diff --git a/app/code/Magento/PageCache/Model/Layout/LayoutPlugin.php b/app/code/Magento/PageCache/Model/Layout/LayoutPlugin.php index 8c6f9fb543d84..b4d9cb2d5e076 100644 --- a/app/code/Magento/PageCache/Model/Layout/LayoutPlugin.php +++ b/app/code/Magento/PageCache/Model/Layout/LayoutPlugin.php @@ -3,8 +3,15 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\PageCache\Model\Layout; +use Magento\Framework\App\MaintenanceMode; +use Magento\Framework\App\ResponseInterface; +use Magento\Framework\DataObject\IdentityInterface; +use Magento\Framework\View\Layout; +use Magento\PageCache\Model\Config; + /** * Class LayoutPlugin * @@ -13,31 +20,31 @@ class LayoutPlugin { /** - * @var \Magento\PageCache\Model\Config + * @var Config */ protected $config; /** - * @var \Magento\Framework\App\ResponseInterface + * @var ResponseInterface */ protected $response; /** - * @var \Magento\Framework\App\MaintenanceMode + * @var MaintenanceMode */ private $maintenanceMode; /** * Constructor * - * @param \Magento\Framework\App\ResponseInterface $response - * @param \Magento\PageCache\Model\Config $config - * @param \Magento\Framework\App\MaintenanceMode $maintenanceMode + * @param ResponseInterface $response + * @param Config $config + * @param MaintenanceMode $maintenanceMode */ public function __construct( - \Magento\Framework\App\ResponseInterface $response, - \Magento\PageCache\Model\Config $config, - \Magento\Framework\App\MaintenanceMode $maintenanceMode + ResponseInterface $response, + Config $config, + MaintenanceMode $maintenanceMode ) { $this->response = $response; $this->config = $config; @@ -49,11 +56,11 @@ public function __construct( * * We have to set public headers in order to tell Varnish and Builtin app that page should be cached * - * @param \Magento\Framework\View\Layout $subject + * @param Layout $subject * @param mixed $result * @return mixed */ - public function afterGenerateXml(\Magento\Framework\View\Layout $subject, $result) + public function afterGenerateXml(Layout $subject, $result) { if ($subject->isCacheable() && !$this->maintenanceMode->isOn() && $this->config->isEnabled()) { $this->response->setPublicHeaders($this->config->getTtl()); @@ -64,22 +71,21 @@ public function afterGenerateXml(\Magento\Framework\View\Layout $subject, $resul /** * Retrieve all identities from blocks for further cache invalidation * - * @param \Magento\Framework\View\Layout $subject + * @param Layout $subject * @param mixed $result * @return mixed */ - public function afterGetOutput(\Magento\Framework\View\Layout $subject, $result) + public function afterGetOutput(Layout $subject, $result) { if ($subject->isCacheable() && $this->config->isEnabled()) { $tags = [[]]; foreach ($subject->getAllBlocks() as $block) { - if ($block instanceof \Magento\Framework\DataObject\IdentityInterface) { + if ($block instanceof IdentityInterface) { $isEsiBlock = $block->getTtl() > 0; - $isVarnish = $this->config->getType() == \Magento\PageCache\Model\Config::VARNISH; + $isVarnish = $this->config->getType() == Config::VARNISH; if ($isVarnish && $isEsiBlock) { continue; } - // phpcs:ignore $tags[] = $block->getIdentities(); } } From ee888ca2ccad1deaea40c1c9a7c476e08bc9db43 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Mon, 13 Jan 2020 14:05:54 +0200 Subject: [PATCH 0796/1143] use underscore find --- .../view/frontend/web/js/configurable.js | 4 +- .../view/frontend/js/configurable.test.js | 41 +------------------ 2 files changed, 3 insertions(+), 42 deletions(-) diff --git a/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js b/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js index 7029d76df9eac..6f3af43bf5c7a 100644 --- a/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js +++ b/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js @@ -140,7 +140,7 @@ define([ $.each(queryParams, $.proxy(function (key, value) { if (this.options.spConfig.attributes[key] !== undefined && - this.options.spConfig.attributes[key].options.find(function (element) { + _.find(this.options.spConfig.attributes[key].options, function (element) { return element.id === value; })) { this.options.values[key] = value; @@ -162,7 +162,7 @@ define([ attributeId = element.id.replace(/[a-z]*/, ''); if (this.options.spConfig.attributes[attributeId] !== undefined && - this.options.spConfig.attributes[attributeId].options.find(function (optionElement) { + _.find(this.options.spConfig.attributes[attributeId].options, function (optionElement) { return optionElement.id === element.value; })) { this.options.values[attributeId] = element.value; diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/frontend/js/configurable.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/frontend/js/configurable.test.js index 5cf7b823f144d..21492b20b779c 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/frontend/js/configurable.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/frontend/js/configurable.test.js @@ -20,45 +20,6 @@ define([ selectElement = $(option); beforeEach(function () { - //remove this lines when jasmine version will be upgraded - if (!Array.prototype.find) { - Object.defineProperty(Array.prototype, 'find', {//eslint-disable-line - enumerable: false, - configurable: true, - writable: true, - - /** - * Find method - */ - value: function (predicate) { - var list = Object(this), - length = list.length >>> 0, - thisArg = arguments[1], - value, - i; - - if (this == null) { - throw new TypeError('Array.prototype.find called on null or undefined'); - } - - if (typeof predicate !== 'function') { - throw new TypeError('predicate must be a function'); - } - - for (i = 0; i < length; i++) { - if (i in list) { - value = list[i]; - - if (predicate.call(thisArg, value, i, list)) {//eslint-disable-line - return value; - } - } - } - - return undefined; - } - }); - } widget = new Configurable(); widget.options = { spConfig: { @@ -98,7 +59,7 @@ define([ expect(widget.options.values.size).toBe('2'); }); - it('check that attribute value is not set id provided option does not exists', function () { + it('check that attribute value is not set if provided option does not exists', function () { expect($.mage.configurable).toBeDefined(); widget._parseQueryParams('size=10'); widget._fillSelect(selectElement[0]); From 1b3101d4c1e5b79e420fa7fa389040a1e7bffa48 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky <firster@atwix.com> Date: Mon, 13 Jan 2020 15:58:24 +0200 Subject: [PATCH 0797/1143] magento/magento2#: Unit test for \Magento\Review\Observer\CatalogProductListCollectionAppendSummaryFieldsObserver --- ...ogProductListCollectionAppendSummaryFieldsObserverTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Review/Test/Unit/Observer/CatalogProductListCollectionAppendSummaryFieldsObserverTest.php b/app/code/Magento/Review/Test/Unit/Observer/CatalogProductListCollectionAppendSummaryFieldsObserverTest.php index fe86954d77c51..894463de93227 100644 --- a/app/code/Magento/Review/Test/Unit/Observer/CatalogProductListCollectionAppendSummaryFieldsObserverTest.php +++ b/app/code/Magento/Review/Test/Unit/Observer/CatalogProductListCollectionAppendSummaryFieldsObserverTest.php @@ -104,8 +104,8 @@ protected function setUp() : void ->getMock(); $this->observer = new CatalogProductListCollectionAppendSummaryFieldsObserver( - $this->sumResourceFactoryMock, - $this->storeManagerMock + $this->sumResourceFactoryMock, + $this->storeManagerMock ); } From 109392d8d78f6ada85e13f1523537888a66e8da0 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <51681487+engcom-Foxtrot@users.noreply.github.com> Date: Mon, 13 Jan 2020 16:31:03 +0200 Subject: [PATCH 0798/1143] magento/magento2#25375: Typo fix. --- .../Catalog/view/base/web/template/product/list/listing.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/view/base/web/template/product/list/listing.html b/app/code/Magento/Catalog/view/base/web/template/product/list/listing.html index b9cf20fa32cb0..ea0124f1c7c4d 100644 --- a/app/code/Magento/Catalog/view/base/web/template/product/list/listing.html +++ b/app/code/Magento/Catalog/view/base/web/template/product/list/listing.html @@ -42,7 +42,7 @@ </div> </div> - <div if=regionHasElements('description-area')" + <div if="regionHasElements('description-area')" class="product-item-description"> <fastForEach args="data: getRegion('description-area'), as: '$col'" > <render args="$col.getBody()"/> @@ -54,4 +54,4 @@ </ol> </div> </div> -</div> \ No newline at end of file +</div> From cff53539219c749b7406c5ec0795e47ce71ff915 Mon Sep 17 00:00:00 2001 From: David Haecker <dhaecker@magento.com> Date: Mon, 13 Jan 2020 08:47:15 -0600 Subject: [PATCH 0799/1143] MC-23535: Fix Skipped MFTF Tests MC-28537 - Removing enable wysiwyg which breaks following test in suite - Unskipping AdminProductImageAssignmentForMultipleStoresTest --- .../Test/AdminCreateAndEditVirtualProductSettingsTest.xml | 4 ++-- .../Test/AdminProductImageAssignmentForMultipleStoresTest.xml | 3 --- .../Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGCMSTest.xml | 1 + 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndEditVirtualProductSettingsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndEditVirtualProductSettingsTest.xml index 34451aba78f21..70cbfe7259da0 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndEditVirtualProductSettingsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndEditVirtualProductSettingsTest.xml @@ -51,7 +51,7 @@ <actionGroup ref="logout" stepKey="adminLogout"/> </after> - <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> + <comment userInput="remove me" stepKey="disableWYSIWYG"/> <!-- Create new virtual product --> <actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="createVirtualProduct"> @@ -185,6 +185,6 @@ <actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openCart"/> <dontSeeElement selector="{{StorefrontProductCartGiftOptionSection.giftOptions}}" stepKey="dontSeeGiftOptionBtn"/> - <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> + <comment userInput="remove me" stepKey="enableWYSIWYG"/> </test> </tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductImageAssignmentForMultipleStoresTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductImageAssignmentForMultipleStoresTest.xml index 455e77666c3a2..59be8157d2f87 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductImageAssignmentForMultipleStoresTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductImageAssignmentForMultipleStoresTest.xml @@ -18,9 +18,6 @@ <testCaseId value="MAGETWO-58718"/> <group value="product"/> <group value="WYSIWYGDisabled"/> - <skip> - <issueId value="MC-13841"/> - </skip> </annotations> <before> <!-- Login Admin --> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGCMSTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGCMSTest.xml index dd45c6768e67f..201a84ecb3c65 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGCMSTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGCMSTest.xml @@ -55,6 +55,7 @@ <seeElement selector="{{StorefrontCMSPageSection.mediaDescription}}" stepKey="assertMediaDescription"/> <seeElementInDOM selector="{{StorefrontCMSPageSection.imageSource(ImageUpload3.fileName)}}" stepKey="assertMediaSource"/> <after> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYGFirst"/> <deleteData createDataKey="createCMSPage" stepKey="deletePreReqCMSPage" /> <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> From 974f72259a91a9054fd0c24f06b5b632db65fd60 Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Mon, 13 Jan 2020 17:57:42 +0200 Subject: [PATCH 0800/1143] MC-29023: Custom attribute values cannot be saved in Admin panel --- .../Test/Mftf/Test/StorefrontInactiveCatalogRuleTest.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/StorefrontInactiveCatalogRuleTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/StorefrontInactiveCatalogRuleTest.xml index a4fc6757ae6cb..3423baf7970eb 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/StorefrontInactiveCatalogRuleTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/StorefrontInactiveCatalogRuleTest.xml @@ -17,6 +17,9 @@ <severity value="CRITICAL"/> <testCaseId value="MC-79"/> <group value="CatalogRule"/> + <skip> + <issueId value="MC-30384"/> + </skip> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="login"/> From f948b1f76f75aa2764de369388b8e733510e1a23 Mon Sep 17 00:00:00 2001 From: Manuel Canepa <manuelcanepa@gmail.com> Date: Mon, 13 Jan 2020 13:28:18 -0300 Subject: [PATCH 0801/1143] Add missing copyright --- .../Test/Unit/Model/XmlCatalog/Format/VsCodeTest.php | 4 ++++ .../Unit/Model/XmlCatalog/Format/_files/invalid_catalog.xml | 6 ++++++ .../Unit/Model/XmlCatalog/Format/_files/valid_catalog.xml | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/VsCodeTest.php b/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/VsCodeTest.php index 64b9f367e5198..4e90bd0b0576c 100644 --- a/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/VsCodeTest.php +++ b/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/VsCodeTest.php @@ -1,4 +1,8 @@ <?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ namespace Magento\Developer\Test\Unit\Model\XmlCatalog\Format; diff --git a/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/_files/invalid_catalog.xml b/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/_files/invalid_catalog.xml index fe6ba3f75f93e..213448bfc7a68 100644 --- a/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/_files/invalid_catalog.xml +++ b/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/_files/invalid_catalog.xml @@ -1,2 +1,8 @@ <?xml version="1.0"?> +<!-- +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> <root /> diff --git a/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/_files/valid_catalog.xml b/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/_files/valid_catalog.xml index ab3973dd89189..43fee113e9930 100644 --- a/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/_files/valid_catalog.xml +++ b/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/_files/valid_catalog.xml @@ -1,4 +1,10 @@ <?xml version="1.0"?> +<!-- +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"> <system systemId="urn:magento:framework:Acl/etc/acl.xsd" uri="../vendor/magento/framework/Acl/etc/acl.xsd"/> <system systemId="urn:magento:module:Magento_Store:etc/config.xsd" uri="../vendor/magento/module-store/etc/config.xsd"/> From 8ffe789b79b0eab41be830b3761a2dc404e23819 Mon Sep 17 00:00:00 2001 From: Manuel Canepa <manuelcanepa@gmail.com> Date: Mon, 13 Jan 2020 14:28:30 -0300 Subject: [PATCH 0802/1143] Fix code style --- .../Unit/Model/XmlCatalog/Format/VsCodeTest.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/VsCodeTest.php b/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/VsCodeTest.php index 4e90bd0b0576c..55d2a811b2eee 100644 --- a/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/VsCodeTest.php +++ b/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/VsCodeTest.php @@ -265,13 +265,18 @@ public function dictionaryDataProvider() return [ [ $content, - ['urn:magento:framework:Acl/etc/acl.xsd' => 'vendor/magento/framework/Acl/etc/acl.xsd', - 'urn:magento:module:Magento_Store:etc/config.xsd' => 'vendor/magento/module-store/etc/config.xsd', - 'urn:magento:module:Magento_Cron:etc/crontab.xsd' => 'vendor/magento/module-cron/etc/crontab.xsd', - 'urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd' => 'vendor/magento/framework/Setup/Declaration/Schema/etc/schema.xsd'], + [ + 'urn:magento:framework:Acl/etc/acl.xsd' => + 'vendor/magento/framework/Acl/etc/acl.xsd', + 'urn:magento:module:Magento_Store:etc/config.xsd' => + 'vendor/magento/module-store/etc/config.xsd', + 'urn:magento:module:Magento_Cron:etc/crontab.xsd' => + 'vendor/magento/module-cron/etc/crontab.xsd', + 'urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd' => + 'vendor/magento/framework/Setup/Declaration/Schema/etc/schema.xsd', + ], $invalidContent, ], ]; } - } From 55fd41846c0b33971f8112dacf7f9dddea532bf6 Mon Sep 17 00:00:00 2001 From: Raoul Rego <rrego@adobe.com> Date: Mon, 13 Jan 2020 12:42:13 -0600 Subject: [PATCH 0803/1143] MC-30288: Hidden PHP Notice and Warning in tests - Handle PHP warning as error during transaction in test run. - Update integration/phpunit.xml Magento TestListeners after AllureAdapter. --- .../TestFramework/Event/Transaction.php | 19 +++++++++++++++++-- dev/tests/integration/phpunit.xml.dist | 5 +++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/dev/tests/integration/framework/Magento/TestFramework/Event/Transaction.php b/dev/tests/integration/framework/Magento/TestFramework/Event/Transaction.php index 9ab6d67014129..2add2ed48fb98 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Event/Transaction.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Event/Transaction.php @@ -4,11 +4,11 @@ * See COPYING.txt for license details. */ +namespace Magento\TestFramework\Event; + /** * Database transaction events manager */ -namespace Magento\TestFramework\Event; - class Transaction { /** @@ -86,6 +86,7 @@ protected function _processTransactionRequests($eventName, \PHPUnit\Framework\Te * Start transaction and fire 'startTransaction' event * * @param \PHPUnit\Framework\TestCase $test + * @SuppressWarnings(PHPMD.UnusedLocalVariable) */ protected function _startTransaction(\PHPUnit\Framework\TestCase $test) { @@ -93,7 +94,21 @@ protected function _startTransaction(\PHPUnit\Framework\TestCase $test) $this->_getConnection()->beginTransparentTransaction(); $this->_isTransactionActive = true; try { + /** + * Add any warning during transaction execution as a failure. + */ + set_error_handler( + function ($errNo, $errStr, $errFile, $errLine) use ($test) { + $errMsg = sprintf("%s: %s in %s:%s.", "Warning", $errStr, $errFile, $errLine); + $test->getTestResultObject()->addError($test, new \PHPUnit\Framework\Warning($errMsg), 0); + + // Allow error to be handled by next error handler + return false; + }, + E_WARNING + ); $this->_eventManager->fireEvent('startTransaction', [$test]); + restore_error_handler(); } catch (\Exception $e) { $test->getTestResultObject()->addFailure( $test, diff --git a/dev/tests/integration/phpunit.xml.dist b/dev/tests/integration/phpunit.xml.dist index 858de7a9873e7..56812163ed5f2 100644 --- a/dev/tests/integration/phpunit.xml.dist +++ b/dev/tests/integration/phpunit.xml.dist @@ -78,8 +78,6 @@ </php> <!-- Test listeners --> <listeners> - <listener class="Magento\TestFramework\Event\PhpUnit"/> - <listener class="Magento\TestFramework\ErrorLog\Listener"/> <listener class="Yandex\Allure\Adapter\AllureAdapter"> <arguments> <string>var/allure-results</string> <!-- XML files output directory --> @@ -127,5 +125,8 @@ </array> </arguments> </listener> + <!-- Run after AllureAdapter to allow it to initialize properly --> + <listener class="Magento\TestFramework\Event\PhpUnit"/> + <listener class="Magento\TestFramework\ErrorLog\Listener"/> </listeners> </phpunit> From 08061d9c4a73e8498c4b62a74717a3cadd01267e Mon Sep 17 00:00:00 2001 From: Manuel Canepa <manuelcanepa@gmail.com> Date: Mon, 13 Jan 2020 17:13:46 -0300 Subject: [PATCH 0804/1143] Remove copyright from xml tests files --- .../Unit/Model/XmlCatalog/Format/_files/invalid_catalog.xml | 6 ------ .../Unit/Model/XmlCatalog/Format/_files/valid_catalog.xml | 6 ------ 2 files changed, 12 deletions(-) diff --git a/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/_files/invalid_catalog.xml b/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/_files/invalid_catalog.xml index 213448bfc7a68..fe6ba3f75f93e 100644 --- a/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/_files/invalid_catalog.xml +++ b/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/_files/invalid_catalog.xml @@ -1,8 +1,2 @@ <?xml version="1.0"?> -<!-- -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> <root /> diff --git a/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/_files/valid_catalog.xml b/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/_files/valid_catalog.xml index 43fee113e9930..ab3973dd89189 100644 --- a/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/_files/valid_catalog.xml +++ b/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/_files/valid_catalog.xml @@ -1,10 +1,4 @@ <?xml version="1.0"?> -<!-- -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"> <system systemId="urn:magento:framework:Acl/etc/acl.xsd" uri="../vendor/magento/framework/Acl/etc/acl.xsd"/> <system systemId="urn:magento:module:Magento_Store:etc/config.xsd" uri="../vendor/magento/module-store/etc/config.xsd"/> From 779c9ae5d7e7e8c4b0438092011768dfca72ab05 Mon Sep 17 00:00:00 2001 From: Manuel Canepa <manuelcanepa@gmail.com> Date: Mon, 13 Jan 2020 17:19:09 -0300 Subject: [PATCH 0805/1143] Add comments on tests and output files --- .../Magento/Developer/Model/XmlCatalog/Format/VsCode.php | 9 ++++++++- .../Model/XmlCatalog/Format/_files/invalid_catalog.xml | 6 ++++++ .../Model/XmlCatalog/Format/_files/valid_catalog.xml | 6 ++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Developer/Model/XmlCatalog/Format/VsCode.php b/app/code/Magento/Developer/Model/XmlCatalog/Format/VsCode.php index 9ba53757c478c..568774a112e9a 100644 --- a/app/code/Magento/Developer/Model/XmlCatalog/Format/VsCode.php +++ b/app/code/Magento/Developer/Model/XmlCatalog/Format/VsCode.php @@ -117,8 +117,15 @@ public function generateCatalog(array $dictionary, $configFile): void */ private function initEmptyFile(\DOMDocument $dom): \DOMElement { - $catalogNode = $dom->createElement('catalog'); + $copyrigthComment = $dom->createComment(' +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +'); + $dom->appendChild($copyrigthComment); + $catalogNode = $dom->createElement('catalog'); $catalogNode->setAttribute('xmlns', self::XMLNS); $dom->appendChild($catalogNode); diff --git a/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/_files/invalid_catalog.xml b/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/_files/invalid_catalog.xml index fe6ba3f75f93e..213448bfc7a68 100644 --- a/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/_files/invalid_catalog.xml +++ b/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/_files/invalid_catalog.xml @@ -1,2 +1,8 @@ <?xml version="1.0"?> +<!-- +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> <root /> diff --git a/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/_files/valid_catalog.xml b/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/_files/valid_catalog.xml index ab3973dd89189..43fee113e9930 100644 --- a/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/_files/valid_catalog.xml +++ b/app/code/Magento/Developer/Test/Unit/Model/XmlCatalog/Format/_files/valid_catalog.xml @@ -1,4 +1,10 @@ <?xml version="1.0"?> +<!-- +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"> <system systemId="urn:magento:framework:Acl/etc/acl.xsd" uri="../vendor/magento/framework/Acl/etc/acl.xsd"/> <system systemId="urn:magento:module:Magento_Store:etc/config.xsd" uri="../vendor/magento/module-store/etc/config.xsd"/> From 8c8f2572bf354994b0175b56893eacb251f504aa Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Tue, 14 Jan 2020 10:01:05 +0200 Subject: [PATCH 0806/1143] MC-30262: Inventory Sources and Stock is breaking the Category and CMS --- .../Model/Rule/Condition/Product.php | 5 +- .../Unit/Model/Rule/Condition/ProductTest.php | 54 ++++--- .../Condition/Product/AbstractProduct.php | 2 + .../Condition/Product/AbstractProductTest.php | 148 +++++++++++------- 4 files changed, 130 insertions(+), 79 deletions(-) diff --git a/app/code/Magento/CatalogWidget/Model/Rule/Condition/Product.php b/app/code/Magento/CatalogWidget/Model/Rule/Condition/Product.php index a712ae91cbfa9..eca994de0892f 100644 --- a/app/code/Magento/CatalogWidget/Model/Rule/Condition/Product.php +++ b/app/code/Magento/CatalogWidget/Model/Rule/Condition/Product.php @@ -14,7 +14,8 @@ use Magento\Store\Model\Store; /** - * Class Product + * Rule product condition data model + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Product extends \Magento\Rule\Model\Condition\Product\AbstractProduct @@ -250,7 +251,7 @@ protected function addNotGlobalAttribute( public function getMappedSqlField() { $result = ''; - if (in_array($this->getAttribute(), ['category_ids', 'sku'])) { + if (in_array($this->getAttribute(), ['category_ids', 'sku', 'attribute_set_id'])) { $result = parent::getMappedSqlField(); } elseif (isset($this->joinedAttributes[$this->getAttribute()])) { $result = $this->joinedAttributes[$this->getAttribute()]; diff --git a/app/code/Magento/CatalogWidget/Test/Unit/Model/Rule/Condition/ProductTest.php b/app/code/Magento/CatalogWidget/Test/Unit/Model/Rule/Condition/ProductTest.php index 219cae6829299..7dceb41d263ec 100644 --- a/app/code/Magento/CatalogWidget/Test/Unit/Model/Rule/Condition/ProductTest.php +++ b/app/code/Magento/CatalogWidget/Test/Unit/Model/Rule/Condition/ProductTest.php @@ -5,53 +5,65 @@ */ namespace Magento\CatalogWidget\Test\Unit\Model\Rule\Condition; +use Magento\Catalog\Model\ProductCategoryList; +use Magento\Catalog\Model\ResourceModel\Eav\Attribute; +use Magento\Catalog\Model\ResourceModel\Product; +use Magento\Catalog\Model\ResourceModel\Product\Collection; +use Magento\CatalogWidget\Model\Rule\Condition\Product as ProductWidget; +use Magento\Eav\Model\Config; +use Magento\Eav\Model\Entity\AbstractEntity; +use Magento\Framework\DB\Adapter\AdapterInterface; +use Magento\Framework\DB\Select; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\SalesRule\Model\Rule; +use Magento\Store\Api\Data\StoreInterface; +use Magento\Store\Model\StoreManagerInterface; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class ProductTest extends \PHPUnit\Framework\TestCase +class ProductTest extends TestCase { /** - * @var \Magento\CatalogWidget\Model\Rule\Condition\Product + * @var ProductWidget */ private $model; /** - * @var \Magento\Catalog\Model\ResourceModel\Product|\PHPUnit_Framework_MockObject_MockObject + * @var MockObject */ - private $productResource; + private $attributeMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var Product|MockObject */ - private $attributeMock; + private $productResource; /** * @inheritdoc - * - * @return void */ protected function setUp() { $objectManagerHelper = new ObjectManager($this); - $eavConfig = $this->createMock(\Magento\Eav\Model\Config::class); - $this->attributeMock = $this->createMock(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class); + $eavConfig = $this->createMock(Config::class); + $this->attributeMock = $this->createMock(Attribute::class); $eavConfig->expects($this->any())->method('getAttribute')->willReturn($this->attributeMock); - $ruleMock = $this->createMock(\Magento\SalesRule\Model\Rule::class); - $storeManager = $this->createMock(\Magento\Store\Model\StoreManagerInterface::class); - $storeMock = $this->createMock(\Magento\Store\Api\Data\StoreInterface::class); + $ruleMock = $this->createMock(Rule::class); + $storeManager = $this->createMock(StoreManagerInterface::class); + $storeMock = $this->createMock(StoreInterface::class); $storeManager->expects($this->any())->method('getStore')->willReturn($storeMock); - $this->productResource = $this->createMock(\Magento\Catalog\Model\ResourceModel\Product::class); + $this->productResource = $this->createMock(Product::class); $this->productResource->expects($this->once())->method('loadAllAttributes')->willReturnSelf(); $this->productResource->expects($this->once())->method('getAttributesByCode')->willReturn([]); - $productCategoryList = $this->getMockBuilder(\Magento\Catalog\Model\ProductCategoryList::class) + $productCategoryList = $this->getMockBuilder(ProductCategoryList::class) ->disableOriginalConstructor() ->getMock(); $this->model = $objectManagerHelper->getObject( - \Magento\CatalogWidget\Model\Rule\Condition\Product::class, + ProductWidget::class, [ 'config' => $eavConfig, 'storeManager' => $storeManager, @@ -72,8 +84,8 @@ protected function setUp() */ public function testAddToCollection() { - $collectionMock = $this->createMock(\Magento\Catalog\Model\ResourceModel\Product\Collection::class); - $selectMock = $this->createMock(\Magento\Framework\DB\Select::class); + $collectionMock = $this->createMock(Collection::class); + $selectMock = $this->createMock(Select::class); $collectionMock->expects($this->once())->method('getSelect')->willReturn($selectMock); $selectMock->expects($this->any())->method('join')->willReturnSelf(); $this->attributeMock->expects($this->any())->method('getAttributeCode')->willReturn('code'); @@ -83,10 +95,10 @@ public function testAddToCollection() $this->attributeMock->expects($this->once())->method('isScopeGlobal')->willReturn(true); $this->attributeMock->expects($this->once())->method('getBackendType')->willReturn('multiselect'); - $entityMock = $this->createMock(\Magento\Eav\Model\Entity\AbstractEntity::class); + $entityMock = $this->createMock(AbstractEntity::class); $entityMock->expects($this->once())->method('getLinkField')->willReturn('entitiy_id'); $this->attributeMock->expects($this->once())->method('getEntity')->willReturn($entityMock); - $connection = $this->createMock(\Magento\Framework\DB\Adapter\AdapterInterface::class); + $connection = $this->createMock(AdapterInterface::class); $this->productResource->expects($this->atLeastOnce())->method('getConnection')->willReturn($connection); @@ -102,5 +114,7 @@ public function testGetMappedSqlFieldSku() { $this->model->setAttribute('sku'); $this->assertEquals('e.sku', $this->model->getMappedSqlField()); + $this->model->setAttribute('attribute_set_id'); + $this->assertEquals('e.attribute_set_id', $this->model->getMappedSqlField()); } } diff --git a/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php b/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php index e216e2ae658ba..2206dbef38640 100644 --- a/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php +++ b/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php @@ -625,6 +625,8 @@ public function getMappedSqlField() $mappedSqlField = $this->getEavAttributeTableAlias() . '.value'; } elseif ($this->getAttribute() == 'category_ids') { $mappedSqlField = 'e.entity_id'; + } elseif ($this->getAttribute() == 'attribute_set_id') { + $mappedSqlField = 'e.attribute_set_id'; } else { $mappedSqlField = parent::getMappedSqlField(); } diff --git a/app/code/Magento/Rule/Test/Unit/Model/Condition/Product/AbstractProductTest.php b/app/code/Magento/Rule/Test/Unit/Model/Condition/Product/AbstractProductTest.php index 80f07c9d6550d..62d91de3ca8e2 100644 --- a/app/code/Magento/Rule/Test/Unit/Model/Condition/Product/AbstractProductTest.php +++ b/app/code/Magento/Rule/Test/Unit/Model/Condition/Product/AbstractProductTest.php @@ -3,85 +3,103 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - namespace Magento\Rule\Test\Unit\Model\Condition\Product; -use ReflectionMethod; -use ReflectionProperty; +use Magento\Catalog\Model\ProductCategoryList; +use Magento\Catalog\Model\ResourceModel\Eav\Attribute; +use Magento\Catalog\Model\ResourceModel\Product; +use Magento\Eav\Model\Config; +use Magento\Eav\Model\Entity\Attribute\Source\AbstractSource; +use Magento\Eav\Model\Entity\Type; +use Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\Collection; +use Magento\Framework\DataObject; +use Magento\Framework\Model\AbstractModel; +use Magento\Rule\Model\Condition\Product\AbstractProduct; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; -class AbstractProductTest extends \PHPUnit\Framework\TestCase +/** + * Class to test Abstract Rule product condition data model + */ +class AbstractProductTest extends TestCase { /** * Tested condition * - * @var \Magento\Rule\Model\Condition\Product\AbstractProduct|\PHPUnit_Framework_MockObject_MockObject + * @var AbstractProduct|MockObject */ protected $_condition; /** * Framework object * - * @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject + * @var DataObject|MockObject */ protected $_object; /** - * Reflection for Magento\Rule\Model\Condition\Product\AbstractProduct::$_entityAttributeValues + * Reflection for AbstractProduct::$_entityAttributeValues * * @var \ReflectionProperty */ protected $_entityAttributeValuesProperty; /** - * Reflection for Magento\Rule\Model\Condition\Product\AbstractProduct::$_config + * Reflection for AbstractProduct::$_config * * @var \ReflectionProperty */ protected $_configProperty; /** - * Reflection for Magento\Rule\Model\Condition\Product\AbstractProduct::$productCategoryListProperty + * Reflection for AbstractProduct::$productCategoryListProperty * * @var \ReflectionProperty */ private $productCategoryListProperty; + /** + * @inheritdoc + */ protected function setUp() { $this->_condition = $this->getMockForAbstractClass( - \Magento\Rule\Model\Condition\Product\AbstractProduct::class, + AbstractProduct::class, [], '', false ); $this->productCategoryListProperty = new \ReflectionProperty( - \Magento\Rule\Model\Condition\Product\AbstractProduct::class, + AbstractProduct::class, 'productCategoryList' ); $this->productCategoryListProperty->setAccessible(true); $this->_entityAttributeValuesProperty = new \ReflectionProperty( - \Magento\Rule\Model\Condition\Product\AbstractProduct::class, + AbstractProduct::class, '_entityAttributeValues' ); $this->_entityAttributeValuesProperty->setAccessible(true); $this->_configProperty = new \ReflectionProperty( - \Magento\Rule\Model\Condition\Product\AbstractProduct::class, + AbstractProduct::class, '_config' ); $this->_configProperty->setAccessible(true); } + /** + * Test to validate equal category id condition + */ public function testValidateAttributeEqualCategoryId() { - $product = $this->createPartialMock(\Magento\Framework\Model\AbstractModel::class, ["getAttribute"]); + $product = $this->createPartialMock(AbstractModel::class, ["getAttribute"]); $this->_condition->setAttribute('category_ids'); $this->_condition->setValueParsed('1'); $this->_condition->setOperator('{}'); - $productCategoryList = $this->getMockBuilder(\Magento\Catalog\Model\ProductCategoryList::class) + $productCategoryList = $this->getMockBuilder(ProductCategoryList::class) ->disableOriginalConstructor() ->getMock(); $productCategoryList->method('getCategoryIds')->willReturn([1, 2]); @@ -91,7 +109,7 @@ public function testValidateAttributeEqualCategoryId() ); $this->_configProperty->setValue( $this->_condition, - $this->getMockBuilder(\Magento\Eav\Model\Config::class) + $this->getMockBuilder(Config::class) ->disableOriginalConstructor() ->getMock() ); @@ -99,10 +117,13 @@ public function testValidateAttributeEqualCategoryId() $this->assertTrue($this->_condition->validate($product)); } + /** + * Test to validate empty attribute condition + */ public function testValidateEmptyEntityAttributeValues() { $product = $this->createPartialMock( - \Magento\Framework\Model\AbstractModel::class, + AbstractModel::class, ["getAttribute", 'getResource'] ); $product->expects($this->once()) @@ -110,7 +131,7 @@ public function testValidateEmptyEntityAttributeValues() ->willReturn(null); $product->setId(1); $configProperty = new \ReflectionProperty( - \Magento\Rule\Model\Condition\Product\AbstractProduct::class, + AbstractProduct::class, '_entityAttributeValues' ); $configProperty->setAccessible(true); @@ -118,10 +139,13 @@ public function testValidateEmptyEntityAttributeValues() $this->assertFalse($this->_condition->validate($product)); } + /** + * Test to validate empty attribute value condition + */ public function testValidateEmptyEntityAttributeValuesWithResource() { $product = $this->createPartialMock( - \Magento\Framework\Model\AbstractModel::class, + AbstractModel::class, ["getAttribute", 'getResource'] ); $product->setId(1); @@ -132,18 +156,18 @@ public function testValidateEmptyEntityAttributeValuesWithResource() $this->_configProperty->setValue( $this->_condition, - $this->createMock(\Magento\Eav\Model\Config::class) + $this->createMock(Config::class) ); - $attribute = new \Magento\Framework\DataObject(); + $attribute = new DataObject(); $attribute->setBackendType('datetime'); - $newResource = $this->createPartialMock(\Magento\Catalog\Model\ResourceModel\Product::class, ['getAttribute']); + $newResource = $this->createPartialMock(Product::class, ['getAttribute']); $newResource->expects($this->any()) ->method('getAttribute') ->with('someAttribute') ->will($this->returnValue($attribute)); - $newResource->_config = $this->createMock(\Magento\Eav\Model\Config::class); + $newResource->_config = $this->createMock(Config::class); $product->expects($this->atLeastOnce()) ->method('getResource') ->willReturn($newResource); @@ -154,22 +178,25 @@ public function testValidateEmptyEntityAttributeValuesWithResource() $attribute->setBackendType('null'); $attribute->setFrontendInput('multiselect'); - $newResource = $this->createPartialMock(\Magento\Catalog\Model\ResourceModel\Product::class, ['getAttribute']); + $newResource = $this->createPartialMock(Product::class, ['getAttribute']); $newResource->expects($this->any()) ->method('getAttribute') ->with('someAttribute') ->will($this->returnValue($attribute)); - $newResource->_config = $this->createMock(\Magento\Eav\Model\Config::class); + $newResource->_config = $this->createMock(Config::class); $product->setResource($newResource); $this->assertFalse($this->_condition->validate($product)); } + /** + * Test to validate set entity attribute value with resource condition + */ public function testValidateSetEntityAttributeValuesWithResource() { $this->_condition->setAttribute('someAttribute'); $product = $this->createPartialMock( - \Magento\Framework\Model\AbstractModel::class, + AbstractModel::class, ['getAttribute', 'getResource'] ); $product->setAtribute('attribute'); @@ -177,22 +204,22 @@ public function testValidateSetEntityAttributeValuesWithResource() $this->_configProperty->setValue( $this->_condition, - $this->createMock(\Magento\Eav\Model\Config::class) + $this->createMock(Config::class) ); $this->_entityAttributeValuesProperty->setValue( $this->_condition, - $this->createMock(\Magento\Eav\Model\Config::class) + $this->createMock(Config::class) ); - $attribute = new \Magento\Framework\DataObject(); + $attribute = new DataObject(); $attribute->setBackendType('datetime'); - $newResource = $this->createPartialMock(\Magento\Catalog\Model\ResourceModel\Product::class, ['getAttribute']); + $newResource = $this->createPartialMock(Product::class, ['getAttribute']); $newResource->expects($this->any()) ->method('getAttribute') ->with('someAttribute') ->will($this->returnValue($attribute)); - $newResource->_config = $this->createMock(\Magento\Eav\Model\Config::class); + $newResource->_config = $this->createMock(Config::class); $product->expects($this->atLeastOnce()) ->method('getResource') @@ -209,10 +236,13 @@ public function testValidateSetEntityAttributeValuesWithResource() $this->assertFalse($this->_condition->validate($product)); } + /** + * Test to validate set entity attribute value without resource condition + */ public function testValidateSetEntityAttributeValuesWithoutResource() { $product = $this->createPartialMock( - \Magento\Framework\Model\AbstractModel::class, + AbstractModel::class, ['someMethod', 'getResource', 'load'] ); $this->_condition->setAttribute('someAttribute'); @@ -221,23 +251,23 @@ public function testValidateSetEntityAttributeValuesWithoutResource() $this->_configProperty->setValue( $this->_condition, - $this->createMock(\Magento\Eav\Model\Config::class) + $this->createMock(Config::class) ); $this->_entityAttributeValuesProperty->setValue( $this->_condition, - $this->createMock(\Magento\Eav\Model\Config::class) + $this->createMock(Config::class) ); - $attribute = new \Magento\Framework\DataObject(); + $attribute = new DataObject(); $attribute->setBackendType('multiselect'); - $newResource = $this->createPartialMock(\Magento\Catalog\Model\ResourceModel\Product::class, ['getAttribute']); + $newResource = $this->createPartialMock(Product::class, ['getAttribute']); $newResource->expects($this->any()) ->method('getAttribute') ->with('someAttribute') ->will($this->returnValue($attribute)); - $newResource->_config = $this->createMock(\Magento\Eav\Model\Config::class); + $newResource->_config = $this->createMock(Config::class); $product->expects($this->atLeastOnce()) ->method('getResource') @@ -254,16 +284,16 @@ public function testValidateSetEntityAttributeValuesWithoutResource() $this->assertFalse($this->_condition->validate($product)); - $attribute = new \Magento\Framework\DataObject(); + $attribute = new DataObject(); $attribute->setBackendType(null); $attribute->setFrontendInput('multiselect'); - $newResource = $this->createPartialMock(\Magento\Catalog\Model\ResourceModel\Product::class, ['getAttribute']); + $newResource = $this->createPartialMock(Product::class, ['getAttribute']); $newResource->expects($this->any()) ->method('getAttribute') ->with('someAttribute') ->will($this->returnValue($attribute)); - $newResource->_config = $this->createMock(\Magento\Eav\Model\Config::class); + $newResource->_config = $this->createMock(Config::class); $product->setResource($newResource); $product->setId(1); @@ -272,19 +302,29 @@ public function testValidateSetEntityAttributeValuesWithoutResource() $this->assertFalse($this->_condition->validate($product)); } + /** + * Test to get tables to join + */ public function testGetjointTables() { $this->_condition->setAttribute('category_ids'); $this->assertEquals([], $this->_condition->getTablesToJoin()); } + /** + * Test to get mapped sql field + */ public function testGetMappedSqlField() { $this->_condition->setAttribute('category_ids'); $this->assertEquals('e.entity_id', $this->_condition->getMappedSqlField()); + $this->_condition->setAttribute('attribute_set_id'); + $this->assertEquals('e.attribute_set_id', $this->_condition->getMappedSqlField()); } /** + * Test to prepare value options + * * @param array $setData * @param string $attributeObjectFrontendInput * @param array $attrObjectSourceAllOptionsValue @@ -308,7 +348,7 @@ public function testPrepareValueOptions( $this->_condition->setData($key, $value); } - $attrObjectSourceMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\Attribute\Source\AbstractSource::class) + $attrObjectSourceMock = $this->getMockBuilder(AbstractSource::class) ->setMethods(['getAllOptions']) ->disableOriginalConstructor() ->getMock(); @@ -318,7 +358,7 @@ public function testPrepareValueOptions( ->with($expectedAttrObjSourceAllOptionsParam) ->willReturn($attrObjectSourceAllOptionsValue); - $attributeObjectMock = $this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class) + $attributeObjectMock = $this->getMockBuilder(Attribute::class) ->setMethods(['usesSource', 'getFrontendInput', 'getSource', 'getAllOptions']) ->disableOriginalConstructor() ->getMock(); @@ -329,28 +369,28 @@ public function testPrepareValueOptions( ->willReturn($attributeObjectFrontendInput); $attributeObjectMock->method('getSource')->willReturn($attrObjectSourceMock); - $entityTypeMock = $this->getMockBuilder(\Magento\Framework\Model\AbstractModel\Type::class) + $entityTypeMock = $this->getMockBuilder(Type::class) ->setMethods(['getId']) ->disableOriginalConstructor() ->getMock(); $entityTypeMock->method('getId')->willReturn('SomeEntityType'); $configValueMock = $this->createPartialMock( - \Magento\Eav\Model\Config::class, + Config::class, ['getAttribute', 'getEntityType'] ); $configValueMock->method('getAttribute')->willReturn($attributeObjectMock); $configValueMock->method('getEntityType')->willReturn($entityTypeMock); - $configProperty = new ReflectionProperty( - \Magento\Rule\Model\Condition\Product\AbstractProduct::class, + $configProperty = new \ReflectionProperty( + AbstractProduct::class, '_config' ); $configProperty->setAccessible(true); $configProperty->setValue($this->_condition, $configValueMock); $attrSetCollectionValueMock = $this - ->getMockBuilder(\Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\Collection::class) + ->getMockBuilder(Collection::class) ->setMethods(['setEntityTypeFilter', 'load', 'toOptionArray']) ->disableOriginalConstructor() ->getMock(); @@ -362,15 +402,15 @@ public function testPrepareValueOptions( ->method('toOptionArray') ->willReturn($attrSetCollectionOptionsArray); - $attrSetCollectionProperty = new ReflectionProperty( - \Magento\Rule\Model\Condition\Product\AbstractProduct::class, + $attrSetCollectionProperty = new \ReflectionProperty( + AbstractProduct::class, '_attrSetCollection' ); $attrSetCollectionProperty->setAccessible(true); $attrSetCollectionProperty->setValue($this->_condition, $attrSetCollectionValueMock); - $testedMethod = new ReflectionMethod( - \Magento\Rule\Model\Condition\Product\AbstractProduct::class, + $testedMethod = new \ReflectionMethod( + AbstractProduct::class, '_prepareValueOptions' ); $testedMethod->setAccessible(true); @@ -395,7 +435,6 @@ public function prepareValueOptionsDataProvider() 'value_option' => ['k' => 'v'], ], null, null, null, null, ['key' => 'value'], ['k' => 'v'], ], - [ ['attribute' => 'attribute_set_id'], null, @@ -414,7 +453,6 @@ public function prepareValueOptionsDataProvider() 'value2' => 'Label for value 2' ] ], - [ [ 'value_select_options' => [ @@ -436,7 +474,6 @@ public function prepareValueOptionsDataProvider() 'value4' => 'Label for value 4' ] ], - [ [ 'value_select_options' => [ @@ -458,7 +495,6 @@ public function prepareValueOptionsDataProvider() 'value6' => 'Label for value 6' ] ], - [ [], 'multiselect', @@ -477,7 +513,6 @@ public function prepareValueOptionsDataProvider() 'value8' => 'Label for value 8', ], ], - [ [], 'multiselect', @@ -495,7 +530,6 @@ public function prepareValueOptionsDataProvider() 'valueA' => 'Label for value A', ], ], - [ [], 'select', From fc6c7f1aeadf83e7e6083e387b4a82c8a1cacbea Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Tue, 14 Jan 2020 10:23:47 +0200 Subject: [PATCH 0807/1143] MC-29917: [OnPrem] Issue with Catalog Price rules - active in DB but not applying on frontend --- .../Model/ResourceModel/Indexer/State.php | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/app/code/Magento/Indexer/Model/ResourceModel/Indexer/State.php b/app/code/Magento/Indexer/Model/ResourceModel/Indexer/State.php index d1e27be21ae41..d0ab887b2e335 100644 --- a/app/code/Magento/Indexer/Model/ResourceModel/Indexer/State.php +++ b/app/code/Magento/Indexer/Model/ResourceModel/Indexer/State.php @@ -5,6 +5,11 @@ */ namespace Magento\Indexer\Model\ResourceModel\Indexer; +use Magento\Framework\Indexer\StateInterface; + +/** + * Resource model for indexer state + */ class State extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb { /** @@ -17,4 +22,22 @@ protected function _construct() $this->_init('indexer_state', 'state_id'); $this->addUniqueField(['field' => ['indexer_id'], 'title' => __('State for the same indexer')]); } + + /** + * @inheritDoc + */ + protected function prepareDataForUpdate($object) + { + $data = parent::prepareDataForUpdate($object); + + if (isset($data['status']) && StateInterface::STATUS_VALID === $data['status']) { + $data['status'] = $this->getConnection()->getCheckSql( + $this->getConnection()->quoteInto('status = ?', StateInterface::STATUS_WORKING), + $this->getConnection()->quote($data['status']), + 'status' + ); + } + + return $data; + } } From d3bce59975c9e14a55f578f7e76f0b520e9f10cc Mon Sep 17 00:00:00 2001 From: "rostyslav.hymon" <rostyslav.hymon@transoftgroup.com> Date: Tue, 14 Jan 2020 10:48:49 +0200 Subject: [PATCH 0808/1143] MC-30000: Default shipping address not being honoured --- .../Magento/Quote/Model/Quote/Address.php | 234 +++++++++++------- .../Quote/Model/ResourceModel/Quote.php | 5 + ...thTwoAddressesTaxableAndNonTaxableTest.xml | 4 + .../Magento/Quote/Model/Quote/AddressTest.php | 130 ++++++---- 4 files changed, 234 insertions(+), 139 deletions(-) diff --git a/app/code/Magento/Quote/Model/Quote/Address.php b/app/code/Magento/Quote/Model/Quote/Address.php index db8ac0d1fe179..39148f990b714 100644 --- a/app/code/Magento/Quote/Model/Quote/Address.php +++ b/app/code/Magento/Quote/Model/Quote/Address.php @@ -6,10 +6,42 @@ namespace Magento\Quote\Model\Quote; use Magento\Customer\Api\AddressMetadataInterface; +use Magento\Customer\Api\Data\AddressInterface; use Magento\Customer\Api\Data\AddressInterfaceFactory; use Magento\Customer\Api\Data\RegionInterfaceFactory; +use Magento\Customer\Model\Address\AbstractAddress; +use Magento\Customer\Model\Address\Mapper; +use Magento\Directory\Helper\Data; +use Magento\Directory\Model\CountryFactory; +use Magento\Directory\Model\RegionFactory; +use Magento\Framework\Api\AttributeValueFactory; +use Magento\Framework\Api\DataObjectHelper; +use Magento\Framework\Api\ExtensionAttributesFactory; +use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\App\ObjectManager; +use Magento\Framework\Data\Collection\AbstractDb; +use Magento\Framework\DataObject\Copy; +use Magento\Framework\Model\Context; +use Magento\Framework\Model\ResourceModel\AbstractResource; +use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection; +use Magento\Framework\Registry; use Magento\Framework\Serialize\Serializer\Json; +use Magento\Quote\Api\Data\AddressExtensionInterface; +use Magento\Quote\Model\Quote; +use Magento\Quote\Model\Quote\Address\Rate; +use Magento\Quote\Model\Quote\Address\RateCollectorInterfaceFactory; +use Magento\Quote\Model\Quote\Address\RateFactory; +use Magento\Quote\Model\Quote\Address\RateRequest; +use Magento\Quote\Model\Quote\Address\RateRequestFactory; +use Magento\Quote\Model\Quote\Address\Total; +use Magento\Quote\Model\Quote\Address\Total\Collector; +use Magento\Quote\Model\Quote\Address\Total\CollectorFactory; +use Magento\Quote\Model\Quote\Address\TotalFactory; +use Magento\Quote\Model\Quote\Item\AbstractItem; +use Magento\Quote\Model\ResourceModel\Quote\Address\Rate\CollectionFactory; +use Magento\Shipping\Model\CarrierFactoryInterface; +use Magento\Store\Api\Data\StoreInterface; +use Magento\Store\Model\ScopeInterface; use Magento\Store\Model\StoreManagerInterface; /** @@ -22,8 +54,8 @@ * @method Address setCreatedAt(string $value) * @method string getUpdatedAt() * @method Address setUpdatedAt(string $value) - * @method \Magento\Customer\Api\Data\AddressInterface getCustomerAddress() - * @method Address setCustomerAddressData(\Magento\Customer\Api\Data\AddressInterface $value) + * @method AddressInterface getCustomerAddress() + * @method Address setCustomerAddressData(AddressInterface $value) * @method string getAddressType() * @method Address setAddressType(string $value) * @method int getFreeShipping() @@ -90,14 +122,14 @@ * @method int[] getAppliedRuleIds() * @method Address setBaseShippingInclTax(float $value) * - * @property $_objectCopyService \Magento\Framework\DataObject\Copy + * @property $objectCopyService \Magento\Framework\DataObject\Copy * @SuppressWarnings(PHPMD.ExcessivePublicCount) * @SuppressWarnings(PHPMD.TooManyFields) * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @since 100.0.2 */ -class Address extends \Magento\Customer\Model\Address\AbstractAddress implements +class Address extends AbstractAddress implements \Magento\Quote\Api\Data\AddressInterface { const RATES_FETCH = 1; @@ -125,28 +157,28 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress implements /** * Quote object * - * @var \Magento\Quote\Model\Quote + * @var Quote */ protected $_items; /** * Quote object * - * @var \Magento\Quote\Model\Quote + * @var Quote */ protected $_quote; /** * Sales Quote address rates * - * @var \Magento\Quote\Model\Quote\Address\Rate + * @var Rate */ protected $_rates; /** * Total models collector * - * @var \Magento\Quote\Model\Quote\Address\Total\Collector + * @var Collector */ protected $_totalCollector; @@ -170,7 +202,7 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress implements /** * Core store config * - * @var \Magento\Framework\App\Config\ScopeConfigInterface + * @var ScopeConfigInterface */ protected $_scopeConfig; @@ -185,33 +217,33 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress implements protected $_itemCollectionFactory; /** - * @var \Magento\Quote\Model\Quote\Address\RateCollectorInterfaceFactory + * @var RateCollectorInterfaceFactory */ protected $_rateCollector; /** - * @var \Magento\Quote\Model\ResourceModel\Quote\Address\Rate\CollectionFactory + * @var CollectionFactory */ protected $_rateCollectionFactory; /** - * @var \Magento\Quote\Model\Quote\Address\Total\CollectorFactory + * @var CollectorFactory */ protected $_totalCollectorFactory; /** - * @var \Magento\Quote\Model\Quote\Address\TotalFactory + * @var TotalFactory */ protected $_addressTotalFactory; /** - * @var \Magento\Quote\Model\Quote\Address\RateFactory + * @var RateFactory * @since 100.2.0 */ protected $_addressRateFactory; /** - * @var \Magento\Customer\Api\Data\AddressInterfaceFactory + * @var AddressInterfaceFactory */ protected $addressDataFactory; @@ -221,7 +253,7 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress implements protected $validator; /** - * @var \Magento\Customer\Model\Address\Mapper + * @var Mapper */ protected $addressMapper; @@ -241,7 +273,7 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress implements protected $totalsCollector; /** - * @var \Magento\Quote\Model\Quote\TotalsReader + * @var TotalsReader */ protected $totalsReader; @@ -256,37 +288,47 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress implements private $storeManager; /** - * @param \Magento\Framework\Model\Context $context - * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory - * @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory - * @param \Magento\Directory\Helper\Data $directoryData + * @var Copy + */ + private $objectCopyService; + + /** + * @var /Magento\Shipping\Model\CarrierFactoryInterface + */ + private $carrierFactory; + + /** + * @param Context $context + * @param Registry $registry + * @param ExtensionAttributesFactory $extensionFactory + * @param AttributeValueFactory $customAttributeFactory + * @param Data $directoryData * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Customer\Model\Address\Config $addressConfig - * @param \Magento\Directory\Model\RegionFactory $regionFactory - * @param \Magento\Directory\Model\CountryFactory $countryFactory + * @param RegionFactory $regionFactory + * @param CountryFactory $countryFactory * @param AddressMetadataInterface $metadataService * @param AddressInterfaceFactory $addressDataFactory * @param RegionInterfaceFactory $regionDataFactory - * @param \Magento\Framework\Api\DataObjectHelper $dataObjectHelper - * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig + * @param DataObjectHelper $dataObjectHelper + * @param ScopeConfigInterface $scopeConfig * @param Address\ItemFactory $addressItemFactory * @param \Magento\Quote\Model\ResourceModel\Quote\Address\Item\CollectionFactory $itemCollectionFactory - * @param \Magento\Quote\Model\Quote\Address\RateFactory $addressRateFactory + * @param RateFactory $addressRateFactory * @param Address\RateCollectorInterfaceFactory $rateCollector - * @param \Magento\Quote\Model\ResourceModel\Quote\Address\Rate\CollectionFactory $rateCollectionFactory + * @param CollectionFactory $rateCollectionFactory * @param Address\RateRequestFactory $rateRequestFactory * @param Address\Total\CollectorFactory $totalCollectorFactory * @param Address\TotalFactory $addressTotalFactory - * @param \Magento\Framework\DataObject\Copy $objectCopyService - * @param \Magento\Shipping\Model\CarrierFactoryInterface $carrierFactory + * @param Copy $objectCopyService + * @param CarrierFactoryInterface $carrierFactory * @param Address\Validator $validator - * @param \Magento\Customer\Model\Address\Mapper $addressMapper + * @param Mapper $addressMapper * @param Address\CustomAttributeListInterface $attributeList * @param TotalsCollector $totalsCollector - * @param \Magento\Quote\Model\Quote\TotalsReader $totalsReader - * @param \Magento\Framework\Model\ResourceModel\AbstractResource|null $resource - * @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection + * @param TotalsReader $totalsReader + * @param AbstractResource|null $resource + * @param AbstractDb|null $resourceCollection * @param array $data * @param Json $serializer * @param StoreManagerInterface $storeManager @@ -294,37 +336,37 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress implements * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Framework\Model\Context $context, - \Magento\Framework\Registry $registry, - \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, - \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory, - \Magento\Directory\Helper\Data $directoryData, + Context $context, + Registry $registry, + ExtensionAttributesFactory $extensionFactory, + AttributeValueFactory $customAttributeFactory, + Data $directoryData, \Magento\Eav\Model\Config $eavConfig, \Magento\Customer\Model\Address\Config $addressConfig, - \Magento\Directory\Model\RegionFactory $regionFactory, - \Magento\Directory\Model\CountryFactory $countryFactory, + RegionFactory $regionFactory, + CountryFactory $countryFactory, AddressMetadataInterface $metadataService, AddressInterfaceFactory $addressDataFactory, RegionInterfaceFactory $regionDataFactory, - \Magento\Framework\Api\DataObjectHelper $dataObjectHelper, - \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, + DataObjectHelper $dataObjectHelper, + ScopeConfigInterface $scopeConfig, \Magento\Quote\Model\Quote\Address\ItemFactory $addressItemFactory, \Magento\Quote\Model\ResourceModel\Quote\Address\Item\CollectionFactory $itemCollectionFactory, - \Magento\Quote\Model\Quote\Address\RateFactory $addressRateFactory, - \Magento\Quote\Model\Quote\Address\RateCollectorInterfaceFactory $rateCollector, - \Magento\Quote\Model\ResourceModel\Quote\Address\Rate\CollectionFactory $rateCollectionFactory, - \Magento\Quote\Model\Quote\Address\RateRequestFactory $rateRequestFactory, - \Magento\Quote\Model\Quote\Address\Total\CollectorFactory $totalCollectorFactory, - \Magento\Quote\Model\Quote\Address\TotalFactory $addressTotalFactory, - \Magento\Framework\DataObject\Copy $objectCopyService, - \Magento\Shipping\Model\CarrierFactoryInterface $carrierFactory, + RateFactory $addressRateFactory, + RateCollectorInterfaceFactory $rateCollector, + CollectionFactory $rateCollectionFactory, + RateRequestFactory $rateRequestFactory, + CollectorFactory $totalCollectorFactory, + TotalFactory $addressTotalFactory, + Copy $objectCopyService, + CarrierFactoryInterface $carrierFactory, Address\Validator $validator, - \Magento\Customer\Model\Address\Mapper $addressMapper, + Mapper $addressMapper, Address\CustomAttributeListInterface $attributeList, - \Magento\Quote\Model\Quote\TotalsCollector $totalsCollector, - \Magento\Quote\Model\Quote\TotalsReader $totalsReader, - \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, - \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, + TotalsCollector $totalsCollector, + TotalsReader $totalsReader, + AbstractResource $resource = null, + AbstractDb $resourceCollection = null, array $data = [], Json $serializer = null, StoreManagerInterface $storeManager = null @@ -338,8 +380,8 @@ public function __construct( $this->_rateRequestFactory = $rateRequestFactory; $this->_totalCollectorFactory = $totalCollectorFactory; $this->_addressTotalFactory = $addressTotalFactory; - $this->_objectCopyService = $objectCopyService; - $this->_carrierFactory = $carrierFactory; + $this->objectCopyService = $objectCopyService; + $this->carrierFactory = $carrierFactory; $this->addressDataFactory = $addressDataFactory; $this->validator = $validator; $this->addressMapper = $addressMapper; @@ -412,7 +454,7 @@ protected function _populateBeforeSaveData() $this->setCustomerAddressId($this->getCustomerAddressData()->getId()); } - if (!$this->getId()) { + if (!$this->getId() || $this->getQuote()->dataHasChangedFor('customer_id')) { $this->setSameAsBilling((int)$this->_isSameAsBilling()); } } @@ -427,7 +469,7 @@ protected function _isSameAsBilling() { $quoteSameAsBilling = $this->getSameAsBilling(); - return $this->getAddressType() == \Magento\Quote\Model\Quote\Address::TYPE_SHIPPING && + return $this->getAddressType() == Address::TYPE_SHIPPING && ($this->_isNotRegisteredCustomer() || $this->_isDefaultShippingNullOrSameAsBillingAddress()) && ($quoteSameAsBilling || $quoteSameAsBilling === 0 || $quoteSameAsBilling === null); } @@ -473,10 +515,10 @@ protected function _isDefaultShippingNullOrSameAsBillingAddress() /** * Declare address quote model object * - * @param \Magento\Quote\Model\Quote $quote + * @param Quote $quote * @return $this */ - public function setQuote(\Magento\Quote\Model\Quote $quote) + public function setQuote(Quote $quote) { $this->_quote = $quote; $this->setQuoteId($quote->getId()); @@ -486,7 +528,7 @@ public function setQuote(\Magento\Quote\Model\Quote $quote) /** * Retrieve quote object * - * @return \Magento\Quote\Model\Quote + * @return Quote */ public function getQuote() { @@ -496,12 +538,12 @@ public function getQuote() /** * Import quote address data from customer address Data Object. * - * @param \Magento\Customer\Api\Data\AddressInterface $address + * @param AddressInterface $address * @return $this */ - public function importCustomerAddressData(\Magento\Customer\Api\Data\AddressInterface $address) + public function importCustomerAddressData(AddressInterface $address) { - $this->_objectCopyService->copyFieldsetToTarget( + $this->objectCopyService->copyFieldsetToTarget( 'customer_address', 'to_quote_address', $this->addressMapper->toFlatArray($address), @@ -519,11 +561,11 @@ public function importCustomerAddressData(\Magento\Customer\Api\Data\AddressInte /** * Export data to customer address Data Object. * - * @return \Magento\Customer\Api\Data\AddressInterface + * @return AddressInterface */ public function exportCustomerAddress() { - $customerAddressData = $this->_objectCopyService->getDataFromFieldset( + $customerAddressData = $this->objectCopyService->getDataFromFieldset( 'sales_convert_quote_address', 'to_customer_address', $this @@ -542,7 +584,7 @@ public function exportCustomerAddress() $this->dataObjectHelper->populateWithArray( $addressDataObject, $customerAddressData, - \Magento\Customer\Api\Data\AddressInterface::class + AddressInterface::class ); return $addressDataObject; } @@ -568,7 +610,7 @@ public function toArray(array $arrAttributes = []) /** * Retrieve address items collection * - * @return \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection + * @return AbstractCollection */ public function getItemsCollection() { @@ -765,13 +807,13 @@ public function removeItem($itemId) /** * Add item to address * - * @param \Magento\Quote\Model\Quote\Item\AbstractItem $item + * @param AbstractItem $item * @param int $qty * @return $this */ - public function addItem(\Magento\Quote\Model\Quote\Item\AbstractItem $item, $qty = null) + public function addItem(AbstractItem $item, $qty = null) { - if ($item instanceof \Magento\Quote\Model\Quote\Item) { + if ($item instanceof Item) { if ($item->getParentItemId()) { return $this; } @@ -808,7 +850,7 @@ public function addItem(\Magento\Quote\Model\Quote\Item\AbstractItem $item, $qty /** * Retrieve collection of quote shipping rates * - * @return \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection + * @return AbstractCollection */ public function getShippingRatesCollection() { @@ -849,13 +891,13 @@ public function getGroupedAllShippingRates() { $rates = []; foreach ($this->getShippingRatesCollection() as $rate) { - if (!$rate->isDeleted() && $this->_carrierFactory->get($rate->getCarrier())) { + if (!$rate->isDeleted() && $this->carrierFactory->get($rate->getCarrier())) { if (!isset($rates[$rate->getCarrier()])) { $rates[$rate->getCarrier()] = []; } $rates[$rate->getCarrier()][] = $rate; - $rates[$rate->getCarrier()][0]->carrier_sort_order = $this->_carrierFactory->get( + $rates[$rate->getCarrier()][0]->carrier_sort_order = $this->carrierFactory->get( $rate->getCarrier() )->getSortOrder(); } @@ -881,7 +923,7 @@ protected function _sortRates($firstItem, $secondItem) * Retrieve shipping rate by identifier * * @param int $rateId - * @return \Magento\Quote\Model\Quote\Address\Rate|false + * @return Rate|false */ public function getShippingRateById($rateId) { @@ -898,7 +940,7 @@ public function getShippingRateById($rateId) * Retrieve shipping rate by code * * @param string $code - * @return \Magento\Quote\Model\Quote\Address\Rate|false + * @return Rate|false */ public function getShippingRateByCode($code) { @@ -927,10 +969,10 @@ public function removeAllShippingRates() /** * Add shipping rate * - * @param \Magento\Quote\Model\Quote\Address\Rate $rate + * @param Rate $rate * @return $this */ - public function addShippingRate(\Magento\Quote\Model\Quote\Address\Rate $rate) + public function addShippingRate(Rate $rate) { $rate->setAddress($this); $this->getShippingRatesCollection()->addItem($rate); @@ -970,14 +1012,14 @@ public function collectShippingRates() * * Returns true if current selected shipping method code corresponds to one of the found rates * - * @param \Magento\Quote\Model\Quote\Item\AbstractItem $item + * @param AbstractItem $item * @return bool * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ - public function requestShippingRates(\Magento\Quote\Model\Quote\Item\AbstractItem $item = null) + public function requestShippingRates(AbstractItem $item = null) { - /** @var $request \Magento\Quote\Model\Quote\Address\RateRequest */ + /** @var $request RateRequest */ $request = $this->_rateRequestFactory->create(); $request->setAllItems($item ? [$item] : $this->getAllItems()); $request->setDestCountryId($this->getCountryId()); @@ -1041,7 +1083,7 @@ public function requestShippingRates(\Magento\Quote\Model\Quote\Item\AbstractIte $item->setBaseShippingAmount($rate->getPrice()); } else { - /** @var \Magento\Store\Api\Data\StoreInterface */ + /** @var StoreInterface */ $store = $this->storeManager->getStore(); $amountPrice = $store->getBaseCurrency() ->convert($rate->getPrice(), $store->getCurrentCurrencyCode()); @@ -1078,17 +1120,17 @@ public function getTotals() /** * Add total data or model * - * @param \Magento\Quote\Model\Quote\Address\Total|array $total + * @param Total|array $total * @return $this */ public function addTotal($total) { $addressTotal = null; if (is_array($total)) { - /** @var \Magento\Quote\Model\Quote\Address\Total $addressTotal */ - $addressTotal = $this->_addressTotalFactory->create(\Magento\Quote\Model\Quote\Address\Total::class); + /** @var Total $addressTotal */ + $addressTotal = $this->_addressTotalFactory->create(Total::class); $addressTotal->setData($total); - } elseif ($total instanceof \Magento\Quote\Model\Quote\Address\Total) { + } elseif ($total instanceof Total) { $addressTotal = $total; } @@ -1104,7 +1146,7 @@ public function addTotal($total) /** * Rewrite clone method * - * @return \Magento\Quote\Model\Quote\Address + * @return Address */ public function __clone() { @@ -1141,7 +1183,7 @@ public function validateMinimumAmount() $storeId = $this->getQuote()->getStoreId(); $validateEnabled = $this->_scopeConfig->isSetFlag( 'sales/minimum_order/active', - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $storeId ); if (!$validateEnabled) { @@ -1154,17 +1196,17 @@ public function validateMinimumAmount() $includeDiscount = $this->_scopeConfig->getValue( 'sales/minimum_order/include_discount_amount', - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $storeId ); $amount = $this->_scopeConfig->getValue( 'sales/minimum_order/amount', - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $storeId ); $taxInclude = $this->_scopeConfig->getValue( 'sales/minimum_order/tax_including', - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $storeId ); @@ -1701,7 +1743,7 @@ public function setSaveInAddressBook($saveInAddressBook) /** * @inheritdoc * - * @return \Magento\Quote\Api\Data\AddressExtensionInterface|null + * @return AddressExtensionInterface|null */ public function getExtensionAttributes() { @@ -1711,10 +1753,10 @@ public function getExtensionAttributes() /** * @inheritdoc * - * @param \Magento\Quote\Api\Data\AddressExtensionInterface $extensionAttributes + * @param AddressExtensionInterface $extensionAttributes * @return $this */ - public function setExtensionAttributes(\Magento\Quote\Api\Data\AddressExtensionInterface $extensionAttributes) + public function setExtensionAttributes(AddressExtensionInterface $extensionAttributes) { return $this->_setExtensionAttributes($extensionAttributes); } diff --git a/app/code/Magento/Quote/Model/ResourceModel/Quote.php b/app/code/Magento/Quote/Model/ResourceModel/Quote.php index ae26407c74522..48945dacd1738 100644 --- a/app/code/Magento/Quote/Model/ResourceModel/Quote.php +++ b/app/code/Magento/Quote/Model/ResourceModel/Quote.php @@ -102,6 +102,7 @@ public function loadByCustomerId($quote, $customerId) if ($data) { $quote->setData($data); + $quote->setOrigData(); } $this->_afterLoad($quote); @@ -124,6 +125,7 @@ public function loadActive($quote, $quoteId) $data = $connection->fetchRow($select); if ($data) { $quote->setData($data); + $quote->setOrigData(); } $this->_afterLoad($quote); @@ -148,6 +150,7 @@ public function loadByIdWithoutStore($quote, $quoteId) if ($data) { $quote->setData($data); + $quote->setOrigData(); } } @@ -303,5 +306,7 @@ public function save(\Magento\Framework\Model\AbstractModel $object) if (!$object->isPreventSaving()) { return parent::save($object); } + + return $this; } } diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderForCustomerWithTwoAddressesTaxableAndNonTaxableTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderForCustomerWithTwoAddressesTaxableAndNonTaxableTest.xml index 1c35a9e900a8a..8177bbaa6e1d7 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderForCustomerWithTwoAddressesTaxableAndNonTaxableTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderForCustomerWithTwoAddressesTaxableAndNonTaxableTest.xml @@ -45,6 +45,10 @@ </actionGroup> <!--Step 2: Select taxable address as billing address--> <selectOption selector="{{AdminOrderFormBillingAddressSection.selectAddress}}" userInput="{{US_Address_CA.state}}" stepKey="selectTaxableAddress" /> + <waitForPageLoad stepKey="waitForChangeBillingAddress"/> + <!--Step 3: Set shipping address same as billing --> + <checkOption selector="{{AdminOrderFormShippingAddressSection.SameAsBilling}}" stepKey="checkSameAsBillingAddressCheckbox"/> + <waitForPageLoad stepKey="waitForChangeShippingAddress"/> <!--Step 3: Select FlatRate shipping method--> <actionGroup ref="OrderSelectFlatRateShippingActionGroup" stepKey="selectFlatRateShippingMethod"/> <!--Step 4: Verify that tax is applied to the order--> diff --git a/dev/tests/integration/testsuite/Magento/Quote/Model/Quote/AddressTest.php b/dev/tests/integration/testsuite/Magento/Quote/Model/Quote/AddressTest.php index 545638bcb0c57..dcd36d4078f8c 100644 --- a/dev/tests/integration/testsuite/Magento/Quote/Model/Quote/AddressTest.php +++ b/dev/tests/integration/testsuite/Magento/Quote/Model/Quote/AddressTest.php @@ -5,30 +5,41 @@ */ namespace Magento\Quote\Model\Quote; +use Magento\Customer\Api\AddressRepositoryInterface; +use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Customer\Api\Data\AddressInterface; +use Magento\Customer\Api\Data\AddressInterfaceFactory; +use Magento\Customer\Api\Data\CustomerInterface; +use Magento\Customer\Model\CustomerRegistry; +use Magento\Framework\Reflection\DataObjectProcessor; +use Magento\Quote\Model\Quote; use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\Indexer\TestCase; /** + * Class to test Sales Quote address model functionality + * * @magentoDataFixture Magento/Sales/_files/quote_with_customer.php * @magentoDataFixture Magento/Customer/_files/customer_two_addresses.php */ -class AddressTest extends \Magento\TestFramework\Indexer\TestCase +class AddressTest extends TestCase { - /** @var \Magento\Quote\Model\Quote $quote */ + /** @var Quote $quote */ protected $_quote; - /** @var \Magento\Customer\Api\Data\CustomerInterface $customer */ + /** @var CustomerInterface $customer */ protected $_customer; - /** @var \Magento\Quote\Model\Quote\Address */ + /** @var Address */ protected $_address; - /**@var \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository */ + /**@var CustomerRepositoryInterface $customerRepository */ protected $customerRepository; - /** @var \Magento\Customer\Api\AddressRepositoryInterface $addressRepository */ + /** @var AddressRepositoryInterface $addressRepository */ protected $addressRepository; - /** @var \Magento\Framework\Reflection\DataObjectProcessor */ + /** @var DataObjectProcessor */ protected $dataProcessor; /** @@ -36,7 +47,7 @@ class AddressTest extends \Magento\TestFramework\Indexer\TestCase */ public static function setUpBeforeClass() { - $db = \Magento\TestFramework\Helper\Bootstrap::getInstance()->getBootstrap() + $db = Bootstrap::getInstance()->getBootstrap() ->getApplication() ->getDbInstance(); if (!$db->isDbDumpExists()) { @@ -48,43 +59,46 @@ public static function setUpBeforeClass() } /** - * Initialize quote and customer fixtures + * @inheritdoc */ public function setUp() { - $this->_quote = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - \Magento\Quote\Model\Quote::class + $this->_quote = Bootstrap::getObjectManager()->create( + Quote::class ); $this->_quote->load('test01', 'reserved_order_id'); $this->_quote->setIsMultiShipping('0'); - $this->customerRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - \Magento\Customer\Api\CustomerRepositoryInterface::class + $this->customerRepository = Bootstrap::getObjectManager()->create( + CustomerRepositoryInterface::class ); $this->_customer = $this->customerRepository->getById(1); /** @var \Magento\Sales\Model\Order\Address $address */ - $this->_address = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - \Magento\Quote\Model\Quote\Address::class + $this->_address = Bootstrap::getObjectManager()->create( + Address::class ); $this->_address->setId(1); $this->_address->load($this->_address->getId()); $this->_address->setQuote($this->_quote); - $this->addressRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - \Magento\Customer\Api\AddressRepositoryInterface::class + $this->addressRepository = Bootstrap::getObjectManager()->create( + AddressRepositoryInterface::class ); - $this->dataProcessor = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - \Magento\Framework\Reflection\DataObjectProcessor::class + $this->dataProcessor = Bootstrap::getObjectManager()->create( + DataObjectProcessor::class ); } + /** + * @inheritdoc + */ protected function tearDown() { - /** @var \Magento\Customer\Model\CustomerRegistry $customerRegistry */ - $customerRegistry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get(\Magento\Customer\Model\CustomerRegistry::class); + /** @var CustomerRegistry $customerRegistry */ + $customerRegistry = Bootstrap::getObjectManager() + ->get(CustomerRegistry::class); //Cleanup customer from registry $customerRegistry->remove(1); } @@ -102,9 +116,9 @@ public function testSameAsBillingForBillingAddress($unsetId) if ($unsetId) { $address->setId(null); } - /** @var \Magento\Customer\Api\AddressRepositoryInterface $addressRepository */ + /** @var AddressRepositoryInterface $addressRepository */ $addressRepository = Bootstrap::getObjectManager() - ->create(\Magento\Customer\Api\AddressRepositoryInterface::class); + ->create(AddressRepositoryInterface::class); $customerAddressData = $addressRepository->getById($this->_customer->getDefaultBilling()); $address->setSameAsBilling(0)->setCustomerAddressData($customerAddressData)->save(); $this->assertEquals(0, $this->_quote->getBillingAddress()->getSameAsBilling()); @@ -155,9 +169,9 @@ public function testSameAsBillingWhenQuoteAddressHasNoCustomerAddress($unsetId) */ public function testSameAsBillingWhenCustomerHasNoDefaultShippingAddress($unsetId) { - /** @var \Magento\Customer\Api\AddressRepositoryInterface $addressRepository */ + /** @var AddressRepositoryInterface $addressRepository */ $addressRepository = Bootstrap::getObjectManager() - ->create(\Magento\Customer\Api\AddressRepositoryInterface::class); + ->create(AddressRepositoryInterface::class); $this->_customer->setDefaultShipping(-1) ->setAddresses( [ @@ -194,9 +208,9 @@ public function testSameAsBillingWhenCustomerHasBillingSameShipping($unsetId) */ public function testSameAsBillingWhenCustomerHasDefaultShippingAddress() { - /** @var \Magento\Customer\Api\AddressRepositoryInterface $addressRepository */ + /** @var AddressRepositoryInterface $addressRepository */ $addressRepository = Bootstrap::getObjectManager() - ->create(\Magento\Customer\Api\AddressRepositoryInterface::class); + ->create(AddressRepositoryInterface::class); $this->_customer->setDefaultShipping(2) ->setAddresses([$addressRepository->getById($this->_address->getId())]); $this->_customer = $this->customerRepository->save($this->_customer); @@ -218,19 +232,39 @@ protected function _setCustomerAddressAndSave($unsetId) if ($unsetId) { $shippingAddress->setId(null); } - /** @var \Magento\Customer\Api\AddressRepositoryInterface $addressRepository */ + /** @var AddressRepositoryInterface $addressRepository */ $addressRepository = Bootstrap::getObjectManager() - ->create(\Magento\Customer\Api\AddressRepositoryInterface::class); + ->create(AddressRepositoryInterface::class); $shippingAddress->setSameAsBilling(0) ->setCustomerAddressData($addressRepository->getById($this->_customer->getDefaultBilling())) ->save(); } + /** + * @return array + */ public function unsetAddressIdDataProvider() { return [[true], [false]]; } + /** + * Test to get same as billing flag after change quote customer + */ + public function testSameAsBillingAfterCustomerWesChanged() + { + $shippingAddressId = 2; + $this->_quote->setCustomer($this->_customer); + /** Make different default shipping and default billing addresses */ + $this->_customer->setDefaultShipping($shippingAddressId); + $this->_quote->getShippingAddress()->setCustomerAddressId($shippingAddressId); + /** Emulate to change customer */ + $this->_quote->setOrigData('customer_id', null); + $shippingAddress = $this->_quote->getShippingAddress(); + $shippingAddress->beforeSave(); + $this->assertEquals(false, $this->_quote->getShippingAddress()->getSameAsBilling()); + } + /** * Import customer address to quote address */ @@ -241,13 +275,13 @@ public function testImportCustomerAddressDataWithCustomer() $city = 'TestCity'; $street = 'Street1'; - /** @var \Magento\Customer\Api\Data\AddressInterfaceFactory $addressFactory */ + /** @var AddressInterfaceFactory $addressFactory */ $addressFactory = Bootstrap::getObjectManager()->create( - \Magento\Customer\Api\Data\AddressInterfaceFactory::class + AddressInterfaceFactory::class ); - /** @var \Magento\Customer\Api\AddressRepositoryInterface $addressRepository */ + /** @var AddressRepositoryInterface $addressRepository */ $addressRepository = Bootstrap::getObjectManager()->create( - \Magento\Customer\Api\AddressRepositoryInterface::class + AddressRepositoryInterface::class ); $addressData = $addressFactory->create() ->setCustomerId($customerIdFromFixture) @@ -284,6 +318,9 @@ public function testExportCustomerAddressData() $this->assertEquals($company, $customerAddress->getCompany(), 'Company was exported incorrectly.'); } + /** + * Test to Set the required fields + */ public function testPopulateBeforeSaveData() { /** Preconditions */ @@ -303,9 +340,9 @@ public function testPopulateBeforeSaveData() "Precondition failed: Customer address ID was not set." ); - /** @var \Magento\Customer\Api\Data\AddressInterfaceFactory $addressFactory */ + /** @var AddressInterfaceFactory $addressFactory */ $addressFactory = Bootstrap::getObjectManager()->create( - \Magento\Customer\Api\Data\AddressInterfaceFactory::class + AddressInterfaceFactory::class ); $customerAddressData = $addressFactory->create()->setId($customerAddressId); $this->_address->setCustomerAddressData($customerAddressData); @@ -317,22 +354,26 @@ public function testPopulateBeforeSaveData() } /** - * Tests + * Test to retrieve applied taxes * - * @covers \Magento\Quote\Model\Quote\Address::setAppliedTaxes() - * @covers \Magento\Quote\Model\Quote\Address::getAppliedTaxes() - * @dataProvider dataProvider * @param $taxes * @param $expected + * @covers \Magento\Quote\Model\Quote\Address::setAppliedTaxes() + * @covers \Magento\Quote\Model\Quote\Address::getAppliedTaxes() + * @dataProvider appliedTaxesDataProvider */ public function testAppliedTaxes($taxes, $expected) { $this->_address->setAppliedTaxes($taxes); - $this->assertSame($expected, $this->_address->getAppliedTaxes()); } - public function dataProvider() + /** + * Retrieve applied taxes data provider + * + * @return array + */ + public function appliedTaxesDataProvider() { return [ ['test', 'test'], @@ -340,6 +381,9 @@ public function dataProvider() ]; } + /** + * Test to sate shipping address without region + */ public function testSaveShippingAddressWithEmptyRegionId() { $customerAddress = $this->addressRepository->getById(1); @@ -347,7 +391,7 @@ public function testSaveShippingAddressWithEmptyRegionId() $address = $this->dataProcessor->buildOutputDataArray( $customerAddress, - \Magento\Customer\Api\Data\AddressInterface::class + AddressInterface::class ); $shippingAddress = $this->_quote->getShippingAddress(); From f036061cba35e67dc7834803bd9b327df312fd1b Mon Sep 17 00:00:00 2001 From: "rostyslav.hymon" <rostyslav.hymon@transoftgroup.com> Date: Tue, 14 Jan 2020 11:30:59 +0200 Subject: [PATCH 0809/1143] MC-30294: [Magento Cloud] - Colour Swatches do not appear - JS Error Triggers --- app/code/Magento/Swatches/view/adminhtml/web/js/text.js | 3 ++- app/code/Magento/Swatches/view/adminhtml/web/js/visual.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Swatches/view/adminhtml/web/js/text.js b/app/code/Magento/Swatches/view/adminhtml/web/js/text.js index 2bb1672d9e8c8..48a14c14bdf3a 100644 --- a/app/code/Magento/Swatches/view/adminhtml/web/js/text.js +++ b/app/code/Magento/Swatches/view/adminhtml/web/js/text.js @@ -13,7 +13,8 @@ define([ 'mage/template', 'uiRegistry', 'jquery/ui', - 'prototype' + 'prototype', + 'validation' ], function (jQuery, mageTemplate, rg) { 'use strict'; diff --git a/app/code/Magento/Swatches/view/adminhtml/web/js/visual.js b/app/code/Magento/Swatches/view/adminhtml/web/js/visual.js index b91fea59229cd..19307432c4122 100644 --- a/app/code/Magento/Swatches/view/adminhtml/web/js/visual.js +++ b/app/code/Magento/Swatches/view/adminhtml/web/js/visual.js @@ -14,7 +14,8 @@ define([ 'uiRegistry', 'jquery/colorpicker/js/colorpicker', 'prototype', - 'jquery/ui' + 'jquery/ui', + 'validation' ], function (jQuery, mageTemplate, rg) { 'use strict'; From 54270993b4dd2301113144441a27adb6ac80309b Mon Sep 17 00:00:00 2001 From: Chris Pook <chris.pook@absolutecommerce.co.uk> Date: Tue, 14 Jan 2020 09:51:37 +0000 Subject: [PATCH 0810/1143] 26375 Remove PrototypeJS dependency causing address issue This may need additional refactoring if PrototypeJS is being used (this is not currently clear) --- .../view/frontend/web/js/view/payment/method-renderer/cc-form.js | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/cc-form.js b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/cc-form.js index 5f06d26e2acfc..afe22475981ec 100644 --- a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/cc-form.js +++ b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/cc-form.js @@ -18,7 +18,6 @@ define( 'Magento_Vault/js/view/payment/vault-enabler', 'Magento_Braintree/js/view/payment/kount', 'mage/translate', - 'prototype', 'domReady!' ], function ( From 07ac4c8936e3910d37566ef406d796986b3ac9c0 Mon Sep 17 00:00:00 2001 From: "rostyslav.hymon" <rostyslav.hymon@transoftgroup.com> Date: Tue, 14 Jan 2020 12:01:55 +0200 Subject: [PATCH 0811/1143] MC-30201: ES6.0+ Display all products on page --- .../Test/StoreFrontProductsDisplayUsingElasticSearchTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StoreFrontProductsDisplayUsingElasticSearchTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StoreFrontProductsDisplayUsingElasticSearchTest.xml index c444a567bf7c5..3c1bcb3b352cd 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/StoreFrontProductsDisplayUsingElasticSearchTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/StoreFrontProductsDisplayUsingElasticSearchTest.xml @@ -168,7 +168,7 @@ <!--Revert ElasticSearch as search engine.--> - <actionGroup ref="ResetSearchEngineConfiguration" stepKey="resetCatalogSearchConfiguration"/> + <actionGroup ref="ResetSearchEngineConfigurationActionGroup" stepKey="resetCatalogSearchConfiguration"/> <magentoCLI command="indexer:reindex" stepKey="performReindexAfterElasticSearchDisable"/> <magentoCLI command="cache:flush" stepKey="cleanCacheAfterElasticSearchDisable"/> <actionGroup ref="logout" stepKey="logout"/> From 5e9f1b35e666b5adec383d289c8e2a27a30fb190 Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Tue, 14 Jan 2020 12:30:28 +0200 Subject: [PATCH 0812/1143] MC-29023: Custom attribute values cannot be saved in Admin panel --- .../Catalog/Test/Mftf/Test/AdminCreateDuplicateProductTest.xml | 3 +++ .../Mftf/Test/AdminUrlRewritesForProductAfterImportTest.xml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDuplicateProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDuplicateProductTest.xml index 4507e1f880a86..b74efe18af708 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDuplicateProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDuplicateProductTest.xml @@ -15,6 +15,9 @@ <testCaseId value="MC-14714"/> <severity value="CRITICAL"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-30409"/> + </skip> </annotations> <before> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUrlRewritesForProductAfterImportTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUrlRewritesForProductAfterImportTest.xml index a3d3b897ef75d..88c28230b8347 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUrlRewritesForProductAfterImportTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUrlRewritesForProductAfterImportTest.xml @@ -16,6 +16,9 @@ <severity value="MAJOR"/> <testCaseId value="MC-20229"/> <group value="urlRewrite"/> + <skip> + <issueId value="MC-30409"/> + </skip> </annotations> <before> <comment userInput="Set the configuration for Generate category/product URL Rewrites" stepKey="commentSetURLRewriteConfiguration" /> From 8abeb71c4312143f66e513fa07f1071e08c6c96b Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Tue, 14 Jan 2020 12:31:59 +0200 Subject: [PATCH 0813/1143] MC-30323: Customer Import - File passes data check then returns error 'Invalid data for insert' --- .../Model/Import/Customer.php | 22 ++++- .../ResourceModel/Import/Customer/Storage.php | 89 +++++++++++++++---- .../Model/Import/CustomerTest.php | 88 ++++++++++++++---- .../Import/_files/customers_to_update.csv | 4 + 4 files changed, 172 insertions(+), 31 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/_files/customers_to_update.csv diff --git a/app/code/Magento/CustomerImportExport/Model/Import/Customer.php b/app/code/Magento/CustomerImportExport/Model/Import/Customer.php index f86ebaea69730..5e5f309915d99 100644 --- a/app/code/Magento/CustomerImportExport/Model/Import/Customer.php +++ b/app/code/Magento/CustomerImportExport/Model/Import/Customer.php @@ -408,7 +408,7 @@ protected function _prepareDataForUpdate(array $rowData) $createdAt = (new \DateTime())->setTimestamp(strtotime($rowData['created_at'])); } - $emailInLowercase = strtolower($rowData[self::COLUMN_EMAIL]); + $emailInLowercase = strtolower(trim($rowData[self::COLUMN_EMAIL])); $newCustomer = false; $entityId = $this->_getCustomerId($emailInLowercase, $rowData[self::COLUMN_WEBSITE]); if (!$entityId) { @@ -478,6 +478,8 @@ protected function _prepareDataForUpdate(array $rowData) $entityRow['updated_at'] = $now->format(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT); if (!empty($rowData[self::COLUMN_STORE])) { $entityRow['store_id'] = $this->_storeCodeToId[$rowData[self::COLUMN_STORE]]; + } else { + $entityRow['store_id'] = $this->getCustomerStoreId($emailInLowercase, $rowData[self::COLUMN_WEBSITE]); } $entitiesToUpdate[] = $entityRow; } @@ -666,4 +668,22 @@ public function getValidColumnNames() ) ); } + + /** + * Get customer store ID by email and website ID. + * + * @param string $email + * @param string $websiteCode + * @return bool|int + */ + private function getCustomerStoreId(string $email, string $websiteCode) + { + $websiteId = (int) $this->getWebsiteId($websiteCode); + $storeId = $this->getCustomerStorage()->getCustomerStoreId($email, $websiteId); + if ($storeId === null || $storeId === false) { + $defaultStore = $this->_storeManager->getWebsite($websiteId)->getDefaultStore(); + $storeId = $defaultStore ? $defaultStore->getId() : \Magento\Store\Model\Store::DEFAULT_STORE_ID; + } + return $storeId; + } } diff --git a/app/code/Magento/CustomerImportExport/Model/ResourceModel/Import/Customer/Storage.php b/app/code/Magento/CustomerImportExport/Model/ResourceModel/Import/Customer/Storage.php index 43623019c005e..7cff2dcc21b1e 100644 --- a/app/code/Magento/CustomerImportExport/Model/ResourceModel/Import/Customer/Storage.php +++ b/app/code/Magento/CustomerImportExport/Model/ResourceModel/Import/Customer/Storage.php @@ -5,13 +5,12 @@ */ namespace Magento\CustomerImportExport\Model\ResourceModel\Import\Customer; -use Magento\CustomerImportExport\Test\Unit\Model\Import\CustomerCompositeTest; +use Magento\Customer\Model\ResourceModel\Customer\Collection as CustomerCollection; +use Magento\Customer\Model\ResourceModel\Customer\CollectionFactory as CustomerCollectionFactory; use Magento\Framework\DataObject; use Magento\Framework\DB\Select; -use Magento\Customer\Model\ResourceModel\Customer\CollectionFactory as CustomerCollectionFactory; -use Magento\Customer\Model\ResourceModel\Customer\Collection as CustomerCollection; -use Magento\ImportExport\Model\ResourceModel\CollectionByPagesIteratorFactory; use Magento\ImportExport\Model\ResourceModel\CollectionByPagesIterator; +use Magento\ImportExport\Model\ResourceModel\CollectionByPagesIteratorFactory; /** * Storage to check existing customers. @@ -56,6 +55,20 @@ class Storage */ public $_customerCollection; + /** + * Existing customers store IDs. In form of: + * + * [customer email] => array( + * [website id 1] => store id 1, + * [website id 2] => store id 2, + * ... => ... , + * [website id n] => store id n, + * ) + * + * @var array + */ + private $customerStoreIds = []; + /** * @param CustomerCollectionFactory $collectionFactory * @param CollectionByPagesIteratorFactory $colIteratorFactory @@ -91,7 +104,7 @@ private function prepareCollection(array $customerIdentifiers): CustomerCollecti $select = $collection->getSelect(); $customerTableId = array_keys($select->getPart(Select::FROM))[0]; $select->where( - $customerTableId .'.email in (?)', + $customerTableId . '.email in (?)', array_map( function (array $customer) { return $customer['email']; @@ -127,11 +140,15 @@ private function loadCustomersData(array $customerIdentifiers) */ public function addCustomerByArray(array $customer): Storage { - $email = strtolower(trim($customer['email'])); + $email = mb_strtolower(trim($customer['email'])); if (!isset($this->_customerIds[$email])) { $this->_customerIds[$email] = []; } + if (!isset($this->customerStoreIds[$email])) { + $this->customerStoreIds[$email] = []; + } $this->_customerIds[$email][$customer['website_id']] = $customer['entity_id']; + $this->customerStoreIds[$email][$customer['website_id']] = $customer['store_id'] ?? null; return $this; } @@ -164,11 +181,7 @@ public function addCustomer(DataObject $customer): Storage public function getCustomerId(string $email, int $websiteId) { $email = mb_strtolower($email); - //Trying to load the customer. - if (!array_key_exists($email, $this->_customerIds) || !array_key_exists($websiteId, $this->_customerIds[$email]) - ) { - $this->loadCustomersData([['email' => $email, 'website_id' => $websiteId]]); - } + $this->loadCustomerData($email, $websiteId); if (isset($this->_customerIds[$email][$websiteId])) { return $this->_customerIds[$email][$websiteId]; @@ -177,6 +190,25 @@ public function getCustomerId(string $email, int $websiteId) return false; } + /** + * Find customer store ID for unique pair of email and website ID. + * + * @param string $email + * @param int $websiteId + * @return bool|int + */ + public function getCustomerStoreId(string $email, int $websiteId) + { + $email = mb_strtolower($email); + $this->loadCustomerData($email, $websiteId); + + if (isset($this->customerStoreIds[$email][$websiteId])) { + return $this->customerStoreIds[$email][$websiteId]; + } + + return false; + } + /** * Pre-load customers for future checks. * @@ -189,12 +221,10 @@ public function prepareCustomers(array $customersToFind): void foreach ($customersToFind as $customerToFind) { $email = mb_strtolower($customerToFind['email']); $websiteId = $customerToFind['website_id']; - if (!array_key_exists($email, $this->_customerIds) - || !array_key_exists($websiteId, $this->_customerIds[$email]) - ) { + if (!$this->isLoadedCustomerData($email, $websiteId)) { //Only looking for customers we don't already have ID for. //We need unique identifiers. - $uniqueKey = $email .'_' .$websiteId; + $uniqueKey = $email . '_' . $websiteId; $identifiers[$uniqueKey] = [ 'email' => $email, 'website_id' => $websiteId, @@ -202,8 +232,10 @@ public function prepareCustomers(array $customersToFind): void //Recording that we've searched for a customer. if (!array_key_exists($email, $this->_customerIds)) { $this->_customerIds[$email] = []; + $this->customerStoreIds[$email] = []; } $this->_customerIds[$email][$websiteId] = null; + $this->customerStoreIds[$email][$websiteId] = null; } } if (!$identifiers) { @@ -213,4 +245,31 @@ public function prepareCustomers(array $customersToFind): void //Loading customers data. $this->loadCustomersData($identifiers); } + + /** + * Load customer data if it's not loaded. + * + * @param string $email + * @param int $websiteId + * @return void + */ + private function loadCustomerData(string $email, int $websiteId): void + { + if (!$this->isLoadedCustomerData($email, $websiteId)) { + $this->loadCustomersData([['email' => $email, 'website_id' => $websiteId]]); + } + } + + /** + * Check if customer data is loaded + * + * @param string $email + * @param int $websiteId + * @return bool + */ + private function isLoadedCustomerData(string $email, int $websiteId): bool + { + return array_key_exists($email, $this->_customerIds) + && array_key_exists($websiteId, $this->_customerIds[$email]); + } } diff --git a/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/CustomerTest.php b/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/CustomerTest.php index 77ceae27e0774..7b5ddc4b9fa5f 100644 --- a/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/CustomerTest.php +++ b/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/CustomerTest.php @@ -6,11 +6,17 @@ namespace Magento\CustomerImportExport\Model\Import; +use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Customer\Api\Data\CustomerInterface; use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\Exception\NoSuchEntityException; use Magento\ImportExport\Model\Import; /** * Test for class \Magento\CustomerImportExport\Model\Import\Customer which covers validation logic + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * @SuppressWarnings(PHPMD.TooManyPublicMethods) */ class CustomerTest extends \PHPUnit\Framework\TestCase { @@ -82,6 +88,8 @@ public function testImportData() $this->directoryWrite ); + $existingCustomer = $this->getCustomer('CharlesTAlston@teleworm.us', 1); + /** @var $customersCollection \Magento\Customer\Model\ResourceModel\Customer\Collection */ $customersCollection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( \Magento\Customer\Model\ResourceModel\Customer\Collection::class @@ -107,13 +115,6 @@ public function testImportData() $this->assertEquals($expectAddedCustomers, $addedCustomers, 'Added unexpected amount of customers'); - /** @var $objectManager \Magento\TestFramework\ObjectManager */ - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - - $existingCustomer = $objectManager->get( - \Magento\Framework\Registry::class - )->registry('_fixture/Magento_ImportExport_Customer'); - $updatedCustomer = $customers[$existingCustomer->getId()]; $this->assertNotEquals( @@ -154,6 +155,12 @@ public function testImportDataWithOneAdditionalColumn(): void $this->directoryWrite ); + $existingCustomer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + \Magento\Customer\Model\Customer::class + ); + $existingCustomer->setWebsiteId(1); + $existingCustomer = $existingCustomer->loadByEmail('CharlesTAlston@teleworm.us'); + /** @var $customersCollection \Magento\Customer\Model\ResourceModel\Customer\Collection */ $customersCollection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( \Magento\Customer\Model\ResourceModel\Customer\Collection::class @@ -171,12 +178,6 @@ public function testImportDataWithOneAdditionalColumn(): void $customers = $customersCollection->getItems(); - /** @var $objectManager \Magento\TestFramework\ObjectManager */ - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - - $existingCustomer = $objectManager->get(\Magento\Framework\Registry::class) - ->registry('_fixture/Magento_ImportExport_Customer'); - $updatedCustomer = $customers[$existingCustomer->getId()]; $this->assertNotEquals( @@ -210,8 +211,8 @@ public function testImportDataWithOneAdditionalColumn(): void ); $this->assertEquals( - $existingCustomer->getCustomerGroupId(), - $updatedCustomer->getCustomerGroupId(), + $existingCustomer->getGroupId(), + $updatedCustomer->getGroupId(), 'Customer group must not be changed' ); } @@ -352,4 +353,61 @@ public function testValidateEmailForDeleteBehavior() $this->_model->getErrorAggregator()->getErrorsByCode([Customer::ERROR_CUSTOMER_NOT_FOUND]) ); } + + /** + * Test import existing customers + * + * @magentoDataFixture Magento/Customer/_files/import_export/customers.php + * @return void + */ + public function testUpdateExistingCustomers(): void + { + $this->doImport(__DIR__ . '/_files/customers_to_update.csv', Import::BEHAVIOR_ADD_UPDATE); + $customer = $this->getCustomer('customer@example.com', 1); + $this->assertEquals('Firstname-updated', $customer->getFirstname()); + $this->assertEquals('Lastname-updated', $customer->getLastname()); + $this->assertEquals(1, $customer->getStoreId()); + $customer = $this->getCustomer('julie.worrell@example.com', 1); + $this->assertEquals('Julie-updated', $customer->getFirstname()); + $this->assertEquals('Worrell-updated', $customer->getLastname()); + $this->assertEquals(1, $customer->getStoreId()); + $customer = $this->getCustomer('david.lamar@example.com', 1); + $this->assertEquals('David-updated', $customer->getFirstname()); + $this->assertEquals('Lamar-updated', $customer->getLastname()); + $this->assertEquals(1, $customer->getStoreId()); + } + + /** + * Gets customer entity. + * + * @param string $email + * @param int $websiteId + * @return CustomerInterface + * @throws NoSuchEntityException + * @throws \Magento\Framework\Exception\LocalizedException + */ + private function getCustomer(string $email, int $websiteId): CustomerInterface + { + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + /** @var CustomerRepositoryInterface $repository */ + $repository = $objectManager->get(CustomerRepositoryInterface::class); + return $repository->get($email, $websiteId); + } + + /** + * Import using given file and behavior + * + * @param string $file + * @param string $behavior + */ + private function doImport(string $file, string $behavior): void + { + $source = new \Magento\ImportExport\Model\Import\Source\Csv($file, $this->directoryWrite); + $this->_model + ->setParameters(['behavior' => $behavior]) + ->setSource($source) + ->validateData() + ->hasToBeTerminated(); + $this->_model->importData(); + } } diff --git a/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/_files/customers_to_update.csv b/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/_files/customers_to_update.csv new file mode 100644 index 0000000000000..b6d8e24860ed3 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/_files/customers_to_update.csv @@ -0,0 +1,4 @@ +email,_website,_store,confirmation,created_at,created_in,default_billing,default_shipping,disable_auto_group_change,dob,firstname,gender,group_id,lastname,middlename,password_hash,prefix,rp_token,rp_token_created_at,store_id,suffix,taxvat,website_id,password +customer@example.com,base,"default",,5/6/2012 16:15,Admin,"1","1",0,,"Firstname-updated",Male,1,"Lastname-updated",T.,145d12bfff8a6a279eb61e277e3d727c0ba95acc1131237f1594ddbb7687a564:l1,,,,0,,,"1", +julie.worrell@example.com,base,"",,5/6/2012 16:19,Admin,"1","1",0,,"Julie-updated",Female,1,"Worrell-updated",T.,145d12bfff8a6a279eb61e277e3d727c0ba95acc1131237f1594ddbb7687a564:l1,,,,0,,,"1", +david.lamar@example.com,base,"",,5/6/2012 16:25,Admin,"1","1",0,,"David-updated",Male,1,"Lamar-updated",T.,145d12bfff8a6a279eb61e277e3d727c0ba95acc1131237f1594ddbb7687a564:l1,,,,0,,,"1", From daec86e617f04a317a7f00113c38e3d13f80fa37 Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Tue, 14 Jan 2020 12:39:00 +0200 Subject: [PATCH 0814/1143] MC-30409: [FT] [MFTF] [2.4] Fix flaky test AdminCreateDuplicateProductTest (MC-14714) --- .../Catalog/Test/Mftf/Test/AdminCreateDuplicateProductTest.xml | 1 + .../Mftf/Test/AdminUrlRewritesForProductAfterImportTest.xml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDuplicateProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDuplicateProductTest.xml index 4507e1f880a86..3eb617d19d54c 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDuplicateProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDuplicateProductTest.xml @@ -22,6 +22,7 @@ <createData entity="Two_nested_categories" stepKey="subCategory"> <requiredEntity createDataKey="category"/> </createData> + <magentoCLI command="config:set catalog/seo/generate_category_product_rewrites 1" stepKey="enableGenerateUrlRewrite"/> <actionGroup ref="LoginAsAdmin" stepKey="login"/> </before> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUrlRewritesForProductAfterImportTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUrlRewritesForProductAfterImportTest.xml index a3d3b897ef75d..9fcca06df5c69 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUrlRewritesForProductAfterImportTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUrlRewritesForProductAfterImportTest.xml @@ -42,7 +42,7 @@ <deleteData createDataKey="simpleSubCategory2" stepKey="deleteSimpleSubCategory2"/> <deleteData createDataKey="simpleSubCategory1" stepKey="deleteSimpleSubCategory1"/> <comment userInput="Disable config to generate category/product URL Rewrites " stepKey="commentDisableConfig" /> - <magentoCLI command="config:set catalog/seo/generate_category_product_rewrites 0" stepKey="disableGenerateUrlRewrite"/> + <magentoCLI command="config:set catalog/seo/generate_category_product_rewrites 1" stepKey="disableGenerateUrlRewrite"/> <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> </after> From bf580e444c1da52f09bdde5932e914800a7a4721 Mon Sep 17 00:00:00 2001 From: akartavtsev <akartavcev@magecom.net> Date: Tue, 14 Jan 2020 13:01:37 +0200 Subject: [PATCH 0815/1143] #25300 Mobile view issue on category page - Sort By label overlaps with Shop By button --- .../web/css/source/module/_toolbar.less | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 b587c169f67eb..9d30f787a7431 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 @@ -243,3 +243,13 @@ } } } + +// +// Mobile +// _____________________________________________ + +.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__xs) { + .sorter-options { + margin: 0 2px; + } +} From 36791998025e1b8bc29404e9763054a715ebe62d Mon Sep 17 00:00:00 2001 From: Viktor Sevch <svitja@ukr.net> Date: Tue, 14 Jan 2020 15:05:43 +0200 Subject: [PATCH 0816/1143] MC-25254: [ElasticSearch] New product attribute requires full search reindex to be searchable on Storefront --- .../Model/Client/Elasticsearch.php | 4 +- .../Model/Client/Elasticsearch.php | 4 +- .../Model/Client/ElasticsearchTest.php | 8 +- .../Model/Client/Elasticsearch.php | 4 +- .../Unit/Model/Client/ElasticsearchTest.php | 8 +- .../GraphQl/Catalog/ProductSearchTest.php | 124 +++++++++--------- 6 files changed, 76 insertions(+), 76 deletions(-) diff --git a/app/code/Magento/Elasticsearch/Elasticsearch5/Model/Client/Elasticsearch.php b/app/code/Magento/Elasticsearch/Elasticsearch5/Model/Client/Elasticsearch.php index b9102bc5e00c4..ddf79f413df37 100644 --- a/app/code/Magento/Elasticsearch/Elasticsearch5/Model/Client/Elasticsearch.php +++ b/app/code/Magento/Elasticsearch/Elasticsearch5/Model/Client/Elasticsearch.php @@ -285,7 +285,7 @@ public function addFieldsMapping(array $fields, $index, $entityType) 'match_mapping_type' => 'string', 'mapping' => [ 'type' => 'integer', - 'index' => false, + 'index' => true, ], ], ], @@ -296,7 +296,7 @@ public function addFieldsMapping(array $fields, $index, $entityType) 'mapping' => $this->prepareFieldInfo( [ 'type' => 'text', - 'index' => false, + 'index' => true, ] ), ], diff --git a/app/code/Magento/Elasticsearch/Model/Client/Elasticsearch.php b/app/code/Magento/Elasticsearch/Model/Client/Elasticsearch.php index d933d8bb5d0b5..d2b677a95c7c0 100644 --- a/app/code/Magento/Elasticsearch/Model/Client/Elasticsearch.php +++ b/app/code/Magento/Elasticsearch/Model/Client/Elasticsearch.php @@ -278,7 +278,7 @@ public function addFieldsMapping(array $fields, $index, $entityType) 'match_mapping' => 'string', 'mapping' => [ 'type' => 'integer', - 'index' => 'no' + 'index' => 'not_analyzed', ], ], ], @@ -288,7 +288,7 @@ public function addFieldsMapping(array $fields, $index, $entityType) 'match_mapping' => 'string', 'mapping' => [ 'type' => 'string', - 'index' => 'no' + 'index' => 'not_analyzed', ], ], ] diff --git a/app/code/Magento/Elasticsearch/Test/Unit/Elasticsearch5/Model/Client/ElasticsearchTest.php b/app/code/Magento/Elasticsearch/Test/Unit/Elasticsearch5/Model/Client/ElasticsearchTest.php index 99fd416b5cd3e..d5b873ccd7866 100644 --- a/app/code/Magento/Elasticsearch/Test/Unit/Elasticsearch5/Model/Client/ElasticsearchTest.php +++ b/app/code/Magento/Elasticsearch/Test/Unit/Elasticsearch5/Model/Client/ElasticsearchTest.php @@ -379,7 +379,7 @@ public function testAddFieldsMapping() 'match_mapping_type' => 'string', 'mapping' => [ 'type' => 'integer', - 'index' => false + 'index' => true ], ], ], @@ -389,7 +389,7 @@ public function testAddFieldsMapping() 'match_mapping_type' => 'string', 'mapping' => [ 'type' => 'text', - 'index' => false, + 'index' => true, ], ], ], @@ -449,7 +449,7 @@ public function testAddFieldsMappingFailure() 'match_mapping_type' => 'string', 'mapping' => [ 'type' => 'integer', - 'index' => false + 'index' => true, ], ], ], @@ -459,7 +459,7 @@ public function testAddFieldsMappingFailure() 'match_mapping_type' => 'string', 'mapping' => [ 'type' => 'text', - 'index' => false, + 'index' => true, ], ], ] diff --git a/app/code/Magento/Elasticsearch6/Model/Client/Elasticsearch.php b/app/code/Magento/Elasticsearch6/Model/Client/Elasticsearch.php index ff299be786aa8..2c1c283c5b24d 100644 --- a/app/code/Magento/Elasticsearch6/Model/Client/Elasticsearch.php +++ b/app/code/Magento/Elasticsearch6/Model/Client/Elasticsearch.php @@ -292,7 +292,7 @@ public function addFieldsMapping(array $fields, $index, $entityType) 'match_mapping_type' => 'string', 'mapping' => [ 'type' => 'integer', - 'index' => false, + 'index' => true, ], ], ], @@ -302,7 +302,7 @@ public function addFieldsMapping(array $fields, $index, $entityType) 'match_mapping_type' => 'string', 'mapping' => [ 'type' => 'text', - 'index' => false, + 'index' => true, 'copy_to' => '_search' ], ], diff --git a/app/code/Magento/Elasticsearch6/Test/Unit/Model/Client/ElasticsearchTest.php b/app/code/Magento/Elasticsearch6/Test/Unit/Model/Client/ElasticsearchTest.php index 607624d7b5e8e..3d840d5a808af 100644 --- a/app/code/Magento/Elasticsearch6/Test/Unit/Model/Client/ElasticsearchTest.php +++ b/app/code/Magento/Elasticsearch6/Test/Unit/Model/Client/ElasticsearchTest.php @@ -445,7 +445,7 @@ public function testAddFieldsMapping() 'match_mapping_type' => 'string', 'mapping' => [ 'type' => 'integer', - 'index' => false + 'index' => true, ], ], ], @@ -455,7 +455,7 @@ public function testAddFieldsMapping() 'match_mapping_type' => 'string', 'mapping' => [ 'type' => 'text', - 'index' => false, + 'index' => true, 'copy_to' => '_search' ], ], @@ -515,7 +515,7 @@ public function testAddFieldsMappingFailure() 'match_mapping_type' => 'string', 'mapping' => [ 'type' => 'integer', - 'index' => false + 'index' => true, ], ], ], @@ -525,7 +525,7 @@ public function testAddFieldsMappingFailure() 'match_mapping_type' => 'string', 'mapping' => [ 'type' => 'text', - 'index' => false, + 'index' => true, 'copy_to' => '_search' ], ], diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchTest.php index 9ee3b3baa5fc2..9ac5f6959d12e 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchTest.php @@ -42,7 +42,7 @@ public function testFilterForNonExistingCategory() { products(filter: {category_id: {eq: "99999999"}}) { filters { - name + name } } } @@ -204,7 +204,7 @@ private function getQueryProductsWithArrayOfCustomAttributes($attributeCode, $fi { return <<<QUERY { - products(filter:{ + products(filter:{ $attributeCode: {in:["{$firstOption}", "{$secondOption}"]} } pageSize: 3 @@ -212,7 +212,7 @@ private function getQueryProductsWithArrayOfCustomAttributes($attributeCode, $fi ) { total_count - items + items { name sku @@ -225,14 +225,14 @@ private function getQueryProductsWithArrayOfCustomAttributes($attributeCode, $fi filters{ name request_var - filter_items_count + filter_items_count filter_items{ label items_count value_string __typename } - } + } aggregations{ attribute_code count @@ -243,8 +243,8 @@ private function getQueryProductsWithArrayOfCustomAttributes($attributeCode, $fi count } } - - } + + } } QUERY; } @@ -262,16 +262,16 @@ public function testFilterProductsByDropDownCustomAttribute() $optionValue = $this->getDefaultAttributeOptionValue($attributeCode); $query = <<<QUERY { - products(filter:{ + products(filter:{ $attributeCode: {eq: "{$optionValue}"} } - + pageSize: 3 currentPage: 1 ) { total_count - items + items { name sku @@ -284,14 +284,14 @@ public function testFilterProductsByDropDownCustomAttribute() filters{ name request_var - filter_items_count + filter_items_count filter_items{ label items_count value_string __typename } - + } aggregations{ attribute_code @@ -304,8 +304,8 @@ public function testFilterProductsByDropDownCustomAttribute() value } } - - } + + } } QUERY; @@ -365,7 +365,7 @@ private function reIndexAndCleanCache() : void $appDir = dirname(Bootstrap::getInstance()->getAppTempDir()); $out = ''; // phpcs:ignore Magento2.Security.InsecureFunction - exec("php -f {$appDir}/bin/magento indexer:reindex", $out); + exec("php -f {$appDir}/bin/magento indexer:reindex catalog_category_product", $out); CacheCleaner::cleanAll(); } @@ -393,15 +393,15 @@ public function testFilterProductsByMultiSelectCustomAttributes() } $query = <<<QUERY { - products(filter:{ - $attributeCode: {in:["{$optionValues[0]}", "{$optionValues[1]}", "{$optionValues[2]}"]} + products(filter:{ + $attributeCode: {in:["{$optionValues[0]}", "{$optionValues[1]}", "{$optionValues[2]}"]} } pageSize: 3 currentPage: 1 ) { total_count - items + items { name sku @@ -414,14 +414,14 @@ public function testFilterProductsByMultiSelectCustomAttributes() filters{ name request_var - filter_items_count + filter_items_count filter_items{ label items_count value_string __typename } - } + } aggregations{ attribute_code count @@ -430,11 +430,11 @@ public function testFilterProductsByMultiSelectCustomAttributes() { label value - + } } - - } + + } } QUERY; @@ -485,7 +485,7 @@ public function testSearchAndFilterByCustomAttribute() ) { total_count - items + items { name sku @@ -498,15 +498,15 @@ public function testSearchAndFilterByCustomAttribute() filters{ name request_var - filter_items_count + filter_items_count filter_items{ label items_count value_string __typename } - - } + + } aggregations { attribute_code @@ -518,10 +518,10 @@ public function testSearchAndFilterByCustomAttribute() label value } - } - } - + + } + } QUERY; $response = $this->graphQlQuery($query); @@ -631,7 +631,7 @@ public function testFilterByCategoryIdAndCustomAttribute() ) { total_count - items + items { name sku @@ -644,7 +644,7 @@ public function testFilterByCategoryIdAndCustomAttribute() filters{ name request_var - filter_items_count + filter_items_count filter_items{ label items_count @@ -664,7 +664,7 @@ public function testFilterByCategoryIdAndCustomAttribute() value } } - } + } } QUERY; $response = $this->graphQlQuery($query); @@ -788,7 +788,7 @@ public function testFilterBySingleProductUrlKey() ) { total_count - items + items { name sku @@ -802,7 +802,7 @@ public function testFilterBySingleProductUrlKey() filters{ name request_var - filter_items_count + filter_items_count filter_items{ label items_count @@ -822,7 +822,7 @@ public function testFilterBySingleProductUrlKey() value } } - } + } } QUERY; $response = $this->graphQlQuery($query); @@ -851,17 +851,17 @@ public function testFilterBySingleProductUrlKey() ) { total_count - items + items { name sku url_key } - + filters{ name request_var - filter_items_count + filter_items_count } aggregations { @@ -875,7 +875,7 @@ public function testFilterBySingleProductUrlKey() value } } - } + } } QUERY; $response = $this->graphQlQuery($query2); @@ -914,7 +914,7 @@ public function testFilterByMultipleProductUrlKeys() ) { total_count - items + items { name sku @@ -923,12 +923,12 @@ public function testFilterByMultipleProductUrlKeys() page_info{ current_page page_size - + } filters{ name request_var - filter_items_count + filter_items_count } aggregations { @@ -942,7 +942,7 @@ public function testFilterByMultipleProductUrlKeys() value } } - } + } } QUERY; $response = $this->graphQlQuery($query); @@ -1198,10 +1198,10 @@ public function testFilterByMultipleFilterFieldsSortedByMultipleSortFields() products( filter: { - price:{to :"50"} + price:{to :"50"} sku:{in:["simple1", "simple2"]} name:{match:"Simple"} - + } pageSize:4 currentPage:1 @@ -1236,10 +1236,10 @@ public function testFilterByMultipleFilterFieldsSortedByMultipleSortFields() page_size current_page } - sort_fields + sort_fields { default - options + options { value label @@ -1382,7 +1382,7 @@ public function testFilteringForProductsFromMultipleCategories() $query = <<<QUERY { - products(filter:{ + products(filter:{ category_id :{in:["4","5","12"]} }) { @@ -1429,7 +1429,7 @@ public function testFilterProductsBySingleCategoryId() category_id:{eq:"{$queryCategoryId}"} } pageSize:2 - + ) { items @@ -1446,7 +1446,7 @@ public function testFilterProductsBySingleCategoryId() } } total_count - + } } @@ -1520,7 +1520,7 @@ public function testSearchAndSortByRelevance() ) { total_count - items + items { name sku @@ -1533,14 +1533,14 @@ public function testSearchAndSortByRelevance() filters{ name request_var - filter_items_count + filter_items_count filter_items{ label items_count value_string __typename } - } + } aggregations{ attribute_code count @@ -1550,9 +1550,9 @@ public function testSearchAndSortByRelevance() value count } - } + } } - + } QUERY; $response = $this->graphQlQuery($query); @@ -1679,7 +1679,7 @@ public function testProductBasicFullTextSearchQuery() items_count label value_string - } + } } aggregations{ attribute_code @@ -1838,11 +1838,11 @@ public function testQueryFilterNoMatchingItems() { products( filter: - { + { price:{from:"50"} - + description:{match:"Description"} - + } pageSize:2 currentPage:1 @@ -1995,7 +1995,7 @@ public function testFilterProductsThatAreOutOfStockWithConfigSettings() sku:{eq:"simple_visible_in_stock"} } pageSize:20 - + ) { items @@ -2004,7 +2004,7 @@ public function testFilterProductsThatAreOutOfStockWithConfigSettings() name } total_count - + } } QUERY; From 3d6b49a930dbd7eeab2354e0a7e681b1958ab5d3 Mon Sep 17 00:00:00 2001 From: Mastiuhin Olexandr <mastiuhin.olexandr@transoftgroup.com> Date: Tue, 14 Jan 2020 15:40:08 +0200 Subject: [PATCH 0817/1143] MC-29988: [On Pre] Wishlist scope issue 404 --- app/code/Magento/Wishlist/Controller/Index/Plugin.php | 3 ++- .../Wishlist/Test/Unit/Controller/Index/PluginTest.php | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Wishlist/Controller/Index/Plugin.php b/app/code/Magento/Wishlist/Controller/Index/Plugin.php index 150e4de72b40d..63ae419759250 100644 --- a/app/code/Magento/Wishlist/Controller/Index/Plugin.php +++ b/app/code/Magento/Wishlist/Controller/Index/Plugin.php @@ -10,6 +10,7 @@ use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\App\RequestInterface; use Magento\Framework\App\Response\RedirectInterface; +use Magento\Store\Model\ScopeInterface; /** * Wishlist plugin before dispatch @@ -89,7 +90,7 @@ public function beforeDispatch(\Magento\Framework\App\ActionInterface $subject, $this->messageManager->addErrorMessage(__('You must login or register to add items to your wishlist.')); } } - if (!$this->config->isSetFlag('wishlist/general/active')) { + if (!$this->config->isSetFlag('wishlist/general/active', ScopeInterface::SCOPE_STORES)) { throw new NotFoundException(__('Page not found.')); } } diff --git a/app/code/Magento/Wishlist/Test/Unit/Controller/Index/PluginTest.php b/app/code/Magento/Wishlist/Test/Unit/Controller/Index/PluginTest.php index 2b583f9101516..53b9ba7d846b1 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Controller/Index/PluginTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Controller/Index/PluginTest.php @@ -6,8 +6,12 @@ namespace Magento\Wishlist\Test\Unit\Controller\Index; +use Magento\Store\Model\ScopeInterface; + /** * Test for wishlist plugin before dispatch + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class PluginTest extends \PHPUnit\Framework\TestCase { @@ -175,7 +179,7 @@ public function testBeforeDispatch() $this->config ->expects($this->once()) ->method('isSetFlag') - ->with('wishlist/general/active') + ->with('wishlist/general/active', ScopeInterface::SCOPE_STORES) ->willReturn(false); $this->getPlugin()->beforeDispatch($indexController, $this->request); From f4de663ae5bc43a2d3bb1f09ec85599a65722691 Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Tue, 14 Jan 2020 15:43:39 +0200 Subject: [PATCH 0818/1143] MC-30131: [Magento Cloud] When choosing all products, no products appear --- .../ResourceModel/Fulltext/Collection/SearchResultApplier.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Elasticsearch/Model/ResourceModel/Fulltext/Collection/SearchResultApplier.php b/app/code/Magento/Elasticsearch/Model/ResourceModel/Fulltext/Collection/SearchResultApplier.php index ad52f81bf8eda..491d505b5bd85 100644 --- a/app/code/Magento/Elasticsearch/Model/ResourceModel/Fulltext/Collection/SearchResultApplier.php +++ b/app/code/Magento/Elasticsearch/Model/ResourceModel/Fulltext/Collection/SearchResultApplier.php @@ -7,8 +7,8 @@ namespace Magento\Elasticsearch\Model\ResourceModel\Fulltext\Collection; use Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection\SearchResultApplierInterface; -use Magento\Framework\Data\Collection; use Magento\Framework\Api\Search\SearchResultInterface; +use Magento\Framework\Data\Collection; /** * Resolve specific attributes for search criteria. @@ -71,7 +71,7 @@ public function apply() $this->collection->getSelect()->where('e.entity_id IN (?)', $ids); $orderList = join(',', $ids); $this->collection->getSelect()->reset(\Magento\Framework\DB\Select::ORDER); - $this->collection->getSelect()->order("FIELD(e.entity_id,$orderList)"); + $this->collection->getSelect()->order(new \Zend_Db_Expr("FIELD(e.entity_id,$orderList)")); } /** From 367c365c210a31ce9300f7e07dca83556f7f5dcd Mon Sep 17 00:00:00 2001 From: Mykhailo Matiola <mykhailo.matiola@transoftgroup.com> Date: Tue, 14 Jan 2020 15:52:28 +0200 Subject: [PATCH 0819/1143] MC-30333: Admin: Add/delete image(s) from configurable product and its child products --- .../Product/Initialization/HelperTest.php | 369 ++++++++++++++++++ .../Model/Product/VariationHandlerTest.php | 101 +++-- 2 files changed, 433 insertions(+), 37 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/Controller/Adminhtml/Product/Initialization/HelperTest.php diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Controller/Adminhtml/Product/Initialization/HelperTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Controller/Adminhtml/Product/Initialization/HelperTest.php new file mode 100644 index 0000000000000..ba684f37175e4 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Controller/Adminhtml/Product/Initialization/HelperTest.php @@ -0,0 +1,369 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\ConfigurableProduct\Controller\Adminhtml\Product\Initialization; + +use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper; +use Magento\Catalog\Model\Product\Media\Config; +use Magento\Catalog\Model\ResourceModel\Product as ProductResource; +use Magento\Framework\Api\SearchCriteriaBuilder; +use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\App\RequestInterface; +use Magento\Framework\Filesystem; +use Magento\Framework\Filesystem\Directory\WriteInterface; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Serialize\SerializerInterface; +use Magento\Store\Model\Store; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; + +/** + * Tests for image processing plugins for child products by saving a configurable product. + * + * @magentoAppArea adminhtml + * @magentoDbIsolation enabled + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class HelperTest extends TestCase +{ + /** + * @var ObjectManagerInterface + */ + private $objectManager; + + /** + * @var Helper + */ + private $helper; + + /** + * @var RequestInterface + */ + private $request; + + /** + * @var ProductRepositoryInterface + */ + private $productRepository; + + /** + * @var ProductResource + */ + private $productResource; + + /** + * @var ProductAttributeRepositoryInterface + */ + private $productAttributeRepository; + + /** + * @var SerializerInterface + */ + private $jsonSerializer; + + /** + * @var SearchCriteriaBuilder + */ + private $searchCriteriaBuilder; + + /** + * @var Config + */ + private $config; + + /** + * @var WriteInterface + */ + private $mediaDirectory; + + /** + * @var ProductInterface + */ + private $configurableProduct; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + $this->objectManager = Bootstrap::getObjectManager(); + $this->request = $this->objectManager->get(RequestInterface::class); + $this->helper = $this->objectManager->create(Helper::class); + $this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class); + $this->productRepository->cleanCache(); + $this->productResource =$this->objectManager->get(ProductResource::class); + $this->productAttributeRepository = $this->objectManager->create(ProductAttributeRepositoryInterface::class); + $this->jsonSerializer = $this->objectManager->get(SerializerInterface::class); + $this->searchCriteriaBuilder = $this->objectManager->get(SearchCriteriaBuilder::class); + $this->config = $this->objectManager->get(Config::class); + $this->mediaDirectory = $this->objectManager->get(Filesystem::class)->getDirectoryWrite(DirectoryList::MEDIA); + $this->configurableProduct = $this->productRepository->get('configurable'); + } + + /** + * Tests adding images with various roles to child products by saving a configurable product. + * + * @magentoDataFixture Magento/Catalog/_files/product_image.php + * @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php + * @dataProvider initializeDataProvider + * @param array $childProducts + * @param array $expectedImages + * @return void + */ + public function testInitialize(array $childProducts, array $expectedImages): void + { + $this->setRequestParams($childProducts); + $this->helper->initialize($this->configurableProduct); + $this->assertChildProductImages($expectedImages); + } + + /** + * Tests replacing images with various roles to child products by saving a configurable product. + * + * @magentoDataFixture Magento/Catalog/_files/product_image.php + * @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php + * @dataProvider initializeWithExistingChildImagesDataProvider + * @param array $childProducts + * @param array $expectedImages + * @return void + */ + public function testInitializeWithExistingChildImages(array $childProducts, array $expectedImages): void + { + $this->updateChildProductsImages( + [ + 'simple_10' => '/m/a/magento_thumbnail.jpg.tmp', + 'simple_20' => '/m/a/magento_small_image.jpg.tmp', + ] + ); + $this->setRequestParams($childProducts); + $this->helper->initialize($this->configurableProduct); + $this->assertChildProductImages($expectedImages); + } + + /** + * @return array + */ + public function initializeDataProvider(): array + { + return [ + 'children_with_same_image_and_roles' => [ + 'child_products' => [ + 'simple_10' => [ + 'media_gallery' => $this->getMediaGallery(['ben062bdw2v' => '/m/a/magento_image.jpg.tmp']), + 'images' => [ + '/m/a/magento_image.jpg.tmp' => ['swatch_image', 'small_image', 'image', 'thumbnail'], + ], + ], + 'simple_20' => [ + 'media_gallery' => $this->getMediaGallery(['ben062bdw2v' => '/m/a/magento_image.jpg.tmp']), + 'images' => [ + '/m/a/magento_image.jpg.tmp' => ['swatch_image', 'small_image', 'image', 'thumbnail'], + ], + ], + ], + 'expected_images' => [ + 'simple_10' => [ + '/m/a/magento_image_1.jpg' => ['swatch_image', 'small_image', 'image', 'thumbnail'], + ], + 'simple_20' => [ + '/m/a/magento_image_2.jpg' => ['swatch_image', 'small_image', 'image', 'thumbnail'], + ], + ], + ], + 'children_with_different_images' => [ + 'child_products' => [ + 'simple_10' => [ + 'media_gallery' => $this->getMediaGallery(['ben062bdw2v' => '/m/a/magento_image.jpg.tmp']), + 'images' => [ + '/m/a/magento_image.jpg.tmp' => ['swatch_image', 'small_image', 'image', 'thumbnail'], + ], + ], + 'simple_20' => [ + 'media_gallery' => $this->getMediaGallery( + ['lrwuv5ukisn' => '/m/a/magento_small_image.jpg.tmp'] + ), + 'images' => [ + '/m/a/magento_small_image.jpg.tmp' => ['swatch_image', 'small_image', 'image', 'thumbnail'], + ], + ], + ], + 'expected_images' => [ + 'simple_10' => [ + '/m/a/magento_image_1.jpg' => ['swatch_image', 'small_image', 'image', 'thumbnail'], + ], + 'simple_20' => [ + '/m/a/magento_small_image_1.jpg' => ['swatch_image', 'small_image', 'image', 'thumbnail'], + ], + ], + ], + 'children_with_different_image_roles' => [ + 'child_products' => [ + 'simple_10' => [ + 'media_gallery' => $this->getMediaGallery( + [ + 'ben062bdw2v' => '/m/a/magento_image.jpg.tmp', + 'lrwuv5ukisn' => '/m/a/magento_small_image.jpg.tmp', + ] + ), + 'images' => [ + '/m/a/magento_image.jpg.tmp' => ['swatch_image', 'small_image'], + '/m/a/magento_small_image.jpg.tmp' => ['image', 'thumbnail'], + ], + ], + 'simple_20' => [ + 'media_gallery' => $this->getMediaGallery( + [ + 'ben062bdw2v' => '/m/a/magento_image.jpg.tmp', + 'lrwuv5ukisn' => '/m/a/magento_small_image.jpg.tmp', + ] + ), + 'images' => [ + '/m/a/magento_small_image.jpg.tmp' => ['swatch_image', 'small_image'], + '/m/a/magento_image.jpg.tmp' => ['image', 'thumbnail'], + ], + ], + ], + 'expected_images' => [ + 'simple_10' => [ + '/m/a/magento_image_1.jpg' => ['swatch_image', 'small_image'], + '/m/a/magento_small_image_1.jpg' => ['image', 'thumbnail'], + ], + 'simple_20' => [ + '/m/a/magento_small_image_2.jpg' => ['swatch_image', 'small_image'], + '/m/a/magento_image_2.jpg' => ['image', 'thumbnail'], + ], + ], + ], + ]; + } + + /** + * @return array + */ + public function initializeWithExistingChildImagesDataProvider(): array + { + $dataProvider = $this->initializeDataProvider(); + unset($dataProvider['children_with_different_images'], $dataProvider['children_with_different_image_roles']); + + return array_values($dataProvider); + } + + /** + * Sets configurable product params to request. + * + * @param array $childProducts + * @return void + */ + private function setRequestParams(array $childProducts): void + { + $matrix = $associatedProductIds = []; + $attribute = $this->productAttributeRepository->get('test_configurable'); + + foreach ($childProducts as $sku => $product) { + $simpleProduct = $this->productRepository->get($sku); + $attributeValue = $simpleProduct->getData('test_configurable'); + foreach ($product['images'] as $image => $roles) { + foreach ($roles as $role) { + $product[$role] = $image; + } + } + unset($product['images']); + $product['configurable_attribute'] = $this->jsonSerializer->serialize( + ['test_configurable' => $attributeValue] + ); + $product['variationKey'] = $attributeValue; + $product['id'] = $simpleProduct->getId(); + $product['sku'] = $sku; + $product['was_changed'] = true; + $product['newProduct'] = 0; + $matrix[] = $product; + $associatedProductIds[] = $simpleProduct->getId(); + } + $this->request->setParams( + [ + 'attributes' => [$attribute->getAttributeId()], + 'configurable-matrix-serialized' => $this->jsonSerializer->serialize($matrix), + ] + ); + $this->request->setPostValue( + 'associated_product_ids_serialized', + $this->jsonSerializer->serialize($associatedProductIds) + ); + } + + /** + * Asserts child products images. + * + * @param array $expectedImages + * @return void + */ + private function assertChildProductImages(array $expectedImages): void + { + $simpleIds = $this->configurableProduct->getExtensionAttributes()->getConfigurableProductLinks(); + $criteria = $this->searchCriteriaBuilder->addFilter('entity_id', $simpleIds, 'in')->create(); + foreach ($this->productRepository->getList($criteria)->getItems() as $simpleProduct) { + $images = $expectedImages[$simpleProduct->getSku()]; + foreach ($images as $image => $roles) { + foreach ($roles as $role) { + $this->assertEquals($image, $simpleProduct->getData($role)); + } + $this->assertFileExists( + $this->mediaDirectory->getAbsolutePath($this->config->getBaseMediaPath() . $image) + ); + } + } + } + + /** + * Returns media gallery product param. + * + * @param array $imageNames + * @return array + */ + private function getMediaGallery(array $imageNames): array + { + $images = []; + foreach ($imageNames as $key => $item) { + $images[$key] = ['file' => $item, 'label' => '', 'media_type' => 'image']; + } + + return ['images' => $images]; + } + + /** + * Sets image to child products. + * + * @param array $imageNames + * @return void + */ + private function updateChildProductsImages(array $imageNames): void + { + $simpleIds = $this->configurableProduct->getExtensionAttributes()->getConfigurableProductLinks(); + $criteria = $this->searchCriteriaBuilder->addFilter('entity_id', $simpleIds, 'in')->create(); + $products = $this->productRepository->getList($criteria)->getItems(); + foreach ($products as $simpleProduct) { + $simpleProduct->setStoreId(Store::DEFAULT_STORE_ID) + ->setImage($imageNames[$simpleProduct->getSku()]) + ->setSmallImage($imageNames[$simpleProduct->getSku()]) + ->setThumbnail($imageNames[$simpleProduct->getSku()]) + ->setSwatchImage($imageNames[$simpleProduct->getSku()]) + ->setData( + 'media_gallery', + [ + 'images' => [ + ['file' => $imageNames[$simpleProduct->getSku()], 'label' => '', 'media_type' => 'image'] + ] + ] + ); + $this->productResource->save($simpleProduct); + } + } +} diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/VariationHandlerTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/VariationHandlerTest.php index fc2e99d6a9d10..c3b845694c6a0 100644 --- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/VariationHandlerTest.php +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/VariationHandlerTest.php @@ -3,78 +3,105 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\ConfigurableProduct\Model\Product; +use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\CatalogInventory\Api\StockRegistryInterface; +use Magento\ConfigurableProduct\Model\Product\Type\Configurable; +use Magento\Framework\ObjectManagerInterface; use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; /** + * Tests for simple products generation by saving a configurable product. + * * @magentoAppIsolation enabled - * @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php + * @magentoDbIsolation enabled */ -class VariationHandlerTest extends \PHPUnit\Framework\TestCase +class VariationHandlerTest extends TestCase { - /** @var \Magento\ConfigurableProduct\Model\Product\VariationHandler */ - private $_model; + /** + * @var ObjectManagerInterface + */ + private $objectManager; - /** @var \Magento\Catalog\Model\Product */ - private $_product; + /** + * @var VariationHandler + */ + private $variationHandler; - /** @var \Magento\CatalogInventory\Api\StockRegistryInterface */ + /** + * @var ProductInterface + */ + private $product; + + /** + * @var ProductRepositoryInterface + */ + private $productRepository; + + /** + * @var StockRegistryInterface + */ private $stockRegistry; + /** + * @inheritdoc + */ protected function setUp() { - $this->_product = Bootstrap::getObjectManager()->create( - \Magento\Catalog\Model\Product::class - ); - $this->_product->load(1); - - $this->_model = Bootstrap::getObjectManager()->create( - \Magento\ConfigurableProduct\Model\Product\VariationHandler::class - ); - // prevent fatal errors by assigning proper "singleton" of type instance to the product - $this->_product->setTypeInstance($this->_model); - $this->stockRegistry = Bootstrap::getObjectManager()->get( - \Magento\CatalogInventory\Api\StockRegistryInterface::class - ); + $this->objectManager = Bootstrap::getObjectManager(); + $this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class); + $this->productRepository->cleanCache(); + $this->variationHandler = $this->objectManager->create(VariationHandler::class); + $this->product = $this->productRepository->get('configurable'); + $this->stockRegistry = $this->objectManager->get(StockRegistryInterface::class); } /** - * @param array $productsData + * @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php * @dataProvider generateSimpleProductsDataProvider + * @param array $productsData + * @return void */ - public function testGenerateSimpleProducts($productsData) + public function testGenerateSimpleProducts(array $productsData): void { - $this->_product->setNewVariationsAttributeSetId(4); - // Default attribute set id - $generatedProducts = $this->_model->generateSimpleProducts($this->_product, $productsData); + $this->product->setImage('some_test_image.jpg') + ->setSmallImage('some_test_image.jpg') + ->setThumbnail('some_test_image.jpg') + ->setSwatchImage('some_test_image.jpg') + ->setNewVariationsAttributeSetId($this->product->getDefaultAttributeSetId()); + $generatedProducts = $this->variationHandler->generateSimpleProducts($this->product, $productsData); $this->assertEquals(3, count($generatedProducts)); foreach ($generatedProducts as $productId) { $stockItem = $this->stockRegistry->getStockItem($productId); - /** @var $product \Magento\Catalog\Model\Product */ - $product = Bootstrap::getObjectManager()->create( - \Magento\Catalog\Model\Product::class - ); - $product->load($productId); + $product = $this->productRepository->getById($productId); $this->assertNotNull($product->getName()); $this->assertNotNull($product->getSku()); $this->assertNotNull($product->getPrice()); $this->assertNotNull($product->getWeight()); $this->assertEquals('1', $stockItem->getIsInStock()); + $this->assertNull($product->getImage()); + $this->assertNull($product->getSmallImage()); + $this->assertNull($product->getThumbnail()); + $this->assertNull($product->getSwatchImage()); } } /** * @param array $productsData + * @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php * @dataProvider generateSimpleProductsWithPartialDataDataProvider - * @magentoDbIsolation enabled + * @return void */ - public function testGenerateSimpleProductsWithPartialData($productsData) + public function testGenerateSimpleProductsWithPartialData(array $productsData): void { - $this->_product->setNewVariationsAttributeSetId(4); - $generatedProducts = $this->_model->generateSimpleProducts($this->_product, $productsData); - $parentStockItem = $this->stockRegistry->getStockItem($this->_product->getId()); + $this->product->setNewVariationsAttributeSetId(4); + $generatedProducts = $this->variationHandler->generateSimpleProducts($this->product, $productsData); + $parentStockItem = $this->stockRegistry->getStockItem($this->product->getId()); foreach ($generatedProducts as $productId) { $stockItem = $this->stockRegistry->getStockItem($productId); $this->assertEquals($parentStockItem->getManageStock(), $stockItem->getManageStock()); @@ -85,7 +112,7 @@ public function testGenerateSimpleProductsWithPartialData($productsData) /** * @return array */ - public static function generateSimpleProductsDataProvider() + public function generateSimpleProductsDataProvider(): array { return [ [ @@ -122,7 +149,7 @@ public static function generateSimpleProductsDataProvider() /** * @return array */ - public static function generateSimpleProductsWithPartialDataDataProvider() + public function generateSimpleProductsWithPartialDataDataProvider(): array { return [ [ From 242feac6176dcb78fb43badf96558ba45fecd65a Mon Sep 17 00:00:00 2001 From: Mykhailo Matiola <mykhailo.matiola@transoftgroup.com> Date: Tue, 14 Jan 2020 15:56:20 +0200 Subject: [PATCH 0820/1143] MC-30328: Admin: Create/update configurable product --- .../Controller/Adminhtml/ProductTest.php | 517 ++++++++++++++++-- .../configurable_product_with_one_simple.php | 72 +++ ...rable_product_with_one_simple_rollback.php | 32 ++ 3 files changed, 585 insertions(+), 36 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_one_simple.php create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_one_simple_rollback.php diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Controller/Adminhtml/ProductTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Controller/Adminhtml/ProductTest.php index b71507ae43f9f..833100e3e4740 100644 --- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Controller/Adminhtml/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Controller/Adminhtml/ProductTest.php @@ -3,76 +3,521 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\ConfigurableProduct\Controller\Adminhtml; -use Magento\Catalog\Model\Product; -use Magento\Framework\Registry; -use Magento\TestFramework\ObjectManager; +use Magento\Catalog\Api\Data\ProductAttributeInterface; +use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Catalog\Model\Product\Type\Simple; +use Magento\Catalog\Model\Product\Type\Virtual; +use Magento\ConfigurableProduct\Model\Product\Type\Configurable; +use Magento\Eav\Model\Config; use Magento\Framework\App\Request\Http as HttpRequest; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Message\MessageInterface; +use Magento\Framework\Registry; +use Magento\Framework\Serialize\SerializerInterface; +use Magento\TestFramework\TestCase\AbstractBackendController; /** + * Tests for configurable product admin save. + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @magentoAppArea adminhtml + * @magentoDbIsolation enabled */ -class ProductTest extends \Magento\TestFramework\TestCase\AbstractBackendController +class ProductTest extends AbstractBackendController { + /** + * @var ProductRepositoryInterface + */ + private $productRepository; + + /** + * @var ProductAttributeRepositoryInterface + */ + private $productAttributeRepository; + + /** + * @var Registry + */ + private $registry; + + /** + * @var SerializerInterface + */ + private $jsonSerializer; + + /** + * @var Config + */ + private $eavConfig; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + $this->productRepository = $this->_objectManager->get(ProductRepositoryInterface::class); + $this->productRepository->cleanCache(); + $this->productAttributeRepository = $this->_objectManager->create(ProductAttributeRepositoryInterface::class); + $this->registry = $this->_objectManager->get(Registry::class); + $this->jsonSerializer = $this->_objectManager->get(SerializerInterface::class); + $this->eavConfig = $this->_objectManager->get(Config::class); + } + /** * @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php * @magentoDataFixture Magento/ConfigurableProduct/_files/associated_products.php + * @return void */ - public function testSaveActionAssociatedProductIds() + public function testSaveActionAssociatedProductIds(): void { $associatedProductIds = ['3', '14', '15', '92']; - $associatedProductIdsJSON = json_encode($associatedProductIds); $this->getRequest()->setMethod(HttpRequest::METHOD_POST); $this->getRequest()->setPostValue( [ 'id' => 1, - 'attributes' => [$this->_getConfigurableAttribute()->getId()], - 'associated_product_ids_serialized' => $associatedProductIdsJSON, + 'attributes' => [$this->getAttribute('test_configurable')->getId()], + 'associated_product_ids_serialized' => $this->jsonSerializer->serialize($associatedProductIds), ] ); + $this->dispatch('backend/catalog/product/save'); + $this->assertSessionMessages($this->equalTo([__('You saved the product.')]), MessageInterface::TYPE_SUCCESS); + $this->assertRegistryConfigurableLinks($associatedProductIds); + $this->assertConfigurableLinks('configurable', $associatedProductIds); + } + /** + * @magentoDataFixture Magento/ConfigurableProduct/_files/configurable_attribute.php + * @dataProvider saveNewProductDataProvider + * @param array $childProducts + * @return void + */ + public function testSaveNewProduct(array $childProducts): void + { + $this->serRequestParams($childProducts); $this->dispatch('backend/catalog/product/save'); + $this->assertSessionMessages($this->equalTo([__('You saved the product.')]), MessageInterface::TYPE_SUCCESS); + $this->assertChildProducts($childProducts); + $this->assertConfigurableOptions('configurable', $childProducts); + $this->assertConfigurableLinks('configurable', $this->getProductIds(array_keys($childProducts))); + } - /** @var $objectManager ObjectManager */ - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + /** + * @return array + */ + public function saveNewProductDataProvider(): array + { + return [ + 'with_different_prices_and_qty' => [ + 'child_products' => [ + 'simple_1' => [ + 'name' => 'simple_1', + 'sku' => 'simple_1', + 'price' => '200', + 'weight' => '1', + 'qty' => '100', + 'attributes' => ['test_configurable' => 'Option 1'], + ], + 'simple_2' => [ + 'name' => 'simple_2', + 'sku' => 'simple_2', + 'price' => '100', + 'weight' => '1', + 'qty' => '200', + 'attributes' => ['test_configurable' => 'Option 2'], + ], + ], + ], + 'without_weight' => [ + 'child_products' => [ + 'simple_1' => [ + 'name' => 'simple_1', + 'sku' => 'simple_1', + 'price' => '100', + 'qty' => '100', + 'attributes' => ['test_configurable' => 'Option 1'], + ], + 'simple_2' => [ + 'name' => 'simple_2', + 'sku' => 'simple_2', + 'price' => '100', + 'qty' => '100', + 'attributes' => ['test_configurable' => 'Option 2'], + ], + ], + ], + ]; + } - /** @var $product Product */ - $product = $objectManager->get(Registry::class)->registry('current_product'); - $configurableProductLinks = array_values($product->getExtensionAttributes()->getConfigurableProductLinks()); - self::assertEquals( - $associatedProductIds, - $configurableProductLinks, - 'Product links are not available in the registry' + /** + * @magentoDataFixture Magento/ConfigurableProduct/_files/configurable_product_with_one_simple.php + * @magentoDataFixture Magento/ConfigurableProduct/_files/configurable_attribute_2.php + * @dataProvider saveExistProductDataProvider + * @param array $childProducts + * @param array $associatedProducts + * @return void + */ + public function testSaveExistProduct(array $childProducts, array $associatedProducts): void + { + $configurableProduct = $this->productRepository->get('configurable'); + $this->serRequestParams($childProducts, $associatedProducts, (int)$configurableProduct->getId()); + $this->dispatch('backend/catalog/product/save'); + $this->assertSessionMessages($this->equalTo([__('You saved the product.')]), MessageInterface::TYPE_SUCCESS); + $this->assertChildProducts($childProducts); + $this->assertConfigurableOptions('configurable', $childProducts); + $this->assertConfigurableLinks( + 'configurable', + $this->getProductIds(array_merge($associatedProducts, array_keys($childProducts))) + ); + } + + /** + * @return array + */ + public function saveExistProductDataProvider(): array + { + return [ + 'added_new_option' => [ + 'child_products' => [ + 'simple_2' => [ + 'name' => 'simple_2', + 'sku' => 'simple_2', + 'price' => '100', + 'weight' => '1', + 'qty' => '200', + 'attributes' => ['test_configurable' => 'Option 2'], + ], + ], + 'associated_products' => ['simple_1'], + ], + 'added_new_option_and_delete_old' => [ + 'child_products' => [ + 'simple_2' => [ + 'name' => 'simple_2', + 'sku' => 'simple_2', + 'price' => '100', + 'qty' => '100', + 'attributes' => ['test_configurable' => 'Option 2'], + ], + ], + 'associated_products' => [], + ], + 'delete_all_options' => [ + 'child_products' => [], + 'associated_products' => [], + ], + 'added_new_attribute' => [ + 'child_products' => [ + 'simple_1_1' => [ + 'name' => 'simple_1_1', + 'sku' => 'simple_1_1', + 'price' => '100', + 'weight' => '1', + 'qty' => '200', + 'attributes' => [ + 'test_configurable' => 'Option 1', + 'test_configurable_2' => 'Option 1', + ], + ], + 'simple_1_2' => [ + 'name' => 'simple_1_2', + 'sku' => 'simple_1_2', + 'price' => '100', + 'weight' => '1', + 'qty' => '200', + 'attributes' => [ + 'test_configurable' => 'Option 1', + 'test_configurable_2' => 'Option 2', + ], + ], + ], + 'associated_products' => [], + ], + 'added_new_attribute_and_delete_old' => [ + 'child_products' => [ + 'simple_2_1' => [ + 'name' => 'simple_2_1', + 'sku' => 'simple_2_1', + 'price' => '100', + 'qty' => '100', + 'attributes' => ['test_configurable_2' => 'Option 1'], + ], + 'simple_2_2' => [ + 'name' => 'simple_2_2', + 'sku' => 'simple_2_2', + 'price' => '100', + 'qty' => '100', + 'attributes' => ['test_configurable_2' => 'Option 2'], + ], + ], + 'associated_products' => [], + ], + ]; + } + + /** + * Sets products data into request. + * + * @param array $childProducts + * @param array|null $associatedProducts + * @param int|null $mainProductId + * @return void + */ + private function serRequestParams( + array $childProducts, + ?array $associatedProducts = [], + ?int $mainProductId = null + ): void { + $this->setVariationMatrix($childProducts); + $this->setAssociatedProducts($associatedProducts); + $this->getRequest()->setMethod(HttpRequest::METHOD_POST); + $this->getRequest()->setParams( + [ + 'type' => Configurable::TYPE_CODE, + 'set' => $this->getDefaultAttributeSetId(), + 'id' => $mainProductId, + ] + ); + $this->getRequest()->setPostValue( + 'product', + [ + 'attribute_set_id' => $this->getDefaultAttributeSetId(), + 'name' => 'configurable', + 'sku' => 'configurable', + 'configurable_attributes_data' => $this->getConfigurableAttributesData($childProducts) ?: null, + ] ); + } - /** @var $product \Magento\Catalog\Api\Data\ProductInterface */ - $product = $objectManager->get(ProductRepositoryInterface::class)->getById(1, false, null, true); - $configurableProductLinks = array_values($product->getExtensionAttributes()->getConfigurableProductLinks()); - self::assertEquals( + /** + * Asserts product configurable links. + * + * @param string $sku + * @param array $associatedProductIds + * @return void + */ + private function assertConfigurableLinks(string $sku, array $associatedProductIds): void + { + $product = $this->productRepository->get($sku, false, null, true); + $this->assertEquals( $associatedProductIds, - $configurableProductLinks, + array_values($product->getExtensionAttributes()->getConfigurableProductLinks() ?: []), 'Product links are not available in the database' ); } /** - * Retrieve configurable attribute instance + * Asserts product from registry configurable links. * - * @return \Magento\Catalog\Model\Entity\Attribute - */ - protected function _getConfigurableAttribute() - { - return \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - \Magento\Catalog\Model\Entity\Attribute::class - )->loadByCode( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - \Magento\Eav\Model\Config::class - )->getEntityType( - 'catalog_product' - )->getId(), - 'test_configurable' + * @param array $associatedProductIds + * @return void + */ + private function assertRegistryConfigurableLinks(array $associatedProductIds): void + { + $product = $this->registry->registry('current_product'); + $this->assertNotNull($product); + $this->assertEquals( + $associatedProductIds, + array_values($product->getExtensionAttributes()->getConfigurableProductLinks() ?: []), + 'Product links are not available in the registry' + ); + } + + /** + * Asserts child products data. + * + * @param array $childProducts + * @return void + */ + private function assertChildProducts(array $childProducts): void + { + foreach ($this->getProducts(array_column($childProducts, 'sku')) as $product) { + $expectedProduct = $childProducts[$product->getSku()]; + $this->assertEquals($expectedProduct['price'], $product->getPrice()); + + if (!empty($expectedProduct['weight'])) { + $this->assertEquals($expectedProduct['weight'], (double)$product->getWeight()); + $this->assertInstanceOf(Simple::class, $product->getTypeInstance()); + } else { + $this->assertInstanceOf(Virtual::class, $product->getTypeInstance()); + } + + $this->assertEquals($expectedProduct['qty'], $product->getExtensionAttributes()->getStockItem()->getQty()); + } + } + + /** + * Asserts that configurable attributes present in product configurable option list. + * + * @param string $sku + * @param array $childProducts + * @return void + */ + private function assertConfigurableOptions(string $sku, array $childProducts): void + { + $configurableProduct = $this->productRepository->get($sku, false, null, true); + $options = $configurableProduct->getExtensionAttributes()->getConfigurableProductOptions(); + if (empty($childProducts)) { + $this->assertNull($options); + } else { + foreach ($options as $option) { + $attribute = $this->getAttribute($option->getAttributeId()); + foreach ($childProducts as $childProduct) { + $this->assertContains($attribute->getAttributeCode(), array_keys($childProduct['attributes'])); + } + } + } + } + + /** + * Sets configurable product params to request. + * + * @param array $childProducts + * @return void + */ + private function setVariationMatrix(array $childProducts): void + { + $matrix = $attributeIds = $configurableAttributes = []; + foreach ($childProducts as $product) { + foreach ($product['attributes'] as $attributeCode => $optionLabel) { + $attribute = $this->getAttribute($attributeCode); + $configurableAttributes[$attributeCode] = $attribute->getSource()->getOptionId($optionLabel); + $attributeIds[] = $attribute->getAttributeId(); + } + $product['status'] = Status::STATUS_ENABLED; + $product['configurable_attribute'] = $this->jsonSerializer->serialize($configurableAttributes); + $product['newProduct'] = 1; + $product['variationKey'] = implode('-', array_values($configurableAttributes)); + $matrix[] = $product; + } + $this->getRequest()->setPostValue( + [ + 'affect_configurable_product_attributes' => 1, + 'attributes' => $attributeIds, + 'new-variations-attribute-set-id' => $this->getDefaultAttributeSetId(), + 'configurable-matrix-serialized' => $this->jsonSerializer->serialize($matrix), + ] ); } + + /** + * Sets associated product ids param to request. + * + * @param array|null $associatedProducts + */ + private function setAssociatedProducts(?array $associatedProducts): void + { + if (!empty($associatedProducts)) { + $associatedProductIds = array_map( + function (ProductInterface $product) { + return $product->getId(); + }, + $this->getProducts($associatedProducts) + ); + $this->getRequest()->setPostValue( + 'associated_product_ids_serialized', + $this->jsonSerializer->serialize($associatedProductIds) + ); + } + } + + /** + * Returns product configurable attributes data. + * + * @param array $childProducts + * @return array + */ + private function getConfigurableAttributesData(array $childProducts): array + { + $result = []; + foreach ($childProducts as $product) { + foreach ($product['attributes'] as $attributeCode => $optionLabel) { + $attribute = $this->getAttribute($attributeCode); + $optionId = $attribute->getSource()->getOptionId($optionLabel); + if (empty($result[$attribute->getAttributeId()])) { + $result[$attribute->getAttributeId()] = [ + 'attribute_id' =>$attribute->getAttributeId(), + 'code' => $attribute->getAttributeCode(), + 'label' => $attribute->getAttributeCode(), + 'position' => '0', + 'values' => [ + $optionId => [ + 'include' => '1', + 'value_index' => $optionId, + ], + ], + ]; + } else { + $result[$attribute->getAttributeId()]['values'][$optionId] = [ + 'include' => '1', + 'value_index' => $optionId, + ]; + } + } + } + + return $result; + } + + /** + * Retrieve default product attribute set id. + * + * @return int + */ + private function getDefaultAttributeSetId(): int + { + return (int)$this->eavConfig + ->getEntityType(ProductAttributeInterface::ENTITY_TYPE_CODE) + ->getDefaultAttributeSetId(); + } + + /** + * Retrieve configurable attribute instance. + * + * @param string $attributeCode + * @return ProductAttributeInterface + */ + private function getAttribute(string $attributeCode): ProductAttributeInterface + { + return $this->productAttributeRepository->get($attributeCode); + } + + /** + * Returns products by sku list. + * + * @param array $skuList + * @return ProductInterface[] + */ + private function getProducts(array $skuList): array + { + $result = []; + foreach ($skuList as $sku) { + $result[] = $this->productRepository->get($sku); + } + + return $result; + } + + /** + * Returns product ids by sku list. + * + * @param array $skuList + * @return array + */ + private function getProductIds(array $skuList): array + { + $associatedProductIds = []; + foreach ($this->getProducts($skuList) as $product) { + $associatedProductIds[] = $product->getId(); + } + + return $associatedProductIds; + } } diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_one_simple.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_one_simple.php new file mode 100644 index 0000000000000..dd3a31bb29016 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_one_simple.php @@ -0,0 +1,72 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\Data\ProductExtensionInterfaceFactory; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Catalog\Model\Product\Type; +use Magento\Catalog\Model\Product\Visibility; +use Magento\Catalog\Model\ProductFactory; +use Magento\ConfigurableProduct\Helper\Product\Options\Factory; +use Magento\ConfigurableProduct\Model\Product\Type\Configurable; +use Magento\Store\Api\WebsiteRepositoryInterface; +use Magento\TestFramework\Helper\Bootstrap; + +require __DIR__ . '/configurable_attribute.php'; +$objectManager = Bootstrap::getObjectManager(); +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->get(ProductRepositoryInterface::class); +/** @var ProductFactory $productFactory */ +$productFactory = $objectManager->get(ProductFactory::class); +/** @var Factory $optionsFactory */ +$optionsFactory = $objectManager->get(Factory::class); +/** @var ProductExtensionInterfaceFactory $productExtensionAttributes */ +$productExtensionAttributesFactory = $objectManager->get(ProductExtensionInterfaceFactory::class); +/** @var WebsiteRepositoryInterface $websiteRepository */ +$websiteRepository = $objectManager->get(WebsiteRepositoryInterface::class); +$defaultWebsiteId = $websiteRepository->get('base')->getId(); + +$option = $attribute->getSource()->getOptionId('Option 1'); +$product = $productFactory->create(); +$product->setTypeId(Type::TYPE_SIMPLE) + ->setAttributeSetId($product->getDefaultAttributeSetId()) + ->setWebsiteIds([$defaultWebsiteId]) + ->setName('Configurable Option 1') + ->setSku('simple_1') + ->setPrice(10.00) + ->setTestConfigurable($option) + ->setVisibility(Visibility::VISIBILITY_NOT_VISIBLE) + ->setStatus(Status::STATUS_ENABLED) + ->setStockData(['use_config_manage_stock' => 1, 'qty' => 100, 'is_qty_decimal' => 0, 'is_in_stock' => 1]); +$product = $productRepository->save($product); + +$configurableOptions = $optionsFactory->create( + [ + [ + 'attribute_id' => $attribute->getId(), + 'code' => $attribute->getAttributeCode(), + 'label' => $attribute->getStoreLabel(), + 'position' => '0', + 'values' => [['label' => 'test', 'attribute_id' => $attribute->getId(), 'value_index' => $option]], + ], + ] +); +$extensionConfigurableAttributes = $product->getExtensionAttributes() ?: $productExtensionAttributesFactory->create(); +$extensionConfigurableAttributes->setConfigurableProductOptions($configurableOptions); +$extensionConfigurableAttributes->setConfigurableProductLinks([$product->getId()]); + +$configurableProduct = $productFactory->create(); +$configurableProduct->setExtensionAttributes($extensionConfigurableAttributes); +$configurableProduct->setTypeId(Configurable::TYPE_CODE) + ->setAttributeSetId($configurableProduct->getDefaultAttributeSetId()) + ->setWebsiteIds([$defaultWebsiteId]) + ->setName('Configurable Product') + ->setSku('configurable') + ->setVisibility(Visibility::VISIBILITY_BOTH) + ->setStatus(Status::STATUS_ENABLED) + ->setStockData(['use_config_manage_stock' => 1, 'is_in_stock' => 1]); +$productRepository->save($configurableProduct); diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_one_simple_rollback.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_one_simple_rollback.php new file mode 100644 index 0000000000000..165b714caa508 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_one_simple_rollback.php @@ -0,0 +1,32 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Registry; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var Registry $registry */ +$registry = $objectManager->get(Registry::class); +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->get(ProductRepositoryInterface::class); +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); + +foreach (['simple_1', 'configurable'] as $sku) { + try { + $product = $productRepository->get($sku); + $productRepository->delete($product); + } catch (NoSuchEntityException $e) { + //Product already removed + } +} + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); +require __DIR__ . '/configurable_attribute_rollback.php'; From 44faf8b09b1cbfd9a9f8e93c16c0bfedcc1030ff Mon Sep 17 00:00:00 2001 From: Viktor Sevch <svitja@ukr.net> Date: Tue, 14 Jan 2020 16:01:08 +0200 Subject: [PATCH 0821/1143] MC-25254: [ElasticSearch] New product attribute requires full search reindex to be searchable on Storefront --- .../Test/Unit/Elasticsearch5/Model/Client/ElasticsearchTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Elasticsearch/Test/Unit/Elasticsearch5/Model/Client/ElasticsearchTest.php b/app/code/Magento/Elasticsearch/Test/Unit/Elasticsearch5/Model/Client/ElasticsearchTest.php index d5b873ccd7866..5a735da96b754 100644 --- a/app/code/Magento/Elasticsearch/Test/Unit/Elasticsearch5/Model/Client/ElasticsearchTest.php +++ b/app/code/Magento/Elasticsearch/Test/Unit/Elasticsearch5/Model/Client/ElasticsearchTest.php @@ -11,7 +11,7 @@ use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; /** - * Class ElasticsearchTest + * Test elasticsearch client methods. */ class ElasticsearchTest extends \PHPUnit\Framework\TestCase { From 9a31aa2a0f5f238e1df601274d307308ac767659 Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Tue, 14 Jan 2020 16:11:20 +0200 Subject: [PATCH 0822/1143] MC-30103: Page Builder Image widget Select From Gallery thumbnail is not cached --- .../Cms/Model/Wysiwyg/Images/Storage.php | 35 ++++---- .../Unit/Model/Wysiwyg/Images/StorageTest.php | 10 +-- .../Cms/Model/Wysiwyg/Images/StorageTest.php | 86 +++++++++++++++++++ 3 files changed, 104 insertions(+), 27 deletions(-) diff --git a/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php b/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php index 21f3b232e783c..f0a232bdccccc 100644 --- a/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php +++ b/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php @@ -570,7 +570,11 @@ public function getThumbnailPath($filePath, $checkFile = false) $mediaRootDir = $this->_cmsWysiwygImages->getStorageRoot(); if (strpos($filePath, (string) $mediaRootDir) === 0) { - $thumbPath = $this->getThumbnailRoot() . substr($filePath, strlen($mediaRootDir)); + $relativeFilePath = substr($filePath, strlen($mediaRootDir)); + // phpcs:ignore Magento2.Functions.DiscouragedFunction + $thumbPath = $relativeFilePath === basename($filePath) + ? $this->getThumbnailRoot() . DIRECTORY_SEPARATOR . $relativeFilePath + : $this->getThumbnailRoot() . $relativeFilePath; if (!$checkFile || $this->_directory->isExist($this->_directory->getRelativePath($thumbPath))) { return $thumbPath; @@ -589,21 +593,12 @@ public function getThumbnailPath($filePath, $checkFile = false) */ public function getThumbnailUrl($filePath, $checkFile = false) { - $mediaRootDir = $this->_cmsWysiwygImages->getStorageRoot(); - - if (strpos($filePath, (string) $mediaRootDir) === 0) { - $thumbSuffix = self::THUMBS_DIRECTORY_NAME . substr($filePath, strlen($mediaRootDir)); - if (!$checkFile || $this->_directory->isExist( - $this->_directory->getRelativePath($mediaRootDir . '/' . $thumbSuffix) - ) - ) { - $thumbSuffix = substr( - $mediaRootDir, - strlen($this->_directory->getAbsolutePath()) - ) . '/' . $thumbSuffix; - $randomIndex = '?rand=' . time(); - return str_replace('\\', '/', $this->_cmsWysiwygImages->getBaseUrl() . $thumbSuffix) . $randomIndex; - } + $thumbPath = $this->getThumbnailPath($filePath, $checkFile); + if ($thumbPath) { + $thumbRelativePath = ltrim($this->_directory->getRelativePath($thumbPath), '/\\'); + $baseUrl = rtrim($this->_cmsWysiwygImages->getBaseUrl(), '/'); + $randomIndex = '?rand=' . time(); + return str_replace('\\', '/', $baseUrl . '/' . $thumbRelativePath) . $randomIndex; } return false; @@ -666,11 +661,13 @@ public function resizeOnTheFly($filename) */ public function getThumbsPath($filePath = false) { - $mediaRootDir = $this->_cmsWysiwygImages->getStorageRoot(); $thumbnailDir = $this->getThumbnailRoot(); - if ($filePath && strpos($filePath, (string) $mediaRootDir) === 0) { - $thumbnailDir .= $this->file->getParentDirectory(substr($filePath, strlen($mediaRootDir))); + if ($filePath) { + $thumbPath = $this->getThumbnailPath($filePath, false); + if ($thumbPath) { + $thumbnailDir = $this->file->getParentDirectory($thumbPath); + } } return $thumbnailDir; diff --git a/app/code/Magento/Cms/Test/Unit/Model/Wysiwyg/Images/StorageTest.php b/app/code/Magento/Cms/Test/Unit/Model/Wysiwyg/Images/StorageTest.php index 9a9c63195051c..f87eee62e1095 100644 --- a/app/code/Magento/Cms/Test/Unit/Model/Wysiwyg/Images/StorageTest.php +++ b/app/code/Magento/Cms/Test/Unit/Model/Wysiwyg/Images/StorageTest.php @@ -131,6 +131,7 @@ class StorageTest extends \PHPUnit\Framework\TestCase */ protected function setUp() { + $this->objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->filesystemMock = $this->createMock(\Magento\Framework\Filesystem::class); $this->driverMock = $this->getMockBuilder(\Magento\Framework\Filesystem\DriverInterface::class) ->setMethods(['getRealPathSafety']) @@ -159,10 +160,7 @@ protected function setUp() $this->returnValue($this->directoryMock) ); - $this->fileMock = $this->createPartialMock( - \Magento\Framework\Filesystem\Driver\File::class, - ['getParentDirectory'] - ); + $this->fileMock = $this->objectManagerHelper->getObject(\Magento\Framework\Filesystem\Driver\File::class); $this->ioFileMock = $this->createPartialMock(\Magento\Framework\Filesystem\Io\File::class, ['getPathInfo']); $this->ioFileMock->expects( $this->any() @@ -233,8 +231,6 @@ function ($path) { 'image_allowed' => $this->allowedImageExtensions, ]; - $this->objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $this->imagesStorage = $this->objectManagerHelper->getObject( \Magento\Cms\Model\Wysiwyg\Images\Storage::class, [ @@ -525,8 +521,6 @@ public function testUploadFile() ] ); - $this->fileMock->expects($this->any())->method('getParentDirectory')->willReturn($path); - $image = $this->getMockBuilder(\Magento\Catalog\Model\Product\Image::class) ->disableOriginalConstructor() ->setMethods(['open', 'keepAspectRatio', 'resize', 'save']) diff --git a/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php b/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php index 5d256f2234a53..c77646ca5be1c 100644 --- a/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php +++ b/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php @@ -9,9 +9,12 @@ use Magento\Framework\App\Filesystem\DirectoryList; /** + * Test methods of class Storage * * @SuppressWarnings(PHPMD.LongVariable) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * @SuppressWarnings(PHPMD.TooManyPublicMethods) */ class StorageTest extends \PHPUnit\Framework\TestCase { @@ -260,4 +263,87 @@ public function testUploadFileWithWrongFile(): void $this->assertFalse(is_file(self::$_baseDir . DIRECTORY_SEPARATOR . $fileName)); // phpcs:enable } + + /** + * Test that getThumbnailUrl() returns correct URL for root folder or sub-folders images + * + * @param string $directory + * @param string $filename + * @param string $expectedUrl + * @return void + * @magentoAppIsolation enabled + * @magentoAppArea adminhtml + * @dataProvider getThumbnailUrlDataProvider + */ + public function testGetThumbnailUrl(string $directory, string $filename, string $expectedUrl): void + { + $root = $this->storage->getCmsWysiwygImages()->getStorageRoot(); + $directory = implode('/', array_filter([rtrim($root, '/'), trim($directory, '/')])); + $path = $directory . '/' . $filename; + $this->generateImage($path); + $this->storage->resizeFile($path); + $collection = $this->storage->getFilesCollection($directory, 'image'); + $paths = []; + foreach ($collection as $item) { + $paths[] = parse_url($item->getThumbUrl(), PHP_URL_PATH); + } + $this->assertEquals([$expectedUrl], $paths); + $this->storage->deleteFile($path); + } + + /** + * Provide scenarios for testing getThumbnailUrl() + * + * @return array + */ + public function getThumbnailUrlDataProvider(): array + { + return [ + [ + '/', + 'image1.png', + '/pub/media/.thumbs/image1.png' + ], + [ + '/cms', + 'image2.png', + '/pub/media/.thumbscms/image2.png' + ], + [ + '/cms/pages', + 'image3.png', + '/pub/media/.thumbscms/pages/image3.png' + ] + ]; + } + + /** + * Generate a dummy image of the given width and height. + * + * @param string $path + * @param int $width + * @param int $height + * @return string + */ + private function generateImage(string $path, int $width = 1024, int $height = 768) + { + $dir = dirname($path); + if (!file_exists($dir)) { + mkdir($dir, 0777, true); + } + $file = fopen($path, 'wb'); + $filename = basename($path); + ob_start(); + $image = imagecreatetruecolor($width, $height); + switch (substr($filename, strrpos($filename, '.'))) { + case '.jpeg': + imagejpeg($image); + break; + case '.png': + imagepng($image); + break; + } + fwrite($file, ob_get_clean()); + return $path; + } } From b3982062f89f247abd5ee784e160f734c3e86a16 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Tue, 14 Jan 2020 16:18:24 +0200 Subject: [PATCH 0823/1143] Cover changes with jasmine tests --- .../frontend/web/js/add-to-wishlist.test.js | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Wishlist/view/frontend/web/js/add-to-wishlist.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Wishlist/view/frontend/web/js/add-to-wishlist.test.js index 207d14bf990c3..f157ae27ee532 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Wishlist/view/frontend/web/js/add-to-wishlist.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Wishlist/view/frontend/web/js/add-to-wishlist.test.js @@ -6,15 +6,22 @@ define([ 'jquery', 'Magento_Wishlist/js/add-to-wishlist' -], function ($) { +], function ($, Widget) { 'use strict'; describe('Testing addToWishlist widget', function () { - var wdContainer; + var wdContainer, + wishlistWidget, + eventMock = { + preventDefault: jasmine.createSpy(), + stopPropagation: jasmine.createSpy() + }; beforeEach(function () { wdContainer = $('<input type="hidden" class="bundle-option-11 product bundle option" \n' + 'name="bundle_option[11]" value="15" aria-required="true"/>'); + wishlistWidget = new Widget(); + $.fn.validation = {}; }); afterEach(function () { @@ -31,5 +38,15 @@ define([ }); expect(wdContainer.addToWishlist('option', 'bundleInfo')).toBe('test'); }); + + it('verify update wichlist with validate product qty, valid qty', function () { + var validation = spyOn($.fn, 'validation').and.returnValue(false); + + wishlistWidget._validateWishlistQty(eventMock); + expect(validation).toHaveBeenCalled(); + expect(eventMock.preventDefault).toHaveBeenCalled(); + expect(eventMock.stopPropagation).toHaveBeenCalled(); + }); + }); }); From 1b8a3714e0f59dfc46fe30ad20cf215fd315bc15 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Tue, 14 Jan 2020 16:27:53 +0200 Subject: [PATCH 0824/1143] Static test fix --- .../Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFiles.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFiles.php b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFiles.php index df0764a2e26c6..9327c51c3f761 100644 --- a/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFiles.php +++ b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFiles.php @@ -5,8 +5,8 @@ */ namespace Magento\Cms\Controller\Adminhtml\Wysiwyg\Images; -use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\App\Action\HttpPostActionInterface; +use Magento\Framework\App\Filesystem\DirectoryList; /** * Delete image files. @@ -62,6 +62,7 @@ public function execute() { try { if (!$this->getRequest()->isPost()) { + //phpcs:ignore Magento2.Exceptions.DirectThrow throw new \Exception('Wrong request.'); } $files = $this->getRequest()->getParam('files'); @@ -84,8 +85,9 @@ public function execute() $this->getStorage()->deleteFile($filePath); } } - + return $this->resultRawFactory->create(); + // phpcs:ignore Magento2.Exceptions.ThrowCatch } catch (\Exception $e) { $result = ['error' => true, 'message' => $e->getMessage()]; /** @var \Magento\Framework\Controller\Result\Json $resultJson */ From c3b8a564ac259c141b29d6129cfe7008fd6b3ab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Tue, 14 Jan 2020 17:42:47 +0100 Subject: [PATCH 0825/1143] Fix PHPUnit fatal error related with class methods not implemented --- .../Test/Unit/Plugin/DisableMultishippingModeTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Multishipping/Test/Unit/Plugin/DisableMultishippingModeTest.php b/app/code/Magento/Multishipping/Test/Unit/Plugin/DisableMultishippingModeTest.php index 02ae1a70ce801..25a095381333e 100644 --- a/app/code/Magento/Multishipping/Test/Unit/Plugin/DisableMultishippingModeTest.php +++ b/app/code/Magento/Multishipping/Test/Unit/Plugin/DisableMultishippingModeTest.php @@ -59,10 +59,10 @@ protected function setUp() public function testExecuteTurnsOffMultishippingModeOnMultishippingQuote(): void { $subject = $this->createMock(Index::class); - $extensionAttributes = $this->createPartialMock( - CartExtensionInterface::class, - ['setShippingAssignments', 'getShippingAssignments'] - ); + $extensionAttributes = $this->getMockBuilder(CartExtensionInterface::class) + ->disableOriginalConstructor() + ->setMethods(['setShippingAssignments', 'getShippingAssignments']) + ->getMockForAbstractClass(); $extensionAttributes->method('getShippingAssignments') ->willReturn( $this->createMock(ShippingAssignmentInterface::class) From 1065a715f1f546bc82a63598a7183c3f86c217b8 Mon Sep 17 00:00:00 2001 From: Lena Orobei <oorobei@magento.com> Date: Tue, 14 Jan 2020 13:42:57 -0600 Subject: [PATCH 0826/1143] magento/magento2#26331: Deliver commerce and B2B test --- .../Test/AdminUnassignProductAttributeFromAttributeSetTest.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUnassignProductAttributeFromAttributeSetTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUnassignProductAttributeFromAttributeSetTest.xml index 1c9cdad681d98..0aa033178ea38 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUnassignProductAttributeFromAttributeSetTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUnassignProductAttributeFromAttributeSetTest.xml @@ -33,8 +33,9 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <deleteData createDataKey="attribute" stepKey="deleteAttribute"/> <deleteData createDataKey="product" stepKey="deleteProduct"/> + <deleteData createDataKey="attribute" stepKey="deleteAttribute"/> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> <actionGroup ref="logout" stepKey="logout"/> </after> <!-- Assert attribute presence in storefront product additional information --> From 4dcf4366112eda56257dcb7a736986aee17d5693 Mon Sep 17 00:00:00 2001 From: Daniel Renaud <drenaud@magento.com> Date: Tue, 14 Jan 2020 13:54:45 -0600 Subject: [PATCH 0827/1143] MC-23303: [Forwardport] Support preview for staged data --- .../Product/SearchCriteriaBuilder.php | 13 +- .../Model/Resolver/Category/Products.php | 58 ++----- .../Model/Resolver/Product/PriceRange.php | 4 +- .../Model/Resolver/Products.php | 40 +---- .../Model/Resolver/Products/Query/Filter.php | 151 +++++++++++++++--- .../Products/Query/ProductQueryInterface.php | 25 +++ .../Model/Resolver/Products/Query/Search.php | 43 ++++- .../FilterProcessor/CategoryFilter.php | 23 ++- app/code/Magento/CatalogGraphQl/etc/di.xml | 2 + app/code/Magento/GraphQl/etc/graphql/di.xml | 1 + .../Magento/Catalog/_files/categories.php | 3 +- .../_files/rule_by_category_ids_rollback.php | 27 ++++ .../Test/Legacy/ModuleDBChangeTest.php | 15 -- 13 files changed, 264 insertions(+), 141 deletions(-) create mode 100644 app/code/Magento/CatalogGraphQl/Model/Resolver/Products/Query/ProductQueryInterface.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_by_category_ids_rollback.php diff --git a/app/code/Magento/CatalogGraphQl/DataProvider/Product/SearchCriteriaBuilder.php b/app/code/Magento/CatalogGraphQl/DataProvider/Product/SearchCriteriaBuilder.php index 0e92bbbab4259..53d3b624285e9 100644 --- a/app/code/Magento/CatalogGraphQl/DataProvider/Product/SearchCriteriaBuilder.php +++ b/app/code/Magento/CatalogGraphQl/DataProvider/Product/SearchCriteriaBuilder.php @@ -129,7 +129,7 @@ private function addVisibilityFilter(SearchCriteriaInterface $searchCriteria, bo ? $this->visibility->getVisibleInSearchIds() : $this->visibility->getVisibleInCatalogIds(); - $this->addFilter($searchCriteria, 'visibility', $visibilityIds); + $this->addFilter($searchCriteria, 'visibility', $visibilityIds, 'in'); } /** @@ -155,13 +155,20 @@ private function preparePriceAggregation(SearchCriteriaInterface $searchCriteria * @param SearchCriteriaInterface $searchCriteria * @param string $field * @param mixed $value + * @param string|null $condition */ - private function addFilter(SearchCriteriaInterface $searchCriteria, string $field, $value): void - { + private function addFilter( + SearchCriteriaInterface $searchCriteria, + string $field, + $value, + ?string $condition = null + ): void { $filter = $this->filterBuilder ->setField($field) ->setValue($value) + ->setConditionType($condition) ->create(); + $this->filterGroupBuilder->addFilter($filter); $filterGroups = $searchCriteria->getFilterGroups(); $filterGroups[] = $this->filterGroupBuilder->create(); diff --git a/app/code/Magento/CatalogGraphQl/Model/Resolver/Category/Products.php b/app/code/Magento/CatalogGraphQl/Model/Resolver/Category/Products.php index abc5ae7e1da7f..85b86f313de4d 100644 --- a/app/code/Magento/CatalogGraphQl/Model/Resolver/Category/Products.php +++ b/app/code/Magento/CatalogGraphQl/Model/Resolver/Category/Products.php @@ -7,16 +7,12 @@ namespace Magento\CatalogGraphQl\Model\Resolver\Category; -use Magento\Catalog\Api\ProductRepositoryInterface; use Magento\CatalogGraphQl\DataProvider\Product\SearchCriteriaBuilder; -use Magento\CatalogGraphQl\Model\Resolver\Products\Query\Search; -use Magento\Framework\App\ObjectManager; use Magento\Framework\GraphQl\Config\Element\Field; use Magento\Framework\GraphQl\Query\ResolverInterface; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; -use Magento\Framework\GraphQl\Query\Resolver\Argument\SearchCriteria\Builder; -use Magento\CatalogGraphQl\Model\Resolver\Products\Query\Filter; use Magento\Framework\GraphQl\Exception\GraphQlInputException; +use Magento\CatalogGraphQl\Model\Resolver\Products\Query\ProductQueryInterface; /** * Category products resolver, used by GraphQL endpoints to retrieve products assigned to a category @@ -24,24 +20,7 @@ class Products implements ResolverInterface { /** - * @var \Magento\Catalog\Api\ProductRepositoryInterface - */ - private $productRepository; - - /** - * @var Builder - * @deprecated - */ - private $searchCriteriaBuilder; - - /** - * @var Filter - * @deprecated - */ - private $filterQuery; - - /** - * @var Search + * @var ProductQueryInterface */ private $searchQuery; @@ -51,25 +30,15 @@ class Products implements ResolverInterface private $searchApiCriteriaBuilder; /** - * @param ProductRepositoryInterface $productRepository - * @param Builder $searchCriteriaBuilder - * @param Filter $filterQuery - * @param Search $searchQuery + * @param ProductQueryInterface $searchQuery * @param SearchCriteriaBuilder $searchApiCriteriaBuilder */ public function __construct( - ProductRepositoryInterface $productRepository, - Builder $searchCriteriaBuilder, - Filter $filterQuery, - Search $searchQuery = null, - SearchCriteriaBuilder $searchApiCriteriaBuilder = null + ProductQueryInterface $searchQuery, + SearchCriteriaBuilder $searchApiCriteriaBuilder ) { - $this->productRepository = $productRepository; - $this->searchCriteriaBuilder = $searchCriteriaBuilder; - $this->filterQuery = $filterQuery; - $this->searchQuery = $searchQuery ?? ObjectManager::getInstance()->get(Search::class); - $this->searchApiCriteriaBuilder = $searchApiCriteriaBuilder ?? - ObjectManager::getInstance()->get(SearchCriteriaBuilder::class); + $this->searchQuery = $searchQuery; + $this->searchApiCriteriaBuilder = $searchApiCriteriaBuilder; } /** @@ -94,18 +63,17 @@ public function resolve( 'eq' => $value['id'] ] ]; - $searchCriteria = $this->searchApiCriteriaBuilder->build($args, false); - $searchResult = $this->searchQuery->getResult($searchCriteria, $info); + $searchResult = $this->searchQuery->getResult($args, $info); //possible division by 0 - if ($searchCriteria->getPageSize()) { - $maxPages = ceil($searchResult->getTotalCount() / $searchCriteria->getPageSize()); + if ($searchResult->getPageSize()) { + $maxPages = ceil($searchResult->getTotalCount() / $searchResult->getPageSize()); } else { $maxPages = 0; } - $currentPage = $searchCriteria->getCurrentPage(); - if ($searchCriteria->getCurrentPage() > $maxPages && $searchResult->getTotalCount() > 0) { + $currentPage = $searchResult->getCurrentPage(); + if ($searchResult->getCurrentPage() > $maxPages && $searchResult->getTotalCount() > 0) { $currentPage = new GraphQlInputException( __( 'currentPage value %1 specified is greater than the number of pages available.', @@ -118,7 +86,7 @@ public function resolve( 'total_count' => $searchResult->getTotalCount(), 'items' => $searchResult->getProductsSearchResult(), 'page_info' => [ - 'page_size' => $searchCriteria->getPageSize(), + 'page_size' => $searchResult->getPageSize(), 'current_page' => $currentPage, 'total_pages' => $maxPages ] diff --git a/app/code/Magento/CatalogGraphQl/Model/Resolver/Product/PriceRange.php b/app/code/Magento/CatalogGraphQl/Model/Resolver/Product/PriceRange.php index 9396b1f02b975..dbb52f2010930 100644 --- a/app/code/Magento/CatalogGraphQl/Model/Resolver/Product/PriceRange.php +++ b/app/code/Magento/CatalogGraphQl/Model/Resolver/Product/PriceRange.php @@ -86,7 +86,7 @@ private function getMinimumProductPrice(SaleableInterface $product, StoreInterfa $priceProvider = $this->priceProviderPool->getProviderByProductType($product->getTypeId()); $regularPrice = $priceProvider->getMinimalRegularPrice($product)->getValue(); $finalPrice = $priceProvider->getMinimalFinalPrice($product)->getValue(); - $minPriceArray = $this->formatPrice($regularPrice, $finalPrice, $store); + $minPriceArray = $this->formatPrice((float) $regularPrice, (float) $finalPrice, $store); $minPriceArray['model'] = $product; return $minPriceArray; } @@ -103,7 +103,7 @@ private function getMaximumProductPrice(SaleableInterface $product, StoreInterfa $priceProvider = $this->priceProviderPool->getProviderByProductType($product->getTypeId()); $regularPrice = $priceProvider->getMaximalRegularPrice($product)->getValue(); $finalPrice = $priceProvider->getMaximalFinalPrice($product)->getValue(); - $maxPriceArray = $this->formatPrice($regularPrice, $finalPrice, $store); + $maxPriceArray = $this->formatPrice((float) $regularPrice, (float) $finalPrice, $store); $maxPriceArray['model'] = $product; return $maxPriceArray; } diff --git a/app/code/Magento/CatalogGraphQl/Model/Resolver/Products.php b/app/code/Magento/CatalogGraphQl/Model/Resolver/Products.php index 691f93e4148bc..e3d9ba2a9b3c6 100644 --- a/app/code/Magento/CatalogGraphQl/Model/Resolver/Products.php +++ b/app/code/Magento/CatalogGraphQl/Model/Resolver/Products.php @@ -7,6 +7,7 @@ namespace Magento\CatalogGraphQl\Model\Resolver; +use Magento\CatalogGraphQl\Model\Resolver\Products\Query\ProductQueryInterface; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; use Magento\CatalogGraphQl\Model\Resolver\Products\Query\Filter; use Magento\CatalogGraphQl\Model\Resolver\Products\Query\Search; @@ -24,51 +25,24 @@ class Products implements ResolverInterface { /** - * @var Builder - * @deprecated - */ - private $searchCriteriaBuilder; - - /** - * @var Search + * @var ProductQueryInterface */ private $searchQuery; - /** - * @var Filter - * @deprecated - */ - private $filterQuery; - - /** - * @var SearchFilter - * @deprecated - */ - private $searchFilter; - /** * @var SearchCriteriaBuilder */ private $searchApiCriteriaBuilder; /** - * @param Builder $searchCriteriaBuilder - * @param Search $searchQuery - * @param Filter $filterQuery - * @param SearchFilter $searchFilter + * @param ProductQueryInterface $searchQuery * @param SearchCriteriaBuilder|null $searchApiCriteriaBuilder */ public function __construct( - Builder $searchCriteriaBuilder, - Search $searchQuery, - Filter $filterQuery, - SearchFilter $searchFilter, + ProductQueryInterface $searchQuery, SearchCriteriaBuilder $searchApiCriteriaBuilder = null ) { - $this->searchCriteriaBuilder = $searchCriteriaBuilder; $this->searchQuery = $searchQuery; - $this->filterQuery = $filterQuery; - $this->searchFilter = $searchFilter; $this->searchApiCriteriaBuilder = $searchApiCriteriaBuilder ?? \Magento\Framework\App\ObjectManager::getInstance()->get(SearchCriteriaBuilder::class); } @@ -95,11 +69,7 @@ public function resolve( ); } - //get product children fields queried - $productFields = (array)$info->getFieldSelection(1); - $includeAggregations = isset($productFields['filters']) || isset($productFields['aggregations']); - $searchCriteria = $this->searchApiCriteriaBuilder->build($args, $includeAggregations); - $searchResult = $this->searchQuery->getResult($searchCriteria, $info, $args); + $searchResult = $this->searchQuery->getResult($args, $info); if ($searchResult->getCurrentPage() > $searchResult->getTotalPages() && $searchResult->getTotalCount() > 0) { throw new GraphQlInputException( diff --git a/app/code/Magento/CatalogGraphQl/Model/Resolver/Products/Query/Filter.php b/app/code/Magento/CatalogGraphQl/Model/Resolver/Products/Query/Filter.php index cc25af44fdfbe..670eee9c4583e 100644 --- a/app/code/Magento/CatalogGraphQl/Model/Resolver/Products/Query/Filter.php +++ b/app/code/Magento/CatalogGraphQl/Model/Resolver/Products/Query/Filter.php @@ -7,16 +7,23 @@ namespace Magento\CatalogGraphQl\Model\Resolver\Products\Query; -use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; +use Magento\Catalog\Model\Layer\Resolver as LayerResolver; +use Magento\Catalog\Model\Product; use Magento\Framework\Api\SearchCriteriaInterface; -use Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\Product; +use Magento\Framework\Exception\InputException; +use Magento\Framework\GraphQl\Query\Resolver\Argument\SearchCriteria\Builder as SearchCriteriaBuilder; +use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; +use Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\Product as ProductProvider; use Magento\CatalogGraphQl\Model\Resolver\Products\SearchResult; use Magento\CatalogGraphQl\Model\Resolver\Products\SearchResultFactory; +use Magento\Search\Model\Query; +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Store\Model\ScopeInterface; /** * Retrieve filtered product data based off given search criteria in a format that GraphQL can interpret. */ -class Filter +class Filter implements ProductQueryInterface { /** * @var SearchResultFactory @@ -24,12 +31,12 @@ class Filter private $searchResultFactory; /** - * @var \Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\Product + * @var ProductProvider */ private $productDataProvider; /** - * @var \Magento\Catalog\Model\Layer\Resolver + * @var LayerResolver */ private $layerResolver; @@ -38,50 +45,154 @@ class Filter */ private $fieldSelection; + /** + * @var SearchCriteriaBuilder + */ + private $searchCriteriaBuilder; + + /** + * @var ScopeConfigInterface + */ + private $scopeConfig; + /** * @param SearchResultFactory $searchResultFactory - * @param Product $productDataProvider - * @param \Magento\Catalog\Model\Layer\Resolver $layerResolver + * @param ProductProvider $productDataProvider + * @param LayerResolver $layerResolver * @param FieldSelection $fieldSelection + * @param SearchCriteriaBuilder $searchCriteriaBuilder + * @param ScopeConfigInterface $scopeConfig */ public function __construct( SearchResultFactory $searchResultFactory, - Product $productDataProvider, - \Magento\Catalog\Model\Layer\Resolver $layerResolver, - FieldSelection $fieldSelection + ProductProvider $productDataProvider, + LayerResolver $layerResolver, + FieldSelection $fieldSelection, + SearchCriteriaBuilder $searchCriteriaBuilder, + ScopeConfigInterface $scopeConfig ) { $this->searchResultFactory = $searchResultFactory; $this->productDataProvider = $productDataProvider; $this->layerResolver = $layerResolver; $this->fieldSelection = $fieldSelection; + $this->searchCriteriaBuilder = $searchCriteriaBuilder; + $this->scopeConfig = $scopeConfig; } /** * Filter catalog product data based off given search criteria * - * @param SearchCriteriaInterface $searchCriteria + * @param array $args * @param ResolveInfo $info - * @param bool $isSearch * @return SearchResult */ public function getResult( - SearchCriteriaInterface $searchCriteria, - ResolveInfo $info, - bool $isSearch = false + array $args, + ResolveInfo $info ): SearchResult { $fields = $this->fieldSelection->getProductsFieldSelection($info); - $products = $this->productDataProvider->getList($searchCriteria, $fields, $isSearch); + try { + $searchCriteria = $this->buildSearchCriteria($args, $info); + $searchResults = $this->productDataProvider->getList($searchCriteria, $fields); + } catch (InputException $e) { + return $this->createEmptyResult($args); + } + $productArray = []; - /** @var \Magento\Catalog\Model\Product $product */ - foreach ($products->getItems() as $product) { + /** @var Product $product */ + foreach ($searchResults->getItems() as $product) { $productArray[$product->getId()] = $product->getData(); $productArray[$product->getId()]['model'] = $product; } + //possible division by 0 + if ($searchCriteria->getPageSize()) { + $maxPages = (int)ceil($searchResults->getTotalCount() / $searchCriteria->getPageSize()); + } else { + $maxPages = 0; + } + + return $this->searchResultFactory->create( + [ + 'totalCount' => $searchResults->getTotalCount(), + 'productsSearchResult' => $productArray, + 'pageSize' => $searchCriteria->getPageSize(), + 'currentPage' => $searchCriteria->getCurrentPage(), + 'totalPages' => $maxPages, + ] + ); + } + + /** + * Build search criteria from query input args + * + * @param array $args + * @param ResolveInfo $info + * @return SearchCriteriaInterface + */ + private function buildSearchCriteria(array $args, ResolveInfo $info): SearchCriteriaInterface + { + if (!empty($args['filter'])) { + $args['filter'] = $this->formatFilters($args['filter']); + } + + $criteria = $this->searchCriteriaBuilder->build($info->fieldName, $args); + $criteria->setCurrentPage($args['currentPage']); + $criteria->setPageSize($args['pageSize']); + + return $criteria; + } + + /** + * Reformat filters + * + * @param array $filters + * @return array + * @throws InputException + */ + private function formatFilters(array $filters): array + { + $formattedFilters = []; + $minimumQueryLength = $this->scopeConfig->getValue( + Query::XML_PATH_MIN_QUERY_LENGTH, + ScopeInterface::SCOPE_STORE + ); + + foreach ($filters as $field => $filter) { + foreach ($filter as $condition => $value) { + if ($condition === 'match') { + // reformat 'match' filter so MySQL filtering behaves like SearchAPI filtering + $condition = 'like'; + $value = str_replace('%', '', trim($value)); + if (strlen($value) < $minimumQueryLength) { + throw new InputException(__('Invalid match filter')); + } + $value = '%' . preg_replace('/ +/', '%', $value) . '%'; + } + $formattedFilters[$field] = [$condition => $value]; + } + } + + return $formattedFilters; + } + + /** + * Return and empty SearchResult object + * + * Used for handling exceptions gracefully + * + * @param array $args + * @return SearchResult + */ + private function createEmptyResult(array $args): SearchResult + { return $this->searchResultFactory->create( [ - 'totalCount' => $products->getTotalCount(), - 'productsSearchResult' => $productArray + 'totalCount' => 0, + 'productsSearchResult' => [], + 'pageSize' => $args['pageSize'], + 'currentPage' => $args['currentPage'], + 'totalPages' => 0, ] ); } diff --git a/app/code/Magento/CatalogGraphQl/Model/Resolver/Products/Query/ProductQueryInterface.php b/app/code/Magento/CatalogGraphQl/Model/Resolver/Products/Query/ProductQueryInterface.php new file mode 100644 index 0000000000000..580af5d87be26 --- /dev/null +++ b/app/code/Magento/CatalogGraphQl/Model/Resolver/Products/Query/ProductQueryInterface.php @@ -0,0 +1,25 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\CatalogGraphQl\Model\Resolver\Products\Query; + +use Magento\CatalogGraphQl\Model\Resolver\Products\SearchResult; +use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; + +/** + * Search for products by criteria + */ +interface ProductQueryInterface +{ + /** + * Get product search result + * + * @param array $args + * @param ResolveInfo $info + * @return SearchResult + */ + public function getResult(array $args, ResolveInfo $info): SearchResult; +} diff --git a/app/code/Magento/CatalogGraphQl/Model/Resolver/Products/Query/Search.php b/app/code/Magento/CatalogGraphQl/Model/Resolver/Products/Query/Search.php index ef83cc6132ecc..8377cd9baa5b4 100644 --- a/app/code/Magento/CatalogGraphQl/Model/Resolver/Products/Query/Search.php +++ b/app/code/Magento/CatalogGraphQl/Model/Resolver/Products/Query/Search.php @@ -7,6 +7,7 @@ namespace Magento\CatalogGraphQl\Model\Resolver\Products\Query; +use Magento\CatalogGraphQl\DataProvider\Product\SearchCriteriaBuilder; use Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\ProductSearch; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; use Magento\Framework\Api\Search\SearchCriteriaInterface; @@ -14,11 +15,12 @@ use Magento\CatalogGraphQl\Model\Resolver\Products\SearchResultFactory; use Magento\Search\Api\SearchInterface; use Magento\Framework\Api\Search\SearchCriteriaInterfaceFactory; +use Magento\Search\Model\Search\PageSizeProvider; /** * Full text search for catalog using given search criteria. */ -class Search +class Search implements ProductQueryInterface { /** * @var SearchInterface @@ -31,7 +33,7 @@ class Search private $searchResultFactory; /** - * @var \Magento\Search\Model\Search\PageSizeProvider + * @var PageSizeProvider */ private $pageSizeProvider; @@ -50,21 +52,28 @@ class Search */ private $productsProvider; + /** + * @var SearchCriteriaBuilder + */ + private $searchCriteriaBuilder; + /** * @param SearchInterface $search * @param SearchResultFactory $searchResultFactory - * @param \Magento\Search\Model\Search\PageSizeProvider $pageSize + * @param PageSizeProvider $pageSize * @param SearchCriteriaInterfaceFactory $searchCriteriaFactory * @param FieldSelection $fieldSelection * @param ProductSearch $productsProvider + * @param SearchCriteriaBuilder $searchCriteriaBuilder */ public function __construct( SearchInterface $search, SearchResultFactory $searchResultFactory, - \Magento\Search\Model\Search\PageSizeProvider $pageSize, + PageSizeProvider $pageSize, SearchCriteriaInterfaceFactory $searchCriteriaFactory, FieldSelection $fieldSelection, - ProductSearch $productsProvider + ProductSearch $productsProvider, + SearchCriteriaBuilder $searchCriteriaBuilder ) { $this->search = $search; $this->searchResultFactory = $searchResultFactory; @@ -72,21 +81,23 @@ public function __construct( $this->searchCriteriaFactory = $searchCriteriaFactory; $this->fieldSelection = $fieldSelection; $this->productsProvider = $productsProvider; + $this->searchCriteriaBuilder = $searchCriteriaBuilder; } /** - * Return results of full text catalog search of given term, and will return filtered results if filter is specified + * Return product search results using Search API * - * @param SearchCriteriaInterface $searchCriteria + * @param array $args * @param ResolveInfo $info * @return SearchResult * @throws \Exception */ public function getResult( - SearchCriteriaInterface $searchCriteria, + array $args, ResolveInfo $info ): SearchResult { $queryFields = $this->fieldSelection->getProductsFieldSelection($info); + $searchCriteria = $this->buildSearchCriteria($args, $info); $realPageSize = $searchCriteria->getPageSize(); $realCurrentPage = $searchCriteria->getCurrentPage(); @@ -131,4 +142,20 @@ public function getResult( ] ); } + + /** + * Build search criteria from query input args + * + * @param array $args + * @param ResolveInfo $info + * @return SearchCriteriaInterface + */ + private function buildSearchCriteria(array $args, ResolveInfo $info): SearchCriteriaInterface + { + $productFields = (array)$info->getFieldSelection(1); + $includeAggregations = isset($productFields['filters']) || isset($productFields['aggregations']); + $searchCriteria = $this->searchCriteriaBuilder->build($args, $includeAggregations); + + return $searchCriteria; + } } diff --git a/app/code/Magento/CatalogGraphQl/Model/Resolver/Products/SearchCriteria/CollectionProcessor/FilterProcessor/CategoryFilter.php b/app/code/Magento/CatalogGraphQl/Model/Resolver/Products/SearchCriteria/CollectionProcessor/FilterProcessor/CategoryFilter.php index e3b3588166163..92888a2775e17 100644 --- a/app/code/Magento/CatalogGraphQl/Model/Resolver/Products/SearchCriteria/CollectionProcessor/FilterProcessor/CategoryFilter.php +++ b/app/code/Magento/CatalogGraphQl/Model/Resolver/Products/SearchCriteria/CollectionProcessor/FilterProcessor/CategoryFilter.php @@ -9,11 +9,9 @@ use Magento\Catalog\Model\CategoryFactory; use Magento\Catalog\Model\ResourceModel\Category as CategoryResourceModel; -use Magento\Catalog\Model\ResourceModel\Product\Collection; use Magento\Framework\Api\Filter; use Magento\Framework\Api\SearchCriteria\CollectionProcessor\FilterProcessor\CustomFilterInterface; use Magento\Framework\Data\Collection\AbstractDb; -use Magento\Framework\Exception\LocalizedException; /** * Category filter allows to filter products collection using 'category_id' filter from search criteria. @@ -50,22 +48,23 @@ public function __construct( * @param Filter $filter * @param AbstractDb $collection * @return bool Whether the filter is applied - * @throws LocalizedException */ public function apply(Filter $filter, AbstractDb $collection) { - $conditionType = $filter->getConditionType(); - - if ($conditionType !== 'eq') { - throw new LocalizedException(__("'category_id' only supports 'eq' condition type.")); + $categoryIds = $filter->getValue(); + if (!is_array($categoryIds)) { + $categoryIds = [$categoryIds]; } - $categoryId = $filter->getValue(); - /** @var Collection $collection */ - $category = $this->categoryFactory->create(); - $this->categoryResourceModel->load($category, $categoryId); - $collection->addCategoryFilter($category); + $categoryProducts = []; + foreach ($categoryIds as $categoryId) { + $category = $this->categoryFactory->create(); + $this->categoryResourceModel->load($category, $categoryId); + $categoryProducts[$categoryId] = $category->getProductCollection()->getAllIds(); + } + $categoryProductIds = array_unique(array_merge(...$categoryProducts)); + $collection->addIdFilter($categoryProductIds); return true; } } diff --git a/app/code/Magento/CatalogGraphQl/etc/di.xml b/app/code/Magento/CatalogGraphQl/etc/di.xml index 1fe62fc442ecf..d6f75259e30d7 100644 --- a/app/code/Magento/CatalogGraphQl/etc/di.xml +++ b/app/code/Magento/CatalogGraphQl/etc/di.xml @@ -71,4 +71,6 @@ </type> <preference type="\Magento\CatalogGraphQl\Model\Resolver\Product\Price\Provider" for="\Magento\CatalogGraphQl\Model\Resolver\Product\Price\ProviderInterface"/> + + <preference type="Magento\CatalogGraphQl\Model\Resolver\Products\Query\Search" for="Magento\CatalogGraphQl\Model\Resolver\Products\Query\ProductQueryInterface"/> </config> diff --git a/app/code/Magento/GraphQl/etc/graphql/di.xml b/app/code/Magento/GraphQl/etc/graphql/di.xml index 03bae5c80e12c..2bcd44e9ae410 100644 --- a/app/code/Magento/GraphQl/etc/graphql/di.xml +++ b/app/code/Magento/GraphQl/etc/graphql/di.xml @@ -7,6 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <preference for="Magento\Framework\App\FrontControllerInterface" type="Magento\GraphQl\Controller\GraphQl" /> + <preference for="Magento\Framework\Authorization\RoleLocatorInterface" type="Magento\Webapi\Model\WebapiRoleLocator" /> <type name="Magento\Authorization\Model\CompositeUserContext"> <arguments> <argument name="userContexts" xsi:type="array"> diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/categories.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/categories.php index 25bb55ffbc32c..4255d7d3c98e5 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/categories.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/categories.php @@ -20,7 +20,7 @@ ] ); -/** @var Magento\Catalog\Api\CategoryLinkManagementInterface $linkManagement */ +/** @var Magento\Catalog\Api\CategoryLinkManagementInterface $categoryLinkManagement */ $categoryLinkManagement = $objectManager->create(\Magento\Catalog\Api\CategoryLinkManagementInterface::class); $reflectionClass = new \ReflectionClass(get_class($categoryLinkManagement)); $properties = [ @@ -115,6 +115,7 @@ ->setName('Inactive') ->setParentId(2) ->setPath('1/2/8') + ->setLevel(2) ->setAvailableSortBy('name') ->setDefaultSortBy('name') ->setIsActive(false) diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_by_category_ids_rollback.php b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_by_category_ids_rollback.php new file mode 100644 index 0000000000000..67584a300eacd --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_by_category_ids_rollback.php @@ -0,0 +1,27 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + +/** @var \Magento\CatalogRule\Model\ResourceModel\Rule $catalogRuleResource */ +$catalogRuleResource = $objectManager->create(\Magento\CatalogRule\Model\ResourceModel\Rule::class); + +//Retrieve rule id by name +$select = $catalogRuleResource->getConnection()->select(); +$select->from($catalogRuleResource->getMainTable(), 'rule_id'); +$select->where('name = ?', 'test_category_rule'); +$ruleId = $catalogRuleResource->getConnection()->fetchOne($select); + +try { + /** @var \Magento\CatalogRule\Api\CatalogRuleRepositoryInterface $ruleRepository */ + $ruleRepository = $objectManager->create(\Magento\CatalogRule\Api\CatalogRuleRepositoryInterface::class); + $ruleRepository->deleteById($ruleId); +} catch (\Exception $ex) { + //Nothing to remove +} +/** @var \Magento\CatalogRule\Model\Indexer\IndexBuilder $indexBuilder */ +$indexBuilder = $objectManager->get(\Magento\CatalogRule\Model\Indexer\IndexBuilder::class); +$indexBuilder->reindexFull(); diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/ModuleDBChangeTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/ModuleDBChangeTest.php index 876944e0027b4..15b3dc0e0a899 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/ModuleDBChangeTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/ModuleDBChangeTest.php @@ -64,21 +64,6 @@ public static function setUpBeforeClass() } } - /** - * Test changes for module.xml files - */ - public function testModuleXmlFiles() - { - if (!self::$actualBranch) { - preg_match_all('|etc/module\.xml$|mi', self::$changedFileList, $matches); - $this->assertEmpty( - reset($matches), - 'module.xml changes for patch releases in non-actual branches are not allowed:' . PHP_EOL . - implode(PHP_EOL, array_values(reset($matches))) - ); - } - } - /** * Test changes for files in Module Setup dir */ From bf5000352f67df7de4389e77f0ee9495199b1281 Mon Sep 17 00:00:00 2001 From: Lena Orobei <oorobei@magento.com> Date: Tue, 14 Jan 2020 16:15:01 -0600 Subject: [PATCH 0828/1143] magento/magento2#26331: Deliver commerce and B2B test --- .../Test/Mftf/Test/AdminCreateAndSwitchProductType.xml | 1 + ...ProductWithThreeProductDontDisplayOutOfStockProductsTest.xml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml index a5ad45048ce96..d7399cbd1ab20 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml @@ -148,6 +148,7 @@ <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetSearch"/> <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/> <deleteData stepKey="deleteAttribute" createDataKey="createConfigProductAttribute"/> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> <actionGroup ref="logout" stepKey="logout"/> </after> <!-- Create configurable product from downloadable product page--> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDontDisplayOutOfStockProductsTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDontDisplayOutOfStockProductsTest.xml index 9b4cea72882eb..206df79a1a6a8 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDontDisplayOutOfStockProductsTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDontDisplayOutOfStockProductsTest.xml @@ -72,6 +72,8 @@ <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <!-- Log out --> <actionGroup ref="logout" stepKey="logout"/> </after> From 7fd55602752d6d857874bac7bef54ea2c5adaa8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Tue, 14 Jan 2020 23:41:03 +0100 Subject: [PATCH 0829/1143] Add missing Annotations to MFTF tests --- .../Backend/Test/Mftf/Test/AdminLoginTest.xml | 2 +- .../AdminCardinalCommerceSettingsHiddenTest.xml | 1 + ...uctAttributeWithoutValueInCompareListTest.xml | 16 ++++++++-------- ...ontCategoryAccessibleWhenSuffixIsNullTest.xml | 1 + .../Test/AdminCMSPageCreateDisabledPageTest.xml | 1 + ...AdminCMSPageCreatePageForDefaultStoreTest.xml | 1 + ...minCMSPageCreatePageInSingleStoreModeTest.xml | 1 + .../Mftf/Test/AdminCMSPageCreatePageTest.xml | 3 ++- .../Test/AdminCMSPageCreatePageWithBlockTest.xml | 1 + .../Mftf/Test/NoErrorForMiniCartItemEditTest.xml | 1 + .../AdminScheduledImportSettingsHiddenTest.xml | 7 ++++--- ...NoJavascriptErrorOnAddYourReviewClickTest.xml | 1 + .../AdminCreateOrderWithDateTimeOptionUITest.xml | 1 + ...nSignifydConfigDependentOnActiveFieldTest.xml | 1 + .../AdminSetUpWatermarkForSwatchImageTest.xml | 1 + 15 files changed, 26 insertions(+), 13 deletions(-) diff --git a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginTest.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginTest.xml index ce33f01c60141..960e77db7194f 100644 --- a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginTest.xml +++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginTest.xml @@ -24,4 +24,4 @@ <seeInCurrentUrl url="{{AdminLoginPage.url}}" stepKey="seeAdminLoginUrl"/> <actionGroup ref="logout" stepKey="logoutFromAdmin"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/CardinalCommerce/Test/Mftf/Test/AdminCardinalCommerceSettingsHiddenTest.xml b/app/code/Magento/CardinalCommerce/Test/Mftf/Test/AdminCardinalCommerceSettingsHiddenTest.xml index a41b96f0db6e4..c891a578cdcca 100644 --- a/app/code/Magento/CardinalCommerce/Test/Mftf/Test/AdminCardinalCommerceSettingsHiddenTest.xml +++ b/app/code/Magento/CardinalCommerce/Test/Mftf/Test/AdminCardinalCommerceSettingsHiddenTest.xml @@ -9,6 +9,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="AdminCardinalCommerceSettingsHiddenTest"> <annotations> + <stories value="Cardinal Commerce Settings"/> <features value="CardinalCommerce"/> <title value="CardinalCommerce settings hidden" /> <description value="CardinalCommerce config shouldn't be visible if the 3D secure is disabled for Authorize.Net."/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/ProductAttributeWithoutValueInCompareListTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/ProductAttributeWithoutValueInCompareListTest.xml index 70d2fb63941c7..c75abdbe43e24 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/ProductAttributeWithoutValueInCompareListTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/ProductAttributeWithoutValueInCompareListTest.xml @@ -7,13 +7,13 @@ --> <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="ProductAttributeWithoutValueInCompareListTest"> <annotations> <features value="Catalog"/> + <stories value="Product Comparison"/> <title value="Product attribute without value in compare list test"/> - <description - value="The product attribute that has no value should output 'N/A' on the product comparison page."/> + <description value="The product attribute that has no value should output 'N/A' on the product comparison page."/> <severity value="MINOR"/> <group value="Catalog"/> </annotations> @@ -22,7 +22,7 @@ <createData entity="textProductAttribute" stepKey="createProductAttribute"/> <createData entity="CatalogAttributeSet" stepKey="createAttributeSet"/> <amOnPage url="{{AdminProductAttributeSetEditPage.url}}/$$createAttributeSet.attribute_set_id$$/" - stepKey="onAttributeSetEdit"/> + stepKey="onAttributeSetEdit"/> <actionGroup ref="AssignAttributeToGroupActionGroup" stepKey="assignAttributeToGroup"> <argument name="group" value="Product Details"/> <argument name="attribute" value="$$createProductAttribute.attribute_code$$"/> @@ -69,11 +69,11 @@ </actionGroup> <!--See attribute default value in the comparison list--> <see userInput="$createProductAttribute.defaultValue$" - selector="{{StorefrontProductCompareMainSection.ProductAttributeByCodeAndProductName(ProductAttributeFrontendLabel.label, $createProductCustom.name$)}}" - stepKey="assertAttributeValueForProductCustom"/> + selector="{{StorefrontProductCompareMainSection.ProductAttributeByCodeAndProductName(ProductAttributeFrontendLabel.label, $createProductCustom.name$)}}" + stepKey="assertAttributeValueForProductCustom"/> <!--See N/A if attribute has no value in the comparison list--> <see userInput="N/A" - selector="{{StorefrontProductCompareMainSection.ProductAttributeByCodeAndProductName(ProductAttributeFrontendLabel.label, $createProductDefault.name$)}}" - stepKey="assertNAForProductDefault"/> + selector="{{StorefrontProductCompareMainSection.ProductAttributeByCodeAndProductName(ProductAttributeFrontendLabel.label, $createProductDefault.name$)}}" + stepKey="assertNAForProductDefault"/> </test> </tests> diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/StorefrontCategoryAccessibleWhenSuffixIsNullTest.xml b/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/StorefrontCategoryAccessibleWhenSuffixIsNullTest.xml index ef8f2b6b1a3e2..6674c55064169 100644 --- a/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/StorefrontCategoryAccessibleWhenSuffixIsNullTest.xml +++ b/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/StorefrontCategoryAccessibleWhenSuffixIsNullTest.xml @@ -9,6 +9,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="StorefrontCategoryAccessibleWhenSuffixIsNullTest"> <annotations> + <stories value="Url rewrites"/> <title value="Storefront category is accessible when url suffix is set to null test"/> <description value="Check no crash occurs on Category page when catalog/seo/category_url_suffix is set to null"/> <features value="CatalogUrlRewrite"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreateDisabledPageTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreateDisabledPageTest.xml index 5b83807eca244..a5f43b090e9d6 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreateDisabledPageTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreateDisabledPageTest.xml @@ -10,6 +10,7 @@ <test name="AdminCMSPageCreateDisabledPageTest"> <annotations> <features value="Cms"/> + <stories value="Create a CMS Page via the Admin"/> <title value="Create disabled CMS Page via the Admin"/> <description value="Admin should be able to create a CMS Page"/> <severity value="CRITICAL"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageForDefaultStoreTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageForDefaultStoreTest.xml index a9f5fcd8b17e0..d63952f7eb6c8 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageForDefaultStoreTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageForDefaultStoreTest.xml @@ -10,6 +10,7 @@ <test name="AdminCMSPageCreatePageForDefaultStoreTest"> <annotations> <features value="Cms"/> + <stories value="Create a CMS Page via the Admin"/> <title value="Create CMS Page via the Admin for default store"/> <description value="Admin should be able to create a CMS Page"/> <severity value="CRITICAL"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageInSingleStoreModeTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageInSingleStoreModeTest.xml index 1ec85f90f46ef..d2124b5d83be6 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageInSingleStoreModeTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageInSingleStoreModeTest.xml @@ -10,6 +10,7 @@ <test name="AdminCMSPageCreatePageInSingleStoreModeTest"> <annotations> <features value="Cms"/> + <stories value="Create a CMS Page via the Admin"/> <title value="Create CMS Page via the Admin in single store mode"/> <description value="Admin should be able to create a CMS Page"/> <severity value="CRITICAL"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageTest.xml index 947fa92f2c8ff..d33d7484f7770 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageTest.xml @@ -6,10 +6,11 @@ */ --> <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="AdminCMSPageCreatePageTest"> <annotations> <features value="Cms"/> + <stories value="Create a CMS Page via the Admin"/> <title value="Create CMS Page via the Admin"/> <description value="Admin should be able to create a CMS Page"/> <severity value="CRITICAL"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageWithBlockTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageWithBlockTest.xml index a6c67dc61dd97..1600a0d9d8d0f 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageWithBlockTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageWithBlockTest.xml @@ -10,6 +10,7 @@ <test name="AdminCMSPageCreatePageWithBlockTest"> <annotations> <features value="Cms"/> + <stories value="Create a CMS Page via the Admin"/> <title value="Create CMS Page that contains block content via the Admin"/> <description value="Admin should be able to create a CMS Page"/> <severity value="CRITICAL"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoErrorForMiniCartItemEditTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoErrorForMiniCartItemEditTest.xml index 42bad3e4bb8bf..914550fabf39b 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoErrorForMiniCartItemEditTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoErrorForMiniCartItemEditTest.xml @@ -11,6 +11,7 @@ <test name="NoErrorForMiniCartItemEditTest"> <annotations> <features value="ConfigurableProduct"/> + <stories value="Storefront Minicart Update"/> <title value="No error for minicart item edit test"/> <description value="Already selected configurable option should be selected when configurable product is edited from minicart"/> <severity value="MAJOR"/> diff --git a/app/code/Magento/Directory/Test/Mftf/Test/AdminScheduledImportSettingsHiddenTest.xml b/app/code/Magento/Directory/Test/Mftf/Test/AdminScheduledImportSettingsHiddenTest.xml index 0320b6f422cd6..853872dd907bd 100644 --- a/app/code/Magento/Directory/Test/Mftf/Test/AdminScheduledImportSettingsHiddenTest.xml +++ b/app/code/Magento/Directory/Test/Mftf/Test/AdminScheduledImportSettingsHiddenTest.xml @@ -6,11 +6,12 @@ */ --> <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="AdminScheduledImportSettingsHiddenTest"> <annotations> <features value="Directory"/> - <title value="Scheduled import settings hidden" /> + <title value="Scheduled import settings hidden"/> + <stories value="Fields visibility according to 'Enable' value"/> <description value="Scheduled Import Settings' should hide fields when 'Enabled' is 'No'"/> <severity value="MINOR"/> </annotations> @@ -24,7 +25,7 @@ <magentoCLI command="config:set currency/import/enabled 0" stepKey="disableCurrencyImport"/> </after> - <amOnPage url="{{AdminCurrencySetupPage.url}}" stepKey="openCurrencyOptionsPage" /> + <amOnPage url="{{AdminCurrencySetupPage.url}}" stepKey="openCurrencyOptionsPage"/> <conditionalClick dependentSelector="{{AdminScheduledImportSettingsSection.enabled}}" visible="false" selector="{{AdminScheduledImportSettingsSection.head}}" stepKey="openCollapsibleBlock"/> <see selector="{{AdminScheduledImportSettingsSection.service}}" userInput="Fixer.io" stepKey="seeServiceFixerIo"/> <selectOption selector="{{AdminScheduledImportSettingsSection.enabled}}" userInput="0" stepKey="disableCurrencyImportOption"/> diff --git a/app/code/Magento/Review/Test/Mftf/Test/StorefrontNoJavascriptErrorOnAddYourReviewClickTest.xml b/app/code/Magento/Review/Test/Mftf/Test/StorefrontNoJavascriptErrorOnAddYourReviewClickTest.xml index 99e418a950c69..c981d70938e11 100644 --- a/app/code/Magento/Review/Test/Mftf/Test/StorefrontNoJavascriptErrorOnAddYourReviewClickTest.xml +++ b/app/code/Magento/Review/Test/Mftf/Test/StorefrontNoJavascriptErrorOnAddYourReviewClickTest.xml @@ -11,6 +11,7 @@ <test name="StorefrontNoJavascriptErrorOnAddYourReviewClickTest"> <annotations> <features value="Review"/> + <stories value="Storefront Add Review"/> <title value="Storefront no javascript error on 'Add Your Review' click test"/> <description value="Verify no javascript error occurs when customer clicks 'Add Your Review' link"/> <severity value="MAJOR"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithDateTimeOptionUITest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithDateTimeOptionUITest.xml index 7e58e55c8981e..1fa01e0efa156 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithDateTimeOptionUITest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithDateTimeOptionUITest.xml @@ -10,6 +10,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="AdminCreateOrderWithDateTimeOptionUITest"> <annotations> + <stories value="Create Order"/> <title value="Admin create order with date time option UI test"/> <description value="Check asterisk rendered correctly for Product with custom option (datetime) at backend"/> <features value="Sales"/> diff --git a/app/code/Magento/Signifyd/Test/Mftf/Test/AdminSignifydConfigDependentOnActiveFieldTest.xml b/app/code/Magento/Signifyd/Test/Mftf/Test/AdminSignifydConfigDependentOnActiveFieldTest.xml index dcae0c4091ba6..b8fb91c4dcd99 100644 --- a/app/code/Magento/Signifyd/Test/Mftf/Test/AdminSignifydConfigDependentOnActiveFieldTest.xml +++ b/app/code/Magento/Signifyd/Test/Mftf/Test/AdminSignifydConfigDependentOnActiveFieldTest.xml @@ -10,6 +10,7 @@ <test name="AdminSignifydConfigDependentOnActiveFieldTest"> <annotations> <features value="Signifyd"/> + <stories value="Signify ID Settings"/> <title value="Signifyd config dependent on active field" /> <description value="Signifyd system configs dependent by Enable this Solution field."/> <severity value="MINOR"/> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/AdminSetUpWatermarkForSwatchImageTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/AdminSetUpWatermarkForSwatchImageTest.xml index 569952019b29b..b24420061db65 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/AdminSetUpWatermarkForSwatchImageTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/AdminSetUpWatermarkForSwatchImageTest.xml @@ -11,6 +11,7 @@ <test name="AdminSetUpWatermarkForSwatchImageTest"> <annotations> <features value="Swatches"/> + <stories value="Product Swatches Images"/> <title value="Possibility to set up watermark for a swatch image type"/> <description value="Possibility to set up watermark for a swatch image type"/> <severity value="MAJOR"/> From 4be4f15964bb0d06da218dfd2672ded9a9223f54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Tue, 14 Jan 2020 23:50:43 +0100 Subject: [PATCH 0830/1143] Add missing severity to Test Cases --- .../Test/Mftf/Test/AdminDeleteIntegrationEntityTest.xml | 2 ++ .../Test/Mftf/Test/NewCustomerPasswordComplexityTest.xml | 1 + .../Security/Test/Mftf/Test/NewCustomerPasswordLengthTest.xml | 1 + .../AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml | 1 + .../Test/AdminDeleteCategoryUrlRewriteWithRequestPathTest.xml | 1 + .../Test/AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.xml | 1 + .../AdminDeleteCmsPageUrlRewriteWithTemporaryRedirectTest.xml | 1 + .../Test/AdminUpdateCmsPageRewriteEntityWithNoRedirectTest.xml | 1 + ...AdminUpdateCmsPageRewriteEntityWithTemporaryRedirectTest.xml | 1 + 9 files changed, 10 insertions(+) diff --git a/app/code/Magento/Integration/Test/Mftf/Test/AdminDeleteIntegrationEntityTest.xml b/app/code/Magento/Integration/Test/Mftf/Test/AdminDeleteIntegrationEntityTest.xml index 6f46bbf99d218..966be94d9e404 100644 --- a/app/code/Magento/Integration/Test/Mftf/Test/AdminDeleteIntegrationEntityTest.xml +++ b/app/code/Magento/Integration/Test/Mftf/Test/AdminDeleteIntegrationEntityTest.xml @@ -14,6 +14,8 @@ <stories value="System Integration"/> <title value="Admin system integration"/> <description value="Admin Deletes Created Integration"/> + <severity value="MAJOR"/> + <testCaseId value="MC-28027"/> <group value="integration"/> <group value="mtf_migrated"/> </annotations> diff --git a/app/code/Magento/Security/Test/Mftf/Test/NewCustomerPasswordComplexityTest.xml b/app/code/Magento/Security/Test/Mftf/Test/NewCustomerPasswordComplexityTest.xml index 74a9c68cb2f79..d7151aff22fa7 100644 --- a/app/code/Magento/Security/Test/Mftf/Test/NewCustomerPasswordComplexityTest.xml +++ b/app/code/Magento/Security/Test/Mftf/Test/NewCustomerPasswordComplexityTest.xml @@ -15,6 +15,7 @@ <title value="Notify the customer if password complexity does not match the requirements"/> <description value="Notify the customer if password complexity does not match the requirements"/> <testCaseId value="MC-14368"/> + <severity value="CRITICAL"/> <group value="security"/> <group value="mtf_migrated"/> </annotations> diff --git a/app/code/Magento/Security/Test/Mftf/Test/NewCustomerPasswordLengthTest.xml b/app/code/Magento/Security/Test/Mftf/Test/NewCustomerPasswordLengthTest.xml index a10059d0603c5..298b4de11f9ca 100644 --- a/app/code/Magento/Security/Test/Mftf/Test/NewCustomerPasswordLengthTest.xml +++ b/app/code/Magento/Security/Test/Mftf/Test/NewCustomerPasswordLengthTest.xml @@ -15,6 +15,7 @@ <title value="Notify the customer if password length does not match the requirements"/> <description value="Notify the customer if password length does not match the requirements"/> <testCaseId value="MC-14367"/> + <severity value="CRITICAL"/> <group value="security"/> <group value="mtf_migrated"/> </annotations> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml index 4b9f37f628f34..ad952225c2ff5 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml @@ -14,6 +14,7 @@ <title value="Delete category URL rewrite, hyphen as request path"/> <description value="Delete category URL rewrite, hyphen as request path"/> <testCaseId value="MC-5348" /> + <severity value="MAJOR"/> <group value="urlRewrite"/> <group value="mtf_migrated"/> </annotations> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteWithRequestPathTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteWithRequestPathTest.xml index 7c4023c6d0f75..dc9928773bf35 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteWithRequestPathTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteWithRequestPathTest.xml @@ -14,6 +14,7 @@ <title value="Delete category URL rewrite, with request path"/> <description value="Delete category URL rewrite, with request path"/> <testCaseId value="MC-5349" /> + <severity value="MAJOR"/> <group value="urlRewrite"/> <group value="mtf_migrated"/> </annotations> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.xml index c40dd3256114e..e2f0d6af0deab 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.xml @@ -13,6 +13,7 @@ <stories value="Delete CMS Page URL rewrite with No Redirects"/> <title value="Delete CMS Page URL rewrite with No Redirects"/> <description value="Log in to admin and delete CMS Page URL rewrite with No Redirects"/> + <severity value="CRITICAL"/> <testCaseId value="MC-14648"/> <group value="mtf_migrated"/> </annotations> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithTemporaryRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithTemporaryRedirectTest.xml index 43de4123f35a8..e3d417f3c1f39 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithTemporaryRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithTemporaryRedirectTest.xml @@ -14,6 +14,7 @@ <title value="Delete CMS Page URL rewrite with Temporary Redirect"/> <description value="Log in to admin and delete CMS Page URL rewrite with Temporary Redirect"/> <testCaseId value="MC-14650"/> + <severity value="CRITICAL"/> <group value="mtf_migrated"/> </annotations> <before> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithNoRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithNoRedirectTest.xml index 6467a5051631d..b2fa13ead1164 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithNoRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithNoRedirectTest.xml @@ -12,6 +12,7 @@ <stories value="Update CMS Page URL Redirect With No Redirect"/> <title value="Update CMS Page URL Redirect With No Redirect"/> <description value="Login as Admin and tried to update the created URL Rewrite for CMS page"/> + <severity value="MINOR"/> <group value="cMSContent"/> <group value="mtf_migrated"/> </annotations> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithTemporaryRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithTemporaryRedirectTest.xml index a7cadcdf753c3..b00241bc3acac 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithTemporaryRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithTemporaryRedirectTest.xml @@ -12,6 +12,7 @@ <stories value="Update CMS Page URL Redirect With Temporary Redirect"/> <title value="Update CMS Page URL Redirect With Temporary Redirect"/> <description value="Login as Admin and tried to update the created URL Rewrite for CMS page"/> + <severity value="MINOR"/> <group value="cMSContent"/> <group value="mtf_migrated"/> </annotations> From 58fb3d3ec15f0818d73671335079fda343d186c2 Mon Sep 17 00:00:00 2001 From: yaroslavGoncharuk <yaroslav.goncharuk@gmail.com> Date: Tue, 14 Jan 2020 18:39:39 -0600 Subject: [PATCH 0831/1143] MC-24173: Fix Skipped MFTF Tests From MC-17140: MC-28425, MC-28439, MC-28445 --- .../Indexer/Test/Mftf/Section/AdminIndexManagementSection.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Indexer/Test/Mftf/Section/AdminIndexManagementSection.xml b/app/code/Magento/Indexer/Test/Mftf/Section/AdminIndexManagementSection.xml index 8e7df86d01329..020cd9654e36b 100644 --- a/app/code/Magento/Indexer/Test/Mftf/Section/AdminIndexManagementSection.xml +++ b/app/code/Magento/Indexer/Test/Mftf/Section/AdminIndexManagementSection.xml @@ -15,7 +15,7 @@ <element name="massActionSubmit" type="button" selector="#gridIndexer_massaction-form button"/> <element name="indexerSelect" type="select" selector="//select[contains(@class,'action-select-multiselect')]"/> <element name="indexerStatus" type="text" selector="//tr[descendant::td[contains(., '{{status}}')]]//*[contains(@class, 'col-indexer_status')]/span" parameterized="true"/> - <element name="successMessage" type="text" selector="//*[@data-ui-id='messages-message-success']"/> + <element name="successMessage" type="text" selector="//*[@data-ui-id='messages-message-success']" timeout="120"/> <element name="selectMassAction" type="select" selector="#gridIndexer_massaction-mass-select"/> </section> </sections> From d546aa237a50b30ebcd617d066bd136e3cf73c2b Mon Sep 17 00:00:00 2001 From: "rostyslav.hymon" <rostyslav.hymon@transoftgroup.com> Date: Wed, 15 Jan 2020 09:20:22 +0200 Subject: [PATCH 0832/1143] MC-29959: [Magento Cloud] Options for downloadable products not found in row(s) error while importing products --- .../DownloadableImportExport/Helper/Data.php | 6 +- .../Helper/Uploader.php | 13 +- .../Export/Product/Type/Downloadable.php | 15 ++ .../Model/Export/RowCustomizer.php | 170 ++++++++++++++++++ .../Import/Product/Type/Downloadable.php | 10 +- .../Import/Product/Type/DownloadableTest.php | 5 +- .../DownloadableImportExport/etc/di.xml | 16 ++ .../DownloadableImportExport/etc/export.xml | 10 ++ ...nloadable_with_link_url_and_sample_url.php | 87 +++++++++ ..._with_link_url_and_sample_url_rollback.php | 40 +++++ .../Model/DownloadableTest.php | 61 ++++--- 11 files changed, 399 insertions(+), 34 deletions(-) create mode 100644 app/code/Magento/DownloadableImportExport/Model/Export/Product/Type/Downloadable.php create mode 100644 app/code/Magento/DownloadableImportExport/Model/Export/RowCustomizer.php create mode 100644 app/code/Magento/DownloadableImportExport/etc/di.xml create mode 100644 app/code/Magento/DownloadableImportExport/etc/export.xml create mode 100644 dev/tests/integration/testsuite/Magento/Downloadable/_files/product_downloadable_with_link_url_and_sample_url.php create mode 100644 dev/tests/integration/testsuite/Magento/Downloadable/_files/product_downloadable_with_link_url_and_sample_url_rollback.php diff --git a/app/code/Magento/DownloadableImportExport/Helper/Data.php b/app/code/Magento/DownloadableImportExport/Helper/Data.php index fa4f7d656cdbe..91e290dbbcdf3 100644 --- a/app/code/Magento/DownloadableImportExport/Helper/Data.php +++ b/app/code/Magento/DownloadableImportExport/Helper/Data.php @@ -8,7 +8,7 @@ use Magento\DownloadableImportExport\Model\Import\Product\Type\Downloadable; /** - * Class Data + * Helper for import-export downloadable product */ class Data extends \Magento\Framework\App\Helper\AbstractHelper { @@ -47,6 +47,7 @@ public function isRowDownloadableNoValid(array $rowData) * @param array $option * @param array $existingOptions * @return array + * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ public function fillExistOptions(array $base, array $option, array $existingOptions) { @@ -59,6 +60,9 @@ public function fillExistOptions(array $base, array $option, array $existingOpti && $option['sample_file'] == $existingOption['sample_file'] && $option['sample_type'] == $existingOption['sample_type'] && $option['product_id'] == $existingOption['product_id']) { + if (empty($existingOption['website_id'])) { + unset($existingOption['website_id']); + } $result = array_replace($base, $option, $existingOption); } } diff --git a/app/code/Magento/DownloadableImportExport/Helper/Uploader.php b/app/code/Magento/DownloadableImportExport/Helper/Uploader.php index 197250faaea91..e6ead5d5cc021 100644 --- a/app/code/Magento/DownloadableImportExport/Helper/Uploader.php +++ b/app/code/Magento/DownloadableImportExport/Helper/Uploader.php @@ -8,7 +8,7 @@ use Magento\Framework\App\Filesystem\DirectoryList; /** - * Class Uploader + * Uploader helper for downloadable products */ class Uploader extends \Magento\Framework\App\Helper\AbstractHelper { @@ -105,6 +105,17 @@ public function getUploader($type, $parameters) return $this->fileUploader; } + /** + * Check a file or directory exists + * + * @param string $fileName + * @return bool + */ + public function isFileExist(string $fileName): bool + { + return $this->mediaDirectory->isExist($this->fileUploader->getDestDir().$fileName); + } + /** * Get all allowed extensions * diff --git a/app/code/Magento/DownloadableImportExport/Model/Export/Product/Type/Downloadable.php b/app/code/Magento/DownloadableImportExport/Model/Export/Product/Type/Downloadable.php new file mode 100644 index 0000000000000..716e65e00d1aa --- /dev/null +++ b/app/code/Magento/DownloadableImportExport/Model/Export/Product/Type/Downloadable.php @@ -0,0 +1,15 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\DownloadableImportExport\Model\Export\Product\Type; + +use Magento\CatalogImportExport\Model\Export\Product\Type\AbstractType; + +/** + * Class Downloadable for composite CatalogImportExport + */ +class Downloadable extends AbstractType +{ +} diff --git a/app/code/Magento/DownloadableImportExport/Model/Export/RowCustomizer.php b/app/code/Magento/DownloadableImportExport/Model/Export/RowCustomizer.php new file mode 100644 index 0000000000000..daa874e829e54 --- /dev/null +++ b/app/code/Magento/DownloadableImportExport/Model/Export/RowCustomizer.php @@ -0,0 +1,170 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\DownloadableImportExport\Model\Export; + +use Magento\Downloadable\Model\LinkRepository; +use Magento\Downloadable\Model\SampleRepository; +use Magento\Catalog\Model\ResourceModel\Product\Collection as ProductCollection; +use Magento\CatalogImportExport\Model\Export\RowCustomizerInterface; +use Magento\CatalogImportExport\Model\Import\Product as ImportProduct; +use Magento\Downloadable\Model\Product\Type as Type; +use Magento\ImportExport\Model\Import; +use Magento\Store\Model\Store; +use Magento\Store\Model\StoreManagerInterface; +use Magento\DownloadableImportExport\Model\Import\Product\Type\Downloadable; + +/** + * Customizes output during export + */ +class RowCustomizer implements RowCustomizerInterface +{ + /** + * @var array + */ + private $downloadableData = []; + + /** + * @var string[] + */ + private $downloadableColumns = [ + Downloadable::COL_DOWNLOADABLE_LINKS, + Downloadable::COL_DOWNLOADABLE_SAMPLES, + ]; + + /** + * @var LinkRepository + */ + private $linkRepository; + + /** + * @var SampleRepository + */ + private $sampleRepository; + + /** + * @var StoreManagerInterface + */ + private $storeManager; + + /** + * @param StoreManagerInterface $storeManager + * @param LinkRepository $linkRepository + * @param SampleRepository $sampleRepository + */ + public function __construct( + StoreManagerInterface $storeManager, + LinkRepository $linkRepository, + SampleRepository $sampleRepository + ) { + $this->storeManager = $storeManager; + $this->linkRepository = $linkRepository; + $this->sampleRepository = $sampleRepository; + } + + /** + * Prepare configurable data for export + * + * @param ProductCollection $collection + * @param int[] $productIds + * @return void + */ + public function prepareData($collection, $productIds): void + { + $productCollection = clone $collection; + $productCollection->addAttributeToFilter('entity_id', ['in' => $productIds]) + ->addAttributeToFilter('type_id', ['eq' => Type::TYPE_DOWNLOADABLE]) + ->addAttributeToSelect('links_title') + ->addAttributeToSelect('samples_title'); + // set global scope during export + $this->storeManager->setCurrentStore(Store::DEFAULT_STORE_ID); + foreach ($collection as $product) { + $productLinks = $this->linkRepository->getLinksByProduct($product); + $productSamples = $this->sampleRepository->getSamplesByProduct($product); + $this->downloadableData[$product->getId()] = []; + $linksData = []; + $samplesData = []; + foreach ($productLinks as $linkId => $link) { + $linkData = $link->getData(); + $linkData['group_title'] = $product->getData('links_title'); + $linksData[$linkId] = $this->optionRowToCellString($linkData); + } + foreach ($productSamples as $sampleId => $sample) { + $sampleData = $sample->getData(); + $sampleData['group_title'] = $product->getData('samples_title'); + $samplesData[$sampleId] = $this->optionRowToCellString($sampleData); + } + $this->downloadableData[$product->getId()] = [ + Downloadable::COL_DOWNLOADABLE_LINKS => implode( + ImportProduct::PSEUDO_MULTI_LINE_SEPARATOR, + $linksData + ), + Downloadable::COL_DOWNLOADABLE_SAMPLES => implode( + Import::DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR, + $samplesData + )]; + } + } + + /** + * Convert option row to cell string + * + * @param array $option + * @return string + */ + private function optionRowToCellString(array $option): string + { + $result = []; + foreach ($option as $attributeCode => $value) { + if ($value) { + $result[] = $attributeCode . ImportProduct::PAIR_NAME_VALUE_SEPARATOR . $value; + } + } + return implode(Import::DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR, $result); + } + + /** + * Set headers columns + * + * @param array $columns + * @return array + */ + public function addHeaderColumns($columns): array + { + return array_merge($columns, $this->downloadableColumns); + } + + /** + * Add downloadable data for export + * + * @param array $dataRow + * @param int $productId + * @return array + */ + public function addData($dataRow, $productId): array + { + if (!empty($this->downloadableData[$productId])) { + $dataRow = array_merge($dataRow, $this->downloadableData[$productId]); + } + return $dataRow; + } + + /** + * Calculate the largest links block + * + * @param array $additionalRowsCount + * @param int $productId + * @return array + */ + public function getAdditionalRowsCount($additionalRowsCount, $productId): array + { + if (!empty($this->downloadableData[$productId])) { + $additionalRowsCount = max($additionalRowsCount, count($this->downloadableData[$productId])); + } + return $additionalRowsCount; + } +} diff --git a/app/code/Magento/DownloadableImportExport/Model/Import/Product/Type/Downloadable.php b/app/code/Magento/DownloadableImportExport/Model/Import/Product/Type/Downloadable.php index c9cdf52f55dd1..f148550dd96bb 100644 --- a/app/code/Magento/DownloadableImportExport/Model/Import/Product/Type/Downloadable.php +++ b/app/code/Magento/DownloadableImportExport/Model/Import/Product/Type/Downloadable.php @@ -896,12 +896,16 @@ protected function parseSampleOption($values) protected function uploadDownloadableFiles($fileName, $type = 'links', $renameFileOff = false) { try { - $res = $this->uploaderHelper->getUploader($type, $this->parameters)->move($fileName, $renameFileOff); - return $res['file']; + $uploader = $this->uploaderHelper->getUploader($type, $this->parameters); + if (!$this->uploaderHelper->isFileExist($fileName)) { + $uploader->move($fileName, $renameFileOff); + $fileName = $uploader['file']; + } } catch (\Exception $e) { $this->_entityModel->addRowError(self::ERROR_MOVE_FILE, $this->rowNum); - return ''; + $fileName = ''; } + return $fileName; } /** diff --git a/app/code/Magento/DownloadableImportExport/Test/Unit/Model/Import/Product/Type/DownloadableTest.php b/app/code/Magento/DownloadableImportExport/Test/Unit/Model/Import/Product/Type/DownloadableTest.php index 9cb6b061b14ee..482bfa4f7c569 100644 --- a/app/code/Magento/DownloadableImportExport/Test/Unit/Model/Import/Product/Type/DownloadableTest.php +++ b/app/code/Magento/DownloadableImportExport/Test/Unit/Model/Import/Product/Type/DownloadableTest.php @@ -9,7 +9,7 @@ use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManager; /** - * Class DownloadableTest + * Class DownloadableTest for downloadable products import * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ @@ -164,7 +164,7 @@ protected function setUp() // 7. $fileHelper $this->uploaderHelper = $this->createPartialMock( \Magento\DownloadableImportExport\Helper\Uploader::class, - ['getUploader'] + ['getUploader', 'isFileExist'] ); $this->uploaderHelper->expects($this->any())->method('getUploader')->willReturn($this->uploaderMock); $this->downloadableHelper = $this->createPartialMock( @@ -660,6 +660,7 @@ public function testSetUploaderDirFalse($newSku, $bunch, $allowImport, $parsedOp $metadataPoolMock->expects($this->any())->method('getLinkField')->willReturn('entity_id'); $this->downloadableHelper->expects($this->atLeastOnce()) ->method('fillExistOptions')->willReturn($parsedOptions['link']); + $this->uploaderHelper->method('isFileExist')->willReturn(false); $this->downloadableModelMock = $this->objectManagerHelper->getObject( \Magento\DownloadableImportExport\Model\Import\Product\Type\Downloadable::class, diff --git a/app/code/Magento/DownloadableImportExport/etc/di.xml b/app/code/Magento/DownloadableImportExport/etc/di.xml new file mode 100644 index 0000000000000..06768d3e72a8b --- /dev/null +++ b/app/code/Magento/DownloadableImportExport/etc/di.xml @@ -0,0 +1,16 @@ +<?xml version="1.0"?> +<!-- +/** + * 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:ObjectManager/etc/config.xsd"> + <type name="Magento\CatalogImportExport\Model\Export\RowCustomizer\Composite"> + <arguments> + <argument name="customizers" xsi:type="array"> + <item name="downloadableProduct" xsi:type="string">Magento\DownloadableImportExport\Model\Export\RowCustomizer</item> + </argument> + </arguments> + </type> +</config> diff --git a/app/code/Magento/DownloadableImportExport/etc/export.xml b/app/code/Magento/DownloadableImportExport/etc/export.xml new file mode 100644 index 0000000000000..b6e419cc2c389 --- /dev/null +++ b/app/code/Magento/DownloadableImportExport/etc/export.xml @@ -0,0 +1,10 @@ +<?xml version="1.0"?> +<!-- +/** + * 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:module:Magento_ImportExport:etc/export.xsd"> + <entityType entity="catalog_product" name="downloadable" model="Magento\DownloadableImportExport\Model\Export\Product\Type\Downloadable" /> +</config> diff --git a/dev/tests/integration/testsuite/Magento/Downloadable/_files/product_downloadable_with_link_url_and_sample_url.php b/dev/tests/integration/testsuite/Magento/Downloadable/_files/product_downloadable_with_link_url_and_sample_url.php new file mode 100644 index 0000000000000..32fed4730adfc --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Downloadable/_files/product_downloadable_with_link_url_and_sample_url.php @@ -0,0 +1,87 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +use Magento\Downloadable\Api\DomainManagerInterface; +use Magento\Store\Model\StoreManagerInterface; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\Downloadable\Api\Data\LinkInterfaceFactory; +use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Downloadable\Model\Product\Type; +use Magento\Catalog\Model\Product\Visibility; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Downloadable\Helper\Download; +use Magento\Downloadable\Model\Link; +use Magento\Downloadable\Api\Data\SampleInterfaceFactory; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Downloadable\Api\Data\LinkInterface; + +$objectManager = Bootstrap::getObjectManager(); + +$storeManager = $objectManager->get(StoreManagerInterface::class); +$storeManager->setCurrentStore($storeManager->getStore('admin')->getId()); + +$domainManager = $objectManager->get(DomainManagerInterface::class); +$domainManager->addDomains( + [ + 'example.com', + 'www.example.com', + 'www.sample.example.com', + 'google.com' + ] +); + +$product = $objectManager->get(ProductInterface::class); +$product + ->setTypeId(Type::TYPE_DOWNLOADABLE) + ->setId(1) + ->setAttributeSetId(4) + ->setName('Downloadable Product') + ->setSku('downloadable-product') + ->setPrice(10) + ->setVisibility(Visibility::VISIBILITY_BOTH) + ->setStatus(Status::STATUS_ENABLED) + ->setLinksPurchasedSeparately(true) + ->setLinksTitle('Links') + ->setSamplesTitle('Samples') + ->setStockData( + [ + 'qty' => 100, + 'is_in_stock' => 1, + 'manage_stock' => 1, + ] + ); + +$linkFactory = $objectManager->get(LinkInterfaceFactory::class); +/** @var LinkInterface $link */ +$link = $linkFactory->create(); +$link->setTitle('Downloadable Product Link'); +$link->setIsShareable(Link::LINK_SHAREABLE_CONFIG); +$link->setLinkUrl('http://example.com/downloadable.txt'); +$link->setLinkType(Download::LINK_TYPE_URL); +$link->setStoreId($product->getStoreId()); +$link->setWebsiteId($product->getStore()->getWebsiteId()); +$link->setProductWebsiteIds($product->getWebsiteIds()); +$link->setSortOrder(1); +$link->setPrice(0); +$link->setNumberOfDownloads(0); + +$sampleFactory = $objectManager->get(SampleInterfaceFactory::class); +$sample = $sampleFactory->create(); +$sample->setTitle('Downloadable Product Sample') + ->setSampleType(Download::LINK_TYPE_URL) + ->setSampleUrl('http://example.com/downloadable.txt') + ->setStoreId($product->getStoreId()) + ->setWebsiteId($product->getStore()->getWebsiteId()) + ->setProductWebsiteIds($product->getWebsiteIds()) + ->setSortOrder(10); + +$extension = $product->getExtensionAttributes(); +$extension->setDownloadableProductLinks([$link]); +$extension->setDownloadableProductSamples([$sample]); +$product->setExtensionAttributes($extension); + +$productRepository = $objectManager->get(ProductRepositoryInterface::class); +$productRepository->save($product); diff --git a/dev/tests/integration/testsuite/Magento/Downloadable/_files/product_downloadable_with_link_url_and_sample_url_rollback.php b/dev/tests/integration/testsuite/Magento/Downloadable/_files/product_downloadable_with_link_url_and_sample_url_rollback.php new file mode 100644 index 0000000000000..9a2e1c74fcd33 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Downloadable/_files/product_downloadable_with_link_url_and_sample_url_rollback.php @@ -0,0 +1,40 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +use Magento\Downloadable\Api\DomainManagerInterface; +use Magento\Framework\Exception\NoSuchEntityException; + +\Magento\TestFramework\Helper\Bootstrap::getInstance()->getInstance()->reinitialize(); + +$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + +/** @var DomainManagerInterface $domainManager */ +$domainManager = $objectManager->get(DomainManagerInterface::class); +$domainManager->removeDomains( + [ + 'example.com', + 'www.example.com', + 'www.sample.example.com', + 'google.com' + ] +); + +/** @var \Magento\Framework\Registry $registry */ +$registry = $objectManager->get(\Magento\Framework\Registry::class); + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); + +/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager + ->get(\Magento\Catalog\Api\ProductRepositoryInterface::class); +try { + $product = $productRepository->get('downloadable-product', false, null, true); + $productRepository->delete($product); +} catch (NoSuchEntityException $e) { // @codingStandardsIgnoreLine +} +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); diff --git a/dev/tests/integration/testsuite/Magento/DownloadableImportExport/Model/DownloadableTest.php b/dev/tests/integration/testsuite/Magento/DownloadableImportExport/Model/DownloadableTest.php index d0e4471e2ea68..861be98c13e72 100644 --- a/dev/tests/integration/testsuite/Magento/DownloadableImportExport/Model/DownloadableTest.php +++ b/dev/tests/integration/testsuite/Magento/DownloadableImportExport/Model/DownloadableTest.php @@ -6,7 +6,11 @@ namespace Magento\DownloadableImportExport\Model; use Magento\CatalogImportExport\Model\AbstractProductExportImportTestCase; +use Magento\Catalog\Model\Product; +/** + * Test export and import downloadable products + */ class DownloadableTest extends AbstractProductExportImportTestCase { /** @@ -17,15 +21,7 @@ public function exportImportDataProvider(): array return [ 'downloadable-product' => [ [ - 'Magento/Downloadable/_files/product_downloadable.php' - ], - [ - 'downloadable-product', - ], - ], - 'downloadable-product-with-files' => [ - [ - 'Magento/Downloadable/_files/product_downloadable_with_files.php' + 'Magento/Downloadable/_files/product_downloadable_with_link_url_and_sample_url.php' ], [ 'downloadable-product', @@ -46,43 +42,54 @@ public function exportImportDataProvider(): array * @param string[] $skippedAttributes * @return void * @dataProvider exportImportDataProvider - * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function testImportExport(array $fixtures, array $skus, array $skippedAttributes = []): void { - $this->markTestSkipped('Uncomment after MAGETWO-38240 resolved'); + $skippedAttributes = array_merge(self::$skippedAttributes, ['downloadable_links']); + parent::testImportExport($fixtures, $skus, $skippedAttributes); } /** * @inheritdoc */ protected function assertEqualsSpecificAttributes( - \Magento\Catalog\Model\Product $expectedProduct, - \Magento\Catalog\Model\Product $actualProduct + Product $expectedProduct, + Product $actualProduct ): void { - $expectedProductLinks = $expectedProduct->getExtensionAttributes()->getDownloadableProductLinks(); + $expectedProductLinks = $expectedProduct->getExtensionAttributes()->getDownloadableProductLinks(); $expectedProductSamples = $expectedProduct->getExtensionAttributes()->getDownloadableProductSamples(); - $actualProductLinks = $actualProduct->getExtensionAttributes()->getDownloadableProductLinks(); + $actualProductLinks = $actualProduct->getExtensionAttributes()->getDownloadableProductLinks(); $actualProductSamples = $actualProduct->getExtensionAttributes()->getDownloadableProductSamples(); $this->assertEquals(count($expectedProductLinks), count($actualProductLinks)); $this->assertEquals(count($expectedProductSamples), count($actualProductSamples)); - - $expectedLinksArray = []; - foreach ($expectedProductLinks as $link) { - $expectedLinksArray[] = $link->getData(); + $actualLinks = $this->getDataWithSortingById($actualProductLinks); + $expectedLinks = $this->getDataWithSortingById($actualProductLinks); + foreach ($actualLinks as $key => $actualLink) { + $this->assertEquals($expectedLinks[$key], $actualLink); } - foreach ($actualProductLinks as $actualLink) { - $this->assertContains($expectedLinksArray, $actualLink->getData()); + $actualSamples = $this->getDataWithSortingById($actualProductSamples); + $expectedSamples = $this->getDataWithSortingById($expectedProductSamples); + foreach ($actualSamples as $key => $actualSample) { + $this->assertEquals($expectedSamples[$key], $actualSample); } + } - $expectedSamplesArray = []; - foreach ($expectedProductSamples as $sample) { - $expectedSamplesArray[] = $sample->getData(); - } - foreach ($actualProductSamples as $actualSample) { - $this->assertContains($expectedSamplesArray, $actualSample->getData()); + /** + * Get data with sorting by id + * + * @param array $objects + * + * @return array + */ + private function getDataWithSortingById(array $objects) + { + $result = []; + foreach ($objects as $object) { + $result[$object->getId()] = $object->getData(); } + + return $result; } } From b6880b20e8cd7049d69f67cb5c8fb60e092384db Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Wed, 15 Jan 2020 10:40:01 +0200 Subject: [PATCH 0833/1143] MC-23986: Cart price rule based on payment methods not aplied in checkout --- ...ingAddressAndProductWithTierPricesTest.xml | 1 + ...ippingMethodInReviewAndPaymentStepTest.xml | 12 +--- .../web/js/action/select-payment-method.js | 2 +- .../Model/Checkout/Plugin/GuestValidation.php | 31 +++------- .../Model/Checkout/Plugin/Validation.php | 37 ++++------- .../Checkout/Plugin/GuestValidationTest.php | 37 +---------- .../Model/Checkout/Plugin/ValidationTest.php | 40 ++++-------- .../Promo/Quote/Edit/Tab/Conditions.php | 28 ++++++--- .../SalesRule/Model/Quote/Discount.php | 6 ++ .../Model/Rule/Condition/Address.php | 1 + ...StorefrontApplyDiscountCodeActionGroup.xml | 2 +- .../view/frontend/requirejs-config.js | 14 +++++ .../js/action/select-payment-method-mixin.js | 50 +++++++++++++++ .../view/frontend/web/js/model/coupon.js | 49 +++++++++++++++ .../frontend/web/js/view/payment/discount.js | 11 ++-- .../Model/Rule/Condition/AddressTest.php | 50 +++++++++++++++ .../Model/Rule/Condition/ConditionHelper.php | 62 +++++++++++++++++++ .../Model/Rule/Condition/ProductTest.php | 55 ++-------------- .../SalesRule/_files/rules_payment_method.php | 47 ++++++++++++++ .../Php/_files/phpcpd/blacklist/common.txt | 3 +- 20 files changed, 346 insertions(+), 192 deletions(-) create mode 100644 app/code/Magento/SalesRule/view/frontend/requirejs-config.js create mode 100644 app/code/Magento/SalesRule/view/frontend/web/js/action/select-payment-method-mixin.js create mode 100644 app/code/Magento/SalesRule/view/frontend/web/js/model/coupon.js create mode 100644 dev/tests/integration/testsuite/Magento/SalesRule/Model/Rule/Condition/AddressTest.php create mode 100644 dev/tests/integration/testsuite/Magento/SalesRule/Model/Rule/Condition/ConditionHelper.php create mode 100644 dev/tests/integration/testsuite/Magento/SalesRule/_files/rules_payment_method.php diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndProductWithTierPricesTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndProductWithTierPricesTest.xml index 07d29aa0aac4a..92eae461019a2 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndProductWithTierPricesTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndProductWithTierPricesTest.xml @@ -77,6 +77,7 @@ <checkOption selector="{{CheckoutPaymentSection.bankTransfer}}" stepKey="selectBankTransfer"/> <waitForElementVisible selector="{{CheckoutPaymentSection.billingAddressNotSameBankTransferCheckbox}}" stepKey="waitForElementToBeVisible"/> <uncheckOption selector="{{CheckoutPaymentSection.billingAddressNotSameBankTransferCheckbox}}" stepKey="uncheckSameBillingAndShippingAddress"/> + <waitForElementVisible selector="{{CheckoutShippingSection.editActiveAddressButton}}" stepKey="waitForEditButtonToBeVisible"/> <conditionalClick selector="{{CheckoutShippingSection.editActiveAddressButton}}" dependentSelector="{{CheckoutShippingSection.editActiveAddressButton}}" visible="true" stepKey="clickEditButton"/> <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontNotApplicableShippingMethodInReviewAndPaymentStepTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontNotApplicableShippingMethodInReviewAndPaymentStepTest.xml index 1a427bbe77166..f11d25a30f073 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontNotApplicableShippingMethodInReviewAndPaymentStepTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontNotApplicableShippingMethodInReviewAndPaymentStepTest.xml @@ -27,12 +27,6 @@ <magentoCLI command="config:set {{AdminFreeshippingActiveConfigData.path}} {{AdminFreeshippingActiveConfigData.enabled}}" stepKey="enableFreeShippingMethod" /> <magentoCLI command="config:set {{AdminFreeshippingMinimumOrderAmountConfigData.path}} {{AdminFreeshippingMinimumOrderAmountConfigData.hundred}}" stepKey="setFreeShippingMethodMinimumOrderAmountToBe100" /> - <!--Set Fedex configs data--> - <magentoCLI command="config:set {{AdminFedexEnableForCheckoutConfigData.path}} {{AdminFedexEnableForCheckoutConfigData.value}}" stepKey="enableCheckout"/> - <magentoCLI command="config:set {{AdminFedexEnableSandboxModeConfigData.path}} {{AdminFedexEnableSandboxModeConfigData.value}}" stepKey="enableSandbox"/> - <magentoCLI command="config:set {{AdminFedexEnableDebugConfigData.path}} {{AdminFedexEnableDebugConfigData.value}}" stepKey="enableDebug"/> - <magentoCLI command="config:set {{AdminFedexEnableShowMethodConfigData.path}} {{AdminFedexEnableShowMethodConfigData.value}}" stepKey="enableShowMethod"/> - <!--Set StoreInformation configs data--> <magentoCLI command="config:set {{AdminGeneralSetStoreNameConfigData.path}} '{{AdminGeneralSetStoreNameConfigData.value}}'" stepKey="setStoreInformationName"/> <magentoCLI command="config:set {{AdminGeneralSetStorePhoneConfigData.path}} {{DE_Address_Berlin_Not_Default_Address.telephone}}" stepKey="setStoreInformationPhone"/> @@ -75,10 +69,6 @@ <magentoCLI command="config:set {{AdminFreeshippingMinimumOrderAmountConfigData.path}} {{AdminFreeshippingMinimumOrderAmountConfigData.default}}" stepKey="setFreeShippingMethodMinimumOrderAmountAsDefault" /> <magentoCLI command="config:set {{AdminFreeshippingActiveConfigData.path}} {{AdminFreeshippingActiveConfigData.disabled}}" stepKey="disableFreeShippingMethod" /> <!--Reset configs--> - <magentoCLI command="config:set {{AdminFedexDisableForCheckoutConfigData.path}} {{AdminFedexDisableForCheckoutConfigData.value}}" stepKey="disableCheckout"/> - <magentoCLI command="config:set {{AdminFedexDisableSandboxModeConfigData.path}} {{AdminFedexDisableSandboxModeConfigData.value}}" stepKey="disableSandbox"/> - <magentoCLI command="config:set {{AdminFedexDisableDebugConfigData.path}} {{AdminFedexDisableDebugConfigData.value}}" stepKey="disableDebug"/> - <magentoCLI command="config:set {{AdminFedexDisableShowMethodConfigData.path}} {{AdminFedexDisableShowMethodConfigData.value}}" stepKey="disableShowMethod"/> <magentoCLI command="config:set {{AdminGeneralSetStoreNameConfigData.path}} ''" stepKey="setStoreInformationName"/> <magentoCLI command="config:set {{AdminGeneralSetStorePhoneConfigData.path}} ''" stepKey="setStoreInformationPhone"/> <magentoCLI command="config:set {{AdminGeneralSetCityConfigData.path}} ''" stepKey="setStoreInformationCity"/> @@ -187,7 +177,7 @@ <!-- Assert Shipping total is not yet calculated --> <actionGroup ref="AssertStorefrontNotCalculatedValueInShippingTotalInOrderSummaryActionGroup" stepKey="assertNotYetCalculated2"/> - <!-- Assert order cannot be placed and error message will shown. --> + <!-- Assert order cannot be placed and error message will shown. --> <actionGroup ref="AssertStorefrontOrderCannotBePlacedActionGroup" stepKey="assertOrderCannotBePlaced2"> <argument name="error" value="The shipping method is missing. Select the shipping method and try again."/> </actionGroup> diff --git a/app/code/Magento/Checkout/view/frontend/web/js/action/select-payment-method.js b/app/code/Magento/Checkout/view/frontend/web/js/action/select-payment-method.js index 34f1700749794..5adbd9356a8d8 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/action/select-payment-method.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/action/select-payment-method.js @@ -7,7 +7,7 @@ * @api */ define([ - '../model/quote' + 'Magento_Checkout/js/model/quote' ], function (quote) { 'use strict'; diff --git a/app/code/Magento/CheckoutAgreements/Model/Checkout/Plugin/GuestValidation.php b/app/code/Magento/CheckoutAgreements/Model/Checkout/Plugin/GuestValidation.php index fbceca0906702..95330c9d01381 100644 --- a/app/code/Magento/CheckoutAgreements/Model/Checkout/Plugin/GuestValidation.php +++ b/app/code/Magento/CheckoutAgreements/Model/Checkout/Plugin/GuestValidation.php @@ -11,7 +11,7 @@ use Magento\CheckoutAgreements\Model\Api\SearchCriteria\ActiveStoreAgreementsFilter; /** - * Class GuestValidation + * Guest checkout agreements validation. * * Plugin that checks if checkout agreement enabled and validates all agreements. * Current plugin is duplicate from Magento\CheckoutAgreements\Model\Checkout\Plugin\Validation due to different @@ -58,6 +58,8 @@ public function __construct( } /** + * Validates agreements before save payment information and order placing. + * * @param \Magento\Checkout\Api\GuestPaymentInformationManagementInterface $subject * @param string $cartId * @param string $email @@ -80,28 +82,8 @@ public function beforeSavePaymentInformationAndPlaceOrder( } /** - * @param \Magento\Checkout\Api\GuestPaymentInformationManagementInterface $subject - * @param string $cartId - * @param string $email - * @param \Magento\Quote\Api\Data\PaymentInterface $paymentMethod - * @param \Magento\Quote\Api\Data\AddressInterface|null $billingAddress - * @throws \Magento\Framework\Exception\CouldNotSaveException - * @return void - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function beforeSavePaymentInformation( - \Magento\Checkout\Api\GuestPaymentInformationManagementInterface $subject, - $cartId, - $email, - \Magento\Quote\Api\Data\PaymentInterface $paymentMethod, - \Magento\Quote\Api\Data\AddressInterface $billingAddress = null - ) { - if ($this->isAgreementEnabled()) { - $this->validateAgreements($paymentMethod); - } - } - - /** + * Validates agreements. + * * @param \Magento\Quote\Api\Data\PaymentInterface $paymentMethod * @throws \Magento\Framework\Exception\CouldNotSaveException * @return void @@ -123,7 +105,8 @@ private function validateAgreements(\Magento\Quote\Api\Data\PaymentInterface $pa } /** - * Verify if agreement validation needed + * Verify if agreement validation needed. + * * @return bool */ private function isAgreementEnabled() diff --git a/app/code/Magento/CheckoutAgreements/Model/Checkout/Plugin/Validation.php b/app/code/Magento/CheckoutAgreements/Model/Checkout/Plugin/Validation.php index 67e2a6c9ec334..04f625238d249 100644 --- a/app/code/Magento/CheckoutAgreements/Model/Checkout/Plugin/Validation.php +++ b/app/code/Magento/CheckoutAgreements/Model/Checkout/Plugin/Validation.php @@ -11,19 +11,19 @@ use Magento\CheckoutAgreements\Model\Api\SearchCriteria\ActiveStoreAgreementsFilter; /** - * Class Validation + * Checkout agreements validation. */ class Validation { /** * @var \Magento\Framework\App\Config\ScopeConfigInterface */ - protected $scopeConfiguration; + private $scopeConfiguration; /** * @var \Magento\Checkout\Api\AgreementsValidatorInterface */ - protected $agreementsValidator; + private $agreementsValidator; /** * @var \Magento\CheckoutAgreements\Api\CheckoutAgreementsListInterface @@ -54,6 +54,8 @@ public function __construct( } /** + * Validates agreements before save payment information and order placing. + * * @param \Magento\Checkout\Api\PaymentInformationManagementInterface $subject * @param int $cartId * @param \Magento\Quote\Api\Data\PaymentInterface $paymentMethod @@ -74,31 +76,13 @@ public function beforeSavePaymentInformationAndPlaceOrder( } /** - * @param \Magento\Checkout\Api\PaymentInformationManagementInterface $subject - * @param int $cartId - * @param \Magento\Quote\Api\Data\PaymentInterface $paymentMethod - * @param \Magento\Quote\Api\Data\AddressInterface|null $billingAddress - * @throws \Magento\Framework\Exception\CouldNotSaveException - * @return void - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function beforeSavePaymentInformation( - \Magento\Checkout\Api\PaymentInformationManagementInterface $subject, - $cartId, - \Magento\Quote\Api\Data\PaymentInterface $paymentMethod, - \Magento\Quote\Api\Data\AddressInterface $billingAddress = null - ) { - if ($this->isAgreementEnabled()) { - $this->validateAgreements($paymentMethod); - } - } - - /** + * Validates agreements. + * * @param \Magento\Quote\Api\Data\PaymentInterface $paymentMethod * @throws \Magento\Framework\Exception\CouldNotSaveException * @return void */ - protected function validateAgreements(\Magento\Quote\Api\Data\PaymentInterface $paymentMethod) + private function validateAgreements(\Magento\Quote\Api\Data\PaymentInterface $paymentMethod) { $agreements = $paymentMethod->getExtensionAttributes() === null ? [] @@ -115,10 +99,11 @@ protected function validateAgreements(\Magento\Quote\Api\Data\PaymentInterface $ } /** - * Verify if agreement validation needed + * Verify if agreement validation needed. + * * @return bool */ - protected function isAgreementEnabled() + private function isAgreementEnabled() { $isAgreementsEnabled = $this->scopeConfiguration->isSetFlag( AgreementsProvider::PATH_ENABLED, diff --git a/app/code/Magento/CheckoutAgreements/Test/Unit/Model/Checkout/Plugin/GuestValidationTest.php b/app/code/Magento/CheckoutAgreements/Test/Unit/Model/Checkout/Plugin/GuestValidationTest.php index 3d7b910c7abc5..b685d3edff275 100644 --- a/app/code/Magento/CheckoutAgreements/Test/Unit/Model/Checkout/Plugin/GuestValidationTest.php +++ b/app/code/Magento/CheckoutAgreements/Test/Unit/Model/Checkout/Plugin/GuestValidationTest.php @@ -10,7 +10,6 @@ use Magento\Store\Model\ScopeInterface; /** - * Class GuestValidationTest * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class GuestValidationTest extends \PHPUnit\Framework\TestCase @@ -109,7 +108,7 @@ public function testBeforeSavePaymentInformationAndPlaceOrder() $this->paymentMock->expects(static::atLeastOnce()) ->method('getExtensionAttributes') ->willReturn($this->extensionAttributesMock); - $this->model->beforeSavePaymentInformation( + $this->model->beforeSavePaymentInformationAndPlaceOrder( $this->subjectMock, $cartId, $email, @@ -144,7 +143,7 @@ public function testBeforeSavePaymentInformationAndPlaceOrderIfAgreementsNotVali $this->paymentMock->expects(static::atLeastOnce()) ->method('getExtensionAttributes') ->willReturn($this->extensionAttributesMock); - $this->model->beforeSavePaymentInformation( + $this->model->beforeSavePaymentInformationAndPlaceOrder( $this->subjectMock, $cartId, $email, @@ -156,36 +155,4 @@ public function testBeforeSavePaymentInformationAndPlaceOrderIfAgreementsNotVali "The order wasn't placed. First, agree to the terms and conditions, then try placing your order again." ); } - - public function testBeforeSavePaymentInformation() - { - $cartId = 100; - $email = 'email@example.com'; - $agreements = [1, 2, 3]; - $this->scopeConfigMock - ->expects($this->once()) - ->method('isSetFlag') - ->with(AgreementsProvider::PATH_ENABLED, ScopeInterface::SCOPE_STORE) - ->willReturn(true); - $searchCriteriaMock = $this->createMock(\Magento\Framework\Api\SearchCriteria::class); - $this->agreementsFilterMock->expects($this->once()) - ->method('buildSearchCriteria') - ->willReturn($searchCriteriaMock); - $this->checkoutAgreementsListMock->expects($this->once()) - ->method('getList') - ->with($searchCriteriaMock) - ->willReturn([1]); - $this->extensionAttributesMock->expects($this->once())->method('getAgreementIds')->willReturn($agreements); - $this->agreementsValidatorMock->expects($this->once())->method('isValid')->with($agreements)->willReturn(true); - $this->paymentMock->expects(static::atLeastOnce()) - ->method('getExtensionAttributes') - ->willReturn($this->extensionAttributesMock); - $this->model->beforeSavePaymentInformation( - $this->subjectMock, - $cartId, - $email, - $this->paymentMock, - $this->addressMock - ); - } } diff --git a/app/code/Magento/CheckoutAgreements/Test/Unit/Model/Checkout/Plugin/ValidationTest.php b/app/code/Magento/CheckoutAgreements/Test/Unit/Model/Checkout/Plugin/ValidationTest.php index 7f11fad202401..d3422ae6a8893 100644 --- a/app/code/Magento/CheckoutAgreements/Test/Unit/Model/Checkout/Plugin/ValidationTest.php +++ b/app/code/Magento/CheckoutAgreements/Test/Unit/Model/Checkout/Plugin/ValidationTest.php @@ -10,7 +10,6 @@ use Magento\Store\Model\ScopeInterface; /** - * Class ValidationTest * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class ValidationTest extends \PHPUnit\Framework\TestCase @@ -108,7 +107,12 @@ public function testBeforeSavePaymentInformationAndPlaceOrder() $this->paymentMock->expects(static::atLeastOnce()) ->method('getExtensionAttributes') ->willReturn($this->extensionAttributesMock); - $this->model->beforeSavePaymentInformation($this->subjectMock, $cartId, $this->paymentMock, $this->addressMock); + $this->model->beforeSavePaymentInformationAndPlaceOrder( + $this->subjectMock, + $cartId, + $this->paymentMock, + $this->addressMock + ); } /** @@ -136,35 +140,15 @@ public function testBeforeSavePaymentInformationAndPlaceOrderIfAgreementsNotVali $this->paymentMock->expects(static::atLeastOnce()) ->method('getExtensionAttributes') ->willReturn($this->extensionAttributesMock); - $this->model->beforeSavePaymentInformation($this->subjectMock, $cartId, $this->paymentMock, $this->addressMock); + $this->model->beforeSavePaymentInformationAndPlaceOrder( + $this->subjectMock, + $cartId, + $this->paymentMock, + $this->addressMock + ); $this->expectExceptionMessage( "The order wasn't placed. First, agree to the terms and conditions, then try placing your order again." ); } - - public function testBeforeSavePaymentInformation() - { - $cartId = 100; - $agreements = [1, 2, 3]; - $this->scopeConfigMock - ->expects($this->once()) - ->method('isSetFlag') - ->with(AgreementsProvider::PATH_ENABLED, ScopeInterface::SCOPE_STORE) - ->willReturn(true); - $searchCriteriaMock = $this->createMock(\Magento\Framework\Api\SearchCriteria::class); - $this->agreementsFilterMock->expects($this->once()) - ->method('buildSearchCriteria') - ->willReturn($searchCriteriaMock); - $this->checkoutAgreementsListMock->expects($this->once()) - ->method('getList') - ->with($searchCriteriaMock) - ->willReturn([1]); - $this->extensionAttributesMock->expects($this->once())->method('getAgreementIds')->willReturn($agreements); - $this->agreementsValidatorMock->expects($this->once())->method('isValid')->with($agreements)->willReturn(true); - $this->paymentMock->expects(static::atLeastOnce()) - ->method('getExtensionAttributes') - ->willReturn($this->extensionAttributesMock); - $this->model->beforeSavePaymentInformation($this->subjectMock, $cartId, $this->paymentMock, $this->addressMock); - } } diff --git a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Conditions.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Conditions.php index 1038f289eada2..ff905bf5cb9ff 100644 --- a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Conditions.php +++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Conditions.php @@ -3,10 +3,19 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab; use Magento\Framework\App\ObjectManager; +use Magento\Framework\Data\Form\Element\Fieldset; +use Magento\SalesRule\Model\Rule; +/** + * Block for rendering Conditions tab on Sales Rules creation page. + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class Conditions extends \Magento\Backend\Block\Widget\Form\Generic implements \Magento\Ui\Component\Layout\Tabs\TabInterface { @@ -33,8 +42,6 @@ class Conditions extends \Magento\Backend\Block\Widget\Form\Generic implements private $ruleFactory; /** - * Constructor - * * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Framework\Registry $registry * @param \Magento\Framework\Data\FormFactory $formFactory @@ -60,7 +67,8 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc + * * @codeCoverageIgnore */ public function getTabClass() @@ -69,7 +77,7 @@ public function getTabClass() } /** - * {@inheritdoc} + * @inheritdoc */ public function getTabUrl() { @@ -77,7 +85,7 @@ public function getTabUrl() } /** - * {@inheritdoc} + * @inheritdoc */ public function isAjaxLoaded() { @@ -85,7 +93,7 @@ public function isAjaxLoaded() } /** - * {@inheritdoc} + * @inheritdoc */ public function getTabLabel() { @@ -93,7 +101,7 @@ public function getTabLabel() } /** - * {@inheritdoc} + * @inheritdoc */ public function getTabTitle() { @@ -101,7 +109,7 @@ public function getTabTitle() } /** - * {@inheritdoc} + * @inheritdoc */ public function canShowTab() { @@ -109,7 +117,7 @@ public function canShowTab() } /** - * {@inheritdoc} + * @inheritdoc */ public function isHidden() { @@ -133,7 +141,7 @@ protected function _prepareForm() /** * Handles addition of conditions tab to supplied form. * - * @param \Magento\SalesRule\Model\Rule $model + * @param Rule $model * @param string $fieldsetId * @param string $formName * @return \Magento\Framework\Data\Form diff --git a/app/code/Magento/SalesRule/Model/Quote/Discount.php b/app/code/Magento/SalesRule/Model/Quote/Discount.php index 69abac8309f90..a580a8f9d2eaa 100644 --- a/app/code/Magento/SalesRule/Model/Quote/Discount.php +++ b/app/code/Magento/SalesRule/Model/Quote/Discount.php @@ -85,6 +85,7 @@ public function __construct( * @param \Magento\Quote\Model\Quote\Address\Total $total * @return $this * @SuppressWarnings(PHPMD.CyclomaticComplexity) + * @SuppressWarnings(PHPMD.NPathComplexity) */ public function collect( \Magento\Quote\Model\Quote $quote, @@ -95,6 +96,11 @@ public function collect( $store = $this->storeManager->getStore($quote->getStoreId()); $address = $shippingAssignment->getShipping()->getAddress(); + + if ($quote->currentPaymentWasSet()) { + $address->setPaymentMethod($quote->getPayment()->getMethod()); + } + $this->calculator->reset($address); $items = $shippingAssignment->getItems(); diff --git a/app/code/Magento/SalesRule/Model/Rule/Condition/Address.php b/app/code/Magento/SalesRule/Model/Rule/Condition/Address.php index 29cdf34c5a784..cf6301cb31a9c 100644 --- a/app/code/Magento/SalesRule/Model/Rule/Condition/Address.php +++ b/app/code/Magento/SalesRule/Model/Rule/Condition/Address.php @@ -65,6 +65,7 @@ public function loadAttributeOptions() 'base_subtotal' => __('Subtotal'), 'total_qty' => __('Total Items Quantity'), 'weight' => __('Total Weight'), + 'payment_method' => __('Payment Method'), 'shipping_method' => __('Shipping Method'), 'postcode' => __('Shipping Postcode'), 'region' => __('Shipping Region'), diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontApplyDiscountCodeActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontApplyDiscountCodeActionGroup.xml index 063409e9fc7ea..3cf96a8b3dc06 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontApplyDiscountCodeActionGroup.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontApplyDiscountCodeActionGroup.xml @@ -15,7 +15,7 @@ <click selector="{{DiscountSection.DiscountTab}}" stepKey="clickToAddDiscount"/> <fillField selector="{{DiscountSection.DiscountInput}}" userInput="{{discountCode}}" stepKey="fillFieldDiscountCode"/> <click selector="{{DiscountSection.ApplyCodeBtn}}" stepKey="clickToApplyDiscount"/> - <waitForPageLoad stepKey="waitForDiscountToBeAdded"/> + <waitForElement selector="{{DiscountSection.DiscountVerificationMsg}}" time="30" stepKey="waitForDiscountToBeAdded"/> <see selector="{{DiscountSection.DiscountVerificationMsg}}" userInput="Your coupon was successfully applied" stepKey="assertDiscountApplyMessage"/> </actionGroup> </actionGroups> diff --git a/app/code/Magento/SalesRule/view/frontend/requirejs-config.js b/app/code/Magento/SalesRule/view/frontend/requirejs-config.js new file mode 100644 index 0000000000000..13b701c6fe65a --- /dev/null +++ b/app/code/Magento/SalesRule/view/frontend/requirejs-config.js @@ -0,0 +1,14 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +var config = { + config: { + mixins: { + 'Magento_Checkout/js/action/select-payment-method': { + 'Magento_SalesRule/js/action/select-payment-method-mixin': true + } + } + } +}; diff --git a/app/code/Magento/SalesRule/view/frontend/web/js/action/select-payment-method-mixin.js b/app/code/Magento/SalesRule/view/frontend/web/js/action/select-payment-method-mixin.js new file mode 100644 index 0000000000000..50d54d4e59789 --- /dev/null +++ b/app/code/Magento/SalesRule/view/frontend/web/js/action/select-payment-method-mixin.js @@ -0,0 +1,50 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +define([ + 'jquery', + 'mage/utils/wrapper', + 'Magento_Checkout/js/model/quote', + 'Magento_SalesRule/js/model/payment/discount-messages', + 'Magento_Checkout/js/action/set-payment-information', + 'Magento_Checkout/js/action/get-totals', + 'Magento_SalesRule/js/model/coupon' +], function ($, wrapper, quote, messageContainer, setPaymentInformationAction, getTotalsAction, coupon) { + 'use strict'; + + return function (selectPaymentMethodAction) { + + return wrapper.wrap(selectPaymentMethodAction, function (originalSelectPaymentMethodAction, paymentMethod) { + + originalSelectPaymentMethodAction(paymentMethod); + + $.when( + setPaymentInformationAction( + messageContainer, + { + method: paymentMethod.method + } + ) + ).done( + function () { + var deferred = $.Deferred(), + + /** + * Update coupon form. + */ + updateCouponCallback = function () { + if (quote.totals() && !quote.totals()['coupon_code']) { + coupon.setCouponCode(''); + coupon.setIsApplied(false); + } + }; + + getTotalsAction([], deferred); + $.when(deferred).done(updateCouponCallback); + } + ); + }); + }; + +}); diff --git a/app/code/Magento/SalesRule/view/frontend/web/js/model/coupon.js b/app/code/Magento/SalesRule/view/frontend/web/js/model/coupon.js new file mode 100644 index 0000000000000..1e3e057bbb401 --- /dev/null +++ b/app/code/Magento/SalesRule/view/frontend/web/js/model/coupon.js @@ -0,0 +1,49 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +/** + * Coupon model. + */ +define([ + 'ko', + 'domReady!' +], function (ko) { + 'use strict'; + + var couponCode = ko.observable(null), + isApplied = ko.observable(null); + + return { + couponCode: couponCode, + isApplied: isApplied, + + /** + * @return {*} + */ + getCouponCode: function () { + return couponCode; + }, + + /** + * @return {Boolean} + */ + getIsApplied: function () { + return isApplied; + }, + + /** + * @param {*} couponCodeValue + */ + setCouponCode: function (couponCodeValue) { + couponCode(couponCodeValue); + }, + + /** + * @param {Boolean} isAppliedValue + */ + setIsApplied: function (isAppliedValue) { + isApplied(isAppliedValue); + } + }; +}); diff --git a/app/code/Magento/SalesRule/view/frontend/web/js/view/payment/discount.js b/app/code/Magento/SalesRule/view/frontend/web/js/view/payment/discount.js index d2902d8863f3d..9c83cb7ba40ba 100644 --- a/app/code/Magento/SalesRule/view/frontend/web/js/view/payment/discount.js +++ b/app/code/Magento/SalesRule/view/frontend/web/js/view/payment/discount.js @@ -9,18 +9,19 @@ define([ 'uiComponent', 'Magento_Checkout/js/model/quote', 'Magento_SalesRule/js/action/set-coupon-code', - 'Magento_SalesRule/js/action/cancel-coupon' -], function ($, ko, Component, quote, setCouponCodeAction, cancelCouponAction) { + 'Magento_SalesRule/js/action/cancel-coupon', + 'Magento_SalesRule/js/model/coupon' +], function ($, ko, Component, quote, setCouponCodeAction, cancelCouponAction, coupon) { 'use strict'; var totals = quote.getTotals(), - couponCode = ko.observable(null), - isApplied; + couponCode = coupon.getCouponCode(), + isApplied = coupon.getIsApplied(); if (totals()) { couponCode(totals()['coupon_code']); } - isApplied = ko.observable(couponCode() != null); + isApplied(couponCode() != null); return Component.extend({ defaults: { diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/Model/Rule/Condition/AddressTest.php b/dev/tests/integration/testsuite/Magento/SalesRule/Model/Rule/Condition/AddressTest.php new file mode 100644 index 0000000000000..17730262d2dfd --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/SalesRule/Model/Rule/Condition/AddressTest.php @@ -0,0 +1,50 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\SalesRule\Model\Rule\Condition; + +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; + +/** + * Test for \Magento\SalesRule\Model\Rule\Condition\Address. + */ +class AddressTest extends TestCase +{ + use ConditionHelper; + + /** + * @var \Magento\Framework\ObjectManagerInterface + */ + private $objectManager; + + /** + * @inheritDoc + */ + protected function setUp() + { + $this->objectManager = Bootstrap::getObjectManager(); + } + + /** + * Tests cart price rule validation. + * + * @magentoDbIsolation enabled + * @magentoAppIsolation enabled + * @magentoConfigFixture default_store payment/checkmo/active 1 + * @magentoDataFixture Magento/SalesRule/_files/rules_payment_method.php + * @magentoDataFixture Magento/Checkout/_files/quote_with_payment_saved.php + */ + public function testValidateRule() + { + $quote = $this->getQuote('test_order_1_with_payment'); + $rule = $this->getSalesRule('50% Off on Checkmo Payment Method'); + + $this->assertTrue( + $rule->validate($quote->getBillingAddress()), + 'Cart price rule validation failed.' + ); + } +} diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/Model/Rule/Condition/ConditionHelper.php b/dev/tests/integration/testsuite/Magento/SalesRule/Model/Rule/Condition/ConditionHelper.php new file mode 100644 index 0000000000000..e857ab902fcc5 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/SalesRule/Model/Rule/Condition/ConditionHelper.php @@ -0,0 +1,62 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\SalesRule\Model\Rule\Condition; + +use Magento\Framework\Api\SearchCriteriaBuilder; +use Magento\Quote\Api\CartRepositoryInterface; +use Magento\Quote\Api\Data\CartInterface; +use Magento\SalesRule\Api\RuleRepositoryInterface; + +/** + * Helper class for testing cart price rule conditions. + */ +trait ConditionHelper +{ + /** + * Gets quote by reserved order id. + * + * @param string $reservedOrderId + * @return CartInterface + */ + private function getQuote($reservedOrderId) + { + /** @var SearchCriteriaBuilder $searchCriteriaBuilder */ + $searchCriteriaBuilder = $this->objectManager->get(SearchCriteriaBuilder::class); + $searchCriteria = $searchCriteriaBuilder->addFilter('reserved_order_id', $reservedOrderId) + ->create(); + + /** @var CartRepositoryInterface $quoteRepository */ + $quoteRepository = $this->objectManager->get(CartRepositoryInterface::class); + $items = $quoteRepository->getList($searchCriteria)->getItems(); + return array_pop($items); + } + + /** + * Gets rule by name. + * + * @param string $name + * @return \Magento\SalesRule\Model\Rule + * @throws \Magento\Framework\Exception\InputException + * @throws \Magento\Framework\Exception\NoSuchEntityException + */ + private function getSalesRule(string $name): \Magento\SalesRule\Model\Rule + { + /** @var SearchCriteriaBuilder $searchCriteriaBuilder */ + $searchCriteriaBuilder = $this->objectManager->get(SearchCriteriaBuilder::class); + $searchCriteria = $searchCriteriaBuilder->addFilter('name', $name) + ->create(); + + /** @var CartRepositoryInterface $quoteRepository */ + $ruleRepository = $this->objectManager->get(RuleRepositoryInterface::class); + $items = $ruleRepository->getList($searchCriteria)->getItems(); + + $rule = array_pop($items); + /** @var \Magento\SalesRule\Model\Converter\ToModel $converter */ + $converter = $this->objectManager->get(\Magento\SalesRule\Model\Converter\ToModel::class); + + return $converter->toModel($rule); + } +} 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 70fa11fc78c87..917ff085f7429 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 @@ -6,21 +6,21 @@ namespace Magento\SalesRule\Model\Rule\Condition; -use Magento\Quote\Api\CartRepositoryInterface; -use Magento\Framework\Api\SearchCriteriaBuilder; -use Magento\Quote\Api\Data\CartInterface; -use Magento\SalesRule\Api\RuleRepositoryInterface; - /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class ProductTest extends \PHPUnit\Framework\TestCase { + use ConditionHelper; + /** * @var \Magento\Framework\ObjectManagerInterface */ private $objectManager; + /** + * @inheritDoc + */ protected function setUp() { $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); @@ -127,49 +127,4 @@ public function testValidateQtySalesRuleWithConfigurable() $rule->validate($quote->getBillingAddress()) ); } - - /** - * Gets quote by reserved order id. - * - * @param string $reservedOrderId - * @return CartInterface - */ - private function getQuote($reservedOrderId) - { - /** @var SearchCriteriaBuilder $searchCriteriaBuilder */ - $searchCriteriaBuilder = $this->objectManager->get(SearchCriteriaBuilder::class); - $searchCriteria = $searchCriteriaBuilder->addFilter('reserved_order_id', $reservedOrderId) - ->create(); - - /** @var CartRepositoryInterface $quoteRepository */ - $quoteRepository = $this->objectManager->get(CartRepositoryInterface::class); - $items = $quoteRepository->getList($searchCriteria)->getItems(); - return array_pop($items); - } - - /** - * Gets rule by name. - * - * @param string $name - * @return \Magento\SalesRule\Model\Rule - * @throws \Magento\Framework\Exception\InputException - * @throws \Magento\Framework\Exception\NoSuchEntityException - */ - private function getSalesRule(string $name): \Magento\SalesRule\Model\Rule - { - /** @var SearchCriteriaBuilder $searchCriteriaBuilder */ - $searchCriteriaBuilder = $this->objectManager->get(SearchCriteriaBuilder::class); - $searchCriteria = $searchCriteriaBuilder->addFilter('name', $name) - ->create(); - - /** @var CartRepositoryInterface $quoteRepository */ - $ruleRepository = $this->objectManager->get(RuleRepositoryInterface::class); - $items = $ruleRepository->getList($searchCriteria)->getItems(); - - $rule = array_pop($items); - /** @var \Magento\SalesRule\Model\Converter\ToModel $converter */ - $converter = $this->objectManager->get(\Magento\SalesRule\Model\Converter\ToModel::class); - - return $converter->toModel($rule); - } } diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/_files/rules_payment_method.php b/dev/tests/integration/testsuite/Magento/SalesRule/_files/rules_payment_method.php new file mode 100644 index 0000000000000..25f208d34d8e0 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/SalesRule/_files/rules_payment_method.php @@ -0,0 +1,47 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +use Magento\TestFramework\Helper\Bootstrap; + +/** @var \Magento\SalesRule\Model\Rule $rule */ +$salesRule = Bootstrap::getObjectManager()->create(\Magento\SalesRule\Model\Rule::class); +$salesRule->setData( + [ + 'name' => '50% Off on Checkmo Payment Method', + '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' => 50, + 'discount_step' => 0, + 'stop_rules_processing' => 1, + 'website_ids' => [ + 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' => 'any', + 'conditions' => + [ + [ + 'type' => \Magento\SalesRule\Model\Rule\Condition\Address::class, + 'attribute' => 'payment_method', + 'operator' => '==', + 'value' => 'checkmo' + ], + ], +]); + +$salesRule->save(); diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt index 59b171a86e1cd..411f02e2c5930 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt @@ -217,4 +217,5 @@ Magento/Config/App/Config/Type Magento/InventoryReservationCli/Test/Integration Magento/InventoryAdminUi/Controller/Adminhtml Magento/Newsletter/Model/Queue -Magento/Framework/Mail/Template \ No newline at end of file +Magento/Framework/Mail/Template +Magento/CheckoutAgreements/Model/Checkout/Plugin From 4b93e8b6accdd09562d1f82cd61d03d88850d514 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Wed, 15 Jan 2020 10:06:06 +0100 Subject: [PATCH 0834/1143] HotFix: Failing Magento EE check on Layered Navigation --- .../Catalog/Test/Mftf/Test/AdminMoveAnchoredCategoryTest.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveAnchoredCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveAnchoredCategoryTest.xml index 551b3437cb856..423b7b6224b23 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveAnchoredCategoryTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveAnchoredCategoryTest.xml @@ -29,6 +29,7 @@ <createData entity="_defaultProduct" stepKey="productTwo"> <requiredEntity createDataKey="simpleSubCategoryOne"/> </createData> + <magentoCLI command="cron:run --group=index" stepKey="runIndexerCron"/> </before> <after> <actionGroup ref="logout" stepKey="logoutAdminUserAfterTest"/> @@ -119,4 +120,4 @@ <see selector="{{StorefrontNavigationSection.breadcrumbs}}" userInput="$$simpleSubCategoryOne.name$$" stepKey="seeSubCategoryWithParentInBreadcrumbsOnSubCategoryWithParent3"/> <see selector="{{StorefrontNavigationSection.breadcrumbs}}" userInput="$$productOne.name$$" stepKey="seeProductInBreadcrumbsOnSubCategoryOne3"/> </test> -</tests> \ No newline at end of file +</tests> From 28e8e5aa46ffe2cfed80124bb95d3ce025a127c8 Mon Sep 17 00:00:00 2001 From: "a.chorniy" <a.chorniy@atwix.com> Date: Wed, 15 Jan 2020 11:56:36 +0200 Subject: [PATCH 0835/1143] Issue-25968 - Added adjustments after review --- app/code/Magento/Sales/Model/Order/Item.php | 4 +++ .../Sales/Test/Unit/Model/Order/ItemTest.php | 26 ++++++++++--------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/app/code/Magento/Sales/Model/Order/Item.php b/app/code/Magento/Sales/Model/Order/Item.php index f9e585098aef4..c133d3aea267d 100644 --- a/app/code/Magento/Sales/Model/Order/Item.php +++ b/app/code/Magento/Sales/Model/Order/Item.php @@ -385,6 +385,8 @@ public function getStatus() * * @param string $statusId * @return \Magento\Framework\Phrase + * + * phpcs:disable Magento2.Functions.StaticFunction */ public static function getStatusName($statusId) { @@ -422,6 +424,8 @@ public function cancel() * Retrieve order item statuses array * * @return array + * + * phpcs:disable Magento2.Functions.StaticFunction */ public static function getStatuses() { diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/ItemTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/ItemTest.php index e74af4739d8c9..72e379006742a 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/ItemTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/ItemTest.php @@ -9,11 +9,10 @@ use Magento\Framework\Serialize\Serializer\Json; use Magento\Sales\Model\ResourceModel\OrderFactory; use \Magento\Sales\Model\Order; +use Magento\Sales\Api\Data\OrderItemInterface; /** - * Class ItemTest - * - * @package Magento\Sales\Model\Order + * Unit test for order item class. */ class ItemTest extends \PHPUnit\Framework\TestCase { @@ -72,7 +71,7 @@ public function testSetParentItem() public function testGetPatentItem() { $item = $this->objectManager->getObject(\Magento\Sales\Model\Order\Item::class, []); - $this->model->setData(\Magento\Sales\Api\Data\OrderItemInterface::PARENT_ITEM, $item); + $this->model->setData(OrderItemInterface::PARENT_ITEM, $item); $this->assertEquals($item, $this->model->getParentItem()); } @@ -184,7 +183,7 @@ public function testGetOriginalPrice() $this->assertEquals($price, $this->model->getOriginalPrice()); $originalPrice = 5.55; - $this->model->setData(\Magento\Sales\Api\Data\OrderItemInterface::ORIGINAL_PRICE, $originalPrice); + $this->model->setData(OrderItemInterface::ORIGINAL_PRICE, $originalPrice); $this->assertEquals($originalPrice, $this->model->getOriginalPrice()); } @@ -350,20 +349,23 @@ public function getItemQtyVariants() } /** - * Test getPrice() method + * Test getPrice() method should returns float */ - public function testGetPrice() + public function testGetPriceReturnsFloat() { $price = 9.99; $this->model->setPrice($price); $this->assertEquals($price, $this->model->getPrice()); + } - $newPrice = 5.53; - $this->model->setData(\Magento\Sales\Api\Data\OrderItemInterface::PRICE, $newPrice); - $this->assertEquals($newPrice, $this->model->getPrice()); - + /** + * Test getPrice() method should returns null + */ + public function testGetPriceReturnsNull() + { $nullablePrice = null; - $this->model->setPrice($nullablePrice); + $this->model->setData(OrderItemInterface::PRICE, $nullablePrice); $this->assertEquals($nullablePrice, $this->model->getPrice()); } + } From 71da244811484747f55bf3ccb1244844ff903fd6 Mon Sep 17 00:00:00 2001 From: "a.chorniy" <a.chorniy@atwix.com> Date: Wed, 15 Jan 2020 12:15:05 +0200 Subject: [PATCH 0836/1143] Issue-25968 - Small adjustments after code review --- app/code/Magento/Sales/Test/Unit/Model/Order/ItemTest.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/ItemTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/ItemTest.php index 72e379006742a..3c7042c10f4d3 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/ItemTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/ItemTest.php @@ -7,9 +7,8 @@ namespace Magento\Sales\Test\Unit\Model\Order; use Magento\Framework\Serialize\Serializer\Json; -use Magento\Sales\Model\ResourceModel\OrderFactory; -use \Magento\Sales\Model\Order; use Magento\Sales\Api\Data\OrderItemInterface; +use Magento\Sales\Model\ResourceModel\OrderFactory; /** * Unit test for order item class. @@ -349,7 +348,7 @@ public function getItemQtyVariants() } /** - * Test getPrice() method should returns float + * Test getPrice() method returns float */ public function testGetPriceReturnsFloat() { @@ -359,7 +358,7 @@ public function testGetPriceReturnsFloat() } /** - * Test getPrice() method should returns null + * Test getPrice() method returns null */ public function testGetPriceReturnsNull() { @@ -367,5 +366,4 @@ public function testGetPriceReturnsNull() $this->model->setData(OrderItemInterface::PRICE, $nullablePrice); $this->assertEquals($nullablePrice, $this->model->getPrice()); } - } From 4d814cba6ad8969a01e84113eacff03a1547c77e Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Wed, 15 Jan 2020 13:49:18 +0200 Subject: [PATCH 0837/1143] MC-30409: [FT] [MFTF] [2.4] Fix flaky test AdminCreateDuplicateProductTest (MC-14714) --- .../Catalog/Test/Mftf/Test/AdminCreateDuplicateProductTest.xml | 3 --- .../Mftf/Test/AdminUrlRewritesForProductAfterImportTest.xml | 3 --- 2 files changed, 6 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDuplicateProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDuplicateProductTest.xml index 472de07baccdd..3eb617d19d54c 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDuplicateProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDuplicateProductTest.xml @@ -15,9 +15,6 @@ <testCaseId value="MC-14714"/> <severity value="CRITICAL"/> <group value="mtf_migrated"/> - <skip> - <issueId value="MC-30409"/> - </skip> </annotations> <before> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUrlRewritesForProductAfterImportTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUrlRewritesForProductAfterImportTest.xml index 3f2ae13a16657..9fcca06df5c69 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUrlRewritesForProductAfterImportTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUrlRewritesForProductAfterImportTest.xml @@ -16,9 +16,6 @@ <severity value="MAJOR"/> <testCaseId value="MC-20229"/> <group value="urlRewrite"/> - <skip> - <issueId value="MC-30409"/> - </skip> </annotations> <before> <comment userInput="Set the configuration for Generate category/product URL Rewrites" stepKey="commentSetURLRewriteConfiguration" /> From 364b51a08021abd491e89f9ec838e78476420ab0 Mon Sep 17 00:00:00 2001 From: Karyna Tsymbal <k.tsymbal@atwix.com> Date: Wed, 15 Jan 2020 06:15:24 -0600 Subject: [PATCH 0838/1143] Issue #26332 BeforeOrderPaymentSaveObserver override payment insructions --- .../BeforeOrderPaymentSaveObserver.php | 3 ++- .../BeforeOrderPaymentSaveObserverTest.php | 20 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/OfflinePayments/Observer/BeforeOrderPaymentSaveObserver.php b/app/code/Magento/OfflinePayments/Observer/BeforeOrderPaymentSaveObserver.php index daf1cef3fff60..d7cad6b62e993 100644 --- a/app/code/Magento/OfflinePayments/Observer/BeforeOrderPaymentSaveObserver.php +++ b/app/code/Magento/OfflinePayments/Observer/BeforeOrderPaymentSaveObserver.php @@ -30,7 +30,8 @@ public function execute(\Magento\Framework\Event\Observer $observer) Banktransfer::PAYMENT_METHOD_BANKTRANSFER_CODE, Cashondelivery::PAYMENT_METHOD_CASHONDELIVERY_CODE ]; - if (in_array($payment->getMethod(), $instructionMethods)) { + if (in_array($payment->getMethod(), $instructionMethods) + && empty($payment->getAdditionalInformation('instructions'))) { $payment->setAdditionalInformation( 'instructions', $payment->getMethodInstance()->getInstructions() diff --git a/app/code/Magento/OfflinePayments/Test/Unit/Observer/BeforeOrderPaymentSaveObserverTest.php b/app/code/Magento/OfflinePayments/Test/Unit/Observer/BeforeOrderPaymentSaveObserverTest.php index 51edaea0e659c..0b482a805175a 100644 --- a/app/code/Magento/OfflinePayments/Test/Unit/Observer/BeforeOrderPaymentSaveObserverTest.php +++ b/app/code/Magento/OfflinePayments/Test/Unit/Observer/BeforeOrderPaymentSaveObserverTest.php @@ -172,4 +172,24 @@ public function testBeforeOrderPaymentSaveWithOthers() $this->_model->execute($this->observer); } + + /** + * @param string $methodCode + * @dataProvider dataProviderBeforeOrderPaymentSaveWithInstructions + */ + public function testBeforeOrderPaymentSaveWithInstructionsAlreadySet($methodCode) + { + $this->payment + ->method('getMethod') + ->willReturn($methodCode); + + $this->payment->expects(self::once()) + ->method('getAdditionalInformation') + ->willReturn('Test'); + + $this->payment->expects(self::never()) + ->method('setAdditionalInformation'); + + $this->_model->execute($this->observer); + } } From 4b9b6fa85fcbb2f47efe0f67ab5889b355b2f300 Mon Sep 17 00:00:00 2001 From: Daniel Ruf <d.ruf@bitexpert.de> Date: Wed, 15 Jan 2020 13:06:32 +0100 Subject: [PATCH 0839/1143] Apply review feedback --- app/code/Magento/Customer/ViewModel/Address.php | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/app/code/Magento/Customer/ViewModel/Address.php b/app/code/Magento/Customer/ViewModel/Address.php index a6bcbfcb40676..58df4c1adc1d4 100644 --- a/app/code/Magento/Customer/ViewModel/Address.php +++ b/app/code/Magento/Customer/ViewModel/Address.php @@ -11,25 +11,17 @@ use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\View\Element\Block\ArgumentInterface; -/** - * Customer address view model. - */ - /** - * Address view model + * Custom address view model */ class Address implements ArgumentInterface { /** - * Data helper - * * @var DataHelper */ private $helperData; /** - * Address helper - * * @var AddressHelper */ private $helperAddress; @@ -53,9 +45,7 @@ public function __construct( * Get string with frontend validation classes for attribute * * @param string $attributeCode - * * @return string - * * @throws \Magento\Framework\Exception\LocalizedException */ public function dataGetAttributeValidationClass($attributeCode) @@ -67,9 +57,7 @@ public function dataGetAttributeValidationClass($attributeCode) * Get string with frontend validation classes for attribute * * @param string $attributeCode - * * @return string - * * @throws \Magento\Framework\Exception\LocalizedException */ public function addressGetAttributeValidationClass($attributeCode) From a8c981b80505d7dc58f1bc16c70bdaea7b250340 Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Wed, 15 Jan 2020 14:41:35 +0200 Subject: [PATCH 0840/1143] MC-30234: Storefront doesn't open after assigning a default watermark to a theme --- .../Model/Product/Image/ParamsBuilder.php | 5 +- .../Model/Product/Image/ParamsBuilderTest.php | 143 +++++++++++------- 2 files changed, 91 insertions(+), 57 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Image/ParamsBuilder.php b/app/code/Magento/Catalog/Model/Product/Image/ParamsBuilder.php index c0f4e83ef3de4..ecdb3b2829b90 100644 --- a/app/code/Magento/Catalog/Model/Product/Image/ParamsBuilder.php +++ b/app/code/Magento/Catalog/Model/Product/Image/ParamsBuilder.php @@ -132,9 +132,10 @@ private function getWatermark(string $type, int $scopeId = null): array if ($file) { $size = explode( 'x', - $this->scopeConfig->getValue( + (string) $this->scopeConfig->getValue( "design/watermark/{$type}_size", - ScopeInterface::SCOPE_STORE + ScopeInterface::SCOPE_STORE, + $scopeId ) ); $opacity = $this->scopeConfig->getValue( diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Image/ParamsBuilderTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Image/ParamsBuilderTest.php index 22e3a88574e03..68239c8fa8aed 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/Image/ParamsBuilderTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Image/ParamsBuilderTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Catalog\Test\Unit\Model\Product\Image; @@ -11,10 +12,15 @@ use Magento\Framework\App\Area; use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\Config\View; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use Magento\Framework\View\ConfigInterface; use Magento\Store\Model\ScopeInterface; +use PHPUnit\Framework\TestCase; -class ParamsBuilderTest extends \PHPUnit\Framework\TestCase +/** + * Test product image params builder + */ +class ParamsBuilderTest extends TestCase { /** * @var ScopeConfigInterface @@ -30,10 +36,17 @@ class ParamsBuilderTest extends \PHPUnit\Framework\TestCase * @var ParamsBuilder */ private $model; + /** + * @var array + */ + private $scopeConfigData = []; + /** + * @inheritDoc + */ protected function setUp() { - $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $objectManager = new ObjectManager($this); $this->scopeConfig = $this->createMock(ScopeConfigInterface::class); $this->viewConfig = $this->createMock(ConfigInterface::class); $this->model = $objectManager->getObject( @@ -43,28 +56,37 @@ protected function setUp() 'viewConfig' => $this->viewConfig, ] ); + $this->scopeConfigData = []; + $this->scopeConfig->method('getValue') + ->willReturnCallback( + function ($path, $scopeType, $scopeCode) { + return $this->scopeConfigData[$path][$scopeType][$scopeCode] ?? null; + } + ); } /** - * Test watermark location. + * Test build() with different parameters and config values + * + * @param int $scopeId + * @param array $config + * @param array $imageArguments + * @param array $expected + * @dataProvider buildDataProvider */ - public function testWatermarkLocation() + public function testBuild(int $scopeId, array $config, array $imageArguments, array $expected) { - $imageArguments = [ - 'type' => 'type', - 'height' => 'image_height', - 'width' => 'image_width', - 'angle' => 'angle', - 'background' => [1, 2, 3] + $this->scopeConfigData[Image::XML_PATH_JPEG_QUALITY][ScopeConfigInterface::SCOPE_TYPE_DEFAULT][null] = 80; + foreach ($config as $path => $value) { + $this->scopeConfigData[$path][ScopeInterface::SCOPE_STORE][$scopeId] = $value; + } + $imageArguments += [ + 'type' => 'image', + 'height' => '600', + 'width' => '400', + 'angle' => '45', + 'background' => [110, 64, 224] ]; - $scopeId = 1; - $quality = 100; - $file = 'file'; - $width = 'width'; - $height = 'height'; - $size = "{$width}x{$height}"; - $opacity = 'opacity'; - $position = 'position'; $viewMock = $this->createMock(View::class); $viewMock->expects($this->once()) @@ -77,51 +99,16 @@ public function testWatermarkLocation() ->with(['area' => Area::AREA_FRONTEND]) ->willReturn($viewMock); - $this->scopeConfig->expects($this->exactly(5))->method('getValue')->withConsecutive( - [ - Image::XML_PATH_JPEG_QUALITY - ], - [ - "design/watermark/{$imageArguments['type']}_image", - ScopeInterface::SCOPE_STORE, - $scopeId, - ], - [ - "design/watermark/{$imageArguments['type']}_size", - ScopeInterface::SCOPE_STORE], - [ - "design/watermark/{$imageArguments['type']}_imageOpacity", - ScopeInterface::SCOPE_STORE, - $scopeId - ], - [ - "design/watermark/{$imageArguments['type']}_position", - ScopeInterface::SCOPE_STORE, - $scopeId - ] - )->willReturnOnConsecutiveCalls( - $quality, - $file, - $size, - $opacity, - $position - ); - $actual = $this->model->build($imageArguments, $scopeId); - $expected = [ + $expected += [ 'image_type' => $imageArguments['type'], 'background' => $imageArguments['background'], 'angle' => $imageArguments['angle'], - 'quality' => $quality, + 'quality' => 80, 'keep_aspect_ratio' => true, 'keep_frame' => true, 'keep_transparency' => true, 'constrain_only' => true, - 'watermark_file' => $file, - 'watermark_image_opacity' => $opacity, - 'watermark_position' => $position, - 'watermark_width' => $width, - 'watermark_height' => $height, 'image_height' => $imageArguments['height'], 'image_width' => $imageArguments['width'], ]; @@ -131,4 +118,50 @@ public function testWatermarkLocation() $actual ); } + + /** + * Provides test scenarios for + * + * @return array + */ + public function buildDataProvider() + { + return [ + 'watermark config' => [ + 1, + [ + 'design/watermark/small_image_image' => 'stores/1/magento-logo.png', + 'design/watermark/small_image_size' => '60x40', + 'design/watermark/small_image_imageOpacity' => '50', + 'design/watermark/small_image_position' => 'bottom-right', + ], + [ + 'type' => 'small_image' + ], + [ + 'watermark_file' => 'stores/1/magento-logo.png', + 'watermark_image_opacity' => '50', + 'watermark_position' => 'bottom-right', + 'watermark_width' => '60', + 'watermark_height' => '40', + ] + ], + 'watermark config empty' => [ + 1, + [ + 'design/watermark/small_image_image' => 'stores/1/magento-logo.png', + ], + [ + 'type' => 'small_image' + ], + [ + 'watermark_file' => 'stores/1/magento-logo.png', + 'watermark_image_opacity' => null, + 'watermark_position' => null, + 'watermark_width' => null, + 'watermark_height' => null, + ] + ] + ]; + } } From 07a86851b5d8b7a7f334756c7b7668f0a8965b93 Mon Sep 17 00:00:00 2001 From: Krissy Hiserote <khiserote@magento.com> Date: Wed, 15 Jan 2020 10:29:57 -0600 Subject: [PATCH 0841/1143] MC-25269: Upgrade from 2.3.x CE with SD to 2.3.x EE fails - fix static failures --- app/code/Magento/Indexer/Setup/Recurring.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Indexer/Setup/Recurring.php b/app/code/Magento/Indexer/Setup/Recurring.php index 1e5c79c9b10d4..30e4ad438e73d 100644 --- a/app/code/Magento/Indexer/Setup/Recurring.php +++ b/app/code/Magento/Indexer/Setup/Recurring.php @@ -20,6 +20,8 @@ use Magento\Indexer\Model\ResourceModel\Indexer\State\CollectionFactory; /** + * Indexer recurring setup + * * @codeCoverageIgnore * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ @@ -84,7 +86,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { From 9bad814abdc6bdd2c035636764c071f70aa89df6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Wed, 15 Jan 2020 20:14:44 +0100 Subject: [PATCH 0842/1143] #26396 DeleteProduct Action Group should wait till Loading Mask disappear --- .../Catalog/Test/Mftf/ActionGroup/DeleteProductActionGroup.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductActionGroup.xml index aa44a517593af..22209b61d5316 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductActionGroup.xml @@ -27,5 +27,6 @@ <waitForPageLoad stepKey="waitForDeleteItemPopup" time="10"/> <click stepKey="clickOnOk" selector="{{ProductsPageSection.ok}}"/> <waitForElementVisible stepKey="waitForSuccessfullyDeletedMessage" selector="{{ProductsPageSection.deletedSuccessMessage}}" time="10"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskDisappear"/> </actionGroup> </actionGroups> From 8b40fac74159236991f7be5e0528c4cbd88f36df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Wed, 15 Jan 2020 20:16:24 +0100 Subject: [PATCH 0843/1143] #26396 DeleteCustomer Action Group should wait till Loading Mask disappear --- .../Mftf/ActionGroup/DeleteCustomerActionGroup.xml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/DeleteCustomerActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/DeleteCustomerActionGroup.xml index 58777ec0d3515..81b8cabaa51ef 100644 --- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/DeleteCustomerActionGroup.xml +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/DeleteCustomerActionGroup.xml @@ -15,7 +15,7 @@ <arguments> <argument name="lastName" defaultValue=""/> </arguments> - + <!--Clear filter if exist--> <amOnPage url="{{AdminCustomerPage.url}}" stepKey="navigateToCustomers"/> <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingCustomerFilters"/> @@ -28,8 +28,9 @@ <waitForPageLoad stepKey="waitForDeleteItemPopup" time="10"/> <click stepKey="clickOnOk" selector="{{CustomersPageSection.ok}}"/> <waitForElementVisible stepKey="waitForSuccessfullyDeletedMessage" selector="{{CustomersPageSection.deletedSuccessMessage}}" time="10"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskDisappear"/> </actionGroup> - + <actionGroup name="DeleteCustomerByEmailActionGroup"> <annotations> <description>Goes to the Admin Customers grid page. Deletes a Customer based on the provided Email Address.</description> @@ -37,7 +38,7 @@ <arguments> <argument name="email" type="string"/> </arguments> - + <amOnPage url="{{AdminCustomerPage.url}}" stepKey="navigateToCustomers"/> <waitForPageLoad stepKey="waitForAdminCustomerPageLoad"/> <click selector="{{AdminCustomerFiltersSection.filtersButton}}" stepKey="clickFilterButton"/> @@ -51,6 +52,7 @@ <click selector="{{CustomersPageSection.delete}}" stepKey="clickDelete"/> <waitForElementVisible selector="{{CustomersPageSection.ok}}" stepKey="waitForOkToVisible"/> <click selector="{{CustomersPageSection.ok}}" stepKey="clickOkConfirmationButton"/> - <waitForElementVisible stepKey="waitForSuccessfullyDeletedMessage" selector="{{CustomersPageSection.deletedSuccessMessage}}" time="30"/> + <waitForElementVisible stepKey="waitForSuccessfullyDeletedMessage" selector="{{CustomersPageSection.deletedSuccessMessage}}" time="10"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskDisappear"/> </actionGroup> </actionGroups> From 5e9ef73cc9611dc1c342ee426b955cbb96d1d692 Mon Sep 17 00:00:00 2001 From: Iryna Lagno <ilagno@adobe.com> Date: Wed, 15 Jan 2020 14:19:37 -0600 Subject: [PATCH 0844/1143] MC-14917: Update Symfony components to 4.4LTS for 2.4.x --- composer.json | 6 +- composer.lock | 1142 +++++++++-------- .../SimplePolicyHeaderRendererTest.php | 18 +- .../HeaderProvider/AbstractHeaderTestCase.php | 38 +- .../HeaderProvider/UpgradeInsecureTest.php | 2 +- .../Magento/Test/Integrity/ComposerTest.php | 48 +- lib/internal/Magento/Framework/composer.json | 4 +- 7 files changed, 688 insertions(+), 570 deletions(-) diff --git a/composer.json b/composer.json index ab767fdac286d..489ee92dc3f65 100644 --- a/composer.json +++ b/composer.json @@ -46,9 +46,9 @@ "phpseclib/mcrypt_compat": "1.0.8", "phpseclib/phpseclib": "2.0.*", "ramsey/uuid": "~3.8.0", - "symfony/console": "~4.1.0||~4.2.0||~4.3.0", - "symfony/event-dispatcher": "~4.1.0||~4.2.0||~4.3.0", - "symfony/process": "~4.1.0||~4.2.0||~4.3.0", + "symfony/console": "~4.4.0", + "symfony/event-dispatcher": "~4.4.0", + "symfony/process": "~4.4.0", "tedivm/jshrink": "~1.3.0", "tubalmartin/cssmin": "4.1.1", "webonyx/graphql-php": "^0.13.8", diff --git a/composer.lock b/composer.lock index b6d834610059a..73875d0b21841 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8d8e6b87c1f6ac98b3b7331eba9473f3", + "content-hash": "8a41c0f45690e8714e21de75d201f1b2", "packages": [ { "name": "braintree/braintree_php", @@ -164,16 +164,16 @@ }, { "name": "colinmollenhour/php-redis-session-abstract", - "version": "v1.4.1", + "version": "v1.4.2", "source": { "type": "git", "url": "https://github.com/colinmollenhour/php-redis-session-abstract.git", - "reference": "4949ca28b86037abb44984c77bab9d0a4e075643" + "reference": "669521218794f125c7b668252f4f576eda65e1e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/colinmollenhour/php-redis-session-abstract/zipball/4949ca28b86037abb44984c77bab9d0a4e075643", - "reference": "4949ca28b86037abb44984c77bab9d0a4e075643", + "url": "https://api.github.com/repos/colinmollenhour/php-redis-session-abstract/zipball/669521218794f125c7b668252f4f576eda65e1e4", + "reference": "669521218794f125c7b668252f4f576eda65e1e4", "shasum": "" }, "require": { @@ -197,20 +197,20 @@ ], "description": "A Redis-based session handler with optimistic locking", "homepage": "https://github.com/colinmollenhour/php-redis-session-abstract", - "time": "2019-03-18T14:43:14+00:00" + "time": "2020-01-08T17:41:01+00:00" }, { "name": "composer/ca-bundle", - "version": "1.2.4", + "version": "1.2.6", "source": { "type": "git", "url": "https://github.com/composer/ca-bundle.git", - "reference": "10bb96592168a0f8e8f6dcde3532d9fa50b0b527" + "reference": "47fe531de31fca4a1b997f87308e7d7804348f7e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/10bb96592168a0f8e8f6dcde3532d9fa50b0b527", - "reference": "10bb96592168a0f8e8f6dcde3532d9fa50b0b527", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/47fe531de31fca4a1b997f87308e7d7804348f7e", + "reference": "47fe531de31fca4a1b997f87308e7d7804348f7e", "shasum": "" }, "require": { @@ -221,7 +221,7 @@ "require-dev": { "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8", "psr/log": "^1.0", - "symfony/process": "^2.5 || ^3.0 || ^4.0" + "symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0" }, "type": "library", "extra": { @@ -253,20 +253,20 @@ "ssl", "tls" ], - "time": "2019-08-30T08:44:50+00:00" + "time": "2020-01-13T10:02:55+00:00" }, { "name": "composer/composer", - "version": "1.9.1", + "version": "1.9.2", "source": { "type": "git", "url": "https://github.com/composer/composer.git", - "reference": "bb01f2180df87ce7992b8331a68904f80439dd2f" + "reference": "7a04aa0201ddaa0b3cf64d41022bd8cdcd7fafeb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/bb01f2180df87ce7992b8331a68904f80439dd2f", - "reference": "bb01f2180df87ce7992b8331a68904f80439dd2f", + "url": "https://api.github.com/repos/composer/composer/zipball/7a04aa0201ddaa0b3cf64d41022bd8cdcd7fafeb", + "reference": "7a04aa0201ddaa0b3cf64d41022bd8cdcd7fafeb", "shasum": "" }, "require": { @@ -333,28 +333,27 @@ "dependency", "package" ], - "time": "2019-11-01T16:20:17+00:00" + "time": "2020-01-14T15:30:32+00:00" }, { "name": "composer/semver", - "version": "1.5.0", + "version": "1.5.1", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "46d9139568ccb8d9e7cdd4539cab7347568a5e2e" + "reference": "c6bea70230ef4dd483e6bbcab6005f682ed3a8de" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/46d9139568ccb8d9e7cdd4539cab7347568a5e2e", - "reference": "46d9139568ccb8d9e7cdd4539cab7347568a5e2e", + "url": "https://api.github.com/repos/composer/semver/zipball/c6bea70230ef4dd483e6bbcab6005f682ed3a8de", + "reference": "c6bea70230ef4dd483e6bbcab6005f682ed3a8de", "shasum": "" }, "require": { "php": "^5.3.2 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "^4.5 || ^5.0.5", - "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" + "phpunit/phpunit": "^4.5 || ^5.0.5" }, "type": "library", "extra": { @@ -395,7 +394,7 @@ "validation", "versioning" ], - "time": "2019-03-19T17:25:45+00:00" + "time": "2020-01-13T12:06:48+00:00" }, { "name": "composer/spdx-licenses", @@ -595,16 +594,16 @@ }, { "name": "guzzlehttp/guzzle", - "version": "6.4.1", + "version": "6.5.2", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "0895c932405407fd3a7368b6910c09a24d26db11" + "reference": "43ece0e75098b7ecd8d13918293029e555a50f82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/0895c932405407fd3a7368b6910c09a24d26db11", - "reference": "0895c932405407fd3a7368b6910c09a24d26db11", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/43ece0e75098b7ecd8d13918293029e555a50f82", + "reference": "43ece0e75098b7ecd8d13918293029e555a50f82", "shasum": "" }, "require": { @@ -619,12 +618,13 @@ "psr/log": "^1.1" }, "suggest": { + "ext-intl": "Required for Internationalized Domain Name (IDN) support", "psr/log": "Required for using the Log middleware" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.3-dev" + "dev-master": "6.5-dev" } }, "autoload": { @@ -657,7 +657,7 @@ "rest", "web service" ], - "time": "2019-10-23T15:58:00+00:00" + "time": "2019-12-23T11:57:10+00:00" }, { "name": "guzzlehttp/promises", @@ -950,22 +950,22 @@ }, { "name": "magento/composer", - "version": "1.5.0", + "version": "1.5.1", "source": { "type": "git", "url": "https://github.com/magento/composer.git", - "reference": "ea12b95be5c0833b3d9497aaefa08816c19e5dcd" + "reference": "b2dcb2194629bc2eb03fd81cb9f4586ffe4b65b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/magento/composer/zipball/ea12b95be5c0833b3d9497aaefa08816c19e5dcd", - "reference": "ea12b95be5c0833b3d9497aaefa08816c19e5dcd", + "url": "https://api.github.com/repos/magento/composer/zipball/b2dcb2194629bc2eb03fd81cb9f4586ffe4b65b0", + "reference": "b2dcb2194629bc2eb03fd81cb9f4586ffe4b65b0", "shasum": "" }, "require": { "composer/composer": "^1.6", "php": "~7.1.3||~7.2.0||~7.3.0", - "symfony/console": "~4.0.0 || ~4.1.0" + "symfony/console": "~4.0.0||~4.1.0||~4.2.0||~4.3.0||~4.4.0" }, "require-dev": { "phpunit/phpunit": "~7.0.0" @@ -982,7 +982,7 @@ "AFL-3.0" ], "description": "Magento composer library helps to instantiate Composer application and run composer commands.", - "time": "2019-07-29T19:52:05+00:00" + "time": "2020-01-07T22:16:08+00:00" }, { "name": "magento/magento-composer-installer", @@ -1065,16 +1065,16 @@ }, { "name": "magento/zendframework1", - "version": "1.14.2", + "version": "1.14.3", "source": { "type": "git", "url": "https://github.com/magento/zf1.git", - "reference": "8221062d42a198e431d183bbe672e5e1a2f98c5f" + "reference": "726855dfb080089dc7bc7b016624129f8e7bc4e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/magento/zf1/zipball/8221062d42a198e431d183bbe672e5e1a2f98c5f", - "reference": "8221062d42a198e431d183bbe672e5e1a2f98c5f", + "url": "https://api.github.com/repos/magento/zf1/zipball/726855dfb080089dc7bc7b016624129f8e7bc4e5", + "reference": "726855dfb080089dc7bc7b016624129f8e7bc4e5", "shasum": "" }, "require": { @@ -1108,20 +1108,20 @@ "ZF1", "framework" ], - "time": "2019-07-26T16:43:11+00:00" + "time": "2019-11-26T15:09:40+00:00" }, { "name": "monolog/monolog", - "version": "1.25.2", + "version": "1.25.3", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "d5e2fb341cb44f7e2ab639d12a1e5901091ec287" + "reference": "fa82921994db851a8becaf3787a9e73c5976b6f1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/d5e2fb341cb44f7e2ab639d12a1e5901091ec287", - "reference": "d5e2fb341cb44f7e2ab639d12a1e5901091ec287", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fa82921994db851a8becaf3787a9e73c5976b6f1", + "reference": "fa82921994db851a8becaf3787a9e73c5976b6f1", "shasum": "" }, "require": { @@ -1186,7 +1186,7 @@ "logging", "psr-3" ], - "time": "2019-11-13T10:00:05+00:00" + "time": "2019-12-20T14:15:16+00:00" }, { "name": "paragonie/random_compat", @@ -1235,16 +1235,16 @@ }, { "name": "paragonie/sodium_compat", - "version": "v1.12.1", + "version": "v1.12.2", "source": { "type": "git", "url": "https://github.com/paragonie/sodium_compat.git", - "reference": "063cae9b3a7323579063e7037720f5b52b56c178" + "reference": "3b953109fdfc821c1979bc829c8b7421721fef82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/sodium_compat/zipball/063cae9b3a7323579063e7037720f5b52b56c178", - "reference": "063cae9b3a7323579063e7037720f5b52b56c178", + "url": "https://api.github.com/repos/paragonie/sodium_compat/zipball/3b953109fdfc821c1979bc829c8b7421721fef82", + "reference": "3b953109fdfc821c1979bc829c8b7421721fef82", "shasum": "" }, "require": { @@ -1313,7 +1313,7 @@ "secret-key cryptography", "side-channel resistant" ], - "time": "2019-11-07T17:07:24+00:00" + "time": "2019-12-30T03:11:08+00:00" }, { "name": "pelago/emogrifier", @@ -1968,16 +1968,16 @@ }, { "name": "seld/phar-utils", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/Seldaek/phar-utils.git", - "reference": "7009b5139491975ef6486545a39f3e6dad5ac30a" + "reference": "84715761c35808076b00908a20317a3a8a67d17e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/7009b5139491975ef6486545a39f3e6dad5ac30a", - "reference": "7009b5139491975ef6486545a39f3e6dad5ac30a", + "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/84715761c35808076b00908a20317a3a8a67d17e", + "reference": "84715761c35808076b00908a20317a3a8a67d17e", "shasum": "" }, "require": { @@ -2008,28 +2008,32 @@ "keywords": [ "phra" ], - "time": "2015-10-13T18:44:15+00:00" + "time": "2020-01-13T10:41:09+00:00" }, { "name": "symfony/console", - "version": "v4.1.12", + "version": "v4.4.2", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "9e87c798f67dc9fceeb4f3d57847b52d945d1a02" + "reference": "82437719dab1e6bdd28726af14cb345c2ec816d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/9e87c798f67dc9fceeb4f3d57847b52d945d1a02", - "reference": "9e87c798f67dc9fceeb4f3d57847b52d945d1a02", + "url": "https://api.github.com/repos/symfony/console/zipball/82437719dab1e6bdd28726af14cb345c2ec816d0", + "reference": "82437719dab1e6bdd28726af14cb345c2ec816d0", "shasum": "" }, "require": { "php": "^7.1.3", - "symfony/polyfill-mbstring": "~1.0" + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "^1.8", + "symfony/service-contracts": "^1.1|^2" }, "conflict": { "symfony/dependency-injection": "<3.4", + "symfony/event-dispatcher": "<4.3|>=5", + "symfony/lock": "<4.4", "symfony/process": "<3.3" }, "provide": { @@ -2037,11 +2041,12 @@ }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~3.4|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/event-dispatcher": "~3.4|~4.0", - "symfony/lock": "~3.4|~4.0", - "symfony/process": "~3.4|~4.0" + "symfony/config": "^3.4|^4.0|^5.0", + "symfony/dependency-injection": "^3.4|^4.0|^5.0", + "symfony/event-dispatcher": "^4.3", + "symfony/lock": "^4.4|^5.0", + "symfony/process": "^3.4|^4.0|^5.0", + "symfony/var-dumper": "^4.3|^5.0" }, "suggest": { "psr/log": "For using the console logger", @@ -2052,7 +2057,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.1-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -2079,20 +2084,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2019-01-25T14:34:37+00:00" + "time": "2019-12-17T10:32:23+00:00" }, { "name": "symfony/css-selector", - "version": "v4.3.8", + "version": "v4.4.2", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "f4b3ff6a549d9ed28b2b0ecd1781bf67cf220ee9" + "reference": "64acec7e0d67125e9f4656c68d4a38a42ab5a0b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/f4b3ff6a549d9ed28b2b0ecd1781bf67cf220ee9", - "reference": "f4b3ff6a549d9ed28b2b0ecd1781bf67cf220ee9", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/64acec7e0d67125e9f4656c68d4a38a42ab5a0b7", + "reference": "64acec7e0d67125e9f4656c68d4a38a42ab5a0b7", "shasum": "" }, "require": { @@ -2101,7 +2106,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -2132,20 +2137,20 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2019-10-02T08:36:26+00:00" + "time": "2019-10-12T00:35:04+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v4.3.8", + "version": "v4.4.2", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "0df002fd4f500392eabd243c2947061a50937287" + "reference": "b3c3068a72623287550fe20b84a2b01dcba2686f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/0df002fd4f500392eabd243c2947061a50937287", - "reference": "0df002fd4f500392eabd243c2947061a50937287", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/b3c3068a72623287550fe20b84a2b01dcba2686f", + "reference": "b3c3068a72623287550fe20b84a2b01dcba2686f", "shasum": "" }, "require": { @@ -2161,12 +2166,12 @@ }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~3.4|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/expression-language": "~3.4|~4.0", - "symfony/http-foundation": "^3.4|^4.0", - "symfony/service-contracts": "^1.1", - "symfony/stopwatch": "~3.4|~4.0" + "symfony/config": "^3.4|^4.0|^5.0", + "symfony/dependency-injection": "^3.4|^4.0|^5.0", + "symfony/expression-language": "^3.4|^4.0|^5.0", + "symfony/http-foundation": "^3.4|^4.0|^5.0", + "symfony/service-contracts": "^1.1|^2", + "symfony/stopwatch": "^3.4|^4.0|^5.0" }, "suggest": { "symfony/dependency-injection": "", @@ -2175,7 +2180,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -2202,7 +2207,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2019-11-03T09:04:05+00:00" + "time": "2019-11-28T13:33:56+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -2264,16 +2269,16 @@ }, { "name": "symfony/filesystem", - "version": "v4.3.8", + "version": "v4.4.2", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "9abbb7ef96a51f4d7e69627bc6f63307994e4263" + "reference": "40c2606131d56eff6f193b6e2ceb92414653b591" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/9abbb7ef96a51f4d7e69627bc6f63307994e4263", - "reference": "9abbb7ef96a51f4d7e69627bc6f63307994e4263", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/40c2606131d56eff6f193b6e2ceb92414653b591", + "reference": "40c2606131d56eff6f193b6e2ceb92414653b591", "shasum": "" }, "require": { @@ -2283,7 +2288,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -2310,20 +2315,20 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2019-08-20T14:07:54+00:00" + "time": "2019-11-26T23:16:41+00:00" }, { "name": "symfony/finder", - "version": "v4.3.8", + "version": "v4.4.2", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "72a068f77e317ae77c0a0495236ad292cfb5ce6f" + "reference": "ce8743441da64c41e2a667b8eb66070444ed911e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/72a068f77e317ae77c0a0495236ad292cfb5ce6f", - "reference": "72a068f77e317ae77c0a0495236ad292cfb5ce6f", + "url": "https://api.github.com/repos/symfony/finder/zipball/ce8743441da64c41e2a667b8eb66070444ed911e", + "reference": "ce8743441da64c41e2a667b8eb66070444ed911e", "shasum": "" }, "require": { @@ -2332,7 +2337,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -2359,20 +2364,20 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2019-10-30T12:53:54+00:00" + "time": "2019-11-17T21:56:56+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.12.0", + "version": "v1.13.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "550ebaac289296ce228a706d0867afc34687e3f4" + "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/550ebaac289296ce228a706d0867afc34687e3f4", - "reference": "550ebaac289296ce228a706d0867afc34687e3f4", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", + "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", "shasum": "" }, "require": { @@ -2384,7 +2389,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.12-dev" + "dev-master": "1.13-dev" } }, "autoload": { @@ -2417,20 +2422,20 @@ "polyfill", "portable" ], - "time": "2019-08-06T08:03:45+00:00" + "time": "2019-11-27T13:56:44+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.12.0", + "version": "v1.13.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17" + "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/b42a2f66e8f1b15ccf25652c3424265923eb4f17", - "reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f", + "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f", "shasum": "" }, "require": { @@ -2442,7 +2447,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.12-dev" + "dev-master": "1.13-dev" } }, "autoload": { @@ -2476,20 +2481,78 @@ "portable", "shim" ], - "time": "2019-08-06T08:03:45+00:00" + "time": "2019-11-27T14:18:11+00:00" + }, + { + "name": "symfony/polyfill-php73", + "version": "v1.13.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "4b0e2222c55a25b4541305a053013d5647d3a25f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/4b0e2222c55a25b4541305a053013d5647d3a25f", + "reference": "4b0e2222c55a25b4541305a053013d5647d3a25f", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.13-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2019-11-27T16:25:15+00:00" }, { "name": "symfony/process", - "version": "v4.3.8", + "version": "v4.4.2", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "3b2e0cb029afbb0395034509291f21191d1a4db0" + "reference": "b84501ad50adb72a94fb460a5b5c91f693e99c9b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/3b2e0cb029afbb0395034509291f21191d1a4db0", - "reference": "3b2e0cb029afbb0395034509291f21191d1a4db0", + "url": "https://api.github.com/repos/symfony/process/zipball/b84501ad50adb72a94fb460a5b5c91f693e99c9b", + "reference": "b84501ad50adb72a94fb460a5b5c91f693e99c9b", "shasum": "" }, "require": { @@ -2498,7 +2561,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -2525,7 +2588,65 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2019-10-28T17:07:32+00:00" + "time": "2019-12-06T10:06:46+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v2.0.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "144c5e51266b281231e947b51223ba14acf1a749" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/144c5e51266b281231e947b51223ba14acf1a749", + "reference": "144c5e51266b281231e947b51223ba14acf1a749", + "shasum": "" + }, + "require": { + "php": "^7.2.5", + "psr/container": "^1.0" + }, + "suggest": { + "symfony/service-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "time": "2019-11-18T17:27:11+00:00" }, { "name": "tedivm/jshrink", @@ -2841,6 +2962,7 @@ "captcha", "zf" ], + "abandoned": "laminas/laminas-captcha", "time": "2019-06-18T09:32:52+00:00" }, { @@ -2894,6 +3016,7 @@ "code", "zf" ], + "abandoned": "laminas/laminas-code", "time": "2019-08-31T14:14:34+00:00" }, { @@ -2950,6 +3073,7 @@ "config", "zf2" ], + "abandoned": "laminas/laminas-config", "time": "2016-02-04T23:01:10+00:00" }, { @@ -3003,6 +3127,7 @@ "console", "zf" ], + "abandoned": "laminas/laminas-console", "time": "2019-02-04T19:48:22+00:00" }, { @@ -3053,20 +3178,21 @@ "crypt", "zf2" ], + "abandoned": "laminas/laminas-crypt", "time": "2016-02-03T23:46:30+00:00" }, { "name": "zendframework/zend-db", - "version": "2.10.0", + "version": "2.11.0", "source": { "type": "git", "url": "https://github.com/zendframework/zend-db.git", - "reference": "77022f06f6ffd384fa86d22ab8d8bbdb925a1e8e" + "reference": "71626f95f6f9ee326e4be3c34228c1c466300a2c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-db/zipball/77022f06f6ffd384fa86d22ab8d8bbdb925a1e8e", - "reference": "77022f06f6ffd384fa86d22ab8d8bbdb925a1e8e", + "url": "https://api.github.com/repos/zendframework/zend-db/zipball/71626f95f6f9ee326e4be3c34228c1c466300a2c", + "reference": "71626f95f6f9ee326e4be3c34228c1c466300a2c", "shasum": "" }, "require": { @@ -3074,7 +3200,7 @@ "zendframework/zend-stdlib": "^2.7 || ^3.0" }, "require-dev": { - "phpunit/phpunit": "^5.7.25 || ^6.4.4", + "phpunit/phpunit": "^5.7.27 || ^6.5.14", "zendframework/zend-coding-standard": "~1.0.0", "zendframework/zend-eventmanager": "^2.6.2 || ^3.0", "zendframework/zend-hydrator": "^1.1 || ^2.1 || ^3.0", @@ -3088,8 +3214,8 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.9-dev", - "dev-develop": "2.10-dev" + "dev-master": "2.11.x-dev", + "dev-develop": "2.12.x-dev" }, "zf": { "component": "Zend\\Db", @@ -3111,7 +3237,8 @@ "db", "zf" ], - "time": "2019-02-25T11:37:45+00:00" + "abandoned": "laminas/laminas-db", + "time": "2019-12-31T19:43:46+00:00" }, { "name": "zendframework/zend-di", @@ -3158,6 +3285,7 @@ "di", "zf2" ], + "abandoned": "laminas/laminas-di", "time": "2016-04-25T20:58:11+00:00" }, { @@ -3220,6 +3348,7 @@ "psr", "psr-7" ], + "abandoned": "laminas/laminas-diactoros", "time": "2019-08-06T17:53:53+00:00" }, { @@ -3265,6 +3394,7 @@ "escaper", "zf" ], + "abandoned": "laminas/laminas-escaper", "time": "2019-09-05T20:03:20+00:00" }, { @@ -3319,6 +3449,7 @@ "events", "zf2" ], + "abandoned": "laminas/laminas-eventmanager", "time": "2018-04-25T15:33:34+00:00" }, { @@ -3382,6 +3513,7 @@ "feed", "zf" ], + "abandoned": "laminas/laminas-feed", "time": "2019-03-05T20:08:49+00:00" }, { @@ -3447,6 +3579,7 @@ "filter", "zf" ], + "abandoned": "laminas/laminas-filter", "time": "2019-08-19T07:08:04+00:00" }, { @@ -3525,20 +3658,21 @@ "form", "zf" ], + "abandoned": "laminas/laminas-form", "time": "2019-10-04T10:46:36+00:00" }, { "name": "zendframework/zend-http", - "version": "2.10.0", + "version": "2.11.2", "source": { "type": "git", "url": "https://github.com/zendframework/zend-http.git", - "reference": "4b4983178693a8fdda53b0bbee58552e2d2b1ac0" + "reference": "e15e0ce45a2a4f642cd0b7b4f4d4d0366b729a1a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-http/zipball/4b4983178693a8fdda53b0bbee58552e2d2b1ac0", - "reference": "4b4983178693a8fdda53b0bbee58552e2d2b1ac0", + "url": "https://api.github.com/repos/zendframework/zend-http/zipball/e15e0ce45a2a4f642cd0b7b4f4d4d0366b729a1a", + "reference": "e15e0ce45a2a4f642cd0b7b4f4d4d0366b729a1a", "shasum": "" }, "require": { @@ -3559,8 +3693,8 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.10.x-dev", - "dev-develop": "2.11.x-dev" + "dev-master": "2.11.x-dev", + "dev-develop": "2.12.x-dev" } }, "autoload": { @@ -3580,7 +3714,8 @@ "zend", "zf" ], - "time": "2019-02-19T18:58:14+00:00" + "abandoned": "laminas/laminas-http", + "time": "2019-12-30T20:47:33+00:00" }, { "name": "zendframework/zend-hydrator", @@ -3640,26 +3775,31 @@ "hydrator", "zf" ], + "abandoned": "laminas/laminas-hydrator", "time": "2019-10-04T11:17:36+00:00" }, { "name": "zendframework/zend-i18n", - "version": "2.9.2", + "version": "2.10.1", "source": { "type": "git", "url": "https://github.com/zendframework/zend-i18n.git", - "reference": "e17a54b3aee333ab156958f570cde630acee8b07" + "reference": "84038e6a1838b611dcc491b1c40321fa4c3a123c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-i18n/zipball/e17a54b3aee333ab156958f570cde630acee8b07", - "reference": "e17a54b3aee333ab156958f570cde630acee8b07", + "url": "https://api.github.com/repos/zendframework/zend-i18n/zipball/84038e6a1838b611dcc491b1c40321fa4c3a123c", + "reference": "84038e6a1838b611dcc491b1c40321fa4c3a123c", "shasum": "" }, "require": { + "ext-intl": "*", "php": "^5.6 || ^7.0", "zendframework/zend-stdlib": "^2.7 || ^3.0" }, + "conflict": { + "phpspec/prophecy": "<1.9.0" + }, "require-dev": { "phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.5.16", "zendframework/zend-cache": "^2.6.1", @@ -3672,7 +3812,6 @@ "zendframework/zend-view": "^2.6.3" }, "suggest": { - "ext-intl": "Required for most features of Zend\\I18n; included in default builds of PHP", "zendframework/zend-cache": "Zend\\Cache component", "zendframework/zend-config": "Zend\\Config component", "zendframework/zend-eventmanager": "You should install this package to use the events in the translator", @@ -3685,8 +3824,8 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.9.x-dev", - "dev-develop": "2.10.x-dev" + "dev-master": "2.10.x-dev", + "dev-develop": "2.11.x-dev" }, "zf": { "component": "Zend\\I18n", @@ -3708,7 +3847,8 @@ "i18n", "zf" ], - "time": "2019-09-30T12:04:37+00:00" + "abandoned": "laminas/laminas-i18n", + "time": "2019-12-12T14:08:22+00:00" }, { "name": "zendframework/zend-inputfilter", @@ -3765,6 +3905,7 @@ "inputfilter", "zf" ], + "abandoned": "laminas/laminas-inputfilter", "time": "2019-08-28T19:45:32+00:00" }, { @@ -3820,6 +3961,7 @@ "json", "zf2" ], + "abandoned": "laminas/laminas-json", "time": "2016-02-04T21:20:26+00:00" }, { @@ -3865,25 +4007,26 @@ "loader", "zf" ], + "abandoned": "laminas/laminas-loader", "time": "2019-09-04T19:38:14+00:00" }, { "name": "zendframework/zend-log", - "version": "2.11.0", + "version": "2.12.0", "source": { "type": "git", "url": "https://github.com/zendframework/zend-log.git", - "reference": "cb278772afdacb1924342248a069330977625ae6" + "reference": "e5ec088dc8a7b4d96a3a6627761f720a738a36b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-log/zipball/cb278772afdacb1924342248a069330977625ae6", - "reference": "cb278772afdacb1924342248a069330977625ae6", + "url": "https://api.github.com/repos/zendframework/zend-log/zipball/e5ec088dc8a7b4d96a3a6627761f720a738a36b8", + "reference": "e5ec088dc8a7b4d96a3a6627761f720a738a36b8", "shasum": "" }, "require": { "php": "^5.6 || ^7.0", - "psr/log": "^1.0", + "psr/log": "^1.1.2", "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3", "zendframework/zend-stdlib": "^2.7 || ^3.0" }, @@ -3911,8 +4054,8 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.11.x-dev", - "dev-develop": "2.12.x-dev" + "dev-master": "2.12.x-dev", + "dev-develop": "2.13.x-dev" }, "zf": { "component": "Zend\\Log", @@ -3935,7 +4078,8 @@ "logging", "zf" ], - "time": "2019-08-23T21:28:18+00:00" + "abandoned": "laminas/laminas-log", + "time": "2019-12-27T16:18:31+00:00" }, { "name": "zendframework/zend-mail", @@ -3997,6 +4141,7 @@ "mail", "zf" ], + "abandoned": "laminas/laminas-mail", "time": "2018-06-07T13:37:07+00:00" }, { @@ -4047,6 +4192,7 @@ "math", "zf2" ], + "abandoned": "laminas/laminas-math", "time": "2018-12-04T15:34:17+00:00" }, { @@ -4097,6 +4243,7 @@ "mime", "zf" ], + "abandoned": "laminas/laminas-mime", "time": "2019-10-16T19:30:37+00:00" }, { @@ -4156,6 +4303,7 @@ "modulemanager", "zf" ], + "abandoned": "laminas/laminas-modulemanager", "time": "2019-10-28T13:29:38+00:00" }, { @@ -4251,6 +4399,7 @@ "mvc", "zf2" ], + "abandoned": "laminas/laminas-mvc", "time": "2018-05-03T13:13:41+00:00" }, { @@ -4300,6 +4449,7 @@ "psr", "psr-7" ], + "abandoned": "laminas/laminas-psr7bridge", "time": "2016-05-10T21:44:39+00:00" }, { @@ -4357,6 +4507,7 @@ "serializer", "zf" ], + "abandoned": "laminas/laminas-serializer", "time": "2019-10-19T08:06:30+00:00" }, { @@ -4404,6 +4555,7 @@ "server", "zf" ], + "abandoned": "laminas/laminas-server", "time": "2019-10-16T18:27:05+00:00" }, { @@ -4456,6 +4608,7 @@ "servicemanager", "zf2" ], + "abandoned": "laminas/laminas-servicemanager", "time": "2018-06-22T14:49:54+00:00" }, { @@ -4523,6 +4676,7 @@ "session", "zf" ], + "abandoned": "laminas/laminas-session", "time": "2019-10-28T19:40:43+00:00" }, { @@ -4576,6 +4730,7 @@ "soap", "zf2" ], + "abandoned": "laminas/laminas-soap", "time": "2019-04-30T16:45:35+00:00" }, { @@ -4622,6 +4777,7 @@ "stdlib", "zf" ], + "abandoned": "laminas/laminas-stdlib", "time": "2018-08-28T21:34:05+00:00" }, { @@ -4670,6 +4826,7 @@ "text", "zf" ], + "abandoned": "laminas/laminas-text", "time": "2019-10-16T20:36:27+00:00" }, { @@ -4717,29 +4874,32 @@ "uri", "zf" ], + "abandoned": "laminas/laminas-uri", "time": "2019-10-07T13:35:33+00:00" }, { "name": "zendframework/zend-validator", - "version": "2.12.2", + "version": "2.13.0", "source": { "type": "git", "url": "https://github.com/zendframework/zend-validator.git", - "reference": "fd24920c2afcf2a70d11f67c3457f8f509453a62" + "reference": "b54acef1f407741c5347f2a97f899ab21f2229ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-validator/zipball/fd24920c2afcf2a70d11f67c3457f8f509453a62", - "reference": "fd24920c2afcf2a70d11f67c3457f8f509453a62", + "url": "https://api.github.com/repos/zendframework/zend-validator/zipball/b54acef1f407741c5347f2a97f899ab21f2229ef", + "reference": "b54acef1f407741c5347f2a97f899ab21f2229ef", "shasum": "" }, "require": { "container-interop/container-interop": "^1.1", - "php": "^5.6 || ^7.0", + "php": "^7.1", "zendframework/zend-stdlib": "^3.2.1" }, "require-dev": { "phpunit/phpunit": "^6.0.8 || ^5.7.15", + "psr/http-client": "^1.0", + "psr/http-factory": "^1.0", "psr/http-message": "^1.0", "zendframework/zend-cache": "^2.6.1", "zendframework/zend-coding-standard": "~1.0.0", @@ -4767,8 +4927,8 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.12.x-dev", - "dev-develop": "2.13.x-dev" + "dev-master": "2.13.x-dev", + "dev-develop": "2.14.x-dev" }, "zf": { "component": "Zend\\Validator", @@ -4790,20 +4950,21 @@ "validator", "zf" ], - "time": "2019-10-29T08:33:25+00:00" + "abandoned": "laminas/laminas-validator", + "time": "2019-12-28T04:07:18+00:00" }, { "name": "zendframework/zend-view", - "version": "2.11.3", + "version": "2.11.4", "source": { "type": "git", "url": "https://github.com/zendframework/zend-view.git", - "reference": "e766457bd6ce13c5354e443bb949511b6904d7f5" + "reference": "a8b1b2d9b52e191539be861a6529f8c8a0c06b9d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-view/zipball/e766457bd6ce13c5354e443bb949511b6904d7f5", - "reference": "e766457bd6ce13c5354e443bb949511b6904d7f5", + "url": "https://api.github.com/repos/zendframework/zend-view/zipball/a8b1b2d9b52e191539be861a6529f8c8a0c06b9d", + "reference": "a8b1b2d9b52e191539be861a6529f8c8a0c06b9d", "shasum": "" }, "require": { @@ -4877,7 +5038,8 @@ "view", "zf" ], - "time": "2019-10-11T21:10:04+00:00" + "abandoned": "laminas/laminas-view", + "time": "2019-12-04T08:40:50+00:00" } ], "packages-dev": [ @@ -4934,23 +5096,23 @@ }, { "name": "allure-framework/allure-php-api", - "version": "1.1.5", + "version": "1.1.6", "source": { "type": "git", "url": "https://github.com/allure-framework/allure-php-commons.git", - "reference": "c7a675823ad75b8e02ddc364baae21668e7c4e88" + "reference": "2c62a70d60eca190253a6b80e9aa4c2ebc2e6e7f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/allure-framework/allure-php-commons/zipball/c7a675823ad75b8e02ddc364baae21668e7c4e88", - "reference": "c7a675823ad75b8e02ddc364baae21668e7c4e88", + "url": "https://api.github.com/repos/allure-framework/allure-php-commons/zipball/2c62a70d60eca190253a6b80e9aa4c2ebc2e6e7f", + "reference": "2c62a70d60eca190253a6b80e9aa4c2ebc2e6e7f", "shasum": "" }, "require": { - "jms/serializer": "^0.16.0", + "jms/serializer": "^0.16 || ^1.0", "php": ">=5.4.0", - "ramsey/uuid": "^3.0.0", - "symfony/http-foundation": "^2.0" + "ramsey/uuid": "^3.0", + "symfony/http-foundation": "^2.0 || ^3.0 || ^4.0" }, "require-dev": { "phpunit/phpunit": "^4.0.0" @@ -4983,7 +5145,7 @@ "php", "report" ], - "time": "2018-05-25T14:02:11+00:00" + "time": "2020-01-09T10:26:09+00:00" }, { "name": "allure-framework/allure-phpunit", @@ -5280,16 +5442,16 @@ }, { "name": "codeception/phpunit-wrapper", - "version": "6.7.0", + "version": "6.8.0", "source": { "type": "git", "url": "https://github.com/Codeception/phpunit-wrapper.git", - "reference": "93f59e028826464eac086052fa226e58967f6907" + "reference": "20e054e9cee8de0523322367bcccde8e6a3db263" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Codeception/phpunit-wrapper/zipball/93f59e028826464eac086052fa226e58967f6907", - "reference": "93f59e028826464eac086052fa226e58967f6907", + "url": "https://api.github.com/repos/Codeception/phpunit-wrapper/zipball/20e054e9cee8de0523322367bcccde8e6a3db263", + "reference": "20e054e9cee8de0523322367bcccde8e6a3db263", "shasum": "" }, "require": { @@ -5322,7 +5484,7 @@ } ], "description": "PHPUnit classes used by Codeception", - "time": "2019-08-18T15:43:35+00:00" + "time": "2020-01-03T08:01:16+00:00" }, { "name": "codeception/stub", @@ -6162,16 +6324,16 @@ }, { "name": "doctrine/cache", - "version": "1.9.1", + "version": "1.10.0", "source": { "type": "git", "url": "https://github.com/doctrine/cache.git", - "reference": "89a5c76c39c292f7798f964ab3c836c3f8192a55" + "reference": "382e7f4db9a12dc6c19431743a2b096041bcdd62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/89a5c76c39c292f7798f964ab3c836c3f8192a55", - "reference": "89a5c76c39c292f7798f964ab3c836c3f8192a55", + "url": "https://api.github.com/repos/doctrine/cache/zipball/382e7f4db9a12dc6c19431743a2b096041bcdd62", + "reference": "382e7f4db9a12dc6c19431743a2b096041bcdd62", "shasum": "" }, "require": { @@ -6238,10 +6400,9 @@ "memcached", "php", "redis", - "riak", "xcache" ], - "time": "2019-11-15T14:31:57+00:00" + "time": "2019-11-29T15:36:20+00:00" }, { "name": "doctrine/inflector", @@ -6490,16 +6651,16 @@ }, { "name": "flow/jsonpath", - "version": "0.4.0", + "version": "0.5.0", "source": { "type": "git", "url": "https://github.com/FlowCommunications/JSONPath.git", - "reference": "f0222818d5c938e4ab668ab2e2c079bd51a27112" + "reference": "b9738858c75d008c1211612b973e9510f8b7f8ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FlowCommunications/JSONPath/zipball/f0222818d5c938e4ab668ab2e2c079bd51a27112", - "reference": "f0222818d5c938e4ab668ab2e2c079bd51a27112", + "url": "https://api.github.com/repos/FlowCommunications/JSONPath/zipball/b9738858c75d008c1211612b973e9510f8b7f8ea", + "reference": "b9738858c75d008c1211612b973e9510f8b7f8ea", "shasum": "" }, "require": { @@ -6507,7 +6668,7 @@ }, "require-dev": { "peekmo/jsonpath": "dev-master", - "phpunit/phpunit": "^4.0" + "phpunit/phpunit": "^7.0" }, "type": "library", "autoload": { @@ -6527,7 +6688,7 @@ } ], "description": "JSONPath implementation for parsing, searching and flattening arrays", - "time": "2018-03-04T16:39:47+00:00" + "time": "2019-07-15T17:23:22+00:00" }, { "name": "friendsofphp/php-cs-fixer", @@ -6620,16 +6781,16 @@ }, { "name": "fzaninotto/faker", - "version": "v1.9.0", + "version": "v1.9.1", "source": { "type": "git", "url": "https://github.com/fzaninotto/Faker.git", - "reference": "27a216cbe72327b2d6369fab721a5843be71e57d" + "reference": "fc10d778e4b84d5bd315dad194661e091d307c6f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/27a216cbe72327b2d6369fab721a5843be71e57d", - "reference": "27a216cbe72327b2d6369fab721a5843be71e57d", + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/fc10d778e4b84d5bd315dad194661e091d307c6f", + "reference": "fc10d778e4b84d5bd315dad194661e091d307c6f", "shasum": "" }, "require": { @@ -6642,7 +6803,9 @@ }, "type": "library", "extra": { - "branch-alias": [] + "branch-alias": { + "dev-master": "1.9-dev" + } }, "autoload": { "psr-4": { @@ -6664,7 +6827,7 @@ "faker", "fixtures" ], - "time": "2019-11-14T13:13:06+00:00" + "time": "2019-12-12T13:22:17+00:00" }, { "name": "grasmash/expander", @@ -6761,48 +6924,6 @@ "description": "Expands internal property references in a yaml file.", "time": "2017-12-16T16:06:03+00:00" }, - { - "name": "ircmaxell/password-compat", - "version": "v1.0.4", - "source": { - "type": "git", - "url": "https://github.com/ircmaxell/password_compat.git", - "reference": "5c5cde8822a69545767f7c7f3058cb15ff84614c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ircmaxell/password_compat/zipball/5c5cde8822a69545767f7c7f3058cb15ff84614c", - "reference": "5c5cde8822a69545767f7c7f3058cb15ff84614c", - "shasum": "" - }, - "require-dev": { - "phpunit/phpunit": "4.*" - }, - "type": "library", - "autoload": { - "files": [ - "lib/password.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Anthony Ferrara", - "email": "ircmaxell@php.net", - "homepage": "http://blog.ircmaxell.com" - } - ], - "description": "A compatibility library for the proposed simplified password hashing algorithm: https://wiki.php.net/rfc/password_hash", - "homepage": "https://github.com/ircmaxell/password_compat", - "keywords": [ - "hashing", - "password" - ], - "time": "2014-11-20T16:49:30+00:00" - }, { "name": "jms/metadata", "version": "1.7.0", @@ -6895,44 +7016,56 @@ }, { "name": "jms/serializer", - "version": "0.16.0", + "version": "1.14.0", "source": { "type": "git", "url": "https://github.com/schmittjoh/serializer.git", - "reference": "c8a171357ca92b6706e395c757f334902d430ea9" + "reference": "ee96d57024af9a7716d56fcbe3aa94b3d030f3ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/serializer/zipball/c8a171357ca92b6706e395c757f334902d430ea9", - "reference": "c8a171357ca92b6706e395c757f334902d430ea9", + "url": "https://api.github.com/repos/schmittjoh/serializer/zipball/ee96d57024af9a7716d56fcbe3aa94b3d030f3ca", + "reference": "ee96d57024af9a7716d56fcbe3aa94b3d030f3ca", "shasum": "" }, "require": { - "doctrine/annotations": "1.*", - "jms/metadata": "~1.1", + "doctrine/annotations": "^1.0", + "doctrine/instantiator": "^1.0.3", + "jms/metadata": "^1.3", "jms/parser-lib": "1.*", - "php": ">=5.3.2", - "phpcollection/phpcollection": "~0.1" + "php": "^5.5|^7.0", + "phpcollection/phpcollection": "~0.1", + "phpoption/phpoption": "^1.1" + }, + "conflict": { + "twig/twig": "<1.12" }, "require-dev": { "doctrine/orm": "~2.1", - "doctrine/phpcr-odm": "~1.0.1", - "jackalope/jackalope-doctrine-dbal": "1.0.*", + "doctrine/phpcr-odm": "^1.3|^2.0", + "ext-pdo_sqlite": "*", + "jackalope/jackalope-doctrine-dbal": "^1.1.5", + "phpunit/phpunit": "^4.8|^5.0", "propel/propel1": "~1.7", - "symfony/filesystem": "2.*", - "symfony/form": "~2.1", - "symfony/translation": "~2.0", - "symfony/validator": "~2.0", - "symfony/yaml": "2.*", - "twig/twig": ">=1.8,<2.0-dev" + "psr/container": "^1.0", + "symfony/dependency-injection": "^2.7|^3.3|^4.0", + "symfony/expression-language": "^2.6|^3.0", + "symfony/filesystem": "^2.1", + "symfony/form": "~2.1|^3.0", + "symfony/translation": "^2.1|^3.0", + "symfony/validator": "^2.2|^3.0", + "symfony/yaml": "^2.1|^3.0", + "twig/twig": "~1.12|~2.0" }, "suggest": { + "doctrine/cache": "Required if you like to use cache functionality.", + "doctrine/collections": "Required if you like to use doctrine collection types as ArrayCollection.", "symfony/yaml": "Required if you'd like to serialize data to YAML format." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "0.15-dev" + "dev-1.x": "1.14-dev" } }, "autoload": { @@ -6942,14 +7075,16 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "Apache2" + "MIT" ], "authors": [ { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com", - "homepage": "https://github.com/schmittjoh", - "role": "Developer of wrapped JMSSerializerBundle" + "name": "Asmir Mustafic", + "email": "goetas@gmail.com" + }, + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com" } ], "description": "Library for (de-)serializing data of any complexity; supports XML, JSON, and YAML.", @@ -6961,7 +7096,7 @@ "serialization", "xml" ], - "time": "2014-03-18T08:39:00+00:00" + "time": "2019-04-17T08:12:16+00:00" }, { "name": "league/container", @@ -7030,16 +7165,16 @@ }, { "name": "league/flysystem", - "version": "1.0.57", + "version": "1.0.63", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "0e9db7f0b96b9f12dcf6f65bc34b72b1a30ea55a" + "reference": "8132daec326565036bc8e8d1876f77ec183a7bd6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/0e9db7f0b96b9f12dcf6f65bc34b72b1a30ea55a", - "reference": "0e9db7f0b96b9f12dcf6f65bc34b72b1a30ea55a", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/8132daec326565036bc8e8d1876f77ec183a7bd6", + "reference": "8132daec326565036bc8e8d1876f77ec183a7bd6", "shasum": "" }, "require": { @@ -7110,7 +7245,7 @@ "sftp", "storage" ], - "time": "2019-10-16T21:01:05+00:00" + "time": "2020-01-04T16:30:31+00:00" }, { "name": "lusitanian/oauth", @@ -7344,16 +7479,16 @@ }, { "name": "mustache/mustache", - "version": "v2.12.0", + "version": "v2.13.0", "source": { "type": "git", "url": "https://github.com/bobthecow/mustache.php.git", - "reference": "fe8fe72e9d580591854de404cc59a1b83ca4d19e" + "reference": "e95c5a008c23d3151d59ea72484d4f72049ab7f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/mustache.php/zipball/fe8fe72e9d580591854de404cc59a1b83ca4d19e", - "reference": "fe8fe72e9d580591854de404cc59a1b83ca4d19e", + "url": "https://api.github.com/repos/bobthecow/mustache.php/zipball/e95c5a008c23d3151d59ea72484d4f72049ab7f4", + "reference": "e95c5a008c23d3151d59ea72484d4f72049ab7f4", "shasum": "" }, "require": { @@ -7386,20 +7521,20 @@ "mustache", "templating" ], - "time": "2017-07-11T12:54:05+00:00" + "time": "2019-11-23T21:40:31+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.9.3", + "version": "1.9.4", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea" + "reference": "579bb7356d91f9456ccd505f24ca8b667966a0a7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/007c053ae6f31bba39dfa19a7726f56e9763bbea", - "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/579bb7356d91f9456ccd505f24ca8b667966a0a7", + "reference": "579bb7356d91f9456ccd505f24ca8b667966a0a7", "shasum": "" }, "require": { @@ -7434,59 +7569,7 @@ "object", "object graph" ], - "time": "2019-08-09T12:45:53+00:00" - }, - { - "name": "nikic/php-parser", - "version": "v4.3.0", - "source": { - "type": "git", - "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "9a9981c347c5c49d6dfe5cf826bb882b824080dc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/9a9981c347c5c49d6dfe5cf826bb882b824080dc", - "reference": "9a9981c347c5c49d6dfe5cf826bb882b824080dc", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=7.0" - }, - "require-dev": { - "ircmaxell/php-yacc": "0.0.5", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0" - }, - "bin": [ - "bin/php-parse" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.3-dev" - } - }, - "autoload": { - "psr-4": { - "PhpParser\\": "lib/PhpParser" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Nikita Popov" - } - ], - "description": "A PHP parser written in PHP", - "keywords": [ - "parser", - "php" - ], - "time": "2019-11-08T13:50:10+00:00" + "time": "2019-12-15T19:12:40+00:00" }, { "name": "pdepend/pdepend", @@ -7731,16 +7814,16 @@ }, { "name": "phpcompatibility/php-compatibility", - "version": "9.3.4", + "version": "9.3.5", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibility.git", - "reference": "1f37659196e4f3113ea506a7efba201c52303bf1" + "reference": "9fb324479acf6f39452e0655d2429cc0d3914243" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/1f37659196e4f3113ea506a7efba201c52303bf1", - "reference": "1f37659196e4f3113ea506a7efba201c52303bf1", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243", + "reference": "9fb324479acf6f39452e0655d2429cc0d3914243", "shasum": "" }, "require": { @@ -7785,7 +7868,7 @@ "phpcs", "standards" ], - "time": "2019-11-15T04:12:02+00:00" + "time": "2019-12-27T09:44:58+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -7841,16 +7924,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "4.3.2", + "version": "4.3.4", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e" + "reference": "da3fd972d6bafd628114f7e7e036f45944b62e9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/b83ff7cfcfee7827e1e78b637a5904fe6a96698e", - "reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/da3fd972d6bafd628114f7e7e036f45944b62e9c", + "reference": "da3fd972d6bafd628114f7e7e036f45944b62e9c", "shasum": "" }, "require": { @@ -7862,6 +7945,7 @@ "require-dev": { "doctrine/instantiator": "^1.0.5", "mockery/mockery": "^1.0", + "phpdocumentor/type-resolver": "0.4.*", "phpunit/phpunit": "^6.4" }, "type": "library", @@ -7888,7 +7972,7 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2019-09-12T14:27:41+00:00" + "time": "2019-12-28T18:55:12+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -8007,33 +8091,34 @@ }, { "name": "phpoption/phpoption", - "version": "1.5.2", + "version": "1.7.2", "source": { "type": "git", "url": "https://github.com/schmittjoh/php-option.git", - "reference": "2ba2586380f8d2b44ad1b9feb61c371020b27793" + "reference": "77f7c4d2e65413aff5b5a8cc8b3caf7a28d81959" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/2ba2586380f8d2b44ad1b9feb61c371020b27793", - "reference": "2ba2586380f8d2b44ad1b9feb61c371020b27793", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/77f7c4d2e65413aff5b5a8cc8b3caf7a28d81959", + "reference": "77f7c4d2e65413aff5b5a8cc8b3caf7a28d81959", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": "^5.5.9 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "^4.7|^5.0" + "bamarni/composer-bin-plugin": "^1.3", + "phpunit/phpunit": "^4.8.35 || ^5.0 || ^6.0 || ^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.5-dev" + "dev-master": "1.7-dev" } }, "autoload": { - "psr-0": { - "PhpOption\\": "src/" + "psr-4": { + "PhpOption\\": "src/PhpOption/" } }, "notification-url": "https://packagist.org/downloads/", @@ -8044,6 +8129,10 @@ { "name": "Johannes M. Schmitt", "email": "schmittjoh@gmail.com" + }, + { + "name": "Graham Campbell", + "email": "graham@alt-three.com" } ], "description": "Option Type for PHP", @@ -8053,37 +8142,37 @@ "php", "type" ], - "time": "2019-11-06T22:27:00+00:00" + "time": "2019-12-15T19:35:24+00:00" }, { "name": "phpspec/prophecy", - "version": "1.9.0", + "version": "1.10.1", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203" + "reference": "cbe1df668b3fe136bcc909126a0f529a78d4cbbc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/f6811d96d97bdf400077a0cc100ae56aa32b9203", - "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/cbe1df668b3fe136bcc909126a0f529a78d4cbbc", + "reference": "cbe1df668b3fe136bcc909126a0f529a78d4cbbc", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", - "sebastian/comparator": "^1.1|^2.0|^3.0", + "sebastian/comparator": "^1.2.3|^2.0|^3.0", "sebastian/recursion-context": "^1.0|^2.0|^3.0" }, "require-dev": { - "phpspec/phpspec": "^2.5|^3.2", + "phpspec/phpspec": "^2.5 || ^3.2", "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8.x-dev" + "dev-master": "1.10.x-dev" } }, "autoload": { @@ -8116,24 +8205,23 @@ "spy", "stub" ], - "time": "2019-10-03T11:07:50+00:00" + "time": "2019-12-22T21:05:45+00:00" }, { "name": "phpstan/phpstan", - "version": "0.12.3", + "version": "0.12.5", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "c15a6ea55da71d8133399306f560cfe4d30301b7" + "reference": "71a20c18f06c53605251a00a8efe443fa85225d1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c15a6ea55da71d8133399306f560cfe4d30301b7", - "reference": "c15a6ea55da71d8133399306f560cfe4d30301b7", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/71a20c18f06c53605251a00a8efe443fa85225d1", + "reference": "71a20c18f06c53605251a00a8efe443fa85225d1", "shasum": "" }, "require": { - "nikic/php-parser": "^4.3.0", "php": "^7.1" }, "bin": [ @@ -8156,7 +8244,7 @@ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", - "time": "2019-12-14T13:41:17+00:00" + "time": "2020-01-12T14:31:21+00:00" }, { "name": "phpunit/php-code-coverage", @@ -9346,27 +9434,27 @@ }, { "name": "symfony/browser-kit", - "version": "v4.3.8", + "version": "v4.4.2", "source": { "type": "git", "url": "https://github.com/symfony/browser-kit.git", - "reference": "b14fa08508afd152257d5dcc7adb5f278654d972" + "reference": "e19e465c055137938afd40cfddd687e7511bbbf0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/b14fa08508afd152257d5dcc7adb5f278654d972", - "reference": "b14fa08508afd152257d5dcc7adb5f278654d972", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/e19e465c055137938afd40cfddd687e7511bbbf0", + "reference": "e19e465c055137938afd40cfddd687e7511bbbf0", "shasum": "" }, "require": { "php": "^7.1.3", - "symfony/dom-crawler": "~3.4|~4.0" + "symfony/dom-crawler": "^3.4|^4.0|^5.0" }, "require-dev": { - "symfony/css-selector": "~3.4|~4.0", - "symfony/http-client": "^4.3", - "symfony/mime": "^4.3", - "symfony/process": "~3.4|~4.0" + "symfony/css-selector": "^3.4|^4.0|^5.0", + "symfony/http-client": "^4.3|^5.0", + "symfony/mime": "^4.3|^5.0", + "symfony/process": "^3.4|^4.0|^5.0" }, "suggest": { "symfony/process": "" @@ -9374,7 +9462,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -9401,36 +9489,36 @@ ], "description": "Symfony BrowserKit Component", "homepage": "https://symfony.com", - "time": "2019-10-28T17:07:32+00:00" + "time": "2019-10-28T20:30:34+00:00" }, { "name": "symfony/config", - "version": "v4.3.8", + "version": "v4.4.2", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "8267214841c44d315a55242ea867684eb43c42ce" + "reference": "6911d432edd5b50822986604fd5a5be3af856d30" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/8267214841c44d315a55242ea867684eb43c42ce", - "reference": "8267214841c44d315a55242ea867684eb43c42ce", + "url": "https://api.github.com/repos/symfony/config/zipball/6911d432edd5b50822986604fd5a5be3af856d30", + "reference": "6911d432edd5b50822986604fd5a5be3af856d30", "shasum": "" }, "require": { "php": "^7.1.3", - "symfony/filesystem": "~3.4|~4.0", + "symfony/filesystem": "^3.4|^4.0|^5.0", "symfony/polyfill-ctype": "~1.8" }, "conflict": { "symfony/finder": "<3.4" }, "require-dev": { - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/event-dispatcher": "~3.4|~4.0", - "symfony/finder": "~3.4|~4.0", - "symfony/messenger": "~4.1", - "symfony/yaml": "~3.4|~4.0" + "symfony/event-dispatcher": "^3.4|^4.0|^5.0", + "symfony/finder": "^3.4|^4.0|^5.0", + "symfony/messenger": "^4.1|^5.0", + "symfony/service-contracts": "^1.1|^2", + "symfony/yaml": "^3.4|^4.0|^5.0" }, "suggest": { "symfony/yaml": "To use the yaml reference dumper" @@ -9438,7 +9526,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -9465,29 +9553,29 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2019-11-08T08:31:27+00:00" + "time": "2019-12-18T12:00:29+00:00" }, { "name": "symfony/dependency-injection", - "version": "v4.3.8", + "version": "v4.4.2", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "80c6d9e19467dfbba14f830ed478eb592ce51b64" + "reference": "79b0358207a3571cc3af02a57d0321927921f539" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/80c6d9e19467dfbba14f830ed478eb592ce51b64", - "reference": "80c6d9e19467dfbba14f830ed478eb592ce51b64", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/79b0358207a3571cc3af02a57d0321927921f539", + "reference": "79b0358207a3571cc3af02a57d0321927921f539", "shasum": "" }, "require": { "php": "^7.1.3", "psr/container": "^1.0", - "symfony/service-contracts": "^1.1.6" + "symfony/service-contracts": "^1.1.6|^2" }, "conflict": { - "symfony/config": "<4.3", + "symfony/config": "<4.3|>=5.0", "symfony/finder": "<3.4", "symfony/proxy-manager-bridge": "<3.4", "symfony/yaml": "<3.4" @@ -9498,8 +9586,8 @@ }, "require-dev": { "symfony/config": "^4.3", - "symfony/expression-language": "~3.4|~4.0", - "symfony/yaml": "~3.4|~4.0" + "symfony/expression-language": "^3.4|^4.0|^5.0", + "symfony/yaml": "^3.4|^4.0|^5.0" }, "suggest": { "symfony/config": "", @@ -9511,7 +9599,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -9538,20 +9626,20 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2019-11-08T16:22:27+00:00" + "time": "2019-12-19T16:00:02+00:00" }, { "name": "symfony/dom-crawler", - "version": "v4.3.8", + "version": "v4.4.2", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "4b9efd5708c3a38593e19b6a33e40867f4f89d72" + "reference": "36bbcab9369fc2f583220890efd43bf262d563fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/4b9efd5708c3a38593e19b6a33e40867f4f89d72", - "reference": "4b9efd5708c3a38593e19b6a33e40867f4f89d72", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/36bbcab9369fc2f583220890efd43bf262d563fd", + "reference": "36bbcab9369fc2f583220890efd43bf262d563fd", "shasum": "" }, "require": { @@ -9564,7 +9652,7 @@ }, "require-dev": { "masterminds/html5": "^2.6", - "symfony/css-selector": "~3.4|~4.0" + "symfony/css-selector": "^3.4|^4.0|^5.0" }, "suggest": { "symfony/css-selector": "" @@ -9572,7 +9660,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -9599,35 +9687,35 @@ ], "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2019-10-28T17:07:32+00:00" + "time": "2019-10-29T11:38:30+00:00" }, { "name": "symfony/http-foundation", - "version": "v2.8.52", + "version": "v4.4.2", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "3929d9fe8148d17819ad0178c748b8d339420709" + "reference": "fcae1cff5b57b2a9c3aabefeb1527678705ddb62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/3929d9fe8148d17819ad0178c748b8d339420709", - "reference": "3929d9fe8148d17819ad0178c748b8d339420709", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/fcae1cff5b57b2a9c3aabefeb1527678705ddb62", + "reference": "fcae1cff5b57b2a9c3aabefeb1527678705ddb62", "shasum": "" }, "require": { - "php": ">=5.3.9", - "symfony/polyfill-mbstring": "~1.1", - "symfony/polyfill-php54": "~1.0", - "symfony/polyfill-php55": "~1.0" + "php": "^7.1.3", + "symfony/mime": "^4.3|^5.0", + "symfony/polyfill-mbstring": "~1.1" }, "require-dev": { - "symfony/expression-language": "~2.4|~3.0.0" + "predis/predis": "~1.0", + "symfony/expression-language": "^3.4|^4.0|^5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -9654,34 +9742,43 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2019-11-12T12:34:41+00:00" + "time": "2019-12-19T15:57:49+00:00" }, { - "name": "symfony/options-resolver", - "version": "v4.3.8", + "name": "symfony/mime", + "version": "v5.0.2", "source": { "type": "git", - "url": "https://github.com/symfony/options-resolver.git", - "reference": "f46c7fc8e207bd8a2188f54f8738f232533765a4" + "url": "https://github.com/symfony/mime.git", + "reference": "0e6a4ced216e49d457eddcefb61132173a876d79" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/f46c7fc8e207bd8a2188f54f8738f232533765a4", - "reference": "f46c7fc8e207bd8a2188f54f8738f232533765a4", + "url": "https://api.github.com/repos/symfony/mime/zipball/0e6a4ced216e49d457eddcefb61132173a876d79", + "reference": "0e6a4ced216e49d457eddcefb61132173a876d79", "shasum": "" }, "require": { - "php": "^7.1.3" + "php": "^7.2.5", + "symfony/polyfill-intl-idn": "^1.10", + "symfony/polyfill-mbstring": "^1.0" + }, + "conflict": { + "symfony/mailer": "<4.4" + }, + "require-dev": { + "egulias/email-validator": "^2.1.10", + "symfony/dependency-injection": "^4.4|^5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "5.0-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\OptionsResolver\\": "" + "Symfony\\Component\\Mime\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -9701,47 +9798,43 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony OptionsResolver Component", + "description": "A library to manipulate MIME messages", "homepage": "https://symfony.com", "keywords": [ - "config", - "configuration", - "options" + "mime", + "mime-type" ], - "time": "2019-10-28T20:59:01+00:00" + "time": "2019-11-30T14:12:50+00:00" }, { - "name": "symfony/polyfill-php54", - "version": "v1.12.0", + "name": "symfony/options-resolver", + "version": "v4.4.2", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php54.git", - "reference": "a043bcced870214922fbb4bf22679d431ec0296a" + "url": "https://github.com/symfony/options-resolver.git", + "reference": "2be23e63f33de16b49294ea6581f462932a77e2f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/a043bcced870214922fbb4bf22679d431ec0296a", - "reference": "a043bcced870214922fbb4bf22679d431ec0296a", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/2be23e63f33de16b49294ea6581f462932a77e2f", + "reference": "2be23e63f33de16b49294ea6581f462932a77e2f", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.1.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.12-dev" + "dev-master": "4.4-dev" } }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Php54\\": "" + "Symfony\\Component\\OptionsResolver\\": "" }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -9750,51 +9843,54 @@ ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 5.4+ features to lower PHP versions", + "description": "Symfony OptionsResolver Component", "homepage": "https://symfony.com", "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" + "config", + "configuration", + "options" ], - "time": "2019-08-06T08:03:45+00:00" + "time": "2019-10-28T21:57:16+00:00" }, { - "name": "symfony/polyfill-php55", - "version": "v1.12.0", + "name": "symfony/polyfill-intl-idn", + "version": "v1.13.1", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php55.git", - "reference": "548bb39407e78e54f785b4e18c7e0d5d9e493265" + "url": "https://github.com/symfony/polyfill-intl-idn.git", + "reference": "6f9c239e61e1b0c9229a28ff89a812dc449c3d46" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/548bb39407e78e54f785b4e18c7e0d5d9e493265", - "reference": "548bb39407e78e54f785b4e18c7e0d5d9e493265", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/6f9c239e61e1b0c9229a28ff89a812dc449c3d46", + "reference": "6f9c239e61e1b0c9229a28ff89a812dc449c3d46", "shasum": "" }, "require": { - "ircmaxell/password-compat": "~1.0", - "php": ">=5.3.3" + "php": ">=5.3.3", + "symfony/polyfill-mbstring": "^1.3", + "symfony/polyfill-php72": "^1.9" + }, + "suggest": { + "ext-intl": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.12-dev" + "dev-master": "1.13-dev" } }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Php55\\": "" + "Symfony\\Polyfill\\Intl\\Idn\\": "" }, "files": [ "bootstrap.php" @@ -9806,36 +9902,38 @@ ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "name": "Laurent Bassin", + "email": "laurent@bassin.info" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 5.5+ features to lower PHP versions", + "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions", "homepage": "https://symfony.com", "keywords": [ "compatibility", + "idn", + "intl", "polyfill", "portable", "shim" ], - "time": "2019-08-06T08:03:45+00:00" + "time": "2019-11-27T13:56:44+00:00" }, { "name": "symfony/polyfill-php70", - "version": "v1.12.0", + "version": "v1.13.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "54b4c428a0054e254223797d2713c31e08610831" + "reference": "af23c7bb26a73b850840823662dda371484926c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/54b4c428a0054e254223797d2713c31e08610831", - "reference": "54b4c428a0054e254223797d2713c31e08610831", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/af23c7bb26a73b850840823662dda371484926c4", + "reference": "af23c7bb26a73b850840823662dda371484926c4", "shasum": "" }, "require": { @@ -9845,7 +9943,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.12-dev" + "dev-master": "1.13-dev" } }, "autoload": { @@ -9881,20 +9979,20 @@ "portable", "shim" ], - "time": "2019-08-06T08:03:45+00:00" + "time": "2019-11-27T13:56:44+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.12.0", + "version": "v1.13.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "04ce3335667451138df4307d6a9b61565560199e" + "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/04ce3335667451138df4307d6a9b61565560199e", - "reference": "04ce3335667451138df4307d6a9b61565560199e", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/66fea50f6cb37a35eea048d75a7d99a45b586038", + "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038", "shasum": "" }, "require": { @@ -9903,7 +10001,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.12-dev" + "dev-master": "1.13-dev" } }, "autoload": { @@ -9936,88 +10034,30 @@ "portable", "shim" ], - "time": "2019-08-06T08:03:45+00:00" - }, - { - "name": "symfony/service-contracts", - "version": "v1.1.8", - "source": { - "type": "git", - "url": "https://github.com/symfony/service-contracts.git", - "reference": "ffc7f5692092df31515df2a5ecf3b7302b3ddacf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/ffc7f5692092df31515df2a5ecf3b7302b3ddacf", - "reference": "ffc7f5692092df31515df2a5ecf3b7302b3ddacf", - "shasum": "" - }, - "require": { - "php": "^7.1.3", - "psr/container": "^1.0" - }, - "suggest": { - "symfony/service-implementation": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Contracts\\Service\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Generic abstractions related to writing services", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "time": "2019-10-14T12:27:06+00:00" + "time": "2019-11-27T13:56:44+00:00" }, { "name": "symfony/stopwatch", - "version": "v4.3.8", + "version": "v4.4.2", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "e96c259de6abcd0cead71f0bf4d730d53ee464d0" + "reference": "5745b514fc56ae1907c6b8ed74f94f90f64694e9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/e96c259de6abcd0cead71f0bf4d730d53ee464d0", - "reference": "e96c259de6abcd0cead71f0bf4d730d53ee464d0", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/5745b514fc56ae1907c6b8ed74f94f90f64694e9", + "reference": "5745b514fc56ae1907c6b8ed74f94f90f64694e9", "shasum": "" }, "require": { "php": "^7.1.3", - "symfony/service-contracts": "^1.0" + "symfony/service-contracts": "^1.0|^2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -10044,20 +10084,20 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2019-11-05T14:48:09+00:00" + "time": "2019-11-05T16:11:08+00:00" }, { "name": "symfony/yaml", - "version": "v4.3.8", + "version": "v4.4.2", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "324cf4b19c345465fad14f3602050519e09e361d" + "reference": "a08832b974dd5fafe3085a66d41fe4c84bb2628c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/324cf4b19c345465fad14f3602050519e09e361d", - "reference": "324cf4b19c345465fad14f3602050519e09e361d", + "url": "https://api.github.com/repos/symfony/yaml/zipball/a08832b974dd5fafe3085a66d41fe4c84bb2628c", + "reference": "a08832b974dd5fafe3085a66d41fe4c84bb2628c", "shasum": "" }, "require": { @@ -10068,7 +10108,7 @@ "symfony/console": "<3.4" }, "require-dev": { - "symfony/console": "~3.4|~4.0" + "symfony/console": "^3.4|^4.0|^5.0" }, "suggest": { "symfony/console": "For validating YAML files using the lint command" @@ -10076,7 +10116,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -10103,7 +10143,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2019-10-30T12:58:49+00:00" + "time": "2019-12-10T10:33:21+00:00" }, { "name": "theseer/fdomdocument", @@ -10238,31 +10278,29 @@ }, { "name": "webmozart/assert", - "version": "1.5.0", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "88e6d84706d09a236046d686bbea96f07b3a34f4" + "reference": "573381c0a64f155a0d9a23f4b0c797194805b925" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/88e6d84706d09a236046d686bbea96f07b3a34f4", - "reference": "88e6d84706d09a236046d686bbea96f07b3a34f4", + "url": "https://api.github.com/repos/webmozart/assert/zipball/573381c0a64f155a0d9a23f4b0c797194805b925", + "reference": "573381c0a64f155a0d9a23f4b0c797194805b925", "shasum": "" }, "require": { "php": "^5.3.3 || ^7.0", "symfony/polyfill-ctype": "^1.8" }, + "conflict": { + "vimeo/psalm": "<3.6.0" + }, "require-dev": { "phpunit/phpunit": "^4.8.36 || ^7.5.13" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -10284,7 +10322,7 @@ "check", "validate" ], - "time": "2019-08-24T08:43:50+00:00" + "time": "2019-11-24T13:36:37+00:00" }, { "name": "weew/helpers-array", diff --git a/dev/tests/integration/testsuite/Magento/Csp/Model/Policy/Renderer/SimplePolicyHeaderRendererTest.php b/dev/tests/integration/testsuite/Magento/Csp/Model/Policy/Renderer/SimplePolicyHeaderRendererTest.php index a67665c6d3c48..93e7833038a42 100644 --- a/dev/tests/integration/testsuite/Magento/Csp/Model/Policy/Renderer/SimplePolicyHeaderRendererTest.php +++ b/dev/tests/integration/testsuite/Magento/Csp/Model/Policy/Renderer/SimplePolicyHeaderRendererTest.php @@ -53,7 +53,13 @@ public function testRenderRestrictMode(): void $this->assertNotEmpty($header = $this->response->getHeader('Content-Security-Policy')); $this->assertEmpty($this->response->getHeader('Content-Security-Policy-Report-Only')); - $this->assertEquals('default-src https://magento.com \'self\';', $header->getFieldValue()); + $contentSecurityPolicyContent = []; + if ($header instanceof \ArrayIterator) { + foreach ($header as $item) { + $contentSecurityPolicyContent[] = $item->getFieldValue(); + } + } + $this->assertEquals(['default-src https://magento.com \'self\';'], $contentSecurityPolicyContent); } /** @@ -73,9 +79,15 @@ public function testRenderRestrictWithReportingMode(): void $this->assertNotEmpty($header = $this->response->getHeader('Content-Security-Policy')); $this->assertEmpty($this->response->getHeader('Content-Security-Policy-Report-Only')); + $contentSecurityPolicyContent = []; + if ($header instanceof \ArrayIterator) { + foreach ($header as $item) { + $contentSecurityPolicyContent[] = $item->getFieldValue(); + } + } $this->assertEquals( - 'default-src https://magento.com \'self\'; report-uri /csp-reports/; report-to report-endpoint;', - $header->getFieldValue() + ['default-src https://magento.com \'self\'; report-uri /csp-reports/; report-to report-endpoint;'], + $contentSecurityPolicyContent ); $this->assertNotEmpty($reportToHeader = $this->response->getHeader('Report-To')); $this->assertNotEmpty($reportData = json_decode("[{$reportToHeader->getFieldValue()}]", true)); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Response/HeaderProvider/AbstractHeaderTestCase.php b/dev/tests/integration/testsuite/Magento/Framework/App/Response/HeaderProvider/AbstractHeaderTestCase.php index 8183a5878ba85..cb338d00cab16 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Response/HeaderProvider/AbstractHeaderTestCase.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Response/HeaderProvider/AbstractHeaderTestCase.php @@ -5,11 +5,22 @@ */ namespace Magento\Framework\App\Response\HeaderProvider; +use Magento\Framework\App\Response\Http as HttpResponse; +use Zend\Http\Header\HeaderInterface; + +/** + * Class AbstractHeaderTestCase + */ abstract class AbstractHeaderTestCase extends \Magento\TestFramework\TestCase\AbstractController { - /** @var \Magento\Framework\App\Response\Http */ + /** + * @var HttpResponse + */ private $interceptedResponse; + /** + * @inheritDoc + */ public function setUp() { parent::setUp(); @@ -17,12 +28,11 @@ public function setUp() [ 'preferences' => [ - \Magento\Framework\App\Response\Http::class => - \Magento\Framework\App\Response\Http\Interceptor::class + HttpResponse::class => 'Magento\Framework\App\Response\Http\Interceptor' ] ] ); - $this->interceptedResponse = $this->_objectManager->create(\Magento\Framework\App\Response\Http::class); + $this->interceptedResponse = $this->_objectManager->create(HttpResponse::class); } /** @@ -33,16 +43,30 @@ public function setUp() */ protected function assertHeaderPresent($name, $value) { + $value = [$value]; $this->interceptedResponse->sendResponse(); - $header = $this->interceptedResponse->getHeader($name); - $this->assertTrue(is_subclass_of($header, \Zend\Http\Header\HeaderInterface::class, false)); + + $headerContent = []; + if ($header instanceof \ArrayIterator) { + foreach ($header as $item) { + $headerContent[] = $item->getFieldValue(); + } + } elseif ($header instanceof HeaderInterface) { + $headerContent[] = $header->getFieldValue(); + } + $this->assertSame( $value, - $header->getFieldValue() + $headerContent ); } + /** + * Assert is no header. + * + * @param string $name + */ protected function assertHeaderNotPresent($name) { $this->interceptedResponse->sendResponse(); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Response/HeaderProvider/UpgradeInsecureTest.php b/dev/tests/integration/testsuite/Magento/Framework/App/Response/HeaderProvider/UpgradeInsecureTest.php index 18d58bea14b93..8b621c1d65974 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Response/HeaderProvider/UpgradeInsecureTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Response/HeaderProvider/UpgradeInsecureTest.php @@ -14,7 +14,7 @@ class UpgradeInsecureTest extends AbstractHeaderTestCase */ public function testHeaderPresent() { - $this->assertHeaderPresent('Content-Security-Policy', 'upgrade-insecure-requests'); + $this->assertHeaderPresent('Content-Security-Policy', 'upgrade-insecure-requests;'); } /** diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php index 438d9530ec5d5..e753fa42c0c36 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php @@ -45,6 +45,11 @@ class ComposerTest extends \PHPUnit\Framework\TestCase */ private static $moduleNameBlacklist; + /** + * @var string + */ + private static $magentoFrameworkLibaryName = 'magento/framework'; + public static function setUpBeforeClass() { self::$root = BP; @@ -68,6 +73,7 @@ public static function getBlacklist(string $pattern) { $blacklist = []; foreach (glob($pattern) as $list) { + //phpcs:ignore Magento2.Performance.ForeachArrayMerge $blacklist = array_merge($blacklist, file($list, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES)); } return $blacklist; @@ -311,9 +317,9 @@ private function assertDependsOnPhp(\StdClass $json) private function assertDependsOnFramework(\StdClass $json) { $this->assertObjectHasAttribute( - 'magento/framework', + self::$magentoFrameworkLibaryName, $json, - 'This component is expected to depend on magento/framework' + 'This component is expected to depend on ' . self::$magentoFrameworkLibaryName ); } @@ -496,4 +502,42 @@ private function checkProject() ); } } + + /** + * Check the correspondence between the root composer file and magento/framework composer file. + */ + public function testConsistencyOfDeclarationsInComposerFiles() + { + if (strpos(self::$rootJson['name'], 'magento/project-') !== false) { + // The Dependency test is skipped for vendor/magento build + self::markTestSkipped( + 'The build is running for composer installation. Consistency test for composer files is skipped.' + ); + } + + $componentRegistrar = new ComponentRegistrar(); + $magentoFrameworkLibaryDir = + $componentRegistrar->getPath(ComponentRegistrar::LIBRARY, self::$magentoFrameworkLibaryName); + $magentoFrameworkComposerFile = + json_decode( + file_get_contents($magentoFrameworkLibaryDir . DIRECTORY_SEPARATOR . 'composer.json'), + true + ); + + $inconsistentDependencies = []; + foreach ($magentoFrameworkComposerFile['require'] as $dependency => $constraint) { + if (isset(self::$rootJson['require'][$dependency]) + && self::$rootJson['require'][$dependency] !== $constraint + ) { + $inconsistentDependencies[] = $dependency; + } + } + + $this->assertEmpty( + $inconsistentDependencies, + 'There is a discrepancy between the declared versions of the following modules in "' + . self::$magentoFrameworkLibaryName . '" and the root composer.json: ' + . implode(', ', $inconsistentDependencies) + ); + } } diff --git a/lib/internal/Magento/Framework/composer.json b/lib/internal/Magento/Framework/composer.json index dfbfb5a25debe..36cb23943010e 100644 --- a/lib/internal/Magento/Framework/composer.json +++ b/lib/internal/Magento/Framework/composer.json @@ -27,8 +27,8 @@ "magento/zendframework1": "~1.14.2", "monolog/monolog": "^1.17", "wikimedia/less.php": "~1.8.0", - "symfony/console": "~4.1.0", - "symfony/process": "~4.1.0", + "symfony/console": "~4.4.0", + "symfony/process": "~4.4.0", "tedivm/jshrink": "~1.3.0", "zendframework/zend-code": "~3.3.0", "zendframework/zend-crypt": "^2.6.0", From 6a7b1795421176b90111c01b5100d02b36bd862c Mon Sep 17 00:00:00 2001 From: Lena Orobei <oorobei@magento.com> Date: Wed, 15 Jan 2020 16:35:08 -0600 Subject: [PATCH 0845/1143] magento/magento2#26331: Deliver commerce and B2B tests refactoring --- .../Test/AdminUnassignProductAttributeFromAttributeSetTest.xml | 2 +- .../Test/Mftf/Test/AdminCreateAndSwitchProductType.xml | 2 +- ...ProductWithThreeProductDontDisplayOutOfStockProductsTest.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUnassignProductAttributeFromAttributeSetTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUnassignProductAttributeFromAttributeSetTest.xml index 0aa033178ea38..44b4e60973907 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUnassignProductAttributeFromAttributeSetTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUnassignProductAttributeFromAttributeSetTest.xml @@ -35,7 +35,7 @@ <after> <deleteData createDataKey="product" stepKey="deleteProduct"/> <deleteData createDataKey="attribute" stepKey="deleteAttribute"/> - <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cron:run --group=index" stepKey="runCron"/> <actionGroup ref="logout" stepKey="logout"/> </after> <!-- Assert attribute presence in storefront product additional information --> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml index d7399cbd1ab20..fa515c89fa460 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml @@ -148,7 +148,7 @@ <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetSearch"/> <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/> <deleteData stepKey="deleteAttribute" createDataKey="createConfigProductAttribute"/> - <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cron:run --group=index" stepKey="runCron"/> <actionGroup ref="logout" stepKey="logout"/> </after> <!-- Create configurable product from downloadable product page--> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDontDisplayOutOfStockProductsTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDontDisplayOutOfStockProductsTest.xml index 206df79a1a6a8..1b7fc2c153208 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDontDisplayOutOfStockProductsTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDontDisplayOutOfStockProductsTest.xml @@ -72,7 +72,7 @@ <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cron:run --group=index" stepKey="runCron"/> <!-- Log out --> <actionGroup ref="logout" stepKey="logout"/> From 4192ff3af9039f50f6ac3d98f688dee743ffea2e Mon Sep 17 00:00:00 2001 From: Raul E Watson <raul.watson@maginus.com> Date: Thu, 16 Jan 2020 05:43:25 +0000 Subject: [PATCH 0846/1143] #895 Fix for Media Gallery buttons are shifted to the left --- .../view/adminhtml/web/css/source/_module.less | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 app/code/Magento/MediaGallery/view/adminhtml/web/css/source/_module.less diff --git a/app/code/Magento/MediaGallery/view/adminhtml/web/css/source/_module.less b/app/code/Magento/MediaGallery/view/adminhtml/web/css/source/_module.less new file mode 100644 index 0000000000000..4abcfb702a3dd --- /dev/null +++ b/app/code/Magento/MediaGallery/view/adminhtml/web/css/source/_module.less @@ -0,0 +1,13 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +.modal-slide { + .media-gallery-modal { + .page-main-actions { + .page-action-buttons{ + text-align: right; + } + } + } +} From 627ea42161550c38f246aa236a26dd292ac6a441 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky <firster@atwix.com> Date: Thu, 9 Jan 2020 16:58:23 +0200 Subject: [PATCH 0847/1143] =?UTF-8?q?magento/magento2#:=20Remove=20unused?= =?UTF-8?q?=20=E2=80=9CDefault=20Email=20Domain=E2=80=9D=20translation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/code/Magento/Customer/i18n/en_US.csv | 1 - app/code/Magento/Sales/Model/AdminOrder/Create.php | 8 -------- 2 files changed, 9 deletions(-) diff --git a/app/code/Magento/Customer/i18n/en_US.csv b/app/code/Magento/Customer/i18n/en_US.csv index a70aa08dba735..f1b82bd5a4395 100644 --- a/app/code/Magento/Customer/i18n/en_US.csv +++ b/app/code/Magento/Customer/i18n/en_US.csv @@ -432,7 +432,6 @@ Strong,Strong "Default Value for Disable Automatic Group Changes Based on VAT ID","Default Value for Disable Automatic Group Changes Based on VAT ID" "Show VAT Number on Storefront","Show VAT Number on Storefront" "To show VAT number on Storefront, set Show VAT Number on Storefront option to Yes.","To show VAT number on Storefront, set Show VAT Number on Storefront option to Yes." -"Default Email Domain","Default Email Domain" "Default Welcome Email","Default Welcome Email" "Email template chosen based on theme fallback when ""Default"" option is selected.","Email template chosen based on theme fallback when ""Default"" option is selected." "Default Welcome Email Without Password","Default Welcome Email Without Password" diff --git a/app/code/Magento/Sales/Model/AdminOrder/Create.php b/app/code/Magento/Sales/Model/AdminOrder/Create.php index 7396118aa9fc0..81f918e455069 100644 --- a/app/code/Magento/Sales/Model/AdminOrder/Create.php +++ b/app/code/Magento/Sales/Model/AdminOrder/Create.php @@ -28,14 +28,6 @@ */ class Create extends \Magento\Framework\DataObject implements \Magento\Checkout\Model\Cart\CartInterface { - /** - * Path to "CUSTOMERS > Customer Configuration > Create New Account Options > Default Email Domain" setting - * - * @deprecated since version 2.2.6 - * @see \Magento\Sales\Model\AdminOrder\Create. Constant usage has been removed from _getNewCustomerEmail() method. - */ - const XML_PATH_DEFAULT_EMAIL_DOMAIN = 'customer/create_account/email_domain'; - /** * Quote session object * From 73ed5cc4868803ed6a84cb66283566697c579acd Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Thu, 16 Jan 2020 09:53:00 +0200 Subject: [PATCH 0848/1143] MC-30141: [On Pre] [2.2.7] Status Change Doesn't Update the Stock Index --- .../Model/Import/Product.php | 78 ++++++++- .../Model/Import/Product/StatusProcessor.php | 153 ++++++++++++++++++ .../Model/Import/Product/StockProcessor.php | 57 +++++++ .../Test/Unit/Model/Import/ProductTest.php | 15 +- .../Magento/CatalogImportExport/etc/di.xml | 7 + .../Model/Import/ProductTest.php | 39 ++++- .../Model/Import/_files/disable_product.csv | 2 + .../Model/Import/_files/enable_product.csv | 2 + 8 files changed, 344 insertions(+), 9 deletions(-) create mode 100644 app/code/Magento/CatalogImportExport/Model/Import/Product/StatusProcessor.php create mode 100644 app/code/Magento/CatalogImportExport/Model/Import/Product/StockProcessor.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/disable_product.csv create mode 100644 dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/enable_product.csv diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php index 7ebc397cbe650..f7b15c9330fc5 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php @@ -13,6 +13,8 @@ use Magento\CatalogImportExport\Model\Import\Product\ImageTypeProcessor; use Magento\CatalogImportExport\Model\Import\Product\MediaGalleryProcessor; use Magento\CatalogImportExport\Model\Import\Product\RowValidatorInterface as ValidatorInterface; +use Magento\CatalogImportExport\Model\Import\Product\StatusProcessor; +use Magento\CatalogImportExport\Model\Import\Product\StockProcessor; use Magento\CatalogImportExport\Model\StockItemImporterInterface; use Magento\CatalogInventory\Api\Data\StockItemInterface; use Magento\Framework\App\Filesystem\DirectoryList; @@ -746,6 +748,15 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity */ private $productRepository; + /** + * @var StatusProcessor + */ + private $statusProcessor; + /** + * @var StockProcessor + */ + private $stockProcessor; + /** * @param \Magento\Framework\Json\Helper\Data $jsonHelper * @param \Magento\ImportExport\Helper\Data $importExportData @@ -791,6 +802,8 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity * @param StockItemImporterInterface|null $stockItemImporter * @param DateTimeFactory $dateTimeFactory * @param ProductRepositoryInterface|null $productRepository + * @param StatusProcessor|null $statusProcessor + * @param StockProcessor|null $stockProcessor * @throws LocalizedException * @throws \Magento\Framework\Exception\FileSystemException * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -840,7 +853,9 @@ public function __construct( MediaGalleryProcessor $mediaProcessor = null, StockItemImporterInterface $stockItemImporter = null, DateTimeFactory $dateTimeFactory = null, - ProductRepositoryInterface $productRepository = null + ProductRepositoryInterface $productRepository = null, + StatusProcessor $statusProcessor = null, + StockProcessor $stockProcessor = null ) { $this->_eventManager = $eventManager; $this->stockRegistry = $stockRegistry; @@ -876,6 +891,10 @@ public function __construct( $this->mediaProcessor = $mediaProcessor ?: ObjectManager::getInstance()->get(MediaGalleryProcessor::class); $this->stockItemImporter = $stockItemImporter ?: ObjectManager::getInstance() ->get(StockItemImporterInterface::class); + $this->statusProcessor = $statusProcessor ?: ObjectManager::getInstance() + ->get(StatusProcessor::class); + $this->stockProcessor = $stockProcessor ?: ObjectManager::getInstance() + ->get(StockProcessor::class); parent::__construct( $jsonHelper, $importExportData, @@ -1290,12 +1309,18 @@ protected function _saveLinks() protected function _saveProductAttributes(array $attributesData) { $linkField = $this->getProductEntityLinkField(); + $statusAttributeId = (int) $this->retrieveAttributeByCode('status')->getId(); foreach ($attributesData as $tableName => $skuData) { + $linkIdBySkuForStatusChanged = []; $tableData = []; foreach ($skuData as $sku => $attributes) { $linkId = $this->_oldSku[strtolower($sku)][$linkField]; foreach ($attributes as $attributeId => $storeValues) { foreach ($storeValues as $storeId => $storeValue) { + if ($attributeId === $statusAttributeId) { + $this->statusProcessor->setStatus($sku, $storeId, $storeValue); + $linkIdBySkuForStatusChanged[strtolower($sku)] = $linkId; + } $tableData[] = [ $linkField => $linkId, 'attribute_id' => $attributeId, @@ -1305,6 +1330,9 @@ protected function _saveProductAttributes(array $attributesData) } } } + if ($linkIdBySkuForStatusChanged) { + $this->statusProcessor->loadOldStatus($linkIdBySkuForStatusChanged); + } $this->_connection->insertOnDuplicate($tableName, $tableData, ['value']); } @@ -2188,6 +2216,7 @@ protected function _saveStockItem() while ($bunch = $this->_dataSourceModel->getNextBunch()) { $stockData = []; $productIdsToReindex = []; + $stockChangedProductIds = []; // Format bunch to stock data rows foreach ($bunch as $rowNum => $rowData) { if (!$this->isRowAllowedToImport($rowData, $rowNum)) { @@ -2197,8 +2226,16 @@ protected function _saveStockItem() $row = []; $sku = $rowData[self::COL_SKU]; if ($this->skuProcessor->getNewSku($sku) !== null) { + $stockItem = $this->getRowExistingStockItem($rowData); + $existingStockItemData = $stockItem->getData(); $row = $this->formatStockDataForRow($rowData); $productIdsToReindex[] = $row['product_id']; + $storeId = $this->getRowStoreId($rowData); + if (!empty(array_diff_assoc($row, $existingStockItemData)) + || $this->statusProcessor->isStatusChanged($sku, $storeId) + ) { + $stockChangedProductIds[] = $row['product_id']; + } } if (!isset($stockData[$sku])) { @@ -2211,11 +2248,24 @@ protected function _saveStockItem() $this->stockItemImporter->import($stockData); } + $this->reindexStockStatus($stockChangedProductIds); $this->reindexProducts($productIdsToReindex); } return $this; } + /** + * Reindex stock status for provided product IDs + * + * @param array $productIds + */ + private function reindexStockStatus(array $productIds): void + { + if ($productIds) { + $this->stockProcessor->reindexList($productIds); + } + } + /** * Initiate product reindex by product ids * @@ -3259,4 +3309,30 @@ private function composeLinkKey(int $productId, int $linkedId, int $linkTypeId) { return "{$productId}-{$linkedId}-{$linkTypeId}"; } + + /** + * Get row store ID + * + * @param array $rowData + * @return int + */ + private function getRowStoreId(array $rowData): int + { + return !empty($rowData[self::COL_STORE]) + ? (int) $this->getStoreIdByCode($rowData[self::COL_STORE]) + : Store::DEFAULT_STORE_ID; + } + + /** + * Get row stock item model + * + * @param array $rowData + * @return StockItemInterface + */ + private function getRowExistingStockItem(array $rowData): StockItemInterface + { + $productId = $this->skuProcessor->getNewSku($rowData[self::COL_SKU])['entity_id']; + $websiteId = $this->stockConfiguration->getDefaultScopeId(); + return $this->stockRegistry->getStockItem($productId, $websiteId); + } } diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product/StatusProcessor.php b/app/code/Magento/CatalogImportExport/Model/Import/Product/StatusProcessor.php new file mode 100644 index 0000000000000..1c6d679848216 --- /dev/null +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product/StatusProcessor.php @@ -0,0 +1,153 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\CatalogImportExport\Model\Import\Product; + +use Magento\Catalog\Api\Data\ProductInterface; +use Magento\CatalogImportExport\Model\Import\Proxy\Product\ResourceModelFactory; +use Magento\Eav\Model\Entity\Attribute\AbstractAttribute; +use Magento\Framework\App\ResourceConnection; +use Magento\Framework\EntityManager\MetadataPool; + +/** + * Imported product status state manager + */ +class StatusProcessor +{ + private const ATTRIBUTE_CODE = 'status'; + /** + * @var array + */ + private $oldData; + /** + * @var array + */ + private $newData; + /** + * @var ResourceModelFactory + */ + private $resourceFactory; + /** + * @var ResourceConnection + */ + private $resourceConnection; + /** + * @var MetadataPool + */ + private $metadataPool; + /** + * @var string + */ + private $productEntityLinkField; + /** + * @var AbstractAttribute + */ + private $attribute; + + /** + * Initializes dependencies. + * + * @param MetadataPool $metadataPool + * @param ResourceModelFactory $resourceFactory + * @param ResourceConnection $resourceConnection + */ + public function __construct( + MetadataPool $metadataPool, + ResourceModelFactory $resourceFactory, + ResourceConnection $resourceConnection + ) { + $this->oldData = []; + $this->newData = []; + $this->resourceFactory = $resourceFactory; + $this->resourceConnection = $resourceConnection; + $this->metadataPool = $metadataPool; + } + + /** + * Check if status has changed for given (sku, storeId) + * + * @param string $sku + * @param int $storeId + * @return bool + */ + public function isStatusChanged(string $sku, int $storeId): bool + { + $sku = strtolower($sku); + if (!isset($this->newData[$sku][$storeId])) { + $changed = false; + } elseif (!isset($this->oldData[$sku][$storeId])) { + $changed = true; + } else { + $oldStatus = (int) $this->oldData[$sku][$storeId]; + $newStatus = (int) $this->newData[$sku][$storeId]; + $changed = $oldStatus !== $newStatus; + } + return $changed; + } + + /** + * Load old status data + * + * @param array $linkIdBySku + */ + public function loadOldStatus(array $linkIdBySku): void + { + $connection = $this->resourceConnection->getConnection(); + $linkId = $this->getProductEntityLinkField(); + $select = $connection->select() + ->from($this->getAttribute()->getBackend()->getTable()) + ->columns([$linkId, 'store_id', 'value']) + ->where(sprintf('%s IN (?)', $linkId), array_values($linkIdBySku)); + $skuByLinkId = array_flip($linkIdBySku); + + foreach ($connection->fetchAll($select) as $item) { + if (isset($skuByLinkId[$item[$linkId]])) { + $this->oldData[$skuByLinkId[$item[$linkId]]][$item['store_id']] = $item['value']; + } + } + } + + /** + * Set SKU status for given storeId + * + * @param string $sku + * @param string $storeId + * @param int $value + */ + public function setStatus(string $sku, string $storeId, int $value): void + { + $sku = strtolower($sku); + $this->newData[$sku][$storeId] = $value; + } + + /** + * Get product entity link field. + * + * @return string + */ + private function getProductEntityLinkField() + { + if (!$this->productEntityLinkField) { + $this->productEntityLinkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField(); + } + + return $this->productEntityLinkField; + } + + /** + * Get Attribute model + * + * @return AbstractAttribute + */ + private function getAttribute(): AbstractAttribute + { + if ($this->attribute === null) { + $this->attribute = $this->resourceFactory->create()->getAttribute(self::ATTRIBUTE_CODE); + } + return $this->attribute; + } +} diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product/StockProcessor.php b/app/code/Magento/CatalogImportExport/Model/Import/Product/StockProcessor.php new file mode 100644 index 0000000000000..76508d1ebec89 --- /dev/null +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product/StockProcessor.php @@ -0,0 +1,57 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\CatalogImportExport\Model\Import\Product; + +use Magento\Framework\Indexer\IndexerRegistry; + +/** + * Imported product stock manager + */ +class StockProcessor +{ + /** + * @var IndexerRegistry + */ + private $indexerRegistry; + /** + * @var array + */ + private $indexers; + + /** + * Initializes dependencies. + * + * @param IndexerRegistry $indexerRegistry + * @param array $indexers + */ + public function __construct( + IndexerRegistry $indexerRegistry, + array $indexers = [] + ) { + $this->indexerRegistry = $indexerRegistry; + $this->indexers = array_filter($indexers); + } + + /** + * Reindex products by ids + * + * @param array $ids + * @return void + */ + public function reindexList(array $ids = []): void + { + if ($ids) { + foreach ($this->indexers as $indexerName) { + $indexer = $this->indexerRegistry->get($indexerName); + if (!$indexer->isScheduled()) { + $indexer->reindexList($ids); + } + } + } + } +} diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php index 40041fe90db96..ff724ddc746aa 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php @@ -13,8 +13,8 @@ use PHPUnit\Framework\MockObject\MockObject; /** - * Class ProductTest - * @package Magento\CatalogImportExport\Test\Unit\Model\Import + * Test import entity product model + * * @SuppressWarnings(PHPMD.TooManyFields) * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -547,6 +547,17 @@ public function testSaveProductAttributes() $this->_connection->expects($this->once()) ->method('insertOnDuplicate') ->with($testTable, $tableData, ['value']); + $attribute = $this->getMockBuilder(\Magento\Eav\Model\Entity\Attribute\AbstractAttribute::class) + ->disableOriginalConstructor() + ->setMethods(['getId']) + ->getMockForAbstractClass(); + $attribute->expects($this->once())->method('getId')->willReturn(1); + $resource = $this->getMockBuilder(\Magento\CatalogImportExport\Model\Import\Proxy\Product\ResourceModel::class) + ->disableOriginalConstructor() + ->setMethods(['getAttribute']) + ->getMock(); + $resource->expects($this->once())->method('getAttribute')->willReturn($attribute); + $this->_resourceFactory->expects($this->once())->method('create')->willReturn($resource); $this->setPropertyValue($this->importProduct, '_oldSku', [$testSku => ['entity_id' => self::ENTITY_ID]]); $object = $this->invokeMethod($this->importProduct, '_saveProductAttributes', [$attributesData]); $this->assertEquals($this->importProduct, $object); diff --git a/app/code/Magento/CatalogImportExport/etc/di.xml b/app/code/Magento/CatalogImportExport/etc/di.xml index 4e2fe390e0b17..3d629dd106b9e 100644 --- a/app/code/Magento/CatalogImportExport/etc/di.xml +++ b/app/code/Magento/CatalogImportExport/etc/di.xml @@ -16,6 +16,13 @@ <plugin name="invalidateProductCategoryIndexerOnImport" type="Magento\CatalogImportExport\Model\Indexer\Product\Category\Plugin\Import" /> <plugin name="invalidateCategoryProductIndexerOnImport" type="Magento\CatalogImportExport\Model\Indexer\Category\Product\Plugin\Import" /> </type> + <type name="Magento\CatalogImportExport\Model\Import\Product\StockProcessor"> + <arguments> + <argument name="indexers" xsi:type="array"> + <item name="cataloginventory_stock" xsi:type="const">Magento\CatalogInventory\Model\Indexer\Stock\Processor::INDEXER_ID</item> + </argument> + </arguments> + </type> <type name="Magento\CatalogImportExport\Model\Import\Product\Validator"> <arguments> <argument name="validators" xsi:type="array"> diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php index 4e2b73de301a3..fdbda7e817d56 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php @@ -19,6 +19,9 @@ use Magento\Catalog\Model\Product; use Magento\Catalog\Model\ResourceModel\Product as ProductResource; use Magento\CatalogImportExport\Model\Import\Product\RowValidatorInterface; +use Magento\CatalogInventory\Model\Stock; +use Magento\CatalogInventory\Model\StockRegistry; +use Magento\CatalogInventory\Model\StockRegistryStorage; use Magento\Framework\App\Bootstrap; use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\App\ObjectManager; @@ -230,9 +233,9 @@ public function testSaveStockItemQty() $existingProductIds = [$id1, $id2, $id3]; $stockItems = []; foreach ($existingProductIds as $productId) { - /** @var $stockRegistry \Magento\CatalogInventory\Model\StockRegistry */ + /** @var $stockRegistry StockRegistry */ $stockRegistry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - \Magento\CatalogInventory\Model\StockRegistry::class + StockRegistry::class ); $stockItem = $stockRegistry->getStockItem($productId, 1); @@ -261,9 +264,9 @@ public function testSaveStockItemQty() /** @var $stockItmBeforeImport \Magento\CatalogInventory\Model\Stock\Item */ foreach ($stockItems as $productId => $stockItmBeforeImport) { - /** @var $stockRegistry \Magento\CatalogInventory\Model\StockRegistry */ + /** @var $stockRegistry StockRegistry */ $stockRegistry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - \Magento\CatalogInventory\Model\StockRegistry::class + StockRegistry::class ); $stockItemAfterImport = $stockRegistry->getStockItem($productId, 1); @@ -2031,9 +2034,9 @@ public function testProductWithUseConfigSettings() $this->_model->importData(); foreach ($products as $sku => $manageStockUseConfig) { - /** @var \Magento\CatalogInventory\Model\StockRegistry $stockRegistry */ + /** @var StockRegistry $stockRegistry */ $stockRegistry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - \Magento\CatalogInventory\Model\StockRegistry::class + StockRegistry::class ); $stockItem = $stockRegistry->getStockItemBySku($sku); $this->assertEquals($manageStockUseConfig, $stockItem->getUseConfigManageStock()); @@ -2941,4 +2944,28 @@ public function testImportConfigurableProductImages() } $this->assertEquals($expected, $actual); } + + /** + * Test that product stock status is updated after import + * + * @magentoDataFixture mediaImportImageFixture + * @magentoDataFixture Magento/Catalog/_files/product_simple.php + */ + public function testProductStockStatusShouldBeUpdated() + { + /** @var $stockRegistry StockRegistry */ + $stockRegistry = $this->objectManager->create(StockRegistry::class); + /** @var StockRegistryStorage $stockRegistryStorage */ + $stockRegistryStorage = $this->objectManager->get(StockRegistryStorage::class); + $status = $stockRegistry->getStockStatusBySku('simple'); + $this->assertEquals(Stock::STOCK_IN_STOCK, $status->getStockStatus()); + $this->importDataForMediaTest('disable_product.csv'); + $stockRegistryStorage->clean(); + $status = $stockRegistry->getStockStatusBySku('simple'); + $this->assertEquals(Stock::STOCK_OUT_OF_STOCK, $status->getStockStatus()); + $this->importDataForMediaTest('enable_product.csv'); + $stockRegistryStorage->clean(); + $status = $stockRegistry->getStockStatusBySku('simple'); + $this->assertEquals(Stock::STOCK_IN_STOCK, $status->getStockStatus()); + } } diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/disable_product.csv b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/disable_product.csv new file mode 100644 index 0000000000000..b366fb63afd92 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/disable_product.csv @@ -0,0 +1,2 @@ +"sku", "product_online" +"simple", "0" diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/enable_product.csv b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/enable_product.csv new file mode 100644 index 0000000000000..eb36621bc61e1 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/enable_product.csv @@ -0,0 +1,2 @@ +"sku", "product_online" +"simple", "1" From b6a0f86313ceb261638c6d648e8624e0971f36a3 Mon Sep 17 00:00:00 2001 From: DianaRusin <rusind95@gmail.com> Date: Thu, 16 Jan 2020 11:13:20 +0200 Subject: [PATCH 0849/1143] MC-30111: [2.4] Test StorefrontCustomerCheckoutTest fails on Jenkins --- .../Test/StorefrontCustomerCheckoutTest.xml | 117 ++++++++---------- 1 file changed, 53 insertions(+), 64 deletions(-) diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml index 861f379988031..8bdbabb584b83 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml @@ -10,88 +10,77 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="StorefrontCustomerCheckoutTest"> <annotations> - <features value="Checkout"/> - <stories value="Checkout via the Admin"/> - <title value="Customer Checkout via the Admin"/> + <features value="Customer Checkout"/> + <stories value="Checkout via Storefront"/> + <title value="Customer Checkout via Storefront"/> <description value="Should be able to place an order as a customer."/> <severity value="CRITICAL"/> - <testCaseId value="MC-5922"/> + <testCaseId value="MC-30274"/> <group value="checkout"/> - <skip> - <issueId value="MC-30111"/> - </skip> </annotations> <before> - <createData entity="SimpleSubCategory" stepKey="simplecategory"/> - <createData entity="SimpleProduct" stepKey="simpleproduct1"> - <requiredEntity createDataKey="simplecategory"/> + <createData entity="SimpleSubCategory" stepKey="createCategory"/> + <createData entity="SimpleProduct" stepKey="createSimpleProduct"> + <requiredEntity createDataKey="createCategory"/> </createData> - <createData entity="Simple_US_Customer" stepKey="simpleuscustomer"/> + <createData entity="Simple_US_Customer" stepKey="createCustomer"/> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> </before> <after> - <!--Clear filters--> - <amOnPage url="{{AdminCustomerPage.url}}" stepKey="navigateToCustomers"/> - <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingCustomerFilters"/> - - <actionGroup ref="logout" stepKey="logout"/> - <deleteData createDataKey="simpleproduct1" stepKey="deleteProduct1"/> - <deleteData createDataKey="simplecategory" stepKey="deleteCategory"/> + <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> + <deleteData createDataKey="createCategory" stepKey="deleteSimpleCategory"/> + <deleteData createDataKey="createCustomer" stepKey="deleteUsCustomer"/> + <actionGroup ref="AdminClearCustomersFiltersActionGroup" stepKey="resetCustomerFilters"/> + <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomer"/> </after> - <actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerLogin"> - <argument name="Customer" value="$$simpleuscustomer$$" /> + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="storefrontCustomerLogin"> + <argument name="Customer" value="$$createCustomer$$"/> + </actionGroup> + + <actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="navigateToCategoryPage"> + <argument name="category" value="$$createCategory$$"/> </actionGroup> - <amOnPage url="{{StorefrontCategoryPage.url($$simplecategory.name$$)}}" stepKey="onCategoryPage"/> <waitForPageLoad stepKey="waitForCatalogPageLoad"/> - <moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="hoverProduct"/> - <click selector="{{StorefrontCategoryMainSection.AddToCartBtn}}" stepKey="addToCart"/> - <waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="waitForProductAdded"/> - <see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="You added $$simpleproduct1.name$$ to your shopping cart." stepKey="seeAddedToCartMessage"/> - <see selector="{{StorefrontMinicartSection.quantity}}" userInput="1" stepKey="seeCartQuantity"/> - <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart" /> - <click stepKey="s35" selector="{{CheckoutShippingMethodsSection.firstShippingMethod}}"/> - <waitForElement stepKey="s36" selector="{{CheckoutShippingMethodsSection.next}}" time="30"/> - <click stepKey="s37" selector="{{CheckoutShippingMethodsSection.next}}" /> - <!-- Checkout select Check/Money Order payment --> - <actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/> - <waitForPageLoad stepKey="s39"/> - <waitForElement stepKey="s41" selector="{{CheckoutPaymentSection.placeOrder}}" time="30" /> - <see stepKey="s47" selector="{{CheckoutPaymentSection.billingAddress}}" userInput="{{US_Address_TX.street[0]}}" /> - <click stepKey="s49" selector="{{CheckoutPaymentSection.placeOrder}}" /> - <waitForPageLoad stepKey="s51"/> - <grabTextFrom stepKey="s53" selector="{{CheckoutSuccessMainSection.orderNumber22}}"/> - <see stepKey="s55" selector="{{CheckoutSuccessMainSection.success}}" userInput="Your order number is:" /> + <actionGroup ref="StorefrontAddCategoryProductToCartActionGroup" stepKey="addProductToCart"> + <argument name="product" value="$$createSimpleProduct$$"/> + <argument name="productCount" value="CONST.one"/> + </actionGroup> + + <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/> + <actionGroup ref="CheckoutSelectFlatRateShippingMethodActionGroup" stepKey="selectFlatRate"/> + <actionGroup ref="StorefrontCheckoutForwardFromShippingStepActionGroup" stepKey="goToReview"/> + <actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyOrder"/> + <actionGroup ref="CheckoutPlaceOrderActionGroup" stepKey="clickOnPlaceOrder"> + <argument name="orderNumberMessage" value="CONST.successCheckoutOrderNumberMessage"/> + <argument name="emailYouMessage" value="CONST.successCheckoutEmailYouMessage"/> + </actionGroup> - <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/> + <grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="orderNumber"/> - <amOnPage stepKey="s67" url="{{AdminOrdersPage.url}}"/> - <waitForPageLoad stepKey="s75"/> - <actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearFiltersIfPresent"/> - <fillField stepKey="s77" selector="{{AdminOrdersGridSection.search}}" userInput="{$s53}" /> - <waitForPageLoad stepKey="s78"/> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - <click stepKey="s81" selector="{{AdminOrdersGridSection.submitSearch22}}" /> - <waitForPageLoad stepKey="s831"/> - <click stepKey="s84" selector="{{AdminOrdersGridSection.firstRow}}" /> - <waitForPageLoad stepKey="waitForOrderToLoad"/> - <see stepKey="s85" selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="Pending" /> - <see stepKey="s87" selector="{{AdminOrderDetailsInformationSection.accountInformation}}" userInput="Customer" /> - <see stepKey="s89" selector="{{AdminOrderDetailsInformationSection.accountInformation}}" userInput="$$simpleuscustomer.email$$" /> - <see stepKey="s91" selector="{{AdminOrderDetailsInformationSection.billingAddress}}" userInput="{{US_Address_TX.street[0]}}" /> - <see stepKey="s93" selector="{{AdminOrderDetailsInformationSection.shippingAddress}}" userInput="{{US_Address_TX.street[0]}}" /> - <see stepKey="s95" selector="{{AdminOrderDetailsInformationSection.itemsOrdered}}" userInput="$$simpleproduct1.name$$" /> + <actionGroup ref="OpenOrderByIdActionGroup" stepKey="addFilterToGridAndOpenOrder"> + <argument name="orderId" value="{$orderNumber}"/> + </actionGroup> + + <see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="Pending" stepKey="verifyOrderStatus"/> + <see selector="{{AdminOrderDetailsInformationSection.accountInformation}}" userInput="Customer" stepKey="verifyAccountInformation"/> + <see selector="{{AdminOrderDetailsInformationSection.accountInformation}}" userInput="$$createCustomer.email$$" stepKey="verifyCustomerEmail"/> + <see selector="{{AdminOrderDetailsInformationSection.billingAddress}}" userInput="{{US_Address_TX.street[0]}}" stepKey="verifyBillingAddress"/> + <see selector="{{AdminOrderDetailsInformationSection.shippingAddress}}" userInput="{{US_Address_TX.street[0]}}" stepKey="verifyShippingAddress"/> + <see selector="{{AdminOrderDetailsInformationSection.itemsOrdered}}" userInput="$$createSimpleProduct.name$$" stepKey="verifyProductName"/> + + <actionGroup ref="OpenEditCustomerFromAdminActionGroup" stepKey="openCustomerEditPage"> + <argument name="customer" value="$$createCustomer$$"/> + </actionGroup> - <amOnPage stepKey="s96" url="{{AdminCustomerPage.url}}"/> - <waitForPageLoad stepKey="s97"/> - <waitForElementVisible selector="{{AdminCustomerFiltersSection.filtersButton}}" time="30" stepKey="waitFiltersButton"/> - <click stepKey="s98" selector="{{AdminCustomerFiltersSection.filtersButton}}"/> - <fillField stepKey="s99" selector="{{AdminCustomerFiltersSection.emailInput}}" userInput="$$simpleuscustomer.email$$"/> - <click stepKey="s100" selector="{{AdminCustomerFiltersSection.apply}}"/> - <click stepKey="s101" selector="{{AdminCustomerGridSection.firstRowEditLink}}"/> - <click stepKey="s102" selector="{{AdminEditCustomerInformationSection.orders}}"/> - <see stepKey="s103" selector="{{AdminEditCustomerOrdersSection.orderGrid}}" userInput="$$simpleuscustomer.firstname$$ $$simpleuscustomer.lastname$$" /> + <click selector="{{AdminEditCustomerInformationSection.orders}}" stepKey="navigateToOrdersTab"/> + <waitForElementVisible selector="{{AdminEditCustomerOrdersSection.orderGrid}}" stepKey="waitForOrdersGridVisible"/> + <see selector="{{AdminEditCustomerOrdersSection.orderGrid}}" userInput="$$createCustomer.firstname$$ $$createCustomer.lastname$$" stepKey="verifyOrder"/> </test> <test name="StorefrontCustomerCheckoutTestWithMultipleAddressesAndTaxRates"> <annotations> From 8ce08227b0cc10f16c3d59a25c432a615cb1864b Mon Sep 17 00:00:00 2001 From: Vaha <vaha@atwix.com> Date: Thu, 16 Jan 2020 15:06:54 +0200 Subject: [PATCH 0850/1143] #8691: improved language pack inheritance order --- .../Framework/App/Language/Dictionary.php | 71 +++++++++++++++---- 1 file changed, 59 insertions(+), 12 deletions(-) diff --git a/lib/internal/Magento/Framework/App/Language/Dictionary.php b/lib/internal/Magento/Framework/App/Language/Dictionary.php index d9a5ccb00d892..9aaafc23c9e49 100644 --- a/lib/internal/Magento/Framework/App/Language/Dictionary.php +++ b/lib/internal/Magento/Framework/App/Language/Dictionary.php @@ -103,7 +103,9 @@ public function getDictionary($languageCode) foreach ($languages as $languageConfig) { $this->collectInheritedPacks($languageConfig, $packs); } - uasort($packs, [$this, 'sortInherited']); + + // Get sorted packs + $packs = $this->getSortedPacks($packs); // Merge all packages of translation to one dictionary $result = []; @@ -118,6 +120,37 @@ public function getDictionary($languageCode) return $result; } + /** + * Get sorted packs + * + * First level packs (inheritance_level eq 0) sort by 'sort order' (ascending) + * Inherited packs has the same order as declared in parent config (language.xml) + * + * @param array $allPacks + * + * @return array + */ + private function getSortedPacks($allPacks) + { + // Get first level (inheritance_level) packs and sort by provided sort order (descending) + $firstLevelPacks = array_filter( + $allPacks, + function ($pack) { + return $pack['inheritance_level'] === 0; + } + ); + uasort($firstLevelPacks, [$this, 'sortPacks']); + + // Add inherited packs + $sortedPacks = []; + foreach ($firstLevelPacks as $pack) { + $this->addInheritedPacks($allPacks, $pack, $sortedPacks); + } + + // Reverse array: the first element has the lowest priority, the last one - the highest + return array_reverse($sortedPacks, true); + } + /** * Line up (flatten) a tree of inheritance of language packs * @@ -152,28 +185,42 @@ private function collectInheritedPacks($languageConfig, &$result, $level = 0, ar } /** - * Sub-routine for custom sorting packs using inheritance level and sort order + * Add inherited packs to sorted packs * - * First sort by inheritance level descending, then by sort order ascending + * @param array $packs + * @param array $pack + * @param array $sortedPacks + * + * @return void + */ + private function addInheritedPacks($packs, $pack, &$sortedPacks) + { + $sortedPacks[$pack['key']] = $pack; + foreach ($pack['language']->getUses() as $reuse) { + $packKey = implode('|', [$reuse['vendor'], $reuse['package']]); + if (isset($packs[$packKey])) { + $this->addInheritedPacks($packs, $packs[$packKey], $sortedPacks); + } + } + } + + /** + * Sub-routine for custom sorting packs using sort order (descending) * * @param array $current * @param array $next + * * @return int * @SuppressWarnings(PHPMD.UnusedPrivateMethod) */ - private function sortInherited($current, $next) + private function sortPacks($current, $next) { - if ($current['inheritance_level'] > $next['inheritance_level']) { - return -1; - } elseif ($current['inheritance_level'] < $next['inheritance_level']) { - return 1; - } if ($current['sort_order'] > $next['sort_order']) { - return 1; - } elseif ($current['sort_order'] < $next['sort_order']) { return -1; + } elseif ($current['sort_order'] < $next['sort_order']) { + return 1; } - return strcmp($current['key'], $next['key']); + return strcmp($next['key'], $current['key']); } /** From b2177742d18ae320b07562b70b3358305c29fcf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Eduardo=20C=C3=A1nepa=20Cihuelo?= <10290593+manuelcanepa@users.noreply.github.com> Date: Thu, 16 Jan 2020 10:14:20 -0300 Subject: [PATCH 0851/1143] Update app/code/Magento/Developer/Model/XmlCatalog/Format/VsCode.php Co-Authored-By: Ihor Sviziev <ihor-sviziev@users.noreply.github.com> --- app/code/Magento/Developer/Model/XmlCatalog/Format/VsCode.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Developer/Model/XmlCatalog/Format/VsCode.php b/app/code/Magento/Developer/Model/XmlCatalog/Format/VsCode.php index 568774a112e9a..20dad6c0300f3 100644 --- a/app/code/Magento/Developer/Model/XmlCatalog/Format/VsCode.php +++ b/app/code/Magento/Developer/Model/XmlCatalog/Format/VsCode.php @@ -123,7 +123,7 @@ private function initEmptyFile(\DOMDocument $dom): \DOMElement * See COPYING.txt for license details. */ '); - $dom->appendChild($copyrigthComment); + $dom->appendChild($copyrightComment); $catalogNode = $dom->createElement('catalog'); $catalogNode->setAttribute('xmlns', self::XMLNS); From 4d70d26317de495f228604a26c63f3827ece3836 Mon Sep 17 00:00:00 2001 From: Manuel Canepa <manuelcanepa@gmail.com> Date: Thu, 16 Jan 2020 10:17:44 -0300 Subject: [PATCH 0852/1143] Fix typo --- app/code/Magento/Developer/Model/XmlCatalog/Format/VsCode.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Developer/Model/XmlCatalog/Format/VsCode.php b/app/code/Magento/Developer/Model/XmlCatalog/Format/VsCode.php index 20dad6c0300f3..f45aebf6fad68 100644 --- a/app/code/Magento/Developer/Model/XmlCatalog/Format/VsCode.php +++ b/app/code/Magento/Developer/Model/XmlCatalog/Format/VsCode.php @@ -117,7 +117,7 @@ public function generateCatalog(array $dictionary, $configFile): void */ private function initEmptyFile(\DOMDocument $dom): \DOMElement { - $copyrigthComment = $dom->createComment(' + $copyrightComment = $dom->createComment(' /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. From 08714a33498ac39cadfd95b7a1d00675410c8e8e Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Thu, 16 Jan 2020 15:23:52 +0200 Subject: [PATCH 0853/1143] MC-24170: Fix Skipped MFTF Tests From MC-17140: MC-13493, MC-14062, MC-14063 --- .../ChangeSeoUrlKeyActionGroup.xml | 2 +- ...angeSeoUrlKeyForSubCategoryActionGroup.xml | 2 +- ...geSelectDropDownOptionValueActionGroup.xml | 22 ++ ...electRadioButtonOptionValueActionGroup.xml | 22 ++ .../Mftf/Section/AdminCategorySEOSection.xml | 3 +- .../StorefrontProductInfoMainSection.xml | 1 + ...eInStockVisibleInCategoryAndSearchTest.xml | 3 + ...inCatalogPriceRuleDeleteAllActionGroup.xml | 41 +++ ...CatalogPriceRuleFillActionsActionGroup.xml | 27 ++ ...atalogPriceRuleFillMainInfoActionGroup.xml | 34 +++ ...atalogPriceRuleSaveAndApplyActionGroup.xml | 21 ++ ...iceRuleSelectCustomerGroupsActionGroup.xml | 20 ++ .../AdminSaveAndApplyRulesActionGroup.xml | 4 +- .../CatalogSelectCustomerGroupActionGroup.xml | 2 +- ...itionWithAttributeAndOptionActionGroup.xml | 4 +- .../AdminNewCatalogPriceRuleSection.xml | 10 +- ...ProductWithAssignedSimpleProducts2Test.xml | 289 ++++++++++++++++++ ...eProductWithAssignedSimpleProductsTest.xml | 6 +- ...ForConfigurableProductWithOptions2Test.xml | 220 +++++++++++++ ...eForConfigurableProductWithOptionsTest.xml | 6 +- ...refrontSelectOptionDropDownActionGroup.xml | 4 +- ...rontSelectOptionRadioButtonActionGroup.xml | 2 +- ...lKeyForStoreViewAndMovingCategory2Test.xml | 87 ++++++ ...rlKeyForStoreViewAndMovingCategoryTest.xml | 7 +- 24 files changed, 818 insertions(+), 21 deletions(-) create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontProductPageSelectDropDownOptionValueActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontProductPageSelectRadioButtonOptionValueActionGroup.xml create mode 100644 app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminCatalogPriceRuleDeleteAllActionGroup.xml create mode 100644 app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminCatalogPriceRuleFillActionsActionGroup.xml create mode 100644 app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminCatalogPriceRuleFillMainInfoActionGroup.xml create mode 100644 app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminCatalogPriceRuleSaveAndApplyActionGroup.xml create mode 100644 app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminCatalogPriceRuleSelectCustomerGroupsActionGroup.xml create mode 100644 app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProducts2Test.xml create mode 100644 app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptions2Test.xml create mode 100644 app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategory2Test.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ChangeSeoUrlKeyActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ChangeSeoUrlKeyActionGroup.xml index 7107cc2a560d1..cf2e809fefa5e 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ChangeSeoUrlKeyActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ChangeSeoUrlKeyActionGroup.xml @@ -16,7 +16,7 @@ <argument name="value" type="string"/> </arguments> - <click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="openSeoSection"/> + <conditionalClick selector="{{AdminCategorySEOSection.SectionHeader}}" dependentSelector="{{AdminCategorySEOSection.sectionBody}}" visible="false" stepKey="openSeoSection"/> <fillField selector="{{AdminCategorySEOSection.UrlKeyInput}}" userInput="{{value}}" stepKey="enterURLKey"/> <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/> <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="assertSuccessMessage"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ChangeSeoUrlKeyForSubCategoryActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ChangeSeoUrlKeyForSubCategoryActionGroup.xml index 42813aef05be5..a65bb297971c7 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ChangeSeoUrlKeyForSubCategoryActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ChangeSeoUrlKeyForSubCategoryActionGroup.xml @@ -16,7 +16,7 @@ <argument name="value" type="string"/> </arguments> - <click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="openSeoSection"/> + <conditionalClick selector="{{AdminCategorySEOSection.SectionHeader}}" dependentSelector="{{AdminCategorySEOSection.sectionBody}}" visible="false" stepKey="openSeoSection"/> <uncheckOption selector="{{AdminCategorySEOSection.UrlKeyDefaultValueCheckbox}}" stepKey="uncheckDefaultValue"/> <fillField selector="{{AdminCategorySEOSection.UrlKeyInput}}" userInput="{{value}}" stepKey="enterURLKey"/> <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontProductPageSelectDropDownOptionValueActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontProductPageSelectDropDownOptionValueActionGroup.xml new file mode 100644 index 0000000000000..31b18e1f0d37e --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontProductPageSelectDropDownOptionValueActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontProductPageSelectDropDownOptionValueActionGroup"> + <annotations> + <description>Selects the provided Product Option Value under the provided DropDown Product Option Title on a Storefront Product page.</description> + </annotations> + <arguments> + <argument name="attributeLabel" type="string" defaultValue="{{ProductAttributeFrontendLabel.label}}"/> + <argument name="optionLabel" type="string" defaultValue="{{productAttributeOption1.label}}"/> + </arguments> + + <selectOption selector="{{StorefrontProductInfoMainSection.productOptionSelect(attributeLabel)}}" userInput="{{optionLabel}}" stepKey="fillDropDownAttributeOption"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontProductPageSelectRadioButtonOptionValueActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontProductPageSelectRadioButtonOptionValueActionGroup.xml new file mode 100644 index 0000000000000..5f2a130956cbe --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontProductPageSelectRadioButtonOptionValueActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontProductPageSelectRadioButtonOptionValueActionGroup"> + <annotations> + <description>Selects the provided Product Option Value under the provided Radio Button Product Option Title on a Storefront Product page.</description> + </annotations> + <arguments> + <argument name="attributeLabel" type="string" defaultValue="{{ProductAttributeFrontendLabel.label}}"/> + <argument name="optionLabel" type="string" defaultValue="{{productAttributeOption1.label}}"/> + </arguments> + + <checkOption selector="{{StorefrontProductInfoMainSection.productAttributeOptionsRadioButtonByName(attributeLabel, optionLabel)}}" stepKey="fillRadioButtonAttributeOption"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategorySEOSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategorySEOSection.xml index b5d5d61f6468b..bde7a94662d04 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategorySEOSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategorySEOSection.xml @@ -9,7 +9,8 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminCategorySEOSection"> - <element name="SectionHeader" type="button" selector="div[data-index='search_engine_optimization']" timeout="30"/> + <element name="SectionHeader" type="button" selector="div[data-index='search_engine_optimization'] .fieldset-wrapper-title" timeout="30"/> + <element name="sectionBody" type="text" selector="div[data-index='search_engine_optimization'] .admin__fieldset-wrapper-content"/> <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']"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductInfoMainSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductInfoMainSection.xml index 631649e33b0fd..a5a02ad95b1f7 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductInfoMainSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductInfoMainSection.xml @@ -62,6 +62,7 @@ <element name="productAttributeOptionsPrice" type="text" selector="//label[contains(.,'{{var1}}')]//span[@data-price-amount='{{var2}}']" parameterized="true"/> <element name="productAttributeOptionsDropDown" type="text" selector="//label[contains(.,'{{var1}}')]/../div[@class='control']//select//option[@price='{{var2}}']" parameterized="true"/> <element name="productAttributeOptionsRadioButtons" type="text" selector="//label[contains(.,'{{var1}}')]/../div[@class='control']//span[@data-price-amount='{{var2}}']" parameterized="true"/> + <element name="productAttributeOptionsRadioButtonByName" type="checkbox" selector="//*[@id='product-options-wrapper']//div[contains(@class,'fieldset')]//label[contains(.,'{{attributeName}}')]/../div[contains(@class,'control')]//label[contains(@class,'label') and contains(.,'{{optionName}}')]/preceding-sibling::input[@type='radio']" parameterized="true"/> <element name="productAttributeOptionsCheckbox" type="text" selector="//label[contains(.,'{{var1}}')]/../div[@class='control']//span[@data-price-amount='{{var2}}']" parameterized="true"/> <element name="productAttributeOptionsMultiselect" type="text" selector="//label[contains(.,'{{var1}}')]/../div[@class='control']//select//option[@price='{{var2}}']" parameterized="true"/> <element name="productAttributeOptionsData" type="text" selector="//span[contains(.,'{{var1}}')]/../span[@class='price-notice']//span[@data-price-amount='{{var2}}']" parameterized="true"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryAndSearchTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryAndSearchTest.xml index 10347584b4cda..04110dbd73a4c 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryAndSearchTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryAndSearchTest.xml @@ -17,6 +17,9 @@ <severity value="CRITICAL"/> <group value="catalog"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-30166"/> + </skip> </annotations> <before> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminCatalogPriceRuleDeleteAllActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminCatalogPriceRuleDeleteAllActionGroup.xml new file mode 100644 index 0000000000000..5860137c1ab8d --- /dev/null +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminCatalogPriceRuleDeleteAllActionGroup.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCatalogPriceRuleDeleteAllActionGroup"> + <annotations> + <description>Open Catalog Price Rule grid and delete all rules one by one. Need to avoid interference with other tests that test catalog price rules.</description> + </annotations> + <amOnPage url="{{AdminCatalogPriceRuleGridPage.url}}" stepKey="goToAdminCatalogPriceRuleGridPage"/> + <!-- It sometimes is loading too long for default 10s --> + <waitForPageLoad time="60" stepKey="waitForPageFullyLoaded"/> + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingFilters"/> + <executeInSelenium + function=" + function ($webdriver) use ($I) { + $rows = $webdriver->findElements(\Facebook\WebDriver\WebDriverBy::cssSelector('table.data-grid tbody tr[data-role=row]:not(.data-grid-tr-no-data):nth-of-type(1)')); + while(!empty($rows)) { + $rows[0]->click(); + $I->waitForPageLoad(30); + $I->click('#delete'); + $I->waitForPageLoad(30); + $I->waitForElementVisible('aside.confirm .modal-footer button.action-accept', 10); + $I->waitForPageLoad(60); + $I->click('aside.confirm .modal-footer button.action-accept'); + $I->waitForPageLoad(60); + $I->waitForLoadingMaskToDisappear(); + $I->waitForElementVisible('#messages div.message-success', 10); + $I->see('You deleted the rule.', '#messages div.message-success'); + $rows = $webdriver->findElements(\Facebook\WebDriver\WebDriverBy::cssSelector('table.data-grid tbody tr[data-role=row]:not(.data-grid-tr-no-data):nth-of-type(1)')); + } + }" + stepKey="deleteAllCatalogPriceRulesOneByOne"/> + <waitForElementVisible selector="{{AdminDataGridTableSection.dataGridEmpty}}" stepKey="waitDataGridEmptyMessageAppears"/> + <see selector="{{AdminDataGridTableSection.dataGridEmpty}}" userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminCatalogPriceRuleFillActionsActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminCatalogPriceRuleFillActionsActionGroup.xml new file mode 100644 index 0000000000000..da8571769ef31 --- /dev/null +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminCatalogPriceRuleFillActionsActionGroup.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCatalogPriceRuleFillActionsActionGroup"> + <annotations> + <description>Fill Catalog Price Rule actions fields: Apply, Discount Amount, Discard subsequent rules.</description> + </annotations> + <arguments> + <argument name="apply" type="string" defaultValue="{{_defaultCatalogRule.simple_action}}"/> + <argument name="discountAmount" type="string" defaultValue="{{_defaultCatalogRule.discount_amount}}"/> + <argument name="discardSubsequentRules" type="string" defaultValue="Yes"/> + </arguments> + + <conditionalClick selector="{{AdminNewCatalogPriceRule.actionsTabTitle}}" dependentSelector="{{AdminNewCatalogPriceRule.actionsTabBody}}" visible="false" stepKey="openActionSectionIfNeeded"/> + <scrollTo selector="{{AdminNewCatalogPriceRule.actionsTabTitle}}" stepKey="scrollToActionsFieldset"/> + <waitForElementVisible selector="{{AdminNewCatalogPriceRuleActions.apply}}" stepKey="waitActionsFieldsetFullyOpened"/> + <selectOption selector="{{AdminNewCatalogPriceRuleActions.apply}}" userInput="{{apply}}" stepKey="fillDiscountType"/> + <fillField selector="{{AdminNewCatalogPriceRuleActions.discountAmount}}" userInput="{{discountAmount}}" stepKey="fillDiscountAmount"/> + <selectOption selector="{{AdminNewCatalogPriceRuleActions.disregardRules}}" userInput="{{discardSubsequentRules}}" stepKey="fillDiscardSubsequentRules"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminCatalogPriceRuleFillMainInfoActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminCatalogPriceRuleFillMainInfoActionGroup.xml new file mode 100644 index 0000000000000..e609550d19461 --- /dev/null +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminCatalogPriceRuleFillMainInfoActionGroup.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCatalogPriceRuleFillMainInfoActionGroup"> + <annotations> + <description>Fill Catalog Price Rule main info fields: Name, Description, Active (1/0), Priority.</description> + </annotations> + <arguments> + <argument name="name" type="string" defaultValue="{{_defaultCatalogRule.name}}"/> + <argument name="description" type="string" defaultValue="{{_defaultCatalogRule.description}}"/> + <argument name="active" type="string" defaultValue="1"/> + <argument name="websites" type="string" defaultValue="'Main Website'"/> + <argument name="groups" type="string" defaultValue="'NOT LOGGED IN','General','Wholesale','Retailer'"/> + <argument name="fromDate" type="string" defaultValue=""/> + <argument name="toDate" type="string" defaultValue=""/> + <argument name="priority" type="string" defaultValue=""/> + </arguments> + + <fillField selector="{{AdminNewCatalogPriceRule.ruleName}}" userInput="{{name}}" stepKey="fillName"/> + <fillField selector="{{AdminNewCatalogPriceRule.description}}" userInput="{{description}}" stepKey="fillDescription"/> + <conditionalClick selector="{{AdminNewCatalogPriceRule.isActive}}" dependentSelector="{{AdminNewCatalogPriceRule.activeByStatus(active)}}" visible="false" stepKey="fillActive"/> + <selectOption selector="{{AdminNewCatalogPriceRule.websites}}" parameterArray="[{{websites}}]" stepKey="selectSpecifiedWebsites"/> + <selectOption selector="{{AdminNewCatalogPriceRule.customerGroups}}" parameterArray="[{{groups}}]" stepKey="selectSpecifiedCustomerGroups"/> + <fillField selector="{{AdminNewCatalogPriceRule.fromDate}}" userInput="{{fromDate}}" stepKey="fillFromDate"/> + <fillField selector="{{AdminNewCatalogPriceRule.toDate}}" userInput="{{toDate}}" stepKey="fillToDate"/> + <fillField selector="{{AdminNewCatalogPriceRule.priority}}" userInput="{{priority}}" stepKey="fillPriority"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminCatalogPriceRuleSaveAndApplyActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminCatalogPriceRuleSaveAndApplyActionGroup.xml new file mode 100644 index 0000000000000..84cc7b862ef7c --- /dev/null +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminCatalogPriceRuleSaveAndApplyActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCatalogPriceRuleSaveAndApplyActionGroup"> + <annotations> + <description>Clicks Save and Apply on a Admin Catalog Price Rule creation/edit page. Validates that the Success Message is present. Validates that applied rules success message is present.</description> + </annotations> + + <scrollToTopOfPage stepKey="scrollToTop"/> + <click selector="{{AdminNewCatalogPriceRule.saveAndApply}}" stepKey="saveAndApplyRule"/> + <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForSuccessMessageAppears"/> + <see selector="{{AdminMessagesSection.success}}" userInput="You saved the rule." stepKey="checkSuccessSaveMessage"/> + <see selector="{{AdminMessagesSection.success}}" userInput="Updated rules applied." stepKey="checkSuccessAppliedMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminCatalogPriceRuleSelectCustomerGroupsActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminCatalogPriceRuleSelectCustomerGroupsActionGroup.xml new file mode 100644 index 0000000000000..8c37325aff722 --- /dev/null +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminCatalogPriceRuleSelectCustomerGroupsActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCatalogPriceRuleSelectCustomerGroupsActionGroup"> + <annotations> + <description>Fill Catalog Price Rule customer groups multiselect on new/edit page.</description> + </annotations> + <arguments> + <argument name="groups" type="string" defaultValue="'NOT LOGGED IN','General','Wholesale','Retailer'"/> + </arguments> + + <selectOption selector="{{AdminNewCatalogPriceRule.customerGroups}}" parameterArray="[{{groups}}]" stepKey="selectSpecifiedCustomerGroups"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminSaveAndApplyRulesActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminSaveAndApplyRulesActionGroup.xml index 82e7a6979e34b..9ad27d22caba6 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminSaveAndApplyRulesActionGroup.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminSaveAndApplyRulesActionGroup.xml @@ -10,9 +10,9 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="AdminSaveAndApplyRulesActionGroup"> <annotations> - <description>Clicks Save on a Admin Catalog Price Rule creation/edit page. Validates that the Success Message is present. Clicks Apply Rules. Validates that the Success Message is present.</description> + <description>DEPRECATED. Please use AdminCatalogPriceRuleSaveAndApplyActionGroup instead. Clicks Save on a Admin Catalog Price Rule creation/edit page. Validates that the Success Message is present. Clicks Apply Rules. Validates that the Success Message is present.</description> </annotations> - + <waitForPageLoad stepKey="waitForPageToLoad"/> <scrollToTopOfPage stepKey="scrollToTop"/> <click selector="{{AdminNewCatalogPriceRule.save}}" stepKey="saveTheCatalogRule"/> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogSelectCustomerGroupActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogSelectCustomerGroupActionGroup.xml index cd2f7a207a3e2..b6fc92e1a1df6 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogSelectCustomerGroupActionGroup.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogSelectCustomerGroupActionGroup.xml @@ -10,7 +10,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="CatalogSelectCustomerGroupActionGroup"> <annotations> - <description>Selects the provided Customer Group Name on the Admin Catalog Price Rule creation/edit page.</description> + <description>DEPRECATED. Please use AdminCatalogPriceRuleSelectCustomerGroupsActionGroup instead. Selects the provided Customer Group Name on the Admin Catalog Price Rule creation/edit page.</description> </annotations> <arguments> <argument name="customerGroupName" defaultValue="NOT LOGGED IN" type="string"/> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CreateCatalogPriceRuleConditionWithAttributeAndOptionActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CreateCatalogPriceRuleConditionWithAttributeAndOptionActionGroup.xml index bdc09c56353df..732aee0ad63d7 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CreateCatalogPriceRuleConditionWithAttributeAndOptionActionGroup.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CreateCatalogPriceRuleConditionWithAttributeAndOptionActionGroup.xml @@ -18,8 +18,8 @@ <argument name="indexA" type="string"/> <argument name="indexB" type="string"/> </arguments> - - <click selector="{{AdminNewCatalogPriceRule.conditionsTab}}" stepKey="openConditionsTab"/> + + <conditionalClick selector="{{AdminNewCatalogPriceRule.conditionsTabTitle}}" dependentSelector="{{AdminNewCatalogPriceRule.conditionsTabBody}}" visible="false" stepKey="openConditionsTab"/> <waitForPageLoad stepKey="waitForConditionTabOpened"/> <click selector="{{AdminNewCatalogPriceRuleConditions.newCondition}}" stepKey="addNewCondition"/> <selectOption selector="{{AdminNewCatalogPriceRuleConditions.conditionSelect(indexA)}}" userInput="{{attributeName}}" stepKey="selectTypeCondition"/> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Section/AdminNewCatalogPriceRuleSection.xml b/app/code/Magento/CatalogRule/Test/Mftf/Section/AdminNewCatalogPriceRuleSection.xml index 7d375da6dfb65..be0fdb2e0b419 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Section/AdminNewCatalogPriceRuleSection.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Section/AdminNewCatalogPriceRuleSection.xml @@ -20,7 +20,8 @@ <element name="ruleNameNew" type="input" selector="[name='staging[name]']"/> <element name="description" type="textarea" selector="[name='description']"/> <element name="status" type="select" selector="[name='is_active']"/> - <element name="isActive" type="select" selector="input[name='is_active']+label"/> + <element name="isActive" type="text" selector="input[name='is_active']+label"/> + <element name="activeByStatus" type="text" selector="div.admin__actions-switch input[name='is_active'][value='{{value}}']+label" parameterized="true"/> <element name="websites" type="select" selector="[name='website_ids']"/> <element name="active" type="checkbox" selector="//div[contains(@class, 'admin__actions-switch')]/input[@name='is_active']/../label"/> @@ -34,10 +35,15 @@ <element name="startDateButton" type="button" selector="[name='staging[start_time]'] + button" timeout="15"/> <element name="toDateButton" type="button" selector="[name='to_date'] + button" timeout="15"/> <element name="todayDate" type="button" selector="#ui-datepicker-div [data-handler='today']"/> + <element name="fromDate" type="input" selector="[name='from_date']"/> + <element name="toDate" type="input" selector="[name='to_date']"/> <element name="priority" type="input" selector="[name='sort_order']"/> <element name="conditionsTab" type="block" selector="[data-index='block_promo_catalog_edit_tab_conditions']"/> + <element name="conditionsTabTitle" type="block" selector="[data-index='block_promo_catalog_edit_tab_conditions'] .fieldset-wrapper-title"/> + <element name="conditionsTabBody" type="block" selector="[data-index='block_promo_catalog_edit_tab_conditions'] .admin__fieldset-wrapper-content"/> <element name="actionsTab" type="block" selector="[data-index='actions']"/> - + <element name="actionsTabTitle" type="block" selector="[data-index='actions'] .fieldset-wrapper-title"/> + <element name="actionsTabBody" type="block" selector="[data-index='actions'] .admin__fieldset-wrapper-content"/> <element name="fieldError" type="text" selector="//input[@name='{{fieldName}}']/following-sibling::label[@class='admin__field-error']" parameterized="true"/> </section> diff --git a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProducts2Test.xml b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProducts2Test.xml new file mode 100644 index 0000000000000..0b6edc42c87ff --- /dev/null +++ b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProducts2Test.xml @@ -0,0 +1,289 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProducts2Test"> + <annotations> + <features value="CatalogRuleConfigurable"/> + <stories value="Apply catalog price rule"/> + <title value="Apply catalog rule for configurable product with assigned simple products"/> + <description value="Admin should be able to apply catalog rule for configurable product with assigned simple products"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-27708"/> + <group value="catalog"/> + <group value="configurable_product"/> + <group value="catalog_rule_configurable"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <!-- Create category for first configurable product --> + <createData entity="SimpleSubCategory" stepKey="firstSimpleCategory"/> + + <!-- Create first configurable product with two options --> + <createData entity="ApiConfigurableProduct" stepKey="createFirstConfigProduct"> + <requiredEntity createDataKey="firstSimpleCategory"/> + </createData> + + <createData entity="productAttributeWithTwoOptions" stepKey="createFirstConfigProductAttribute"/> + <createData entity="productAttributeOption1" stepKey="createFirstConfigProductAttributeFirstOption"> + <requiredEntity createDataKey="createFirstConfigProductAttribute"/> + </createData> + <createData entity="productAttributeOption2" stepKey="createFirstConfigProductAttributeSecondOption"> + <requiredEntity createDataKey="createFirstConfigProductAttribute"/> + </createData> + + <createData entity="AddToDefaultSet" stepKey="addFirstProductToAttributeSet"> + <requiredEntity createDataKey="createFirstConfigProductAttribute"/> + </createData> + + <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getFirstConfigAttributeFirstOption"> + <requiredEntity createDataKey="createFirstConfigProductAttribute"/> + </getData> + <getData entity="ProductAttributeOptionGetter" index="2" stepKey="getFirstConfigAttributeSecondOption"> + <requiredEntity createDataKey="createFirstConfigProductAttribute"/> + </getData> + + <!-- Create two child products for first configurable product --> + <createData entity="ApiSimpleOne" stepKey="createFirstConfigFirstChildProduct"> + <requiredEntity createDataKey="createFirstConfigProductAttribute"/> + <requiredEntity createDataKey="getFirstConfigAttributeFirstOption"/> + </createData> + + <createData entity="ApiSimpleOne" stepKey="createFirstConfigSecondChildProduct"> + <requiredEntity createDataKey="createFirstConfigProductAttribute"/> + <requiredEntity createDataKey="getFirstConfigAttributeSecondOption"/> + </createData> + + <createData entity="ConfigurableProductTwoOptions" stepKey="createFirstConfigProductOption"> + <requiredEntity createDataKey="createFirstConfigProduct"/> + <requiredEntity createDataKey="createFirstConfigProductAttribute"/> + <requiredEntity createDataKey="getFirstConfigAttributeFirstOption"/> + <requiredEntity createDataKey="getFirstConfigAttributeSecondOption"/> + </createData> + + <createData entity="ConfigurableProductAddChild" stepKey="createFirstConfigProductAddFirstChild"> + <requiredEntity createDataKey="createFirstConfigProduct"/> + <requiredEntity createDataKey="createFirstConfigFirstChildProduct"/> + </createData> + <createData entity="ConfigurableProductAddChild" stepKey="createFirstConfigProductAddSecondChild"> + <requiredEntity createDataKey="createFirstConfigProduct"/> + <requiredEntity createDataKey="createFirstConfigSecondChildProduct"/> + </createData> + + <!-- Add customizable options to first product --> + <updateData createDataKey="createFirstConfigProduct" entity="productWithOptionRadiobutton" stepKey="updateFirstProductWithOption"/> + + <!-- Create category for second configurable product --> + <createData entity="SimpleSubCategory" stepKey="secondSimpleCategory"/> + + <!-- Create second configurable product with two options --> + <createData entity="ApiConfigurableProduct" stepKey="createSecondConfigProduct"> + <requiredEntity createDataKey="secondSimpleCategory"/> + </createData> + + <createData entity="productAttributeWithTwoOptions" stepKey="createSecondConfigProductAttribute"/> + <createData entity="productAttributeOption1" stepKey="createSecondConfigProductAttributeFirstOption"> + <requiredEntity createDataKey="createSecondConfigProductAttribute"/> + </createData> + <createData entity="productAttributeOption2" stepKey="createSecondConfigProductAttributeSecondOption"> + <requiredEntity createDataKey="createSecondConfigProductAttribute"/> + </createData> + + <createData entity="AddToDefaultSet" stepKey="addSecondProductToAttributeSet"> + <requiredEntity createDataKey="createSecondConfigProductAttribute"/> + </createData> + + <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getSecondConfigAttributeFirstOption"> + <requiredEntity createDataKey="createSecondConfigProductAttribute"/> + </getData> + <getData entity="ProductAttributeOptionGetter" index="2" stepKey="getSecondConfigAttributeSecondOption"> + <requiredEntity createDataKey="createSecondConfigProductAttribute"/> + </getData> + + <!-- Create two child products for second configurable product --> + <createData entity="ApiSimpleOne" stepKey="createSecondConfigFirstChildProduct"> + <requiredEntity createDataKey="createSecondConfigProductAttribute"/> + <requiredEntity createDataKey="getSecondConfigAttributeFirstOption"/> + </createData> + + <createData entity="ApiSimpleOne" stepKey="createSecondConfigSecondChildProduct"> + <requiredEntity createDataKey="createSecondConfigProductAttribute"/> + <requiredEntity createDataKey="getSecondConfigAttributeSecondOption"/> + </createData> + + <createData entity="ConfigurableProductTwoOptions" stepKey="createSecondConfigProductOption"> + <requiredEntity createDataKey="createSecondConfigProduct"/> + <requiredEntity createDataKey="createSecondConfigProductAttribute"/> + <requiredEntity createDataKey="getSecondConfigAttributeFirstOption"/> + <requiredEntity createDataKey="getSecondConfigAttributeSecondOption"/> + </createData> + + <createData entity="ConfigurableProductAddChild" stepKey="createSecondConfigProductAddFirstChild"> + <requiredEntity createDataKey="createSecondConfigProduct"/> + <requiredEntity createDataKey="createSecondConfigFirstChildProduct"/> + </createData> + <createData entity="ConfigurableProductAddChild" stepKey="createSecondConfigProductAddSecondChild"> + <requiredEntity createDataKey="createSecondConfigProduct"/> + <requiredEntity createDataKey="createSecondConfigSecondChildProduct"/> + </createData> + + <!-- Add customizable options to second product --> + <updateData createDataKey="createSecondConfigProduct" entity="productWithOptionRadiobutton" stepKey="updateSecondProductWithOption"/> + + <!--Create customer group --> + <createData entity="CustomCustomerGroup" stepKey="customerGroup"/> + + <!-- Create Customer --> + <createData entity="SimpleUsCustomerWithNewCustomerGroup" stepKey="createCustomer"> + <requiredEntity createDataKey="customerGroup" /> + </createData> + + <!-- Login as Admin --> + <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> + <actionGroup ref="AdminCatalogPriceRuleDeleteAllActionGroup" stepKey="deleteAllCatalogPriceRule"/> + </before> + <after> + <!-- Delete created data --> + <deleteData createDataKey="createFirstConfigProduct" stepKey="deleteFirstConfigProduct"/> + <deleteData createDataKey="createFirstConfigFirstChildProduct" stepKey="deleteFirstConfigFirstChildProduct"/> + <deleteData createDataKey="createFirstConfigSecondChildProduct" stepKey="deleteFirstConfigSecondChildProduct"/> + <deleteData createDataKey="createFirstConfigProductAttribute" stepKey="deleteFirstConfigProductAttribute"/> + <deleteData createDataKey="firstSimpleCategory" stepKey="deleteFirstSimpleCategory"/> + + <deleteData createDataKey="createSecondConfigProduct" stepKey="deleteSecondConfigProduct"/> + <deleteData createDataKey="createSecondConfigFirstChildProduct" stepKey="deleteSecondConfigFirstChildProduct"/> + <deleteData createDataKey="createSecondConfigSecondChildProduct" stepKey="deleteSecondConfigSecondChildProduct"/> + <deleteData createDataKey="createSecondConfigProductAttribute" stepKey="deleteSecondConfigProductAttribute"/> + <deleteData createDataKey="secondSimpleCategory" stepKey="deleteSimpleCategory"/> + + <!-- Customer log out --> + <!-- Must logout before delete customer otherwise magento fails during logout --> + <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutFromStorefront"/> + + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> + <deleteData createDataKey="customerGroup" stepKey="deleteCustomerGroup"/> + + <!-- Delete created price rules --> + <actionGroup ref="AdminCatalogPriceRuleDeleteAllActionGroup" stepKey="deleteAllCatalogPriceRule"/> + <!-- Admin log out --> + <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + </after> + + <!-- Create catalog price rule --> + <executeJS function="return '$$customerGroup.code$$'" stepKey="customerGroupName"/> + <actionGroup ref="AdminOpenNewCatalogPriceRuleFormPageActionGroup" stepKey="startCreatingCatalogPriceRule"/> + <actionGroup ref="AdminCatalogPriceRuleFillMainInfoActionGroup" stepKey="fillMainInfoForCatalogPriceRule"> + <argument name="groups" value=""{$customerGroupName}""/> + </actionGroup> + <actionGroup ref="AdminCatalogPriceRuleFillActionsActionGroup" stepKey="fillActionsForCatalogPriceRule"> + <argument name="apply" value="{{CatalogRuleToFixed.simple_action}}"/> + <argument name="discountAmount" value="{{CatalogRuleToFixed.discount_amount}}"/> + </actionGroup> + <actionGroup ref="AdminCatalogPriceRuleSaveAndApplyActionGroup" stepKey="saveAndApplyCatalogPriceRule"/> + + <actionGroup ref="AdminReindexAndFlushCache" stepKey="reindexAndFlushCache"/> + + <!-- Login to storefront from customer --> + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginCustomerOnStorefron"> + <argument name="Customer" value="$$createCustomer$$"/> + </actionGroup> + + <!-- Assert first product in category --> + <amOnPage url="{{StorefrontCategoryPage.url($$firstSimpleCategory.custom_attributes[url_key]$$)}}" stepKey="goToFirstCategoryPageStorefront"/> + <waitForPageLoad stepKey="waitForFirstCategoryPageLoad"/> + <actionGroup ref="StorefrontCheckCategoryConfigurableProductWithUpdatedPriceActionGroup" stepKey="checkFirstProductPriceInCategory"> + <argument name="productName" value="$$createFirstConfigProduct.name$$"/> + <argument name="expectedPrice" value="{{CatalogRuleToFixed.discount_amount}}"/> + </actionGroup> + + <!-- Assert second product in category --> + <amOnPage url="{{StorefrontCategoryPage.url($$secondSimpleCategory.custom_attributes[url_key]$$)}}" stepKey="goToSecondCategoryPageStorefront"/> + <waitForPageLoad stepKey="waitForSecondCategoryPageLoad"/> + <actionGroup ref="StorefrontCheckCategoryConfigurableProductWithUpdatedPriceActionGroup" stepKey="checkSecondProductPriceInCategory"> + <argument name="productName" value="$$createSecondConfigProduct.name$$"/> + <argument name="expectedPrice" value="{{CatalogRuleToFixed.discount_amount}}"/> + </actionGroup> + + <!-- Assert first product in storefront product page --> + <amOnPage url="{{StorefrontProductPage.url($$createFirstConfigProduct.custom_attributes[url_key]$$)}}" stepKey="amOnFirstProductPage"/> + <waitForPageLoad stepKey="waitForFirstProductPageLoad"/> + <actionGroup ref="StorefrontAssertUpdatedProductPriceInStorefrontProductPageActionGroup" stepKey="checkFirstProductPriceInStorefrontProductPage"> + <argument name="productName" value="$$createFirstConfigProduct.name$$"/> + <argument name="expectedPrice" value="{{CatalogRuleToFixed.discount_amount}}"/> + </actionGroup> + + <!-- Add first product with selected options to the cart --> + <actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="firstConfigProductSelectFirstOptionValue"> + <argument name="attributeLabel" value="$$createFirstConfigProductAttribute.default_frontend_label$$"/> + <argument name="optionLabel" value="$$createFirstConfigProductAttributeFirstOption.option[store_labels][1][label]$$"/> + </actionGroup> + <actionGroup ref="StorefrontProductPageSelectRadioButtonOptionValueActionGroup" stepKey="firstConfigProductSelectSecondOptionValue"> + <argument name="attributeLabel" value="{{ProductOptionRadiobuttonWithTwoFixedOptions.title}}"/> + <argument name="optionLabel" value="{{ProductOptionValueRadioButtons1.title}}"/> + </actionGroup> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addFirstConfigProductToCart"> + <argument name="productName" value="$$createFirstConfigProduct.name$$"/> + </actionGroup> + + <!-- Add first product with another selected options to the cart --> + <actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="firstConfigProductSelectFirstOptionAnotherValue"> + <argument name="attributeLabel" value="$$createFirstConfigProductAttribute.default_frontend_label$$"/> + <argument name="optionLabel" value="$$createFirstConfigProductAttributeSecondOption.option[store_labels][1][label]$$"/> + </actionGroup> + <actionGroup ref="StorefrontProductPageSelectRadioButtonOptionValueActionGroup" stepKey="firstConfigProductSelectSecondOptionAnotherValue"> + <argument name="attributeLabel" value="{{ProductOptionRadiobuttonWithTwoFixedOptions.title}}"/> + <argument name="optionLabel" value="{{ProductOptionValueRadioButtons3.title}}"/> + </actionGroup> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addFirstConfigProductWithOtherOptionsToCart"> + <argument name="productName" value="$$createFirstConfigProduct.name$$"/> + </actionGroup> + + <!-- Assert second product in storefront product page --> + <amOnPage url="{{StorefrontProductPage.url($$createSecondConfigProduct.custom_attributes[url_key]$$)}}" stepKey="amOnSecondProductPage"/> + <waitForPageLoad stepKey="waitForSecondProductPageLoad"/> + <actionGroup ref="StorefrontAssertUpdatedProductPriceInStorefrontProductPageActionGroup" stepKey="checkSecondProductPriceInStorefrontProductPage"> + <argument name="productName" value="$$createSecondConfigProduct.name$$"/> + <argument name="expectedPrice" value="{{CatalogRuleToFixed.discount_amount}}"/> + </actionGroup> + + <!-- Add second product with selected options to the cart --> + <actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="secondConfigProductSelectFirstOptionValue"> + <argument name="attributeLabel" value="$$createSecondConfigProductAttribute.default_frontend_label$$"/> + <argument name="optionLabel" value="$$createSecondConfigProductAttributeFirstOption.option[store_labels][1][label]$$"/> + </actionGroup> + <actionGroup ref="StorefrontProductPageSelectRadioButtonOptionValueActionGroup" stepKey="secondConfigProductSelectSecondOptionValue"> + <argument name="attributeLabel" value="{{ProductOptionRadiobuttonWithTwoFixedOptions.title}}"/> + <argument name="optionLabel" value="{{ProductOptionValueRadioButtons1.title}}"/> + </actionGroup> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addSecondConfigProductToCart"> + <argument name="productName" value="$$createSecondConfigProduct.name$$"/> + </actionGroup> + + <!-- Add second product with another selected options to the cart --> + <actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="secondConfigProductSelectFirstOptionAnotherValue"> + <argument name="attributeLabel" value="$$createSecondConfigProductAttribute.default_frontend_label$$"/> + <argument name="optionLabel" value="$$createSecondConfigProductAttributeSecondOption.option[store_labels][1][label]$$"/> + </actionGroup> + <actionGroup ref="StorefrontProductPageSelectRadioButtonOptionValueActionGroup" stepKey="secondConfigProductSelectSecondOptionAnotherValue"> + <argument name="attributeLabel" value="{{ProductOptionRadiobuttonWithTwoFixedOptions.title}}"/> + <argument name="optionLabel" value="{{ProductOptionValueRadioButtons3.title}}"/> + </actionGroup> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addSecondConfigProductWithOtherOptionsToCart"> + <argument name="productName" value="$$createSecondConfigProduct.name$$"/> + </actionGroup> + + <!--Assert products prices in the cart --> + <actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="amOnShoppingCartPage"/> + <waitForPageLoad stepKey="waitForShoppingCartPageLoad"/> + <waitForElementVisible selector="{{CheckoutCartProductSection.ProductPriceByOption($$createFirstConfigProductAttributeFirstOption.option[store_labels][1][label]$$)}}" stepKey="waitForCartFullyLoaded"/> + <see userInput="$210.69" selector="{{CheckoutCartProductSection.ProductPriceByOption($$createFirstConfigProductAttributeFirstOption.option[store_labels][1][label]$$)}}" stepKey="assertFirstProductPriceForFirstProductOption"/> + <see userInput="$120.70" selector="{{CheckoutCartProductSection.ProductPriceByOption($$createFirstConfigProductAttributeSecondOption.option[store_labels][1][label]$$)}}" stepKey="assertFirstProductPriceForSecondProductOption"/> + <see userInput="$210.69" selector="{{CheckoutCartProductSection.ProductPriceByOption($$createSecondConfigProductAttributeFirstOption.option[store_labels][1][label]$$)}}" stepKey="assertSecondProductPriceForFirstProductOption"/> + <see userInput="$120.70" selector="{{CheckoutCartProductSection.ProductPriceByOption($$createSecondConfigProductAttributeSecondOption.option[store_labels][1][label]$$)}}" stepKey="assertSecondProductPriceForSecondProductOption"/> + </test> +</tests> diff --git a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProductsTest.xml b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProductsTest.xml index 1bc794ae80cd7..c110daee35428 100644 --- a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProductsTest.xml +++ b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProductsTest.xml @@ -11,14 +11,14 @@ <annotations> <features value="CatalogRuleConfigurable"/> <stories value="Apply catalog price rule"/> - <title value="Apply catalog rule for configurable product with assigned simple products"/> - <description value="Admin should be able to apply catalog rule for configurable product with assigned simple products"/> + <title value="DEPRECATED. Apply catalog rule for configurable product with assigned simple products"/> + <description value="DEPRECATED. Admin should be able to apply catalog rule for configurable product with assigned simple products"/> <severity value="CRITICAL"/> <testCaseId value="MC-14063"/> <group value="catalogRuleConfigurable"/> <group value="mtf_migrated"/> <skip> - <issueId value="MC-17140"/> + <issueId value="DEPRECATED">Use AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProducts2Test instead</issueId> </skip> </annotations> <before> diff --git a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptions2Test.xml b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptions2Test.xml new file mode 100644 index 0000000000000..bc6c89f2f1155 --- /dev/null +++ b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptions2Test.xml @@ -0,0 +1,220 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminApplyCatalogRuleForConfigurableProductWithOptions2Test"> + <annotations> + <features value="CatalogRuleConfigurable"/> + <stories value="Apply catalog price rule"/> + <title value="Apply catalog price rule for configurable product with options"/> + <description value="Admin should be able to apply the catalog rule for configurable product with options"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-27707"/> + <group value="catalog"/> + <group value="configurable_product"/> + <group value="catalog_rule_configurable"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <!-- Create category --> + <createData entity="SimpleSubCategory" stepKey="simpleCategory"/> + + <!-- Create configurable product with three options --> + <createData entity="ApiConfigurableProduct" stepKey="createConfigProduct"> + <requiredEntity createDataKey="simpleCategory"/> + </createData> + + <createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/> + <createData entity="productAttributeOption1" stepKey="createConfigProductAttributeFirstOption"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </createData> + <createData entity="productAttributeOption2" stepKey="createConfigProductAttributeSecondOption"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </createData> + <createData entity="productAttributeOption3" stepKey="createConfigProductAttributeThirdOption"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </createData> + + <createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </createData> + + <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeFirstOption"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </getData> + <getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeSecondOption"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </getData> + <getData entity="ProductAttributeOptionGetter" index="3" stepKey="getConfigAttributeThirdOption"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </getData> + + <!-- Create three child products --> + <createData entity="ApiSimpleOne" stepKey="createConfigFirstChildProduct"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="getConfigAttributeFirstOption"/> + </createData> + + <createData entity="ApiSimpleOne" stepKey="createConfigSecondChildProduct"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="getConfigAttributeSecondOption"/> + </createData> + + <createData entity="ApiSimpleOne" stepKey="createConfigThirdChildProduct"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="getConfigAttributeThirdOption"/> + </createData> + + <createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption"> + <requiredEntity createDataKey="createConfigProduct"/> + <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="getConfigAttributeFirstOption"/> + <requiredEntity createDataKey="getConfigAttributeSecondOption"/> + <requiredEntity createDataKey="getConfigAttributeThirdOption"/> + </createData> + + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddFirstChild"> + <requiredEntity createDataKey="createConfigProduct"/> + <requiredEntity createDataKey="createConfigFirstChildProduct"/> + </createData> + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddSecondChild"> + <requiredEntity createDataKey="createConfigProduct"/> + <requiredEntity createDataKey="createConfigSecondChildProduct"/> + </createData> + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddThirdChild"> + <requiredEntity createDataKey="createConfigProduct"/> + <requiredEntity createDataKey="createConfigThirdChildProduct"/> + </createData> + + <!-- Login as Admin --> + <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> + <actionGroup ref="AdminCatalogPriceRuleDeleteAllActionGroup" stepKey="deleteAllCatalogPriceRule"/> + </before> + <after> + <!-- Delete created data --> + <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> + <deleteData createDataKey="createConfigFirstChildProduct" stepKey="deleteFirstSimpleProduct"/> + <deleteData createDataKey="createConfigSecondChildProduct" stepKey="deleteSecondSimpleProduct"/> + <deleteData createDataKey="createConfigThirdChildProduct" stepKey="deleteThirdSimpleProduct"/> + <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> + <deleteData createDataKey="simpleCategory" stepKey="deleteCategory"/> + + <actionGroup ref="AdminCatalogPriceRuleDeleteAllActionGroup" stepKey="deleteAllCatalogPriceRule"/> + <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + </after> + + <!-- Create price rule for first configurable product option --> + <actionGroup ref="AdminOpenNewCatalogPriceRuleFormPageActionGroup" stepKey="startCreatingFirstPriceRule"/> + <actionGroup ref="AdminCatalogPriceRuleFillMainInfoActionGroup" stepKey="fillMainInfoForFirstPriceRule"> + <argument name="groups" value="'NOT LOGGED IN'"/> + </actionGroup> + <actionGroup ref="CreateCatalogPriceRuleConditionWithAttributeAndOptionActionGroup" stepKey="fillConditionsForFirstPriceRule"> + <argument name="attributeName" value="$$createConfigProductAttribute.attribute[frontend_labels][0][label]$$"/> + <argument name="targetSelectValue" value="$$createConfigProductAttributeFirstOption.option[store_labels][1][label]$$"/> + <argument name="indexA" value="1"/> + <argument name="indexB" value="1"/> + </actionGroup> + <actionGroup ref="AdminCatalogPriceRuleFillActionsActionGroup" stepKey="fillActionsForFirstPriceRule"> + <argument name="apply" value="{{CatalogRuleToFixed.simple_action}}"/> + <argument name="discountAmount" value="{{CatalogRuleToFixed.discount_amount}}"/> + </actionGroup> + <actionGroup ref="AdminCatalogPriceRuleSaveAndApplyActionGroup" stepKey="saveAndApplyFirstPriceRule"/> + + <!-- Create price rule for second configurable product option --> + <actionGroup ref="AdminOpenNewCatalogPriceRuleFormPageActionGroup" stepKey="startCreatingThirdPriceRule"/> + <actionGroup ref="AdminCatalogPriceRuleFillMainInfoActionGroup" stepKey="fillMainInfoForThirdPriceRule"> + <argument name="groups" value="'NOT LOGGED IN'"/> + </actionGroup> + <actionGroup ref="CreateCatalogPriceRuleConditionWithAttributeAndOptionActionGroup" stepKey="fillConditionsForThirdPriceRule"> + <argument name="attributeName" value="$$createConfigProductAttribute.attribute[frontend_labels][0][label]$$"/> + <argument name="targetSelectValue" value="$$createConfigProductAttributeSecondOption.option[store_labels][1][label]$$"/> + <argument name="indexA" value="1"/> + <argument name="indexB" value="1"/> + </actionGroup> + <actionGroup ref="AdminCatalogPriceRuleFillActionsActionGroup" stepKey="fillActionsForThirdPriceRule"/> + <actionGroup ref="AdminCatalogPriceRuleSaveAndApplyActionGroup" stepKey="saveAndApplyThirdPriceRule"/> + + <!-- Create price rule for third configurable product option --> + <actionGroup ref="AdminOpenNewCatalogPriceRuleFormPageActionGroup" stepKey="startCreatingSecondPriceRule"/> + <actionGroup ref="AdminCatalogPriceRuleFillMainInfoActionGroup" stepKey="fillMainInfoForSecondPriceRule"> + <argument name="groups" value="'NOT LOGGED IN'"/> + </actionGroup> + <actionGroup ref="CreateCatalogPriceRuleConditionWithAttributeAndOptionActionGroup" stepKey="fillConditionsForSecondPriceRule"> + <argument name="attributeName" value="$$createConfigProductAttribute.attribute[frontend_labels][0][label]$$"/> + <argument name="targetSelectValue" value="$$createConfigProductAttributeThirdOption.option[store_labels][1][label]$$"/> + <argument name="indexA" value="1"/> + <argument name="indexB" value="1"/> + </actionGroup> + <actionGroup ref="AdminCatalogPriceRuleFillActionsActionGroup" stepKey="fillActionsForSecondPriceRule"> + <argument name="apply" value="{{CatalogRuleWithoutDiscount.simple_action}}"/> + <argument name="discountAmount" value="{{CatalogRuleWithoutDiscount.discount_amount}}"/> + </actionGroup> + <actionGroup ref="AdminCatalogPriceRuleSaveAndApplyActionGroup" stepKey="saveAndApplySecondPriceRule"/> + + <actionGroup ref="AdminReindexAndFlushCache" stepKey="reindexAndFlushCache"/> + + <!-- Assert product in storefront product page --> + <amOnPage url="{{StorefrontProductPage.url($$createConfigProduct.custom_attributes[url_key]$$)}}" stepKey="amOnProductPage"/> + <waitForPageLoad stepKey="waitForProductPageLoad"/> + <actionGroup ref="StorefrontAssertUpdatedProductPriceInStorefrontProductPageActionGroup" stepKey="assertUpdatedProductPriceInStorefrontProductPage"> + <argument name="productName" value="$$createConfigProduct.name$$"/> + <argument name="expectedPrice" value="As low as ${{CatalogRuleToFixed.discount_amount}}"/> + </actionGroup> + + <executeJS function="return '$' + ({{CatalogRuleToFixed.discount_amount}}).toFixed(2);" stepKey="firstOptionPrice"/> + <executeJS function="return '$' + ({{ApiConfigurableProduct.price}} * (100 - {{_defaultCatalogRule.discount_amount}})/100).toFixed(2);" stepKey="secondOptionPrice"/> + + <!-- Assert product options price in storefront product page --> + <actionGroup ref="StorefrontAssertCatalogPriceRuleAppliedToProductOptionActionGroup" stepKey="assertCatalogPriceRuleAppliedToFirstProductOption"> + <argument name="option" value="$$createConfigProductAttributeFirstOption.option[store_labels][1][label]$$"/> + <argument name="expectedPrice" value="{$firstOptionPrice} Regular Price ${{ApiConfigurableProduct.price}}"/> + </actionGroup> + + <actionGroup ref="StorefrontAssertCatalogPriceRuleAppliedToProductOptionActionGroup" stepKey="assertCatalogPriceRuleAppliedToSecondProductOption"> + <argument name="option" value="$$createConfigProductAttributeSecondOption.option[store_labels][1][label]$$"/> + <argument name="expectedPrice" value="{$secondOptionPrice} Regular Price ${{ApiConfigurableProduct.price}}"/> + </actionGroup> + + <actionGroup ref="StorefrontAssertCatalogPriceRuleAppliedToProductOptionActionGroup" stepKey="assertCatalogPriceRuleAppliedToThirdProductOption"> + <argument name="option" value="$$createConfigProductAttributeThirdOption.option[store_labels][1][label]$$"/> + <argument name="expectedPrice" value="{{ApiConfigurableProduct.price}}"/> + </actionGroup> + + <!-- Add product with selected option to the cart --> + <actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="selectFirstOptionValue"> + <argument name="attributeLabel" value="$$createConfigProductAttribute.default_frontend_label$$"/> + <argument name="optionLabel" value="$$createConfigProductAttributeFirstOption.option[store_labels][1][label]$$"/> + </actionGroup> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addFirstOptionToCart"> + <argument name="productName" value="$$createConfigProduct.name$$"/> + </actionGroup> + + <actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="selectSecondOptionValue"> + <argument name="attributeLabel" value="$$createConfigProductAttribute.default_frontend_label$$"/> + <argument name="optionLabel" value="$$createConfigProductAttributeSecondOption.option[store_labels][1][label]$$"/> + </actionGroup> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addSecondOptionToCart"> + <argument name="productName" value="$$createConfigProduct.name$$"/> + </actionGroup> + + <actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="selectThirdOptionValue"> + <argument name="attributeLabel" value="$$createConfigProductAttribute.default_frontend_label$$"/> + <argument name="optionLabel" value="$$createConfigProductAttributeThirdOption.option[store_labels][1][label]$$"/> + </actionGroup> + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addThirdOptionToCart"> + <argument name="productName" value="$$createConfigProduct.name$$"/> + </actionGroup> + + <!--Assert product price in the cart --> + <actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openCartPage"/> + <waitForElementVisible selector="{{CheckoutCartProductSection.ProductPriceByOption($$createConfigProductAttributeFirstOption.option[store_labels][1][label]$$)}}" stepKey="waitForPriceAppears"/> + <see userInput="{$firstOptionPrice}" selector="{{CheckoutCartProductSection.ProductPriceByOption($$createConfigProductAttributeFirstOption.option[store_labels][1][label]$$)}}" stepKey="assertProductPriceForFirstProductOption"/> + <see userInput="{$secondOptionPrice}" selector="{{CheckoutCartProductSection.ProductPriceByOption($$createConfigProductAttributeSecondOption.option[store_labels][1][label]$$)}}" stepKey="assertProductPriceForSecondProductOption"/> + <see userInput="{{ApiConfigurableProduct.price}}" selector="{{CheckoutCartProductSection.ProductPriceByOption($$createConfigProductAttributeThirdOption.option[store_labels][1][label]$$)}}" stepKey="assertProductPriceForThirdProductOption"/> + </test> +</tests> diff --git a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptionsTest.xml b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptionsTest.xml index fcf5e2c038047..05f30fd6fcbde 100644 --- a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptionsTest.xml +++ b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptionsTest.xml @@ -11,14 +11,14 @@ <annotations> <features value="CatalogRuleConfigurable"/> <stories value="Apply catalog price rule"/> - <title value="Apply catalog price rule for configurable product with options"/> - <description value="Admin should be able to apply the catalog rule for configurable product with options"/> + <title value="DEPRECATED. Apply catalog price rule for configurable product with options"/> + <description value="DEPRECATED. Admin should be able to apply the catalog rule for configurable product with options"/> <severity value="CRITICAL"/> <testCaseId value="MC-14062"/> <group value="catalogRuleConfigurable"/> <group value="mtf_migrated"/> <skip> - <issueId value="MC-17140"/> + <issueId value="DEPRECATED">Use AdminApplyCatalogRuleForConfigurableProductWithOptions2Test instead</issueId> </skip> </annotations> <before> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontSelectOptionDropDownActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontSelectOptionDropDownActionGroup.xml index 0e36e0ecbe71f..fa169373c1096 100644 --- a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontSelectOptionDropDownActionGroup.xml +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontSelectOptionDropDownActionGroup.xml @@ -10,13 +10,13 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="StorefrontSelectOptionDropDownActionGroup"> <annotations> - <description>Selects the provided Product Option Value under the provided Product Option Title on a Storefront Product page.</description> + <description>DEPRECATED. Please use StorefrontProductPageSelectDropDownOptionValueActionGroup instead. Selects the provided Product Option Value under the provided Product Option Title on a Storefront Product page.</description> </annotations> <arguments> <argument name="optionTitle" defaultValue="ProductOptionDropDown"/> <argument name="option" defaultValue="ProductOptionValueDropdown2.title"/> </arguments> - + <selectOption selector="{{StorefrontProductInfoMainSection.productOptionSelect(optionTitle.title)}}" userInput="{{option}}" stepKey="fillOptionDropDown"/> </actionGroup> </actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontSelectOptionRadioButtonActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontSelectOptionRadioButtonActionGroup.xml index c0de6f8f8466f..ba75a03d6ff04 100644 --- a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontSelectOptionRadioButtonActionGroup.xml +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontSelectOptionRadioButtonActionGroup.xml @@ -10,7 +10,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="StorefrontSelectOptionRadioButtonActionGroup"> <annotations> - <description>Checks the provided Product Option radio button for the provided Product Option Price on a Storefront Product page.</description> + <description>DEPRECATED. Please use StorefrontProductPageSelectRadioButtonOptionValueActionGroup instead. Checks the provided Product Option radio button for the provided Product Option Price on a Storefront Product page.</description> </annotations> <arguments> <argument name="optionTitle" defaultValue="ProductOptionRadiobutton"/> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategory2Test.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategory2Test.xml new file mode 100644 index 0000000000000..aa207c4c10cf3 --- /dev/null +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategory2Test.xml @@ -0,0 +1,87 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategory2Test"> + <annotations> + <features value="UrlRewrite"/> + <stories value="Update url rewrites"/> + <title value="Check url rewrites in catalog categories after changing url key"/> + <description value="Check url rewrites in catalog categories after changing url key for store view and moving category"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-25622"/> + <group value="catalog"/> + <group value="url_rewrite"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <!-- Create two sub-categories in default category with simple products --> + <createData entity="_defaultCategory" stepKey="createFirstCategory"/> + <createData entity="_defaultProduct" stepKey="createFirstSimpleProduct"> + <requiredEntity createDataKey="createFirstCategory"/> + </createData> + <createData entity="_defaultCategory" stepKey="createSecondCategory"/> + <createData entity="_defaultProduct" stepKey="createSecondSimpleProduct"> + <requiredEntity createDataKey="createSecondCategory"/> + </createData> + + <!-- Log in to backend --> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + + <!--Create additional Store View in Main Website Store --> + <actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createStoreView"/> + <magentoCLI command="indexer:reindex" stepKey="reindexAll"/> + </before> + + <after> + <deleteData createDataKey="createFirstCategory" stepKey="deleteFirstCategory"/> + <deleteData createDataKey="createSecondCategory" stepKey="deleteSecondCategory"/> + <deleteData createDataKey="createFirstSimpleProduct" stepKey="deleteFirstSimpleProduct"/> + <deleteData createDataKey="createSecondSimpleProduct" stepKey="deleteSecondSimpleProduct"/> + <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearWebsitesGridFilters"/> + <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + </after> + + <!-- On the categories editing page change store view to created additional view --> + <actionGroup ref="SwitchCategoryStoreViewActionGroup" stepKey="openFirstCategoryAndSwitchToCustomStoreView"> + <argument name="Store" value="customStore.name"/> + <argument name="CatName" value="$createFirstCategory.name$"/> + </actionGroup> + + <!-- Change url key for category for first category; save --> + <actionGroup ref="ChangeSeoUrlKeyForSubCategoryActionGroup" stepKey="changeFirstCategoryUrlKey"> + <argument name="value" value="{{SimpleRootSubCategory.url_key}}"/> + </actionGroup> + + <!-- Change store view to "All store views" for first category --> + <actionGroup ref="SwitchCategoryToAllStoreViewActionGroup" stepKey="switchToAllStoreViews"> + <argument name="CatName" value="$createFirstCategory.name$"/> + </actionGroup> + + <!-- Move first category inside second category --> + <actionGroup ref="MoveCategoryActionGroup" stepKey="moveFirstCategoryInsideSecondCategory"> + <argument name="childCategory" value="$createFirstCategory.name$"/> + <argument name="parentCategory" value="$createSecondCategory.name$"/> + </actionGroup> + + <!-- Open first category storefront page --> + <amOnPage url="{{StorefrontCategoryPage.url($createFirstCategory.custom_attributes[url_path]$)}}" stepKey="openFirstCategoryStorefrontPage"/> + <waitForPageLoad stepKey="waitForFirstCategoryStorefrontPageLoad"/> + <see userInput="$createFirstSimpleProduct.name$" selector="{{StorefrontCategoryMainSection.productsList}}" stepKey="seeFirstProductInCategory"/> + + <!-- Switch to custom store view--> + <actionGroup ref="StorefrontSwitchStoreViewActionGroup" stepKey="switchToCustomStoreView"> + <argument name="storeView" value="customStore"/> + </actionGroup> + + <!-- Assert category url with custom store view --> + <seeInCurrentUrl url="{{SimpleRootSubCategory.url_key}}.html" stepKey="seeUpdatedUrlKey"/> + <see userInput="$createFirstSimpleProduct.name$" selector="{{StorefrontCategoryMainSection.productsList}}" stepKey="seeFirstProductInCategoryAgain"/> + </test> +</tests> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategoryTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategoryTest.xml index badda06b827ea..7f9ee3020c388 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategoryTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategoryTest.xml @@ -11,12 +11,15 @@ <annotations> <features value="Url Rewrite"/> <stories value="Update url rewrites"/> - <title value="Check url rewrites in catalog categories after changing url key"/> - <description value="Check url rewrites in catalog categories after changing url key for store view and moving category"/> + <title value="DEPRECATED. Check url rewrites in catalog categories after changing url key"/> + <description value="DEPRECATED. Check url rewrites in catalog categories after changing url key for store view and moving category"/> <severity value="CRITICAL"/> <testCaseId value="MC-5352"/> <group value="url_rewrite"/> <group value="mtf_migrated"/> + <skip> + <issueId value="DEPRECATED">Use AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategory2Test instead</issueId> + </skip> </annotations> <before> <!-- Create two sub-categories in default category with simple products --> From fb90fd701cf37b24d9f678a74cc91488f27bee79 Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Thu, 16 Jan 2020 16:00:35 +0200 Subject: [PATCH 0854/1143] MC-25108: MFTF Flakiness because of bad design - StoreFrontMyAccountWithMultishipmentTest --- .../Test/Mftf/Test/StorefrontOrderWithMultishippingTest.xml | 1 + ...ertStorefrontCustomerOrderMatchesGrandTotalActionGroup.xml | 4 ++++ .../Test/Mftf/Section/StorefrontCustomerOrdersGridSection.xml | 4 ++-- 3 files changed, 7 insertions(+), 2 deletions(-) rename app/code/Magento/{Multishipping => Sales}/Test/Mftf/ActionGroup/AssertStorefrontCustomerOrderMatchesGrandTotalActionGroup.xml (91%) diff --git a/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontOrderWithMultishippingTest.xml b/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontOrderWithMultishippingTest.xml index 26a1892cb679e..dbc1ba980e9c7 100644 --- a/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontOrderWithMultishippingTest.xml +++ b/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontOrderWithMultishippingTest.xml @@ -16,6 +16,7 @@ <description value="Verify that shipping price on My account matches with shipping method prices after multiple addresses checkout (Order view page)"/> <severity value="CRITICAL"/> <testCaseId value="MC-28900"/> + <useCaseId value="MC-19303"/> <group value="catalog"/> <group value="sales"/> <group value="multishipping"/> diff --git a/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/AssertStorefrontCustomerOrderMatchesGrandTotalActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AssertStorefrontCustomerOrderMatchesGrandTotalActionGroup.xml similarity index 91% rename from app/code/Magento/Multishipping/Test/Mftf/ActionGroup/AssertStorefrontCustomerOrderMatchesGrandTotalActionGroup.xml rename to app/code/Magento/Sales/Test/Mftf/ActionGroup/AssertStorefrontCustomerOrderMatchesGrandTotalActionGroup.xml index 9281cdf03a1ab..b5361363c489b 100644 --- a/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/AssertStorefrontCustomerOrderMatchesGrandTotalActionGroup.xml +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AssertStorefrontCustomerOrderMatchesGrandTotalActionGroup.xml @@ -9,6 +9,10 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <actionGroup name="AssertStorefrontCustomerOrderMatchesGrandTotalActionGroup"> + <annotations> + <description>Check that order grand total equals sum of all totals.</description> + </annotations> + <grabTextFrom selector="{{StorefrontSalesOrderSection.salesOrderPrice('subtotal')}}" stepKey="grabValueForSubtotal"/> <grabTextFrom selector="{{StorefrontSalesOrderSection.salesOrderPrice('shipping')}}" stepKey="grabValueForShippingHandling"/> <grabTextFrom selector="{{StorefrontSalesOrderSection.salesOrderPrice('grand_total')}}" stepKey="grabValueForGrandTotal"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Section/StorefrontCustomerOrdersGridSection.xml b/app/code/Magento/Sales/Test/Mftf/Section/StorefrontCustomerOrdersGridSection.xml index 5b079891f657a..0964ef5811cec 100644 --- a/app/code/Magento/Sales/Test/Mftf/Section/StorefrontCustomerOrdersGridSection.xml +++ b/app/code/Magento/Sales/Test/Mftf/Section/StorefrontCustomerOrdersGridSection.xml @@ -9,7 +9,7 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="StorefrontCustomerOrdersGridSection"> - <element name="orderView" type="button" selector="//td[text()='{{orderNumber}}']/following-sibling::td[@class='col actions']/a[contains(@class, 'view')]" parameterized="true" timeout="30" /> - <element name="reorderBtn" type="button" selector="//td[text()='{{orderNumber}}']/following-sibling::td[@class='col actions']/a[contains(@class, 'order')]" parameterized="true" timeout="30" /> + <element name="orderView" type="button" selector="//td[contains(text(),'{{orderNumber}}')]/following-sibling::td[contains(@class,'col') and contains(@class,'actions')]/a[contains(@class, 'view')]" parameterized="true" timeout="30" /> + <element name="reorderBtn" type="button" selector="//td[contains(text(),'{{orderNumber}}')]/following-sibling::td[contains(@class,'col') and contains(@class,'actions')]/a[contains(@class, 'order')]" parameterized="true" timeout="30" /> </section> </sections> From ca69fd22d5d644b6d5347aae5ef57407dfd49bd4 Mon Sep 17 00:00:00 2001 From: Viktor Sevch <svitja@ukr.net> Date: Thu, 16 Jan 2020 16:30:22 +0200 Subject: [PATCH 0855/1143] MC-23546: Child Configurable product does not save disabled status via API --- .../StorefrontQuickSearchConfigurableChildrenTest.xml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontQuickSearchConfigurableChildrenTest.xml b/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontQuickSearchConfigurableChildrenTest.xml index 03ce878ef4f9f..1169d053ec7c8 100644 --- a/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontQuickSearchConfigurableChildrenTest.xml +++ b/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontQuickSearchConfigurableChildrenTest.xml @@ -14,8 +14,8 @@ <title value="User should be able to use Quick Search to a configurable product's child products"/> <description value="Use Quick Search to find a configurable product with enabled/disable children"/> <severity value="MAJOR"/> - <testCaseId value="MC-14798"/> - <group value="CatalogSearch"/> + <testCaseId value="MC-28374"/> + <group value="catalogSearch"/> <group value="mtf_migrated"/> </annotations> <before> @@ -75,20 +75,19 @@ <magentoCLI command="indexer:reindex" stepKey="reindex"/> </before> <after> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> <deleteData createDataKey="createConfigurableProduct" stepKey="deleteConfigurableProduct"/> <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> <deleteData createDataKey="createProductAttribute" stepKey="deleteProductAttribute"/> <deleteData createDataKey="createAttributeSet" stepKey="deleteAttributeSet"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <actionGroup ref="logout" stepKey="logoutFromAdmin"/> </after> <amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToHomePage"/> <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="searchStorefront"> <argument name="phrase" value="$createConfigurableProduct.name$"/> </actionGroup> - <actionGroup ref="StorefrontQuickSearchCheckProductNameInGridActionGroup" stepKey="seeProductInGrid"> + <actionGroup ref="StorefrontQuickSearchSeeProductByNameActionGroup" stepKey="seeProductInGrid"> <argument name="productName" value="$createConfigurableProduct.name$"/> - <argument name="index" value="1"/> </actionGroup> <!-- Disable Child Product --> From 92816ab04db61666741ae9ab0986175068c46bee Mon Sep 17 00:00:00 2001 From: Fanis Strezos <fanis.strezos@dotdigital.com> Date: Thu, 16 Jan 2020 15:38:32 +0000 Subject: [PATCH 0856/1143] update getCustomer method in order class --- .../Magento/Sales/Api/Data/OrderInterface.php | 8 +++++++ app/code/Magento/Sales/Model/Order.php | 23 ++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Api/Data/OrderInterface.php b/app/code/Magento/Sales/Api/Data/OrderInterface.php index b45fddc7d7354..f699d24bd32cd 100644 --- a/app/code/Magento/Sales/Api/Data/OrderInterface.php +++ b/app/code/Magento/Sales/Api/Data/OrderInterface.php @@ -5,6 +5,8 @@ */ namespace Magento\Sales\Api\Data; +use Magento\Customer\Model\Customer; + /** * Order interface. * @@ -910,6 +912,12 @@ public function getCreatedAt(); */ public function setCreatedAt($createdAt); + /** + * Gets the customer from Order + * @return Customer + */ + public function getCustomer(); + /** * Gets the customer date-of-birth (DOB) for the order. * diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php index 89564f97ccf16..1d520574f21d7 100644 --- a/app/code/Magento/Sales/Model/Order.php +++ b/app/code/Magento/Sales/Model/Order.php @@ -6,6 +6,7 @@ namespace Magento\Sales\Model; use Magento\Config\Model\Config\Source\Nooptreq; +use Magento\Customer\Api\CustomerRepositoryInterface; use Magento\Directory\Model\Currency; use Magento\Framework\Api\AttributeValueFactory; use Magento\Framework\Api\SearchCriteriaBuilder; @@ -51,7 +52,6 @@ * @method bool hasCustomerNoteNotify() * @method bool hasForcedCanCreditmemo() * @method bool getIsInProcess() - * @method \Magento\Customer\Model\Customer getCustomer() * @method \Magento\Sales\Model\Order setSendEmail(bool $value) * @SuppressWarnings(PHPMD.ExcessivePublicCount) * @SuppressWarnings(PHPMD.TooManyFields) @@ -307,6 +307,11 @@ class Order extends AbstractModel implements EntityInterface, OrderInterface */ private $scopeConfig; + /** + * @var CustomerRepositoryInterface + */ + private $_customerRepositoryInterface; + /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry @@ -340,6 +345,7 @@ class Order extends AbstractModel implements EntityInterface, OrderInterface * @param OrderItemRepositoryInterface $itemRepository * @param SearchCriteriaBuilder $searchCriteriaBuilder * @param ScopeConfigInterface $scopeConfig + * @param CustomerRepositoryInterface $customerRepositoryInterface * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -366,6 +372,7 @@ public function __construct( \Magento\Sales\Model\ResourceModel\Order\Shipment\Track\CollectionFactory $trackCollectionFactory, \Magento\Sales\Model\ResourceModel\Order\CollectionFactory $salesOrderCollectionFactory, PriceCurrencyInterface $priceCurrency, + CustomerRepositoryInterface $customerRepositoryInterface, \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productListFactory, \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, @@ -403,6 +410,7 @@ public function __construct( $this->searchCriteriaBuilder = $searchCriteriaBuilder ?: ObjectManager::getInstance() ->get(SearchCriteriaBuilder::class); $this->scopeConfig = $scopeConfig ?: ObjectManager::getInstance()->get(ScopeConfigInterface::class); + $this->_customerRepositoryInterface = $customerRepositoryInterface; parent::__construct( $context, @@ -562,6 +570,19 @@ public function getStore() return $this->_storeManager->getStore(); } + /** + * Returns Customer + * + * @return \Magento\Customer\Api\Data\CustomerInterface + * @throws LocalizedException + * @throws \Magento\Framework\Exception\NoSuchEntityException + */ + public function getCustomer() + { + $customerId = $this->getData(OrderInterface::CUSTOMER_ID); + return $this->_customerRepositoryInterface->getById($customerId); + } + /** * Retrieve order cancel availability * From 9ec1d67e18d0b4fed5cc1ef3c8b9a8ad7327d41c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Tylek?= <pawel.tylek@creativestyle.pl> Date: Thu, 16 Jan 2020 16:57:41 +0100 Subject: [PATCH 0857/1143] Add to Compare link does not show in mobile view under 640px in blank theme --- .../Magento/blank/Magento_Catalog/web/css/source/_module.less | 1 - 1 file changed, 1 deletion(-) diff --git a/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/_module.less b/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/_module.less index 44e93087399a1..cd7177d329e7f 100644 --- a/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/_module.less +++ b/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/_module.less @@ -543,7 +543,6 @@ } .compare, - .product-addto-links .action.tocompare, .product-item-actions .actions-secondary > .action.tocompare, [class*='block-compare'] { display: none; From 84093ba759495ff026a64f22dd358f42a52febc5 Mon Sep 17 00:00:00 2001 From: Arnob Saha <arnobsh@gmail.com> Date: Thu, 16 Jan 2020 12:02:28 -0600 Subject: [PATCH 0858/1143] MC-30431: MFTF test incorrect behavior after its' implementation in MC-20229 - fixing MFTF test --- .../Mftf/Test/AdminUrlRewritesForProductAfterImportTest.xml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUrlRewritesForProductAfterImportTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUrlRewritesForProductAfterImportTest.xml index 88c28230b8347..15d54d2904b58 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUrlRewritesForProductAfterImportTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUrlRewritesForProductAfterImportTest.xml @@ -22,8 +22,6 @@ </annotations> <before> <comment userInput="Set the configuration for Generate category/product URL Rewrites" stepKey="commentSetURLRewriteConfiguration" /> - <comment userInput="Enable config to generate category/product URL Rewrites " stepKey="commentEnableConfig" /> - <magentoCLI command="config:set catalog/seo/generate_category_product_rewrites 1" stepKey="enableGenerateUrlRewrite"/> <createData entity="NewRootCategory" stepKey="simpleSubCategory1"> <field key="parent_id">2</field> </createData> @@ -44,8 +42,6 @@ <deleteData createDataKey="simpleSubCategory3" stepKey="deleteSimpleSubCategory3"/> <deleteData createDataKey="simpleSubCategory2" stepKey="deleteSimpleSubCategory2"/> <deleteData createDataKey="simpleSubCategory1" stepKey="deleteSimpleSubCategory1"/> - <comment userInput="Disable config to generate category/product URL Rewrites " stepKey="commentDisableConfig" /> - <magentoCLI command="config:set catalog/seo/generate_category_product_rewrites 0" stepKey="disableGenerateUrlRewrite"/> <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> </after> From 720a13973434a240e206a29679f71e7e56f91111 Mon Sep 17 00:00:00 2001 From: Joan He <johe@magento.com> Date: Wed, 15 Jan 2020 11:55:58 -0600 Subject: [PATCH 0859/1143] B2B-343: Stabilize Community PR --- .../StorefrontUpdateSearchTermEntityTest.xml | 13 ++++++++-- ...archSuggestionByProductDescriptionTest.xml | 24 ------------------- 2 files changed, 11 insertions(+), 26 deletions(-) diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontUpdateSearchTermEntityTest.xml b/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontUpdateSearchTermEntityTest.xml index 6c475ddc60a95..fab28dc357016 100644 --- a/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontUpdateSearchTermEntityTest.xml +++ b/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontUpdateSearchTermEntityTest.xml @@ -25,14 +25,23 @@ <requiredEntity createDataKey="createCategory1"/> </createData> + <!-- Perform reindex and flush cache --> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> <amOnPage url="{{StorefrontHomePage.url}}" stepKey="amOnStorefrontPage1"/> <waitForPageLoad stepKey="waitForPageLoad1"/> </before> <after> - <actionGroup ref="logout" stepKey="logoutOfAdmin1"/> - <deleteData createDataKey="createProduct1" stepKey="deleteSimpleProduct1"/> <deleteData createDataKey="createCategory1" stepKey="deleteCategory1"/> + + <!-- Delete all search terms --> + <amOnPage url="{{AdminCatalogSearchTermIndexPage.url}}" stepKey="openAdminCatalogSearchTermIndexPage"/> + <waitForPageLoad stepKey="waitForAdminCatalogSearchTermIndexPageLoad"/> + <comment userInput="Delete all search terms" stepKey="deleteAllSearchTermsComment"/> + <actionGroup ref="AdminDeleteAllSearchTermsActionGroup" stepKey="deleteAllSearchTerms"/> + + <actionGroup ref="logout" stepKey="logoutOfAdmin1"/> </after> <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="quickSearchByProductName1"> diff --git a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductDescriptionTest.xml b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductDescriptionTest.xml index 959f3835a7d12..93a0f98f6f828 100644 --- a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductDescriptionTest.xml +++ b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductDescriptionTest.xml @@ -16,24 +16,11 @@ <severity value="CRITICAL"/> <testCaseId value="MC-14765"/> <group value="mtf_migrated"/> - <skip> - <issueId value="MC-19868"/> - </skip> </annotations> <before> <!-- Login as admin --> - <comment userInput="Login as admin" stepKey="loginAsAdminComment"/> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - <!-- Go to the catalog search term page --> - <comment userInput="Go to the catalog search term page" stepKey="goToSearchTermPageComment"/> - <amOnPage url="{{AdminCatalogSearchTermIndexPage.url}}" stepKey="openAdminCatalogSearchTermIndexPage"/> - <waitForPageLoad stepKey="waitForAdminCatalogSearchTermIndexPageLoad"/> - <!-- Delete all search terms --> - <comment userInput="Delete all search terms" stepKey="deleteAllSearchTermsComment"/> - <actionGroup ref="AdminDeleteAllSearchTermsActionGroup" stepKey="deleteAllSearchTerms"/> - <actionGroup ref="DeleteAllProductsUsingProductGridActionGroup" stepKey="deleteAllProducts"/> <!-- Create product with description --> - <comment userInput="Create product with description" stepKey="createProductWithDescriptionComment"/> <createData entity="SimpleProductWithDescription" stepKey="simpleProduct"/> <!-- Perform reindex and flush cache --> @@ -42,51 +29,40 @@ </before> <after> <!-- Delete created product --> - <comment userInput="Delete created product" stepKey="deleteCreatedProductComment"/> <deleteData createDataKey="simpleProduct" stepKey="deleteProduct"/> <!-- Go to the catalog search term page --> - <comment userInput="Go to the catalog search term page" stepKey="goToSearchTermPageComment2"/> <amOnPage url="{{AdminCatalogSearchTermIndexPage.url}}" stepKey="openAdminCatalogSearchTermIndexPage"/> <waitForPageLoad stepKey="waitForAdminCatalogSearchTermIndexPageLoad"/> <!-- Filter the search term --> - <comment userInput="Filter search term" stepKey="filterSearchTermComment"/> <actionGroup ref="AdminSearchTermFilterBySearchQueryActionGroup" stepKey="filterByThirdSearchQuery"> <argument name="searchQuery" value="{{ApiProductDescription.value}}"/> </actionGroup> <!-- Delete created below search terms --> - <comment userInput="Delete created below search terms" stepKey="deleteCreatedBelowSearchTermsComment"/> <actionGroup ref="AdminDeleteSearchTermActionGroup" stepKey="deleteSearchTerms"/> <actionGroup ref="logout" stepKey="logout"/> </after> <!-- Go to storefront home page --> - <comment userInput="Go to storefront home page" stepKey="goToStorefrontHomePageComment"/> <actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="openStoreFrontHomePage"/> <!-- Storefront quick search by product name --> - <comment userInput="Storefront quick search by product name" stepKey="storefrontQuickSearchByProductNameComment"/> <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="quickSearchByProductName"> <argument name="phrase" value="{{ApiProductDescription.value}}"/> </actionGroup> <!-- Verify search suggestions and select the suggestion from dropdown options --> - <comment userInput="Verify search suggestions and select the suggestion from dropdown options" stepKey="verifySearchSuggestionsComment"/> <actionGroup ref="StoreFrontSelectDropDownSearchSuggestionActionGroup" stepKey="seeDropDownSearchSuggestion"> <argument name="searchQuery" value="{{ApiProductDescription.value}}"/> </actionGroup> <!-- Assert Product storefront main page --> - <comment userInput="See product name" stepKey="seeProductNameComment"/> <actionGroup ref="StorefrontAssertProductNameOnProductMainPageActionGroup" stepKey="seeProductName"> <argument name="productName" value="$$simpleProduct.name$$"/> </actionGroup> <!-- Go to the catalog search term page --> - <comment userInput="Go to the catalog search term page" stepKey="goToSearchTermPageComment3"/> <amOnPage url="{{AdminCatalogSearchTermIndexPage.url}}" stepKey="openAdminCatalogSearchTermIndexPage"/> <waitForPageLoad stepKey="waitForAdminCatalogSearchTermIndexPageLoad"/> <!-- Filter the search term --> - <comment userInput="Filter search term" stepKey="filterSearchTermComment2"/> <actionGroup ref="AdminSearchTermFilterBySearchQueryActionGroup" stepKey="filterByThirdSearchQuery"> <argument name="searchQuery" value="{{ApiProductDescription.value}}"/> </actionGroup> <!-- Assert Search Term in grid --> - <comment userInput="Check is search term in grid or not" stepKey="isSearchTermInGridComment"/> <see stepKey="seeSearchTermInGrid" selector="{{AdminCatalogSearchTermIndexSection.gridRow}}" userInput="{{ApiProductDescription.value}}" /> <see selector="{{AdminCatalogSearchTermIndexSection.numberOfSearchTermResults}}" userInput="1" stepKey="seeNumberOfSearchTermResultInGrid"/> </test> From 81bc7680951d563e9a2f5b2f4e8a558d318d719d Mon Sep 17 00:00:00 2001 From: Joan He <johe@magento.com> Date: Thu, 16 Jan 2020 11:30:26 -0600 Subject: [PATCH 0860/1143] B2B-343: Stabilize Community PR --- lib/web/requirejs/domReady.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/web/requirejs/domReady.js b/lib/web/requirejs/domReady.js index d6eaa31187e60..60e6a793656c1 100644 --- a/lib/web/requirejs/domReady.js +++ b/lib/web/requirejs/domReady.js @@ -90,7 +90,7 @@ define(function () { //There is still a window.onload binding that should get fired if //DOMContentLoaded is missed. if (document.readyState !== "loading") { - pageLoaded(); + setTimeout(pageLoaded); } } @@ -126,4 +126,4 @@ define(function () { /** END OF PUBLIC API **/ return domReady; -}); \ No newline at end of file +}); From 07f0c70a4e0aab9bcd513a3a26de7925b7d529b9 Mon Sep 17 00:00:00 2001 From: Patrick McLain <pat@pmclain.com> Date: Thu, 16 Jan 2020 15:20:51 -0500 Subject: [PATCH 0861/1143] Static tests and additional test cases --- .../Adminhtml/Wysiwyg/Images/DeleteFiles.php | 14 ++++++++------ .../Adminhtml/Wysiwyg/Images/DeleteFilesTest.php | 4 ++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFiles.php b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFiles.php index 9327c51c3f761..fa873930aaade 100644 --- a/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFiles.php +++ b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFiles.php @@ -60,11 +60,15 @@ public function __construct( */ public function execute() { + $resultJson = $this->resultJsonFactory->create(); + + if (!$this->getRequest()->isPost()) { + $result = ['error' => true, 'message' => __('Wrong request.')]; + /** @var \Magento\Framework\Controller\Result\Json $resultJson */ + return $resultJson->setData($result); + } + try { - if (!$this->getRequest()->isPost()) { - //phpcs:ignore Magento2.Exceptions.DirectThrow - throw new \Exception('Wrong request.'); - } $files = $this->getRequest()->getParam('files'); /** @var $helper \Magento\Cms\Helper\Wysiwyg\Images */ @@ -90,8 +94,6 @@ public function execute() // phpcs:ignore Magento2.Exceptions.ThrowCatch } catch (\Exception $e) { $result = ['error' => true, 'message' => $e->getMessage()]; - /** @var \Magento\Framework\Controller\Result\Json $resultJson */ - $resultJson = $this->resultJsonFactory->create(); return $resultJson->setData($result); } diff --git a/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFilesTest.php b/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFilesTest.php index 98c3b3fd36ce7..c135a89a00bc7 100644 --- a/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFilesTest.php @@ -105,6 +105,10 @@ public function testExecute(string $filename) public function executeDataProvider(): array { return [ + ['name with spaces.jpg'], + ['name with, comma.jpg'], + ['name with* asterisk.jpg'], + ['name with[ bracket.jpg'], ['magento_small_image.jpg'], ['_.jpg'], [' - .jpg'], From 504bfe5f2f10c5003f6155c07bcb29bccf7bedc9 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky <firster@atwix.com> Date: Wed, 15 Jan 2020 17:42:23 +0200 Subject: [PATCH 0862/1143] magento/magento2#: Unit test for \Magento\AdminNotification\Observer\PredispatchAdminActionControllerObserver --- ...patchAdminActionControllerObserverTest.php | 134 ++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 app/code/Magento/AdminNotification/Test/Unit/Observer/PredispatchAdminActionControllerObserverTest.php diff --git a/app/code/Magento/AdminNotification/Test/Unit/Observer/PredispatchAdminActionControllerObserverTest.php b/app/code/Magento/AdminNotification/Test/Unit/Observer/PredispatchAdminActionControllerObserverTest.php new file mode 100644 index 0000000000000..3209572ab0d70 --- /dev/null +++ b/app/code/Magento/AdminNotification/Test/Unit/Observer/PredispatchAdminActionControllerObserverTest.php @@ -0,0 +1,134 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\AdminNotification\Test\Unit\Observer; + +use Magento\AdminNotification\Model\Feed; +use Magento\AdminNotification\Model\FeedFactory; +use Magento\AdminNotification\Observer\PredispatchAdminActionControllerObserver; +use Magento\Backend\Model\Auth\Session; +use Magento\Framework\Event\Observer; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +/** + * Test class for \Magento\AdminNotification\Observer\PredispatchAdminActionControllerObserver + */ +class PredispatchAdminActionControllerObserverTest extends TestCase +{ + private const STATUS_ADMIN_LOGGED_IN = true; + private const STATUS_ADMIN_IS_NOT_LOGGED = false; + + /** + * @var Session|MockObject + */ + private $backendAuthSessionMock; + + /** + * @var Feed|MockObject + */ + private $feedMock; + + /** + * @var FeedFactory|MockObject + */ + private $feedFactoryMock; + + /** + * Object Manager Instance + * + * @var ObjectManager + */ + private $objectManager; + + /** + * Testable Object + * + * @var PredispatchAdminActionControllerObserver + */ + private $observer; + + /** + * @var Observer|MockObject + */ + private $observerMock; + + /** + * @inheritdoc + */ + protected function setUp() : void + { + $this->objectManager = new ObjectManager($this); + $this->observerMock = $this->createMock(Observer::class); + + $this->backendAuthSessionMock = $this->getMockBuilder(Session::class) + ->disableOriginalConstructor() + ->setMethods(['isLoggedIn']) + ->getMock(); + + $this->feedMock = $this->getMockBuilder(Feed::class) + ->disableOriginalConstructor() + ->setMethods(['checkUpdate']) + ->getMock(); + + $this->feedFactoryMock = $this->getMockBuilder(FeedFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + + $this->observer = $this->objectManager->getObject( + PredispatchAdminActionControllerObserver::class, + [ + '_feedFactory' => $this->feedFactoryMock, + '_backendAuthSession' => $this->backendAuthSessionMock, + ] + ); + } + + /** + * Test observer when admin user is logged in + */ + public function testPredispatchObserverWhenAdminLoggedIn() + { + $this->backendAuthSessionMock + ->expects($this->once()) + ->method('isLoggedIn') + ->willReturn(self::STATUS_ADMIN_LOGGED_IN); + + $this->feedFactoryMock + ->expects($this->once()) + ->method('create') + ->willReturn($this->feedMock); + + $this->feedMock + ->expects($this->once()) + ->method('checkUpdate') + ->willReturn($this->feedMock); + + $this->observer->execute($this->observerMock); + } + + /** + * Test observer when admin user is not logged in + */ + public function testPredispatchObserverWhenAdminIsNotLoggedIn() + { + $this->backendAuthSessionMock + ->expects($this->once()) + ->method('isLoggedIn') + ->willReturn(self::STATUS_ADMIN_IS_NOT_LOGGED); + + $this->feedFactoryMock + ->expects($this->never()) + ->method('create'); + + $this->feedMock + ->expects($this->never()) + ->method('checkUpdate'); + + $this->observer->execute($this->observerMock); + } +} From d3dbceef5544a0fd7bb931669ed170112b915905 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 16 Jan 2020 22:51:36 +0100 Subject: [PATCH 0863/1143] Module Catalog: Blocks --- .../Block/Product/ProductList/Related.php | 53 +++++++------ .../Block/Product/ProductList/Upsell.php | 76 ++++++++++--------- 2 files changed, 68 insertions(+), 61 deletions(-) diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Related.php b/app/code/Magento/Catalog/Block/Product/ProductList/Related.php index 24811d61a7715..387fac770c5bc 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Related.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Related.php @@ -6,7 +6,15 @@ namespace Magento\Catalog\Block\Product\ProductList; +use Magento\Catalog\Block\Product\AbstractProduct; +use Magento\Catalog\Block\Product\Context; +use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\Product\Visibility as ProductVisibility; use Magento\Catalog\Model\ResourceModel\Product\Collection; +use Magento\Checkout\Model\ResourceModel\Cart as CartResourceModel; +use Magento\Checkout\Model\Session as CheckoutSession; +use Magento\Framework\DataObject\IdentityInterface; +use Magento\Framework\Module\Manager; use Magento\Framework\View\Element\AbstractBlock; /** @@ -16,8 +24,7 @@ * @SuppressWarnings(PHPMD.LongVariable) * @since 100.0.2 */ -class Related extends \Magento\Catalog\Block\Product\AbstractProduct implements - \Magento\Framework\DataObject\IdentityInterface +class Related extends AbstractProduct implements IdentityInterface { /** * @var Collection @@ -27,53 +34,50 @@ class Related extends \Magento\Catalog\Block\Product\AbstractProduct implements /** * Checkout session * - * @var \Magento\Checkout\Model\Session + * @var CheckoutSession */ protected $_checkoutSession; /** * Catalog product visibility * - * @var \Magento\Catalog\Model\Product\Visibility + * @var ProductVisibility */ protected $_catalogProductVisibility; /** * Checkout cart * - * @var \Magento\Checkout\Model\ResourceModel\Cart + * @var CartResourceModel */ protected $_checkoutCart; /** - * @var \Magento\Framework\Module\Manager + * @var Manager */ protected $moduleManager; /** - * @param \Magento\Catalog\Block\Product\Context $context - * @param \Magento\Checkout\Model\ResourceModel\Cart $checkoutCart - * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility - * @param \Magento\Checkout\Model\Session $checkoutSession - * @param \Magento\Framework\Module\Manager $moduleManager + * @param Context $context + * @param CartResourceModel $checkoutCart + * @param ProductVisibility $catalogProductVisibility + * @param CheckoutSession $checkoutSession + * @param Manager $moduleManager * @param array $data */ public function __construct( - \Magento\Catalog\Block\Product\Context $context, - \Magento\Checkout\Model\ResourceModel\Cart $checkoutCart, - \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, - \Magento\Checkout\Model\Session $checkoutSession, - \Magento\Framework\Module\Manager $moduleManager, + Context $context, + CartResourceModel $checkoutCart, + ProductVisibility $catalogProductVisibility, + CheckoutSession $checkoutSession, + Manager $moduleManager, array $data = [] ) { $this->_checkoutCart = $checkoutCart; $this->_catalogProductVisibility = $catalogProductVisibility; $this->_checkoutSession = $checkoutSession; $this->moduleManager = $moduleManager; - parent::__construct( - $context, - $data - ); + parent::__construct($context, $data); } /** @@ -84,7 +88,7 @@ public function __construct( protected function _prepareData() { $product = $this->getProduct(); - /* @var $product \Magento\Catalog\Model\Product */ + /* @var $product Product */ $this->_itemCollection = $product->getRelatedProductCollection()->addAttributeToSelect( 'required_options' @@ -139,12 +143,11 @@ public function getItems() */ public function getIdentities() { - $identities = []; + $identities = [[]]; foreach ($this->getItems() as $item) { - // phpcs:ignore Magento2.Performance.ForeachArrayMerge - $identities = array_merge($identities, $item->getIdentities()); + $identities[] = $item->getIdentities(); } - return $identities; + return array_merge(...$identities); } /** diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php b/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php index fa1beaf6e0ea8..cf7e992650e1f 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php @@ -6,7 +6,16 @@ namespace Magento\Catalog\Block\Product\ProductList; +use Magento\Catalog\Block\Product\AbstractProduct; +use Magento\Catalog\Block\Product\Context; +use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\Product\Visibility as ProductVisibility; use Magento\Catalog\Model\ResourceModel\Product\Collection; +use Magento\Checkout\Model\ResourceModel\Cart as CartResourceModel; +use Magento\Checkout\Model\Session as CheckoutSession; +use Magento\Framework\DataObject; +use Magento\Framework\DataObject\IdentityInterface; +use Magento\Framework\Module\Manager; /** * Catalog product upsell items block @@ -15,8 +24,7 @@ * @SuppressWarnings(PHPMD.LongVariable) * @since 100.0.2 */ -class Upsell extends \Magento\Catalog\Block\Product\AbstractProduct implements - \Magento\Framework\DataObject\IdentityInterface +class Upsell extends AbstractProduct implements IdentityInterface { /** * @var int @@ -24,7 +32,7 @@ class Upsell extends \Magento\Catalog\Block\Product\AbstractProduct implements protected $_columnCount = 4; /** - * @var \Magento\Framework\DataObject[] + * @var DataObject[] */ protected $_items; @@ -41,53 +49,50 @@ class Upsell extends \Magento\Catalog\Block\Product\AbstractProduct implements /** * Checkout session * - * @var \Magento\Checkout\Model\Session + * @var CheckoutSession */ protected $_checkoutSession; /** * Catalog product visibility * - * @var \Magento\Catalog\Model\Product\Visibility + * @var ProductVisibility */ protected $_catalogProductVisibility; /** * Checkout cart * - * @var \Magento\Checkout\Model\ResourceModel\Cart + * @var CartResourceModel */ protected $_checkoutCart; /** - * @var \Magento\Framework\Module\Manager + * @var Manager */ protected $moduleManager; /** - * @param \Magento\Catalog\Block\Product\Context $context - * @param \Magento\Checkout\Model\ResourceModel\Cart $checkoutCart - * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility - * @param \Magento\Checkout\Model\Session $checkoutSession - * @param \Magento\Framework\Module\Manager $moduleManager + * @param Context $context + * @param CartResourceModel $checkoutCart + * @param ProductVisibility $catalogProductVisibility + * @param CheckoutSession $checkoutSession + * @param Manager $moduleManager * @param array $data */ public function __construct( - \Magento\Catalog\Block\Product\Context $context, - \Magento\Checkout\Model\ResourceModel\Cart $checkoutCart, - \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, - \Magento\Checkout\Model\Session $checkoutSession, - \Magento\Framework\Module\Manager $moduleManager, + Context $context, + CartResourceModel $checkoutCart, + ProductVisibility $catalogProductVisibility, + CheckoutSession $checkoutSession, + Manager $moduleManager, array $data = [] ) { $this->_checkoutCart = $checkoutCart; $this->_catalogProductVisibility = $catalogProductVisibility; $this->_checkoutSession = $checkoutSession; $this->moduleManager = $moduleManager; - parent::__construct( - $context, - $data - ); + parent::__construct($context, $data); } /** @@ -98,7 +103,7 @@ public function __construct( protected function _prepareData() { $product = $this->getProduct(); - /* @var $product \Magento\Catalog\Model\Product */ + /* @var $product Product */ $this->_itemCollection = $product->getUpSellProductCollection()->setPositionOrder()->addStoreFilter(); if ($this->moduleManager->isEnabled('Magento_Checkout')) { $this->_addProductAttributesAndPrices($this->_itemCollection); @@ -153,7 +158,7 @@ public function getItemCollection() /** * Get collection items * - * @return \Magento\Framework\DataObject[] + * @return DataObject[] */ public function getItems() { @@ -181,8 +186,8 @@ public function getRowCount() */ public function setColumnCount($columns) { - if ((int) $columns > 0) { - $this->_columnCount = (int) $columns; + if ((int)$columns > 0) { + $this->_columnCount = (int)$columns; } return $this; } @@ -227,12 +232,12 @@ public function getIterableItem() * * @param string $type * @param int $limit - * @return \Magento\Catalog\Block\Product\ProductList\Upsell + * @return Upsell */ public function setItemLimit($type, $limit) { - if ((int) $limit > 0) { - $this->_itemLimits[$type] = (int) $limit; + if ((int)$limit > 0) { + $this->_itemLimits[$type] = (int)$limit; } return $this; } @@ -250,9 +255,9 @@ public function getItemLimit($type = '') } if (isset($this->_itemLimits[$type])) { return $this->_itemLimits[$type]; - } else { - return 0; } + + return 0; } /** @@ -262,11 +267,10 @@ public function getItemLimit($type = '') */ public function getIdentities() { - $identities = []; - foreach ($this->getItems() as $item) { - // phpcs:ignore Magento2.Performance.ForeachArrayMerge - $identities = array_merge($identities, $item->getIdentities()); - } - return $identities; + $identities = array_map(function (DataObject $item) { + return $item->getIdentities(); + }, $this->getItems()); + + return array_merge(...$identities); } } From 08608a611f21d763aa2ddd6b759ef9abd62f88b7 Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Fri, 17 Jan 2020 10:02:15 +0200 Subject: [PATCH 0864/1143] MC-30155: quote_item.applied_rule_ids not updated after disabling cart price rule --- .../Rule/RuleQuoteRecollectTotalsOnDemand.php | 52 ++++++++++++ .../Spi/RuleQuoteRecollectTotalsInterface.php | 23 ++++++ .../RuleQuoteRecollectTotalsObserver.php | 50 +++++++++++ app/code/Magento/SalesRule/etc/di.xml | 6 +- app/code/Magento/SalesRule/etc/events.xml | 6 ++ .../Api/GuestTotalsInformationManagement.php | 71 ++++++++++++++++ .../Api/TotalsInformationManagement.php | 82 +++++++++++++++++++ .../cart_rule_50_percent_off_no_condition.php | 38 +++++++++ ...e_50_percent_off_no_condition_rollback.php | 19 +++++ 9 files changed, 345 insertions(+), 2 deletions(-) create mode 100644 app/code/Magento/SalesRule/Model/Rule/RuleQuoteRecollectTotalsOnDemand.php create mode 100644 app/code/Magento/SalesRule/Model/Spi/RuleQuoteRecollectTotalsInterface.php create mode 100644 app/code/Magento/SalesRule/Observer/RuleQuoteRecollectTotalsObserver.php create mode 100644 dev/tests/api-functional/testsuite/Magento/SalesRule/Api/GuestTotalsInformationManagement.php create mode 100644 dev/tests/api-functional/testsuite/Magento/SalesRule/Api/TotalsInformationManagement.php create mode 100644 dev/tests/integration/testsuite/Magento/SalesRule/_files/cart_rule_50_percent_off_no_condition.php create mode 100644 dev/tests/integration/testsuite/Magento/SalesRule/_files/cart_rule_50_percent_off_no_condition_rollback.php diff --git a/app/code/Magento/SalesRule/Model/Rule/RuleQuoteRecollectTotalsOnDemand.php b/app/code/Magento/SalesRule/Model/Rule/RuleQuoteRecollectTotalsOnDemand.php new file mode 100644 index 0000000000000..b983a59d79c5e --- /dev/null +++ b/app/code/Magento/SalesRule/Model/Rule/RuleQuoteRecollectTotalsOnDemand.php @@ -0,0 +1,52 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\SalesRule\Model\Rule; + +use Magento\Quote\Model\ResourceModel\Quote; +use Magento\SalesRule\Model\Spi\RuleQuoteRecollectTotalsInterface; + +/** + * Forces related quotes to be recollected on demand. + */ +class RuleQuoteRecollectTotalsOnDemand implements RuleQuoteRecollectTotalsInterface +{ + /** + * @var Quote + */ + private $quoteResourceModel; + + /** + * Initializes dependencies + * + * @param Quote $quoteResourceModel + */ + public function __construct(Quote $quoteResourceModel) + { + $this->quoteResourceModel = $quoteResourceModel; + } + + /** + * Set "trigger_recollect" flag for active quotes which the given rule is applied to. + * + * @param int $ruleId + * @return void + */ + public function execute(int $ruleId): void + { + $this->quoteResourceModel->getConnection() + ->update( + $this->quoteResourceModel->getMainTable(), + ['trigger_recollect' => 1], + [ + 'is_active = ?' => 1, + 'FIND_IN_SET(?, applied_rule_ids)' => $ruleId + ] + ); + } +} diff --git a/app/code/Magento/SalesRule/Model/Spi/RuleQuoteRecollectTotalsInterface.php b/app/code/Magento/SalesRule/Model/Spi/RuleQuoteRecollectTotalsInterface.php new file mode 100644 index 0000000000000..e5562b22db6ca --- /dev/null +++ b/app/code/Magento/SalesRule/Model/Spi/RuleQuoteRecollectTotalsInterface.php @@ -0,0 +1,23 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\SalesRule\Model\Spi; + +/** + * Recollect totals for rule related quotes + */ +interface RuleQuoteRecollectTotalsInterface +{ + /** + * Recollect totals for rule related quotes. + * + * @param int $ruleId + * @return void + */ + public function execute(int $ruleId): void; +} diff --git a/app/code/Magento/SalesRule/Observer/RuleQuoteRecollectTotalsObserver.php b/app/code/Magento/SalesRule/Observer/RuleQuoteRecollectTotalsObserver.php new file mode 100644 index 0000000000000..c2d73d59c020b --- /dev/null +++ b/app/code/Magento/SalesRule/Observer/RuleQuoteRecollectTotalsObserver.php @@ -0,0 +1,50 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\SalesRule\Observer; + +use Magento\Framework\Event\Observer; +use Magento\Framework\Event\ObserverInterface; +use Magento\SalesRule\Model\Rule; +use Magento\SalesRule\Model\Spi\RuleQuoteRecollectTotalsInterface; + +/** + * Forces related quotes to be recollected for inactive rule. + */ +class RuleQuoteRecollectTotalsObserver implements ObserverInterface +{ + /** + * @var RuleQuoteRecollectTotalsInterface + */ + private $recollectTotals; + + /** + * Initializes dependencies + * + * @param RuleQuoteRecollectTotalsInterface $recollectTotals + */ + public function __construct(RuleQuoteRecollectTotalsInterface $recollectTotals) + { + $this->recollectTotals = $recollectTotals; + } + + /** + * Forces related quotes to be recollected, if the rule was disabled or deleted. + * + * @param Observer $observer + * @return void + */ + public function execute(Observer $observer): void + { + /** @var Rule $rule */ + $rule = $observer->getRule(); + if (!$rule->isObjectNew() && (!$rule->getIsActive() || $rule->isDeleted())) { + $this->recollectTotals->execute((int) $rule->getId()); + } + } +} diff --git a/app/code/Magento/SalesRule/etc/di.xml b/app/code/Magento/SalesRule/etc/di.xml index 4ba67e2fa5871..0e5fe6d29aed6 100644 --- a/app/code/Magento/SalesRule/etc/di.xml +++ b/app/code/Magento/SalesRule/etc/di.xml @@ -13,7 +13,7 @@ <preference for="Magento\SalesRule\Api\Data\ConditionInterface" type="Magento\SalesRule\Model\Data\Condition" /> <preference for="Magento\SalesRule\Api\Data\RuleSearchResultInterface" - type="Magento\SalesRule\Model\RuleSearchResult" /> + type="Magento\Framework\Api\SearchResults" /> <preference for="Magento\SalesRule\Api\Data\RuleLabelInterface" type="Magento\SalesRule\Model\Data\RuleLabel" /> <preference for="Magento\SalesRule\Api\Data\CouponInterface" @@ -23,7 +23,7 @@ <preference for="Magento\SalesRule\Model\Spi\CouponResourceInterface" type="Magento\SalesRule\Model\ResourceModel\Coupon" /> <preference for="Magento\SalesRule\Api\Data\CouponSearchResultInterface" - type="Magento\SalesRule\Model\CouponSearchResult" /> + type="Magento\Framework\Api\SearchResults" /> <preference for="Magento\SalesRule\Api\Data\CouponGenerationSpecInterface" type="Magento\SalesRule\Model\Data\CouponGenerationSpec" /> <preference for="Magento\SalesRule\Api\Data\CouponMassDeleteResultInterface" @@ -34,6 +34,8 @@ type="Magento\SalesRule\Model\Data\RuleDiscount" /> <preference for="Magento\SalesRule\Api\Data\DiscountDataInterface" type="Magento\SalesRule\Model\Data\DiscountData" /> + <preference for="Magento\SalesRule\Model\Spi\RuleQuoteRecollectTotalsInterface" + type="\Magento\SalesRule\Model\Rule\RuleQuoteRecollectTotalsOnDemand" /> <type name="Magento\SalesRule\Helper\Coupon"> <arguments> <argument name="couponParameters" xsi:type="array"> diff --git a/app/code/Magento/SalesRule/etc/events.xml b/app/code/Magento/SalesRule/etc/events.xml index e421aafa96b55..5f899fb0cca5c 100644 --- a/app/code/Magento/SalesRule/etc/events.xml +++ b/app/code/Magento/SalesRule/etc/events.xml @@ -30,4 +30,10 @@ <event name="sales_quote_address_collect_totals_before"> <observer name="coupon_code_validation" instance="Magento\SalesRule\Observer\CouponCodeValidation" /> </event> + <event name="salesrule_rule_save_after"> + <observer name="salesrule_quote_recollect_totals_on_disabled" instance="\Magento\SalesRule\Observer\RuleQuoteRecollectTotalsObserver" /> + </event> + <event name="salesrule_rule_delete_after"> + <observer name="salesrule_quote_recollect_totals_on_delete" instance="\Magento\SalesRule\Observer\RuleQuoteRecollectTotalsObserver" /> + </event> </config> diff --git a/dev/tests/api-functional/testsuite/Magento/SalesRule/Api/GuestTotalsInformationManagement.php b/dev/tests/api-functional/testsuite/Magento/SalesRule/Api/GuestTotalsInformationManagement.php new file mode 100644 index 0000000000000..2057a97087fff --- /dev/null +++ b/dev/tests/api-functional/testsuite/Magento/SalesRule/Api/GuestTotalsInformationManagement.php @@ -0,0 +1,71 @@ +<?php +/** + * + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\SalesRule\Api; + +use Magento\Framework\Webapi\Rest\Request; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\TestCase\WebapiAbstract; + +/** + * Tests disabled cart rules for guest's cart + */ +class GuestTotalsInformationManagement extends WebapiAbstract +{ + private const SERVICE_OPERATION = 'calculate'; + private const SERVICE_NAME = 'checkoutGuestTotalsInformationManagementV1'; + private const SERVICE_VERSION = 'V1'; + private const RESOURCE_PATH = '/V1/guest-carts/:cartId/totals-information'; + private const QUOTE_RESERVED_ORDER_ID = 'test01'; + private const SALES_RULE_ID = 'Magento/SalesRule/_files/cart_rule_50_percent_off_no_condition/salesRuleId'; + + /** + * Test sales rule changes should be persisted in the database + * + * @magentoApiDataFixture Magento/SalesRule/_files/cart_rule_50_percent_off_no_condition.php + * @magentoApiDataFixture Magento/Sales/_files/quote.php + */ + public function testCalculate() + { + /** @var \Magento\Quote\Model\Quote $quote */ + /** @var \Magento\Quote\Model\QuoteIdMask $quoteIdMask */ + /** @var \Magento\SalesRule\Model\Rule $salesRule */ + /** @var \Magento\Framework\Registry $registry */ + $registry = Bootstrap::getObjectManager()->get(\Magento\Framework\Registry::class); + $quote = Bootstrap::getObjectManager()->get(\Magento\Quote\Model\QuoteFactory::class)->create(); + $quote->load(self::QUOTE_RESERVED_ORDER_ID, 'reserved_order_id'); + $quoteIdMask = Bootstrap::getObjectManager()->get(\Magento\Quote\Model\QuoteIdMaskFactory::class)->create(); + $quoteIdMask->load($quote->getId(), 'quote_id'); + $salesRuleId = $registry->registry(self::SALES_RULE_ID); + $salesRule = Bootstrap::getObjectManager()->create(\Magento\SalesRule\Model\RuleFactory::class)->create(); + $salesRule->load($salesRuleId); + $this->assertContains($salesRule->getRuleId(), str_getcsv($quote->getAppliedRuleIds())); + $salesRule->setIsActive(0); + $salesRule->save(); + $response = $this->_webApiCall( + [ + 'rest' => [ + 'resourcePath' => str_replace(':cartId', $quoteIdMask->getMaskedId(), self::RESOURCE_PATH), + 'httpMethod' => Request::HTTP_METHOD_POST, + ], + 'soap' => [ + 'service' => self::SERVICE_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => self::SERVICE_NAME . self::SERVICE_OPERATION, + ], + ], + [ + 'addressInformation' => [ + 'address' => [] + ] + ] + ); + $this->assertNotEmpty($response); + $quote->load(self::QUOTE_RESERVED_ORDER_ID, 'reserved_order_id'); + $this->assertNotContains($salesRule->getId(), str_getcsv($quote->getAppliedRuleIds())); + } +} diff --git a/dev/tests/api-functional/testsuite/Magento/SalesRule/Api/TotalsInformationManagement.php b/dev/tests/api-functional/testsuite/Magento/SalesRule/Api/TotalsInformationManagement.php new file mode 100644 index 0000000000000..6bde30b9acab4 --- /dev/null +++ b/dev/tests/api-functional/testsuite/Magento/SalesRule/Api/TotalsInformationManagement.php @@ -0,0 +1,82 @@ +<?php +/** + * + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\SalesRule\Api; + +use Magento\Framework\Webapi\Rest\Request; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\TestCase\WebapiAbstract; + +/** + * Tests disabled cart rules for customer's cart + */ +class TotalsInformationManagement extends WebapiAbstract +{ + private const SERVICE_OPERATION = 'calculate'; + private const SERVICE_NAME = 'checkoutTotalsInformationManagementV1'; + private const SERVICE_VERSION = 'V1'; + private const RESOURCE_PATH = '/V1/carts/mine/totals-information'; + private const QUOTE_RESERVED_ORDER_ID = 'test01'; + private const SALES_RULE_ID = 'Magento/SalesRule/_files/cart_rule_50_percent_off_no_condition/salesRuleId'; + private const CUSTOMER_EMAIL = 'customer@example.com'; + private const CUSTOMER_PASSWORD = 'password'; + + /** + * Test sales rule changes should be persisted in the database + * + * @magentoApiDataFixture Magento/SalesRule/_files/cart_rule_50_percent_off_no_condition.php + * @magentoApiDataFixture Magento/Sales/_files/quote_with_customer.php + */ + public function testCalculate() + { + /** @var \Magento\Quote\Model\Quote $quote */ + /** @var \Magento\Quote\Model\QuoteIdMask $quoteIdMask */ + /** @var \Magento\SalesRule\Model\Rule $salesRule */ + /** @var \Magento\Framework\Registry $registry */ + $registry = Bootstrap::getObjectManager()->get(\Magento\Framework\Registry::class); + $quote = Bootstrap::getObjectManager()->get(\Magento\Quote\Model\QuoteFactory::class)->create(); + $quote->load(self::QUOTE_RESERVED_ORDER_ID, 'reserved_order_id'); + $quoteIdMask = Bootstrap::getObjectManager()->get(\Magento\Quote\Model\QuoteIdMaskFactory::class)->create(); + $quoteIdMask->load($quote->getId(), 'quote_id'); + $salesRuleId = $registry->registry(self::SALES_RULE_ID); + $salesRule = Bootstrap::getObjectManager()->create(\Magento\SalesRule\Model\RuleFactory::class)->create(); + $salesRule->load($salesRuleId); + $this->assertContains($salesRule->getRuleId(), str_getcsv($quote->getAppliedRuleIds())); + $salesRule->setIsActive(0); + $salesRule->save(); + $response = $this->_webApiCall( + [ + 'rest' => [ + 'resourcePath' => self::RESOURCE_PATH, + 'httpMethod' => Request::HTTP_METHOD_POST, + 'token' => Bootstrap::getObjectManager() + ->create( + \Magento\Integration\Api\CustomerTokenServiceInterface::class + ) + ->createCustomerAccessToken( + self::CUSTOMER_EMAIL, + self::CUSTOMER_PASSWORD + ) + ], + 'soap' => [ + 'service' => self::SERVICE_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => self::SERVICE_NAME . self::SERVICE_OPERATION, + ], + ], + [ + 'cartId' => $quote->getId(), + 'addressInformation' => [ + 'address' => [] + ] + ] + ); + $this->assertNotEmpty($response); + $quote->load(self::QUOTE_RESERVED_ORDER_ID, 'reserved_order_id'); + $this->assertNotContains($salesRule->getId(), str_getcsv($quote->getAppliedRuleIds())); + } +} diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/_files/cart_rule_50_percent_off_no_condition.php b/dev/tests/integration/testsuite/Magento/SalesRule/_files/cart_rule_50_percent_off_no_condition.php new file mode 100644 index 0000000000000..77178abdb2384 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/SalesRule/_files/cart_rule_50_percent_off_no_condition.php @@ -0,0 +1,38 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +/** @var \Magento\Framework\Registry $registry */ +/** @var \Magento\SalesRule\Model\Rule $salesRule */ +/** @var \Magento\SalesRule\Model\RuleRepository $salesRuleRepository */ + +$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); +$registry = $objectManager->get(\Magento\Framework\Registry::class); +$salesRule = $objectManager->create(\Magento\SalesRule\Model\Rule::class); +$salesRuleRepository = $objectManager->create(\Magento\SalesRule\Model\RuleRepository::class); +$allRules = $salesRuleRepository->getList($objectManager->get(\Magento\Framework\Api\SearchCriteriaInterface::class)); +foreach ($allRules->getItems() as $rule) { + $salesRuleRepository->deleteById($rule->getRuleId()); +} +$salesRule->setData( + [ + 'name' => '50% off - July 4', + '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' => 50, + 'discount_step' => 0, + 'stop_rules_processing' => 1, + 'website_ids' => [ + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + \Magento\Store\Model\StoreManagerInterface::class + )->getWebsite()->getId() + ] + ] +); +$salesRule->save(); + +$registry->unregister('Magento/SalesRule/_files/cart_rule_50_percent_off_no_condition/salesRuleId'); +$registry->register('Magento/SalesRule/_files/cart_rule_50_percent_off_no_condition/salesRuleId', $salesRule->getId()); diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/_files/cart_rule_50_percent_off_no_condition_rollback.php b/dev/tests/integration/testsuite/Magento/SalesRule/_files/cart_rule_50_percent_off_no_condition_rollback.php new file mode 100644 index 0000000000000..bafaf1a48f960 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/SalesRule/_files/cart_rule_50_percent_off_no_condition_rollback.php @@ -0,0 +1,19 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +/** @var \Magento\Framework\Registry $registry */ +/** @var \Magento\SalesRule\Model\Rule $salesRule */ +$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); +$registry = $objectManager->get(\Magento\Framework\Registry::class); +$salesRule = $objectManager->create(\Magento\SalesRule\Model\Rule::class); +$salesRuleId = $registry->registry('Magento/SalesRule/_files/cart_rule_50_percent_off_no_condition/salesRuleId'); +if ($salesRuleId) { + $salesRule->load($salesRuleId); + if ($salesRule->getId()) { + $salesRule->delete(); + } +} From b1d69cb1f864e756538a7579ba286f1a12367e19 Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Fri, 17 Jan 2020 10:08:20 +0200 Subject: [PATCH 0865/1143] MC-30258: [On Pre] Multi Shipping Checkout Terms and Conditions Manual Check Fails Validation. --- .../Model/Checkout/Plugin/Validation.php | 30 ++++++++++--- .../Model/Checkout/Plugin/ValidationTest.php | 44 ++++++++++++++++++- 2 files changed, 67 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/CheckoutAgreements/Model/Checkout/Plugin/Validation.php b/app/code/Magento/CheckoutAgreements/Model/Checkout/Plugin/Validation.php index 67e2a6c9ec334..5722099435118 100644 --- a/app/code/Magento/CheckoutAgreements/Model/Checkout/Plugin/Validation.php +++ b/app/code/Magento/CheckoutAgreements/Model/Checkout/Plugin/Validation.php @@ -7,11 +7,12 @@ namespace Magento\CheckoutAgreements\Model\Checkout\Plugin; use Magento\CheckoutAgreements\Model\AgreementsProvider; -use Magento\Store\Model\ScopeInterface; use Magento\CheckoutAgreements\Model\Api\SearchCriteria\ActiveStoreAgreementsFilter; +use Magento\Quote\Api\CartRepositoryInterface; +use Magento\Store\Model\ScopeInterface; /** - * Class Validation + * Class Validation validates the agreement based on the payment method */ class Validation { @@ -35,25 +36,37 @@ class Validation */ private $activeStoreAgreementsFilter; + /** + * Quote repository. + * + * @var \Magento\Quote\Api\CartRepositoryInterface + */ + private $quoteRepository; + /** * @param \Magento\Checkout\Api\AgreementsValidatorInterface $agreementsValidator * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfiguration * @param \Magento\CheckoutAgreements\Api\CheckoutAgreementsListInterface $checkoutAgreementsList * @param ActiveStoreAgreementsFilter $activeStoreAgreementsFilter + * @param CartRepositoryInterface $quoteRepository */ public function __construct( \Magento\Checkout\Api\AgreementsValidatorInterface $agreementsValidator, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfiguration, \Magento\CheckoutAgreements\Api\CheckoutAgreementsListInterface $checkoutAgreementsList, - \Magento\CheckoutAgreements\Model\Api\SearchCriteria\ActiveStoreAgreementsFilter $activeStoreAgreementsFilter + \Magento\CheckoutAgreements\Model\Api\SearchCriteria\ActiveStoreAgreementsFilter $activeStoreAgreementsFilter, + CartRepositoryInterface $quoteRepository ) { $this->agreementsValidator = $agreementsValidator; $this->scopeConfiguration = $scopeConfiguration; $this->checkoutAgreementsList = $checkoutAgreementsList; $this->activeStoreAgreementsFilter = $activeStoreAgreementsFilter; + $this->quoteRepository = $quoteRepository; } /** + * Check validation before saving the payment information and place order + * * @param \Magento\Checkout\Api\PaymentInformationManagementInterface $subject * @param int $cartId * @param \Magento\Quote\Api\Data\PaymentInterface $paymentMethod @@ -74,13 +87,16 @@ public function beforeSavePaymentInformationAndPlaceOrder( } /** + * Check validation before saving the payment information + * * @param \Magento\Checkout\Api\PaymentInformationManagementInterface $subject * @param int $cartId * @param \Magento\Quote\Api\Data\PaymentInterface $paymentMethod * @param \Magento\Quote\Api\Data\AddressInterface|null $billingAddress - * @throws \Magento\Framework\Exception\CouldNotSaveException * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @throws \Magento\Framework\Exception\NoSuchEntityException + * @throws \Magento\Framework\Exception\CouldNotSaveException */ public function beforeSavePaymentInformation( \Magento\Checkout\Api\PaymentInformationManagementInterface $subject, @@ -88,12 +104,15 @@ public function beforeSavePaymentInformation( \Magento\Quote\Api\Data\PaymentInterface $paymentMethod, \Magento\Quote\Api\Data\AddressInterface $billingAddress = null ) { - if ($this->isAgreementEnabled()) { + $quote = $this->quoteRepository->getActive($cartId); + if ($this->isAgreementEnabled() && !$quote->getIsMultiShipping()) { $this->validateAgreements($paymentMethod); } } /** + * Validate agreements base on the payment method + * * @param \Magento\Quote\Api\Data\PaymentInterface $paymentMethod * @throws \Magento\Framework\Exception\CouldNotSaveException * @return void @@ -116,6 +135,7 @@ protected function validateAgreements(\Magento\Quote\Api\Data\PaymentInterface $ /** * Verify if agreement validation needed + * * @return bool */ protected function isAgreementEnabled() diff --git a/app/code/Magento/CheckoutAgreements/Test/Unit/Model/Checkout/Plugin/ValidationTest.php b/app/code/Magento/CheckoutAgreements/Test/Unit/Model/Checkout/Plugin/ValidationTest.php index 7f11fad202401..db8469f34af62 100644 --- a/app/code/Magento/CheckoutAgreements/Test/Unit/Model/Checkout/Plugin/ValidationTest.php +++ b/app/code/Magento/CheckoutAgreements/Test/Unit/Model/Checkout/Plugin/ValidationTest.php @@ -10,7 +10,7 @@ use Magento\Store\Model\ScopeInterface; /** - * Class ValidationTest + * Class ValidationTest validates the agreement based on the payment method * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class ValidationTest extends \PHPUnit\Framework\TestCase @@ -60,12 +60,24 @@ class ValidationTest extends \PHPUnit\Framework\TestCase */ private $agreementsFilterMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + private $quoteMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + private $quoteRepositoryMock; + protected function setUp() { $this->agreementsValidatorMock = $this->createMock(\Magento\Checkout\Api\AgreementsValidatorInterface::class); $this->subjectMock = $this->createMock(\Magento\Checkout\Api\PaymentInformationManagementInterface::class); $this->paymentMock = $this->createMock(\Magento\Quote\Api\Data\PaymentInterface::class); $this->addressMock = $this->createMock(\Magento\Quote\Api\Data\AddressInterface::class); + $this->quoteMock = $this->createPartialMock(\Magento\Quote\Model\Quote::class, ['getIsMultiShipping']); + $this->quoteRepositoryMock = $this->createMock(\Magento\Quote\Api\CartRepositoryInterface::class); $this->extensionAttributesMock = $this->createPartialMock( \Magento\Quote\Api\Data\PaymentExtension::class, ['getAgreementIds'] @@ -82,7 +94,8 @@ protected function setUp() $this->agreementsValidatorMock, $this->scopeConfigMock, $this->checkoutAgreementsListMock, - $this->agreementsFilterMock + $this->agreementsFilterMock, + $this->quoteRepositoryMock ); } @@ -96,6 +109,15 @@ public function testBeforeSavePaymentInformationAndPlaceOrder() ->with(AgreementsProvider::PATH_ENABLED, ScopeInterface::SCOPE_STORE) ->willReturn(true); $searchCriteriaMock = $this->createMock(\Magento\Framework\Api\SearchCriteria::class); + $this->quoteMock + ->expects($this->once()) + ->method('getIsMultiShipping') + ->willReturn(false); + $this->quoteRepositoryMock + ->expects($this->once()) + ->method('getActive') + ->with($cartId) + ->willReturn($this->quoteMock); $this->agreementsFilterMock->expects($this->once()) ->method('buildSearchCriteria') ->willReturn($searchCriteriaMock); @@ -124,6 +146,15 @@ public function testBeforeSavePaymentInformationAndPlaceOrderIfAgreementsNotVali ->with(AgreementsProvider::PATH_ENABLED, ScopeInterface::SCOPE_STORE) ->willReturn(true); $searchCriteriaMock = $this->createMock(\Magento\Framework\Api\SearchCriteria::class); + $this->quoteMock + ->expects($this->once()) + ->method('getIsMultiShipping') + ->willReturn(false); + $this->quoteRepositoryMock + ->expects($this->once()) + ->method('getActive') + ->with($cartId) + ->willReturn($this->quoteMock); $this->agreementsFilterMock->expects($this->once()) ->method('buildSearchCriteria') ->willReturn($searchCriteriaMock); @@ -152,6 +183,15 @@ public function testBeforeSavePaymentInformation() ->method('isSetFlag') ->with(AgreementsProvider::PATH_ENABLED, ScopeInterface::SCOPE_STORE) ->willReturn(true); + $this->quoteMock + ->expects($this->once()) + ->method('getIsMultiShipping') + ->willReturn(false); + $this->quoteRepositoryMock + ->expects($this->once()) + ->method('getActive') + ->with($cartId) + ->willReturn($this->quoteMock); $searchCriteriaMock = $this->createMock(\Magento\Framework\Api\SearchCriteria::class); $this->agreementsFilterMock->expects($this->once()) ->method('buildSearchCriteria') From 2481c0bd065488d75f23a7f3769a0c7bc2cfecc1 Mon Sep 17 00:00:00 2001 From: OlgaVasyltsun <olga.vasyltsun@gmail.com> Date: Fri, 17 Jan 2020 11:06:00 +0200 Subject: [PATCH 0866/1143] MC-29047: Fix MFTF test --- ...ml => StorefrontOpenProductFromCategoryPageActionGroup.xml} | 2 +- ...yConfigurableProductChildAssignedToSeparateCategoryTest.xml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) rename app/code/Magento/Catalog/Test/Mftf/ActionGroup/{StorefrontCategoryPageOpenProductActionGroup.xml => StorefrontOpenProductFromCategoryPageActionGroup.xml} (91%) diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryPageOpenProductActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontOpenProductFromCategoryPageActionGroup.xml similarity index 91% rename from app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryPageOpenProductActionGroup.xml rename to app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontOpenProductFromCategoryPageActionGroup.xml index 86ce7a602315d..39bffe006d987 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryPageOpenProductActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontOpenProductFromCategoryPageActionGroup.xml @@ -7,7 +7,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="StorefrontCategoryPageOpenProductActionGroup"> + <actionGroup name="StorefrontOpenProductFromCategoryPageActionGroup"> <annotations> <description>Click on the provided product on category page.</description> </annotations> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontShouldSeeOnlyConfigurableProductChildAssignedToSeparateCategoryTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontShouldSeeOnlyConfigurableProductChildAssignedToSeparateCategoryTest.xml index 5f2fc5c8caca7..56e5bedc9eab1 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontShouldSeeOnlyConfigurableProductChildAssignedToSeparateCategoryTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontShouldSeeOnlyConfigurableProductChildAssignedToSeparateCategoryTest.xml @@ -17,6 +17,7 @@ <severity value="CRITICAL"/> <testCaseId value="MC-25651"/> <group value="configurable_product"/> + <group value="catalog"/> </annotations> <before> <!-- Create the category --> @@ -123,7 +124,7 @@ <actionGroup ref="StorefrontCheckProductIsMissingInCategoryProductsPageActionGroup" stepKey="dontSeeParentProduct"> <argument name="productName" value="$$createConfigProduct.name$$"/> </actionGroup> - <actionGroup ref="StorefrontCategoryPageOpenProductActionGroup" stepKey="openConfigChildProductFromCategoryPage"> + <actionGroup ref="StorefrontOpenProductFromCategoryPageActionGroup" stepKey="openConfigChildProductFromCategoryPage"> <argument name="productName" value="$$createConfigChildProduct1.name$$"/> </actionGroup> <actionGroup ref="AssertStorefrontProductDetailPageNameAndUrlActionGroup" stepKey="checkStorefrontConfigChildProductPage"> From 346678c02b589a4ec975fd393629a16e7aa0cedc Mon Sep 17 00:00:00 2001 From: "rostyslav.hymon" <rostyslav.hymon@transoftgroup.com> Date: Fri, 17 Jan 2020 11:11:13 +0200 Subject: [PATCH 0867/1143] MC-30313: Out of stock child of grouped product prevents other children to be added to cart --- .../Model/Product/Type/Grouped.php | 2 +- .../Unit/Model/Product/Type/GroupedTest.php | 198 +++++++++++++----- 2 files changed, 147 insertions(+), 53 deletions(-) diff --git a/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php b/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php index 187fd27fa0554..8eac8d0b0e163 100644 --- a/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php +++ b/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php @@ -344,7 +344,7 @@ protected function getProductInfo(\Magento\Framework\DataObject $buyRequest, $pr } foreach ($associatedProducts as $subProduct) { if (!isset($productsInfo[$subProduct->getId()])) { - if ($isStrictProcessMode && !$subProduct->getQty()) { + if ($isStrictProcessMode && !$subProduct->getQty() && $subProduct->isSalable()) { return __('Please specify the quantity of product(s).')->render(); } $productsInfo[$subProduct->getId()] = $subProduct->isSalable() ? (float)$subProduct->getQty() : 0; diff --git a/app/code/Magento/GroupedProduct/Test/Unit/Model/Product/Type/GroupedTest.php b/app/code/Magento/GroupedProduct/Test/Unit/Model/Product/Type/GroupedTest.php index e50d6491a6aca..b1f7905695b5d 100644 --- a/app/code/Magento/GroupedProduct/Test/Unit/Model/Product/Type/GroupedTest.php +++ b/app/code/Magento/GroupedProduct/Test/Unit/Model/Product/Type/GroupedTest.php @@ -54,9 +54,7 @@ protected function setUp() $productFactoryMock = $this->createMock(\Magento\Catalog\Model\ProductFactory::class); $this->catalogProductLink = $this->createMock(\Magento\GroupedProduct\Model\ResourceModel\Product\Link::class); $this->productStatusMock = $this->createMock(\Magento\Catalog\Model\Product\Attribute\Source\Status::class); - $this->serializer = $this->getMockBuilder(\Magento\Framework\Serialize\Serializer\Json::class) - ->setMethods(['serialize']) - ->getMockForAbstractClass(); + $this->serializer = $this->objectHelper->getObject(\Magento\Framework\Serialize\Serializer\Json::class); $this->_model = $this->objectHelper->getObject( \Magento\GroupedProduct\Model\Product\Type\Grouped::class, @@ -419,9 +417,6 @@ public function testPrepareForCartAdvancedNoProductsStrictFalse() ->expects($this->atLeastOnce()) ->method('getData') ->will($this->returnValue($associatedProducts)); - $this->serializer->expects($this->any()) - ->method('serialize') - ->willReturn(json_encode($buyRequest->getData())); $this->assertEquals( [0 => $this->product], @@ -521,10 +516,6 @@ public function testPrepareForCartAdvancedWithProductsStrictFalse() $buyRequest = new \Magento\Framework\DataObject(); $buyRequest->setSuperGroup([$associatedId => 1]); - $this->serializer->expects($this->any()) - ->method('serialize') - ->willReturn(json_encode($buyRequest->getData())); - $cached = true; $this->product ->expects($this->atLeastOnce()) @@ -541,49 +532,36 @@ public function testPrepareForCartAdvancedWithProductsStrictFalse() ); } - public function testPrepareForCartAdvancedWithProductsStrictTrue() - { - $associatedProduct = $this->createMock(\Magento\Catalog\Model\Product::class); - $associatedId = 9384; - $associatedProduct->expects($this->atLeastOnce())->method('getId')->will($this->returnValue($associatedId)); - - $typeMock = $this->createPartialMock( - \Magento\Catalog\Model\Product\Type\AbstractType::class, - ['_prepareProduct', 'deleteTypeSpecificData'] - ); - $associatedPrepareResult = $this->getMockBuilder(\Magento\Catalog\Model\Product::class) - ->setMockClassName('resultProduct') - ->disableOriginalConstructor() - ->getMock(); - $typeMock->expects($this->once())->method('_prepareProduct')->willReturn([$associatedPrepareResult]); - - $associatedProduct->expects($this->once())->method('getTypeInstance')->willReturn($typeMock); - - $buyRequest = new \Magento\Framework\DataObject(); - $buyRequest->setSuperGroup([$associatedId => 1]); - - $this->serializer->expects($this->any()) - ->method('serialize') - ->willReturn(json_encode($buyRequest->getData())); - - $cached = true; - $this->product - ->expects($this->atLeastOnce()) - ->method('hasData') - ->will($this->returnValue($cached)); - $this->product - ->expects($this->atLeastOnce()) - ->method('getData') - ->will($this->returnValue([$associatedProduct])); - - $associatedPrepareResult->expects($this->at(1))->method('addCustomOption')->with( - 'product_type', - 'grouped', - $this->product - ); + /** + * Test prepareForCartAdvanced() method in full mode + * + * @dataProvider prepareForCartAdvancedWithProductsStrictTrueDataProvider + * @param array $subProducts + * @param array $buyRequest + * @param mixed $expectedResult + */ + public function testPrepareForCartAdvancedWithProductsStrictTrue( + array $subProducts, + array $buyRequest, + $expectedResult + ) { + $associatedProducts = $this->configureProduct($subProducts); + $buyRequestObject = new \Magento\Framework\DataObject(); + $buyRequestObject->setSuperGroup($buyRequest); + $associatedProductsById = []; + foreach ($associatedProducts as $associatedProduct) { + $associatedProductsById[$associatedProduct->getId()] = $associatedProduct; + } + if (is_array($expectedResult)) { + $expectedResultArray = $expectedResult; + $expectedResult = []; + foreach ($expectedResultArray as $id) { + $expectedResult[] = $associatedProductsById[$id]; + } + } $this->assertEquals( - [$associatedPrepareResult], - $this->_model->prepareForCartAdvanced($buyRequest, $this->product) + $expectedResult, + $this->_model->prepareForCartAdvanced($buyRequestObject, $this->product) ); } @@ -618,4 +596,120 @@ public function testFlushAssociatedProductsCache() ->willReturnSelf(); $this->assertEquals($productMock, $this->_model->flushAssociatedProductsCache($productMock)); } + + /** + * @return array + */ + public function prepareForCartAdvancedWithProductsStrictTrueDataProvider(): array + { + return [ + [ + [ + [ + 'getId' => 1, + 'getQty' => 100, + 'isSalable' => true + ], + [ + 'getId' => 2, + 'getQty' => 200, + 'isSalable' => true + ] + ], + [ + 1 => 2, + 2 => 1, + ], + [1, 2] + ], + [ + [ + [ + 'getId' => 1, + 'getQty' => 100, + 'isSalable' => true + ], + [ + 'getId' => 2, + 'getQty' => 0, + 'isSalable' => false + ] + ], + [ + 1 => 2, + ], + [1] + ], + [ + [ + [ + 'getId' => 1, + 'getQty' => 0, + 'isSalable' => true + ], + [ + 'getId' => 2, + 'getQty' => 0, + 'isSalable' => false + ] + ], + [ + ], + 'Please specify the quantity of product(s).' + ], + [ + [ + [ + 'getId' => 1, + 'getQty' => 0, + 'isSalable' => false + ], + [ + 'getId' => 2, + 'getQty' => 0, + 'isSalable' => false + ] + ], + [ + ], + 'Please specify the quantity of product(s).' + ] + ]; + } + + /** + * Configure sub-products of grouped product + * + * @param array $subProducts + * @return array + */ + private function configureProduct(array $subProducts): array + { + $associatedProducts = []; + foreach ($subProducts as $data) { + $associatedProduct = $this->createMock(\Magento\Catalog\Model\Product::class); + foreach ($data as $method => $value) { + $associatedProduct->method($method)->willReturn($value); + } + $associatedProducts[] = $associatedProduct; + + $typeMock = $this->createPartialMock( + \Magento\Catalog\Model\Product\Type\AbstractType::class, + ['_prepareProduct', 'deleteTypeSpecificData'] + ); + $typeMock->method('_prepareProduct')->willReturn([$associatedProduct]); + $associatedProduct->method('getTypeInstance')->willReturn($typeMock); + } + $this->product + ->expects($this->atLeastOnce()) + ->method('hasData') + ->with('_cache_instance_associated_products') + ->willReturn(true); + $this->product + ->expects($this->atLeastOnce()) + ->method('getData') + ->with('_cache_instance_associated_products') + ->willReturn($associatedProducts); + return $associatedProducts; + } } From 74ad5dd1ef05eab9d0b4fa26a1303f8ea3fa0c52 Mon Sep 17 00:00:00 2001 From: Karyna Tsymbal <k.tsymbal@atwix.com> Date: Fri, 17 Jan 2020 11:46:55 +0200 Subject: [PATCH 0868/1143] Unit Test for Magento\Sitemap\Model\Config\Backend\Priority --- .../Model/Config/Backend/PriorityTest.php | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 app/code/Magento/Sitemap/Test/Unit/Model/Config/Backend/PriorityTest.php diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/Config/Backend/PriorityTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/Config/Backend/PriorityTest.php new file mode 100644 index 0000000000000..eea98e0f966ee --- /dev/null +++ b/app/code/Magento/Sitemap/Test/Unit/Model/Config/Backend/PriorityTest.php @@ -0,0 +1,81 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sitemap\Test\Unit\Model\Config\Backend; + +use Magento\Sitemap\Model\Config\Backend\Priority; +use PHPUnit\Framework\MockObject\MockObject; + +/** + * Tests for @see Priority + */ +class PriorityTest extends \PHPUnit\Framework\TestCase +{ + /** + * @var Priority|MockObject + */ + private $priorityMock; + + /** + * @inheritDoc + */ + protected function setUp() + { + $this->priorityMock = $this->getMockBuilder(Priority::class) + ->disableOriginalConstructor() + ->setMethods(['getValue']) + ->getMock(); + } + + /** + * @param string $value + * @dataProvider dataProviderTestBeforeSaveValueCorrect + */ + public function testBeforeSave($value) + { + $this->priorityMock->expects($this->once()) + ->method('getValue') + ->willReturn($value); + + $this->assertSame($this->priorityMock, $this->priorityMock->beforeSave()); + } + + /** + * @param string $value + * @dataProvider dataProviderTestBeforeSaveValueOutOfRange + */ + public function testBeforeSaveValueOutOfRange($value) + { + $this->priorityMock->expects($this->once()) + ->method('getValue') + ->willReturn($value); + + $this->expectException(\Exception::class); + $this->expectExceptionMessage('The priority must be between 0 and 1.'); + + $this->priorityMock->beforeSave(); + } + + /** + * @return array + */ + public function dataProviderTestBeforeSaveValueCorrect() + { + return [ + ['0'], ['0.0'], ['0.5'], ['1'] + ]; + } + + /** + * @return array + */ + public function dataProviderTestBeforeSaveValueOutOfRange() + { + return [ + ['-1'], ['2'], ['nan'] + ]; + } +} From 162622f66cba3dc7cb45a2162384df967edd6542 Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Fri, 17 Jan 2020 12:50:05 +0200 Subject: [PATCH 0869/1143] MC-30510: [Integration] PaymentFailuresServiceTest::testHandlerWithCustomer is flaky --- .../Service/PaymentFailuresServiceTest.php | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Service/PaymentFailuresServiceTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Service/PaymentFailuresServiceTest.php index 383af7968e047..c85408f21819a 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Model/Service/PaymentFailuresServiceTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Service/PaymentFailuresServiceTest.php @@ -7,10 +7,12 @@ namespace Magento\Sales\Model\Service; +use Magento\Framework\Stdlib\DateTime\TimezoneInterface; use Magento\Quote\Api\CartRepositoryInterface; use Magento\Quote\Model\Quote; use Magento\Sales\Api\PaymentFailuresInterface; use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\MockObject\MockObject; /** * Tests \Magento\Sales\Api\PaymentFailuresInterface. @@ -28,10 +30,15 @@ class PaymentFailuresServiceTest extends \PHPUnit\Framework\TestCase private $quote; /** - * @var CartRepositoryInterface|\PHPUnit_Framework_MockObject_MockObject + * @var CartRepositoryInterface|MockObject */ private $cartRepositoryMock; + /** + * @var TimezoneInterface|MockObject + */ + private $localeDateMock; + /** * @inheritdoc */ @@ -42,11 +49,15 @@ protected function setUp() ->disableOriginalConstructor() ->setMethods(['get']) ->getMockForAbstractClass(); + $this->localeDateMock = $this->getMockBuilder(TimezoneInterface::class) + ->setMethods(['formatDateTime']) + ->getMockForAbstractClass(); $this->paymentFailures = Bootstrap::getObjectManager()->create( PaymentFailuresInterface::class, [ 'cartRepository' => $this->cartRepositoryMock, + 'localeDate' => $this->localeDateMock, ] ); } @@ -69,20 +80,19 @@ public function testHandlerWithCustomer(): void ->with($this->quote->getId()) ->willReturn($this->quote); + $dateAndTime = 'Nov 22, 2019, 1:00:00 AM'; + $this->localeDateMock->expects($this->atLeastOnce())->method('formatDateTime')->willReturn($dateAndTime); $this->paymentFailures->handle((int)$this->quote->getId(), $errorMessage->render()); $paymentReflection = new \ReflectionClass($this->paymentFailures); - $templateTimeMethod = $paymentReflection->getMethod('getLocaleDate'); - $templateTimeMethod->setAccessible(true); - $templateVarsMethod = $paymentReflection->getMethod('getTemplateVars'); $templateVarsMethod->setAccessible(true); $templateVars = $templateVarsMethod->invoke($this->paymentFailures, $this->quote, $errorMessage, $checkoutType); $expectedVars = [ - 'reason' => $errorMessage, + 'reason' => $errorMessage->render(), 'checkoutType' => $checkoutType, - 'dateAndTime' => $templateTimeMethod->invoke($this->paymentFailures), + 'dateAndTime' => $dateAndTime, 'customer' => 'John Smith', 'customerEmail' => 'aaa@aaa.com', 'paymentMethod' => 'Some Title Of The Method', From fd3fc0ed50de0d057735e9abb2962513d3d54049 Mon Sep 17 00:00:00 2001 From: Karyna Tsymbal <k.tsymbal@atwix.com> Date: Fri, 17 Jan 2020 12:55:10 +0200 Subject: [PATCH 0870/1143] improve test name --- .../Sitemap/Test/Unit/Model/Config/Backend/PriorityTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/Config/Backend/PriorityTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/Config/Backend/PriorityTest.php index eea98e0f966ee..bba2429912cd8 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/Config/Backend/PriorityTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/Config/Backend/PriorityTest.php @@ -34,7 +34,7 @@ protected function setUp() * @param string $value * @dataProvider dataProviderTestBeforeSaveValueCorrect */ - public function testBeforeSave($value) + public function testBeforeSaveIsChainable($value) { $this->priorityMock->expects($this->once()) ->method('getValue') From 1df821646fbcb7a626a4705734132d982d895bba Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Fri, 17 Jan 2020 13:51:44 +0200 Subject: [PATCH 0871/1143] Static test fix --- .../Test/Unit/Model/Config/Backend/PriorityTest.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/Config/Backend/PriorityTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/Config/Backend/PriorityTest.php index bba2429912cd8..b819dfd343806 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/Config/Backend/PriorityTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/Config/Backend/PriorityTest.php @@ -31,6 +31,8 @@ protected function setUp() } /** + * Verify before save in chainable + * * @param string $value * @dataProvider dataProviderTestBeforeSaveValueCorrect */ @@ -44,6 +46,8 @@ public function testBeforeSaveIsChainable($value) } /** + * Verify before save value out of range + * * @param string $value * @dataProvider dataProviderTestBeforeSaveValueOutOfRange */ @@ -60,6 +64,8 @@ public function testBeforeSaveValueOutOfRange($value) } /** + * Data provider + * * @return array */ public function dataProviderTestBeforeSaveValueCorrect() @@ -70,6 +76,8 @@ public function dataProviderTestBeforeSaveValueCorrect() } /** + * Data provider + * * @return array */ public function dataProviderTestBeforeSaveValueOutOfRange() From dd6cccf6cbf7697c333847e904173e41a21a844e Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Fri, 17 Jan 2020 14:27:21 +0200 Subject: [PATCH 0872/1143] MC-24170: Fix Skipped MFTF Tests From MC-17140: MC-13493, MC-14062, MC-14063 --- ...iesAfterChangingUrlKeyForStoreViewAndMovingCategory2Test.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategory2Test.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategory2Test.xml index aa207c4c10cf3..e14bb5342db91 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategory2Test.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategory2Test.xml @@ -71,7 +71,7 @@ </actionGroup> <!-- Open first category storefront page --> - <amOnPage url="{{StorefrontCategoryPage.url($createFirstCategory.custom_attributes[url_path]$)}}" stepKey="openFirstCategoryStorefrontPage"/> + <amOnPage url="$createSecondCategory.custom_attributes[url_key]$/$createFirstCategory.custom_attributes[url_key]$.html" stepKey="openFirstCategoryStorefrontPage"/> <waitForPageLoad stepKey="waitForFirstCategoryStorefrontPageLoad"/> <see userInput="$createFirstSimpleProduct.name$" selector="{{StorefrontCategoryMainSection.productsList}}" stepKey="seeFirstProductInCategory"/> From 819c3f255224d7e2d04e90bcd47bb410a2eee23b Mon Sep 17 00:00:00 2001 From: Vaha <vaha@atwix.com> Date: Fri, 17 Jan 2020 14:31:45 +0200 Subject: [PATCH 0873/1143] #18012: added i18n wrapper to be used in underscore templates for translation --- lib/web/mage/translate.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/web/mage/translate.js b/lib/web/mage/translate.js index 65ec33266aebd..b96586ab9e927 100644 --- a/lib/web/mage/translate.js +++ b/lib/web/mage/translate.js @@ -6,8 +6,9 @@ define([ 'jquery', 'mage/mage', - 'mageTranslationDictionary' -], function ($, mage, dictionary) { + 'mageTranslationDictionary', + 'underscore' +], function ($, mage, dictionary, _) { 'use strict'; $.extend(true, $, { @@ -46,5 +47,12 @@ define([ }); $.mage.__ = $.proxy($.mage.translate.translate, $.mage.translate); + // Provide i18n wrapper to be used in underscore templates for translation + _.extend(_, { + i18n: function (str) { + return $.mage.__(str); + } + }); + return $.mage.__; }); From f3c0c6f7dacbf711f864e8e7764af916a25d47b3 Mon Sep 17 00:00:00 2001 From: Tjitse <Tjitse@vendic.nl> Date: Fri, 17 Jan 2020 13:37:49 +0100 Subject: [PATCH 0874/1143] Fix typo in sitemap product collection docblock --- .../Magento/Sitemap/Model/ResourceModel/Catalog/Product.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php b/app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php index 23a1c0fd09b7b..8b2154e6ee47a 100644 --- a/app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php +++ b/app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php @@ -291,7 +291,7 @@ protected function _getAttribute($attributeCode) } /** - * Get category collection array + * Get product collection array * * @param null|string|bool|int|Store $storeId * From d6eff7b04bbbfd20fbb71a793daef5c93edb998e Mon Sep 17 00:00:00 2001 From: Viktor Sevch <svitja@ukr.net> Date: Fri, 17 Jan 2020 16:53:44 +0200 Subject: [PATCH 0875/1143] MC-24168: Fix Skipped MFTF Tests From MC-17140: MAGETWO-95175, MAGETWO-97001, MAGETWO-98189 --- .../Catalog/Test/Mftf/Data/ConstData.xml | 2 + .../Section/AdminCategoryProductsSection.xml | 4 +- ...ateCategoryProductUrlRewriteConfigData.xml | 22 +++ ...OpenCreditMemoFromOrderPageActionGroup.xml | 20 +++ ...minOpenInvoiceFromOrderPageActionGroup.xml | 20 +++ ...inOpenShipmentFromOrderPageActionGroup.xml | 20 +++ ...eateCreditMemoFromOrderPageActionGroup.xml | 19 +++ ...rtAdminCreditMemoGrandTotalActionGroup.xml | 21 +++ .../Section/AdminOrderShipmentsTabSection.xml | 3 +- ...axRuleCustomProductTaxClassActionGroup.xml | 31 ++++ .../Tax/Test/Mftf/Data/TaxConfigData.xml | 6 + .../Mftf/Section/AdminTaxRulesSection.xml | 1 + .../Test/AdminCheckCreditMemoTotalsTest.xml | 91 +++++++++++ .../Mftf/Test/CheckCreditMemoTotalsTest.xml | 148 ------------------ 14 files changed, 258 insertions(+), 150 deletions(-) create mode 100644 app/code/Magento/CatalogUrlRewrite/Test/Mftf/Data/GenerateCategoryProductUrlRewriteConfigData.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOpenCreditMemoFromOrderPageActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOpenInvoiceFromOrderPageActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOpenShipmentFromOrderPageActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminStartToCreateCreditMemoFromOrderPageActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/AssertAdminCreditMemoGrandTotalActionGroup.xml create mode 100644 app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminCreateTaxRuleCustomProductTaxClassActionGroup.xml create mode 100644 app/code/Magento/Tax/Test/Mftf/Test/AdminCheckCreditMemoTotalsTest.xml delete mode 100644 app/code/Magento/Tax/Test/Mftf/Test/CheckCreditMemoTotalsTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/ConstData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/ConstData.xml index d09880f14afbf..f44bfb217d0ae 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Data/ConstData.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Data/ConstData.xml @@ -16,5 +16,7 @@ <entity name="prodNameWithSpecChars"> <data key="trademark">"Pursuit Lumaflex™ Tone Band"</data> <data key="skumark">"x™"</data> + <data key="trademark_without_quotes">Pursuit Lumaflex™ Tone Band</data> + <data key="skumark_without_quotes">x™</data> </entity> </entities> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryProductsSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryProductsSection.xml index 8a993a74a58d1..d89d9a5bd43c0 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryProductsSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryProductsSection.xml @@ -12,5 +12,7 @@ <element name="sectionHeader" type="button" selector="div[data-index='assign_products']" timeout="30"/> <element name="addProducts" type="button" selector="#catalog_category_add_product_tabs" timeout="30"/> <element name="addProductsDisabled" type="button" selector="#catalog_category_add_product_tabs[disabled]" timeout="30"/> + <element name="productsInCategorySectionTitle" type="text" selector="div[data-index='assign_products'] .fieldset-wrapper-title" timeout="10"/> + <element name="productsInCategorySectionBody" type="text" selector="div[data-index='assign_products'] .admin__fieldset-wrapper-content"/> </section> -</sections> \ No newline at end of file +</sections> diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Data/GenerateCategoryProductUrlRewriteConfigData.xml b/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Data/GenerateCategoryProductUrlRewriteConfigData.xml new file mode 100644 index 0000000000000..10d2213b64717 --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Data/GenerateCategoryProductUrlRewriteConfigData.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="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> + <entity name="EnableGenerateCategoryProductUrlRewritesConfigData"> + <!-- Default value --> + <data key="path">catalog/seo/generate_category_product_rewrites</data> + <data key="label">Yes</data> + <data key="value">1</data> + </entity> + <entity name="DisableGenerateCategoryProductUrlRewritesConfigData"> + <data key="path">catalog/seo/generate_category_product_rewrites</data> + <data key="label">No</data> + <data key="value">0</data> + </entity> +</entities> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOpenCreditMemoFromOrderPageActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOpenCreditMemoFromOrderPageActionGroup.xml new file mode 100644 index 0000000000000..fab25c7f40681 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOpenCreditMemoFromOrderPageActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminOpenCreditMemoFromOrderPageActionGroup"> + <annotations> + <description>Admin open creditmemo from order</description> + </annotations> + <conditionalClick selector="{{AdminOrderDetailsOrderViewSection.creditMemos}}" dependentSelector="{{AdminOrderCreditMemosTabSection.viewGridRow('1')}}" visible="false" stepKey="openCreditMemosTab"/> + <waitForElementVisible selector="{{AdminCreditMemoTotalSection.viewMemo}}" stepKey="waitForCreditMemosTabOpened"/> + <click selector="{{AdminOrderCreditMemosTabSection.viewGridRow('1')}}" stepKey="viewMemo"/> + <waitForPageLoad stepKey="waitForCreditMemoOpened"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOpenInvoiceFromOrderPageActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOpenInvoiceFromOrderPageActionGroup.xml new file mode 100644 index 0000000000000..ec4352c15e1a8 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOpenInvoiceFromOrderPageActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminOpenInvoiceFromOrderPageActionGroup"> + <annotations> + <description>Admin open invoice from order</description> + </annotations> + <conditionalClick selector="{{AdminOrderDetailsOrderViewSection.invoices}}" dependentSelector="{{AdminOrderInvoicesTabSection.viewInvoice}}" visible="false" stepKey="openInvoicesTab"/> + <waitForElementVisible selector="{{AdminOrderInvoicesTabSection.viewInvoice}}" stepKey="waitForInvocesTabOpened"/> + <click selector="{{AdminOrderInvoicesTabSection.viewGridRow('1')}}" stepKey="viewInvoice"/> + <waitForPageLoad stepKey="waitForInvoiceOpened"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOpenShipmentFromOrderPageActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOpenShipmentFromOrderPageActionGroup.xml new file mode 100644 index 0000000000000..1ed31b93cb075 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOpenShipmentFromOrderPageActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminOpenShipmentFromOrderPageActionGroup"> + <annotations> + <description>Admin open shipment from order</description> + </annotations> + <conditionalClick selector="{{AdminOrderDetailsOrderViewSection.shipments}}" dependentSelector="{{AdminOrderShipmentsTabSection.viewShipment}}" visible="false" stepKey="openShipmentsTab"/> + <waitForElementVisible selector="{{AdminOrderShipmentsTabSection.viewShipment}}" stepKey="waitForShipmentTabOpened"/> + <click selector="{{AdminOrderShipmentsTabSection.viewGridRow('1')}}" stepKey="viewShipment"/> + <waitForPageLoad stepKey="waitForShipmentOpened"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminStartToCreateCreditMemoFromOrderPageActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminStartToCreateCreditMemoFromOrderPageActionGroup.xml new file mode 100644 index 0000000000000..e5c29ac33294e --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminStartToCreateCreditMemoFromOrderPageActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminStartToCreateCreditMemoFromOrderPageActionGroup"> + <annotations> + <description>Admin start to create credit memo from order</description> + </annotations> + <click selector="{{AdminOrderDetailsMainActionsSection.creditMemo}}" stepKey="clickCreditMemo"/> + <waitForElementVisible selector="{{AdminHeaderSection.pageTitle}}" stepKey="waitForPageTitle"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Memo" stepKey="seeNewMemoPageTitle"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AssertAdminCreditMemoGrandTotalActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AssertAdminCreditMemoGrandTotalActionGroup.xml new file mode 100644 index 0000000000000..f318e76ce74a8 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AssertAdminCreditMemoGrandTotalActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertAdminCreditMemoGrandTotalActionGroup"> + <annotations> + <description>Admin assert creditmemo grant total sum</description> + </annotations> + <arguments> + <argument name="expectedGrandTotal" type="string" defaultValue="$123.00"/> + </arguments> + <grabTextFrom selector="{{AdminCreditMemoTotalSection.grandTotal}}" stepKey="getGrandTotal"/> + <assertEquals expected='{{expectedGrandTotal}}' actualType="variable" expectedType="string" actual="getGrandTotal" stepKey="assertGrandTotalValue"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderShipmentsTabSection.xml b/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderShipmentsTabSection.xml index e471fcfe18114..66bea45b83f3d 100644 --- a/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderShipmentsTabSection.xml +++ b/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderShipmentsTabSection.xml @@ -18,5 +18,6 @@ <element name="shipmentId" type="input" selector="//div[@id='sales_order_view_tabs_order_shipments_content']//input[@name='increment_id']" timeout="30"/> <element name="totalQtyFrom" type="input" selector="[name='total_qty[from]']" timeout="30"/> <element name="totalQtyTo" type="input" selector="[name='total_qty[to]']" timeout="30"/> + <element name="viewShipment" type="button" selector="#sales_order_view_tabs_order_shipments_content div.admin__data-grid-wrap a.action-menu-item" timeout="30"/> </section> -</sections> \ No newline at end of file +</sections> diff --git a/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminCreateTaxRuleCustomProductTaxClassActionGroup.xml b/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminCreateTaxRuleCustomProductTaxClassActionGroup.xml new file mode 100644 index 0000000000000..377985a81af37 --- /dev/null +++ b/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminCreateTaxRuleCustomProductTaxClassActionGroup.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateTaxRuleCustomProductTaxClassActionGroup"> + <annotations> + <description>Admin create tax rule with custom tax rate and product tax class</description> + </annotations> + <arguments> + <argument name="taxRuleCode" type="string" defaultValue="{{defaultTaxRule.code}}"/> + <argument name="taxRateCode" type="string" defaultValue="{{US_NY_Rate_1.code}}"/> + <argument name="productTaxClassName" type="string" defaultValue="NewTaxClass"/> + </arguments> + <amOnPage url="{{AdminNewTaxRulePage.url}}" stepKey="goNewTaxRulePage"/> + <waitForPageLoad stepKey="waitForNewTaxRulePageLoaded"/> + <fillField selector="{{AdminTaxRulesSection.ruleName}}" userInput="{{taxRuleCode}}" stepKey="fillRuleName"/> + <click selector="{{AdminTaxRulesSection.selectTaxRate(taxRateCode)}}" stepKey="selectTaxRate"/> + <click selector="{{AdminTaxRuleFormSection.additionalSettings}}" stepKey="clickAdditionalSettings"/> + <click selector="{{AdminTaxRulesSection.selectProductTaxClass(taxableGoodsTaxClass.class_name)}}" stepKey="unSelectTaxClass"/> + <click selector="{{AdminTaxRulesSection.selectProductTaxClass(productTaxClassName)}}" stepKey="selectProductTaxClass"/> + <click selector="{{AdminMainActionsSection.save}}" stepKey="clickSave"/> + <waitForElementVisible selector="{{AdminMessagesSection.successMessage}}" stepKey="waitForSuccessMessage"/> + <see selector="{{AdminMessagesSection.successMessage}}" userInput="You saved the tax rule." stepKey="verifyRuleSaved"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Tax/Test/Mftf/Data/TaxConfigData.xml b/app/code/Magento/Tax/Test/Mftf/Data/TaxConfigData.xml index 4edf005c2fc2b..ad92bae51d429 100644 --- a/app/code/Magento/Tax/Test/Mftf/Data/TaxConfigData.xml +++ b/app/code/Magento/Tax/Test/Mftf/Data/TaxConfigData.xml @@ -57,4 +57,10 @@ <entity name="EmptyField" type="taxPostCodeEmpty"> <data key="value"/> </entity> + <entity name="DefaultProductTaxClass"> + <!-- Default value --> + <data key="path">tax/classes/default_product_tax_class</data> + <data key="label">Yes</data> + <data key="value">2</data> + </entity> </entities> diff --git a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRulesSection.xml b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRulesSection.xml index 7f721d4079c27..c69d555d5177a 100644 --- a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRulesSection.xml +++ b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRulesSection.xml @@ -35,5 +35,6 @@ <element name="taxRateMultiSelectItems" type="block" selector=".mselect-list-item"/> <element name="taxRateNumber" type="button" selector="//div[@data-ui-id='tax-rate-form-fieldset-element-form-field-tax-rate']//div[@class='mselect-items-wrapper']//label[{{var}}]" parameterized="true"/> <element name="selectTaxRate" type="input" selector="//span[text()='{{taxCode}}']" parameterized="true"/> + <element name="selectProductTaxClass" type="input" selector="//div[contains(@class, 'field-tax_product_class')]//*[contains(@class, 'mselect-list-item') and contains(.,'{{taxClass}}')]" parameterized="true"/> </section> </sections> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminCheckCreditMemoTotalsTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminCheckCreditMemoTotalsTest.xml new file mode 100644 index 0000000000000..39e6e316dd486 --- /dev/null +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminCheckCreditMemoTotalsTest.xml @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCheckCreditMemoTotalsTest"> + <annotations> + <features value="Tax"/> + <stories value="Credit memo entity"/> + <title value="Checking Credit memo Totals"/> + <description value="Checking Credit memo Totals"/> + <severity value="MAJOR"/> + <testCaseId value="MC-6159"/> + <group value="tax"/> + <group value="sales"/> + </annotations> + <before> + <!-- Create productTaxClass --> + <createData entity="productTaxClass" stepKey="createProductTaxClass"/> + <!--Set configs--> + <magentoCLI command="config:set {{DisableGenerateCategoryProductUrlRewritesConfigData.path}} {{DisableGenerateCategoryProductUrlRewritesConfigData.value}}" stepKey="disableGenerateUrlRewrite"/> + <magentoCLI command="config:set {{DefaultProductTaxClass.path}} $createProductTaxClass.return$" stepKey="setDefaultProductTaxClass"/> + <!--Create category and product--> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <createData entity="_defaultProduct" stepKey="createSimpleProduct"> + <requiredEntity createDataKey="createCategory"/> + <field key="productTaxClass">$createProductTaxClass.taxClass[class_name]$</field> + </createData> + <!--Create customer--> + <createData entity="Simple_US_Customer_NY" stepKey="createCustomer"/> + <!--Login as admin--> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <!--Create tax rule--> + <actionGroup ref="AdminCreateTaxRuleCustomProductTaxClassActionGroup" stepKey="createTaxRuleCustomProductTaxClass"> + <argument name="productTaxClassName" value="$createProductTaxClass.taxClass[class_name]$"/> + </actionGroup> + </before> + <after> + <!--Set configs--> + <magentoCLI command="config:set {{EnableGenerateCategoryProductUrlRewritesConfigData.path}} {{EnableGenerateCategoryProductUrlRewritesConfigData.value}}" stepKey="enableGenerateUrlRewrite"/> + <magentoCLI command="config:set {{DefaultProductTaxClass.path}} {{DefaultProductTaxClass.value}}" stepKey="setDefaultProductTaxClass"/> + <!--Delete category and product--> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> + <!--Delete customer--> + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> + <!-- Reset admin order filter --> + <actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearOrderFilters"/> + <!-- Go to the tax rule page and delete the row we created--> + <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRulesPage"/> + <actionGroup ref="deleteEntitySecondaryGrid" stepKey="deleteRule"> + <argument name="name" value="{{defaultTaxRule.code}}"/> + <argument name="searchInput" value="{{AdminSecondaryGridSection.taxIdentifierSearch}}"/> + </actionGroup> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearTaxRuleFilter"/> + <!-- Delete Tax Class --> + <deleteData createDataKey="createProductTaxClass" stepKey="deleteProductTaxClass"/> + <!--Logout--> + <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + </after> + <!--Create new order--> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="createNewOrder"> + <argument name="customer" value="Simple_US_Customer_NY"/> + </actionGroup> + <!--Add product to order--> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSimpleProductToOrder"> + <argument name="product" value="$createSimpleProduct$"/> + </actionGroup> + <!--Set shipping method--> + <actionGroup ref="OrderSelectFlatRateShippingActionGroup" stepKey="orderSelectFlatRateShipping"/> + <!--Submit order--> + <actionGroup ref="AdminSubmitOrderActionGroup" stepKey="submitOrder"/> + <!--Create order invoice--> + <actionGroup ref="StartCreateInvoiceFromOrderPageActionGroup" stepKey="startCreateInvoice"/> + <actionGroup ref="SubmitInvoiceActionGroup" stepKey="submitInvoice"/> + <!--Create Credit Memo--> + <actionGroup ref="AdminStartToCreateCreditMemoFromOrderPageActionGroup" stepKey="startCreatingCreditMemo"/> + <fillField selector="{{AdminCreditMemoTotalSection.refundShipping}}" userInput="0" stepKey="setRefundShipping"/> + <actionGroup ref="UpdateCreditMemoTotalsActionGroup" stepKey="updateTotals"/> + <actionGroup ref="SubmitCreditMemoActionGroup" stepKey="submitCreditMemo"/> + <actionGroup ref="AdminOpenCreditMemoFromOrderPageActionGroup" stepKey="openCreditMemoFromOrderPageActionGroup"/> + <actionGroup ref="AssertAdminCreditMemoGrandTotalActionGroup" stepKey="assertGrandTotal"> + <argument name="expectedGrandTotal" value="$133.30"/> + </actionGroup> + </test> +</tests> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/CheckCreditMemoTotalsTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/CheckCreditMemoTotalsTest.xml deleted file mode 100644 index e7964a2dd29eb..0000000000000 --- a/app/code/Magento/Tax/Test/Mftf/Test/CheckCreditMemoTotalsTest.xml +++ /dev/null @@ -1,148 +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="urn:magento:mftf:Test/etc/testSchema.xsd"> - <test name="CheckCreditMemoTotalsTest"> - <annotations> - <features value="Tax"/> - <stories value="MAGETWO-91769 - Credit Memo - Wrong tax calculation! #10982"/> - <title value="Checking Credit memo Totals"/> - <description value="Checking Credit memo Totals"/> - <severity value="MAJOR"/> - <testCaseId value="MAGETWO-95175"/> - <group value="creditMemo"/> - <group value="tax"/> - <skip> - <issueId value="MC-17140"/> - </skip> - </annotations> - <before> - <!--Create category and product--> - <createData entity="_defaultCategory" stepKey="createCategory"/> - <createData entity="_defaultProduct" stepKey="createSimpleProduct"> - <requiredEntity createDataKey="createCategory"/> - </createData> - <!--Create customer--> - <createData entity="Simple_US_Customer_NY" stepKey="createCustomer"/> - <!--Login as admin--> - <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> - <!--Create tax rule and tax rate--> - <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRulePage"/> - <waitForPageLoad stepKey="waitForTaxRatePage"/> - <click stepKey="addNewTaxRate" selector="{{AdminGridMainControls.add}}"/> - <fillField stepKey="fillRuleName" selector="{{AdminTaxRulesSection.ruleName}}" userInput="SampleRule"/> - <actionGroup ref="addCustomTaxRate" stepKey="addCustomTaxRate"> - <argument name="taxCode" value="SimpleTaxNY"/> - </actionGroup> - <click stepKey="expandAdditionalSettings" selector="{{AdminProductTaxClassSection.additionalSettings}}"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <click selector="{{AdminProductTaxClassSection.productTaxClass}}" stepKey="ClickToAddTaxClass"/> - <fillField selector="{{AdminProductTaxClassSection.TaxClassName}}" userInput="NewTaxClass" stepKey="setName"/> - <click selector="{{AdminProductTaxClassSection.confirm}}" stepKey="ClickToDone"/> - <click stepKey="clickSave" selector="{{AdminStoresMainActionsSection.saveButton}}"/> - <waitForPageLoad stepKey="waitForTaxRatePage1"/> - <see userInput="You saved the tax rule." stepKey="VerifyRuleSaved"/> - <!--Search and edit product to add new created tax rule--> - <actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForSimpleProduct"> - <argument name="product" value="$$createSimpleProduct$$"/> - </actionGroup> - <actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="OpenEditProductOnBackend"> - <argument name="product" value="$$createSimpleProduct$$"/> - </actionGroup> - <waitForPageLoad stepKey="waitForPageLoad2"/> - <selectOption selector="{{AdminProductFormActionSection.selectTaxClass}}" userInput="NewTaxClass" stepKey="SetNewTaxClass" /> - <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct"/> - <!--Set configs--> - <amOnPage url="{{AdminTaxConfigurationPage.url}}" stepKey="goToTaxConfigPage"/> - <conditionalClick stepKey="clickOrdersInvoicesCreditSales" selector="{{AdminConfigureTaxSection.taxClasses}}" dependentSelector="{{AdminConfigureTaxSection.taxClassesCondition}}" visible="false"/> - <click selector="{{AdminConfigureTaxSection.useSystemValue}}" stepKey="UncheckUseSystemValue"/> - <selectOption selector="{{AdminConfigureTaxSection.productTaxClass}}" userInput="NewTaxClass" stepKey="selectClass"/> - <click selector="{{AdminConfigureTaxSection.save}}" stepKey="saveConfig"/> - <!--flash cache--> - <magentoCLI command="cache:flush" stepKey="flushCache"/> - </before> - <after> - <!--Delete category and product--> - <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> - <!--Delete customer--> - <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> - <!-- Reset admin order filter --> - <actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearOrderFilters"/> - <!--Roll Back configuration--> - <amOnPage url="{{AdminTaxConfigurationPage.url}}" stepKey="goToTaxConfigPage"/> - <conditionalClick stepKey="clickOrdersInvoicesCreditSales" selector="{{AdminConfigureTaxSection.taxClasses}}" dependentSelector="{{AdminConfigureTaxSection.taxClassesCondition}}" visible="false"/> - <selectOption selector="{{AdminConfigureTaxSection.productTaxClass}}" userInput="Taxable Goods" stepKey="selectClass"/> - <click selector="{{AdminConfigureTaxSection.save}}" stepKey="saveConfig"/> - <!-- Go to the tax rule page and delete the row we created--> - <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRulesPage"/> - <waitForPageLoad stepKey="waitForRulesPage"/> - <actionGroup ref="deleteEntitySecondaryGrid" stepKey="deleteRule"> - <argument name="name" value="SampleRule"/> - <argument name="searchInput" value="{{AdminSecondaryGridSection.taxIdentifierSearch}}"/> - </actionGroup> - <!-- Go to the tax rate page --> - <amOnPage url="{{AdminTaxRateGridPage.url}}" stepKey="goToTaxRatesPage"/> - <waitForPageLoad stepKey="waitForRatesPage"/> - <!-- Delete tax rate that were created --> - <actionGroup ref="deleteEntitySecondaryGrid" stepKey="deleteNYRate"> - <argument name="name" value="{{SimpleTaxNY.state}}"/> - <argument name="searchInput" value="{{AdminSecondaryGridSection.taxIdentifierSearch}}"/> - </actionGroup> - <actionGroup ref="DeleteProductTaxClassActionGroup" stepKey="deleteFirstProductTaxClass"> - <argument name="taxClassName" value="NewTaxClass"/> - </actionGroup> - <!--logout--> - <actionGroup ref="logout" stepKey="logout"/> - </after> - <!--Create new order--> - <actionGroup stepKey="CreateNewOrder" ref="NavigateToNewOrderPageExistingCustomerActionGroup"> - <argument name="customer" value="Simple_US_Customer_NY"/> - </actionGroup> - <!--Add product to order--> - <click stepKey="clickToAddProduct" selector="{{AdminOrderFormItemsSection.addProducts}}"/> - <waitForPageLoad stepKey="waitForProductsOpened"/> - <checkOption selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" stepKey="selectProduct"/> - <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickAddSelectedProducts"/> - <waitForPageLoad stepKey="waitForPageLoad3"/> - <!--Set shipping method--> - <actionGroup stepKey="OrderSelectFlatRateShippingActionGroup" ref="OrderSelectFlatRateShippingActionGroup"/> - <!--Submit order--> - <click stepKey="SubmitOrder" selector="{{AdminOrderFormActionSection.SubmitOrder}}"/> - <waitForPageLoad stepKey="waitForPageLoad4"/> - <grabTextFrom stepKey="getOrderId" selector="|Order # (\d+)|"/> - <!--Open new created order--> - <amOnPage url="{{AdminOrdersPage.url}}" stepKey="goToOrders"/> - <waitForPageLoad stepKey="waitForPageLoad5"/> - <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGridById"> - <argument name="orderId" value="$getOrderId"/> - </actionGroup> - <!--Create order invoice--> - <click selector="{{AdminDataGridTableSection.rowViewAction('1')}}" stepKey="clickCreatedOrderInGrid"/> - <click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoiceAction"/> - <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Invoice" stepKey="seePageNameNewInvoicePage"/> - <click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/> - <see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="The invoice has been created." stepKey="seeInvoiceCreateSuccess"/> - <see selector="{{AdminInvoiceOrderInformationSection.orderStatus}}" userInput="Processing" stepKey="seeOrderProcessing"/> - <!--Create Credit Memo--> - <click selector="{{AdminOrderDetailsMainActionsSection.creditMemo}}" stepKey="clickCreditMemoAction"/> - <fillField selector="{{AdminCreditMemoTotalSection.refundShipping}}" userInput="0" stepKey="setRefundShipping"/> - <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Memo" stepKey="seeNewMemoInPageTitle"/> - <click selector="{{AdminCreditMemoTotalSection.submitRefundOffline}}" stepKey="clickRefundOffline"/> - <see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="You created the credit memo." stepKey="seeCreditMemoSuccess"/> - <click selector="{{AdminCreditMemoTotalSection.creditMemoItem}}" stepKey="goToCreatedCreditMemo"/> - <waitForPageLoad stepKey="waitForPageLoad6"/> - <!--View created memo and verify tax for product--> - <click selector="{{AdminCreditMemoTotalSection.viewMemo}}" stepKey="ViewMemo"/> - <waitForPageLoad stepKey="waitForPageLoad7"/> - <grabTextFrom selector="{{AdminCreditMemoTotalSection.grandTotal}}" stepKey="getGrandTotal"/> - <assertEquals expected='$123.00' expectedType="string" actual="($getGrandTotal)" stepKey="assertGrandTotalValue"/> - - </test> -</tests> From c103950be1f559c4ec89d0aa1709081e802c4348 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky <firster@atwix.com> Date: Fri, 17 Jan 2020 02:17:13 +0200 Subject: [PATCH 0876/1143] magento/magento2#: Unit test for \Magento\Bundle\Observer\AppendUpsellProductsObserver --- .../Observer/AppendUpsellProductsObserver.php | 13 +- .../AppendUpsellProductsObserverTest.php | 410 ++++++++++++++++++ 2 files changed, 421 insertions(+), 2 deletions(-) create mode 100644 app/code/Magento/Bundle/Test/Unit/Observer/AppendUpsellProductsObserverTest.php diff --git a/app/code/Magento/Bundle/Observer/AppendUpsellProductsObserver.php b/app/code/Magento/Bundle/Observer/AppendUpsellProductsObserver.php index 63ae3cef7a33e..fe5eaebbf7f25 100644 --- a/app/code/Magento/Bundle/Observer/AppendUpsellProductsObserver.php +++ b/app/code/Magento/Bundle/Observer/AppendUpsellProductsObserver.php @@ -7,6 +7,9 @@ use Magento\Framework\Event\ObserverInterface; +/** + * Class adds bundle products into up-sell products collection + */ class AppendUpsellProductsObserver implements ObserverInterface { /** @@ -98,9 +101,15 @@ public function execute(\Magento\Framework\Event\Observer $observer) } /* @var $bundleCollection \Magento\Catalog\Model\ResourceModel\Product\Collection */ - $bundleCollection = $product->getCollection()->addAttributeToSelect( + $bundleCollection = $product->getCollection(); + $bundleCollection->addAttributeToSelect( $this->config->getProductAttributes() - )->addStoreFilter()->addMinimalPrice()->addFinalPrice()->addTaxPercents()->setVisibility( + ); + $bundleCollection->addStoreFilter(); + $bundleCollection->addMinimalPrice(); + $bundleCollection->addFinalPrice(); + $bundleCollection->addTaxPercents(); + $bundleCollection->setVisibility( $this->productVisibility->getVisibleInCatalogIds() ); diff --git a/app/code/Magento/Bundle/Test/Unit/Observer/AppendUpsellProductsObserverTest.php b/app/code/Magento/Bundle/Test/Unit/Observer/AppendUpsellProductsObserverTest.php new file mode 100644 index 0000000000000..d1058ff56270c --- /dev/null +++ b/app/code/Magento/Bundle/Test/Unit/Observer/AppendUpsellProductsObserverTest.php @@ -0,0 +1,410 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Bundle\Test\Unit\Observer; + +use Magento\Bundle\Helper\Data as BundleHelper; +use Magento\Bundle\Model\ResourceModel\Selection; +use Magento\Bundle\Observer\AppendUpsellProductsObserver; +use Magento\Catalog\Model\Config as CatalogConfig; +use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\Product\Type as ProductType; +use Magento\Catalog\Model\Product\Visibility; +use Magento\Catalog\Model\ResourceModel\Product\Collection as ProductCollection; +use Magento\Catalog\Model\ResourceModel\Product\Link\Product\Collection as ProductLinkCollection; +use Magento\Framework\Event; +use Magento\Framework\Event\Observer; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\GroupedProduct\Model\Product\Type\Grouped; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +/** + * Test class for \Magento\Bundle\Observer\AppendUpsellProductsObserver + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class AppendUpsellProductsObserverTest extends TestCase +{ + /** + * @var ProductCollection|MockObject + */ + private $bundleCollectionMock; + + /** + * @var BundleHelper|MockObject + */ + private $bundleDataMock; + + /** + * @var Selection|MockObject + */ + private $bundleSelectionMock; + + /** + * @var CatalogConfig|MockObject + */ + private $configMock; + + /** + * @var Event|MockObject + */ + private $eventMock; + + /** + * Object Manager Instance + * + * @var ObjectManager + */ + private $objectManager; + + /** + * Testable Object + * + * @var AppendUpsellProductsObserver + */ + private $observer; + + /** + * @var Observer|MockObject + */ + private $observerMock; + + /** + * @var ProductLinkCollection|MockObject + */ + private $collectionMock; + + /** + * @var Product|MockObject + */ + private $productMock; + + /** + * @var Visibility|MockObject + */ + private $productVisibilityMock; + + /** + * @inheritdoc + */ + protected function setUp() : void + { + $this->objectManager = new ObjectManager($this); + $this->observerMock = $this->createMock(Observer::class); + + $this->bundleCollectionMock = $this->getMockBuilder(ProductCollection::class) + ->disableOriginalConstructor() + ->setMethods([ + 'addAttributeToSelect', + 'addFieldToFilter', + 'addFinalPrice', + 'addMinimalPrice', + 'addStoreFilter', + 'addTaxPercents', + 'load', + 'setFlag', + 'setPageSize', + 'setVisibility' + ]) + ->getMock(); + + $this->bundleDataMock = $this->getMockBuilder(BundleHelper::class) + ->disableOriginalConstructor() + ->setMethods(['getAllowedSelectionTypes']) + ->getMock(); + + $this->bundleSelectionMock = $this->getMockBuilder(Selection::class) + ->disableOriginalConstructor() + ->setMethods(['getParentIdsByChild']) + ->getMock(); + + $this->configMock = $this->getMockBuilder(CatalogConfig::class) + ->disableOriginalConstructor() + ->setMethods(['getProductAttributes']) + ->getMock(); + + $this->eventMock = $this->getMockBuilder(Event::class) + ->disableOriginalConstructor() + ->setMethods(['getProduct', 'getCollection', 'getLimit']) + ->getMock(); + + $this->collectionMock = $this->getMockBuilder(Event::class) + ->disableOriginalConstructor() + ->setMethods(['setItems', 'getItems']) + ->getMock(); + + $this->productMock = $this->getMockBuilder(Product::class) + ->disableOriginalConstructor() + ->setMethods(['getCollection', 'getId', 'getTypeId']) + ->getMock(); + + $this->productVisibilityMock = $this->getMockBuilder(Visibility::class) + ->disableOriginalConstructor() + ->setMethods(['getVisibleInCatalogIds']) + ->getMock(); + + $this->observer = $this->objectManager->getObject( + AppendUpsellProductsObserver::class, + [ + 'bundleData' => $this->bundleDataMock, + 'productVisibility' => $this->productVisibilityMock, + 'config' => $this->configMock, + 'bundleSelection' => $this->bundleSelectionMock, + ] + ); + } + + /** + * Test observer execute method + */ + public function testAddBundleCollectionItemsToEventCollection() + { + $collectionItems = [ + 1 => 1 + ]; + $limit = 2; + $parentIds = [1, 3]; + $productId = 2; + $productAttributes = ['attribute1', 'attribute2']; + $visibleInCatalogIds = [10, 11, 12]; + + $this->observerMock + ->expects($this->exactly(3)) + ->method('getEvent') + ->willReturn($this->eventMock); + + $this->eventMock + ->expects($this->once()) + ->method('getProduct') + ->willReturn($this->productMock); + + $this->bundleDataMock + ->expects($this->once()) + ->method('getAllowedSelectionTypes') + ->willReturn($this->getAllowedSelectionTypes()); + + $this->productMock + ->expects($this->once()) + ->method('getTypeId') + ->willReturn(ProductType::TYPE_SIMPLE); + + $this->eventMock + ->expects($this->once()) + ->method('getCollection') + ->willReturn($this->collectionMock); + + $this->eventMock + ->expects($this->once()) + ->method('getLimit') + ->willReturn($limit); + + $this->collectionMock + ->expects($this->exactly(2)) + ->method('getItems') + ->willReturn($collectionItems); + + $this->productMock + ->expects($this->once()) + ->method('getId') + ->willReturn($productId); + + $this->bundleSelectionMock + ->expects($this->once()) + ->method('getParentIdsByChild') + ->willReturn($parentIds); + + $this->productMock + ->expects($this->once()) + ->method('getCollection') + ->willReturn($this->bundleCollectionMock); + + $this->bundleCollectionMock + ->expects($this->once()) + ->method('addAttributeToSelect') + ->willReturn($this->bundleCollectionMock); + + $this->configMock + ->expects($this->once()) + ->method('getProductAttributes') + ->willReturn($productAttributes); + + $this->productVisibilityMock + ->expects($this->once()) + ->method('getVisibleInCatalogIds') + ->willReturn($visibleInCatalogIds); + + $this->bundleCollectionMock + ->expects($this->once()) + ->method('setPageSize') + ->willReturn($this->bundleCollectionMock); + + $this->bundleCollectionMock + ->expects($this->once()) + ->method('addFieldToFilter') + ->willReturn($this->bundleCollectionMock); + + $this->bundleCollectionMock + ->expects($this->once()) + ->method('setFlag') + ->willReturn($this->bundleCollectionMock); + + $this->collectionMock + ->expects($this->once()) + ->method('setItems') + ->willReturn($collectionItems); + + $this->observer->execute($this->observerMock); + } + + /** + * Test observer when collection contains a parent product of a current product + */ + public function testObserverWithoutBundleIds() + { + $collectionItems = [ + 1 => 1 + ]; + $parentIds = [1]; + $limit = 2; + $productId = 2; + + $this->observerMock + ->expects($this->exactly(3)) + ->method('getEvent') + ->willReturn($this->eventMock); + + $this->eventMock + ->expects($this->once()) + ->method('getProduct') + ->willReturn($this->productMock); + + $this->bundleDataMock + ->expects($this->once()) + ->method('getAllowedSelectionTypes') + ->willReturn($this->getAllowedSelectionTypes()); + + $this->productMock + ->expects($this->once()) + ->method('getTypeId') + ->willReturn(ProductType::TYPE_SIMPLE); + + $this->eventMock + ->expects($this->once()) + ->method('getCollection') + ->willReturn($this->collectionMock); + + $this->eventMock + ->expects($this->once()) + ->method('getLimit') + ->willReturn($limit); + + $this->collectionMock + ->expects($this->once()) + ->method('getItems') + ->willReturn($collectionItems); + + $this->productMock + ->expects($this->once()) + ->method('getId') + ->willReturn($productId); + + $this->bundleSelectionMock + ->expects($this->once()) + ->method('getParentIdsByChild') + ->willReturn($parentIds); + + $this->observer->execute($this->observerMock); + } + + /** + * Test observer when count of products is equal to limit. + */ + public function testObserverWithoutLinkedProducts() + { + $collectionItems = [ + 1 => 1 + ]; + $limit = 1; + + $this->observerMock + ->expects($this->exactly(3)) + ->method('getEvent') + ->willReturn($this->eventMock); + + $this->eventMock + ->expects($this->once()) + ->method('getProduct') + ->willReturn($this->productMock); + + $this->bundleDataMock + ->expects($this->once()) + ->method('getAllowedSelectionTypes') + ->willReturn($this->getAllowedSelectionTypes()); + + $this->productMock + ->expects($this->once()) + ->method('getTypeId') + ->willReturn(ProductType::TYPE_SIMPLE); + + $this->eventMock + ->expects($this->once()) + ->method('getCollection') + ->willReturn($this->collectionMock); + + $this->eventMock + ->expects($this->once()) + ->method('getLimit') + ->willReturn($limit); + + $this->collectionMock + ->expects($this->once()) + ->method('getItems') + ->willReturn($collectionItems); + + $this->observer->execute($this->observerMock); + } + + /** + * Test observer when a current product type is allowed for bundle selection + */ + public function testCurrentProductIsNotAllowedForBundleSelection() + { + $this->bundleDataMock + ->expects($this->once()) + ->method('getAllowedSelectionTypes') + ->willReturn($this->getAllowedSelectionTypes()); + + $this->eventMock + ->expects($this->once()) + ->method('getProduct') + ->willReturn($this->productMock); + + $this->observerMock + ->expects($this->once()) + ->method('getEvent') + ->willReturn($this->eventMock); + + $this->productMock + ->expects($this->once()) + ->method('getTypeId') + ->willReturn(Grouped::TYPE_CODE); + + $this->observer->execute($this->observerMock); + } + + /** + * Returns allowed products types + * + * @return array + */ + private function getAllowedSelectionTypes(): array + { + return [ + 'simple' => ProductType::TYPE_SIMPLE, + 'virtual' => ProductType::TYPE_VIRTUAL, + ]; + } +} From 2d65f15d9a76a0110428eec749d9ccac1f158f2d Mon Sep 17 00:00:00 2001 From: Oleksandr Miroshnichenko <omiroshnichenko@magento.com> Date: Fri, 17 Jan 2020 11:08:02 -0600 Subject: [PATCH 0877/1143] MC-30414: [2.4] Flaky Unit Test: Magento_Ui/js/form/form.encountered a declaration exception --- .../frontend/js/view/shipping.test.js | 58 ++++++++----------- .../Signifyd/frontend/js/Fingerprint.test.js | 13 ++++- 2 files changed, 35 insertions(+), 36 deletions(-) diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Checkout/frontend/js/view/shipping.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Checkout/frontend/js/view/shipping.test.js index 46d9e1974bdb7..f6f4927aaeda2 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Checkout/frontend/js/view/shipping.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Checkout/frontend/js/view/shipping.test.js @@ -12,7 +12,7 @@ require.config({ } }); -define(['squire', 'ko', 'jquery', 'uiRegistry', 'jquery/validate'], function (Squire, ko, $, registry) { +define(['squire', 'ko', 'jquery', 'jquery/validate'], function (Squire, ko, $) { 'use strict'; var injector = new Squire(), @@ -20,6 +20,16 @@ define(['squire', 'ko', 'jquery', 'uiRegistry', 'jquery/validate'], function (Sq openModal: jasmine.createSpy(), closeModal: jasmine.createSpy() }, + country = { + /** Stub */ + on: function () {}, + + /** Stub */ + get: function () {}, + + /** Stub */ + set: function () {} + }, mocks = { 'Magento_Customer/js/model/customer': { isLoggedIn: ko.observable() @@ -28,17 +38,7 @@ define(['squire', 'ko', 'jquery', 'uiRegistry', 'jquery/validate'], function (Sq 'Magento_Checkout/js/model/address-converter': jasmine.createSpy(), 'Magento_Checkout/js/model/quote': { isVirtual: jasmine.createSpy(), - shippingMethod: ko.observable(), - - /** - * Stub - */ - shippingAddress: function () { - - return { - 'countryId': 'AD' - }; - } + shippingMethod: ko.observable() }, 'Magento_Checkout/js/action/create-shipping-address': jasmine.createSpy().and.returnValue( jasmine.createSpyObj('newShippingAddress', ['getKey']) @@ -62,7 +62,18 @@ define(['squire', 'ko', 'jquery', 'uiRegistry', 'jquery/validate'], function (Sq 'checkoutData', ['setSelectedShippingAddress', 'setNewCustomerShippingAddress', 'setSelectedShippingRate'] ), - 'Magento_Ui/js/lib/registry/registry': registry, + 'Magento_Ui/js/lib/registry/registry': { + async: jasmine.createSpy().and.returnValue(function () {}), + create: jasmine.createSpy(), + set: jasmine.createSpy(), + get: jasmine.createSpy().and.callFake(function (query) { + if (query === 'test.shippingAddress.shipping-address-fieldset.country_id') { + return country; + } else if (query === 'checkout.errors') { + return {}; + } + }) + }, 'Magento_Checkout/js/model/shipping-rate-service': jasmine.createSpy() }, obj; @@ -73,7 +84,6 @@ define(['squire', 'ko', 'jquery', 'uiRegistry', 'jquery/validate'], function (Sq obj = new Constr({ provider: 'provName', name: '', - parentName: 'test', index: '', popUpForm: { options: { @@ -174,16 +184,6 @@ define(['squire', 'ko', 'jquery', 'uiRegistry', 'jquery/validate'], function (Sq describe('"validateShippingInformation" method', function () { it('Check method call on negative cases.', function () { - /* jscs:disable */ - var country = { - on: function () {}, - get: function () {}, - set: function () {} - }; - /* jscs:enable */ - - registry.set('test.shippingAddress.shipping-address-fieldset.country_id', country); - registry.set('checkout.errors', {}); obj.source = { get: jasmine.createSpy().and.returnValue(true), set: jasmine.createSpy(), @@ -199,20 +199,10 @@ define(['squire', 'ko', 'jquery', 'uiRegistry', 'jquery/validate'], function (Sq expect(obj.validateShippingInformation()).toBeFalsy(); }); it('Check method call on positive case.', function () { - /* jscs:disable */ - var country = { - on: function () {}, - get: function () {}, - set: function () {} - }; - /* jscs:enable */ - $('body').append('<form data-role="email-with-possible-login">' + '<input type="text" name="username" />' + '</form>'); - registry.set('test.shippingAddress.shipping-address-fieldset.country_id', country); - registry.set('checkout.errors', {}); obj.source = { get: jasmine.createSpy().and.returnValue(true), set: jasmine.createSpy(), diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Signifyd/frontend/js/Fingerprint.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Signifyd/frontend/js/Fingerprint.test.js index 0be178c5a31f0..a9d9fe8d08047 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Signifyd/frontend/js/Fingerprint.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Signifyd/frontend/js/Fingerprint.test.js @@ -10,6 +10,16 @@ define([ /*eslint max-nested-callbacks: ["error", 5]*/ describe('Signifyd device fingerprint client script', function () { + var originalTimeout; + + beforeEach(function () { + originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL; + jasmine.DEFAULT_TIMEOUT_INTERVAL = 12000; + }); + + afterEach(function () { + jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout; + }); it('SIGNIFYD_GLOBAL object initialization check', function (done) { var script = document.createElement('script'); @@ -32,7 +42,6 @@ define([ expect(signifyd.scriptTagHasLoaded()).toBe(true); done(); }, 10000); - - }, 12000); + }); }); }); From 678322eab4f1d230a1c408c8bb2bba01418ba00b Mon Sep 17 00:00:00 2001 From: Anusha Vattam <avattam@adobe.com> Date: Fri, 17 Jan 2020 12:03:29 -0600 Subject: [PATCH 0878/1143] MC-30496: Forward Port [WebAPI Test] Failing Test: Magento.GraphQl.Quote.Customer.GetCustomerCartTest.testGetCustomerCartSecondStore - Added test changes --- .../Quote/Customer/GetCustomerCartTest.php | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetCustomerCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetCustomerCartTest.php index 8100bce4ac718..2da911ac9d3b1 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetCustomerCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetCustomerCartTest.php @@ -11,6 +11,8 @@ use Magento\GraphQl\Quote\GetMaskedQuoteIdByReservedOrderId; use Magento\Integration\Api\CustomerTokenServiceInterface; use Magento\TestFramework\Helper\Bootstrap; +use Magento\Quote\Model\ResourceModel\Quote\Collection; +use Magento\Framework\ObjectManagerInterface; use Magento\TestFramework\TestCase\GraphQlAbstract; /** @@ -28,11 +30,29 @@ class GetCustomerCartTest extends GraphQlAbstract */ private $customerTokenService; + /** + * @var ObjectManagerInterface + */ + protected $objectManager; + protected function setUp() { - $objectManager = Bootstrap::getObjectManager(); - $this->getMaskedQuoteIdByReservedOrderId = $objectManager->get(GetMaskedQuoteIdByReservedOrderId::class); - $this->customerTokenService = $objectManager->get(CustomerTokenServiceInterface::class); + $this->objectManager = Bootstrap::getObjectManager(); + $this->getMaskedQuoteIdByReservedOrderId = $this->objectManager->get(GetMaskedQuoteIdByReservedOrderId::class); + $this->customerTokenService = $this->objectManager->get(CustomerTokenServiceInterface::class); + } + + /** + * @inheritdoc + */ + protected function tearDown() + { + /** @var \Magento\Quote\Model\Quote $quote */ + $quoteCollection = $this->objectManager->create(Collection::class); + foreach ($quoteCollection as $quote) { + $quote->delete(); + } + parent::tearDown(); } /** @@ -177,9 +197,8 @@ public function testGetInactiveCustomerCart() */ public function testGetCustomerCartSecondStore() { - $maskedQuoteIdSecondStore = $this->getMaskedQuoteIdByReservedOrderId->execute('test_order_1_not_default_store'); $customerCartQuery = $this->getCustomerCartQuery(); - + $maskedQuoteIdSecondStore = $this->getMaskedQuoteIdByReservedOrderId->execute('test_order_1_not_default_store'); $headerMap = $this->getHeaderMap(); $headerMap['Store'] = 'fixture_second_store'; $responseSecondStore = $this->graphQlQuery($customerCartQuery, [], '', $headerMap); From 45631a0924aabb82bdda34a98c9ad5e04f31ac33 Mon Sep 17 00:00:00 2001 From: Anusha Vattam <avattam@adobe.com> Date: Fri, 17 Jan 2020 12:45:11 -0600 Subject: [PATCH 0879/1143] MC-30496: Forward Port [WebAPI Test] Failing Test: Magento.GraphQl.Quote.Customer.GetCustomerCartTest.testGetCustomerCartSecondStore - Fixed static failures --- .../Magento/GraphQl/Quote/Customer/GetCustomerCartTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetCustomerCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetCustomerCartTest.php index 2da911ac9d3b1..6ee9bcc516172 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetCustomerCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetCustomerCartTest.php @@ -33,7 +33,7 @@ class GetCustomerCartTest extends GraphQlAbstract /** * @var ObjectManagerInterface */ - protected $objectManager; + private $objectManager; protected function setUp() { From 807b5de95ed8f3ca4b20e398d9db95a2560f2c31 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky <firster@atwix.com> Date: Fri, 17 Jan 2020 21:30:27 +0200 Subject: [PATCH 0880/1143] magento/magento2#: Unit test for \Magento\Bundle\Observer\InitOptionRendererObserver --- .../Observer/InitOptionRendererObserver.php | 11 ++- .../InitOptionRendererObserverTest.php | 81 +++++++++++++++++++ 2 files changed, 89 insertions(+), 3 deletions(-) create mode 100644 app/code/Magento/Bundle/Test/Unit/Observer/InitOptionRendererObserverTest.php diff --git a/app/code/Magento/Bundle/Observer/InitOptionRendererObserver.php b/app/code/Magento/Bundle/Observer/InitOptionRendererObserver.php index 008ab1d84ac37..377b8a7dea466 100644 --- a/app/code/Magento/Bundle/Observer/InitOptionRendererObserver.php +++ b/app/code/Magento/Bundle/Observer/InitOptionRendererObserver.php @@ -5,20 +5,25 @@ */ namespace Magento\Bundle\Observer; +use Magento\Bundle\Helper\Catalog\Product\Configuration; +use Magento\Framework\Event\Observer; use Magento\Framework\Event\ObserverInterface; +/** + * Initiates render options + */ class InitOptionRendererObserver implements ObserverInterface { /** * Initialize product options renderer with bundle specific params * - * @param \Magento\Framework\Event\Observer $observer + * @param Observer $observer * @return $this */ - public function execute(\Magento\Framework\Event\Observer $observer) + public function execute(Observer $observer) { $block = $observer->getBlock(); - $block->addOptionsRenderCfg('bundle', \Magento\Bundle\Helper\Catalog\Product\Configuration::class); + $block->addOptionsRenderCfg('bundle', Configuration::class); return $this; } } diff --git a/app/code/Magento/Bundle/Test/Unit/Observer/InitOptionRendererObserverTest.php b/app/code/Magento/Bundle/Test/Unit/Observer/InitOptionRendererObserverTest.php new file mode 100644 index 0000000000000..78f1d97e888c7 --- /dev/null +++ b/app/code/Magento/Bundle/Test/Unit/Observer/InitOptionRendererObserverTest.php @@ -0,0 +1,81 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Bundle\Test\Unit\Observer; + +use Magento\Bundle\Observer\InitOptionRendererObserver; +use Magento\Framework\Event\Observer; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Wishlist\Block\Customer\Wishlist\Item\Options; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +/** + * Test class for \Magento\Bundle\Observer\InitOptionRendererObserver + */ +class InitOptionRendererObserverTest extends TestCase +{ + /** + * @var Options|MockObject + */ + private $blockMock; + + /** + * Object Manager Instance + * + * @var ObjectManager + */ + private $objectManager; + + /** + * Testable Object + * + * @var InitOptionRendererObserver + */ + private $observer; + + /** + * @var Observer|MockObject + */ + private $observerMock; + + /** + * @inheritdoc + */ + protected function setUp() : void + { + $this->objectManager = new ObjectManager($this); + $this->observerMock = $this->getMockBuilder(Observer::class) + ->disableOriginalConstructor() + ->setMethods(['getBlock']) + ->getMock(); + + $this->blockMock = $this->getMockBuilder(Options::class) + ->disableOriginalConstructor() + ->setMethods(['addOptionsRenderCfg']) + ->getMock(); + + $this->observer = $this->objectManager->getObject(InitOptionRendererObserver::class); + } + + /** + * Test observer execute method + */ + public function testProductOptionRendererInit() + { + $this->observerMock + ->expects($this->once()) + ->method('getBlock') + ->willReturn($this->blockMock); + + $this->blockMock + ->expects($this->once()) + ->method('addOptionsRenderCfg') + ->willReturn($this->blockMock); + + $this->observer->execute($this->observerMock); + } +} From 74857854ee628f93ba14e17221d36b996192fbb4 Mon Sep 17 00:00:00 2001 From: Joan He <johe@magento.com> Date: Fri, 17 Jan 2020 13:38:07 -0600 Subject: [PATCH 0881/1143] B2B-343: Stabilize Community PR --- lib/web/requirejs/domReady.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/web/requirejs/domReady.js b/lib/web/requirejs/domReady.js index 60e6a793656c1..099c6f7b79e15 100644 --- a/lib/web/requirejs/domReady.js +++ b/lib/web/requirejs/domReady.js @@ -90,6 +90,7 @@ define(function () { //There is still a window.onload binding that should get fired if //DOMContentLoaded is missed. if (document.readyState !== "loading") { + // Handle it asynchronously to allow scripts the opportunity to delay ready setTimeout(pageLoaded); } } From 86352a52b05342ed84044736d6654e80f92ab7e8 Mon Sep 17 00:00:00 2001 From: Oleksandr Miroshnichenko <omiroshnichenko@magento.com> Date: Fri, 17 Jan 2020 14:26:17 -0600 Subject: [PATCH 0882/1143] MC-30414: [2.4] Flaky Unit Test: Magento_Ui/js/form/form.encountered a declaration exception --- .../code/Magento/Ui/base/js/form/form.test.js | 60 ++++++++++++------- 1 file changed, 40 insertions(+), 20 deletions(-) diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/form.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/form.test.js index fa149f285c0e3..5726184df2103 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/form.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/form.test.js @@ -3,30 +3,50 @@ * See COPYING.txt for license details. */ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + define([ - 'underscore', - 'uiRegistry', - 'Magento_Ui/js/form/form' -], function (_, registry, Constr) { + 'squire' +], function (Squire) { 'use strict'; describe('Magento_Ui/js/form/form', function () { - - var obj = new Constr({ - provider: 'provName', - name: '', - index: '' - }); - - registry.set('provName', { - /** Stub */ - on: function () {}, - - /** Stub */ - get: function () {}, - - /** Stub */ - set: function () {} + var injector = new Squire(), + mocks = { + 'Magento_Ui/js/lib/registry/registry': { + /** Method stub. */ + get: function () { + return { + get: jasmine.createSpy(), + set: jasmine.createSpy() + }; + }, + options: jasmine.createSpy(), + create: jasmine.createSpy(), + set: jasmine.createSpy(), + async: jasmine.createSpy() + } + }, + obj, + dataScope = 'dataScope'; + + beforeEach(function (done) { + injector.mock(mocks); + injector.require([ + 'Magento_Ui/js/form/form' + ], function (Constr) { + obj = new Constr({ + provider: 'provName', + name: '', + index: '', + dataScope: dataScope + }); + + done(); + }); }); describe('"initAdapter" method', function () { From a1959f62e2d73b208e5989e640d6dcb453ef0724 Mon Sep 17 00:00:00 2001 From: Raul E Watson <raul.watson@maginus.com> Date: Fri, 17 Jan 2020 22:34:46 +0000 Subject: [PATCH 0883/1143] #895 Fix for Media Gallery buttons are shifted to the left --- .../view/adminhtml/web/css/source/_module.less | 13 ------------- .../backend/Magento_Cms/web/css/source/_module.less | 4 ++++ 2 files changed, 4 insertions(+), 13 deletions(-) delete mode 100644 app/code/Magento/MediaGallery/view/adminhtml/web/css/source/_module.less diff --git a/app/code/Magento/MediaGallery/view/adminhtml/web/css/source/_module.less b/app/code/Magento/MediaGallery/view/adminhtml/web/css/source/_module.less deleted file mode 100644 index 4abcfb702a3dd..0000000000000 --- a/app/code/Magento/MediaGallery/view/adminhtml/web/css/source/_module.less +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -.modal-slide { - .media-gallery-modal { - .page-main-actions { - .page-action-buttons{ - text-align: right; - } - } - } -} diff --git a/app/design/adminhtml/Magento/backend/Magento_Cms/web/css/source/_module.less b/app/design/adminhtml/Magento/backend/Magento_Cms/web/css/source/_module.less index 715ad40dc475f..fda9a1ebdd083 100644 --- a/app/design/adminhtml/Magento/backend/Magento_Cms/web/css/source/_module.less +++ b/app/design/adminhtml/Magento/backend/Magento_Cms/web/css/source/_module.less @@ -6,6 +6,10 @@ .media-gallery-modal { .page-main-actions { margin-bottom: 3rem; + + .page-action-buttons { + text-align: right; + } } .new_folder { From 5049ee1f3a0a34b3532b2512778ac0def2406e2e Mon Sep 17 00:00:00 2001 From: Iryna Lagno <ilagno@adobe.com> Date: Fri, 17 Jan 2020 17:39:24 -0600 Subject: [PATCH 0884/1143] MC-14917: Update Symfony components to 4.4LTS for 2.4.x - fix after CR --- composer.json | 8 +++- composer.lock | 48 +++++++++---------- .../Magento/Test/Integrity/ComposerTest.php | 14 +++--- 3 files changed, 37 insertions(+), 33 deletions(-) diff --git a/composer.json b/composer.json index 489ee92dc3f65..f156adfe81162 100644 --- a/composer.json +++ b/composer.json @@ -10,6 +10,12 @@ "preferred-install": "dist", "sort-packages": true }, + "repositories": [ + { + "type": "git", + "url": "https://github.com/magento/composer" + } + ], "require": { "php": "~7.1.3||~7.2.0||~7.3.0", "ext-bcmath": "*", @@ -35,7 +41,7 @@ "colinmollenhour/php-redis-session-abstract": "~1.4.0", "composer/composer": "^1.6", "elasticsearch/elasticsearch": "~2.0||~5.1||~6.1", - "magento/composer": "~1.5.0", + "magento/composer": "1.6.x-dev", "magento/magento-composer-installer": ">=0.1.11", "magento/zendframework1": "~1.14.2", "monolog/monolog": "^1.17", diff --git a/composer.lock b/composer.lock index 73875d0b21841..85a3875a143d1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8a41c0f45690e8714e21de75d201f1b2", + "content-hash": "701b25f7d664c2e8a500233a69587004", "packages": [ { "name": "braintree/braintree_php", @@ -950,22 +950,16 @@ }, { "name": "magento/composer", - "version": "1.5.1", + "version": "1.6.x-dev", "source": { "type": "git", - "url": "https://github.com/magento/composer.git", - "reference": "b2dcb2194629bc2eb03fd81cb9f4586ffe4b65b0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/magento/composer/zipball/b2dcb2194629bc2eb03fd81cb9f4586ffe4b65b0", - "reference": "b2dcb2194629bc2eb03fd81cb9f4586ffe4b65b0", - "shasum": "" + "url": "https://github.com/magento/composer", + "reference": "fe738ac9155f550b669b260b3cfa6422eacb53fa" }, "require": { "composer/composer": "^1.6", "php": "~7.1.3||~7.2.0||~7.3.0", - "symfony/console": "~4.0.0||~4.1.0||~4.2.0||~4.3.0||~4.4.0" + "symfony/console": "~4.4.0" }, "require-dev": { "phpunit/phpunit": "~7.0.0" @@ -976,13 +970,12 @@ "Magento\\Composer\\": "src" } }, - "notification-url": "https://packagist.org/downloads/", "license": [ "OSL-3.0", "AFL-3.0" ], "description": "Magento composer library helps to instantiate Composer application and run composer commands.", - "time": "2020-01-07T22:16:08+00:00" + "time": "2020-01-17T16:43:51+00:00" }, { "name": "magento/magento-composer-installer", @@ -7525,16 +7518,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.9.4", + "version": "1.9.5", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "579bb7356d91f9456ccd505f24ca8b667966a0a7" + "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/579bb7356d91f9456ccd505f24ca8b667966a0a7", - "reference": "579bb7356d91f9456ccd505f24ca8b667966a0a7", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/b2c28789e80a97badd14145fda39b545d83ca3ef", + "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef", "shasum": "" }, "require": { @@ -7569,7 +7562,7 @@ "object", "object graph" ], - "time": "2019-12-15T19:12:40+00:00" + "time": "2020-01-17T21:11:47+00:00" }, { "name": "pdepend/pdepend", @@ -9013,23 +9006,27 @@ }, { "name": "sebastian/finder-facade", - "version": "1.2.2", + "version": "1.2.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/finder-facade.git", - "reference": "4a3174709c2dc565fe5fb26fcf827f6a1fc7b09f" + "reference": "167c45d131f7fc3d159f56f191a0a22228765e16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/finder-facade/zipball/4a3174709c2dc565fe5fb26fcf827f6a1fc7b09f", - "reference": "4a3174709c2dc565fe5fb26fcf827f6a1fc7b09f", + "url": "https://api.github.com/repos/sebastianbergmann/finder-facade/zipball/167c45d131f7fc3d159f56f191a0a22228765e16", + "reference": "167c45d131f7fc3d159f56f191a0a22228765e16", "shasum": "" }, "require": { - "symfony/finder": "~2.3|~3.0|~4.0", - "theseer/fdomdocument": "~1.3" + "php": "^7.1", + "symfony/finder": "^2.3|^3.0|^4.0|^5.0", + "theseer/fdomdocument": "^1.6" }, "type": "library", + "extra": { + "branch-alias": [] + }, "autoload": { "classmap": [ "src/" @@ -9048,7 +9045,7 @@ ], "description": "FinderFacade is a convenience wrapper for Symfony's Finder component.", "homepage": "https://github.com/sebastianbergmann/finder-facade", - "time": "2017-11-18T17:31:49+00:00" + "time": "2020-01-16T08:08:45+00:00" }, { "name": "sebastian/global-state", @@ -10365,6 +10362,7 @@ "aliases": [], "minimum-stability": "stable", "stability-flags": { + "magento/composer": 20, "phpmd/phpmd": 0 }, "prefer-stable": true, diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php index e753fa42c0c36..e45bb324306c0 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php @@ -48,7 +48,7 @@ class ComposerTest extends \PHPUnit\Framework\TestCase /** * @var string */ - private static $magentoFrameworkLibaryName = 'magento/framework'; + private static $magentoFrameworkLibraryName = 'magento/framework'; public static function setUpBeforeClass() { @@ -317,9 +317,9 @@ private function assertDependsOnPhp(\StdClass $json) private function assertDependsOnFramework(\StdClass $json) { $this->assertObjectHasAttribute( - self::$magentoFrameworkLibaryName, + self::$magentoFrameworkLibraryName, $json, - 'This component is expected to depend on ' . self::$magentoFrameworkLibaryName + 'This component is expected to depend on ' . self::$magentoFrameworkLibraryName ); } @@ -516,11 +516,11 @@ public function testConsistencyOfDeclarationsInComposerFiles() } $componentRegistrar = new ComponentRegistrar(); - $magentoFrameworkLibaryDir = - $componentRegistrar->getPath(ComponentRegistrar::LIBRARY, self::$magentoFrameworkLibaryName); + $magentoFrameworkLibraryDir = + $componentRegistrar->getPath(ComponentRegistrar::LIBRARY, self::$magentoFrameworkLibraryName); $magentoFrameworkComposerFile = json_decode( - file_get_contents($magentoFrameworkLibaryDir . DIRECTORY_SEPARATOR . 'composer.json'), + file_get_contents($magentoFrameworkLibraryDir . DIRECTORY_SEPARATOR . 'composer.json'), true ); @@ -536,7 +536,7 @@ public function testConsistencyOfDeclarationsInComposerFiles() $this->assertEmpty( $inconsistentDependencies, 'There is a discrepancy between the declared versions of the following modules in "' - . self::$magentoFrameworkLibaryName . '" and the root composer.json: ' + . self::$magentoFrameworkLibraryName . '" and the root composer.json: ' . implode(', ', $inconsistentDependencies) ); } From 3bffb4cc8d16dcb5a4fa5358accd3b3bcedfcd02 Mon Sep 17 00:00:00 2001 From: Vimal Kumar <vimal.kumar@ranosys.com> Date: Sat, 18 Jan 2020 14:17:17 +0530 Subject: [PATCH 0885/1143] fixed issue #25761 --- .../Sitemap/Model/ItemProvider/StoreUrl.php | 54 ++++++++++++++++ .../ItemProvider/StoreUrlConfigReader.php | 61 +++++++++++++++++++ .../Magento/Sitemap/etc/adminhtml/system.xml | 14 ++++- app/code/Magento/Sitemap/etc/config.xml | 4 ++ app/code/Magento/Sitemap/etc/di.xml | 6 ++ 5 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 app/code/Magento/Sitemap/Model/ItemProvider/StoreUrl.php create mode 100644 app/code/Magento/Sitemap/Model/ItemProvider/StoreUrlConfigReader.php diff --git a/app/code/Magento/Sitemap/Model/ItemProvider/StoreUrl.php b/app/code/Magento/Sitemap/Model/ItemProvider/StoreUrl.php new file mode 100644 index 0000000000000..dd7c50385945f --- /dev/null +++ b/app/code/Magento/Sitemap/Model/ItemProvider/StoreUrl.php @@ -0,0 +1,54 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sitemap\Model\ItemProvider; + +use Magento\Sitemap\Model\SitemapItemInterfaceFactory; + +class StoreUrl implements ItemProviderInterface +{ + /** + * Sitemap item factory + * + * @var SitemapItemInterfaceFactory + */ + private $itemFactory; + + /** + * Config reader + * + * @var ConfigReaderInterface + */ + private $configReader; + + /** + * CategorySitemapItemResolver constructor. + * + * @param ConfigReaderInterface $configReader + * @param SitemapItemInterfaceFactory $itemFactory + */ + public function __construct( + ConfigReaderInterface $configReader, + SitemapItemInterfaceFactory $itemFactory + ) { + $this->itemFactory = $itemFactory; + $this->configReader = $configReader; + } + + /** + * {@inheritdoc} + */ + public function getItems($storeId) + { + $items[] = $this->itemFactory->create([ + 'url' => '', + 'priority' => $this->configReader->getPriority($storeId), + 'changeFrequency' => $this->configReader->getChangeFrequency($storeId), + ]); + + return $items; + } +} diff --git a/app/code/Magento/Sitemap/Model/ItemProvider/StoreUrlConfigReader.php b/app/code/Magento/Sitemap/Model/ItemProvider/StoreUrlConfigReader.php new file mode 100644 index 0000000000000..9a33028d77c76 --- /dev/null +++ b/app/code/Magento/Sitemap/Model/ItemProvider/StoreUrlConfigReader.php @@ -0,0 +1,61 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sitemap\Model\ItemProvider; + +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Store\Model\ScopeInterface; + +class StoreUrlConfigReader implements ConfigReaderInterface +{ + /**#@+ + * Xpath config settings + */ + const XML_PATH_CHANGE_FREQUENCY = 'sitemap/store/changefreq'; + const XML_PATH_PRIORITY = 'sitemap/store/priority'; + /**#@-*/ + + /** + * Scope config + * + * @var ScopeConfigInterface + */ + private $scopeConfig; + + /** + * CategoryItemResolverConfigReader constructor. + * + * @param ScopeConfigInterface $scopeConfig + */ + public function __construct(ScopeConfigInterface $scopeConfig) + { + $this->scopeConfig = $scopeConfig; + } + + /** + * {@inheritdoc} + */ + public function getPriority($storeId) + { + return (string)$this->scopeConfig->getValue( + self::XML_PATH_PRIORITY, + ScopeInterface::SCOPE_STORE, + $storeId + ); + } + + /** + * {@inheritdoc} + */ + public function getChangeFrequency($storeId) + { + return (string)$this->scopeConfig->getValue( + self::XML_PATH_CHANGE_FREQUENCY, + ScopeInterface::SCOPE_STORE, + $storeId + ); + } +} diff --git a/app/code/Magento/Sitemap/etc/adminhtml/system.xml b/app/code/Magento/Sitemap/etc/adminhtml/system.xml index 57c426c68e83f..46ae510287716 100644 --- a/app/code/Magento/Sitemap/etc/adminhtml/system.xml +++ b/app/code/Magento/Sitemap/etc/adminhtml/system.xml @@ -51,7 +51,19 @@ <comment>Valid values range from 0.0 to 1.0.</comment> </field> </group> - <group id="generate" translate="label" type="text" sortOrder="4" showInDefault="1"> + <group id="store" translate="label" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1"> + <label>Store Url Options</label> + <field id="changefreq" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> + <label>Frequency</label> + <source_model>Magento\Sitemap\Model\Config\Source\Frequency</source_model> + </field> + <field id="priority" translate="label comment" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> + <label>Priority</label> + <backend_model>Magento\Sitemap\Model\Config\Backend\Priority</backend_model> + <comment>Valid values range from 0.0 to 1.0.</comment> + </field> + </group> + <group id="generate" translate="label" type="text" sortOrder="5" showInDefault="1"> <label>Generation Settings</label> <field id="enabled" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Enabled</label> diff --git a/app/code/Magento/Sitemap/etc/config.xml b/app/code/Magento/Sitemap/etc/config.xml index 6f14ff728ac4f..36b2cc2207422 100644 --- a/app/code/Magento/Sitemap/etc/config.xml +++ b/app/code/Magento/Sitemap/etc/config.xml @@ -25,6 +25,10 @@ <changefreq>daily</changefreq> <image_include>all</image_include> </product> + <store> + <priority>1</priority> + <changefreq>daily</changefreq> + </store> <generate> <enabled>0</enabled> <error_email /> diff --git a/app/code/Magento/Sitemap/etc/di.xml b/app/code/Magento/Sitemap/etc/di.xml index e627b3b50fff9..4c4a5f98f737a 100644 --- a/app/code/Magento/Sitemap/etc/di.xml +++ b/app/code/Magento/Sitemap/etc/di.xml @@ -25,12 +25,18 @@ <type name="Magento\Sitemap\Model\ItemProvider\Composite"> <arguments> <argument name="itemProviders" xsi:type="array"> + <item name="storeUrlProvider" xsi:type="object">Magento\Sitemap\Model\ItemProvider\StoreUrl</item> <item name="categoryProvider" xsi:type="object">Magento\Sitemap\Model\ItemProvider\Category</item> <item name="cmsPageProvider" xsi:type="object">Magento\Sitemap\Model\ItemProvider\CmsPage</item> <item name="productProvider" xsi:type="object">Magento\Sitemap\Model\ItemProvider\Product</item> </argument> </arguments> </type> + <type name="Magento\Sitemap\Model\ItemProvider\StoreUrl"> + <arguments> + <argument name="configReader" xsi:type="object">Magento\Sitemap\Model\ItemProvider\StoreUrlConfigReader</argument> + </arguments> + </type> <type name="Magento\Sitemap\Model\ItemProvider\Category"> <arguments> <argument name="configReader" xsi:type="object">Magento\Sitemap\Model\ItemProvider\CategoryConfigReader</argument> From a39bc8c5dad9baedc1ca9031e38eb507c4cd143b Mon Sep 17 00:00:00 2001 From: Michele Fantetti <mfantetti@ittweb.net> Date: Sat, 18 Jan 2020 12:29:47 +0100 Subject: [PATCH 0886/1143] Add frontend template hints status command --- .../Command/TemplateHintsShowCommand.php | 66 +++++++++++++++++++ app/code/Magento/Developer/etc/di.xml | 1 + 2 files changed, 67 insertions(+) create mode 100644 app/code/Magento/Developer/Console/Command/TemplateHintsShowCommand.php diff --git a/app/code/Magento/Developer/Console/Command/TemplateHintsShowCommand.php b/app/code/Magento/Developer/Console/Command/TemplateHintsShowCommand.php new file mode 100644 index 0000000000000..55ffaee646abb --- /dev/null +++ b/app/code/Magento/Developer/Console/Command/TemplateHintsShowCommand.php @@ -0,0 +1,66 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Developer\Console\Command; + +use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Magento\Framework\App\Config\ConfigResource\ConfigInterface; + +class TemplateHintsShowCommand extends Command +{ + + /** + * command name + */ + const COMMAND_NAME = 'dev:template-hints:show'; + + /** + * Success message + */ + const SUCCESS_MESSAGE = "Template hints are "; + + /** + * @var \Magento\Framework\App\Config\ScopeConfigInterface + */ + protected $scopeConfig; + + /** + * Initialize dependencies. + * + * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig + */ + public function __construct( + \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig + ) + { + parent::__construct(); + $this->scopeConfig = $scopeConfig; + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this->setName(self::COMMAND_NAME) + ->setDescription('Show frontend template hints status.'); + + parent::configure(); + } + + /** + * {@inheritdoc} + * @throws \InvalidArgumentException + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $templateHintsStatus = ($this->scopeConfig->getValue('dev/debug/template_hints_storefront', 'default')) ? 'enabled' : 'disabled'; + $templateHintsMessage = self::SUCCESS_MESSAGE . $templateHintsStatus; + $output->writeln("<info>". $templateHintsMessage . "</info>"); + } +} diff --git a/app/code/Magento/Developer/etc/di.xml b/app/code/Magento/Developer/etc/di.xml index d8f8eb6c1221e..c2a845d1b794f 100644 --- a/app/code/Magento/Developer/etc/di.xml +++ b/app/code/Magento/Developer/etc/di.xml @@ -105,6 +105,7 @@ <item name="dev_query_log_disable" xsi:type="object">Magento\Developer\Console\Command\QueryLogDisableCommand</item> <item name="dev_template_hints_disable" xsi:type="object">Magento\Developer\Console\Command\TemplateHintsDisableCommand</item> <item name="dev_template_hints_enable" xsi:type="object">Magento\Developer\Console\Command\TemplateHintsEnableCommand</item> + <item name="dev_template_hints_show" xsi:type="object">Magento\Developer\Console\Command\TemplateHintsShowCommand</item> <item name="dev_profiler_disable" xsi:type="object">Magento\Developer\Console\Command\ProfilerDisableCommand</item> <item name="dev_profiler_enable" xsi:type="object">Magento\Developer\Console\Command\ProfilerEnableCommand</item> <item name="dev_generate_patch" xsi:type="object">Magento\Developer\Console\Command\GeneratePatchCommand</item> From f37c228d50c93ef21f4d477ccdb1f59c874867c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Sat, 18 Jan 2020 17:17:46 +0100 Subject: [PATCH 0887/1143] Added Unit Tests for 2 cases and introduce fallback ( [[]] ) --- .../Block/Product/ProductList/Upsell.php | 2 +- .../Block/Product/ProductList/UpsellTest.php | 40 +++++++++++++++++-- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php b/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php index cf7e992650e1f..3c3a78201dddc 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php @@ -269,7 +269,7 @@ public function getIdentities() { $identities = array_map(function (DataObject $item) { return $item->getIdentities(); - }, $this->getItems()); + }, $this->getItems()) ?: [[]]; return array_merge(...$identities); } diff --git a/app/code/Magento/Catalog/Test/Unit/Block/Product/ProductList/UpsellTest.php b/app/code/Magento/Catalog/Test/Unit/Block/Product/ProductList/UpsellTest.php index 03f3c83d87dcb..f3aa3f182d198 100644 --- a/app/code/Magento/Catalog/Test/Unit/Block/Product/ProductList/UpsellTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Block/Product/ProductList/UpsellTest.php @@ -5,17 +5,21 @@ */ namespace Magento\Catalog\Test\Unit\Block\Product\ProductList; +use Magento\Catalog\Block\Product\ProductList\Upsell as UpsellBlock; +use Magento\Catalog\Model\Product; + class UpsellTest extends \PHPUnit\Framework\TestCase { + const STUB_EMPTY_ARRAY = []; /** - * @var \Magento\Catalog\Block\Product\ProductList\Upsell + * @var UpsellBlock */ protected $block; protected function setUp() { $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $this->block = $objectManager->getObject(\Magento\Catalog\Block\Product\ProductList\Upsell::class); + $this->block = $objectManager->getObject(UpsellBlock::class); } protected function tearDown() @@ -26,10 +30,10 @@ protected function tearDown() public function testGetIdentities() { $productTag = ['compare_item_1']; - $product = $this->createMock(\Magento\Catalog\Model\Product::class); + $product = $this->createMock(Product::class); $product->expects($this->once())->method('getIdentities')->will($this->returnValue($productTag)); - $itemsCollection = new \ReflectionProperty(\Magento\Catalog\Block\Product\ProductList\Upsell::class, '_items'); + $itemsCollection = new \ReflectionProperty(UpsellBlock::class, '_items'); $itemsCollection->setAccessible(true); $itemsCollection->setValue($this->block, [$product]); @@ -38,4 +42,32 @@ public function testGetIdentities() $this->block->getIdentities() ); } + + public function testGetIdentitiesWhenItemGetIdentitiesReturnEmptyArray() + { + $product = $this->createMock(Product::class); + $product->expects($this->once())->method('getIdentities') + ->willReturn(self::STUB_EMPTY_ARRAY); + + $itemsCollection = new \ReflectionProperty(UpsellBlock::class, '_items'); + $itemsCollection->setAccessible(true); + $itemsCollection->setValue($this->block, [$product]); + + $this->assertEquals( + self::STUB_EMPTY_ARRAY, + $this->block->getIdentities() + ); + } + + public function testGetIdentitiesWhenGetItemsReturnEmptyArray() + { + $itemsCollection = new \ReflectionProperty(UpsellBlock::class, '_items'); + $itemsCollection->setAccessible(true); + $itemsCollection->setValue($this->block, self::STUB_EMPTY_ARRAY); + + $this->assertEquals( + self::STUB_EMPTY_ARRAY, + $this->block->getIdentities() + ); + } } From 390b919018740722a37e89f723078faa4ccf40cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Sat, 18 Jan 2020 17:45:48 +0100 Subject: [PATCH 0888/1143] Add description --- .../Test/Unit/Plugin/DisableMultishippingModeTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Multishipping/Test/Unit/Plugin/DisableMultishippingModeTest.php b/app/code/Magento/Multishipping/Test/Unit/Plugin/DisableMultishippingModeTest.php index 25a095381333e..829d5a9ce2763 100644 --- a/app/code/Magento/Multishipping/Test/Unit/Plugin/DisableMultishippingModeTest.php +++ b/app/code/Magento/Multishipping/Test/Unit/Plugin/DisableMultishippingModeTest.php @@ -16,7 +16,7 @@ use Magento\Quote\Model\Quote; /** - * Class DisableMultishippingModeTest + * Set of Unit Tets to cover DisableMultishippingMode */ class DisableMultishippingModeTest extends \PHPUnit\Framework\TestCase { From 57b8f53c447a8b07f521a677678921364891b3b6 Mon Sep 17 00:00:00 2001 From: Deepak S Nair <deepak.nair@ranosys.com> Date: Mon, 20 Jan 2020 10:25:01 +0530 Subject: [PATCH 0889/1143] update sort order --- app/code/Magento/Sitemap/etc/adminhtml/system.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Sitemap/etc/adminhtml/system.xml b/app/code/Magento/Sitemap/etc/adminhtml/system.xml index 46ae510287716..8814d7dcf67bd 100644 --- a/app/code/Magento/Sitemap/etc/adminhtml/system.xml +++ b/app/code/Magento/Sitemap/etc/adminhtml/system.xml @@ -53,11 +53,11 @@ </group> <group id="store" translate="label" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Store Url Options</label> - <field id="changefreq" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> + <field id="changefreq" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Frequency</label> <source_model>Magento\Sitemap\Model\Config\Source\Frequency</source_model> </field> - <field id="priority" translate="label comment" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> + <field id="priority" translate="label comment" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Priority</label> <backend_model>Magento\Sitemap\Model\Config\Backend\Priority</backend_model> <comment>Valid values range from 0.0 to 1.0.</comment> @@ -106,7 +106,7 @@ </depends> </field> </group> - <group id="limit" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1"> + <group id="limit" translate="label" type="text" sortOrder="6" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Sitemap File Limits</label> <field id="max_lines" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Maximum No of URLs Per File</label> @@ -118,7 +118,7 @@ <validate>validate-number validate-greater-than-zero</validate> </field> </group> - <group id="search_engines" translate="label" type="text" sortOrder="6" showInDefault="1" showInWebsite="1" showInStore="1"> + <group id="search_engines" translate="label" type="text" sortOrder="7" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Search Engine Submission Settings</label> <field id="submission_robots" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Enable Submission to Robots.txt</label> From 3a19f179309633f3c12ee8e039e5dd5b2d513624 Mon Sep 17 00:00:00 2001 From: Vaha <vaha@atwix.com> Date: Mon, 20 Jan 2020 09:35:50 +0200 Subject: [PATCH 0890/1143] #18012: updated JS config 'i18n_translation' pattern in order to add _.i18n --- app/code/Magento/Translation/etc/di.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Translation/etc/di.xml b/app/code/Magento/Translation/etc/di.xml index d17dac23933ee..de476f52a53fe 100644 --- a/app/code/Magento/Translation/etc/di.xml +++ b/app/code/Magento/Translation/etc/di.xml @@ -64,7 +64,7 @@ <type name="Magento\Translation\Model\Js\Config"> <arguments> <argument name="patterns" xsi:type="array"> - <item name="i18n_translation" xsi:type="string"><![CDATA[~i18n\:\s*(["'])(.*?)(?<!\\)\1~]]></item> + <item name="i18n_translation" xsi:type="string"><![CDATA[~(?:i18n\:|_\.i18n\()\s*(["'])(.*?)(?<!\\)\1~]]></item> <item name="translate_wrapping" xsi:type="string"><![CDATA[~translate\=("')([^\'].*?)\'\"~]]></item> <item name="mage_translation_widget" xsi:type="string"><![CDATA[~(?s)(?:\$|jQuery)\.mage\.__\(\s*(['"])(?<translate>.+?)(?<!\\)\1\s*(*SKIP)\)\s*(?s)~]]></item> <item name="mage_translation_static" xsi:type="string"><![CDATA[~(?s)\$t\(\s*(['"])(?<translate>.+?)(?<!\\)\1\s*(*SKIP)\)(?s)~]]></item> From 7633af187af63892ce58ed89b199a9bbf7e8a590 Mon Sep 17 00:00:00 2001 From: OlgaVasyltsun <olga.vasyltsun@gmail.com> Date: Mon, 20 Jan 2020 09:52:51 +0200 Subject: [PATCH 0891/1143] MC-30398: Filter are not present on category page --- .../Data/UpdateDefaultAttributeValue.php | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Catalog/Setup/Patch/Data/UpdateDefaultAttributeValue.php b/app/code/Magento/Catalog/Setup/Patch/Data/UpdateDefaultAttributeValue.php index 1d58de1994a11..e658d837efbaf 100644 --- a/app/code/Magento/Catalog/Setup/Patch/Data/UpdateDefaultAttributeValue.php +++ b/app/code/Magento/Catalog/Setup/Patch/Data/UpdateDefaultAttributeValue.php @@ -3,19 +3,18 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Catalog\Setup\Patch\Data; use Magento\Catalog\Setup\CategorySetup; use Magento\Catalog\Setup\CategorySetupFactory; -use Magento\Framework\App\ResourceConnection; use Magento\Framework\Setup\ModuleDataSetupInterface; use Magento\Framework\Setup\Patch\DataPatchInterface; use Magento\Framework\Setup\Patch\PatchVersionInterface; /** - * Class UpdateDefaultAttributeValue - * @package Magento\Catalog\Setup\Patch + * Updates 'is_anchor' attribute default value. */ class UpdateDefaultAttributeValue implements DataPatchInterface, PatchVersionInterface { @@ -30,7 +29,6 @@ class UpdateDefaultAttributeValue implements DataPatchInterface, PatchVersionInt private $categorySetupFactory; /** - * PatchInitial constructor. * @param ModuleDataSetupInterface $moduleDataSetup * @param CategorySetupFactory $categorySetupFactory */ @@ -43,17 +41,22 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ public function apply() { /** @var CategorySetup $categorySetup */ $categorySetup = $this->categorySetupFactory->create(['setup' => $this->moduleDataSetup]); - $categorySetup->updateAttribute(3, 54, 'default_value', 1); + $categorySetup->updateAttribute( + CategorySetup::CATEGORY_ENTITY_TYPE_ID, + 'is_anchor', + 'default_value', + 1 + ); } /** - * {@inheritdoc} + * @inheritdoc */ public static function getDependencies() { @@ -63,7 +66,7 @@ public static function getDependencies() } /** - * {@inheritdoc} + * @inheritdoc */ public static function getVersion() { @@ -71,7 +74,7 @@ public static function getVersion() } /** - * {@inheritdoc} + * @inheritdoc */ public function getAliases() { From 8d1102571a8631fcef97f4896101e7b12f52f51d Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Mon, 20 Jan 2020 10:16:58 +0200 Subject: [PATCH 0892/1143] MC-24256: [Integration Test] Export Customers Main File with multiple websites --- .../import_export/customers_with_websites.php | 18 ++++++++++++++++++ .../customers_with_websites_rollback.php | 9 +++++++++ .../Model/Export/CustomerTest.php | 14 ++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/Customer/_files/import_export/customers_with_websites.php create mode 100644 dev/tests/integration/testsuite/Magento/Customer/_files/import_export/customers_with_websites_rollback.php diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/import_export/customers_with_websites.php b/dev/tests/integration/testsuite/Magento/Customer/_files/import_export/customers_with_websites.php new file mode 100644 index 0000000000000..3ee6530063dbd --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Customer/_files/import_export/customers_with_websites.php @@ -0,0 +1,18 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\TestFramework\Helper\Bootstrap; +use Magento\Customer\Api\CustomerRepositoryInterface; + +require __DIR__ . '/customers.php'; +require __DIR__ . '/../../../Store/_files/website.php'; + +$objectManager = Bootstrap::getObjectManager(); +$repository = $objectManager->create(CustomerRepositoryInterface::class); +$customer = $repository->get('customer@example.com'); +$customer->setWebsiteId($website->getId()); +$repository->save($customer); diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/import_export/customers_with_websites_rollback.php b/dev/tests/integration/testsuite/Magento/Customer/_files/import_export/customers_with_websites_rollback.php new file mode 100644 index 0000000000000..09858172126f5 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Customer/_files/import_export/customers_with_websites_rollback.php @@ -0,0 +1,9 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +include __DIR__ . '/customers_rollback.php'; +include __DIR__ . '/../../../Store/_files/website_rollback.php'; diff --git a/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Export/CustomerTest.php b/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Export/CustomerTest.php index 884a4a38ebe0f..9a178aafb0aee 100644 --- a/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Export/CustomerTest.php +++ b/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Export/CustomerTest.php @@ -75,6 +75,20 @@ public function testExport() $this->checkExportData($lines, $expectedAttributes); } + /** + * Export with Multi Websites "Customer Main File". + * + * @magentoDataFixture Magento/Customer/_files/import_export/customers_with_websites.php + * @return void + */ + public function testExportWithMultiWebsites(): void + { + $this->processCustomerAttribute(); + $expectedAttributes = $this->getExpectedAttributes(); + $lines = $this->export($expectedAttributes); + $this->checkExportData($lines, $expectedAttributes); + } + /** * Return attributes which should be exported. * From 690f791cc76e435d15da1c3eb5f8a4e4f63200ea Mon Sep 17 00:00:00 2001 From: Oleh Usik <o.usik@atwix.com> Date: Mon, 20 Jan 2020 10:29:42 +0200 Subject: [PATCH 0893/1143] 25162 fixed wrong format link --- .../Newsletter/Controller/Subscriber/NewAction.php | 4 +++- app/code/Magento/Newsletter/etc/frontend/di.xml | 12 ++++++++++++ .../messages/localizedSubscriptionErrorMessage.phtml | 9 +++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 app/code/Magento/Newsletter/view/frontend/templates/messages/localizedSubscriptionErrorMessage.phtml diff --git a/app/code/Magento/Newsletter/Controller/Subscriber/NewAction.php b/app/code/Magento/Newsletter/Controller/Subscriber/NewAction.php index ea52ae8aaa864..0944ea4626586 100644 --- a/app/code/Magento/Newsletter/Controller/Subscriber/NewAction.php +++ b/app/code/Magento/Newsletter/Controller/Subscriber/NewAction.php @@ -172,7 +172,9 @@ public function execute() $message = $this->getSuccessMessage((int)$subscriber->getSubscriberStatus()); $this->messageManager->addSuccessMessage($message); } catch (LocalizedException $e) { - $this->messageManager->addErrorMessage($e->getMessage()); + $this->messageManager->addComplexErrorMessage( + 'localizedSubscriptionErrorMessage', ['message' => $e->getMessage()] + ); } catch (\Exception $e) { $this->messageManager->addExceptionMessage($e, __('Something went wrong with the subscription.')); } diff --git a/app/code/Magento/Newsletter/etc/frontend/di.xml b/app/code/Magento/Newsletter/etc/frontend/di.xml index eef123a3304e3..99e90faff4034 100644 --- a/app/code/Magento/Newsletter/etc/frontend/di.xml +++ b/app/code/Magento/Newsletter/etc/frontend/di.xml @@ -13,4 +13,16 @@ </argument> </arguments> </type> + <type name="Magento\Framework\View\Element\Message\MessageConfigurationsPool"> + <arguments> + <argument name="configurationsMap" xsi:type="array"> + <item name="localizedSubscriptionErrorMessage" xsi:type="array"> + <item name="renderer" xsi:type="const">\Magento\Framework\View\Element\Message\Renderer\BlockRenderer::CODE</item> + <item name="data" xsi:type="array"> + <item name="template" xsi:type="string">Magento_Newsletter::messages/localizedSubscriptionErrorMessage.phtml</item> + </item> + </item> + </argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/Newsletter/view/frontend/templates/messages/localizedSubscriptionErrorMessage.phtml b/app/code/Magento/Newsletter/view/frontend/templates/messages/localizedSubscriptionErrorMessage.phtml new file mode 100644 index 0000000000000..46c35002e3995 --- /dev/null +++ b/app/code/Magento/Newsletter/view/frontend/templates/messages/localizedSubscriptionErrorMessage.phtml @@ -0,0 +1,9 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +/** @var \Magento\Framework\View\Element\Template $block */ +?> +<?= $block->escapeHtml(__($block->getData('message')), ['a']); ?> From 914bae6e0f1fefb974c47694aba0032ad9d3e2a2 Mon Sep 17 00:00:00 2001 From: OlgaVasyltsun <olga.vasyltsun@gmail.com> Date: Mon, 20 Jan 2020 10:44:06 +0200 Subject: [PATCH 0894/1143] MC-30398: Filter are not present on category page --- .../Catalog/Setup/Patch/Data/UpdateDefaultAttributeValue.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Catalog/Setup/Patch/Data/UpdateDefaultAttributeValue.php b/app/code/Magento/Catalog/Setup/Patch/Data/UpdateDefaultAttributeValue.php index e658d837efbaf..4500d86ad4a6c 100644 --- a/app/code/Magento/Catalog/Setup/Patch/Data/UpdateDefaultAttributeValue.php +++ b/app/code/Magento/Catalog/Setup/Patch/Data/UpdateDefaultAttributeValue.php @@ -53,6 +53,8 @@ public function apply() 'default_value', 1 ); + + return $this; } /** From f4a46e7ea6278ddc0c1779d231287844445a75b3 Mon Sep 17 00:00:00 2001 From: Michele Fantetti <mfantetti@ittweb.net> Date: Mon, 20 Jan 2020 09:45:09 +0100 Subject: [PATCH 0895/1143] Add frontend template hints status command after suggestions --- ...owCommand.php => TemplateHintsStatusCommand.php} | 13 ++++++------- app/code/Magento/Developer/etc/di.xml | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) rename app/code/Magento/Developer/Console/Command/{TemplateHintsShowCommand.php => TemplateHintsStatusCommand.php} (73%) diff --git a/app/code/Magento/Developer/Console/Command/TemplateHintsShowCommand.php b/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php similarity index 73% rename from app/code/Magento/Developer/Console/Command/TemplateHintsShowCommand.php rename to app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php index 55ffaee646abb..81df48d6df49f 100644 --- a/app/code/Magento/Developer/Console/Command/TemplateHintsShowCommand.php +++ b/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php @@ -9,20 +9,19 @@ use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Magento\Framework\App\Config\ConfigResource\ConfigInterface; -class TemplateHintsShowCommand extends Command +class TemplateHintsStatusCommand extends Command { /** * command name */ - const COMMAND_NAME = 'dev:template-hints:show'; + const COMMAND_NAME = 'dev:template-hints:status'; /** * Success message */ - const SUCCESS_MESSAGE = "Template hints are "; + const SUCCESS_MESSAGE = "Template hints are %status"; /** * @var \Magento\Framework\App\Config\ScopeConfigInterface @@ -54,13 +53,13 @@ protected function configure() } /** - * {@inheritdoc} + * @inheritdoc * @throws \InvalidArgumentException */ protected function execute(InputInterface $input, OutputInterface $output) { - $templateHintsStatus = ($this->scopeConfig->getValue('dev/debug/template_hints_storefront', 'default')) ? 'enabled' : 'disabled'; - $templateHintsMessage = self::SUCCESS_MESSAGE . $templateHintsStatus; + $templateHintsStatus = ($this->scopeConfig->isSetFlag('dev/debug/template_hints_storefront', 'default')) ? 'enabled' : 'disabled'; + $templateHintsMessage = __(self::SUCCESS_MESSAGE, ['status' => $templateHintsStatus]); $output->writeln("<info>". $templateHintsMessage . "</info>"); } } diff --git a/app/code/Magento/Developer/etc/di.xml b/app/code/Magento/Developer/etc/di.xml index c2a845d1b794f..3e08466c6a001 100644 --- a/app/code/Magento/Developer/etc/di.xml +++ b/app/code/Magento/Developer/etc/di.xml @@ -105,7 +105,7 @@ <item name="dev_query_log_disable" xsi:type="object">Magento\Developer\Console\Command\QueryLogDisableCommand</item> <item name="dev_template_hints_disable" xsi:type="object">Magento\Developer\Console\Command\TemplateHintsDisableCommand</item> <item name="dev_template_hints_enable" xsi:type="object">Magento\Developer\Console\Command\TemplateHintsEnableCommand</item> - <item name="dev_template_hints_show" xsi:type="object">Magento\Developer\Console\Command\TemplateHintsShowCommand</item> + <item name="dev_template_hints_status" xsi:type="object">Magento\Developer\Console\Command\TemplateHintsStatusCommand</item> <item name="dev_profiler_disable" xsi:type="object">Magento\Developer\Console\Command\ProfilerDisableCommand</item> <item name="dev_profiler_enable" xsi:type="object">Magento\Developer\Console\Command\ProfilerEnableCommand</item> <item name="dev_generate_patch" xsi:type="object">Magento\Developer\Console\Command\GeneratePatchCommand</item> From 141ca96b1ac0973ac1c46f8a225f4e69291c01fd Mon Sep 17 00:00:00 2001 From: Oleh Usik <o.usik@atwix.com> Date: Mon, 20 Jan 2020 11:17:31 +0200 Subject: [PATCH 0896/1143] 25162 added MFTF tests --- ...rConfigFieldGuestNotAllowedActionGroup.xml | 18 +++++++++++++ .../Mftf/Page/AdminNewsletterConfigPage.xml | 13 ++++++++++ ...erConfigPageSubscriptionOptionsSection.xml | 14 ++++++++++ .../Section/NewsletterTemplateSection.xml | 4 +++ ...inkDisplayedForGuestSubscriptionNoTest.xml | 26 +++++++++++++++++++ 5 files changed, 75 insertions(+) create mode 100644 app/code/Magento/Newsletter/Test/Mftf/ActionGroup/AssertAdminNewsletterConfigFieldGuestNotAllowedActionGroup.xml create mode 100644 app/code/Magento/Newsletter/Test/Mftf/Page/AdminNewsletterConfigPage.xml create mode 100644 app/code/Magento/Newsletter/Test/Mftf/Section/AdminNewsletterConfigPageSubscriptionOptionsSection.xml create mode 100644 app/code/Magento/Newsletter/Test/Mftf/Test/VerifyRegistredLinkDisplayedForGuestSubscriptionNoTest.xml diff --git a/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/AssertAdminNewsletterConfigFieldGuestNotAllowedActionGroup.xml b/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/AssertAdminNewsletterConfigFieldGuestNotAllowedActionGroup.xml new file mode 100644 index 0000000000000..73fb9de740ba7 --- /dev/null +++ b/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/AssertAdminNewsletterConfigFieldGuestNotAllowedActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertAdminNewsletterConfigFieldGuestNotAllowedActionGroup"> + <amOnPage url="{{AdminNewsletterConfigPage.url}}" stepKey="amOnNewsletterConfigPage"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <click selector="{{AdminNewsletterConfigPageSubscriptionOptionsSection.allowGuestSubscription}}" stepKey="allowEdit"/> + <selectOption selector="{{AdminNewsletterConfigPageSubscriptionOptionsSection.guestSubscription}}" userInput="No" stepKey="noGuestSubscription"/> + <click selector="{{AdminMainActionsSection.save}}" stepKey="saveNewsletterConfig"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Newsletter/Test/Mftf/Page/AdminNewsletterConfigPage.xml b/app/code/Magento/Newsletter/Test/Mftf/Page/AdminNewsletterConfigPage.xml new file mode 100644 index 0000000000000..00cbaa1656326 --- /dev/null +++ b/app/code/Magento/Newsletter/Test/Mftf/Page/AdminNewsletterConfigPage.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> + <page name="AdminNewsletterConfigPage" url="admin/system_config/edit/section/newsletter/" area="admin" module="Magento_Newsletter"> + <section name="AdminNewsletterConfigPageSubscriptionOptionsSection"/> + </page> +</pages> diff --git a/app/code/Magento/Newsletter/Test/Mftf/Section/AdminNewsletterConfigPageSubscriptionOptionsSection.xml b/app/code/Magento/Newsletter/Test/Mftf/Section/AdminNewsletterConfigPageSubscriptionOptionsSection.xml new file mode 100644 index 0000000000000..26fdcf10ede02 --- /dev/null +++ b/app/code/Magento/Newsletter/Test/Mftf/Section/AdminNewsletterConfigPageSubscriptionOptionsSection.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="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="AdminNewsletterConfigPageSubscriptionOptionsSection"> + <element name="allowGuestSubscription" type="input" selector="#newsletter_subscription_allow_guest_subscribe_inherit"/> + <element name="guestSubscription" type="select" selector="#newsletter_subscription_allow_guest_subscribe" timeout="30"/> + </section> +</sections> diff --git a/app/code/Magento/Newsletter/Test/Mftf/Section/NewsletterTemplateSection.xml b/app/code/Magento/Newsletter/Test/Mftf/Section/NewsletterTemplateSection.xml index 4c8f641f78ae3..ebc1577fd5ece 100644 --- a/app/code/Magento/Newsletter/Test/Mftf/Section/NewsletterTemplateSection.xml +++ b/app/code/Magento/Newsletter/Test/Mftf/Section/NewsletterTemplateSection.xml @@ -7,6 +7,10 @@ --> <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="BasicFrontendNewsletterFormSection"> + <element name="newsletterEmail" type="input" selector="#newsletter"/> + <element name="subscribeButton" type="button" selector=".subscribe"/> + </section> <section name="BasicFieldNewsletterSection"> <element name="templateName" type="input" selector="#code"/> <element name="templateSubject" type="input" selector="#subject"/> diff --git a/app/code/Magento/Newsletter/Test/Mftf/Test/VerifyRegistredLinkDisplayedForGuestSubscriptionNoTest.xml b/app/code/Magento/Newsletter/Test/Mftf/Test/VerifyRegistredLinkDisplayedForGuestSubscriptionNoTest.xml new file mode 100644 index 0000000000000..b5cb4e2fa62bc --- /dev/null +++ b/app/code/Magento/Newsletter/Test/Mftf/Test/VerifyRegistredLinkDisplayedForGuestSubscriptionNoTest.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="VerifyRegistredLinkDisplayedForGuestSubscriptionNoTest"> + <before> + <!--Log in to Magento as admin.--> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <!--Allow Guest Subscription NO--> + <actionGroup ref="AssertAdminNewsletterConfigFieldGuestNotAllowedActionGroup" stepKey="amOnNewsletterConfigField"/> + <!--Log out from Magento admin.--> + <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + </before> + + <amOnPage url="{{StorefrontHomePage.url}}" stepKey="amOnStorefrontPage"/> + <fillField selector="{{BasicFrontendNewsletterFormSection.newsletterEmail}}" userInput="{{_defaultNewsletter.senderEmail}}" stepKey="fillTemplateEmail" /> + <click selector="{{BasicFrontendNewsletterFormSection.subscribeButton}}" stepKey="subscribe"/> + <waitForElement selector=".messages" stepKey="waitMessage"/> + </test> +</tests> From fea7701b47c07bd5f95e8cb535760dcef850ed2c Mon Sep 17 00:00:00 2001 From: "rostyslav.hymon" <rostyslav.hymon@transoftgroup.com> Date: Mon, 20 Jan 2020 11:28:40 +0200 Subject: [PATCH 0897/1143] MC-30229: Product compare shows products when it should be empty --- .../Controller/Product/Compare/Index.php | 13 ++------- .../Catalog/Helper/Product/Compare.php | 8 +----- .../Controller/Product/Compare/IndexTest.php | 28 ------------------- .../Controller/Product/CompareTest.php | 16 ----------- .../Catalog/Helper/Product/CompareTest.php | 13 --------- 5 files changed, 3 insertions(+), 75 deletions(-) diff --git a/app/code/Magento/Catalog/Controller/Product/Compare/Index.php b/app/code/Magento/Catalog/Controller/Product/Compare/Index.php index c0aa32a56ed17..3a1b4e7702f70 100644 --- a/app/code/Magento/Catalog/Controller/Product/Compare/Index.php +++ b/app/code/Magento/Catalog/Controller/Product/Compare/Index.php @@ -12,6 +12,8 @@ use Magento\Framework\View\Result\PageFactory; /** + * View products compare in frontend + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Index extends \Magento\Catalog\Controller\Product\Compare implements HttpGetActionInterface @@ -74,23 +76,12 @@ public function __construct( */ public function execute() { - $items = $this->getRequest()->getParam('items'); - $beforeUrl = $this->getRequest()->getParam(self::PARAM_NAME_URL_ENCODED); if ($beforeUrl) { $this->_catalogSession->setBeforeCompareUrl( $this->urlDecoder->decode($beforeUrl) ); } - - if ($items) { - $items = explode(',', $items); - /** @var \Magento\Catalog\Model\Product\Compare\ListCompare $list */ - $list = $this->_catalogProductCompareList; - $list->addProducts($items); - $resultRedirect = $this->resultRedirectFactory->create(); - return $resultRedirect->setPath('*/*/*'); - } return $this->resultPageFactory->create(); } } diff --git a/app/code/Magento/Catalog/Helper/Product/Compare.php b/app/code/Magento/Catalog/Helper/Product/Compare.php index d6d35c5c76dd8..49a90c590a440 100644 --- a/app/code/Magento/Catalog/Helper/Product/Compare.php +++ b/app/code/Magento/Catalog/Helper/Product/Compare.php @@ -14,6 +14,7 @@ * @api * @SuppressWarnings(PHPMD.LongVariable) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) * @since 100.0.2 */ class Compare extends \Magento\Framework\Url\Helper\Data @@ -145,16 +146,9 @@ public function __construct( */ public function getListUrl() { - $itemIds = []; - foreach ($this->getItemCollection() as $item) { - $itemIds[] = $item->getId(); - } - $params = [ - 'items' => implode(',', $itemIds), \Magento\Framework\App\ActionInterface::PARAM_NAME_URL_ENCODED => $this->getEncodedUrl() ]; - return $this->_getUrl('catalog/product_compare', $params); } diff --git a/app/code/Magento/Catalog/Test/Unit/Controller/Product/Compare/IndexTest.php b/app/code/Magento/Catalog/Test/Unit/Controller/Product/Compare/IndexTest.php index bf6f6cff9ad80..a2e784eef9f1b 100644 --- a/app/code/Magento/Catalog/Test/Unit/Controller/Product/Compare/IndexTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Controller/Product/Compare/IndexTest.php @@ -129,7 +129,6 @@ public function testExecute() ->method('getParam') ->willReturnMap( [ - ['items', null, null], ['uenc', null, $beforeUrl], ] ); @@ -141,34 +140,7 @@ public function testExecute() ->method('setBeforeCompareUrl') ->with($beforeUrl . '1') ->willReturnSelf(); - $this->listCompareMock->expects($this->never())->method('addProducts'); $this->redirectFactoryMock->expects($this->never())->method('create'); $this->index->execute(); } - - public function testExecuteWithItems() - { - $this->request->expects($this->any()) - ->method('getParam') - ->willReturnMap( - [ - ['items', null, '1,2,3'], - ['uenc', null, null], - ] - ); - $this->decoderMock->expects($this->never())->method('decode'); - $this->catalogSession->expects($this->never())->method('setBeforeCompareUrl'); - - $this->listCompareMock->expects($this->once()) - ->method('addProducts') - ->with([1, 2, 3]); - $redirect = $this->createPartialMock(\Magento\Framework\Controller\Result\Redirect::class, ['setPath']); - $redirect->expects($this->once()) - ->method('setPath') - ->with('*/*/*'); - $this->redirectFactoryMock->expects($this->once()) - ->method('create') - ->willReturn($redirect); - $this->index->execute(); - } } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Product/CompareTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Product/CompareTest.php index 0c3e81fd52e81..c303fb1fe6e0c 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Product/CompareTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Product/CompareTest.php @@ -96,22 +96,6 @@ public function testAddActionForDisabledProduct(): void $this->_assertCompareListEquals([]); } - /** - * Test comparing a product. - * - * @throws \Magento\Framework\Exception\NoSuchEntityException - */ - public function testIndexActionAddProducts() - { - $this->_requireVisitorWithNoProducts(); - $product = $this->productRepository->get('simple_product_2'); - $this->dispatch('catalog/product_compare/index/items/' . $product->getEntityId()); - - $this->assertRedirect($this->stringStartsWith('http://localhost/index.php/catalog/product_compare/index/')); - - $this->_assertCompareListEquals([$product->getEntityId()]); - } - /** * Test removing a product from compare list. * diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/CompareTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/CompareTest.php index f99344904f68e..6615815569fcf 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/CompareTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/CompareTest.php @@ -23,24 +23,11 @@ protected function setUp() $this->_helper = $this->_objectManager->get(\Magento\Catalog\Helper\Product\Compare::class); } - /** - * @magentoDataFixture Magento/Catalog/_files/multiple_products.php - * @magentoDbIsolation disabled - */ public function testGetListUrl() { /** @var $empty \Magento\Catalog\Helper\Product\Compare */ $empty = $this->_objectManager->create(\Magento\Catalog\Helper\Product\Compare::class); $this->assertContains('/catalog/product_compare/index/', $empty->getListUrl()); - - $this->_populateCompareList(); - $productRepository = $this->_objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); - $id1 = $productRepository->get('simple1')->getId(); - $id2 = $productRepository->get('simple2')->getId(); - $this->assertRegExp( - '#/catalog/product_compare/index/items/(?:' . $id1 . '%2C' . $id2 . '|' . $id2 . '%2C' . $id1. ')/#', - $this->_helper->getListUrl() - ); } public function testGetAddUrl() From a50d335e17ef518092afa453a35b64ef8bc088bc Mon Sep 17 00:00:00 2001 From: Yurii Sapiha <yurasapiga93@gmail.com> Date: Mon, 20 Jan 2020 11:28:58 +0200 Subject: [PATCH 0898/1143] MC-24892: Admin: Check Category products indexing when add/remove product in category and Product categories indexing when add/remove category in product --- .../Catalog/Model/GetCategoryByName.php | 43 ++++ .../Product/Save/CategoryIndexTest.php | 134 ++++++++++++ .../Indexer/Product/CategoryIndexTest.php | 203 ++++++++++++++++++ .../category_product_assigned_to_website.php | 61 ++++++ ...y_product_assigned_to_website_rollback.php | 42 ++++ .../_files/category_with_parent_anchor.php | 41 ++++ .../category_with_parent_anchor_rollback.php | 38 ++++ 7 files changed, 562 insertions(+) create mode 100644 dev/tests/integration/framework/Magento/TestFramework/Catalog/Model/GetCategoryByName.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Save/CategoryIndexTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/CategoryIndexTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/category_product_assigned_to_website.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/category_product_assigned_to_website_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/category_with_parent_anchor.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/category_with_parent_anchor_rollback.php diff --git a/dev/tests/integration/framework/Magento/TestFramework/Catalog/Model/GetCategoryByName.php b/dev/tests/integration/framework/Magento/TestFramework/Catalog/Model/GetCategoryByName.php new file mode 100644 index 0000000000000..75b123e2dc906 --- /dev/null +++ b/dev/tests/integration/framework/Magento/TestFramework/Catalog/Model/GetCategoryByName.php @@ -0,0 +1,43 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\TestFramework\Catalog\Model; + +use Magento\Catalog\Api\Data\CategoryInterface; +use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory; + +/** + * Load category by category name + */ +class GetCategoryByName +{ + /** @var CollectionFactory */ + private $categoryCollectionFactory; + + /** + * @param CollectionFactory $categoryCollectionFactory + */ + public function __construct(CollectionFactory $categoryCollectionFactory) + { + $this->categoryCollectionFactory = $categoryCollectionFactory; + } + + /** + * Load category by name. + * + * @param string $categoryName + * @return CategoryInterface + */ + public function execute(string $categoryName): CategoryInterface + { + $categoryCollection = $this->categoryCollectionFactory->create(); + + return $categoryCollection->addAttributeToFilter(CategoryInterface::KEY_NAME, $categoryName) + ->setPageSize(1) + ->getFirstItem(); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Save/CategoryIndexTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Save/CategoryIndexTest.php new file mode 100644 index 0000000000000..4d44afe831029 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Save/CategoryIndexTest.php @@ -0,0 +1,134 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Controller\Adminhtml\Product\Save; + +use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Helper\DefaultCategory; +use Magento\Catalog\Model\Indexer\Category\Product\TableMaintainer; +use Magento\Catalog\Model\ResourceModel\Product as ProductResource; +use Magento\Framework\App\Request\Http; +use Magento\Framework\DB\Adapter\AdapterInterface; +use Magento\Framework\Message\MessageInterface; +use Magento\Store\Model\Store; +use Magento\TestFramework\TestCase\AbstractBackendController; + +/** + * Checks category product index in cases when category unassigned from product + * + * @magentoDataFixture Magento/Catalog/_files/category_product_assigned_to_website.php + * @magentoAppArea adminhtml + * @magentoDbIsolation disabled + */ +class CategoryIndexTest extends AbstractBackendController +{ + /** @var ProductRepositoryInterface */ + private $productRepository; + + /** @var ProductInterface */ + private $product; + + /** @var TableMaintainer */ + private $tableMaintainer; + + /** @var ProductResource */ + private $productResource; + + /** @var AdapterInterface */ + private $connection; + + /** @var DefaultCategory */ + private $defaultCategoryHelper; + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + + $this->productRepository = $this->_objectManager->get(ProductRepositoryInterface::class); + $this->product = $this->productRepository->get('product_with_category'); + $this->tableMaintainer = $this->_objectManager->create(TableMaintainer::class); + $this->productResource = $this->_objectManager->get(ProductResource::class); + $this->connection = $this->productResource->getConnection(); + $this->defaultCategoryHelper = $this->_objectManager->get(DefaultCategory::class); + } + + /** + * @return void + */ + public function testUnassignCategory(): void + { + $postData = $this->preparePostData(); + $this->dispatchSaveProductRequest($postData); + $this->assertEmpty($this->fetchIndexData()); + } + + /** + * @magentoDataFixture Magento/Catalog/_files/category_product_assigned_to_website.php + * @magentoDataFixture Magento/Catalog/_files/category.php + * + * @return void + */ + public function testReassignCategory(): void + { + $postData = $this->preparePostData(333); + $this->dispatchSaveProductRequest($postData); + $result = $this->fetchIndexData(); + $this->assertNotEmpty($result); + $this->assertEquals(333, reset($result)['category_id']); + } + + /** + * Perform request + * + * @param array $postData + * @return void + */ + private function dispatchSaveProductRequest(array $postData): void + { + $this->getRequest()->setPostValue($postData); + $this->getRequest()->setMethod(Http::METHOD_POST); + $this->dispatch('backend/catalog/product/save/id/' . $this->product->getEntityId()); + $this->assertSessionMessages($this->equalTo(['You saved the product.']), MessageInterface::TYPE_SUCCESS); + } + + /** + * Prepare data to request + * + * @param int|null $newCategoryId + * @return array + */ + private function preparePostData(?int $newCategoryId = null): array + { + $this->product->getWebsiteIds(); + $data = $this->product->getData(); + unset($data['entity_id'], $data['category_ids']); + if ($newCategoryId) { + $data['category_ids'] = [$newCategoryId]; + } + + return ['product' => $data]; + } + + /** + * Fetch data from category product index table + * + * @return array + */ + private function fetchIndexData(): array + { + $tableName = $this->tableMaintainer->getMainTable(Store::DISTRO_STORE_ID); + $select = $this->connection->select(); + $select->from(['index_table' => $tableName], 'index_table.category_id') + ->where('index_table.product_id = ?', $this->product->getId()) + ->where('index_table.category_id != ?', $this->defaultCategoryHelper->getId()); + + return $this->connection->fetchAll($select); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/CategoryIndexTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/CategoryIndexTest.php new file mode 100644 index 0000000000000..06f083781aa26 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/CategoryIndexTest.php @@ -0,0 +1,203 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Model\Indexer\Product; + +use Magento\Catalog\Api\CategoryRepositoryInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Helper\DefaultCategory; +use Magento\Catalog\Model\Indexer\Category\Product\TableMaintainer; +use Magento\Catalog\Model\ResourceModel\Category as CategoryResource; +use Magento\Catalog\Model\ResourceModel\Product as ProductResource; +use Magento\Framework\DB\Adapter\AdapterInterface; +use Magento\Framework\ObjectManagerInterface; +use Magento\Store\Model\StoreManagerInterface; +use Magento\TestFramework\Catalog\Model\GetCategoryByName; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\Indexer\TestCase; + +/** + * Checks category products indexing + * + * @magentoAppArea adminhtml + * @magentoAppIsolation enabled + * @magentoDbIsolation disabled + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class CategoryIndexTest extends TestCase +{ + /** @var ObjectManagerInterface */ + private $objectManager; + + /** @var ProductRepositoryInterface */ + private $productRepository; + + /** @var StoreManagerInterface */ + private $storeManager; + + /** @var AdapterInterface */ + private $connection; + + /** @var TableMaintainer */ + private $tableMaintainer; + + /** @var ProductResource */ + private $productResource; + + /** @var CategoryRepositoryInterface */ + private $categoryRepository; + + /** @var CategoryResource */ + private $categoryResource; + + /** @var GetCategoryByName */ + private $getCategoryByName; + + /** @var DefaultCategory */ + private $defaultCategoryHelper; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + + $this->objectManager = Bootstrap::getObjectManager(); + $this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class); + $this->productResource = $this->objectManager->get(ProductResource::class); + $this->storeManager = $this->objectManager->get(StoreManagerInterface::class); + $this->connection = $this->productResource->getConnection(); + $this->tableMaintainer = $this->objectManager->get(TableMaintainer::class); + $this->categoryRepository = $this->objectManager->get(CategoryRepositoryInterface::class); + $this->categoryResource = $this->objectManager->get(CategoryResource::class); + $this->getCategoryByName = $this->objectManager->create(GetCategoryByName::class); + $this->defaultCategoryHelper = $this->objectManager->get(DefaultCategory::class); + } + + /** + * @magentoDataFixture Magento/Catalog/_files/category_with_parent_anchor.php + * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + * + * @dataProvider assignCategoriesDataProvider + * + * @param string $categoryName + * @param int $expectedItemsCount + * @return void + */ + public function testProductAssignCategory(string $categoryName, int $expectedItemsCount): void + { + $product = $this->productRepository->get('simple2'); + $category = $this->getCategoryByName->execute($categoryName); + $product->setCategoryIds(array_merge($product->getCategoryIds(), [$category->getId()])); + $this->productResource->save($product); + $result = $this->getIndexRecordsByProductId((int)$product->getId()); + $this->assertEquals($expectedItemsCount, $result); + } + + /** + * @return array + */ + public function assignCategoriesDataProvider(): array + { + return [ + 'assign_to_category' => [ + 'category_name' => 'Parent category', + 'expected_records_count' => 1, + ], + 'assign_to_category_with_parent_anchor_category' => [ + 'category_name' => 'Child category', + 'expected_records_count' => 2, + ], + ]; + } + + /** + * @magentoDataFixture Magento/Catalog/_files/category_with_parent_anchor.php + * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + * + * @dataProvider assignProductsDataProvider + * + * @param string $categoryName + * @param int $expectedCount + * @return void + */ + public function testCategoryAssignProduct(string $categoryName, int $expectedCount): void + { + $product = $this->productRepository->get('simple2'); + $category = $this->getCategoryByName->execute($categoryName); + $data = ['posted_products' => [$product->getId() => 0]]; + $category->addData($data); + $this->categoryResource->save($category); + $result = $this->getIndexRecordsByProductId((int)$product->getId()); + $this->assertEquals($expectedCount, $result); + } + + /** + * @return array + */ + public function assignProductsDataProvider(): array + { + return [ + 'assign_product_to_category' => [ + 'category_name' => 'Parent category', + 'expected_records_count' => 1, + ], + 'assign_product_to_category_with_parent_anchor_category' => [ + 'category_name' => 'Child category', + 'expected_records_count' => 2, + ], + ]; + } + + /** + * @magentoDataFixture Magento/Catalog/_files/category_product_assigned_to_website.php + * @magentoDataFixture Magento/Catalog/_files/category_with_parent_anchor.php + * + * @return void + */ + public function testCategoryMove(): void + { + $product = $this->productRepository->get('product_with_category'); + $category = $this->getCategoryByName->execute('Category with product'); + $newParentCategory = $this->getCategoryByName->execute('Parent category'); + $afterCategory = $this->getCategoryByName->execute('Child category'); + $category->move($newParentCategory->getId(), $afterCategory->getId()); + $result = $this->getIndexRecordsByProductId((int)$product->getId()); + $this->assertEquals(2, $result); + } + + /** + * @magentoDataFixture Magento/Catalog/_files/category_product_assigned_to_website.php + * + * @return void + */ + public function testDeleteProduct(): void + { + $product = $this->productRepository->get('product_with_category'); + $this->productRepository->delete($product); + $result = $this->getIndexRecordsByProductId((int)$product->getId()); + $this->assertEmpty($result); + } + + /** + * Fetch data from category product index table + * + * @param int $productId + * @return int + */ + private function getIndexRecordsByProductId(int $productId): int + { + $tableName = $this->tableMaintainer->getMainTable((int)$this->storeManager->getStore()->getId()); + $select = $this->connection->select(); + $select->from(['index_table' => $tableName], new \Zend_Db_Expr('COUNT(*)')) + ->where('index_table.product_id = ?', $productId) + ->where('index_table.category_id != ?', $this->defaultCategoryHelper->getId()); + + return (int)$this->connection->fetchOne($select); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/category_product_assigned_to_website.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/category_product_assigned_to_website.php new file mode 100644 index 0000000000000..b4fd3d997c924 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/category_product_assigned_to_website.php @@ -0,0 +1,61 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\CategoryRepositoryInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\CategoryFactory; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Catalog\Model\Product\Type; +use Magento\Catalog\Model\Product\Visibility; +use Magento\Catalog\Model\ProductFactory; +use Magento\Framework\ObjectManagerInterface; +use Magento\Store\Api\WebsiteRepositoryInterface; +use Magento\TestFramework\Helper\Bootstrap; + +/** @var ObjectManagerInterface $objectManager */ +$objectManager = Bootstrap::getObjectManager(); +/** @var CategoryFactory $categoryFactory */ +$categoryFactory = $objectManager->get(CategoryFactory::class); +/** @var ProductFactory $productFactory */ +$productFactory = $objectManager->get(ProductFactory::class); +/** @var CategoryRepositoryInterface $categoryRepository */ +$categoryRepository = $objectManager->get(CategoryRepositoryInterface::class); +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->get(ProductRepositoryInterface::class); +/** @var WebsiteRepositoryInterface $websiteRepository */ +$websiteRepository = $objectManager->get(WebsiteRepositoryInterface::class); +$defaultWebsiteId = $websiteRepository->get('base')->getId(); +$category = $categoryFactory->create(); +$categoryData = [ + 'name' => 'Category with product', + 'attribute_set_id' => $category->getDefaultAttributeSetId(), + 'parent_id' => 2, + 'is_active' => true, +]; +$category->setData($categoryData); +$category = $categoryRepository->save($category); + +$product = $productFactory->create(); +$productData = [ + 'type_id' => Type::TYPE_SIMPLE, + 'attribute_set_id' => $product->getDefaultAttributeSetId(), + 'sku' => 'product_with_category', + 'website_ids' => [$defaultWebsiteId], + 'name' => 'Product with category', + 'price' => 10, + 'stock_data' => [ + 'use_config_manage_stock' => 1, + 'qty' => 100, + 'is_qty_decimal' => 0, + 'is_in_stock' => 1, + ], + 'category_ids' => [2, $category->getId()], + 'visibility' => Visibility::VISIBILITY_BOTH, + 'status' => Status::STATUS_ENABLED, +]; +$product->setData($productData); +$productRepository->save($product); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/category_product_assigned_to_website_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/category_product_assigned_to_website_rollback.php new file mode 100644 index 0000000000000..aab3c6f938248 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/category_product_assigned_to_website_rollback.php @@ -0,0 +1,42 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\CategoryRepositoryInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Registry; +use Magento\TestFramework\Catalog\Model\GetCategoryByName; +use Magento\TestFramework\Helper\Bootstrap; + +/** @var ObjectManagerInterface $objectManager */ +$objectManager = Bootstrap::getObjectManager(); +/** @var Registry $registry */ +$registry = $objectManager->get(Registry::class); +/** @var CategoryRepositoryInterface $categoryRepository */ +$categoryRepository = $objectManager->create(CategoryRepositoryInterface::class); +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->get(ProductRepositoryInterface::class); +/** @var GetCategoryByName $getCategoryByName */ +$getCategoryByName = $objectManager->create(GetCategoryByName::class); +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); + +try { + $productRepository->deleteById('product_with_category'); +} catch (NoSuchEntityException $e) { + // product already deleted +} + +$category = $getCategoryByName->execute('Category with product'); + +if ($category->getId()) { + $categoryRepository->delete($category); +} + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/category_with_parent_anchor.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/category_with_parent_anchor.php new file mode 100644 index 0000000000000..abdec4954135b --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/category_with_parent_anchor.php @@ -0,0 +1,41 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Model\CategoryFactory; +use Magento\Catalog\Model\CategoryRepository; +use Magento\Framework\ObjectManagerInterface; +use Magento\TestFramework\Helper\Bootstrap; + +/** @var ObjectManagerInterface $objectManager */ +$objectManager = Bootstrap::getObjectManager(); +/** @var CategoryFactory $categoryFactory */ +$categoryFactory = $objectManager->get(CategoryFactory::class); +/** @var CategoryRepository $categoryRepository */ +$categoryRepository = $objectManager->create(CategoryRepository::class); +$parentCategory = $categoryFactory->create(); +$attributeSetId = $parentCategory->getDefaultAttributeSetId(); +$parentCategory->isObjectNew(true); +$parentCategoryData = [ + 'name' => 'Parent category', + 'attribute_set_id' => $attributeSetId, + 'parent_id' => 2, + 'is_active' => true, + 'is_anchor' => true, +]; +$parentCategory->setData($parentCategoryData); +$parentCategoryId = $categoryRepository->save($parentCategory)->getId(); + +$category = $categoryFactory->create(); +$category->isObjectNew(true); +$categoryData = [ + 'name' => 'Child category', + 'attribute_set_id' => $attributeSetId, + 'parent_id' => $parentCategoryId, + 'is_active' => true, +]; +$category->setData($categoryData); +$categoryRepository->save($category); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/category_with_parent_anchor_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/category_with_parent_anchor_rollback.php new file mode 100644 index 0000000000000..35a0ee38c8cfe --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/category_with_parent_anchor_rollback.php @@ -0,0 +1,38 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\CategoryRepositoryInterface; +use Magento\Catalog\Api\Data\CategoryInterface; +use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Registry; +use Magento\TestFramework\Helper\Bootstrap; + +/** @var ObjectManagerInterface $objectManager */ +$objectManager = Bootstrap::getObjectManager(); +/** @var Registry $registry */ +$registry = $objectManager->get(Registry::class); +/** @var CollectionFactory $categoryCollectionFactory */ +$categoryCollectionFactory = $objectManager->get(CollectionFactory::class); +/** @var CategoryRepositoryInterface $categoryRepository */ +$categoryRepository = $objectManager->create(CategoryRepositoryInterface::class); + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); + +$categoryCollection = $categoryCollectionFactory->create(); +$categoryCollection->addAttributeToFilter( + CategoryInterface::KEY_NAME, + ['in' => ['Parent category', 'Child category']] +); + +foreach ($categoryCollection as $category) { + $categoryRepository->delete($category); +} + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); From f060ee7d46a5a88b97c846c1c37fd3d3c447c32d Mon Sep 17 00:00:00 2001 From: Oleh Usik <o.usik@atwix.com> Date: Mon, 20 Jan 2020 12:18:10 +0200 Subject: [PATCH 0899/1143] fixed code style issue --- .../Magento/Newsletter/Controller/Subscriber/NewAction.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Newsletter/Controller/Subscriber/NewAction.php b/app/code/Magento/Newsletter/Controller/Subscriber/NewAction.php index 0944ea4626586..c27a4db926d06 100644 --- a/app/code/Magento/Newsletter/Controller/Subscriber/NewAction.php +++ b/app/code/Magento/Newsletter/Controller/Subscriber/NewAction.php @@ -173,7 +173,8 @@ public function execute() $this->messageManager->addSuccessMessage($message); } catch (LocalizedException $e) { $this->messageManager->addComplexErrorMessage( - 'localizedSubscriptionErrorMessage', ['message' => $e->getMessage()] + 'localizedSubscriptionErrorMessage', + ['message' => $e->getMessage()] ); } catch (\Exception $e) { $this->messageManager->addExceptionMessage($e, __('Something went wrong with the subscription.')); From a4aa69b8e0a2343a8966c7fc243f68bf3b576ecc Mon Sep 17 00:00:00 2001 From: Michele Fantetti <mfantetti@ittweb.net> Date: Mon, 20 Jan 2020 11:39:48 +0100 Subject: [PATCH 0900/1143] Add frontend template hints status command after suggestions --- .../Console/Command/TemplateHintsStatusCommand.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php b/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php index 81df48d6df49f..d9af42ee33cb4 100644 --- a/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php +++ b/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php @@ -9,6 +9,7 @@ use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +use Magento\Framework\App\Config\ScopeConfigInterface; class TemplateHintsStatusCommand extends Command { @@ -24,25 +25,23 @@ class TemplateHintsStatusCommand extends Command const SUCCESS_MESSAGE = "Template hints are %status"; /** - * @var \Magento\Framework\App\Config\ScopeConfigInterface + * @var ScopeConfigInterface */ protected $scopeConfig; /** * Initialize dependencies. * - * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig + * @param ScopeConfigInterface $scopeConfig */ - public function __construct( - \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig - ) + public function __construct(ScopeConfigInterface $scopeConfig) { parent::__construct(); $this->scopeConfig = $scopeConfig; } /** - * {@inheritdoc} + * @inheritdoc */ protected function configure() { @@ -60,6 +59,6 @@ protected function execute(InputInterface $input, OutputInterface $output) { $templateHintsStatus = ($this->scopeConfig->isSetFlag('dev/debug/template_hints_storefront', 'default')) ? 'enabled' : 'disabled'; $templateHintsMessage = __(self::SUCCESS_MESSAGE, ['status' => $templateHintsStatus]); - $output->writeln("<info>". $templateHintsMessage . "</info>"); + $output->writeln("<info>" . $templateHintsMessage . "</info>"); } } From a7928e2ec12f685159e6e92799d7831c4f0014be Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Mon, 20 Jan 2020 13:17:01 +0200 Subject: [PATCH 0901/1143] MC-30299: [Magento On-Premise] Incorrect refund when discount applied --- .../Model/Order/Creditmemo/Total/Discount.php | 45 +++++++++++++++++-- .../Order/Creditmemo/Total/DiscountTest.php | 16 ++++--- .../Quote/Address/Total/ShippingDiscount.php | 4 ++ 3 files changed, 55 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo/Total/Discount.php b/app/code/Magento/Sales/Model/Order/Creditmemo/Total/Discount.php index 06bfbcf24daac..43a66382aa1c2 100644 --- a/app/code/Magento/Sales/Model/Order/Creditmemo/Total/Discount.php +++ b/app/code/Magento/Sales/Model/Order/Creditmemo/Total/Discount.php @@ -5,17 +5,38 @@ */ namespace Magento\Sales\Model\Order\Creditmemo\Total; +use Magento\Tax\Model\Config; + /** * Discount total calculator */ class Discount extends AbstractTotal { + /** + * @var Config + */ + private $taxConfig; + + /** + * @param Config $taxConfig + * @param array $data + */ + public function __construct( + Config $taxConfig, + array $data = [] + ) { + $this->taxConfig = $taxConfig; + + parent::__construct($data); + } + /** * Collect discount * * @param \Magento\Sales\Model\Order\Creditmemo $creditmemo * @return $this * @throws \Magento\Framework\Exception\LocalizedException + * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ public function collect(\Magento\Sales\Model\Order\Creditmemo $creditmemo) { @@ -31,7 +52,7 @@ public function collect(\Magento\Sales\Model\Order\Creditmemo $creditmemo) * Calculate how much shipping discount should be applied * basing on how much shipping should be refunded. */ - $baseShippingAmount = $this->getBaseShippingAmount($creditmemo); + $baseShippingAmount = $this->getBaseShippingAmount($creditmemo, $order); /** * If credit memo's shipping amount is set and Order's shipping amount is 0, @@ -43,10 +64,14 @@ public function collect(\Magento\Sales\Model\Order\Creditmemo $creditmemo) ); } if ($baseShippingAmount) { + $orderBaseShippingAmount = $this->isShippingInclTax((int)$order->getStoreId()) ? + $order->getBaseShippingInclTax() : $order->getBaseShippingAmount(); + $orderShippingAmount = $this->isShippingInclTax((int)$order->getStoreId()) ? + $order->getShippingInclTax() : $order->getShippingAmount(); $baseShippingDiscount = $baseShippingAmount * $order->getBaseShippingDiscountAmount() / - $order->getBaseShippingAmount(); - $shippingDiscount = $order->getShippingAmount() * $baseShippingDiscount / $order->getBaseShippingAmount(); + $orderBaseShippingAmount; + $shippingDiscount = $orderShippingAmount * $baseShippingDiscount / $orderBaseShippingAmount; $totalDiscountAmount = $totalDiscountAmount + $shippingDiscount; $baseTotalDiscountAmount = $baseTotalDiscountAmount + $baseShippingDiscount; } @@ -104,8 +129,20 @@ private function getBaseShippingAmount(\Magento\Sales\Model\Order\Creditmemo $cr if (!$baseShippingAmount) { $baseShippingInclTax = (float)$creditmemo->getBaseShippingInclTax(); $baseShippingTaxAmount = (float)$creditmemo->getBaseShippingTaxAmount(); - $baseShippingAmount = $baseShippingInclTax - $baseShippingTaxAmount; + $baseShippingAmount = $this->isShippingInclTax((int)$creditmemo->getStoreId()) ? + $baseShippingInclTax : $baseShippingInclTax - $baseShippingTaxAmount; } return $baseShippingAmount; } + + /** + * Returns whether the user specified a shipping amount that already includes tax + * + * @param int $storeId + * @return bool + */ + private function isShippingInclTax(int $storeId): bool + { + return (bool)$this->taxConfig->displaySalesShippingInclTax($storeId); + } } diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/Total/DiscountTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/Total/DiscountTest.php index 8a45aa8c7958e..07826ff1d0cbd 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/Total/DiscountTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/Total/DiscountTest.php @@ -6,9 +6,6 @@ namespace Magento\Sales\Test\Unit\Model\Order\Creditmemo\Total; -/** - * Class DiscountTest - */ class DiscountTest extends \PHPUnit\Framework\TestCase { /** @@ -36,6 +33,11 @@ class DiscountTest extends \PHPUnit\Framework\TestCase */ protected $orderItemMock; + /** + * @var \Magento\Tax\Model\Config|\PHPUnit\Framework\MockObject\MockObject + */ + private $taxConfig; + protected function setUp() { $this->orderMock = $this->createPartialMock( @@ -54,7 +56,9 @@ protected function setUp() 'getHasChildren', 'getBaseCost', 'getQty', 'getOrderItem', 'setDiscountAmount', 'setBaseDiscountAmount', 'isLast' ]); - $this->total = new \Magento\Sales\Model\Order\Creditmemo\Total\Discount(); + $this->taxConfig = $this->createMock(\Magento\Tax\Model\Config::class); + + $this->total = new \Magento\Sales\Model\Order\Creditmemo\Total\Discount($this->taxConfig); } public function testCollect() @@ -74,7 +78,7 @@ public function testCollect() $this->orderMock->expects($this->once()) ->method('getBaseShippingDiscountAmount') ->willReturn(1); - $this->orderMock->expects($this->exactly(3)) + $this->orderMock->expects($this->exactly(2)) ->method('getBaseShippingAmount') ->willReturn(1); $this->orderMock->expects($this->once()) @@ -150,7 +154,7 @@ public function testCollectNoBaseShippingAmount() $this->orderMock->expects($this->once()) ->method('getBaseShippingDiscountAmount') ->willReturn(1); - $this->orderMock->expects($this->exactly(3)) + $this->orderMock->expects($this->exactly(2)) ->method('getBaseShippingAmount') ->willReturn(1); $this->orderMock->expects($this->once()) diff --git a/app/code/Magento/SalesRule/Model/Quote/Address/Total/ShippingDiscount.php b/app/code/Magento/SalesRule/Model/Quote/Address/Total/ShippingDiscount.php index 53adcd268f81d..9f116cedcb340 100644 --- a/app/code/Magento/SalesRule/Model/Quote/Address/Total/ShippingDiscount.php +++ b/app/code/Magento/SalesRule/Model/Quote/Address/Total/ShippingDiscount.php @@ -53,6 +53,10 @@ public function collect(Quote $quote, ShippingAssignment $shippingAssignment, To $address->setShippingDiscountAmount(0); $address->setBaseShippingDiscountAmount(0); + if ($total->getShippingAmountForDiscount() !== null) { + $address->setShippingAmountForDiscount($total->getShippingAmountForDiscount()); + $address->setBaseShippingAmountForDiscount($total->getBaseShippingAmountForDiscount()); + } if ($address->getShippingAmount()) { $this->calculator->processShippingAmount($address); $total->addTotalAmount(DiscountCollector::COLLECTOR_TYPE_CODE, -$address->getShippingDiscountAmount()); From e8a622b555e801a884b1f0ac1c071633e8fc381a Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Mon, 20 Jan 2020 13:22:35 +0200 Subject: [PATCH 0902/1143] MC-30304: CSV product export ignores stock filter --- .../Model/Export/Product.php | 28 +++-- .../Model/Export/Product/CategoryFilter.php | 31 +++++ .../Model/Export/Product/Stock.php | 111 ++++++++++++++++++ .../Export/Product/StockStatusFilter.php | 58 +++++++++ .../Model/Export/ProductFilterInterface.php | 22 ++++ .../Model/Export/ProductFilters.php | 39 ++++++ .../Magento/CatalogImportExport/etc/di.xml | 9 ++ .../Model/Export/ProductTest.php | 80 +++++++++++++ 8 files changed, 367 insertions(+), 11 deletions(-) create mode 100644 app/code/Magento/CatalogImportExport/Model/Export/Product/CategoryFilter.php create mode 100644 app/code/Magento/CatalogImportExport/Model/Export/Product/Stock.php create mode 100644 app/code/Magento/CatalogImportExport/Model/Export/Product/StockStatusFilter.php create mode 100644 app/code/Magento/CatalogImportExport/Model/Export/ProductFilterInterface.php create mode 100644 app/code/Magento/CatalogImportExport/Model/Export/ProductFilters.php diff --git a/app/code/Magento/CatalogImportExport/Model/Export/Product.php b/app/code/Magento/CatalogImportExport/Model/Export/Product.php index 5baa4b4274be5..530bf6b1a0057 100644 --- a/app/code/Magento/CatalogImportExport/Model/Export/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Export/Product.php @@ -5,12 +5,13 @@ */ namespace Magento\CatalogImportExport\Model\Export; +use Magento\Catalog\Model\Product as ProductEntity; use Magento\Catalog\Model\ResourceModel\Product\Option\Collection; +use Magento\CatalogImportExport\Model\Import\Product as ImportProduct; use Magento\CatalogImportExport\Model\Import\Product\CategoryProcessor; +use Magento\Framework\App\ObjectManager; use Magento\ImportExport\Model\Import; -use \Magento\Store\Model\Store; -use \Magento\CatalogImportExport\Model\Import\Product as ImportProduct; -use Magento\Catalog\Model\Product as ProductEntity; +use Magento\Store\Model\Store; /** * Export entity product model @@ -21,6 +22,8 @@ * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.ExcessiveParameterList) + * @SuppressWarnings(PHPMD.ExcessiveClassLength) + * @SuppressWarnings(PHPMD.TooManyMethods) * @since 100.0.2 */ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity @@ -348,6 +351,10 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity * @var string */ private $productEntityLinkField; + /** + * @var ProductFilterInterface + */ + private $filter; /** * Product constructor. @@ -369,6 +376,7 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity * @param ProductEntity\LinkTypeProvider $linkTypeProvider * @param RowCustomizerInterface $rowCustomizer * @param array $dateAttrCodes + * @param ProductFilterInterface $filter * @throws \Magento\Framework\Exception\LocalizedException */ public function __construct( @@ -388,7 +396,8 @@ public function __construct( \Magento\CatalogImportExport\Model\Export\Product\Type\Factory $_typeFactory, \Magento\Catalog\Model\Product\LinkTypeProvider $linkTypeProvider, \Magento\CatalogImportExport\Model\Export\RowCustomizerInterface $rowCustomizer, - array $dateAttrCodes = [] + array $dateAttrCodes = [], + ?ProductFilterInterface $filter = null ) { $this->_entityCollectionFactory = $collectionFactory; $this->_exportConfig = $exportConfig; @@ -404,6 +413,7 @@ public function __construct( $this->_linkTypeProvider = $linkTypeProvider; $this->rowCustomizer = $rowCustomizer; $this->dateAttrCodes = array_merge($this->dateAttrCodes, $dateAttrCodes); + $this->filter = $filter ?? ObjectManager::getInstance()->get(ProductFilterInterface::class); parent::__construct($localeDate, $config, $resource, $storeManager); @@ -819,9 +829,11 @@ protected function getItemsPerPage() case 'g': $memoryLimit *= 1024; // fall-through intentional + // no break case 'm': $memoryLimit *= 1024; // fall-through intentional + // no break case 'k': $memoryLimit *= 1024; break; @@ -913,12 +925,7 @@ protected function _prepareEntityCollection(\Magento\Eav\Model\Entity\Collection $exportFilter = !empty($this->_parameters[\Magento\ImportExport\Model\Export::FILTER_ELEMENT_GROUP]) ? $this->_parameters[\Magento\ImportExport\Model\Export::FILTER_ELEMENT_GROUP] : []; - if (isset($exportFilter['category_ids']) - && trim($exportFilter['category_ids']) - && $collection instanceof \Magento\Catalog\Model\ResourceModel\Product\Collection - ) { - $collection->addCategoriesFilter(['in' => explode(',', $exportFilter['category_ids'])]); - } + $collection = $this->filter->filter($collection, $exportFilter); return parent::_prepareEntityCollection($collection); } @@ -979,7 +986,6 @@ protected function loadCollection(): array $collection = $this->_getEntityCollection(); foreach (array_keys($this->_storeIdToCode) as $storeId) { $collection->setOrder('entity_id', 'asc'); - $this->_prepareEntityCollection($collection); $collection->setStoreId($storeId); $collection->load(); foreach ($collection as $itemId => $item) { diff --git a/app/code/Magento/CatalogImportExport/Model/Export/Product/CategoryFilter.php b/app/code/Magento/CatalogImportExport/Model/Export/Product/CategoryFilter.php new file mode 100644 index 0000000000000..2907135695b20 --- /dev/null +++ b/app/code/Magento/CatalogImportExport/Model/Export/Product/CategoryFilter.php @@ -0,0 +1,31 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\CatalogImportExport\Model\Export\Product; + +use Magento\Catalog\Model\ResourceModel\Product\Collection; +use Magento\CatalogImportExport\Model\Export\ProductFilterInterface; + +/** + * Category filter for products export + */ +class CategoryFilter implements ProductFilterInterface +{ + private const NAME = 'category_ids'; + + /** + * @inheritDoc + */ + public function filter(Collection $collection, array $filters): Collection + { + $value = trim($filters[self::NAME] ?? ''); + if ($value) { + $collection->addCategoriesFilter(['in' => explode(',', $value)]); + } + return $collection; + } +} diff --git a/app/code/Magento/CatalogImportExport/Model/Export/Product/Stock.php b/app/code/Magento/CatalogImportExport/Model/Export/Product/Stock.php new file mode 100644 index 0000000000000..3648487df02ec --- /dev/null +++ b/app/code/Magento/CatalogImportExport/Model/Export/Product/Stock.php @@ -0,0 +1,111 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\CatalogImportExport\Model\Export\Product; + +use Magento\Catalog\Model\ResourceModel\Product\Collection; +use Magento\CatalogInventory\Model\Configuration; +use Magento\CatalogInventory\Model\ResourceModel\Stock\Item as StockItemResourceModel; +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Store\Model\ScopeInterface; + +/** + * Stock status collection filter + */ +class Stock +{ + /** + * @var ScopeConfigInterface + */ + private $scopeConfig; + /** + * @var StockItemResourceModel + */ + private $stockItemResourceModel; + + /** + * @param ScopeConfigInterface $scopeConfig + * @param StockItemResourceModel $stockItemResourceModel + */ + public function __construct( + ScopeConfigInterface $scopeConfig, + StockItemResourceModel $stockItemResourceModel + ) { + $this->scopeConfig = $scopeConfig; + $this->stockItemResourceModel = $stockItemResourceModel; + } + + /** + * Filter provided collection to return only "in stock" products + * + * @param Collection $collection + * @return Collection + */ + public function addInStockFilterToCollection(Collection $collection): Collection + { + $manageStock = $this->scopeConfig->getValue( + Configuration::XML_PATH_MANAGE_STOCK, + ScopeInterface::SCOPE_STORE + ); + $cond = [ + '{{table}}.use_config_manage_stock = 0 AND {{table}}.manage_stock=1 AND {{table}}.is_in_stock=1', + '{{table}}.use_config_manage_stock = 0 AND {{table}}.manage_stock=0' + ]; + + if ($manageStock) { + $cond[] = '{{table}}.use_config_manage_stock = 1 AND {{table}}.is_in_stock=1'; + } else { + $cond[] = '{{table}}.use_config_manage_stock = 1'; + } + return $this->addFilterToCollection($collection, '(' . join(') OR (', $cond) . ')'); + } + + /** + * Filter provided collection to return only "out of stock" products + * + * @param Collection $collection + * @return Collection + */ + public function addOutOfStockFilterToCollection(Collection $collection): Collection + { + $manageStock = $this->scopeConfig->getValue( + Configuration::XML_PATH_MANAGE_STOCK, + ScopeInterface::SCOPE_STORE + ); + $cond = [ + '{{table}}.use_config_manage_stock = 0 AND {{table}}.manage_stock=1 AND {{table}}.is_in_stock=0', + ]; + + if ($manageStock) { + $cond[] = '{{table}}.use_config_manage_stock = 1 AND {{table}}.is_in_stock=0'; + } + return $this->addFilterToCollection($collection, '(' . join(') OR (', $cond) . ')'); + } + + /** + * Add stock status filter to the collection + * + * @param Collection $collection + * @param string $condition + * @return Collection + */ + private function addFilterToCollection(Collection $collection, string $condition): Collection + { + $condition = str_replace( + '{{table}}', + 'inventory_stock_item_filter', + '({{table}}.product_id=e.entity_id) AND (' . $condition . ')' + ); + $collection->getSelect() + ->joinInner( + ['inventory_stock_item_filter' => $this->stockItemResourceModel->getMainTable()], + $condition, + [] + ); + return $collection; + } +} diff --git a/app/code/Magento/CatalogImportExport/Model/Export/Product/StockStatusFilter.php b/app/code/Magento/CatalogImportExport/Model/Export/Product/StockStatusFilter.php new file mode 100644 index 0000000000000..9a57e58669729 --- /dev/null +++ b/app/code/Magento/CatalogImportExport/Model/Export/Product/StockStatusFilter.php @@ -0,0 +1,58 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\CatalogImportExport\Model\Export\Product; + +use Magento\Catalog\Model\ResourceModel\Product\Collection; +use Magento\CatalogImportExport\Model\Export\ProductFilterInterface; +use Magento\Framework\App\Config\ScopeConfigInterface; + +/** + * Stock status filter for products export + */ +class StockStatusFilter implements ProductFilterInterface +{ + private const NAME = 'quantity_and_stock_status'; + private const IN_STOCK = '1'; + private const OUT_OF_STOCK = '0'; + /** + * @var Stock + */ + private $stockHelper; + /** + * @var ScopeConfigInterface + */ + private $scopeConfig; + + /** + * @param Stock $stockHelper + * @param ScopeConfigInterface $scopeConfig + */ + public function __construct( + Stock $stockHelper, + ScopeConfigInterface $scopeConfig + ) { + $this->stockHelper = $stockHelper; + $this->scopeConfig = $scopeConfig; + } + /** + * @inheritDoc + */ + public function filter(Collection $collection, array $filters): Collection + { + $value = $filters[self::NAME] ?? ''; + switch ($value) { + case self::IN_STOCK: + $this->stockHelper->addInStockFilterToCollection($collection); + break; + case self::OUT_OF_STOCK: + $this->stockHelper->addOutOfStockFilterToCollection($collection); + break; + } + return $collection; + } +} diff --git a/app/code/Magento/CatalogImportExport/Model/Export/ProductFilterInterface.php b/app/code/Magento/CatalogImportExport/Model/Export/ProductFilterInterface.php new file mode 100644 index 0000000000000..30985f3dc8cd7 --- /dev/null +++ b/app/code/Magento/CatalogImportExport/Model/Export/ProductFilterInterface.php @@ -0,0 +1,22 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\CatalogImportExport\Model\Export; + +use Magento\Catalog\Model\ResourceModel\Product\Collection; + +interface ProductFilterInterface +{ + /** + * Filter provided product collection + * + * @param Collection $collection + * @param array $filters + * @return Collection + */ + public function filter(Collection $collection, array $filters): Collection; +} diff --git a/app/code/Magento/CatalogImportExport/Model/Export/ProductFilters.php b/app/code/Magento/CatalogImportExport/Model/Export/ProductFilters.php new file mode 100644 index 0000000000000..49e1be8496d30 --- /dev/null +++ b/app/code/Magento/CatalogImportExport/Model/Export/ProductFilters.php @@ -0,0 +1,39 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\CatalogImportExport\Model\Export; + +use Magento\Catalog\Model\ResourceModel\Product\Collection; + +/** + * Product filters pool for export + */ +class ProductFilters implements ProductFilterInterface +{ + /** + * @var ProductFilterInterface[] + */ + private $filters; + /** + * @param ProductFilterInterface[] $filters + */ + public function __construct(array $filters = []) + { + $this->filters = $filters; + } + + /** + * @inheritDoc + */ + public function filter(Collection $collection, array $filters): Collection + { + foreach ($this->filters as $filter) { + $collection = $filter->filter($collection, $filters); + } + return $collection; + } +} diff --git a/app/code/Magento/CatalogImportExport/etc/di.xml b/app/code/Magento/CatalogImportExport/etc/di.xml index 4e2fe390e0b17..0126a7752dba3 100644 --- a/app/code/Magento/CatalogImportExport/etc/di.xml +++ b/app/code/Magento/CatalogImportExport/etc/di.xml @@ -8,6 +8,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <preference for="Magento\CatalogImportExport\Model\Export\RowCustomizerInterface" type="Magento\CatalogImportExport\Model\Export\RowCustomizer\Composite" /> <preference for="Magento\CatalogImportExport\Model\StockItemImporterInterface" type="Magento\CatalogImportExport\Model\StockItemImporter" /> + <preference for="Magento\CatalogImportExport\Model\Export\ProductFilterInterface" type="Magento\CatalogImportExport\Model\Export\ProductFilters" /> <type name="Magento\ImportExport\Model\Import"> <plugin name="catalogProductFlatIndexerImport" type="Magento\CatalogImportExport\Model\Indexer\Product\Flat\Plugin\Import" /> <plugin name="invalidatePriceIndexerOnImport" type="Magento\CatalogImportExport\Model\Indexer\Product\Price\Plugin\Import" /> @@ -35,4 +36,12 @@ <argument name="validationState" xsi:type="object">Magento\Framework\Config\ValidationState\Required</argument> </arguments> </type> + <type name="Magento\CatalogImportExport\Model\Export\ProductFilters"> + <arguments> + <argument name="filters" xsi:type="array"> + <item name="category_ids" xsi:type="object">Magento\CatalogImportExport\Model\Export\Product\CategoryFilter</item> + <item name="quantity_and_stock_status" xsi:type="object">Magento\CatalogImportExport\Model\Export\Product\StockStatusFilter</item> + </argument> + </arguments> + </type> </config> diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Export/ProductTest.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Export/ProductTest.php index 4753d947e9d3c..508560d000271 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Export/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Export/ProductTest.php @@ -535,4 +535,84 @@ public function testExportProductWithTwoWebsites() $reinitiableConfig->setValue('catalog/price/scope', \Magento\Store\Model\Store::PRICE_SCOPE_GLOBAL); $switchPriceScope->execute($observer); } + + /** + * Verify that "stock status" filter correctly applies to export result + * + * @param string $value + * @param array $productsIncluded + * @param array $productsNotIncluded + * @magentoDataFixture Magento/Catalog/_files/multiple_products_with_few_out_of_stock.php + * @dataProvider filterByQuantityAndStockStatusDataProvider + */ + public function testFilterByQuantityAndStockStatus( + string $value, + array $productsIncluded, + array $productsNotIncluded + ) { + $exportData = $this->doExport(['quantity_and_stock_status' => $value]); + foreach ($productsIncluded as $productName) { + $this->assertContains($productName, $exportData); + } + foreach ($productsNotIncluded as $productName) { + $this->assertNotContains($productName, $exportData); + } + } + /** + * @return array + */ + public function filterByQuantityAndStockStatusDataProvider(): array + { + return [ + [ + '', + [ + 'Simple Product OOS', + 'Simple Product Not Visible', + 'Simple Product Visible and InStock' + ], + [ + ] + ], + [ + '1', + [ + 'Simple Product Not Visible', + 'Simple Product Visible and InStock' + ], + [ + 'Simple Product OOS' + ] + ], + [ + '0', + [ + 'Simple Product OOS' + ], + [ + 'Simple Product Not Visible', + 'Simple Product Visible and InStock' + ] + ] + ]; + } + + /** + * @param array $filters + * @return string + */ + private function doExport(array $filters = []): string + { + $this->model->setWriter( + $this->objectManager->create( + \Magento\ImportExport\Model\Export\Adapter\Csv::class + ) + ); + $this->model->setParameters( + [ + \Magento\ImportExport\Model\Export::FILTER_ELEMENT_GROUP => $filters + ] + ); + return $this->model->export(); + } } From c32b64377fc06771f12e74b4add2f32c8fa0a555 Mon Sep 17 00:00:00 2001 From: Vaha <vaha@atwix.com> Date: Mon, 20 Jan 2020 14:32:56 +0200 Subject: [PATCH 0903/1143] #18012: added description for _.i18n --- lib/web/mage/translate.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/web/mage/translate.js b/lib/web/mage/translate.js index b96586ab9e927..0a385da8dcf38 100644 --- a/lib/web/mage/translate.js +++ b/lib/web/mage/translate.js @@ -49,8 +49,14 @@ define([ // Provide i18n wrapper to be used in underscore templates for translation _.extend(_, { - i18n: function (str) { - return $.mage.__(str); + /** + * Make a translation using $.mage.__ + * + * @param {String} text + * @return {String} + */ + i18n: function (text) { + return $.mage.__(text); } }); From e99457737d2e028fc8206056ea1f464f4278ad21 Mon Sep 17 00:00:00 2001 From: Viktor Sevch <svitja@ukr.net> Date: Mon, 20 Jan 2020 15:36:18 +0200 Subject: [PATCH 0904/1143] MC-23546: Child Configurable product does not save disabled status via API --- .../Mftf/Test/SearchEntityResultsTest.xml | 97 ------------------- 1 file changed, 97 deletions(-) diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml b/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml index c289fc7868a10..7648b59aaefe8 100644 --- a/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml +++ b/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml @@ -603,101 +603,4 @@ <argument name="value" value="$simpleProduct1.name$"/> </actionGroup> </test> - - <test name="QuickSearchConfigurableChildren"> - <annotations> - <stories value="Search Product on Storefront"/> - <title value="Deprecated. User should be able to use Quick Search to a configurable product's child products"/> - <description value="Use Quick Search to find a configurable product with enabled/disable children"/> - <severity value="MAJOR"/> - <testCaseId value="MC-14798"/> - <group value="CatalogSearch"/> - <group value="mtf_migrated"/> - <skip> - <issueId value="DEPRECATED">Use StorefrontQuickSearchConfigurableChildrenTest instead.</issueId> - </skip> - </annotations> - <before> - <!-- Create the category --> - <createData entity="ApiCategory" stepKey="createCategory"/> - - <!-- Create blank AttributeSet--> - <createData entity="CatalogAttributeSet" stepKey="attributeSet"/> - - <!-- Create an attribute with two options to be used in the first child product --> - <createData entity="hiddenDropdownAttributeWithOptions" stepKey="createConfigProductAttribute"/> - <createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1"> - <requiredEntity createDataKey="createConfigProductAttribute"/> - </createData> - - <!-- Assign attribute to set --> - <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - <actionGroup ref="goToAttributeGridPage" stepKey="goToPage"/> - <actionGroup ref="GoToAttributeSetByNameActionGroup" stepKey="goToSet"> - <argument name="name" value="$attributeSet.attribute_set_name$"/> - </actionGroup> - <actionGroup ref="AssignAttributeToGroupActionGroup" stepKey="assignToAttributeSetAndGroup"> - <argument name="group" value="Product Details"/> - <argument name="attribute" value="$createConfigProductAttribute.attribute_code$"/> - </actionGroup> - <actionGroup ref="SaveAttributeSetActionGroup" stepKey="savePage"/> - - <!-- Get the first option of the attribute we created --> - <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1"> - <requiredEntity createDataKey="createConfigProductAttribute"/> - </getData> - - <!-- Create a simple product,give it the attributeSet and attribute with the first option --> - <createData entity="ApiSimpleOneHidden" stepKey="createConfigChildProduct1"> - <field key="attribute_set_id">$attributeSet.attribute_set_id$</field> - <requiredEntity createDataKey="createConfigProductAttribute"/> - <requiredEntity createDataKey="getConfigAttributeOption1"/> - </createData> - <updateData entity="ApiSimpleProductUpdateDescription" stepKey="updateSimpleProduct1" createDataKey="createConfigChildProduct1"/> - - <!-- Create the configurable product, give it the attributeSet and add it to the category --> - <createData entity="ApiConfigurableProduct" stepKey="createConfigProduct"> - <field key="attribute_set_id">$attributeSet.attribute_set_id$</field> - <requiredEntity createDataKey="createCategory"/> - </createData> - <!-- Create the configurable product --> - <createData entity="ConfigurableProductOneOption" stepKey="createConfigProductOption"> - <requiredEntity createDataKey="createConfigProduct"/> - <requiredEntity createDataKey="createConfigProductAttribute"/> - <requiredEntity createDataKey="getConfigAttributeOption1"/> - </createData> - <!-- Add the first simple product to the configurable product --> - <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild1"> - <requiredEntity createDataKey="createConfigProduct"/> - <requiredEntity createDataKey="createConfigChildProduct1"/> - </createData> - - <!-- Perform reindex and flush cache --> - <magentoCLI command="indexer:reindex" stepKey="reindex"/> - <magentoCLI command="cache:flush" stepKey="flushCache"/> - </before> - <amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToFrontPage"/> - <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="searchStorefront"> - <argument name="phrase" value="$createConfigProduct.name$"/> - </actionGroup> - <actionGroup ref="StorefrontQuickSearchCheckProductNameInGridActionGroup" stepKey="seeProductInGrid"> - <argument name="productName" value="$createConfigProduct.name$"/> - <argument name="index" value="1"/> - </actionGroup> - - <!-- Disable Child Product --> - <actionGroup ref="GoToProductPageViaIDActionGroup" stepKey="goToChildProduct"> - <argument name="productId" value="$createConfigChildProduct1.id$"/> - </actionGroup> - <actionGroup ref="ToggleProductEnabledActionGroup" stepKey="disableProduct"/> - <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> - - <amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToFrontPageAgain"/> - <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="searchStorefrontAgain"> - <argument name="phrase" value="$createConfigProduct.name$"/> - </actionGroup> - <actionGroup ref="StorefrontQuickSearchCheckProductNameNotInGridActionGroup" stepKey="dontSeeProductAnymore"> - <argument name="productName" value="$createConfigProduct.name$"/> - </actionGroup> - </test> </tests> From 1044f254a4fbc24342ecb6127d2eb484533e6fc3 Mon Sep 17 00:00:00 2001 From: Erfan Shamabadi <erfan@codekunst.com> Date: Mon, 20 Jan 2020 14:48:59 +0100 Subject: [PATCH 0905/1143] Escape dollar sign for saving content into crontab The crontab contents can contain dollar sign (e.g. $(date)). The current code does not escape it which transform it to actual values. In this commit a replacement to escape dollar sign is added to the previous replacements. --- lib/internal/Magento/Framework/Crontab/CrontabManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Crontab/CrontabManager.php b/lib/internal/Magento/Framework/Crontab/CrontabManager.php index fb3537ca0648f..a6496e4d01c04 100644 --- a/lib/internal/Magento/Framework/Crontab/CrontabManager.php +++ b/lib/internal/Magento/Framework/Crontab/CrontabManager.php @@ -203,7 +203,7 @@ private function getCrontabContent() */ private function save($content) { - $content = str_replace(['%', '"'], ['%%', '\"'], $content); + $content = str_replace(['%', '"', '$'], ['%%', '\"', '\$'], $content); try { $this->shell->execute('echo "' . $content . '" | crontab -'); From f309ae042236736db0a964e533e33baa0a0e5142 Mon Sep 17 00:00:00 2001 From: kalinicham <Hvdygfijf13795> Date: Mon, 20 Jan 2020 15:54:16 +0200 Subject: [PATCH 0906/1143] Cover changes with Unit test --- .../Backend/TierPrice/UpdateHandlerTest.php | 145 ++++++++++++++---- 1 file changed, 116 insertions(+), 29 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Backend/TierPrice/UpdateHandlerTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Backend/TierPrice/UpdateHandlerTest.php index 88adec0e20376..8b398d3ba4d97 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Backend/TierPrice/UpdateHandlerTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Backend/TierPrice/UpdateHandlerTest.php @@ -7,13 +7,13 @@ namespace Magento\Catalog\Test\Unit\Model\Attribute\Backend\TierPrice; -use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; -use Magento\Catalog\Model\Product\Attribute\Backend\TierPrice\UpdateHandler; -use Magento\Store\Model\StoreManagerInterface; use Magento\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Catalog\Model\Product\Attribute\Backend\TierPrice\UpdateHandler; +use Magento\Catalog\Model\ResourceModel\Product\Attribute\Backend\Tierprice; use Magento\Customer\Api\GroupManagementInterface; use Magento\Framework\EntityManager\MetadataPool; -use Magento\Catalog\Model\ResourceModel\Product\Attribute\Backend\Tierprice; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Store\Model\StoreManagerInterface; /** * Unit tests for \Magento\Catalog\Model\Product\Attribute\Backend\TierPrice\UpdateHandler @@ -95,20 +95,27 @@ protected function setUp() ); } - public function testExecute(): void - { - $newTierPrices = [ - ['website_id' => 0, 'price_qty' => 2, 'cust_group' => 0, 'price' => 15], - ['website_id' => 0, 'price_qty' => 3, 'cust_group' => 3200, 'price' => null, 'percentage_value' => 20] - ]; - $priceIdToDelete = 2; - $originalTierPrices = [ - ['price_id' => 1, 'website_id' => 0, 'price_qty' => 2, 'cust_group' => 0, 'price' => 10], - ['price_id' => $priceIdToDelete, 'website_id' => 0, 'price_qty' => 4, 'cust_group' => 0, 'price' => 20], - ]; - $linkField = 'entity_id'; - $productId = 10; - $originalProductId = 11; + /** + * Verify update handle. + * + * @param array $newTierPrices + * @param array $originalTierPrices + * @param int $priceIdToDelete + * @param string $linkField + * @param int $productId + * @param int $originalProductId + * @throws \Magento\Framework\Exception\InputException + * + * @dataProvider configDataProvider + */ + public function testExecute( + $newTierPrices, + $originalTierPrices, + $priceIdToDelete, + $linkField, + $productId, + $originalProductId + ): void { /** @var \PHPUnit_Framework_MockObject_MockObject $product */ $product = $this->getMockBuilder(\Magento\Catalog\Api\Data\ProductInterface::class) @@ -128,18 +135,12 @@ public function testExecute(): void ['entity_id', $originalProductId] ] ); - $this->assertEquals( - $this->assertNotNull($newTierPrices[0]['price']), - $this->tierPriceResource->expects($this->atLeastOnce()) - ->method('updateValues')->with($newTierPrices, $originalTierPrices)->willReturn(true) - ); - $this->assertEquals( - $this->assertNull($newTierPrices[0]['price']), - $this->tierPriceResource->expects($this->atLeastOnce()) - ->method('updateValues')->with($newTierPrices, $originalTierPrices)->willReturn(false) - ); + $product->expects($this->atLeastOnce())->method('getStoreId')->willReturn(0); - $product->expects($this->atLeastOnce())->method('setData')->with('tier_price_changed', 1); + + $product->expects($this->atLeastOnce()) + ->method('setData') + ->with('tier_price_changed', 1); $store = $this->getMockBuilder(\Magento\Store\Api\Data\StoreInterface::class) ->disableOriginalConstructor() ->setMethods(['getWebsiteId']) @@ -177,6 +178,8 @@ public function testExecute(): void } /** + * Verify update handle with exception. + * * @expectedException \Magento\Framework\Exception\InputException * @expectedExceptionMessage Tier prices data should be array, but actually other type is received */ @@ -199,4 +202,88 @@ public function testExecuteWithException(): void $this->updateHandler->execute($product); } + + /** + * Returns test parameters. + * + * @return array + */ + public function configDataProvider() + { + return [ + [ + [ + [ + 'website_id' => 0, + 'price_qty' => 2, + 'cust_group' => 0, + 'price' => 15 + ], + [ + 'website_id' => 0, + 'price_qty' => 3, + 'cust_group' => 3200, + 'price' => null, + 'percentage_value' => 20 + ] + ], + [ + [ + 'price_id' => 1, + 'website_id' => 0, + 'price_qty' => 2, + 'cust_group' => 0, + 'price' => 10], + [ + 'price_id' => 2, + 'website_id' => 0, + 'price_qty' => 4, + 'cust_group' => 0, + 'price' => 20 + ], + ], + 2, + 'entity_id', + 10, + 11 + ], + [ + [ + [ + 'website_id' => 0, + 'price_qty' => 2, + 'cust_group' => 0, + 'price' => 0 + ], + [ + 'website_id' => 0, + 'price_qty' => 3, + 'cust_group' => 3200, + 'price' => null, + 'percentage_value' => 20 + ] + ], + [ + [ + 'price_id' => 1, + 'website_id' => 0, + 'price_qty' => 2, + 'cust_group' => 0, + 'price' => 10 + ], + [ + 'price_id' => 2, + 'website_id' => 0, + 'price_qty' => 4, + 'cust_group' => 0, + 'price' => 20 + ], + ], + 2, + 'entity_id', + 10, + 11 + ] + ]; + } } From 093e30600f58f506a3dc5e853b8b3c4b205157f4 Mon Sep 17 00:00:00 2001 From: Viktor Petryk <victor.petryk@transoftgroup.com> Date: Mon, 20 Jan 2020 17:16:30 +0200 Subject: [PATCH 0907/1143] MC-24906: An error notification is displayed while creating return on storefront --- .../shipment_for_order_with_customer.php | 27 +++++++++++++++++++ ...pment_for_order_with_customer_rollback.php | 8 ++++++ 2 files changed, 35 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/Sales/_files/shipment_for_order_with_customer.php create mode 100644 dev/tests/integration/testsuite/Magento/Sales/_files/shipment_for_order_with_customer_rollback.php diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/shipment_for_order_with_customer.php b/dev/tests/integration/testsuite/Magento/Sales/_files/shipment_for_order_with_customer.php new file mode 100644 index 0000000000000..c5304f5b8809f --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/shipment_for_order_with_customer.php @@ -0,0 +1,27 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Framework\DB\Transaction; +use Magento\Sales\Model\Order\ShipmentFactory; +use Magento\TestFramework\Helper\Bootstrap; + +require __DIR__ . '/order_with_customer.php'; + +$objectManager = Bootstrap::getObjectManager(); +$order->setIsInProcess(true); +/** @var Transaction $transaction */ +$transaction = $objectManager->create(Transaction::class); + +$items = []; +foreach ($order->getItems() as $orderItem) { + $items[$orderItem->getId()] = $orderItem->getQtyOrdered(); +} + +$shipment = $objectManager->get(ShipmentFactory::class)->create($order, $items); +$shipment->register(); + +$transaction->addObject($shipment)->addObject($order)->save(); diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/shipment_for_order_with_customer_rollback.php b/dev/tests/integration/testsuite/Magento/Sales/_files/shipment_for_order_with_customer_rollback.php new file mode 100644 index 0000000000000..2595d6bf4084a --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/shipment_for_order_with_customer_rollback.php @@ -0,0 +1,8 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +require __DIR__ . '/default_rollback.php'; From 33ea5358c56e0768c62bf37ba44b75a509e67c5a Mon Sep 17 00:00:00 2001 From: Alex Taranovsky <firster@atwix.com> Date: Sat, 18 Jan 2020 20:11:49 +0200 Subject: [PATCH 0908/1143] magento/magento2#: DeletePaymentToken. Remove redundant validation logic. Test coverage. --- .../Model/Resolver/DeletePaymentToken.php | 5 - .../Model/Resolver/DeletePaymentTokenTest.php | 230 ++++++++++++++++++ 2 files changed, 230 insertions(+), 5 deletions(-) create mode 100644 app/code/Magento/VaultGraphQl/Test/Unit/Model/Resolver/DeletePaymentTokenTest.php diff --git a/app/code/Magento/VaultGraphQl/Model/Resolver/DeletePaymentToken.php b/app/code/Magento/VaultGraphQl/Model/Resolver/DeletePaymentToken.php index 8dc42cebe8dfc..146215059b365 100644 --- a/app/code/Magento/VaultGraphQl/Model/Resolver/DeletePaymentToken.php +++ b/app/code/Magento/VaultGraphQl/Model/Resolver/DeletePaymentToken.php @@ -9,7 +9,6 @@ use Magento\Framework\GraphQl\Config\Element\Field; use Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException; -use Magento\Framework\GraphQl\Exception\GraphQlInputException; use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException; use Magento\Framework\GraphQl\Query\ResolverInterface; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; @@ -59,10 +58,6 @@ public function resolve( throw new GraphQlAuthorizationException(__('The current customer isn\'t authorized.')); } - if (!isset($args['public_hash'])) { - throw new GraphQlInputException(__('Specify the "public_hash" value.')); - } - $token = $this->paymentTokenManagement->getByPublicHash($args['public_hash'], $context->getUserId()); if (!$token) { throw new GraphQlNoSuchEntityException( diff --git a/app/code/Magento/VaultGraphQl/Test/Unit/Model/Resolver/DeletePaymentTokenTest.php b/app/code/Magento/VaultGraphQl/Test/Unit/Model/Resolver/DeletePaymentTokenTest.php new file mode 100644 index 0000000000000..0ec1a8b3907e7 --- /dev/null +++ b/app/code/Magento/VaultGraphQl/Test/Unit/Model/Resolver/DeletePaymentTokenTest.php @@ -0,0 +1,230 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\VaultGraphQl\Test\Unit\Model\Resolver; + +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Framework\GraphQl\Config\Element\Field; +use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException; +use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; +use Magento\GraphQl\Model\Query\ContextInterface; +use Magento\GraphQl\Model\Query\ContextExtensionInterface; +use Magento\Vault\Api\PaymentTokenManagementInterface; +use Magento\Vault\Api\PaymentTokenRepositoryInterface; +use Magento\Vault\Api\Data\PaymentTokenInterface; +use Magento\VaultGraphQl\Model\Resolver\DeletePaymentToken; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +/** + * Test class for \Magento\VaultGraphQl\Model\Resolver\DeletePaymentToken + */ +class DeletePaymentTokenTest extends TestCase +{ + /** + * Object Manager Instance + * + * @var ObjectManager + */ + private $objectManager; + + /** + * Testable Object + * + * @var DeletePaymentToken + */ + private $resolver; + + /** + * @var ContextInterface|MockObject + */ + private $contextMock; + + /** + * @var ContextExtensionInterface|MockObject + */ + private $contextExtensionMock; + + /** + * @var Field|MockObject + */ + private $fieldMock; + + /** + * @var PaymentTokenManagementInterface|MockObject + */ + private $paymentTokenManagementMock; + + /** + * @var PaymentTokenRepositoryInterface|MockObject + */ + private $paymentTokenRepositoryMock; + + /** + * @var PaymentTokenInterface|MockObject + */ + private $paymentTokenMock; + + /** + * @var ResolveInfo|MockObject + */ + private $resolveInfoMock; + + /** + * @inheritdoc + */ + protected function setUp() : void + { + $this->objectManager = new ObjectManager($this); + + $this->contextMock = $this->getMockBuilder(ContextInterface::class) + ->disableOriginalConstructor() + ->setMethods( + [ + 'getExtensionAttributes', + 'getUserId', + 'getUserType', + ] + ) + ->getMock(); + + $this->contextExtensionMock = $this->getMockBuilder(ContextExtensionInterface::class) + ->setMethods( + [ + 'getIsCustomer', + 'getStore', + 'setStore', + 'setIsCustomer', + ] + ) + ->getMock(); + + $this->fieldMock = $this->getMockBuilder(Field::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->paymentTokenManagementMock = $this->getMockBuilder(PaymentTokenManagementInterface::class) + ->getMockForAbstractClass(); + + $this->paymentTokenRepositoryMock = $this->getMockBuilder(PaymentTokenRepositoryInterface::class) + ->getMockForAbstractClass(); + + $this->paymentTokenMock = $this->getMockBuilder(PaymentTokenInterface::class) + ->getMockForAbstractClass(); + + $this->resolveInfoMock = $this->getMockBuilder(ResolveInfo::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->resolver = $this->objectManager->getObject( + DeletePaymentToken::class, + [ + 'paymentTokenManagement' => $this->paymentTokenManagementMock, + 'paymentTokenRepository' => $this->paymentTokenRepositoryMock, + ] + ); + } + + /** + * Test delete customer payment token + */ + public function testDeleteCustomerPaymentToken() + { + $isCustomer = true; + $paymentTokenResult = true; + + $this->contextMock + ->expects($this->once()) + ->method('getExtensionAttributes') + ->willReturn($this->contextExtensionMock); + + $this->contextExtensionMock + ->expects($this->once()) + ->method('getIsCustomer') + ->willReturn($isCustomer); + + $this->paymentTokenManagementMock + ->expects($this->once()) + ->method('getByPublicHash') + ->willReturn($this->paymentTokenMock); + + $this->paymentTokenRepositoryMock + ->expects($this->once()) + ->method('delete') + ->with($this->paymentTokenMock) + ->willReturn($paymentTokenResult); + + $this->assertEquals( + [ + 'result' => true + ], + $this->resolver->resolve( + $this->fieldMock, + $this->contextMock, + $this->resolveInfoMock + ) + ); + } + + /** + * Test mutation when customer isn't authorized. + * + * @expectedException \Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException + * @expectedExceptionMessage The current customer isn't authorized. + */ + public function testCustomerNotAuthorized() + { + $isCustomer = false; + + $this->contextMock + ->expects($this->once()) + ->method('getExtensionAttributes') + ->willReturn($this->contextExtensionMock); + + $this->contextExtensionMock + ->expects($this->once()) + ->method('getIsCustomer') + ->willReturn($isCustomer); + + $this->resolver->resolve( + $this->fieldMock, + $this->contextMock, + $this->resolveInfoMock + ); + } + + /** + * Test mutation when provided token ID does not exist + */ + public function testCustomerPaymentTokenNotExists() + { + $isCustomer = true; + $token = false; + + $this->contextMock + ->expects($this->once()) + ->method('getExtensionAttributes') + ->willReturn($this->contextExtensionMock); + + $this->contextExtensionMock + ->expects($this->once()) + ->method('getIsCustomer') + ->willReturn($isCustomer); + + $this->paymentTokenManagementMock + ->expects($this->once()) + ->method('getByPublicHash') + ->willReturn($token); + + $this->expectException(GraphQlNoSuchEntityException::class); + + $this->resolver->resolve( + $this->fieldMock, + $this->contextMock, + $this->resolveInfoMock + ); + } +} From 1067926e468c6a630800b1b2f567bffdf58888b7 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky <firster@atwix.com> Date: Tue, 21 Jan 2020 01:28:09 +0200 Subject: [PATCH 0909/1143] magento/magento2#: RevokeCustomerToken. Test coverage. --- .../Resolver/RevokeCustomerTokenTest.php | 172 ++++++++++++++++++ 1 file changed, 172 insertions(+) create mode 100644 app/code/Magento/CustomerGraphQl/Test/Unit/Model/Resolver/RevokeCustomerTokenTest.php diff --git a/app/code/Magento/CustomerGraphQl/Test/Unit/Model/Resolver/RevokeCustomerTokenTest.php b/app/code/Magento/CustomerGraphQl/Test/Unit/Model/Resolver/RevokeCustomerTokenTest.php new file mode 100644 index 0000000000000..4f8d626ca4e64 --- /dev/null +++ b/app/code/Magento/CustomerGraphQl/Test/Unit/Model/Resolver/RevokeCustomerTokenTest.php @@ -0,0 +1,172 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\CustomerGraphQl\Test\Unit\Model\Resolver; + +use Magento\CustomerGraphQl\Model\Resolver\RevokeCustomerToken; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Framework\GraphQl\Config\Element\Field; +use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; +use Magento\GraphQl\Model\Query\ContextInterface; +use Magento\GraphQl\Model\Query\ContextExtensionInterface; +use Magento\Integration\Api\CustomerTokenServiceInterface; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +/** + * Test class for \Magento\CustomerGraphQl\Model\Resolver\RevokeCustomerToken + */ +class RevokeCustomerTokenTest extends TestCase +{ + /** + * Object Manager Instance + * + * @var ObjectManager + */ + private $objectManager; + + /** + * Testable Object + * + * @var RevokeCustomerToken + */ + private $resolver; + + /** + * @var ContextInterface|MockObject + */ + private $contextMock; + + /** + * @var ContextExtensionInterface|MockObject + */ + private $contextExtensionMock; + + /** + * @var CustomerTokenServiceInterface|MockObject + */ + private $customerTokenServiceMock; + + /** + * @var Field|MockObject + */ + private $fieldMock; + + /** + * @var ResolveInfo|MockObject + */ + private $resolveInfoMock; + + /** + * @inheritdoc + */ + protected function setUp() : void + { + $this->objectManager = new ObjectManager($this); + + $this->contextMock = $this->getMockBuilder(ContextInterface::class) + ->disableOriginalConstructor() + ->setMethods( + [ + 'getExtensionAttributes', + 'getUserId', + 'getUserType', + ] + ) + ->getMock(); + + $this->contextExtensionMock = $this->getMockBuilder(ContextExtensionInterface::class) + ->setMethods( + [ + 'getIsCustomer', + 'getStore', + 'setStore', + 'setIsCustomer', + ] + ) + ->getMock(); + + $this->fieldMock = $this->getMockBuilder(Field::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->customerTokenServiceMock = $this->getMockBuilder(CustomerTokenServiceInterface::class) + ->getMockForAbstractClass(); + + $this->resolveInfoMock = $this->getMockBuilder(ResolveInfo::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->resolver = $this->objectManager->getObject( + RevokeCustomerToken::class, + [ + 'customerTokenService' => $this->customerTokenServiceMock, + ] + ); + } + + /** + * Test revoke customer token + */ + public function testRevokeCustomerToken() + { + $isCustomer = true; + $revokeCustomerTokenResult = true; + + $this->contextMock + ->expects($this->once()) + ->method('getExtensionAttributes') + ->willReturn($this->contextExtensionMock); + + $this->contextExtensionMock + ->expects($this->once()) + ->method('getIsCustomer') + ->willReturn($isCustomer); + + $this->customerTokenServiceMock + ->expects($this->once()) + ->method('revokeCustomerAccessToken') + ->willReturn($revokeCustomerTokenResult); + + $this->assertEquals( + [ + 'result' => true + ], + $this->resolver->resolve( + $this->fieldMock, + $this->contextMock, + $this->resolveInfoMock + ) + ); + } + + /** + * Test mutation when customer isn't authorized. + * + * @expectedException \Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException + * @expectedExceptionMessage The current customer isn't authorized. + */ + public function testCustomerNotAuthorized() + { + $isCustomer = false; + + $this->contextMock + ->expects($this->once()) + ->method('getExtensionAttributes') + ->willReturn($this->contextExtensionMock); + + $this->contextExtensionMock + ->expects($this->once()) + ->method('getIsCustomer') + ->willReturn($isCustomer); + + $this->resolver->resolve( + $this->fieldMock, + $this->contextMock, + $this->resolveInfoMock + ); + } +} From bdb46793b5aab8ed78bee5196538c7dfb229bc0e Mon Sep 17 00:00:00 2001 From: Michele Fantetti <mfantetti@ittweb.net> Date: Tue, 21 Jan 2020 09:16:57 +0100 Subject: [PATCH 0910/1143] Add frontend template hints status command after suggestions --- .../Console/Command/TemplateHintsStatusCommand.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php b/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php index d9af42ee33cb4..abe8e70677c60 100644 --- a/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php +++ b/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php @@ -11,6 +11,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Magento\Framework\App\Config\ScopeConfigInterface; +/** + * Command to show frontend template hints status + */ class TemplateHintsStatusCommand extends Command { @@ -57,8 +60,13 @@ protected function configure() */ protected function execute(InputInterface $input, OutputInterface $output) { - $templateHintsStatus = ($this->scopeConfig->isSetFlag('dev/debug/template_hints_storefront', 'default')) ? 'enabled' : 'disabled'; + $templateHintsStatus = + ($this->scopeConfig->isSetFlag('dev/debug/template_hints_storefront', 'default')) + ? 'enabled' + : 'disabled'; $templateHintsMessage = __(self::SUCCESS_MESSAGE, ['status' => $templateHintsStatus]); $output->writeln("<info>" . $templateHintsMessage . "</info>"); + + return; } } From a8041a1fda3a598e3502c5fdb1b7bd9a157befd1 Mon Sep 17 00:00:00 2001 From: Michele Fantetti <mfantetti@ittweb.net> Date: Tue, 21 Jan 2020 09:47:57 +0100 Subject: [PATCH 0911/1143] Add frontend template hints status command after suggestions --- .../Developer/Console/Command/TemplateHintsStatusCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php b/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php index abe8e70677c60..b229c9a2b19fc 100644 --- a/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php +++ b/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php @@ -67,6 +67,6 @@ protected function execute(InputInterface $input, OutputInterface $output) $templateHintsMessage = __(self::SUCCESS_MESSAGE, ['status' => $templateHintsStatus]); $output->writeln("<info>" . $templateHintsMessage . "</info>"); - return; + return 0; } } From 4c952ed9b65351358bba0884571316dfa135d240 Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Tue, 21 Jan 2020 11:04:43 +0200 Subject: [PATCH 0912/1143] MC-23986: Cart price rule based on payment methods not aplied in checkout --- .../Test/Unit/Model/Checkout/Plugin/ValidationTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/CheckoutAgreements/Test/Unit/Model/Checkout/Plugin/ValidationTest.php b/app/code/Magento/CheckoutAgreements/Test/Unit/Model/Checkout/Plugin/ValidationTest.php index 6a4953a3cfe70..64c91edb4e27d 100644 --- a/app/code/Magento/CheckoutAgreements/Test/Unit/Model/Checkout/Plugin/ValidationTest.php +++ b/app/code/Magento/CheckoutAgreements/Test/Unit/Model/Checkout/Plugin/ValidationTest.php @@ -130,7 +130,7 @@ public function testBeforeSavePaymentInformationAndPlaceOrder() $this->paymentMock->expects(static::atLeastOnce()) ->method('getExtensionAttributes') ->willReturn($this->extensionAttributesMock); - $this->model->beforeSavePaymentInformationAndPlaceOrder( + $this->model->beforeSavePaymentInformation( $this->subjectMock, $cartId, $this->paymentMock, @@ -172,7 +172,7 @@ public function testBeforeSavePaymentInformationAndPlaceOrderIfAgreementsNotVali $this->paymentMock->expects(static::atLeastOnce()) ->method('getExtensionAttributes') ->willReturn($this->extensionAttributesMock); - $this->model->beforeSavePaymentInformationAndPlaceOrder( + $this->model->beforeSavePaymentInformation( $this->subjectMock, $cartId, $this->paymentMock, From 80b8514a601923b66abb8492e0868ad7fb5dfb1f Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Tue, 21 Jan 2020 14:59:12 +0200 Subject: [PATCH 0913/1143] cover gallery.js with jasmine test --- .../tests/lib/mage/gallery/gallery.test.js | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 dev/tests/js/jasmine/tests/lib/mage/gallery/gallery.test.js diff --git a/dev/tests/js/jasmine/tests/lib/mage/gallery/gallery.test.js b/dev/tests/js/jasmine/tests/lib/mage/gallery/gallery.test.js new file mode 100644 index 0000000000000..d40681fd944c3 --- /dev/null +++ b/dev/tests/js/jasmine/tests/lib/mage/gallery/gallery.test.js @@ -0,0 +1,100 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +define([ + 'mage/gallery/gallery', + 'jquery' +], function (Gallery, $) { + 'use strict'; + + var gallery, + options, + element; + + beforeEach(function () { + options = { + options: { + allowfullscreen: true, + arrows: true, + height: 700, + keyboard: true, + loop: true, + nav: 'thumbs', + navarrows: true, + navdir: 'horizontal', + navtype: 'slides', + showCaption: false, + thumbheight: 110, + thumbwidth: 88, + transition: 'slide', + transitionduration: 500, + width: 700 + }, + fullscreen: { + arrows: true, + loop: true, + nav: 'thumbs', + navarrows: false, + navdir: 'horizontal', + navtype: 'slides', + showCaption: false, + transition: 'slide', + transitionduration: 500 + }, + breakpoints: { + mobile: {} + }, + data: [ + { + caption: 'Simple product', + isMain: true, + position: '1', + type: 'image', + videoUrl: null, + thumb: '', + full: '', + img: '' + } + ], + magnifierOpts: { + enabled: false, + eventType: 'hover', + fullscreenzoom: '20', + height: 100, + largeWrapper: '[data-gallery-role=\'magnifier\']', + left: 10, + mode: 'outside', + thumb: '.fotorama__img', + top: 10, + width: 100, + zoomable: false + } + }; + element = $('<div class="gallery-placeholder' + + ' _block-content-loading" data-gallery-role="gallery-placeholder">' + + '<img alt="main product photo" class="gallery-placeholder__image" src="">' + + '</div>'); + + spyOn($.fn, 'data').and.callFake(function () { + return { + setOptions: jasmine.createSpy().and.returnValue(true), + updateOptions: jasmine.createSpy().and.returnValue(true) + }; + }); + expect(); + gallery = new Gallery(options, element); + + }); + + describe('"initGallery" method', function () { + it('Verify gallery initialization', function () { + expect(gallery.settings.$elementF.class).toBe(element[1]); + expect(gallery.settings.fullscreenConfig).toBeDefined(); + expect(gallery.settings.fotoramaApi).toBeDefined(); + expect(gallery.settings.data).toBeDefined(); + expect(gallery.settings.api).toBeDefined(); + }); + }); +}); From 37080a55b9756c013a7513170308bb8aa1efd42a Mon Sep 17 00:00:00 2001 From: Iryna Lagno <ilagno@adobe.com> Date: Tue, 21 Jan 2020 10:17:05 -0600 Subject: [PATCH 0914/1143] MC-14917: Update Symfony components to 4.4LTS for 2.4.x --- composer.json | 6 -- composer.lock | 186 ++++++++++++++++++++++++++------------------------ 2 files changed, 97 insertions(+), 95 deletions(-) diff --git a/composer.json b/composer.json index f156adfe81162..9cbbf1689738f 100644 --- a/composer.json +++ b/composer.json @@ -10,12 +10,6 @@ "preferred-install": "dist", "sort-packages": true }, - "repositories": [ - { - "type": "git", - "url": "https://github.com/magento/composer" - } - ], "require": { "php": "~7.1.3||~7.2.0||~7.3.0", "ext-bcmath": "*", diff --git a/composer.lock b/composer.lock index 85a3875a143d1..5b94f60fa80a9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "701b25f7d664c2e8a500233a69587004", + "content-hash": "988eebffd81167973e4a51d7efd5be46", "packages": [ { "name": "braintree/braintree_php", @@ -953,9 +953,15 @@ "version": "1.6.x-dev", "source": { "type": "git", - "url": "https://github.com/magento/composer", + "url": "https://github.com/magento/composer.git", "reference": "fe738ac9155f550b669b260b3cfa6422eacb53fa" }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/magento/composer/zipball/fe738ac9155f550b669b260b3cfa6422eacb53fa", + "reference": "fe738ac9155f550b669b260b3cfa6422eacb53fa", + "shasum": "" + }, "require": { "composer/composer": "^1.6", "php": "~7.1.3||~7.2.0||~7.3.0", @@ -970,6 +976,7 @@ "Magento\\Composer\\": "src" } }, + "notification-url": "https://packagist.org/downloads/", "license": [ "OSL-3.0", "AFL-3.0" @@ -2005,16 +2012,16 @@ }, { "name": "symfony/console", - "version": "v4.4.2", + "version": "v4.4.3", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "82437719dab1e6bdd28726af14cb345c2ec816d0" + "reference": "e9ee09d087e2c88eaf6e5fc0f5c574f64d100e4f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/82437719dab1e6bdd28726af14cb345c2ec816d0", - "reference": "82437719dab1e6bdd28726af14cb345c2ec816d0", + "url": "https://api.github.com/repos/symfony/console/zipball/e9ee09d087e2c88eaf6e5fc0f5c574f64d100e4f", + "reference": "e9ee09d087e2c88eaf6e5fc0f5c574f64d100e4f", "shasum": "" }, "require": { @@ -2077,20 +2084,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2019-12-17T10:32:23+00:00" + "time": "2020-01-10T21:54:01+00:00" }, { "name": "symfony/css-selector", - "version": "v4.4.2", + "version": "v4.4.3", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "64acec7e0d67125e9f4656c68d4a38a42ab5a0b7" + "reference": "a167b1860995b926d279f9bb538f873e3bfa3465" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/64acec7e0d67125e9f4656c68d4a38a42ab5a0b7", - "reference": "64acec7e0d67125e9f4656c68d4a38a42ab5a0b7", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/a167b1860995b926d279f9bb538f873e3bfa3465", + "reference": "a167b1860995b926d279f9bb538f873e3bfa3465", "shasum": "" }, "require": { @@ -2130,20 +2137,20 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2019-10-12T00:35:04+00:00" + "time": "2020-01-04T13:00:46+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v4.4.2", + "version": "v4.4.3", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "b3c3068a72623287550fe20b84a2b01dcba2686f" + "reference": "9e3de195e5bc301704dd6915df55892f6dfc208b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/b3c3068a72623287550fe20b84a2b01dcba2686f", - "reference": "b3c3068a72623287550fe20b84a2b01dcba2686f", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/9e3de195e5bc301704dd6915df55892f6dfc208b", + "reference": "9e3de195e5bc301704dd6915df55892f6dfc208b", "shasum": "" }, "require": { @@ -2200,7 +2207,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2019-11-28T13:33:56+00:00" + "time": "2020-01-10T21:54:01+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -2262,16 +2269,16 @@ }, { "name": "symfony/filesystem", - "version": "v4.4.2", + "version": "v4.4.3", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "40c2606131d56eff6f193b6e2ceb92414653b591" + "reference": "266c9540b475f26122b61ef8b23dd9198f5d1cfd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/40c2606131d56eff6f193b6e2ceb92414653b591", - "reference": "40c2606131d56eff6f193b6e2ceb92414653b591", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/266c9540b475f26122b61ef8b23dd9198f5d1cfd", + "reference": "266c9540b475f26122b61ef8b23dd9198f5d1cfd", "shasum": "" }, "require": { @@ -2308,20 +2315,20 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2019-11-26T23:16:41+00:00" + "time": "2020-01-21T08:20:44+00:00" }, { "name": "symfony/finder", - "version": "v4.4.2", + "version": "v4.4.3", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "ce8743441da64c41e2a667b8eb66070444ed911e" + "reference": "3a50be43515590faf812fbd7708200aabc327ec3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/ce8743441da64c41e2a667b8eb66070444ed911e", - "reference": "ce8743441da64c41e2a667b8eb66070444ed911e", + "url": "https://api.github.com/repos/symfony/finder/zipball/3a50be43515590faf812fbd7708200aabc327ec3", + "reference": "3a50be43515590faf812fbd7708200aabc327ec3", "shasum": "" }, "require": { @@ -2357,7 +2364,7 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2019-11-17T21:56:56+00:00" + "time": "2020-01-04T13:00:46+00:00" }, { "name": "symfony/polyfill-ctype", @@ -2536,16 +2543,16 @@ }, { "name": "symfony/process", - "version": "v4.4.2", + "version": "v4.4.3", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "b84501ad50adb72a94fb460a5b5c91f693e99c9b" + "reference": "f5697ab4cb14a5deed7473819e63141bf5352c36" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/b84501ad50adb72a94fb460a5b5c91f693e99c9b", - "reference": "b84501ad50adb72a94fb460a5b5c91f693e99c9b", + "url": "https://api.github.com/repos/symfony/process/zipball/f5697ab4cb14a5deed7473819e63141bf5352c36", + "reference": "f5697ab4cb14a5deed7473819e63141bf5352c36", "shasum": "" }, "require": { @@ -2581,7 +2588,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2019-12-06T10:06:46+00:00" + "time": "2020-01-09T09:50:08+00:00" }, { "name": "symfony/service-contracts", @@ -6640,6 +6647,7 @@ "selenium", "webdriver" ], + "abandoned": "php-webdriver/webdriver", "time": "2019-06-13T08:02:18+00:00" }, { @@ -8139,24 +8147,24 @@ }, { "name": "phpspec/prophecy", - "version": "1.10.1", + "version": "v1.10.2", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "cbe1df668b3fe136bcc909126a0f529a78d4cbbc" + "reference": "b4400efc9d206e83138e2bb97ed7f5b14b831cd9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/cbe1df668b3fe136bcc909126a0f529a78d4cbbc", - "reference": "cbe1df668b3fe136bcc909126a0f529a78d4cbbc", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/b4400efc9d206e83138e2bb97ed7f5b14b831cd9", + "reference": "b4400efc9d206e83138e2bb97ed7f5b14b831cd9", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", - "sebastian/comparator": "^1.2.3|^2.0|^3.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0" + "sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0" }, "require-dev": { "phpspec/phpspec": "^2.5 || ^3.2", @@ -8198,20 +8206,20 @@ "spy", "stub" ], - "time": "2019-12-22T21:05:45+00:00" + "time": "2020-01-20T15:57:02+00:00" }, { "name": "phpstan/phpstan", - "version": "0.12.5", + "version": "0.12.7", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "71a20c18f06c53605251a00a8efe443fa85225d1" + "reference": "07fa7958027fd98c567099bbcda5d6a0f2ec5197" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/71a20c18f06c53605251a00a8efe443fa85225d1", - "reference": "71a20c18f06c53605251a00a8efe443fa85225d1", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/07fa7958027fd98c567099bbcda5d6a0f2ec5197", + "reference": "07fa7958027fd98c567099bbcda5d6a0f2ec5197", "shasum": "" }, "require": { @@ -8237,7 +8245,7 @@ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", - "time": "2020-01-12T14:31:21+00:00" + "time": "2020-01-20T21:59:06+00:00" }, { "name": "phpunit/php-code-coverage", @@ -9431,16 +9439,16 @@ }, { "name": "symfony/browser-kit", - "version": "v4.4.2", + "version": "v4.4.3", "source": { "type": "git", "url": "https://github.com/symfony/browser-kit.git", - "reference": "e19e465c055137938afd40cfddd687e7511bbbf0" + "reference": "45cae6dd8683d2de56df7ec23638e9429c70135f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/e19e465c055137938afd40cfddd687e7511bbbf0", - "reference": "e19e465c055137938afd40cfddd687e7511bbbf0", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/45cae6dd8683d2de56df7ec23638e9429c70135f", + "reference": "45cae6dd8683d2de56df7ec23638e9429c70135f", "shasum": "" }, "require": { @@ -9486,20 +9494,20 @@ ], "description": "Symfony BrowserKit Component", "homepage": "https://symfony.com", - "time": "2019-10-28T20:30:34+00:00" + "time": "2020-01-04T13:00:46+00:00" }, { "name": "symfony/config", - "version": "v4.4.2", + "version": "v4.4.3", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "6911d432edd5b50822986604fd5a5be3af856d30" + "reference": "4d3979f54472637169080f802dc82197e21fdcce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/6911d432edd5b50822986604fd5a5be3af856d30", - "reference": "6911d432edd5b50822986604fd5a5be3af856d30", + "url": "https://api.github.com/repos/symfony/config/zipball/4d3979f54472637169080f802dc82197e21fdcce", + "reference": "4d3979f54472637169080f802dc82197e21fdcce", "shasum": "" }, "require": { @@ -9550,20 +9558,20 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2019-12-18T12:00:29+00:00" + "time": "2020-01-04T13:00:46+00:00" }, { "name": "symfony/dependency-injection", - "version": "v4.4.2", + "version": "v4.4.3", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "79b0358207a3571cc3af02a57d0321927921f539" + "reference": "6faf589e1f6af78692aed3ab6b3c336c58d5d83c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/79b0358207a3571cc3af02a57d0321927921f539", - "reference": "79b0358207a3571cc3af02a57d0321927921f539", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/6faf589e1f6af78692aed3ab6b3c336c58d5d83c", + "reference": "6faf589e1f6af78692aed3ab6b3c336c58d5d83c", "shasum": "" }, "require": { @@ -9623,20 +9631,20 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2019-12-19T16:00:02+00:00" + "time": "2020-01-21T07:39:36+00:00" }, { "name": "symfony/dom-crawler", - "version": "v4.4.2", + "version": "v4.4.3", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "36bbcab9369fc2f583220890efd43bf262d563fd" + "reference": "b66fe8ccc850ea11c4cd31677706c1219768bea1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/36bbcab9369fc2f583220890efd43bf262d563fd", - "reference": "36bbcab9369fc2f583220890efd43bf262d563fd", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/b66fe8ccc850ea11c4cd31677706c1219768bea1", + "reference": "b66fe8ccc850ea11c4cd31677706c1219768bea1", "shasum": "" }, "require": { @@ -9684,20 +9692,20 @@ ], "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2019-10-29T11:38:30+00:00" + "time": "2020-01-04T13:00:46+00:00" }, { "name": "symfony/http-foundation", - "version": "v4.4.2", + "version": "v4.4.3", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "fcae1cff5b57b2a9c3aabefeb1527678705ddb62" + "reference": "c33998709f3fe9b8e27e0277535b07fbf6fde37a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/fcae1cff5b57b2a9c3aabefeb1527678705ddb62", - "reference": "fcae1cff5b57b2a9c3aabefeb1527678705ddb62", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/c33998709f3fe9b8e27e0277535b07fbf6fde37a", + "reference": "c33998709f3fe9b8e27e0277535b07fbf6fde37a", "shasum": "" }, "require": { @@ -9739,20 +9747,20 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2019-12-19T15:57:49+00:00" + "time": "2020-01-04T13:00:46+00:00" }, { "name": "symfony/mime", - "version": "v5.0.2", + "version": "v5.0.3", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "0e6a4ced216e49d457eddcefb61132173a876d79" + "reference": "2a3c7fee1f1a0961fa9cf360d5da553d05095e59" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/0e6a4ced216e49d457eddcefb61132173a876d79", - "reference": "0e6a4ced216e49d457eddcefb61132173a876d79", + "url": "https://api.github.com/repos/symfony/mime/zipball/2a3c7fee1f1a0961fa9cf360d5da553d05095e59", + "reference": "2a3c7fee1f1a0961fa9cf360d5da553d05095e59", "shasum": "" }, "require": { @@ -9801,20 +9809,20 @@ "mime", "mime-type" ], - "time": "2019-11-30T14:12:50+00:00" + "time": "2020-01-04T14:08:26+00:00" }, { "name": "symfony/options-resolver", - "version": "v4.4.2", + "version": "v4.4.3", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "2be23e63f33de16b49294ea6581f462932a77e2f" + "reference": "9a02d6662660fe7bfadad63b5f0b0718d4c8b6b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/2be23e63f33de16b49294ea6581f462932a77e2f", - "reference": "2be23e63f33de16b49294ea6581f462932a77e2f", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/9a02d6662660fe7bfadad63b5f0b0718d4c8b6b0", + "reference": "9a02d6662660fe7bfadad63b5f0b0718d4c8b6b0", "shasum": "" }, "require": { @@ -9855,7 +9863,7 @@ "configuration", "options" ], - "time": "2019-10-28T21:57:16+00:00" + "time": "2020-01-04T13:00:46+00:00" }, { "name": "symfony/polyfill-intl-idn", @@ -10035,16 +10043,16 @@ }, { "name": "symfony/stopwatch", - "version": "v4.4.2", + "version": "v4.4.3", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "5745b514fc56ae1907c6b8ed74f94f90f64694e9" + "reference": "abc08d7c48987829bac301347faa10f7e8bbf4fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/5745b514fc56ae1907c6b8ed74f94f90f64694e9", - "reference": "5745b514fc56ae1907c6b8ed74f94f90f64694e9", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/abc08d7c48987829bac301347faa10f7e8bbf4fb", + "reference": "abc08d7c48987829bac301347faa10f7e8bbf4fb", "shasum": "" }, "require": { @@ -10081,20 +10089,20 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2019-11-05T16:11:08+00:00" + "time": "2020-01-04T13:00:46+00:00" }, { "name": "symfony/yaml", - "version": "v4.4.2", + "version": "v4.4.3", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "a08832b974dd5fafe3085a66d41fe4c84bb2628c" + "reference": "cd014e425b3668220adb865f53bff64b3ad21767" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/a08832b974dd5fafe3085a66d41fe4c84bb2628c", - "reference": "a08832b974dd5fafe3085a66d41fe4c84bb2628c", + "url": "https://api.github.com/repos/symfony/yaml/zipball/cd014e425b3668220adb865f53bff64b3ad21767", + "reference": "cd014e425b3668220adb865f53bff64b3ad21767", "shasum": "" }, "require": { @@ -10140,7 +10148,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2019-12-10T10:33:21+00:00" + "time": "2020-01-21T11:12:16+00:00" }, { "name": "theseer/fdomdocument", From 7a70a47677f64b7a4edf45c9e072a20b3deabeb8 Mon Sep 17 00:00:00 2001 From: Karyna Tsymbal <k.tsymbal@atwix.com> Date: Tue, 21 Jan 2020 18:36:50 +0200 Subject: [PATCH 0915/1143] Unit Test for Magento\Fedex\Plugin\Block\DataProviders\Tracking\ChangeTitle --- .../Tracking/ChangeTitleTest.php | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 app/code/Magento/Fedex/Test/Unit/Plugin/Block/DataProviders/Tracking/ChangeTitleTest.php diff --git a/app/code/Magento/Fedex/Test/Unit/Plugin/Block/DataProviders/Tracking/ChangeTitleTest.php b/app/code/Magento/Fedex/Test/Unit/Plugin/Block/DataProviders/Tracking/ChangeTitleTest.php new file mode 100644 index 0000000000000..dc3218411b748 --- /dev/null +++ b/app/code/Magento/Fedex/Test/Unit/Plugin/Block/DataProviders/Tracking/ChangeTitleTest.php @@ -0,0 +1,77 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Fedex\Test\Unit\Plugin\Block\DataProviders\Tracking; + +use Magento\Fedex\Plugin\Block\DataProviders\Tracking\ChangeTitle; +use Magento\Framework\Phrase; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Shipping\Block\DataProviders\Tracking\DeliveryDateTitle; +use Magento\Shipping\Model\Tracking\Result\Status; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +/** + * Unit Test for @see \Magento\Fedex\Plugin\Block\DataProviders\Tracking\ChangeTitle + */ +class ChangeTitleTest extends TestCase +{ + /** + * @var ChangeTitle|MockObject + */ + private $plugin; + + /** + * @inheritDoc + */ + protected function setUp() + { + $objectManagerHelper = new ObjectManager($this); + $this->plugin = $objectManagerHelper->getObject(ChangeTitle::class); + } + + /** + * Check if Title was changed + * + * @param string $carrierCode + * @param string $originalResult + * @param Phrase|string $finalResult + * @dataProvider testAfterGetTitleDataProvider + */ + public function testAfterGetTitle($carrierCode, $originalResult, $finalResult) + { + /** @var DeliveryDateTitle|MockObject $subjectMock */ + $subjectMock = $this->getMockBuilder(DeliveryDateTitle::class) + ->disableOriginalConstructor() + ->getMock(); + + /** @var Status|MockObject $trackingStatusMock */ + $trackingStatusMock = $this->getMockBuilder(Status::class) + ->disableOriginalConstructor() + ->setMethods(['getCarrier']) + ->getMock(); + $trackingStatusMock->expects($this::once()) + ->method('getCarrier') + ->willReturn($carrierCode); + + $actual = $this->plugin->afterGetTitle($subjectMock, $originalResult, $trackingStatusMock); + + $this->assertEquals($finalResult, $actual); + } + + /** + * Data provider + * + * @return array + */ + public function testAfterGetTitleDataProvider() + { + return [ + [\Magento\Fedex\Model\Carrier::CODE, 'Original Title', __('Expected Delivery:')], + ['not-fedex', 'Original Title', 'Original Title'], + ]; + } +} From c4c5d736e179d8f6055255eb075b7c3cc705ce58 Mon Sep 17 00:00:00 2001 From: Michele Fantetti <mfantetti@ittweb.net> Date: Tue, 21 Jan 2020 18:33:03 +0100 Subject: [PATCH 0916/1143] Add frontend template hints status command after suggestions --- .../Console/Command/TemplateHintsStatusCommand.php | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php b/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php index b229c9a2b19fc..296d5dd7ac82d 100644 --- a/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php +++ b/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php @@ -16,17 +16,9 @@ */ class TemplateHintsStatusCommand extends Command { - - /** - * command name - */ + const COMMAND_NAME = 'dev:template-hints:status'; - /** - * Success message - */ - const SUCCESS_MESSAGE = "Template hints are %status"; - /** * @var ScopeConfigInterface */ @@ -64,7 +56,7 @@ protected function execute(InputInterface $input, OutputInterface $output) ($this->scopeConfig->isSetFlag('dev/debug/template_hints_storefront', 'default')) ? 'enabled' : 'disabled'; - $templateHintsMessage = __(self::SUCCESS_MESSAGE, ['status' => $templateHintsStatus]); + $templateHintsMessage = __("Template hints are %status", ['status' => $templateHintsStatus]); $output->writeln("<info>" . $templateHintsMessage . "</info>"); return 0; From ec63bdf39196405f3bb613e8790b89c1e5a14642 Mon Sep 17 00:00:00 2001 From: yaroslavGoncharuk <yaroslav.goncharuk@gmail.com> Date: Tue, 21 Jan 2020 11:43:48 -0600 Subject: [PATCH 0917/1143] MC-24173: Fix and Unskip MFTF tests MC-28425, MC-28445, MC-28537 - MC-14770 skipped again due it is still flaky --- .../ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml index 514366fa45c52..1950f060790d7 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml @@ -17,6 +17,9 @@ <testCaseId value="MC-14770"/> <group value="CatalogRule"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-24172"/> + </skip> </annotations> <before> <!-- Login as Admin --> From ab1b1de0294314503af16d5b346e5e2536542210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Tue, 21 Jan 2020 19:06:21 +0100 Subject: [PATCH 0918/1143] magento/magento2#26479 Clear notice if Autoloader was not registered properly, instead of passing the error to higher levels --- .../Magento/Framework/Autoload/AutoloaderRegistry.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/internal/Magento/Framework/Autoload/AutoloaderRegistry.php b/lib/internal/Magento/Framework/Autoload/AutoloaderRegistry.php index f051d215808a3..7a7e3501f89bd 100644 --- a/lib/internal/Magento/Framework/Autoload/AutoloaderRegistry.php +++ b/lib/internal/Magento/Framework/Autoload/AutoloaderRegistry.php @@ -34,12 +34,12 @@ public static function registerAutoloader(AutoloaderInterface $newAutoloader) * @throws \Exception * @return AutoloaderInterface */ - public static function getAutoloader() + public static function getAutoloader(): AutoloaderInterface { - if (self::$autoloader !== null) { - return self::$autoloader; - } else { + if (!self::$autoloader instanceof AutoloaderInterface) { throw new \Exception('Autoloader is not registered, cannot be retrieved.'); } + + return self::$autoloader; } } From bf775238f24f2a60e36a252e3cac937d743fb328 Mon Sep 17 00:00:00 2001 From: Karyna Tsymbal <k.tsymbal@atwix.com> Date: Tue, 21 Jan 2020 20:58:10 +0200 Subject: [PATCH 0919/1143] Unit test for Magento\Fedex\Plugin\Block\Tracking\PopupDeliveryDate --- .../Block/Tracking/PopupDeliveryDateTest.php | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 app/code/Magento/Fedex/Test/Unit/Plugin/Block/Tracking/PopupDeliveryDateTest.php diff --git a/app/code/Magento/Fedex/Test/Unit/Plugin/Block/Tracking/PopupDeliveryDateTest.php b/app/code/Magento/Fedex/Test/Unit/Plugin/Block/Tracking/PopupDeliveryDateTest.php new file mode 100644 index 0000000000000..23465b1b26a42 --- /dev/null +++ b/app/code/Magento/Fedex/Test/Unit/Plugin/Block/Tracking/PopupDeliveryDateTest.php @@ -0,0 +1,90 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Fedex\Test\Unit\Plugin\Block\Tracking; + +use Magento\Fedex\Plugin\Block\Tracking\PopupDeliveryDate; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Shipping\Block\Tracking\Popup; +use Magento\Shipping\Model\Tracking\Result\Status; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +/** + * Unit Test for @see \Magento\Fedex\Plugin\Block\Tracking\PopupDeliveryDate + */ +class PopupDeliveryDateTest extends TestCase +{ + /** + * @var MockObject|PopupDeliveryDate + */ + private $plugin; + + /** + * @inheritDoc + */ + protected function setUp() + { + $objectManagerHelper = new ObjectManager($this); + $this->plugin = $objectManagerHelper->getObject(PopupDeliveryDate::class); + } + + /** + * Test the method with Fedex carrier + */ + public function testAfterFormatDeliveryDateTimeWithFedexCarrier() + { + /** @var Status|MockObject $trackingStatusMock */ + $trackingStatusMock = $this->getMockBuilder(Status::class) + ->disableOriginalConstructor() + ->setMethods(['getCarrier']) + ->getMock(); + $trackingStatusMock->expects($this::once()) + ->method('getCarrier') + ->willReturn(\Magento\Fedex\Model\Carrier::CODE); + + /** @var Popup|MockObject $subjectMock */ + $subjectMock = $this->getMockBuilder(Popup::class) + ->disableOriginalConstructor() + ->setMethods(['formatDeliveryDate', 'getTrackingInfo']) + ->getMock(); + $subjectMock->expects($this->once()) + ->method('getTrackingInfo') + ->willReturn([[$trackingStatusMock]]); + $subjectMock->expects($this->once()) + ->method('formatDeliveryDate'); + + $this->plugin->afterFormatDeliveryDateTime($subjectMock, 'Test Result', '2020-02-02', '12:00'); + } + + /** + * Test the method with a different carrier + */ + public function testAfterFormatDeliveryDateTimeWithOtherCarrier() + { + /** @var Status|MockObject $trackingStatusMock */ + $trackingStatusMock = $this->getMockBuilder(Status::class) + ->disableOriginalConstructor() + ->setMethods(['getCarrier']) + ->getMock(); + $trackingStatusMock->expects($this::once()) + ->method('getCarrier') + ->willReturn('not-fedex'); + + /** @var Popup|MockObject $subjectMock */ + $subjectMock = $this->getMockBuilder(Popup::class) + ->disableOriginalConstructor() + ->setMethods(['formatDeliveryDate', 'getTrackingInfo']) + ->getMock(); + $subjectMock->expects($this->once()) + ->method('getTrackingInfo') + ->willReturn([[$trackingStatusMock]]); + $subjectMock->expects($this->never()) + ->method('formatDeliveryDate'); + + $this->plugin->afterFormatDeliveryDateTime($subjectMock, 'Test Result', '2020-02-02', '12:00'); + } +} From af8e6663d97ded8ab24727282efa253340a32773 Mon Sep 17 00:00:00 2001 From: Prabhu Ram <pganapat@adobe.com> Date: Tue, 21 Jan 2020 14:24:31 -0600 Subject: [PATCH 0920/1143] MC-24172: Fix Skipped MFTF Tests From MC-17140: MC-14770, MC-14771, MC-14772 - add sorting to fix product ordering --- .../ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml index 514366fa45c52..02d6d90ae5d0e 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml @@ -114,6 +114,11 @@ <!-- Navigate to category on store front --> <amOnPage url="{{StorefrontProductPage.url($createCategory.name$)}}" stepKey="goToCategoryPage"/> + <!-- Sort products By Price --> + <actionGroup ref="StorefrontCategoryPageSortProductActionGroup" stepKey="sortProductByPrice"/> + <!-- Set Ascending Direction --> + <actionGroup ref="StorefrontCategoryPageSortAscendingActionGroup" stepKey="setAscendingDirection"/> + <!-- Check simple product name on store front category page --> <actionGroup ref="AssertProductDetailsOnStorefrontActionGroup" stepKey="storefrontProduct1Name"> <argument name="productInfo" value="$createSimpleProduct.name$"/> From 620abb47d15d5f21a5213b08184f66bd2f7a6e8b Mon Sep 17 00:00:00 2001 From: Oleksandr Dubovyk <odubovyk@magento.com> Date: Tue, 21 Jan 2020 16:21:26 -0600 Subject: [PATCH 0921/1143] MC-30255: In Stock Alert Email Shows Incorrect Item Pricing - fixed - modified tests - remove redundant ImageProvider --- .../Block/Email/AbstractEmail.php | 15 +-- .../Block/Product/ImageProvider.php | 72 -------------- .../Magento/ProductAlert/Model/Observer.php | 1 + .../Test/Unit/Block/Email/StockTest.php | 15 +-- .../Unit/Block/Product/ImageProviderTest.php | 99 ------------------- .../Test/Unit/Model/ObserverTest.php | 8 +- 6 files changed, 11 insertions(+), 199 deletions(-) delete mode 100644 app/code/Magento/ProductAlert/Block/Product/ImageProvider.php delete mode 100644 app/code/Magento/ProductAlert/Test/Unit/Block/Product/ImageProviderTest.php diff --git a/app/code/Magento/ProductAlert/Block/Email/AbstractEmail.php b/app/code/Magento/ProductAlert/Block/Email/AbstractEmail.php index ca989c9f5235f..f7a4c53ab1f14 100644 --- a/app/code/Magento/ProductAlert/Block/Email/AbstractEmail.php +++ b/app/code/Magento/ProductAlert/Block/Email/AbstractEmail.php @@ -6,8 +6,6 @@ namespace Magento\ProductAlert\Block\Email; use Magento\Framework\Pricing\PriceCurrencyInterface; -use Magento\Framework\App\ObjectManager; -use Magento\ProductAlert\Block\Product\ImageProvider; /** * Product Alert Abstract Email Block @@ -43,32 +41,23 @@ abstract class AbstractEmail extends \Magento\Framework\View\Element\Template */ protected $imageBuilder; - /** - * @var ImageProvider - */ - private $imageProvider; - /** * @param \Magento\Framework\View\Element\Template\Context $context * @param \Magento\Framework\Filter\Input\MaliciousCode $maliciousCode * @param PriceCurrencyInterface $priceCurrency * @param \Magento\Catalog\Block\Product\ImageBuilder $imageBuilder * @param array $data - * @param ImageProvider $imageProvider */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\Filter\Input\MaliciousCode $maliciousCode, PriceCurrencyInterface $priceCurrency, \Magento\Catalog\Block\Product\ImageBuilder $imageBuilder, - array $data = [], - ImageProvider $imageProvider = null + array $data = [] ) { $this->imageBuilder = $imageBuilder; $this->priceCurrency = $priceCurrency; $this->_maliciousCode = $maliciousCode; - $this->imageProvider = $imageProvider ?: ObjectManager::getInstance()->get(ImageProvider::class); - parent::__construct($context, $data); } @@ -227,6 +216,6 @@ public function getProductPriceHtml( */ public function getImage($product, $imageId, $attributes = []) { - return $this->imageProvider->getImage($product, $imageId, $attributes); + return $this->imageBuilder->create($product, $imageId, $attributes); } } diff --git a/app/code/Magento/ProductAlert/Block/Product/ImageProvider.php b/app/code/Magento/ProductAlert/Block/Product/ImageProvider.php deleted file mode 100644 index 61d8d1987c2d7..0000000000000 --- a/app/code/Magento/ProductAlert/Block/Product/ImageProvider.php +++ /dev/null @@ -1,72 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\ProductAlert\Block\Product; - -use Magento\Store\Model\App\Emulation; -use Magento\Catalog\Block\Product\ImageBuilder; -use Magento\Catalog\Model\Product; -use Magento\Store\Model\StoreManagerInterface; -use Magento\Framework\App\Area; -use Magento\Catalog\Block\Product\Image; - -/** - * Provides product image to be used in the Product Alert Email. - */ -class ImageProvider -{ - /** - * @var ImageBuilder - */ - private $imageBuilder; - - /** - * @var StoreManagerInterface - */ - private $storeManager; - - /** - * @var Emulation - */ - private $appEmulation; - - /** - * @param ImageBuilder $imageBuilder - * @param StoreManagerInterface $storeManager - * @param Emulation $appEmulation - */ - public function __construct( - ImageBuilder $imageBuilder, - StoreManagerInterface $storeManager, - Emulation $appEmulation - ) { - $this->imageBuilder = $imageBuilder; - $this->storeManager = $storeManager; - $this->appEmulation = $appEmulation; - } - - /** - * @param Product $product - * @param string $imageId - * @param array $attributes - * @return Image - * @throws \Exception - */ - public function getImage(Product $product, $imageId, $attributes = []) - { - $storeId = $this->storeManager->getStore()->getId(); - $this->appEmulation->startEnvironmentEmulation($storeId, Area::AREA_FRONTEND, true); - - try { - $image = $this->imageBuilder->create($product, $imageId, $attributes); - } catch (\Exception $exception) { - $this->appEmulation->stopEnvironmentEmulation(); - throw $exception; - } - - $this->appEmulation->stopEnvironmentEmulation(); - return $image; - } -} diff --git a/app/code/Magento/ProductAlert/Model/Observer.php b/app/code/Magento/ProductAlert/Model/Observer.php index addc61d2f49a9..953218d3ea205 100644 --- a/app/code/Magento/ProductAlert/Model/Observer.php +++ b/app/code/Magento/ProductAlert/Model/Observer.php @@ -242,6 +242,7 @@ protected function _processPrice(\Magento\ProductAlert\Model\Email $email) ); $product->setCustomerGroupId($customer->getGroupId()); + $this->_storeManager->getStore()->setWebsiteId($website->getId()); if ($alert->getPrice() > $product->getFinalPrice()) { $productPrice = $product->getFinalPrice(); $product->setFinalPrice($this->_catalogData->getTaxPrice($product, $productPrice)); diff --git a/app/code/Magento/ProductAlert/Test/Unit/Block/Email/StockTest.php b/app/code/Magento/ProductAlert/Test/Unit/Block/Email/StockTest.php index c5872701ef9c8..48907197ab7b3 100644 --- a/app/code/Magento/ProductAlert/Test/Unit/Block/Email/StockTest.php +++ b/app/code/Magento/ProductAlert/Test/Unit/Block/Email/StockTest.php @@ -25,11 +25,6 @@ class StockTest extends \PHPUnit\Framework\TestCase */ protected $imageBuilder; - /** - * @var \Magento\ProductAlert\Block\Product\ImageProvider|\PHPUnit_Framework_MockObject_MockObject - */ - private $imageProviderMock; - protected function setUp() { $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); @@ -39,16 +34,11 @@ protected function setUp() ->disableOriginalConstructor() ->getMock(); - $this->imageProviderMock = $this->getMockBuilder(\Magento\ProductAlert\Block\Product\ImageProvider::class) - ->disableOriginalConstructor() - ->getMock(); - $this->_block = $objectManager->getObject( \Magento\ProductAlert\Block\Email\Stock::class, [ 'maliciousCode' => $this->_filter, - 'imageBuilder' => $this->imageBuilder, - 'imageProvider' => $this->imageProviderMock + 'imageBuilder' => $this->imageBuilder ] ); } @@ -88,8 +78,7 @@ public function testGetImage() ->disableOriginalConstructor() ->getMock(); - $this->imageProviderMock->expects($this->atLeastOnce())->method('getImage')->willReturn($productImageMock); - + $this->imageBuilder->expects($this->atLeastOnce())->method('create')->willReturn($productImageMock); $this->assertInstanceOf( \Magento\Catalog\Block\Product\Image::class, $this->_block->getImage($productMock, $imageId, $attributes) diff --git a/app/code/Magento/ProductAlert/Test/Unit/Block/Product/ImageProviderTest.php b/app/code/Magento/ProductAlert/Test/Unit/Block/Product/ImageProviderTest.php deleted file mode 100644 index 172e5f486f30b..0000000000000 --- a/app/code/Magento/ProductAlert/Test/Unit/Block/Product/ImageProviderTest.php +++ /dev/null @@ -1,99 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\ProductAlert\Test\Unit\Block\Product; - -class ImageProviderTest extends \PHPUnit\Framework\TestCase -{ - /** - * @var \Magento\Catalog\Block\Product\ImageBuilder|\PHPUnit_Framework_MockObject_MockObject - */ - private $imageBuilderMock; - - /** - * @var \Magento\Store\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject - */ - private $storeManagerMock; - - /** - * @var \Magento\Store\Model\App\Emulation|\PHPUnit_Framework_MockObject_MockObject - */ - private $emulationMock; - - /** - * @var \Magento\ProductAlert\Block\Product\ImageProvider - */ - private $model; - - protected function setUp() - { - $this->imageBuilderMock = $this->getMockBuilder(\Magento\Catalog\Block\Product\ImageBuilder::class) - ->disableOriginalConstructor() - ->getMock(); - $this->storeManagerMock = $this->getMockBuilder(\Magento\Store\Model\StoreManagerInterface::class) - ->disableOriginalConstructor() - ->getMock(); - $this->emulationMock = $this->getMockBuilder(\Magento\Store\Model\App\Emulation::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->model = new \Magento\ProductAlert\Block\Product\ImageProvider( - $this->imageBuilderMock, - $this->storeManagerMock, - $this->emulationMock - ); - } - - /** - * Test that image is created successfully with app emulation enabled. - */ - public function testGetImage() - { - $imageId = 'test_image_id'; - $attributes = []; - - $productMock = $this->createMock(\Magento\Catalog\Model\Product::class); - $imageMock = $this->createMock(\Magento\Catalog\Block\Product\Image::class); - $storeMock = $this->createMock(\Magento\Store\Api\Data\StoreInterface::class); - - $this->storeManagerMock->expects($this->atLeastOnce())->method('getStore')->willReturn($storeMock); - $this->emulationMock->expects($this->once())->method('startEnvironmentEmulation'); - $this->imageBuilderMock->expects($this->once()) - ->method('create') - ->with($productMock, $imageId, $attributes) - ->willReturn($imageMock); - $this->emulationMock->expects($this->once())->method('stopEnvironmentEmulation'); - - $this->assertEquals($imageMock, $this->model->getImage($productMock, $imageId, $attributes)); - } - - /** - * Test that app emulation stops when exception occurs. - * - * @expectedException \Exception - * @expectedExceptionMessage Image Builder Exception - */ - public function testGetImageThrowsAnException() - { - $imageId = 1; - $productMock = $this->getMockBuilder(\Magento\Catalog\Model\Product::class) - ->disableOriginalConstructor() - ->getMock(); - $storeMock = $this->getMockBuilder(\Magento\Store\Api\Data\StoreInterface::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->emulationMock->expects($this->once())->method('startEnvironmentEmulation'); - $this->storeManagerMock->expects($this->atLeastOnce())->method('getStore')->willReturn($storeMock); - - $this->imageBuilderMock->expects($this->once()) - ->method('create') - ->with($productMock, $imageId) - ->willThrowException(new \Exception("Image Builder Exception")); - - $this->emulationMock->expects($this->once())->method('stopEnvironmentEmulation'); - $this->model->getImage($productMock, $imageId); - } -} diff --git a/app/code/Magento/ProductAlert/Test/Unit/Model/ObserverTest.php b/app/code/Magento/ProductAlert/Test/Unit/Model/ObserverTest.php index e3a2056a89ec0..9a5381c094243 100644 --- a/app/code/Magento/ProductAlert/Test/Unit/Model/ObserverTest.php +++ b/app/code/Magento/ProductAlert/Test/Unit/Model/ObserverTest.php @@ -11,6 +11,9 @@ /** * Class ObserverTest + * + * Is used to test Product Alert Observer + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.TooManyFields) */ @@ -168,7 +171,7 @@ protected function setUp() ); $this->storeMock = $this->getMockBuilder(\Magento\Store\Model\Store::class) ->disableOriginalConstructor() - ->setMethods(['getDefaultStore', 'getId']) + ->setMethods(['getDefaultStore', 'getId', 'setWebsiteId']) ->getMock(); $this->customerRepositoryMock = $this->getMockBuilder(\Magento\Customer\Api\CustomerRepositoryInterface::class) ->getMock(); @@ -285,12 +288,13 @@ public function testProcessPriceEmailThrowsException() $this->storeMock->expects($this->any())->method('getDefaultStore')->willReturnSelf(); $this->websiteMock->expects($this->once())->method('getDefaultStore')->willReturn($this->storeMock); $this->storeMock->expects($this->any())->method('getId')->willReturn(2); + $this->storeMock->expects($this->any())->method('setWebsiteId')->willReturnSelf(); $this->scopeConfigMock->expects($this->once())->method('getValue')->willReturn(true); $this->priceColFactoryMock->expects($this->once())->method('create')->willReturnSelf(); $this->priceColFactoryMock->expects($this->once())->method('addWebsiteFilter')->willReturnSelf(); - + $this->storeManagerMock->expects($this->any())->method('getStore')->willReturn($this->storeMock); $items = [ new \Magento\Framework\DataObject([ 'customer_id' => $id From 41c671795d4a5fb076ffa6fc636fe7da9ffbb2e5 Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Wed, 22 Jan 2020 09:45:19 +0200 Subject: [PATCH 0922/1143] MC-30189: Error Import exported .csv file with small profile generated data --- .../Setup/Fixtures/AttributeSet/Pattern.php | 10 +- .../Setup/Fixtures/SimpleProductsFixture.php | 110 +++++++++++++----- .../Fixtures/AttributeSet/PatternTest.php | 3 +- 3 files changed, 88 insertions(+), 35 deletions(-) diff --git a/setup/src/Magento/Setup/Fixtures/AttributeSet/Pattern.php b/setup/src/Magento/Setup/Fixtures/AttributeSet/Pattern.php index 1d582862c2428..2947bd352aab3 100644 --- a/setup/src/Magento/Setup/Fixtures/AttributeSet/Pattern.php +++ b/setup/src/Magento/Setup/Fixtures/AttributeSet/Pattern.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Setup\Fixtures\AttributeSet; /** @@ -32,7 +34,7 @@ class Pattern * @param string $name * @param int $attributesPerSet * @param int $optionsPerAttribute - * @param callable $attributePattern callback in f($index, $attributeData) format + * @param callable $attributePattern callback in f($index, $attributeData) format * @return array */ public function generateAttributeSet( @@ -46,9 +48,9 @@ public function generateAttributeSet( 'attributes' => [] ]; for ($index = 1; $index <= $attributesPerSet; $index++) { - $attributeData = $this->generateAttribute( + $attributeData = $this->generateAttribute( $index, - is_array($optionsPerAttribute) ? $optionsPerAttribute[$index-1] : $optionsPerAttribute + is_array($optionsPerAttribute) ? $optionsPerAttribute[$index - 1] : $optionsPerAttribute ); if (is_callable($attributePattern)) { $attributeData = $attributePattern($index, $attributeData); @@ -72,7 +74,7 @@ private function generateAttribute($index, $optionsPerAttribute) $attribute['attribute_code'] = $attribute['attribute_code'] . $index; $attribute['frontend_label'] = $attribute['frontend_label'] . $index; $attribute['options'] = ['option' => $this->generateOptions($optionsPerAttribute)]; - $attribute['default_option'] = $attribute['options']['option'][0]['label']; + $attribute['default_value'] = $attribute['options']['option'][0]['value']; return $attribute; } diff --git a/setup/src/Magento/Setup/Fixtures/SimpleProductsFixture.php b/setup/src/Magento/Setup/Fixtures/SimpleProductsFixture.php index 8e2e842a7d805..84fb2e5beed4b 100644 --- a/setup/src/Magento/Setup/Fixtures/SimpleProductsFixture.php +++ b/setup/src/Magento/Setup/Fixtures/SimpleProductsFixture.php @@ -3,13 +3,17 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Setup\Fixtures; use Magento\Catalog\Model\Product; use Magento\Catalog\Model\Product\Attribute\Source\Status; use Magento\Catalog\Model\ProductFactory; +use Magento\Eav\Model\Entity\Attribute; +use Magento\Eav\Model\ResourceModel\Entity\Attribute\Collection; use Magento\Eav\Model\ResourceModel\Entity\Attribute\CollectionFactory; +use Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\Collection as AttributeSetCollection; use Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\CollectionFactory as AttributeSetCollectionFactory; use Magento\Setup\Model\FixtureGenerator\ProductGenerator; use Magento\Setup\Model\SearchTermDescriptionGeneratorFactory; @@ -68,7 +72,7 @@ class SimpleProductsFixture extends Fixture private $defaultAttributeSetId; /** - * @var \Magento\Eav\Model\ResourceModel\Entity\Attribute\Collection + * @var Collection */ private $attributeCollectionFactory; @@ -97,6 +101,11 @@ class SimpleProductsFixture extends Fixture */ private $priceProvider; + /** + * @var int[] + */ + private $additionalAttributeSetIds; + /** * @param FixtureModel $fixtureModel * @param ProductFactory $productFactory @@ -184,35 +193,38 @@ public function execute() 'Short simple product Description %s' ); - $additionalAttributeSets = $this->getAdditionalAttributeSets(); - $attributeSet = function ($index) use ($defaultAttributeSets, $additionalAttributeSets) { + $additionalAttributeSetIds = $this->getAdditionalAttributeSetIds(); + $attributeSet = function ($index) use ($defaultAttributeSets, $additionalAttributeSetIds) { // phpcs:ignore mt_srand($index); $attributeSetCount = count(array_keys($defaultAttributeSets)); if ($attributeSetCount > (($index - 1) % (int)$this->fixtureModel->getValue('categories', 30))) { - // phpcs:ignore Magento2.Functions.DiscouragedFunction + // phpcs:ignore Magento2.Security.InsecureFunction return array_keys($defaultAttributeSets)[mt_rand(0, count(array_keys($defaultAttributeSets)) - 1)]; } else { - $customSetsAmount = count($additionalAttributeSets); + $customSetsAmount = count($additionalAttributeSetIds); return $customSetsAmount - ? $additionalAttributeSets[$index % count($additionalAttributeSets)]['attribute_set_id'] + ? $additionalAttributeSetIds[$index % $customSetsAmount] : $this->getDefaultAttributeSetId(); } }; + $additionalAttributeValues = $this->getAdditionalAttributeValues(); $additionalAttributes = function ( $attributeSetId, $index ) use ( $defaultAttributeSets, - $additionalAttributeSets + $additionalAttributeValues ) { $attributeValues = []; // phpcs:ignore mt_srand($index); - if (isset($defaultAttributeSets[$attributeSetId])) { - foreach ($defaultAttributeSets[$attributeSetId] as $attributeCode => $values) { - // phpcs:ignore Magento2.Functions.DiscouragedFunction + $attributeValuesByAttributeSet = $defaultAttributeSets[$attributeSetId] + ?? $additionalAttributeValues[$attributeSetId]; + if (!empty($attributeValuesByAttributeSet)) { + foreach ($attributeValuesByAttributeSet as $attributeCode => $values) { + // phpcs:ignore Magento2.Security.InsecureFunction $attributeValues[$attributeCode] = $values[mt_rand(0, count($values) - 1)]; } } @@ -279,10 +291,10 @@ private function getDefaultAttributeSetId() } /** - * Get default attribute sets with attributes + * Get default attribute sets with attributes. * - * @see config/attributeSets.xml * @return array + * @see config/attributeSets.xml */ private function getDefaultAttributeSets() { @@ -301,17 +313,7 @@ private function getDefaultAttributeSets() 'attribute_code', array_column($attributesData, 'attribute_code') ); - /** @var \Magento\Eav\Model\Entity\Attribute $attribute */ - foreach ($attributeCollection as $attribute) { - $values = []; - $options = $attribute->getOptions(); - foreach (($options ?: []) as $option) { - if ($option->getValue()) { - $values[] = $option->getValue(); - } - } - $attributes[$attribute->getAttributeSetId()][$attribute->getAttributeCode()] = $values; - } + $attributes = $this->processAttributeValues($attributeCollection, $attributes); } } $attributes[$this->getDefaultAttributeSetId()] = []; @@ -381,16 +383,64 @@ private function readDescriptionConfig($configSrc) } /** - * Get additional attribute sets + * Get additional attribute set ids. + * + * @return int[] + */ + private function getAdditionalAttributeSetIds() + { + if (null === $this->additionalAttributeSetIds) { + /** @var AttributeSetCollection $sets */ + $sets = $this->attributeSetCollectionFactory->create(); + $sets->addFieldToFilter( + 'attribute_set_name', + ['like' => AttributeSetsFixture::PRODUCT_SET_NAME . '%'] + ); + $this->additionalAttributeSetIds = $sets->getAllIds(); + } + + return $this->additionalAttributeSetIds; + } + + /** + * Get values of additional attributes. * - * @return \Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\Collection[] + * @return array */ - private function getAdditionalAttributeSets() + private function getAdditionalAttributeValues(): array { - /** @var \Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\Collection $sets */ - $sets = $this->attributeSetCollectionFactory->create(); - $sets->addFieldToFilter('attribute_set_name', ['like' => AttributeSetsFixture::PRODUCT_SET_NAME . '%']); + $attributeCollection = $this->attributeCollectionFactory->create(); + $attributeCollection->setAttributeSetsFilter($this->getAdditionalAttributeSetIds()) + ->addFieldToFilter('attribute_code', ['like' => 'attribute_set%']); + $attributeCollection->getSelect()->columns(['entity_attribute.attribute_set_id']); + + return $this->processAttributeValues($attributeCollection); + } - return $sets->getData(); + /** + * Maps attribute values by attribute set and attribute code. + * + * @param Collection $attributeCollection + * @param array $attributes + * @return array + */ + private function processAttributeValues( + Collection $attributeCollection, + array $attributes = [] + ): array { + /** @var Attribute $attribute */ + foreach ($attributeCollection as $attribute) { + $values = []; + $options = $attribute->getOptions() ?? []; + $attributeSetId = $attribute->getAttributeSetId() ?? $this->getDefaultAttributeSetId(); + foreach ($options as $option) { + if ($option->getValue()) { + $values[] = $option->getValue(); + } + } + $attributes[$attributeSetId][$attribute->getAttributeCode()] = $values; + } + + return $attributes; } } diff --git a/setup/src/Magento/Setup/Test/Unit/Fixtures/AttributeSet/PatternTest.php b/setup/src/Magento/Setup/Test/Unit/Fixtures/AttributeSet/PatternTest.php index f267343bd3fd3..dcb7430c0e82a 100644 --- a/setup/src/Magento/Setup/Test/Unit/Fixtures/AttributeSet/PatternTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Fixtures/AttributeSet/PatternTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Setup\Test\Unit\Fixtures\AttributeSet; @@ -28,7 +29,7 @@ public function testGenerateAttributeSet() 'frontend_label' => 'Attribute 1', 'frontend_input' => 'select', 'backend_type' => 1, - 'default_option' => 'option 1', + 'default_value' => 'option_1', 'options' => [ 'option' => [ [ From fd1fe53c1c42ebc7c459d7cd98554dd875d6b4c7 Mon Sep 17 00:00:00 2001 From: Mykhailo Matiola <mykhailo.matiola@transoftgroup.com> Date: Wed, 22 Jan 2020 10:36:50 +0200 Subject: [PATCH 0923/1143] MC-29690: Layered Navigation with in stock/out of stock products on Category page --- .../Catalog/_files/product_with_category.php | 47 ++++++++ .../_files/product_with_category_rollback.php | 30 +++++ .../Category/OutOfStockProductsFilterTest.php | 110 ++++++++++++++++++ .../Search/OutOfStockProductsFilterTest.php | 53 +++++++++ 4 files changed, 240 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/product_with_category.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/product_with_category_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/OutOfStockProductsFilterTest.php create mode 100644 dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Search/OutOfStockProductsFilterTest.php diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_with_category.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_with_category.php new file mode 100644 index 0000000000000..28c235e4e3e87 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_with_category.php @@ -0,0 +1,47 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Catalog\Model\Product\Type; +use Magento\Catalog\Model\Product\Visibility; +use Magento\Catalog\Model\ProductFactory; +use Magento\Store\Api\WebsiteRepositoryInterface; +use Magento\TestFramework\Helper\Bootstrap; + +require __DIR__ . '/category.php'; + +$objectManager = Bootstrap::getObjectManager(); +/** @var ProductFactory $productFactory */ +$productFactory = $objectManager->get(ProductFactory::class); +/** @var WebsiteRepositoryInterface $websiteRepository */ +$websiteRepository = $objectManager->get(WebsiteRepositoryInterface::class); +$defaultWebsiteId = $websiteRepository->get('base')->getId(); +$product = $productFactory->create(); +$product->isObjectNew(true); +$product->setTypeId(Type::TYPE_SIMPLE) + ->setAttributeSetId($product->getDefaultAttributeSetId()) + ->setWebsiteIds([$defaultWebsiteId]) + ->setName('Simple Product In Stock') + ->setSku('in-stock-product') + ->setPrice(10) + ->setWeight(1) + ->setShortDescription("Short description") + ->setTaxClassId(0) + ->setDescription('Description with <b>html tag</b>') + ->setMetaTitle('meta title') + ->setMetaKeyword('meta keyword') + ->setMetaDescription('meta description') + ->setVisibility(Visibility::VISIBILITY_BOTH) + ->setStatus(Status::STATUS_ENABLED) + ->setCategoryIds([333]) + ->setStockData(['use_config_manage_stock' => 0]) + ->setCanSaveCustomOptions(true) + ->setHasOptions(true); +/** @var ProductRepositoryInterface $productRepositoryFactory */ +$productRepository = $objectManager->create(ProductRepositoryInterface::class); +$productRepository->save($product); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_with_category_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_with_category_rollback.php new file mode 100644 index 0000000000000..12d8c720d10d1 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_with_category_rollback.php @@ -0,0 +1,30 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Registry; +use Magento\TestFramework\Helper\Bootstrap; + +require __DIR__ . '/category_rollback.php'; + +$objectManager = Bootstrap::getObjectManager(); +/** @var Registry $registry */ +$registry = $objectManager->get(Registry::class); + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->create(ProductRepositoryInterface::class); + +try { + $productRepository->deleteById('in-stock-product'); +} catch (NoSuchEntityException $e) { + //already removed +} +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); diff --git a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/OutOfStockProductsFilterTest.php b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/OutOfStockProductsFilterTest.php new file mode 100644 index 0000000000000..9a0deedea94ab --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/OutOfStockProductsFilterTest.php @@ -0,0 +1,110 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\LayeredNavigation\Block\Navigation\Category; + +use Magento\Catalog\Model\Layer\Resolver; +use Magento\CatalogInventory\Model\Configuration; +use Magento\Framework\App\Config\MutableScopeConfigInterface; +use Magento\Framework\App\ScopeInterface; +use Magento\LayeredNavigation\Block\Navigation\AbstractFiltersTest; +use Magento\Catalog\Model\Layer\Filter\AbstractFilter; +use Magento\Store\Model\ScopeInterface as StoreScope; + +/** + * Provides tests for select filter in navigation block on category page with out of stock products + * and enabled out of stock products displaying. + * + * @magentoAppArea frontend + * @magentoAppIsolation enabled + * @magentoDbIsolation disabled + */ +class OutOfStockProductsFilterTest extends AbstractFiltersTest +{ + /** + * @var MutableScopeConfigInterface + */ + private $scopeConfig; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + $this->scopeConfig = $this->objectManager->get(MutableScopeConfigInterface::class); + } + + /** + * @magentoDataFixture Magento/Catalog/_files/product_dropdown_attribute.php + * @magentoDataFixture Magento/Catalog/_files/out_of_stock_product_with_category.php + * @magentoDataFixture Magento/Catalog/_files/product_with_category.php + * @dataProvider getFiltersWithOutOfStockProduct + * @param int $showOutOfStock + * @param array $expectation + * @return void + */ + public function testGetFiltersWithOutOfStockProduct(int $showOutOfStock, array $expectation): void + { + $this->updateConfigShowOutOfStockFlag($showOutOfStock); + $this->getCategoryFiltersAndAssert( + ['out-of-stock-product' => 'Option 1', 'in-stock-product' => 'Option 2'], + ['is_filterable' => AbstractFilter::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS], + $expectation, + 'Category 1' + ); + } + + /** + * @return array + */ + public function getFiltersWithOutOfStockProduct(): array + { + return [ + 'show_out_of_stock' => [ + 'show_out_of_stock' => 1, + 'expectation' => [['label' => 'Option 1', 'count' => 1], ['label' => 'Option 2', 'count' => 1]], + ], + 'not_show_out_of_stock' => [ + 'show_out_of_stock' => 0, + 'expectation' => [['label' => 'Option 2', 'count' => 1]], + ], + ]; + } + + /** + * @inheritdoc + */ + protected function getLayerType(): string + { + return Resolver::CATALOG_LAYER_CATEGORY; + } + + /** + * @inheritdoc + */ + protected function getAttributeCode(): string + { + return 'dropdown_attribute'; + } + + /** + * Updates store config 'cataloginventory/options/show_out_of_stock' flag. + * + * @param int $showOutOfStock + * @return void + */ + protected function updateConfigShowOutOfStockFlag(int $showOutOfStock): void + { + $this->scopeConfig->setValue( + Configuration::XML_PATH_SHOW_OUT_OF_STOCK, + $showOutOfStock, + StoreScope::SCOPE_STORE, + ScopeInterface::SCOPE_DEFAULT + ); + } +} diff --git a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Search/OutOfStockProductsFilterTest.php b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Search/OutOfStockProductsFilterTest.php new file mode 100644 index 0000000000000..c4b7b3bdcc68b --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Search/OutOfStockProductsFilterTest.php @@ -0,0 +1,53 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\LayeredNavigation\Block\Navigation\Search; + +use Magento\Catalog\Model\Layer\Filter\AbstractFilter; +use Magento\Catalog\Model\Layer\Resolver; +use Magento\LayeredNavigation\Block\Navigation\Category\OutOfStockProductsFilterTest as CategoryFilterTest; + +/** + * Provides tests for select filter in navigation block on search page with out of stock products + * and enabled out of stock products displaying. + * + * @magentoAppArea frontend + * @magentoAppIsolation enabled + * @magentoDbIsolation disabled + */ +class OutOfStockProductsFilterTest extends CategoryFilterTest +{ + /** + * @magentoDataFixture Magento/Catalog/_files/product_dropdown_attribute.php + * @magentoDataFixture Magento/Catalog/_files/out_of_stock_product_with_category.php + * @magentoDataFixture Magento/Catalog/_files/product_with_category.php + * @dataProvider getFiltersWithOutOfStockProduct + * @param int $showOutOfStock + * @param array $expectation + * @return void + */ + public function testGetFiltersWithOutOfStockProduct(int $showOutOfStock, array $expectation): void + { + $this->updateConfigShowOutOfStockFlag($showOutOfStock); + $this->getSearchFiltersAndAssert( + ['out-of-stock-product' => 'Option 1', 'in-stock-product' => 'Option 2'], + [ + 'is_filterable' => AbstractFilter::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS, + 'is_filterable_in_search' => 1, + ], + $expectation + ); + } + + /** + * @inheritdoc + */ + protected function getLayerType(): string + { + return Resolver::CATALOG_LAYER_SEARCH; + } +} From 47c394ee31d7865cc4ba1ba39b26e37d748a828d Mon Sep 17 00:00:00 2001 From: Mykhailo Matiola <mykhailo.matiola@transoftgroup.com> Date: Wed, 22 Jan 2020 10:45:33 +0200 Subject: [PATCH 0924/1143] MC-30562: Storefront: Layered Navigation with configurable product --- .../configurable_product_with_category.php | 23 ++ ...gurable_product_with_category_rollback.php | 9 + .../Block/Navigation/AbstractFiltersTest.php | 6 +- .../Category/Configurable/PriceFilterTest.php | 157 ++++++++++++ .../Block/Product/ListProductTest.php | 238 ++++++++++++++++++ 5 files changed, 432 insertions(+), 1 deletion(-) create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_category.php create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_category_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/Configurable/PriceFilterTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Swatches/Block/Product/ListProductTest.php diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_category.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_category.php new file mode 100644 index 0000000000000..0db8b8b097644 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_category.php @@ -0,0 +1,23 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\CategoryLinkManagementInterface; +use Magento\Catalog\Helper\DefaultCategory; +use Magento\TestFramework\Helper\Bootstrap; + +require __DIR__ . '/../../Catalog/_files/category.php'; +require __DIR__ . '/product_configurable.php'; + +$objectManager = Bootstrap::getObjectManager(); +/** @var CategoryLinkManagementInterface $categoryLinkManagement */ +$categoryLinkManagement = $objectManager->create(CategoryLinkManagementInterface::class); +/** @var DefaultCategory $categoryHelper */ +$categoryHelper = $objectManager->get(DefaultCategory::class); + +foreach (['simple_10', 'simple_20', 'configurable'] as $sku) { + $categoryLinkManagement->assignProductToCategories($sku, [$categoryHelper->getId(), 333]); +} diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_category_rollback.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_category_rollback.php new file mode 100644 index 0000000000000..36d070f566bb4 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_category_rollback.php @@ -0,0 +1,9 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +require __DIR__ . '/../../Catalog/_files/category_rollback.php'; +require __DIR__ . '/product_configurable_rollback.php'; diff --git a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/AbstractFiltersTest.php b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/AbstractFiltersTest.php index fed8c76852872..54996e2f1b5da 100644 --- a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/AbstractFiltersTest.php +++ b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/AbstractFiltersTest.php @@ -182,8 +182,12 @@ protected function updateAttribute( array $data ): void { $attribute = $this->attributeRepository->get($this->getAttributeCode()); + $attribute->setDataChanges(false); $attribute->addData($data); - $this->attributeRepository->save($attribute); + + if ($attribute->hasDataChanges()) { + $this->attributeRepository->save($attribute); + } } /** diff --git a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/Configurable/PriceFilterTest.php b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/Configurable/PriceFilterTest.php new file mode 100644 index 0000000000000..9dcc713bc4867 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/Configurable/PriceFilterTest.php @@ -0,0 +1,157 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\LayeredNavigation\Block\Navigation\Category\Configurable; + +use Magento\Catalog\Model\Layer\Resolver; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Framework\Module\Manager; +use Magento\LayeredNavigation\Block\Navigation\AbstractFiltersTest; +use Magento\Catalog\Model\Layer\Filter\AbstractFilter; +use Magento\Catalog\Model\Layer\Filter\Item; +use Magento\Store\Model\Store; + +/** + * Provides price filter tests for configurable in navigation block on category page. + * + * @magentoAppArea frontend + * @magentoAppIsolation enabled + * @magentoDbIsolation disabled + */ +class PriceFilterTest extends AbstractFiltersTest +{ + /** + * @var Manager + */ + private $moduleManager; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + $this->moduleManager = $this->objectManager->get(Manager::class); + //This check is needed because LayeredNavigation independent of Magento_ConfigurableProduct + if (!$this->moduleManager->isEnabled('Magento_ConfigurableProduct')) { + $this->markTestSkipped('Magento_ConfigurableProduct module disabled.'); + } + } + + /** + * @magentoDataFixture Magento/ConfigurableProduct/_files/configurable_product_with_category.php + * @magentoDataFixture Magento/Catalog/_files/category_product.php + * @magentoConfigFixture current_store catalog/layered_navigation/price_range_calculation manual + * @magentoConfigFixture current_store catalog/layered_navigation/price_range_step 10 + * @dataProvider getFiltersDataProvider + * @param array $products + * @param array $expectation + * @return void + */ + public function testGetFilters(array $products, array $expectation): void + { + $this->updateProductData($products); + $this->getCategoryFiltersAndAssert([], ['is_filterable' => '1'], $expectation, 'Category 1'); + } + + /** + * @return array + */ + public function getFiltersDataProvider(): array + { + return [ + 'all_children_active' => [ + 'products_data' => [ + 'simple333' => ['price' => 60.00], + ], + 'expectation' => [ + [ + 'label' => '<span class="price">$10.00</span> - <span class="price">$19.99</span>', + 'value' => '10-20', + 'count' => 1, + ], + [ + 'label' => '<span class="price">$60.00</span> and above', + 'value' => '60-', + 'count' => 1, + ], + ], + ], + 'one_child_disabled' => [ + 'products_data' => [ + 'simple333' => ['price' => 50.00], + 'simple_10' => ['status' => Status::STATUS_DISABLED], + ], + 'expectation' => [ + [ + 'label' => '<span class="price">$20.00</span> - <span class="price">$29.99</span>', + 'value' => '20-30', + 'count' => 1, + ], + [ + 'label' => '<span class="price">$50.00</span> and above', + 'value' => '50-', + 'count' => 1, + ], + ], + ], + ]; + } + + /** + * @inheritdoc + */ + protected function getLayerType(): string + { + return Resolver::CATALOG_LAYER_CATEGORY; + } + + /** + * @inheritdoc + */ + protected function getAttributeCode(): string + { + return 'price'; + } + + /** + * @inheritdoc + */ + protected function prepareFilterItems(AbstractFilter $filter): array + { + $items = []; + /** @var Item $item */ + foreach ($filter->getItems() as $item) { + $item = [ + 'label' => __($item->getData('label'))->render(), + 'value' => $item->getData('value'), + 'count' => $item->getData('count'), + ]; + $items[] = $item; + } + + return $items; + } + + /** + * Updates products data. + * + * @param array $products + * @param int $storeId + * @return void + */ + private function updateProductData( + array $products, + int $storeId = Store::DEFAULT_STORE_ID + ): void { + foreach ($products as $productSku => $data) { + $product = $this->productRepository->get($productSku, false, $storeId, true); + $product->addData($data); + $this->productRepository->save($product); + } + } +} diff --git a/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/ListProductTest.php b/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/ListProductTest.php new file mode 100644 index 0000000000000..460e4559a0e84 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/ListProductTest.php @@ -0,0 +1,238 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Swatches\Block\Product; + +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Block\Product\Image; +use Magento\Catalog\Block\Product\ListProduct; +use Magento\Catalog\Model\ResourceModel\Product as ProductResource; +use Magento\Framework\App\RequestInterface; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\View\LayoutInterface; +use Magento\Store\Model\Store; +use Magento\Swatches\Model\Plugin\ProductImage; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; + +/** + * Tests for displaying configurable product image with swatch attributes. + * + * @magentoAppIsolation enabled + * @magentoDbIsolation enabled + * @magentoAppArea frontend + */ +class ListProductTest extends TestCase +{ + /** + * @var ObjectManagerInterface + */ + private $objectManager; + + /** + * @var ProductRepositoryInterface + */ + private $productRepository; + + /** + * @var ProductResource + */ + private $productResource; + + /** + * @var ProductAttributeRepositoryInterface + */ + private $attributeRepository; + + /** + * @var RequestInterface + */ + private $request; + + /** + * @var LayoutInterface + */ + private $layout; + + /** + * @var ListProduct + */ + private $listingBlock; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + $this->objectManager = Bootstrap::getObjectManager(); + $this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class); + $this->productResource = $this->objectManager->get(ProductResource::class); + $this->attributeRepository = $this->objectManager->get(ProductAttributeRepositoryInterface::class); + $this->request = $this->objectManager->get(RequestInterface::class); + $this->layout = $this->objectManager->get(LayoutInterface::class); + $this->listingBlock = $this->layout->createBlock(ListProduct::class); + } + + /** + * @magentoDataFixture Magento/Swatches/_files/configurable_product_text_swatch_attribute.php + * @magentoDataFixture Magento/Catalog/_files/product_image.php + * @dataProvider getImageDataProvider + * @param array $images + * @param string $area + * @param array $expectation + * @return void + */ + public function testGetImageForTextSwatchConfigurable(array $images, string $area, array $expectation): void + { + $this->updateAttributePreviewImageFlag('text_swatch_attribute'); + $this->addFilterToRequest('text_swatch_attribute', 'option 1'); + $this->assertProductImage($images, $area, $expectation); + } + + /** + * @magentoDataFixture Magento/Swatches/_files/configurable_product_visual_swatch_attribute.php + * @magentoDataFixture Magento/Catalog/_files/product_image.php + * @dataProvider getImageDataProvider + * @param array $images + * @param string $area + * @param array $expectation + * @return void + */ + public function testGetImageForVisualSwatchConfigurable(array $images, string $area, array $expectation): void + { + $this->updateAttributePreviewImageFlag('visual_swatch_attribute'); + $this->addFilterToRequest('visual_swatch_attribute', 'option 1'); + $this->assertProductImage($images, $area, $expectation); + } + + /** + * @return array + */ + public function getImageDataProvider(): array + { + return [ + 'without_images_and_display_grid' => [ + 'images' => [], + 'display_area' => ProductImage::CATEGORY_PAGE_GRID_LOCATION, + 'expectation' => ['image_url' => 'placeholder/small_image.jpg', 'label' => 'Configurable Product'], + ], + 'without_images_and_display_list' => [ + 'images' => [], + 'display_area' => ProductImage::CATEGORY_PAGE_LIST_LOCATION, + 'expectation' => ['image_url' => 'placeholder/small_image.jpg', 'label' => 'Configurable Product'], + ], + 'with_image_on_configurable_and_display_grid' => [ + 'images' => ['configurable' => '/m/a/magento_image.jpg'], + 'display_area' => ProductImage::CATEGORY_PAGE_GRID_LOCATION, + 'expectation' => ['image_url' => '/m/a/magento_image.jpg', 'label' => 'Image Alt Text'], + ], + 'with_image_on_configurable_and_display_list' => [ + 'images' => ['configurable' => '/m/a/magento_image.jpg'], + 'display_area' => ProductImage::CATEGORY_PAGE_LIST_LOCATION, + 'expectation' => ['image_url' => '/m/a/magento_image.jpg', 'label' => 'Image Alt Text'], + ], + 'with_image_on_simple' => [ + 'images' => ['simple_option_1' => '/m/a/magento_small_image.jpg'], + 'display_area' => ProductImage::CATEGORY_PAGE_GRID_LOCATION, + 'expectation' => ['image_url' => '/m/a/magento_small_image.jpg', 'label' => 'Image Alt Text'], + ], + 'with_image_on_simple_and_configurable' => [ + 'images' => [ + 'configurable' => '/m/a/magento_image.jpg', + 'simple_option_1' => '/m/a/magento_small_image.jpg', + ], + 'display_area' => ProductImage::CATEGORY_PAGE_GRID_LOCATION, + 'expectation' => ['image_url' => '/m/a/magento_small_image.jpg', 'label' => 'Image Alt Text'], + ], + ]; + } + + /** + * Asserts image data. + * + * @param array $images + * @param string $area + * @param array $expectation + * @return void + */ + private function assertProductImage(array $images, string $area, array $expectation): void + { + $this->updateProductImages($images); + $productImage = $this->listingBlock->getImage($this->productRepository->get('configurable'), $area); + $this->assertInstanceOf(Image::class, $productImage); + $this->assertEquals($productImage->getCustomAttributes(), ''); + $this->assertEquals($productImage->getClass(), 'product-image-photo'); + $this->assertEquals($productImage->getRatio(), 1.25); + $this->assertEquals($productImage->getLabel(), $expectation['label']); + $this->assertStringEndsWith($expectation['image_url'], $productImage->getImageUrl()); + $this->assertEquals($productImage->getWidth(), 240); + $this->assertEquals($productImage->getHeight(), 300); + } + + /** + * Updates products images. + * + * @param array $images + * @return void + */ + private function updateProductImages(array $images): void + { + foreach ($images as $sku => $imageName) { + $product = $this->productRepository->get($sku); + $product->setStoreId(Store::DEFAULT_STORE_ID) + ->setImage($imageName) + ->setSmallImage($imageName) + ->setThumbnail($imageName) + ->setData( + 'media_gallery', + [ + 'images' => [ + [ + 'file' => $imageName, + 'position' => 1, + 'label' => 'Image Alt Text', + 'disabled' => 0, + 'media_type' => 'image' + ], + ], + ] + ) + ->setCanSaveCustomOptions(true); + $this->productResource->save($product); + } + } + + /** + * Updates attribute "Update Product Preview Image" flag. + * + * @param string $attributeCode + * @return void + */ + private function updateAttributePreviewImageFlag(string $attributeCode): void + { + $attribute = $this->attributeRepository->get($attributeCode); + $attribute->setData('update_product_preview_image', 1); + $this->attributeRepository->save($attribute); + } + + /** + * Adds attribute param to request. + * + * @param string $attributeCode + * @param string $optionLabel + * @return void + */ + private function addFilterToRequest(string $attributeCode, string $optionLabel): void + { + $attribute = $this->attributeRepository->get($attributeCode); + $this->request->setParams( + [$attributeCode => $attribute->getSource()->getOptionId($optionLabel)] + ); + } +} From 5a0bea09d0e2797f5f878bfe39bcce4dd31e0bc9 Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Wed, 22 Jan 2020 10:47:19 +0200 Subject: [PATCH 0925/1143] MC-30391: Category not considered Configurable product in cart rule --- .../Model/Rule/Condition/Product/Combine.php | 3 +- .../Model/Rule/Condition/ProductTest.php | 32 +++++++-- .../_files/rules_parent_category.php | 66 +++++++++++++++++++ .../_files/rules_parent_category_rollback.php | 21 ++++++ 4 files changed, 117 insertions(+), 5 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/SalesRule/_files/rules_parent_category.php create mode 100644 dev/tests/integration/testsuite/Magento/SalesRule/_files/rules_parent_category_rollback.php diff --git a/app/code/Magento/SalesRule/Model/Rule/Condition/Product/Combine.php b/app/code/Magento/SalesRule/Model/Rule/Condition/Product/Combine.php index 1649dea80ef5b..6ade7a064e849 100644 --- a/app/code/Magento/SalesRule/Model/Rule/Condition/Product/Combine.php +++ b/app/code/Magento/SalesRule/Model/Rule/Condition/Product/Combine.php @@ -145,7 +145,8 @@ private function validateEntity($cond, \Magento\Framework\Model\AbstractModel $e private function retrieveValidateEntities($attributeScope, \Magento\Framework\Model\AbstractModel $entity) { if ($attributeScope === 'parent') { - $validateEntities = [$entity]; + $parentItem = $entity->getParentItem(); + $validateEntities = $parentItem ? [$parentItem] : [$entity]; } elseif ($attributeScope === 'children') { $validateEntities = $entity->getChildren() ?: [$entity]; } else { 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 70fa11fc78c87..abdb38897004d 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 @@ -11,6 +11,9 @@ use Magento\Quote\Api\Data\CartInterface; use Magento\SalesRule\Api\RuleRepositoryInterface; +use Magento\Framework\Registry; +use Magento\SalesRule\Model\Rule; + /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ @@ -50,8 +53,8 @@ public function testValidateCategorySalesRuleIncludesChildren($categoryId, $expe ->load('test_cart_with_configurable', 'reserved_order_id'); // Load the SalesRule looking for products in a specific category - /** @var $rule \Magento\SalesRule\Model\Rule */ - $rule = $this->objectManager->get(\Magento\Framework\Registry::class) + /** @var $rule Rule */ + $rule = $this->objectManager->get(Registry::class) ->registry('_fixture/Magento_SalesRule_Category'); // Prepare the parent product with the given category setting @@ -80,8 +83,8 @@ public function testValidateSalesRuleExcludesBundleChildren(): void ->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) + /** @var $rule Rule */ + $rule = $this->objectManager->get(Registry::class) ->registry('_fixture/Magento_SalesRule_Sku_Exclude'); $this->assertEquals(false, $rule->validate($quote)); @@ -172,4 +175,25 @@ private function getSalesRule(string $name): \Magento\SalesRule\Model\Rule return $converter->toModel($rule); } + + /** + * Ensure that SalesRules filtering on quote items quantity validates configurable product parent category correctly + * + * @magentoDataFixture Magento/ConfigurableProduct/_files/quote_with_configurable_product.php + * @magentoDataFixture Magento/SalesRule/_files/rules_parent_category.php + */ + public function testValidateParentCategoryWithConfigurable() + { + $quote = $this->getQuote('test_cart_with_configurable'); + $registry = $this->objectManager->get(Registry::class); + /** @var Rule $rule */ + $rule = $this->objectManager->create(Rule::class); + $ruleId = $registry->registry('50% Off on Configurable parent category'); + $rule->load($ruleId); + + $this->assertFalse( + $rule->validate($quote->getBillingAddress()), + 'Cart price rule validation failed.' + ); + } } diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/_files/rules_parent_category.php b/dev/tests/integration/testsuite/Magento/SalesRule/_files/rules_parent_category.php new file mode 100644 index 0000000000000..c525fa7152447 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/SalesRule/_files/rules_parent_category.php @@ -0,0 +1,66 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Framework\Registry; +use Magento\TestFramework\Helper\Bootstrap; + +/** @var Registry $registry */ +$registry = Bootstrap::getObjectManager()->get(Registry::class); +/** @var \Magento\SalesRule\Model\Rule $rule */ +$salesRule = Bootstrap::getObjectManager()->create(\Magento\SalesRule\Model\Rule::class); +$salesRule->setData( + [ + 'name' => '50% Off on Configurable parent category', + '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' => 50, + 'discount_step' => 0, + 'stop_rules_processing' => 1, + 'website_ids' => [ + 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\Subselect::class, + 'attribute' => 'qty', + 'operator' => '==', + 'value' => '1', + 'is_value_processed' => null, + 'aggregator' => 'all', + 'conditions' => + [ + [ + 'type' => \Magento\SalesRule\Model\Rule\Condition\Product::class, + 'attribute' => 'category_ids', + 'attribute_scope' => 'parent', + 'operator' => '!=', + 'value' => '2', + 'is_value_processed' => false, + ], + ], + ], + ], +]); + +$salesRule->save(); +$registry->unregister('50% Off on Configurable parent category'); +$registry->register('50% Off on Configurable parent category', $salesRule->getRuleId()); diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/_files/rules_parent_category_rollback.php b/dev/tests/integration/testsuite/Magento/SalesRule/_files/rules_parent_category_rollback.php new file mode 100644 index 0000000000000..edefd5e1650e7 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/SalesRule/_files/rules_parent_category_rollback.php @@ -0,0 +1,21 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\SalesRule\Model\Rule; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\Framework\Registry; + +/** @var Registry $registry */ +$registry = Bootstrap::getObjectManager()->get(Registry::class); +$rule = Bootstrap::getObjectManager()->get(Rule::class); + +/** @var Rule $rule */ +$ruleId = $registry->registry('50% Off on Configurable parent category'); +$rule->load($ruleId); +if ($rule->getId()) { + $rule->delete(); +} From 2312289f29c2dbc84e2ab23c745cfc3c9e30cd42 Mon Sep 17 00:00:00 2001 From: "Rav [RedChamps]" <rav@redchamps.com> Date: Wed, 22 Jan 2020 14:21:56 +0530 Subject: [PATCH 0926/1143] checked if quote object contains id before looking for quote items --- app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Cart.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Cart.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Cart.php index 3709f4914c477..ec4bd93ee4ff0 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Cart.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Cart.php @@ -105,14 +105,13 @@ protected function _prepareCollection() { $quote = $this->getQuote(); - if ($quote) { + if ($quote && $quote->getId()) { $collection = $quote->getItemsCollection(false); + $collection->addFieldToFilter('parent_item_id', ['null' => true]); } else { $collection = $this->_dataCollectionFactory->create(); } - $collection->addFieldToFilter('parent_item_id', ['null' => true]); - $this->setCollection($collection); return parent::_prepareCollection(); From c5991d3c719d68f66c64f5f10978b6412021165c Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Wed, 22 Jan 2020 10:57:13 +0200 Subject: [PATCH 0927/1143] Refactoring test to remove object after test --- .../tests/lib/mage/gallery/gallery.test.js | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/dev/tests/js/jasmine/tests/lib/mage/gallery/gallery.test.js b/dev/tests/js/jasmine/tests/lib/mage/gallery/gallery.test.js index d40681fd944c3..c18728acaf948 100644 --- a/dev/tests/js/jasmine/tests/lib/mage/gallery/gallery.test.js +++ b/dev/tests/js/jasmine/tests/lib/mage/gallery/gallery.test.js @@ -11,7 +11,9 @@ define([ var gallery, options, - element; + element, + jqueryDataMock, + originSpy; beforeEach(function () { options = { @@ -76,25 +78,25 @@ define([ ' _block-content-loading" data-gallery-role="gallery-placeholder">' + '<img alt="main product photo" class="gallery-placeholder__image" src="">' + '</div>'); - - spyOn($.fn, 'data').and.callFake(function () { - return { - setOptions: jasmine.createSpy().and.returnValue(true), - updateOptions: jasmine.createSpy().and.returnValue(true) - }; - }); - expect(); - gallery = new Gallery(options, element); - }); describe('"initGallery" method', function () { it('Verify gallery initialization', function () { + originSpy = $.fn.data; + jqueryDataMock = { + setOptions: jasmine.createSpy().and.returnValue(true), + updateOptions: jasmine.createSpy().and.returnValue(true) + } + spyOn($.fn, 'data').and.callFake(function () { return jqueryDataMock }); + + gallery = new Gallery(options, element); expect(gallery.settings.$elementF.class).toBe(element[1]); expect(gallery.settings.fullscreenConfig).toBeDefined(); expect(gallery.settings.fotoramaApi).toBeDefined(); expect(gallery.settings.data).toBeDefined(); expect(gallery.settings.api).toBeDefined(); + + $.fn.data = originSpy; }); }); }); From 205e97644517b5faeb49b9f3da24e6882f1b0b55 Mon Sep 17 00:00:00 2001 From: Mykhailo Matiola <mykhailo.matiola@transoftgroup.com> Date: Wed, 22 Jan 2020 11:10:25 +0200 Subject: [PATCH 0928/1143] MC-30564: Storefront: View configurable product with images --- .../Product/View/Type/ConfigurableTest.php | 106 ++++++-- ...roduct_with_child_products_with_images.php | 62 +++++ ...th_child_products_with_images_rollback.php | 9 + .../Product/Renderer/ConfigurableTest.php | 252 ++++++++++++++++++ ...e_product_with_visual_swatch_attribute.php | 86 ++++++ ..._with_visual_swatch_attribute_rollback.php | 44 +++ ..._attribute_with_different_options_type.php | 2 +- 7 files changed, 537 insertions(+), 24 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_child_products_with_images.php create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_child_products_with_images_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/Swatches/Block/Product/Renderer/ConfigurableTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_with_visual_swatch_attribute.php create mode 100644 dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_with_visual_swatch_attribute_rollback.php diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/ConfigurableTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/ConfigurableTest.php index 75f5b9928b881..ee1f4d25e88da 100644 --- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/ConfigurableTest.php +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/ConfigurableTest.php @@ -7,10 +7,11 @@ namespace Magento\ConfigurableProduct\Block\Product\View\Type; +use Magento\Catalog\Api\Data\ProductInterface; use Magento\Catalog\Api\ProductRepositoryInterface; -use Magento\Catalog\Model\Product; use Magento\Catalog\Model\ResourceModel\Product as ProductResource; use Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable\Attribute\Collection; +use Magento\Framework\Api\SearchCriteriaBuilder; use Magento\Framework\ObjectManagerInterface; use Magento\Framework\Serialize\SerializerInterface; use Magento\Framework\View\LayoutInterface; @@ -18,49 +19,66 @@ use PHPUnit\Framework\TestCase; /** - * Test class to check configurable product view behaviour + * Test class to check configurable product view behaviour. * * @see \Magento\ConfigurableProduct\Block\Product\View\Type\Configurable * * @magentoAppIsolation enabled + * @magentoDbIsolation enabled * @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php */ class ConfigurableTest extends TestCase { - /** @var ObjectManagerInterface */ + /** + * @var ObjectManagerInterface + */ private $objectManager; - /** @var Configurable */ - private $block; + /** + * @var SerializerInterface + */ + private $serializer; - /** @var Product */ - private $product; + /** + * @var SearchCriteriaBuilder + */ + private $searchBuilder; - /** @var LayoutInterface */ - private $layout; + /** + * @var Configurable + */ + private $block; - /** @var ProductRepositoryInterface */ + /** + * @var ProductRepositoryInterface + */ private $productRepository; - /** @var SerializerInterface */ - private $json; - - /** @var ProductResource */ + /** + * @var ProductResource + */ private $productResource; + /** + * @var ProductInterface + */ + private $product; + /** * @inheritdoc */ protected function setUp() { + parent::setUp(); $this->objectManager = Bootstrap::getObjectManager(); - $this->productRepository = $this->objectManager->create(ProductRepositoryInterface::class); + $this->serializer = $this->objectManager->get(SerializerInterface::class); + $this->searchBuilder = $this->objectManager->get(SearchCriteriaBuilder::class); + $this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class); + $this->productRepository->cleanCache(); + $this->productResource = $this->objectManager->create(ProductResource::class); $this->product = $this->productRepository->get('configurable'); - $this->layout = $this->objectManager->get(LayoutInterface::class); - $this->block = $this->layout->createBlock(Configurable::class); - $this->json = $this->objectManager->get(SerializerInterface::class); + $this->block = $this->objectManager->get(LayoutInterface::class)->createBlock(Configurable::class); $this->block->setProduct($this->product); - $this->productResource = $this->objectManager->create(ProductResource::class); } /** @@ -89,7 +107,7 @@ public function testGetAllowProducts(): void $products = $this->block->getAllowProducts(); $this->assertGreaterThanOrEqual(2, count($products)); foreach ($products as $product) { - $this->assertInstanceOf(Product::class, $product); + $this->assertInstanceOf(ProductInterface::class, $product); } } @@ -98,7 +116,7 @@ public function testGetAllowProducts(): void */ public function testGetJsonConfig(): void { - $config = $this->json->unserialize($this->block->getJsonConfig()); + $config = $this->serializer->unserialize($this->block->getJsonConfig()); $this->assertNotEmpty($config); $this->assertArrayHasKey('productId', $config); $this->assertEquals(1, $config['productId']); @@ -106,6 +124,35 @@ public function testGetJsonConfig(): void $this->assertArrayHasKey('template', $config); $this->assertArrayHasKey('prices', $config); $this->assertArrayHasKey('basePrice', $config['prices']); + $this->assertArrayHasKey('images', $config); + $this->assertCount(0, $config['images']); + } + + /** + * @magentoDataFixture Magento/ConfigurableProduct/_files/configurable_product_with_child_products_with_images.php + * @return void + */ + public function testGetJsonConfigWithChildProductsImages(): void + { + $config = $this->serializer->unserialize($this->block->getJsonConfig()); + $this->assertNotEmpty($config); + $this->assertArrayHasKey('images', $config); + $this->assertCount(2, $config['images']); + $products = $this->getProducts( + $this->product->getExtensionAttributes()->getConfigurableProductLinks() + ); + $i = 0; + foreach ($products as $simpleProduct) { + $i++; + $resultImage = reset($config['images'][$simpleProduct->getId()]); + $this->assertContains($simpleProduct->getImage(), $resultImage['thumb']); + $this->assertContains($simpleProduct->getImage(), $resultImage['img']); + $this->assertContains($simpleProduct->getImage(), $resultImage['full']); + $this->assertTrue($resultImage['isMain']); + $this->assertEquals('image', $resultImage['type']); + $this->assertEquals($i, $resultImage['position']); + $this->assertNull($resultImage['videoUrl']); + } } /** @@ -121,7 +168,7 @@ public function testConfigurableProductView(string $label, array $expectedConfig $this->assertCount(1, $attributes); $attribute = $attributes->getFirstItem(); $this->assertEquals($label, $attribute->getLabel()); - $config = $this->json->unserialize($this->block->getJsonConfig())['attributes'] ?? null; + $config = $this->serializer->unserialize($this->block->getJsonConfig())['attributes'] ?? null; $this->assertNotNull($config); $this->assertConfig(reset($config), $expectedConfig); } @@ -158,7 +205,7 @@ public function expectedDataProvider(): array * @param array $expectedData * @return void */ - private function assertConfig($data, $expectedData): void + private function assertConfig(array $data, array $expectedData): void { $this->assertEquals($expectedData['label'], $data['label']); $skus = array_column($expectedData['options'], 'sku'); @@ -175,4 +222,17 @@ private function assertConfig($data, $expectedData): void } } } + + /** + * Returns products by ids list. + * + * @param array $productIds + * @return ProductInterface[] + */ + private function getProducts(array $productIds): array + { + $criteria = $this->searchBuilder->addFilter('entity_id', $productIds, 'in') + ->create(); + return $this->productRepository->getList($criteria)->getItems(); + } } diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_child_products_with_images.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_child_products_with_images.php new file mode 100644 index 0000000000000..d2418ccaaddec --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_child_products_with_images.php @@ -0,0 +1,62 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product; +use Magento\Store\Model\Store; +use Magento\TestFramework\Helper\Bootstrap; + +require __DIR__ . '/../../../Magento/Catalog/_files/product_image.php'; +require __DIR__ . '/product_configurable.php'; + +$objectManager = Bootstrap::getObjectManager(); +$productRepository = $objectManager->create(ProductRepositoryInterface::class); +$firstSimple = $productRepository->get('simple_10'); +$secondSimple = $productRepository->get('simple_20'); +/** @var $firstSimple Product */ +$firstSimple->setStoreId(Store::DEFAULT_STORE_ID) + ->setImage('/m/a/magento_image.jpg') + ->setSmallImage('/m/a/magento_image.jpg') + ->setThumbnail('/m/a/magento_image.jpg') + ->setData( + 'media_gallery', + [ + 'images' => [ + [ + 'file' => '/m/a/magento_image.jpg', + 'position' => 1, + 'label' => 'Image Alt Text', + 'disabled' => 0, + 'media_type' => 'image' + ], + ] + ] + ) + ->setCanSaveCustomOptions(true) + ->save(); +/** @var $secondSimple Product */ +$secondSimple->setStoreId(Store::DEFAULT_STORE_ID) + ->setImage('/m/a/magento_thumbnail.jpg') + ->setSmallImage('/m/a/magento_thumbnail.jpg') + ->setThumbnail('/m/a/magento_thumbnail.jpg') + ->setSwatchImage('/m/a/magento_thumbnail.jpg') + ->setData( + 'media_gallery', + [ + 'images' => [ + [ + 'file' => '/m/a/magento_thumbnail.jpg', + 'position' => 2, + 'label' => 'Thumbnail Image', + 'disabled' => 0, + 'media_type' => 'image' + ], + ] + ] + ) + ->setCanSaveCustomOptions(true) + ->save(); diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_child_products_with_images_rollback.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_child_products_with_images_rollback.php new file mode 100644 index 0000000000000..11350999ae7aa --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_child_products_with_images_rollback.php @@ -0,0 +1,9 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +require __DIR__ . '/product_configurable_rollback.php'; +require __DIR__ . '/../../../Magento/Catalog/_files/product_image_rollback.php'; diff --git a/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/Renderer/ConfigurableTest.php b/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/Renderer/ConfigurableTest.php new file mode 100644 index 0000000000000..a750abf1e0bb3 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/Renderer/ConfigurableTest.php @@ -0,0 +1,252 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Swatches\Block\Product\Renderer; + +use Magento\Catalog\Api\Data\ProductAttributeInterface; +use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product\Image\UrlBuilder; +use Magento\Catalog\Model\ResourceModel\Product as ProductResource; +use Magento\ConfigurableProduct\Block\Product\View\Type\Configurable; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Serialize\SerializerInterface; +use Magento\Framework\View\LayoutInterface; +use Magento\Store\Model\Store; +use Magento\Swatches\Block\Product\Renderer\Configurable as ConfigurableBlock; +use Magento\Swatches\Helper\Media; +use Magento\Swatches\Model\Swatch; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; + +/** + * Tests for configurable products options block with swatch attribute. + * + * @magentoAppIsolation enabled + * @magentoDbIsolation enabled + * @magentoAppArea frontend + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class ConfigurableTest extends TestCase +{ + /** + * @var ObjectManagerInterface + */ + private $objectManager; + + /** + * @var SerializerInterface + */ + private $serializer; + + /** + * @var Media + */ + private $swatchHelper; + + /** + * @var UrlBuilder + */ + private $imageUrlBuilder; + + /** + * @var Configurable + */ + private $block; + + /** + * @var ProductRepositoryInterface + */ + private $productRepository; + + /** + * @var ProductAttributeRepositoryInterface + */ + private $productAttributeRepository; + + /** + * @var ProductResource + */ + private $productResource; + + /** + * @var ProductAttributeInterface + */ + private $configurableAttribute; + + /** + * @var ProductInterface + */ + private $product; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + $this->objectManager = Bootstrap::getObjectManager(); + $this->serializer = $this->objectManager->get(SerializerInterface::class); + $this->swatchHelper = $this->objectManager->get(Media::class); + $this->imageUrlBuilder = $this->objectManager->get(UrlBuilder::class); + $this->productAttributeRepository = $this->objectManager->get(ProductAttributeRepositoryInterface::class); + $this->configurableAttribute = $this->productAttributeRepository->get('test_configurable'); + $this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class); + $this->productRepository->cleanCache(); + $this->product = $this->productRepository->get('configurable'); + $this->productResource = $this->objectManager->get(ProductResource::class); + $this->block = $this->objectManager->get(LayoutInterface::class)->createBlock(ConfigurableBlock::class); + $this->block->setProduct($this->product); + } + + /** + * @magentoDataFixture Magento/Swatches/_files/configurable_product_with_visual_swatch_attribute.php + * @return void + */ + public function testGetJsonSwatchConfig(): void + { + $expectedOptions = $this->getDefaultOptionsList(); + $expectedOptions['option 2']['value'] = $this->swatchHelper->getSwatchAttributeImage( + Swatch::SWATCH_IMAGE_NAME, + '/visual_swatch_attribute_option_type_image.jpg' + ); + $expectedOptions['option 2']['thumb'] = $this->swatchHelper->getSwatchAttributeImage( + Swatch::SWATCH_THUMBNAIL_NAME, + '/visual_swatch_attribute_option_type_image.jpg' + ); + $config = $this->serializer->unserialize($this->block->getJsonSwatchConfig()); + $this->assertOptionsData($config, $expectedOptions, ['swatch_input_type' => 'visual']); + } + + /** + * @magentoDataFixture Magento/Swatches/_files/configurable_product_with_visual_swatch_attribute.php + * @magentoDataFixture Magento/Catalog/_files/product_image.php + * @return void + */ + public function testGetJsonSwatchConfigUsedProductImage(): void + { + $this->updateAttributeUseProductImageFlag(); + $this->updateProductImage('simple_option_2', '/m/a/magento_image.jpg'); + $expectedOptions = $this->getDefaultOptionsList(); + $expectedOptions['option 2']['value'] = $this->imageUrlBuilder->getUrl( + '/m/a/magento_image.jpg', + 'swatch_image_base' + ); + $expectedOptions['option 2']['thumb'] = $this->imageUrlBuilder->getUrl( + '/m/a/magento_image.jpg', + 'swatch_thumb_base' + ); + $this->assertOptionsData( + $this->serializer->unserialize($this->block->getJsonSwatchConfig()), + $expectedOptions, + ['swatch_input_type' => 'visual', 'use_product_image_for_swatch' => 1] + ); + } + + /** + * @magentoDataFixture Magento/Swatches/_files/configurable_product_with_visual_swatch_attribute.php + * @return void + */ + public function testGetJsonSwatchConfigUsedEmptyProductImage(): void + { + $this->updateAttributeUseProductImageFlag(); + $expectedOptions = $this->getDefaultOptionsList(); + $expectedOptions['option 2']['value'] = $this->swatchHelper->getSwatchAttributeImage( + Swatch::SWATCH_IMAGE_NAME, + '/visual_swatch_attribute_option_type_image.jpg' + ); + $expectedOptions['option 2']['thumb'] = $this->swatchHelper->getSwatchAttributeImage( + Swatch::SWATCH_THUMBNAIL_NAME, + '/visual_swatch_attribute_option_type_image.jpg' + ); + $this->assertOptionsData( + $this->serializer->unserialize($this->block->getJsonSwatchConfig()), + $expectedOptions, + ['swatch_input_type' => 'visual', 'use_product_image_for_swatch' => 1] + ); + } + + /** + * @return array + */ + private function getDefaultOptionsList(): array + { + return [ + 'option 1' => ['type' => '1', 'value' => '#000000', 'label' => 'option 1'], + 'option 2' => ['type' => '2', 'value' => '', 'thumb' => '', 'label' => 'option 2'], + 'option 3' => ['type' => '3', 'value' => null, 'label' => 'option 3'], + ]; + } + + /** + * Asserts swatch options data. + * + * @param array $config + * @param array $expectedOptions + * @param array $expectedAdditional + * @return void + */ + private function assertOptionsData(array $config, array $expectedOptions, array $expectedAdditional): void + { + $this->assertNotEmpty($config); + $resultOptions = $config[$this->configurableAttribute->getAttributeId()]; + foreach ($expectedOptions as $label => $data) { + $resultOption = $resultOptions[$this->configurableAttribute->getSource()->getOptionId($label)]; + $this->assertEquals($data['type'], $resultOption['type']); + $this->assertEquals($data['label'], $resultOption['label']); + $this->assertEquals($data['value'], $resultOption['value']); + if (!empty($data['thumb'])) { + $this->assertEquals($data['thumb'], $resultOption['thumb']); + } + } + $this->assertEquals($expectedAdditional, $this->serializer->unserialize($resultOptions['additional_data'])); + } + + /** + * Updates attribute 'use_product_image_for_swatch' flag. + * + * @return void + */ + private function updateAttributeUseProductImageFlag(): void + { + $this->configurableAttribute->setData('use_product_image_for_swatch', 1); + $this->configurableAttribute = $this->productAttributeRepository->save($this->configurableAttribute); + } + + /** + * Updates Product image. + * + * @param string $sku + * @param string $imageName + * @return void + */ + private function updateProductImage(string $sku, string $imageName): void + { + $product = $this->productRepository->get($sku); + $product->setStoreId(Store::DEFAULT_STORE_ID) + ->setImage($imageName) + ->setSmallImage($imageName) + ->setThumbnail($imageName) + ->setData( + 'media_gallery', + [ + 'images' => [ + [ + 'file' => $imageName, + 'position' => 1, + 'label' => 'Image Alt Text', + 'disabled' => 0, + 'media_type' => 'image' + ], + ] + ] + ) + ->setCanSaveCustomOptions(true); + $this->productResource->save($product); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_with_visual_swatch_attribute.php b/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_with_visual_swatch_attribute.php new file mode 100644 index 0000000000000..0d1eb1ce12f76 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_with_visual_swatch_attribute.php @@ -0,0 +1,86 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\Data\ProductExtensionInterfaceFactory; +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\Model\ProductFactory; +use Magento\ConfigurableProduct\Helper\Product\Options\Factory; +use Magento\ConfigurableProduct\Model\Product\Type\Configurable; +use Magento\Store\Api\WebsiteRepositoryInterface; +use Magento\TestFramework\Helper\Bootstrap; + +require __DIR__ . '/visual_swatch_attribute_with_different_options_type.php'; + +$objectManager = Bootstrap::getObjectManager(); +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->get(ProductRepositoryInterface::class); +/** @var ProductFactory $productFactory */ +$productFactory = $objectManager->get(ProductFactory::class); +/** @var Factory $optionsFactory */ +$optionsFactory = $objectManager->get(Factory::class); +/** @var ProductExtensionInterfaceFactory $productExtensionAttributes */ +$productExtensionAttributesFactory = $objectManager->get(ProductExtensionInterfaceFactory::class); +/** @var WebsiteRepositoryInterface $websiteRepository */ +$websiteRepository = $objectManager->get(WebsiteRepositoryInterface::class); +$defaultWebsiteId = $websiteRepository->get('base')->getId(); +$attributeValues = $associatedProductIds = []; +$options = $attribute->getSource()->getAllOptions(); +array_shift($options); +foreach ($options as $option) { + /** @var Product $product */ + $product = $productFactory->create(); + $product->setTypeId(Type::TYPE_SIMPLE) + ->setAttributeSetId($product->getDefaultAttributeSetId()) + ->setWebsiteIds([$defaultWebsiteId]) + ->setName('Configurable Option' . $option['label']) + ->setSku('simple_' . str_replace(' ', '_', $option['label'])) + ->setPrice(100) + ->setData('test_configurable', $option['value']) + ->setVisibility(Visibility::VISIBILITY_NOT_VISIBLE) + ->setStatus(Status::STATUS_ENABLED) + ->setStockData(['use_config_manage_stock' => 1, 'qty' => 100, 'is_qty_decimal' => 0, 'is_in_stock' => 1]); + $product = $productRepository->save($product); + $attributeValues[] = [ + 'label' => 'test', + 'attribute_id' => $attribute->getId(), + 'value_index' => $option['value'], + ]; + $associatedProductIds[] = $product->getId(); +} + +/** @var Product $configurableProduct */ +$configurableProduct = $productFactory->create(); +$configurableOptions = $optionsFactory->create( + [ + [ + 'attribute_id' => $attribute->getId(), + 'code' => $attribute->getAttributeCode(), + 'label' => $attribute->getStoreLabel(), + 'position' => '0', + 'values' => $attributeValues, + ], + ] +); +$extensionConfigurableAttributes = $configurableProduct->getExtensionAttributes() + ?: $productExtensionAttributesFactory->create(); +$extensionConfigurableAttributes->setConfigurableProductOptions($configurableOptions); +$extensionConfigurableAttributes->setConfigurableProductLinks($associatedProductIds); + +$configurableProduct->setExtensionAttributes($extensionConfigurableAttributes); +$configurableProduct->setTypeId(Configurable::TYPE_CODE) + ->setAttributeSetId($configurableProduct->getDefaultAttributeSetId()) + ->setWebsiteIds([$defaultWebsiteId]) + ->setName('Configurable Product') + ->setSku('configurable') + ->setVisibility(Visibility::VISIBILITY_BOTH) + ->setStatus(Status::STATUS_ENABLED) + ->setStockData(['use_config_manage_stock' => 1, 'is_in_stock' => 1]); +$productRepository->save($configurableProduct); diff --git a/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_with_visual_swatch_attribute_rollback.php b/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_with_visual_swatch_attribute_rollback.php new file mode 100644 index 0000000000000..e2cddfa9065e2 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_with_visual_swatch_attribute_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\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Registry; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var Registry $registry */ +$registry = $objectManager->get(Registry::class); +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->get(ProductRepositoryInterface::class); +/** @var ProductAttributeRepositoryInterface $attributeRepository */ +$attributeRepository = $objectManager->create(ProductAttributeRepositoryInterface::class); +$attribute = $attributeRepository->get('test_configurable'); + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); +$options = $attribute->getSource()->getAllOptions(); +array_shift($options); +foreach ($options as $option) { + try { + $productRepository->deleteById('simple_' . str_replace(' ', '_', $option['label'])); + } catch (NoSuchEntityException $e) { + //Product already removed + } +} + +try { + $productRepository->deleteById('configurable'); +} catch (NoSuchEntityException $e) { + //Product already removed +} + +require __DIR__ . '/visual_swatch_attribute_with_different_options_type_rollback.php'; + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); diff --git a/dev/tests/integration/testsuite/Magento/Swatches/_files/visual_swatch_attribute_with_different_options_type.php b/dev/tests/integration/testsuite/Magento/Swatches/_files/visual_swatch_attribute_with_different_options_type.php index a4a755c4b92db..8d2b427d7f7f3 100644 --- a/dev/tests/integration/testsuite/Magento/Swatches/_files/visual_swatch_attribute_with_different_options_type.php +++ b/dev/tests/integration/testsuite/Magento/Swatches/_files/visual_swatch_attribute_with_different_options_type.php @@ -24,7 +24,7 @@ $imagesGenerator = Bootstrap::getObjectManager()->get(ImagesGenerator::class); /** @var SwatchesMedia $swatchesMedia */ $swatchesMedia = Bootstrap::getObjectManager()->get(SwatchesMedia::class); -$imageName = 'visual_swatch_attribute_option_type_image.jpg'; +$imageName = '/visual_swatch_attribute_option_type_image.jpg'; $imagesGenerator->generate([ 'image-width' => 110, 'image-height' => 90, From 41f07fcc674ef4aee5e5234cc71e6a3ac71aba45 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Wed, 22 Jan 2020 11:11:51 +0200 Subject: [PATCH 0929/1143] static test fix --- .../Search/Model/PopularSearchTerms.php | 2 +- .../Model/ResourceModel/Query/Collection.php | 52 ++++++++++++------- 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/app/code/Magento/Search/Model/PopularSearchTerms.php b/app/code/Magento/Search/Model/PopularSearchTerms.php index 213fac0232535..0a3a7de4e1271 100644 --- a/app/code/Magento/Search/Model/PopularSearchTerms.php +++ b/app/code/Magento/Search/Model/PopularSearchTerms.php @@ -7,7 +7,7 @@ namespace Magento\Search\Model; /** - * Popular search terms + * Finds top search results in search */ class PopularSearchTerms { diff --git a/app/code/Magento/Search/Model/ResourceModel/Query/Collection.php b/app/code/Magento/Search/Model/ResourceModel/Query/Collection.php index c9a983dd8589b..2fc71fc6a6d73 100644 --- a/app/code/Magento/Search/Model/ResourceModel/Query/Collection.php +++ b/app/code/Magento/Search/Model/ResourceModel/Query/Collection.php @@ -5,15 +5,25 @@ */ namespace Magento\Search\Model\ResourceModel\Query; +use Magento\Framework\Data\Collection\Db\FetchStrategyInterface; +use Magento\Framework\Data\Collection\EntityFactoryInterface; +use Magento\Framework\DB\Adapter\AdapterInterface; +use Magento\Framework\DB\Helper; +use Magento\Framework\Event\ManagerInterface; +use Magento\Framework\Model\ResourceModel\Db\AbstractDb; +use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection; use Magento\Store\Model\Store; +use Magento\Store\Model\StoreManagerInterface; +use Psr\Log\LoggerInterface; /** * Search query collection * * @api * @since 100.0.2 + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection +class Collection extends AbstractCollection { /** * Store for filter @@ -25,36 +35,38 @@ class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\Ab /** * Store manager * - * @var \Magento\Store\Model\StoreManagerInterface + * @var StoreManagerInterface */ protected $_storeManager; /** * Search resource helper * - * @var \Magento\Framework\DB\Helper + * @var Helper */ protected $_resourceHelper; /** - * @param \Magento\Framework\Data\Collection\EntityFactory $entityFactory - * @param \Psr\Log\LoggerInterface $logger - * @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy - * @param \Magento\Framework\Event\ManagerInterface $eventManager - * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Framework\DB\Helper $resourceHelper - * @param \Magento\Framework\DB\Adapter\AdapterInterface $connection - * @param \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource + * Constructor + * + * @param EntityFactoryInterface $entityFactory + * @param LoggerInterface $logger + * @param FetchStrategyInterface $fetchStrategy + * @param ManagerInterface $eventManager + * @param StoreManagerInterface $storeManager + * @param Helper $resourceHelper + * @param AdapterInterface $connection + * @param AbstractDb $resource */ public function __construct( - \Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory, - \Psr\Log\LoggerInterface $logger, - \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, - \Magento\Framework\Event\ManagerInterface $eventManager, - \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Framework\DB\Helper $resourceHelper, - \Magento\Framework\DB\Adapter\AdapterInterface $connection = null, - \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null + EntityFactoryInterface $entityFactory, + LoggerInterface $logger, + FetchStrategyInterface $fetchStrategy, + ManagerInterface $eventManager, + StoreManagerInterface $storeManager, + Helper $resourceHelper, + AdapterInterface $connection = null, + AbstractDb $resource = null ) { $this->_storeManager = $storeManager; $this->_resourceHelper = $resourceHelper; @@ -178,7 +190,7 @@ public function isTopSearchResult(string $term, int $storeId, int $maxCountCache return $this->getSize() > 0; } - + /** * Set Recent Queries Order * From 030172abae997b093b74eb76179da676b5762af0 Mon Sep 17 00:00:00 2001 From: Viktor Sevch <svitja@ukr.net> Date: Wed, 22 Jan 2020 11:53:53 +0200 Subject: [PATCH 0930/1143] MC-24168: Fix Skipped MFTF Tests From MC-17140: MAGETWO-95175, MAGETWO-97001, MAGETWO-98189 --- .../Tax/Test/Mftf/Test/AdminCheckCreditMemoTotalsTest.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminCheckCreditMemoTotalsTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminCheckCreditMemoTotalsTest.xml index 39e6e316dd486..dfed39e861f05 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/AdminCheckCreditMemoTotalsTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminCheckCreditMemoTotalsTest.xml @@ -15,7 +15,7 @@ <title value="Checking Credit memo Totals"/> <description value="Checking Credit memo Totals"/> <severity value="MAJOR"/> - <testCaseId value="MC-6159"/> + <testCaseId value="MC-25752"/> <group value="tax"/> <group value="sales"/> </annotations> @@ -23,7 +23,6 @@ <!-- Create productTaxClass --> <createData entity="productTaxClass" stepKey="createProductTaxClass"/> <!--Set configs--> - <magentoCLI command="config:set {{DisableGenerateCategoryProductUrlRewritesConfigData.path}} {{DisableGenerateCategoryProductUrlRewritesConfigData.value}}" stepKey="disableGenerateUrlRewrite"/> <magentoCLI command="config:set {{DefaultProductTaxClass.path}} $createProductTaxClass.return$" stepKey="setDefaultProductTaxClass"/> <!--Create category and product--> <createData entity="_defaultCategory" stepKey="createCategory"/> @@ -42,7 +41,6 @@ </before> <after> <!--Set configs--> - <magentoCLI command="config:set {{EnableGenerateCategoryProductUrlRewritesConfigData.path}} {{EnableGenerateCategoryProductUrlRewritesConfigData.value}}" stepKey="enableGenerateUrlRewrite"/> <magentoCLI command="config:set {{DefaultProductTaxClass.path}} {{DefaultProductTaxClass.value}}" stepKey="setDefaultProductTaxClass"/> <!--Delete category and product--> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> From acdc9b429bfab2a9aa496f571d9ccc37d0b6492d Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Wed, 22 Jan 2020 11:54:55 +0200 Subject: [PATCH 0931/1143] fix static tests --- .../jasmine/tests/lib/mage/gallery/gallery.test.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/dev/tests/js/jasmine/tests/lib/mage/gallery/gallery.test.js b/dev/tests/js/jasmine/tests/lib/mage/gallery/gallery.test.js index c18728acaf948..7700c3d64a1b7 100644 --- a/dev/tests/js/jasmine/tests/lib/mage/gallery/gallery.test.js +++ b/dev/tests/js/jasmine/tests/lib/mage/gallery/gallery.test.js @@ -3,6 +3,7 @@ * See COPYING.txt for license details. */ +/* eslint-disable max-nested-callbacks */ define([ 'mage/gallery/gallery', 'jquery' @@ -83,12 +84,14 @@ define([ describe('"initGallery" method', function () { it('Verify gallery initialization', function () { originSpy = $.fn.data; - jqueryDataMock = { + jqueryDataMock = { setOptions: jasmine.createSpy().and.returnValue(true), updateOptions: jasmine.createSpy().and.returnValue(true) - } - spyOn($.fn, 'data').and.callFake(function () { return jqueryDataMock }); - + }; + spyOn($.fn, 'data').and.callFake(function () { + return jqueryDataMock; + }); + gallery = new Gallery(options, element); expect(gallery.settings.$elementF.class).toBe(element[1]); expect(gallery.settings.fullscreenConfig).toBeDefined(); @@ -96,7 +99,7 @@ define([ expect(gallery.settings.data).toBeDefined(); expect(gallery.settings.api).toBeDefined(); - $.fn.data = originSpy; + $.fn.data = originSpy; }); }); }); From 0263b4cad75f368c010b5077df6bc9c22dc1ce5b Mon Sep 17 00:00:00 2001 From: Andrew Chorniy <a.chorniy@atwix.com> Date: Wed, 22 Jan 2020 12:27:08 +0200 Subject: [PATCH 0932/1143] Fixed type issue. Create unit test for customer data model --- .../Magento/Customer/Model/Data/Customer.php | 4 +- .../Test/Unit/Model/Data/CustomerTest.php | 74 +++++++++++++++++++ 2 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 app/code/Magento/Customer/Test/Unit/Model/Data/CustomerTest.php diff --git a/app/code/Magento/Customer/Model/Data/Customer.php b/app/code/Magento/Customer/Model/Data/Customer.php index 7a135904f6663..27a82d7f8d8f3 100644 --- a/app/code/Magento/Customer/Model/Data/Customer.php +++ b/app/code/Magento/Customer/Model/Data/Customer.php @@ -94,7 +94,7 @@ public function getCreatedAt() */ public function getCreatedIn() { - return $this->_get(self::CREATED_IN); + return (string)$this->_get(self::CREATED_IN); } /** @@ -150,7 +150,7 @@ public function getGender() /** * Get group id * - * @return string|null + * @return int|null */ public function getGroupId() { diff --git a/app/code/Magento/Customer/Test/Unit/Model/Data/CustomerTest.php b/app/code/Magento/Customer/Test/Unit/Model/Data/CustomerTest.php new file mode 100644 index 0000000000000..945f213d015bd --- /dev/null +++ b/app/code/Magento/Customer/Test/Unit/Model/Data/CustomerTest.php @@ -0,0 +1,74 @@ +<?php + +namespace Magento\Customer\Test\Unit\Model\Data; + +use Magento\Customer\Model\Data\Customer; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use PHPUnit\Framework\TestCase; + +/** + * Unit test for customer data model + */ +class CustomerTest extends TestCase +{ + /** @var Customer */ + protected $model; + + /** @var ObjectManager */ + protected $objectManager; + + protected function setUp() + { + $this->objectManager = new ObjectManager($this); + + $this->model = $this->objectManager->getObject(Customer::class); + } + + /** + * Test getGroupId() + * + * @return void + */ + public function testGetGroupId() + { + $testGroupId = 3; + $this->model->setGroupId($testGroupId); + $this->assertEquals($testGroupId, $this->model->getGroupId()); + } + + /** + * Test getCreatedIn() + * + * @param array|string $options + * @param array $expectedResult + * + * @dataProvider getCreatedInDataProvider + * + * @return void + */ + public function testGetCreatedIn($options, $expectedResult) + { + for ($i = 0; $i < count($options); $i++) { + $this->model->setCreatedIn($options[$i]); + for ($j = $i; $j < count($expectedResult); $j++) { + $this->assertEquals($expectedResult[$j], $this->model->getCreatedIn()); + break; + } + } + } + + /** + * Data provider for testGetCreatedIn + * + * @return array + */ + public function getCreatedInDataProvider() + { + return [ + 'array' => [ + 'options' => ['Default', 'Admin', 'US'], + 'expectedResult' => ['Default', 'Admin', 'US'] + ] + ]; + } +} From c42ebc1c298c6262bbdf35e0a8682b693b8186d9 Mon Sep 17 00:00:00 2001 From: Vaha <vaha@atwix.com> Date: Wed, 22 Jan 2020 13:47:35 +0200 Subject: [PATCH 0933/1143] #8691: improved cases for DictionaryTest --- .../Framework/App/Language/DictionaryTest.php | 50 ++++++++++++++++++- .../_files/bar/{en_us => en_az}/a.csv | 0 .../_files/bar/{en_us => en_az}/b.csv | 0 .../_files/bar/{en_us => en_az}/language.xml | 4 +- .../bar/{en_us => en_az}/registration.php | 2 +- .../Language/_files/bar/en_gb/language.xml | 2 +- .../App/Language/_files/baz/en_gb/1.csv | 6 ++- .../App/Language/_files/devdoc/en_ak/1.csv | 3 ++ .../Language/_files/devdoc/en_ak/language.xml | 15 ++++++ .../_files/devdoc/en_ak/registration.php | 9 ++++ .../_files/first/{en_us => en_az}/1.csv | 0 .../first/{en_us => en_az}/language.xml | 4 +- .../first/{en_us => en_az}/registration.php | 2 +- .../parent-package-one/en_au_package/1.csv | 5 ++ .../en_au_package/language.xml | 14 ++++++ .../en_au_package/registration.php | 9 ++++ .../parent-package-one/en_ie_package/1.csv | 6 +++ .../en_ie_package/language.xml | 13 +++++ .../en_ie_package/registration.php | 9 ++++ .../language_package_one/1.csv | 4 ++ .../language_package_one/language.xml | 14 ++++++ .../language_package_one/registration.php | 9 ++++ .../parent-package-two/en_ca_package/1.csv | 8 +++ .../en_ca_package/language.xml | 14 ++++++ .../en_ca_package/registration.php | 9 ++++ .../parent-package-two/en_us_package/1.csv | 9 ++++ .../en_us_package/language.xml | 13 +++++ .../en_us_package/registration.php | 9 ++++ .../language_package_two/1.csv | 7 +++ .../language_package_two/language.xml | 14 ++++++ .../language_package_two/registration.php | 9 ++++ .../Language/_files/second/en_gb/language.xml | 2 +- .../Framework/App/Language/Dictionary.php | 4 ++ 33 files changed, 267 insertions(+), 11 deletions(-) rename dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/{en_us => en_az}/a.csv (100%) rename dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/{en_us => en_az}/b.csv (100%) rename dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/{en_us => en_az}/language.xml (86%) rename dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/{en_us => en_az}/registration.php (92%) create mode 100644 dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/devdoc/en_ak/1.csv create mode 100644 dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/devdoc/en_ak/language.xml create mode 100644 dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/devdoc/en_ak/registration.php rename dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/first/{en_us => en_az}/1.csv (100%) rename dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/first/{en_us => en_az}/language.xml (88%) rename dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/first/{en_us => en_az}/registration.php (91%) create mode 100644 dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/en_au_package/1.csv create mode 100644 dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/en_au_package/language.xml create mode 100644 dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/en_au_package/registration.php create mode 100644 dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/en_ie_package/1.csv create mode 100644 dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/en_ie_package/language.xml create mode 100644 dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/en_ie_package/registration.php create mode 100644 dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/language_package_one/1.csv create mode 100644 dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/language_package_one/language.xml create mode 100644 dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/language_package_one/registration.php create mode 100644 dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/en_ca_package/1.csv create mode 100644 dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/en_ca_package/language.xml create mode 100644 dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/en_ca_package/registration.php create mode 100644 dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/en_us_package/1.csv create mode 100644 dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/en_us_package/language.xml create mode 100644 dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/en_us_package/registration.php create mode 100644 dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/language_package_two/1.csv create mode 100644 dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/language_package_two/language.xml create mode 100644 dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/language_package_two/registration.php diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/DictionaryTest.php b/dev/tests/integration/testsuite/Magento/Framework/App/Language/DictionaryTest.php index 363f84627350f..bc299053bd4fe 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Language/DictionaryTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/DictionaryTest.php @@ -63,7 +63,9 @@ public function dictionaryDataProvider() // Second case with inheritance of package with the same language code 'a case with inheritance similar language code' => $this->getDataInheritanceWitSimilarCode(), // Third case with circular inheritance, when two packages depend on each other - 'a case with circular inheritance' => $this->getDataCircularInheritance() + 'a case with circular inheritance' => $this->getDataCircularInheritance(), + // Fourth case with multiple inheritance from dev docs + 'a case with multiple inheritance from dev docs' => $this->getDataMultipleInheritanceFromDevDocs() ]; } @@ -113,7 +115,7 @@ private function getDataCircularInheritance() { return [ // Dictionary that will be requested - 'language_code' => 'en_US', + 'language_code' => 'en_AZ', // Expected merged dictionary data 'expectation' => [ 'one' => '1.0', @@ -123,4 +125,48 @@ private function getDataCircularInheritance() ] ]; } + + /** + * If a language package inherits from two packages: + * ... + * <code>en_AK</code> + * ... + * <use vendor="parent-package-one" package="language_package_one"/> + * <use vendor= "parent-package-two" package="language_package_two"/> + * ... + * + * In the preceding example: + * language_package_one inherits from en_au_package and en_au_package inherits from en_ie_package + * language_package_two inherits from en_ca_package and en_ca_package inherits from en_us_package + * + * If the Magento application cannot find word or phrase in the en_AK package, + * it looks in other packages in following sequence: + * parent-package-one/language_package_one + * <vendorname>/en_au_package + * <vendorname>/en_ie_package + * parent-package-two/language_package_two + * <vendorname>/en_ca_package + * <vendorname>/en_us_package + * + * @return array + */ + private function getDataMultipleInheritanceFromDevDocs() + { + return [ + // Dictionary that will be requested + 'language_code' => 'en_AK', + // Expected merged dictionary data + 'expectation' => [ + 'one' => 'en_us_package_one', + 'two' => 'en_ca_package_two', + 'three' => 'language_package_two_three', + 'four' => 'en_ie_package_four', + 'five' => 'en_au_package_five', + 'six' => 'language_package_one_six', + 'seven' => 'en_ak_seven', + 'eight' => 'en_ak_eight', + 'nine' => 'en_ak_nine', + ] + ]; + } } diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_us/a.csv b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_az/a.csv similarity index 100% rename from dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_us/a.csv rename to dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_az/a.csv diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_us/b.csv b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_az/b.csv similarity index 100% rename from dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_us/b.csv rename to dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_az/b.csv diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_us/language.xml b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_az/language.xml similarity index 86% rename from dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_us/language.xml rename to dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_az/language.xml index a4c5630d5fcd9..3cc5d8965c2e8 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_us/language.xml +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_az/language.xml @@ -6,8 +6,8 @@ */ --> <language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/Language/package.xsd"> - <code>en_US</code> + <code>en_AZ</code> <vendor>bar</vendor> - <package>en_us</package> + <package>en_az</package> <sort_order>0</sort_order> </language> diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_us/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_az/registration.php similarity index 92% rename from dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_us/registration.php rename to dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_az/registration.php index 7f792bf5941ca..41e17fbcf515d 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_us/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_az/registration.php @@ -6,4 +6,4 @@ use Magento\Framework\Component\ComponentRegistrar; -ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'bar_en_us', __DIR__); +ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'bar_en_az', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_gb/language.xml b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_gb/language.xml index faf531fbf5cc2..736e9dbe738d7 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_gb/language.xml +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_gb/language.xml @@ -10,5 +10,5 @@ <vendor>bar</vendor> <package>en_gb</package> <sort_order>100</sort_order> - <use package="en_us" vendor="bar"/> + <use package="en_az" vendor="bar"/> </language> diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/baz/en_gb/1.csv b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/baz/en_gb/1.csv index ea501f9d96944..61ef9dd8a49b3 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/baz/en_gb/1.csv +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/baz/en_gb/1.csv @@ -1 +1,5 @@ -four and 5/10,4.5 \ No newline at end of file +one,1.00 +two,2.00 +three,3.00 +four,4.00 +four and 5/10,4.5 diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/devdoc/en_ak/1.csv b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/devdoc/en_ak/1.csv new file mode 100644 index 0000000000000..8ed274ad7d886 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/devdoc/en_ak/1.csv @@ -0,0 +1,3 @@ +seven,en_ak_seven +eight,en_ak_eight +nine,en_ak_nine diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/devdoc/en_ak/language.xml b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/devdoc/en_ak/language.xml new file mode 100644 index 0000000000000..d0db854f329d0 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/devdoc/en_ak/language.xml @@ -0,0 +1,15 @@ +<?xml version="1.0"?> +<!-- +/** +* Copyright © Magento, Inc. All rights reserved. +* See COPYING.txt for license details. +*/ +--> +<language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/Language/package.xsd"> + <code>en_AK</code> + <vendor>devdoc</vendor> + <package>en_ak</package> + <sort_order>0</sort_order> + <use vendor="parent-package-one" package="language_package_one"/> + <use vendor="parent-package-two" package="language_package_two"/> +</language> diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/devdoc/en_ak/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/devdoc/en_ak/registration.php new file mode 100644 index 0000000000000..13b498edcd0aa --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/devdoc/en_ak/registration.php @@ -0,0 +1,9 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +use Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'devdoc_en_ak', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/first/en_us/1.csv b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/first/en_az/1.csv similarity index 100% rename from dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/first/en_us/1.csv rename to dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/first/en_az/1.csv diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/first/en_us/language.xml b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/first/en_az/language.xml similarity index 88% rename from dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/first/en_us/language.xml rename to dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/first/en_az/language.xml index 6c67871476b5f..2b8354a70dc28 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/first/en_us/language.xml +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/first/en_az/language.xml @@ -6,9 +6,9 @@ */ --> <language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/Language/package.xsd"> - <code>en_US</code> + <code>en_AZ</code> <vendor>first</vendor> - <package>en_us</package> + <package>en_az</package> <sort_order>0</sort_order> <use package="en_gb" vendor="second"/> </language> diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/first/en_us/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/first/en_az/registration.php similarity index 91% rename from dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/first/en_us/registration.php rename to dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/first/en_az/registration.php index 48dfbf20c9f26..85e88eb4546ce 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/first/en_us/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/first/en_az/registration.php @@ -6,4 +6,4 @@ use Magento\Framework\Component\ComponentRegistrar; -ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'first_en_us', __DIR__); +ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'first_en_az', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/en_au_package/1.csv b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/en_au_package/1.csv new file mode 100644 index 0000000000000..f1d7dc7c106c7 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/en_au_package/1.csv @@ -0,0 +1,5 @@ +five,en_au_package_five +six,en_au_package_six +seven,en_au_package_seven +eight,en_au_package_eight +nine,en_au_package_nine diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/en_au_package/language.xml b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/en_au_package/language.xml new file mode 100644 index 0000000000000..64d558d9c1d63 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/en_au_package/language.xml @@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<!-- +/** +* Copyright © Magento, Inc. All rights reserved. +* See COPYING.txt for license details. +*/ +--> +<language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/Language/package.xsd"> + <code>en_US</code> + <vendor>parent-package-one</vendor> + <package>en_au_package</package> + <sort_order>0</sort_order> + <use vendor="parent-package-one" package="en_ie_package"/> +</language> diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/en_au_package/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/en_au_package/registration.php new file mode 100644 index 0000000000000..664a6d34a814b --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/en_au_package/registration.php @@ -0,0 +1,9 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +use Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'parent-package-one_en_au_package', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/en_ie_package/1.csv b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/en_ie_package/1.csv new file mode 100644 index 0000000000000..8c580556c2e26 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/en_ie_package/1.csv @@ -0,0 +1,6 @@ +four,en_ie_package_four +five,en_ie_package_five +six,en_ie_package_six +seven,en_ie_package_seven +eight,en_ie_package_eight +nine,en_ie_package_nine diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/en_ie_package/language.xml b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/en_ie_package/language.xml new file mode 100644 index 0000000000000..3b681d012b192 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/en_ie_package/language.xml @@ -0,0 +1,13 @@ +<?xml version="1.0"?> +<!-- +/** +* Copyright © Magento, Inc. All rights reserved. +* See COPYING.txt for license details. +*/ +--> +<language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/Language/package.xsd"> + <code>en_US</code> + <vendor>parent-package-one</vendor> + <package>en_ie_package</package> + <sort_order>0</sort_order> +</language> diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/en_ie_package/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/en_ie_package/registration.php new file mode 100644 index 0000000000000..81ae45c3d5a40 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/en_ie_package/registration.php @@ -0,0 +1,9 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +use Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'parent-package-one_en_ie_package', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/language_package_one/1.csv b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/language_package_one/1.csv new file mode 100644 index 0000000000000..54bb6bee04f17 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/language_package_one/1.csv @@ -0,0 +1,4 @@ +six,language_package_one_six +seven,language_package_one_seven +eight,language_package_one_eight +nine,language_package_one_nine diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/language_package_one/language.xml b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/language_package_one/language.xml new file mode 100644 index 0000000000000..4d19c728222ba --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/language_package_one/language.xml @@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<!-- +/** +* Copyright © Magento, Inc. All rights reserved. +* See COPYING.txt for license details. +*/ +--> +<language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/Language/package.xsd"> + <code>en_US</code> + <vendor>parent-package-one</vendor> + <package>language_package_one</package> + <sort_order>0</sort_order> + <use vendor="parent-package-one" package="en_au_package"/> +</language> diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/language_package_one/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/language_package_one/registration.php new file mode 100644 index 0000000000000..0432f835f0849 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-one/language_package_one/registration.php @@ -0,0 +1,9 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +use Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'parent-package-one_language_package_one', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/en_ca_package/1.csv b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/en_ca_package/1.csv new file mode 100644 index 0000000000000..b3c5408b439b4 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/en_ca_package/1.csv @@ -0,0 +1,8 @@ +two,en_ca_package_two +three,en_ca_package_three +four,en_ca_package_four +five,en_ca_package_five +six,en_ca_package_six +seven,en_ca_package_seven +eight,en_ca_package_eight +nine,en_ca_package_nine diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/en_ca_package/language.xml b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/en_ca_package/language.xml new file mode 100644 index 0000000000000..68914dc8df672 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/en_ca_package/language.xml @@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<!-- +/** +* Copyright © Magento, Inc. All rights reserved. +* See COPYING.txt for license details. +*/ +--> +<language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/Language/package.xsd"> + <code>en_US</code> + <vendor>parent-package-two</vendor> + <package>en_ca_package</package> + <sort_order>0</sort_order> + <use vendor="parent-package-two" package="en_us_package"/> +</language> diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/en_ca_package/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/en_ca_package/registration.php new file mode 100644 index 0000000000000..b87032884f7db --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/en_ca_package/registration.php @@ -0,0 +1,9 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +use Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'parent-package-two_en_ca_package', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/en_us_package/1.csv b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/en_us_package/1.csv new file mode 100644 index 0000000000000..ef932c4326fb3 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/en_us_package/1.csv @@ -0,0 +1,9 @@ +one,en_us_package_one +two,en_us_package_two +three,en_us_package_three +four,en_us_package_four +five,en_us_package_five +six,en_us_package_six +seven,en_us_package_seven +eight,en_us_package_eight +nine,en_us_package_nine diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/en_us_package/language.xml b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/en_us_package/language.xml new file mode 100644 index 0000000000000..fa7ecda34c975 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/en_us_package/language.xml @@ -0,0 +1,13 @@ +<?xml version="1.0"?> +<!-- +/** +* Copyright © Magento, Inc. All rights reserved. +* See COPYING.txt for license details. +*/ +--> +<language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/Language/package.xsd"> + <code>en_US</code> + <vendor>parent-package-two</vendor> + <package>en_us_package</package> + <sort_order>0</sort_order> +</language> diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/en_us_package/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/en_us_package/registration.php new file mode 100644 index 0000000000000..48ed54033a96e --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/en_us_package/registration.php @@ -0,0 +1,9 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +use Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'parent-package-two_en_us_package', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/language_package_two/1.csv b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/language_package_two/1.csv new file mode 100644 index 0000000000000..ef85e7dd72575 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/language_package_two/1.csv @@ -0,0 +1,7 @@ +three,language_package_two_three +four,language_package_two_four +five,language_package_two_five +six,language_package_two_six +seven,language_package_two_seven +eight,language_package_two_eight +nine,language_package_two_nine diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/language_package_two/language.xml b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/language_package_two/language.xml new file mode 100644 index 0000000000000..5e72723312c68 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/language_package_two/language.xml @@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<!-- +/** +* Copyright © Magento, Inc. All rights reserved. +* See COPYING.txt for license details. +*/ +--> +<language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/Language/package.xsd"> + <code>en_US</code> + <vendor>parent-package-two</vendor> + <package>language_package_two</package> + <sort_order>0</sort_order> + <use vendor="parent-package-two" package="en_ca_package"/> +</language> diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/language_package_two/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/language_package_two/registration.php new file mode 100644 index 0000000000000..f7eb7d2373a29 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/parent-package-two/language_package_two/registration.php @@ -0,0 +1,9 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +use Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'parent-package-two_language_package_two', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/second/en_gb/language.xml b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/second/en_gb/language.xml index 860e21ad009ab..12f36154efffe 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/second/en_gb/language.xml +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/second/en_gb/language.xml @@ -10,5 +10,5 @@ <vendor>second</vendor> <package>en_gb</package> <sort_order>0</sort_order> - <use package="en_us" vendor="first"/> + <use package="en_az" vendor="first"/> </language> diff --git a/lib/internal/Magento/Framework/App/Language/Dictionary.php b/lib/internal/Magento/Framework/App/Language/Dictionary.php index 9aaafc23c9e49..b4a6fdc1b5ce3 100644 --- a/lib/internal/Magento/Framework/App/Language/Dictionary.php +++ b/lib/internal/Magento/Framework/App/Language/Dictionary.php @@ -195,6 +195,10 @@ private function collectInheritedPacks($languageConfig, &$result, $level = 0, ar */ private function addInheritedPacks($packs, $pack, &$sortedPacks) { + if (isset($sortedPacks[$pack['key']])) { + return; + } + $sortedPacks[$pack['key']] = $pack; foreach ($pack['language']->getUses() as $reuse) { $packKey = implode('|', [$reuse['vendor'], $reuse['package']]); From 7bfc9902c6b01e337fcbdae402d8525271a63b65 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky <firster@atwix.com> Date: Tue, 21 Jan 2020 16:36:03 +0200 Subject: [PATCH 0934/1143] magento/magento2#: Remove a redundant call to DB for guest session --- app/code/Magento/Customer/Model/Session.php | 12 +- .../Customer/Test/Unit/Model/SessionTest.php | 132 ++++++++++++++---- 2 files changed, 116 insertions(+), 28 deletions(-) diff --git a/app/code/Magento/Customer/Model/Session.php b/app/code/Magento/Customer/Model/Session.php index e9dc7700ec090..7fb02a14bc09b 100644 --- a/app/code/Magento/Customer/Model/Session.php +++ b/app/code/Magento/Customer/Model/Session.php @@ -19,6 +19,7 @@ * @method string getNoReferer() * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) + * @SuppressWarnings(PHPMD.TooManyFields) * @since 100.0.2 */ class Session extends \Magento\Framework\Session\SessionManager @@ -98,6 +99,11 @@ class Session extends \Magento\Framework\Session\SessionManager */ protected $_httpContext; + /** + * @var AccountConfirmation + */ + protected $accountConfirmation; + /** * @var GroupManagementInterface */ @@ -304,7 +310,11 @@ public function setCustomer(Customer $customerModel) public function getCustomer() { if ($this->_customerModel === null) { - $this->_customerModel = $this->_customerFactory->create()->load($this->getCustomerId()); + $this->_customerModel = $this->_customerFactory->create(); + + if ($this->getCustomerId()) { + $this->_customerResource->load($this->_customerModel, $this->getCustomerId()); + } } return $this->_customerModel; diff --git a/app/code/Magento/Customer/Test/Unit/Model/SessionTest.php b/app/code/Magento/Customer/Test/Unit/Model/SessionTest.php index 8565790990df1..00f376c4b81bc 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/SessionTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/SessionTest.php @@ -7,48 +7,67 @@ */ namespace Magento\Customer\Test\Unit\Model; +use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Customer\Api\Data\CustomerInterface; +use Magento\Customer\Model\Customer; +use Magento\Customer\Model\CustomerFactory; +use Magento\Customer\Model\ResourceModel\Customer as ResourceCustomer; +use Magento\Customer\Model\Session; +use Magento\Customer\Model\Session\Storage; +use Magento\Framework\App\Http\Context; +use Magento\Framework\App\Response\Http; +use Magento\Framework\Event\ManagerInterface; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\Framework\UrlFactory; +use PHPUnit\Framework\MockObject\MockObject; + /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class SessionTest extends \PHPUnit\Framework\TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var ResourceCustomer|MockObject + */ + protected $_customerResourceMock; + + /** + * @var Storage|MockObject */ protected $_storageMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var ManagerInterface|MockObject */ protected $_eventManagerMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var Context|MockObject */ protected $_httpContextMock; /** - * @var \Magento\Framework\UrlFactory|\PHPUnit_Framework_MockObject_MockObject + * @var UrlFactory|MockObject */ protected $urlFactoryMock; /** - * @var \Magento\Customer\Model\CustomerFactory|\PHPUnit_Framework_MockObject_MockObject + * @var CustomerFactory|MockObject */ protected $customerFactoryMock; /** - * @var \Magento\Customer\Api\CustomerRepositoryInterface|\PHPUnit_Framework_MockObject_MockObject + * @var CustomerRepositoryInterface|MockObject */ protected $customerRepositoryMock; /** - * @var \Magento\Framework\App\Response\Http|\PHPUnit_Framework_MockObject_MockObject + * @var Http|MockObject */ protected $responseMock; /** - * @var \Magento\Customer\Model\Session + * @var Session */ protected $_model; @@ -58,21 +77,25 @@ class SessionTest extends \PHPUnit\Framework\TestCase protected function setUp() { $this->_storageMock = $this->createPartialMock( - \Magento\Customer\Model\Session\Storage::class, + Storage::class, ['getIsCustomerEmulated', 'getData', 'unsIsCustomerEmulated', '__sleep', '__wakeup'] ); - $this->_eventManagerMock = $this->createMock(\Magento\Framework\Event\ManagerInterface::class); - $this->_httpContextMock = $this->createMock(\Magento\Framework\App\Http\Context::class); - $this->urlFactoryMock = $this->createMock(\Magento\Framework\UrlFactory::class); - $this->customerFactoryMock = $this->getMockBuilder(\Magento\Customer\Model\CustomerFactory::class) + $this->_eventManagerMock = $this->createMock(ManagerInterface::class); + $this->_httpContextMock = $this->createMock(Context::class); + $this->urlFactoryMock = $this->createMock(UrlFactory::class); + $this->customerFactoryMock = $this->getMockBuilder(CustomerFactory::class) ->disableOriginalConstructor() - ->setMethods(['create', 'save']) + ->setMethods(['create']) ->getMock(); - $this->customerRepositoryMock = $this->createMock(\Magento\Customer\Api\CustomerRepositoryInterface::class); - $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $this->responseMock = $this->createMock(\Magento\Framework\App\Response\Http::class); + $this->_customerResourceMock = $this->getMockBuilder(ResourceCustomer::class) + ->disableOriginalConstructor() + ->setMethods(['load']) + ->getMock(); + $this->customerRepositoryMock = $this->createMock(CustomerRepositoryInterface::class); + $helper = new ObjectManagerHelper($this); + $this->responseMock = $this->createMock(Http::class); $this->_model = $helper->getObject( - \Magento\Customer\Model\Session::class, + Session::class, [ 'customerFactory' => $this->customerFactoryMock, 'storage' => $this->_storageMock, @@ -81,6 +104,7 @@ protected function setUp() 'urlFactory' => $this->urlFactoryMock, 'customerRepository' => $this->customerRepositoryMock, 'response' => $this->responseMock, + '_customerResource' => $this->_customerResourceMock, ] ); } @@ -90,8 +114,8 @@ protected function setUp() */ public function testSetCustomerAsLoggedIn() { - $customer = $this->createMock(\Magento\Customer\Model\Customer::class); - $customerDto = $this->createMock(\Magento\Customer\Api\Data\CustomerInterface::class); + $customer = $this->createMock(Customer::class); + $customerDto = $this->createMock(CustomerInterface::class); $customer->expects($this->any()) ->method('getDataModel') ->will($this->returnValue($customerDto)); @@ -113,8 +137,8 @@ public function testSetCustomerAsLoggedIn() */ public function testSetCustomerDataAsLoggedIn() { - $customer = $this->createMock(\Magento\Customer\Model\Customer::class); - $customerDto = $this->createMock(\Magento\Customer\Api\Data\CustomerInterface::class); + $customer = $this->createMock(Customer::class); + $customerDto = $this->createMock(CustomerInterface::class); $this->customerFactoryMock->expects($this->once()) ->method('create') @@ -185,19 +209,22 @@ public function testLoginById() */ protected function prepareLoginDataMock($customerId) { - $customerDataMock = $this->createMock(\Magento\Customer\Api\Data\CustomerInterface::class); + $customerDataMock = $this->createMock(CustomerInterface::class); $customerDataMock->expects($this->once()) ->method('getId') ->will($this->returnValue($customerId)); $customerMock = $this->createPartialMock( - \Magento\Customer\Model\Customer::class, - ['getId', 'getConfirmation', 'updateData', 'getGroupId'] + Customer::class, + ['getId', 'isConfirmationRequired', 'getConfirmation', 'updateData', 'getGroupId'] ); - $customerMock->expects($this->exactly(3)) + $customerMock->expects($this->once()) ->method('getId') ->will($this->returnValue($customerId)); $customerMock->expects($this->once()) + ->method('isConfirmationRequired') + ->will($this->returnValue(true)); + $customerMock->expects($this->never()) ->method('getConfirmation') ->will($this->returnValue($customerId)); @@ -259,8 +286,59 @@ public function getIsLoggedInDataProvider() */ public function testSetCustomerRemovesFlagThatShowsIfCustomerIsEmulated() { - $customerMock = $this->createMock(\Magento\Customer\Model\Customer::class); + $customerMock = $this->createMock(Customer::class); $this->_storageMock->expects($this->once())->method('unsIsCustomerEmulated'); $this->_model->setCustomer($customerMock); } + /** + * Test "getCustomer()" for guest user + * + * @return void + */ + public function testGetCustomerForGuestUser() + { + $customerMock = $this->getMockBuilder(Customer::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->customerFactoryMock + ->expects($this->once()) + ->method('create') + ->will($this->returnValue($customerMock)); + + $this->assertSame($customerMock, $this->_model->getCustomer()); + } + + /** + * Test "getCustomer()" for registered user + * + * @return void + */ + public function testGetCustomerForRegisteredUser() + { + $customerId = 1; + + $customerMock = $this->getMockBuilder(Customer::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->customerFactoryMock + ->expects($this->once()) + ->method('create') + ->will($this->returnValue($customerMock)); + + $this->_storageMock + ->expects($this->exactly(4)) + ->method('getData') + ->with('customer_id') + ->willReturn($customerId); + + $this->_customerResourceMock + ->expects($this->once()) + ->method('load') + ->with($customerMock, $customerId) + ->will($this->returnValue($customerMock)); + + $this->assertSame($customerMock, $this->_model->getCustomer()); + } } From 57cf6eacf0b9808279721d1c48be92bd7719f872 Mon Sep 17 00:00:00 2001 From: Andrew Chorniy <a.chorniy@atwix.com> Date: Wed, 22 Jan 2020 15:04:17 +0200 Subject: [PATCH 0935/1143] Delete wrongly added type for variable --- app/code/Magento/Customer/Model/Data/Customer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/Model/Data/Customer.php b/app/code/Magento/Customer/Model/Data/Customer.php index 27a82d7f8d8f3..5c1fee5ee5633 100644 --- a/app/code/Magento/Customer/Model/Data/Customer.php +++ b/app/code/Magento/Customer/Model/Data/Customer.php @@ -94,7 +94,7 @@ public function getCreatedAt() */ public function getCreatedIn() { - return (string)$this->_get(self::CREATED_IN); + return $this->_get(self::CREATED_IN); } /** From c885c9fbf99c672a06222a33a9b123108ae2ccf9 Mon Sep 17 00:00:00 2001 From: Timon de Groot <timon@mooore.nl> Date: Wed, 22 Jan 2020 14:55:16 +0100 Subject: [PATCH 0936/1143] Fix confusing phpdoc in curl client --- lib/internal/Magento/Framework/HTTP/Client/Curl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/HTTP/Client/Curl.php b/lib/internal/Magento/Framework/HTTP/Client/Curl.php index 8b90897481259..47ee5198326dd 100644 --- a/lib/internal/Magento/Framework/HTTP/Client/Curl.php +++ b/lib/internal/Magento/Framework/HTTP/Client/Curl.php @@ -107,9 +107,9 @@ class Curl implements \Magento\Framework\HTTP\ClientInterface protected $_headerCount = 0; /** - * Set request timeout, msec + * Set request timeout * - * @param int $value + * @param int $value value in seconds * @return void */ public function setTimeout($value) From 39ecd070fa0519c7b93962c023703a95829a6630 Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Wed, 22 Jan 2020 16:10:17 +0200 Subject: [PATCH 0937/1143] Fixing the disabled currency inputs --- .../CurrencySymbol/view/adminhtml/templates/grid.phtml | 3 ++- .../CurrencySymbol/view/adminhtml/web/js/symbols-form.js | 6 ++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml b/app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml index 397c2598dc3b0..74268f6e4c4de 100644 --- a/app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml +++ b/app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml @@ -22,7 +22,8 @@ class="required-entry admin__control-text <?= $data['inherited'] ? 'disabled' : '' ?>" type="text" value="<?= $block->escapeHtmlAttr($data['displaySymbol']) ?>" - name="custom_currency_symbol[<?= $block->escapeHtmlAttr($code) ?>]"> + name="custom_currency_symbol[<?= $block->escapeHtmlAttr($code) ?>]" + <?= $data['inherited'] ? 'disabled' : '' ?>> <div class="admin__field admin__field-option"> <input id="custom_currency_symbol_inherit<?= $block->escapeHtmlAttr($code) ?>" class="admin__control-checkbox" type="checkbox" diff --git a/app/code/Magento/CurrencySymbol/view/adminhtml/web/js/symbols-form.js b/app/code/Magento/CurrencySymbol/view/adminhtml/web/js/symbols-form.js index 68f914ddb1b4d..a2cbfa883554a 100644 --- a/app/code/Magento/CurrencySymbol/view/adminhtml/web/js/symbols-form.js +++ b/app/code/Magento/CurrencySymbol/view/adminhtml/web/js/symbols-form.js @@ -25,12 +25,10 @@ define([ input = $('#custom_currency_symbol' + code); if (checkbox.is(':checked')) { - input.addClass('disabled'); input.val(value); - input.prop('readonly', true); + input.prop('disabled', true); } else { - input.removeClass('disabled'); - input.prop('readonly', false); + input.prop('disabled', false); } } From a071b25012c4132442501b1b58d40dbe3de5dd83 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky <firster@atwix.com> Date: Wed, 22 Jan 2020 16:13:53 +0200 Subject: [PATCH 0938/1143] magento/magento2#: Remove a redundant call to DB for guest session --- .../Customer/Test/Unit/Model/SessionTest.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Customer/Test/Unit/Model/SessionTest.php b/app/code/Magento/Customer/Test/Unit/Model/SessionTest.php index 00f376c4b81bc..03232938cde47 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/SessionTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/SessionTest.php @@ -18,13 +18,15 @@ use Magento\Framework\App\Response\Http; use Magento\Framework\Event\ManagerInterface; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\Framework\Url; use Magento\Framework\UrlFactory; use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class SessionTest extends \PHPUnit\Framework\TestCase +class SessionTest extends TestCase { /** * @var ResourceCustomer|MockObject @@ -85,11 +87,11 @@ protected function setUp() $this->urlFactoryMock = $this->createMock(UrlFactory::class); $this->customerFactoryMock = $this->getMockBuilder(CustomerFactory::class) ->disableOriginalConstructor() - ->setMethods(['create']) + ->setMethods(['create', 'save']) ->getMock(); $this->_customerResourceMock = $this->getMockBuilder(ResourceCustomer::class) ->disableOriginalConstructor() - ->setMethods(['load']) + ->setMethods(['load', 'save']) ->getMock(); $this->customerRepositoryMock = $this->createMock(CustomerRepositoryInterface::class); $helper = new ObjectManagerHelper($this); @@ -164,7 +166,7 @@ public function testSetCustomerDataAsLoggedIn() */ public function testAuthenticate() { - $urlMock = $this->createMock(\Magento\Framework\Url::class); + $urlMock = $this->createMock(Url::class); $urlMock->expects($this->exactly(2)) ->method('getUrl') ->willReturn(''); @@ -216,15 +218,12 @@ protected function prepareLoginDataMock($customerId) $customerMock = $this->createPartialMock( Customer::class, - ['getId', 'isConfirmationRequired', 'getConfirmation', 'updateData', 'getGroupId'] + ['getId', 'getConfirmation', 'updateData', 'getGroupId'] ); - $customerMock->expects($this->once()) + $customerMock->expects($this->exactly(3)) ->method('getId') ->will($this->returnValue($customerId)); $customerMock->expects($this->once()) - ->method('isConfirmationRequired') - ->will($this->returnValue(true)); - $customerMock->expects($this->never()) ->method('getConfirmation') ->will($this->returnValue($customerId)); @@ -290,6 +289,7 @@ public function testSetCustomerRemovesFlagThatShowsIfCustomerIsEmulated() $this->_storageMock->expects($this->once())->method('unsIsCustomerEmulated'); $this->_model->setCustomer($customerMock); } + /** * Test "getCustomer()" for guest user * From 8a96c5884a3cf62d26a49be4ff94b10423aeb0f9 Mon Sep 17 00:00:00 2001 From: Fred Orosko Dias <oroskodias@users.noreply.github.com> Date: Wed, 22 Jan 2020 16:29:58 +0200 Subject: [PATCH 0939/1143] Extend exception message in Redirect Class --- .../Store/Controller/Store/Redirect.php | 2 +- .../Unit/Controller/Store/RedirectTest.php | 280 ++++++++++++++++++ .../HttpRequestValidator/StoreValidator.php | 2 +- .../Test/Unit/StoreValidatorTest.php | 146 +++++++++ 4 files changed, 428 insertions(+), 2 deletions(-) create mode 100644 app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php create mode 100644 app/code/Magento/StoreGraphQl/Test/Unit/StoreValidatorTest.php diff --git a/app/code/Magento/Store/Controller/Store/Redirect.php b/app/code/Magento/Store/Controller/Store/Redirect.php index 5d61275e72a28..2cc8ba1905442 100644 --- a/app/code/Magento/Store/Controller/Store/Redirect.php +++ b/app/code/Magento/Store/Controller/Store/Redirect.php @@ -98,7 +98,7 @@ public function execute() /** @var Store $fromStore */ $fromStore = $this->storeRepository->get($fromStoreCode); } catch (NoSuchEntityException $e) { - $error = __('Requested store is not found'); + $error = __("Requested store is not found ({$fromStoreCode})"); } if ($error !== null) { diff --git a/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php b/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php new file mode 100644 index 0000000000000..7d60fcac24ec9 --- /dev/null +++ b/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php @@ -0,0 +1,280 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Store\Test\Unit\Controller\Store; + +use Magento\Framework\App\ActionInterface; +use Magento\Framework\App\RequestInterface; +use Magento\Framework\App\Response\RedirectInterface; +use Magento\Framework\App\ResponseInterface; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Message\ManagerInterface; +use Magento\Framework\Session\SidResolverInterface; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\Store\Api\StoreRepositoryInterface; +use Magento\Store\Api\StoreResolverInterface; +use Magento\Store\Controller\Store\Redirect; +use Magento\Store\Model\Store; +use Magento\Store\Model\StoreResolver; +use Magento\Store\Model\StoreSwitcher\HashGenerator; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +/** + * Test class for redirect controller + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class RedirectTest extends TestCase +{ + private const DEFAULT_STORE_VIEW_CODE = 'default'; + private const STORE_CODE = 'sv1'; + + /** + * @var StoreRepositoryInterface|MockObject + */ + private $storeRepositoryMock; + + /** + * @var RequestInterface|MockObject + */ + private $requestMock; + + /** + * @var StoreResolverInterface|MockObject + */ + private $storeResolverMock; + + /** + * @var RedirectInterface|MockObject + */ + private $redirectMock; + + /** + * @var ResponseInterface|MockObject + */ + private $responseMock; + + /** + * @var ManagerInterface|MockObject + */ + private $messageManagerMock; + + /** + * @var Store|MockObject + */ + private $formStoreMock; + + /** + * @var Store|MockObject + */ + private $currentStoreMock; + + /** + * @var SidResolverInterface|MockObject + */ + private $sidResolverMock; + + /** + * @var HashGenerator|MockObject + */ + private $hashGeneratorMock; + + /** + * @var Redirect + */ + private $redirectController; + + /** + * @inheritDoc + */ + protected function setUp() + { + $this->requestMock = $this->createMock(RequestInterface::class); + $this->redirectMock = $this->createMock(RedirectInterface::class); + $this->storeResolverMock = $this->createMock(StoreResolverInterface::class); + $this->storeRepositoryMock = $this->createMock(StoreRepositoryInterface::class); + $this->messageManagerMock = $this->createMock(ManagerInterface::class); + $this->responseMock = $this->createMock(ResponseInterface::class); + $this->formStoreMock = $this->createMock(Store::class); + $this->sidResolverMock = $this->createMock(SidResolverInterface::class); + $this->hashGeneratorMock = $this->createMock(HashGenerator::class); + + $this->currentStoreMock = $this->getMockBuilder(Store::class) + ->disableOriginalConstructor() + ->setMethods(['getBaseUrl']) + ->getMock(); + $this->storeRepositoryMock + ->expects($this->once()) + ->method('getById') + ->willReturn($this->currentStoreMock); + $this->storeResolverMock + ->expects($this->once()) + ->method('getCurrentStoreId') + ->willReturnSelf(); + + $objectManager = new ObjectManagerHelper($this); + + $this->redirectController = $objectManager->getObject( + Redirect::class, + [ + 'storeRepository' => $this->storeRepositoryMock, + 'storeResolver' => $this->storeResolverMock, + 'messageManager' => $this->messageManagerMock, + '_request' => $this->requestMock, + '_redirect' => $this->redirectMock, + '_response' => $this->responseMock, + 'sidResolver' => $this->sidResolverMock, + 'hashGenerator' => $this->hashGeneratorMock + ] + ); + } + + /** + * Verify redirect controller + * + * @param string $defaultStoreViewCode + * @param string $storeCode + * + * @dataProvider getConfigDataProvider + * @return void + * @throws NoSuchEntityException + */ + public function testRedirect(string $defaultStoreViewCode, string $storeCode): void + { + $this->requestMock + ->expects($this->at(0)) + ->method('getParam') + ->with(StoreResolver::PARAM_NAME) + ->willReturn($storeCode); + $this->requestMock + ->expects($this->at(1)) + ->method('getParam') + ->with('___from_store') + ->willReturn($defaultStoreViewCode); + $this->requestMock + ->expects($this->at(2)) + ->method('getParam') + ->with(ActionInterface::PARAM_NAME_URL_ENCODED) + ->willReturn($defaultStoreViewCode); + $this->storeRepositoryMock + ->expects($this->once()) + ->method('get') + ->with($defaultStoreViewCode) + ->willReturn($this->formStoreMock); + $this->formStoreMock + ->expects($this->once()) + ->method('getCode') + ->willReturnSelf(); + $this->sidResolverMock + ->expects($this->once()) + ->method('getUseSessionInUrl') + ->willReturn(false); + $this->hashGeneratorMock + ->expects($this->once()) + ->method('generateHash') + ->with($this->formStoreMock) + ->willReturn([]); + + $this->redirectMock + ->expects($this->once()) + ->method('redirect') + ->with( + $this->responseMock, + 'stores/store/switch', + ['_nosid' => true, + '_query' => [ + 'uenc' => $defaultStoreViewCode, + '___from_store' => $this->formStoreMock, + '___store' => $storeCode + ] + ] + ) + ->willReturnSelf(); + + $this->assertEquals(null, $this->redirectController->execute()); + } + + /** + * Verify execute with exception + * + * @param string $defaultStoreViewCode + * @param string $storeCode + * @return void + * @dataProvider getConfigDataProvider + * @throws NoSuchEntityException + */ + public function testRedirectWithThrowsException(string $defaultStoreViewCode, string $storeCode): void + { + $this->requestMock + ->expects($this->at(0)) + ->method('getParam') + ->with(StoreResolver::PARAM_NAME) + ->willReturn($storeCode); + $this->requestMock + ->expects($this->at(1)) + ->method('getParam') + ->with('___from_store') + ->willReturn($defaultStoreViewCode); + $this->storeRepositoryMock + ->expects($this->once()) + ->method('get') + ->with($defaultStoreViewCode) + ->willThrowException(new NoSuchEntityException()); + $this->messageManagerMock + ->expects($this->once()) + ->method('addErrorMessage') + ->willReturnSelf(); + $this->currentStoreMock + ->expects($this->once()) + ->method('getBaseUrl') + ->willReturnSelf(); + $this->redirectMock + ->expects($this->once()) + ->method('redirect') + ->with($this->responseMock, $this->currentStoreMock) + ->willReturnSelf(); + + $this->assertEquals(null, $this->redirectController->execute()); + } + + /** + * Verify redirect target is null + * + * @return void + * @throws NoSuchEntityException + */ + public function testRedirectTargetIsNull(): void + { + $this->requestMock + ->expects($this->at(0)) + ->method('getParam') + ->with(StoreResolver::PARAM_NAME) + ->willReturn(null); + $this->requestMock + ->expects($this->at(1)) + ->method('getParam') + ->with('___from_store') + ->willReturnSelf(); + $this->storeRepositoryMock + ->expects($this->never()) + ->method('get'); + + $this->assertEquals($this->responseMock, $this->redirectController->execute()); + } + + /** + * @inheritDoc + * + * @return array + */ + public function getConfigDataProvider(): array + { + return [ + [ self::DEFAULT_STORE_VIEW_CODE, self::STORE_CODE ] + ]; + } +} diff --git a/app/code/Magento/StoreGraphQl/Controller/HttpRequestValidator/StoreValidator.php b/app/code/Magento/StoreGraphQl/Controller/HttpRequestValidator/StoreValidator.php index 5d0a4edd44b73..8011960915726 100644 --- a/app/code/Magento/StoreGraphQl/Controller/HttpRequestValidator/StoreValidator.php +++ b/app/code/Magento/StoreGraphQl/Controller/HttpRequestValidator/StoreValidator.php @@ -45,7 +45,7 @@ public function validate(HttpRequestInterface $request): void $storeCode = trim($headerValue); if (!$this->isStoreActive($storeCode)) { $this->storeManager->setCurrentStore(null); - throw new GraphQlInputException(__('Requested store is not found')); + throw new GraphQlInputException(__('Requested store is not found ({$storeCode})')); } } } diff --git a/app/code/Magento/StoreGraphQl/Test/Unit/StoreValidatorTest.php b/app/code/Magento/StoreGraphQl/Test/Unit/StoreValidatorTest.php new file mode 100644 index 0000000000000..aa160bd3eb8e7 --- /dev/null +++ b/app/code/Magento/StoreGraphQl/Test/Unit/StoreValidatorTest.php @@ -0,0 +1,146 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\StoreGraphQl\Test\Unit; + +use Magento\Framework\App\HttpRequestInterface; +use Magento\Framework\GraphQl\Exception\GraphQlInputException; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\Store\Model\StoreManagerInterface; +use Magento\StoreGraphQl\Controller\HttpRequestValidator\StoreValidator; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +/** + * Test for StoreValidator class + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class StoreValidatorTest extends TestCase +{ + private const DEFAULT_STORE_VIEW_CODE = 'default'; + private const STORE_CODE = 'sv1'; + + /** + * @var StoreManagerInterface|MockObject + */ + private $storeManagerMock; + + /** + * @var HttpRequestInterface|MockObject + */ + private $requestMock; + + /** + * @var StoreValidator + */ + private $storeValidator; + + /** + * @inheritDoc + */ + public function setUp() + { + $this->storeManagerMock = $this->createMock(StoreManagerInterface::class); + $this->requestMock = $this->getMockBuilder(HttpRequestInterface::class) + ->disableOriginalConstructor() + ->setMethods( + [ + 'isPost', + 'isGet', + 'isPatch', + 'isDelete', + 'isPut', + 'isAjax', + 'getHeader' + ] + ) + ->getMock(); + + $objectManager = new ObjectManagerHelper($this); + + $this->storeValidator = $objectManager->getObject( + StoreValidator::class, + [ + 'storeManager' => $this->storeManagerMock + ] + ); + } + + /** + * Verify validate + * + * @param array $config + * + * @dataProvider getConfigDataProvider + * @throws GraphQlInputException + */ + public function testValidate(array $config): void + { + $this->requestMock + ->expects($this->once()) + ->method('getHeader') + ->with('Store') + ->willReturn($config['store']); + $this->storeManagerMock + ->expects($this->once()) + ->method('getStores') + ->with(false, true) + ->willReturn($config['store']); + $this->storeManagerMock + ->expects($this->once()) + ->method('setCurrentStore') + ->with(null) + ->willReturnSelf(); + $this->expectExceptionMessage('Requested store is not found ({$storeCode})'); + $this->storeValidator->validate($this->requestMock); + } + + /** + * Verify validate with active store + * + * @param array $config + * + * @throws GraphQlInputException + * @dataProvider getConfigDataProvider + */ + public function testValidateWithStoreActive(array $config): void + { + $this->requestMock + ->expects($this->once()) + ->method('getHeader') + ->with('Store') + ->willReturn($config['default']); + $this->storeManagerMock + ->expects($this->once()) + ->method('getStores') + ->with(false, true) + ->willReturn($config['default']); + $this->storeManagerMock + ->expects($this->never()) + ->method('setCurrentStore') + ->with(null) + ->willReturnSelf(); + $this->storeValidator->validate($this->requestMock); + } + + /** + * @inheritDoc + * + * @return array + */ + public function getConfigDataProvider(): array + { + return [ + [ + [ + 'default' => self::DEFAULT_STORE_VIEW_CODE, + 'store' => self::STORE_CODE + ] + ] + ]; + } +} From 1e827779044ecf3d91e53e680bf473047533a774 Mon Sep 17 00:00:00 2001 From: engcom-Echo <engcom-vendorworker-echo@adobe.com> Date: Wed, 22 Jan 2020 16:37:27 +0200 Subject: [PATCH 0940/1143] Refactor by review comment --- .../Magento/Store/Test/Unit/Controller/Store/RedirectTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php b/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php index 7d60fcac24ec9..1136194fc322a 100644 --- a/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php +++ b/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php @@ -227,6 +227,7 @@ public function testRedirectWithThrowsException(string $defaultStoreViewCode, st $this->messageManagerMock ->expects($this->once()) ->method('addErrorMessage') + ->with("Requested store is not found ({$defaultStoreViewCode})") ->willReturnSelf(); $this->currentStoreMock ->expects($this->once()) From b1f2d8cca4b805f16bea8f88bf5775bb605131cf Mon Sep 17 00:00:00 2001 From: "ivan.pletnyov" <ivan.pletnyov@transoftgroup.com> Date: Wed, 22 Jan 2020 16:45:46 +0200 Subject: [PATCH 0941/1143] MC-24879: Admin: Create category with enabled Catalog Category Flat Index --- .../DeleteCategoryWithEnabledFlatTest.php | 115 ++++++++ .../Save/AbstractSaveCategoryTest.php | 62 ++++ .../Save/SaveCategoryWithEnabledFlatTest.php | 268 ++++++++++++++++++ .../Category/Save/UrlRewriteTest.php | 30 +- .../_files/reindex_catalog_category_flat.php | 16 ++ 5 files changed, 470 insertions(+), 21 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Category/Delete/DeleteCategoryWithEnabledFlatTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Category/Save/AbstractSaveCategoryTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Category/Save/SaveCategoryWithEnabledFlatTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/reindex_catalog_category_flat.php diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Category/Delete/DeleteCategoryWithEnabledFlatTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Category/Delete/DeleteCategoryWithEnabledFlatTest.php new file mode 100644 index 0000000000000..357b7247412d9 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Category/Delete/DeleteCategoryWithEnabledFlatTest.php @@ -0,0 +1,115 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Controller\Adminhtml\Category\Delete; + +use Magento\Catalog\Api\CategoryRepositoryInterface; +use Magento\Catalog\Model\Indexer\Category\Flat\State; +use Magento\Catalog\Model\ResourceModel\Category\Flat as CategoryFlatResource; +use Magento\Catalog\Model\ResourceModel\Category\Flat\CollectionFactory; +use Magento\Framework\App\Request\Http as HttpRequest; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Indexer\IndexerRegistry; +use Magento\TestFramework\TestCase\AbstractBackendController; + +/** + * Test cases related to delete category with enabled category flat. + * + * @magentoAppArea adminhtml + * @magentoDbIsolation disabled + */ +class DeleteCategoryWithEnabledFlatTest extends AbstractBackendController +{ + /** + * @var IndexerRegistry + */ + private $indexerRegistry; + + /** + * @var CategoryRepositoryInterface + */ + private $categoryRepository; + + /** + * @var CategoryFlatResource + */ + private $categoryFlatResource; + + /** + * @var CollectionFactory + */ + private $categoryFlatCollectionFactory; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + $this->indexerRegistry = $this->_objectManager->get(IndexerRegistry::class); + $this->categoryRepository = $this->_objectManager->get(CategoryRepositoryInterface::class); + $this->categoryFlatResource = $this->_objectManager->get(CategoryFlatResource::class); + $this->categoryFlatCollectionFactory = $this->_objectManager->get(CollectionFactory::class); + } + + /** + * @inheritdoc + */ + protected function tearDown() + { + parent::tearDown(); + $categoryFlatIndexer = $this->indexerRegistry->get(State::INDEXER_ID); + $categoryFlatIndexer->invalidate(); + $this->categoryFlatResource->getConnection()->dropTable($this->categoryFlatResource->getMainTable()); + } + + /** + * Check that product is deleted from flat table. + * + * @magentoConfigFixture current_store catalog/frontend/flat_catalog_category true + * + * @magentoDataFixture Magento/Catalog/_files/category.php + * @magentoDataFixture Magento/Catalog/_files/reindex_catalog_category_flat.php + * + * @return void + */ + public function testDeleteCategory(): void + { + $this->assertEquals(1, $this->getFlatCategoryCollectionSizeByCategoryId(333)); + $this->getRequest()->setMethod(HttpRequest::METHOD_POST); + $this->getRequest()->setPostValue(['id' => 333]); + $this->dispatch('backend/catalog/category/delete'); + $this->assertSessionMessages($this->equalTo([(string)__('You deleted the category.')])); + $this->assertEquals(0, $this->getFlatCategoryCollectionSizeByCategoryId(333)); + $this->checkCategoryIsDeleted(333); + } + + /** + * Return collection size from category flat collection by category ID. + * + * @param int $categoryId + * @return int + */ + private function getFlatCategoryCollectionSizeByCategoryId(int $categoryId): int + { + $categoryFlatCollection = $this->categoryFlatCollectionFactory->create(); + $categoryFlatCollection->addIdFilter($categoryId); + + return $categoryFlatCollection->getSize(); + } + + /** + * Assert that category is deleted. + * + * @param int $categoryId + */ + private function checkCategoryIsDeleted(int $categoryId): void + { + $this->expectExceptionObject(new NoSuchEntityException(__("No such entity with id = {$categoryId}"))); + $this->categoryRepository->get($categoryId); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Category/Save/AbstractSaveCategoryTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Category/Save/AbstractSaveCategoryTest.php new file mode 100644 index 0000000000000..e472220896af9 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Category/Save/AbstractSaveCategoryTest.php @@ -0,0 +1,62 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Controller\Adminhtml\Category\Save; + +use Magento\Framework\App\Request\Http as HttpRequest; +use Magento\Framework\Serialize\SerializerInterface; +use Magento\TestFramework\TestCase\AbstractBackendController; + +/** + * Abstract save category. + */ +class AbstractSaveCategoryTest extends AbstractBackendController +{ + /** + * @var SerializerInterface + */ + private $serializer; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + $this->serializer = $this->_objectManager->get(SerializerInterface::class); + } + + /** + * Perform save category request with category POST data. + * + * @param array $data + * @return array + */ + protected function performSaveCategoryRequest(array $data): array + { + $data['return_session_messages_only'] = true; + $this->getRequest()->setMethod(HttpRequest::METHOD_POST); + $this->getRequest()->setPostValue($data); + $this->dispatch('backend/catalog/category/save'); + + return $this->serializer->unserialize($this->getResponse()->getBody()); + } + + /** + * Assert that session has message about successfully category save. + * + * @param array $responseData + * @return void + */ + protected function assertRequestIsSuccessfullyPerformed(array $responseData): void + { + $this->assertTrue(isset($responseData['category']['entity_id'])); + $this->assertFalse($responseData['error'], 'Response message: ' . $responseData['messages']); + $message = str_replace('.', '\.', (string)__('You saved the category.')); + $this->assertRegExp("/>{$message}</", $responseData['messages']); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Category/Save/SaveCategoryWithEnabledFlatTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Category/Save/SaveCategoryWithEnabledFlatTest.php new file mode 100644 index 0000000000000..376e9865b4fb8 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Category/Save/SaveCategoryWithEnabledFlatTest.php @@ -0,0 +1,268 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Controller\Adminhtml\Category\Save; + +use Magento\Catalog\Api\CategoryRepositoryInterface; +use Magento\Catalog\Model\Category; +use Magento\Catalog\Model\Indexer\Category\Flat; +use Magento\Catalog\Model\Indexer\Category\Flat\State; +use Magento\Catalog\Model\ResourceModel\Category\Flat as CategoryFlatResource; +use Magento\Catalog\Model\ResourceModel\Category\Flat\CollectionFactory; +use Magento\CatalogUrlRewrite\Model\Map\DataCategoryUrlRewriteDatabaseMap; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Indexer\IndexerRegistry; +use Magento\UrlRewrite\Model\ResourceModel\UrlRewrite as UrlRewriteResource; +use Magento\UrlRewrite\Service\V1\Data\UrlRewrite; + +/** + * Test cases related to save category with enabled category flat. + * + * @magentoAppArea adminhtml + * @magentoDbIsolation disabled + */ +class SaveCategoryWithEnabledFlatTest extends AbstractSaveCategoryTest +{ + /** + * @var IndexerRegistry + */ + private $indexerRegistry; + + /** + * @var UrlRewriteResource + */ + private $urlRewriteResource; + + /** + * @var CategoryRepositoryInterface + */ + private $categoryRepository; + + /** + * @var Flat + */ + private $categoryFlatIndexer; + + /** + * @var CategoryFlatResource + */ + private $categoryFlatResource; + + /** + * @var CollectionFactory + */ + private $categoryFlatCollectionFactory; + + /** + * @var string + */ + private $createdCategoryId; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + $this->indexerRegistry = $this->_objectManager->get(IndexerRegistry::class); + $this->urlRewriteResource = $this->_objectManager->get(UrlRewriteResource::class); + $this->categoryRepository = $this->_objectManager->get(CategoryRepositoryInterface::class); + $this->categoryFlatIndexer = $this->_objectManager->get(Flat::class); + $this->categoryFlatResource = $this->_objectManager->get(CategoryFlatResource::class); + $this->categoryFlatCollectionFactory = $this->_objectManager->get(CollectionFactory::class); + } + + /** + * @inheritdoc + */ + protected function tearDown() + { + parent::tearDown(); + $categoryFlatIndexer = $this->indexerRegistry->get(State::INDEXER_ID); + $categoryFlatIndexer->invalidate(); + $this->categoryFlatResource->getConnection()->dropTable($this->categoryFlatResource->getMainTable()); + $this->deleteAllCategoryUrlRewrites(); + try { + $this->categoryRepository->deleteByIdentifier($this->createdCategoryId); + } catch (NoSuchEntityException $e) { + //Category already deleted. + } + $this->createdCategoryId = null; + } + + /** + * Assert that category flat table is created and flat table contain category with created child category. + * + * @magentoDataFixture Magento/Catalog/_files/category.php + * + * @magentoConfigFixture current_store catalog/frontend/flat_catalog_category true + * + * @return void + */ + public function testAddChildCategory(): void + { + $parentCategory = $this->categoryRepository->get(333); + $postData = [ + 'name' => 'Custom category name', + 'parent' => 333, + 'is_active' => 1, + 'include_in_menu' => 1, + 'display_mode' => 'PRODUCTS', + 'is_anchor' => true, + 'use_config' => [ + 'available_sort_by' => 1, + 'default_sort_by' => 1, + 'filter_price_range' => 1, + ], + ]; + $responseData = $this->performSaveCategoryRequest($postData); + $this->assertRequestIsSuccessfullyPerformed($responseData); + $this->createdCategoryId = $responseData['category']['entity_id']; + $this->categoryFlatIndexer->executeFull(); + $this->assertTrue( + $this->categoryFlatResource->getConnection()->isTableExists($this->categoryFlatResource->getMainTable()) + ); + $this->assertEquals(1, $parentCategory->getChildrenCategories()->getSize()); + $categoryFlatCollection = $this->categoryFlatCollectionFactory->create(); + $categoryFlatCollection->addIdFilter([333, $this->createdCategoryId]); + $this->assertCount(2, $categoryFlatCollection->getItems()); + /** @var Category $createdCategory */ + $createdCategory = $categoryFlatCollection->getItemByColumnValue('entity_id', $this->createdCategoryId); + $this->assertEquals($parentCategory->getPath() . '/' . $this->createdCategoryId, $createdCategory->getPath()); + $this->assertEquals($parentCategory->getEntityId(), $createdCategory->getParentId()); + $this->assertEquals($parentCategory->getLevel() + 1, $createdCategory->getLevel()); + } + + /** + * Assert that category flat table is created and flat table contains category with expected data. + * + * @dataProvider enableCategoryDataProvider + * + * @magentoConfigFixture current_store catalog/frontend/flat_catalog_category true + * + * @param array $postData + * @param array $expectedData + * @return void + */ + public function testSaveCategoryWithData(array $postData, array $expectedData): void + { + $responseData = $this->performSaveCategoryRequest($postData); + $this->assertRequestIsSuccessfullyPerformed($responseData); + $this->createdCategoryId = $responseData['category']['entity_id']; + $this->categoryFlatIndexer->executeFull(); + $this->assertTrue( + $this->categoryFlatResource->getConnection()->isTableExists($this->categoryFlatResource->getMainTable()) + ); + $categoryFlatCollection = $this->categoryFlatCollectionFactory->create(); + $categoryFlatCollection->addAttributeToSelect(array_keys($expectedData)); + $categoryFlatCollection->addIdFilter($this->createdCategoryId); + $this->assertCount(1, $categoryFlatCollection->getItems()); + /** @var Category $createdCategory */ + $createdCategory = $categoryFlatCollection->getFirstItem(); + foreach ($expectedData as $fieldName => $value) { + $this->assertEquals($value, $createdCategory->getDataByKey($fieldName)); + } + } + + /** + * Data provider with create category POST data. + * + * @return array + */ + public function enableCategoryDataProvider(): array + { + return [ + 'category_is_enabled' => [ + [ + 'name' => 'Custom category name', + 'parent' => 2, + 'is_active' => 1, + 'include_in_menu' => 1, + 'display_mode' => 'PRODUCTS', + 'is_anchor' => true, + 'use_config' => [ + 'available_sort_by' => 1, + 'default_sort_by' => 1, + 'filter_price_range' => 1, + ], + ], + [ + 'is_active' => '1', + ], + ], + 'category_is_disabled' => [ + [ + 'name' => 'Custom category name', + 'parent' => 2, + 'is_active' => 0, + 'include_in_menu' => 1, + 'display_mode' => 'PRODUCTS', + 'is_anchor' => true, + 'use_config' => [ + 'available_sort_by' => 1, + 'default_sort_by' => 1, + 'filter_price_range' => 1, + ], + ], + [ + 'is_active' => '0' + ] + ], + 'include_in_menu_is_enabled' => [ + [ + 'name' => 'Custom category name', + 'parent' => 2, + 'is_active' => 1, + 'include_in_menu' => 1, + 'display_mode' => 'PRODUCTS', + 'is_anchor' => true, + 'use_config' => [ + 'available_sort_by' => 1, + 'default_sort_by' => 1, + 'filter_price_range' => 1, + ], + ], + [ + 'include_in_menu' => '1', + ], + ], + 'include_in_menu_is_disabled' => [ + [ + 'name' => 'Custom category name', + 'parent' => 2, + 'is_active' => 1, + 'include_in_menu' => 0, + 'display_mode' => 'PRODUCTS', + 'is_anchor' => true, + 'use_config' => [ + 'available_sort_by' => 1, + 'default_sort_by' => 1, + 'filter_price_range' => 1, + ], + ], + [ + 'include_in_menu' => '0', + ], + ], + ]; + } + + /** + * Delete all URL rewrite with entity type equal to "category". + * + * @return void + */ + private function deleteAllCategoryUrlRewrites(): void + { + $deleteCondition = $this->urlRewriteResource->getConnection() + ->quoteInto(UrlRewrite::ENTITY_TYPE . ' = ?', DataCategoryUrlRewriteDatabaseMap::ENTITY_TYPE); + $this->urlRewriteResource->getConnection()->delete( + $this->urlRewriteResource->getMainTable(), + $deleteCondition + ); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Category/Save/UrlRewriteTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Category/Save/UrlRewriteTest.php index 90f354d90f17a..e9354d7116ae6 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Category/Save/UrlRewriteTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Category/Save/UrlRewriteTest.php @@ -8,9 +8,6 @@ namespace Magento\Catalog\Controller\Adminhtml\Category\Save; use Magento\CatalogUrlRewrite\Model\Map\DataCategoryUrlRewriteDatabaseMap; -use Magento\Framework\App\Request\Http as HttpRequest; -use Magento\Framework\Serialize\Serializer\Json; -use Magento\TestFramework\TestCase\AbstractBackendController; use Magento\UrlRewrite\Model\ResourceModel\UrlRewriteCollectionFactory; use Magento\UrlRewrite\Service\V1\Data\UrlRewrite; @@ -20,23 +17,20 @@ * @magentoAppArea adminhtml * @magentoDbIsolation enabled */ -class UrlRewriteTest extends AbstractBackendController +class UrlRewriteTest extends AbstractSaveCategoryTest { - /** @var $urlRewriteCollectionFactory */ + /** + * @var UrlRewriteCollectionFactory + */ private $urlRewriteCollectionFactory; - /** @var Json */ - private $jsonSerializer; - /** - * @inheritDoc + * @inheritdoc */ protected function setUp() { parent::setUp(); - $this->urlRewriteCollectionFactory = $this->_objectManager->get(UrlRewriteCollectionFactory::class); - $this->jsonSerializer = $this->_objectManager->get(Json::class); } /** @@ -47,19 +41,14 @@ protected function setUp() */ public function testUrlRewrite(array $data): void { - $this->getRequest()->setMethod(HttpRequest::METHOD_POST); - $this->getRequest()->setPostValue($data); - $this->dispatch('backend/catalog/category/save'); - $categoryId = $this->jsonSerializer->unserialize($this->getResponse()->getBody())['category']['entity_id']; + $responseData = $this->performSaveCategoryRequest($data); + $this->assertRequestIsSuccessfullyPerformed($responseData); + $categoryId = $responseData['category']['entity_id']; $this->assertNotNull($categoryId, 'The category was not created'); $urlRewriteCollection = $this->urlRewriteCollectionFactory->create(); $urlRewriteCollection->addFieldToFilter(UrlRewrite::ENTITY_ID, ['eq' => $categoryId]) ->addFieldToFilter(UrlRewrite::ENTITY_TYPE, ['eq' => DataCategoryUrlRewriteDatabaseMap::ENTITY_TYPE]); - $this->assertCount( - 1, - $urlRewriteCollection->getItems(), - 'Wrong count of url rewrites was created' - ); + $this->assertEquals(1, $urlRewriteCollection->getSize(), 'Wrong count of url rewrites was created'); } /** @@ -77,7 +66,6 @@ public function categoryDataProvider(): array 'include_in_menu' => '1', 'display_mode' => 'PRODUCTS', 'is_anchor' => true, - 'return_session_messages_only' => true, 'use_config' => [ 'available_sort_by' => 1, 'default_sort_by' => 1, diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/reindex_catalog_category_flat.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/reindex_catalog_category_flat.php new file mode 100644 index 0000000000000..03a6bd7735422 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/reindex_catalog_category_flat.php @@ -0,0 +1,16 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Model\Indexer\Category\Flat\State; +use Magento\Indexer\Model\Indexer; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var Indexer $indexer */ +$indexer = $objectManager->get(Indexer::class); +$indexer->load(State::INDEXER_ID); +$indexer->reindexAll(); From 4ce3e07e72d50ce0468b75c871f9f5e24bfd6157 Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Wed, 22 Jan 2020 16:47:52 +0200 Subject: [PATCH 0942/1143] Fixing static tests --- .../CurrencySymbol/view/adminhtml/templates/grid.phtml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml b/app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml index 74268f6e4c4de..9298f0d3ce1d8 100644 --- a/app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml +++ b/app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml @@ -12,7 +12,7 @@ <form id="currency-symbols-form" action="<?= $block->escapeUrl($block->getFormActionUrl()) ?>" method="post"> <input name="form_key" type="hidden" value="<?= $block->escapeHtmlAttr($block->getFormKey()) ?>" /> <fieldset class="admin__fieldset"> - <?php foreach ($block->getCurrencySymbolsData() as $code => $data) : ?> + <?php foreach ($block->getCurrencySymbolsData() as $code => $data): ?> <div class="admin__field _required"> <label class="admin__field-label" for="custom_currency_symbol<?= $block->escapeHtmlAttr($code) ?>"> <span><?= $block->escapeHtml($code) ?> (<?= $block->escapeHtml($data['displayName']) ?>)</span> @@ -25,9 +25,13 @@ name="custom_currency_symbol[<?= $block->escapeHtmlAttr($code) ?>]" <?= $data['inherited'] ? 'disabled' : '' ?>> <div class="admin__field admin__field-option"> + <?php + $escapedCode = $block->escapeHtmlAttr($block->escapeJs($code)); + $escapedSymbol = $block->escapeJs($data['parentSymbol']); + ?> <input id="custom_currency_symbol_inherit<?= $block->escapeHtmlAttr($code) ?>" class="admin__control-checkbox" type="checkbox" - onclick="toggleUseDefault(<?= '\'' . $block->escapeHtmlAttr($block->escapeJs($code)) . '\',\'' . $block->escapeJs($data['parentSymbol']) . '\'' ?>)" + onclick="toggleUseDefault(<?= '\'' . $escapedCode . '\',\'' . $escapedSymbol . '\'' ?>)" <?= $data['inherited'] ? ' checked="checked"' : '' ?> value="1" name="inherit_custom_currency_symbol[<?= $block->escapeHtmlAttr($code) ?>]"> From 69b34419b5ce8e69e5e7568cd8ffde60467d7bb4 Mon Sep 17 00:00:00 2001 From: Oleksandr Dubovyk <odubovyk@magento.com> Date: Wed, 22 Jan 2020 09:15:46 -0600 Subject: [PATCH 0943/1143] MC-30255: In Stock Alert Email Shows Incorrect Item Pricing - static --- app/code/Magento/ProductAlert/Block/Email/AbstractEmail.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/ProductAlert/Block/Email/AbstractEmail.php b/app/code/Magento/ProductAlert/Block/Email/AbstractEmail.php index f7a4c53ab1f14..57081804fca80 100644 --- a/app/code/Magento/ProductAlert/Block/Email/AbstractEmail.php +++ b/app/code/Magento/ProductAlert/Block/Email/AbstractEmail.php @@ -162,6 +162,8 @@ protected function _getUrlParams() } /** + * Get Price Render + * * @return \Magento\Framework\Pricing\Render */ protected function getPriceRender() From 52b184ed9fe1d54400a0758c8a1f1267177ecfb8 Mon Sep 17 00:00:00 2001 From: Andrew Chorniy <a.chorniy@atwix.com> Date: Wed, 22 Jan 2020 18:15:51 +0200 Subject: [PATCH 0944/1143] Fixed issues after code sniffer --- app/code/Magento/Customer/Model/Data/Customer.php | 11 +++++++---- .../Customer/Test/Unit/Model/Data/CustomerTest.php | 13 ++++++++++--- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Customer/Model/Data/Customer.php b/app/code/Magento/Customer/Model/Data/Customer.php index 5c1fee5ee5633..f4318d68f6aa4 100644 --- a/app/code/Magento/Customer/Model/Data/Customer.php +++ b/app/code/Magento/Customer/Model/Data/Customer.php @@ -9,7 +9,8 @@ use \Magento\Framework\Api\AttributeValueFactory; /** - * Class Customer + * Customer data model + * * @SuppressWarnings(PHPMD.ExcessivePublicCount) */ class Customer extends \Magento\Framework\Api\AbstractExtensibleObject implements @@ -39,7 +40,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ protected function getCustomAttributesCodes() { @@ -50,6 +51,8 @@ protected function getCustomAttributesCodes() } /** + * Get default billing address id + * * @return string|null */ public function getDefaultBilling() @@ -489,7 +492,7 @@ public function setDisableAutoGroupChange($disableAutoGroupChange) } /** - * {@inheritdoc} + * @inheritdoc * * @return \Magento\Customer\Api\Data\CustomerExtensionInterface|null */ @@ -499,7 +502,7 @@ public function getExtensionAttributes() } /** - * {@inheritdoc} + * @inheritdoc * * @param \Magento\Customer\Api\Data\CustomerExtensionInterface $extensionAttributes * @return $this diff --git a/app/code/Magento/Customer/Test/Unit/Model/Data/CustomerTest.php b/app/code/Magento/Customer/Test/Unit/Model/Data/CustomerTest.php index 945f213d015bd..395967c46ae67 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Data/CustomerTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Data/CustomerTest.php @@ -1,4 +1,8 @@ <?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ namespace Magento\Customer\Test\Unit\Model\Data; @@ -45,12 +49,15 @@ public function testGetGroupId() * @dataProvider getCreatedInDataProvider * * @return void - */ + */ public function testGetCreatedIn($options, $expectedResult) { - for ($i = 0; $i < count($options); $i++) { + $optionsCount = count($options); + $expectedCount = count($expectedResult); + + for ($i = 0; $i < $optionsCount; $i++) { $this->model->setCreatedIn($options[$i]); - for ($j = $i; $j < count($expectedResult); $j++) { + for ($j = $i; $j < $expectedCount; $j++) { $this->assertEquals($expectedResult[$j], $this->model->getCreatedIn()); break; } From 3b629811c14c613b8b0f962dd0cb3a517cc914bf Mon Sep 17 00:00:00 2001 From: Prabhu Ram <pganapat@adobe.com> Date: Wed, 22 Jan 2020 10:48:27 -0600 Subject: [PATCH 0945/1143] MC-24172: Fix Skipped MFTF Tests From MC-17140: MC-14770, MC-14771, MC-14772 - unskipping MC-24172 --- .../ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml index 67a2551ff239b..02d6d90ae5d0e 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml @@ -17,9 +17,6 @@ <testCaseId value="MC-14770"/> <group value="CatalogRule"/> <group value="mtf_migrated"/> - <skip> - <issueId value="MC-24172"/> - </skip> </annotations> <before> <!-- Login as Admin --> From 103fbb5d1513af9894ce499f1bb504f68391107c Mon Sep 17 00:00:00 2001 From: Mastiuhin Olexandr <mastiuhin.olexandr@transoftgroup.com> Date: Wed, 22 Jan 2020 18:48:46 +0200 Subject: [PATCH 0946/1143] MC-23853: ModuleDBChangeTest Static test errors on PR builds --- .../Magento/Test/Legacy/ModuleDBChangeTest.php | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/ModuleDBChangeTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/ModuleDBChangeTest.php index 876944e0027b4..15b3dc0e0a899 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/ModuleDBChangeTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/ModuleDBChangeTest.php @@ -64,21 +64,6 @@ public static function setUpBeforeClass() } } - /** - * Test changes for module.xml files - */ - public function testModuleXmlFiles() - { - if (!self::$actualBranch) { - preg_match_all('|etc/module\.xml$|mi', self::$changedFileList, $matches); - $this->assertEmpty( - reset($matches), - 'module.xml changes for patch releases in non-actual branches are not allowed:' . PHP_EOL . - implode(PHP_EOL, array_values(reset($matches))) - ); - } - } - /** * Test changes for files in Module Setup dir */ From 87842d3d34e74f6102ec5f39c62fe6e23aa5761e Mon Sep 17 00:00:00 2001 From: Stanislav Ilnytskyi <stailx1@gmail.com> Date: Wed, 22 Jan 2020 19:58:42 +0100 Subject: [PATCH 0947/1143] #26065 unit test improve --- .../Model/Product/Type/Configurable.php | 9 +++++---- .../Test/Unit/Model/Product/Type/ConfigurableTest.php | 10 ++++++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php index 36981aafc34e2..fa677b0b8b421 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php @@ -592,7 +592,7 @@ protected function getGalleryReadHandler() * @param \Magento\Catalog\Model\Product $product * @return \Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable\Product\Collection */ - public function getLinkedProductCollection($product) + protected function getLinkedProductCollection($product) { $collection = $this->_productCollectionFactory->create()->setFlag( 'product_children', @@ -767,8 +767,9 @@ public function isSalable($product) $storeId = $storeId->getId(); } - if (isset($this->isSaleableBySku[$storeId][$product->getSku()])) { - return $this->isSaleableBySku[$storeId][$product->getSku()]; + $sku = $product->getSku(); + if (isset($this->isSaleableBySku[$storeId][$sku])) { + return $this->isSaleableBySku[$storeId][$sku]; } $salable = parent::isSalable($product); @@ -780,7 +781,7 @@ public function isSalable($product) $salable = 0 !== $collection->getSize(); } - $this->isSaleableBySku[$storeId][$product->getSku()] = $salable; + $this->isSaleableBySku[$storeId][$sku] = $salable; return $salable; } diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Type/ConfigurableTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Type/ConfigurableTest.php index 165e479d99348..603b5b4c90f46 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Type/ConfigurableTest.php +++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Type/ConfigurableTest.php @@ -567,12 +567,18 @@ public function testHasOptionsFalse() public function testIsSalable() { $productMock = $this->getMockBuilder(\Magento\Catalog\Model\Product::class) - ->setMethods(['__wakeup', 'getStatus', 'hasData', 'getData', 'getStoreId', 'setData']) + ->setMethods(['__wakeup', 'getStatus', 'hasData', 'getData', 'getStoreId', 'setData', 'getSku']) ->disableOriginalConstructor() ->getMock(); + $productMock + ->expects($this->at(0)) + ->method('getData') + ->with('_cache_instance_store_filter') + ->willReturn(0); $productMock->expects($this->once())->method('getStatus')->willReturn(1); $productMock->expects($this->any())->method('hasData')->willReturn(true); - $productMock->expects($this->at(2))->method('getData')->with('is_salable')->willReturn(true); + $productMock->expects($this->at(1))->method('getSku')->willReturn('SKU-CODE'); + $productMock->expects($this->at(4))->method('getData')->with('is_salable')->willReturn(true); $productCollection = $this->getMockBuilder( \Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable\Product\Collection::class ) From 980f7c3788cddba48d9deae6c6ab29e5340d5ea6 Mon Sep 17 00:00:00 2001 From: OlgaVasyltsun <olga.vasyltsun@gmail.com> Date: Thu, 23 Jan 2020 08:17:36 +0200 Subject: [PATCH 0948/1143] MC-29047: Fix MFTF test --- ...tCheckCategorySimpleProductActionGroup.xml | 2 - ...urableProductCategoryViewChildOnlyTest.xml | 129 ------------------ 2 files changed, 131 deletions(-) delete mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductCategoryViewChildOnlyTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckCategorySimpleProductActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckCategorySimpleProductActionGroup.xml index ef8d5e3a1212a..b8bc3197d1a11 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckCategorySimpleProductActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckCategorySimpleProductActionGroup.xml @@ -19,9 +19,7 @@ <waitForElementVisible selector="{{StorefrontCategoryProductSection.ProductTitleByName(product.name)}}" stepKey="waitForProduct"/> <seeElement selector="{{StorefrontCategoryProductSection.ProductTitleByName(product.name)}}" stepKey="assertProductName"/> <see userInput="${{product.price}}.00" selector="{{StorefrontCategoryProductSection.ProductPriceByName(product.name)}}" stepKey="AssertProductPrice"/> - <!-- @TODO: MAGETWO-80272 Move to Magento_Checkout --> <moveMouseOver selector="{{StorefrontCategoryProductSection.ProductInfoByName(product.name)}}" stepKey="moveMouseOverProduct"/> - <!-- @TODO: MAGETWO-80272 Move to Magento_Checkout --> <seeElement selector="{{StorefrontCategoryProductSection.ProductAddToCartByName(product.name)}}" stepKey="AssertAddToCart"/> </actionGroup> </actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductCategoryViewChildOnlyTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductCategoryViewChildOnlyTest.xml deleted file mode 100644 index 6c9b985bf38f7..0000000000000 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductCategoryViewChildOnlyTest.xml +++ /dev/null @@ -1,129 +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="urn:magento:mftf:Test/etc/testSchema.xsd"> - <test name="StorefrontConfigurableProductCategoryViewChildOnlyTest"> - <annotations> - <features value="ConfigurableProduct"/> - <stories value="View configurable product child in storefront"/> - <title value="DEPRECATED It should be possible to only view the child product of a configurable product"/> - <description value="Create configurable product, add to category such that only child variation is visible in category"/> - <severity value="CRITICAL"/> - <testCaseId value="MC-5832"/> - <group value="ConfigurableProduct"/> - <skip> - <issueId value="DEPRECATED">Use StorefrontShouldSeeOnlyConfigurableProductChildAssignedToSeparateCategoryTest instead</issueId> - </skip> - </annotations> - <before> - <!-- Create the category --> - <createData entity="ApiCategory" stepKey="createCategory"/> - <createData entity="ApiCategory" stepKey="secondCategory"/> - - <!-- Create an attribute with two options to be used in the first child product --> - <createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/> - <createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1"> - <requiredEntity createDataKey="createConfigProductAttribute"/> - </createData> - <createData entity="productAttributeOption2" stepKey="createConfigProductAttributeOption2"> - <requiredEntity createDataKey="createConfigProductAttribute"/> - </createData> - - <!-- Add the attribute we just created to default attribute set --> - <createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet"> - <requiredEntity createDataKey="createConfigProductAttribute"/> - </createData> - - <!-- Get the first option of the attribute we created --> - <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1"> - <requiredEntity createDataKey="createConfigProductAttribute"/> - </getData> - - <!-- Get the second option of the attribute we created --> - <getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeOption2"> - <requiredEntity createDataKey="createConfigProductAttribute"/> - </getData> - - <!-- Create the configurable product and add it to the category --> - <createData entity="ApiConfigurableProduct" stepKey="createConfigProduct"> - <requiredEntity createDataKey="createCategory"/> - </createData> - - <!-- Create a simple product and give it the attribute with the first option --> - <createData entity="ApiSimpleOne" stepKey="createConfigChildProduct1"> - <requiredEntity createDataKey="createConfigProductAttribute"/> - <requiredEntity createDataKey="getConfigAttributeOption1"/> - </createData> - - <!-- Create a simple product and give it the attribute with the second option --> - <createData entity="ApiSimpleTwo" stepKey="createConfigChildProduct2"> - <requiredEntity createDataKey="createConfigProductAttribute"/> - <requiredEntity createDataKey="getConfigAttributeOption2"/> - </createData> - - <createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption"> - <requiredEntity createDataKey="createConfigProduct"/> - <requiredEntity createDataKey="createConfigProductAttribute"/> - <requiredEntity createDataKey="getConfigAttributeOption1"/> - <requiredEntity createDataKey="getConfigAttributeOption2"/> - </createData> - - <!-- Add the first simple product to the configurable product --> - <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild1"> - <requiredEntity createDataKey="createConfigProduct"/> - <requiredEntity createDataKey="createConfigChildProduct1"/> - </createData> - - <!-- Add the second simple product to the configurable product --> - <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild2"> - <requiredEntity createDataKey="createConfigProduct"/> - <requiredEntity createDataKey="createConfigChildProduct2"/> - </createData> - </before> - - <after> - <actionGroup ref="logout" stepKey="adminLogout"/> - <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> - <deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct1"/> - <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/> - <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> - <deleteData createDataKey="createCategory" stepKey="deleteApiCategory"/> - <deleteData createDataKey="secondCategory" stepKey="deleteSecondCategory"/> - </after> - - <actionGroup ref="LoginAsAdmin" stepKey="login"/> - - <!-- Go to the product page for the first product --> - <amOnPage stepKey="goToProductGrid" url="{{ProductCatalogPage.url}}"/> - <waitForPageLoad stepKey="waitForProductGridLoad"/> - <actionGroup stepKey="searchForSimpleProduct" ref="FilterProductGridBySku2ActionGroup"> - <argument name="sku" value="$$createConfigChildProduct1.sku$$"/> - </actionGroup> - <actionGroup stepKey="openProductEditPage" ref="OpenProductForEditByClickingRowXColumnYInProductGridActionGroup"/> - <!-- Edit the visibility the first simple product --> - <selectOption selector="{{AdminProductFormSection.visibility}}" userInput="Catalog, Search" stepKey="selectVisibilityCatalogSearch"/> - <!--Add to category--> - <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[$$secondCategory.name$$]" stepKey="addProductToCategory"/> - <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct"/> - <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="assertSaveMessageSuccess"/> - - <!-- Go to storefront to view child product --> - <amOnPage stepKey="goToStoreFront" url="{{StorefrontHomePage.url}}"/> - <waitForPageLoad stepKey="waitForStorefront"/> - <click selector="{{StorefrontHeaderSection.NavigationCategoryByName($$secondCategory.name$$)}}" stepKey="goToCategoryStorefront"/> - <waitForPageLoad stepKey="waitForStorefrontCategory"/> - <seeElement selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createConfigChildProduct1.name$$)}}" stepKey="seeChildProductInCategory"/> - <dontSeeElement selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createConfigChildProduct2.name$$)}}" stepKey="dontSeeOtherChildProduct"/> - <dontSeeElement selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createConfigProduct.name$$)}}" stepKey="dontSeeParentProduct"/> - <click selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createConfigChildProduct1.name$$)}}" stepKey="clickProductName"/> - <waitForPageLoad stepKey="waitForProductPageLoad"/> - <seeInCurrentUrl url="$$createConfigChildProduct1.custom_attributes[url_key]$$" stepKey="seeProductPageIsAccessible"/> - <seeElement selector="{{StorefrontProductInfoMainSection.productName($$createConfigChildProduct1.name$$)}}" stepKey="seeProductNameOnProductPage"/> - </test> -</tests> From f165a5375830077ebaed7d07f7d8c965332ffae9 Mon Sep 17 00:00:00 2001 From: Deepak S Nair <deepak.nair@ranosys.com> Date: Thu, 23 Jan 2020 11:51:32 +0530 Subject: [PATCH 0949/1143] fixed #25761 - added automated test cases --- .../Unit/Model/ItemProvider/StoreUrlTest.php | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 app/code/Magento/Sitemap/Test/Unit/Model/ItemProvider/StoreUrlTest.php diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/ItemProvider/StoreUrlTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/ItemProvider/StoreUrlTest.php new file mode 100644 index 0000000000000..6a6d2a5770439 --- /dev/null +++ b/app/code/Magento/Sitemap/Test/Unit/Model/ItemProvider/StoreUrlTest.php @@ -0,0 +1,70 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sitemap\Test\Unit\Model\ItemProvider; + +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Sitemap\Model\ItemProvider\ConfigReaderInterface; +use Magento\Sitemap\Model\ItemProvider\StoreUrl as StoreUrlItemResolver; +use Magento\Sitemap\Model\SitemapItem; +use Magento\Sitemap\Model\SitemapItemInterfaceFactory; + +class StoreUrlTest extends \PHPUnit\Framework\TestCase +{ + /** + * test for getItems method + */ + public function testGetItems() + { + $configReaderMock = $this->getConfigReaderMock(); + $itemFactoryMock = $this->getItemFactoryMock(); + $resolver = new StoreUrlItemResolver($configReaderMock, $itemFactoryMock); + $items = $resolver->getItems(1); + + $this->assertTrue(count($items) == 1); + foreach ($items as $index => $item) { + $this->assertSame('daily', $items[$index]->getChangeFrequency()); + $this->assertSame('1.0', $items[$index]->getPriority()); + } + } + + /** + * @return \PHPUnit_Framework_MockObject_MockObject + */ + private function getItemFactoryMock() + { + $itemFactoryMock = $this->getMockBuilder(SitemapItemInterfaceFactory::class) + ->setMethods(['create']) + ->disableOriginalConstructor() + ->getMock(); + + $itemFactoryMock->expects($this->any()) + ->method('create') + ->willReturnCallback(function ($data) { + $helper = new ObjectManager($this); + + return $helper->getObject(SitemapItem::class, $data); + }); + + return $itemFactoryMock; + } + + /** + * @return \PHPUnit_Framework_MockObject_MockObject + */ + private function getConfigReaderMock() + { + $configReaderMock = $this->getMockForAbstractClass(ConfigReaderInterface::class); + $configReaderMock->expects($this->any()) + ->method('getPriority') + ->willReturn('1.0'); + $configReaderMock->expects($this->any()) + ->method('getChangeFrequency') + ->willReturn('daily'); + + return $configReaderMock; + } +} \ No newline at end of file From 124f8cd99e7cf5b84d244e39c5ce53f50eaf4338 Mon Sep 17 00:00:00 2001 From: Mykhailo Matiola <mykhailo.matiola@transoftgroup.com> Date: Thu, 23 Jan 2020 09:27:10 +0200 Subject: [PATCH 0950/1143] MC-30646: Refactor CatalogRule integration test --- .../Model/Indexer/Product/PriceTest.php | 66 +++++++++------- .../_files/catalog_rule_50_percent_off.php | 36 --------- .../catalog_rule_50_percent_off_rollback.php | 28 ------- ...oduct_with_catalog_rule_50_percent_off.php | 75 +++++++++++++++++++ ...h_catalog_rule_50_percent_off_rollback.php | 54 +++++++++++++ .../CatalogRule/_files/simple_products.php | 68 +++-------------- .../_files/simple_products_rollback.php | 2 +- 7 files changed, 180 insertions(+), 149 deletions(-) delete mode 100644 dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_50_percent_off.php delete mode 100644 dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_50_percent_off_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogRule/_files/simple_product_with_catalog_rule_50_percent_off.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogRule/_files/simple_product_with_catalog_rule_50_percent_off_rollback.php diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/Product/PriceTest.php b/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/Product/PriceTest.php index ce182f56898ef..71ea03b1d362b 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/Product/PriceTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/Product/PriceTest.php @@ -8,21 +8,49 @@ use Magento\Catalog\Api\ProductRepositoryInterface; use Magento\Catalog\Model\ProductRepository; use Magento\Catalog\Model\ResourceModel\Product\Collection; +use Magento\CatalogRule\Model\Indexer\IndexBuilder; use Magento\CatalogRule\Model\ResourceModel\Rule; use Magento\Framework\Api\SearchCriteriaInterface; use Magento\Framework\Api\SortOrder; +use Magento\Store\Api\WebsiteRepositoryInterface; use Magento\TestFramework\Helper\Bootstrap; class PriceTest extends \PHPUnit\Framework\TestCase { + /** + * @var \Magento\Framework\ObjectManagerInterface + */ + private $objectManager; /** * @var Rule */ private $resourceRule; + /** + * @var WebsiteRepositoryInterface + */ + private $websiteRepository; + + /** + * @var ProductRepository + */ + private $productRepository; + + /** + * @var IndexBuilder + */ + private $indexerBuilder; + + /** + * @inheritdoc + */ protected function setUp() { - $this->resourceRule = Bootstrap::getObjectManager()->get(Rule::class); + $this->objectManager = Bootstrap::getObjectManager(); + $this->resourceRule = $this->objectManager->get(Rule::class); + $this->websiteRepository = $this->objectManager->get(WebsiteRepositoryInterface::class); + $this->productRepository = $this->objectManager->create(ProductRepository::class); + $this->indexerBuilder = $this->objectManager->get(IndexBuilder::class); } /** @@ -58,41 +86,23 @@ public function testPriceApplying() } /** - * @magentoDataFixtureBeforeTransaction Magento/CatalogRule/_files/simple_products.php - * @magentoDataFixtureBeforeTransaction Magento/CatalogRule/_files/catalog_rule_50_percent_off.php + * @magentoDataFixtureBeforeTransaction Magento/CatalogRule/_files/simple_product_with_catalog_rule_50_percent_off.php * @magentoDbIsolation enabled * @magentoAppIsolation enabled + * @return void */ - public function testPriceForSecondStore() + public function testPriceForSecondStore():void { - $customerGroupId = 1; - $websiteId = 2; - /** @var ProductRepository $productRepository */ - $productRepository = Bootstrap::getObjectManager()->create( - ProductRepository::class - ); - $simpleProduct = $productRepository->get('simple3'); + $websiteId = $this->websiteRepository->get('test')->getId(); + $simpleProduct = $this->productRepository->get('simple'); $simpleProduct->setPriceCalculation(true); - $this->assertEquals('simple3', $simpleProduct->getSku()); + $this->assertEquals('simple', $simpleProduct->getSku()); $this->assertFalse( - $this->resourceRule->getRulePrice( - new \DateTime(), - $websiteId, - $customerGroupId, - $simpleProduct->getId() - ) - ); - $indexerBuilder = Bootstrap::getObjectManager()->get( - \Magento\CatalogRule\Model\Indexer\IndexBuilder::class + $this->resourceRule->getRulePrice(new \DateTime(), $websiteId, 1, $simpleProduct->getId()) ); - $indexerBuilder->reindexById($simpleProduct->getId()); + $this->indexerBuilder->reindexById($simpleProduct->getId()); $this->assertEquals( - $this->resourceRule->getRulePrice( - new \DateTime(), - $websiteId, - $customerGroupId, - $simpleProduct->getId() - ), + $this->resourceRule->getRulePrice(new \DateTime(), $websiteId, 1, $simpleProduct->getId()), 25 ); } diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_50_percent_off.php b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_50_percent_off.php deleted file mode 100644 index ca5c8ecbbd59f..0000000000000 --- a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_50_percent_off.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - -use Magento\TestFramework\Helper\Bootstrap; - -/** - * Creates simple Catalog Rule with the following data: - * active, applied to all products, without time limits, with 50% off for all customers - */ -/** @var \Magento\CatalogRule\Model\Rule $rule */ -$catalogRule = Bootstrap::getObjectManager()->get(\Magento\CatalogRule\Model\RuleFactory::class)->create(); -$catalogRule->loadPost( - [ - 'name' => 'Test Catalog Rule 50% off', - 'is_active' => '1', - 'stop_rules_processing' => 0, - 'website_ids' => [2], - 'customer_group_ids' => [0, 1], - 'discount_amount' => 50, - 'simple_action' => 'by_percent', - 'from_date' => '', - 'to_date' => '', - 'sort_order' => 0, - 'sub_is_enable' => 0, - 'sub_discount_amount' => 0, - 'conditions' => [], - ] -); -$catalogRule->save(); -/** @var \Magento\CatalogRule\Model\Indexer\IndexBuilder $indexBuilder */ -$indexBuilder = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get(\Magento\CatalogRule\Model\Indexer\IndexBuilder::class); -$indexBuilder->reindexFull(); diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_50_percent_off_rollback.php b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_50_percent_off_rollback.php deleted file mode 100644 index 404bfd021492d..0000000000000 --- a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_50_percent_off_rollback.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - -$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - -/** @var \Magento\CatalogRule\Model\ResourceModel\Rule $catalogRuleResource */ -$catalogRuleResource = $objectManager->create(\Magento\CatalogRule\Model\ResourceModel\Rule::class); - -//Retrieve second rule by name -$select = $catalogRuleResource->getConnection()->select(); -$select->from($catalogRuleResource->getMainTable(), 'rule_id'); -$select->where('name = ?', 'Test Catalog Rule 50% off'); -$ruleId = $catalogRuleResource->getConnection()->fetchOne($select); - -try { - /** @var \Magento\CatalogRule\Api\CatalogRuleRepositoryInterface $ruleRepository */ - $ruleRepository = $objectManager->create(\Magento\CatalogRule\Api\CatalogRuleRepositoryInterface::class); - $ruleRepository->deleteById($ruleId); -} catch (\Exception $ex) { - //Nothing to remove -} - -/** @var \Magento\CatalogRule\Model\Indexer\IndexBuilder $indexBuilder */ -$indexBuilder = $objectManager->get(\Magento\CatalogRule\Model\Indexer\IndexBuilder::class); -$indexBuilder->reindexFull(); diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/simple_product_with_catalog_rule_50_percent_off.php b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/simple_product_with_catalog_rule_50_percent_off.php new file mode 100644 index 0000000000000..cad11e38ac8f3 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/simple_product_with_catalog_rule_50_percent_off.php @@ -0,0 +1,75 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\Data\ProductInterfaceFactory; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Catalog\Model\Product\Visibility; +use Magento\CatalogRule\Api\CatalogRuleRepositoryInterface; +use Magento\CatalogRule\Model\Indexer\IndexBuilder; +use Magento\CatalogRule\Model\Rule; +use Magento\CatalogRule\Model\RuleFactory; +use Magento\Customer\Model\Group; +use Magento\Store\Api\WebsiteRepositoryInterface; +use Magento\TestFramework\Helper\Bootstrap; + +require __DIR__ . '/../../Store/_files/second_website_with_two_stores.php'; + +$objectManager = Bootstrap::getObjectManager(); +/** @var WebsiteRepositoryInterface $websiteRepository */ +$websiteRepository = $objectManager->get(WebsiteRepositoryInterface::class); +/** @var IndexBuilder $indexBuilder */ +$indexBuilder = $objectManager->get(IndexBuilder::class); +/** @var CatalogRuleRepositoryInterface $catalogRuleRepository */ +$catalogRuleRepository = $objectManager->get(CatalogRuleRepositoryInterface::class); +/** @var ProductInterfaceFactory $productFactory */ +$productFactory = $objectManager->get(ProductInterfaceFactory::class); +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->get(ProductRepositoryInterface::class); +/** @var RuleFactory $ruleFactory */ +$ruleFactory = $objectManager->get(RuleFactory::class); + +$secondWebsite = $websiteRepository->get('test'); +$product = $productFactory->create(); +$product->setTypeId('simple') + ->setAttributeSetId($product->getDefaultAttributeSetId()) + ->setWebsiteIds([$secondWebsite->getId()]) + ->setName('Simple Product') + ->setSku('simple') + ->setPrice(50) + ->setVisibility(Visibility::VISIBILITY_BOTH) + ->setStatus(Status::STATUS_ENABLED) + ->setStockData( + [ + 'use_config_manage_stock' => 1, + 'qty' => 100, + 'is_qty_decimal' => 0, + 'is_in_stock' => 1, + ] + ); +$productRepository->save($product); +/** @var Rule $rule */ +$catalogRule = $ruleFactory->create(); +$catalogRule->loadPost( + [ + 'name' => 'Test Catalog Rule 50% off', + 'is_active' => '1', + 'stop_rules_processing' => 0, + 'website_ids' => [$secondWebsite->getId()], + 'customer_group_ids' => [Group::NOT_LOGGED_IN_ID, 1], + 'discount_amount' => 50, + 'simple_action' => 'by_percent', + 'from_date' => '', + 'to_date' => '', + 'sort_order' => 0, + 'sub_is_enable' => 0, + 'sub_discount_amount' => 0, + 'conditions' => [], + ] +); +$catalogRuleRepository->save($catalogRule); +$indexBuilder->reindexFull(); diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/simple_product_with_catalog_rule_50_percent_off_rollback.php b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/simple_product_with_catalog_rule_50_percent_off_rollback.php new file mode 100644 index 0000000000000..a0df9b0daea9f --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/simple_product_with_catalog_rule_50_percent_off_rollback.php @@ -0,0 +1,54 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\CatalogRule\Api\CatalogRuleRepositoryInterface; +use Magento\CatalogRule\Model\Indexer\IndexBuilder; +use Magento\CatalogRule\Model\ResourceModel\Rule; +use Magento\Framework\Exception\CouldNotDeleteException; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Registry; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var Registry $registry */ +$registry = $objectManager->get(Registry::class); +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->create(ProductRepositoryInterface::class); +/** @var CatalogRuleRepositoryInterface $ruleRepository */ +$ruleRepository = $objectManager->get(CatalogRuleRepositoryInterface::class); +/** @var IndexBuilder $indexBuilder */ +$indexBuilder = $objectManager->get(IndexBuilder::class); + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); +try { + $productRepository->deleteById('simple'); +} catch (NoSuchEntityException $e) { + //already removed +} +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); + +/** @var Rule $catalogRuleResource */ +$catalogRuleResource = $objectManager->create(Rule::class); +//Retrieve rule by name +$select = $catalogRuleResource->getConnection() + ->select() + ->from($catalogRuleResource->getMainTable(), 'rule_id') + ->where('name = ?', 'Test Catalog Rule 50% off'); +$ruleId = $catalogRuleResource->getConnection()->fetchOne($select); + +try { + $ruleRepository->deleteById($ruleId); +} catch (CouldNotDeleteException $ex) { + //Nothing to remove +} + +$indexBuilder->reindexFull(); + +require __DIR__ . '/../../Store/_files/second_website_with_two_stores_rollback.php'; diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/simple_products.php b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/simple_products.php index c40b641e58b1d..84ce4e1bca87c 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/simple_products.php +++ b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/simple_products.php @@ -26,14 +26,12 @@ ->setPrice(10) ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) - ->setStockData( - [ - 'use_config_manage_stock' => 1, - 'qty' => 100, - 'is_qty_decimal' => 0, - 'is_in_stock' => 1, - ] - ); + ->setStockData([ + 'use_config_manage_stock' => 1, + 'qty' => 100, + 'is_qty_decimal' => 0, + 'is_in_stock' => 1, + ]); $productRepository->save($product); $productAction = $objectManager->get(\Magento\Catalog\Model\Product\Action::class); $productAction->updateAttributes([$product->getId()], ['test_attribute' => 'test_attribute_value'], $store->getId()); @@ -48,52 +46,10 @@ ->setPrice(9.9) ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) - ->setStockData( - [ - 'use_config_manage_stock' => 1, - 'qty' => 100, - 'is_qty_decimal' => 0, - 'is_in_stock' => 1, - ] - ); + ->setStockData([ + 'use_config_manage_stock' => 1, + 'qty' => 100, + 'is_qty_decimal' => 0, + 'is_in_stock' => 1, + ]); $productRepository->save($product); -$store = $objectManager->create(\Magento\Store\Model\Store::class); -$store->load('second_store_view', 'code'); -/** - * @var Website $website - */ -$website2 = $objectManager->get(\Magento\Store\Model\Website::class); -$website2->load('second_website', 'code'); -if (!$website2->getId()) { - /** @var \Magento\Store\Model\Website $website */ - $website2->setData( - [ - 'code' => 'second_website', - 'name' => 'Second Website', - - ] - ); - - $website2->save(); -} -$product = $objectManager->create(\Magento\Catalog\Model\Product::class) - ->setTypeId('simple') - ->setId(3) - ->setAttributeSetId($attributeSetId) - ->setWebsiteIds([$website2->getId()]) - ->setName('Simple Product 3') - ->setSku('simple3') - ->setPrice(50) - ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) - ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) - ->setStockData( - [ - 'use_config_manage_stock' => 1, - 'qty' => 100, - 'is_qty_decimal' => 0, - 'is_in_stock' => 1, - ] - ); -$productRepository->save($product); -$productAction = $objectManager->get(\Magento\Catalog\Model\Product\Action::class); -$productAction->updateAttributes([$product->getId()], ['test_attribute' => 'test_attribute_value'], $store->getId()); diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/simple_products_rollback.php b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/simple_products_rollback.php index e641f9f32df40..6625b1926fc10 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/simple_products_rollback.php +++ b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/simple_products_rollback.php @@ -18,7 +18,7 @@ /** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */ $productRepository = $objectManager->get(\Magento\Catalog\Api\ProductRepositoryInterface::class); -foreach (['simple1', 'simple2','simple3'] as $sku) { +foreach (['simple1', 'simple2'] as $sku) { try { $product = $productRepository->get($sku, false, null, true); $productRepository->delete($product); From 613edfc40e02bcaaab12a7fc517a6241c15da72b Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Thu, 23 Jan 2020 09:35:15 +0200 Subject: [PATCH 0951/1143] fix static tests --- lib/internal/Magento/Framework/HTTP/Client/Curl.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/internal/Magento/Framework/HTTP/Client/Curl.php b/lib/internal/Magento/Framework/HTTP/Client/Curl.php index 47ee5198326dd..43dea5f1dc4b7 100644 --- a/lib/internal/Magento/Framework/HTTP/Client/Curl.php +++ b/lib/internal/Magento/Framework/HTTP/Client/Curl.php @@ -423,6 +423,7 @@ protected function makeRequest($method, $uri, $params = []) */ public function doError($string) { + // hpcs:ignore Magento2.Exceptions.DirectThrow throw new \Exception($string); } From 27c721bca5b3f4595b3a954557aee677b2d09447 Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Thu, 23 Jan 2020 09:50:19 +0200 Subject: [PATCH 0952/1143] MC-24170: Fix Skipped MFTF Tests From MC-17140: MC-13493, MC-14062, MC-14063 --- ...minCreateVirtualProductWithTierPriceForGeneralGroupTest.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithTierPriceForGeneralGroupTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithTierPriceForGeneralGroupTest.xml index 976f714d7b3e1..4c3d519106389 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithTierPriceForGeneralGroupTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithTierPriceForGeneralGroupTest.xml @@ -17,6 +17,9 @@ <severity value="CRITICAL"/> <group value="catalog"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-30682"/> + </skip> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> From 2da2d49878d31f460aad91b542340a4c3dcbd863 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Thu, 23 Jan 2020 09:52:14 +0200 Subject: [PATCH 0953/1143] fix typo --- lib/internal/Magento/Framework/HTTP/Client/Curl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/HTTP/Client/Curl.php b/lib/internal/Magento/Framework/HTTP/Client/Curl.php index 43dea5f1dc4b7..60825e231504d 100644 --- a/lib/internal/Magento/Framework/HTTP/Client/Curl.php +++ b/lib/internal/Magento/Framework/HTTP/Client/Curl.php @@ -423,7 +423,7 @@ protected function makeRequest($method, $uri, $params = []) */ public function doError($string) { - // hpcs:ignore Magento2.Exceptions.DirectThrow + // phpcs:ignore Magento2.Exceptions.DirectThrow throw new \Exception($string); } From 69d07c13b394bdf367048ba25dbf922f7cc4f1b6 Mon Sep 17 00:00:00 2001 From: Vaha <vaha@atwix.com> Date: Thu, 23 Jan 2020 10:09:29 +0200 Subject: [PATCH 0954/1143] #18012: improved cases for DataProviderTest --- .../Test/Unit/Model/Js/DataProviderTest.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Translation/Test/Unit/Model/Js/DataProviderTest.php b/app/code/Magento/Translation/Test/Unit/Model/Js/DataProviderTest.php index b5bfbbc29a603..56cfcad7a2775 100644 --- a/app/code/Magento/Translation/Test/Unit/Model/Js/DataProviderTest.php +++ b/app/code/Magento/Translation/Test/Unit/Model/Js/DataProviderTest.php @@ -105,24 +105,31 @@ public function testGetData() 'hello1' => 'hello1translated', 'hello2' => 'hello2translated', 'hello3' => 'hello3translated', - 'hello4' => 'hello4translated' + 'hello4' => 'hello4translated', + 'ko i18' => 'ko i18 translated', + 'underscore i18' => 'underscore i18 translated', ]; $contentsMap = [ 'content1$.mage.__("hello1")content1', 'content2$.mage.__("hello2")content2', - 'content2$.mage.__("hello4")content4', // this value should be last after running data provider - 'content2$.mage.__("hello3")content3', + 'content2$.mage.__("hello4")content4 <!-- ko i18n: "ko i18" --><!-- /ko -->', + 'content2$.mage.__("hello3")content3 <% _.i18n("underscore i18") %>', ]; $translateMap = [ [['hello1'], [], 'hello1translated'], [['hello2'], [], 'hello2translated'], [['hello3'], [], 'hello3translated'], - [['hello4'], [], 'hello4translated'] + [['hello4'], [], 'hello4translated'], + [['ko i18'], [], 'ko i18 translated'], + [['underscore i18'], [], 'underscore i18 translated'], ]; - $patterns = ['~\$\.mage\.__\(([\'"])(.+?)\1\)~']; + $patterns = [ + '~\$\.mage\.__\(([\'"])(.+?)\1\)~', + '~(?:i18n\:|_\.i18n\()\s*(["\'])(.*?)(?<!\\\\)\1~', + ]; $this->appStateMock->expects($this->once()) ->method('getAreaCode') From ea1c1cdf5548ecea506e46b20ab479498719ba74 Mon Sep 17 00:00:00 2001 From: Andrii Kalinich <51681435+engcom-Echo@users.noreply.github.com> Date: Thu, 23 Jan 2020 10:18:22 +0200 Subject: [PATCH 0955/1143] Update StoreValidatorTest.php --- app/code/Magento/StoreGraphQl/Test/Unit/StoreValidatorTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/StoreGraphQl/Test/Unit/StoreValidatorTest.php b/app/code/Magento/StoreGraphQl/Test/Unit/StoreValidatorTest.php index aa160bd3eb8e7..7a4ea46990e00 100644 --- a/app/code/Magento/StoreGraphQl/Test/Unit/StoreValidatorTest.php +++ b/app/code/Magento/StoreGraphQl/Test/Unit/StoreValidatorTest.php @@ -128,7 +128,7 @@ public function testValidateWithStoreActive(array $config): void } /** - * @inheritDoc + * Data provider * * @return array */ From a62180759f0179e7d76766e0d6c3324b50aecdd1 Mon Sep 17 00:00:00 2001 From: Andrii Kalinich <51681435+engcom-Echo@users.noreply.github.com> Date: Thu, 23 Jan 2020 10:18:51 +0200 Subject: [PATCH 0956/1143] Update RedirectTest.php --- .../Magento/Store/Test/Unit/Controller/Store/RedirectTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php b/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php index 1136194fc322a..3943b84841806 100644 --- a/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php +++ b/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php @@ -268,7 +268,7 @@ public function testRedirectTargetIsNull(): void } /** - * @inheritDoc + * Data provider * * @return array */ From 8f5b2c7ff88d4771ad34bd0548185d3cc0c30643 Mon Sep 17 00:00:00 2001 From: Deepak S Nair <deepak.nair@ranosys.com> Date: Thu, 23 Jan 2020 14:33:12 +0530 Subject: [PATCH 0957/1143] fixed #25761 - update test case and one comment --- app/code/Magento/Sitemap/Model/ItemProvider/StoreUrl.php | 2 +- .../Sitemap/Test/Unit/Model/ItemProvider/StoreUrlTest.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Sitemap/Model/ItemProvider/StoreUrl.php b/app/code/Magento/Sitemap/Model/ItemProvider/StoreUrl.php index dd7c50385945f..e262f56d0905f 100644 --- a/app/code/Magento/Sitemap/Model/ItemProvider/StoreUrl.php +++ b/app/code/Magento/Sitemap/Model/ItemProvider/StoreUrl.php @@ -25,7 +25,7 @@ class StoreUrl implements ItemProviderInterface private $configReader; /** - * CategorySitemapItemResolver constructor. + * StoreUrlSitemapItemResolver constructor. * * @param ConfigReaderInterface $configReader * @param SitemapItemInterfaceFactory $itemFactory diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/ItemProvider/StoreUrlTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/ItemProvider/StoreUrlTest.php index 6a6d2a5770439..62b30aa176bf1 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/ItemProvider/StoreUrlTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/ItemProvider/StoreUrlTest.php @@ -25,9 +25,9 @@ public function testGetItems() $items = $resolver->getItems(1); $this->assertTrue(count($items) == 1); - foreach ($items as $index => $item) { - $this->assertSame('daily', $items[$index]->getChangeFrequency()); - $this->assertSame('1.0', $items[$index]->getPriority()); + foreach ($items as $item) { + $this->assertSame('daily', $item->getChangeFrequency()); + $this->assertSame('1.0', $item->getPriority()); } } From 305f573bf1c120463f8e80e5fe5f5c8ac27269f9 Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Thu, 23 Jan 2020 11:07:31 +0200 Subject: [PATCH 0958/1143] MC-30320: Product image is not visible if a watermark image size is larger --- .../Magento/Framework/Image/Adapter/Gd2.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/lib/internal/Magento/Framework/Image/Adapter/Gd2.php b/lib/internal/Magento/Framework/Image/Adapter/Gd2.php index 7e92b336cfdc0..04d4c5386bd25 100644 --- a/lib/internal/Magento/Framework/Image/Adapter/Gd2.php +++ b/lib/internal/Magento/Framework/Image/Adapter/Gd2.php @@ -822,8 +822,9 @@ protected function _createEmptyImage($width, $height) * @param int $src_w * @param int $src_h * @param int $pct - * * @return bool + * @SuppressWarnings(PHPMD.CyclomaticComplexity) + * @SuppressWarnings(PHPMD.NPathComplexity) */ private function imagecopymergeWithAlphaFix( $dst_im, @@ -859,12 +860,24 @@ private function imagecopymergeWithAlphaFix( return false; } + if (false === imagesavealpha($tmpImg, true)) { + return false; + } + if (false === imagecopy($tmpImg, $src_im, 0, 0, 0, 0, $sizeX, $sizeY)) { return false; } - $transparancy = 127 - (($pct*127)/100); - if (false === imagefilter($tmpImg, IMG_FILTER_COLORIZE, 0, 0, 0, $transparancy)) { + $transparency = 127 - (($pct*127)/100); + if (false === imagefilter($tmpImg, IMG_FILTER_COLORIZE, 0, 0, 0, $transparency)) { + return false; + } + + if (false === imagealphablending($dst_im, true)) { + return false; + } + + if (false === imagesavealpha($dst_im, true)) { return false; } From 58adcc59e675430e890ab5d18f675e90715646a1 Mon Sep 17 00:00:00 2001 From: Vaha <vaha@atwix.com> Date: Thu, 23 Jan 2020 11:31:48 +0200 Subject: [PATCH 0959/1143] #18012: updated description for DataProviderTest --- .../Magento/Translation/Test/Unit/Model/Js/DataProviderTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Translation/Test/Unit/Model/Js/DataProviderTest.php b/app/code/Magento/Translation/Test/Unit/Model/Js/DataProviderTest.php index 56cfcad7a2775..146e1c06782ce 100644 --- a/app/code/Magento/Translation/Test/Unit/Model/Js/DataProviderTest.php +++ b/app/code/Magento/Translation/Test/Unit/Model/Js/DataProviderTest.php @@ -15,7 +15,7 @@ use Magento\Framework\Phrase\Renderer\Translate; /** - * Class DataProviderTest + * Verify data provider translation * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ From 8e6b0c8530470109678568e44d4d5c7baf087f0b Mon Sep 17 00:00:00 2001 From: Michele Fantetti <mfantetti@ittweb.net> Date: Thu, 23 Jan 2020 11:04:24 +0100 Subject: [PATCH 0960/1143] Add frontend template hints status command after suggestions --- .../Command/TemplateHintsStatusCommand.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php b/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php index 296d5dd7ac82d..d61db01dfd4ee 100644 --- a/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php +++ b/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php @@ -22,7 +22,7 @@ class TemplateHintsStatusCommand extends Command /** * @var ScopeConfigInterface */ - protected $scopeConfig; + private $scopeConfig; /** * Initialize dependencies. @@ -53,12 +53,23 @@ protected function configure() protected function execute(InputInterface $input, OutputInterface $output) { $templateHintsStatus = - ($this->scopeConfig->isSetFlag('dev/debug/template_hints_storefront', 'default')) + ($this->isTemplateHintsEnabled()) ? 'enabled' : 'disabled'; $templateHintsMessage = __("Template hints are %status", ['status' => $templateHintsStatus]); $output->writeln("<info>" . $templateHintsMessage . "</info>"); - return 0; + return \Magento\Framework\Console\Cli::RETURN_SUCCESS; + } + + /** + * @return bool + */ + private function isTemplateHintsEnabled() + { + $result = ($this->scopeConfig->isSetFlag('dev/debug/template_hints_storefront', 'default')) + ? true + : false; + return $result; } } From c4ffa89eea24b3ce906409f176ecd74dad5c57fa Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Thu, 23 Jan 2020 12:09:43 +0200 Subject: [PATCH 0961/1143] Use view model insead of helper, fix static tests --- .../ViewModel/Layer/Filter.php | 41 +++++++++++++++++++ .../catalog_category_view_type_layered.xml | 6 ++- .../frontend/templates/layer/filter.phtml | 18 ++++---- .../templates/product/layered/renderer.phtml | 29 +++++++++---- 4 files changed, 76 insertions(+), 18 deletions(-) create mode 100644 app/code/Magento/LayeredNavigation/ViewModel/Layer/Filter.php diff --git a/app/code/Magento/LayeredNavigation/ViewModel/Layer/Filter.php b/app/code/Magento/LayeredNavigation/ViewModel/Layer/Filter.php new file mode 100644 index 0000000000000..fbfd5d3432d34 --- /dev/null +++ b/app/code/Magento/LayeredNavigation/ViewModel/Layer/Filter.php @@ -0,0 +1,41 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\LayeredNavigation\ViewModel\Layer; + +use Magento\Catalog\Helper\Data as DataHelper; +use Magento\Framework\View\Element\Block\ArgumentInterface; + +/** + * ViewModel for Product Layer + */ +class Filter implements ArgumentInterface +{ + /** + * @var DataHelper + */ + private $dataHelper; + + /** + * Constructor + * + * @param DataHelper $dataHelper + */ + public function __construct(DataHelper $dataHelper) + { + $this->dataHelper = $dataHelper; + } + + /** + * Check is should display product count on layer + * + * @return bool + */ + public function shouldDisplayProductCountOnLayer(): bool + { + return $this->dataHelper->shouldDisplayProductCountOnLayer(); + } +} diff --git a/app/code/Magento/LayeredNavigation/view/frontend/layout/catalog_category_view_type_layered.xml b/app/code/Magento/LayeredNavigation/view/frontend/layout/catalog_category_view_type_layered.xml index 647874540f94c..6f0a1af0f5bae 100644 --- a/app/code/Magento/LayeredNavigation/view/frontend/layout/catalog_category_view_type_layered.xml +++ b/app/code/Magento/LayeredNavigation/view/frontend/layout/catalog_category_view_type_layered.xml @@ -11,7 +11,11 @@ <referenceContainer name="sidebar.main"> <block class="Magento\LayeredNavigation\Block\Navigation\Category" name="catalog.leftnav" before="-" template="Magento_LayeredNavigation::layer/view.phtml"> <block class="Magento\LayeredNavigation\Block\Navigation\State" name="catalog.navigation.state" as="state" /> - <block class="Magento\LayeredNavigation\Block\Navigation\FilterRenderer" name="catalog.navigation.renderer" as="renderer" template="Magento_LayeredNavigation::layer/filter.phtml"/> + <block class="Magento\LayeredNavigation\Block\Navigation\FilterRenderer" name="catalog.navigation.renderer" as="renderer" template="Magento_LayeredNavigation::layer/filter.phtml"> + <arguments> + <argument name="product_layer_view_model" xsi:type="object">Magento\LayeredNavigation\ViewModel\Layer\Filter</argument> + </arguments> + </block> </block> </referenceContainer> </body> diff --git a/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/filter.phtml b/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/filter.phtml index 7313207ecf663..de81373a11573 100644 --- a/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/filter.phtml +++ b/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/filter.phtml @@ -7,20 +7,18 @@ // phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis ?> <?php -/** - * Template for filter items block - * - * @var $block \Magento\LayeredNavigation\Block\Navigation\FilterRenderer - */ +/** @var $block \Magento\LayeredNavigation\Block\Navigation\FilterRenderer */ +/** @var \Magento\LayeredNavigation\ViewModel\Layer\Filter $viewModel */ +$viewModel = $block->getData('product_layer_view_model'); ?> <ol class="items"> - <?php foreach ($filterItems as $filterItem) : ?> + <?php foreach ($filterItems as $filterItem) :?> <li class="item"> - <?php if ($filterItem->getCount() > 0) : ?> + <?php if ($filterItem->getCount() > 0) :?> <a href="<?= $block->escapeUrl($filterItem->getUrl()) ?>" rel="nofollow"> <?= /* @noEscape */ $filterItem->getLabel() ?> - <?php if ($this->helper(\Magento\Catalog\Helper\Data::class)->shouldDisplayProductCountOnLayer()) : ?> + <?php if ($viewModel->shouldDisplayProductCountOnLayer()) : ?> <span class="count"><?= /* @noEscape */ (int)$filterItem->getCount() ?><span class="filter-count-label"> <?php if ($filterItem->getCount() == 1) : ?> <?= $block->escapeHtml(__('item')) ?><?php @@ -31,11 +29,11 @@ </a> <?php else :?> <?= /* @noEscape */ $filterItem->getLabel() ?> - <?php if ($this->helper(\Magento\Catalog\Helper\Data::class)->shouldDisplayProductCountOnLayer()) : ?> + <?php if ($viewModel->shouldDisplayProductCountOnLayer()) : ?> <span class="count"><?= /* @noEscape */ (int)$filterItem->getCount() ?><span class="filter-count-label"> <?php if ($filterItem->getCount() == 1) : ?><?= $block->escapeHtml(__('items')) ?><?php - else : + else: ?><?= $block->escapeHtml(__('items')) ?><?php endif;?></span></span> <?php endif; ?> diff --git a/app/code/Magento/Swatches/view/frontend/templates/product/layered/renderer.phtml b/app/code/Magento/Swatches/view/frontend/templates/product/layered/renderer.phtml index 0680290e25002..5623da147130c 100644 --- a/app/code/Magento/Swatches/view/frontend/templates/product/layered/renderer.phtml +++ b/app/code/Magento/Swatches/view/frontend/templates/product/layered/renderer.phtml @@ -14,11 +14,11 @@ attribute-code="<?= $block->escapeHtmlAttr($swatchData['attribute_code']) ?>" attribute-id="<?= $block->escapeHtmlAttr($swatchData['attribute_id']) ?>"> <div class="swatch-attribute-options clearfix"> - <?php foreach ($swatchData['options'] as $option => $label) : ?> + <?php foreach ($swatchData['options'] as $option => $label) :?> <a href="<?= $block->escapeUrl($label['link']) ?>" rel="nofollow" aria-label="<?= $block->escapeHtmlAttr($label['label']) ?>" class="swatch-option-link-layered"> - <?php if (isset($swatchData['swatches'][$option]['type'])) : ?> + <?php if (isset($swatchData['swatches'][$option]['type'])) :?> <?php switch ($swatchData['swatches'][$option]['type']) { case '3': ?> @@ -33,8 +33,16 @@ <?php break; case '2': ?> - <?php $swatchThumbPath = $block->getSwatchPath('swatch_thumb', $swatchData['swatches'][$option]['value']); ?> - <?php $swatchImagePath = $block->getSwatchPath('swatch_image', $swatchData['swatches'][$option]['value']); ?> + <?php $swatchThumbPath = $block->getSwatchPath( + 'swatch_thumb', + $swatchData['swatches'][$option]['value'] + ); ?> + <?php $swatchImagePath = $block->getSwatchPath( + 'swatch_image', + $swatchData['swatches'][$option]['value'] + ); + $escapedUrl = $block->escapeUrl($swatchImagePath); + ?> <div class="swatch-option image <?= $block->escapeHtmlAttr($label['custom_style']) ?>" tabindex="-1" option-type="2" @@ -42,7 +50,10 @@ option-label="<?= $block->escapeHtmlAttr($label['label']) ?>" option-tooltip-thumb="<?= $block->escapeUrl($swatchThumbPath) ?>" option-tooltip-value="" - style="background: url(<?= $block->escapeUrl($swatchImagePath) ?>) no-repeat center; background-size: initial;"></div> + style="background: url(<?= + $escapedUrl + ?>) no-repeat center; background-size: initial;"> + </div> <?php break; case '1': ?> @@ -52,8 +63,12 @@ option-id="<?= $block->escapeHtmlAttr($option) ?>" option-label="<?= $block->escapeHtmlAttr($label['label']) ?>" option-tooltip-thumb="" - option-tooltip-value="<?= $block->escapeHtmlAttr($swatchData['swatches'][$option]['value']) ?>" - style="background: <?= $block->escapeHtmlAttr($swatchData['swatches'][$option]['value']) ?> no-repeat center; background-size: initial;"></div> + option-tooltip-value="<?= $block->escapeHtmlAttr( + $swatchData['swatches'][$option]['value'] + ) ?>" + style="background: <?= $block->escapeHtmlAttr( + $swatchData['swatches'][$option]['value'] + ) ?> no-repeat center; background-size: initial;"></div> <?php break; case '0': default: From 7d316ecfcb850a60253d897c6dba020f1a8b3a83 Mon Sep 17 00:00:00 2001 From: Karyna Tsymbal <k.tsymbal@atwix.com> Date: Thu, 23 Jan 2020 12:11:14 +0200 Subject: [PATCH 0962/1143] Code cleaning --- .../Test/Unit/Plugin/Block/Tracking/PopupDeliveryDateTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Fedex/Test/Unit/Plugin/Block/Tracking/PopupDeliveryDateTest.php b/app/code/Magento/Fedex/Test/Unit/Plugin/Block/Tracking/PopupDeliveryDateTest.php index 23465b1b26a42..a1c461a10abdc 100644 --- a/app/code/Magento/Fedex/Test/Unit/Plugin/Block/Tracking/PopupDeliveryDateTest.php +++ b/app/code/Magento/Fedex/Test/Unit/Plugin/Block/Tracking/PopupDeliveryDateTest.php @@ -6,6 +6,7 @@ namespace Magento\Fedex\Test\Unit\Plugin\Block\Tracking; +use Magento\Fedex\Model\Carrier; use Magento\Fedex\Plugin\Block\Tracking\PopupDeliveryDate; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use Magento\Shipping\Block\Tracking\Popup; @@ -44,7 +45,7 @@ public function testAfterFormatDeliveryDateTimeWithFedexCarrier() ->getMock(); $trackingStatusMock->expects($this::once()) ->method('getCarrier') - ->willReturn(\Magento\Fedex\Model\Carrier::CODE); + ->willReturn(Carrier::CODE); /** @var Popup|MockObject $subjectMock */ $subjectMock = $this->getMockBuilder(Popup::class) From c93c1a0d0912202d1e81c6cfcacd15b0d691257e Mon Sep 17 00:00:00 2001 From: Viktor Sevch <svitja@ukr.net> Date: Thu, 23 Jan 2020 12:17:43 +0200 Subject: [PATCH 0963/1143] MC-23546: Child Configurable product does not save disabled status via API --- .../Mftf/Test/StorefrontQuickSearchConfigurableChildrenTest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontQuickSearchConfigurableChildrenTest.xml b/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontQuickSearchConfigurableChildrenTest.xml index 1169d053ec7c8..44a4001f7b579 100644 --- a/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontQuickSearchConfigurableChildrenTest.xml +++ b/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontQuickSearchConfigurableChildrenTest.xml @@ -15,6 +15,7 @@ <description value="Use Quick Search to find a configurable product with enabled/disable children"/> <severity value="MAJOR"/> <testCaseId value="MC-28374"/> + <useCaseId value="MAGETWO-69181"/> <group value="catalogSearch"/> <group value="mtf_migrated"/> </annotations> From d4cbfaf4a3fa88ca13e7640fce5d08b9d19dba01 Mon Sep 17 00:00:00 2001 From: Michele Fantetti <mfantetti@ittweb.net> Date: Thu, 23 Jan 2020 11:19:19 +0100 Subject: [PATCH 0964/1143] Add frontend template hints status command after suggestions --- .../Console/Command/TemplateHintsStatusCommand.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php b/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php index d61db01dfd4ee..98719784a03c4 100644 --- a/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php +++ b/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php @@ -10,6 +10,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\Console\Cli; /** * Command to show frontend template hints status @@ -59,7 +60,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $templateHintsMessage = __("Template hints are %status", ['status' => $templateHintsStatus]); $output->writeln("<info>" . $templateHintsMessage . "</info>"); - return \Magento\Framework\Console\Cli::RETURN_SUCCESS; + return Cli::RETURN_SUCCESS; } /** @@ -67,9 +68,6 @@ protected function execute(InputInterface $input, OutputInterface $output) */ private function isTemplateHintsEnabled() { - $result = ($this->scopeConfig->isSetFlag('dev/debug/template_hints_storefront', 'default')) - ? true - : false; - return $result; + return ($this->scopeConfig->isSetFlag('dev/debug/template_hints_storefront', 'default')); } } From 76946a6f62830fe76ae6e5fe0d23bdace40f74ce Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Thu, 23 Jan 2020 13:00:00 +0200 Subject: [PATCH 0965/1143] Static test fix attempt 2 --- .../frontend/templates/layer/filter.phtml | 22 ++++++++------- .../templates/product/layered/renderer.phtml | 28 +++++++++---------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/filter.phtml b/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/filter.phtml index de81373a11573..6b65d184b462a 100644 --- a/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/filter.phtml +++ b/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/filter.phtml @@ -13,25 +13,27 @@ $viewModel = $block->getData('product_layer_view_model'); ?> <ol class="items"> - <?php foreach ($filterItems as $filterItem) :?> + <?php foreach ($filterItems as $filterItem): ?> <li class="item"> - <?php if ($filterItem->getCount() > 0) :?> + <?php if ($filterItem->getCount() > 0): ?> <a href="<?= $block->escapeUrl($filterItem->getUrl()) ?>" rel="nofollow"> <?= /* @noEscape */ $filterItem->getLabel() ?> - <?php if ($viewModel->shouldDisplayProductCountOnLayer()) : ?> - <span class="count"><?= /* @noEscape */ (int)$filterItem->getCount() ?><span class="filter-count-label"> - <?php if ($filterItem->getCount() == 1) : + <?php if ($viewModel->shouldDisplayProductCountOnLayer()): ?> + <span class="count"><?= /* @noEscape */ (int)$filterItem->getCount() ?> + <span class="filter-count-label"> + <?php if ($filterItem->getCount() == 1): ?> <?= $block->escapeHtml(__('item')) ?><?php - else : + else: ?> <?= $block->escapeHtml(__('item')) ?><?php endif;?></span></span> <?php endif; ?> </a> - <?php else :?> + <?php else: ?> <?= /* @noEscape */ $filterItem->getLabel() ?> - <?php if ($viewModel->shouldDisplayProductCountOnLayer()) : ?> - <span class="count"><?= /* @noEscape */ (int)$filterItem->getCount() ?><span class="filter-count-label"> - <?php if ($filterItem->getCount() == 1) : + <?php if ($viewModel->shouldDisplayProductCountOnLayer()): ?> + <span class="count"><?= /* @noEscape */ (int)$filterItem->getCount() ?> + <span class="filter-count-label"> + <?php if ($filterItem->getCount() == 1): ?><?= $block->escapeHtml(__('items')) ?><?php else: ?><?= $block->escapeHtml(__('items')) ?><?php diff --git a/app/code/Magento/Swatches/view/frontend/templates/product/layered/renderer.phtml b/app/code/Magento/Swatches/view/frontend/templates/product/layered/renderer.phtml index 5623da147130c..7cb9b06713ef2 100644 --- a/app/code/Magento/Swatches/view/frontend/templates/product/layered/renderer.phtml +++ b/app/code/Magento/Swatches/view/frontend/templates/product/layered/renderer.phtml @@ -14,11 +14,11 @@ attribute-code="<?= $block->escapeHtmlAttr($swatchData['attribute_code']) ?>" attribute-id="<?= $block->escapeHtmlAttr($swatchData['attribute_id']) ?>"> <div class="swatch-attribute-options clearfix"> - <?php foreach ($swatchData['options'] as $option => $label) :?> + <?php foreach ($swatchData['options'] as $option => $label): ?> <a href="<?= $block->escapeUrl($label['link']) ?>" rel="nofollow" aria-label="<?= $block->escapeHtmlAttr($label['label']) ?>" class="swatch-option-link-layered"> - <?php if (isset($swatchData['swatches'][$option]['type'])) :?> + <?php if (isset($swatchData['swatches'][$option]['type'])): ?> <?php switch ($swatchData['swatches'][$option]['type']) { case '3': ?> @@ -34,14 +34,14 @@ case '2': ?> <?php $swatchThumbPath = $block->getSwatchPath( - 'swatch_thumb', - $swatchData['swatches'][$option]['value'] - ); ?> + 'swatch_thumb', + $swatchData['swatches'][$option]['value'] + ); ?> <?php $swatchImagePath = $block->getSwatchPath( - 'swatch_image', - $swatchData['swatches'][$option]['value'] + 'swatch_image', + $swatchData['swatches'][$option]['value'] ); - $escapedUrl = $block->escapeUrl($swatchImagePath); + $escapedUrl = $block->escapeUrl($swatchImagePath); ?> <div class="swatch-option image <?= $block->escapeHtmlAttr($label['custom_style']) ?>" tabindex="-1" @@ -50,8 +50,8 @@ option-label="<?= $block->escapeHtmlAttr($label['label']) ?>" option-tooltip-thumb="<?= $block->escapeUrl($swatchThumbPath) ?>" option-tooltip-value="" - style="background: url(<?= - $escapedUrl + style="background: url(<?= + /* @noEscape */ $escapedUrl ?>) no-repeat center; background-size: initial;"> </div> <?php break; @@ -64,11 +64,11 @@ option-label="<?= $block->escapeHtmlAttr($label['label']) ?>" option-tooltip-thumb="" option-tooltip-value="<?= $block->escapeHtmlAttr( - $swatchData['swatches'][$option]['value'] - ) ?>" + $swatchData['swatches'][$option]['value'] + ) ?>" style="background: <?= $block->escapeHtmlAttr( - $swatchData['swatches'][$option]['value'] - ) ?> no-repeat center; background-size: initial;"></div> + $swatchData['swatches'][$option]['value'] + ) ?> no-repeat center; background-size: initial;"></div> <?php break; case '0': default: From 61bc535bc277a340fd43bf9722c331b2a08f5712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bajsarowicz?= <lukasz.bajsarowicz@gmail.com> Date: Thu, 23 Jan 2020 13:27:19 +0100 Subject: [PATCH 0966/1143] Fix: Static tests --- .../Magento/Framework/Autoload/AutoloaderRegistry.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/internal/Magento/Framework/Autoload/AutoloaderRegistry.php b/lib/internal/Magento/Framework/Autoload/AutoloaderRegistry.php index 7a7e3501f89bd..037d8c2181dbf 100644 --- a/lib/internal/Magento/Framework/Autoload/AutoloaderRegistry.php +++ b/lib/internal/Magento/Framework/Autoload/AutoloaderRegistry.php @@ -5,6 +5,7 @@ */ namespace Magento\Framework\Autoload; +use InvalidArgumentException; use Magento\Framework\Autoload\AutoloaderInterface; /** @@ -23,7 +24,7 @@ class AutoloaderRegistry * @param AutoloaderInterface $newAutoloader * @return void */ - public static function registerAutoloader(AutoloaderInterface $newAutoloader) + public static function registerAutoloader(AutoloaderInterface $newAutoloader): void { self::$autoloader = $newAutoloader; } @@ -31,13 +32,13 @@ public static function registerAutoloader(AutoloaderInterface $newAutoloader) /** * Returns the registered autoloader * - * @throws \Exception + * @throws InvalidArgumentException * @return AutoloaderInterface */ public static function getAutoloader(): AutoloaderInterface { if (!self::$autoloader instanceof AutoloaderInterface) { - throw new \Exception('Autoloader is not registered, cannot be retrieved.'); + throw new InvalidArgumentException('Autoloader is not registered, cannot be retrieved.'); } return self::$autoloader; From d93fe31aa16a297c28dcba4c5f8ad906475e08f2 Mon Sep 17 00:00:00 2001 From: Deepak S Nair <deepak.nair@ranosys.com> Date: Thu, 23 Jan 2020 18:14:33 +0530 Subject: [PATCH 0967/1143] fix #25761 - resolved feedbacks --- .../Model/ItemProvider/StoreUrlConfigReader.php | 4 ++-- .../Test/Unit/Model/ItemProvider/StoreUrlTest.php | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Sitemap/Model/ItemProvider/StoreUrlConfigReader.php b/app/code/Magento/Sitemap/Model/ItemProvider/StoreUrlConfigReader.php index 9a33028d77c76..782863e79ea4d 100644 --- a/app/code/Magento/Sitemap/Model/ItemProvider/StoreUrlConfigReader.php +++ b/app/code/Magento/Sitemap/Model/ItemProvider/StoreUrlConfigReader.php @@ -36,7 +36,7 @@ public function __construct(ScopeConfigInterface $scopeConfig) } /** - * {@inheritdoc} + * @inheritdoc */ public function getPriority($storeId) { @@ -48,7 +48,7 @@ public function getPriority($storeId) } /** - * {@inheritdoc} + * @inheritdoc */ public function getChangeFrequency($storeId) { diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/ItemProvider/StoreUrlTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/ItemProvider/StoreUrlTest.php index 62b30aa176bf1..e18a54889a1b2 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/ItemProvider/StoreUrlTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/ItemProvider/StoreUrlTest.php @@ -11,8 +11,10 @@ use Magento\Sitemap\Model\ItemProvider\StoreUrl as StoreUrlItemResolver; use Magento\Sitemap\Model\SitemapItem; use Magento\Sitemap\Model\SitemapItemInterfaceFactory; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; -class StoreUrlTest extends \PHPUnit\Framework\TestCase +class StoreUrlTest extends TestCase { /** * test for getItems method @@ -24,7 +26,7 @@ public function testGetItems() $resolver = new StoreUrlItemResolver($configReaderMock, $itemFactoryMock); $items = $resolver->getItems(1); - $this->assertTrue(count($items) == 1); + $this->assertCount(1, $items); foreach ($items as $item) { $this->assertSame('daily', $item->getChangeFrequency()); $this->assertSame('1.0', $item->getPriority()); @@ -32,7 +34,7 @@ public function testGetItems() } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return SitemapItemInterfaceFactory|MockObject */ private function getItemFactoryMock() { @@ -53,7 +55,7 @@ private function getItemFactoryMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return ConfigReaderInterface|MockObject */ private function getConfigReaderMock() { From 256a84517c8de179c1d9cf4d74e724d256f40a5a Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Thu, 23 Jan 2020 15:22:43 +0200 Subject: [PATCH 0968/1143] Add missing view model --- .../view/frontend/layout/catalogsearch_result_index.xml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/LayeredNavigation/view/frontend/layout/catalogsearch_result_index.xml b/app/code/Magento/LayeredNavigation/view/frontend/layout/catalogsearch_result_index.xml index 3bb21ed09a01c..28006ca70e07b 100644 --- a/app/code/Magento/LayeredNavigation/view/frontend/layout/catalogsearch_result_index.xml +++ b/app/code/Magento/LayeredNavigation/view/frontend/layout/catalogsearch_result_index.xml @@ -11,7 +11,11 @@ <referenceContainer name="sidebar.main"> <block class="Magento\LayeredNavigation\Block\Navigation\Search" name="catalogsearch.leftnav" before="-" template="Magento_LayeredNavigation::layer/view.phtml"> <block class="Magento\LayeredNavigation\Block\Navigation\State" name="catalogsearch.navigation.state" as="state" /> - <block class="Magento\LayeredNavigation\Block\Navigation\FilterRenderer" name="catalogsearch.navigation.renderer" as="renderer" template="Magento_LayeredNavigation::layer/filter.phtml"/> + <block class="Magento\LayeredNavigation\Block\Navigation\FilterRenderer" name="catalogsearch.navigation.renderer" as="renderer" template="Magento_LayeredNavigation::layer/filter.phtml"> + <arguments> + <argument name="product_layer_view_model" xsi:type="object">Magento\LayeredNavigation\ViewModel\Layer\Filter</argument> + </arguments> + </block> </block> </referenceContainer> </body> From f29159f075d136b411693af2be73f76a4a4a413a Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Thu, 23 Jan 2020 15:31:34 +0200 Subject: [PATCH 0969/1143] MC-30498: Cannot place an order using PayPal through Braintree using sample data customer --- .../view/frontend/web/js/view/payment/method-renderer/paypal.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/paypal.js b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/paypal.js index ea5200e4ba51f..c0ad38173c52d 100644 --- a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/paypal.js +++ b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/paypal.js @@ -269,6 +269,7 @@ define([ */ onError: function () { self.showError($t('Payment ' + self.getTitle() + ' can\'t be initialized')); + self.reInitPayPal(); } }, self.paypalButtonSelector); }, From 63682a05b94d2475ed26c0002d29bd4d9f792b31 Mon Sep 17 00:00:00 2001 From: engcom-Echo <engcom-vendorworker-echo@adobe.com> Date: Thu, 23 Jan 2020 16:07:46 +0200 Subject: [PATCH 0970/1143] Fix test with willReturnMap --- .../Unit/Controller/Store/RedirectTest.php | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) mode change 100644 => 100755 app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php diff --git a/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php b/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php old mode 100644 new mode 100755 index 1136194fc322a..ff550b912a86f --- a/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php +++ b/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php @@ -146,20 +146,14 @@ protected function setUp() public function testRedirect(string $defaultStoreViewCode, string $storeCode): void { $this->requestMock - ->expects($this->at(0)) - ->method('getParam') - ->with(StoreResolver::PARAM_NAME) - ->willReturn($storeCode); - $this->requestMock - ->expects($this->at(1)) - ->method('getParam') - ->with('___from_store') - ->willReturn($defaultStoreViewCode); - $this->requestMock - ->expects($this->at(2)) - ->method('getParam') - ->with(ActionInterface::PARAM_NAME_URL_ENCODED) - ->willReturn($defaultStoreViewCode); + ->expects($this->any()) + ->method('getParam')->willReturnMap( + [ + [StoreResolver::PARAM_NAME, null, $storeCode], + ['___from_store', null, $defaultStoreViewCode], + [ActionInterface::PARAM_NAME_URL_ENCODED, null, $defaultStoreViewCode] + ] + ); $this->storeRepositoryMock ->expects($this->once()) ->method('get') From 3e2d9fcc4e7bd7331e6ad1f5b0c56807886a923f Mon Sep 17 00:00:00 2001 From: Michele Fantetti <mfantetti@ittweb.net> Date: Thu, 23 Jan 2020 15:18:26 +0100 Subject: [PATCH 0971/1143] Add frontend template hints status command after suggestions --- .../Command/TemplateHintsStatusCommand.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php b/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php index 98719784a03c4..5905f951aa2a1 100644 --- a/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php +++ b/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Developer\Console\Command; @@ -10,6 +11,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\App\Config\ReinitableConfigInterface; use Magento\Framework\Console\Cli; /** @@ -19,21 +21,31 @@ class TemplateHintsStatusCommand extends Command { const COMMAND_NAME = 'dev:template-hints:status'; + const TEMPLATE_HINTS_STOREFRONT_PATH = 'dev/debug/template_hints_storefront'; /** * @var ScopeConfigInterface */ private $scopeConfig; + /** + * @var ReinitableConfigInterface + */ + private $reinitableConfig; /** * Initialize dependencies. * * @param ScopeConfigInterface $scopeConfig + * @param ReinitableConfigInterface $reinitableConfig */ - public function __construct(ScopeConfigInterface $scopeConfig) + public function __construct( + ScopeConfigInterface $scopeConfig, + ReinitableConfigInterface $reinitableConfig + ) { parent::__construct(); $this->scopeConfig = $scopeConfig; + $this->reinitableConfig = $reinitableConfig; } /** @@ -53,6 +65,7 @@ protected function configure() */ protected function execute(InputInterface $input, OutputInterface $output) { + $this->reinitableConfig->reinit(); $templateHintsStatus = ($this->isTemplateHintsEnabled()) ? 'enabled' @@ -66,8 +79,8 @@ protected function execute(InputInterface $input, OutputInterface $output) /** * @return bool */ - private function isTemplateHintsEnabled() + private function isTemplateHintsEnabled(): bool { - return ($this->scopeConfig->isSetFlag('dev/debug/template_hints_storefront', 'default')); + return $this->scopeConfig->isSetFlag(self::TEMPLATE_HINTS_STOREFRONT_PATH, 'default'); } } From a9f7252907c6359572cba944a09f3a32e33751e7 Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Thu, 23 Jan 2020 16:30:33 +0200 Subject: [PATCH 0972/1143] MC-24170: Fix Skipped MFTF Tests From MC-17140: MC-13493, MC-14062, MC-14063 --- .../Catalog/Test/Mftf/Test/AdminMoveAnchoredCategoryTest.xml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveAnchoredCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveAnchoredCategoryTest.xml index 551b3437cb856..60a6c14ddce4e 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveAnchoredCategoryTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveAnchoredCategoryTest.xml @@ -16,6 +16,9 @@ <severity value="CRITICAL"/> <testCaseId value="MAGETWO-76273"/> <group value="category"/> + <skip> + <issueId value="MC-30720"/> + </skip> </annotations> <before> <createData entity="SimpleSubCategory" stepKey="simpleSubCategoryOne"/> @@ -119,4 +122,4 @@ <see selector="{{StorefrontNavigationSection.breadcrumbs}}" userInput="$$simpleSubCategoryOne.name$$" stepKey="seeSubCategoryWithParentInBreadcrumbsOnSubCategoryWithParent3"/> <see selector="{{StorefrontNavigationSection.breadcrumbs}}" userInput="$$productOne.name$$" stepKey="seeProductInBreadcrumbsOnSubCategoryOne3"/> </test> -</tests> \ No newline at end of file +</tests> From a009b97d2b81f18b011b3d85ad8329c9d9f8d4f4 Mon Sep 17 00:00:00 2001 From: Fred Orosko Dias <fred@absoluteweb.com> Date: Thu, 23 Jan 2020 11:04:16 -0500 Subject: [PATCH 0973/1143] Extend exception message --- app/code/Magento/Analytics/Model/Connector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Analytics/Model/Connector.php b/app/code/Magento/Analytics/Model/Connector.php index 23b0ffa213b6e..c48f7f6b41946 100644 --- a/app/code/Magento/Analytics/Model/Connector.php +++ b/app/code/Magento/Analytics/Model/Connector.php @@ -53,7 +53,7 @@ public function __construct( public function execute($commandName) { if (!array_key_exists($commandName, $this->commands)) { - throw new NotFoundException(__('Command was not found.')); + throw new NotFoundException(__('Command "%1" was not found.', $commandName)); } /** @var \Magento\Analytics\Model\Connector\CommandInterface $command */ From 6574e7dac97442ef0ad0b1fc0364e70141cb1a3b Mon Sep 17 00:00:00 2001 From: Dave Macaulay <macaulay@adobe.com> Date: Thu, 23 Jan 2020 10:08:29 -0600 Subject: [PATCH 0974/1143] MC-30727: Modal slide out will have title set incorrectly when dynamically set --- app/code/Magento/Ui/view/base/web/js/modal/modal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 bcbb2f3c31dbd..f5c284165d8d2 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 @@ -192,7 +192,7 @@ define([ * @param {String} title */ setTitle: function (title) { - var $title = $(this.options.modalTitle), + var $title = this.modal.find(this.options.modalTitle), $subTitle = this.modal.find(this.options.modalSubTitle); $title.text(title); From ad4ba2e047a7262546fb60a93eb012ac4757559a Mon Sep 17 00:00:00 2001 From: Fred Orosko Dias <fred@absoluteweb.com> Date: Thu, 23 Jan 2020 11:09:18 -0500 Subject: [PATCH 0975/1143] Extend exception message --- .../Magento/Multishipping/Model/Checkout/Type/Multishipping.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php index 7fa674505461e..49212202b5f62 100644 --- a/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php +++ b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php @@ -1262,7 +1262,7 @@ private function searchQuoteAddressId(OrderInterface $order, array $addresses): } } - throw new NotFoundException(__('Quote address for failed order not found.')); + throw new NotFoundException(__('Quote address for failed order ID "%1" not found.', $order->getEntityId())); } /** From ddc02f814f05dc56b657f07c39680f5f6aec975d Mon Sep 17 00:00:00 2001 From: Fred Orosko Dias <fred@absoluteweb.com> Date: Thu, 23 Jan 2020 11:23:20 -0500 Subject: [PATCH 0976/1143] Update PHP Docs --- .../Magento/Store/Model/Config/Importer/Processor/Create.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Store/Model/Config/Importer/Processor/Create.php b/app/code/Magento/Store/Model/Config/Importer/Processor/Create.php index 1fb9f1c224d3e..317e4bf43e42c 100644 --- a/app/code/Magento/Store/Model/Config/Importer/Processor/Create.php +++ b/app/code/Magento/Store/Model/Config/Importer/Processor/Create.php @@ -160,6 +160,7 @@ private function createWebsites(array $items, array $data) * @param array $items Groups to create * @param array $data The all available data * @return void + * @throws NotFoundException */ private function createGroups(array $items, array $data) { @@ -199,6 +200,7 @@ private function createGroups(array $items, array $data) * @param array $items Stores to create * @param array $data The all available data * @return void + * @throws NotFoundException */ private function createStores(array $items, array $data) { From c08ccac74c67a44c9d47811a49fb48a37e8a76fc Mon Sep 17 00:00:00 2001 From: Oleksandr Miroshnichenko <omiroshnichenko@magento.com> Date: Thu, 23 Jan 2020 14:11:54 -0600 Subject: [PATCH 0977/1143] MC-30737: Stock sorting doesn't work with table prefix --- app/code/Magento/CatalogInventory/Model/Source/Stock.php | 2 +- .../CatalogInventory/Test/Unit/Model/Source/StockTest.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/CatalogInventory/Model/Source/Stock.php b/app/code/Magento/CatalogInventory/Model/Source/Stock.php index 7d44ab782de61..9661fc83ce275 100644 --- a/app/code/Magento/CatalogInventory/Model/Source/Stock.php +++ b/app/code/Magento/CatalogInventory/Model/Source/Stock.php @@ -42,7 +42,7 @@ public function getAllOptions() public function addValueSortToCollection($collection, $dir = \Magento\Framework\Data\Collection::SORT_ORDER_DESC) { $collection->getSelect()->joinLeft( - ['stock_item_table' => 'cataloginventory_stock_item'], + ['stock_item_table' => $collection->getTable('cataloginventory_stock_item')], "e.entity_id=stock_item_table.product_id", [] ); diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Model/Source/StockTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Model/Source/StockTest.php index 11f41fcaf6d01..1c81e17358e71 100644 --- a/app/code/Magento/CatalogInventory/Test/Unit/Model/Source/StockTest.php +++ b/app/code/Magento/CatalogInventory/Test/Unit/Model/Source/StockTest.php @@ -25,6 +25,7 @@ public function testAddValueSortToCollection() $selectMock = $this->createMock(\Magento\Framework\DB\Select::class); $collectionMock = $this->createMock(\Magento\Eav\Model\Entity\Collection\AbstractCollection::class); $collectionMock->expects($this->atLeastOnce())->method('getSelect')->willReturn($selectMock); + $collectionMock->expects($this->atLeastOnce())->method('getTable')->willReturn('cataloginventory_stock_item'); $selectMock->expects($this->once()) ->method('joinLeft') From 69e05c0193464f26b4e6a4deb285b8c77456b6f4 Mon Sep 17 00:00:00 2001 From: Fred Orosko Dias <fred@absoluteweb.com> Date: Thu, 23 Jan 2020 16:23:14 -0500 Subject: [PATCH 0978/1143] Update translation file --- app/code/Magento/Analytics/i18n/en_US.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Analytics/i18n/en_US.csv b/app/code/Magento/Analytics/i18n/en_US.csv index 4faa48fb73709..9e86e8ce072c5 100644 --- a/app/code/Magento/Analytics/i18n/en_US.csv +++ b/app/code/Magento/Analytics/i18n/en_US.csv @@ -7,7 +7,7 @@ "There was an error save new configuration value.","There was an error save new configuration value." "Please select an industry.","Please select an industry." "--Please Select--","--Please Select--" -"Command was not found.","Command was not found." +"Command "%1" was not found.","Command "%1" was not found." "Input data must be string or convertible into string.","Input data must be string or convertible into string." "Input data must be non-empty string.","Input data must be non-empty string." "Not valid cipher method.","Not valid cipher method." From 3a7e6c11b24ecbcb53b58fd4f99bcf1e95944308 Mon Sep 17 00:00:00 2001 From: Oleksandr Dubovyk <odubovyk@magento.com> Date: Thu, 23 Jan 2020 15:51:30 -0600 Subject: [PATCH 0979/1143] MC-30255: In Stock Alert Email Shows Incorrect Item Pricing --- .../Indexer/LinkedProductSelectBuilderByIndexPrice.php | 4 ++-- .../Product/LinkedProductSelectBuilderByBasePrice.php | 4 ++-- .../Product/LinkedProductSelectBuilderBySpecialPrice.php | 6 +++--- .../Product/LinkedProductSelectBuilderByTierPrice.php | 4 ++-- .../Product/LinkedProductSelectBuilderComposite.php | 4 ++-- .../Product/LinkedProductSelectBuilderInterface.php | 3 ++- .../LinkedProductSelectBuilderByCatalogRulePrice.php | 6 +++--- .../ResourceModel/Product/LinkedProductSelectBuilder.php | 4 ++-- .../Pricing/Price/LowestPriceOptionsProvider.php | 6 ++++-- .../Product/LinkedProductSelectBuilderTest.php | 3 ++- .../Unit/Pricing/Price/LowestPriceOptionsProviderTest.php | 6 ++++-- app/code/Magento/ProductAlert/Model/Observer.php | 2 +- 12 files changed, 29 insertions(+), 23 deletions(-) diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/LinkedProductSelectBuilderByIndexPrice.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/LinkedProductSelectBuilderByIndexPrice.php index ebe04fb63b217..81c80ea37e006 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/LinkedProductSelectBuilderByIndexPrice.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/LinkedProductSelectBuilderByIndexPrice.php @@ -85,11 +85,11 @@ public function __construct( /** * {@inheritdoc} */ - public function build($productId) + public function build(int $productId, int $storeId) : array { $linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField(); $productTable = $this->resource->getTableName('catalog_product_entity'); - $websiteId = $this->storeManager->getStore()->getWebsiteId(); + $websiteId = $this->storeManager->getStore($storeId)->getWebsiteId(); $customerGroupId = $this->customerSession->getCustomerGroupId(); $priceSelect = $this->resource->getConnection()->select() diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderByBasePrice.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderByBasePrice.php index 841fe17bdcf05..77e886f12723c 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderByBasePrice.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderByBasePrice.php @@ -74,7 +74,7 @@ public function __construct( /** * @inheritdoc */ - public function build($productId) + public function build(int $productId, int $storeId) : array { $linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField(); $priceAttribute = $this->eavConfig->getAttribute(Product::ENTITY, 'price'); @@ -104,7 +104,7 @@ public function build($productId) if (!$this->catalogHelper->isPriceGlobal()) { $priceSelectStore = clone $priceSelect; - $priceSelectStore->where('t.store_id = ?', $this->storeManager->getStore()->getId()); + $priceSelectStore->where('t.store_id = ?', $storeId); $selects[] = $priceSelectStore; } diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderBySpecialPrice.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderBySpecialPrice.php index 5c47185a85bf4..effac86bb4571 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderBySpecialPrice.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderBySpecialPrice.php @@ -90,14 +90,14 @@ public function __construct( /** * {@inheritdoc} */ - public function build($productId) + public function build(int $productId, int $storeId) : array { $linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField(); $connection = $this->resource->getConnection(); $specialPriceAttribute = $this->eavConfig->getAttribute(Product::ENTITY, 'special_price'); $specialPriceFromDate = $this->eavConfig->getAttribute(Product::ENTITY, 'special_from_date'); $specialPriceToDate = $this->eavConfig->getAttribute(Product::ENTITY, 'special_to_date'); - $timestamp = $this->localeDate->scopeTimeStamp($this->storeManager->getStore()); + $timestamp = $this->localeDate->scopeTimeStamp($this->storeManager->getStore($storeId)); $currentDate = $this->dateTime->formatDate($timestamp, false); $productTable = $this->resource->getTableName('catalog_product_entity'); @@ -145,7 +145,7 @@ public function build($productId) if (!$this->catalogHelper->isPriceGlobal()) { $priceSelectStore = clone $specialPrice; - $priceSelectStore->where('t.store_id = ?', $this->storeManager->getStore()->getId()); + $priceSelectStore->where('t.store_id = ?', $storeId); $selects[] = $priceSelectStore; } diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderByTierPrice.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderByTierPrice.php index 37281193d6a1b..44322f65c04d0 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderByTierPrice.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderByTierPrice.php @@ -74,7 +74,7 @@ public function __construct( /** * {@inheritdoc} */ - public function build($productId) + public function build(int $productId, int $storeId) : array { $linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField(); $productTable = $this->resource->getTableName('catalog_product_entity'); @@ -103,7 +103,7 @@ public function build($productId) if (!$this->catalogHelper->isPriceGlobal()) { $priceSelectStore = clone $priceSelect; - $priceSelectStore->where('t.website_id = ?', $this->storeManager->getStore()->getWebsiteId()); + $priceSelectStore->where('t.website_id = ?', $this->storeManager->getStore($storeId)->getWebsiteId()); $selects[] = $priceSelectStore; } diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderComposite.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderComposite.php index 5782834c06d85..4baf8ff5d2c2f 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderComposite.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderComposite.php @@ -24,11 +24,11 @@ public function __construct($linkedProductSelectBuilder) /** * {@inheritdoc} */ - public function build($productId) + public function build(int $productId, int $storeId) : array { $selects = []; foreach ($this->linkedProductSelectBuilder as $productSelectBuilder) { - $selects = array_merge($selects, $productSelectBuilder->build($productId)); + $selects = array_merge($selects, $productSelectBuilder->build($productId, $storeId)); } return $selects; diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderInterface.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderInterface.php index 3b870ed61f36d..29676f5ac59e4 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderInterface.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderInterface.php @@ -12,7 +12,8 @@ interface LinkedProductSelectBuilderInterface { /** * @param int $productId + * @param int $storeId * @return \Magento\Framework\DB\Select[] */ - public function build($productId); + public function build(int $productId, int $storeId) : array; } diff --git a/app/code/Magento/CatalogRule/Model/ResourceModel/Product/LinkedProductSelectBuilderByCatalogRulePrice.php b/app/code/Magento/CatalogRule/Model/ResourceModel/Product/LinkedProductSelectBuilderByCatalogRulePrice.php index 48c463fc18b80..aaafc4ecd4c5d 100644 --- a/app/code/Magento/CatalogRule/Model/ResourceModel/Product/LinkedProductSelectBuilderByCatalogRulePrice.php +++ b/app/code/Magento/CatalogRule/Model/ResourceModel/Product/LinkedProductSelectBuilderByCatalogRulePrice.php @@ -86,9 +86,9 @@ public function __construct( /** * @inheritdoc */ - public function build($productId) + public function build(int $productId, int $storeId) : array { - $timestamp = $this->localeDate->scopeTimeStamp($this->storeManager->getStore()); + $timestamp = $this->localeDate->scopeTimeStamp($this->storeManager->getStore($storeId)); $currentDate = $this->dateTime->formatDate($timestamp, false); $linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField(); $productTable = $this->resource->getTableName('catalog_product_entity'); @@ -108,7 +108,7 @@ public function build($productId) sprintf('t.product_id = %s.%s', BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS, $linkField), [] )->where('parent.entity_id = ?', $productId) - ->where('t.website_id = ?', $this->storeManager->getStore()->getWebsiteId()) + ->where('t.website_id = ?', $this->storeManager->getStore($storeId)->getWebsiteId()) ->where('t.customer_group_id = ?', $this->customerSession->getCustomerGroupId()) ->where('t.rule_date = ?', $currentDate) ->order('t.rule_price ' . Select::SQL_ASC) diff --git a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/LinkedProductSelectBuilder.php b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/LinkedProductSelectBuilder.php index 3f1c22548c8d8..fa156fe9e6329 100644 --- a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/LinkedProductSelectBuilder.php +++ b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/LinkedProductSelectBuilder.php @@ -41,9 +41,9 @@ public function __construct( /** * {@inheritdoc} */ - public function build($productId) + public function build(int $productId, int $storeId) : array { - $selects = $this->linkedProductSelectBuilder->build($productId); + $selects = $this->linkedProductSelectBuilder->build($productId, $storeId); foreach ($selects as $select) { $this->baseSelectProcessor->process($select); diff --git a/app/code/Magento/ConfigurableProduct/Pricing/Price/LowestPriceOptionsProvider.php b/app/code/Magento/ConfigurableProduct/Pricing/Price/LowestPriceOptionsProvider.php index d3ce508b31e0d..fa620d88185b5 100644 --- a/app/code/Magento/ConfigurableProduct/Pricing/Price/LowestPriceOptionsProvider.php +++ b/app/code/Magento/ConfigurableProduct/Pricing/Price/LowestPriceOptionsProvider.php @@ -66,10 +66,12 @@ public function __construct( */ public function getProducts(ProductInterface $product) { - $key = $this->storeManager->getStore()->getId() . '-' . $product->getId(); + $productId = $product->getId(); + $storeId = $product->getStoreId(); + $key = $storeId . '-' . $productId; if (!isset($this->linkedProductMap[$key])) { $productIds = $this->resource->getConnection()->fetchCol( - '(' . implode(') UNION (', $this->linkedProductSelectBuilder->build($product->getId())) . ')' + '(' . implode(') UNION (', $this->linkedProductSelectBuilder->build($productId, $storeId)) . ')' ); $this->linkedProductMap[$key] = $this->collectionFactory->create() diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/ResourceModel/Product/LinkedProductSelectBuilderTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/ResourceModel/Product/LinkedProductSelectBuilderTest.php index 3ef03f32ae05d..0794ba2cb42bf 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/ResourceModel/Product/LinkedProductSelectBuilderTest.php +++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/ResourceModel/Product/LinkedProductSelectBuilderTest.php @@ -50,6 +50,7 @@ protected function setUp() public function testBuild() { $productId = 42; + $storeId = 1; /** @var Select|\PHPUnit_Framework_MockObject_MockObject $selectMock */ $selectMock = $this->getMockBuilder(Select::class) @@ -67,6 +68,6 @@ public function testBuild() ->method('process') ->with($selectMock); - $this->assertEquals($expectedResult, $this->subject->build($productId)); + $this->assertEquals($expectedResult, $this->subject->build($productId, $storeId)); } } diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Pricing/Price/LowestPriceOptionsProviderTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Pricing/Price/LowestPriceOptionsProviderTest.php index 7c83645a9fda3..29f48dbe7a460 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Unit/Pricing/Price/LowestPriceOptionsProviderTest.php +++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Pricing/Price/LowestPriceOptionsProviderTest.php @@ -6,8 +6,8 @@ namespace Magento\ConfigurableProduct\Test\Unit\Pricing\Price; +use Magento\Catalog\Model\Product; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; -use Magento\Catalog\Api\Data\ProductInterface; use Magento\Catalog\Model\ResourceModel\Product\LinkedProductSelectBuilderInterface; use Magento\Store\Model\StoreManagerInterface; use Magento\Store\Api\Data\StoreInterface; @@ -102,9 +102,11 @@ protected function setUp() public function testGetProducts() { $productId = 1; + $storeId = 1; $linkedProducts = ['some', 'linked', 'products', 'dataobjects']; - $product = $this->getMockBuilder(ProductInterface::class)->disableOriginalConstructor()->getMock(); + $product = $this->createMock(Product::class); $product->expects($this->any())->method('getId')->willReturn($productId); + $product->expects($this->any())->method('getStoreId')->willReturn($storeId); $this->linkedProductSelectBuilder->expects($this->any())->method('build')->with($productId)->willReturn([]); $this->productCollection ->expects($this->once()) diff --git a/app/code/Magento/ProductAlert/Model/Observer.php b/app/code/Magento/ProductAlert/Model/Observer.php index 953218d3ea205..d0d26a55eb5f7 100644 --- a/app/code/Magento/ProductAlert/Model/Observer.php +++ b/app/code/Magento/ProductAlert/Model/Observer.php @@ -193,6 +193,7 @@ protected function _getWebsites() protected function _processPrice(\Magento\ProductAlert\Model\Email $email) { $email->setType('price'); + echo('price '); foreach ($this->_getWebsites() as $website) { /* @var $website \Magento\Store\Model\Website */ if (!$website->getDefaultGroup() || !$website->getDefaultGroup()->getDefaultStore()) { @@ -242,7 +243,6 @@ protected function _processPrice(\Magento\ProductAlert\Model\Email $email) ); $product->setCustomerGroupId($customer->getGroupId()); - $this->_storeManager->getStore()->setWebsiteId($website->getId()); if ($alert->getPrice() > $product->getFinalPrice()) { $productPrice = $product->getFinalPrice(); $product->setFinalPrice($this->_catalogData->getTaxPrice($product, $productPrice)); From 6180e23debd89322d7305438825368f30273b455 Mon Sep 17 00:00:00 2001 From: Oleksandr Dubovyk <odubovyk@magento.com> Date: Thu, 23 Jan 2020 17:51:39 -0600 Subject: [PATCH 0980/1143] MC-30255: In Stock Alert Email Shows Incorrect Item Pricing - static --- .../LinkedProductSelectBuilderByIndexPrice.php | 9 ++++++++- .../LinkedProductSelectBuilderBySpecialPrice.php | 6 +++++- .../Product/LinkedProductSelectBuilderByTierPrice.php | 11 ++++++++++- .../Product/LinkedProductSelectBuilderComposite.php | 8 ++++++-- .../Product/LinkedProductSelectBuilderInterface.php | 2 ++ .../LinkedProductSelectBuilderByIndexPriceTest.php | 3 ++- .../Product/LinkedProductSelectBuilder.php | 2 +- .../Pricing/Price/LowestPriceOptionsProvider.php | 2 +- app/code/Magento/ProductAlert/Model/Observer.php | 1 - 9 files changed, 35 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/LinkedProductSelectBuilderByIndexPrice.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/LinkedProductSelectBuilderByIndexPrice.php index 81c80ea37e006..f477c11896688 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/LinkedProductSelectBuilderByIndexPrice.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/LinkedProductSelectBuilderByIndexPrice.php @@ -15,6 +15,13 @@ use Magento\Store\Model\Indexer\WebsiteDimensionProvider; use Magento\Framework\Search\Request\IndexScopeResolverInterface; +/** + * Class LinkedProductSelectBuilderByIndexPrice + * + * Provide Select object for retrieve product id by index price. + * + * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) + */ class LinkedProductSelectBuilderByIndexPrice implements LinkedProductSelectBuilderInterface { /** @@ -83,7 +90,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ public function build(int $productId, int $storeId) : array { diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderBySpecialPrice.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderBySpecialPrice.php index effac86bb4571..ef0eeca10502a 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderBySpecialPrice.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderBySpecialPrice.php @@ -12,6 +12,10 @@ use Magento\Store\Model\Store; /** + * LinkedProductSelectBuilderBySpecialPrice + * + * Provide Select object for retrieve product id by special price + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class LinkedProductSelectBuilderBySpecialPrice implements LinkedProductSelectBuilderInterface @@ -88,7 +92,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ public function build(int $productId, int $storeId) : array { diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderByTierPrice.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderByTierPrice.php index 44322f65c04d0..f104f92ea86c5 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderByTierPrice.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderByTierPrice.php @@ -9,10 +9,19 @@ use Magento\Framework\App\ObjectManager; use Magento\Framework\DB\Select; +/** + * LinkedProductSelectBuilderByTierPrice + * + * Provide Select object for retrieve product id by tier price + * + * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) + */ class LinkedProductSelectBuilderByTierPrice implements LinkedProductSelectBuilderInterface { /** * Default website id + * + * Constant represents default website id */ const DEFAULT_WEBSITE_ID = 0; @@ -72,7 +81,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ public function build(int $productId, int $storeId) : array { diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderComposite.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderComposite.php index 4baf8ff5d2c2f..17ca389777c5b 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderComposite.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderComposite.php @@ -6,6 +6,9 @@ namespace Magento\Catalog\Model\ResourceModel\Product; +/** + * Collect Select object for list of products + */ class LinkedProductSelectBuilderComposite implements LinkedProductSelectBuilderInterface { /** @@ -22,14 +25,15 @@ public function __construct($linkedProductSelectBuilder) } /** - * {@inheritdoc} + * @inheritdoc */ public function build(int $productId, int $storeId) : array { $selects = []; foreach ($this->linkedProductSelectBuilder as $productSelectBuilder) { - $selects = array_merge($selects, $productSelectBuilder->build($productId, $storeId)); + $selects[] = $productSelectBuilder->build($productId, $storeId); } + $selects = array_merge(...$selects); return $selects; } diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderInterface.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderInterface.php index 29676f5ac59e4..3411c124bf5ce 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderInterface.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderInterface.php @@ -11,6 +11,8 @@ interface LinkedProductSelectBuilderInterface { /** + * Build Select objects + * * @param int $productId * @param int $storeId * @return \Magento\Framework\DB\Select[] diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/Indexer/LinkedProductSelectBuilderByIndexPriceTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/Indexer/LinkedProductSelectBuilderByIndexPriceTest.php index 6f3d8e1a84b17..3ca689bda8837 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/Indexer/LinkedProductSelectBuilderByIndexPriceTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/Indexer/LinkedProductSelectBuilderByIndexPriceTest.php @@ -85,6 +85,7 @@ protected function setUp() public function testBuild() { $productId = 10; + $storeId = 1; $metadata = $this->getMockBuilder(\Magento\Framework\EntityManager\EntityMetadataInterface::class) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -108,6 +109,6 @@ public function testBuild() $metadata->expects($this->once())->method('getLinkField')->willReturn('row_id'); $this->resourceMock->expects($this->any())->method('getTableName'); $this->baseSelectProcessorMock->expects($this->once())->method('process')->willReturnSelf(); - $this->model->build($productId); + $this->model->build($productId, $storeId); } } diff --git a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/LinkedProductSelectBuilder.php b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/LinkedProductSelectBuilder.php index fa156fe9e6329..fc5e149c0726e 100644 --- a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/LinkedProductSelectBuilder.php +++ b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/LinkedProductSelectBuilder.php @@ -39,7 +39,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ public function build(int $productId, int $storeId) : array { diff --git a/app/code/Magento/ConfigurableProduct/Pricing/Price/LowestPriceOptionsProvider.php b/app/code/Magento/ConfigurableProduct/Pricing/Price/LowestPriceOptionsProvider.php index fa620d88185b5..11bfecf7e8da1 100644 --- a/app/code/Magento/ConfigurableProduct/Pricing/Price/LowestPriceOptionsProvider.php +++ b/app/code/Magento/ConfigurableProduct/Pricing/Price/LowestPriceOptionsProvider.php @@ -62,7 +62,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ public function getProducts(ProductInterface $product) { diff --git a/app/code/Magento/ProductAlert/Model/Observer.php b/app/code/Magento/ProductAlert/Model/Observer.php index d0d26a55eb5f7..addc61d2f49a9 100644 --- a/app/code/Magento/ProductAlert/Model/Observer.php +++ b/app/code/Magento/ProductAlert/Model/Observer.php @@ -193,7 +193,6 @@ protected function _getWebsites() protected function _processPrice(\Magento\ProductAlert\Model\Email $email) { $email->setType('price'); - echo('price '); foreach ($this->_getWebsites() as $website) { /* @var $website \Magento\Store\Model\Website */ if (!$website->getDefaultGroup() || !$website->getDefaultGroup()->getDefaultStore()) { From 1124cc87a31c6fa3f56c9cb0b5a417d5848627a4 Mon Sep 17 00:00:00 2001 From: Oleksandr Dubovyk <odubovyk@magento.com> Date: Thu, 23 Jan 2020 19:18:00 -0600 Subject: [PATCH 0981/1143] MC-30255: In Stock Alert Email Shows Incorrect Item Pricing - static. undefined property --- ...LinkedProductSelectBuilderByIndexPriceTest.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/Indexer/LinkedProductSelectBuilderByIndexPriceTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/Indexer/LinkedProductSelectBuilderByIndexPriceTest.php index 3ca689bda8837..945c61f44e99c 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/Indexer/LinkedProductSelectBuilderByIndexPriceTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/Indexer/LinkedProductSelectBuilderByIndexPriceTest.php @@ -37,6 +37,21 @@ class LinkedProductSelectBuilderByIndexPriceTest extends \PHPUnit\Framework\Test */ private $baseSelectProcessorMock; + /** + * @var \Magento\Framework\Search\Request\IndexScopeResolverInterface|\PHPUnit\Framework\MockObject\MockObject + */ + private $indexScopeResolverMock; + + /** + * @var \Magento\Framework\Indexer\Dimension|\PHPUnit\Framework\MockObject\MockObject + */ + private $dimensionMock; + + /** + * @var \Magento\Framework\Indexer\DimensionFactory|\PHPUnit\Framework\MockObject\MockObject + */ + private $dimensionFactoryMock; + /** * @var \Magento\Catalog\Model\ResourceModel\Product\Indexer\LinkedProductSelectBuilderByIndexPrice */ From 085e52e00733da7e95bb4420ab5661a264a1737b Mon Sep 17 00:00:00 2001 From: Fred Orosko Dias <fred@absoluteweb.com> Date: Thu, 23 Jan 2020 21:51:32 -0500 Subject: [PATCH 0982/1143] Add translation message --- app/code/Magento/Multishipping/i18n/en_US.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Multishipping/i18n/en_US.csv b/app/code/Magento/Multishipping/i18n/en_US.csv index 43615e697b931..f9ab587c65fa3 100644 --- a/app/code/Magento/Multishipping/i18n/en_US.csv +++ b/app/code/Magento/Multishipping/i18n/en_US.csv @@ -91,3 +91,4 @@ Options,Options "Ship to:","Ship to:" "Error:","Error:" "We are unable to process your request. Please, try again later.","We are unable to process your request. Please, try again later." +"Quote address for failed order ID "%1" not found.","Quote address for failed order ID "%1" not found." From a409774cb18ad48cb0dccf038766e4f8e6cb01ff Mon Sep 17 00:00:00 2001 From: jimuld <37830897+jimuld@users.noreply.github.com> Date: Fri, 24 Jan 2020 10:33:28 +0530 Subject: [PATCH 0983/1143] Update lib/internal/Magento/Framework/HTTP/Adapter/Curl.php Co-Authored-By: Patrick McLain <pat@pmclain.com> --- lib/internal/Magento/Framework/HTTP/Adapter/Curl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php b/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php index df82be8a70e71..067c22564bc45 100644 --- a/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php +++ b/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php @@ -177,7 +177,7 @@ public function write($method, $url, $http_ver = '1.1', $headers = [], $body = ' curl_setopt($this->_getResource(), CURLOPT_HTTPGET, true); curl_setopt($this->_getResource(), CURLOPT_CUSTOMREQUEST, 'GET'); } elseif ($method == \Zend_Http_Client::DELETE) { - curl_setopt($this->_getResource(), CURLOPT_CUSTOMREQUEST, "DELETE"); + curl_setopt($this->_getResource(), CURLOPT_CUSTOMREQUEST, 'DELETE'); curl_setopt($this->_getResource(), CURLOPT_POSTFIELDS, $body); } From 585a7d51dfd2bcef817b0b836fbf579805595df0 Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Fri, 24 Jan 2020 09:38:35 +0200 Subject: [PATCH 0984/1143] MC-25108: MFTF Flakiness because of bad design - StoreFrontMyAccountWithMultishipmentTest --- .../StorefrontOrderWithMultishippingTest.xml | 4 ++-- .../AdminOrderCheckStatusActionGroup.xml | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderCheckStatusActionGroup.xml diff --git a/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontOrderWithMultishippingTest.xml b/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontOrderWithMultishippingTest.xml index dbc1ba980e9c7..ef63d55ccfe35 100644 --- a/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontOrderWithMultishippingTest.xml +++ b/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontOrderWithMultishippingTest.xml @@ -93,14 +93,14 @@ <argument name="orderId" value="{$getFirstOrderIdPlaceOrder}"/> </actionGroup> <!-- Check status --> - <see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="Pending" stepKey="seeFirstOrderPendingStatus"/> + <actionGroup ref="AdminOrderViewCheckStatusActionGroup" stepKey="seeFirstOrderPendingStatus"/> <actionGroup ref="AdminSalesOrderActionGroup" stepKey="validateOrderTotalsForFirstOrder"/> <!-- Go to order page --> <actionGroup ref="OpenOrderByIdActionGroup" stepKey="openSecondOrderPage"> <argument name="orderId" value="{$getSecondOrderIdPlaceOrder}"/> </actionGroup> <!-- Check status --> - <see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="Pending" stepKey="seeSecondOrderPendingStatus"/> + <actionGroup ref="AdminOrderViewCheckStatusActionGroup" stepKey="seeSecondOrderPendingStatus"/> <actionGroup ref="AdminSalesOrderActionGroup" stepKey="validateOrderTotalsForSecondOrder"/> </test> </tests> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderCheckStatusActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderCheckStatusActionGroup.xml new file mode 100644 index 0000000000000..f5d46d165efe5 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderCheckStatusActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminOrderViewCheckStatusActionGroup"> + <annotations> + <description>Check order status on order view page.</description> + </annotations> + <arguments> + <argument name="status" type="string" defaultValue="Pending"/> + </arguments> + + <see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="{{status}}" stepKey="seeOrderStatus"/> + </actionGroup> +</actionGroups> From 24a34475da27a2d821ec873cbe554480c45f4449 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <51681547+engcom-Golf@users.noreply.github.com> Date: Fri, 24 Jan 2020 10:59:31 +0200 Subject: [PATCH 0985/1143] Update Upsell.php --- app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php b/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php index 3c3a78201dddc..37bc356e32db5 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php @@ -232,7 +232,7 @@ public function getIterableItem() * * @param string $type * @param int $limit - * @return Upsell + * @return $this */ public function setItemLimit($type, $limit) { From edf2d040a11e4ccc87e8000c14a25bc5bb572572 Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Fri, 24 Jan 2020 13:34:38 +0200 Subject: [PATCH 0986/1143] Covering the fix by MFTF --- ...vigateToCurrencySymbolsPageActionGroup.xml | 15 +++++++ ...minCurrencySymbolIsDisabledActionGroup.xml | 19 +++++++++ .../Mftf/Page/AdminCurrencySymbolsPage.xml | 14 +++++++ .../AdminCurrencySymbolsGridSection.xml | 14 +++++++ ...nDefaultCurrencySymbolsAreDisabledTest.xml | 39 +++++++++++++++++++ 5 files changed, 101 insertions(+) create mode 100644 app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/AdminNavigateToCurrencySymbolsPageActionGroup.xml create mode 100644 app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/AssertAdminCurrencySymbolIsDisabledActionGroup.xml create mode 100644 app/code/Magento/CurrencySymbol/Test/Mftf/Page/AdminCurrencySymbolsPage.xml create mode 100644 app/code/Magento/CurrencySymbol/Test/Mftf/Section/AdminCurrencySymbolsGridSection.xml create mode 100644 app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminDefaultCurrencySymbolsAreDisabledTest.xml diff --git a/app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/AdminNavigateToCurrencySymbolsPageActionGroup.xml b/app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/AdminNavigateToCurrencySymbolsPageActionGroup.xml new file mode 100644 index 0000000000000..58854d2ce8162 --- /dev/null +++ b/app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/AdminNavigateToCurrencySymbolsPageActionGroup.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminNavigateToCurrencySymbolsPageActionGroup"> + <amOnPage url="{{AdminCurrencySymbolsPage.url}}" stepKey="navigateToCurrencySymbolsPage"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/AssertAdminCurrencySymbolIsDisabledActionGroup.xml b/app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/AssertAdminCurrencySymbolIsDisabledActionGroup.xml new file mode 100644 index 0000000000000..b8bcb2b0b9cb7 --- /dev/null +++ b/app/code/Magento/CurrencySymbol/Test/Mftf/ActionGroup/AssertAdminCurrencySymbolIsDisabledActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertAdminCurrencySymbolIsDisabledActionGroup"> + <arguments> + <argument name="currency" type="string"/> + </arguments> + + <grabAttributeFrom selector="{{AdminCurrencySymbolsGridSection.currencyElement(currency)}}" userInput="disabled" stepKey="grabDisabledAttribute"/> + <assertEquals expected='true' expectedType="string" actual="$grabDisabledAttribute" stepKey="assertInputIsDisabled"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CurrencySymbol/Test/Mftf/Page/AdminCurrencySymbolsPage.xml b/app/code/Magento/CurrencySymbol/Test/Mftf/Page/AdminCurrencySymbolsPage.xml new file mode 100644 index 0000000000000..82c2fa70e301a --- /dev/null +++ b/app/code/Magento/CurrencySymbol/Test/Mftf/Page/AdminCurrencySymbolsPage.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="urn:magento:mftf:Page/etc/PageObject.xsd"> + <page name="AdminCurrencySymbolsPage" url="admin/system_currencysymbol/" area="admin" module="CurrencySymbol"> + <section name="AdminCurrencySymbolsGridSection"/> + </page> +</pages> diff --git a/app/code/Magento/CurrencySymbol/Test/Mftf/Section/AdminCurrencySymbolsGridSection.xml b/app/code/Magento/CurrencySymbol/Test/Mftf/Section/AdminCurrencySymbolsGridSection.xml new file mode 100644 index 0000000000000..bf087d2ed8f4d --- /dev/null +++ b/app/code/Magento/CurrencySymbol/Test/Mftf/Section/AdminCurrencySymbolsGridSection.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="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="AdminCurrencySymbolsGridSection"> + <element name="currencyElement" type="input" selector="#currency-symbols-form #custom_currency_symbol{{currency}}" parameterized="true"/> + </section> +</sections> diff --git a/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminDefaultCurrencySymbolsAreDisabledTest.xml b/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminDefaultCurrencySymbolsAreDisabledTest.xml new file mode 100644 index 0000000000000..a04128c3d5ded --- /dev/null +++ b/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminDefaultCurrencySymbolsAreDisabledTest.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCurrencySymbolsAreDisabledTest"> + <annotations> + <features value="CurrencySymbol"/> + <stories value="Currency Symbols"/> + <title value="Currency symbols are disabled by default"/> + <description value="Currency symbols should be disabled by default"/> + <severity value="MINOR"/> + <group value="currency"/> + </annotations> + <before> + <magentoCLI command="config:set --scope={{SetAllowedCurrenciesConfigForUSD.scope}} --scope-code={{SetAllowedCurrenciesConfigForUSD.scope_code}} {{SetAllowedCurrenciesConfigForUSD.path}} {{SetAllowedCurrenciesConfigForUSD.value}},{{SetAllowedCurrenciesConfigForEUR.value}},{{SetAllowedCurrenciesConfigForRUB.value}}" stepKey="setAllowedCurrencyWebsites_EUR_RUB_USD"/> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <magentoCLI command="config:set --scope={{SetAllowedCurrenciesConfigForUSD.scope}} --scope-code={{SetAllowedCurrenciesConfigForUSD.scope_code}} {{SetAllowedCurrenciesConfigForUSD.path}} {{SetAllowedCurrenciesConfigForUSD.value}},{{SetAllowedCurrenciesConfigForEUR.value}}" stepKey="setAllowedCurrencyWebsites_EUR_USD"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <actionGroup ref="AdminNavigateToCurrencySymbolsPageActionGroup" stepKey="navigateToCurrencySymbolsPage"/> + <actionGroup ref="AssertAdminCurrencySymbolIsDisabledActionGroup" stepKey="assertEURDisabledInput"> + <argument name="currency" value="{{SetAllowedCurrenciesConfigForEUR.value}}"/> + </actionGroup> + <actionGroup ref="AssertAdminCurrencySymbolIsDisabledActionGroup" stepKey="assertUSDDisabledInput"> + <argument name="currency" value="{{SetAllowedCurrenciesConfigForUSD.value}}"/> + </actionGroup> + <actionGroup ref="AssertAdminCurrencySymbolIsDisabledActionGroup" stepKey="assertRUBDisabledInput"> + <argument name="currency" value="{{SetAllowedCurrenciesConfigForRUB.value}}"/> + </actionGroup> + </test> +</tests> From ed4c01bd01b7a70d44a1f9ee2c534bdd896f2da5 Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Fri, 24 Jan 2020 13:51:07 +0200 Subject: [PATCH 0987/1143] Ignoring unescaped output warning --- .../Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml b/app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml index 9298f0d3ce1d8..353137a4dcb2e 100644 --- a/app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml +++ b/app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml @@ -31,7 +31,9 @@ ?> <input id="custom_currency_symbol_inherit<?= $block->escapeHtmlAttr($code) ?>" class="admin__control-checkbox" type="checkbox" + <?php //@codingStandardsIgnoreStart ?> onclick="toggleUseDefault(<?= '\'' . $escapedCode . '\',\'' . $escapedSymbol . '\'' ?>)" + <?php //@codingStandardsIgnoreEnd ?> <?= $data['inherited'] ? ' checked="checked"' : '' ?> value="1" name="inherit_custom_currency_symbol[<?= $block->escapeHtmlAttr($code) ?>]"> From 79b0aa77223c5f61d3af9f7a44c5d078b8db91af Mon Sep 17 00:00:00 2001 From: Serhii Voloshkov <serhii.voloshkov@transoftgroup.com> Date: Fri, 24 Jan 2020 14:44:43 +0200 Subject: [PATCH 0988/1143] MC-23753: "<" and ">" symbols are changed to "<" and ">" in the frontend catalog search line --- .../Magento/Search/view/frontend/templates/form.mini.phtml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Search/view/frontend/templates/form.mini.phtml b/app/code/Magento/Search/view/frontend/templates/form.mini.phtml index 0dd9c819c855a..35f3876599731 100644 --- a/app/code/Magento/Search/view/frontend/templates/form.mini.phtml +++ b/app/code/Magento/Search/view/frontend/templates/form.mini.phtml @@ -14,7 +14,8 @@ $helper = $this->helper(\Magento\Search\Helper\Data::class); <div class="block block-search"> <div class="block block-title"><strong><?= $block->escapeHtml(__('Search')) ?></strong></div> <div class="block block-content"> - <form class="form minisearch" id="search_mini_form" action="<?= $block->escapeUrl($helper->getResultUrl()) ?>" method="get"> + <form class="form minisearch" id="search_mini_form" + action="<?= $block->escapeUrl($helper->getResultUrl()) ?>" method="get"> <div class="field search"> <label class="label" for="search" data-role="minisearch-label"> <span><?= $block->escapeHtml(__('Search')) ?></span> @@ -29,7 +30,7 @@ $helper = $this->helper(\Magento\Search\Helper\Data::class); }' type="text" name="<?= $block->escapeHtmlAttr($helper->getQueryParamName()) ?>" - value="<?= $block->escapeHtmlAttr($helper->getEscapedQueryText()) ?>" + value="<?= /* @noEscape */ $helper->getEscapedQueryText() ?>" placeholder="<?= $block->escapeHtmlAttr(__('Search entire store here...')) ?>" class="input-text" maxlength="<?= $block->escapeHtmlAttr($helper->getMaxQueryLength()) ?>" From 78329252e8f4adedae98a99c1fbc44529536cd92 Mon Sep 17 00:00:00 2001 From: Ihor Sviziev <ihor-sviziev@users.noreply.github.com> Date: Fri, 24 Jan 2020 14:51:09 +0200 Subject: [PATCH 0989/1143] Http adapter curl missing delete method Fix static tests & use strict comparison --- lib/internal/Magento/Framework/HTTP/Adapter/Curl.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php b/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php index 067c22564bc45..19b23abbc44d4 100644 --- a/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php +++ b/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php @@ -166,22 +166,21 @@ public function write($method, $url, $http_ver = '1.1', $headers = [], $body = ' // set url to post to curl_setopt($this->_getResource(), CURLOPT_URL, $url); curl_setopt($this->_getResource(), CURLOPT_RETURNTRANSFER, true); - if ($method == \Zend_Http_Client::POST) { + if ($method === \Zend_Http_Client::POST) { curl_setopt($this->_getResource(), CURLOPT_POST, true); curl_setopt($this->_getResource(), CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($this->_getResource(), CURLOPT_POSTFIELDS, $body); - } elseif ($method == \Zend_Http_Client::PUT) { + } elseif ($method === \Zend_Http_Client::PUT) { curl_setopt($this->_getResource(), CURLOPT_CUSTOMREQUEST, 'PUT'); curl_setopt($this->_getResource(), CURLOPT_POSTFIELDS, $body); - } elseif ($method == \Zend_Http_Client::GET) { + } elseif ($method === \Zend_Http_Client::GET) { curl_setopt($this->_getResource(), CURLOPT_HTTPGET, true); curl_setopt($this->_getResource(), CURLOPT_CUSTOMREQUEST, 'GET'); - } elseif ($method == \Zend_Http_Client::DELETE) { + } elseif ($method === \Zend_Http_Client::DELETE) { curl_setopt($this->_getResource(), CURLOPT_CUSTOMREQUEST, 'DELETE'); curl_setopt($this->_getResource(), CURLOPT_POSTFIELDS, $body); } - if ($http_ver === \Zend_Http_Client::HTTP_1) { curl_setopt($this->_getResource(), CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); } elseif ($http_ver === \Zend_Http_Client::HTTP_0) { From b143e7ba59c6e32b4edbafc9537fe044116fff01 Mon Sep 17 00:00:00 2001 From: "ivan.pletnyov" <ivan.pletnyov@transoftgroup.com> Date: Fri, 24 Jan 2020 16:11:32 +0200 Subject: [PATCH 0990/1143] MC-24894: Admin: Check Product categories indexing when add/remove category in product using category link management --- .../Model/CategoryLinkManagementTest.php | 227 ++++++++++++++++++ ...ith_category_which_has_parent_category.php | 47 ++++ ...ory_which_has_parent_category_rollback.php | 23 ++ .../Catalog/_files/product_with_category.php | 2 +- 4 files changed, 298 insertions(+), 1 deletion(-) create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryLinkManagementTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_category_which_has_parent_category.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_category_which_has_parent_category_rollback.php diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryLinkManagementTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryLinkManagementTest.php new file mode 100644 index 0000000000000..50d0ddbf5dccf --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryLinkManagementTest.php @@ -0,0 +1,227 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Model; + +use Magento\Catalog\Api\CategoryLinkManagementInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Indexer\Category\Product\TableMaintainer; +use Magento\Catalog\Model\ResourceModel\Category as CategoryResourceModel; +use Magento\Store\Api\StoreRepositoryInterface; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\ObjectManager; +use Magento\UrlRewrite\Model\ResourceModel\UrlRewriteCollectionFactory; +use PHPUnit\Framework\TestCase; + +/** + * Test cases related to assign/unassign product to/from category. + */ +class CategoryLinkManagementTest extends TestCase +{ + /** + * @var ObjectManager + */ + private $objectManager; + + /** + * @var TableMaintainer + */ + private $tableMaintainer; + + /** + * @var StoreRepositoryInterface + */ + private $storeRepository; + + /** + * @var ProductRepositoryInterface + */ + private $productRepository; + + /** + * @var CategoryResourceModel + */ + private $categoryResourceModel; + + /** + * @var CategoryLinkManagementInterface + */ + private $categoryLinkManagement; + + /** + * @inheritdoc + */ + protected function setUp() + { + $this->objectManager = Bootstrap::getObjectManager(); + $this->tableMaintainer = $this->objectManager->get(TableMaintainer::class); + $this->storeRepository = $this->objectManager->get(StoreRepositoryInterface::class); + $this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class); + $this->categoryResourceModel = $this->objectManager->get(CategoryResourceModel::class); + $this->categoryLinkManagement = $this->objectManager->create(CategoryLinkManagementInterface::class); + $this->productRepository->cleanCache(); + parent::setUp(); + } + + /** + * @inheritdoc + */ + protected function tearDown() + { + $this->objectManager->removeSharedInstance(CategoryLinkRepository::class); + $this->objectManager->removeSharedInstance(CategoryRepository::class); + parent::tearDown(); + } + + /** + * Assert that product correctly assigned to category and index table contain indexed data. + * + * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + * @magentoDataFixture Magento/Catalog/_files/category.php + * + * @magentoDbIsolation disabled + * + * @return void + */ + public function testAssignProductToCategory(): void + { + $product = $this->productRepository->get('simple2'); + $this->assertEquals(0, $this->getCategoryProductRelationRecordsCount((int)$product->getId(), [333])); + $this->assertEquals(0, $this->getCategoryProductIndexRecordsCount((int)$product->getId(), [333])); + $this->categoryLinkManagement->assignProductToCategories('simple2', [333]); + $this->assertEquals(1, $this->getCategoryProductRelationRecordsCount((int)$product->getId(), [333])); + $this->assertEquals(1, $this->getCategoryProductIndexRecordsCount((int)$product->getId(), [333])); + } + + /** + * Assert that product correctly unassigned from category and index table not contain indexed data. + * + * @magentoDataFixture Magento/Catalog/_files/product_with_category.php + * + * @magentoDbIsolation disabled + * + * @return void + */ + public function testUnassignProductFromCategory(): void + { + $product = $this->productRepository->get('in-stock-product'); + $this->assertEquals(1, $this->getCategoryProductRelationRecordsCount((int)$product->getId(), [333])); + $this->assertEquals(1, $this->getCategoryProductIndexRecordsCount((int)$product->getId(), [333])); + $this->categoryLinkManagement->assignProductToCategories('in-stock-product', []); + $this->assertEquals(0, $this->getCategoryProductRelationRecordsCount((int)$product->getId(), [333])); + $this->assertEquals(0, $this->getCategoryProductIndexRecordsCount((int)$product->getId(), [333])); + } + + /** + * Assert that product correctly assigned to category and index table contain index data. + * + * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + * @magentoDataFixture Magento/Catalog/_files/categories_no_products.php + * + * @magentoDbIsolation disabled + * + * @return void + */ + public function testAssignProductToCategoryWhichHasParentCategories(): void + { + $product = $this->productRepository->get('simple2'); + $this->assertEquals(0, $this->getCategoryProductRelationRecordsCount((int)$product->getId(), [5])); + $this->assertEquals(0, $this->getCategoryProductIndexRecordsCount((int)$product->getId(), [3, 4, 5])); + $this->categoryLinkManagement->assignProductToCategories('simple2', [5]); + $this->assertEquals(1, $this->getCategoryProductRelationRecordsCount((int)$product->getId(), [5])); + $this->assertEquals(3, $this->getCategoryProductIndexRecordsCount((int)$product->getId(), [3, 4, 5])); + } + + /** + * Assert that product correctly unassigned from category and index table doesn't contain index data. + * + * @magentoDataFixture Magento/Catalog/_files/product_simple_with_category_which_has_parent_category.php + * + * @magentoDbIsolation disabled + * + * @return void + */ + public function testUnassignProductFromCategoryWhichHasParentCategories(): void + { + $product = $this->productRepository->get('simple_with_child_category'); + $this->assertEquals(1, $this->getCategoryProductRelationRecordsCount((int)$product->getId(), [5])); + $this->assertEquals(3, $this->getCategoryProductIndexRecordsCount((int)$product->getId(), [3, 4, 5])); + $this->categoryLinkManagement->assignProductToCategories('simple_with_child_category', []); + $this->assertEquals(0, $this->getCategoryProductRelationRecordsCount((int)$product->getId(), [5])); + $this->assertEquals(0, $this->getCategoryProductIndexRecordsCount((int)$product->getId(), [3, 4, 5])); + } + + /** + * Assert that product correctly reassigned to another category. + * + * @magentoDataFixture Magento/Catalog/_files/product_simple_with_category_which_has_parent_category.php + * + * @magentoDbIsolation disabled + * + * @return void + */ + public function testReassignProductToOtherCategory(): void + { + $product = $this->productRepository->get('simple_with_child_category'); + $this->assertEquals(1, $this->getCategoryProductRelationRecordsCount((int)$product->getId(), [5])); + $this->assertEquals(3, $this->getCategoryProductIndexRecordsCount((int)$product->getId(), [3, 4, 5])); + $this->categoryLinkManagement->assignProductToCategories('simple_with_child_category', [6]); + $this->assertEquals(1, $this->getCategoryProductRelationRecordsCount((int)$product->getId(), [6])); + $this->assertEquals(1, $this->getCategoryProductIndexRecordsCount((int)$product->getId(), [6])); + $this->assertEquals(0, $this->getCategoryProductRelationRecordsCount((int)$product->getId(), [5])); + $this->assertEquals(0, $this->getCategoryProductIndexRecordsCount((int)$product->getId(), [3, 4, 5])); + } + + /** + * Return count of product which assigned to provided categories. + * + * @param int $productId + * @param int[] $categoryIds + * @return int + */ + private function getCategoryProductRelationRecordsCount(int $productId, array $categoryIds): int + { + $select = $this->categoryResourceModel->getConnection()->select(); + $select->from( + $this->categoryResourceModel->getCategoryProductTable(), + [ + 'row_count' => new \Zend_Db_Expr('COUNT(*)') + ] + ); + $select->where('product_id = ?', $productId); + $select->where('category_id IN (?)', $categoryIds); + + return (int)$this->categoryResourceModel->getConnection()->fetchOne($select); + } + + /** + * Return count of products which added to index table with all provided category ids. + * + * @param int $productId + * @param array $categoryIds + * @param string $storeCode + * @return int + */ + private function getCategoryProductIndexRecordsCount( + int $productId, + array $categoryIds, + string $storeCode = 'default' + ): int { + $storeId = (int)$this->storeRepository->get($storeCode)->getId(); + $select = $this->categoryResourceModel->getConnection()->select(); + $select->from( + $this->tableMaintainer->getMainTable($storeId), + [ + 'row_count' => new \Zend_Db_Expr('COUNT(*)') + ] + ); + $select->where('product_id = ?', $productId); + $select->where('category_id IN (?)', $categoryIds); + + return (int)$this->categoryResourceModel->getConnection()->fetchOne($select); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_category_which_has_parent_category.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_category_which_has_parent_category.php new file mode 100644 index 0000000000000..4d3ad8fcbf2f4 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_category_which_has_parent_category.php @@ -0,0 +1,47 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\Data\ProductInterfaceFactory; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Catalog\Model\Product\Visibility; +use Magento\Store\Api\WebsiteRepositoryInterface; +use Magento\TestFramework\Helper\Bootstrap; + +require __DIR__ . '/categories_no_products.php'; + +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->get(ProductRepositoryInterface::class); +/** @var WebsiteRepositoryInterface $websiteRepository */ +$websiteRepository = $objectManager->get(WebsiteRepositoryInterface::class); +/** @var ProductInterfaceFactory $productFactory */ +$productFactory = $objectManager->get(ProductInterfaceFactory::class); +$defaultWebsiteId = $websiteRepository->get('base')->getId(); +$product = $productFactory->create(); +$product->setData( + [ + 'attribute_set_id' => $product->getDefaultAttributeSetId(), + 'website_ids' => [ + $defaultWebsiteId + ], + 'name' => 'Simple product with child category', + 'sku' => 'simple_with_child_category', + 'price' => 10, + 'description' => 'Description product with category which has parent category', + 'visibility' => Visibility::VISIBILITY_BOTH, + 'status' => Status::STATUS_ENABLED, + 'category_ids' => [5], + 'stock_data' => [ + 'use_config_manage_stock' => 1, + 'qty' => 100, + 'is_qty_decimal' => 0, + 'is_in_stock' => 1 + ], + 'url_key' => 'simple-with-child-category' + ] +); +$productRepository->save($product); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_category_which_has_parent_category_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_category_which_has_parent_category_rollback.php new file mode 100644 index 0000000000000..58acf8e35129e --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_category_which_has_parent_category_rollback.php @@ -0,0 +1,23 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Framework\Exception\NoSuchEntityException; + +require __DIR__ . '/categories_no_products_rollback.php'; + +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->get(ProductRepositoryInterface::class); +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); +try { + $productRepository->deleteById('simple_with_child_category'); +} catch (NoSuchEntityException $exception) { + //Product already deleted. +} +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_with_category.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_with_category.php index 28c235e4e3e87..ebc6bce655198 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_with_category.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_with_category.php @@ -30,7 +30,7 @@ ->setSku('in-stock-product') ->setPrice(10) ->setWeight(1) - ->setShortDescription("Short description") + ->setShortDescription('Short description') ->setTaxClassId(0) ->setDescription('Description with <b>html tag</b>') ->setMetaTitle('meta title') From 0671b7f013d11f06bef65cdb8a0c5342834e89fd Mon Sep 17 00:00:00 2001 From: Karyna Tsymbal <k.tsymbal@atwix.com> Date: Fri, 24 Jan 2020 16:14:02 +0200 Subject: [PATCH 0991/1143] Added strict_types --- .../Test/Unit/Plugin/Block/Tracking/PopupDeliveryDateTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Fedex/Test/Unit/Plugin/Block/Tracking/PopupDeliveryDateTest.php b/app/code/Magento/Fedex/Test/Unit/Plugin/Block/Tracking/PopupDeliveryDateTest.php index a1c461a10abdc..a5cd261ab7121 100644 --- a/app/code/Magento/Fedex/Test/Unit/Plugin/Block/Tracking/PopupDeliveryDateTest.php +++ b/app/code/Magento/Fedex/Test/Unit/Plugin/Block/Tracking/PopupDeliveryDateTest.php @@ -4,6 +4,8 @@ * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Fedex\Test\Unit\Plugin\Block\Tracking; use Magento\Fedex\Model\Carrier; From e69ff7b0fe2ac2757bc28ab4c5293288675f44d4 Mon Sep 17 00:00:00 2001 From: Karyna Tsymbal <k.tsymbal@atwix.com> Date: Fri, 24 Jan 2020 16:24:33 +0200 Subject: [PATCH 0992/1143] Added strict_types and some cleanup --- .../Block/DataProviders/Tracking/ChangeTitleTest.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Fedex/Test/Unit/Plugin/Block/DataProviders/Tracking/ChangeTitleTest.php b/app/code/Magento/Fedex/Test/Unit/Plugin/Block/DataProviders/Tracking/ChangeTitleTest.php index dc3218411b748..ff1276044d731 100644 --- a/app/code/Magento/Fedex/Test/Unit/Plugin/Block/DataProviders/Tracking/ChangeTitleTest.php +++ b/app/code/Magento/Fedex/Test/Unit/Plugin/Block/DataProviders/Tracking/ChangeTitleTest.php @@ -4,8 +4,11 @@ * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Fedex\Test\Unit\Plugin\Block\DataProviders\Tracking; +use Magento\Fedex\Model\Carrier; use Magento\Fedex\Plugin\Block\DataProviders\Tracking\ChangeTitle; use Magento\Framework\Phrase; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; @@ -15,7 +18,7 @@ use PHPUnit\Framework\TestCase; /** - * Unit Test for @see \Magento\Fedex\Plugin\Block\DataProviders\Tracking\ChangeTitle + * Unit Test for @see ChangeTitle */ class ChangeTitleTest extends TestCase { @@ -41,7 +44,7 @@ protected function setUp() * @param Phrase|string $finalResult * @dataProvider testAfterGetTitleDataProvider */ - public function testAfterGetTitle($carrierCode, $originalResult, $finalResult) + public function testAfterGetTitle(string $carrierCode, string $originalResult, $finalResult) { /** @var DeliveryDateTitle|MockObject $subjectMock */ $subjectMock = $this->getMockBuilder(DeliveryDateTitle::class) @@ -67,10 +70,10 @@ public function testAfterGetTitle($carrierCode, $originalResult, $finalResult) * * @return array */ - public function testAfterGetTitleDataProvider() + public function testAfterGetTitleDataProvider(): array { return [ - [\Magento\Fedex\Model\Carrier::CODE, 'Original Title', __('Expected Delivery:')], + [Carrier::CODE, 'Original Title', __('Expected Delivery:')], ['not-fedex', 'Original Title', 'Original Title'], ]; } From 52a66acc44a3f7dff0e3eaf1166cec6d279d29be Mon Sep 17 00:00:00 2001 From: Karyna Tsymbal <k.tsymbal@atwix.com> Date: Fri, 24 Jan 2020 16:30:17 +0200 Subject: [PATCH 0993/1143] Unit test for Magento\Reports\Observer\EventSaver --- .../Test/Unit/Observer/EventSaverTest.php | 156 ++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 app/code/Magento/Reports/Test/Unit/Observer/EventSaverTest.php diff --git a/app/code/Magento/Reports/Test/Unit/Observer/EventSaverTest.php b/app/code/Magento/Reports/Test/Unit/Observer/EventSaverTest.php new file mode 100644 index 0000000000000..8175887a33903 --- /dev/null +++ b/app/code/Magento/Reports/Test/Unit/Observer/EventSaverTest.php @@ -0,0 +1,156 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\Reports\Test\Unit\Observer; + +use Magento\Customer\Model\Session; +use Magento\Customer\Model\Visitor; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Reports\Model\Event; +use Magento\Reports\Model\EventFactory; +use Magento\Reports\Observer\EventSaver; +use Magento\Store\Api\Data\StoreInterface; +use Magento\Store\Model\StoreManagerInterface; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +/** + * Unit Test for @see EventSaver + */ +class EventSaverTest extends TestCase +{ + /** + * @var Session|MockObject + */ + private $customerSessionMock; + + /** + * @var Visitor|MockObject + */ + private $customerVisitorMock; + + /** + * @var StoreInterface|MockObject + */ + private $storeMock; + + /** + * @var StoreManagerInterface|MockObject + */ + private $storeManagerMock; + + /** + * @var EventFactory|MockObject + */ + private $eventFactoryMock; + + /** + * @var Event|MockObject + */ + private $eventMock; + + /** + * @var EventSaver + */ + private $eventSaver; + + /** + * @inheritDoc + */ + public function setUp() + { + $this->customerSessionMock = $this->createMock(Session::class); + $this->customerVisitorMock = $this->createMock(Visitor::class); + + $this->storeMock = $this->createMock(StoreInterface::class); + $this->storeManagerMock = $this->createMock(StoreManagerInterface::class); + $this->storeManagerMock->expects($this->once()) + ->method('getStore') + ->willReturn($this->storeMock); + $this->storeMock->expects($this->once()) + ->method('getId') + ->willReturn(1); + + $this->eventMock = $this->createMock(Event::class); + $this->eventFactoryMock = $this->createMock(EventFactory::class); + $this->eventFactoryMock->expects($this->once()) + ->method('create') + ->willReturn($this->eventMock); + $this->eventMock->expects($this->once()) + ->method('setData') + ->willReturnSelf(); + $this->eventMock->expects($this->once()) + ->method('save') + ->willReturnSelf(); + + $objectManagerHelper = new ObjectManager($this); + $this->eventSaver = $objectManagerHelper->getObject( + EventSaver::class, + [ + '_storeManager' => $this->storeManagerMock, + '_eventFactory' => $this->eventFactoryMock, + '_customerSession' => $this->customerSessionMock, + '_customerVisitor' => $this->customerVisitorMock + ] + ); + } + + /** + * Test save with subject ID provided + */ + public function testSaveWithSubject() + { + $subjectId = 5; + $this->customerSessionMock->expects($this->never()) + ->method('isLoggedIn'); + $this->customerSessionMock->expects($this->never()) + ->method('getCustomerId'); + $this->customerVisitorMock->expects($this->never()) + ->method('getId'); + $this->eventSaver->save(1, 1, $subjectId); + } + + /** + * Test save with no subject ID provided + * + * @param bool $isLoggedIn + * @dataProvider dataProviderTestSaveWithoutSubject + */ + public function testSaveWithoutSubject(bool $isLoggedIn) + { + if ($isLoggedIn) { + $this->customerSessionMock->expects($this->once()) + ->method('isLoggedIn') + ->willReturn(true); + $this->customerSessionMock->expects($this->once()) + ->method('getCustomerId') + ->willReturn(1); + } else { + $this->customerSessionMock->expects($this->once()) + ->method('isLoggedIn') + ->willReturn(false); + $this->customerVisitorMock->expects($this->once()) + ->method('getId') + ->willReturn(2); + } + $this->eventSaver->save(1, 1, null); + } + + /** + * Data provider for a case without subjectId provided + * + * @return array + */ + public function dataProviderTestSaveWithoutSubject() + { + return [ + [true], + [false] + ]; + } +} From 75c2fb5489b7aaf601925482f270ebf15419a531 Mon Sep 17 00:00:00 2001 From: vadim <vadim@example.com> Date: Fri, 24 Jan 2020 13:31:31 +0200 Subject: [PATCH 0994/1143] magento/magento2#25966: `Next` button position fix --- .../web/css/source/module/checkout/_shipping.less | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_shipping.less b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_shipping.less index 2eb634acc5daa..f054140c0e1b2 100644 --- a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_shipping.less +++ b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_shipping.less @@ -211,6 +211,12 @@ } } } + + #shipping-method-buttons-container { + .button { + margin-top: 2px; + } + } } // From 45cd0fa332f5eb32e4e49a2e055ecb57d8442afa Mon Sep 17 00:00:00 2001 From: Oleh Usik <o.usik@atwix.com> Date: Fri, 24 Jan 2020 18:40:48 +0200 Subject: [PATCH 0995/1143] Refactored MFTF test --- ...orefrontCreateNewSubscriberActionGroup.xml | 19 +++++++++++++++++++ ...erConfigPageSubscriptionOptionsSection.xml | 2 +- .../Section/NewsletterTemplateSection.xml | 3 ++- ...inkDisplayedForGuestSubscriptionNoTest.xml | 6 +----- 4 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 app/code/Magento/Newsletter/Test/Mftf/ActionGroup/StorefrontCreateNewSubscriberActionGroup.xml diff --git a/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/StorefrontCreateNewSubscriberActionGroup.xml b/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/StorefrontCreateNewSubscriberActionGroup.xml new file mode 100644 index 0000000000000..0aee2cb9b2e3c --- /dev/null +++ b/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/StorefrontCreateNewSubscriberActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCreateNewSubscriberActionGroup"> + <amOnPage url="{{StorefrontHomePage.url}}" stepKey="amOnStorefrontPage"/> + <submitForm selector="{{BasicFrontendNewsletterFormSection.subscribeForm}}" + parameterArray="['email' => '{{_defaultNewsletter.senderEmail}}']" + button="{{BasicFrontendNewsletterFormSection.subscribeButton}}" stepKey="submitForm"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <waitForElementVisible stepKey="waitForErrorAppears" selector="{{StorefrontMessagesSection.error}}"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Newsletter/Test/Mftf/Section/AdminNewsletterConfigPageSubscriptionOptionsSection.xml b/app/code/Magento/Newsletter/Test/Mftf/Section/AdminNewsletterConfigPageSubscriptionOptionsSection.xml index 26fdcf10ede02..32bedfead088c 100644 --- a/app/code/Magento/Newsletter/Test/Mftf/Section/AdminNewsletterConfigPageSubscriptionOptionsSection.xml +++ b/app/code/Magento/Newsletter/Test/Mftf/Section/AdminNewsletterConfigPageSubscriptionOptionsSection.xml @@ -8,7 +8,7 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminNewsletterConfigPageSubscriptionOptionsSection"> - <element name="allowGuestSubscription" type="input" selector="#newsletter_subscription_allow_guest_subscribe_inherit"/> + <element name="allowGuestSubscription" type="checkbox" selector="input[name='groups[subscription][fields][allow_guest_subscribe][inherit]']" timeout="30"/> <element name="guestSubscription" type="select" selector="#newsletter_subscription_allow_guest_subscribe" timeout="30"/> </section> </sections> diff --git a/app/code/Magento/Newsletter/Test/Mftf/Section/NewsletterTemplateSection.xml b/app/code/Magento/Newsletter/Test/Mftf/Section/NewsletterTemplateSection.xml index ebc1577fd5ece..ffc871c56800b 100644 --- a/app/code/Magento/Newsletter/Test/Mftf/Section/NewsletterTemplateSection.xml +++ b/app/code/Magento/Newsletter/Test/Mftf/Section/NewsletterTemplateSection.xml @@ -9,7 +9,8 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="BasicFrontendNewsletterFormSection"> <element name="newsletterEmail" type="input" selector="#newsletter"/> - <element name="subscribeButton" type="button" selector=".subscribe"/> + <element name="subscribeButton" type="button" selector=".subscribe" timeout="30"/> + <element name="subscribeForm" type="input" selector="#newsletter-validate-detail" timeout="30"/> </section> <section name="BasicFieldNewsletterSection"> <element name="templateName" type="input" selector="#code"/> diff --git a/app/code/Magento/Newsletter/Test/Mftf/Test/VerifyRegistredLinkDisplayedForGuestSubscriptionNoTest.xml b/app/code/Magento/Newsletter/Test/Mftf/Test/VerifyRegistredLinkDisplayedForGuestSubscriptionNoTest.xml index b5cb4e2fa62bc..f4dc370391b64 100644 --- a/app/code/Magento/Newsletter/Test/Mftf/Test/VerifyRegistredLinkDisplayedForGuestSubscriptionNoTest.xml +++ b/app/code/Magento/Newsletter/Test/Mftf/Test/VerifyRegistredLinkDisplayedForGuestSubscriptionNoTest.xml @@ -17,10 +17,6 @@ <!--Log out from Magento admin.--> <actionGroup ref="logout" stepKey="logoutFromAdmin"/> </before> - - <amOnPage url="{{StorefrontHomePage.url}}" stepKey="amOnStorefrontPage"/> - <fillField selector="{{BasicFrontendNewsletterFormSection.newsletterEmail}}" userInput="{{_defaultNewsletter.senderEmail}}" stepKey="fillTemplateEmail" /> - <click selector="{{BasicFrontendNewsletterFormSection.subscribeButton}}" stepKey="subscribe"/> - <waitForElement selector=".messages" stepKey="waitMessage"/> + <actionGroup ref="StorefrontCreateNewSubscriberActionGroup" stepKey="createSubscriber"/> </test> </tests> From 8f7328bf98e6df0951d4cf8cc245b48d72549f98 Mon Sep 17 00:00:00 2001 From: Oleksandr Dubovyk <odubovyk@magento.com> Date: Fri, 24 Jan 2020 11:57:05 -0600 Subject: [PATCH 0996/1143] MC-30255: In Stock Alert Email Shows Incorrect Item Pricing - added fallback --- .../Pricing/Price/LowestPriceOptionsProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/ConfigurableProduct/Pricing/Price/LowestPriceOptionsProvider.php b/app/code/Magento/ConfigurableProduct/Pricing/Price/LowestPriceOptionsProvider.php index 11bfecf7e8da1..29717a057cbdb 100644 --- a/app/code/Magento/ConfigurableProduct/Pricing/Price/LowestPriceOptionsProvider.php +++ b/app/code/Magento/ConfigurableProduct/Pricing/Price/LowestPriceOptionsProvider.php @@ -67,7 +67,7 @@ public function __construct( public function getProducts(ProductInterface $product) { $productId = $product->getId(); - $storeId = $product->getStoreId(); + $storeId = $product->getStoreId() ?: $this->storeManager->getStore()->getId(); $key = $storeId . '-' . $productId; if (!isset($this->linkedProductMap[$key])) { $productIds = $this->resource->getConnection()->fetchCol( From 9761b9737bb601026cded149db000118840b82b0 Mon Sep 17 00:00:00 2001 From: Lena Orobei <oorobei@magento.com> Date: Fri, 24 Jan 2020 13:39:45 -0600 Subject: [PATCH 0997/1143] ENGCOM-6641: Magento partners issue/PR templates --- .github/ISSUE_TEMPLATE/developer-experience-issue.md | 1 + .github/ISSUE_TEMPLATE/feature_request.md | 1 + .github/PULL_REQUEST_TEMPLATE.md | 3 +++ 3 files changed, 5 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/developer-experience-issue.md b/.github/ISSUE_TEMPLATE/developer-experience-issue.md index 423d4818fb31c..713ce410a16e1 100644 --- a/.github/ISSUE_TEMPLATE/developer-experience-issue.md +++ b/.github/ISSUE_TEMPLATE/developer-experience-issue.md @@ -1,6 +1,7 @@ --- name: Developer experience issue about: Issues related to customization, extensibility, modularity +labels: 'Triage: Dev.Experience' --- diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index f64185773cab4..7b6a8d199f28f 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,6 +1,7 @@ --- name: Feature request about: Please consider reporting directly to https://github.com/magento/community-features +labels: 'feature request' --- diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 11da06ee704c6..5d6620ce19228 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -15,6 +15,9 @@ Letting us know what has changed and why it needed changing will help us validate this pull request. --> +### Related Pull Requests +<!-- related pull request placeholder --> + ### Fixed Issues (if relevant) <!--- If relevant, please provide a list of fixed issues in the format magento/magento2#<issue_number>. From fd3f2a22b8e5b2cffaf17daccc29f461c26c5f51 Mon Sep 17 00:00:00 2001 From: Yevhen Sentiabov <sentiabo@adobe.com> Date: Fri, 24 Jan 2020 14:26:19 -0600 Subject: [PATCH 0998/1143] Github #26532: di:setup:compile fails with anonymous classes - Fixed parsing for anonymous classes during di:compile run - Small code optimizations - Extended and refactored related unit tests --- .../Module/Di/Code/Scanner/PhpScanner.php | 86 ++++++++++--------- .../Di/Code/Reader/ClassesScannerTest.php | 4 +- .../Module/Di/Code/Scanner/PhpScannerTest.php | 84 +++++++++--------- .../Model/StubWithAnonymousClass.php | 36 ++++++++ 4 files changed, 128 insertions(+), 82 deletions(-) create mode 100644 setup/src/Magento/Setup/Test/Unit/Module/Di/_files/app/code/Magento/SomeModule/Model/StubWithAnonymousClass.php diff --git a/setup/src/Magento/Setup/Module/Di/Code/Scanner/PhpScanner.php b/setup/src/Magento/Setup/Module/Di/Code/Scanner/PhpScanner.php index 1cd242acbe50b..be25cf605ef80 100644 --- a/setup/src/Magento/Setup/Module/Di/Code/Scanner/PhpScanner.php +++ b/setup/src/Magento/Setup/Module/Di/Code/Scanner/PhpScanner.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Setup\Module\Di\Code\Scanner; use Magento\Framework\Api\Code\Generator\ExtensionAttributesGenerator; @@ -12,9 +14,7 @@ use \Magento\Framework\Reflection\TypeProcessor; /** - * Class PhpScanner - * - * @package Magento\Setup\Module\Di\Code\Scanner + * Finds factory and extension attributes classes which require auto-generation. */ class PhpScanner implements ScannerInterface { @@ -53,15 +53,28 @@ public function __construct(Log $log, TypeProcessor $typeProcessor = null) protected function _findMissingClasses($file, $classReflection, $methodName, $entityType) { $missingClasses = []; - if ($classReflection->hasMethod($methodName)) { - $constructor = $classReflection->getMethod($methodName); - $parameters = $constructor->getParameters(); - /** @var $parameter \ReflectionParameter */ - foreach ($parameters as $parameter) { - preg_match('/\[\s\<\w+?>\s([\w\\\\]+)/s', $parameter->__toString(), $matches); - if (isset($matches[1]) && substr($matches[1], -strlen($entityType)) == $entityType) { - $missingClassName = $matches[1]; - if ($this->shouldGenerateClass($missingClassName, $entityType, $file)) { + if (!$classReflection->hasMethod($methodName)) { + return $missingClasses; + } + + $factorySuffix = '\\' . ucfirst(FactoryGenerator::ENTITY_TYPE); + $constructor = $classReflection->getMethod($methodName); + $parameters = $constructor->getParameters(); + /** @var $parameter \ReflectionParameter */ + foreach ($parameters as $parameter) { + preg_match('/\[\s\<\w+?>\s([\w\\\\]+)/s', $parameter->__toString(), $matches); + if (isset($matches[1]) && substr($matches[1], -strlen($entityType)) == $entityType) { + $missingClassName = $matches[1]; + if ($this->shouldGenerateClass($missingClassName, $entityType, $file)) { + + if (substr($missingClassName, -strlen($factorySuffix)) == $factorySuffix) { + $entityName = rtrim(substr($missingClassName, 0, -strlen($factorySuffix)), '\\'); + $this->_log->add( + Log::CONFIGURATION_ERROR, + $missingClassName, + 'Invalid Factory declaration for class ' . $entityName . ' in file ' . $file + ); + } else { $missingClasses[] = $missingClassName; } } @@ -110,24 +123,12 @@ protected function getSourceClassName($missingClassName, $entityType) */ protected function _fetchFactories($reflectionClass, $file) { - $factorySuffix = '\\' . ucfirst(FactoryGenerator::ENTITY_TYPE); $absentFactories = $this->_findMissingClasses( $file, $reflectionClass, '__construct', ucfirst(FactoryGenerator::ENTITY_TYPE) ); - foreach ($absentFactories as $key => $absentFactory) { - if (substr($absentFactory, -strlen($factorySuffix)) == $factorySuffix) { - $entityName = rtrim(substr($absentFactory, 0, -strlen($factorySuffix)), '\\'); - $this->_log->add( - Log::CONFIGURATION_ERROR, - $absentFactory, - 'Invalid Factory declaration for class ' . $entityName . ' in file ' . $file - ); - unset($absentFactories[$key]); - } - } return $absentFactories; } @@ -150,21 +151,19 @@ protected function _fetchMissingExtensionAttributesClasses($reflectionClass, $fi $missingClassName = $returnType['type']; if ($this->shouldGenerateClass($missingClassName, $entityType, $file)) { $missingExtensionInterfaces[] = $missingClassName; + + $extension = rtrim(substr($missingClassName, 0, -strlen('Interface')), '\\'); + if (!class_exists($extension)) { + $missingExtensionInterfaces[] = $extension; + } + $extensionFactory = $extension . 'Factory'; + if (!class_exists($extensionFactory)) { + $missingExtensionInterfaces[] = $extensionFactory; + } } } - $missingExtensionClasses = []; - $missingExtensionFactories = []; - foreach ($missingExtensionInterfaces as $missingExtensionInterface) { - $extension = rtrim(substr($missingExtensionInterface, 0, -strlen('Interface')), '\\'); - if (!class_exists($extension)) { - $missingExtensionClasses[] = $extension; - } - $extensionFactory = $extension . 'Factory'; - if (!class_exists($extensionFactory)) { - $missingExtensionFactories[] = $extensionFactory; - } - } - return array_merge($missingExtensionInterfaces, $missingExtensionClasses, $missingExtensionFactories); + + return $missingExtensionInterfaces; } /** @@ -223,8 +222,17 @@ protected function _fetchClasses($namespace, $tokenIterator, $count, $tokens) { $classes = []; for ($tokenOffset = $tokenIterator + 1; $tokenOffset < $count; ++$tokenOffset) { - if ($tokens[$tokenOffset] === '{') { - $classes[] = $namespace . "\\" . $tokens[$tokenIterator + 2][1]; + if ($tokens[$tokenOffset] !== '{') { + continue; + } + // anonymous classes should be omitted + if (is_array($tokens[$tokenIterator - 2]) && $tokens[$tokenIterator - 2][0] === T_NEW) { + continue; + } + + $class = $namespace . "\\" . $tokens[$tokenIterator + 2][1]; + if (!in_array($class, $classes)) { + $classes[] = $class; } } return $classes; diff --git a/setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Reader/ClassesScannerTest.php b/setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Reader/ClassesScannerTest.php index efb7e72b0ed08..4d9cd140122ad 100644 --- a/setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Reader/ClassesScannerTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Reader/ClassesScannerTest.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Setup\Test\Unit\Module\Di\Code\Reader; use Magento\Framework\App\Filesystem\DirectoryList; @@ -37,6 +39,6 @@ public function testGetList() $pathToScan = str_replace('\\', '/', realpath(__DIR__ . '/../../') . '/_files/app/code/Magento/SomeModule'); $actual = $this->model->getList($pathToScan); $this->assertTrue(is_array($actual)); - $this->assertCount(5, $actual); + $this->assertCount(6, $actual); } } diff --git a/setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Scanner/PhpScannerTest.php b/setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Scanner/PhpScannerTest.php index 5f8cd7643e87c..46d45770055b0 100644 --- a/setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Scanner/PhpScannerTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Scanner/PhpScannerTest.php @@ -3,74 +3,74 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Setup\Test\Unit\Module\Di\Code\Scanner; +declare(strict_types=1); -require_once __DIR__ . '/../../_files/app/code/Magento/SomeModule/Helper/Test.php'; -require_once __DIR__ . '/../../_files/app/code/Magento/SomeModule/ElementFactory.php'; -require_once __DIR__ . '/../../_files/app/code/Magento/SomeModule/Model/DoubleColon.php'; -require_once __DIR__ . '/../../_files/app/code/Magento/SomeModule/Api/Data/SomeInterface.php'; +namespace Magento\Setup\Test\Unit\Module\Di\Code\Scanner; use Magento\Framework\Reflection\TypeProcessor; +use Magento\Setup\Module\Di\Code\Scanner\PhpScanner; +use Magento\Setup\Module\Di\Compiler\Log\Log; +use PHPUnit\Framework\MockObject\MockObject; class PhpScannerTest extends \PHPUnit\Framework\TestCase { /** - * @var \Magento\Setup\Module\Di\Code\Scanner\PhpScanner + * @var PhpScanner */ - protected $_model; + private $scanner; /** * @var string */ - protected $_testDir; - - /** - * @var array - */ - protected $_testFiles = []; + private $testDir; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var Log|MockObject */ - protected $_logMock; + private $log; protected function setUp() { - $this->_logMock = $this->createMock(\Magento\Setup\Module\Di\Compiler\Log\Log::class); - $this->_model = new \Magento\Setup\Module\Di\Code\Scanner\PhpScanner($this->_logMock, new TypeProcessor()); - $this->_testDir = str_replace('\\', '/', realpath(__DIR__ . '/../../') . '/_files'); + $this->log = $this->createMock(Log::class); + $this->scanner = new PhpScanner($this->log, new TypeProcessor()); + $this->testDir = str_replace('\\', '/', realpath(__DIR__ . '/../../') . '/_files'); } public function testCollectEntities() { - $this->_testFiles = [ - $this->_testDir . '/app/code/Magento/SomeModule/Helper/Test.php', - $this->_testDir . '/app/code/Magento/SomeModule/Model/DoubleColon.php', - $this->_testDir . '/app/code/Magento/SomeModule/Api/Data/SomeInterface.php' + require_once __DIR__ . '/../../_files/app/code/Magento/SomeModule/Helper/Test.php'; + require_once __DIR__ . '/../../_files/app/code/Magento/SomeModule/ElementFactory.php'; + require_once __DIR__ . '/../../_files/app/code/Magento/SomeModule/Model/DoubleColon.php'; + require_once __DIR__ . '/../../_files/app/code/Magento/SomeModule/Api/Data/SomeInterface.php'; + require_once __DIR__ . '/../../_files/app/code/Magento/SomeModule/Model/StubWithAnonymousClass.php'; + + $testFiles = [ + $this->testDir . '/app/code/Magento/SomeModule/Helper/Test.php', + $this->testDir . '/app/code/Magento/SomeModule/Model/DoubleColon.php', + $this->testDir . '/app/code/Magento/SomeModule/Api/Data/SomeInterface.php', + $this->testDir . '/app/code/Magento/SomeModule/Model/StubWithAnonymousClass.php', ]; - $this->_logMock->expects( - $this->at(0) - )->method( - 'add' - )->with( - 4, - 'Magento\SomeModule\Module\Factory', - 'Invalid Factory for nonexistent class Magento\SomeModule\Module in file ' . $this->_testFiles[0] - ); - $this->_logMock->expects( - $this->at(1) - )->method( - 'add' - )->with( - 4, - 'Magento\SomeModule\Element\Factory', - 'Invalid Factory declaration for class Magento\SomeModule\Element in file ' . $this->_testFiles[0] - ); + $this->log->expects(self::at(0)) + ->method('add') + ->with( + 4, + 'Magento\SomeModule\Module\Factory', + 'Invalid Factory for nonexistent class Magento\SomeModule\Module in file ' . $testFiles[0] + ); + $this->log->expects(self::at(1)) + ->method('add') + ->with( + 4, + 'Magento\SomeModule\Element\Factory', + 'Invalid Factory declaration for class Magento\SomeModule\Element in file ' . $testFiles[0] + ); + + $result = $this->scanner->collectEntities($testFiles); - $this->assertEquals( + self::assertEquals( ['\\' . \Magento\Eav\Api\Data\AttributeExtensionInterface::class], - $this->_model->collectEntities($this->_testFiles) + $result ); } } diff --git a/setup/src/Magento/Setup/Test/Unit/Module/Di/_files/app/code/Magento/SomeModule/Model/StubWithAnonymousClass.php b/setup/src/Magento/Setup/Test/Unit/Module/Di/_files/app/code/Magento/SomeModule/Model/StubWithAnonymousClass.php new file mode 100644 index 0000000000000..793ee3bb16cdb --- /dev/null +++ b/setup/src/Magento/Setup/Test/Unit/Module/Di/_files/app/code/Magento/SomeModule/Model/StubWithAnonymousClass.php @@ -0,0 +1,36 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\SomeModule\Model; + +use Magento\SomeModule\DummyFactory; + +class StubWithAnonymousClass +{ + /** + * @var DummyFactory + */ + private $factory; + + public function __construct(DummyFactory $factory) + { + $this->factory = $factory; + } + + public function getSerializable(): \JsonSerializable + { + return new class() implements \JsonSerializable { + /** + * @inheritDoc + */ + public function jsonSerialize() + { + return [1, 2, 3]; + } + }; + } +} From 7fa8e4ca812c0d71bf237ac17c757b928bb4276e Mon Sep 17 00:00:00 2001 From: Lena Orobei <oorobei@magento.com> Date: Fri, 24 Jan 2020 14:58:28 -0600 Subject: [PATCH 0999/1143] magento/magento2#26391 MFTF: Add missing tests annotations - test fix --- .../Test/Mftf/ActionGroup/DeleteTermActionGroup.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/DeleteTermActionGroup.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/DeleteTermActionGroup.xml index b88101ce88ef6..13163e90efdbc 100644 --- a/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/DeleteTermActionGroup.xml +++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/ActionGroup/DeleteTermActionGroup.xml @@ -10,7 +10,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="DeleteTermActionGroup"> <arguments> - <argument name="term" /> + <argument name="term"/> </arguments> <amOnPage url="{{AdminTermsPage.url}}" stepKey="onTermGridPage"/> <waitForPageLoad stepKey="waitForAdminTermsGridPageLoad"/> @@ -19,8 +19,8 @@ <click selector="{{AdminTermGridSection.firstRowConditionId}}" stepKey="clickFirstRow"/> <waitForPageLoad stepKey="waitForEditTermPageLoad"/> <click selector="{{AdminEditTermFormSection.delete}}" stepKey="clickDeleteButton"/> + <waitForElementVisible selector="{{AdminEditTermFormSection.acceptPopupButton}}" stepKey="waitForElement"/> <click selector="{{AdminEditTermFormSection.acceptPopupButton}}" stepKey="clickDeleteOkButton"/> - <waitForPageLoad stepKey="waitForAdminTermsGridPageLoad2"/> - <see selector="{{AdminTermFormMessagesSection.successMessage}}" userInput="You deleted the condition." stepKey="seeSuccessMessage"/> + <waitForText selector="{{AdminTermFormMessagesSection.successMessage}}" userInput="You deleted the condition." stepKey="seeSuccessMessage"/> </actionGroup> -</actionGroups> \ No newline at end of file +</actionGroups> From 8c01f7c07550cd8d7bd564ceb1af7680723a4c9e Mon Sep 17 00:00:00 2001 From: Mastiuhin Olexandr <mastiuhin.olexandr@transoftgroup.com> Date: Sat, 25 Jan 2020 11:09:47 +0200 Subject: [PATCH 1000/1143] MC-30528: Inconsisten behavior when importing configurable products with custom options and when specifying store_view_code --- .../Model/Import/Product/Option.php | 25 +++++++---- .../Model/Import/ProductTest.php | 41 +++++++++++++++---- ...ustom_options_and_multiple_store_views.csv | 4 ++ 3 files changed, 54 insertions(+), 16 deletions(-) diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product/Option.php b/app/code/Magento/CatalogImportExport/Model/Import/Product/Option.php index 4c716421b7ae6..e12fc726f1056 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product/Option.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product/Option.php @@ -6,14 +6,14 @@ namespace Magento\CatalogImportExport\Model\Import\Product; -use Magento\CatalogImportExport\Model\Import\Product; -use Magento\Framework\App\ResourceConnection; -use Magento\ImportExport\Model\Import\ErrorProcessing\ProcessingErrorAggregatorInterface; use Magento\Catalog\Api\Data\ProductInterface; use Magento\Catalog\Model\ResourceModel\Product\Option\Value\Collection as ProductOptionValueCollection; use Magento\Catalog\Model\ResourceModel\Product\Option\Value\CollectionFactory as ProductOptionValueCollectionFactory; -use Magento\Store\Model\Store; +use Magento\CatalogImportExport\Model\Import\Product; +use Magento\Framework\App\ResourceConnection; use Magento\ImportExport\Model\Import; +use Magento\ImportExport\Model\Import\ErrorProcessing\ProcessingErrorAggregatorInterface; +use Magento\Store\Model\Store; /** * Entity class which provide possibility to import product custom options @@ -110,6 +110,13 @@ class Option extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity 'file' => ['sku', 'file_extension', 'image_size_x', 'image_size_y'], ]; + /** + * Invalid rows list + * + * @var array + */ + private $_invalidRows; + /** * Keep product id value for every row which will be imported * @@ -433,7 +440,7 @@ protected function _initMessageTemplates() self::ERROR_INVALID_TYPE, __( 'Value for \'type\' sub attribute in \'custom_options\' attribute contains incorrect value, acceptable values are: %1', - '\''.implode('\', \'', array_keys($this->_specificTypes)).'\'' + '\'' . implode('\', \'', array_keys($this->_specificTypes)) . '\'' ) ); $this->_productEntity->addMessageTemplate(self::ERROR_EMPTY_TITLE, __('Please enter a value for title.')); @@ -1251,7 +1258,9 @@ protected function _importData() $childCount = []; $optionsToRemove = []; foreach ($bunch as $rowNumber => $rowData) { - if (isset($optionId, $valueId) && empty($rowData[PRODUCT::COL_STORE_VIEW_CODE])) { + if (isset($optionId, $valueId) && + (empty($rowData[PRODUCT::COL_STORE_VIEW_CODE]) || empty($rowData['custom_options'])) + ) { $nextOptionId = $optionId; $nextValueId = $valueId; } @@ -1548,8 +1557,8 @@ protected function _collectOptionTitle(array $rowData, $prevOptionId, array &$ti if (!empty($rowData[self::COLUMN_TITLE])) { if (!isset($titles[$prevOptionId][$defaultStoreId])) { if (isset($this->lastOptionTitle[$prevOptionId])) { - $titles[$prevOptionId] = $this->lastOptionTitle[$prevOptionId]; - unset($this->lastOptionTitle); + $titles[$prevOptionId] = $this->lastOptionTitle[$prevOptionId]; + unset($this->lastOptionTitle); } else { $titles[$prevOptionId][$defaultStoreId] = $rowData[self::COLUMN_TITLE]; } diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php index fdbda7e817d56..9ef682e55f087 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php @@ -33,9 +33,9 @@ use Magento\ImportExport\Model\Import\Source\Csv; use Magento\Store\Model\Store; use Magento\Store\Model\StoreManagerInterface; +use Magento\TestFramework\Helper\Bootstrap as BootstrapHelper; use Magento\UrlRewrite\Model\ResourceModel\UrlRewriteCollection; use Psr\Log\LoggerInterface; -use Magento\TestFramework\Helper\Bootstrap as BootstrapHelper; /** * Class ProductTest @@ -403,7 +403,7 @@ public function testSaveCustomOptionsWithMultipleStoreViews() $pathToFile = __DIR__ . '/_files/' . $importFile; $importModel = $this->createImportModel($pathToFile); $errors = $importModel->validateData(); - $this->assertTrue($errors->getErrorsCount() == 0); + $this->assertTrue($errors->getErrorsCount() == 0, 'Import File Validation Failed'); $importModel->importData(); /** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */ $productRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( @@ -422,20 +422,41 @@ public function testSaveCustomOptionsWithMultipleStoreViews() $actualOptions = $actualData['options']; sort($expectedOptions); sort($actualOptions); - $this->assertEquals($expectedOptions, $actualOptions); + $this->assertEquals( + $expectedOptions, + $actualOptions, + 'Expected and actual options arrays does not match' + ); // assert of options data - $this->assertCount(count($expectedData['data']), $actualData['data']); - $this->assertCount(count($expectedData['values']), $actualData['values']); + $this->assertCount( + count($expectedData['data']), + $actualData['data'], + 'Expected and actual data count does not match' + ); + $this->assertCount( + count($expectedData['values']), + $actualData['values'], + 'Expected and actual values count does not match' + ); + foreach ($expectedData['options'] as $expectedId => $expectedOption) { $elementExist = false; // find value in actual options and values foreach ($actualData['options'] as $actualId => $actualOption) { if ($actualOption == $expectedOption) { $elementExist = true; - $this->assertEquals($expectedData['data'][$expectedId], $actualData['data'][$actualId]); + $this->assertEquals( + $expectedData['data'][$expectedId], + $actualData['data'][$actualId], + 'Expected data does not match actual data' + ); if (array_key_exists($expectedId, $expectedData['values'])) { - $this->assertEquals($expectedData['values'][$expectedId], $actualData['values'][$actualId]); + $this->assertEquals( + $expectedData['values'][$expectedId], + $actualData['values'][$actualId], + 'Expected values does not match actual data' + ); } unset($actualData['options'][$actualId]); // remove value in case of duplicating key values @@ -448,7 +469,11 @@ public function testSaveCustomOptionsWithMultipleStoreViews() // Make sure that after importing existing options again, option IDs and option value IDs are not changed $customOptionValues = $this->getCustomOptionValues($sku); $this->createImportModel($pathToFile)->importData(); - $this->assertEquals($customOptionValues, $this->getCustomOptionValues($sku)); + $this->assertEquals( + $customOptionValues, + $this->getCustomOptionValues($sku), + 'Option IDs changed after second import' + ); } } diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/product_with_custom_options_and_multiple_store_views.csv b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/product_with_custom_options_and_multiple_store_views.csv index d4c4130e946a4..17858531993db 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/product_with_custom_options_and_multiple_store_views.csv +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/product_with_custom_options_and_multiple_store_views.csv @@ -2,3 +2,7 @@ sku,website_code,store_view_code,attribute_set_code,product_type,name,descriptio simple,base,,Default,simple,New Product,,,9,1,"Catalog, Search","base,secondwebsite",,10,,,,Taxable Goods,new-product,,,,,,,,,,,,,,,,,,,,,,,,"name=Test Field Title,type=field,required=1,sku=1-text,price=100|name=Test Date and Time Title,type=date_time,required=1,sku=2-date,price=200|name=Test Select,type=drop_down,required=1,sku=3-1-select,price=310,option_title=Select Option 1|name=Test Select,type=drop_down,required=1,sku=3-2-select,price=320,option_title=Select Option 2|name=Test Checkbox,type=checkbox,required=1,sku=4-1-select,price=410,option_title=Checkbox Option 1|name=Test Checkbox,type=checkbox,required=1,sku=4-2-select,price=420,option_title=Checkbox Option 2|name=Test Radio,type=radio,required=1,sku=5-1-radio,price=510,option_title=Radio Option 1|name=Test Radio,type=radio,required=1,sku=5-2-radio,price=520,option_title=Radio Option 2",,1,1,999,0,0,0,1,10000,1,1,0,0,,,,,,,,,,,Block after Info Column,,, simple,,default,Default,simple,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"name=Test Field Title_default,type=field,sku=1-text|name=Test Date and Time Title_default,type=date_time,sku=2-date|name=Test Select_default,type=drop_down,sku=3-1-select,option_title=Select Option 1_default|name=Test Select_default,type=drop_down,sku=3-2-select,option_title=Select Option 2_default|name=Test Checkbox_default,type=checkbox,sku=4-1-select,option_title=Checkbox Option 1_default|name=Test Checkbox_default,type=checkbox,sku=4-2-select,option_title=Checkbox Option 2_default|name=Test Radio_default,type=radio,sku=5-1-radio,option_title=Radio Option 1_default|name=Test Radio_default,type=radio,sku=5-2-radio,option_title=Radio Option 2_default",,,,,,,,,,,,,,,,,,,,,,,,,,, simple,,secondstore,Default,simple,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"name=Test Field Title_fixture_second_store,type=field,sku=1-text,price=101|name=Test Date and Time Title_fixture_second_store,type=date_time,sku=2-date,price=201|name=Test Select_fixture_second_store,type=drop_down,sku=3-1-select,price=311,option_title=Select Option 1_fixture_second_store|name=Test Select_fixture_second_store,type=drop_down,sku=3-2-select,price=321,option_title=Select Option 2_fixture_second_store|name=Test Checkbox_second_store,type=checkbox,sku=4-1-select,price=411,option_title=Checkbox Option 1_second_store|name=Test Checkbox_second_store,type=checkbox,sku=4-2-select,price=421,option_title=Checkbox Option 2_second_store|name=Test Radio_fixture_second_store,type=radio,sku=5-1-radio,price=511,option_title=Radio Option 1_fixture_second_store|name=Test Radio_fixture_second_store,type=radio,sku=5-2-radio,price=521,option_title=Radio Option 2_fixture_second_store",,,,,,,,,,,,,,,,,,,,,,,,,,, +newprod2,base,secondstore,Default,configurable,New Product 2,,,9,1,"Catalog, Search","base,secondwebsite",,10,,,,Taxable Goods,new-product-2,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,999,0,0,0,1,10000,1,1,0,0,,,,,,,,,,,Block after Info Column,,, +newprod3,base,,Default,configurable,New Product 3,,,9,1,"Catalog, Search","base,secondwebsite",,10,,,,Taxable Goods,new-product-3,,,,,,,,,,,,,,,,,,,,,,,,"name=Line 1,type=field,max_characters=30,required=1,option_title=Line 1|name=Line 2,type=field,max_characters=30,required=0,option_title=Line 2",,1,1,999,0,0,0,1,10000,1,1,0,0,,,,,,,,,,,Block after Info Column,,, +newprod4,base,secondstore,Default,configurable,New Product 4,,,9,1,"Catalog, Search","base,secondwebsite",,10,,,,Taxable Goods,new-product-4,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,999,0,0,0,1,10000,1,1,0,0,,,,,,,,,,,Block after Info Column,,, +newprod5,base,,Default,configurable,New Product 5,,,9,1,"Catalog, Search","base,secondwebsite",,10,,,,Taxable Goods,new-product-5,,,,,,,,,,,,,,,,,,,,,,,,"name=Line 3,type=field,max_characters=30,required=1,option_title=Line 3|name=Line 4,type=field,max_characters=30,required=0,option_title=Line 4",,1,1,999,0,0,0,1,10000,1,1,0,0,,,,,,,,,,,Block after Info Column,,, From 345acd1375edc0674fb5cc805e83c1aa22a202d4 Mon Sep 17 00:00:00 2001 From: Ajith <ajithkumar.maragathavel@ziffity.com> Date: Sun, 26 Jan 2020 00:08:59 +0530 Subject: [PATCH 1001/1143] Covered admin cms block creatation with MFTF test --- .../Mftf/Test/AdminCreateCmsBlockTest.xml | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsBlockTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsBlockTest.xml index ef4a7575c35d3..6388e89b46a5a 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsBlockTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsBlockTest.xml @@ -49,4 +49,36 @@ <see userInput="You saved the block." stepKey="seeSavedBlockMsgOnGrid"/> <seeElement selector="div[data-role='grid-wrapper']" stepKey="seeGridPage" /> </test> + <test name="AdminCreateCmsBlockTest"> + <annotations> + <features value="Cms"/> + <stories value="CMS Block Creation and Reset Removal"/> + <title value="Admin should be able to create a CMS block"/> + <description value="Admin should be able to create a CMS block"/> + <severity value="CRITICAL"/> + <group value="Cms"/> + </annotations> + <before> + <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> + </before> + <after> + <actionGroup ref="deleteBlock" stepKey="deleteCreatedBlock"> + <argument name="Block" value="_defaultBlock"/> + </actionGroup> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <amOnPage url="{{CmsNewBlock.url}}" stepKey="amOnBlocksCreationForm"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + <!--Verify Save&Duplicate button and Save&Close button--> + <click selector="{{BlockNewPagePageActionsSection.expandSplitButton}}" stepKey="expandSplitBtn1" /> + <see selector="{{BlockNewPagePageActionsSection.saveAndDuplicate}}" userInput="Save & Duplicate" stepKey="seeSaveAndDuplicate"/> + <see selector="{{BlockNewPagePageActionsSection.saveAndClose}}" userInput="Save & Close" stepKey="seeSaveAndClose"/> + <!--Create new CMS Block page--> + <actionGroup ref="FillOutBlockContent" stepKey="FillOutBlockContent"/> + <click selector="{{BlockNewPagePageActionsSection.expandSplitButton}}" stepKey="expandSplitBtn2" /> + <click selector="{{BlockNewPagePageActionsSection.saveAndClose}}" stepKey="clickSaveAndClose" /> + <waitForPageLoad stepKey="waitForPageLoad3"/> + <see userInput="You saved the block." stepKey="seeSavedBlockMsgOnForm"/> + </test> </tests> From a7a619aa42527bdb0849edd8f2229588b496eca7 Mon Sep 17 00:00:00 2001 From: Ajith <ajithkumar.maragathavel@ziffity.com> Date: Sun, 26 Jan 2020 16:04:49 +0530 Subject: [PATCH 1002/1143] Action group added and MFTF test moved to seperate file --- ...rifyCmsBlockSaveSplitButtonActionGroup.xml | 23 ++++++++++++ .../Mftf/Test/AdminCreateCmsBlockTest.xml | 34 +----------------- .../Test/AdminSaveAndCloseCmsBlockTest.xml | 36 +++++++++++++++++++ 3 files changed, 60 insertions(+), 33 deletions(-) create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyCmsBlockSaveSplitButtonActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/Test/AdminSaveAndCloseCmsBlockTest.xml diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyCmsBlockSaveSplitButtonActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyCmsBlockSaveSplitButtonActionGroup.xml new file mode 100644 index 0000000000000..fee2f984c42d2 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyCmsBlockSaveSplitButtonActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="VerifyCmsBlockSaveSplitButtonActionGroup"> + <annotations> + <description>verify Save and Close and Save and Duplicate button.</description> + </annotations> + + <amOnPage url="{{CmsNewBlock.url}}" stepKey="amOnBlocksCreationForm"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + <!--Verify Save&Duplicate button and Save&Close button--> + <click selector="{{BlockNewPagePageActionsSection.expandSplitButton}}" stepKey="expandSplitBtn1" /> + <see selector="{{BlockNewPagePageActionsSection.saveAndDuplicate}}" userInput="Save & Duplicate" stepKey="seeSaveAndDuplicate"/> + <see selector="{{BlockNewPagePageActionsSection.saveAndClose}}" userInput="Save & Close" stepKey="seeSaveAndClose"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsBlockTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsBlockTest.xml index 6388e89b46a5a..131e467f021c8 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsBlockTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsBlockTest.xml @@ -49,36 +49,4 @@ <see userInput="You saved the block." stepKey="seeSavedBlockMsgOnGrid"/> <seeElement selector="div[data-role='grid-wrapper']" stepKey="seeGridPage" /> </test> - <test name="AdminCreateCmsBlockTest"> - <annotations> - <features value="Cms"/> - <stories value="CMS Block Creation and Reset Removal"/> - <title value="Admin should be able to create a CMS block"/> - <description value="Admin should be able to create a CMS block"/> - <severity value="CRITICAL"/> - <group value="Cms"/> - </annotations> - <before> - <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> - <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> - </before> - <after> - <actionGroup ref="deleteBlock" stepKey="deleteCreatedBlock"> - <argument name="Block" value="_defaultBlock"/> - </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> - </after> - <amOnPage url="{{CmsNewBlock.url}}" stepKey="amOnBlocksCreationForm"/> - <waitForPageLoad stepKey="waitForPageLoad1"/> - <!--Verify Save&Duplicate button and Save&Close button--> - <click selector="{{BlockNewPagePageActionsSection.expandSplitButton}}" stepKey="expandSplitBtn1" /> - <see selector="{{BlockNewPagePageActionsSection.saveAndDuplicate}}" userInput="Save & Duplicate" stepKey="seeSaveAndDuplicate"/> - <see selector="{{BlockNewPagePageActionsSection.saveAndClose}}" userInput="Save & Close" stepKey="seeSaveAndClose"/> - <!--Create new CMS Block page--> - <actionGroup ref="FillOutBlockContent" stepKey="FillOutBlockContent"/> - <click selector="{{BlockNewPagePageActionsSection.expandSplitButton}}" stepKey="expandSplitBtn2" /> - <click selector="{{BlockNewPagePageActionsSection.saveAndClose}}" stepKey="clickSaveAndClose" /> - <waitForPageLoad stepKey="waitForPageLoad3"/> - <see userInput="You saved the block." stepKey="seeSavedBlockMsgOnForm"/> - </test> -</tests> +</tests> \ No newline at end of file diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminSaveAndCloseCmsBlockTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminSaveAndCloseCmsBlockTest.xml new file mode 100644 index 0000000000000..8c89c47ab5077 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminSaveAndCloseCmsBlockTest.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminSaveAndCloseCmsBlockTest"> + <annotations> + <features value="Cms"/> + <stories value="CMS Block Creation and Reset Removal"/> + <title value="Admin should be able to create a CMS block"/> + <description value="Admin should be able to create a CMS block using save and close"/> + <severity value="CRITICAL"/> + <group value="Cms"/> + </annotations> + <before> + <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> + <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> + </before> + <after> + <actionGroup ref="deleteBlock" stepKey="deleteCreatedBlock"> + <argument name="Block" value="_defaultBlock"/> + </actionGroup> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!-- Navigate to create cms block page and verify save split button --> + <actionGroup ref="VerifyCmsBlockSaveSplitButtonActionGroup" stepKey="verifyCmsBlockSaveSplitButton" /> + <!--Create new CMS Block page--> + <actionGroup ref="FillOutBlockContent" stepKey="FillOutBlockContent"/> + <actionGroup ref="SaveAndCloseCMSBlockWithSplitButtonActionGroup" stepKey="saveCmsBlockContent" /> + </test> +</tests> \ No newline at end of file From 4e575713ce861e1aa08170081f2ace57f27029e3 Mon Sep 17 00:00:00 2001 From: Ajith <ajithkumar.maragathavel@ziffity.com> Date: Sun, 26 Jan 2020 22:14:51 +0530 Subject: [PATCH 1003/1143] Added action group for cms block duplication test --- ...cateCMSBlockWithSplitButtonActionGroup.xml | 23 +++++++++++++++++++ ...rifyCmsBlockSaveSplitButtonActionGroup.xml | 23 +++++++++++++++++++ .../Mftf/Test/AdminCreateCmsBlockTest.xml | 21 ++++++----------- 3 files changed, 53 insertions(+), 14 deletions(-) create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/SaveAndDuplicateCMSBlockWithSplitButtonActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyCmsBlockSaveSplitButtonActionGroup.xml diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/SaveAndDuplicateCMSBlockWithSplitButtonActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/SaveAndDuplicateCMSBlockWithSplitButtonActionGroup.xml new file mode 100644 index 0000000000000..625046d1a978b --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/SaveAndDuplicateCMSBlockWithSplitButtonActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SaveAndDuplicateCMSBlockWithSplitButtonActionGroup"> + <annotations> + <description>Clicks on the Save and Duplicate button.</description> + </annotations> + + <waitForElementVisible selector="{{BlockNewPagePageActionsSection.expandSplitButton}}" stepKey="waitForExpandSplitButtonToBeVisible"/> + <click selector="{{BlockNewPagePageActionsSection.expandSplitButton}}" stepKey="expandSplitButton"/> + <click selector="{{BlockNewPagePageActionsSection.saveAndDuplicate}}" stepKey="clickSaveAndDuplicate" /> + <waitForPageLoad stepKey="waitForPageLoadAfterClickingSave"/> + <see userInput="You saved the block." stepKey="assertSaveBlockSuccessMessage"/> + <see userInput="You duplicated the block." stepKey="seeDuplicatedBlockMsg"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyCmsBlockSaveSplitButtonActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyCmsBlockSaveSplitButtonActionGroup.xml new file mode 100644 index 0000000000000..fee2f984c42d2 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyCmsBlockSaveSplitButtonActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="VerifyCmsBlockSaveSplitButtonActionGroup"> + <annotations> + <description>verify Save and Close and Save and Duplicate button.</description> + </annotations> + + <amOnPage url="{{CmsNewBlock.url}}" stepKey="amOnBlocksCreationForm"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + <!--Verify Save&Duplicate button and Save&Close button--> + <click selector="{{BlockNewPagePageActionsSection.expandSplitButton}}" stepKey="expandSplitBtn1" /> + <see selector="{{BlockNewPagePageActionsSection.saveAndDuplicate}}" userInput="Save & Duplicate" stepKey="seeSaveAndDuplicate"/> + <see selector="{{BlockNewPagePageActionsSection.saveAndClose}}" userInput="Save & Close" stepKey="seeSaveAndClose"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsBlockTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsBlockTest.xml index ef4a7575c35d3..6867560551915 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsBlockTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsBlockTest.xml @@ -28,25 +28,18 @@ </actionGroup> <actionGroup ref="logout" stepKey="logout"/> </after> - <amOnPage url="{{CmsNewBlock.url}}" stepKey="amOnBlocksCreationForm"/> - <waitForPageLoad stepKey="waitForPageLoad1"/> - <!--Verify Save&Duplicate button and Save&Close button--> - <click selector="{{BlockNewPagePageActionsSection.expandSplitButton}}" stepKey="expandSplitBtn1" /> - <see selector="{{BlockNewPagePageActionsSection.saveAndDuplicate}}" userInput="Save & Duplicate" stepKey="seeSaveAndDuplicate"/> - <see selector="{{BlockNewPagePageActionsSection.saveAndClose}}" userInput="Save & Close" stepKey="seeSaveAndClose"/> + <!-- Navigate to create cms block page and verify save split button --> + <actionGroup ref="VerifyCmsBlockSaveSplitButtonActionGroup" stepKey="verifyCmsBlockSaveButton" /> <!--Create new CMS Block page--> <actionGroup ref="FillOutBlockContent" stepKey="FillOutBlockContent"/> - <click selector="{{BlockNewPagePageActionsSection.expandSplitButton}}" stepKey="expandSplitBtn2" /> - <click selector="{{BlockNewPagePageActionsSection.saveAndDuplicate}}" stepKey="clickSaveAndDuplicate" /> - <waitForPageLoad stepKey="waitForPageLoad3"/> - <see userInput="You saved the block." stepKey="seeSavedBlockMsgOnForm"/> - <see userInput="You duplicated the block." stepKey="seeDuplicatedBlockMsg"/> + <!-- Click save and duplicate action --> + <actionGroup ref="SaveAndDuplicateCMSBlockWithSplitButtonActionGroup" stepKey="clickSaveAndDuplicateButton" /> + <!--Verify duplicated CMS Block Page--> <seeElement selector="{{BlockNewPageBasicFieldsSection.isActive('0')}}" stepKey="seeBlockNotEnable" /> <actionGroup ref="AssertBlockContent" stepKey="assertContent"/> - <click selector="{{BlockNewPagePageActionsSection.expandSplitButton}}" stepKey="expandSplitBtn3" /> - <click selector="{{BlockNewPagePageActionsSection.saveAndClose}}" stepKey="clickSaveAndClose"/> - <see userInput="You saved the block." stepKey="seeSavedBlockMsgOnGrid"/> + <!-- Click save and close button --> + <actionGroup ref="SaveAndCloseCMSBlockWithSplitButtonActionGroup" stepKey="saveAndCloseAction" /> <seeElement selector="div[data-role='grid-wrapper']" stepKey="seeGridPage" /> </test> </tests> From e543d0a6c5580ae11e65e5789118d33dc9f47624 Mon Sep 17 00:00:00 2001 From: Karyna Tsymbal <k.tsymbal@atwix.com> Date: Sun, 26 Jan 2020 19:20:26 +0200 Subject: [PATCH 1004/1143] Replace dataProvider with separate methods --- .../Test/Unit/Observer/EventSaverTest.php | 45 +++++++------------ 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/app/code/Magento/Reports/Test/Unit/Observer/EventSaverTest.php b/app/code/Magento/Reports/Test/Unit/Observer/EventSaverTest.php index 8175887a33903..eebed5bfc0431 100644 --- a/app/code/Magento/Reports/Test/Unit/Observer/EventSaverTest.php +++ b/app/code/Magento/Reports/Test/Unit/Observer/EventSaverTest.php @@ -116,41 +116,30 @@ public function testSaveWithSubject() } /** - * Test save with no subject ID provided - * - * @param bool $isLoggedIn - * @dataProvider dataProviderTestSaveWithoutSubject + * Test save with no subject ID provided and customer is logged in */ - public function testSaveWithoutSubject(bool $isLoggedIn) + public function testSaveWithoutSubjectWhenLoggedIn() { - if ($isLoggedIn) { - $this->customerSessionMock->expects($this->once()) - ->method('isLoggedIn') - ->willReturn(true); - $this->customerSessionMock->expects($this->once()) - ->method('getCustomerId') - ->willReturn(1); - } else { - $this->customerSessionMock->expects($this->once()) - ->method('isLoggedIn') - ->willReturn(false); - $this->customerVisitorMock->expects($this->once()) - ->method('getId') - ->willReturn(2); - } + $this->customerSessionMock->expects($this->once()) + ->method('isLoggedIn') + ->willReturn(true); + $this->customerSessionMock->expects($this->once()) + ->method('getCustomerId') + ->willReturn(1); $this->eventSaver->save(1, 1, null); } /** - * Data provider for a case without subjectId provided - * - * @return array + * Test save with no subject ID provided and customer is not logged in */ - public function dataProviderTestSaveWithoutSubject() + public function testSaveWithoutSubjectForGuest() { - return [ - [true], - [false] - ]; + $this->customerSessionMock->expects($this->once()) + ->method('isLoggedIn') + ->willReturn(false); + $this->customerVisitorMock->expects($this->once()) + ->method('getId') + ->willReturn(2); + $this->eventSaver->save(1, 1, null); } } From fee5a139f2fe36c0c852a5592732c0f87a792187 Mon Sep 17 00:00:00 2001 From: Mayank <mayank@dolphinwebsolution.com> Date: Mon, 27 Jan 2020 12:20:15 +0530 Subject: [PATCH 1005/1143] Typo Mistake --- .../Block/Adminhtml/Order/Creditmemo/Create/Adjustments.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Create/Adjustments.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Create/Adjustments.php index 50d29c195968c..3af058ef978cf 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Create/Adjustments.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Create/Adjustments.php @@ -60,7 +60,7 @@ public function initTotals() { $parent = $this->getParentBlock(); $this->_source = $parent->getSource(); - $total = new \Magento\Framework\DataObject(['code' => 'agjustments', 'block_name' => $this->getNameInLayout()]); + $total = new \Magento\Framework\DataObject(['code' => 'adjustments', 'block_name' => $this->getNameInLayout()]); $parent->removeTotal('shipping'); $parent->removeTotal('adjustment_positive'); $parent->removeTotal('adjustment_negative'); From 51dff6e37c7abf6e9b4dd6a637caa9e0eb6574a7 Mon Sep 17 00:00:00 2001 From: Michele Fantetti <mfantetti@ittweb.net> Date: Mon, 27 Jan 2020 09:31:33 +0100 Subject: [PATCH 1006/1143] Add frontend template hints status command unit tests --- .../Command/TemplateHintsStatusCommand.php | 10 +-- .../TemplateHintsStatusCommandTest.php | 63 +++++++++++++++++++ 2 files changed, 64 insertions(+), 9 deletions(-) create mode 100644 app/code/Magento/Developer/Test/Unit/Console/Command/TemplateHintsStatusCommandTest.php diff --git a/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php b/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php index 5905f951aa2a1..01c4fe42e083e 100644 --- a/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php +++ b/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php @@ -67,7 +67,7 @@ protected function execute(InputInterface $input, OutputInterface $output) { $this->reinitableConfig->reinit(); $templateHintsStatus = - ($this->isTemplateHintsEnabled()) + $this->scopeConfig->isSetFlag(self::TEMPLATE_HINTS_STOREFRONT_PATH, 'default') ? 'enabled' : 'disabled'; $templateHintsMessage = __("Template hints are %status", ['status' => $templateHintsStatus]); @@ -75,12 +75,4 @@ protected function execute(InputInterface $input, OutputInterface $output) return Cli::RETURN_SUCCESS; } - - /** - * @return bool - */ - private function isTemplateHintsEnabled(): bool - { - return $this->scopeConfig->isSetFlag(self::TEMPLATE_HINTS_STOREFRONT_PATH, 'default'); - } } diff --git a/app/code/Magento/Developer/Test/Unit/Console/Command/TemplateHintsStatusCommandTest.php b/app/code/Magento/Developer/Test/Unit/Console/Command/TemplateHintsStatusCommandTest.php new file mode 100644 index 0000000000000..27f41a61f9202 --- /dev/null +++ b/app/code/Magento/Developer/Test/Unit/Console/Command/TemplateHintsStatusCommandTest.php @@ -0,0 +1,63 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Developer\Test\Unit\Console\Command; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Console\Tester\CommandTester; +use Magento\Developer\Console\Command\TemplateHintsStatusCommand; +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\App\Config\ReinitableConfigInterface; + +/** + * Class TemplateHintsStatusCommandTest + * + * Tests dev:template-hints:status command. + */ +class TemplateHintsStatusCommandTest extends TestCase +{ + /** + * @var TemplateHintsStatusCommand + */ + private $command; + + /** + * @var ScopeConfigInterface + */ + private $scopeConfigMock; + /** + * @var ReinitableConfigInterface + */ + private $reinitableConfigMock; + + protected function setUp() + { + $this->scopeConfigMock = $this->getMockForAbstractClass(ScopeConfigInterface::class); + $this->reinitableConfigMock = $this->getMockForAbstractClass(ReinitableConfigInterface::class); + + $this->command = new TemplateHintsStatusCommand( + $this->scopeConfigMock, + $this->reinitableConfigMock + ); + + } + + public function testExecute() + { + $tester = new CommandTester($this->command); + $tester->execute([]); + + $this->assertContains( + 'disabled', + $tester->getDisplay() + ); + + $this->assertEquals( + 0, + $tester->getStatusCode() + ); + } +} \ No newline at end of file From 55e2e64e98583cab40b79f97e9c515c439efbe28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Chitesh=40wagento=2Ecom=E2=80=9D?= <hitesh@wagento.com> Date: Mon, 27 Jan 2020 14:47:10 +0530 Subject: [PATCH 1007/1143] [fixed My Wish List Product not showing properly between >768px and <1023px] --- .../web/css/source/_module.less | 13 +++++++++++++ .../web/css/source/_module.less | 18 +++++++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/app/design/frontend/Magento/blank/Magento_Wishlist/web/css/source/_module.less b/app/design/frontend/Magento/blank/Magento_Wishlist/web/css/source/_module.less index 9cd0439c13956..b26abd2731131 100644 --- a/app/design/frontend/Magento/blank/Magento_Wishlist/web/css/source/_module.less +++ b/app/design/frontend/Magento/blank/Magento_Wishlist/web/css/source/_module.less @@ -53,6 +53,17 @@ } } + .products-grid.wishlist { + .product-item { + margin-left: 2%; + padding: 5px; + width: calc(~'(100% - 4%) / 3'); + &:nth-child(3n + 1) { + margin-left: 0; + } + } + } + .account .table-wrapper .data.table.wishlist { .lib-table-bordered( @_table_type: horizontal @@ -185,6 +196,8 @@ .products-grid.wishlist { .product-item { border-bottom: 1px solid @secondary__color; + margin: 0; + width: 100%; &:first-child { border-top: 1px solid @secondary__color; } diff --git a/app/design/frontend/Magento/luma/Magento_Wishlist/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Wishlist/web/css/source/_module.less index 85e8aeb0b515c..0c4be4dcd6c00 100644 --- a/app/design/frontend/Magento/luma/Magento_Wishlist/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_Wishlist/web/css/source/_module.less @@ -45,6 +45,17 @@ } } + .products-grid.wishlist { + .product-item { + margin-left: 2%; + padding: 5px; + width: calc(~'(100% - 4%) / 3'); + &:nth-child(3n + 1) { + margin-left: 0; + } + } + } + .account .table-wrapper .data.table.wishlist { .lib-table-bordered( @_table_type: horizontal @@ -183,7 +194,7 @@ } } .products-grid.wishlist { - .product-item-actions { + .product-item-actions { .action { &.edit, &.delete { @@ -216,7 +227,8 @@ .products-grid.wishlist { .product-item { border-bottom: 1px solid @secondary__color; - + margin: 0; + width: 100%; &:first-child { border-top: 1px solid @secondary__color; } @@ -253,7 +265,7 @@ &:last-child { margin-right: 0; } - + &.edit, &.delete { margin-top: 7px; From 0c00764f9fd1943da2620d7916c560a8d2ec98bc Mon Sep 17 00:00:00 2001 From: "rostyslav.hymon" <rostyslav.hymon@transoftgroup.com> Date: Mon, 27 Jan 2020 11:22:47 +0200 Subject: [PATCH 1008/1143] MC-30672: [Magento Cloud] Product Import Error --- app/code/Magento/CatalogImportExport/Model/Import/Product.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php index f7b15c9330fc5..ae5f0f5d79e2a 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php @@ -2521,7 +2521,7 @@ public function validateRow(array $rowData, $rowNum) $this->addRowError( ValidatorInterface::ERROR_DUPLICATE_URL_KEY, $rowNum, - $rowData[self::COL_NAME], + $urlKey, $message, $errorLevel ) From faf522f6dc56d8a87a913688e0f16d945d79f599 Mon Sep 17 00:00:00 2001 From: engcom-Echo <engcom-vendorworker-echo@adobe.com> Date: Mon, 27 Jan 2020 13:12:35 +0200 Subject: [PATCH 1009/1143] Cover unit test --- .../Model/Checkout/Type/MultishippingTest.php | 295 ++++++++++++++++-- 1 file changed, 262 insertions(+), 33 deletions(-) diff --git a/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/MultishippingTest.php b/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/MultishippingTest.php index fba3245bec68d..c3f0f1113fb5a 100644 --- a/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/MultishippingTest.php +++ b/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/MultishippingTest.php @@ -3,34 +3,40 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Multishipping\Test\Unit\Model\Checkout\Type; +use Magento\Catalog\Model\Product\Type; +use Magento\Catalog\Model\Product\Type\Simple; use Magento\Checkout\Model\Session; use Magento\Customer\Api\AddressRepositoryInterface; use Magento\Customer\Api\Data\AddressInterface; use Magento\Customer\Api\Data\AddressSearchResultsInterface; use Magento\Customer\Api\Data\CustomerInterface; -use Magento\Directory\Model\Currency; -use Magento\Multishipping\Model\Checkout\Type\Multishipping\PlaceOrderDefault; -use Magento\Multishipping\Model\Checkout\Type\Multishipping\PlaceOrderFactory; -use Magento\Quote\Model\Quote\Address; use Magento\Customer\Model\Session as CustomerSession; +use Magento\Directory\Model\AllowedCountries; +use Magento\Directory\Model\Currency; use Magento\Framework\Api\FilterBuilder; use Magento\Framework\Api\SearchCriteria; use Magento\Framework\Api\SearchCriteriaBuilder; use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\Event\ManagerInterface; +use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Pricing\PriceCurrencyInterface; use Magento\Framework\Session\Generic; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use Magento\Multishipping\Helper\Data; use Magento\Multishipping\Model\Checkout\Type\Multishipping; +use Magento\Multishipping\Model\Checkout\Type\Multishipping\PlaceOrderDefault; +use Magento\Multishipping\Model\Checkout\Type\Multishipping\PlaceOrderFactory; +use Magento\Payment\Model\Method\AbstractMethod; use Magento\Payment\Model\Method\SpecificationInterface; use Magento\Quote\Api\CartRepositoryInterface; use Magento\Quote\Api\Data\CartExtension; use Magento\Quote\Api\Data\CartExtensionFactory; use Magento\Quote\Model\Quote; +use Magento\Quote\Model\Quote\Address; use Magento\Quote\Model\Quote\Address as QuoteAddress; use Magento\Quote\Model\Quote\Address\Item as AddressItem; use Magento\Quote\Model\Quote\Address\ToOrder; @@ -38,22 +44,24 @@ use Magento\Quote\Model\Quote\AddressFactory; use Magento\Quote\Model\Quote\Item; use Magento\Quote\Model\Quote\Item\ToOrderItem; +use Magento\Quote\Model\Quote\Payment; use Magento\Quote\Model\Quote\Payment\ToOrderPayment; use Magento\Quote\Model\Quote\ShippingAssignment\ShippingAssignmentProcessor; use Magento\Quote\Model\Quote\TotalsCollector; use Magento\Quote\Model\Shipping; use Magento\Quote\Model\ShippingAssignment; +use Magento\Sales\Api\Data\OrderAddressInterface; +use Magento\Sales\Api\Data\OrderInterface; +use Magento\Sales\Api\Data\OrderPaymentInterface; use Magento\Sales\Model\Order\Email\Sender\OrderSender; use Magento\Sales\Model\OrderFactory; use Magento\Store\Model\Store; use Magento\Store\Model\StoreManagerInterface; use PHPUnit_Framework_MockObject_MockObject; -use \PHPUnit\Framework\TestCase; -use Magento\Quote\Model\Quote\Payment; -use Magento\Payment\Model\Method\AbstractMethod; -use Magento\Directory\Model\AllowedCountries; /** + * Test class Multishipping + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.TooManyFields) */ @@ -174,6 +182,9 @@ class MultishippingTest extends \PHPUnit\Framework\TestCase */ private $scopeConfigMock; + /** + * @inheritDoc + */ protected function setUp() { $this->checkoutSessionMock = $this->createSimpleMock(Session::class); @@ -265,7 +276,13 @@ protected function setUp() ); } - public function testSetShippingItemsInformation() + /** + * Verify set shipping items information. + * + * @return void + * @throws LocalizedException + */ + public function testSetShippingItemsInformation():void { $info = [ [ @@ -313,10 +330,13 @@ public function testSetShippingItemsInformation() } /** - * @expectedException \Magento\Framework\Exception\LocalizedException + * Verefi set shipping items information for address leak + * + * @return void + * @expectedException LocalizedException * @expectedExceptionMessage Verify the shipping address information and continue. */ - public function testSetShippingItemsInformationForAddressLeak() + public function testSetShippingItemsInformationForAddressLeak():void { $info = [ [ @@ -343,7 +363,13 @@ public function testSetShippingItemsInformationForAddressLeak() $this->assertEquals($this->model, $this->model->setShippingItemsInformation($info)); } - public function testUpdateQuoteCustomerShippingAddress() + /** + * Verify update quote customer shipping address. + * + * @return void + * @throws LocalizedException + */ + public function testUpdateQuoteCustomerShippingAddress():void { $addressId = 42; $customerAddressId = 42; @@ -359,10 +385,13 @@ public function testUpdateQuoteCustomerShippingAddress() } /** - * @expectedException \Magento\Framework\Exception\LocalizedException + * Verify update quote customer shipping address for address leak + * + * @return void + * @expectedException LocalizedException * @expectedExceptionMessage Verify the shipping address information and continue. */ - public function testUpdateQuoteCustomerShippingAddressForAddressLeak() + public function testUpdateQuoteCustomerShippingAddressForAddressLeak():void { $addressId = 43; $customerAddressId = 42; @@ -375,7 +404,13 @@ public function testUpdateQuoteCustomerShippingAddressForAddressLeak() $this->assertEquals($this->model, $this->model->updateQuoteCustomerShippingAddress($addressId)); } - public function testSetQuoteCustomerBillingAddress() + /** + * Verify set quote customer billing address. + * + * @return void + * @throws LocalizedException + */ + public function testSetQuoteCustomerBillingAddress():void { $addressId = 42; $customerAddressId = 42; @@ -389,10 +424,13 @@ public function testSetQuoteCustomerBillingAddress() } /** - * @expectedException \Magento\Framework\Exception\LocalizedException + * Verify set quote customer billing address for address leak. + * + * @return void + * @expectedException LocalizedException * @expectedExceptionMessage Verify the billing address information and continue. */ - public function testSetQuoteCustomerBillingAddressForAddressLeak() + public function testSetQuoteCustomerBillingAddressForAddressLeak():void { $addressId = 43; $customerAddressId = 42; @@ -405,7 +443,12 @@ public function testSetQuoteCustomerBillingAddressForAddressLeak() $this->assertEquals($this->model, $this->model->setQuoteCustomerBillingAddress($addressId)); } - public function testGetQuoteShippingAddressesItems() + /** + * Verify get quote shipping addresses items. + * + * @return void + */ + public function testGetQuoteShippingAddressesItems():void { $quoteItem = $this->getMockBuilder(AddressItem::class) ->disableOriginalConstructor() @@ -415,7 +458,13 @@ public function testGetQuoteShippingAddressesItems() $this->model->getQuoteShippingAddressesItems(); } - public function testSetShippingMethods() + /** + * Verify set shipping methods + * + * @return void + * @throws LocalizedException + */ + public function testSetShippingMethods():void { $methodsArray = [1 => 'flatrate_flatrate', 2 => 'tablerate_bestway']; $addressId = 1; @@ -444,12 +493,15 @@ public function testSetShippingMethods() } /** + * Verify create orders + * * @return void + * @throws \Exception */ public function testCreateOrders(): void { $addressTotal = 5; - $productType = \Magento\Catalog\Model\Product\Type::TYPE_SIMPLE; + $productType = Type::TYPE_SIMPLE; $infoBuyRequest = [ 'info_buyRequest' => [ 'product' => '1', @@ -460,7 +512,7 @@ public function testCreateOrders(): void $paymentProviderCode = 'checkmo'; $shippingPrice = '0.00'; $currencyCode = 'USD'; - $simpleProductTypeMock = $this->getMockBuilder(\Magento\Catalog\Model\Product\Type\Simple::class) + $simpleProductTypeMock = $this->getMockBuilder(Simple::class) ->disableOriginalConstructor() ->setMethods(['getOrderOptions']) ->getMock(); @@ -484,8 +536,8 @@ public function testCreateOrders(): void ->getMock(); $storeMock->method('getBaseCurrency')->willReturn($currencyMock); $storeMock->method('getCurrentCurrencyCode')->willReturn($currencyCode); - $orderAddressMock = $this->createSimpleMock(\Magento\Sales\Api\Data\OrderAddressInterface::class); - $orderPaymentMock = $this->createSimpleMock(\Magento\Sales\Api\Data\OrderPaymentInterface::class); + $orderAddressMock = $this->createSimpleMock(OrderAddressInterface::class); + $orderPaymentMock = $this->createSimpleMock(OrderPaymentInterface::class); $orderItemMock = $this->getMockBuilder(\Magento\Sales\Model\Order\Item::class) ->disableOriginalConstructor() ->setMethods(['getQuoteItemId']) @@ -499,7 +551,7 @@ public function testCreateOrders(): void $this->orderFactoryMock->expects($this->once())->method('create')->willReturn($orderMock); $this->dataObjectHelperMock->expects($this->once())->method('mergeDataObjects') ->with( - \Magento\Sales\Api\Data\OrderInterface::class, + OrderInterface::class, $orderMock, $orderMock )->willReturnSelf(); @@ -517,6 +569,7 @@ public function testCreateOrders(): void )->willReturn($orderAddressMock); $this->toOrderPaymentMock->method('convert')->willReturn($orderPaymentMock); $this->toOrderItemMock->method('convert')->with($quoteAddressItemMock)->willReturn($orderItemMock); + $this->quoteMock->expects($this->once())->method('collectTotals')->willReturnSelf(); $placeOrderServiceMock = $this->getMockBuilder(PlaceOrderDefault::class) ->disableOriginalConstructor() @@ -530,6 +583,117 @@ public function testCreateOrders(): void } /** + * Create orders verify exception message + * + * @param array $config + * + * @return void + * @dataProvider getConfigCreateOrders + * @throws \Exception + */ + public function testCreateOrdersWithThrowsException(array $config): void + { + $simpleProductTypeMock = $this->getMockBuilder(Simple::class) + ->disableOriginalConstructor() + ->setMethods(['getOrderOptions']) + ->getMock(); + $productMock = $this->getProductMock($simpleProductTypeMock); + $simpleProductTypeMock->method('getOrderOptions') + ->with($productMock) + ->willReturn($config['infoBuyRequest']); + $quoteItemMock = $this->getQuoteItemMock($config['productType'], $productMock); + $quoteAddressItemMock = + $this->getQuoteAddressItemMock($quoteItemMock, $config['productType'], $config['infoBuyRequest']); + list($shippingAddressMock, $billingAddressMock) = + $this->getQuoteAddressesMock($quoteAddressItemMock, $config['addressTotal']); + $this->setQuoteMockData($config['paymentProviderCode'], $shippingAddressMock, $billingAddressMock); + $currencyMock = $this->getMockBuilder(Currency::class) + ->disableOriginalConstructor() + ->setMethods([ 'convert' ]) + ->getMock(); + $currencyMock->method('convert') + ->willReturn($config['shippingPrice']); + $storeMock = $this->getMockBuilder(Store::class) + ->disableOriginalConstructor() + ->setMethods(['getBaseCurrency','getCurrentCurrencyCode' ]) + ->getMock(); + $storeMock->method('getBaseCurrency') + ->willReturn($currencyMock); + $storeMock->method('getCurrentCurrencyCode') + ->willReturn($config['currencyCode']); + $orderAddressMock = $this->createSimpleMock(OrderAddressInterface::class); + $orderPaymentMock = $this->createSimpleMock(OrderPaymentInterface::class); + $orderItemMock = $this->getMockBuilder(\Magento\Sales\Model\Order\Item::class) + ->disableOriginalConstructor() + ->setMethods(['getQuoteItemId']) + ->getMock(); + $orderItemMock->method('getQuoteItemId') + ->willReturn($config['quoteItemId']); + $orderMock = $this->getOrderMock($orderAddressMock, $orderPaymentMock, $orderItemMock); + $orderMock->expects($this->once()) + ->method('getStore') + ->willReturn($storeMock); + $orderMock->expects($this->once()) + ->method('setBaseShippingAmount') + ->with($config['shippingPrice'])->willReturnSelf(); + $orderMock->expects($this->once()) + ->method('setShippingAmount') + ->with($config['shippingPrice']) + ->willReturnSelf(); + $this->orderFactoryMock->expects($this->once()) + ->method('create') + ->willReturn($orderMock); + $this->dataObjectHelperMock->expects($this->once()) + ->method('mergeDataObjects') + ->with( + OrderInterface::class, + $orderMock, + $orderMock + )->willReturnSelf(); + $this->priceMock->expects($this->once()) + ->method('round') + ->with($config['addressTotal']) + ->willReturn($config['addressTotal']); + $this->toOrderMock->expects($this->once()) + ->method('convert') + ->with($shippingAddressMock) + ->willReturn($orderMock); + $this->toOrderAddressMock->expects($this->exactly(2))->method('convert') + ->withConsecutive( + [$billingAddressMock, []], + [$shippingAddressMock, []] + )->willReturn($orderAddressMock); + $this->toOrderPaymentMock->method('convert') + ->willReturn($orderPaymentMock); + $this->toOrderItemMock->method('convert') + ->with($quoteAddressItemMock) + ->willReturn($orderItemMock); + $placeOrderServiceMock = $this->getMockBuilder(PlaceOrderDefault::class) + ->disableOriginalConstructor() + ->setMethods(['place']) + ->getMock(); + $placeOrderServiceMock->method('place') + ->with([$orderMock]) + ->willReturn([$config['quoteId'] => new \Exception()]); + $this->quoteMock->expects($this->any()) + ->method('__call') + ->willReturnSelf(); + $this->placeOrderFactoryMock->method('create') + ->with($config['paymentProviderCode']) + ->willReturn($placeOrderServiceMock); + $this->quoteMock->expects($this->exactly(2)) + ->method('collectTotals') + ->willReturnSelf(); + $this->quoteRepositoryMock->expects($this->once()) + ->method('save') + ->with($this->quoteMock); + $this->expectExceptionMessage('Quote address for failed order ID "1" not found.'); + $this->model->createOrders(); + } + + /** + * Return Payment Mock. + * * @param string $paymentProviderCode * @return PHPUnit_Framework_MockObject_MockObject */ @@ -552,7 +716,9 @@ private function getPaymentMock(string $paymentProviderCode): PHPUnit_Framework_ } /** - * @param \Magento\Catalog\Model\Product\Type\Simple|PHPUnit_Framework_MockObject_MockObject $simpleProductTypeMock + * Return Product Mock. + * + * @param Simple|PHPUnit_Framework_MockObject_MockObject $simpleProductTypeMock * @return PHPUnit_Framework_MockObject_MockObject */ private function getProductMock($simpleProductTypeMock): PHPUnit_Framework_MockObject_MockObject @@ -567,6 +733,8 @@ private function getProductMock($simpleProductTypeMock): PHPUnit_Framework_MockO } /** + * Return Quote Item Mock. + * * @param string $productType * @param \Magento\Catalog\Model\Product|PHPUnit_Framework_MockObject_MockObject $productMock * @return PHPUnit_Framework_MockObject_MockObject @@ -584,6 +752,8 @@ private function getQuoteItemMock($productType, $productMock): PHPUnit_Framework } /** + * Return Quote Address Item Mock + * * @param \Magento\Quote\Model\Quote\Item|PHPUnit_Framework_MockObject_MockObject $quoteItemMock * @param string $productType * @param array $infoBuyRequest @@ -607,6 +777,7 @@ private function getQuoteAddressItemMock( } /** + * Return Quote Addresses Mock * @param \Magento\Quote\Model\Quote\Address\Item|PHPUnit_Framework_MockObject_MockObject $quoteAddressItemMock * @param int $addressTotal * @return array @@ -650,6 +821,8 @@ private function getQuoteAddressesMock($quoteAddressItemMock, int $addressTotal) } /** + * Set data for Quote Mock. + * * @param string $paymentProviderCode * @param Address|PHPUnit_Framework_MockObject_MockObject $shippingAddressMock * @param Address|PHPUnit_Framework_MockObject_MockObject $billingAddressMock @@ -669,14 +842,15 @@ private function setQuoteMockData(string $paymentProviderCode, $shippingAddressM $this->quoteMock->method('hasVirtualItems') ->willReturn(false); $this->quoteMock->expects($this->once())->method('reserveOrderId')->willReturnSelf(); - $this->quoteMock->expects($this->once())->method('collectTotals')->willReturnSelf(); $this->quoteMock->method('getId')->willReturn($quoteId); $this->quoteMock->method('setIsActive')->with(false)->willReturnSelf(); } /** - * @param \Magento\Sales\Api\Data\OrderAddressInterface|PHPUnit_Framework_MockObject_MockObject $orderAddressMock - * @param \Magento\Sales\Api\Data\OrderPaymentInterface|PHPUnit_Framework_MockObject_MockObject $orderPaymentMock + * Return Order Mock. + * + * @param OrderAddressInterface|PHPUnit_Framework_MockObject_MockObject $orderAddressMock + * @param OrderPaymentInterface|PHPUnit_Framework_MockObject_MockObject $orderPaymentMock * @param \Magento\Sales\Model\Order\Item|PHPUnit_Framework_MockObject_MockObject $orderItemMock * @return PHPUnit_Framework_MockObject_MockObject */ @@ -696,6 +870,7 @@ private function getOrderMock( 'addItem', 'getIncrementId', 'getId', + 'getEntityId', 'getCanSendNewEmailFlag', 'getItems', 'setShippingMethod', @@ -712,6 +887,7 @@ private function getOrderMock( $orderMock->method('addItem')->with($orderItemMock)->willReturnSelf(); $orderMock->method('getIncrementId')->willReturn('1'); $orderMock->method('getId')->willReturn('1'); + $orderMock->method('getEntityId')->willReturn('1'); $orderMock->method('getCanSendNewEmailFlag')->willReturn(false); $orderMock->method('getItems')->willReturn([$orderItemMock]); @@ -721,10 +897,12 @@ private function getOrderMock( /** * Tests exception for addresses with country id not in the allowed countries list. * - * @expectedException \Magento\Framework\Exception\LocalizedException + * @return void + * @expectedException LocalizedException * @expectedExceptionMessage Some addresses can't be used due to the configurations for specific countries. + * @throws \Exception */ - public function testCreateOrdersCountryNotPresentInAllowedListException() + public function testCreateOrdersCountryNotPresentInAllowedListException():void { $abstractMethod = $this->getMockBuilder(AbstractMethod::class) ->disableOriginalConstructor() @@ -762,6 +940,8 @@ public function testCreateOrdersCountryNotPresentInAllowedListException() } /** + * Return Extension Attributes Mock. + * * @param ShippingAssignment $shippingAssignmentMock * @return CartExtension|PHPUnit_Framework_MockObject_MockObject */ @@ -781,6 +961,8 @@ private function getExtensionAttributesMock(ShippingAssignment $shippingAssignme } /** + * Return Shipping Assignment Mock. + * * @return ShippingAssignment | PHPUnit_Framework_MockObject_MockObject */ private function getShippingAssignmentMock() @@ -801,7 +983,12 @@ private function getShippingAssignmentMock() return $shippingAssignmentMock; } - private function mockShippingAssignment() + /** + * Expected shipping assignment + * + * @return void + */ + private function mockShippingAssignment():void { $shippingAssignmentMock = $this->getShippingAssignmentMock(); @@ -825,6 +1012,8 @@ private function mockShippingAssignment() } /** + * Return Customer Address Mock + * * @param $customerAddressId * @return Address | PHPUnit_Framework_MockObject_MockObject */ @@ -842,6 +1031,8 @@ private function getCustomerAddressMock($customerAddressId) } /** + * Return Simple Mock. + * * @param string $className * @return PHPUnit_Framework_MockObject_MockObject */ @@ -852,7 +1043,12 @@ private function createSimpleMock($className) ->getMock(); } - public function testValidateMinimumAmountMultiAddressTrue() + /** + * Verify validate minimum amount multi address is true. + * + * @return void + */ + public function testValidateMinimumAmountMultiAddressTrue():void { $this->scopeConfigMock->expects($this->exactly(2))->method('isSetFlag')->withConsecutive( ['sales/minimum_order/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE], @@ -864,7 +1060,12 @@ public function testValidateMinimumAmountMultiAddressTrue() $this->assertFalse($this->model->validateMinimumAmount()); } - public function testValidateMinimumAmountMultiAddressFalse() + /** + * Verify validate minimum amount multi address is false. + * + * @return void + */ + public function testValidateMinimumAmountMultiAddressFalse():void { $addressMock = $this->createMock(\Magento\Quote\Model\Quote\Address::class); $this->scopeConfigMock->expects($this->exactly(2))->method('isSetFlag')->withConsecutive( @@ -884,4 +1085,32 @@ public function testValidateMinimumAmountMultiAddressFalse() $this->assertTrue($this->model->validateMinimumAmount()); } + + /** + * Data provider + * + * @return array + */ + public function getConfigCreateOrders(): array + { + return [ + [ + [ + 'quoteId' => 1, + 'addressTotal' => 5, + 'productType' => Type::TYPE_SIMPLE, + 'infoBuyRequest'=> [ + 'info_buyRequest' => [ + 'product' => '1', + 'qty' => 1, + ], + ], + 'quoteItemId' => 1, + 'paymentProviderCode' => 'checkmo', + 'shippingPrice' => '0.00', + 'currencyCode' => 'USD', + ] + ] + ]; + } } From 28d078c29122435ab3220c7aaf7a1d6004b657b0 Mon Sep 17 00:00:00 2001 From: vadim <vadim@example.com> Date: Mon, 27 Jan 2020 13:15:40 +0200 Subject: [PATCH 1010/1143] Unit test coverage --- .../Magento/Analytics/Test/Unit/Model/ConnectorTest.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Analytics/Test/Unit/Model/ConnectorTest.php b/app/code/Magento/Analytics/Test/Unit/Model/ConnectorTest.php index 714d0daf5c419..90f6fa1643660 100644 --- a/app/code/Magento/Analytics/Test/Unit/Model/ConnectorTest.php +++ b/app/code/Magento/Analytics/Test/Unit/Model/ConnectorTest.php @@ -57,9 +57,13 @@ public function testExecute() } /** + * Executing non-existing command + * * @expectedException \Magento\Framework\Exception\NotFoundException + * @expectedExceptionMessage Command "register" was not found. + * @return void */ - public function testExecuteCommandNotFound() + public function testExecuteCommandNotFound(): void { $commandName = 'register'; $this->connector->execute($commandName); From 5b9b16309a87bcc826ae883dd5a1ea70f162c8b1 Mon Sep 17 00:00:00 2001 From: Sathish <srsathish92@gmail.com> Date: Mon, 27 Jan 2020 16:51:48 +0530 Subject: [PATCH 1011/1143] [Fedex] covered model source generic by unit test & removed deprecated class --- .../Magento/Fedex/Model/Source/Generic.php | 9 +- .../Test/Unit/Model/Source/GenericTest.php | 94 +++++++++++++++++++ 2 files changed, 100 insertions(+), 3 deletions(-) create mode 100644 app/code/Magento/Fedex/Test/Unit/Model/Source/GenericTest.php diff --git a/app/code/Magento/Fedex/Model/Source/Generic.php b/app/code/Magento/Fedex/Model/Source/Generic.php index f245685ce0274..b624c5e5cea15 100644 --- a/app/code/Magento/Fedex/Model/Source/Generic.php +++ b/app/code/Magento/Fedex/Model/Source/Generic.php @@ -5,7 +5,7 @@ */ namespace Magento\Fedex\Model\Source; -class Generic implements \Magento\Framework\Option\ArrayInterface +class Generic implements \Magento\Framework\Data\OptionSourceInterface { /** * @var \Magento\Fedex\Model\Carrier @@ -36,9 +36,12 @@ public function toOptionArray() { $configData = $this->_shippingFedex->getCode($this->_code); $arr = []; - foreach ($configData as $code => $title) { - $arr[] = ['value' => $code, 'label' => $title]; + if($configData) { + foreach ($configData as $code => $title) { + $arr[] = ['value' => $code, 'label' => $title]; + } } + return $arr; } } diff --git a/app/code/Magento/Fedex/Test/Unit/Model/Source/GenericTest.php b/app/code/Magento/Fedex/Test/Unit/Model/Source/GenericTest.php new file mode 100644 index 0000000000000..ac63442124920 --- /dev/null +++ b/app/code/Magento/Fedex/Test/Unit/Model/Source/GenericTest.php @@ -0,0 +1,94 @@ +<?php + +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\Fedex\Test\Unit\Model\Source; + +use Magento\Fedex\Model\Source\Generic; +use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\MockObject\MockObject; +use Magento\Fedex\Model\Carrier; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; + +/** + * Unit test for Magento\Fedex\Test\Unit\Model\Source\Generic + */ +class GenericTest extends TestCase +{ + /** + * @var Generic + */ + private $model; + + /** + * @var Carrier|MockObject + */ + private $shippingFedexMock; + + /** + * @inheritdoc + */ + protected function setUp(): void + { + $this->shippingFedexMock = $this->createMock(Carrier::class); + + $objectManager = new ObjectManagerHelper($this); + $this->model = $objectManager->getObject( + Generic::class, + [ + 'shippingFedex' => $this->shippingFedexMock + ] + ); + } + + /** + * Test toOptionArray + * + * @param string $code + * @param array|false $methods + * @param array $result + * @return void + * @dataProvider toOptionArrayDataProvider + */ + public function testToOptionArray($code, $methods, $result): void + { + $this->model->code = $code; + $this->shippingFedexMock->expects($this->once()) + ->method('getCode') + ->willReturn($methods); + + $this->assertEquals($result, $this->model->toOptionArray()); + } + + /** + * Data provider for testToOptionArray() + * + * @return array + */ + public function toOptionArrayDataProvider(): array + { + return [ + [ + 'method', + [ + 'FEDEX_GROUND' => __('Ground'), + 'FIRST_OVERNIGHT' => __('First Overnight') + ], + [ + ['value' => 'FEDEX_GROUND', 'label' => __('Ground')], + ['value' => 'FIRST_OVERNIGHT', 'label' => __('First Overnight')] + ] + ], + [ + '', + false, + [] + ] + ]; + } +} From 3e2ea3a54e0568e2971fee7df3591a54f40e8b7d Mon Sep 17 00:00:00 2001 From: Oleh Usik <o.usik@atwix.com> Date: Mon, 27 Jan 2020 13:44:37 +0200 Subject: [PATCH 1012/1143] rename ActionGroup --- ...AdminNewsletterConfigFieldSetGuestNotAllowedActionGroup.xml} | 2 +- .../VerifyRegistredLinkDisplayedForGuestSubscriptionNoTest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename app/code/Magento/Newsletter/Test/Mftf/ActionGroup/{AssertAdminNewsletterConfigFieldGuestNotAllowedActionGroup.xml => AdminNewsletterConfigFieldSetGuestNotAllowedActionGroup.xml} (91%) diff --git a/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/AssertAdminNewsletterConfigFieldGuestNotAllowedActionGroup.xml b/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/AdminNewsletterConfigFieldSetGuestNotAllowedActionGroup.xml similarity index 91% rename from app/code/Magento/Newsletter/Test/Mftf/ActionGroup/AssertAdminNewsletterConfigFieldGuestNotAllowedActionGroup.xml rename to app/code/Magento/Newsletter/Test/Mftf/ActionGroup/AdminNewsletterConfigFieldSetGuestNotAllowedActionGroup.xml index 73fb9de740ba7..a6242797cf3c6 100644 --- a/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/AssertAdminNewsletterConfigFieldGuestNotAllowedActionGroup.xml +++ b/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/AdminNewsletterConfigFieldSetGuestNotAllowedActionGroup.xml @@ -8,7 +8,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AssertAdminNewsletterConfigFieldGuestNotAllowedActionGroup"> + <actionGroup name="AdminNewsletterConfigFieldSetGuestNotAllowedActionGroup"> <amOnPage url="{{AdminNewsletterConfigPage.url}}" stepKey="amOnNewsletterConfigPage"/> <waitForPageLoad stepKey="waitForPageLoad"/> <click selector="{{AdminNewsletterConfigPageSubscriptionOptionsSection.allowGuestSubscription}}" stepKey="allowEdit"/> diff --git a/app/code/Magento/Newsletter/Test/Mftf/Test/VerifyRegistredLinkDisplayedForGuestSubscriptionNoTest.xml b/app/code/Magento/Newsletter/Test/Mftf/Test/VerifyRegistredLinkDisplayedForGuestSubscriptionNoTest.xml index f4dc370391b64..6565c2a167ba2 100644 --- a/app/code/Magento/Newsletter/Test/Mftf/Test/VerifyRegistredLinkDisplayedForGuestSubscriptionNoTest.xml +++ b/app/code/Magento/Newsletter/Test/Mftf/Test/VerifyRegistredLinkDisplayedForGuestSubscriptionNoTest.xml @@ -13,7 +13,7 @@ <!--Log in to Magento as admin.--> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <!--Allow Guest Subscription NO--> - <actionGroup ref="AssertAdminNewsletterConfigFieldGuestNotAllowedActionGroup" stepKey="amOnNewsletterConfigField"/> + <actionGroup ref="AdminNewsletterConfigFieldSetGuestNotAllowedActionGroup" stepKey="amOnNewsletterConfigField"/> <!--Log out from Magento admin.--> <actionGroup ref="logout" stepKey="logoutFromAdmin"/> </before> From 680021bc33d3e581bf5d66cbba73a1326caa1617 Mon Sep 17 00:00:00 2001 From: Sathish <srsathish92@gmail.com> Date: Mon, 27 Jan 2020 17:40:38 +0530 Subject: [PATCH 1013/1143] Static test fix --- app/code/Magento/Fedex/Model/Source/Generic.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Fedex/Model/Source/Generic.php b/app/code/Magento/Fedex/Model/Source/Generic.php index b624c5e5cea15..ba747db9f4470 100644 --- a/app/code/Magento/Fedex/Model/Source/Generic.php +++ b/app/code/Magento/Fedex/Model/Source/Generic.php @@ -3,6 +3,12 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + + /** + * Fedex generic source implementation + * + * @author Magento Core Team <core@magentocommerce.com> + */ namespace Magento\Fedex\Model\Source; class Generic implements \Magento\Framework\Data\OptionSourceInterface @@ -36,7 +42,7 @@ public function toOptionArray() { $configData = $this->_shippingFedex->getCode($this->_code); $arr = []; - if($configData) { + if ($configData) { foreach ($configData as $code => $title) { $arr[] = ['value' => $code, 'label' => $title]; } From 0340713d242b1126fd5962ef3fd7c4049c443efa Mon Sep 17 00:00:00 2001 From: Sathish <srsathish92@gmail.com> Date: Mon, 27 Jan 2020 18:11:02 +0530 Subject: [PATCH 1014/1143] Static test fix --- app/code/Magento/Fedex/Model/Source/Generic.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Fedex/Model/Source/Generic.php b/app/code/Magento/Fedex/Model/Source/Generic.php index ba747db9f4470..b1c1c0aedb863 100644 --- a/app/code/Magento/Fedex/Model/Source/Generic.php +++ b/app/code/Magento/Fedex/Model/Source/Generic.php @@ -1,16 +1,17 @@ <?php + /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - /** - * Fedex generic source implementation - * - * @author Magento Core Team <core@magentocommerce.com> - */ namespace Magento\Fedex\Model\Source; +/** + * Fedex generic source implementation + * + * @author Magento Core Team <core@magentocommerce.com> + */ class Generic implements \Magento\Framework\Data\OptionSourceInterface { /** From d6316cfe9c5ec70cf99689b26c452a2b28986a4e Mon Sep 17 00:00:00 2001 From: Oleh Usik <o.usik@atwix.com> Date: Mon, 27 Jan 2020 14:41:04 +0200 Subject: [PATCH 1015/1143] added minor changes --- ...VerifyRegistredLinkDisplayedForGuestSubscriptionNoTest.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Newsletter/Test/Mftf/Test/VerifyRegistredLinkDisplayedForGuestSubscriptionNoTest.xml b/app/code/Magento/Newsletter/Test/Mftf/Test/VerifyRegistredLinkDisplayedForGuestSubscriptionNoTest.xml index 6565c2a167ba2..0780363b682cd 100644 --- a/app/code/Magento/Newsletter/Test/Mftf/Test/VerifyRegistredLinkDisplayedForGuestSubscriptionNoTest.xml +++ b/app/code/Magento/Newsletter/Test/Mftf/Test/VerifyRegistredLinkDisplayedForGuestSubscriptionNoTest.xml @@ -11,11 +11,11 @@ <test name="VerifyRegistredLinkDisplayedForGuestSubscriptionNoTest"> <before> <!--Log in to Magento as admin.--> - <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <actionGroup ref="LoginActionGroup" stepKey="loginAsAdmin"/> <!--Allow Guest Subscription NO--> <actionGroup ref="AdminNewsletterConfigFieldSetGuestNotAllowedActionGroup" stepKey="amOnNewsletterConfigField"/> <!--Log out from Magento admin.--> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </before> <actionGroup ref="StorefrontCreateNewSubscriberActionGroup" stepKey="createSubscriber"/> </test> From 49eceb82c67d6b589fd9dee0680d4eaf7d011967 Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Mon, 27 Jan 2020 14:49:44 +0200 Subject: [PATCH 1016/1143] MC-30794: Recently Viewed products issues in does not work on store view level --- .../Catalog/Block/Ui/ProductViewCounter.php | 32 +++++++++++++++---- .../Catalog/CustomerData/CompareProducts.php | 28 ++++++++++++++-- .../Unit/Block/Ui/ProductViewCounterTest.php | 24 ++++++++++---- .../Unit/CustomerData/CompareProductsTest.php | 26 ++++++++++++--- .../Product/Listing/DataProvider.php | 16 +++++++++- .../ui_component/widget_recently_compared.xml | 1 + .../ui_component/widget_recently_viewed.xml | 1 + .../view/frontend/web/js/product/provider.js | 14 +++++--- .../js/product/storage/ids-storage-compare.js | 24 ++++++++++---- .../frontend/web/js/product/view/provider.js | 10 ++++-- .../Magento/Checkout/Block/Cart/Sidebar.php | 3 +- .../Test/Unit/Block/Cart/SidebarTest.php | 3 +- 12 files changed, 145 insertions(+), 37 deletions(-) diff --git a/app/code/Magento/Catalog/Block/Ui/ProductViewCounter.php b/app/code/Magento/Catalog/Block/Ui/ProductViewCounter.php index dd2e23e67f3d7..6d96ba8e1880e 100644 --- a/app/code/Magento/Catalog/Block/Ui/ProductViewCounter.php +++ b/app/code/Magento/Catalog/Block/Ui/ProductViewCounter.php @@ -6,15 +6,17 @@ namespace Magento\Catalog\Block\Ui; use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Catalog\Model\ProductRenderFactory; +use Magento\Catalog\Model\ProductRepository; use Magento\Catalog\Ui\DataProvider\Product\ProductRenderCollectorComposite; +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\EntityManager\Hydrator; use Magento\Framework\Registry; use Magento\Framework\Serialize\SerializerInterface; use Magento\Framework\Url; use Magento\Framework\View\Element\Template; use Magento\Store\Model\Store; -use Magento\Catalog\Model\ProductRenderFactory; -use Magento\Catalog\Model\ProductRepository; -use Magento\Framework\EntityManager\Hydrator; use Magento\Store\Model\StoreManager; /** @@ -25,6 +27,7 @@ * * @api * @since 101.1.0 + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class ProductViewCounter extends Template { @@ -68,6 +71,13 @@ class ProductViewCounter extends Template */ private $registry; + /** + * Core store config + * + * @var ScopeConfigInterface + */ + private $scopeConfig; + /** * @param Template\Context $context * @param ProductRepository $productRepository @@ -78,6 +88,8 @@ class ProductViewCounter extends Template * @param SerializerInterface $serialize * @param Url $url * @param Registry $registry + * @param ScopeConfigInterface|null $scopeConfig + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( Template\Context $context, @@ -88,7 +100,8 @@ public function __construct( Hydrator $hydrator, SerializerInterface $serialize, Url $url, - Registry $registry + Registry $registry, + ?ScopeConfigInterface $scopeConfig = null ) { parent::__construct($context); $this->productRepository = $productRepository; @@ -99,6 +112,7 @@ public function __construct( $this->serialize = $serialize; $this->url = $url; $this->registry = $registry; + $this->scopeConfig = $scopeConfig ?? ObjectManager::getInstance()->get(ScopeConfigInterface::class); } /** @@ -116,6 +130,10 @@ public function getCurrentProductData() { /** @var ProductInterface $product */ $product = $this->registry->registry('product'); + $productsScope = $this->scopeConfig->getValue( + 'catalog/recently_products/scope', + \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE + ); /** @var Store $store */ $store = $this->storeManager->getStore(); @@ -123,7 +141,8 @@ public function getCurrentProductData() return $this->serialize->serialize([ 'items' => [], 'store' => $store->getId(), - 'currency' => $store->getCurrentCurrency()->getCode() + 'currency' => $store->getCurrentCurrency()->getCode(), + 'productCurrentScope' => $productsScope ]); } @@ -140,7 +159,8 @@ public function getCurrentProductData() $product->getId() => $data ], 'store' => $store->getId(), - 'currency' => $store->getCurrentCurrency()->getCode() + 'currency' => $store->getCurrentCurrency()->getCode(), + 'productCurrentScope' => $productsScope ]; return $this->serialize->serialize($currentProductData); diff --git a/app/code/Magento/Catalog/CustomerData/CompareProducts.php b/app/code/Magento/Catalog/CustomerData/CompareProducts.php index afbeab8c9070e..bdac4dfde64d1 100644 --- a/app/code/Magento/Catalog/CustomerData/CompareProducts.php +++ b/app/code/Magento/Catalog/CustomerData/CompareProducts.php @@ -6,7 +6,13 @@ namespace Magento\Catalog\CustomerData; use Magento\Customer\CustomerData\SectionSourceInterface; +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\Exception\LocalizedException; +/** + * Catalog Product Compare Widget + */ class CompareProducts implements SectionSourceInterface { /** @@ -24,23 +30,33 @@ class CompareProducts implements SectionSourceInterface */ private $outputHelper; + /** + * Core store config + * + * @var ScopeConfigInterface + */ + private $scopeConfig; + /** * @param \Magento\Catalog\Helper\Product\Compare $helper * @param \Magento\Catalog\Model\Product\Url $productUrl * @param \Magento\Catalog\Helper\Output $outputHelper + * @param ScopeConfigInterface|null $scopeConfig */ public function __construct( \Magento\Catalog\Helper\Product\Compare $helper, \Magento\Catalog\Model\Product\Url $productUrl, - \Magento\Catalog\Helper\Output $outputHelper + \Magento\Catalog\Helper\Output $outputHelper, + ?ScopeConfigInterface $scopeConfig = null ) { $this->helper = $helper; $this->productUrl = $productUrl; $this->outputHelper = $outputHelper; + $this->scopeConfig = $scopeConfig ?? ObjectManager::getInstance()->get(ScopeConfigInterface::class); } /** - * {@inheritdoc} + * @inheritdoc */ public function getSectionData() { @@ -54,11 +70,18 @@ public function getSectionData() } /** + * Get the list of compared product items + * * @return array + * @throws LocalizedException */ protected function getItems() { $items = []; + $productsScope = $this->scopeConfig->getValue( + 'catalog/recently_products/scope', + \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE + ); /** @var \Magento\Catalog\Model\Product $item */ foreach ($this->helper->getItemCollection() as $item) { $items[] = [ @@ -66,6 +89,7 @@ protected function getItems() 'product_url' => $this->productUrl->getUrl($item), 'name' => $this->outputHelper->productAttribute($item, $item->getName(), 'name'), 'remove_url' => $this->helper->getPostDataRemove($item), + 'productScope' => $productsScope ]; } return $items; diff --git a/app/code/Magento/Catalog/Test/Unit/Block/Ui/ProductViewCounterTest.php b/app/code/Magento/Catalog/Test/Unit/Block/Ui/ProductViewCounterTest.php index e7e8ab5ea91a7..85ab52384740d 100644 --- a/app/code/Magento/Catalog/Test/Unit/Block/Ui/ProductViewCounterTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Block/Ui/ProductViewCounterTest.php @@ -6,19 +6,20 @@ namespace Magento\Catalog\Test\Unit\Block\Ui; +use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Catalog\Api\Data\ProductRenderInterface; +use Magento\Catalog\Block\Ui\ProductViewCounter; +use Magento\Catalog\Model\ProductRenderFactory; use Magento\Catalog\Model\ProductRepository; use Magento\Catalog\Ui\DataProvider\Product\ProductRenderCollectorComposite; -use Magento\Catalog\Model\ProductRenderFactory; +use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\EntityManager\Hydrator; +use Magento\Framework\Registry; use Magento\Framework\Serialize\SerializerInterface; use Magento\Framework\Url; use Magento\Framework\View\Element\Template\Context; -use Magento\Store\Model\StoreManager; use Magento\Store\Model\Store; -use Magento\Framework\Registry; -use Magento\Catalog\Api\Data\ProductInterface; -use Magento\Catalog\Api\Data\ProductRenderInterface; -use Magento\Catalog\Block\Ui\ProductViewCounter; +use Magento\Store\Model\StoreManager; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -70,6 +71,11 @@ class ProductViewCounterTest extends \PHPUnit\Framework\TestCase */ private $storeManagerMock; + /** + * @var ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $scopeConfigMock; + /** * @var ProductRenderFactory|\PHPUnit_Framework_MockObject_MockObject */ @@ -104,6 +110,9 @@ protected function setUp() $this->storeManagerMock = $this->getMockBuilder(StoreManager::class) ->disableOriginalConstructor() ->getMock(); + $this->scopeConfigMock = $this->getMockBuilder(ScopeConfigInterface::class) + ->disableOriginalConstructor() + ->getMock(); $this->productViewCounter = new ProductViewCounter( $this->contextMock, @@ -114,7 +123,8 @@ protected function setUp() $this->hydratorMock, $this->serializeMock, $this->urlMock, - $this->registryMock + $this->registryMock, + $this->scopeConfigMock ); } diff --git a/app/code/Magento/Catalog/Test/Unit/CustomerData/CompareProductsTest.php b/app/code/Magento/Catalog/Test/Unit/CustomerData/CompareProductsTest.php index e30ddda0b70b9..6f5d927e333ec 100644 --- a/app/code/Magento/Catalog/Test/Unit/CustomerData/CompareProductsTest.php +++ b/app/code/Magento/Catalog/Test/Unit/CustomerData/CompareProductsTest.php @@ -15,6 +15,7 @@ use Magento\Catalog\Model\Product; use Magento\Catalog\Model\Product\Url; use Magento\Catalog\Model\ResourceModel\Product\Compare\Item\Collection; +use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; class CompareProductsTest extends \PHPUnit\Framework\TestCase @@ -44,6 +45,11 @@ class CompareProductsTest extends \PHPUnit\Framework\TestCase */ private $objectManagerHelper; + /** + * @var ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $scopeConfigMock; + /** * @var array */ @@ -65,6 +71,9 @@ protected function setUp() $this->outputHelperMock = $this->getMockBuilder(Output::class) ->disableOriginalConstructor() ->getMock(); + $this->scopeConfigMock = $this->getMockBuilder(ScopeConfigInterface::class) + ->disableOriginalConstructor() + ->getMock(); $this->objectManagerHelper = new ObjectManagerHelper($this); @@ -73,7 +82,8 @@ protected function setUp() [ 'helper' => $this->helperMock, 'productUrl' => $this->productUrlMock, - 'outputHelper' => $this->outputHelperMock + 'outputHelper' => $this->outputHelperMock, + 'scopeConfig' => $this->scopeConfigMock ] ); } @@ -109,6 +119,7 @@ private function prepareProductsWithCorrespondingMocks(array $dataSet) : array $urlMap = []; $outputMap = []; $helperMap = []; + $productScopeMap = []; $count = count($dataSet); @@ -119,6 +130,7 @@ private function prepareProductsWithCorrespondingMocks(array $dataSet) : array $outputMap[] = [$item, $data['name'], 'name', 'productName#' . $data['id']]; $helperMap[] = [$item, 'http://remove.url/' . $data['id']]; $urlMap[] = [$item, [], 'http://product.url/' . $data['id']]; + $productScopeMap[] = [$item, 'store-' . $data['id']]; } $this->productUrlMock->expects($this->exactly($count)) @@ -193,19 +205,22 @@ public function testGetSectionData() 'id' => 1, 'product_url' => 'http://product.url/1', 'name' => 'productName#1', - 'remove_url' => 'http://remove.url/1' + 'remove_url' => 'http://remove.url/1', + 'productScope' => null ], [ 'id' => 2, 'product_url' => 'http://product.url/2', 'name' => 'productName#2', - 'remove_url' => 'http://remove.url/2' + 'remove_url' => 'http://remove.url/2', + 'productScope' => null ], [ 'id' => 3, 'product_url' => 'http://product.url/3', 'name' => 'productName#3', - 'remove_url' => 'http://remove.url/3' + 'remove_url' => 'http://remove.url/3', + 'productScope' => null ] ] ], @@ -276,7 +291,8 @@ public function testGetSectionDataSingleItem() 'id' => 12345, 'product_url' => 'http://product.url/12345', 'name' => 'productName#12345', - 'remove_url' => 'http://remove.url/12345' + 'remove_url' => 'http://remove.url/12345', + 'productScope' => null ] ] ], diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/DataProvider.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/DataProvider.php index 4de0b94d06801..3289e4806df3a 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/DataProvider.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/DataProvider.php @@ -8,12 +8,14 @@ use Magento\Framework\Api\FilterBuilder; use Magento\Framework\Api\Search\SearchCriteriaBuilder; +use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\App\RequestInterface; use Magento\Framework\View\Element\UiComponent\DataProvider\Reporting; use Magento\Store\Model\StoreManager; /** * Provide information about current store and currency for product listing ui component + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class DataProvider extends \Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider { @@ -22,6 +24,13 @@ class DataProvider extends \Magento\Framework\View\Element\UiComponent\DataProvi */ private $storeManager; + /** + * Core store config + * + * @var ScopeConfigInterface + */ + private $scopeConfig; + /** * @param string $name * @param Reporting $reporting @@ -56,6 +65,7 @@ public function __construct( $this->name = $name; $this->storeManager = $storeManager; + $this->scopeConfig = $data['config']['scopeConfig']; } /** @@ -65,9 +75,13 @@ public function getData() { $data = []; $store = $this->storeManager->getStore(); + $productsScope = $this->scopeConfig->getValue( + 'catalog/recently_products/scope', + \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE + ); $data['store'] = $store->getId(); $data['currency'] = $store->getCurrentCurrency()->getCode(); - + $data['productCurrentScope'] = $productsScope; return $data; } } diff --git a/app/code/Magento/Catalog/view/frontend/ui_component/widget_recently_compared.xml b/app/code/Magento/Catalog/view/frontend/ui_component/widget_recently_compared.xml index 7cced8bb613c3..b0a275f720670 100644 --- a/app/code/Magento/Catalog/view/frontend/ui_component/widget_recently_compared.xml +++ b/app/code/Magento/Catalog/view/frontend/ui_component/widget_recently_compared.xml @@ -32,6 +32,7 @@ <item name="namespace" xsi:type="string">recently_compared_product</item> <item name="provider" xsi:type="string">compare-products</item> </item> + <item name="scopeConfig" xsi:type="object">Magento\Framework\App\Config\ScopeConfigInterface</item> </item> </argument> </argument> diff --git a/app/code/Magento/Catalog/view/frontend/ui_component/widget_recently_viewed.xml b/app/code/Magento/Catalog/view/frontend/ui_component/widget_recently_viewed.xml index efad08eef8c12..2af3b1210b18b 100644 --- a/app/code/Magento/Catalog/view/frontend/ui_component/widget_recently_viewed.xml +++ b/app/code/Magento/Catalog/view/frontend/ui_component/widget_recently_viewed.xml @@ -31,6 +31,7 @@ <item name="identifiersConfig" xsi:type="array"> <item name="namespace" xsi:type="string">recently_viewed_product</item> </item> + <item name="scopeConfig" xsi:type="object">Magento\Framework\App\Config\ScopeConfigInterface</item> </item> </argument> </argument> diff --git a/app/code/Magento/Catalog/view/frontend/web/js/product/provider.js b/app/code/Magento/Catalog/view/frontend/web/js/product/provider.js index ca9381c45e2ab..f246a8e3a0f9f 100644 --- a/app/code/Magento/Catalog/view/frontend/web/js/product/provider.js +++ b/app/code/Magento/Catalog/view/frontend/web/js/product/provider.js @@ -138,13 +138,17 @@ define([ filterIds: function (ids) { var _ids = {}, currentTime = new Date().getTime() / 1000, - currentProductIds = productResolver($('#product_addtocart_form')); + currentProductIds = productResolver($('#product_addtocart_form')), + productCurrentScope = this.data.productCurrentScope, + scopeId = productCurrentScope === 'store' ? window.checkout.storeId : + productCurrentScope === 'group' ? window.checkout.storeGroupId : + window.checkout.websiteId; - _.each(ids, function (id) { + _.each(ids, function (id, key) { if ( - currentTime - id['added_at'] < ~~this.idsStorage.lifetime && - !_.contains(currentProductIds, id['product_id']) && - (!id.hasOwnProperty('website_id') || id['website_id'] === window.checkout.websiteId) + currentTime - ids[key]['added_at'] < ~~this.idsStorage.lifetime && + !_.contains(currentProductIds, ids[key]['product_id']) && + (!id.hasOwnProperty('scope_id') || ids[key]['scope_id'] === scopeId) ) { _ids[id['product_id']] = id; diff --git a/app/code/Magento/Catalog/view/frontend/web/js/product/storage/ids-storage-compare.js b/app/code/Magento/Catalog/view/frontend/web/js/product/storage/ids-storage-compare.js index a904d8ed3b3da..bd92c5d452423 100644 --- a/app/code/Magento/Catalog/view/frontend/web/js/product/storage/ids-storage-compare.js +++ b/app/code/Magento/Catalog/view/frontend/web/js/product/storage/ids-storage-compare.js @@ -67,14 +67,26 @@ define([ * @returns {Object} data */ prepareData: function (data) { - var result = {}; + var result = {}, + scopeId; _.each(data, function (item) { - result[item.id] = { - 'added_at': new Date().getTime() / 1000, - 'product_id': item.id, - 'website_id': window.checkout.websiteId - }; + if (typeof item.productScope !== 'undefined') { + scopeId = item.productScope === 'store' ? window.checkout.storeId : + item.productScope === 'group' ? window.checkout.storeGroupId : + window.checkout.websiteId; + + result[item.productScope + '-' + scopeId + '-' + item.id] = { + 'added_at': new Date().getTime() / 1000, + 'product_id': item.id, + 'scope_id': scopeId + }; + } else { + result[item.id] = { + 'added_at': new Date().getTime() / 1000, + 'product_id': item.id + }; + } }); return result; diff --git a/app/code/Magento/Catalog/view/frontend/web/js/product/view/provider.js b/app/code/Magento/Catalog/view/frontend/web/js/product/view/provider.js index f4ce882dd668b..5bcf57c035929 100644 --- a/app/code/Magento/Catalog/view/frontend/web/js/product/view/provider.js +++ b/app/code/Magento/Catalog/view/frontend/web/js/product/view/provider.js @@ -85,13 +85,17 @@ define([ * @returns {Object} */ getIdentifiers: function () { - var result = {}; + var result = {}, + productCurrentScope = this.data.productCurrentScope, + scopeId = productCurrentScope === 'store' ? window.checkout.storeId : + productCurrentScope === 'group' ? window.checkout.storeGroupId : + window.checkout.websiteId; _.each(this.data.items, function (item, key) { - result[key] = { + result[productCurrentScope + '-' + scopeId + '-' + key] = { 'added_at': new Date().getTime() / 1000, 'product_id': key, - 'website_id': window.checkout.websiteId + 'scope_id': scopeId }; }, this); diff --git a/app/code/Magento/Checkout/Block/Cart/Sidebar.php b/app/code/Magento/Checkout/Block/Cart/Sidebar.php index c5e309df3cad6..147782e501ae4 100644 --- a/app/code/Magento/Checkout/Block/Cart/Sidebar.php +++ b/app/code/Magento/Checkout/Block/Cart/Sidebar.php @@ -83,7 +83,8 @@ public function getConfig() 'minicartMaxItemsVisible' => $this->getMiniCartMaxItemsCount(), 'websiteId' => $this->_storeManager->getStore()->getWebsiteId(), 'maxItemsToDisplay' => $this->getMaxItemsToDisplay(), - 'storeId' => $this->_storeManager->getStore()->getId() + 'storeId' => $this->_storeManager->getStore()->getId(), + 'storeGroupId' => $this->_storeManager->getStore()->getStoreGroupId() ]; } diff --git a/app/code/Magento/Checkout/Test/Unit/Block/Cart/SidebarTest.php b/app/code/Magento/Checkout/Test/Unit/Block/Cart/SidebarTest.php index f69ced3b094c7..fdf63b4ebe1ed 100644 --- a/app/code/Magento/Checkout/Test/Unit/Block/Cart/SidebarTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Block/Cart/SidebarTest.php @@ -145,7 +145,8 @@ public function testGetConfig() 'minicartMaxItemsVisible' => 3, 'websiteId' => 100, 'maxItemsToDisplay' => 8, - 'storeId' => null + 'storeId' => null, + 'storeGroupId' => null ]; $valueMap = [ From 2324d99cd740fd969413aa50096b24c054ecf653 Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Mon, 27 Jan 2020 15:04:54 +0200 Subject: [PATCH 1017/1143] MC-30540: "CData section too big" error while accessing configurable product in backend --- .../View/TemplateEngine/Xhtml/Template.php | 13 ++-- .../TemplateEngine/Xhtml/TemplateTest.php | 67 +++++++++++++++++++ .../Unit/TemplateEngine/_files/simple.xml | 12 ++++ 3 files changed, 87 insertions(+), 5 deletions(-) create mode 100644 lib/internal/Magento/Framework/View/Test/Unit/TemplateEngine/Xhtml/TemplateTest.php create mode 100644 lib/internal/Magento/Framework/View/Test/Unit/TemplateEngine/_files/simple.xml diff --git a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Template.php b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Template.php index e75c80777ec0c..64cdf543a7571 100644 --- a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Template.php +++ b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Template.php @@ -6,7 +6,7 @@ namespace Magento\Framework\View\TemplateEngine\Xhtml; /** - * Class Template + * XML Template Engine */ class Template { @@ -34,7 +34,7 @@ public function __construct( ) { $this->logger = $logger; $document = new \DOMDocument(static::XML_VERSION, static::XML_ENCODING); - $document->loadXML($content); + $document->loadXML($content, LIBXML_PARSEHUGE); $this->templateNode = $document->documentElement; } @@ -56,9 +56,12 @@ public function getDocumentElement() */ public function append($content) { - $newFragment = $this->templateNode->ownerDocument->createDocumentFragment(); - $newFragment->appendXML($content); - $this->templateNode->appendChild($newFragment); + $ownerDocument= $this->templateNode->ownerDocument; + $document = new \DOMDocument(); + $document->loadXml($content, LIBXML_PARSEHUGE); + $this->templateNode->appendChild( + $ownerDocument->importNode($document->documentElement, true) + ); } /** diff --git a/lib/internal/Magento/Framework/View/Test/Unit/TemplateEngine/Xhtml/TemplateTest.php b/lib/internal/Magento/Framework/View/Test/Unit/TemplateEngine/Xhtml/TemplateTest.php new file mode 100644 index 0000000000000..3a3a7de47fbab --- /dev/null +++ b/lib/internal/Magento/Framework/View/Test/Unit/TemplateEngine/Xhtml/TemplateTest.php @@ -0,0 +1,67 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Framework\View\Test\Unit\TemplateEngine\Xhtml; + +use Magento\Framework\View\TemplateEngine\Xhtml\Template; +use PHPUnit\Framework\TestCase; +use Psr\Log\LoggerInterface; + +/** + * Test XML template engine + */ +class TemplateTest extends TestCase +{ + /** + * @var Template + */ + private $model; + + /** + * @inheritDoc + */ + protected function setUp() + { + parent::setUp(); + $this->model = new Template( + $this->getMockForAbstractClass(LoggerInterface::class), + file_get_contents(__DIR__ . '/../_files/simple.xml') + ); + } + + /** + * Test that xml content is correctly appended to the current element + */ + public function testAppend() + { + $body = <<<HTML +<body> + <h1>Home Page</h1> + <p>CMS homepage content goes here.</p> +</body> +HTML; + $expected = <<<HTML +<!-- +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--><html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <title>Home Page + + +

Home Page

+

CMS homepage content goes here.

+ + +HTML; + + $this->model->append($body); + $this->assertEquals($expected, (string) $this->model); + } +} diff --git a/lib/internal/Magento/Framework/View/Test/Unit/TemplateEngine/_files/simple.xml b/lib/internal/Magento/Framework/View/Test/Unit/TemplateEngine/_files/simple.xml new file mode 100644 index 0000000000000..0c73702b572c0 --- /dev/null +++ b/lib/internal/Magento/Framework/View/Test/Unit/TemplateEngine/_files/simple.xml @@ -0,0 +1,12 @@ + + + + + Home Page + + From 619ab67eccfb8623e6517c91a78dae417ea97089 Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh Date: Mon, 27 Jan 2020 15:07:41 +0200 Subject: [PATCH 1018/1143] MC-30544: "updated_at" timestamp not updating for products updated via "Update Attribute" action --- .../Model/ResourceModel/Product/Action.php | 57 +++++++++++++++---- .../Eav/Model/Entity/AbstractEntity.php | 16 +++++- 2 files changed, 61 insertions(+), 12 deletions(-) diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Action.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Action.php index ca20f57c5d00e..d0a3af92126d3 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Action.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Action.php @@ -5,6 +5,7 @@ */ namespace Magento\Catalog\Model\ResourceModel\Product; +use Magento\Catalog\Api\Data\ProductInterface; use Magento\Eav\Model\Entity\Attribute\AbstractAttribute; /** @@ -14,6 +15,32 @@ */ class Action extends \Magento\Catalog\Model\ResourceModel\AbstractResource { + /** + * @var \Magento\Framework\Stdlib\DateTime\DateTime + */ + private $dateTime; + + /** + * @param \Magento\Eav\Model\Entity\Context $context + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\Catalog\Model\Factory $modelFactory + * @param \Magento\Eav\Model\Entity\Attribute\UniqueValidationInterface $uniqueValidator + * @param \Magento\Framework\Stdlib\DateTime\DateTime $dateTime + * @param array $data + */ + public function __construct( + \Magento\Eav\Model\Entity\Context $context, + \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\Catalog\Model\Factory $modelFactory, + \Magento\Eav\Model\Entity\Attribute\UniqueValidationInterface $uniqueValidator, + \Magento\Framework\Stdlib\DateTime\DateTime $dateTime, + $data = [] + ) { + parent::__construct($context, $storeManager, $modelFactory, $data, $uniqueValidator); + + $this->dateTime = $dateTime; + } + /** * Initialize connection * @@ -43,6 +70,7 @@ public function updateAttributes($entityIds, $attrData, $storeId) $object = new \Magento\Framework\DataObject(); $object->setStoreId($storeId); + $attrData[ProductInterface::UPDATED_AT] = $this->dateTime->gmtDate(); $this->getConnection()->beginTransaction(); try { foreach ($attrData as $attrCode => $value) { @@ -95,7 +123,7 @@ protected function _saveAttributeValue($object, $attribute, $value) * for default store id * In this case we clear all not default values */ - if ($this->_storeManager->hasSingleStore()) { + if ($this->_storeManager->hasSingleStore() && !$attribute->isStatic()) { $storeId = $this->getDefaultStoreId(); $connection->delete( $table, @@ -107,17 +135,24 @@ protected function _saveAttributeValue($object, $attribute, $value) ); } - $data = new \Magento\Framework\DataObject( - [ - 'attribute_id' => $attribute->getAttributeId(), - 'store_id' => $storeId, - $this->getLinkField() => $entityId, - 'value' => $this->_prepareValueForSave($value, $attribute), - ] - ); + $data = $attribute->isStatic() + ? new \Magento\Framework\DataObject( + [ + $this->getLinkField() => $entityId, + $attribute->getAttributeCode() => $this->_prepareValueForSave($value, $attribute), + ] + ) + : new \Magento\Framework\DataObject( + [ + 'attribute_id' => $attribute->getAttributeId(), + 'store_id' => $storeId, + $this->getLinkField() => $entityId, + 'value' => $this->_prepareValueForSave($value, $attribute), + ] + ); $bind = $this->_prepareDataForTable($data, $table); - if ($attribute->isScopeStore()) { + if ($attribute->isScopeStore() || $attribute->isStatic()) { /** * Update attribute value for store */ @@ -143,6 +178,8 @@ protected function _saveAttributeValue($object, $attribute, $value) } /** + * Resolve entity id + * * @param int $entityId * @return int */ diff --git a/app/code/Magento/Eav/Model/Entity/AbstractEntity.php b/app/code/Magento/Eav/Model/Entity/AbstractEntity.php index 7649c89a07955..5b6252f2c0d6c 100644 --- a/app/code/Magento/Eav/Model/Entity/AbstractEntity.php +++ b/app/code/Magento/Eav/Model/Entity/AbstractEntity.php @@ -1021,6 +1021,8 @@ public function load($object, $entityId, $attributes = []) protected function loadAttributesMetadata($attributes) { $this->loadAttributesForObject($attributes); + + return $this; } /** @@ -1433,8 +1435,10 @@ protected function _processSaveData($saveData) $insertEntity = true; $entityTable = $this->getEntityTable(); $entityIdField = $this->getEntityIdField(); + // phpstan:ignore "Undefined variable" $entityId = $newObject->getId(); + // phpstan:ignore "Undefined variable" unset($entityRow[$entityIdField]); if (!empty($entityId) && is_numeric($entityId)) { $bind = ['entity_id' => $entityId]; @@ -1450,6 +1454,7 @@ protected function _processSaveData($saveData) /** * Process base row */ + // phpstan:ignore "Undefined variable" $entityObject = new DataObject($entityRow); $entityRow = $this->_prepareDataForTable($entityObject, $entityTable); if ($insertEntity) { @@ -1460,6 +1465,7 @@ protected function _processSaveData($saveData) $connection->insert($entityTable, $entityRow); $entityId = $connection->lastInsertId($entityTable); } + // phpstan:ignore "Undefined variable" $newObject->setId($entityId); } else { $where = sprintf('%s=%d', $connection->quoteIdentifier($entityIdField), $entityId); @@ -1472,6 +1478,7 @@ protected function _processSaveData($saveData) if (!empty($insert)) { foreach ($insert as $attributeId => $value) { $attribute = $this->getAttribute($attributeId); + // phpstan:ignore "Undefined variable" $this->_insertAttribute($newObject, $attribute, $value); } } @@ -1482,6 +1489,7 @@ protected function _processSaveData($saveData) if (!empty($update)) { foreach ($update as $attributeId => $v) { $attribute = $this->getAttribute($attributeId); + // phpstan:ignore "Undefined variable" $this->_updateAttribute($newObject, $attribute, $v['value_id'], $v['value']); } } @@ -1491,12 +1499,14 @@ protected function _processSaveData($saveData) */ if (!empty($delete)) { foreach ($delete as $table => $values) { + // phpstan:ignore "Undefined variable" $this->_deleteAttributes($newObject, $table, $values); } } $this->_processAttributeValues(); + // phpstan:ignore "Undefined variable" $newObject->isObjectNew(false); return $this; @@ -1573,7 +1583,7 @@ protected function _processAttributeValues() { $connection = $this->getConnection(); foreach ($this->_attributeValuesToSave as $table => $data) { - $connection->insertOnDuplicate($table, $data, ['value']); + $connection->insertOnDuplicate($table, $data, array_keys($data[0])); } foreach ($this->_attributeValuesToDelete as $table => $valueIds) { @@ -1607,7 +1617,9 @@ protected function _prepareValueForSave($value, AbstractAttribute $attribute) self::$_attributeBackendTables[$backendTable] = $this->getConnection()->describeTable($backendTable); } $describe = self::$_attributeBackendTables[$backendTable]; - return $this->getConnection()->prepareColumnValue($describe['value'], $value); + $columnName = $attribute->isStatic() ? $attribute->getAttributeCode() : 'value'; + + return $this->getConnection()->prepareColumnValue($describe[$columnName], $value); } /** From 1ba225d9a7cf78a5dffb7249418eca6638965168 Mon Sep 17 00:00:00 2001 From: Yurii Sapiha Date: Mon, 27 Jan 2020 15:27:46 +0200 Subject: [PATCH 1019/1143] MC-29688: Storefront: Check multiple currencies per websites/store views --- .../Model/RemoveCurrencyRateByCode.php | 40 +++++ .../Product/View/AbstractCurrencyTest.php | 111 +++++++++++++ .../Product/View/MultiStoreCurrencyTest.php | 147 ++++++++++++++++++ .../Product/View/SingleStoreCurrencyTest.php | 64 ++++++++ .../Magento/Directory/Block/CurrencyTest.php | 123 +++++++++++++++ .../Magento/Directory/_files/usd_cny_rate.php | 16 ++ .../_files/usd_cny_rate_rollback.php | 14 ++ .../Magento/Directory/_files/usd_uah_rate.php | 16 ++ .../_files/usd_uah_rate_rollback.php | 14 ++ 9 files changed, 545 insertions(+) create mode 100644 dev/tests/integration/framework/Magento/TestFramework/Directory/Model/RemoveCurrencyRateByCode.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/AbstractCurrencyTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/MultiStoreCurrencyTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/SingleStoreCurrencyTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Directory/Block/CurrencyTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Directory/_files/usd_cny_rate.php create mode 100644 dev/tests/integration/testsuite/Magento/Directory/_files/usd_cny_rate_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/Directory/_files/usd_uah_rate.php create mode 100644 dev/tests/integration/testsuite/Magento/Directory/_files/usd_uah_rate_rollback.php diff --git a/dev/tests/integration/framework/Magento/TestFramework/Directory/Model/RemoveCurrencyRateByCode.php b/dev/tests/integration/framework/Magento/TestFramework/Directory/Model/RemoveCurrencyRateByCode.php new file mode 100644 index 0000000000000..86895045db945 --- /dev/null +++ b/dev/tests/integration/framework/Magento/TestFramework/Directory/Model/RemoveCurrencyRateByCode.php @@ -0,0 +1,40 @@ +currencyResource = $currencyResource; + } + + /** + * Remove currency rates + * + * @param string $currencyCode + * @return void + */ + public function execute(string $currencyCode): void + { + $connection = $this->currencyResource->getConnection(); + $rateTable = $this->currencyResource->getTable('directory_currency_rate'); + $connection->delete($rateTable, $connection->quoteInto('currency_to = ? OR currency_from = ?', $currencyCode)); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/AbstractCurrencyTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/AbstractCurrencyTest.php new file mode 100644 index 0000000000000..2ae71797e52e5 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/AbstractCurrencyTest.php @@ -0,0 +1,111 @@ +objectManager = Bootstrap::getObjectManager(); + $this->registry = $this->objectManager->get(Registry::class); + $this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class); + $this->productRepository->cleanCache(); + $this->pageFactory = $this->objectManager->get(PageFactory::class); + } + + /** + * @inheridoc + */ + protected function tearDown() + { + $this->registry->unregister('product'); + + parent::tearDown(); + } + + /** + * Process price view on product page + * + * @param string|ProductInterface $product + * @param string $blockName + * @return string + */ + protected function processPriceView($product, string $blockName = self::FINAL_PRICE_BLOCK_NAME): string + { + $product = is_string($product) ? $this->productRepository->get($product) : $product; + $this->registerProduct($product); + + return trim( + preg_replace('/(?:\s| )+/', ' ', strip_tags($this->getProductPriceBlockHtml($blockName))) + ); + } + + /** + * Get product price block content + * + * @param string $blockName + * @return string + */ + private function getProductPriceBlockHtml(string $blockName): string + { + $page = $this->pageFactory->create(); + $page->addHandle([ + 'default', + 'catalog_product_view', + 'catalog_product_view_type_configurable', + ]); + $page->getLayout()->generateXml(); + $block = $page->getLayout()->getBlock($blockName); + $this->assertNotFalse($block); + + return $block->toHtml(); + } + + /** + * Register the product + * + * @param ProductInterface $product + * @return void + */ + private function registerProduct(ProductInterface $product): void + { + $this->registry->unregister('product'); + $this->registry->register('product', $product); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/MultiStoreCurrencyTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/MultiStoreCurrencyTest.php new file mode 100644 index 0000000000000..22d30fd3d9ea8 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/MultiStoreCurrencyTest.php @@ -0,0 +1,147 @@ +storeManager = $this->objectManager->get(StoreManagerInterface::class); + } + + /** + * @magentoConfigFixture default/currency/options/base USD + * @magentoConfigFixture current_store currency/options/default CNY + * @magentoConfigFixture current_store currency/options/allow CNY,USD + * @magentoConfigFixture fixturestore_store currency/options/default UAH + * @magentoConfigFixture fixturestore_store currency/options/allow UAH,USD + * + * @magentoDataFixture Magento/Store/_files/core_fixturestore.php + * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + * @magentoDataFixture Magento/Directory/_files/usd_cny_rate.php + * @magentoDataFixture Magento/Directory/_files/usd_uah_rate.php + * + * @return void + */ + public function testMultiStoreRenderPrice(): void + { + $this->assertProductStorePrice('simple2', 'CN¥70.00'); + $this->reloadProductPriceInfo(); + $this->assertProductStorePrice('simple2', '₴240.00', 'fixturestore'); + } + + /** + * @magentoConfigFixture default/currency/options/base USD + * @magentoConfigFixture current_store currency/options/default CNY + * @magentoConfigFixture current_store currency/options/allow CNY,USD + * @magentoConfigFixture fixturestore_store currency/options/default UAH + * @magentoConfigFixture fixturestore_store currency/options/allow UAH,USD + * + * @magentoDataFixture Magento/Store/_files/core_fixturestore.php + * @magentoDataFixture Magento/Catalog/_files/product_special_price.php + * @magentoDataFixture Magento/Directory/_files/usd_cny_rate.php + * @magentoDataFixture Magento/Directory/_files/usd_uah_rate.php + * + * @return void + */ + public function testMultiStoreRenderSpecialPrice(): void + { + $this->assertProductStorePrice('simple', 'Special Price CN¥41.93 Regular Price CN¥70.00'); + $this->reloadProductPriceInfo(); + $this->assertProductStorePrice('simple', 'Special Price ₴143.76 Regular Price ₴240.00', 'fixturestore'); + } + + /** + * @magentoConfigFixture default/currency/options/base USD + * @magentoConfigFixture current_store currency/options/default CNY + * @magentoConfigFixture current_store currency/options/allow CNY,USD + * @magentoConfigFixture fixturestore_store currency/options/default UAH + * @magentoConfigFixture fixturestore_store currency/options/allow UAH,USD + * + * @magentoDataFixture Magento/Store/_files/core_fixturestore.php + * @magentoDataFixture Magento/Catalog/_files/product_simple_with_fixed_tier_price.php + * @magentoDataFixture Magento/Directory/_files/usd_cny_rate.php + * @magentoDataFixture Magento/Directory/_files/usd_uah_rate.php + * + * @return void + */ + public function testMultiStoreRenderTierPrice(): void + { + $this->assertProductStorePrice( + 'simple-product-tax-none', + 'Buy 2 for CN¥280.00 each and save 80%', + 'default', + self::TIER_PRICE_BLOCK_NAME + ); + $this->reloadProductPriceInfo(); + $this->assertProductStorePrice( + 'simple-product-tax-none', + 'Buy 2 for ₴960.00 each and save 80%', + 'fixturestore', + self::TIER_PRICE_BLOCK_NAME + ); + } + + /** + * Check price per stores + * + * @param string $productSku + * @param string $expectedData + * @param string $storeCode + * @param string $priceBlockName + * @return void + */ + private function assertProductStorePrice( + string $productSku, + string $expectedData, + string $storeCode = 'default', + string $priceBlockName = self::FINAL_PRICE_BLOCK_NAME + ): void { + $currentStore = $this->storeManager->getStore(); + try { + if ($currentStore->getCode() !== $storeCode) { + $this->storeManager->setCurrentStore($storeCode); + } + + $actualData = $this->processPriceView($productSku, $priceBlockName); + $this->assertEquals($expectedData, $actualData); + } finally { + if ($currentStore->getCode() !== $storeCode) { + $this->storeManager->setCurrentStore($currentStore); + } + } + } + + /** + * Reload product price info + * + * @return void + */ + private function reloadProductPriceInfo(): void + { + $product = $this->registry->registry('product'); + $this->assertNotNull($product); + $product->reloadPriceInfo(); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/SingleStoreCurrencyTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/SingleStoreCurrencyTest.php new file mode 100644 index 0000000000000..284d85ccc9ebd --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/SingleStoreCurrencyTest.php @@ -0,0 +1,64 @@ +processPriceView('simple2'); + $this->assertEquals('CN¥70.00', $priceHtml); + } + + /** + * @magentoConfigFixture current_store currency/options/base USD + * @magentoConfigFixture current_store currency/options/default CNY + * @magentoConfigFixture current_store currency/options/allow EUR,CNY + * + * @magentoDataFixture Magento/Catalog/_files/product_special_price.php + * @magentoDataFixture Magento/Directory/_files/usd_cny_rate.php + * + * @return void + */ + public function testRenderSpecialPrice(): void + { + $priceHtml = $this->processPriceView('simple'); + $this->assertEquals('Special Price CN¥41.93 Regular Price CN¥70.00', $priceHtml); + } + + /** + * @magentoConfigFixture current_store currency/options/base USD + * @magentoConfigFixture current_store currency/options/default CNY + * @magentoConfigFixture current_store currency/options/allow CNY,USD + * + * @magentoDataFixture Magento/Catalog/_files/product_simple_with_fixed_tier_price.php + * @magentoDataFixture Magento/Directory/_files/usd_cny_rate.php + * + * @return void + */ + public function testRenderTierPrice(): void + { + $priceHtml = $this->processPriceView('simple-product-tax-none', self::TIER_PRICE_BLOCK_NAME); + $this->assertEquals('Buy 2 for CN¥280.00 each and save 80%', $priceHtml); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Directory/Block/CurrencyTest.php b/dev/tests/integration/testsuite/Magento/Directory/Block/CurrencyTest.php new file mode 100644 index 0000000000000..30527bc2fa926 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Directory/Block/CurrencyTest.php @@ -0,0 +1,123 @@ +objectManager = Bootstrap::getObjectManager(); + $this->layout = $this->objectManager->get(LayoutInterface::class); + $this->storeManager = $this->objectManager->get(StoreManagerInterface::class); + } + + /** + * @magentoConfigFixture current_store currency/options/allow USD + * + * @return void + */ + public function testDefaultCurrencySwitcher(): void + { + $this->assertCurrencySwitcherPerStore(''); + } + + /** + * @magentoConfigFixture current_store currency/options/allow EUR,USD + * + * @return void + */ + public function testCurrencySwitcher(): void + { + $this->assertCurrencySwitcherPerStore('Currency USD - US Dollar EUR - Euro'); + } + + /** + * @magentoConfigFixture current_store currency/options/allow USD,CNY + * @magentoConfigFixture fixturestore_store currency/options/allow USD,UAH + * + * @magentoDataFixture Magento/Store/_files/core_fixturestore.php + * @magentoDataFixture Magento/Directory/_files/usd_cny_rate.php + * @magentoDataFixture Magento/Directory/_files/usd_uah_rate.php + * + * @return void + */ + public function testMultiStoreCurrencySwitcher(): void + { + $this->assertCurrencySwitcherPerStore('Currency USD - US Dollar CNY - Chinese Yuan'); + $this->assertCurrencySwitcherPerStore('Currency USD - US Dollar UAH - Ukrainian Hryvnia', 'fixturestore'); + } + + /** + * Check currency switcher diplaying per stores + * + * @param string $expectedData + * @param string $storeCode + * @return void + */ + private function assertCurrencySwitcherPerStore( + string $expectedData, + string $storeCode = 'default' + ): void { + $currentStore = $this->storeManager->getStore(); + try { + if ($currentStore->getCode() !== $storeCode) { + $this->storeManager->setCurrentStore($storeCode); + } + + $actualData = trim(preg_replace('/\s+/', ' ', strip_tags($this->getBlock()->toHtml()))); + $this->assertEquals($expectedData, $actualData); + } finally { + if ($currentStore->getCode() !== $storeCode) { + $this->storeManager->setCurrentStore($currentStore); + } + } + } + + /** + * Get currency block + * + * @return Currency + */ + private function getBlock(): Currency + { + $block = $this->layout->createBlock(Currency::class); + $block->setTemplate(self::CURRENCY_SWITCHER_TEMPLATE); + + return $block; + } +} diff --git a/dev/tests/integration/testsuite/Magento/Directory/_files/usd_cny_rate.php b/dev/tests/integration/testsuite/Magento/Directory/_files/usd_cny_rate.php new file mode 100644 index 0000000000000..8651f2cc760d2 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Directory/_files/usd_cny_rate.php @@ -0,0 +1,16 @@ + ['CNY' => '7.0000']]; +/** @var Currency $currencyModel */ +$currencyModel = $objectManager->create(Currency::class); +$currencyModel->saveRates($rates); diff --git a/dev/tests/integration/testsuite/Magento/Directory/_files/usd_cny_rate_rollback.php b/dev/tests/integration/testsuite/Magento/Directory/_files/usd_cny_rate_rollback.php new file mode 100644 index 0000000000000..c553995e6288c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Directory/_files/usd_cny_rate_rollback.php @@ -0,0 +1,14 @@ +get(RemoveCurrencyRateByCode::class); +$deleteRateByCode->execute('CNY'); diff --git a/dev/tests/integration/testsuite/Magento/Directory/_files/usd_uah_rate.php b/dev/tests/integration/testsuite/Magento/Directory/_files/usd_uah_rate.php new file mode 100644 index 0000000000000..3bb4bded1979c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Directory/_files/usd_uah_rate.php @@ -0,0 +1,16 @@ + ['UAH' => '24.0000']]; +/** @var Currency $currencyModel */ +$currencyModel = $objectManager->create(Currency::class); +$currencyModel->saveRates($rates); diff --git a/dev/tests/integration/testsuite/Magento/Directory/_files/usd_uah_rate_rollback.php b/dev/tests/integration/testsuite/Magento/Directory/_files/usd_uah_rate_rollback.php new file mode 100644 index 0000000000000..131f533666132 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Directory/_files/usd_uah_rate_rollback.php @@ -0,0 +1,14 @@ +get(RemoveCurrencyRateByCode::class); +$deleteRateByCode->execute('UAH'); From a70842f7d5420fd0590b3ebb1fe5737fa1db94a4 Mon Sep 17 00:00:00 2001 From: engcom-Echo Date: Mon, 27 Jan 2020 15:29:29 +0200 Subject: [PATCH 1020/1143] Fix unit test --- .../Model/Checkout/Type/MultishippingTest.php | 235 +++++++++++------- 1 file changed, 147 insertions(+), 88 deletions(-) diff --git a/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/MultishippingTest.php b/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/MultishippingTest.php index c3f0f1113fb5a..3948025fa0388 100644 --- a/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/MultishippingTest.php +++ b/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/MultishippingTest.php @@ -282,7 +282,7 @@ protected function setUp() * @return void * @throws LocalizedException */ - public function testSetShippingItemsInformation():void + public function testSetShippingItemsInformation(): void { $info = [ [ @@ -333,10 +333,9 @@ public function testSetShippingItemsInformation():void * Verefi set shipping items information for address leak * * @return void - * @expectedException LocalizedException - * @expectedExceptionMessage Verify the shipping address information and continue. + * @throws LocalizedException */ - public function testSetShippingItemsInformationForAddressLeak():void + public function testSetShippingItemsInformationForAddressLeak(): void { $info = [ [ @@ -360,6 +359,8 @@ public function testSetShippingItemsInformationForAddressLeak():void $this->helperMock->expects($this->once())->method('getMaximumQty')->willReturn(500); $this->customerMock->expects($this->once())->method('getAddresses')->willReturn($customerAddresses); + $this->expectExceptionMessage('Verify the shipping address information and continue.'); + $this->assertEquals($this->model, $this->model->setShippingItemsInformation($info)); } @@ -369,7 +370,7 @@ public function testSetShippingItemsInformationForAddressLeak():void * @return void * @throws LocalizedException */ - public function testUpdateQuoteCustomerShippingAddress():void + public function testUpdateQuoteCustomerShippingAddress(): void { $addressId = 42; $customerAddressId = 42; @@ -388,10 +389,9 @@ public function testUpdateQuoteCustomerShippingAddress():void * Verify update quote customer shipping address for address leak * * @return void - * @expectedException LocalizedException - * @expectedExceptionMessage Verify the shipping address information and continue. + * @throws LocalizedException */ - public function testUpdateQuoteCustomerShippingAddressForAddressLeak():void + public function testUpdateQuoteCustomerShippingAddressForAddressLeak(): void { $addressId = 43; $customerAddressId = 42; @@ -400,6 +400,7 @@ public function testUpdateQuoteCustomerShippingAddressForAddressLeak():void $this->getCustomerAddressMock($customerAddressId) ]; $this->customerMock->expects($this->once())->method('getAddresses')->willReturn($customerAddresses); + $this->expectExceptionMessage('Verify the shipping address information and continue.'); $this->assertEquals($this->model, $this->model->updateQuoteCustomerShippingAddress($addressId)); } @@ -410,7 +411,7 @@ public function testUpdateQuoteCustomerShippingAddressForAddressLeak():void * @return void * @throws LocalizedException */ - public function testSetQuoteCustomerBillingAddress():void + public function testSetQuoteCustomerBillingAddress(): void { $addressId = 42; $customerAddressId = 42; @@ -427,10 +428,9 @@ public function testSetQuoteCustomerBillingAddress():void * Verify set quote customer billing address for address leak. * * @return void - * @expectedException LocalizedException - * @expectedExceptionMessage Verify the billing address information and continue. + * @throws LocalizedException */ - public function testSetQuoteCustomerBillingAddressForAddressLeak():void + public function testSetQuoteCustomerBillingAddressForAddressLeak(): void { $addressId = 43; $customerAddressId = 42; @@ -439,6 +439,7 @@ public function testSetQuoteCustomerBillingAddressForAddressLeak():void $this->getCustomerAddressMock($customerAddressId) ]; $this->customerMock->expects($this->once())->method('getAddresses')->willReturn($customerAddresses); + $this->expectExceptionMessage('Verify the billing address information and continue.'); $this->assertEquals($this->model, $this->model->setQuoteCustomerBillingAddress($addressId)); } @@ -448,7 +449,7 @@ public function testSetQuoteCustomerBillingAddressForAddressLeak():void * * @return void */ - public function testGetQuoteShippingAddressesItems():void + public function testGetQuoteShippingAddressesItems(): void { $quoteItem = $this->getMockBuilder(AddressItem::class) ->disableOriginalConstructor() @@ -464,7 +465,7 @@ public function testGetQuoteShippingAddressesItems():void * @return void * @throws LocalizedException */ - public function testSetShippingMethods():void + public function testSetShippingMethods(): void { $methodsArray = [1 => 'flatrate_flatrate', 2 => 'tablerate_bestway']; $addressId = 1; @@ -603,24 +604,20 @@ public function testCreateOrdersWithThrowsException(array $config): void ->willReturn($config['infoBuyRequest']); $quoteItemMock = $this->getQuoteItemMock($config['productType'], $productMock); $quoteAddressItemMock = - $this->getQuoteAddressItemMock($quoteItemMock, $config['productType'], $config['infoBuyRequest']); + $this->getQuoteAddressItemMock( + $quoteItemMock, + $config['productType'], + $config['infoBuyRequest'] + ); list($shippingAddressMock, $billingAddressMock) = $this->getQuoteAddressesMock($quoteAddressItemMock, $config['addressTotal']); - $this->setQuoteMockData($config['paymentProviderCode'], $shippingAddressMock, $billingAddressMock); - $currencyMock = $this->getMockBuilder(Currency::class) - ->disableOriginalConstructor() - ->setMethods([ 'convert' ]) - ->getMock(); - $currencyMock->method('convert') - ->willReturn($config['shippingPrice']); - $storeMock = $this->getMockBuilder(Store::class) - ->disableOriginalConstructor() - ->setMethods(['getBaseCurrency','getCurrentCurrencyCode' ]) - ->getMock(); - $storeMock->method('getBaseCurrency') - ->willReturn($currencyMock); - $storeMock->method('getCurrentCurrencyCode') - ->willReturn($config['currencyCode']); + $this->setQuoteMockData( + $config['paymentProviderCode'], + $shippingAddressMock, + $billingAddressMock + ); + $currencyMock = $this->getCurrencyMock($config['shippingPrice']); + $storeMock = $this->getStoreMock($currencyMock, $config['currencyCode']); $orderAddressMock = $this->createSimpleMock(OrderAddressInterface::class); $orderPaymentMock = $this->createSimpleMock(OrderPaymentInterface::class); $orderItemMock = $this->getMockBuilder(\Magento\Sales\Model\Order\Item::class) @@ -629,17 +626,12 @@ public function testCreateOrdersWithThrowsException(array $config): void ->getMock(); $orderItemMock->method('getQuoteItemId') ->willReturn($config['quoteItemId']); - $orderMock = $this->getOrderMock($orderAddressMock, $orderPaymentMock, $orderItemMock); - $orderMock->expects($this->once()) - ->method('getStore') - ->willReturn($storeMock); - $orderMock->expects($this->once()) - ->method('setBaseShippingAmount') - ->with($config['shippingPrice'])->willReturnSelf(); - $orderMock->expects($this->once()) - ->method('setShippingAmount') - ->with($config['shippingPrice']) - ->willReturnSelf(); + $orderMock = $this->getOrderMock( + $orderAddressMock, + $orderPaymentMock, + $orderItemMock + ); + $this->getOrderMockData($orderMock, $storeMock, $config['shippingPrice']); $this->orderFactoryMock->expects($this->once()) ->method('create') ->willReturn($orderMock); @@ -658,7 +650,8 @@ public function testCreateOrdersWithThrowsException(array $config): void ->method('convert') ->with($shippingAddressMock) ->willReturn($orderMock); - $this->toOrderAddressMock->expects($this->exactly(2))->method('convert') + $this->toOrderAddressMock->expects($this->exactly(2)) + ->method('convert') ->withConsecutive( [$billingAddressMock, []], [$shippingAddressMock, []] @@ -688,9 +681,57 @@ public function testCreateOrdersWithThrowsException(array $config): void ->method('save') ->with($this->quoteMock); $this->expectExceptionMessage('Quote address for failed order ID "1" not found.'); + $this->model->createOrders(); } + /** + * Return Store Mock. + * + * @param PHPUnit_Framework_MockObject_MockObject $currencyMock + * @param string $currencyCode + * @return PHPUnit_Framework_MockObject_MockObject + */ + private function getStoreMock($currencyMock, string $currencyCode): PHPUnit_Framework_MockObject_MockObject + { + $storeMock = $this->getMockBuilder(Store::class) + ->disableOriginalConstructor() + ->setMethods(['getBaseCurrency','getCurrentCurrencyCode' ]) + ->getMock(); + $storeMock->method('getBaseCurrency') + ->willReturn($currencyMock); + $storeMock->method('getCurrentCurrencyCode') + ->willReturn($currencyCode); + + return $storeMock; + } + + /** + * Return Order Mock with data + * + * @param PHPUnit_Framework_MockObject_MockObject $orderMock + * @param PHPUnit_Framework_MockObject_MockObject $storeMock + * @param string $shippingPrice + * @return void + */ + private function getOrderMockData( + PHPUnit_Framework_MockObject_MockObject $orderMock, + PHPUnit_Framework_MockObject_MockObject $storeMock, + string $shippingPrice + ): void { + $orderMock->expects($this->once()) + ->method('getStore') + ->willReturn($storeMock); + $orderMock->expects($this->once()) + ->method('setBaseShippingAmount') + ->with($shippingPrice) + ->willReturnSelf(); + $orderMock->expects($this->once()) + ->method('setShippingAmount') + ->with($shippingPrice) + ->willReturnSelf(); + } + /** * Return Payment Mock. * @@ -898,12 +939,12 @@ private function getOrderMock( * Tests exception for addresses with country id not in the allowed countries list. * * @return void - * @expectedException LocalizedException - * @expectedExceptionMessage Some addresses can't be used due to the configurations for specific countries. * @throws \Exception */ - public function testCreateOrdersCountryNotPresentInAllowedListException():void + public function testCreateOrdersCountryNotPresentInAllowedListException(): void { + $ExceptionMessage = 'Some addresses can\'t be used due to the configurations for specific countries.'; + $abstractMethod = $this->getMockBuilder(AbstractMethod::class) ->disableOriginalConstructor() ->setMethods(['isAvailable']) @@ -935,18 +976,63 @@ public function testCreateOrdersCountryNotPresentInAllowedListException():void ->willReturn($paymentMock); $this->quoteMock->method('getAllShippingAddresses') ->willReturn([$shippingAddressMock]); + $this->expectExceptionMessage($ExceptionMessage); $this->model->createOrders(); } + /** + * Verify validate minimum amount multi address is false. + * + * @return void + */ + public function testValidateMinimumAmountMultiAddressFalse(): void + { + $addressMock = $this->createMock(\Magento\Quote\Model\Quote\Address::class); + $this->scopeConfigMock->expects($this->exactly(2))->method('isSetFlag')->withConsecutive( + ['sales/minimum_order/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE], + ['sales/minimum_order/multi_address', \Magento\Store\Model\ScopeInterface::SCOPE_STORE] + )->willReturnOnConsecutiveCalls(true, false); + + $this->scopeConfigMock->expects($this->exactly(2))->method('getValue')->withConsecutive( + ['sales/minimum_order/amount', \Magento\Store\Model\ScopeInterface::SCOPE_STORE], + ['sales/minimum_order/tax_including', \Magento\Store\Model\ScopeInterface::SCOPE_STORE] + )->willReturnOnConsecutiveCalls(100, false); + + $this->checkoutSessionMock->expects($this->atLeastOnce())->method('getQuote')->willReturn($this->quoteMock); + $this->quoteMock->expects($this->once())->method('getStoreId')->willReturn(1); + $this->quoteMock->expects($this->once())->method('getAllAddresses')->willReturn([$addressMock]); + $addressMock->expects($this->once())->method('getBaseSubtotalWithDiscount')->willReturn(101); + + $this->assertTrue($this->model->validateMinimumAmount()); + } + + /** + * Verify validate minimum amount multi address is true. + * + * @return void + */ + public function testValidateMinimumAmountMultiAddressTrue(): void + { + $this->scopeConfigMock->expects($this->exactly(2))->method('isSetFlag')->withConsecutive( + ['sales/minimum_order/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE], + ['sales/minimum_order/multi_address', \Magento\Store\Model\ScopeInterface::SCOPE_STORE] + )->willReturnOnConsecutiveCalls(true, true); + + $this->checkoutSessionMock->expects($this->atLeastOnce())->method('getQuote')->willReturn($this->quoteMock); + $this->quoteMock->expects($this->once())->method('validateMinimumAmount')->willReturn(false); + $this->assertFalse($this->model->validateMinimumAmount()); + } + /** * Return Extension Attributes Mock. * * @param ShippingAssignment $shippingAssignmentMock * @return CartExtension|PHPUnit_Framework_MockObject_MockObject */ - private function getExtensionAttributesMock(ShippingAssignment $shippingAssignmentMock) - { + private function getExtensionAttributesMock( + ShippingAssignment $shippingAssignmentMock + ): PHPUnit_Framework_MockObject_MockObject { $extensionAttributesMock = $this->getMockBuilder(CartExtension::class) ->setMethods(['setShippingAssignments']) ->getMock(); @@ -965,7 +1051,7 @@ private function getExtensionAttributesMock(ShippingAssignment $shippingAssignme * * @return ShippingAssignment | PHPUnit_Framework_MockObject_MockObject */ - private function getShippingAssignmentMock() + private function getShippingAssignmentMock(): PHPUnit_Framework_MockObject_MockObject { $shippingAssignmentMock = $this->getMockBuilder(ShippingAssignment::class) ->disableOriginalConstructor() @@ -988,7 +1074,7 @@ private function getShippingAssignmentMock() * * @return void */ - private function mockShippingAssignment():void + private function mockShippingAssignment(): void { $shippingAssignmentMock = $this->getShippingAssignmentMock(); @@ -1017,7 +1103,7 @@ private function mockShippingAssignment():void * @param $customerAddressId * @return Address | PHPUnit_Framework_MockObject_MockObject */ - private function getCustomerAddressMock($customerAddressId) + private function getCustomerAddressMock($customerAddressId): PHPUnit_Framework_MockObject_MockObject { $customerAddressMock = $this->getMockBuilder(Address::class) ->setMethods(['getId']) @@ -1036,7 +1122,7 @@ private function getCustomerAddressMock($customerAddressId) * @param string $className * @return PHPUnit_Framework_MockObject_MockObject */ - private function createSimpleMock($className) + private function createSimpleMock($className): PHPUnit_Framework_MockObject_MockObject { return $this->getMockBuilder($className) ->disableOriginalConstructor() @@ -1044,46 +1130,19 @@ private function createSimpleMock($className) } /** - * Verify validate minimum amount multi address is true. - * - * @return void - */ - public function testValidateMinimumAmountMultiAddressTrue():void - { - $this->scopeConfigMock->expects($this->exactly(2))->method('isSetFlag')->withConsecutive( - ['sales/minimum_order/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE], - ['sales/minimum_order/multi_address', \Magento\Store\Model\ScopeInterface::SCOPE_STORE] - )->willReturnOnConsecutiveCalls(true, true); - - $this->checkoutSessionMock->expects($this->atLeastOnce())->method('getQuote')->willReturn($this->quoteMock); - $this->quoteMock->expects($this->once())->method('validateMinimumAmount')->willReturn(false); - $this->assertFalse($this->model->validateMinimumAmount()); - } - - /** - * Verify validate minimum amount multi address is false. + * Return Currency Mock. * - * @return void + * @param $shippingPrice + * @return PHPUnit_Framework_MockObject_MockObject */ - public function testValidateMinimumAmountMultiAddressFalse():void + private function getCurrencyMock($shippingPrice): PHPUnit_Framework_MockObject_MockObject { - $addressMock = $this->createMock(\Magento\Quote\Model\Quote\Address::class); - $this->scopeConfigMock->expects($this->exactly(2))->method('isSetFlag')->withConsecutive( - ['sales/minimum_order/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE], - ['sales/minimum_order/multi_address', \Magento\Store\Model\ScopeInterface::SCOPE_STORE] - )->willReturnOnConsecutiveCalls(true, false); - - $this->scopeConfigMock->expects($this->exactly(2))->method('getValue')->withConsecutive( - ['sales/minimum_order/amount', \Magento\Store\Model\ScopeInterface::SCOPE_STORE], - ['sales/minimum_order/tax_including', \Magento\Store\Model\ScopeInterface::SCOPE_STORE] - )->willReturnOnConsecutiveCalls(100, false); - - $this->checkoutSessionMock->expects($this->atLeastOnce())->method('getQuote')->willReturn($this->quoteMock); - $this->quoteMock->expects($this->once())->method('getStoreId')->willReturn(1); - $this->quoteMock->expects($this->once())->method('getAllAddresses')->willReturn([$addressMock]); - $addressMock->expects($this->once())->method('getBaseSubtotalWithDiscount')->willReturn(101); - - $this->assertTrue($this->model->validateMinimumAmount()); + $currencyMock = $this->getMockBuilder(Currency::class) + ->disableOriginalConstructor() + ->setMethods([ 'convert' ]) + ->getMock(); + $currencyMock->method('convert')->willReturn($shippingPrice); + return $currencyMock; } /** From cf30cfb482641217b1bee91278512825151af709 Mon Sep 17 00:00:00 2001 From: DmytroPaidych Date: Mon, 27 Jan 2020 15:39:00 +0200 Subject: [PATCH 1021/1143] MC-30642: Storefront: Configurable product prices --- .../Type/ConfigurableProductPriceTest.php | 211 ++++++++++++++++++ ...figurable_with_custom_option_type_text.php | 32 +++ ..._with_custom_option_type_text_rollback.php | 8 + .../Renderer/Configurable/PriceTest.php | 187 ++++++++++++++++ 4 files changed, 438 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/ConfigurableProductPriceTest.php create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_with_custom_option_type_text.php create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_with_custom_option_type_text_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/Swatches/Block/Product/Renderer/Configurable/PriceTest.php diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/ConfigurableProductPriceTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/ConfigurableProductPriceTest.php new file mode 100644 index 0000000000000..977a130eff838 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/ConfigurableProductPriceTest.php @@ -0,0 +1,211 @@ +objectManager = Bootstrap::getObjectManager(); + $this->registry = $this->objectManager->get(Registry::class); + $this->page = $this->objectManager->get(Page::class); + $this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class); + $this->productRepository->cleanCache(); + $this->productCustomOption = $this->objectManager->get(ProductCustomOptionInterface::class); + $this->json = $this->objectManager->get(SerializerInterface::class); + } + + /** + * @inheritdoc + */ + protected function tearDown() + { + $this->registry->unregister('product'); + $this->registry->unregister('current_product'); + + parent::tearDown(); + } + + /** + * @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php + * + * @return void + */ + public function testConfigurablePrice(): void + { + $this->assertPrice($this->processPriceView('configurable'), 10.00); + } + + /** + * @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable_disable_first_child.php + * + * @return void + */ + public function testConfigurablePriceWithDisabledFirstChild(): void + { + $this->assertPrice($this->processPriceView('configurable'), 20.00); + } + + /** + * @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child.php + * + * @return void + */ + public function testConfigurablePriceWithOutOfStockFirstChild(): void + { + $this->assertPrice($this->processPriceView('configurable'), 20.00); + } + + /** + * @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php + * @magentoDataFixture Magento/CatalogRule/_files/rule_apply_as_percentage_of_original_not_logged_user.php + * @magentoDbIsolation disabled + * + * @return void + */ + public function testConfigurablePriceWithCatalogRule(): void + { + $this->assertPrice($this->processPriceView('configurable'), 9.00); + } + + /** + * @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable_with_custom_option_type_text.php + * + * @return void + */ + public function testConfigurablePriceWithCustomOption(): void + { + $product = $this->productRepository->get('configurable'); + $this->registerProduct($product); + $this->preparePageLayout(); + $customOptionsBlock = $this->page->getLayout() + ->getChildBlock('product.info.options.wrapper', 'product_options'); + $option = $product->getOptions()[0] ?? null; + $this->assertNotNull($option); + $this->assertJsonConfig($customOptionsBlock->getJsonConfig(), '15', (int)$option->getId()); + $optionBlock = $customOptionsBlock->getChildBlock($this->productCustomOption->getGroupByType('area')); + $optionPrice = $optionBlock->setProduct($product)->setOption($option)->getFormattedPrice(); + $this->assertEquals('+$15.00', preg_replace('/[\n\s]/', '', strip_tags($optionPrice))); + } + + /** + * Register the product. + * + * @param ProductInterface $product + * @return void + */ + private function registerProduct(ProductInterface $product): void + { + $this->registry->unregister('product'); + $this->registry->register('product', $product); + $this->registry->unregister('current_product'); + $this->registry->register('current_product', $product); + } + + /** + * Prepare configurable product page. + * + * @return void + */ + private function preparePageLayout(): void + { + $this->page->addHandle([ + 'default', + 'catalog_product_view', + 'catalog_product_view_type_configurable', + ]); + $this->page->getLayout()->generateXml(); + } + + /** + * Process view product final price block html. + * + * @param string $sku + * @return string + */ + private function processPriceView(string $sku): string + { + $product = $this->productRepository->get($sku); + $this->registerProduct($product); + $this->preparePageLayout(); + + return $this->page->getLayout()->getBlock('product.price.final')->toHtml(); + } + + /** + * Assert that html contain price label and expected final price amount. + * + * @param string $priceBlockHtml + * @param float $expectedPrice + * @return void + */ + private function assertPrice(string $priceBlockHtml, float $expectedPrice): void + { + $regexp = '/As low as<\/span>.*'; + $regexp .= '\$%.2f<\/span><\/span>/'; + $this->assertRegExp( + sprintf($regexp, round($expectedPrice, 2), $expectedPrice), + preg_replace('/[\n\r]/', '', $priceBlockHtml) + ); + } + + /** + * Assert custom option price json config. + * + * @param string $config + * @param string $expectedPrice + * @param int $optionId + * @return void + */ + private function assertJsonConfig(string $config, string $expectedPrice, int $optionId): void + { + $price = $this->json->unserialize($config)[$optionId]['prices']['finalPrice']['amount'] ?? null; + $this->assertNotNull($price); + $this->assertEquals($expectedPrice, $price); + } +} diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_with_custom_option_type_text.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_with_custom_option_type_text.php new file mode 100644 index 0000000000000..dc173b1cd7607 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_with_custom_option_type_text.php @@ -0,0 +1,32 @@ +get(ProductCustomOptionInterfaceFactory::class); + +$createdOption = $optionRepository->create([ + 'data' => [ + 'is_require' => 0, + 'sku' => 'option-1', + 'title' => 'Option 1', + 'type' => ProductCustomOptionInterface::OPTION_TYPE_AREA, + 'price' => 15, + 'price_type' => 'fixed', + ] +]); +$createdOption->setProductSku($product->getSku()); +$product->setOptions([$createdOption]); +$productRepository->save($product); diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_with_custom_option_type_text_rollback.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_with_custom_option_type_text_rollback.php new file mode 100644 index 0000000000000..c6c17b956ee37 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_with_custom_option_type_text_rollback.php @@ -0,0 +1,8 @@ +objectManager = Bootstrap::getObjectManager(); + $this->registry = $this->objectManager->get(Registry::class); + $this->page = $this->objectManager->get(Page::class); + $this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class); + $this->productRepository->cleanCache(); + $this->json = $this->objectManager->get(SerializerInterface::class); + } + + /** + * @inheritdoc + */ + protected function tearDown() + { + $this->registry->unregister('product'); + + parent::tearDown(); + } + + /** + * @dataProvider childProductsDataProvider + * @magentoDataFixture Magento/Swatches/_files/configurable_product_visual_swatch_attribute.php + * @magentoCache config disabled + * + * @param array $updateData + * @param array $expectedData + * @return void + */ + public function testConfigurableOptionPrices(array $updateData, array $expectedData): void + { + $this->updateProducts($updateData); + $product = $this->productRepository->get('configurable'); + $this->registerProduct($product); + $configurableOptions = $this->getProductSwatchOptionsBlock()->getJsonConfig(); + $optionsData = $this->json->unserialize($configurableOptions); + $this->assertArrayHasKey('optionPrices', $optionsData); + $this->assertEquals($expectedData, array_values($optionsData['optionPrices'])); + } + + /** + * @return array + */ + public function childProductsDataProvider(): array + { + return [ + [ + 'update_data' => [ + 'simple_option_1' => [ + 'special_price' => 50, + ], + 'simple_option_2' => [ + 'special_price' => 58.55, + ], + 'simple_option_3' => [ + 'tier_price' => [ + [ + 'website_id' => 0, + 'cust_group' => Group::CUST_GROUP_ALL, + 'price_qty' => 1, + 'value_type' => TierPriceInterface::PRICE_TYPE_FIXED, + 'price' => 75, + ], + ], + ], + ], + 'expected_data' => [ + [ + 'oldPrice' => ['amount' => 150], + 'basePrice' => ['amount' => 50], + 'finalPrice' => ['amount' => 50], + 'tierPrices' => [], + 'msrpPrice' => ['amount' => null], + ], + [ + 'oldPrice' => ['amount' => 150], + 'basePrice' => ['amount' => 58.55], + 'finalPrice' => ['amount' => 58.55], + 'tierPrices' => [], + 'msrpPrice' => ['amount' => null], + ], + [ + 'oldPrice' => ['amount' => 150], + 'basePrice' => ['amount' => 75], + 'finalPrice' => ['amount' => 75], + 'tierPrices' => [], + 'msrpPrice' => ['amount' => null], + ], + ] + ], + ]; + } + + /** + * Update products. + * + * @param array $data + * @return void + */ + private function updateProducts(array $data): void + { + foreach ($data as $sku => $updateData) { + $product = $this->productRepository->get($sku); + $product->addData($updateData); + $this->productRepository->save($product); + } + } + + /** + * Register the product. + * + * @param ProductInterface $product + * @return void + */ + private function registerProduct(ProductInterface $product): void + { + $this->registry->unregister('product'); + $this->registry->register('product', $product); + } + + /** + * Get product swatch options block. + * + * @return Configurable + */ + private function getProductSwatchOptionsBlock(): Configurable + { + $this->page->addHandle([ + 'default', + 'catalog_product_view', + 'catalog_product_view_type_configurable', + ]); + $this->page->getLayout()->generateXml(); + + return $this->page->getLayout()->getChildBlock('product.info.options.wrapper', 'swatch_options'); + } +} From dec897285bb89e971c9597746d501bf9e84515f6 Mon Sep 17 00:00:00 2001 From: Deepak S Nair Date: Mon, 27 Jan 2020 19:25:14 +0530 Subject: [PATCH 1022/1143] fix-25761 : resolved static test issues and added translation --- app/code/Magento/Sitemap/Model/ItemProvider/StoreUrl.php | 5 ++++- .../Sitemap/Model/ItemProvider/StoreUrlConfigReader.php | 3 +++ .../Sitemap/Test/Unit/Model/ItemProvider/StoreUrlTest.php | 2 +- app/code/Magento/Sitemap/i18n/en_US.csv | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Sitemap/Model/ItemProvider/StoreUrl.php b/app/code/Magento/Sitemap/Model/ItemProvider/StoreUrl.php index e262f56d0905f..11a2d585d8da6 100644 --- a/app/code/Magento/Sitemap/Model/ItemProvider/StoreUrl.php +++ b/app/code/Magento/Sitemap/Model/ItemProvider/StoreUrl.php @@ -8,6 +8,9 @@ use Magento\Sitemap\Model\SitemapItemInterfaceFactory; +/** + * Class for adding Store Url in sitemap + */ class StoreUrl implements ItemProviderInterface { /** @@ -39,7 +42,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ public function getItems($storeId) { diff --git a/app/code/Magento/Sitemap/Model/ItemProvider/StoreUrlConfigReader.php b/app/code/Magento/Sitemap/Model/ItemProvider/StoreUrlConfigReader.php index 782863e79ea4d..b18dd73fb2836 100644 --- a/app/code/Magento/Sitemap/Model/ItemProvider/StoreUrlConfigReader.php +++ b/app/code/Magento/Sitemap/Model/ItemProvider/StoreUrlConfigReader.php @@ -9,6 +9,9 @@ use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Store\Model\ScopeInterface; +/** + * Class for getting configuration for Store Url + */ class StoreUrlConfigReader implements ConfigReaderInterface { /**#@+ diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/ItemProvider/StoreUrlTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/ItemProvider/StoreUrlTest.php index e18a54889a1b2..0edfd253f0c1d 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/ItemProvider/StoreUrlTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/ItemProvider/StoreUrlTest.php @@ -69,4 +69,4 @@ private function getConfigReaderMock() return $configReaderMock; } -} \ No newline at end of file +} diff --git a/app/code/Magento/Sitemap/i18n/en_US.csv b/app/code/Magento/Sitemap/i18n/en_US.csv index 29ecd7e22773e..8a7ac86e2fb47 100644 --- a/app/code/Magento/Sitemap/i18n/en_US.csv +++ b/app/code/Magento/Sitemap/i18n/en_US.csv @@ -64,3 +64,4 @@ ID,ID "Link for Google","Link for Google" "Last Generated","Last Generated" Action,Action +"Store Url Options","Store Url Options" From 83e60706166470c8e8f433670875f67ac7eb810a Mon Sep 17 00:00:00 2001 From: Michele Fantetti Date: Mon, 27 Jan 2020 17:16:49 +0100 Subject: [PATCH 1023/1143] Add frontend template hints status command unit tests after suggestions --- .../Command/TemplateHintsStatusCommandTest.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Developer/Test/Unit/Console/Command/TemplateHintsStatusCommandTest.php b/app/code/Magento/Developer/Test/Unit/Console/Command/TemplateHintsStatusCommandTest.php index 27f41a61f9202..7c6ab356b4ada 100644 --- a/app/code/Magento/Developer/Test/Unit/Console/Command/TemplateHintsStatusCommandTest.php +++ b/app/code/Magento/Developer/Test/Unit/Console/Command/TemplateHintsStatusCommandTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Developer\Test\Unit\Console\Command; @@ -33,6 +34,9 @@ class TemplateHintsStatusCommandTest extends TestCase */ private $reinitableConfigMock; + /** + * TemplateHintsStatusCommandTest setup + */ protected function setUp() { $this->scopeConfigMock = $this->getMockForAbstractClass(ScopeConfigInterface::class); @@ -45,16 +49,14 @@ protected function setUp() } + /** + * Test execution + */ public function testExecute() { $tester = new CommandTester($this->command); $tester->execute([]); - $this->assertContains( - 'disabled', - $tester->getDisplay() - ); - $this->assertEquals( 0, $tester->getStatusCode() From c527a47182756afc83ddc16c807a07652c1b35ac Mon Sep 17 00:00:00 2001 From: Myroslav Dobra Date: Mon, 27 Jan 2020 20:52:09 +0200 Subject: [PATCH 1024/1143] MC-24170: Fix Skipped MFTF Tests From MC-17140: MC-13493, MC-14062, MC-14063 --- ...uleForConfigurableProductWithAssignedSimpleProducts2Test.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProducts2Test.xml b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProducts2Test.xml index 0b6edc42c87ff..8b72b7616b6ff 100644 --- a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProducts2Test.xml +++ b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProducts2Test.xml @@ -189,7 +189,7 @@ - + From 9f6fcbb3ab0394322a247f6a5f412d494b4b4e49 Mon Sep 17 00:00:00 2001 From: Karyna Tsymbal Date: Mon, 27 Jan 2020 21:51:52 +0200 Subject: [PATCH 1025/1143] Improved code readability --- .../Block/Tracking/PopupDeliveryDateTest.php | 91 +++++++++++++------ 1 file changed, 62 insertions(+), 29 deletions(-) diff --git a/app/code/Magento/Fedex/Test/Unit/Plugin/Block/Tracking/PopupDeliveryDateTest.php b/app/code/Magento/Fedex/Test/Unit/Plugin/Block/Tracking/PopupDeliveryDateTest.php index a5cd261ab7121..80cd37c3bde5e 100644 --- a/app/code/Magento/Fedex/Test/Unit/Plugin/Block/Tracking/PopupDeliveryDateTest.php +++ b/app/code/Magento/Fedex/Test/Unit/Plugin/Block/Tracking/PopupDeliveryDateTest.php @@ -21,16 +21,36 @@ */ class PopupDeliveryDateTest extends TestCase { + const STUB_CARRIER_CODE_NOT_FEDEX = 'not-fedex'; + const STUB_DELIVERY_DATE = '2020-02-02'; + const STUB_DELIVERY_TIME = '12:00'; + /** * @var MockObject|PopupDeliveryDate */ private $plugin; + /** + * @var MockObject|Status $trackingStatusMock + */ + private $trackingStatusMock; + + /** + * @var MockObject|Popup $subjectMock + */ + private $subjectMock; + /** * @inheritDoc */ protected function setUp() { + $this->trackingStatusMock = $this->getStatusMock(); + $this->subjectMock = $this->getPopupMock(); + $this->subjectMock->expects($this->once()) + ->method('getTrackingInfo') + ->willReturn([[$this->trackingStatusMock]]); + $objectManagerHelper = new ObjectManager($this); $this->plugin = $objectManagerHelper->getObject(PopupDeliveryDate::class); } @@ -40,27 +60,14 @@ protected function setUp() */ public function testAfterFormatDeliveryDateTimeWithFedexCarrier() { - /** @var Status|MockObject $trackingStatusMock */ - $trackingStatusMock = $this->getMockBuilder(Status::class) - ->disableOriginalConstructor() - ->setMethods(['getCarrier']) - ->getMock(); - $trackingStatusMock->expects($this::once()) + $this->trackingStatusMock->expects($this::once()) ->method('getCarrier') ->willReturn(Carrier::CODE); - /** @var Popup|MockObject $subjectMock */ - $subjectMock = $this->getMockBuilder(Popup::class) - ->disableOriginalConstructor() - ->setMethods(['formatDeliveryDate', 'getTrackingInfo']) - ->getMock(); - $subjectMock->expects($this->once()) - ->method('getTrackingInfo') - ->willReturn([[$trackingStatusMock]]); - $subjectMock->expects($this->once()) + $this->subjectMock->expects($this->once()) ->method('formatDeliveryDate'); - $this->plugin->afterFormatDeliveryDateTime($subjectMock, 'Test Result', '2020-02-02', '12:00'); + $this->executeOriginalMethod(); } /** @@ -68,26 +75,52 @@ public function testAfterFormatDeliveryDateTimeWithFedexCarrier() */ public function testAfterFormatDeliveryDateTimeWithOtherCarrier() { - /** @var Status|MockObject $trackingStatusMock */ - $trackingStatusMock = $this->getMockBuilder(Status::class) + $this->trackingStatusMock->expects($this::once()) + ->method('getCarrier') + ->willReturn(self::STUB_CARRIER_CODE_NOT_FEDEX); + + $this->subjectMock->expects($this->never()) + ->method('formatDeliveryDate'); + + $this->executeOriginalMethod(); + } + + /** + * Returns Mock for @see Status + * + * @return MockObject + */ + private function getStatusMock(): MockObject + { + return $this->getMockBuilder(Status::class) ->disableOriginalConstructor() ->setMethods(['getCarrier']) ->getMock(); - $trackingStatusMock->expects($this::once()) - ->method('getCarrier') - ->willReturn('not-fedex'); + } - /** @var Popup|MockObject $subjectMock */ - $subjectMock = $this->getMockBuilder(Popup::class) + /** + * Returns Mock for @see Popup + * + * @return MockObject + */ + private function getPopupMock(): MockObject + { + return $this->getMockBuilder(Popup::class) ->disableOriginalConstructor() ->setMethods(['formatDeliveryDate', 'getTrackingInfo']) ->getMock(); - $subjectMock->expects($this->once()) - ->method('getTrackingInfo') - ->willReturn([[$trackingStatusMock]]); - $subjectMock->expects($this->never()) - ->method('formatDeliveryDate'); + } - $this->plugin->afterFormatDeliveryDateTime($subjectMock, 'Test Result', '2020-02-02', '12:00'); + /** + * + */ + private function executeOriginalMethod() + { + $this->plugin->afterFormatDeliveryDateTime( + $this->subjectMock, + 'Test Result', + self::STUB_DELIVERY_DATE, + self::STUB_DELIVERY_TIME + ); } } From cdc0834c23c97fd6d052e7a99f8456dc4193a016 Mon Sep 17 00:00:00 2001 From: Karyna Tsymbal Date: Mon, 27 Jan 2020 21:55:05 +0200 Subject: [PATCH 1026/1143] Comment added --- .../Test/Unit/Plugin/Block/Tracking/PopupDeliveryDateTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Fedex/Test/Unit/Plugin/Block/Tracking/PopupDeliveryDateTest.php b/app/code/Magento/Fedex/Test/Unit/Plugin/Block/Tracking/PopupDeliveryDateTest.php index 80cd37c3bde5e..109f6199b52c6 100644 --- a/app/code/Magento/Fedex/Test/Unit/Plugin/Block/Tracking/PopupDeliveryDateTest.php +++ b/app/code/Magento/Fedex/Test/Unit/Plugin/Block/Tracking/PopupDeliveryDateTest.php @@ -112,7 +112,7 @@ private function getPopupMock(): MockObject } /** - * + * Run plugin's original method */ private function executeOriginalMethod() { From 5342a25c5df6a8652b25b688935d20fd1b8e2d6c Mon Sep 17 00:00:00 2001 From: Karyna Tsymbal Date: Mon, 27 Jan 2020 22:38:44 +0200 Subject: [PATCH 1027/1143] Constants added --- .../Test/Unit/Observer/EventSaverTest.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Reports/Test/Unit/Observer/EventSaverTest.php b/app/code/Magento/Reports/Test/Unit/Observer/EventSaverTest.php index eebed5bfc0431..07e9eef40f4de 100644 --- a/app/code/Magento/Reports/Test/Unit/Observer/EventSaverTest.php +++ b/app/code/Magento/Reports/Test/Unit/Observer/EventSaverTest.php @@ -24,6 +24,12 @@ */ class EventSaverTest extends TestCase { + const STUB_CUSTOMER_ID = 1; + const STUB_VISITOR_ID = 2; + const STUB_EVENT_TYPE_ID = 1; + const STUB_OBJECT_ID = 1; + const STUB_STORE_ID = 1; + /** * @var Session|MockObject */ @@ -74,7 +80,7 @@ public function setUp() ->willReturn($this->storeMock); $this->storeMock->expects($this->once()) ->method('getId') - ->willReturn(1); + ->willReturn(self::STUB_STORE_ID); $this->eventMock = $this->createMock(Event::class); $this->eventFactoryMock = $this->createMock(EventFactory::class); @@ -112,7 +118,7 @@ public function testSaveWithSubject() ->method('getCustomerId'); $this->customerVisitorMock->expects($this->never()) ->method('getId'); - $this->eventSaver->save(1, 1, $subjectId); + $this->eventSaver->save(self::STUB_EVENT_TYPE_ID, self::STUB_OBJECT_ID, $subjectId); } /** @@ -125,8 +131,8 @@ public function testSaveWithoutSubjectWhenLoggedIn() ->willReturn(true); $this->customerSessionMock->expects($this->once()) ->method('getCustomerId') - ->willReturn(1); - $this->eventSaver->save(1, 1, null); + ->willReturn(self::STUB_CUSTOMER_ID); + $this->eventSaver->save(self::STUB_EVENT_TYPE_ID, self::STUB_OBJECT_ID, null); } /** @@ -139,7 +145,7 @@ public function testSaveWithoutSubjectForGuest() ->willReturn(false); $this->customerVisitorMock->expects($this->once()) ->method('getId') - ->willReturn(2); - $this->eventSaver->save(1, 1, null); + ->willReturn(self::STUB_VISITOR_ID); + $this->eventSaver->save(self::STUB_EVENT_TYPE_ID, self::STUB_OBJECT_ID, null); } } From ece031d464e611a7b1567ccf6b9f452e2bb6e432 Mon Sep 17 00:00:00 2001 From: eduard13 Date: Tue, 28 Jan 2020 09:00:57 +0200 Subject: [PATCH 1028/1143] Covering the model classes by Unit Tests --- .../Unit/Model/Mode/ConfigManagerTest.php | 109 ++++++++++++++++++ .../Unit/Model/PolicyRendererPoolTest.php | 96 +++++++++++++++ 2 files changed, 205 insertions(+) create mode 100644 app/code/Magento/Csp/Test/Unit/Model/Mode/ConfigManagerTest.php create mode 100644 app/code/Magento/Csp/Test/Unit/Model/PolicyRendererPoolTest.php diff --git a/app/code/Magento/Csp/Test/Unit/Model/Mode/ConfigManagerTest.php b/app/code/Magento/Csp/Test/Unit/Model/Mode/ConfigManagerTest.php new file mode 100644 index 0000000000000..2bc23a520cd71 --- /dev/null +++ b/app/code/Magento/Csp/Test/Unit/Model/Mode/ConfigManagerTest.php @@ -0,0 +1,109 @@ +scopeConfigMock = $this->createMock(ScopeConfigInterface::class); + $this->storeMock = $this->createMock(Store::class); + $this->stateMock = $this->createMock(State::class); + + $this->model = $objectManager->getObject( + ConfigManager::class, + [ + 'config' => $this->scopeConfigMock, + 'storeModel' => $this->storeMock, + 'state' => $this->stateMock + ] + ); + } + + /** + * Test throwing an exception for non storefront or admin areas + * + * @return void + * + * @expectedExceptionMessage CSP can only be configured for storefront or admin area + * @expectedException RuntimeException + */ + public function testThrownExceptionForCrontabArea() + { + $this->stateMock->expects($this->any()) + ->method('getAreaCode') + ->willReturn(static::STUB_CRONTAB_AREA); + + $this->model->getConfigured(); + } + + /** + * Test returning the configured CSP for admin area + * + * @return void + */ + public function testConfiguredCSPForAdminArea() + { + $this->stateMock->expects($this->any()) + ->method('getAreaCode') + ->willReturn(Area::AREA_ADMINHTML); + $this->scopeConfigMock->expects($this->any()) + ->method('isSetFlag') + ->willReturn(true); + $this->scopeConfigMock->expects($this->any()) + ->method('getValue') + ->willReturn('testReportUri'); + $result = $this->model->getConfigured(); + + $this->assertInstanceOf(ModeConfigured::class, $result); + } +} diff --git a/app/code/Magento/Csp/Test/Unit/Model/PolicyRendererPoolTest.php b/app/code/Magento/Csp/Test/Unit/Model/PolicyRendererPoolTest.php new file mode 100644 index 0000000000000..1bc98a5232d04 --- /dev/null +++ b/app/code/Magento/Csp/Test/Unit/Model/PolicyRendererPoolTest.php @@ -0,0 +1,96 @@ +simplePolicyHeaderRendererMock = $this->createPartialMock( + SimplePolicyHeaderRenderer::class, + ['canRender'] + ); + $this->policyMock = $this->createMock(PolicyInterface::class); + + $this->model = $objectManager->getObject( + PolicyRendererPool::class, + [ + 'renderers' => [ + $this->simplePolicyHeaderRendererMock + ] + ] + ); + } + + /** + * Test throwing an exception for not found policy renders + * + * @return void + * + * @expectedExceptionMessage Failed to find a renderer for policy + * @expectedException RuntimeException + */ + public function testThrownExceptionForNotFoundPolicyRenders() + { + $this->policyMock->expects($this->any()) + ->method('getId') + ->willReturn(static::STUB_POLICY_ID); + + $this->model->getRenderer($this->policyMock); + } + + /** + * Test returning a renderer for the given policy + * + * @return void + */ + public function testReturningThePolicyRender() + { + $this->simplePolicyHeaderRendererMock->expects($this->any()) + ->method('canRender') + ->with($this->policyMock) + ->willReturn(true); + + $this->model->getRenderer($this->policyMock); + } +} From 7811896f1740f72fa6ae825c308e39a16c948abf Mon Sep 17 00:00:00 2001 From: eduard13 Date: Tue, 28 Jan 2020 09:14:14 +0200 Subject: [PATCH 1029/1143] Covering the model classes by Unit Tests --- .../Magento/Csp/Test/Unit/Model/Mode/ConfigManagerTest.php | 4 +--- .../Magento/Csp/Test/Unit/Model/PolicyRendererPoolTest.php | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Csp/Test/Unit/Model/Mode/ConfigManagerTest.php b/app/code/Magento/Csp/Test/Unit/Model/Mode/ConfigManagerTest.php index 2bc23a520cd71..adab15eacd6dc 100644 --- a/app/code/Magento/Csp/Test/Unit/Model/Mode/ConfigManagerTest.php +++ b/app/code/Magento/Csp/Test/Unit/Model/Mode/ConfigManagerTest.php @@ -26,8 +26,6 @@ */ class ConfigManagerTest extends TestCase { - const STUB_CRONTAB_AREA = 'crontab'; - /** * @var ConfigManager */ @@ -81,7 +79,7 @@ public function testThrownExceptionForCrontabArea() { $this->stateMock->expects($this->any()) ->method('getAreaCode') - ->willReturn(static::STUB_CRONTAB_AREA); + ->willReturn(Area::AREA_CRONTAB); $this->model->getConfigured(); } diff --git a/app/code/Magento/Csp/Test/Unit/Model/PolicyRendererPoolTest.php b/app/code/Magento/Csp/Test/Unit/Model/PolicyRendererPoolTest.php index 1bc98a5232d04..2b551d4b8dcaf 100644 --- a/app/code/Magento/Csp/Test/Unit/Model/PolicyRendererPoolTest.php +++ b/app/code/Magento/Csp/Test/Unit/Model/PolicyRendererPoolTest.php @@ -23,7 +23,7 @@ */ class PolicyRendererPoolTest extends TestCase { - const STUB_POLICY_ID = 'header'; + private const STUB_POLICY_ID = 'header'; /** * @var PolicyRendererPool From 988309d6d0ad534846e37b5cb264e0ea51794679 Mon Sep 17 00:00:00 2001 From: eduard13 Date: Tue, 28 Jan 2020 09:27:03 +0200 Subject: [PATCH 1030/1143] Covering the model classes by Unit Tests --- app/code/Magento/Csp/Test/Unit/Model/Mode/ConfigManagerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Csp/Test/Unit/Model/Mode/ConfigManagerTest.php b/app/code/Magento/Csp/Test/Unit/Model/Mode/ConfigManagerTest.php index adab15eacd6dc..c574abc1bad59 100644 --- a/app/code/Magento/Csp/Test/Unit/Model/Mode/ConfigManagerTest.php +++ b/app/code/Magento/Csp/Test/Unit/Model/Mode/ConfigManagerTest.php @@ -6,7 +6,7 @@ declare(strict_types=1); -namespace Magento\Csp\Test\Unit\Model; +namespace Magento\Csp\Test\Unit\Model\Mode; use Magento\Csp\Model\Mode\ConfigManager; use Magento\Csp\Model\Mode\Data\ModeConfigured; From 6fbdbbed12051bc306174e1f4f828c3e00ac2e05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Chitesh=40wagento=2Ecom=E2=80=9D?= Date: Tue, 28 Jan 2020 13:08:36 +0530 Subject: [PATCH 1031/1143] [Applied changes as per suggession] --- .../web/css/source/_module.less | 19 ++++++++----------- .../web/css/source/_module.less | 19 ++++++++----------- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/app/design/frontend/Magento/blank/Magento_Wishlist/web/css/source/_module.less b/app/design/frontend/Magento/blank/Magento_Wishlist/web/css/source/_module.less index b26abd2731131..20a026ac2af9c 100644 --- a/app/design/frontend/Magento/blank/Magento_Wishlist/web/css/source/_module.less +++ b/app/design/frontend/Magento/blank/Magento_Wishlist/web/css/source/_module.less @@ -53,17 +53,6 @@ } } - .products-grid.wishlist { - .product-item { - margin-left: 2%; - padding: 5px; - width: calc(~'(100% - 4%) / 3'); - &:nth-child(3n + 1) { - margin-left: 0; - } - } - } - .account .table-wrapper .data.table.wishlist { .lib-table-bordered( @_table_type: horizontal @@ -139,6 +128,13 @@ .products-grid.wishlist { .product { &-item { + margin-left: 2%; + width: calc(~'(100% - 4%) / 3'); + + &:nth-child(3n + 1) { + margin-left: 0; + } + &-photo { display: block; margin-bottom: @indent__s; @@ -198,6 +194,7 @@ border-bottom: 1px solid @secondary__color; margin: 0; width: 100%; + &:first-child { border-top: 1px solid @secondary__color; } diff --git a/app/design/frontend/Magento/luma/Magento_Wishlist/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Wishlist/web/css/source/_module.less index 0c4be4dcd6c00..69342821e9b17 100644 --- a/app/design/frontend/Magento/luma/Magento_Wishlist/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_Wishlist/web/css/source/_module.less @@ -45,17 +45,6 @@ } } - .products-grid.wishlist { - .product-item { - margin-left: 2%; - padding: 5px; - width: calc(~'(100% - 4%) / 3'); - &:nth-child(3n + 1) { - margin-left: 0; - } - } - } - .account .table-wrapper .data.table.wishlist { .lib-table-bordered( @_table_type: horizontal @@ -146,6 +135,13 @@ .products-grid.wishlist { .product { &-item { + margin-left: 2%; + width: calc(~'(100% - 4%) / 3'); + + &:nth-child(3n + 1) { + margin-left: 0; + } + &-photo { display: block; margin-bottom: @indent__s; @@ -229,6 +225,7 @@ border-bottom: 1px solid @secondary__color; margin: 0; width: 100%; + &:first-child { border-top: 1px solid @secondary__color; } From 52a5fb621acc981fa56d592c9d6ccf7254174ceb Mon Sep 17 00:00:00 2001 From: "rostyslav.hymon" Date: Tue, 28 Jan 2020 11:03:28 +0200 Subject: [PATCH 1032/1143] MC-29579: After MC-22931 shipping price displays without tax --- app/code/Magento/Customer/etc/fieldset.xml | 17 -- .../Quote/Model/ShippingMethodManagement.php | 39 +++- .../_files/customer_group_rollback.php | 30 ++++ .../Model/ShippingMethodManagementTest.php | 167 +++++++++++++++++- .../Magento/Tax/_files/tax_classes_de.php | 58 ++++++ .../Tax/_files/tax_classes_de_rollback.php | 64 +++++++ 6 files changed, 348 insertions(+), 27 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Customer/_files/customer_group_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/Tax/_files/tax_classes_de.php create mode 100644 dev/tests/integration/testsuite/Magento/Tax/_files/tax_classes_de_rollback.php diff --git a/app/code/Magento/Customer/etc/fieldset.xml b/app/code/Magento/Customer/etc/fieldset.xml index f89b653981520..ebd0fb2e57efe 100644 --- a/app/code/Magento/Customer/etc/fieldset.xml +++ b/app/code/Magento/Customer/etc/fieldset.xml @@ -57,23 +57,6 @@ -
- - - - - - - - - - - - - - - -
diff --git a/app/code/Magento/Quote/Model/ShippingMethodManagement.php b/app/code/Magento/Quote/Model/ShippingMethodManagement.php index f62866539c6cc..73a2a43b2581f 100644 --- a/app/code/Magento/Quote/Model/ShippingMethodManagement.php +++ b/app/code/Magento/Quote/Model/ShippingMethodManagement.php @@ -7,6 +7,7 @@ namespace Magento\Quote\Model; use Magento\Customer\Api\Data\AddressInterfaceFactory; +use Magento\Customer\Model\Session as CustomerSession; use Magento\Framework\App\ObjectManager; use Magento\Framework\Exception\CouldNotSaveException; use Magento\Framework\Exception\InputException; @@ -22,6 +23,7 @@ * Shipping method read service * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) */ class ShippingMethodManagement implements \Magento\Quote\Api\ShippingMethodManagementInterface, @@ -69,6 +71,11 @@ class ShippingMethodManagement implements */ private $quoteAddressResource; + /** + * @var CustomerSession + */ + private $customerSession; + /** * Constructor * @@ -78,6 +85,7 @@ class ShippingMethodManagement implements * @param Quote\TotalsCollector $totalsCollector * @param AddressInterfaceFactory|null $addressFactory * @param QuoteAddressResource|null $quoteAddressResource + * @param CustomerSession|null $customerSession */ public function __construct( \Magento\Quote\Api\CartRepositoryInterface $quoteRepository, @@ -85,7 +93,8 @@ public function __construct( \Magento\Customer\Api\AddressRepositoryInterface $addressRepository, \Magento\Quote\Model\Quote\TotalsCollector $totalsCollector, AddressInterfaceFactory $addressFactory = null, - QuoteAddressResource $quoteAddressResource = null + QuoteAddressResource $quoteAddressResource = null, + CustomerSession $customerSession = null ) { $this->quoteRepository = $quoteRepository; $this->converter = $converter; @@ -95,10 +104,11 @@ public function __construct( ->get(AddressInterfaceFactory::class); $this->quoteAddressResource = $quoteAddressResource ?: ObjectManager::getInstance() ->get(QuoteAddressResource::class); + $this->customerSession = $customerSession ?? ObjectManager::getInstance()->get(CustomerSession::class); } /** - * {@inheritDoc} + * @inheritDoc */ public function get($cartId) { @@ -126,7 +136,7 @@ public function get($cartId) } /** - * {@inheritDoc} + * @inheritDoc */ public function getList($cartId) { @@ -155,7 +165,7 @@ public function getList($cartId) } /** - * {@inheritDoc} + * @inheritDoc */ public function set($cartId, $carrierCode, $methodCode) { @@ -176,6 +186,8 @@ public function set($cartId, $carrierCode, $methodCode) } /** + * Apply carrier code. + * * @param int $cartId The shopping cart ID. * @param string $carrierCode The carrier code. * @param string $methodCode The shipping method code. @@ -209,7 +221,7 @@ public function apply($cartId, $carrierCode, $methodCode) } /** - * {@inheritDoc} + * @inheritDoc */ public function estimateByAddress($cartId, \Magento\Quote\Api\Data\EstimateAddressInterface $address) { @@ -240,7 +252,7 @@ public function estimateByExtendedAddress($cartId, AddressInterface $address) } /** - * {@inheritDoc} + * @inheritDoc */ public function estimateByAddressId($cartId, $addressId) { @@ -266,6 +278,7 @@ public function estimateByAddressId($cartId, $addressId) * @param string $region * @param \Magento\Framework\Api\ExtensibleDataInterface|null $address * @return \Magento\Quote\Api\Data\ShippingMethodInterface[] An array of shipping methods. + * @SuppressWarnings(PHPMD.UnusedFormalParameter) * @deprecated 100.2.0 */ protected function getEstimatedRates( @@ -277,11 +290,10 @@ protected function getEstimatedRates( $address = null ) { if (!$address) { - $address = $this->getAddressFactory()->create() + $address = $this->addressFactory->create() ->setCountryId($country) ->setPostcode($postcode) - ->setRegionId($regionId) - ->setRegion($region); + ->setRegionId($regionId); } return $this->getShippingMethods($quote, $address); } @@ -301,12 +313,21 @@ private function getShippingMethods(Quote $quote, $address) $shippingAddress->setCollectShippingRates(true); $this->totalsCollector->collectAddressTotals($quote, $shippingAddress); + $quoteCustomerGroupId = $quote->getCustomerGroupId(); + $customerGroupId = $this->customerSession->getCustomerGroupId(); + $isCustomerGroupChanged = $quoteCustomerGroupId !== $customerGroupId; + if ($isCustomerGroupChanged) { + $quote->setCustomerGroupId($customerGroupId); + } $shippingRates = $shippingAddress->getGroupedAllShippingRates(); foreach ($shippingRates as $carrierRates) { foreach ($carrierRates as $rate) { $output[] = $this->converter->modelToDataObject($rate, $quote->getQuoteCurrencyCode()); } } + if ($isCustomerGroupChanged) { + $quote->setCustomerGroupId($quoteCustomerGroupId); + } return $output; } diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/customer_group_rollback.php b/dev/tests/integration/testsuite/Magento/Customer/_files/customer_group_rollback.php new file mode 100644 index 0000000000000..20a1f4623a1f7 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Customer/_files/customer_group_rollback.php @@ -0,0 +1,30 @@ +get(GroupRepositoryInterface::class); +/** @var SearchCriteriaBuilder $searchBuilder */ +$searchBuilder = $objectManager->get(SearchCriteriaBuilder::class); +$searchCriteria = $searchBuilder->addFilter(GroupInterface::CODE, 'custom_group') + ->create(); +$groups = $groupRepository->getList($searchCriteria) + ->getItems(); +foreach ($groups as $group) { + try { + $groupRepository->delete($group); + } catch (NoSuchEntityException $exception) { + //Group already removed + } +} diff --git a/dev/tests/integration/testsuite/Magento/Quote/Model/ShippingMethodManagementTest.php b/dev/tests/integration/testsuite/Magento/Quote/Model/ShippingMethodManagementTest.php index 8db7b65d0142d..1a4e640a1eabe 100644 --- a/dev/tests/integration/testsuite/Magento/Quote/Model/ShippingMethodManagementTest.php +++ b/dev/tests/integration/testsuite/Magento/Quote/Model/ShippingMethodManagementTest.php @@ -6,13 +6,52 @@ namespace Magento\Quote\Model; +use Magento\Customer\Model\Vat; +use Magento\Store\Model\ScopeInterface; +use Magento\Tax\Model\Config as TaxConfig; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\Quote\Model\GetQuoteByReservedOrderId; +use Magento\Framework\ObjectManagerInterface; +use Magento\Customer\Api\Data\GroupInterface; +use Magento\Customer\Api\GroupRepositoryInterface; +use Magento\Tax\Model\ClassModel; +use Magento\Framework\App\Config\MutableScopeConfigInterface; +use Magento\Customer\Api\AddressRepositoryInterface; +use Magento\Customer\Api\Data\CustomerInterface; +use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Quote\Api\ShippingMethodManagementInterface; +use Magento\Customer\Api\Data\AddressInterface; +use Magento\Framework\Api\SearchCriteriaBuilder; +use Magento\Tax\Api\TaxClassRepositoryInterface; +use Magento\Tax\Api\Data\TaxClassInterface; + /** - * Class ShippingMethodManagementTest + * Test for shipping methods management * * @magentoDbIsolation enabled + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class ShippingMethodManagementTest extends \PHPUnit\Framework\TestCase { + /** @var ObjectManagerInterface $objectManager */ + private $objectManager; + + /** @var GroupRepositoryInterface $groupRepository */ + private $groupRepository; + + /** @var TaxClassRepositoryInterface $taxClassRepository */ + private $taxClassRepository; + + /** + * @inheritdoc + */ + protected function setUp() + { + $this->objectManager = Bootstrap::getObjectManager(); + $this->groupRepository = $this->objectManager->get(GroupRepositoryInterface::class); + $this->taxClassRepository = $this->objectManager->get(TaxClassRepositoryInterface::class); + } + /** * @magentoDataFixture Magento/SalesRule/_files/cart_rule_100_percent_off.php * @magentoDataFixture Magento/Sales/_files/quote_with_customer.php @@ -173,4 +212,130 @@ private function executeTestFlow($flatRateAmount, $tableRateAmount) $this->assertEquals($expectedResult[$rate->getCarrierCode()]['method_code'], $rate->getMethodCode()); } } + + /** + * Test for estimate shipping with tax and changed VAT customer group + * + * @magentoDbIsolation disabled + * @magentoDataFixture Magento/Tax/_files/tax_classes_de.php + * @magentoDataFixture Magento/Sales/_files/quote_with_customer.php + * @magentoDataFixture Magento/Customer/_files/customer_group.php + * @magentoDataFixture Magento/Customer/_files/customer_address.php + * @magentoConfigFixture current_store customer/create_account/tax_calculation_address_type shipping + * @magentoConfigFixture current_store customer/create_account/default_group 1 + * @magentoConfigFixture current_store customer/create_account/auto_group_assign 1 + * @magentoConfigFixture current_store tax/calculation/price_includes_tax 1 + * @magentoConfigFixture current_store tax/calculation/shipping_includes_tax 1 + */ + public function testEstimateByAddressWithInclExclTaxAndVATGroup() + { + /** @var CustomerRepositoryInterface $customerRepository */ + $customerRepository = $this->objectManager->get(CustomerRepositoryInterface::class); + $customer = $customerRepository->get('customer@example.com'); + + /** @var GroupInterface $customerGroup */ + $customerGroup = $this->findCustomerGroupByCode('custom_group'); + $customerGroup->setTaxClassId($this->getTaxClass('CustomerTaxClass')->getClassId()); + $this->groupRepository->save($customerGroup); + + $customer->setGroupId($customerGroup->getId()); + $customer->setTaxvat('12'); + $customerRepository->save($customer); + $this->setConfig($customerGroup->getId(), $this->getTaxClass('ProductTaxClass')->getClassId()); + $this->changeCustomerAddress($customer->getDefaultShipping()); + + $quote = $this->objectManager->get(GetQuoteByReservedOrderId::class)->execute('test01'); + + /** @var ShippingMethodManagementInterface $shippingEstimation */ + $shippingEstimation = $this->objectManager->get(ShippingMethodManagementInterface::class); + $result = $shippingEstimation->estimateByAddressId($quote->getId(), $customer->getDefaultShipping()); + + $this->assertEquals(6.05, $result[0]->getPriceInclTax()); + $this->assertEquals(5.0, $result[0]->getPriceExclTax()); + } + + /** + * Find the group with a given code. + * + * @param string $code + * + * @return GroupInterface + */ + protected function findCustomerGroupByCode(string $code): ?GroupInterface + { + /** @var SearchCriteriaBuilder $searchBuilder */ + $searchBuilder = $this->objectManager->get(SearchCriteriaBuilder::class); + $searchCriteria = $searchBuilder->addFilter('code', $code) + ->create(); + $groups = $this->groupRepository->getList($searchCriteria) + ->getItems(); + + return array_shift($groups); + } + + /** + * Change customer address + * + * @param int $customerAddressId + * + * @return AddressInterface + */ + private function changeCustomerAddress(int $customerAddressId): AddressInterface + { + $addressRepository = $this->objectManager->get(AddressRepositoryInterface::class); + $address = $addressRepository->getById($customerAddressId); + $address->setVatId(12345); + $address->setCountryId('DE'); + $address->setRegionId(0); + $address->setPostcode(10178); + + return $addressRepository->save($address); + } + + /** + * Get tax class. + * + * @param string $name + * + * @return TaxClassInterface + */ + private function getTaxClass(string $name): ?TaxClassInterface + { + /** @var SearchCriteriaBuilder $searchBuilder */ + $searchBuilder = $this->objectManager->get(SearchCriteriaBuilder::class); + $searchCriteria = $searchBuilder->addFilter(ClassModel::KEY_NAME, $name) + ->create(); + $searchResults = $this->taxClassRepository->getList($searchCriteria) + ->getItems(); + + return array_shift($searchResults); + } + + /** + * Set the configuration. + * + * @param int $customerGroupId + * @param int $productTaxClassId + * + * @return void + */ + private function setConfig(int $customerGroupId, int $productTaxClassId): void + { + $configData = [ + [ + 'path' => Vat::XML_PATH_CUSTOMER_VIV_INVALID_GROUP, + 'value' => $customerGroupId, + 'scope' => ScopeInterface::SCOPE_STORE, + ], + [ + 'path' => TaxConfig::CONFIG_XML_PATH_SHIPPING_TAX_CLASS, + 'value' => $productTaxClassId, + 'scope' => ScopeInterface::SCOPE_STORE, + ], + ]; + $config = $this->objectManager->get(MutableScopeConfigInterface::class); + foreach ($configData as $data) { + $config->setValue($data['path'], $data['value'], $data['scope']); + } + } } diff --git a/dev/tests/integration/testsuite/Magento/Tax/_files/tax_classes_de.php b/dev/tests/integration/testsuite/Magento/Tax/_files/tax_classes_de.php new file mode 100644 index 0000000000000..d2115e4488b14 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Tax/_files/tax_classes_de.php @@ -0,0 +1,58 @@ +get(TaxClassRepositoryInterface::class); +$taxClassFactory = $objectManager->get(TaxClassInterfaceFactory::class); +/** @var TaxClassInterface $taxClassDataObject */ +$taxClassDataObject = $taxClassFactory->create(); +$taxClassDataObject->setClassName('CustomerTaxClass') + ->setClassType(TaxClassManagementInterface::TYPE_CUSTOMER); +$taxCustomerClassId = $taxClassRepository->save($taxClassDataObject); +$taxClassDataObject = $taxClassFactory->create(); +$taxClassDataObject->setClassName('ProductTaxClass') + ->setClassType(TaxClassManagementInterface::TYPE_PRODUCT); +$taxProductClassId = $taxClassRepository->save($taxClassDataObject); + +$taxRateFactory = $objectManager->get(TaxRateInterfaceFactory::class); +/** @var TaxRateInterface $taxRate */ +$taxRate = $taxRateFactory->create(); +$taxRate->setTaxCountryId('DE') + ->setTaxRegionId(0) + ->setTaxPostcode('*') + ->setCode('Denmark') + ->setRate('21'); +/** @var TaxRateRepositoryInterface $taxRateRepository */ +$taxRateRepository = $objectManager->get(TaxRateRepositoryInterface::class); +$taxRate = $taxRateRepository->save($taxRate); + +/** @var TaxRuleRepositoryInterface $taxRuleRepository */ +$taxRuleRepository = $objectManager->get(TaxRuleRepositoryInterface::class); +$taxRuleFactory = $objectManager->get(TaxRuleInterfaceFactory::class); +/** @var TaxRuleInterface $taxRule */ +$taxRule = $taxRuleFactory->create(); +$taxRule->setCode('Test Rule') + ->setCustomerTaxClassIds([$taxCustomerClassId]) + ->setProductTaxClassIds([$taxProductClassId]) + ->setTaxRateIds([$taxRate->getId()]) + ->setPriority(0); +$taxRuleRepository->save($taxRule); diff --git a/dev/tests/integration/testsuite/Magento/Tax/_files/tax_classes_de_rollback.php b/dev/tests/integration/testsuite/Magento/Tax/_files/tax_classes_de_rollback.php new file mode 100644 index 0000000000000..a87a031ee78a6 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Tax/_files/tax_classes_de_rollback.php @@ -0,0 +1,64 @@ +get(TaxRuleRepositoryInterface::class); +/** @var SearchCriteriaBuilder $searchBuilder */ +$searchBuilder = $objectManager->get(SearchCriteriaBuilder::class); +$searchCriteria = $searchBuilder->addFilter(Rule::KEY_CODE, 'Test Rule') + ->create(); +$taxRules = $taxRuleRepository->getList($searchCriteria) + ->getItems(); +foreach ($taxRules as $taxRule) { + try { + $taxRuleRepository->delete($taxRule); + } catch (NoSuchEntityException $exception) { + //Rule already removed + } +} +$searchCriteria = $searchBuilder->addFilter(ClassModel::KEY_NAME, $taxClasses, 'in') + ->create(); +/** @var TaxClassRepositoryInterface $groupRepository */ +$taxClassRepository = $objectManager->get(TaxClassRepositoryInterface::class); +$taxClasses = $taxClassRepository->getList($searchCriteria) + ->getItems(); +foreach ($taxClasses as $taxClass) { + try { + $taxClassRepository->delete($taxClass); + } catch (NoSuchEntityException $exception) { + //TaxClass already removed + } +} +$searchCriteria = $searchBuilder->addFilter(Rate::KEY_CODE, 'Denmark') + ->create(); +/** @var TaxRateRepositoryInterface $groupRepository */ +$taxRateRepository = $objectManager->get(TaxRateRepositoryInterface::class); +$taxRates = $taxRateRepository->getList($searchCriteria) + ->getItems(); +foreach ($taxRates as $taxRate) { + try { + $taxRateRepository->delete($taxRate); + } catch (NoSuchEntityException $exception) { + //TaxRate already removed + } +} From 539c087563155416e6508cc763de9bf7df9aa42f Mon Sep 17 00:00:00 2001 From: Nazar Klovanych Date: Tue, 28 Jan 2020 11:06:32 +0200 Subject: [PATCH 1033/1143] Refactor Multishipping test for standarts --- .../Model/Checkout/Type/MultishippingTest.php | 241 +++++++++--------- 1 file changed, 127 insertions(+), 114 deletions(-) diff --git a/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/MultishippingTest.php b/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/MultishippingTest.php index 3948025fa0388..397ea8a59e2aa 100644 --- a/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/MultishippingTest.php +++ b/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/MultishippingTest.php @@ -57,7 +57,7 @@ use Magento\Sales\Model\OrderFactory; use Magento\Store\Model\Store; use Magento\Store\Model\StoreManagerInterface; -use PHPUnit_Framework_MockObject_MockObject; +use PHPUnit_Framework_MockObject_MockObject as MockObject; /** * Test class Multishipping @@ -73,112 +73,112 @@ class MultishippingTest extends \PHPUnit\Framework\TestCase protected $model; /** - * @var PHPUnit_Framework_MockObject_MockObject + * @var MockObject */ protected $checkoutSessionMock; /** - * @var PHPUnit_Framework_MockObject_MockObject + * @var MockObject */ protected $customerSessionMock; /** - * @var PHPUnit_Framework_MockObject_MockObject + * @var MockObject */ protected $customerMock; /** - * @var PHPUnit_Framework_MockObject_MockObject + * @var MockObject */ protected $quoteMock; /** - * @var PHPUnit_Framework_MockObject_MockObject + * @var MockObject */ protected $helperMock; /** - * @var PHPUnit_Framework_MockObject_MockObject + * @var MockObject */ protected $filterBuilderMock; /** - * @var PHPUnit_Framework_MockObject_MockObject + * @var MockObject */ protected $addressRepositoryMock; /** - * @var PHPUnit_Framework_MockObject_MockObject + * @var MockObject */ protected $searchCriteriaBuilderMock; /** - * @var PHPUnit_Framework_MockObject_MockObject + * @var MockObject */ protected $totalsCollectorMock; /** - * @var PHPUnit_Framework_MockObject_MockObject + * @var MockObject */ private $cartExtensionFactoryMock; /** - * @var PHPUnit_Framework_MockObject_MockObject + * @var MockObject */ private $shippingAssignmentProcessorMock; /** - * @var PHPUnit_Framework_MockObject_MockObject + * @var MockObject */ private $quoteRepositoryMock; /** - * @var OrderFactory|PHPUnit_Framework_MockObject_MockObject + * @var OrderFactory|MockObject */ private $orderFactoryMock; /** - * @var \Magento\Framework\Api\DataObjectHelper|PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\Api\DataObjectHelper|MockObject */ private $dataObjectHelperMock; /** - * @var ToOrder|PHPUnit_Framework_MockObject_MockObject + * @var ToOrder|MockObject */ private $toOrderMock; /** - * @var ToOrderAddress|PHPUnit_Framework_MockObject_MockObject + * @var ToOrderAddress|MockObject */ private $toOrderAddressMock; /** - * @var ToOrderPayment|PHPUnit_Framework_MockObject_MockObject + * @var ToOrderPayment|MockObject */ private $toOrderPaymentMock; /** - * @var PriceCurrencyInterface|PHPUnit_Framework_MockObject_MockObject + * @var PriceCurrencyInterface|MockObject */ private $priceMock; /** - * @var ToOrderItem|PHPUnit_Framework_MockObject_MockObject + * @var ToOrderItem|MockObject */ private $toOrderItemMock; /** - * @var PlaceOrderFactory|PHPUnit_Framework_MockObject_MockObject + * @var PlaceOrderFactory|MockObject */ private $placeOrderFactoryMock; /** - * @var Generic|PHPUnit_Framework_MockObject_MockObject + * @var Generic|MockObject */ private $sessionMock; /** - * @var PHPUnit_Framework_MockObject_MockObject + * @var MockObject */ private $scopeConfigMock; @@ -598,19 +598,25 @@ public function testCreateOrdersWithThrowsException(array $config): void ->disableOriginalConstructor() ->setMethods(['getOrderOptions']) ->getMock(); + $orderAddressMock = $this->createSimpleMock(OrderAddressInterface::class); + $orderPaymentMock = $this->createSimpleMock(OrderPaymentInterface::class); + $orderItemMock = $this->createMock(\Magento\Sales\Model\Order\Item::class); $productMock = $this->getProductMock($simpleProductTypeMock); - $simpleProductTypeMock->method('getOrderOptions') - ->with($productMock) - ->willReturn($config['infoBuyRequest']); + $orderMock = $this->getOrderMock( + $orderAddressMock, + $orderPaymentMock, + $orderItemMock + ); $quoteItemMock = $this->getQuoteItemMock($config['productType'], $productMock); - $quoteAddressItemMock = - $this->getQuoteAddressItemMock( - $quoteItemMock, - $config['productType'], - $config['infoBuyRequest'] - ); - list($shippingAddressMock, $billingAddressMock) = - $this->getQuoteAddressesMock($quoteAddressItemMock, $config['addressTotal']); + $quoteAddressItemMock = $this->getQuoteAddressItemMock( + $quoteItemMock, + $config['productType'], + $config['infoBuyRequest'] + ); + list($shippingAddressMock, $billingAddressMock) = $this->getQuoteAddressesMock( + $quoteAddressItemMock, + $config['addressTotal'] + ); $this->setQuoteMockData( $config['paymentProviderCode'], $shippingAddressMock, @@ -618,30 +624,23 @@ public function testCreateOrdersWithThrowsException(array $config): void ); $currencyMock = $this->getCurrencyMock($config['shippingPrice']); $storeMock = $this->getStoreMock($currencyMock, $config['currencyCode']); - $orderAddressMock = $this->createSimpleMock(OrderAddressInterface::class); - $orderPaymentMock = $this->createSimpleMock(OrderPaymentInterface::class); - $orderItemMock = $this->getMockBuilder(\Magento\Sales\Model\Order\Item::class) + $placeOrderServiceMock = $this->getMockBuilder(PlaceOrderDefault::class) ->disableOriginalConstructor() - ->setMethods(['getQuoteItemId']) + ->setMethods(['place']) ->getMock(); - $orderItemMock->method('getQuoteItemId') - ->willReturn($config['quoteItemId']); - $orderMock = $this->getOrderMock( - $orderAddressMock, - $orderPaymentMock, - $orderItemMock - ); + + $orderItemMock->method('getQuoteItemId')->willReturn($config['quoteItemId']); + $simpleProductTypeMock->method('getOrderOptions') + ->with($productMock) + ->willReturn($config['infoBuyRequest']); $this->getOrderMockData($orderMock, $storeMock, $config['shippingPrice']); $this->orderFactoryMock->expects($this->once()) ->method('create') ->willReturn($orderMock); $this->dataObjectHelperMock->expects($this->once()) ->method('mergeDataObjects') - ->with( - OrderInterface::class, - $orderMock, - $orderMock - )->willReturnSelf(); + ->with(OrderInterface::class, $orderMock, $orderMock) + ->willReturnSelf(); $this->priceMock->expects($this->once()) ->method('round') ->with($config['addressTotal']) @@ -652,19 +651,13 @@ public function testCreateOrdersWithThrowsException(array $config): void ->willReturn($orderMock); $this->toOrderAddressMock->expects($this->exactly(2)) ->method('convert') - ->withConsecutive( - [$billingAddressMock, []], - [$shippingAddressMock, []] - )->willReturn($orderAddressMock); + ->withConsecutive([$billingAddressMock, []], [$shippingAddressMock, []]) + ->willReturn($orderAddressMock); $this->toOrderPaymentMock->method('convert') ->willReturn($orderPaymentMock); $this->toOrderItemMock->method('convert') ->with($quoteAddressItemMock) ->willReturn($orderItemMock); - $placeOrderServiceMock = $this->getMockBuilder(PlaceOrderDefault::class) - ->disableOriginalConstructor() - ->setMethods(['place']) - ->getMock(); $placeOrderServiceMock->method('place') ->with([$orderMock]) ->willReturn([$config['quoteId'] => new \Exception()]); @@ -680,6 +673,7 @@ public function testCreateOrdersWithThrowsException(array $config): void $this->quoteRepositoryMock->expects($this->once()) ->method('save') ->with($this->quoteMock); + $this->expectExceptionMessage('Quote address for failed order ID "1" not found.'); $this->model->createOrders(); @@ -688,11 +682,11 @@ public function testCreateOrdersWithThrowsException(array $config): void /** * Return Store Mock. * - * @param PHPUnit_Framework_MockObject_MockObject $currencyMock + * @param MockObject $currencyMock * @param string $currencyCode - * @return PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ - private function getStoreMock($currencyMock, string $currencyCode): PHPUnit_Framework_MockObject_MockObject + private function getStoreMock($currencyMock, string $currencyCode): MockObject { $storeMock = $this->getMockBuilder(Store::class) ->disableOriginalConstructor() @@ -709,14 +703,14 @@ private function getStoreMock($currencyMock, string $currencyCode): PHPUnit_Fram /** * Return Order Mock with data * - * @param PHPUnit_Framework_MockObject_MockObject $orderMock - * @param PHPUnit_Framework_MockObject_MockObject $storeMock + * @param MockObject $orderMock + * @param MockObject $storeMock * @param string $shippingPrice * @return void */ private function getOrderMockData( - PHPUnit_Framework_MockObject_MockObject $orderMock, - PHPUnit_Framework_MockObject_MockObject $storeMock, + MockObject $orderMock, + MockObject $storeMock, string $shippingPrice ): void { $orderMock->expects($this->once()) @@ -736,9 +730,9 @@ private function getOrderMockData( * Return Payment Mock. * * @param string $paymentProviderCode - * @return PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ - private function getPaymentMock(string $paymentProviderCode): PHPUnit_Framework_MockObject_MockObject + private function getPaymentMock(string $paymentProviderCode): MockObject { $abstractMethod = $this->getMockBuilder(AbstractMethod::class) ->disableOriginalConstructor() @@ -759,10 +753,10 @@ private function getPaymentMock(string $paymentProviderCode): PHPUnit_Framework_ /** * Return Product Mock. * - * @param Simple|PHPUnit_Framework_MockObject_MockObject $simpleProductTypeMock - * @return PHPUnit_Framework_MockObject_MockObject + * @param Simple|MockObject $simpleProductTypeMock + * @return MockObject */ - private function getProductMock($simpleProductTypeMock): PHPUnit_Framework_MockObject_MockObject + private function getProductMock($simpleProductTypeMock): MockObject { $productMock = $this->getMockBuilder(\Magento\Catalog\Model\Product::class) ->disableOriginalConstructor() @@ -777,10 +771,10 @@ private function getProductMock($simpleProductTypeMock): PHPUnit_Framework_MockO * Return Quote Item Mock. * * @param string $productType - * @param \Magento\Catalog\Model\Product|PHPUnit_Framework_MockObject_MockObject $productMock - * @return PHPUnit_Framework_MockObject_MockObject + * @param \Magento\Catalog\Model\Product|MockObject $productMock + * @return MockObject */ - private function getQuoteItemMock($productType, $productMock): PHPUnit_Framework_MockObject_MockObject + private function getQuoteItemMock($productType, $productMock): MockObject { $quoteItemMock = $this->getMockBuilder(\Magento\Quote\Model\Quote\Item::class) ->disableOriginalConstructor() @@ -795,16 +789,16 @@ private function getQuoteItemMock($productType, $productMock): PHPUnit_Framework /** * Return Quote Address Item Mock * - * @param \Magento\Quote\Model\Quote\Item|PHPUnit_Framework_MockObject_MockObject $quoteItemMock + * @param \Magento\Quote\Model\Quote\Item|MockObject $quoteItemMock * @param string $productType * @param array $infoBuyRequest - * @return PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ private function getQuoteAddressItemMock( $quoteItemMock, string $productType, array $infoBuyRequest - ): PHPUnit_Framework_MockObject_MockObject { + ): MockObject { $quoteAddressItemMock = $this->getMockBuilder(\Magento\Quote\Model\Quote\Address\Item::class) ->disableOriginalConstructor() ->setMethods(['getQuoteItem', 'setProductType', 'setProductOptions', 'getParentItem']) @@ -819,7 +813,7 @@ private function getQuoteAddressItemMock( /** * Return Quote Addresses Mock - * @param \Magento\Quote\Model\Quote\Address\Item|PHPUnit_Framework_MockObject_MockObject $quoteAddressItemMock + * @param \Magento\Quote\Model\Quote\Address\Item|MockObject $quoteAddressItemMock * @param int $addressTotal * @return array */ @@ -865,8 +859,8 @@ private function getQuoteAddressesMock($quoteAddressItemMock, int $addressTotal) * Set data for Quote Mock. * * @param string $paymentProviderCode - * @param Address|PHPUnit_Framework_MockObject_MockObject $shippingAddressMock - * @param Address|PHPUnit_Framework_MockObject_MockObject $billingAddressMock + * @param Address|MockObject $shippingAddressMock + * @param Address|MockObject $billingAddressMock * * @return void */ @@ -890,16 +884,16 @@ private function setQuoteMockData(string $paymentProviderCode, $shippingAddressM /** * Return Order Mock. * - * @param OrderAddressInterface|PHPUnit_Framework_MockObject_MockObject $orderAddressMock - * @param OrderPaymentInterface|PHPUnit_Framework_MockObject_MockObject $orderPaymentMock - * @param \Magento\Sales\Model\Order\Item|PHPUnit_Framework_MockObject_MockObject $orderItemMock - * @return PHPUnit_Framework_MockObject_MockObject + * @param OrderAddressInterface|MockObject $orderAddressMock + * @param OrderPaymentInterface|MockObject $orderPaymentMock + * @param \Magento\Sales\Model\Order\Item|MockObject $orderItemMock + * @return MockObject */ private function getOrderMock( $orderAddressMock, $orderPaymentMock, $orderItemMock - ): PHPUnit_Framework_MockObject_MockObject { + ): MockObject { $orderMock = $this->getMockBuilder(\Magento\Sales\Model\Order::class) ->disableOriginalConstructor() ->setMethods( @@ -989,20 +983,33 @@ public function testCreateOrdersCountryNotPresentInAllowedListException(): void public function testValidateMinimumAmountMultiAddressFalse(): void { $addressMock = $this->createMock(\Magento\Quote\Model\Quote\Address::class); - $this->scopeConfigMock->expects($this->exactly(2))->method('isSetFlag')->withConsecutive( - ['sales/minimum_order/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE], - ['sales/minimum_order/multi_address', \Magento\Store\Model\ScopeInterface::SCOPE_STORE] - )->willReturnOnConsecutiveCalls(true, false); - $this->scopeConfigMock->expects($this->exactly(2))->method('getValue')->withConsecutive( - ['sales/minimum_order/amount', \Magento\Store\Model\ScopeInterface::SCOPE_STORE], - ['sales/minimum_order/tax_including', \Magento\Store\Model\ScopeInterface::SCOPE_STORE] - )->willReturnOnConsecutiveCalls(100, false); + $this->scopeConfigMock->expects($this->exactly(2)) + ->method('isSetFlag') + ->withConsecutive( + ['sales/minimum_order/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE], + ['sales/minimum_order/multi_address', \Magento\Store\Model\ScopeInterface::SCOPE_STORE] + )->willReturnOnConsecutiveCalls(true, false); - $this->checkoutSessionMock->expects($this->atLeastOnce())->method('getQuote')->willReturn($this->quoteMock); - $this->quoteMock->expects($this->once())->method('getStoreId')->willReturn(1); - $this->quoteMock->expects($this->once())->method('getAllAddresses')->willReturn([$addressMock]); - $addressMock->expects($this->once())->method('getBaseSubtotalWithDiscount')->willReturn(101); + $this->scopeConfigMock->expects($this->exactly(2)) + ->method('getValue') + ->withConsecutive( + ['sales/minimum_order/amount', \Magento\Store\Model\ScopeInterface::SCOPE_STORE], + ['sales/minimum_order/tax_including', \Magento\Store\Model\ScopeInterface::SCOPE_STORE] + )->willReturnOnConsecutiveCalls(100, false); + + $this->checkoutSessionMock->expects($this->atLeastOnce()) + ->method('getQuote') + ->willReturn($this->quoteMock); + $this->quoteMock->expects($this->once()) + ->method('getStoreId') + ->willReturn(1); + $this->quoteMock->expects($this->once()) + ->method('getAllAddresses') + ->willReturn([$addressMock]); + $addressMock->expects($this->once()) + ->method('getBaseSubtotalWithDiscount') + ->willReturn(101); $this->assertTrue($this->model->validateMinimumAmount()); } @@ -1014,13 +1021,20 @@ public function testValidateMinimumAmountMultiAddressFalse(): void */ public function testValidateMinimumAmountMultiAddressTrue(): void { - $this->scopeConfigMock->expects($this->exactly(2))->method('isSetFlag')->withConsecutive( - ['sales/minimum_order/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE], - ['sales/minimum_order/multi_address', \Magento\Store\Model\ScopeInterface::SCOPE_STORE] - )->willReturnOnConsecutiveCalls(true, true); + $this->scopeConfigMock->expects($this->exactly(2)) + ->method('isSetFlag') + ->withConsecutive( + ['sales/minimum_order/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE], + ['sales/minimum_order/multi_address', \Magento\Store\Model\ScopeInterface::SCOPE_STORE] + )->willReturnOnConsecutiveCalls(true, true); + + $this->checkoutSessionMock->expects($this->atLeastOnce()) + ->method('getQuote') + ->willReturn($this->quoteMock); + $this->quoteMock->expects($this->once()) + ->method('validateMinimumAmount') + ->willReturn(false); - $this->checkoutSessionMock->expects($this->atLeastOnce())->method('getQuote')->willReturn($this->quoteMock); - $this->quoteMock->expects($this->once())->method('validateMinimumAmount')->willReturn(false); $this->assertFalse($this->model->validateMinimumAmount()); } @@ -1028,11 +1042,10 @@ public function testValidateMinimumAmountMultiAddressTrue(): void * Return Extension Attributes Mock. * * @param ShippingAssignment $shippingAssignmentMock - * @return CartExtension|PHPUnit_Framework_MockObject_MockObject + * @return CartExtension|MockObject */ - private function getExtensionAttributesMock( - ShippingAssignment $shippingAssignmentMock - ): PHPUnit_Framework_MockObject_MockObject { + private function getExtensionAttributesMock(ShippingAssignment $shippingAssignmentMock): MockObject + { $extensionAttributesMock = $this->getMockBuilder(CartExtension::class) ->setMethods(['setShippingAssignments']) ->getMock(); @@ -1049,9 +1062,9 @@ private function getExtensionAttributesMock( /** * Return Shipping Assignment Mock. * - * @return ShippingAssignment | PHPUnit_Framework_MockObject_MockObject + * @return ShippingAssignment | MockObject */ - private function getShippingAssignmentMock(): PHPUnit_Framework_MockObject_MockObject + private function getShippingAssignmentMock(): MockObject { $shippingAssignmentMock = $this->getMockBuilder(ShippingAssignment::class) ->disableOriginalConstructor() @@ -1101,9 +1114,9 @@ private function mockShippingAssignment(): void * Return Customer Address Mock * * @param $customerAddressId - * @return Address | PHPUnit_Framework_MockObject_MockObject + * @return Address | MockObject */ - private function getCustomerAddressMock($customerAddressId): PHPUnit_Framework_MockObject_MockObject + private function getCustomerAddressMock($customerAddressId): MockObject { $customerAddressMock = $this->getMockBuilder(Address::class) ->setMethods(['getId']) @@ -1120,9 +1133,9 @@ private function getCustomerAddressMock($customerAddressId): PHPUnit_Framework_M * Return Simple Mock. * * @param string $className - * @return PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ - private function createSimpleMock($className): PHPUnit_Framework_MockObject_MockObject + private function createSimpleMock($className): MockObject { return $this->getMockBuilder($className) ->disableOriginalConstructor() @@ -1133,9 +1146,9 @@ private function createSimpleMock($className): PHPUnit_Framework_MockObject_Mock * Return Currency Mock. * * @param $shippingPrice - * @return PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ - private function getCurrencyMock($shippingPrice): PHPUnit_Framework_MockObject_MockObject + private function getCurrencyMock($shippingPrice): MockObject { $currencyMock = $this->getMockBuilder(Currency::class) ->disableOriginalConstructor() From 12feb34d275c64a66066deafb2b17004acb6d429 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych Date: Tue, 28 Jan 2020 11:10:59 +0200 Subject: [PATCH 1034/1143] refactore private methods to match docblock standart --- .../Unit/Model/Checkout/Type/MultishippingTest.php | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/MultishippingTest.php b/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/MultishippingTest.php index 397ea8a59e2aa..a3a0b8c227a61 100644 --- a/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/MultishippingTest.php +++ b/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/MultishippingTest.php @@ -794,11 +794,8 @@ private function getQuoteItemMock($productType, $productMock): MockObject * @param array $infoBuyRequest * @return MockObject */ - private function getQuoteAddressItemMock( - $quoteItemMock, - string $productType, - array $infoBuyRequest - ): MockObject { + private function getQuoteAddressItemMock($quoteItemMock, string $productType, array $infoBuyRequest): MockObject + { $quoteAddressItemMock = $this->getMockBuilder(\Magento\Quote\Model\Quote\Address\Item::class) ->disableOriginalConstructor() ->setMethods(['getQuoteItem', 'setProductType', 'setProductOptions', 'getParentItem']) @@ -889,11 +886,8 @@ private function setQuoteMockData(string $paymentProviderCode, $shippingAddressM * @param \Magento\Sales\Model\Order\Item|MockObject $orderItemMock * @return MockObject */ - private function getOrderMock( - $orderAddressMock, - $orderPaymentMock, - $orderItemMock - ): MockObject { + private function getOrderMock($orderAddressMock, $orderPaymentMock, $orderItemMock): MockObject + { $orderMock = $this->getMockBuilder(\Magento\Sales\Model\Order::class) ->disableOriginalConstructor() ->setMethods( From b8480b8b890d0ce589d08c58c9c911764d4e64d4 Mon Sep 17 00:00:00 2001 From: "vadim.malesh" Date: Tue, 28 Jan 2020 10:30:26 +0200 Subject: [PATCH 1035/1143] fix static --- .../web/css/source/module/checkout/_shipping.less | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_shipping.less b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_shipping.less index f054140c0e1b2..8f2092713b718 100644 --- a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_shipping.less +++ b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_shipping.less @@ -211,12 +211,6 @@ } } } - - #shipping-method-buttons-container { - .button { - margin-top: 2px; - } - } } // @@ -302,6 +296,9 @@ .action { &.primary { margin: 0; + &.button { + margin-top: 2px; + } } } } From 471b3f87748152ac6affb0bfc0787b81c2a7ca4f Mon Sep 17 00:00:00 2001 From: Serhii Voloshkov Date: Tue, 28 Jan 2020 11:03:54 +0200 Subject: [PATCH 1036/1143] MC-23633: Catalog Inventory modal refactor --- .../Model/Stock/StockItemModifyChecker.php | 70 ++++++++++ ...gInventoryChangeManageStockActionGroup.xml | 24 ++++ .../Stock/StockItemModifyCheckerTest.php | 132 ++++++++++++++++++ .../Form/Modifier/AdvancedInventory.php | 1 + .../Form/Modifier/AdvancedInventoryModal.php | 70 ++++++++++ .../CatalogInventory/etc/adminhtml/di.xml | 11 ++ .../adminhtml/ui_component/product_form.xml | 68 ++++++--- .../js/components/use-config-min-sale-qty.js | 4 +- .../web/js/components/use-config-settings.js | 25 +++- .../Product/Form/Modifier/ConfigurableQty.php | 6 +- .../Product/Form/Modifier/StockData.php | 14 +- .../web/js/components/qty-configurable.js | 45 ++++++ .../js/components/qty-configurable.test.js | 107 ++++++++++++++ 13 files changed, 536 insertions(+), 41 deletions(-) create mode 100644 app/code/Magento/CatalogInventory/Model/Stock/StockItemModifyChecker.php create mode 100644 app/code/Magento/CatalogInventory/Test/Mftf/ActionGroup/AdminCatalogInventoryChangeManageStockActionGroup.xml create mode 100644 app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/StockItemModifyCheckerTest.php create mode 100644 app/code/Magento/CatalogInventory/Ui/DataProvider/Product/Form/Modifier/AdvancedInventoryModal.php create mode 100644 app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/qty-configurable.js create mode 100644 dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/qty-configurable.test.js diff --git a/app/code/Magento/CatalogInventory/Model/Stock/StockItemModifyChecker.php b/app/code/Magento/CatalogInventory/Model/Stock/StockItemModifyChecker.php new file mode 100644 index 0000000000000..ca8869c6ec5e6 --- /dev/null +++ b/app/code/Magento/CatalogInventory/Model/Stock/StockItemModifyChecker.php @@ -0,0 +1,70 @@ +stockItemRepository = $stockItemRepository; + $this->arrayUtils = $arrayUtils; + $this->skippedAttributes = $skippedAttributes; + } + + /** + * Check if stock item is modified. + * + * @param StockItem $model + * @return bool + */ + public function isModified($model): bool + { + if (!$model->getId()) { + return true; + } + $stockItem = $this->stockItemRepository->get($model->getId()); + $stockItemData = $stockItem->getData(); + $modelData = $model->getData(); + foreach ($this->skippedAttributes as $attribute) { + unset($stockItemData[$attribute], $modelData[$attribute]); + } + $diff = $this->arrayUtils->recursiveDiff($stockItemData, $modelData); + + return !empty($diff); + } +} diff --git a/app/code/Magento/CatalogInventory/Test/Mftf/ActionGroup/AdminCatalogInventoryChangeManageStockActionGroup.xml b/app/code/Magento/CatalogInventory/Test/Mftf/ActionGroup/AdminCatalogInventoryChangeManageStockActionGroup.xml new file mode 100644 index 0000000000000..2c38f14f53379 --- /dev/null +++ b/app/code/Magento/CatalogInventory/Test/Mftf/ActionGroup/AdminCatalogInventoryChangeManageStockActionGroup.xml @@ -0,0 +1,24 @@ + + + + + + + Opens advanced inventory modal if it has not opened yet. Sets Manage stock value. + + + + + + + + + + + diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/StockItemModifyCheckerTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/StockItemModifyCheckerTest.php new file mode 100644 index 0000000000000..5e4617ff47193 --- /dev/null +++ b/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/StockItemModifyCheckerTest.php @@ -0,0 +1,132 @@ +stockItemRepository = $this->createPartialMock(StockItemRepository::class, ['get']); + $this->arrayUtils = $this->createPartialMock(ArrayUtils::class, ['recursiveDiff']); + $this->stockItemModel = $this->createPartialMock(StockItem::class, ['getId', 'getData']); + + $this->model = $objectManager->getObject( + StockItemModifyChecker::class, + [ + 'stockItemRepository' => $this->stockItemRepository, + 'arrayUtils' => $this->arrayUtils, + 'skippedAttributes' => [StockItemInterface::LOW_STOCK_DATE], + ] + ); + } + + /** + * Test for IsModified method when data is not modified. + * + * @return void + */ + public function testIsModifiedForNotModifiedModel(): void + { + $itemFromRepository = [ + 'id' => 1, + 'low_stock_date' => '01.01.2020', + 'qty' => 100, + ]; + $model = [ + 'id' => 1, + 'low_stock_date' => '01.01.2021', + 'qty' => 100 + ]; + $this->stockItemModel->expects($this->exactly(2))->method('getId')->willReturn($model['id']); + $this->stockItemRepository->expects($this->once())->method('get')->willReturn($this->stockItemModel); + $this->stockItemModel->expects($this->exactly(2)) + ->method('getData') + ->willReturnOnConsecutiveCalls($itemFromRepository, $model); + $this->arrayUtils->expects($this->once())->method('recursiveDiff')->willReturn([]); + + $this->assertFalse($this->model->isModified($this->stockItemModel)); + } + + /** + * Test for IsModified method when model is new. + * + * @return void + */ + public function testIsModifiedWhenModelIsNew(): void + { + $this->stockItemModel->expects($this->once())->method('getId')->willReturn(null); + $this->stockItemRepository->expects($this->never())->method('get'); + + $this->assertTrue($this->model->isModified($this->stockItemModel)); + } + + /** + * Test for IsModified method when found difference between data. + * + * @return void + */ + public function testIsModifiedWhenDifferenceFound(): void + { + $itemFromRepository = [ + 'id' => 1, + 'low_stock_date' => '01.01.2020', + 'qty' => 100, + ]; + $model = [ + 'id' => 1, + 'low_stock_date' => '01.01.2021', + 'qty' => 99 + ]; + $this->stockItemModel->expects($this->exactly(2))->method('getId')->willReturn($model['id']); + $this->stockItemRepository->expects($this->once())->method('get')->willReturn($this->stockItemModel); + $this->stockItemModel->expects($this->exactly(2)) + ->method('getData') + ->willReturnOnConsecutiveCalls($itemFromRepository, $model); + $this->arrayUtils->expects($this->once())->method('recursiveDiff')->willReturn(['qty' => 100]); + + $this->assertTrue($this->model->isModified($this->stockItemModel)); + } +} 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 aafde14a28584..38a33b75f552a 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 @@ -242,6 +242,7 @@ private function prepareMeta() 'handleChanges' => '${$.provider}:data.product.stock_data.is_qty_decimal', ], 'sortOrder' => 10, + 'disabled' => $this->locator->getProduct()->isLockedAttribute($fieldCode), ]; $advancedInventoryButton['arguments']['data']['config'] = [ 'displayAsLink' => true, diff --git a/app/code/Magento/CatalogInventory/Ui/DataProvider/Product/Form/Modifier/AdvancedInventoryModal.php b/app/code/Magento/CatalogInventory/Ui/DataProvider/Product/Form/Modifier/AdvancedInventoryModal.php new file mode 100644 index 0000000000000..76194b0710441 --- /dev/null +++ b/app/code/Magento/CatalogInventory/Ui/DataProvider/Product/Form/Modifier/AdvancedInventoryModal.php @@ -0,0 +1,70 @@ +locator = $locator; + } + + /** + * @inheritdoc + */ + public function modifyMeta(array $meta) + { + $this->meta = $meta; + $this->prepareMeta(); + + return $this->meta; + } + + /** + * @inheritdoc + */ + public function modifyData(array $data) + { + return $data; + } + + /** + * Modify Advanced Inventory Modal meta. + * + * @return array + */ + private function prepareMeta(): array + { + $product = $this->locator->getProduct(); + $readOnly = (bool)$product->getInventoryReadonly(); + + $this->meta['advanced_inventory_modal']['children']['stock_data']['arguments'] + ['data']['config']['disabled'] = $readOnly; + + return $this->meta; + } +} diff --git a/app/code/Magento/CatalogInventory/etc/adminhtml/di.xml b/app/code/Magento/CatalogInventory/etc/adminhtml/di.xml index 28035de29bc2e..d4dd1b1647416 100644 --- a/app/code/Magento/CatalogInventory/etc/adminhtml/di.xml +++ b/app/code/Magento/CatalogInventory/etc/adminhtml/di.xml @@ -37,10 +37,21 @@ Magento\CatalogInventory\Ui\DataProvider\Product\Form\Modifier\AdvancedInventory 20 + + Magento\CatalogInventory\Ui\DataProvider\Product\Form\Modifier\AdvancedInventoryModal + 900 + + + + + Magento\CatalogInventory\Api\Data\StockItemInterface::LOW_STOCK_DATE + + + diff --git a/app/code/Magento/CatalogInventory/view/adminhtml/ui_component/product_form.xml b/app/code/Magento/CatalogInventory/view/adminhtml/ui_component/product_form.xml index c77c77a5183d0..27ce26cabc627 100644 --- a/app/code/Magento/CatalogInventory/view/adminhtml/ui_component/product_form.xml +++ b/app/code/Magento/CatalogInventory/view/adminhtml/ui_component/product_form.xml @@ -49,6 +49,9 @@ [GLOBAL] manage_stock + + ${$.parentName}.use_config_${$.index}:disableParent + @@ -410,9 +426,9 @@ ${$.provider}:data.product.stock_data.backorders - - ${$.parentName}.backorders:disabled - + + ns = ${ $.ns }, index = stock_data:disabled + @@ -450,6 +466,9 @@ notify_stock_qty + + ${$.parentName}.use_config_${$.index}:disableParent + @@ -465,9 +484,9 @@ ${$.provider}:data.product.stock_data.notify_stock_qty - - ${$.parentName}.notify_stock_qty:disabled - + + ns = ${ $.ns }, index = stock_data:disabled + @@ -500,6 +519,9 @@ [GLOBAL] enable_qty_increments + + ${$.parentName}.use_config_${$.index}:disableParent + diff --git a/app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/use-config-min-sale-qty.js b/app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/use-config-min-sale-qty.js index 4ac1d5ed2d294..c7ca38f05f707 100644 --- a/app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/use-config-min-sale-qty.js +++ b/app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/use-config-min-sale-qty.js @@ -37,7 +37,7 @@ define([ /** * @inheritdoc */ - 'onCheckedChanged': function (newChecked) { + onCheckedChanged: function (newChecked) { var valueFromConfig = this.valueFromConfig(); if (newChecked && (_.isArray(valueFromConfig) && valueFromConfig.length === 0 || valueFromConfig === 1)) { @@ -49,7 +49,7 @@ define([ this.changeVisibleDisabled(this.inputField, true, true, null); this.changeVisibleDisabled(this.dynamicRowsField, false, true, null); } else { - this.changeVisibleDisabled(this.inputField, true, false, null); + this.changeVisibleDisabled(this.inputField, true, this.disabled() || false, null); this.changeVisibleDisabled(this.dynamicRowsField, false, true, null); } diff --git a/app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/use-config-settings.js b/app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/use-config-settings.js index f91797448fa55..e121743b0f69f 100644 --- a/app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/use-config-settings.js +++ b/app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/use-config-settings.js @@ -11,7 +11,15 @@ define([ return checkbox.extend({ defaults: { valueFromConfig: '', - linkedValue: '' + linkedValue: '', + disableParent: false, + listens: { + disabled: 'processState', + checked: 'processState onCheckedChanged' + }, + imports: { + readOnly: 'ns = ${ $.ns }, index = stock_data:disabled' + } }, /** @@ -20,13 +28,24 @@ define([ initObservable: function () { return this ._super() - .observe(['valueFromConfig', 'linkedValue']); + .observe(['valueFromConfig', 'linkedValue', 'disableParent']); + }, + + /** + * Handle checked and disabled changes to calculate disableParent value + */ + processState: function () { + this.disableParent(this.checked() || this.readOnly); + + if (this.readOnly) { + this.disable(); + } }, /** * @inheritdoc */ - 'onCheckedChanged': function (newChecked) { + onCheckedChanged: function (newChecked) { if (newChecked) { this.linkedValue(this.valueFromConfig()); } diff --git a/app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/ConfigurableQty.php b/app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/ConfigurableQty.php index ade56edeb3dfc..6eb65efa2ecae 100644 --- a/app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/ConfigurableQty.php +++ b/app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/ConfigurableQty.php @@ -41,10 +41,8 @@ public function modifyMeta(array $meta) 'arguments' => [ 'data' => [ 'config' => [ - 'imports' => [ - 'disabled' => '!ns = ${ $.ns }, index = ' - . ConfigurablePanel::CONFIGURABLE_MATRIX . ':isEmpty', - ], + 'component' => 'Magento_ConfigurableProduct/js/' . + 'components/qty-configurable' ], ], ], diff --git a/app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/StockData.php b/app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/StockData.php index 58b58b11c1b1c..db51e7eebefc4 100644 --- a/app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/StockData.php +++ b/app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/StockData.php @@ -28,7 +28,7 @@ public function __construct(LocatorInterface $locator) } /** - * {@inheritdoc} + * @inheritdoc */ public function modifyData(array $data) { @@ -36,7 +36,7 @@ public function modifyData(array $data) } /** - * {@inheritdoc} + * @inheritdoc */ public function modifyMeta(array $meta) { @@ -72,15 +72,7 @@ public function modifyMeta(array $meta) ], ]; - $meta['advanced_inventory_modal'] = [ - 'children' => [ - 'stock_data' => [ - 'children' => [ - 'qty' => $config, - ], - ], - ], - ]; + $meta['advanced_inventory_modal']['children']['stock_data']['children']['qty'] = $config; } return $meta; diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/qty-configurable.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/qty-configurable.js new file mode 100644 index 0000000000000..6b3840bdec450 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/qty-configurable.js @@ -0,0 +1,45 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +define([ + 'Magento_Ui/js/form/element/abstract' +], function (Abstract) { + 'use strict'; + + return Abstract.extend({ + defaults: { + imports: { + isConfigurable: '!ns = ${ $.ns }, index = configurable-matrix:isEmpty' + } + }, + + /** @inheritdoc */ + initialize: function () { + this._super(); + // resolve initial disable state + this.handleQtyValue(this.isConfigurable); + + /** important to set this listener in initialize because of a different order of processing. + * Do not move to defaults->listens section */ + this.setListeners({ + isConfigurable: 'handleQtyValue' + }); + + return this; + }, + + /** + * Disable and clear Qty if product type changed to configurable + * + * @param {String} isConfigurable + */ + handleQtyValue: function (isConfigurable) { + this.disabled(!!this.isUseDefault() || isConfigurable); + + if (isConfigurable) { + this.clear(); + } + } + }); +}); diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/qty-configurable.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/qty-configurable.test.js new file mode 100644 index 0000000000000..1c81c9fabf85e --- /dev/null +++ b/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/qty-configurable.test.js @@ -0,0 +1,107 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +define(['squire'], function (Squire) { + 'use strict'; + + var injector = new Squire(), + Component, + params = { + name: 'qty-element', + dataScope: '', + value: 1000, + setListeners: jasmine.createSpy().and.callFake(function () { + return this; + }), + setLinks: jasmine.createSpy().and.callFake(function () { + this.isConfigurable = false; + + return this; + }) + }; + + beforeEach(function (done) { + injector.require( + ['Magento_ConfigurableProduct/js/components/qty-configurable'], function (QtyConfigurable) { + Component = QtyConfigurable; + done(); + }); + }); + + afterEach(function () { + try { + injector.remove(); + injector.clean(); + } catch (e) { + } + }); + + describe('Magento_ConfigurableProduct/js/components/qty-configurable', function () { + it('Product is not configurable by default', function () { + var component = new Component(params); + + expect(component.disabled()).toBeFalsy(); + expect(component.value()).toEqual(1000); + }); + + it('State of component does not changed', function () { + var component = new Component(params); + + expect(component.disabled()).toBeFalsy(); + + component.value(99); + component.handleQtyValue(false); + + expect(component.disabled()).toBeFalsy(); + expect(component.value()).toEqual(99); + }); + + it('Product changed to configurable', function () { + var component = new Component(params); + + expect(component.disabled()).toBeFalsy(); + expect(component.value()).toEqual(1000); + + component.handleQtyValue(true); + + expect(component.disabled()).toBeTruthy(); + expect(component.value()).toEqual(''); + }); + + it('Product is configurable by default', function () { + var component = new Component($.extend({}, params, { + // eslint-disable-next-line max-nested-callbacks + setLinks: jasmine.createSpy().and.callFake(function () { + this.isConfigurable = true; + + return this; + }) + })); + + expect(component.disabled()).toBeTruthy(); + expect(component.value()).toEqual(''); + }); + + it('Product changed from configurable to another one', function () { + var component = new Component($.extend({}, params, { + // eslint-disable-next-line max-nested-callbacks + setLinks: jasmine.createSpy().and.callFake(function () { + this.isConfigurable = true; + + return this; + }) + })); + + expect(component.disabled()).toBeTruthy(); + expect(component.value()).toEqual(''); + + component.value(100); + component.handleQtyValue(false); + + expect(component.disabled()).toBeFalsy(); + expect(component.value()).toEqual(100); + }); + }); +}); From 776b544c25ea451fea9f7b332d64c6f8bd04048a Mon Sep 17 00:00:00 2001 From: Ihor Sviziev Date: Tue, 28 Jan 2020 11:52:42 +0200 Subject: [PATCH 1037/1143] Fix small typo in test --- .../Test/Unit/Model/Checkout/Type/MultishippingTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/MultishippingTest.php b/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/MultishippingTest.php index a3a0b8c227a61..c7f85a9edacb4 100644 --- a/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/MultishippingTest.php +++ b/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/MultishippingTest.php @@ -330,7 +330,7 @@ public function testSetShippingItemsInformation(): void } /** - * Verefi set shipping items information for address leak + * Verify set shipping items information for address leak * * @return void * @throws LocalizedException From 4fbd865b77f0da776e993a0bcf8278fd54b31b3d Mon Sep 17 00:00:00 2001 From: Ihor Sviziev Date: Tue, 28 Jan 2020 11:56:37 +0200 Subject: [PATCH 1038/1143] Fix variable name in test --- .../Test/Unit/Model/Checkout/Type/MultishippingTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/MultishippingTest.php b/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/MultishippingTest.php index c7f85a9edacb4..747d88353f022 100644 --- a/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/MultishippingTest.php +++ b/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/MultishippingTest.php @@ -931,7 +931,7 @@ private function getOrderMock($orderAddressMock, $orderPaymentMock, $orderItemMo */ public function testCreateOrdersCountryNotPresentInAllowedListException(): void { - $ExceptionMessage = 'Some addresses can\'t be used due to the configurations for specific countries.'; + $exceptionMessage = 'Some addresses can\'t be used due to the configurations for specific countries.'; $abstractMethod = $this->getMockBuilder(AbstractMethod::class) ->disableOriginalConstructor() @@ -964,7 +964,7 @@ public function testCreateOrdersCountryNotPresentInAllowedListException(): void ->willReturn($paymentMock); $this->quoteMock->method('getAllShippingAddresses') ->willReturn([$shippingAddressMock]); - $this->expectExceptionMessage($ExceptionMessage); + $this->expectExceptionMessage($exceptionMessage); $this->model->createOrders(); } From f01776e61c022ec932e3470e6f7bfa8a0b233f14 Mon Sep 17 00:00:00 2001 From: Andrii Kalinich <51681435+engcom-Echo@users.noreply.github.com> Date: Mon, 27 Jan 2020 15:52:16 +0200 Subject: [PATCH 1039/1143] Update RedirectTest.php --- .../Unit/Controller/Store/RedirectTest.php | 67 ++++++++++--------- 1 file changed, 36 insertions(+), 31 deletions(-) diff --git a/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php b/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php index 319620f3c6a02..1124a66fe7a40 100755 --- a/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php +++ b/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php @@ -7,6 +7,7 @@ namespace Magento\Store\Test\Unit\Controller\Store; +use Magento\Framework\App\Action\Context; use Magento\Framework\App\ActionInterface; use Magento\Framework\App\RequestInterface; use Magento\Framework\App\Response\RedirectInterface; @@ -117,18 +118,23 @@ protected function setUp() ->willReturnSelf(); $objectManager = new ObjectManagerHelper($this); - + $context = $objectManager->getObject( + Context::class, + [ + '_request' => $this->requestMock, + '_redirect' => $this->redirectMock, + '_response' => $this->responseMock, + ] + ); $this->redirectController = $objectManager->getObject( Redirect::class, [ - 'storeRepository' => $this->storeRepositoryMock, - 'storeResolver' => $this->storeResolverMock, - 'messageManager' => $this->messageManagerMock, - '_request' => $this->requestMock, - '_redirect' => $this->redirectMock, - '_response' => $this->responseMock, - 'sidResolver' => $this->sidResolverMock, - 'hashGenerator' => $this->hashGeneratorMock + 'storeRepository' => $this->storeRepositoryMock, + 'storeResolver' => $this->storeResolverMock, + 'messageManager' => $this->messageManagerMock, + 'sidResolver' => $this->sidResolverMock, + 'hashGenerator' => $this->hashGeneratorMock, + 'context' => $context, ] ); } @@ -146,13 +152,16 @@ protected function setUp() public function testRedirect(string $defaultStoreViewCode, string $storeCode): void { $this->requestMock - ->expects($this->any()) - ->method('getParam')->willReturnMap( - [ - [StoreResolver::PARAM_NAME, null, $storeCode], - ['___from_store', null, $defaultStoreViewCode], - [ActionInterface::PARAM_NAME_URL_ENCODED, null, $defaultStoreViewCode] - ] + ->expects($this->exactly(3)) + ->method('getParam') + ->withConsecutive( + [StoreResolver::PARAM_NAME], + ['___from_store'], + [ActionInterface::PARAM_NAME_URL_ENCODED] + )->willReturnOnConsecutiveCalls( + $storeCode, + $defaultStoreViewCode, + $defaultStoreViewCode ); $this->storeRepositoryMock ->expects($this->once()) @@ -162,7 +171,7 @@ public function testRedirect(string $defaultStoreViewCode, string $storeCode): v $this->formStoreMock ->expects($this->once()) ->method('getCode') - ->willReturnSelf(); + ->willReturn($defaultStoreViewCode); $this->sidResolverMock ->expects($this->once()) ->method('getUseSessionInUrl') @@ -172,7 +181,6 @@ public function testRedirect(string $defaultStoreViewCode, string $storeCode): v ->method('generateHash') ->with($this->formStoreMock) ->willReturn([]); - $this->redirectMock ->expects($this->once()) ->method('redirect') @@ -182,12 +190,11 @@ public function testRedirect(string $defaultStoreViewCode, string $storeCode): v ['_nosid' => true, '_query' => [ 'uenc' => $defaultStoreViewCode, - '___from_store' => $this->formStoreMock, + '___from_store' => $defaultStoreViewCode, '___store' => $storeCode ] ] - ) - ->willReturnSelf(); + ); $this->assertEquals(null, $this->redirectController->execute()); } @@ -204,15 +211,13 @@ public function testRedirect(string $defaultStoreViewCode, string $storeCode): v public function testRedirectWithThrowsException(string $defaultStoreViewCode, string $storeCode): void { $this->requestMock - ->expects($this->at(0)) - ->method('getParam') - ->with(StoreResolver::PARAM_NAME) - ->willReturn($storeCode); - $this->requestMock - ->expects($this->at(1)) - ->method('getParam') - ->with('___from_store') - ->willReturn($defaultStoreViewCode); + ->expects($this->exactly(2)) + ->method('getParam')->willReturnMap( + [ + [StoreResolver::PARAM_NAME, null, $storeCode], + ['___from_store', null, $defaultStoreViewCode] + ] + ); $this->storeRepositoryMock ->expects($this->once()) ->method('get') @@ -269,7 +274,7 @@ public function testRedirectTargetIsNull(): void public function getConfigDataProvider(): array { return [ - [ self::DEFAULT_STORE_VIEW_CODE, self::STORE_CODE ] + [self::DEFAULT_STORE_VIEW_CODE, self::STORE_CODE] ]; } } From 6f14ca23b1299c3c4a9963011264ee49e67abfcf Mon Sep 17 00:00:00 2001 From: engcom-Echo Date: Tue, 28 Jan 2020 12:47:03 +0200 Subject: [PATCH 1040/1143] Minor changes --- .../Command/TemplateHintsStatusCommand.php | 15 +++++++-------- .../Command/TemplateHintsStatusCommandTest.php | 13 ++++++------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php b/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php index 01c4fe42e083e..42e2d214a330c 100644 --- a/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php +++ b/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php @@ -7,19 +7,18 @@ namespace Magento\Developer\Console\Command; +use Magento\Framework\App\Config\ReinitableConfigInterface; +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\Console\Cli; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Magento\Framework\App\Config\ScopeConfigInterface; -use Magento\Framework\App\Config\ReinitableConfigInterface; -use Magento\Framework\Console\Cli; /** * Command to show frontend template hints status */ class TemplateHintsStatusCommand extends Command { - const COMMAND_NAME = 'dev:template-hints:status'; const TEMPLATE_HINTS_STOREFRONT_PATH = 'dev/debug/template_hints_storefront'; @@ -27,6 +26,7 @@ class TemplateHintsStatusCommand extends Command * @var ScopeConfigInterface */ private $scopeConfig; + /** * @var ReinitableConfigInterface */ @@ -41,8 +41,7 @@ class TemplateHintsStatusCommand extends Command public function __construct( ScopeConfigInterface $scopeConfig, ReinitableConfigInterface $reinitableConfig - ) - { + ) { parent::__construct(); $this->scopeConfig = $scopeConfig; $this->reinitableConfig = $reinitableConfig; @@ -51,7 +50,7 @@ public function __construct( /** * @inheritdoc */ - protected function configure() + public function configure() { $this->setName(self::COMMAND_NAME) ->setDescription('Show frontend template hints status.'); @@ -63,7 +62,7 @@ protected function configure() * @inheritdoc * @throws \InvalidArgumentException */ - protected function execute(InputInterface $input, OutputInterface $output) + public function execute(InputInterface $input, OutputInterface $output) { $this->reinitableConfig->reinit(); $templateHintsStatus = diff --git a/app/code/Magento/Developer/Test/Unit/Console/Command/TemplateHintsStatusCommandTest.php b/app/code/Magento/Developer/Test/Unit/Console/Command/TemplateHintsStatusCommandTest.php index 7c6ab356b4ada..e3db485635e18 100644 --- a/app/code/Magento/Developer/Test/Unit/Console/Command/TemplateHintsStatusCommandTest.php +++ b/app/code/Magento/Developer/Test/Unit/Console/Command/TemplateHintsStatusCommandTest.php @@ -7,11 +7,11 @@ namespace Magento\Developer\Test\Unit\Console\Command; -use PHPUnit\Framework\TestCase; -use Symfony\Component\Console\Tester\CommandTester; use Magento\Developer\Console\Command\TemplateHintsStatusCommand; -use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\App\Config\ReinitableConfigInterface; +use Magento\Framework\App\Config\ScopeConfigInterface; +use PHPUnit\Framework\TestCase; +use Symfony\Component\Console\Tester\CommandTester; /** * Class TemplateHintsStatusCommandTest @@ -35,7 +35,7 @@ class TemplateHintsStatusCommandTest extends TestCase private $reinitableConfigMock; /** - * TemplateHintsStatusCommandTest setup + * @inheritDoc */ protected function setUp() { @@ -46,11 +46,10 @@ protected function setUp() $this->scopeConfigMock, $this->reinitableConfigMock ); - } /** - * Test execution + * Verify execution */ public function testExecute() { @@ -62,4 +61,4 @@ public function testExecute() $tester->getStatusCode() ); } -} \ No newline at end of file +} From ac66ee7062a416a366ffaa8a7ec53f11ddf68354 Mon Sep 17 00:00:00 2001 From: Michele Fantetti Date: Tue, 28 Jan 2020 11:59:16 +0100 Subject: [PATCH 1041/1143] Add frontend template hints status command after suggestions --- .../Unit/Console/Command/TemplateHintsStatusCommandTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Developer/Test/Unit/Console/Command/TemplateHintsStatusCommandTest.php b/app/code/Magento/Developer/Test/Unit/Console/Command/TemplateHintsStatusCommandTest.php index e3db485635e18..f3acb5d2e1f5e 100644 --- a/app/code/Magento/Developer/Test/Unit/Console/Command/TemplateHintsStatusCommandTest.php +++ b/app/code/Magento/Developer/Test/Unit/Console/Command/TemplateHintsStatusCommandTest.php @@ -10,6 +10,7 @@ use Magento\Developer\Console\Command\TemplateHintsStatusCommand; use Magento\Framework\App\Config\ReinitableConfigInterface; use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\Console\Cli; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Tester\CommandTester; @@ -57,7 +58,7 @@ public function testExecute() $tester->execute([]); $this->assertEquals( - 0, + Cli::RETURN_SUCCESS, $tester->getStatusCode() ); } From 1bb9a791e6fbf74a68cea5aeac48da0da2406e86 Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh Date: Tue, 28 Jan 2020 13:53:10 +0200 Subject: [PATCH 1042/1143] MC-30391: Category not considered Configurable product in cart rule --- .../Model/Rule/Condition/ProductTest.php | 51 +------------------ 1 file changed, 2 insertions(+), 49 deletions(-) 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 6f4a298f04553..066f30667b53c 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 @@ -6,10 +6,6 @@ namespace Magento\SalesRule\Model\Rule\Condition; -use Magento\Quote\Api\CartRepositoryInterface; -use Magento\Framework\Api\SearchCriteriaBuilder; -use Magento\Quote\Api\Data\CartInterface; -use Magento\SalesRule\Api\RuleRepositoryInterface; use Magento\Framework\Registry; use Magento\SalesRule\Model\Rule; @@ -18,6 +14,8 @@ */ class ProductTest extends \PHPUnit\Framework\TestCase { + use ConditionHelper; + /** * @var \Magento\Framework\ObjectManagerInterface */ @@ -133,51 +131,6 @@ public function testValidateQtySalesRuleWithConfigurable() ); } - /** - * Gets quote by reserved order id. - * - * @param string $reservedOrderId - * @return CartInterface - */ - private function getQuote($reservedOrderId) - { - /** @var SearchCriteriaBuilder $searchCriteriaBuilder */ - $searchCriteriaBuilder = $this->objectManager->get(SearchCriteriaBuilder::class); - $searchCriteria = $searchCriteriaBuilder->addFilter('reserved_order_id', $reservedOrderId) - ->create(); - - /** @var CartRepositoryInterface $quoteRepository */ - $quoteRepository = $this->objectManager->get(CartRepositoryInterface::class); - $items = $quoteRepository->getList($searchCriteria)->getItems(); - return array_pop($items); - } - - /** - * Gets rule by name. - * - * @param string $name - * @return \Magento\SalesRule\Model\Rule - * @throws \Magento\Framework\Exception\InputException - * @throws \Magento\Framework\Exception\NoSuchEntityException - */ - private function getSalesRule(string $name): \Magento\SalesRule\Model\Rule - { - /** @var SearchCriteriaBuilder $searchCriteriaBuilder */ - $searchCriteriaBuilder = $this->objectManager->get(SearchCriteriaBuilder::class); - $searchCriteria = $searchCriteriaBuilder->addFilter('name', $name) - ->create(); - - /** @var CartRepositoryInterface $quoteRepository */ - $ruleRepository = $this->objectManager->get(RuleRepositoryInterface::class); - $items = $ruleRepository->getList($searchCriteria)->getItems(); - - $rule = array_pop($items); - /** @var \Magento\SalesRule\Model\Converter\ToModel $converter */ - $converter = $this->objectManager->get(\Magento\SalesRule\Model\Converter\ToModel::class); - - return $converter->toModel($rule); - } - /** * Ensure that SalesRules filtering on quote items quantity validates configurable product parent category correctly * From 1251f01b4ab88d5ef70447667e1f482feb01b055 Mon Sep 17 00:00:00 2001 From: "vadim.malesh" Date: Tue, 28 Jan 2020 15:03:32 +0200 Subject: [PATCH 1043/1143] magento/magento2#26455: fix mftf --- ...onfigFieldSetGuestNotAllowedActionGroup.xml | 18 ------------------ ...LinkDisplayedForGuestSubscriptionNoTest.xml | 8 ++------ 2 files changed, 2 insertions(+), 24 deletions(-) delete mode 100644 app/code/Magento/Newsletter/Test/Mftf/ActionGroup/AdminNewsletterConfigFieldSetGuestNotAllowedActionGroup.xml diff --git a/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/AdminNewsletterConfigFieldSetGuestNotAllowedActionGroup.xml b/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/AdminNewsletterConfigFieldSetGuestNotAllowedActionGroup.xml deleted file mode 100644 index a6242797cf3c6..0000000000000 --- a/app/code/Magento/Newsletter/Test/Mftf/ActionGroup/AdminNewsletterConfigFieldSetGuestNotAllowedActionGroup.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - diff --git a/app/code/Magento/Newsletter/Test/Mftf/Test/VerifyRegistredLinkDisplayedForGuestSubscriptionNoTest.xml b/app/code/Magento/Newsletter/Test/Mftf/Test/VerifyRegistredLinkDisplayedForGuestSubscriptionNoTest.xml index 0780363b682cd..3288de47dd4b9 100644 --- a/app/code/Magento/Newsletter/Test/Mftf/Test/VerifyRegistredLinkDisplayedForGuestSubscriptionNoTest.xml +++ b/app/code/Magento/Newsletter/Test/Mftf/Test/VerifyRegistredLinkDisplayedForGuestSubscriptionNoTest.xml @@ -10,12 +10,8 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> - - - - - - + From cea0c66b4e0179b490198ae26dd78110e6913022 Mon Sep 17 00:00:00 2001 From: engcom-Echo Date: Tue, 28 Jan 2020 14:20:04 +0200 Subject: [PATCH 1044/1143] Fix RedirectTest --- .../Unit/Controller/Store/RedirectTest.php | 67 ++++++++++++------- 1 file changed, 43 insertions(+), 24 deletions(-) diff --git a/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php b/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php index 1124a66fe7a40..88de664f3bb29 100755 --- a/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php +++ b/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php @@ -94,14 +94,34 @@ class RedirectTest extends TestCase */ protected function setUp() { - $this->requestMock = $this->createMock(RequestInterface::class); - $this->redirectMock = $this->createMock(RedirectInterface::class); - $this->storeResolverMock = $this->createMock(StoreResolverInterface::class); - $this->storeRepositoryMock = $this->createMock(StoreRepositoryInterface::class); - $this->messageManagerMock = $this->createMock(ManagerInterface::class); - $this->responseMock = $this->createMock(ResponseInterface::class); + $this->requestMock = $this->getMockBuilder(RequestInterface::class) + ->disableOriginalConstructor() + ->setMethods(['getParam']) + ->getMockForAbstractClass(); + $this->redirectMock = $this->getMockBuilder(RedirectInterface::class) + ->disableOriginalConstructor() + ->setMethods(['redirect']) + ->getMockForAbstractClass(); + $this->storeResolverMock = $this->getMockBuilder(StoreResolverInterface::class) + ->disableOriginalConstructor() + ->setMethods(['getCurrentStoreId']) + ->getMockForAbstractClass(); + $this->storeRepositoryMock = $this->getMockBuilder(StoreRepositoryInterface::class) + ->disableOriginalConstructor() + ->setMethods(['getById', 'get']) + ->getMockForAbstractClass(); + $this->messageManagerMock = $this->getMockBuilder(ManagerInterface::class) + ->disableOriginalConstructor() + ->setMethods(['addErrorMessage']) + ->getMockForAbstractClass(); + $this->responseMock = $this->getMockBuilder(ResponseInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); $this->formStoreMock = $this->createMock(Store::class); - $this->sidResolverMock = $this->createMock(SidResolverInterface::class); + $this->sidResolverMock = $this->getMockBuilder(SidResolverInterface::class) + ->disableOriginalConstructor() + ->setMethods(['getUseSessionInUrl']) + ->getMockForAbstractClass(); $this->hashGeneratorMock = $this->createMock(HashGenerator::class); $this->currentStoreMock = $this->getMockBuilder(Store::class) @@ -124,6 +144,7 @@ protected function setUp() '_request' => $this->requestMock, '_redirect' => $this->redirectMock, '_response' => $this->responseMock, + 'messageManager' => $this->messageManagerMock, ] ); $this->redirectController = $objectManager->getObject( @@ -131,7 +152,6 @@ protected function setUp() [ 'storeRepository' => $this->storeRepositoryMock, 'storeResolver' => $this->storeResolverMock, - 'messageManager' => $this->messageManagerMock, 'sidResolver' => $this->sidResolverMock, 'hashGenerator' => $this->hashGeneratorMock, 'context' => $context, @@ -147,7 +167,6 @@ protected function setUp() * * @dataProvider getConfigDataProvider * @return void - * @throws NoSuchEntityException */ public function testRedirect(string $defaultStoreViewCode, string $storeCode): void { @@ -206,17 +225,18 @@ public function testRedirect(string $defaultStoreViewCode, string $storeCode): v * @param string $storeCode * @return void * @dataProvider getConfigDataProvider - * @throws NoSuchEntityException */ public function testRedirectWithThrowsException(string $defaultStoreViewCode, string $storeCode): void { $this->requestMock ->expects($this->exactly(2)) - ->method('getParam')->willReturnMap( - [ - [StoreResolver::PARAM_NAME, null, $storeCode], - ['___from_store', null, $defaultStoreViewCode] - ] + ->method('getParam') + ->withConsecutive( + [StoreResolver::PARAM_NAME], + ['___from_store'] + )->willReturnOnConsecutiveCalls( + $storeCode, + $defaultStoreViewCode ); $this->storeRepositoryMock ->expects($this->once()) @@ -245,20 +265,19 @@ public function testRedirectWithThrowsException(string $defaultStoreViewCode, st * Verify redirect target is null * * @return void - * @throws NoSuchEntityException */ public function testRedirectTargetIsNull(): void { $this->requestMock - ->expects($this->at(0)) - ->method('getParam') - ->with(StoreResolver::PARAM_NAME) - ->willReturn(null); - $this->requestMock - ->expects($this->at(1)) + ->expects($this->exactly(2)) ->method('getParam') - ->with('___from_store') - ->willReturnSelf(); + ->withConsecutive( + [StoreResolver::PARAM_NAME], + ['___from_store'] + )->willReturnOnConsecutiveCalls( + null, + null + ); $this->storeRepositoryMock ->expects($this->never()) ->method('get'); From 6d985af3486280a5a672ef32681a6cdb2a148aa3 Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh Date: Tue, 28 Jan 2020 16:11:26 +0200 Subject: [PATCH 1045/1143] MC-30739: Custom customer address attribute code showing on checkout --- .../Checkout/view/frontend/web/js/view/billing-address.js | 8 +++++--- .../js/view/shipping-address/address-renderer/default.js | 8 +++++--- .../view/shipping-information/address-renderer/default.js | 8 +++++--- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js b/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js index e728a5c0fcdd5..f850386890470 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js @@ -255,9 +255,11 @@ function ( return attribute.label; } - resultAttribute = _.findWhere(this.source.get('customAttributes')[attribute['attribute_code']], { - value: attribute.value - }); + if (typeof this.source.get('customAttributes') !== 'undefined') { + resultAttribute = _.findWhere(this.source.get('customAttributes')[attribute['attribute_code']], { + value: attribute.value + }); + } return resultAttribute && resultAttribute.label || attribute.value; } diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/shipping-address/address-renderer/default.js b/app/code/Magento/Checkout/view/frontend/web/js/view/shipping-address/address-renderer/default.js index 939a2af1a25aa..1f8cc90fe1622 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/shipping-address/address-renderer/default.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/shipping-address/address-renderer/default.js @@ -65,9 +65,11 @@ define([ return attribute.label; } - resultAttribute = _.findWhere(this.source.get('customAttributes')[attribute['attribute_code']], { - value: attribute.value - }); + if (typeof this.source.get('customAttributes') !== 'undefined') { + resultAttribute = _.findWhere(this.source.get('customAttributes')[attribute['attribute_code']], { + value: attribute.value + }); + } return resultAttribute && resultAttribute.label || attribute.value; }, diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/shipping-information/address-renderer/default.js b/app/code/Magento/Checkout/view/frontend/web/js/view/shipping-information/address-renderer/default.js index 009178cbb19b9..6ec9fde554dc2 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/shipping-information/address-renderer/default.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/shipping-information/address-renderer/default.js @@ -42,9 +42,11 @@ define([ return attribute.label; } - resultAttribute = _.findWhere(this.source.get('customAttributes')[attribute['attribute_code']], { - value: attribute.value - }); + if (typeof this.source.get('customAttributes') !== 'undefined') { + resultAttribute = _.findWhere(this.source.get('customAttributes')[attribute['attribute_code']], { + value: attribute.value + }); + } return resultAttribute && resultAttribute.label || attribute.value; } From bc06501851838ca9a07a3fc437b778c46366b4e9 Mon Sep 17 00:00:00 2001 From: Serhii Balko Date: Tue, 28 Jan 2020 16:13:17 +0200 Subject: [PATCH 1046/1143] MC-30148: Temporary files are not deleted after exporting products --- .../ImportExport/Model/Export/Adapter/Csv.php | 19 ++--- .../AbstractProductExportImportTestCase.php | 17 +++-- .../Model/Export/Adapter/CsvTest.php | 70 +++++++++++++++++++ 3 files changed, 92 insertions(+), 14 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Adapter/CsvTest.php diff --git a/app/code/Magento/ImportExport/Model/Export/Adapter/Csv.php b/app/code/Magento/ImportExport/Model/Export/Adapter/Csv.php index 25081b5797c25..09b17371ae4e8 100644 --- a/app/code/Magento/ImportExport/Model/Export/Adapter/Csv.php +++ b/app/code/Magento/ImportExport/Model/Export/Adapter/Csv.php @@ -5,13 +5,16 @@ */ namespace Magento\ImportExport\Model\Export\Adapter; +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Filesystem\File\Write; + /** * Export adapter csv. * * @api * @since 100.0.2 */ -class Csv extends \Magento\ImportExport\Model\Export\Adapter\AbstractAdapter +class Csv extends AbstractAdapter { /** * Field delimiter. @@ -30,21 +33,20 @@ class Csv extends \Magento\ImportExport\Model\Export\Adapter\AbstractAdapter /** * Source file handler. * - * @var \Magento\Framework\Filesystem\File\Write + * @var Write */ protected $_fileHandler; /** - * {@inheritdoc } + * Object destructor */ - public function __construct(\Magento\Framework\Filesystem $filesystem, $destination = null) + public function __destruct() { - register_shutdown_function([$this, 'destruct']); - parent::__construct($filesystem, $destination); + $this->destruct(); } /** - * Object destructor. + * Clean cached values * * @return void */ @@ -52,6 +54,7 @@ public function destruct() { if (is_object($this->_fileHandler)) { $this->_fileHandler->close(); + $this->_directoryHandle->delete($this->_destination); } } @@ -96,7 +99,7 @@ public function getFileExtension() public function setHeaderCols(array $headerColumns) { if (null !== $this->_headerCols) { - throw new \Magento\Framework\Exception\LocalizedException(__('The header column names are already set.')); + throw new LocalizedException(__('The header column names are already set.')); } if ($headerColumns) { foreach ($headerColumns as $columnName) { diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/AbstractProductExportImportTestCase.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/AbstractProductExportImportTestCase.php index d3a2e4c53f246..eecdcdf038cf8 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/AbstractProductExportImportTestCase.php +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/AbstractProductExportImportTestCase.php @@ -7,6 +7,7 @@ use Magento\Framework\App\Bootstrap; use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\ImportExport\Model\Export\Adapter\AbstractAdapter; use Magento\Store\Model\Store; /** @@ -62,6 +63,11 @@ abstract class AbstractProductExportImportTestCase extends \PHPUnit\Framework\Te 'tax_class_id', ]; + /** + * @var AbstractAdapter + */ + private $writer; + /** * @inheritdoc */ @@ -367,7 +373,7 @@ protected function executeImportReplaceTest( * Export products in the system. * * @param \Magento\CatalogImportExport\Model\Export\Product|null $exportProduct - * @return string Return exported file name + * @return string Return exported file */ private function exportProducts(\Magento\CatalogImportExport\Model\Export\Product $exportProduct = null) { @@ -376,12 +382,11 @@ private function exportProducts(\Magento\CatalogImportExport\Model\Export\Produc $exportProduct = $exportProduct ?: $this->objectManager->create( \Magento\CatalogImportExport\Model\Export\Product::class ); - $exportProduct->setWriter( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - \Magento\ImportExport\Model\Export\Adapter\Csv::class, - ['fileSystem' => $this->fileSystem, 'destination' => $csvfile] - ) + $this->writer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + \Magento\ImportExport\Model\Export\Adapter\Csv::class, + ['fileSystem' => $this->fileSystem, 'destination' => $csvfile] ); + $exportProduct->setWriter($this->writer); $this->assertNotEmpty($exportProduct->export()); return $csvfile; diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Adapter/CsvTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Adapter/CsvTest.php new file mode 100644 index 0000000000000..b874e55aea9ed --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Adapter/CsvTest.php @@ -0,0 +1,70 @@ +objectManager = Bootstrap::getObjectManager(); + $this->csv = $this->objectManager->create( + Csv::class, + ['destination' => $this->destination] + ); + } + + /** + * Test to destruct export adapter + */ + public function testDestruct(): void + { + /** @var Filesystem $fileSystem */ + $fileSystem = $this->objectManager->get(Filesystem::class); + $directoryHandle = $fileSystem->getDirectoryRead(DirectoryList::VAR_DIR); + /** Assert that the destination file is present after construct */ + $this->assertFileExists( + $directoryHandle->getAbsolutePath($this->destination), + 'The destination file was\'t created after construct' + ); + /** Assert that the destination file was removed after destruct */ + $this->csv = null; + $this->assertFileNotExists( + $directoryHandle->getAbsolutePath($this->destination), + 'The destination file was\'t removed after destruct' + ); + } +} From a1ac22c564de3fff5ab3a66d24d26c592e194e58 Mon Sep 17 00:00:00 2001 From: Serhii Voloshkov Date: Tue, 28 Jan 2020 17:02:29 +0200 Subject: [PATCH 1047/1143] MC-23633: Catalog Inventory modal refactor --- .../Stock/StockItemModifyCheckerTest.php | 92 ++++++++++--------- 1 file changed, 49 insertions(+), 43 deletions(-) diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/StockItemModifyCheckerTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/StockItemModifyCheckerTest.php index 5e4617ff47193..73f3a8af29666 100644 --- a/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/StockItemModifyCheckerTest.php +++ b/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/StockItemModifyCheckerTest.php @@ -38,7 +38,7 @@ class StockItemModifyCheckerTest extends TestCase private $stockItemModel; /** - * @var ArrayUtils|MockObject + * @var ArrayUtils */ private $arrayUtils; @@ -50,7 +50,7 @@ protected function setUp() $objectManager = new ObjectManager($this); $this->stockItemRepository = $this->createPartialMock(StockItemRepository::class, ['get']); - $this->arrayUtils = $this->createPartialMock(ArrayUtils::class, ['recursiveDiff']); + $this->arrayUtils = $objectManager->getObject(ArrayUtils::class); $this->stockItemModel = $this->createPartialMock(StockItem::class, ['getId', 'getData']); $this->model = $objectManager->getObject( @@ -63,33 +63,6 @@ protected function setUp() ); } - /** - * Test for IsModified method when data is not modified. - * - * @return void - */ - public function testIsModifiedForNotModifiedModel(): void - { - $itemFromRepository = [ - 'id' => 1, - 'low_stock_date' => '01.01.2020', - 'qty' => 100, - ]; - $model = [ - 'id' => 1, - 'low_stock_date' => '01.01.2021', - 'qty' => 100 - ]; - $this->stockItemModel->expects($this->exactly(2))->method('getId')->willReturn($model['id']); - $this->stockItemRepository->expects($this->once())->method('get')->willReturn($this->stockItemModel); - $this->stockItemModel->expects($this->exactly(2)) - ->method('getData') - ->willReturnOnConsecutiveCalls($itemFromRepository, $model); - $this->arrayUtils->expects($this->once())->method('recursiveDiff')->willReturn([]); - - $this->assertFalse($this->model->isModified($this->stockItemModel)); - } - /** * Test for IsModified method when model is new. * @@ -106,27 +79,60 @@ public function testIsModifiedWhenModelIsNew(): void /** * Test for IsModified method when found difference between data. * + * @param array $itemFromRepository + * @param array $model + * @param bool $expectedResult * @return void + * @dataProvider stockItemModelDataProvider */ - public function testIsModifiedWhenDifferenceFound(): void - { - $itemFromRepository = [ - 'id' => 1, - 'low_stock_date' => '01.01.2020', - 'qty' => 100, - ]; - $model = [ - 'id' => 1, - 'low_stock_date' => '01.01.2021', - 'qty' => 99 - ]; + public function testIsModified( + array $itemFromRepository, + array $model, + bool $expectedResult + ): void { $this->stockItemModel->expects($this->exactly(2))->method('getId')->willReturn($model['id']); $this->stockItemRepository->expects($this->once())->method('get')->willReturn($this->stockItemModel); $this->stockItemModel->expects($this->exactly(2)) ->method('getData') ->willReturnOnConsecutiveCalls($itemFromRepository, $model); - $this->arrayUtils->expects($this->once())->method('recursiveDiff')->willReturn(['qty' => 100]); - $this->assertTrue($this->model->isModified($this->stockItemModel)); + $this->assertEquals($expectedResult, $this->model->isModified($this->stockItemModel)); + } + + /** + * Data provider for testIsModified. + * + * @return array + */ + public function stockItemModelDataProvider(): array + { + return [ + 'Model is modified' => [ + 'stockItemFromRepository' => [ + 'id' => 1, + 'low_stock_date' => '01.01.2020', + 'qty' => 100, + ], + 'model' => [ + 'id' => 1, + 'low_stock_date' => '01.01.2021', + 'qty' => 99, + ], + 'expectedResult' => true, + ], + 'Model is not modified' => [ + 'stockItemFromRepository' => [ + 'id' => 1, + 'low_stock_date' => '01.01.2020', + 'qty' => 100, + ], + 'model' => [ + 'id' => 1, + 'low_stock_date' => '01.01.2021', + 'qty' => 100, + ], + 'expectedResult' => false, + ], + ]; } } From 270e8e4e579aedc4ddbc285731de907d35e23d78 Mon Sep 17 00:00:00 2001 From: eduard13 Date: Tue, 28 Jan 2020 18:49:52 +0200 Subject: [PATCH 1048/1143] Small adjustments --- .../Csp/Test/Unit/Model/Mode/ConfigManagerTest.php | 8 +++----- .../Csp/Test/Unit/Model/PolicyRendererPoolTest.php | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/Csp/Test/Unit/Model/Mode/ConfigManagerTest.php b/app/code/Magento/Csp/Test/Unit/Model/Mode/ConfigManagerTest.php index c574abc1bad59..a41c03b512fc5 100644 --- a/app/code/Magento/Csp/Test/Unit/Model/Mode/ConfigManagerTest.php +++ b/app/code/Magento/Csp/Test/Unit/Model/Mode/ConfigManagerTest.php @@ -20,8 +20,6 @@ use RuntimeException; /** - * Class ConfigManagerTest - * * Test for \Magento\Csp\Model\Mode\ConfigManager */ class ConfigManagerTest extends TestCase @@ -71,9 +69,6 @@ protected function setUp() * Test throwing an exception for non storefront or admin areas * * @return void - * - * @expectedExceptionMessage CSP can only be configured for storefront or admin area - * @expectedException RuntimeException */ public function testThrownExceptionForCrontabArea() { @@ -81,6 +76,9 @@ public function testThrownExceptionForCrontabArea() ->method('getAreaCode') ->willReturn(Area::AREA_CRONTAB); + $this->expectExceptionMessage('CSP can only be configured for storefront or admin area'); + $this->expectException(RuntimeException::class); + $this->model->getConfigured(); } diff --git a/app/code/Magento/Csp/Test/Unit/Model/PolicyRendererPoolTest.php b/app/code/Magento/Csp/Test/Unit/Model/PolicyRendererPoolTest.php index 2b551d4b8dcaf..84ee8584ebf59 100644 --- a/app/code/Magento/Csp/Test/Unit/Model/PolicyRendererPoolTest.php +++ b/app/code/Magento/Csp/Test/Unit/Model/PolicyRendererPoolTest.php @@ -17,8 +17,6 @@ use RuntimeException; /** - * Class PolicyRendererPoolTest - * * Test for \Magento\Csp\Model\PolicyRendererPool */ class PolicyRendererPoolTest extends TestCase @@ -66,9 +64,6 @@ protected function setUp() * Test throwing an exception for not found policy renders * * @return void - * - * @expectedExceptionMessage Failed to find a renderer for policy - * @expectedException RuntimeException */ public function testThrownExceptionForNotFoundPolicyRenders() { @@ -76,6 +71,9 @@ public function testThrownExceptionForNotFoundPolicyRenders() ->method('getId') ->willReturn(static::STUB_POLICY_ID); + $this->expectExceptionMessage('Failed to find a renderer for policy'); + $this->expectException(RuntimeException::class); + $this->model->getRenderer($this->policyMock); } From 2e346af25356e3681dd76fada865aae563676a69 Mon Sep 17 00:00:00 2001 From: Lukasz Bajsarowicz Date: Tue, 28 Jan 2020 18:41:53 +0100 Subject: [PATCH 1049/1143] Semantic Version Checker fix --- app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php b/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php index 37bc356e32db5..ac66392efe5dc 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php @@ -158,7 +158,7 @@ public function getItemCollection() /** * Get collection items * - * @return DataObject[] + * @return \Magento\Framework\DataObject[] */ public function getItems() { @@ -232,7 +232,7 @@ public function getIterableItem() * * @param string $type * @param int $limit - * @return $this + * @return \Magento\Catalog\Block\Product\ProductList\Upsell */ public function setItemLimit($type, $limit) { From eb979046e02e5e44a88deae892f665b28791e77e Mon Sep 17 00:00:00 2001 From: Sathish Date: Wed, 29 Jan 2020 00:14:23 +0530 Subject: [PATCH 1050/1143] array_map updated instead of foreach --- app/code/Magento/Fedex/Model/Source/Generic.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Fedex/Model/Source/Generic.php b/app/code/Magento/Fedex/Model/Source/Generic.php index b1c1c0aedb863..a7442f7a18128 100644 --- a/app/code/Magento/Fedex/Model/Source/Generic.php +++ b/app/code/Magento/Fedex/Model/Source/Generic.php @@ -1,5 +1,4 @@ */ class Generic implements \Magento\Framework\Data\OptionSourceInterface { @@ -44,9 +41,14 @@ public function toOptionArray() $configData = $this->_shippingFedex->getCode($this->_code); $arr = []; if ($configData) { - foreach ($configData as $code => $title) { - $arr[] = ['value' => $code, 'label' => $title]; - } + $arr = array_map( + function ($code, $title) { + return [ + 'value' => $code, + 'label' => $title + ]; + }, array_keys($configData), $configData + ); } return $arr; From 74b1d8b24d6c936e2042d6c5dede88b494069764 Mon Sep 17 00:00:00 2001 From: Sathish Date: Wed, 29 Jan 2020 01:13:02 +0530 Subject: [PATCH 1051/1143] Static test fix --- app/code/Magento/Fedex/Model/Source/Generic.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Fedex/Model/Source/Generic.php b/app/code/Magento/Fedex/Model/Source/Generic.php index a7442f7a18128..c918dd7ad0013 100644 --- a/app/code/Magento/Fedex/Model/Source/Generic.php +++ b/app/code/Magento/Fedex/Model/Source/Generic.php @@ -47,7 +47,9 @@ function ($code, $title) { 'value' => $code, 'label' => $title ]; - }, array_keys($configData), $configData + }, + array_keys($configData), + $configData ); } From e22b34b3e5ae0c2241684298c2dcaafa00f45e5e Mon Sep 17 00:00:00 2001 From: Ajith Date: Wed, 29 Jan 2020 01:54:21 +0530 Subject: [PATCH 1052/1143] Action group added for existing test --- .../AdminNavigateToPageGridActionGroup.xml | 19 +++++++++++++++ ...reateNewPageWithBasicValuesActionGroup.xml | 24 +++++++++++++++++++ .../VerifyCreatedCmsPageActionGroup.xml | 21 ++++++++++++++++ .../Test/Mftf/Test/AdminCreateCmsPageTest.xml | 23 ++++-------------- 4 files changed, 68 insertions(+), 19 deletions(-) create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminNavigateToPageGridActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/CreateNewPageWithBasicValuesActionGroup.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyCreatedCmsPageActionGroup.xml diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminNavigateToPageGridActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminNavigateToPageGridActionGroup.xml new file mode 100644 index 0000000000000..7dc68e7a5a891 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminNavigateToPageGridActionGroup.xml @@ -0,0 +1,19 @@ + + + + + + + Navigates to CMS page grid. + + + + + + diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/CreateNewPageWithBasicValuesActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/CreateNewPageWithBasicValuesActionGroup.xml new file mode 100644 index 0000000000000..1f9ddf7e70424 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/CreateNewPageWithBasicValuesActionGroup.xml @@ -0,0 +1,24 @@ + + + + + + + Click Add new page button and fills basic information in cms page. Values are hardcoded from _defaultCmsPage. + + + + + + + + + + + diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyCreatedCmsPageActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyCreatedCmsPageActionGroup.xml new file mode 100644 index 0000000000000..5cbd3bf7072a0 --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyCreatedCmsPageActionGroup.xml @@ -0,0 +1,21 @@ + + + + + + + Verify created cms page in store front. Values are hardcoded from _defaultCmsPage. + + + + + + + + diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsPageTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsPageTest.xml index db8b5606cd398..e6fcbab4de644 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsPageTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsPageTest.xml @@ -25,25 +25,10 @@ - - - - - - - - - - - - - - - - - - - + + + + From e3c203ad5fb0693c55cd3abc383ef6baa43e8b10 Mon Sep 17 00:00:00 2001 From: Oleh Usik Date: Tue, 28 Jan 2020 23:26:52 +0200 Subject: [PATCH 1053/1143] Fixed wrong state title --- .../Sales/Block/Status/Grid/Column/State.php | 6 ++-- app/code/Magento/Sales/Model/Order/Config.php | 19 ----------- .../Test/Unit/Model/Order/ConfigTest.php | 32 ------------------- 3 files changed, 3 insertions(+), 54 deletions(-) diff --git a/app/code/Magento/Sales/Block/Status/Grid/Column/State.php b/app/code/Magento/Sales/Block/Status/Grid/Column/State.php index d2163fae72428..85e32d53c4b72 100644 --- a/app/code/Magento/Sales/Block/Status/Grid/Column/State.php +++ b/app/code/Magento/Sales/Block/Status/Grid/Column/State.php @@ -53,9 +53,9 @@ public function getFrameCallback() */ public function decorateState($value, $row, $column, $isExport) { - $status = $row->getStatus(); - if ($value) { - $cell = $value . '[' . $this->_config->getStateLabelByStateAndStatus($value, $status) . ']'; + $states = $this->_config->getStates(); + if (isset($states[$value])) { + $cell = $value . '[' . $states[$value] . ']'; } else { $cell = $value; } diff --git a/app/code/Magento/Sales/Model/Order/Config.php b/app/code/Magento/Sales/Model/Order/Config.php index 92681f3ecf181..7dbddcd0a16c4 100644 --- a/app/code/Magento/Sales/Model/Order/Config.php +++ b/app/code/Magento/Sales/Model/Order/Config.php @@ -300,23 +300,4 @@ protected function _getStatuses($visibility) } return $this->statuses[(bool) $visibility]; } - - /** - * Retrieve label by state and status - * - * @param string $state - * @param string $status - * @return \Magento\Framework\Phrase|string - * @since 100.2.0 - */ - public function getStateLabelByStateAndStatus($state, $status) - { - foreach ($this->_getCollection() as $item) { - if ($item->getData('state') == $state && $item->getData('status') == $status) { - $label = $item->getData('label'); - return __($label); - } - } - return $state; - } } diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/ConfigTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/ConfigTest.php index feee2816b2cd4..c1a271ef2b591 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/ConfigTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/ConfigTest.php @@ -116,38 +116,6 @@ public function testGetInvisibleOnFrontStatuses() $this->assertSame($expectedResult, $result); } - /** - * @return void - */ - public function testGetStateLabelByStateAndStatus() - { - $statuses = [ - new DataObject( - [ - 'status' => 'fraud', - 'state' => 'processing', - 'label' => 'Suspected Fraud', - ] - ), - new DataObject( - [ - 'status' => 'processing', - 'state' => 'processing', - 'label' => 'Processing', - ] - ) - ]; - $collectionMock = $this->createPartialMock(Collection::class, ['create', 'joinStates']); - $this->orderStatusCollectionFactoryMock->expects($this->once()) - ->method('create') - ->will($this->returnValue($collectionMock)); - $collectionMock->expects($this->once()) - ->method('joinStates') - ->will($this->returnValue($statuses)); - $result = $this->salesConfig->getStateLabelByStateAndStatus('processing', 'fraud'); - $this->assertSame('Suspected Fraud', $result->getText()); - } - /** * Test get statuses * From 25bf04ec2feecc06919c25a2897973c1dbddf643 Mon Sep 17 00:00:00 2001 From: Lena Orobei Date: Tue, 28 Jan 2020 16:43:17 -0600 Subject: [PATCH 1054/1143] Removed CODEOWNERS file --- .github/CODEOWNERS | 206 --------------------------------------------- 1 file changed, 206 deletions(-) delete mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index 00763eb56e0c6..0000000000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1,206 +0,0 @@ -/app/code/Magento/AdminNotification/ @paliarush -/app/code/Magento/Backend/ @paliarush -/app/code/Magento/User/ @paliarush -/lib/internal/Magento/Framework/App/ @buskamuza -/lib/internal/Magento/Framework/Controller/ @buskamuza -/lib/internal/Magento/Framework/Flag/ @buskamuza -/lib/internal/Magento/Framework/HTTP/ @buskamuza -/lib/internal/Magento/Framework/Logger/ @buskamuza -/lib/internal/Magento/Framework/Message/ @buskamuza -/lib/internal/Magento/Framework/Notification/ @buskamuza -/lib/internal/Magento/Framework/Session/ @buskamuza -/lib/internal/Magento/Framework/Url/ @buskamuza -/app/code/Magento/Cms/ @melnikovi -/app/code/Magento/CmsUrlRewrite/ @melnikovi -/app/code/Magento/Contact/ @melnikovi -/app/code/Magento/Email/ @melnikovi -/app/code/Magento/Variable/ @melnikovi -/app/code/Magento/Widget/ @melnikovi -/lib/internal/Magento/Framework/Cache/ @kokoc -/app/code/Magento/CacheInvalidate/ @kokoc -/app/code/Magento/CatalogInventory/ @tariqjawed83 @maghamed -/app/code/Magento/Bundle/ @akaplya -/app/code/Magento/BundleImportExport/ @akaplya -/app/code/Magento/Catalog/ @akaplya -/app/code/Magento/CatalogAnalytics/ @akaplya -/app/code/Magento/CatalogImportExport/ @akaplya -/app/code/Magento/CatalogSearch/ @kokoc -/app/code/Magento/CatalogUrlRewrite/ @akaplya -/app/code/Magento/ConfigurableImportExport/ @akaplya -/app/code/Magento/ConfigurableProduct/ @akaplya -/app/code/Magento/Downloadable/ @akaplya -/app/code/Magento/DownloadableImportExport/ @akaplya -/app/code/Magento/GroupedImportExport/ @akaplya -/app/code/Magento/GroupedProduct/ @akaplya -/app/code/Magento/LayeredNavigation/ @kokoc -/app/code/Magento/ProductVideo/ @akaplya -/app/code/Magento/Review/ @akaplya -/app/code/Magento/Swatches/ @akaplya -/app/code/Magento/SwatchesLayeredNavigation/ @kokoc -/app/code/Magento/Checkout/ @paliarush -/app/code/Magento/CheckoutAgreements/ @paliarush -/app/code/Magento/GiftMessage/ @paliarush -/app/code/Magento/InstantPurchase/ @paliarush -/app/code/Magento/Multishipping/ @joni-jones -/app/code/Magento/Quote/ @paliarush -/app/code/Magento/QuoteAnalytics/ @paliarush -/lib/internal/Magento/Framework/Code/ @joni-jones -/lib/internal/Magento/Framework/Reflection/ @joni-jones -/lib/internal/Magento/Framework/Component/ @buskamuza -/app/code/Magento/Version/ @buskamuza -/lib/internal/Magento/Framework/Config/ @paliarush -/app/code/Magento/Config/ @paliarush -/lib/internal/Magento/Framework/Console/ @joni-jones -/lib/internal/Magento/Framework/Process/ @joni-jones -/lib/internal/Magento/Framework/Shell/ @joni-jones -/app/code/Magento/Cookie/ @kokoc -/lib/internal/Magento/Framework/Crontab/ @tariqjawed83 @buskamuza -/app/code/Magento/Cron/ @tariqjawed83 @buskamuza -/app/code/Magento/Customer/ @paliarush -/app/code/Magento/CustomerAnalytics/ @paliarush -/app/code/Magento/CustomerImportExport/ @paliarush -/app/code/Magento/Persistent/ @paliarush -/app/code/Magento/Wishlist/ @paliarush -/lib/internal/Magento/Framework/DB/ @akaplya -/lib/internal/Magento/Framework/EntityManager/ @akaplya -/lib/internal/Magento/Framework/Indexer/ @akaplya -/lib/internal/Magento/Framework/Model/ @akaplya -/lib/internal/Magento/Framework/Mview/ @akaplya -/app/code/Magento/Eav/ @akaplya -/app/code/Magento/Indexer/ @akaplya -/lib/internal/Magento/Framework/Archive/ @joni-jones -/lib/internal/Magento/Framework/Convert/ @joni-jones -/lib/internal/Magento/Framework/Data/ @joni-jones -/lib/internal/Magento/Framework/DomDocument/ @joni-jones -/lib/internal/Magento/Framework/Json/ @joni-jones -/lib/internal/Magento/Framework/Math/ @joni-jones -/lib/internal/Magento/Framework/Parse/ @joni-jones -/lib/internal/Magento/Framework/Serialize/ @joni-jones -/lib/internal/Magento/Framework/Simplexml/ @joni-jones -/lib/internal/Magento/Framework/Stdlib/ @joni-jones -/lib/internal/Magento/Framework/Unserialize/ @joni-jones -/lib/internal/Magento/Framework/Xml/ @joni-jones -/lib/internal/Magento/Framework/XsltProcessor/ @joni-jones -/app/code/Magento/Deploy/ @kandy @buskamuza -/lib/internal/Magento/Framework/Profiler/ @kandy -/app/code/Magento/Developer/ @buskamuza -/app/code/Magento/Directory/ @buskamuza -/lib/internal/Magento/Framework/Exception/ @paliarush -/lib/internal/Magento/Framework/File/ @buskamuza -/lib/internal/Magento/Framework/Filesystem/ @buskamuza -/lib/internal/Magento/Framework/System/ @buskamuza -/lib/internal/Magento/Framework/Css/ @DrewML -/lib/internal/Magento/Framework/Option/ @DrewML -/lib/internal/Magento/Framework/RequireJs/ @DrewML -/lib/internal/Magento/Framework/View/ @melnikovi -/dev/tests/js/ @DrewML -/app/code/Magento/RequireJs/ @DrewML -/app/code/Magento/Theme/ @melnikovi -/app/code/Magento/Ui/ @melnikovi -/lib/internal/Magento/Framework/Intl/ @melnikovi -/lib/internal/Magento/Framework/Locale/ @melnikovi -/lib/internal/Magento/Framework/Phrase/ @melnikovi -/lib/internal/Magento/Framework/Translate/ @melnikovi -/app/code/Magento/Translation/ @melnikovi -/app/code/Magento/ImportExport/ @akaplya -/app/code/Magento/GoogleAdwords/ @buskamuza @melnikovi -/app/code/Magento/Newsletter/ @buskamuza @melnikovi -/app/code/Magento/ProductAlert/ @buskamuza @melnikovi -/app/code/Magento/Rss/ @buskamuza @melnikovi -/app/code/Magento/SendFriend/ @buskamuza @melnikovi -/app/code/Magento/Marketplace/ @buskamuza -/app/code/Magento/MediaStorage/ @buskamuza -/lib/internal/Magento/Framework/Amqp/ @tariqjawed83 @paliarush -/lib/internal/Magento/Framework/Bulk/ @tariqjawed83 @paliarush -/lib/internal/Magento/Framework/Communication/ @tariqjawed83 @paliarush -/app/code/Magento/Amqp/ @tariqjawed83 @paliarush -/app/code/Magento/AsynchronousOperations/ @tariqjawed83 @paliarush -/app/code/Magento/MessageQueue/ @tariqjawed83 @paliarush -/app/code/Magento/MysqlMq/ @tariqjawed83 @paliarush -/app/code/Magento/Sales/ @joni-jones -/app/code/Magento/SalesInventory/ @joni-jones -/app/code/Magento/SalesSequence/ @joni-jones -/lib/internal/Magento/Framework/Event/ @buskamuza @kandy -/lib/internal/Magento/Framework/Interception/ @buskamuza @kandy -/lib/internal/Magento/Framework/ObjectManager/ @buskamuza @kandy -/app/code/Magento/PageCache/ @Andrey @kokoc @paliarush -/app/code/Magento/Authorizenet/ @joni-jones -/app/code/Magento/Braintree/ @joni-jones -/app/code/Magento/OfflinePayments/ @joni-jones -/app/code/Magento/Payment/ @joni-jones -/app/code/Magento/Paypal/ @joni-jones -/app/code/Magento/Signifyd/ @joni-jones -/app/code/Magento/Vault/ @joni-jones -/lib/internal/Magento/Framework/Pricing/ @akaplya -/app/code/Magento/AdvancedPricingImportExport/ @akaplya -/app/code/Magento/CurrencySymbol/ @akaplya -/app/code/Magento/Msrp/ @akaplya -/app/code/Magento/Tax/ @akaplya -/app/code/Magento/TaxImportExport/ @akaplya -/app/code/Magento/Weee/ @akaplya -/app/code/Magento/CatalogRule/ @kokoc -/app/code/Magento/CatalogRuleConfigurable/ @kokoc -/app/code/Magento/CatalogWidget/ @kokoc -/app/code/Magento/Rule/ @kokoc -/app/code/Magento/SalesRule/ @akaplya -/app/code/Magento/ReleaseNotification/ @paliarush -/app/code/Magento/Analytics/ @tariqjawed83 @buskamuza -/app/code/Magento/GoogleAnalytics/ @tariqjawed83 @buskamuza -/app/code/Magento/NewRelicReporting/ @tariqjawed83 @buskamuza -/app/code/Magento/Reports/ @tariqjawed83 @buskamuza -/app/code/Magento/ReviewAnalytics/ @tariqjawed83 @buskamuza -/app/code/Magento/SalesAnalytics/ @tariqjawed83 @buskamuza -/app/code/Magento/WishlistAnalytics/ @tariqjawed83 @buskamuza -/app/code/Magento/GoogleOptimizer/ @paliarush -/app/code/Magento/Robots/ @paliarush -/app/code/Magento/Sitemap/ @paliarush -/lib/internal/Magento/Framework/Search/ @kokoc -/app/code/Magento/AdvancedSearch/ @kokoc -/app/code/Magento/Elasticsearch/ @kokoc -/app/code/Magento/Search/ @kokoc -/lib/internal/Magento/Framework/Acl/ @kokoc -/lib/internal/Magento/Framework/Authorization/ @kokoc -/lib/internal/Magento/Framework/Encryption/ @kokoc -/app/code/Magento/Authorization/ @kokoc -/app/code/Magento/Captcha/ @kokoc -/app/code/Magento/EncryptionKey/ @kokoc -/app/code/Magento/Security/ @kokoc -/lib/internal/Magento/Framework/Autoload/ @buskamuza -/lib/internal/Magento/Framework/Backup/ @buskamuza -/lib/internal/Magento/Framework/Composer/ @buskamuza -/lib/internal/Magento/Framework/Setup/ @buskamuza -/app/code/Magento/Backup/ @buskamuza -/setup/ @buskamuza -/app/code/Magento/Dhl/ @joni-jones -/app/code/Magento/Fedex/ @joni-jones -/app/code/Magento/OfflineShipping/ @joni-jones -/app/code/Magento/Shipping/ @joni-jones -/app/code/Magento/Ups/ @joni-jones -/app/code/Magento/Usps/ @joni-jones -/app/code/Magento/Store/ @akaplya -/lib/internal/Magento/Framework/TestFramework/ @paliarush -/dev/tests/integration/framework/ @buskamuza -/dev/tests/setup-integration/framework/ @paliarush -/dev/tests/static/framework/ @paliarush -/dev/tests/unit/ @paliarush -/dev/tests/api-functional/ @paliarush -/app/code/Magento/UrlRewrite/ @kokoc -/lib/internal/Magento/Framework/Image/ @buskamuza -/lib/internal/Magento/Framework/Mail/ @melnikovi -/lib/internal/Magento/Framework/Filter/ @melnikovi -/lib/internal/Magento/Framework/Validation/ @melnikovi -/lib/internal/Magento/Framework/Validator/ @melnikovi -/lib/internal/Magento/Framework/Api/ @paliarush -/lib/internal/Magento/Framework/GraphQL/ @paliarush -/lib/internal/Magento/Framework/Oauth/ @paliarush -/lib/internal/Magento/Framework/Webapi/ @paliarush -/app/code/Magento/GraphQL/ @paliarush -/app/code/Magento/Integration/ @paliarush -/app/code/Magento/Swagger/ @paliarush -/app/code/Magento/Webapi/ @paliarush -/app/code/Magento/WebapiSecurity/ @paliarush - -composer.json @buskamuza -*.js @DrewML -.htaccess* @akaplya -nginx.conf* @akaplya From f5f0827836fd250aa473ad8e9d795f46dc42c35c Mon Sep 17 00:00:00 2001 From: Serhii Voloshkov Date: Wed, 29 Jan 2020 10:05:55 +0200 Subject: [PATCH 1055/1143] MC-23633: Catalog Inventory modal refactor --- ...temModifyChecker.php => StockItemChecker.php} | 2 +- ...yCheckerTest.php => StockItemCheckerTest.php} | 16 ++++++++-------- .../CatalogInventory/etc/adminhtml/di.xml | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) rename app/code/Magento/CatalogInventory/Model/Stock/{StockItemModifyChecker.php => StockItemChecker.php} (98%) rename app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/{StockItemModifyCheckerTest.php => StockItemCheckerTest.php} (90%) diff --git a/app/code/Magento/CatalogInventory/Model/Stock/StockItemModifyChecker.php b/app/code/Magento/CatalogInventory/Model/Stock/StockItemChecker.php similarity index 98% rename from app/code/Magento/CatalogInventory/Model/Stock/StockItemModifyChecker.php rename to app/code/Magento/CatalogInventory/Model/Stock/StockItemChecker.php index ca8869c6ec5e6..e3a9c48b27155 100644 --- a/app/code/Magento/CatalogInventory/Model/Stock/StockItemModifyChecker.php +++ b/app/code/Magento/CatalogInventory/Model/Stock/StockItemChecker.php @@ -14,7 +14,7 @@ /** * Verifies Stock item model changes. */ -class StockItemModifyChecker +class StockItemChecker { /** * @var StockItemRepositoryInterface diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/StockItemModifyCheckerTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/StockItemCheckerTest.php similarity index 90% rename from app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/StockItemModifyCheckerTest.php rename to app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/StockItemCheckerTest.php index 73f3a8af29666..0f2568a2e213d 100644 --- a/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/StockItemModifyCheckerTest.php +++ b/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/StockItemCheckerTest.php @@ -8,7 +8,7 @@ namespace Magento\CatalogInventory\Test\Unit\Model\Stock; use Magento\CatalogInventory\Api\Data\StockItemInterface; -use Magento\CatalogInventory\Model\Stock\StockItemModifyChecker; +use Magento\CatalogInventory\Model\Stock\StockItemChecker; use Magento\CatalogInventory\Model\Stock\Item as StockItem; use Magento\CatalogInventory\Model\Stock\StockItemRepository; use Magento\Framework\Stdlib\ArrayUtils; @@ -17,13 +17,13 @@ use PHPUnit\Framework\TestCase; /** - * Unit test for StockItemModifyChecker. - * @see StockItemModifyChecker + * Unit test for StockItemChecker. + * @see StockItemChecker */ -class StockItemModifyCheckerTest extends TestCase +class StockItemCheckerTest extends TestCase { /** - * @var StockItemModifyChecker + * @var StockItemChecker */ private $model; @@ -54,7 +54,7 @@ protected function setUp() $this->stockItemModel = $this->createPartialMock(StockItem::class, ['getId', 'getData']); $this->model = $objectManager->getObject( - StockItemModifyChecker::class, + StockItemChecker::class, [ 'stockItemRepository' => $this->stockItemRepository, 'arrayUtils' => $this->arrayUtils, @@ -64,7 +64,7 @@ protected function setUp() } /** - * Test for IsModified method when model is new. + * Test for isModified method when model is new. * * @return void */ @@ -77,7 +77,7 @@ public function testIsModifiedWhenModelIsNew(): void } /** - * Test for IsModified method when found difference between data. + * Test for isModified method when found difference between data. * * @param array $itemFromRepository * @param array $model diff --git a/app/code/Magento/CatalogInventory/etc/adminhtml/di.xml b/app/code/Magento/CatalogInventory/etc/adminhtml/di.xml index d4dd1b1647416..4d90b2159d852 100644 --- a/app/code/Magento/CatalogInventory/etc/adminhtml/di.xml +++ b/app/code/Magento/CatalogInventory/etc/adminhtml/di.xml @@ -47,7 +47,7 @@ - + Magento\CatalogInventory\Api\Data\StockItemInterface::LOW_STOCK_DATE From e3e06d0b6e18e1884273561c48bd5b4818eb0a36 Mon Sep 17 00:00:00 2001 From: eduard13 Date: Wed, 29 Jan 2020 10:29:29 +0200 Subject: [PATCH 1056/1143] Removing disabled class --- .../Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml b/app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml index 353137a4dcb2e..55195698c5dc8 100644 --- a/app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml +++ b/app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml @@ -19,7 +19,7 @@
Date: Wed, 29 Jan 2020 11:44:07 +0200 Subject: [PATCH 1057/1143] Minor changes --- .../Crontab/Test/Unit/CrontabManagerTest.php | 69 ++++++++++++++----- 1 file changed, 51 insertions(+), 18 deletions(-) diff --git a/lib/internal/Magento/Framework/Crontab/Test/Unit/CrontabManagerTest.php b/lib/internal/Magento/Framework/Crontab/Test/Unit/CrontabManagerTest.php index f6c863d9d9fad..4ee8c89e2b802 100644 --- a/lib/internal/Magento/Framework/Crontab/Test/Unit/CrontabManagerTest.php +++ b/lib/internal/Magento/Framework/Crontab/Test/Unit/CrontabManagerTest.php @@ -3,32 +3,34 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - +declare(strict_types=1); namespace Magento\Framework\Crontab\Test\Unit; +use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\Crontab\CrontabManager; use Magento\Framework\Crontab\CrontabManagerInterface; -use Magento\Framework\ShellInterface; -use Magento\Framework\Phrase; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Filesystem; -use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\Filesystem\Directory\ReadInterface; use Magento\Framework\Filesystem\DriverPool; +use Magento\Framework\Phrase; +use Magento\Framework\ShellInterface; +use PHPUnit\Framework\TestCase; +use PHPUnit_Framework_MockObject_MockObject as MockObject; /** * Tests crontab manager functionality. */ -class CrontabManagerTest extends \PHPUnit\Framework\TestCase +class CrontabManagerTest extends TestCase { /** - * @var ShellInterface|\PHPUnit_Framework_MockObject_MockObject + * @var ShellInterface|MockObject */ private $shellMock; /** - * @var Filesystem|\PHPUnit_Framework_MockObject_MockObject + * @var Filesystem|MockObject */ private $filesystemMock; @@ -38,7 +40,7 @@ class CrontabManagerTest extends \PHPUnit\Framework\TestCase private $crontabManager; /** - * @return void + * @inheritDoc */ protected function setUp() { @@ -53,9 +55,11 @@ protected function setUp() } /** + * Verify get tasks without cronetab. + * * @return void */ - public function testGetTasksNoCrontab() + public function testGetTasksNoCrontab(): void { $exception = new \Exception('crontab: no crontab for user'); $localizedException = new LocalizedException(new Phrase('Some error'), $exception); @@ -69,12 +73,14 @@ public function testGetTasksNoCrontab() } /** + * Verify get tasks. + * * @param string $content * @param array $tasks * @return void * @dataProvider getTasksDataProvider */ - public function testGetTasks($content, $tasks) + public function testGetTasks($content, $tasks): void { $this->shellMock->expects($this->once()) ->method('execute') @@ -85,9 +91,11 @@ public function testGetTasks($content, $tasks) } /** + * Data provider to get tasks. + * * @return array */ - public function getTasksDataProvider() + public function getTasksDataProvider(): array { return [ [ @@ -120,11 +128,13 @@ public function getTasksDataProvider() } /** + * Verify remove tasks with exception. + * * @return void * @expectedException \Magento\Framework\Exception\LocalizedException * @expectedExceptionMessage Shell error */ - public function testRemoveTasksWithException() + public function testRemoveTasksWithException(): void { $exception = new \Exception('Shell error'); $localizedException = new LocalizedException(new Phrase('Some error'), $exception); @@ -143,12 +153,14 @@ public function testRemoveTasksWithException() } /** + * Verify remove tasks. + * * @param string $contentBefore * @param string $contentAfter * @return void * @dataProvider removeTasksDataProvider */ - public function testRemoveTasks($contentBefore, $contentAfter) + public function testRemoveTasks($contentBefore, $contentAfter): void { $this->shellMock->expects($this->at(0)) ->method('execute') @@ -163,9 +175,11 @@ public function testRemoveTasks($contentBefore, $contentAfter) } /** + * Data provider to remove tasks. + * * @return array */ - public function removeTasksDataProvider() + public function removeTasksDataProvider(): array { return [ [ @@ -195,11 +209,13 @@ public function removeTasksDataProvider() } /** + * Verify save tasks with empty tasks list. + * * @return void * @expectedException \Magento\Framework\Exception\LocalizedException * @expectedExceptionMessage The list of tasks is empty. Add tasks and try again. */ - public function testSaveTasksWithEmptyTasksList() + public function testSaveTasksWithEmptyTasksList(): void { $baseDirMock = $this->getMockBuilder(ReadInterface::class) ->getMockForAbstractClass(); @@ -222,11 +238,13 @@ public function testSaveTasksWithEmptyTasksList() } /** + * Verify save tasks with out command. + * * @return void * @expectedException \Magento\Framework\Exception\LocalizedException * @expectedExceptionMessage The command shouldn't be empty. Enter and try again. */ - public function testSaveTasksWithoutCommand() + public function testSaveTasksWithoutCommand(): void { $baseDirMock = $this->getMockBuilder(ReadInterface::class) ->getMockForAbstractClass(); @@ -252,13 +270,15 @@ public function testSaveTasksWithoutCommand() } /** + * Verify sava task. + * * @param array $tasks * @param string $content * @param string $contentToSave * @return void * @dataProvider saveTasksDataProvider */ - public function testSaveTasks($tasks, $content, $contentToSave) + public function testSaveTasks($tasks, $content, $contentToSave): void { $baseDirMock = $this->getMockBuilder(ReadInterface::class) ->getMockForAbstractClass(); @@ -291,9 +311,11 @@ public function testSaveTasks($tasks, $content, $contentToSave) } /** + * Data provider to save tasks. + * * @return array */ - public function saveTasksDataProvider() + public function saveTasksDataProvider(): array { $content = '* * * * * /bin/php /var/www/cron.php' . PHP_EOL . CrontabManagerInterface::TASKS_BLOCK_START . ' ' . hash("sha256", BP) . PHP_EOL @@ -354,6 +376,17 @@ public function saveTasksDataProvider() . ' %% cron:run | grep -v \"Ran \'jobs\' by schedule\"' . PHP_EOL . CrontabManagerInterface::TASKS_BLOCK_END . ' ' . hash("sha256", BP) . PHP_EOL, ], + [ + 'tasks' => [ + ['command' => '{magentoRoot}run.php % cron:run | grep -v "Ran \'jobs\' by schedule"$'] + ], + 'content' => '* * * * * /bin/php /var/www/cron.php', + 'contentToSave' => '* * * * * /bin/php /var/www/cron.php' . PHP_EOL + . CrontabManagerInterface::TASKS_BLOCK_START . ' ' . hash("sha256", BP) . PHP_EOL + . '* * * * * ' . PHP_BINARY . ' /var/www/magento2/run.php' + . ' %% cron:run | grep -v \"Ran \'jobs\' by schedule\"\$' . PHP_EOL + . CrontabManagerInterface::TASKS_BLOCK_END . ' ' . hash("sha256", BP) . PHP_EOL, + ], ]; } } From f4cf91621d7d31203d7fec2c5d0353ab70a10373 Mon Sep 17 00:00:00 2001 From: DmitryTsymbal Date: Wed, 29 Jan 2020 12:05:00 +0200 Subject: [PATCH 1058/1143] Seasrch Term Redirect --- ...inCreateNewSearchTermEntityActionGroup.xml | 25 +++++++++ .../StoreFrontQuickSearchActionGroup.xml | 20 ++++++++ .../Section/AdminSearchTermFormSection.xml | 18 +++++++ .../Section/AdminSearchTermsGridSection.xml | 14 +++++ ...rontVerifySearchTermEntityRedirectTest.xml | 51 +++++++++++++++++++ 5 files changed, 128 insertions(+) create mode 100644 app/code/Magento/Search/Test/Mftf/ActionGroup/AdminCreateNewSearchTermEntityActionGroup.xml create mode 100644 app/code/Magento/Search/Test/Mftf/ActionGroup/StoreFrontQuickSearchActionGroup.xml create mode 100644 app/code/Magento/Search/Test/Mftf/Section/AdminSearchTermFormSection.xml create mode 100644 app/code/Magento/Search/Test/Mftf/Section/AdminSearchTermsGridSection.xml create mode 100644 app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchTermEntityRedirectTest.xml diff --git a/app/code/Magento/Search/Test/Mftf/ActionGroup/AdminCreateNewSearchTermEntityActionGroup.xml b/app/code/Magento/Search/Test/Mftf/ActionGroup/AdminCreateNewSearchTermEntityActionGroup.xml new file mode 100644 index 0000000000000..5fb8f9c2b6b47 --- /dev/null +++ b/app/code/Magento/Search/Test/Mftf/ActionGroup/AdminCreateNewSearchTermEntityActionGroup.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + diff --git a/app/code/Magento/Search/Test/Mftf/ActionGroup/StoreFrontQuickSearchActionGroup.xml b/app/code/Magento/Search/Test/Mftf/ActionGroup/StoreFrontQuickSearchActionGroup.xml new file mode 100644 index 0000000000000..aec874e7b6d85 --- /dev/null +++ b/app/code/Magento/Search/Test/Mftf/ActionGroup/StoreFrontQuickSearchActionGroup.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + diff --git a/app/code/Magento/Search/Test/Mftf/Section/AdminSearchTermFormSection.xml b/app/code/Magento/Search/Test/Mftf/Section/AdminSearchTermFormSection.xml new file mode 100644 index 0000000000000..8135ed517c376 --- /dev/null +++ b/app/code/Magento/Search/Test/Mftf/Section/AdminSearchTermFormSection.xml @@ -0,0 +1,18 @@ + + + + +
+ + + + + +
+
diff --git a/app/code/Magento/Search/Test/Mftf/Section/AdminSearchTermsGridSection.xml b/app/code/Magento/Search/Test/Mftf/Section/AdminSearchTermsGridSection.xml new file mode 100644 index 0000000000000..0eeffdb24f94e --- /dev/null +++ b/app/code/Magento/Search/Test/Mftf/Section/AdminSearchTermsGridSection.xml @@ -0,0 +1,14 @@ + + + + +
+ +
+
diff --git a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchTermEntityRedirectTest.xml b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchTermEntityRedirectTest.xml new file mode 100644 index 0000000000000..e24a72e5940cf --- /dev/null +++ b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchTermEntityRedirectTest.xml @@ -0,0 +1,51 @@ + + + + + + + + + <description value="Storefront search by created search term with redirect. Verifying if created redirect is working"/> + </annotations> + + <before> + <!-- Login As Admin User --> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <!-- Navigate To Marketing Search Terms Grid --> + <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToSearchTermPage"> + <argument name="menuUiId" value="{{AdminMenuMarketing.dataUiId}}"/> + <argument name="submenuUiId" value="{{AdminMenuMarketingSEOAndSearchSearchTerms.dataUiId}}"/> + </actionGroup> + <!-- Create Custom Search Term With Redirect --> + <actionGroup ref="AdminCreateNewSearchTermEntityActionGroup" stepKey="createSearchTerm"> + <argument name="query" value="{{SearchTerm.query_text}}"/> + <argument name="store" value="{{SearchTerm.store_id}}"/> + <argument name="redirectUrl" value="{{SearchTerm.redirect}}"/> + </actionGroup> + </before> + <after> + <amOnPage url="{{AdminCatalogSearchTermIndexPage.url}}" stepKey="navigateToSearchTermPage"/> + <actionGroup ref="AdminSearchTermFilterBySearchQueryActionGroup" stepKey="findCreatedTerm"> + <argument name="searchQuery" value="{{SearchTerm.query_text}}"/> + </actionGroup> + <actionGroup ref="AdminDeleteSearchTermActionGroup" stepKey="deleteCreatedSearchTerm"/> + </after> + + <!-- TEST BODY --> + <!-- Navigate To StoreFront --> + <actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="openStoreFrontHomePage"/> + <!-- Fill in Search Field, Submit Search Request --> + <actionGroup ref="StoreFrontQuickSearchActionGroup" stepKey="searchByCreatedTerm"> + <argument name="query" value="{{SearchTerm.query_text}}"/> + </actionGroup> + <!-- Assert Current Url --> + <seeCurrentUrlEquals stepKey="checkUrl" url="{{SearchTerm.redirect}}"/> + </test> +</tests> From 684ae8ec7541f328cc092b1e6e355cd684db501a Mon Sep 17 00:00:00 2001 From: Dmytro Cheshun <d.cheshun@atwix.com> Date: Wed, 29 Jan 2020 13:03:37 +0200 Subject: [PATCH 1059/1143] Minor code style fixes --- .../Test/StorefrontVerifySearchTermEntityRedirectTest.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchTermEntityRedirectTest.xml b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchTermEntityRedirectTest.xml index e24a72e5940cf..5f21d4364736b 100644 --- a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchTermEntityRedirectTest.xml +++ b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchTermEntityRedirectTest.xml @@ -38,14 +38,14 @@ <actionGroup ref="AdminDeleteSearchTermActionGroup" stepKey="deleteCreatedSearchTerm"/> </after> - <!-- TEST BODY --> - <!-- Navigate To StoreFront --> + <!-- TEST BODY --> + <!-- Navigate To StoreFront --> <actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="openStoreFrontHomePage"/> - <!-- Fill in Search Field, Submit Search Request --> + <!-- Fill in Search Field, Submit Search Request --> <actionGroup ref="StoreFrontQuickSearchActionGroup" stepKey="searchByCreatedTerm"> <argument name="query" value="{{SearchTerm.query_text}}"/> </actionGroup> - <!-- Assert Current Url --> + <!-- Assert Current Url --> <seeCurrentUrlEquals stepKey="checkUrl" url="{{SearchTerm.redirect}}"/> </test> </tests> From 153688a6de30c441dfab85a2a39e75fec9690941 Mon Sep 17 00:00:00 2001 From: Mastiuhin Olexandr <mastiuhin.olexandr@transoftgroup.com> Date: Wed, 29 Jan 2020 13:42:24 +0200 Subject: [PATCH 1060/1143] MC-30357: [On Pre] [2.2.7] Status Change Doesn't Update the Stock Index ("Update on Schedule" indexers) --- .../Magento/CatalogInventory/etc/mview.xml | 2 ++ .../Model/Import/ProductTest.php | 30 +++++++++++++++++++ ...nventory_stock_item_update_by_schedule.php | 13 ++++++++ ...stock_item_update_by_schedule_rollback.php | 13 ++++++++ 4 files changed, 58 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/cataloginventory_stock_item_update_by_schedule.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/cataloginventory_stock_item_update_by_schedule_rollback.php diff --git a/app/code/Magento/CatalogInventory/etc/mview.xml b/app/code/Magento/CatalogInventory/etc/mview.xml index 72dda16e8b5bb..338f1fe0610a1 100644 --- a/app/code/Magento/CatalogInventory/etc/mview.xml +++ b/app/code/Magento/CatalogInventory/etc/mview.xml @@ -9,6 +9,8 @@ <view id="cataloginventory_stock" class="Magento\CatalogInventory\Model\Indexer\Stock" group="indexer"> <subscriptions> <table name="cataloginventory_stock_item" entity_column="product_id" /> + <!--Track product status to trigger stock indexer--> + <table name="catalog_product_entity_int" entity_column="entity_id" /> </subscriptions> </view> <view id="catalog_product_price" class="Magento\Catalog\Model\Indexer\Product\Price" group="indexer"> diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php index fdbda7e817d56..27b781a5f3c93 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php @@ -2968,4 +2968,34 @@ public function testProductStockStatusShouldBeUpdated() $status = $stockRegistry->getStockStatusBySku('simple'); $this->assertEquals(Stock::STOCK_IN_STOCK, $status->getStockStatus()); } + + /** + * Test that product stock status is updated after import on schedule + * + * @magentoDataFixture mediaImportImageFixture + * @magentoDataFixture Magento/Catalog/_files/product_simple.php + * @magentoDataFixture Magento/CatalogImportExport/_files/cataloginventory_stock_item_update_by_schedule.php + * @magentoDbIsolation disabled + */ + public function testProductStockStatusShouldBeUpdatedOnSchedule() + { + /** * @var $indexProcessor \Magento\Indexer\Model\Processor */ + $indexProcessor = $this->objectManager->create(\Magento\Indexer\Model\Processor::class); + /** @var $stockRegistry StockRegistry */ + $stockRegistry = $this->objectManager->create(StockRegistry::class); + /** @var StockRegistryStorage $stockRegistryStorage */ + $stockRegistryStorage = $this->objectManager->get(StockRegistryStorage::class); + $status = $stockRegistry->getStockStatusBySku('simple'); + $this->assertEquals(Stock::STOCK_IN_STOCK, $status->getStockStatus()); + $this->importDataForMediaTest('disable_product.csv'); + $indexProcessor->updateMview(); + $stockRegistryStorage->clean(); + $status = $stockRegistry->getStockStatusBySku('simple'); + $this->assertEquals(Stock::STOCK_OUT_OF_STOCK, $status->getStockStatus()); + $this->importDataForMediaTest('enable_product.csv'); + $indexProcessor->updateMview(); + $stockRegistryStorage->clean(); + $status = $stockRegistry->getStockStatusBySku('simple'); + $this->assertEquals(Stock::STOCK_IN_STOCK, $status->getStockStatus()); + } } diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/cataloginventory_stock_item_update_by_schedule.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/cataloginventory_stock_item_update_by_schedule.php new file mode 100644 index 0000000000000..94e700a778d97 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/cataloginventory_stock_item_update_by_schedule.php @@ -0,0 +1,13 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\CatalogInventory\Model\Indexer\Stock\Processor; +use Magento\TestFramework\Helper\Bootstrap; + +/** * @var $indexerProcessor Processor */ +$indexerProcessor = Bootstrap::getObjectManager()->get(Processor::class); +$indexerProcessor->getIndexer()->setScheduled(true); diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/cataloginventory_stock_item_update_by_schedule_rollback.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/cataloginventory_stock_item_update_by_schedule_rollback.php new file mode 100644 index 0000000000000..bd9a07529e8e3 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/cataloginventory_stock_item_update_by_schedule_rollback.php @@ -0,0 +1,13 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\CatalogInventory\Model\Indexer\Stock\Processor; +use Magento\TestFramework\Helper\Bootstrap; + +/** * @var $indexerProcessor Processor */ +$indexerProcessor = Bootstrap::getObjectManager()->get(Processor::class); +$indexerProcessor->getIndexer()->setScheduled(false); From 5c79a9efdf840eb4568e20ee0f54b319eb1833cd Mon Sep 17 00:00:00 2001 From: engcom-Echo <engcom-vendorworker-echo@adobe.com> Date: Wed, 29 Jan 2020 14:28:28 +0200 Subject: [PATCH 1061/1143] Fix Unit Test. --- .../Framework/Crontab/Test/Unit/CrontabManagerTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Crontab/Test/Unit/CrontabManagerTest.php b/lib/internal/Magento/Framework/Crontab/Test/Unit/CrontabManagerTest.php index 4ee8c89e2b802..4ef00fbb65576 100644 --- a/lib/internal/Magento/Framework/Crontab/Test/Unit/CrontabManagerTest.php +++ b/lib/internal/Magento/Framework/Crontab/Test/Unit/CrontabManagerTest.php @@ -378,13 +378,13 @@ public function saveTasksDataProvider(): array ], [ 'tasks' => [ - ['command' => '{magentoRoot}run.php % cron:run | grep -v "Ran \'jobs\' by schedule"$'] + ['command' => '{magentoRoot}run.php mysqldump db > db-$(date +%F).sql'] ], 'content' => '* * * * * /bin/php /var/www/cron.php', 'contentToSave' => '* * * * * /bin/php /var/www/cron.php' . PHP_EOL . CrontabManagerInterface::TASKS_BLOCK_START . ' ' . hash("sha256", BP) . PHP_EOL . '* * * * * ' . PHP_BINARY . ' /var/www/magento2/run.php' - . ' %% cron:run | grep -v \"Ran \'jobs\' by schedule\"\$' . PHP_EOL + . ' mysqldump db > db-\$(date +%%F).sql' . PHP_EOL . CrontabManagerInterface::TASKS_BLOCK_END . ' ' . hash("sha256", BP) . PHP_EOL, ], ]; From 953d9b2f9cd223652c033c2611b8b960628011bd Mon Sep 17 00:00:00 2001 From: engcom-Echo <engcom-vendorworker-echo@adobe.com> Date: Wed, 29 Jan 2020 15:00:49 +0200 Subject: [PATCH 1062/1143] Fix Unit Test. --- .../Store/Test/Unit/Controller/Store/RedirectTest.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php b/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php index 88de664f3bb29..41ff3de1942af 100755 --- a/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php +++ b/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php @@ -117,7 +117,10 @@ protected function setUp() $this->responseMock = $this->getMockBuilder(ResponseInterface::class) ->disableOriginalConstructor() ->getMockForAbstractClass(); - $this->formStoreMock = $this->createMock(Store::class); + $this->formStoreMock = $this->getMockBuilder(Store::class) + ->disableOriginalConstructor() + ->setMethods(['getCode']) + ->getMockForAbstractClass(); $this->sidResolverMock = $this->getMockBuilder(SidResolverInterface::class) ->disableOriginalConstructor() ->setMethods(['getUseSessionInUrl']) From 4e94687ae0c753d9d8d936b9917a8bd65aad001a Mon Sep 17 00:00:00 2001 From: Oleh Usik <o.usik@atwix.com> Date: Wed, 29 Jan 2020 15:18:34 +0200 Subject: [PATCH 1063/1143] fixed minor code style issues --- app/code/Magento/Sales/Block/Status/Grid/Column/State.php | 2 ++ app/code/Magento/Sales/Test/Unit/Model/Order/ConfigTest.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Block/Status/Grid/Column/State.php b/app/code/Magento/Sales/Block/Status/Grid/Column/State.php index 85e32d53c4b72..51d9886c79b67 100644 --- a/app/code/Magento/Sales/Block/Status/Grid/Column/State.php +++ b/app/code/Magento/Sales/Block/Status/Grid/Column/State.php @@ -6,6 +6,8 @@ namespace Magento\Sales\Block\Status\Grid\Column; /** + * Column State class + * * @api * @since 100.0.2 */ diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/ConfigTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/ConfigTest.php index c1a271ef2b591..2dcc3c2a9fd24 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/ConfigTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/ConfigTest.php @@ -9,7 +9,7 @@ use Magento\Sales\Model\ResourceModel\Order\Status\Collection; /** - * Class ConfigTest + * Test for Magento\Sales\Model\Order\Config class */ class ConfigTest extends \PHPUnit\Framework\TestCase { From c8775638ec0a910ea34e7d77fe6aeb20111d2a99 Mon Sep 17 00:00:00 2001 From: Karyna Tsymbal <k.tsymbal@atwix.com> Date: Wed, 29 Jan 2020 15:52:25 +0200 Subject: [PATCH 1064/1143] Unit test for Magento\Reports\Observer\CheckoutCartAddProductObserver --- .../CheckoutCartAddProductObserverTest.php | 161 ++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 app/code/Magento/Reports/Test/Unit/Observer/CheckoutCartAddProductObserverTest.php diff --git a/app/code/Magento/Reports/Test/Unit/Observer/CheckoutCartAddProductObserverTest.php b/app/code/Magento/Reports/Test/Unit/Observer/CheckoutCartAddProductObserverTest.php new file mode 100644 index 0000000000000..25c3b62697e5d --- /dev/null +++ b/app/code/Magento/Reports/Test/Unit/Observer/CheckoutCartAddProductObserverTest.php @@ -0,0 +1,161 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\Reports\Test\Unit\Observer; + +use Magento\Framework\Event; +use Magento\Framework\Event\Observer; +use Magento\Quote\Model\Quote\Item as QuoteItem; +use Magento\Reports\Model\Event as ReportsEventModel; +use Magento\Reports\Model\ReportStatus; +use Magento\Reports\Observer\CheckoutCartAddProductObserver; +use Magento\Reports\Observer\EventSaver; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +/** + * Unit Test for @see CheckoutCartAddProductObserver + */ +class CheckoutCartAddProductObserverTest extends TestCase +{ + const STUB_QUOTE_PARENT_ITEM_ID = 1; + const STUB_QUOTE_ITEM_ID = 2; + + /** + * @var MockObject|EventSaver + */ + private $eventSaverMock; + + /** + * @var MockObject|ReportStatus + */ + private $reportStatusMock; + + /** + * @var MockObject|Observer + */ + private $eventObserverMock; + + /** + * @var MockObject|Event + */ + private $eventMock; + + /** + * @var MockObject|QuoteItem + */ + private $quoteItemMock; + + /** + * @var CheckoutCartAddProductObserver + */ + private $observer; + + /** + * @inheritDoc + */ + protected function setUp() + { + $this->eventSaverMock = $this->createMock(EventSaver::class); + $this->reportStatusMock = $this->createMock(ReportStatus::class); + $this->eventObserverMock = $this->createMock(Observer::class); + $this->quoteItemMock = $this->createMock(QuoteItem::class); + $this->eventMock = $this->getMockBuilder(Event::class) + ->disableOriginalConstructor() + ->setMethods(['getItem']) + ->getMock(); + + $this->observer = new CheckoutCartAddProductObserver( + $this->eventSaverMock, + $this->reportStatusMock + ); + } + + /** + * The case when event has to be successfully saved + */ + public function testExecute() + { + $this->configureMocksWhenReportsEnabled(); + $this->quoteItemMock->expects($this->once()) + ->method('getId') + ->willReturn(null); + $this->quoteItemMock->expects($this->once()) + ->method('getParentItem') + ->willReturn(null); + + $this->eventSaverMock->expects($this->once()) + ->method('save'); + $this->observer->execute($this->eventObserverMock); + } + + /** + * Test the method when 'Product Added To Cart' Report is disabled in configuration + */ + public function testExecuteWhenReportsDisabled() + { + $this->reportStatusMock->expects($this->once()) + ->method('isReportEnabled') + ->with(ReportsEventModel::EVENT_PRODUCT_TO_CART) + ->willReturn(false); + + $this->checkOriginalMethodIsNeverExecuted(); + } + + /** + * Test when Quote Item has Id + */ + public function testExecuteWithQuoteItemIdSet() + { + $this->configureMocksWhenReportsEnabled(); + $this->quoteItemMock->expects($this->any()) + ->method('getId') + ->willReturn(self::STUB_QUOTE_ITEM_ID); + + $this->checkOriginalMethodIsNeverExecuted(); + } + + /** + * Test when Quote Item has Parent Item set + */ + public function testExecuteWithQuoteParentItemIdSet() + { + $this->configureMocksWhenReportsEnabled(); + $this->quoteItemMock->expects($this->any()) + ->method('getParentItem') + ->willReturn(self::STUB_QUOTE_PARENT_ITEM_ID); + + $this->checkOriginalMethodIsNeverExecuted(); + } + + /** + * Common mocks assertions when Report is enabled in configuration + */ + private function configureMocksWhenReportsEnabled() + { + $this->reportStatusMock->expects($this->once()) + ->method('isReportEnabled') + ->willReturn(true); + $this->eventObserverMock->expects($this->once()) + ->method('getEvent') + ->willReturn($this->eventMock); + $this->eventMock->expects($this->once()) + ->method('getItem') + ->willReturn($this->quoteItemMock); + } + + /** + * Checking that the method will be never executed + */ + private function checkOriginalMethodIsNeverExecuted() + { + $this->eventSaverMock->expects($this->never()) + ->method('save'); + $this->observer->execute($this->eventObserverMock); + } +} From b315f70d8f30262951823f9530a066259cfd0d70 Mon Sep 17 00:00:00 2001 From: "rostyslav.hymon" <rostyslav.hymon@transoftgroup.com> Date: Wed, 29 Jan 2020 16:22:30 +0200 Subject: [PATCH 1065/1143] MC-30546: [Magento Cloud] [Question] Tax config query --- .../Sales/Total/Quote/CommonTaxCollector.php | 7 +- .../Model/Sales/Total/Quote/SubtotalTest.php | 311 +++++++++++------- 2 files changed, 202 insertions(+), 116 deletions(-) diff --git a/app/code/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollector.php b/app/code/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollector.php index c70c715d32c1b..55a56bd857a58 100644 --- a/app/code/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollector.php +++ b/app/code/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollector.php @@ -593,8 +593,11 @@ protected function processProductItems( $total->setSubtotalInclTax($subtotalInclTax); $total->setBaseSubtotalTotalInclTax($baseSubtotalInclTax); $total->setBaseSubtotalInclTax($baseSubtotalInclTax); - $shippingAssignment->getShipping()->getAddress()->setBaseSubtotalTotalInclTax($baseSubtotalInclTax); - $shippingAssignment->getShipping()->getAddress()->setBaseTaxAmount($baseTax); + $address = $shippingAssignment->getShipping()->getAddress(); + $address->setBaseTaxAmount($baseTax); + $address->setBaseSubtotalTotalInclTax($baseSubtotalInclTax); + $address->setSubtotal($total->getSubtotal()); + $address->setBaseSubtotal($total->getBaseSubtotal()); return $this; } diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/Sales/Total/Quote/SubtotalTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/Sales/Total/Quote/SubtotalTest.php index ae1f475d43b71..5a2351f7a1660 100644 --- a/dev/tests/integration/testsuite/Magento/Tax/Model/Sales/Total/Quote/SubtotalTest.php +++ b/dev/tests/integration/testsuite/Magento/Tax/Model/Sales/Total/Quote/SubtotalTest.php @@ -67,110 +67,110 @@ protected function getCustomerById($id) * @magentoDataFixture Magento/Catalog/_files/products.php * @magentoConfigFixture current_store tax/calculation/algorithm UNIT_BASE_CALCULATION * @dataProvider collectUnitBasedDataProvider + * @param array $quoteItems + * @param array $expected + * @return void */ - public function testCollectUnitBased($expected) + public function testCollectUnitBased(array $quoteItems, array $expected): void { - $customerTaxClassId = $this->getCustomerTaxClassId(); - $fixtureCustomerId = 1; - /** @var \Magento\Customer\Model\Customer $customer */ - $customer = $this->objectManager->create(\Magento\Customer\Model\Customer::class)->load($fixtureCustomerId); - /** @var \Magento\Customer\Model\Group $customerGroup */ - $customerGroup = $this->objectManager->create( - \Magento\Customer\Model\Group::class - )->load( - 'custom_group', - 'customer_group_code' - ); - $customerGroup->setTaxClassId($customerTaxClassId)->save(); - $customer->setGroupId($customerGroup->getId())->save(); + $this->quote($quoteItems, $expected); + } + + public function collectUnitBasedDataProvider(): array + { + return [ + 'one_item' => [ + [ + [ + 'sku' => 'simple', + 'qty' => 2 + ], + ], + [ + [ + 'subtotal' => 20, + 'subtotal_incl_tax' => 21.5, + 'base_subtotal_total_incl_tax' => 21.5, + 'tax_amount' => 1.5, + 'discount_amount' => 0, + ], + [ + [ + 'tax_amount' => 1.5, + 'price' => 10, + 'price_incl_tax' => 10.75, + 'row_total' => 20, + 'row_total_incl_tax' => 21.5, + 'tax_percent' => 7.5, + ], + ], + ], + ], + ]; + } + /** + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoDataFixture Magento/Customer/_files/customer_address.php + * @magentoDataFixture Magento/Tax/_files/tax_classes.php + * @magentoDataFixture Magento/Customer/_files/customer_group.php + * @magentoDataFixture Magento/Bundle/_files/product.php + * @magentoConfigFixture current_store tax/calculation/algorithm UNIT_BASE_CALCULATION + * @dataProvider collectUnitBasedBundleProductDataProvider + * @param array $quoteItems + * @param array $expected + * @return void + */ + public function testCollectUnitBasedBundleProduct(array $quoteItems, array $expected): void + { $productTaxClassId = $this->getProductTaxClassId(); /** @var \Magento\Catalog\Model\Product $product */ - $product = $this->productRepository->get('simple'); - $product->setTaxClassId($productTaxClassId)->save(); - - $quoteShippingAddressDataObject = $this->getShippingAddressDataObject($fixtureCustomerId); - - /** @var \Magento\Quote\Model\Quote\Address $quoteShippingAddress */ - $quoteShippingAddress = $this->objectManager->create(\Magento\Quote\Model\Quote\Address::class); - $quoteShippingAddress->importCustomerAddressData($quoteShippingAddressDataObject); - $quantity = 2; - - /** @var \Magento\Quote\Model\Quote $quote */ - $quote = $this->objectManager->create(\Magento\Quote\Model\Quote::class); - $quote->setStoreId( - 1 - )->setIsActive( - true - )->setIsMultiShipping( - false - )->assignCustomerWithAddressChange( - $this->getCustomerById($customer->getId()) - )->setShippingAddress( - $quoteShippingAddress - )->setBillingAddress( - $quoteShippingAddress - )->setCheckoutMethod( - $customer->getMode() - )->setPasswordHash( - $customer->encryptPassword($customer->getPassword()) - )->addProduct( - $product->load($product->getId()), - $quantity - ); - $address = $quote->getShippingAddress(); - /** @var \Magento\Quote\Model\ShippingAssignment $shippingAssignment */ - $shippingAssignment = $this->objectManager->create(\Magento\Quote\Model\ShippingAssignment::class); - $shipping = $this->objectManager->create(\Magento\Quote\Model\Shipping::class); - $shipping->setAddress($address); - $shippingAssignment->setShipping($shipping); - $shippingAssignment->setItems($address->getAllItems()); - /** @var \Magento\Quote\Model\Quote\Address\Total $total */ - $total = $this->objectManager->create(\Magento\Quote\Model\Quote\Address\Total::class); - /** @var \Magento\Quote\Model\Quote\Address\Total\Subtotal $addressSubtotalCollector */ - $addressSubtotalCollector = $this->objectManager->create( - \Magento\Quote\Model\Quote\Address\Total\Subtotal::class - ); - $addressSubtotalCollector->collect($quote, $shippingAssignment, $total); - - /** @var \Magento\Tax\Model\Sales\Total\Quote\Subtotal $subtotalCollector */ - $subtotalCollector = $this->objectManager->create(\Magento\Tax\Model\Sales\Total\Quote\Subtotal::class); - $subtotalCollector->collect($quote, $shippingAssignment, $total); - - $this->assertEquals($expected['subtotal'], $total->getSubtotal()); - $this->assertEquals($expected['subtotal'] + $expected['tax_amount'], $total->getSubtotalInclTax()); - $this->assertEquals($expected['subtotal'] + $expected['tax_amount'], $address->getBaseSubtotalTotalInclTax()); - $this->assertEquals($expected['discount_amount'], $total->getDiscountAmount()); - $items = $address->getAllItems(); - /** @var \Magento\Quote\Model\Quote\Address\Item $item */ - $item = $items[0]; - $this->assertEquals($expected['items'][0]['price'], $item->getPrice()); - $this->assertEquals($expected['items'][0]['price_incl_tax'], $item->getPriceInclTax()); - $this->assertEquals($expected['items'][0]['row_total'], $item->getRowTotal()); - $this->assertEquals($expected['items'][0]['row_total_incl_tax'], $item->getRowTotalInclTax()); - $this->assertEquals($expected['items'][0]['tax_percent'], $item->getTaxPercent()); + $childProduct = $this->productRepository->get('simple'); + $childProduct->setTaxClassId($productTaxClassId)->save(); + /** @var \Magento\Catalog\Model\Product $product */ + $product = $this->productRepository->get('bundle-product'); + $product->setTaxClassId($productTaxClassId) + ->setPriceType(\Magento\Catalog\Model\Product\Type\AbstractType::CALCULATE_CHILD) + ->save(); + $quoteItems[0]['product'] = $product; + $this->quote($quoteItems, $expected); } - public function collectUnitBasedDataProvider() + public function collectUnitBasedBundleProductDataProvider(): array { return [ 'one_item' => [ [ - 'subtotal' => 20, - 'tax_amount' => 1.5, - 'discount_amount' => 0, - 'items' => [ + [ + 'sku' => 'bundle-product', + 'qty' => 2 + ], + ], + [ + [ + 'subtotal' => 20, + 'subtotal_incl_tax' => 21.5, + 'base_subtotal_total_incl_tax' => 21.5, + 'tax_amount' => 1.5, + 'discount_amount' => 0, + ], + [ [ 'tax_amount' => 1.5, 'price' => 10, 'price_incl_tax' => 10.75, 'row_total' => 20, 'row_total_incl_tax' => 21.5, - 'taxable_amount' => 10, - 'code' => 'simple', - 'type' => 'product', - 'tax_percent' => 7.5, + 'tax_percent' => null, ], + [ + 'tax_amount' => 1.5, + 'price' => 10, + 'price_incl_tax' => 10.75, + 'row_total' => 20, + 'row_total_incl_tax' => 21.5, + 'tax_percent' => 7.5, + ] ], ], ], @@ -178,16 +178,96 @@ public function collectUnitBasedDataProvider() } /** - * @magentoDbIsolation disabled + * @magentoAppIsolation enabled + * @magentoDbIsolation enabled + * @magentoConfigFixture current_store tax/calculation/cross_border_trade_enabled 1 * @magentoDataFixture Magento/Customer/_files/customer.php * @magentoDataFixture Magento/Customer/_files/customer_address.php * @magentoDataFixture Magento/Tax/_files/tax_classes.php * @magentoDataFixture Magento/Customer/_files/customer_group.php - * @magentoDataFixture Magento/Bundle/_files/product.php + * @magentoDataFixture Magento/Catalog/_files/products.php * @magentoConfigFixture current_store tax/calculation/algorithm UNIT_BASE_CALCULATION - * @dataProvider collectUnitBasedDataProvider + * @magentoConfigFixture current_store tax/calculation/price_includes_tax 1 + * @dataProvider collectUnitBasedPriceIncludesTaxDataProvider + * @param array $quoteItems + * @param array $expected + */ + public function testCollectUnitBasedPriceIncludesTax(array $quoteItems, array $expected): void + { + $this->quote($quoteItems, $expected); + } + + /** + * @return array + */ + public function collectUnitBasedPriceIncludesTaxDataProvider(): array + { + return [ + [ + [ + [ + 'sku' => 'simple', + 'qty' => 1 + ], + ], + [ + [ + 'subtotal' => 9.3, + 'subtotal_incl_tax' => 10, + 'base_subtotal_total_incl_tax' => 10, + 'tax_amount' => 0.7, + 'discount_amount' => 0, + ], + [ + [ + 'tax_amount' => 0.7, + 'price' => 9.3, + 'price_incl_tax' => 10, + 'row_total' => 9.3, + 'row_total_incl_tax' => 10, + 'tax_percent' => 7.5, + ], + ], + ], + ], + [ + [ + [ + 'sku' => 'simple', + 'qty' => 2 + ], + ], + [ + [ + 'subtotal' => 18.6, + 'subtotal_incl_tax' => 20, + 'base_subtotal_total_incl_tax' => 20, + 'tax_amount' => 1.4, + 'discount_amount' => 0, + ], + [ + [ + 'tax_amount' => 1.4, + 'price' => 9.3, + 'price_incl_tax' => 10, + 'row_total' => 18.6, + 'row_total_incl_tax' => 20, + 'tax_percent' => 7.5, + ], + ], + ], + ], + ]; + } + + /** + * Create quote and assert totals values + * + * @param array $quoteItems + * @param array $expected + * @return void */ - public function testCollectUnitBasedBundleProduct($expected) + private function quote(array $quoteItems, array $expected): void { $customerTaxClassId = $this->getCustomerTaxClassId(); $fixtureCustomerId = 1; @@ -202,23 +282,14 @@ public function testCollectUnitBasedBundleProduct($expected) ); $customerGroup->setTaxClassId($customerTaxClassId)->save(); $customer->setGroupId($customerGroup->getId())->save(); - $productTaxClassId = $this->getProductTaxClassId(); - /** @var \Magento\Catalog\Model\Product $product */ - $childProduct = $this->productRepository->get('simple'); - $childProduct->setTaxClassId($productTaxClassId)->save(); - /** @var \Magento\Catalog\Model\Product $product */ - $product = $this->productRepository->get('bundle-product'); - $product->setTaxClassId($productTaxClassId) - ->setPriceType(\Magento\Catalog\Model\Product\Type\AbstractType::CALCULATE_CHILD) - ->save(); + $quoteShippingAddressDataObject = $this->getShippingAddressDataObject($fixtureCustomerId); /** @var \Magento\Quote\Model\Quote\Address $quoteShippingAddress */ $quoteShippingAddress = $this->objectManager->create(\Magento\Quote\Model\Quote\Address::class); $quoteShippingAddress->importCustomerAddressData($quoteShippingAddressDataObject); - $quantity = 2; /** @var \Magento\Quote\Model\Quote $quote */ $quote = $this->objectManager->create(\Magento\Quote\Model\Quote::class); @@ -238,17 +309,25 @@ public function testCollectUnitBasedBundleProduct($expected) $customer->getMode() )->setPasswordHash( $customer->encryptPassword($customer->getPassword()) - )->addProduct( - $product->load($product->getId()), - $quantity ); + + foreach ($quoteItems as $quoteItem) { + $product = $quoteItem['product'] ?? null; + if ($product === null) { + /** @var \Magento\Catalog\Model\Product $product */ + $product = $this->productRepository->get($quoteItem['sku'] ?? 'simple'); + $product->setTaxClassId($productTaxClassId)->save(); + } + $quote->addProduct($product, $quoteItem['qty']); + } + $address = $quote->getShippingAddress(); /** @var \Magento\Quote\Model\ShippingAssignment $shippingAssignment */ $shippingAssignment = $this->objectManager->create(\Magento\Quote\Model\ShippingAssignment::class); $shipping = $this->objectManager->create(\Magento\Quote\Model\Shipping::class); $shipping->setAddress($address); $shippingAssignment->setShipping($shipping); - $shippingAssignment->setItems($quote->getAllItems()); + $shippingAssignment->setItems($address->getAllItems()); /** @var \Magento\Quote\Model\Quote\Address\Total $total */ $total = $this->objectManager->create(\Magento\Quote\Model\Quote\Address\Total::class); /** @var \Magento\Quote\Model\Quote\Address\Total\Subtotal $addressSubtotalCollector */ @@ -261,16 +340,20 @@ public function testCollectUnitBasedBundleProduct($expected) $subtotalCollector = $this->objectManager->create(\Magento\Tax\Model\Sales\Total\Quote\Subtotal::class); $subtotalCollector->collect($quote, $shippingAssignment, $total); - $this->assertEquals($expected['subtotal'], $total->getSubtotal()); - $this->assertEquals($expected['subtotal'] + $expected['tax_amount'], $total->getSubtotalInclTax()); - $this->assertEquals($expected['discount_amount'], $total->getDiscountAmount()); - $items = $address->getAllItems(); - /** @var \Magento\Quote\Model\Quote\Address\Item $item */ - $item = $items[0]; - $this->assertEquals($expected['items'][0]['price'], $item->getPrice()); - $this->assertEquals($expected['items'][0]['price_incl_tax'], $item->getPriceInclTax()); - $this->assertEquals($expected['items'][0]['row_total'], $item->getRowTotal()); - $this->assertEquals($expected['items'][0]['row_total_incl_tax'], $item->getRowTotalInclTax()); + $this->assertEquals($address->getSubtotal(), $total->getSubtotal()); + $this->assertEquals($address->getBaseSubtotal(), $total->getBaseSubtotal()); + $this->assertEquals($address->getBaseSubtotalTotalInclTax(), $total->getBaseSubtotalTotalInclTax()); + + $this->assertEquals($expected[0], $total->toArray(array_keys($expected[0]))); + $actualAddressItemsData = []; + if ($expected[1]) { + $keys = array_keys($expected[1][0]); + /** @var \Magento\Quote\Model\Quote\Address\Item $addressItem */ + foreach ($address->getAllItems() as $addressItem) { + $actualAddressItemsData[] = array_intersect_key($addressItem->toArray($keys), array_flip($keys)); + } + } + $this->assertEquals($expected[1], $actualAddressItemsData); } /** From d2bb11cd75513bd7fa121bd963ec86f4b653921b Mon Sep 17 00:00:00 2001 From: Karyna Tsymbal <k.tsymbal@atwix.com> Date: Wed, 29 Jan 2020 17:22:03 +0200 Subject: [PATCH 1066/1143] use objectmanager helper --- .../Unit/Observer/CheckoutCartAddProductObserverTest.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/code/Magento/Reports/Test/Unit/Observer/CheckoutCartAddProductObserverTest.php b/app/code/Magento/Reports/Test/Unit/Observer/CheckoutCartAddProductObserverTest.php index 25c3b62697e5d..ad7b9fed3436e 100644 --- a/app/code/Magento/Reports/Test/Unit/Observer/CheckoutCartAddProductObserverTest.php +++ b/app/code/Magento/Reports/Test/Unit/Observer/CheckoutCartAddProductObserverTest.php @@ -10,6 +10,7 @@ use Magento\Framework\Event; use Magento\Framework\Event\Observer; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use Magento\Quote\Model\Quote\Item as QuoteItem; use Magento\Reports\Model\Event as ReportsEventModel; use Magento\Reports\Model\ReportStatus; @@ -74,6 +75,14 @@ protected function setUp() $this->eventSaverMock, $this->reportStatusMock ); + $objectManager = new ObjectManager($this); + $this->observer = $objectManager->getObject( + CheckoutCartAddProductObserver::class, + [ + 'eventSaver' => $this->eventSaverMock, + 'reportStatus' => $this->reportStatusMock + ] + ); } /** From c81e72820847fe4a0caa1c7cc259052b33fb3d93 Mon Sep 17 00:00:00 2001 From: Karyna Tsymbal <k.tsymbal@atwix.com> Date: Wed, 29 Jan 2020 17:23:38 +0200 Subject: [PATCH 1067/1143] remove typo --- .../Test/Unit/Observer/CheckoutCartAddProductObserverTest.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/code/Magento/Reports/Test/Unit/Observer/CheckoutCartAddProductObserverTest.php b/app/code/Magento/Reports/Test/Unit/Observer/CheckoutCartAddProductObserverTest.php index ad7b9fed3436e..02bdbdf794ac6 100644 --- a/app/code/Magento/Reports/Test/Unit/Observer/CheckoutCartAddProductObserverTest.php +++ b/app/code/Magento/Reports/Test/Unit/Observer/CheckoutCartAddProductObserverTest.php @@ -71,10 +71,6 @@ protected function setUp() ->setMethods(['getItem']) ->getMock(); - $this->observer = new CheckoutCartAddProductObserver( - $this->eventSaverMock, - $this->reportStatusMock - ); $objectManager = new ObjectManager($this); $this->observer = $objectManager->getObject( CheckoutCartAddProductObserver::class, From 25fd9259e72bc484f5899aa4edf3de120b66db0c Mon Sep 17 00:00:00 2001 From: Alexander Steshuk <grp-engcom-vendorworker-Kilo@adobe.com> Date: Wed, 29 Jan 2020 17:30:11 +0200 Subject: [PATCH 1068/1143] magento/magento2#26533: Unit test fix --- .../Unit/Module/Di/Code/Scanner/PhpScannerTest.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Scanner/PhpScannerTest.php b/setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Scanner/PhpScannerTest.php index 46d45770055b0..3aea4166df838 100644 --- a/setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Scanner/PhpScannerTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Scanner/PhpScannerTest.php @@ -7,6 +7,12 @@ namespace Magento\Setup\Test\Unit\Module\Di\Code\Scanner; +require_once __DIR__ . '/../../_files/app/code/Magento/SomeModule/Helper/Test.php'; +require_once __DIR__ . '/../../_files/app/code/Magento/SomeModule/ElementFactory.php'; +require_once __DIR__ . '/../../_files/app/code/Magento/SomeModule/Model/DoubleColon.php'; +require_once __DIR__ . '/../../_files/app/code/Magento/SomeModule/Api/Data/SomeInterface.php'; +require_once __DIR__ . '/../../_files/app/code/Magento/SomeModule/Model/StubWithAnonymousClass.php'; + use Magento\Framework\Reflection\TypeProcessor; use Magento\Setup\Module\Di\Code\Scanner\PhpScanner; use Magento\Setup\Module\Di\Compiler\Log\Log; @@ -38,12 +44,6 @@ protected function setUp() public function testCollectEntities() { - require_once __DIR__ . '/../../_files/app/code/Magento/SomeModule/Helper/Test.php'; - require_once __DIR__ . '/../../_files/app/code/Magento/SomeModule/ElementFactory.php'; - require_once __DIR__ . '/../../_files/app/code/Magento/SomeModule/Model/DoubleColon.php'; - require_once __DIR__ . '/../../_files/app/code/Magento/SomeModule/Api/Data/SomeInterface.php'; - require_once __DIR__ . '/../../_files/app/code/Magento/SomeModule/Model/StubWithAnonymousClass.php'; - $testFiles = [ $this->testDir . '/app/code/Magento/SomeModule/Helper/Test.php', $this->testDir . '/app/code/Magento/SomeModule/Model/DoubleColon.php', From 764f8c78d6d9257f943ade27f5a16822ecf70faf Mon Sep 17 00:00:00 2001 From: engcom-Echo <engcom-vendorworker-echo@adobe.com> Date: Wed, 29 Jan 2020 17:51:42 +0200 Subject: [PATCH 1069/1143] Cover unit test --- .../Magento/Store/Test/Unit/Controller/Store/RedirectTest.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php b/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php index 41ff3de1942af..4408c45d6a640 100755 --- a/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php +++ b/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php @@ -194,10 +194,6 @@ public function testRedirect(string $defaultStoreViewCode, string $storeCode): v ->expects($this->once()) ->method('getCode') ->willReturn($defaultStoreViewCode); - $this->sidResolverMock - ->expects($this->once()) - ->method('getUseSessionInUrl') - ->willReturn(false); $this->hashGeneratorMock ->expects($this->once()) ->method('generateHash') From 41b1cd54488dd6709124d618f1c570e9d0eab51a Mon Sep 17 00:00:00 2001 From: Alex Paliarush <paliarus@adobe.com> Date: Wed, 29 Jan 2020 10:05:55 -0600 Subject: [PATCH 1070/1143] ECP-261: Offload Catalog Image Resizing from Magento --- .../Magento/Catalog/Block/Rss/Category.php | 4 +- .../Catalog/Block/Rss/Product/NewProducts.php | 28 +- .../Catalog/Block/Rss/Product/Special.php | 15 +- .../Adminhtml/Product/Gallery/Upload.php | 2 +- app/code/Magento/Catalog/Helper/Image.php | 33 +- .../Model/Config/CatalogMediaConfig.php | 50 ++ .../Source/Web/CatalogMediaUrlFormat.php | 30 ++ .../Catalog/Model/View/Asset/Image.php | 90 +++- .../Observer/ImageResizeAfterProductSave.php | 21 +- .../Helper/Form/Gallery/ContentTest.php | 442 ------------------ .../Test/Unit/Model/ImageUploaderTest.php | 154 ------ .../Model/View/Asset/Image/ContextTest.php | 76 --- .../Test/Unit/Model/View/Asset/ImageTest.php | 213 --------- .../Product/Listing/Collector/ImageTest.php | 13 +- .../Component/Listing/Columns/Thumbnail.php | 12 +- .../Product/Form/Modifier/Related.php | 6 +- .../Product/Listing/Collector/Image.php | 16 +- .../Magento/Catalog/etc/adminhtml/system.xml | 7 + app/code/Magento/Catalog/etc/config.xml | 5 + .../Checkout/CustomerData/DefaultItem.php | 8 +- .../Checkout/Model/DefaultConfigProvider.php | 2 +- .../Console/Command/ImagesResizeCommand.php | 5 +- .../HeaderProvider/UpgradeInsecureTest.php | 2 +- .../Wishlist/CustomerData/Wishlist.php | 27 +- .../Test/Unit/CustomerData/WishlistTest.php | 6 - .../Block/Product/View/GalleryTest.php | 102 ++++ .../Service/PaymentFailuresServiceTest.php | 2 +- .../ResourceModel/Catalog/ProductTest.php | 2 + nginx.conf.sample | 25 + 29 files changed, 431 insertions(+), 967 deletions(-) create mode 100644 app/code/Magento/Catalog/Model/Config/CatalogMediaConfig.php create mode 100644 app/code/Magento/Catalog/Model/Config/Source/Web/CatalogMediaUrlFormat.php delete mode 100644 app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Helper/Form/Gallery/ContentTest.php delete mode 100644 app/code/Magento/Catalog/Test/Unit/Model/ImageUploaderTest.php delete mode 100644 app/code/Magento/Catalog/Test/Unit/Model/View/Asset/Image/ContextTest.php delete mode 100644 app/code/Magento/Catalog/Test/Unit/Model/View/Asset/ImageTest.php diff --git a/app/code/Magento/Catalog/Block/Rss/Category.php b/app/code/Magento/Catalog/Block/Rss/Category.php index 50967d2eb8dca..f149114f2eab8 100644 --- a/app/code/Magento/Catalog/Block/Rss/Category.php +++ b/app/code/Magento/Catalog/Block/Rss/Category.php @@ -10,9 +10,7 @@ use Magento\Framework\Exception\NoSuchEntityException; /** - * Class Category - * - * @package Magento\Catalog\Block\Rss + * Category feed block * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ diff --git a/app/code/Magento/Catalog/Block/Rss/Product/NewProducts.php b/app/code/Magento/Catalog/Block/Rss/Product/NewProducts.php index 20c4bef0845d6..9ade8b198656c 100644 --- a/app/code/Magento/Catalog/Block/Rss/Product/NewProducts.php +++ b/app/code/Magento/Catalog/Block/Rss/Product/NewProducts.php @@ -8,8 +8,7 @@ use Magento\Framework\App\Rss\DataProviderInterface; /** - * Class NewProducts - * @package Magento\Catalog\Block\Rss\Product + * New products feed block */ class NewProducts extends \Magento\Framework\View\Element\AbstractBlock implements DataProviderInterface { @@ -55,6 +54,8 @@ public function __construct( } /** + * Init + * * @return void */ protected function _construct() @@ -64,7 +65,7 @@ protected function _construct() } /** - * {@inheritdoc} + * @inheritdoc */ public function isAllowed() { @@ -72,7 +73,7 @@ public function isAllowed() } /** - * {@inheritdoc} + * @inheritdoc */ public function getRssData() { @@ -97,10 +98,13 @@ public function getRssData() $item->setAllowedInRss(true); $item->setAllowedPriceInRss(true); - $this->_eventManager->dispatch('rss_catalog_new_xml_callback', [ - 'row' => $item->getData(), - 'product' => $item - ]); + $this->_eventManager->dispatch( + 'rss_catalog_new_xml_callback', + [ + 'row' => $item->getData(), + 'product' => $item + ] + ); if (!$item->getAllowedInRss()) { continue; @@ -132,6 +136,8 @@ public function getRssData() } /** + * Get store id + * * @return int */ protected function getStoreId() @@ -177,7 +183,7 @@ protected function renderPriceHtml(\Magento\Catalog\Model\Product $product) } /** - * {@inheritdoc} + * @inheritdoc */ public function getCacheLifetime() { @@ -185,6 +191,8 @@ public function getCacheLifetime() } /** + * Get feeds + * * @return array */ public function getFeeds() @@ -199,7 +207,7 @@ public function getFeeds() } /** - * {@inheritdoc} + * @inheritdoc */ public function isAuthRequired() { diff --git a/app/code/Magento/Catalog/Block/Rss/Product/Special.php b/app/code/Magento/Catalog/Block/Rss/Product/Special.php index a9107f14cc5e4..5e459413bb5a2 100644 --- a/app/code/Magento/Catalog/Block/Rss/Product/Special.php +++ b/app/code/Magento/Catalog/Block/Rss/Product/Special.php @@ -9,8 +9,7 @@ use Magento\Framework\App\Rss\DataProviderInterface; /** - * Class Special - * @package Magento\Catalog\Block\Rss\Product + * Special products feed block * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Special extends \Magento\Framework\View\Element\AbstractBlock implements DataProviderInterface @@ -98,6 +97,8 @@ public function __construct( } /** + * Init + * * @return void */ protected function _construct() @@ -107,6 +108,8 @@ protected function _construct() } /** + * Get RSS data + * * @return array */ public function getRssData() @@ -156,6 +159,8 @@ public function getRssData() } /** + * Get entry data + * * @param \Magento\Catalog\Model\Product $item * @return array */ @@ -245,7 +250,7 @@ public function isAllowed() } /** - * {@inheritdoc} + * @inheritdoc */ public function getCacheLifetime() { @@ -253,6 +258,8 @@ public function getCacheLifetime() } /** + * Get feeds + * * @return array */ public function getFeeds() @@ -266,7 +273,7 @@ public function getFeeds() } /** - * {@inheritdoc} + * @inheritdoc */ public function isAuthRequired() { diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Gallery/Upload.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Gallery/Upload.php index d43b313c43b3e..3e7cc3ee962b9 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Gallery/Upload.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Gallery/Upload.php @@ -11,7 +11,7 @@ use Magento\Framework\Exception\LocalizedException; /** - * Class Upload + * Upload product image action controller */ class Upload extends \Magento\Backend\App\Action implements HttpPostActionInterface { diff --git a/app/code/Magento/Catalog/Helper/Image.php b/app/code/Magento/Catalog/Helper/Image.php index 110b798df9df9..191f5eee1b5e1 100644 --- a/app/code/Magento/Catalog/Helper/Image.php +++ b/app/code/Magento/Catalog/Helper/Image.php @@ -5,7 +5,11 @@ */ namespace Magento\Catalog\Helper; +use Magento\Catalog\Model\Config\CatalogMediaConfig; +use Magento\Catalog\Model\View\Asset\PlaceholderFactory; use Magento\Framework\App\Helper\AbstractHelper; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\Exception\LocalizedException; use Magento\Framework\View\Element\Block\ArgumentInterface; /** @@ -129,31 +133,39 @@ class Image extends AbstractHelper implements ArgumentInterface protected $attributes = []; /** - * @var \Magento\Catalog\Model\View\Asset\PlaceholderFactory + * @var PlaceholderFactory */ private $viewAssetPlaceholderFactory; + /** + * @var CatalogMediaConfig + */ + private $mediaConfig; + /** * @param \Magento\Framework\App\Helper\Context $context * @param \Magento\Catalog\Model\Product\ImageFactory $productImageFactory * @param \Magento\Framework\View\Asset\Repository $assetRepo * @param \Magento\Framework\View\ConfigInterface $viewConfig - * @param \Magento\Catalog\Model\View\Asset\PlaceholderFactory $placeholderFactory + * @param PlaceholderFactory $placeholderFactory + * @param CatalogMediaConfig $mediaConfig */ public function __construct( \Magento\Framework\App\Helper\Context $context, \Magento\Catalog\Model\Product\ImageFactory $productImageFactory, \Magento\Framework\View\Asset\Repository $assetRepo, \Magento\Framework\View\ConfigInterface $viewConfig, - \Magento\Catalog\Model\View\Asset\PlaceholderFactory $placeholderFactory = null + PlaceholderFactory $placeholderFactory = null, + CatalogMediaConfig $mediaConfig = null ) { $this->_productImageFactory = $productImageFactory; parent::__construct($context); $this->_assetRepo = $assetRepo; $this->viewConfig = $viewConfig; $this->viewAssetPlaceholderFactory = $placeholderFactory - ?: \Magento\Framework\App\ObjectManager::getInstance() - ->get(\Magento\Catalog\Model\View\Asset\PlaceholderFactory::class); + ?: ObjectManager::getInstance() + ->get(PlaceholderFactory::class); + $this->mediaConfig = $mediaConfig ?: ObjectManager::getInstance()->get(CatalogMediaConfig::class); } /** @@ -526,7 +538,16 @@ protected function isScheduledActionsAllowed() public function getUrl() { try { - $this->applyScheduledActions(); + switch ($this->mediaConfig->getMediaUrlFormat()) { + case CatalogMediaConfig::IMAGE_OPTIMIZATION_PARAMETERS: + $this->initBaseFile(); + break; + case CatalogMediaConfig::HASH: + $this->applyScheduledActions(); + break; + default: + throw new LocalizedException(__("The specified Catalog media URL format is not supported.")); + } return $this->_getModel()->getUrl(); } catch (\Exception $e) { return $this->getDefaultPlaceholderUrl(); diff --git a/app/code/Magento/Catalog/Model/Config/CatalogMediaConfig.php b/app/code/Magento/Catalog/Model/Config/CatalogMediaConfig.php new file mode 100644 index 0000000000000..9e5394f0d6585 --- /dev/null +++ b/app/code/Magento/Catalog/Model/Config/CatalogMediaConfig.php @@ -0,0 +1,50 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Catalog\Model\Config; + +use Magento\Framework\App\Config\ScopeConfigInterface; + +/** + * Config for catalog media + */ +class CatalogMediaConfig +{ + private const XML_PATH_CATALOG_MEDIA_URL_FORMAT = 'web/url/catalog_media_url_format'; + + const IMAGE_OPTIMIZATION_PARAMETERS = 'image_optimization_parameters'; + const HASH = 'hash'; + + /** + * @var ScopeConfigInterface + */ + private $scopeConfig; + + /** + * Constructor + * + * @param ScopeConfigInterface $scopeConfig + */ + public function __construct(ScopeConfigInterface $scopeConfig) + { + $this->scopeConfig = $scopeConfig; + } + + /** + * Get media URL format for catalog images + * + * @param string $scopeType + * @param null|int|string $scopeCode + * @return string + */ + public function getMediaUrlFormat($scopeType = ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $scopeCode = null) + { + return $this->scopeConfig->getValue( + CatalogMediaConfig::XML_PATH_CATALOG_MEDIA_URL_FORMAT, + $scopeType, + $scopeCode + ); + } +} diff --git a/app/code/Magento/Catalog/Model/Config/Source/Web/CatalogMediaUrlFormat.php b/app/code/Magento/Catalog/Model/Config/Source/Web/CatalogMediaUrlFormat.php new file mode 100644 index 0000000000000..f24044fc92c95 --- /dev/null +++ b/app/code/Magento/Catalog/Model/Config/Source/Web/CatalogMediaUrlFormat.php @@ -0,0 +1,30 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Catalog\Model\Config\Source\Web; + +use Magento\Catalog\Model\Config\CatalogMediaConfig; + +/** + * Option provider for catalog media URL format system setting. + */ +class CatalogMediaUrlFormat implements \Magento\Framework\Data\OptionSourceInterface +{ + /** + * Get a list of supported catalog media URL formats. + * + * @codeCoverageIgnore + */ + public function toOptionArray() + { + return [ + [ + 'value' => CatalogMediaConfig::IMAGE_OPTIMIZATION_PARAMETERS, + 'label' => __('Image optimization based on query parameters') + ], + ['value' => CatalogMediaConfig::HASH, 'label' => __('Unique hash per image variant (Legacy mode)')] + ]; + } +} diff --git a/app/code/Magento/Catalog/Model/View/Asset/Image.php b/app/code/Magento/Catalog/Model/View/Asset/Image.php index c547ec612bb94..da1009ab1125c 100644 --- a/app/code/Magento/Catalog/Model/View/Asset/Image.php +++ b/app/code/Magento/Catalog/Model/View/Asset/Image.php @@ -6,11 +6,16 @@ namespace Magento\Catalog\Model\View\Asset; +use Magento\Catalog\Model\Config\CatalogMediaConfig; use Magento\Catalog\Model\Product\Media\ConfigInterface; use Magento\Framework\Encryption\Encryptor; use Magento\Framework\Encryption\EncryptorInterface; +use Magento\Framework\Exception\LocalizedException; use Magento\Framework\View\Asset\ContextInterface; use Magento\Framework\View\Asset\LocalInterface; +use Magento\Catalog\Helper\Image as ImageHelper; +use Magento\Framework\App\ObjectManager; +use Magento\Store\Model\StoreManagerInterface; /** * A locally available image file asset that can be referred with a file path @@ -58,6 +63,21 @@ class Image implements LocalInterface */ private $encryptor; + /** + * @var ImageHelper + */ + private $imageHelper; + + /** + * @var CatalogMediaConfig + */ + private $catalogMediaConfig; + + /** + * @var StoreManagerInterface + */ + private $storeManager; + /** * Image constructor. * @@ -66,13 +86,19 @@ class Image implements LocalInterface * @param EncryptorInterface $encryptor * @param string $filePath * @param array $miscParams + * @param ImageHelper $imageHelper + * @param CatalogMediaConfig $catalogMediaConfig + * @param StoreManagerInterface $storeManager */ public function __construct( ConfigInterface $mediaConfig, ContextInterface $context, EncryptorInterface $encryptor, $filePath, - array $miscParams + array $miscParams, + ImageHelper $imageHelper = null, + CatalogMediaConfig $catalogMediaConfig = null, + StoreManagerInterface $storeManager = null ) { if (isset($miscParams['image_type'])) { $this->sourceContentType = $miscParams['image_type']; @@ -85,14 +111,72 @@ public function __construct( $this->filePath = $filePath; $this->miscParams = $miscParams; $this->encryptor = $encryptor; + $this->imageHelper = $imageHelper ?: ObjectManager::getInstance()->get(ImageHelper::class); + $this->catalogMediaConfig = $catalogMediaConfig ?: ObjectManager::getInstance()->get(CatalogMediaConfig::class); + $this->storeManager = $storeManager ?: ObjectManager::getInstance()->get(StoreManagerInterface::class); } /** - * @inheritdoc + * Get catalog image URL. + * + * @return string + * @throws LocalizedException */ public function getUrl() { - return $this->context->getBaseUrl() . DIRECTORY_SEPARATOR . $this->getImageInfo(); + $mediaUrlFormat = $this->catalogMediaConfig->getMediaUrlFormat(); + switch ($mediaUrlFormat) { + case CatalogMediaConfig::IMAGE_OPTIMIZATION_PARAMETERS: + return $this->getUrlWithTransformationParameters(); + case CatalogMediaConfig::HASH: + return $this->context->getBaseUrl() . DIRECTORY_SEPARATOR . $this->getImageInfo(); + default: + throw new LocalizedException( + __("The specified Catalog media URL format '$mediaUrlFormat' is not supported.") + ); + } + } + + /** + * Get image URL with transformation parameters + * + * @return string + */ + private function getUrlWithTransformationParameters() + { + return $this->getOriginalImageUrl() . '?' . http_build_query($this->getImageTransformationParameters()); + } + + /** + * The list of parameters to be used during image transformations (e.g. resizing or applying watermarks). + * + * This method can be used as an extension point. + * + * @return string[] + */ + public function getImageTransformationParameters() + { + return [ + 'width' => $this->miscParams['image_width'], + 'height' => $this->miscParams['image_height'], + 'store' => $this->storeManager->getStore()->getCode(), + 'image-type' => $this->sourceContentType + ]; + } + + /** + * Get URL to the original version of the product image. + * + * @return string + */ + private function getOriginalImageUrl() + { + $originalImageFile = $this->getSourceFile(); + if (!$originalImageFile) { + return $this->imageHelper->getDefaultPlaceholderUrl(); + } else { + return $this->context->getBaseUrl() . $this->getFilePath(); + } } /** diff --git a/app/code/Magento/Catalog/Observer/ImageResizeAfterProductSave.php b/app/code/Magento/Catalog/Observer/ImageResizeAfterProductSave.php index 91d2868afab8c..54b655a217a08 100644 --- a/app/code/Magento/Catalog/Observer/ImageResizeAfterProductSave.php +++ b/app/code/Magento/Catalog/Observer/ImageResizeAfterProductSave.php @@ -10,7 +10,11 @@ use Magento\Framework\Event\ObserverInterface; use Magento\Framework\App\State; use Magento\MediaStorage\Service\ImageResize; +use Magento\Catalog\Model\Config\CatalogMediaConfig; +/** + * Resize product images after the product is saved + */ class ImageResizeAfterProductSave implements ObserverInterface { /** @@ -23,17 +27,26 @@ class ImageResizeAfterProductSave implements ObserverInterface */ private $state; + /** + * @var CatalogMediaConfig + */ + private $catalogMediaConfig; + /** * Product constructor. + * * @param ImageResize $imageResize * @param State $state + * @param CatalogMediaConfig $catalogMediaConfig */ public function __construct( ImageResize $imageResize, - State $state + State $state, + CatalogMediaConfig $catalogMediaConfig ) { $this->imageResize = $imageResize; $this->state = $state; + $this->catalogMediaConfig = $catalogMediaConfig; } /** @@ -44,6 +57,12 @@ public function __construct( */ public function execute(\Magento\Framework\Event\Observer $observer) { + $catalogMediaUrlFormat = $this->catalogMediaConfig->getMediaUrlFormat(); + if ($catalogMediaUrlFormat == CatalogMediaConfig::IMAGE_OPTIMIZATION_PARAMETERS) { + // Skip image resizing on the Magento side when it is offloaded to a web server or CDN + return; + } + /** @var $product \Magento\Catalog\Model\Product */ $product = $observer->getEvent()->getProduct(); diff --git a/app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Helper/Form/Gallery/ContentTest.php b/app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Helper/Form/Gallery/ContentTest.php deleted file mode 100644 index 9a2199859a1df..0000000000000 --- a/app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Helper/Form/Gallery/ContentTest.php +++ /dev/null @@ -1,442 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Catalog\Test\Unit\Block\Adminhtml\Product\Helper\Form\Gallery; - -use Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Gallery\Content; -use Magento\Catalog\Model\Entity\Attribute; -use Magento\Catalog\Model\Product; -use Magento\Framework\Phrase; -use Magento\MediaStorage\Helper\File\Storage\Database; - -/** - * @SuppressWarnings(PHPMD.CouplingBetweenObjects) - */ -class ContentTest extends \PHPUnit\Framework\TestCase -{ - /** - * @var \Magento\Framework\Filesystem|\PHPUnit_Framework_MockObject_MockObject - */ - protected $fileSystemMock; - - /** - * @var \Magento\Framework\Filesystem\Directory\Read|\PHPUnit_Framework_MockObject_MockObject - */ - protected $readMock; - - /** - * @var Content|\PHPUnit_Framework_MockObject_MockObject - */ - protected $content; - - /** - * @var \Magento\Catalog\Model\Product\Media\Config|\PHPUnit_Framework_MockObject_MockObject - */ - protected $mediaConfigMock; - - /** - * @var \Magento\Framework\Json\EncoderInterface|\PHPUnit_Framework_MockObject_MockObject - */ - protected $jsonEncoderMock; - - /** - * @var \Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Gallery|\PHPUnit_Framework_MockObject_MockObject - */ - protected $galleryMock; - - /** - * @var \Magento\Catalog\Helper\Image|\PHPUnit_Framework_MockObject_MockObject - */ - protected $imageHelper; - - /** - * @var \Magento\MediaStorage\Helper\File\Storage\Database|\PHPUnit_Framework_MockObject_MockObject - */ - protected $databaseMock; - - /** - * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager - */ - protected $objectManager; - - public function setUp() - { - $this->fileSystemMock = $this->createPartialMock( - \Magento\Framework\Filesystem::class, - ['stat', 'getDirectoryRead'] - ); - $this->readMock = $this->createMock(\Magento\Framework\Filesystem\Directory\ReadInterface::class); - $this->galleryMock = $this->createMock(\Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Gallery::class); - $this->mediaConfigMock = $this->createPartialMock( - \Magento\Catalog\Model\Product\Media\Config::class, - ['getMediaUrl', 'getMediaPath'] - ); - $this->jsonEncoderMock = $this->getMockBuilder(\Magento\Framework\Json\EncoderInterface::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->databaseMock = $this->getMockBuilder(Database::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $this->content = $this->objectManager->getObject( - \Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Gallery\Content::class, - [ - 'mediaConfig' => $this->mediaConfigMock, - 'jsonEncoder' => $this->jsonEncoderMock, - 'filesystem' => $this->fileSystemMock, - 'fileStorageDatabase' => $this->databaseMock - ] - ); - } - - public function testGetImagesJson() - { - $url = [ - ['file_1.jpg', 'url_to_the_image/image_1.jpg'], - ['file_2.jpg', 'url_to_the_image/image_2.jpg'] - ]; - $mediaPath = [ - ['file_1.jpg', 'catalog/product/image_1.jpg'], - ['file_2.jpg', 'catalog/product/image_2.jpg'] - ]; - - $sizeMap = [ - ['catalog/product/image_1.jpg', ['size' => 399659]], - ['catalog/product/image_2.jpg', ['size' => 879394]] - ]; - - $imagesResult = [ - [ - 'value_id' => '2', - 'file' => 'file_2.jpg', - 'media_type' => 'image', - 'position' => '0', - 'url' => 'url_to_the_image/image_2.jpg', - 'size' => 879394 - ], - [ - 'value_id' => '1', - 'file' => 'file_1.jpg', - 'media_type' => 'image', - 'position' => '1', - 'url' => 'url_to_the_image/image_1.jpg', - 'size' => 399659 - ] - ]; - - $images = [ - 'images' => [ - [ - 'value_id' => '1', - 'file' => 'file_1.jpg', - 'media_type' => 'image', - 'position' => '1' - ] , - [ - 'value_id' => '2', - 'file' => 'file_2.jpg', - 'media_type' => 'image', - 'position' => '0' - ] - ] - ]; - - $this->content->setElement($this->galleryMock); - $this->galleryMock->expects($this->once())->method('getImages')->willReturn($images); - $this->fileSystemMock->expects($this->once())->method('getDirectoryRead')->willReturn($this->readMock); - - $this->mediaConfigMock->expects($this->any())->method('getMediaUrl')->willReturnMap($url); - $this->mediaConfigMock->expects($this->any())->method('getMediaPath')->willReturnMap($mediaPath); - $this->readMock->expects($this->any())->method('stat')->willReturnMap($sizeMap); - $this->jsonEncoderMock->expects($this->once())->method('encode')->willReturnCallback('json_encode'); - - $this->readMock->expects($this->any()) - ->method('isFile') - ->will($this->returnValue(true)); - $this->databaseMock->expects($this->any()) - ->method('checkDbUsage') - ->will($this->returnValue(false)); - - $this->assertSame(json_encode($imagesResult), $this->content->getImagesJson()); - } - - public function testGetImagesJsonWithoutImages() - { - $this->content->setElement($this->galleryMock); - $this->galleryMock->expects($this->once())->method('getImages')->willReturn(null); - - $this->assertSame('[]', $this->content->getImagesJson()); - } - - public function testGetImagesJsonWithException() - { - $this->imageHelper = $this->getMockBuilder(\Magento\Catalog\Helper\Image::class) - ->disableOriginalConstructor() - ->setMethods(['getDefaultPlaceholderUrl']) - ->getMock(); - - $this->objectManager->setBackwardCompatibleProperty( - $this->content, - 'imageHelper', - $this->imageHelper - ); - - $placeholderUrl = 'url_to_the_placeholder/placeholder.jpg'; - - $imagesResult = [ - [ - 'value_id' => '2', - 'file' => 'file_2.jpg', - 'media_type' => 'image', - 'position' => '0', - 'url' => 'url_to_the_placeholder/placeholder.jpg', - 'size' => 0 - ], - [ - 'value_id' => '1', - 'file' => 'file_1.jpg', - 'media_type' => 'image', - 'position' => '1', - 'url' => 'url_to_the_placeholder/placeholder.jpg', - 'size' => 0 - ] - ]; - - $images = [ - 'images' => [ - [ - 'value_id' => '1', - 'file' => 'file_1.jpg', - 'media_type' => 'image', - 'position' => '1' - ], - [ - 'value_id' => '2', - 'file' => 'file_2.jpg', - 'media_type' => 'image', - 'position' => '0' - ] - ] - ]; - - $this->content->setElement($this->galleryMock); - $this->galleryMock->expects($this->once())->method('getImages')->willReturn($images); - $this->fileSystemMock->expects($this->any())->method('getDirectoryRead')->willReturn($this->readMock); - $this->mediaConfigMock->expects($this->any())->method('getMediaUrl'); - $this->mediaConfigMock->expects($this->any())->method('getMediaPath'); - - $this->readMock->expects($this->any()) - ->method('isFile') - ->will($this->returnValue(true)); - $this->databaseMock->expects($this->any()) - ->method('checkDbUsage') - ->will($this->returnValue(false)); - - $this->readMock->expects($this->any())->method('stat')->willReturnOnConsecutiveCalls( - $this->throwException( - new \Magento\Framework\Exception\FileSystemException(new Phrase('test')) - ), - $this->throwException( - new \Magento\Framework\Exception\FileSystemException(new Phrase('test')) - ) - ); - $this->imageHelper->expects($this->any())->method('getDefaultPlaceholderUrl')->willReturn($placeholderUrl); - $this->jsonEncoderMock->expects($this->once())->method('encode')->willReturnCallback('json_encode'); - - $this->assertSame(json_encode($imagesResult), $this->content->getImagesJson()); - } - - /** - * Test GetImageTypes() will return value for given attribute from data persistor. - * - * @return void - */ - public function testGetImageTypesFromDataPersistor() - { - $attributeCode = 'thumbnail'; - $value = 'testImageValue'; - $scopeLabel = 'testScopeLabel'; - $label = 'testLabel'; - $name = 'testName'; - $expectedTypes = [ - $attributeCode => [ - 'code' => $attributeCode, - 'value' => $value, - 'label' => $label, - 'name' => $name, - ], - ]; - $product = $this->getMockBuilder(Product::class) - ->disableOriginalConstructor() - ->getMock(); - $product->expects($this->once()) - ->method('getData') - ->with($this->identicalTo($attributeCode)) - ->willReturn(null); - $mediaAttribute = $this->getMediaAttribute($label, $attributeCode); - $product->expects($this->once()) - ->method('getMediaAttributes') - ->willReturn([$mediaAttribute]); - $this->galleryMock->expects($this->exactly(2)) - ->method('getDataObject') - ->willReturn($product); - $this->galleryMock->expects($this->once()) - ->method('getImageValue') - ->with($this->identicalTo($attributeCode)) - ->willReturn($value); - $this->galleryMock->expects($this->once()) - ->method('getScopeLabel') - ->with($this->identicalTo($mediaAttribute)) - ->willReturn($scopeLabel); - $this->galleryMock->expects($this->once()) - ->method('getAttributeFieldName') - ->with($this->identicalTo($mediaAttribute)) - ->willReturn($name); - $this->getImageTypesAssertions($attributeCode, $scopeLabel, $expectedTypes); - } - - /** - * Test GetImageTypes() will return value for given attribute from product. - * - * @return void - */ - public function testGetImageTypesFromProduct() - { - $attributeCode = 'thumbnail'; - $value = 'testImageValue'; - $scopeLabel = 'testScopeLabel'; - $label = 'testLabel'; - $name = 'testName'; - $expectedTypes = [ - $attributeCode => [ - 'code' => $attributeCode, - 'value' => $value, - 'label' => $label, - 'name' => $name, - ], - ]; - $product = $this->getMockBuilder(Product::class) - ->disableOriginalConstructor() - ->getMock(); - $product->expects($this->once()) - ->method('getData') - ->with($this->identicalTo($attributeCode)) - ->willReturn($value); - $mediaAttribute = $this->getMediaAttribute($label, $attributeCode); - $product->expects($this->once()) - ->method('getMediaAttributes') - ->willReturn([$mediaAttribute]); - $this->galleryMock->expects($this->exactly(2)) - ->method('getDataObject') - ->willReturn($product); - $this->galleryMock->expects($this->never()) - ->method('getImageValue'); - $this->galleryMock->expects($this->once()) - ->method('getScopeLabel') - ->with($this->identicalTo($mediaAttribute)) - ->willReturn($scopeLabel); - $this->galleryMock->expects($this->once()) - ->method('getAttributeFieldName') - ->with($this->identicalTo($mediaAttribute)) - ->willReturn($name); - $this->getImageTypesAssertions($attributeCode, $scopeLabel, $expectedTypes); - } - - /** - * Perform assertions. - * - * @param string $attributeCode - * @param string $scopeLabel - * @param array $expectedTypes - * @return void - */ - private function getImageTypesAssertions(string $attributeCode, string $scopeLabel, array $expectedTypes) - { - $this->content->setElement($this->galleryMock); - $result = $this->content->getImageTypes(); - $scope = $result[$attributeCode]['scope']; - $this->assertSame($scopeLabel, $scope->getText()); - unset($result[$attributeCode]['scope']); - $this->assertSame($expectedTypes, $result); - } - - /** - * Get media attribute mock. - * - * @param string $label - * @param string $attributeCode - * @return \PHPUnit_Framework_MockObject_MockObject - */ - private function getMediaAttribute(string $label, string $attributeCode) - { - $frontend = $this->getMockBuilder(Product\Attribute\Frontend\Image::class) - ->disableOriginalConstructor() - ->getMock(); - $frontend->expects($this->once()) - ->method('getLabel') - ->willReturn($label); - $mediaAttribute = $this->getMockBuilder(Attribute::class) - ->disableOriginalConstructor() - ->getMock(); - $mediaAttribute->expects($this->any()) - ->method('getAttributeCode') - ->willReturn($attributeCode); - $mediaAttribute->expects($this->once()) - ->method('getFrontend') - ->willReturn($frontend); - - return $mediaAttribute; - } - - /** - * Test GetImagesJson() calls MediaStorage functions to obtain image from DB prior to stat call - * - * @return void - */ - public function testGetImagesJsonMediaStorageMode() - { - $images = [ - 'images' => [ - [ - 'value_id' => '0', - 'file' => 'file_1.jpg', - 'media_type' => 'image', - 'position' => '0' - ] - ] - ]; - - $mediaPath = [ - ['file_1.jpg', 'catalog/product/image_1.jpg'] - ]; - - $this->content->setElement($this->galleryMock); - - $this->galleryMock->expects($this->once()) - ->method('getImages') - ->willReturn($images); - $this->fileSystemMock->expects($this->once()) - ->method('getDirectoryRead') - ->willReturn($this->readMock); - $this->mediaConfigMock->expects($this->any()) - ->method('getMediaPath') - ->willReturnMap($mediaPath); - - $this->readMock->expects($this->any()) - ->method('isFile') - ->will($this->returnValue(false)); - $this->databaseMock->expects($this->any()) - ->method('checkDbUsage') - ->will($this->returnValue(true)); - - $this->databaseMock->expects($this->once()) - ->method('saveFileToFilesystem') - ->with('catalog/product/image_1.jpg'); - - $this->content->getImagesJson(); - } -} diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ImageUploaderTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ImageUploaderTest.php deleted file mode 100644 index 6552e85440008..0000000000000 --- a/app/code/Magento/Catalog/Test/Unit/Model/ImageUploaderTest.php +++ /dev/null @@ -1,154 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Catalog\Test\Unit\Model; - -class ImageUploaderTest extends \PHPUnit\Framework\TestCase -{ - /** - * @var \Magento\Catalog\Model\ImageUploader - */ - private $imageUploader; - - /** - * Core file storage database - * - * @var \Magento\MediaStorage\Helper\File\Storage\Database|\PHPUnit_Framework_MockObject_MockObject - */ - private $coreFileStorageDatabaseMock; - - /** - * Media directory object (writable). - * - * @var \Magento\Framework\Filesystem|\PHPUnit_Framework_MockObject_MockObject - */ - private $mediaDirectoryMock; - - /** - * Media directory object (writable). - * - * @var \Magento\Framework\Filesystem\Directory\WriteInterface|\PHPUnit_Framework_MockObject_MockObject - */ - private $mediaWriteDirectoryMock; - - /** - * Uploader factory - * - * @var \Magento\MediaStorage\Model\File\UploaderFactory|\PHPUnit_Framework_MockObject_MockObject - */ - private $uploaderFactoryMock; - - /** - * Store manager - * - * @var \Magento\Store\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject - */ - private $storeManagerMock; - - /** - * @var \Psr\Log\LoggerInterface|\PHPUnit_Framework_MockObject_MockObject - */ - private $loggerMock; - - /** - * Base tmp path - * - * @var string - */ - private $baseTmpPath; - - /** - * Base path - * - * @var string - */ - private $basePath; - - /** - * Allowed extensions - * - * @var array - */ - private $allowedExtensions; - - /** - * Allowed mime types - * - * @var array - */ - private $allowedMimeTypes; - - protected function setUp() - { - $this->coreFileStorageDatabaseMock = $this->createMock( - \Magento\MediaStorage\Helper\File\Storage\Database::class - ); - $this->mediaDirectoryMock = $this->createMock( - \Magento\Framework\Filesystem::class - ); - $this->mediaWriteDirectoryMock = $this->createMock( - \Magento\Framework\Filesystem\Directory\WriteInterface::class - ); - $this->mediaDirectoryMock->expects($this->any())->method('getDirectoryWrite')->willReturn( - $this->mediaWriteDirectoryMock - ); - $this->uploaderFactoryMock = $this->createMock( - \Magento\MediaStorage\Model\File\UploaderFactory::class - ); - $this->storeManagerMock = $this->createMock( - \Magento\Store\Model\StoreManagerInterface::class - ); - $this->loggerMock = $this->createMock(\Psr\Log\LoggerInterface::class); - $this->baseTmpPath = 'base/tmp/'; - $this->basePath = 'base/real/'; - $this->allowedExtensions = ['.jpg']; - $this->allowedMimeTypes = ['image/jpg', 'image/jpeg', 'image/gif', 'image/png']; - - $this->imageUploader = - new \Magento\Catalog\Model\ImageUploader( - $this->coreFileStorageDatabaseMock, - $this->mediaDirectoryMock, - $this->uploaderFactoryMock, - $this->storeManagerMock, - $this->loggerMock, - $this->baseTmpPath, - $this->basePath, - $this->allowedExtensions, - $this->allowedMimeTypes - ); - } - - public function testSaveFileToTmpDir() - { - $fileId = 'file.jpg'; - $allowedMimeTypes = [ - 'image/jpg', - 'image/jpeg', - 'image/gif', - 'image/png', - ]; - /** @var \Magento\MediaStorage\Model\File\Uploader|\PHPUnit_Framework_MockObject_MockObject $uploader */ - $uploader = $this->createMock(\Magento\MediaStorage\Model\File\Uploader::class); - $this->uploaderFactoryMock->expects($this->once())->method('create')->willReturn($uploader); - $uploader->expects($this->once())->method('setAllowedExtensions')->with($this->allowedExtensions); - $uploader->expects($this->once())->method('setAllowRenameFiles')->with(true); - $this->mediaWriteDirectoryMock->expects($this->once())->method('getAbsolutePath')->with($this->baseTmpPath) - ->willReturn($this->basePath); - $uploader->expects($this->once())->method('save')->with($this->basePath) - ->willReturn(['tmp_name' => $this->baseTmpPath, 'file' => $fileId, 'path' => $this->basePath]); - $uploader->expects($this->atLeastOnce())->method('checkMimeType')->with($allowedMimeTypes)->willReturn(true); - $storeMock = $this->createPartialMock( - \Magento\Store\Model\Store::class, - ['getBaseUrl'] - ); - $this->storeManagerMock->expects($this->once())->method('getStore')->willReturn($storeMock); - $storeMock->expects($this->once())->method('getBaseUrl'); - $this->coreFileStorageDatabaseMock->expects($this->once())->method('saveFile'); - - $result = $this->imageUploader->saveFileToTmpDir($fileId); - - $this->assertArrayNotHasKey('path', $result); - } -} diff --git a/app/code/Magento/Catalog/Test/Unit/Model/View/Asset/Image/ContextTest.php b/app/code/Magento/Catalog/Test/Unit/Model/View/Asset/Image/ContextTest.php deleted file mode 100644 index e73a2f30e2b10..0000000000000 --- a/app/code/Magento/Catalog/Test/Unit/Model/View/Asset/Image/ContextTest.php +++ /dev/null @@ -1,76 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Catalog\Test\Unit\Model\View\Asset\Image; - -use Magento\Catalog\Model\Product\Media\ConfigInterface; -use Magento\Catalog\Model\View\Asset\Image\Context; -use Magento\Framework\App\Filesystem\DirectoryList; -use Magento\Framework\Filesystem; -use Magento\Framework\Filesystem\Directory\WriteInterface; - -/** - * Class ContextTest - */ -class ContextTest extends \PHPUnit\Framework\TestCase -{ - /** - * @var Context - */ - protected $model; - - /** - * @var WriteInterface|\PHPUnit_Framework_MockObject_MockObject - */ - protected $mediaDirectory; - - /** - * @var ContextInterface|\PHPUnit_Framework_MockObject_MockObject - */ - protected $mediaConfig; - - /** - * @var Filesystem|\PHPUnit_Framework_MockObject_MockObject - */ - protected $filesystem; - - protected function setUp() - { - $this->mediaConfig = $this->getMockBuilder(ConfigInterface::class)->getMockForAbstractClass(); - $this->mediaConfig->expects($this->any())->method('getBaseMediaPath')->willReturn('catalog/product'); - $this->mediaDirectory = $this->getMockBuilder(WriteInterface::class)->getMockForAbstractClass(); - $this->mediaDirectory->expects($this->once())->method('create')->with('catalog/product'); - $this->filesystem = $this->getMockBuilder(Filesystem::class) - ->disableOriginalConstructor() - ->getMock(); - $this->filesystem->expects($this->once()) - ->method('getDirectoryWrite') - ->with(DirectoryList::MEDIA) - ->willReturn($this->mediaDirectory); - $this->model = new Context( - $this->mediaConfig, - $this->filesystem - ); - } - - public function testGetPath() - { - $path = '/var/www/html/magento2ce/pub/media/catalog/product'; - $this->mediaDirectory->expects($this->once()) - ->method('getAbsolutePath') - ->with('catalog/product') - ->willReturn($path); - - $this->assertEquals($path, $this->model->getPath()); - } - - public function testGetUrl() - { - $baseUrl = 'http://localhost/pub/media/catalog/product'; - $this->mediaConfig->expects($this->once())->method('getBaseMediaUrl')->willReturn($baseUrl); - - $this->assertEquals($baseUrl, $this->model->getBaseUrl()); - } -} diff --git a/app/code/Magento/Catalog/Test/Unit/Model/View/Asset/ImageTest.php b/app/code/Magento/Catalog/Test/Unit/Model/View/Asset/ImageTest.php deleted file mode 100644 index 6832d5b3399d7..0000000000000 --- a/app/code/Magento/Catalog/Test/Unit/Model/View/Asset/ImageTest.php +++ /dev/null @@ -1,213 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Catalog\Test\Unit\Model\View\Asset; - -use Magento\Catalog\Model\Product\Media\ConfigInterface; -use Magento\Catalog\Model\View\Asset\Image; -use Magento\Framework\Encryption\Encryptor; -use Magento\Framework\Encryption\EncryptorInterface; -use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; -use Magento\Framework\View\Asset\ContextInterface; -use Magento\Framework\View\Asset\Repository; - -/** - * Class ImageTest - */ -class ImageTest extends \PHPUnit\Framework\TestCase -{ - /** - * @var \Magento\Catalog\Model\View\Asset\Image - */ - protected $model; - - /** - * @var ContextInterface|\PHPUnit_Framework_MockObject_MockObject - */ - protected $mediaConfig; - - /** - * @var EncryptorInterface|\PHPUnit_Framework_MockObject_MockObject - */ - protected $encryptor; - - /** - * @var ContextInterface|\PHPUnit_Framework_MockObject_MockObject - */ - protected $context; - - /** - * @var Repository|\PHPUnit_Framework_MockObject_MockObject - */ - private $assetRepo; - - private $objectManager; - - protected function setUp() - { - $this->mediaConfig = $this->createMock(ConfigInterface::class); - $this->encryptor = $this->createMock(EncryptorInterface::class); - $this->context = $this->createMock(ContextInterface::class); - $this->assetRepo = $this->createMock(Repository::class); - $this->objectManager = new ObjectManager($this); - $this->model = $this->objectManager->getObject( - Image::class, - [ - 'mediaConfig' => $this->mediaConfig, - 'imageContext' => $this->context, - 'encryptor' => $this->encryptor, - 'filePath' => '/somefile.png', - 'assetRepo' => $this->assetRepo, - 'miscParams' => [ - 'image_width' => 100, - 'image_height' => 50, - 'constrain_only' => false, - 'keep_aspect_ratio' => false, - 'keep_frame' => true, - 'keep_transparency' => false, - 'background' => '255,255,255', - 'image_type' => 'image', //thumbnail,small_image,image,swatch_image,swatch_thumb - 'quality' => 80, - 'angle' => null - ] - ] - ); - } - - public function testModuleAndContentAndContentType() - { - $contentType = 'image'; - $this->assertEquals($contentType, $this->model->getContentType()); - $this->assertEquals($contentType, $this->model->getSourceContentType()); - $this->assertNull($this->model->getContent()); - $this->assertEquals('cache', $this->model->getModule()); - } - - public function testGetFilePath() - { - $this->assertEquals('/somefile.png', $this->model->getFilePath()); - } - - public function testGetSoureFile() - { - $this->mediaConfig->expects($this->once())->method('getBaseMediaPath')->willReturn('catalog/product'); - $this->assertEquals('catalog/product/somefile.png', $this->model->getSourceFile()); - } - - public function testGetContext() - { - $this->assertInstanceOf(ContextInterface::class, $this->model->getContext()); - } - - /** - * @param string $filePath - * @param array $miscParams - * @param string $readableParams - * @dataProvider getPathDataProvider - */ - public function testGetPath($filePath, $miscParams, $readableParams) - { - $imageModel = $this->objectManager->getObject( - Image::class, - [ - 'mediaConfig' => $this->mediaConfig, - 'context' => $this->context, - 'encryptor' => $this->encryptor, - 'filePath' => $filePath, - 'assetRepo' => $this->assetRepo, - 'miscParams' => $miscParams - ] - ); - $absolutePath = '/var/www/html/magento2ce/pub/media/catalog/product'; - $hashPath = 'somehash'; - $this->context->method('getPath')->willReturn($absolutePath); - $this->encryptor->expects(static::once()) - ->method('hash') - ->with($readableParams, $this->anything()) - ->willReturn($hashPath); - static::assertEquals( - $absolutePath . '/cache/'. $hashPath . $filePath, - $imageModel->getPath() - ); - } - - /** - * @param string $filePath - * @param array $miscParams - * @param string $readableParams - * @dataProvider getPathDataProvider - */ - public function testGetUrl($filePath, $miscParams, $readableParams) - { - $imageModel = $this->objectManager->getObject( - Image::class, - [ - 'mediaConfig' => $this->mediaConfig, - 'context' => $this->context, - 'encryptor' => $this->encryptor, - 'filePath' => $filePath, - 'assetRepo' => $this->assetRepo, - 'miscParams' => $miscParams - ] - ); - $absolutePath = 'http://localhost/pub/media/catalog/product'; - $hashPath = 'somehash'; - $this->context->expects(static::once())->method('getBaseUrl')->willReturn($absolutePath); - $this->encryptor->expects(static::once()) - ->method('hash') - ->with($readableParams, $this->anything()) - ->willReturn($hashPath); - static::assertEquals( - $absolutePath . '/cache/' . $hashPath . $filePath, - $imageModel->getUrl() - ); - } - - /** - * @return array - */ - public function getPathDataProvider() - { - return [ - [ - '/some_file.png', - [], //default value for miscParams, - 'h:empty_w:empty_q:empty_r:empty_nonproportional_noframe_notransparency_notconstrainonly_nobackground', - ], - [ - '/some_file_2.png', - [ - 'image_type' => 'thumbnail', - 'image_height' => 75, - 'image_width' => 75, - 'keep_aspect_ratio' => true, - 'keep_frame' => true, - 'keep_transparency' => true, - 'constrain_only' => true, - 'background' => [233,1,0], - 'angle' => null, - 'quality' => 80, - ], - 'h:75_w:75_proportional_frame_transparency_doconstrainonly_rgb233,1,0_r:empty_q:80', - ], - [ - '/some_file_3.png', - [ - 'image_type' => 'thumbnail', - 'image_height' => 75, - 'image_width' => 75, - 'keep_aspect_ratio' => false, - 'keep_frame' => false, - 'keep_transparency' => false, - 'constrain_only' => false, - 'background' => [233,1,0], - 'angle' => 90, - 'quality' => 80, - ], - 'h:75_w:75_nonproportional_noframe_notransparency_notconstrainonly_rgb233,1,0_r:90_q:80', - ], - ]; - } -} diff --git a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Listing/Collector/ImageTest.php b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Listing/Collector/ImageTest.php index 009cd690d4cd4..bd08a39fb2bed 100644 --- a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Listing/Collector/ImageTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Listing/Collector/ImageTest.php @@ -99,9 +99,6 @@ public function testGet() ->method('create') ->willReturn($image); - $imageHelper->expects($this->once()) - ->method('getResizedImageInfo') - ->willReturn([11, 11]); $this->state->expects($this->once()) ->method('emulateAreaCode') ->with( @@ -111,12 +108,14 @@ public function testGet() ) ->willReturn($imageHelper); + $width = 5; + $height = 10; $imageHelper->expects($this->once()) ->method('getHeight') - ->willReturn(10); + ->willReturn($height); $imageHelper->expects($this->once()) ->method('getWidth') - ->willReturn(10); + ->willReturn($width); $imageHelper->expects($this->once()) ->method('getLabel') ->willReturn('Label'); @@ -132,10 +131,10 @@ public function testGet() ->with(); $image->expects($this->once()) ->method('setResizedHeight') - ->with(11); + ->with($height); $image->expects($this->once()) ->method('setResizedWidth') - ->with(11); + ->with($width); $productRenderInfoDto->expects($this->once()) ->method('setImages') diff --git a/app/code/Magento/Catalog/Ui/Component/Listing/Columns/Thumbnail.php b/app/code/Magento/Catalog/Ui/Component/Listing/Columns/Thumbnail.php index 09c9782fc0e32..52773b4580256 100644 --- a/app/code/Magento/Catalog/Ui/Component/Listing/Columns/Thumbnail.php +++ b/app/code/Magento/Catalog/Ui/Component/Listing/Columns/Thumbnail.php @@ -9,7 +9,7 @@ use Magento\Framework\View\Element\UiComponent\ContextInterface; /** - * Class Thumbnail + * Column with thumbnail images * * @api * @since 100.0.2 @@ -20,6 +20,16 @@ class Thumbnail extends \Magento\Ui\Component\Listing\Columns\Column const ALT_FIELD = 'name'; + /** + * @var \Magento\Catalog\Helper\Image + */ + private $imageHelper; + + /** + * @var \Magento\Framework\UrlInterface + */ + private $urlBuilder; + /** * @param ContextInterface $context * @param UiComponentFactory $uiComponentFactory diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Related.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Related.php index b4acb93dcd14f..b822a5e3ef88a 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Related.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Related.php @@ -25,7 +25,7 @@ use Magento\Catalog\Model\Product\Attribute\Source\Status; /** - * Class Related + * Related products modifier * * @api * @@ -143,7 +143,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc * @since 101.0.0 */ public function modifyMeta(array $meta) @@ -182,7 +182,7 @@ public function modifyMeta(array $meta) } /** - * {@inheritdoc} + * @inheritdoc * @since 101.0.0 */ public function modifyData(array $data) diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/Collector/Image.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/Collector/Image.php index d8f76c40e8fad..45383ed51f6fc 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/Collector/Image.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/Collector/Image.php @@ -118,18 +118,14 @@ public function collect(ProductInterface $product, ProductRenderInterface $produ [$product, $imageCode, (int) $productRender->getStoreId(), $image] ); - try { - $resizedInfo = $helper->getResizedImageInfo(); - } catch (NotLoadInfoImageException $exception) { - $resizedInfo = [$helper->getWidth(), $helper->getHeight()]; - } - $image->setCode($imageCode); - $image->setHeight($helper->getHeight()); - $image->setWidth($helper->getWidth()); + $height = $helper->getHeight(); + $image->setHeight($height); + $width = $helper->getWidth(); + $image->setWidth($width); $image->setLabel($helper->getLabel()); - $image->setResizedHeight($resizedInfo[1]); - $image->setResizedWidth($resizedInfo[0]); + $image->setResizedHeight($height); + $image->setResizedWidth($width); $images[] = $image; } diff --git a/app/code/Magento/Catalog/etc/adminhtml/system.xml b/app/code/Magento/Catalog/etc/adminhtml/system.xml index 80b323cfdb250..f59990cdcea96 100644 --- a/app/code/Magento/Catalog/etc/adminhtml/system.xml +++ b/app/code/Magento/Catalog/etc/adminhtml/system.xml @@ -208,6 +208,13 @@ <source_model>Magento\Catalog\Model\Config\Source\LayoutList</source_model> </field> </group> + <group id="url"> + <field id="catalog_media_url_format" translate="label comment" type="select" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> + <label>Catalog media URL format</label> + <source_model>Magento\Catalog\Model\Config\Source\Web\CatalogMediaUrlFormat</source_model> + <comment><![CDATA[Images should be optimized based on query parameters by your CDN or web server. Use the legacy mode for backward compatibility. <a href="https://docs.magento.com/m2/ee/user_guide/configuration/general/web.html#url-options">Learn more</a> about catalog URL formats.<br/><br/><strong style="color:red">Warning!</strong> If you switch back to legacy mode, you must <a href="https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/themes/theme-images.html#resize-catalog-images">use the CLI to regenerate images</a>.]]></comment> + </field> + </group> </section> <section id="system" translate="label" type="text" sortOrder="900" showInDefault="1" showInWebsite="1" showInStore="1"> <class>separator-top</class> diff --git a/app/code/Magento/Catalog/etc/config.xml b/app/code/Magento/Catalog/etc/config.xml index 59fc4b6d947d9..68289904db0cf 100644 --- a/app/code/Magento/Catalog/etc/config.xml +++ b/app/code/Magento/Catalog/etc/config.xml @@ -80,6 +80,11 @@ <thumbnail_position>stretch</thumbnail_position> </watermark> </design> + <web> + <url> + <catalog_media_url_format>hash</catalog_media_url_format> + </url> + </web> <general> <validator_data> <input_types> diff --git a/app/code/Magento/Checkout/CustomerData/DefaultItem.php b/app/code/Magento/Checkout/CustomerData/DefaultItem.php index 21580d1275d0c..23d5827dc1916 100644 --- a/app/code/Magento/Checkout/CustomerData/DefaultItem.php +++ b/app/code/Magento/Checkout/CustomerData/DefaultItem.php @@ -10,7 +10,7 @@ use Magento\Catalog\Model\Product\Configuration\Item\ItemResolverInterface; /** - * Default item + * Default item in checkout customer data */ class DefaultItem extends AbstractItem { @@ -78,7 +78,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ protected function doGetItemData() { @@ -121,6 +121,8 @@ protected function getOptionList() } /** + * Get product for thumbnail + * * @return \Magento\Catalog\Model\Product * @codeCoverageIgnore */ @@ -130,6 +132,8 @@ protected function getProductForThumbnail() } /** + * Get product + * * @return \Magento\Catalog\Model\Product * @codeCoverageIgnore */ diff --git a/app/code/Magento/Checkout/Model/DefaultConfigProvider.php b/app/code/Magento/Checkout/Model/DefaultConfigProvider.php index fdf49d6765a29..87585e4bf327f 100644 --- a/app/code/Magento/Checkout/Model/DefaultConfigProvider.php +++ b/app/code/Magento/Checkout/Model/DefaultConfigProvider.php @@ -31,7 +31,7 @@ use Magento\Ui\Component\Form\Element\Multiline; /** - * Default Config Provider + * Default Config Provider for checkout * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.TooManyFields) diff --git a/app/code/Magento/MediaStorage/Console/Command/ImagesResizeCommand.php b/app/code/Magento/MediaStorage/Console/Command/ImagesResizeCommand.php index 4ed84829c2ad0..7f19ba6c24cfa 100644 --- a/app/code/Magento/MediaStorage/Console/Command/ImagesResizeCommand.php +++ b/app/code/Magento/MediaStorage/Console/Command/ImagesResizeCommand.php @@ -84,7 +84,10 @@ public function __construct( protected function configure() { $this->setName('catalog:images:resize') - ->setDescription('Creates resized product images') + ->setDescription( + 'Creates resized product images ' . + '(Not relevant when image resizing is offloaded from Magento. See https://docs.magento.com/m2/ee/user_guide/configuration/general/web.html#url-options )' + ) ->setDefinition($this->getOptionsList()); } diff --git a/app/code/Magento/Store/Test/Unit/Model/HeaderProvider/UpgradeInsecureTest.php b/app/code/Magento/Store/Test/Unit/Model/HeaderProvider/UpgradeInsecureTest.php index cf85fb633bbca..29b60ed44d5b1 100644 --- a/app/code/Magento/Store/Test/Unit/Model/HeaderProvider/UpgradeInsecureTest.php +++ b/app/code/Magento/Store/Test/Unit/Model/HeaderProvider/UpgradeInsecureTest.php @@ -19,7 +19,7 @@ class UpgradeInsecureTest extends \PHPUnit\Framework\TestCase /** * Content-Security-Policy header value */ - const HEADER_VALUE = 'upgrade-insecure-requests'; + const HEADER_VALUE = 'upgrade-insecure-requests;'; /** * @var UpgradeInsecure diff --git a/app/code/Magento/Wishlist/CustomerData/Wishlist.php b/app/code/Magento/Wishlist/CustomerData/Wishlist.php index ae54289d4b1c9..2f6b57a8650c4 100644 --- a/app/code/Magento/Wishlist/CustomerData/Wishlist.php +++ b/app/code/Magento/Wishlist/CustomerData/Wishlist.php @@ -68,7 +68,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ public function getSectionData() { @@ -80,6 +80,8 @@ public function getSectionData() } /** + * Get counter + * * @return string */ protected function getCounter() @@ -156,7 +158,6 @@ protected function getItemData(\Magento\Wishlist\Model\Item $wishlistItem) * * @param \Magento\Catalog\Model\Product $product * @return array - * @SuppressWarnings(PHPMD.NPathComplexity) */ protected function getImageData($product) { @@ -164,27 +165,11 @@ protected function getImageData($product) $helper = $this->imageHelperFactory->create() ->init($product, 'wishlist_sidebar_block'); - $template = 'Magento_Catalog/product/image_with_borders'; - - try { - $imagesize = $helper->getResizedImageInfo(); - } catch (NotLoadInfoImageException $exception) { - $imagesize = [$helper->getWidth(), $helper->getHeight()]; - } - - $width = $helper->getFrame() - ? $helper->getWidth() - : $imagesize[0]; - - $height = $helper->getFrame() - ? $helper->getHeight() - : $imagesize[1]; - return [ - 'template' => $template, + 'template' => 'Magento_Catalog/product/image_with_borders', 'src' => $helper->getUrl(), - 'width' => $width, - 'height' => $height, + 'width' => $helper->getWidth(), + 'height' => $helper->getHeight(), 'alt' => $helper->getLabel(), ]; } diff --git a/app/code/Magento/Wishlist/Test/Unit/CustomerData/WishlistTest.php b/app/code/Magento/Wishlist/Test/Unit/CustomerData/WishlistTest.php index 4954712e5ff3b..6d90d8b1a5fed 100644 --- a/app/code/Magento/Wishlist/Test/Unit/CustomerData/WishlistTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/CustomerData/WishlistTest.php @@ -193,9 +193,6 @@ public function testGetSectionData() $this->catalogImageHelperMock->expects($this->any()) ->method('getFrame') ->willReturn(true); - $this->catalogImageHelperMock->expects($this->once()) - ->method('getResizedImageInfo') - ->willReturn([]); $this->wishlistHelperMock->expects($this->once()) ->method('getProductUrl') @@ -394,9 +391,6 @@ public function testGetSectionDataWithTwoItems() $this->catalogImageHelperMock->expects($this->any()) ->method('getFrame') ->willReturn(true); - $this->catalogImageHelperMock->expects($this->exactly(2)) - ->method('getResizedImageInfo') - ->willReturn([]); $this->wishlistHelperMock->expects($this->exactly(2)) ->method('getProductUrl') diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/GalleryTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/GalleryTest.php index 9bcdb00eebe7c..a3545e4a39e80 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/GalleryTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/GalleryTest.php @@ -120,9 +120,23 @@ public function testGetGalleryImagesJsonWithoutImages(): void $this->assertImages(reset($result), $this->placeholderExpectation); } + /** + * @magentoDataFixture Magento/Catalog/_files/product_simple.php + * @magentoConfigFixture default/web/url/catalog_media_url_format image_optimization_parameters + * @magentoDbIsolation enabled + * @return void + */ + public function testGetGalleryImagesJsonWithoutImagesWithImageOptimizationParametersInUrl(): void + { + $this->block->setData('product', $this->getProduct()); + $result = $this->serializer->unserialize($this->block->getGalleryImagesJson()); + $this->assertImages(reset($result), $this->placeholderExpectation); + } + /** * @dataProvider galleryDisabledImagesDataProvider * @magentoDataFixture Magento/Catalog/_files/product_with_multiple_images.php + * @magentoConfigFixture default/web/url/catalog_media_url_format hash * @magentoDbIsolation enabled * @param array $images * @param array $expectation @@ -141,6 +155,7 @@ public function testGetGalleryImagesJsonWithDisabledImage(array $images, array $ * @dataProvider galleryDisabledImagesDataProvider * @magentoDataFixture Magento/Catalog/_files/product_with_multiple_images.php * @magentoDataFixture Magento/Store/_files/second_store.php + * @magentoConfigFixture default/web/url/catalog_media_url_format hash * @magentoDbIsolation disabled * @param array $images * @param array $expectation @@ -173,6 +188,8 @@ public function galleryDisabledImagesDataProvider(): array } /** + * Test default image generation format. + * * @dataProvider galleryImagesDataProvider * @magentoDataFixture Magento/Catalog/_files/product_with_multiple_images.php * @magentoDbIsolation enabled @@ -230,10 +247,95 @@ public function galleryImagesDataProvider(): array ]; } + /** + * @dataProvider galleryImagesWithImageOptimizationParametersInUrlDataProvider + * @magentoDataFixture Magento/Catalog/_files/product_with_multiple_images.php + * @magentoConfigFixture default/web/url/catalog_media_url_format image_optimization_parameters + * @magentoDbIsolation enabled + * @param array $images + * @param array $expectation + * @return void + */ + public function testGetGalleryImagesJsonWithImageOptimizationParametersInUrl( + array $images, + array $expectation + ): void { + $product = $this->getProduct(); + $this->setGalleryImages($product, $images); + $this->block->setData('product', $this->getProduct()); + [$firstImage, $secondImage] = $this->serializer->unserialize($this->block->getGalleryImagesJson()); + [$firstExpectedImage, $secondExpectedImage] = $expectation; + $this->assertImages($firstImage, $firstExpectedImage); + $this->assertImages($secondImage, $secondExpectedImage); + } + + /** + * @return array + */ + public function galleryImagesWithImageOptimizationParametersInUrlDataProvider(): array + { + + $imageExpectation = [ + 'thumb' => '/m/a/magento_image.jpg?width=88&height=110&store=default&image-type=thumbnail', + 'img' => '/m/a/magento_image.jpg?width=700&height=700&store=default&image-type=image', + 'full' => '/m/a/magento_image.jpg?store=default&image-type=image', + 'caption' => 'Image Alt Text', + 'position' => '1', + 'isMain' => false, + 'type' => 'image', + 'videoUrl' => null, + ]; + + $thumbnailExpectation = [ + 'thumb' => '/m/a/magento_thumbnail.jpg?width=88&height=110&store=default&image-type=thumbnail', + 'img' => '/m/a/magento_thumbnail.jpg?width=700&height=700&store=default&image-type=image', + 'full' => '/m/a/magento_thumbnail.jpg?store=default&image-type=image', + 'caption' => 'Thumbnail Image', + 'position' => '2', + 'isMain' => false, + 'type' => 'image', + 'videoUrl' => null, + ]; + + return [ + 'with_main_image' => [ + 'images' => [ + '/m/a/magento_image.jpg' => [], + '/m/a/magento_thumbnail.jpg' => ['main' => true], + ], + 'expectation' => [ + $imageExpectation, + array_merge($thumbnailExpectation, ['isMain' => true]), + ], + ], + 'without_main_image' => [ + 'images' => [ + '/m/a/magento_image.jpg' => [], + '/m/a/magento_thumbnail.jpg' => [], + ], + 'expectation' => [ + array_merge($imageExpectation, ['isMain' => true]), + $thumbnailExpectation, + ], + ], + 'with_changed_position' => [ + 'images' => [ + '/m/a/magento_image.jpg' => ['position' => '2'], + '/m/a/magento_thumbnail.jpg' => ['position' => '1'], + ], + 'expectation' => [ + array_merge($thumbnailExpectation, ['position' => '1']), + array_merge($imageExpectation, ['position' => '2', 'isMain' => true]), + ], + ], + ]; + } + /** * @dataProvider galleryImagesOnStoreViewDataProvider * @magentoDataFixture Magento/Catalog/_files/product_with_multiple_images.php * @magentoDataFixture Magento/Store/_files/second_store.php + * @magentoConfigFixture default/web/url/catalog_media_url_format hash * @magentoDbIsolation disabled * @param array $images * @param array $expectation diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Service/PaymentFailuresServiceTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Service/PaymentFailuresServiceTest.php index 383af7968e047..46e9ba667f390 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Model/Service/PaymentFailuresServiceTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Service/PaymentFailuresServiceTest.php @@ -82,7 +82,6 @@ public function testHandlerWithCustomer(): void $expectedVars = [ 'reason' => $errorMessage, 'checkoutType' => $checkoutType, - 'dateAndTime' => $templateTimeMethod->invoke($this->paymentFailures), 'customer' => 'John Smith', 'customerEmail' => 'aaa@aaa.com', 'paymentMethod' => 'Some Title Of The Method', @@ -94,6 +93,7 @@ public function testHandlerWithCustomer(): void 'billingAddressHtml' => $this->quote->getBillingAddress()->format('html'), 'shippingAddressHtml' => $this->quote->getShippingAddress()->format('html'), ]; + unset($templateVars['dateAndTime']); $this->assertEquals($expectedVars, $templateVars); } diff --git a/dev/tests/integration/testsuite/Magento/Sitemap/Model/ResourceModel/Catalog/ProductTest.php b/dev/tests/integration/testsuite/Magento/Sitemap/Model/ResourceModel/Catalog/ProductTest.php index d6388b188a5fd..7d5e919880d3b 100644 --- a/dev/tests/integration/testsuite/Magento/Sitemap/Model/ResourceModel/Catalog/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/Sitemap/Model/ResourceModel/Catalog/ProductTest.php @@ -52,6 +52,7 @@ public function testGetCollectionNone() * 3) Check thumbnails when no thumbnail selected * * @magentoConfigFixture default_store sitemap/product/image_include all + * @magentoConfigFixture default/web/url/catalog_media_url_format hash */ public function testGetCollectionAll() { @@ -120,6 +121,7 @@ public function testGetCollectionAll() * 3) Check thumbnails when no thumbnail selected * * @magentoConfigFixture default_store sitemap/product/image_include base + * @magentoConfigFixture default/web/url/catalog_media_url_format hash */ public function testGetCollectionBase() { diff --git a/nginx.conf.sample b/nginx.conf.sample index 9219400f6aacd..f045edb46a1c2 100644 --- a/nginx.conf.sample +++ b/nginx.conf.sample @@ -26,6 +26,9 @@ ## ## In production mode, you should uncomment the 'expires' directive in the /static/ location block +# Modules can be loaded only at the very beginning of the Nginx config file, please move the line below to the main config file +# load_module /etc/nginx/modules/ngx_http_image_filter_module.so; + root $MAGE_ROOT/pub; index index.php; @@ -134,6 +137,28 @@ location /static/ { } location /media/ { + +## The following section allows to offload image resizing from Magento instance to the Nginx. +## Catalog image URL format should be set accordingly. +## See https://docs.magento.com/m2/ee/user_guide/configuration/general/web.html#url-options +# location ~* ^/media/catalog/.* { +# +# # Replace placeholders and uncomment the line below to serve product images from public S3 +# # See examples of S3 authentication at https://github.com/anomalizer/ngx_aws_auth +# # proxy_pass https://<bucket-name>.<region-name>.amazonaws.com; +# +# set $width "-"; +# set $height "-"; +# if ($arg_width != '') { +# set $width $arg_width; +# } +# if ($arg_height != '') { +# set $height $arg_height; +# } +# image_filter resize $width $height; +# image_filter_jpeg_quality 90; +# } + try_files $uri $uri/ /get.php$is_args$args; location ~ ^/media/theme_customization/.*\.xml { From a7504d71fa23881def23c99b380712e810600365 Mon Sep 17 00:00:00 2001 From: Michele Fantetti <mfantetti@ittweb.net> Date: Wed, 29 Jan 2020 17:32:00 +0100 Subject: [PATCH 1071/1143] Add frontend template hints status command unit tests after suggestions --- .../Developer/Console/Command/TemplateHintsStatusCommand.php | 2 +- .../Unit/Console/Command/TemplateHintsStatusCommandTest.php | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php b/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php index 42e2d214a330c..d6569622d17ce 100644 --- a/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php +++ b/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php @@ -70,7 +70,7 @@ public function execute(InputInterface $input, OutputInterface $output) ? 'enabled' : 'disabled'; $templateHintsMessage = __("Template hints are %status", ['status' => $templateHintsStatus]); - $output->writeln("<info>" . $templateHintsMessage . "</info>"); + $output->writeln("<info>$templateHintsMessage</info>"); return Cli::RETURN_SUCCESS; } diff --git a/app/code/Magento/Developer/Test/Unit/Console/Command/TemplateHintsStatusCommandTest.php b/app/code/Magento/Developer/Test/Unit/Console/Command/TemplateHintsStatusCommandTest.php index f3acb5d2e1f5e..1c7ecaf161003 100644 --- a/app/code/Magento/Developer/Test/Unit/Console/Command/TemplateHintsStatusCommandTest.php +++ b/app/code/Magento/Developer/Test/Unit/Console/Command/TemplateHintsStatusCommandTest.php @@ -25,7 +25,6 @@ class TemplateHintsStatusCommandTest extends TestCase * @var TemplateHintsStatusCommand */ private $command; - /** * @var ScopeConfigInterface */ From e165d99f5994af39d49ed70155c003745158e5db Mon Sep 17 00:00:00 2001 From: Yevhen Sentiabov <sentiabo@adobe.com> Date: Wed, 29 Jan 2020 10:53:49 -0600 Subject: [PATCH 1072/1143] Github #26532: di:setup:compile fails with anonymous classes - Small refactoring for code simplification --- .../Module/Di/Code/Scanner/PhpScanner.php | 47 ++++++++++--------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/setup/src/Magento/Setup/Module/Di/Code/Scanner/PhpScanner.php b/setup/src/Magento/Setup/Module/Di/Code/Scanner/PhpScanner.php index be25cf605ef80..c7aa6fc6eb0c3 100644 --- a/setup/src/Magento/Setup/Module/Di/Code/Scanner/PhpScanner.php +++ b/setup/src/Magento/Setup/Module/Di/Code/Scanner/PhpScanner.php @@ -10,8 +10,8 @@ use Magento\Framework\Api\Code\Generator\ExtensionAttributesGenerator; use Magento\Framework\Api\Code\Generator\ExtensionAttributesInterfaceGenerator; use Magento\Framework\ObjectManager\Code\Generator\Factory as FactoryGenerator; +use Magento\Framework\Reflection\TypeProcessor; use Magento\Setup\Module\Di\Compiler\Log\Log; -use \Magento\Framework\Reflection\TypeProcessor; /** * Finds factory and extension attributes classes which require auto-generation. @@ -50,7 +50,7 @@ public function __construct(Log $log, TypeProcessor $typeProcessor = null) * @param string $entityType * @return string[] */ - protected function _findMissingClasses($file, $classReflection, $methodName, $entityType) + private function findMissingFactories($file, $classReflection, $methodName, $entityType) { $missingClasses = []; if (!$classReflection->hasMethod($methodName)) { @@ -123,7 +123,7 @@ protected function getSourceClassName($missingClassName, $entityType) */ protected function _fetchFactories($reflectionClass, $file) { - $absentFactories = $this->_findMissingClasses( + $absentFactories = $this->findMissingFactories( $file, $reflectionClass, '__construct', @@ -177,11 +177,11 @@ public function collectEntities(array $files) { $output = [[]]; foreach ($files as $file) { - $classes = $this->_getDeclaredClasses($file); + $classes = $this->getDeclaredClasses($file); foreach ($classes as $className) { $reflectionClass = new \ReflectionClass($className); - $output [] = $this->_fetchFactories($reflectionClass, $file); - $output [] = $this->_fetchMissingExtensionAttributesClasses($reflectionClass, $file); + $output[] = $this->_fetchFactories($reflectionClass, $file); + $output[] = $this->_fetchMissingExtensionAttributesClasses($reflectionClass, $file); } } return array_unique(array_merge(...$output)); @@ -210,32 +210,30 @@ protected function _fetchNamespace($tokenIterator, $count, $tokens) } /** - * Fetch class names from tokenized PHP file + * Fetches class name from tokenized PHP file. * * @param string $namespace * @param int $tokenIterator * @param int $count * @param array $tokens - * @return array + * @return string|null */ - protected function _fetchClasses($namespace, $tokenIterator, $count, $tokens) + private function fetchClass($namespace, $tokenIterator, $count, $tokens):? string { - $classes = []; + // anonymous classes should be omitted + if (is_array($tokens[$tokenIterator - 2]) && $tokens[$tokenIterator - 2][0] === T_NEW) { + return null; + } + for ($tokenOffset = $tokenIterator + 1; $tokenOffset < $count; ++$tokenOffset) { if ($tokens[$tokenOffset] !== '{') { continue; } - // anonymous classes should be omitted - if (is_array($tokens[$tokenIterator - 2]) && $tokens[$tokenIterator - 2][0] === T_NEW) { - continue; - } - $class = $namespace . "\\" . $tokens[$tokenIterator + 2][1]; - if (!in_array($class, $classes)) { - $classes[] = $class; - } + return $namespace . "\\" . $tokens[$tokenIterator + 2][1]; } - return $classes; + + return null; } /** @@ -244,9 +242,9 @@ protected function _fetchClasses($namespace, $tokenIterator, $count, $tokens) * @param string $file * @return array */ - protected function _getDeclaredClasses($file) + private function getDeclaredClasses($file): array { - $classes = [[]]; + $classes = []; $namespaceParts = []; // phpcs:ignore $tokens = token_get_all(file_get_contents($file)); @@ -260,10 +258,13 @@ protected function _getDeclaredClasses($file) if (($tokens[$tokenIterator][0] == T_CLASS || $tokens[$tokenIterator][0] == T_INTERFACE) && $tokens[$tokenIterator - 1][0] != T_DOUBLE_COLON ) { - $classes[] = $this->_fetchClasses(join('', $namespaceParts), $tokenIterator, $count, $tokens); + $class = $this->fetchClass(join('', $namespaceParts), $tokenIterator, $count, $tokens); + if ($class !== null && !in_array($class, $classes)) { + $classes[] = $class; + } } } - return array_unique(array_merge(...$classes)); + return $classes; } /** From 1000bcd1bfe1380c613b0486e1557e1acec18958 Mon Sep 17 00:00:00 2001 From: Oleh Usik <o.usik@atwix.com> Date: Wed, 29 Jan 2020 19:48:33 +0200 Subject: [PATCH 1073/1143] Fix issue related with UnitTest --- .../Magento/Sales/Block/Status/Grid/Column/State.php | 10 ++++++---- .../Test/Unit/Block/Status/Grid/Column/StateTest.php | 4 +++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Sales/Block/Status/Grid/Column/State.php b/app/code/Magento/Sales/Block/Status/Grid/Column/State.php index 51d9886c79b67..7639bde75898c 100644 --- a/app/code/Magento/Sales/Block/Status/Grid/Column/State.php +++ b/app/code/Magento/Sales/Block/Status/Grid/Column/State.php @@ -57,10 +57,12 @@ public function decorateState($value, $row, $column, $isExport) { $states = $this->_config->getStates(); if (isset($states[$value])) { - $cell = $value . '[' . $states[$value] . ']'; - } else { - $cell = $value; + return sprintf("%s[%s]", + $value, + $states[$value] + ); } - return $cell; + + return $value; } } diff --git a/app/code/Magento/Sales/Test/Unit/Block/Status/Grid/Column/StateTest.php b/app/code/Magento/Sales/Test/Unit/Block/Status/Grid/Column/StateTest.php index 86e0c561ca5ee..76ebeb2487ef3 100644 --- a/app/code/Magento/Sales/Test/Unit/Block/Status/Grid/Column/StateTest.php +++ b/app/code/Magento/Sales/Test/Unit/Block/Status/Grid/Column/StateTest.php @@ -55,6 +55,7 @@ public function testDecorateState() [ 'status' => 'fraud', 'state' => 'processing', + 'is_default' => '0', 'label' => 'Suspected Fraud', ] ), @@ -62,6 +63,7 @@ public function testDecorateState() [ 'status' => 'processing', 'state' => 'processing', + 'is_default' => '1', 'label' => 'Processing', ] ) @@ -78,6 +80,6 @@ public function testDecorateState() ->will($this->returnValue($statuses)); $result = $this->stateColumn->decorateState('processing', $rowMock, $columnMock, false); - $this->assertSame('processing[Suspected Fraud]', $result); + $this->assertSame('processing[Processing]', $result); } } From ae47540b5a1934bf8b47dc56fe65e4bed40191c0 Mon Sep 17 00:00:00 2001 From: Alex Paliarush <paliarus@adobe.com> Date: Wed, 29 Jan 2020 13:32:55 -0600 Subject: [PATCH 1074/1143] ECP-261: Offload Catalog Image Resizing from Magento - Fixed tests - Suppressed excessive coupling warning in Helper/Image because it is an @api class with dependencies in protected properties (cannot be refactored in backward compatible manner) --- app/code/Magento/Catalog/Helper/Image.php | 9 +++++---- .../MediaStorage/Console/Command/ImagesResizeCommand.php | 3 ++- .../Unit/Model/HeaderProvider/UpgradeInsecureTest.php | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Catalog/Helper/Image.php b/app/code/Magento/Catalog/Helper/Image.php index 191f5eee1b5e1..3e0976936329c 100644 --- a/app/code/Magento/Catalog/Helper/Image.php +++ b/app/code/Magento/Catalog/Helper/Image.php @@ -13,10 +13,11 @@ use Magento\Framework\View\Element\Block\ArgumentInterface; /** - * Catalog image helper + * Catalog image helper. * * @api * @SuppressWarnings(PHPMD.TooManyFields) + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @since 100.0.2 */ class Image extends AbstractHelper implements ArgumentInterface @@ -163,8 +164,7 @@ public function __construct( $this->_assetRepo = $assetRepo; $this->viewConfig = $viewConfig; $this->viewAssetPlaceholderFactory = $placeholderFactory - ?: ObjectManager::getInstance() - ->get(PlaceholderFactory::class); + ?: ObjectManager::getInstance()->get(PlaceholderFactory::class); $this->mediaConfig = $mediaConfig ?: ObjectManager::getInstance()->get(CatalogMediaConfig::class); } @@ -394,9 +394,10 @@ public function constrainOnly($flag) */ public function backgroundColor($colorRGB) { + $args = func_get_args(); // assume that 3 params were given instead of array if (!is_array($colorRGB)) { - $colorRGB = func_get_args(); + $colorRGB = $args; } $this->_getModel()->setBackgroundColor($colorRGB); return $this; diff --git a/app/code/Magento/MediaStorage/Console/Command/ImagesResizeCommand.php b/app/code/Magento/MediaStorage/Console/Command/ImagesResizeCommand.php index 7f19ba6c24cfa..d592a004e111a 100644 --- a/app/code/Magento/MediaStorage/Console/Command/ImagesResizeCommand.php +++ b/app/code/Magento/MediaStorage/Console/Command/ImagesResizeCommand.php @@ -86,7 +86,8 @@ protected function configure() $this->setName('catalog:images:resize') ->setDescription( 'Creates resized product images ' . - '(Not relevant when image resizing is offloaded from Magento. See https://docs.magento.com/m2/ee/user_guide/configuration/general/web.html#url-options )' + '(Not relevant when image resizing is offloaded from Magento. ' . + 'See https://docs.magento.com/m2/ee/user_guide/configuration/general/web.html#url-options )' ) ->setDefinition($this->getOptionsList()); } diff --git a/app/code/Magento/Store/Test/Unit/Model/HeaderProvider/UpgradeInsecureTest.php b/app/code/Magento/Store/Test/Unit/Model/HeaderProvider/UpgradeInsecureTest.php index 29b60ed44d5b1..cf85fb633bbca 100644 --- a/app/code/Magento/Store/Test/Unit/Model/HeaderProvider/UpgradeInsecureTest.php +++ b/app/code/Magento/Store/Test/Unit/Model/HeaderProvider/UpgradeInsecureTest.php @@ -19,7 +19,7 @@ class UpgradeInsecureTest extends \PHPUnit\Framework\TestCase /** * Content-Security-Policy header value */ - const HEADER_VALUE = 'upgrade-insecure-requests;'; + const HEADER_VALUE = 'upgrade-insecure-requests'; /** * @var UpgradeInsecure From ad184d23efcea17cd1d5fe84849b38ed9f1b6636 Mon Sep 17 00:00:00 2001 From: Oleh Usik <o.usik@atwix.com> Date: Wed, 29 Jan 2020 21:49:08 +0200 Subject: [PATCH 1075/1143] fix code style issue --- app/code/Magento/Sales/Block/Status/Grid/Column/State.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/Magento/Sales/Block/Status/Grid/Column/State.php b/app/code/Magento/Sales/Block/Status/Grid/Column/State.php index 7639bde75898c..b66587eef5831 100644 --- a/app/code/Magento/Sales/Block/Status/Grid/Column/State.php +++ b/app/code/Magento/Sales/Block/Status/Grid/Column/State.php @@ -59,8 +59,7 @@ public function decorateState($value, $row, $column, $isExport) if (isset($states[$value])) { return sprintf("%s[%s]", $value, - $states[$value] - ); + $states[$value]); } return $value; From 6e2d0c841cb716fefd831fe1667acd2013e00c28 Mon Sep 17 00:00:00 2001 From: Oleh Usik <o.usik@atwix.com> Date: Wed, 29 Jan 2020 22:43:58 +0200 Subject: [PATCH 1076/1143] fixed codeStyle issues --- app/code/Magento/Sales/Block/Status/Grid/Column/State.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Sales/Block/Status/Grid/Column/State.php b/app/code/Magento/Sales/Block/Status/Grid/Column/State.php index b66587eef5831..10f8edb524c34 100644 --- a/app/code/Magento/Sales/Block/Status/Grid/Column/State.php +++ b/app/code/Magento/Sales/Block/Status/Grid/Column/State.php @@ -57,9 +57,11 @@ public function decorateState($value, $row, $column, $isExport) { $states = $this->_config->getStates(); if (isset($states[$value])) { - return sprintf("%s[%s]", + return sprintf( + "%s[%s]", $value, - $states[$value]); + $states[$value] + ); } return $value; From 16a5930c45b118cd1d52e4b50e9b3cc81b4e1c51 Mon Sep 17 00:00:00 2001 From: Mykhailo Matiola <mykhailo.matiola@transoftgroup.com> Date: Thu, 30 Jan 2020 09:35:03 +0200 Subject: [PATCH 1077/1143] MC-30722: Layered Navigation with default product attribute "Price" --- .../_files/category_with_three_products.php | 17 ++ .../category_with_three_products_rollback.php | 9 + .../Block/Navigation/AbstractFiltersTest.php | 5 +- .../Navigation/Category/DecimalFilterTest.php | 19 -- .../Navigation/Category/PriceFilterTest.php | 212 ++++++++++++++++++ .../Navigation/Search/PriceFilterTest.php | 51 +++++ 6 files changed, 293 insertions(+), 20 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/category_with_three_products.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/category_with_three_products_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/PriceFilterTest.php create mode 100644 dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Search/PriceFilterTest.php diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/category_with_three_products.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/category_with_three_products.php new file mode 100644 index 0000000000000..dcb184083529c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/category_with_three_products.php @@ -0,0 +1,17 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\CategoryLinkManagementInterface; +use Magento\TestFramework\Helper\Bootstrap; + +require __DIR__ . '/category_with_different_price_products.php'; +require __DIR__ . '/second_product_simple.php'; + +$objectManager = Bootstrap::getObjectManager(); +/** @var CategoryLinkManagementInterface $categoryLinkManagement */ +$categoryLinkManagement = $objectManager->get(CategoryLinkManagementInterface::class); +$categoryLinkManagement->assignProductToCategories('simple2', [$category->getId()]); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/category_with_three_products_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/category_with_three_products_rollback.php new file mode 100644 index 0000000000000..839f9d74222fa --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/category_with_three_products_rollback.php @@ -0,0 +1,9 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +require __DIR__ . '/second_product_simple_rollback.php'; +require __DIR__ . '/category_with_different_price_products_rollback.php'; diff --git a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/AbstractFiltersTest.php b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/AbstractFiltersTest.php index 54996e2f1b5da..cf39757cb8264 100644 --- a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/AbstractFiltersTest.php +++ b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/AbstractFiltersTest.php @@ -227,8 +227,11 @@ protected function updateProducts( foreach ($products as $productSku => $stringValue) { $product = $this->productRepository->get($productSku, false, $storeId, true); + $productValue = $attribute->usesSource() + ? $attribute->getSource()->getOptionId($stringValue) + : $stringValue; $product->addData( - [$attribute->getAttributeCode() => $attribute->getSource()->getOptionId($stringValue)] + [$attribute->getAttributeCode() => $productValue] ); $this->productRepository->save($product); } diff --git a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/DecimalFilterTest.php b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/DecimalFilterTest.php index eb4148d77b21e..f84cd5ba08259 100644 --- a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/DecimalFilterTest.php +++ b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/DecimalFilterTest.php @@ -71,25 +71,6 @@ protected function prepareFilterItems(AbstractFilter $filter): array return $items; } - /** - * @inheritdoc - */ - protected function updateProducts( - array $products, - string $attributeCode, - int $storeId = Store::DEFAULT_STORE_ID - ): void { - $attribute = $this->attributeRepository->get($attributeCode); - - foreach ($products as $productSku => $value) { - $product = $this->productRepository->get($productSku, false, $storeId, true); - $product->addData( - [$attribute->getAttributeCode() => $value] - ); - $this->productRepository->save($product); - } - } - /** * @return array */ diff --git a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/PriceFilterTest.php b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/PriceFilterTest.php new file mode 100644 index 0000000000000..f380e440d9e09 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/PriceFilterTest.php @@ -0,0 +1,212 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\LayeredNavigation\Block\Navigation\Category; + +use Magento\Catalog\Model\Layer\Resolver; +use Magento\Framework\App\Config\MutableScopeConfigInterface; +use Magento\Framework\App\ScopeInterface; +use Magento\LayeredNavigation\Block\Navigation\AbstractFiltersTest; +use Magento\Catalog\Model\Layer\Filter\AbstractFilter; +use Magento\Catalog\Model\Layer\Filter\Item; +use Magento\Store\Model\ScopeInterface as StoreScope; +use Magento\Store\Model\Store; + +/** + * Provides price filter tests with different price ranges calculation in navigation block on category page. + * + * @magentoAppArea frontend + * @magentoAppIsolation enabled + * @magentoDbIsolation disabled + */ +class PriceFilterTest extends AbstractFiltersTest +{ + /** + * @var MutableScopeConfigInterface + */ + private $scopeConfig; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + $this->scopeConfig = $this->objectManager->get(MutableScopeConfigInterface::class); + } + + /** + * @magentoDataFixture Magento/Catalog/_files/category_with_three_products.php + * @dataProvider getFiltersDataProvider + * @param array $config + * @param array $products + * @param array $expectation + * @return void + */ + public function testGetFilters(array $config, array $products, array $expectation): void + { + $this->applyCatalogConfig($config); + $this->getCategoryFiltersAndAssert( + $products, + ['is_filterable' => AbstractFilter::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS], + $expectation, + 'Category 999' + ); + } + + /** + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + * @return array + */ + public function getFiltersDataProvider(): array + { + return [ + 'auto_calculation_variation_with_small_price_difference' => [ + 'config' => ['catalog/layered_navigation/price_range_calculation' => 'auto'], + 'products_data' => ['simple1000' => 10.00, 'simple1001' => 20.00, 'simple2' => 50.00], + 'expectation' => [ + ['label' => '$10.00 - $19.99', 'value' => '10-20', 'count' => 1], + ['label' => '$20.00 - $29.99', 'value' => '20-30', 'count' => 1], + ['label' => '$50.00 and above', 'value' => '50-', 'count' => 1], + ], + ], + 'auto_calculation_variation_with_big_price_difference' => [ + 'config' => ['catalog/layered_navigation/price_range_calculation' => 'auto'], + 'products_data' => ['simple1000' => 10.00, 'simple1001' => 20.00, 'simple2' => 300.00], + 'expectation' => [ + ['label' => '$0.00 - $99.99', 'value' => '-100', 'count' => 2], + ['label' => '$300.00 and above', 'value' => '300-', 'count' => 1], + ], + ], + 'auto_calculation_variation_with_fixed_price_step' => [ + 'config' => ['catalog/layered_navigation/price_range_calculation' => 'auto'], + 'products_data' => ['simple1000' => 300.00, 'simple1001' => 400.00, 'simple2' => 500.00], + 'expectation' => [ + ['label' => '$300.00 - $399.99', 'value' => '300-400', 'count' => 1], + ['label' => '$400.00 - $499.99', 'value' => '400-500', 'count' => 1], + ['label' => '$500.00 and above', 'value' => '500-', 'count' => 1], + ], + ], + 'improved_calculation_variation_with_small_price_difference' => [ + 'config' => [ + 'catalog/layered_navigation/price_range_calculation' => 'improved', + 'catalog/layered_navigation/interval_division_limit' => 3, + ], + 'products_data' => ['simple1000' => 10.00, 'simple1001' => 20.00, 'simple2' => 50.00], + 'expectation' => [ + ['label' => '$0.00 - $49.99', 'value' => '-50', 'count' => 2], + ['label' => '$50.00 and above', 'value' => '50-', 'count' => 1], + ], + ], + 'improved_calculation_variation_with_big_price_difference' => [ + 'config' => [ + 'catalog/layered_navigation/price_range_calculation' => 'improved', + 'catalog/layered_navigation/interval_division_limit' => 3, + ], + 'products_data' => ['simple1000' => 10.00, 'simple1001' => 20.00, 'simple2' => 300.00], + 'expectation' => [ + ['label' => '$0.00 - $299.99', 'value' => '-300', 'count' => 2.0], + ['label' => '$300.00 and above', 'value' => '300-', 'count' => 1.0], + ], + ], + 'manual_calculation_with_price_step_200' => [ + 'config' => [ + 'catalog/layered_navigation/price_range_calculation' => 'manual', + 'catalog/layered_navigation/price_range_step' => 200, + ], + 'products_data' => ['simple1000' => 300.00, 'simple1001' => 300.00, 'simple2' => 500.00], + 'expectation' => [ + ['label' => '$200.00 - $399.99', 'value' => '200-400', 'count' => 2], + ['label' => '$400.00 and above', 'value' => '400-', 'count' => 1], + ], + ], + 'manual_calculation_with_price_step_10' => [ + 'config' => [ + 'catalog/layered_navigation/price_range_calculation' => 'manual', + 'catalog/layered_navigation/price_range_step' => 10, + ], + 'products_data' => ['simple1000' => 300.00, 'simple1001' => 300.00, 'simple2' => 500.00], + 'expectation' => [ + ['label' => '$300.00 - $309.99', 'value' => '300-310', 'count' => 2], + ['label' => '$500.00 and above', 'value' => '500-', 'count' => 1], + ], + ], + 'manual_calculation_with_number_of_intervals_10' => [ + 'config' => [ + 'catalog/layered_navigation/price_range_calculation' => 'manual', + 'catalog/layered_navigation/price_range_step' => 10, + 'catalog/layered_navigation/price_range_max_intervals' => 10, + ], + 'products_data' => ['simple1000' => 10.00, 'simple1001' => 20.00, 'simple2' => 30.00], + 'expectation' => [ + ['label' => '$10.00 - $19.99', 'value' => '10-20', 'count' => 1], + ['label' => '$20.00 - $29.99', 'value' => '20-30', 'count' => 1], + ['label' => '$30.00 and above', 'value' => '30-', 'count' => 1], + ], + ], + 'manual_calculation_with_number_of_intervals_2' => [ + 'config' => [ + 'catalog/layered_navigation/price_range_calculation' => 'manual', + 'catalog/layered_navigation/price_range_step' => 10, + 'catalog/layered_navigation/price_range_max_intervals' => 2, + ], + 'products_data' => ['simple1000' => 10.00, 'simple1001' => 20.00, 'simple2' => 30.00], + 'expectation' => [ + ['label' => '$10.00 - $19.99', 'value' => '10-20', 'count' => 1], + ['label' => '$20.00 and above', 'value' => '20-', 'count' => 2], + ], + ], + ]; + } + + /** + * @inheritdoc + */ + protected function getLayerType(): string + { + return Resolver::CATALOG_LAYER_CATEGORY; + } + + /** + * @inheritdoc + */ + protected function getAttributeCode(): string + { + return 'price'; + } + + /** + * @inheritdoc + */ + protected function prepareFilterItems(AbstractFilter $filter): array + { + $items = []; + /** @var Item $item */ + foreach ($filter->getItems() as $item) { + $items[] = [ + 'label' => strip_tags(__($item->getData('label'))->render()), + 'value' => $item->getData('value'), + 'count' => $item->getData('count'), + ]; + } + + return $items; + } + + /** + * Updates price filter store configuration. + * + * @param array $config + * @return void + */ + protected function applyCatalogConfig(array $config): void + { + foreach ($config as $path => $value) { + $this->scopeConfig->setValue($path, $value, StoreScope::SCOPE_STORE, ScopeInterface::SCOPE_DEFAULT); + } + } +} diff --git a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Search/PriceFilterTest.php b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Search/PriceFilterTest.php new file mode 100644 index 0000000000000..d9ac02b2bff11 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Search/PriceFilterTest.php @@ -0,0 +1,51 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\LayeredNavigation\Block\Navigation\Search; + +use Magento\Catalog\Model\Layer\Filter\AbstractFilter; +use Magento\Catalog\Model\Layer\Resolver; +use Magento\LayeredNavigation\Block\Navigation\Category\PriceFilterTest as CategoryPriceFilterTest; + +/** + * Provides price filter tests with different price ranges calculation in navigation block on search page. + * + * @magentoAppArea frontend + * @magentoAppIsolation enabled + * @magentoDbIsolation disabled + */ +class PriceFilterTest extends CategoryPriceFilterTest +{ + /** + * @magentoDataFixture Magento/Catalog/_files/category_with_three_products.php + * @dataProvider getFiltersDataProvider + * @param array $config + * @param array $products + * @param array $expectation + * @return void + */ + public function testGetFilters(array $config, array $products, array $expectation): void + { + $this->applyCatalogConfig($config); + $this->getSearchFiltersAndAssert( + $products, + [ + 'is_filterable' => AbstractFilter::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS, + 'is_filterable_in_search' => 1, + ], + $expectation + ); + } + + /** + * @inheritdoc + */ + protected function getLayerType(): string + { + return Resolver::CATALOG_LAYER_SEARCH; + } +} From 8e2959de1740f78ba9a57aa0e21e23ecca79dcc6 Mon Sep 17 00:00:00 2001 From: Jeroen <jeroen@reachdigital.nl> Date: Mon, 2 Dec 2019 12:25:28 +0100 Subject: [PATCH 1078/1143] Prevent endless loop when duplicating product --- .../Magento/Catalog/Model/Product/Copier.php | 81 ++++---- .../Test/Unit/Model/Product/CopierTest.php | 177 +++++++++++++++--- 2 files changed, 185 insertions(+), 73 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Copier.php b/app/code/Magento/Catalog/Model/Product/Copier.php index a7f7bad1a5167..d10bf085a4a25 100644 --- a/app/code/Magento/Catalog/Model/Product/Copier.php +++ b/app/code/Magento/Catalog/Model/Product/Copier.php @@ -8,7 +8,11 @@ use Magento\Catalog\Api\Data\ProductInterface; use Magento\Catalog\Model\Attribute\ScopeOverriddenValue; use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\Product\Option\Repository as OptionRepository; use Magento\Catalog\Model\ProductFactory; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\EntityManager\MetadataPool; +use Magento\UrlRewrite\Model\Exception\UrlAlreadyExistsException; /** * Catalog product copier. @@ -35,9 +39,10 @@ class Copier protected $productFactory; /** - * @var \Magento\Framework\EntityManager\MetadataPool + * @var MetadataPool */ protected $metadataPool; + /** * @var ScopeOverriddenValue */ @@ -47,30 +52,38 @@ class Copier * @param CopyConstructorInterface $copyConstructor * @param ProductFactory $productFactory * @param ScopeOverriddenValue $scopeOverriddenValue + * @param OptionRepository|null $optionRepository + * @param MetadataPool|null $metadataPool */ public function __construct( CopyConstructorInterface $copyConstructor, ProductFactory $productFactory, - ScopeOverriddenValue $scopeOverriddenValue + ScopeOverriddenValue $scopeOverriddenValue, + OptionRepository $optionRepository = null, + MetadataPool $metadataPool = null ) { $this->productFactory = $productFactory; $this->copyConstructor = $copyConstructor; $this->scopeOverriddenValue = $scopeOverriddenValue; + $this->optionRepository = $optionRepository ?: ObjectManager::getInstance()->get(OptionRepository::class); + $this->metadataPool = $metadataPool ?: ObjectManager::getInstance()->get(MetadataPool::class); } /** * Create product duplicate * * @param \Magento\Catalog\Model\Product $product + * * @return \Magento\Catalog\Model\Product + * + * @throws \Exception */ public function copy(Product $product) { $product->getWebsiteIds(); $product->getCategoryIds(); - /** @var \Magento\Framework\EntityManager\EntityMetadataInterface $metadata */ - $metadata = $this->getMetadataPool()->getMetadata(ProductInterface::class); + $metadata = $this->metadataPool->getMetadata(ProductInterface::class); /** @var \Magento\Catalog\Model\Product $duplicate */ $duplicate = $this->productFactory->create(); @@ -88,7 +101,7 @@ public function copy(Product $product) $this->copyConstructor->build($product, $duplicate); $this->setDefaultUrl($product, $duplicate); $this->setStoresUrl($product, $duplicate); - $this->getOptionRepository()->duplicate($product, $duplicate); + $this->optionRepository->duplicate($product, $duplicate); $product->getResource()->duplicate( $product->getData($metadata->getLinkField()), $duplicate->getData($metadata->getLinkField()) @@ -123,13 +136,16 @@ private function setDefaultUrl(Product $product, Product $duplicate) : void * * @param Product $product * @param Product $duplicate + * * @return void + * @throws UrlAlreadyExistsException */ private function setStoresUrl(Product $product, Product $duplicate) : void { $storeIds = $duplicate->getStoreIds(); $productId = $product->getId(); $productResource = $product->getResource(); + $attribute = $productResource->getAttribute('url_key'); $duplicate->setData('save_rewrites_history', false); foreach ($storeIds as $storeId) { $useDefault = !$this->scopeOverriddenValue->containsValue( @@ -141,20 +157,23 @@ private function setStoresUrl(Product $product, Product $duplicate) : void if ($useDefault) { continue; } - $isDuplicateSaved = false; + $duplicate->setStoreId($storeId); $urlKey = $productResource->getAttributeRawValue($productId, 'url_key', $storeId); + $iteration = 0; + do { + if ($iteration === 10) { + throw new UrlAlreadyExistsException(); + } + $urlKey = $this->modifyUrl($urlKey); $duplicate->setUrlKey($urlKey); - $duplicate->setData('url_path', null); - try { - $duplicate->save(); - $isDuplicateSaved = true; - // phpcs:ignore Magento2.CodeAnalysis.EmptyBlock - } catch (\Magento\Framework\Exception\AlreadyExistsException $e) { - } - } while (!$isDuplicateSaved); + $iteration++; + } while (!$attribute->getEntity()->checkAttributeUniqueValue($attribute, $duplicate)); + $duplicate->setData('url_path', null); + $productResource->saveAttribute($duplicate, 'url_path'); + $productResource->saveAttribute($duplicate, 'url_key'); } $duplicate->setStoreId(\Magento\Store\Model\Store::DEFAULT_STORE_ID); } @@ -168,38 +187,8 @@ private function setStoresUrl(Product $product, Product $duplicate) : void private function modifyUrl(string $urlKey) : string { return preg_match('/(.*)-(\d+)$/', $urlKey, $matches) - ? $matches[1] . '-' . ($matches[2] + 1) - : $urlKey . '-1'; - } - - /** - * Returns product option repository. - * - * @return Option\Repository - * @deprecated 101.0.0 - */ - private function getOptionRepository() - { - if (null === $this->optionRepository) { - $this->optionRepository = \Magento\Framework\App\ObjectManager::getInstance() - ->get(\Magento\Catalog\Model\Product\Option\Repository::class); - } - return $this->optionRepository; - } - - /** - * Returns metadata pool. - * - * @return \Magento\Framework\EntityManager\MetadataPool - * @deprecated 101.0.0 - */ - private function getMetadataPool() - { - if (null === $this->metadataPool) { - $this->metadataPool = \Magento\Framework\App\ObjectManager::getInstance() - ->get(\Magento\Framework\EntityManager\MetadataPool::class); - } - return $this->metadataPool; + ? $matches[1] . '-' . ($matches[2] + 1) + : $urlKey . '-1'; } /** diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/CopierTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/CopierTest.php index 809fa0225278c..1d5abd817deb5 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/CopierTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/CopierTest.php @@ -6,7 +6,6 @@ namespace Magento\Catalog\Test\Unit\Model\Product; use Magento\Catalog\Api\Data\ProductInterface; -use Magento\Catalog\Model\Attribute\ScopeOverriddenValue; use Magento\Catalog\Model\Product; use Magento\Catalog\Model\Product\Copier; @@ -40,17 +39,17 @@ class CopierTest extends \PHPUnit\Framework\TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $productMock; + private $scopeOverriddenValueMock; /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $metadata; + protected $productMock; /** - * @var ScopeOverriddenValue|\PHPUnit_Framework_MockObject_MockObject + * @var \PHPUnit_Framework_MockObject_MockObject */ - private $scopeOverriddenValue; + protected $metadata; protected function setUp() { @@ -59,13 +58,14 @@ protected function setUp() \Magento\Catalog\Model\ProductFactory::class, ['create'] ); + $this->scopeOverriddenValueMock = $this->createMock( + \Magento\Catalog\Model\Attribute\ScopeOverriddenValue::class + ); $this->optionRepositoryMock = $this->createMock( \Magento\Catalog\Model\Product\Option\Repository::class ); - $this->optionRepositoryMock; $this->productMock = $this->createMock(Product::class); $this->productMock->expects($this->any())->method('getEntityId')->willReturn(1); - $this->scopeOverriddenValue = $this->createMock(ScopeOverriddenValue::class); $this->metadata = $this->getMockBuilder(\Magento\Framework\EntityManager\EntityMetadata::class) ->disableOriginalConstructor() @@ -74,20 +74,16 @@ protected function setUp() ->disableOriginalConstructor() ->getMock(); $metadataPool->expects($this->any())->method('getMetadata')->willReturn($this->metadata); - $this->_model = new Copier( $this->copyConstructorMock, $this->productFactoryMock, - $this->scopeOverriddenValue + $this->scopeOverriddenValueMock ); - $this->setProperties( - $this->_model, - [ - 'optionRepository' => $this->optionRepositoryMock, - 'metadataPool' => $metadataPool, - ] - ); + $this->setProperties($this->_model, [ + 'optionRepository' => $this->optionRepositoryMock, + 'metadataPool' => $metadataPool + ]); } /** @@ -115,12 +111,10 @@ public function testCopy() ]; $this->productMock->expects($this->atLeastOnce())->method('getWebsiteIds'); $this->productMock->expects($this->atLeastOnce())->method('getCategoryIds'); - $this->productMock->expects($this->any())->method('getData')->willReturnMap( - [ - ['', null, $productData], - ['linkField', null, '1'], - ] - ); + $this->productMock->expects($this->any())->method('getData')->willReturnMap([ + ['', null, $productData], + ['linkField', null, '1'], + ]); $entityMock = $this->getMockForAbstractClass( \Magento\Eav\Model\Entity\AbstractEntity::class, @@ -205,11 +199,9 @@ public function testCopy() $this->metadata->expects($this->any())->method('getLinkField')->willReturn('linkField'); - $duplicateMock->expects($this->any())->method('getData')->willReturnMap( - [ - ['linkField', null, '2'], - ] - ); + $duplicateMock->expects($this->any())->method('getData')->willReturnMap([ + ['linkField', null, '2'], + ]); $this->optionRepositoryMock->expects($this->once()) ->method('duplicate') ->with($this->productMock, $duplicateMock); @@ -218,6 +210,137 @@ public function testCopy() $this->assertEquals($duplicateMock, $this->_model->copy($this->productMock)); } + /** + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function testUrlAlreadyExistsExceptionWhileCopyStoresUrl() + { + $stockItem = $this->getMockBuilder(\Magento\CatalogInventory\Api\Data\StockItemInterface::class) + ->getMock(); + $extensionAttributes = $this->getMockBuilder(\Magento\Catalog\Api\Data\ProductExtension::class) + ->setMethods(['getStockItem', 'setData']) + ->getMock(); + $extensionAttributes + ->expects($this->once()) + ->method('getStockItem') + ->willReturn($stockItem); + $extensionAttributes + ->expects($this->once()) + ->method('setData') + ->with('stock_item', null); + + $productData = [ + 'product data' => ['product data'], + ProductInterface::EXTENSION_ATTRIBUTES_KEY => $extensionAttributes, + ]; + $this->productMock->expects($this->atLeastOnce())->method('getWebsiteIds'); + $this->productMock->expects($this->atLeastOnce())->method('getCategoryIds'); + $this->productMock->expects($this->any())->method('getData')->willReturnMap([ + ['', null, $productData], + ['linkField', null, '1'], + ]); + + $entityMock = $this->getMockForAbstractClass( + \Magento\Eav\Model\Entity\AbstractEntity::class, + [], + '', + false, + true, + true, + ['checkAttributeUniqueValue'] + ); + $entityMock->expects($this->exactly(11)) + ->method('checkAttributeUniqueValue') + ->willReturn(true, false); + + $attributeMock = $this->getMockForAbstractClass( + \Magento\Eav\Model\Entity\Attribute\AbstractAttribute::class, + [], + '', + false, + true, + true, + ['getEntity'] + ); + $attributeMock->expects($this->any()) + ->method('getEntity') + ->willReturn($entityMock); + + $resourceMock = $this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Product::class) + ->disableOriginalConstructor() + ->setMethods(['getAttributeRawValue', 'duplicate', 'getAttribute']) + ->getMock(); + $resourceMock->expects($this->any()) + ->method('getAttributeRawValue') + ->willReturn('urk-key-1'); + $resourceMock->expects($this->any()) + ->method('getAttribute') + ->willReturn($attributeMock); + + $this->productMock->expects($this->any())->method('getResource')->will($this->returnValue($resourceMock)); + + $duplicateMock = $this->createPartialMock( + Product::class, + [ + '__wakeup', + 'setData', + 'setOptions', + 'getData', + 'setIsDuplicate', + 'setOriginalLinkId', + 'setStatus', + 'setCreatedAt', + 'setUpdatedAt', + 'setId', + 'getEntityId', + 'save', + 'setUrlKey', + 'setStoreId', + 'getStoreIds', + ] + ); + $this->productFactoryMock->expects($this->once())->method('create')->will($this->returnValue($duplicateMock)); + + $duplicateMock->expects($this->once())->method('setOptions')->with([]); + $duplicateMock->expects($this->once())->method('setIsDuplicate')->with(true); + $duplicateMock->expects($this->once())->method('setOriginalLinkId')->with(1); + $duplicateMock->expects( + $this->once() + )->method( + 'setStatus' + )->with( + \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_DISABLED + ); + $duplicateMock->expects($this->atLeastOnce())->method('setStoreId'); + $duplicateMock->expects($this->once())->method('setCreatedAt')->with(null); + $duplicateMock->expects($this->once())->method('setUpdatedAt')->with(null); + $duplicateMock->expects($this->once())->method('setId')->with(null); + $duplicateMock->expects($this->atLeastOnce())->method('getStoreIds')->willReturn([1]); + $duplicateMock->expects($this->atLeastOnce())->method('setData')->willReturn($duplicateMock); + $this->copyConstructorMock->expects($this->once())->method('build')->with($this->productMock, $duplicateMock); + $duplicateMock->expects( + $this->exactly(11) + )->method( + 'setUrlKey' + )->with( + $this->stringContains('urk-key-') + )->willReturn( + $duplicateMock + ); + $duplicateMock->expects($this->once())->method('save'); + + $this->scopeOverriddenValueMock->expects($this->once())->method('containsValue')->willReturn(true); + + $this->metadata->expects($this->any())->method('getLinkField')->willReturn('linkField'); + + $duplicateMock->expects($this->any())->method('getData')->willReturnMap([ + ['linkField', null, '2'], + ]); + + $this->expectException(\Magento\UrlRewrite\Model\Exception\UrlAlreadyExistsException::class); + $this->_model->copy($this->productMock); + } + /** * @param $object * @param array $properties From 0cc7d3d3d243f09b99dce4bf49dc8e43a16ab68c Mon Sep 17 00:00:00 2001 From: Mykhailo Matiola <mykhailo.matiola@transoftgroup.com> Date: Thu, 30 Jan 2020 10:42:44 +0200 Subject: [PATCH 1079/1143] MC-30722: Layered Navigation with default product attribute "Price" --- .../_files/category_with_three_products.php | 25 +++++++++++++------ .../category_with_three_products_rollback.php | 21 +++++++++++++++- .../Navigation/Category/PriceFilterTest.php | 18 ++++++------- 3 files changed, 47 insertions(+), 17 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/category_with_three_products.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/category_with_three_products.php index dcb184083529c..b29c17e392ed9 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/category_with_three_products.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/category_with_three_products.php @@ -5,13 +5,24 @@ */ declare(strict_types=1); -use Magento\Catalog\Api\CategoryLinkManagementInterface; -use Magento\TestFramework\Helper\Bootstrap; +use Magento\Catalog\Model\Product\Visibility; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Catalog\Model\Product\Type; +use Magento\Store\Model\Store; require __DIR__ . '/category_with_different_price_products.php'; -require __DIR__ . '/second_product_simple.php'; -$objectManager = Bootstrap::getObjectManager(); -/** @var CategoryLinkManagementInterface $categoryLinkManagement */ -$categoryLinkManagement = $objectManager->get(CategoryLinkManagementInterface::class); -$categoryLinkManagement->assignProductToCategories('simple2', [$category->getId()]); +$product = $productFactory->create(); +$product->setTypeId(Type::TYPE_SIMPLE) + ->setAttributeSetId(4) + ->setStoreId(Store::DEFAULT_STORE_ID) + ->setWebsiteIds([1]) + ->setName('Simple Product2') + ->setSku('simple1002') + ->setPrice(10) + ->setWeight(1) + ->setStockData(['use_config_manage_stock' => 0]) + ->setCategoryIds([$category->getId()]) + ->setVisibility(Visibility::VISIBILITY_BOTH) + ->setStatus(Status::STATUS_ENABLED); +$productRepository->save($product); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/category_with_three_products_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/category_with_three_products_rollback.php index 839f9d74222fa..a90b9e732e827 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/category_with_three_products_rollback.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/category_with_three_products_rollback.php @@ -5,5 +5,24 @@ */ declare(strict_types=1); -require __DIR__ . '/second_product_simple_rollback.php'; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Registry; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +$registry = $objectManager->get(Registry::class); +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); + +$productRepository = $objectManager->get(ProductRepositoryInterface::class); +try { + $productRepository->deleteById('simple1002'); +} catch (NoSuchEntityException $e) { + //Already deleted. +} + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); + require __DIR__ . '/category_with_different_price_products_rollback.php'; diff --git a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/PriceFilterTest.php b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/PriceFilterTest.php index f380e440d9e09..a82b4bf0fd00d 100644 --- a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/PriceFilterTest.php +++ b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/PriceFilterTest.php @@ -67,7 +67,7 @@ public function getFiltersDataProvider(): array return [ 'auto_calculation_variation_with_small_price_difference' => [ 'config' => ['catalog/layered_navigation/price_range_calculation' => 'auto'], - 'products_data' => ['simple1000' => 10.00, 'simple1001' => 20.00, 'simple2' => 50.00], + 'products_data' => ['simple1000' => 10.00, 'simple1001' => 20.00, 'simple1002' => 50.00], 'expectation' => [ ['label' => '$10.00 - $19.99', 'value' => '10-20', 'count' => 1], ['label' => '$20.00 - $29.99', 'value' => '20-30', 'count' => 1], @@ -76,7 +76,7 @@ public function getFiltersDataProvider(): array ], 'auto_calculation_variation_with_big_price_difference' => [ 'config' => ['catalog/layered_navigation/price_range_calculation' => 'auto'], - 'products_data' => ['simple1000' => 10.00, 'simple1001' => 20.00, 'simple2' => 300.00], + 'products_data' => ['simple1000' => 10.00, 'simple1001' => 20.00, 'simple1002' => 300.00], 'expectation' => [ ['label' => '$0.00 - $99.99', 'value' => '-100', 'count' => 2], ['label' => '$300.00 and above', 'value' => '300-', 'count' => 1], @@ -84,7 +84,7 @@ public function getFiltersDataProvider(): array ], 'auto_calculation_variation_with_fixed_price_step' => [ 'config' => ['catalog/layered_navigation/price_range_calculation' => 'auto'], - 'products_data' => ['simple1000' => 300.00, 'simple1001' => 400.00, 'simple2' => 500.00], + 'products_data' => ['simple1000' => 300.00, 'simple1001' => 400.00, 'simple1002' => 500.00], 'expectation' => [ ['label' => '$300.00 - $399.99', 'value' => '300-400', 'count' => 1], ['label' => '$400.00 - $499.99', 'value' => '400-500', 'count' => 1], @@ -96,7 +96,7 @@ public function getFiltersDataProvider(): array 'catalog/layered_navigation/price_range_calculation' => 'improved', 'catalog/layered_navigation/interval_division_limit' => 3, ], - 'products_data' => ['simple1000' => 10.00, 'simple1001' => 20.00, 'simple2' => 50.00], + 'products_data' => ['simple1000' => 10.00, 'simple1001' => 20.00, 'simple1002' => 50.00], 'expectation' => [ ['label' => '$0.00 - $49.99', 'value' => '-50', 'count' => 2], ['label' => '$50.00 and above', 'value' => '50-', 'count' => 1], @@ -107,7 +107,7 @@ public function getFiltersDataProvider(): array 'catalog/layered_navigation/price_range_calculation' => 'improved', 'catalog/layered_navigation/interval_division_limit' => 3, ], - 'products_data' => ['simple1000' => 10.00, 'simple1001' => 20.00, 'simple2' => 300.00], + 'products_data' => ['simple1000' => 10.00, 'simple1001' => 20.00, 'simple1002' => 300.00], 'expectation' => [ ['label' => '$0.00 - $299.99', 'value' => '-300', 'count' => 2.0], ['label' => '$300.00 and above', 'value' => '300-', 'count' => 1.0], @@ -118,7 +118,7 @@ public function getFiltersDataProvider(): array 'catalog/layered_navigation/price_range_calculation' => 'manual', 'catalog/layered_navigation/price_range_step' => 200, ], - 'products_data' => ['simple1000' => 300.00, 'simple1001' => 300.00, 'simple2' => 500.00], + 'products_data' => ['simple1000' => 300.00, 'simple1001' => 300.00, 'simple1002' => 500.00], 'expectation' => [ ['label' => '$200.00 - $399.99', 'value' => '200-400', 'count' => 2], ['label' => '$400.00 and above', 'value' => '400-', 'count' => 1], @@ -129,7 +129,7 @@ public function getFiltersDataProvider(): array 'catalog/layered_navigation/price_range_calculation' => 'manual', 'catalog/layered_navigation/price_range_step' => 10, ], - 'products_data' => ['simple1000' => 300.00, 'simple1001' => 300.00, 'simple2' => 500.00], + 'products_data' => ['simple1000' => 300.00, 'simple1001' => 300.00, 'simple1002' => 500.00], 'expectation' => [ ['label' => '$300.00 - $309.99', 'value' => '300-310', 'count' => 2], ['label' => '$500.00 and above', 'value' => '500-', 'count' => 1], @@ -141,7 +141,7 @@ public function getFiltersDataProvider(): array 'catalog/layered_navigation/price_range_step' => 10, 'catalog/layered_navigation/price_range_max_intervals' => 10, ], - 'products_data' => ['simple1000' => 10.00, 'simple1001' => 20.00, 'simple2' => 30.00], + 'products_data' => ['simple1000' => 10.00, 'simple1001' => 20.00, 'simple1002' => 30.00], 'expectation' => [ ['label' => '$10.00 - $19.99', 'value' => '10-20', 'count' => 1], ['label' => '$20.00 - $29.99', 'value' => '20-30', 'count' => 1], @@ -154,7 +154,7 @@ public function getFiltersDataProvider(): array 'catalog/layered_navigation/price_range_step' => 10, 'catalog/layered_navigation/price_range_max_intervals' => 2, ], - 'products_data' => ['simple1000' => 10.00, 'simple1001' => 20.00, 'simple2' => 30.00], + 'products_data' => ['simple1000' => 10.00, 'simple1001' => 20.00, 'simple1002' => 30.00], 'expectation' => [ ['label' => '$10.00 - $19.99', 'value' => '10-20', 'count' => 1], ['label' => '$20.00 and above', 'value' => '20-', 'count' => 2], From 5474b5f90a853378ac673f296047da09a0e510d5 Mon Sep 17 00:00:00 2001 From: Oleh Usik <o.usik@atwix.com> Date: Thu, 30 Jan 2020 11:33:52 +0200 Subject: [PATCH 1080/1143] Rewrite methods which was removed in first commit --- app/code/Magento/Sales/Model/Order/Config.php | 19 +++++++++++ .../Test/Unit/Model/Order/ConfigTest.php | 32 +++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/app/code/Magento/Sales/Model/Order/Config.php b/app/code/Magento/Sales/Model/Order/Config.php index 7dbddcd0a16c4..92681f3ecf181 100644 --- a/app/code/Magento/Sales/Model/Order/Config.php +++ b/app/code/Magento/Sales/Model/Order/Config.php @@ -300,4 +300,23 @@ protected function _getStatuses($visibility) } return $this->statuses[(bool) $visibility]; } + + /** + * Retrieve label by state and status + * + * @param string $state + * @param string $status + * @return \Magento\Framework\Phrase|string + * @since 100.2.0 + */ + public function getStateLabelByStateAndStatus($state, $status) + { + foreach ($this->_getCollection() as $item) { + if ($item->getData('state') == $state && $item->getData('status') == $status) { + $label = $item->getData('label'); + return __($label); + } + } + return $state; + } } diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/ConfigTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/ConfigTest.php index 2dcc3c2a9fd24..0bd20150cd450 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/ConfigTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/ConfigTest.php @@ -116,6 +116,38 @@ public function testGetInvisibleOnFrontStatuses() $this->assertSame($expectedResult, $result); } + /** + * @return void + */ + public function testGetStateLabelByStateAndStatus() + { + $statuses = [ + new DataObject( + [ + 'status' => 'fraud', + 'state' => 'processing', + 'label' => 'Suspected Fraud', + ] + ), + new DataObject( + [ + 'status' => 'processing', + 'state' => 'processing', + 'label' => 'Processing', + ] + ) + ]; + $collectionMock = $this->createPartialMock(Collection::class, ['create', 'joinStates']); + $this->orderStatusCollectionFactoryMock->expects($this->once()) + ->method('create') + ->will($this->returnValue($collectionMock)); + $collectionMock->expects($this->once()) + ->method('joinStates') + ->will($this->returnValue($statuses)); + $result = $this->salesConfig->getStateLabelByStateAndStatus('processing', 'fraud'); + $this->assertSame('Suspected Fraud', $result->getText()); + } + /** * Test get statuses * From 581ac89489128c3a0bcc4f8558413fbe8a4a43f8 Mon Sep 17 00:00:00 2001 From: "rostyslav.hymon" <rostyslav.hymon@transoftgroup.com> Date: Thu, 30 Jan 2020 12:52:47 +0200 Subject: [PATCH 1081/1143] MC-23940: Removing websites or stores together with their configuration from config.php fails --- .../Model/Config/Importer/SaveProcessor.php | 11 ++++--- .../Config/Importer/SaveProcessorTest.php | 33 +++++++++++++++++++ 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Config/Model/Config/Importer/SaveProcessor.php b/app/code/Magento/Config/Model/Config/Importer/SaveProcessor.php index 2ea9df52c0a03..225729f69a74e 100644 --- a/app/code/Magento/Config/Model/Config/Importer/SaveProcessor.php +++ b/app/code/Magento/Config/Model/Config/Importer/SaveProcessor.php @@ -91,6 +91,7 @@ public function process(array $data) * @param string $scope The configuration scope (default, website, or store) * @param string $scopeCode The scope code * @return void + * @throws \Magento\Framework\Exception\RuntimeException */ private function invokeSave(array $scopeData, $scope, $scopeCode = null) { @@ -98,11 +99,13 @@ private function invokeSave(array $scopeData, $scope, $scopeCode = null) foreach ($scopeData as $path) { $value = $this->scopeConfig->getValue($path, $scope, $scopeCode); - $backendModel = $this->valueFactory->create($path, $value, $scope, $scopeCode); + if ($value !== null) { + $backendModel = $this->valueFactory->create($path, $value, $scope, $scopeCode); - if ($backendModel instanceof Value) { - $backendModel->beforeSave(); - $backendModel->afterSave(); + if ($backendModel instanceof Value) { + $backendModel->beforeSave(); + $backendModel->afterSave(); + } } } } diff --git a/app/code/Magento/Config/Test/Unit/Model/Config/Importer/SaveProcessorTest.php b/app/code/Magento/Config/Test/Unit/Model/Config/Importer/SaveProcessorTest.php index aec3a6f64fec0..39a0e14f3e91c 100644 --- a/app/code/Magento/Config/Test/Unit/Model/Config/Importer/SaveProcessorTest.php +++ b/app/code/Magento/Config/Test/Unit/Model/Config/Importer/SaveProcessorTest.php @@ -136,4 +136,37 @@ public function testProcess() $this->assertSame(null, $this->model->process($data)); } + + public function testProcessWithNullValues() + { + $data = [ + 'default' => [ + 'advanced' => ['modules_disable_output' => ['Test_Module' => '1']] + ], + 'websites' => ['test_website' => ['general' => ['locale' => ['timezone' => 'America/Rio_Branco']]]], + ]; + $this->arrayUtilsMock->expects($this->exactly(2)) + ->method('flatten') + ->willReturnMap([ + [ + [ + 'advanced' => ['modules_disable_output' => ['Test_Module' => '1']] + ], + '', + '/', + ['advanced/modules_disable_output/Test_Module' => '1'] + ], + [ + ['general' => ['locale' => ['timezone' => 'America/Rio_Branco']]], + '', + '/', + ['general/locale/timezone' => 'America/Rio_Branco'] + ] + ]); + $this->scopeConfigMock->expects($this->exactly(2)) + ->method('getValue') + ->willReturn(null); + + $this->assertSame(null, $this->model->process($data)); + } } From 700dbafdce11bd7dd023972bc6f31bae7a8f97d7 Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Thu, 30 Jan 2020 15:07:22 +0200 Subject: [PATCH 1082/1143] MC-30639: PayPal's Payment Review orders status change to Processing on payment update failure --- app/code/Magento/Paypal/Model/Ipn.php | 29 ++++-- .../Magento/Paypal/Model/IpnTest.php | 61 ++++++++++++- .../Magento/Paypal/_files/ipn_failed.php | 17 ++++ ...er_express_with_invoice_payment_review.php | 88 +++++++++++++++++++ 4 files changed, 185 insertions(+), 10 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Paypal/_files/ipn_failed.php create mode 100644 dev/tests/integration/testsuite/Magento/Paypal/_files/order_express_with_invoice_payment_review.php diff --git a/app/code/Magento/Paypal/Model/Ipn.php b/app/code/Magento/Paypal/Model/Ipn.php index 9107762c54b69..0d7d5518f9c7d 100644 --- a/app/code/Magento/Paypal/Model/Ipn.php +++ b/app/code/Magento/Paypal/Model/Ipn.php @@ -106,6 +106,7 @@ protected function _getConfig() $parameters = ['params' => [$methodCode, $order->getStoreId()]]; $this->_config = $this->_configFactory->create($parameters); if (!$this->_config->isMethodActive($methodCode) || !$this->_config->isMethodAvailable()) { + // phpcs:ignore Magento2.Exceptions.DirectThrow throw new Exception(sprintf('The "%s" method isn\'t available.', $methodCode)); } /** @link https://cms.paypal.com/cgi-bin/marketingweb?cmd=_render-content&content_ID= @@ -117,6 +118,7 @@ protected function _getConfig() } $receiver = $this->getRequestData('business') ?: $this->getRequestData('receiver_email'); if (strtolower($merchantEmail) != strtolower($receiver)) { + // phpcs:ignore Magento2.Exceptions.DirectThrow throw new Exception( sprintf( 'The requested "%s" and the configured "%s" merchant emails don\'t match.', @@ -140,6 +142,7 @@ protected function _getOrder() $incrementId = $this->getRequestData('invoice'); $this->_order = $this->_orderFactory->create()->loadByIncrementId($incrementId); if (!$this->_order->getId()) { + // phpcs:ignore Magento2.Exceptions.DirectThrow throw new Exception(sprintf('The "%s" order ID is incorrect. Verify the ID and try again.', $incrementId)); } return $this->_order; @@ -245,8 +248,11 @@ protected function _registerTransaction() break; // customer attempted to pay via bank account, but failed case Info::PAYMENTSTATUS_FAILED: - // cancel order - $this->_registerPaymentFailure(); + if ($this->_order->getState() === \Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW) { + $this->_registerPaymentDenial(); + } else { + $this->_registerPaymentFailure(); + } break; // payment was obtained, but money were not captured yet case Info::PAYMENTSTATUS_PENDING: @@ -270,6 +276,7 @@ protected function _registerTransaction() $this->_registerPaymentVoid(); break; default: + // phpcs:ignore Magento2.Exceptions.DirectThrow throw new Exception("The '{$paymentStatus}' payment status couldn't be handled."); } } @@ -322,11 +329,12 @@ protected function _registerPaymentDenial() { try { $this->_importPaymentInformation(); - $this->_order->getPayment() - ->setTransactionId($this->getRequestData('txn_id')) - ->setNotificationResult(true) - ->setIsTransactionClosed(true) - ->deny(false); + $payment = $this->_order->getPayment(); + $payment->setTransactionId($this->getRequestData('txn_id')); + $payment->setPreparedMessage($this->_createIpnComment('')); + $payment->setNotificationResult(true); + $payment->setIsTransactionClosed(true); + $payment->deny(false); $this->_order->save(); } catch (LocalizedException $e) { if ($e->getMessage() != __('We cannot cancel this order.')) { @@ -360,6 +368,7 @@ public function _registerPaymentPending() return; } if ('order' === $reason) { + // phpcs:ignore Magento2.Exceptions.DirectThrow throw new Exception('The "order" authorizations aren\'t implemented.'); } // case when was placed using PayPal standard @@ -501,6 +510,7 @@ protected function _registerPaymentVoid() /** * Map payment information from IPN to payment object + * * Returns true if there were changes in information * * @return bool @@ -537,8 +547,10 @@ protected function _importPaymentInformation() // collect fraud filters $fraudFilters = []; - for ($i = 1; $value = $this->getRequestData("fraud_management_pending_filters_{$i}"); $i++) { + $index = 1; + while ($value = $this->getRequestData("fraud_management_pending_filters_{$index}")) { $fraudFilters[] = $value; + $index++; } if ($fraudFilters) { $from[Info::FRAUD_FILTERS] = $fraudFilters; @@ -568,6 +580,7 @@ protected function _importPaymentInformation() /** * Generate an "IPN" comment with additional explanation. + * * Returns the generated comment or order status history object * * @param string $comment diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Model/IpnTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Model/IpnTest.php index 1a22ea947f85a..1877e1faaec67 100644 --- a/dev/tests/integration/testsuite/Magento/Paypal/Model/IpnTest.php +++ b/dev/tests/integration/testsuite/Magento/Paypal/Model/IpnTest.php @@ -5,10 +5,13 @@ */ namespace Magento\Paypal\Model; -use Magento\Paypal\Model\IpnFactory; +use Magento\Framework\Api\SearchCriteriaBuilder; use Magento\Sales\Api\Data\OrderInterface; +use Magento\Sales\Api\OrderRepositoryInterface; use Magento\Sales\Model\Order; use Magento\Sales\Model\Order\Creditmemo; +use Magento\Sales\Model\Order\Invoice; +use Magento\TestFramework\Helper\Bootstrap; /** * @magentoAppArea frontend @@ -22,7 +25,7 @@ class IpnTest extends \PHPUnit\Framework\TestCase protected function setUp() { - $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->_objectManager = Bootstrap::getObjectManager(); } /** @@ -158,6 +161,39 @@ public function testProcessIpnRequestRestRefund() $this->assertEmpty($order->getTotalOfflineRefunded()); } + /** + * Verifies canceling an order that was in payment review state by PayPal Express IPN message service. + * + * @magentoDataFixture Magento/Paypal/_files/order_express_with_invoice_payment_review.php + * @magentoConfigFixture current_store payment/paypal_express/active 1 + * @magentoConfigFixture current_store paypal/general/merchant_country US + */ + public function testProcessIpnRequestWithFailedStatus() + { + $ipnData = require __DIR__ . '/../_files/ipn_failed.php'; + + /** @var IpnFactory $ipnFactory */ + $ipnFactory = $this->_objectManager->create(IpnFactory::class); + $ipnModel = $ipnFactory->create( + [ + 'data' => $ipnData, + 'curlFactory' => $this->_createMockedHttpAdapter() + ] + ); + + $ipnModel->processIpnRequest(); + + $order = $this->getOrder($ipnData['invoice']); + $invoiceItems = $order->getInvoiceCollection() + ->getItems(); + /** @var Invoice $invoice */ + $invoice = array_pop($invoiceItems); + $invoice->getState(); + + $this->assertEquals(Order::STATE_CANCELED, $order->getState()); + $this->assertEquals(Invoice::STATE_CANCELED, $invoice->getState()); + } + /** * Test processIpnRequest() currency check for paypal_express and paypal_standard payment methods * @@ -224,4 +260,25 @@ protected function _createMockedHttpAdapter() $factory->expects($this->once())->method('create')->with()->will($this->returnValue($adapter)); return $factory; } + + /** + * Get stored order. + * + * @param string $incrementId + * @return OrderInterface + */ + private function getOrder(string $incrementId) + { + /** @var SearchCriteriaBuilder $searchCriteriaBuilder */ + $searchCriteriaBuilder = $this->_objectManager->get(SearchCriteriaBuilder::class); + $searchCriteria = $searchCriteriaBuilder->addFilter(OrderInterface::INCREMENT_ID, $incrementId) + ->create(); + + $orderRepository = $this->_objectManager->get(OrderRepositoryInterface::class); + $orders = $orderRepository->getList($searchCriteria) + ->getItems(); + + /** @var OrderInterface $order */ + return array_pop($orders); + } } diff --git a/dev/tests/integration/testsuite/Magento/Paypal/_files/ipn_failed.php b/dev/tests/integration/testsuite/Magento/Paypal/_files/ipn_failed.php new file mode 100644 index 0000000000000..cf1822c9a1a52 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Paypal/_files/ipn_failed.php @@ -0,0 +1,17 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +return [ + 'invoice' => '100000002', + 'payment_status' => 'Failed', + 'receiver_email' => 'merchant_2012050718_biz@example.com', + 'parent_txn_id' => '84J11393WC835693U', + 'payer_status' => 'verified', + 'payment_type' => 'instant', + 'txn_id' => '1P566839F9694230H', + 'txn_type' => 'cart' +]; diff --git a/dev/tests/integration/testsuite/Magento/Paypal/_files/order_express_with_invoice_payment_review.php b/dev/tests/integration/testsuite/Magento/Paypal/_files/order_express_with_invoice_payment_review.php new file mode 100644 index 0000000000000..eb6654b274ba7 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Paypal/_files/order_express_with_invoice_payment_review.php @@ -0,0 +1,88 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Framework\DB\Transaction; +use Magento\Paypal\Model\Config; +use Magento\Sales\Api\InvoiceManagementInterface; +use Magento\Sales\Api\OrderRepositoryInterface; +use Magento\Sales\Model\Order; +use Magento\Sales\Model\Order\Item; +use Magento\Sales\Model\Order\Address; +use Magento\Sales\Model\Order\Payment; +use Magento\Sales\Model\Service\InvoiceService; +use Magento\TestFramework\Helper\Bootstrap; + +require __DIR__ . '/../../../Magento/Catalog/_files/product_simple.php'; + +$objectManager = Bootstrap::getObjectManager(); + +$addressData = include __DIR__ . '/address_data.php'; +$billingAddress = $objectManager->create( + Address::class, + ['data' => $addressData] +); +$billingAddress->setAddressType('billing'); +$shippingAddress = clone $billingAddress; +$shippingAddress->setId(null)->setAddressType('shipping'); + +$payment = $objectManager->create(Payment::class); +$payment->setMethod(Config::METHOD_WPP_EXPRESS); + +/** @var Item $orderItem */ +$orderItem = $objectManager->create(Item::class); +$orderItem->setProductId($product->getId())->setQtyOrdered(1); +$orderItem->setBasePrice($product->getPrice()); +$orderItem->setPrice($product->getPrice()); +$orderItem->setRowTotal($product->getPrice()); +$orderItem->setRowTotalInclTax($product->getPrice()); +$orderItem->setBaseRowTotal($product->getPrice()); +$orderItem->setBaseRowTotalInclTax($product->getPrice()); +$orderItem->setBaseRowInvoiced($product->getPrice()); +$orderItem->setProductType('simple'); + +$itemsAmount = $product->getPrice(); +$shippingAmount = 20; +$totalAmount = $itemsAmount + $shippingAmount; + +/** @var Order $order */ +$order = $objectManager->create(Order::class); +$order->setCustomerEmail('co@co.co') + ->setIncrementId('100000002') + ->addItem($orderItem) + ->setSubtotal($itemsAmount) + ->setBaseSubtotal($itemsAmount) + ->setBaseGrandTotal($totalAmount) + ->setGrandTotal($totalAmount) + ->setBaseCurrencyCode('USD') + ->setCustomerIsGuest(true) + ->setStoreId(1) + ->setEmailSent(true) + ->setState(Order::STATE_PAYMENT_REVIEW) + ->setBillingAddress($billingAddress) + ->setShippingAddress($shippingAddress) + ->setBaseTotalPaid($totalAmount) + ->setTotalPaid($totalAmount) + ->setData('base_to_global_rate', 1) + ->setData('base_to_order_rate', 1) + ->setData('shipping_amount', $shippingAmount) + ->setData('base_shipping_amount', $shippingAmount) + ->setPayment($payment); + +/** @var OrderRepositoryInterface $orderRepository */ +$orderRepository = $objectManager->get(OrderRepositoryInterface::class); +$orderRepository->save($order); + +/** @var InvoiceService $invoiceService */ +$invoiceService = $objectManager->create(InvoiceManagementInterface::class); + +/** @var Transaction $transaction */ +$transaction = $objectManager->create(Transaction::class); + +$invoice = $invoiceService->prepareInvoice($order, [$orderItem->getId() => 1]); +$invoice->register(); + +$transaction->addObject($invoice)->addObject($order)->save(); From 0173e341fd66a8c58c25da2396f7678109a585da Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Thu, 30 Jan 2020 16:34:57 +0200 Subject: [PATCH 1083/1143] Cover changes with integration test --- .../Block/Adminhtml/Edit/Tab/CartTest.php | 92 +++++++++++++++++-- 1 file changed, 82 insertions(+), 10 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/CartTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/CartTest.php index 2152d70c13d5e..90febc0d448ba 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/CartTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/CartTest.php @@ -5,7 +5,13 @@ */ namespace Magento\Customer\Block\Adminhtml\Edit\Tab; +use Magento\Backend\Block\Template\Context; +use Magento\Backend\Model\Session\Quote as SessionQuote; use Magento\Customer\Controller\RegistryConstants; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Registry; +use Magento\Quote\Model\Quote; +use Magento\Store\Model\StoreManagerInterface; /** * Magento\Customer\Block\Adminhtml\Edit\Tab\Cart @@ -16,21 +22,34 @@ class CartTest extends \PHPUnit\Framework\TestCase { const CUSTOMER_ID_VALUE = 1234; - /** @var \Magento\Backend\Block\Template\Context */ + /** + * @var Context + */ private $_context; - /** @var \Magento\Framework\Registry */ + /** + * @var Registry + */ private $_coreRegistry; - /** @var \Magento\Store\Model\StoreManagerInterface */ + /** + * @var StoreManagerInterface + */ private $_storeManager; - /** @var Cart */ + /** + * @var Cart + */ private $_block; - /** @var \Magento\Framework\ObjectManagerInterface */ + /** + * @var ObjectManagerInterface + */ private $_objectManager; + /** + * @inheritdoc + */ public function setUp() { $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); @@ -53,22 +72,65 @@ public function setUp() ); } + /** + * @inheritdoc + */ public function tearDown() { $this->_coreRegistry->unregister(RegistryConstants::CURRENT_CUSTOMER_ID); } - public function testGetCustomerId() + /** + * Verify Grid with quote items + * + * @magentoDataFixture Magento/Sales/_files/quote_with_two_products_and_customer.php + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoAppIsolation enabled + * @magentoDbIsolation disabled + * @return void + */ + public function testVerifyCollectionWithQuote(): void + { + $session = $this->_objectManager->create(SessionQuote::class); + $session->setCustomerId(self::CUSTOMER_ID_VALUE); + $quoteFixture = $this->_objectManager->create(Quote::class); + $quoteFixture->load('test01', 'reserved_order_id'); + $quoteFixture->setCustomerIsGuest(false) + ->setCustomerId(self::CUSTOMER_ID_VALUE) + ->save(); + $html = $this->_block->toHtml(); + $this->assertNotContains( + "We couldn't find any records", + $this->_block->getGridParentHtml() + ); + } + + /** + * Verify Customer id + * + * @return void + */ + public function testGetCustomerId(): void { $this->assertEquals(self::CUSTOMER_ID_VALUE, $this->_block->getCustomerId()); } - public function testGetGridUrl() + /** + * Verify get grid url + * + * @return void + */ + public function testGetGridUrl(): void { $this->assertContains('/backend/customer/index/cart', $this->_block->getGridUrl()); } - public function testGetGridParentHtml() + /** + * Verify grid parent html + * + * @return void + */ + public function testGetGridParentHtml(): void { $this->_block = $this->_objectManager->get( \Magento\Framework\View\LayoutInterface::class @@ -87,14 +149,24 @@ public function testGetGridParentHtml() ); } - public function testGetRowUrl() + /** + * Verify row url + * + * @return void + */ + public function testGetRowUrl(): void { $row = new \Magento\Framework\DataObject(); $row->setProductId(1); $this->assertContains('/backend/catalog/product/edit/id/1', $this->_block->getRowUrl($row)); } - public function testGetHtml() + /** + * Verify get html + * + * @return void + */ + public function testGetHtml(): void { $html = $this->_block->toHtml(); $this->assertContains("<div id=\"customer_cart_grid\"", $html); From a3dc4505db1ce7f634ede1a32a0cc5fe86b60027 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Thu, 30 Jan 2020 17:01:34 +0200 Subject: [PATCH 1084/1143] Add more cases --- .../Block/Adminhtml/Edit/Tab/CartTest.php | 58 ++++++++++++++----- 1 file changed, 45 insertions(+), 13 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/CartTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/CartTest.php index 90febc0d448ba..34e28838d0e0d 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/CartTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/CartTest.php @@ -17,6 +17,7 @@ * Magento\Customer\Block\Adminhtml\Edit\Tab\Cart * * @magentoAppArea adminhtml + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class CartTest extends \PHPUnit\Framework\TestCase { @@ -28,7 +29,7 @@ class CartTest extends \PHPUnit\Framework\TestCase private $_context; /** - * @var Registry + * @var Registry */ private $_coreRegistry; @@ -38,7 +39,7 @@ class CartTest extends \PHPUnit\Framework\TestCase private $_storeManager; /** - * @var Cart + * @var Cart */ private $_block; @@ -85,24 +86,55 @@ public function tearDown() * * @magentoDataFixture Magento/Sales/_files/quote_with_two_products_and_customer.php * @magentoDataFixture Magento/Customer/_files/customer.php - * @magentoAppIsolation enabled - * @magentoDbIsolation disabled + * @dataProvider getQuoteDataProvider + * + * @param int $customerId + * @param bool $guest + * @param bool $contains * @return void */ - public function testVerifyCollectionWithQuote(): void + public function testVerifyCollectionWithQuote(int $customerId, bool $guest, bool $contains): void { $session = $this->_objectManager->create(SessionQuote::class); - $session->setCustomerId(self::CUSTOMER_ID_VALUE); + $session->setCustomerId($customerId); $quoteFixture = $this->_objectManager->create(Quote::class); $quoteFixture->load('test01', 'reserved_order_id'); - $quoteFixture->setCustomerIsGuest(false) - ->setCustomerId(self::CUSTOMER_ID_VALUE) + $quoteFixture->setCustomerIsGuest($guest) + ->setCustomerId($customerId) ->save(); - $html = $this->_block->toHtml(); - $this->assertNotContains( - "We couldn't find any records", - $this->_block->getGridParentHtml() - ); + $this->_block->toHtml(); + if ($contains) { + $this->assertContains( + "We couldn't find any records", + $this->_block->getGridParentHtml() + ); + } else { + $this->assertNotContains( + "We couldn't find any records", + $this->_block->getGridParentHtml() + ); + } + } + + /** + * Data provider for withQuoteTest + * + * @return array + */ + public function getQuoteDataProvider(): array + { + return [ + [ + 6, + false, + true + ], + [ + self::CUSTOMER_ID_VALUE, + true, + false + ], + ]; } /** From 996406f506557ecb49ae0951ca1d9c20043a2b92 Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Fri, 31 Jan 2020 08:56:07 +0200 Subject: [PATCH 1085/1143] MC-30281: [2.4] Fix and unskip StorefrontSortingByPriceForConfigurableProductWithCatalogRuleAppliedTest --- ...logPriceRuleAddSkuConditionActionGroup.xml | 28 +++++ ...ConfigurableWithCatalogRuleAppliedTest.xml | 105 +++++++++--------- 2 files changed, 83 insertions(+), 50 deletions(-) create mode 100644 app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminCatalogPriceRuleAddSkuConditionActionGroup.xml diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminCatalogPriceRuleAddSkuConditionActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminCatalogPriceRuleAddSkuConditionActionGroup.xml new file mode 100644 index 0000000000000..2c4e3ddb648e0 --- /dev/null +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminCatalogPriceRuleAddSkuConditionActionGroup.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCatalogPriceRuleAddSkuConditionActionGroup"> + <annotations> + <description>Create new product SKU based condition in Catalog Price Rule form.</description> + </annotations> + <arguments> + <argument name="productSku" type="string" defaultValue="{{ApiSimpleTwo.sku}}"/> + </arguments> + + <conditionalClick selector="{{AdminNewCatalogPriceRule.conditionsTabTitle}}" dependentSelector="{{AdminNewCatalogPriceRule.conditionsTabBody}}" visible="false" stepKey="openConditionsSectionIfNeeded"/> + <scrollTo selector="{{AdminNewCatalogPriceRule.conditionsTabTitle}}" stepKey="scrollToConditionsFieldset"/> + <waitForElementVisible selector="{{AdminNewCatalogPriceRuleConditions.newCondition}}" stepKey="waitForNewConditionButton"/> + <click selector="{{AdminNewCatalogPriceRuleConditions.newCondition}}" stepKey="clickAddNewConditionButton"/> + <selectOption selector="{{AdminNewCatalogPriceRuleConditions.conditionSelect('1')}}" userInput="Magento\CatalogRule\Model\Rule\Condition\Product|sku" stepKey="selectConditionTypeSku"/> + <waitForPageLoad stepKey="waitConditionFormRefresh"/> + <click selector="{{AdminNewCatalogPriceRuleConditions.targetEllipsis('1')}}" stepKey="clickEllipsis"/> + <fillField selector="{{AdminNewCatalogPriceRuleConditions.targetInput('1', '1')}}" userInput="{{productSku}}" stepKey="fillProductSku"/> + <click selector="{{AdminNewCatalogPriceRuleConditions.applyButton('1', '1')}}" stepKey="clickApply"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml index 7828478bc963e..02700b2fd7c85 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml @@ -8,15 +8,18 @@ <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> - <test name="StorefrontSortingByPriceForConfigurableProductWithCatalogRuleAppliedTest"> + <test name="StorefrontCheckSortingByPriceForConfigurableWithCatalogRuleAppliedTest"> <annotations> <features value="ConfigurableProduct"/> - <stories value="View soting by price in storefront"/> - <title value="Sorting by price for Configurable with Catalog Rule applied"/> + <stories value="Check sorting by price on storefront"/> + <title value="Check sorting by price for Configurable product with Catalog Rule applied"/> <description value="Sort by price should be correct if the apply Catalog Rule to child product of configurable product"/> <severity value="CRITICAL"/> - <testCaseId value="MAGETWO-69988"/> - <group value="configurable_product"/> + <testCaseId value="MC-11926"/> + <useCaseId value="MAGETWO-66688"/> + <group value="catalog"/> + <group value="catalogRule"/> + <group value="configurableProduct"/> </annotations> <before> <createData entity="ApiCategory" stepKey="createCategory"/> @@ -28,63 +31,63 @@ <requiredEntity createDataKey="createCategory"/> <field key="price">10.00</field> </createData> - <createData entity="ApiConfigurableProduct" stepKey="createConfigProduct"> + <createData entity="ApiConfigurableProduct" stepKey="createConfigurableProduct"> <requiredEntity createDataKey="createCategory"/> </createData> - <createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/> - <createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1"> - <requiredEntity createDataKey="createConfigProductAttribute"/> + <createData entity="productAttributeWithTwoOptions" stepKey="createConfigurableProductAttribute"/> + <createData entity="productAttributeOption1" stepKey="createConfigurableProductAttributeOption1"> + <requiredEntity createDataKey="createConfigurableProductAttribute"/> </createData> - <createData entity="productAttributeOption2" stepKey="createConfigProductAttributeOption2"> - <requiredEntity createDataKey="createConfigProductAttribute"/> + <createData entity="productAttributeOption2" stepKey="createConfigurableProductAttributeOption2"> + <requiredEntity createDataKey="createConfigurableProductAttribute"/> </createData> - <createData entity="productAttributeOption3" stepKey="createConfigProductAttributeOption3"> - <requiredEntity createDataKey="createConfigProductAttribute"/> + <createData entity="productAttributeOption3" stepKey="createConfigurableProductAttributeOption3"> + <requiredEntity createDataKey="createConfigurableProductAttribute"/> </createData> <createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet"> - <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="createConfigurableProductAttribute"/> </createData> <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1"> - <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="createConfigurableProductAttribute"/> </getData> <getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeOption2"> - <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="createConfigurableProductAttribute"/> </getData> <getData entity="ProductAttributeOptionGetter" index="3" stepKey="getConfigAttributeOption3"> - <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="createConfigurableProductAttribute"/> </getData> <createData entity="ApiSimpleOne" stepKey="createConfigChildProduct1"> - <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="createConfigurableProductAttribute"/> <requiredEntity createDataKey="getConfigAttributeOption1"/> <field key="price">15.00</field> </createData> <createData entity="ApiSimpleTwo" stepKey="createConfigChildProduct2"> - <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="createConfigurableProductAttribute"/> <requiredEntity createDataKey="getConfigAttributeOption2"/> <field key="price">20.00</field> </createData> <createData entity="ApiSimpleTwo" stepKey="createConfigChildProduct3"> - <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="createConfigurableProductAttribute"/> <requiredEntity createDataKey="getConfigAttributeOption3"/> <field key="price">25.00</field> </createData> - <createData entity="ConfigurableProductThreeOptions" stepKey="createConfigProductOption"> - <requiredEntity createDataKey="createConfigProduct"/> - <requiredEntity createDataKey="createConfigProductAttribute"/> + <createData entity="ConfigurableProductThreeOptions" stepKey="createConfigurableProductOption"> + <requiredEntity createDataKey="createConfigurableProduct"/> + <requiredEntity createDataKey="createConfigurableProductAttribute"/> <requiredEntity createDataKey="getConfigAttributeOption1"/> <requiredEntity createDataKey="getConfigAttributeOption2"/> <requiredEntity createDataKey="getConfigAttributeOption3"/> </createData> - <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild1"> - <requiredEntity createDataKey="createConfigProduct"/> + <createData entity="ConfigurableProductAddChild" stepKey="createConfigurableProductAddChild1"> + <requiredEntity createDataKey="createConfigurableProduct"/> <requiredEntity createDataKey="createConfigChildProduct1"/> </createData> - <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild2"> - <requiredEntity createDataKey="createConfigProduct"/> + <createData entity="ConfigurableProductAddChild" stepKey="createConfigurableProductAddChild2"> + <requiredEntity createDataKey="createConfigurableProduct"/> <requiredEntity createDataKey="createConfigChildProduct2"/> </createData> - <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild3"> - <requiredEntity createDataKey="createConfigProduct"/> + <createData entity="ConfigurableProductAddChild" stepKey="createConfigurableProductAddChild3"> + <requiredEntity createDataKey="createConfigurableProduct"/> <requiredEntity createDataKey="createConfigChildProduct3"/> </createData> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> @@ -95,8 +98,8 @@ <actionGroup ref="ChangeUseForPromoRuleConditionsProductAttributeActionGroup" stepKey="changeUseForPromoRuleConditionsProductAttributeToYes"> <argument name="option" value="Yes"/> </actionGroup> - <magentoCLI command="indexer:reindex" stepKey="reindex1"/> - <magentoCLI command="cache:flush" stepKey="flushCache1"/> + <actionGroup ref="AdminCatalogPriceRuleDeleteAllActionGroup" stepKey="deleteAllRules"/> + <magentoCLI command="indexer:reindex" stepKey="reindexIndices"/> </before> <after> @@ -106,8 +109,8 @@ <deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct1"/> <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/> <deleteData createDataKey="createConfigChildProduct3" stepKey="deleteConfigChildProduct3"/> - <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> - <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> + <deleteData createDataKey="createConfigurableProduct" stepKey="deleteConfigProduct"/> + <deleteData createDataKey="createConfigurableProductAttribute" stepKey="deleteConfigProductAttribute"/> <!--SKU Product Attribute is disable for Promo Rule Conditions--> <actionGroup ref="NavigateToEditProductAttributeActionGroup" stepKey="navigateToSkuProductAttribute"> @@ -116,7 +119,12 @@ <actionGroup ref="ChangeUseForPromoRuleConditionsProductAttributeActionGroup" stepKey="changeUseForPromoRuleConditionsProductAttributeToNo"> <argument name="option" value="No"/> </actionGroup> + <actionGroup ref="AdminCatalogPriceRuleDeleteAllActionGroup" stepKey="deleteAllRules"/> <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + + <!-- TODO: Remove this and change to CliRunReindexUsingCronJobsActionGroup after MC-29943 delivered--> + <!-- Need reindex because creating new product attributes break some indices and this may affect other tests in testsuite --> + <magentoCLI command="indexer:reindex" stepKey="reindexIndices"/> </after> <!--Open category with products and Sort by price desc--> @@ -127,20 +135,24 @@ <argument name="sortBy" value="price"/> <argument name="sort" value="desc"/> </actionGroup> - <see selector="{{StorefrontCategoryMainSection.lineProductName('1')}}" userInput="$$createConfigProduct.name$$" stepKey="seeConfigurableProduct"/> + <see selector="{{StorefrontCategoryMainSection.lineProductName('1')}}" userInput="$$createConfigurableProduct.name$$" stepKey="seeConfigurableProduct"/> <see selector="{{StorefrontCategoryMainSection.lineProductName('2')}}" userInput="$$createSimpleProduct2.name$$" stepKey="seeSimpleProductTwo"/> <see selector="{{StorefrontCategoryMainSection.lineProductName('3')}}" userInput="$$createSimpleProduct.name$$" stepKey="seeSimpleProduct"/> <!--Create and apply catalog price rule--> - <actionGroup ref="NewCatalogPriceRuleByUIWithConditionIsSKUActionGroup" stepKey="createCatalogPriceRule"> - <argument name="catalogRule" value="CatalogRuleByPercentWith96Amount" /> - <argument name="productSku" value="$$createConfigChildProduct3.sku$$" /> + <actionGroup ref="AdminOpenNewCatalogPriceRuleFormPageActionGroup" stepKey="startCreatingCatalogPriceRule"/> + <actionGroup ref="AdminCatalogPriceRuleFillMainInfoActionGroup" stepKey="fillMainInfoForCatalogPriceRule"> + <argument name="groups" value="'NOT LOGGED IN'"/> </actionGroup> - <actionGroup ref="SelectNotLoggedInCustomerGroupActionGroup" stepKey="selectNotLoggedInCustomerGroup"/> - <click selector="{{AdminNewCatalogPriceRule.saveAndApply}}" stepKey="clickSaveAndApplyRules"/> - - <magentoCLI command="indexer:reindex" stepKey="reindex"/> - <magentoCLI command="cache:flush" stepKey="flushCache"/> + <actionGroup ref="AdminCatalogPriceRuleAddSkuConditionActionGroup" stepKey="addProductSkuBasedCondition"> + <argument name="productSku" value="$createConfigChildProduct3.sku$"/> + </actionGroup> + <actionGroup ref="AdminCatalogPriceRuleFillActionsActionGroup" stepKey="fillActionsForCatalogPriceRule"> + <argument name="apply" value="{{CatalogRuleByPercentWith96Amount.simple_action}}"/> + <argument name="discountAmount" value="{{CatalogRuleByPercentWith96Amount.discount_amount}}"/> + </actionGroup> + <actionGroup ref="AdminCatalogPriceRuleSaveAndApplyActionGroup" stepKey="saveAndApplyCatalogPriceRule"/> + <actionGroup ref="AdminReindexAndFlushCache" stepKey="reindexAndFlushCache"/> <!--Reopen category with products and Sort by price desc--> <actionGroup ref="GoToStorefrontCategoryPageByParametersActionGroup" stepKey="goToStorefrontCategoryPage2"> @@ -152,13 +164,6 @@ </actionGroup> <see selector="{{StorefrontCategoryMainSection.lineProductName('1')}}" userInput="$$createSimpleProduct2.name$$" stepKey="seeSimpleProductTwo2"/> <see selector="{{StorefrontCategoryMainSection.lineProductName('2')}}" userInput="$$createSimpleProduct.name$$" stepKey="seeSimpleProduct2"/> - <see selector="{{StorefrontCategoryMainSection.lineProductName('3')}}" userInput="$$createConfigProduct.name$$" stepKey="seeConfigurableProduct2"/> - - <!-- Delete the rule --> - <amOnPage url="{{CatalogRulePage.url}}" stepKey="goToPriceRulePage"/> - <actionGroup ref="deleteEntitySecondaryGrid" stepKey="deletePriceRule"> - <argument name="name" value="{{CatalogRuleByPercentWith96Amount.name}}"/> - <argument name="searchInput" value="{{AdminSecondaryGridSection.catalogRuleIdentifierSearch}}"/> - </actionGroup> + <see selector="{{StorefrontCategoryMainSection.lineProductName('3')}}" userInput="$$createConfigurableProduct.name$$" stepKey="seeConfigurableProduct2"/> </test> </tests> From 3056027889eb89fb63341af79217d9ff34af17ec Mon Sep 17 00:00:00 2001 From: "rostyslav.hymon" <rostyslav.hymon@transoftgroup.com> Date: Fri, 31 Jan 2020 09:35:50 +0200 Subject: [PATCH 1086/1143] MC-30777: '1 record found' is shown on the product grid regardless of the number of displayed products --- .../Ui/Component/Listing/Columns/Websites.php | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/app/code/Magento/Catalog/Ui/Component/Listing/Columns/Websites.php b/app/code/Magento/Catalog/Ui/Component/Listing/Columns/Websites.php index 494b77724e5b7..c80b2663d1f69 100644 --- a/app/code/Magento/Catalog/Ui/Component/Listing/Columns/Websites.php +++ b/app/code/Magento/Catalog/Ui/Component/Listing/Columns/Websites.php @@ -3,7 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - declare(strict_types=1); namespace Magento\Catalog\Ui\Component\Listing\Columns; @@ -120,31 +119,32 @@ protected function applySorting() && !empty($sorting['direction']) && $sorting['field'] === $this->getName() ) { + /** @var \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection $collection */ $collection = $this->getContext()->getDataProvider()->getCollection(); - $collection - ->joinField( - 'websites_ids', - 'catalog_product_website', - 'website_id', - 'product_id=entity_id', - null, - 'left' - ) - ->joinTable( - 'store_website', - 'website_id = websites_ids', - ['name'], - null, - 'left' - ) - ->groupByAttribute('entity_id'); - $this->resourceHelper->addGroupConcatColumn( - $collection->getSelect(), - $this->websiteNames, - 'name' + + $select = $collection->getConnection()->select(); + $select->from( + ['cpw' => $collection->getTable('catalog_product_website')], + ['product_id'] + )->joinLeft( + ['sw' => $collection->getTable('store_website')], + 'cpw.website_id = sw.website_id', + [ + $this->websiteNames => new \Zend_Db_Expr( + 'GROUP_CONCAT(sw.name ORDER BY sw.website_id ASC SEPARATOR \',\')' + ) + ] + )->group( + 'cpw.product_id' ); - $collection->getSelect()->order($this->websiteNames . ' ' . $sorting['direction']); + $collection->getSelect()->joinLeft( + ['product_websites' => $select], + 'product_websites.product_id = e.entity_id', + [$this->websiteNames] + )->order( + 'product_websites.' . $this->websiteNames . ' ' . $sorting['direction'] + ); } } } From 5be754b7d3de102cb9ec6ef2f43dbdbcb797540a Mon Sep 17 00:00:00 2001 From: Mateusz Krzeszowiak <mateusz.krzeszowiak@creativestyle.pl> Date: Thu, 28 Nov 2019 17:08:19 +0100 Subject: [PATCH 1087/1143] Add failing test and fix it --- .../view/frontend/web/js/section-config.js | 2 +- .../Customer/frontend/js/section-config.test.js | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/view/frontend/web/js/section-config.js b/app/code/Magento/Customer/view/frontend/web/js/section-config.js index 60482e5fee260..107a177d0832f 100644 --- a/app/code/Magento/Customer/view/frontend/web/js/section-config.js +++ b/app/code/Magento/Customer/view/frontend/web/js/section-config.js @@ -50,7 +50,7 @@ define(['underscore'], function (_) { return route.indexOf(section) === 0; }); - return _.union(actions, sections['*']); + return _.union(_.toArray(actions), sections['*']); }, /** diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/section-config.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/section-config.test.js index 56ed546e28f8c..ef7222883b738 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/section-config.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/section-config.test.js @@ -128,6 +128,21 @@ define(['squire'], function (Squire) { expect(obj.getAffectedSections('http://localhost.com/path')).toEqual(['all']); }); + + it('Ignores capitalization in parts of URL.', function () { + obj['Magento_Customer/js/section-config']({ + sections: { + 'path': [ + 'section' + ] + }, + baseUrls: [ + 'http://localhost.com/' + ] + }); + + expect(obj.getAffectedSections('http://localhost.com/PaTh')).toEqual(['section']); + }); }); describe('"filterClientSideSections" method', function () { From b29cdcd238ded56050308d54aa22df3bc7672a43 Mon Sep 17 00:00:00 2001 From: Lukasz Bajsarowicz <lukasz.bajsarowicz@gmail.com> Date: Fri, 31 Jan 2020 01:42:48 +0100 Subject: [PATCH 1088/1143] #26610 Fix failing CI due to invalid variable handler --- ...ngNewOptionsWithImagesAndPricesToConfigurableProductTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAddingNewOptionsWithImagesAndPricesToConfigurableProductTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAddingNewOptionsWithImagesAndPricesToConfigurableProductTest.xml index 86c4d0398b2cc..a70a62470ecbc 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAddingNewOptionsWithImagesAndPricesToConfigurableProductTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAddingNewOptionsWithImagesAndPricesToConfigurableProductTest.xml @@ -32,7 +32,7 @@ <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <actionGroup ref="AdminClearFiltersActionGroup" stepKey="clearProductFilters"/> <actionGroup ref="DeleteProductActionGroup" stepKey="deleteProduct1"> - <argument name="productName" value="$$createConfigProductAttributeCreateConfigurableProduct.name$$"/> + <argument name="productName" value="$$createConfigProductCreateConfigurableProduct.name$$"/> </actionGroup> <actionGroup ref="logout" stepKey="logout"/> </after> From c13b83fd26c3368c8536995caf918f4372e56b52 Mon Sep 17 00:00:00 2001 From: Lukasz Bajsarowicz <lukasz.bajsarowicz@gmail.com> Date: Fri, 31 Jan 2020 13:42:30 +0100 Subject: [PATCH 1089/1143] #26612 Fix failure on Coupon Apply procedure when loading mask still on page --- .../Mftf/Test/StorefrontApplyPromoCodeDuringCheckoutTest.xml | 2 +- .../Mftf/ActionGroup/StorefrontApplyDiscountCodeActionGroup.xml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontApplyPromoCodeDuringCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontApplyPromoCodeDuringCheckoutTest.xml index 7edc37d510266..5e13ce3e06e10 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontApplyPromoCodeDuringCheckoutTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontApplyPromoCodeDuringCheckoutTest.xml @@ -54,7 +54,7 @@ <argument name="shippingMethod" value="Flat Rate"/> </actionGroup> - <!-- Click Apply Discount Code: section is expanded. Input promo code, apply and see success message --> + <!-- Click Apply Discount Code: section is expanded. Input promo code, apply and see success message --> <actionGroup ref="StorefrontApplyDiscountCodeActionGroup" stepKey="applyCoupon"> <argument name="discountCode" value="$$createCouponForCartPriceRule.code$$"/> </actionGroup> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontApplyDiscountCodeActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontApplyDiscountCodeActionGroup.xml index 3cf96a8b3dc06..fadfadc8ee7cd 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontApplyDiscountCodeActionGroup.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontApplyDiscountCodeActionGroup.xml @@ -16,6 +16,7 @@ <fillField selector="{{DiscountSection.DiscountInput}}" userInput="{{discountCode}}" stepKey="fillFieldDiscountCode"/> <click selector="{{DiscountSection.ApplyCodeBtn}}" stepKey="clickToApplyDiscount"/> <waitForElement selector="{{DiscountSection.DiscountVerificationMsg}}" time="30" stepKey="waitForDiscountToBeAdded"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingFinished"/> <see selector="{{DiscountSection.DiscountVerificationMsg}}" userInput="Your coupon was successfully applied" stepKey="assertDiscountApplyMessage"/> </actionGroup> </actionGroups> From 98d319b3f5c9f170da5ffca234cac212973b3817 Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Fri, 31 Jan 2020 15:10:24 +0200 Subject: [PATCH 1090/1143] MC-30281: [2.4] Fix and unskip StorefrontSortingByPriceForConfigurableProductWithCatalogRuleAppliedTest --- ...ngByPriceForConfigurableWithCatalogRuleAppliedTest.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml index 02700b2fd7c85..85f35703592c1 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml @@ -99,7 +99,8 @@ <argument name="option" value="Yes"/> </actionGroup> <actionGroup ref="AdminCatalogPriceRuleDeleteAllActionGroup" stepKey="deleteAllRules"/> - <magentoCLI command="indexer:reindex" stepKey="reindexIndices"/> + <!-- TODO: Replace this with CliRunReindexUsingCronJobsActionGroup after MC-29943 delivered--> + <magentoCLI command="indexer:reindex" arguments="catalogsearch_fulltext catalog_category_product" stepKey="reindexIndices"/> </before> <after> @@ -122,9 +123,8 @@ <actionGroup ref="AdminCatalogPriceRuleDeleteAllActionGroup" stepKey="deleteAllRules"/> <actionGroup ref="logout" stepKey="logoutFromAdmin"/> - <!-- TODO: Remove this and change to CliRunReindexUsingCronJobsActionGroup after MC-29943 delivered--> - <!-- Need reindex because creating new product attributes break some indices and this may affect other tests in testsuite --> - <magentoCLI command="indexer:reindex" stepKey="reindexIndices"/> + <!-- TODO: Replace this with CliRunReindexUsingCronJobsActionGroup after MC-29943 delivered--> + <magentoCLI command="indexer:reindex" arguments="catalogsearch_fulltext catalog_category_product" stepKey="reindexIndices"/> </after> <!--Open category with products and Sort by price desc--> From 92aee111d387a8deda1c0fa3c6087f5b108d1c9b Mon Sep 17 00:00:00 2001 From: "rostyslav.hymon" <rostyslav.hymon@transoftgroup.com> Date: Fri, 31 Jan 2020 15:19:45 +0200 Subject: [PATCH 1091/1143] MC-30734: Admin: sort by Attribute set on product page doesn't work as expected --- .../Listing/Columns/AttributeSetId.php | 39 +++++++++++++++++++ .../ui_component/product_listing.xml | 2 +- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 app/code/Magento/Catalog/Ui/Component/Listing/Columns/AttributeSetId.php diff --git a/app/code/Magento/Catalog/Ui/Component/Listing/Columns/AttributeSetId.php b/app/code/Magento/Catalog/Ui/Component/Listing/Columns/AttributeSetId.php new file mode 100644 index 0000000000000..5e9f7ba065be7 --- /dev/null +++ b/app/code/Magento/Catalog/Ui/Component/Listing/Columns/AttributeSetId.php @@ -0,0 +1,39 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Ui\Component\Listing\Columns; + +/** + * Attribute set listing column component + */ +class AttributeSetId extends \Magento\Ui\Component\Listing\Columns\Column +{ + /** + * @inheritDoc + */ + protected function applySorting() + { + $sorting = $this->getContext()->getRequestParam('sorting'); + $isSortable = $this->getData('config/sortable'); + if ($isSortable !== false + && !empty($sorting['field']) + && !empty($sorting['direction']) + && $sorting['field'] === $this->getName() + ) { + $collection = $this->getContext()->getDataProvider()->getCollection(); + $collection->joinField( + 'attribute_set', + 'eav_attribute_set', + 'attribute_set_name', + 'attribute_set_id=attribute_set_id', + null, + 'left' + ); + $collection->getSelect()->order('attribute_set_name ' . $sorting['direction']); + } + } +} diff --git a/app/code/Magento/Catalog/view/adminhtml/ui_component/product_listing.xml b/app/code/Magento/Catalog/view/adminhtml/ui_component/product_listing.xml index d2d6f098125ce..88bb578712056 100644 --- a/app/code/Magento/Catalog/view/adminhtml/ui_component/product_listing.xml +++ b/app/code/Magento/Catalog/view/adminhtml/ui_component/product_listing.xml @@ -144,7 +144,7 @@ <label translate="true">Type</label> </settings> </column> - <column name="attribute_set_id" component="Magento_Ui/js/grid/columns/select" sortOrder="50"> + <column name="attribute_set_id" class="Magento\Catalog\Ui\Component\Listing\Columns\AttributeSetId" component="Magento_Ui/js/grid/columns/select" sortOrder="50"> <settings> <options class="Magento\Catalog\Model\Product\AttributeSet\Options"/> <filter>select</filter> From a183437b8c95f9487d5c815605ac7c89e7fa2a95 Mon Sep 17 00:00:00 2001 From: Karyna Tsymbal <k.tsymbal@atwix.com> Date: Fri, 31 Jan 2020 16:03:49 +0200 Subject: [PATCH 1092/1143] Code cleaning --- .../Observer/CheckoutCartAddProductObserverTest.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Reports/Test/Unit/Observer/CheckoutCartAddProductObserverTest.php b/app/code/Magento/Reports/Test/Unit/Observer/CheckoutCartAddProductObserverTest.php index 02bdbdf794ac6..d9a75c96d4304 100644 --- a/app/code/Magento/Reports/Test/Unit/Observer/CheckoutCartAddProductObserverTest.php +++ b/app/code/Magento/Reports/Test/Unit/Observer/CheckoutCartAddProductObserverTest.php @@ -20,7 +20,7 @@ use PHPUnit\Framework\TestCase; /** - * Unit Test for @see CheckoutCartAddProductObserver + * Unit Test for \Magento\Reports\Observer\CheckoutCartAddProductObserver */ class CheckoutCartAddProductObserverTest extends TestCase { @@ -84,7 +84,7 @@ protected function setUp() /** * The case when event has to be successfully saved */ - public function testExecute() + public function testExecuteExpectsSaveCalledWhenNewProductAdded() { $this->configureMocksWhenReportsEnabled(); $this->quoteItemMock->expects($this->once()) @@ -94,8 +94,7 @@ public function testExecute() ->method('getParentItem') ->willReturn(null); - $this->eventSaverMock->expects($this->once()) - ->method('save'); + $this->eventSaverMock->expects($this->once())->method('save'); $this->observer->execute($this->eventObserverMock); } @@ -159,8 +158,7 @@ private function configureMocksWhenReportsEnabled() */ private function checkOriginalMethodIsNeverExecuted() { - $this->eventSaverMock->expects($this->never()) - ->method('save'); + $this->eventSaverMock->expects($this->never())->method('save'); $this->observer->execute($this->eventObserverMock); } } From bcc19dc4002ffe158cb2c77b38852c676f53f86e Mon Sep 17 00:00:00 2001 From: Karyna Tsymbal <k.tsymbal@atwix.com> Date: Fri, 31 Jan 2020 16:43:29 +0200 Subject: [PATCH 1093/1143] Code cleaning --- .../Block/Tracking/PopupDeliveryDateTest.php | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Fedex/Test/Unit/Plugin/Block/Tracking/PopupDeliveryDateTest.php b/app/code/Magento/Fedex/Test/Unit/Plugin/Block/Tracking/PopupDeliveryDateTest.php index 109f6199b52c6..f9865793129d3 100644 --- a/app/code/Magento/Fedex/Test/Unit/Plugin/Block/Tracking/PopupDeliveryDateTest.php +++ b/app/code/Magento/Fedex/Test/Unit/Plugin/Block/Tracking/PopupDeliveryDateTest.php @@ -17,7 +17,7 @@ use PHPUnit\Framework\TestCase; /** - * Unit Test for @see \Magento\Fedex\Plugin\Block\Tracking\PopupDeliveryDate + * Unit Test for \Magento\Fedex\Plugin\Block\Tracking\PopupDeliveryDate */ class PopupDeliveryDateTest extends TestCase { @@ -63,9 +63,7 @@ public function testAfterFormatDeliveryDateTimeWithFedexCarrier() $this->trackingStatusMock->expects($this::once()) ->method('getCarrier') ->willReturn(Carrier::CODE); - - $this->subjectMock->expects($this->once()) - ->method('formatDeliveryDate'); + $this->subjectMock->expects($this->once())->method('formatDeliveryDate'); $this->executeOriginalMethod(); } @@ -78,15 +76,13 @@ public function testAfterFormatDeliveryDateTimeWithOtherCarrier() $this->trackingStatusMock->expects($this::once()) ->method('getCarrier') ->willReturn(self::STUB_CARRIER_CODE_NOT_FEDEX); - - $this->subjectMock->expects($this->never()) - ->method('formatDeliveryDate'); + $this->subjectMock->expects($this->never())->method('formatDeliveryDate'); $this->executeOriginalMethod(); } /** - * Returns Mock for @see Status + * Returns Mock for \Magento\Shipping\Model\Tracking\Result\Status * * @return MockObject */ @@ -99,7 +95,7 @@ private function getStatusMock(): MockObject } /** - * Returns Mock for @see Popup + * Returns Mock for \Magento\Shipping\Block\Tracking\Popup * * @return MockObject */ From 1c6a7a3518343991909fa9605d173f9de1f1fb42 Mon Sep 17 00:00:00 2001 From: Lukasz Bajsarowicz <lukasz.bajsarowicz@gmail.com> Date: Fri, 31 Jan 2020 23:11:23 +0100 Subject: [PATCH 1094/1143] #CoreReview Fix backward compatibility --- .../Block/Product/ProductsList.php | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php b/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php index 4a75c806aa37b..2175889ce84e8 100644 --- a/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php +++ b/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php @@ -8,6 +8,7 @@ use Magento\Catalog\Api\CategoryRepositoryInterface; use Magento\Catalog\Block\Product\AbstractProduct; +use Magento\Catalog\Block\Product\Context; use Magento\Catalog\Block\Product\Widget\Html\Pager; use Magento\Catalog\Model\Product; use Magento\Catalog\Model\Product\Visibility; @@ -16,7 +17,7 @@ use Magento\Catalog\Pricing\Price\FinalPrice; use Magento\CatalogWidget\Model\Rule; use Magento\Framework\App\ActionInterface; -use Magento\Framework\App\Http\Context; +use Magento\Framework\App\Http\Context as HttpContext; use Magento\Framework\App\ObjectManager; use Magento\Framework\DataObject\IdentityInterface; use Magento\Framework\Exception\LocalizedException; @@ -27,7 +28,7 @@ use Magento\Framework\View\LayoutFactory; use Magento\Framework\View\LayoutInterface; use Magento\Rule\Model\Condition\Combine; -use Magento\Rule\Model\Condition\Sql\Builder; +use Magento\Rule\Model\Condition\Sql\Builder as SqlBuilder; use Magento\Widget\Block\BlockInterface; use Magento\Widget\Helper\Conditions; @@ -69,7 +70,7 @@ class ProductsList extends AbstractProduct implements BlockInterface, IdentityIn protected $pager; /** - * @var Context + * @var HttpContext */ protected $httpContext; @@ -88,7 +89,7 @@ class ProductsList extends AbstractProduct implements BlockInterface, IdentityIn protected $productCollectionFactory; /** - * @var Builder + * @var SqlBuilder */ protected $sqlBuilder; @@ -135,34 +136,34 @@ class ProductsList extends AbstractProduct implements BlockInterface, IdentityIn private $categoryRepository; /** - * @param \Magento\Catalog\Block\Product\Context $context + * @param Context $context * @param CollectionFactory $productCollectionFactory * @param Visibility $catalogProductVisibility - * @param Context $httpContext - * @param Builder $sqlBuilder + * @param HttpContext $httpContext + * @param SqlBuilder $sqlBuilder * @param Rule $rule * @param Conditions $conditionsHelper - * @param CategoryRepositoryInterface $categoryRepository * @param array $data * @param Json|null $json * @param LayoutFactory|null $layoutFactory * @param EncoderInterface|null $urlEncoder + * @param CategoryRepositoryInterface|null $categoryRepository * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Catalog\Block\Product\Context $context, + Context $context, CollectionFactory $productCollectionFactory, Visibility $catalogProductVisibility, - Context $httpContext, - Builder $sqlBuilder, + HttpContext $httpContext, + SqlBuilder $sqlBuilder, Rule $rule, Conditions $conditionsHelper, - CategoryRepositoryInterface $categoryRepository, array $data = [], Json $json = null, LayoutFactory $layoutFactory = null, - EncoderInterface $urlEncoder = null + EncoderInterface $urlEncoder = null, + CategoryRepositoryInterface $categoryRepository = null ) { $this->productCollectionFactory = $productCollectionFactory; $this->catalogProductVisibility = $catalogProductVisibility; @@ -173,7 +174,8 @@ public function __construct( $this->json = $json ?: ObjectManager::getInstance()->get(Json::class); $this->layoutFactory = $layoutFactory ?: ObjectManager::getInstance()->get(LayoutFactory::class); $this->urlEncoder = $urlEncoder ?: ObjectManager::getInstance()->get(EncoderInterface::class); - $this->categoryRepository = $categoryRepository; + $this->categoryRepository = $categoryRepository ?? ObjectManager::getInstance() + ->get(CategoryRepositoryInterface::class); parent::__construct( $context, $data From 5000cd9aa766448ad3a9812052474f75beb96604 Mon Sep 17 00:00:00 2001 From: Lukasz Bajsarowicz <lukasz.bajsarowicz@gmail.com> Date: Fri, 31 Jan 2020 23:19:46 +0100 Subject: [PATCH 1095/1143] #CoreReview Improve test readability with const STUB and extracting assertions, using Phrase placeholder --- .../DeleteCategoryWithEnabledFlatTest.php | 35 +++++++++++++++---- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Category/Delete/DeleteCategoryWithEnabledFlatTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Category/Delete/DeleteCategoryWithEnabledFlatTest.php index 357b7247412d9..efa19b98d077f 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Category/Delete/DeleteCategoryWithEnabledFlatTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Category/Delete/DeleteCategoryWithEnabledFlatTest.php @@ -24,6 +24,8 @@ */ class DeleteCategoryWithEnabledFlatTest extends AbstractBackendController { + const STUB_CATEGORY_ID = 333; + /** * @var IndexerRegistry */ @@ -79,13 +81,16 @@ protected function tearDown() */ public function testDeleteCategory(): void { - $this->assertEquals(1, $this->getFlatCategoryCollectionSizeByCategoryId(333)); - $this->getRequest()->setMethod(HttpRequest::METHOD_POST); - $this->getRequest()->setPostValue(['id' => 333]); - $this->dispatch('backend/catalog/category/delete'); + // Given + $this->assertEquals(1, $this->getFlatCategoryCollectionSizeByCategoryId(self::STUB_CATEGORY_ID)); + + // When + $this->sendDeleteCategoryRequest(self::STUB_CATEGORY_ID); + + // Then $this->assertSessionMessages($this->equalTo([(string)__('You deleted the category.')])); - $this->assertEquals(0, $this->getFlatCategoryCollectionSizeByCategoryId(333)); - $this->checkCategoryIsDeleted(333); + $this->assertEquals(0, $this->getFlatCategoryCollectionSizeByCategoryId(self::STUB_CATEGORY_ID)); + $this->checkCategoryIsDeleted(self::STUB_CATEGORY_ID); } /** @@ -106,10 +111,26 @@ private function getFlatCategoryCollectionSizeByCategoryId(int $categoryId): int * Assert that category is deleted. * * @param int $categoryId + * @return void */ private function checkCategoryIsDeleted(int $categoryId): void { - $this->expectExceptionObject(new NoSuchEntityException(__("No such entity with id = {$categoryId}"))); + $this->expectExceptionObject( + new NoSuchEntityException(__("No such entity with id = %entityId", ['entityId' => $categoryId])) + ); $this->categoryRepository->get($categoryId); } + + /** + * Method passes the request to Backend to remove given category. + * + * @param int $categoryId + * @return void + */ + private function sendDeleteCategoryRequest(int $categoryId): void + { + $this->getRequest()->setMethod(HttpRequest::METHOD_POST); + $this->getRequest()->setPostValue(['id' => $categoryId]); + $this->dispatch('backend/catalog/category/delete'); + } } From e943bda91d0b03a0fc67fb78b82254986796396c Mon Sep 17 00:00:00 2001 From: Lachlan Turner <lachlan.turner@aligent.com.au> Date: Sat, 1 Feb 2020 12:25:23 +1030 Subject: [PATCH 1096/1143] #26622 - Check quote item for parentItem instead of parentItemId, as the latter is only set in beforeSave function. --- app/code/Magento/SalesRule/Model/Validator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/SalesRule/Model/Validator.php b/app/code/Magento/SalesRule/Model/Validator.php index dad35165051ce..addfd6107f600 100644 --- a/app/code/Magento/SalesRule/Model/Validator.php +++ b/app/code/Magento/SalesRule/Model/Validator.php @@ -383,7 +383,7 @@ public function initTotals($items, Address $address) foreach ($items as $item) { //Skipping child items to avoid double calculations - if ($item->getParentItemId()) { + if ($item->getParentItem()) { continue; } if (!$rule->getActions()->validate($item)) { From 324ee916643f3b936d4f65eb82b35ed3085debb9 Mon Sep 17 00:00:00 2001 From: Michele Fantetti <mfantetti@ittweb.net> Date: Sat, 1 Feb 2020 11:41:13 +0100 Subject: [PATCH 1097/1143] Add frontend template hints status command unit tests after suggestions --- .../Command/TemplateHintsStatusCommand.php | 10 ++++++- .../TemplateHintsStatusCommandTest.php | 26 +++++++++++++------ 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php b/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php index d6569622d17ce..c4d4d0109b1b5 100644 --- a/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php +++ b/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php @@ -66,7 +66,7 @@ public function execute(InputInterface $input, OutputInterface $output) { $this->reinitableConfig->reinit(); $templateHintsStatus = - $this->scopeConfig->isSetFlag(self::TEMPLATE_HINTS_STOREFRONT_PATH, 'default') + ($this->isTemplateHintsEnabled()) ? 'enabled' : 'disabled'; $templateHintsMessage = __("Template hints are %status", ['status' => $templateHintsStatus]); @@ -74,4 +74,12 @@ public function execute(InputInterface $input, OutputInterface $output) return Cli::RETURN_SUCCESS; } + + /** + * @return bool + */ + private function isTemplateHintsEnabled(): bool + { + return $this->scopeConfig->isSetFlag(self::TEMPLATE_HINTS_STOREFRONT_PATH, 'default'); + } } diff --git a/app/code/Magento/Developer/Test/Unit/Console/Command/TemplateHintsStatusCommandTest.php b/app/code/Magento/Developer/Test/Unit/Console/Command/TemplateHintsStatusCommandTest.php index 1c7ecaf161003..1aec1d71b434d 100644 --- a/app/code/Magento/Developer/Test/Unit/Console/Command/TemplateHintsStatusCommandTest.php +++ b/app/code/Magento/Developer/Test/Unit/Console/Command/TemplateHintsStatusCommandTest.php @@ -49,16 +49,26 @@ protected function setUp() } /** - * Verify execution + * Verify ScopeConfigInterface instance */ - public function testExecute() + public function testScopeConfigInterfaceInstance() { - $tester = new CommandTester($this->command); - $tester->execute([]); + $this->assertInstanceOf(ScopeConfigInterface::class, $this->scopeConfigMock); + } - $this->assertEquals( - Cli::RETURN_SUCCESS, - $tester->getStatusCode() - ); + /** + * Verify ReinitableConfigInterface instance + */ + public function testReinitableConfigInterfaceInstance() + { + $this->assertInstanceOf(ReinitableConfigInterface::class, $this->reinitableConfigMock); + } + + /** + * Verify TemplateHintsStatusCommand instance + */ + public function testCommandInstance() + { + $this->assertInstanceOf(TemplateHintsStatusCommand::class, $this->command); } } From df14b1c46675a4a59eb57f1b1b1e6fbec697a1b4 Mon Sep 17 00:00:00 2001 From: Vikalp Saxena <vikalpsaxena@cedcommerce.com> Date: Sun, 2 Feb 2020 10:49:24 +0530 Subject: [PATCH 1098/1143] Fixed #26513 Added missing Array param type in comment in \Magento\Quote\Model\Quote\Item::addOption #26513 --- app/code/Magento/Quote/Model/Quote/Item.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Quote/Model/Quote/Item.php b/app/code/Magento/Quote/Model/Quote/Item.php index d14ae008ce407..2e4a9c7ded683 100644 --- a/app/code/Magento/Quote/Model/Quote/Item.php +++ b/app/code/Magento/Quote/Model/Quote/Item.php @@ -609,7 +609,7 @@ public function getOptionsByCode() /** * Add option to item * - * @param \Magento\Quote\Model\Quote\Item\Option|\Magento\Framework\DataObject $option + * @param \Magento\Quote\Model\Quote\Item\Option|\Magento\Framework\DataObject|array $option * @return $this * @throws \Magento\Framework\Exception\LocalizedException */ From 71cc328d7792d089b62939a71486e770299240ad Mon Sep 17 00:00:00 2001 From: Pratik Sangani <pratiksangani95@gmail.com> Date: Sun, 2 Feb 2020 12:18:12 +0530 Subject: [PATCH 1099/1143] Xml fixes --- app/code/Magento/AdvancedPricingImportExport/etc/module.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/Magento/AdvancedPricingImportExport/etc/module.xml b/app/code/Magento/AdvancedPricingImportExport/etc/module.xml index 230fb17ae5544..4482ba7a0a5e8 100644 --- a/app/code/Magento/AdvancedPricingImportExport/etc/module.xml +++ b/app/code/Magento/AdvancedPricingImportExport/etc/module.xml @@ -6,6 +6,5 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> - <module name="Magento_AdvancedPricingImportExport" > - </module> + <module name="Magento_AdvancedPricingImportExport" /> </config> From f9f5e30a692725451bb0ada271cfaf3f594e22e5 Mon Sep 17 00:00:00 2001 From: Sanchit <sanchit@cueblocks.com> Date: Sun, 2 Feb 2020 12:21:51 +0530 Subject: [PATCH 1100/1143] ProductToolbarTypoFix: Grit Typo Fix --- app/code/Magento/Catalog/Block/Product/ProductList/Toolbar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Toolbar.php b/app/code/Magento/Catalog/Block/Product/ProductList/Toolbar.php index c530ba4785ad9..48725331b27da 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Toolbar.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Toolbar.php @@ -263,7 +263,7 @@ public function getCurrentPage() } /** - * Get grit products sort order field + * Get grid products sort order field * * @return string */ From 49cfa49da66cc6baf446b8e34b516377a1f85348 Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Mon, 3 Feb 2020 10:54:02 +0200 Subject: [PATCH 1101/1143] MC-30281: [2.4] Fix and unskip StorefrontSortingByPriceForConfigurableProductWithCatalogRuleAppliedTest --- .../Test/Mftf/Section/AdminNewCatalogPriceRuleSection.xml | 2 +- ...SortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Section/AdminNewCatalogPriceRuleSection.xml b/app/code/Magento/CatalogRule/Test/Mftf/Section/AdminNewCatalogPriceRuleSection.xml index be0fdb2e0b419..8be6b809aa77b 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Section/AdminNewCatalogPriceRuleSection.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Section/AdminNewCatalogPriceRuleSection.xml @@ -63,7 +63,7 @@ <element name="targetEllipsisSelect" type="select" selector="select#conditions__{{var1}}--{{var2}}__value" parameterized="true" timeout="30"/> <element name="targetSelect" type="select" selector="//ul[@id='conditions__{{var}}__children']//select" parameterized="true" timeout="30"/> <element name="targetInput" type="input" selector="input#conditions__{{var1}}--{{var2}}__value" parameterized="true"/> - <element name="applyButton" type="button" selector="#conditions__{{var1}}__children li:nth-of-type({{var2}}) a.rule-param-apply" parameterized="true"/> + <element name="applyButton" type="button" selector="#conditions__{{var1}}__children li:nth-of-type({{var2}}) a.rule-param-apply" parameterized="true" timeout="30"/> <element name="condition" type="text" selector="//span[@class='rule-param']/a[text()='{{condition}}']" parameterized="true"/> <element name="activeOperatorSelect" type="select" selector=".rule-param-edit select[name*='[operator]']"/> <element name="activeValueInput" type="input" selector=".rule-param-edit [name*='[value]']"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml index 85f35703592c1..4e8274203365c 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml @@ -152,7 +152,8 @@ <argument name="discountAmount" value="{{CatalogRuleByPercentWith96Amount.discount_amount}}"/> </actionGroup> <actionGroup ref="AdminCatalogPriceRuleSaveAndApplyActionGroup" stepKey="saveAndApplyCatalogPriceRule"/> - <actionGroup ref="AdminReindexAndFlushCache" stepKey="reindexAndFlushCache"/> + <magentoCLI command="indexer:reindex" arguments="catalogsearch_fulltext catalog_category_product catalog_product_price catalogrule_rule" stepKey="reindexIndices"/> + <magentoCLI command="cache:clean" arguments="full_page block_html" stepKey="flushCache"/> <!--Reopen category with products and Sort by price desc--> <actionGroup ref="GoToStorefrontCategoryPageByParametersActionGroup" stepKey="goToStorefrontCategoryPage2"> From 0e7063ab0a6ed3458f04a1c31588e130a7699dba Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Mon, 3 Feb 2020 11:07:26 +0200 Subject: [PATCH 1102/1143] MC-30281: [2.4] Fix and unskip StorefrontSortingByPriceForConfigurableProductWithCatalogRuleAppliedTest --- ...tSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml index 4e8274203365c..15df342ca47a8 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml @@ -153,7 +153,7 @@ </actionGroup> <actionGroup ref="AdminCatalogPriceRuleSaveAndApplyActionGroup" stepKey="saveAndApplyCatalogPriceRule"/> <magentoCLI command="indexer:reindex" arguments="catalogsearch_fulltext catalog_category_product catalog_product_price catalogrule_rule" stepKey="reindexIndices"/> - <magentoCLI command="cache:clean" arguments="full_page block_html" stepKey="flushCache"/> + <magentoCLI command="cache:clean" arguments="full_page" stepKey="flushCache"/> <!--Reopen category with products and Sort by price desc--> <actionGroup ref="GoToStorefrontCategoryPageByParametersActionGroup" stepKey="goToStorefrontCategoryPage2"> From 4ace1e6658a80a9b017cd5803b30fb3ed6189dd0 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Mon, 3 Feb 2020 11:39:21 +0200 Subject: [PATCH 1103/1143] cover changes with jasmine test --- .../frontend/web/js/swatch-renderer.test.js | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.test.js index f486123ba0bd3..144bfa4a77bce 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.test.js @@ -98,5 +98,37 @@ define([ widget._UpdatePrice(); expect(productPriceMock.find().find.calls.count()).toBe(1); }); + + it('check getSelectedOptionPriceIndex', function () { + var optionMock = '<div class="swatch-attribute" attribute-id="2" option-selected="4"></div>', + element = $('<div class="' + widget.options.tooltipClass + + '"><div class="image"></div><div class="title"></div><div class="corner"></div>' + + optionMock + '</div>' + ), + optionPricesMock = { + optionPrices: { + p: { + finalPrice: { + amount: 12 + } + } + } + }; + + widget.element = element; + widget.options.classes.attributeClass = 'swatch-attribute'; + widget.options.jsonConfig = optionPricesMock; + widget.optionsMap = { + 2: { + 4: { + products: 'p' + }, + hasOwnProperty: jasmine.createSpy().and.returnValue(true) + }, + hasOwnProperty: jasmine.createSpy().and.returnValue(true) + }; + + expect(widget._getSelectedOptionPriceIndex()).toBe('p'); + }); }); }); From 9c0a76fe87c984043ffb7b189c37ed469058bc27 Mon Sep 17 00:00:00 2001 From: engcom-Echo <engcom-vendorworker-echo@adobe.com> Date: Mon, 3 Feb 2020 12:20:55 +0200 Subject: [PATCH 1104/1143] Minor change --- .../Developer/Console/Command/TemplateHintsStatusCommand.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php b/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php index c4d4d0109b1b5..bc44df911213b 100644 --- a/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php +++ b/app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php @@ -76,6 +76,8 @@ public function execute(InputInterface $input, OutputInterface $output) } /** + * Check if template hints enabled + * * @return bool */ private function isTemplateHintsEnabled(): bool From 2d414e7bcb586afdeda9638939d1da341309d9c5 Mon Sep 17 00:00:00 2001 From: Roman Zhupanyn <roma.dj.elf@gmail.com> Date: Mon, 3 Feb 2020 15:00:51 +0200 Subject: [PATCH 1105/1143] MC-24930: Admin: Edit product Attribute --- .../Attribute/DataProvider/Decimal.php | 134 +++++ .../Attribute/DataProvider/MediaImage.php | 75 +++ .../Product/Attribute/DataProvider/Price.php | 59 --- .../AbstractAttributeDataWithOptions.php | 63 +++ .../AbstractBaseAttributeData.php | 176 ++++++- .../Eav/Model/Attribute/DataProvider/Date.php | 95 ++++ .../Model/Attribute/DataProvider/DropDown.php | 74 +++ .../Attribute/DataProvider/MultipleSelect.php | 74 +++ .../Eav/Model/Attribute/DataProvider/Text.php | 76 +++ .../Model/Attribute/DataProvider/TextArea.php | 86 ++++ .../Attribute/DataProvider/TextEditor.php | 87 ++++ .../Model/Attribute/DataProvider/YesNo.php | 76 +++ .../GetEntityIdByAttributeId.php | 16 +- .../Attribute/DataProvider/TextSwatch.php | 136 +++++ .../Attribute/DataProvider/VisualSwatch.php | 130 +++++ .../DataProvider/FixedProductTax.php | 75 +++ .../AbstractSaveAttributeTest.php | 41 +- .../{PriceTest.php => DecimalTest.php} | 9 +- .../Save/InputType/MediaImageTest.php | 7 +- .../Update/AbstractUpdateAttributeTest.php | 472 ++++++++++++++++++ .../Update/InputType/DecimalTest.php | 67 +++ .../Update/InputType/MediaImageTest.php | 67 +++ .../_files/product_text_editor_attribute.php | 55 ++ ...product_text_editor_attribute_rollback.php | 26 + .../Attribute/Save/InputType/DateTest.php | 7 +- .../Attribute/Save/InputType/DropDownTest.php | 7 +- .../Save/InputType/MultipleSelectTest.php | 7 +- .../Attribute/Save/InputType/TextAreaTest.php | 7 +- .../Save/InputType/TextEditorTest.php | 7 +- .../Attribute/Save/InputType/TextTest.php | 7 +- .../Attribute/Save/InputType/YesNoTest.php | 7 +- .../Attribute/Update/InputType/DateTest.php | 67 +++ .../Update/InputType/DropDownTest.php | 82 +++ .../Update/InputType/MultipleSelectTest.php | 82 +++ .../Update/InputType/TextAreaTest.php | 67 +++ .../Update/InputType/TextEditorTest.php | 67 +++ .../Attribute/Update/InputType/TextTest.php | 67 +++ .../Attribute/Update/InputType/YesNoTest.php | 67 +++ .../Save/InputType/TextSwatchTest.php | 7 +- .../Save/InputType/VisualSwatchTest.php | 7 +- .../AbstractUpdateSwatchAttributeTest.php | 146 ++++++ .../Update/InputType/TextSwatchTest.php | 91 ++++ .../Update/InputType/VisualSwatchTest.php | 91 ++++ ...oduct_visual_swatch_attribute_rollback.php | 3 +- .../Save/InputType/FixedProductTaxTest.php | 7 +- .../Update/InputType/FixedProductTaxTest.php | 67 +++ 46 files changed, 3014 insertions(+), 129 deletions(-) create mode 100644 dev/tests/integration/framework/Magento/TestFramework/Catalog/Model/Product/Attribute/DataProvider/Decimal.php delete mode 100644 dev/tests/integration/framework/Magento/TestFramework/Catalog/Model/Product/Attribute/DataProvider/Price.php rename dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save/{InputType => }/AbstractSaveAttributeTest.php (86%) rename dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save/InputType/{PriceTest.php => DecimalTest.php} (79%) create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Update/AbstractUpdateAttributeTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Update/InputType/DecimalTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Update/InputType/MediaImageTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/product_text_editor_attribute.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/product_text_editor_attribute_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Update/InputType/DateTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Update/InputType/DropDownTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Update/InputType/MultipleSelectTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Update/InputType/TextAreaTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Update/InputType/TextEditorTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Update/InputType/TextTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Update/InputType/YesNoTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Update/AbstractUpdateSwatchAttributeTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Update/InputType/TextSwatchTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Update/InputType/VisualSwatchTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Weee/Controller/Adminhtml/Product/Attribute/Update/InputType/FixedProductTaxTest.php diff --git a/dev/tests/integration/framework/Magento/TestFramework/Catalog/Model/Product/Attribute/DataProvider/Decimal.php b/dev/tests/integration/framework/Magento/TestFramework/Catalog/Model/Product/Attribute/DataProvider/Decimal.php new file mode 100644 index 0000000000000..ad72f2d197794 --- /dev/null +++ b/dev/tests/integration/framework/Magento/TestFramework/Catalog/Model/Product/Attribute/DataProvider/Decimal.php @@ -0,0 +1,134 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\TestFramework\Catalog\Model\Product\Attribute\DataProvider; + +use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface; +use Magento\TestFramework\Eav\Model\Attribute\DataProvider\AbstractBaseAttributeData; +use Magento\Store\Model\Store; +use Magento\Catalog\Model\Product\Attribute\Backend\Price as BackendPrice; + +/** + * Product attribute data for attribute with input type weee. + */ +class Decimal extends AbstractBaseAttributeData +{ + /** + * @inheritdoc + */ + public function __construct() + { + parent::__construct(); + $this->defaultAttributePostData['is_filterable'] = '0'; + $this->defaultAttributePostData['is_filterable_in_search'] = '0'; + $this->defaultAttributePostData['used_for_sort_by'] = '0'; + } + + /** + * @inheritdoc + */ + public function getAttributeData(): array + { + $result = parent::getAttributeData(); + unset($result["{$this->getFrontendInput()}_with_default_value"]); + unset($result["{$this->getFrontendInput()}_without_default_value"]); + + return $result; + } + + /** + * @inheritdoc + */ + public function getAttributeDataWithCheckArray(): array + { + $result = parent::getAttributeDataWithCheckArray(); + unset($result["{$this->getFrontendInput()}_with_default_value"]); + unset($result["{$this->getFrontendInput()}_without_default_value"]); + + return $result; + } + + /** + * @inheritdoc + */ + public function getUpdateProvider(): array + { + $frontendInput = $this->getFrontendInput(); + return array_replace_recursive( + parent::getUpdateProvider(), + [ + "{$frontendInput}_other_attribute_code" => [ + 'post_data' => [ + 'attribute_code' => 'text_attribute_update', + ], + 'expected_data' => [ + 'attribute_code' => 'decimal_attribute', + ], + ], + ] + ); + } + + /** + * @inheritdoc + */ + protected function getFrontendInput(): string + { + return 'price'; + } + + /** + * @inheritdoc + */ + protected function getUpdatePostData(): array + { + return [ + 'frontend_label' => [ + Store::DEFAULT_STORE_ID => 'Decimal Attribute Update', + ], + 'frontend_input' => 'price', + 'is_required' => '1', + 'is_unique' => '1', + 'is_used_in_grid' => '1', + 'is_visible_in_grid' => '1', + 'is_filterable_in_grid' => '1', + 'is_searchable' => '1', + 'search_weight' => '2', + 'is_visible_in_advanced_search' => '1', + 'is_comparable' => '1', + 'is_filterable' => '2', + 'is_filterable_in_search' => '1', + 'position' => '2', + 'is_used_for_promo_rules' => '1', + 'is_html_allowed_on_front' => '1', + 'is_visible_on_front' => '1', + 'used_in_product_listing' => '0', + 'used_for_sort_by' => '1', + ]; + } + + /** + * @inheritdoc + */ + protected function getUpdateExpectedData(): array + { + $updatePostData = $this->getUpdatePostData(); + return array_merge( + $updatePostData, + [ + 'frontend_label' => 'Decimal Attribute Update', + 'attribute_code' => 'decimal_attribute', + 'is_global' => ScopedAttributeInterface::SCOPE_GLOBAL, + 'default_value' => null, + 'frontend_class' => null, + 'is_user_defined' => '1', + 'backend_type' => 'decimal', + 'backend_model' => BackendPrice::class, + ] + ); + } +} diff --git a/dev/tests/integration/framework/Magento/TestFramework/Catalog/Model/Product/Attribute/DataProvider/MediaImage.php b/dev/tests/integration/framework/Magento/TestFramework/Catalog/Model/Product/Attribute/DataProvider/MediaImage.php index dd706ab29c326..7ae0169efa497 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Catalog/Model/Product/Attribute/DataProvider/MediaImage.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Catalog/Model/Product/Attribute/DataProvider/MediaImage.php @@ -7,6 +7,9 @@ namespace Magento\TestFramework\Catalog\Model\Product\Attribute\DataProvider; +use Magento\Catalog\Model\Product\Attribute\Frontend\Image; +use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface; +use Magento\Store\Model\Store; use Magento\TestFramework\Eav\Model\Attribute\DataProvider\AbstractBaseAttributeData; /** @@ -47,6 +50,27 @@ public function getAttributeDataWithCheckArray(): array return $result; } + /** + * @inheritdoc + */ + public function getUpdateProvider(): array + { + $frontendInput = $this->getFrontendInput(); + return array_replace_recursive( + parent::getUpdateProvider(), + [ + "{$frontendInput}_other_attribute_code" => [ + 'post_data' => [ + 'attribute_code' => 'text_attribute_update', + ], + 'expected_data' => [ + 'attribute_code' => 'image_attribute', + ], + ], + ] + ); + } + /** * @inheritdoc */ @@ -54,4 +78,55 @@ protected function getFrontendInput(): string { return 'media_image'; } + + /** + * @inheritdoc + */ + protected function getUpdatePostData(): array + { + return [ + 'frontend_label' => [ + Store::DEFAULT_STORE_ID => 'Decimal Attribute Update', + ], + 'frontend_input' => 'media_image', + 'is_global' => ScopedAttributeInterface::SCOPE_WEBSITE, + 'is_used_in_grid' => '1', + 'is_visible_in_grid' => '1', + 'is_filterable_in_grid' => '1', + ]; + } + + /** + * @inheritdoc + */ + protected function getUpdateExpectedData(): array + { + $updatePostData = $this->getUpdatePostData(); + return array_merge( + $updatePostData, + [ + 'frontend_label' => 'Decimal Attribute Update', + 'is_required' => '0', + 'attribute_code' => 'image_attribute', + 'default_value' => null, + 'is_unique' => '0', + 'frontend_class' => null, + 'is_searchable' => '0', + 'search_weight' => '1', + 'is_visible_in_advanced_search' => '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' => '1', + 'used_for_sort_by' => '0', + 'is_user_defined' => '1', + 'backend_type' => 'varchar', + 'frontend_model' => Image::class, + ] + ); + } } diff --git a/dev/tests/integration/framework/Magento/TestFramework/Catalog/Model/Product/Attribute/DataProvider/Price.php b/dev/tests/integration/framework/Magento/TestFramework/Catalog/Model/Product/Attribute/DataProvider/Price.php deleted file mode 100644 index 04ee6bb0a5740..0000000000000 --- a/dev/tests/integration/framework/Magento/TestFramework/Catalog/Model/Product/Attribute/DataProvider/Price.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -declare(strict_types=1); - -namespace Magento\TestFramework\Catalog\Model\Product\Attribute\DataProvider; - -use Magento\TestFramework\Eav\Model\Attribute\DataProvider\AbstractBaseAttributeData; - -/** - * Product attribute data for attribute with input type weee. - */ -class Price extends AbstractBaseAttributeData -{ - /** - * @inheritdoc - */ - public function __construct() - { - parent::__construct(); - $this->defaultAttributePostData['is_filterable'] = '0'; - $this->defaultAttributePostData['is_filterable_in_search'] = '0'; - $this->defaultAttributePostData['used_for_sort_by'] = '0'; - } - - /** - * @inheritdoc - */ - public function getAttributeData(): array - { - $result = parent::getAttributeData(); - unset($result["{$this->getFrontendInput()}_with_default_value"]); - unset($result["{$this->getFrontendInput()}_without_default_value"]); - - return $result; - } - - /** - * @inheritdoc - */ - public function getAttributeDataWithCheckArray(): array - { - $result = parent::getAttributeDataWithCheckArray(); - unset($result["{$this->getFrontendInput()}_with_default_value"]); - unset($result["{$this->getFrontendInput()}_without_default_value"]); - - return $result; - } - - /** - * @inheritdoc - */ - protected function getFrontendInput(): string - { - return 'price'; - } -} diff --git a/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/AbstractAttributeDataWithOptions.php b/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/AbstractAttributeDataWithOptions.php index 8f25651e2e036..affd063d99ab5 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/AbstractAttributeDataWithOptions.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/AbstractAttributeDataWithOptions.php @@ -7,6 +7,8 @@ namespace Magento\TestFramework\Eav\Model\Attribute\DataProvider; +use Magento\Store\Model\Store; + /** * Base POST data for create attribute with options. */ @@ -72,6 +74,67 @@ public function getAttributeDataWithCheckArray(): array return $result; } + /** + * Return product attribute data set for update attribute options. + * + * @return array + */ + public function getUpdateOptionsProvider(): array + { + $frontendInput = $this->getFrontendInput(); + return [ + "{$frontendInput}_update_options" => [ + 'post_data' => [ + 'options_array' => [ + 'option_1' => [ + 'order' => '5', + 'value' => [ + Store::DEFAULT_STORE_ID => 'Option 1 Admin', + 'default' => 'Option 1 Store 1', + 'fixture_second_store' => 'Option 1 Store 2', + 'fixture_third_store' => 'Option 1 Store 3', + ], + 'delete' => '', + ], + 'option_2' => [ + 'order' => '6', + 'value' => [ + Store::DEFAULT_STORE_ID => 'Option 2 Admin', + 'default' => 'Option 2 Store 1', + 'fixture_second_store' => 'Option 2 Store 2', + 'fixture_third_store' => 'Option 2 Store 3', + ], + 'delete' => '', + 'default' => 1, + ], + ], + ], + ], + "{$frontendInput}_delete_options" => [ + 'post_data' => [ + 'options_array' => [ + 'option_1' => [ + 'value' => [], + 'delete' => '', + ], + 'option_2' => [ + 'value' => [], + 'delete' => '1', + ], + 'option_3' => [ + 'value' => [], + 'delete' => '', + ], + 'option_4' => [ + 'value' => [], + 'delete' => '1', + ], + ], + ], + ], + ]; + } + /** * Return attribute options data. * diff --git a/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/AbstractBaseAttributeData.php b/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/AbstractBaseAttributeData.php index af9e58d02fb5a..cd93e57a849cf 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/AbstractBaseAttributeData.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/AbstractBaseAttributeData.php @@ -8,6 +8,7 @@ namespace Magento\TestFramework\Eav\Model\Attribute\DataProvider; use Magento\Store\Model\Store; +use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface; /** * Base POST data for create attribute. @@ -28,7 +29,7 @@ abstract class AbstractBaseAttributeData 'dropdown_attribute_validation' => '', 'dropdown_attribute_validation_unique' => '', 'attribute_code' => '', - 'is_global' => '0', + 'is_global' => ScopedAttributeInterface::SCOPE_STORE, 'default_value_text' => '', 'default_value_yesno' => '0', 'default_value_date' => '', @@ -68,10 +69,10 @@ public function getAttributeData(): array $this->defaultAttributePostData, ], "{$this->getFrontendInput()}_with_global_scope" => [ - array_merge($this->defaultAttributePostData, ['is_global' => '1']), + array_merge($this->defaultAttributePostData, ['is_global' => ScopedAttributeInterface::SCOPE_GLOBAL]), ], "{$this->getFrontendInput()}_with_website_scope" => [ - array_merge($this->defaultAttributePostData, ['is_global' => '2']), + array_merge($this->defaultAttributePostData, ['is_global' => ScopedAttributeInterface::SCOPE_WEBSITE]), ], "{$this->getFrontendInput()}_with_attribute_code" => [ array_merge($this->defaultAttributePostData, ['attribute_code' => 'test_custom_attribute_code']), @@ -143,19 +144,19 @@ public function getAttributeDataWithCheckArray(): array "{$this->getFrontendInput()}_with_store_view_scope" => [ [ 'attribute_code' => 'test_attribute_name', - 'is_global' => '0', + 'is_global' => ScopedAttributeInterface::SCOPE_STORE, ], ], "{$this->getFrontendInput()}_with_global_scope" => [ [ 'attribute_code' => 'test_attribute_name', - 'is_global' => '1', + 'is_global' => ScopedAttributeInterface::SCOPE_GLOBAL, ], ], "{$this->getFrontendInput()}_with_website_scope" => [ [ 'attribute_code' => 'test_attribute_name', - 'is_global' => '2', + 'is_global' => ScopedAttributeInterface::SCOPE_WEBSITE, ], ], "{$this->getFrontendInput()}_with_attribute_code" => [ @@ -215,10 +216,173 @@ public function getAttributeDataWithCheckArray(): array ); } + /** + * Return product attribute data set for update attribute. + * + * @return array + */ + public function getUpdateProvider(): array + { + $frontendInput = $this->getFrontendInput(); + return [ + "{$frontendInput}_update_all_fields" => [ + 'post_data' => $this->getUpdatePostData(), + 'expected_data' => $this->getUpdateExpectedData(), + ], + "{$frontendInput}_other_is_user_defined" => [ + 'post_data' => [ + 'is_user_defined' => '2', + ], + 'expected_data' => [ + 'is_user_defined' => '1', + ], + ], + "{$frontendInput}_with_is_global_null" => [ + 'post_data' => [ + 'is_global' => null, + ], + 'expected_data' => [ + 'is_global' => ScopedAttributeInterface::SCOPE_GLOBAL, + ], + ], + "{$frontendInput}_is_visible_in_advanced_search" => [ + 'post_data' => [ + 'is_searchable' => '0', + 'is_visible_in_advanced_search' => '1', + ], + 'expected_data' => [ + 'is_searchable' => '0', + 'is_visible_in_advanced_search' => '0', + ], + ], + "{$frontendInput}_update_with_attribute_set" => [ + 'post_data' => [ + 'set' => '4', + 'new_attribute_set_name' => 'Text Attribute Set', + 'group' => 'text_attribute_group', + 'groupName' => 'Text Attribute Group', + 'groupSortOrder' => '1', + ], + 'expected_data' => [], + ], + ]; + } + + /** + * Return product attribute data set with error message for update attribute. + * + * @return array + */ + public function getUpdateProviderWithErrorMessage(): array + { + $frontendInput = $this->getFrontendInput(); + return [ + "{$frontendInput}_same_attribute_set_name" => [ + 'post_data' => [ + 'set' => '4', + 'new_attribute_set_name' => 'Default', + ], + 'error_message' => (string)__('An attribute set named \'Default\' already exists.'), + ], + "{$frontendInput}_empty_set_id" => [ + 'post_data' => [ + 'set' => '', + 'new_attribute_set_name' => 'Text Attribute Set', + ], + 'error_message' => (string)__('Something went wrong while saving the attribute.'), + ], + "{$frontendInput}_nonexistent_attribute_id" => [ + 'post_data' => [ + 'attribute_id' => 9999, + ], + 'error_message' => (string)__('This attribute no longer exists.'), + ], + "{$frontendInput}_attribute_other_entity_type" => [ + 'post_data' => [ + 'attribute_id' => 45, + ], + 'error_message' => (string)__('We can\'t update the attribute.'), + ], + ]; + } + + /** + * Return product attribute data set for update attribute frontend labels. + * + * @return array + */ + public function getUpdateFrontendLabelsProvider(): array + { + $frontendInput = $this->getFrontendInput(); + return [ + "{$frontendInput}_update_frontend_label" => [ + 'post_data' => [ + 'frontend_label' => [ + Store::DEFAULT_STORE_ID => 'Test Attribute Update', + 'default' => 'Default Store Update', + 'fixture_second_store' => 'Second Store Update', + 'fixture_third_store' => 'Third Store Update', + ] + ], + 'expected_data' => [ + 'frontend_label' => 'Test Attribute Update', + 'store_labels' => [ + 'default' => 'Default Store Update', + 'fixture_second_store' => 'Second Store Update', + 'fixture_third_store' => 'Third Store Update', + ], + ], + ], + "{$frontendInput}_remove_frontend_label" => [ + 'post_data' => [ + 'frontend_label' => [ + Store::DEFAULT_STORE_ID => 'Test Attribute Update', + 'default' => 'Default Store Update', + 'fixture_second_store' => '', + 'fixture_third_store' => '', + ] + ], + 'expected_data' => [ + 'frontend_label' => 'Test Attribute Update', + 'store_labels' => [ + 'default' => 'Default Store Update', + ], + ], + ], + "{$frontendInput}_with_frontend_label_string" => [ + 'post_data' => [ + 'frontend_label' => 'Test Attribute Update', + ], + 'expected_data' => [ + 'frontend_label' => 'Test Attribute Update', + 'store_labels' => [ + 'default' => 'Default Store View', + 'fixture_second_store' => 'Fixture Second Store', + 'fixture_third_store' => 'Fixture Third Store', + ], + ], + ], + ]; + } + /** * Return attribute frontend input. * * @return string */ abstract protected function getFrontendInput(): string; + + /** + * Return post data for attribute update. + * + * @return array + */ + abstract protected function getUpdatePostData(): array; + + /** + * Return expected data for attribute update. + * + * @return array + */ + abstract protected function getUpdateExpectedData(): array; } diff --git a/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/Date.php b/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/Date.php index 7a6f8ee41c1f8..3c6caddfdb95c 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/Date.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/Date.php @@ -7,6 +7,9 @@ namespace Magento\TestFramework\Eav\Model\Attribute\DataProvider; +use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface; +use Magento\Store\Model\Store; + /** * Product attribute data for attribute with input type date. */ @@ -56,6 +59,46 @@ public function getAttributeDataWithCheckArray(): array ); } + /** + * @inheritdoc + */ + public function getUpdateProvider(): array + { + $frontendInput = $this->getFrontendInput(); + return array_replace_recursive( + parent::getUpdateProvider(), + [ + "{$frontendInput}_other_attribute_code" => [ + 'post_data' => [ + 'attribute_code' => 'text_attribute_update', + ], + 'expected_data' => [ + 'attribute_code' => 'date_attribute', + ], + ], + ] + ); + } + + /** + * @inheritdoc + */ + public function getUpdateProviderWithErrorMessage(): array + { + $frontendInput = $this->getFrontendInput(); + return array_replace_recursive( + parent::getUpdateProviderWithErrorMessage(), + [ + "{$frontendInput}_wrong_default_value" => [ + 'post_data' => [ + 'default_value_date' => '2019//12//12', + ], + 'error_message' => (string)__('The default date is invalid. Verify the date and try again.'), + ], + ] + ); + } + /** * @inheritdoc */ @@ -63,4 +106,56 @@ protected function getFrontendInput(): string { return 'date'; } + + /** + * @inheritdoc + */ + protected function getUpdatePostData(): array + { + return [ + 'frontend_label' => [ + Store::DEFAULT_STORE_ID => 'Date Attribute Update', + ], + 'frontend_input' => 'date', + 'is_required' => '1', + 'is_global' => ScopedAttributeInterface::SCOPE_WEBSITE, + 'default_value_date' => '12/29/2019', + 'is_unique' => '1', + 'is_used_in_grid' => '1', + 'is_visible_in_grid' => '1', + 'is_filterable_in_grid' => '1', + 'is_searchable' => '1', + 'search_weight' => '2', + 'is_visible_in_advanced_search' => '1', + 'is_comparable' => '1', + 'is_used_for_promo_rules' => '1', + 'is_html_allowed_on_front' => '1', + 'is_visible_on_front' => '1', + 'used_in_product_listing' => '0', + 'used_for_sort_by' => '1', + ]; + } + + /** + * @inheritdoc + */ + protected function getUpdateExpectedData(): array + { + $updatePostData = $this->getUpdatePostData(); + unset($updatePostData['default_value_date']); + return array_merge( + $updatePostData, + [ + 'frontend_label' => 'Date Attribute Update', + 'attribute_code' => 'date_attribute', + 'default_value' => '2019-12-29 00:00:00', + 'frontend_class' => null, + 'is_filterable' => '0', + 'is_filterable_in_search' => '0', + 'position' => '0', + 'is_user_defined' => '1', + 'backend_type' => 'datetime', + ] + ); + } } diff --git a/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/DropDown.php b/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/DropDown.php index 3c1acb5a33a54..8366b13760795 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/DropDown.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/DropDown.php @@ -7,6 +7,9 @@ namespace Magento\TestFramework\Eav\Model\Attribute\DataProvider; +use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface; +use Magento\Store\Model\Store; + /** * Product attribute data for attribute with input type dropdown. */ @@ -22,6 +25,27 @@ public function __construct() $this->defaultAttributePostData['swatch_input_type'] = 'dropdown'; } + /** + * @inheritdoc + */ + public function getUpdateProvider(): array + { + $frontendInput = $this->getFrontendInput(); + return array_replace_recursive( + parent::getUpdateProvider(), + [ + "{$frontendInput}_other_attribute_code" => [ + 'post_data' => [ + 'attribute_code' => 'text_attribute_update', + ], + 'expected_data' => [ + 'attribute_code' => 'dropdown_attribute', + ], + ], + ] + ); + } + /** * @inheritdoc */ @@ -29,4 +53,54 @@ protected function getFrontendInput(): string { return 'select'; } + + /** + * @inheritdoc + */ + protected function getUpdatePostData(): array + { + return [ + 'frontend_label' => [ + Store::DEFAULT_STORE_ID => 'Drop-Down Attribute Update', + ], + 'frontend_input' => 'select', + 'is_required' => '1', + 'is_global' => ScopedAttributeInterface::SCOPE_WEBSITE, + 'is_unique' => '1', + 'is_used_in_grid' => '1', + 'is_visible_in_grid' => '1', + 'is_filterable_in_grid' => '1', + 'is_searchable' => '1', + 'search_weight' => '2', + 'is_visible_in_advanced_search' => '1', + 'is_comparable' => '1', + 'is_filterable' => '2', + 'is_filterable_in_search' => '1', + 'position' => '2', + 'is_used_for_promo_rules' => '1', + 'is_html_allowed_on_front' => '0', + 'is_visible_on_front' => '0', + 'used_in_product_listing' => '0', + 'used_for_sort_by' => '1', + ]; + } + + /** + * @inheritdoc + */ + protected function getUpdateExpectedData(): array + { + $updatePostData = $this->getUpdatePostData(); + return array_merge( + $updatePostData, + [ + 'frontend_label' => 'Drop-Down Attribute Update', + 'attribute_code' => 'dropdown_attribute', + 'default_value' => null, + 'frontend_class' => null, + 'is_user_defined' => '1', + 'backend_type' => 'varchar', + ] + ); + } } diff --git a/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/MultipleSelect.php b/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/MultipleSelect.php index 5fb5f745aebdc..4d72f5b316ea0 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/MultipleSelect.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/MultipleSelect.php @@ -7,11 +7,35 @@ namespace Magento\TestFramework\Eav\Model\Attribute\DataProvider; +use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface; +use Magento\Store\Model\Store; + /** * Product attribute data for attribute with input type multiple select. */ class MultipleSelect extends AbstractAttributeDataWithOptions { + /** + * @inheritdoc + */ + public function getUpdateProvider(): array + { + $frontendInput = $this->getFrontendInput(); + return array_replace_recursive( + parent::getUpdateProvider(), + [ + "{$frontendInput}_other_attribute_code" => [ + 'post_data' => [ + 'attribute_code' => 'text_attribute_update', + ], + 'expected_data' => [ + 'attribute_code' => 'multiselect_attribute', + ], + ], + ] + ); + } + /** * @inheritdoc */ @@ -19,4 +43,54 @@ protected function getFrontendInput(): string { return 'multiselect'; } + + /** + * @inheritdoc + */ + protected function getUpdatePostData(): array + { + return [ + 'frontend_label' => [ + Store::DEFAULT_STORE_ID => 'Multiselect Attribute Update', + ], + 'frontend_input' => 'multiselect', + 'is_required' => '1', + 'is_global' => ScopedAttributeInterface::SCOPE_WEBSITE, + 'is_unique' => '1', + 'is_used_in_grid' => '1', + 'is_visible_in_grid' => '1', + 'is_filterable_in_grid' => '1', + 'is_searchable' => '1', + 'search_weight' => '2', + 'is_visible_in_advanced_search' => '1', + 'is_comparable' => '1', + 'is_filterable' => '2', + 'is_filterable_in_search' => '1', + 'position' => '2', + 'is_used_for_promo_rules' => '1', + 'is_html_allowed_on_front' => '0', + 'is_visible_on_front' => '1', + 'used_in_product_listing' => '1', + ]; + } + + /** + * @inheritdoc + */ + protected function getUpdateExpectedData(): array + { + $updatePostData = $this->getUpdatePostData(); + return array_merge( + $updatePostData, + [ + 'frontend_label' => 'Multiselect Attribute Update', + 'attribute_code' => 'multiselect_attribute', + 'default_value' => null, + 'frontend_class' => null, + 'used_for_sort_by' => '0', + 'is_user_defined' => '1', + 'backend_type' => 'varchar', + ] + ); + } } diff --git a/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/Text.php b/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/Text.php index 5b37248e27361..654e31a0f4528 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/Text.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/Text.php @@ -7,6 +7,9 @@ namespace Magento\TestFramework\Eav\Model\Attribute\DataProvider; +use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface; +use Magento\Store\Model\Store; + /** * Product attribute data for attribute with input type text. */ @@ -64,6 +67,27 @@ public function getAttributeDataWithCheckArray(): array ); } + /** + * @inheritdoc + */ + public function getUpdateProvider(): array + { + $frontendInput = $this->getFrontendInput(); + return array_replace_recursive( + parent::getUpdateProvider(), + [ + "{$frontendInput}_other_attribute_code" => [ + 'post_data' => [ + 'attribute_code' => 'varchar_attribute_update', + ], + 'expected_data' => [ + 'attribute_code' => 'varchar_attribute', + ], + ], + ] + ); + } + /** * @inheritdoc */ @@ -71,4 +95,56 @@ protected function getFrontendInput(): string { return 'text'; } + + /** + * @inheritdoc + */ + protected function getUpdatePostData(): array + { + return [ + 'frontend_label' => [ + Store::DEFAULT_STORE_ID => 'Varchar Attribute Update', + ], + 'is_required' => '1', + 'is_global' => ScopedAttributeInterface::SCOPE_WEBSITE, + 'default_value_text' => 'Varchar Attribute Default', + 'is_unique' => '1', + 'frontend_class' => 'validate-alphanum', + 'is_used_in_grid' => '1', + 'is_visible_in_grid' => '1', + 'is_filterable_in_grid' => '1', + 'is_searchable' => '1', + 'search_weight' => '2', + 'is_visible_in_advanced_search' => '1', + 'is_comparable' => '1', + 'is_used_for_promo_rules' => '1', + 'is_html_allowed_on_front' => '0', + 'is_visible_on_front' => '1', + 'used_in_product_listing' => '0', + 'used_for_sort_by' => '1', + ]; + } + + /** + * @inheritdoc + */ + protected function getUpdateExpectedData(): array + { + $updatePostData = $this->getUpdatePostData(); + unset($updatePostData['default_value_text']); + return array_merge( + $updatePostData, + [ + 'frontend_label' => 'Varchar Attribute Update', + 'frontend_input' => 'text', + 'attribute_code' => 'varchar_attribute', + 'default_value' => 'Varchar Attribute Default', + 'is_filterable' => '0', + 'is_filterable_in_search' => '0', + 'position' => '0', + 'is_user_defined' => '1', + 'backend_type' => 'varchar', + ] + ); + } } diff --git a/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/TextArea.php b/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/TextArea.php index 7588b12700272..2b9414fe01390 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/TextArea.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/TextArea.php @@ -7,6 +7,9 @@ namespace Magento\TestFramework\Eav\Model\Attribute\DataProvider; +use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface; +use Magento\Store\Model\Store; + /** * Product attribute data for attribute with text area input type. */ @@ -30,6 +33,36 @@ public function getAttributeData(): array ); } + /** + * @inheritdoc + */ + public function getUpdateProvider(): array + { + $frontendInput = $this->getFrontendInput(); + return array_replace_recursive( + parent::getUpdateProvider(), + [ + "{$frontendInput}_other_attribute_code" => [ + 'post_data' => [ + 'attribute_code' => 'text_attribute_update', + ], + 'expected_data' => [ + 'attribute_code' => 'text_attribute', + ], + ], + "{$frontendInput}_change_frontend_input" => [ + 'post_data' => [ + 'frontend_input' => 'texteditor', + ], + 'expected_data' => [ + 'frontend_input' => 'textarea', + 'is_wysiwyg_enabled' => '1' + ], + ], + ] + ); + } + /** * @inheritdoc */ @@ -37,4 +70,57 @@ protected function getFrontendInput(): string { return 'textarea'; } + + /** + * @inheritdoc + */ + protected function getUpdatePostData(): array + { + return [ + 'frontend_label' => [ + Store::DEFAULT_STORE_ID => 'Text Attribute Update', + ], + 'frontend_input' => 'textarea', + 'is_required' => '1', + 'is_global' => ScopedAttributeInterface::SCOPE_WEBSITE, + 'default_value_textarea' => 'Text Attribute Default', + 'is_unique' => '1', + 'is_used_in_grid' => '1', + 'is_visible_in_grid' => '1', + 'is_filterable_in_grid' => '1', + 'is_searchable' => '1', + 'search_weight' => '2', + 'is_visible_in_advanced_search' => '1', + 'is_comparable' => '1', + 'is_used_for_promo_rules' => '1', + 'is_html_allowed_on_front' => '1', + 'is_visible_on_front' => '1', + 'used_in_product_listing' => '1', + ]; + } + + /** + * @inheritdoc + */ + protected function getUpdateExpectedData(): array + { + $updatePostData = $this->getUpdatePostData(); + unset($updatePostData['default_value_textarea']); + return array_merge( + $updatePostData, + [ + 'frontend_label' => 'Text Attribute Update', + 'attribute_code' => 'text_attribute', + 'default_value' => 'Text Attribute Default', + 'frontend_class' => null, + 'is_filterable' => '0', + 'is_filterable_in_search' => '0', + 'position' => '0', + 'used_for_sort_by' => '0', + 'is_user_defined' => '1', + 'backend_type' => 'text', + 'is_wysiwyg_enabled' => '0', + ] + ); + } } diff --git a/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/TextEditor.php b/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/TextEditor.php index d7a6276c1720f..282031e4377a5 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/TextEditor.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/TextEditor.php @@ -7,6 +7,9 @@ namespace Magento\TestFramework\Eav\Model\Attribute\DataProvider; +use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface; +use Magento\Store\Model\Store; + /** * Product attribute data for attribute with text editor input type. */ @@ -116,6 +119,36 @@ public function getAttributeDataWithCheckArray(): array ); } + /** + * @inheritdoc + */ + public function getUpdateProvider(): array + { + $frontendInput = $this->getFrontendInput(); + return array_replace_recursive( + parent::getUpdateProvider(), + [ + "{$frontendInput}_other_attribute_code" => [ + 'post_data' => [ + 'attribute_code' => 'text_attribute_update', + ], + 'expected_data' => [ + 'attribute_code' => 'text_editor_attribute', + ], + ], + "{$frontendInput}_change_frontend_input" => [ + 'post_data' => [ + 'frontend_input' => 'textarea', + ], + 'expected_data' => [ + 'frontend_input' => 'textarea', + 'is_wysiwyg_enabled' => '0' + ], + ], + ] + ); + } + /** * @inheritdoc */ @@ -123,4 +156,58 @@ protected function getFrontendInput(): string { return 'texteditor'; } + + /** + * @inheritdoc + */ + protected function getUpdatePostData(): array + { + return [ + 'frontend_label' => [ + Store::DEFAULT_STORE_ID => 'Text Editor Attribute Update', + ], + 'frontend_input' => 'texteditor', + 'is_required' => '1', + 'is_global' => ScopedAttributeInterface::SCOPE_WEBSITE, + 'default_value_textarea' => 'Text Editor Attribute Default', + 'is_unique' => '1', + 'is_used_in_grid' => '1', + 'is_visible_in_grid' => '1', + 'is_filterable_in_grid' => '1', + 'is_searchable' => '1', + 'search_weight' => '2', + 'is_visible_in_advanced_search' => '1', + 'is_comparable' => '1', + 'is_used_for_promo_rules' => '1', + 'is_html_allowed_on_front' => '1', + 'is_visible_on_front' => '1', + 'used_in_product_listing' => '1', + 'used_for_sort_by' => '1', + ]; + } + + /** + * @inheritdoc + */ + protected function getUpdateExpectedData(): array + { + $updatePostData = $this->getUpdatePostData(); + unset($updatePostData['default_value_textarea']); + return array_merge( + $updatePostData, + [ + 'frontend_label' => 'Text Editor Attribute Update', + 'frontend_input' => 'textarea', + 'attribute_code' => 'text_editor_attribute', + 'default_value' => 'Text Editor Attribute Default', + 'frontend_class' => null, + 'is_filterable' => '0', + 'is_filterable_in_search' => '0', + 'position' => '0', + 'is_user_defined' => '1', + 'backend_type' => 'text', + 'is_wysiwyg_enabled' => '1', + ] + ); + } } diff --git a/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/YesNo.php b/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/YesNo.php index 8fece70f0273c..28428b38be009 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/YesNo.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/YesNo.php @@ -7,6 +7,9 @@ namespace Magento\TestFramework\Eav\Model\Attribute\DataProvider; +use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface; +use Magento\Store\Model\Store; + /** * Product attribute data for attribute with yes/no input type. */ @@ -58,6 +61,27 @@ public function getAttributeDataWithCheckArray(): array ); } + /** + * @inheritdoc + */ + public function getUpdateProvider(): array + { + $frontendInput = $this->getFrontendInput(); + return array_replace_recursive( + parent::getUpdateProvider(), + [ + "{$frontendInput}_other_attribute_code" => [ + 'post_data' => [ + 'attribute_code' => 'text_attribute_update', + ], + 'expected_data' => [ + 'attribute_code' => 'boolean_attribute', + ], + ], + ] + ); + } + /** * @inheritdoc */ @@ -65,4 +89,56 @@ protected function getFrontendInput(): string { return 'boolean'; } + + /** + * @inheritdoc + */ + protected function getUpdatePostData(): array + { + return [ + 'frontend_label' => [ + Store::DEFAULT_STORE_ID => 'Boolean Attribute Update', + ], + 'frontend_input' => 'boolean', + 'is_required' => '1', + 'is_global' => ScopedAttributeInterface::SCOPE_WEBSITE, + 'default_value_yesno' => '1', + 'is_unique' => '1', + 'is_used_in_grid' => '1', + 'is_visible_in_grid' => '1', + 'is_filterable_in_grid' => '1', + 'is_searchable' => '1', + 'search_weight' => '2', + 'is_visible_in_advanced_search' => '0', + 'is_comparable' => '1', + 'is_filterable' => '2', + 'is_filterable_in_search' => '0', + 'position' => '2', + 'is_used_for_promo_rules' => '1', + 'is_html_allowed_on_front' => '0', + 'is_visible_on_front' => '0', + 'used_in_product_listing' => '0', + 'used_for_sort_by' => '1', + ]; + } + + /** + * @inheritdoc + */ + protected function getUpdateExpectedData(): array + { + $updatePostData = $this->getUpdatePostData(); + unset($updatePostData['default_value_yesno']); + return array_merge( + $updatePostData, + [ + 'frontend_label' => 'Boolean Attribute Update', + 'attribute_code' => 'boolean_attribute', + 'default_value' => '1', + 'frontend_class' => null, + 'is_user_defined' => '1', + 'backend_type' => 'int', + ] + ); + } } diff --git a/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/ResourceModel/GetEntityIdByAttributeId.php b/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/ResourceModel/GetEntityIdByAttributeId.php index edb75a5d8d1bd..76235b3392684 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/ResourceModel/GetEntityIdByAttributeId.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/ResourceModel/GetEntityIdByAttributeId.php @@ -33,16 +33,24 @@ public function __construct( * * @param int $setId * @param int $attributeId + * @param int|null $attributeGroupId * @return int|null */ - public function execute(int $setId, int $attributeId): ?int + public function execute(int $setId, int $attributeId, ?int $attributeGroupId = null): ?int { $select = $this->attributeSetResource->getConnection()->select() - ->from($this->attributeSetResource->getTable('eav_entity_attribute')) + ->from( + $this->attributeSetResource->getTable('eav_entity_attribute'), + 'entity_attribute_id' + ) ->where('attribute_set_id = ?', $setId) ->where('attribute_id = ?', $attributeId); - $result = $this->attributeSetResource->getConnection()->fetchOne($select); - return $result ? (int)$result : null; + if ($attributeGroupId !== null) { + $select->where('attribute_group_id = ?', $attributeGroupId); + } + $entityAttributeId = $this->attributeSetResource->getConnection()->fetchOne($select); + + return $entityAttributeId ? (int)$entityAttributeId : null; } } diff --git a/dev/tests/integration/framework/Magento/TestFramework/Swatches/Model/Attribute/DataProvider/TextSwatch.php b/dev/tests/integration/framework/Magento/TestFramework/Swatches/Model/Attribute/DataProvider/TextSwatch.php index c63873469e2f8..bb705b5503c39 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Swatches/Model/Attribute/DataProvider/TextSwatch.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Swatches/Model/Attribute/DataProvider/TextSwatch.php @@ -7,7 +7,9 @@ namespace Magento\TestFramework\Swatches\Model\Attribute\DataProvider; +use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface; use Magento\Swatches\Model\Swatch; +use Magento\Store\Model\Store; /** * Product attribute data for attribute with input type visual swatch. @@ -90,6 +92,88 @@ public function getAttributeDataWithCheckArray(): array ); } + /** + * @inheritdoc + */ + public function getUpdateProvider(): array + { + $frontendInput = $this->getFrontendInput(); + return array_replace_recursive( + parent::getUpdateProvider(), + [ + "{$frontendInput}_other_attribute_code" => [ + 'post_data' => [ + 'attribute_code' => 'text_attribute_update', + ], + 'expected_data' => [ + 'attribute_code' => 'text_swatch_attribute', + ], + ], + "{$frontendInput}_change_frontend_input_swatch_visual" => [ + 'post_data' => [ + 'frontend_input' => Swatch::SWATCH_TYPE_VISUAL_ATTRIBUTE_FRONTEND_INPUT, + 'update_product_preview_image' => '1', + 'use_product_image_for_swatch' => '1', + ], + 'expected_data' => [ + 'frontend_input' => 'select', + 'swatch_input_type' => Swatch::SWATCH_INPUT_TYPE_VISUAL, + 'update_product_preview_image' => '1', + 'use_product_image_for_swatch' => '1', + ], + ], + "{$frontendInput}_change_frontend_input_dropdown" => [ + 'post_data' => [ + 'frontend_input' => 'select', + ], + 'expected_data' => [ + 'frontend_input' => 'select', + 'swatch_input_type' => null, + 'update_product_preview_image' => null, + 'use_product_image_for_swatch' => null, + ], + ], + ] + ); + } + + /** + * @inheritdoc + */ + public function getUpdateOptionsProvider(): array + { + $frontendInput = $this->getFrontendInput(); + return array_replace_recursive( + parent::getUpdateOptionsProvider(), + [ + "{$frontendInput}_update_options" => [ + 'post_data' => [ + 'options_array' => [ + 'option_1' => [ + 'order' => '4', + 'swatch' => [ + Store::DEFAULT_STORE_ID => 'Swatch 1 Admin', + 'default' => 'Swatch 1 Store 1', + 'fixture_second_store' => 'Swatch 1 Store 2', + 'fixture_third_store' => 'Swatch 1 Store 3', + ], + ], + 'option_2' => [ + 'order' => '5', + 'swatch' => [ + Store::DEFAULT_STORE_ID => 'Swatch 2 Admin', + 'default' => 'Swatch 2 Store 1', + 'fixture_second_store' => 'Swatch 2 Store 2', + 'fixture_third_store' => 'Swatch 2 Store 3', + ], + ], + ], + ], + ], + ] + ); + } + /** * @inheritdoc */ @@ -157,4 +241,56 @@ protected function getFrontendInput(): string { return Swatch::SWATCH_TYPE_TEXTUAL_ATTRIBUTE_FRONTEND_INPUT; } + + /** + * @inheritdoc + */ + protected function getUpdatePostData(): array + { + return [ + 'frontend_label' => [ + Store::DEFAULT_STORE_ID => 'Text swatch attribute Update', + ], + 'frontend_input' => Swatch::SWATCH_TYPE_TEXTUAL_ATTRIBUTE_FRONTEND_INPUT, + 'is_required' => '1', + 'update_product_preview_image' => '1', + 'is_global' => ScopedAttributeInterface::SCOPE_WEBSITE, + 'is_unique' => '1', + 'is_used_in_grid' => '1', + 'is_visible_in_grid' => '1', + 'is_filterable_in_grid' => '1', + 'is_searchable' => '1', + 'search_weight' => '2', + 'is_visible_in_advanced_search' => '1', + 'is_comparable' => '1', + 'is_filterable' => '2', + 'is_filterable_in_search' => '1', + 'position' => '2', + 'is_used_for_promo_rules' => '1', + 'is_visible_on_front' => '1', + 'used_in_product_listing' => '0', + 'used_for_sort_by' => '1', + ]; + } + + /** + * @inheritdoc + */ + protected function getUpdateExpectedData(): array + { + $updatePostData = $this->getUpdatePostData(); + return array_merge( + $updatePostData, + [ + 'frontend_label' => 'Text swatch attribute Update', + 'frontend_input' => 'select', + 'attribute_code' => 'text_swatch_attribute', + 'default_value' => null, + 'frontend_class' => null, + 'is_html_allowed_on_front' => '1', + 'is_user_defined' => '1', + 'backend_type' => 'int', + ] + ); + } } diff --git a/dev/tests/integration/framework/Magento/TestFramework/Swatches/Model/Attribute/DataProvider/VisualSwatch.php b/dev/tests/integration/framework/Magento/TestFramework/Swatches/Model/Attribute/DataProvider/VisualSwatch.php index b5e32c40ef8a1..c5195d7d1d1a4 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Swatches/Model/Attribute/DataProvider/VisualSwatch.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Swatches/Model/Attribute/DataProvider/VisualSwatch.php @@ -7,7 +7,9 @@ namespace Magento\TestFramework\Swatches\Model\Attribute\DataProvider; +use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface; use Magento\Swatches\Model\Swatch; +use Magento\Store\Model\Store; /** * Product attribute data for attribute with input type visual swatch. @@ -90,6 +92,81 @@ public function getAttributeDataWithCheckArray(): array ); } + /** + * @inheritdoc + */ + public function getUpdateProvider(): array + { + $frontendInput = $this->getFrontendInput(); + return array_replace_recursive( + parent::getUpdateProvider(), + [ + "{$frontendInput}_other_attribute_code" => [ + 'post_data' => [ + 'attribute_code' => 'text_attribute_update', + ], + 'expected_data' => [ + 'attribute_code' => 'visual_swatch_attribute', + ], + ], + "{$frontendInput}_change_frontend_input_swatch_text" => [ + 'post_data' => [ + 'frontend_input' => Swatch::SWATCH_TYPE_TEXTUAL_ATTRIBUTE_FRONTEND_INPUT, + 'update_product_preview_image' => '1', + ], + 'expected_data' => [ + 'frontend_input' => 'select', + 'swatch_input_type' => Swatch::SWATCH_INPUT_TYPE_TEXT, + 'update_product_preview_image' => '1', + 'use_product_image_for_swatch' => 0, + ], + ], + "{$frontendInput}_change_frontend_input_dropdown" => [ + 'post_data' => [ + 'frontend_input' => 'select', + ], + 'expected_data' => [ + 'frontend_input' => 'select', + 'swatch_input_type' => null, + 'update_product_preview_image' => null, + 'use_product_image_for_swatch' => null, + ], + ], + ] + ); + } + + /** + * @inheritdoc + */ + public function getUpdateOptionsProvider(): array + { + $frontendInput = $this->getFrontendInput(); + return array_replace_recursive( + parent::getUpdateOptionsProvider(), + [ + "{$frontendInput}_update_options" => [ + 'post_data' => [ + 'options_array' => [ + 'option_1' => [ + 'order' => '4', + 'swatch' => [ + Store::DEFAULT_STORE_ID => '#1a1a1a', + ], + ], + 'option_2' => [ + 'order' => '5', + 'swatch' => [ + Store::DEFAULT_STORE_ID => '#2b2b2b', + ], + ], + ], + ], + ], + ] + ); + } + /** * @inheritdoc */ @@ -148,4 +225,57 @@ protected function getFrontendInput(): string { return Swatch::SWATCH_TYPE_VISUAL_ATTRIBUTE_FRONTEND_INPUT; } + + /** + * @inheritdoc + */ + protected function getUpdatePostData(): array + { + return [ + 'frontend_label' => [ + Store::DEFAULT_STORE_ID => 'Visual swatch attribute Update', + ], + 'frontend_input' => Swatch::SWATCH_TYPE_VISUAL_ATTRIBUTE_FRONTEND_INPUT, + 'is_required' => '1', + 'update_product_preview_image' => '1', + 'use_product_image_for_swatch' => '1', + 'is_global' => ScopedAttributeInterface::SCOPE_WEBSITE, + 'is_unique' => '1', + 'is_used_in_grid' => '1', + 'is_visible_in_grid' => '1', + 'is_filterable_in_grid' => '1', + 'is_searchable' => '1', + 'search_weight' => '2', + 'is_visible_in_advanced_search' => '1', + 'is_comparable' => '1', + 'is_filterable' => '2', + 'is_filterable_in_search' => '1', + 'position' => '2', + 'is_used_for_promo_rules' => '1', + 'is_visible_on_front' => '1', + 'used_in_product_listing' => '0', + 'used_for_sort_by' => '1', + ]; + } + + /** + * @inheritdoc + */ + protected function getUpdateExpectedData(): array + { + $updatePostData = $this->getUpdatePostData(); + return array_merge( + $updatePostData, + [ + 'frontend_label' => 'Visual swatch attribute Update', + 'frontend_input' => 'select', + 'attribute_code' => 'visual_swatch_attribute', + 'default_value' => null, + 'frontend_class' => null, + 'is_html_allowed_on_front' => '1', + 'is_user_defined' => '1', + 'backend_type' => 'int', + ] + ); + } } diff --git a/dev/tests/integration/framework/Magento/TestFramework/Weee/Model/Attribute/DataProvider/FixedProductTax.php b/dev/tests/integration/framework/Magento/TestFramework/Weee/Model/Attribute/DataProvider/FixedProductTax.php index 2f1f625ad48ac..ab0b214ccc101 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Weee/Model/Attribute/DataProvider/FixedProductTax.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Weee/Model/Attribute/DataProvider/FixedProductTax.php @@ -7,7 +7,10 @@ namespace Magento\TestFramework\Weee\Model\Attribute\DataProvider; +use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface; use Magento\TestFramework\Eav\Model\Attribute\DataProvider\AbstractBaseAttributeData; +use Magento\Store\Model\Store; +use Magento\Weee\Model\Attribute\Backend\Weee\Tax; /** * Product attribute data for attribute with input type fixed product tax. @@ -47,6 +50,27 @@ public function getAttributeDataWithCheckArray(): array return $result; } + /** + * @inheritdoc + */ + public function getUpdateProvider(): array + { + $frontendInput = $this->getFrontendInput(); + return array_replace_recursive( + parent::getUpdateProvider(), + [ + "{$frontendInput}_other_attribute_code" => [ + 'post_data' => [ + 'attribute_code' => 'text_attribute_update', + ], + 'expected_data' => [ + 'attribute_code' => 'fixed_product_attribute', + ], + ], + ] + ); + } + /** * @inheritdoc */ @@ -54,4 +78,55 @@ protected function getFrontendInput(): string { return 'weee'; } + + /** + * @inheritdoc + */ + protected function getUpdatePostData(): array + { + return [ + 'frontend_label' => [ + Store::DEFAULT_STORE_ID => 'Fixed product tax Update', + ], + 'frontend_input' => 'weee', + 'is_used_in_grid' => '1', + 'is_visible_in_grid' => '1', + 'is_filterable_in_grid' => '1', + ]; + } + + /** + * @inheritdoc + */ + protected function getUpdateExpectedData(): array + { + $updatePostData = $this->getUpdatePostData(); + return array_merge( + $updatePostData, + [ + 'frontend_label' => 'Fixed product tax Update', + 'is_required' => '0', + 'attribute_code' => 'fixed_product_attribute', + 'is_global' => ScopedAttributeInterface::SCOPE_GLOBAL, + 'default_value' => null, + 'is_unique' => '0', + 'frontend_class' => null, + 'is_searchable' => '0', + 'search_weight' => '1', + 'is_visible_in_advanced_search' => '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' => '0', + 'is_visible_on_front' => '0', + 'used_in_product_listing' => '0', + 'used_for_sort_by' => '0', + 'is_user_defined' => '1', + 'backend_type' => 'static', + 'backend_model' => Tax::class, + ] + ); + } } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save/InputType/AbstractSaveAttributeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save/AbstractSaveAttributeTest.php similarity index 86% rename from dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save/InputType/AbstractSaveAttributeTest.php rename to dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save/AbstractSaveAttributeTest.php index d0f1256f1fdb7..91650d4b7444e 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save/InputType/AbstractSaveAttributeTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save/AbstractSaveAttributeTest.php @@ -5,11 +5,10 @@ */ declare(strict_types=1); -namespace Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\InputType; +namespace Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save; -use Magento\Catalog\Api\Data\ProductAttributeInterface; use Magento\Catalog\Api\ProductAttributeOptionManagementInterface; -use Magento\Eav\Api\AttributeRepositoryInterface; +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; use Magento\Eav\Api\Data\AttributeInterface; use Magento\Eav\Model\Entity\Attribute\AbstractAttribute; use Magento\Framework\App\Request\Http as HttpRequest; @@ -22,27 +21,21 @@ /** * Base create and assert attribute data. + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ abstract class AbstractSaveAttributeTest extends AbstractBackendController { - /** - * @var AttributeRepositoryInterface - */ - protected $attributeRepository; + /** @var ProductAttributeRepositoryInterface */ + protected $productAttributeRepository; - /** - * @var Escaper - */ + /** @var Escaper */ protected $escaper; - /** - * @var Json - */ + /** @var Json */ protected $jsonSerializer; - /** - * @var ProductAttributeOptionManagementInterface - */ + /** @var ProductAttributeOptionManagementInterface */ protected $productAttributeOptionManagement; /** @@ -51,12 +44,12 @@ abstract class AbstractSaveAttributeTest extends AbstractBackendController protected function setUp() { parent::setUp(); - $this->attributeRepository = $this->_objectManager->get(AttributeRepositoryInterface::class); $this->escaper = $this->_objectManager->get(Escaper::class); $this->jsonSerializer = $this->_objectManager->get(Json::class); $this->productAttributeOptionManagement = $this->_objectManager->get( ProductAttributeOptionManagementInterface::class ); + $this->productAttributeRepository = $this->_objectManager->get(ProductAttributeRepositoryInterface::class); } /** @@ -73,15 +66,15 @@ protected function createAttributeUsingDataAndAssert(array $attributeData, array if (isset($attributeData['serialized_options_arr'])) { $attributeData['serialized_options'] = $this->serializeOptions($attributeData['serialized_options_arr']); } - $this->createAttributeViaController($attributeData); + $this->dispatchAttributeSave($attributeData); $this->assertSessionMessages( $this->equalTo([(string)__('You saved the product attribute.')]), MessageInterface::TYPE_SUCCESS ); try { - $attribute = $this->attributeRepository->get(ProductAttributeInterface::ENTITY_TYPE_CODE, $attributeCode); + $attribute = $this->productAttributeRepository->get($attributeCode); $this->assertAttributeData($attribute, $attributeData, $checkArray); - $this->attributeRepository->delete($attribute); + $this->productAttributeRepository->delete($attribute); } catch (NoSuchEntityException $e) { $this->fail("Attribute with code {$attributeCode} was not created."); } @@ -101,15 +94,15 @@ protected function createAttributeUsingDataWithErrorAndAssert(array $attributeDa ) { $attributeData['serialized_options'] = $this->serializeOptions($attributeData['serialized_options_arr']); } - $this->createAttributeViaController($attributeData); + $this->dispatchAttributeSave($attributeData); $this->assertSessionMessages( $this->equalTo([$this->escaper->escapeHtml($errorMessage)]), MessageInterface::TYPE_ERROR ); $attributeCode = $this->getAttributeCodeFromAttributeData($attributeData); try { - $attribute = $this->attributeRepository->get(ProductAttributeInterface::ENTITY_TYPE_CODE, $attributeCode); - $this->attributeRepository->delete($attribute); + $attribute = $this->productAttributeRepository->get($attributeCode); + $this->productAttributeRepository->delete($attribute); } catch (NoSuchEntityException $e) { //Attribute already deleted. } @@ -191,7 +184,7 @@ private function getAttributeCodeFromAttributeData(array $attributeData): string * @param array $attributeData * @return void */ - private function createAttributeViaController(array $attributeData): void + private function dispatchAttributeSave(array $attributeData): void { $this->getRequest()->setMethod(HttpRequest::METHOD_POST); $this->getRequest()->setPostValue($attributeData); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save/InputType/PriceTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save/InputType/DecimalTest.php similarity index 79% rename from dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save/InputType/PriceTest.php rename to dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save/InputType/DecimalTest.php index fb71f0a4d9d76..943f33b9c1800 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save/InputType/PriceTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save/InputType/DecimalTest.php @@ -7,17 +7,20 @@ namespace Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\InputType; +use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\AbstractSaveAttributeTest; + /** * Test cases related to create attribute with input type price. * * @magentoDbIsolation enabled + * @magentoAppArea adminhtml */ -class PriceTest extends AbstractSaveAttributeTest +class DecimalTest extends AbstractSaveAttributeTest { /** * Test create attribute and compare attribute data and input data. * - * @dataProvider \Magento\TestFramework\Catalog\Model\Product\Attribute\DataProvider\Price::getAttributeDataWithCheckArray() + * @dataProvider \Magento\TestFramework\Catalog\Model\Product\Attribute\DataProvider\Decimal::getAttributeDataWithCheckArray * * @param array $attributePostData * @param array $checkArray @@ -31,7 +34,7 @@ public function testCreateAttribute(array $attributePostData, array $checkArray) /** * Test create attribute with error. * - * @dataProvider \Magento\TestFramework\Catalog\Model\Product\Attribute\DataProvider\Price::getAttributeDataWithErrorMessage() + * @dataProvider \Magento\TestFramework\Catalog\Model\Product\Attribute\DataProvider\Decimal::getAttributeDataWithErrorMessage * * @param array $attributePostData * @param string $errorMessage diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save/InputType/MediaImageTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save/InputType/MediaImageTest.php index f8adac2872773..c6500e03fa327 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save/InputType/MediaImageTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save/InputType/MediaImageTest.php @@ -7,17 +7,20 @@ namespace Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\InputType; +use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\AbstractSaveAttributeTest; + /** * Test cases related to create attribute with input type media image. * * @magentoDbIsolation enabled + * @magentoAppArea adminhtml */ class MediaImageTest extends AbstractSaveAttributeTest { /** * Test create attribute and compare attribute data and input data. * - * @dataProvider \Magento\TestFramework\Catalog\Model\Product\Attribute\DataProvider\MediaImage::getAttributeDataWithCheckArray() + * @dataProvider \Magento\TestFramework\Catalog\Model\Product\Attribute\DataProvider\MediaImage::getAttributeDataWithCheckArray * * @param array $attributePostData * @param array $checkArray @@ -31,7 +34,7 @@ public function testCreateAttribute(array $attributePostData, array $checkArray) /** * Test create attribute with error. * - * @dataProvider \Magento\TestFramework\Catalog\Model\Product\Attribute\DataProvider\MediaImage::getAttributeDataWithErrorMessage() + * @dataProvider \Magento\TestFramework\Catalog\Model\Product\Attribute\DataProvider\MediaImage::getAttributeDataWithErrorMessage * * @param array $attributePostData * @param string $errorMessage diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Update/AbstractUpdateAttributeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Update/AbstractUpdateAttributeTest.php new file mode 100644 index 0000000000000..60702d83bf4f7 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Update/AbstractUpdateAttributeTest.php @@ -0,0 +1,472 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Controller\Adminhtml\Product\Attribute\Update; + +use Magento\Catalog\Api\Data\ProductAttributeInterface; +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Catalog\Model\ResourceModel\Attribute as AttributeResource; +use Magento\Catalog\Model\ResourceModel\Eav\Attribute; +use Magento\Eav\Model\ResourceModel\Entity\Attribute\Option as OptionResource; +use Magento\Eav\Model\ResourceModel\Entity\Attribute\Option\CollectionFactory as OptionCollectionFactory; +use Magento\Framework\App\Request\Http as HttpRequest; +use Magento\Framework\Escaper; +use Magento\Framework\Message\MessageInterface; +use Magento\Framework\Serialize\Serializer\Json; +use Magento\Store\Model\StoreManagerInterface; +use Magento\TestFramework\Eav\Model\GetAttributeGroupByName; +use Magento\TestFramework\Eav\Model\GetAttributeSetByName; +use Magento\TestFramework\Eav\Model\ResourceModel\GetEntityIdByAttributeId; +use Magento\TestFramework\TestCase\AbstractBackendController; + +/** + * Base update and assert attribute data. + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +abstract class AbstractUpdateAttributeTest extends AbstractBackendController +{ + /** @var ProductAttributeRepositoryInterface */ + protected $productAttributeRepository; + + /** @var Escaper */ + protected $escaper; + + /** @var Json */ + protected $jsonSerializer; + + /** @var GetAttributeSetByName */ + private $getAttributeSetByName; + + /** @var GetAttributeGroupByName */ + private $getAttributeGroupByName; + + /** @var GetEntityIdByAttributeId */ + private $getEntityIdByAttributeId; + + /** @var StoreManagerInterface */ + private $storeManager; + + /** @var OptionCollectionFactory */ + private $optionCollectionFactory; + + /** @var OptionResource */ + private $attributeOptionResource; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + $this->escaper = $this->_objectManager->get(Escaper::class); + $this->jsonSerializer = $this->_objectManager->get(Json::class); + $this->productAttributeRepository = $this->_objectManager->get(ProductAttributeRepositoryInterface::class); + $this->getAttributeSetByName = $this->_objectManager->get(GetAttributeSetByName::class); + $this->getAttributeGroupByName = $this->_objectManager->get(GetAttributeGroupByName::class); + $this->getEntityIdByAttributeId = $this->_objectManager->get(GetEntityIdByAttributeId::class); + $this->storeManager = $this->_objectManager->get(StoreManagerInterface::class); + $this->optionCollectionFactory = $this->_objectManager->get(OptionCollectionFactory::class); + $this->attributeOptionResource = $this->_objectManager->get(OptionResource::class); + } + + /** + * Updates attribute frontend labels on stores for a given attribute type. + * + * @param string $attributeCode + * @param array $postData + * @param array $expectedData + * @return void + */ + protected function processUpdateFrontendLabelOnStores( + string $attributeCode, + array $postData, + array $expectedData + ): void { + $this->setAttributeStorelabels($attributeCode); + if (is_array($postData['frontend_label'])) { + $postData['frontend_label'] = $this->prepareStoresData($postData['frontend_label']); + } + $expectedData['store_labels'] = $this->prepareStoresData($expectedData['store_labels']); + + $this->_objectManager->removeSharedInstance(AttributeResource::class); + $this->updateAttributeUsingData($attributeCode, $postData); + $this->assertUpdateAttributeProcess($attributeCode, $postData, $expectedData); + } + + /** + * Updates attribute options on stores for a given attribute type. + * + * @param string $attributeCode + * @param array $postData + * @return void + */ + protected function processUpdateOptionsOnStores(string $attributeCode, array $postData): void + { + $optionsData = $this->prepareStoreOptionsArray($attributeCode, $postData['options_array']); + $optionsPostData = $this->prepareStoreOptionsPostData($optionsData); + $postData['serialized_options'] = $this->serializeOptions($optionsPostData); + $expectedData = $this->prepareStoreOptionsExpectedData($optionsData); + + $this->_objectManager->removeSharedInstance(AttributeResource::class); + $this->updateAttributeUsingData($attributeCode, $postData); + $this->assertUpdateAttributeProcess($attributeCode, $postData, $expectedData); + } + + /** + * Prepare an array of values by store - replace store code with store identifier. + * + * @param array $storesData + * @return array + */ + protected function prepareStoresData(array $storesData): array + { + $storeIdsData = []; + foreach ($storesData as $storeId => $label) { + $store = $this->storeManager->getStore($storeId); + $storeIdsData[$store->getId()] = $label; + } + + return $storeIdsData; + } + + /** + * Update attribute via save product attribute controller. + * + * @param string $attributeCode + * @param array $postData + * @return void + */ + protected function updateAttributeUsingData(string $attributeCode, array $postData): void + { + $attributeId = $postData['attribute_id'] ?? $this->productAttributeRepository->get($attributeCode)->getId(); + $this->dispatchAttributeSave($postData, (int)$attributeId); + } + + /** + * Replace the store code with an identifier in the array of option values + * + * @param array $optionsArray + * @return array + */ + protected function replaceStoreCodeWithId(array $optionsArray): array + { + foreach ($optionsArray as $key => $option) { + $optionsArray[$key]['value'] = $this->prepareStoresData($option['value']); + } + + return $optionsArray; + } + + /** + * Prepare an array of attribute option values that will be saved. + * + * @param string $attributeCode + * @param array $optionsArray + * @return array + */ + protected function prepareStoreOptionsArray(string $attributeCode, array $optionsArray): array + { + $attribute = $this->productAttributeRepository->get($attributeCode); + $replacedOptionsArray = $this->replaceStoreCodeWithId($optionsArray); + $actualOptionsData = $this->getActualOptionsData($attribute->getId()); + $labeledOptionsData = []; + $optionLabelIds = []; + $i = 1; + foreach ($actualOptionsData as $optionId => $optionData) { + $optionLabelIds['option_' . $i] = $optionId; + $labeledOptionsData['option_' . $i] = $optionData; + $i++; + } + + $combineOptionsData = array_replace_recursive($labeledOptionsData, $replacedOptionsArray); + $optionsData = []; + foreach ($optionLabelIds as $optionLabel => $optionId) { + $optionsData[$optionId] = $combineOptionsData[$optionLabel]; + } + + return $optionsData; + } + + /** + * Get actual attribute options data. + * + * @param string $attributeId + * @return array + */ + protected function getActualOptionsData(string $attributeId): array + { + $attributeOptions = $this->getAttributeOptions($attributeId); + $actualOptionsData = []; + foreach ($attributeOptions as $optionId => $option) { + $actualOptionsData[$optionId] = [ + 'order' => $option->getSortOrder(), + 'value' => $this->getAttributeOptionValues($optionId), + ]; + } + + return $actualOptionsData; + } + + /** + * Prepare an array of attribute option values for sending via post parameters. + * + * @param array $optionsData + * @return array + */ + protected function prepareStoreOptionsPostData(array $optionsData): array + { + $optionsPostData = []; + foreach ($optionsData as $optionId => $option) { + $optionsPostData[$optionId]['option'] = [ + 'order' => [ + $optionId => $option['order'], + ], + 'value' => [ + $optionId => $option['value'], + ], + 'delete' => [ + $optionId => $option['delete'] ?? '', + ], + ]; + if (isset($option['default'])) { + $optionsPostData[$optionId]['default'][] = $optionId; + } + } + + return $optionsPostData; + } + + /** + * Prepare an array of attribute option values for verification after saving the attribute. + * + * @param array $optionsData + * @return array + */ + protected function prepareStoreOptionsExpectedData(array $optionsData): array + { + $optionsArray = []; + $defaultValue = ''; + + foreach ($optionsData as $optionId => $option) { + if (!empty($option['delete'])) { + continue; + } + $optionsArray[$optionId] = [ + 'order' => $option['order'], + 'value' => $option['value'], + ]; + if (isset($option['default'])) { + $defaultValue = $optionId; + } + } + + return [ + 'options_array' => $optionsArray, + 'default_value' => $defaultValue, + ]; + } + + /** + * Assert that attribute update correctly. + * + * @param string $attributeCode + * @param array $postData + * @param array $expectedData + * @return void + */ + protected function assertUpdateAttributeProcess(string $attributeCode, array $postData, array $expectedData): void + { + $this->assertSessionMessages( + $this->equalTo([(string)__('You saved the product attribute.')]), + MessageInterface::TYPE_SUCCESS + ); + $updatedAttribute = $this->productAttributeRepository->get($attributeCode); + if (isset($postData['new_attribute_set_name'])) { + $this->assertUpdateAttributeSet($updatedAttribute, $postData); + } elseif (isset($postData['options_array'])) { + $this->assertUpdateAttributeOptions($updatedAttribute, $expectedData['options_array']); + unset($expectedData['options_array']); + $this->assertUpdateAttributeData($updatedAttribute, $expectedData); + } else { + $this->assertUpdateAttributeData($updatedAttribute, $expectedData); + } + } + + /** + * Check that attribute property values match expected values. + * + * @param ProductAttributeInterface $attribute + * @param array $expectedData + * @return void + */ + protected function assertUpdateAttributeData( + ProductAttributeInterface $attribute, + array $expectedData + ): void { + foreach ($expectedData as $key => $expectedValue) { + $this->assertEquals( + $expectedValue, + $attribute->getDataUsingMethod($key), + "Invalid expected value for $key field." + ); + } + } + + /** + * Checks that appropriate error message appears. + * + * @param string $errorMessage + * @return void + */ + protected function assertErrorSessionMessages(string $errorMessage): void + { + $this->assertSessionMessages( + $this->equalTo([$this->escaper->escapeHtml($errorMessage)]), + MessageInterface::TYPE_ERROR + ); + } + + /** + * Create or update attribute using catalog/product_attribute/save action. + * + * @param array $attributeData + * @param int|null $attributeId + * @return void + */ + private function dispatchAttributeSave(array $attributeData, ?int $attributeId = null): void + { + $this->getRequest()->setMethod(HttpRequest::METHOD_POST); + $this->getRequest()->setPostValue($attributeData); + if ($attributeId) { + $this->getRequest()->setParam('attribute_id', $attributeId); + } + $this->dispatch('backend/catalog/product_attribute/save'); + } + + /** + * Create serialized options string. + * + * @param array $optionsArr + * @return string + */ + private function serializeOptions(array $optionsArr): string + { + $resultArr = []; + + foreach ($optionsArr as $option) { + $resultArr[] = http_build_query($option); + } + + return $this->jsonSerializer->serialize($resultArr); + } + + /** + * Set default values of attribute store labels and save. + * + * @param string $attributeCode + * @return void + */ + private function setAttributeStoreLabels(string $attributeCode): void + { + $stores = $this->storeManager->getStores(); + $storeLabels = []; + foreach ($stores as $storeId => $store) { + $storeLabels[$storeId] = $store->getName(); + } + $attribute = $this->productAttributeRepository->get($attributeCode); + $attribute->setStoreLabels($storeLabels); + $this->productAttributeRepository->save($attribute); + } + + /** + * Check that the attribute update was successful after adding it to the + * new attribute set and new attribute group. + * + * @param ProductAttributeInterface|Attribute $attribute + * @param array $postData + * @return void + */ + private function assertUpdateAttributeSet( + ProductAttributeInterface $attribute, + array $postData + ): void { + $attributeSet = $this->getAttributeSetByName->execute($postData['new_attribute_set_name']); + $this->assertNotNull( + $attributeSet, + 'The attribute set ' . $postData['new_attribute_set_name'] . 'was not created' + ); + + $attributeGroup = $this->getAttributeGroupByName->execute((int)$attributeSet->getId(), $postData['groupName']); + $this->assertNotNull( + $attributeGroup, + 'The attribute group ' . $postData['groupName'] . 'was not created' + ); + + $entityAttributeId = $this->getEntityIdByAttributeId->execute( + (int)$attributeSet->getId(), + (int)$attribute->getId(), + (int)$attributeGroup->getId() + ); + + $this->assertNotNull( + $entityAttributeId, + 'The attribute set and attribute group for the current attribute have not been updated.' + ); + } + + /** + * Check that attribute options are saved correctly. + * + * @param ProductAttributeInterface|Attribute $attribute + * @param array $expectedData + * @return void + */ + private function assertUpdateAttributeOptions( + ProductAttributeInterface $attribute, + array $expectedData + ): void { + $actualOptionsData = $this->getActualOptionsData($attribute->getId()); + + $this->assertEquals($expectedData, $actualOptionsData, 'Expected attribute options does not match.'); + } + + /** + * Get attribute options by attribute id and store id. + * + * @param string $attributeId + * @param int|null $storeId + * @return array + */ + private function getAttributeOptions(string $attributeId, ?int $storeId = null): array + { + $attributeOptionCollection = $this->optionCollectionFactory->create(); + $attributeOptionCollection->setAttributeFilter($attributeId); + $attributeOptionCollection->setStoreFilter($storeId); + + return $attributeOptionCollection->getItems(); + } + + /** + * Get attribute option values by option id. + * + * @param int $optionId + * @return array + */ + private function getAttributeOptionValues(int $optionId): array + { + $connection = $this->attributeOptionResource->getConnection(); + $select = $connection->select() + ->from( + ['main_table' => $this->attributeOptionResource->getTable('eav_attribute_option_value')], + ['store_id','value'] + ) + ->where('main_table.option_id = ?', $optionId); + + return $connection->fetchPairs($select); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Update/InputType/DecimalTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Update/InputType/DecimalTest.php new file mode 100644 index 0000000000000..0febc033592a6 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Update/InputType/DecimalTest.php @@ -0,0 +1,67 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Controller\Adminhtml\Product\Attribute\Update\InputType; + +use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Update\AbstractUpdateAttributeTest; + +/** + * Test cases related to update attribute with input type price. + * + * @magentoDbIsolation enabled + * @magentoAppArea adminhtml + */ +class DecimalTest extends AbstractUpdateAttributeTest +{ + /** + * Test update attribute. + * + * @dataProvider \Magento\TestFramework\Catalog\Model\Product\Attribute\DataProvider\Decimal::getUpdateProvider + * @magentoDataFixture Magento/Catalog/_files/product_decimal_attribute.php + * + * @param array $postData + * @param array $expectedData + * @return void + */ + public function testUpdateAttribute(array $postData, array $expectedData): void + { + $this->updateAttributeUsingData('decimal_attribute', $postData); + $this->assertUpdateAttributeProcess('decimal_attribute', $postData, $expectedData); + } + + /** + * Test update attribute with error. + * + * @dataProvider \Magento\TestFramework\Catalog\Model\Product\Attribute\DataProvider\Decimal::getUpdateProviderWithErrorMessage + * @magentoDataFixture Magento/Catalog/_files/product_decimal_attribute.php + * + * @param array $postData + * @param string $errorMessage + * @return void + */ + public function testUpdateAttributeWithError(array $postData, string $errorMessage): void + { + $this->updateAttributeUsingData('decimal_attribute', $postData); + $this->assertErrorSessionMessages($errorMessage); + } + + /** + * Test update attribute frontend labels on stores. + * + * @dataProvider \Magento\TestFramework\Catalog\Model\Product\Attribute\DataProvider\Decimal::getUpdateFrontendLabelsProvider + * @magentoDataFixture Magento/Store/_files/second_website_with_two_stores.php + * @magentoDataFixture Magento/Catalog/_files/product_decimal_attribute.php + * + * @param array $postData + * @param array $expectedData + * @return void + */ + public function testUpdateFrontendLabelOnStores(array $postData, array $expectedData): void + { + $this->processUpdateFrontendLabelOnStores('decimal_attribute', $postData, $expectedData); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Update/InputType/MediaImageTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Update/InputType/MediaImageTest.php new file mode 100644 index 0000000000000..806e690dfd5b7 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Update/InputType/MediaImageTest.php @@ -0,0 +1,67 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Controller\Adminhtml\Product\Attribute\Update\InputType; + +use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Update\AbstractUpdateAttributeTest; + +/** + * Test cases related to update attribute with input type media image. + * + * @magentoDbIsolation enabled + * @magentoAppArea adminhtml + */ +class MediaImageTest extends AbstractUpdateAttributeTest +{ + /** + * Test update attribute. + * + * @dataProvider \Magento\TestFramework\Catalog\Model\Product\Attribute\DataProvider\MediaImage::getUpdateProvider + * @magentoDataFixture Magento/Catalog/_files/product_image_attribute.php + * + * @param array $postData + * @param array $expectedData + * @return void + */ + public function testUpdateAttribute(array $postData, array $expectedData): void + { + $this->updateAttributeUsingData('image_attribute', $postData); + $this->assertUpdateAttributeProcess('image_attribute', $postData, $expectedData); + } + + /** + * Test update attribute with error. + * + * @dataProvider \Magento\TestFramework\Catalog\Model\Product\Attribute\DataProvider\MediaImage::getUpdateProviderWithErrorMessage + * @magentoDataFixture Magento/Catalog/_files/product_image_attribute.php + * + * @param array $postData + * @param string $errorMessage + * @return void + */ + public function testUpdateAttributeWithError(array $postData, string $errorMessage): void + { + $this->updateAttributeUsingData('image_attribute', $postData); + $this->assertErrorSessionMessages($errorMessage); + } + + /** + * Test update attribute frontend labels on stores. + * + * @dataProvider \Magento\TestFramework\Catalog\Model\Product\Attribute\DataProvider\MediaImage::getUpdateFrontendLabelsProvider + * @magentoDataFixture Magento/Store/_files/second_website_with_two_stores.php + * @magentoDataFixture Magento/Catalog/_files/product_image_attribute.php + * + * @param array $postData + * @param array $expectedData + * @return void + */ + public function testUpdateFrontendLabelOnStores(array $postData, array $expectedData): void + { + $this->processUpdateFrontendLabelOnStores('image_attribute', $postData, $expectedData); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_text_editor_attribute.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_text_editor_attribute.php new file mode 100644 index 0000000000000..2b62f8a78252a --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_text_editor_attribute.php @@ -0,0 +1,55 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\Data\ProductAttributeInterface; +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Catalog\Model\ResourceModel\Eav\Attribute; +use Magento\Catalog\Model\ResourceModel\Eav\AttributeFactory; +use Magento\Catalog\Setup\CategorySetup; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var CategorySetup $installer */ +$installer = $objectManager->create(CategorySetup::class); +$entityType = $installer->getEntityTypeId(ProductAttributeInterface::ENTITY_TYPE_CODE); +/** @var ProductAttributeRepositoryInterface $attributeRepository */ +$attributeRepository = $objectManager->create(ProductAttributeRepositoryInterface::class); +/** @var Attribute $attribute */ +$attribute = $objectManager->get(AttributeFactory::class)->create(); +if (!$attribute->loadByCode($entityType, 'text_editor_attribute')->getAttributeId()) { + $attribute->setData( + [ + 'attribute_code' => 'text_editor_attribute', + 'entity_type_id' => $entityType, + 'is_global' => 1, + 'is_user_defined' => 1, + 'frontend_input' => 'textarea', + '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' => ['Text Editor Attribute'], + 'backend_type' => 'text', + 'is_wysiwyg_enabled' => '1', + ] + ); + $attributeRepository->save($attribute); + $installer->addAttributeToGroup( + ProductAttributeInterface::ENTITY_TYPE_CODE, + 'Default', + 'General', + $attribute->getId() + ); +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_text_editor_attribute_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_text_editor_attribute_rollback.php new file mode 100644 index 0000000000000..09d3c1ea392ba --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_text_editor_attribute_rollback.php @@ -0,0 +1,26 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\Framework\Registry; +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; + +$objectManager = Bootstrap::getObjectManager(); +/** @var Registry $registry */ +$registry = $objectManager->get(Registry::class); +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); +/** @var ProductAttributeRepositoryInterface $attributeRepository */ +$attributeRepository = $objectManager->create(ProductAttributeRepositoryInterface::class); + +try { + $attributeRepository->deleteById('text_editor_attribute'); +} catch (NoSuchEntityException $e) { +} +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); diff --git a/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Save/InputType/DateTest.php b/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Save/InputType/DateTest.php index cb75d3e0d4a8e..9057415cf5248 100644 --- a/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Save/InputType/DateTest.php +++ b/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Save/InputType/DateTest.php @@ -7,19 +7,20 @@ namespace Magento\Eav\Controller\Adminhtml\Product\Attribute\Save\InputType; -use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\InputType\AbstractSaveAttributeTest; +use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\AbstractSaveAttributeTest; /** * Test cases related to create attribute with input type date. * * @magentoDbIsolation enabled + * @magentoAppArea adminhtml */ class DateTest extends AbstractSaveAttributeTest { /** * Test create attribute and compare attribute data and input data. * - * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\Date::getAttributeDataWithCheckArray() + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\Date::getAttributeDataWithCheckArray * * @param array $attributePostData * @param array $checkArray @@ -33,7 +34,7 @@ public function testCreateAttribute(array $attributePostData, array $checkArray) /** * Test create attribute with error. * - * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\Date::getAttributeDataWithErrorMessage() + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\Date::getAttributeDataWithErrorMessage * * @param array $attributePostData * @param string $errorMessage diff --git a/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Save/InputType/DropDownTest.php b/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Save/InputType/DropDownTest.php index 1a3f363832d6e..070dc850057cf 100644 --- a/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Save/InputType/DropDownTest.php +++ b/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Save/InputType/DropDownTest.php @@ -7,19 +7,20 @@ namespace Magento\Eav\Controller\Adminhtml\Product\Attribute\Save\InputType; -use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\InputType\AbstractSaveAttributeTest; +use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\AbstractSaveAttributeTest; /** * Test cases related to create attribute with input type dropdown. * * @magentoDbIsolation enabled + * @magentoAppArea adminhtml */ class DropDownTest extends AbstractSaveAttributeTest { /** * Test create attribute and compare attribute data and input data. * - * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\DropDown::getAttributeDataWithCheckArray() + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\DropDown::getAttributeDataWithCheckArray * * @param array $attributePostData * @param array $checkArray @@ -33,7 +34,7 @@ public function testCreateAttribute(array $attributePostData, array $checkArray) /** * Test create attribute with error. * - * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\DropDown::getAttributeDataWithErrorMessage() + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\DropDown::getAttributeDataWithErrorMessage * * @param array $attributePostData * @param string $errorMessage diff --git a/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Save/InputType/MultipleSelectTest.php b/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Save/InputType/MultipleSelectTest.php index 1c0f5ea720f70..6f51546a5d62d 100644 --- a/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Save/InputType/MultipleSelectTest.php +++ b/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Save/InputType/MultipleSelectTest.php @@ -7,19 +7,20 @@ namespace Magento\Eav\Controller\Adminhtml\Product\Attribute\Save\InputType; -use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\InputType\AbstractSaveAttributeTest; +use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\AbstractSaveAttributeTest; /** * Test cases related to create attribute with input type multiselect. * * @magentoDbIsolation enabled + * @magentoAppArea adminhtml */ class MultipleSelectTest extends AbstractSaveAttributeTest { /** * Test create attribute and compare attribute data and input data. * - * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\MultipleSelect::getAttributeDataWithCheckArray() + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\MultipleSelect::getAttributeDataWithCheckArray * * @param array $attributePostData * @param array $checkArray @@ -33,7 +34,7 @@ public function testCreateAttribute(array $attributePostData, array $checkArray) /** * Test create attribute with error. * - * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\MultipleSelect::getAttributeDataWithErrorMessage() + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\MultipleSelect::getAttributeDataWithErrorMessage * * @param array $attributePostData * @param string $errorMessage diff --git a/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Save/InputType/TextAreaTest.php b/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Save/InputType/TextAreaTest.php index 9c5b1a8587674..c315f61b89148 100644 --- a/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Save/InputType/TextAreaTest.php +++ b/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Save/InputType/TextAreaTest.php @@ -7,19 +7,20 @@ namespace Magento\Eav\Controller\Adminhtml\Product\Attribute\Save\InputType; -use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\InputType\AbstractSaveAttributeTest; +use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\AbstractSaveAttributeTest; /** * Test cases related to create attribute with input type text_area. * * @magentoDbIsolation enabled + * @magentoAppArea adminhtml */ class TextAreaTest extends AbstractSaveAttributeTest { /** * Test create attribute and compare attribute data and input data. * - * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\TextArea::getAttributeDataWithCheckArray() + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\TextArea::getAttributeDataWithCheckArray * * @param array $attributePostData * @param array $checkArray @@ -33,7 +34,7 @@ public function testCreateAttribute(array $attributePostData, array $checkArray) /** * Test create attribute with error. * - * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\TextArea::getAttributeDataWithErrorMessage() + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\TextArea::getAttributeDataWithErrorMessage * * @param array $attributePostData * @param string $errorMessage diff --git a/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Save/InputType/TextEditorTest.php b/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Save/InputType/TextEditorTest.php index 807e0cfd570b2..36e95550a562a 100644 --- a/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Save/InputType/TextEditorTest.php +++ b/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Save/InputType/TextEditorTest.php @@ -7,19 +7,20 @@ namespace Magento\Eav\Controller\Adminhtml\Product\Attribute\Save\InputType; -use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\InputType\AbstractSaveAttributeTest; +use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\AbstractSaveAttributeTest; /** * Test cases related to create attribute with input type text_editor. * * @magentoDbIsolation enabled + * @magentoAppArea adminhtml */ class TextEditorTest extends AbstractSaveAttributeTest { /** * Test create attribute and compare attribute data and input data. * - * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\TextEditor::getAttributeDataWithCheckArray() + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\TextEditor::getAttributeDataWithCheckArray * * @param array $attributePostData * @param array $checkArray @@ -33,7 +34,7 @@ public function testCreateAttribute(array $attributePostData, array $checkArray) /** * Test create attribute with error. * - * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\TextEditor::getAttributeDataWithErrorMessage() + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\TextEditor::getAttributeDataWithErrorMessage * * @param array $attributePostData * @param string $errorMessage diff --git a/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Save/InputType/TextTest.php b/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Save/InputType/TextTest.php index 70069dcedd0e4..3a7747f59939a 100644 --- a/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Save/InputType/TextTest.php +++ b/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Save/InputType/TextTest.php @@ -7,19 +7,20 @@ namespace Magento\Eav\Controller\Adminhtml\Product\Attribute\Save\InputType; -use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\InputType\AbstractSaveAttributeTest; +use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\AbstractSaveAttributeTest; /** * Test cases related to create attribute with input type text. * * @magentoDbIsolation enabled + * @magentoAppArea adminhtml */ class TextTest extends AbstractSaveAttributeTest { /** * Test create attribute and compare attribute data and input data. * - * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\Text::getAttributeDataWithCheckArray() + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\Text::getAttributeDataWithCheckArray * * @param array $attributePostData * @param array $checkArray @@ -33,7 +34,7 @@ public function testCreateAttribute(array $attributePostData, array $checkArray) /** * Test create attribute with error. * - * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\Text::getAttributeDataWithErrorMessage() + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\Text::getAttributeDataWithErrorMessage * * @param array $attributePostData * @param string $errorMessage diff --git a/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Save/InputType/YesNoTest.php b/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Save/InputType/YesNoTest.php index 7bb26556c3fd6..28ba04465b870 100644 --- a/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Save/InputType/YesNoTest.php +++ b/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Save/InputType/YesNoTest.php @@ -7,19 +7,20 @@ namespace Magento\Eav\Controller\Adminhtml\Product\Attribute\Save\InputType; -use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\InputType\AbstractSaveAttributeTest; +use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\AbstractSaveAttributeTest; /** * Test cases related to create attribute with yes/no input type. * * @magentoDbIsolation enabled + * @magentoAppArea adminhtml */ class YesNoTest extends AbstractSaveAttributeTest { /** * Test create attribute and compare attribute data and input data. * - * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\YesNo::getAttributeDataWithCheckArray() + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\YesNo::getAttributeDataWithCheckArray * * @param array $attributePostData * @param array $checkArray @@ -33,7 +34,7 @@ public function testCreateAttribute(array $attributePostData, array $checkArray) /** * Test create attribute with error. * - * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\YesNo::getAttributeDataWithErrorMessage() + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\YesNo::getAttributeDataWithErrorMessage * * @param array $attributePostData * @param string $errorMessage diff --git a/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Update/InputType/DateTest.php b/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Update/InputType/DateTest.php new file mode 100644 index 0000000000000..5df39674d05c8 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Update/InputType/DateTest.php @@ -0,0 +1,67 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Eav\Controller\Adminhtml\Product\Attribute\Update\InputType; + +use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Update\AbstractUpdateAttributeTest; + +/** + * Test cases related to update attribute with input type date. + * + * @magentoDbIsolation enabled + * @magentoAppArea adminhtml + */ +class DateTest extends AbstractUpdateAttributeTest +{ + /** + * Test update attribute. + * + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\Date::getUpdateProvider + * @magentoDataFixture Magento/Catalog/_files/product_date_attribute.php + * + * @param array $postData + * @param array $expectedData + * @return void + */ + public function testUpdateAttribute(array $postData, array $expectedData): void + { + $this->updateAttributeUsingData('date_attribute', $postData); + $this->assertUpdateAttributeProcess('date_attribute', $postData, $expectedData); + } + + /** + * Test update attribute with error. + * + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\Date::getUpdateProviderWithErrorMessage + * @magentoDataFixture Magento/Catalog/_files/product_date_attribute.php + * + * @param array $postData + * @param string $errorMessage + * @return void + */ + public function testUpdateAttributeWithError(array $postData, string $errorMessage): void + { + $this->updateAttributeUsingData('date_attribute', $postData); + $this->assertErrorSessionMessages($errorMessage); + } + + /** + * Test update attribute frontend labels on stores. + * + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\Date::getUpdateFrontendLabelsProvider + * @magentoDataFixture Magento/Store/_files/second_website_with_two_stores.php + * @magentoDataFixture Magento/Catalog/_files/product_date_attribute.php + * + * @param array $postData + * @param array $expectedData + * @return void + */ + public function testUpdateFrontendLabelOnStores(array $postData, array $expectedData): void + { + $this->processUpdateFrontendLabelOnStores('date_attribute', $postData, $expectedData); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Update/InputType/DropDownTest.php b/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Update/InputType/DropDownTest.php new file mode 100644 index 0000000000000..4b3fb2cf6fac9 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Update/InputType/DropDownTest.php @@ -0,0 +1,82 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Eav\Controller\Adminhtml\Product\Attribute\Update\InputType; + +use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Update\AbstractUpdateAttributeTest; + +/** + * Test cases related to update attribute with input type dropdown. + * + * @magentoDbIsolation enabled + * @magentoAppArea adminhtml + */ +class DropDownTest extends AbstractUpdateAttributeTest +{ + /** + * Test update attribute. + * + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\DropDown::getUpdateProvider + * @magentoDataFixture Magento/Catalog/_files/dropdown_attribute.php + * + * @param array $postData + * @param array $expectedData + * @return void + */ + public function testUpdateAttribute(array $postData, array $expectedData): void + { + $this->updateAttributeUsingData('dropdown_attribute', $postData); + $this->assertUpdateAttributeProcess('dropdown_attribute', $postData, $expectedData); + } + + /** + * Test update attribute with error. + * + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\DropDown::getUpdateProviderWithErrorMessage + * @magentoDataFixture Magento/Catalog/_files/dropdown_attribute.php + * + * @param array $postData + * @param string $errorMessage + * @return void + */ + public function testUpdateAttributeWithError(array $postData, string $errorMessage): void + { + $this->updateAttributeUsingData('dropdown_attribute', $postData); + $this->assertErrorSessionMessages($errorMessage); + } + + /** + * Test update attribute frontend labels on stores. + * + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\DropDown::getUpdateFrontendLabelsProvider + * @magentoDataFixture Magento/Store/_files/second_website_with_two_stores.php + * @magentoDataFixture Magento/Catalog/_files/dropdown_attribute.php + * + * @param array $postData + * @param array $expectedData + * @return void + */ + public function testUpdateFrontendLabelOnStores(array $postData, array $expectedData): void + { + $this->processUpdateFrontendLabelOnStores('dropdown_attribute', $postData, $expectedData); + } + + /** + * Test update attribute options on stores. + * + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\DropDown::getUpdateOptionsProvider + * @magentoDataFixture Magento/Store/_files/second_website_with_two_stores.php + * @magentoDataFixture Magento/Catalog/_files/dropdown_attribute.php + * + * @param array $postData + * @return void + */ + public function testUpdateOptionsOnStores(array $postData): void + { + $this->processUpdateOptionsOnStores('dropdown_attribute', $postData); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Update/InputType/MultipleSelectTest.php b/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Update/InputType/MultipleSelectTest.php new file mode 100644 index 0000000000000..fa8b63a2d034c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Update/InputType/MultipleSelectTest.php @@ -0,0 +1,82 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Eav\Controller\Adminhtml\Product\Attribute\Update\InputType; + +use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Update\AbstractUpdateAttributeTest; + +/** + * Test cases related to update attribute with input type multiselect. + * + * @magentoDbIsolation enabled + * @magentoAppArea adminhtml + */ +class MultipleSelectTest extends AbstractUpdateAttributeTest +{ + /** + * Test update attribute. + * + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\MultipleSelect::getUpdateProvider + * @magentoDataFixture Magento/Catalog/_files/multiselect_attribute.php + * + * @param array $postData + * @param array $expectedData + * @return void + */ + public function testUpdateAttribute(array $postData, array $expectedData): void + { + $this->updateAttributeUsingData('multiselect_attribute', $postData); + $this->assertUpdateAttributeProcess('multiselect_attribute', $postData, $expectedData); + } + + /** + * Test update attribute with error. + * + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\MultipleSelect::getUpdateProviderWithErrorMessage + * @magentoDataFixture Magento/Catalog/_files/multiselect_attribute.php + * + * @param array $postData + * @param string $errorMessage + * @return void + */ + public function testUpdateAttributeWithError(array $postData, string $errorMessage): void + { + $this->updateAttributeUsingData('multiselect_attribute', $postData); + $this->assertErrorSessionMessages($errorMessage); + } + + /** + * Test update attribute frontend labels on stores. + * + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\MultipleSelect::getUpdateFrontendLabelsProvider + * @magentoDataFixture Magento/Store/_files/second_website_with_two_stores.php + * @magentoDataFixture Magento/Catalog/_files/multiselect_attribute.php + * + * @param array $postData + * @param array $expectedData + * @return void + */ + public function testUpdateFrontendLabelOnStores(array $postData, array $expectedData): void + { + $this->processUpdateFrontendLabelOnStores('multiselect_attribute', $postData, $expectedData); + } + + /** + * Test update attribute options on stores. + * + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\MultipleSelect::getUpdateOptionsProvider + * @magentoDataFixture Magento/Store/_files/second_website_with_two_stores.php + * @magentoDataFixture Magento/Catalog/_files/multiselect_attribute.php + * + * @param array $postData + * @return void + */ + public function testUpdateOptionsOnStores(array $postData): void + { + $this->processUpdateOptionsOnStores('multiselect_attribute', $postData); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Update/InputType/TextAreaTest.php b/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Update/InputType/TextAreaTest.php new file mode 100644 index 0000000000000..708de8dec916c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Update/InputType/TextAreaTest.php @@ -0,0 +1,67 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Eav\Controller\Adminhtml\Product\Attribute\Update\InputType; + +use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Update\AbstractUpdateAttributeTest; + +/** + * Test cases related to update attribute with input type text_area. + * + * @magentoDbIsolation enabled + * @magentoAppArea adminhtml + */ +class TextAreaTest extends AbstractUpdateAttributeTest +{ + /** + * Test update attribute. + * + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\TextArea::getUpdateProvider + * @magentoDataFixture Magento/Catalog/_files/product_text_attribute.php + * + * @param array $postData + * @param array $expectedData + * @return void + */ + public function testUpdateAttribute(array $postData, array $expectedData): void + { + $this->updateAttributeUsingData('text_attribute', $postData); + $this->assertUpdateAttributeProcess('text_attribute', $postData, $expectedData); + } + + /** + * Test update attribute with error. + * + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\TextArea::getUpdateProviderWithErrorMessage + * @magentoDataFixture Magento/Catalog/_files/product_text_attribute.php + * + * @param array $postData + * @param string $errorMessage + * @return void + */ + public function testUpdateAttributeWithError(array $postData, string $errorMessage): void + { + $this->updateAttributeUsingData('text_attribute', $postData); + $this->assertErrorSessionMessages($errorMessage); + } + + /** + * Test update attribute frontend labels on stores. + * + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\TextArea::getUpdateFrontendLabelsProvider + * @magentoDataFixture Magento/Store/_files/second_website_with_two_stores.php + * @magentoDataFixture Magento/Catalog/_files/product_text_attribute.php + * + * @param array $postData + * @param array $expectedData + * @return void + */ + public function testUpdateFrontendLabelOnStores(array $postData, array $expectedData): void + { + $this->processUpdateFrontendLabelOnStores('text_attribute', $postData, $expectedData); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Update/InputType/TextEditorTest.php b/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Update/InputType/TextEditorTest.php new file mode 100644 index 0000000000000..14e0f84741782 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Update/InputType/TextEditorTest.php @@ -0,0 +1,67 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Eav\Controller\Adminhtml\Product\Attribute\Update\InputType; + +use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Update\AbstractUpdateAttributeTest; + +/** + * Test cases related to update attribute with input type text_editor. + * + * @magentoDbIsolation enabled + * @magentoAppArea adminhtml + */ +class TextEditorTest extends AbstractUpdateAttributeTest +{ + /** + * Test update attribute. + * + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\TextEditor::getUpdateProvider + * @magentoDataFixture Magento/Catalog/_files/product_text_editor_attribute.php + * + * @param array $postData + * @param array $expectedData + * @return void + */ + public function testUpdateAttribute(array $postData, array $expectedData): void + { + $this->updateAttributeUsingData('text_editor_attribute', $postData); + $this->assertUpdateAttributeProcess('text_editor_attribute', $postData, $expectedData); + } + + /** + * Test update attribute with error. + * + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\TextEditor::getUpdateProviderWithErrorMessage + * @magentoDataFixture Magento/Catalog/_files/product_text_editor_attribute.php + * + * @param array $postData + * @param string $errorMessage + * @return void + */ + public function testUpdateAttributeWithError(array $postData, string $errorMessage): void + { + $this->updateAttributeUsingData('text_editor_attribute', $postData); + $this->assertErrorSessionMessages($errorMessage); + } + + /** + * Test update attribute frontend labels on stores. + * + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\TextEditor::getUpdateFrontendLabelsProvider + * @magentoDataFixture Magento/Store/_files/second_website_with_two_stores.php + * @magentoDataFixture Magento/Catalog/_files/product_text_editor_attribute.php + * + * @param array $postData + * @param array $expectedData + * @return void + */ + public function testUpdateFrontendLabelOnStores(array $postData, array $expectedData): void + { + $this->processUpdateFrontendLabelOnStores('text_editor_attribute', $postData, $expectedData); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Update/InputType/TextTest.php b/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Update/InputType/TextTest.php new file mode 100644 index 0000000000000..fb025e4280c96 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Update/InputType/TextTest.php @@ -0,0 +1,67 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Eav\Controller\Adminhtml\Product\Attribute\Update\InputType; + +use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Update\AbstractUpdateAttributeTest; + +/** + * Test cases related to update attribute with input type text. + * + * @magentoDbIsolation enabled + * @magentoAppArea adminhtml + */ +class TextTest extends AbstractUpdateAttributeTest +{ + /** + * Test update attribute. + * + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\Text::getUpdateProvider + * @magentoDataFixture Magento/Catalog/_files/product_varchar_attribute.php + * + * @param array $postData + * @param array $expectedData + * @return void + */ + public function testUpdateAttribute(array $postData, array $expectedData): void + { + $this->updateAttributeUsingData('varchar_attribute', $postData); + $this->assertUpdateAttributeProcess('varchar_attribute', $postData, $expectedData); + } + + /** + * Test update attribute with error. + * + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\Text::getUpdateProviderWithErrorMessage + * @magentoDataFixture Magento/Catalog/_files/product_varchar_attribute.php + * + * @param array $postData + * @param string $errorMessage + * @return void + */ + public function testUpdateAttributeWithError(array $postData, string $errorMessage): void + { + $this->updateAttributeUsingData('varchar_attribute', $postData); + $this->assertErrorSessionMessages($errorMessage); + } + + /** + * Test update attribute frontend labels on stores. + * + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\Text::getUpdateFrontendLabelsProvider + * @magentoDataFixture Magento/Store/_files/second_website_with_two_stores.php + * @magentoDataFixture Magento/Catalog/_files/product_varchar_attribute.php + * + * @param array $postData + * @param array $expectedData + * @return void + */ + public function testUpdateFrontendLabelOnStores(array $postData, array $expectedData): void + { + $this->processUpdateFrontendLabelOnStores('varchar_attribute', $postData, $expectedData); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Update/InputType/YesNoTest.php b/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Update/InputType/YesNoTest.php new file mode 100644 index 0000000000000..c2baeba182836 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Update/InputType/YesNoTest.php @@ -0,0 +1,67 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Eav\Controller\Adminhtml\Product\Attribute\Update\InputType; + +use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Update\AbstractUpdateAttributeTest; + +/** + * Test cases related to update attribute with yes/no input type. + * + * @magentoDbIsolation enabled + * @magentoAppArea adminhtml + */ +class YesNoTest extends AbstractUpdateAttributeTest +{ + /** + * Test update attribute. + * + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\YesNo::getUpdateProvider + * @magentoDataFixture Magento/Catalog/_files/product_boolean_attribute.php + * + * @param array $postData + * @param array $expectedData + * @return void + */ + public function testUpdateAttribute(array $postData, array $expectedData): void + { + $this->updateAttributeUsingData('boolean_attribute', $postData); + $this->assertUpdateAttributeProcess('boolean_attribute', $postData, $expectedData); + } + + /** + * Test update attribute with error. + * + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\YesNo::getUpdateProviderWithErrorMessage + * @magentoDataFixture Magento/Catalog/_files/product_boolean_attribute.php + * + * @param array $postData + * @param string $errorMessage + * @return void + */ + public function testUpdateAttributeWithError(array $postData, string $errorMessage): void + { + $this->updateAttributeUsingData('boolean_attribute', $postData); + $this->assertErrorSessionMessages($errorMessage); + } + + /** + * Test update attribute frontend labels on stores. + * + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\YesNo::getUpdateFrontendLabelsProvider + * @magentoDataFixture Magento/Store/_files/second_website_with_two_stores.php + * @magentoDataFixture Magento/Catalog/_files/product_boolean_attribute.php + * + * @param array $postData + * @param array $expectedData + * @return void + */ + public function testUpdateFrontendLabelOnStores(array $postData, array $expectedData): void + { + $this->processUpdateFrontendLabelOnStores('boolean_attribute', $postData, $expectedData); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Save/InputType/TextSwatchTest.php b/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Save/InputType/TextSwatchTest.php index e9839266b07a0..348afff7fe9ba 100644 --- a/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Save/InputType/TextSwatchTest.php +++ b/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Save/InputType/TextSwatchTest.php @@ -7,7 +7,7 @@ namespace Magento\Swatches\Controller\Adminhtml\Product\Attribute\Save\InputType; -use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\InputType\AbstractSaveAttributeTest; +use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\AbstractSaveAttributeTest; use Magento\Eav\Api\Data\AttributeInterface; use Magento\Eav\Model\Entity\Attribute\Source\Table; @@ -15,13 +15,14 @@ * Test cases related to create attribute with input type text swatch. * * @magentoDbIsolation enabled + * @magentoAppArea adminhtml */ class TextSwatchTest extends AbstractSaveAttributeTest { /** * Test create attribute and compare attribute data and input data. * - * @dataProvider \Magento\TestFramework\Swatches\Model\Attribute\DataProvider\TextSwatch::getAttributeDataWithCheckArray() + * @dataProvider \Magento\TestFramework\Swatches\Model\Attribute\DataProvider\TextSwatch::getAttributeDataWithCheckArray * * @param array $attributePostData * @param array $checkArray @@ -35,7 +36,7 @@ public function testCreateAttribute(array $attributePostData, array $checkArray) /** * Test create attribute with error. * - * @dataProvider \Magento\TestFramework\Swatches\Model\Attribute\DataProvider\TextSwatch::getAttributeDataWithErrorMessage() + * @dataProvider \Magento\TestFramework\Swatches\Model\Attribute\DataProvider\TextSwatch::getAttributeDataWithErrorMessage * * @param array $attributePostData * @param string $errorMessage diff --git a/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Save/InputType/VisualSwatchTest.php b/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Save/InputType/VisualSwatchTest.php index 56b051c8ec9c2..0ee64f0de9ca3 100644 --- a/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Save/InputType/VisualSwatchTest.php +++ b/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Save/InputType/VisualSwatchTest.php @@ -7,7 +7,7 @@ namespace Magento\Swatches\Controller\Adminhtml\Product\Attribute\Save\InputType; -use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\InputType\AbstractSaveAttributeTest; +use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\AbstractSaveAttributeTest; use Magento\Eav\Api\Data\AttributeInterface; use Magento\Eav\Model\Entity\Attribute\Source\Table; @@ -15,13 +15,14 @@ * Test cases related to create attribute with input type visual swatch. * * @magentoDbIsolation enabled + * @magentoAppArea adminhtml */ class VisualSwatchTest extends AbstractSaveAttributeTest { /** * Test create attribute and compare attribute data and input data. * - * @dataProvider \Magento\TestFramework\Swatches\Model\Attribute\DataProvider\VisualSwatch::getAttributeDataWithCheckArray() + * @dataProvider \Magento\TestFramework\Swatches\Model\Attribute\DataProvider\VisualSwatch::getAttributeDataWithCheckArray * * @param array $attributePostData * @param array $checkArray @@ -35,7 +36,7 @@ public function testCreateAttribute(array $attributePostData, array $checkArray) /** * Test create attribute with error. * - * @dataProvider \Magento\TestFramework\Swatches\Model\Attribute\DataProvider\VisualSwatch::getAttributeDataWithErrorMessage() + * @dataProvider \Magento\TestFramework\Swatches\Model\Attribute\DataProvider\VisualSwatch::getAttributeDataWithErrorMessage * * @param array $attributePostData * @param string $errorMessage diff --git a/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Update/AbstractUpdateSwatchAttributeTest.php b/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Update/AbstractUpdateSwatchAttributeTest.php new file mode 100644 index 0000000000000..2152a9c93419c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Update/AbstractUpdateSwatchAttributeTest.php @@ -0,0 +1,146 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Swatches\Controller\Adminhtml\Product\Attribute\Update; + +use Magento\Catalog\Api\Data\ProductAttributeInterface; +use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Update\AbstractUpdateAttributeTest; +use Magento\Swatches\Model\ResourceModel\Swatch\CollectionFactory as SwatchCollectionFactory; +use Magento\Swatches\Model\Swatch; +use Magento\Swatches\Model\SwatchAttributeType; + +/** + * Base update and assert swatch attribute data. + */ +abstract class AbstractUpdateSwatchAttributeTest extends AbstractUpdateAttributeTest +{ + /** @var SwatchAttributeType */ + private $swatchAttributeType; + + /** @var SwatchCollectionFactory */ + private $swatchCollectionFactory; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + $this->swatchAttributeType = $this->_objectManager->get(SwatchAttributeType::class); + $this->swatchCollectionFactory = $this->_objectManager->get(SwatchCollectionFactory::class); + } + + /** + * @inheritdoc + */ + protected function replaceStoreCodeWithId(array $optionsArray): array + { + $optionsArray = parent::replaceStoreCodeWithId($optionsArray); + foreach ($optionsArray as $key => $option) { + if (isset($option['swatch'])) { + $optionsArray[$key]['swatch'] = $this->prepareStoresData($option['swatch']); + } + } + + return $optionsArray; + } + + /** + * @inheritdoc + */ + protected function getActualOptionsData(string $attributeId): array + { + $actualOptionsData = parent::getActualOptionsData($attributeId); + foreach (array_keys($actualOptionsData) as $optionId) { + $actualOptionsData[$optionId]['swatch'] = $this->getAttributeOptionSwatchValues($optionId); + } + + return $actualOptionsData; + } + + /** + * @inheritdoc + */ + protected function prepareStoreOptionsPostData(array $optionsData): array + { + $optionsPostData = parent::prepareStoreOptionsPostData($optionsData); + $swatchType = $this->getSwatchType(); + $swatchOptionsPostData = []; + + foreach ($optionsData as $optionId => $option) { + $data = []; + $data['option' . $swatchType] = $optionsPostData[$optionId]['option']; + $optionSwatch = $swatchType == Swatch::SWATCH_INPUT_TYPE_VISUAL ? $option['swatch'][0] : $option['swatch']; + + $data['swatch' . $swatchType] = [ + 'value' => [ + $optionId => $optionSwatch, + ], + ]; + if (isset($optionsPostData[$optionId]['default'])) { + $data['default' . $swatchType] = $optionsPostData[$optionId]['default']; + } + $swatchOptionsPostData[] = $data; + } + + return $swatchOptionsPostData; + } + + /** + * @inheritdoc + */ + protected function prepareStoreOptionsExpectedData(array $optionsData): array + { + $optionsExpectedData = parent::prepareStoreOptionsExpectedData($optionsData); + $optionsArray = $optionsExpectedData['options_array']; + foreach (array_keys($optionsArray) as $optionId) { + $optionsArray[$optionId]['swatch'] = $optionsData[$optionId]['swatch']; + } + + return [ + 'options_array' => $optionsArray, + 'default_value' => $optionsExpectedData['default_value'], + ]; + } + + /** + * @inheritdoc + */ + protected function assertUpdateAttributeData( + ProductAttributeInterface $attribute, + array $expectedData + ): void { + $this->swatchAttributeType->isSwatchAttribute($attribute); + parent::assertUpdateAttributeData($attribute, $expectedData); + } + + /** + * Get attribute option swatch values by option id. + * + * @param int $optionId + * @return array + */ + private function getAttributeOptionSwatchValues(int $optionId): array + { + $swatchValues = []; + $collection = $this->swatchCollectionFactory->create(); + $collection->addFieldToFilter('option_id', $optionId); + + foreach ($collection as $item) { + $swatchValues[$item->getData('store_id')] = $item->getData('value'); + } + + return $swatchValues; + } + + /** + * Get swatch type. + * + * @return string + */ + abstract protected function getSwatchType(): string; +} diff --git a/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Update/InputType/TextSwatchTest.php b/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Update/InputType/TextSwatchTest.php new file mode 100644 index 0000000000000..b62671bef04a4 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Update/InputType/TextSwatchTest.php @@ -0,0 +1,91 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Swatches\Controller\Adminhtml\Product\Attribute\Update\InputType; + +use Magento\Swatches\Controller\Adminhtml\Product\Attribute\Update\AbstractUpdateSwatchAttributeTest; +use Magento\Swatches\Model\Swatch; + +/** + * Test cases related to update attribute with input type text swatch. + * + * @magentoDbIsolation enabled + * @magentoAppArea adminhtml + */ +class TextSwatchTest extends AbstractUpdateSwatchAttributeTest +{ + /** + * Test update attribute. + * + * @dataProvider \Magento\TestFramework\Swatches\Model\Attribute\DataProvider\TextSwatch::getUpdateProvider + * @magentoDataFixture Magento/Swatches/_files/product_text_swatch_attribute.php + * + * @param array $postData + * @param array $expectedData + * @return void + */ + public function testUpdateAttribute(array $postData, array $expectedData): void + { + $this->updateAttributeUsingData('text_swatch_attribute', $postData); + $this->assertUpdateAttributeProcess('text_swatch_attribute', $postData, $expectedData); + } + + /** + * Test update attribute with error. + * + * @dataProvider \Magento\TestFramework\Swatches\Model\Attribute\DataProvider\TextSwatch::getUpdateProviderWithErrorMessage + * @magentoDataFixture Magento/Swatches/_files/product_text_swatch_attribute.php + * + * @param array $postData + * @param string $errorMessage + * @return void + */ + public function testUpdateAttributeWithError(array $postData, string $errorMessage): void + { + $this->updateAttributeUsingData('text_swatch_attribute', $postData); + $this->assertErrorSessionMessages($errorMessage); + } + + /** + * Test update attribute frontend labels on stores. + * + * @dataProvider \Magento\TestFramework\Swatches\Model\Attribute\DataProvider\TextSwatch::getUpdateFrontendLabelsProvider + * @magentoDataFixture Magento/Store/_files/second_website_with_two_stores.php + * @magentoDataFixture Magento/Swatches/_files/product_text_swatch_attribute.php + * + * @param array $postData + * @param array $expectedData + * @return void + */ + public function testUpdateFrontendLabelOnStores(array $postData, array $expectedData): void + { + $this->processUpdateFrontendLabelOnStores('text_swatch_attribute', $postData, $expectedData); + } + + /** + * Test update attribute options on stores. + * + * @dataProvider \Magento\TestFramework\Swatches\Model\Attribute\DataProvider\TextSwatch::getUpdateOptionsProvider + * @magentoDataFixture Magento/Store/_files/second_website_with_two_stores.php + * @magentoDataFixture Magento/Swatches/_files/product_text_swatch_attribute.php + * + * @param array $postData + * @return void + */ + public function testUpdateOptionsOnStores(array $postData): void + { + $this->processUpdateOptionsOnStores('text_swatch_attribute', $postData); + } + + /** + * @inheritdoc + */ + protected function getSwatchType(): string + { + return Swatch::SWATCH_INPUT_TYPE_TEXT; + } +} diff --git a/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Update/InputType/VisualSwatchTest.php b/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Update/InputType/VisualSwatchTest.php new file mode 100644 index 0000000000000..b5aa58bbd3339 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Update/InputType/VisualSwatchTest.php @@ -0,0 +1,91 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Swatches\Controller\Adminhtml\Product\Attribute\Update\InputType; + +use Magento\Swatches\Controller\Adminhtml\Product\Attribute\Update\AbstractUpdateSwatchAttributeTest; +use Magento\Swatches\Model\Swatch; + +/** + * Test cases related to update attribute with input type visual swatch. + * + * @magentoDbIsolation enabled + * @magentoAppArea adminhtml + */ +class VisualSwatchTest extends AbstractUpdateSwatchAttributeTest +{ + /** + * Test update attribute. + * + * @dataProvider \Magento\TestFramework\Swatches\Model\Attribute\DataProvider\VisualSwatch::getUpdateProvider + * @magentoDataFixture Magento/Swatches/_files/product_visual_swatch_attribute.php + * + * @param array $postData + * @param array $expectedData + * @return void + */ + public function testUpdateAttribute(array $postData, array $expectedData): void + { + $this->updateAttributeUsingData('visual_swatch_attribute', $postData); + $this->assertUpdateAttributeProcess('visual_swatch_attribute', $postData, $expectedData); + } + + /** + * Test update attribute with error. + * + * @dataProvider \Magento\TestFramework\Swatches\Model\Attribute\DataProvider\VisualSwatch::getUpdateProviderWithErrorMessage + * @magentoDataFixture Magento/Swatches/_files/product_visual_swatch_attribute.php + * + * @param array $postData + * @param string $errorMessage + * @return void + */ + public function testUpdateAttributeWithError(array $postData, string $errorMessage): void + { + $this->updateAttributeUsingData('visual_swatch_attribute', $postData); + $this->assertErrorSessionMessages($errorMessage); + } + + /** + * Test update attribute frontend labels on stores. + * + * @dataProvider \Magento\TestFramework\Swatches\Model\Attribute\DataProvider\VisualSwatch::getUpdateFrontendLabelsProvider + * @magentoDataFixture Magento/Store/_files/second_website_with_two_stores.php + * @magentoDataFixture Magento/Swatches/_files/product_visual_swatch_attribute.php + * + * @param array $postData + * @param array $expectedData + * @return void + */ + public function testUpdateFrontendLabelOnStores(array $postData, array $expectedData): void + { + $this->processUpdateFrontendLabelOnStores('visual_swatch_attribute', $postData, $expectedData); + } + + /** + * Test update attribute options on stores. + * + * @dataProvider \Magento\TestFramework\Swatches\Model\Attribute\DataProvider\VisualSwatch::getUpdateOptionsProvider + * @magentoDataFixture Magento/Store/_files/second_website_with_two_stores.php + * @magentoDataFixture Magento/Swatches/_files/product_visual_swatch_attribute.php + * + * @param array $postData + * @return void + */ + public function testUpdateOptionsOnStores(array $postData): void + { + $this->processUpdateOptionsOnStores('visual_swatch_attribute', $postData); + } + + /** + * @inheritdoc + */ + protected function getSwatchType(): string + { + return Swatch::SWATCH_INPUT_TYPE_VISUAL; + } +} diff --git a/dev/tests/integration/testsuite/Magento/Swatches/_files/product_visual_swatch_attribute_rollback.php b/dev/tests/integration/testsuite/Magento/Swatches/_files/product_visual_swatch_attribute_rollback.php index 67157532bdb98..e6b23a757441d 100644 --- a/dev/tests/integration/testsuite/Magento/Swatches/_files/product_visual_swatch_attribute_rollback.php +++ b/dev/tests/integration/testsuite/Magento/Swatches/_files/product_visual_swatch_attribute_rollback.php @@ -11,6 +11,7 @@ use Magento\Catalog\Api\ProductAttributeRepositoryInterface; $objectManager = Bootstrap::getObjectManager(); +/** @var Registry $registry */ $registry = $objectManager->get(Registry::class); $registry->unregister('isSecureArea'); $registry->register('isSecureArea', true); @@ -18,7 +19,7 @@ $attributeRepository = $objectManager->create(ProductAttributeRepositoryInterface::class); try { - $attributeRepository->deleteById('text_swatch_attribute'); + $attributeRepository->deleteById('visual_swatch_attribute'); } catch (NoSuchEntityException $e) { } $registry->unregister('isSecureArea'); diff --git a/dev/tests/integration/testsuite/Magento/Weee/Controller/Adminhtml/Product/Attribute/Save/InputType/FixedProductTaxTest.php b/dev/tests/integration/testsuite/Magento/Weee/Controller/Adminhtml/Product/Attribute/Save/InputType/FixedProductTaxTest.php index 5a6065d249b51..0c9b648a6123b 100644 --- a/dev/tests/integration/testsuite/Magento/Weee/Controller/Adminhtml/Product/Attribute/Save/InputType/FixedProductTaxTest.php +++ b/dev/tests/integration/testsuite/Magento/Weee/Controller/Adminhtml/Product/Attribute/Save/InputType/FixedProductTaxTest.php @@ -7,19 +7,20 @@ namespace Magento\Weee\Controller\Adminhtml\Product\Attribute\Save\InputType; -use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\InputType\AbstractSaveAttributeTest; +use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\AbstractSaveAttributeTest; /** * Test cases related to create attribute with input type fixed product tax. * * @magentoDbIsolation enabled + * @magentoAppArea adminhtml */ class FixedProductTaxTest extends AbstractSaveAttributeTest { /** * Test create attribute and compare attribute data and input data. * - * @dataProvider \Magento\TestFramework\Weee\Model\Attribute\DataProvider\FixedProductTax::getAttributeDataWithCheckArray() + * @dataProvider \Magento\TestFramework\Weee\Model\Attribute\DataProvider\FixedProductTax::getAttributeDataWithCheckArray * * @param array $attributePostData * @param array $checkArray @@ -33,7 +34,7 @@ public function testCreateAttribute(array $attributePostData, array $checkArray) /** * Test create attribute with error. * - * @dataProvider \Magento\TestFramework\Weee\Model\Attribute\DataProvider\FixedProductTax::getAttributeDataWithErrorMessage() + * @dataProvider \Magento\TestFramework\Weee\Model\Attribute\DataProvider\FixedProductTax::getAttributeDataWithErrorMessage * * @param array $attributePostData * @param string $errorMessage diff --git a/dev/tests/integration/testsuite/Magento/Weee/Controller/Adminhtml/Product/Attribute/Update/InputType/FixedProductTaxTest.php b/dev/tests/integration/testsuite/Magento/Weee/Controller/Adminhtml/Product/Attribute/Update/InputType/FixedProductTaxTest.php new file mode 100644 index 0000000000000..ec788bde0a002 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Weee/Controller/Adminhtml/Product/Attribute/Update/InputType/FixedProductTaxTest.php @@ -0,0 +1,67 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Weee\Controller\Adminhtml\Product\Attribute\Update\InputType; + +use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Update\AbstractUpdateAttributeTest; + +/** + * Test cases related to update attribute with input type fixed product tax. + * + * @magentoDbIsolation enabled + * @magentoAppArea adminhtml + */ +class FixedProductTaxTest extends AbstractUpdateAttributeTest +{ + /** + * Test update attribute. + * + * @dataProvider \Magento\TestFramework\Weee\Model\Attribute\DataProvider\FixedProductTax::getUpdateProvider + * @magentoDataFixture Magento/Weee/_files/fixed_product_attribute.php + * + * @param array $postData + * @param array $expectedData + * @return void + */ + public function testUpdateAttribute(array $postData, array $expectedData): void + { + $this->updateAttributeUsingData('fixed_product_attribute', $postData); + $this->assertUpdateAttributeProcess('fixed_product_attribute', $postData, $expectedData); + } + + /** + * Test update attribute with error. + * + * @dataProvider \Magento\TestFramework\Weee\Model\Attribute\DataProvider\FixedProductTax::getUpdateProviderWithErrorMessage + * @magentoDataFixture Magento/Weee/_files/fixed_product_attribute.php + * + * @param array $postData + * @param string $errorMessage + * @return void + */ + public function testUpdateAttributeWithError(array $postData, string $errorMessage): void + { + $this->updateAttributeUsingData('fixed_product_attribute', $postData); + $this->assertErrorSessionMessages($errorMessage); + } + + /** + * Test update attribute frontend labels on stores. + * + * @dataProvider \Magento\TestFramework\Weee\Model\Attribute\DataProvider\FixedProductTax::getUpdateFrontendLabelsProvider + * @magentoDataFixture Magento/Store/_files/second_website_with_two_stores.php + * @magentoDataFixture Magento/Weee/_files/fixed_product_attribute.php + * + * @param array $postData + * @param array $expectedData + * @return void + */ + public function testUpdateFrontendLabelOnStores(array $postData, array $expectedData): void + { + $this->processUpdateFrontendLabelOnStores('fixed_product_attribute', $postData, $expectedData); + } +} From 57736707881306724368fe2a9b95680189cfb9f4 Mon Sep 17 00:00:00 2001 From: Lena Orobei <oorobei@magento.com> Date: Mon, 3 Feb 2020 10:34:36 -0600 Subject: [PATCH 1106/1143] Changed cc_exp_year for credit card datasets --- .../Magento/Payment/Test/Repository/CreditCard.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Payment/Test/Repository/CreditCard.xml b/dev/tests/functional/tests/app/Magento/Payment/Test/Repository/CreditCard.xml index 7e3266cadf0a3..c922041b7bc5f 100644 --- a/dev/tests/functional/tests/app/Magento/Payment/Test/Repository/CreditCard.xml +++ b/dev/tests/functional/tests/app/Magento/Payment/Test/Repository/CreditCard.xml @@ -10,7 +10,7 @@ <dataset name="visa_default"> <field name="cc_number" xsi:type="string">4111111111111111</field> <field name="cc_exp_month" xsi:type="string">01 - January</field> - <field name="cc_exp_year" xsi:type="string">2020</field> + <field name="cc_exp_year" xsi:type="string">2042</field> <field name="cc_cid" xsi:type="string">123</field> </dataset> @@ -18,28 +18,28 @@ <field name="cc_type" xsi:type="string">Visa</field> <field name="cc_number" xsi:type="string">4111111111111111</field> <field name="cc_exp_month" xsi:type="string">01 - January</field> - <field name="cc_exp_year" xsi:type="string">2020</field> + <field name="cc_exp_year" xsi:type="string">2042</field> <field name="cc_cid" xsi:type="string">123</field> </dataset> <dataset name="visa_alt"> <field name="cc_number" xsi:type="string">4012888888881881</field> <field name="cc_exp_month" xsi:type="string">02 - February</field> - <field name="cc_exp_year" xsi:type="string">2021</field> + <field name="cc_exp_year" xsi:type="string">2042</field> <field name="cc_cid" xsi:type="string">123</field> </dataset> <dataset name="amex_default"> <field name="cc_number" xsi:type="string">378282246310005</field> <field name="cc_exp_month" xsi:type="string">02 - February</field> - <field name="cc_exp_year" xsi:type="string">2021</field> + <field name="cc_exp_year" xsi:type="string">2042</field> <field name="cc_cid" xsi:type="string">1234</field> </dataset> <dataset name="visa_direct"> <field name="cc_number" xsi:type="string">4617747819866651</field> <field name="cc_exp_month" xsi:type="string">01 - January</field> - <field name="cc_exp_year" xsi:type="string">2020</field> + <field name="cc_exp_year" xsi:type="string">2042</field> <field name="cc_cid" xsi:type="string">123</field> </dataset> @@ -54,14 +54,14 @@ <dataset name="visa_cvv_mismatch"> <field name="cc_number" xsi:type="string">4111111111111111</field> <field name="cc_exp_month" xsi:type="string">01 - January</field> - <field name="cc_exp_year" xsi:type="string">2020</field> + <field name="cc_exp_year" xsi:type="string">2042</field> <field name="cc_cid" xsi:type="string">306</field> </dataset> <dataset name="mastercard_default"> <field name="cc_number" xsi:type="string">5555555555554444</field> <field name="cc_exp_month" xsi:type="string">01 - January</field> - <field name="cc_exp_year" xsi:type="string">2020</field> + <field name="cc_exp_year" xsi:type="string">2042</field> <field name="cc_cid" xsi:type="string">123</field> </dataset> </repository> From 1f6569a107f9e1b9e4133036cd2ba40937894f79 Mon Sep 17 00:00:00 2001 From: rishatiwari <rishatiwari@outlook.com> Date: Sun, 2 Feb 2020 13:47:33 +0530 Subject: [PATCH 1107/1143] doc url updated --- phpserver/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpserver/README.md b/phpserver/README.md index e68856fc747fd..a7466557310ac 100644 --- a/phpserver/README.md +++ b/phpserver/README.md @@ -27,7 +27,7 @@ php bin/magento setup:install --base-url=http://127.0.0.1:8082 Notes: - By default, Magento creates a random Admin URI for you. Make sure to write this value down because it's how you access the Magento Admin later. For example : ```http://127.0.0.1:8082/index.php/admin_1vpn01```. -For more informations about the installation process using the CLI, you can consult the dedicated documentation that can found in [the developer documentation](https://github.com/magento/devdocs/blob/develop/guides/v2.0/install-gde/install/cli/install-cli-install.md). +For more information about the installation process using the CLI, you can consult the dedicated documentation that can found in [the developer documentation](https://devdocs.magento.com/guides/v2.3/install-gde/install/cli/install-cli-subcommands.html). ### How to run Magento From a3f548151ff4debd5e5f61d5410751b854d5cb87 Mon Sep 17 00:00:00 2001 From: Lena Orobei <oorobei@magento.com> Date: Mon, 3 Feb 2020 12:08:43 -0600 Subject: [PATCH 1108/1143] Changed cc_exp_year for credit card datasets - 42 was not the answer --- .../Magento/Payment/Test/Repository/CreditCard.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Payment/Test/Repository/CreditCard.xml b/dev/tests/functional/tests/app/Magento/Payment/Test/Repository/CreditCard.xml index c922041b7bc5f..b2c866f9cdce1 100644 --- a/dev/tests/functional/tests/app/Magento/Payment/Test/Repository/CreditCard.xml +++ b/dev/tests/functional/tests/app/Magento/Payment/Test/Repository/CreditCard.xml @@ -10,7 +10,7 @@ <dataset name="visa_default"> <field name="cc_number" xsi:type="string">4111111111111111</field> <field name="cc_exp_month" xsi:type="string">01 - January</field> - <field name="cc_exp_year" xsi:type="string">2042</field> + <field name="cc_exp_year" xsi:type="string">2025</field> <field name="cc_cid" xsi:type="string">123</field> </dataset> @@ -18,28 +18,28 @@ <field name="cc_type" xsi:type="string">Visa</field> <field name="cc_number" xsi:type="string">4111111111111111</field> <field name="cc_exp_month" xsi:type="string">01 - January</field> - <field name="cc_exp_year" xsi:type="string">2042</field> + <field name="cc_exp_year" xsi:type="string">2025</field> <field name="cc_cid" xsi:type="string">123</field> </dataset> <dataset name="visa_alt"> <field name="cc_number" xsi:type="string">4012888888881881</field> <field name="cc_exp_month" xsi:type="string">02 - February</field> - <field name="cc_exp_year" xsi:type="string">2042</field> + <field name="cc_exp_year" xsi:type="string">2025</field> <field name="cc_cid" xsi:type="string">123</field> </dataset> <dataset name="amex_default"> <field name="cc_number" xsi:type="string">378282246310005</field> <field name="cc_exp_month" xsi:type="string">02 - February</field> - <field name="cc_exp_year" xsi:type="string">2042</field> + <field name="cc_exp_year" xsi:type="string">2025</field> <field name="cc_cid" xsi:type="string">1234</field> </dataset> <dataset name="visa_direct"> <field name="cc_number" xsi:type="string">4617747819866651</field> <field name="cc_exp_month" xsi:type="string">01 - January</field> - <field name="cc_exp_year" xsi:type="string">2042</field> + <field name="cc_exp_year" xsi:type="string">2025</field> <field name="cc_cid" xsi:type="string">123</field> </dataset> @@ -54,14 +54,14 @@ <dataset name="visa_cvv_mismatch"> <field name="cc_number" xsi:type="string">4111111111111111</field> <field name="cc_exp_month" xsi:type="string">01 - January</field> - <field name="cc_exp_year" xsi:type="string">2042</field> + <field name="cc_exp_year" xsi:type="string">2025</field> <field name="cc_cid" xsi:type="string">306</field> </dataset> <dataset name="mastercard_default"> <field name="cc_number" xsi:type="string">5555555555554444</field> <field name="cc_exp_month" xsi:type="string">01 - January</field> - <field name="cc_exp_year" xsi:type="string">2042</field> + <field name="cc_exp_year" xsi:type="string">2025</field> <field name="cc_cid" xsi:type="string">123</field> </dataset> </repository> From 5f42ddb9b8fa5addaa9a88b310d525f86158aef9 Mon Sep 17 00:00:00 2001 From: Lena Orobei <oorobei@magento.com> Date: Mon, 3 Feb 2020 13:53:35 -0600 Subject: [PATCH 1109/1143] Fixed unstable MFTF test --- .../Test/AddConfigurableProductToOrderFromShoppingCartTest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AddConfigurableProductToOrderFromShoppingCartTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AddConfigurableProductToOrderFromShoppingCartTest.xml index 6d9f35efc7903..a15e176c943ab 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AddConfigurableProductToOrderFromShoppingCartTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AddConfigurableProductToOrderFromShoppingCartTest.xml @@ -72,6 +72,7 @@ <!-- Delete category --> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <magentoCLI command="cron:run --group=index" stepKey="runCron"/> </after> <!-- Login as customer --> From 711ae3620b334934210098263292dd18c8e5715b Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Tue, 4 Feb 2020 10:41:54 +0200 Subject: [PATCH 1110/1143] MC-30281: [2.4] Fix and unskip StorefrontSortingByPriceForConfigurableProductWithCatalogRuleAppliedTest --- .../Test/Mftf/ActionGroup/CatalogPriceRuleActionGroup.xml | 3 ++- .../NewCatalogPriceRuleByUIWithConditionIsSKUActionGroup.xml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogPriceRuleActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogPriceRuleActionGroup.xml index e0d02a280bf6c..d20798aef4838 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogPriceRuleActionGroup.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogPriceRuleActionGroup.xml @@ -11,7 +11,8 @@ <!-- action group to create a new catalog price rule giving a catalogRule entity --> <actionGroup name="NewCatalogPriceRuleByUIActionGroup"> <annotations> - <description>Goes to the Catalog Price Rule grid. Clicks on Add. Fills in the provided Catalog Rule details.</description> + <description>DEPRECATED. Please use set of AG: AdminOpenNewCatalogPriceRuleFormPageActionGroup, AdminCatalogPriceRuleFillMainInfoActionGroup, AdminCatalogPriceRuleFillActionsActionGroup, AdminCatalogPriceRuleSaveAndApplyActionGroup + Goes to the Catalog Price Rule grid. Clicks on Add. Fills in the provided Catalog Rule details.</description> </annotations> <arguments> <argument name="catalogRule" defaultValue="_defaultCatalogRule"/> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/NewCatalogPriceRuleByUIWithConditionIsSKUActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/NewCatalogPriceRuleByUIWithConditionIsSKUActionGroup.xml index 9d25ffa948ad1..217a7519defa7 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/NewCatalogPriceRuleByUIWithConditionIsSKUActionGroup.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/NewCatalogPriceRuleByUIWithConditionIsSKUActionGroup.xml @@ -10,7 +10,8 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="NewCatalogPriceRuleByUIWithConditionIsSKUActionGroup" extends="NewCatalogPriceRuleByUIActionGroup"> <annotations> - <description>EXTENDS: newCatalogPriceRuleByUI. Add a Catalog Price Rule Condition based on the provided SKU.</description> + <description>DEPRECATED. Please use set of AG: AdminOpenNewCatalogPriceRuleFormPageActionGroup, AdminCatalogPriceRuleFillMainInfoActionGroup, AdminCatalogPriceRuleFillActionsActionGroup, AdminCatalogPriceRuleAddSkuConditionActionGroup, AdminCatalogPriceRuleSaveAndApplyActionGroup + EXTENDS: newCatalogPriceRuleByUI. Add a Catalog Price Rule Condition based on the provided SKU.</description> </annotations> <arguments> <argument name="productSku"/> From 333e8af90b2a712be9278839ea1a3c2e9bb4e8d4 Mon Sep 17 00:00:00 2001 From: Roman Zhupanyn <roma.dj.elf@gmail.com> Date: Tue, 4 Feb 2020 11:01:06 +0200 Subject: [PATCH 1111/1143] MC-24930: Admin: Edit product Attribute --- .../TestFramework/Eav/Model/Attribute/DataProvider/Date.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/Date.php b/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/Date.php index 3c6caddfdb95c..c4e34ef8984a8 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/Date.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/Date.php @@ -91,7 +91,7 @@ public function getUpdateProviderWithErrorMessage(): array [ "{$frontendInput}_wrong_default_value" => [ 'post_data' => [ - 'default_value_date' => '2019//12//12', + 'default_value_date' => '//2019/12/12', ], 'error_message' => (string)__('The default date is invalid. Verify the date and try again.'), ], From 199afbff8651b267ba52a3536784e22cc37979f6 Mon Sep 17 00:00:00 2001 From: Lachlan Turner <lachlan.turner@aligent.com.au> Date: Tue, 4 Feb 2020 20:49:46 +1030 Subject: [PATCH 1112/1143] #26622 - Change to check for both parentItemId and parentItem --- app/code/Magento/SalesRule/Model/Validator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/SalesRule/Model/Validator.php b/app/code/Magento/SalesRule/Model/Validator.php index addfd6107f600..f05ad1eaba7fd 100644 --- a/app/code/Magento/SalesRule/Model/Validator.php +++ b/app/code/Magento/SalesRule/Model/Validator.php @@ -383,7 +383,7 @@ public function initTotals($items, Address $address) foreach ($items as $item) { //Skipping child items to avoid double calculations - if ($item->getParentItem()) { + if ($item->getParentItemId() || $item->getParentItem()) { continue; } if (!$rule->getActions()->validate($item)) { From 90c354044003d9d870f2ab52dbf0cf07ddde44b7 Mon Sep 17 00:00:00 2001 From: Lachlan Turner <lachlan.turner@aligent.com.au> Date: Tue, 4 Feb 2020 20:54:02 +1030 Subject: [PATCH 1113/1143] #26622 - Update test to check combinations of parentItemId and parentItem --- .../SalesRule/Test/Unit/Model/ValidatorTest.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/SalesRule/Test/Unit/Model/ValidatorTest.php b/app/code/Magento/SalesRule/Test/Unit/Model/ValidatorTest.php index e86068946ca78..93f46bc42db5a 100644 --- a/app/code/Magento/SalesRule/Test/Unit/Model/ValidatorTest.php +++ b/app/code/Magento/SalesRule/Test/Unit/Model/ValidatorTest.php @@ -346,11 +346,14 @@ public function testInitTotalsCanApplyDiscount() 'getDiscountCalculationPrice', 'getBaseDiscountCalculationPrice', 'getCalculationPrice', - 'getParentItemId' + 'getParentItemId', + 'getParentItem' ] ); $item2 = clone $item1; - $items = [$item1, $item2]; + $item3 = clone $item1; + $item4 = clone $item1; + $items = [$item1, $item2, $item3, $item4]; $rule->expects($this->any()) ->method('getSimpleAction') @@ -368,11 +371,21 @@ public function testInitTotalsCanApplyDiscount() $validator->expects($this->at(1))->method('isValid')->with($item2)->willReturn(true); $item1->expects($this->any())->method('getParentItemId')->willReturn(false); + $item1->expects($this->any())->method('getParentItem')->willReturn(false); $item1->expects($this->never())->method('getDiscountCalculationPrice'); $item1->expects($this->never())->method('getBaseDiscountCalculationPrice'); $item2->expects($this->any())->method('getParentItemId')->willReturn(false); + $item2->expects($this->any())->method('getParentItem')->willReturn(false); $item2->expects($this->any())->method('getDiscountCalculationPrice')->willReturn(50); $item2->expects($this->once())->method('getBaseDiscountCalculationPrice')->willReturn(50); + $item3->expects($this->any())->method('getParentItemId')->willReturn(false); + $item3->expects($this->any())->method('getParentItem')->willReturn(true); + $item3->expects($this->never())->method('getDiscountCalculationPrice'); + $item3->expects($this->never())->method('getBaseDiscountCalculationPrice'); + $item4->expects($this->any())->method('getParentItemId')->willReturn(true); + $item4->expects($this->any())->method('getParentItem')->willReturn(false); + $item4->expects($this->never())->method('getDiscountCalculationPrice'); + $item4->expects($this->never())->method('getBaseDiscountCalculationPrice'); $this->utility->expects($this->once())->method('getItemQty')->willReturn(1); $this->utility->expects($this->any())->method('canProcessRule')->willReturn(true); From 4efe5a09f7c801c0599786fcfaf913bab19bb99f Mon Sep 17 00:00:00 2001 From: Ihor Sviziev <ihor-sviziev@users.noreply.github.com> Date: Tue, 4 Feb 2020 12:57:42 +0200 Subject: [PATCH 1114/1143] Xml fixes for Magento_AdvancedPricingImportExport module --- app/code/Magento/AdvancedPricingImportExport/etc/module.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/AdvancedPricingImportExport/etc/module.xml b/app/code/Magento/AdvancedPricingImportExport/etc/module.xml index 4482ba7a0a5e8..ac7e6f860382b 100644 --- a/app/code/Magento/AdvancedPricingImportExport/etc/module.xml +++ b/app/code/Magento/AdvancedPricingImportExport/etc/module.xml @@ -6,5 +6,5 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> - <module name="Magento_AdvancedPricingImportExport" /> + <module name="Magento_AdvancedPricingImportExport"/> </config> From 9308b07b07b9903f1062aa0bb9126edc92d77b83 Mon Sep 17 00:00:00 2001 From: Roman Zhupanyn <roma.dj.elf@gmail.com> Date: Tue, 4 Feb 2020 15:22:20 +0200 Subject: [PATCH 1115/1143] MC-24930: Admin: Edit product Attribute --- .../Model/Attribute/DataProvider/DateTime.php | 161 ++++++++++++++++++ .../_files/product_datetime_attribute.php | 54 ++++++ .../product_datetime_attribute_rollback.php | 25 +++ .../Attribute/Save/InputType/DateTimeTest.php | 48 ++++++ .../Update/InputType/DateTimeTest.php | 68 ++++++++ 5 files changed, 356 insertions(+) create mode 100644 dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/DateTime.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/product_datetime_attribute.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/product_datetime_attribute_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Save/InputType/DateTimeTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Update/InputType/DateTimeTest.php diff --git a/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/DateTime.php b/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/DateTime.php new file mode 100644 index 0000000000000..70a8dc670e6d3 --- /dev/null +++ b/dev/tests/integration/framework/Magento/TestFramework/Eav/Model/Attribute/DataProvider/DateTime.php @@ -0,0 +1,161 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\TestFramework\Eav\Model\Attribute\DataProvider; + +use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface; +use Magento\Store\Model\Store; + +/** + * Product attribute data for attribute with input type datetime. + */ +class DateTime extends AbstractBaseAttributeData +{ + /** + * @inheritdoc + */ + public function __construct() + { + parent::__construct(); + $this->defaultAttributePostData['used_for_sort_by'] = '0'; + } + + /** + * @inheritdoc + */ + public function getAttributeData(): array + { + return array_replace_recursive( + parent::getAttributeData(), + [ + "{$this->getFrontendInput()}_with_default_value" => [ + [ + 'default_value_text' => '', + 'default_value_datetime' => '02/4/2020 6:30 AM', + ] + ] + ] + ); + } + + /** + * @inheritdoc + */ + public function getAttributeDataWithCheckArray(): array + { + return array_replace_recursive( + parent::getAttributeDataWithCheckArray(), + [ + "{$this->getFrontendInput()}_with_default_value" => [ + 1 => [ + 'default_value' => '2020-02-04 06:30:00', + ], + ], + ] + ); + } + + /** + * @inheritdoc + */ + public function getUpdateProvider(): array + { + $frontendInput = $this->getFrontendInput(); + return array_replace_recursive( + parent::getUpdateProvider(), + [ + "{$frontendInput}_other_attribute_code" => [ + 'post_data' => [ + 'attribute_code' => 'text_attribute_update', + ], + 'expected_data' => [ + 'attribute_code' => 'datetime_attribute', + ], + ], + ] + ); + } + + /** + * @inheritdoc + */ + public function getUpdateProviderWithErrorMessage(): array + { + $frontendInput = $this->getFrontendInput(); + return array_replace_recursive( + parent::getUpdateProviderWithErrorMessage(), + [ + "{$frontendInput}_wrong_default_value" => [ + 'post_data' => [ + 'default_value_datetime' => '//02/4/2020 6:30 AM', + ], + 'error_message' => (string)__('The default date is invalid. Verify the date and try again.'), + ], + ] + ); + } + + /** + * @inheritdoc + */ + protected function getFrontendInput(): string + { + return 'datetime'; + } + + /** + * @inheritdoc + */ + protected function getUpdatePostData(): array + { + return [ + 'frontend_label' => [ + Store::DEFAULT_STORE_ID => 'Date Time Attribute Update', + ], + 'frontend_input' => 'datetime', + 'is_required' => '1', + 'is_global' => ScopedAttributeInterface::SCOPE_WEBSITE, + 'default_value_datetime' => '02/4/2020 6:30 AM', + 'is_unique' => '1', + 'is_used_in_grid' => '1', + 'is_visible_in_grid' => '1', + 'is_filterable_in_grid' => '1', + 'is_searchable' => '1', + 'search_weight' => '2', + 'is_visible_in_advanced_search' => '1', + 'is_comparable' => '1', + 'is_used_for_promo_rules' => '1', + 'is_html_allowed_on_front' => '1', + 'is_visible_on_front' => '1', + 'used_in_product_listing' => '0', + 'used_for_sort_by' => '1', + ]; + } + + /** + * @inheritdoc + */ + protected function getUpdateExpectedData(): array + { + $updatePostData = $this->getUpdatePostData(); + unset($updatePostData['default_value_datetime']); + return array_merge( + $updatePostData, + [ + 'frontend_label' => 'Date Time Attribute Update', + 'attribute_code' => 'datetime_attribute', + 'default_value' => '2020-02-04 06:30:00', + 'frontend_class' => null, + 'is_filterable' => '0', + 'is_filterable_in_search' => '0', + 'position' => '0', + 'is_user_defined' => '1', + 'backend_type' => 'datetime', + ] + ); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_datetime_attribute.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_datetime_attribute.php new file mode 100644 index 0000000000000..c1e788861266c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_datetime_attribute.php @@ -0,0 +1,54 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\Data\ProductAttributeInterface; +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Catalog\Model\ResourceModel\Eav\Attribute; +use Magento\Catalog\Model\ResourceModel\Eav\AttributeFactory; +use Magento\Catalog\Setup\CategorySetup; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var CategorySetup $installer */ +$installer = $objectManager->create(CategorySetup::class); +$entityType = $installer->getEntityTypeId(ProductAttributeInterface::ENTITY_TYPE_CODE); +/** @var ProductAttributeRepositoryInterface $attributeRepository */ +$attributeRepository = $objectManager->create(ProductAttributeRepositoryInterface::class); +/** @var Attribute $attribute */ +$attribute = $objectManager->get(AttributeFactory::class)->create(); +if (!$attribute->loadByCode($entityType, 'datetime_attribute')->getAttributeId()) { + $attribute->setData( + [ + 'attribute_code' => 'datetime_attribute', + 'entity_type_id' => $entityType, + 'is_global' => 1, + 'is_user_defined' => 1, + 'frontend_input' => 'datetime', + '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' => 1, + 'used_for_sort_by' => 0, + 'frontend_label' => ['Date Time Attribute'], + 'backend_type' => 'datetime', + ] + ); + $attributeRepository->save($attribute); + $installer->addAttributeToGroup( + ProductAttributeInterface::ENTITY_TYPE_CODE, + 'Default', + 'General', + $attribute->getId() + ); +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_datetime_attribute_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_datetime_attribute_rollback.php new file mode 100644 index 0000000000000..51b1ea5418ca9 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_datetime_attribute_rollback.php @@ -0,0 +1,25 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\Framework\Registry; +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; + +$objectManager = Bootstrap::getObjectManager(); +$registry = $objectManager->get(Registry::class); +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); +/** @var ProductAttributeRepositoryInterface $attributeRepository */ +$attributeRepository = $objectManager->create(ProductAttributeRepositoryInterface::class); + +try { + $attributeRepository->deleteById('datetime_attribute'); +} catch (NoSuchEntityException $e) { +} +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); diff --git a/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Save/InputType/DateTimeTest.php b/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Save/InputType/DateTimeTest.php new file mode 100644 index 0000000000000..e80a29877a508 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Save/InputType/DateTimeTest.php @@ -0,0 +1,48 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Eav\Controller\Adminhtml\Product\Attribute\Save\InputType; + +use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\AbstractSaveAttributeTest; + +/** + * Test cases related to create attribute with input type datetime. + * + * @magentoDbIsolation enabled + * @magentoAppArea adminhtml + */ +class DateTimeTest extends AbstractSaveAttributeTest +{ + /** + * Test create attribute and compare attribute data and input data. + * + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\DateTime::getAttributeDataWithCheckArray + * @magentoConfigFixture default/general/locale/timezone UTC + * + * @param array $attributePostData + * @param array $checkArray + * @return void + */ + public function testCreateAttribute(array $attributePostData, array $checkArray): void + { + $this->createAttributeUsingDataAndAssert($attributePostData, $checkArray); + } + + /** + * Test create attribute with error. + * + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\DateTime::getAttributeDataWithErrorMessage + * + * @param array $attributePostData + * @param string $errorMessage + * @return void + */ + public function testCreateAttributeWithError(array $attributePostData, string $errorMessage): void + { + $this->createAttributeUsingDataWithErrorAndAssert($attributePostData, $errorMessage); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Update/InputType/DateTimeTest.php b/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Update/InputType/DateTimeTest.php new file mode 100644 index 0000000000000..2a6f730baf624 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Eav/Controller/Adminhtml/Product/Attribute/Update/InputType/DateTimeTest.php @@ -0,0 +1,68 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Eav\Controller\Adminhtml\Product\Attribute\Update\InputType; + +use Magento\Catalog\Controller\Adminhtml\Product\Attribute\Update\AbstractUpdateAttributeTest; + +/** + * Test cases related to update attribute with input type date. + * + * @magentoDbIsolation enabled + * @magentoAppArea adminhtml + */ +class DateTimeTest extends AbstractUpdateAttributeTest +{ + /** + * Test update attribute. + * + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\DateTime::getUpdateProvider + * @magentoConfigFixture default/general/locale/timezone UTC + * @magentoDataFixture Magento/Catalog/_files/product_datetime_attribute.php + * + * @param array $postData + * @param array $expectedData + * @return void + */ + public function testUpdateAttribute(array $postData, array $expectedData): void + { + $this->updateAttributeUsingData('datetime_attribute', $postData); + $this->assertUpdateAttributeProcess('datetime_attribute', $postData, $expectedData); + } + + /** + * Test update attribute with error. + * + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\DateTime::getUpdateProviderWithErrorMessage + * @magentoDataFixture Magento/Catalog/_files/product_datetime_attribute.php + * + * @param array $postData + * @param string $errorMessage + * @return void + */ + public function testUpdateAttributeWithError(array $postData, string $errorMessage): void + { + $this->updateAttributeUsingData('datetime_attribute', $postData); + $this->assertErrorSessionMessages($errorMessage); + } + + /** + * Test update attribute frontend labels on stores. + * + * @dataProvider \Magento\TestFramework\Eav\Model\Attribute\DataProvider\DateTime::getUpdateFrontendLabelsProvider + * @magentoDataFixture Magento/Store/_files/second_website_with_two_stores.php + * @magentoDataFixture Magento/Catalog/_files/product_datetime_attribute.php + * + * @param array $postData + * @param array $expectedData + * @return void + */ + public function testUpdateFrontendLabelOnStores(array $postData, array $expectedData): void + { + $this->processUpdateFrontendLabelOnStores('datetime_attribute', $postData, $expectedData); + } +} From c80d0e40729692981a9c8bc3e36dafb86301e53f Mon Sep 17 00:00:00 2001 From: Yurii Sapiha <yurasapiga93@gmail.com> Date: Tue, 4 Feb 2020 16:36:18 +0200 Subject: [PATCH 1116/1143] MC-31023: Storefront: Create configurable product on (multiple websites/multiple storeviews) --- .../Store/ExecuteInStoreContext.php | 56 ++++ ...StoreConfigurableViewOnProductPageTest.php | 255 ++++++++++++++++++ ..._attribute_different_labels_per_stores.php | 82 ++++++ ...e_different_labels_per_stores_rollback.php | 30 +++ ...ct_different_option_labeles_per_stores.php | 92 +++++++ ...ent_option_labeles_per_stores_rollback.php | 16 ++ .../configurable_product_two_websites.php | 94 +++++++ ...igurable_product_two_websites_rollback.php | 17 ++ 8 files changed, 642 insertions(+) create mode 100644 dev/tests/integration/framework/Magento/TestFramework/Store/ExecuteInStoreContext.php create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/MultiStoreConfigurableViewOnProductPageTest.php create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_attribute_different_labels_per_stores.php create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_attribute_different_labels_per_stores_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_different_option_labeles_per_stores.php create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_different_option_labeles_per_stores_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_two_websites.php create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_two_websites_rollback.php diff --git a/dev/tests/integration/framework/Magento/TestFramework/Store/ExecuteInStoreContext.php b/dev/tests/integration/framework/Magento/TestFramework/Store/ExecuteInStoreContext.php new file mode 100644 index 0000000000000..eee7b81e8bd32 --- /dev/null +++ b/dev/tests/integration/framework/Magento/TestFramework/Store/ExecuteInStoreContext.php @@ -0,0 +1,56 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\TestFramework\Store; + +use Magento\Store\Api\Data\StoreInterface; +use Magento\Store\Model\StoreManagerInterface; + +/** + * Execute operation in specified store + */ +class ExecuteInStoreContext +{ + /** @var StoreManagerInterface */ + private $storeManager; + + /** + * @param StoreManagerInterface $storeManager + */ + public function __construct(StoreManagerInterface $storeManager) + { + $this->storeManager = $storeManager; + } + + /** + * Execute callback in store context + * + * @param null|string|bool|int|StoreInterface $store + * @param callable $method + * @param array $arguments + * @return mixed + */ + public function execute($store, callable $method, ...$arguments) + { + $storeCode = $store instanceof StoreInterface + ? $store->getCode() + : $this->storeManager->getStore($store)->getCode(); + $currentStore = $this->storeManager->getStore(); + + try { + if ($currentStore->getCode() !== $storeCode) { + $this->storeManager->setCurrentStore($storeCode); + } + + return $method(...array_values($arguments)); + } finally { + if ($currentStore->getCode() !== $storeCode) { + $this->storeManager->setCurrentStore($currentStore); + } + } + } +} diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/MultiStoreConfigurableViewOnProductPageTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/MultiStoreConfigurableViewOnProductPageTest.php new file mode 100644 index 0000000000000..c1adf0ef1d2be --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/MultiStoreConfigurableViewOnProductPageTest.php @@ -0,0 +1,255 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\ConfigurableProduct\Block\Product\View\Type; + +use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Catalog\Model\ResourceModel\Product as ProductResource; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Serialize\SerializerInterface; +use Magento\Framework\View\LayoutInterface; +use Magento\Store\Model\StoreManagerInterface; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\Store\ExecuteInStoreContext; +use PHPUnit\Framework\TestCase; + +/** + * Class check configurable product options displaying per stores + * + * @magentoDbIsolation disabled + */ +class MultiStoreConfigurableViewOnProductPageTest extends TestCase +{ + /** @var ObjectManagerInterface */ + private $objectManager; + + /** @var ProductRepositoryInterface */ + private $productRepository; + + /** @var StoreManagerInterface */ + private $storeManager; + + /** @var LayoutInterface */ + private $layout; + + /** @var SerializerInterface */ + private $serializer; + + /** @var ProductResource */ + private $productResource; + + /** @var ExecuteInStoreContext */ + private $executeInStoreContext; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + + $this->objectManager = Bootstrap::getObjectManager(); + $this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class); + $this->productRepository->cleanCache(); + $this->storeManager = $this->objectManager->get(StoreManagerInterface::class); + $this->layout = $this->objectManager->get(LayoutInterface::class); + $this->serializer = $this->objectManager->get(SerializerInterface::class); + $this->productResource = $this->objectManager->get(ProductResource::class); + $this->executeInStoreContext = $this->objectManager->get(ExecuteInStoreContext::class); + } + + /** + * @magentoDataFixture Magento/ConfigurableProduct/_files/configurable_product_different_option_labeles_per_stores.php + * + * @dataProvider expectedLabelsDataProvider + * + * @param array $expectedStoreData + * @param array $expectedSecondStoreData + * @return void + */ + public function testMultiStoreLabelView(array $expectedStoreData, array $expectedSecondStoreData): void + { + $this->executeInStoreContext->execute('default', [$this, 'assertProductLabel'], $expectedStoreData); + $this->executeInStoreContext->execute('fixturestore', [$this, 'assertProductLabel'], $expectedSecondStoreData); + } + + /** + * @return array + */ + public function expectedLabelsDataProvider(): array + { + return [ + [ + 'options_first_store' => [ + 'simple_option_1_default_store' => [ + 'label' => 'Option 1 Default Store', + ], + 'simple_option_2_default_store' => [ + 'label' => 'Option 2 Default Store', + ], + 'simple_option_3_default_store' => [ + 'label' => 'Option 3 Default Store', + ], + ], + 'options_second_store' => [ + 'simple_option_1_default_store' => [ + 'label' => 'Option 1 Second Store', + ], + 'simple_option_2_default_store' => [ + 'label' => 'Option 2 Second Store', + ], + 'simple_option_3_default_store' => [ + 'label' => 'Option 3 Second Store', + ], + ], + ], + ]; + } + + /** + * Assert configurable product labels config + * + * @param $expectedStoreData + * @return void + */ + public function assertProductLabel($expectedStoreData): void + { + $product = $this->productRepository->get('configurable', false, null, true); + $config = $this->getBlockConfig($product)['attributes'] ?? null; + $this->assertNotNull($config); + $this->assertAttributeConfig($expectedStoreData, reset($config)); + } + + /** + * @magentoDataFixture Magento/ConfigurableProduct/_files/configurable_product_two_websites.php + * + * @dataProvider expectedProductDataProvider + * + * @param array $expectedProducts + * @param array $expectedSecondStoreProducts + * @return void + */ + public function testMultiStoreOptionsView(array $expectedProducts, array $expectedSecondStoreProducts): void + { + $this->prepareConfigurableProduct('configurable', 'fixture_second_store'); + $this->executeInStoreContext->execute('default', [$this, 'assertProductConfig'], $expectedProducts); + $this->executeInStoreContext->execute( + 'fixture_second_store', + [$this, 'assertProductConfig'], + $expectedSecondStoreProducts + ); + } + + /** + * @return array + */ + public function expectedProductDataProvider(): array + { + return [ + [ + 'expected_store_products' => ['simple_option_1', 'simple_option_2'], + 'expected_second_store_products' => ['simple_option_2'], + ], + ]; + } + + /** + * Assert configurable product config + * + * @param $expectedProducts + * @return void + */ + public function assertProductConfig($expectedProducts): void + { + $product = $this->productRepository->get('configurable', false, null, true); + $config = $this->getBlockConfig($product)['index'] ?? null; + $this->assertNotNull($config); + $this->assertProducts($expectedProducts, $config); + } + + /** + * Prepare configurable product to test + * + * @param string $sku + * @param string $storeCode + * @return void + */ + private function prepareConfigurableProduct(string $sku, string $storeCode): void + { + $product = $this->productRepository->get($sku, false, null, true); + $productToUpdate = $product->getTypeInstance()->getUsedProductCollection($product) + ->setPageSize(1)->getFirstItem(); + $this->assertNotEmpty($productToUpdate->getData(), 'Configurable product does not have a child'); + $this->executeInStoreContext->execute($storeCode, [$this, 'setProductDisabled'], $productToUpdate); + } + + /** + * Assert product options display per stores + * + * @param array $expectedProducts + * @param array $config + * @return void + */ + private function assertProducts(array $expectedProducts, array $config): void + { + $this->assertCount(count($expectedProducts), $config); + $idsBySkus = $this->productResource->getProductsIdsBySkus($expectedProducts); + + foreach ($idsBySkus as $productId) { + $this->assertArrayHasKey($productId, $config); + } + } + + /** + * Set product status attribute to disabled + * + * @param ProductInterface $product + * @param string $storeCode + * @return void + */ + public function setProductDisabled(ProductInterface $product): void + { + $product->setStatus(Status::STATUS_DISABLED); + $this->productRepository->save($product); + } + + /** + * Get block config + * + * @param ProductInterface $product + * @return array + */ + private function getBlockConfig(ProductInterface $product): array + { + $block = $this->layout->createBlock(Configurable::class); + $block->setProduct($product); + + return $this->serializer->unserialize($block->getJsonConfig()); + } + + /** + * Assert configurable product config + * + * @param array $expectedData + * @param array $actualOptions + * @return void + */ + private function assertAttributeConfig(array $expectedData, array $actualOptions): void + { + $skus = array_keys($expectedData); + $idBySkuMap = $this->productResource->getProductsIdsBySkus($skus); + array_walk($actualOptions['options'], function (&$option) { + unset($option['id']); + }); + foreach ($expectedData as $sku => &$option) { + $option['products'] = [$idBySkuMap[$sku]]; + } + $this->assertEquals(array_values($expectedData), $actualOptions['options']); + } +} diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_attribute_different_labels_per_stores.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_attribute_different_labels_per_stores.php new file mode 100644 index 0000000000000..0d99869d4adf9 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_attribute_different_labels_per_stores.php @@ -0,0 +1,82 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\Data\ProductAttributeInterface; +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Catalog\Model\ResourceModel\Eav\Attribute; +use Magento\Catalog\Model\ResourceModel\Eav\AttributeFactory; +use Magento\Catalog\Setup\CategorySetup; +use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface; +use Magento\Store\Model\Store; +use Magento\TestFramework\Helper\Bootstrap; + +require __DIR__ . '/../../Store/_files/core_fixturestore.php'; + +$objectManager = Bootstrap::getObjectManager(); +$defaultInstalledStoreId = $storeManager->getStore('default')->getId(); +$secondStoreId = $storeManager->getStore('fixturestore')->getId(); +/** @var CategorySetup $installer */ +$installer = $objectManager->get(CategorySetup::class); +/** @var Attribute $attribute */ +$attribute = $objectManager->get(AttributeFactory::class)->create(); +/** @var ProductAttributeRepositoryInterface $attributeRepository */ +$attributeRepository = $objectManager->get(ProductAttributeRepositoryInterface::class); +$entityType = $installer->getEntityTypeId(ProductAttributeInterface::ENTITY_TYPE_CODE); +if (!$attribute->loadByCode($entityType, 'different_labels_attribute')->getAttributeId()) { + $attribute->setData( + [ + 'frontend_label' => ['Different option labels dropdown attribute'], + 'entity_type_id' => $entityType, + 'frontend_input' => 'select', + 'backend_type' => 'int', + 'is_required' => '0', + 'attribute_code' => 'different_labels_attribute', + 'is_global' => ScopedAttributeInterface::SCOPE_GLOBAL, + 'is_user_defined' => 1, + 'is_unique' => '0', + 'is_searchable' => '0', + 'is_comparable' => '0', + 'is_filterable' => '1', + 'is_filterable_in_search' => '0', + 'is_used_for_promo_rules' => '0', + 'is_html_allowed_on_front' => '1', + 'used_in_product_listing' => '1', + 'used_for_sort_by' => '0', + 'option' => [ + 'value' => [ + 'option_1' => [ + Store::DEFAULT_STORE_ID => 'Option 1', + $defaultInstalledStoreId => 'Option 1 Default Store', + $secondStoreId => 'Option 1 Second Store', + ], + 'option_2' => [ + Store::DEFAULT_STORE_ID => 'Option 2', + $defaultInstalledStoreId => 'Option 2 Default Store', + $secondStoreId => 'Option 2 Second Store', + ], + 'option_3' => [ + Store::DEFAULT_STORE_ID => 'Option 3', + $defaultInstalledStoreId => 'Option 3 Default Store', + $secondStoreId => 'Option 3 Second Store', + ], + ], + 'order' => [ + 'option_1' => 1, + 'option_2' => 2, + 'option_3' => 3, + ], + ], + ] + ); + $attributeRepository->save($attribute); + $installer->addAttributeToGroup( + ProductAttributeInterface::ENTITY_TYPE_CODE, + 'Default', + 'General', + $attribute->getId() + ); +} diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_attribute_different_labels_per_stores_rollback.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_attribute_different_labels_per_stores_rollback.php new file mode 100644 index 0000000000000..f69545c831a98 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_attribute_different_labels_per_stores_rollback.php @@ -0,0 +1,30 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\Framework\Registry; +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; + +$objectManager = Bootstrap::getObjectManager(); +/** @var Registry $registry */ +$registry = $objectManager->get(Registry::class); +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); +/** @var ProductAttributeRepositoryInterface $attributeRepository */ +$attributeRepository = $objectManager->get(ProductAttributeRepositoryInterface::class); + +try { + $attributeRepository->deleteById('different_labels_attribute'); +} catch (NoSuchEntityException $e) { + //already deleted +} + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); + +require __DIR__ . '/../../Store/_files/core_fixturestore_rollback.php'; diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_different_option_labeles_per_stores.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_different_option_labeles_per_stores.php new file mode 100644 index 0000000000000..c4498c6beae4e --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_different_option_labeles_per_stores.php @@ -0,0 +1,92 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\Data\ProductExtensionFactory; +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Catalog\Model\Product\Type as ProductType; +use Magento\Catalog\Model\Product\Visibility; +use Magento\Catalog\Model\ProductFactory; +use Magento\ConfigurableProduct\Helper\Product\Options\Factory; +use Magento\ConfigurableProduct\Model\Product\Type\Configurable; +use Magento\Store\Api\WebsiteRepositoryInterface; +use Magento\TestFramework\Helper\Bootstrap; + +require __DIR__ . '/configurable_attribute_different_labels_per_stores.php'; + +$objectManager = Bootstrap::getObjectManager(); +/** @var ProductAttributeRepositoryInterface $productAttributeRepository */ +$productAttributeRepository = $objectManager->get(ProductAttributeRepositoryInterface::class); +$attribute = $productAttributeRepository->get('different_labels_attribute'); +$options = $attribute->getOptions(); +/** @var WebsiteRepositoryInterface $websiteRepository */ +$websiteRepository = $objectManager->get(WebsiteRepositoryInterface::class); +$baseWebsite = $websiteRepository->get('base'); +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->get(ProductRepositoryInterface::class); +$productRepository->cleanCache(); +/** @var ProductFactory $productFactory */ +$productFactory = $objectManager->get(ProductFactory::class); +$attributeValues = []; +$associatedProductIds = []; +$rootCategoryId = $baseWebsite->getDefaultStore()->getRootCategoryId(); +array_shift($options); + +foreach ($options as $option) { + $product = $productFactory->create(); + $product->setTypeId(ProductType::TYPE_SIMPLE) + ->setAttributeSetId($product->getDefaultAttributeSetId()) + ->setWebsiteIds([$baseWebsite->getId()]) + ->setName('Configurable Option ' . $option->getLabel()) + ->setSku(strtolower(str_replace(' ', '_', 'simple ' . $option->getLabel()))) + ->setPrice(150) + ->setDifferentLabelsAttribute($option->getValue()) + ->setVisibility(Visibility::VISIBILITY_NOT_VISIBLE) + ->setStatus(Status::STATUS_ENABLED) + ->setCategoryIds([$rootCategoryId]) + ->setStockData(['use_config_manage_stock' => 1, 'qty' => 100, 'is_qty_decimal' => 0, 'is_in_stock' => 1]); + $product = $productRepository->save($product); + + $attributeValues[] = [ + 'label' => 'test', + 'attribute_id' => $attribute->getId(), + 'value_index' => $option->getValue(), + ]; + $associatedProductIds[] = $product->getId(); +} +/** @var Factory $optionsFactory */ +$optionsFactory = $objectManager->get(Factory::class); +$configurableAttributesData = [ + [ + 'attribute_id' => $attribute->getId(), + 'code' => $attribute->getAttributeCode(), + 'label' => $attribute->getStoreLabel(), + 'position' => '0', + 'values' => $attributeValues, + ], +]; +$configurableOptions = $optionsFactory->create($configurableAttributesData); + +$product = $productFactory->create(); +/** @var ProductExtensionFactory $extensionAttributesFactory */ +$extensionAttributesFactory = $objectManager->get(ProductExtensionFactory::class); +$extensionConfigurableAttributes = $product->getExtensionAttributes() ?: $extensionAttributesFactory->create(); +$extensionConfigurableAttributes->setConfigurableProductOptions($configurableOptions); +$extensionConfigurableAttributes->setConfigurableProductLinks($associatedProductIds); +$product->setExtensionAttributes($extensionConfigurableAttributes); + +$product->setTypeId(Configurable::TYPE_CODE) + ->setAttributeSetId($product->getDefaultAttributeSetId()) + ->setWebsiteIds([$baseWebsite->getId()]) + ->setName('Configurable Product') + ->setSku('configurable') + ->setVisibility(Visibility::VISIBILITY_BOTH) + ->setStatus(Status::STATUS_ENABLED) + ->setCategoryIds([$rootCategoryId]) + ->setStockData(['use_config_manage_stock' => 1, 'is_in_stock' => 1]); +$productRepository->save($product); diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_different_option_labeles_per_stores_rollback.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_different_option_labeles_per_stores_rollback.php new file mode 100644 index 0000000000000..c82da5f653bd8 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_different_option_labeles_per_stores_rollback.php @@ -0,0 +1,16 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\TestFramework\ConfigurableProduct\Model\DeleteConfigurableProduct; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var DeleteConfigurableProduct $deleteConfigurableProduct */ +$deleteConfigurableProduct = $objectManager->get(DeleteConfigurableProduct::class); +$deleteConfigurableProduct->execute('configurable'); + +require __DIR__ . '/configurable_attribute_different_labels_per_stores_rollback.php'; diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_two_websites.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_two_websites.php new file mode 100644 index 0000000000000..17837deb15a03 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_two_websites.php @@ -0,0 +1,94 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\Data\ProductExtensionFactory; +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Catalog\Model\Product\Type as ProductType; +use Magento\Catalog\Model\Product\Visibility; +use Magento\Catalog\Model\ProductFactory; +use Magento\ConfigurableProduct\Helper\Product\Options\Factory; +use Magento\ConfigurableProduct\Model\Product\Type\Configurable; +use Magento\Store\Api\WebsiteRepositoryInterface; +use Magento\TestFramework\Helper\Bootstrap; + +require __DIR__ . '/../../Store/_files/second_website_with_two_stores.php'; +require __DIR__ . '/configurable_attribute.php'; + +$objectManager = Bootstrap::getObjectManager(); +/** @var ProductAttributeRepositoryInterface $productAttributeRepository */ +$productAttributeRepository = $objectManager->get(ProductAttributeRepositoryInterface::class); +$attribute = $productAttributeRepository->get('test_configurable'); +$options = $attribute->getOptions(); +/** @var WebsiteRepositoryInterface $websiteRepository */ +$websiteRepository = $objectManager->get(WebsiteRepositoryInterface::class); +$baseWebsite = $websiteRepository->get('base'); +$secondWebsite = $websiteRepository->get('test'); +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->get(ProductRepositoryInterface::class); +$productRepository->cleanCache(); +/** @var ProductFactory $productFactory */ +$productFactory = $objectManager->get(ProductFactory::class); +$attributeValues = []; +$associatedProductIds = []; +$rootCategoryId = $baseWebsite->getDefaultStore()->getRootCategoryId(); +array_shift($options); + +foreach ($options as $option) { + $product = $productFactory->create(); + $product->setTypeId(ProductType::TYPE_SIMPLE) + ->setAttributeSetId($product->getDefaultAttributeSetId()) + ->setWebsiteIds([$baseWebsite->getId(), $secondWebsite->getId()]) + ->setName('Configurable Option ' . $option->getLabel()) + ->setSku(strtolower(str_replace(' ', '_', 'simple ' . $option->getLabel()))) + ->setPrice(150) + ->setTestConfigurable($option->getValue()) + ->setVisibility(Visibility::VISIBILITY_NOT_VISIBLE) + ->setStatus(Status::STATUS_ENABLED) + ->setCategoryIds([$rootCategoryId]) + ->setStockData(['use_config_manage_stock' => 1, 'qty' => 100, 'is_qty_decimal' => 0, 'is_in_stock' => 1]); + $product = $productRepository->save($product); + + $attributeValues[] = [ + 'label' => 'test', + 'attribute_id' => $attribute->getId(), + 'value_index' => $option->getValue(), + ]; + $associatedProductIds[] = $product->getId(); +} +/** @var Factory $optionsFactory */ +$optionsFactory = $objectManager->get(Factory::class); +$configurableAttributesData = [ + [ + 'attribute_id' => $attribute->getId(), + 'code' => $attribute->getAttributeCode(), + 'label' => $attribute->getStoreLabel(), + 'position' => '0', + 'values' => $attributeValues, + ], +]; +$configurableOptions = $optionsFactory->create($configurableAttributesData); + +$product = $productFactory->create(); +/** @var ProductExtensionFactory $extensionAttributesFactory */ +$extensionAttributesFactory = $objectManager->get(ProductExtensionFactory::class); +$extensionConfigurableAttributes = $product->getExtensionAttributes() ?: $extensionAttributesFactory->create(); +$extensionConfigurableAttributes->setConfigurableProductOptions($configurableOptions); +$extensionConfigurableAttributes->setConfigurableProductLinks($associatedProductIds); +$product->setExtensionAttributes($extensionConfigurableAttributes); + +$product->setTypeId(Configurable::TYPE_CODE) + ->setAttributeSetId($product->getDefaultAttributeSetId()) + ->setWebsiteIds([$baseWebsite->getId(), $secondWebsite->getId()]) + ->setName('Configurable Product') + ->setSku('configurable') + ->setVisibility(Visibility::VISIBILITY_BOTH) + ->setStatus(Status::STATUS_ENABLED) + ->setCategoryIds([$rootCategoryId]) + ->setStockData(['use_config_manage_stock' => 1, 'is_in_stock' => 1]); +$productRepository->save($product); diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_two_websites_rollback.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_two_websites_rollback.php new file mode 100644 index 0000000000000..78e3109352693 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_two_websites_rollback.php @@ -0,0 +1,17 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\TestFramework\ConfigurableProduct\Model\DeleteConfigurableProduct; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var DeleteConfigurableProduct $deleteConfigurableProduct */ +$deleteConfigurableProduct = $objectManager->get(DeleteConfigurableProduct::class); +$deleteConfigurableProduct->execute('configurable'); + +require __DIR__ . '/configurable_attribute_rollback.php'; +require __DIR__ . '/../../Store/_files/second_website_with_two_stores_rollback.php'; From aaa8c4d3cccde10f8f65a6626be309fecba55f23 Mon Sep 17 00:00:00 2001 From: Alex Paliarush <paliarus@adobe.com> Date: Tue, 4 Feb 2020 08:44:07 -0600 Subject: [PATCH 1117/1143] ECP-202: Deprecate Rotation Support in Magento --- app/code/Magento/Catalog/Helper/Image.php | 5 +++++ app/code/Magento/Catalog/Model/Product/Image.php | 3 +++ lib/internal/Magento/Framework/Image.php | 1 + .../Magento/Framework/Image/Adapter/AbstractAdapter.php | 1 + .../Magento/Framework/Image/Adapter/AdapterInterface.php | 1 + lib/internal/Magento/Framework/Image/Adapter/Gd2.php | 1 + lib/internal/Magento/Framework/Image/Adapter/ImageMagick.php | 1 + 7 files changed, 13 insertions(+) diff --git a/app/code/Magento/Catalog/Helper/Image.php b/app/code/Magento/Catalog/Helper/Image.php index 3e0976936329c..5b0aa0c496ecd 100644 --- a/app/code/Magento/Catalog/Helper/Image.php +++ b/app/code/Magento/Catalog/Helper/Image.php @@ -45,6 +45,7 @@ class Image extends AbstractHelper implements ArgumentInterface * Scheduled for rotate image * * @var bool + * @deprecated unused */ protected $_scheduleRotate = false; @@ -52,6 +53,7 @@ class Image extends AbstractHelper implements ArgumentInterface * Angle * * @var int + * @deprecated unused */ protected $_angle; @@ -408,6 +410,7 @@ public function backgroundColor($colorRGB) * * @param int $angle * @return $this + * @deprecated unused */ public function rotate($angle) { @@ -617,6 +620,7 @@ protected function _getModel() * * @param int $angle * @return $this + * @deprecated unused */ protected function setAngle($angle) { @@ -628,6 +632,7 @@ protected function setAngle($angle) * Get Rotation Angle * * @return int + * @deprecated unused */ protected function getAngle() { diff --git a/app/code/Magento/Catalog/Model/Product/Image.php b/app/code/Magento/Catalog/Model/Product/Image.php index a0be36c5a327c..6c7c133223532 100644 --- a/app/code/Magento/Catalog/Model/Product/Image.php +++ b/app/code/Magento/Catalog/Model/Product/Image.php @@ -101,6 +101,7 @@ class Image extends \Magento\Framework\Model\AbstractModel /** * @var int + * @deprecated unused */ protected $_angle; @@ -524,6 +525,7 @@ public function resize() * * @param int $angle * @return $this + * @deprecated unused */ public function rotate($angle) { @@ -539,6 +541,7 @@ public function rotate($angle) * * @param int $angle * @return $this + * @deprecated unused */ public function setAngle($angle) { diff --git a/lib/internal/Magento/Framework/Image.php b/lib/internal/Magento/Framework/Image.php index b3867c0197b79..ab88f23860704 100644 --- a/lib/internal/Magento/Framework/Image.php +++ b/lib/internal/Magento/Framework/Image.php @@ -85,6 +85,7 @@ public function save($destination = null, $newFileName = null) * @param int $angle * @access public * @return void + * @deprecated unused */ public function rotate($angle) { diff --git a/lib/internal/Magento/Framework/Image/Adapter/AbstractAdapter.php b/lib/internal/Magento/Framework/Image/Adapter/AbstractAdapter.php index b06f2f9e62397..ecb10c67a7dce 100644 --- a/lib/internal/Magento/Framework/Image/Adapter/AbstractAdapter.php +++ b/lib/internal/Magento/Framework/Image/Adapter/AbstractAdapter.php @@ -204,6 +204,7 @@ abstract public function resize($width = null, $height = null); * * @param int $angle * @return void + * @deprecated unused */ abstract public function rotate($angle); diff --git a/lib/internal/Magento/Framework/Image/Adapter/AdapterInterface.php b/lib/internal/Magento/Framework/Image/Adapter/AdapterInterface.php index b31ed5c773495..7749664e520d0 100644 --- a/lib/internal/Magento/Framework/Image/Adapter/AdapterInterface.php +++ b/lib/internal/Magento/Framework/Image/Adapter/AdapterInterface.php @@ -113,6 +113,7 @@ public function save($destination = null, $newName = null); * * @param int $angle * @return void + * @deprecated unused */ public function rotate($angle); } diff --git a/lib/internal/Magento/Framework/Image/Adapter/Gd2.php b/lib/internal/Magento/Framework/Image/Adapter/Gd2.php index 04d4c5386bd25..caa080c02e255 100644 --- a/lib/internal/Magento/Framework/Image/Adapter/Gd2.php +++ b/lib/internal/Magento/Framework/Image/Adapter/Gd2.php @@ -411,6 +411,7 @@ public function resize($frameWidth = null, $frameHeight = null) * * @param int $angle * @return void + * @deprecated unused */ public function rotate($angle) { diff --git a/lib/internal/Magento/Framework/Image/Adapter/ImageMagick.php b/lib/internal/Magento/Framework/Image/Adapter/ImageMagick.php index cd49f283d33a7..418230675e356 100644 --- a/lib/internal/Magento/Framework/Image/Adapter/ImageMagick.php +++ b/lib/internal/Magento/Framework/Image/Adapter/ImageMagick.php @@ -195,6 +195,7 @@ public function resize($frameWidth = null, $frameHeight = null) * * @param int $angle * @return void + * @deprecated unused */ public function rotate($angle) { From 0dd7f9149ec349a264303daa0448a7cb92ce90aa Mon Sep 17 00:00:00 2001 From: "ivan.pletnyov" <ivan.pletnyov@transoftgroup.com> Date: Tue, 4 Feb 2020 16:52:43 +0200 Subject: [PATCH 1118/1143] MC-25170: Combination with different type prices --- ...CombinationWithDifferentTypePricesTest.php | 608 ++++++++++++++++++ .../_files/delete_catalog_rule_data.php | 6 + .../delete_catalog_rule_data_rollback.php | 26 + 3 files changed, 640 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Pricing/Render/CombinationWithDifferentTypePricesTest.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogRule/_files/delete_catalog_rule_data.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogRule/_files/delete_catalog_rule_data_rollback.php diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Pricing/Render/CombinationWithDifferentTypePricesTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Pricing/Render/CombinationWithDifferentTypePricesTest.php new file mode 100644 index 0000000000000..6baaf4940f94f --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Pricing/Render/CombinationWithDifferentTypePricesTest.php @@ -0,0 +1,608 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Pricing\Render; + +use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Catalog\Api\Data\ProductTierPriceExtensionFactory; +use Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\CatalogRule\Api\CatalogRuleRepositoryInterface; +use Magento\CatalogRule\Api\Data\RuleInterface; +use Magento\CatalogRule\Api\Data\RuleInterfaceFactory; +use Magento\CatalogRule\Model\Indexer\IndexBuilder; +use Magento\Customer\Model\Group; +use Magento\Customer\Model\Session; +use Magento\Framework\Registry; +use Magento\Framework\View\Result\Page; +use Magento\Store\Api\WebsiteRepositoryInterface; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\Helper\Xpath; +use Magento\TestFramework\ObjectManager; +use PHPUnit\Framework\TestCase; + +/** + * Assertions related to check product price rendering with combination of different price types. + * + * @magentoDbIsolation disabled + * @magentoAppArea frontend + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class CombinationWithDifferentTypePricesTest extends TestCase +{ + /** + * @var ObjectManager + */ + private $objectManager; + + /** + * @var Page + */ + private $page; + + /** + * @var Registry + */ + private $registry; + + /** + * @var IndexBuilder + */ + private $indexBuilder; + + /** + * @var Session + */ + private $customerSession; + + /** + * @var WebsiteRepositoryInterface + */ + private $websiteRepository; + + /** + * @var ProductRepositoryInterface + */ + private $productRepository; + + /** + * @var RuleInterfaceFactory + */ + private $catalogRuleFactory; + + /** + * @var CatalogRuleRepositoryInterface + */ + private $catalogRuleRepository; + + /** + * @var ProductTierPriceInterfaceFactory + */ + private $productTierPriceFactory; + + /** + * @var ProductTierPriceExtensionFactory + */ + private $productTierPriceExtensionFactory; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + $this->objectManager = Bootstrap::getObjectManager(); + $this->page = $this->objectManager->create(Page::class); + $this->registry = $this->objectManager->get(Registry::class); + $this->indexBuilder = $this->objectManager->get(IndexBuilder::class); + $this->customerSession = $this->objectManager->get(Session::class); + $this->websiteRepository = $this->objectManager->get(WebsiteRepositoryInterface::class); + $this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class); + $this->catalogRuleFactory = $this->objectManager->get(RuleInterfaceFactory::class); + $this->catalogRuleRepository = $this->objectManager->get(CatalogRuleRepositoryInterface::class); + $this->productTierPriceFactory = $this->objectManager->get(ProductTierPriceInterfaceFactory::class); + $this->productTierPriceExtensionFactory = $this->objectManager->get(ProductTierPriceExtensionFactory::class); + $this->productRepository->cleanCache(); + } + + /** + * @inheritdoc + */ + protected function tearDown() + { + parent::tearDown(); + $this->registry->unregister('product'); + } + + /** + * Assert that product price rendered with expected special and regular prices if + * product has special price which lower than regular and tier prices. + * + * @magentoDataFixture Magento/Catalog/_files/product_special_price.php + * + * @dataProvider tierPricesForAllCustomerGroupsDataProvider + * + * @param float $specialPrice + * @param float $regularPrice + * @param array $tierPrices + * @param array|null $tierMessageConfig + * @return void + */ + public function testRenderSpecialPriceInCombinationWithTierPrice( + float $specialPrice, + float $regularPrice, + array $tierPrices, + ?array $tierMessageConfig + ): void { + $this->assertRenderedPrices($specialPrice, $regularPrice, $tierPrices, $tierMessageConfig); + } + + /** + * Data provider with tier prices which are for all customers groups. + * + * @return array + */ + public function tierPricesForAllCustomerGroupsDataProvider(): array + { + return [ + 'fixed_tier_price_with_qty_1' => [ + 5.99, + 10, + [ + ['customer_group_id' => Group::CUST_GROUP_ALL, 'qty' => 1, 'value' => 9], + ], + null + ], + 'fixed_tier_price_with_qty_2' => [ + 5.99, + 10, + [ + ['customer_group_id' => Group::CUST_GROUP_ALL, 'qty' => 2, 'value' => 5], + ], + ['qty' => 2, 'price' => 5.00, 'percent' => 17], + ], + 'percent_tier_price_with_qty_2' => [ + 5.99, + 10, + [ + ['customer_group_id' => Group::CUST_GROUP_ALL, 'qty' => 2, 'percent_value' => 70], + ], + ['qty' => 2, 'price' => 3.00, 'percent' => 70], + ], + 'fixed_tier_price_with_qty_1_is_lower_than_special' => [ + 5, + 10, + [ + ['customer_group_id' => Group::CUST_GROUP_ALL, 'qty' => 1, 'value' => 5], + ], + null + ], + 'percent_tier_price_with_qty_1_is_lower_than_special' => [ + 3, + 10, + [ + ['customer_group_id' => Group::NOT_LOGGED_IN_ID, 'qty' => 1, 'percent_value' => 70], + ], + null + ], + ]; + } + + /** + * Assert that product price rendered with expected special and regular prices if + * product has special price which lower than regular and tier prices and customer is logged. + * + * @magentoDataFixture Magento/Catalog/_files/product_special_price.php + * @magentoDataFixture Magento/Customer/_files/customer.php + * + * @magentoAppIsolation enabled + * + * @dataProvider tierPricesForLoggedCustomerGroupDataProvider + * + * @param float $specialPrice + * @param float $regularPrice + * @param array $tierPrices + * @param array|null $tierMessageConfig + * @return void + */ + public function testRenderSpecialPriceInCombinationWithTierPriceForLoggedInUser( + float $specialPrice, + float $regularPrice, + array $tierPrices, + ?array $tierMessageConfig + ): void { + try { + $this->customerSession->setCustomerId(1); + $this->assertRenderedPrices($specialPrice, $regularPrice, $tierPrices, $tierMessageConfig); + } finally { + $this->customerSession->setCustomerId(null); + } + } + + /** + * Data provider with tier prices which are for logged customers group. + * + * @return array + */ + public function tierPricesForLoggedCustomerGroupDataProvider(): array + { + return [ + 'fixed_tier_price_with_qty_1' => [ + 5.99, + 10, + [ + ['customer_group_id' => 1, 'qty' => 1, 'value' => 9], + ], + null + ], + 'percent_tier_price_with_qty_1' => [ + 5.99, + 10, + [ + ['customer_group_id' => 1, 'qty' => 1, 'percent_value' => 30], + ], + null + ], + ]; + } + + /** + * Assert that product price rendered with expected special and regular prices if + * product has catalog rule price with different type of prices. + * + * @magentoDataFixture Magento/Catalog/_files/product_special_price.php + * @magentoDataFixture Magento/CatalogRule/_files/delete_catalog_rule_data.php + * + * @dataProvider catalogRulesDataProvider + * + * @param float $specialPrice + * @param float $regularPrice + * @param array $catalogRules + * @param array $tierPrices + * @param array|null $tierMessageConfig + * @return void + */ + public function testRenderCatalogRulePriceInCombinationWithDifferentPriceTypes( + float $specialPrice, + float $regularPrice, + array $catalogRules, + array $tierPrices, + ?array $tierMessageConfig + ): void { + $this->createCatalogRulesForProduct($catalogRules); + $this->indexBuilder->reindexFull(); + $this->assertRenderedPrices($specialPrice, $regularPrice, $tierPrices, $tierMessageConfig); + } + + /** + * Data provider with expect special and regular price, catalog rule data and tier price. + * + * @return array + */ + public function catalogRulesDataProvider(): array + { + return [ + 'fixed_catalog_rule_price_more_than_special_price' => [ + 5.99, + 10, + [ + [RuleInterface::DISCOUNT_AMOUNT => 2], + ], + [], + null + ], + 'fixed_catalog_rule_price_lower_than_special_price' => [ + 2, + 10, + [ + [RuleInterface::DISCOUNT_AMOUNT => 8], + ], + [], + null + ], + 'fixed_catalog_rule_price_more_than_tier_price' => [ + 4, + 10, + [ + [RuleInterface::DISCOUNT_AMOUNT => 6], + ], + [ + ['customer_group_id' => Group::CUST_GROUP_ALL, 'qty' => 2, 'percent_value' => 70], + ], + ['qty' => 2, 'price' => 3.00, 'percent' => 70], + ], + 'fixed_catalog_rule_price_lower_than_tier_price' => [ + 2, + 10, + [ + [RuleInterface::DISCOUNT_AMOUNT => 7], + ], + [ + ['customer_group_id' => Group::CUST_GROUP_ALL, 'qty' => 1, 'value' => 2], + ], + null + ], + 'adjust_percent_catalog_rule_price_lower_than_special_price' => [ + 4.50, + 10, + [ + [RuleInterface::DISCOUNT_AMOUNT => 45, RuleInterface::SIMPLE_ACTION => 'to_percent'], + ], + [], + null + ], + 'adjust_percent_catalog_rule_price_lower_than_tier_price' => [ + 3, + 10, + [ + [RuleInterface::DISCOUNT_AMOUNT => 30, RuleInterface::SIMPLE_ACTION => 'to_percent'], + ], + [ + ['customer_group_id' => Group::CUST_GROUP_ALL, 'qty' => 1, 'value' => 3.50], + ], + null + ], + 'percent_catalog_rule_price_lower_than_special_price' => [ + 2, + 10, + [ + [RuleInterface::DISCOUNT_AMOUNT => 2, RuleInterface::SIMPLE_ACTION => 'to_fixed'], + ], + [], + null + ], + 'percent_catalog_rule_price_lower_than_tier_price' => [ + 1, + 10, + [ + [RuleInterface::DISCOUNT_AMOUNT => 1, RuleInterface::SIMPLE_ACTION => 'to_fixed'], + ], + [ + ['customer_group_id' => Group::CUST_GROUP_ALL, 'qty' => 1, 'value' => 3], + ], + null + ], + ]; + } + + /** + * Check that price html contain all provided prices. + * + * @param string $priceHtml + * @param float $specialPrice + * @param float $regularPrice + * @return void + */ + private function checkPrices(string $priceHtml, float $specialPrice, float $regularPrice): void + { + $this->assertEquals( + 1, + Xpath::getElementsCountForXpath($this->getSpecialPriceXpath($specialPrice), $priceHtml), + "Special price {$specialPrice} is not as expected. Rendered html: {$priceHtml}" + ); + $this->assertEquals( + 1, + Xpath::getElementsCountForXpath($this->getRegularPriceLabelXpath(), $priceHtml), + "Regular price label 'Regular Price' not founded. Rendered html: {$priceHtml}" + ); + $this->assertEquals( + 1, + Xpath::getElementsCountForXpath($this->getRegularPriceXpath($regularPrice), $priceHtml), + "Regular price {$regularPrice} is not as expected. Rendered html: {$priceHtml}" + ); + } + + /** + * Assert that tier price message. + * + * @param string $priceHtml + * @param array $tierMessageConfig + * @return void + */ + private function checkTierPriceMessage(string $priceHtml, array $tierMessageConfig): void + { + $this->assertEquals( + 1, + Xpath::getElementsCountForXpath($this->getTierPriceMessageXpath($tierMessageConfig), $priceHtml), + "Tier price message not founded. Rendered html: {$priceHtml}" + ); + } + + /** + * Render price render template with product. + * + * @param ProductInterface $product + * @return string + */ + private function getPriceHtml(ProductInterface $product): string + { + $this->registerProduct($product); + $this->page->addHandle([ + 'default', + 'catalog_product_view', + ]); + $this->page->getLayout()->generateXml(); + $priceHtml = ''; + $availableChildNames = [ + 'product.info.price', + 'product.price.tier' + ]; + foreach ($this->page->getLayout()->getChildNames('product.info.main') as $childName) { + if (in_array($childName, $availableChildNames, true)) { + $priceHtml .= $this->page->getLayout()->renderElement($childName, false); + } + } + + return $priceHtml; + } + + /** + * Add product to the registry. + * + * @param ProductInterface $product + * @return void + */ + private function registerProduct(ProductInterface $product): void + { + $this->registry->unregister('product'); + $this->registry->register('product', $product); + } + + /** + * Create provided tier prices for product. + * + * @param ProductInterface $product + * @param array $tierPrices + * @return ProductInterface + */ + private function createTierPricesForProduct(ProductInterface $product, array $tierPrices): ProductInterface + { + if (empty($tierPrices)) { + return $product; + } + + $createdTierPrices = []; + foreach ($tierPrices as $tierPrice) { + $tierPriceExtensionAttribute = $this->productTierPriceExtensionFactory->create(); + $tierPriceExtensionAttribute->setWebsiteId(0); + + if (isset($tierPrice['percent_value'])) { + $tierPriceExtensionAttribute->setPercentageValue($tierPrice['percent_value']); + unset($tierPrice['percent_value']); + } + + $createdTierPrices[] = $this->productTierPriceFactory->create( + [ + 'data' => $tierPrice + ] + )->setExtensionAttributes($tierPriceExtensionAttribute); + } + $product->setTierPrices($createdTierPrices); + + return $this->productRepository->save($product); + } + + /** + * @param float $specialPrice + * @return string + */ + private function getSpecialPriceXpath(float $specialPrice): string + { + $pathsForSearch = [ + "//div[contains(@class, 'price-box') and contains(@class, 'price-final_price')]", + "//span[contains(@class, 'special-price')]", + sprintf("//span[contains(@class, 'price') and text()='$%01.2f']", $specialPrice), + ]; + + return implode('', $pathsForSearch); + } + + /** + * @param float $regularPrice + * @return string + */ + private function getRegularPriceXpath(float $regularPrice): string + { + $pathsForSearch = [ + "//div[contains(@class, 'price-box') and contains(@class, 'price-final_price')]", + "//span[contains(@class, 'old-price')]", + "//span[contains(@class, 'price-container')]", + sprintf("//span[contains(@class, 'price') and text()='$%01.2f']", $regularPrice), + ]; + + return implode('', $pathsForSearch); + } + + /** + * @return string + */ + private function getRegularPriceLabelXpath(): string + { + $pathsForSearch = [ + "//div[contains(@class, 'price-box') and contains(@class, 'price-final_price')]", + "//span[contains(@class, 'old-price')]", + "//span[contains(@class, 'price-container')]", + "//span[text()='Regular Price']", + ]; + + return implode('', $pathsForSearch); + } + + /** + * Return tier price message xpath. Message must contain expected quantity, + * price and discount percent. + * + * @param array $expectedMessage + * @return string + */ + private function getTierPriceMessageXpath(array $expectedMessage): string + { + [$qty, $price, $percent] = array_values($expectedMessage); + $liPaths = [ + "contains(@class, 'item') and contains(text(), 'Buy {$qty} for')", + sprintf("//span[contains(@class, 'price') and text()='$%01.2f']", $price), + "//span[contains(@class, 'percent') and contains(text(), '{$percent}')]", + ]; + + return sprintf( + "//ul[contains(@class, 'prices-tier') and contains(@class, 'items')]//li[%s]", + implode(' and ', $liPaths) + ); + } + + /** + * Process test with combination of special and tier price. + * + * @param float $specialPrice + * @param float $regularPrice + * @param array $tierPrices + * @param array|null $tierMessageConfig + * @return void + */ + private function assertRenderedPrices( + float $specialPrice, + float $regularPrice, + array $tierPrices, + ?array $tierMessageConfig + ): void { + $product = $this->productRepository->get('simple', false, null, true); + $product = $this->createTierPricesForProduct($product, $tierPrices); + $priceHtml = $this->getPriceHtml($product); + $this->checkPrices($priceHtml, $specialPrice, $regularPrice); + if (null !== $tierMessageConfig) { + $this->checkTierPriceMessage($priceHtml, $tierMessageConfig); + } + } + + /** + * Create provided catalog rules. + * + * @param array $catalogRules + * @return void + */ + private function createCatalogRulesForProduct(array $catalogRules): void + { + $baseWebsite = $this->websiteRepository->get('base'); + $staticRuleData = [ + RuleInterface::IS_ACTIVE => 1, + RuleInterface::NAME => 'Test rule name.', + 'customer_group_ids' => Group::NOT_LOGGED_IN_ID, + RuleInterface::SIMPLE_ACTION => 'by_fixed', + RuleInterface::STOP_RULES_PROCESSING => false, + RuleInterface::SORT_ORDER => 0, + 'sub_is_enable' => 0, + 'sub_discount_amount' => 0, + 'website_ids' => [$baseWebsite->getId()] + ]; + + foreach ($catalogRules as $catalogRule) { + $catalogRule = array_replace($staticRuleData, $catalogRule); + $catalogRule = $this->catalogRuleFactory->create(['data' => $catalogRule]); + $this->catalogRuleRepository->save($catalogRule); + } + } +} diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/delete_catalog_rule_data.php b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/delete_catalog_rule_data.php new file mode 100644 index 0000000000000..37121092d0ba0 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/delete_catalog_rule_data.php @@ -0,0 +1,6 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/delete_catalog_rule_data_rollback.php b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/delete_catalog_rule_data_rollback.php new file mode 100644 index 0000000000000..77f0d1d3781f0 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/delete_catalog_rule_data_rollback.php @@ -0,0 +1,26 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\CatalogRule\Api\CatalogRuleRepositoryInterface; +use Magento\CatalogRule\Api\Data\RuleInterface; +use Magento\CatalogRule\Model\ResourceModel\Rule\CollectionFactory; +use Magento\CatalogRule\Model\ResourceModel\Rule\Product\Price; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var CollectionFactory $catalogRuleCollectionFactory */ +$catalogRuleCollectionFactory = $objectManager->get(CollectionFactory::class); +/** @var CatalogRuleRepositoryInterface $catalogRuleRepository */ +$catalogRuleRepository = $objectManager->get(CatalogRuleRepositoryInterface::class); +/** @var Price $catalogRuleProductPriceResource */ +$catalogRuleProductPriceResource = $objectManager->get(Price::class); +$catalogRuleCollection = $catalogRuleCollectionFactory->create(); +/** @var RuleInterface $catalogRule */ +foreach ($catalogRuleCollection->getItems() as $catalogRule) { + $catalogRuleRepository->delete($catalogRule); +} +$catalogRuleProductPriceResource->getConnection()->delete($catalogRuleProductPriceResource->getMainTable()); From c482b31fcda339432b17a122c31f48d4bd1d4107 Mon Sep 17 00:00:00 2001 From: "ivan.pletnyov" <ivan.pletnyov@transoftgroup.com> Date: Tue, 4 Feb 2020 17:02:14 +0200 Subject: [PATCH 1119/1143] MC-31028: Storefront: Custom options on configurable product page --- .../View/Options/DateGroupDataProvider.php | 25 +- .../View/Options/FileGroupDataProvider.php | 13 +- .../View/Options/SelectGroupDataProvider.php | 33 +- .../View/Options/TextGroupDataProvider.php | 21 +- .../CustomOptions/DateGroupDataProvider.php | 31 ++ .../CustomOptions/FileGroupDataProvider.php | 27 ++ .../CustomOptions/SelectGroupDataProvider.php | 32 ++ .../CustomOptions/TextGroupDataProvider.php | 30 ++ .../AbstractRenderCustomOptionsTest.php | 340 ++++++++++++++++++ .../View/Options/RenderOptionsTest.php | 231 +----------- .../View/CustomOptions/RenderOptionsTest.php | 96 +++++ 11 files changed, 618 insertions(+), 261 deletions(-) create mode 100644 dev/tests/integration/framework/Magento/TestFramework/ConfigurableProduct/Block/CustomOptions/DateGroupDataProvider.php create mode 100644 dev/tests/integration/framework/Magento/TestFramework/ConfigurableProduct/Block/CustomOptions/FileGroupDataProvider.php create mode 100644 dev/tests/integration/framework/Magento/TestFramework/ConfigurableProduct/Block/CustomOptions/SelectGroupDataProvider.php create mode 100644 dev/tests/integration/framework/Magento/TestFramework/ConfigurableProduct/Block/CustomOptions/TextGroupDataProvider.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Options/AbstractRenderCustomOptionsTest.php create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/CustomOptions/RenderOptionsTest.php diff --git a/dev/tests/integration/framework/Magento/TestFramework/Catalog/Block/Product/View/Options/DateGroupDataProvider.php b/dev/tests/integration/framework/Magento/TestFramework/Catalog/Block/Product/View/Options/DateGroupDataProvider.php index 7f9d5362c4f83..7e83b3f349d4d 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Catalog/Block/Product/View/Options/DateGroupDataProvider.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Catalog/Block/Product/View/Options/DateGroupDataProvider.php @@ -8,6 +8,7 @@ namespace Magento\TestFramework\Catalog\Block\Product\View\Options; use Magento\Catalog\Api\Data\ProductCustomOptionInterface; +use Magento\Catalog\Model\Config\Source\ProductPriceOptionsInterface; use Magento\Catalog\Model\Product\Option; /** @@ -31,7 +32,7 @@ public function getData(): array Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_DATE, Option::KEY_IS_REQUIRE => 1, Option::KEY_PRICE => 10, - Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Option::KEY_SKU => 'test-option-date-title-1', ], [ @@ -46,7 +47,7 @@ public function getData(): array Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_DATE, Option::KEY_IS_REQUIRE => 0, Option::KEY_PRICE => 10, - Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Option::KEY_SKU => 'test-option-date-title-2', ], [ @@ -61,7 +62,7 @@ public function getData(): array Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_DATE, Option::KEY_IS_REQUIRE => 0, Option::KEY_PRICE => 50, - Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Option::KEY_SKU => 'test-option-date-title-3', ], [ @@ -76,7 +77,7 @@ public function getData(): array Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_DATE, Option::KEY_IS_REQUIRE => 0, Option::KEY_PRICE => 50, - Option::KEY_PRICE_TYPE => 'percent', + Option::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_PERCENT, Option::KEY_SKU => 'test-option-date-title-4', ], [ @@ -91,7 +92,7 @@ public function getData(): array Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_DATE_TIME, Option::KEY_IS_REQUIRE => 1, Option::KEY_PRICE => 10, - Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Option::KEY_SKU => 'test-option-date-and-time-title-1', ], [ @@ -106,7 +107,7 @@ public function getData(): array Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_DATE_TIME, Option::KEY_IS_REQUIRE => 0, Option::KEY_PRICE => 10, - Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Option::KEY_SKU => 'test-option-date-and-time-title-2', ], [ @@ -121,7 +122,7 @@ public function getData(): array Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_DATE_TIME, Option::KEY_IS_REQUIRE => 0, Option::KEY_PRICE => 50, - Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Option::KEY_SKU => 'test-option-date-and-time-title-3', ], [ @@ -136,7 +137,7 @@ public function getData(): array Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_DATE_TIME, Option::KEY_IS_REQUIRE => 0, Option::KEY_PRICE => 50, - Option::KEY_PRICE_TYPE => 'percent', + Option::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_PERCENT, Option::KEY_SKU => 'test-option-date-and-time-title-4', ], [ @@ -151,7 +152,7 @@ public function getData(): array Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_TIME, Option::KEY_IS_REQUIRE => 1, Option::KEY_PRICE => 10, - Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Option::KEY_SKU => 'test-option-time-title-1', ], [ @@ -166,7 +167,7 @@ public function getData(): array Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_TIME, Option::KEY_IS_REQUIRE => 0, Option::KEY_PRICE => 10, - Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Option::KEY_SKU => 'test-option-time-title-2', ], [ @@ -181,7 +182,7 @@ public function getData(): array Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_TIME, Option::KEY_IS_REQUIRE => 0, Option::KEY_PRICE => 50, - Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Option::KEY_SKU => 'test-option-time-title-3', ], [ @@ -196,7 +197,7 @@ public function getData(): array Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_TIME, Option::KEY_IS_REQUIRE => 0, Option::KEY_PRICE => 50, - Option::KEY_PRICE_TYPE => 'percent', + Option::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_PERCENT, Option::KEY_SKU => 'test-option-time-title-4', ], [ diff --git a/dev/tests/integration/framework/Magento/TestFramework/Catalog/Block/Product/View/Options/FileGroupDataProvider.php b/dev/tests/integration/framework/Magento/TestFramework/Catalog/Block/Product/View/Options/FileGroupDataProvider.php index c28cb770a806e..1817509539eec 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Catalog/Block/Product/View/Options/FileGroupDataProvider.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Catalog/Block/Product/View/Options/FileGroupDataProvider.php @@ -8,6 +8,7 @@ namespace Magento\TestFramework\Catalog\Block\Product\View\Options; use Magento\Catalog\Api\Data\ProductCustomOptionInterface; +use Magento\Catalog\Model\Config\Source\ProductPriceOptionsInterface; use Magento\Catalog\Model\Product\Option; /** @@ -31,7 +32,7 @@ public function getData(): array Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_FILE, Option::KEY_IS_REQUIRE => 1, Option::KEY_PRICE => 10, - Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Option::KEY_SKU => 'test-option-file-title-1', Option::KEY_SORT_ORDER => 1, Option::KEY_FILE_EXTENSION => 'png, jpg', @@ -51,7 +52,7 @@ public function getData(): array Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_FILE, Option::KEY_IS_REQUIRE => 0, Option::KEY_PRICE => 10, - Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Option::KEY_SKU => 'test-option-file-title-2', Option::KEY_SORT_ORDER => 1, Option::KEY_FILE_EXTENSION => 'png, jpg', @@ -71,7 +72,7 @@ public function getData(): array Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_FILE, Option::KEY_IS_REQUIRE => 0, Option::KEY_PRICE => 50, - Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Option::KEY_SKU => 'test-option-file-title-3', Option::KEY_SORT_ORDER => 1, Option::KEY_FILE_EXTENSION => 'png, jpg', @@ -91,7 +92,7 @@ public function getData(): array Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_FILE, Option::KEY_IS_REQUIRE => 0, Option::KEY_PRICE => 50, - Option::KEY_PRICE_TYPE => 'percent', + Option::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_PERCENT, Option::KEY_SKU => 'test-option-file-title-4', Option::KEY_SORT_ORDER => 1, Option::KEY_FILE_EXTENSION => 'png, jpg', @@ -111,7 +112,7 @@ public function getData(): array Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_FILE, Option::KEY_IS_REQUIRE => 0, Option::KEY_PRICE => 50, - Option::KEY_PRICE_TYPE => 'percent', + Option::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Option::KEY_SKU => 'test-option-file-title-5', Option::KEY_SORT_ORDER => 1, Option::KEY_FILE_EXTENSION => 'png, jpg', @@ -122,7 +123,7 @@ public function getData(): array 'block_with_required_class' => '<div class="field file">', 'label_for_created_option' => '<label class="label" for="options_%s_file"', 'title' => '<span>Test option file title 5</span>', - 'price' => 'data-price-amount="5"', + 'price' => 'data-price-amount="50"', 'required_element' => '/<input type="file"/', 'file_extension' => '<strong>png, jpg</strong>', 'file_width' => '/%s:.*<strong>10 px.<\/strong>/', diff --git a/dev/tests/integration/framework/Magento/TestFramework/Catalog/Block/Product/View/Options/SelectGroupDataProvider.php b/dev/tests/integration/framework/Magento/TestFramework/Catalog/Block/Product/View/Options/SelectGroupDataProvider.php index 2a13c1cd45466..ad9ffb40f5762 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Catalog/Block/Product/View/Options/SelectGroupDataProvider.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Catalog/Block/Product/View/Options/SelectGroupDataProvider.php @@ -8,6 +8,7 @@ namespace Magento\TestFramework\Catalog\Block\Product\View\Options; use Magento\Catalog\Api\Data\ProductCustomOptionInterface; +use Magento\Catalog\Model\Config\Source\ProductPriceOptionsInterface; use Magento\Catalog\Model\Product\Option; use Magento\Catalog\Model\Product\Option\Value; @@ -35,7 +36,7 @@ public function getData(): array [ Value::KEY_TITLE => 'Test option drop-down title 1 value 1', Value::KEY_PRICE => 10, - Value::KEY_PRICE_TYPE => 'fixed', + Value::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Value::KEY_SKU => 'test-option-drop-down-title-1-value-1', ], [ @@ -58,7 +59,7 @@ public function getData(): array [ Value::KEY_TITLE => 'Test option drop-down title 2 value 1', Value::KEY_PRICE => 10, - Value::KEY_PRICE_TYPE => 'fixed', + Value::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Value::KEY_SKU => 'test-option-drop-down-title-2-value-1', ], [ @@ -81,7 +82,7 @@ public function getData(): array [ Value::KEY_TITLE => 'Test option drop-down title 3 value 1', Value::KEY_PRICE => 50, - Value::KEY_PRICE_TYPE => 'fixed', + Value::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Value::KEY_SKU => 'test-option-drop-down-title-3-value-1', ], [ @@ -104,7 +105,7 @@ public function getData(): array [ Value::KEY_TITLE => 'Test option drop-down title 4 value 1', Value::KEY_PRICE => 50, - Value::KEY_PRICE_TYPE => 'percent', + Value::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_PERCENT, Value::KEY_SKU => 'test-option-drop-down-title-4-value-1', ], [ @@ -127,7 +128,7 @@ public function getData(): array [ Value::KEY_TITLE => 'Test option radio-button title 1 value 1', Value::KEY_PRICE => 10, - Value::KEY_PRICE_TYPE => 'fixed', + Value::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Value::KEY_SKU => 'test-option-radio-button-title-1-value-1', ], [ @@ -147,7 +148,7 @@ public function getData(): array [ Value::KEY_TITLE => 'Test option radio-button title 2 value 1', Value::KEY_PRICE => 10, - Value::KEY_PRICE_TYPE => 'fixed', + Value::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Value::KEY_SKU => 'test-option-radio-button-title-2-value-1', ], [ @@ -167,7 +168,7 @@ public function getData(): array [ Value::KEY_TITLE => 'Test option radio-button title 3 value 1', Value::KEY_PRICE => 50, - Value::KEY_PRICE_TYPE => 'fixed', + Value::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Value::KEY_SKU => 'test-option-radio-button-title-3-value-1', ], [ @@ -187,7 +188,7 @@ public function getData(): array [ Value::KEY_TITLE => 'Test option radio-button title 4 value 1', Value::KEY_PRICE => 50, - Value::KEY_PRICE_TYPE => 'percent', + Value::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_PERCENT, Value::KEY_SKU => 'test-option-radio-button-title-4-value-1', ], [ @@ -207,7 +208,7 @@ public function getData(): array [ Value::KEY_TITLE => 'Test option checkbox title 1 value 1', Value::KEY_PRICE => 10, - Value::KEY_PRICE_TYPE => 'fixed', + Value::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Value::KEY_SKU => 'test-option-checkbox-title-1-value-1', ], [ @@ -227,7 +228,7 @@ public function getData(): array [ Value::KEY_TITLE => 'Test option checkbox title 2 value 1', Value::KEY_PRICE => 10, - Value::KEY_PRICE_TYPE => 'fixed', + Value::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Value::KEY_SKU => 'test-option-checkbox-title-2-value-1', ], [ @@ -247,7 +248,7 @@ public function getData(): array [ Value::KEY_TITLE => 'Test option checkbox title 3 value 1', Value::KEY_PRICE => 50, - Value::KEY_PRICE_TYPE => 'fixed', + Value::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Value::KEY_SKU => 'test-option-checkbox-title-3-value-1', ], [ @@ -267,7 +268,7 @@ public function getData(): array [ Value::KEY_TITLE => 'Test option checkbox title 4 value 1', Value::KEY_PRICE => 50, - Value::KEY_PRICE_TYPE => 'percent', + Value::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_PERCENT, Value::KEY_SKU => 'test-option-checkbox-title-4-value-1', ], [ @@ -287,7 +288,7 @@ public function getData(): array [ Value::KEY_TITLE => 'Test option multiselect title 1 value 1', Value::KEY_PRICE => 10, - Value::KEY_PRICE_TYPE => 'fixed', + Value::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Value::KEY_SKU => 'test-option-multiselect-title-1-value-1', ], [ @@ -307,7 +308,7 @@ public function getData(): array [ Value::KEY_TITLE => 'Test option multiselect title 2 value 1', Value::KEY_PRICE => 10, - Value::KEY_PRICE_TYPE => 'fixed', + Value::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Value::KEY_SKU => 'test-option-multiselect-title-2-value-1', ], [ @@ -327,7 +328,7 @@ public function getData(): array [ Value::KEY_TITLE => 'Test option multiselect title 3 value 1', Value::KEY_PRICE => 50, - Value::KEY_PRICE_TYPE => 'fixed', + Value::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Value::KEY_SKU => 'test-option-multiselect-title-3-value-1', ], [ @@ -347,7 +348,7 @@ public function getData(): array [ Value::KEY_TITLE => 'Test option multiselect title 4 value 1', Value::KEY_PRICE => 50, - Value::KEY_PRICE_TYPE => 'percent', + Value::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_PERCENT, Value::KEY_SKU => 'test-option-multiselect-title-4-value-1', ], [ diff --git a/dev/tests/integration/framework/Magento/TestFramework/Catalog/Block/Product/View/Options/TextGroupDataProvider.php b/dev/tests/integration/framework/Magento/TestFramework/Catalog/Block/Product/View/Options/TextGroupDataProvider.php index 75a6da0593d73..b0d22a222dd85 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Catalog/Block/Product/View/Options/TextGroupDataProvider.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Catalog/Block/Product/View/Options/TextGroupDataProvider.php @@ -8,6 +8,7 @@ namespace Magento\TestFramework\Catalog\Block\Product\View\Options; use Magento\Catalog\Api\Data\ProductCustomOptionInterface; +use Magento\Catalog\Model\Config\Source\ProductPriceOptionsInterface; use Magento\Catalog\Model\Product\Option; /** @@ -31,7 +32,7 @@ public function getData(): array Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_FIELD, Option::KEY_IS_REQUIRE => 1, Option::KEY_PRICE => 10, - Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Option::KEY_SKU => 'test-option-field-title-1', Option::KEY_MAX_CHARACTERS => 0, ], @@ -49,7 +50,7 @@ public function getData(): array Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_FIELD, Option::KEY_IS_REQUIRE => 0, Option::KEY_PRICE => 10, - Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Option::KEY_SKU => 'test-option-field-title-2', Option::KEY_MAX_CHARACTERS => 0, ], @@ -67,7 +68,7 @@ public function getData(): array Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_FIELD, Option::KEY_IS_REQUIRE => 0, Option::KEY_PRICE => 50, - Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Option::KEY_SKU => 'test-option-field-title-3', Option::KEY_MAX_CHARACTERS => 0, ], @@ -85,7 +86,7 @@ public function getData(): array Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_FIELD, Option::KEY_IS_REQUIRE => 0, Option::KEY_PRICE => 50, - Option::KEY_PRICE_TYPE => 'percent', + Option::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_PERCENT, Option::KEY_SKU => 'test-option-field-title-4', Option::KEY_MAX_CHARACTERS => 0, ], @@ -103,7 +104,7 @@ public function getData(): array Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_FIELD, Option::KEY_IS_REQUIRE => 0, Option::KEY_PRICE => 10, - Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Option::KEY_SKU => 'test-option-field-title-5', Option::KEY_MAX_CHARACTERS => 99, ], @@ -122,7 +123,7 @@ public function getData(): array Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_AREA, Option::KEY_IS_REQUIRE => 1, Option::KEY_PRICE => 10, - Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Option::KEY_SKU => 'test-option-area-title-1', Option::KEY_MAX_CHARACTERS => 0, ], @@ -140,7 +141,7 @@ public function getData(): array Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_AREA, Option::KEY_IS_REQUIRE => 0, Option::KEY_PRICE => 10, - Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Option::KEY_SKU => 'test-option-area-title-2', Option::KEY_MAX_CHARACTERS => 0, ], @@ -158,7 +159,7 @@ public function getData(): array Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_AREA, Option::KEY_IS_REQUIRE => 0, Option::KEY_PRICE => 50, - Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Option::KEY_SKU => 'test-option-area-title-3', Option::KEY_MAX_CHARACTERS => 0, ], @@ -176,7 +177,7 @@ public function getData(): array Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_AREA, Option::KEY_IS_REQUIRE => 0, Option::KEY_PRICE => 50, - Option::KEY_PRICE_TYPE => 'percent', + Option::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_PERCENT, Option::KEY_SKU => 'test-option-area-title-4', Option::KEY_MAX_CHARACTERS => 0, ], @@ -194,7 +195,7 @@ public function getData(): array Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_AREA, Option::KEY_IS_REQUIRE => 0, Option::KEY_PRICE => 10, - Option::KEY_PRICE_TYPE => 'fixed', + Option::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED, Option::KEY_SKU => 'test-option-area-title-5', Option::KEY_MAX_CHARACTERS => 99, ], diff --git a/dev/tests/integration/framework/Magento/TestFramework/ConfigurableProduct/Block/CustomOptions/DateGroupDataProvider.php b/dev/tests/integration/framework/Magento/TestFramework/ConfigurableProduct/Block/CustomOptions/DateGroupDataProvider.php new file mode 100644 index 0000000000000..a03d3912dbd06 --- /dev/null +++ b/dev/tests/integration/framework/Magento/TestFramework/ConfigurableProduct/Block/CustomOptions/DateGroupDataProvider.php @@ -0,0 +1,31 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\TestFramework\ConfigurableProduct\Block\CustomOptions; + +use Magento\TestFramework\Catalog\Block\Product\View\Options\DateGroupDataProvider as OptionsDateGroupDataProvider; + +/** + * @inheritdoc + */ +class DateGroupDataProvider extends OptionsDateGroupDataProvider +{ + /** + * @inheritdoc + */ + public function getData(): array + { + $optionsData = parent::getData(); + unset( + $optionsData['type_date_percent_price'], + $optionsData['type_date_and_time_percent_price'], + $optionsData['type_time_percent_price'] + ); + + return $optionsData; + } +} diff --git a/dev/tests/integration/framework/Magento/TestFramework/ConfigurableProduct/Block/CustomOptions/FileGroupDataProvider.php b/dev/tests/integration/framework/Magento/TestFramework/ConfigurableProduct/Block/CustomOptions/FileGroupDataProvider.php new file mode 100644 index 0000000000000..e0a22341a7ca0 --- /dev/null +++ b/dev/tests/integration/framework/Magento/TestFramework/ConfigurableProduct/Block/CustomOptions/FileGroupDataProvider.php @@ -0,0 +1,27 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\TestFramework\ConfigurableProduct\Block\CustomOptions; + +use Magento\TestFramework\Catalog\Block\Product\View\Options\FileGroupDataProvider as OptionsFileGroupDataProvider; + +/** + * @inheritdoc + */ +class FileGroupDataProvider extends OptionsFileGroupDataProvider +{ + /** + * @inheritdoc + */ + public function getData(): array + { + $optionsData = parent::getData(); + unset($optionsData['type_file_percent_price']); + + return $optionsData; + } +} diff --git a/dev/tests/integration/framework/Magento/TestFramework/ConfigurableProduct/Block/CustomOptions/SelectGroupDataProvider.php b/dev/tests/integration/framework/Magento/TestFramework/ConfigurableProduct/Block/CustomOptions/SelectGroupDataProvider.php new file mode 100644 index 0000000000000..89a94f423d052 --- /dev/null +++ b/dev/tests/integration/framework/Magento/TestFramework/ConfigurableProduct/Block/CustomOptions/SelectGroupDataProvider.php @@ -0,0 +1,32 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\TestFramework\ConfigurableProduct\Block\CustomOptions; + +use Magento\TestFramework\Catalog\Block\Product\View\Options\SelectGroupDataProvider as OptionsSelectGroupDataProvider; + +/** + * @inheritdoc + */ +class SelectGroupDataProvider extends OptionsSelectGroupDataProvider +{ + /** + * @inheritdoc + */ + public function getData(): array + { + $optionsData = parent::getData(); + unset( + $optionsData['type_drop_down_value_percent_price'], + $optionsData['type_radio_button_value_percent_price'], + $optionsData['type_checkbox_value_percent_price'], + $optionsData['type_multiselect_value_percent_price'] + ); + + return $optionsData; + } +} diff --git a/dev/tests/integration/framework/Magento/TestFramework/ConfigurableProduct/Block/CustomOptions/TextGroupDataProvider.php b/dev/tests/integration/framework/Magento/TestFramework/ConfigurableProduct/Block/CustomOptions/TextGroupDataProvider.php new file mode 100644 index 0000000000000..cf442a978b09a --- /dev/null +++ b/dev/tests/integration/framework/Magento/TestFramework/ConfigurableProduct/Block/CustomOptions/TextGroupDataProvider.php @@ -0,0 +1,30 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\TestFramework\ConfigurableProduct\Block\CustomOptions; + +use Magento\TestFramework\Catalog\Block\Product\View\Options\TextGroupDataProvider as OptionsTextGroupDataProvider; + +/** + * @inheritdoc + */ +class TextGroupDataProvider extends OptionsTextGroupDataProvider +{ + /** + * @inheritdoc + */ + public function getData(): array + { + $optionsData = parent::getData(); + unset( + $optionsData['type_field_percent_price'], + $optionsData['type_area_percent_price'] + ); + + return $optionsData; + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Options/AbstractRenderCustomOptionsTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Options/AbstractRenderCustomOptionsTest.php new file mode 100644 index 0000000000000..659cf83407a9e --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Options/AbstractRenderCustomOptionsTest.php @@ -0,0 +1,340 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Block\Product\View\Options; + +use Magento\Catalog\Api\Data\ProductCustomOptionInterface; +use Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory; +use Magento\Catalog\Api\Data\ProductCustomOptionValuesInterfaceFactory; +use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Block\Product\View\Options; +use Magento\Catalog\Model\Product\Option; +use Magento\Catalog\Model\Product\Option\Value; +use Magento\Framework\View\Element\Template; +use Magento\Framework\View\Result\Page; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\ObjectManager; +use PHPUnit\Framework\TestCase; + +/** + * Base logic for render custom options and check that option renders as expected. + */ +abstract class AbstractRenderCustomOptionsTest extends TestCase +{ + /** + * @var ObjectManager + */ + private $objectManager; + + /** + * @var ProductRepositoryInterface + */ + private $productRepository; + + /** + * @var ProductCustomOptionInterfaceFactory + */ + private $productCustomOptionFactory; + + /** + * @var ProductCustomOptionValuesInterfaceFactory + */ + private $productCustomOptionValuesFactory; + + /** + * @var Page + */ + private $page; + + /** + * @inheritdoc + */ + protected function setUp() + { + $this->objectManager = Bootstrap::getObjectManager(); + $this->productRepository = $this->objectManager->create(ProductRepositoryInterface::class); + $this->productCustomOptionFactory = $this->objectManager->get(ProductCustomOptionInterfaceFactory::class); + $this->productCustomOptionValuesFactory = $this->objectManager->get( + ProductCustomOptionValuesInterfaceFactory::class + ); + $this->page = $this->objectManager->create(Page::class); + parent::setUp(); + } + + /** + * @inheritdoc + */ + protected function tearDown() + { + $this->productRepository->cleanCache(); + parent::tearDown(); + } + + /** + * Add provided options from text group to product, render options block + * and check that options rendered as expected. + * + * @param string $productSku + * @param array $optionData + * @param array $checkArray + * @return void + */ + protected function assertTextOptionRenderingOnProduct( + string $productSku, + array $optionData, + array $checkArray + ): void { + $product = $this->productRepository->get($productSku); + $product = $this->addOptionToProduct($product, $optionData); + $option = $this->findOptionByTitle($product, $optionData[Option::KEY_TITLE]); + $optionHtml = $this->getOptionHtml($product); + $this->baseOptionAsserts($option, $optionHtml, $checkArray); + + if ($optionData[Option::KEY_MAX_CHARACTERS] > 0) { + $this->assertContains($checkArray['max_characters'], $optionHtml); + } else { + $this->assertNotContains('class="character-counter', $optionHtml); + } + } + + /** + * Add provided options from file group to product, render options block + * and check that options rendered as expected. + * + * @param string $productSku + * @param array $optionData + * @param array $checkArray + * @return void + */ + protected function assertFileOptionRenderingOnProduct( + string $productSku, + array $optionData, + array $checkArray + ): void { + $product = $this->productRepository->get($productSku); + $product = $this->addOptionToProduct($product, $optionData); + $option = $this->findOptionByTitle($product, $optionData[Option::KEY_TITLE]); + $optionHtml = $this->getOptionHtml($product); + $this->baseOptionAsserts($option, $optionHtml, $checkArray); + $this->assertContains($checkArray['file_extension'], $optionHtml); + + if (isset($checkArray['file_width'])) { + $checkArray['file_width'] = sprintf($checkArray['file_width'], __('Maximum image width')); + $this->assertRegExp($checkArray['file_width'], $optionHtml); + } + + if (isset($checkArray['file_height'])) { + $checkArray['file_height'] = sprintf($checkArray['file_height'], __('Maximum image height')); + $this->assertRegExp($checkArray['file_height'], $optionHtml); + } + } + + /** + * Add provided options from select group to product, render options block + * and check that options rendered as expected. + * + * @param string $productSku + * @param array $optionData + * @param array $optionValueData + * @param array $checkArray + * @return void + */ + protected function assertSelectOptionRenderingOnProduct( + string $productSku, + array $optionData, + array $optionValueData, + array $checkArray + ): void { + $product = $this->productRepository->get($productSku); + $product = $this->addOptionToProduct($product, $optionData, $optionValueData); + $option = $this->findOptionByTitle($product, $optionData[Option::KEY_TITLE]); + $optionValues = $option->getValues(); + $optionValue = reset($optionValues); + $optionHtml = $this->getOptionHtml($product); + $this->baseOptionAsserts($option, $optionHtml, $checkArray); + + if (isset($checkArray['not_contain_arr'])) { + foreach ($checkArray['not_contain_arr'] as $notContainPattern) { + $this->assertNotRegExp($notContainPattern, $optionHtml); + } + } + + if (isset($checkArray['option_value_item'])) { + $checkArray['option_value_item'] = sprintf( + $checkArray['option_value_item'], + $optionValue->getOptionTypeId(), + $optionValueData[Value::KEY_TITLE] + ); + $this->assertRegExp($checkArray['option_value_item'], $optionHtml); + } + } + + /** + * Add provided options from date group to product, render options block + * and check that options rendered as expected. + * + * @param string $productSku + * @param array $optionData + * @param array $checkArray + * @return void + */ + protected function assertDateOptionRenderingOnProduct( + string $productSku, + array $optionData, + array $checkArray + ): void { + $product = $this->productRepository->get($productSku); + $product = $this->addOptionToProduct($product, $optionData); + $option = $this->findOptionByTitle($product, $optionData[Option::KEY_TITLE]); + $optionHtml = $this->getOptionHtml($product); + $this->baseOptionAsserts($option, $optionHtml, $checkArray); + + switch ($optionData[Option::KEY_TYPE]) { + case ProductCustomOptionInterface::OPTION_TYPE_DATE: + $this->assertContains("<select name=\"options[{$option->getOptionId()}][month]\"", $optionHtml); + $this->assertContains("<select name=\"options[{$option->getOptionId()}][day]\"", $optionHtml); + $this->assertContains("<select name=\"options[{$option->getOptionId()}][year]\"", $optionHtml); + $this->assertNotContains("<select name=\"options[{$option->getOptionId()}][hour]\"", $optionHtml); + $this->assertNotContains("<select name=\"options[{$option->getOptionId()}][minute]\"", $optionHtml); + $this->assertNotContains("<select name=\"options[{$option->getOptionId()}][day_part]\"", $optionHtml); + break; + case ProductCustomOptionInterface::OPTION_TYPE_DATE_TIME: + $this->assertContains("<select name=\"options[{$option->getOptionId()}][month]\"", $optionHtml); + $this->assertContains("<select name=\"options[{$option->getOptionId()}][day]\"", $optionHtml); + $this->assertContains("<select name=\"options[{$option->getOptionId()}][year]\"", $optionHtml); + $this->assertContains("<select name=\"options[{$option->getOptionId()}][hour]\"", $optionHtml); + $this->assertContains("<select name=\"options[{$option->getOptionId()}][minute]\"", $optionHtml); + $this->assertContains("<select name=\"options[{$option->getOptionId()}][day_part]\"", $optionHtml); + break; + case ProductCustomOptionInterface::OPTION_TYPE_TIME: + $this->assertNotContains("<select name=\"options[{$option->getOptionId()}][month]\"", $optionHtml); + $this->assertNotContains("<select name=\"options[{$option->getOptionId()}][day]\"", $optionHtml); + $this->assertNotContains("<select name=\"options[{$option->getOptionId()}][year]\"", $optionHtml); + $this->assertContains("<select name=\"options[{$option->getOptionId()}][hour]\"", $optionHtml); + $this->assertContains("<select name=\"options[{$option->getOptionId()}][minute]\"", $optionHtml); + $this->assertContains("<select name=\"options[{$option->getOptionId()}][day_part]\"", $optionHtml); + break; + } + } + + /** + * Base asserts for rendered options. + * + * @param ProductCustomOptionInterface $option + * @param string $optionHtml + * @param array $checkArray + * @return void + */ + private function baseOptionAsserts( + ProductCustomOptionInterface $option, + string $optionHtml, + array $checkArray + ): void { + $this->assertContains($checkArray['block_with_required_class'], $optionHtml); + $this->assertContains($checkArray['title'], $optionHtml); + + if (isset($checkArray['label_for_created_option'])) { + $checkArray['label_for_created_option'] = sprintf( + $checkArray['label_for_created_option'], + $option->getOptionId() + ); + $this->assertContains($checkArray['label_for_created_option'], $optionHtml); + } + + if (isset($checkArray['price'])) { + $this->assertContains($checkArray['price'], $optionHtml); + } + + if (isset($checkArray['required_element'])) { + $this->assertRegExp($checkArray['required_element'], $optionHtml); + } + } + + /** + * Add custom option to product with data. + * + * @param ProductInterface $product + * @param array $optionData + * @param array $optionValueData + * @return ProductInterface + */ + private function addOptionToProduct( + ProductInterface $product, + array $optionData, + array $optionValueData = [] + ): ProductInterface { + $optionData[Option::KEY_PRODUCT_SKU] = $product->getSku(); + + if (!empty($optionValueData)) { + $optionValueData = $this->productCustomOptionValuesFactory->create(['data' => $optionValueData]); + $optionData['values'] = [$optionValueData]; + } + + $option = $this->productCustomOptionFactory->create(['data' => $optionData]); + $product->setOptions([$option]); + + return $this->productRepository->save($product); + } + + /** + * Render custom options block. + * + * @param ProductInterface $product + * @return string + */ + private function getOptionHtml(ProductInterface $product): string + { + $optionsBlock = $this->getOptionsBlock(); + $optionsBlock->setProduct($product); + + return $optionsBlock->toHtml(); + } + + /** + * Get options block. + * + * @return Options + */ + private function getOptionsBlock(): Options + { + $this->page->addHandle($this->getHandlesList()); + $this->page->getLayout()->generateXml(); + /** @var Template $productInfoFormOptionsBlock */ + $productInfoFormOptionsBlock = $this->page->getLayout()->getBlock('product.info.form.options'); + $optionsWrapperBlock = $productInfoFormOptionsBlock->getChildBlock('product_options_wrapper'); + + return $optionsWrapperBlock->getChildBlock('product_options'); + } + + /** + * Find and return custom option. + * + * @param ProductInterface $product + * @param string $optionTitle + * @return null|Option + */ + private function findOptionByTitle(ProductInterface $product, string $optionTitle): ?Option + { + $option = null; + foreach ($product->getOptions() as $customOption) { + if ($customOption->getTitle() === $optionTitle) { + $option = $customOption; + break; + } + } + + return $option; + } + + /** + * Return all need handles for load. + * + * @return array + */ + abstract protected function getHandlesList(): array; +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Options/RenderOptionsTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Options/RenderOptionsTest.php index e83563a6ad474..da31cfc74476a 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Options/RenderOptionsTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Options/RenderOptionsTest.php @@ -7,74 +7,19 @@ namespace Magento\Catalog\Block\Product\View\Options; -use Magento\Catalog\Api\Data\ProductCustomOptionInterface; -use Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory; -use Magento\Catalog\Api\Data\ProductCustomOptionValuesInterfaceFactory; -use Magento\Catalog\Api\ProductRepositoryInterface; -use Magento\Catalog\Block\Product\View\Options; -use Magento\Catalog\Model\Product\Option; -use Magento\Catalog\Model\Product\Option\Value; -use Magento\Framework\View\Element\Template; -use Magento\Framework\View\Result\Page; -use Magento\TestFramework\Helper\Bootstrap; -use Magento\TestFramework\Helper\CacheCleaner; -use Magento\TestFramework\ObjectManager; -use PHPUnit\Framework\TestCase; - /** - * Assert that product custom options render as expected. + * Test cases related to check that simple product custom option renders as expected. * * @magentoDbIsolation disabled * @magentoAppArea frontend */ -class RenderOptionsTest extends TestCase +class RenderOptionsTest extends AbstractRenderCustomOptionsTest { - /** - * @var ObjectManager - */ - private $objectManager; - - /** - * @var ProductRepositoryInterface - */ - private $productRepository; - - /** - * @var ProductCustomOptionInterfaceFactory - */ - private $productCustomOptionFactory; - - /** - * @var ProductCustomOptionValuesInterfaceFactory - */ - private $productCustomOptionValuesFactory; - - /** - * @var Page - */ - private $page; - - /** - * @inheritdoc - */ - protected function setUp() - { - CacheCleaner::cleanAll(); - $this->objectManager = Bootstrap::getObjectManager(); - $this->productRepository = $this->objectManager->create(ProductRepositoryInterface::class); - $this->productCustomOptionFactory = $this->objectManager->get(ProductCustomOptionInterfaceFactory::class); - $this->productCustomOptionValuesFactory = $this->objectManager->get( - ProductCustomOptionValuesInterfaceFactory::class - ); - $this->page = $this->objectManager->create(Page::class); - parent::setUp(); - } - /** * Check that options from text group(field, area) render as expected. * * @magentoDataFixture Magento/Catalog/_files/product_without_options_with_stock_data.php - * @dataProvider \Magento\TestFramework\Catalog\Block\Product\View\Options\TextGroupDataProvider::getData() + * @dataProvider \Magento\TestFramework\Catalog\Block\Product\View\Options\TextGroupDataProvider::getData * * @param array $optionData * @param array $checkArray @@ -82,22 +27,14 @@ protected function setUp() */ public function testRenderCustomOptionsFromTextGroup(array $optionData, array $checkArray): void { - $option = $this->addOptionToProduct($optionData); - $optionHtml = $this->getOptionHtml(); - $this->baseOptionAsserts($option, $optionHtml, $checkArray); - - if ($optionData[Option::KEY_MAX_CHARACTERS] > 0) { - $this->assertContains($checkArray['max_characters'], $optionHtml); - } else { - $this->assertNotContains('class="character-counter', $optionHtml); - } + $this->assertTextOptionRenderingOnProduct('simple', $optionData, $checkArray); } /** * Check that options from file group(file) render as expected. * * @magentoDataFixture Magento/Catalog/_files/product_without_options_with_stock_data.php - * @dataProvider \Magento\TestFramework\Catalog\Block\Product\View\Options\FileGroupDataProvider::getData() + * @dataProvider \Magento\TestFramework\Catalog\Block\Product\View\Options\FileGroupDataProvider::getData * * @param array $optionData * @param array $checkArray @@ -105,27 +42,14 @@ public function testRenderCustomOptionsFromTextGroup(array $optionData, array $c */ public function testRenderCustomOptionsFromFileGroup(array $optionData, array $checkArray): void { - $option = $this->addOptionToProduct($optionData); - $optionHtml = $this->getOptionHtml(); - $this->baseOptionAsserts($option, $optionHtml, $checkArray); - $this->assertContains($checkArray['file_extension'], $optionHtml); - - if (isset($checkArray['file_width'])) { - $checkArray['file_width'] = sprintf($checkArray['file_width'], __('Maximum image width')); - $this->assertRegExp($checkArray['file_width'], $optionHtml); - } - - if (isset($checkArray['file_height'])) { - $checkArray['file_height'] = sprintf($checkArray['file_height'], __('Maximum image height')); - $this->assertRegExp($checkArray['file_height'], $optionHtml); - } + $this->assertFileOptionRenderingOnProduct('simple', $optionData, $checkArray); } /** * Check that options from select group(drop-down, radio buttons, checkbox, multiple select) render as expected. * * @magentoDataFixture Magento/Catalog/_files/product_without_options_with_stock_data.php - * @dataProvider \Magento\TestFramework\Catalog\Block\Product\View\Options\SelectGroupDataProvider::getData() + * @dataProvider \Magento\TestFramework\Catalog\Block\Product\View\Options\SelectGroupDataProvider::getData * * @param array $optionData * @param array $optionValueData @@ -137,33 +61,14 @@ public function testRenderCustomOptionsFromSelectGroup( array $optionValueData, array $checkArray ): void { - $option = $this->addOptionToProduct($optionData, $optionValueData); - $optionValues = $option->getValues(); - $optionValue = reset($optionValues); - $optionHtml = $this->getOptionHtml(); - $this->baseOptionAsserts($option, $optionHtml, $checkArray); - - if (isset($checkArray['not_contain_arr'])) { - foreach ($checkArray['not_contain_arr'] as $notContainPattern) { - $this->assertNotRegExp($notContainPattern, $optionHtml); - } - } - - if (isset($checkArray['option_value_item'])) { - $checkArray['option_value_item'] = sprintf( - $checkArray['option_value_item'], - $optionValue->getOptionTypeId(), - $optionValueData[Value::KEY_TITLE] - ); - $this->assertRegExp($checkArray['option_value_item'], $optionHtml); - } + $this->assertSelectOptionRenderingOnProduct('simple', $optionData, $optionValueData, $checkArray); } /** * Check that options from date group(date, date & time, time) render as expected. * * @magentoDataFixture Magento/Catalog/_files/product_without_options_with_stock_data.php - * @dataProvider \Magento\TestFramework\Catalog\Block\Product\View\Options\DateGroupDataProvider::getData() + * @dataProvider \Magento\TestFramework\Catalog\Block\Product\View\Options\DateGroupDataProvider::getData * * @param array $optionData * @param array $checkArray @@ -171,125 +76,17 @@ public function testRenderCustomOptionsFromSelectGroup( */ public function testRenderCustomOptionsFromDateGroup(array $optionData, array $checkArray): void { - $option = $this->addOptionToProduct($optionData); - $optionHtml = $this->getOptionHtml(); - $this->baseOptionAsserts($option, $optionHtml, $checkArray); - - switch ($optionData[Option::KEY_TYPE]) { - case ProductCustomOptionInterface::OPTION_TYPE_DATE: - $this->assertContains("<select name=\"options[{$option->getOptionId()}][month]\"", $optionHtml); - $this->assertContains("<select name=\"options[{$option->getOptionId()}][day]\"", $optionHtml); - $this->assertContains("<select name=\"options[{$option->getOptionId()}][year]\"", $optionHtml); - $this->assertNotContains("<select name=\"options[{$option->getOptionId()}][hour]\"", $optionHtml); - $this->assertNotContains("<select name=\"options[{$option->getOptionId()}][minute]\"", $optionHtml); - $this->assertNotContains("<select name=\"options[{$option->getOptionId()}][day_part]\"", $optionHtml); - break; - case ProductCustomOptionInterface::OPTION_TYPE_DATE_TIME: - $this->assertContains("<select name=\"options[{$option->getOptionId()}][month]\"", $optionHtml); - $this->assertContains("<select name=\"options[{$option->getOptionId()}][day]\"", $optionHtml); - $this->assertContains("<select name=\"options[{$option->getOptionId()}][year]\"", $optionHtml); - $this->assertContains("<select name=\"options[{$option->getOptionId()}][hour]\"", $optionHtml); - $this->assertContains("<select name=\"options[{$option->getOptionId()}][minute]\"", $optionHtml); - $this->assertContains("<select name=\"options[{$option->getOptionId()}][day_part]\"", $optionHtml); - break; - case ProductCustomOptionInterface::OPTION_TYPE_TIME: - $this->assertNotContains("<select name=\"options[{$option->getOptionId()}][month]\"", $optionHtml); - $this->assertNotContains("<select name=\"options[{$option->getOptionId()}][day]\"", $optionHtml); - $this->assertNotContains("<select name=\"options[{$option->getOptionId()}][year]\"", $optionHtml); - $this->assertContains("<select name=\"options[{$option->getOptionId()}][hour]\"", $optionHtml); - $this->assertContains("<select name=\"options[{$option->getOptionId()}][minute]\"", $optionHtml); - $this->assertContains("<select name=\"options[{$option->getOptionId()}][day_part]\"", $optionHtml); - break; - } + $this->assertDateOptionRenderingOnProduct('simple', $optionData, $checkArray); } /** - * Base asserts for rendered options. - * - * @param ProductCustomOptionInterface $option - * @param string $optionHtml - * @param array $checkArray - * @return void - */ - private function baseOptionAsserts( - ProductCustomOptionInterface $option, - string $optionHtml, - array $checkArray - ): void { - $this->assertContains($checkArray['block_with_required_class'], $optionHtml); - $this->assertContains($checkArray['title'], $optionHtml); - - if (isset($checkArray['label_for_created_option'])) { - $checkArray['label_for_created_option'] = sprintf( - $checkArray['label_for_created_option'], - $option->getOptionId() - ); - $this->assertContains($checkArray['label_for_created_option'], $optionHtml); - } - - if (isset($checkArray['price'])) { - $this->assertContains($checkArray['price'], $optionHtml); - } - - if (isset($checkArray['required_element'])) { - $this->assertRegExp($checkArray['required_element'], $optionHtml); - } - } - - /** - * Add custom option to product with data. - * - * @param array $optionData - * @param array $optionValueData - * @return ProductCustomOptionInterface - */ - private function addOptionToProduct(array $optionData, array $optionValueData = []): ProductCustomOptionInterface - { - $product = $this->productRepository->get('simple'); - $optionData[Option::KEY_PRODUCT_SKU] = $product->getSku(); - - if (!empty($optionValueData)) { - $optionValueData = $this->productCustomOptionValuesFactory->create(['data' => $optionValueData]); - $optionData['values'] = [$optionValueData]; - } - - $option = $this->productCustomOptionFactory->create(['data' => $optionData]); - $product->setOptions([$option]); - $createdOptions = $this->productRepository->save($product)->getOptions(); - - return reset($createdOptions); - } - - /** - * Render custom options block. - * - * @return string - */ - private function getOptionHtml(): string - { - $product = $this->productRepository->get('simple'); - $optionsBlock = $this->getOptionsBlock(); - $optionsBlock->setProduct($product); - - return $optionsBlock->toHtml(); - } - - /** - * Get options block. - * - * @return Options + * @inheritdoc */ - private function getOptionsBlock(): Options + protected function getHandlesList(): array { - $this->page->addHandle([ + return [ 'default', 'catalog_product_view', - ]); - $this->page->getLayout()->generateXml(); - /** @var Template $productInfoFormOptionsBlock */ - $productInfoFormOptionsBlock = $this->page->getLayout()->getBlock('product.info.form.options'); - $optionsWrapperBlock = $productInfoFormOptionsBlock->getChildBlock('product_options_wrapper'); - - return $optionsWrapperBlock->getChildBlock('product_options'); + ]; } } diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/CustomOptions/RenderOptionsTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/CustomOptions/RenderOptionsTest.php new file mode 100644 index 0000000000000..55f8b91f07093 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/CustomOptions/RenderOptionsTest.php @@ -0,0 +1,96 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\ConfigurableProduct\Block\Product\View\CustomOptions; + +use Magento\Catalog\Block\Product\View\Options\AbstractRenderCustomOptionsTest; + +/** + * Test cases related to check that configurable product custom option renders as expected. + * + * @magentoDbIsolation disabled + * @magentoAppArea frontend + */ +class RenderOptionsTest extends AbstractRenderCustomOptionsTest +{ + /** + * Check that options from text group(field, area) render on configurable product as expected. + * + * @magentoDataFixture Magento/ConfigurableProduct/_files/configurable_product_with_two_child_products.php + * @dataProvider \Magento\TestFramework\ConfigurableProduct\Block\CustomOptions\TextGroupDataProvider::getData + * + * @param array $optionData + * @param array $checkArray + * @return void + */ + public function testRenderCustomOptionsFromTextGroup(array $optionData, array $checkArray): void + { + $this->assertTextOptionRenderingOnProduct('Configurable product', $optionData, $checkArray); + } + + /** + * Check that options from file group(file) render on configurable product as expected. + * + * @magentoDataFixture Magento/ConfigurableProduct/_files/configurable_product_with_two_child_products.php + * @dataProvider \Magento\TestFramework\ConfigurableProduct\Block\CustomOptions\FileGroupDataProvider::getData + * + * @param array $optionData + * @param array $checkArray + * @return void + */ + public function testRenderCustomOptionsFromFileGroup(array $optionData, array $checkArray): void + { + $this->assertFileOptionRenderingOnProduct('Configurable product', $optionData, $checkArray); + } + + /** + * Check that options from select group(drop-down, radio buttons, checkbox, multiple select) render + * on configurable product as expected. + * + * @magentoDataFixture Magento/ConfigurableProduct/_files/configurable_product_with_two_child_products.php + * @dataProvider \Magento\TestFramework\ConfigurableProduct\Block\CustomOptions\SelectGroupDataProvider::getData + * + * @param array $optionData + * @param array $optionValueData + * @param array $checkArray + * @return void + */ + public function testRenderCustomOptionsFromSelectGroup( + array $optionData, + array $optionValueData, + array $checkArray + ): void { + $this->assertSelectOptionRenderingOnProduct('Configurable product', $optionData, $optionValueData, $checkArray); + } + + /** + * Check that options from date group(date, date & time, time) render on configurable product as expected. + * + * @magentoDataFixture Magento/ConfigurableProduct/_files/configurable_product_with_two_child_products.php + * @dataProvider \Magento\TestFramework\ConfigurableProduct\Block\CustomOptions\DateGroupDataProvider::getData + * + * @param array $optionData + * @param array $checkArray + * @return void + */ + public function testRenderCustomOptionsFromDateGroup(array $optionData, array $checkArray): void + { + $this->assertDateOptionRenderingOnProduct('Configurable product', $optionData, $checkArray); + } + + /** + * @inheritdoc + */ + protected function getHandlesList(): array + { + return [ + 'default', + 'catalog_product_view', + 'catalog_product_view_type_configurable', + ]; + } +} From c45e16bf0db6e8178d41e8982135c29964f904dc Mon Sep 17 00:00:00 2001 From: Lena Orobei <oorobei@magento.com> Date: Tue, 4 Feb 2020 15:01:04 -0600 Subject: [PATCH 1120/1143] Fixed issue with PHP Fatal error: Cannot redeclare Magento\Customer\Model\Session::$accountConfirmation --- app/code/Magento/Customer/Model/Session.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/code/Magento/Customer/Model/Session.php b/app/code/Magento/Customer/Model/Session.php index 8fc4d9c63458f..55e31cb4555b4 100644 --- a/app/code/Magento/Customer/Model/Session.php +++ b/app/code/Magento/Customer/Model/Session.php @@ -99,11 +99,6 @@ class Session extends \Magento\Framework\Session\SessionManager */ protected $_httpContext; - /** - * @var AccountConfirmation - */ - protected $accountConfirmation; - /** * @var GroupManagementInterface */ From a027e87a3d0393bc0639033e2e0ecf14d51f44a9 Mon Sep 17 00:00:00 2001 From: Ihor Sviziev <ihor-sviziev@users.noreply.github.com> Date: Wed, 5 Feb 2020 01:40:08 +0200 Subject: [PATCH 1121/1143] Prevent endless loop when duplicating product Remove redundant backward compatibility in constructor --- app/code/Magento/Catalog/Model/Product/Copier.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Copier.php b/app/code/Magento/Catalog/Model/Product/Copier.php index d10bf085a4a25..91fb5213281ec 100644 --- a/app/code/Magento/Catalog/Model/Product/Copier.php +++ b/app/code/Magento/Catalog/Model/Product/Copier.php @@ -59,14 +59,14 @@ public function __construct( CopyConstructorInterface $copyConstructor, ProductFactory $productFactory, ScopeOverriddenValue $scopeOverriddenValue, - OptionRepository $optionRepository = null, - MetadataPool $metadataPool = null + OptionRepository $optionRepository, + MetadataPool $metadataPool ) { $this->productFactory = $productFactory; $this->copyConstructor = $copyConstructor; $this->scopeOverriddenValue = $scopeOverriddenValue; - $this->optionRepository = $optionRepository ?: ObjectManager::getInstance()->get(OptionRepository::class); - $this->metadataPool = $metadataPool ?: ObjectManager::getInstance()->get(MetadataPool::class); + $this->optionRepository = $optionRepository; + $this->metadataPool = $metadataPool; } /** From 5f4cc5f6f81776db4419be934c1a3afd159fd38e Mon Sep 17 00:00:00 2001 From: Lachlan Turner <lachlan.turner@aligent.com.au> Date: Wed, 5 Feb 2020 10:30:49 +1030 Subject: [PATCH 1122/1143] #26622 - Reduce cyclomatic complexity of initTotals function --- .../Magento/SalesRule/Model/Validator.php | 34 +++++++++++++++---- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/SalesRule/Model/Validator.php b/app/code/Magento/SalesRule/Model/Validator.php index f05ad1eaba7fd..913c77655b946 100644 --- a/app/code/Magento/SalesRule/Model/Validator.php +++ b/app/code/Magento/SalesRule/Model/Validator.php @@ -383,13 +383,7 @@ public function initTotals($items, Address $address) foreach ($items as $item) { //Skipping child items to avoid double calculations - if ($item->getParentItemId() || $item->getParentItem()) { - continue; - } - if (!$rule->getActions()->validate($item)) { - continue; - } - if (!$this->canApplyDiscount($item)) { + if (!$this->isValidItemForRule($item, $rule)) { continue; } $qty = $this->validatorUtility->getItemQty($item, $rule); @@ -409,6 +403,32 @@ public function initTotals($items, Address $address) return $this; } + /** + * Determine if quote item is valid for a given sales rule + * @param AbstractItem $item + * @param Rule $rule + * @return bool + */ + protected function isValidItemForRule( + AbstractItem $item, + Rule $rule + ) { + /** @var AbstractItem $item */ + if ($item->getParentItemId()) { + return false; + } + if ($item->getParentItem()) { + return false; + } + if (!$rule->getActions()->validate($item)) { + return false; + } + if (!$this->canApplyDiscount($item)) { + return false; + } + return true; + } + /** * Return item price * From 0e9c4ef9d7d541f8dba35052731f8d2d152fe4f7 Mon Sep 17 00:00:00 2001 From: Lachlan Turner <lachlan.turner@aligent.com.au> Date: Wed, 5 Feb 2020 10:31:21 +1030 Subject: [PATCH 1123/1143] #26622 - Update class description to fix failing static test --- app/code/Magento/SalesRule/Test/Unit/Model/ValidatorTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/SalesRule/Test/Unit/Model/ValidatorTest.php b/app/code/Magento/SalesRule/Test/Unit/Model/ValidatorTest.php index 93f46bc42db5a..30b198e5b9199 100644 --- a/app/code/Magento/SalesRule/Test/Unit/Model/ValidatorTest.php +++ b/app/code/Magento/SalesRule/Test/Unit/Model/ValidatorTest.php @@ -13,7 +13,7 @@ use PHPUnit\Framework\MockObject\MockObject; /** - * Class ValidatorTest + * Tests for Magento\SalesRule\Model\Validator * @@SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class ValidatorTest extends \PHPUnit\Framework\TestCase From 2c961afa3170257c4bed3c26d0d57d42d5445035 Mon Sep 17 00:00:00 2001 From: Lachlan Turner <lachlan.turner@aligent.com.au> Date: Wed, 5 Feb 2020 11:16:57 +1030 Subject: [PATCH 1124/1143] #26622 - Fix code style --- app/code/Magento/SalesRule/Model/Validator.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/SalesRule/Model/Validator.php b/app/code/Magento/SalesRule/Model/Validator.php index 913c77655b946..8292e9c313b66 100644 --- a/app/code/Magento/SalesRule/Model/Validator.php +++ b/app/code/Magento/SalesRule/Model/Validator.php @@ -405,6 +405,7 @@ public function initTotals($items, Address $address) /** * Determine if quote item is valid for a given sales rule + * * @param AbstractItem $item * @param Rule $rule * @return bool From 427a4ad298210ed5287044cd49c51391daa0af65 Mon Sep 17 00:00:00 2001 From: Fanis Strezos <fanis.strezos@dotdigital.com> Date: Wed, 5 Feb 2020 09:43:51 +0000 Subject: [PATCH 1125/1143] Update dockblocks to return null --- .../Magento/Sales/Api/Data/OrderInterface.php | 8 ------- app/code/Magento/Sales/Model/Order.php | 23 +------------------ 2 files changed, 1 insertion(+), 30 deletions(-) diff --git a/app/code/Magento/Sales/Api/Data/OrderInterface.php b/app/code/Magento/Sales/Api/Data/OrderInterface.php index f699d24bd32cd..b45fddc7d7354 100644 --- a/app/code/Magento/Sales/Api/Data/OrderInterface.php +++ b/app/code/Magento/Sales/Api/Data/OrderInterface.php @@ -5,8 +5,6 @@ */ namespace Magento\Sales\Api\Data; -use Magento\Customer\Model\Customer; - /** * Order interface. * @@ -912,12 +910,6 @@ public function getCreatedAt(); */ public function setCreatedAt($createdAt); - /** - * Gets the customer from Order - * @return Customer - */ - public function getCustomer(); - /** * Gets the customer date-of-birth (DOB) for the order. * diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php index 1d520574f21d7..0a727b7560396 100644 --- a/app/code/Magento/Sales/Model/Order.php +++ b/app/code/Magento/Sales/Model/Order.php @@ -6,7 +6,6 @@ namespace Magento\Sales\Model; use Magento\Config\Model\Config\Source\Nooptreq; -use Magento\Customer\Api\CustomerRepositoryInterface; use Magento\Directory\Model\Currency; use Magento\Framework\Api\AttributeValueFactory; use Magento\Framework\Api\SearchCriteriaBuilder; @@ -52,6 +51,7 @@ * @method bool hasCustomerNoteNotify() * @method bool hasForcedCanCreditmemo() * @method bool getIsInProcess() + * @method \Magento\Customer\Model\Customer|null getCustomer() * @method \Magento\Sales\Model\Order setSendEmail(bool $value) * @SuppressWarnings(PHPMD.ExcessivePublicCount) * @SuppressWarnings(PHPMD.TooManyFields) @@ -307,11 +307,6 @@ class Order extends AbstractModel implements EntityInterface, OrderInterface */ private $scopeConfig; - /** - * @var CustomerRepositoryInterface - */ - private $_customerRepositoryInterface; - /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry @@ -345,7 +340,6 @@ class Order extends AbstractModel implements EntityInterface, OrderInterface * @param OrderItemRepositoryInterface $itemRepository * @param SearchCriteriaBuilder $searchCriteriaBuilder * @param ScopeConfigInterface $scopeConfig - * @param CustomerRepositoryInterface $customerRepositoryInterface * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -372,7 +366,6 @@ public function __construct( \Magento\Sales\Model\ResourceModel\Order\Shipment\Track\CollectionFactory $trackCollectionFactory, \Magento\Sales\Model\ResourceModel\Order\CollectionFactory $salesOrderCollectionFactory, PriceCurrencyInterface $priceCurrency, - CustomerRepositoryInterface $customerRepositoryInterface, \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productListFactory, \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, @@ -410,7 +403,6 @@ public function __construct( $this->searchCriteriaBuilder = $searchCriteriaBuilder ?: ObjectManager::getInstance() ->get(SearchCriteriaBuilder::class); $this->scopeConfig = $scopeConfig ?: ObjectManager::getInstance()->get(ScopeConfigInterface::class); - $this->_customerRepositoryInterface = $customerRepositoryInterface; parent::__construct( $context, @@ -570,19 +562,6 @@ public function getStore() return $this->_storeManager->getStore(); } - /** - * Returns Customer - * - * @return \Magento\Customer\Api\Data\CustomerInterface - * @throws LocalizedException - * @throws \Magento\Framework\Exception\NoSuchEntityException - */ - public function getCustomer() - { - $customerId = $this->getData(OrderInterface::CUSTOMER_ID); - return $this->_customerRepositoryInterface->getById($customerId); - } - /** * Retrieve order cancel availability * From 198d216d2190b804dcec5dde1d22c29dc824efb4 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Wed, 5 Feb 2020 15:39:17 +0200 Subject: [PATCH 1126/1143] cover changes with jasmine test --- .../dynamic-rows-configurable.test.js | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/dynamic-rows-configurable.test.js diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/dynamic-rows-configurable.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/dynamic-rows-configurable.test.js new file mode 100644 index 0000000000000..25d49af9b1bc7 --- /dev/null +++ b/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/dynamic-rows-configurable.test.js @@ -0,0 +1,53 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +/* eslint-disable max-nested-callbacks */ +define([ + 'jquery', + 'Magento_ConfigurableProduct/js/components/dynamic-rows-configurable', + 'Magento_Ui/js/dynamic-rows/dynamic-rows' +], function ($, DynamicRowsConf, DynamicRows) { + 'use strict'; + + describe('Magento_ConfigurableProduct/js/components/dynamic-rows-configurable', function () { + var model; + + beforeEach(function () { + model = new DynamicRowsConf(new DynamicRows({ + isEmpty: jasmine.createSpy().and.returnValue(1), + isShowAddProductButton: jasmine.createSpy().and.returnValue(1) + })); + + }); + + it('Verify processingUnionInsertDat method', function () { + var expectedData = [], + mockData = [ + { + attributes: 'Color: dsfsd', + sku: 'Conf-sdfs' + }, + { + attributes: 'Color: sdfs', + sku: 'Conf-dsfsd' + } + ], + sourceMock = { + get: jasmine.createSpy().and.returnValue(['code1', 'code2']), + set: jasmine.createSpy().and.callFake(function (path, row) { + expectedData.push(row); + }) + }; + + model.getChildItems = jasmine.createSpy().and.returnValue($('')); + model.source = sourceMock; + model.processingUnionInsertData(mockData); + expect(model.source.get).toHaveBeenCalled(); + expect(model.getChildItems).toHaveBeenCalled(); + expect(expectedData[1].sku).toBe(mockData[0].sku); + }); + + }); +}); From 55337b9f0f1d26a4d11b2edd949adee3af2be8fe Mon Sep 17 00:00:00 2001 From: Mykhailo Matiola <mykhailo.matiola@transoftgroup.com> Date: Wed, 5 Feb 2020 15:42:09 +0200 Subject: [PATCH 1127/1143] MC-31025: Indexer price calculation for configurable product --- .../Price/GetPriceIndexDataByProductId.php | 77 +++++++ .../Product/Type/Configurable/PriceTest.php | 193 ++++++++++++++++ ...configurable_product_with_percent_rule.php | 50 +++++ ...ble_product_with_percent_rule_rollback.php | 33 +++ ...roduct_with_percent_rules_for_children.php | 66 ++++++ ...th_percent_rules_for_children_rollback.php | 35 +++ .../Product/Type/Configurable/PriceTest.php | 209 ++++++++++-------- ...th_custom_option_and_simple_tier_price.php | 34 +++ ..._option_and_simple_tier_price_rollback.php | 8 + 9 files changed, 608 insertions(+), 97 deletions(-) create mode 100644 dev/tests/integration/framework/Magento/TestFramework/Catalog/Model/Product/Price/GetPriceIndexDataByProductId.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogRuleConfigurable/Model/Product/Type/Configurable/PriceTest.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogRuleConfigurable/_files/configurable_product_with_percent_rule.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogRuleConfigurable/_files/configurable_product_with_percent_rule_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogRuleConfigurable/_files/configurable_product_with_percent_rules_for_children.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogRuleConfigurable/_files/configurable_product_with_percent_rules_for_children_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_custom_option_and_simple_tier_price.php create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_custom_option_and_simple_tier_price_rollback.php diff --git a/dev/tests/integration/framework/Magento/TestFramework/Catalog/Model/Product/Price/GetPriceIndexDataByProductId.php b/dev/tests/integration/framework/Magento/TestFramework/Catalog/Model/Product/Price/GetPriceIndexDataByProductId.php new file mode 100644 index 0000000000000..b1794c55d06f3 --- /dev/null +++ b/dev/tests/integration/framework/Magento/TestFramework/Catalog/Model/Product/Price/GetPriceIndexDataByProductId.php @@ -0,0 +1,77 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\TestFramework\Catalog\Model\Product\Price; + +use Magento\Catalog\Model\Indexer\Product\Price\PriceTableResolver; +use Magento\Catalog\Model\ResourceModel\Product as ProductResource; +use Magento\Customer\Model\Indexer\CustomerGroupDimensionProvider; +use Magento\Framework\Indexer\DimensionFactory; +use Magento\Store\Model\Indexer\WebsiteDimensionProvider; + +/** + * Search and return price data from price index table. + */ +class GetPriceIndexDataByProductId +{ + /** + * @var ProductResource + */ + private $productResource; + + /** + * @var PriceTableResolver + */ + private $priceTableResolver; + + /** + * @var DimensionFactory + */ + private $dimensionFactory; + + /** + * @param ProductResource $productResource + * @param PriceTableResolver $priceTableResolver + * @param DimensionFactory $dimensionFactory + */ + public function __construct( + ProductResource $productResource, + PriceTableResolver $priceTableResolver, + DimensionFactory $dimensionFactory + ) { + $this->productResource = $productResource; + $this->priceTableResolver = $priceTableResolver; + $this->dimensionFactory = $dimensionFactory; + } + + /** + * Returns price data by product id. + * + * @param int $productId + * @param int $groupId + * @param int $websiteId + * @return array + */ + public function execute(int $productId, int $groupId, int $websiteId): array + { + $tableName = $this->priceTableResolver->resolve( + 'catalog_product_index_price', + [ + $this->dimensionFactory->create(WebsiteDimensionProvider::DIMENSION_NAME, (string)$websiteId), + $this->dimensionFactory->create(CustomerGroupDimensionProvider::DIMENSION_NAME, (string)$groupId), + ] + ); + + $select = $this->productResource->getConnection()->select() + ->from($tableName) + ->where('entity_id = ?', $productId) + ->where('customer_group_id = ?', $groupId) + ->where('website_id = ?', $websiteId); + + return $this->productResource->getConnection()->fetchAll($select); + } +} diff --git a/dev/tests/integration/testsuite/Magento/CatalogRuleConfigurable/Model/Product/Type/Configurable/PriceTest.php b/dev/tests/integration/testsuite/Magento/CatalogRuleConfigurable/Model/Product/Type/Configurable/PriceTest.php new file mode 100644 index 0000000000000..1d8264522a2c4 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogRuleConfigurable/Model/Product/Type/Configurable/PriceTest.php @@ -0,0 +1,193 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\CatalogRuleConfigurable\Model\Product\Type\Configurable; + +use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product\Type\AbstractType; +use Magento\ConfigurableProduct\Model\Product\Type\Configurable\Price; +use Magento\Customer\Model\Group; +use Magento\Framework\ObjectManagerInterface; +use Magento\Store\Api\WebsiteRepositoryInterface; +use Magento\TestFramework\Catalog\Model\Product\Price\GetPriceIndexDataByProductId; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; + +/** + * Provides tests for configurable product pricing with catalog rules. + * + * @magentoDbIsolation disabled + * @magentoAppArea frontend + */ +class PriceTest extends TestCase +{ + /** + * @var ObjectManagerInterface + */ + private $objectManager; + + /** + * @var WebsiteRepositoryInterface + */ + private $websiteRepository; + + /** + * @var ProductRepositoryInterface + */ + private $productRepository; + + /** + * @var Price + */ + private $priceModel; + + /** + * @var GetPriceIndexDataByProductId + */ + private $getPriceIndexDataByProductId; + + /** + * @inheritdoc + */ + protected function setUp() + { + $this->objectManager = Bootstrap::getObjectManager(); + $this->priceModel = $this->objectManager->create(Price::class); + $this->websiteRepository = $this->objectManager->get(WebsiteRepositoryInterface::class); + $this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class); + $this->productRepository->cleanCache(); + $this->getPriceIndexDataByProductId = $this->objectManager->get(GetPriceIndexDataByProductId::class); + } + + /** + * @magentoDataFixture Magento/CatalogRuleConfigurable/_files/configurable_product_with_percent_rule.php + * @return void + */ + public function testGetFinalPriceWithCustomOptionAndCatalogRule(): void + { + $indexPrices = [ + 'simple_10' => [ + 'price' => 10, + 'final_price' => 9, + 'min_price' => 9, + 'max_price' => 9, + 'tier_price' => null + ], + 'simple_20' => [ + 'price' => 20, + 'final_price' => 15, + 'min_price' => 15, + 'max_price' => 15, + 'tier_price' => 15 + ], + 'configurable' => [ + 'price' => 0, + 'final_price' => 0, + 'min_price' => 9, + 'max_price' => 30, + 'tier_price' => 15 + ], + ]; + $this->assertConfigurableProductPrice(20, 25, $indexPrices); + } + + /** + * @magentoDataFixture Magento/CatalogRuleConfigurable/_files/configurable_product_with_percent_rules_for_children.php + * @return void + */ + public function testGetFinalPriceWithCustomOptionAndCatalogRulesForChildren(): void + { + $indexPrices = [ + 'simple_10' => [ + 'price' => 10, + 'final_price' => 4.5, + 'min_price' => 4.5, + 'max_price' => 9, + 'tier_price' => null + ], + 'simple_20' => [ + 'price' => 20, + 'final_price' => 8, + 'min_price' => 8, + 'max_price' => 15, + 'tier_price' => 15 + ], + 'configurable' => [ + 'price' => 0, + 'final_price' => 0, + 'min_price' => 4.5, + 'max_price' => 23, + 'tier_price' => 15 + ], + ]; + $this->assertConfigurableProductPrice(19.5, 23, $indexPrices); + } + + /** + * Asserts configurable product prices. + * + * @param float $priceWithFirstSimple + * @param float $priceWithSecondSimple + * @param array $indexPrices + * @return void + */ + private function assertConfigurableProductPrice( + float $priceWithFirstSimple, + float $priceWithSecondSimple, + array $indexPrices + ): void { + foreach ($indexPrices as $sku => $prices) { + $this->assertIndexTableData($sku, $prices); + } + $configurable = $this->productRepository->get('configurable'); + //Add tier price option + $optionId = $configurable->getOptions()[0]->getId(); + $configurable->addCustomOption(AbstractType::OPTION_PREFIX . $optionId, 'text'); + $configurable->addCustomOption('option_ids', $optionId); + //First simple rule price + Option price + $this->assertFinalPrice($configurable, $priceWithFirstSimple); + $configurable->addCustomOption('simple_product', 20, $this->productRepository->get('simple_20')); + //Second simple rule price + Option price + $this->assertFinalPrice($configurable, $priceWithSecondSimple); + } + + /** + * Asserts product final price. + * + * @param ProductInterface $product + * @param float $expectedPrice + * @return void + */ + private function assertFinalPrice(ProductInterface $product, float $expectedPrice): void + { + $this->assertEquals( + round($expectedPrice, 2), + round($this->priceModel->getFinalPrice(1, $product), 2) + ); + } + + /** + * Asserts price data in index table. + * + * @param string $sku + * @param array $expectedPrices + * @return void + */ + private function assertIndexTableData(string $sku, array $expectedPrices): void + { + $data = $this->getPriceIndexDataByProductId->execute( + (int)$this->productRepository->get($sku)->getId(), + Group::NOT_LOGGED_IN_ID, + (int)$this->websiteRepository->get('base')->getId() + ); + $data = reset($data); + foreach ($expectedPrices as $column => $price) { + $this->assertEquals($price, $data[$column]); + } + } +} diff --git a/dev/tests/integration/testsuite/Magento/CatalogRuleConfigurable/_files/configurable_product_with_percent_rule.php b/dev/tests/integration/testsuite/Magento/CatalogRuleConfigurable/_files/configurable_product_with_percent_rule.php new file mode 100644 index 0000000000000..abdf785c447a3 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogRuleConfigurable/_files/configurable_product_with_percent_rule.php @@ -0,0 +1,50 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\CatalogRule\Api\CatalogRuleRepositoryInterface; +use Magento\CatalogRule\Model\Rule; +use Magento\CatalogRule\Model\Rule\Condition\Combine; +use Magento\CatalogRule\Model\Rule\Condition\Product; +use Magento\CatalogRule\Model\RuleFactory; +use Magento\Customer\Model\Group; +use Magento\Framework\App\Area; +use Magento\Store\Api\WebsiteRepositoryInterface; +use Magento\Store\Model\StoreManagerInterface; +use Magento\TestFramework\Helper\Bootstrap; + +require __DIR__ . '/../../ConfigurableProduct/_files/configurable_product_with_custom_option_and_simple_tier_price.php'; +Bootstrap::getInstance()->loadArea(Area::AREA_ADMINHTML); + +/** @var StoreManagerInterface $storeManager */ +$storeManager = $objectManager->get(StoreManagerInterface::class); +/** @var WebsiteRepositoryInterface $websiteRepository */ +$websiteRepository = $objectManager->get(WebsiteRepositoryInterface::class); +/** @var CatalogRuleRepositoryInterface $ruleRepository */ +$ruleRepository = $objectManager->get(CatalogRuleRepositoryInterface::class); +/** @var Rule $rule */ +$rule = $objectManager->get(RuleFactory::class)->create(); +$rule->loadPost( + [ + 'name' => 'Percent rule for configurable product', + 'is_active' => '1', + 'stop_rules_processing' => 0, + 'website_ids' => [$websiteRepository->get('base')->getId()], + 'customer_group_ids' => Group::NOT_LOGGED_IN_ID, + 'discount_amount' => 50, + 'simple_action' => 'by_percent', + 'from_date' => '', + 'to_date' => '', + 'sort_order' => 0, + 'sub_is_enable' => 0, + 'sub_discount_amount' => 0, + 'conditions' => [ + '1' => ['type' => Combine::class, 'aggregator' => 'all', 'value' => '1', 'new_child' => ''], + '1--1' => ['type' => Product::class, 'attribute' => 'sku', 'operator' => '==', 'value' => 'configurable'], + ], + ] +); +$ruleRepository->save($rule); diff --git a/dev/tests/integration/testsuite/Magento/CatalogRuleConfigurable/_files/configurable_product_with_percent_rule_rollback.php b/dev/tests/integration/testsuite/Magento/CatalogRuleConfigurable/_files/configurable_product_with_percent_rule_rollback.php new file mode 100644 index 0000000000000..5b23d1918e394 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogRuleConfigurable/_files/configurable_product_with_percent_rule_rollback.php @@ -0,0 +1,33 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\CatalogRule\Api\CatalogRuleRepositoryInterface; +use Magento\CatalogRule\Model\Indexer\IndexBuilder; +use Magento\CatalogRule\Model\ResourceModel\Rule\CollectionFactory; +use Magento\CatalogRule\Model\Rule; +use Magento\TestFramework\Helper\Bootstrap; + +require __DIR__ + . '/../../ConfigurableProduct/_files/' + . 'configurable_product_with_custom_option_and_simple_tier_price_rollback.php'; + +$objectManager = Bootstrap::getObjectManager(); +/** @var CatalogRuleRepositoryInterface $ruleRepository */ +$ruleRepository = $objectManager->create(CatalogRuleRepositoryInterface::class); +/** @var IndexBuilder $indexBuilder */ +$indexBuilder = $objectManager->get(IndexBuilder::class); +/** @var CollectionFactory $ruleCollectionFactory */ +$ruleCollectionFactory = $objectManager->get(CollectionFactory::class); +$ruleCollection = $ruleCollectionFactory->create() + ->addFieldToFilter('name', ['eq' => 'Percent rule for configurable product']) + ->setPageSize(1); +/** @var Rule $rule */ +$rule = $ruleCollection->getFirstItem(); +if ($rule->getId()) { + $ruleRepository->delete($rule); +} +$indexBuilder->reindexFull(); diff --git a/dev/tests/integration/testsuite/Magento/CatalogRuleConfigurable/_files/configurable_product_with_percent_rules_for_children.php b/dev/tests/integration/testsuite/Magento/CatalogRuleConfigurable/_files/configurable_product_with_percent_rules_for_children.php new file mode 100644 index 0000000000000..79a66c69ae618 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogRuleConfigurable/_files/configurable_product_with_percent_rules_for_children.php @@ -0,0 +1,66 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\CatalogRule\Api\CatalogRuleRepositoryInterface; +use Magento\CatalogRule\Model\Rule; +use Magento\CatalogRule\Model\Rule\Condition\Combine; +use Magento\CatalogRule\Model\Rule\Condition\Product; +use Magento\CatalogRule\Model\RuleFactory; +use Magento\Customer\Model\Group; + +require __DIR__ . '/configurable_product_with_percent_rule.php'; + +/** @var CatalogRuleRepositoryInterface $ruleRepository */ +$ruleRepository = $objectManager->get(CatalogRuleRepositoryInterface::class); +/** @var Rule $firstRule */ +$ruleFactory = $objectManager->get(RuleFactory::class); + +$firstRule = $ruleFactory->create(); +$firstRule->loadPost( + [ + 'name' => 'Percent rule for first simple product', + 'is_active' => '1', + 'stop_rules_processing' => 0, + 'website_ids' => [$websiteRepository->get('base')->getId()], + 'customer_group_ids' => Group::NOT_LOGGED_IN_ID, + 'discount_amount' => 10, + 'simple_action' => 'by_percent', + 'from_date' => '', + 'to_date' => '', + 'sort_order' => 0, + 'sub_is_enable' => 0, + 'sub_discount_amount' => 0, + 'conditions' => [ + '1' => ['type' => Combine::class, 'aggregator' => 'all', 'value' => '1', 'new_child' => ''], + '1--1' => ['type' => Product::class, 'attribute' => 'sku', 'operator' => '==', 'value' => 'simple_10'], + ], + ] +); +$ruleRepository->save($firstRule); + +$secondRule = $ruleFactory->create(); +$secondRule->loadPost( + [ + 'name' => 'Percent rule for second simple product', + 'is_active' => '1', + 'stop_rules_processing' => 0, + 'website_ids' => [$websiteRepository->get('base')->getId()], + 'customer_group_ids' => Group::NOT_LOGGED_IN_ID, + 'discount_amount' => 20, + 'simple_action' => 'by_percent', + 'from_date' => '', + 'to_date' => '', + 'sort_order' => 0, + 'sub_is_enable' => 0, + 'sub_discount_amount' => 0, + 'conditions' => [ + '1' => ['type' => Combine::class, 'aggregator' => 'all', 'value' => '1', 'new_child' => ''], + '1--1' => ['type' => Product::class, 'attribute' => 'sku', 'operator' => '==', 'value' => 'simple_20'], + ], + ] +); +$ruleRepository->save($secondRule); diff --git a/dev/tests/integration/testsuite/Magento/CatalogRuleConfigurable/_files/configurable_product_with_percent_rules_for_children_rollback.php b/dev/tests/integration/testsuite/Magento/CatalogRuleConfigurable/_files/configurable_product_with_percent_rules_for_children_rollback.php new file mode 100644 index 0000000000000..773abe6236785 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogRuleConfigurable/_files/configurable_product_with_percent_rules_for_children_rollback.php @@ -0,0 +1,35 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\CatalogRule\Api\CatalogRuleRepositoryInterface; +use Magento\CatalogRule\Model\Indexer\IndexBuilder; +use Magento\CatalogRule\Model\ResourceModel\Rule\CollectionFactory; +use Magento\TestFramework\Helper\Bootstrap; + +require __DIR__ . '/configurable_product_with_percent_rule_rollback.php'; + +$objectManager = Bootstrap::getObjectManager(); +/** @var CatalogRuleRepositoryInterface $ruleRepository */ +$ruleRepository = $objectManager->create(CatalogRuleRepositoryInterface::class); +/** @var IndexBuilder $indexBuilder */ +$indexBuilder = $objectManager->get(IndexBuilder::class); +/** @var CollectionFactory $ruleCollectionFactory */ +$ruleCollectionFactory = $objectManager->get(CollectionFactory::class); +$ruleCollection = $ruleCollectionFactory->create() + ->addFieldToFilter( + 'name', + [ + 'in' => [ + 'Percent rule for first simple product', + 'Percent rule for second simple product', + ] + ] + ); +foreach ($ruleCollection as $rule) { + $ruleRepository->delete($rule); +} +$indexBuilder->reindexFull(); diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/Configurable/PriceTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/Configurable/PriceTest.php index e530029e9755e..6f491b33a3496 100644 --- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/Configurable/PriceTest.php +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/Configurable/PriceTest.php @@ -3,48 +3,94 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\ConfigurableProduct\Model\Product\Type\Configurable; +use Magento\Catalog\Api\Data\ProductInterface; use Magento\Catalog\Api\ProductRepositoryInterface; use Magento\Catalog\Model\Product\Type\AbstractType; +use Magento\Customer\Model\Group; +use Magento\Framework\ObjectManagerInterface; +use Magento\Store\Api\WebsiteRepositoryInterface; +use Magento\TestFramework\Catalog\Model\Product\Price\GetPriceIndexDataByProductId; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; /** - * Class PriceTest + * Provides tests for configurable product pricing. + * * @magentoDbIsolation disabled */ -class PriceTest extends \PHPUnit\Framework\TestCase +class PriceTest extends TestCase { - /** @var \Magento\Framework\ObjectManagerInterface */ - protected $objectManager; + /** + * @var ObjectManagerInterface + */ + private $objectManager; - /** @var \Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory */ - protected $customOptionFactory; + /** + * @var ProductRepositoryInterface + */ + private $productRepository; /** - * + * @var Price + */ + private $priceModel; + + /** + * @var GetPriceIndexDataByProductId + */ + private $getPriceIndexDataByProductId; + + /** + * @var WebsiteRepositoryInterface + */ + private $websiteRepository; + + /** + * @inheritdoc */ protected function setUp() { - $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->objectManager = Bootstrap::getObjectManager(); + $this->priceModel = $this->objectManager->create(Price::class); + $this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class); + $this->productRepository->cleanCache(); + $this->getPriceIndexDataByProductId = $this->objectManager->get(GetPriceIndexDataByProductId::class); + $this->websiteRepository = $this->objectManager->get(WebsiteRepositoryInterface::class); } /** * @magentoDataFixture Magento/ConfigurableProduct/_files/tax_rule.php * @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php - * @magentoDbIsolation disabled + * @return void */ - public function testGetFinalPrice() + public function testGetFinalPrice(): void { $this->assertPrice(10); + $this->assertIndexTableData( + 'configurable', + ['price' => 0, 'final_price' => 0, 'min_price' => 10, 'max_price' => 20, 'tier_price' => null] + ); + $this->assertIndexTableData( + 'simple_10', + ['price' => 10, 'final_price' => 10, 'min_price' => 10, 'max_price' => 10, 'tier_price' => null] + ); + $this->assertIndexTableData( + 'simple_20', + ['price' => 20, 'final_price' => 20, 'min_price' => 20, 'max_price' => 20, 'tier_price' => null] + ); } /** * @magentoConfigFixture current_store tax/display/type 1 * @magentoDataFixture Magento/ConfigurableProduct/_files/tax_rule.php * @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php - * @magentoDbIsolation disabled + * @return void */ - public function testGetFinalPriceExcludingTax() + public function testGetFinalPriceExcludingTax(): void { $this->assertPrice(10); } @@ -53,9 +99,9 @@ public function testGetFinalPriceExcludingTax() * @magentoConfigFixture current_store tax/display/type 2 * @magentoDataFixture Magento/ConfigurableProduct/_files/tax_rule.php * @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php - * @magentoDbIsolation disabled + * @return void */ - public function testGetFinalPriceIncludingTax() + public function testGetFinalPriceIncludingTax(): void { //lowest price of configurable variation + 10% $this->assertPrice(11); @@ -65,9 +111,9 @@ public function testGetFinalPriceIncludingTax() * @magentoConfigFixture current_store tax/display/type 3 * @magentoDataFixture Magento/ConfigurableProduct/_files/tax_rule.php * @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php - * @magentoDbIsolation disabled + * @return void */ - public function testGetFinalPriceIncludingExcludingTax() + public function testGetFinalPriceIncludingExcludingTax(): void { //lowest price of configurable variation + 10% $this->assertPrice(11); @@ -76,109 +122,78 @@ public function testGetFinalPriceIncludingExcludingTax() /** * @magentoDataFixture Magento/ConfigurableProduct/_files/tax_rule.php * @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php - * @magentoDbIsolation disabled + * @return void */ - public function testGetFinalPriceWithSelectedSimpleProduct() + public function testGetFinalPriceWithSelectedSimpleProduct(): void { - $product = $this->getProduct(1); - $product->addCustomOption('simple_product', 20, $this->getProduct(20)); + $product = $this->productRepository->get('configurable'); + $product->addCustomOption('simple_product', 20, $this->productRepository->get('simple_20')); $this->assertPrice(20, $product); } /** - * @magentoConfigFixture current_store tax/display/type 1 - * @magentoDataFixture Magento/ConfigurableProduct/_files/tax_rule.php - * @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php - * @magentoDbIsolation disabled + * @magentoDataFixture Magento/ConfigurableProduct/_files/configurable_product_with_custom_option_and_simple_tier_price.php + * @return void */ - public function testGetFinalPriceWithCustomOption() + public function testGetFinalPriceWithCustomOptionAndSimpleTierPrice(): void { - $product = $this->getProduct(1); - - $options = $this->prepareOptions( - [ - [ - 'option_id' => null, - 'previous_group' => 'text', - 'title' => 'Test Field', - 'type' => 'field', - 'is_require' => 1, - 'sort_order' => 0, - 'price' => 100, - 'price_type' => 'fixed', - 'sku' => '1-text', - 'max_characters' => 100, - ], - ], - $product + $configurable = $this->productRepository->get('configurable'); + $this->assertIndexTableData( + 'configurable', + ['price' => 0, 'final_price' => 0, 'min_price' => 9, 'max_price' => 30, 'tier_price' => 15] ); - - $product->setOptions($options); - $product->setCanSaveCustomOptions(true); - - /** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */ - $productRepository = $this->objectManager->get(ProductRepositoryInterface::class); - $product = $productRepository->save($product); - - $optionId = $product->getOptions()[0]->getId(); - $product->addCustomOption(AbstractType::OPTION_PREFIX . $optionId, 'text'); - $product->addCustomOption('option_ids', $optionId); - $this->assertPrice(110, $product); + $this->assertIndexTableData( + 'simple_10', + ['price' => 10, 'final_price' => 9, 'min_price' => 9, 'max_price' => 9, 'tier_price' => null] + ); + $this->assertIndexTableData( + 'simple_20', + ['price' => 20, 'final_price' => 15, 'min_price' => 15, 'max_price' => 15, 'tier_price' => 15] + ); + $optionId = $configurable->getOptions()[0]->getId(); + $configurable->addCustomOption(AbstractType::OPTION_PREFIX . $optionId, 'text'); + $configurable->addCustomOption('option_ids', $optionId); + // First simple special price (9) + Option price (15) + $this->assertPrice(24, $configurable); + $configurable->addCustomOption('simple_product', 20, $this->productRepository->get('simple_20')); + // Second simple tier price (15) + Option price (15) + $this->assertPrice(30, $configurable); } /** - * @param array $options - * @param \Magento\Catalog\Model\Product $product - * @return \Magento\Catalog\Api\Data\ProductCustomOptionInterface[] + * Asserts price data in index table. + * + * @param string $sku + * @param array $expectedPrices + * @return void */ - protected function prepareOptions($options, $product) + private function assertIndexTableData(string $sku, array $expectedPrices): void { - $preparedOptions = []; - - if (!$this->customOptionFactory) { - $this->customOptionFactory = $this->objectManager->create( - \Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory::class - ); - } - - foreach ($options as $option) { - $option = $this->customOptionFactory->create(['data' => $option]); - $option->setProductSku($product->getSku()); - - $preparedOptions[] = $option; + $data = $this->getPriceIndexDataByProductId->execute( + (int)$this->productRepository->get($sku)->getId(), + Group::NOT_LOGGED_IN_ID, + (int)$this->websiteRepository->get('base')->getId() + ); + $data = reset($data); + foreach ($expectedPrices as $column => $price) { + $this->assertEquals($price, $data[$column], $column); } - - return $preparedOptions; } /** - * Test + * Asserts product final price. * - * @param $expectedPrice - * @param null $product + * @param float $expectedPrice + * @param ProductInterface|null $product * @return void */ - protected function assertPrice($expectedPrice, $product = null) + private function assertPrice(float $expectedPrice, ?ProductInterface $product = null): void { - $product = $product ?: $this->getProduct(1); - - /** @var $model \Magento\ConfigurableProduct\Model\Product\Type\Configurable\Price */ - $model = $this->objectManager->create( - \Magento\ConfigurableProduct\Model\Product\Type\Configurable\Price::class - ); - + $product = $product ?: $this->productRepository->get('configurable'); // final price is the lowest price of configurable variations - $this->assertEquals(round($expectedPrice, 2), round($model->getFinalPrice(1, $product), 2)); - } - - /** - * @param int $id - * @return \Magento\Catalog\Model\Product - */ - private function getProduct($id) - { - /** @var $productRepository ProductRepositoryInterface */ - $productRepository = $this->objectManager->create(ProductRepositoryInterface::class); - return $productRepository->getById($id, true, null, true); + $this->assertEquals( + round($expectedPrice, 2), + round($this->priceModel->getFinalPrice(1, $product), 2) + ); } } diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_custom_option_and_simple_tier_price.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_custom_option_and_simple_tier_price.php new file mode 100644 index 0000000000000..994d1d0f27583 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_custom_option_and_simple_tier_price.php @@ -0,0 +1,34 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\Data\ProductTierPriceExtensionFactory; +use Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory; +use Magento\Customer\Model\Group; +use Magento\Store\Api\WebsiteRepositoryInterface; + +require __DIR__ . '/product_configurable_with_custom_option_type_text.php'; + +/** @var WebsiteRepositoryInterface $websiteRepository */ +$websiteRepository = $objectManager->get(WebsiteRepositoryInterface::class); +/** @var ProductTierPriceInterfaceFactory $tierPriceFactory */ +$tierPriceFactory = $objectManager->get(ProductTierPriceInterfaceFactory::class); +/** @var ProductTierPriceExtensionFactory $tpExtensionAttributeFactory */ +$tpExtensionAttributeFactory = $objectManager->get(ProductTierPriceExtensionFactory::class); + +$firstSimple = $productRepository->get('simple_10'); +$firstSimple->setSpecialPrice(9); +$productRepository->save($firstSimple); + +$secondSimple = $productRepository->get('simple_20'); +$tierPriceExtensionAttribute = $tpExtensionAttributeFactory->create( + ['data' => ['website_id' => $websiteRepository->get('admin')->getId(), 'percentage_value' => 25]] +); +$tierPrices[] = $tierPriceFactory + ->create(['data' => ['customer_group_id' => Group::CUST_GROUP_ALL, 'qty' => 1]]) + ->setExtensionAttributes($tierPriceExtensionAttribute); +$secondSimple->setTierPrices($tierPrices); +$productRepository->save($secondSimple); diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_custom_option_and_simple_tier_price_rollback.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_custom_option_and_simple_tier_price_rollback.php new file mode 100644 index 0000000000000..5157ec05a8834 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_with_custom_option_and_simple_tier_price_rollback.php @@ -0,0 +1,8 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +require __DIR__ . '/product_configurable_with_custom_option_type_text_rollback.php'; From 9ebd3e01049fe82a360b8d09190fe3298fbab79d Mon Sep 17 00:00:00 2001 From: Alex Paliarush <paliarus@adobe.com> Date: Tue, 4 Feb 2020 14:38:04 -0600 Subject: [PATCH 1128/1143] ECP-202 Deprecate Rotation Support in Magento - Fixed static tests --- .../Magento/Catalog/Model/Product/Image.php | 20 +++++++++++++++++-- lib/internal/Magento/Framework/Image.php | 14 ++++++++----- .../Image/Adapter/AbstractAdapter.php | 3 --- .../Image/Adapter/AdapterInterface.php | 3 +++ .../Framework/Image/Adapter/ImageMagick.php | 20 +++++++++++++++---- 5 files changed, 46 insertions(+), 14 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Image.php b/app/code/Magento/Catalog/Model/Product/Image.php index 6c7c133223532..7c2a53768fd47 100644 --- a/app/code/Magento/Catalog/Model/Product/Image.php +++ b/app/code/Magento/Catalog/Model/Product/Image.php @@ -10,9 +10,11 @@ use Magento\Catalog\Model\View\Asset\PlaceholderFactory; use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\App\ObjectManager; +use Magento\Framework\Exception\FileSystemException; use Magento\Framework\Image as MagentoImage; use Magento\Framework\Serialize\SerializerInterface; use Magento\Catalog\Model\Product\Image\ParamsBuilder; +use Magento\Framework\Filesystem\Driver\File as FilesystemDriver; /** * Image operations @@ -200,6 +202,11 @@ class Image extends \Magento\Framework\Model\AbstractModel */ private $serializer; + /** + * @var FilesystemDriver + */ + private $filesystemDriver; + /** * Constructor * @@ -220,6 +227,8 @@ class Image extends \Magento\Framework\Model\AbstractModel * @param array $data * @param SerializerInterface $serializer * @param ParamsBuilder $paramsBuilder + * @param FilesystemDriver $filesystemDriver + * @throws \Magento\Framework\Exception\FileSystemException * @SuppressWarnings(PHPMD.ExcessiveParameterList) * @SuppressWarnings(PHPMD.UnusedLocalVariable) */ @@ -240,7 +249,8 @@ public function __construct( \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, array $data = [], SerializerInterface $serializer = null, - ParamsBuilder $paramsBuilder = null + ParamsBuilder $paramsBuilder = null, + FilesystemDriver $filesystemDriver = null ) { $this->_storeManager = $storeManager; $this->_catalogProductMediaConfig = $catalogProductMediaConfig; @@ -255,6 +265,7 @@ public function __construct( $this->viewAssetPlaceholderFactory = $viewAssetPlaceholderFactory; $this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class); $this->paramsBuilder = $paramsBuilder ?: ObjectManager::getInstance()->get(ParamsBuilder::class); + $this->filesystemDriver = $filesystemDriver ?: ObjectManager::getInstance()->get(FilesystemDriver::class); } /** @@ -666,7 +677,12 @@ public function getDestinationSubdir() public function isCached() { $path = $this->imageAsset->getPath(); - return is_array($this->loadImageInfoFromCache($path)) || file_exists($path); + try { + $isCached = is_array($this->loadImageInfoFromCache($path)) || $this->filesystemDriver->isExists($path); + } catch (FileSystemException $e) { + $isCached = false; + } + return $isCached; } /** diff --git a/lib/internal/Magento/Framework/Image.php b/lib/internal/Magento/Framework/Image.php index ab88f23860704..64cd009a84a3c 100644 --- a/lib/internal/Magento/Framework/Image.php +++ b/lib/internal/Magento/Framework/Image.php @@ -49,7 +49,7 @@ public function open() $this->_adapter->checkDependencies(); if (!file_exists($this->_fileName)) { - throw new \Exception("File '{$this->_fileName}' does not exist."); + throw new \RuntimeException("File '{$this->_fileName}' does not exist."); } $this->_adapter->open($this->_fileName); @@ -95,7 +95,7 @@ public function rotate($angle) /** * Crop an image. * - * @param int $top Default value is 0 + * @param int $top Default value is 0 * @param int $left Default value is 0 * @param int $right Default value is 0 * @param int $bottom Default value is 0 @@ -195,7 +195,7 @@ public function quality($value) * @param int $watermarkImageOpacity Watermark image opacity. * @param bool $repeat Enable or disable watermark brick. * @access public - * @throws \Exception + * @throws \RuntimeException * @return void */ public function watermark( @@ -206,7 +206,7 @@ public function watermark( $repeat = false ) { if (!file_exists($watermarkImage)) { - throw new \Exception("Required file '{$watermarkImage}' does not exists."); + throw new \RuntimeException("Required file '{$watermarkImage}' does not exists."); } $this->_adapter->watermark($watermarkImage, $positionX, $positionY, $watermarkImageOpacity, $repeat); } @@ -233,16 +233,19 @@ public function getImageType() return $this->_adapter->getImageType(); } + // phpcs:disable Magento2.CodeAnalysis.EmptyBlock /** * Process * - * @access public + * @access public, * @return void */ public function process() { } + // phpcs:enable Magento2.CodeAnalysis.EmptyBlock + // phpcs:disable Magento2.CodeAnalysis.EmptyBlock /** * Instruction * @@ -252,6 +255,7 @@ public function process() public function instruction() { } + // phpcs:enable Magento2.CodeAnalysis.EmptyBlock /** * Set image background color diff --git a/lib/internal/Magento/Framework/Image/Adapter/AbstractAdapter.php b/lib/internal/Magento/Framework/Image/Adapter/AbstractAdapter.php index ecb10c67a7dce..88dbd69405471 100644 --- a/lib/internal/Magento/Framework/Image/Adapter/AbstractAdapter.php +++ b/lib/internal/Magento/Framework/Image/Adapter/AbstractAdapter.php @@ -41,9 +41,6 @@ abstract class AbstractAdapter implements AdapterInterface const POSITION_CENTER = 'center'; - /** - * Default font size - */ const DEFAULT_FONT_SIZE = 15; /** diff --git a/lib/internal/Magento/Framework/Image/Adapter/AdapterInterface.php b/lib/internal/Magento/Framework/Image/Adapter/AdapterInterface.php index 7749664e520d0..736686968b374 100644 --- a/lib/internal/Magento/Framework/Image/Adapter/AdapterInterface.php +++ b/lib/internal/Magento/Framework/Image/Adapter/AdapterInterface.php @@ -28,6 +28,8 @@ interface AdapterInterface public function getColorAt($x, $y); /** + * Render image and return its binary contents + * * @see \Magento\Framework\Image\Adapter\AbstractAdapter::getImage * @return string */ @@ -99,6 +101,7 @@ public function crop($top = 0, $left = 0, $right = 0, $bottom = 0); /** * Save image to specific path. + * * If some folders of path does not exist they will be created * * @param null|string $destination diff --git a/lib/internal/Magento/Framework/Image/Adapter/ImageMagick.php b/lib/internal/Magento/Framework/Image/Adapter/ImageMagick.php index 418230675e356..a08d83d33b0ef 100644 --- a/lib/internal/Magento/Framework/Image/Adapter/ImageMagick.php +++ b/lib/internal/Magento/Framework/Image/Adapter/ImageMagick.php @@ -5,6 +5,11 @@ */ namespace Magento\Framework\Image\Adapter; +/** + * Wrapper for Imagick image processing PHP Extension. + * + * @link https://www.php.net/manual/en/book.imagick.php + */ class ImageMagick extends \Magento\Framework\Image\Adapter\AbstractAdapter { /** @@ -77,7 +82,11 @@ public function open($filename) try { $this->_imageHandler = new \Imagick($this->_fileName); } catch (\ImagickException $e) { - throw new \Exception(sprintf('Unsupported image format. File: %s', $this->_fileName), $e->getCode(), $e); + throw new \RuntimeException( + sprintf('Unsupported image format. File: %s', $this->_fileName), + $e->getCode(), + $e + ); } $this->backgroundColor(); @@ -86,6 +95,7 @@ public function open($filename) /** * Save image to specific path. + * * If some folders of path does not exist they will be created * * @param null|string $destination @@ -124,6 +134,8 @@ protected function _applyOptions() } /** + * Render image binary content and return it. + * * @see \Magento\Framework\Image\Adapter\AbstractAdapter::getImage * @return string */ @@ -334,7 +346,7 @@ public function watermark($imagePath, $positionX = 0, $positionY = 0, $opacity = ); } } catch (\ImagickException $e) { - throw new \Exception('Unable to create watermark.', $e->getCode(), $e); + throw new \RuntimeException('Unable to create watermark.', $e->getCode(), $e); } // merge layers @@ -347,12 +359,12 @@ public function watermark($imagePath, $positionX = 0, $positionY = 0, $opacity = * Checks required dependencies * * @return void - * @throws \Exception If some of dependencies are missing + * @throws \RuntimeException If some of dependencies are missing */ public function checkDependencies() { if (!class_exists('\Imagick', false)) { - throw new \Exception("Required PHP extension 'Imagick' was not loaded."); + throw new \RuntimeException("Required PHP extension 'Imagick' was not loaded."); } } From d2c8006d935011a3d41cf86937967faca3f7e41f Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Wed, 5 Feb 2020 16:22:10 +0200 Subject: [PATCH 1129/1143] add "&" to test case --- .../web/js/components/dynamic-rows-configurable.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/dynamic-rows-configurable.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/dynamic-rows-configurable.test.js index 25d49af9b1bc7..4e843dc4c888d 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/dynamic-rows-configurable.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/dynamic-rows-configurable.test.js @@ -27,7 +27,7 @@ define([ mockData = [ { attributes: 'Color: dsfsd', - sku: 'Conf-sdfs' + sku: 'Conf&-sdfs' }, { attributes: 'Color: sdfs', From 861f4922e0a45d0ab4cf52895043a92019bc09b4 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Wed, 5 Feb 2020 16:33:13 +0200 Subject: [PATCH 1130/1143] small improvements --- .../web/js/components/dynamic-rows-configurable.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/dynamic-rows-configurable.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/dynamic-rows-configurable.test.js index 4e843dc4c888d..546392d35fe84 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/dynamic-rows-configurable.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/dynamic-rows-configurable.test.js @@ -46,7 +46,7 @@ define([ model.processingUnionInsertData(mockData); expect(model.source.get).toHaveBeenCalled(); expect(model.getChildItems).toHaveBeenCalled(); - expect(expectedData[1].sku).toBe(mockData[0].sku); + expect(expectedData[1].sku).toBe('Conf&-sdfs'); }); }); From 64cb774f748d375f72e2e0052261d907f6b23c87 Mon Sep 17 00:00:00 2001 From: Lena Orobei <oorobei@magento.com> Date: Wed, 5 Feb 2020 10:40:51 -0600 Subject: [PATCH 1131/1143] magento/magento2#9466: Fixed unit test --- .../Test/Unit/Model/Product/CopierTest.php | 37 +++++-------------- 1 file changed, 9 insertions(+), 28 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/CopierTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/CopierTest.php index 1d5abd817deb5..b72ecbf195d39 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/CopierTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/CopierTest.php @@ -19,22 +19,22 @@ class CopierTest extends \PHPUnit\Framework\TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $optionRepositoryMock; + private $optionRepositoryMock; /** * @var Copier */ - protected $_model; + private $_model; /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $copyConstructorMock; + private $copyConstructorMock; /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $productFactoryMock; + private $productFactoryMock; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -44,12 +44,12 @@ class CopierTest extends \PHPUnit\Framework\TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $productMock; + private $productMock; /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $metadata; + private $metadata; protected function setUp() { @@ -77,13 +77,10 @@ protected function setUp() $this->_model = new Copier( $this->copyConstructorMock, $this->productFactoryMock, - $this->scopeOverriddenValueMock + $this->scopeOverriddenValueMock, + $this->optionRepositoryMock, + $metadataPool ); - - $this->setProperties($this->_model, [ - 'optionRepository' => $this->optionRepositoryMock, - 'metadataPool' => $metadataPool - ]); } /** @@ -340,20 +337,4 @@ public function testUrlAlreadyExistsExceptionWhileCopyStoresUrl() $this->expectException(\Magento\UrlRewrite\Model\Exception\UrlAlreadyExistsException::class); $this->_model->copy($this->productMock); } - - /** - * @param $object - * @param array $properties - */ - private function setProperties($object, $properties = []) - { - $reflectionClass = new \ReflectionClass(get_class($object)); - foreach ($properties as $key => $value) { - if ($reflectionClass->hasProperty($key)) { - $reflectionProperty = $reflectionClass->getProperty($key); - $reflectionProperty->setAccessible(true); - $reflectionProperty->setValue($object, $value); - } - } - } } From f8bcd47e0959bf34b1f2f01712c0488e0939e881 Mon Sep 17 00:00:00 2001 From: Ihor Sviziev <ihor-sviziev@users.noreply.github.com> Date: Thu, 6 Feb 2020 09:05:09 +0200 Subject: [PATCH 1132/1143] Update getCustomer method in order class Fix static test --- app/code/Magento/Sales/Model/Order.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php index 0a727b7560396..8a760065439d6 100644 --- a/app/code/Magento/Sales/Model/Order.php +++ b/app/code/Magento/Sales/Model/Order.php @@ -1326,7 +1326,7 @@ public function getTrackingNumbers() */ public function getShippingMethod($asObject = false) { - $shippingMethod = parent::getShippingMethod(); + $shippingMethod = $this->getData('shipping_method'); if (!$asObject || !$shippingMethod) { return $shippingMethod; } else { From 80c737a7287439876f73ab90c7fce7e1a5a43877 Mon Sep 17 00:00:00 2001 From: Fanis Strezos <fanis.strezos@dotdigital.com> Date: Thu, 6 Feb 2020 09:27:53 +0000 Subject: [PATCH 1133/1143] roll back changes --- app/code/Magento/Sales/Model/Order.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php index 8a760065439d6..0a727b7560396 100644 --- a/app/code/Magento/Sales/Model/Order.php +++ b/app/code/Magento/Sales/Model/Order.php @@ -1326,7 +1326,7 @@ public function getTrackingNumbers() */ public function getShippingMethod($asObject = false) { - $shippingMethod = $this->getData('shipping_method'); + $shippingMethod = parent::getShippingMethod(); if (!$asObject || !$shippingMethod) { return $shippingMethod; } else { From 5a1f48e1cc590a9605c0ae82844e89a9b74e84f6 Mon Sep 17 00:00:00 2001 From: Fanis Strezos <fanis.strezos@dotdigital.com> Date: Thu, 6 Feb 2020 09:44:35 +0000 Subject: [PATCH 1134/1143] Revert "Update getCustomer method in order class" This reverts commit f8bcd47e0959bf34b1f2f01712c0488e0939e881. --- app/code/Magento/Sales/Model/Order.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php index 8a760065439d6..0a727b7560396 100644 --- a/app/code/Magento/Sales/Model/Order.php +++ b/app/code/Magento/Sales/Model/Order.php @@ -1326,7 +1326,7 @@ public function getTrackingNumbers() */ public function getShippingMethod($asObject = false) { - $shippingMethod = $this->getData('shipping_method'); + $shippingMethod = parent::getShippingMethod(); if (!$asObject || !$shippingMethod) { return $shippingMethod; } else { From 3ca45d8efa0a2a79c207451428b845d34c1addc8 Mon Sep 17 00:00:00 2001 From: Fanis Strezos <fanis.strezos@dotdigital.com> Date: Thu, 6 Feb 2020 09:46:51 +0000 Subject: [PATCH 1135/1143] Revert "roll back changes" This reverts commit 80c737a7287439876f73ab90c7fce7e1a5a43877. --- app/code/Magento/Sales/Model/Order.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php index 0a727b7560396..8a760065439d6 100644 --- a/app/code/Magento/Sales/Model/Order.php +++ b/app/code/Magento/Sales/Model/Order.php @@ -1326,7 +1326,7 @@ public function getTrackingNumbers() */ public function getShippingMethod($asObject = false) { - $shippingMethod = parent::getShippingMethod(); + $shippingMethod = $this->getData('shipping_method'); if (!$asObject || !$shippingMethod) { return $shippingMethod; } else { From 0ed2bcdf447d1edd60326670a4327d3be66b72d5 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Thu, 6 Feb 2020 14:34:55 +0200 Subject: [PATCH 1136/1143] Cover changes with jasmine test --- .../view/frontend/web/js/cookie-status.js | 14 ++++--- .../frontend/web/js/cookie-status.test.js | 39 +++++++++++++++++++ 2 files changed, 48 insertions(+), 5 deletions(-) create mode 100644 dev/tests/js/jasmine/tests/app/code/Magento/Theme/view/frontend/web/js/cookie-status.test.js diff --git a/app/code/Magento/Theme/view/frontend/web/js/cookie-status.js b/app/code/Magento/Theme/view/frontend/web/js/cookie-status.js index 48d201af0cffe..3726996a862c6 100644 --- a/app/code/Magento/Theme/view/frontend/web/js/cookie-status.js +++ b/app/code/Magento/Theme/view/frontend/web/js/cookie-status.js @@ -1,8 +1,8 @@ define([ 'jquery', 'Magento_Ui/js/modal/modal', - 'mage/translate', -], function($, modal){ + 'mage/translate' +], function ($, modal) { 'use strict'; $.widget('mage.cookieStatus', { @@ -14,6 +14,10 @@ define([ buttons: [{ text: $.mage.__('Close'), class: 'cookie-status', + + /** + * Callback for click event + */ click: function () { this.closeModal(); } @@ -26,11 +30,11 @@ define([ */ _init: function () { - if(!navigator.cookieEnabled) { + if (!navigator.cookieEnabled) { modal(this.options, $('#cookie-status')); } } }); - + return $.mage.cookieStatus; -}); \ No newline at end of file +}); diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Theme/view/frontend/web/js/cookie-status.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Theme/view/frontend/web/js/cookie-status.test.js new file mode 100644 index 0000000000000..bd35e0d0bd9f5 --- /dev/null +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Theme/view/frontend/web/js/cookie-status.test.js @@ -0,0 +1,39 @@ + +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +define([ + 'jquery', + 'cookieStatus' +], function ($, Cookie) { + 'use strict'; + + describe('Magento_Theme/js/cookie-status', function () { + var widget, + htmlContainer = '<div id="cookie-status" style="display: none"></div>', + navigator; + + beforeEach(function () { + $(document.body).append(htmlContainer); + widget = new Cookie(); + navigator = window.navigator; + }); + + afterEach(function () { + window.navigator = navigator; + }); + + it('verify cookie-status initialization', function () { + expect($.fn.cookieStatus).toBeDefined(); + window.navigator = { + cookieEnabled: false + }; + widget._init(); + expect($('.cookie-status').length).toBe(1); + expect($(document.body).html()).toContain('<aside role="dialog" class="modal-popup'); + }); + + }); +}); From 1692711ef4ab9368c58b3d7a640ebf995818c53d Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Thu, 6 Feb 2020 15:41:33 +0200 Subject: [PATCH 1137/1143] refactor per review commet, add new cases --- .../view/frontend/web/js/cookie-status.test.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Theme/view/frontend/web/js/cookie-status.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Theme/view/frontend/web/js/cookie-status.test.js index bd35e0d0bd9f5..03c6b5f57dc07 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Theme/view/frontend/web/js/cookie-status.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Theme/view/frontend/web/js/cookie-status.test.js @@ -25,13 +25,25 @@ define([ window.navigator = navigator; }); - it('verify cookie-status initialization', function () { + it('verify initialization cookieStatus widget', function () { + expect($.fn.cookieStatus).toBeDefined(); + }); + + it('verify that modal does not shows when cookies are supported', function () { + expect($.fn.cookieStatus).toBeDefined(); + window.navigator = { + cookieEnabled: true + }; + widget._init(); + expect($(document.body).html()).not.toContain('<aside role="dialog" class="modal-popup'); + }); + + it('shows the modal when cookies are not supported', function () { expect($.fn.cookieStatus).toBeDefined(); window.navigator = { cookieEnabled: false }; widget._init(); - expect($('.cookie-status').length).toBe(1); expect($(document.body).html()).toContain('<aside role="dialog" class="modal-popup'); }); From 78e138675193a41a65ee2f7f8b96fae21101a016 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Thu, 6 Feb 2020 15:42:37 +0200 Subject: [PATCH 1138/1143] remove duplicated check --- .../Magento/Theme/view/frontend/web/js/cookie-status.test.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Theme/view/frontend/web/js/cookie-status.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Theme/view/frontend/web/js/cookie-status.test.js index 03c6b5f57dc07..3002122e3455f 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Theme/view/frontend/web/js/cookie-status.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Theme/view/frontend/web/js/cookie-status.test.js @@ -30,7 +30,6 @@ define([ }); it('verify that modal does not shows when cookies are supported', function () { - expect($.fn.cookieStatus).toBeDefined(); window.navigator = { cookieEnabled: true }; @@ -39,7 +38,6 @@ define([ }); it('shows the modal when cookies are not supported', function () { - expect($.fn.cookieStatus).toBeDefined(); window.navigator = { cookieEnabled: false }; From 1b1c8bf17bfd4b1a252395f33593faedbcce49f1 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Thu, 6 Feb 2020 15:54:16 +0200 Subject: [PATCH 1139/1143] rename tests --- .../Magento/Theme/view/frontend/web/js/cookie-status.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Theme/view/frontend/web/js/cookie-status.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Theme/view/frontend/web/js/cookie-status.test.js index 3002122e3455f..9b302d91d2007 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Theme/view/frontend/web/js/cookie-status.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Theme/view/frontend/web/js/cookie-status.test.js @@ -25,11 +25,11 @@ define([ window.navigator = navigator; }); - it('verify initialization cookieStatus widget', function () { + it('defines cookieStatus widget', function () { expect($.fn.cookieStatus).toBeDefined(); }); - it('verify that modal does not shows when cookies are supported', function () { + it('does not show a modal when cookies are supported', function () { window.navigator = { cookieEnabled: true }; From 14112c0c79921773973a088731a7cce8a1d598da Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Thu, 6 Feb 2020 16:33:16 +0200 Subject: [PATCH 1140/1143] clear test data after each --- .../Magento/Theme/view/frontend/web/js/cookie-status.test.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Theme/view/frontend/web/js/cookie-status.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Theme/view/frontend/web/js/cookie-status.test.js index 9b302d91d2007..67ba24fe3bcfb 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Theme/view/frontend/web/js/cookie-status.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Theme/view/frontend/web/js/cookie-status.test.js @@ -1,4 +1,3 @@ - /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. @@ -16,9 +15,11 @@ define([ navigator; beforeEach(function () { - $(document.body).append(htmlContainer); widget = new Cookie(); navigator = window.navigator; + $('.modal-popup').remove(); + $('#cookie-status').remove(); + $(document.body).append(htmlContainer); }); afterEach(function () { From 75b03e05c592075cf0619e419ac54d8bf62e34af Mon Sep 17 00:00:00 2001 From: Lachlan Turner <lachlan.turner@aligent.com.au> Date: Fri, 7 Feb 2020 08:41:55 +1030 Subject: [PATCH 1141/1143] #26622 - Remove unnecessary new lines and variable declaration, and make function private --- app/code/Magento/SalesRule/Model/Validator.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/SalesRule/Model/Validator.php b/app/code/Magento/SalesRule/Model/Validator.php index 8292e9c313b66..cdaac97fe6fb5 100644 --- a/app/code/Magento/SalesRule/Model/Validator.php +++ b/app/code/Magento/SalesRule/Model/Validator.php @@ -410,11 +410,8 @@ public function initTotals($items, Address $address) * @param Rule $rule * @return bool */ - protected function isValidItemForRule( - AbstractItem $item, - Rule $rule - ) { - /** @var AbstractItem $item */ + private function isValidItemForRule(AbstractItem $item, Rule $rule) + { if ($item->getParentItemId()) { return false; } From a037edfe8c14675a89e5e2f6839bf401ac9e253c Mon Sep 17 00:00:00 2001 From: Lachlan Turner <lachlan.turner@aligent.com.au> Date: Fri, 7 Feb 2020 08:43:05 +1030 Subject: [PATCH 1142/1143] #26622 - Fix return values of mock object functions --- .../SalesRule/Test/Unit/Model/ValidatorTest.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/SalesRule/Test/Unit/Model/ValidatorTest.php b/app/code/Magento/SalesRule/Test/Unit/Model/ValidatorTest.php index 30b198e5b9199..946963dd8d234 100644 --- a/app/code/Magento/SalesRule/Test/Unit/Model/ValidatorTest.php +++ b/app/code/Magento/SalesRule/Test/Unit/Model/ValidatorTest.php @@ -370,20 +370,20 @@ public function testInitTotalsCanApplyDiscount() $validator->expects($this->at(0))->method('isValid')->with($item1)->willReturn(false); $validator->expects($this->at(1))->method('isValid')->with($item2)->willReturn(true); - $item1->expects($this->any())->method('getParentItemId')->willReturn(false); - $item1->expects($this->any())->method('getParentItem')->willReturn(false); + $item1->expects($this->any())->method('getParentItemId')->willReturn(null); + $item1->expects($this->any())->method('getParentItem')->willReturn(null); $item1->expects($this->never())->method('getDiscountCalculationPrice'); $item1->expects($this->never())->method('getBaseDiscountCalculationPrice'); - $item2->expects($this->any())->method('getParentItemId')->willReturn(false); - $item2->expects($this->any())->method('getParentItem')->willReturn(false); + $item2->expects($this->any())->method('getParentItemId')->willReturn(null); + $item2->expects($this->any())->method('getParentItem')->willReturn(null); $item2->expects($this->any())->method('getDiscountCalculationPrice')->willReturn(50); $item2->expects($this->once())->method('getBaseDiscountCalculationPrice')->willReturn(50); - $item3->expects($this->any())->method('getParentItemId')->willReturn(false); - $item3->expects($this->any())->method('getParentItem')->willReturn(true); + $item3->expects($this->any())->method('getParentItemId')->willReturn(null); + $item3->expects($this->any())->method('getParentItem')->willReturn($item1); $item3->expects($this->never())->method('getDiscountCalculationPrice'); $item3->expects($this->never())->method('getBaseDiscountCalculationPrice'); - $item4->expects($this->any())->method('getParentItemId')->willReturn(true); - $item4->expects($this->any())->method('getParentItem')->willReturn(false); + $item4->expects($this->any())->method('getParentItemId')->willReturn(12345); + $item4->expects($this->any())->method('getParentItem')->willReturn(null); $item4->expects($this->never())->method('getDiscountCalculationPrice'); $item4->expects($this->never())->method('getBaseDiscountCalculationPrice'); $this->utility->expects($this->once())->method('getItemQty')->willReturn(1); From 05ac25997d5fa5f7a7e446c18d1c361dbe629988 Mon Sep 17 00:00:00 2001 From: DianaRusin <rusind95@gmail.com> Date: Fri, 7 Feb 2020 15:23:28 +0200 Subject: [PATCH 1143/1143] MC-31128: Refund Offline button is disabled because of JS error --- .../Test/Mftf/ActionGroup/SubmitCreditMemoActionGroup.xml | 4 ++-- .../Sales/Test/Mftf/Section/AdminCreditMemoTotalSection.xml | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/SubmitCreditMemoActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/SubmitCreditMemoActionGroup.xml index fbd2a0047d558..2605adbfc91a7 100644 --- a/app/code/Magento/Sales/Test/Mftf/ActionGroup/SubmitCreditMemoActionGroup.xml +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/SubmitCreditMemoActionGroup.xml @@ -10,8 +10,8 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="SubmitCreditMemoActionGroup"> <grabFromCurrentUrl regex="~/order_id/(\d+)/~" stepKey="grabOrderId"/> - <waitForElementVisible selector="{{AdminCreditMemoTotalSection.submitRefundOffline}}" stepKey="waitButtonEnabled"/> - <click selector="{{AdminCreditMemoTotalSection.submitRefundOffline}}" stepKey="clickSubmitCreditMemo"/> + <waitForElementVisible selector="{{AdminCreditMemoTotalSection.submitRefundOfflineEnabled}}" stepKey="waitButtonEnabled"/> + <click selector="{{AdminCreditMemoTotalSection.submitRefundOfflineEnabled}}" stepKey="clickSubmitCreditMemo"/> <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForMessageAppears"/> <see selector="{{AdminMessagesSection.success}}" userInput="You created the credit memo." stepKey="seeCreditMemoCreateSuccess"/> <seeInCurrentUrl url="{{AdminOrderDetailsPage.url}}$grabOrderId" stepKey="seeViewOrderPageCreditMemo"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Section/AdminCreditMemoTotalSection.xml b/app/code/Magento/Sales/Test/Mftf/Section/AdminCreditMemoTotalSection.xml index 6b4bdf69361a5..8efd373f54543 100644 --- a/app/code/Magento/Sales/Test/Mftf/Section/AdminCreditMemoTotalSection.xml +++ b/app/code/Magento/Sales/Test/Mftf/Section/AdminCreditMemoTotalSection.xml @@ -19,6 +19,7 @@ <element name="emailCopy" type="checkbox" selector=".order-totals-actions #send_email"/> <element name="refundStoreCredit" type="checkbox" selector=".order-totals-actions .field-refund-store-credit input[type='checkbox']"/> <element name="submitRefundOffline" type="button" selector=".order-totals-actions button[data-ui-id='order-items-submit-button']" timeout="30"/> + <element name="submitRefundOfflineEnabled" type="button" selector=".order-totals-actions button[data-ui-id='order-items-submit-button']:not(.disabled)" timeout="60"/> <element name="creditMemoItem" type="text" selector="#sales_order_view_tabs_order_creditmemos"/> <element name="viewMemo" type="text" selector="div#sales_order_view_tabs_order_creditmemos_content a.action-menu-item"/> <element name="refundOffline" type="button" selector=".order-totals-actions button[data-ui-id='order-items-submit-offline']"/>